@skedulo/pulse-solution-services 0.0.20 → 0.0.21

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.
@@ -1 +1 @@
1
- "use strict";var __decorate=this&&this.__decorate||function(e,t,r,i){var n,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>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,i){return new(r||(r=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityAPIClient=void 0;const constants_1=require("../constants"),monitor_call_1=require("../monitoring/decorators/monitor-call"),base_client_1=require("./base-client");class AvailabilityAPIClient extends base_client_1.BaseClient{fetchAvailability(e){return __awaiter(this,void 0,void 0,(function*(){var t,r,i,n;if(!e.resourceIds.length)throw new Error("At least one resource ID must be provided.");const a={resource_ids:e.resourceIds.join(","),start:e.start,end:e.end,mergedAvailabilities:null!==(r=null===(t=e.mergedAvailabilities)||void 0===t?void 0:t.toString())&&void 0!==r?r:"false",entries:null!==(n=null===(i=e.entries)||void 0===i?void 0:i.toString())&&void 0!==n?n:"true"};return yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.SIMPLE,queryParams:a})}))}upsertPattern(e){return __awaiter(this,void 0,void 0,(function*(){if(!e.pattern.name)throw new Error("Pattern name is required.");if(!e.resources.length)throw new Error("At least one resource must be provided.");const t=yield this._performRequest({endpoint:constants_1.TENANT_ENDPOINTS.AVAILABILITY.PATTERNS,method:"POST",body:e});if("string"==typeof t)return t;if(t&&"object"==typeof t&&"created"in t)return t.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
+ "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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/pulse-solution-services",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
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",