@stackone/core 1.52.4 → 1.52.6

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.
Files changed (42) hide show
  1. package/dist/index.d.mts +410 -0
  2. package/dist/index.d.ts +410 -0
  3. package/dist/index.js +4298 -1
  4. package/dist/index.mjs +4260 -0
  5. package/package.json +24 -6
  6. package/dist/index.es.mjs +0 -1
  7. package/dist/types/accounts/types.d.ts +0 -10
  8. package/dist/types/blocks/types.d.ts +0 -70
  9. package/dist/types/categories/index.d.ts +0 -3
  10. package/dist/types/categories/types.d.ts +0 -6
  11. package/dist/types/compositeIds/constants.d.ts +0 -8
  12. package/dist/types/compositeIds/errors.d.ts +0 -18
  13. package/dist/types/compositeIds/index.d.ts +0 -4
  14. package/dist/types/compositeIds/typeguards.d.ts +0 -3
  15. package/dist/types/compositeIds/types.d.ts +0 -28
  16. package/dist/types/connector/types.d.ts +0 -113
  17. package/dist/types/cursor/index.d.ts +0 -15
  18. package/dist/types/cursor/schemas.d.ts +0 -67
  19. package/dist/types/cursor/types.d.ts +0 -21
  20. package/dist/types/errors/coreError.d.ts +0 -14
  21. package/dist/types/errors/typeguards.d.ts +0 -2
  22. package/dist/types/index.d.ts +0 -18
  23. package/dist/types/schema/types.d.ts +0 -17
  24. package/dist/types/stepFunctions/factory.d.ts +0 -10
  25. package/dist/types/stepFunctions/groupData/groupDataStepFunction.d.ts +0 -2
  26. package/dist/types/stepFunctions/groupData/schemas.d.ts +0 -18
  27. package/dist/types/stepFunctions/mapFields/getEnumMatcher.d.ts +0 -1
  28. package/dist/types/stepFunctions/mapFields/mapFieldsStepFunction.d.ts +0 -2
  29. package/dist/types/stepFunctions/mapFields/mapFieldsStepFunction.v2.d.ts +0 -2
  30. package/dist/types/stepFunctions/mapFields/schemas.d.ts +0 -99
  31. package/dist/types/stepFunctions/paginatedRequest/paginatedRequestStepFunction.d.ts +0 -2
  32. package/dist/types/stepFunctions/paginatedRequest/schemas.d.ts +0 -176
  33. package/dist/types/stepFunctions/request/requestStepFunction.d.ts +0 -2
  34. package/dist/types/stepFunctions/request/schemas.d.ts +0 -134
  35. package/dist/types/stepFunctions/stepFunctionsList.d.ts +0 -460
  36. package/dist/types/stepFunctions/typecast/schemas.d.ts +0 -48
  37. package/dist/types/stepFunctions/typecast/typecast.d.ts +0 -6
  38. package/dist/types/stepFunctions/typecast/typecastStepFunction.d.ts +0 -2
  39. package/dist/types/stepFunctions/typecast/typecastStepFunction.v2.d.ts +0 -2
  40. package/dist/types/stepFunctions/typecast/types.d.ts +0 -6
  41. package/dist/types/stepFunctions/types.d.ts +0 -29
  42. package/dist/types/steps/types.d.ts +0 -29
