@skedulo/pulse-solution-services 0.0.5 → 0.0.7
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 -0
- package/README.md +478 -13
- package/dist/clients/artifact-client.js +1 -0
- package/dist/clients/availability-api-client.js +1 -0
- package/dist/clients/base-client.js +1 -1
- package/dist/clients/config-features-client.js +1 -0
- package/dist/clients/config-template-client.js +1 -0
- package/dist/clients/config-var-client.js +1 -1
- package/dist/clients/geo-api-client.js +1 -0
- package/dist/clients/graphql-client.js +1 -1
- package/dist/clients/index.js +1 -1
- package/dist/clients/mobile-notification-client.js +1 -0
- package/dist/clients/org-preference-client.js +1 -0
- package/dist/clients/vocabulary-client.js +1 -0
- package/dist/constants/artifact-constants.js +1 -0
- package/dist/constants/config-var-constants.js +1 -0
- package/dist/constants/http.js +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/mobile-notification-constants.js +1 -0
- package/dist/constants/tenant-endpoints.js +1 -1
- package/dist/constants/tenant-objects.js +1 -1
- package/dist/core/entity-factory.js +1 -0
- package/dist/core/execution-context.js +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/tenant-entities.js +1 -0
- package/dist/core/tenant-objects.js +1 -0
- package/dist/index.d.ts +850 -160
- package/dist/interfaces/artifacts.js +1 -0
- package/dist/interfaces/availability.js +1 -0
- package/dist/interfaces/config-template.js +1 -0
- package/dist/interfaces/geoservice-interfaces.js +1 -0
- package/dist/interfaces/index.js +1 -1
- package/dist/interfaces/mobile-notification.js +1 -0
- package/dist/interfaces/resource-availability.js +1 -0
- package/dist/interfaces/vocabulary.js +1 -0
- package/dist/logging/decorators/log-method.d.ts +2 -2
- package/dist/logging/decorators/log-method.js +1 -1
- package/dist/logging/logger.js +1 -1
- package/dist/logging/logging-utils.js +1 -0
- package/dist/services/cache/storage/config-var-cache-storage.js +1 -1
- package/dist/services/data-service.js +1 -0
- package/dist/services/geoservice.js +1 -0
- package/dist/services/graphql/graphql-query-builder.d.ts +21 -20
- package/dist/services/graphql/graphql-query-builder.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/metadata-service.js +1 -1
- package/dist/services/resource-availability/builder/data-service.d.ts +9 -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/object-factory.d.ts +13 -0
- package/dist/services/resource-availability/object-factory.js +1 -0
- package/dist/services/resource-availability/resource-availability-service.d.ts +7 -0
- package/dist/services/resource-availability/resource-availability-service.js +1 -0
- package/dist/services/resource-availability/resource-builder.d.ts +16 -0
- package/dist/services/resource-availability/resource-builder.js +1 -0
- package/dist/services/resource-availability/resource-query-service.d.ts +7 -0
- package/dist/services/resource-availability/resource-query-service.js +1 -0
- package/dist/services/resource-availability/resource-validator.d.ts +29 -0
- package/dist/services/resource-availability/resource-validator.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/dist/utils/object-utils.js +1 -0
- package/package.json +6 -2
- package/yarn.lock +196 -3
- package/dist/constants/config-var.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export interface PicklistValue {
|
|
|
56
56
|
export interface BaseConfig {
|
|
57
57
|
apiServer: string;
|
|
58
58
|
apiToken: string;
|
|
59
|
+
internalApiToken?: string;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Base client for making API requests with standardized error handling.
|
|
@@ -76,6 +77,13 @@ export declare class BaseClient {
|
|
|
76
77
|
Authorization: string;
|
|
77
78
|
"Content-Type": string;
|
|
78
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;
|
|
79
87
|
/**
|
|
80
88
|
* Performs an API request with standardized error handling using fetch.
|
|
81
89
|
* @template T
|
|
@@ -84,14 +92,16 @@ export declare class BaseClient {
|
|
|
84
92
|
* @param {string} options.endpoint - The API endpoint to call.
|
|
85
93
|
* @param {object} [options.body] - The request body.
|
|
86
94
|
* @param {Record<string, string>} [options.headers] - Additional headers.
|
|
95
|
+
* @param {Record<string, string>} [options.queryParams] - Query parameters.
|
|
87
96
|
* @returns {Promise<T>} - The parsed response data.
|
|
88
97
|
* @throws {Error} - If the request fails or the response is not OK.
|
|
89
98
|
*/
|
|
90
|
-
protected performRequest<T = any>({ method, endpoint, headers, body, }: {
|
|
99
|
+
protected performRequest<T = any>({ method, endpoint, headers, body, queryParams, }: {
|
|
91
100
|
method?: string;
|
|
92
101
|
endpoint: string;
|
|
93
102
|
body?: object;
|
|
94
103
|
headers?: Record<string, string>;
|
|
104
|
+
queryParams?: Record<string, string>;
|
|
95
105
|
}): Promise<T>;
|
|
96
106
|
/**
|
|
97
107
|
* Handles exceptions encountered during API requests.
|
|
@@ -106,19 +116,15 @@ export declare class BaseClient {
|
|
|
106
116
|
export declare class MetadataClient extends BaseClient {
|
|
107
117
|
/**
|
|
108
118
|
* Fetches all metadata mappings from the metadata endpoint.
|
|
109
|
-
* @returns {Promise<
|
|
119
|
+
* @returns {Promise<Metadata[]>} - A promise resolving to an object containing an array of Metadata.
|
|
110
120
|
*/
|
|
111
|
-
fetchAllMetadata(): Promise<
|
|
112
|
-
result: Metadata[];
|
|
113
|
-
}>;
|
|
121
|
+
fetchAllMetadata(): Promise<Metadata[]>;
|
|
114
122
|
/**
|
|
115
123
|
* Fetches metadata for a specific object using its mapping.
|
|
116
124
|
* @param {string} mapping - The API mapping for the object.
|
|
117
|
-
* @returns {Promise<
|
|
125
|
+
* @returns {Promise<ObjectMetadata>} - A promise resolving to an object containing the metadata of the requested object.
|
|
118
126
|
*/
|
|
119
|
-
fetchObjectMetadata(mapping: string): Promise<
|
|
120
|
-
result: ObjectMetadata;
|
|
121
|
-
}>;
|
|
127
|
+
fetchObjectMetadata(mapping: string): Promise<ObjectMetadata>;
|
|
122
128
|
}
|
|
123
129
|
/**
|
|
124
130
|
* MetadataService class to process and filter metadata.
|
|
@@ -141,6 +147,55 @@ export declare class MetadataService {
|
|
|
141
147
|
*/
|
|
142
148
|
getPicklistValues(metadata: ObjectMetadata): Record<string, string[]>;
|
|
143
149
|
}
|
|
150
|
+
export interface ConfigTemplate {
|
|
151
|
+
id?: string;
|
|
152
|
+
name: string;
|
|
153
|
+
schemaName: string;
|
|
154
|
+
}
|
|
155
|
+
export interface ConfigTemplateValue {
|
|
156
|
+
id?: string;
|
|
157
|
+
templateId: string;
|
|
158
|
+
rel: string;
|
|
159
|
+
field: string;
|
|
160
|
+
value: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* ConfigTemplateClient class to handle API requests related to configuration templates.
|
|
164
|
+
* Extends BaseClient to perform API operations.
|
|
165
|
+
*/
|
|
166
|
+
export declare class ConfigTemplateClient extends BaseClient {
|
|
167
|
+
/**
|
|
168
|
+
* Fetches configuration templates for a given object type.
|
|
169
|
+
* @param {string} objectName - The object name (e.g., "Jobs").
|
|
170
|
+
* @returns {Promise<ConfigTemplate[]>} - A promise resolving to an array of configuration templates.
|
|
171
|
+
*/
|
|
172
|
+
get(objectName: string): Promise<ConfigTemplate[]>;
|
|
173
|
+
/**
|
|
174
|
+
* Fetches configuration template values by template ID.
|
|
175
|
+
* @param {string} templateId - The template ID.
|
|
176
|
+
* @returns {Promise<any[]>} - A promise resolving to an array of configuration values.
|
|
177
|
+
*/
|
|
178
|
+
getTemmplateValues(templateId: string): Promise<any[]>;
|
|
179
|
+
/**
|
|
180
|
+
* Updates or Inserts configuration template values.
|
|
181
|
+
* @param {string} templateId - The template ID.
|
|
182
|
+
* @param {ConfigTemplateValue[]} values - The values to update.
|
|
183
|
+
* @returns {Promise<any>} - A promise resolving when the update is complete.
|
|
184
|
+
*/
|
|
185
|
+
upsertTemplateValues(templateId: string, values: ConfigTemplateValue[]): Promise<any>;
|
|
186
|
+
/**
|
|
187
|
+
* Deletes a configuration template.
|
|
188
|
+
* @param {string} templateId - The template ID.
|
|
189
|
+
* @returns {Promise<any>} - A promise resolving when the deletion is complete.
|
|
190
|
+
*/
|
|
191
|
+
delete(templateId: string): Promise<any>;
|
|
192
|
+
/**
|
|
193
|
+
* Deploys a configuration template.
|
|
194
|
+
* @param {ConfigTemplate} template - The template to deploy.
|
|
195
|
+
* @returns {Promise<any>} - A promise resolving when the deployment is complete.
|
|
196
|
+
*/
|
|
197
|
+
create(template: ConfigTemplate): Promise<any>;
|
|
198
|
+
}
|
|
144
199
|
export interface ConfigVar {
|
|
145
200
|
key?: string;
|
|
146
201
|
configType: string;
|
|
@@ -209,8 +264,8 @@ export interface QueryResult {
|
|
|
209
264
|
records: HasId[];
|
|
210
265
|
totalCount: number;
|
|
211
266
|
pageInfo: any;
|
|
212
|
-
endCursor
|
|
213
|
-
endOffset
|
|
267
|
+
endCursor: string;
|
|
268
|
+
endOffset: number;
|
|
214
269
|
}
|
|
215
270
|
export interface MutationResult {
|
|
216
271
|
data: {
|
|
@@ -232,22 +287,71 @@ export declare class GraphQLClient extends BaseClient {
|
|
|
232
287
|
*/
|
|
233
288
|
execute(graphqlQuery: string): Promise<GraphQlResponse>;
|
|
234
289
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
export declare
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
+
export declare enum ArtifactType {
|
|
308
|
+
CUSTOM_OBJECT = "custom-object",
|
|
309
|
+
CUSTOM_FIELD = "custom-field",
|
|
310
|
+
FUNCTION = "function",
|
|
311
|
+
MOBILE_EXTENSION = "mobile-extension",
|
|
312
|
+
PUBLIC_PAGE = "public-page",
|
|
313
|
+
TRIGGERED_ACTION = "triggered-action",
|
|
314
|
+
USER_ROLE = "user-role",
|
|
315
|
+
WEBHOOK = "webhook",
|
|
316
|
+
HORIZON_CUSTOM_RESOURCE = "horizon-custom-resource",
|
|
317
|
+
HORIZON_PAGE = "horizon-page",
|
|
318
|
+
HORIZON_TEMPLATE = "horizon-template",
|
|
319
|
+
HORIZON_TENANT_CONFIG = "horizon-tenant-config",
|
|
320
|
+
HORIZON_COMPONENT_BUNDLE = "horizon-component-bundle",
|
|
321
|
+
HORIZON_VIEW_TYPE = "horizon-view-type",
|
|
322
|
+
HORIZON_CUSTOM_ACTION = "horizon-custom-action",
|
|
323
|
+
HORIZON_VIEW_STATE = "horizon-view-state",
|
|
324
|
+
HORIZON_DATA_FIELD_OVERLAY = "horizon-data-field-overlay",
|
|
325
|
+
HORIZON_DATA_RELATIONSHIP_OVERLAY = "horizon-data-relationship-overlay",
|
|
326
|
+
HORIZON_LIST_CONFIG = "horizon-list-config",
|
|
327
|
+
HORIZON_LIST_VIEW_STATE = "horizon-list-view-state"
|
|
328
|
+
}
|
|
329
|
+
export declare enum ConfigVariableType {
|
|
330
|
+
PLAIN_TEXT = "plain-text",
|
|
331
|
+
SECRET = "secret"
|
|
332
|
+
}
|
|
333
|
+
export declare enum ConfigVariableStatus {
|
|
334
|
+
ACTIVE = "active",
|
|
335
|
+
INACTIVE = "inactive",
|
|
336
|
+
EXPIRED = "expired"
|
|
337
|
+
}
|
|
338
|
+
export declare enum HttpMethod {
|
|
339
|
+
GET = "GET",
|
|
340
|
+
POST = "POST",
|
|
341
|
+
PUT = "PUT",
|
|
342
|
+
DELETE = "DELETE",
|
|
343
|
+
PATCH = "PATCH"
|
|
344
|
+
}
|
|
345
|
+
export declare enum NotificationTemplate {
|
|
346
|
+
JOB_DISPATCH = "job_dispatch",
|
|
347
|
+
JOB_REMINDER = "job_reminder",
|
|
348
|
+
JOB_CANCELLED = "job_cancelled",
|
|
349
|
+
JOB_OFFER = "job_offer"
|
|
350
|
+
}
|
|
351
|
+
export declare enum NotificationType {
|
|
352
|
+
SMS = "sms",
|
|
353
|
+
PUSH = "push"
|
|
354
|
+
}
|
|
251
355
|
export declare const TENANT_ENDPOINTS: {
|
|
252
356
|
readonly CONFIG_VAR: {
|
|
253
357
|
readonly CREATE: "configuration/extension";
|
|
@@ -261,82 +365,465 @@ export declare const TENANT_ENDPOINTS: {
|
|
|
261
365
|
readonly ALL: "custom/metadata";
|
|
262
366
|
readonly OBJECT: (objectMapping: string) => string;
|
|
263
367
|
};
|
|
368
|
+
readonly ORG_PREFERENCE: {
|
|
369
|
+
readonly GET: "config/org_preference";
|
|
370
|
+
readonly UPDATE: "config/org_preference";
|
|
371
|
+
};
|
|
372
|
+
readonly CONFIG_TEMPLATE: {
|
|
373
|
+
readonly GET_TEMPLATES: (objectName: string) => string;
|
|
374
|
+
readonly GET_VALUES: (templateId: string) => string;
|
|
375
|
+
readonly UPDATE_VALUES: (templateId: string) => string;
|
|
376
|
+
readonly CREATE: "config/template";
|
|
377
|
+
readonly DELETE: (templateId: string) => string;
|
|
378
|
+
};
|
|
379
|
+
readonly CONFIG_FEATURES: {
|
|
380
|
+
readonly GET: "config/features";
|
|
381
|
+
readonly UPDATE: (tenantId: string) => string;
|
|
382
|
+
};
|
|
383
|
+
readonly VOCABULARY: {
|
|
384
|
+
readonly GET_ITEMS: (schemaName: string, fieldName: string) => string;
|
|
385
|
+
readonly ADD_ITEM: (schemaName: string, fieldName: string) => string;
|
|
386
|
+
readonly UPDATE_ITEM: (schemaName: string, fieldName: string, value: string) => string;
|
|
387
|
+
};
|
|
388
|
+
readonly NOTIFICATIONS: {
|
|
389
|
+
readonly GET_TEMPLATES: "notifications/v2/templates";
|
|
390
|
+
readonly DELETE_TEMPLATE: (template: string, templateType: string) => string;
|
|
391
|
+
readonly SET_TEMPLATE: (type: string, protocol: string) => string;
|
|
392
|
+
readonly DISPATCH: "notifications/dispatch";
|
|
393
|
+
readonly NOTIFY: "notifications/notify";
|
|
394
|
+
readonly NOTIFY_CANCEL: "notifications/notify_cancel";
|
|
395
|
+
readonly ONE_OFF: "notifications/oneoff";
|
|
396
|
+
readonly SEND_SMS: "notifications/sms";
|
|
397
|
+
readonly SMS_CONFIRMATION_REQUEST: "notifications/sms/confirmation_request";
|
|
398
|
+
};
|
|
399
|
+
readonly GEOSERVICES: {
|
|
400
|
+
readonly DISTANCE_MATRIX: "geoservices/distanceMatrix";
|
|
401
|
+
readonly DIRECTIONS: "geoservices/directions";
|
|
402
|
+
readonly GEOCODE: "geoservices/geocode";
|
|
403
|
+
readonly AUTOCOMPLETE: "geoservices/autocomplete";
|
|
404
|
+
readonly PLACE: "geoservices/place";
|
|
405
|
+
readonly TIMEZONE: "geoservices/timezone";
|
|
406
|
+
};
|
|
407
|
+
readonly AVAILABILITY: {
|
|
408
|
+
readonly SIMPLE: "availability/simple";
|
|
409
|
+
};
|
|
264
410
|
};
|
|
265
|
-
export
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
411
|
+
export interface LatLng {
|
|
412
|
+
lat: number;
|
|
413
|
+
lng: number;
|
|
414
|
+
}
|
|
415
|
+
export interface DistanceMatrixRequest {
|
|
416
|
+
origins: LatLng[];
|
|
417
|
+
destinations: LatLng[];
|
|
418
|
+
avoid?: ("ferry" | "highway" | "toll")[];
|
|
419
|
+
departureTime?: string;
|
|
420
|
+
}
|
|
421
|
+
export interface DistanceMatrixResponse {
|
|
422
|
+
matrix: DistanceMatrixEntry[][];
|
|
423
|
+
vendor: string;
|
|
424
|
+
}
|
|
425
|
+
export interface DistanceMatrixEntry {
|
|
426
|
+
status: "OK" | "NO_ROUTE";
|
|
427
|
+
duration?: {
|
|
428
|
+
durationInSeconds: number;
|
|
429
|
+
};
|
|
430
|
+
distance?: {
|
|
431
|
+
distanceInMeters: number;
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
export interface DirectionsRequest {
|
|
435
|
+
requests: {
|
|
436
|
+
origin: LatLng;
|
|
437
|
+
destination: LatLng;
|
|
438
|
+
waypoints?: LatLng[];
|
|
439
|
+
avoid?: ("ferry" | "highway" | "toll")[];
|
|
440
|
+
}[];
|
|
441
|
+
}
|
|
442
|
+
export interface DirectionsResponse {
|
|
443
|
+
routes: {
|
|
444
|
+
leg: {
|
|
445
|
+
origin: LatLng;
|
|
446
|
+
destination: LatLng;
|
|
447
|
+
};
|
|
448
|
+
travelInfo: {
|
|
449
|
+
status: "OK" | "NO_ROUTE";
|
|
450
|
+
duration: {
|
|
451
|
+
durationInSeconds: number;
|
|
452
|
+
};
|
|
453
|
+
distance: {
|
|
454
|
+
distanceInMeters: number;
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
}[];
|
|
458
|
+
}
|
|
459
|
+
export interface GeocodeRequest {
|
|
460
|
+
addresses: string[];
|
|
461
|
+
language?: string;
|
|
462
|
+
responseType?: "allMatches";
|
|
463
|
+
}
|
|
464
|
+
export interface GeocodeResponse {
|
|
465
|
+
result: {
|
|
466
|
+
address: string;
|
|
467
|
+
latLng: LatLng;
|
|
468
|
+
granularity?: string;
|
|
469
|
+
}[];
|
|
470
|
+
}
|
|
471
|
+
export interface AutocompleteRequest {
|
|
472
|
+
input: string;
|
|
473
|
+
sessionId?: string;
|
|
474
|
+
location?: LatLng;
|
|
475
|
+
radius?: number;
|
|
476
|
+
country?: string;
|
|
477
|
+
}
|
|
478
|
+
export interface AutocompleteResponse {
|
|
479
|
+
predictions: {
|
|
480
|
+
description: string;
|
|
481
|
+
placeId: string;
|
|
482
|
+
}[];
|
|
483
|
+
status: "OK" | "ZERO_RESULTS";
|
|
484
|
+
errorMessage?: string;
|
|
485
|
+
}
|
|
486
|
+
export interface PlaceRequest {
|
|
487
|
+
placeId: string;
|
|
488
|
+
sessionId: string;
|
|
489
|
+
}
|
|
490
|
+
export interface PlaceResponse {
|
|
491
|
+
addressComponents: {
|
|
492
|
+
streetNumber: string;
|
|
493
|
+
route: string;
|
|
494
|
+
localCity: string;
|
|
495
|
+
area2: string;
|
|
496
|
+
area1: string;
|
|
497
|
+
country: string;
|
|
498
|
+
postalCode: string;
|
|
499
|
+
};
|
|
500
|
+
formattedAddress: string;
|
|
501
|
+
geometry: LatLng;
|
|
502
|
+
}
|
|
503
|
+
export interface TimezoneRequest {
|
|
504
|
+
location: [
|
|
505
|
+
number,
|
|
506
|
+
number
|
|
507
|
+
];
|
|
508
|
+
timestamp: number;
|
|
509
|
+
}
|
|
510
|
+
export interface TimezoneResponse {
|
|
511
|
+
dstOffset: number;
|
|
512
|
+
rawOffset: number;
|
|
513
|
+
timeZoneId: string;
|
|
514
|
+
}
|
|
515
|
+
export interface BaseObject {
|
|
516
|
+
id: string;
|
|
517
|
+
name: string;
|
|
518
|
+
propertyMap?: Record<string, any>;
|
|
519
|
+
}
|
|
520
|
+
export interface BaseEvent extends BaseObject {
|
|
521
|
+
start: Date;
|
|
522
|
+
finish: Date;
|
|
523
|
+
eventType?: string;
|
|
524
|
+
description?: string;
|
|
525
|
+
geoLocation?: LatLng;
|
|
526
|
+
}
|
|
527
|
+
export interface Resource extends BaseObject {
|
|
528
|
+
category?: string;
|
|
529
|
+
employmentType?: string;
|
|
530
|
+
resourceType?: string;
|
|
531
|
+
userId?: string;
|
|
532
|
+
regionId?: string;
|
|
533
|
+
timezone: string;
|
|
534
|
+
tags: Tag[];
|
|
535
|
+
availabilities: BaseEvent[];
|
|
536
|
+
events: BaseEvent[];
|
|
537
|
+
}
|
|
538
|
+
export interface Tag extends BaseObject {
|
|
539
|
+
}
|
|
540
|
+
export interface Availability extends BaseEvent {
|
|
541
|
+
resourceId: string;
|
|
542
|
+
isAvailable: boolean;
|
|
543
|
+
status: string;
|
|
544
|
+
availabilityType: string;
|
|
545
|
+
}
|
|
546
|
+
export interface Activity extends BaseEvent {
|
|
547
|
+
resourceId: string;
|
|
548
|
+
activityType: string;
|
|
549
|
+
}
|
|
550
|
+
export interface JobAllocation extends BaseEvent {
|
|
551
|
+
jobId: string;
|
|
552
|
+
resourceId: string;
|
|
553
|
+
status: string;
|
|
554
|
+
}
|
|
555
|
+
export interface Job extends BaseEvent {
|
|
556
|
+
address: string;
|
|
557
|
+
contactId: string;
|
|
558
|
+
jobStatus: string;
|
|
559
|
+
regionId: string;
|
|
560
|
+
tags: Tag[];
|
|
561
|
+
}
|
|
562
|
+
export interface ResourceShift extends BaseEvent {
|
|
563
|
+
resourceId: string;
|
|
564
|
+
shift: Shift;
|
|
565
|
+
}
|
|
566
|
+
export interface Shift extends BaseEvent {
|
|
567
|
+
regionId: string;
|
|
568
|
+
displayName: string;
|
|
569
|
+
isDraft: boolean;
|
|
570
|
+
}
|
|
571
|
+
export declare class EntityFactory {
|
|
572
|
+
static createBaseObject(data: Record<string, string>): BaseObject;
|
|
573
|
+
static createBaseEvent(data: Record<string, string>): BaseEvent;
|
|
574
|
+
static createTag(data: Record<string, any>): Tag;
|
|
575
|
+
static createResource(data: Record<string, any>): Resource;
|
|
576
|
+
static createJob(data: Record<string, any>): Job;
|
|
577
|
+
static createAvailability(data: Record<string, any>): Availability;
|
|
578
|
+
static createActivity(data: Record<string, any>): Activity;
|
|
579
|
+
static createJobAllocation(data: Record<string, any>): JobAllocation;
|
|
580
|
+
static createResourceShift(data: Record<string, any>): ResourceShift;
|
|
581
|
+
static createShift(data: Record<string, any>): Shift;
|
|
582
|
+
}
|
|
583
|
+
export type ArtifactParams = {
|
|
584
|
+
objectName?: string;
|
|
585
|
+
viewTypeName?: string;
|
|
586
|
+
name?: string;
|
|
587
|
+
scope?: string;
|
|
285
588
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
589
|
+
declare class ArtifactClient extends BaseClient {
|
|
590
|
+
private artifactType;
|
|
591
|
+
private baseEndpoint;
|
|
592
|
+
constructor(config: any, artifactType: ArtifactType);
|
|
593
|
+
list<T>(): Promise<T[]>;
|
|
594
|
+
get<T>(params?: ArtifactParams): Promise<T>;
|
|
595
|
+
create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
|
|
596
|
+
update<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
|
|
597
|
+
delete(params: ArtifactParams): Promise<void>;
|
|
598
|
+
private buildEndpoint;
|
|
599
|
+
}
|
|
600
|
+
export interface AvailabilityRequestParams {
|
|
601
|
+
/**
|
|
602
|
+
* Array of resource IDs for which availability is requested.
|
|
603
|
+
* Must contain at least one and at most 200 resource IDs.
|
|
604
|
+
*/
|
|
605
|
+
resourceIds: string[];
|
|
606
|
+
/**
|
|
607
|
+
* The UTC datetime from which to start fetching availability (ISO 8601 format).
|
|
608
|
+
*/
|
|
609
|
+
start: string;
|
|
610
|
+
/**
|
|
611
|
+
* The UTC datetime until which to fetch availability (ISO 8601 format).
|
|
612
|
+
* Must be after start and within 375 days.
|
|
613
|
+
*/
|
|
614
|
+
end: string;
|
|
615
|
+
/**
|
|
616
|
+
* If true, merged availability time intervals are returned in the response.
|
|
617
|
+
* Defaults to false.
|
|
618
|
+
*/
|
|
619
|
+
mergedAvailabilities?: boolean;
|
|
620
|
+
/**
|
|
621
|
+
* If true (or omitted), a list of availability entries is returned.
|
|
622
|
+
* Defaults to true.
|
|
623
|
+
*/
|
|
624
|
+
entries?: boolean;
|
|
625
|
+
}
|
|
626
|
+
export interface AvailabilityResult {
|
|
627
|
+
resourceId: string;
|
|
628
|
+
mergedAvailabilities?: {
|
|
629
|
+
start: string;
|
|
630
|
+
end: string;
|
|
301
631
|
}[];
|
|
632
|
+
entries?: AvailabilityEntry[];
|
|
633
|
+
}
|
|
634
|
+
export interface AvailabilityEntry {
|
|
635
|
+
type: "template" | "pattern" | "override" | "holiday";
|
|
636
|
+
start: string;
|
|
637
|
+
end: string;
|
|
638
|
+
available: boolean;
|
|
639
|
+
templateEntryId?: string;
|
|
640
|
+
name?: string;
|
|
641
|
+
patternId?: string;
|
|
642
|
+
patternRecordId?: string;
|
|
643
|
+
}
|
|
644
|
+
declare class AvailabilityAPIClient extends BaseClient {
|
|
302
645
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
646
|
+
* Fetches resource availability based on the given request parameters.
|
|
647
|
+
* @param {AvailabilityRequestParams} params - The request parameters for availability.
|
|
648
|
+
* @returns {Promise<AvailabilityResult[]>} - The availability data for the requested resources.
|
|
305
649
|
*/
|
|
306
|
-
|
|
650
|
+
fetchAvailability(params: AvailabilityRequestParams): Promise<AvailabilityResult[]>;
|
|
651
|
+
}
|
|
652
|
+
declare class ConfigFeaturesClient extends BaseClient {
|
|
307
653
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* @param message - The message to log.
|
|
654
|
+
* Fetches feature flags configuration.
|
|
655
|
+
* @returns {Promise<Record<string, any>>} - A promise resolving to the sorted feature flags in JSON string format.
|
|
311
656
|
*/
|
|
312
|
-
|
|
657
|
+
get(): Promise<Record<string, any>>;
|
|
313
658
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* @
|
|
659
|
+
* Deploys feature flags configuration.
|
|
660
|
+
* @param {string} newConfig - The new configuration to be deployed.
|
|
661
|
+
* @returns {Promise<Record<string, any>>} - A promise resolving when the configuration is successfully deployed.
|
|
317
662
|
*/
|
|
318
|
-
|
|
663
|
+
update(tenantId: string, newConfig: Record<string, any>): Promise<Record<string, any>>;
|
|
664
|
+
}
|
|
665
|
+
declare class GeoAPIClient extends BaseClient {
|
|
319
666
|
/**
|
|
320
|
-
*
|
|
321
|
-
|
|
322
|
-
|
|
667
|
+
* Computes travel distance and time for all combinations of origin and destination locations.
|
|
668
|
+
*/
|
|
669
|
+
getDistanceMatrix(data: DistanceMatrixRequest): Promise<DistanceMatrixResponse>;
|
|
670
|
+
/**
|
|
671
|
+
* Calculates directions between source and destination addresses, possibly including waypoints en route.
|
|
672
|
+
*/
|
|
673
|
+
getDirections(data: DirectionsRequest): Promise<DirectionsResponse>;
|
|
674
|
+
/**
|
|
675
|
+
* Geocodes a given list of addresses and returns their latitude and longitude coordinates.
|
|
323
676
|
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
677
|
+
geocodeAddress(data: GeocodeRequest): Promise<GeocodeResponse>;
|
|
678
|
+
/**
|
|
679
|
+
* Provides address autocomplete suggestions based on an input string.
|
|
680
|
+
*/
|
|
681
|
+
autocompleteAddress(data: AutocompleteRequest): Promise<AutocompleteResponse>;
|
|
682
|
+
/**
|
|
683
|
+
* Fetches detailed information for a given place ID.
|
|
684
|
+
*/
|
|
685
|
+
getPlaceDetails(data: PlaceRequest): Promise<PlaceResponse>;
|
|
686
|
+
/**
|
|
687
|
+
* Retrieves timezone information for a given location and timestamp.
|
|
688
|
+
*/
|
|
689
|
+
getTimezone(data: TimezoneRequest): Promise<TimezoneResponse>;
|
|
690
|
+
}
|
|
691
|
+
export interface JobRequest {
|
|
692
|
+
jobId: string;
|
|
693
|
+
}
|
|
694
|
+
export interface NotifyRequest extends JobRequest {
|
|
695
|
+
resourceId?: string;
|
|
696
|
+
resourceIds?: string[];
|
|
697
|
+
}
|
|
698
|
+
export interface OneOffRequest {
|
|
699
|
+
resourceId: string;
|
|
700
|
+
message: string;
|
|
701
|
+
protocol?: NotificationType;
|
|
702
|
+
}
|
|
703
|
+
export interface DispatchResponse {
|
|
704
|
+
jobId: string;
|
|
705
|
+
results: {
|
|
706
|
+
resourceId: string;
|
|
707
|
+
protocol: string;
|
|
708
|
+
error?: {
|
|
709
|
+
errorType: string;
|
|
710
|
+
message: string;
|
|
711
|
+
};
|
|
327
712
|
}[];
|
|
713
|
+
}
|
|
714
|
+
export interface NotifyResponse extends DispatchResponse {
|
|
715
|
+
}
|
|
716
|
+
export interface NotifyCancelResponse extends DispatchResponse {
|
|
717
|
+
}
|
|
718
|
+
export interface OneOffResponse {
|
|
719
|
+
protocol: NotificationType;
|
|
720
|
+
}
|
|
721
|
+
export interface SendSmsRequest {
|
|
722
|
+
phoneNumber: string;
|
|
723
|
+
countryCode: string;
|
|
724
|
+
message: string;
|
|
725
|
+
expectsReply?: boolean;
|
|
726
|
+
}
|
|
727
|
+
export interface SmsConfirmationRequest extends JobRequest {
|
|
728
|
+
phoneNumber: string;
|
|
729
|
+
countryCode: string;
|
|
730
|
+
message: string;
|
|
731
|
+
}
|
|
732
|
+
export interface SmsResponse {
|
|
733
|
+
success: boolean;
|
|
734
|
+
}
|
|
735
|
+
declare class MobileNotificationClient extends BaseClient {
|
|
328
736
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
|
|
332
|
-
|
|
737
|
+
* Fetches all mobile notification templates from the API.
|
|
738
|
+
* @returns {Promise<any>} - An array of mobile notification templates.
|
|
739
|
+
*/
|
|
740
|
+
getTemplates(): Promise<any>;
|
|
741
|
+
/**
|
|
742
|
+
* Deletes a specific mobile notification template.
|
|
743
|
+
* @param {NotificationTemplate} template - The notification template name.
|
|
744
|
+
* @param {NotificationType} notificationType - The type of the notification (e.g., sms, push).
|
|
745
|
+
*/
|
|
746
|
+
deleteTemplate(template: NotificationTemplate, notificationType: NotificationType): Promise<void>;
|
|
747
|
+
/**
|
|
748
|
+
* Creates or updates a mobile notification template.
|
|
749
|
+
* @param {NotificationTemplate} type - The notification type.
|
|
750
|
+
* @param {NotificationType} protocol - The notification protocol (e.g., sms, push).
|
|
751
|
+
* @param {string} text - The template content.
|
|
752
|
+
*/
|
|
753
|
+
setTemplate(template: NotificationTemplate, protocol: NotificationType, text: string): Promise<void>;
|
|
754
|
+
/**
|
|
755
|
+
* Dispatch resources and notify them.
|
|
756
|
+
* @param {NotifyRequest} request - The dispatch request payload.
|
|
757
|
+
* @returns {Promise<DispatchResponse>} - The API response.
|
|
758
|
+
*/
|
|
759
|
+
dispatchResources(request: NotifyRequest): Promise<DispatchResponse>;
|
|
760
|
+
/**
|
|
761
|
+
* Notify resources about an allocated job.
|
|
762
|
+
* @param {NotifyRequest} request - The notification request payload.
|
|
763
|
+
* @returns {Promise<NotifyResponse>} - The API response.
|
|
333
764
|
*/
|
|
334
|
-
|
|
765
|
+
notifyAllocatedResources(request: NotifyRequest): Promise<NotifyResponse>;
|
|
335
766
|
/**
|
|
336
|
-
*
|
|
767
|
+
* Notify resources of job cancellation.
|
|
768
|
+
* @param {JobRequest} request - The job cancellation notification payload.
|
|
769
|
+
* @returns {Promise<NotifyCancelResponse>} - The API response.
|
|
337
770
|
*/
|
|
338
|
-
|
|
771
|
+
notifyJobCancellation(request: JobRequest): Promise<NotifyCancelResponse>;
|
|
772
|
+
/**
|
|
773
|
+
* Send a message to a resource via push notification or SMS.
|
|
774
|
+
* @param {OneOffRequest} request - The one-off message request payload.
|
|
775
|
+
* @returns {Promise<OneOffResponse>} - The API response.
|
|
776
|
+
*/
|
|
777
|
+
sendOneOffMessage(request: OneOffRequest): Promise<OneOffResponse>;
|
|
778
|
+
/**
|
|
779
|
+
* Send an SMS to any phone number.
|
|
780
|
+
* @param {SendSmsRequest} request - The SMS request payload.
|
|
781
|
+
* @returns {Promise<SmsResponse>} - The API response.
|
|
782
|
+
*/
|
|
783
|
+
sendSms(request: SendSmsRequest): Promise<SmsResponse>;
|
|
784
|
+
/**
|
|
785
|
+
* Request confirmation by SMS.
|
|
786
|
+
* @param {SmsConfirmationRequest} request - The SMS confirmation request payload.
|
|
787
|
+
* @returns {Promise<SmsResponse>} - The API response.
|
|
788
|
+
*/
|
|
789
|
+
requestSmsConfirmation(request: SmsConfirmationRequest): Promise<SmsResponse>;
|
|
339
790
|
}
|
|
791
|
+
export interface VocabularyItem {
|
|
792
|
+
value: string;
|
|
793
|
+
label: string;
|
|
794
|
+
active?: boolean;
|
|
795
|
+
defaultValue?: boolean;
|
|
796
|
+
description?: string;
|
|
797
|
+
createdAt?: string;
|
|
798
|
+
updatedAt?: string;
|
|
799
|
+
}
|
|
800
|
+
declare class VocabularyClient extends BaseClient {
|
|
801
|
+
/**
|
|
802
|
+
* Fetches vocabulary items for a specific field in a schema.
|
|
803
|
+
* @param {string} schemaName - The schema name.
|
|
804
|
+
* @param {string} fieldName - The field name.
|
|
805
|
+
* @returns {Promise<VocabularyItem[]>} - A promise resolving to an array of vocabulary items.
|
|
806
|
+
*/
|
|
807
|
+
getVocabularyItems(schemaName: string, fieldName: string): Promise<VocabularyItem[]>;
|
|
808
|
+
/**
|
|
809
|
+
* Adds a new vocabulary item to a field in a schema.
|
|
810
|
+
* @param {string} schemaName - The schema name.
|
|
811
|
+
* @param {string} fieldName - The field name.
|
|
812
|
+
* @param {VocabularyItem} item - The vocabulary item to add.
|
|
813
|
+
* @returns {Promise<VocabularyItem>} - A promise resolving to the created vocabulary item.
|
|
814
|
+
*/
|
|
815
|
+
addVocabularyItem(schemaName: string, fieldName: string, item: VocabularyItem): Promise<VocabularyItem>;
|
|
816
|
+
/**
|
|
817
|
+
* Updates an existing vocabulary item in a field of a schema.
|
|
818
|
+
* @param {string} schemaName - The schema name.
|
|
819
|
+
* @param {string} fieldName - The field name.
|
|
820
|
+
* @param {string} value - The vocabulary item's value.
|
|
821
|
+
* @param {VocabularyItem} item - The updated vocabulary item.
|
|
822
|
+
* @returns {Promise<VocabularyItem>} - A promise resolving to the updated vocabulary item.
|
|
823
|
+
*/
|
|
824
|
+
updateVocabularyItem(schemaName: string, fieldName: string, value: string, item: VocabularyItem): Promise<VocabularyItem>;
|
|
825
|
+
}
|
|
826
|
+
declare const logger: import("winston").Logger;
|
|
340
827
|
export declare class CacheService<T> {
|
|
341
828
|
private storage;
|
|
342
829
|
private secondaryCache?;
|
|
@@ -407,6 +894,87 @@ export interface CacheOptions<T> {
|
|
|
407
894
|
ttl?: number;
|
|
408
895
|
useSecondaryCache?: boolean;
|
|
409
896
|
}
|
|
897
|
+
declare class GeoService {
|
|
898
|
+
private geoAPIClient;
|
|
899
|
+
private sessionId;
|
|
900
|
+
constructor(geoAPIClient: GeoAPIClient);
|
|
901
|
+
/**
|
|
902
|
+
* Gets distance matrix and returns a structured result map.
|
|
903
|
+
*/
|
|
904
|
+
getDistanceMatrix(origins: LatLng[], destinations: LatLng[]): Promise<Map<string, any>>;
|
|
905
|
+
/**
|
|
906
|
+
* Fetches address suggestions and automatically retrieves place details for the first result.
|
|
907
|
+
*/
|
|
908
|
+
getAddressSuggestions(request: AutocompleteRequest, maxResults?: number): Promise<PlaceResponse[] | null>;
|
|
909
|
+
/**
|
|
910
|
+
* Gets timezone information for a given location.
|
|
911
|
+
*/
|
|
912
|
+
getTimezone(data: TimezoneRequest): Promise<string>;
|
|
913
|
+
/**
|
|
914
|
+
* Generates a new session ID.
|
|
915
|
+
*/
|
|
916
|
+
generateNewSessionId(): string;
|
|
917
|
+
/**
|
|
918
|
+
* Strips trailing zeros from latitude and longitude values.
|
|
919
|
+
*
|
|
920
|
+
* This is necessary because some systems, like Salesforce, may automatically remove trailing zeros
|
|
921
|
+
* when storing or processing geolocation values. If we use raw geocodes (e.g., -78.729880, 35.897187),
|
|
922
|
+
* they might be altered to -78.72988, 35.897187 when retrieved later.
|
|
923
|
+
*
|
|
924
|
+
* Since the Distance Matrix API uses the exact string representation of coordinates as keys for caching
|
|
925
|
+
* and lookup, a mismatch due to trailing zeros can cause unexpected errors or failed lookups.
|
|
926
|
+
* Removing trailing zeros ensures consistency in coordinate representation and prevents key mismatches.
|
|
927
|
+
*/
|
|
928
|
+
stripTrailingZeros(value: number): string;
|
|
929
|
+
/**
|
|
930
|
+
* Creates a unique key for origin and destination pair, ensuring stripped trailing zeros.
|
|
931
|
+
*/
|
|
932
|
+
createKey(origin: LatLng, destination: LatLng): string;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* A service class for handling GraphQL operations.
|
|
936
|
+
*/
|
|
937
|
+
export declare class GraphQLService {
|
|
938
|
+
private client;
|
|
939
|
+
/**
|
|
940
|
+
* Creates an instance of GraphQLService.
|
|
941
|
+
* @param {GraphQLClient} client - The GraphQL client to use for queries and mutations.
|
|
942
|
+
*/
|
|
943
|
+
constructor(client: GraphQLClient);
|
|
944
|
+
/**
|
|
945
|
+
* Executes a GraphQL query to fetch records.
|
|
946
|
+
* @param {FetchRecordsQueryParams} params - The query parameters.
|
|
947
|
+
* @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
|
|
948
|
+
*/
|
|
949
|
+
query(params: FetchRecordsQueryParams): Promise<QueryResult>;
|
|
950
|
+
/**
|
|
951
|
+
* Deletes records from the GraphQL API.
|
|
952
|
+
* @param {string} objectName - The name of the object.
|
|
953
|
+
* @param {HasId[]} records - The records to delete.
|
|
954
|
+
* @returns {Promise<any>} - The response from the delete operation.
|
|
955
|
+
*/
|
|
956
|
+
delete(objectName: string, records: HasId[]): Promise<any>;
|
|
957
|
+
/**
|
|
958
|
+
* 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
|
+
*/
|
|
963
|
+
update(objectName: string, records: HasId[]): Promise<any>;
|
|
964
|
+
/**
|
|
965
|
+
* 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
|
+
*/
|
|
970
|
+
insert(objectName: string, records: HasId[]): Promise<any>;
|
|
971
|
+
/**
|
|
972
|
+
* Extracts job UIDs from a GraphQL mutation response.
|
|
973
|
+
* @param {MutationResult} response - The response object.
|
|
974
|
+
* @returns {string[]} - An array of job UIDs.
|
|
975
|
+
*/
|
|
976
|
+
extractJobUIDs(response: MutationResult): string[];
|
|
977
|
+
}
|
|
410
978
|
/**
|
|
411
979
|
* A utility class for building GraphQL queries dynamically.
|
|
412
980
|
*/
|
|
@@ -421,6 +989,7 @@ export declare class GraphQLQueryBuilder {
|
|
|
421
989
|
private parentQueries;
|
|
422
990
|
private childQueries;
|
|
423
991
|
private isParent;
|
|
992
|
+
private graphqlService;
|
|
424
993
|
/**
|
|
425
994
|
* Creates an instance of GraphQLQueryBuilder.
|
|
426
995
|
* @param {string} objectName - The name of the object being queried.
|
|
@@ -428,102 +997,105 @@ export declare class GraphQLQueryBuilder {
|
|
|
428
997
|
*/
|
|
429
998
|
constructor(objectName: string, isParent?: boolean);
|
|
430
999
|
/**
|
|
431
|
-
*
|
|
432
|
-
|
|
433
|
-
|
|
1000
|
+
* Sets the GraphQL service to use for executing the query.
|
|
1001
|
+
*/
|
|
1002
|
+
setGraphqlService(graphqlService: GraphQLService): void;
|
|
1003
|
+
/**
|
|
1004
|
+
* Specifies the fields to be retrieved. Prevents duplicates.
|
|
434
1005
|
*/
|
|
435
1006
|
withFields(fields: string[]): this;
|
|
436
1007
|
/**
|
|
437
1008
|
* Adds a filter condition to the query.
|
|
438
|
-
* @param {string} condition - The filter condition.
|
|
439
|
-
* @returns {this} - The query builder instance.
|
|
440
1009
|
*/
|
|
441
1010
|
withFilter(condition: string): this;
|
|
442
1011
|
/**
|
|
443
1012
|
* Sets a limit on the number of records to retrieve.
|
|
444
|
-
* @param {number} first - The number of records to fetch.
|
|
445
|
-
* @returns {this} - The query builder instance.
|
|
446
1013
|
*/
|
|
447
1014
|
withLimit(first: number): this;
|
|
448
1015
|
/**
|
|
449
1016
|
* Sets an offset for pagination.
|
|
450
|
-
* @param {number} offset - The offset value.
|
|
451
|
-
* @returns {this} - The query builder instance.
|
|
452
1017
|
*/
|
|
453
1018
|
withOffset(offset: number): this;
|
|
454
1019
|
/**
|
|
455
1020
|
* Sets the order in which records should be retrieved.
|
|
456
|
-
* @param {string} orderBy - The field to order by.
|
|
457
|
-
* @returns {this} - The query builder instance.
|
|
458
1021
|
*/
|
|
459
1022
|
withOrderBy(orderBy: string): this;
|
|
460
1023
|
/**
|
|
461
1024
|
* Applies cursor-based pagination.
|
|
462
|
-
* @param {string} after - The cursor position.
|
|
463
|
-
* @returns {this} - The query builder instance.
|
|
464
1025
|
*/
|
|
465
1026
|
withCursor(after: string): this;
|
|
466
1027
|
/**
|
|
467
1028
|
* Creates a parent query.
|
|
468
|
-
* @param {string} objectName - The name of the parent object.
|
|
469
|
-
* @returns {GraphQLQueryBuilder} - A new query builder instance for the parent.
|
|
470
1029
|
*/
|
|
471
1030
|
withParentQuery(objectName: string): GraphQLQueryBuilder;
|
|
472
1031
|
/**
|
|
473
1032
|
* Creates a child query.
|
|
474
|
-
* @param {string} objectName - The name of the child object.
|
|
475
|
-
* @returns {GraphQLQueryBuilder} - A new query builder instance for the child.
|
|
476
1033
|
*/
|
|
477
1034
|
withChildQuery(objectName: string): GraphQLQueryBuilder;
|
|
478
1035
|
/**
|
|
479
|
-
*
|
|
480
|
-
* @returns {FetchRecordsQueryParams} - The formatted query parameters.
|
|
481
|
-
*/
|
|
482
|
-
build(): FetchRecordsQueryParams;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* A service class for handling GraphQL operations.
|
|
486
|
-
*/
|
|
487
|
-
export declare class GraphQLService {
|
|
488
|
-
private client;
|
|
489
|
-
/**
|
|
490
|
-
* Creates an instance of GraphQLService.
|
|
491
|
-
* @param {GraphQLClient} client - The GraphQL client to use for queries and mutations.
|
|
1036
|
+
* Recursively builds the GraphQL query fields, handling nested queries.
|
|
492
1037
|
*/
|
|
493
|
-
|
|
1038
|
+
private formatQueryFields;
|
|
494
1039
|
/**
|
|
495
|
-
*
|
|
496
|
-
* @param {FetchRecordsQueryParams} params - The query parameters.
|
|
497
|
-
* @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
|
|
1040
|
+
* Builds the GraphQL query parameters in a more structured format.
|
|
498
1041
|
*/
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Deletes records from the GraphQL API.
|
|
502
|
-
* @param {string} objectName - The name of the object.
|
|
503
|
-
* @param {HasId[]} records - The records to delete.
|
|
504
|
-
* @returns {Promise<any>} - The response from the delete operation.
|
|
505
|
-
*/
|
|
506
|
-
delete(objectName: string, records: HasId[]): Promise<any>;
|
|
507
|
-
/**
|
|
508
|
-
* Updates records in the GraphQL API.
|
|
509
|
-
* @param {string} objectName - The name of the object.
|
|
510
|
-
* @param {HasId[]} records - The records to update.
|
|
511
|
-
* @returns {Promise<any>} - The response from the update operation.
|
|
512
|
-
*/
|
|
513
|
-
update(objectName: string, records: HasId[]): Promise<any>;
|
|
1042
|
+
build(): FetchRecordsQueryParams;
|
|
514
1043
|
/**
|
|
515
|
-
*
|
|
516
|
-
* @param {string} objectName - The name of the object.
|
|
517
|
-
* @param {HasId[]} records - The records to insert.
|
|
518
|
-
* @returns {Promise<any>} - The response from the insert operation.
|
|
1044
|
+
* Executes the query using the GraphQL service, with improved error handling.
|
|
519
1045
|
*/
|
|
520
|
-
|
|
1046
|
+
execute(): Promise<QueryResult>;
|
|
521
1047
|
/**
|
|
522
|
-
*
|
|
523
|
-
* @param {MutationResult} response - The response object.
|
|
524
|
-
* @returns {string[]} - An array of job UIDs.
|
|
1048
|
+
* Generates a string representation of the GraphQL query for debugging.
|
|
525
1049
|
*/
|
|
526
|
-
|
|
1050
|
+
toString(): string;
|
|
1051
|
+
}
|
|
1052
|
+
export declare class ResourceQueryParam {
|
|
1053
|
+
resourceIds?: Set<string>;
|
|
1054
|
+
regionIds?: Set<string>;
|
|
1055
|
+
startTime: Date;
|
|
1056
|
+
endTime: Date;
|
|
1057
|
+
timezone: string;
|
|
1058
|
+
respectResourceTimezone: boolean;
|
|
1059
|
+
mergeAvailability: boolean;
|
|
1060
|
+
mergeEvents: boolean;
|
|
1061
|
+
useTag: boolean;
|
|
1062
|
+
useJobAllocation: boolean;
|
|
1063
|
+
useResourceShift: boolean;
|
|
1064
|
+
useActivity: boolean;
|
|
1065
|
+
useAvailability: boolean;
|
|
1066
|
+
useAvailabilityTemplate: boolean;
|
|
1067
|
+
useAvailabilityPattern: boolean;
|
|
1068
|
+
useHoliday: boolean;
|
|
1069
|
+
excludedJAStatus: Set<string>;
|
|
1070
|
+
excludedJobStatus: Set<string>;
|
|
1071
|
+
availabilityStatus: Set<string>;
|
|
1072
|
+
resourceTypes: Set<string>;
|
|
1073
|
+
constructor();
|
|
1074
|
+
}
|
|
1075
|
+
declare class DataService {
|
|
1076
|
+
private graphqlService;
|
|
1077
|
+
constructor(graphqlService: GraphQLService);
|
|
1078
|
+
getResources(param: ResourceQueryParam): Promise<Record<string, any>[]>;
|
|
1079
|
+
getHolidays(regionIds: string[], startTime?: Date, endTime?: Date): Promise<Record<string, any>>;
|
|
1080
|
+
newQueryBuilder(objectName: string): GraphQLQueryBuilder;
|
|
1081
|
+
}
|
|
1082
|
+
export declare class ResourceAvailabilityService {
|
|
1083
|
+
private availabilityAPIClient;
|
|
1084
|
+
constructor(availabilityAPIClient: AvailabilityAPIClient);
|
|
1085
|
+
getAvailabilityPatterns(param: ResourceQueryParam): Promise<Map<string, BaseEvent[]>>;
|
|
1086
|
+
}
|
|
1087
|
+
export declare class ResourceBuilder {
|
|
1088
|
+
private dataService;
|
|
1089
|
+
private availabilityService;
|
|
1090
|
+
constructor(dataService: DataService, availabilityService: ResourceAvailabilityService);
|
|
1091
|
+
build(queryParam: ResourceQueryParam): Promise<Resource[]>;
|
|
1092
|
+
private loadAvailabilityPatterns;
|
|
1093
|
+
private loadActivityEvents;
|
|
1094
|
+
private loadAvailabilityEvents;
|
|
1095
|
+
private loadJobAllocationEvents;
|
|
1096
|
+
private loadResourceShiftEvents;
|
|
1097
|
+
private loadHolidayEvents;
|
|
1098
|
+
protected buildMore(resources: Resource[]): Resource[];
|
|
527
1099
|
}
|
|
528
1100
|
/**
|
|
529
1101
|
* ConfigHelper class provides methods to access and parse configuration variables.
|
|
@@ -560,38 +1132,123 @@ export declare class ConfigHelper {
|
|
|
560
1132
|
*/
|
|
561
1133
|
getString(varName: string): string;
|
|
562
1134
|
}
|
|
1135
|
+
export declare class DateTimeUtils {
|
|
1136
|
+
static toTimezone(input: Date, toTimezone: string): Date;
|
|
1137
|
+
static switchTimezone(input: Date, fromTimezone: string, toTimezone: string): Date;
|
|
1138
|
+
static addMinutes(input: Date, minutes: number, timezone: string): Date;
|
|
1139
|
+
static addDays(input: Date, days: number, timezone: string): Date;
|
|
1140
|
+
static addMonths(input: Date, months: number, timezone: string): Date;
|
|
1141
|
+
static addYears(input: Date, years: number, timezone: string): Date;
|
|
1142
|
+
static getDate(input: Date, timezone: string): Date;
|
|
1143
|
+
static getDateFromIsoString(isoString: string): Date;
|
|
1144
|
+
static getDateTimeFromIsoString(isoString: string): Date;
|
|
1145
|
+
static getStartOfDate(input: Date | string, timezone: string): Date;
|
|
1146
|
+
static getEndOfDate(input: Date | string, timezone: string): Date;
|
|
1147
|
+
static isIncluding(event: BaseEvent, job: BaseEvent): boolean;
|
|
1148
|
+
static isOverlapping(event: BaseEvent, job: BaseEvent): boolean;
|
|
1149
|
+
static mergeEvents(events: BaseEvent[]): BaseEvent[];
|
|
1150
|
+
}
|
|
563
1151
|
export declare class ExecutionContext {
|
|
564
1152
|
skedContext: any;
|
|
565
1153
|
contextData: any;
|
|
566
1154
|
private baseConfig;
|
|
567
|
-
|
|
568
|
-
private
|
|
569
|
-
private _graphqlClient?;
|
|
570
|
-
private _graphqlService?;
|
|
571
|
-
private _metadataClient?;
|
|
572
|
-
private _metadataService?;
|
|
573
|
-
private _configVarClient?;
|
|
574
|
-
private _configVarCache?;
|
|
575
|
-
private _inMemoryCache?;
|
|
1155
|
+
logger: typeof logger;
|
|
1156
|
+
private services;
|
|
576
1157
|
protected constructor(skedContext: any);
|
|
577
1158
|
static fromContext(skedContext: any): ExecutionContext;
|
|
578
|
-
static fromCredentials(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1159
|
+
static fromCredentials(config: BaseConfig): ExecutionContext;
|
|
1160
|
+
/**
|
|
1161
|
+
* Generic method to retrieve or initialize a service.
|
|
1162
|
+
*/
|
|
1163
|
+
private getOrCreateService;
|
|
583
1164
|
get configHelper(): ConfigHelper;
|
|
584
1165
|
get graphqlClient(): GraphQLClient;
|
|
585
1166
|
get graphqlService(): GraphQLService;
|
|
586
|
-
newQueryBuilder(objectName: string): GraphQLQueryBuilder;
|
|
587
1167
|
get metadataClient(): MetadataClient;
|
|
588
1168
|
get metadataService(): MetadataService;
|
|
1169
|
+
get vocabularyClient(): VocabularyClient;
|
|
1170
|
+
get orgPreferencesClient(): OrgPreferenceClient;
|
|
1171
|
+
get configTemplateClient(): ConfigTemplateClient;
|
|
1172
|
+
get configFeaturesClient(): ConfigFeaturesClient;
|
|
589
1173
|
get configVarClient(): ConfigVarClient;
|
|
1174
|
+
get mobileNotificationClient(): MobileNotificationClient;
|
|
1175
|
+
get geoAPIClient(): GeoAPIClient;
|
|
1176
|
+
get availabilityAPIClient(): AvailabilityAPIClient;
|
|
1177
|
+
get geoService(): GeoService;
|
|
590
1178
|
get configVarCache(): CacheService<any>;
|
|
591
1179
|
get inMemoryCache(): CacheService<any>;
|
|
1180
|
+
get resourceAvailabilityService(): ResourceAvailabilityService;
|
|
1181
|
+
get dataService(): DataService;
|
|
1182
|
+
get resourceBuilder(): ResourceBuilder;
|
|
1183
|
+
newQueryBuilder(objectName: string): GraphQLQueryBuilder;
|
|
1184
|
+
newArtifactClient(artifactType: ArtifactType): ArtifactClient;
|
|
592
1185
|
dispose(): void;
|
|
593
|
-
private lazyInit;
|
|
594
1186
|
}
|
|
1187
|
+
export declare const TenantObjects: {
|
|
1188
|
+
Accounts: {
|
|
1189
|
+
Name: string;
|
|
1190
|
+
Fields: string[];
|
|
1191
|
+
};
|
|
1192
|
+
Jobs: {
|
|
1193
|
+
Name: string;
|
|
1194
|
+
Fields: string[];
|
|
1195
|
+
};
|
|
1196
|
+
JobTags: {
|
|
1197
|
+
Name: string;
|
|
1198
|
+
Fields: string[];
|
|
1199
|
+
};
|
|
1200
|
+
JobAllocations: {
|
|
1201
|
+
Name: string;
|
|
1202
|
+
Fields: string[];
|
|
1203
|
+
};
|
|
1204
|
+
Regions: {
|
|
1205
|
+
Name: string;
|
|
1206
|
+
Fields: string[];
|
|
1207
|
+
};
|
|
1208
|
+
Contacts: {
|
|
1209
|
+
Name: string;
|
|
1210
|
+
Fields: string[];
|
|
1211
|
+
};
|
|
1212
|
+
Locations: {
|
|
1213
|
+
Name: string;
|
|
1214
|
+
Fields: string[];
|
|
1215
|
+
};
|
|
1216
|
+
Resources: {
|
|
1217
|
+
Name: string;
|
|
1218
|
+
Fields: string[];
|
|
1219
|
+
};
|
|
1220
|
+
Tags: {
|
|
1221
|
+
Name: string;
|
|
1222
|
+
Fields: string[];
|
|
1223
|
+
};
|
|
1224
|
+
Activities: {
|
|
1225
|
+
Name: string;
|
|
1226
|
+
Fields: string[];
|
|
1227
|
+
};
|
|
1228
|
+
Availabilities: {
|
|
1229
|
+
Name: string;
|
|
1230
|
+
Fields: string[];
|
|
1231
|
+
};
|
|
1232
|
+
Holidays: {
|
|
1233
|
+
Name: string;
|
|
1234
|
+
Fields: string[];
|
|
1235
|
+
};
|
|
1236
|
+
ResourceTags: {
|
|
1237
|
+
Name: string;
|
|
1238
|
+
Fields: string[];
|
|
1239
|
+
};
|
|
1240
|
+
HolidayRegions: {
|
|
1241
|
+
Name: string;
|
|
1242
|
+
Fields: string[];
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* This decorator logs the input arguments and output results of a method,
|
|
1247
|
+
* including error handling with ANSI color-coded logs for better console readability.
|
|
1248
|
+
* It allows selective logging based on the `LOG_NAMESPACE` environment variable.
|
|
1249
|
+
* Uses Winston logger but retains ANSI colors for console logs.
|
|
1250
|
+
*/
|
|
1251
|
+
export declare function LogMethod(namespace?: string): (target: any, propertyKey: any, descriptor: any) => any;
|
|
595
1252
|
export interface BatchJobSchemaData extends HasId {
|
|
596
1253
|
StatusDetails?: string;
|
|
597
1254
|
MaximumBatches?: number;
|
|
@@ -640,5 +1297,38 @@ export declare class BatchOrchestrator {
|
|
|
640
1297
|
protected updateJobStatus(): Promise<void>;
|
|
641
1298
|
private isCompleted;
|
|
642
1299
|
}
|
|
1300
|
+
export interface ResourceValidationOption {
|
|
1301
|
+
checkAvailability: boolean;
|
|
1302
|
+
checkConflict: boolean;
|
|
1303
|
+
checkTag: boolean;
|
|
1304
|
+
}
|
|
1305
|
+
export declare class ResourceJobValidation {
|
|
1306
|
+
resource: Partial<Resource>;
|
|
1307
|
+
job: Partial<Job>;
|
|
1308
|
+
availableEvent: BaseEvent | null;
|
|
1309
|
+
conflictEvents: BaseEvent[];
|
|
1310
|
+
missingTags: Tag[];
|
|
1311
|
+
constructor(resource: Partial<Resource>, job: Partial<Job>, availableEvent?: BaseEvent | null, conflictEvents?: BaseEvent[], missingTags?: Tag[]);
|
|
1312
|
+
isQualified(option: ResourceValidationOption): boolean;
|
|
1313
|
+
}
|
|
1314
|
+
export declare class ValidationResult {
|
|
1315
|
+
private readonly validations;
|
|
1316
|
+
private readonly option;
|
|
1317
|
+
constructor(validations: ResourceJobValidation[], option: ResourceValidationOption);
|
|
1318
|
+
getQualifiedResources(): Partial<Resource>[];
|
|
1319
|
+
getJobsWithXQualifiedResources(minQualifiedResources: number): Partial<Job>[];
|
|
1320
|
+
getUnqualifiedJobsWithReasons(): ResourceJobValidation[];
|
|
1321
|
+
format(): any[];
|
|
1322
|
+
}
|
|
1323
|
+
export declare class ResourceValidator {
|
|
1324
|
+
private readonly option;
|
|
1325
|
+
constructor(option: ResourceValidationOption);
|
|
1326
|
+
validate(resources: Resource[], jobs: Job[]): ValidationResult;
|
|
1327
|
+
private validateResource;
|
|
1328
|
+
private findAvailableEvent;
|
|
1329
|
+
private findConflictingEvents;
|
|
1330
|
+
private findMissingTags;
|
|
1331
|
+
private prepareData;
|
|
1332
|
+
}
|
|
643
1333
|
|
|
644
1334
|
export {};
|