@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,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.JsPFile=void 0;var p_file_1=require("../models/p-file"),JsPFile=function(t){function e(e){var o=t.call(this)||this;return o.file=e,o}return __extends(e,t),e.prototype.supportsMultipartUpload=function(){return!0},e.prototype.appendToFormData=function(t,e){e.append(t,this.file)},e}(p_file_1.PFile);exports.JsPFile=JsPFile;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { OauthSessionService, OauthStatus, OauthLoginConfig } from '../../services/session/oauth-session.service';
|
|
4
|
+
import { ServiceProvider } from '../../services/service-provider';
|
|
5
|
+
export interface JsOauthPublicApiResponse {
|
|
6
|
+
token: string;
|
|
7
|
+
expires_in_secs: number;
|
|
8
|
+
expires: boolean;
|
|
9
|
+
refreshable: boolean;
|
|
10
|
+
refresh_token: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Public-Api-specific implementation of the OauthSessionService for
|
|
14
|
+
* web-based Applications.
|
|
15
|
+
*/
|
|
16
|
+
export declare class JSOauthPublicApiSessionService extends OauthSessionService {
|
|
17
|
+
private _status;
|
|
18
|
+
private status$;
|
|
19
|
+
private httpsClientService;
|
|
20
|
+
constructor(serviceProvider: ServiceProvider);
|
|
21
|
+
/**
|
|
22
|
+
* Called when the service is initialized
|
|
23
|
+
*/
|
|
24
|
+
onCreate(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get an observable that always sends the OauthStatus every time
|
|
27
|
+
* it changes.
|
|
28
|
+
*
|
|
29
|
+
* @returns Observable<OauthStatus> observable that resolves with the OauthStatus, every time it changes
|
|
30
|
+
*/
|
|
31
|
+
getStatus(): Observable<OauthStatus>;
|
|
32
|
+
/**
|
|
33
|
+
* Login user and resolves on success
|
|
34
|
+
*
|
|
35
|
+
* @param config the oauthLoginConfiguration
|
|
36
|
+
*/
|
|
37
|
+
login(config: OauthLoginConfig): Observable<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Refresh session and Access token with the refresh token
|
|
40
|
+
*/
|
|
41
|
+
refresh(): Observable<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Logout the current user-session
|
|
44
|
+
*/
|
|
45
|
+
logout(): Observable<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Instead of logging in with an api-key, the user already logged in to keycloak via another channel (eg direct)
|
|
48
|
+
* -> reuse this existing session instead of creating a new one.
|
|
49
|
+
* (Used to prevent that the API-key needs to be exposed in the app and sent to the SDK without encryption)
|
|
50
|
+
*
|
|
51
|
+
* @param activeSession data about the active session (session-token, ...)
|
|
52
|
+
*/
|
|
53
|
+
private reuseActiveSession;
|
|
54
|
+
/**
|
|
55
|
+
* Update the current access token from a keycloak response.
|
|
56
|
+
* Should be called after successful login or refresh
|
|
57
|
+
*/
|
|
58
|
+
private updateTokenFromResponse;
|
|
59
|
+
/**
|
|
60
|
+
* Update the current access token
|
|
61
|
+
* Should be called after successful login, refresh or session reuse
|
|
62
|
+
*/
|
|
63
|
+
private updateToken;
|
|
64
|
+
/**
|
|
65
|
+
* Reset the current access token
|
|
66
|
+
* Called on logout or failing login/refresh
|
|
67
|
+
*/
|
|
68
|
+
private resetToken;
|
|
69
|
+
private handleError;
|
|
70
|
+
/**
|
|
71
|
+
* Creates an appropiate SdkError from the input error
|
|
72
|
+
* @param error
|
|
73
|
+
* @returns SdkError
|
|
74
|
+
*/
|
|
75
|
+
private createSdkError;
|
|
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 s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JSOauthPublicApiSessionService=void 0;var rxjs_1=require("rxjs"),oauth_session_service_1=require("../../services/session/oauth-session.service"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("../../services/http/https-client/https-client.service.interface"),user_1=require("../../models/user"),error_1=require("../../models/error"),user_token_1=require("../../models/user-token"),JSOauthPublicApiSessionService=function(e){function t(t){var r=e.call(this,t)||this;return r._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},r.status$=new rxjs_1.BehaviorSubject(r._status),r}return __extends(t,e),t.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.httpsClientService=this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService)},t.prototype.getStatus=function(){return this.status$.asObservable()},t.prototype.login=function(e){var t=this;if(e.activeSession)return this.reuseActiveSession(e.activeSession),this.sessionSetup();if(e.apiKey){var r=this.authenticationConfig;return this.httpsClientService.post("".concat(r.partiumApiBaseUrl,"/auth/"),null,null,{Authorization:"Bearer ".concat(r.apiKey)}).pipe((0,operators_1.catchError)((function(e){return t.handleError(e)})),(0,operators_1.tap)((function(e){t.updateTokenFromResponse(e)})),(0,operators_1.mergeMap)((function(){return t.sessionSetup()})))}return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_LOGIN_CONFIG,null,"Neither an api key nor an active session was provided"))},t.prototype.refresh=function(){var e=this;if(this._status&&this._status.refreshToken){var t=this.authenticationConfig;return this.httpsClientService.post("".concat(t.partiumApiBaseUrl,"/auth/refresh"),{refresh_token:this._status.refreshToken},null).pipe((0,operators_1.catchError)((function(t){return e.handleError(t)})),(0,operators_1.map)((function(t){e.updateTokenFromResponse(t)})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.throwError)(this.createSdkError(null,"Could not refresh because there was no refresh token"))},t.prototype.logout=function(){var e=this;if(this._status&&this._status.refreshToken){var t=this.authenticationConfig;return this.httpsClientService.post("".concat(t.partiumApiBaseUrl,"/auth/revoke"),{access_token:this._status.accessToken,refresh_token:this._status.refreshToken},null).pipe((0,operators_1.catchError)((function(t){return e.handleError(t)})),(0,operators_1.map)((function(){e.resetToken(),e.sessionEnded()})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.of)(void 0)},t.prototype.reuseActiveSession=function(e){this.updateToken(e)},t.prototype.updateTokenFromResponse=function(e){var t=new Date(Date.now()+1e3*e.expires_in_secs);this.updateToken({accessToken:e.token,accessTokenExpiration:t,accessTokenCreateDate:new Date,authenticated:!0,refreshToken:e.refresh_token})},t.prototype.updateToken=function(e){this.tokenUpdated(e.accessToken,e.accessTokenExpiration);var t=(0,user_token_1.createUserToken)(e.accessToken),r=user_1.User.createFromToken(t);this.setUser(r),this._status=e,this.status$.next(this._status)},t.prototype.resetToken=function(){this.tokenUpdated(null,null),this.setUser(null),this._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},this.status$.next(this._status)},t.prototype.handleError=function(e){return e instanceof error_1.SdkError?e.code===error_1.SDK_ERROR_CODES.BAD_REQUEST&&e.detail&&e.detail.response&&e.detail.response.data&&"unauthorized_client"===e.detail.response.data.error?(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_AUTH_CONFIG,e.detail,"Unauthorized Keycloak client.")):(0,rxjs_1.throwError)(e):(0,rxjs_1.throwError)(this.createSdkError(e))},t.prototype.createSdkError=function(e,t){return new error_1.SdkError(error_1.SDK_ERROR_CODES.OAUTH_ERROR,e,t)},t}(oauth_session_service_1.OauthSessionService);exports.JSOauthPublicApiSessionService=JSOauthPublicApiSessionService;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { OauthAuthenticationConfig } from "../../models/auth-config";
|
|
3
|
+
/**
|
|
4
|
+
* Authentication configuration for Javascript-Keycloak-OAuth authentication.
|
|
5
|
+
*/
|
|
6
|
+
export declare class JsOauthKeycloakAuthenticationConfig extends OauthAuthenticationConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the login-url of keycloak for this configured authentication-config.
|
|
9
|
+
* Can be used to create a session outside of the SDK and then pass the session into the SDK.
|
|
10
|
+
*
|
|
11
|
+
* @returns the keycloak login URL
|
|
12
|
+
*/
|
|
13
|
+
getKeycloakLoginUrl(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the body for a login request against keycloak.
|
|
16
|
+
* Can be used to create a session outside of the SDK and then pass the session into the SDK.
|
|
17
|
+
*
|
|
18
|
+
* @returns the keycloak login request body
|
|
19
|
+
*/
|
|
20
|
+
getKeycloakLoginBody(): object;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the header for a login request against keycloak.
|
|
23
|
+
* Can be used to create a session outside of the SDK and then pass the session into the SDK.
|
|
24
|
+
*
|
|
25
|
+
* @returns the keycloak login request header
|
|
26
|
+
*/
|
|
27
|
+
getKeycloakLoginHeader(): object;
|
|
28
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(o,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},t(o,n)};return function(o,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsOauthKeycloakAuthenticationConfig=void 0;var auth_config_1=require("../../models/auth-config"),JsOauthKeycloakAuthenticationConfig=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return __extends(o,t),o.prototype.getKeycloakLoginUrl=function(){return"".concat(this.baseUrl,"/auth/realms/").concat(this.realm,"/protocol/openid-connect/token")},o.prototype.getKeycloakLoginBody=function(){return{client_id:this.clientId,grant_type:"password",scope:"openid"}},o.prototype.getKeycloakLoginHeader=function(){return{"Content-type":"application/x-www-form-urlencoded"}},o}(auth_config_1.OauthAuthenticationConfig);exports.JsOauthKeycloakAuthenticationConfig=JsOauthKeycloakAuthenticationConfig;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { OauthSessionService, OauthStatus, OauthLoginConfig } from '../../services/session/oauth-session.service';
|
|
4
|
+
import { ServiceProvider } from '../../services/service-provider';
|
|
5
|
+
export interface JSOauthKeycloakResponse {
|
|
6
|
+
access_token: string;
|
|
7
|
+
expires_in: number;
|
|
8
|
+
refresh_expires_in: number;
|
|
9
|
+
refresh_token: string;
|
|
10
|
+
token_type: string;
|
|
11
|
+
id_token: string;
|
|
12
|
+
session_state: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
error_description?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Keycloak-specific implementation of the OauthSessionService for
|
|
19
|
+
* web-based Applications.
|
|
20
|
+
*/
|
|
21
|
+
export declare class JSOauthKeycloakSessionService extends OauthSessionService {
|
|
22
|
+
private _status;
|
|
23
|
+
private status$;
|
|
24
|
+
private httpsClientService;
|
|
25
|
+
constructor(serviceProvider: ServiceProvider);
|
|
26
|
+
/**
|
|
27
|
+
* Called when the service is initialized
|
|
28
|
+
*/
|
|
29
|
+
onCreate(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get an observable that always sends the OauthStatus every time
|
|
32
|
+
* it changes.
|
|
33
|
+
*
|
|
34
|
+
* @returns Observable<OauthStatus> observable that resolves with the OauthStatus, every time it changes
|
|
35
|
+
*/
|
|
36
|
+
getStatus(): Observable<OauthStatus>;
|
|
37
|
+
/**
|
|
38
|
+
* Login user and resolves on success
|
|
39
|
+
*
|
|
40
|
+
* @param config the oauthLoginConfiguration
|
|
41
|
+
*/
|
|
42
|
+
login(config: OauthLoginConfig): Observable<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Refresh session and Access token with the refresh token
|
|
45
|
+
*/
|
|
46
|
+
refresh(): Observable<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Logout the current user-session
|
|
49
|
+
*/
|
|
50
|
+
logout(): Observable<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Instead of logging in with an api-key, the user already logged in to keycloak via another channel (eg direct)
|
|
53
|
+
* -> reuse this existing session instead of creating a new one.
|
|
54
|
+
* (Used to prevent that the API-key needs to be exposed in the app and sent to the SDK without encryption)
|
|
55
|
+
*
|
|
56
|
+
* @param activeSession data about the active session (session-token, ...)
|
|
57
|
+
*/
|
|
58
|
+
private reuseActiveSession;
|
|
59
|
+
/**
|
|
60
|
+
* Update the current access token from a keycloak response.
|
|
61
|
+
* Should be called after successful login or refresh
|
|
62
|
+
*/
|
|
63
|
+
private updateTokenFromResponse;
|
|
64
|
+
/**
|
|
65
|
+
* Update the current access token
|
|
66
|
+
* Should be called after successful login, refresh or session reuse
|
|
67
|
+
*/
|
|
68
|
+
private updateToken;
|
|
69
|
+
/**
|
|
70
|
+
* Reset the current access token
|
|
71
|
+
* Called on logout or failing login/refresh
|
|
72
|
+
*/
|
|
73
|
+
private resetToken;
|
|
74
|
+
private handleError;
|
|
75
|
+
/**
|
|
76
|
+
* Creates an appropiate SdkError from the input error
|
|
77
|
+
* @param error
|
|
78
|
+
* @returns SdkError
|
|
79
|
+
*/
|
|
80
|
+
private createSdkError;
|
|
81
|
+
private parseApiKey;
|
|
82
|
+
}
|
|
@@ -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 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.JSOauthKeycloakSessionService=void 0;var rxjs_1=require("rxjs"),querystring=require("query-string"),oauth_session_service_1=require("../../services/session/oauth-session.service"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("../../services/http/https-client/https-client.service.interface"),user_1=require("../../models/user"),error_1=require("../../models/error"),base64=require("base-64"),user_token_1=require("../../models/user-token"),JSOauthKeycloakSessionService=function(e){function r(r){var t=e.call(this,r)||this;return t._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},t.status$=new rxjs_1.BehaviorSubject(t._status),t}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.httpsClientService=this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService)},r.prototype.getStatus=function(){return this.status$.asObservable()},r.prototype.login=function(e){var r=this;if(e.activeSession)return this.reuseActiveSession(e.activeSession),this.sessionSetup();if(e.apiKey){var t=this.authenticationConfig,o=this.parseApiKey(e.apiKey),s=o.email,n=o.password,i=t.realm,a=t.clientId,c="".concat(t.baseUrl,"/auth/realms/").concat(i,"/protocol/openid-connect/token"),u=querystring.stringify({client_id:a,grant_type:"password",scope:"openid",username:s,password:n});return this.httpsClientService.post(c,u,null,{"Content-type":"application/x-www-form-urlencoded"}).pipe((0,operators_1.catchError)((function(e){return r.handleError(e)})),(0,operators_1.tap)((function(e){if(e.error)throw console.error(e.error,e.error_description),r.resetToken(),r.sessionEnded(),r.createSdkError(e);r.updateTokenFromResponse(e)})),(0,operators_1.mergeMap)((function(){return r.sessionSetup()})))}return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_LOGIN_CONFIG,null,"Neither an api key nor an active session was provided"))},r.prototype.refresh=function(){var e=this;if(this._status&&this._status.refreshToken){var r=this.authenticationConfig,t=this.authenticationConfig,o=t.realm,s=t.clientId,n="".concat(r.baseUrl,"/auth/realms/").concat(o,"/protocol/openid-connect/token"),i=querystring.stringify({client_id:s,grant_type:"refresh_token",refresh_token:this._status.refreshToken});return this.httpsClientService.post(n,i,null,{"Content-type":"application/x-www-form-urlencoded"}).pipe((0,operators_1.catchError)((function(r){return e.handleError(r)})),(0,operators_1.map)((function(r){if(r.error)throw console.error(r.error,r.error_description),e.resetToken(),e.sessionEnded(),e.createSdkError(r);e.updateTokenFromResponse(r)})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.throwError)(this.createSdkError(null,"Could not refresh because there was no refresh token"))},r.prototype.logout=function(){var e=this;if(this._status&&this._status.refreshToken){var r=this.authenticationConfig,t=this.authenticationConfig,o=t.realm,s=t.clientId,n="".concat(r.baseUrl,"/auth/realms/").concat(o,"/protocol/openid-connect/logout"),i=querystring.stringify({client_id:s,grant_type:"refresh_token",refresh_token:this._status.refreshToken});return this.httpsClientService.post(n,i,null,{"Content-type":"application/x-www-form-urlencoded"}).pipe((0,operators_1.catchError)((function(r){return e.handleError(r)})),(0,operators_1.map)((function(){e.resetToken(),e.sessionEnded()})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.of)(void 0)},r.prototype.reuseActiveSession=function(e){this.updateToken(e)},r.prototype.updateTokenFromResponse=function(e){var r=new Date(Date.now()+1e3*e.expires_in);this.updateToken({accessToken:e.access_token,accessTokenExpiration:r,accessTokenCreateDate:new Date,authenticated:!0,refreshToken:e.refresh_token})},r.prototype.updateToken=function(e){this.tokenUpdated(e.accessToken,e.accessTokenExpiration);var r=(0,user_token_1.createUserToken)(e.accessToken),t=user_1.User.createFromToken(r);this.setUser(t),this._status=e,this.status$.next(this._status)},r.prototype.resetToken=function(){this.tokenUpdated(null,null),this.setUser(null),this._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},this.status$.next(this._status)},r.prototype.handleError=function(e){return e instanceof error_1.SdkError?e.code===error_1.SDK_ERROR_CODES.BAD_REQUEST&&e.detail&&e.detail.response&&e.detail.response.data&&"unauthorized_client"===e.detail.response.data.error?(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_AUTH_CONFIG,e.detail,"Unauthorized Keycloak client.")):(0,rxjs_1.throwError)(e):(0,rxjs_1.throwError)(this.createSdkError(e))},r.prototype.createSdkError=function(e,r){return new error_1.SdkError(error_1.SDK_ERROR_CODES.OAUTH_ERROR,e,r)},r.prototype.parseApiKey=function(e){try{var r=JSON.parse(base64.decode(e));if(!r.email||!r.password)throw"Invalid API Key";return r}catch(e){throw new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_API_KEY_FORMAT,null,"The provided api-key has an invalid format.")}},r}(oauth_session_service_1.OauthSessionService);exports.JSOauthKeycloakSessionService=JSOauthKeycloakSessionService;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { DeviceInfo } from '../models/device-info';
|
|
3
|
+
import { DeviceStatusService } from '../services/device-status.service.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the DeviceStatusService for Web-based applications.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WebDeviceStatusService extends DeviceStatusService {
|
|
8
|
+
/**
|
|
9
|
+
* Returns Promise that resolves with true if connection to a network is available.
|
|
10
|
+
* (Usually the internet, but for intranet-only systems it can also be only intranet)
|
|
11
|
+
*
|
|
12
|
+
* @returns promise that resolves with true or false, depending on network-connection is available or not
|
|
13
|
+
*/
|
|
14
|
+
isConnectionAvailable(): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns Promise that resolves with a DeviceInfo object, containing
|
|
17
|
+
* information about the device and the installation.
|
|
18
|
+
* Used for logging.
|
|
19
|
+
*
|
|
20
|
+
* @returns Promise that resolves with DeviceInfo
|
|
21
|
+
*/
|
|
22
|
+
getDeviceInfo(): Promise<DeviceInfo>;
|
|
23
|
+
private getDeviceType;
|
|
24
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},e(n,t)};return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}(),__awaiter=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(i,o){function u(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,a)}c((r=r.apply(e,n||[])).next())}))},__generator=this&&this.__generator||function(e,n){var t,r,i,o,u={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(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(u=0)),u;)try{if(t=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){u.label=a[1];break}if(6===a[0]&&u.label<i[1]){u.label=i[1],i=a;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(a);break}i[2]&&u.ops.pop(),u.trys.pop();continue}a=n.call(e,u)}catch(e){a=[6,e],r=0}finally{t=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.WebDeviceStatusService=void 0;var device_info_1=require("../models/device-info"),device_status_service_interface_1=require("../services/device-status.service.interface"),pro_enterprise_1=require("@ua-parser-js/pro-enterprise"),WebDeviceStatusService=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return __extends(n,e),n.prototype.isConnectionAvailable=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,window.navigator.onLine]}))}))},n.prototype.getDeviceInfo=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,t,r,i,o,u,a,c,l,s;return __generator(this,(function(v){return e=new pro_enterprise_1.UAParser,n=e.getResult(),[2,new device_info_1.DeviceInfo({manufacturer:null===(t=null==n?void 0:n.device)||void 0===t?void 0:t.vendor,model:null===(r=null==n?void 0:n.device)||void 0===r?void 0:r.model,os:null===(i=null==n?void 0:n.os)||void 0===i?void 0:i.name,osVersion:null===(o=null==n?void 0:n.os)||void 0===o?void 0:o.version,deviceType:this.getDeviceType(n),deviceLanguage:window.navigator.language,appVersionCode:window.appVersion,appVersionName:window.appVersion,browserName:null===(u=null==n?void 0:n.browser)||void 0===u?void 0:u.name,browserVersion:null===(a=null==n?void 0:n.browser)||void 0===a?void 0:a.version,cpuArchitecture:null===(c=null==n?void 0:n.cpu)||void 0===c?void 0:c.architecture,engineName:null===(l=null==n?void 0:n.engine)||void 0===l?void 0:l.name,engineVersion:null===(s=null==n?void 0:n.engine)||void 0===s?void 0:s.version})]}))}))},n.prototype.getDeviceType=function(e){var n;switch(null===(n=null==e?void 0:e.device)||void 0===n?void 0:n.type){case"mobile":return"mobile";case"tablet":return"tablet";default:return"desktop"}},n}(device_status_service_interface_1.DeviceStatusService);exports.WebDeviceStatusService=WebDeviceStatusService;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { JsPFile } from './js-p-file';
|
|
3
|
+
import { FileService } from '../services/file.service.interface';
|
|
4
|
+
import { PFileType } from '../models/p-file';
|
|
5
|
+
export declare class WebFileService extends FileService {
|
|
6
|
+
private getMIMEFromBlob;
|
|
7
|
+
getFileType(pFile: JsPFile): Promise<PFileType>;
|
|
8
|
+
getImageDimensions(pFile: JsPFile): Promise<[number, number]>;
|
|
9
|
+
}
|
|
@@ -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)}}(),__awaiter=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function c(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var r;e.done?i(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}u((n=n.apply(e,r||[])).next())}))},__generator=this&&this.__generator||function(e,r){var t,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(u){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(t=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e],n=0}finally{t=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebFileService=void 0;var file_service_interface_1=require("../services/file.service.interface"),p_file_1=require("../models/p-file"),error_1=require("../models/error"),WebFileService=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.getMIMEFromBlob=function(e){return __awaiter(this,void 0,void 0,(function(){var r,t,n,i;return __generator(this,(function(o){switch(o.label){case 0:return t=Uint8Array.bind,[4,e.arrayBuffer()];case 1:for(r=new(t.apply(Uint8Array,[void 0,o.sent(),0,4])),n="",i=0;i<r.length;i++)n+=r[i].toString(16);switch(n){case"89504e47":return[2,"image/png"];case"47494638":return[2,"image/gif"];case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":return[2,"image/jpeg"];default:return[2,e.type||"unknown"]}return[2]}}))}))},r.prototype.getFileType=function(e){return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getMIMEFromBlob(e.file)];case 1:switch(r=t.sent(),r.replace(/\/.*/,"")){case"image":return[2,p_file_1.PFileType.IMAGE];case"text":return[2,p_file_1.PFileType.TEXT];default:return[2,p_file_1.PFileType.UNKNOWN]}return[2]}}))}))},r.prototype.getImageDimensions=function(e){var r=URL.createObjectURL(e.file);return new Promise((function(e,t){var n=new Image;n.onload=function(){e([n.width,n.height])},n.onerror=function(){t(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_FILE_TYPE,{},"Invalid file type"))},n.src=r}))},r}(file_service_interface_1.FileService);exports.WebFileService=WebFileService;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { ServiceProvider } from "../services/service-provider";
|
|
3
|
+
import { KeyPrefixParams, LocalStorageService } from "../services/local-storage.service.interface";
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the LocalStorageService for Web-based applications with IndexedDB API.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated The operations of this service are not supported anymore and will be removed in the future, use 'web-local-storage.service.ts' instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare class WebIndexedDBService extends LocalStorageService {
|
|
10
|
+
constructor(serviceProvider: ServiceProvider);
|
|
11
|
+
setItem(key: string, value: string, keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
12
|
+
setItems(keyValuePairs: [string, string][], keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
13
|
+
getItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<string | undefined>;
|
|
14
|
+
getItems(keys: string[], keyPrefixParams?: KeyPrefixParams): Promise<string[] | undefined>;
|
|
15
|
+
getAll(): Promise<[string, string][]>;
|
|
16
|
+
deleteItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
17
|
+
deleteItems(keys: string[], keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
18
|
+
hasItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<boolean>;
|
|
19
|
+
}
|
|
@@ -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)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function u(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(a,u)}c((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){a.label=u[1];break}if(6===u[0]&&a.label<i[1]){a.label=i[1],i=u;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(u);break}i[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebIndexedDBService=void 0;var local_storage_service_interface_1=require("../services/local-storage.service.interface"),idb_keyval_1=require("idb-keyval"),WebIndexedDBService=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.setItem=function(e,t){return __awaiter(this,arguments,void 0,(function(e,t,r){return void 0===r&&(r={userEmail:!0,organizationName:!0}),__generator(this,(function(n){return[2,(0,idb_keyval_1.set)(this.getPrefixedKey(e,r),t)]}))}))},t.prototype.setItems=function(e){return __awaiter(this,arguments,void 0,(function(e,t){var r=this;return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(n){return[2,(0,idb_keyval_1.setMany)(e.map((function(e){return[r.getPrefixedKey(e[0],t),e[1]]})))]}))}))},t.prototype.getItem=function(e){return __awaiter(this,arguments,void 0,(function(e,t){return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,(0,idb_keyval_1.get)(this.getPrefixedKey(e,t))]}))}))},t.prototype.getItems=function(e){return __awaiter(this,arguments,void 0,(function(e,t){var r=this;return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(n){return[2,(0,idb_keyval_1.getMany)(e.map((function(e){return r.getPrefixedKey(e,t)})))]}))}))},t.prototype.getAll=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,(0,idb_keyval_1.entries)()]}))}))},t.prototype.deleteItem=function(e){return __awaiter(this,arguments,void 0,(function(e,t){return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,(0,idb_keyval_1.del)(this.getPrefixedKey(e,t))]}))}))},t.prototype.deleteItems=function(e){return __awaiter(this,arguments,void 0,(function(e,t){var r=this;return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(n){return[2,(0,idb_keyval_1.delMany)(e.map((function(e){return r.getPrefixedKey(e,t)})))]}))}))},t.prototype.hasItem=function(e){return __awaiter(this,arguments,void 0,(function(e,t){return void 0===t&&(t={userEmail:!0,organizationName:!0}),__generator(this,(function(r){switch(r.label){case 0:return[4,this.getItem(e,t)];case 1:return[2,null!==r.sent()]}}))}))},t}(local_storage_service_interface_1.LocalStorageService);exports.WebIndexedDBService=WebIndexedDBService;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { ServiceProvider } from "../services/service-provider";
|
|
3
|
+
import { KeyPrefixParams, LocalStorageService } from "../services/local-storage.service.interface";
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the LocalStorageService for Web-based applications with LocalStorage API.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WebLocalStorageService extends LocalStorageService {
|
|
8
|
+
constructor(serviceProvider: ServiceProvider);
|
|
9
|
+
/**
|
|
10
|
+
* Sets the value of the pair identified by key to value, creating a new
|
|
11
|
+
* key/value pair if none existed for key previously.
|
|
12
|
+
*
|
|
13
|
+
* @param key the key to identify the pair
|
|
14
|
+
* @param value the value as string
|
|
15
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
16
|
+
* @returns promise that resolves as soon as the value is stored
|
|
17
|
+
*/
|
|
18
|
+
setItem(key: string, value: string, keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the value of the pair identified by key to value, creating a new
|
|
21
|
+
* key/value pair if none existed for key previously.
|
|
22
|
+
*
|
|
23
|
+
* @param key the key to identify the pair
|
|
24
|
+
* @param value the value as string
|
|
25
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
26
|
+
*/
|
|
27
|
+
setItemSync(key: string, value: string, keyPrefixParams?: KeyPrefixParams): void;
|
|
28
|
+
/**
|
|
29
|
+
* Sets a series of key-value pairs
|
|
30
|
+
*
|
|
31
|
+
* @param keyValuePairs the array of key-value-pairs [['k1', 'val1'], ['k2', 'val2']]
|
|
32
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
33
|
+
* @returns promise that resolves as soon as all pairs are stored
|
|
34
|
+
*/
|
|
35
|
+
setItems(keyValuePairs: string[][], keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Sets a series of key-value pairs
|
|
38
|
+
*
|
|
39
|
+
* @param keyValuePairs the array of key-value-pairs [['k1', 'val1'], ['k2', 'val2']]
|
|
40
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
41
|
+
*/
|
|
42
|
+
setItemsSync(keyValuePairs: string[][], keyPrefixParams?: KeyPrefixParams): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current value associated with the given key, or null if the given
|
|
45
|
+
* key does not exist in the list associated with the object.
|
|
46
|
+
*
|
|
47
|
+
* @param key the key to identify the pair
|
|
48
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
49
|
+
* @returns string-value of the item stored by the given key, or null if not found
|
|
50
|
+
*/
|
|
51
|
+
getItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the current value associated with the given key, or null if the given
|
|
54
|
+
* key does not exist in the list associated with the object.
|
|
55
|
+
*
|
|
56
|
+
* @param key the key to identify the pair
|
|
57
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
58
|
+
* @returns string-value of the item stored by the given key, or null if not found
|
|
59
|
+
*/
|
|
60
|
+
getItemSync(key: string, keyPrefixParams?: KeyPrefixParams): string;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the current value for each of the given keys, or null if the given
|
|
63
|
+
* keys does not exist in the list associated with the object.
|
|
64
|
+
*
|
|
65
|
+
* @param keys array of keys to retrieve
|
|
66
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
67
|
+
* @returns array of string-values of the items stored by the given keys, or null if not found
|
|
68
|
+
*/
|
|
69
|
+
getItems(keys: string[], keyPrefixParams?: KeyPrefixParams): Promise<string[] | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the current value for each of the given keys, or null if the given
|
|
72
|
+
* keys does not exist in the list associated with the object.
|
|
73
|
+
*
|
|
74
|
+
* This method should not be used inside the SDK. It's purpose is only for integrators from outside.
|
|
75
|
+
* The reason is, that using it internally would restrict the use of the SDK for some platforms, as some platforms don't provide support for synchronous
|
|
76
|
+
* interaction with the local storage.
|
|
77
|
+
*
|
|
78
|
+
* @param keys array of keys to retrieve
|
|
79
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
80
|
+
* @returns array of string-values of the items stored by the given keys, or null if not found
|
|
81
|
+
*/
|
|
82
|
+
getItemsSync(keys: string[], keyPrefixParams?: KeyPrefixParams): string[] | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Returns all key-value pairs
|
|
85
|
+
*
|
|
86
|
+
* @returns array of string-value of all the stored items
|
|
87
|
+
*/
|
|
88
|
+
getAll(): Promise<[string, string][]>;
|
|
89
|
+
/**
|
|
90
|
+
* Returns all key-value pairs
|
|
91
|
+
*
|
|
92
|
+
* This method should not be used inside the SDK. It's purpose is only for integrators from outside.
|
|
93
|
+
* The reason is, that using it internally would restrict the use of the SDK for some platforms, as some platforms don't provide support for synchronous
|
|
94
|
+
* interaction with the local storage.
|
|
95
|
+
*
|
|
96
|
+
* @returns array of string-value of all the stored items
|
|
97
|
+
*/
|
|
98
|
+
getAllSync(): [string, string][];
|
|
99
|
+
/**
|
|
100
|
+
* Delete a key-value pair
|
|
101
|
+
*
|
|
102
|
+
* @param key the key to identify the pair
|
|
103
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
104
|
+
*/
|
|
105
|
+
deleteItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Delete a key-value pair
|
|
108
|
+
*
|
|
109
|
+
* This method should not be used inside the SDK. It's purpose is only for integrators from outside.
|
|
110
|
+
* The reason is, that using it internally would restrict the use of the SDK for some platforms, as some platforms don't provide support for synchronous
|
|
111
|
+
* interaction with the local storage.
|
|
112
|
+
*
|
|
113
|
+
* @param key the key to identify the pair
|
|
114
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
115
|
+
*/
|
|
116
|
+
deleteItemSync(key: string, keyPrefixParams?: KeyPrefixParams): void;
|
|
117
|
+
/**
|
|
118
|
+
* Delete a series of key-value pairs
|
|
119
|
+
*
|
|
120
|
+
* @param keys the keys to identify the pairs
|
|
121
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
122
|
+
*/
|
|
123
|
+
deleteItems(keys: string[], keyPrefixParams?: KeyPrefixParams): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Delete a series of key-value pairs
|
|
126
|
+
*
|
|
127
|
+
* This method should not be used inside the SDK. It's purpose is only for integrators from outside.
|
|
128
|
+
* The reason is, that using it internally would restrict the use of the SDK for some platforms, as some platforms don't provide support for synchronous
|
|
129
|
+
* interaction with the local storage.
|
|
130
|
+
*
|
|
131
|
+
* @param keys the keys to identify the pairs
|
|
132
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
133
|
+
*/
|
|
134
|
+
deleteItemsSync(keys: string[], keyPrefixParams?: KeyPrefixParams): void;
|
|
135
|
+
/**
|
|
136
|
+
* Returns true if an item with the given key exists.
|
|
137
|
+
* Returns false, otherwise.
|
|
138
|
+
*
|
|
139
|
+
* @param key the key to identify the item
|
|
140
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
141
|
+
* @returns true if the item exists, false otherwise
|
|
142
|
+
*/
|
|
143
|
+
hasItem(key: string, keyPrefixParams?: KeyPrefixParams): Promise<boolean>;
|
|
144
|
+
/**
|
|
145
|
+
* Returns true if an item with the given key exists.
|
|
146
|
+
* Returns false, otherwise.
|
|
147
|
+
*
|
|
148
|
+
* This method should not be used inside the SDK. It's purpose is only for integrators from outside.
|
|
149
|
+
* The reason is, that using it internally would restrict the use of the SDK for some platforms, as some platforms don't provide support for synchronous
|
|
150
|
+
* interaction with the local storage.
|
|
151
|
+
*
|
|
152
|
+
* @param key the key to identify the item
|
|
153
|
+
* @param keyPrefixParams optional parameters to prefix the key with different prefix-options
|
|
154
|
+
* @returns true if the item exists, false otherwise
|
|
155
|
+
*/
|
|
156
|
+
hasItemSync(key: string, keyPrefixParams?: KeyPrefixParams): boolean;
|
|
157
|
+
}
|
|
@@ -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,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))},__generator=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebLocalStorageService=void 0;var local_storage_service_interface_1=require("../services/local-storage.service.interface"),WebLocalStorageService=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.setItem=function(t,e){return __awaiter(this,arguments,void 0,(function(t,e,r){return void 0===r&&(r={userEmail:!0,organizationName:!0}),__generator(this,(function(n){return this.setItemSync(t,e,r),[2]}))}))},e.prototype.setItemSync=function(t,e,r){void 0===r&&(r={userEmail:!0,organizationName:!0}),localStorage.setItem(this.getPrefixedKey(t,r),e)},e.prototype.setItems=function(t){return __awaiter(this,arguments,void 0,(function(t,e){var r,n=this;return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(o){switch(o.label){case 0:return r=t.map((function(t){return n.setItem(t[0],t[1],e)})),[4,Promise.all(r)];case 1:return o.sent(),[2]}}))}))},e.prototype.setItemsSync=function(t,e){void 0===e&&(e={userEmail:!0,organizationName:!0});for(var r=0,n=t;r<n.length;r++){var o=n[r];this.setItemSync(o[0],o[1],e)}},e.prototype.getItem=function(t){return __awaiter(this,arguments,void 0,(function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,this.getItemSync(t,e)]}))}))},e.prototype.getItemSync=function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),localStorage.getItem(this.getPrefixedKey(t,e))},e.prototype.getItems=function(t){return __awaiter(this,arguments,void 0,(function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,this.getItemsSync(t,e)]}))}))},e.prototype.getItemsSync=function(t,e){var r=this;return void 0===e&&(e={userEmail:!0,organizationName:!0}),t.map((function(t){return r.getItemSync(t,e)}))},e.prototype.getAll=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.getAllSync()]}))}))},e.prototype.getAllSync=function(){return Object.entries(localStorage)},e.prototype.deleteItem=function(t){return __awaiter(this,arguments,void 0,(function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,this.deleteItemSync(t,e)]}))}))},e.prototype.deleteItemSync=function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),localStorage.removeItem(this.getPrefixedKey(t,e))},e.prototype.deleteItems=function(t){return __awaiter(this,arguments,void 0,(function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,this.deleteItemsSync(t,e)]}))}))},e.prototype.deleteItemsSync=function(t,e){void 0===e&&(e={userEmail:!0,organizationName:!0});for(var r=0,n=t;r<n.length;r++){var o=n[r];this.deleteItemSync(o,e)}},e.prototype.hasItem=function(t){return __awaiter(this,arguments,void 0,(function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),__generator(this,(function(r){return[2,this.hasItemSync(t,e)]}))}))},e.prototype.hasItemSync=function(t,e){return void 0===e&&(e={userEmail:!0,organizationName:!0}),!!this.getItemSync(t,e)},e}(local_storage_service_interface_1.LocalStorageService);exports.WebLocalStorageService=WebLocalStorageService;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.APIObject=void 0;var APIObject=function(){function e(){}return e.fromAPIResponse=function(e){throw new Error("from-api-response-function not implemented for deriving class.")},e}();exports.APIObject=APIObject;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { BaseServiceClass } from "../services/base.service";
|
|
3
|
+
import { OauthHttpsService } from "../services/http/oauth-https.service";
|
|
4
|
+
import { OauthSessionService } from "../services/session/oauth-session.service";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract Authentication Configuration
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class AuthenticationConfig {
|
|
9
|
+
externalUserId?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Authentication configuration for OAuth Authentication.
|
|
13
|
+
*
|
|
14
|
+
* Contains the Configuration of the OAuth-Server as well as the necessary Platform-Adapters
|
|
15
|
+
*/
|
|
16
|
+
export declare class OauthAuthenticationConfig extends AuthenticationConfig {
|
|
17
|
+
oauthHttpsService: BaseServiceClass<OauthHttpsService>;
|
|
18
|
+
oauthSessionService: BaseServiceClass<OauthSessionService>;
|
|
19
|
+
clientId?: string;
|
|
20
|
+
redirectUrl?: string;
|
|
21
|
+
urlScheme?: string;
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
realm?: string;
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
constructor(init?: Partial<OauthAuthenticationConfig>);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Authentication configuration for OAuth Authentication with API-key.
|
|
29
|
+
*
|
|
30
|
+
* Contains the Configuration of the OAuth-Server as well as the necessary Platform-Adapters
|
|
31
|
+
*/
|
|
32
|
+
export declare class OauthApiKeyAuthenticationConfig extends AuthenticationConfig {
|
|
33
|
+
oauthHttpsService: BaseServiceClass<OauthHttpsService>;
|
|
34
|
+
oauthSessionService: BaseServiceClass<OauthSessionService>;
|
|
35
|
+
partiumApiBaseUrl?: string;
|
|
36
|
+
apiKey?: string;
|
|
37
|
+
constructor(init?: Partial<OauthApiKeyAuthenticationConfig>);
|
|
38
|
+
}
|
|
@@ -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,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.OauthApiKeyAuthenticationConfig=exports.OauthAuthenticationConfig=exports.AuthenticationConfig=void 0;var js_oauth_keycloak_https_service_1=require("../integration-defaults/http/js-oauth-keycloak-https.service"),js_oauth_api_key_session_service_1=require("../integration-defaults/session/js-oauth-api-key-session.service"),js_oauth_keycloak_session_service_1=require("../integration-defaults/session/js-oauth-keycloak-session.service"),AuthenticationConfig=function(){};exports.AuthenticationConfig=AuthenticationConfig;var OauthAuthenticationConfig=function(t){function e(e){var i=t.call(this)||this;return i.oauthHttpsService=js_oauth_keycloak_https_service_1.JSOauthKeycloakHttpsService,i.oauthSessionService=js_oauth_keycloak_session_service_1.JSOauthKeycloakSessionService,i.clientId="partium-customer-integration",i.redirectUrl="",i.baseUrl="https://login.partium.io",i.realm="partium",Object.assign(i,e),i}return __extends(e,t),e}(AuthenticationConfig);exports.OauthAuthenticationConfig=OauthAuthenticationConfig;var OauthApiKeyAuthenticationConfig=function(t){function e(e){var i=t.call(this)||this;return i.oauthHttpsService=js_oauth_keycloak_https_service_1.JSOauthKeycloakHttpsService,i.oauthSessionService=js_oauth_api_key_session_service_1.JSOauthPublicApiSessionService,i.partiumApiBaseUrl="https://api.partium.io",Object.assign(i,e),i}return __extends(e,t),e}(AuthenticationConfig);exports.OauthApiKeyAuthenticationConfig=OauthApiKeyAuthenticationConfig;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* Info about device and app installation.
|
|
4
|
+
* Used to emit an event log when a new search session is started and the user logs in.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DeviceInfo {
|
|
7
|
+
deviceId?: string;
|
|
8
|
+
manufacturer?: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
os?: string;
|
|
11
|
+
osVersion?: string;
|
|
12
|
+
sdkVersion?: string;
|
|
13
|
+
deviceType: string;
|
|
14
|
+
deviceLanguage?: string;
|
|
15
|
+
appVersionCode?: string;
|
|
16
|
+
appVersionName?: string;
|
|
17
|
+
appId?: string;
|
|
18
|
+
connectivityType?: string;
|
|
19
|
+
browserName?: string;
|
|
20
|
+
browserVersion?: string;
|
|
21
|
+
cpuArchitecture?: string;
|
|
22
|
+
engineName?: string;
|
|
23
|
+
engineVersion?: string;
|
|
24
|
+
/** @deprecated this value is not set anymore by the default SDK device-status service implementations */
|
|
25
|
+
partiumSdkVersion?: string;
|
|
26
|
+
/** @deprecated this value is not set anymore by the default SDK device-status service implementations */
|
|
27
|
+
appLanguage?: string;
|
|
28
|
+
constructor(init?: Partial<DeviceInfo>);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines the expected data structure for the `device_info` event log
|
|
32
|
+
*
|
|
33
|
+
* It contains `DeviceInfo` platform data and additional event log context.
|
|
34
|
+
*/
|
|
35
|
+
export interface DeviceInfoEventLogData extends DeviceInfo {
|
|
36
|
+
languageUi: string | null;
|
|
37
|
+
partiumSdkVersion: string;
|
|
38
|
+
searchSessionId: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Defines the expected data structure for the `user_session_info` event log
|
|
42
|
+
*
|
|
43
|
+
* It contains parts of the `DeviceInfo` platform data and additional event log context.
|
|
44
|
+
*/
|
|
45
|
+
export interface UserSessionInfoEventLogData {
|
|
46
|
+
deviceId?: string;
|
|
47
|
+
manufacturer?: string;
|
|
48
|
+
model?: string;
|
|
49
|
+
os?: string;
|
|
50
|
+
osVersion?: string;
|
|
51
|
+
deviceType: string;
|
|
52
|
+
deviceLanguage?: string;
|
|
53
|
+
appVersionCode?: string;
|
|
54
|
+
appVersionName?: string;
|
|
55
|
+
languageUi: string | null;
|
|
56
|
+
partiumSdkVersion: string;
|
|
57
|
+
browserName?: string;
|
|
58
|
+
browserVersion?: string;
|
|
59
|
+
cpuArchitecture?: string;
|
|
60
|
+
engineName?: string;
|
|
61
|
+
engineVersion?: string;
|
|
62
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeviceInfo=void 0;var DeviceInfo=function(e){var t=this;e&&Object.entries(e).forEach((function(e){var i=e[0],n=e[1],o=getSanitizedValue(n);t[i]="deviceType"===i?o||"unknown":o}))};exports.DeviceInfo=DeviceInfo;var getSanitizedValue=function(e){if("string"==typeof e)return e};
|