@skedulo/pulse-solution-services 0.0.7 → 0.0.9
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/CHANGELOG.md +12 -0
- package/README.md +139 -23
- package/dist/clients/artifact-client.js +1 -1
- package/dist/clients/base-client.js +1 -1
- package/dist/clients/config-var-client.js +1 -1
- package/dist/clients/graphql-client.js +1 -1
- package/dist/constants/graphql-constants.js +1 -0
- package/dist/constants/index.js +1 -1
- package/dist/core/execution-context.js +1 -1
- package/dist/core/execution-options.js +1 -0
- package/dist/core/index.js +1 -1
- package/dist/core/request-header-constants.js +1 -0
- package/dist/index.d.ts +327 -118
- package/dist/interfaces/api-client.js +1 -0
- package/dist/interfaces/index.js +1 -1
- package/dist/interfaces/lock-service-interfaces.js +1 -0
- package/dist/interfaces/locking-service-interfaces.js +1 -0
- package/dist/services/batch-processor/fetching-strategies/cursor-based-fetching-strategy.js +1 -1
- package/dist/services/batch-processor/fetching-strategies/date-based-fetching-strategy.js +1 -1
- package/dist/services/cache/cache-service.js +1 -1
- package/dist/services/graph-batch/configs/graph-batch-config.d.ts +33 -0
- package/dist/services/graph-batch/configs/graph-batch-config.js +1 -0
- package/dist/services/graph-batch/configs/unique-graph-batch-config.d.ts +39 -0
- package/dist/services/graph-batch/configs/unique-graph-batch-config.js +1 -0
- package/dist/services/graph-batch/graph-batch.d.ts +56 -0
- package/dist/services/graph-batch/graph-batch.js +1 -0
- package/dist/services/graph-batch/index.d.ts +5 -0
- package/dist/services/graph-batch/index.js +1 -0
- package/dist/services/graph-batch/pagination-strategy.d.ts +5 -0
- package/dist/services/graph-batch/pagination-strategy.js +1 -0
- package/dist/services/graph-batch/unique-graph-batch.d.ts +28 -0
- package/dist/services/graph-batch/unique-graph-batch.js +1 -0
- package/dist/services/graphql/graphql-query-builder.d.ts +6 -4
- package/dist/services/graphql/graphql-query-builder.js +1 -1
- package/dist/services/graphql/graphql-service.d.ts +20 -13
- package/dist/services/graphql/graphql-service.js +1 -1
- package/dist/services/graphql/queries.d.ts +5 -4
- package/dist/services/graphql/queries.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/lock-service.js +1 -0
- package/dist/services/locking-service.js +1 -0
- package/dist/services/resource-availability/builder/data-service.d.ts +2 -1
- package/dist/services/resource-availability/builder/data-service.js +1 -1
- package/dist/utils/datetime-utils.js +1 -1
- package/package.json +9 -5
- package/yarn.lock +402 -199
- package/dist/constants/tenant-objects.js +0 -1
- package/dist/services/data-service.js +0 -1
- package/dist/services/resource-availability/object-factory.d.ts +0 -13
- package/dist/services/resource-availability/object-factory.js +0 -1
- package/dist/services/resource-availability/resource-availability-service.d.ts +0 -7
- package/dist/services/resource-availability/resource-availability-service.js +0 -1
- package/dist/services/resource-availability/resource-builder.d.ts +0 -16
- package/dist/services/resource-availability/resource-builder.js +0 -1
- package/dist/services/resource-availability/resource-query-service.d.ts +0 -7
- package/dist/services/resource-availability/resource-query-service.js +0 -1
- package/dist/services/resource-availability/resource-validator.d.ts +0 -29
- package/dist/services/resource-availability/resource-validator.js +0 -1
- /package/dist/{interfaces/resource-availability.js → core/base-config.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Interface representing the structure of metadata for an object.
|
|
5
7
|
*/
|
|
@@ -50,40 +52,54 @@ export interface PicklistValue {
|
|
|
50
52
|
active: boolean;
|
|
51
53
|
defaultValue: boolean;
|
|
52
54
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Interface defining the base configuration for API clients.
|
|
55
|
-
*/
|
|
56
55
|
export interface BaseConfig {
|
|
57
56
|
apiServer: string;
|
|
58
57
|
apiToken: string;
|
|
59
58
|
internalApiToken?: string;
|
|
60
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents execution options for GraphQL requests.
|
|
62
|
+
* This class encapsulates metadata and execution settings
|
|
63
|
+
* that enhance observability, performance, and request tracking.
|
|
64
|
+
*/
|
|
65
|
+
export declare class ExecutionOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Identifies the origin of the request (e.g., the system, application, or project that initiated the call).
|
|
68
|
+
* Helps in tracking and debugging requests across different systems.
|
|
69
|
+
*/
|
|
70
|
+
requestSource?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Identifies the client service or Lambda function making the request.
|
|
73
|
+
* Useful for debugging and log filtering to trace which service handled the request.
|
|
74
|
+
*/
|
|
75
|
+
userAgent?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Creates an instance of ExecutionOptions.
|
|
78
|
+
* Allows initializing with partial values for flexibility.
|
|
79
|
+
*
|
|
80
|
+
* @param initialValues - Partial execution options for initialization.
|
|
81
|
+
*/
|
|
82
|
+
constructor(initialValues?: Partial<ExecutionOptions>);
|
|
83
|
+
}
|
|
84
|
+
export interface RequestParams {
|
|
85
|
+
method?: string;
|
|
86
|
+
endpoint: string;
|
|
87
|
+
body?: object;
|
|
88
|
+
headers?: Record<string, string>;
|
|
89
|
+
queryParams?: Record<string, string>;
|
|
90
|
+
}
|
|
61
91
|
/**
|
|
62
92
|
* Base client for making API requests with standardized error handling.
|
|
63
93
|
* Provides methods for setting up headers and performing API requests using fetch.
|
|
64
94
|
*/
|
|
65
95
|
export declare class BaseClient {
|
|
66
96
|
protected config: BaseConfig;
|
|
97
|
+
protected executionOptions: Partial<ExecutionOptions>;
|
|
67
98
|
/**
|
|
68
99
|
* Creates an instance of BaseClient.
|
|
69
100
|
* @param {BaseConfig} config - The configuration object containing API server and token.
|
|
70
101
|
*/
|
|
71
|
-
constructor(config: BaseConfig);
|
|
72
|
-
/**
|
|
73
|
-
* Constructs the headers for API requests.
|
|
74
|
-
* @returns {Record<string, string>} - The headers including authorization and content type.
|
|
75
|
-
*/
|
|
76
|
-
protected getHeaders(): {
|
|
77
|
-
Authorization: string;
|
|
78
|
-
"Content-Type": string;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Builds a URL with query parameters.
|
|
82
|
-
* @param {string} endpoint - The API endpoint.
|
|
83
|
-
* @param {Record<string, string>} [queryParams] - Optional query parameters.
|
|
84
|
-
* @returns {string} - The full URL with query parameters.
|
|
85
|
-
*/
|
|
86
|
-
private buildUrl;
|
|
102
|
+
constructor(config: BaseConfig, executionOptions?: Partial<ExecutionOptions>);
|
|
87
103
|
/**
|
|
88
104
|
* Performs an API request with standardized error handling using fetch.
|
|
89
105
|
* @template T
|
|
@@ -96,13 +112,19 @@ export declare class BaseClient {
|
|
|
96
112
|
* @returns {Promise<T>} - The parsed response data.
|
|
97
113
|
* @throws {Error} - If the request fails or the response is not OK.
|
|
98
114
|
*/
|
|
99
|
-
protected performRequest<T = any>({ method, endpoint, headers, body, queryParams
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
protected performRequest<T = any>({ method, endpoint, headers, body, queryParams }: RequestParams, executionOptions?: Partial<ExecutionOptions>): Promise<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Constructs the headers for API requests.
|
|
118
|
+
* @returns {Record<string, string>} - The headers including authorization and content type.
|
|
119
|
+
*/
|
|
120
|
+
protected getHeaders(executionOptions: Partial<ExecutionOptions>): Record<string, string>;
|
|
121
|
+
/**
|
|
122
|
+
* Builds a URL with query parameters.
|
|
123
|
+
* @param {string} endpoint - The API endpoint.
|
|
124
|
+
* @param {Record<string, string>} [queryParams] - Optional query parameters.
|
|
125
|
+
* @returns {string} - The full URL with query parameters.
|
|
126
|
+
*/
|
|
127
|
+
private buildUrl;
|
|
106
128
|
/**
|
|
107
129
|
* Handles exceptions encountered during API requests.
|
|
108
130
|
* @param {any} error - The error to handle.
|
|
@@ -202,6 +224,7 @@ export interface ConfigVar {
|
|
|
202
224
|
value: string;
|
|
203
225
|
description?: string;
|
|
204
226
|
status?: "active" | "inactive" | "expired";
|
|
227
|
+
expiryDate?: string;
|
|
205
228
|
updatedBy?: string;
|
|
206
229
|
createdBy?: string;
|
|
207
230
|
createdAt?: string;
|
|
@@ -214,96 +237,29 @@ export interface ConfigVar {
|
|
|
214
237
|
export declare class ConfigVarClient extends BaseClient {
|
|
215
238
|
/**
|
|
216
239
|
* Creates a new configuration variable.
|
|
217
|
-
* @param {ConfigVar} configVar - The configuration variable to create.
|
|
218
|
-
* @returns {Promise<ConfigVar>} - The created configuration variable.
|
|
219
240
|
*/
|
|
220
241
|
create(configVar: ConfigVar): Promise<ConfigVar>;
|
|
221
242
|
/**
|
|
222
243
|
* Retrieves a configuration variable by key.
|
|
223
|
-
* @param {string} key - The key of the configuration variable.
|
|
224
|
-
* @returns {Promise<ConfigVar>} - The retrieved configuration variable.
|
|
225
244
|
*/
|
|
226
245
|
get(key: string): Promise<ConfigVar>;
|
|
227
246
|
/**
|
|
228
247
|
* Updates an existing configuration variable.
|
|
229
|
-
* @param {ConfigVar} configVar - The configuration variable with updated values. Only the value and description can be updated.
|
|
230
|
-
* @returns {Promise<ConfigVar>} - A promise that resolves when the update is complete.
|
|
231
248
|
*/
|
|
232
249
|
update(configVar: ConfigVar): Promise<ConfigVar>;
|
|
250
|
+
/**
|
|
251
|
+
* Upsert a configuration variable. If the configuration variable does not exist, it will be created.
|
|
252
|
+
*/
|
|
253
|
+
upsert(configVar: ConfigVar): Promise<ConfigVar>;
|
|
233
254
|
/**
|
|
234
255
|
* Searches for configuration variables with pagination.
|
|
235
|
-
* @param {number} [pageSize] - The number of results per page (default max is 1000).
|
|
236
|
-
* @returns {Promise<ConfigVar[]>} - A list of configuration variables.
|
|
237
256
|
*/
|
|
238
257
|
search(pageSize?: number): Promise<ConfigVar[]>;
|
|
239
258
|
/**
|
|
240
259
|
* Deletes a configuration variable by key.
|
|
241
|
-
* @param {string} key - The key of the configuration variable to delete.
|
|
242
|
-
* @returns {Promise<string>} - A response indicating the result of the delete operation.
|
|
243
260
|
*/
|
|
244
261
|
delete(key: string): Promise<string>;
|
|
245
262
|
}
|
|
246
|
-
export interface HasId {
|
|
247
|
-
UID?: string;
|
|
248
|
-
[key: string]: any;
|
|
249
|
-
}
|
|
250
|
-
export interface GraphQlResponse<T = any> {
|
|
251
|
-
data: T;
|
|
252
|
-
errors?: object[];
|
|
253
|
-
}
|
|
254
|
-
export interface FetchRecordsQueryParams {
|
|
255
|
-
objectName: string;
|
|
256
|
-
first?: number;
|
|
257
|
-
offset?: number;
|
|
258
|
-
orderBy?: string;
|
|
259
|
-
filter?: string;
|
|
260
|
-
after?: string;
|
|
261
|
-
fields?: string;
|
|
262
|
-
}
|
|
263
|
-
export interface QueryResult {
|
|
264
|
-
records: HasId[];
|
|
265
|
-
totalCount: number;
|
|
266
|
-
pageInfo: any;
|
|
267
|
-
endCursor: string;
|
|
268
|
-
endOffset: number;
|
|
269
|
-
}
|
|
270
|
-
export interface MutationResult {
|
|
271
|
-
data: {
|
|
272
|
-
schema: {
|
|
273
|
-
[alias: string]: string;
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* A client for executing GraphQL queries and mutations.
|
|
279
|
-
* Extends the BaseClient to interact with the GraphQL API.
|
|
280
|
-
*/
|
|
281
|
-
export declare class GraphQLClient extends BaseClient {
|
|
282
|
-
/**
|
|
283
|
-
* Executes a GraphQL query or mutation.
|
|
284
|
-
* @param {string} graphqlQuery - The GraphQL query or mutation string.
|
|
285
|
-
* @returns {Promise<GraphQlResponse>} - The response from the GraphQL API.
|
|
286
|
-
* @throws {Error} - If the request fails or if there are errors in the response.
|
|
287
|
-
*/
|
|
288
|
-
execute(graphqlQuery: string): Promise<GraphQlResponse>;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* OrgPreferencesClient class to handle API requests related to organization preferences.
|
|
292
|
-
* Extends BaseClient to perform API operations.
|
|
293
|
-
*/
|
|
294
|
-
export declare class OrgPreferenceClient extends BaseClient {
|
|
295
|
-
/**
|
|
296
|
-
* Fetches the organization preferences configuration.
|
|
297
|
-
* @returns {Promise<Record<string, any>>} - A promise resolving to the sorted organization preferences.
|
|
298
|
-
*/
|
|
299
|
-
get(): Promise<Record<string, any>>;
|
|
300
|
-
/**
|
|
301
|
-
* Deploys the organization preferences configuration.
|
|
302
|
-
* @param {Record<string, any>} newConfig - The new configuration to be deployed.
|
|
303
|
-
* @returns {Promise<Record<string, any>>} - A promise resolving when the configuration is successfully deployed.
|
|
304
|
-
*/
|
|
305
|
-
deploy(newConfig: Record<string, any>): Promise<Record<string, any>>;
|
|
306
|
-
}
|
|
307
263
|
export declare enum ArtifactType {
|
|
308
264
|
CUSTOM_OBJECT = "custom-object",
|
|
309
265
|
CUSTOM_FIELD = "custom-field",
|
|
@@ -335,6 +291,12 @@ export declare enum ConfigVariableStatus {
|
|
|
335
291
|
INACTIVE = "inactive",
|
|
336
292
|
EXPIRED = "expired"
|
|
337
293
|
}
|
|
294
|
+
export declare enum GraphqlOperations {
|
|
295
|
+
INSERT = "insert",
|
|
296
|
+
UPDATE = "update",
|
|
297
|
+
DELETE = "delete",
|
|
298
|
+
UPSERT = "upsert"
|
|
299
|
+
}
|
|
338
300
|
export declare enum HttpMethod {
|
|
339
301
|
GET = "GET",
|
|
340
302
|
POST = "POST",
|
|
@@ -408,6 +370,77 @@ export declare const TENANT_ENDPOINTS: {
|
|
|
408
370
|
readonly SIMPLE: "availability/simple";
|
|
409
371
|
};
|
|
410
372
|
};
|
|
373
|
+
export interface HasId {
|
|
374
|
+
UID?: string;
|
|
375
|
+
[key: string]: any;
|
|
376
|
+
}
|
|
377
|
+
export interface GraphQlResponse<T = any> {
|
|
378
|
+
data: T;
|
|
379
|
+
errors?: object[];
|
|
380
|
+
}
|
|
381
|
+
export interface GraphqlParams {
|
|
382
|
+
objectName: string;
|
|
383
|
+
operationName: string;
|
|
384
|
+
}
|
|
385
|
+
export interface GraphqlMurationParams extends GraphqlParams {
|
|
386
|
+
records: HasId[];
|
|
387
|
+
operation: GraphqlOperations;
|
|
388
|
+
bulkOperation?: boolean;
|
|
389
|
+
}
|
|
390
|
+
export interface GraphqlQueryParams extends GraphqlParams {
|
|
391
|
+
first?: number;
|
|
392
|
+
offset?: number;
|
|
393
|
+
orderBy?: string;
|
|
394
|
+
filter?: string;
|
|
395
|
+
after?: string;
|
|
396
|
+
fields?: string;
|
|
397
|
+
readOnly?: boolean;
|
|
398
|
+
}
|
|
399
|
+
export interface QueryResult {
|
|
400
|
+
records: HasId[];
|
|
401
|
+
totalCount: number;
|
|
402
|
+
pageInfo: any;
|
|
403
|
+
endCursor: string;
|
|
404
|
+
endOffset: number;
|
|
405
|
+
}
|
|
406
|
+
export interface MutationResult {
|
|
407
|
+
data: {
|
|
408
|
+
schema: {
|
|
409
|
+
[alias: string]: string;
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* A client for executing GraphQL queries and mutations.
|
|
415
|
+
* Extends the BaseClient to interact with the GraphQL API.
|
|
416
|
+
*/
|
|
417
|
+
export declare class GraphQLClient extends BaseClient {
|
|
418
|
+
/**
|
|
419
|
+
* Executes a GraphQL query or mutation.
|
|
420
|
+
* @param {string} graphqlQuery - The GraphQL query or mutation string.
|
|
421
|
+
* @param {Record<string, string>} headers - Additional headers to include in the request.
|
|
422
|
+
* @returns {Promise<GraphQlResponse>} - The response from the GraphQL API.
|
|
423
|
+
* @throws {Error} - If the request fails or if there are errors in the response.
|
|
424
|
+
*/
|
|
425
|
+
execute(graphqlQuery: string, headers?: Record<string, string>): Promise<GraphQlResponse>;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* OrgPreferencesClient class to handle API requests related to organization preferences.
|
|
429
|
+
* Extends BaseClient to perform API operations.
|
|
430
|
+
*/
|
|
431
|
+
export declare class OrgPreferenceClient extends BaseClient {
|
|
432
|
+
/**
|
|
433
|
+
* Fetches the organization preferences configuration.
|
|
434
|
+
* @returns {Promise<Record<string, any>>} - A promise resolving to the sorted organization preferences.
|
|
435
|
+
*/
|
|
436
|
+
get(): Promise<Record<string, any>>;
|
|
437
|
+
/**
|
|
438
|
+
* Deploys the organization preferences configuration.
|
|
439
|
+
* @param {Record<string, any>} newConfig - The new configuration to be deployed.
|
|
440
|
+
* @returns {Promise<Record<string, any>>} - A promise resolving when the configuration is successfully deployed.
|
|
441
|
+
*/
|
|
442
|
+
deploy(newConfig: Record<string, any>): Promise<Record<string, any>>;
|
|
443
|
+
}
|
|
411
444
|
export interface LatLng {
|
|
412
445
|
lat: number;
|
|
413
446
|
lng: number;
|
|
@@ -589,7 +622,7 @@ export type ArtifactParams = {
|
|
|
589
622
|
declare class ArtifactClient extends BaseClient {
|
|
590
623
|
private artifactType;
|
|
591
624
|
private baseEndpoint;
|
|
592
|
-
constructor(config: any, artifactType: ArtifactType);
|
|
625
|
+
constructor(config: any, artifactType: ArtifactType, executionOptions?: Partial<ExecutionOptions>);
|
|
593
626
|
list<T>(): Promise<T[]>;
|
|
594
627
|
get<T>(params?: ArtifactParams): Promise<T>;
|
|
595
628
|
create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
|
|
@@ -823,6 +856,11 @@ declare class VocabularyClient extends BaseClient {
|
|
|
823
856
|
*/
|
|
824
857
|
updateVocabularyItem(schemaName: string, fieldName: string, value: string, item: VocabularyItem): Promise<VocabularyItem>;
|
|
825
858
|
}
|
|
859
|
+
export interface LockInfo {
|
|
860
|
+
name: string;
|
|
861
|
+
ttl: number;
|
|
862
|
+
description?: string;
|
|
863
|
+
}
|
|
826
864
|
declare const logger: import("winston").Logger;
|
|
827
865
|
export declare class CacheService<T> {
|
|
828
866
|
private storage;
|
|
@@ -943,43 +981,51 @@ export declare class GraphQLService {
|
|
|
943
981
|
constructor(client: GraphQLClient);
|
|
944
982
|
/**
|
|
945
983
|
* Executes a GraphQL query to fetch records.
|
|
946
|
-
* @param {
|
|
984
|
+
* @param {GraphqlQueryParams} params - The query parameters.
|
|
947
985
|
* @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
|
|
948
986
|
*/
|
|
949
|
-
query(params:
|
|
987
|
+
query(params: GraphqlQueryParams): Promise<QueryResult>;
|
|
950
988
|
/**
|
|
951
|
-
*
|
|
989
|
+
* Performs a mutation operation on the GraphQL API.
|
|
952
990
|
* @param {string} objectName - The name of the object.
|
|
953
991
|
* @param {HasId[]} records - The records to delete.
|
|
954
992
|
* @returns {Promise<any>} - The response from the delete operation.
|
|
955
993
|
*/
|
|
956
|
-
|
|
994
|
+
mutate(params: GraphqlMurationParams): Promise<any>;
|
|
995
|
+
/**
|
|
996
|
+
* Deletes records from the GraphQL API.
|
|
997
|
+
*/
|
|
998
|
+
delete(params: GraphqlMurationParams): Promise<any>;
|
|
957
999
|
/**
|
|
958
1000
|
* Updates records in the GraphQL API.
|
|
959
|
-
* @param {string} objectName - The name of the object.
|
|
960
|
-
* @param {HasId[]} records - The records to update.
|
|
961
|
-
* @returns {Promise<any>} - The response from the update operation.
|
|
962
1001
|
*/
|
|
963
|
-
update(
|
|
1002
|
+
update(params: GraphqlMurationParams): Promise<any>;
|
|
964
1003
|
/**
|
|
965
1004
|
* Inserts records into the GraphQL API.
|
|
966
|
-
* @param {string} objectName - The name of the object.
|
|
967
|
-
* @param {HasId[]} records - The records to insert.
|
|
968
|
-
* @returns {Promise<any>} - The response from the insert operation.
|
|
969
1005
|
*/
|
|
970
|
-
insert(
|
|
1006
|
+
insert(params: GraphqlMurationParams): Promise<any>;
|
|
971
1007
|
/**
|
|
972
1008
|
* Extracts job UIDs from a GraphQL mutation response.
|
|
973
1009
|
* @param {MutationResult} response - The response object.
|
|
974
1010
|
* @returns {string[]} - An array of job UIDs.
|
|
975
1011
|
*/
|
|
976
1012
|
extractJobUIDs(response: MutationResult): string[];
|
|
1013
|
+
/**
|
|
1014
|
+
* Formats the object name to follow GraphQL naming conventions.
|
|
1015
|
+
* @param {string} objectName - The object name to format.
|
|
1016
|
+
* @returns {string} - The formatted object name.
|
|
1017
|
+
*/
|
|
1018
|
+
private getQueryName;
|
|
1019
|
+
private getQueryHeaders;
|
|
1020
|
+
private getMutationHeaders;
|
|
1021
|
+
private getOperationHeader;
|
|
977
1022
|
}
|
|
978
1023
|
/**
|
|
979
1024
|
* A utility class for building GraphQL queries dynamically.
|
|
980
1025
|
*/
|
|
981
1026
|
export declare class GraphQLQueryBuilder {
|
|
982
1027
|
private objectName;
|
|
1028
|
+
operationName: string;
|
|
983
1029
|
private fields;
|
|
984
1030
|
private filters;
|
|
985
1031
|
private first?;
|
|
@@ -990,12 +1036,13 @@ export declare class GraphQLQueryBuilder {
|
|
|
990
1036
|
private childQueries;
|
|
991
1037
|
private isParent;
|
|
992
1038
|
private graphqlService;
|
|
1039
|
+
private queryParams;
|
|
993
1040
|
/**
|
|
994
1041
|
* Creates an instance of GraphQLQueryBuilder.
|
|
995
|
-
* @param {string}
|
|
1042
|
+
* @param {string} graphqlQueryParams - The necessary parameters for the query.
|
|
996
1043
|
* @param {boolean} [isParent=false] - Indicates if this query is a parent query.
|
|
997
1044
|
*/
|
|
998
|
-
constructor(
|
|
1045
|
+
constructor(queryParams: GraphqlQueryParams, isParent?: boolean);
|
|
999
1046
|
/**
|
|
1000
1047
|
* Sets the GraphQL service to use for executing the query.
|
|
1001
1048
|
*/
|
|
@@ -1039,7 +1086,7 @@ export declare class GraphQLQueryBuilder {
|
|
|
1039
1086
|
/**
|
|
1040
1087
|
* Builds the GraphQL query parameters in a more structured format.
|
|
1041
1088
|
*/
|
|
1042
|
-
build():
|
|
1089
|
+
build(): GraphqlQueryParams;
|
|
1043
1090
|
/**
|
|
1044
1091
|
* Executes the query using the GraphQL service, with improved error handling.
|
|
1045
1092
|
*/
|
|
@@ -1049,6 +1096,12 @@ export declare class GraphQLQueryBuilder {
|
|
|
1049
1096
|
*/
|
|
1050
1097
|
toString(): string;
|
|
1051
1098
|
}
|
|
1099
|
+
declare class LockService {
|
|
1100
|
+
private configVarClient;
|
|
1101
|
+
constructor(configVarClient: ConfigVarClient);
|
|
1102
|
+
acquireLock(lockInfo: LockInfo): Promise<boolean>;
|
|
1103
|
+
releaseLock(name: string): Promise<void>;
|
|
1104
|
+
}
|
|
1052
1105
|
export declare class ResourceQueryParam {
|
|
1053
1106
|
resourceIds?: Set<string>;
|
|
1054
1107
|
regionIds?: Set<string>;
|
|
@@ -1077,7 +1130,7 @@ declare class DataService {
|
|
|
1077
1130
|
constructor(graphqlService: GraphQLService);
|
|
1078
1131
|
getResources(param: ResourceQueryParam): Promise<Record<string, any>[]>;
|
|
1079
1132
|
getHolidays(regionIds: string[], startTime?: Date, endTime?: Date): Promise<Record<string, any>>;
|
|
1080
|
-
newQueryBuilder(
|
|
1133
|
+
newQueryBuilder(params: GraphqlQueryParams): GraphQLQueryBuilder;
|
|
1081
1134
|
}
|
|
1082
1135
|
export declare class ResourceAvailabilityService {
|
|
1083
1136
|
private availabilityAPIClient;
|
|
@@ -1154,14 +1207,18 @@ export declare class ExecutionContext {
|
|
|
1154
1207
|
private baseConfig;
|
|
1155
1208
|
logger: typeof logger;
|
|
1156
1209
|
private services;
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
static
|
|
1210
|
+
private _executionOptions;
|
|
1211
|
+
protected constructor(skedContext: any, executionOptions?: Partial<ExecutionOptions>);
|
|
1212
|
+
static fromContext(skedContext: any, executionOptions?: Partial<ExecutionOptions>): ExecutionContext;
|
|
1213
|
+
static fromCredentials(config: BaseConfig, executionOptions?: Partial<ExecutionOptions>): ExecutionContext;
|
|
1214
|
+
set executionOptions(executionOptions: Partial<ExecutionOptions>);
|
|
1215
|
+
get executionOptions(): Partial<ExecutionOptions>;
|
|
1160
1216
|
/**
|
|
1161
1217
|
* Generic method to retrieve or initialize a service.
|
|
1162
1218
|
*/
|
|
1163
1219
|
private getOrCreateService;
|
|
1164
1220
|
get configHelper(): ConfigHelper;
|
|
1221
|
+
get baseClient(): BaseClient;
|
|
1165
1222
|
get graphqlClient(): GraphQLClient;
|
|
1166
1223
|
get graphqlService(): GraphQLService;
|
|
1167
1224
|
get metadataClient(): MetadataClient;
|
|
@@ -1175,15 +1232,17 @@ export declare class ExecutionContext {
|
|
|
1175
1232
|
get geoAPIClient(): GeoAPIClient;
|
|
1176
1233
|
get availabilityAPIClient(): AvailabilityAPIClient;
|
|
1177
1234
|
get geoService(): GeoService;
|
|
1235
|
+
get lockService(): LockService;
|
|
1178
1236
|
get configVarCache(): CacheService<any>;
|
|
1179
1237
|
get inMemoryCache(): CacheService<any>;
|
|
1180
1238
|
get resourceAvailabilityService(): ResourceAvailabilityService;
|
|
1181
1239
|
get dataService(): DataService;
|
|
1182
1240
|
get resourceBuilder(): ResourceBuilder;
|
|
1183
|
-
newQueryBuilder(
|
|
1241
|
+
newQueryBuilder(params: GraphqlQueryParams): GraphQLQueryBuilder;
|
|
1184
1242
|
newArtifactClient(artifactType: ArtifactType): ArtifactClient;
|
|
1185
1243
|
dispose(): void;
|
|
1186
1244
|
}
|
|
1245
|
+
export declare const REQUEST_HEADERS: Record<string, string>;
|
|
1187
1246
|
export declare const TenantObjects: {
|
|
1188
1247
|
Accounts: {
|
|
1189
1248
|
Name: string;
|
|
@@ -1297,6 +1356,156 @@ export declare class BatchOrchestrator {
|
|
|
1297
1356
|
protected updateJobStatus(): Promise<void>;
|
|
1298
1357
|
private isCompleted;
|
|
1299
1358
|
}
|
|
1359
|
+
export declare enum PaginationStrategy {
|
|
1360
|
+
CURSOR = "cursor",
|
|
1361
|
+
OFFSET = "offset",
|
|
1362
|
+
NONE = "none"
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Default configuration values for `GraphBatchConfig`.
|
|
1366
|
+
*/
|
|
1367
|
+
export declare const DEFAULT_GRAPH_BATCH_CONFIG: GraphBatchConfig;
|
|
1368
|
+
/**
|
|
1369
|
+
* Schema validation using `zod`
|
|
1370
|
+
*/
|
|
1371
|
+
export declare const GraphBatchConfigSchema: z.ZodObject<{
|
|
1372
|
+
strategy: z.ZodNativeEnum<typeof PaginationStrategy>;
|
|
1373
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
1374
|
+
maxBatches: z.ZodDefault<z.ZodNumber>;
|
|
1375
|
+
delaySeconds: z.ZodDefault<z.ZodNumber>;
|
|
1376
|
+
}, "strip", z.ZodTypeAny, {
|
|
1377
|
+
strategy: PaginationStrategy;
|
|
1378
|
+
batchSize: number;
|
|
1379
|
+
maxBatches: number;
|
|
1380
|
+
delaySeconds: number;
|
|
1381
|
+
}, {
|
|
1382
|
+
strategy: PaginationStrategy;
|
|
1383
|
+
batchSize?: number | undefined;
|
|
1384
|
+
maxBatches?: number | undefined;
|
|
1385
|
+
delaySeconds?: number | undefined;
|
|
1386
|
+
}>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Configuration options for `GraphBatch`.
|
|
1389
|
+
*/
|
|
1390
|
+
export type GraphBatchConfig = z.infer<typeof GraphBatchConfigSchema>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Merges user-provided config with default values.
|
|
1393
|
+
*/
|
|
1394
|
+
export declare function initializeConfig(config: Partial<GraphBatchConfig> | undefined): GraphBatchConfig;
|
|
1395
|
+
/**
|
|
1396
|
+
* Default configuration values for `UniqueGraphBatchConfig`.
|
|
1397
|
+
*/
|
|
1398
|
+
export declare const DEFAULT_UNIQUE_GRAPH_BATCH_CONFIG: UniqueGraphBatchConfig;
|
|
1399
|
+
/**
|
|
1400
|
+
* Schema validation for `UniqueGraphBatchConfig`
|
|
1401
|
+
*/
|
|
1402
|
+
export declare const UniqueGraphBatchConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
1403
|
+
strategy: z.ZodNativeEnum<typeof PaginationStrategy>;
|
|
1404
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
1405
|
+
maxBatches: z.ZodDefault<z.ZodNumber>;
|
|
1406
|
+
delaySeconds: z.ZodDefault<z.ZodNumber>;
|
|
1407
|
+
}, {
|
|
1408
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1409
|
+
lockTtl: z.ZodOptional<z.ZodNumber>;
|
|
1410
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1411
|
+
strategy: PaginationStrategy;
|
|
1412
|
+
batchSize: number;
|
|
1413
|
+
maxBatches: number;
|
|
1414
|
+
delaySeconds: number;
|
|
1415
|
+
name?: string | undefined;
|
|
1416
|
+
lockTtl?: number | undefined;
|
|
1417
|
+
}, {
|
|
1418
|
+
strategy: PaginationStrategy;
|
|
1419
|
+
name?: string | undefined;
|
|
1420
|
+
batchSize?: number | undefined;
|
|
1421
|
+
maxBatches?: number | undefined;
|
|
1422
|
+
delaySeconds?: number | undefined;
|
|
1423
|
+
lockTtl?: number | undefined;
|
|
1424
|
+
}>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Configuration options for `UniqueGraphBatch`.
|
|
1427
|
+
*/
|
|
1428
|
+
export type UniqueGraphBatchConfig = z.infer<typeof UniqueGraphBatchConfigSchema>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Merges user-provided config with default values for `UniqueGraphBatch`.
|
|
1431
|
+
*/
|
|
1432
|
+
export declare function initializeUniqueConfig(config: Partial<UniqueGraphBatchConfig> | undefined): UniqueGraphBatchConfig;
|
|
1433
|
+
/**
|
|
1434
|
+
* Base class for batch processing with pagination support.
|
|
1435
|
+
*/
|
|
1436
|
+
export declare abstract class GraphBatch {
|
|
1437
|
+
protected context: ExecutionContext;
|
|
1438
|
+
protected config: GraphBatchConfig;
|
|
1439
|
+
protected queryBuilder?: GraphQLQueryBuilder;
|
|
1440
|
+
protected queryResult?: QueryResult;
|
|
1441
|
+
private startTime;
|
|
1442
|
+
constructor(context: ExecutionContext, config?: Partial<GraphBatchConfig>);
|
|
1443
|
+
/**
|
|
1444
|
+
* Runs the batch process, handling pagination, execution, and accumulation of results.
|
|
1445
|
+
*
|
|
1446
|
+
* @returns The accumulated result of the batch process.
|
|
1447
|
+
*/
|
|
1448
|
+
run(): Promise<void>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Initializes the query builder. This method must be overridden in subclasses.
|
|
1451
|
+
*
|
|
1452
|
+
* @returns A configured GraphQL query builder.
|
|
1453
|
+
*/
|
|
1454
|
+
protected abstract start(): Promise<GraphQLQueryBuilder>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Processes a batch of records and accumulates the result.
|
|
1457
|
+
*
|
|
1458
|
+
* @param records The batch of records retrieved from the query.
|
|
1459
|
+
*/
|
|
1460
|
+
protected abstract execute(records: any[]): Promise<void>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Final cleanup or logging after the batch process completes.
|
|
1463
|
+
*/
|
|
1464
|
+
protected finish(): Promise<void>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Fetches the next page of data based on the pagination strategy.
|
|
1467
|
+
*
|
|
1468
|
+
* @returns The result of the query execution.
|
|
1469
|
+
*/
|
|
1470
|
+
protected fetchNextPage(): Promise<QueryResult>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Checks if the maximum number of batches has been reached.
|
|
1473
|
+
*
|
|
1474
|
+
* @param currentBatchCount The number of batches processed so far.
|
|
1475
|
+
* @returns `true` if the maximum limit is reached, otherwise `false`.
|
|
1476
|
+
*/
|
|
1477
|
+
protected isMaxBatchesReached(currentBatchCount: number): boolean;
|
|
1478
|
+
/**
|
|
1479
|
+
* Delays execution for a specified time.
|
|
1480
|
+
*
|
|
1481
|
+
* @param ms The time in milliseconds to delay.
|
|
1482
|
+
*/
|
|
1483
|
+
protected delay(ms: number): Promise<void>;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* UniqueGraphBatch ensures that only one instance of a batch with the same name can run at a time.
|
|
1487
|
+
*/
|
|
1488
|
+
export declare class UniqueGraphBatch extends GraphBatch {
|
|
1489
|
+
private name;
|
|
1490
|
+
private lockTtl;
|
|
1491
|
+
constructor(context: ExecutionContext, config?: Partial<UniqueGraphBatchConfig>);
|
|
1492
|
+
/**
|
|
1493
|
+
* Runs the batch process with lock enforcement.
|
|
1494
|
+
*/
|
|
1495
|
+
run(): Promise<void>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Abstract method implementation - Initialize query builder.
|
|
1498
|
+
*/
|
|
1499
|
+
protected start(): Promise<GraphQLQueryBuilder>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Abstract method implementation - Process batch records.
|
|
1502
|
+
*/
|
|
1503
|
+
protected execute(records: any[]): Promise<void>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Overrides the finish method to ensure lock cleanup.
|
|
1506
|
+
*/
|
|
1507
|
+
protected finish(): Promise<void>;
|
|
1508
|
+
}
|
|
1300
1509
|
export interface ResourceValidationOption {
|
|
1301
1510
|
checkAvailability: boolean;
|
|
1302
1511
|
checkConflict: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("../core/tenant-entities"),exports),__exportStar(require("./availability"),exports),__exportStar(require("./config-template"),exports),__exportStar(require("./config-var"),exports),__exportStar(require("./geoservice-interfaces"),exports),__exportStar(require("./graphql"),exports),__exportStar(require("./metadata"),exports),__exportStar(require("./mobile-notification"),exports);
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("../core/tenant-entities"),exports),__exportStar(require("./api-client"),exports),__exportStar(require("./availability"),exports),__exportStar(require("./config-template"),exports),__exportStar(require("./config-var"),exports),__exportStar(require("./geoservice-interfaces"),exports),__exportStar(require("./graphql"),exports),__exportStar(require("./lock-service-interfaces"),exports),__exportStar(require("./metadata"),exports),__exportStar(require("./mobile-notification"),exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,o,r){return new(o||(o=Promise))((function(a,
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,o,r){return new(o||(o=Promise))((function(a,i){function n(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(n,c)}s((r=r.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CursorBasedFetchingStrategy=void 0,exports.CursorBasedFetchingStrategy={execute(t){return __awaiter(this,void 0,void 0,(function*(){var e,o,r,a,i,n;const c=t.contextData.job.BatchSize||200,s=(t.contextData.job.Fields||"UID").split(",").map((t=>t.trim()));s.includes("UID")||s.push("UID");let u={objectName:t.contextData.job.ObjectName,operationName:t.contextData.job.ObjectName,first:c,orderBy:t.contextData.job.OrderBy,after:null===(o=null===(e=t.contextData.batchState)||void 0===e?void 0:e.processor)||void 0===o?void 0:o.cursor,filter:t.contextData.job.FilterCondition,fields:s.join("\n")};const d=t.newQueryBuilder(u);d.withFields(s).withLimit(c).withOrderBy(t.contextData.job.OrderBy).withFilter(t.contextData.job.FilterCondition);const l=yield t.graphqlService.query(d.build()),h=l.records,v=l.endCursor;return null===(i=null===(a=null===(r=t.contextData.batchState)||void 0===r?void 0:r.processor)||void 0===a?void 0:a.allCursors)||void 0===i||i.push(v),(null===(n=t.contextData.batchState)||void 0===n?void 0:n.processor)&&(t.contextData.batchState.processor.cursor=v),h}))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(n,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateBasedFetchingStrategy=void 0,exports.DateBasedFetchingStrategy={execute(e){return __awaiter(this,void 0,void 0,(function*(){const t=e.contextData.job;let i=`LastModifiedDate <= ${t.CreatedDate} `;t.FilterCondition&&(i+=` AND ${t.FilterCondition}`);const r=t.OrderBy||"CreatedDate ASC",n=t.BatchSize||10,a=(t.Fields||"UID").split(",").map((e=>e.trim()));return(yield e.graphqlService.query({objectName:t.ObjectName,first:n,filter:i,orderBy:r,fields:a.join("\n")})).records}))}};
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(n,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateBasedFetchingStrategy=void 0,exports.DateBasedFetchingStrategy={execute(e){return __awaiter(this,void 0,void 0,(function*(){const t=e.contextData.job;let i=`LastModifiedDate <= ${t.CreatedDate} `;t.FilterCondition&&(i+=` AND ${t.FilterCondition}`);const r=t.OrderBy||"CreatedDate ASC",n=t.BatchSize||10,a=(t.Fields||"UID").split(",").map((e=>e.trim()));return(yield e.graphqlService.query({objectName:t.ObjectName,operationName:t.ObjectName,first:n,filter:i,orderBy:r,fields:a.join("\n")})).records}))}};
|