@partium/js-sdk 13.0.0 → 14.0.0-alpha1
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/LICENSE.txt +1 -1
- package/catalog/index.d.ts +5 -0
- package/catalog/index.js +2 -0
- package/catalog/models/catalog-image-info.d.ts +18 -0
- package/catalog/models/catalog-image-info.js +2 -0
- package/catalog/models/catalog-image.d.ts +39 -0
- package/catalog/models/catalog-image.js +2 -0
- package/catalog/models/upsert-catalog-images-dto.d.ts +37 -0
- package/catalog/models/upsert-catalog-images-dto.js +2 -0
- package/catalog/models/upsert-images-result.d.ts +18 -0
- package/catalog/models/upsert-images-result.js +2 -0
- package/catalog/services/images.service.d.ts +27 -0
- package/catalog/services/images.service.js +2 -0
- package/core/constants/constants.d.ts +1 -0
- package/core/constants/constants.js +1 -1
- package/core/models/user.d.ts +2 -1
- package/core/models/user.js +1 -1
- package/core/services/http/https.service.interface.d.ts +16 -18
- package/core/services/http/https.service.interface.js +1 -1
- package/core/services/http/oauth-https.service.d.ts +3 -10
- package/core/services/http/oauth-https.service.js +1 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/LICENSE.txt
CHANGED
package/catalog/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/catalog-image-info"),exports),__exportStar(require("./models/upsert-catalog-images-dto"),exports),__exportStar(require("./models/catalog-image"),exports),__exportStar(require("./services/images.service"),exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* Meta data information to define the purpose of an image
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CatalogImageInfo {
|
|
6
|
+
/**
|
|
7
|
+
* Image is used a reference image for searching
|
|
8
|
+
*/
|
|
9
|
+
SEARCHABLE = "searchable",
|
|
10
|
+
/**
|
|
11
|
+
* Image is displayed with the corresponding part in the user interface
|
|
12
|
+
*/
|
|
13
|
+
DISPLAY = "display",
|
|
14
|
+
/**
|
|
15
|
+
* Image is used a reference image for searching and displayed with the corresponding part in the user interface
|
|
16
|
+
*/
|
|
17
|
+
SEARCHABLE_AND_DISPLAY = "searchable display"
|
|
18
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var CatalogImageInfo;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CatalogImageInfo=void 0,function(a){a.SEARCHABLE="searchable",a.DISPLAY="display",a.SEARCHABLE_AND_DISPLAY="searchable display"}(CatalogImageInfo||(exports.CatalogImageInfo=CatalogImageInfo={}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { APIObject } from '../../core';
|
|
3
|
+
import { CatalogImageInfo } from './catalog-image-info';
|
|
4
|
+
/**
|
|
5
|
+
* Image from the API
|
|
6
|
+
*/
|
|
7
|
+
export interface CatalogImageFromAPI {
|
|
8
|
+
/**
|
|
9
|
+
* The ID of the image
|
|
10
|
+
*/
|
|
11
|
+
image_id: string;
|
|
12
|
+
/**
|
|
13
|
+
* The external ID of the part
|
|
14
|
+
*/
|
|
15
|
+
part_id: string;
|
|
16
|
+
/**
|
|
17
|
+
* Meta data information to define the purpose of this image
|
|
18
|
+
*/
|
|
19
|
+
info: CatalogImageInfo;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An image in the catalog
|
|
23
|
+
*/
|
|
24
|
+
export declare class CatalogImage extends APIObject {
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the image
|
|
27
|
+
*/
|
|
28
|
+
imageId: string;
|
|
29
|
+
/**
|
|
30
|
+
* The external ID of the part
|
|
31
|
+
*/
|
|
32
|
+
externalPartId: string;
|
|
33
|
+
/**
|
|
34
|
+
* Meta data information to define the purpose of this image
|
|
35
|
+
*/
|
|
36
|
+
info: CatalogImageInfo;
|
|
37
|
+
constructor(init: Partial<CatalogImage>);
|
|
38
|
+
static fromAPIResponse(imageFromAPI: Partial<CatalogImageFromAPI>): CatalogImage;
|
|
39
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.CatalogImage=void 0;var core_1=require("../../core"),CatalogImage=function(t){function e(e){var o=t.call(this)||this;return Object.assign(o,e),o}return __extends(e,t),e.fromAPIResponse=function(t){return new e({imageId:t.image_id,externalPartId:t.part_id,info:t.info})},e}(core_1.APIObject);exports.CatalogImage=CatalogImage;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { CatalogImageInfo } from './catalog-image-info';
|
|
3
|
+
/**
|
|
4
|
+
* DTO for creating a new image
|
|
5
|
+
*
|
|
6
|
+
* @see UpsertCatalogImagesDto
|
|
7
|
+
*/
|
|
8
|
+
export interface NewCatalogImageDto {
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the image
|
|
11
|
+
*/
|
|
12
|
+
imageId: string;
|
|
13
|
+
/**
|
|
14
|
+
* The external ID of the part
|
|
15
|
+
*/
|
|
16
|
+
externalPartId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Meta data information to define the purpose of this image
|
|
19
|
+
*/
|
|
20
|
+
info: CatalogImageInfo;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* DTO for upserting images
|
|
24
|
+
*
|
|
25
|
+
* @see NewCatalogImageDto
|
|
26
|
+
*/
|
|
27
|
+
export interface UpsertCatalogImagesDto {
|
|
28
|
+
/**
|
|
29
|
+
* Array of File objects containing the image data to upload
|
|
30
|
+
*/
|
|
31
|
+
files: File[];
|
|
32
|
+
/**
|
|
33
|
+
* Array of image metadata corresponding to each file
|
|
34
|
+
* The array indices should match between files and images arrays
|
|
35
|
+
*/
|
|
36
|
+
images: NewCatalogImageDto[];
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* Result of the upsert images operation
|
|
4
|
+
*/
|
|
5
|
+
export interface UpsertImagesResult {
|
|
6
|
+
/**
|
|
7
|
+
* List of ids of the created images
|
|
8
|
+
*/
|
|
9
|
+
created: string[];
|
|
10
|
+
/**
|
|
11
|
+
* List of ids of the updated images
|
|
12
|
+
*/
|
|
13
|
+
updated: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Dictionary with ids of failed images and errors found
|
|
16
|
+
*/
|
|
17
|
+
errors: Record<string, string[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { BaseService } from '../../core/services/base.service';
|
|
4
|
+
import { ServiceProvider } from '../../core/services/service-provider';
|
|
5
|
+
import { UpsertCatalogImagesDto } from '../models/upsert-catalog-images-dto';
|
|
6
|
+
import { UpsertImagesResult } from '../models/upsert-images-result';
|
|
7
|
+
export interface ImagesService {
|
|
8
|
+
/**
|
|
9
|
+
* Upserts images.
|
|
10
|
+
*
|
|
11
|
+
* @param request - The images to upsert.
|
|
12
|
+
* @returns An Observable that emits the upserted images.
|
|
13
|
+
*/
|
|
14
|
+
upsert(request: UpsertCatalogImagesDto): Observable<UpsertImagesResult>;
|
|
15
|
+
}
|
|
16
|
+
export declare class ImagesServiceImpl extends BaseService implements ImagesService {
|
|
17
|
+
private httpsService;
|
|
18
|
+
constructor(serviceProvider: ServiceProvider);
|
|
19
|
+
onCreate(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Upserts images.
|
|
22
|
+
*
|
|
23
|
+
* @param request - The images to upsert.
|
|
24
|
+
* @returns An Observable that emits the upserted images.
|
|
25
|
+
*/
|
|
26
|
+
upsert(request: UpsertCatalogImagesDto): Observable<UpsertImagesResult>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 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 n,o=arguments.length,c=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ImagesServiceImpl=void 0;var injection_identifier_1=require("../../core/decorators/injection-identifier"),base_service_1=require("../../core/services/base.service"),https_service_interface_1=require("../../core/services/http/https.service.interface"),ImagesServiceImpl=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)},t.prototype.upsert=function(e){var t=new FormData;return e.files.forEach((function(e){t.append("files",e,e.name)})),t.append("images",JSON.stringify(e.images.map((function(e){return{image_id:e.imageId,part_id:e.externalPartId,info:e.info}})))),this.httpsService.post("images",t,null,https_service_interface_1.BACKEND_SERVICE.CATALOG,{"Content-Type":"multipart/form-data"})},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("ImagesService")],t)}(base_service_1.BaseService);exports.ImagesServiceImpl=ImagesServiceImpl;
|
|
@@ -9,4 +9,5 @@ export declare const REL_OCR_API_URL = "_ocr";
|
|
|
9
9
|
export declare const REL_AUTH_API_URL = "_auth";
|
|
10
10
|
export declare const REL_STATUS_API_URL = "_status";
|
|
11
11
|
export declare const REL_MANAGEMENT_API_URL = "management";
|
|
12
|
+
export declare const REL_CATALOG_API_URL = "catalog";
|
|
12
13
|
export declare const BACKEND_STATUS_FALLBACK_URL = "https://example.com";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BACKEND_STATUS_FALLBACK_URL=exports.REL_MANAGEMENT_API_URL=exports.REL_STATUS_API_URL=exports.REL_AUTH_API_URL=exports.REL_OCR_API_URL=exports.REL_USER_DATA_API_URL=exports.REL_LOGS_API_URL=exports.REL_CSA_API_URL=exports.REL_DATA_API_URL=exports.REL_FIND_API_URL=exports.PARTIUM_API_VERSION=void 0,exports.PARTIUM_API_VERSION=1,exports.REL_FIND_API_URL="_find",exports.REL_DATA_API_URL="_data",exports.REL_CSA_API_URL="_csa",exports.REL_LOGS_API_URL="_logs",exports.REL_USER_DATA_API_URL="_ud",exports.REL_OCR_API_URL="_ocr",exports.REL_AUTH_API_URL="_auth",exports.REL_STATUS_API_URL="_status",exports.REL_MANAGEMENT_API_URL="management",exports.BACKEND_STATUS_FALLBACK_URL="https://example.com";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BACKEND_STATUS_FALLBACK_URL=exports.REL_CATALOG_API_URL=exports.REL_MANAGEMENT_API_URL=exports.REL_STATUS_API_URL=exports.REL_AUTH_API_URL=exports.REL_OCR_API_URL=exports.REL_USER_DATA_API_URL=exports.REL_LOGS_API_URL=exports.REL_CSA_API_URL=exports.REL_DATA_API_URL=exports.REL_FIND_API_URL=exports.PARTIUM_API_VERSION=void 0,exports.PARTIUM_API_VERSION=1,exports.REL_FIND_API_URL="_find",exports.REL_DATA_API_URL="_data",exports.REL_CSA_API_URL="_csa",exports.REL_LOGS_API_URL="_logs",exports.REL_USER_DATA_API_URL="_ud",exports.REL_OCR_API_URL="_ocr",exports.REL_AUTH_API_URL="_auth",exports.REL_STATUS_API_URL="_status",exports.REL_MANAGEMENT_API_URL="management",exports.REL_CATALOG_API_URL="catalog",exports.BACKEND_STATUS_FALLBACK_URL="https://example.com";
|
package/core/models/user.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export declare enum Role {
|
|
|
14
14
|
factoryWorker = "factoryWorker",
|
|
15
15
|
developer = "developer",
|
|
16
16
|
catalogAdmin = "catalogAdmin",
|
|
17
|
-
dataManipulator = "dataManipulator"
|
|
17
|
+
dataManipulator = "dataManipulator",
|
|
18
|
+
dataContributor = "dataContributor"
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* The user-object of the user that is logged in into the SDK.
|
package/core/models/user.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var Role;Object.defineProperty(exports,"__esModule",{value:!0}),exports.User=exports.Role=void 0,function(e){e.admin="admin",e.announcementsEditor="announcementsEditor",e.partiumAnnouncementsEditor="partiumAnnouncementsEditor",e.user="user",e.analyst="dataAnalyst",e.dataInsightAnalyst="dataInsightAnalyst",e.csa="csa",e.factoryWorker="factoryWorker",e.developer="developer",e.catalogAdmin="catalogAdmin",e.dataManipulator="dataManipulator"}(Role||(exports.Role=Role={}));var User=function(){function e(e,t,r,n){void 0===n&&(n=[]),this.email=e,this.role=t,this.roles=r||new Set([t]),this.groups=n}return e.createFromToken=function(t){var r=t.email||t.preferred_username,n=this.createRoles(t),o=t.groups||[];return new e(r,n.values().next().value,n,o)},e.createRoles=function(e){if(e.role)return new Set([e.role]);if(e.groups){for(var t=new Set,r=0,n=e.groups;r<n.length;r++){var o=n[r],a=this.getRoleFromGroup(o);t.add(a)}return t}return new Set},e.getRoleFromGroup=function(e){var t=this.checkPartiumRoles(e),r=e.slice(e.lastIndexOf("/")+1);return this.getRoleByString(r,t)},e.checkPartiumRoles=function(e){var t=e.split("/"),r="partium"===t[t.length-2],n=t[t.length-1],o=Object.values(Role);return r&&!!o.find((function(e){return e===n}))},e.getRoleByString=function(e,t){if(Object.values(Role).includes(e)){var r=e;return r===Role.announcementsEditor&&t?Role.partiumAnnouncementsEditor:r}return Role.factoryWorker},e}();exports.User=User;
|
|
2
|
+
"use strict";var Role;Object.defineProperty(exports,"__esModule",{value:!0}),exports.User=exports.Role=void 0,function(e){e.admin="admin",e.announcementsEditor="announcementsEditor",e.partiumAnnouncementsEditor="partiumAnnouncementsEditor",e.user="user",e.analyst="dataAnalyst",e.dataInsightAnalyst="dataInsightAnalyst",e.csa="csa",e.factoryWorker="factoryWorker",e.developer="developer",e.catalogAdmin="catalogAdmin",e.dataManipulator="dataManipulator",e.dataContributor="dataContributor"}(Role||(exports.Role=Role={}));var User=function(){function e(e,t,r,n){void 0===n&&(n=[]),this.email=e,this.role=t,this.roles=r||new Set([t]),this.groups=n}return e.createFromToken=function(t){var r=t.email||t.preferred_username,n=this.createRoles(t),o=t.groups||[];return new e(r,n.values().next().value,n,o)},e.createRoles=function(e){if(e.role)return new Set([e.role]);if(e.groups){for(var t=new Set,r=0,n=e.groups;r<n.length;r++){var o=n[r],a=this.getRoleFromGroup(o);t.add(a)}return t}return new Set},e.getRoleFromGroup=function(e){var t=this.checkPartiumRoles(e),r=e.slice(e.lastIndexOf("/")+1);return this.getRoleByString(r,t)},e.checkPartiumRoles=function(e){var t=e.split("/"),r="partium"===t[t.length-2],n=t[t.length-1],o=Object.values(Role);return r&&!!o.find((function(e){return e===n}))},e.getRoleByString=function(e,t){if(Object.values(Role).includes(e)){var r=e;return r===Role.announcementsEditor&&t?Role.partiumAnnouncementsEditor:r}return Role.factoryWorker},e}();exports.User=User;
|
|
@@ -12,7 +12,19 @@ export declare enum BACKEND_SERVICE {
|
|
|
12
12
|
LOG = 4,
|
|
13
13
|
USER_DATA = 5,
|
|
14
14
|
OCR = 6,
|
|
15
|
-
MANAGEMENT = 7
|
|
15
|
+
MANAGEMENT = 7,
|
|
16
|
+
CATALOG = 8
|
|
17
|
+
}
|
|
18
|
+
export interface BaseUrls {
|
|
19
|
+
partiumApiBaseUrl: string;
|
|
20
|
+
findBeBaseUrl: string;
|
|
21
|
+
dataBeBaseUrl: string;
|
|
22
|
+
csaBeBaseUrl: string;
|
|
23
|
+
logBeBaseUrl: string;
|
|
24
|
+
userDataBeBaseUrl: string;
|
|
25
|
+
ocrBeBaseUrl: string;
|
|
26
|
+
managementBeBaseUrl: string;
|
|
27
|
+
catalogBeBaseUrl: string;
|
|
16
28
|
}
|
|
17
29
|
/**
|
|
18
30
|
* Defines the structure of a https-service implementation, which
|
|
@@ -31,14 +43,7 @@ export declare enum BACKEND_SERVICE {
|
|
|
31
43
|
*/
|
|
32
44
|
export declare class HttpsService extends BaseService {
|
|
33
45
|
private httpsClientService;
|
|
34
|
-
private
|
|
35
|
-
private findBeBaseUrl;
|
|
36
|
-
private dataBeBaseUrl;
|
|
37
|
-
private csaBeBaseUrl;
|
|
38
|
-
private logBeBaseUrl;
|
|
39
|
-
private userDataBeBaseUrl;
|
|
40
|
-
private ocrBeBaseUrl;
|
|
41
|
-
private managementBeBaseUrl;
|
|
46
|
+
private baseUrls;
|
|
42
47
|
protected config: AuthenticationConfig;
|
|
43
48
|
private currentOrganization$;
|
|
44
49
|
constructor(serviceProvider: ServiceProvider);
|
|
@@ -46,17 +51,10 @@ export declare class HttpsService extends BaseService {
|
|
|
46
51
|
/**
|
|
47
52
|
* Initialize the https-service with configuration parameters.
|
|
48
53
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param findBeBaseUrl: the partium-find-backend base-url
|
|
51
|
-
* @param dataBeBaseUrl: the partium-data-backend base-url
|
|
52
|
-
* @param csaBeBaseUrl: the partium-csa-backend base-url
|
|
53
|
-
* @param logBeBaseUrl: the partium-log-collector-backend base-url
|
|
54
|
-
* @param userDataBeBaseUrl: the partium-user-data-backend base-url
|
|
55
|
-
* @param ocrBeBaseUrl: the partium-ocr-backend base-url
|
|
56
|
-
* @param managementBeBaseUrl: the partium-management-backend base-url
|
|
54
|
+
* @param baseUrls: the base-urls for the different backends
|
|
57
55
|
* @param config the https service configuration
|
|
58
56
|
*/
|
|
59
|
-
init(
|
|
57
|
+
init(baseUrls: BaseUrls, config: AuthenticationConfig): Observable<void>;
|
|
60
58
|
/**
|
|
61
59
|
* Send GET request to the Partium-backend with the given relative url.
|
|
62
60
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}(),__decorate=this&&this.__decorate||function(e,r,t,n){var o,i=arguments.length,s=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(i<3?o(s):i>3?o(r,t,s):o(r,t))||s);return i>3&&s&&Object.defineProperty(r,t,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpsService=exports.BACKEND_SERVICE=void 0;var BACKEND_SERVICE,base_service_1=require("../base.service"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("./https-client/https-client.service.interface"),injection_identifier_1=require("../../decorators/injection-identifier");!function(e){e[e.PARTIUM=0]="PARTIUM",e[e.FIND=1]="FIND",e[e.DATA=2]="DATA",e[e.CSA=3]="CSA",e[e.LOG=4]="LOG",e[e.USER_DATA=5]="USER_DATA",e[e.OCR=6]="OCR",e[e.MANAGEMENT=7]="MANAGEMENT"}(BACKEND_SERVICE||(exports.BACKEND_SERVICE=BACKEND_SERVICE={}));var HttpsService=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){this.httpsClientService=this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService)},r.prototype.init=function(e,r
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}(),__decorate=this&&this.__decorate||function(e,r,t,n){var o,i=arguments.length,s=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(i<3?o(s):i>3?o(r,t,s):o(r,t))||s);return i>3&&s&&Object.defineProperty(r,t,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpsService=exports.BACKEND_SERVICE=void 0;var BACKEND_SERVICE,base_service_1=require("../base.service"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("./https-client/https-client.service.interface"),injection_identifier_1=require("../../decorators/injection-identifier");!function(e){e[e.PARTIUM=0]="PARTIUM",e[e.FIND=1]="FIND",e[e.DATA=2]="DATA",e[e.CSA=3]="CSA",e[e.LOG=4]="LOG",e[e.USER_DATA=5]="USER_DATA",e[e.OCR=6]="OCR",e[e.MANAGEMENT=7]="MANAGEMENT",e[e.CATALOG=8]="CATALOG"}(BACKEND_SERVICE||(exports.BACKEND_SERVICE=BACKEND_SERVICE={}));var HttpsService=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){this.httpsClientService=this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService)},r.prototype.init=function(e,r){return this.baseUrls=e,this.config=r,(0,rxjs_1.of)(void 0)},r.prototype.get=function(e,r,t){var n=this;return(0,rxjs_1.defer)((function(){return n.configureHeaders({},t)})).pipe((0,operators_1.mergeMap)((function(o){return n.httpsClientService.get(n.createUrl(e,t),r,o)})),(0,operators_1.retryWhen)((function(e){return n.retryWhen(e)})),(0,operators_1.catchError)((function(e){return n.processError(e)})))},r.prototype.post=function(e,r,t,n,o){var i=this;return(0,rxjs_1.defer)((function(){return i.configureHeaders(o,n)})).pipe((0,operators_1.mergeMap)((function(o){return i.httpsClientService.post(i.createUrl(e,n),r,t,o)})),(0,operators_1.retryWhen)((function(e){return i.retryWhen(e)})),(0,operators_1.catchError)((function(e){return i.processError(e)})))},r.prototype.put=function(e,r,t,n,o){var i=this;return(0,rxjs_1.defer)((function(){return i.configureHeaders(o,n)})).pipe((0,operators_1.mergeMap)((function(o){return i.httpsClientService.put(i.createUrl(e,n),r,t,o)})),(0,operators_1.retryWhen)((function(e){return i.retryWhen(e)})),(0,operators_1.catchError)((function(e){return i.processError(e)})))},r.prototype.patch=function(e,r,t,n,o){var i=this;return(0,rxjs_1.defer)((function(){return i.configureHeaders(o,n)})).pipe((0,operators_1.mergeMap)((function(o){return i.httpsClientService.patch(i.createUrl(e,n),r,t,o)})),(0,operators_1.retryWhen)((function(e){return i.retryWhen(e)})),(0,operators_1.catchError)((function(e){return i.processError(e)})))},r.prototype.delete=function(e,r,t,n){var o=this;return(0,rxjs_1.defer)((function(){return o.configureHeaders({},n)})).pipe((0,operators_1.mergeMap)((function(i){return o.httpsClientService.delete(o.createUrl(e,n),r,t,i)})),(0,operators_1.retryWhen)((function(e){return o.retryWhen(e)})),(0,operators_1.catchError)((function(e){return o.processError(e)})))},r.prototype.setCurrentOrganization=function(e){this.currentOrganization$=e},r.prototype.retryWhen=function(e){return e.pipe((0,operators_1.mergeMap)((function(e){return(0,rxjs_1.throwError)(e)})))},r.prototype.processError=function(e){return(0,rxjs_1.throwError)(e)},r.prototype.createHeaders=function(e){throw new Error("In order to use the HttpsService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},r.prototype.createUrl=function(e,r){for(void 0===r&&(r=BACKEND_SERVICE.FIND);e.startsWith("/");)e=e.substring(1);var t;switch(r){case BACKEND_SERVICE.PARTIUM:t=this.baseUrls.partiumApiBaseUrl;break;case BACKEND_SERVICE.DATA:t=this.baseUrls.dataBeBaseUrl;break;case BACKEND_SERVICE.CSA:t=this.baseUrls.csaBeBaseUrl;break;case BACKEND_SERVICE.LOG:t=this.baseUrls.logBeBaseUrl;break;case BACKEND_SERVICE.USER_DATA:t=this.baseUrls.userDataBeBaseUrl;break;case BACKEND_SERVICE.OCR:t=this.baseUrls.ocrBeBaseUrl;break;case BACKEND_SERVICE.MANAGEMENT:t=this.baseUrls.managementBeBaseUrl;break;case BACKEND_SERVICE.CATALOG:t=this.baseUrls.catalogBeBaseUrl;break;case BACKEND_SERVICE.FIND:default:t=this.baseUrls.findBeBaseUrl}return[t,e].join("/")},r.prototype.configureHeaders=function(e,r){var t=this.createHeaders(e);return this.config.externalUserId&&r!==BACKEND_SERVICE.LOG&&(t["X-Partium-ExternalUserId"]=this.config.externalUserId),this.currentOrganization$?this.currentOrganization$.pipe((0,operators_1.first)(),(0,operators_1.map)((function(e){return(null==e?void 0:e.name)&&(t["X-Partium-Data-Organization"]=e.name),t}))):(0,rxjs_1.of)(t)},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("HttpsService")],r)}(base_service_1.BaseService);exports.HttpsService=HttpsService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { OauthAuthenticationConfig } from '../../models/auth-config';
|
|
4
|
-
import { BACKEND_SERVICE, HttpsService } from './https.service.interface';
|
|
4
|
+
import { BACKEND_SERVICE, BaseUrls, HttpsService } from './https.service.interface';
|
|
5
5
|
import { ServiceProvider } from '../service-provider';
|
|
6
6
|
/**
|
|
7
7
|
* Implementation of https service that provides authorization with oauth.
|
|
@@ -17,17 +17,10 @@ export declare class OauthHttpsService extends HttpsService {
|
|
|
17
17
|
* If the configuration contains an API-Key, directly create a
|
|
18
18
|
* user-session, by calling login.
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param findBeBaseUrl: the partium-find-backend base-url
|
|
22
|
-
* @param dataBeBaseUrl: the partium-data-backend base-url
|
|
23
|
-
* @param csaBeBaseUrl: the partium-csa-backend base-url
|
|
24
|
-
* @param logBeBaseUrl: the partium-logs-backend base-url
|
|
25
|
-
* @param userDataBeBaseUrl: the partium-user-data-backend base-url
|
|
26
|
-
* @param ocrBeBaseUrl: the partium-ocr-backend base-url
|
|
27
|
-
* @param managementBeBaseUrl: the partium-management-backend base-url
|
|
20
|
+
* @param baseUrls: the base-urls for the different backends
|
|
28
21
|
* @param config the oauth auth-configuration
|
|
29
22
|
*/
|
|
30
|
-
init(
|
|
23
|
+
init(baseUrls: BaseUrls, config: OauthAuthenticationConfig): Observable<void>;
|
|
31
24
|
/**
|
|
32
25
|
* It is not sufficient that the token is set on init, because it can change when for example
|
|
33
26
|
* a refresh is required.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.OauthHttpsService=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),https_service_interface_1=require("./https.service.interface"),error_1=require("../../models/error"),oauth_session_service_1=require("../session/oauth-session.service"),session_service_interface_1=require("../session/session.service.interface"),OauthHttpsService=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.oauthSessionService=this.serviceProvider.getService(session_service_interface_1.SessionService)},r.prototype.init=function(r,t
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.OauthHttpsService=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),https_service_interface_1=require("./https.service.interface"),error_1=require("../../models/error"),oauth_session_service_1=require("../session/oauth-session.service"),session_service_interface_1=require("../session/session.service.interface"),OauthHttpsService=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.oauthSessionService=this.serviceProvider.getService(session_service_interface_1.SessionService)},r.prototype.init=function(r,t){return e.prototype.init.call(this,r,t),t.apiKey?this.callOauthLogin():(0,rxjs_1.of)(void 0)},r.prototype.setToken=function(e,r){this.authToken=e,this.authTokenExpiresAt=r},r.prototype.get=function(r,t,o){var i=this;return this.refreshSessionIfNeeded().pipe((0,operators_1.mergeMap)((function(){return e.prototype.get.call(i,r,t,o)})))},r.prototype.post=function(r,t,o,i,n){var s=this;return this.refreshSessionIfNeeded().pipe((0,operators_1.mergeMap)((function(){return e.prototype.post.call(s,r,t,o,i,n)})))},r.prototype.patch=function(r,t,o,i,n){var s=this;return this.refreshSessionIfNeeded().pipe((0,operators_1.mergeMap)((function(){return e.prototype.patch.call(s,r,t,o,i,n)})))},r.prototype.retryWhen=function(e){var r=this;return e.pipe((0,operators_1.mergeMap)((function(e){return e.code===error_1.SDK_ERROR_CODES.TOKEN_EXPIRED?(console.log("HttpsService - Token expired, attempting refresh"),r.refreshOrLogin()):(0,rxjs_1.throwError)(e)})))},r.prototype.createHeaders=function(e){var r={"Content-Type":"application/json"};return this.authToken&&(r.Authorization="Bearer ".concat(this.authToken)),Object.assign(r,e)},r.prototype.callOauthLogin=function(){var e=this.config;return this.oauthSessionService.login(new oauth_session_service_1.OauthLoginConfig({apiKey:e.apiKey}))},r.prototype.refreshSessionIfNeeded=function(){var e=!1;this.authTokenExpiresAt?e=(Date.now()/1e3|0)>this.authTokenExpiresAt.getTime()/1e3-60:e=!0;return e?this.refreshOrLogin():(0,rxjs_1.of)(void 0)},r.prototype.refreshOrLogin=function(){var e=this;return this.oauthSessionService.refresh().pipe((0,operators_1.catchError)((function(r){return r.code===error_1.SDK_ERROR_CODES.REFRESH_TOKEN_EXPIRED||r.code===error_1.SDK_ERROR_CODES.INVALID_TOKEN||r.code===error_1.SDK_ERROR_CODES.BAD_REQUEST||r.code===error_1.SDK_ERROR_CODES.OAUTH_ERROR?e.callOauthLogin().pipe((0,operators_1.catchError)((function(e){return e.code===error_1.SDK_ERROR_CODES.INVALID_LOGIN_CONFIG?(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.REFRESH_TOKEN_EXPIRED,r)):(0,rxjs_1.throwError)(e)}))):(0,rxjs_1.throwError)(r)})))},r}(https_service_interface_1.HttpsService);exports.OauthHttpsService=OauthHttpsService;
|
package/gen/sdk-version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
export declare const SDK_VERSION_NUMBER = "
|
|
2
|
+
export declare const SDK_VERSION_NUMBER = "14.0.0";
|
package/gen/sdk-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="14.0.0";
|
package/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { AnnouncementService } from './data/services/announcement.service';
|
|
|
24
24
|
import { RelatedPartsService } from './data/services/related-parts.service';
|
|
25
25
|
import { ApiKeyService } from './management';
|
|
26
26
|
import { PartEnrichmentService } from './data/services/part-enrichment.service';
|
|
27
|
+
import { ImagesService } from './catalog/services/images.service';
|
|
27
28
|
export declare enum INITIALIZATION_STATUS {
|
|
28
29
|
NOT_INITIALIZED = 0,
|
|
29
30
|
INITIALIZING = 1,
|
|
@@ -65,6 +66,7 @@ export declare class Partium {
|
|
|
65
66
|
static get ocr(): OcrService;
|
|
66
67
|
static get apiKey(): ApiKeyService;
|
|
67
68
|
static get localStorage(): LocalStorageService;
|
|
69
|
+
static get images(): ImagesService;
|
|
68
70
|
/**
|
|
69
71
|
* Initialize the Partium SDK with a given configuration.
|
|
70
72
|
* The configuration defines what Authentication method is used and which
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Partium=exports.INITIALIZATION_STATUS=void 0;var INITIALIZATION_STATUS,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("./core"),auth_config_1=require("./core/models/auth-config"),partium_config_1=require("./core/models/partium-config"),backend_status_service_1=require("./core/services/backend-status.service"),device_status_service_interface_1=require("./core/services/device-status.service.interface"),file_service_interface_1=require("./core/services/file.service.interface"),file_transfer_service_interface_1=require("./core/services/http/file-transfer/file-transfer.service.interface"),https_client_service_interface_1=require("./core/services/http/https-client/https-client.service.interface"),https_service_interface_1=require("./core/services/http/https.service.interface"),local_storage_service_interface_1=require("./core/services/local-storage.service.interface"),log_service_1=require("./core/services/log.service"),service_provider_1=require("./core/services/service-provider"),session_service_interface_1=require("./core/services/session/session.service.interface"),data_1=require("./data"),filter_service_1=require("./data/services/filter.service"),part_attribute_service_1=require("./data/services/part-attribute.service"),part_service_1=require("./data/services/part.service"),request_list_service_1=require("./user-data/services/request-list/request-list.service"),favorite_service_1=require("./user-data/services/favorite/favorite.service"),asset_service_1=require("./find/services/asset.service"),search_service_1=require("./find/services/search/search.service"),sdk_version_1=require("./gen/sdk-version"),recent_text_search_queries_service_1=require("./find/services/search/recent-text-search-queries.service"),ocr_1=require("./ocr"),shopping_cart_service_1=require("./data/services/shopping-cart.service"),inquiry_service_1=require("./data/services/inquiry.service"),announcement_service_1=require("./data/services/announcement.service"),related_parts_service_1=require("./data/services/related-parts.service"),constants_1=require("./core/constants/constants"),management_1=require("./management"),part_enrichment_service_1=require("./data/services/part-enrichment.service");!function(e){e[e.NOT_INITIALIZED=0]="NOT_INITIALIZED",e[e.INITIALIZING=1]="INITIALIZING",e[e.INITIALIZED=2]="INITIALIZED",e[e.INITIALIZATION_ERROR=3]="INITIALIZATION_ERROR"}(INITIALIZATION_STATUS||(exports.INITIALIZATION_STATUS=INITIALIZATION_STATUS={}));var Partium=function(){function e(){}return Object.defineProperty(e,"search",{get:function(){return e.getService(search_service_1.SearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"asset",{get:function(){return e.getService(asset_service_1.AssetServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"https",{get:function(){return e.getService(https_service_interface_1.HttpsService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fileTransfer",{get:function(){return e.getService(file_transfer_service_interface_1.FileTransferService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"session",{get:function(){return e.getService(session_service_interface_1.SessionService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"assemblyHierarchyNode",{get:function(){return e.getService(data_1.AssemblyHierarchyNodesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"part",{get:function(){return e.getService(part_service_1.PartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partEnrichment",{get:function(){return e.getService(part_enrichment_service_1.PartEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"relatedParts",{get:function(){return e.getService(related_parts_service_1.RelatedPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"requestList",{get:function(){return e.getService(request_list_service_1.RequestListServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shoppingCart",{get:function(){return e.getService(shopping_cart_service_1.ShoppingCartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partAttribute",{get:function(){return e.getService(part_attribute_service_1.PartAttributeServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inquiry",{get:function(){return e.getService(inquiry_service_1.InquiryServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"announcement",{get:function(){return e.getService(announcement_service_1.AnnouncementServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"customerServiceAssistance",{get:function(){return e.getService(data_1.CustomerServiceAssistanceServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"log",{get:function(){return e.getService(log_service_1.LogServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"file",{get:function(){return e.getService(file_service_interface_1.FileService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"recentParts",{get:function(){return e.getService(core_1.RecentPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"favorites",{get:function(){return e.getService(favorite_service_1.FavoriteServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"filters",{get:function(){return e.getService(filter_service_1.FilterServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"organization",{get:function(){return e.getService(core_1.OrganizationService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ocr",{get:function(){return e.getService(ocr_1.OcrServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"apiKey",{get:function(){return e.getService(management_1.ApiKeyServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"localStorage",{get:function(){return e.getService(local_storage_service_interface_1.LocalStorageService)},enumerable:!1,configurable:!0}),e.init=function(r){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZING),e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider);var i=[r.partiumApiBaseUrl,r.partiumLoginUrl];switch(e._serviceProvider.useService(r.httpsClientService,https_client_service_interface_1.HttpsClientService,i),e._serviceProvider.useService(r.fileTransferService,file_transfer_service_interface_1.FileTransferService,i),e._serviceProvider.useService(r.localStorageService,local_storage_service_interface_1.LocalStorageService),e._serviceProvider.useService(r.deviceStatusService,device_status_service_interface_1.DeviceStatusService),e._serviceProvider.useService(r.fileService,file_service_interface_1.FileService),r.authenticationMethod){case partium_config_1.AUTHENTICATION_METHOD.OAUTH_API_KEY:case partium_config_1.AUTHENTICATION_METHOD.OAUTH:e._serviceProvider.useService(r.authenticationConfig.oauthHttpsService,https_service_interface_1.HttpsService),e._serviceProvider.useService(r.authenticationConfig.oauthSessionService,session_service_interface_1.SessionService)}e._serviceProvider.serviceSelectionFinished();var t=e.getService(session_service_interface_1.SessionService),c=e.getService(local_storage_service_interface_1.LocalStorageService);t.registerLoginInitService(c,1);var n=e.getService(asset_service_1.AssetServiceImpl);t.registerLoginInitService(n,2);var s=e.getService(core_1.RecentPartsServiceImpl);t.registerLoginInitService(s,2);var a=e.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl);t.registerLoginInitService(a,2);var _=e.getService(favorite_service_1.FavoriteServiceImpl);t.registerLoginInitService(_,2);var o=e.getService(data_1.CustomerServiceAssistanceServiceImpl);t.registerLoginInitService(o,2);var v=e.getService(search_service_1.SearchServiceImpl);t.registerLoginInitService(v,2);var u=e.getService(log_service_1.LogServiceImpl);t.registerLoginInitService(u,2);var I=e.getService(https_service_interface_1.HttpsService),l=e.getService(backend_status_service_1.BackendStatusService);return l.init(sdk_version_1.SDK_VERSION_NUMBER,"en",e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_STATUS_API_URL]),constants_1.BACKEND_STATUS_FALLBACK_URL),l.checkCompatibility().pipe((0,operators_1.mergeMap)((function(){return l.checkAvailability()})),(0,operators_1.mergeMap)((function(){return t.init(r)})),(0,operators_1.mergeMap)((function(){return I.init(e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION)]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_FIND_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CSA_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_LOGS_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_USER_DATA_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_OCR_API_URL]),e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_MANAGEMENT_API_URL]),r.authenticationConfig)})),(0,operators_1.tap)((function(){I.setCurrentOrganization(t.getCurrentOrganization$())})),(0,operators_1.tap)((function(){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZED)})),(0,operators_1.catchError)((function(r){return e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZATION_ERROR),e.reset(),(0,rxjs_1.throwError)(r)})))},e.initApiKey=function(r){return e.init(new partium_config_1.PartiumConfig({authenticationConfig:new auth_config_1.OauthApiKeyAuthenticationConfig({apiKey:r})}))},e.reset=function(){e._serviceProvider=null,e._initializationStatus$.next(INITIALIZATION_STATUS.NOT_INITIALIZED)},e.getInitializationStatus=function(){return e._initializationStatus$.asObservable()},e.getOrganizations=function(){return e.ensureInitialized(),e.getService(core_1.OrganizationService).getOrganizations()},e.useOrganization=function(r){return e.ensureInitialized(),e.session.useOrganization(r)},e.getService=function(r){return e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider),e._serviceProvider.getService(r)},e.isInitialized=function(){return e._initializationStatus$.value===INITIALIZATION_STATUS.INITIALIZED},e.ensureInitialized=function(){if(!e.isInitialized())throw"Partium-JS-SDK not initialized. Make sure to initialize the Partium-JS-SDK before you try to use it's features!"},e.buildUrl=function(e){for(var r=[],i=0,t=e;i<t.length;i++){var c=t[i];r.push(c.replace(/^\/+/,"").replace(/\/+$/,""))}return r.join("/")},e._initializationStatus$=new rxjs_1.BehaviorSubject(INITIALIZATION_STATUS.NOT_INITIALIZED),e}();exports.Partium=Partium;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Partium=exports.INITIALIZATION_STATUS=void 0;var INITIALIZATION_STATUS,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("./core"),auth_config_1=require("./core/models/auth-config"),partium_config_1=require("./core/models/partium-config"),backend_status_service_1=require("./core/services/backend-status.service"),device_status_service_interface_1=require("./core/services/device-status.service.interface"),file_service_interface_1=require("./core/services/file.service.interface"),file_transfer_service_interface_1=require("./core/services/http/file-transfer/file-transfer.service.interface"),https_client_service_interface_1=require("./core/services/http/https-client/https-client.service.interface"),https_service_interface_1=require("./core/services/http/https.service.interface"),local_storage_service_interface_1=require("./core/services/local-storage.service.interface"),log_service_1=require("./core/services/log.service"),service_provider_1=require("./core/services/service-provider"),session_service_interface_1=require("./core/services/session/session.service.interface"),data_1=require("./data"),filter_service_1=require("./data/services/filter.service"),part_attribute_service_1=require("./data/services/part-attribute.service"),part_service_1=require("./data/services/part.service"),request_list_service_1=require("./user-data/services/request-list/request-list.service"),favorite_service_1=require("./user-data/services/favorite/favorite.service"),asset_service_1=require("./find/services/asset.service"),search_service_1=require("./find/services/search/search.service"),sdk_version_1=require("./gen/sdk-version"),recent_text_search_queries_service_1=require("./find/services/search/recent-text-search-queries.service"),ocr_1=require("./ocr"),shopping_cart_service_1=require("./data/services/shopping-cart.service"),inquiry_service_1=require("./data/services/inquiry.service"),announcement_service_1=require("./data/services/announcement.service"),related_parts_service_1=require("./data/services/related-parts.service"),constants_1=require("./core/constants/constants"),management_1=require("./management"),part_enrichment_service_1=require("./data/services/part-enrichment.service"),images_service_1=require("./catalog/services/images.service");!function(e){e[e.NOT_INITIALIZED=0]="NOT_INITIALIZED",e[e.INITIALIZING=1]="INITIALIZING",e[e.INITIALIZED=2]="INITIALIZED",e[e.INITIALIZATION_ERROR=3]="INITIALIZATION_ERROR"}(INITIALIZATION_STATUS||(exports.INITIALIZATION_STATUS=INITIALIZATION_STATUS={}));var Partium=function(){function e(){}return Object.defineProperty(e,"search",{get:function(){return e.getService(search_service_1.SearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"asset",{get:function(){return e.getService(asset_service_1.AssetServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"https",{get:function(){return e.getService(https_service_interface_1.HttpsService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fileTransfer",{get:function(){return e.getService(file_transfer_service_interface_1.FileTransferService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"session",{get:function(){return e.getService(session_service_interface_1.SessionService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"assemblyHierarchyNode",{get:function(){return e.getService(data_1.AssemblyHierarchyNodesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"part",{get:function(){return e.getService(part_service_1.PartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partEnrichment",{get:function(){return e.getService(part_enrichment_service_1.PartEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"relatedParts",{get:function(){return e.getService(related_parts_service_1.RelatedPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"requestList",{get:function(){return e.getService(request_list_service_1.RequestListServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shoppingCart",{get:function(){return e.getService(shopping_cart_service_1.ShoppingCartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partAttribute",{get:function(){return e.getService(part_attribute_service_1.PartAttributeServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inquiry",{get:function(){return e.getService(inquiry_service_1.InquiryServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"announcement",{get:function(){return e.getService(announcement_service_1.AnnouncementServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"customerServiceAssistance",{get:function(){return e.getService(data_1.CustomerServiceAssistanceServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"log",{get:function(){return e.getService(log_service_1.LogServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"file",{get:function(){return e.getService(file_service_interface_1.FileService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"recentParts",{get:function(){return e.getService(core_1.RecentPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"favorites",{get:function(){return e.getService(favorite_service_1.FavoriteServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"filters",{get:function(){return e.getService(filter_service_1.FilterServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"organization",{get:function(){return e.getService(core_1.OrganizationService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ocr",{get:function(){return e.getService(ocr_1.OcrServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"apiKey",{get:function(){return e.getService(management_1.ApiKeyServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"localStorage",{get:function(){return e.getService(local_storage_service_interface_1.LocalStorageService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"images",{get:function(){return e.getService(images_service_1.ImagesServiceImpl)},enumerable:!1,configurable:!0}),e.init=function(r){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZING),e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider);var i=[r.partiumApiBaseUrl,r.partiumLoginUrl];switch(e._serviceProvider.useService(r.httpsClientService,https_client_service_interface_1.HttpsClientService,i),e._serviceProvider.useService(r.fileTransferService,file_transfer_service_interface_1.FileTransferService,i),e._serviceProvider.useService(r.localStorageService,local_storage_service_interface_1.LocalStorageService),e._serviceProvider.useService(r.deviceStatusService,device_status_service_interface_1.DeviceStatusService),e._serviceProvider.useService(r.fileService,file_service_interface_1.FileService),r.authenticationMethod){case partium_config_1.AUTHENTICATION_METHOD.OAUTH_API_KEY:case partium_config_1.AUTHENTICATION_METHOD.OAUTH:e._serviceProvider.useService(r.authenticationConfig.oauthHttpsService,https_service_interface_1.HttpsService),e._serviceProvider.useService(r.authenticationConfig.oauthSessionService,session_service_interface_1.SessionService)}e._serviceProvider.serviceSelectionFinished();var t=e.getService(session_service_interface_1.SessionService),c=e.getService(local_storage_service_interface_1.LocalStorageService);t.registerLoginInitService(c,1);var n=e.getService(asset_service_1.AssetServiceImpl);t.registerLoginInitService(n,2);var s=e.getService(core_1.RecentPartsServiceImpl);t.registerLoginInitService(s,2);var a=e.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl);t.registerLoginInitService(a,2);var _=e.getService(favorite_service_1.FavoriteServiceImpl);t.registerLoginInitService(_,2);var o=e.getService(data_1.CustomerServiceAssistanceServiceImpl);t.registerLoginInitService(o,2);var v=e.getService(search_service_1.SearchServiceImpl);t.registerLoginInitService(v,2);var u=e.getService(log_service_1.LogServiceImpl);t.registerLoginInitService(u,2);var l=e.getService(https_service_interface_1.HttpsService),I=e.getService(backend_status_service_1.BackendStatusService);return I.init(sdk_version_1.SDK_VERSION_NUMBER,"en",e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_STATUS_API_URL]),constants_1.BACKEND_STATUS_FALLBACK_URL),I.checkCompatibility().pipe((0,operators_1.mergeMap)((function(){return I.checkAvailability()})),(0,operators_1.mergeMap)((function(){return t.init(r)})),(0,operators_1.mergeMap)((function(){return l.init({partiumApiBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION)]),findBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_FIND_API_URL]),dataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_API_URL]),csaBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CSA_API_URL]),logBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_LOGS_API_URL]),userDataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_USER_DATA_API_URL]),ocrBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_OCR_API_URL]),managementBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_MANAGEMENT_API_URL]),catalogBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CATALOG_API_URL])},r.authenticationConfig)})),(0,operators_1.tap)((function(){l.setCurrentOrganization(t.getCurrentOrganization$())})),(0,operators_1.tap)((function(){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZED)})),(0,operators_1.catchError)((function(r){return e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZATION_ERROR),e.reset(),(0,rxjs_1.throwError)(r)})))},e.initApiKey=function(r){return e.init(new partium_config_1.PartiumConfig({authenticationConfig:new auth_config_1.OauthApiKeyAuthenticationConfig({apiKey:r})}))},e.reset=function(){e._serviceProvider=null,e._initializationStatus$.next(INITIALIZATION_STATUS.NOT_INITIALIZED)},e.getInitializationStatus=function(){return e._initializationStatus$.asObservable()},e.getOrganizations=function(){return e.ensureInitialized(),e.getService(core_1.OrganizationService).getOrganizations()},e.useOrganization=function(r){return e.ensureInitialized(),e.session.useOrganization(r)},e.getService=function(r){return e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider),e._serviceProvider.getService(r)},e.isInitialized=function(){return e._initializationStatus$.value===INITIALIZATION_STATUS.INITIALIZED},e.ensureInitialized=function(){if(!e.isInitialized())throw"Partium-JS-SDK not initialized. Make sure to initialize the Partium-JS-SDK before you try to use it's features!"},e.buildUrl=function(e){for(var r=[],i=0,t=e;i<t.length;i++){var c=t[i];r.push(c.replace(/^\/+/,"").replace(/\/+$/,""))}return r.join("/")},e._initializationStatus$=new rxjs_1.BehaviorSubject(INITIALIZATION_STATUS.NOT_INITIALIZED),e}();exports.Partium=Partium;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@partium/js-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0-alpha1",
|
|
4
4
|
"author": "Partium Inc.",
|
|
5
5
|
"license": "(c) Partium Inc. 2020-2025. All rights reserved.",
|
|
6
6
|
"description": "SDK to provide Partium-Search features to JavaScript based applications.",
|