@skedulo/pulse-solution-services 0.0.13 → 0.0.15

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 (67) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +11 -1
  3. package/dist/clients/artifact-client.js +1 -1
  4. package/dist/clients/availability-api-client.js +1 -1
  5. package/dist/clients/base-client.js +1 -1
  6. package/dist/clients/config-features-client.js +1 -1
  7. package/dist/clients/config-template-client.js +1 -1
  8. package/dist/clients/config-var-client.js +1 -1
  9. package/dist/clients/files-api-client.js +1 -1
  10. package/dist/clients/geo-api-client.js +1 -1
  11. package/dist/clients/graphql-client.js +1 -1
  12. package/dist/clients/metadata-client.js +1 -1
  13. package/dist/clients/mobile-notification-client.js +1 -1
  14. package/dist/clients/org-preference-client.js +1 -1
  15. package/dist/clients/vocabulary-client.js +1 -1
  16. package/dist/core/request-header-constants.js +1 -1
  17. package/dist/index.d.ts +9 -4
  18. package/dist/logging/decorators/log-method.js +1 -1
  19. package/dist/monitoring/decorators/monitor-call.js +1 -1
  20. package/dist/monitoring/monitoring-manager.js +1 -1
  21. package/dist/services/cache/cache-service.js +1 -1
  22. package/dist/services/cache/storage/config-var-cache-storage.js +1 -1
  23. package/dist/services/cache/storage/in-memory-cache-storage.js +1 -1
  24. package/dist/services/geoservice.js +1 -1
  25. package/dist/services/graph-batch/graph-batch.js +1 -1
  26. package/dist/services/graph-batch/unique-graph-batch.js +1 -1
  27. package/dist/services/graphql/graphql-service.js +1 -1
  28. package/dist/services/lock-service.js +1 -1
  29. package/dist/services/metadata-service.js +1 -1
  30. package/dist/services/resource-availability/builder/data-service.js +1 -1
  31. package/dist/services/resource-availability/builder/resource-availability-service.js +1 -1
  32. package/dist/services/resource-availability/builder/resource-builder.js +1 -1
  33. package/package.json +2 -2
  34. package/yarn.lock +522 -639
  35. package/dist/interfaces/locking-service-interfaces.js +0 -1
  36. package/dist/monitoring/monitor-call.decorator.js +0 -1
  37. package/dist/services/batch-processor/batch-orchestrator.d.ts +0 -18
  38. package/dist/services/batch-processor/batch-orchestrator.js +0 -1
  39. package/dist/services/batch-processor/constants.d.ts +0 -22
  40. package/dist/services/batch-processor/constants.js +0 -1
  41. package/dist/services/batch-processor/fetching-strategies/batch-number-fetching-strategy.d.ts +0 -6
  42. package/dist/services/batch-processor/fetching-strategies/batch-number-fetching-strategy.js +0 -1
  43. package/dist/services/batch-processor/fetching-strategies/cursor-based-fetching-strategy.d.ts +0 -8
  44. package/dist/services/batch-processor/fetching-strategies/cursor-based-fetching-strategy.js +0 -1
  45. package/dist/services/batch-processor/fetching-strategies/date-based-fetching-strategy.d.ts +0 -4
  46. package/dist/services/batch-processor/fetching-strategies/date-based-fetching-strategy.js +0 -1
  47. package/dist/services/batch-processor/fetching-strategies/fetching-strategy-factory.d.ts +0 -9
  48. package/dist/services/batch-processor/fetching-strategies/fetching-strategy-factory.js +0 -1
  49. package/dist/services/batch-processor/fetching-strategies/index.d.ts +0 -1
  50. package/dist/services/batch-processor/fetching-strategies/index.js +0 -1
  51. package/dist/services/batch-processor/index.d.ts +0 -2
  52. package/dist/services/batch-processor/index.js +0 -1
  53. package/dist/services/batch-processor/interfaces.d.ts +0 -33
  54. package/dist/services/batch-processor/interfaces.js +0 -1
  55. package/dist/services/batch-processor/workers/custom-worker.d.ts +0 -5
  56. package/dist/services/batch-processor/workers/custom-worker.js +0 -1
  57. package/dist/services/batch-processor/workers/delete-worker.d.ts +0 -4
  58. package/dist/services/batch-processor/workers/delete-worker.js +0 -1
  59. package/dist/services/batch-processor/workers/index.d.ts +0 -2
  60. package/dist/services/batch-processor/workers/index.js +0 -1
  61. package/dist/services/batch-processor/workers/update-worker.d.ts +0 -4
  62. package/dist/services/batch-processor/workers/update-worker.js +0 -1
  63. package/dist/services/batch-processor/workers/worker-factory.d.ts +0 -6
  64. package/dist/services/batch-processor/workers/worker-factory.js +0 -1
  65. package/dist/services/batch-processor/workers/worker-interfaces.d.ts +0 -4
  66. package/dist/services/batch-processor/workers/worker-interfaces.js +0 -1
  67. package/dist/services/locking-service.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.0.15] - 2025-05-21
4
+ ### Updated
5
+ - Enable GraphQLRequest with variable to graphqlClient
6
+
7
+ ## [v0.0.14] - 2025-05-21
8
+ ### Added
9
+ - Add graphql mutation option to suppress change events.
10
+
3
11
  ## [v0.0.12] - 2025-03-19
4
12
  ### Updated
5
13
  - Include `baseClient.performRequest` in execution limits calculation.
package/README.md CHANGED
@@ -187,7 +187,15 @@ const updatedVocabularyItem = await context.vocabularyClient.updateVocabularyIte
187
187
  #### GraphQL Client
188
188
  Executes GraphQL queries and mutations against `/graphql/graphql`.
189
189
  ```javascript
190
+ // execute final query string
190
191
  const queryResult = await context.graphqlClient.execute(queryString, {readOnly: true});
192
+
193
+ // using query string with variables
194
+ const graphQLRequest: GraphQLRequest = {
195
+ query: queryString,
196
+ variables: {}
197
+ }
198
+ const queryUsingVariablesResult = await context.graphqlClient.execute(graphQLRequest, {readOnly: true});
191
199
  ```
192
200
 
193
201
  #### Config Variable Client
@@ -536,11 +544,13 @@ const updateResult = await context.graphqlService.mutate({
536
544
  operation: GraphqlOperations.UPDATE,
537
545
  operationName: 'updateResources',
538
546
  records: recordsToUpdate,
539
- bulkOperation: true // optional
547
+ bulkOperation: true, // optional
548
+ suppressChangeEvents: true // optional
540
549
  });
