@skedulo/pulse-solution-services 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/artifact-client.js +1 -1
- package/dist/clients/availability-api-client.js +1 -1
- package/dist/clients/base-client.js +1 -1
- package/dist/clients/config-features-client.js +1 -1
- package/dist/clients/config-template-client.js +1 -1
- package/dist/clients/config-var-client.js +1 -1
- package/dist/clients/files-api-client.js +1 -1
- package/dist/clients/geo-api-client.js +1 -1
- package/dist/clients/graphql-client.js +1 -1
- package/dist/clients/metadata-client.js +1 -1
- package/dist/clients/mobile-notification-client.js +1 -1
- package/dist/clients/org-preference-client.js +1 -1
- package/dist/clients/vocabulary-client.js +1 -1
- package/dist/core/entity-factory.js +1 -1
- package/dist/core/execution-context.js +1 -1
- package/dist/logging/decorators/log-method.js +1 -1
- package/dist/logging/logger.js +1 -1
- package/dist/monitoring/decorators/monitor-call.js +1 -1
- package/dist/monitoring/monitoring-manager.js +1 -1
- package/dist/services/cache/cache-service.js +1 -1
- package/dist/services/cache/storage/config-var-cache-storage.js +1 -1
- package/dist/services/cache/storage/in-memory-cache-storage.js +1 -1
- package/dist/services/geoservice.js +1 -1
- package/dist/services/graph-batch/graph-batch.js +1 -1
- package/dist/services/graph-batch/unique-graph-batch.js +1 -1
- package/dist/services/graphql/graphql-batch-builder.js +1 -1
- package/dist/services/graphql/graphql-query-batch.js +1 -1
- package/dist/services/graphql/graphql-query-builder.js +1 -1
- package/dist/services/graphql/graphql-service.js +1 -1
- package/dist/services/graphql/queries.js +1 -1
- package/dist/services/graphql/queries.test.js +1 -0
- package/dist/services/lock-service.js +1 -1
- package/dist/services/metadata-service.js +1 -1
- package/dist/services/resource-availability/builder/data-service.js +1 -1
- package/dist/services/resource-availability/builder/resource-availability-service.js +1 -1
- package/dist/services/resource-availability/builder/resource-builder.js +1 -1
- package/dist/services/resource-availability/validator/resource-validator.js +1 -1
- package/dist/services/resource-availability/validator/validation-result.js +1 -1
- package/dist/utils/datetime-utils.js +1 -1
- package/dist/utils/object-utils.js +1 -1
- package/package.json +2 -1
|
@@ -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))(
|
|
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{d(i.next(t))}catch(t){o(t)}}function s(t){try{d(i.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,s)}d((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}`,this.statusEndpoint="artifacts/status"}list(){return __awaiter(this,void 0,void 0,function*(){return this._performRequest({endpoint:this.baseEndpoint})})}status(t){return __awaiter(this,void 0,void 0,function*(){return this._performRequest({endpoint:`${this.statusEndpoint}/${t}`})})}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.baseEndpoint,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})})}upsert(t,e){return __awaiter(this,void 0,void 0,function*(){return this._performRequest({method:constants_1.HttpMethod.POST,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",[String]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"status",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,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"upsert",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(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o},__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,i,r){return new(i||(i=Promise))(
|
|
1
|
+
"use strict";var __decorate=this&&this.__decorate||function(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o},__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,i,r){return new(i||(i=Promise))(function(n,a){function o(t){try{s(r.next(t))}catch(t){a(t)}}function l(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,l)}s((r=r.apply(t,e||[])).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(t){return __awaiter(this,void 0,void 0,function*(){var e,i,r,n;if(!t.resourceIds.length)throw new Error("At least one resource ID must be provided.");const a={resource_ids:t.resourceIds.join(","),start:t.start,end:t.end,mergedAvailabilities:null!==(i=null===(e=t.mergedAvailabilities)||void 0===e?void 0:e.toString())&&void 0!==i?i:"false",entries:null!==(n=null===(r=t.entries)||void 0===r?void 0:r.toString())&&void 0!==n?n:"true"};return yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.SIMPLE,queryParams:a})})}upsertPattern(t){return __awaiter(this,void 0,void 0,function*(){if(!t.pattern.name)throw new Error("Pattern name is required.");const e=yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.PATTERNS,method:"POST",body:t});if("string"==typeof e)return e;if(e&&"object"==typeof e&&"created"in e)return e.created;throw new Error("Unexpected response format from patterns API")})}}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),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],AvailabilityAPIClient.prototype,"upsertPattern",null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __decorate=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>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,n){return new(r||(r=Promise))(
|
|
1
|
+
"use strict";var __decorate=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>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,n){return new(r||(r=Promise))(function(o,i){function a(e){try{d(n.next(e))}catch(e){i(e)}}function s(e){try{d(n.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}d((n=n.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:r={},body:n,queryParams:o},i=this.executionOptions){return this._performRequest({method:e,endpoint:t,headers:r,body:n,queryParams:o},i)})}performRequestWithHeaders(e){return __awaiter(this,arguments,void 0,function*({method:e="GET",endpoint:t,headers:r={},body:n,queryParams:o},i=this.executionOptions){return this._performRequestWithHeaders({method:e,endpoint:t,headers:r,body:n,queryParams:o},i)})}_performRequest(e){return __awaiter(this,arguments,void 0,function*({method:e="GET",endpoint:t,headers:r={},body:n,queryParams:o},i=this.executionOptions){return(yield this._performRequestWithHeaders({method:e,endpoint:t,headers:r,body:n,queryParams:o},i)).data})}_performRequestWithHeaders(e){return __awaiter(this,arguments,void 0,function*({method:e="GET",endpoint:t,headers:r={},body:n,queryParams:o},i=this.executionOptions){try{const a=Object.assign(Object.assign({},this.getHeaders(i)),r),s=this.buildUrl(t,o),d=yield fetch(s,{method:e,headers:a,body:n&&"GET"!==e?JSON.stringify(n):void 0});let c;const u=d.headers.get("content-type");if(u&&u.includes("application/json")?(c=yield d.json(),c.result&&(c=c.result)):c=yield d.text(),!d.ok)throw new Error(`HTTP error! Status: ${d.status}. Response: ${JSON.stringify(c)}`);return this.handleResponseData(c),{data:c,headers:d.headers}}catch(e){throw this.handleException(e),e}})}handleResponseData(e){}getHeaders(e){var t,r;const n={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===(r=this.executionOptions)||void 0===r?void 0:r.userAgent);return o&&(n[request_header_constants_1.REQUEST_HEADERS.X_SKEDULO_SOURCE]=o),i&&(n[request_header_constants_1.REQUEST_HEADERS.USER_AGENT]=i),n}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),__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,"performRequestWithHeaders",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))(
|
|
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 +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))(
|
|
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)}`})})}getTemplateValues(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,"getTemplateValues",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))(
|
|
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 +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))(
|
|
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 +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))(
|
|
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 +1 @@
|
|
|
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)},__awaiter=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))(
|
|
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)},__awaiter=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))(function(n,o){function i(e){try{c(a.next(e))}catch(e){o(e)}}function s(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,s)}c((a=a.apply(e,t||[])).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(e){return __awaiter(this,arguments,void 0,function*(e,t={}){const r=yield this._performRequestWithHeaders({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}),a=r.headers.get("X-Skedulo-Dynamic-Query-Limit"),n=r.data;return a&&(n.queryLimit=parseInt(a,10)),n})}executeBatch(e){return __awaiter(this,arguments,void 0,function*(e,t={}){const r=e.map(e=>"string"==typeof e?{query:e}:{query:e.query,variables:e.variables}),a=yield this._performRequest({method:http_1.HttpMethod.POST,endpoint:constants_1.TENANT_ENDPOINTS.GRAPHQL.BATCH,body:r,headers:t});return a.forEach((e,t)=>{if(!e.data&&e.errors)throw new Error(`GraphQL batch error at index ${t}: ${JSON.stringify(e.errors)}`)}),a})}handleResponseData(e){if(Array.isArray(e));else 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",[Array,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))(
|
|
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 +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))(
|
|
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 +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))(
|
|
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 +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))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EntityFactory=void 0;class EntityFactory{static createBaseObject(e){return{id:e.UID||"",name:e.Name||"",propertyMap:{}}}static createBaseEvent(e){const t=e.Finish?e.Finish:e.End;return Object.assign(Object.assign({},this.createBaseObject(e)),{start:new Date(e.Start),finish:new Date(t),eventType:e.Type||""})}static createTag(e){return this.createBaseObject(e)}static createResource(e){var t;return Object.assign(Object.assign({},this.createBaseObject(e)),{category:e.Category||"",employmentType:e.EmploymentType||"",resourceType:e.ResourceType||"",userId:e.UserId||"",regionId:e.PrimaryRegionId||"",timezone:(null===(t=e.PrimaryRegion)||void 0===t?void 0:t.Timezone)||"",tags:(e.ResourceTags||[]).map(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EntityFactory=void 0;class EntityFactory{static createBaseObject(e){return{id:e.UID||"",name:e.Name||"",propertyMap:{}}}static createBaseEvent(e){const t=e.Finish?e.Finish:e.End;return Object.assign(Object.assign({},this.createBaseObject(e)),{start:new Date(e.Start),finish:new Date(t),eventType:e.Type||""})}static createTag(e){return this.createBaseObject(e)}static createResource(e){var t;return Object.assign(Object.assign({},this.createBaseObject(e)),{category:e.Category||"",employmentType:e.EmploymentType||"",resourceType:e.ResourceType||"",userId:e.UserId||"",regionId:e.PrimaryRegionId||"",timezone:(null===(t=e.PrimaryRegion)||void 0===t?void 0:t.Timezone)||"",tags:(e.ResourceTags||[]).map(e=>this.createTag(e.Tag)),availabilities:[],events:[]})}static createJob(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{jobStatus:e.JobStatus||"",regionId:e.RegionId||"",contactId:e.ContactId||"",geoLocation:e.GeoLocation||{lat:e.GeoLatitude,lng:e.GeoLongitude},address:e.Address,eventType:"job",tags:(e.JobTags||[]).map(e=>this.createTag(e.Tag))})}static createAvailability(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{resourceId:e.resourceId||"",isAvailable:!0===e.isAvailable||"true"===e.isAvailable,status:e.status||"",availabilityType:e.availabilityType||""})}static createActivity(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{resourceId:e.resourceId||"",activityType:e.activityType||""})}static createJobAllocation(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{jobId:e.jobId||"",resourceId:e.resourceId||"",status:e.status||""})}static createResourceShift(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{resourceId:e.resourceId||"",shift:this.createShift(e.shift||{})})}static createShift(e){return Object.assign(Object.assign({},this.createBaseEvent(e)),{regionId:e.regionId||"",displayName:e.displayName||"",isDraft:!0===e.isDraft||"true"===e.isDraft})}}exports.EntityFactory=EntityFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExecutionContext=void 0;const function_utilities_1=require("@skedulo/function-utilities"),clients_1=require("../clients"),artifact_client_1=require("../clients/artifact-client"),availability_api_client_1=require("../clients/availability-api-client"),config_features_client_1=require("../clients/config-features-client"),config_template_client_1=require("../clients/config-template-client"),config_var_client_1=require("../clients/config-var-client"),files_api_client_1=require("../clients/files-api-client"),geo_api_client_1=require("../clients/geo-api-client"),graphql_client_1=require("../clients/graphql-client"),metadata_client_1=require("../clients/metadata-client"),mobile_notification_client_1=require("../clients/mobile-notification-client"),org_preference_client_1=require("../clients/org-preference-client"),vocabulary_client_1=require("../clients/vocabulary-client"),logger_1=__importDefault(require("../logging/logger")),monitoring_constants_1=require("../monitoring/monitoring-constants"),monitoring_registry_1=require("../monitoring/monitoring-registry"),cache_service_1=require("../services/cache/cache-service"),storage_1=require("../services/cache/storage"),geoservice_1=require("../services/geoservice"),graphql_1=require("../services/graphql"),lock_service_1=require("../services/lock-service"),metadata_service_1=require("../services/metadata-service"),data_service_1=require("../services/resource-availability/builder/data-service"),resource_availability_service_1=require("../services/resource-availability/builder/resource-availability-service"),resource_builder_1=require("../services/resource-availability/builder/resource-builder"),utils_1=require("../utils"),request_header_constants_1=require("./request-header-constants");class ExecutionContext{constructor(e,i={},t){this.logger=logger_1.default,this.services=new Map,this.skedContext=e,this.contextData={},this._executionOptions=i,this.baseConfig={apiToken:e.auth.token,apiServer:e.auth.baseUrl},(0,monitoring_registry_1.initGlobalMonitorManager)(t)}static fromContext(e,i={},t=monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG){return new ExecutionContext(e,i,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),t))}static fromCredentials(e,i={},t=monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG){const r={Authorization:`Bearer ${e.apiToken}`,[request_header_constants_1.REQUEST_HEADERS.SKED_API_SERVER]:e.apiServer},n=(0,function_utilities_1.createSkedContext)(r);return new ExecutionContext(n,i,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),t))}set executionOptions(e){this._executionOptions=Object.assign(Object.assign({},this._executionOptions),e)}get executionOptions(){return this._executionOptions}getOrCreateService(e,i){return this.services.has(e)||this.services.set(e,i()),this.services.get(e)}get configHelper(){return this.getOrCreateService("configHelper",(
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExecutionContext=void 0;const function_utilities_1=require("@skedulo/function-utilities"),clients_1=require("../clients"),artifact_client_1=require("../clients/artifact-client"),availability_api_client_1=require("../clients/availability-api-client"),config_features_client_1=require("../clients/config-features-client"),config_template_client_1=require("../clients/config-template-client"),config_var_client_1=require("../clients/config-var-client"),files_api_client_1=require("../clients/files-api-client"),geo_api_client_1=require("../clients/geo-api-client"),graphql_client_1=require("../clients/graphql-client"),metadata_client_1=require("../clients/metadata-client"),mobile_notification_client_1=require("../clients/mobile-notification-client"),org_preference_client_1=require("../clients/org-preference-client"),vocabulary_client_1=require("../clients/vocabulary-client"),logger_1=__importDefault(require("../logging/logger")),monitoring_constants_1=require("../monitoring/monitoring-constants"),monitoring_registry_1=require("../monitoring/monitoring-registry"),cache_service_1=require("../services/cache/cache-service"),storage_1=require("../services/cache/storage"),geoservice_1=require("../services/geoservice"),graphql_1=require("../services/graphql"),lock_service_1=require("../services/lock-service"),metadata_service_1=require("../services/metadata-service"),data_service_1=require("../services/resource-availability/builder/data-service"),resource_availability_service_1=require("../services/resource-availability/builder/resource-availability-service"),resource_builder_1=require("../services/resource-availability/builder/resource-builder"),utils_1=require("../utils"),request_header_constants_1=require("./request-header-constants");class ExecutionContext{constructor(e,i={},t){this.logger=logger_1.default,this.services=new Map,this.skedContext=e,this.contextData={},this._executionOptions=i,this.baseConfig={apiToken:e.auth.token,apiServer:e.auth.baseUrl},(0,monitoring_registry_1.initGlobalMonitorManager)(t)}static fromContext(e,i={},t=monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG){return new ExecutionContext(e,i,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),t))}static fromCredentials(e,i={},t=monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG){const r={Authorization:`Bearer ${e.apiToken}`,[request_header_constants_1.REQUEST_HEADERS.SKED_API_SERVER]:e.apiServer},n=(0,function_utilities_1.createSkedContext)(r);return new ExecutionContext(n,i,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),t))}set executionOptions(e){this._executionOptions=Object.assign(Object.assign({},this._executionOptions),e)}get executionOptions(){return this._executionOptions}getOrCreateService(e,i){return this.services.has(e)||this.services.set(e,i()),this.services.get(e)}get configHelper(){return this.getOrCreateService("configHelper",()=>new utils_1.ConfigHelper(this.skedContext.configVars))}get baseClient(){return this.getOrCreateService("baseClient",()=>new clients_1.BaseClient(this.baseConfig,this.executionOptions))}get graphqlClient(){return this.getOrCreateService("graphqlClient",()=>new graphql_client_1.GraphQLClient(this.baseConfig,this.executionOptions))}get graphqlService(){return this.getOrCreateService("graphqlService",()=>new graphql_1.GraphQLService(this.graphqlClient))}get metadataClient(){return this.getOrCreateService("metadataClient",()=>new metadata_client_1.MetadataClient(this.baseConfig,this.executionOptions))}get metadataService(){return this.getOrCreateService("metadataService",()=>new metadata_service_1.MetadataService(this.metadataClient))}get vocabularyClient(){return this.getOrCreateService("vocabularyClient",()=>new vocabulary_client_1.VocabularyClient(this.baseConfig,this.executionOptions))}get orgPreferencesClient(){return this.getOrCreateService("orgPreferencesClient",()=>new org_preference_client_1.OrgPreferenceClient(this.baseConfig,this.executionOptions))}get configTemplateClient(){return this.getOrCreateService("configTemplateClient",()=>new config_template_client_1.ConfigTemplateClient(this.baseConfig,this.executionOptions))}get configFeaturesClient(){return this.getOrCreateService("configFeaturesClient",()=>new config_features_client_1.ConfigFeaturesClient(this.baseConfig,this.executionOptions))}get configVarClient(){return this.getOrCreateService("configVarClient",()=>new config_var_client_1.ConfigVarClient(this.baseConfig,this.executionOptions))}get mobileNotificationClient(){return this.getOrCreateService("mobileNotificationClient",()=>new mobile_notification_client_1.MobileNotificationClient(this.baseConfig,this.executionOptions))}get geoAPIClient(){return this.getOrCreateService("geoAPIClient",()=>new geo_api_client_1.GeoAPIClient(this.baseConfig,this.executionOptions))}get availabilityAPIClient(){return this.getOrCreateService("availabilityAPIClient",()=>new availability_api_client_1.AvailabilityAPIClient(this.baseConfig,this.executionOptions))}get filesAPIClient(){return this.getOrCreateService("filesAPIClient",()=>new files_api_client_1.FilesAPIClient(this.baseConfig,this.executionOptions))}get geoService(){return this.getOrCreateService("geoService",()=>new geoservice_1.GeoService(this.geoAPIClient))}get lockService(){return this.getOrCreateService("lockService",()=>new lock_service_1.LockService(this.configVarClient))}get configVarCache(){return this.getOrCreateService("configVarCache",()=>new cache_service_1.CacheService(new storage_1.ConfigVarCacheStorage(this.configVarClient)))}get inMemoryCache(){return this.getOrCreateService("inMemoryCache",()=>{const e=new cache_service_1.CacheService(new storage_1.InMemoryCacheStorage);return e.setSecondaryCache(this.configVarCache),e})}get resourceAvailabilityService(){return this.getOrCreateService("resourceAvailabilityService",()=>new resource_availability_service_1.ResourceAvailabilityService(this.availabilityAPIClient))}get dataService(){return this.getOrCreateService("dataService",()=>new data_service_1.DataService(this.graphqlService))}get resourceBuilder(){return this.getOrCreateService("resourceBuilder",()=>new resource_builder_1.ResourceBuilder(this.dataService,this.resourceAvailabilityService))}newQueryBuilder(e){const i=new graphql_1.GraphQLQueryBuilder(e);return i.setGraphqlService(this.graphqlService),i}newArtifactClient(e){return this.getOrCreateService(`${e}Client`,()=>new artifact_client_1.ArtifactClient(this.baseConfig,e,this.executionOptions))}dispose(){this.services.clear()}getExecutionMetrics(){return(0,monitoring_registry_1.getGlobalMonitorManager)().getExecutionMetrics()}}exports.ExecutionContext=ExecutionContext,ExecutionContext.instance=null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,n,e,o){return new(e||(e=Promise))(
|
|
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:"[0m",GREEN:"[32m",YELLOW:"[33m",RED:"[31m",CYAN:"[36m",MAGENTA:"[35m"};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}}
|
package/dist/logging/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const winston_1=require("winston"),devFormat=winston_1.format.printf((
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const winston_1=require("winston"),devFormat=winston_1.format.printf(({timestamp:e,level:o,message:t})=>`[${e}] ${o.toUpperCase()}: ${t}`),logger=(0,winston_1.createLogger)({level:process.env.LOG_LEVEL||"info",format:winston_1.format.combine(winston_1.format.timestamp({format:"YYYY-MM-DD HH:mm:ss.SSS"}),"production"===process.env.NODE_ENV?winston_1.format.json():devFormat),transports:[new winston_1.transports.Console]});exports.default=logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,n,r,o){return new(r||(r=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,o,s){return new(o||(o=Promise))(
|
|
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 +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))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(
|
|
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}`)}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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(o,s){function n(t){try{h(i.next(t))}catch(t){s(t)}}function a(t){try{h(i.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLBatchBuilder=exports.GraphQLQueryBuilder=void 0;const graphql_1=require("../../interfaces/graphql");class GraphQLQueryBuilder{constructor(t,e=!1){if(this.fields=new Set(["UID"]),this.filters=[],this.input=null,this.parentQueries={},this.childQueries={},this.graphqlService=null,!t.objectName||!t.operationName)throw new Error("objectName and operationName are required.");this.queryParams=t,this.objectName=t.objectName.charAt(0).toLowerCase()+t.objectName.slice(1),this.operationName=t.operationName,this.operationType=t.operationType||"query",this.isParent=e}setGraphqlService(t){return this.graphqlService=t,this}withFields(t){return t.forEach(t=>this.fields.add(t)),this}withFilter(t){if("mutation"===this.operationType)throw new Error("Cannot apply filters to a mutation.");if(this.isParent)throw new Error(`Cannot apply filters to parent query for object: ${this.objectName}`);return this.filters.push(t),this}withInput(t){if("query"===this.operationType)throw new Error("Cannot apply input to a query.");if(!t||0===Object.keys(t).length)throw new Error("Mutation input cannot be empty.");return this.input=t,this}withLimit(t){if("mutation"===this.operationType)throw new Error("Cannot apply limit to a mutation.");if(this.isParent)throw new Error(`Cannot apply limit to parent query for object: ${this.objectName}`);return this.first=t,this}withOffset(t){if("mutation"===this.operationType)throw new Error("Cannot apply offset to a mutation.");if(this.isParent)throw new Error(`Cannot apply offset to parent query for object: ${this.objectName}`);return this.offset=t,this}withOrderBy(t){if("mutation"===this.operationType)throw new Error("Cannot apply orderBy to a mutation.");if(this.isParent)throw new Error(`Cannot apply orderBy to parent query for object: ${this.objectName}`);return this.orderBy=t,this}withCursor(t){if("mutation"===this.operationType)throw new Error("Cannot apply cursor to a mutation.");if(this.isParent)throw new Error(`Cannot apply cursor to parent query for object: ${this.objectName}`);return this.after=t,this}withParentQuery(t){const e=new GraphQLQueryBuilder({objectName:t,operationName:this.operationName,operationType:this.operationType},!0);return this.parentQueries[t]=e,e}withChildQuery(t){const e=new GraphQLQueryBuilder({objectName:t,operationName:this.operationName,operationType:this.operationType});return this.childQueries[t]=e,e}formatQueryFields(){const t=[...this.fields];for(const[e,r]of Object.entries(this.parentQueries))t.push(`${e} { ${r.formatQueryFields()} }`);for(const[e,r]of Object.entries(this.childQueries)){const i=r.build(),o=i.filter?`(filter: "${i.filter}")`:"";t.push(`${e} ${o} { ${i.fields||"UID"} }`)}return t.filter(Boolean).join(", ")}build(){const t={objectName:this.objectName,operationName:this.operationName,operationType:this.operationType,fields:this.formatQueryFields(),readOnly:this.queryParams.readOnly};return"query"===this.operationType?(t.filter=this.filters.length>0?this.filters.join(" AND "):void 0,t.first=this.first,t.offset=this.offset,t.orderBy=this.orderBy,t.after=this.after):t.input=this.input||void 0,t}execute(){var t;if(!this.graphqlService)throw new Error(`No GraphQL service set for ${this.operationType} execution on ${this.objectName}.`);const e=this.build();if("mutation"===this.operationType){const r={objectName:this.objectName,operationName:this.operationName,operation:(null===(t=this.input)||void 0===t?void 0:t.operation)||graphql_1.GraphqlOperations.UPDATE,records:this.input?[this.input]:[],fields:e.fields?e.fields.split(", "):["UID"]};return this.graphqlService.mutate(r)}return this.graphqlService.query(e)}toString(){const t=[];"query"===this.operationType?(this.first&&t.push(`first: ${this.first}`),this.offset&&t.push(`offset: ${this.offset}`),this.orderBy&&t.push(`orderBy: "${this.orderBy}"`),this.after&&t.push(`after: "${this.after}"`),this.filters.length&&t.push(`filter: "${this.filters.join(" AND ")}"`)):this.input&&t.push(`input: ${JSON.stringify(this.input)}`);const e=t.length?`(${t.join(", ")})`:"";return`${this.operationType} ${this.operationName} { ${this.objectName}${e} { ${this.formatQueryFields()} } }`}}exports.GraphQLQueryBuilder=GraphQLQueryBuilder;class GraphQLBatchBuilder{constructor(){this.operations=[]}add(t){return this.operations.push(t),this}execute(){return __awaiter(this,void 0,void 0,function*(){if(!this.operations.length)return[];const t=this.operations[0].graphqlService;if(!t)throw new Error("No GraphQL service set for batch execution.");if(this.operations.some(e=>e.graphqlService!==t))throw new Error("All operations must use the same GraphQL service.");const e=this.operations.map(t=>t.build());return t.executeBatch(e)})}toString(){return this.operations.map(t=>t.toString()).join("\n")}}exports.GraphQLBatchBuilder=GraphQLBatchBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(a,c){function i(t){try{u(n.next(t))}catch(t){c(t)}}function o(t){try{u(n.throw(t))}catch(t){c(t)}}function u(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(i,o)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLQueryBatch=void 0;class GraphQLQueryBatch{execute(t){return __awaiter(this,void 0,void 0,function*(){if(!t.length)return[];const e=t[0].graphqlService;if(!e)throw new Error("No GraphQL service set for batch execution.");const r=t.map(t=>t.build());return e.queryBatch(r)})}}exports.GraphQLQueryBatch=GraphQLQueryBatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(s,o){function a(e){try{h(i.next(e))}catch(e){o(e)}}function n(e){try{h(i.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,n)}h((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLQueryBuilder=void 0;class GraphQLQueryBuilder{constructor(e,t=!1){this.fields=new Set(["UID"]),this.filters=[],this.parentQueries={},this.childQueries={},this.graphqlService=null,this.queryParams=e,this.objectName=e.objectName.charAt(0).toLowerCase()+e.objectName.slice(1),this.operationName=e.operationName,this.isParent=t}setGraphqlService(e){this.graphqlService=e}withFields(e){return e.forEach(e=>this.fields.add(e)),this}withFilter(e){if(this.isParent)throw new Error("Cannot apply filters to a parent query.");return this.filters.push(e),this}withLimit(e){if(this.isParent)throw new Error("Cannot apply limit to a parent query.");return this.limit=e,this}withFirst(e){if(this.isParent)throw new Error("Cannot apply limit to a parent query.");return this.first=e,this}withOffset(e){if(this.isParent)throw new Error("Cannot apply offset to a parent query.");return this.offset=e,this}withOrderBy(e){if(this.isParent)throw new Error("Cannot apply orderBy to a parent query.");return this.orderBy=e,this}withCursor(e){if(this.isParent)throw new Error("Cannot apply cursor to a parent query.");return this.after=e,this}withParentQuery(e){const t=new GraphQLQueryBuilder({objectName:e,operationName:this.operationName},!0);return this.parentQueries[e]=t,t}withChildQuery(e){const t=new GraphQLQueryBuilder({objectName:e,operationName:this.operationName});return this.childQueries[e]=t,t}formatQueryFields(){const e=Object.entries(this.parentQueries).map(([e,t])=>`${e} { ${t.formatQueryFields()} }`).join(", "),t=Object.entries(this.childQueries).map(([e,t])=>{const r=t.build(),i=[];r.filter&&i.push(`filter: "${r.filter}"`),r.orderBy&&i.push(`orderBy: "${r.orderBy}"`),void 0!==r.limit&&void 0!==this.limit&&i.push(`limit: ${r.limit}`);return`${e} ${i.length>0?`(${i.join(", ")})`:""} { ${r.fields||"UID"} }`}).join(", ");return[...this.fields,e,t].filter(Boolean).join(", ")}build(){return{objectName:this.objectName,operationName:this.operationName,fields:this.formatQueryFields(),filter:this.filters.length>0?this.filters.join(" AND "):void 0,first:this.first,limit:this.limit,offset:this.offset,orderBy:this.orderBy,after:this.after,readOnly:this.queryParams.readOnly}}execute(){return __awaiter(this,void 0,void 0,function*(){if(!this.graphqlService)return Promise.reject(new Error("No GraphQL service set for query execution."));const e=this.build();return e.readOnly=this.queryParams.readOnly,yield this.graphqlService.query(e)})}executeAll(){return __awaiter(this,arguments,void 0,function*(e=1,t=20){if(!this.graphqlService)throw new Error("No GraphQL service set for query execution.");if(e<1)throw new Error("fromPage must be at least 1.");if(t<e)throw new Error("toPage must be greater than or equal to fromPage.");const r=Math.min(t,20),i=this.build(),s=yield this.graphqlService.query(i),o=s.totalCount;if(0===o)return{records:[],totalCount:0,pageInfo:{hasNextPage:!1},endCursor:"",endOffset:0};const a=this.limit||this.first||200,n=Math.ceil(o/a),h=Math.min(r,n);if(0===Math.max(0,h-e+1))return{records:[],totalCount:o,pageInfo:{hasNextPage:h<n},endCursor:"",endOffset:(e-1)*a};const u=[];for(let t=e-1;t<h;t++){const e=new GraphQLQueryBuilder({objectName:this.objectName,operationName:this.operationName,readOnly:this.queryParams.readOnly});e.setGraphqlService(this.graphqlService),e.fields=new Set(this.fields),e.filters=[...this.filters],void 0!==this.limit?e.limit=a:e.first=a,e.offset=t*a,e.orderBy=this.orderBy,e.after=this.after,u.push(e)}const l=yield this.graphqlService.queryBatch(u),f=l.flatMap(e=>e.records),d=l[l.length-1];return{records:f,totalCount:s.totalCount,pageInfo:d.pageInfo,endCursor:d.endCursor,endOffset:d.endOffset}})}toString(){return`{ ${this.objectName} { ${this.formatQueryFields()} } }`}}exports.GraphQLQueryBuilder=GraphQLQueryBuilder;
|
|
@@ -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))(
|
|
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),h=yield this.client.execute(p,v),g={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===(i=null===(n=null==h?void 0:h.data)||void 0===n?void 0:n[e.objectName])||void 0===i?void 0:i.pageInfo)||{}};if(g.records.length>0){const t=(null===(u=null===(d=null===(s=null==h?void 0:h.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===(_=null===(l=null===(c=null==h?void 0:h.data)||void 0===c?void 0:c[e.objectName])||void 0===l?void 0:l.edges)||void 0===_?void 0:_.map(e=>e.cursor))||[];g.endOffset=t[t.length-1],g.endCursor=a[a.length-1]}return(null==h?void 0:h.queryLimit)&&(g.queryLimit=h.queryLimit),g})}queryBatch(e){return __awaiter(this,void 0,void 0,function*(){if(!e.length)return[];const t=e.map(e=>e.build());return this.executeBatchQueries(t)})}executeBatchQueries(e){return __awaiter(this,void 0,void 0,function*(){if(!e.length)return[];const t=e.map(e=>{const t=Object.assign(Object.assign({},e),{objectName:this.getQueryName(e.objectName)});return(0,queries_1.FETCH_RECORDS_QUERY)(t)}),a=this.getQueryHeaders(e[0]);return(yield this.client.executeBatch(t,a)).map((t,a)=>{var r,o,n,i,s,d,u,c,l,_,p,v;const h=e[a],g={records:(null===(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r[h.objectName])||void 0===o?void 0:o.edges.map(e=>e.node))||[],totalCount:(null===(i=null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[h.objectName])||void 0===i?void 0:i.totalCount)||0,pageInfo:(null===(d=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s[h.objectName])||void 0===d?void 0:d.pageInfo)||{}};if(g.records.length>0){const e=(null===(l=null===(c=null===(u=null==t?void 0:t.data)||void 0===u?void 0:u[h.objectName])||void 0===c?void 0:c.edges)||void 0===l?void 0:l.map(e=>e.offset))||[],a=(null===(v=null===(p=null===(_=null==t?void 0:t.data)||void 0===_?void 0:_[h.objectName])||void 0===p?void 0:p.edges)||void 0===v?void 0:v.map(e=>e.cursor))||[];g.endOffset=e[e.length-1],g.endCursor=a[a.length-1]}return(null==t?void 0:t.queryLimit)&&(g.queryLimit=t.queryLimit),g})})}mutate(e){return __awaiter(this,void 0,void 0,function*(){if(!e.records||0===e.records.length)return Promise.resolve({data:{schema:{}}});let t="";switch(e.operation){case constants_1.GraphqlOperations.DELETE:t=(0,queries_1.DELETE_OBJECTS_MUTATION)(e);break;case constants_1.GraphqlOperations.INSERT:case constants_1.GraphqlOperations.UPDATE:case constants_1.GraphqlOperations.UPSERT:t=(0,queries_1.MUTATE_OBJECTS_MUTATION)(e);break;default:throw new Error(`Invalid operation: ${e.operation}`)}const a=this.getMutationHeaders(e);return yield this.client.execute(t,a)})}mutateBatch(e){return __awaiter(this,void 0,void 0,function*(){if(!e.length)return[];e.forEach((e,t)=>{if(!e.records||0===e.records.length)throw new Error(`Mutation at index ${t} has empty or null records for operation '${e.operationName}'`)});const t=e.map(e=>{switch(e.operation){case constants_1.GraphqlOperations.DELETE:return(0,queries_1.DELETE_OBJECTS_MUTATION)(e);case constants_1.GraphqlOperations.INSERT:case constants_1.GraphqlOperations.UPDATE:case constants_1.GraphqlOperations.UPSERT:return(0,queries_1.MUTATE_OBJECTS_MUTATION)(e);default:throw new Error(`Invalid operation: ${e.operation}`)}}),a=this.getMutationHeaders(e[0]);return yield this.client.executeBatch(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)})}upsert(e){return __awaiter(this,void 0,void 0,function*(){return e.operation=constants_1.GraphqlOperations.UPSERT,this.mutate(e)})}extractUIDs(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",[Array]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"queryBatch",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",[Array]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"mutateBatch",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),__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],GraphQLService.prototype,"upsert",null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MUTATE_OBJECTS_MUTATION=exports.DELETE_OBJECTS_MUTATION=exports.FETCH_RECORDS_QUERY=void 0;const FETCH_RECORDS_QUERY=({objectName:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MUTATE_OBJECTS_MUTATION=exports.DELETE_OBJECTS_MUTATION=exports.FETCH_RECORDS_QUERY=void 0;const serializeGraphQLValue=e=>{if(Array.isArray(e)){return`[${e.map(e=>serializeGraphQLValue(e)).join(", ")}]`}return"string"==typeof e?`"${e}"`:String(e)},FETCH_RECORDS_QUERY=({objectName:e,operationName:n,filter:t,first:r=200,limit:i,offset:o=0,after:a,orderBy:s,fields:T})=>{const E=void 0!==i,$=E?i:r;return`\n query ${n} {\n ${e}(${[t?`filter: "${t}"`:"",a?`after: "${a}"`:"",E?`limit: ${$}`:`first: ${$}`,o?`offset: ${o}`:"",s?`orderBy: "${s}"`:""].filter(e=>e).join(", ")}) {\n totalCount\n pageInfo{\n hasNextPage\n }\n edges {\n cursor\n offset\n node {\n ${T||"UID"}\n }\n }\n }\n }\n `};exports.FETCH_RECORDS_QUERY=FETCH_RECORDS_QUERY;const DELETE_OBJECTS_MUTATION=({objectName:e,operationName:n,records:t})=>`\n mutation ${n} {\n schema {\n ${t.map((n,t)=>`alias${t+1}:delete${e}(UID: "${n.UID}")`).join("\n ")}\n }\n }`;exports.DELETE_OBJECTS_MUTATION=DELETE_OBJECTS_MUTATION;const MUTATE_OBJECTS_MUTATION=({objectName:e,operationName:n,records:t,operation:r,keyField:i})=>{let o;return o="upsert"===r?t.map((n,t)=>`\n alias${t+1}:upsert${e}(\n keyField: "${i||"UID"}",\n input: {\n ${Object.entries(n).map(([e,n])=>`${e}: ${serializeGraphQLValue(n)}`).join(", ")}\n }\n )\n `).join("\n "):t.map((n,t)=>`\n alias${t+1}:${r}${e}(\n input: {\n ${Object.entries(n).map(([e,n])=>`${e}: ${serializeGraphQLValue(n)}`).join(", ")}\n }\n )\n `).join("\n "),`\n mutation ${n} {\n schema {\n ${o}\n }\n }\n `};exports.MUTATE_OBJECTS_MUTATION=MUTATE_OBJECTS_MUTATION;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const queries_1=require("./queries"),constants_1=require("../../constants");describe("GraphQL Queries - Mutation Builder",()=>{describe("MUTATE_OBJECTS_MUTATION",()=>{it("should properly serialize arrays in multipicklist fields for insert operations",()=>{const t={objectName:"Jobs",operationName:"CreateJobWithMultipicklist",records:[{UID:"test-job-1",Name:"Test Job",CustomDifficulty:["Easy","Hard"],RegionId:"region-123"}],operation:constants_1.GraphqlOperations.INSERT},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain('CustomDifficulty: ["Easy", "Hard"]'),expect(e).not.toContain("CustomDifficulty: Easy,Hard"),expect(e).toContain('Name: "Test Job"'),expect(e).toContain('RegionId: "region-123"')}),it("should properly serialize arrays in multipicklist fields for update operations",()=>{const t={objectName:"Jobs",operationName:"UpdateJobWithMultipicklist",records:[{UID:"test-job-1",CustomDifficulty:["Medium","Expert"],Status:"Dispatched"}],operation:constants_1.GraphqlOperations.UPDATE},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain('CustomDifficulty: ["Medium", "Expert"]'),expect(e).toContain('Status: "Dispatched"'),expect(e).toContain("updateJobs")}),it("should properly serialize arrays in multipicklist fields for upsert operations",()=>{const t={objectName:"Jobs",operationName:"UpsertJobWithMultipicklist",records:[{UID:"test-job-1",Name:"Upserted Job",CustomDifficulty:["Easy","Medium","Hard"],Priority:5}],operation:constants_1.GraphqlOperations.UPSERT,keyField:"UID"},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain('CustomDifficulty: ["Easy", "Medium", "Hard"]'),expect(e).toContain("Priority: 5"),expect(e).toContain('keyField: "UID"'),expect(e).toContain("upsertJobs")}),it("should handle empty arrays correctly",()=>{const t={objectName:"Jobs",operationName:"CreateJobWithEmptyArray",records:[{UID:"test-job-1",Name:"Test Job",CustomDifficulty:[],Tags:["urgent"]}],operation:constants_1.GraphqlOperations.INSERT},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain("CustomDifficulty: []"),expect(e).toContain('Tags: ["urgent"]')}),it("should handle mixed data types correctly",()=>{const t={objectName:"Jobs",operationName:"CreateJobWithMixedTypes",records:[{UID:"test-job-1",Name:"Test Job",CustomDifficulty:["Easy","Hard"],Priority:5,IsActive:!0,Duration:2.5,Notes:null,Metadata:{type:"maintenance",urgent:!0}}],operation:constants_1.GraphqlOperations.INSERT},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain('CustomDifficulty: ["Easy", "Hard"]'),expect(e).toContain("Priority: 5"),expect(e).toContain("IsActive: true"),expect(e).toContain("Duration: 2.5"),expect(e).toContain("Notes: null"),expect(e).toContain('Metadata: { type: "maintenance", urgent: true }')}),it("should handle nested arrays in objects",()=>{const t={objectName:"Jobs",operationName:"CreateJobWithNestedArrays",records:[{UID:"test-job-1",Name:"Test Job",Configuration:{skills:["plumbing","electrical"],levels:[1,2,3],active:!0}}],operation:constants_1.GraphqlOperations.INSERT},e=(0,queries_1.MUTATE_OBJECTS_MUTATION)(t);expect(e).toContain('Configuration: { skills: ["plumbing", "electrical"], levels: [1, 2, 3], active: true }')})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __decorate=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,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,i,r){return new(i||(i=Promise))(
|
|
1
|
+
"use strict";var __decorate=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,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,i,r){return new(i||(i=Promise))(function(n,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,c)}l((r=r.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,i=new Date(Date.now()+e.ttl).toISOString();try{let r=null;try{r=yield this.configVarClient.get(t)}catch(e){}if(r){if(r.expiryDate&&new Date<new Date(r.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:i}),!0}catch(t){return logger_1.default.info(`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.info(`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))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(
|
|
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 +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))(
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";var __decorate=this&&this.__decorate||function(t,e,i,a){var o,r=arguments.length,n=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,a);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n},__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.ResourceValidator=void 0;const logging_1=require("../../../logging"),utils_1=require("../../../utils"),resource_job_validation_1=require("./resource-job-validation"),validation_result_1=require("./validation-result");class ResourceValidator{constructor(t){this.option=t}validate(t,e){if(!t.length||!e.length)throw new Error("ResourceValidator Error: Resources and jobs must be provided before validation.");this.prepareData(t,e);const i=[];for(const a of e)for(const e of t)i.push(this.validateResource(e,a));return new validation_result_1.ValidationResult(i,this.option)}validateResource(t,e){const i=new resource_job_validation_1.ResourceJobValidation(t,e);return this.option.checkAvailability&&(i.availableEvent=this.findAvailableEvent(t,e)),this.option.checkConflict&&(i.conflictEvents=this.findConflictingEvents(t,e)),this.option.checkTag&&(i.missingTags=this.findMissingTags(t,e)),i}findAvailableEvent(t,e){return t.availabilities.find(
|
|
1
|
+
"use strict";var __decorate=this&&this.__decorate||function(t,e,i,a){var o,r=arguments.length,n=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,a);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n},__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.ResourceValidator=void 0;const logging_1=require("../../../logging"),utils_1=require("../../../utils"),resource_job_validation_1=require("./resource-job-validation"),validation_result_1=require("./validation-result");class ResourceValidator{constructor(t){this.option=t}validate(t,e){if(!t.length||!e.length)throw new Error("ResourceValidator Error: Resources and jobs must be provided before validation.");this.prepareData(t,e);const i=[];for(const a of e)for(const e of t)i.push(this.validateResource(e,a));return new validation_result_1.ValidationResult(i,this.option)}validateResource(t,e){const i=new resource_job_validation_1.ResourceJobValidation(t,e);return this.option.checkAvailability&&(i.availableEvent=this.findAvailableEvent(t,e)),this.option.checkConflict&&(i.conflictEvents=this.findConflictingEvents(t,e)),this.option.checkTag&&(i.missingTags=this.findMissingTags(t,e)),i}findAvailableEvent(t,e){return t.availabilities.find(t=>utils_1.DateTimeUtils.isIncluding(t,e))||null}findConflictingEvents(t,e){return t.events.filter(t=>t.id!==e.id&&utils_1.DateTimeUtils.isOverlapping(t,e))}findMissingTags(t,e){if(!e.tags||!t.tags)return[];const i=new Set(t.tags.map(t=>t.id));return e.tags.filter(t=>!i.has(t.id))}prepareData(t,e){for(const e of t)e.tags||(e.tags=[]);for(const t of e)t.id||(t.id=`${t.start}-${t.finish}`),t.name||(t.name=`${t.start}-${t.finish}`),t.tags||(t.tags=[])}}exports.ResourceValidator=ResourceValidator,__decorate([(0,logging_1.LogMethod)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Array,Array]),__metadata("design:returntype",validation_result_1.ValidationResult)],ResourceValidator.prototype,"validate",null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ValidationResult=void 0;class ValidationResult{constructor(i,e){this.validations=i,this.option=e}getQualifiedResources(){const i=new Map;for(const e of this.validations)e.isQualified(this.option)&&e.resource.id&&i.set(e.resource.id,e.resource);return Array.from(i.values())}getJobsWithXQualifiedResources(i){const e=new Map;for(const i of this.validations)i.isQualified(this.option)&&i.job.id&&e.set(i.job.id,(e.get(i.job.id)||0)+1);return Array.from(new Set(this.validations.map(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ValidationResult=void 0;class ValidationResult{constructor(i,e){this.validations=i,this.option=e}getQualifiedResources(){const i=new Map;for(const e of this.validations)e.isQualified(this.option)&&e.resource.id&&i.set(e.resource.id,e.resource);return Array.from(i.values())}getJobsWithXQualifiedResources(i){const e=new Map;for(const i of this.validations)i.isQualified(this.option)&&i.job.id&&e.set(i.job.id,(e.get(i.job.id)||0)+1);return Array.from(new Set(this.validations.map(i=>i.job))).filter(t=>(e.get(t.id)||0)>=i)}getUnqualifiedJobsWithReasons(){return this.validations.filter(i=>!i.isQualified(this.option))}format(){return this.validations.map(i=>({resource:i.resource,job:i.job,qualificationStatus:i.isQualified({checkAvailability:!0,checkConflict:!0,checkTag:!0})?"Qualified":"Not Qualified",reasons:[...i.availableEvent?[]:[{reason:"Resource is not available during the job timeframe."}],...i.conflictEvents.length>0?[{reason:"Conflict Detected",conflictingEvents:i.conflictEvents.map(i=>({id:i.id,name:i.name,eventType:i.eventType}))}]:[],...i.missingTags.length>0?[{reason:"Missing Required Skills",missingSkills:i.missingTags.map(i=>({id:i.id,name:i.name}))}]:[]]}))}}exports.ValidationResult=ValidationResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateTimeUtils=void 0;const dayjs_1=__importDefault(require("dayjs")),timezone_1=__importDefault(require("dayjs/plugin/timezone")),utc_1=__importDefault(require("dayjs/plugin/utc"));dayjs_1.default.extend(utc_1.default),dayjs_1.default.extend(timezone_1.default);class DateTimeUtils{static toTimezone(t,e){return(0,dayjs_1.default)(t).tz(e).toDate()}static switchTimezone(t,e,a){return e===a?t:(0,dayjs_1.default)(t).tz(e).tz(a).toDate()}static addMinutes(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"minute").toDate()}static addDays(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"day").toDate()}static addMonths(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"month").toDate()}static addYears(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"year").toDate()}static getDate(t,e){return(0,dayjs_1.default)(t).tz(e).startOf("day").toDate()}static getDateFromIsoString(t){return(0,dayjs_1.default)(t).utc().toDate()}static getDateTimeFromIsoString(t){return(0,dayjs_1.default)(t).utc().toDate()}static getStartOfDate(t,e){const a="string"==typeof t?this.getDateFromIsoString(t):t;return(0,dayjs_1.default)(a).tz(e).startOf("day").toDate()}static getEndOfDate(t,e){return this.addDays(this.getStartOfDate(t,e),1,e)}static isIncluding(t,e){return t.start<=e.start&&t.finish>=e.finish}static isOverlapping(t,e){return t.start<e.finish&&t.finish>e.start}static mergeEvents(t){t.sort((
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateTimeUtils=void 0;const dayjs_1=__importDefault(require("dayjs")),timezone_1=__importDefault(require("dayjs/plugin/timezone")),utc_1=__importDefault(require("dayjs/plugin/utc"));dayjs_1.default.extend(utc_1.default),dayjs_1.default.extend(timezone_1.default);class DateTimeUtils{static toTimezone(t,e){return(0,dayjs_1.default)(t).tz(e).toDate()}static switchTimezone(t,e,a){return e===a?t:(0,dayjs_1.default)(t).tz(e).tz(a).toDate()}static addMinutes(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"minute").toDate()}static addDays(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"day").toDate()}static addMonths(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"month").toDate()}static addYears(t,e,a){return(0,dayjs_1.default)(t).tz(a).add(e,"year").toDate()}static getDate(t,e){return(0,dayjs_1.default)(t).tz(e).startOf("day").toDate()}static getDateFromIsoString(t){return(0,dayjs_1.default)(t).utc().toDate()}static getDateTimeFromIsoString(t){return(0,dayjs_1.default)(t).utc().toDate()}static getStartOfDate(t,e){const a="string"==typeof t?this.getDateFromIsoString(t):t;return(0,dayjs_1.default)(a).tz(e).startOf("day").toDate()}static getEndOfDate(t,e){return this.addDays(this.getStartOfDate(t,e),1,e)}static isIncluding(t,e){return t.start<=e.start&&t.finish>=e.finish}static isOverlapping(t,e){return t.start<e.finish&&t.finish>e.start}static mergeEvents(t){t.sort((t,e)=>t.start.getTime()-e.start.getTime());const e=[];let a=null;for(const s of t)a?a.finish>=s.start?(a.finish=s.finish,a.eventType="merged",a.description=a.description?`${a.description}, ${a.name} merged with ${s.name}`:`${a.name} merged with ${s.name}`):(e.push(a),a=s):a=s;return a&&e.push(a),e}}exports.DateTimeUtils=DateTimeUtils;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sortObjectKeys=void 0;const sortObjectKeys=e=>Array.isArray(e)?e.map(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sortObjectKeys=void 0;const sortObjectKeys=e=>Array.isArray(e)?e.map(e=>(0,exports.sortObjectKeys)(e)):null!==e&&"object"==typeof e?Object.keys(e).sort().reduce((t,s)=>(t[s]=(0,exports.sortObjectKeys)(e[s]),t),{}):e;exports.sortObjectKeys=sortObjectKeys;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skedulo/pulse-solution-services",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
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",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@tsconfig/node18": "^18.2.2",
|
|
28
|
+
"@types/jest": "^30.0.0",
|
|
28
29
|
"@types/uuid": "^10.0.0",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
30
31
|
"@typescript-eslint/parser": "^8.11.0",
|