@cerios/salesforce-sobjectly 0.0.0-stage → 1.1.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,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.mts.map
package/dist/index.cjs ADDED
@@ -0,0 +1,65 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_sf_cli = require("./sf-cli-R6LHwqoo.cjs");
3
+ exports.ActionsApi = require_sf_cli.ActionsApi;
4
+ exports.ApexExecutionError = require_sf_cli.ApexExecutionError;
5
+ exports.ApprovalsApi = require_sf_cli.ApprovalsApi;
6
+ exports.BulkApi = require_sf_cli.BulkApi;
7
+ exports.BulkIngestJob = require_sf_cli.BulkIngestJob;
8
+ exports.BulkQueryJob = require_sf_cli.BulkQueryJob;
9
+ exports.CollectionsApi = require_sf_cli.CollectionsApi;
10
+ exports.CompositeApi = require_sf_cli.CompositeApi;
11
+ exports.CompositeRequestBuilder = require_sf_cli.CompositeRequestBuilder;
12
+ exports.CompositeResponse = require_sf_cli.CompositeResponse;
13
+ exports.CsvRowParser = require_sf_cli.CsvRowParser;
14
+ exports.DEBUG_LEVEL_NAME = require_sf_cli.DEBUG_LEVEL_NAME;
15
+ exports.DEFAULT_DEBUG_LEVELS = require_sf_cli.DEFAULT_DEBUG_LEVELS;
16
+ exports.DebugLogCaptureError = require_sf_cli.DebugLogCaptureError;
17
+ exports.DebugLogsApi = require_sf_cli.DebugLogsApi;
18
+ exports.EventsApi = require_sf_cli.EventsApi;
19
+ exports.FilesApi = require_sf_cli.FilesApi;
20
+ exports.MAX_JSON_UPLOAD_BYTES = require_sf_cli.MAX_JSON_UPLOAD_BYTES;
21
+ exports.MAX_UPLOAD_BYTES = require_sf_cli.MAX_UPLOAD_BYTES;
22
+ exports.MetadataCache = require_sf_cli.MetadataCache;
23
+ exports.QueryApi = require_sf_cli.QueryApi;
24
+ exports.QuickActionsApi = require_sf_cli.QuickActionsApi;
25
+ exports.ReportsApi = require_sf_cli.ReportsApi;
26
+ exports.SObjectResource = require_sf_cli.SObjectResource;
27
+ exports.SalesforceAuthError = require_sf_cli.SalesforceAuthError;
28
+ exports.SalesforceBulkJobError = require_sf_cli.SalesforceBulkJobError;
29
+ exports.SalesforceClient = require_sf_cli.SalesforceClient;
30
+ exports.SalesforceConnection = require_sf_cli.SalesforceConnection;
31
+ exports.SalesforceError = require_sf_cli.SalesforceError;
32
+ exports.SalesforcePartialFailureError = require_sf_cli.SalesforcePartialFailureError;
33
+ exports.SalesforceSaveError = require_sf_cli.SalesforceSaveError;
34
+ exports.SearchApi = require_sf_cli.SearchApi;
35
+ exports.SoqlQueryBuilder = require_sf_cli.SoqlQueryBuilder;
36
+ exports.ToolingApi = require_sf_cli.ToolingApi;
37
+ exports.TypeOfBuilder = require_sf_cli.TypeOfBuilder;
38
+ exports.UiApi = require_sf_cli.UiApi;
39
+ exports.accessToken = require_sf_cli.accessToken;
40
+ exports.buildMultipart = require_sf_cli.buildMultipart;
41
+ exports.clientCredentials = require_sf_cli.clientCredentials;
42
+ exports.createJwtAssertion = require_sf_cli.createJwtAssertion;
43
+ exports.fetchTransport = require_sf_cli.fetchTransport;
44
+ exports.hasErrorCode = require_sf_cli.hasErrorCode;
45
+ exports.isApiVersion = require_sf_cli.isApiVersion;
46
+ exports.isSObjectType = require_sf_cli.isSObjectType;
47
+ exports.isSalesforceError = require_sf_cli.isSalesforceError;
48
+ exports.jwtBearer = require_sf_cli.jwtBearer;
49
+ exports.normalizeApiVersion = require_sf_cli.normalizeApiVersion;
50
+ exports.parseCsv = require_sf_cli.parseCsv;
51
+ exports.parseCsvRows = require_sf_cli.parseCsvRows;
52
+ exports.parseCsvStream = require_sf_cli.parseCsvStream;
53
+ exports.refreshToken = require_sf_cli.refreshToken;
54
+ exports.reportRows = require_sf_cli.reportRows;
55
+ exports.sfCli = require_sf_cli.sfCli;
56
+ exports.soqlDate = require_sf_cli.soqlDate;
57
+ exports.soqlDateLiteral = require_sf_cli.soqlDateLiteral;
58
+ exports.soqlEscape = require_sf_cli.soqlEscape;
59
+ exports.soqlEscapeDateOnly = require_sf_cli.soqlEscapeDateOnly;
60
+ exports.soqlFor = require_sf_cli.soqlFor;
61
+ exports.soqlLiteral = require_sf_cli.soqlLiteral;
62
+ exports.soslEscape = require_sf_cli.soslEscape;
63
+ exports.toCsv = require_sf_cli.toCsv;
64
+ exports.toPublishResult = require_sf_cli.toPublishResult;
65
+ exports.tokenProvider = require_sf_cli.tokenProvider;