@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.
Files changed (84) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +478 -13
  3. package/dist/clients/artifact-client.js +1 -0
  4. package/dist/clients/availability-api-client.js +1 -0
  5. package/dist/clients/base-client.js +1 -1
  6. package/dist/clients/config-features-client.js +1 -0
  7. package/dist/clients/config-template-client.js +1 -0
  8. package/dist/clients/config-var-client.js +1 -1
  9. package/dist/clients/geo-api-client.js +1 -0
  10. package/dist/clients/graphql-client.js +1 -1
  11. package/dist/clients/index.js +1 -1
  12. package/dist/clients/mobile-notification-client.js +1 -0
  13. package/dist/clients/org-preference-client.js +1 -0
  14. package/dist/clients/vocabulary-client.js +1 -0
  15. package/dist/constants/artifact-constants.js +1 -0
  16. package/dist/constants/config-var-constants.js +1 -0
  17. package/dist/constants/http.js +1 -1
  18. package/dist/constants/index.js +1 -1
  19. package/dist/constants/mobile-notification-constants.js +1 -0
  20. package/dist/constants/tenant-endpoints.js +1 -1
  21. package/dist/constants/tenant-objects.js +1 -1
  22. package/dist/core/entity-factory.js +1 -0
  23. package/dist/core/execution-context.js +1 -1
  24. package/dist/core/index.js +1 -1
  25. package/dist/core/tenant-entities.js +1 -0
  26. package/dist/core/tenant-objects.js +1 -0
  27. package/dist/index.d.ts +850 -160
  28. package/dist/interfaces/artifacts.js +1 -0
  29. package/dist/interfaces/availability.js +1 -0
  30. package/dist/interfaces/config-template.js +1 -0
  31. package/dist/interfaces/geoservice-interfaces.js +1 -0
  32. package/dist/interfaces/index.js +1 -1
  33. package/dist/interfaces/mobile-notification.js +1 -0
  34. package/dist/interfaces/resource-availability.js +1 -0
  35. package/dist/interfaces/vocabulary.js +1 -0
  36. package/dist/logging/decorators/log-method.d.ts +2 -2
  37. package/dist/logging/decorators/log-method.js +1 -1
  38. package/dist/logging/logger.js +1 -1
  39. package/dist/logging/logging-utils.js +1 -0
  40. package/dist/services/cache/storage/config-var-cache-storage.js +1 -1
  41. package/dist/services/data-service.js +1 -0
  42. package/dist/services/geoservice.js +1 -0
  43. package/dist/services/graphql/graphql-query-builder.d.ts +21 -20
  44. package/dist/services/graphql/graphql-query-builder.js +1 -1
  45. package/dist/services/index.js +1 -1
  46. package/dist/services/metadata-service.js +1 -1
  47. package/dist/services/resource-availability/builder/data-service.d.ts +9 -0
  48. package/dist/services/resource-availability/builder/data-service.js +1 -0
  49. package/dist/services/resource-availability/builder/index.d.ts +3 -0
  50. package/dist/services/resource-availability/builder/index.js +1 -0
  51. package/dist/services/resource-availability/builder/resource-availability-service.d.ts +8 -0
  52. package/dist/services/resource-availability/builder/resource-availability-service.js +1 -0
  53. package/dist/services/resource-availability/builder/resource-builder.d.ts +17 -0
  54. package/dist/services/resource-availability/builder/resource-builder.js +1 -0
  55. package/dist/services/resource-availability/builder/resource-query-param.d.ts +23 -0
  56. package/dist/services/resource-availability/builder/resource-query-param.js +1 -0
  57. package/dist/services/resource-availability/index.d.ts +2 -0
  58. package/dist/services/resource-availability/index.js +1 -0
  59. package/dist/services/resource-availability/object-factory.d.ts +13 -0
  60. package/dist/services/resource-availability/object-factory.js +1 -0
  61. package/dist/services/resource-availability/resource-availability-service.d.ts +7 -0
  62. package/dist/services/resource-availability/resource-availability-service.js +1 -0
  63. package/dist/services/resource-availability/resource-builder.d.ts +16 -0
  64. package/dist/services/resource-availability/resource-builder.js +1 -0
  65. package/dist/services/resource-availability/resource-query-service.d.ts +7 -0
  66. package/dist/services/resource-availability/resource-query-service.js +1 -0
  67. package/dist/services/resource-availability/resource-validator.d.ts +29 -0
  68. package/dist/services/resource-availability/resource-validator.js +1 -0
  69. package/dist/services/resource-availability/validator/index.d.ts +3 -0
  70. package/dist/services/resource-availability/validator/index.js +1 -0
  71. package/dist/services/resource-availability/validator/resource-job-validation.d.ts +11 -0
  72. package/dist/services/resource-availability/validator/resource-job-validation.js +1 -0
  73. package/dist/services/resource-availability/validator/resource-validation-option.d.ts +5 -0
  74. package/dist/services/resource-availability/validator/resource-validation-option.js +1 -0
  75. package/dist/services/resource-availability/validator/resource-validator.d.ts +13 -0
  76. package/dist/services/resource-availability/validator/resource-validator.js +1 -0
  77. package/dist/services/resource-availability/validator/validation-result.d.ts +12 -0
  78. package/dist/services/resource-availability/validator/validation-result.js +1 -0
  79. package/dist/utils/datetime-utils.js +1 -0
  80. package/dist/utils/index.js +1 -1
  81. package/dist/utils/object-utils.js +1 -0
  82. package/package.json +6 -2
  83. package/yarn.lock +196 -3
  84. package/dist/constants/config-var.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## [v0.0.7] - 2025-02-13
