@skedulo/pulse-solution-services 0.0.16 → 0.0.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.0.18] - 2025-07-16
4
+ ### Update
5
+ - Support upsert and status polling in artifact client
6
+
3
7
  ## [v0.0.16] - 2025-06-19
4
8
  ### Added
5
9
  - Support upsert mutation.
package/README.md CHANGED
@@ -19,9 +19,12 @@
19
19
  - [Artifact Client](#artifact-client)
20
20
  - [GraphQL Service](#graphql-service)
21
21
  - [Query Data](#query-data)
22
+ - [Query by Pages](#query-by-pages)
23
+ - [Batch Queries](#batch-queries)
22
24
  - [Update Data](#update-data)
23
- - [Pagination with Offset](#pagination-with-offset)
24
- - [Pagination with Cursor](#pagination-with-cursor)
25
+ - [Upsert Data](#upsert-data)
26
+ - [Batch mMtations](#batch-mutations)
27
+ - [Pagination](#pagination)
25
28
  - [Resource Service](#resource-service)
26
29
  - [Resource Builder](#resource-builder)
27
30
  - [Resource Validator](#resource-validator)
@@ -311,7 +314,7 @@ const result: SmsResponse = await context.mobileNotificationClient.requestSmsCon
311
314
  const templates: ConfigTemplate[] = await context.configTemplateClient.get('Jobs');
312
315
 
313
316
  // Get teamplate values
314
- const values: ConfigValue[] = await context.configTemplateClient.getTemmplateValues(templateId);
317
+ const values: ConfigValue[] = await context.configTemplateClient.getTemplateValues(templateId);
315
318
 
316
319
  // Delete a template
317
320
  const result: Record<string,string> = await context.configTemplateClient.delete(templateId);
@@ -319,7 +322,7 @@ const result: Record<string,string> = await context.configTemplateClient.delete(
319
322
  **Template Values**
320
323
  ```javascript
321
324
  // Get template values
322
- const values: ConfigValue[] = await context.configTemplateClient.getTemmplateValues(templateId);
325
+ const values: ConfigValue[] = await context.configTemplateClient.getTemplateValues(templateId);
323
326
 
324
327
  // Create a new template and values
325
328
  const newTemplate: ConfigTemplate = {
@@ -462,7 +465,7 @@ type ArtifactParams = {
462
465
  await client.get({ name: "Jobs" });
463
466
 
464
467
  // Create an artifact
465
- await client.create({},
468
+ const upsertStatus: any = await client.upsert({},
466
469
  {
467
470
  metadata: {
468
471
  type: 'CustomObject'
@@ -473,8 +476,12 @@ await client.create({},
473
476
  }
474
477
  );
475
478
 
479
+ // Wait for 2 seconds then poll the status
480
+ await new Promise(resolve => setTimeout(resolve, 2000));
481
+ const result = await client.status(upsertStatus.id);
482
+
476
483
  // Update an artifact
477
- await client.update(
484
+ await client.upsert(
478
485
  {
479
486
  name: 'Tasks'
480
487
  },
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(t,e,n,i){var a,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(o<3?a(r):o>3?a(e,n,r):a(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(a,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArtifactClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ArtifactClient extends base_client_1.BaseClient{constructor(t,e,n={}){super(t,n),this.artifactType=e,this.baseEndpoint=`artifacts/${this.artifactType}`}list(){return __awaiter(this,void 0,void 0,(function*(){return this._performRequest({endpoint:this.baseEndpoint})}))}get(){return __awaiter(this,arguments,void 0,(function*(t={}){return this._performRequest({endpoint:this.buildEndpoint(t)})}))}create(t,e){return __awaiter(this,void 0,void 0,(function*(){return this._performRequest({method:constants_1.HttpMethod.POST,endpoint:this.buildEndpoint(t),body:e})}))}update(t,e){return __awaiter(this,void 0,void 0,(function*(){return this._performRequest({method:constants_1.HttpMethod.PUT,endpoint:this.buildEndpoint(t),body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){yield this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:this.buildEndpoint(t)})}))}buildEndpoint(t){const{objectName:e,viewTypeName:n,name:i,scope:a}=t;let o=this.baseEndpoint;return e&&(o+=`/${e}`),n&&(o+=`/${n}`),i&&(o+=`/${i}`),a&&(o+=`/${a}`),o}}exports.ArtifactClient=ArtifactClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"list",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"create",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object,Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"update",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ArtifactClient.prototype,"delete",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,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,n,a){var o,i=arguments.length,r=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,a);else for(var _=t.length-1;_>=0;_--)(o=t[_])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=this&&this.__awaiter||function(t,e,n,a){return new(n||(n=Promise))((function(o,i){function r(t){try{s(a.next(t))}catch(t){i(t)}}function _(t){try{s(a.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,_)}s((a=a.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConfigTemplateClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class ConfigTemplateClient extends base_client_1.BaseClient{get(t){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_TEMPLATES(t)}`})}))}getTemmplateValues(t){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.GET_VALUES(t)}`})}))}upsertTemplateValues(t,e){return __awaiter(this,void 0,void 0,(function*(){return this._performRequest({method:constants_1.HttpMethod.PUT,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.UPDATE_VALUES(t)}`,body:e})}))}delete(t){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({method:constants_1.HttpMethod.DELETE,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.DELETE(t)}`})}))}create(t){return __awaiter(this,void 0,void 0,(function*(){return yield this._performRequest({method:constants_1.HttpMethod.POST,endpoint:`${constants_1.TENANT_ENDPOINTS.CONFIG_TEMPLATE.CREATE}`,body:t})}))}}exports.ConfigTemplateClient=ConfigTemplateClient,__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"get",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"getTemmplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String,Array]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"upsertTemplateValues",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[String]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"delete",null),__decorate([(0,monitor_call_1.MonitorCall)(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],ConfigTemplateClient.prototype,"create",null);
1
+ "use strict";var __decorate=this&&this.__decorate||function(t,e,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 __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,t={},i){this.logger=logger_1.default,this.services=new Map,this.skedContext=e,this.contextData={},this._executionOptions=t,this.baseConfig={apiToken:e.auth.token,apiServer:e.auth.baseUrl},(0,monitoring_registry_1.initGlobalMonitorManager)(i)}static fromContext(e,t={},i=monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG){return ExecutionContext.instance?ExecutionContext.instance.updateConfig(e,t,i):ExecutionContext.instance=new ExecutionContext(e,t,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),i)),ExecutionContext.instance}static fromCredentials(e,t={},i=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 ExecutionContext.instance?ExecutionContext.instance.updateConfig(n,t,i,e):ExecutionContext.instance=new ExecutionContext(n,t,Object.assign(Object.assign({},monitoring_constants_1.DEFAULT_THRESHOLD_CONFIG),i)),ExecutionContext.instance}updateConfig(e,t,i,r){this.skedContext=e,this._executionOptions=Object.assign(Object.assign({},this._executionOptions),t),r&&(this.baseConfig=Object.assign(Object.assign({},r),this.baseConfig))}set executionOptions(e){this._executionOptions=Object.assign(Object.assign({},this._executionOptions),e)}get executionOptions(){return this._executionOptions}getOrCreateService(e,t){return this.services.has(e)||this.services.set(e,t()),this.services.get(e)}get configHelper(){return this.getOrCreateService("configHelper",(()=>new utils_1.ConfigHelper(this.skedContext.configVars)))}get 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 t=new graphql_1.GraphQLQueryBuilder(e);return t.setGraphqlService(this.graphqlService),t}newArtifactClient(e){return this.getOrCreateService(`${e}Client`,(()=>new artifact_client_1.ArtifactClient(this.baseConfig,e,this.executionOptions)))}dispose(){this.services.clear()}getExecutionMetrics(){return(0,monitoring_registry_1.getGlobalMonitorManager)().getExecutionMetrics()}}exports.ExecutionContext=ExecutionContext,ExecutionContext.instance=null;
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;
package/dist/index.d.ts CHANGED
@@ -207,11 +207,14 @@ export type ArtifactParams = {
207
207
  export declare class ArtifactClient extends BaseClient {
208
208
  private artifactType;
209
209
  private baseEndpoint;
210
+ private statusEndpoint;
210
211
  constructor(config: any, artifactType: ArtifactType, executionOptions?: Partial<ExecutionOptions>);
211
212
  list<T>(): Promise<T[]>;
213
+ status<T>(id: string): Promise<T>;
212
214
  get<T>(params?: ArtifactParams): Promise<T>;
213
- create<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
215
+ create<T>(_: ArtifactParams, artifactData: Partial<T>): Promise<T>;
214
216
  update<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
217
+ upsert<T>(params: ArtifactParams, artifactData: Partial<T>): Promise<T>;
215
218
  delete(params: ArtifactParams): Promise<void>;
216
219
  private buildEndpoint;
217
220
  }
@@ -316,7 +319,7 @@ export declare class ConfigTemplateClient extends BaseClient {
316
319
  * @param {string} templateId - The template ID.
317
320
  * @returns {Promise<any[]>} - A promise resolving to an array of configuration values.
318
321
  */
319
- getTemmplateValues(templateId: string): Promise<any[]>;
322
+ getTemplateValues(templateId: string): Promise<any[]>;
320
323
  /**
321
324
  * Updates or Inserts configuration template values.
322
325
  * @param {string} templateId - The template ID.
@@ -596,6 +599,7 @@ export interface MutationResult {
596
599
  [alias: string]: string;
597
600
  };
598
601
  };
602
+ errors?: object[];
599
603
  }
600
604
  export interface GraphQLRequest {
601
605
  query: string;
@@ -1363,7 +1367,6 @@ export declare class ExecutionContext {
1363
1367
  protected constructor(skedContext: any, executionOptions: Partial<ExecutionOptions> | undefined, threshholds: ThresholdConfig);
1364
1368
  static fromContext(skedContext: any, executionOptions?: Partial<ExecutionOptions>, threshholds?: ThresholdConfig): ExecutionContext;
1365
1369
  static fromCredentials(config: BaseConfig, executionOptions?: Partial<ExecutionOptions>, threshholds?: ThresholdConfig): ExecutionContext;
1366
- private updateConfig;
1367
1370
  set executionOptions(executionOptions: Partial<ExecutionOptions>);
1368
1371
  get executionOptions(): Partial<ExecutionOptions>;
1369
1372
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/pulse-solution-services",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
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",