@cerios/salesforce-sobjectly 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -13
- package/dist/cli.cjs +4 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +5 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/{codegen-CSx0WAtK.mjs → codegen-0L2ebG9j.mjs} +410 -117
- package/dist/codegen-0L2ebG9j.mjs.map +1 -0
- package/dist/{codegen-BgDgU2RR.cjs → codegen-Daud-Grz.cjs} +419 -112
- package/dist/codegen-Daud-Grz.cjs.map +1 -0
- package/dist/codegen.cjs +3 -1
- package/dist/codegen.d.cts +117 -35
- package/dist/codegen.d.mts +117 -35
- package/dist/codegen.mjs +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.mts +15 -4
- package/dist/index.mjs +1 -1
- package/dist/{sf-cli-CtWtdkJ0.mjs → sf-cli-D2PgjErx.mjs} +40 -17
- package/dist/sf-cli-D2PgjErx.mjs.map +1 -0
- package/dist/{sf-cli-DEVZQTR7.cjs → sf-cli-S2BrCbik.cjs} +40 -17
- package/dist/sf-cli-S2BrCbik.cjs.map +1 -0
- package/package.json +1 -1
- package/sobjectly.config.schema.json +94 -18
- package/dist/codegen-BgDgU2RR.cjs.map +0 -1
- package/dist/codegen-CSx0WAtK.mjs.map +0 -1
- package/dist/sf-cli-CtWtdkJ0.mjs.map +0 -1
- package/dist/sf-cli-DEVZQTR7.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-0L2ebG9j.mjs","names":["IDENTIFIER","IDENTIFIER","IDENTIFIER"],"sources":["../src/codegen/emit.ts","../src/codegen/type-mapper.ts","../src/codegen/picklist-types.ts","../src/codegen/generator.ts","../src/codegen/validate-config.ts","../src/codegen/load-config.ts","../src/codegen/config.ts","../src/codegen/init.ts","../src/codegen/prompter.ts","../src/codegen/index.ts"],"sourcesContent":["import type { CodegenField } from \"./type-mapper\";\n\n/** Helpers shared by the modules that emit generated source. */\n\nexport const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/** Fields sorted by name, `Id` first, so the output is deterministic. */\nexport function sortedFields(describe: { readonly fields: readonly CodegenField[] }): CodegenField[] {\n\treturn [...describe.fields].sort((a, b) => (a.name === \"Id\" ? -1 : b.name === \"Id\" ? 1 : compare(a.name, b.name)));\n}\n\n/** An object key: the bare name when it is an identifier, otherwise a quoted string. */\nexport function propertyKey(name: string): string {\n\treturn IDENTIFIER.test(name) ? name : JSON.stringify(name);\n}\n\nexport function escapeComment(value: string | null | undefined): string {\n\treturn String(value ?? \"\")\n\t\t.replace(/\\*\\//g, \"*\\\\/\")\n\t\t.replace(/\\r?\\n/g, \" \");\n}\n\nexport function compare(a: string, b: string): number {\n\treturn a < b ? -1 : a > b ? 1 : 0;\n}\n","import type { FieldDescribe } from \"../types/describe\";\n\nimport type { PicklistMode } from \"./config\";\n\n/** The subset of a field describe the generator needs. */\nexport type CodegenField = Pick<\n\tFieldDescribe,\n\t| \"name\"\n\t| \"label\"\n\t| \"type\"\n\t| \"nillable\"\n\t| \"createable\"\n\t| \"updateable\"\n\t| \"defaultedOnCreate\"\n\t| \"referenceTo\"\n\t| \"relationshipName\"\n> &\n\tPartial<Pick<FieldDescribe, \"picklistValues\" | \"restrictedPicklist\" | \"externalId\" | \"idLookup\">>;\n\nexport const ADDRESS_TYPE = \"SalesforceAddress\";\nexport const GEOLOCATION_TYPE = \"SalesforceGeolocation\";\n\n/** Maps each Salesforce field type to a TypeScript type. Types not listed become `unknown`. */\nexport const FIELD_TYPE_MAP: Readonly<Record<string, string>> = {\n\tboolean: \"boolean\",\n\tint: \"number\",\n\tlong: \"number\",\n\tdouble: \"number\",\n\tcurrency: \"number\",\n\tpercent: \"number\",\n\t/** ISO date, `yyyy-MM-dd`. */\n\tdate: \"string\",\n\t/** ISO date-time, e.g. `2026-01-31T12:00:00.000+0000`. */\n\tdatetime: \"string\",\n\t/** `HH:mm:ss.SSSZ`. */\n\ttime: \"string\",\n\tid: \"string\",\n\treference: \"string\",\n\tstring: \"string\",\n\ttextarea: \"string\",\n\tpicklist: \"string\",\n\t/** Values separated by `;`. */\n\tmultipicklist: \"string\",\n\tcombobox: \"string\",\n\temail: \"string\",\n\tphone: \"string\",\n\turl: \"string\",\n\tencryptedstring: \"string\",\n\t/** Base64-encoded content. */\n\tbase64: \"string\",\n\taddress: ADDRESS_TYPE,\n\tlocation: GEOLOCATION_TYPE,\n};\n\n/**\n * Returns the TypeScript type for a field, including `| null` for nillable fields. With picklist\n * mode `\"const\"` or `\"enum\"`, `typeName` is the field's named picklist type; it replaces the union.\n */\nexport function mapFieldType(field: CodegenField, picklists: PicklistMode = \"union\", typeName?: string): string {\n\tconst base = picklistType(field, picklists, typeName) ?? FIELD_TYPE_MAP[field.type] ?? \"unknown\";\n\treturn field.nillable && base !== \"unknown\" ? `${base} | null` : base;\n}\n\nfunction picklistType(field: CodegenField, picklists: PicklistMode, typeName: string | undefined): string | undefined {\n\tif (picklists === \"string\" || (field.type !== \"picklist\" && field.type !== \"combobox\")) {\n\t\treturn undefined;\n\t}\n\tconst values = activePicklistValues(field);\n\tif (values.length === 0) {\n\t\treturn undefined;\n\t}\n\tconst members =\n\t\tpicklists !== \"union\" && typeName !== undefined\n\t\t\t? typeName\n\t\t\t: values.map((value) => JSON.stringify(value)).join(\" | \");\n\treturn field.restrictedPicklist && field.type === \"picklist\" ? members : `${members} | (string & {})`;\n}\n\n/** The distinct active values of a picklist, multi-select picklist or combobox, in describe order. */\nexport function activePicklistValues(field: CodegenField): string[] {\n\tif (field.type !== \"picklist\" && field.type !== \"multipicklist\" && field.type !== \"combobox\") {\n\t\treturn [];\n\t}\n\treturn [...new Set((field.picklistValues ?? []).filter((entry) => entry.active).map((entry) => entry.value))];\n}\n","import type { PicklistMode } from \"./config\";\nimport { compare, escapeComment, IDENTIFIER, propertyKey, sortedFields } from \"./emit\";\nimport type { CodegenDescribe } from \"./generator\";\nimport { activePicklistValues, type CodegenField } from \"./type-mapper\";\n\n/** The picklist modes that emit a named type per picklist. */\nexport type NamedPicklistMode = Extract<PicklistMode, \"const\" | \"enum\">;\n\nexport function isNamedPicklistMode(mode: PicklistMode): mode is NamedPicklistMode {\n\treturn mode === \"const\" || mode === \"enum\";\n}\n\n/** Named picklist types per sObject and field, e.g. `Case` -> `Status` -> `CaseStatus`. */\nexport type PicklistTypeNames = ReadonlyMap<string, ReadonlyMap<string, string>>;\n\n/** Appended to a picklist type name that is already taken, e.g. by the `CaseStatus` sObject. */\nconst CLASH_SUFFIX = \"Picklist\";\n\n/**\n * Names the type of every picklist with active values: sObject and field in PascalCase, e.g.\n * `Case.Status` -> `CaseStatus` and `Case.Status__c` -> `CaseStatusCustom`. A name that is in\n * `taken` (the sObjects and other names the file defines) or already used by another picklist gets\n * the suffix `Picklist`; when that is taken too, this throws.\n */\nexport function picklistTypeNames(\n\tdescribes: readonly CodegenDescribe[],\n\ttaken: ReadonlySet<string>,\n): PicklistTypeNames {\n\t// Name -> the picklist that uses it, or undefined for names the file defines otherwise.\n\tconst used = new Map<string, string | undefined>([...taken].map((name) => [name, undefined]));\n\tconst result = new Map<string, Map<string, string>>();\n\tfor (const describe of [...describes].sort((a, b) => compare(a.name, b.name))) {\n\t\tconst names = new Map<string, string>();\n\t\tfor (const field of sortedFields(describe).filter((item) => activePicklistValues(item).length > 0)) {\n\t\t\tconst base = `${pascalApiName(describe.name, \"sobject\")}${pascalApiName(field.name, \"field\")}`;\n\t\t\tif (IDENTIFIER.test(base)) {\n\t\t\t\tconst picklist = `${describe.name}.${field.name}`;\n\t\t\t\tconst name = resolveName(base, picklist, used);\n\t\t\t\tused.set(name, picklist);\n\t\t\t\tnames.set(field.name, name);\n\t\t\t}\n\t\t}\n\t\tif (names.size > 0) {\n\t\t\tresult.set(describe.name, names);\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction resolveName(base: string, picklist: string, used: ReadonlyMap<string, string | undefined>): string {\n\tconst name = used.has(base) ? `${base}${CLASH_SUFFIX}` : base;\n\tif (used.has(name)) {\n\t\tconst owner = used.get(name);\n\t\tconst other = owner === undefined ? \"a type the generated file defines\" : `the picklist type for ${owner}`;\n\t\tthrow new Error(\n\t\t\t`The picklist type \"${name}\" for ${picklist} clashes with ${other}; exclude one of the sObjects or use picklists: \"union\".`,\n\t\t);\n\t}\n\treturn name;\n}\n\n/**\n * An API name in PascalCase without underscores. A field's `__c` becomes `Custom`\n * (`Lead_Source__c` -> `LeadSourceCustom`) and an sObject's is dropped (`My_Object__c` ->\n * `MyObject`). Other suffixes are kept: `Foo__pc` -> `FooPc`, `Config__mdt` -> `ConfigMdt`.\n */\nexport function pascalApiName(name: string, kind: \"sobject\" | \"field\"): string {\n\tconst match = /^(.+?)__([a-z]+)$/.exec(name);\n\tconst body = match ? match[1] : name;\n\tconst suffix = match ? match[2] : \"\";\n\tconst suffixPart = suffix === \"c\" ? (kind === \"field\" ? \"Custom\" : \"\") : capitalize(suffix);\n\tconst bodyPart = body\n\t\t.split(\"_\")\n\t\t.filter((part) => part.length > 0)\n\t\t.map(capitalize)\n\t\t.join(\"\");\n\treturn `${bodyPart}${suffixPart}`;\n}\n\nfunction capitalize(value: string): string {\n\treturn value.charAt(0).toUpperCase() + value.slice(1);\n}\n\n/**\n * The member names for a picklist's values, in the same order. A value that is an identifier is\n * its own name; other values are sanitized (`\"Closed Won\"` -> `Closed_Won`, `\"3rd Party\"` ->\n * `_3rd_Party`). When the sanitized name is empty or taken, the value itself is the (quoted) name.\n */\nexport function picklistMemberKeys(values: readonly string[], mode: NamedPicklistMode): string[] {\n\tconst used = new Set<string>();\n\tconst claim = (key: string): string => {\n\t\tused.add(key);\n\t\treturn key;\n\t};\n\t// `__proto__` would set the prototype of the const object; enums can't have numeric member names.\n\tconst usable = (key: string): boolean =>\n\t\tkey.length > 0 && key !== \"__proto__\" && !used.has(key) && (mode === \"const\" || !isNumericName(key));\n\t// Identifier values claim their own name first, so a sanitized value can't take it.\n\tconst own = values.map((value) => (IDENTIFIER.test(value) && usable(value) ? claim(value) : undefined));\n\treturn values.map((value, index) => {\n\t\tconst ownKey = own[index];\n\t\tif (ownKey !== undefined) {\n\t\t\treturn ownKey;\n\t\t}\n\t\tconst sanitized = sanitizeKey(value);\n\t\tif (usable(sanitized)) {\n\t\t\treturn claim(sanitized);\n\t\t}\n\t\tif (usable(value)) {\n\t\t\treturn claim(value);\n\t\t}\n\t\tlet counter = 2;\n\t\twhile (!usable(`${sanitized || \"_\"}_${counter}`)) {\n\t\t\tcounter++;\n\t\t}\n\t\treturn claim(`${sanitized || \"_\"}_${counter}`);\n\t});\n}\n\nfunction sanitizeKey(value: string): string {\n\tconst key = value\n\t\t.normalize(\"NFKD\")\n\t\t.replace(/\\p{M}/gu, \"\")\n\t\t.replace(/[^A-Za-z0-9_]+/g, \"_\")\n\t\t.replace(/^_+|_+$/g, \"\");\n\treturn /^[0-9]/.test(key) ? `_${key}` : key;\n}\n\n/** Names TypeScript rejects as enum members because they are numeric, e.g. `\"1\"` or `\"-1\"`. */\nfunction isNumericName(key: string): boolean {\n\tconst number = Number(key);\n\treturn Number.isFinite(number) && String(number) === key;\n}\n\n/** The named type declarations for one sObject's picklists, in field order; `\"\"` when there are none. */\nexport function picklistDeclarations(\n\tdescribe: CodegenDescribe,\n\tnames: ReadonlyMap<string, string> | undefined,\n\tmode: NamedPicklistMode,\n): string {\n\tif (!names) {\n\t\treturn \"\";\n\t}\n\treturn sortedFields(describe)\n\t\t.flatMap((field) => {\n\t\t\tconst name = names.get(field.name);\n\t\t\treturn name === undefined ? [] : [declaration(describe.name, field, name, mode)];\n\t\t})\n\t\t.join(\"\\n\\n\");\n}\n\nfunction declaration(sobject: string, field: CodegenField, name: string, mode: NamedPicklistMode): string {\n\tconst values = activePicklistValues(field);\n\tconst keys = picklistMemberKeys(values, mode);\n\tconst doc = `/** Active values of ${escapeComment(`${sobject}.${field.name}`)} (${escapeComment(field.type)}). */`;\n\tif (mode === \"enum\") {\n\t\tconst members = values.map((value, index) => `\\t${propertyKey(keys[index])} = ${JSON.stringify(value)},`);\n\t\treturn [doc, `export enum ${name} {`, ...members, \"}\"].join(\"\\n\");\n\t}\n\tconst members = values.map((value, index) => `\\t${propertyKey(keys[index])}: ${JSON.stringify(value)},`);\n\treturn [\n\t\tdoc,\n\t\t`export const ${name} = {`,\n\t\t...members,\n\t\t\"} as const;\",\n\t\t`export type ${name} = (typeof ${name})[keyof typeof ${name}];`,\n\t].join(\"\\n\");\n}\n","import { createHash } from \"node:crypto\";\n\nimport type { ApiVersion } from \"../types/common\";\nimport type { ChildRelationship, RecordTypeInfo } from \"../types/describe\";\n\nimport type { PicklistMode } from \"./config\";\nimport { compare, escapeComment, IDENTIFIER, propertyKey, sortedFields } from \"./emit\";\nimport { isNamedPicklistMode, picklistDeclarations, picklistTypeNames } from \"./picklist-types\";\nimport { activePicklistValues, ADDRESS_TYPE, type CodegenField, GEOLOCATION_TYPE, mapFieldType } from \"./type-mapper\";\n\n/** The subset of an sObject describe the generator needs. */\nexport interface CodegenDescribe {\n\tname: string;\n\tlabel?: string;\n\tfields: CodegenField[];\n\tchildRelationships: Pick<ChildRelationship, \"childSObject\" | \"field\" | \"relationshipName\">[];\n\trecordTypeInfos?: Pick<RecordTypeInfo, \"developerName\">[];\n}\n\nexport interface GenerateSourceOptions {\n\texcludeCreateFields?: Partial<Record<string, readonly string[]>>;\n\texcludeUpdateFields?: Partial<Record<string, readonly string[]>>;\n\tpicklists?: PicklistMode;\n\timportSource?: string;\n\t/** When set, the output exports it as `API_VERSION`, so the client can use the same version. */\n\tapiVersion?: ApiVersion;\n\t/** Emit the `PICKLIST_VALUES` and `RECORD_TYPES` runtime constants. Defaults to `true`. */\n\tconstants?: boolean;\n}\n\n/** Field types whose kind is recorded in the registry's `fieldKinds`. */\nconst FIELD_KINDS = new Set([\"date\", \"datetime\", \"time\", \"multipicklist\"]);\n\n/**\n * Generates the TypeScript source for a set of sObject describes: a read interface, create\n * and update input types per sObject, and the `SObjectRegistry` that ties them together. With\n * picklist mode `\"const\"` or `\"enum\"`, each picklist also gets a named type before its sObject.\n * The output is deterministic: sObjects are sorted by name and fields by name (`Id` first).\n */\nexport function generateSource(describes: readonly CodegenDescribe[], options: GenerateSourceOptions = {}): string {\n\tconst sorted = [...describes].sort((a, b) => compare(a.name, b.name));\n\tconst definedNames = assertGeneratableNames(sorted);\n\tconst names = new Set(sorted.map((describe) => describe.name));\n\tconst picklists = options.picklists ?? \"union\";\n\tconst picklistTypes = isNamedPicklistMode(picklists) ? picklistTypeNames(sorted, definedNames) : undefined;\n\tconst sections = [imports(sorted, options.importSource ?? \"@cerios/salesforce-sobjectly\")];\n\tconst objectHashes: string[] = [];\n\n\tfor (const describe of sorted) {\n\t\tconst typeNames = picklistTypes?.get(describe.name);\n\t\tconst objectSections = [\n\t\t\tisNamedPicklistMode(picklists) ? picklistDeclarations(describe, typeNames, picklists) : \"\",\n\t\t\treadInterface(describe, picklists, typeNames),\n\t\t\tinputType(describe, \"CreateInput\", \"createable\", lookup(options.excludeCreateFields, describe.name)),\n\t\t\tinputType(describe, \"UpdateInput\", \"updateable\", lookup(options.excludeUpdateFields, describe.name)),\n\t\t].filter((section) => section.length > 0);\n\t\tsections.push(...objectSections);\n\t\tconst fingerprint = [\n\t\t\t...objectSections,\n\t\t\tregistryEntry(describe, names),\n\t\t\toptions.constants === false ? \"\" : picklistEntry(describe),\n\t\t].join(\"\\n\");\n\t\tobjectHashes.push(`${describe.name}:${sha256(fingerprint).slice(0, OBJECT_HASH_LENGTH)}`);\n\t}\n\tsections.push(registry(sorted, names));\n\tif (options.constants !== false) {\n\t\tsections.push(picklistConstants(sorted), recordTypeConstants(sorted));\n\t}\n\tif (options.apiVersion) {\n\t\tsections.push(apiVersionConstant(options.apiVersion));\n\t}\n\tconst body = sections.filter((section) => section.length > 0).join(\"\\n\\n\");\n\treturn `${header(sha256(body), objectHashes)}\\n\\n${body}\\n`;\n}\n\n/** Names the generated file uses itself; an sObject with one of these names would break it. */\nconst RESERVED_TYPE_NAMES = new Set([\n\t\"Record\",\n\t\"Pick\",\n\t\"Partial\",\n\t\"SObjectRegistry\",\n\t\"PICKLIST_VALUES\",\n\t\"RECORD_TYPES\",\n\t\"API_VERSION\",\n\tADDRESS_TYPE,\n\tGEOLOCATION_TYPE,\n]);\n\n/**\n * Fails with a clear message for sObject names the generated TypeScript can't represent. Returns\n * every name the file defines apart from picklist types, so those can avoid them.\n */\nfunction assertGeneratableNames(describes: readonly CodegenDescribe[]): Set<string> {\n\tconst seen = new Map<string, string>();\n\tconst generated = new Set(\n\t\tdescribes.flatMap((describe) => [`${describe.name}CreateInput`, `${describe.name}UpdateInput`]),\n\t);\n\tfor (const { name } of describes) {\n\t\tif (!IDENTIFIER.test(name)) {\n\t\t\tthrow new Error(`sObject name \"${name}\" is not a valid TypeScript identifier.`);\n\t\t}\n\t\tif (RESERVED_TYPE_NAMES.has(name) || generated.has(name)) {\n\t\t\tthrow new Error(`sObject name \"${name}\" clashes with a type the generated file defines; exclude it.`);\n\t\t}\n\t\tconst previous = seen.get(name.toLowerCase());\n\t\tif (previous !== undefined) {\n\t\t\tthrow new Error(`sObjects \"${previous}\" and \"${name}\" differ only in case; list each sObject once.`);\n\t\t}\n\t\tseen.set(name.toLowerCase(), name);\n\t}\n\treturn new Set([...RESERVED_TYPE_NAMES, ...generated, ...describes.map((describe) => describe.name)]);\n}\n\n/** Looks up a per-sObject option case-insensitively (sObject names are case-insensitive in Salesforce). */\nfunction lookup(map: Partial<Record<string, readonly string[]>> | undefined, name: string): readonly string[] {\n\tif (!map) {\n\t\treturn [];\n\t}\n\tconst key = Object.keys(map).find((candidate) => candidate.toLowerCase() === name.toLowerCase());\n\treturn key === undefined ? [] : (map[key] ?? []);\n}\n\nconst CONTENT_HASH_PREFIX = \"// sobjectly-content-hash: sha256:\";\nconst OBJECT_HASHES_PREFIX = \"// sobjectly-sobjects: \";\nconst OBJECT_HASH_LENGTH = 12;\n\nfunction header(contentHash: string, objectHashes: readonly string[]): string {\n\treturn [\n\t\t\"// ──────────────────────────────────────────────────────────────\",\n\t\t\"// AUTO-GENERATED by @cerios/salesforce-sobjectly (`sobjectly generate`).\",\n\t\t\"// Do not edit manually; re-run the generator instead.\",\n\t\t\"// ──────────────────────────────────────────────────────────────\",\n\t\t`${CONTENT_HASH_PREFIX}${contentHash}`,\n\t\t`${OBJECT_HASHES_PREFIX}${objectHashes.join(\",\")}`,\n\t\t\"/* eslint-disable */\",\n\t].join(\"\\n\");\n}\n\n/** The content hashes a generated file records in its header. */\nexport interface GeneratedFileHashes {\n\t/** SHA-256 of the unformatted generated content; formatting changes don't affect it. */\n\tcontentHash: string;\n\t/** Short hash per sObject, to tell which sObjects changed. */\n\tsobjects: Map<string, string>;\n}\n\n/** Reads the content hashes from a generated file's header (also after reformatting). */\nexport function readGeneratedHashes(source: string): GeneratedFileHashes | undefined {\n\tconst lines = source.split(/\\r?\\n/).map((line) => line.trim());\n\tconst hashLine = lines.find((line) => line.startsWith(CONTENT_HASH_PREFIX));\n\tif (!hashLine) {\n\t\treturn undefined;\n\t}\n\tconst objectsLine = lines.find((line) => line.startsWith(OBJECT_HASHES_PREFIX)) ?? OBJECT_HASHES_PREFIX;\n\tconst sobjects = new Map<string, string>();\n\tfor (const entry of objectsLine.slice(OBJECT_HASHES_PREFIX.length).split(\",\")) {\n\t\tconst [name, hash] = entry.split(\":\");\n\t\tif (name && hash) {\n\t\t\tsobjects.set(name, hash);\n\t\t}\n\t}\n\treturn { contentHash: hashLine.slice(CONTENT_HASH_PREFIX.length), sobjects };\n}\n\nfunction sha256(text: string): string {\n\treturn createHash(\"sha256\").update(text).digest(\"hex\");\n}\n\nfunction imports(describes: readonly CodegenDescribe[], importSource: string): string {\n\tconst used: string[] = [];\n\tconst fields = describes.flatMap((describe) => describe.fields);\n\tif (fields.some((field) => field.type === \"address\")) {\n\t\tused.push(ADDRESS_TYPE);\n\t}\n\tif (fields.some((field) => field.type === \"location\")) {\n\t\tused.push(GEOLOCATION_TYPE);\n\t}\n\treturn used.length > 0 ? `import type { ${used.join(\", \")} } from ${JSON.stringify(importSource)};` : \"\";\n}\n\nfunction readInterface(\n\tdescribe: CodegenDescribe,\n\tpicklists: PicklistMode,\n\ttypeNames: ReadonlyMap<string, string> | undefined,\n): string {\n\tconst lines = sortedFields(describe).map((field) => {\n\t\tconst comment = `\\t/** ${escapeComment(field.label)} (${escapeComment(field.type)}) */`;\n\t\tconst type = mapFieldType(field, picklists, typeNames?.get(field.name));\n\t\treturn `${comment}\\n\\t${propertyKey(field.name)}: ${type};`;\n\t});\n\tconst doc = describe.label ? `/** ${escapeComment(describe.label)} */\\n` : \"\";\n\treturn `${doc}export interface ${describe.name} {\\n${lines.join(\"\\n\")}\\n}`;\n}\n\n/**\n * Create input: required fields are `createable && !nillable && !defaultedOnCreate`; other\n * createable fields are optional. Validation rules and record types can add more requirements\n * at runtime. Update input: every updateable field is optional.\n */\nfunction inputType(\n\tdescribe: CodegenDescribe,\n\tsuffix: \"CreateInput\" | \"UpdateInput\",\n\tflag: \"createable\" | \"updateable\",\n\texcluded: readonly string[],\n): string {\n\tconst typeName = `${describe.name}${suffix}`;\n\tconst excludedNames = new Set(excluded.map((name) => name.toLowerCase()));\n\tconst allowed = sortedFields(describe).filter((field) => field[flag] && !excludedNames.has(field.name.toLowerCase()));\n\tif (allowed.length === 0) {\n\t\treturn `export type ${typeName} = Record<string, never>;`;\n\t}\n\tconst required =\n\t\tsuffix === \"CreateInput\"\n\t\t\t? allowed.filter((field) => !field.nillable && !field.defaultedOnCreate).map((field) => field.name)\n\t\t\t: [];\n\tconst optional = allowed.map((field) => field.name).filter((name) => !required.includes(name));\n\tconst parts: string[] = [];\n\tif (required.length > 0) {\n\t\tparts.push(`Pick<${describe.name}, ${keyUnion(required)}>`);\n\t}\n\tif (optional.length > 0) {\n\t\tparts.push(`Partial<Pick<${describe.name}, ${keyUnion(optional)}>>`);\n\t}\n\treturn `export type ${typeName} = ${parts.join(\" & \")};`;\n}\n\nfunction registry(describes: readonly CodegenDescribe[], names: ReadonlySet<string>): string {\n\tconst entries = describes.map((describe) => registryEntry(describe, names));\n\treturn [\n\t\t\"/**\",\n\t\t\" * Maps every generated sObject to its read, create and update types and its relationships.\",\n\t\t\" * Pass it to the client: `new SalesforceClient<SObjectRegistry>({ ... })`.\",\n\t\t\" */\",\n\t\t\"export interface SObjectRegistry {\",\n\t\t...entries,\n\t\t\"}\",\n\t].join(\"\\n\");\n}\n\nfunction registryEntry(describe: CodegenDescribe, names: ReadonlySet<string>): string {\n\tconst parents = describe.fields\n\t\t.filter(\n\t\t\t(field) =>\n\t\t\t\tfield.relationshipName &&\n\t\t\t\tfield.referenceTo.length === 1 &&\n\t\t\t\tnames.has(field.referenceTo[0]) &&\n\t\t\t\tIDENTIFIER.test(field.relationshipName),\n\t\t)\n\t\t.map((field) => [field.relationshipName as string, field.referenceTo[0]] as const);\n\tconst children = describe.childRelationships\n\t\t.filter(\n\t\t\t(relationship) =>\n\t\t\t\trelationship.relationshipName &&\n\t\t\t\tnames.has(relationship.childSObject) &&\n\t\t\t\tIDENTIFIER.test(relationship.relationshipName),\n\t\t)\n\t\t.map((relationship) => [relationship.relationshipName as string, relationship.childSObject] as const);\n\treturn [\n\t\t`\\t${describe.name}: {`,\n\t\t`\\t\\tread: ${describe.name};`,\n\t\t`\\t\\tcreate: ${describe.name}CreateInput;`,\n\t\t`\\t\\tupdate: ${describe.name}UpdateInput;`,\n\t\t`\\t\\tparents: ${relationshipMap(parents)};`,\n\t\t`\\t\\tchildren: ${relationshipMap(children)};`,\n\t\t`\\t\\texternalIds: ${unionOrNever(externalIdFields(describe))};`,\n\t\t`\\t\\tfieldKinds: ${fieldKindMap(describe)};`,\n\t\t`\\t\\trecordTypes: ${unionOrNever(recordTypeNames(describe))};`,\n\t\t`\\t\\tpolymorphicParents: ${polymorphicMap(describe)};`,\n\t\t\"\\t};\",\n\t].join(\"\\n\");\n}\n\n/** `Id` plus every field marked `externalId` or `idLookup`: the fields upsert accepts. */\nfunction externalIdFields(describe: CodegenDescribe): string[] {\n\tconst names = describe.fields\n\t\t.filter((field) => field.name === \"Id\" || field.externalId === true || field.idLookup === true)\n\t\t.map((field) => field.name);\n\treturn [...new Set(names)].sort(compare);\n}\n\nfunction recordTypeNames(describe: CodegenDescribe): string[] {\n\tconst names = (describe.recordTypeInfos ?? []).map((info) => info.developerName);\n\treturn [...new Set(names.filter((name) => typeof name === \"string\" && name.length > 0))].sort(compare);\n}\n\nfunction fieldKindMap(describe: CodegenDescribe): string {\n\tconst lines = sortedFields(describe)\n\t\t.filter((field) => FIELD_KINDS.has(field.type))\n\t\t.map((field) => `\\t\\t\\t${propertyKey(field.name)}: ${JSON.stringify(field.type)};`);\n\treturn lines.length > 0 ? `{\\n${lines.join(\"\\n\")}\\n\\t\\t}` : \"Record<never, never>\";\n}\n\n/** Lookups with more than one target (e.g. `Owner` -> User or Group); `parents` leaves these out. */\nfunction polymorphicMap(describe: CodegenDescribe): string {\n\tconst entries = new Map<string, string>();\n\tfor (const field of sortedFields(describe)) {\n\t\tconst name = field.relationshipName;\n\t\tif (name && field.referenceTo.length > 1 && IDENTIFIER.test(name) && !entries.has(name)) {\n\t\t\tentries.set(name, unionOrNever([...field.referenceTo].sort(compare)));\n\t\t}\n\t}\n\tconst lines = [...entries.entries()]\n\t\t.sort(([a], [b]) => compare(a, b))\n\t\t.map(([name, targets]) => `\\t\\t\\t${name}: ${targets};`);\n\treturn lines.length > 0 ? `{\\n${lines.join(\"\\n\")}\\n\\t\\t}` : \"Record<never, never>\";\n}\n\n/** `PICKLIST_VALUES`: the active values of every picklist and multi-select picklist field. */\nfunction picklistConstants(describes: readonly CodegenDescribe[]): string {\n\tconst entries = describes.map(picklistEntry).filter((entry) => entry.length > 0);\n\treturn [\n\t\t\"/** Active picklist values per sObject and field, e.g. to loop over every status in a test. */\",\n\t\t`export const PICKLIST_VALUES = {${entries.length > 0 ? `\\n${entries.join(\"\\n\")}\\n` : \"\"}} as const;`,\n\t].join(\"\\n\");\n}\n\n/** One sObject's entry in `PICKLIST_VALUES`, or `\"\"` when it has no picklists. */\nfunction picklistEntry(describe: CodegenDescribe): string {\n\tconst fields = sortedFields(describe)\n\t\t.map((field) => [field.name, activePicklistValues(field)] as const)\n\t\t.filter(([, values]) => values.length > 0)\n\t\t.map(([name, values]) => `\\t\\t${propertyKey(name)}: [${values.map((value) => JSON.stringify(value)).join(\", \")}],`);\n\treturn fields.length > 0 ? `\\t${describe.name}: {\\n${fields.join(\"\\n\")}\\n\\t},` : \"\";\n}\n\n/** `RECORD_TYPES`: the record type DeveloperNames per sObject. */\nfunction recordTypeConstants(describes: readonly CodegenDescribe[]): string {\n\tconst entries = describes\n\t\t.map((describe) => [describe.name, recordTypeNames(describe)] as const)\n\t\t.filter(([, names]) => names.length > 0)\n\t\t.map(([name, names]) => `\\t${name}: [${names.map((value) => JSON.stringify(value)).join(\", \")}],`);\n\treturn [\n\t\t\"/** Record type DeveloperNames per sObject. Resolve ids with `sf.sobject(name).recordTypeId(developerName)`. */\",\n\t\t`export const RECORD_TYPES = {${entries.length > 0 ? `\\n${entries.join(\"\\n\")}\\n` : \"\"}} as const;`,\n\t].join(\"\\n\");\n}\n\nfunction unionOrNever(values: readonly string[]): string {\n\treturn values.length > 0 ? values.map((value) => JSON.stringify(value)).join(\" | \") : \"never\";\n}\n\nfunction apiVersionConstant(apiVersion: ApiVersion): string {\n\tif (!/^v\\d+\\.\\d+$/.test(apiVersion)) {\n\t\tthrow new Error(`Invalid apiVersion \"${apiVersion}\".`);\n\t}\n\treturn [\n\t\t\"/**\",\n\t\t\" * The API version these types were generated with. Pass it to the client so requests use the\",\n\t\t\" * same version: `new SalesforceClient<SObjectRegistry>({ apiVersion: API_VERSION, ... })`.\",\n\t\t\" */\",\n\t\t`export const API_VERSION = ${JSON.stringify(apiVersion)};`,\n\t].join(\"\\n\");\n}\n\nfunction relationshipMap(entries: readonly (readonly [string, string])[]): string {\n\tconst unique = new Map<string, string>();\n\tfor (const [name, target] of entries) {\n\t\tif (!unique.has(name)) {\n\t\t\tunique.set(name, target);\n\t\t}\n\t}\n\tif (unique.size === 0) {\n\t\treturn \"Record<never, never>\";\n\t}\n\tconst lines = [...unique.entries()]\n\t\t.sort(([a], [b]) => compare(a, b))\n\t\t.map(([name, target]) => `\\t\\t\\t${name}: ${JSON.stringify(target)};`);\n\treturn `{\\n${lines.join(\"\\n\")}\\n\\t\\t}`;\n}\n\nfunction keyUnion(names: readonly string[]): string {\n\treturn names.map((name) => JSON.stringify(name)).join(\" | \");\n}\n","import { isApiVersion } from \"../api-version\";\n\nimport type { AuthSetting, CodegenConfig } from \"./config\";\n\n/** Thrown when a codegen config is invalid. Lists every problem found. */\nexport class CodegenConfigError extends Error {\n\toverride readonly name: string = \"CodegenConfigError\";\n\n\tconstructor(\n\t\treadonly source: string,\n\t\treadonly problems: string[],\n\t) {\n\t\tsuper(`Invalid sobjectly config (${source}):\\n${problems.map((problem) => ` - ${problem}`).join(\"\\n\")}`);\n\t}\n}\n\n/** The options each auth type accepts: its credential keys, then the deprecated `*Env` keys. */\nexport const AUTH_OPTIONS: Record<AuthSetting[\"type\"], readonly string[]> = {\n\tclientCredentials: [\"loginUrl\", \"clientId\", \"clientSecret\", \"loginUrlEnv\", \"clientIdEnv\", \"clientSecretEnv\"],\n\taccessToken: [\"accessToken\", \"instanceUrl\", \"accessTokenEnv\", \"instanceUrlEnv\"],\n\tjwtBearer: [\n\t\t\"loginUrl\",\n\t\t\"clientId\",\n\t\t\"username\",\n\t\t\"privateKey\",\n\t\t\"privateKeyPath\",\n\t\t\"loginUrlEnv\",\n\t\t\"clientIdEnv\",\n\t\t\"usernameEnv\",\n\t\t\"privateKeyEnv\",\n\t\t\"privateKeyPathEnv\",\n\t],\n\tsfCli: [\"targetOrg\"],\n};\n\n/** The deprecated `*Env` auth options, each mapped to the credential key that replaces it. */\nexport const DEPRECATED_AUTH_OPTIONS: Readonly<Record<string, string>> = {\n\tloginUrlEnv: \"loginUrl\",\n\tclientIdEnv: \"clientId\",\n\tclientSecretEnv: \"clientSecret\",\n\taccessTokenEnv: \"accessToken\",\n\tinstanceUrlEnv: \"instanceUrl\",\n\tusernameEnv: \"username\",\n\tprivateKeyEnv: \"privateKey\",\n\tprivateKeyPathEnv: \"privateKeyPath\",\n};\n\nexport const PICKLIST_MODES = [\"union\", \"string\", \"const\", \"enum\"] as const;\n\nconst IDENTIFIER = /^[A-Za-z][A-Za-z0-9_]*$/;\n\ninterface Context {\n\tconfig: Record<string, unknown>;\n\tjson: boolean;\n\tproblem: (message: string) => void;\n}\n\ntype Validator = (value: unknown, context: Context) => void;\n\nconst VALIDATORS: Record<string, Validator> = {\n\t$schema: (value, { problem }) => {\n\t\tif (typeof value !== \"string\") {\n\t\t\tproblem(\"$schema: must be a string.\");\n\t\t}\n\t},\n\toutput: (value, { problem }) => {\n\t\tif (value === undefined) {\n\t\t\tproblem('output: required, e.g. \"src/generated/sobjects.ts\".');\n\t\t} else if (typeof value !== \"string\" || !/\\.(ts|mts|cts)$/.test(value)) {\n\t\t\tproblem(`output: must be a TypeScript file path such as \"src/generated/sobjects.ts\", got ${show(value)}.`);\n\t\t}\n\t},\n\tapiVersion: (value, { problem }) => {\n\t\tif (value === undefined || value === \"\") {\n\t\t\tproblem('apiVersion: required, e.g. \"v66.0\".');\n\t\t} else if (!isApiVersion(value)) {\n\t\t\tproblem(`apiVersion: must look like \"v66.0\", got ${show(value)}.`);\n\t\t}\n\t},\n\tsobjects: (value, { problem }) => validateNames(\"sobjects\", value, problem),\n\texclude: (value, { problem }) => validateNames(\"exclude\", value, problem),\n\tauth: validateAuth,\n\texcludeCreateFields: (value, context) => validateFieldMap(\"excludeCreateFields\", value, context),\n\texcludeUpdateFields: (value, context) => validateFieldMap(\"excludeUpdateFields\", value, context),\n\tpicklists: (value, { problem }) => {\n\t\tif (!PICKLIST_MODES.includes(value as (typeof PICKLIST_MODES)[number])) {\n\t\t\tproblem(`picklists: must be one of ${PICKLIST_MODES.join(\", \")}, got ${show(value)}.`);\n\t\t}\n\t},\n\tconstants: (value, { problem }) => {\n\t\tif (typeof value !== \"boolean\") {\n\t\t\tproblem(`constants: must be true or false, got ${show(value)}.`);\n\t\t}\n\t},\n\tconcurrency: (value, { problem }) => {\n\t\tif (!Number.isInteger(value) || (value as number) < 1) {\n\t\t\tproblem(`concurrency: must be a positive integer, got ${show(value)}.`);\n\t\t}\n\t},\n\tcontinueOnDescribeError: (value, { problem }) => {\n\t\tif (typeof value !== \"boolean\") {\n\t\t\tproblem(`continueOnDescribeError: must be true or false, got ${show(value)}.`);\n\t\t}\n\t},\n\timportSource: (value, { problem }) => {\n\t\tif (typeof value !== \"string\" || value.length === 0) {\n\t\t\tproblem(`importSource: must be a non-empty string, got ${show(value)}.`);\n\t\t}\n\t},\n\tformat: (value, { problem, json }) => {\n\t\tif (json) {\n\t\t\tproblem(\"format: only supported in a TypeScript config.\");\n\t\t} else if (typeof value !== \"function\") {\n\t\t\tproblem(\"format: must be a function (source, filePath) => string.\");\n\t\t}\n\t},\n\ttransport: (value, { problem, json }) => {\n\t\tif (json) {\n\t\t\tproblem(\"transport: only supported in a TypeScript config.\");\n\t\t} else if (typeof (value as { send?: unknown } | null)?.send !== \"function\") {\n\t\t\tproblem(\"transport: must be an HttpTransport (an object with a send() method).\");\n\t\t}\n\t},\n};\n\n/** The options a config may contain. */\nexport const CONFIG_OPTIONS: readonly string[] = Object.keys(VALIDATORS).filter((key) => key !== \"$schema\");\n\n/**\n * Checks a loaded config and returns it typed. Throws a `CodegenConfigError` listing every\n * problem. `json` disallows the options that only a TypeScript config can express.\n */\nexport function validateConfig(value: unknown, options: { source: string; json?: boolean }): CodegenConfig {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new CodegenConfigError(options.source, [\n\t\t\t\"the config must be an object (export default defineConfig({ ... }) or a JSON object).\",\n\t\t]);\n\t}\n\tconst problems: string[] = [];\n\tconst context: Context = {\n\t\tconfig: value as Record<string, unknown>,\n\t\tjson: options.json ?? false,\n\t\tproblem: (message) => problems.push(message),\n\t};\n\tfor (const required of [\"apiVersion\", \"output\"]) {\n\t\tif (!(required in value)) {\n\t\t\tVALIDATORS[required]?.(undefined, context);\n\t\t}\n\t}\n\tfor (const [key, option] of Object.entries(value)) {\n\t\tconst validate = VALIDATORS[key];\n\t\tif (!validate) {\n\t\t\tproblems.push(`${key}: unknown option. Valid options: ${CONFIG_OPTIONS.join(\", \")}.`);\n\t\t} else if (option !== undefined || key === \"apiVersion\" || key === \"output\") {\n\t\t\tvalidate(option, context);\n\t\t}\n\t}\n\tif (problems.length > 0) {\n\t\tif (problems.some((problem) => problem.startsWith(\"apiVersion\") || problem.startsWith(\"output\"))) {\n\t\t\tproblems.push('Run \"npx sobjectly init\" to create a valid config.');\n\t\t}\n\t\tthrow new CodegenConfigError(options.source, problems);\n\t}\n\tconst { $schema: _schema, ...config } = value as Record<string, unknown>;\n\treturn config as unknown as CodegenConfig;\n}\n\nfunction validateNames(key: string, value: unknown, problem: (message: string) => void): void {\n\tif (!Array.isArray(value)) {\n\t\tproblem(`${key}: must be an array of sObject API names, got ${show(value)}.`);\n\t\treturn;\n\t}\n\tif (key === \"sobjects\" && value.length === 0) {\n\t\tproblem(\"sobjects: list at least one sObject, or leave it out to generate every queryable sObject.\");\n\t}\n\tvalue.forEach((name, index) => {\n\t\tif (typeof name !== \"string\" || !IDENTIFIER.test(name)) {\n\t\t\tproblem(`${key}[${index}]: ${show(name)} is not a valid sObject API name.`);\n\t\t}\n\t});\n}\n\nfunction validateFieldMap(key: string, value: unknown, { config, problem }: Context): void {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tproblem(`${key}: must be an object like { \"Account\": [\"FieldName\"] }, got ${show(value)}.`);\n\t\treturn;\n\t}\n\t// sObject names are case-insensitive; the generator looks these keys up the same way.\n\tconst listed = Array.isArray(config.sobjects)\n\t\t? new Set((config.sobjects as unknown[]).map((name) => (typeof name === \"string\" ? name.toLowerCase() : name)))\n\t\t: undefined;\n\tfor (const [sobject, fields] of Object.entries(value)) {\n\t\tif (listed && !listed.has(sobject.toLowerCase())) {\n\t\t\tproblem(`${key}.${sobject}: \"${sobject}\" is not listed in sobjects.`);\n\t\t}\n\t\tif (!Array.isArray(fields) || fields.some((field) => typeof field !== \"string\" || field.length === 0)) {\n\t\t\tproblem(`${key}.${sobject}: must be an array of field API names, got ${show(fields)}.`);\n\t\t}\n\t}\n}\n\nfunction validateAuth(value: unknown, { json, problem }: Context): void {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tproblem(`auth: must be an object like { \"type\": \"clientCredentials\" }, got ${show(value)}.`);\n\t\treturn;\n\t}\n\tif (typeof (value as { getToken?: unknown }).getToken === \"function\") {\n\t\tif (json) {\n\t\t\tproblem(\"auth: auth providers are only supported in a TypeScript config.\");\n\t\t}\n\t\treturn;\n\t}\n\tconst { type, ...rest } = value as Record<string, unknown>;\n\tconst allowed = AUTH_OPTIONS[type as AuthSetting[\"type\"]] as readonly string[] | undefined;\n\tif (!allowed) {\n\t\tproblem(`auth.type: must be one of ${Object.keys(AUTH_OPTIONS).join(\", \")}, got ${show(type)}.`);\n\t\treturn;\n\t}\n\tfor (const [key, option] of Object.entries(rest)) {\n\t\tif (!allowed.includes(key)) {\n\t\t\tconst valid = allowed.filter((name) => !(name in DEPRECATED_AUTH_OPTIONS));\n\t\t\tproblem(`auth.${key}: not an option of \"${String(type)}\". Valid options: ${valid.join(\", \")}.`);\n\t\t} else {\n\t\t\tvalidateAuthOption(key, option, rest, problem);\n\t\t}\n\t}\n}\n\nfunction validateAuthOption(\n\tkey: string,\n\toption: unknown,\n\tsetting: Record<string, unknown>,\n\tproblem: (message: string) => void,\n): void {\n\tconst replacement = DEPRECATED_AUTH_OPTIONS[key];\n\tif (replacement !== undefined && replacement in setting) {\n\t\tproblem(`auth.${key}: use either ${replacement} or ${key}, not both.`);\n\t} else if (replacement !== undefined) {\n\t\tif (typeof option !== \"string\" || option.length === 0) {\n\t\t\tproblem(`auth.${key}: must be a non-empty string, got ${show(option)}.`);\n\t\t}\n\t} else if (option !== undefined && typeof option !== \"string\") {\n\t\t// Credential values may be undefined here (process.env.X); generate reports them if still empty.\n\t\tproblem(`auth.${key}: must be a string, got ${show(option)}.`);\n\t}\n}\n\nfunction show(value: unknown): string {\n\tif (value === undefined) {\n\t\treturn \"undefined\";\n\t}\n\tif (typeof value === \"function\") {\n\t\treturn \"a function\";\n\t}\n\ttry {\n\t\treturn JSON.stringify(value) ?? typeof value;\n\t} catch {\n\t\treturn typeof value;\n\t}\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, extname, join, resolve } from \"node:path\";\n\nimport { createJiti } from \"jiti\";\n\nimport type { CodegenConfig } from \"./config\";\nimport { CodegenConfigError, validateConfig } from \"./validate-config\";\n\n/** Config file names, in lookup order. */\nexport const CONFIG_FILE_NAMES = [\n\t\"sobjectly.config.ts\",\n\t\"sobjectly.config.mts\",\n\t\"sobjectly.config.cts\",\n\t\"sobjectly.config.json\",\n];\n\nconst TYPESCRIPT_EXTENSIONS = new Set([\".ts\", \".mts\", \".cts\"]);\n\n/** Looks for a `sobjectly.config.{ts,mts,cts,json}` file in `cwd`; the first match in lookup order wins. */\nexport function findConfigFile(cwd: string = process.cwd()): string | undefined {\n\treturn findConfigFiles(cwd)[0];\n}\n\n/** Every `sobjectly.config.*` file in `cwd`, in lookup order. */\nexport function findConfigFiles(cwd: string = process.cwd()): string[] {\n\treturn CONFIG_FILE_NAMES.map((name) => join(cwd, name)).filter((path) => existsSync(path));\n}\n\n/**\n * Loads and validates a TypeScript (`.ts`, `.mts`, `.cts`) or JSON config file. Returns the\n * config and the directory it lives in. Throws a `CodegenConfigError` listing every problem.\n */\nexport async function loadConfig(configPath: string): Promise<{ config: CodegenConfig; directory: string }> {\n\tconst absolutePath = resolve(configPath);\n\tif (!existsSync(absolutePath)) {\n\t\tthrow new Error(`Config file not found: ${absolutePath}`);\n\t}\n\tconst extension = extname(absolutePath).toLowerCase();\n\tconst directory = dirname(absolutePath);\n\tif (extension === \".json\") {\n\t\treturn { config: validateConfig(readJson(absolutePath), { source: absolutePath, json: true }), directory };\n\t}\n\tif (!TYPESCRIPT_EXTENSIONS.has(extension)) {\n\t\tthrow new Error(`Unsupported config file \"${absolutePath}\". Use sobjectly.config.ts or sobjectly.config.json.`);\n\t}\n\tconst jiti = createJiti(join(directory, \"_sobjectly_loader.js\"), { interopDefault: true });\n\tconst loaded = await jiti.import<unknown>(absolutePath, { default: true });\n\treturn { config: validateConfig(loaded, { source: absolutePath }), directory };\n}\n\nfunction readJson(path: string): unknown {\n\ttry {\n\t\treturn JSON.parse(readFileSync(path, \"utf8\")) as unknown;\n\t} catch (error) {\n\t\tthrow new CodegenConfigError(path, [`not valid JSON: ${error instanceof Error ? error.message : String(error)}`]);\n\t}\n}\n","import type { AuthProvider } from \"../auth/types\";\nimport type { HttpTransport } from \"../http/transport\";\nimport type { ApiVersion } from \"../types/common\";\n\n/**\n * A credential value in the config: usually `process.env.ANY_NAME` (so `undefined` type-checks),\n * a `\"${ANY_NAME}\"` placeholder that is read from the environment (the way to do it in JSON), or\n * a literal. A key that is set but ends up empty is an error; a key that is left out falls back\n * to its default `SF_*` environment variable.\n */\nexport type ConfigValue = string | undefined;\n\n/** OAuth 2.0 client credentials. Keys you leave out are read from the default variables shown. */\nexport interface ClientCredentialsAuth {\n\ttype: \"clientCredentials\";\n\t/** Your My Domain URL. Defaults to the `SF_LOGIN_URL` variable. */\n\tloginUrl?: ConfigValue;\n\t/** Defaults to the `SF_CLIENT_ID` variable. */\n\tclientId?: ConfigValue;\n\t/** Defaults to the `SF_CLIENT_SECRET` variable. */\n\tclientSecret?: ConfigValue;\n\t/** @deprecated Use `loginUrl: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tloginUrlEnv?: string;\n\t/** @deprecated Use `clientId: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tclientIdEnv?: string;\n\t/** @deprecated Use `clientSecret: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tclientSecretEnv?: string;\n}\n\n/** A fixed access token, e.g. from `sf org display`. Keys you leave out are read from the default variables shown. */\nexport interface AccessTokenAuth {\n\ttype: \"accessToken\";\n\t/** Defaults to the `SF_ACCESS_TOKEN` variable. */\n\taccessToken?: ConfigValue;\n\t/** Defaults to the `SF_INSTANCE_URL` variable. */\n\tinstanceUrl?: ConfigValue;\n\t/** @deprecated Use `accessToken: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\taccessTokenEnv?: string;\n\t/** @deprecated Use `instanceUrl: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tinstanceUrlEnv?: string;\n}\n\n/** OAuth 2.0 JWT bearer flow. Keys you leave out are read from the default variables shown. */\nexport interface JwtBearerAuth {\n\ttype: \"jwtBearer\";\n\t/** Defaults to the `SF_LOGIN_URL` variable. */\n\tloginUrl?: ConfigValue;\n\t/** Defaults to the `SF_CLIENT_ID` variable. */\n\tclientId?: ConfigValue;\n\t/** Defaults to the `SF_USERNAME` variable. */\n\tusername?: ConfigValue;\n\t/** The PEM key itself. Defaults to the `SF_PRIVATE_KEY` variable. */\n\tprivateKey?: ConfigValue;\n\t/** A path to the PEM key file, used when `privateKey` is empty. Defaults to the `SF_PRIVATE_KEY_PATH` variable. */\n\tprivateKeyPath?: ConfigValue;\n\t/** @deprecated Use `loginUrl: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tloginUrlEnv?: string;\n\t/** @deprecated Use `clientId: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tclientIdEnv?: string;\n\t/** @deprecated Use `username: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tusernameEnv?: string;\n\t/** @deprecated Use `privateKey: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tprivateKeyEnv?: string;\n\t/** @deprecated Use `privateKeyPath: process.env.NAME` (or `\"${NAME}\"` in JSON). Removed in 2.0. */\n\tprivateKeyPathEnv?: string;\n}\n\n/** An org you are logged into with the Salesforce CLI (`sf org login web --alias my-org`). */\nexport interface SfCliAuth {\n\ttype: \"sfCli\";\n\t/**\n\t * The org alias or username, e.g. `process.env.NAME` or a `\"${NAME}\"` placeholder. Left out, the\n\t * CLI's default org is used (the CLI's own `SF_TARGET_ORG` variable can set it). Set but empty is an error.\n\t */\n\ttargetOrg?: ConfigValue;\n}\n\n/** An auth setting that can be written as data. The only kind a JSON config can use. */\nexport type AuthSetting = ClientCredentialsAuth | AccessTokenAuth | JwtBearerAuth | SfCliAuth;\n\n/** @deprecated Use `ClientCredentialsAuth`. */\nexport type EnvClientCredentialsAuth = ClientCredentialsAuth;\n/** @deprecated Use `AccessTokenAuth`. */\nexport type EnvAccessTokenAuth = AccessTokenAuth;\n/** @deprecated Use `JwtBearerAuth`. */\nexport type EnvJwtBearerAuth = JwtBearerAuth;\n/** @deprecated Use `AuthSetting`. */\nexport type EnvAuth = AuthSetting;\n\n/** An auth setting, or any auth provider (TypeScript configs only). */\nexport type CodegenAuth = AuthSetting | AuthProvider;\n\nexport type PicklistMode =\n\t/** Every picklist is `string`. */\n\t| \"string\"\n\t/** Restricted picklists become a union of their values; unrestricted ones `\"A\" | \"B\" | (string & {})`. */\n\t| \"union\"\n\t/**\n\t * Like `\"union\"`, plus a named `as const` object and type per picklist: `CaseStatus.Working`,\n\t * `Status: CaseStatus`. Plain strings such as `\"Working\"` are still accepted.\n\t */\n\t| \"const\"\n\t/**\n\t * A TypeScript `enum` per picklist: `CaseStatus.Working`, `Status: CaseStatus`. Enums are nominal,\n\t * so restricted picklists only accept enum members, not plain strings. Not usable with\n\t * `erasableSyntaxOnly` or Node's type stripping.\n\t */\n\t| \"enum\";\n\n/**\n * The codegen config. `S` is the union of the listed sObject names; `defineConfig` infers it, so\n * per-sObject options such as `excludeCreateFields` only accept listed names.\n */\nexport interface CodegenConfig<S extends string = string> {\n\t/** Output file, relative to the config file's directory, e.g. `\"src/generated/sobjects.ts\"`. */\n\toutput: string;\n\t/**\n\t * The API version to describe with, e.g. `\"v66.0\"`. Required. It is also written to the\n\t * generated file as `API_VERSION`, so the client can use the same version.\n\t */\n\tapiVersion: ApiVersion;\n\t/**\n\t * sObjects to generate. Strongly recommended: without it every queryable sObject in the org\n\t * is generated, which can be thousands of types.\n\t */\n\tsobjects?: readonly S[];\n\t/** sObjects to skip (applied after `sobjects`). */\n\texclude?: readonly string[];\n\t/**\n\t * How to authenticate, e.g. `{ type: \"clientCredentials\", clientId: process.env.MY_CLIENT_ID, ... }`.\n\t * Defaults to client credentials from `SF_LOGIN_URL`, `SF_CLIENT_ID` and `SF_CLIENT_SECRET`.\n\t */\n\tauth?: CodegenAuth;\n\t/** Fields to leave out of the create input per sObject (e.g. fields describe marks createable but REST rejects). */\n\texcludeCreateFields?: Partial<Record<NoInfer<S>, readonly string[]>>;\n\t/** Fields to leave out of the update input per sObject. */\n\texcludeUpdateFields?: Partial<Record<NoInfer<S>, readonly string[]>>;\n\t/** How picklists are typed. Defaults to `\"union\"`. */\n\tpicklists?: PicklistMode;\n\t/** Emit the `PICKLIST_VALUES` and `RECORD_TYPES` runtime constants. Defaults to `true`. */\n\tconstants?: boolean;\n\t/** Parallel describe calls. Defaults to 10. */\n\tconcurrency?: number;\n\t/** Skip sObjects whose describe fails instead of failing the run. Defaults to `false`. */\n\tcontinueOnDescribeError?: boolean;\n\t/** Where the generated file imports helper types from. Defaults to `\"@cerios/salesforce-sobjectly\"`. */\n\timportSource?: string;\n\t/** Post-processes the generated source, e.g. with your formatter. TypeScript configs only. */\n\tformat?: (source: string, filePath: string) => string | Promise<string>;\n\t/** A custom transport for the describe calls (e.g. behind a proxy). TypeScript configs only. */\n\ttransport?: HttpTransport;\n}\n\n/**\n * The shape of `sobjectly.config.json`: everything that can be written as JSON (no functions,\n * no auth providers). `$schema` points editors at the bundled JSON Schema.\n */\nexport type JsonCodegenConfig = Omit<CodegenConfig, \"auth\" | \"format\" | \"transport\"> & {\n\t$schema?: string;\n\tauth?: AuthSetting;\n};\n\n/**\n * Type-checks a `sobjectly.config.ts`. The listed `sobjects` become a literal union, so a typo in\n * a per-sObject option is a compile error:\n *\n * ```ts\n * export default defineConfig({\n * \tapiVersion: \"v66.0\",\n * \toutput: \"src/generated/sobjects.ts\",\n * \tsobjects: [\"Account\", \"Contact\"],\n * \texcludeCreateFields: { Acount: [\"Name\"] }, // ❌ \"Acount\" is not in sobjects\n * });\n * ```\n */\nexport function defineConfig<const S extends string = string>(config: CodegenConfig<S>): CodegenConfig<S> {\n\treturn config;\n}\n","import { existsSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\n\nimport { normalizeApiVersion } from \"../api-version\";\nimport type { ApiVersion } from \"../types/common\";\n\nimport type { PicklistMode } from \"./config\";\nimport { findConfigFiles } from \"./load-config\";\nimport type { Choice, Prompter } from \"./prompter\";\n\nexport type InitAuthType = \"clientCredentials\" | \"accessToken\" | \"jwtBearer\" | \"sfCli\";\nexport type InitConfigFormat = \"ts\" | \"json\";\n\nexport interface InitAnswers {\n\tapiVersion: ApiVersion;\n\toutput: string;\n\tsobjects: string[];\n\tauth: InitAuthType;\n\t/** The Salesforce CLI org alias, for `auth: \"sfCli\"`. Omitted means the CLI's default org. */\n\ttargetOrg?: string;\n\tpicklists: PicklistMode;\n\tformat: InitConfigFormat;\n}\n\nexport interface InitOptions {\n\tcwd: string;\n\tprompter: Prompter;\n\tlog: (message: string) => void;\n\t/** Answers given up front (e.g. CLI flags); those questions are skipped. */\n\tpreset?: Partial<InitAnswers>;\n\t/** Accept the suggested answer for every question not in `preset`. `apiVersion` must then be preset. */\n\tyes?: boolean;\n\t/** Overwrite an existing config without asking. */\n\tforce?: boolean;\n}\n\nexport interface InitResult {\n\t/** `undefined` when the user chose not to overwrite an existing config. */\n\tconfigPath: string | undefined;\n\tanswers?: InitAnswers;\n\tenvExampleUpdated?: boolean;\n\tscriptAdded?: boolean;\n}\n\nconst SOBJECT_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nconst NPM_SCRIPT = \"sobjects:generate\";\n\n/** The credential keys `init` writes per auth type, each with the environment variable it suggests. */\nconst AUTH_FIELDS: Record<InitAuthType, [key: string, envName: string][]> = {\n\tclientCredentials: [\n\t\t[\"loginUrl\", \"SF_LOGIN_URL\"],\n\t\t[\"clientId\", \"SF_CLIENT_ID\"],\n\t\t[\"clientSecret\", \"SF_CLIENT_SECRET\"],\n\t],\n\taccessToken: [\n\t\t[\"accessToken\", \"SF_ACCESS_TOKEN\"],\n\t\t[\"instanceUrl\", \"SF_INSTANCE_URL\"],\n\t],\n\tjwtBearer: [\n\t\t[\"loginUrl\", \"SF_LOGIN_URL\"],\n\t\t[\"clientId\", \"SF_CLIENT_ID\"],\n\t\t[\"username\", \"SF_USERNAME\"],\n\t\t[\"privateKeyPath\", \"SF_PRIVATE_KEY_PATH\"],\n\t],\n\tsfCli: [],\n};\n\n/** The environment variables the config written by `init` reads, per auth type. */\nexport const AUTH_ENV_VARS: Record<InitAuthType, string[]> = {\n\tclientCredentials: AUTH_FIELDS.clientCredentials.map(([, envName]) => envName),\n\taccessToken: AUTH_FIELDS.accessToken.map(([, envName]) => envName),\n\tjwtBearer: AUTH_FIELDS.jwtBearer.map(([, envName]) => envName),\n\tsfCli: [],\n};\n\nconst AUTH_CHOICES: Choice<InitAuthType>[] = [\n\t{ value: \"clientCredentials\", label: \"Client credentials (recommended for CI and test automation)\" },\n\t{ value: \"sfCli\", label: \"Salesforce CLI org (recommended for local development; no secrets needed)\" },\n\t{ value: \"accessToken\", label: \"Access token (e.g. from `sf org display`)\" },\n\t{ value: \"jwtBearer\", label: \"JWT bearer (certificate-based, runs as a user)\" },\n];\n\nconst PICKLIST_CHOICES: Choice<PicklistMode>[] = [\n\t{ value: \"union\", label: 'Union of values, e.g. \"New\" | \"Closed\" (type-safe)' },\n\t{ value: \"string\", label: \"Plain string\" },\n\t{ value: \"const\", label: \"Union plus a named constant per picklist, e.g. CaseStatus.Closed\" },\n\t{ value: \"enum\", label: \"TypeScript enum per picklist (restricted picklists only accept enum members)\" },\n];\n\nconst FORMAT_CHOICES: Choice<InitConfigFormat>[] = [\n\t{ value: \"ts\", label: \"TypeScript (sobjectly.config.ts, type-checked with defineConfig)\" },\n\t{ value: \"json\", label: \"JSON (sobjectly.config.json, validated with a JSON Schema)\" },\n];\n\n/**\n * Creates a `sobjectly.config` file by asking for the API version, output path, sObjects, auth\n * method, picklist mode and file format. Optionally adds the auth variables to `.env.example`\n * and an npm script to `package.json`.\n */\nexport async function runInit(options: InitOptions): Promise<InitResult> {\n\tconst { cwd, prompter, log } = options;\n\tconst existing = findConfigFiles(cwd);\n\tif (existing.length > 0 && !options.force) {\n\t\tconst names = existing.map((path) => relative(cwd, path)).join(\" and \");\n\t\tconst overwrite = options.yes ? false : await prompter.confirm(`${names} already exists. Replace it?`, false);\n\t\tif (!overwrite) {\n\t\t\tlog(`Kept the existing ${names}.`);\n\t\t\treturn { configPath: undefined };\n\t\t}\n\t}\n\n\tvalidatePreset(options.preset ?? {});\n\tconst answers = await askQuestions(options);\n\tconst configPath = join(cwd, `sobjectly.config.${answers.format}`);\n\t// Only one config may exist, otherwise the lookup order would silently pick one.\n\tfor (const path of existing.filter((path) => path !== configPath)) {\n\t\trmSync(path);\n\t\tlog(`Removed ${relative(cwd, path)}`);\n\t}\n\twriteFileSync(configPath, renderConfig(answers), \"utf8\");\n\tlog(`\\nCreated ${relative(cwd, configPath)}`);\n\n\tconst envExampleUpdated = await maybeUpdateEnvExample(options, answers.auth);\n\tconst scriptAdded = await maybeAddScript(options);\n\tprintNextSteps(log, answers, scriptAdded, cwd);\n\treturn { configPath, answers, envExampleUpdated, scriptAdded };\n}\n\nasync function askQuestions(options: InitOptions): Promise<InitAnswers> {\n\tconst { prompter, preset = {}, yes } = options;\n\tconst apiVersion = preset.apiVersion ?? (await askApiVersion(prompter, yes));\n\tconst output =\n\t\tpreset.output ??\n\t\t(yes\n\t\t\t? \"src/generated/sobjects.ts\"\n\t\t\t: await prompter.ask(\"Where should the generated types be written?\", {\n\t\t\t\t\tdefaultValue: \"src/generated/sobjects.ts\",\n\t\t\t\t\tvalidate: validateOutput,\n\t\t\t\t}));\n\tconst sobjects = preset.sobjects ?? (await askSObjects(prompter, yes));\n\tconst auth =\n\t\tpreset.auth ??\n\t\t(yes\n\t\t\t? \"clientCredentials\"\n\t\t\t: await prompter.choose(\"How should the generator log in to Salesforce?\", AUTH_CHOICES, \"clientCredentials\"));\n\tconst targetOrg = auth === \"sfCli\" ? (preset.targetOrg ?? (await askTargetOrg(prompter, yes))) : undefined;\n\tconst picklists =\n\t\tpreset.picklists ??\n\t\t(yes ? \"union\" : await prompter.choose(\"How should picklist fields be typed?\", PICKLIST_CHOICES, \"union\"));\n\tconst format =\n\t\tpreset.format ?? (yes ? \"ts\" : await prompter.choose(\"Which config file format?\", FORMAT_CHOICES, \"ts\"));\n\treturn { apiVersion, output, sobjects, auth, ...(targetOrg ? { targetOrg } : {}), picklists, format };\n}\n\nasync function askTargetOrg(prompter: Prompter, yes: boolean | undefined): Promise<string | undefined> {\n\tif (yes) {\n\t\treturn undefined;\n\t}\n\tconst answer = await prompter.ask(\"Which Salesforce CLI org alias? Leave empty to use the CLI's default org\", {\n\t\tvalidate: (value) => (value === \"\" || /^[\\w.@+-]+$/.test(value) ? undefined : \"Enter an org alias or username.\"),\n\t});\n\treturn answer === \"\" ? undefined : answer;\n}\n\nasync function askApiVersion(prompter: Prompter, yes: boolean | undefined): Promise<ApiVersion> {\n\tif (yes) {\n\t\tthrow new Error(\"An API version is required: pass --api-version (e.g. --api-version v66.0).\");\n\t}\n\tconst answer = await prompter.ask(\n\t\t\"Which Salesforce API version should be used? (e.g. v66.0; your org lists them at https://<my-domain>.my.salesforce.com/services/data/)\",\n\t\t{ validate: (value) => (normalizeApiVersion(value) ? undefined : 'Enter a version like \"v66.0\" or \"66\".') },\n\t);\n\treturn normalizeApiVersion(answer) as ApiVersion;\n}\n\nasync function askSObjects(prompter: Prompter, yes: boolean | undefined): Promise<string[]> {\n\tconst defaultValue = \"Account, Contact\";\n\tconst answer = yes\n\t\t? defaultValue\n\t\t: await prompter.ask(\"Which sObjects do you want types for? Use comma-separated API names\", {\n\t\t\t\tdefaultValue,\n\t\t\t\tvalidate: validateSObjects,\n\t\t\t});\n\treturn parseSObjects(answer);\n}\n\n/** Splits a comma/space separated list of sObject names, removing duplicates. */\nexport function parseSObjects(answer: string): string[] {\n\treturn [...new Set(answer.split(/[\\s,]+/).filter((name) => name.length > 0))];\n}\n\nfunction validateSObjects(answer: string): string | undefined {\n\treturn validateSObjectNames(parseSObjects(answer));\n}\n\nfunction validateSObjectNames(names: readonly string[]): string | undefined {\n\tif (names.length === 0) {\n\t\treturn \"Enter at least one sObject, e.g. Account.\";\n\t}\n\tconst invalid = names.filter((name) => !SOBJECT_NAME.test(name));\n\treturn invalid.length > 0 ? `Not a valid sObject API name: ${invalid.join(\", \")}` : undefined;\n}\n\n/** Answers given as flags get the same checks as typed answers. */\nfunction validatePreset(preset: Partial<InitAnswers>): void {\n\tconst errors = [\n\t\t// Check the names as given: joining and re-splitting would let \"Bad Name\" pass as two names.\n\t\tpreset.sobjects === undefined ? undefined : validateSObjectNames(preset.sobjects),\n\t\tpreset.output === undefined ? undefined : validateOutput(preset.output),\n\t\tpreset.targetOrg === undefined || /^[\\w.@+-]+$/.test(preset.targetOrg)\n\t\t\t? undefined\n\t\t\t: `Invalid org alias \"${preset.targetOrg}\".`,\n\t].filter((error): error is string => error !== undefined);\n\tif (errors.length > 0) {\n\t\tthrow new Error(errors.join(\" \"));\n\t}\n}\n\nfunction validateOutput(answer: string): string | undefined {\n\treturn /\\.(ts|mts|cts)$/.test(answer)\n\t\t? undefined\n\t\t: \"The output must be a TypeScript file, e.g. src/generated/sobjects.ts.\";\n}\n\n/** The `$schema` reference written into `sobjectly.config.json`. */\nexport const JSON_SCHEMA_REFERENCE = \"./node_modules/@cerios/salesforce-sobjectly/sobjectly.config.schema.json\";\n\n/** Renders the config file in the chosen format. */\nexport function renderConfig(answers: InitAnswers): string {\n\treturn answers.format === \"json\" ? renderJsonConfig(answers) : renderTypeScriptConfig(answers);\n}\n\nfunction renderJsonConfig(answers: InitAnswers): string {\n\tconst config = {\n\t\t$schema: JSON_SCHEMA_REFERENCE,\n\t\tapiVersion: answers.apiVersion,\n\t\toutput: answers.output,\n\t\tsobjects: answers.sobjects,\n\t\tauth: authSetting(answers),\n\t\tpicklists: answers.picklists,\n\t};\n\treturn `${JSON.stringify(config, null, \"\\t\")}\\n`;\n}\n\nfunction renderTypeScriptConfig(answers: InitAnswers): string {\n\tconst sobjects = answers.sobjects.map((name) => JSON.stringify(name)).join(\", \");\n\treturn [\n\t\t'import { defineConfig } from \"@cerios/salesforce-sobjectly/codegen\";',\n\t\t\"\",\n\t\t\"export default defineConfig({\",\n\t\t\"\\t// The Salesforce REST API version. The generated file exports it as API_VERSION for the client.\",\n\t\t`\\tapiVersion: ${JSON.stringify(answers.apiVersion)},`,\n\t\t\"\\t// Where the generated types are written, relative to this file.\",\n\t\t`\\toutput: ${JSON.stringify(answers.output)},`,\n\t\t\"\\t// The sObjects to generate types for.\",\n\t\t`\\tsobjects: [${sobjects}],`,\n\t\t`\\t// ${authComment(answers.auth)}`,\n\t\t`\\tauth: ${renderAuth(answers)},`,\n\t\t`\\tpicklists: ${JSON.stringify(answers.picklists)},`,\n\t\t\"});\",\n\t\t\"\",\n\t].join(\"\\n\");\n}\n\n/** The JSON auth setting: credentials are `\"${NAME}\"` placeholders, read from the environment. */\nfunction authSetting(answers: InitAnswers): Record<string, string> {\n\tif (answers.auth === \"sfCli\") {\n\t\treturn answers.targetOrg ? { type: \"sfCli\", targetOrg: answers.targetOrg } : { type: \"sfCli\" };\n\t}\n\tconst fields = AUTH_FIELDS[answers.auth].map(([key, envName]) => [key, `\\${${envName}}`]);\n\treturn { type: answers.auth, ...Object.fromEntries(fields) };\n}\n\n/** The TypeScript auth setting: credentials are read with `process.env`. */\nfunction renderAuth(answers: InitAnswers): string {\n\tif (answers.auth === \"sfCli\") {\n\t\tconst targetOrg = answers.targetOrg ? `, targetOrg: ${JSON.stringify(answers.targetOrg)}` : \"\";\n\t\treturn `{ type: \"sfCli\"${targetOrg} }`;\n\t}\n\tconst fields = AUTH_FIELDS[answers.auth].map(([key, envName]) => `\\t\\t${key}: process.env.${envName},`);\n\treturn [\"{\", `\\t\\ttype: ${JSON.stringify(answers.auth)},`, ...fields, \"\\t}\"].join(\"\\n\");\n}\n\nfunction authComment(auth: InitAuthType): string {\n\treturn auth === \"sfCli\"\n\t\t? \"Uses an org you are logged into with the Salesforce CLI (sf org login web).\"\n\t\t: \"Fill these in from process.env (any variable names), a secret store or elsewhere. Keep secrets out of this file.\";\n}\n\nasync function maybeUpdateEnvExample(options: InitOptions, auth: InitAuthType): Promise<boolean> {\n\tconst path = join(options.cwd, \".env.example\");\n\tconst content = existsSync(path) ? readFileSync(path, \"utf8\") : \"\";\n\tconst missing = AUTH_ENV_VARS[auth].filter((name) => !new RegExp(`^${name}=`, \"m\").test(content));\n\tif (missing.length === 0) {\n\t\treturn false;\n\t}\n\tconst add =\n\t\toptions.yes === true || (await options.prompter.confirm(`Add ${formatList(missing)} to .env.example?`, true));\n\tif (!add) {\n\t\treturn false;\n\t}\n\tconst block = [\"# Salesforce credentials for `sobjectly generate`\", ...missing.map((name) => `${name}=`)].join(\"\\n\");\n\tconst separator = content.length === 0 ? \"\" : content.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n\twriteFileSync(path, `${content}${separator}${block}\\n`, \"utf8\");\n\toptions.log(\"Updated .env.example\");\n\treturn true;\n}\n\nasync function maybeAddScript(options: InitOptions): Promise<boolean> {\n\tconst path = join(options.cwd, \"package.json\");\n\tif (!existsSync(path)) {\n\t\treturn false;\n\t}\n\tconst raw = readFileSync(path, \"utf8\");\n\tconst bom = raw.startsWith(\"\") ? \"\" : \"\";\n\tlet pkg: { scripts?: Record<string, string> };\n\ttry {\n\t\tpkg = JSON.parse(raw.slice(bom.length)) as { scripts?: Record<string, string> };\n\t} catch {\n\t\toptions.log(`Skipped adding the \"${NPM_SCRIPT}\" script: package.json is not valid JSON.`);\n\t\treturn false;\n\t}\n\tif (pkg.scripts?.[NPM_SCRIPT]) {\n\t\treturn false;\n\t}\n\tconst add = options.yes === true || (await options.prompter.confirm(`Add an npm script \"${NPM_SCRIPT}\"?`, true));\n\tif (!add) {\n\t\treturn false;\n\t}\n\tpkg.scripts = { ...pkg.scripts, [NPM_SCRIPT]: \"sobjectly generate\" };\n\tconst indent = /^[ \\t]+/m.exec(raw)?.[0] ?? \"\\t\";\n\tconst newline = raw.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n\tconst json = JSON.stringify(pkg, null, indent).replace(/\\n/g, newline);\n\twriteFileSync(path, `${bom}${json}${newline}`, \"utf8\");\n\toptions.log(`Added the \"${NPM_SCRIPT}\" script to package.json`);\n\treturn true;\n}\n\nfunction printNextSteps(log: (message: string) => void, answers: InitAnswers, scriptAdded: boolean, cwd: string): void {\n\tconst cli = answers.auth === \"sfCli\";\n\tconst envFile = cli ? \"\" : \" --env-file .env\";\n\tconst command = scriptAdded\n\t\t? `npm run ${NPM_SCRIPT}${envFile ? ` --${envFile}` : \"\"}`\n\t\t: `npx sobjectly generate${envFile}`;\n\tconst gitignore = join(cwd, \".gitignore\");\n\tconst envIgnored = existsSync(gitignore) && /^\\.env\\b/m.test(readFileSync(gitignore, \"utf8\"));\n\tconst firstStep = cli\n\t\t? ` 1. Log in with the Salesforce CLI: sf org login web${answers.targetOrg ? ` --alias ${answers.targetOrg}` : \" --set-default\"}`\n\t\t: ` 1. Put ${formatList(AUTH_ENV_VARS[answers.auth])} in a .env file${envIgnored ? \"\" : \" (and add .env to .gitignore)\"}.`;\n\tlog(\n\t\t[\n\t\t\t\"\",\n\t\t\t\"Next steps:\",\n\t\t\tfirstStep,\n\t\t\t` 2. Generate the types: ${command}`,\n\t\t\t\" 3. Use them, logging in with the config's auth:\",\n\t\t\t' import { loadAuth } from \"@cerios/salesforce-sobjectly/codegen\";',\n\t\t\t` import { API_VERSION, type SObjectRegistry } from \"./${answers.output.replace(/\\.(ts|mts|cts)$/, \"\")}\";`,\n\t\t\t\" const sf = new SalesforceClient<SObjectRegistry>({ apiVersion: API_VERSION, auth: await loadAuth() });\",\n\t\t].join(\"\\n\"),\n\t);\n}\n\nfunction formatList(items: readonly string[]): string {\n\tif (items.length <= 1) {\n\t\treturn items.join(\"\");\n\t}\n\treturn `${items.slice(0, -1).join(\", \")} and ${items.at(-1)}`;\n}\n","import { createInterface } from \"node:readline\";\n\nexport interface Choice<T extends string> {\n\tvalue: T;\n\tlabel: string;\n}\n\n/** Asks questions. The CLI uses `readlinePrompter`; tests pass a scripted implementation. */\nexport interface Prompter {\n\t/** Asks for text. `validate` returns an error message to ask again, or `undefined` to accept. */\n\task(\n\t\tquestion: string,\n\t\toptions?: { defaultValue?: string; validate?: (answer: string) => string | undefined },\n\t): Promise<string>;\n\t/** Asks to pick one of `choices`, by number or value. */\n\tchoose<T extends string>(question: string, choices: readonly Choice<T>[], defaultValue: T): Promise<T>;\n\t/** Asks a yes/no question. */\n\tconfirm(question: string, defaultValue: boolean): Promise<boolean>;\n\tclose(): void;\n}\n\n/**\n * A prompter on stdin/stdout (or the given streams). Lines are queued as they arrive, so piped\n * input (`printf \"v66.0\\n...\" | sobjectly init`) works too. If the input ends before a question\n * is answered, the question rejects.\n */\nexport function readlinePrompter(\n\tinput: NodeJS.ReadableStream = process.stdin,\n\toutput: NodeJS.WritableStream = process.stdout,\n): Prompter {\n\tconst interactive = (input as { isTTY?: boolean }).isTTY === true;\n\tconst rl = createInterface({ input, output, terminal: interactive });\n\tconst lines: string[] = [];\n\tlet waiting: { resolve: (line: string) => void; reject: (error: Error) => void } | undefined;\n\tlet closed = false;\n\n\trl.on(\"line\", (line) => {\n\t\tif (waiting) {\n\t\t\tconst { resolve } = waiting;\n\t\t\twaiting = undefined;\n\t\t\tresolve(line);\n\t\t} else {\n\t\t\tlines.push(line);\n\t\t}\n\t});\n\trl.on(\"close\", () => {\n\t\tclosed = true;\n\t\twaiting?.reject(new Error(\"Input ended before all questions were answered.\"));\n\t\twaiting = undefined;\n\t});\n\n\tconst readLine = (prompt: string): Promise<string> => {\n\t\tif (closed) {\n\t\t\t// Piped input can end while answers are still queued; readline can't prompt after close.\n\t\t\toutput.write(prompt);\n\t\t} else {\n\t\t\trl.setPrompt(prompt);\n\t\t\trl.prompt();\n\t\t}\n\t\tconst queued = lines.shift();\n\t\tif (queued !== undefined) {\n\t\t\tif (!interactive) {\n\t\t\t\toutput.write(`${queued}\\n`);\n\t\t\t}\n\t\t\treturn Promise.resolve(queued);\n\t\t}\n\t\tif (closed) {\n\t\t\treturn Promise.reject(new Error(\"Input ended before all questions were answered.\"));\n\t\t}\n\t\treturn new Promise((resolve, reject) => {\n\t\t\twaiting = {\n\t\t\t\tresolve: (line: string): void => {\n\t\t\t\t\tif (!interactive) {\n\t\t\t\t\t\toutput.write(`${line}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\tresolve(line);\n\t\t\t\t},\n\t\t\t\treject,\n\t\t\t};\n\t\t});\n\t};\n\n\tconst ask: Prompter[\"ask\"] = async (question, options = {}) => {\n\t\tconst suffix = options.defaultValue ? ` (${options.defaultValue})` : \"\";\n\t\tfor (;;) {\n\t\t\tconst raw = (await readLine(`? ${question}${suffix}: `)).trim();\n\t\t\tconst answer = raw === \"\" ? (options.defaultValue ?? \"\") : raw;\n\t\t\tconst error = options.validate?.(answer);\n\t\t\tif (error === undefined) {\n\t\t\t\treturn answer;\n\t\t\t}\n\t\t\toutput.write(` ${error}\\n`);\n\t\t}\n\t};\n\n\treturn {\n\t\task,\n\t\tasync choose(question, choices, defaultValue) {\n\t\t\toutput.write(`? ${question}\\n`);\n\t\t\tchoices.forEach((choice, index) => {\n\t\t\t\toutput.write(` ${index + 1}) ${choice.label}${choice.value === defaultValue ? \" (default)\" : \"\"}\\n`);\n\t\t\t});\n\t\t\tconst answer = await ask(\"Choose a number\", {\n\t\t\t\tdefaultValue: String(choices.findIndex((choice) => choice.value === defaultValue) + 1),\n\t\t\t\tvalidate: (value) => (pick(choices, value) ? undefined : `Enter a number from 1 to ${choices.length}.`),\n\t\t\t});\n\t\t\treturn (pick(choices, answer) ?? choices[0]).value;\n\t\t},\n\t\tasync confirm(question, defaultValue) {\n\t\t\tconst answer = await ask(`${question} ${defaultValue ? \"(Y/n)\" : \"(y/N)\"}`, {\n\t\t\t\tvalidate: (value) => (value === \"\" || /^(y|yes|n|no)$/i.test(value) ? undefined : \"Answer y or n.\"),\n\t\t\t});\n\t\t\treturn answer === \"\" ? defaultValue : /^y/i.test(answer);\n\t\t},\n\t\tclose() {\n\t\t\trl.close();\n\t\t},\n\t};\n}\n\nfunction pick<T extends string>(choices: readonly Choice<T>[], answer: string): Choice<T> | undefined {\n\tconst index = Number(answer);\n\tif (Number.isInteger(index) && index >= 1 && index <= choices.length) {\n\t\treturn choices[index - 1];\n\t}\n\treturn choices.find((choice) => choice.value.toLowerCase() === answer.toLowerCase());\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, resolve } from \"node:path\";\n\nimport { accessToken, clientCredentials, jwtBearer } from \"../auth/providers\";\nimport { sfCli } from \"../auth/sf-cli\";\nimport type { AuthProvider } from \"../auth/types\";\nimport { SalesforceClient } from \"../client\";\nimport type { ApiVersion } from \"../types/common\";\nimport type { DescribeSObjectResult } from \"../types/describe\";\n\nimport type { AuthSetting, CodegenAuth, CodegenConfig } from \"./config\";\nimport { type CodegenDescribe, type GeneratedFileHashes, generateSource, readGeneratedHashes } from \"./generator\";\nimport { CONFIG_FILE_NAMES, findConfigFiles, loadConfig } from \"./load-config\";\nimport { validateConfig } from \"./validate-config\";\n\nexport { defineConfig } from \"./config\";\nexport type {\n\tAccessTokenAuth,\n\tAuthSetting,\n\tClientCredentialsAuth,\n\tCodegenAuth,\n\tCodegenConfig,\n\tConfigValue,\n\tJsonCodegenConfig,\n\tJwtBearerAuth,\n\tPicklistMode,\n\tSfCliAuth,\n} from \"./config\";\n/* oxlint-disable typescript/no-deprecated -- kept exported until 2.0 so existing imports keep working */\nexport type { EnvAuth, EnvAccessTokenAuth, EnvClientCredentialsAuth, EnvJwtBearerAuth } from \"./config\";\n/* oxlint-enable typescript/no-deprecated */\nexport { generateSource, readGeneratedHashes } from \"./generator\";\nexport type { CodegenDescribe, GeneratedFileHashes, GenerateSourceOptions } from \"./generator\";\nexport { FIELD_TYPE_MAP, mapFieldType } from \"./type-mapper\";\nexport type { CodegenField } from \"./type-mapper\";\nexport { CONFIG_FILE_NAMES, findConfigFile, findConfigFiles, loadConfig } from \"./load-config\";\nexport {\n\tAUTH_OPTIONS,\n\tCONFIG_OPTIONS,\n\tCodegenConfigError,\n\tDEPRECATED_AUTH_OPTIONS,\n\tvalidateConfig,\n} from \"./validate-config\";\nexport { AUTH_ENV_VARS, parseSObjects, renderConfig, runInit } from \"./init\";\nexport type { InitAnswers, InitAuthType, InitConfigFormat, InitOptions, InitResult } from \"./init\";\nexport { readlinePrompter } from \"./prompter\";\nexport type { Choice, Prompter } from \"./prompter\";\n\nexport interface CodegenLogger {\n\tinfo(message: string): void;\n\twarn(message: string): void;\n}\n\nexport interface GenerateOptions {\n\t/** Directory that `output` is resolved against. Defaults to `process.cwd()`. */\n\tcwd?: string;\n\tlogger?: CodegenLogger;\n\t/** Where `\"${NAME}\"` placeholders and the default `SF_*` variables are read from. Defaults to `process.env`. */\n\tenv?: Record<string, string | undefined>;\n\t/** Write the file. Defaults to `true`; with `false` the source is only returned. */\n\twrite?: boolean;\n}\n\nexport interface GenerateResult {\n\toutputPath: string;\n\t/** The concrete API version the types were generated with. */\n\tapiVersion: ApiVersion;\n\tsobjects: string[];\n\tskipped: { name: string; error: string }[];\n\t/** The generated source (after the `format` hook). */\n\tsource: string;\n\t/** SHA-256 of the unformatted content, as recorded in the file header. */\n\tcontentHash: string;\n}\n\nexport interface CheckResult {\n\t/** `true` when the file on disk has the same content (formatting differences are ignored). */\n\tupToDate: boolean;\n\t/** Why the file is out of date. */\n\treason?: \"missing\" | \"changed\";\n\toutputPath: string;\n\t/** sObjects that would be added, removed or changed (known when the file has hash headers). */\n\tadded: string[];\n\tremoved: string[];\n\tchanged: string[];\n}\n\nconst silentLogger: CodegenLogger = { info: () => undefined, warn: () => undefined };\n\n/** Describes the configured sObjects and writes the generated types to `config.output`. */\nexport async function generate(input: CodegenConfig, options: GenerateOptions = {}): Promise<GenerateResult> {\n\tconst logger = options.logger ?? silentLogger;\n\tconst built = await buildSource(input, options);\n\tconst { config } = built;\n\tlet source = built.raw;\n\tif (config.format) {\n\t\tsource = await config.format(source, built.outputPath);\n\t}\n\tif (options.write !== false) {\n\t\tawait writeAtomically(built.outputPath, source);\n\t\tlogger.info(`Wrote ${built.sobjects.length} sObject type(s) to ${built.outputPath}`);\n\t}\n\tconst { contentHash } = readGeneratedHashes(built.raw) as GeneratedFileHashes;\n\treturn {\n\t\toutputPath: built.outputPath,\n\t\tapiVersion: config.apiVersion,\n\t\tsobjects: built.sobjects,\n\t\tskipped: built.skipped,\n\t\tsource,\n\t\tcontentHash,\n\t};\n}\n\n/**\n * Checks whether the generated file on disk is up to date with the org, without writing it.\n * Only content counts: a file reformatted by Prettier, oxfmt or the `format` hook is up to date.\n */\nexport async function checkGenerated(input: CodegenConfig, options: GenerateOptions = {}): Promise<CheckResult> {\n\tconst built = await buildSource(input, options);\n\tconst empty = { outputPath: built.outputPath, added: [], removed: [], changed: [] };\n\tif (!existsSync(built.outputPath)) {\n\t\treturn { ...empty, upToDate: false, reason: \"missing\" };\n\t}\n\tconst existing = await readFile(built.outputPath, \"utf8\");\n\tconst expected = readGeneratedHashes(built.raw) as GeneratedFileHashes;\n\tconst actual = readGeneratedHashes(existing);\n\tif (!actual) {\n\t\t// Older files have no hash header: compare content, ignoring formatting.\n\t\tconst upToDate = normalizeSource(existing) === normalizeSource(built.raw);\n\t\treturn { ...empty, upToDate, reason: upToDate ? undefined : \"changed\" };\n\t}\n\tif (actual.contentHash === expected.contentHash) {\n\t\treturn { ...empty, upToDate: true };\n\t}\n\treturn { ...empty, upToDate: false, reason: \"changed\", ...diffObjects(actual.sobjects, expected.sobjects) };\n}\n\nasync function buildSource(\n\tinput: CodegenConfig,\n\toptions: GenerateOptions,\n): Promise<{\n\tconfig: CodegenConfig;\n\toutputPath: string;\n\traw: string;\n\tsobjects: string[];\n\tskipped: GenerateResult[\"skipped\"];\n}> {\n\tconst config = validateConfig(input, { source: \"generate()\" });\n\tconst { apiVersion } = config;\n\tconst logger = options.logger ?? silentLogger;\n\tconst env = options.env ?? process.env;\n\tconst outputPath = isAbsolute(config.output) ? config.output : resolve(options.cwd ?? process.cwd(), config.output);\n\n\tconst client = new SalesforceClient({\n\t\tauth: resolveAuth(config.auth, env, { warn: (message) => logger.warn(message) }),\n\t\tapiVersion,\n\t\ttransport: config.transport,\n\t\tretry: true,\n\t});\n\n\tconst names = await resolveSObjectNames(client, config, logger);\n\tlogger.info(`Describing ${names.length} sObject(s) with API ${apiVersion}...`);\n\tconst { describes, skipped } = await describeAll(client, names, config, logger);\n\n\tconst raw = generateSource(describes, {\n\t\texcludeCreateFields: config.excludeCreateFields,\n\t\texcludeUpdateFields: config.excludeUpdateFields,\n\t\tpicklists: config.picklists,\n\t\tconstants: config.constants,\n\t\timportSource: config.importSource,\n\t\tapiVersion,\n\t});\n\treturn { config, outputPath, raw, sobjects: describes.map((describe) => describe.name).sort(), skipped };\n}\n\nfunction diffObjects(\n\tactual: ReadonlyMap<string, string>,\n\texpected: ReadonlyMap<string, string>,\n): Pick<CheckResult, \"added\" | \"removed\" | \"changed\"> {\n\treturn {\n\t\tadded: [...expected.keys()].filter((name) => !actual.has(name)),\n\t\tremoved: [...actual.keys()].filter((name) => !expected.has(name)),\n\t\tchanged: [...expected.entries()]\n\t\t\t.filter(([name, hash]) => actual.has(name) && actual.get(name) !== hash)\n\t\t\t.map(([name]) => name),\n\t};\n}\n\n/** Strips comments, whitespace, quote style, semicolons and commas, so only content remains. */\nfunction normalizeSource(source: string): string {\n\tlet result = \"\";\n\tlet index = 0;\n\twhile (index < source.length) {\n\t\tconst char = source[index];\n\t\tconst next = source[index + 1];\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\t// Keep the string's content exactly; only the quote style is normalised.\n\t\t\tlet end = index + 1;\n\t\t\twhile (end < source.length && source[end] !== char) {\n\t\t\t\tend += source[end] === \"\\\\\" ? 2 : 1;\n\t\t\t}\n\t\t\tresult += `\"${source\n\t\t\t\t.slice(index + 1, end)\n\t\t\t\t.replace(/\\\\'/g, \"'\")\n\t\t\t\t.replace(/\"/g, '\\\\\"')}\"`;\n\t\t\tindex = end + 1;\n\t\t} else if (char === \"/\" && next === \"/\") {\n\t\t\tindex = source.indexOf(\"\\n\", index) === -1 ? source.length : source.indexOf(\"\\n\", index);\n\t\t} else if (char === \"/\" && next === \"*\") {\n\t\t\tconst end = source.indexOf(\"*/\", index + 2);\n\t\t\tindex = end === -1 ? source.length : end + 2;\n\t\t} else {\n\t\t\tif (!/[\\s;,]/.test(char)) {\n\t\t\t\tresult += char;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport interface ResolveAuthOptions {\n\t/** Receives deprecation warnings, e.g. for the `*Env` keys. */\n\twarn?: (message: string) => void;\n}\n\n/** Where the JWT private key comes from, in order of preference, with each default variable. */\nconst PRIVATE_KEY_SOURCES = [\n\t[\"privateKey\", \"SF_PRIVATE_KEY\"],\n\t[\"privateKeyPath\", \"SF_PRIVATE_KEY_PATH\"],\n] as const;\n\n/** A `\"${NAME}\"` placeholder. Only a whole value counts, so a secret that contains `${` is kept as-is. */\nconst ENV_PLACEHOLDER = /^\\$\\{([A-Za-z_][A-Za-z0-9_]*)\\}$/;\n\n/**\n * Turns the config's auth setting into an auth provider. Each credential comes from its key in\n * the setting (a `\"${NAME}\"` placeholder is read from `env`), else from the variable a deprecated\n * `*Env` key names, else from its default `SF_*` variable. Throws one error listing every\n * missing credential.\n */\nexport function resolveAuth(\n\tauth: CodegenAuth | undefined,\n\tenv: Record<string, string | undefined>,\n\toptions: ResolveAuthOptions = {},\n): AuthProvider {\n\tconst setting = auth ?? { type: \"clientCredentials\" };\n\tif (\"getToken\" in setting) {\n\t\treturn setting;\n\t}\n\tconst problems: string[] = [];\n\tconst lookup = (key: string, defaultEnv: string): Credential =>\n\t\treadCredential(setting, key, defaultEnv, env, options.warn);\n\tconst read = (key: string, defaultEnv: string): string => {\n\t\tconst { value, problem } = lookup(key, defaultEnv);\n\t\tif (problem) {\n\t\t\tproblems.push(problem);\n\t\t}\n\t\treturn value;\n\t};\n\tswitch (setting.type) {\n\t\tcase \"accessToken\": {\n\t\t\tconst token = {\n\t\t\t\taccessToken: read(\"accessToken\", \"SF_ACCESS_TOKEN\"),\n\t\t\t\tinstanceUrl: read(\"instanceUrl\", \"SF_INSTANCE_URL\"),\n\t\t\t};\n\t\t\tthrowIfMissing(setting.type, problems);\n\t\t\treturn accessToken(token);\n\t\t}\n\t\tcase \"jwtBearer\": {\n\t\t\tconst loginUrl = read(\"loginUrl\", \"SF_LOGIN_URL\");\n\t\t\tconst clientId = read(\"clientId\", \"SF_CLIENT_ID\");\n\t\t\tconst username = read(\"username\", \"SF_USERNAME\");\n\t\t\t// The key itself wins over the key file. Setting either one in the config skips both defaults,\n\t\t\t// so a stray SF_PRIVATE_KEY can't override a configured key file.\n\t\t\tconst configured = PRIVATE_KEY_SOURCES.filter(([key]) => key in setting);\n\t\t\tconst found = (configured.length > 0 ? configured : PRIVATE_KEY_SOURCES).map(([key, defaultEnv]) => ({\n\t\t\t\tkey,\n\t\t\t\t...lookup(key, defaultEnv),\n\t\t\t}));\n\t\t\tconst source = found.find((item) => item.value);\n\t\t\tif (source === undefined) {\n\t\t\t\tproblems.push(`no private key: ${found.map((item) => item.problem).join(\", and \")}`);\n\t\t\t}\n\t\t\tthrowIfMissing(setting.type, problems);\n\t\t\tconst privateKey = source?.key === \"privateKeyPath\" ? readFileSync(source.value, \"utf8\") : (source?.value ?? \"\");\n\t\t\treturn jwtBearer({ loginUrl, clientId, username, privateKey });\n\t\t}\n\t\tcase \"sfCli\": {\n\t\t\t// Left out: the CLI's default org. Set but empty fails like any other credential, so a typo\n\t\t\t// in `process.env.NAME` can't silently switch to the default org.\n\t\t\tconst targetOrg = \"targetOrg\" in setting ? read(\"targetOrg\", \"\") : undefined;\n\t\t\tthrowIfMissing(setting.type, problems);\n\t\t\treturn sfCli({ targetOrg });\n\t\t}\n\t\tcase \"clientCredentials\": {\n\t\t\tconst credentials = {\n\t\t\t\tloginUrl: read(\"loginUrl\", \"SF_LOGIN_URL\"),\n\t\t\t\tclientId: read(\"clientId\", \"SF_CLIENT_ID\"),\n\t\t\t\tclientSecret: read(\"clientSecret\", \"SF_CLIENT_SECRET\"),\n\t\t\t};\n\t\t\tthrowIfMissing(setting.type, problems);\n\t\t\treturn clientCredentials(credentials);\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown codegen auth type \"${(setting as { type: string }).type}\".`);\n\t}\n}\n\nexport interface LoadAuthOptions extends ResolveAuthOptions {\n\t/** The config file. Defaults to the first `sobjectly.config.{ts,mts,cts,json}` in `cwd`. */\n\tconfigPath?: string;\n\t/** Where to look for the config file. Defaults to `process.cwd()`. */\n\tcwd?: string;\n\t/** Where `\"${NAME}\"` placeholders and the default `SF_*` variables are read from. Defaults to `process.env`. */\n\tenv?: Record<string, string | undefined>;\n}\n\n/**\n * Loads the sobjectly config and returns an auth provider for its `auth` setting, so the client\n * logs in the same way as `sobjectly generate`:\n * `new SalesforceClient({ apiVersion: API_VERSION, auth: await loadAuth() })`.\n * Throws when no config file is found, or one error listing every missing credential.\n */\nexport async function loadAuth(options: LoadAuthOptions = {}): Promise<AuthProvider> {\n\tconst cwd = options.cwd ?? process.cwd();\n\tlet configPath = options.configPath === undefined ? undefined : resolve(cwd, options.configPath);\n\tif (configPath === undefined) {\n\t\tconst found = findConfigFiles(cwd);\n\t\tif (found.length > 1) {\n\t\t\toptions.warn?.(`found ${found.join(\" and \")}; using ${found[0]}. Remove the other one.`);\n\t\t}\n\t\tconfigPath = found[0];\n\t}\n\tif (configPath === undefined) {\n\t\tthrow new Error(\n\t\t\t`No sobjectly config file found in ${cwd} (looked for ${CONFIG_FILE_NAMES.join(\", \")}).\\n` +\n\t\t\t\t'Pass { configPath } to loadAuth(), run \"npx sobjectly init\" to create a config, ' +\n\t\t\t\t\"or pass an auth provider such as clientCredentials() to SalesforceClient directly.\",\n\t\t);\n\t}\n\tconst { config } = await loadConfig(configPath);\n\treturn resolveAuth(config.auth, options.env ?? process.env, { warn: options.warn });\n}\n\ninterface Credential {\n\tvalue: string;\n\tproblem?: string;\n}\n\nfunction readCredential(\n\tsetting: AuthSetting,\n\tkey: string,\n\tdefaultEnv: string,\n\tenv: Record<string, string | undefined>,\n\twarn: ((message: string) => void) | undefined,\n): Credential {\n\tconst values = setting as unknown as Record<string, unknown>;\n\tif (key in values) {\n\t\t// Set in the config: never fall back to a default variable, so `process.env.TYPO` fails loudly.\n\t\tconst configured = values[key];\n\t\tconst name = typeof configured === \"string\" ? ENV_PLACEHOLDER.exec(configured)?.[1] : undefined;\n\t\tif (name !== undefined) {\n\t\t\treturn fromEnv(env, name, ` (from auth.${key} \"${String(configured)}\")`);\n\t\t}\n\t\treturn typeof configured === \"string\" && configured.length > 0\n\t\t\t? { value: configured }\n\t\t\t: { value: \"\", problem: `auth.${key} is empty or undefined (if it reads process.env, that variable is not set)` };\n\t}\n\tconst envKey = `${key}Env`;\n\tconst legacy = values[envKey];\n\tif (typeof legacy === \"string\") {\n\t\twarn?.(\n\t\t\t`auth.${envKey} is deprecated and will be removed in 2.0. Use ${key}: process.env.${legacy} in a TypeScript config, or \"${key}\": \"\\${${legacy}}\" in JSON.`,\n\t\t);\n\t\treturn fromEnv(env, legacy, \"\");\n\t}\n\treturn fromEnv(env, defaultEnv, \"\");\n}\n\nfunction fromEnv(env: Record<string, string | undefined>, name: string, origin: string): Credential {\n\tconst value = env[name];\n\treturn value ? { value } : { value: \"\", problem: `environment variable ${name}${origin} is not set` };\n}\n\nfunction throwIfMissing(type: string, problems: readonly string[]): void {\n\tif (problems.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Missing Salesforce credentials for auth \"${type}\":\\n${problems.map((problem) => ` - ${problem}`).join(\"\\n\")}\\n` +\n\t\t\t\t\"Fill them in under auth in the config, or set the environment variables (e.g. with --env-file .env).\",\n\t\t);\n\t}\n}\n\nasync function resolveSObjectNames(\n\tclient: SalesforceClient,\n\tconfig: CodegenConfig,\n\tlogger: CodegenLogger,\n): Promise<string[]> {\n\t// sObject names are case-insensitive in Salesforce.\n\tconst exclude = new Set((config.exclude ?? []).map((name) => name.toLowerCase()));\n\tif (config.sobjects && config.sobjects.length > 0) {\n\t\tconst unique = new Map<string, string>();\n\t\tfor (const name of config.sobjects) {\n\t\t\tif (!unique.has(name.toLowerCase())) {\n\t\t\t\tunique.set(name.toLowerCase(), name);\n\t\t\t}\n\t\t}\n\t\treturn [...unique.entries()].filter(([key]) => !exclude.has(key)).map(([, name]) => name);\n\t}\n\tlogger.warn(\"No `sobjects` configured: generating every queryable sObject. Consider an explicit list.\");\n\tconst global = await client.describeGlobal();\n\treturn global.sobjects\n\t\t.filter((sobject) => sobject.queryable && !sobject.deprecatedAndHidden && !exclude.has(sobject.name.toLowerCase()))\n\t\t.map((sobject) => sobject.name);\n}\n\nasync function describeAll(\n\tclient: SalesforceClient,\n\tnames: readonly string[],\n\tconfig: CodegenConfig,\n\tlogger: CodegenLogger,\n): Promise<{ describes: CodegenDescribe[]; skipped: GenerateResult[\"skipped\"] }> {\n\tconst concurrency = Math.max(1, config.concurrency ?? 10);\n\tconst describes: CodegenDescribe[] = [];\n\tconst skipped: GenerateResult[\"skipped\"] = [];\n\tlet next = 0;\n\tlet done = 0;\n\t// Stops the other workers (and their in-flight requests) once one describe has failed.\n\tconst failed = new AbortController();\n\n\tconst worker = async (): Promise<void> => {\n\t\twhile (next < names.length && !failed.signal.aborted) {\n\t\t\tconst name = names[next++];\n\t\t\ttry {\n\t\t\t\tconst describe: DescribeSObjectResult = await client.sobject(name).describe({ signal: failed.signal });\n\t\t\t\tdescribes.push(describe);\n\t\t\t} catch (error) {\n\t\t\t\tif (failed.signal.aborted) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tif (!config.continueOnDescribeError) {\n\t\t\t\t\tfailed.abort();\n\t\t\t\t\tthrow new Error(`Describing sObject \"${name}\" failed: ${message}`, { cause: error });\n\t\t\t\t}\n\t\t\t\tlogger.warn(`Skipping sObject \"${name}\": ${message}`);\n\t\t\t\tskipped.push({ name, error: message });\n\t\t\t}\n\t\t\tdone++;\n\t\t\tif (done % 10 === 0 || done === names.length) {\n\t\t\t\tlogger.info(`Described ${done}/${names.length} sObject(s)`);\n\t\t\t}\n\t\t}\n\t};\n\n\tawait Promise.all(Array.from({ length: Math.min(concurrency, names.length) }, () => worker()));\n\t// Two configured names can resolve to the same sObject (e.g. a different case): keep one.\n\tconst unique = new Map(describes.map((describe) => [describe.name, describe] as const));\n\treturn { describes: [...unique.values()], skipped };\n}\n\nasync function writeAtomically(filePath: string, content: string): Promise<void> {\n\tawait mkdir(dirname(filePath), { recursive: true });\n\tconst temporary = `${filePath}.${process.pid}.${Date.now()}.tmp`;\n\ttry {\n\t\tawait writeFile(temporary, content, \"utf8\");\n\t\tawait renameWithRetry(temporary, filePath);\n\t} catch (error) {\n\t\tawait rm(temporary, { force: true });\n\t\tthrow error;\n\t}\n}\n\n/** On Windows a virus scanner or indexer can briefly lock the target file; retry a few times. */\nasync function renameWithRetry(from: string, to: string): Promise<void> {\n\tfor (let attempt = 1; ; attempt++) {\n\t\ttry {\n\t\t\tawait rename(from, to);\n\t\t\treturn;\n\t\t} catch (error) {\n\t\t\tconst code = (error as NodeJS.ErrnoException).code;\n\t\t\tif (attempt >= 5 || (code !== \"EPERM\" && code !== \"EBUSY\" && code !== \"EACCES\")) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 50 * attempt));\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,aAAa,UAAwE;CACpG,OAAO,CAAC,GAAG,SAAS,MAAM,CAAC,CAAC,MAAM,GAAG,MAAO,EAAE,SAAS,OAAO,KAAK,EAAE,SAAS,OAAO,IAAI,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAE;AAClH;;AAGA,SAAgB,YAAY,MAAsB;CACjD,OAAOA,aAAW,KAAK,IAAI,IAAI,OAAO,KAAK,UAAU,IAAI;AAC1D;AAEA,SAAgB,cAAc,OAA0C;CACvE,OAAO,OAAO,SAAS,EAAE,CAAC,CACxB,QAAQ,SAAS,MAAM,CAAC,CACxB,QAAQ,UAAU,GAAG;AACxB;AAEA,SAAgB,QAAQ,GAAW,GAAmB;CACrD,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI;AACjC;;;CApBaA,eAAa;;;;;;;;ACsD1B,SAAgB,aAAa,OAAqB,YAA0B,SAAS,UAA2B;CAC/G,MAAM,OAAO,aAAa,OAAO,WAAW,QAAQ,KAAK,eAAe,MAAM,SAAS;CACvF,OAAO,MAAM,YAAY,SAAS,YAAY,GAAG,KAAK,WAAW;AAClE;AAEA,SAAS,aAAa,OAAqB,WAAyB,UAAkD;CACrH,IAAI,cAAc,YAAa,MAAM,SAAS,cAAc,MAAM,SAAS,YAC1E;CAED,MAAM,SAAS,qBAAqB,KAAK;CACzC,IAAI,OAAO,WAAW,GACrB;CAED,MAAM,UACL,cAAc,WAAW,aAAa,KAAA,IACnC,WACA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