/** * Reserved identifiers per target language. * * Single source of truth for "what can't be a legal identifier in the * emitted code." Consumed by: * - the realize γ-stub renderers (per-owner-runner, per-action-recovery) * which use re-export-rename when an action name is reserved * - the step-conventions matcher's safety net (returns no-match when * entity-name extraction yields a reserved word — typically an * adjective like "new" being grabbed instead of the actual noun) * * Structured as per-target-language because the set differs by output * language. Today SpecVerse only emits TypeScript, so only the TS set * is populated. Future Python / Go / Rust targets get their own * exported set; consumers select by target. * * NL stopwords / adjectives (`new`, `existing`, `the`, …) are a * SEPARATE concern — they belong to the input (English spec text), not * the output language, and live with the matcher's pattern-level * adjective-skip. Don't merge them into this list: the consumers + the * tuning lifecycle are different. */ /** * Reserved + restricted identifiers for TypeScript / JavaScript. * * Covers ES2022 strict-mode reserved words plus a few names that * cause TS-level confusion when used as identifiers (`true`, `false`, * `null`, `undefined` — technically literals/values, but emitting * `const true = ...` is broken everywhere). * * Lowercase entries only — callers should `.toLowerCase()` before * lookup (matches the JS keyword convention). */ export declare const TS_RESERVED_WORDS: ReadonlySet; /** * Returns true when `name` is reserved as a TypeScript identifier * (case-insensitive match). Use in code-emitters to refuse to emit * `const = ...` for unsafe inputs, and in matchers to bail out * of an extraction that produced a reserved word as the entity name. */ export declare function isReservedTsIdentifier(name: string): boolean; /** * Sanitise an extracted entity name (something that must map to a * real schema/collection/table reference). Returns the lowerCamel * identifier, OR `null` when the lowerCamel form would collide with * a TS reserved word — caller treats null as "extraction failed, fall * through." Empty/whitespace input also returns null. * * Checks the *lowerCamel-form* (`name.charAt(0).toLowerCase() + …`) * against the reserved set, because the entity reference emitted * downstream is `prisma..create` — so a capitalised input * like `"New"` collides via the lowercase-first-char convention even * though `"New"` itself is a legal identifier. * * Examples: * safeEntityName('Player') → 'player' * safeEntityName('OrderItem') → 'orderItem' * safeEntityName('new') → null // would emit `prisma.new.create` * safeEntityName('New') → null // same — lowerCamel form is `new` * safeEntityName('') → null */ export declare function safeEntityName(name: string): string | null; /** * Sanitise a name that will become a function declaration. Returns * the identifier to use (possibly suffix-renamed) plus a `reserved` * flag — when `true`, the caller must emit a re-export so consumers * importing the original name continue to resolve: * * const { name, reserved } = safeFunctionName('delete'); * // ↳ { name: 'delete_', reserved: true } * * async function delete_(input: any): Promise { ... } * export { delete_ as delete }; // ← needed because reserved * * For non-reserved names, returns the input unchanged with * `reserved: false` and the caller emits `export async function `. * * Case-sensitive on the literal identifier: `safeFunctionName('Delete')` * passes through unchanged because `Delete` (capital D) is a legal TS * identifier — only the keyword `delete` (lowercase) is reserved. */ export declare function safeFunctionName(name: string): { name: string; reserved: boolean; }; //# sourceMappingURL=reserved-words.d.ts.map