@partium/js-sdk 15.4.0 → 15.6.0
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/core/models/user-token.js +1 -1
- package/data/services/shopping-cart.service.js +1 -1
- package/enrichment/index.d.ts +2 -0
- package/enrichment/index.js +1 -1
- package/enrichment/models/trigger-enrichment-job-request.d.ts +23 -0
- package/enrichment/models/trigger-enrichment-job-request.js +2 -0
- package/enrichment/models/trigger-enrichment-job-response.d.ts +10 -0
- package/enrichment/models/trigger-enrichment-job-response.js +2 -0
- package/enrichment/services/data-enrichment.service.d.ts +10 -0
- package/enrichment/services/data-enrichment.service.js +1 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -1
- package/package.json +1 -1
- package/user-data/services/request-list/request-list.service.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createUserToken=createUserToken;var jwt_decode_1=require("jwt-decode");function createUserToken(e){return(0,jwt_decode_1.jwtDecode)(e)}
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createUserToken=createUserToken;var jwt_decode_1=require("jwt-decode"),error_1=require("./error");function createUserToken(e){try{return(0,jwt_decode_1.jwtDecode)(e)}catch(e){throw new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_TOKEN,e,"Invalid or malformed JWT token.")}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(t,e,r,i){var o,n=arguments.length,c=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(c=(n<3?o(c):n>3?o(e,r,c):o(e,r))||c);return n>3&&c&&Object.defineProperty(e,r,c),c};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShoppingCartServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),log_1=require("../../core/models/log"),injection_identifier_1=require("../../core/decorators/injection-identifier"),https_service_interface_1=require("../../core/services/http/https.service.interface"),base_service_1=require("../../core/services/base.service"),log_service_1=require("../../core/services/log.service"),shopping_cart_1=require("../models/shopping-cart"),core_1=require("../../core"),csa_request_1=require("../models/csa-request"),ShoppingCartServiceImpl=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},e.prototype.getShoppingCarts=function(t){return void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromAPIResponse,this.httpsService,"carts",https_service_interface_1.BACKEND_SERVICE.CSA,t)},e.prototype.createEmptyShoppingCart=function(t){return this.httpsService.post("carts",t,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCart=function(t){return this.httpsService.get("carts/".concat(t),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCartParts=function(t,e){return void 0===e&&(e=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromPartAPIResponse,this.httpsService,"carts/".concat(t,"/parts"),https_service_interface_1.BACKEND_SERVICE.CSA,e)},e.prototype.updateShoppingCartPart=function(t,e,r){var i=this;return this.httpsService.put("carts/".concat(t,"/parts/").concat(e.item_id),e,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partium_id:e.item_id,quantity:e.quantity,shopping_cart_id:t,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},e.prototype.requestShoppingCartOffer=function(t,e){return this.httpsService.post("carts/".concat(t,"/actions/request-offer"),{language_ui:e},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.saveShoppingCartEcrs=function(t,e){var r=this,i=[];return t.forEach((function(t){i.push(r.httpsService.put("requests/".concat(t.item_id,"/quantity/"),{quantity:t.quantity},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return csa_request_1.CSARequest.fromAPIResponse(t)}))))})),(0,rxjs_1.forkJoin)(i)},e.prototype.saveShoppingCartParts=function(t,e,r){var i=e.map((function(t){return{item_id:t.item_id,quantity:t.quantity,bom_context:t.bom_context}}));return this.httpsService.put("carts/".concat(t,"/parts"),i,[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.addPart=function(t,e,r){var i=this,o={item_id:e.item_id,quantity:e.quantity,bom_context:null==e?void 0:e.bom_context};return this.httpsService.post("carts/".concat(t,"/parts"),o,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:e.item_id,quantity:e.quantity,searchSessionId:null==r?void 0:r.searchSessionId,shopping_cart_id:t},r)})))},e.prototype.resetShoppingCart=function(t,e){var r=this;return this.httpsService.put("carts/".concat(t,"/parts"),[],[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{shopping_cart_id:t},e)})),(0,operators_1.catchError)((function(t){})))},e.prototype.deletePart=function(t,e,r){var i=this;return this.httpsService.delete("carts/".concat(t,"/parts/").concat(e),{},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e,shopping_cart_id:t},r)})),(0,operators_1.map)((function(){return!0})))},e.prototype.exportShoppingCartAsEmail=function(t,e,r,i){return this.httpsService.post("carts/".concat(t,"/actions/email"),{recipients:e,subject:r,message:i},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.dispatchLogService=function(t,e,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:t,data:e})).subscribe((function(){}),(function(t){console.log("Error while sending log event: ",t)}))},e=__decorate([(0,injection_identifier_1.InjectionIdentifier)("ShoppingCartService")],e)}(base_service_1.BaseService);exports.ShoppingCartServiceImpl=ShoppingCartServiceImpl;
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(t,e,r,i){var o,n=arguments.length,c=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(c=(n<3?o(c):n>3?o(e,r,c):o(e,r))||c);return n>3&&c&&Object.defineProperty(e,r,c),c};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShoppingCartServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),log_1=require("../../core/models/log"),injection_identifier_1=require("../../core/decorators/injection-identifier"),https_service_interface_1=require("../../core/services/http/https.service.interface"),base_service_1=require("../../core/services/base.service"),log_service_1=require("../../core/services/log.service"),shopping_cart_1=require("../models/shopping-cart"),core_1=require("../../core"),csa_request_1=require("../models/csa-request"),ShoppingCartServiceImpl=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},e.prototype.getShoppingCarts=function(t){return void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromAPIResponse,this.httpsService,"carts",https_service_interface_1.BACKEND_SERVICE.CSA,t)},e.prototype.createEmptyShoppingCart=function(t){return this.httpsService.post("carts",t,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCart=function(t){return this.httpsService.get("carts/".concat(t),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCartParts=function(t,e){return void 0===e&&(e=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromPartAPIResponse,this.httpsService,"carts/".concat(t,"/parts"),https_service_interface_1.BACKEND_SERVICE.CSA,e)},e.prototype.updateShoppingCartPart=function(t,e,r){var i=this;return this.httpsService.put("carts/".concat(t,"/parts/").concat(e.item_id),e,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partium_id:e.item_id,quantity:e.quantity,shopping_cart_id:t,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},e.prototype.requestShoppingCartOffer=function(t,e){return this.httpsService.post("carts/".concat(t,"/actions/request-offer"),{language_ui:e},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.saveShoppingCartEcrs=function(t,e){var r=this,i=[];return t.forEach((function(t){i.push(r.httpsService.put("requests/".concat(t.item_id,"/quantity/"),{quantity:t.quantity},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return csa_request_1.CSARequest.fromAPIResponse(t)}))))})),(0,rxjs_1.forkJoin)(i)},e.prototype.saveShoppingCartParts=function(t,e,r){var i=e.map((function(t){return{item_id:t.item_id,quantity:t.quantity,bom_context:t.bom_context}}));return this.httpsService.put("carts/".concat(t,"/parts"),i,[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.addPart=function(t,e,r){var i=this,o={item_id:e.item_id,quantity:e.quantity,bom_context:null==e?void 0:e.bom_context};return this.httpsService.post("carts/".concat(t,"/parts"),o,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:e.item_id,quantity:e.quantity,searchSessionId:null==r?void 0:r.searchSessionId,shopping_cart_id:t},r)})))},e.prototype.resetShoppingCart=function(t,e){var r=this;return this.httpsService.put("carts/".concat(t,"/parts"),[],[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{shopping_cart_id:t},e)})),(0,operators_1.map)((function(){return!0})),(0,operators_1.catchError)((function(t){return console.log("Reset shopping cart log error",t),(0,rxjs_1.throwError)((function(){return t}))})))},e.prototype.deletePart=function(t,e,r){var i=this;return this.httpsService.delete("carts/".concat(t,"/parts/").concat(e),{},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e,shopping_cart_id:t},r)})),(0,operators_1.map)((function(){return!0})))},e.prototype.exportShoppingCartAsEmail=function(t,e,r,i){return this.httpsService.post("carts/".concat(t,"/actions/email"),{recipients:e,subject:r,message:i},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.dispatchLogService=function(t,e,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:t,data:e})).subscribe((function(){}),(function(t){console.log("Error while sending log event: ",t)}))},e=__decorate([(0,injection_identifier_1.InjectionIdentifier)("ShoppingCartService")],e)}(base_service_1.BaseService);exports.ShoppingCartServiceImpl=ShoppingCartServiceImpl;
|
package/enrichment/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export * from './services/data-enrichment.service';
|
|
|
6
6
|
export * from './models/create-enrichment-job-request';
|
|
7
7
|
export * from './models/create-enrichment-job-response';
|
|
8
8
|
export * from './models/submit-enrichment-job-request';
|
|
9
|
+
export * from './models/trigger-enrichment-job-request';
|
|
10
|
+
export * from './models/trigger-enrichment-job-response';
|
package/enrichment/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,o){void 0===o&&(o=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,i)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/enrichment-job"),exports),__exportStar(require("./models/get-enrichment-job-parts-request"),exports),__exportStar(require("./models/enrichment-job-part"),exports),__exportStar(require("./services/data-enrichment.service"),exports),__exportStar(require("./models/create-enrichment-job-request"),exports),__exportStar(require("./models/create-enrichment-job-response"),exports),__exportStar(require("./models/submit-enrichment-job-request"),exports);
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,o){void 0===o&&(o=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,i)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/enrichment-job"),exports),__exportStar(require("./models/get-enrichment-job-parts-request"),exports),__exportStar(require("./models/enrichment-job-part"),exports),__exportStar(require("./services/data-enrichment.service"),exports),__exportStar(require("./models/create-enrichment-job-request"),exports),__exportStar(require("./models/create-enrichment-job-response"),exports),__exportStar(require("./models/submit-enrichment-job-request"),exports),__exportStar(require("./models/trigger-enrichment-job-request"),exports),__exportStar(require("./models/trigger-enrichment-job-response"),exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
+
import { EnrichmentJobType } from './enrichment-job';
|
|
3
|
+
/**
|
|
4
|
+
* Request to trigger a single-part enrichment job.
|
|
5
|
+
*/
|
|
6
|
+
export interface TriggerEnrichmentJobRequest {
|
|
7
|
+
/**
|
|
8
|
+
* Type of the enrichment job.
|
|
9
|
+
*/
|
|
10
|
+
type: EnrichmentJobType;
|
|
11
|
+
/**
|
|
12
|
+
* List of part ids to enrich.
|
|
13
|
+
*/
|
|
14
|
+
partIds: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Whether the job should be visible in the enrichment dashboard.
|
|
17
|
+
*/
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Organization identifier when explicitly selecting an organization.
|
|
21
|
+
*/
|
|
22
|
+
organization?: string;
|
|
23
|
+
}
|
|
@@ -10,6 +10,8 @@ import { CreateEnrichmentJobRequest } from '../models/create-enrichment-job-requ
|
|
|
10
10
|
import { CreateEnrichmentJobResponse } from '../models/create-enrichment-job-response';
|
|
11
11
|
import { SubmitEnrichmentJobRequest } from '../models/submit-enrichment-job-request';
|
|
12
12
|
import { GetEnrichmentJobRequest } from '../models/get-enrichment-job-request';
|
|
13
|
+
import { TriggerEnrichmentJobRequest } from '../models/trigger-enrichment-job-request';
|
|
14
|
+
import { TriggerEnrichmentJobResponse } from '../models/trigger-enrichment-job-response';
|
|
13
15
|
/**
|
|
14
16
|
* Service for managing data enrichment jobs.
|
|
15
17
|
*/
|
|
@@ -78,6 +80,13 @@ export interface DataEnrichmentService {
|
|
|
78
80
|
* @returns An Observable that emits the response
|
|
79
81
|
*/
|
|
80
82
|
submitEnrichmentJob(request: SubmitEnrichmentJobRequest): Observable<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Trigger a single-part enrichment job.
|
|
85
|
+
*
|
|
86
|
+
* @param request - The request containing enrichment type, part ids and optional visibility/organization.
|
|
87
|
+
* @returns An Observable that emits the created job id.
|
|
88
|
+
*/
|
|
89
|
+
triggerEnrichmentJob(request: TriggerEnrichmentJobRequest): Observable<TriggerEnrichmentJobResponse>;
|
|
81
90
|
}
|
|
82
91
|
export declare class DataEnrichmentServiceImpl extends BaseService implements DataEnrichmentService {
|
|
83
92
|
private httpsService;
|
|
@@ -103,6 +112,7 @@ export declare class DataEnrichmentServiceImpl extends BaseService implements Da
|
|
|
103
112
|
hasMoreEnrichmentJobPartsAvailable(paginationContext: DefaultGetPaginatedRequestPaginationContext): boolean;
|
|
104
113
|
createEnrichmentJob(request: CreateEnrichmentJobRequest): Observable<CreateEnrichmentJobResponse>;
|
|
105
114
|
submitEnrichmentJob(request: SubmitEnrichmentJobRequest): Observable<void>;
|
|
115
|
+
triggerEnrichmentJob(request: TriggerEnrichmentJobRequest): Observable<TriggerEnrichmentJobResponse>;
|
|
106
116
|
private fetchEnrichmentJobsPage;
|
|
107
117
|
private fetchEnrichmentJobPartsPage;
|
|
108
118
|
private extractNextCursor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(t,r,e,n){var o,i=arguments.length,s=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(r,e,s):o(r,e))||s);return i>3&&s&&Object.defineProperty(r,e,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataEnrichmentServiceImpl=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),enrichment_job_1=require("../models/enrichment-job"),enrichment_job_part_1=require("../models/enrichment-job-part"),DataEnrichmentServiceImpl=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return __extends(r,t),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},r.prototype.loadEnrichmentJobs=function(t){return this.fetchEnrichmentJobsPage(t).pipe((0,rxjs_1.map)((function(r){var e=r.jobs,n=r.nextCursor;return{jobs:e,paginationContext:{initialRequest:t,nextCursor:n}}})))},r.prototype.loadMoreEnrichmentJobs=function(t){if(!t.nextCursor)return(0,rxjs_1.throwError)((function(){return new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_PAGINATION_CURSOR_AVAILABLE,null,"No cursor available")}));var r=__assign(__assign({},t.initialRequest),{cursor:t.nextCursor});return this.fetchEnrichmentJobsPage(r).pipe((0,rxjs_1.map)((function(r){var e=r.jobs,n=r.nextCursor;return{jobs:e,paginationContext:__assign(__assign({},t),{nextCursor:n})}})))},r.prototype.hasMoreEnrichmentJobsAvailable=function(t){return!!t.nextCursor},r.prototype.getEnrichmentJob=function(t){return this.httpsService.get("jobs/".concat(t.jobId),[],core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){return(0,enrichment_job_1.enrichmentJobFromAPIResponse)(t)})))},r.prototype.loadEnrichmentJobParts=function(t){return this.fetchEnrichmentJobPartsPage(t).pipe((0,rxjs_1.map)((function(r){var e=r.parts,n=r.nextCursor;return{parts:e,paginationContext:{initialRequest:t,nextCursor:n}}})))},r.prototype.loadMoreEnrichmentJobParts=function(t){if(!t.nextCursor)return(0,rxjs_1.throwError)((function(){return new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_PAGINATION_CURSOR_AVAILABLE,null,"No cursor available")}));var r=__assign(__assign({},t.initialRequest),{cursor:t.nextCursor});return this.fetchEnrichmentJobPartsPage(r).pipe((0,rxjs_1.map)((function(r){var e=r.parts,n=r.nextCursor;return{parts:e,paginationContext:__assign(__assign({},t),{nextCursor:n})}})))},r.prototype.hasMoreEnrichmentJobPartsAvailable=function(t){return!!t.nextCursor},r.prototype.createEnrichmentJob=function(t){var r=new FormData;r.append("file",t.csvFile);var e=t.jobType?[{jobType:t.jobType}]:[];return this.httpsService.post("jobs/upload",r,e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT,{"Content-Type":"multipart/form-data"})},r.prototype.submitEnrichmentJob=function(t){return this.httpsService.post("jobs/".concat(t.jobId,"/submit"),t,[],core_1.BACKEND_SERVICE.DATA_ENRICHMENT)},r.prototype.fetchEnrichmentJobsPage=function(t){var r=this,e=Object.entries(t).map((function(t){var r,e=t[0],n=t[1];return(r={})[e]=n,r}));return this.httpsService.get("jobs",e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){var e;return{jobs:null===(e=t.results)||void 0===e?void 0:e.map((function(t){return(0,enrichment_job_1.enrichmentJobFromAPIResponse)(t)})),nextCursor:r.extractNextCursor(t)}})))},r.prototype.fetchEnrichmentJobPartsPage=function(t){var r=this,e=Object.entries(t).map((function(t){var r,e=t[0],n=t[1];return(r={})[e]=n,r}));return this.httpsService.get("jobs/".concat(t.jobId,"/parts"),e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){var e;return{parts:null===(e=t.results)||void 0===e?void 0:e.map((function(t){return(0,enrichment_job_part_1.enrichmentJobPartFromAPIResponse)(t)})),nextCursor:r.extractNextCursor(t)}})))},r.prototype.extractNextCursor=function(t){if(t.next)return new URL(t.next).searchParams.get("cursor")||void 0},r=__decorate([(0,core_1.InjectionIdentifier)("DataEnrichmentService")],r)}(core_1.BaseService);exports.DataEnrichmentServiceImpl=DataEnrichmentServiceImpl;
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(t,r,e,n){var o,i=arguments.length,s=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,r,e,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(r,e,s):o(r,e))||s);return i>3&&s&&Object.defineProperty(r,e,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataEnrichmentServiceImpl=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),enrichment_job_1=require("../models/enrichment-job"),enrichment_job_part_1=require("../models/enrichment-job-part"),DataEnrichmentServiceImpl=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return __extends(r,t),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},r.prototype.loadEnrichmentJobs=function(t){return this.fetchEnrichmentJobsPage(t).pipe((0,rxjs_1.map)((function(r){var e=r.jobs,n=r.nextCursor;return{jobs:e,paginationContext:{initialRequest:t,nextCursor:n}}})))},r.prototype.loadMoreEnrichmentJobs=function(t){if(!t.nextCursor)return(0,rxjs_1.throwError)((function(){return new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_PAGINATION_CURSOR_AVAILABLE,null,"No cursor available")}));var r=__assign(__assign({},t.initialRequest),{cursor:t.nextCursor});return this.fetchEnrichmentJobsPage(r).pipe((0,rxjs_1.map)((function(r){var e=r.jobs,n=r.nextCursor;return{jobs:e,paginationContext:__assign(__assign({},t),{nextCursor:n})}})))},r.prototype.hasMoreEnrichmentJobsAvailable=function(t){return!!t.nextCursor},r.prototype.getEnrichmentJob=function(t){return this.httpsService.get("jobs/".concat(t.jobId),[],core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){return(0,enrichment_job_1.enrichmentJobFromAPIResponse)(t)})))},r.prototype.loadEnrichmentJobParts=function(t){return this.fetchEnrichmentJobPartsPage(t).pipe((0,rxjs_1.map)((function(r){var e=r.parts,n=r.nextCursor;return{parts:e,paginationContext:{initialRequest:t,nextCursor:n}}})))},r.prototype.loadMoreEnrichmentJobParts=function(t){if(!t.nextCursor)return(0,rxjs_1.throwError)((function(){return new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_PAGINATION_CURSOR_AVAILABLE,null,"No cursor available")}));var r=__assign(__assign({},t.initialRequest),{cursor:t.nextCursor});return this.fetchEnrichmentJobPartsPage(r).pipe((0,rxjs_1.map)((function(r){var e=r.parts,n=r.nextCursor;return{parts:e,paginationContext:__assign(__assign({},t),{nextCursor:n})}})))},r.prototype.hasMoreEnrichmentJobPartsAvailable=function(t){return!!t.nextCursor},r.prototype.createEnrichmentJob=function(t){var r=new FormData;r.append("file",t.csvFile);var e=t.jobType?[{jobType:t.jobType}]:[];return this.httpsService.post("jobs/upload",r,e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT,{"Content-Type":"multipart/form-data"})},r.prototype.submitEnrichmentJob=function(t){return this.httpsService.post("jobs/".concat(t.jobId,"/submit"),t,[],core_1.BACKEND_SERVICE.DATA_ENRICHMENT)},r.prototype.triggerEnrichmentJob=function(t){var r,e=__assign({type:t.type,partIds:t.partIds,visible:null!==(r=t.visible)&&void 0!==r&&r},void 0!==t.organization?{organization:t.organization}:{});return this.httpsService.post("jobs/trigger",e,[],core_1.BACKEND_SERVICE.DATA_ENRICHMENT)},r.prototype.fetchEnrichmentJobsPage=function(t){var r=this,e=Object.entries(t).map((function(t){var r,e=t[0],n=t[1];return(r={})[e]=n,r}));return this.httpsService.get("jobs",e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){var e;return{jobs:null===(e=t.results)||void 0===e?void 0:e.map((function(t){return(0,enrichment_job_1.enrichmentJobFromAPIResponse)(t)})),nextCursor:r.extractNextCursor(t)}})))},r.prototype.fetchEnrichmentJobPartsPage=function(t){var r=this,e=Object.entries(t).map((function(t){var r,e=t[0],n=t[1];return(r={})[e]=n,r}));return this.httpsService.get("jobs/".concat(t.jobId,"/parts"),e,core_1.BACKEND_SERVICE.DATA_ENRICHMENT).pipe((0,rxjs_1.map)((function(t){var e;return{parts:null===(e=t.results)||void 0===e?void 0:e.map((function(t){return(0,enrichment_job_part_1.enrichmentJobPartFromAPIResponse)(t)})),nextCursor:r.extractNextCursor(t)}})))},r.prototype.extractNextCursor=function(t){if(t.next)return new URL(t.next).searchParams.get("cursor")||void 0},r=__decorate([(0,core_1.InjectionIdentifier)("DataEnrichmentService")],r)}(core_1.BaseService);exports.DataEnrichmentServiceImpl=DataEnrichmentServiceImpl;
|
package/gen/sdk-version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
export declare const SDK_VERSION_NUMBER = "15.
|
|
2
|
+
export declare const SDK_VERSION_NUMBER = "15.6.0";
|
package/gen/sdk-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="15.
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="15.6.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@partium/js-sdk",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.6.0",
|
|
4
4
|
"author": "Partium Inc.",
|
|
5
5
|
"license": "See LICENSE.txt",
|
|
6
6
|
"description": "The Partium Find SDK enables integration of Partium’s parts and materials search capabilities into JavaScript-based applications.",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,t,r,i){var o,s=arguments.length,n=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(n=(s<3?o(n):s>3?o(t,r,n):o(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,o=0,s=t.length;o<s;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestListServiceImpl=void 0;var request_list_1=require("../../models/request-list/request-list"),operators_1=require("rxjs/operators"),log_1=require("../../../core/models/log"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),base_service_1=require("../../../core/services/base.service"),log_service_1=require("../../../core/services/log.service"),RequestListServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},t.prototype.saveRequestList=function(e,t){var r=this,i=e.map((function(e){return{partiumId:e.partiumId,quantity:e.quantity}}));return this.postRequestList(e).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_UPDATE,{list:__spreadArray([],i,!0)},t)})))},t.prototype.updateRequestList=function(e,t,r){var i=e.map((function(e){return e.partiumId===t.partiumId?{partiumId:e.partiumId,quantity:t.quantity}:e}));return this.addPart(i,t,r)},t.prototype.addPart=function(e,t,r){var i=this,o=!!e.find((function(e){return e.partiumId===t.partiumId})),s=o?e:__spreadArray(__spreadArray([],e,!0),[t],!1),n=o?t.quantity:1;return this.postRequestList(s).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:t.partiumId,quantity:n,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},t.prototype.getRequestList=function(){return this.httpsService.get("request-list",null,https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.resetList=function(e){var t=this;return this.postRequestList([]).pipe((0,operators_1.tap)((function(){return t.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{},e)})),(0,operators_1.catchError)((function(e){console.log("Reset list log error",e)})))},t.prototype.deletePart=function(e,t){var r=this;return this.httpsService.delete("request-list/items/".concat(e),void 0,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e},t)})),(0,operators_1.map)((function(){return!0})))},t.prototype.postRequestList=function(e){var t=e.map((function(e){return{quantity:e.quantity,part_id:e.partiumId}}));return this.httpsService.post("request-list",t,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.dispatchLogService=function(e,t,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:e,data:t})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("RequestListService")],t)}(base_service_1.BaseService);exports.RequestListServiceImpl=RequestListServiceImpl;
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,t,r,i){var o,s=arguments.length,n=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(n=(s<3?o(n):s>3?o(t,r,n):o(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,o=0,s=t.length;o<s;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RequestListServiceImpl=void 0;var request_list_1=require("../../models/request-list/request-list"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),log_1=require("../../../core/models/log"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),base_service_1=require("../../../core/services/base.service"),log_service_1=require("../../../core/services/log.service"),RequestListServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},t.prototype.saveRequestList=function(e,t){var r=this,i=e.map((function(e){return{partiumId:e.partiumId,quantity:e.quantity}}));return this.postRequestList(e).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_UPDATE,{list:__spreadArray([],i,!0)},t)})))},t.prototype.updateRequestList=function(e,t,r){var i=e.map((function(e){return e.partiumId===t.partiumId?{partiumId:e.partiumId,quantity:t.quantity}:e}));return this.addPart(i,t,r)},t.prototype.addPart=function(e,t,r){var i=this,o=!!e.find((function(e){return e.partiumId===t.partiumId})),s=o?e:__spreadArray(__spreadArray([],e,!0),[t],!1),n=o?t.quantity:1;return this.postRequestList(s).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:t.partiumId,quantity:n,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},t.prototype.getRequestList=function(){return this.httpsService.get("request-list",null,https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.resetList=function(e){var t=this;return this.postRequestList([]).pipe((0,operators_1.tap)((function(){return t.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{},e)})),(0,operators_1.catchError)((function(e){return console.log("Reset list log error",e),(0,rxjs_1.throwError)((function(){return e}))})))},t.prototype.deletePart=function(e,t){var r=this;return this.httpsService.delete("request-list/items/".concat(e),void 0,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.tap)((function(){return r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e},t)})),(0,operators_1.map)((function(){return!0})))},t.prototype.postRequestList=function(e){var t=e.map((function(e){return{quantity:e.quantity,part_id:e.partiumId}}));return this.httpsService.post("request-list",t,[],https_service_interface_1.BACKEND_SERVICE.USER_DATA).pipe((0,operators_1.map)((function(e){return request_list_1.RequestList.fromAPIResponse(e).list})))},t.prototype.dispatchLogService=function(e,t,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:e,data:t})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)}))},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("RequestListService")],t)}(base_service_1.BaseService);exports.RequestListServiceImpl=RequestListServiceImpl;
|