4
+ ### Added
5
+ - Geo API Client, Geo Service, Resource Builder, Resource Validator
6
+
7
+ ## [v0.0.6] - 2025-02-06
8
+ ### Added
9
+ - API Clients for Artifact, Vocabulary, Config Templates, and Org Preference, Notification APIs.
10
+
11
+ ## [v0.0.5] - 2025-02-03
12
+ ### Initial Release
13
+ - First version of the project.
package/README.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Pulse Solution Services
2
2
 
3
+ - [Overview](#pulse-solution-services)
4
+ - [Installation](#installation)
5
+ - [Quick Start](#quick-start)
6
+ - [Initialize Execution Context](#initialize-execution-context)
7
+ - [API Clients](#api-clients)
8
+ - [Metadata Client](#metadata-client)
9
+ - [Vocabulary Client](#vocabulary-client)
10
+ - [GraphQL Client](#graphql-client)
11
+ - [Config Variable Client](#config-variable-client)
12
+ - [Org Preferences Client](#org-preferences-client)
13
+ - [Config Features (Feature Flags) Client](#config-features-feature-flags-client)
14
+ - [Mobile Notification Client](#mobile-notification-client)
15
+ - [Configuration Templates](#configuration-templates)
16
+ - [Geoservices Client](#geoservices-client)
17
+ - [Artifact Client](#artifact-client)
18
+ - [GraphQL Service](#graphql-service)
19
+ - [Query Data](#query-data)
20
+ - [Update Data](#update-data)
21
+ - [Pagination with Offset](#pagination-with-offset)
22
+ - [Pagination with Cursor](#pagination-with-cursor)
23
+ - [Resource Service](#resource-service)
24
+ - [Resource Builder](#resource-builder)
25
+ - [Resource Validator](#resource-validator)
26
+ - [GeoService](#geoservice)
27
+ - [Batch Service](#batch-service)
28
+ - [Cache Service](#cache-service)
29
+ - [Logging Utils](#logging-utils)
30
+
31
+ ## Overview
32
+
3
33
  **@skedulo/pulse-solution-services** provides common services and utilities for building solutions on the Pulse platform.
4
34
 
5
35
  ## Installation
@@ -23,28 +53,52 @@ const context = ExecutionContext.fromContext(skedToken);
23
53
  ```javascript
24
54
  const context = ExecutionContext.fromCredentials({
25
55
  apiServer: user.apiBasePath,
26
- apiToken: user.user.accessToken,
56
+ apiToken: user.accessToken,
27
57
  });
28
58
  ```
59
+ Once initialized, the context object provides access to the various services detailed in subsequent sections.
29
60
  ### API Clients
30
61
 
31
- **Metadata Client**
62
+ #### Metadata Client
32
63
  Fetches metadata from `/metadata` endpoints.
33
64
  ```javascript
34
65
  // Calls /metadata endpoint to retrieve all metadata
35
66
  const metadata = await context.metadataClient.fetchAllMetadata();
36
67
 
37
- // Calls /metadata/{mapping} endpoint to fetches metadata for a specific object
68
+ // Calls /metadata/{mapping} endpoint to fetch metadata for a specific object
38
69
  const jobMetadata = await context.metadataClient.fetchObjectMetadata('job');
39
70
  ```
40
71
 
41
- **GraphQL Client**
72
+ #### Vocabulary Client
73
+ Manages vocabulary items for picklist fields in schemas.
74
+ ```javascript
75
+ // Calls /custom/vocabulary/Jobs/Type to fetch all vocabulary items for the 'Type' field in 'Jobs' schema
76
+ const vocabularyItems = await context.vocabularyClient.getVocabularyItems('Jobs', 'Type');
77
+
78
+ // Calls /custom/vocabulary/Jobs/Type to add a new vocabulary item
79
+ const newVocabularyItem = await context.vocabularyClient.addVocabularyItem('Jobs', 'Type', {
80
+ value: "Repair",
81
+ label: "Repair Service",
82
+ active: true,
83
+ defaultValue: false,
84
+ description: "A repair job type"
85
+ });
86
+
87
+ // Calls /custom/vocabulary/Jobs/Type/Upgrade to update the 'Upgrade' vocabulary item
88
+ const updatedVocabularyItem = await context.vocabularyClient.updateVocabularyItem('Jobs', 'Type', 'Upgrade', {
89
+ value: "Upgrade",
90
+ label: "System Upgrade",
91
+ description: "An upgraded system installation"
92
+ });
93
+ ```
94
+
95
+ #### GraphQL Client
42
96
  Executes GraphQL queries and mutations against `/graphql/graphql`.
43
97
  ```javascript
44
98
  const queryResult = await context.graphqlClient.query(queryParams);
45
99
  ```
46
100
 
47
- **Config Variable Client**
101
+ #### Config Variable Client
48
102
  Provides CRUD and search methods for managing configuration variables.
49
103
  ```javascript
50
104
  // Calls /configuration/extension endpoint to create a configuration var
@@ -58,9 +112,270 @@ await context.configVarClient.create({
58
112
  const config = await context.configVarClient.get('TEST_KEY');
59
113
  ```
60
114
 
115
+ #### Org Preferences Client
116
+ Fetch Org Preferences from the `/config/org_preference` endpoint.
117
+ ```javascript
118
+ // Get
119
+ const config: Record<string, any> = await context.orgPreferencesClient.get();
120
+
121
+ // Update
122
+ const jobConfig = {
123
+ allowAbortJob:false
124
+ }
125
+ const config: Record<string, any> = await context.orgPreferencesClient.deploy(jobConfig);
126
+ ```
127
+
128
+ #### Config Features (Feature Flags) Client
129
+ Fetch Config Features from the `/config/features` endpoint.
130
+ ```javascript
131
+ // Get
132
+ const config: Record<string, any> = await context.configFeaturesClient.get();
133
+ ```
134
+
135
+ #### Mobile Notification Client
136
+ Manage mobile notifications, SMS messaging, and templates.
137
+
138
+ **Mobile Notification Templates**
139
+ ```javascript
140
+ // Get all mobile notification templates
141
+ const templates = await context.mobileNotificationClient.getTemplates();
142
+
143
+ // Update a template
144
+ await context.mobileNotificationClient.setTemplate(
145
+ NotificationTemplate.JOB_DISPATCH,
146
+ NotificationType.SMS,
147
+ 'Updated text for job dispatch: {{ Name }} starts at {{ Start }}.'
148
+ );
149
+
150
+ // Delete a template
151
+ await context.mobileNotificationClient.deleteTemplate(NotificationTemplate.JOB_DISPATCH, NotificationType.SMS);
152
+ ```
153
+
154
+ **Job Notifications**
155
+ Send notifications related to job dispatch, reminders, cancellations, and custom messages.
156
+ ```javascript
157
+ // Dispatch resources and notify them
158
+ const result: DispatchResponse = await context.mobileNotificationClient.dispatchResources({
159
+ jobId: "12345",
160
+ resourceIds: ["resource-1", "resource-2"]
161
+ });
162
+
163
+ // Notify resources about an allocated job
164
+ const result: NotifyResponse = await context.mobileNotificationClient.notifyAllocatedResources({
165
+ jobId: "12345",
166
+ resourceIds: ["resource-1", "resource-2"]
167
+ });
168
+
169
+ // Notify resources of job cancellation
170
+ const result: NotifyCancelResponse = await context.mobileNotificationClient.notifyJobCancellation({
171
+ jobId: "12345"
172
+ });
173
+
174
+ // Send a one-off message via push notification
175
+ const result: OneOffResponse = await context.mobileNotificationClient.sendOneOffMessage({
176
+ resourceId: "resource-1",
177
+ message: "Reminder: Your job starts in 1 hour.",
178
+ protocol: NotificationType.PUSH
179
+ });
180
+ ```
181
+ **SMS Messaging**
182
+ Send SMS messages or request job confirmations via SMS.
183
+ ```javascript
184
+ // Send an SMS to any phone number
185
+ const result: SmsResponse = await context.mobileNotificationClient.sendSms({
186
+ phoneNumber: "+1234567890",
187
+ countryCode: "US",
188
+ message: "Thank you for confirming your appointment!",
189
+ expectsReply: false
190
+ });
191
+
192
+ // Request job confirmation via SMS
193
+ const result: SmsResponse = await context.mobileNotificationClient.requestSmsConfirmation({
194
+ phoneNumber: "+1234567890",
195
+ countryCode: "US",
196
+ jobId: "12345",
197
+ message: "Please confirm your job by replying YES or NO."
198
+ });
199
+ ```
200
+ #### Configuration Templates
201
+
202
+ **Templates**
203
+ ```javascript
204
+ // Get templates
205
+ const templates: ConfigTemplate[] = await context.configTemplateClient.get('Jobs');
206
+
207
+ // Get teamplate values
208
+ const values: ConfigValue[] = await context.configTemplateClient.getTemmplateValues(templateId);
209
+
210
+ // Delete a template
211
+ const result: Record<string,string> = await context.configTemplateClient.delete(templateId);
212
+ ```
213
+ **Template Values**
214
+ ```javascript
215
+ // Get template values
216
+ const values: ConfigValue[] = await context.configTemplateClient.getTemmplateValues(templateId);
217
+
218
+ // Create a new template and values
219
+ const newTemplate: ConfigTemplate = {
220
+ name: "Installation",
221
+ schemaName: 'Jobs'
222
+ }
223
+ const createdTemplate: ConfigTemplate = await context.configTemplateClient.create(newTemplate);
224
+ console.log(JSON.stringify(createdTemplate, null, 2));
225
+
226
+ const configTemplateValues: ConfigValue[] = [
227
+ {
228
+ templateId: createdTemplate.id!,
229
+ rel: "job",
230
+ field: "CanBeDeclined",
231
+ value: "true"
232
+ },
233
+ {
234
+ templateId: createdTemplate.id!,
235
+ rel: "job",
236
+ field: "Duration",
237
+ value: "120"
238
+ }
239
+ ]
240
+
241
+ const newValues = await context.configTemplateClient.upsertTemplateValues(createdTemplate.id!, configTemplateValues);
242
+ console.log(JSON.stringify(newValues, null, 2));
243
+ ```
244
+
245
+ #### Geo API Client
246
+ Provides access to geolocation-related services via the `/geoservices` endpoints.
247
+
248
+ ```javascript
249
+ // Calls /distanceMatrix endpoint to compute travel distance and time
250
+ const distanceMatrix: DistanceMatrixResponse = await context.geoAPIClient.getDistanceMatrix({
251
+ origins: [{ lat: 37.7749, lng: -122.4194 }],
252
+ destinations: [{ lat: 34.0522, lng: -118.2437 }],
253
+ avoid: ["highway"],
254
+ });
255
+
256
+ // Calls /directions endpoint to fetch directions between two locations
257
+ const directions: DirectionsResponse = await context.geoAPIClient.getDirections({
258
+ requests: [{
259
+ origin: { lat: 37.7749, lng: -122.4194 },
260
+ destination: { lat: 34.0522, lng: -118.2437 },
261
+ waypoints: [{ lat: 36.7783, lng: -119.4179 }],
262
+ avoid: ["toll"],
263
+ }],
264
+ });
265
+
266
+ // Calls /geocode endpoint to retrieve latitude and longitude for an address
267
+ const geocode: GeocodeResponse = await context.geoAPIClient.geocodeAddress({
268
+ addresses: ["1600 Amphitheatre Parkway, Mountain View, CA"],
269
+ });
270
+
271
+ // Calls /autocomplete endpoint to get address suggestions
272
+ const autocomplete = await context.geoAPIClient.autocompleteAddress({
273
+ input: "1600 Amphi",
274
+ sessionId: "unique-session-id",
275
+ location: { lat: 37.7749, lng: -122.4194 },
276
+ radius: 5000,
277
+ country: "US",
278
+ });
279
+
280
+ // Calls /place endpoint to fetch place details using a place ID
281
+ const placeDetails = await context.geoAPIClient.getPlaceDetails({
282
+ placeId: "ChIJ2eUgeAK6j4ARbn5u_wAGqWA",
283
+ sessionId: "unique-session-id",
284
+ });
285
+
286
+ // Calls /timezone endpoint to fetch timezone information for a location
287
+ const timezone: TimezoneResponse = await context.geoAPIClient.getTimezone({
288
+ location: [37.7749, -122.4194],
289
+ timestamp: Math.floor(Date.now() / 1000),
290
+ });
291
+ ```
292
+
293
+ #### Availability API Client
294
+ ```javascript
295
+ // Calls /availability/simple endpoint to retrieve availability for resources
296
+ const resourceAvailability: AvailabilityResult[] = await context.availabilityAPIClient.fetchAvailability({
297
+ resourceIds: ["resource_123", "resource_456"],
298
+ start: "2024-06-01T00:00:00Z",
299
+ end: "2024-06-02T00:00:00Z",
300
+ mergedAvailabilities: false, // Optional, defaults to false
301
+ entries: true // Optional, defaults to true
302
+ });
303
+
304
+ // Example: Accessing merged availability intervals
305
+ console.log(availability[0].mergedAvailabilities);
306
+
307
+ // Example: Accessing detailed availability entries
308
+ console.log(availability[0].entries);
309
+
310
+ ```
311
+
312
+ #### Artifact Client
313
+ The `ArtifactClient` provides a unified way to manage various artifact types.
314
+ ```javascript
315
+ // Creating an Artifact Client for a specific type
316
+ const client = context.newArtifactClient(ArtifactType.CUSTOM_OBJECT);
317
+ ```
318
+ **Listing All Artifacts**
319
+ Retrieve all artifactse.
320
+ ```javascript
321
+ await client.list();
322
+ ```
323
+
324
+ **Using Artifact Parameters for CRUD Operations**
325
+ When performing CRUD operations, provide `ArtifactParams` with the necessary values based on the artifact type.
326
+ ```javascript
327
+ type ArtifactParams = {
328
+ name?: string; // Artifact name (required for most operations)
329
+ objectName?: string; // Optional identifier for object-based artifacts
330
+ viewTypeName?: string; // Optional view type name if applicable
331
+ scope?: string; // Optional scope if applicable
332
+ };
333
+ ```
334
+ **Notes**
335
+ - Use the object label for `objectName` in Horizon artifacts.
336
+ - `name` is the `slug` for Horizon templates and `defId` for mobile extensions.
337
+ ```javascript
338
+ // Get an artifact
339
+ await client.get({ name: "Jobs" });
340
+
341
+ // Create an artifact
342
+ await client.create({},
343
+ {
344
+ metadata: {
345
+ type: 'CustomObject'
346
+ },
347
+ name: 'Tasks',
348
+ label: 'Tasks',
349
+ description: 'Daily tasks'
350
+ }
351
+ );
352
+
353
+ // Update an artifact
354
+ await client.update(
355
+ {
356
+ name: 'Tasks'
357
+ },
358
+ {
359
+ metadata: {
360
+ type: 'CustomObject'
361
+ },
362
+ name: 'Tasks',
363
+ label: 'Tasks',
364
+ description: 'Daily tasks - updated'
365
+ }
366
+ );
367
+
368
+ // Delete an artifact
369
+ await client.delete(
370
+ {
371
+ name: 'Tasks'
372
+ }
373
+ );
374
+ ```
375
+
61
376
  ### GraphQL Service
62
377
 
63
- **Query data**
378
+ #### Query data
64
379
  ```javascript
65
380
  // Create a query builder for the Resources object
66
381
  const queryBuilder = context.newQueryBuilder('Resources')
@@ -77,8 +392,8 @@ queryBuilder.withChildQuery('JobAllocations')
77
392
  // Add a parent query for Primary Region
78
393
  queryBuilder.withParentQuery('PrimaryRegion')
79
394
  .withFields(['UID', 'Name']);
80
- // Finally, execute the query via your GraphQL service
81
- const queryResult: QueryResult = await context.graphqlService.query(queryBuilder.build());
395
+ // Finally, execute the query
396
+ let queryResult = await queryBuilder.execute();
82
397
 
83
398
  console.log(queryResult.records);
84
399
  console.log(queryResult.totalCount); // 5
@@ -86,7 +401,7 @@ console.log(queryResult.pageInfo.hasNextPage); // true
86
401
  console.log(queryResult.endCursor); // Mg==
87
402
  console.log(queryResult.endOffset); // 1
88
403
  ```
89
- **Update data**
404
+ #### Update data
90
405
  ```javascript
91
406
  const recordsToUpdate = queryResult.records.map((record) => {
92
407
  return {
@@ -96,18 +411,168 @@ const recordsToUpdate = queryResult.records.map((record) => {
96
411
  });
97
412
  const updateResult = await context.graphqlService.update('Resources', recordsToUpdate);
98
413
  ```
99
- **Pagination with offset**
414
+ #### Pagination with offset
100
415
  ```javascript
101
416
  while(queryResult.pageInfo.hasNextPage) {
102
417
  queryBuilder.withOffset(queryResult.endOffset + 1);
103
- queryResult = await context.graphqlService.query(queryBuilder.build());
418
+ queryResult = await queryBuilder.execute();
104
419
  }
105
420
  ```
106
- **Pagination with cursor**
421
+ #### Pagination with cursor
107
422
  ```javascript
108
423
  while(queryResult.pageInfo.hasNextPage) {
109
424
  queryBuilder.withCursor(queryResult.endCursor);
110
- queryResult = await context.graphqlService.query(queryBuilder.build());
425
+ queryResult = await queryBuilder.execute();
426
+ }
427
+ ```
428
+
429
+ ### Resource Service
430
+ The Resource Service consists of two main components:
431
+
432
+ - **Resource Builder**: Retrieves resource information, including availability, scheduled jobs, activities, tags, etc
433
+ - **Resource Validator**: Validates which resources are available for which jobs based on given conditions.
434
+
435
+ #### Resource Builder
436
+
437
+ The Resource Builder retrieves resource data, including availability, activities, scheduled jobs, tags, and other relevant details. By default, it enables the following options: `useTag`, `useJobAllocation`, `useResourceShift`, `useActivity`, `useAvailabilityPattern`, and `useHoliday`, with a time range set to 14 days from the current time.
438
+
439
+ **Usage**
440
+ ```javascript
441
+ // Define query parameters for resource fetching
442
+ const params = new ResourceQueryParam();
443
+ params.regionIds = new Set(['<region_id>']);
444
+ // Override default values
445
+ params.useTag = false;
446
+ params.startTime = new Date();
447
+ params.endTime = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000);// next 7 days from now
448
+
449
+ // Build resources with the given parameters
450
+ const resources = await context.resourceBuilder.build(params);
451
+ console.log(resources);
452
+ ```
453
+
454
+ #### Resource Validator
455
+ The Resource Validator takes a list of resources and jobs, and determines which resources are qualified to perform the jobs based on:
456
+
457
+ - Availability: Is the resource available during the job's timeframe?
458
+ - Conflict Detection: Does the resource already have conflicting events (e.g., another job, activity, or time-off)?
459
+ - Tag Matching: Does the resource have the required skills for the job?
460
+
461
+ **Usage**
462
+ ```javascript
463
+ // Fetch jobs using GraphQL
464
+ const jobQueryResult = await context
465
+ .newQueryBuilder(TenantObjects.Jobs.Name)
466
+ .withLimit(2)
467
+ .withFields(TenantObjects.Jobs.Fields)
468
+ .execute();
469
+
470
+ // Convert raw job data into structured Job entities
471
+ const jobs: Job[] = jobQueryResult.records.map((job) => EntityFactory.createJob(job));
472
+
473
+ // Define validation options
474
+ const validationOptions = {
475
+ checkAvailability: true, // Check if the resource is available
476
+ checkConflict: true, // Check for conflicting events
477
+ checkTag: true // Check if the resource has the required skills
478
+ };
479
+
480
+ // Create a validator instance
481
+ const validator = new ResourceValidator(validationOptions);
482
+
483
+ // Run validation
484
+ const result: ValidationResult = validator.validate(resources, jobs);
485
+
486
+ // Output results
487
+ console.log(JSON.stringify(result, null, 2));
488
+
489
+ const resourcesQualifiedForAtleastOneJob = result.getQualifiedResources();
490
+ const jobsWithAtLeastXQualifiedResources = result.getJobsWithXQualifiedResources(2);
491
+ const unqualifiedJobsWithReasons = result.getUnqualifiedJobsWithReasons();
492
+ ```
493
+ **Validation Output**
494
+ The Resource Validator returns a structured JSON output indicating which resources are qualified, and the reasons why certain jobs are not assigned. The results can be formatted to present a clearer qualification status along with detailed reasons.
495
+ ```javascript
496
+ console.log(JSON.stringify(result.format(), null, 2));
497
+
498
+ /*
499
+ [
500
+ {
501
+ "resource": {
502
+ "id": "0005fcae-3c63-46c0-8533-b2e154c25040",
503
+ "name": "Tracey Rodriguez"
504
+ },
505
+ "job": {
506
+ "id": "00143a8e-7958-4df1-8ade-767b19e9aff8",
507
+ "name": "JOB-71777"
508
+ },
509
+ "qualificationStatus": "Qualified",
510
+ "reasons": []
511
+ },
512
+ {
513
+ "resource": {
514
+ "id": "0005fcae-3c63-46c0-8533-b2e154c25040",
515
+ "name": "Tracey Rodriguez"
516
+ },
517
+ "job": {
518
+ "id": "0014bfb0-2993-4d6a-ad25-ed5d9c79de14",
519
+ "name": "JOB-71743"
520
+ },
521
+ "qualificationStatus": "Not Qualified",
522
+ "reasons": [
523
+ {
524
+ "reason": "Conflict Detected",
525
+ "conflictingEvents": [
526
+ {
527
+ "id": "2025-02-13T14:00:00.000Z_2025-02-14T14:00:00.000Z",
528
+ "name": "Regional Holiday",
529
+ "eventType": "holiday"
530
+ }
531
+ ]
532
+ }
533
+ ]
534
+ }
535
+ ]
536
+ */
537
+ ```
538
+
539
+ ### GeoService
540
+ Provides a high-level interface for geolocation-related operations, built on top of `GeoAPIClient`.
541
+
542
+ **Get Distance Matrix**
543
+ Computes travel distance and duration between origins and destinations. Handles cases where no route is available.
544
+ ```javascript
545
+ const origins = [{ lat: 55.93, lng: -3.118 }, { lat: 50.087, lng: 14.421 }];
546
+ const destinations = [{ lat: 50.087, lng: 14.421 }, { lat: 0, lng: 0 }];
547
+
548
+ const distanceMatrix: Map<string, DistanceMatrixEntry> = await context.geoService.getDistanceMatrix(origins, destinations);
549
+
550
+ for(const origin of origins) {
551
+ for(const destination of destinations) {
552
+ const key = context.geoService.createKey(origin, destination);
553
+ const entry = distanceMatrix.get(key);
554
+ console.log(`Origin-Destination: ${key} - Status: ${entry?.status}`);
555
+ if(entry?.status === "OK") {
556
+ console.log(`Distance: ${entry?.distance?.distanceInMeters} meters`);
557
+ console.log(`Duration: ${entry?.duration?.durationInSeconds} seconds`);
558
+ }
559
+ }
560
+ }
561
+ ```
562
+
563
+ **Get Address Suggestions**
564
+ Fetches address autocomplete suggestions and retrieves detailed place information.
565
+ ```javascript
566
+ const input = "1600 Amphitheatre Pkwy";
567
+ const suggestions: PlaceResponse[]|null = await context.geoService.getAddressSuggestions({ input, country: 'US' }, 2);
568
+
569
+ if (suggestions) {
570
+ suggestions.forEach((place, index) => {
571
+ console.log(`Place ${index + 1}: ${place.formattedAddress}`);
572
+ console.log(`Latitude: ${place.geometry.lat}, Longitude: ${place.geometry.lng}`);
573
+ });
574
+ } else {
575
+ console.log("No place details found.");
111
576
  }
112
577
  ```
113
578
 
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(o,r){function s(t){try{d(n.next(t))}catch(t){r(t)}}function a(t){try{d(n.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}d((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArtifactClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class ArtifactClient extends base_client_1.BaseClient{constructor(t,e){super(t),this.artifactType=e,this.baseEndpoint=`artifacts/${this.artifactType}`}list(){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({endpoint:this.baseEndpoint})}))}get(){return __awaiter(this,arguments,void 0,(function*(t={}){return this.performRequest({endpoint:this.buildEndpoint(t)})}))}create(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:this.buildEndpoint(t),body:e})}))}update(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.PUT,endpoint:this.buildEndpoint(t),body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HttpMethod.DELETE,endpoint:this.buildEndpoint(t)})}))}buildEndpoint(t){const{objectName:e,viewTypeName:i,name:n,scope:o}=t;let r=this.baseEndpoint;return e&&(r+=`/${e}`),i&&(r+=`/${i}`),n&&(r+=`/${n}`),o&&(r+=`/${o}`),r}}exports.ArtifactClient=ArtifactClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityAPIClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class AvailabilityAPIClient extends base_client_1.BaseClient{fetchAvailability(e){return __awaiter(this,void 0,void 0,(function*(){var t,i,n,r;if(!e.resourceIds.length)throw new Error("At least one resource ID must be provided.");const s={resource_ids:e.resourceIds.join(","),start:e.start,end:e.end,mergedAvailabilities:null!==(i=null===(t=e.mergedAvailabilities)||void 0===t?void 0:t.toString())&&void 0!==i?i:"false",entries:null!==(r=null===(n=e.entries)||void 0===n?void 0:n.toString())&&void 0!==r?r:"true"};return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.SIMPLE,queryParams:s})}))}}exports.AvailabilityAPIClient=AvailabilityAPIClient;
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseClient=void 0;const logging_1=require("../logging");class BaseClient{constructor(e){this.config=e}getHeaders(){return{Authorization:`Bearer ${this.config.apiToken}`,"Content-Type":"application/json"}}performRequest(e){return __awaiter(this,arguments,void 0,(function*({method:e="GET",endpoint:t,headers:n={},body:o}){try{const i=Object.assign(Object.assign({},this.getHeaders()),n),r=yield fetch(`${this.config.apiServer}/${t}`,{method:e,headers:i,body:o?JSON.stringify(o):void 0});let a;const s=r.headers.get("content-type");if(a=s&&s.includes("application/json")?yield r.json():yield r.text(),!r.ok)throw new Error(`HTTP error! Status: ${r.status}. Response: ${JSON.stringify(a)}`);return a}catch(e){throw this.handleException(e),e}}))}handleException(e){}}exports.BaseClient=BaseClient,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],BaseClient.prototype,"performRequest",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseClient=void 0;const logging_1=require("../logging");class BaseClient{constructor(e){this.config=e}getHeaders(){return{Authorization:`Bearer ${this.config.apiToken}`,"Content-Type":"application/json"}}buildUrl(e,t){const n=new URL(`${this.config.apiServer}/${e}`);return t&&Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,t)})),n.toString()}performRequest(e){return __awaiter(this,arguments,void 0,(function*({method:e="GET",endpoint:t,headers:n={},body:r,queryParams:o}){try{const i=Object.assign(Object.assign({},this.getHeaders()),n),a=this.buildUrl(t,o),s=yield fetch(a,{method:e,headers:i,body:r&&"GET"!==e?JSON.stringify(r):void 0});let c;const d=s.headers.get("content-type");if(d&&d.includes("application/json")?(c=yield s.json(),c.result&&(c=c.result)):c=yield s.text(),!s.ok)throw new Error(`HTTP error! Status: ${s.status}. Response: ${JSON.stringify(c)}`);return c}catch(e){throw this.handleException(e),e}}))}handleException(e){}}exports.BaseClient=BaseClient,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],BaseClient.prototype,"performRequest",null);
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigFeaturesClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class ConfigFeaturesClient extends base_client_1.BaseClient{get(){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_FEATURES.GET})}))}update(t,e){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,headers:{Authorization:`Bearer ${this.config.internalApiToken}`,"Content-Type":"application/json"},endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_FEATURES.UPDATE(t),body:e})}))}}exports.ConfigFeaturesClient=ConfigFeaturesClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{_(i.next(t))}catch(t){r(t)}}function a(t){try{_(i.throw(t))}catch(t){r(t)}}function _(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}_((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigTemplateClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class ConfigTemplateClient extends base_client_1.BaseClient{get(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_TEMPLATES(t)}`})}))}getTemmplateValues(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_VALUES(t)}`})}))}upsertTemplateValues(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.PUT,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.UPDATE_VALUES(t)}`,body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.DELETE,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.DELETE(t)}`})}))}create(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.CREATE}`,body:t})}))}}exports.ConfigTemplateClient=ConfigTemplateClient;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{_(i.next(t))}catch(t){r(t)}}function a(t){try{_(i.throw(t))}catch(t){r(t)}}function _(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}_((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class ConfigVarClient extends base_client_1.BaseClient{create(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HTTP_METHOD.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.CREATE,body:t})}))}get(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.GET(t)})}))}update(t){return __awaiter(this,void 0,void 0,(function*(){const e=t.key||"";return delete t.key,yield this.performRequest({method:constants_1.HTTP_METHOD.PATCH,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.UPDATE(e),body:{value:t.value,description:t.description}})}))}search(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HTTP_METHOD.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.SEARCH,body:{pageSize:t&&t<1e3?t:1e3}})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HTTP_METHOD.DELETE,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.DELETE(t)})}))}}exports.ConfigVarClient=ConfigVarClient;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{d(i.next(t))}catch(t){r(t)}}function a(t){try{d(i.throw(t))}catch(t){r(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}d((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class ConfigVarClient extends base_client_1.BaseClient{create(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.CREATE,body:t})}))}get(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.GET(t)})}))}update(t){return __awaiter(this,void 0,void 0,(function*(){const e=t.key||"";return delete t.key,yield this.performRequest({method:constants_1.HttpMethod.PATCH,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.UPDATE(e),body:{value:t.value,description:t.description}})}))}search(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.SEARCH,body:{pageSize:t&&t<1e3?t:1e3}})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.DELETE,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.DELETE(t)})}))}}exports.ConfigVarClient=ConfigVarClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,s){function r(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}c((o=o.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoAPIClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class GeoAPIClient extends base_client_1.BaseClient{getDistanceMatrix(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.DISTANCE_MATRIX,body:t})}))}getDirections(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.DIRECTIONS,body:t})}))}geocodeAddress(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.GEOCODE,body:t})}))}autocompleteAddress(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.AUTOCOMPLETE,body:t})}))}getPlaceDetails(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.PLACE,body:t})}))}getTimezone(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HttpMethod.GET,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.TIMEZONE,queryParams:{location:t.location.join(","),timestamp:t.timestamp.toString()}})}))}}exports.GeoAPIClient=GeoAPIClient;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function a(t){try{c(i.next(t))}catch(t){s(t)}}function o(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,o)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLClient=void 0;const constants_1=require("../constants"),http_1=require("../constants/http"),base_client_1=require("./base-client");class GraphQLClient extends base_client_1.BaseClient{execute(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:http_1.HTTP_METHOD.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL,body:{query:t}})}))}}exports.GraphQLClient=GraphQLClient;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLClient=void 0;const constants_1=require("../constants"),http_1=require("../constants/http"),base_client_1=require("./base-client");class GraphQLClient extends base_client_1.BaseClient{execute(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL,body:{query:t}})}))}}exports.GraphQLClient=GraphQLClient;
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("../services/metadata-service"),exports),__exportStar(require("./base-client"),exports),__exportStar(require("./config-var-client"),exports),__exportStar(require("./graphql-client"),exports),__exportStar(require("./metadata-client"),exports);
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("../services/metadata-service"),exports),__exportStar(require("./base-client"),exports),__exportStar(require("./config-template-client"),exports),__exportStar(require("./config-var-client"),exports),__exportStar(require("./graphql-client"),exports),__exportStar(require("./metadata-client"),exports),__exportStar(require("./org-preference-client"),exports);
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,s){function r(t){try{a(o.next(t))}catch(t){s(t)}}function T(t){try{a(o.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,T)}a((o=o.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MobileNotificationClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class MobileNotificationClient extends base_client_1.BaseClient{getTemplates(){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.GET_TEMPLATES})}))}deleteTemplate(t,e){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HttpMethod.DELETE,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.DELETE_TEMPLATE(t,e)})}))}setTemplate(t,e,n){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SET_TEMPLATE(t,e),body:{template:n}})}))}dispatchResources(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.DISPATCH,body:t})}))}notifyAllocatedResources(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.NOTIFY,body:t})}))}notifyJobCancellation(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.NOTIFY_CANCEL,body:t})}))}sendOneOffMessage(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.ONE_OFF,body:t})}))}sendSms(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SEND_SMS,body:t})}))}requestSmsConfirmation(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SMS_CONFIRMATION_REQUEST,body:t})}))}}exports.MobileNotificationClient=MobileNotificationClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrgPreferenceClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class OrgPreferenceClient extends base_client_1.BaseClient{get(){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.ORG_PREFERENCE.GET})}))}deploy(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.ORG_PREFERENCE.UPDATE,body:e})}))}}exports.OrgPreferenceClient=OrgPreferenceClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VocabularyClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class VocabularyClient extends base_client_1.BaseClient{getVocabularyItems(t,e){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.GET_ITEMS(t,e)})}))}addVocabularyItem(t,e,n){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.ADD_ITEM(t,e),body:n})}))}updateVocabularyItem(t,e,n,o){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:constants_1.HttpMethod.PUT,endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.UPDATE_ITEM(t,e,n),body:o})}))}}exports.VocabularyClient=VocabularyClient;
@@ -0,0 +1 @@
1
+ "use strict";var ArtifactType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArtifactType=void 0,function(o){o.CUSTOM_OBJECT="custom-object",o.CUSTOM_FIELD="custom-field",o.FUNCTION="function",o.MOBILE_EXTENSION="mobile-extension",o.PUBLIC_PAGE="public-page",o.TRIGGERED_ACTION="triggered-action",o.USER_ROLE="user-role",o.WEBHOOK="webhook",o.HORIZON_CUSTOM_RESOURCE="horizon-custom-resource",o.HORIZON_PAGE="horizon-page",o.HORIZON_TEMPLATE="horizon-template",o.HORIZON_TENANT_CONFIG="horizon-tenant-config",o.HORIZON_COMPONENT_BUNDLE="horizon-component-bundle",o.HORIZON_VIEW_TYPE="horizon-view-type",o.HORIZON_CUSTOM_ACTION="horizon-custom-action",o.HORIZON_VIEW_STATE="horizon-view-state",o.HORIZON_DATA_FIELD_OVERLAY="horizon-data-field-overlay",o.HORIZON_DATA_RELATIONSHIP_OVERLAY="horizon-data-relationship-overlay",o.HORIZON_LIST_CONFIG="horizon-list-config",o.HORIZON_LIST_VIEW_STATE="horizon-list-view-state"}(ArtifactType||(exports.ArtifactType=ArtifactType={}));
@@ -0,0 +1 @@
1
+ "use strict";var ConfigVariableType,ConfigVariableStatus;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVariableStatus=exports.ConfigVariableType=void 0,function(e){e.PLAIN_TEXT="plain-text",e.SECRET="secret"}(ConfigVariableType||(exports.ConfigVariableType=ConfigVariableType={})),function(e){e.ACTIVE="active",e.INACTIVE="inactive",e.EXPIRED="expired"}(ConfigVariableStatus||(exports.ConfigVariableStatus=ConfigVariableStatus={}));