@skedulo/pulse-solution-services 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +253 -11
  3. package/dist/clients/artifact-client.js +1 -0
  4. package/dist/clients/artifacts/artifact-client.d.ts +19 -0
  5. package/dist/clients/artifacts/artifact-client.js +1 -0
  6. package/dist/clients/artifacts/base-artifact-client.d.ts +14 -0
  7. package/dist/clients/artifacts/base-artifact-client.js +1 -0
  8. package/dist/clients/artifacts/object-based-artifact-client.d.ts +11 -0
  9. package/dist/clients/artifacts/object-based-artifact-client.js +1 -0
  10. package/dist/clients/base-client.js +1 -1
  11. package/dist/clients/config-features-client.js +1 -0
  12. package/dist/clients/config-template-client.js +1 -0
  13. package/dist/clients/config-var-client.js +1 -1
  14. package/dist/clients/custom-field-client.js +1 -0
  15. package/dist/clients/custom-schema-client.js +1 -0
  16. package/dist/clients/graphql-client.js +1 -1
  17. package/dist/clients/index.js +1 -1
  18. package/dist/clients/mobile-notification-client.js +1 -0
  19. package/dist/clients/org-preference-client.js +1 -0
  20. package/dist/clients/vocabulary-client.js +1 -0
  21. package/dist/constants/artifact-constants.js +1 -0
  22. package/dist/constants/artifact.js +1 -0
  23. package/dist/constants/config-var-constants.js +1 -0
  24. package/dist/constants/config-variable-constants.js +1 -0
  25. package/dist/constants/http.js +1 -1
  26. package/dist/constants/index.js +1 -1
  27. package/dist/constants/mobile-notification-constants.js +1 -0
  28. package/dist/constants/mobile-notification.js +1 -0
  29. package/dist/constants/tenant-endpoints.js +1 -1
  30. package/dist/constants/tenant-objects.js +1 -1
  31. package/dist/core/execution-context.js +1 -1
  32. package/dist/index.d.ts +410 -145
  33. package/dist/interfaces/artifacts.js +1 -0
  34. package/dist/interfaces/config-template.js +1 -0
  35. package/dist/interfaces/custom-field.js +1 -0
  36. package/dist/interfaces/custom-schema.js +1 -0
  37. package/dist/interfaces/index.js +1 -1
  38. package/dist/interfaces/mobile-notification.js +1 -0
  39. package/dist/interfaces/vocabulary.js +1 -0
  40. package/dist/logging/decorators/log-method.d.ts +2 -2
  41. package/dist/logging/decorators/log-method.js +1 -1
  42. package/dist/logging/logger.js +1 -1
  43. package/dist/logging/logging-utils.js +1 -0
  44. package/dist/services/cache/storage/config-var-cache-storage.js +1 -1
  45. package/dist/services/graphql/graphql-query-builder.d.ts +15 -1
  46. package/dist/services/graphql/graphql-query-builder.js +1 -1
  47. package/dist/services/metadata-service.js +1 -1
  48. package/dist/utils/object-utils.js +1 -0
  49. package/package.json +3 -2
  50. package/yarn.lock +181 -3
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<{ result: Metadata[] }>} - A promise resolving to an object containing an array of Metadata.
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<{ result: ObjectMetadata }>} - A promise resolving to an object containing the metadata of the requested object.
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?: string;
213
- endOffset?: number;
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
- export declare const CONFIG_VAR_TYPE: {
236
- PLAIN_TEXT: string;
237
- SECRET: string;
238
- };
239
- export declare const CONFIG_VAR_STATUS: {
240
- ACTIVE: string;
241
- INACTIVE: string;
242
- EXPIRED: string;
243
- };
244
- export declare const HTTP_METHOD: {
245
- GET: string;
246
- POST: string;
247
- PUT: string;
248
- DELETE: string;
249
- PATCH: string;
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,225 @@ 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
+ };
264
399
  };
