@cerios/salesforce-sobjectly 0.0.0-stage → 1.0.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.
@@ -0,0 +1,312 @@
1
+ import { E as AuthProvider, O as HttpTransport, a as FieldDescribe, c as RecordTypeInfo, t as ChildRelationship, u as ApiVersion } from "./describe-Dj3J8o-x.mjs";
2
+ //#region src/codegen/config.d.ts
3
+ /** Client credentials read from environment variables (defaults shown). */
4
+ interface EnvClientCredentialsAuth {
5
+ type: "clientCredentials";
6
+ /** Defaults to `SF_LOGIN_URL` (your My Domain URL). */
7
+ loginUrlEnv?: string;
8
+ /** Defaults to `SF_CLIENT_ID`. */
9
+ clientIdEnv?: string;
10
+ /** Defaults to `SF_CLIENT_SECRET`. */
11
+ clientSecretEnv?: string;
12
+ }
13
+ /** An access token read from environment variables (defaults shown), e.g. from `sf org display`. */
14
+ interface EnvAccessTokenAuth {
15
+ type: "accessToken";
16
+ /** Defaults to `SF_ACCESS_TOKEN`. */
17
+ accessTokenEnv?: string;
18
+ /** Defaults to `SF_INSTANCE_URL`. */
19
+ instanceUrlEnv?: string;
20
+ }
21
+ /** JWT bearer flow with values read from environment variables (defaults shown). */
22
+ interface EnvJwtBearerAuth {
23
+ type: "jwtBearer";
24
+ /** Defaults to `SF_LOGIN_URL`. */
25
+ loginUrlEnv?: string;
26
+ /** Defaults to `SF_CLIENT_ID`. */
27
+ clientIdEnv?: string;
28
+ /** Defaults to `SF_USERNAME`. */
29
+ usernameEnv?: string;
30
+ /** The PEM key itself. Defaults to `SF_PRIVATE_KEY`. */
31
+ privateKeyEnv?: string;
32
+ /** A path to the PEM key file, used when the key variable is empty. Defaults to `SF_PRIVATE_KEY_PATH`. */
33
+ privateKeyPathEnv?: string;
34
+ }
35
+ /** An auth setting that reads credentials from environment variables. The only kind a JSON config can use. */
36
+ /** An org you are logged into with the Salesforce CLI (`sf org login web --alias my-org`). */
37
+ interface SfCliAuth {
38
+ type: "sfCli";
39
+ /** The org alias or username. Defaults to the CLI's default org. */
40
+ targetOrg?: string;
41
+ }
42
+ type EnvAuth = EnvClientCredentialsAuth | EnvAccessTokenAuth | EnvJwtBearerAuth | SfCliAuth;
43
+ /** Env-based auth, or any auth provider (TypeScript configs only). */
44
+ type CodegenAuth = EnvAuth | AuthProvider;
45
+ type PicklistMode =
46
+ /** Every picklist is `string`. */
47
+ "string" |
48
+ /** Restricted picklists become a union of their values; unrestricted ones `"A" | "B" | (string & {})`. */
49
+ "union";
50
+ /**
51
+ * The codegen config. `S` is the union of the listed sObject names; `defineConfig` infers it, so
52
+ * per-sObject options such as `excludeCreateFields` only accept listed names.
53
+ */
54
+ interface CodegenConfig<S extends string = string> {
55
+ /** Output file, relative to the config file's directory, e.g. `"src/generated/sobjects.ts"`. */
56
+ output: string;
57
+ /**
58
+ * The API version to describe with, e.g. `"v66.0"`. Required. It is also written to the
59
+ * generated file as `API_VERSION`, so the client can use the same version.
60
+ */
61
+ apiVersion: ApiVersion;
62
+ /**
63
+ * sObjects to generate. Strongly recommended: without it every queryable sObject in the org
64
+ * is generated, which can be thousands of types.
65
+ */
66
+ sobjects?: readonly S[];
67
+ /** sObjects to skip (applied after `sobjects`). */
68
+ exclude?: readonly string[];
69
+ /** How to authenticate. Defaults to client credentials from `SF_LOGIN_URL`, `SF_CLIENT_ID` and `SF_CLIENT_SECRET`. */
70
+ auth?: CodegenAuth;
71
+ /** Fields to leave out of the create input per sObject (e.g. fields describe marks createable but REST rejects). */
72
+ excludeCreateFields?: Partial<Record<NoInfer<S>, readonly string[]>>;
73
+ /** Fields to leave out of the update input per sObject. */
74
+ excludeUpdateFields?: Partial<Record<NoInfer<S>, readonly string[]>>;
75
+ /** How picklists are typed. Defaults to `"union"`. */
76
+ picklists?: PicklistMode;
77
+ /** Emit the `PICKLIST_VALUES` and `RECORD_TYPES` runtime constants. Defaults to `true`. */
78
+ constants?: boolean;
79
+ /** Parallel describe calls. Defaults to 10. */
80
+ concurrency?: number;
81
+ /** Skip sObjects whose describe fails instead of failing the run. Defaults to `false`. */
82
+ continueOnDescribeError?: boolean;
83
+ /** Where the generated file imports helper types from. Defaults to `"@cerios/salesforce-sobjectly"`. */
84
+ importSource?: string;
85
+ /** Post-processes the generated source, e.g. with your formatter. TypeScript configs only. */
86
+ format?: (source: string, filePath: string) => string | Promise<string>;
87
+ /** A custom transport for the describe calls (e.g. behind a proxy). TypeScript configs only. */
88
+ transport?: HttpTransport;
89
+ }
90
+ /**
91
+ * The shape of `sobjectly.config.json`: everything that can be written as JSON (no functions,
92
+ * no auth providers). `$schema` points editors at the bundled JSON Schema.
93
+ */
94
+ type JsonCodegenConfig = Omit<CodegenConfig, "auth" | "format" | "transport"> & {
95
+ $schema?: string;
96
+ auth?: EnvAuth;
97
+ };
98
+ /**
99
+ * Type-checks a `sobjectly.config.ts`. The listed `sobjects` become a literal union, so a typo in
100
+ * a per-sObject option is a compile error:
101
+ *
102
+ * ```ts
103
+ * export default defineConfig({
104
+ * apiVersion: "v66.0",
105
+ * output: "src/generated/sobjects.ts",
106
+ * sobjects: ["Account", "Contact"],
107
+ * excludeCreateFields: { Acount: ["Name"] }, // ❌ "Acount" is not in sobjects
108
+ * });
109
+ * ```
110
+ */
111
+ export declare function defineConfig<const S extends string = string>(config: CodegenConfig<S>): CodegenConfig<S>;
112
+ //#endregion
113
+ //#region src/codegen/type-mapper.d.ts
114
+ /** The subset of a field describe the generator needs. */
115
+ type CodegenField = Pick<FieldDescribe, "name" | "label" | "type" | "nillable" | "createable" | "updateable" | "defaultedOnCreate" | "referenceTo" | "relationshipName"> & Partial<Pick<FieldDescribe, "picklistValues" | "restrictedPicklist" | "externalId" | "idLookup">>;
116
+ /** Maps each Salesforce field type to a TypeScript type. Types not listed become `unknown`. */
117
+ export declare const FIELD_TYPE_MAP: Readonly<Record<string, string>>;
118
+ /** Returns the TypeScript type for a field, including `| null` for nillable fields. */
119
+ export declare function mapFieldType(field: CodegenField, picklists?: PicklistMode): string;
120
+ //#endregion
121
+ //#region src/codegen/generator.d.ts
122
+ /** The subset of an sObject describe the generator needs. */
123
+ interface CodegenDescribe {
124
+ name: string;
125
+ label?: string;
126
+ fields: CodegenField[];
127
+ childRelationships: Pick<ChildRelationship, "childSObject" | "field" | "relationshipName">[];
128
+ recordTypeInfos?: Pick<RecordTypeInfo, "developerName">[];
129
+ }
130
+ interface GenerateSourceOptions {
131
+ excludeCreateFields?: Partial<Record<string, readonly string[]>>;
132
+ excludeUpdateFields?: Partial<Record<string, readonly string[]>>;
133
+ picklists?: PicklistMode;
134
+ importSource?: string;
135
+ /** When set, the output exports it as `API_VERSION`, so the client can use the same version. */
136
+ apiVersion?: ApiVersion;
137
+ /** Emit the `PICKLIST_VALUES` and `RECORD_TYPES` runtime constants. Defaults to `true`. */
138
+ constants?: boolean;
139
+ }
140
+ /**
141
+ * Generates the TypeScript source for a set of sObject describes: a read interface, create
142
+ * and update input types per sObject, and the `SObjectRegistry` that ties them together.
143
+ * The output is deterministic: sObjects are sorted by name and fields by name (`Id` first).
144
+ */
145
+ export declare function generateSource(describes: readonly CodegenDescribe[], options?: GenerateSourceOptions): string;
146
+ /** The content hashes a generated file records in its header. */
147
+ interface GeneratedFileHashes {
148
+ /** SHA-256 of the unformatted generated content; formatting changes don't affect it. */
149
+ contentHash: string;
150
+ /** Short hash per sObject, to tell which sObjects changed. */
151
+ sobjects: Map<string, string>;
152
+ }
153
+ /** Reads the content hashes from a generated file's header (also after reformatting). */
154
+ export declare function readGeneratedHashes(source: string): GeneratedFileHashes | undefined;
155
+ //#endregion
156
+ //#region src/codegen/load-config.d.ts
157
+ /** Config file names, in lookup order. */
158
+ export declare const CONFIG_FILE_NAMES: string[];
159
+ /** Looks for a `sobjectly.config.{ts,mts,cts,json}` file in `cwd`; the first match in lookup order wins. */
160
+ export declare function findConfigFile(cwd?: string): string | undefined;
161
+ /** Every `sobjectly.config.*` file in `cwd`, in lookup order. */
162
+ export declare function findConfigFiles(cwd?: string): string[];
163
+ /**
164
+ * Loads and validates a TypeScript (`.ts`, `.mts`, `.cts`) or JSON config file. Returns the
165
+ * config and the directory it lives in. Throws a `CodegenConfigError` listing every problem.
166
+ */
167
+ export declare function loadConfig(configPath: string): Promise<{
168
+ config: CodegenConfig;
169
+ directory: string;
170
+ }>;
171
+ //#endregion
172
+ //#region src/codegen/validate-config.d.ts
173
+ /** Thrown when a codegen config is invalid. Lists every problem found. */
174
+ export declare class CodegenConfigError extends Error {
175
+ readonly source: string;
176
+ readonly problems: string[];
177
+ readonly name: string;
178
+ constructor(source: string, problems: string[]);
179
+ }
180
+ /** The env-variable options each env-based auth type accepts. */
181
+ export declare const AUTH_OPTIONS: Record<EnvAuth["type"], readonly string[]>;
182
+ /** The options a config may contain. */
183
+ export declare const CONFIG_OPTIONS: readonly string[];
184
+ /**
185
+ * Checks a loaded config and returns it typed. Throws a `CodegenConfigError` listing every
186
+ * problem. `json` disallows the options that only a TypeScript config can express.
187
+ */
188
+ export declare function validateConfig(value: unknown, options: {
189
+ source: string;
190
+ json?: boolean;
191
+ }): CodegenConfig;
192
+ //#endregion
193
+ //#region src/codegen/prompter.d.ts
194
+ interface Choice<T extends string> {
195
+ value: T;
196
+ label: string;
197
+ }
198
+ /** Asks questions. The CLI uses `readlinePrompter`; tests pass a scripted implementation. */
199
+ interface Prompter {
200
+ /** Asks for text. `validate` returns an error message to ask again, or `undefined` to accept. */
201
+ ask(question: string, options?: {
202
+ defaultValue?: string;
203
+ validate?: (answer: string) => string | undefined;
204
+ }): Promise<string>;
205
+ /** Asks to pick one of `choices`, by number or value. */
206
+ choose<T extends string>(question: string, choices: readonly Choice<T>[], defaultValue: T): Promise<T>;
207
+ /** Asks a yes/no question. */
208
+ confirm(question: string, defaultValue: boolean): Promise<boolean>;
209
+ close(): void;
210
+ }
211
+ /**
212
+ * A prompter on stdin/stdout (or the given streams). Lines are queued as they arrive, so piped
213
+ * input (`printf "v66.0\n..." | sobjectly init`) works too. If the input ends before a question
214
+ * is answered, the question rejects.
215
+ */
216
+ export declare function readlinePrompter(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): Prompter;
217
+ //#endregion
218
+ //#region src/codegen/init.d.ts
219
+ type InitAuthType = "clientCredentials" | "accessToken" | "jwtBearer" | "sfCli";
220
+ type InitConfigFormat = "ts" | "json";
221
+ interface InitAnswers {
222
+ apiVersion: ApiVersion;
223
+ output: string;
224
+ sobjects: string[];
225
+ auth: InitAuthType;
226
+ /** The Salesforce CLI org alias, for `auth: "sfCli"`. Omitted means the CLI's default org. */
227
+ targetOrg?: string;
228
+ picklists: PicklistMode;
229
+ format: InitConfigFormat;
230
+ }
231
+ interface InitOptions {
232
+ cwd: string;
233
+ prompter: Prompter;
234
+ log: (message: string) => void;
235
+ /** Answers given up front (e.g. CLI flags); those questions are skipped. */
236
+ preset?: Partial<InitAnswers>;
237
+ /** Accept the suggested answer for every question not in `preset`. `apiVersion` must then be preset. */
238
+ yes?: boolean;
239
+ /** Overwrite an existing config without asking. */
240
+ force?: boolean;
241
+ }
242
+ interface InitResult {
243
+ /** `undefined` when the user chose not to overwrite an existing config. */
244
+ configPath: string | undefined;
245
+ answers?: InitAnswers;
246
+ envExampleUpdated?: boolean;
247
+ scriptAdded?: boolean;
248
+ }
249
+ /** The environment variables each auth type reads by default. */
250
+ export declare const AUTH_ENV_VARS: Record<InitAuthType, string[]>;
251
+ /**
252
+ * Creates a `sobjectly.config` file by asking for the API version, output path, sObjects, auth
253
+ * method, picklist mode and file format. Optionally adds the auth variables to `.env.example`
254
+ * and an npm script to `package.json`.
255
+ */
256
+ export declare function runInit(options: InitOptions): Promise<InitResult>;
257
+ /** Splits a comma/space separated list of sObject names, removing duplicates. */
258
+ export declare function parseSObjects(answer: string): string[];
259
+ /** Renders the config file in the chosen format. */
260
+ export declare function renderConfig(answers: InitAnswers): string;
261
+ //#endregion
262
+ //#region src/codegen/index.d.ts
263
+ export interface CodegenLogger {
264
+ info(message: string): void;
265
+ warn(message: string): void;
266
+ }
267
+ export interface GenerateOptions {
268
+ /** Directory that `output` is resolved against. Defaults to `process.cwd()`. */
269
+ cwd?: string;
270
+ logger?: CodegenLogger;
271
+ /** Environment to read credentials from. Defaults to `process.env`. */
272
+ env?: Record<string, string | undefined>;
273
+ /** Write the file. Defaults to `true`; with `false` the source is only returned. */
274
+ write?: boolean;
275
+ }
276
+ export interface GenerateResult {
277
+ outputPath: string;
278
+ /** The concrete API version the types were generated with. */
279
+ apiVersion: ApiVersion;
280
+ sobjects: string[];
281
+ skipped: {
282
+ name: string;
283
+ error: string;
284
+ }[];
285
+ /** The generated source (after the `format` hook). */
286
+ source: string;
287
+ /** SHA-256 of the unformatted content, as recorded in the file header. */
288
+ contentHash: string;
289
+ }
290
+ export interface CheckResult {
291
+ /** `true` when the file on disk has the same content (formatting differences are ignored). */
292
+ upToDate: boolean;
293
+ /** Why the file is out of date. */
294
+ reason?: "missing" | "changed";
295
+ outputPath: string;
296
+ /** sObjects that would be added, removed or changed (known when the file has hash headers). */
297
+ added: string[];
298
+ removed: string[];
299
+ changed: string[];
300
+ }
301
+ /** Describes the configured sObjects and writes the generated types to `config.output`. */
302
+ export declare function generate(input: CodegenConfig, options?: GenerateOptions): Promise<GenerateResult>;
303
+ /**
304
+ * Checks whether the generated file on disk is up to date with the org, without writing it.
305
+ * Only content counts: a file reformatted by Prettier, oxfmt or the `format` hook is up to date.
306
+ */
307
+ export declare function checkGenerated(input: CodegenConfig, options?: GenerateOptions): Promise<CheckResult>;
308
+ /** Turns the config's auth setting into an auth provider, reading env-based credentials. */
309
+ export declare function resolveAuth(auth: CodegenAuth | undefined, env: Record<string, string | undefined>): AuthProvider;
310
+ //#endregion
311
+ export type { Choice, CodegenAuth, CodegenConfig, CodegenDescribe, CodegenField, EnvAccessTokenAuth, EnvAuth, EnvClientCredentialsAuth, EnvJwtBearerAuth, GenerateSourceOptions, GeneratedFileHashes, InitAnswers, InitAuthType, InitConfigFormat, InitOptions, InitResult, JsonCodegenConfig, PicklistMode, Prompter, SfCliAuth };
312
+ //# sourceMappingURL=codegen.d.mts.map
@@ -0,0 +1,10 @@
1
+ import { C as validateConfig, D as FIELD_TYPE_MAP, E as readGeneratedHashes, O as init_type_mapper, S as init_validate_config, T as init_generator, _ as defineConfig, a as init_prompter, b as CONFIG_OPTIONS, c as init_init, d as runInit, f as CONFIG_FILE_NAMES, g as loadConfig, h as init_load_config, i as resolveAuth, k as mapFieldType, l as parseSObjects, m as findConfigFiles, n as generate, o as readlinePrompter, p as findConfigFile, r as init_codegen, s as AUTH_ENV_VARS, t as checkGenerated, u as renderConfig, v as init_config, w as generateSource, x as CodegenConfigError, y as AUTH_OPTIONS } from "./codegen-CSx0WAtK.mjs";
2
+ init_type_mapper();
3
+ init_generator();
4
+ init_validate_config();
5
+ init_config();
6
+ init_load_config();
7
+ init_init();
8
+ init_prompter();
9
+ init_codegen();
10
+ export { AUTH_ENV_VARS, AUTH_OPTIONS, CONFIG_FILE_NAMES, CONFIG_OPTIONS, CodegenConfigError, FIELD_TYPE_MAP, checkGenerated, defineConfig, findConfigFile, findConfigFiles, generate, generateSource, loadConfig, mapFieldType, parseSObjects, readGeneratedHashes, readlinePrompter, renderConfig, resolveAuth, runInit, validateConfig };
@@ -0,0 +1,284 @@
1
+ //#region src/http/transport.d.ts
2
+ type HttpMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD";
3
+ /** A fully prepared HTTP request handed to a transport. */
4
+ interface TransportRequest {
5
+ method: HttpMethod;
6
+ url: URL;
7
+ headers: Headers;
8
+ body?: string | Uint8Array;
9
+ /** Aborts the request (covers both caller cancellation and the client timeout). */
10
+ signal?: AbortSignal;
11
+ /** The client timeout in milliseconds, for transports that take it as an option instead of a signal. */
12
+ timeoutMs?: number;
13
+ }
14
+ /** A buffered HTTP response returned by a transport. Non-2xx statuses must be returned, not thrown. */
15
+ interface TransportResponse {
16
+ status: number;
17
+ headers: Headers;
18
+ body: Uint8Array;
19
+ }
20
+ /** A response whose body arrives as a stream of chunks. */
21
+ interface StreamingTransportResponse {
22
+ status: number;
23
+ headers: Headers;
24
+ body: AsyncIterable<Uint8Array>;
25
+ }
26
+ /**
27
+ * The only thing the client needs from an HTTP library. Implement it to plug in any client
28
+ * (undici, axios, got, a logging wrapper, ...). See `fetchTransport`.
29
+ */
30
+ interface HttpTransport {
31
+ send(request: TransportRequest): Promise<TransportResponse>;
32
+ /**
33
+ * Optional: sends a request and streams the response body. Used for large downloads such as
34
+ * Bulk API results; transports without it fall back to `send`.
35
+ */
36
+ stream?(request: TransportRequest): Promise<StreamingTransportResponse>;
37
+ }
38
+ //#endregion
39
+ //#region src/auth/types.d.ts
40
+ /** An access token together with the instance it is valid for. */
41
+ interface AccessToken {
42
+ accessToken: string;
43
+ /** The org's instance URL, e.g. `https://mydomain.my.salesforce.com`. API calls go here. */
44
+ instanceUrl: string;
45
+ /** Optional expiry in epoch milliseconds. When set, the token is refreshed shortly before it expires. */
46
+ expiresAt?: number;
47
+ }
48
+ interface AuthContext {
49
+ /** The client's transport, so token requests use the same HTTP stack as API calls. */
50
+ transport: HttpTransport;
51
+ signal?: AbortSignal;
52
+ }
53
+ /**
54
+ * Supplies access tokens to the client. Implementations should cache tokens; the client calls
55
+ * `getToken` before every request.
56
+ */
57
+ interface AuthProvider {
58
+ getToken(context: AuthContext): Promise<AccessToken>;
59
+ /**
60
+ * Called when Salesforce answered 401 for `token`. Providers that can obtain a new token
61
+ * should drop it from their cache; the client then retries the request once.
62
+ */
63
+ invalidate?(token: AccessToken): void;
64
+ }
65
+ //#endregion
66
+ //#region src/types/error-codes.d.ts
67
+ /**
68
+ * Common Salesforce error codes: record-level `StatusCode` values (in save results) and
69
+ * call-level `ExceptionCode` values (in REST error bodies). Salesforce has hundreds more, so the
70
+ * type stays open (`string & {}`) while giving autocomplete for these.
71
+ */
72
+ type KnownSalesforceErrorCode = "ALL_OR_NONE_OPERATION_ROLLED_BACK" | "ALREADY_IN_PROCESS" | "CANNOT_EXECUTE_FLOW_TRIGGER" | "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY" | "CANNOT_UPDATE_CONVERTED_LEAD" | "CIRCULAR_DEPENDENCY" | "DELETE_FAILED" | "DEPENDENCY_EXISTS" | "DUPLICATE_EXTERNAL_ID" | "DUPLICATE_VALUE" | "DUPLICATES_DETECTED" | "ENTITY_IS_ARCHIVED" | "ENTITY_IS_DELETED" | "ENTITY_IS_LOCKED" | "FIELD_CUSTOM_VALIDATION_EXCEPTION" | "FIELD_FILTER_VALIDATION_EXCEPTION" | "FIELD_INTEGRITY_EXCEPTION" | "FILE_SIZE_LIMIT_EXCEEDED" | "FLOW_EXCEPTION" | "INACTIVE_OWNER_OR_USER" | "INSUFFICIENT_ACCESS" | "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" | "INSUFFICIENT_ACCESS_OR_READONLY" | "INVALID_CROSS_REFERENCE_KEY" | "INVALID_EMAIL_ADDRESS" | "INVALID_FIELD_FOR_INSERT_UPDATE" | "INVALID_ID_FIELD" | "INVALID_OPERATION" | "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST" | "INVALID_RECORD_TYPE" | "INVALID_STATUS" | "INVALID_TYPE_ON_FIELD_IN_RECORD" | "LIMIT_EXCEEDED" | "MALFORMED_ID" | "MANAGER_NOT_DEFINED" | "MAXIMUM_SIZE_OF_DOCUMENT" | "MISSING_ARGUMENT" | "NO_APPLICABLE_PROCESS" | "NUMBER_OUTSIDE_VALID_RANGE" | "OPERATION_ENQUEUED" | "PLATFORM_EVENT_PUBLISH_FAILED" | "PLATFORM_EVENT_PUBLISHING_UNAVAILABLE" | "PROCESSING_HALTED" | "REQUIRED_FIELD_MISSING" | "STORAGE_LIMIT_EXCEEDED" | "STRING_TOO_LONG" | "TOO_MANY_APEX_REQUESTS" | "UNABLE_TO_LOCK_ROW" | "UNKNOWN_EXCEPTION" | "API_CURRENTLY_DISABLED" | "API_DISABLED_FOR_ORG" | "APEX_REST_SERVICES_DISABLED" | "ENTITY_NOT_QUERYABLE" | "EXCEEDED_ID_LIMIT" | "EXCEEDED_MAX_SEMIJOIN_SUBSELECTS" | "FUNCTIONALITY_NOT_ENABLED" | "INTERNAL_ERROR" | "INVALID_BATCH_SIZE" | "INVALID_FIELD" | "INVALID_ID" | "INVALID_LOGIN" | "INVALID_QUERY_FILTER_OPERATOR" | "INVALID_QUERY_LOCATOR" | "INVALID_SESSION_ID" | "INVALID_TYPE" | "INVALID_VERSION" | "JSON_PARSER_ERROR" | "MALFORMED_QUERY" | "MIXED_DML_OPERATION" | "MULTIPLE_RECORDS_FOUND" | "NOT_FOUND" | "NOT_MODIFIED" | "OPERATION_TOO_LARGE" | "QUERY_TIMEOUT" | "QUERY_TOO_COMPLICATED" | "REQUEST_LIMIT_EXCEEDED" | "REQUEST_RUNNING_TOO_LONG" | "SERVER_UNAVAILABLE" | "UNSUPPORTED_API_VERSION";
73
+ /** A Salesforce error code: autocomplete for the common ones, any string accepted. */
74
+ type SalesforceErrorCode = KnownSalesforceErrorCode | (string & {});
75
+ //#endregion
76
+ //#region src/types/common.d.ts
77
+ /** A Salesforce REST API version such as `"v66.0"`. */
78
+ type ApiVersion = `v${number}.${number}`;
79
+ /** The `attributes` object Salesforce adds to every record it returns. */
80
+ interface RecordAttributes {
81
+ type: string;
82
+ /** Absent in some contexts, such as aggregate query rows. */
83
+ url?: string;
84
+ }
85
+ /** Adds the Salesforce `attributes` object to a record type. */
86
+ type WithAttributes<T> = T & {
87
+ attributes: RecordAttributes;
88
+ };
89
+ /** An untyped record, used when no generated registry is supplied. */
90
+ type GenericRecord = Record<string, unknown>;
91
+ /** An item of the error array Salesforce returns for a non-2xx REST response. */
92
+ interface RestError {
93
+ message: string;
94
+ errorCode: SalesforceErrorCode;
95
+ fields?: string[];
96
+ [key: string]: unknown;
97
+ }
98
+ /** An error inside a save/delete/upsert result. Note: `statusCode`, not `errorCode`. */
99
+ interface SaveError {
100
+ statusCode: SalesforceErrorCode;
101
+ message: string;
102
+ fields: string[];
103
+ extendedErrorDetails?: unknown;
104
+ }
105
+ interface SaveResult {
106
+ /** Absent when the operation failed. */
107
+ id?: string;
108
+ success: boolean;
109
+ errors: SaveError[];
110
+ }
111
+ interface UpsertResult extends SaveResult {
112
+ /** `true` when the record was inserted, `false` when an existing record was updated. */
113
+ created?: boolean;
114
+ }
115
+ type DeleteResult = SaveResult;
116
+ /** The raw shape of a `/query`, `/queryAll` or `/tooling/query` response page. */
117
+ interface QueryResponse<T> {
118
+ totalSize: number;
119
+ done: boolean;
120
+ nextRecordsUrl?: string;
121
+ records: T[];
122
+ }
123
+ /** A Salesforce compound address field value. */
124
+ interface SalesforceAddress {
125
+ city: string | null;
126
+ country: string | null;
127
+ countryCode: string | null;
128
+ geocodeAccuracy: string | null;
129
+ latitude: number | null;
130
+ longitude: number | null;
131
+ postalCode: string | null;
132
+ state: string | null;
133
+ stateCode: string | null;
134
+ street: string | null;
135
+ }
136
+ /** A Salesforce compound geolocation (`location`) field value. */
137
+ interface SalesforceGeolocation {
138
+ latitude: number | null;
139
+ longitude: number | null;
140
+ }
141
+ //#endregion
142
+ //#region src/types/describe.d.ts
143
+ /** Every field `type` a describe call can report. */
144
+ type FieldType = "id" | "boolean" | "string" | "textarea" | "picklist" | "multipicklist" | "combobox" | "reference" | "currency" | "double" | "percent" | "int" | "long" | "date" | "datetime" | "time" | "url" | "email" | "phone" | "encryptedstring" | "base64" | "address" | "location" | "anyType" | "complexvalue" | "datacategorygroupreference";
145
+ interface PicklistEntry {
146
+ active: boolean;
147
+ defaultValue: boolean;
148
+ label: string | null;
149
+ validFor: string | null;
150
+ value: string;
151
+ }
152
+ interface FieldDescribe {
153
+ name: string;
154
+ label: string;
155
+ /** Usually a {@link FieldType}; typed as `string` because Salesforce adds types over time. */
156
+ type: FieldType | (string & {});
157
+ soapType: string;
158
+ length: number;
159
+ byteLength: number;
160
+ precision: number;
161
+ scale: number;
162
+ digits: number;
163
+ nillable: boolean;
164
+ createable: boolean;
165
+ updateable: boolean;
166
+ defaultedOnCreate: boolean;
167
+ defaultValue: unknown;
168
+ defaultValueFormula: string | null;
169
+ calculated: boolean;
170
+ calculatedFormula: string | null;
171
+ autoNumber: boolean;
172
+ unique: boolean;
173
+ externalId: boolean;
174
+ idLookup: boolean;
175
+ nameField: boolean;
176
+ caseSensitive: boolean;
177
+ filterable: boolean;
178
+ sortable: boolean;
179
+ groupable: boolean;
180
+ aggregatable: boolean;
181
+ custom: boolean;
182
+ deprecatedAndHidden: boolean;
183
+ encrypted: boolean;
184
+ htmlFormatted: boolean;
185
+ inlineHelpText: string | null;
186
+ picklistValues: PicklistEntry[];
187
+ restrictedPicklist: boolean;
188
+ dependentPicklist: boolean;
189
+ controllerName: string | null;
190
+ /** Non-empty only for lookup and master-detail fields. More than one entry means a polymorphic lookup. */
191
+ referenceTo: string[];
192
+ /** The relationship name used for SOQL traversal, e.g. `"Account"` for `AccountId`. */
193
+ relationshipName: string | null;
194
+ relationshipOrder: number | null;
195
+ polymorphicForeignKey: boolean;
196
+ cascadeDelete: boolean;
197
+ restrictedDelete: boolean;
198
+ writeRequiresMasterRead: boolean;
199
+ compoundFieldName: string | null;
200
+ extraTypeInfo: string | null;
201
+ [key: string]: unknown;
202
+ }
203
+ interface ChildRelationship {
204
+ cascadeDelete: boolean;
205
+ /** API name of the child sObject, e.g. `"Case"` for Account's `Cases` relationship. */
206
+ childSObject: string;
207
+ deprecatedAndHidden: boolean;
208
+ /** The field on the child that points to this sObject. */
209
+ field: string;
210
+ junctionIdListNames: string[];
211
+ junctionReferenceTo: string[];
212
+ /** The name used in a nested SOQL subquery, e.g. `"Cases"`; `null` when not queryable. */
213
+ relationshipName: string | null;
214
+ restrictedDelete: boolean;
215
+ }
216
+ interface RecordTypeInfo {
217
+ active: boolean;
218
+ available: boolean;
219
+ defaultRecordTypeMapping: boolean;
220
+ developerName: string;
221
+ master: boolean;
222
+ name: string;
223
+ recordTypeId: string;
224
+ urls: Record<string, string>;
225
+ }
226
+ /** An entry of the `/sobjects` (describe global) response. */
227
+ interface DescribeGlobalSObject {
228
+ activateable: boolean;
229
+ createable: boolean;
230
+ custom: boolean;
231
+ customSetting: boolean;
232
+ deletable: boolean;
233
+ deprecatedAndHidden: boolean;
234
+ feedEnabled: boolean;
235
+ hasSubtypes: boolean;
236
+ isInterface: boolean;
237
+ isSubtype: boolean;
238
+ keyPrefix: string | null;
239
+ label: string;
240
+ labelPlural: string;
241
+ layoutable: boolean;
242
+ mergeable: boolean;
243
+ mruEnabled: boolean;
244
+ name: string;
245
+ queryable: boolean;
246
+ replicateable: boolean;
247
+ retrieveable: boolean;
248
+ searchable: boolean;
249
+ triggerable: boolean;
250
+ undeletable: boolean;
251
+ updateable: boolean;
252
+ urls: Record<string, string>;
253
+ [key: string]: unknown;
254
+ }
255
+ interface DescribeGlobalResult {
256
+ encoding: string;
257
+ maxBatchSize: number;
258
+ sobjects: DescribeGlobalSObject[];
259
+ }
260
+ /** The `/sobjects/{name}/describe` response. */
261
+ interface DescribeSObjectResult extends DescribeGlobalSObject {
262
+ childRelationships: ChildRelationship[];
263
+ fields: FieldDescribe[];
264
+ recordTypeInfos: RecordTypeInfo[];
265
+ compactLayoutable: boolean;
266
+ listviewable: boolean | null;
267
+ lookupLayoutable: boolean | null;
268
+ searchLayoutable: boolean;
269
+ networkScopeFieldName: string | null;
270
+ supportedScopes: {
271
+ label: string;
272
+ name: string;
273
+ }[];
274
+ actionOverrides: unknown[];
275
+ namedLayoutInfos: unknown[];
276
+ }
277
+ /** The `/sobjects/{name}` (basic information) response. */
278
+ interface SObjectBasicInfo {
279
+ objectDescribe: DescribeGlobalSObject;
280
+ recentItems: Record<string, unknown>[];
281
+ }
282
+ //#endregion
283
+ export { TransportRequest as A, SalesforceErrorCode as C, HttpMethod as D, AuthProvider as E, HttpTransport as O, KnownSalesforceErrorCode as S, AuthContext as T, SalesforceGeolocation as _, FieldDescribe as a, UpsertResult as b, RecordTypeInfo as c, DeleteResult as d, GenericRecord as f, SalesforceAddress as g, RestError as h, DescribeSObjectResult as i, TransportResponse as j, StreamingTransportResponse as k, SObjectBasicInfo as l, RecordAttributes as m, DescribeGlobalResult as n, FieldType as o, QueryResponse as p, DescribeGlobalSObject as r, PicklistEntry as s, ChildRelationship as t, ApiVersion as u, SaveError as v, AccessToken as w, WithAttributes as x, SaveResult as y };
284
+ //# sourceMappingURL=describe-Dj3J8o-x.d.cts.map