@partium/js-sdk 15.20.0 → 16.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/core/constants/constants.d.ts +1 -2
- package/core/constants/constants.js +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.js +1 -1
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +5 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -1
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -1
- package/core/integration-defaults/session/js-oauth-web-cookie-session.service.js +1 -1
- package/core/models/user.d.ts +7 -43
- package/core/models/user.js +1 -1
- package/core/services/http/https.service.interface.d.ts +18 -20
- package/core/services/http/https.service.interface.js +1 -1
- package/core/services/http/oauth-https.service.d.ts +3 -3
- package/core/services/local-storage.service.interface.d.ts +1 -1
- package/core/services/log.service.d.ts +1 -1
- package/core/services/organization/index.d.ts +6 -0
- package/core/services/organization/index.js +2 -0
- package/core/services/organization/models/get-organization-by-id-request.d.ts +10 -0
- package/core/services/organization/models/get-organization-by-name-request.d.ts +10 -0
- package/core/services/organization/models/get-organizations-request.d.ts +33 -0
- package/core/services/organization/models/get-organizations-request.js +2 -0
- package/core/services/organization/models/organization.d.ts +77 -0
- package/core/services/organization/models/organization.js +2 -0
- package/core/services/organization/organization.service.d.ts +81 -0
- package/core/services/organization/organization.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +1 -1
- package/core/services/session/session.service.interface.d.ts +17 -5
- package/core/services/session/session.service.interface.js +1 -1
- package/core/utils/general-helper.d.ts +2 -1
- package/core/utils/general-helper.js +1 -1
- package/core/utils/multipart-upload.helper.d.ts +20 -0
- package/core/utils/multipart-upload.helper.js +2 -0
- package/data/models/attribute.d.ts +5 -5
- package/data/models/attribute.js +1 -1
- package/data/models/csa-request.d.ts +2 -3
- package/data/models/csa-request.js +1 -1
- package/data/models/image.d.ts +10 -13
- package/data/models/image.js +1 -1
- package/data/models/part-data.d.ts +1 -1
- package/data/models/part.d.ts +13 -9
- package/data/models/part.js +1 -1
- package/data/services/customer-service-assistance.service.d.ts +3 -22
- package/data/services/customer-service-assistance.service.js +1 -1
- package/data/services/data.service.js +1 -1
- package/data/services/filter.service.d.ts +0 -21
- package/data/services/filter.service.js +1 -1
- package/enrichment/models/enrichment-job-part.d.ts +2 -2
- package/enrichment/models/enrichment-job-part.js +1 -1
- package/enrichment/models/enrichment-job.d.ts +2 -2
- package/enrichment/models/enrichment-job.js +1 -1
- package/find/index.d.ts +1 -28
- package/find/index.js +1 -1
- package/find/models/image-crop-area.d.ts +7 -0
- package/find/models/search-input.d.ts +11 -3
- package/find/models/search-input.js +1 -1
- package/find/services/asset.service.d.ts +41 -102
- package/find/services/asset.service.js +1 -1
- package/find/services/search/search.service.d.ts +5 -218
- package/find/services/search/search.service.js +1 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -1
- package/index.d.ts +14 -8
- package/index.js +1 -1
- package/ocr/index.d.ts +1 -2
- package/ocr/index.js +1 -1
- package/ocr/models/ocr-response.d.ts +5 -0
- package/ocr/models/ocr-response.js +2 -0
- package/ocr/services/ocr.service.d.ts +9 -15
- package/ocr/services/ocr.service.js +1 -1
- package/package.json +1 -1
- package/core/models/organization.d.ts +0 -127
- package/core/models/organization.js +0 -2
- package/core/services/organization.service.d.ts +0 -48
- package/core/services/organization.service.js +0 -2
- package/data/services/csa-helper.service.d.ts +0 -32
- package/data/services/csa-helper.service.js +0 -2
- package/find/models/assets/asset.d.ts +0 -24
- package/find/models/assets/asset.js +0 -2
- package/find/models/search-filter.d.ts +0 -87
- package/find/models/search-filter.js +0 -2
- package/find/models/search-result-status.d.ts +0 -33
- package/find/models/search-result-status.js +0 -2
- package/find/models/search-session-log-object.d.ts +0 -16
- package/find/models/search-session-log-object.js +0 -2
- package/find/models/search-status/cv-search-status.d.ts +0 -20
- package/find/models/search-status/cv-search-status.js +0 -2
- package/find/models/search-status/search-filter-status.d.ts +0 -33
- package/find/models/search-status/search-filter-status.js +0 -2
- package/find/models/search-status/search-status.d.ts +0 -34
- package/find/models/search-status/search-status.js +0 -2
- package/find/models/search-status/tag-search-status.d.ts +0 -16
- package/find/models/search-status/tag-search-status.js +0 -2
- package/find/models/search-status/text-search-status.d.ts +0 -15
- package/find/models/search-status/text-search-status.js +0 -2
- package/find/models/search-tag.d.ts +0 -12
- package/find/models/search-tag.js +0 -2
- package/find/models/tagable/i18n-tagable.d.ts +0 -10
- package/find/models/tagable/i18n-tagable.js +0 -2
- package/find/models/tagable/tagable-base.d.ts +0 -11
- package/find/models/tagable/tagable-base.js +0 -2
- package/find/models/tagable/tagable.d.ts +0 -10
- package/find/models/tagable/tagable.js +0 -2
- package/find/models/text-search-config.d.ts +0 -57
- package/find/models/text-search-config.js +0 -2
- package/find/models/text-search-manipulator.d.ts +0 -46
- package/find/models/text-search-manipulator.js +0 -2
- package/find/models/text-search-result-item/text-search-error.d.ts +0 -7
- package/find/models/text-search-result-item/text-search-error.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +0 -10
- package/find/models/text-search-result-item/text-search-result-item-document.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +0 -12
- package/find/models/text-search-result-item/text-search-result-item-part.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +0 -10
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +0 -12
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +0 -2
- package/find/models/text-search-result-item/text-search-result-item.d.ts +0 -16
- package/find/models/text-search-result-item/text-search-result-item.js +0 -2
- package/find/services/filter-uploaders/filter-uploader.d.ts +0 -13
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +0 -17
- package/find/services/filter-uploaders/update-filters-uploader.js +0 -2
- package/find/services/filter-uploaders/update-filters.model.d.ts +0 -19
- package/find/services/filter-uploaders/update-filters.model.js +0 -2
- package/find/services/search/cv-search.service.d.ts +0 -103
- package/find/services/search/cv-search.service.js +0 -2
- package/find/services/search/search-result.service.d.ts +0 -142
- package/find/services/search/search-result.service.js +0 -2
- package/find/services/search/tag-search.service.d.ts +0 -66
- package/find/services/search/tag-search.service.js +0 -2
- package/find/services/search/text-search.service.d.ts +0 -116
- package/find/services/search/text-search.service.js +0 -2
- package/find/services/search-filter.service.d.ts +0 -223
- package/find/services/search-filter.service.js +0 -2
- package/find/utils/search-helper.d.ts +0 -14
- package/find/utils/search-helper.js +0 -2
- package/ocr/models/detect-response.d.ts +0 -5
- package/ocr/models/detected-text-entry.d.ts +0 -5
- /package/{find/services/filter-uploaders/filter-uploader.js → core/services/organization/models/get-organization-by-id-request.js} +0 -0
- /package/{ocr/models/detect-response.js → core/services/organization/models/get-organization-by-name-request.js} +0 -0
- /package/{ocr/models/detected-text-entry.js → find/models/image-crop-area.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var e=function(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
|
|
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)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},__assign.apply(this,arguments)},__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 c=e.length-1;c>=0;c--)(n=e[c])&&(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{a(i.next(e))}catch(e){o(e)}}function c(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(s,c)}a((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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(t=1,i&&(n=2&c[0]?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,i=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){s.label=c[1];break}if(6===c[0]&&s.label<n[1]){s.label=n[1],n=c;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(c);break}n[2]&&s.ops.pop(),s.trys.pop();continue}c=r.call(e,s)}catch(e){c=[6,e],i=0}finally{t=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AssetServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../../core/decorators/injection-identifier"),error_1=require("../../core/models/error"),p_file_1=require("../../core/models/p-file"),base_login_init_service_1=require("../../core/services/base-login-init.service"),file_service_interface_1=require("../../core/services/file.service.interface"),file_transfer_service_interface_1=require("../../core/services/http/file-transfer/file-transfer.service.interface"),https_service_interface_1=require("../../core/services/http/https.service.interface"),log_service_1=require("../../core/services/log.service"),core_1=require("../../core"),multipart_upload_helper_1=require("../../core/utils/multipart-upload.helper"),AssetServiceImpl=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.fileTransferService=this.serviceProvider.getService(file_transfer_service_interface_1.FileTransferService),this.fileService=this.serviceProvider.getService(file_service_interface_1.FileService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},r.prototype.init=function(r,t,i){return e.prototype.init.call(this,r,t,i),(0,rxjs_1.of)(void 0)},r.prototype.uploadImage=function(e,r,t){var i=this;return(0,multipart_upload_helper_1.guardMultipartUpload)(e,(function(){return(0,rxjs_1.defer)((function(){return i.logImageDimensions(e,t),(0,multipart_upload_helper_1.postPFileImageMultipartRequest)(i.httpsService,{url:"/assets/images",image:e,input:r?{organization:r}:void 0,eventInterface:t.eventInterface})})).pipe((0,operators_1.map)((function(e){return e.assetId})))}))},r.prototype.downloadImage=function(e,r,t){var i=this;return void 0===r&&(r="original"),void 0===t&&(t=https_service_interface_1.BACKEND_SERVICE.PARTIUM),(t===https_service_interface_1.BACKEND_SERVICE.DATA?this.getDataImageUrl(e,r):this.getImageUrl(e,r)).pipe((0,operators_1.mergeMap)((function(e){return i.fileTransferService.downloadFile(e)})))},r.prototype.getImageDownloadUrls=function(e){return this.httpsService.get("assets/images/".concat(e),null,https_service_interface_1.BACKEND_SERVICE.PARTIUM).pipe((0,operators_1.map)((function(e){return e.urls})))},r.prototype.logImageDimensions=function(e,r){return __awaiter(this,void 0,void 0,(function(){var t,i,n,o;return __generator(this,(function(s){switch(s.label){case 0:return[4,this.fileService.getFileType(e)];case 1:if(s.sent()!==p_file_1.PFileType.IMAGE)return console.log("Wrong file type provided. Type IMAGE required."),[2];s.label=2;case 2:return s.trys.push([2,5,,6]),[4,this.fileService.getImageDimensions(e)];case 3:return t=s.sent(),i=t[0],n=t[1],[4,(0,rxjs_1.firstValueFrom)(this.logService.logEvent(new core_1.EventLog({version:core_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:r.organizationId,interface:r.eventInterface||core_1.INTERFACE.API_ACCESS,event:core_1.EVENT.ATTEMPT_UPLOAD_IMAGE_DIMENSIONS,data:__assign(__assign({},r.searchSessionId&&{searchSessionId:r.searchSessionId}),{width:i,height:n})})))];case 4:return s.sent(),[3,6];case 5:return o=s.sent(),console.log("Error while sending log event ".concat(core_1.EVENT.ATTEMPT_UPLOAD_IMAGE_DIMENSIONS,": "),o),[3,6];case 6:return[2]}}))}))},r.prototype.getImageUrl=function(e,r){var t=this;return this.getImageDownloadUrls(e).pipe((0,operators_1.map)((function(i){return t.resolveDownloadUrlForSize(i,e,r)})))},r.prototype.getDataImageUrl=function(e,r){var t=this;return this.httpsService.get("images/".concat(e),null,https_service_interface_1.BACKEND_SERVICE.DATA).pipe((0,operators_1.map)((function(i){return t.resolveDownloadUrlForSize(i.urls,e,r)})))},r.prototype.resolveDownloadUrlForSize=function(e,r,t){var i=null==e?void 0:e[t];if(!i)throw new error_1.SdkError(error_1.SDK_ERROR_CODES.NOT_FOUND,null,"Could not find image with id: ".concat(r," in size: ").concat(t));return i},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("AssetService")],r)}(base_login_init_service_1.BaseLoginInitService);exports.AssetServiceImpl=AssetServiceImpl;
|
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { TextSearchService, TextSearchServiceImpl } from './text-search.service';
|
|
3
|
-
import { CvSearchServiceImpl, CvSearchService } from './cv-search.service';
|
|
4
2
|
import { Observable } from 'rxjs';
|
|
5
|
-
import {
|
|
6
|
-
import { SearchFilter } from '../../models/search-filter';
|
|
7
|
-
import { SearchFilterServiceImpl, SearchFilterService } from '../search-filter.service';
|
|
8
|
-
import { SearchSessionLogObject } from '../../models/search-session-log-object';
|
|
9
|
-
import { CurResultList } from './search-result.service';
|
|
10
|
-
import { TagSearchService, TagSearchServiceImpl } from './tag-search.service';
|
|
11
|
-
import { SearchResultStatus } from '../../models/search-result-status';
|
|
12
|
-
import { SdkError } from '../../../core/models/error';
|
|
13
|
-
import { PFile } from '../../../core/models/p-file';
|
|
14
|
-
import { Part, PartFromFindAPI } from '../../../data/models/part';
|
|
3
|
+
import { PartFromPartiumAPI } from '../../../data/models/part';
|
|
15
4
|
import { ServiceProvider } from '../../../core/services/service-provider';
|
|
16
5
|
import { EventContext } from '../../../core/models/log';
|
|
17
6
|
import { RecentTextSearchQueriesService } from './recent-text-search-queries.service';
|
|
18
|
-
import {
|
|
7
|
+
import { SmartFilterFromAPI } from '../../models/smart-filter';
|
|
19
8
|
import { SearchInput } from '../../models/search-input';
|
|
20
9
|
import { SEARCH_OUTPUT_STATUS, SearchOutput } from '../../models/search-output';
|
|
21
10
|
import { BaseLoginInitService, Organization, PartiumConfig } from '../../../core';
|
|
22
|
-
import { ImageCropArea } from '../../models/
|
|
11
|
+
import { ImageCropArea } from '../../models/image-crop-area';
|
|
23
12
|
export interface SearchEventContext extends EventContext {
|
|
24
13
|
languageUi?: string;
|
|
25
|
-
searchSessionId?: string;
|
|
26
14
|
}
|
|
27
15
|
export interface SearchApiResponse {
|
|
28
16
|
sessionId: string;
|
|
29
17
|
resultsTotalCount: number;
|
|
30
|
-
results:
|
|
18
|
+
results: PartFromPartiumAPI[];
|
|
31
19
|
smartFilters?: SmartFilterFromAPI[];
|
|
32
20
|
imageId?: string;
|
|
33
21
|
status?: SEARCH_OUTPUT_STATUS;
|
|
@@ -57,9 +45,6 @@ export interface SearchApiResponse {
|
|
|
57
45
|
};
|
|
58
46
|
};
|
|
59
47
|
}
|
|
60
|
-
export interface ImageUploadApiResponse {
|
|
61
|
-
imageId: string;
|
|
62
|
-
}
|
|
63
48
|
interface FilterFromAPIResponse {
|
|
64
49
|
label: string;
|
|
65
50
|
values: string[];
|
|
@@ -67,159 +52,9 @@ interface FilterFromAPIResponse {
|
|
|
67
52
|
type SearchResultOptions = Record<string, string | number | boolean>;
|
|
68
53
|
/**
|
|
69
54
|
* This service is the central service for managing all search-related interaction.
|
|
70
|
-
* It
|
|
71
|
-
* Also it provides functionality for managing search-sessions, such as creating
|
|
72
|
-
* new search-sessions or retrieving the search-result.
|
|
73
|
-
*
|
|
74
|
-
* The search results are managed in the SearchResultService
|
|
55
|
+
* It allows to perform searches or load search-results from a previous search.
|
|
75
56
|
*/
|
|
76
57
|
export interface SearchService {
|
|
77
|
-
/**
|
|
78
|
-
* Start a new search session in the context of an organization. If there was already an active search session,
|
|
79
|
-
* the old one ends with the start of the new one. Only one search session can be active at the time.
|
|
80
|
-
*
|
|
81
|
-
* @param searchDomainId the id of the search domain
|
|
82
|
-
* @param filters (optional) search filters can either be directly passed when creating search, or later via the SearchFilterService
|
|
83
|
-
* @param searchLanguage (optional) language to use for the search. Only configured languages are allowed to be used.
|
|
84
|
-
* If not provided it defaults to a configured default language for an organization.
|
|
85
|
-
* Language is expected to be a two-letter string, according to ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
86
|
-
* @param searchEventContext (optional) SearchEventContext object to add the missing data that will be logged using the log format V2
|
|
87
|
-
* @returns Observable that resolves with the request to the backend
|
|
88
|
-
*
|
|
89
|
-
* @deprecated use performSearch instead
|
|
90
|
-
*/
|
|
91
|
-
startNewSearch(searchDomainId: string, filters?: Array<SearchFilter>, searchLanguage?: string, searchEventContext?: SearchEventContext): Observable<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Load an existing search session into the active search-state.
|
|
94
|
-
* This allows to load and continue an older search-session.
|
|
95
|
-
* It can also be used to only view the state of that search-session,
|
|
96
|
-
* including the last result-list.
|
|
97
|
-
*
|
|
98
|
-
* TODO This function is currently only used to load the search-results of an
|
|
99
|
-
* older search-session. Loading of the search-inputs is not fully working yet
|
|
100
|
-
* and should therefore not yet be used.
|
|
101
|
-
*
|
|
102
|
-
* @param searchSessionId the id of the search-session to load
|
|
103
|
-
*
|
|
104
|
-
* @beta
|
|
105
|
-
*
|
|
106
|
-
* @deprecated use performSearch instead
|
|
107
|
-
*/
|
|
108
|
-
loadExistingSearchSession(searchSessionId: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* Leave the currently active search-session.
|
|
111
|
-
* This will reset the state of the whole search-session, but the
|
|
112
|
-
* search-session will keep existing and can be continued at a later
|
|
113
|
-
* point, if desired.
|
|
114
|
-
*
|
|
115
|
-
* @deprecated use performSearch instead
|
|
116
|
-
*/
|
|
117
|
-
leaveCurrentSearchSession(): void;
|
|
118
|
-
/**
|
|
119
|
-
* Get an observable that always emits the whole currently available result list every
|
|
120
|
-
* time it changes.
|
|
121
|
-
*
|
|
122
|
-
* @returns Observable that emits an Array with the current result list every time it changes, or an SdkError when an error happens during processing of the search in the backend
|
|
123
|
-
*
|
|
124
|
-
* @deprecated use performSearch instead
|
|
125
|
-
*/
|
|
126
|
-
getCurResultList(): Observable<CurResultList | SdkError>;
|
|
127
|
-
/**
|
|
128
|
-
* Get an observable that always emits changes in the search-result-state.
|
|
129
|
-
* The initial state after creating a new search-session will be CREATED.
|
|
130
|
-
* While processing search-input the state will be RUNNING.
|
|
131
|
-
* Only when creation of search-results and creation of search-tags is finished,
|
|
132
|
-
* it will change to FINISHED.
|
|
133
|
-
*SearchFilterServiceImpl
|
|
134
|
-
* @returns Observable that emits changesSearchFilterServiceImpllt-state
|
|
135
|
-
*
|
|
136
|
-
* @deprecated use performSearch instead
|
|
137
|
-
*/
|
|
138
|
-
getSearchResultStatus(): Observable<SearchResultStatus>;
|
|
139
|
-
/**
|
|
140
|
-
* Get the ID of the current search session
|
|
141
|
-
*
|
|
142
|
-
* @returns the current search session id
|
|
143
|
-
*
|
|
144
|
-
* @deprecated use performSearch instead
|
|
145
|
-
*/
|
|
146
|
-
getCurSearchSessionID(): string;
|
|
147
|
-
/**
|
|
148
|
-
* Get an observable that always emits the current search session id every
|
|
149
|
-
* time it changes.
|
|
150
|
-
*
|
|
151
|
-
* @returns Observable that emits a string with the current search session id every time it changes
|
|
152
|
-
*
|
|
153
|
-
* @deprecated use performSearch instead
|
|
154
|
-
*/
|
|
155
|
-
getCurSearchSessionID$(): Observable<string>;
|
|
156
|
-
/**
|
|
157
|
-
* Get the SearchStatus object of the currently active search. It contains information about
|
|
158
|
-
* the active search session and all active search components.
|
|
159
|
-
*
|
|
160
|
-
* @returns the SearchStatus object, representing the current search
|
|
161
|
-
*
|
|
162
|
-
* @deprecated use performSearch instead
|
|
163
|
-
*/
|
|
164
|
-
getSearchStatus(): SearchStatus;
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated use performSearch instead
|
|
167
|
-
*/
|
|
168
|
-
getCurResultListLength(): number;
|
|
169
|
-
/**
|
|
170
|
-
* @deprecated use performSearch instead
|
|
171
|
-
*/
|
|
172
|
-
getCurResultListValue(): Array<Part>;
|
|
173
|
-
/**
|
|
174
|
-
* Log some other type of information to the currently active search session.
|
|
175
|
-
* (Other than that which is already logged automatically, like cv, ...)
|
|
176
|
-
* Can be used for questions, feedback...
|
|
177
|
-
*
|
|
178
|
-
* @deprecated use the LogService for logging
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
logToSearchSession(logObject: SearchSessionLogObject): Observable<void>;
|
|
182
|
-
/**
|
|
183
|
-
* Load more results of the current result list.
|
|
184
|
-
* The newly loaded results will emit via the getCurResultList-Observable,
|
|
185
|
-
* along with the already known results.
|
|
186
|
-
*
|
|
187
|
-
* @deprecated use performSearch instead
|
|
188
|
-
*/
|
|
189
|
-
loadMoreSearchResults(): void;
|
|
190
|
-
/**
|
|
191
|
-
* Get an Observable that always resolves with the latest search status
|
|
192
|
-
* when a search is performed.
|
|
193
|
-
*
|
|
194
|
-
* @returns Observable that always resolves with the latest search status whenever changed
|
|
195
|
-
*
|
|
196
|
-
* @deprecated use performSearch instead
|
|
197
|
-
*/
|
|
198
|
-
allSearchInputsEmpty(): Observable<boolean>;
|
|
199
|
-
/**
|
|
200
|
-
* Get an Observable that always emits the current Smart Filters every time they change.
|
|
201
|
-
*
|
|
202
|
-
* @returns Get an Observable that always emits the current Smart Filters every time they change
|
|
203
|
-
*
|
|
204
|
-
* @deprecated use performSearch instead
|
|
205
|
-
*/
|
|
206
|
-
getCurSmartFilters(): Observable<SmartFilter[]>;
|
|
207
|
-
/**
|
|
208
|
-
* @deprecated use performSearch instead
|
|
209
|
-
*/
|
|
210
|
-
text: TextSearchService;
|
|
211
|
-
/**
|
|
212
|
-
* @deprecated use performSearch instead
|
|
213
|
-
*/
|
|
214
|
-
cv: CvSearchService;
|
|
215
|
-
/**
|
|
216
|
-
* @deprecated use performSearch instead
|
|
217
|
-
*/
|
|
218
|
-
filter: SearchFilterService;
|
|
219
|
-
/**
|
|
220
|
-
* @deprecated use performSearch instead
|
|
221
|
-
*/
|
|
222
|
-
searchTag: TagSearchService;
|
|
223
58
|
recentTextSearchQueries: RecentTextSearchQueriesService;
|
|
224
59
|
/**
|
|
225
60
|
* Perform a search with the given input synchronously (uses the new synchronous Search-API).
|
|
@@ -243,74 +78,26 @@ export interface SearchService {
|
|
|
243
78
|
* @returns object of type SearchOutput that contains all search-details, such as search-input + result-list, smart-filters, ... (depending on projection)
|
|
244
79
|
*/
|
|
245
80
|
getSearchOutput(searchSessionId: string, projection?: string[], resultOptions?: SearchResultOptions, organizationName?: string): Observable<SearchOutput>;
|
|
246
|
-
/**
|
|
247
|
-
* Upload an image that can be reused in subsequent searches without uploading it again.
|
|
248
|
-
* The returned imageId can be passed as `searchImageAssetId` in the search-input of performSearch.
|
|
249
|
-
*
|
|
250
|
-
* Only available on platforms that support multipart-upload (see PFile.supportsMultipartUpload).
|
|
251
|
-
* On other platforms an SdkError with code MULTIPART_UPLOAD_NOT_SUPPORTED is emitted.
|
|
252
|
-
*
|
|
253
|
-
* @param searchImage the image to upload
|
|
254
|
-
* @param organizationName (optional) organization name to associate with the uploaded image.
|
|
255
|
-
* If not provided, the authenticated user's default organization is used by the backend.
|
|
256
|
-
* @param searchEventContext (optional) SearchEventContext object to add the missing data that will be logged using the log format V2.
|
|
257
|
-
* Pass a searchSessionId to associate the image-dimensions-log with an existing search-session.
|
|
258
|
-
* @returns Observable that resolves with the imageId of the uploaded image
|
|
259
|
-
*/
|
|
260
|
-
uploadSearchImage(searchImage: PFile, organizationName?: string, searchEventContext?: SearchEventContext): Observable<string>;
|
|
261
81
|
}
|
|
262
82
|
export declare class SearchServiceImpl extends BaseLoginInitService implements SearchService {
|
|
263
83
|
private httpsService;
|
|
264
|
-
private searchResultService;
|
|
265
84
|
private logService;
|
|
266
85
|
private deviceStatusService;
|
|
267
86
|
private organizationService;
|
|
268
|
-
private assetService;
|
|
269
|
-
private fileService;
|
|
270
|
-
private searchStatus;
|
|
271
|
-
private readonly searchSessionID$;
|
|
272
87
|
constructor(serviceProvider: ServiceProvider);
|
|
273
88
|
onCreate(): void;
|
|
274
89
|
/**
|
|
275
90
|
* Initializes the SearchService
|
|
276
91
|
*/
|
|
277
92
|
init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable<Organization>): Observable<void>;
|
|
278
|
-
get text(): TextSearchServiceImpl;
|
|
279
|
-
get cv(): CvSearchServiceImpl;
|
|
280
|
-
get filter(): SearchFilterServiceImpl;
|
|
281
|
-
get searchTag(): TagSearchServiceImpl;
|
|
282
93
|
get recentTextSearchQueries(): RecentTextSearchQueriesService;
|
|
283
|
-
startNewSearch(searchDomainId: string, filters?: Array<SearchFilter>, searchLanguage?: string, searchEventContext?: SearchEventContext): Observable<void>;
|
|
284
|
-
loadExistingSearchSession(searchSessionId: string): void;
|
|
285
|
-
leaveCurrentSearchSession(): void;
|
|
286
|
-
getCurResultList(): Observable<CurResultList | SdkError>;
|
|
287
|
-
getSearchResultStatus(): Observable<SearchResultStatus>;
|
|
288
|
-
getCurSearchSessionID(): string;
|
|
289
|
-
getCurSearchSessionID$(): Observable<string>;
|
|
290
|
-
getSearchStatus(): SearchStatus;
|
|
291
|
-
getCurResultListLength(): number;
|
|
292
|
-
getCurResultListValue(): Array<Part>;
|
|
293
|
-
logToSearchSession(logObject: SearchSessionLogObject): Observable<void>;
|
|
294
|
-
loadMoreSearchResults(): void;
|
|
295
|
-
allSearchInputsEmpty(): Observable<boolean>;
|
|
296
|
-
getCurSmartFilters(): Observable<SmartFilter[]>;
|
|
297
94
|
performSearch(searchInput: SearchInput, searchEventContext?: SearchEventContext, projection?: string[], resultOptions?: SearchResultOptions, skipDeviceInfoEventLog?: boolean): Observable<SearchOutput>;
|
|
298
95
|
getSearchOutput(searchSessionId: string, projection?: string[], resultOptions?: SearchResultOptions, organizationName?: string): Observable<SearchOutput>;
|
|
299
|
-
uploadSearchImage(searchImage: PFile, organizationName?: string, searchEventContext?: SearchEventContext): Observable<string>;
|
|
300
|
-
/**
|
|
301
|
-
* Log the dimensions of an upload-attempted search-image (analogue to the image-dimensions-log in the AssetService).
|
|
302
|
-
* Fire-and-forget: failures only get logged to the console and never affect the upload itself.
|
|
303
|
-
*/
|
|
304
|
-
private logSearchImageDimensions;
|
|
305
96
|
private logDeviceInfo;
|
|
306
97
|
private getOrganizationId;
|
|
307
98
|
private prepareFilters;
|
|
308
99
|
private processSearchApiResponse;
|
|
309
100
|
private removeDuplicatesFromArray;
|
|
310
|
-
/**
|
|
311
|
-
* TODO used for backwards-compatibility, can be removed when SearchStatus is deleted
|
|
312
|
-
*/
|
|
313
|
-
private updateSearchStatus;
|
|
314
101
|
/**
|
|
315
102
|
* Add text-searches to recent text-searches if set
|
|
316
103
|
* @param searchInput the new search-input
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(e,t,r,s){var a,i=arguments.length,c=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var n=e.length-1;n>=0;n--)(a=e[n])&&(c=(i<3?a(c):i>3?a(t,r,c):a(t,r))||c);return i>3&&c&&Object.defineProperty(t,r,c),c},__awaiter=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(a,i){function c(e){try{o(s.next(e))}catch(e){i(e)}}function n(e){try{o(s.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,n)}o((s=s.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,s,a,i,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function n(n){return function(o){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,n[0]&&(c=0)),c;)try{if(r=1,s&&(a=2&n[0]?s.return:n[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,n[1])).done)return a;switch(s=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,s=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(a=c.trys,(a=a.length>0&&a[a.length-1])||6!==n[0]&&2!==n[0])){c=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){c.label=n[1];break}if(6===n[0]&&c.label<a[1]){c.label=a[1],a=n;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(n);break}a[2]&&c.ops.pop(),c.trys.pop();continue}n=t.call(e,c)}catch(e){n=[6,e],s=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,o])}}},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var s,a=0,i=t.length;a<i;a++)!s&&a in t||(s||(s=Array.prototype.slice.call(t,0,a)),s[a]=t[a]);return e.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SearchServiceImpl=void 0;var text_search_service_1=require("./text-search.service"),cv_search_service_1=require("./cv-search.service"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),search_status_1=require("../../models/search-status/search-status"),search_filter_1=require("../../models/search-filter"),search_filter_service_1=require("../search-filter.service"),search_result_service_1=require("./search-result.service"),tag_search_service_1=require("./tag-search.service"),search_result_status_1=require("../../models/search-result-status"),sdk_version_1=require("../../../gen/sdk-version"),error_1=require("../../../core/models/error"),part_1=require("../../../data/models/part"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),log_service_1=require("../../../core/services/log.service"),device_status_service_interface_1=require("../../../core/services/device-status.service.interface"),log_1=require("../../../core/models/log"),recent_text_search_queries_service_1=require("./recent-text-search-queries.service"),smart_filter_1=require("../../models/smart-filter"),core_1=require("../../../core"),cv_search_status_1=require("../../models/search-status/cv-search-status"),asset_service_1=require("../asset.service"),asset_1=require("../../models/assets/asset"),text_search_status_1=require("../../models/search-status/text-search-status"),search_filter_status_1=require("../../models/search-status/search-filter-status"),tag_search_status_1=require("../../models/search-status/tag-search-status"),SearchServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.searchStatus=new search_status_1.SearchStatus,r.searchSessionID$=new rxjs_1.BehaviorSubject(""),r}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.searchResultService=this.serviceProvider.getService(search_result_service_1.SearchResultService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService),this.organizationService=this.serviceProvider.getService(core_1.OrganizationService),this.assetService=this.serviceProvider.getService(asset_service_1.AssetServiceImpl),this.fileService=this.serviceProvider.getService(core_1.FileService)},t.prototype.init=function(t,r,s){return e.prototype.init.call(this,t,r,s),(0,rxjs_1.of)(void 0)},Object.defineProperty(t.prototype,"text",{get:function(){return this.serviceProvider.getService(text_search_service_1.TextSearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cv",{get:function(){return this.serviceProvider.getService(cv_search_service_1.CvSearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this.serviceProvider.getService(search_filter_service_1.SearchFilterServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"searchTag",{get:function(){return this.serviceProvider.getService(tag_search_service_1.TagSearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"recentTextSearchQueries",{get:function(){return this.serviceProvider.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl)},enumerable:!1,configurable:!0}),t.prototype.startNewSearch=function(e,t,r,s){var a=this;this.searchStatus=new search_status_1.SearchStatus(e),this.searchSessionID$.next(this.searchStatus.searchSessionID),this.filter.reset(this.searchStatus),this.cv.reset(this.searchStatus),this.text.reset(this.searchStatus),this.searchTag.reset(this.searchStatus),this.searchResultService.reset(this.searchStatus);var i={};return r&&(i.language=r),s&&s.languageUi&&(i.languageUi=s.languageUi),this.httpsService.post("domains/".concat(this.searchStatus.searchDomainId,"/search"),i).pipe((0,operators_1.tap)((function(e){return __awaiter(a,void 0,void 0,(function(){var t,r,a;return __generator(this,(function(i){switch(i.label){case 0:return this.searchStatus.searchSessionID=e.searchSessionId,this.searchStatus.searchLanguage=e.language,this.searchSessionID$.next(this.searchStatus.searchSessionID),console.log("SearchService - New Search: ".concat(this.searchStatus.searchSessionID)),[4,this.deviceStatusService.getDeviceInfo()];case 1:return t=i.sent(),r=__assign(__assign({},t),{partiumSdkVersion:sdk_version_1.SDK_VERSION_NUMBER,languageUi:(null==s?void 0:s.languageUi)||null,searchSessionId:this.searchStatus.searchSessionID}),a=this.searchStatus.searchDomainId,this.logService.logEvent(new log_1.EventLog({organizationId:a,version:log_1.EVENTLOG_VERSIONS.V_2_0_0,interface:(null==s?void 0:s.eventInterface)||log_1.INTERFACE.API_ACCESS,event:log_1.EVENT.DEVICE_INFO,data:r})).subscribe({next:function(){},error:function(e){console.error("Error while sending log event ".concat(log_1.EVENT.DEVICE_INFO,": "),e)}}),[2]}}))}))})),(0,operators_1.mergeMap)((function(e){return t&&t.length>0?a.filter.setSearchFilters(t):(0,rxjs_1.of)(void 0)})),(0,operators_1.catchError)((function(e){return a.searchStatus=new search_status_1.SearchStatus,a.searchSessionID$.next(""),(0,rxjs_1.throwError)((function(){return e}))})))},t.prototype.loadExistingSearchSession=function(e){this.searchStatus=new search_status_1.SearchStatus,this.searchStatus.searchSessionID=e,this.searchSessionID$.next(this.searchStatus.searchSessionID),this.filter.reset(this.searchStatus),this.cv.reset(this.searchStatus),this.text.reset(this.searchStatus),this.searchTag.reset(this.searchStatus),this.searchResultService.reset(this.searchStatus),this.searchResultService.startPollingForResults()},t.prototype.leaveCurrentSearchSession=function(){var e;this.searchStatus=new search_status_1.SearchStatus,this.searchSessionID$.next(this.searchStatus.searchSessionID),this.filter.reset(this.searchStatus),this.cv.reset(this.searchStatus),this.text.reset(this.searchStatus),this.searchTag.reset(this.searchStatus),null===(e=this.searchResultService)||void 0===e||e.reset(this.searchStatus)},t.prototype.getCurResultList=function(){return this.searchResultService.getCurResultList()},t.prototype.getSearchResultStatus=function(){return this.searchResultService.getSearchResultStatus()},t.prototype.getCurSearchSessionID=function(){return this.searchStatus.searchSessionID||""},t.prototype.getCurSearchSessionID$=function(){return this.searchSessionID$.asObservable()},t.prototype.getSearchStatus=function(){return this.searchStatus},t.prototype.getCurResultListLength=function(){return this.searchResultService.getCurResultListLength()},t.prototype.getCurResultListValue=function(){return this.searchResultService.getCurResultListValue()},t.prototype.logToSearchSession=function(e){return this.httpsService.post("search/".concat(this.getCurSearchSessionID(),"/log"),e)},t.prototype.loadMoreSearchResults=function(){this.searchResultService.loadMoreResults()},t.prototype.allSearchInputsEmpty=function(){return(0,rxjs_1.combineLatest)([this.text.getSearchQueries().pipe((0,operators_1.map)((function(e){return Object.values(e).some((function(e){return e}))}))),this.cv.getCvImageValue().pipe((0,operators_1.map)((function(e){return!!e}))),this.filter.getFilters().pipe((0,operators_1.map)((function(e){return Object.values(e).some((function(e){return e}))})))]).pipe((0,operators_1.switchMap)((function(e){var t=e[0],r=e[1],s=e[2];return(0,rxjs_1.of)(!t&&!r&&!s)})))},t.prototype.getCurSmartFilters=function(){return this.searchResultService.getSmartFilters()},t.prototype.performSearch=function(e,t,r,s,a){var i,c,n,o,u=this;void 0===r&&(r=["smartFilters","results.id","results.partiumId","results.name","request"]),void 0===s&&(s={limit:25}),void 0===a&&(a=!1);var h,l=__assign(__assign(__assign(__assign(__assign({language:e.searchLanguage},e.searchSessionId&&{sessionId:e.searchSessionId}),{matches:__assign(__assign(__assign(__assign(__assign(__assign(__assign({organization:e.organizationName},(e.text||(null===(i=e.searchQueries)||void 0===i?void 0:i.semanticText))&&{text:e.text||(null===(c=e.searchQueries)||void 0===c?void 0:c.semanticText)}),(null===(n=e.searchQueries)||void 0===n?void 0:n.exactText)&&{exact:null===(o=e.searchQueries)||void 0===o?void 0:o.exactText}),e.hierarchyFilters&&{hierarchyPartiumIds:e.hierarchyFilters}),e.attributeFilters&&{filters:this.prepareFilters(e.attributeFilters)}),e.similarTo&&{similarTo:e.similarTo}),e.duplicateOf&&{duplicateOf:e.duplicateOf}),e.hasRelatedParts&&{hasRelatedParts:e.hasRelatedParts})}),e.searchImageAssetId&&{reusableImageId:e.searchImageAssetId}),(e.searchImageAssetId||e.searchImage)&&e.searchImageCropArea&&{imageOptions:{areaOfInterest:e.searchImageCropArea}}),{projection:this.removeDuplicatesFromArray(__spreadArray(__spreadArray([],r,!0),["request"],!1)),resultOptions:s});if(this.updateRecentTextSearch(e),e.searchImage)if(e.searchImage.supportsMultipartUpload()){var _=new FormData;_.append("input",JSON.stringify(l)),e.searchImage.appendToFormData("image",_),h=this.httpsService.post("/find/search",_,void 0,https_service_interface_1.BACKEND_SERVICE.PARTIUM,{"Content-Type":"multipart/form-data","X-Partium-Interface":(null==t?void 0:t.eventInterface)||log_1.INTERFACE.API_ACCESS})}else h=this.getOrganizationId(e.organizationName).pipe((0,operators_1.first)(),(0,operators_1.switchMap)((function(r){return u.assetService.generateAsset(r,e.searchImage,{eventInterface:null==t?void 0:t.eventInterface})})),(0,operators_1.filter)((function(e){return e.asset.getStatus()===asset_1.ASSET_STATUS.VERIFIED})),(0,operators_1.first)(),(0,operators_1.map)((function(e){return e.asset.referenceId})),(0,operators_1.switchMap)((function(e){return e&&(l.reusableImageId=e),u.httpsService.post("/find/search",l,void 0,https_service_interface_1.BACKEND_SERVICE.PARTIUM,{"X-Partium-Interface":(null==t?void 0:t.eventInterface)||log_1.INTERFACE.API_ACCESS})})));else h=this.httpsService.post("/find/search",l,void 0,https_service_interface_1.BACKEND_SERVICE.PARTIUM,{"X-Partium-Interface":(null==t?void 0:t.eventInterface)||log_1.INTERFACE.API_ACCESS});return h.pipe((0,operators_1.map)((function(t){var r=u.processSearchApiResponse(t);return r.searchInput.searchImage=e.searchImage,r})),(0,operators_1.switchMap)((function(t){return u.getOrganizationId(e.organizationName).pipe((0,operators_1.map)((function(e){return{organizationId:e,searchOutput:t}})))})),(0,operators_1.tap)((function(r){var s,i=r.searchOutput,c=r.organizationId;u.updateSearchStatus(i,c),e.searchSessionId||a||u.logDeviceInfo(null!==(s=i.searchInput.searchSessionId)&&void 0!==s?s:"",c,t)})),(0,operators_1.map)((function(e){return e.searchOutput})))},t.prototype.getSearchOutput=function(e,t,r,s){var a=this;return void 0===t&&(t=["smartFilters","results.id","results.partiumId","results.name","request"]),void 0===r&&(r={limit:25}),(s?(0,rxjs_1.of)(s):this.currentOrganization$.pipe((0,operators_1.map)((function(e){return e.name})))).pipe((0,operators_1.switchMap)((function(s){return a.httpsService.get("/find/search/state/".concat(e),__spreadArray([{projection:a.removeDuplicatesFromArray(__spreadArray(__spreadArray([],t,!0),["request"],!1))},{organization:s}],Object.keys(r).map((function(e){var t;return(t={})[e]=r[e],t})),!0),https_service_interface_1.BACKEND_SERVICE.PARTIUM)})),(0,operators_1.map)((function(e){return a.processSearchApiResponse(e)})))},t.prototype.uploadSearchImage=function(e,t,r){var s=this;if(!e.supportsMultipartUpload())return(0,rxjs_1.throwError)((function(){return new error_1.SdkError(error_1.SDK_ERROR_CODES.MULTIPART_UPLOAD_NOT_SUPPORTED,{},"Standalone image-upload is only available on platforms that support multipart-upload. Pass the image directly to performSearch instead.")}));var a=new FormData;return t&&a.append("input",JSON.stringify({organization:t})),e.appendToFormData("image",a),(0,rxjs_1.defer)((function(){return s.logSearchImageDimensions(e,t,r),s.httpsService.post("/find/images",a,void 0,https_service_interface_1.BACKEND_SERVICE.PARTIUM,{"Content-Type":"multipart/form-data","X-Partium-Interface":(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS})})).pipe((0,operators_1.map)((function(e){return e.imageId})))},t.prototype.logSearchImageDimensions=function(e,t,r){var s=this,a=t?this.getOrganizationId(t):this.currentOrganization$.pipe((0,operators_1.map)((function(e){return e.partiumId})));(0,rxjs_1.combineLatest)([a,(0,rxjs_1.from)(this.fileService.getImageDimensions(e))]).pipe((0,operators_1.first)(),(0,operators_1.mergeMap)((function(e){var t=e[0],a=e[1],i=a[0],c=a[1];return s.logService.logEvent(new log_1.EventLog({organizationId:t,version:log_1.EVENTLOG_VERSIONS.V_2_0_0,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:log_1.EVENT.ATTEMPT_UPLOAD_IMAGE_DIMENSIONS,data:__assign(__assign({},(null==r?void 0:r.searchSessionId)&&{searchSessionId:r.searchSessionId}),{width:i,height:c})}))}))).subscribe({error:function(e){console.error("Error while sending log event ".concat(log_1.EVENT.ATTEMPT_UPLOAD_IMAGE_DIMENSIONS,": "),e)}})},t.prototype.logDeviceInfo=function(e,t,r){var s=this;this.deviceStatusService.getDeviceInfo().then((function(a){var i=__assign(__assign({},a),{partiumSdkVersion:sdk_version_1.SDK_VERSION_NUMBER,languageUi:(null==r?void 0:r.languageUi)||null,searchSessionId:e});s.logService.logEvent(new log_1.EventLog({organizationId:t,version:log_1.EVENTLOG_VERSIONS.V_2_0_0,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:log_1.EVENT.DEVICE_INFO,data:i})).subscribe({next:function(){},error:function(e){console.error("Error while sending log event ".concat(log_1.EVENT.DEVICE_INFO,": "),e)}})}))},t.prototype.getOrganizationId=function(e){return(0,rxjs_1.from)(this.organizationService.getOrganizations()).pipe((0,operators_1.map)((function(t){for(var r=0,s=t;r<s.length;r++){var a=s[r];if(a.name.toLowerCase()===e.toLowerCase())return a.partiumId}return""})))},t.prototype.prepareFilters=function(e){return Object.keys(e).map((function(t){return{label:t,values:e[t].map((function(e){return e}))}}))},t.prototype.processSearchApiResponse=function(e){var t,r,s,a,i,c,n,o,u,h,l,_,S,p,v,g,d,f=null!==(r=null===(t=e.request)||void 0===t?void 0:t.language)&&void 0!==r?r:"",I=null!==(i=null===(a=null===(s=e.request)||void 0===s?void 0:s.matches)||void 0===a?void 0:a.organization)&&void 0!==i?i:"";return __assign(__assign({searchInput:__assign({organizationName:I,searchLanguage:f,searchSessionId:e.sessionId},e.request&&{text:null===(c=e.request.matches)||void 0===c?void 0:c.text,searchQueries:{exactText:null===(n=e.request.matches)||void 0===n?void 0:n.exact,semanticText:null===(o=e.request.matches)||void 0===o?void 0:o.text},searchImageAssetId:e.request.reusableImageId||e.imageId,searchImageCropArea:null===(u=e.request.imageOptions)||void 0===u?void 0:u.areaOfInterest,hierarchyFilters:null===(h=e.request.matches)||void 0===h?void 0:h.hierarchyPartiumIds,attributeFilters:null===(_=null===(l=e.request.matches)||void 0===l?void 0:l.filters)||void 0===_?void 0:_.reduce((function(e,t){var r;return __assign(__assign({},e),((r={})[t.label]=t.values,r))}),{}),similarTo:null===(S=e.request.matches)||void 0===S?void 0:S.similarTo,duplicateOf:null===(p=e.request.matches)||void 0===p?void 0:p.duplicateOf,hasRelatedParts:null===(v=e.request.matches)||void 0===v?void 0:v.hasRelatedParts}),resultsTotalCount:e.resultsTotalCount,searchResults:e.results.map((function(e){return part_1.Part.fromAPIResponse(e,part_1.DATA_ORIGIN.FIND_API,f)}))},e.status&&{status:e.status}),{smartFilters:null!==(d=null===(g=e.smartFilters)||void 0===g?void 0:g.map((function(e){return smart_filter_1.SmartFilter.fromAPIResponse(e)})))&&void 0!==d?d:[]})},t.prototype.removeDuplicatesFromArray=function(e){return Array.from(new Set(e))},t.prototype.updateSearchStatus=function(e,t){var r,s,a,i,c,n,o;this.searchStatus=this.searchStatus||new search_status_1.SearchStatus,this.searchStatus.searchDomainId=t,this.searchStatus.searchSessionID=null!==(r=e.searchInput.searchSessionId)&&void 0!==r?r:"",this.searchSessionID$.next(this.searchStatus.searchSessionID),this.searchStatus.searchLanguage=null!==(s=e.searchInput.searchLanguage)&&void 0!==s?s:null,this.searchStatus.curResultList=e.searchResults,this.searchStatus.textSearchStatus=this.searchStatus.textSearchStatus||new text_search_status_1.TextSearchStatus,this.searchStatus.textSearchStatus.searchQuery=null!==(a=e.searchInput.text)&&void 0!==a?a:"",this.searchStatus.textSearchStatus.searchQueries=null!==(i=e.searchInput.searchQueries)&&void 0!==i?i:{},this.searchStatus.cvSearchStatus=this.searchStatus.cvSearchStatus||new cv_search_status_1.CVSearchStatus,this.searchStatus.cvSearchStatus.assetId=null!==(c=e.searchInput.searchImageAssetId)&&void 0!==c?c:"",this.searchStatus.cvSearchStatus.cvImage=e.searchInput.searchImage?new asset_1.Asset(e.searchInput.searchImage):null,this.searchStatus.cvSearchStatus.cropArea=e.searchInput.searchImageCropArea,this.searchStatus.filterStatus=this.searchStatus.filterStatus||new search_filter_status_1.SearchFilterStatus;var u=null!==(n=e.searchInput.hierarchyFilters)&&void 0!==n?n:[],h=null!==(o=e.searchInput.attributeFilters)&&void 0!==o?o:{};this.searchStatus.filterStatus.filters=__spreadArray(__spreadArray([],u.length>0?[new search_filter_1.HierarchyPartiumIdFilter(u,[])]:[],!0),Object.keys(h).map((function(e){return new search_filter_1.KvpHardFilter(e,e,h[e])})),!0),this.searchStatus.filterStatus.filtersMap=this.searchStatus.filterStatus.filters.reduce((function(e,t){var r;return __assign(__assign({},e),((r={})[t.key]=t,r))}),{}),this.searchStatus.filterStatus.excludedHierarchyNodes={},this.searchStatus.tagSearchStatus=this.searchStatus.tagSearchStatus||new tag_search_status_1.TagSearchStatus,this.searchStatus.tagSearchStatus.proposedSearchTags=[],this.searchStatus.searchResultStatus=this.searchStatus.searchResultStatus||new search_result_status_1.SearchResultStatus,this.searchStatus.searchResultStatus.status=search_result_status_1.SEARCH_RESULT_STATUS.FINISHED,this.searchStatus.searchResultStatus.asyncTagsStatus=search_result_status_1.ASYNC_TAG_STATUS.WILL_NOT_RECEIVE,this.searchStatus.searchResultStatus.asyncResultsStatus=search_result_status_1.ASYNC_RESULT_STATUS.RECEIVED,this.searchStatus.searchResultStatus.asyncSmartFiltersStatus=search_result_status_1.SMART_FILTERS_STATUS.WILL_NOT_RECEIVE},t.prototype.updateRecentTextSearch=function(e){e.searchQueries&&e.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC]&&this.recentTextSearchQueries.addSemanticTextQuery(e.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC]),e.searchQueries&&e.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.EXACT]&&(this.recentTextSearchQueries.addExactTextQuery(e.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.EXACT]),this.recentTextSearchQueries.addQuery(e.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.EXACT])),e.text&&this.recentTextSearchQueries.addQuery(e.text)},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("SearchService")],t)}(core_1.BaseLoginInitService);exports.SearchServiceImpl=SearchServiceImpl;
|
|
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)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var s in r=arguments[t])Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);return e},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(e,r,t,i){var s,a=arguments.length,n=a<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,r,t,i);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(n=(a<3?s(n):a>3?s(r,t,n):s(r,t))||n);return a>3&&n&&Object.defineProperty(r,t,n),n},__spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var i,s=0,a=r.length;s<a;s++)!i&&s in r||(i||(i=Array.prototype.slice.call(r,0,s)),i[s]=r[s]);return e.concat(i||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SearchServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),sdk_version_1=require("../../../gen/sdk-version"),part_1=require("../../../data/models/part"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),log_service_1=require("../../../core/services/log.service"),device_status_service_interface_1=require("../../../core/services/device-status.service.interface"),log_1=require("../../../core/models/log"),recent_text_search_queries_service_1=require("./recent-text-search-queries.service"),smart_filter_1=require("../../models/smart-filter"),search_input_1=require("../../models/search-input"),core_1=require("../../../core"),multipart_upload_helper_1=require("../../../core/utils/multipart-upload.helper"),SearchServiceImpl=function(e){function r(r){return e.call(this,r)||this}return __extends(r,e),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService),this.organizationService=this.serviceProvider.getService(core_1.OrganizationServiceImpl)},r.prototype.init=function(r,t,i){return e.prototype.init.call(this,r,t,i),(0,rxjs_1.of)(void 0)},Object.defineProperty(r.prototype,"recentTextSearchQueries",{get:function(){return this.serviceProvider.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl)},enumerable:!1,configurable:!0}),r.prototype.performSearch=function(e,r,t,i,s){var a,n,o,c,u=this;void 0===t&&(t=["smartFilters","results.id","results.partiumId","results.name","request"]),void 0===i&&(i={limit:25}),void 0===s&&(s=!1);var l=__assign(__assign(__assign(__assign(__assign({language:e.searchLanguage},e.searchSessionId&&{sessionId:e.searchSessionId}),{matches:__assign(__assign(__assign(__assign(__assign(__assign(__assign({organization:e.organizationName},(e.text||(null===(a=e.searchQueries)||void 0===a?void 0:a.semanticText))&&{text:e.text||(null===(n=e.searchQueries)||void 0===n?void 0:n.semanticText)}),(null===(o=e.searchQueries)||void 0===o?void 0:o.exactText)&&{exact:null===(c=e.searchQueries)||void 0===c?void 0:c.exactText}),e.hierarchyFilters&&{hierarchyPartiumIds:e.hierarchyFilters}),e.attributeFilters&&{filters:this.prepareFilters(e.attributeFilters)}),e.similarTo&&{similarTo:e.similarTo}),e.duplicateOf&&{duplicateOf:e.duplicateOf}),e.hasRelatedParts&&{hasRelatedParts:e.hasRelatedParts})}),e.searchImageAssetId&&{reusableImageId:e.searchImageAssetId}),(e.searchImageAssetId||e.searchImage)&&e.searchImageCropArea&&{imageOptions:{areaOfInterest:e.searchImageCropArea}}),{projection:this.removeDuplicatesFromArray(__spreadArray(__spreadArray([],t,!0),["request"],!1)),resultOptions:i});return this.updateRecentTextSearch(e),(e.searchImage?(0,multipart_upload_helper_1.guardMultipartUpload)(e.searchImage,(function(){return(0,multipart_upload_helper_1.postPFileImageMultipartRequest)(u.httpsService,{url:"/find/search",image:e.searchImage,input:l,eventInterface:null==r?void 0:r.eventInterface})})):this.httpsService.post("/find/search",l,void 0,https_service_interface_1.BACKEND_SERVICE.PARTIUM,{"X-Partium-Interface":(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS})).pipe((0,operators_1.map)((function(r){var t=u.processSearchApiResponse(r);return t.searchInput.searchImage=e.searchImage,t})),(0,operators_1.tap)((function(t){e.searchSessionId||s||u.getOrganizationId(e.organizationName).subscribe({next:function(e){var i;u.logDeviceInfo(null!==(i=t.searchInput.searchSessionId)&&void 0!==i?i:"",e,r)},error:function(e){console.error("Error while resolving organization for device info log: ",e)}})})))},r.prototype.getSearchOutput=function(e,r,t,i){var s=this;return void 0===r&&(r=["smartFilters","results.id","results.partiumId","results.name","request"]),void 0===t&&(t={limit:25}),(i?(0,rxjs_1.of)(i):this.currentOrganization$.pipe((0,operators_1.map)((function(e){return e.name})))).pipe((0,operators_1.switchMap)((function(i){return s.httpsService.get("/find/search/state/".concat(e),(0,core_1.toQueryParams)(__assign({projection:s.removeDuplicatesFromArray(__spreadArray(__spreadArray([],r,!0),["request"],!1)),organization:i},t)),https_service_interface_1.BACKEND_SERVICE.PARTIUM)})),(0,operators_1.map)((function(e){return s.processSearchApiResponse(e)})))},r.prototype.logDeviceInfo=function(e,r,t){var i=this;this.deviceStatusService.getDeviceInfo().then((function(s){var a=__assign(__assign({},s),{partiumSdkVersion:sdk_version_1.SDK_VERSION_NUMBER,languageUi:(null==t?void 0:t.languageUi)||null,searchSessionId:e});i.logService.logEvent(new log_1.EventLog({organizationId:r,version:log_1.EVENTLOG_VERSIONS.V_2_0_0,interface:(null==t?void 0:t.eventInterface)||log_1.INTERFACE.API_ACCESS,event:log_1.EVENT.DEVICE_INFO,data:a})).subscribe({next:function(){},error:function(e){console.error("Error while sending log event ".concat(log_1.EVENT.DEVICE_INFO,": "),e)}})}))},r.prototype.getOrganizationId=function(e){return this.organizationService.getOrganizationByName({name:e}).pipe((0,operators_1.map)((function(e){return e.partiumId})))},r.prototype.prepareFilters=function(e){return Object.keys(e).map((function(r){return{label:r,values:e[r].map((function(e){return e}))}}))},r.prototype.processSearchApiResponse=function(e){var r,t,i,s,a,n,o,c,u,l,_,p,h,d,v,g,f,m=null!==(t=null===(r=e.request)||void 0===r?void 0:r.language)&&void 0!==t?t:"",I=null!==(a=null===(s=null===(i=e.request)||void 0===i?void 0:i.matches)||void 0===s?void 0:s.organization)&&void 0!==a?a:"";return __assign(__assign({searchInput:__assign({organizationName:I,searchLanguage:m,searchSessionId:e.sessionId},e.request&&{text:null===(n=e.request.matches)||void 0===n?void 0:n.text,searchQueries:{exactText:null===(o=e.request.matches)||void 0===o?void 0:o.exact,semanticText:null===(c=e.request.matches)||void 0===c?void 0:c.text},searchImageAssetId:e.request.reusableImageId||e.imageId,searchImageCropArea:null===(u=e.request.imageOptions)||void 0===u?void 0:u.areaOfInterest,hierarchyFilters:null===(l=e.request.matches)||void 0===l?void 0:l.hierarchyPartiumIds,attributeFilters:null===(p=null===(_=e.request.matches)||void 0===_?void 0:_.filters)||void 0===p?void 0:p.reduce((function(e,r){var t;return __assign(__assign({},e),((t={})[r.label]=r.values,t))}),{}),similarTo:null===(h=e.request.matches)||void 0===h?void 0:h.similarTo,duplicateOf:null===(d=e.request.matches)||void 0===d?void 0:d.duplicateOf,hasRelatedParts:null===(v=e.request.matches)||void 0===v?void 0:v.hasRelatedParts}),resultsTotalCount:e.resultsTotalCount,searchResults:e.results.map((function(e){return part_1.Part.fromAPIResponse(e,part_1.DATA_ORIGIN.PARTIUM_API,m)}))},e.status&&{status:e.status}),{smartFilters:null!==(f=null===(g=e.smartFilters)||void 0===g?void 0:g.map((function(e){return smart_filter_1.SmartFilter.fromAPIResponse(e)})))&&void 0!==f?f:[]})},r.prototype.removeDuplicatesFromArray=function(e){return Array.from(new Set(e))},r.prototype.updateRecentTextSearch=function(e){e.searchQueries&&e.searchQueries[search_input_1.TEXT_SEARCH_TYPE.SEMANTIC]&&this.recentTextSearchQueries.addSemanticTextQuery(e.searchQueries[search_input_1.TEXT_SEARCH_TYPE.SEMANTIC]),e.searchQueries&&e.searchQueries[search_input_1.TEXT_SEARCH_TYPE.EXACT]&&(this.recentTextSearchQueries.addExactTextQuery(e.searchQueries[search_input_1.TEXT_SEARCH_TYPE.EXACT]),this.recentTextSearchQueries.addQuery(e.searchQueries[search_input_1.TEXT_SEARCH_TYPE.EXACT])),e.text&&this.recentTextSearchQueries.addQuery(e.text)},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("SearchService")],r)}(core_1.BaseLoginInitService);exports.SearchServiceImpl=SearchServiceImpl;
|
package/gen/sdk-version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
export declare const SDK_VERSION_NUMBER = "
|
|
2
|
+
export declare const SDK_VERSION_NUMBER = "16.0.0";
|
package/gen/sdk-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SDK_VERSION_NUMBER=void 0,exports.SDK_VERSION_NUMBER="16.0.0";
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { RecentPartsService, OrganizationService } from './core';
|
|
3
|
+
import { RecentPartsService, OrganizationService, GetOrganizationsRequest, OrganizationsResponse } from './core';
|
|
4
4
|
import { PartiumConfig } from './core/models/partium-config';
|
|
5
|
-
import { Organization } from './core/models/organization';
|
|
6
5
|
import { FileService } from './core/services/file.service.interface';
|
|
7
6
|
import { FileTransferService } from './core/services/http/file-transfer/file-transfer.service.interface';
|
|
8
7
|
import { HttpsService } from './core/services/http/https.service.interface';
|
|
@@ -103,18 +102,25 @@ export declare class Partium {
|
|
|
103
102
|
*/
|
|
104
103
|
static getInitializationStatus(): Observable<INITIALIZATION_STATUS>;
|
|
105
104
|
/**
|
|
106
|
-
* Returns
|
|
105
|
+
* Returns the first page of Organizations of the currently logged in user.
|
|
107
106
|
*
|
|
108
|
-
* @returns a promise that resolves with an array with all available organizations for a customer.
|
|
107
|
+
* @returns a promise that resolves with an array of the first page of organizations and a pagination context with all available organizations for a customer.
|
|
109
108
|
*/
|
|
110
|
-
static getOrganizations(): Promise<
|
|
109
|
+
static getOrganizations(request: GetOrganizationsRequest): Promise<OrganizationsResponse>;
|
|
111
110
|
/**
|
|
112
|
-
* Set organization with the given
|
|
111
|
+
* Set organization with the given partiumId as the current organization to be used in the session.
|
|
113
112
|
*
|
|
114
|
-
* @param
|
|
113
|
+
* @param organizationId organization-id
|
|
115
114
|
* @returns void if organization is found, otherwise throws an error
|
|
116
115
|
*/
|
|
117
|
-
static
|
|
116
|
+
static useOrganizationById(organizationId: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Set organization with the given name as the current organization to be used in the session.
|
|
119
|
+
*
|
|
120
|
+
* @param organizationName organization-name
|
|
121
|
+
* @returns void if organization is found, otherwise throws an error
|
|
122
|
+
*/
|
|
123
|
+
static useOrganizationByName(organizationName: string): Promise<void>;
|
|
118
124
|
/**
|
|
119
125
|
* Get a service from the service-singleton provider
|
|
120
126
|
*
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Partium=exports.INITIALIZATION_STATUS=void 0;var INITIALIZATION_STATUS,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("./core"),auth_config_1=require("./core/models/auth-config"),partium_config_1=require("./core/models/partium-config"),backend_status_service_1=require("./core/services/backend-status.service"),device_status_service_interface_1=require("./core/services/device-status.service.interface"),file_service_interface_1=require("./core/services/file.service.interface"),file_transfer_service_interface_1=require("./core/services/http/file-transfer/file-transfer.service.interface"),https_client_service_interface_1=require("./core/services/http/https-client/https-client.service.interface"),https_service_interface_1=require("./core/services/http/https.service.interface"),local_storage_service_interface_1=require("./core/services/local-storage.service.interface"),log_service_1=require("./core/services/log.service"),service_provider_1=require("./core/services/service-provider"),session_service_interface_1=require("./core/services/session/session.service.interface"),data_1=require("./data"),filter_service_1=require("./data/services/filter.service"),part_attribute_service_1=require("./data/services/part-attribute.service"),part_service_1=require("./data/services/part.service"),request_list_service_1=require("./user-data/services/request-list/request-list.service"),favorite_service_1=require("./user-data/services/favorite/favorite.service"),asset_service_1=require("./find/services/asset.service"),search_service_1=require("./find/services/search/search.service"),sdk_version_1=require("./gen/sdk-version"),recent_text_search_queries_service_1=require("./find/services/search/recent-text-search-queries.service"),ocr_1=require("./ocr"),shopping_cart_service_1=require("./data/services/shopping-cart.service"),inquiry_service_1=require("./data/services/inquiry.service"),announcement_service_1=require("./data/services/announcement.service"),related_parts_service_1=require("./data/services/related-parts.service"),constants_1=require("./core/constants/constants"),management_1=require("./management"),part_enrichment_service_1=require("./data/services/part-enrichment.service"),images_service_1=require("./catalog/services/images.service"),datacuration_1=require("./datacuration"),enrichment_1=require("./enrichment");!function(e){e[e.NOT_INITIALIZED=0]="NOT_INITIALIZED",e[e.INITIALIZING=1]="INITIALIZING",e[e.INITIALIZED=2]="INITIALIZED",e[e.INITIALIZATION_ERROR=3]="INITIALIZATION_ERROR"}(INITIALIZATION_STATUS||(exports.INITIALIZATION_STATUS=INITIALIZATION_STATUS={}));var Partium=function(){function e(){}return Object.defineProperty(e,"search",{get:function(){return e.getService(search_service_1.SearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"asset",{get:function(){return e.getService(asset_service_1.AssetServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"https",{get:function(){return e.getService(https_service_interface_1.HttpsService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fileTransfer",{get:function(){return e.getService(file_transfer_service_interface_1.FileTransferService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"session",{get:function(){return e.getService(session_service_interface_1.SessionService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"assemblyHierarchyNode",{get:function(){return e.getService(data_1.AssemblyHierarchyNodesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"part",{get:function(){return e.getService(part_service_1.PartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partEnrichment",{get:function(){return e.getService(part_enrichment_service_1.PartEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"relatedParts",{get:function(){return e.getService(related_parts_service_1.RelatedPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"requestList",{get:function(){return e.getService(request_list_service_1.RequestListServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shoppingCart",{get:function(){return e.getService(shopping_cart_service_1.ShoppingCartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partAttribute",{get:function(){return e.getService(part_attribute_service_1.PartAttributeServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"data",{get:function(){return e.getService(data_1.DataServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inquiry",{get:function(){return e.getService(inquiry_service_1.InquiryServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"announcement",{get:function(){return e.getService(announcement_service_1.AnnouncementServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"customerServiceAssistance",{get:function(){return e.getService(data_1.CustomerServiceAssistanceServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"log",{get:function(){return e.getService(log_service_1.LogServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"file",{get:function(){return e.getService(file_service_interface_1.FileService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"recentParts",{get:function(){return e.getService(core_1.RecentPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"favorites",{get:function(){return e.getService(favorite_service_1.FavoriteServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"filters",{get:function(){return e.getService(filter_service_1.FilterServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"organization",{get:function(){return e.getService(core_1.OrganizationService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ocr",{get:function(){return e.getService(ocr_1.OcrServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"apiKey",{get:function(){return e.getService(management_1.ApiKeyServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"localStorage",{get:function(){return e.getService(local_storage_service_interface_1.LocalStorageService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"images",{get:function(){return e.getService(images_service_1.ImagesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"imageSubmission",{get:function(){return e.getService(datacuration_1.ImageSubmissionServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"dataEnrichment",{get:function(){return e.getService(enrichment_1.DataEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),e.init=function(r){console.log("Initializing Partium...",r),e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZING),e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider);var i=[r.partiumApiBaseUrl,r.partiumLoginUrl].filter((function(e){return!!e}));switch(e._serviceProvider.useService(r.httpsClientService,https_client_service_interface_1.HttpsClientService,i),e._serviceProvider.useService(r.fileTransferService,file_transfer_service_interface_1.FileTransferService,i),e._serviceProvider.useService(r.localStorageService,local_storage_service_interface_1.LocalStorageService),e._serviceProvider.useService(r.deviceStatusService,device_status_service_interface_1.DeviceStatusService),e._serviceProvider.useService(r.fileService,file_service_interface_1.FileService),r.authenticationMethod){case partium_config_1.AUTHENTICATION_METHOD.OAUTH_API_KEY:case partium_config_1.AUTHENTICATION_METHOD.OAUTH:e._serviceProvider.useService(r.authenticationConfig.oauthHttpsService,https_service_interface_1.HttpsService),e._serviceProvider.useService(r.authenticationConfig.oauthSessionService,session_service_interface_1.SessionService)}e._serviceProvider.serviceSelectionFinished();var t=e.getService(session_service_interface_1.SessionService),c=e.getService(local_storage_service_interface_1.LocalStorageService);t.registerLoginInitService(c,1);var n=e.getService(asset_service_1.AssetServiceImpl);t.registerLoginInitService(n,2);var a=e.getService(core_1.RecentPartsServiceImpl);t.registerLoginInitService(a,2);var s=e.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl);t.registerLoginInitService(s,2);var _=e.getService(favorite_service_1.FavoriteServiceImpl);t.registerLoginInitService(_,2);var o=e.getService(data_1.CustomerServiceAssistanceServiceImpl);t.registerLoginInitService(o,2);var u=e.getService(search_service_1.SearchServiceImpl);t.registerLoginInitService(u,2);var v=e.getService(log_service_1.LogServiceImpl);t.registerLoginInitService(v,2);var l=e.getService(https_service_interface_1.HttpsService),I=e.getService(backend_status_service_1.BackendStatusService);return I.init(sdk_version_1.SDK_VERSION_NUMBER,"en",e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_STATUS_API_URL]),constants_1.BACKEND_STATUS_FALLBACK_URL),I.checkCompatibility().pipe((0,operators_1.mergeMap)((function(){return I.checkAvailability()})),(0,operators_1.mergeMap)((function(){return t.init(r)})),(0,operators_1.mergeMap)((function(){return l.init({partiumApiBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION)]),findBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_FIND_API_URL]),dataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_API_URL]),csaBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CSA_API_URL]),logBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_LOGS_API_URL]),userDataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_USER_DATA_API_URL]),ocrBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_OCR_API_URL]),managementBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_MANAGEMENT_API_URL]),catalogBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CATALOG_API_URL]),datacurationBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATACURATION_API_URL]),dataV2BeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_V2_API_URL]),dataEnrichmentBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_ENRICHMENT_API_URL])},r.authenticationConfig)})),(0,operators_1.tap)((function(){l.setCurrentOrganization(t.getCurrentOrganization$())})),(0,operators_1.tap)((function(){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZED)})),(0,operators_1.catchError)((function(r){return e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZATION_ERROR),e.reset(),(0,rxjs_1.throwError)((function(){return r}))})))},e.initApiKey=function(r){return e.init(new partium_config_1.PartiumConfig({authenticationConfig:new auth_config_1.OauthApiKeyAuthenticationConfig({apiKey:r})}))},e.reset=function(){e._serviceProvider=null,e._initializationStatus$.next(INITIALIZATION_STATUS.NOT_INITIALIZED)},e.getInitializationStatus=function(){return e._initializationStatus$.asObservable()},e.getOrganizations=function(){return e.ensureInitialized(),e.getService(core_1.OrganizationService).getOrganizations()},e.useOrganization=function(r){return e.ensureInitialized(),e.session.useOrganization(r)},e.getService=function(r){return e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider),e._serviceProvider.getService(r)},e.isInitialized=function(){return e._initializationStatus$.value===INITIALIZATION_STATUS.INITIALIZED},e.ensureInitialized=function(){if(!e.isInitialized())throw"Partium-JS-SDK not initialized. Make sure to initialize the Partium-JS-SDK before you try to use it's features!"},e.buildUrl=function(e){for(var r=[],i=0,t=e;i<t.length;i++){var c=t[i];r.push(c.replace(/^\/+/,"").replace(/\/+$/,""))}return r.join("/")},e._serviceProvider=null,e._initializationStatus$=new rxjs_1.BehaviorSubject(INITIALIZATION_STATUS.NOT_INITIALIZED),e}();exports.Partium=Partium;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Partium=exports.INITIALIZATION_STATUS=void 0;var INITIALIZATION_STATUS,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("./core"),auth_config_1=require("./core/models/auth-config"),partium_config_1=require("./core/models/partium-config"),backend_status_service_1=require("./core/services/backend-status.service"),device_status_service_interface_1=require("./core/services/device-status.service.interface"),file_service_interface_1=require("./core/services/file.service.interface"),file_transfer_service_interface_1=require("./core/services/http/file-transfer/file-transfer.service.interface"),https_client_service_interface_1=require("./core/services/http/https-client/https-client.service.interface"),https_service_interface_1=require("./core/services/http/https.service.interface"),local_storage_service_interface_1=require("./core/services/local-storage.service.interface"),log_service_1=require("./core/services/log.service"),service_provider_1=require("./core/services/service-provider"),session_service_interface_1=require("./core/services/session/session.service.interface"),data_1=require("./data"),filter_service_1=require("./data/services/filter.service"),part_attribute_service_1=require("./data/services/part-attribute.service"),part_service_1=require("./data/services/part.service"),request_list_service_1=require("./user-data/services/request-list/request-list.service"),favorite_service_1=require("./user-data/services/favorite/favorite.service"),asset_service_1=require("./find/services/asset.service"),search_service_1=require("./find/services/search/search.service"),sdk_version_1=require("./gen/sdk-version"),recent_text_search_queries_service_1=require("./find/services/search/recent-text-search-queries.service"),ocr_1=require("./ocr"),shopping_cart_service_1=require("./data/services/shopping-cart.service"),inquiry_service_1=require("./data/services/inquiry.service"),announcement_service_1=require("./data/services/announcement.service"),related_parts_service_1=require("./data/services/related-parts.service"),constants_1=require("./core/constants/constants"),management_1=require("./management"),part_enrichment_service_1=require("./data/services/part-enrichment.service"),images_service_1=require("./catalog/services/images.service"),datacuration_1=require("./datacuration"),enrichment_1=require("./enrichment");!function(e){e[e.NOT_INITIALIZED=0]="NOT_INITIALIZED",e[e.INITIALIZING=1]="INITIALIZING",e[e.INITIALIZED=2]="INITIALIZED",e[e.INITIALIZATION_ERROR=3]="INITIALIZATION_ERROR"}(INITIALIZATION_STATUS||(exports.INITIALIZATION_STATUS=INITIALIZATION_STATUS={}));var Partium=function(){function e(){}return Object.defineProperty(e,"search",{get:function(){return e.getService(search_service_1.SearchServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"asset",{get:function(){return e.getService(asset_service_1.AssetServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"https",{get:function(){return e.getService(https_service_interface_1.HttpsService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fileTransfer",{get:function(){return e.getService(file_transfer_service_interface_1.FileTransferService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"session",{get:function(){return e.getService(session_service_interface_1.SessionService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"assemblyHierarchyNode",{get:function(){return e.getService(data_1.AssemblyHierarchyNodesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"part",{get:function(){return e.getService(part_service_1.PartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partEnrichment",{get:function(){return e.getService(part_enrichment_service_1.PartEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"relatedParts",{get:function(){return e.getService(related_parts_service_1.RelatedPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"requestList",{get:function(){return e.getService(request_list_service_1.RequestListServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shoppingCart",{get:function(){return e.getService(shopping_cart_service_1.ShoppingCartServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"partAttribute",{get:function(){return e.getService(part_attribute_service_1.PartAttributeServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"data",{get:function(){return e.getService(data_1.DataServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"inquiry",{get:function(){return e.getService(inquiry_service_1.InquiryServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"announcement",{get:function(){return e.getService(announcement_service_1.AnnouncementServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"customerServiceAssistance",{get:function(){return e.getService(data_1.CustomerServiceAssistanceServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"log",{get:function(){return e.getService(log_service_1.LogServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"file",{get:function(){return e.getService(file_service_interface_1.FileService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"recentParts",{get:function(){return e.getService(core_1.RecentPartsServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"favorites",{get:function(){return e.getService(favorite_service_1.FavoriteServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"filters",{get:function(){return e.getService(filter_service_1.FilterServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"organization",{get:function(){return e.getService(core_1.OrganizationServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ocr",{get:function(){return e.getService(ocr_1.OcrServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"apiKey",{get:function(){return e.getService(management_1.ApiKeyServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"localStorage",{get:function(){return e.getService(local_storage_service_interface_1.LocalStorageService)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"images",{get:function(){return e.getService(images_service_1.ImagesServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"imageSubmission",{get:function(){return e.getService(datacuration_1.ImageSubmissionServiceImpl)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"dataEnrichment",{get:function(){return e.getService(enrichment_1.DataEnrichmentServiceImpl)},enumerable:!1,configurable:!0}),e.init=function(r){console.log("Initializing Partium...",r),e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZING),e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider);var i=[r.partiumApiBaseUrl,r.partiumLoginUrl].filter((function(e){return!!e}));switch(e._serviceProvider.useService(r.httpsClientService,https_client_service_interface_1.HttpsClientService,i),e._serviceProvider.useService(r.fileTransferService,file_transfer_service_interface_1.FileTransferService,i),e._serviceProvider.useService(r.localStorageService,local_storage_service_interface_1.LocalStorageService),e._serviceProvider.useService(r.deviceStatusService,device_status_service_interface_1.DeviceStatusService),e._serviceProvider.useService(r.fileService,file_service_interface_1.FileService),r.authenticationMethod){case partium_config_1.AUTHENTICATION_METHOD.OAUTH_API_KEY:case partium_config_1.AUTHENTICATION_METHOD.OAUTH:e._serviceProvider.useService(r.authenticationConfig.oauthHttpsService,https_service_interface_1.HttpsService),e._serviceProvider.useService(r.authenticationConfig.oauthSessionService,session_service_interface_1.SessionService)}e._serviceProvider.serviceSelectionFinished();var t=e.getService(session_service_interface_1.SessionService),n=e.getService(local_storage_service_interface_1.LocalStorageService);t.registerLoginInitService(n,1);var c=e.getService(asset_service_1.AssetServiceImpl);t.registerLoginInitService(c,2);var a=e.getService(core_1.RecentPartsServiceImpl);t.registerLoginInitService(a,2);var s=e.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl);t.registerLoginInitService(s,2);var o=e.getService(favorite_service_1.FavoriteServiceImpl);t.registerLoginInitService(o,2);var _=e.getService(data_1.CustomerServiceAssistanceServiceImpl);t.registerLoginInitService(_,2);var u=e.getService(search_service_1.SearchServiceImpl);t.registerLoginInitService(u,2);var v=e.getService(log_service_1.LogServiceImpl);t.registerLoginInitService(v,2);var l=e.getService(https_service_interface_1.HttpsService),I=e.getService(backend_status_service_1.BackendStatusService);return I.init(sdk_version_1.SDK_VERSION_NUMBER,"en",e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_STATUS_API_URL]),constants_1.BACKEND_STATUS_FALLBACK_URL),I.checkCompatibility().pipe((0,operators_1.mergeMap)((function(){return I.checkAvailability()})),(0,operators_1.mergeMap)((function(){return t.init(r)})),(0,operators_1.mergeMap)((function(){return l.init({partiumApiBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION)]),dataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_API_URL]),csaBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CSA_API_URL]),logBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_LOGS_API_URL]),userDataBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_USER_DATA_API_URL]),managementBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_MANAGEMENT_API_URL]),catalogBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_CATALOG_API_URL]),datacurationBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATACURATION_API_URL]),dataV2BeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_V2_API_URL]),dataEnrichmentBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_DATA_ENRICHMENT_API_URL]),backofficeBeBaseUrl:e.buildUrl([r.partiumApiBaseUrl,"".concat(constants_1.PARTIUM_API_VERSION),constants_1.REL_BACKOFFICE_API_URL])},r.authenticationConfig)})),(0,operators_1.tap)((function(){l.setCurrentOrganization(t.getCurrentOrganization$())})),(0,operators_1.tap)((function(){e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZED)})),(0,operators_1.catchError)((function(r){return e._initializationStatus$.next(INITIALIZATION_STATUS.INITIALIZATION_ERROR),e.reset(),(0,rxjs_1.throwError)((function(){return r}))})))},e.initApiKey=function(r){return e.init(new partium_config_1.PartiumConfig({authenticationConfig:new auth_config_1.OauthApiKeyAuthenticationConfig({apiKey:r})}))},e.reset=function(){e._serviceProvider=null,e._initializationStatus$.next(INITIALIZATION_STATUS.NOT_INITIALIZED)},e.getInitializationStatus=function(){return e._initializationStatus$.asObservable()},e.getOrganizations=function(r){return e.ensureInitialized(),(0,rxjs_1.firstValueFrom)(e.getService(core_1.OrganizationServiceImpl).loadOrganizations(r))},e.useOrganizationById=function(r){return e.ensureInitialized(),e.session.useOrganizationById(r)},e.useOrganizationByName=function(r){return e.ensureInitialized(),e.session.useOrganizationByName(r)},e.getService=function(r){return e._serviceProvider||(e._serviceProvider=new service_provider_1.ServiceProvider),e._serviceProvider.getService(r)},e.isInitialized=function(){return e._initializationStatus$.value===INITIALIZATION_STATUS.INITIALIZED},e.ensureInitialized=function(){if(!e.isInitialized())throw"Partium-JS-SDK not initialized. Make sure to initialize the Partium-JS-SDK before you try to use it's features!"},e.buildUrl=function(e){for(var r=[],i=0,t=e;i<t.length;i++){var n=t[i];r.push(n.replace(/^\/+/,"").replace(/\/+$/,""))}return r.join("/")},e._serviceProvider=null,e._initializationStatus$=new rxjs_1.BehaviorSubject(INITIALIZATION_STATUS.NOT_INITIALIZED),e}();exports.Partium=Partium;
|
package/ocr/index.d.ts
CHANGED
package/ocr/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=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,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=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/ocr-response"),exports),__exportStar(require("./services/ocr.service"),exports);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { BaseService } from '../../core/services/base.service';
|
|
4
4
|
import { ServiceProvider } from '../../core/services/service-provider';
|
|
5
|
+
import { OcrResponse } from '../models/ocr-response';
|
|
5
6
|
import { EventContext, PFile } from '../../core';
|
|
6
7
|
export interface OCREventContext extends EventContext {
|
|
7
8
|
searchSessionId?: string;
|
|
@@ -11,26 +12,19 @@ export interface OCREventContext extends EventContext {
|
|
|
11
12
|
*/
|
|
12
13
|
export interface OcrService {
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Detect text in an image.
|
|
15
16
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
17
|
+
* @param organizationName Name of the organization to use the OCR in.
|
|
18
|
+
* @param image PFile of the image to use (ideally cropped to the area of interest)
|
|
19
|
+
* @param eventContext (optional) OCREventContext object to add the missing data that will be logged using the log format V2.
|
|
20
|
+
* Pass a searchSessionId to associate the OCR-detection with an existing search-session.
|
|
21
|
+
* @returns The detected texts and the imageId of the image-asset that is generated during OCR-detection.
|
|
18
22
|
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Upload an image and detect text in it.
|
|
22
|
-
*
|
|
23
|
-
* @param organizationId Id of the organization to use the OCR in.
|
|
24
|
-
* @param file PFile of the image to use (ideally cropped to the area of interest)
|
|
25
|
-
* @returns The detected texts.
|
|
26
|
-
*/
|
|
27
|
-
detectFromFile(organizationId: string, file: PFile): Observable<string[]>;
|
|
23
|
+
detectFromFile(organizationName: string, image: PFile, eventContext?: OCREventContext): Observable<OcrResponse>;
|
|
28
24
|
}
|
|
29
25
|
export declare class OcrServiceImpl extends BaseService implements OcrService {
|
|
30
26
|
private httpsService;
|
|
31
|
-
private assetService;
|
|
32
27
|
constructor(serviceProvider: ServiceProvider);
|
|
33
28
|
onCreate(): void;
|
|
34
|
-
|
|
35
|
-
detectFromFile(organizationId: string, file: PFile, eventContext?: OCREventContext): Observable<string[]>;
|
|
29
|
+
detectFromFile(organizationName: string, image: PFile, eventContext?: OCREventContext): Observable<OcrResponse>;
|
|
36
30
|
}
|