265
- export declare const TENANT_OBJECTS: {
266
- Accounts: string;
267
- Jobs: string;
268
- JobAllocations: string;
269
- Regions: string;
270
- Contacts: string;
271
- Locations: string;
272
- Resources: string;
273
- Tags: string;
274
- JobTags: string;
275
- ResourceTags: string;
276
- Activities: string;
277
- Availabilities: string;
278
- Holidays: string;
279
- AvailabilityPatterns: string;
280
- AvailabilityPatternResources: string;
281
- AccountResourceScores: string;
282
- LocationResourceScores: string;
283
- Products: string;
284
- JobProducts: string;
400
+ export declare enum TenantObject {
401
+ Accounts = "Accounts",
402
+ Jobs = "Jobs",
403
+ JobAllocations = "JobAllocations",
404
+ Regions = "Regions",
405
+ Contacts = "Contacts",
406
+ Locations = "Locations",
407
+ Resources = "Resources",
408
+ Tags = "Tags",
409
+ JobTags = "JobTags",
410
+ ResourceTags = "ResourceTags",
411
+ Activities = "Activities",
412
+ Availabilities = "Availabilities",
413
+ Holidays = "Holidays",
414
+ AvailabilityPatterns = "AvailabilityPatterns",
415
+ AvailabilityPatternResources = "AvailabilityPatternResources",
416
+ AccountResourceScores = "AccountResourceScores",
417
+ LocationResourceScores = "LocationResourceScores",
418
+ Products = "Products",
419
+ JobProducts = "JobProducts"
420
+ }
421
+ export type ArtifactParams = {
422
+ objectName?: string;
423
+ viewTypeName?: string;
424
+ name?: string;
425
+ scope?: string;
285
426
  };
286
- export declare const PULSE_SOLUTION_NAMESPACE = "PSS";
287
- /**
288
- * This decorator logs the input arguments and output results of a method,
289
- * including error handling with ANSI color-coded logs for better console readability.
290
- * It allows selective logging based on the `LOG_NAMESPACE` environment variable.
291
- */
292
- export declare function LogMethod(namespace?: string): MethodDecorator;
293
- /**
294
- * Logger class for managing log messages.
295
- * Provides methods for logging information and errors, retrieving logs, and formatting logs.
296
- */
297
- export declare class Logger {
298
- logs: {
299
- level: string;
300
- message: string;
427
+ declare class ArtifactClient extends BaseClient {
428
+ private artifactType;
429
+ private baseEndpoint;
430
+ constructor(config: any, artifactType: ArtifactType);
431
+ list<T>(): Promise<T[]>;
432
+ get<T>(params?: ArtifactParams): Promise<T>;
433
+ create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
434
+ update<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
435
+ delete(params: ArtifactParams): Promise<void>;
436
+ private buildEndpoint;
437
+ }
438
+ declare class ConfigFeaturesClient extends BaseClient {
439
+ /**
440
+ * Fetches feature flags configuration.
441
+ * @returns {Promise<Record<string, any>>} - A promise resolving to the sorted feature flags in JSON string format.
442
+ */
443
+ get(): Promise<Record<string, any>>;
444
+ /**
445
+ * Deploys feature flags configuration.
446
+ * @param {string} newConfig - The new configuration to be deployed.
447
+ * @returns {Promise<Record<string, any>>} - A promise resolving when the configuration is successfully deployed.
448
+ */
449
+ update(tenantId: string, newConfig: Record<string, any>): Promise<Record<string, any>>;
450
+ }
451
+ export interface JobRequest {
452
+ jobId: string;
453
+ }
454
+ export interface NotifyRequest extends JobRequest {
455
+ resourceId?: string;
456
+ resourceIds?: string[];
457
+ }
458
+ export interface OneOffRequest {
459
+ resourceId: string;
460
+ message: string;
461
+ protocol?: NotificationType;
462
+ }
463
+ export interface DispatchResponse {
464
+ jobId: string;
465
+ results: {
466
+ resourceId: string;
467
+ protocol: string;
468
+ error?: {
469
+ errorType: string;
470
+ message: string;
471
+ };
301
472
  }[];
473
+ }
474
+ export interface NotifyResponse extends DispatchResponse {
475
+ }
476
+ export interface NotifyCancelResponse extends DispatchResponse {
477
+ }
478
+ export interface OneOffResponse {
479
+ protocol: NotificationType;
480
+ }
481
+ export interface SendSmsRequest {
482
+ phoneNumber: string;
483
+ countryCode: string;
484
+ message: string;
485
+ expectsReply?: boolean;
486
+ }
487
+ export interface SmsConfirmationRequest extends JobRequest {
488
+ phoneNumber: string;
489
+ countryCode: string;
490
+ message: string;
491
+ }
492
+ export interface SmsResponse {
493
+ success: boolean;
494
+ }
495
+ declare class MobileNotificationClient extends BaseClient {
302
496
  /**
303
- * Constructs an instance of Logger.
304
- * Initializes an empty array for storing log messages.
497
+ * Fetches all mobile notification templates from the API.
498
+ * @returns {Promise<any>} - An array of mobile notification templates.
305
499
  */
306
- constructor();
500
+ getTemplates(): Promise<any>;
307
501
  /**
308
- * Logs an informational message.
309
- *
310
- * @param message - The message to log.
502
+ * Deletes a specific mobile notification template.
503
+ * @param {NotificationTemplate} template - The notification template name.
504
+ * @param {NotificationType} notificationType - The type of the notification (e.g., sms, push).
311
505
  */
312
- info(message: string): void;
506
+ deleteTemplate(template: NotificationTemplate, notificationType: NotificationType): Promise<void>;
313
507
  /**
314
- * Logs an error message.
315
- *
316
- * @param message - The message to log.
508
+ * Creates or updates a mobile notification template.
509
+ * @param {NotificationTemplate} type - The notification type.
510
+ * @param {NotificationType} protocol - The notification protocol (e.g., sms, push).
511
+ * @param {string} text - The template content.
317
512
  */
318
- error(message: string): void;
513
+ setTemplate(template: NotificationTemplate, protocol: NotificationType, text: string): Promise<void>;
319
514
  /**
320
- * Retrieves all log messages.
321
- *
322
- * @returns An array of log messages.
515
+ * Dispatch resources and notify them.
516
+ * @param {NotifyRequest} request - The dispatch request payload.
517
+ * @returns {Promise<DispatchResponse>} - The API response.
323
518
  */
324
- getLogs(): {
325
- level: string;
326
- message: string;
327
- }[];
519
+ dispatchResources(request: NotifyRequest): Promise<DispatchResponse>;
328
520
  /**
329
- * Formats and retrieves all log messages as a single string.
330
- *
331
- * @param separator - The separator to use between log messages. Defaults to a newline character.
332
- * @returns A formatted string of all log messages.
521
+ * Notify resources about an allocated job.
522
+ * @param {NotifyRequest} request - The notification request payload.
523
+ * @returns {Promise<NotifyResponse>} - The API response.
333
524
  */
334
- getFormattedLogs(separator?: string): string;
525
+ notifyAllocatedResources(request: NotifyRequest): Promise<NotifyResponse>;
335
526
  /**
336
- * Clears all log messages.
527
+ * Notify resources of job cancellation.
528
+ * @param {JobRequest} request - The job cancellation notification payload.
529
+ * @returns {Promise<NotifyCancelResponse>} - The API response.
337
530
  */
338
- clear(): void;
531
+ notifyJobCancellation(request: JobRequest): Promise<NotifyCancelResponse>;
532
+ /**
533
+ * Send a message to a resource via push notification or SMS.
534
+ * @param {OneOffRequest} request - The one-off message request payload.
535
+ * @returns {Promise<OneOffResponse>} - The API response.
536
+ */
537
+ sendOneOffMessage(request: OneOffRequest): Promise<OneOffResponse>;
538
+ /**
539
+ * Send an SMS to any phone number.
540
+ * @param {SendSmsRequest} request - The SMS request payload.
541
+ * @returns {Promise<SmsResponse>} - The API response.
542
+ */
543
+ sendSms(request: SendSmsRequest): Promise<SmsResponse>;
544
+ /**
545
+ * Request confirmation by SMS.
546
+ * @param {SmsConfirmationRequest} request - The SMS confirmation request payload.
547
+ * @returns {Promise<SmsResponse>} - The API response.
548
+ */
549
+ requestSmsConfirmation(request: SmsConfirmationRequest): Promise<SmsResponse>;
550
+ }
551
+ export interface VocabularyItem {
552
+ value: string;
553
+ label: string;
554
+ active?: boolean;
555
+ defaultValue?: boolean;
556
+ description?: string;
557
+ createdAt?: string;
558
+ updatedAt?: string;
339
559
  }
560
+ declare class VocabularyClient extends BaseClient {
561
+ /**
562
+ * Fetches vocabulary items for a specific field in a schema.
563
+ * @param {string} schemaName - The schema name.
564
+ * @param {string} fieldName - The field name.
565
+ * @returns {Promise<VocabularyItem[]>} - A promise resolving to an array of vocabulary items.
566
+ */
567
+ getVocabularyItems(schemaName: string, fieldName: string): Promise<VocabularyItem[]>;
568
+ /**
569
+ * Adds a new vocabulary item to a field in a schema.
570
+ * @param {string} schemaName - The schema name.
571
+ * @param {string} fieldName - The field name.
572
+ * @param {VocabularyItem} item - The vocabulary item to add.
573
+ * @returns {Promise<VocabularyItem>} - A promise resolving to the created vocabulary item.
574
+ */
575
+ addVocabularyItem(schemaName: string, fieldName: string, item: VocabularyItem): Promise<VocabularyItem>;
576
+ /**
577
+ * Updates an existing vocabulary item in a field of a schema.
578
+ * @param {string} schemaName - The schema name.
579
+ * @param {string} fieldName - The field name.
580
+ * @param {string} value - The vocabulary item's value.
581
+ * @param {VocabularyItem} item - The updated vocabulary item.
582
+ * @returns {Promise<VocabularyItem>} - A promise resolving to the updated vocabulary item.
583
+ */
584
+ updateVocabularyItem(schemaName: string, fieldName: string, value: string, item: VocabularyItem): Promise<VocabularyItem>;
585
+ }
586
+ declare const logger: import("winston").Logger;
340
587
  export declare class CacheService<T> {
341
588
  private storage;
342
589
  private secondaryCache?;
@@ -407,6 +654,50 @@ export interface CacheOptions<T> {
407
654
  ttl?: number;
408
655
  useSecondaryCache?: boolean;
409
656
  }
657
+ /**
658
+ * A service class for handling GraphQL operations.
659
+ */
660
+ export declare class GraphQLService {
661
+ private client;
662
+ /**
663
+ * Creates an instance of GraphQLService.
664
+ * @param {GraphQLClient} client - The GraphQL client to use for queries and mutations.
665
+ */
666
+ constructor(client: GraphQLClient);
667
+ /**
668
+ * Executes a GraphQL query to fetch records.
669
+ * @param {FetchRecordsQueryParams} params - The query parameters.
670
+ * @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
671
+ */
672
+ query(params: FetchRecordsQueryParams): Promise<QueryResult>;
673
+ /**
674
+ * Deletes records from the GraphQL API.
675
+ * @param {string} objectName - The name of the object.
676
+ * @param {HasId[]} records - The records to delete.
677
+ * @returns {Promise<any>} - The response from the delete operation.
678
+ */
679
+ delete(objectName: string, records: HasId[]): Promise<any>;
680
+ /**
681
+ * 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
+ */
686
+ update(objectName: string, records: HasId[]): Promise<any>;
687
+ /**
688
+ * 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
+ */
693
+ insert(objectName: string, records: HasId[]): Promise<any>;
694
+ /**
695
+ * Extracts job UIDs from a GraphQL mutation response.
696
+ * @param {MutationResult} response - The response object.
697
+ * @returns {string[]} - An array of job UIDs.
698
+ */
699
+ extractJobUIDs(response: MutationResult): string[];
700
+ }
410
701
  /**
411
702
  * A utility class for building GraphQL queries dynamically.
412
703
  */
@@ -421,12 +712,19 @@ export declare class GraphQLQueryBuilder {
421
712
  private parentQueries;
422
713
  private childQueries;
423
714
  private isParent;
715
+ private graphqlService;
424
716
  /**
425
717
  * Creates an instance of GraphQLQueryBuilder.
426
718
  * @param {string} objectName - The name of the object being queried.
427
719
  * @param {boolean} [isParent=false] - Indicates if this query is a parent query.
428
720
  */
429
721
  constructor(objectName: string, isParent?: boolean);
722
+ /**
723
+ * Sets the GraphQL service to use for executing the query.
724
+ * @param {GraphQLService} graphqlService - The GraphQL service instance.
725
+ * @returns {void}
726
+ */
727
+ setGraphqlService(graphqlService: GraphQLService): void;
430
728
  /**
431
729
  * Specifies the fields to be retrieved.
432
730
  * @param {string[]} fields - The list of fields to select.
@@ -480,50 +778,12 @@ export declare class GraphQLQueryBuilder {
480
778
  * @returns {FetchRecordsQueryParams} - The formatted query parameters.
481
779
  */
482
780
  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.
492
- */
493
- constructor(client: GraphQLClient);
494
- /**
495
- * Executes a GraphQL query to fetch records.
496
- * @param {FetchRecordsQueryParams} params - The query parameters.
497
- * @returns {Promise<QueryResult>} - The query result including records, total count, page info, and cursors.
498
- */
499
- query(params: FetchRecordsQueryParams): Promise<QueryResult>;
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
781
  /**
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.
782
+ * Executes the query using the GraphQL service.
783
+ * @returns {Promise<QueryResult>} - The query result.
784
+ * @throws {Error} - If no GraphQL service is set.
512
785
  */
513
- update(objectName: string, records: HasId[]): Promise<any>;
514
- /**
515
- * Inserts records into the GraphQL API.
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.
519
- */
520
- insert(objectName: string, records: HasId[]): Promise<any>;
521
- /**
522
- * Extracts job UIDs from a GraphQL mutation response.
523
- * @param {MutationResult} response - The response object.
524
- * @returns {string[]} - An array of job UIDs.
525
- */
526
- extractJobUIDs(response: MutationResult): string[];
786
+ execute(): Promise<QueryResult>;
527
787
  }
528
788
  /**
529
789
  * ConfigHelper class provides methods to access and parse configuration variables.
@@ -564,34 +824,39 @@ export declare class ExecutionContext {
564
824
  skedContext: any;
565
825
  contextData: any;
566
826
  private baseConfig;
567
- private _logger?;
568
- private _configHelper?;
569
- private _graphqlClient?;
570
- private _graphqlService?;
571
- private _metadataClient?;
572
- private _metadataService?;
573
- private _configVarClient?;
574
- private _configVarCache?;
575
- private _inMemoryCache?;
827
+ logger: typeof logger;
828
+ private services;
576
829
  protected constructor(skedContext: any);
577
830
  static fromContext(skedContext: any): ExecutionContext;
578
- static fromCredentials({ apiServer, apiToken }: {
579
- apiServer: string;
580
- apiToken: string;
581
- }): ExecutionContext;
582
- get logger(): Logger;
831
+ static fromCredentials(config: BaseConfig): ExecutionContext;
832
+ /**
833
+ * Generic method to retrieve or initialize a service.
834
+ */
835
+ private getOrCreateService;
583
836
  get configHelper(): ConfigHelper;
584
837
  get graphqlClient(): GraphQLClient;
585
838
  get graphqlService(): GraphQLService;
586
- newQueryBuilder(objectName: string): GraphQLQueryBuilder;
587
839
  get metadataClient(): MetadataClient;
588
840
  get metadataService(): MetadataService;
841
+ get vocabularyClient(): VocabularyClient;
842
+ get orgPreferencesClient(): OrgPreferenceClient;
843
+ get configTemplateClient(): ConfigTemplateClient;
844
+ get configFeaturesClient(): ConfigFeaturesClient;
589
845
  get configVarClient(): ConfigVarClient;
846
+ get mobileNotificationClient(): MobileNotificationClient;
590
847
  get configVarCache(): CacheService<any>;
591
848
  get inMemoryCache(): CacheService<any>;
849
+ newQueryBuilder(objectName: string): GraphQLQueryBuilder;
850
+ newArtifactClient(artifactType: ArtifactType): ArtifactClient;
592
851
  dispose(): void;
593
- private lazyInit;
594
852
  }
853
+ /**
854
+ * This decorator logs the input arguments and output results of a method,
855
+ * including error handling with ANSI color-coded logs for better console readability.
856
+ * It allows selective logging based on the `LOG_NAMESPACE` environment variable.
857
+ * Uses Winston logger but retains ANSI colors for console logs.
858
+ */
859
+ export declare function LogMethod(namespace?: string): (target: any, propertyKey: any, descriptor: any) => any;
595
860
  export interface BatchJobSchemaData extends HasId {
596
861
  StatusDetails?: string;
597
862
  MaximumBatches?: number;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});