@@ -0,0 +1,410 @@
1
+ import { HttpMethod, IHttpClient } from "@stackone/transport";
2
+ import { ILogger } from "@stackone/logger";
3
+ import { ZodType, z } from "zod/v4";
4
+
5
+ //#region src/categories/types.d.ts
6
+ type Category = 'hris' | 'crm' | 'ats' | 'lms' | 'marketing' | 'filestorage';
7
+ type CategoryDetails = {
8
+ title: string;
9
+ key: Category;
10
+ description: string;
11
+ };
12
+ //#endregion
13
+ //#region src/categories/index.d.ts
14
+ declare const getCategoryDetails: (category: string) => CategoryDetails | null;
15
+ declare const isValidCategory: (category: string) => boolean;
16
+ //#endregion
17
+ //#region src/compositeIds/types.d.ts
18
+ type SingleIdentifier = {
19
+ value: string;
20
+ key: string;
21
+ };
22
+ type MultipleIdentifier = {
23
+ identifiers: Array<SingleIdentifier>;
24
+ };
25
+ type CompositeIdentifier = MultipleIdentifier | SingleIdentifier;
26
+ type CompositeIdentifierConfig = {
27
+ version: number;
28
+ aliases?: Record<string, string>;
29
+ };
30
+ type ComponentConfig = {
31
+ name: string;
32
+ alias?: string;
33
+ };
34
+ type ComponentFieldConfig = {
35
+ targetFieldKey: string;
36
+ remote?: string;
37
+ components: ComponentConfig[];
38
+ };
39
+ type CompositeIdentifierConnectorConfig = {
40
+ enabled: boolean;
41
+ version?: number;
42
+ fields?: ComponentFieldConfig[];
43
+ };
44
+ //#endregion
45
+ //#region src/compositeIds/index.d.ts
46
+ declare const encodeCompositeId: (identifier: CompositeIdentifier, compositeIdConfig?: CompositeIdentifierConfig) => string;
47
+ declare const decodeCompositeId: (compositeId: string, compositeIdConfig?: CompositeIdentifierConfig) => Record<string, string>;
48
+ declare const isCompositeId: (value?: string | null) => boolean;
49
+ //#endregion
50
+ //#region src/compositeIds/constants.d.ts
51
+ declare const COMPOSITE_ID_LATEST_VERSION = 1;
52
+ //#endregion
53
+ //#region src/cursor/types.d.ts
54
+ type Position = {
55
+ pageNumber?: number | null;
56
+ providerPageCursor?: string | null;
57
+ position?: number | null;
58
+ };
59
+ type Cursor = {
60
+ remote: Record<number, Position>;
61
+ version: number;
62
+ timestamp: number;
63
+ };
64
+ //#endregion
65
+ //#region src/cursor/index.d.ts
66
+ declare const minifyCursor: (cursor: Cursor) => string;
67
+ declare const expandCursor: (minifiedCursor: unknown) => Cursor | null;
68
+ declare const areCursorsEqual: (first: string | Cursor, second: string | Cursor) => boolean;
69
+ declare const isCursorEmpty: ({
70
+ cursor,
71
+ ignoreStepIndex
72
+ }: {
73
+ cursor?: Cursor | null;
74
+ ignoreStepIndex?: number;
75
+ }) => boolean;
76
+ declare const updateCursor: ({
77
+ cursor,
78
+ stepIndex,
79
+ pageNumber,
80
+ providerPageCursor,
81
+ position
82
+ }: {
83
+ cursor?: Cursor | null;
84
+ stepIndex: number;
85
+ pageNumber?: number | null;
86
+ providerPageCursor?: string | null;
87
+ position?: number | null;
88
+ }) => Cursor;
89
+ //#endregion
90
+ //#region src/schema/types.d.ts
91
+ type Schema = {
92
+ name: string;
93
+ key: string;
94
+ version: string;
95
+ description?: string;
96
+ category: Category;
97
+ fields: {
98
+ [name: string]: SchemaField;
99
+ };
100
+ };
101
+ type SchemaField = {
102
+ name: string;
103
+ type: string;
104
+ required: boolean;
105
+ description?: string;
106
+ };
107
+ //#endregion
108
+ //#region src/stepFunctions/stepFunctionsList.d.ts
109
+ declare enum StepFunctionName {
110
+ TYPECAST = "typecast",
111
+ MAP_FIELDS = "map_fields",
112
+ GROUP_DATA = "group_data",
113
+ REQUEST = "request",
114
+ PAGINATED_REQUEST = "paginated_request",
115
+ }
116
+ //#endregion
117
+ //#region src/stepFunctions/types.d.ts
118
+ type StepFunction = ({
119
+ block,
120
+ params
121
+ }: {
122
+ block: Readonly<Block>;
123
+ params?: StepFunctionParams;
124
+ }) => Promise<StepFunctionOutput>;
125
+ type StepFunctionParams = {
126
+ [key: string]: unknown;
127
+ };
128
+ type StepFunctionMeta = {
129
+ functionName: StepFunctionName;
130
+ params?: StepFunctionParams;
131
+ version?: string;
132
+ };
133
+ type StepFunctionInstance = {
134
+ fn: StepFunction;
135
+ inputSchema?: ZodType;
136
+ outputSchema?: ZodType;
137
+ };
138
+ type StepFunctionOutput = {
139
+ block: Block;
140
+ successful: boolean;
141
+ errors?: StepError[];
142
+ output?: {
143
+ [name: string]: unknown;
144
+ };
145
+ };
146
+ //#endregion
147
+ //#region src/steps/types.d.ts
148
+ type StepSnapshot = {
149
+ output?: {
150
+ [name: string]: unknown;
151
+ };
152
+ successful: boolean;
153
+ skipped?: boolean;
154
+ message?: string;
155
+ errors?: StepError[];
156
+ };
157
+ type StepsSnapshots = {
158
+ [stepId: string]: StepSnapshot;
159
+ };
160
+ type StepError = {
161
+ [key: string]: unknown;
162
+ };
163
+ type Step = {
164
+ id: string;
165
+ description: string;
166
+ stepFunction: StepFunctionMeta;
167
+ ignoreError?: boolean;
168
+ async?: boolean;
169
+ successCriteria?: string;
170
+ condition?: string;
171
+ };
172
+ //#endregion
173
+ //#region src/connector/types.d.ts
174
+ type Connector = {
175
+ title: string;
176
+ version: string;
177
+ key: string;
178
+ description?: string;
179
+ categories?: Category[];
180
+ authentication?: Authentication;
181
+ operations?: {
182
+ [entrypointUrl: string]: Operation;
183
+ };
184
+ };
185
+ type OperationType = 'list' | 'get' | 'create' | 'update' | 'delete' | 'custom' | 'unknown';
186
+ type InputLocation = 'body' | 'query' | 'path' | 'headers';
187
+ type Input = {
188
+ name: string;
189
+ type: string;
190
+ required: boolean;
191
+ description: string;
192
+ in: InputLocation;
193
+ };
194
+ type Operation = {
195
+ id: string;
196
+ categories: Category[];
197
+ description: string;
198
+ schema?: Schema;
199
+ operationType: OperationType;
200
+ entrypointUrl: string;
201
+ entrypointHttpMethod: HttpMethod;
202
+ inputs?: Input[];
203
+ steps: {
204
+ [stepId: string]: Step;
205
+ };
206
+ result?: string | Record<string, unknown>;
207
+ responses: {
208
+ success: OperationResponse;
209
+ errors: Record<number, OperationResponse>;
210
+ };
211
+ cursor: {
212
+ enabled: boolean;
213
+ pageSize: number;
214
+ };
215
+ compositeIdentifiers: CompositeIdentifierConnectorConfig;
216
+ scheduledJobs?: ScheduledJobConfig[];
217
+ };
218
+ type ScheduledJobConfig = {
219
+ enabled: boolean;
220
+ type: ScheduledJobType;
221
+ schedule: string;
222
+ description: string;
223
+ requestParams?: ScheduledJobRequestParams;
224
+ syncFilter?: SyncFilterConfig;
225
+ };
226
+ type ScheduledJobRequestParams = {
227
+ fields?: string[];
228
+ expand?: string[];
229
+ filter?: Record<string, string>;
230
+ };
231
+ type ScheduledJobType = 'data_sync';
232
+ type SyncFilterName = 'updated_after' | 'created_after';
233
+ type SyncFilterConfig = {
234
+ name: SyncFilterName;
235
+ initialLoopbackPeriod: string;
236
+ incrementalLoopbackPeriod: string;
237
+ };
238
+ type OperationResponse = {
239
+ statusCode: number;
240
+ description?: string;
241
+ };
242
+ type AuthenticationField = {
243
+ key: string;
244
+ label: string;
245
+ type: 'text' | 'password' | 'select';
246
+ options?: {
247
+ value: string;
248
+ label: string;
249
+ }[];
250
+ required: boolean;
251
+ secret: boolean;
252
+ readOnly: boolean;
253
+ placeholder?: string;
254
+ description?: string;
255
+ tooltip?: string;
256
+ };
257
+ type SupportConfig = {
258
+ link: string;
259
+ description?: string;
260
+ };
261
+ type AuthenticationConfig = {
262
+ envKey: string;
263
+ envName: string;
264
+ type: 'custom' | 'oauth2' | 'oidc';
265
+ label: string;
266
+ authorization: {
267
+ type: 'basic' | 'bearer';
268
+ [authParam: string]: unknown;
269
+ };
270
+ support?: SupportConfig;
271
+ configFields?: AuthenticationField[];
272
+ setupFields?: AuthenticationField[];
273
+ testOperationsIds?: string[];
274
+ };
275
+ type Authentication = {
276
+ [authType: string]: {
277
+ production: AuthenticationConfig;
278
+ [envKey: string]: AuthenticationConfig;
279
+ };
280
+ };
281
+ //#endregion
282
+ //#region src/blocks/types.d.ts
283
+ type Block = {
284
+ inputs?: {
285
+ [key: string]: unknown;
286
+ };
287
+ connector?: Connector;
288
+ context: BlockContext;
289
+ debug?: DebugParams;
290
+ steps?: StepsSnapshots;
291
+ httpClient?: IHttpClient;
292
+ logger?: ILogger;
293
+ operation?: Operation;
294
+ credentials?: Credentials;
295
+ outputs?: unknown;
296
+ nextCursor?: Cursor | null;
297
+ response?: {
298
+ statusCode: number;
299
+ successful: boolean;
300
+ message?: string;
301
+ };
302
+ fieldConfigs?: FieldConfig[];
303
+ result?: BlockIndexedRecord[] | BlockIndexedRecord;
304
+ };
305
+ type BlockContext = {
306
+ projectSecureId: string;
307
+ accountSecureId: string;
308
+ connectorKey: string;
309
+ connectorVersion: string;
310
+ category: Category;
311
+ schema?: string;
312
+ operationType: OperationType;
313
+ authenticationType: string;
314
+ environment: string;
315
+ service: string;
316
+ resource: string;
317
+ subResource?: string;
318
+ childResource?: string;
319
+ };
320
+ type BlockIndexedRecord = {
321
+ id: string;
322
+ remote_id?: string;
323
+ [key: string]: unknown;
324
+ unified_custom_fields?: {
325
+ [key: string]: unknown;
326
+ };
327
+ };
328
+ type EnumMatcherExpression = {
329
+ matchExpression: string;
330
+ value: string;
331
+ };
332
+ type FieldConfig = {
333
+ expression?: string;
334
+ targetFieldKey: string;
335
+ alias?: string;
336
+ type: string;
337
+ custom: boolean;
338
+ hidden: boolean;
339
+ enumMapper?: {
340
+ matcher: string | EnumMatcherExpression[];
341
+ };
342
+ };
343
+ type DebugParams = {
344
+ custom_mappings?: 'disabled' | 'enabled';
345
+ };
346
+ type Credentials = Record<string, unknown>;
347
+ //#endregion
348
+ //#region src/errors/coreError.d.ts
349
+ declare class CoreError extends Error {
350
+ readonly type: string;
351
+ readonly category: string;
352
+ readonly context?: BlockContext;
353
+ constructor({
354
+ category,
355
+ name,
356
+ type,
357
+ context,
358
+ message
359
+ }: {
360
+ category: string;
361
+ name: string;
362
+ type: string;
363
+ context?: BlockContext;
364
+ message?: string;
365
+ });
366
+ toString(): string;
367
+ }
368
+ //#endregion
369
+ //#region src/errors/typeguards.d.ts
370
+ declare const isCoreError: (error: unknown) => error is CoreError;
371
+ //#endregion
372
+ //#region src/stepFunctions/factory.d.ts
373
+ declare const StepFunctionsFactory: {
374
+ build({
375
+ functionName,
376
+ version,
377
+ validateSchemas,
378
+ stepFunctionsList
379
+ }: {
380
+ functionName: StepFunctionName;
381
+ version?: string;
382
+ validateSchemas?: boolean;
383
+ stepFunctionsList?: Record<string, Record<string, StepFunctionInstance>>;
384
+ }): StepFunctionInstance;
385
+ };
386
+ //#endregion
387
+ //#region src/stepFunctions/request/schemas.d.ts
388
+ declare const AUTHENTICATION_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject<{
389
+ type: z.ZodLiteral<"basic">;
390
+ username: z.ZodOptional<z.ZodString>;
391
+ password: z.ZodOptional<z.ZodString>;
392
+ encoding: z.ZodOptional<z.ZodString>;
393
+ }, z.core.$strip>, z.ZodObject<{
394
+ type: z.ZodLiteral<"bearer">;
395
+ token: z.ZodString;
396
+ }, z.core.$strip>]>;
397
+ //#endregion
398
+ //#region src/accounts/types.d.ts
399
+ type Account = {
400
+ providerKey: string;
401
+ providerVersion: string;
402
+ authConfigKey: string;
403
+ environment: string;
404
+ organizationId: number;
405
+ secureId: string;
406
+ credentials?: Record<string, unknown>;
407
+ projectSecureId: string;
408
+ };
409
+ //#endregion
410
+ export { AUTHENTICATION_SCHEMA, Account, Authentication, AuthenticationConfig, AuthenticationField, Block, BlockContext, BlockIndexedRecord, COMPOSITE_ID_LATEST_VERSION, Category, CompositeIdentifier, CompositeIdentifierConfig, CompositeIdentifierConnectorConfig, Connector, CoreError, Cursor, FieldConfig, Input, InputLocation, Operation, OperationResponse, OperationType, Schema, SchemaField, Step, StepFunction, StepFunctionName, StepFunctionOutput, StepFunctionParams, StepFunctionsFactory, StepsSnapshots, SupportConfig, areCursorsEqual, decodeCompositeId, encodeCompositeId, expandCursor, getCategoryDetails, isCompositeId, isCoreError, isCursorEmpty, isValidCategory, minifyCursor, updateCursor };