@partium/js-sdk 13.0.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/LICENSE.txt +100 -0
- package/README.md +18 -0
- package/core/constants/constants.d.ts +12 -0
- package/core/constants/constants.js +2 -0
- package/core/decorators/injection-identifier.d.ts +10 -0
- package/core/decorators/injection-identifier.js +2 -0
- package/core/factories/paginated-request-service.factory.d.ts +22 -0
- package/core/factories/paginated-request-service.factory.js +2 -0
- package/core/index.d.ts +47 -0
- package/core/index.js +2 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.d.ts +16 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +2 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.d.ts +35 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.d.ts +47 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/handle-axios-error-helper.d.ts +17 -0
- package/core/integration-defaults/http/handle-axios-error-helper.js +2 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +83 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +2 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.d.ts +85 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +2 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.d.ts +8 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +2 -0
- package/core/integration-defaults/js-p-file.d.ts +8 -0
- package/core/integration-defaults/js-p-file.js +2 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.d.ts +76 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.d.ts +28 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.d.ts +82 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +2 -0
- package/core/integration-defaults/web-device-status.service.d.ts +24 -0
- package/core/integration-defaults/web-device-status.service.js +2 -0
- package/core/integration-defaults/web-file.service.d.ts +9 -0
- package/core/integration-defaults/web-file.service.js +2 -0
- package/core/integration-defaults/web-indexeddb.service.d.ts +19 -0
- package/core/integration-defaults/web-indexeddb.service.js +2 -0
- package/core/integration-defaults/web-local-storage.service.d.ts +157 -0
- package/core/integration-defaults/web-local-storage.service.js +2 -0
- package/core/models/api-object.d.ts +7 -0
- package/core/models/api-object.js +2 -0
- package/core/models/auth-config.d.ts +38 -0
- package/core/models/auth-config.js +2 -0
- package/core/models/device-info.d.ts +62 -0
- package/core/models/device-info.js +2 -0
- package/core/models/error.d.ts +70 -0
- package/core/models/error.js +2 -0
- package/core/models/formatted-string.d.ts +9 -0
- package/core/models/formatted-string.js +2 -0
- package/core/models/i18n-map.d.ts +34 -0
- package/core/models/i18n-map.js +2 -0
- package/core/models/i18n-string.d.ts +8 -0
- package/core/models/i18n-string.js +2 -0
- package/core/models/log.d.ts +130 -0
- package/core/models/log.js +2 -0
- package/core/models/organization.d.ts +121 -0
- package/core/models/organization.js +2 -0
- package/core/models/p-file.d.ts +17 -0
- package/core/models/p-file.js +2 -0
- package/core/models/paginated-list.d.ts +23 -0
- package/core/models/paginated-list.js +2 -0
- package/core/models/partium-config.d.ts +31 -0
- package/core/models/partium-config.js +2 -0
- package/core/models/user-token.d.ts +16 -0
- package/core/models/user-token.js +2 -0
- package/core/models/user.d.ts +48 -0
- package/core/models/user.js +2 -0
- package/core/services/backend-status.service.d.ts +46 -0
- package/core/services/backend-status.service.js +2 -0
- package/core/services/base-login-init.service.d.ts +32 -0
- package/core/services/base-login-init.service.js +2 -0
- package/core/services/base.service.d.ts +31 -0
- package/core/services/base.service.js +2 -0
- package/core/services/device-status.service.interface.d.ts +36 -0
- package/core/services/device-status.service.interface.js +2 -0
- package/core/services/file.service.interface.d.ts +24 -0
- package/core/services/file.service.interface.js +2 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.d.ts +57 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.js +2 -0
- package/core/services/http/https-client/https-client.service.interface.d.ts +96 -0
- package/core/services/http/https-client/https-client.service.interface.js +2 -0
- package/core/services/http/https.service.interface.d.ts +164 -0
- package/core/services/http/https.service.interface.js +2 -0
- package/core/services/http/oauth-https.service.d.ts +120 -0
- package/core/services/http/oauth-https.service.js +2 -0
- package/core/services/local-storage.service.interface.d.ts +221 -0
- package/core/services/local-storage.service.interface.js +2 -0
- package/core/services/log.service.d.ts +48 -0
- package/core/services/log.service.js +2 -0
- package/core/services/organization.service.d.ts +48 -0
- package/core/services/organization.service.js +2 -0
- package/core/services/paginated-request.service.d.ts +104 -0
- package/core/services/paginated-request.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +59 -0
- package/core/services/recent-parts.service.js +2 -0
- package/core/services/service-provider.d.ts +58 -0
- package/core/services/service-provider.js +2 -0
- package/core/services/session/oauth-session.service.d.ts +76 -0
- package/core/services/session/oauth-session.service.js +2 -0
- package/core/services/session/session.service.interface.d.ts +138 -0
- package/core/services/session/session.service.interface.js +2 -0
- package/core/utils/general-helper.d.ts +35 -0
- package/core/utils/general-helper.js +2 -0
- package/data/index.d.ts +28 -0
- package/data/index.js +2 -0
- package/data/models/announcement.d.ts +30 -0
- package/data/models/announcement.js +2 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.d.ts +10 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.js +2 -0
- package/data/models/assembly-hierarchy-node.d.ts +16 -0
- package/data/models/assembly-hierarchy-node.js +2 -0
- package/data/models/attribute.d.ts +46 -0
- package/data/models/attribute.js +2 -0
- package/data/models/csa-request-search.d.ts +18 -0
- package/data/models/csa-request-search.js +2 -0
- package/data/models/csa-request-status.d.ts +16 -0
- package/data/models/csa-request-status.js +2 -0
- package/data/models/csa-request.d.ts +41 -0
- package/data/models/csa-request.js +2 -0
- package/data/models/document.d.ts +12 -0
- package/data/models/document.js +2 -0
- package/data/models/filter-key.d.ts +12 -0
- package/data/models/filter-key.js +2 -0
- package/data/models/filter-option-value.d.ts +18 -0
- package/data/models/filter-option-value.js +2 -0
- package/data/models/image.d.ts +36 -0
- package/data/models/image.js +2 -0
- package/data/models/inquiry.d.ts +32 -0
- package/data/models/inquiry.js +2 -0
- package/data/models/mounting-location.d.ts +32 -0
- package/data/models/mounting-location.js +2 -0
- package/data/models/multiple-expert-searches.d.ts +9 -0
- package/data/models/multiple-expert-searches.js +2 -0
- package/data/models/part-enrichment-data.d.ts +24 -0
- package/data/models/part-enrichment-data.js +2 -0
- package/data/models/part.d.ts +168 -0
- package/data/models/part.js +2 -0
- package/data/models/shopping-cart.d.ts +43 -0
- package/data/models/shopping-cart.js +2 -0
- package/data/services/announcement.service.d.ts +68 -0
- package/data/services/announcement.service.js +2 -0
- package/data/services/assembly-hierarchy-nodes.service.d.ts +113 -0
- package/data/services/assembly-hierarchy-nodes.service.js +2 -0
- package/data/services/csa-helper.service.d.ts +32 -0
- package/data/services/csa-helper.service.js +2 -0
- package/data/services/customer-service-assistance.service.d.ts +181 -0
- package/data/services/customer-service-assistance.service.js +2 -0
- package/data/services/filter.service.d.ts +97 -0
- package/data/services/filter.service.js +2 -0
- package/data/services/inquiry.service.d.ts +54 -0
- package/data/services/inquiry.service.js +2 -0
- package/data/services/part-attribute.service.d.ts +42 -0
- package/data/services/part-attribute.service.js +2 -0
- package/data/services/part-enrichment.service.d.ts +32 -0
- package/data/services/part-enrichment.service.js +2 -0
- package/data/services/part.service.d.ts +121 -0
- package/data/services/part.service.js +2 -0
- package/data/services/related-parts.service.d.ts +75 -0
- package/data/services/related-parts.service.js +2 -0
- package/data/services/shopping-cart.service.d.ts +150 -0
- package/data/services/shopping-cart.service.js +2 -0
- package/find/index.d.ts +35 -0
- package/find/index.js +2 -0
- package/find/models/assets/asset.d.ts +24 -0
- package/find/models/assets/asset.js +2 -0
- package/find/models/search-filter.d.ts +87 -0
- package/find/models/search-filter.js +2 -0
- package/find/models/search-input.d.ts +39 -0
- package/find/models/search-input.js +2 -0
- package/find/models/search-output.d.ts +10 -0
- package/find/models/search-output.js +2 -0
- package/find/models/search-result-status.d.ts +33 -0
- package/find/models/search-result-status.js +2 -0
- package/find/models/search-session-log-object.d.ts +16 -0
- package/find/models/search-session-log-object.js +2 -0
- package/find/models/search-status/cv-search-status.d.ts +20 -0
- package/find/models/search-status/cv-search-status.js +2 -0
- package/find/models/search-status/search-filter-status.d.ts +33 -0
- package/find/models/search-status/search-filter-status.js +2 -0
- package/find/models/search-status/search-status.d.ts +34 -0
- package/find/models/search-status/search-status.js +2 -0
- package/find/models/search-status/tag-search-status.d.ts +16 -0
- package/find/models/search-status/tag-search-status.js +2 -0
- package/find/models/search-status/text-search-status.d.ts +15 -0
- package/find/models/search-status/text-search-status.js +2 -0
- package/find/models/search-tag.d.ts +12 -0
- package/find/models/search-tag.js +2 -0
- package/find/models/smart-filter.d.ts +25 -0
- package/find/models/smart-filter.js +2 -0
- package/find/models/tagable/i18n-tagable.d.ts +10 -0
- package/find/models/tagable/i18n-tagable.js +2 -0
- package/find/models/tagable/tagable-base.d.ts +11 -0
- package/find/models/tagable/tagable-base.js +2 -0
- package/find/models/tagable/tagable.d.ts +10 -0
- package/find/models/tagable/tagable.js +2 -0
- package/find/models/text-search-config.d.ts +57 -0
- package/find/models/text-search-config.js +2 -0
- package/find/models/text-search-manipulator.d.ts +46 -0
- package/find/models/text-search-manipulator.js +2 -0
- package/find/models/text-search-result-item/text-search-error.d.ts +7 -0
- package/find/models/text-search-result-item/text-search-error.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-document.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-part.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item.d.ts +16 -0
- package/find/models/text-search-result-item/text-search-result-item.js +2 -0
- package/find/services/asset.service.d.ts +160 -0
- package/find/services/asset.service.js +2 -0
- package/find/services/filter-uploaders/filter-uploader.d.ts +13 -0
- package/find/services/filter-uploaders/filter-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +17 -0
- package/find/services/filter-uploaders/update-filters-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters.model.d.ts +19 -0
- package/find/services/filter-uploaders/update-filters.model.js +2 -0
- package/find/services/search/cv-search.service.d.ts +103 -0
- package/find/services/search/cv-search.service.js +2 -0
- package/find/services/search/recent-text-search-queries.service.d.ts +89 -0
- package/find/services/search/recent-text-search-queries.service.js +2 -0
- package/find/services/search/search-result.service.d.ts +142 -0
- package/find/services/search/search-result.service.js +2 -0
- package/find/services/search/search.service.d.ts +291 -0
- package/find/services/search/search.service.js +2 -0
- package/find/services/search/tag-search.service.d.ts +66 -0
- package/find/services/search/tag-search.service.js +2 -0
- package/find/services/search/text-search.service.d.ts +116 -0
- package/find/services/search/text-search.service.js +2 -0
- package/find/services/search-filter.service.d.ts +223 -0
- package/find/services/search-filter.service.js +2 -0
- package/find/utils/search-helper.d.ts +14 -0
- package/find/utils/search-helper.js +2 -0
- package/gen/sdk-version.d.ts +2 -0
- package/gen/sdk-version.js +2 -0
- package/index.d.ts +121 -0
- package/index.js +2 -0
- package/management/index.d.ts +5 -0
- package/management/index.js +2 -0
- package/management/models/api-key-list-response.d.ts +10 -0
- package/management/models/api-key-list-response.js +2 -0
- package/management/models/api-key-type.d.ts +5 -0
- package/management/models/api-key-type.js +2 -0
- package/management/models/api-key.d.ts +4 -0
- package/management/models/api-key.js +2 -0
- package/management/services/api-key.service.d.ts +39 -0
- package/management/services/api-key.service.js +2 -0
- package/ocr/index.d.ts +4 -0
- package/ocr/index.js +2 -0
- package/ocr/models/detect-response.d.ts +5 -0
- package/ocr/models/detect-response.js +2 -0
- package/ocr/models/detected-text-entry.d.ts +5 -0
- package/ocr/models/detected-text-entry.js +2 -0
- package/ocr/services/ocr.service.d.ts +36 -0
- package/ocr/services/ocr.service.js +2 -0
- package/package.json +45 -0
- package/user-data/index.d.ts +5 -0
- package/user-data/index.js +2 -0
- package/user-data/models/part-with-nullable.d.ts +5 -0
- package/user-data/models/part-with-nullable.js +2 -0
- package/user-data/models/request-list/request-list.d.ts +16 -0
- package/user-data/models/request-list/request-list.js +2 -0
- package/user-data/services/favorite/favorite.service.d.ts +45 -0
- package/user-data/services/favorite/favorite.service.js +2 -0
- package/user-data/services/request-list/request-list.service.d.ts +97 -0
- package/user-data/services/request-list/request-list.service.js +2 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ServiceProvider } from './service-provider';
|
|
4
|
+
import { PartiumConfig } from '../models/partium-config';
|
|
5
|
+
import { BaseLoginInitService } from './base-login-init.service';
|
|
6
|
+
import { Organization } from '../models/organization';
|
|
7
|
+
/**
|
|
8
|
+
* Service that provides functionality to locally store and retrieve a list of recently viewed parts.
|
|
9
|
+
* The max length of the list can be controlled with the maxPartHistoryLength parameter passed in the Partium config in init.
|
|
10
|
+
* (only part-ids are stored)
|
|
11
|
+
*/
|
|
12
|
+
export interface RecentPartsService {
|
|
13
|
+
/**
|
|
14
|
+
* Adds a part to the recent part list
|
|
15
|
+
* This adds the part to the beginning of the recent parts list. If the part was already contained in the list it is moved to the beginning
|
|
16
|
+
*
|
|
17
|
+
* @param partiumPartId id of the recent part
|
|
18
|
+
*/
|
|
19
|
+
addRecentPart(partiumPartId: string): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the recent parts partium-ids as array.
|
|
22
|
+
* It is sorted by when it was added, the first item is the most recent one.
|
|
23
|
+
*
|
|
24
|
+
* @return observable that resolves with the array of recent parts partiumIds
|
|
25
|
+
*/
|
|
26
|
+
getRecentParts(): Observable<string[]>;
|
|
27
|
+
}
|
|
28
|
+
export declare class RecentPartsServiceImpl extends BaseLoginInitService implements RecentPartsService {
|
|
29
|
+
private localStorageService;
|
|
30
|
+
private initialized;
|
|
31
|
+
private initialized$;
|
|
32
|
+
private recentPartIds$;
|
|
33
|
+
private maxPartHistoryLength;
|
|
34
|
+
constructor(serviceProvider: ServiceProvider);
|
|
35
|
+
onCreate(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Initializes the RecentPartsService: Loads the recent parts from the localstorage
|
|
38
|
+
* and configures the service based on the passed Partium configuration.
|
|
39
|
+
*
|
|
40
|
+
* Note: Should be called at the start of a session
|
|
41
|
+
* to ensure the correct recent parts are loaded
|
|
42
|
+
*/
|
|
43
|
+
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
44
|
+
addRecentPart(partiumPartId: string): Promise<void>;
|
|
45
|
+
private saveToLocalStorage;
|
|
46
|
+
getRecentParts(): Observable<string[]>;
|
|
47
|
+
private loadRecentPartIds;
|
|
48
|
+
/**
|
|
49
|
+
* Loads the recent parts from local storage and returns them.
|
|
50
|
+
*
|
|
51
|
+
* @return array that contains the ids of the recent parts loaded from the localstorage
|
|
52
|
+
*/
|
|
53
|
+
private getRecentPartIdsFromLocalStorage;
|
|
54
|
+
/**
|
|
55
|
+
* Clear memory (not storage)
|
|
56
|
+
* Called on logout.
|
|
57
|
+
*/
|
|
58
|
+
reset(): void;
|
|
59
|
+
}
|
|
@@ -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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__decorate=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RecentPartsServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../decorators/injection-identifier"),session_service_interface_1=require("./session/session.service.interface"),local_storage_service_interface_1=require("./local-storage.service.interface"),base_login_init_service_1=require("./base-login-init.service"),RecentPartsServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.initialized$=new Promise((function(e,t){r.initialized=e})),r.recentPartIds$=new rxjs_1.BehaviorSubject([]),r}return __extends(t,e),t.prototype.onCreate=function(){var e=this;this.localStorageService=this.serviceProvider.getService(local_storage_service_interface_1.LocalStorageService),this.serviceProvider.getService(session_service_interface_1.SessionService).getSessionStatusEvents().subscribe((function(t){t===session_service_interface_1.SESSION_STATUS_EVENT.SESSION_ENDED&&e.reset()}))},t.prototype.init=function(t,r,n){var i=this;return e.prototype.init.call(this,t,r,n),this.maxPartHistoryLength=t.recentPartsMaxPartHistoryLength,this.currentOrganization$.pipe((0,operators_1.filter)((function(e){return!!e})),(0,operators_1.skip)(1),(0,operators_1.distinctUntilChanged)()).subscribe((function(){i.loadRecentPartIds()})),(0,rxjs_1.defer)((function(){return i.loadRecentPartIds()})).pipe((0,operators_1.map)((function(){i.initialized()})))},t.prototype.addRecentPart=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this.getRecentPartIdsFromLocalStorage()];case 1:return(t=(t=r.sent()).filter((function(t){return t!==e}))).unshift(e),t=t.splice(0,this.maxPartHistoryLength),[4,this.saveToLocalStorage(t)];case 2:return r.sent(),this.recentPartIds$.next(t),[2]}}))}))},t.prototype.saveToLocalStorage=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.localStorageService.setItem("RECENT_PARTS_IDS",JSON.stringify(e||[]))]}))}))},t.prototype.getRecentParts=function(){var e=this;return(0,rxjs_1.from)(this.initialized$).pipe((0,operators_1.mergeMap)((function(){return e.recentPartIds$.asObservable()})))},t.prototype.loadRecentPartIds=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getRecentPartIdsFromLocalStorage()];case 1:return e=t.sent(),this.recentPartIds$.next(e),[2]}}))}))},t.prototype.getRecentPartIdsFromLocalStorage=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this.localStorageService.getItem("RECENT_PARTS_IDS")];case 1:return(e=r.sent())?!(t=JSON.parse(e))||t.length<1?[2,[]]:[2,t]:[2,[]]}}))}))},t.prototype.reset=function(){this.recentPartIds$.next([])},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("RecentPartsService")],t)}(base_login_init_service_1.BaseLoginInitService);exports.RecentPartsServiceImpl=RecentPartsServiceImpl;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { BaseService, BaseServiceClass } from './base.service';
|
|
3
|
+
/**
|
|
4
|
+
* Manages and provides all services as singletons.
|
|
5
|
+
* If a certain Service is needed somewhere it can be requested here if it is already existing,
|
|
6
|
+
* the instance is returned, or if not a new instance is generated.
|
|
7
|
+
*
|
|
8
|
+
* This Service operates in two stages:
|
|
9
|
+
* 1) In the first stage useService can be called, in order to choose which service to use for certain interfaces (eg: HttpsService)
|
|
10
|
+
* 2) In the second phase services can be retrieved or created, but not via useService() anymore
|
|
11
|
+
* This is required, because services cross-reference each other and this can cause to inconsistencies, especially with services
|
|
12
|
+
* that are instantiated via useService, such as HttpsService.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ServiceProvider {
|
|
15
|
+
private services;
|
|
16
|
+
private useServicePhaseEnded;
|
|
17
|
+
/**
|
|
18
|
+
* Get the singleton instance of a certain service class
|
|
19
|
+
*
|
|
20
|
+
* @param serviceClass the Service-class to get an instance of
|
|
21
|
+
* @returns Promise that resoles with singleton instance of the requested service
|
|
22
|
+
*/
|
|
23
|
+
getService<S extends BaseService>(serviceClass: BaseServiceClass<S>): S;
|
|
24
|
+
/**
|
|
25
|
+
* Allow to select one specific service out of alternative options.
|
|
26
|
+
* eg: HttpsService: There are multiple alternative Https-service,
|
|
27
|
+
* which the user of the api can choose from. This function allows
|
|
28
|
+
* to choose one and use it over the whole plugin with the unified
|
|
29
|
+
* name of it's ancestor.
|
|
30
|
+
*
|
|
31
|
+
* eg: serviceProvider.useService( HttpsServiceApiKey, HttpsService )
|
|
32
|
+
* -> later this can be referred to via serviceProvider.getService( HttpsService )
|
|
33
|
+
*
|
|
34
|
+
* @param serviceClass the Service-class to use
|
|
35
|
+
* @param useFor the super-class to "replace" with
|
|
36
|
+
*/
|
|
37
|
+
useService<S extends BaseService, T extends BaseService>(serviceClass: BaseServiceClass<S>, useFor: BaseServiceClass<T>, ...initArgs: any[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Allows to set an instance for a specified service class
|
|
40
|
+
* This can be for example used for setting mocked services in the context of tests
|
|
41
|
+
*
|
|
42
|
+
* eg: serviceProvider.setService( { ..mocked object }, HttpsService )
|
|
43
|
+
*
|
|
44
|
+
* @param serviceInstance the service instance to use
|
|
45
|
+
* @param useFor the super-class to "replace" with the service instance
|
|
46
|
+
*/
|
|
47
|
+
setService<S extends BaseService, T extends BaseService>(serviceInstance: S, useFor: BaseServiceClass<T>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Call this function when all useService-calls are done to close the 1st stage and allow to use the
|
|
50
|
+
* getService method.
|
|
51
|
+
*/
|
|
52
|
+
serviceSelectionFinished(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Reset the state of the provider to the initial state.
|
|
55
|
+
* (Mainly used for tests)
|
|
56
|
+
*/
|
|
57
|
+
reset(): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||2===arguments.length)for(var r,s=0,n=i.length;s<n;s++)!r&&s in i||(r||(r=Array.prototype.slice.call(i,0,s)),r[s]=i[s]);return e.concat(r||Array.prototype.slice.call(i))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServiceProvider=void 0;var ServiceProvider=function(){function e(){this.services={},this.useServicePhaseEnded=!1}return e.prototype.getService=function(e){if(!this.serviceSelectionFinished)throw"Can not retrieve service, because service-selection with useService is not yet finished. Call serviceSelectionFinished to end this phase.";return this.services[e.getInjectionIdentifierName()]||(this.services[e.getInjectionIdentifierName()]=new e(this),this.useServicePhaseEnded&&this.services[e.getInjectionIdentifierName()].onCreate()),this.services[e.getInjectionIdentifierName()]},e.prototype.useService=function(e,i){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(this.useServicePhaseEnded)throw"You can not call useService after calling serviceSelectionFinished";this.services[i.getInjectionIdentifierName()]=new(e.bind.apply(e,__spreadArray([void 0,this],t,!1)))},e.prototype.setService=function(e,i){if(this.useServicePhaseEnded)throw"You can not call setService after calling serviceSelectionFinished";this.services[i.getInjectionIdentifierName()]=e},e.prototype.serviceSelectionFinished=function(){if(!this.useServicePhaseEnded){this.useServicePhaseEnded=!0;for(var e=0,i=Object.keys(this.services);e<i.length;e++){var t=i[e];this.services[t].onCreate()}}},e.prototype.reset=function(){this.services={},this.useServicePhaseEnded=!1},e}();exports.ServiceProvider=ServiceProvider;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { SessionService, LoginConfig } from './session.service.interface';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { ServiceProvider } from '../service-provider';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration that is needed for oauth login.
|
|
7
|
+
*/
|
|
8
|
+
export declare class OauthLoginConfig extends LoginConfig {
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
activeSession?: OauthStatus;
|
|
11
|
+
constructor(init?: Partial<OauthLoginConfig>);
|
|
12
|
+
}
|
|
13
|
+
export declare class OauthStatus {
|
|
14
|
+
accessToken: string;
|
|
15
|
+
accessTokenExpiration: Date;
|
|
16
|
+
accessTokenCreateDate: Date;
|
|
17
|
+
authenticated: boolean;
|
|
18
|
+
refreshToken: string;
|
|
19
|
+
constructor(init?: Partial<OauthStatus>);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Oauth specific extension of the SessionService, that provides functions
|
|
23
|
+
* for oauth-authentication.
|
|
24
|
+
* The implementations of this interface will be based on the chosen
|
|
25
|
+
* platform that is used in the application,
|
|
26
|
+
*
|
|
27
|
+
* An implementation of this service is required and has to be configured during
|
|
28
|
+
* the initialization phase of Partium.
|
|
29
|
+
*
|
|
30
|
+
* This class file is called interface, even though it is not an interface,
|
|
31
|
+
* but we need it to be a concrete class for the serviceProvider.
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class OauthSessionService extends SessionService {
|
|
34
|
+
private httpsServiceOauth;
|
|
35
|
+
constructor(serviceProvider: ServiceProvider);
|
|
36
|
+
onCreate(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the current OauthState by returning the OauthStatus object.
|
|
39
|
+
*
|
|
40
|
+
* @abstract
|
|
41
|
+
* @returns {Observable<OauthStatus>}
|
|
42
|
+
*/
|
|
43
|
+
abstract getStatus(): Observable<OauthStatus>;
|
|
44
|
+
/**
|
|
45
|
+
* Log in the user and will resolve on success, throw an error otherwise
|
|
46
|
+
* If an apiKey is passed in the config, the login should be done automatically,
|
|
47
|
+
* otherwise the user should be prompted to enter login credentials.
|
|
48
|
+
*
|
|
49
|
+
* Make sure to call this.sessionSetup() on successful login, to prepare
|
|
50
|
+
* the current session.
|
|
51
|
+
*
|
|
52
|
+
* Method should be overridden by child-class
|
|
53
|
+
*
|
|
54
|
+
* @param config the LoginConfiguration
|
|
55
|
+
* @returns {Observable<void>}
|
|
56
|
+
*/
|
|
57
|
+
login(config: OauthLoginConfig): Observable<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Refresh the token using the refreshToken. As login, will resolve on success or throw otherwise
|
|
60
|
+
*
|
|
61
|
+
* Method should be overridden by child-class
|
|
62
|
+
*/
|
|
63
|
+
refresh(): Observable<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Logout the user and remove all locally stored information. Next login should require the user to enter the credentials
|
|
66
|
+
*
|
|
67
|
+
* Method should be overridden by child-class
|
|
68
|
+
*
|
|
69
|
+
* @returns {Observable<void>}
|
|
70
|
+
*/
|
|
71
|
+
logout(): Observable<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Update the oauth token in the oauth https service whenever it changes.
|
|
74
|
+
*/
|
|
75
|
+
protected tokenUpdated(newToken: string, tokenExpiresAt: Date): void;
|
|
76
|
+
}
|
|
@@ -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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.OauthSessionService=exports.OauthStatus=exports.OauthLoginConfig=void 0;var session_service_interface_1=require("./session.service.interface"),https_service_interface_1=require("../http/https.service.interface"),OauthLoginConfig=function(e){function t(t){var r=e.call(this)||this;return Object.assign(r,t),r}return __extends(t,e),t}(session_service_interface_1.LoginConfig);exports.OauthLoginConfig=OauthLoginConfig;var OauthStatus=function(e){Object.assign(this,e)};exports.OauthStatus=OauthStatus;var OauthSessionService=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsServiceOauth=this.serviceProvider.getService(https_service_interface_1.HttpsService)},t.prototype.login=function(e){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.refresh=function(){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.logout=function(){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.tokenUpdated=function(e,t){this.httpsServiceOauth.setToken(e,t)},t}(session_service_interface_1.SessionService);exports.OauthSessionService=OauthSessionService;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
import { AuthenticationConfig } from '../../models/auth-config';
|
|
4
|
+
import { PartiumConfig } from '../../models/partium-config';
|
|
5
|
+
import { User } from '../../models/user';
|
|
6
|
+
import { BaseLoginInitService } from '../base-login-init.service';
|
|
7
|
+
import { BaseService } from '../base.service';
|
|
8
|
+
import { ServiceProvider } from '../service-provider';
|
|
9
|
+
import { EventContext } from '../../models/log';
|
|
10
|
+
import { Organization } from '../../models/organization';
|
|
11
|
+
export declare enum SESSION_STATUS_EVENT {
|
|
12
|
+
SESSION_STARTED = 0,
|
|
13
|
+
SESSION_ENDED = 1
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Login-Configuration, such as username and password, or api-key
|
|
17
|
+
*/
|
|
18
|
+
export declare class LoginConfig {
|
|
19
|
+
}
|
|
20
|
+
export interface SessionEventContext extends EventContext {
|
|
21
|
+
languageUi?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Defines the structure of a session-service implementation.
|
|
25
|
+
* It contains functions that are required for handling user sessions and
|
|
26
|
+
* authentication-mechanisms.
|
|
27
|
+
* The implementations of this interface will be based on the chosen
|
|
28
|
+
* authentication method and platform that is used in the application,
|
|
29
|
+
*
|
|
30
|
+
* An implementation of this service is required and has to be configured during
|
|
31
|
+
* the initialization phase of Partium.
|
|
32
|
+
*
|
|
33
|
+
* This class file is called interface, even though it is not an interface,
|
|
34
|
+
* but we need it to be a concrete class for the serviceProvider.
|
|
35
|
+
*/
|
|
36
|
+
export declare class SessionService extends BaseService {
|
|
37
|
+
private organizationService;
|
|
38
|
+
private localStorageService;
|
|
39
|
+
private user;
|
|
40
|
+
protected authenticationConfig: AuthenticationConfig;
|
|
41
|
+
private partiumConfig;
|
|
42
|
+
protected sessionStatus$: BehaviorSubject<SESSION_STATUS_EVENT>;
|
|
43
|
+
private currentOrganization$;
|
|
44
|
+
private servicesToInitDuringLogin;
|
|
45
|
+
constructor(serviceProvider: ServiceProvider);
|
|
46
|
+
/**
|
|
47
|
+
* Called by HttpsService to pass config info
|
|
48
|
+
*
|
|
49
|
+
* @param config the Partium configuration
|
|
50
|
+
*/
|
|
51
|
+
init(config: PartiumConfig): Observable<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Login user based on the given configuration.
|
|
54
|
+
*
|
|
55
|
+
* Method should be overridden by child-class
|
|
56
|
+
*
|
|
57
|
+
* @param config the login configuration, which differs per authentication-method
|
|
58
|
+
*/
|
|
59
|
+
login(config: LoginConfig): Observable<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Logout currently logged in user
|
|
62
|
+
*
|
|
63
|
+
* Method should be overridden by child-class
|
|
64
|
+
*/
|
|
65
|
+
logout(): Observable<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Returns an Observable that always emits an event when a session has just
|
|
68
|
+
* started or ended.
|
|
69
|
+
*/
|
|
70
|
+
getSessionStatusEvents(): Observable<SESSION_STATUS_EVENT>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the currently configured authentication configuration
|
|
73
|
+
*
|
|
74
|
+
* @returns the authentication configuration
|
|
75
|
+
*/
|
|
76
|
+
getAuthConfig(): AuthenticationConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Set the user-object of the currently logged in user.
|
|
79
|
+
* This class should be called by any of the deriving classes.
|
|
80
|
+
*
|
|
81
|
+
* @param user the currently logged in user
|
|
82
|
+
*/
|
|
83
|
+
protected setUser(user: User): void;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve the currently logged in user
|
|
86
|
+
*
|
|
87
|
+
* @returns the currently logged in user
|
|
88
|
+
*/
|
|
89
|
+
getUser(): User;
|
|
90
|
+
/**
|
|
91
|
+
* Set organization with the given identifier as the current organization to be used in the session.
|
|
92
|
+
*
|
|
93
|
+
* @param organizationIdentifier can be organization-id or organization-name
|
|
94
|
+
* @returns void if organization is found, otherwise throws an error
|
|
95
|
+
*/
|
|
96
|
+
useOrganization(organizationIdentifier: string): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Get an observable that always emits when the currently selected organization changed.
|
|
99
|
+
*
|
|
100
|
+
* @returns Observable, emitting the currently used organization.
|
|
101
|
+
*/
|
|
102
|
+
getCurrentOrganization$(): Observable<Organization | undefined>;
|
|
103
|
+
/**
|
|
104
|
+
* Register a service to be initialized during login-process.
|
|
105
|
+
* The passed service must extend the BaseLoginInitService and implement an init-function,
|
|
106
|
+
* that returns an Observable, that resolves, when the initialization was finished successfully
|
|
107
|
+
*
|
|
108
|
+
* @param service the service to init during login
|
|
109
|
+
* @param priority services with lower prio will be initialized first. Services with the same prio will be initialized in parallel. Can be used if there are dependencies between the services.
|
|
110
|
+
*/
|
|
111
|
+
registerLoginInitService(service: BaseLoginInitService, priority?: number): void;
|
|
112
|
+
/**
|
|
113
|
+
* Needs to be called during the login-process, after the user is authenticated,
|
|
114
|
+
* to download and prepare all the data needed in the session.
|
|
115
|
+
*
|
|
116
|
+
* @param eventContext (optional) additional event context for event logs emitted during session setup
|
|
117
|
+
*/
|
|
118
|
+
protected sessionSetup(eventContext?: SessionEventContext): Observable<void>;
|
|
119
|
+
private logUserSessionInfoEvent;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the passed languageUiCandidate if it is valid for the organization config.
|
|
122
|
+
* Returns null if invalid.
|
|
123
|
+
*/
|
|
124
|
+
private getValidLanguageUiForEvent;
|
|
125
|
+
/**
|
|
126
|
+
* Needs to be called when a session ended,
|
|
127
|
+
* to notify other services that need to tear down.
|
|
128
|
+
*/
|
|
129
|
+
protected sessionEnded(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Initializes all services, which are registered for initialization during login.
|
|
132
|
+
* First all services with priority 1 will be registered in parallel, then all services with priority 2, and so on.
|
|
133
|
+
*
|
|
134
|
+
* @returns Observable that resolves once all services have been initialized.
|
|
135
|
+
*/
|
|
136
|
+
private initializeRegisteredServices;
|
|
137
|
+
private getFlattenedOrganizations;
|
|
138
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
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 i(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}(),__decorate=this&&this.__decorate||function(e,r,t,i){var n,o=arguments.length,s=o<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(r,t,s):n(r,t))||s);return o>3&&s&&Object.defineProperty(r,t,s),s},__awaiter=this&&this.__awaiter||function(e,r,t,i){return new(t||(t=Promise))((function(n,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(s,a)}c((i=i.apply(e,r||[])).next())}))},__generator=this&&this.__generator||function(e,r){var t,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(t=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e],i=0}finally{t=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},__spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var i,n=0,o=r.length;n<o;n++)!i&&n in r||(i||(i=Array.prototype.slice.call(r,0,n)),i[n]=r[n]);return e.concat(i||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionService=exports.LoginConfig=exports.SESSION_STATUS_EVENT=void 0;var SESSION_STATUS_EVENT,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../../decorators/injection-identifier"),base_service_1=require("../base.service"),organization_service_1=require("../organization.service"),log_1=require("../../models/log"),log_service_1=require("../log.service"),device_status_service_interface_1=require("../device-status.service.interface"),sdk_version_1=require("../../../gen/sdk-version"),error_1=require("../../models/error"),local_storage_service_interface_1=require("../local-storage.service.interface");!function(e){e[e.SESSION_STARTED=0]="SESSION_STARTED",e[e.SESSION_ENDED=1]="SESSION_ENDED"}(SESSION_STATUS_EVENT||(exports.SESSION_STATUS_EVENT=SESSION_STATUS_EVENT={}));var LoginConfig=function(){};exports.LoginConfig=LoginConfig;var SessionService=function(e){function r(r){var t=e.call(this,r)||this;return t.currentOrganization$=new rxjs_1.BehaviorSubject(void 0),t.servicesToInitDuringLogin=[],t.sessionStatus$=new rxjs_1.BehaviorSubject(null),t}return __extends(r,e),r.prototype.init=function(e){var r=this;return new rxjs_1.Observable((function(t){r.authenticationConfig=e.authenticationConfig,r.partiumConfig=e,t.next(),t.complete()}))},r.prototype.login=function(e){throw new Error("In order to use the SessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},r.prototype.logout=function(){throw new Error("In order to use the SessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},r.prototype.getSessionStatusEvents=function(){return this.sessionStatus$.asObservable()},r.prototype.getAuthConfig=function(){return this.authenticationConfig},r.prototype.setUser=function(e){this.user=e},r.prototype.getUser=function(){return this.user},r.prototype.useOrganization=function(e){return __awaiter(this,void 0,void 0,(function(){var r,t,i,n,o;return __generator(this,(function(s){switch(s.label){case 0:return[4,this.organizationService.getOrganizations()];case 1:for(r=s.sent(),t=this.getFlattenedOrganizations(r),i=0,n=t;i<n.length;i++)if((o=n[i]).partiumId===e||o.name===e)return this.currentOrganization$.next(o),this.localStorageService.setItem("lastUsedOrganizationId",o.partiumId,{organizationName:!1,userEmail:!1}),[2];throw new error_1.SdkError(error_1.SDK_ERROR_CODES.ORGANIZATION_NOT_FOUND,{organizationIdentifier:e},"Could not find organization with id/name ".concat(e))}}))}))},r.prototype.getCurrentOrganization$=function(){return this.currentOrganization$.asObservable()},r.prototype.registerLoginInitService=function(e,r){void 0===r&&(r=100),this.servicesToInitDuringLogin.push({service:e,priority:r})},r.prototype.sessionSetup=function(e){var r=this;this.organizationService=this.serviceProvider.getService(organization_service_1.OrganizationService),this.localStorageService=this.serviceProvider.getService(local_storage_service_interface_1.LocalStorageService);var t=this.serviceProvider.getService(log_service_1.LogServiceImpl),i=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService);return(0,rxjs_1.from)(Promise.all([this.localStorageService.getItem("lastUsedOrganizationId",{organizationName:!1,userEmail:!1}),this.organizationService.init().then((function(){return r.organizationService.getOrganizations()}))])).pipe((0,operators_1.mergeMap)((function(e){var t=e[0],i=e[1];if(t){var n=r.getFlattenedOrganizations(i).find((function(e){return e.partiumId===t}));if(n&&!n.requiresAdditionalAuthentication)return(0,rxjs_1.of)(n)}return(0,rxjs_1.from)(r.organizationService.getFirstOrganization())})),(0,operators_1.map)((function(e){return r.currentOrganization$.next(e),e})),(0,operators_1.mergeMap)((function(n){return r.initializeRegisteredServices().pipe((0,operators_1.mergeMap)((function(){return(0,rxjs_1.from)(i.getDeviceInfo()).pipe((0,operators_1.tap)((function(i){r.logUserSessionInfoEvent(i,t,n,e)})))})))})),(0,operators_1.map)((function(){r.sessionStatus$.next(SESSION_STATUS_EVENT.SESSION_STARTED)})),(0,operators_1.catchError)((function(e){return r.logout().subscribe(),(0,rxjs_1.throwError)(e)})))},r.prototype.logUserSessionInfoEvent=function(e,r,t,i){var n=this.getValidLanguageUiForEvent(t,null==i?void 0:i.languageUi),o={deviceId:e.deviceId,manufacturer:e.manufacturer,model:e.model,os:e.os,osVersion:e.osVersion,deviceType:e.deviceType,deviceLanguage:e.deviceLanguage,appVersionCode:e.appVersionCode,appVersionName:e.appVersionName,partiumSdkVersion:sdk_version_1.SDK_VERSION_NUMBER,languageUi:n,browserName:e.browserName,browserVersion:e.browserVersion,cpuArchitecture:e.cpuArchitecture,engineName:e.engineName,engineVersion:e.engineVersion};r.logEvent(new log_1.EventLog({organizationId:t.partiumId,version:log_1.EVENTLOG_VERSIONS.V_2_0_0,interface:(null==i?void 0:i.eventInterface)||log_1.INTERFACE.API_ACCESS,event:log_1.EVENT.USER_SESSION_INFO,data:o})).subscribe({next:function(){},error:function(e){console.error("Error while sending log event ".concat(log_1.EVENT.USER_SESSION_INFO,": "),e)}})},r.prototype.getValidLanguageUiForEvent=function(e,r){var t;if(r&&((null===(t=e.config)||void 0===t?void 0:t.availableUiLanguages)||["en"]).includes(r))return r;return null},r.prototype.sessionEnded=function(){this.sessionStatus$.next(SESSION_STATUS_EVENT.SESSION_ENDED)},r.prototype.initializeRegisteredServices=function(){for(var e=this,r=this.servicesToInitDuringLogin.sort((function(e,r){return e.priority-r.priority})),t=[],i=-1,n=0;n<r.length;n++){var o=r[n];o.priority===i?t[t.length-1].push(o.service):(i=o.priority,t.push([o.service]))}return rxjs_1.concat.apply(void 0,t.map((function(r){return(0,rxjs_1.forkJoin)(r.map((function(r){return r.init(e.partiumConfig,e.user.email,e.getCurrentOrganization$())})))}))).pipe((0,operators_1.last)())},r.prototype.getFlattenedOrganizations=function(e){return e.reduce((function(e,r){return __spreadArray(__spreadArray(__spreadArray([],e,!0),[r],!1),r.subOrgs||[],!0)}),[])},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("SessionService")],r)}(base_service_1.BaseService);exports.SessionService=SessionService;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* Converts camel case to snake case
|
|
4
|
+
*
|
|
5
|
+
* @param data object with properties in camel case format
|
|
6
|
+
* @returns object in snake case format
|
|
7
|
+
*/
|
|
8
|
+
export declare const camelToSnake: (data: {}) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Converts snake case to camel case
|
|
11
|
+
*
|
|
12
|
+
* @param data object with properties in snake case format
|
|
13
|
+
* @returns object in camel case format
|
|
14
|
+
*/
|
|
15
|
+
export declare const snakeToCamelCase: (data: {}) => any;
|
|
16
|
+
/**
|
|
17
|
+
* Add url parameters to the given url and return it as string.
|
|
18
|
+
* If one of the parameter already exists, it will be added another time.
|
|
19
|
+
* If an object of the array contains multiple params, all are added.
|
|
20
|
+
*
|
|
21
|
+
* @param url the url to add the parameters to
|
|
22
|
+
* @param paramObjects array of objects with parameters that should be appended, eg: [{ pageNumber: 4 }]
|
|
23
|
+
* @returns the given url with the appended parameters
|
|
24
|
+
*/
|
|
25
|
+
export declare const addUrlParameters: (url: string, paramObjects: Array<Object>) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Add an url parameter to the given url and return it as string.
|
|
28
|
+
* If the same parameter already exists, it will be added another time.
|
|
29
|
+
* If an object of the array contains multiple params, all are added.
|
|
30
|
+
*
|
|
31
|
+
* @param url the url to add the parameter to
|
|
32
|
+
* @param paramObject the object with one or more params to append, eg: { pageNumber: 4 }
|
|
33
|
+
* @returns the given url with the appended parameter
|
|
34
|
+
*/
|
|
35
|
+
export declare const addUrlParameter: (url: string, paramObject: Object) => string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addUrlParameter=exports.addUrlParameters=exports.snakeToCamelCase=exports.camelToSnake=void 0;var camelToSnake=function(e){var r={};return Object.keys(e).forEach((function(a){var t=a.replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())}));if(r[t]=e[a],Array.isArray(e[t])){var n=e[t];n=n.map((function(e){return e&&"object"==typeof e&&e.constructor===Object?(0,exports.camelToSnake)(e):e})),r[t]=n}})),r};exports.camelToSnake=camelToSnake;var snakeToCamelCase=function(e){var r={};return Object.keys(e).forEach((function(a){var t=a.toLowerCase().replace(/([-_][a-z])/g,(function(e){return e.toUpperCase().replace("-","").replace("_","")}));if(r[t]=e[a],Array.isArray(e[t])){var n=e[t];n=n.map((function(e){return e&&"object"==typeof e&&e.constructor===Object?(0,exports.snakeToCamelCase)(e):e})),r[t]=n}})),r};exports.snakeToCamelCase=snakeToCamelCase;var addUrlParameters=function(e,r){if(!r||r.length<1)return e;for(var a=0,t=r;a<t.length;a++){var n=t[a];e=(0,exports.addUrlParameter)(e,n)}return e};exports.addUrlParameters=addUrlParameters;var addUrlParameter=function(e,r){if(!r)return e;var a=e.split("?"),t=a[0],n=[];a.length>1&&(n=a[1].split("&").map((function(e){return e.split("=")})));for(var o=0,c=Object.keys(r);o<c.length;o++){var s=c[o],l=r[s];null!=l&&(s=encodeURIComponent(s),l=encodeURIComponent(l),n.push([s,l]))}var p=n.map((function(e){return e.join("=")}));return p.length>0?"".concat(t,"?").concat(p.join("&")):t};exports.addUrlParameter=addUrlParameter;
|
package/data/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
export * from './models/part';
|
|
3
|
+
export * from './models/document';
|
|
4
|
+
export * from './models/assembly-hierarchy-node';
|
|
5
|
+
export * from './models/assembly-hierarchy-node-breadcrumb';
|
|
6
|
+
export * from './models/image';
|
|
7
|
+
export * from './models/attribute';
|
|
8
|
+
export * from './models/csa-request';
|
|
9
|
+
export * from './models/csa-request-status';
|
|
10
|
+
export * from './models/filter-key';
|
|
11
|
+
export * from './models/filter-option-value';
|
|
12
|
+
export * from './models/shopping-cart';
|
|
13
|
+
export * from './models/multiple-expert-searches';
|
|
14
|
+
export * from './models/csa-request-search';
|
|
15
|
+
export * from './models/announcement';
|
|
16
|
+
export * from './models/inquiry';
|
|
17
|
+
export * from './models/mounting-location';
|
|
18
|
+
export * from './models/part-enrichment-data';
|
|
19
|
+
export * from './services/part.service';
|
|
20
|
+
export * from './services/part-enrichment.service';
|
|
21
|
+
export * from './services/related-parts.service';
|
|
22
|
+
export * from './services/assembly-hierarchy-nodes.service';
|
|
23
|
+
export * from './services/part-attribute.service';
|
|
24
|
+
export * from './services/customer-service-assistance.service';
|
|
25
|
+
export * from './services/filter.service';
|
|
26
|
+
export * from './services/shopping-cart.service';
|
|
27
|
+
export * from './services/inquiry.service';
|
|
28
|
+
export * from './services/announcement.service';
|
package/data/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,r,t,s){void 0===s&&(s=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,s,o)}:function(e,r,t,s){void 0===s&&(s=t),e[s]=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/part"),exports),__exportStar(require("./models/document"),exports),__exportStar(require("./models/assembly-hierarchy-node"),exports),__exportStar(require("./models/assembly-hierarchy-node-breadcrumb"),exports),__exportStar(require("./models/image"),exports),__exportStar(require("./models/attribute"),exports),__exportStar(require("./models/csa-request"),exports),__exportStar(require("./models/csa-request-status"),exports),__exportStar(require("./models/filter-key"),exports),__exportStar(require("./models/filter-option-value"),exports),__exportStar(require("./models/shopping-cart"),exports),__exportStar(require("./models/multiple-expert-searches"),exports),__exportStar(require("./models/csa-request-search"),exports),__exportStar(require("./models/announcement"),exports),__exportStar(require("./models/inquiry"),exports),__exportStar(require("./models/mounting-location"),exports),__exportStar(require("./models/part-enrichment-data"),exports),__exportStar(require("./services/part.service"),exports),__exportStar(require("./services/part-enrichment.service"),exports),__exportStar(require("./services/related-parts.service"),exports),__exportStar(require("./services/assembly-hierarchy-nodes.service"),exports),__exportStar(require("./services/part-attribute.service"),exports),__exportStar(require("./services/customer-service-assistance.service"),exports),__exportStar(require("./services/filter.service"),exports),__exportStar(require("./services/shopping-cart.service"),exports),__exportStar(require("./services/inquiry.service"),exports),__exportStar(require("./services/announcement.service"),exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { APIObject } from '../../core';
|
|
3
|
+
export declare enum ANNOUNCEMENTS_STATUS {
|
|
4
|
+
PUBLISHED = "PUBLISHED",
|
|
5
|
+
UNPUBLISHED = "UNPUBLISHED",
|
|
6
|
+
UNPUBLISHED_CHANGES = "UNPUBLISHED CHANGES"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ANNOUNCEMENT_TYPE {
|
|
9
|
+
APP = "app",
|
|
10
|
+
COMPANY = "company"
|
|
11
|
+
}
|
|
12
|
+
export declare class AnnouncementRecipient extends APIObject {
|
|
13
|
+
partiumId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
constructor(init?: Partial<AnnouncementRecipient>);
|
|
16
|
+
static fromAPIResponse(requestData: Object): AnnouncementRecipient;
|
|
17
|
+
}
|
|
18
|
+
export declare class Announcement extends APIObject {
|
|
19
|
+
status: ANNOUNCEMENTS_STATUS;
|
|
20
|
+
title: string;
|
|
21
|
+
contents: string;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
terminatesAt: string;
|
|
24
|
+
announcementType: ANNOUNCEMENT_TYPE;
|
|
25
|
+
recipients: string[];
|
|
26
|
+
includeSubOrgs: boolean;
|
|
27
|
+
sendEmails: boolean;
|
|
28
|
+
constructor(init?: Partial<Announcement>);
|
|
29
|
+
static fromAPIResponse(requestData: Object): Announcement;
|
|
30
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.Announcement=exports.AnnouncementRecipient=exports.ANNOUNCEMENT_TYPE=exports.ANNOUNCEMENTS_STATUS=void 0;var ANNOUNCEMENTS_STATUS,ANNOUNCEMENT_TYPE,core_1=require("../../core");!function(n){n.PUBLISHED="PUBLISHED",n.UNPUBLISHED="UNPUBLISHED",n.UNPUBLISHED_CHANGES="UNPUBLISHED CHANGES"}(ANNOUNCEMENTS_STATUS||(exports.ANNOUNCEMENTS_STATUS=ANNOUNCEMENTS_STATUS={})),function(n){n.APP="app",n.COMPANY="company"}(ANNOUNCEMENT_TYPE||(exports.ANNOUNCEMENT_TYPE=ANNOUNCEMENT_TYPE={}));var AnnouncementRecipient=function(n){function t(t){var e=n.call(this)||this;return Object.assign(e,t),e}return __extends(t,n),t.fromAPIResponse=function(n){return new t({partiumId:n.uuid,name:n.name})},t}(core_1.APIObject);exports.AnnouncementRecipient=AnnouncementRecipient;var Announcement=function(n){function t(t){var e=n.call(this)||this;return Object.assign(e,t),e}return __extends(t,n),t.fromAPIResponse=function(n){return new t({status:n.status,title:n.title,contents:n.contents,timestamp:n.timestamp,terminatesAt:n.terminatesAt,announcementType:n.type,recipients:n.recipients,includeSubOrgs:n.includeSubOrgs,sendEmails:n.sendEmails})},t}(core_1.APIObject);exports.Announcement=Announcement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { i18nString, APIObject } from "../../core";
|
|
3
|
+
export declare class AssemblyHierarchyNodeBreadcrumb extends APIObject {
|
|
4
|
+
partiumId: string;
|
|
5
|
+
name: i18nString;
|
|
6
|
+
constructor(init?: Partial<AssemblyHierarchyNodeBreadcrumb>);
|
|
7
|
+
static serialize(breadcrumb: AssemblyHierarchyNodeBreadcrumb): string;
|
|
8
|
+
static deserialize(serialized: string): AssemblyHierarchyNodeBreadcrumb;
|
|
9
|
+
static fromAPIResponse(breadcrumbData: Object): AssemblyHierarchyNodeBreadcrumb;
|
|
10
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
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)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AssemblyHierarchyNodeBreadcrumb=void 0;var core_1=require("../../core"),AssemblyHierarchyNodeBreadcrumb=function(e){function r(r){var t=e.call(this)||this;return Object.assign(t,r),t}return __extends(r,e),r.serialize=function(e){var r={};return r.partiumId=e.partiumId,e.name&&(r.name=e.name.getAsObject()),JSON.stringify(r)},r.deserialize=function(e){var t={},n=JSON.parse(e);return t.partiumId=n.partiumId,t.name=new core_1.i18nString(n.name),new r(t)},r.fromAPIResponse=function(e){return new r({partiumId:e.uuid,name:new core_1.i18nString(e.name)})},r}(core_1.APIObject);exports.AssemblyHierarchyNodeBreadcrumb=AssemblyHierarchyNodeBreadcrumb;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { i18nString, APIObject } from "../../core";
|
|
3
|
+
import { AssemblyHierarchyNodeBreadcrumb } from "./assembly-hierarchy-node-breadcrumb";
|
|
4
|
+
export declare class AssemblyHierarchyNode extends APIObject {
|
|
5
|
+
partiumId: string;
|
|
6
|
+
externalId: string;
|
|
7
|
+
externalPayload: Object;
|
|
8
|
+
name: i18nString;
|
|
9
|
+
parentId: string;
|
|
10
|
+
partTypeCount: number;
|
|
11
|
+
breadcrumbs: AssemblyHierarchyNodeBreadcrumb[];
|
|
12
|
+
childCount: number;
|
|
13
|
+
constructor(init?: Partial<AssemblyHierarchyNode>);
|
|
14
|
+
updateNode(update?: Partial<AssemblyHierarchyNode>): void;
|
|
15
|
+
static fromAPIResponse(nodeData: Object): AssemblyHierarchyNode;
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
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)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AssemblyHierarchyNode=void 0;var core_1=require("../../core"),assembly_hierarchy_node_breadcrumb_1=require("./assembly-hierarchy-node-breadcrumb"),AssemblyHierarchyNode=function(e){function r(r){var t=e.call(this)||this;return Object.assign(t,r),t}return __extends(r,e),r.prototype.updateNode=function(e){Object.assign(this,e)},r.fromAPIResponse=function(e){return new r({partiumId:e.uuid,externalId:e.external_id,externalPayload:e.metadata,name:new core_1.i18nString(e.name),partTypeCount:e.part_type_count,parentId:e.parent&&e.parent.uuid,breadcrumbs:e.tree?e.tree.map((function(e){return assembly_hierarchy_node_breadcrumb_1.AssemblyHierarchyNodeBreadcrumb.fromAPIResponse(e)})):[],childCount:e.children?e.children.length:0})},r}(core_1.APIObject);exports.AssemblyHierarchyNode=AssemblyHierarchyNode;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { i18nString, Organization, APIObject } from '../../core';
|
|
3
|
+
import { DATA_ORIGIN } from './part';
|
|
4
|
+
export interface AttributeFromDataAPI {
|
|
5
|
+
uuid: string;
|
|
6
|
+
metadata?: object;
|
|
7
|
+
created?: string;
|
|
8
|
+
modified?: string;
|
|
9
|
+
name?: any;
|
|
10
|
+
external_id?: string;
|
|
11
|
+
value?: any;
|
|
12
|
+
organization: {
|
|
13
|
+
uuid: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
type: string;
|
|
17
|
+
options: object[];
|
|
18
|
+
}
|
|
19
|
+
export interface AttributeFromFindAPI {
|
|
20
|
+
label: string;
|
|
21
|
+
language: string;
|
|
22
|
+
values: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare enum AttributeType {
|
|
25
|
+
KVP = "kvp",
|
|
26
|
+
PER_ORG = "per_org"
|
|
27
|
+
}
|
|
28
|
+
export interface AttributeOption {
|
|
29
|
+
value: i18nString;
|
|
30
|
+
organization?: Organization;
|
|
31
|
+
expansion?: i18nString;
|
|
32
|
+
}
|
|
33
|
+
export declare class Attribute extends APIObject {
|
|
34
|
+
partiumId?: string;
|
|
35
|
+
metadata?: object;
|
|
36
|
+
name?: i18nString;
|
|
37
|
+
externalId?: string;
|
|
38
|
+
value?: i18nString | string;
|
|
39
|
+
organization: Organization;
|
|
40
|
+
type: AttributeType;
|
|
41
|
+
options: AttributeOption[];
|
|
42
|
+
constructor(init: Partial<Attribute>);
|
|
43
|
+
updateAttribute(update?: Partial<Attribute>): void;
|
|
44
|
+
getAttributeWithValue(attributeValue: string): Attribute;
|
|
45
|
+
static fromAPIResponse(attributeFromAPI: Partial<AttributeFromDataAPI | AttributeFromFindAPI>, dataOrigin?: DATA_ORIGIN): Attribute;
|
|
46
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Attribute=exports.AttributeType=void 0;var AttributeType,core_1=require("../../core"),part_1=require("./part");!function(t){t.KVP="kvp",t.PER_ORG="per_org"}(AttributeType||(exports.AttributeType=AttributeType={}));var Attribute=function(t){function n(n){var e=t.call(this)||this;return Object.assign(e,n),e}return __extends(n,t),n.prototype.updateAttribute=function(t){Object.assign(this,t)},n.prototype.getAttributeWithValue=function(t){return __assign(__assign({},this),{value:t})},n.fromAPIResponse=function(t,e){var r;if(void 0===e&&(e=part_1.DATA_ORIGIN.DATA_API),e===part_1.DATA_ORIGIN.DATA_API){var i=t,a=i.uuid,o=i.metadata,s=i.value,u=i.external_id,_=i.organization,p=i.type,c=i.options;return new n(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({},a&&{partiumId:a}),o&&{metadata:o}),{name:new core_1.i18nString(i.name)}),u&&{externalId:u}),s&&{value:s instanceof Object?new core_1.i18nString(s):s.toString()}),_&&{organization:new core_1.Organization({partiumId:_.uuid,name:_.name,displayName:_.name})}),p&&{type:p}),{options:c?c.map((function(t){return{organization:new core_1.Organization({partiumId:t.organization?t.organization.uuid:null,name:t.organization?t.organization.name:null,displayName:t.organization?t.organization.name:null}),value:new core_1.i18nString(t.value),expansion:new core_1.i18nString(t.expansion)}})):[]}))}var g=t;return new n({name:new core_1.i18nString((r={},r[g.language]=g.label,r)),options:g.values.map((function(t){var n;return{value:new core_1.i18nString((n={},n[g.language]=t,n))}}))})},n}(core_1.APIObject);exports.Attribute=Attribute;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { APIObject } from '../../core';
|
|
3
|
+
export interface ICSARequestSearch {
|
|
4
|
+
searchSessionId: string;
|
|
5
|
+
userEmail: string;
|
|
6
|
+
searchLimitReached?: boolean;
|
|
7
|
+
relativeIndex?: number;
|
|
8
|
+
abandoned?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class CSARequestSearch extends APIObject implements ICSARequestSearch {
|
|
11
|
+
searchSessionId: string;
|
|
12
|
+
userEmail: string;
|
|
13
|
+
searchLimitReached?: boolean;
|
|
14
|
+
abandoned?: boolean;
|
|
15
|
+
relativeIndex?: number;
|
|
16
|
+
constructor(init?: Partial<CSARequestSearch>);
|
|
17
|
+
static fromAPIResponse(requestData: Object): CSARequestSearch;
|
|
18
|
+
}
|
|
@@ -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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CSARequestSearch=void 0;var core_1=require("../../core"),general_helper_1=require("../../core/utils/general-helper"),CSARequestSearch=function(e){function t(t){var r=e.call(this)||this;return Object.assign(r,t),r}return __extends(t,e),t.fromAPIResponse=function(e){var r=(0,general_helper_1.snakeToCamelCase)(e);return new t(__assign({},r))},t}(core_1.APIObject);exports.CSARequestSearch=CSARequestSearch;
|