@skedulo/pulse-solution-services 0.0.6 → 0.0.8
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 +13 -1
- package/README.md +321 -25
- package/dist/clients/artifact-client.js +1 -1
- package/dist/clients/availability-api-client.js +1 -0
- package/dist/clients/base-client.js +1 -1
- package/dist/clients/geo-api-client.js +1 -0
- 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/constants/tenant-endpoints.js +1 -1
- package/dist/core/entity-factory.js +1 -0
- 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-context.js +1 -0
- package/dist/core/request-header-constants.js +1 -0
- package/dist/core/tenant-objects.js +1 -0
- package/dist/index.d.ts +708 -151
- package/dist/interfaces/api-client.js +1 -0
- package/dist/interfaces/availability.js +1 -0
- package/dist/interfaces/geoservice-interfaces.js +1 -0
- package/dist/interfaces/index.js +1 -1
- 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/geoservice.js +1 -0
- package/dist/services/graph-batch/graph-batch-config.d.ts +34 -0
- package/dist/services/graph-batch/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 +3 -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/graphql/graphql-query-builder.d.ts +17 -28
- 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/resource-availability/builder/data-service.d.ts +10 -0
- package/dist/services/resource-availability/builder/data-service.js +1 -0
- package/dist/services/resource-availability/builder/index.d.ts +3 -0
- package/dist/services/resource-availability/builder/index.js +1 -0
- package/dist/services/resource-availability/builder/resource-availability-service.d.ts +8 -0
- package/dist/services/resource-availability/builder/resource-availability-service.js +1 -0
- package/dist/services/resource-availability/builder/resource-builder.d.ts +17 -0
- package/dist/services/resource-availability/builder/resource-builder.js +1 -0
- package/dist/services/resource-availability/builder/resource-query-param.d.ts +23 -0
- package/dist/services/resource-availability/builder/resource-query-param.js +1 -0
- package/dist/services/resource-availability/index.d.ts +2 -0
- package/dist/services/resource-availability/index.js +1 -0
- package/dist/services/resource-availability/validator/index.d.ts +3 -0
- package/dist/services/resource-availability/validator/index.js +1 -0
- package/dist/services/resource-availability/validator/resource-job-validation.d.ts +11 -0
- package/dist/services/resource-availability/validator/resource-job-validation.js +1 -0
- package/dist/services/resource-availability/validator/resource-validation-option.d.ts +5 -0
- package/dist/services/resource-availability/validator/resource-validation-option.js +1 -0
- package/dist/services/resource-availability/validator/resource-validator.d.ts +13 -0
- package/dist/services/resource-availability/validator/resource-validator.js +1 -0
- package/dist/services/resource-availability/validator/validation-result.d.ts +12 -0
- package/dist/services/resource-availability/validator/validation-result.js +1 -0
- package/dist/utils/datetime-utils.js +1 -0
- package/dist/utils/index.js +1 -1
- package/package.json +7 -2
- package/yarn.lock +38 -0
- package/dist/clients/artifacts/artifact-client.d.ts +0 -19
- package/dist/clients/artifacts/artifact-client.js +0 -1
- package/dist/clients/artifacts/base-artifact-client.d.ts +0 -14
- package/dist/clients/artifacts/base-artifact-client.js +0 -1
- package/dist/clients/artifacts/object-based-artifact-client.d.ts +0 -11
- package/dist/clients/artifacts/object-based-artifact-client.js +0 -1
- package/dist/clients/custom-field-client.js +0 -1
- package/dist/clients/custom-schema-client.js +0 -1
- package/dist/constants/artifact.js +0 -1
- package/dist/constants/config-var.js +0 -1
- package/dist/constants/config-variable-constants.js +0 -1
- package/dist/constants/mobile-notification.js +0 -1
- package/dist/constants/tenant-objects.js +0 -1
- /package/dist/{interfaces/custom-field.js → core/base-config.js} +0 -0
- /package/dist/{interfaces/custom-schema.js → core/tenant-entities.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,49 @@ 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
|
+
declare class ExecutionOptions {
|
|
61
|
+
/**
|
|
62
|
+
* Identifies the origin of the request (e.g., the system, application, or project that initiated the call).
|
|
63
|
+
* Helps in tracking and debugging requests across different systems.
|
|
64
|
+
*/
|
|
65
|
+
requestSource?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Identifies the client service or Lambda function making the request.
|
|
68
|
+
* Useful for debugging and log filtering to trace which service handled the request.
|
|
69
|
+
*/
|
|
70
|
+
userAgent?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Creates an instance of ExecutionOptions.
|
|
73
|
+
* Allows initializing with partial values for flexibility.
|
|
74
|
+
*
|
|
75
|
+
* @param initialValues - Partial execution options for initialization.
|
|
76
|
+
*/
|
|
77
|
+
constructor(initialValues?: Partial<ExecutionOptions>);
|
|
78
|
+
}
|
|
79
|
+
export interface RequestParams {
|
|
80
|
+
method?: string;
|
|
81
|
+
endpoint: string;
|
|
82
|
+
body?: object;
|
|
83
|
+
headers?: Record<string, string>;
|
|
84
|
+
queryParams?: Record<string, string>;
|
|
85
|
+
}
|
|
61
86
|
/**
|
|
62
87
|
* Base client for making API requests with standardized error handling.
|
|
63
88
|
* Provides methods for setting up headers and performing API requests using fetch.
|
|
64
89
|
*/
|
|
65
90
|
export declare class BaseClient {
|
|
66
91
|
protected config: BaseConfig;
|
|
92
|
+
protected executionOptions: Partial<ExecutionOptions>;
|
|
67
93
|
/**
|
|
68
94
|
* Creates an instance of BaseClient.
|
|
69
95
|
* @param {BaseConfig} config - The configuration object containing API server and token.
|
|
70
96
|
*/
|
|
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;
|
|
97
|
+
constructor(config: BaseConfig, executionOptions?: Partial<ExecutionOptions>);
|
|
87
98
|
/**
|
|
88
99
|
* Performs an API request with standardized error handling using fetch.
|
|
89
100
|
* @template T
|
|
@@ -96,13 +107,19 @@ export declare class BaseClient {
|
|
|
96
107
|
* @returns {Promise<T>} - The parsed response data.
|
|
97
108
|
* @throws {Error} - If the request fails or the response is not OK.
|
|
98
109
|
*/
|
|
99
|
-
protected performRequest<T = any>({ method, endpoint, headers, body, queryParams
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
protected performRequest<T = any>({ method, endpoint, headers, body, queryParams }: RequestParams, executionOptions?: Partial<ExecutionOptions>): Promise<T>;
|
|
111
|
+
/**
|
|
112
|
+
* Constructs the headers for API requests.
|
|
113
|
+
* @returns {Record<string, string>} - The headers including authorization and content type.
|
|
114
|
+
*/
|
|
115
|
+
protected getHeaders(executionOptions: Partial<ExecutionOptions>): Record<string, string>;
|
|
116
|
+
/**
|
|
117
|
+
* Builds a URL with query parameters.
|
|
118
|
+
* @param {string} endpoint - The API endpoint.
|
|
119
|
+
* @param {Record<string, string>} [queryParams] - Optional query parameters.
|
|
120
|
+
* @returns {string} - The full URL with query parameters.
|
|
121
|
+
*/
|
|
122
|
+
private buildUrl;
|
|
106
123
|
/**
|
|
107
124
|
* Handles exceptions encountered during API requests.
|
|
108
125
|
* @param {any} error - The error to handle.
|
|
@@ -243,67 +260,6 @@ export declare class ConfigVarClient extends BaseClient {
|
|
|
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",
|
|
@@ -396,27 +358,260 @@ export declare const TENANT_ENDPOINTS: {
|
|
|
396
358
|
readonly SEND_SMS: "notifications/sms";
|
|
397
359
|
readonly SMS_CONFIRMATION_REQUEST: "notifications/sms/confirmation_request";
|
|
398
360
|
};
|
|
361
|
+
readonly GEOSERVICES: {
|
|
362
|
+
readonly DISTANCE_MATRIX: "geoservices/distanceMatrix";
|
|
363
|
+
readonly DIRECTIONS: "geoservices/directions";
|
|
364
|
+
readonly GEOCODE: "geoservices/geocode";
|
|
365
|
+
readonly AUTOCOMPLETE: "geoservices/autocomplete";
|
|
366
|
+
readonly PLACE: "geoservices/place";
|
|
367
|
+
readonly TIMEZONE: "geoservices/timezone";
|
|
368
|
+
};
|
|
369
|
+
readonly AVAILABILITY: {
|
|
370
|
+
readonly SIMPLE: "availability/simple";
|
|
371
|
+
};
|
|
399
372
|
};
|
|
400
|
-
export
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
+
}
|
|
444
|
+
export interface LatLng {
|
|
445
|
+
lat: number;
|
|
446
|
+
lng: number;
|
|
447
|
+
}
|
|
448
|
+
export interface DistanceMatrixRequest {
|
|
449
|
+
origins: LatLng[];
|
|
450
|
+
destinations: LatLng[];
|
|
451
|
+
avoid?: ("ferry" | "highway" | "toll")[];
|
|
452
|
+
departureTime?: string;
|
|
453
|
+
}
|
|
454
|
+
export interface DistanceMatrixResponse {
|
|
455
|
+
matrix: DistanceMatrixEntry[][];
|
|
456
|
+
vendor: string;
|
|
457
|
+
}
|
|
458
|
+
export interface DistanceMatrixEntry {
|
|
459
|
+
status: "OK" | "NO_ROUTE";
|
|
460
|
+
duration?: {
|
|
461
|
+
durationInSeconds: number;
|
|
462
|
+
};
|
|
463
|
+
distance?: {
|
|
464
|
+
distanceInMeters: number;
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
export interface DirectionsRequest {
|
|
468
|
+
requests: {
|
|
469
|
+
origin: LatLng;
|
|
470
|
+
destination: LatLng;
|
|
471
|
+
waypoints?: LatLng[];
|
|
472
|
+
avoid?: ("ferry" | "highway" | "toll")[];
|
|
473
|
+
}[];
|
|
474
|
+
}
|
|
475
|
+
export interface DirectionsResponse {
|
|
476
|
+
routes: {
|
|
477
|
+
leg: {
|
|
478
|
+
origin: LatLng;
|
|
479
|
+
destination: LatLng;
|
|
480
|
+
};
|
|
481
|
+
travelInfo: {
|
|
482
|
+
status: "OK" | "NO_ROUTE";
|
|
483
|
+
duration: {
|
|
484
|
+
durationInSeconds: number;
|
|
485
|
+
};
|
|
486
|
+
distance: {
|
|
487
|
+
distanceInMeters: number;
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
}[];
|
|
491
|
+
}
|
|
492
|
+
export interface GeocodeRequest {
|
|
493
|
+
addresses: string[];
|
|
494
|
+
language?: string;
|
|
495
|
+
responseType?: "allMatches";
|
|
496
|
+
}
|
|
497
|
+
export interface GeocodeResponse {
|
|
498
|
+
result: {
|
|
499
|
+
address: string;
|
|
500
|
+
latLng: LatLng;
|
|
501
|
+
granularity?: string;
|
|
502
|
+
}[];
|
|
503
|
+
}
|
|
504
|
+
export interface AutocompleteRequest {
|
|
505
|
+
input: string;
|
|
506
|
+
sessionId?: string;
|
|
507
|
+
location?: LatLng;
|
|
508
|
+
radius?: number;
|
|
509
|
+
country?: string;
|
|
510
|
+
}
|
|
511
|
+
export interface AutocompleteResponse {
|
|
512
|
+
predictions: {
|
|
513
|
+
description: string;
|
|
514
|
+
placeId: string;
|
|
515
|
+
}[];
|
|
516
|
+
status: "OK" | "ZERO_RESULTS";
|
|
517
|
+
errorMessage?: string;
|
|
518
|
+
}
|
|
519
|
+
export interface PlaceRequest {
|
|
520
|
+
placeId: string;
|
|
521
|
+
sessionId: string;
|
|
522
|
+
}
|
|
523
|
+
export interface PlaceResponse {
|
|
524
|
+
addressComponents: {
|
|
525
|
+
streetNumber: string;
|
|
526
|
+
route: string;
|
|
527
|
+
localCity: string;
|
|
528
|
+
area2: string;
|
|
529
|
+
area1: string;
|
|
530
|
+
country: string;
|
|
531
|
+
postalCode: string;
|
|
532
|
+
};
|
|
533
|
+
formattedAddress: string;
|
|
534
|
+
geometry: LatLng;
|
|
535
|
+
}
|
|
536
|
+
export interface TimezoneRequest {
|
|
537
|
+
location: [
|
|
538
|
+
number,
|
|
539
|
+
number
|
|
540
|
+
];
|
|
541
|
+
timestamp: number;
|
|
542
|
+
}
|
|
543
|
+
export interface TimezoneResponse {
|
|
544
|
+
dstOffset: number;
|
|
545
|
+
rawOffset: number;
|
|
546
|
+
timeZoneId: string;
|
|
547
|
+
}
|
|
548
|
+
export interface BaseObject {
|
|
549
|
+
id: string;
|
|
550
|
+
name: string;
|
|
551
|
+
propertyMap?: Record<string, any>;
|
|
552
|
+
}
|
|
553
|
+
export interface BaseEvent extends BaseObject {
|
|
554
|
+
start: Date;
|
|
555
|
+
finish: Date;
|
|
556
|
+
eventType?: string;
|
|
557
|
+
description?: string;
|
|
558
|
+
geoLocation?: LatLng;
|
|
559
|
+
}
|
|
560
|
+
export interface Resource extends BaseObject {
|
|
561
|
+
category?: string;
|
|
562
|
+
employmentType?: string;
|
|
563
|
+
resourceType?: string;
|
|
564
|
+
userId?: string;
|
|
565
|
+
regionId?: string;
|
|
566
|
+
timezone: string;
|
|
567
|
+
tags: Tag[];
|
|
568
|
+
availabilities: BaseEvent[];
|
|
569
|
+
events: BaseEvent[];
|
|
570
|
+
}
|
|
571
|
+
export interface Tag extends BaseObject {
|
|
572
|
+
}
|
|
573
|
+
export interface Availability extends BaseEvent {
|
|
574
|
+
resourceId: string;
|
|
575
|
+
isAvailable: boolean;
|
|
576
|
+
status: string;
|
|
577
|
+
availabilityType: string;
|
|
578
|
+
}
|
|
579
|
+
export interface Activity extends BaseEvent {
|
|
580
|
+
resourceId: string;
|
|
581
|
+
activityType: string;
|
|
582
|
+
}
|
|
583
|
+
export interface JobAllocation extends BaseEvent {
|
|
584
|
+
jobId: string;
|
|
585
|
+
resourceId: string;
|
|
586
|
+
status: string;
|
|
587
|
+
}
|
|
588
|
+
export interface Job extends BaseEvent {
|
|
589
|
+
address: string;
|
|
590
|
+
contactId: string;
|
|
591
|
+
jobStatus: string;
|
|
592
|
+
regionId: string;
|
|
593
|
+
tags: Tag[];
|
|
594
|
+
}
|
|
595
|
+
export interface ResourceShift extends BaseEvent {
|
|
596
|
+
resourceId: string;
|
|
597
|
+
shift: Shift;
|
|
598
|
+
}
|
|
599
|
+
export interface Shift extends BaseEvent {
|
|
600
|
+
regionId: string;
|
|
601
|
+
displayName: string;
|
|
602
|
+
isDraft: boolean;
|
|
603
|
+
}
|
|
604
|
+
export declare class EntityFactory {
|
|
605
|
+
static createBaseObject(data: Record<string, string>): BaseObject;
|
|
606
|
+
static createBaseEvent(data: Record<string, string>): BaseEvent;
|
|
607
|
+
static createTag(data: Record<string, any>): Tag;
|
|
608
|
+
static createResource(data: Record<string, any>): Resource;
|
|
609
|
+
static createJob(data: Record<string, any>): Job;
|
|
610
|
+
static createAvailability(data: Record<string, any>): Availability;
|
|
611
|
+
static createActivity(data: Record<string, any>): Activity;
|
|
612
|
+
static createJobAllocation(data: Record<string, any>): JobAllocation;
|
|
613
|
+
static createResourceShift(data: Record<string, any>): ResourceShift;
|
|
614
|
+
static createShift(data: Record<string, any>): Shift;
|
|
420
615
|
}
|
|
421
616
|
export type ArtifactParams = {
|
|
422
617
|
objectName?: string;
|
|
@@ -427,7 +622,7 @@ export type ArtifactParams = {
|
|
|
427
622
|
declare class ArtifactClient extends BaseClient {
|
|
428
623
|
private artifactType;
|
|
429
624
|
private baseEndpoint;
|
|
430
|
-
constructor(config: any, artifactType: ArtifactType);
|
|
625
|
+
constructor(config: any, artifactType: ArtifactType, executionOptions?: Partial<ExecutionOptions>);
|
|
431
626
|
list<T>(): Promise<T[]>;
|
|
432
627
|
get<T>(params?: ArtifactParams): Promise<T>;
|
|
433
628
|
create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
|
|
@@ -435,6 +630,58 @@ declare class ArtifactClient extends BaseClient {
|
|
|
435
630
|
delete(params: ArtifactParams): Promise<void>;
|
|
436
631
|
private buildEndpoint;
|
|
437
632
|
}
|
|
633
|
+
export interface AvailabilityRequestParams {
|
|
634
|
+
/**
|
|
635
|
+
* Array of resource IDs for which availability is requested.
|
|
636
|
+
* Must contain at least one and at most 200 resource IDs.
|
|
637
|
+
*/
|
|
638
|
+
resourceIds: string[];
|
|
639
|
+
/**
|
|
640
|
+
* The UTC datetime from which to start fetching availability (ISO 8601 format).
|
|
641
|
+
*/
|
|
642
|
+
start: string;
|
|
643
|
+
/**
|
|
644
|
+
* The UTC datetime until which to fetch availability (ISO 8601 format).
|
|
645
|
+
* Must be after start and within 375 days.
|
|
646
|
+
*/
|
|
647
|
+
end: string;
|
|
648
|
+
/**
|
|
649
|
+
* If true, merged availability time intervals are returned in the response.
|
|
650
|
+
* Defaults to false.
|
|
651
|
+
*/
|
|
652
|
+
mergedAvailabilities?: boolean;
|
|
653
|
+
/**
|
|
654
|
+
* If true (or omitted), a list of availability entries is returned.
|
|
655
|
+
* Defaults to true.
|
|
656
|
+
*/
|
|
657
|
+
entries?: boolean;
|
|
658
|
+
}
|
|
659
|
+
export interface AvailabilityResult {
|
|
660
|
+
resourceId: string;
|
|
661
|
+
mergedAvailabilities?: {
|
|
662
|
+
start: string;
|
|
663
|
+
end: string;
|
|
664
|
+
}[];
|
|
665
|
+
entries?: AvailabilityEntry[];
|
|
666
|
+
}
|
|
667
|
+
export interface AvailabilityEntry {
|
|
668
|
+
type: "template" | "pattern" | "override" | "holiday";
|
|
669
|
+
start: string;
|
|
670
|
+
end: string;
|
|
671
|
+
available: boolean;
|
|
672
|
+
templateEntryId?: string;
|
|
673
|
+
name?: string;
|
|
674
|
+
patternId?: string;
|
|
675
|
+
patternRecordId?: string;
|
|
676
|
+
}
|
|
677
|
+
declare class AvailabilityAPIClient extends BaseClient {
|
|
678
|
+
/**
|
|
679
|
+
* Fetches resource availability based on the given request parameters.
|
|
680
|
+
* @param {AvailabilityRequestParams} params - The request parameters for availability.
|
|
681
|
+
* @returns {Promise<AvailabilityResult[]>} - The availability data for the requested resources.
|
|
682
|
+
*/
|
|
683
|
+
fetchAvailability(params: AvailabilityRequestParams): Promise<AvailabilityResult[]>;
|
|
684
|
+
}
|
|
438
685
|
declare class ConfigFeaturesClient extends BaseClient {
|
|
439
686
|
/**
|
|
440
687
|
* Fetches feature flags configuration.
|
|
@@ -448,6 +695,32 @@ declare class ConfigFeaturesClient extends BaseClient {
|
|
|
448
695
|
*/
|
|
449
696
|
update(tenantId: string, newConfig: Record<string, any>): Promise<Record<string, any>>;
|
|
450
697
|
}
|
|
698
|
+
declare class GeoAPIClient extends BaseClient {
|
|
699
|
+
/**
|
|
700
|
+
* Computes travel distance and time for all combinations of origin and destination locations.
|
|
701
|
+
*/
|
|
702
|
+
getDistanceMatrix(data: DistanceMatrixRequest): Promise<DistanceMatrixResponse>;
|
|
703
|
+
/**
|
|
704
|
+
* Calculates directions between source and destination addresses, possibly including waypoints en route.
|
|
705
|
+
*/
|
|
706
|
+
getDirections(data: DirectionsRequest): Promise<DirectionsResponse>;
|
|
707
|
+
/**
|
|
708
|
+
* Geocodes a given list of addresses and returns their latitude and longitude coordinates.
|
|
709
|
+
*/
|
|
710
|
+
geocodeAddress(data: GeocodeRequest): Promise<GeocodeResponse>;
|
|
711
|
+
/**
|
|
712
|
+
* Provides address autocomplete suggestions based on an input string.
|
|
713
|
+
*/
|
|
714
|
+
autocompleteAddress(data: AutocompleteRequest): Promise<AutocompleteResponse>;
|
|
715
|
+
/**
|
|
716
|
+
* Fetches detailed information for a given place ID.
|
|
717
|
+
*/
|
|
718
|
+
getPlaceDetails(data: PlaceRequest): Promise<PlaceResponse>;
|
|
719
|
+
/**
|
|
720
|
+
* Retrieves timezone information for a given location and timestamp.
|
|
721
|
+
*/
|
|
722
|
+
getTimezone(data: TimezoneRequest): Promise<TimezoneResponse>;
|
|
723
|
+
}
|
|
451
724
|
export interface JobRequest {
|
|
452
725
|
jobId: string;
|
|
453
726
|
}
|
|
@@ -654,6 +927,43 @@ export interface CacheOptions<T> {
|
|
|
654
927
|
ttl?: number;
|
|
655
928
|
useSecondaryCache?: boolean;
|
|
656
929
|
}
|
|
930
|
+
declare class GeoService {
|
|
931
|
+
private geoAPIClient;
|
|
932
|
+
private sessionId;
|
|
933
|
+
constructor(geoAPIClient: GeoAPIClient);
|
|
934
|
+
/**
|
|
935
|
+
* Gets distance matrix and returns a structured result map.
|
|
936
|
+
*/
|
|
937
|
+
getDistanceMatrix(origins: LatLng[], destinations: LatLng[]): Promise<Map<string, any>>;
|
|
938
|
+
/**
|
|
939
|
+
* Fetches address suggestions and automatically retrieves place details for the first result.
|
|
940
|
+
*/
|
|
941
|
+
getAddressSuggestions(request: AutocompleteRequest, maxResults?: number): Promise<PlaceResponse[] | null>;
|
|
942
|
+
/**
|
|
943
|
+
* Gets timezone information for a given location.
|
|
944
|
+
*/
|
|
945
|
+
getTimezone(data: TimezoneRequest): Promise<string>;
|
|
946
|
+
/**
|
|
947
|
+
* Generates a new session ID.
|
|
948
|
+
*/
|
|
949
|
+
generateNewSessionId(): string;
|
|
950
|
+
/**
|
|
951
|
+
* Strips trailing zeros from latitude and longitude values.
|
|
952
|
+
*
|
|
953
|
+
* This is necessary because some systems, like Salesforce, may automatically remove trailing zeros
|
|
954
|
+
* when storing or processing geolocation values. If we use raw geocodes (e.g., -78.729880, 35.897187),
|
|
955
|
+
* they might be altered to -78.72988, 35.897187 when retrieved later.
|
|
956
|
+
*
|
|
957
|
+
* Since the Distance Matrix API uses the exact string representation of coordinates as keys for caching
|
|
958
|
+
* and lookup, a mismatch due to trailing zeros can cause unexpected errors or failed lookups.
|
|
959
|
+
* Removing trailing zeros ensures consistency in coordinate representation and prevents key mismatches.
|
|
960
|
+
*/
|
|
961
|
+
stripTrailingZeros(value: number): string;
|
|
962
|
+
/**
|
|
963
|
+
* Creates a unique key for origin and destination pair, ensuring stripped trailing zeros.
|
|
964
|
+
*/
|
|
965
|
+
createKey(origin: LatLng, destination: LatLng): string;
|
|
966
|
+
}
|
|
657
967
|
/**
|
|
658
968
|
* A service class for handling GraphQL operations.
|
|
659
969
|
*/
|
|
@@ -666,43 +976,51 @@ export declare class GraphQLService {
|
|
|
666
976
|
constructor(client: GraphQLClient);
|
|
667
977
|
/**
|
|
668
978
|
* Executes a GraphQL query to fetch records.
|
|
669
|
-
* @param {
|
|
979
|
+
* @param {GraphqlQueryParams} params - The query parameters.
|
|
670
980
|
* @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
|
|
671
981
|
*/
|
|
672
|
-
query(params:
|
|
982
|
+
query(params: GraphqlQueryParams): Promise<QueryResult>;
|
|
673
983
|
/**
|
|
674
|
-
*
|
|
984
|
+
* Performs a mutation operation on the GraphQL API.
|
|
675
985
|
* @param {string} objectName - The name of the object.
|
|
676
986
|
* @param {HasId[]} records - The records to delete.
|
|
677
987
|
* @returns {Promise<any>} - The response from the delete operation.
|
|
678
988
|
*/
|
|
679
|
-
|
|
989
|
+
mutate(params: GraphqlMurationParams): Promise<any>;
|
|
990
|
+
/**
|
|
991
|
+
* Deletes records from the GraphQL API.
|
|
992
|
+
*/
|
|
993
|
+
delete(params: GraphqlMurationParams): Promise<any>;
|
|
680
994
|
/**
|
|
681
995
|
* Updates records in the GraphQL API.
|
|
682
|
-
* @param {string} objectName - The name of the object.
|
|
683
|
-
* @param {HasId[]} records - The records to update.
|
|
684
|
-
* @returns {Promise<any>} - The response from the update operation.
|
|
685
996
|
*/
|
|
686
|
-
update(
|
|
997
|
+
update(params: GraphqlMurationParams): Promise<any>;
|
|
687
998
|
/**
|
|
688
999
|
* Inserts records into the GraphQL API.
|
|
689
|
-
* @param {string} objectName - The name of the object.
|
|
690
|
-
* @param {HasId[]} records - The records to insert.
|
|
691
|
-
* @returns {Promise<any>} - The response from the insert operation.
|
|
692
1000
|
*/
|
|
693
|
-
insert(
|
|
1001
|
+
insert(params: GraphqlMurationParams): Promise<any>;
|
|
694
1002
|
/**
|
|
695
1003
|
* Extracts job UIDs from a GraphQL mutation response.
|
|
696
1004
|
* @param {MutationResult} response - The response object.
|
|
697
1005
|
* @returns {string[]} - An array of job UIDs.
|
|
698
1006
|
*/
|
|
699
1007
|
extractJobUIDs(response: MutationResult): string[];
|
|
1008
|
+
/**
|
|
1009
|
+
* Formats the object name to follow GraphQL naming conventions.
|
|
1010
|
+
* @param {string} objectName - The object name to format.
|
|
1011
|
+
* @returns {string} - The formatted object name.
|
|
1012
|
+
*/
|
|
1013
|
+
private getQueryName;
|
|
1014
|
+
private getQueryHeaders;
|
|
1015
|
+
private getMutationHeaders;
|
|
1016
|
+
private getOperationHeader;
|
|
700
1017
|
}
|
|
701
1018
|
/**
|
|
702
1019
|
* A utility class for building GraphQL queries dynamically.
|
|
703
1020
|
*/
|
|
704
1021
|
export declare class GraphQLQueryBuilder {
|
|
705
1022
|
private objectName;
|
|
1023
|
+
operationName: string;
|
|
706
1024
|
private fields;
|
|
707
1025
|
private filters;
|
|
708
1026
|
private first?;
|
|
@@ -713,77 +1031,113 @@ export declare class GraphQLQueryBuilder {
|
|
|
713
1031
|
private childQueries;
|
|
714
1032
|
private isParent;
|
|
715
1033
|
private graphqlService;
|
|
1034
|
+
private queryParams;
|
|
716
1035
|
/**
|
|
717
1036
|
* Creates an instance of GraphQLQueryBuilder.
|
|
718
|
-
* @param {string}
|
|
1037
|
+
* @param {string} graphqlQueryParams - The necessary parameters for the query.
|
|
719
1038
|
* @param {boolean} [isParent=false] - Indicates if this query is a parent query.
|
|
720
1039
|
*/
|
|
721
|
-
constructor(
|
|
1040
|
+
constructor(queryParams: GraphqlQueryParams, isParent?: boolean);
|
|
722
1041
|
/**
|
|
723
1042
|
* Sets the GraphQL service to use for executing the query.
|
|
724
|
-
* @param {GraphQLService} graphqlService - The GraphQL service instance.
|
|
725
|
-
* @returns {void}
|
|
726
1043
|
*/
|
|
727
1044
|
setGraphqlService(graphqlService: GraphQLService): void;
|
|
728
1045
|
/**
|
|
729
|
-
* Specifies the fields to be retrieved.
|
|
730
|
-
* @param {string[]} fields - The list of fields to select.
|
|
731
|
-
* @returns {this} - The query builder instance.
|
|
1046
|
+
* Specifies the fields to be retrieved. Prevents duplicates.
|
|
732
1047
|
*/
|
|
733
1048
|
withFields(fields: string[]): this;
|
|
734
1049
|
/**
|
|
735
1050
|
* Adds a filter condition to the query.
|
|
736
|
-
* @param {string} condition - The filter condition.
|
|
737
|
-
* @returns {this} - The query builder instance.
|
|
738
1051
|
*/
|
|
739
1052
|
withFilter(condition: string): this;
|
|
740
1053
|
/**
|
|
741
1054
|
* Sets a limit on the number of records to retrieve.
|
|
742
|
-
* @param {number} first - The number of records to fetch.
|
|
743
|
-
* @returns {this} - The query builder instance.
|
|
744
1055
|
*/
|
|
745
1056
|
withLimit(first: number): this;
|
|
746
1057
|
/**
|
|
747
1058
|
* Sets an offset for pagination.
|
|
748
|
-
* @param {number} offset - The offset value.
|
|
749
|
-
* @returns {this} - The query builder instance.
|
|
750
1059
|
*/
|
|
751
1060
|
withOffset(offset: number): this;
|
|
752
1061
|
/**
|
|
753
1062
|
* Sets the order in which records should be retrieved.
|
|
754
|
-
* @param {string} orderBy - The field to order by.
|
|
755
|
-
* @returns {this} - The query builder instance.
|
|
756
1063
|
*/
|
|
757
1064
|
withOrderBy(orderBy: string): this;
|
|
758
1065
|
/**
|
|
759
1066
|
* Applies cursor-based pagination.
|
|
760
|
-
* @param {string} after - The cursor position.
|
|
761
|
-
* @returns {this} - The query builder instance.
|
|
762
1067
|
*/
|
|
763
1068
|
withCursor(after: string): this;
|
|
764
1069
|
/**
|
|
765
1070
|
* Creates a parent query.
|
|
766
|
-
* @param {string} objectName - The name of the parent object.
|
|
767
|
-
* @returns {GraphQLQueryBuilder} - A new query builder instance for the parent.
|
|
768
1071
|
*/
|
|
769
1072
|
withParentQuery(objectName: string): GraphQLQueryBuilder;
|
|
770
1073
|
/**
|
|
771
1074
|
* Creates a child query.
|
|
772
|
-
* @param {string} objectName - The name of the child object.
|
|
773
|
-
* @returns {GraphQLQueryBuilder} - A new query builder instance for the child.
|
|
774
1075
|
*/
|
|
775
1076
|
withChildQuery(objectName: string): GraphQLQueryBuilder;
|
|
776
1077
|
/**
|
|
777
|
-
*
|
|
778
|
-
|
|
1078
|
+
* Recursively builds the GraphQL query fields, handling nested queries.
|
|
1079
|
+
*/
|
|
1080
|
+
private formatQueryFields;
|
|
1081
|
+
/**
|
|
1082
|
+
* Builds the GraphQL query parameters in a more structured format.
|
|
779
1083
|
*/
|
|
780
|
-
build():
|
|
1084
|
+
build(): GraphqlQueryParams;
|
|
781
1085
|
/**
|
|
782
|
-
* Executes the query using the GraphQL service.
|
|
783
|
-
* @returns {Promise<QueryResult>} - The query result.
|
|
784
|
-
* @throws {Error} - If no GraphQL service is set.
|
|
1086
|
+
* Executes the query using the GraphQL service, with improved error handling.
|
|
785
1087
|
*/
|
|
786
1088
|
execute(): Promise<QueryResult>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Generates a string representation of the GraphQL query for debugging.
|
|
1091
|
+
*/
|
|
1092
|
+
toString(): string;
|
|
1093
|
+
}
|
|
1094
|
+
export declare class ResourceQueryParam {
|
|
1095
|
+
resourceIds?: Set<string>;
|
|
1096
|
+
regionIds?: Set<string>;
|
|
1097
|
+
startTime: Date;
|
|
1098
|
+
endTime: Date;
|
|
1099
|
+
timezone: string;
|
|
1100
|
+
respectResourceTimezone: boolean;
|
|
1101
|
+
mergeAvailability: boolean;
|
|
1102
|
+
mergeEvents: boolean;
|
|
1103
|
+
useTag: boolean;
|
|
1104
|
+
useJobAllocation: boolean;
|
|
1105
|
+
useResourceShift: boolean;
|
|
1106
|
+
useActivity: boolean;
|
|
1107
|
+
useAvailability: boolean;
|
|
1108
|
+
useAvailabilityTemplate: boolean;
|
|
1109
|
+
useAvailabilityPattern: boolean;
|
|
1110
|
+
useHoliday: boolean;
|
|
1111
|
+
excludedJAStatus: Set<string>;
|
|
1112
|
+
excludedJobStatus: Set<string>;
|
|
1113
|
+
availabilityStatus: Set<string>;
|
|
1114
|
+
resourceTypes: Set<string>;
|
|
1115
|
+
constructor();
|
|
1116
|
+
}
|
|
1117
|
+
declare class DataService {
|
|
1118
|
+
private graphqlService;
|
|
1119
|
+
constructor(graphqlService: GraphQLService);
|
|
1120
|
+
getResources(param: ResourceQueryParam): Promise<Record<string, any>[]>;
|
|
1121
|
+
getHolidays(regionIds: string[], startTime?: Date, endTime?: Date): Promise<Record<string, any>>;
|
|
1122
|
+
newQueryBuilder(params: GraphqlQueryParams): GraphQLQueryBuilder;
|
|
1123
|
+
}
|
|
1124
|
+
export declare class ResourceAvailabilityService {
|
|
1125
|
+
private availabilityAPIClient;
|
|
1126
|
+
constructor(availabilityAPIClient: AvailabilityAPIClient);
|
|
1127
|
+
getAvailabilityPatterns(param: ResourceQueryParam): Promise<Map<string, BaseEvent[]>>;
|
|
1128
|
+
}
|
|
1129
|
+
export declare class ResourceBuilder {
|
|
1130
|
+
private dataService;
|
|
1131
|
+
private availabilityService;
|
|
1132
|
+
constructor(dataService: DataService, availabilityService: ResourceAvailabilityService);
|
|
1133
|
+
build(queryParam: ResourceQueryParam): Promise<Resource[]>;
|
|
1134
|
+
private loadAvailabilityPatterns;
|
|
1135
|
+
private loadActivityEvents;
|
|
1136
|
+
private loadAvailabilityEvents;
|
|
1137
|
+
private loadJobAllocationEvents;
|
|
1138
|
+
private loadResourceShiftEvents;
|
|
1139
|
+
private loadHolidayEvents;
|
|
1140
|
+
protected buildMore(resources: Resource[]): Resource[];
|
|
787
1141
|
}
|
|
788
1142
|
/**
|
|
789
1143
|
* ConfigHelper class provides methods to access and parse configuration variables.
|
|
@@ -820,20 +1174,40 @@ export declare class ConfigHelper {
|
|
|
820
1174
|
*/
|
|
821
1175
|
getString(varName: string): string;
|
|
822
1176
|
}
|
|
1177
|
+
export declare class DateTimeUtils {
|
|
1178
|
+
static toTimezone(input: Date, toTimezone: string): Date;
|
|
1179
|
+
static switchTimezone(input: Date, fromTimezone: string, toTimezone: string): Date;
|
|
1180
|
+
static addMinutes(input: Date, minutes: number, timezone: string): Date;
|
|
1181
|
+
static addDays(input: Date, days: number, timezone: string): Date;
|
|
1182
|
+
static addMonths(input: Date, months: number, timezone: string): Date;
|
|
1183
|
+
static addYears(input: Date, years: number, timezone: string): Date;
|
|
1184
|
+
static getDate(input: Date, timezone: string): Date;
|
|
1185
|
+
static getDateFromIsoString(isoString: string): Date;
|
|
1186
|
+
static getDateTimeFromIsoString(isoString: string): Date;
|
|
1187
|
+
static getStartOfDate(input: Date | string, timezone: string): Date;
|
|
1188
|
+
static getEndOfDate(input: Date | string, timezone: string): Date;
|
|
1189
|
+
static isIncluding(event: BaseEvent, job: BaseEvent): boolean;
|
|
1190
|
+
static isOverlapping(event: BaseEvent, job: BaseEvent): boolean;
|
|
1191
|
+
static mergeEvents(events: BaseEvent[]): BaseEvent[];
|
|
1192
|
+
}
|
|
823
1193
|
export declare class ExecutionContext {
|
|
824
1194
|
skedContext: any;
|
|
825
1195
|
contextData: any;
|
|
826
1196
|
private baseConfig;
|
|
827
1197
|
logger: typeof logger;
|
|
828
1198
|
private services;
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
static
|
|
1199
|
+
private _executionOptions;
|
|
1200
|
+
protected constructor(skedContext: any, executionOptions?: Partial<ExecutionOptions>);
|
|
1201
|
+
static fromContext(skedContext: any, executionOptions?: Partial<ExecutionOptions>): ExecutionContext;
|
|
1202
|
+
static fromCredentials(config: BaseConfig, executionOptions?: Partial<ExecutionOptions>): ExecutionContext;
|
|
1203
|
+
set executionOptions(executionOptions: Partial<ExecutionOptions>);
|
|
1204
|
+
get executionOptions(): Partial<ExecutionOptions>;
|
|
832
1205
|
/**
|
|
833
1206
|
* Generic method to retrieve or initialize a service.
|
|
834
1207
|
*/
|
|
835
1208
|
private getOrCreateService;
|
|
836
1209
|
get configHelper(): ConfigHelper;
|
|
1210
|
+
get baseClient(): BaseClient;
|
|
837
1211
|
get graphqlClient(): GraphQLClient;
|
|
838
1212
|
get graphqlService(): GraphQLService;
|
|
839
1213
|
get metadataClient(): MetadataClient;
|
|
@@ -844,12 +1218,77 @@ export declare class ExecutionContext {
|
|
|
844
1218
|
get configFeaturesClient(): ConfigFeaturesClient;
|
|
845
1219
|
get configVarClient(): ConfigVarClient;
|
|
846
1220
|
get mobileNotificationClient(): MobileNotificationClient;
|
|
1221
|
+
get geoAPIClient(): GeoAPIClient;
|
|
1222
|
+
get availabilityAPIClient(): AvailabilityAPIClient;
|
|
1223
|
+
get geoService(): GeoService;
|
|
847
1224
|
get configVarCache(): CacheService<any>;
|
|
848
1225
|
get inMemoryCache(): CacheService<any>;
|
|
849
|
-
|
|
1226
|
+
get resourceAvailabilityService(): ResourceAvailabilityService;
|
|
1227
|
+
get dataService(): DataService;
|
|
1228
|
+
get resourceBuilder(): ResourceBuilder;
|
|
1229
|
+
newQueryBuilder(params: GraphqlQueryParams): GraphQLQueryBuilder;
|
|
850
1230
|
newArtifactClient(artifactType: ArtifactType): ArtifactClient;
|
|
851
1231
|
dispose(): void;
|
|
852
1232
|
}
|
|
1233
|
+
export declare const REQUEST_HEADERS: Record<string, string>;
|
|
1234
|
+
export declare const TenantObjects: {
|
|
1235
|
+
Accounts: {
|
|
1236
|
+
Name: string;
|
|
1237
|
+
Fields: string[];
|
|
1238
|
+
};
|
|
1239
|
+
Jobs: {
|
|
1240
|
+
Name: string;
|
|
1241
|
+
Fields: string[];
|
|
1242
|
+
};
|
|
1243
|
+
JobTags: {
|
|
1244
|
+
Name: string;
|
|
1245
|
+
Fields: string[];
|
|
1246
|
+
};
|
|
1247
|
+
JobAllocations: {
|
|
1248
|
+
Name: string;
|
|
1249
|
+
Fields: string[];
|
|
1250
|
+
};
|
|
1251
|
+
Regions: {
|
|
1252
|
+
Name: string;
|
|
1253
|
+
Fields: string[];
|
|
1254
|
+
};
|
|
1255
|
+
Contacts: {
|
|
1256
|
+
Name: string;
|
|
1257
|
+
Fields: string[];
|
|
1258
|
+
};
|
|
1259
|
+
Locations: {
|
|
1260
|
+
Name: string;
|
|
1261
|
+
Fields: string[];
|
|
1262
|
+
};
|
|
1263
|
+
Resources: {
|
|
1264
|
+
Name: string;
|
|
1265
|
+
Fields: string[];
|
|
1266
|
+
};
|
|
1267
|
+
Tags: {
|
|
1268
|
+
Name: string;
|
|
1269
|
+
Fields: string[];
|
|
1270
|
+
};
|
|
1271
|
+
Activities: {
|
|
1272
|
+
Name: string;
|
|
1273
|
+
Fields: string[];
|
|
1274
|
+
};
|
|
1275
|
+
Availabilities: {
|
|
1276
|
+
Name: string;
|
|
1277
|
+
Fields: string[];
|
|
1278
|
+
};
|
|
1279
|
+
Holidays: {
|
|
1280
|
+
Name: string;
|
|
1281
|
+
Fields: string[];
|
|
1282
|
+
};
|
|
1283
|
+
ResourceTags: {
|
|
1284
|
+
Name: string;
|
|
1285
|
+
Fields: string[];
|
|
1286
|
+
};
|
|
1287
|
+
HolidayRegions: {
|
|
1288
|
+
Name: string;
|
|
1289
|
+
Fields: string[];
|
|
1290
|
+
};
|
|
1291
|
+
};
|
|
853
1292
|
/**
|
|
854
1293
|
* This decorator logs the input arguments and output results of a method,
|
|
855
1294
|
* including error handling with ANSI color-coded logs for better console readability.
|
|
@@ -905,5 +1344,123 @@ export declare class BatchOrchestrator {
|
|
|
905
1344
|
protected updateJobStatus(): Promise<void>;
|
|
906
1345
|
private isCompleted;
|
|
907
1346
|
}
|
|
1347
|
+
export declare enum PaginationStrategy {
|
|
1348
|
+
CURSOR = "cursor",
|
|
1349
|
+
OFFSET = "offset",
|
|
1350
|
+
NONE = "none"
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Default configuration values for `GraphBatchConfig`.
|
|
1354
|
+
*/
|
|
1355
|
+
export declare const DEFAULT_GRAPH_BATCH_CONFIG: GraphBatchConfig;
|
|
1356
|
+
declare const GraphBatchConfigSchema: z.ZodObject<{
|
|
1357
|
+
strategy: z.ZodNativeEnum<typeof PaginationStrategy>;
|
|
1358
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
1359
|
+
maxBatches: z.ZodDefault<z.ZodNumber>;
|
|
1360
|
+
delaySeconds: z.ZodDefault<z.ZodNumber>;
|
|
1361
|
+
}, "strip", z.ZodTypeAny, {
|
|
1362
|
+
strategy: PaginationStrategy;
|
|
1363
|
+
batchSize: number;
|
|
1364
|
+
maxBatches: number;
|
|
1365
|
+
delaySeconds: number;
|
|
1366
|
+
}, {
|
|
1367
|
+
strategy: PaginationStrategy;
|
|
1368
|
+
batchSize?: number | undefined;
|
|
1369
|
+
maxBatches?: number | undefined;
|
|
1370
|
+
delaySeconds?: number | undefined;
|
|
1371
|
+
}>;
|
|
1372
|
+
/**
|
|
1373
|
+
* Configuration options for `GraphBatch`.
|
|
1374
|
+
*/
|
|
1375
|
+
export type GraphBatchConfig = z.infer<typeof GraphBatchConfigSchema>;
|
|
1376
|
+
/**
|
|
1377
|
+
* Merges user-provided config with default values.
|
|
1378
|
+
*/
|
|
1379
|
+
export declare function initializeConfig(config: Partial<GraphBatchConfig> | undefined): GraphBatchConfig;
|
|
1380
|
+
/**
|
|
1381
|
+
* Base class for batch processing with pagination support.
|
|
1382
|
+
*/
|
|
1383
|
+
export declare abstract class GraphBatch {
|
|
1384
|
+
protected context: ExecutionContext;
|
|
1385
|
+
protected config: GraphBatchConfig;
|
|
1386
|
+
protected queryBuilder?: GraphQLQueryBuilder;
|
|
1387
|
+
protected queryResult?: QueryResult;
|
|
1388
|
+
private startTime;
|
|
1389
|
+
constructor(context: ExecutionContext, config?: Partial<GraphBatchConfig>);
|
|
1390
|
+
/**
|
|
1391
|
+
* Runs the batch process, handling pagination, execution, and accumulation of results.
|
|
1392
|
+
*
|
|
1393
|
+
* @returns The accumulated result of the batch process.
|
|
1394
|
+
*/
|
|
1395
|
+
run(): Promise<void>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Initializes the query builder. This method must be overridden in subclasses.
|
|
1398
|
+
*
|
|
1399
|
+
* @returns A configured GraphQL query builder.
|
|
1400
|
+
*/
|
|
1401
|
+
protected abstract start(): Promise<GraphQLQueryBuilder>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Processes a batch of records and accumulates the result.
|
|
1404
|
+
*
|
|
1405
|
+
* @param records The batch of records retrieved from the query.
|
|
1406
|
+
*/
|
|
1407
|
+
protected abstract execute(records: any[]): Promise<void>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Final cleanup or logging after the batch process completes.
|
|
1410
|
+
*/
|
|
1411
|
+
protected finish(): Promise<void>;
|
|
1412
|
+
/**
|
|
1413
|
+
* Fetches the next page of data based on the pagination strategy.
|
|
1414
|
+
*
|
|
1415
|
+
* @returns The result of the query execution.
|
|
1416
|
+
*/
|
|
1417
|
+
protected fetchNextPage(): Promise<QueryResult>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Checks if the maximum number of batches has been reached.
|
|
1420
|
+
*
|
|
1421
|
+
* @param currentBatchCount The number of batches processed so far.
|
|
1422
|
+
* @returns `true` if the maximum limit is reached, otherwise `false`.
|
|
1423
|
+
*/
|
|
1424
|
+
protected isMaxBatchesReached(currentBatchCount: number): boolean;
|
|
1425
|
+
/**
|
|
1426
|
+
* Delays execution for a specified time.
|
|
1427
|
+
*
|
|
1428
|
+
* @param ms The time in milliseconds to delay.
|
|
1429
|
+
*/
|
|
1430
|
+
protected delay(ms: number): Promise<void>;
|
|
1431
|
+
}
|
|
1432
|
+
export interface ResourceValidationOption {
|
|
1433
|
+
checkAvailability: boolean;
|
|
1434
|
+
checkConflict: boolean;
|
|
1435
|
+
checkTag: boolean;
|
|
1436
|
+
}
|
|
1437
|
+
export declare class ResourceJobValidation {
|
|
1438
|
+
resource: Partial<Resource>;
|
|
1439
|
+
job: Partial<Job>;
|
|
1440
|
+
availableEvent: BaseEvent | null;
|
|
1441
|
+
conflictEvents: BaseEvent[];
|
|
1442
|
+
missingTags: Tag[];
|
|
1443
|
+
constructor(resource: Partial<Resource>, job: Partial<Job>, availableEvent?: BaseEvent | null, conflictEvents?: BaseEvent[], missingTags?: Tag[]);
|
|
1444
|
+
isQualified(option: ResourceValidationOption): boolean;
|
|
1445
|
+
}
|
|
1446
|
+
export declare class ValidationResult {
|
|
1447
|
+
private readonly validations;
|
|
1448
|
+
private readonly option;
|
|
1449
|
+
constructor(validations: ResourceJobValidation[], option: ResourceValidationOption);
|
|
1450
|
+
getQualifiedResources(): Partial<Resource>[];
|
|
1451
|
+
getJobsWithXQualifiedResources(minQualifiedResources: number): Partial<Job>[];
|
|
1452
|
+
getUnqualifiedJobsWithReasons(): ResourceJobValidation[];
|
|
1453
|
+
format(): any[];
|
|
1454
|
+
}
|
|
1455
|
+
export declare class ResourceValidator {
|
|
1456
|
+
private readonly option;
|
|
1457
|
+
constructor(option: ResourceValidationOption);
|
|
1458
|
+
validate(resources: Resource[], jobs: Job[]): ValidationResult;
|
|
1459
|
+
private validateResource;
|
|
1460
|
+
private findAvailableEvent;
|
|
1461
|
+
private findConflictingEvents;
|
|
1462
|
+
private findMissingTags;
|
|
1463
|
+
private prepareData;
|
|
1464
|
+
}
|
|
908
1465
|
|
|
909
1466
|
export {};
|