541
550
  ```
542
551
 
543
552
  The `bulkOperation` and `readOnly` options help optimize large-scale mutations and read-heavy queries. When enabled, they automatically add the `X-Skedulo-Bulk-Operation` (for mutations) and `X-Skedulo-Read-Only` (for queries) headers to improve performance.
553
+ To reduce the impact on change event processing, especially during high-volume mutations, the `suppressChangeEvents` option can be used. This disables change history tracking, helping to minimize delays.
544
554
 
545
555
  #### Pagination with offset
546
556
  ```javascript
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,i){var a,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(o<3?a(r):o>3?a(e,n,r):a(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(a,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArtifactClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ArtifactClient extends base_client_1.BaseClient{constructor(t,e,n={}){super(t,n),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:n,name:i,scope:a}=t;let o=this.baseEndpoint;return e&&(o+=`/${e}`),n&&(o+=`/${n}`),i&&(o+=`/${i}`),a&&(o+=`/${a}`),o}}exports.ArtifactClient=ArtifactClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"list",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"create",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"update",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"delete",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var i,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,a,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(o<3?i(r):o>3?i(e,a,r):i(e,a))||r);return o>3&&r&&Object.defineProperty(e,a,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArtifactClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ArtifactClient extends base_client_1.BaseClient{constructor(t,e,a={}){super(t,a),this.artifactType=e,this.baseEndpoint=`artifacts/${this.artifactType}`}async list(){return this._performRequest({endpoint:this.baseEndpoint})}async get(t={}){return this._performRequest({endpoint:this.buildEndpoint(t)})}async create(t,e){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:this.buildEndpoint(t),body:e})}async update(t,e){return this._performRequest({method:constants_1.HttpMethod.PUT,endpoint:this.buildEndpoint(t),body:e})}async delete(t){await this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:this.buildEndpoint(t)})}buildEndpoint(t){const{objectName:e,viewTypeName:a,name:n,scope:i}=t;let o=this.baseEndpoint;return e&&(o+=`/${e}`),a&&(o+=`/${a}`),n&&(o+=`/${n}`),i&&(o+=`/${i}`),o}}exports.ArtifactClient=ArtifactClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"list",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"create",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"update",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"delete",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,i,n){var r,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(o=(a<3?r(o):a>3?r(t,i,o):r(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o},__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,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,l)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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 a={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:a})}))}}exports.AvailabilityAPIClient=AvailabilityAPIClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],AvailabilityAPIClient.prototype,"fetchAvailability",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,i,a){var r,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class AvailabilityAPIClient extends base_client_1.BaseClient{async fetchAvailability(e){var t,i,a,r;if(!e.resourceIds.length)throw new Error("At least one resource ID must be provided.");const n={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===(a=e.entries)||void 0===a?void 0:a.toString())&&void 0!==r?r:"true"};return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.SIMPLE,queryParams:n})}}exports.AvailabilityAPIClient=AvailabilityAPIClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],AvailabilityAPIClient.prototype,"fetchAvailability",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},__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 s(e){try{c(r.next(e))}catch(e){i(e)}}function a(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(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseClient=void 0;const request_header_constants_1=require("../core/request-header-constants"),logging_1=require("../logging"),monitor_call_1=require("../monitoring/decorators/monitor-call");class BaseClient{constructor(e,t={}){this.config=e,this.executionOptions=t}performRequest(e){return __awaiter(this,arguments,void 0,(function*({method:e="GET",endpoint:t,headers:n={},body:r,queryParams:o},i=this.executionOptions){return this._performRequest({method:e,endpoint:t,headers:n,body:r,queryParams:o},i)}))}_performRequest(e){return __awaiter(this,arguments,void 0,(function*({method:e="GET",endpoint:t,headers:n={},body:r,queryParams:o},i=this.executionOptions){try{const s=Object.assign(Object.assign({},this.getHeaders(i)),n),a=this.buildUrl(t,o),c=yield fetch(a,{method:e,headers:s,body:r&&"GET"!==e?JSON.stringify(r):void 0});let u;const d=c.headers.get("content-type");if(d&&d.includes("application/json")?(u=yield c.json(),u.result&&(u=u.result)):u=yield c.text(),!c.ok)throw new Error(`HTTP error! Status: ${c.status}. Response: ${JSON.stringify(u)}`);return this.handleResponseData(u),u}catch(e){throw this.handleException(e),e}}))}handleResponseData(e){}getHeaders(e){var t,n;const r={Authorization:`Bearer ${this.config.apiToken}`,"Content-Type":"application/json"},o=e.requestSource||(null===(t=this.executionOptions)||void 0===t?void 0:t.requestSource),i=e.userAgent||(null===(n=this.executionOptions)||void 0===n?void 0:n.userAgent);return o&&(r[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_SOURCE]=o),i&&(r[request_header_constants_1.REQUEST_HEADERS.USER_AGENT]=i),r}buildUrl(e,t){const n=e.startsWith("http")?new URL(e):new URL(`${this.config.apiServer}/${e}`);return t&&Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,t)})),n.toString()}handleException(e){}}exports.BaseClient=BaseClient,__decorate([(0,logging_1.LogMethod)(),(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],BaseClient.prototype,"performRequest",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,r,o){var n,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;i>=0;i--)(n=e[i])&&(a=(s<3?n(a):s>3?n(t,r,a):n(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseClient=void 0;const request_header_constants_1=require("../core/request-header-constants"),logging_1=require("../logging"),monitor_call_1=require("../monitoring/decorators/monitor-call");class BaseClient{constructor(e,t={}){this.config=e,this.executionOptions=t}async performRequest({method:e="GET",endpoint:t,headers:r={},body:o,queryParams:n},s=this.executionOptions){return this._performRequest({method:e,endpoint:t,headers:r,body:o,queryParams:n},s)}async _performRequest({method:e="GET",endpoint:t,headers:r={},body:o,queryParams:n},s=this.executionOptions){try{const a=Object.assign(Object.assign({},this.getHeaders(s)),r),i=this.buildUrl(t,n),c=await fetch(i,{method:e,headers:a,body:o&&"GET"!==e?JSON.stringify(o):void 0});let d;const u=c.headers.get("content-type");if(u&&u.includes("application/json")?(d=await c.json(),d.result&&(d=d.result)):d=await c.text(),!c.ok)throw new Error(`HTTP error! Status: ${c.status}. Response: ${JSON.stringify(d)}`);return this.handleResponseData(d),d}catch(e){throw this.handleException(e),e}}handleResponseData(e){}getHeaders(e){var t,r;const o={Authorization:`Bearer ${this.config.apiToken}`,"Content-Type":"application/json"},n=e.requestSource||(null===(t=this.executionOptions)||void 0===t?void 0:t.requestSource),s=e.userAgent||(null===(r=this.executionOptions)||void 0===r?void 0:r.userAgent);return n&&(o[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_SOURCE]=n),s&&(o[request_header_constants_1.REQUEST_HEADERS.USER_AGENT]=s),o}buildUrl(e,t){const r=e.startsWith("http")?new URL(e):new URL(`${this.config.apiServer}/${e}`);return t&&Object.entries(t).forEach((([e,t])=>{r.searchParams.append(e,t)})),r.toString()}handleException(e){}}exports.BaseClient=BaseClient,__decorate([(0,logging_1.LogMethod)(),(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],BaseClient.prototype,"performRequest",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,o){var a,i=arguments.length,r=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(i<3?a(r):i>3?a(e,n,r):a(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(a,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigFeaturesClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ConfigFeaturesClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],ConfigFeaturesClient.prototype,"update",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,n,a){var o,r=arguments.length,i=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigFeaturesClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ConfigFeaturesClient extends base_client_1.BaseClient{async get(){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_FEATURES.GET})}async update(e,t){return await 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(e),body:t})}}exports.ConfigFeaturesClient=ConfigFeaturesClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ConfigFeaturesClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],ConfigFeaturesClient.prototype,"update",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,a){var o,i=arguments.length,r=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,a);else for(var _=t.length-1;_>=0;_--)(o=t[_])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,a){return new(n||(n=Promise))((function(o,i){function r(t){try{s(a.next(t))}catch(t){i(t)}}function _(t){try{s(a.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,_)}s((a=a.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigTemplateClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"getTemmplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Array]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"upsertTemplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"delete",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"create",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var o,r=arguments.length,i=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,a,n);else for(var _=t.length-1;_>=0;_--)(o=t[_])&&(i=(r<3?o(i):r>3?o(e,a,i):o(e,a))||i);return r>3&&i&&Object.defineProperty(e,a,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigTemplateClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ConfigTemplateClient extends base_client_1.BaseClient{async get(t){return await this._performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_TEMPLATES(t)}`})}async getTemmplateValues(t){return await this._performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_VALUES(t)}`})}async upsertTemplateValues(t,e){return this._performRequest({method:constants_1.HttpMethod.PUT,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.UPDATE_VALUES(t)}`,body:e})}async delete(t){return await this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.DELETE(t)}`})}async create(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.CREATE}`,body:t})}}exports.ConfigTemplateClient=ConfigTemplateClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"getTemmplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Array]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"upsertTemplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"delete",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"create",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,a){var i,o=arguments.length,r=o<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,a);else for(var _=t.length-1;_>=0;_--)(i=t[_])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,a){return new(n||(n=Promise))((function(i,o){function r(t){try{s(a.next(t))}catch(t){o(t)}}function _(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,_)}s((a=a.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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||"";delete t.key;const n={};return void 0!==t.value&&(n.value=t.value),void 0!==t.description&&(n.description=t.description),void 0!==t.expiryDate&&(n.expiryDate=t.expiryDate),void 0!==t.status&&(n.status=t.status),yield this._performRequest({method:constants_1.HttpMethod.PATCH,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.UPDATE(e),body:n})}))}upsert(t){return __awaiter(this,void 0,void 0,(function*(){try{return yield this.update(Object.assign({},t))}catch(e){return yield this.create(t)}}))}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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"create",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"update",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Number]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"search",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"delete",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var o,r=arguments.length,i=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,a,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(r<3?o(i):r>3?o(e,a,i):o(e,a))||i);return r>3&&i&&Object.defineProperty(e,a,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ConfigVarClient extends base_client_1.BaseClient{async create(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.CREATE,body:t})}async get(t){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.GET(t)})}async update(t){const e=t.key||"";delete t.key;const a={};return void 0!==t.value&&(a.value=t.value),void 0!==t.description&&(a.description=t.description),void 0!==t.expiryDate&&(a.expiryDate=t.expiryDate),void 0!==t.status&&(a.status=t.status),await this._performRequest({method:constants_1.HttpMethod.PATCH,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.UPDATE(e),body:a})}async upsert(t){try{return await this.update(Object.assign({},t))}catch(e){return await this.create(t)}}async search(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.SEARCH,body:{pageSize:t&&t<1e3?t:1e3}})}async delete(t){return await this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:constants_1.TENANT_ENDPOINTS.CONFIG_VAR.DELETE(t)})}}exports.ConfigVarClient=ConfigVarClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"create",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"update",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Number]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"search",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigVarClient.prototype,"delete",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,a){var i,o=arguments.length,r=o<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,a);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,a){return new(n||(n=Promise))((function(i,o){function r(t){try{c(a.next(t))}catch(t){o(t)}}function s(t){try{c(a.throw(t))}catch(t){o(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,s)}c((a=a.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilesAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class FilesAPIClient extends base_client_1.BaseClient{getAvatar(t){return __awaiter(this,void 0,void 0,(function*(){const{userIds:e,sizeHint:n}=t,a={user_ids:e.join(",")};return n&&(a.size_hint=n),this._performRequest({method:constants_1.HttpMethod.GET,endpoint:constants_1.TENANT_ENDPOINTS.FILES.AVATAR,queryParams:a})}))}getAttachments(t){return __awaiter(this,void 0,void 0,(function*(){return this._performRequest({method:constants_1.HttpMethod.GET,endpoint:constants_1.TENANT_ENDPOINTS.FILES.ATTACHMENTS(t)})}))}}exports.FilesAPIClient=FilesAPIClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],FilesAPIClient.prototype,"getAvatar",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],FilesAPIClient.prototype,"getAttachments",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,n,a){var o,r=arguments.length,s=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,a);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FilesAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class FilesAPIClient extends base_client_1.BaseClient{async getAvatar(t){const{userIds:e,sizeHint:n}=t,a={user_ids:e.join(",")};return n&&(a.size_hint=n),this._performRequest({method:constants_1.HttpMethod.GET,endpoint:constants_1.TENANT_ENDPOINTS.FILES.AVATAR,queryParams:a})}async getAttachments(t){return this._performRequest({method:constants_1.HttpMethod.GET,endpoint:constants_1.TENANT_ENDPOINTS.FILES.ATTACHMENTS(t)})}}exports.FilesAPIClient=FilesAPIClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],FilesAPIClient.prototype,"getAvatar",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],FilesAPIClient.prototype,"getAttachments",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,o,n){var a,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(i<3?a(r):i>3?a(e,o,r):a(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))((function(a,i){function r(t){try{_(n.next(t))}catch(t){i(t)}}function s(t){try{_(n.throw(t))}catch(t){i(t)}}function _(t){var e;t.done?a(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,s)}_((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getDistanceMatrix",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getDirections",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"geocodeAddress",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"autocompleteAddress",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getPlaceDetails",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getTimezone",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,o,n){var a,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,n);else for(var i=t.length-1;i>=0;i--)(a=t[i])&&(s=(r<3?a(s):r>3?a(e,o,s):a(e,o))||s);return r>3&&s&&Object.defineProperty(e,o,s),s},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class GeoAPIClient extends base_client_1.BaseClient{async getDistanceMatrix(t){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.DISTANCE_MATRIX,body:t})}async getDirections(t){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.DIRECTIONS,body:t})}async geocodeAddress(t){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.GEOCODE,body:t})}async autocompleteAddress(t){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.AUTOCOMPLETE,body:t})}async getPlaceDetails(t){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GEOSERVICES.PLACE,body:t})}async getTimezone(t){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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getDistanceMatrix",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getDirections",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"geocodeAddress",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"autocompleteAddress",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getPlaceDetails",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GeoAPIClient.prototype,"getTimezone",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(a=t[c])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(a,o){function i(t){try{s(n.next(t))}catch(t){o(t)}}function c(t){try{s(n.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLClient=void 0;const constants_1=require("../constants"),http_1=require("../constants/http"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class GraphQLClient extends base_client_1.BaseClient{execute(t){return __awaiter(this,arguments,void 0,(function*(t,e={}){return yield this._performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL.SINGLE,body:{query:t},headers:e})}))}executeBatch(t){return __awaiter(this,arguments,void 0,(function*(t,e={}){return yield this._performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL.BATCH,body:{query:t},headers:e})}))}handleResponseData(t){if(!t.data&&t.errors)throw new Error(`GraphQL error: ${JSON.stringify(t.errors)}`)}}exports.GraphQLClient=GraphQLClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],GraphQLClient.prototype,"execute",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],GraphQLClient.prototype,"executeBatch",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o<3?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLClient=void 0;const constants_1=require("../constants"),http_1=require("../constants/http"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class GraphQLClient extends base_client_1.BaseClient{async execute(e,t={}){return await this._performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL.SINGLE,body:"string"==typeof e?{query:e}:{query:e.query,variables:e.variables},headers:t})}async executeBatch(e,t={}){return await this._performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL.BATCH,body:"string"==typeof e?{query:e}:{query:e.query,variables:e.variables},headers:t})}handleResponseData(e){if(!e.data&&e.errors)throw new Error(`GraphQL error: ${JSON.stringify(e.errors)}`)}}exports.GraphQLClient=GraphQLClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],GraphQLClient.prototype,"execute",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],GraphQLClient.prototype,"executeBatch",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var i,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,a,n);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(r=(o<3?i(r):o>3?i(e,a,r):i(e,a))||r);return o>3&&r&&Object.defineProperty(e,a,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,a,n){return new(a||(a=Promise))((function(i,o){function r(t){try{_(n.next(t))}catch(t){o(t)}}function c(t){try{_(n.throw(t))}catch(t){o(t)}}function _(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(r,c)}_((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetadataClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class MetadataClient extends base_client_1.BaseClient{fetchAllMetadata(){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.METADATA.ALL})}))}fetchObjectMetadata(t){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.METADATA.OBJECT(t)})}))}}exports.MetadataClient=MetadataClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],MetadataClient.prototype,"fetchAllMetadata",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],MetadataClient.prototype,"fetchObjectMetadata",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var r,o=arguments.length,i=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,a,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(o<3?r(i):o>3?r(e,a,i):r(e,a))||i);return o>3&&i&&Object.defineProperty(e,a,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetadataClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class MetadataClient extends base_client_1.BaseClient{async fetchAllMetadata(){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.METADATA.ALL})}async fetchObjectMetadata(t){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.METADATA.OBJECT(t)})}}exports.MetadataClient=MetadataClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],MetadataClient.prototype,"fetchAllMetadata",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],MetadataClient.prototype,"fetchObjectMetadata",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,o,n){var i,a=arguments.length,r=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var _=t.length-1;_>=0;_--)(i=t[_])&&(r=(a<3?i(r):a>3?i(e,o,r):i(e,o))||r);return a>3&&r&&Object.defineProperty(e,o,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))((function(i,a){function r(t){try{s(n.next(t))}catch(t){a(t)}}function _(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,_)}s((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MobileNotificationClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,o){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:o}})}))}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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"getTemplates",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"deleteTemplate",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,String]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"setTemplate",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"dispatchResources",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"notifyAllocatedResources",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"notifyJobCancellation",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"sendOneOffMessage",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"sendSms",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"requestSmsConfirmation",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,o){var n,i=arguments.length,s=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,a):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,a,o);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(s=(i<3?n(s):i>3?n(e,a,s):n(e,a))||s);return i>3&&s&&Object.defineProperty(e,a,s),s},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MobileNotificationClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class MobileNotificationClient extends base_client_1.BaseClient{async getTemplates(){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.GET_TEMPLATES})}async deleteTemplate(t,e){await this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.DELETE_TEMPLATE(t,e)})}async setTemplate(t,e,a){await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SET_TEMPLATE(t,e),body:{template:a}})}async dispatchResources(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.DISPATCH,body:t})}async notifyAllocatedResources(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.NOTIFY,body:t})}async notifyJobCancellation(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.NOTIFY_CANCEL,body:t})}async sendOneOffMessage(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.ONE_OFF,body:t})}async sendSms(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SEND_SMS,body:t})}async requestSmsConfirmation(t){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.NOTIFICATIONS.SMS_CONFIRMATION_REQUEST,body:t})}}exports.MobileNotificationClient=MobileNotificationClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"getTemplates",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"deleteTemplate",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,String]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"setTemplate",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"dispatchResources",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"notifyAllocatedResources",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"notifyJobCancellation",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"sendOneOffMessage",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"sendSms",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],MobileNotificationClient.prototype,"requestSmsConfirmation",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i},__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,a){function i(e){try{_(r.next(e))}catch(e){a(e)}}function c(e){try{_(r.throw(e))}catch(e){a(e)}}function _(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}_((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrgPreferenceClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],OrgPreferenceClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],OrgPreferenceClient.prototype,"deploy",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrgPreferenceClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class OrgPreferenceClient extends base_client_1.BaseClient{async get(){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.ORG_PREFERENCE.GET})}async deploy(e){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.ORG_PREFERENCE.UPDATE,body:e})}}exports.OrgPreferenceClient=OrgPreferenceClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],OrgPreferenceClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],OrgPreferenceClient.prototype,"deploy",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var o,r=arguments.length,i=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,a,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(i=(r<3?o(i):r>3?o(e,a,i):o(e,a))||i);return r>3&&i&&Object.defineProperty(e,a,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,a,n){return new(a||(a=Promise))((function(o,r){function i(t){try{_(n.next(t))}catch(t){r(t)}}function c(t){try{_(n.throw(t))}catch(t){r(t)}}function _(t){var e;t.done?o(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(i,c)}_((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VocabularyClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),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,a){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:a})}))}updateVocabularyItem(t,e,a,n){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,a),body:n})}))}}exports.VocabularyClient=VocabularyClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"getVocabularyItems",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,Object]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"addVocabularyItem",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,String,Object]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"updateVocabularyItem",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,a,n){var o,r=arguments.length,i=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,a,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(i=(r<3?o(i):r>3?o(e,a,i):o(e,a))||i);return r>3&&i&&Object.defineProperty(e,a,i),i},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VocabularyClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class VocabularyClient extends base_client_1.BaseClient{async getVocabularyItems(t,e){return await this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.GET_ITEMS(t,e)})}async addVocabularyItem(t,e,a){return await this._performRequest({method:constants_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.ADD_ITEM(t,e),body:a})}async updateVocabularyItem(t,e,a,n){return await this._performRequest({method:constants_1.HttpMethod.PUT,endpoint:constants_1.TENANT_ENDPOINTS.VOCABULARY.UPDATE_ITEM(t,e,a),body:n})}}exports.VocabularyClient=VocabularyClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"getVocabularyItems",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,Object]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"addVocabularyItem",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,String,String,Object]),__metadata("design:returntype",Promise)],VocabularyClient.prototype,"updateVocabularyItem",null);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.REQUEST_HEADERS=void 0,exports.REQUEST_HEADERS={X_SKEDULO_BULK_OPERATION:"X-Skedulo-Bulk-Operation",X_SKEDULO_READ_ONLY:"X-Skedulo-Read-Only",X_SKEDULO_SOURCE:"X-Skedulo-Source",X_GRAPHQL_OPERATION:"X-Graphql-Operation",SKED_FUNCTION_EXECUTION_TYPE:"Sked-Function-Execution-Type",SKED_API_SERVER:"sked-api-server",USER_AGENT:"User-Agent"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.REQUEST_HEADERS=void 0,exports.REQUEST_HEADERS={X_SKEDULO_BULK_OPERATION:"X-Skedulo-Bulk-Operation",X_SKEDULO_READ_ONLY:"X-Skedulo-Read-Only",X_SKEDULO_SOURCE:"X-Skedulo-Source",X_GRAPHQL_OPERATION:"X-Graphql-Operation",SKED_FUNCTION_EXECUTION_TYPE:"Sked-Function-Execution-Type",SKED_API_SERVER:"sked-api-server",USER_AGENT:"User-Agent",X_SKEDULO_SUPPRESS_CHANGE_EVENTS:"X-Skedulo-Suppress-Change-Events"};
package/dist/index.d.ts CHANGED
@@ -571,6 +571,7 @@ export interface GraphqlMurationParams extends GraphqlParams {
571
571
  records: HasId[];
572
572
  operation: GraphqlOperations;
573
573
  bulkOperation?: boolean;
574
+ suppressChangeEvents?: boolean;
574
575
  }
575
576
  export interface GraphqlQueryParams extends GraphqlParams {
576
577
  first?: number;
@@ -595,6 +596,10 @@ export interface MutationResult {
595
596
  };
596
597
  };
597
598
  }
599
+ export interface GraphQLRequest {
600
+ query: string;
601
+ variables: object;
602
+ }
598
603
  /**
599
604
  * A client for executing GraphQL queries and mutations.
600
605
  * Extends the BaseClient to interact with the GraphQL API.
@@ -602,20 +607,20 @@ export interface MutationResult {
602
607
  export declare class GraphQLClient extends BaseClient {
603
608
  /**
604
609
  * Executes a GraphQL query or mutation.
605
- * @param {string} graphqlQuery - The GraphQL query or mutation string.
610
+ * @param {string | GraphQLRequest} graphqlQuery - The GraphQL query or mutation string.
606
611
  * @param {Record<string, string>} headers - Additional headers to include in the request.
607
612
  * @returns {Promise<GraphQlResponse>} - The response from the GraphQL API.
608
613
  * @throws {Error} - If the request fails or if there are errors in the response.
609
614
  */
610
- execute(graphqlQuery: string, headers?: Record<string, string>): Promise<GraphQlResponse>;
615
+ execute(graphqlQuery: string | GraphQLRequest, headers?: Record<string, string>): Promise<GraphQlResponse>;
611
616
  /**
612
617
  * Executes a GraphQL query or mutation.
613
- * @param {string} graphqlQuery - The GraphQL queries and/or mutations.
618
+ * @param {string | GraphQLRequest} graphqlQuery - The GraphQL query or mutation string.
614
619
  * @param {Record<string, string>} headers - Additional headers to include in the request.
615
620
  * @returns {Promise<GraphQlResponse>} - The response from the GraphQL API.
616
621
  * @throws {Error} - If the request fails or if there are errors in the response.
617
622
  */
618
- executeBatch(graphqlQuery: string, headers?: Record<string, string>): Promise<GraphQlResponse>;
623
+ executeBatch(graphqlQuery: string | GraphQLRequest, headers?: Record<string, string>): Promise<GraphQlResponse>;
619
624
  protected handleResponseData(responseData: any): void;
620
625
  }
621
626
  /**
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,n,e,o){return new(e||(e=Promise))((function(r,i){function s(t){try{O(o.next(t))}catch(t){i(t)}}function E(t){try{O(o.throw(t))}catch(t){i(t)}}function O(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,E)}O((o=o.apply(t,n||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LogMethod=LogMethod;const logging_utils_1=require("../logging-utils"),PULSE_SOLUTION_NAMESPACE="PSS",COLORS={RESET:"",GREEN:"",YELLOW:"",RED:"",CYAN:"",MAGENTA:""};function LogMethod(t=PULSE_SOLUTION_NAMESPACE){return function(n,e,o){const r=o.value,i=process.env.LOG_NAMESPACE||"";if(!i)return o;const s=parseInt(process.env.LOG_ENTRY_MAX_LENGTH||"120",10),E=i===t||"ALL"===i.toUpperCase();function O(t,n,e,o,r){const i=(new Date).toISOString(),E="ERROR"===o?COLORS.RED:"INPUT"===o?COLORS.CYAN:COLORS.MAGENTA;console.log(`${COLORS.GREEN}[${t.toUpperCase()}]${COLORS.RESET} | ${COLORS.YELLOW}${i}${COLORS.RESET} | ${COLORS.GREEN}${PULSE_SOLUTION_NAMESPACE}${COLORS.RESET} | ${n.constructor.name} | ${e} - ${E}${o}${COLORS.RESET}: ${function(t){if(!t)return"";const n=(0,logging_utils_1.maskSensitiveData)(t);return n.length>s?`${n.substring(0,s-3)}...`:n}(r)}`)}return o.value=function(...t){return __awaiter(this,void 0,void 0,(function*(){E&&O("info",this,e.toString(),"INPUT",t);try{const n=yield Promise.resolve(r.apply(this,t));return E&&O("info",this,e.toString(),"OUTPUT",n),n}catch(t){throw O("error",this,e.toString(),"ERROR",t.message||t),t}}))},o}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LogMethod=LogMethod;const logging_utils_1=require("../logging-utils"),PULSE_SOLUTION_NAMESPACE="PSS",COLORS={RESET:"",GREEN:"",YELLOW:"",RED:"",CYAN:"",MAGENTA:""};function LogMethod(t=PULSE_SOLUTION_NAMESPACE){return function(e,n,o){const r=o.value,E=process.env.LOG_NAMESPACE||"";if(!E)return o;const O=parseInt(process.env.LOG_ENTRY_MAX_LENGTH||"120",10),s=E===t||"ALL"===E.toUpperCase();function S(t,e,n,o,r){const E=(new Date).toISOString(),s="ERROR"===o?COLORS.RED:"INPUT"===o?COLORS.CYAN:COLORS.MAGENTA;console.log(`${COLORS.GREEN}[${t.toUpperCase()}]${COLORS.RESET} | ${COLORS.YELLOW}${E}${COLORS.RESET} | ${COLORS.GREEN}${PULSE_SOLUTION_NAMESPACE}${COLORS.RESET} | ${e.constructor.name} | ${n} - ${s}${o}${COLORS.RESET}: ${function(t){if(!t)return"";const e=(0,logging_utils_1.maskSensitiveData)(t);return e.length>O?`${e.substring(0,O-3)}...`:e}(r)}`)}return o.value=async function(...t){s&&S("info",this,n.toString(),"INPUT",t);try{const e=await Promise.resolve(r.apply(this,t));return s&&S("info",this,n.toString(),"OUTPUT",e),e}catch(t){throw S("error",this,n.toString(),"ERROR",t.message||t),t}},o}}
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,n,r,o){return new(r||(r=Promise))((function(e,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,u)}c((o=o.apply(t,n||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MonitorCall=MonitorCall;const monitoring_registry_1=require("../monitoring-registry");function MonitorCall(t){return function(n,r,o){const e=o.value;return o.value=function(...o){return __awaiter(this,void 0,void 0,(function*(){const i=t||`${n.constructor.name}.${r}`;return(0,monitoring_registry_1.getGlobalMonitorManager)().measure(i,(()=>__awaiter(this,void 0,void 0,(function*(){return e.apply(this,o)}))))}))},o}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MonitorCall=MonitorCall;const monitoring_registry_1=require("../monitoring-registry");function MonitorCall(r){return function(t,n,o){const e=o.value;return o.value=async function(...o){const i=r||`${t.constructor.name}.${n}`;return(0,monitoring_registry_1.getGlobalMonitorManager)().measure(i,(async()=>e.apply(this,o)))},o}}
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,o,s){return new(o||(o=Promise))((function(i,n){function a(t){try{r(s.next(t))}catch(t){n(t)}}function l(t){try{r(s.throw(t))}catch(t){n(t)}}function r(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(a,l)}r((s=s.apply(t,e||[])).next())}))},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MonitoringManager=void 0;const logger_1=__importDefault(require("../logging/logger"));class MonitoringManager{constructor(t={}){this.totalCalls=0,this.methodCallCounts={},this.methodExecutionTimes={},this.concurrentRequests=0,this.peakConcurrentRequests=0,this.startTime=Date.now(),this.violations={},this.thresholds=t}measure(t,e){return __awaiter(this,void 0,void 0,(function*(){this.incrementTotalCallsCount(),this.incrementMethodCount(t),this.trackConcurrentRequest(1,t);const o=Date.now();let s;try{s=yield e()}finally{this.trackConcurrentRequest(-1,t)}const i=Date.now()-o;return this.trackExecutionTime(t,i),this.checkMethodDuration(t,i),s}))}trackConcurrentRequest(t,e){this.concurrentRequests+=t,this.peakConcurrentRequests=Math.max(this.peakConcurrentRequests,this.concurrentRequests),this.thresholds.maxConcurrentRequests&&this.peakConcurrentRequests>this.thresholds.maxConcurrentRequests&&this.handleViolation("maxConcurrentRequests",`Method ${e} max concurrent requests exceeded: ${this.peakConcurrentRequests} (Allowed: ${this.thresholds.maxConcurrentRequests})`)}getExecutionMetrics(){return{totalCalls:this.totalCalls,totalExecutionTimeMs:Date.now()-this.startTime,peakConcurrentRequests:this.peakConcurrentRequests,methodCallCounts:Object.assign({},this.methodCallCounts),methodExecutionTimes:Object.assign({},this.methodExecutionTimes),violations:Object.values(this.violations)}}incrementTotalCallsCount(){this.totalCalls++,this.thresholds.totalCalls&&this.totalCalls>this.thresholds.totalCalls&&this.handleViolation("totalCalls",`Total calls limit exceeded: ${this.totalCalls} (Allowed: ${this.thresholds.totalCalls})`)}incrementMethodCount(t){var e;this.methodCallCounts[t]=(null!==(e=this.methodCallCounts[t])&&void 0!==e?e:0)+1;const o=`methodCallLimit:${t}`,s=this.thresholds.maxMethodCalls;s&&this.methodCallCounts[t]>s&&this.handleViolation(o,`Method [${t}] call limit exceeded: ${this.methodCallCounts[t]} (Allowed: ${s})`)}trackExecutionTime(t,e){this.methodExecutionTimes[t]||(this.methodExecutionTimes[t]={totalTime:0,count:0,min:Number.MAX_VALUE,max:0});const o=this.methodExecutionTimes[t];o.totalTime+=e,o.count+=1,o.min=Math.min(o.min,e),o.max=Math.max(o.max,e)}checkMethodDuration(t,e){const o=this.thresholds.maxMethodExecutionTimeMs,s=`methodDurationLimit:${t}`;o&&e>o&&this.handleViolation(s,`Method [${t}] exceeded duration limit: ${e}ms (Allowed: ${o}ms)`)}handleViolation(t,e){if(this.violations[t]=e,this.thresholds.throwOnViolation)throw new Error(e);logger_1.default.warn(`[Violation] ${e}`)}}exports.MonitoringManager=MonitoringManager;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MonitoringManager=void 0;const logger_1=__importDefault(require("../logging/logger"));class MonitoringManager{constructor(t={}){this.totalCalls=0,this.methodCallCounts={},this.methodExecutionTimes={},this.concurrentRequests=0,this.peakConcurrentRequests=0,this.startTime=Date.now(),this.violations={},this.thresholds=t}async measure(t,e){this.incrementTotalCallsCount(),this.incrementMethodCount(t),this.trackConcurrentRequest(1,t);const s=Date.now();let o;try{o=await e()}finally{this.trackConcurrentRequest(-1,t)}const i=Date.now()-s;return this.trackExecutionTime(t,i),this.checkMethodDuration(t,i),o}trackConcurrentRequest(t,e){this.concurrentRequests+=t,this.peakConcurrentRequests=Math.max(this.peakConcurrentRequests,this.concurrentRequests),this.thresholds.maxConcurrentRequests&&this.peakConcurrentRequests>this.thresholds.maxConcurrentRequests&&this.handleViolation("maxConcurrentRequests",`Method ${e} max concurrent requests exceeded: ${this.peakConcurrentRequests} (Allowed: ${this.thresholds.maxConcurrentRequests})`)}getExecutionMetrics(){return{totalCalls:this.totalCalls,totalExecutionTimeMs:Date.now()-this.startTime,peakConcurrentRequests:this.peakConcurrentRequests,methodCallCounts:Object.assign({},this.methodCallCounts),methodExecutionTimes:Object.assign({},this.methodExecutionTimes),violations:Object.values(this.violations)}}incrementTotalCallsCount(){this.totalCalls++,this.thresholds.totalCalls&&this.totalCalls>this.thresholds.totalCalls&&this.handleViolation("totalCalls",`Total calls limit exceeded: ${this.totalCalls} (Allowed: ${this.thresholds.totalCalls})`)}incrementMethodCount(t){var e;this.methodCallCounts[t]=(null!==(e=this.methodCallCounts[t])&&void 0!==e?e:0)+1;const s=`methodCallLimit:${t}`,o=this.thresholds.maxMethodCalls;o&&this.methodCallCounts[t]>o&&this.handleViolation(s,`Method [${t}] call limit exceeded: ${this.methodCallCounts[t]} (Allowed: ${o})`)}trackExecutionTime(t,e){this.methodExecutionTimes[t]||(this.methodExecutionTimes[t]={totalTime:0,count:0,min:Number.MAX_VALUE,max:0});const s=this.methodExecutionTimes[t];s.totalTime+=e,s.count+=1,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e)}checkMethodDuration(t,e){const s=this.thresholds.maxMethodExecutionTimeMs,o=`methodDurationLimit:${t}`;s&&e>s&&this.handleViolation(o,`Method [${t}] exceeded duration limit: ${e}ms (Allowed: ${s}ms)`)}handleViolation(t,e){if(this.violations[t]=e,this.thresholds.throwOnViolation)throw new Error(e);logger_1.default.warn(`[Violation] ${e}`)}}exports.MonitoringManager=MonitoringManager;
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,r,a){var i,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(n<3?i(o):n>3?i(t,r,o):i(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o},__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,r,a){return new(r||(r=Promise))((function(i,n){function o(e){try{c(a.next(e))}catch(e){n(e)}}function s(e){try{c(a.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((a=a.apply(e,t||[])).next())}))},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CacheService=void 0;const logging_1=require("../../logging"),logger_1=__importDefault(require("../../logging/logger")),KEY_PREFIX="Z_CACHE_",DEFAULT_TTL=36e5;class CacheService{constructor(e){this.storage=e}setSecondaryCache(e){this.secondaryCache=e}get(e,t){return __awaiter(this,void 0,void 0,(function*(){e=this.addPrefix(e);const r=yield this.storage.get(e);if(r)try{const t=JSON.parse(r);return t.expiresAt&&Date.now()>t.expiresAt?(yield this.delete(e),null):this.deserialize(t)}catch(e){return logger_1.default.error("Cache deserialization failed:",e),null}if((null==t?void 0:t.useSecondaryCache)&&this.secondaryCache){const r=yield this.secondaryCache.get(e,t);return null!==r&&(yield this.set(e,r,{ttl:null==t?void 0:t.ttl})),r}return null}))}set(e,t,r){return __awaiter(this,void 0,void 0,(function*(){var a;e=this.addPrefix(e);const i={type:t instanceof Date?"date":typeof t,value:t,expiresAt:Date.now()+(null!==(a=null==r?void 0:r.ttl)&&void 0!==a?a:36e5)},n=JSON.stringify(i);yield this.storage.set(e,n),(null==r?void 0:r.useSecondaryCache)&&this.secondaryCache&&(yield this.secondaryCache.set(e,t,r))}))}delete(e){return __awaiter(this,void 0,void 0,(function*(){e=this.addPrefix(e),yield this.storage.delete(e)}))}clear(){return __awaiter(this,void 0,void 0,(function*(){yield this.storage.clear()}))}addPrefix(e){return e.startsWith("Z_CACHE_")?e:"Z_CACHE_"+e}deserialize(e){switch(e.type){case"number":return Number(e.value);case"boolean":return Boolean(e.value);case"object":return e.value;case"date":case"datetime":const t=new Date(e.value);return isNaN(t.getTime())?(logger_1.default.error(`Invalid ${e.type} string:`,e.value),null):t;default:return String(e.value)}}}exports.CacheService=CacheService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],CacheService.prototype,"get",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object,Object]),__metadata("design:returntype",Promise)],CacheService.prototype,"set",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,a,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,a,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(n<3?i(s):n>3?i(t,a,s):i(t,a))||s);return n>3&&s&&Object.defineProperty(t,a,s),s},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CacheService=void 0;const logging_1=require("../../logging"),logger_1=__importDefault(require("../../logging/logger")),KEY_PREFIX="Z_CACHE_",DEFAULT_TTL=36e5;class CacheService{constructor(e){this.storage=e}setSecondaryCache(e){this.secondaryCache=e}async get(e,t){e=this.addPrefix(e);const a=await this.storage.get(e);if(a)try{const t=JSON.parse(a);return t.expiresAt&&Date.now()>t.expiresAt?(await this.delete(e),null):this.deserialize(t)}catch(e){return logger_1.default.error("Cache deserialization failed:",e),null}if((null==t?void 0:t.useSecondaryCache)&&this.secondaryCache){const a=await this.secondaryCache.get(e,t);return null!==a&&await this.set(e,a,{ttl:null==t?void 0:t.ttl}),a}return null}async set(e,t,a){var r;e=this.addPrefix(e);const i={type:t instanceof Date?"date":typeof t,value:t,expiresAt:Date.now()+(null!==(r=null==a?void 0:a.ttl)&&void 0!==r?r:36e5)},n=JSON.stringify(i);await this.storage.set(e,n),(null==a?void 0:a.useSecondaryCache)&&this.secondaryCache&&await this.secondaryCache.set(e,t,a)}async delete(e){e=this.addPrefix(e),await this.storage.delete(e)}async clear(){await this.storage.clear()}addPrefix(e){return e.startsWith("Z_CACHE_")?e:"Z_CACHE_"+e}deserialize(e){switch(e.type){case"number":return Number(e.value);case"boolean":return Boolean(e.value);case"object":return e.value;case"date":case"datetime":const t=new Date(e.value);return isNaN(t.getTime())?(logger_1.default.error(`Invalid ${e.type} string:`,e.value),null):t;default:return String(e.value)}}}exports.CacheService=CacheService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object]),__metadata("design:returntype",Promise)],CacheService.prototype,"get",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Object,Object]),__metadata("design:returntype",Promise)],CacheService.prototype,"set",null);
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function a(t){try{s(i.next(t))}catch(t){r(t)}}function c(t){try{s(i.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarCacheStorage=void 0;const config_var_constants_1=require("../../../constants/config-var-constants");class ConfigVarCacheStorage{constructor(t){this.configVarClient=t}set(t,e){return __awaiter(this,void 0,void 0,(function*(){try{yield this.configVarClient.create({key:t,value:e,configType:config_var_constants_1.ConfigVariableType.PLAIN_TEXT})}catch(n){yield this.configVarClient.update({key:t,value:e,configType:config_var_constants_1.ConfigVariableType.PLAIN_TEXT})}}))}get(t){return __awaiter(this,void 0,void 0,(function*(){var e;try{const e=yield this.configVarClient.get(t);if(e)return e.value}catch(t){if(null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("not_found"))return null;throw t}return null}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){yield this.configVarClient.delete(t)}))}clear(){return __awaiter(this,void 0,void 0,(function*(){throw new Error("Clear operation is not supported by ConfigVarCacheStorage")}))}}exports.ConfigVarCacheStorage=ConfigVarCacheStorage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigVarCacheStorage=void 0;const config_var_constants_1=require("../../../constants/config-var-constants");class ConfigVarCacheStorage{constructor(e){this.configVarClient=e}async set(e,t){try{await this.configVarClient.create({key:e,value:t,configType:config_var_constants_1.ConfigVariableType.PLAIN_TEXT})}catch(a){await this.configVarClient.update({key:e,value:t,configType:config_var_constants_1.ConfigVariableType.PLAIN_TEXT})}}async get(e){var t;try{const t=await this.configVarClient.get(e);if(t)return t.value}catch(e){if(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.includes("not_found"))return null;throw e}return null}async delete(e){await this.configVarClient.delete(e)}async clear(){throw new Error("Clear operation is not supported by ConfigVarCacheStorage")}}exports.ConfigVarCacheStorage=ConfigVarCacheStorage;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.InMemoryCacheStorage=void 0;class InMemoryCacheStorage{constructor(){this.cache=new Map}set(e,t){return __awaiter(this,void 0,void 0,(function*(){this.cache.set(e,t)}))}get(e){return __awaiter(this,void 0,void 0,(function*(){const t=this.cache.get(e);return t||null}))}delete(e){return __awaiter(this,void 0,void 0,(function*(){this.cache.delete(e)}))}clear(){return __awaiter(this,void 0,void 0,(function*(){this.cache.clear()}))}}exports.InMemoryCacheStorage=InMemoryCacheStorage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InMemoryCacheStorage=void 0;class InMemoryCacheStorage{constructor(){this.cache=new Map}async set(e,c){this.cache.set(e,c)}async get(e){const c=this.cache.get(e);return c||null}async delete(e){this.cache.delete(e)}async clear(){this.cache.clear()}}exports.InMemoryCacheStorage=InMemoryCacheStorage;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(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(o,a)}l((s=s.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoService=void 0;const uuid_1=require("uuid");class GeoService{constructor(e){this.sessionId="",this.geoAPIClient=e,this.sessionId=this.generateNewSessionId()}getDistanceMatrix(e,t){return __awaiter(this,void 0,void 0,(function*(){const i=e.map((e=>({lat:parseFloat(this.stripTrailingZeros(e.lat)),lng:parseFloat(this.stripTrailingZeros(e.lng))}))),s=t.map((e=>({lat:parseFloat(this.stripTrailingZeros(e.lat)),lng:parseFloat(this.stripTrailingZeros(e.lng))}))),r=yield this.geoAPIClient.getDistanceMatrix({origins:i,destinations:s});if(!r||!r.matrix||0===r.matrix.length)throw new Error("Failed to retrieve distance matrix data");const n=new Map;for(let o=0;o<e.length;o++)for(let e=0;e<t.length;e++){const t=this.createKey(i[o],s[e]),a=r.matrix[o][e];n.set(t,a)}return n}))}getAddressSuggestions(e){return __awaiter(this,arguments,void 0,(function*(e,t=1){const i=e.sessionId||this.sessionId;e.sessionId||(e.sessionId=this.sessionId);const s=yield this.geoAPIClient.autocompleteAddress(e);if(0===s.predictions.length)return null;const r=s.predictions.slice(0,t);return Promise.all(r.map((e=>this.geoAPIClient.getPlaceDetails({placeId:e.placeId,sessionId:i}))))}))}getTimezone(e){return __awaiter(this,void 0,void 0,(function*(){return(yield this.geoAPIClient.getTimezone(e)).timeZoneId}))}generateNewSessionId(){return(0,uuid_1.v4)()}stripTrailingZeros(e){return parseFloat(e.toFixed(8)).toString()}createKey(e,t){return`${this.stripTrailingZeros(e.lat)},${this.stripTrailingZeros(e.lng)}-${this.stripTrailingZeros(t.lat)},${this.stripTrailingZeros(t.lng)}`}}exports.GeoService=GeoService;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoService=void 0;const uuid_1=require("uuid");class GeoService{constructor(e){this.sessionId="",this.geoAPIClient=e,this.sessionId=this.generateNewSessionId()}async getDistanceMatrix(e,t){const s=e.map((e=>({lat:parseFloat(this.stripTrailingZeros(e.lat)),lng:parseFloat(this.stripTrailingZeros(e.lng))}))),i=t.map((e=>({lat:parseFloat(this.stripTrailingZeros(e.lat)),lng:parseFloat(this.stripTrailingZeros(e.lng))}))),r=await this.geoAPIClient.getDistanceMatrix({origins:s,destinations:i});if(!r||!r.matrix||0===r.matrix.length)throw new Error("Failed to retrieve distance matrix data");const n=new Map;for(let o=0;o<e.length;o++)for(let e=0;e<t.length;e++){const t=this.createKey(s[o],i[e]),a=r.matrix[o][e];n.set(t,a)}return n}async getAddressSuggestions(e,t=1){const s=e.sessionId||this.sessionId;e.sessionId||(e.sessionId=this.sessionId);const i=await this.geoAPIClient.autocompleteAddress(e);if(0===i.predictions.length)return null;const r=i.predictions.slice(0,t);return Promise.all(r.map((e=>this.geoAPIClient.getPlaceDetails({placeId:e.placeId,sessionId:s}))))}async getTimezone(e){return(await this.geoAPIClient.getTimezone(e)).timeZoneId}generateNewSessionId(){return(0,uuid_1.v4)()}stripTrailingZeros(e){return parseFloat(e.toFixed(8)).toString()}createKey(e,t){return`${this.stripTrailingZeros(e.lat)},${this.stripTrailingZeros(e.lng)}-${this.stripTrailingZeros(t.lat)},${this.stripTrailingZeros(t.lng)}`}}exports.GeoService=GeoService;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(a,s){function n(t){try{o(r.next(t))}catch(t){s(t)}}function h(t){try{o(r.throw(t))}catch(t){s(t)}}function o(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,h)}o((r=r.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphBatch=void 0;const graph_batch_config_1=require("./configs/graph-batch-config"),pagination_strategy_1=require("./pagination-strategy");class GraphBatch{constructor(t,e){this.startTime=new Date,this.context=t,this.config=(0,graph_batch_config_1.initializeConfig)(e),this.startTime=new Date}run(){return __awaiter(this,void 0,void 0,(function*(){var t,e;if(this.queryBuilder=yield this.start(),!this.queryBuilder)throw new Error("Query builder was not defined in start().");this.queryBuilder.withLimit(this.config.batchSize);let i=0,r=!0;for(;r&&!this.isMaxBatchesReached(i)&&(this.queryResult=yield this.fetchNextPage(),this.queryResult.records&&0!==this.queryResult.records.length);)yield this.execute(this.queryResult.records),i++,this.config.delaySeconds&&!this.isMaxBatchesReached(i)&&(yield this.delay(1e3*this.config.delaySeconds)),r=null!==(e=null===(t=this.queryResult.pageInfo)||void 0===t?void 0:t.hasNextPage)&&void 0!==e&&e;yield this.finish()}))}finish(){return __awaiter(this,void 0,void 0,(function*(){this.context.logger.info("Batch process completed.")}))}fetchNextPage(){return __awaiter(this,void 0,void 0,(function*(){var t,e,i;switch(this.config.strategy){case pagination_strategy_1.PaginationStrategy.OFFSET:this.queryResult&&(null===(t=this.queryBuilder)||void 0===t||t.withOffset(this.queryResult.endOffset+1));break;case pagination_strategy_1.PaginationStrategy.CURSOR:this.queryResult&&(null===(e=this.queryBuilder)||void 0===e||e.withCursor(this.queryResult.endCursor));break;case pagination_strategy_1.PaginationStrategy.NONE:default:null===(i=this.queryBuilder)||void 0===i||i.withFilter(`LastModifiedDate < ${this.startTime.toISOString()}`)}return this.queryBuilder.execute()}))}isMaxBatchesReached(t){return!!this.config.maxBatches&&t>=this.config.maxBatches}delay(t){return __awaiter(this,void 0,void 0,(function*(){return new Promise((e=>setTimeout(e,t)))}))}}exports.GraphBatch=GraphBatch;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphBatch=void 0;const graph_batch_config_1=require("./configs/graph-batch-config"),pagination_strategy_1=require("./pagination-strategy");class GraphBatch{constructor(t,e){this.startTime=new Date,this.context=t,this.config=(0,graph_batch_config_1.initializeConfig)(e),this.startTime=new Date}async run(){var t,e;if(this.queryBuilder=await this.start(),!this.queryBuilder)throw new Error("Query builder was not defined in start().");this.queryBuilder.withLimit(this.config.batchSize);let i=0,s=!0;for(;s&&!this.isMaxBatchesReached(i)&&(this.queryResult=await this.fetchNextPage(),this.queryResult.records&&0!==this.queryResult.records.length);)await this.execute(this.queryResult.records),i++,this.config.delaySeconds&&!this.isMaxBatchesReached(i)&&await this.delay(1e3*this.config.delaySeconds),s=null!==(e=null===(t=this.queryResult.pageInfo)||void 0===t?void 0:t.hasNextPage)&&void 0!==e&&e;await this.finish()}async finish(){this.context.logger.info("Batch process completed.")}async fetchNextPage(){var t,e,i;switch(this.config.strategy){case pagination_strategy_1.PaginationStrategy.OFFSET:this.queryResult&&(null===(t=this.queryBuilder)||void 0===t||t.withOffset(this.queryResult.endOffset+1));break;case pagination_strategy_1.PaginationStrategy.CURSOR:this.queryResult&&(null===(e=this.queryBuilder)||void 0===e||e.withCursor(this.queryResult.endCursor));break;case pagination_strategy_1.PaginationStrategy.NONE:default:null===(i=this.queryBuilder)||void 0===i||i.withFilter(`LastModifiedDate < ${this.startTime.toISOString()}`)}return this.queryBuilder.execute()}isMaxBatchesReached(t){return!!this.config.maxBatches&&t>=this.config.maxBatches}async delay(t){return new Promise((e=>setTimeout(e,t)))}}exports.GraphBatch=GraphBatch;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,a){function o(t){try{s(i.next(t))}catch(t){a(t)}}function c(t){try{s(i.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,c)}s((i=i.apply(t,e||[])).next())}))},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UniqueGraphBatch=void 0;const logger_1=__importDefault(require("../../logging/logger")),graph_batch_1=require("./graph-batch");class UniqueGraphBatch extends graph_batch_1.GraphBatch{constructor(t,e){super(t,e),this.name=(null==e?void 0:e.name)||this.constructor.name,this.name=this.name.toUpperCase().replace(/[^A-Z0-9]/g,"_"),this.lockTtl=(null==e?void 0:e.lockTtl)||96e4}run(){const t=Object.create(null,{run:{get:()=>super.run}});return __awaiter(this,void 0,void 0,(function*(){const e={name:this.name,ttl:this.lockTtl,description:`Lock for batch process: ${this.name}`};try{if(!(yield this.context.lockService.acquireLock(e)))return void logger_1.default.error(`A batch with name '${this.name}' is already running.`);yield t.run.call(this)}catch(t){logger_1.default.error(`Error running batch with name '${this.name}': ${t.message}`)}finally{yield this.context.lockService.releaseLock(this.name)}}))}start(){return __awaiter(this,void 0,void 0,(function*(){throw new Error("Subclasses must implement the 'start' method.")}))}execute(t){return __awaiter(this,void 0,void 0,(function*(){throw new Error("Subclasses must implement the 'execute' method.")}))}finish(){const t=Object.create(null,{finish:{get:()=>super.finish}});return __awaiter(this,void 0,void 0,(function*(){yield t.finish.call(this)}))}}exports.UniqueGraphBatch=UniqueGraphBatch;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UniqueGraphBatch=void 0;const logger_1=__importDefault(require("../../logging/logger")),graph_batch_1=require("./graph-batch");class UniqueGraphBatch extends graph_batch_1.GraphBatch{constructor(e,t){super(e,t),this.name=(null==t?void 0:t.name)||this.constructor.name,this.name=this.name.toUpperCase().replace(/[^A-Z0-9]/g,"_"),this.lockTtl=(null==t?void 0:t.lockTtl)||96e4}async run(){const e={name:this.name,ttl:this.lockTtl,description:`Lock for batch process: ${this.name}`};try{if(!await this.context.lockService.acquireLock(e))return void logger_1.default.error(`A batch with name '${this.name}' is already running.`);await super.run()}catch(e){logger_1.default.error(`Error running batch with name '${this.name}': ${e.message}`)}finally{await this.context.lockService.releaseLock(this.name)}}async start(){throw new Error("Subclasses must implement the 'start' method.")}async execute(e){throw new Error("Subclasses must implement the 'execute' method.")}async finish(){await super.finish()}}exports.UniqueGraphBatch=UniqueGraphBatch;
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,a,r){var o,n=arguments.length,i=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,a,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n<3?o(i):n>3?o(t,a,i):o(t,a))||i);return n>3&&i&&Object.defineProperty(t,a,i),i},__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,a,r){return new(a||(a=Promise))((function(o,n){function i(e){try{d(r.next(e))}catch(e){n(e)}}function s(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,s)}d((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLService=void 0;const constants_1=require("../../constants"),request_header_constants_1=require("../../core/request-header-constants"),logging_1=require("../../logging"),queries_1=require("./queries");class GraphQLService{constructor(e){this.client=e}query(e){return __awaiter(this,void 0,void 0,(function*(){var t,a,r,o,n,i,s,d,u,c,_,l;e.objectName=this.getQueryName(e.objectName);const p=(0,queries_1.FETCH_RECORDS_QUERY)(e),v=this.getQueryHeaders(e),g=yield this.client.execute(p,v),h={records:(null===(a=null===(t=null==g?void 0:g.data)||void 0===t?void 0:t[e.objectName])||void 0===a?void 0:a.edges.map((e=>e.node)))||[],totalCount:(null===(o=null===(r=null==g?void 0:g.data)||void 0===r?void 0:r[e.objectName])||void 0===o?void 0:o.totalCount)||0,pageInfo:(null===(i=null===(n=null==g?void 0:g.data)||void 0===n?void 0:n[e.objectName])||void 0===i?void 0:i.pageInfo)||{}};if(h.records.length>0){const t=(null===(u=null===(d=null===(s=null==g?void 0:g.data)||void 0===s?void 0:s[e.objectName])||void 0===d?void 0:d.edges)||void 0===u?void 0:u.map((e=>e.offset)))||[],a=(null===(l=null===(_=null===(c=null==g?void 0:g.data)||void 0===c?void 0:c[e.objectName])||void 0===_?void 0:_.edges)||void 0===l?void 0:l.map((e=>e.cursor)))||[];h.endOffset=t[t.length-1],h.endCursor=a[a.length-1]}return h}))}mutate(e){return __awaiter(this,void 0,void 0,(function*(){if(!e.records||0===e.records.length)return Promise.resolve({message:"No records to process"});let t="";switch(e.operation){case constants_1.GraphqlOperations.DELETE:t=(0,queries_1.DELETE_OBJECTS_MUTATION)(e);break;case constants_1.GraphqlOperations.UPDATE:case constants_1.GraphqlOperations.INSERT:t=(0,queries_1.UPSERT_OBJECTS_MUTATION)(e);break;default:throw new Error(`Invalid operation: ${e.operation}`)}const a=this.getMutationHeaders(e);return yield this.client.execute(t,a)}))}delete(e){return __awaiter(this,void 0,void 0,(function*(){return e.operation=constants_1.GraphqlOperations.DELETE,this.mutate(e)}))}update(e){return __awaiter(this,void 0,void 0,(function*(){return e.operation=constants_1.GraphqlOperations.UPDATE,this.mutate(e)}))}insert(e){return __awaiter(this,void 0,void 0,(function*(){return e.operation=constants_1.GraphqlOperations.INSERT,this.mutate(e)}))}extractJobUIDs(e){var t;return(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.schema)?Object.values(e.data.schema):[]}getQueryName(e){return e.charAt(0).toLowerCase()+e.slice(1)}getQueryHeaders(e){const t=this.getOperationHeader(e.operationName);return e.readOnly&&(t[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_READ_ONLY]="true"),t}getMutationHeaders(e){const t=this.getOperationHeader(e.operationName);return e.bulkOperation&&(t[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_BULK_OPERATION]="true"),t}getOperationHeader(e){return{[request_header_constants_1.REQUEST_HEADERS.X_GRAPHQL_OPERATION]:e}}}exports.GraphQLService=GraphQLService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"query",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"mutate",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"delete",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"update",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"insert",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,a,r){var o,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,a,r);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(s=(n<3?o(s):n>3?o(t,a,s):o(t,a))||s);return n>3&&s&&Object.defineProperty(t,a,s),s},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLService=void 0;const constants_1=require("../../constants"),request_header_constants_1=require("../../core/request-header-constants"),logging_1=require("../../logging"),queries_1=require("./queries");class GraphQLService{constructor(e){this.client=e}async query(e){var t,a,r,o,n,s,i,d,_,c,u,l;e.objectName=this.getQueryName(e.objectName);const p=(0,queries_1.FETCH_RECORDS_QUERY)(e),g=this.getQueryHeaders(e),h=await this.client.execute(p,g),m={records:(null===(a=null===(t=null==h?void 0:h.data)||void 0===t?void 0:t[e.objectName])||void 0===a?void 0:a.edges.map((e=>e.node)))||[],totalCount:(null===(o=null===(r=null==h?void 0:h.data)||void 0===r?void 0:r[e.objectName])||void 0===o?void 0:o.totalCount)||0,pageInfo:(null===(s=null===(n=null==h?void 0:h.data)||void 0===n?void 0:n[e.objectName])||void 0===s?void 0:s.pageInfo)||{}};if(m.records.length>0){const t=(null===(_=null===(d=null===(i=null==h?void 0:h.data)||void 0===i?void 0:i[e.objectName])||void 0===d?void 0:d.edges)||void 0===_?void 0:_.map((e=>e.offset)))||[],a=(null===(l=null===(u=null===(c=null==h?void 0:h.data)||void 0===c?void 0:c[e.objectName])||void 0===u?void 0:u.edges)||void 0===l?void 0:l.map((e=>e.cursor)))||[];m.endOffset=t[t.length-1],m.endCursor=a[a.length-1]}return m}async mutate(e){if(!e.records||0===e.records.length)return Promise.resolve({message:"No records to process"});let t="";switch(e.operation){case constants_1.GraphqlOperations.DELETE:t=(0,queries_1.DELETE_OBJECTS_MUTATION)(e);break;case constants_1.GraphqlOperations.UPDATE:case constants_1.GraphqlOperations.INSERT:t=(0,queries_1.UPSERT_OBJECTS_MUTATION)(e);break;default:throw new Error(`Invalid operation: ${e.operation}`)}const a=this.getMutationHeaders(e);return await this.client.execute(t,a)}async delete(e){return e.operation=constants_1.GraphqlOperations.DELETE,this.mutate(e)}async update(e){return e.operation=constants_1.GraphqlOperations.UPDATE,this.mutate(e)}async insert(e){return e.operation=constants_1.GraphqlOperations.INSERT,this.mutate(e)}extractJobUIDs(e){var t;return(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.schema)?Object.values(e.data.schema):[]}getQueryName(e){return e.charAt(0).toLowerCase()+e.slice(1)}getQueryHeaders(e){const t=this.getOperationHeader(e.operationName);return e.readOnly&&(t[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_READ_ONLY]="true"),t}getMutationHeaders(e){const t=this.getOperationHeader(e.operationName);return e.bulkOperation&&(t[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_BULK_OPERATION]="true"),e.suppressChangeEvents&&(t[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_SUPPRESS_CHANGE_EVENTS]="true"),t}getOperationHeader(e){return{[request_header_constants_1.REQUEST_HEADERS.X_GRAPHQL_OPERATION]:e}}}exports.GraphQLService=GraphQLService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"query",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"mutate",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"delete",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"update",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"insert",null);
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,r,i){var o,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(n<3?o(a):n>3?o(t,r,a):o(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,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,r,i){return new(r||(r=Promise))((function(o,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function c(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}l((i=i.apply(e,t||[])).next())}))},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LockService=void 0;const logging_1=require("../logging"),logger_1=__importDefault(require("../logging/logger")),KEY_PREFIX="Z_LOCK_";class LockService{constructor(e){this.configVarClient=e}acquireLock(e){return __awaiter(this,void 0,void 0,(function*(){const t="Z_LOCK_"+e.name,r=new Date(Date.now()+e.ttl).toISOString();try{let i=null;try{i=yield this.configVarClient.get(t)}catch(e){}if(i){if(i.expiryDate&&new Date<new Date(i.expiryDate))return!1;yield this.configVarClient.delete(t)}return yield this.configVarClient.create({key:t,value:e.name,configType:"plain-text",description:e.description,expiryDate:r}),!0}catch(t){return logger_1.default.error(`Failed to acquire lock: ${e.name}`),!1}}))}releaseLock(e){return __awaiter(this,void 0,void 0,(function*(){const t="Z_LOCK_"+e;try{let e=null;try{e=yield this.configVarClient.get(t)}catch(e){}e&&(yield this.configVarClient.delete(t))}catch(t){logger_1.default.error(`Failed to release lock: ${e}`)}}))}}exports.LockService=LockService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],LockService.prototype,"acquireLock",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],LockService.prototype,"releaseLock",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,a,r){var i,o=arguments.length,c=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,a,r);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(c=(o<3?i(c):o>3?i(t,a,c):i(t,a))||c);return o>3&&c&&Object.defineProperty(t,a,c),c},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LockService=void 0;const logging_1=require("../logging"),logger_1=__importDefault(require("../logging/logger")),KEY_PREFIX="Z_LOCK_";class LockService{constructor(e){this.configVarClient=e}async acquireLock(e){const t="Z_LOCK_"+e.name,a=new Date(Date.now()+e.ttl).toISOString();try{let r=null;try{r=await this.configVarClient.get(t)}catch(e){}if(r){if(r.expiryDate&&new Date<new Date(r.expiryDate))return!1;await this.configVarClient.delete(t)}return await this.configVarClient.create({key:t,value:e.name,configType:"plain-text",description:e.description,expiryDate:a}),!0}catch(t){return logger_1.default.error(`Failed to acquire lock: ${e.name}`),!1}}async releaseLock(e){const t="Z_LOCK_"+e;try{let e=null;try{e=await this.configVarClient.get(t)}catch(e){}e&&await this.configVarClient.delete(t)}catch(t){logger_1.default.error(`Failed to release lock: ${e}`)}}}exports.LockService=LockService,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],LockService.prototype,"acquireLock",null),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],LockService.prototype,"releaseLock",null);
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,a,n){return new(a||(a=Promise))((function(i,r){function c(t){try{s(n.next(t))}catch(t){r(t)}}function o(t){try{s(n.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(c,o)}s((n=n.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetadataService=void 0;class MetadataService{constructor(t){this.client=t}getObjectMetadata(t){return __awaiter(this,void 0,void 0,(function*(){const e=yield this.client.fetchAllMetadata(),a={};for(const n of t){const t=e.find((t=>t.name===n));if(!t)throw new Error(`Metadata mapping not found for object: ${n}`);a[n]=yield this.client.fetchObjectMetadata(t.mapping)}return a}))}getPicklistValues(t){const e=t.fields.filter((t=>"picklist"===t.type)),a={};for(const t of e)a[t.name]=t.values.map((t=>t.value));return a}}exports.MetadataService=MetadataService;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetadataService=void 0;class MetadataService{constructor(t){this.client=t}async getObjectMetadata(t){const e=await this.client.fetchAllMetadata(),a={};for(const c of t){const t=e.find((t=>t.name===c));if(!t)throw new Error(`Metadata mapping not found for object: ${c}`);a[c]=await this.client.fetchObjectMetadata(t.mapping)}return a}getPicklistValues(t){const e=t.fields.filter((t=>"picklist"===t.type)),a={};for(const t of e)a[t.name]=t.values.map((t=>t.value));return a}}exports.MetadataService=MetadataService;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,a){function r(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataService=void 0;const tenant_objects_1=require("../../../core/tenant-objects"),graphql_1=require("../../graphql");class DataService{constructor(e){this.graphqlService=e}getResources(e){return __awaiter(this,void 0,void 0,(function*(){const t=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Resources.Name,operationName:"fetchResourcesWithAvailabilities"});t.withFields(tenant_objects_1.TenantObjects.Resources.Fields).withFilter("IsActive == true"),t.withParentQuery("PrimaryRegion").withFields(tenant_objects_1.TenantObjects.Regions.Fields),e.resourceIds&&e.resourceIds.size>0?t.withFilter(`UID IN ${JSON.stringify(Array.from(e.resourceIds))}`):e.regionIds&&e.regionIds.size>0&&t.withFilter(`PrimaryRegionId IN [${Array.from(e.regionIds).map((e=>`'${e}'`)).join(",")}]`),e.useTag&&t.withChildQuery(tenant_objects_1.TenantObjects.ResourceTags.Name).withParentQuery("Tag").withFields(tenant_objects_1.TenantObjects.Tags.Fields),e.useActivity&&t.withChildQuery(tenant_objects_1.TenantObjects.Activities.Name).withFields(tenant_objects_1.TenantObjects.Activities.Fields),e.useAvailability&&t.withChildQuery(tenant_objects_1.TenantObjects.Availabilities.Name).withFields(tenant_objects_1.TenantObjects.Availabilities.Fields),e.useJobAllocation&&t.withChildQuery(tenant_objects_1.TenantObjects.JobAllocations.Name).withFields(tenant_objects_1.TenantObjects.JobAllocations.Fields).withFilter("Status NOTIN ['Deleted', 'Declined']").withParentQuery("Job").withFields(tenant_objects_1.TenantObjects.Jobs.Fields);return(yield t.execute()).records}))}getHolidays(e,t,i){return __awaiter(this,void 0,void 0,(function*(){const n={},s=t?t.toISOString().split("T")[0]:null,a=i?i.toISOString().split("T")[0]:null,r=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Holidays.Name,operationName:"fetchHolidays"});r.withFields(tenant_objects_1.TenantObjects.Holidays.Fields),r.withFilter("Global == true"),s&&r.withFilter(`EndDate >= ${s}`),a&&r.withFilter(`StartDate <= ${a}`);const o=yield r.execute();if(n.GLOBAL=o.records||[],e&&e.length>0){const t=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Holidays.Name,operationName:"fetchHolidays"});t.withFields(tenant_objects_1.TenantObjects.Holidays.Fields),t.withChildQuery(tenant_objects_1.TenantObjects.HolidayRegions.Name).withFields(tenant_objects_1.TenantObjects.HolidayRegions.Fields).withFilter(`RegionId IN [${e.map((e=>`'${e}'`)).join(",")}]`),s&&t.withFilter(`EndDate >= ${s}`),a&&t.withFilter(`StartDate <= ${a}`);const i=yield t.execute();for(const e of i.records||[])for(const t of e.HolidayRegions||[]){const i=t.RegionId;n[i]||(n[i]=[]),n[i].push(e)}}return n}))}newQueryBuilder(e){const t=new graphql_1.GraphQLQueryBuilder(e);return t.setGraphqlService(this.graphqlService),t}}exports.DataService=DataService;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataService=void 0;const tenant_objects_1=require("../../../core/tenant-objects"),graphql_1=require("../../graphql");class DataService{constructor(e){this.graphqlService=e}async getResources(e){const t=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Resources.Name,operationName:"fetchResourcesWithAvailabilities"});t.withFields(tenant_objects_1.TenantObjects.Resources.Fields).withFilter("IsActive == true"),t.withParentQuery("PrimaryRegion").withFields(tenant_objects_1.TenantObjects.Regions.Fields),e.resourceIds&&e.resourceIds.size>0?t.withFilter(`UID IN ${JSON.stringify(Array.from(e.resourceIds))}`):e.regionIds&&e.regionIds.size>0&&t.withFilter(`PrimaryRegionId IN [${Array.from(e.regionIds).map((e=>`'${e}'`)).join(",")}]`),e.useTag&&t.withChildQuery(tenant_objects_1.TenantObjects.ResourceTags.Name).withParentQuery("Tag").withFields(tenant_objects_1.TenantObjects.Tags.Fields),e.useActivity&&t.withChildQuery(tenant_objects_1.TenantObjects.Activities.Name).withFields(tenant_objects_1.TenantObjects.Activities.Fields),e.useAvailability&&t.withChildQuery(tenant_objects_1.TenantObjects.Availabilities.Name).withFields(tenant_objects_1.TenantObjects.Availabilities.Fields),e.useJobAllocation&&t.withChildQuery(tenant_objects_1.TenantObjects.JobAllocations.Name).withFields(tenant_objects_1.TenantObjects.JobAllocations.Fields).withFilter("Status NOTIN ['Deleted', 'Declined']").withParentQuery("Job").withFields(tenant_objects_1.TenantObjects.Jobs.Fields);return(await t.execute()).records}async getHolidays(e,t,i){const s={},n=t?t.toISOString().split("T")[0]:null,a=i?i.toISOString().split("T")[0]:null,r=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Holidays.Name,operationName:"fetchHolidays"});r.withFields(tenant_objects_1.TenantObjects.Holidays.Fields),r.withFilter("Global == true"),n&&r.withFilter(`EndDate >= ${n}`),a&&r.withFilter(`StartDate <= ${a}`);const o=await r.execute();if(s.GLOBAL=o.records||[],e&&e.length>0){const t=this.newQueryBuilder({objectName:tenant_objects_1.TenantObjects.Holidays.Name,operationName:"fetchHolidays"});t.withFields(tenant_objects_1.TenantObjects.Holidays.Fields),t.withChildQuery(tenant_objects_1.TenantObjects.HolidayRegions.Name).withFields(tenant_objects_1.TenantObjects.HolidayRegions.Fields).withFilter(`RegionId IN [${e.map((e=>`'${e}'`)).join(",")}]`),n&&t.withFilter(`EndDate >= ${n}`),a&&t.withFilter(`StartDate <= ${a}`);const i=await t.execute();for(const e of i.records||[])for(const t of e.HolidayRegions||[]){const i=t.RegionId;s[i]||(s[i]=[]),s[i].push(e)}}return s}newQueryBuilder(e){const t=new graphql_1.GraphQLQueryBuilder(e);return t.setGraphqlService(this.graphqlService),t}}exports.DataService=DataService;
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(a,n){function s(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResourceAvailabilityService=void 0;class ResourceAvailabilityService{constructor(e){this.availabilityAPIClient=e}getAvailabilityPatterns(e){return __awaiter(this,void 0,void 0,(function*(){const t=yield this.availabilityAPIClient.fetchAvailability({resourceIds:Array.from(e.resourceIds||[]),start:e.startTime.toISOString(),end:e.endTime.toISOString(),mergedAvailabilities:!1,entries:!0}),i=new Map;return t.forEach((e=>{if(!e.entries)return;const t=e.entries.filter((e=>"pattern"===e.type)).map((e=>({id:`${e.start}_${e.end}`,name:`${e.name}(${e.type})`,start:e.start?new Date(e.start):new Date(0),finish:e.end?new Date(e.end):new Date(0),eventType:e.type})));i.set(e.resourceId,t)})),i}))}}exports.ResourceAvailabilityService=ResourceAvailabilityService;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResourceAvailabilityService=void 0;class ResourceAvailabilityService{constructor(e){this.availabilityAPIClient=e}async getAvailabilityPatterns(e){const t=await this.availabilityAPIClient.fetchAvailability({resourceIds:Array.from(e.resourceIds||[]),start:e.startTime.toISOString(),end:e.endTime.toISOString(),mergedAvailabilities:!1,entries:!0}),i=new Map;return t.forEach((e=>{if(!e.entries)return;const t=e.entries.filter((e=>"pattern"===e.type)).map((e=>({id:`${e.start}_${e.end}`,name:`${e.name}(${e.type})`,start:e.start?new Date(e.start):new Date(0),finish:e.end?new Date(e.end):new Date(0),eventType:e.type})));i.set(e.resourceId,t)})),i}}exports.ResourceAvailabilityService=ResourceAvailabilityService;
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,i,a){var r,s=arguments.length,o=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},__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,i,a){return new(i||(i=Promise))((function(r,s){function o(e){try{l(a.next(e))}catch(e){s(e)}}function n(e){try{l(a.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(o,n)}l((a=a.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResourceBuilder=void 0;const entity_factory_1=require("../../../core/entity-factory"),logging_1=require("../../../logging"),utils_1=require("../../../utils"),resource_query_param_1=require("./resource-query-param");class ResourceBuilder{constructor(e,t){this.dataService=e,this.availabilityService=t}build(e){return __awaiter(this,void 0,void 0,(function*(){var t,i;if(!e)throw new Error("ResourceBuilder Error: queryParam is required");const a=[],r=yield this.dataService.getResources(e);e.resourceIds&&0!==e.resourceIds.size||(e.resourceIds=new Set(r.map((e=>e.UID))));for(const t of r){const i=entity_factory_1.EntityFactory.createResource(t);a.push(i),e.useActivity&&this.loadActivityEvents(t,i),e.useAvailability&&this.loadAvailabilityEvents(t,i),e.useJobAllocation&&this.loadJobAllocationEvents(t,i),e.useResourceShift&&this.loadResourceShiftEvents(t,i),e.useHoliday&&this.loadHolidayEvents(i,e)}e.useAvailabilityPattern&&(yield this.loadAvailabilityPatterns(a,e));for(const r of a)e.mergeAvailability?r.availabilities=utils_1.DateTimeUtils.mergeEvents(r.availabilities):null===(t=r.availabilities)||void 0===t||t.sort(((e,t)=>e.start.getTime()-t.start.getTime())),e.mergeEvents?r.events=utils_1.DateTimeUtils.mergeEvents(r.events):null===(i=r.events)||void 0===i||i.sort(((e,t)=>e.start.getTime()-t.start.getTime()));return this.buildMore(a)}))}loadAvailabilityPatterns(e,t){return __awaiter(this,void 0,void 0,(function*(){const i=yield this.availabilityService.getAvailabilityPatterns(t);for(const t of e)t.availabilities.push(...i.get(t.id)||[])}))}loadActivityEvents(e,t){e.Activities&&t.events.push(...e.Activities.map((e=>({id:e.UID,name:e.Name,start:new Date(e.Start),finish:new Date(e.End),eventType:"activity"}))))}loadAvailabilityEvents(e,t){if(e.availabilities){const i=[],a=[];e.Availabilities.forEach((e=>{e.IsAvailable?i.push(entity_factory_1.EntityFactory.createBaseEvent(e)):a.push(entity_factory_1.EntityFactory.createBaseEvent(e))})),t.availabilities=i,t.events.push(...a)}}loadJobAllocationEvents(e,t){e.JobAllocations&&t.events.push(...e.JobAllocations.map((e=>({id:e.UID,name:e.Name,start:e.Start?new Date(e.Start):void 0,finish:e.End?new Date(e.End):void 0,eventType:"job_allocation"}))))}loadResourceShiftEvents(e,t){e.resourceShifts&&t.events.push(...e.resourceShifts.map((e=>({id:e.id,name:e.name,start:e.start?new Date(e.start):new Date(0),finish:e.finish?new Date(e.finish):new Date(0),eventType:"resource_shift"}))))}loadHolidayEvents(e,t){return __awaiter(this,void 0,void 0,(function*(){const i=yield this.dataService.getHolidays(Array.from(t.regionIds||[]),t.startTime,t.endTime),a=i.GLOBAL||[];i[e.regionId]&&a.push(...i[e.regionId]),a.forEach((i=>{let a=utils_1.DateTimeUtils.getStartOfDate(i.StartDate,e.timezone),r=utils_1.DateTimeUtils.getEndOfDate(i.EndDate,e.timezone);a<t.startTime&&(a=t.startTime),r>t.endTime&&(r=t.endTime),e.events.push({id:`${a.toISOString()}_${r.toISOString()}`,name:i.Name,start:a,finish:r,eventType:"holiday"})}))}))}buildMore(e){return e}}exports.ResourceBuilder=ResourceBuilder,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[resource_query_param_1.ResourceQueryParam]),__metadata("design:returntype",Promise)],ResourceBuilder.prototype,"build",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(e,t,i,a){var s,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},__metadata=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResourceBuilder=void 0;const entity_factory_1=require("../../../core/entity-factory"),logging_1=require("../../../logging"),utils_1=require("../../../utils"),resource_query_param_1=require("./resource-query-param");class ResourceBuilder{constructor(e,t){this.dataService=e,this.availabilityService=t}async build(e){var t,i;if(!e)throw new Error("ResourceBuilder Error: queryParam is required");const a=[],s=await this.dataService.getResources(e);e.resourceIds&&0!==e.resourceIds.size||(e.resourceIds=new Set(s.map((e=>e.UID))));for(const t of s){const i=entity_factory_1.EntityFactory.createResource(t);a.push(i),e.useActivity&&this.loadActivityEvents(t,i),e.useAvailability&&this.loadAvailabilityEvents(t,i),e.useJobAllocation&&this.loadJobAllocationEvents(t,i),e.useResourceShift&&this.loadResourceShiftEvents(t,i),e.useHoliday&&this.loadHolidayEvents(i,e)}e.useAvailabilityPattern&&await this.loadAvailabilityPatterns(a,e);for(const s of a)e.mergeAvailability?s.availabilities=utils_1.DateTimeUtils.mergeEvents(s.availabilities):null===(t=s.availabilities)||void 0===t||t.sort(((e,t)=>e.start.getTime()-t.start.getTime())),e.mergeEvents?s.events=utils_1.DateTimeUtils.mergeEvents(s.events):null===(i=s.events)||void 0===i||i.sort(((e,t)=>e.start.getTime()-t.start.getTime()));return this.buildMore(a)}async loadAvailabilityPatterns(e,t){const i=await this.availabilityService.getAvailabilityPatterns(t);for(const t of e)t.availabilities.push(...i.get(t.id)||[])}loadActivityEvents(e,t){e.Activities&&t.events.push(...e.Activities.map((e=>({id:e.UID,name:e.Name,start:new Date(e.Start),finish:new Date(e.End),eventType:"activity"}))))}loadAvailabilityEvents(e,t){if(e.availabilities){const i=[],a=[];e.Availabilities.forEach((e=>{e.IsAvailable?i.push(entity_factory_1.EntityFactory.createBaseEvent(e)):a.push(entity_factory_1.EntityFactory.createBaseEvent(e))})),t.availabilities=i,t.events.push(...a)}}loadJobAllocationEvents(e,t){e.JobAllocations&&t.events.push(...e.JobAllocations.map((e=>({id:e.UID,name:e.Name,start:e.Start?new Date(e.Start):void 0,finish:e.End?new Date(e.End):void 0,eventType:"job_allocation"}))))}loadResourceShiftEvents(e,t){e.resourceShifts&&t.events.push(...e.resourceShifts.map((e=>({id:e.id,name:e.name,start:e.start?new Date(e.start):new Date(0),finish:e.finish?new Date(e.finish):new Date(0),eventType:"resource_shift"}))))}async loadHolidayEvents(e,t){const i=await this.dataService.getHolidays(Array.from(t.regionIds||[]),t.startTime,t.endTime),a=i.GLOBAL||[];i[e.regionId]&&a.push(...i[e.regionId]),a.forEach((i=>{let a=utils_1.DateTimeUtils.getStartOfDate(i.StartDate,e.timezone),s=utils_1.DateTimeUtils.getEndOfDate(i.EndDate,e.timezone);a<t.startTime&&(a=t.startTime),s>t.endTime&&(s=t.endTime),e.events.push({id:`${a.toISOString()}_${s.toISOString()}`,name:i.Name,start:a,finish:s,eventType:"holiday"})}))}buildMore(e){return e}}exports.ResourceBuilder=ResourceBuilder,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[resource_query_param_1.ResourceQueryParam]),__metadata("design:returntype",Promise)],ResourceBuilder.prototype,"build",null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/pulse-solution-services",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "A collection of services and utilities to support solution development on the Pulse platform.",
5
5
  "author": "Skedulo",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "yarn.lock"
25
25
  ],
26
26
  "devDependencies": {
27
- "@tsconfig/node18": "^18.2.2",
27
+ "@tsconfig/node18": "^18.2.4",
28
28
  "@types/uuid": "^10.0.0",
29
29
  "@typescript-eslint/eslint-plugin": "^8.11.0",
30
30
  "@typescript-eslint/parser": "^8.11.0",