@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/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## [v0.0.6] - 2025-02-06
4
+ ### Added
5
+ - API Clients for Artifact, Vocabulary, Config Templates, and Org Preference, Notification APIs.
6
+
7
+ ## [v0.0.5] - 2025-03-03
8
+ ### Initial Release
9
+ - First version of the project.
package/README.md CHANGED
@@ -1,5 +1,30 @@
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
+ - [Artifact Client](#artifact-client)
17
+ - [GraphQL Service](#graphql-service)
18
+ - [Query Data](#query-data)
19
+ - [Update Data](#update-data)
20
+ - [Pagination with Offset](#pagination-with-offset)
21
+ - [Pagination with Cursor](#pagination-with-cursor)
22
+ - [Batch Service](#batch-service)
23
+ - [Cache Service](#cache-service)
24
+ - [Logging Utils](#logging-utils)
25
+
26
+ ## Overview
27
+
3
28
  **@skedulo/pulse-solution-services** provides common services and utilities for building solutions on the Pulse platform.
4
29
 
5
30
  ## Installation
@@ -28,23 +53,46 @@ const context = ExecutionContext.fromCredentials({
28
53
  ```
29
54
  ### API Clients
30
55
 
31
- **Metadata Client**
56
+ #### Metadata Client
32
57
  Fetches metadata from `/metadata` endpoints.
33
58
  ```javascript
34
59
  // Calls /metadata endpoint to retrieve all metadata
35
60
  const metadata = await context.metadataClient.fetchAllMetadata();
36
61
 
37
- // Calls /metadata/{mapping} endpoint to fetches metadata for a specific object
62
+ // Calls /metadata/{mapping} endpoint to fetch metadata for a specific object
38
63
  const jobMetadata = await context.metadataClient.fetchObjectMetadata('job');
39
64
  ```
40
65
 
41
- **GraphQL Client**
66
+ #### Vocabulary Client
67
+ Manages vocabulary items for picklist fields in schemas.
68
+ ```javascript
69
+ // Calls /custom/vocabulary/Jobs/Type to fetch all vocabulary items for the 'Type' field in 'Jobs' schema
70
+ const vocabularyItems = await context.vocabularyClient.getVocabularyItems('Jobs', 'Type');
71
+
72
+ // Calls /custom/vocabulary/Jobs/Type to add a new vocabulary item
73
+ const newVocabularyItem = await context.vocabularyClient.addVocabularyItem('Jobs', 'Type', {
74
+ value: "Repair",
75
+ label: "Repair Service",
76
+ active: true,
77
+ defaultValue: false,
78
+ description: "A repair job type"
79
+ });
80
+
81
+ // Calls /custom/vocabulary/Jobs/Type/Upgrade to update the 'Upgrade' vocabulary item
82
+ const updatedVocabularyItem = await context.vocabularyClient.updateVocabularyItem('Jobs', 'Type', 'Upgrade', {
83
+ value: "Upgrade",
84
+ label: "System Upgrade",
85
+ description: "An upgraded system installation"
86
+ });
87
+ ```
88
+
89
+ #### GraphQL Client
42
90
  Executes GraphQL queries and mutations against `/graphql/graphql`.
43
91
  ```javascript
44
92
  const queryResult = await context.graphqlClient.query(queryParams);
45
93
  ```
46
94
 
47
- **Config Variable Client**
95
+ #### Config Variable Client
48
96
  Provides CRUD and search methods for managing configuration variables.
49
97
  ```javascript
50
98
  // Calls /configuration/extension endpoint to create a configuration var
@@ -58,9 +106,203 @@ await context.configVarClient.create({
58
106
  const config = await context.configVarClient.get('TEST_KEY');
59
107
  ```
60
108
 
109
+ #### Org Preferences Client
110
+ Fetch Org Preferences from the `/config/org_preference` endpoint.
111
+ ```javascript
112
+ // Get
113
+ const config: Record<string, any> = await context.orgPreferencesClient.get();
114
+
115
+ // Update
116
+ const jobConfig = {
117
+ allowAbortJob:false
118
+ }
119
+ const config: Record<string, any> = await context.orgPreferencesClient.deploy(jobConfig);
120
+ ```
121
+
122
+ #### Config Features (Feature Flags) Client
123
+ Fetch Config Features from the `/config/features` endpoint.
124
+ ```javascript
125
+ // Get
126
+ const config: Record<string, any> = await context.configFeaturesClient.get();
127
+ ```
128
+
129
+ #### Mobile Notification Client
130
+ Manage mobile notifications, SMS messaging, and templates.
131
+
132
+ **Mobile Notification Templates**
133
+ ```javascript
134
+ // Get all mobile notification templates
135
+ const templates = await context.mobileNotificationClient.getTemplates();
136
+
137
+ // Update a template
138
+ await context.mobileNotificationClient.setTemplate(
139
+ NotificationTemplate.JOB_DISPATCH,
140
+ NotificationType.SMS,
141
+ 'Updated text for job dispatch: {{ Name }} starts at {{ Start }}.'
142
+ );
143
+
144
+ // Delete a template
145
+ await context.mobileNotificationClient.deleteTemplate(NotificationTemplate.JOB_DISPATCH, NotificationType.SMS);
146
+ ```
147
+
148
+ **Job Notifications**
149
+ Send notifications related to job dispatch, reminders, cancellations, and custom messages.
150
+ ```javascript
151
+ // Dispatch resources and notify them
152
+ const result: DispatchResponse = await context.mobileNotificationClient.dispatchResources({
153
+ jobId: "12345",
154
+ resourceIds: ["resource-1", "resource-2"]
155
+ });
156
+
157
+ // Notify resources about an allocated job
158
+ const result: NotifyResponse = await context.mobileNotificationClient.notifyAllocatedResources({
159
+ jobId: "12345",
160
+ resourceIds: ["resource-1", "resource-2"]
161
+ });
162
+
163
+ // Notify resources of job cancellation
164
+ const result: NotifyCancelResponse = await context.mobileNotificationClient.notifyJobCancellation({
165
+ jobId: "12345"
166
+ });
167
+
168
+ // Send a one-off message via push notification
169
+ const result: OneOffResponse = await context.mobileNotificationClient.sendOneOffMessage({
170
+ resourceId: "resource-1",
171
+ message: "Reminder: Your job starts in 1 hour.",
172
+ protocol: NotificationType.PUSH
173
+ });
174
+ ```
175
+ **SMS Messaging**
176
+ Send SMS messages or request job confirmations via SMS.
177
+ ```javascript
178
+ // Send an SMS to any phone number
179
+ const result: SmsResponse = await context.mobileNotificationClient.sendSms({
180
+ phoneNumber: "+1234567890",
181
+ countryCode: "US",
182
+ message: "Thank you for confirming your appointment!",
183
+ expectsReply: false
184
+ });
185
+
186
+ // Request job confirmation via SMS
187
+ const result: SmsResponse = await context.mobileNotificationClient.requestSmsConfirmation({
188
+ phoneNumber: "+1234567890",
189
+ countryCode: "US",
190
+ jobId: "12345",
191
+ message: "Please confirm your job by replying YES or NO."
192
+ });
193
+ ```
194
+ #### Configuration Templates
195
+
196
+ **Templates**
197
+ ```javascript
198
+ // Get templates
199
+ const templates: ConfigTemplate[] = await context.configTemplateClient.get('Jobs');
200
+
201
+ // Get teamplate values
202
+ const values: ConfigValue[] = await context.configTemplateClient.getTemmplateValues(templateId);
203
+
204
+ // Delete a template
205
+ const result: Record<string,string> = await context.configTemplateClient.delete(templateId);
206
+ ```
207
+ **Template Values**
208
+ ```javascript
209
+ // Get template values
210
+ const values: {result: ConfigValue[]} = await context.configTemplateClient.getTemmplateValues(templateId);
211
+
212
+ // Create a new template and values
213
+ const newTemplate: ConfigTemplate = {
214
+ name: "Installation",
215
+ schemaName: 'Jobs'
216
+ }
217
+ const createdTemplate: ConfigTemplate = await context.configTemplateClient.create(newTemplate);
218
+ console.log(JSON.stringify(createdTemplate, null, 2));
219
+
220
+ const configTemplateValues: ConfigValue[] = [
221
+ {
222
+ templateId: createdTemplate.id!,
223
+ rel: "job",
224
+ field: "CanBeDeclined",
225
+ value: "true"
226
+ },
227
+ {
228
+ templateId: createdTemplate.id!,
229
+ rel: "job",
230
+ field: "Duration",
231
+ value: "120"
232
+ }
233
+ ]
234
+
235
+ const newValues = await context.configTemplateClient.upsertTemplateValues(createdTemplate.id!, configTemplateValues);
236
+ console.log(JSON.stringify(newValues, null, 2));
237
+ ```
238
+
239
+ #### Artifact Client
240
+ The `ArtifactClient` provides a unified way to manage various artifact types.
241
+ ```javascript
242
+ // Creating an Artifact Client for a specific type
243
+ const client = context.newArtifactClient(ArtifactType.CUSTOM_OBJECT);
244
+ ```
245
+ **Listing All Artifacts**
246
+ Retrieve all artifactse.
247
+ ```javascript
248
+ await client.list();
249
+ ```
250
+
251
+ **Using Artifact Parameters for CRUD Operations**
252
+ When performing CRUD operations, provide `ArtifactParams` with the necessary values based on the artifact type.
253
+ ```javascript
254
+ type ArtifactParams = {
255
+ name?: string; // Artifact name (required for most operations)
256
+ objectName?: string; // Optional identifier for object-based artifacts
257
+ viewTypeName?: string; // Optional view type name if applicable
258
+ scope?: string; // Optional scope if applicable
259
+ };
260
+ ```
261
+ **Notes**
262
+ - Use the object label for `objectName` in Horizon artifacts.
263
+ - `name` is the `slug` for Horizon templates and `defId` for mobile extensions.
264
+ ```javascript
265
+ // Get an artifact
266
+ await client.get({ name: "Jobs" });
267
+
268
+ // Create an artifact
269
+ await client.create({},
270
+ {
271
+ metadata: {
272
+ type: 'CustomObject'
273
+ },
274
+ name: 'Tasks',
275
+ label: 'Tasks',
276
+ description: 'Daily tasks'
277
+ }
278
+ );
279
+
280
+ // Update an artifact
281
+ await client.update(
282
+ {
283
+ name: 'Tasks'
284
+ },
285
+ {
286
+ metadata: {
287
+ type: 'CustomObject'
288
+ },
289
+ name: 'Tasks',
290
+ label: 'Tasks',
291
+ description: 'Daily tasks - updated'
292
+ }
293
+ );
294
+
295
+ // Delete an artifact
296
+ await client.delete(
297
+ {
298
+ name: 'Tasks'
299
+ }
300
+ );
301
+ ```
302
+
61
303
  ### GraphQL Service
62
304
 
63
- **Query data**
305
+ #### Query data
64
306
  ```javascript
65
307
  // Create a query builder for the Resources object
66
308
  const queryBuilder = context.newQueryBuilder('Resources')
@@ -78,7 +320,7 @@ queryBuilder.withChildQuery('JobAllocations')
78
320
  queryBuilder.withParentQuery('PrimaryRegion')
79
321
  .withFields(['UID', 'Name']);
80
322
  // Finally, execute the query via your GraphQL service
81
- const queryResult: QueryResult = await context.graphqlService.query(queryBuilder.build());
323
+ let queryResult = await queryBuilder.execute();
82
324
 
83
325
  console.log(queryResult.records);
84
326
  console.log(queryResult.totalCount); // 5
@@ -86,7 +328,7 @@ console.log(queryResult.pageInfo.hasNextPage); // true
86
328
  console.log(queryResult.endCursor); // Mg==
87
329
  console.log(queryResult.endOffset); // 1
88
330
  ```
89
- **Update data**
331
+ #### Update data
90
332
  ```javascript
91
333
  const recordsToUpdate = queryResult.records.map((record) => {
92
334
  return {
@@ -96,18 +338,18 @@ const recordsToUpdate = queryResult.records.map((record) => {
96
338
  });
97
339
  const updateResult = await context.graphqlService.update('Resources', recordsToUpdate);
98
340
  ```
99
- **Pagination with offset**
341
+ #### Pagination with offset
100
342
  ```javascript
101
343
  while(queryResult.pageInfo.hasNextPage) {
102
344
  queryBuilder.withOffset(queryResult.endOffset + 1);
103
- queryResult = await context.graphqlService.query(queryBuilder.build());
345
+ queryResult = await queryBuilder.execute();
104
346
  }
105
347
  ```
106
- **Pagination with cursor**
348
+ #### Pagination with cursor
107
349
  ```javascript
108
350
  while(queryResult.pageInfo.hasNextPage) {
109
351
  queryBuilder.withCursor(queryResult.endCursor);
110
- queryResult = await context.graphqlService.query(queryBuilder.build());
352
+ queryResult = await queryBuilder.execute();
111
353
  }
112
354
  ```
113
355
 
@@ -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,19 @@
1
+ import { BaseClient } from "../base-client";
2
+ type ArtifactParams = {
3
+ objectName?: string;
4
+ viewTypeName?: string;
5
+ name?: string;
6
+ scope?: string;
7
+ };
8
+ export declare class ArtifactClient extends BaseClient {
9
+ private artifactType;
10
+ private baseEndpoint;
11
+ constructor(config: any, artifactType: string);
12
+ list<T>(): Promise<T[]>;
13
+ get<T>(params?: ArtifactParams): Promise<T>;
14
+ create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
15
+ update<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
16
+ delete(params: ArtifactParams): Promise<void>;
17
+ private buildEndpoint;
18
+ }
19
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}u((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.HTTP_METHOD.POST,endpoint:this.buildEndpoint(t),body:e})}))}update(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HTTP_METHOD.PUT,endpoint:this.buildEndpoint(t),body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HTTP_METHOD.DELETE,endpoint:this.buildEndpoint(t)})}))}buildEndpoint(t){const{objectName:e,viewTypeName:i,name:n,scope:r}=t;let o=this.baseEndpoint;return e&&(o+=`/${e}`),i&&(o+=`/${i}`),n&&(o+=`/${n}`),r&&(o+=`/${r}`),o}}exports.ArtifactClient=ArtifactClient;
@@ -0,0 +1,14 @@
1
+ import { BaseClient } from "../base-client";
2
+ /**
3
+ * Handles artifacts that only require `name` in the endpoint.
4
+ */
5
+ export declare class BaseArtifactClient extends BaseClient {
6
+ protected artifactType: string;
7
+ protected artifactEndpoint: string;
8
+ constructor(config: any, artifactType: string);
9
+ list<T>(): Promise<T[]>;
10
+ get<T>(name: string): Promise<T>;
11
+ create<T>(name: string, artifactData: Partial<T>): Promise<T>;
12
+ update<T>(name: string, artifactData: Partial<T>): Promise<T>;
13
+ delete(name: string): Promise<void>;
14
+ }
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,a){function o(t){try{c(n.next(t))}catch(t){a(t)}}function s(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseArtifactClient=void 0;const constants_1=require("../../constants"),base_client_1=require("../base-client");class BaseArtifactClient extends base_client_1.BaseClient{constructor(t,e){super(t),this.artifactType=e,this.artifactEndpoint=`artifacts/${this.artifactType}`}list(){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({endpoint:this.artifactEndpoint})}))}get(t){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({endpoint:`${this.artifactEndpoint}/${t}`})}))}create(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HTTP_METHOD.POST,endpoint:`${this.artifactEndpoint}/${t}`,body:e})}))}update(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HTTP_METHOD.PUT,endpoint:`${this.artifactEndpoint}/${t}`,body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HTTP_METHOD.DELETE,endpoint:`${this.artifactEndpoint}/${t}`})}))}}exports.BaseArtifactClient=BaseArtifactClient;
@@ -0,0 +1,11 @@
1
+ import { BaseArtifactClient } from "./base-artifact-client";
2
+ /**
3
+ * Handles artifacts that require both `objectName` and `name` in the endpoint.
4
+ */
5
+ export declare class ObjectBasedArtifactClient extends BaseArtifactClient {
6
+ constructor(config: any, artifactType: string);
7
+ getArtifact<T>(objectName: string, name: string): Promise<T>;
8
+ createOrUpdateArtifact<T>(objectName: string, name: string, artifactData: Partial<T>): Promise<T>;
9
+ updateArtifact<T>(objectName: string, name: string, artifactData: Partial<T>): Promise<T>;
10
+ deleteArtifact(objectName: string, name: string): Promise<void>;
11
+ }
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,a){function o(t){try{s(n.next(t))}catch(t){a(t)}}function c(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,c)}s((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ObjectBasedArtifactClient=void 0;const constants_1=require("../../constants"),base_artifact_client_1=require("./base-artifact-client");class ObjectBasedArtifactClient extends base_artifact_client_1.BaseArtifactClient{constructor(t,e){super(t,e)}getArtifact(t,e){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({endpoint:`${this.artifactEndpoint}/${t}/${e}`})}))}createOrUpdateArtifact(t,e,i){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HTTP_METHOD.POST,endpoint:`${this.artifactEndpoint}/${t}/${e}`,body:i})}))}updateArtifact(t,e,i){return __awaiter(this,void 0,void 0,(function*(){return this.performRequest({method:constants_1.HTTP_METHOD.PUT,endpoint:`${this.artifactEndpoint}/${t}/${e}`,body:i})}))}deleteArtifact(t,e){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:constants_1.HTTP_METHOD.DELETE,endpoint:`${this.artifactEndpoint}/${t}/${e}`})}))}}exports.ObjectBasedArtifactClient=ObjectBasedArtifactClient;
@@ -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,i){return new(n||(n=Promise))((function(o,s){function r(t){try{d(i.next(t))}catch(t){s(t)}}function a(t){try{d(i.throw(t))}catch(t){s(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(r,a)}d((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomFieldClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class CustomFieldClient extends base_client_1.BaseClient{getCustomFields(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_FIELD.GET_FIELDS(t)})}))}createStandaloneField(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:"POST",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_FIELD.CREATE_STANDALONE,body:t})}))}updateCustomField(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:"POST",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_FIELD.UPDATE,body:t})}))}deleteStandaloneField(t){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:"DELETE",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_FIELD.DELETE_STANDALONE(t)})}))}}exports.CustomFieldClient=CustomFieldClient;
@@ -0,0 +1 @@
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,s){function r(t){try{c(i.next(t))}catch(t){s(t)}}function a(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomSchemaClient=void 0;const constants_1=require("../constants"),base_client_1=require("./base-client");class CustomSchemaClient extends base_client_1.BaseClient{getCustomSchemas(){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_SCHEMA.GET_ALL})}))}updateCustomSchemas(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:"POST",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_SCHEMA.UPDATE,body:t})}))}createStandaloneSchema(t){return __awaiter(this,void 0,void 0,(function*(){return yield this.performRequest({method:"POST",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_SCHEMA.CREATE_STANDALONE,body:t})}))}deleteStandaloneSchema(t){return __awaiter(this,void 0,void 0,(function*(){yield this.performRequest({method:"DELETE",endpoint:constants_1.TENANT_ENDPOINTS.CUSTOM_SCHEMA.DELETE_STANDALONE(t)})}))}}exports.CustomSchemaClient=CustomSchemaClient;
@@ -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 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={}));
@@ -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={}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HTTP_METHOD=void 0,exports.HTTP_METHOD={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH"};
1
+ "use strict";var HttpMethod;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpMethod=void 0,function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.DELETE="DELETE",t.PATCH="PATCH"}(HttpMethod||(exports.HttpMethod=HttpMethod={}));
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=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("./config-var"),exports),__exportStar(require("./http"),exports),__exportStar(require("./tenant-endpoints"),exports),__exportStar(require("./tenant-objects"),exports);
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),__exportStar=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||__createBinding(e,t,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./artifact-constants"),exports),__exportStar(require("./config-var-constants"),exports),__exportStar(require("./http"),exports),__exportStar(require("./mobile-notification-constants"),exports),__exportStar(require("./tenant-endpoints"),exports),__exportStar(require("./tenant-objects"),exports);
@@ -0,0 +1 @@
1
+ "use strict";var NotificationTemplate,NotificationType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationType=exports.NotificationTemplate=void 0,function(i){i.JOB_DISPATCH="job_dispatch",i.JOB_REMINDER="job_reminder",i.JOB_CANCELLED="job_cancelled",i.JOB_OFFER="job_offer"}(NotificationTemplate||(exports.NotificationTemplate=NotificationTemplate={})),function(i){i.SMS="sms",i.PUSH="push"}(NotificationType||(exports.NotificationType=NotificationType={}));
@@ -0,0 +1 @@
1
+ "use strict";var NotificationTemplate,NotificationType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationType=exports.NotificationTemplate=void 0,function(i){i.JOB_DISPATCH="job_dispatch",i.JOB_REMINDER="job_reminder",i.JOB_CANCELLED="job_cancelled",i.JOB_OFFER="job_offer"}(NotificationTemplate||(exports.NotificationTemplate=NotificationTemplate={})),function(i){i.SMS="sms",i.PUSH="push"}(NotificationType||(exports.NotificationType=NotificationType={}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TENANT_ENDPOINTS=void 0,exports.TENANT_ENDPOINTS={CONFIG_VAR:{CREATE:"configuration/extension",GET:e=>`configuration/extension/${e}`,UPDATE:e=>`configuration/extension/${e}`,DELETE:e=>`configuration/extension/${e}`,SEARCH:"configuration/extension/search"},GRAPHQL:"graphql/graphql",METADATA:{ALL:"custom/metadata",OBJECT:e=>`custom/metadata/${e}`}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TENANT_ENDPOINTS=void 0,exports.TENANT_ENDPOINTS={CONFIG_VAR:{CREATE:"configuration/extension",GET:t=>`configuration/extension/${t}`,UPDATE:t=>`configuration/extension/${t}`,DELETE:t=>`configuration/extension/${t}`,SEARCH:"configuration/extension/search"},GRAPHQL:"graphql/graphql",METADATA:{ALL:"custom/metadata",OBJECT:t=>`custom/metadata/${t}`},ORG_PREFERENCE:{GET:"config/org_preference",UPDATE:"config/org_preference"},CONFIG_TEMPLATE:{GET_TEMPLATES:t=>`config/templates/${t}`,GET_VALUES:t=>`config/template/${t}/values`,UPDATE_VALUES:t=>`config/template/${t}/values`,CREATE:"config/template",DELETE:t=>`config/template/${t}`},CONFIG_FEATURES:{GET:"config/features",UPDATE:t=>`config/features/${t}`},VOCABULARY:{GET_ITEMS:(t,o)=>`custom/vocabulary/${t}/${o}`,ADD_ITEM:(t,o)=>`custom/vocabulary/${t}/${o}`,UPDATE_ITEM:(t,o,i)=>`custom/vocabulary/${t}/${o}/${i}`},NOTIFICATIONS:{GET_TEMPLATES:"notifications/v2/templates",DELETE_TEMPLATE:(t,o)=>`notifications/v2/template/${t}/${o}`,SET_TEMPLATE:(t,o)=>`notifications/v2/template/${t}/${o}`,DISPATCH:"notifications/dispatch",NOTIFY:"notifications/notify",NOTIFY_CANCEL:"notifications/notify_cancel",ONE_OFF:"notifications/oneoff",SEND_SMS:"notifications/sms",SMS_CONFIRMATION_REQUEST:"notifications/sms/confirmation_request"}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TENANT_OBJECTS=void 0,exports.TENANT_OBJECTS={Accounts:"Accounts",Jobs:"Jobs",JobAllocations:"JobAllocations",Regions:"Regions",Contacts:"Contacts",Locations:"Locations",Resources:"Resources",Tags:"Tags",JobTags:"JobTags",ResourceTags:"ResourceTags",Activities:"Activities",Availabilities:"Availabilities",Holidays:"Holidays",AvailabilityPatterns:"AvailabilityPatterns",AvailabilityPatternResources:"AvailabilityPatternResources",AccountResourceScores:"AccountResourceScores",LocationResourceScores:"LocationResourceScores",Products:"Products",JobProducts:"JobProducts"};
1
+ "use strict";var TenantObject;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TenantObject=void 0,function(e){e.Accounts="Accounts",e.Jobs="Jobs",e.JobAllocations="JobAllocations",e.Regions="Regions",e.Contacts="Contacts",e.Locations="Locations",e.Resources="Resources",e.Tags="Tags",e.JobTags="JobTags",e.ResourceTags="ResourceTags",e.Activities="Activities",e.Availabilities="Availabilities",e.Holidays="Holidays",e.AvailabilityPatterns="AvailabilityPatterns",e.AvailabilityPatternResources="AvailabilityPatternResources",e.AccountResourceScores="AccountResourceScores",e.LocationResourceScores="LocationResourceScores",e.Products="Products",e.JobProducts="JobProducts"}(TenantObject||(exports.TenantObject=TenantObject={}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExecutionContext=void 0;const function_utilities_1=require("@skedulo/function-utilities"),config_var_client_1=require("../clients/config-var-client"),graphql_client_1=require("../clients/graphql-client"),metadata_client_1=require("../clients/metadata-client"),logging_1=require("../logging"),cache_service_1=require("../services/cache/cache-service"),storage_1=require("../services/cache/storage"),graphql_1=require("../services/graphql"),metadata_service_1=require("../services/metadata-service"),utils_1=require("../utils");class ExecutionContext{constructor(e){this.skedContext=e,this.contextData={},this.baseConfig={apiToken:e.auth.token,apiServer:e.auth.baseUrl}}static fromContext(e){return new ExecutionContext(e)}static fromCredentials({apiServer:e,apiToken:t}){const i={Authorization:`Bearer ${t}`,"sked-api-server":e},r=(0,function_utilities_1.createSkedContext)(i);return new ExecutionContext(r)}get logger(){return this._logger=this.lazyInit(this._logger,(()=>new logging_1.Logger))}get configHelper(){return this._configHelper=this.lazyInit(this._configHelper,(()=>new utils_1.ConfigHelper(this.skedContext.configVars)))}get graphqlClient(){return this._graphqlClient=this.lazyInit(this._graphqlClient,(()=>new graphql_client_1.GraphQLClient(this.baseConfig)))}get graphqlService(){return this._graphqlService=this.lazyInit(this._graphqlService,(()=>new graphql_1.GraphQLService(this.graphqlClient)))}newQueryBuilder(e){return new graphql_1.GraphQLQueryBuilder(e)}get metadataClient(){return this._metadataClient=this.lazyInit(this._metadataClient,(()=>new metadata_client_1.MetadataClient(this.baseConfig)))}get metadataService(){return this._metadataService=this.lazyInit(this._metadataService,(()=>new metadata_service_1.MetadataService(this.metadataClient)))}get configVarClient(){return this._configVarClient=this.lazyInit(this._configVarClient,(()=>new config_var_client_1.ConfigVarClient(this.baseConfig)))}get configVarCache(){if(!this._configVarCache){if(!this.configVarClient)throw new Error("ConfigVarClient is not initialized.");this._configVarCache=this.lazyInit(this._configVarCache,(()=>new cache_service_1.CacheService(new storage_1.ConfigVarCacheStorage(this.configVarClient))))}return this._configVarCache}get inMemoryCache(){return this._inMemoryCache||(this._inMemoryCache=this.lazyInit(this._inMemoryCache,(()=>new cache_service_1.CacheService(new storage_1.InMemoryCacheStorage))),this._inMemoryCache.setSecondaryCache(this.configVarCache)),this._inMemoryCache}dispose(){this._logger=void 0,this._configHelper=void 0,this._graphqlClient=void 0,this._graphqlService=void 0,this._metadataClient=void 0,this._metadataService=void 0,this._configVarClient=void 0,this._inMemoryCache=void 0}lazyInit(e,t){return null!=e?e:t()}}exports.ExecutionContext=ExecutionContext;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExecutionContext=void 0;const function_utilities_1=require("@skedulo/function-utilities"),artifact_client_1=require("../clients/artifact-client"),config_features_client_1=require("../clients/config-features-client"),config_template_client_1=require("../clients/config-template-client"),config_var_client_1=require("../clients/config-var-client"),graphql_client_1=require("../clients/graphql-client"),metadata_client_1=require("../clients/metadata-client"),mobile_notification_client_1=require("../clients/mobile-notification-client"),org_preference_client_1=require("../clients/org-preference-client"),vocabulary_client_1=require("../clients/vocabulary-client"),logger_1=__importDefault(require("../logging/logger")),cache_service_1=require("../services/cache/cache-service"),storage_1=require("../services/cache/storage"),graphql_1=require("../services/graphql"),metadata_service_1=require("../services/metadata-service"),utils_1=require("../utils");class ExecutionContext{constructor(e){this.logger=logger_1.default,this.services=new Map,this.skedContext=e,this.contextData={},this.baseConfig={apiToken:e.auth.token,apiServer:e.auth.baseUrl}}static fromContext(e){return new ExecutionContext(e)}static fromCredentials(e){const t={Authorization:`Bearer ${e.apiToken}`,"sked-api-server":e.apiServer},i=(0,function_utilities_1.createSkedContext)(t),r=new ExecutionContext(i);return r.baseConfig=Object.assign(Object.assign({},e),r.baseConfig),r}getOrCreateService(e,t){return this.services.has(e)||this.services.set(e,t()),this.services.get(e)}get configHelper(){return this.getOrCreateService("configHelper",(()=>new utils_1.ConfigHelper(this.skedContext.configVars)))}get graphqlClient(){return this.getOrCreateService("graphqlClient",(()=>new graphql_client_1.GraphQLClient(this.baseConfig)))}get graphqlService(){return this.getOrCreateService("graphqlService",(()=>new graphql_1.GraphQLService(this.graphqlClient)))}get metadataClient(){return this.getOrCreateService("metadataClient",(()=>new metadata_client_1.MetadataClient(this.baseConfig)))}get metadataService(){return this.getOrCreateService("metadataService",(()=>new metadata_service_1.MetadataService(this.metadataClient)))}get vocabularyClient(){return this.getOrCreateService("vocabularyClient",(()=>new vocabulary_client_1.VocabularyClient(this.baseConfig)))}get orgPreferencesClient(){return this.getOrCreateService("orgPreferencesClient",(()=>new org_preference_client_1.OrgPreferenceClient(this.baseConfig)))}get configTemplateClient(){return this.getOrCreateService("configTemplateClient",(()=>new config_template_client_1.ConfigTemplateClient(this.baseConfig)))}get configFeaturesClient(){return this.getOrCreateService("configFeaturesClient",(()=>new config_features_client_1.ConfigFeaturesClient(this.baseConfig)))}get configVarClient(){return this.getOrCreateService("configVarClient",(()=>new config_var_client_1.ConfigVarClient(this.baseConfig)))}get mobileNotificationClient(){return this.getOrCreateService("mobileNotificationClient",(()=>new mobile_notification_client_1.MobileNotificationClient(this.baseConfig)))}get configVarCache(){return this.getOrCreateService("configVarCache",(()=>new cache_service_1.CacheService(new storage_1.ConfigVarCacheStorage(this.configVarClient))))}get inMemoryCache(){return this.getOrCreateService("inMemoryCache",(()=>{const e=new cache_service_1.CacheService(new storage_1.InMemoryCacheStorage);return e.setSecondaryCache(this.configVarCache),e}))}newQueryBuilder(e){const t=new graphql_1.GraphQLQueryBuilder(e);return t.setGraphqlService(this.graphqlService),t}newArtifactClient(e){return this.getOrCreateService(`${e}Client`,(()=>new artifact_client_1.ArtifactClient(this.baseConfig,e)))}dispose(){this.services.clear()}}exports.ExecutionContext=ExecutionContext;