@partium/js-sdk 15.20.0 → 16.1.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 +2 -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/log.d.ts +3 -1
- package/core/models/log.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 +20 -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 +16 -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/selection/index.d.ts +17 -0
- package/selection/index.js +2 -0
- package/selection/models/add-all-search-session-parts-to-selection-request.d.ts +4 -0
- package/selection/models/add-all-search-session-parts-to-selection-request.js +2 -0
- package/selection/models/add-all-search-session-parts-to-selection-response.d.ts +5 -0
- package/selection/models/add-all-search-session-parts-to-selection-response.js +2 -0
- package/selection/models/add-parts-from-file-to-selection-request.d.ts +10 -0
- package/selection/models/add-parts-from-file-to-selection-request.js +2 -0
- package/selection/models/add-parts-from-file-to-selection-response.d.ts +33 -0
- package/selection/models/add-parts-from-file-to-selection-response.js +2 -0
- package/selection/models/add-parts-to-selection-request.d.ts +4 -0
- package/selection/models/add-parts-to-selection-request.js +2 -0
- package/selection/models/add-parts-to-selection-response.d.ts +5 -0
- package/selection/models/add-parts-to-selection-response.js +2 -0
- package/selection/models/check-which-parts-in-selection-request.d.ts +4 -0
- package/selection/models/check-which-parts-in-selection-request.js +2 -0
- package/selection/models/check-which-parts-in-selection-response.d.ts +4 -0
- package/selection/models/check-which-parts-in-selection-response.js +2 -0
- package/selection/models/create-selection-request.d.ts +6 -0
- package/selection/models/create-selection-request.js +2 -0
- package/selection/models/create-selection-response.d.ts +10 -0
- package/selection/models/create-selection-response.js +2 -0
- package/selection/models/remove-all-search-session-parts-from-selection-request.d.ts +4 -0
- package/selection/models/remove-all-search-session-parts-from-selection-request.js +2 -0
- package/selection/models/remove-all-search-session-parts-from-selection-response.d.ts +5 -0
- package/selection/models/remove-all-search-session-parts-from-selection-response.js +2 -0
- package/selection/models/remove-parts-from-selection-request.d.ts +4 -0
- package/selection/models/remove-parts-from-selection-request.js +2 -0
- package/selection/models/remove-parts-from-selection-response.d.ts +5 -0
- package/selection/models/remove-parts-from-selection-response.js +2 -0
- package/selection/models/selection-search-summary-response.d.ts +5 -0
- package/selection/models/selection-search-summary-response.js +2 -0
- package/selection/services/selection.service.d.ts +95 -0
- package/selection/services/selection.service.js +2 -0
- 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,66 +0,0 @@
|
|
|
1
|
-
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { SearchStatus } from '../../models/search-status/search-status';
|
|
4
|
-
import { SearchTag } from '../../models/search-tag';
|
|
5
|
-
import { BaseService } from '../../../core/services/base.service';
|
|
6
|
-
import { ServiceProvider } from '../../../core/services/service-provider';
|
|
7
|
-
import { EventContext } from '../../../core';
|
|
8
|
-
export interface TagSearchEventContext extends EventContext {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Manages search tags for the current search session.
|
|
12
|
-
* Provides methods that manipulate and upload the search-tag status.
|
|
13
|
-
*
|
|
14
|
-
* @deprecated use SearchService.performSearch instead
|
|
15
|
-
*/
|
|
16
|
-
export interface TagSearchService {
|
|
17
|
-
/**
|
|
18
|
-
* Returns an Observable that always emits the latest list of
|
|
19
|
-
* SearchTags that the user should be able to choose from.
|
|
20
|
-
*
|
|
21
|
-
* @returns observable that always emits the full list of proposed
|
|
22
|
-
* search-tags, whenever the list changes
|
|
23
|
-
*
|
|
24
|
-
* @deprecated use SearchService.performSearch instead
|
|
25
|
-
*/
|
|
26
|
-
getProposedSearchTags(): Observable<SearchTag[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Called from the search-result-service, when the proposed tags should change.
|
|
29
|
-
*
|
|
30
|
-
* @param searchTags the new proposed search-tags to display to the user
|
|
31
|
-
*
|
|
32
|
-
* @deprecated use SearchService.performSearch instead
|
|
33
|
-
*/
|
|
34
|
-
updateProposedTags(searchTags: SearchTag[]): void;
|
|
35
|
-
/**
|
|
36
|
-
* Append a search-tag to the current text-search query and execute
|
|
37
|
-
* a persisted text-search.
|
|
38
|
-
*
|
|
39
|
-
* @param searchTag the search-tag to add *
|
|
40
|
-
* @param tagSearchEventContext (optional) TagSearchEventContext object to add the missing data that will be logged using the log format V2
|
|
41
|
-
* @param customQuery (optional) the custom query to which the search-tag should be added
|
|
42
|
-
* @returns Observable that resolves with the request to the backend,
|
|
43
|
-
* to update the persisted text-search.
|
|
44
|
-
*
|
|
45
|
-
* @deprecated use SearchService.performSearch instead
|
|
46
|
-
*/
|
|
47
|
-
addSearchTag(searchTag: SearchTag, tagSearchEventContext?: TagSearchEventContext, customQuery?: string): Observable<void>;
|
|
48
|
-
}
|
|
49
|
-
export declare class TagSearchServiceImpl extends BaseService implements TagSearchService {
|
|
50
|
-
private textSearchService;
|
|
51
|
-
private logService;
|
|
52
|
-
private searchStatus;
|
|
53
|
-
private tagSearchStatus;
|
|
54
|
-
private readonly proposedSearchTagsSub;
|
|
55
|
-
constructor(serviceProvider: ServiceProvider);
|
|
56
|
-
onCreate(): void;
|
|
57
|
-
getProposedSearchTags(): Observable<SearchTag[]>;
|
|
58
|
-
updateProposedTags(searchTags: SearchTag[]): void;
|
|
59
|
-
/**
|
|
60
|
-
* Reset the search-tag service. Called when a new search session is created.
|
|
61
|
-
*
|
|
62
|
-
* @param searchStatus the search status object of the new search session.
|
|
63
|
-
*/
|
|
64
|
-
reset(searchStatus: SearchStatus): void;
|
|
65
|
-
addSearchTag(searchTag: SearchTag, tagSearchEventContext?: TagSearchEventContext, customQuery?: string): Observable<void>;
|
|
66
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
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 o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;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,o){var s,c=arguments.length,i=c<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,r,t,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(c<3?s(i):c>3?s(r,t,i):s(r,t))||i);return c>3&&i&&Object.defineProperty(r,t,i),i},__spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var o,s=0,c=r.length;s<c;s++)!o&&s in r||(o||(o=Array.prototype.slice.call(r,0,s)),o[s]=r[s]);return e.concat(o||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TagSearchServiceImpl=void 0;var rxjs_1=require("rxjs"),text_search_service_1=require("./text-search.service"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),base_service_1=require("../../../core/services/base.service"),log_service_1=require("../../../core/services/log.service"),core_1=require("../../../core"),TagSearchServiceImpl=function(e){function r(r){var t=e.call(this,r)||this;return t.proposedSearchTagsSub=new rxjs_1.BehaviorSubject([]),t}return __extends(r,e),r.prototype.onCreate=function(){this.textSearchService=this.serviceProvider.getService(text_search_service_1.TextSearchServiceImpl),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},r.prototype.getProposedSearchTags=function(){return this.proposedSearchTagsSub.asObservable()},r.prototype.updateProposedTags=function(e){this.tagSearchStatus.proposedSearchTags=__spreadArray([],e,!0),this.proposedSearchTagsSub.next(__spreadArray([],e,!0))},r.prototype.reset=function(e){this.searchStatus=e,this.tagSearchStatus=e.tagSearchStatus,this.proposedSearchTagsSub.next([])},r.prototype.addSearchTag=function(e,r,t){var o,s=this,c="";return(o=t||this.searchStatus.textSearchStatus.searchQueries[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC])?(c=o.trim(),c="".concat(c," ").concat(e.value)):c=e.value,this.logService.logEvent(new core_1.EventLog({version:core_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:this.searchStatus.searchDomainId,interface:(null==r?void 0:r.eventInterface)||core_1.INTERFACE.API_ACCESS,event:core_1.EVENT.SEARCH_INPUT_SEMANTIC_TAGS,data:{searchSessionId:this.searchStatus.searchSessionID,value:e.value,score:e.score}})).subscribe((function(){}),(function(e){console.log("Error while sending log event: ",e)})),this.textSearchService.getSearchQueries().pipe((0,operators_1.take)(1),(0,operators_1.mergeMap)((function(e){var r;return s.textSearchService.performTextSearch(__assign(__assign({},e),((r={})[text_search_service_1.TEXT_SEARCH_TYPE.SEMANTIC]=c,r)))})))},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("TagSearchService")],r)}(base_service_1.BaseService);exports.TagSearchServiceImpl=TagSearchServiceImpl;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { SearchStatus } from '../../models/search-status/search-status';
|
|
4
|
-
import { TextSearchConfig } from '../../models/text-search-config';
|
|
5
|
-
import { ServiceProvider } from '../../../core/services/service-provider';
|
|
6
|
-
import { BaseService } from '../../../core/services/base.service';
|
|
7
|
-
export declare enum TEXT_SEARCH_TYPE {
|
|
8
|
-
SEMANTIC = "semanticText",
|
|
9
|
-
EXACT = "exactText"
|
|
10
|
-
}
|
|
11
|
-
export type TextSearchQueries = {
|
|
12
|
-
[key in TEXT_SEARCH_TYPE]?: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Service that provides functions for searching media by text.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated use SearchService.performSearch instead
|
|
18
|
-
*/
|
|
19
|
-
export interface TextSearchService {
|
|
20
|
-
/**
|
|
21
|
-
* Perform a text-search. Multiple types of text-search are supported
|
|
22
|
-
* and can be triggered separately or together at the same time with different
|
|
23
|
-
* queries.
|
|
24
|
-
*
|
|
25
|
-
* The available search-types are:
|
|
26
|
-
* - 'semanticText' - error tolerant search, can be used to describe parts
|
|
27
|
-
* - 'exactText' - exact search for part ids, sizes, ...
|
|
28
|
-
*
|
|
29
|
-
* @param textSearchQueries object that contains queries for the different
|
|
30
|
-
* text-search types. If a query-type is missing, it will be handled as
|
|
31
|
-
* if '' was passed.
|
|
32
|
-
* @param skipAddingToRecentQueries if set, the queries are not appended
|
|
33
|
-
* to the recent search queries (default false)
|
|
34
|
-
*
|
|
35
|
-
* @deprecated use SearchService.performSearch instead
|
|
36
|
-
*/
|
|
37
|
-
performTextSearch(textSearchQueries: TextSearchQueries, skipAddingToRecentQueries?: boolean): Observable<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Get an Observable that always resolves with the latest text-search
|
|
40
|
-
* queries when a search is performed.
|
|
41
|
-
*
|
|
42
|
-
* @returns Observable that always resolves with all latest text-search
|
|
43
|
-
* queries whenever changed
|
|
44
|
-
*
|
|
45
|
-
* @deprecated use SearchService.performSearch instead
|
|
46
|
-
*/
|
|
47
|
-
getSearchQueries(): Observable<TextSearchQueries>;
|
|
48
|
-
/**
|
|
49
|
-
* Sets the value of the SearchQUeries
|
|
50
|
-
*
|
|
51
|
-
* @returns void
|
|
52
|
-
*
|
|
53
|
-
* @deprecated use SearchService.performSearch instead
|
|
54
|
-
*/
|
|
55
|
-
setTextQueries(textSearchQueries: TextSearchQueries): void;
|
|
56
|
-
}
|
|
57
|
-
export declare class TextSearchServiceImpl extends BaseService implements TextSearchService {
|
|
58
|
-
private httpsService;
|
|
59
|
-
private searchResultService;
|
|
60
|
-
private recentTextSearchQueriesService;
|
|
61
|
-
private currentSearchQuery$;
|
|
62
|
-
private temporarySearchResult$;
|
|
63
|
-
private textSearchStatus;
|
|
64
|
-
private searchStatus;
|
|
65
|
-
private curTextSearchQueries$;
|
|
66
|
-
private externalTempSearchResultManipulator;
|
|
67
|
-
private skipAutoTextSearchAfterLoadingEventFlag;
|
|
68
|
-
constructor(serviceProvider: ServiceProvider);
|
|
69
|
-
onCreate(): void;
|
|
70
|
-
reset(searchStatus: SearchStatus): void;
|
|
71
|
-
/**
|
|
72
|
-
* Set the text-search-status to a certain status.
|
|
73
|
-
* This can happen if an old search-session is loaded or a change of the search-input
|
|
74
|
-
* was initiated on the backend-side.
|
|
75
|
-
*
|
|
76
|
-
* @param searchStatus the search-status object
|
|
77
|
-
* @param query the query of the old session
|
|
78
|
-
* @param searchConfig the search-config of the old session (if null => use default)
|
|
79
|
-
* @param textSearchStatus the textSearchStatus containing exact and semantic searches
|
|
80
|
-
*/
|
|
81
|
-
setStatusExternal(searchStatus: SearchStatus, query?: string, searchConfig?: TextSearchConfig, textSearchQueries?: TextSearchQueries): void;
|
|
82
|
-
setTextQueries(textSearchQueries: TextSearchQueries): void;
|
|
83
|
-
performTextSearch(textSearchQueries: TextSearchQueries, skipAddingToRecentQueries?: boolean): Observable<void>;
|
|
84
|
-
getSearchQueries(): Observable<TextSearchQueries>;
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
* Handle currentSearchQuery$ changes.
|
|
88
|
-
* Only the latest request is processed and only if it really changed (distinctUntilChanged)
|
|
89
|
-
* Similarily, the search filters stream is merged with the query change stream and it fires every time one of the streams emits
|
|
90
|
-
* https://angular-2-training-book.rangle.io/http/search_with_switchmap
|
|
91
|
-
* https://stackoverflow.com/questions/53432096/observables-cancel-previous-http-request-on-new-subscription-call
|
|
92
|
-
*/
|
|
93
|
-
private subscribeSearchChanges;
|
|
94
|
-
/**
|
|
95
|
-
* Sends the quick text search request to the backend and return the result as observable
|
|
96
|
-
*
|
|
97
|
-
* @deprecated quick text search is deprecated and will be replaced in the future
|
|
98
|
-
*
|
|
99
|
-
* @param query the current temporary search query
|
|
100
|
-
*/
|
|
101
|
-
private performQuickTextSearch;
|
|
102
|
-
/**
|
|
103
|
-
* Builds search-object for elastic-search that is sent with the request.
|
|
104
|
-
*
|
|
105
|
-
* @param query the query to search for
|
|
106
|
-
* @param domains the domains to search in
|
|
107
|
-
*/
|
|
108
|
-
private getElasticSearchObject;
|
|
109
|
-
/**
|
|
110
|
-
* returns the search fields to use in the ElasticSearchObject
|
|
111
|
-
*
|
|
112
|
-
* @param domain domain option (e.g. part or document)
|
|
113
|
-
* @returns fields to search in
|
|
114
|
-
*/
|
|
115
|
-
private getElasticSearchFields;
|
|
116
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
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,c=arguments.length,i=c<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,s);else for(var n=e.length-1;n>=0;n--)(a=e[n])&&(i=(c<3?a(i):c>3?a(t,r,i):a(t,r))||i);return c>3&&i&&Object.defineProperty(t,r,i),i},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var s,a=0,c=t.length;a<c;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.TextSearchServiceImpl=exports.TEXT_SEARCH_TYPE=void 0;var TEXT_SEARCH_TYPE,rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),text_search_manipulator_1=require("../../models/text-search-manipulator"),text_search_result_item_unknown_1=require("../../models/text-search-result-item/text-search-result-item-unknown"),text_search_result_item_recent_query_1=require("../../models/text-search-result-item/text-search-result-item-recent-query"),text_search_result_item_part_1=require("../../models/text-search-result-item/text-search-result-item-part"),_=require("lodash"),text_search_config_1=require("../../models/text-search-config"),search_result_service_1=require("./search-result.service"),text_search_result_item_document_1=require("../../models/text-search-result-item/text-search-result-item-document"),recent_text_search_queries_service_1=require("./recent-text-search-queries.service"),https_service_interface_1=require("../../../core/services/http/https.service.interface"),injection_identifier_1=require("../../../core/decorators/injection-identifier"),base_service_1=require("../../../core/services/base.service"),part_1=require("../../../data/models/part"),i18n_string_1=require("../../../core/models/i18n-string"),document_1=require("../../../data/models/document"),FIELDS_PER_DOMAIN={};FIELDS_PER_DOMAIN[text_search_config_1.SEARCH_DOMAINS.PART]=["full_text.*"],FIELDS_PER_DOMAIN[text_search_config_1.SEARCH_DOMAINS.DOCUMENT]=["name","name.ngram","attachment.content"],function(e){e.SEMANTIC="semanticText",e.EXACT="exactText"}(TEXT_SEARCH_TYPE||(exports.TEXT_SEARCH_TYPE=TEXT_SEARCH_TYPE={}));var TextSearchServiceImpl=function(e){function t(t){var r,s=e.call(this,t)||this;return s.skipAutoTextSearchAfterLoadingEventFlag=!1,s.temporarySearchResult$=new rxjs_1.BehaviorSubject({query:"",result:[]}),s.currentSearchQuery$=new rxjs_1.BehaviorSubject(""),s.curTextSearchQueries$=new rxjs_1.BehaviorSubject(((r={})[TEXT_SEARCH_TYPE.SEMANTIC]="",r[TEXT_SEARCH_TYPE.EXACT]="",r)),s.externalTempSearchResultManipulator=new text_search_manipulator_1.TextSearchManipulatorDoNothing,s}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.recentTextSearchQueriesService=this.serviceProvider.getService(recent_text_search_queries_service_1.RecentTextSearchQueriesServiceImpl),this.subscribeSearchChanges()},t.prototype.reset=function(e){var t;this.searchStatus=e,this.textSearchStatus=e.textSearchStatus,this.currentSearchQuery$.next(""),this.curTextSearchQueries$.next(((t={})[TEXT_SEARCH_TYPE.SEMANTIC]="",t[TEXT_SEARCH_TYPE.EXACT]="",t))},t.prototype.setStatusExternal=function(e,t,r,s){this.searchStatus=e,this.textSearchStatus=e.textSearchStatus,this.setTextQueries(s),this.skipAutoTextSearchAfterLoadingEventFlag=!0},t.prototype.setTextQueries=function(e){e&&(this.textSearchStatus.searchQueries=e,this.curTextSearchQueries$.next(e))},t.prototype.performTextSearch=function(e,t){var r,s=this;return void 0===t&&(t=!1),this.textSearchStatus.searchQueries=e,this.curTextSearchQueries$.next(e),this.httpsService.patch("search/".concat(this.searchStatus.searchSessionID),{method:"textSearch",options:{textSearch:(r={},r[TEXT_SEARCH_TYPE.SEMANTIC]=e[TEXT_SEARCH_TYPE.SEMANTIC]||"",r[TEXT_SEARCH_TYPE.EXACT]=e[TEXT_SEARCH_TYPE.EXACT]||"",r)}}).pipe((0,operators_1.tap)((function(){if(!t){var r=e[TEXT_SEARCH_TYPE.SEMANTIC],a=e[TEXT_SEARCH_TYPE.EXACT];r&&s.recentTextSearchQueriesService.addSemanticTextQuery(r),a&&s.recentTextSearchQueriesService.addExactTextQuery(a)}s.searchResultService.startPollingForResults()})))},t.prototype.getSearchQueries=function(){return this.curTextSearchQueries$.asObservable()},t.prototype.subscribeSearchChanges=function(){var e=this;this.currentSearchQuery$.pipe((0,operators_1.filter)((function(){var t=e.skipAutoTextSearchAfterLoadingEventFlag;return e.skipAutoTextSearchAfterLoadingEventFlag=!1,!t})),(0,operators_1.debounceTime)(100),(0,operators_1.distinctUntilChanged)(),(0,operators_1.switchMap)((function(t){var r=t;return e.performQuickTextSearch(t).pipe((0,operators_1.catchError)((function(t){return console.log("Search error: ",t),e.temporarySearchResult$.next({query:r,error:t}),(0,rxjs_1.of)(void 0)})))}))).subscribe((function(t){t?e.temporarySearchResult$.next(t):e.temporarySearchResult$.next({query:"",result:[]})}),(function(e){console.log("TextSearch error: ",e)}))},t.prototype.performQuickTextSearch=function(e){var t=this;return(0,rxjs_1.of)({query:e,result:[]}).pipe((0,operators_1.mergeMap)((function(r){var s,a,c,i=null===(c=null===(a=null===(s=t.textSearchStatus)||void 0===s?void 0:s.searchConfig)||void 0===a?void 0:a.temporarySearch)||void 0===c?void 0:c.includes(text_search_config_1.TEMPORARY_SEARCH_TYPE.QUICK_TEXT_SEARCH);return e&&e.length>0&&i?t.httpsService.post("search/".concat(t.searchStatus.searchSessionID),t.getElasticSearchObject(e)).pipe((0,operators_1.map)((function(t){var r=[];if(t.results){var s=Object.keys(t.results);_.forEach(s,(function(e){"entities"===e?_.forEach(t.results[e],(function(e){r.push(new text_search_result_item_part_1.TextSearchResultItemPart(new part_1.Part({name:new i18n_string_1.i18nString(e.name),partiumId:e.partiumId,externalId:e.externalId,externalPayload:e.externalPayload,dataOrigin:part_1.DATA_ORIGIN.PARTIAL}),e.confidence))})):"documents"===e?_.forEach(t.results[e],(function(e){r.push(new text_search_result_item_document_1.TextSearchResultItemDocument(new document_1.Document({name:e.name,partiumId:e.partiumId,externalId:e.externalId,externalPayload:e.externalPayload}),e.confidence))})):_.forEach(t.results[e],(function(t){r.push(new text_search_result_item_unknown_1.TextSearchResultItemUnknown(t,t.confidence,e))}))})),r=_.orderBy(r,["confidence"],["desc"])}return{query:e,result:r}})),(0,operators_1.mergeMap)((function(e){return(0,rxjs_1.from)(t.externalTempSearchResultManipulator.textSearchResultManipulatorFunction(e))}))):(0,rxjs_1.of)(r)})),(0,operators_1.mergeMap)((function(e){var r,s,a;return(null===(a=null===(s=null===(r=t.textSearchStatus)||void 0===r?void 0:r.searchConfig)||void 0===s?void 0:s.temporarySearch)||void 0===a?void 0:a.includes(text_search_config_1.TEMPORARY_SEARCH_TYPE.RECENT_SEARCH_QUERIES))?t.recentTextSearchQueriesService.getQueries().pipe((0,operators_1.first)(),(0,operators_1.map)((function(t){var r,s=__spreadArray(__spreadArray([],null!==(r=e.result)&&void 0!==r?r:[],!0),t.map((function(e){return new text_search_result_item_recent_query_1.TextSearchResultItemRecentQuery(e,1)})),!0);return __assign(__assign({},e),{result:s})}))):(0,rxjs_1.of)(e)})))},t.prototype.getElasticSearchObject=function(e){var t=this;return{textSearch:{searchObjects:this.textSearchStatus.searchConfig.domains.map((function(r){return{type:t.textSearchStatus.searchConfig.searchType,options:__assign({skip:0,limit:t.textSearchStatus.searchConfig.limit,domain:r,fields:t.getElasticSearchFields(r),searchTerm:e},t.textSearchStatus.searchConfig.searchType===text_search_config_1.SEARCH_TYPE.FUZZY&&{fuzziness:t.textSearchStatus.searchConfig.fuzziness})}}))}}},t.prototype.getElasticSearchFields=function(e){return e===text_search_config_1.SEARCH_DOMAINS.PART&&this.searchStatus.searchLanguage?["full_text.".concat(this.searchStatus.searchLanguage)]:FIELDS_PER_DOMAIN[e]},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("TextSearchService")],t)}(base_service_1.BaseService);exports.TextSearchServiceImpl=TextSearchServiceImpl;
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
-
import { BaseService } from '../../core/services/base.service';
|
|
4
|
-
import { ServiceProvider } from '../../core/services/service-provider';
|
|
5
|
-
import { AssemblyHierarchyNode } from '../../data/models/assembly-hierarchy-node';
|
|
6
|
-
import { KvpHardFilter, SearchFilter } from '../models/search-filter';
|
|
7
|
-
import { SearchStatus } from '../models/search-status/search-status';
|
|
8
|
-
/**
|
|
9
|
-
* Manages search filters for the current search session.
|
|
10
|
-
* Provides methods that manipulate and upload the filter status.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated use SearchService.performSearch instead
|
|
13
|
-
*/
|
|
14
|
-
export interface SearchFilterService {
|
|
15
|
-
/**
|
|
16
|
-
* Get an observable that always emits the currently set Search-Filters
|
|
17
|
-
*
|
|
18
|
-
* @returns Observable that emits an oAssemblyHierarchyNodesServiceImplSearch-Filters, whenever
|
|
19
|
-
* the filters are updated
|
|
20
|
-
*
|
|
21
|
-
* @deprecated use SearchService.performSearch instead
|
|
22
|
-
*/
|
|
23
|
-
getFilters(): Observable<{
|
|
24
|
-
[filterKey: string]: SearchFilter;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Get an observable that always emits the currently set Search-Filters
|
|
28
|
-
*
|
|
29
|
-
* @deprecated this method is deprecated in favor of getFilters
|
|
30
|
-
*
|
|
31
|
-
* @returns Observable that emits an array of the current Search-Filters, whenever
|
|
32
|
-
* the filters are updated
|
|
33
|
-
*/
|
|
34
|
-
getSearchFilters(): Observable<SearchFilter[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Get an observable that always emits the currently excluded HierarchAssemblyHierarchyNodesServiceImpl
|
|
37
|
-
*
|
|
38
|
-
* @deprecated this method is deprecated in favor of getFilters containing the excluded node id's as part of the filter objects
|
|
39
|
-
* @returns Observable that emits an array of the currently excluded Hierarchy-Filters, whenever
|
|
40
|
-
* the filters are updated
|
|
41
|
-
*/
|
|
42
|
-
getExcludedHierarchyFilterNodes(): Observable<{
|
|
43
|
-
[id: string]: AssemblyHierarchyNode;
|
|
44
|
-
}>;
|
|
45
|
-
/**
|
|
46
|
-
* Change the current Search-Filters in the search-session to the one that are passed as filters map.
|
|
47
|
-
* This removes any previously set search filters and replaces them with the passed filters.
|
|
48
|
-
*
|
|
49
|
-
* @param filters the search filters map
|
|
50
|
-
* @returns Observable that resolves with the request to the backend.
|
|
51
|
-
*
|
|
52
|
-
* @deprecated use SearchService.performSearch instead
|
|
53
|
-
*/
|
|
54
|
-
setFilters(filters: {
|
|
55
|
-
[filterKey: string]: SearchFilter;
|
|
56
|
-
}): Observable<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Change the current Search-Filters in the search-session to the one that are passed
|
|
59
|
-
* (remove existing ones)
|
|
60
|
-
* @deprecated this method will be removed in future SDK releases, please use "setFilters" instead
|
|
61
|
-
*
|
|
62
|
-
* @param filters the array of search filters to set. multiple filters with the same filter key will be merged and de-duplicated
|
|
63
|
-
* @returns Observable that resolves with the request to the backend.
|
|
64
|
-
*/
|
|
65
|
-
setSearchFilters(filters: Array<SearchFilter>): Observable<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Update the current Search-Filters in the search-session to the one that are passed
|
|
68
|
-
* (removes existing ones)
|
|
69
|
-
*
|
|
70
|
-
* @deprecated this method will be removed in future SDK releases, please use "setFilters" instead
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param filtersAdd the array of search filters to add (only considers HierarchyFilter)
|
|
74
|
-
* @param filtersRemove the array of search filters to remove (only considers HierarchyFilter)
|
|
75
|
-
* @returns Observable that resolves with the request to the backend.
|
|
76
|
-
*/
|
|
77
|
-
updateSearchFilters(filtersAdd: Array<SearchFilter>, filtersRemove: Array<SearchFilter>): Observable<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Add a single Search-Filter to the current search-session
|
|
80
|
-
*
|
|
81
|
-
* @deprecated this method will be removed in future SDK releases, please use "setFilters" instead
|
|
82
|
-
*
|
|
83
|
-
* @param filter search filters to add
|
|
84
|
-
* @returns Observable that resolves with the request to the backend.
|
|
85
|
-
*/
|
|
86
|
-
addSearchFilter(filter: SearchFilter): Observable<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Remove a single Search-Filter to the current search-session
|
|
89
|
-
*
|
|
90
|
-
* @deprecated this method will be removed in future SDK releases, please use "setFilters" instead
|
|
91
|
-
*
|
|
92
|
-
* @param filter search filters to remove (removes filters with same filter key)
|
|
93
|
-
* @returns Observable that resolves with the request to the backend.
|
|
94
|
-
*/
|
|
95
|
-
removeSearchFilter(filter: SearchFilter): Observable<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Maps and returns the selected hard filter values and hierarchy filter values into the right structure to be uploaded by the uploadSearchFilters() method:
|
|
98
|
-
*
|
|
99
|
-
* @param selectedHardFiltersKeyWithValues the hard filters with the selected values type Array<FilterKeyWithValues>
|
|
100
|
-
* @param hierarchy the hierarchy filter values
|
|
101
|
-
* @returns an object with the filters , where the hardfilter id is the key of each of the filter objects { [filterKey: string]: SearchFilter }
|
|
102
|
-
*
|
|
103
|
-
* @deprecated use SearchService.performSearch instead
|
|
104
|
-
*/
|
|
105
|
-
mapFiltersToUploadFilterFormat(selectedHardFiltersKeyWithValues: Array<KvpHardFilter>, hierarchy: {
|
|
106
|
-
exclude: string[];
|
|
107
|
-
include: string[];
|
|
108
|
-
key: string;
|
|
109
|
-
}): {
|
|
110
|
-
[filterKey: string]: SearchFilter;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Checks if the filters have already been loaded after the polling mechanism. This can be used when loading a search session to await the filter input being correctly loaded
|
|
114
|
-
* @deprecated this is not relevant for the new search
|
|
115
|
-
* @returns an observable with the boolean type
|
|
116
|
-
*/
|
|
117
|
-
getSearchInputFiltersLoaded(): Observable<boolean>;
|
|
118
|
-
}
|
|
119
|
-
export declare class SearchFilterServiceImpl extends BaseService implements SearchFilterService {
|
|
120
|
-
searchFiltersLoaded$: BehaviorSubject<boolean>;
|
|
121
|
-
private httpsService;
|
|
122
|
-
private searchResultService;
|
|
123
|
-
private assemblyHierarchyNodeService;
|
|
124
|
-
private searchFilterUploader;
|
|
125
|
-
private searchStatus;
|
|
126
|
-
private searchFilters$;
|
|
127
|
-
private searchFiltersMap$;
|
|
128
|
-
private excludedHierarchyFilterNodes$;
|
|
129
|
-
constructor(serviceProvider: ServiceProvider);
|
|
130
|
-
onCreate(): void;
|
|
131
|
-
getSearchInputFiltersLoaded(): Observable<boolean>;
|
|
132
|
-
reset(searchStatus: SearchStatus): void;
|
|
133
|
-
/**
|
|
134
|
-
* Set the search filters to a certain status.
|
|
135
|
-
* This can happen if an old search-session is loaded or a change of the search-input
|
|
136
|
-
* was initiated on the backend-side.
|
|
137
|
-
*
|
|
138
|
-
* @param searchStatus the search-status object
|
|
139
|
-
* @param filters the filters object
|
|
140
|
-
*/
|
|
141
|
-
setStatusExternal(searchStatus: SearchStatus, filters?: {
|
|
142
|
-
[filterKey: string]: SearchFilter;
|
|
143
|
-
}): void;
|
|
144
|
-
getFilters(): Observable<{
|
|
145
|
-
[filterKey: string]: SearchFilter;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Maps and returns the selected hard filter values and hierarchy filter values into the right structure to be uploaded by the uploadSearchFilters() method:
|
|
149
|
-
*
|
|
150
|
-
* @param selectedHardFiltersKeyWithValues the hard filters with the selected values type Array<FilterKeyWithValues>
|
|
151
|
-
* @param hierarchy the hierarchy filter values
|
|
152
|
-
* @returns an object with the filters , where the hardfilter id is the key of each of the filter objects { [filterKey: string]: SearchFilter }
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* The structure should be something similar to this:
|
|
156
|
-
*
|
|
157
|
-
hierarchy-partium-id: {
|
|
158
|
-
"key": "hierarchy-partium-id",
|
|
159
|
-
"type": "includeExclude",
|
|
160
|
-
"include": [
|
|
161
|
-
"2d102f6a-343a-43ff-9a05-8eb84715a302"
|
|
162
|
-
],
|
|
163
|
-
"exclude": []
|
|
164
|
-
}
|
|
165
|
-
en/2392692c-dd1f-481e-97cd-3fcd971158b4": {
|
|
166
|
-
"key": "en/2392692c-dd1f-481e-97cd-3fcd971158b4",
|
|
167
|
-
"type": "kvpHardFilter",
|
|
168
|
-
"values": [
|
|
169
|
-
"25A",
|
|
170
|
-
"3A"
|
|
171
|
-
],
|
|
172
|
-
"label": "Amperage"
|
|
173
|
-
}
|
|
174
|
-
*/
|
|
175
|
-
mapFiltersToUploadFilterFormat(hardFilters: Array<KvpHardFilter>, hierarchy: {
|
|
176
|
-
exclude: string[];
|
|
177
|
-
include: string[];
|
|
178
|
-
key: string;
|
|
179
|
-
}): {
|
|
180
|
-
[filterKey: string]: SearchFilter;
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated this method is deprecated in favor of getFilters
|
|
184
|
-
*/
|
|
185
|
-
getSearchFilters(): Observable<SearchFilter[]>;
|
|
186
|
-
/**
|
|
187
|
-
* @deprecated this method is deprecated in favor of getFilters containing the excluded node id's as part of the filter objects
|
|
188
|
-
*/
|
|
189
|
-
getExcludedHierarchyFilterNodes(): Observable<{
|
|
190
|
-
[id: string]: AssemblyHierarchyNode;
|
|
191
|
-
}>;
|
|
192
|
-
setFilters(filters: {
|
|
193
|
-
[filterKey: string]: SearchFilter;
|
|
194
|
-
}): Observable<void>;
|
|
195
|
-
/**
|
|
196
|
-
* @deprecated this method is deprecated in favor of setFilters
|
|
197
|
-
*/
|
|
198
|
-
setSearchFilters(filters: Array<SearchFilter>): Observable<void>;
|
|
199
|
-
/**
|
|
200
|
-
* helper function to merge multiple filters with same key to one filter
|
|
201
|
-
* @param filters array of search filters
|
|
202
|
-
* @returns dict of search filters grouped by their filter key
|
|
203
|
-
*/
|
|
204
|
-
private mergeFilters;
|
|
205
|
-
/**
|
|
206
|
-
* @deprecated this method is deprecated in favor of setFilters
|
|
207
|
-
*/
|
|
208
|
-
updateSearchFilters(filtersAdd: Array<SearchFilter>, filtersRemove: Array<SearchFilter>): Observable<void>;
|
|
209
|
-
/**
|
|
210
|
-
* @deprecated this method is deprecated in favor of setFilters
|
|
211
|
-
*/
|
|
212
|
-
addSearchFilter(filter: SearchFilter): Observable<void>;
|
|
213
|
-
/**
|
|
214
|
-
* @deprecated this method is deprecated in favor of setFilters
|
|
215
|
-
*/
|
|
216
|
-
removeSearchFilter(filter: SearchFilter): Observable<void>;
|
|
217
|
-
/**
|
|
218
|
-
* Send the Request for updating the Search-Filters to the backend
|
|
219
|
-
* @param filters dict of all Search-Filters to set in the search
|
|
220
|
-
* @returns Observable that resolves with the request to the backend.
|
|
221
|
-
*/
|
|
222
|
-
private uploadSearchFilters;
|
|
223
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
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 s(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}}(),__decorate=this&&this.__decorate||function(e,r,t,s){var i,a=arguments.length,c=a<3?r:null===s?s=Object.getOwnPropertyDescriptor(r,t):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,r,t,s);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(c=(a<3?i(c):a>3?i(r,t,c):i(r,t))||c);return a>3&&c&&Object.defineProperty(r,t,c),c},__spreadArray=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var s,i=0,a=r.length;i<a;i++)!s&&i in r||(s||(s=Array.prototype.slice.call(r,0,i)),s[i]=r[i]);return e.concat(s||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SearchFilterServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../../core/decorators/injection-identifier"),base_service_1=require("../../core/services/base.service"),https_service_interface_1=require("../../core/services/http/https.service.interface"),assembly_hierarchy_nodes_service_1=require("../../data/services/assembly-hierarchy-nodes.service"),search_filter_1=require("../models/search-filter"),update_filters_uploader_1=require("./filter-uploaders/update-filters-uploader"),search_result_service_1=require("./search/search-result.service"),SearchFilterServiceImpl=function(e){function r(r){var t=e.call(this,r)||this;return t.searchFiltersLoaded$=new rxjs_1.BehaviorSubject(!1),t.searchFilters$=new rxjs_1.BehaviorSubject([]),t.searchFiltersMap$=new rxjs_1.BehaviorSubject({}),t.excludedHierarchyFilterNodes$=new rxjs_1.BehaviorSubject({}),t}return __extends(r,e),r.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.searchResultService=this.serviceProvider.getService(search_result_service_1.SearchResultService),this.assemblyHierarchyNodeService=this.serviceProvider.getService(assembly_hierarchy_nodes_service_1.AssemblyHierarchyNodesServiceImpl),this.searchFilterUploader=new update_filters_uploader_1.UpdateFiltersUploader(this.httpsService)},r.prototype.getSearchInputFiltersLoaded=function(){return this.searchFiltersLoaded$},r.prototype.reset=function(e){var r,t;this.searchStatus=e,this.searchStatus.filterStatus.filters=[],this.searchStatus.filterStatus.filtersMap={},this.searchStatus.filterStatus.excludedHierarchyNodes={},this.searchFilters$.next([]),this.searchFiltersMap$.next({}),this.searchFiltersLoaded$.next(!1),this.excludedHierarchyFilterNodes$.next({}),null===(r=this.searchFilterUploader)||void 0===r||r.reset(),null===(t=this.searchResultService)||void 0===t||t.startPollingForResults()},r.prototype.setStatusExternal=function(e,r){this.searchStatus=e,r&&(this.searchStatus.filterStatus.filters=Object.values(r),this.searchStatus.filterStatus.filtersMap=r,this.searchFilters$.next(this.searchStatus.filterStatus.filters),this.searchFiltersMap$.next(this.searchStatus.filterStatus.filtersMap)),this.searchFiltersLoaded$.next(!0)},r.prototype.getFilters=function(){return this.searchFiltersMap$.asObservable()},r.prototype.mapFiltersToUploadFilterFormat=function(e,r){var t={};return r&&(t[r.key]=new search_filter_1.HierarchyPartiumIdFilter(r.include,r.exclude)),e.length>0&&e.forEach((function(e){t[e.key]=e})),t},r.prototype.getSearchFilters=function(){return this.searchFilters$.asObservable()},r.prototype.getExcludedHierarchyFilterNodes=function(){return this.excludedHierarchyFilterNodes$.asObservable()},r.prototype.setFilters=function(e){var r=this;return this.uploadSearchFilters(e).pipe((0,operators_1.mergeMap)((function(){var t=e[search_filter_1.HierarchyPartiumIdFilter.KEY];return t&&t.exclude&&t.exclude.length?r.assemblyHierarchyNodeService.getAssemblyHierarchyNodes(t.exclude):(0,rxjs_1.of)([])})),(0,operators_1.map)((function(t){r.searchStatus.filterStatus.filters=Object.values(e),r.searchStatus.filterStatus.filtersMap=e,r.searchStatus.filterStatus.excludedHierarchyNodes=t.reduce((function(e,r){return e[r.partiumId]=r,e}),{}),console.log("NEW filter state: ",{filters:e,excludedNodes:Object.keys(r.searchStatus.filterStatus.excludedHierarchyNodes)}),r.excludedHierarchyFilterNodes$.next(r.searchStatus.filterStatus.excludedHierarchyNodes),r.searchFilters$.next(r.searchStatus.filterStatus.filters),r.searchFiltersMap$.next(r.searchStatus.filterStatus.filtersMap)})))},r.prototype.setSearchFilters=function(e){console.log("SearchFilterService - setSearchFilters():",e);var r=this.mergeFilters(e);return this.setFilters(r)},r.prototype.mergeFilters=function(e){for(var r={},t=0,s=e;t<s.length;t++){var i=s[t];if(i instanceof search_filter_1.HierarchyFilter){var a=Array.isArray(i.value)?i.value:[i.value];(c=r[i.key])?c.include=__spreadArray([],Array.from(new Set(__spreadArray(__spreadArray([],c.include,!0),a,!0))),!0):r[i.key]=new search_filter_1.HierarchyPartiumIdFilter(a,[])}else if(i instanceof search_filter_1.HierarchyPartiumIdFilter){(c=r[i.key])?(c.include=__spreadArray([],Array.from(new Set(__spreadArray(__spreadArray([],c.include,!0),i.include,!0))),!0),c.exclude=__spreadArray([],Array.from(new Set(__spreadArray(__spreadArray([],c.exclude,!0),i.exclude,!0))),!0)):r[i.key]=new search_filter_1.HierarchyPartiumIdFilter(i.include,i.exclude)}else if(i instanceof search_filter_1.CategoryFilter){var c;if(c=r[i.key]){a=Array.isArray(i.value)?i.value:[i.value];var l=Array.isArray(c.value)?c.value:[c.value];c.value=__spreadArray([],Array.from(new Set(__spreadArray(__spreadArray([],l,!0),a,!0))),!0)}else r[i.key]=i}}return r},r.prototype.updateSearchFilters=function(e,r){console.log("SearchFilterService - updateSearchFilters( filtersAdd: %s ; filtersRemove: %s )",e,r);var t=e.filter((function(e){return e instanceof search_filter_1.HierarchyFilter})).reduce((function(e,r){var t=Array.isArray(r.value)?r.value:[r.value];return __spreadArray(__spreadArray([],e,!0),t,!0)}),[]),s=r.filter((function(e){return e instanceof search_filter_1.HierarchyFilter})).reduce((function(e,r){var t=Array.isArray(r.value)?r.value:[r.value];return __spreadArray(__spreadArray([],e,!0),t,!0)}),[]),i=new search_filter_1.HierarchyPartiumIdFilter(t,s);return this.setSearchFilters([i])},r.prototype.addSearchFilter=function(e){console.log("SearchFilterService - addSearchFilter():",e);var r=__spreadArray(__spreadArray([],this.searchStatus.filterStatus.filters,!0),[e],!1);return this.setSearchFilters(r)},r.prototype.removeSearchFilter=function(e){console.log("SearchFilterService - removeSearchFilter(): ",e);var r=__spreadArray([],this.searchStatus.filterStatus.filters,!0),t=r.findIndex((function(r){return r.key===e.key}));return t>-1&&r.splice(t,1),this.setSearchFilters(r)},r.prototype.uploadSearchFilters=function(e){var r=this;return console.log("SearchFilterService - uploadSearchFilters() .."),this.searchFilterUploader.uploadFilters(e,this.searchStatus.searchSessionID).pipe((0,operators_1.tap)((function(){r.searchResultService.startPollingForResults()})))},r=__decorate([(0,injection_identifier_1.InjectionIdentifier)("SearchFilterService")],r)}(base_service_1.BaseService);exports.SearchFilterServiceImpl=SearchFilterServiceImpl;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import { SearchInput } from "../models/search-input";
|
|
4
|
-
import { SearchEventContext } from "../services/search/search.service";
|
|
5
|
-
import { Part } from "../../data";
|
|
6
|
-
/**
|
|
7
|
-
* Helper function for sync search.
|
|
8
|
-
* Performs an image search based on the given search-input.
|
|
9
|
-
*/
|
|
10
|
-
export declare const performImageSearch: (organizationId: string, searchInput: SearchInput, searchEventContext?: SearchEventContext) => Observable<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Load all results of a given searchSessionId
|
|
13
|
-
*/
|
|
14
|
-
export declare const getAllResults: (searchSessionId: string, maxPartCount?: number) => Observable<Part[]>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// Copyright © 2022-2026 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAllResults=exports.performImageSearch=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),asset_1=require("../models/assets/asset"),__1=require("../.."),data_1=require("../../data"),performImageSearch=function(e,r,t){var s;if(r.searchImageAssetId){var a=new asset_1.Asset(null==r?void 0:r.searchImage);a.referenceId=r.searchImageAssetId,s=__1.Partium.search.cv.performCVObs(a,r.searchImageCropArea)}else s=r.searchImage?__1.Partium.asset.generateAsset(e,r.searchImage,{eventInterface:null==t?void 0:t.eventInterface}).pipe((0,rxjs_1.filter)((function(e){return e.asset.getStatus()===asset_1.ASSET_STATUS.VERIFIED})),(0,rxjs_1.first)(),(0,rxjs_1.mergeMap)((function(e){return __1.Partium.search.cv.performCVObs(e.asset,r.searchImageCropArea)}))):(0,rxjs_1.of)(null);return s.pipe((0,rxjs_1.catchError)((function(e){return e.code===core_1.SDK_ERROR_CODES.INVALID_MULTIPLE_IMAGE_SEARCHES?(console.log("Swallowed INVALID_MULTIPLE_IMAGE_SEARCHES error"),(0,rxjs_1.of)(null)):(0,rxjs_1.throwError)((function(){return e}))})))};exports.performImageSearch=performImageSearch;var getAllResults=function(e,r){return void 0===r&&(r=500),__1.Partium.https.get("search/".concat(e),[{skip:0},{limit:r}]).pipe((0,rxjs_1.map)((function(e){return e&&e.results&&e.results.entities?e.results.entities.map((function(e){return new data_1.Part({name:new core_1.i18nString(e.name),partiumId:e.partiumId,externalId:e.externalId,externalPayload:e.externalPayload,dataOrigin:data_1.DATA_ORIGIN.PARTIAL})})):[]})))};exports.getAllResults=getAllResults;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|