arlas-web-core 19.2.0 → 19.3.0-dev0
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/.editorconfig +13 -0
- package/.gitlab-ci.yml +19 -0
- package/.travis.yml +27 -0
- package/CHANGELOG.md +446 -0
- package/CONTRIBUTING.md +48 -0
- package/{LICENSE → LICENSE.txt} +0 -0
- package/NOTICE.txt +10 -0
- package/README-NPM.md +78 -0
- package/README.md +2 -2
- package/arlas-web-core-19.3.0-dev0.tgz +0 -0
- package/build.sh +9 -0
- package/jsconfig.json +13 -0
- package/mkDocs.sh +18 -0
- package/package-release.json +25 -0
- package/package.json +12 -6
- package/release.sh +429 -0
- package/{index.js → src/index.ts} +7 -4
- package/{models/collaboration.js → src/models/collaboration.ts} +30 -6
- package/src/models/contributor.ts +161 -0
- package/src/models/projections.ts +58 -0
- package/{services/collaborativesearch.service.js → src/services/collaborativesearch.service.ts} +366 -178
- package/{services/config.service.js → src/services/config.service.ts} +15 -11
- package/src/utils/utils.ts +80 -0
- package/tsconfig-build.json +21 -0
- package/tsconfig.json +15 -0
- package/tslint.json +116 -0
- package/index.d.ts +0 -6
- package/index.js.map +0 -1
- package/models/collaboration.d.ts +0 -29
- package/models/collaboration.js.map +0 -1
- package/models/contributor.d.ts +0 -56
- package/models/contributor.js +0 -116
- package/models/contributor.js.map +0 -1
- package/models/projections.d.ts +0 -35
- package/models/projections.js +0 -38
- package/models/projections.js.map +0 -1
- package/services/collaborativesearch.service.d.ts +0 -320
- package/services/collaborativesearch.service.js.map +0 -1
- package/services/config.service.d.ts +0 -31
- package/services/config.service.js.map +0 -1
- package/utils/utils.d.ts +0 -22
- package/utils/utils.js +0 -63
- package/utils/utils.js.map +0 -1
|
@@ -16,48 +16,52 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
|
|
19
20
|
import { Subject } from 'rxjs';
|
|
20
21
|
import { getObject } from '../utils/utils';
|
|
22
|
+
|
|
21
23
|
export class ConfigService {
|
|
24
|
+
/**
|
|
25
|
+
* Bus of configuration error.
|
|
26
|
+
*/
|
|
27
|
+
public confErrorBus = new Subject<string>();
|
|
28
|
+
/**
|
|
29
|
+
* Object which contains the configuration (json format).
|
|
30
|
+
*/
|
|
31
|
+
private config: Object;
|
|
22
32
|
constructor() {
|
|
23
|
-
/**
|
|
24
|
-
* Bus of configuration error.
|
|
25
|
-
*/
|
|
26
|
-
this.confErrorBus = new Subject();
|
|
27
33
|
}
|
|
28
34
|
/**
|
|
29
35
|
* Retrieve Value from key in configuration object.
|
|
30
36
|
* @returns configuration value
|
|
31
37
|
*/
|
|
32
|
-
getValue(key) {
|
|
38
|
+
public getValue(key: string): any {
|
|
33
39
|
const conf = this.config;
|
|
34
40
|
const value = getObject(conf, 'conf.' + key);
|
|
35
41
|
if (value !== null) {
|
|
36
42
|
return getObject(conf, 'conf.' + key);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
43
|
+
} else {
|
|
39
44
|
this.errorCallBack(key);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
/**
|
|
43
48
|
* Notify bus error.
|
|
44
49
|
*/
|
|
45
|
-
errorCallBack(key) {
|
|
50
|
+
public errorCallBack(key: string) {
|
|
46
51
|
this.confErrorBus.next(key);
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
* Get configuration object.
|
|
50
55
|
* @returns configuration Object
|
|
51
56
|
*/
|
|
52
|
-
getConfig() {
|
|
57
|
+
public getConfig(): Object {
|
|
53
58
|
return this.config;
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
56
61
|
* Set configuration object.
|
|
57
62
|
* @param config Object
|
|
58
63
|
*/
|
|
59
|
-
setConfig(config) {
|
|
64
|
+
public setConfig(config: Object) {
|
|
60
65
|
this.config = config;
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
|
-
//# sourceMappingURL=config.service.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Gisaïa under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE.txt file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Gisaïa licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get object or String value of an object from key
|
|
22
|
+
* sample usage: getObject(object,key1.key2)
|
|
23
|
+
* @param {object} datalayer - datalayer object
|
|
24
|
+
* @param {string} objectKey? - optional
|
|
25
|
+
* @returns {any} returns object by key or string value
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export function getObject(datalayer: object, objectKey?: string): any {
|
|
29
|
+
// if datalayer doesn't exists, just return
|
|
30
|
+
if (!datalayer) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// default return datalayer
|
|
34
|
+
let current = datalayer;
|
|
35
|
+
// check every layer
|
|
36
|
+
if (typeof objectKey === 'string') {
|
|
37
|
+
const numberOfObjectHierarchy = objectKey.match(/\./g).length;
|
|
38
|
+
for (let i = 1; i <= numberOfObjectHierarchy; i++) {
|
|
39
|
+
const currentKey = objectKey.split(/\./)[i];
|
|
40
|
+
if (typeof current[currentKey] === 'undefined') {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
current = current[currentKey];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return current;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** This interface will be used to get on which field to aggregate for a collection */
|
|
51
|
+
export interface CollectionAggField {
|
|
52
|
+
field?: string;
|
|
53
|
+
collectionName: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** checks if there is a common string in the given arrays */
|
|
57
|
+
export function hasAtLeastOneCommon(collections1: string[], collections2: string[]): boolean {
|
|
58
|
+
const cSet1 = new Set(collections1);
|
|
59
|
+
if (!!cSet1 && collections2) {
|
|
60
|
+
return collections2.filter(c => cSet1.has(c)).length > 0;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function fromEntries<T = any>(map: Map<string, T>): { [k: string]: T } {
|
|
66
|
+
|
|
67
|
+
const object = {};
|
|
68
|
+
if (!!map) {
|
|
69
|
+
map.forEach((v, k) => {
|
|
70
|
+
object[k] = v;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return object;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CollectionCount {
|
|
77
|
+
count: number;
|
|
78
|
+
collection: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist/",
|
|
5
|
+
"baseUrl": "src",
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"target": "es6",
|
|
9
|
+
"module": "es2015",
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"emitDecoratorMetadata": true,
|
|
12
|
+
"experimentalDecorators": true,
|
|
13
|
+
"stripInternal": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"typeRoots": ["node_modules/@types"],
|
|
16
|
+
"lib": ["es2015", "es6", "es2019", "dom"]
|
|
17
|
+
},
|
|
18
|
+
"files": ["src/index.ts"],
|
|
19
|
+
"include": ["src/**/*"],
|
|
20
|
+
"exclude": ["node_modules", "dist"]
|
|
21
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist/",
|
|
5
|
+
"baseUrl": "src",
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"emitDecoratorMetadata": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"target": "es6",
|
|
12
|
+
"typeRoots": ["node_modules/@types"],
|
|
13
|
+
"lib": ["es2016", "es2019", "dom"]
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tslint.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rules": {
|
|
3
|
+
"arrow-return-shorthand": true,
|
|
4
|
+
"callable-types": true,
|
|
5
|
+
"class-name": true,
|
|
6
|
+
"comment-format": [
|
|
7
|
+
true,
|
|
8
|
+
"check-space"
|
|
9
|
+
],
|
|
10
|
+
"curly": true,
|
|
11
|
+
"eofline": true,
|
|
12
|
+
"forin": true,
|
|
13
|
+
"import-blacklist": [
|
|
14
|
+
true
|
|
15
|
+
],
|
|
16
|
+
"import-spacing": true,
|
|
17
|
+
"indent": [
|
|
18
|
+
true,
|
|
19
|
+
"spaces"
|
|
20
|
+
],
|
|
21
|
+
"interface-over-type-literal": true,
|
|
22
|
+
"label-position": true,
|
|
23
|
+
"max-line-length": [
|
|
24
|
+
true,
|
|
25
|
+
140
|
|
26
|
+
],
|
|
27
|
+
"member-access": true,
|
|
28
|
+
"member-ordering": [
|
|
29
|
+
true,
|
|
30
|
+
{
|
|
31
|
+
"order": [
|
|
32
|
+
"static-field",
|
|
33
|
+
"instance-field",
|
|
34
|
+
"constructor",
|
|
35
|
+
"public-instance-method",
|
|
36
|
+
"protected-instance-method",
|
|
37
|
+
"private-instance-method"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"no-arg": true,
|
|
42
|
+
"no-bitwise": true,
|
|
43
|
+
"no-console": [
|
|
44
|
+
true,
|
|
45
|
+
"debug",
|
|
46
|
+
"info",
|
|
47
|
+
"time",
|
|
48
|
+
"timeEnd",
|
|
49
|
+
"trace"
|
|
50
|
+
],
|
|
51
|
+
"no-construct": true,
|
|
52
|
+
"no-debugger": true,
|
|
53
|
+
"no-duplicate-super": true,
|
|
54
|
+
"no-duplicate-variable": true,
|
|
55
|
+
"no-empty": false,
|
|
56
|
+
"no-empty-interface": true,
|
|
57
|
+
"no-eval": true,
|
|
58
|
+
"no-internal-module": true,
|
|
59
|
+
"no-inferrable-types": [
|
|
60
|
+
true,
|
|
61
|
+
"ignore-params"
|
|
62
|
+
],
|
|
63
|
+
"no-misused-new": true,
|
|
64
|
+
"no-non-null-assertion": true,
|
|
65
|
+
"no-shadowed-variable": true,
|
|
66
|
+
"no-string-literal": false,
|
|
67
|
+
"no-string-throw": true,
|
|
68
|
+
"no-switch-case-fall-through": true,
|
|
69
|
+
"no-trailing-whitespace": true,
|
|
70
|
+
"no-unnecessary-initializer": true,
|
|
71
|
+
"no-unused-expression": true,
|
|
72
|
+
"no-var-keyword": true,
|
|
73
|
+
"object-literal-sort-keys": false,
|
|
74
|
+
"one-line": [
|
|
75
|
+
true,
|
|
76
|
+
"check-open-brace",
|
|
77
|
+
"check-catch",
|
|
78
|
+
"check-else",
|
|
79
|
+
"check-whitespace"
|
|
80
|
+
],
|
|
81
|
+
"prefer-const": true,
|
|
82
|
+
"quotemark": [
|
|
83
|
+
true,
|
|
84
|
+
"single"
|
|
85
|
+
],
|
|
86
|
+
"radix": true,
|
|
87
|
+
"semicolon": true,
|
|
88
|
+
"triple-equals": [
|
|
89
|
+
true,
|
|
90
|
+
"allow-null-check"
|
|
91
|
+
],
|
|
92
|
+
"typedef-whitespace": [
|
|
93
|
+
true,
|
|
94
|
+
{
|
|
95
|
+
"call-signature": "nospace",
|
|
96
|
+
"index-signature": "nospace",
|
|
97
|
+
"parameter": "nospace",
|
|
98
|
+
"property-declaration": "nospace",
|
|
99
|
+
"variable-declaration": "nospace"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"unified-signatures": true,
|
|
103
|
+
"variable-name": [
|
|
104
|
+
true,
|
|
105
|
+
"ban-keywords"
|
|
106
|
+
],
|
|
107
|
+
"whitespace": [
|
|
108
|
+
true,
|
|
109
|
+
"check-branch",
|
|
110
|
+
"check-decl",
|
|
111
|
+
"check-operator",
|
|
112
|
+
"check-separator",
|
|
113
|
+
"check-type"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
package/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { CollaborativesearchService } from './services/collaborativesearch.service';
|
|
2
|
-
export { ConfigService } from './services/config.service';
|
|
3
|
-
export { projType, TiledSearch, GeohashAggregation, GeoTileAggregation } from './models/projections';
|
|
4
|
-
export { Contributor } from './models/contributor';
|
|
5
|
-
export { Collaboration, OperationEnum, CollaborationEvent } from './models/collaboration';
|
|
6
|
-
export { fromEntries, CollectionCount, CollectionAggField } from './utils/utils';
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAuD,MAAM,sBAAsB,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAiB,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAuC,MAAM,eAAe,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Filter } from 'arlas-api';
|
|
2
|
-
/**
|
|
3
|
-
* - A filter object from ARLAS API.
|
|
4
|
-
* - A boolean to know if the filter of the collaboration is enabled.
|
|
5
|
-
*/
|
|
6
|
-
export interface Collaboration {
|
|
7
|
-
filters: Map<string, Filter[]>;
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface FilterOnCollection extends Filter {
|
|
11
|
-
collection: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* - An id of a contributor.
|
|
15
|
-
* - An operation add/remove.
|
|
16
|
-
* - If the operation is for all the contributors
|
|
17
|
-
*/
|
|
18
|
-
export interface CollaborationEvent {
|
|
19
|
-
id: string;
|
|
20
|
-
operation: OperationEnum;
|
|
21
|
-
all: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* - Enum of operation.
|
|
25
|
-
*/
|
|
26
|
-
export declare enum OperationEnum {
|
|
27
|
-
add = 0,
|
|
28
|
-
remove = 1
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.js","sourceRoot":"","sources":["../../src/models/collaboration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA4BH;;EAEE;AACF,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+CAAG,CAAA;IAAE,qDAAM,CAAA;AACb,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB"}
|
package/models/contributor.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ConfigService } from '../services/config.service';
|
|
2
|
-
import { CollaborativesearchService } from '../services/collaborativesearch.service';
|
|
3
|
-
import { CollaborationEvent, Collaboration } from './collaboration';
|
|
4
|
-
import { Observable, Subject } from 'rxjs';
|
|
5
|
-
import { CollectionAggField } from '../utils/utils';
|
|
6
|
-
export declare abstract class Contributor {
|
|
7
|
-
identifier: string;
|
|
8
|
-
configService: ConfigService;
|
|
9
|
-
collaborativeSearcheService: CollaborativesearchService;
|
|
10
|
-
private name;
|
|
11
|
-
private fetchedData;
|
|
12
|
-
private _updateData;
|
|
13
|
-
isDataUpdating: boolean;
|
|
14
|
-
collection: string;
|
|
15
|
-
collections: CollectionAggField[];
|
|
16
|
-
endCollaborationEvent: Subject<unknown>;
|
|
17
|
-
protected cacheDuration: number;
|
|
18
|
-
/**
|
|
19
|
-
* @param identifier string identifier of the contributor.
|
|
20
|
-
* @param configService configService of the contributor.
|
|
21
|
-
*/
|
|
22
|
-
constructor(identifier: string, configService: ConfigService, collaborativeSearcheService: CollaborativesearchService, collection?: string);
|
|
23
|
-
/**
|
|
24
|
-
* @returns package name of contributor used in configuration.
|
|
25
|
-
*/
|
|
26
|
-
abstract getPackageName(): string;
|
|
27
|
-
/**
|
|
28
|
-
* @param key a `key` defined in configuration.
|
|
29
|
-
* @returns value of the `key` in configuration.
|
|
30
|
-
*/
|
|
31
|
-
getConfigValue(key: string): any;
|
|
32
|
-
/**
|
|
33
|
-
* @returns name of contributor set in configuration.
|
|
34
|
-
*/
|
|
35
|
-
getName(): string;
|
|
36
|
-
/**
|
|
37
|
-
* @returns set the name of the contributor
|
|
38
|
-
*/
|
|
39
|
-
setName(name: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* @returns whether the data of contributor should be updated.
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* @param value set if the data of contributor should be updated or not.
|
|
45
|
-
*/
|
|
46
|
-
updateData: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* @returns name and live informations about filter contributor.
|
|
49
|
-
*/
|
|
50
|
-
abstract getFilterDisplayName(): string;
|
|
51
|
-
abstract fetchData(collaborationEvent: CollaborationEvent): Observable<any>;
|
|
52
|
-
abstract computeData(data: any): any;
|
|
53
|
-
abstract setData(data: any): any;
|
|
54
|
-
abstract setSelection(data: any, c: Collaboration): any;
|
|
55
|
-
updateFromCollaboration(collaborationEvent: CollaborationEvent): void;
|
|
56
|
-
}
|
package/models/contributor.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Licensed to Gisaïa under one or more contributor
|
|
3
|
-
* license agreements. See the NOTICE.txt file distributed with
|
|
4
|
-
* this work for additional information regarding copyright
|
|
5
|
-
* ownership. Gisaïa licenses this file to you under
|
|
6
|
-
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
-
* not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
|
13
|
-
* software distributed under the License is distributed on an
|
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
* KIND, either express or implied. See the License for the
|
|
16
|
-
* specific language governing permissions and limitations
|
|
17
|
-
* under the License.
|
|
18
|
-
*/
|
|
19
|
-
import { Subject } from 'rxjs';
|
|
20
|
-
import { map, finalize, debounceTime } from 'rxjs/operators';
|
|
21
|
-
import { hasAtLeastOneCommon as hasAtLeastOneCommon } from '../utils/utils';
|
|
22
|
-
export class Contributor {
|
|
23
|
-
/**
|
|
24
|
-
* @param identifier string identifier of the contributor.
|
|
25
|
-
* @param configService configService of the contributor.
|
|
26
|
-
*/
|
|
27
|
-
constructor(identifier, configService, collaborativeSearcheService, collection) {
|
|
28
|
-
this.identifier = identifier;
|
|
29
|
-
this.configService = configService;
|
|
30
|
-
this.collaborativeSearcheService = collaborativeSearcheService;
|
|
31
|
-
this._updateData = true;
|
|
32
|
-
this.isDataUpdating = false;
|
|
33
|
-
this.endCollaborationEvent = new Subject();
|
|
34
|
-
if (!!collection) {
|
|
35
|
-
this.collection = collection;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this.collection = this.collaborativeSearcheService.defaultCollection;
|
|
39
|
-
}
|
|
40
|
-
const configDebounceTime = this.configService.getValue('arlas.server.debounceCollaborationTime');
|
|
41
|
-
const debounceDuration = configDebounceTime !== undefined ? configDebounceTime : 750;
|
|
42
|
-
const configName = this.getConfigValue('name');
|
|
43
|
-
const configCacheDuration = this.getConfigValue('cache_duration');
|
|
44
|
-
this.cacheDuration = configCacheDuration ? configCacheDuration : this.collaborativeSearcheService.max_age;
|
|
45
|
-
this.name = configName ? configName : this.identifier;
|
|
46
|
-
// Register the contributor in collaborativeSearcheService registry
|
|
47
|
-
this.collaborativeSearcheService.register(this.identifier, this);
|
|
48
|
-
// Subscribe a bus to update data and selection
|
|
49
|
-
this.collaborativeSearcheService.collaborationBus.pipe(debounceTime(debounceDuration))
|
|
50
|
-
.subscribe(collaborationEvent => {
|
|
51
|
-
// Update only contributor of same collection that the current collaboration or on the init whit the url
|
|
52
|
-
let collaborationCollections;
|
|
53
|
-
if (!!this.collaborativeSearcheService.registry.get(collaborationEvent.id)) {
|
|
54
|
-
collaborationCollections = this.collaborativeSearcheService.registry.get(collaborationEvent.id).collections;
|
|
55
|
-
}
|
|
56
|
-
const cs1 = !!this.collections ? this.collections.map(c => c.collectionName) : [];
|
|
57
|
-
const cs2 = !!collaborationCollections ? collaborationCollections.map(c => c.collectionName) : [];
|
|
58
|
-
const update = collaborationEvent.id === 'url' || collaborationEvent.id === 'all' || hasAtLeastOneCommon(cs1, cs2);
|
|
59
|
-
if (this._updateData && update) {
|
|
60
|
-
this.updateFromCollaboration(collaborationEvent);
|
|
61
|
-
}
|
|
62
|
-
}, error => this.collaborativeSearcheService.collaborationErrorBus.next(error));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @param key a `key` defined in configuration.
|
|
66
|
-
* @returns value of the `key` in configuration.
|
|
67
|
-
*/
|
|
68
|
-
getConfigValue(key) {
|
|
69
|
-
let configValue = null;
|
|
70
|
-
const contributor = this.configService.getValue('arlas.web.contributors').find(contrib => contrib.identifier === this.identifier);
|
|
71
|
-
if (contributor) {
|
|
72
|
-
configValue = contributor[key];
|
|
73
|
-
}
|
|
74
|
-
return configValue;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @returns name of contributor set in configuration.
|
|
78
|
-
*/
|
|
79
|
-
getName() {
|
|
80
|
-
return this.name;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @returns set the name of the contributor
|
|
84
|
-
*/
|
|
85
|
-
setName(name) {
|
|
86
|
-
this.name = name;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @returns whether the data of contributor should be updated.
|
|
90
|
-
*/
|
|
91
|
-
get updateData() {
|
|
92
|
-
return this._updateData;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @param value set if the data of contributor should be updated or not.
|
|
96
|
-
*/
|
|
97
|
-
set updateData(value) {
|
|
98
|
-
this._updateData = value;
|
|
99
|
-
}
|
|
100
|
-
updateFromCollaboration(collaborationEvent) {
|
|
101
|
-
this.collaborativeSearcheService.ongoingSubscribe.next(1);
|
|
102
|
-
this.isDataUpdating = true;
|
|
103
|
-
this.fetchData(collaborationEvent)
|
|
104
|
-
.pipe(map(f => this.computeData(f)), map(f => { this.fetchedData = f; this.setData(f); }), finalize(() => {
|
|
105
|
-
this.setSelection(this.fetchedData, this.collaborativeSearcheService.getCollaboration(this.identifier));
|
|
106
|
-
this.collaborativeSearcheService.contribFilterBus
|
|
107
|
-
.next(this.collaborativeSearcheService.registry.get(this.identifier));
|
|
108
|
-
this.collaborativeSearcheService.ongoingSubscribe.
|
|
109
|
-
next(-1);
|
|
110
|
-
this.isDataUpdating = false;
|
|
111
|
-
this.endCollaborationEvent.next();
|
|
112
|
-
}))
|
|
113
|
-
.subscribe(data => data, error => this.collaborativeSearcheService.collaborationErrorBus.next(error));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=contributor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{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C,CAAC,CAAC,CAAC,EACpD,QAAQ,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YACxG,IAAI,CAAC,2BAA2B,CAAC,gBAAgB;iBAC5C,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YAC1E,IAAI,CAAC,2BAA2B,CAAC,gBAAgB;gBAC7C,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;YAC5B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC,CAAC,CACL;aACA,SAAS,CACN,IAAI,CAAC,EAAE,CAAC,IAAI,EACZ,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAC9E,CAAC;IACV,CAAC;CACJ"}
|
package/models/projections.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Search, Aggregation } from 'arlas-api';
|
|
2
|
-
/**
|
|
3
|
-
* Enum ARLAS SERVER type of request.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum projType {
|
|
6
|
-
aggregate = 0,
|
|
7
|
-
geoaggregate = 1,
|
|
8
|
-
geohashgeoaggregate = 2,
|
|
9
|
-
geotilegeoaggregate = 3,
|
|
10
|
-
count = 4,
|
|
11
|
-
search = 5,
|
|
12
|
-
geosearch = 6,
|
|
13
|
-
tiledgeosearch = 7,
|
|
14
|
-
/**range is deprecated and will be removed in v13.0.0 */
|
|
15
|
-
range = 8,
|
|
16
|
-
compute = 9,
|
|
17
|
-
shapesearch = 10,
|
|
18
|
-
shapeaggregate = 11
|
|
19
|
-
}
|
|
20
|
-
export interface TiledSearch {
|
|
21
|
-
search: Search;
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
z: number;
|
|
25
|
-
}
|
|
26
|
-
export interface GeohashAggregation {
|
|
27
|
-
geohash: string;
|
|
28
|
-
aggregations: Array<Aggregation>;
|
|
29
|
-
}
|
|
30
|
-
export interface GeoTileAggregation {
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
z: number;
|
|
34
|
-
aggregations: Array<Aggregation>;
|
|
35
|
-
}
|
package/models/projections.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Licensed to Gisaïa under one or more contributor
|
|
3
|
-
* license agreements. See the NOTICE.txt file distributed with
|
|
4
|
-
* this work for additional information regarding copyright
|
|
5
|
-
* ownership. Gisaïa licenses this file to you under
|
|
6
|
-
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
-
* not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
|
13
|
-
* software distributed under the License is distributed on an
|
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
* KIND, either express or implied. See the License for the
|
|
16
|
-
* specific language governing permissions and limitations
|
|
17
|
-
* under the License.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Enum ARLAS SERVER type of request.
|
|
21
|
-
*/
|
|
22
|
-
export var projType;
|
|
23
|
-
(function (projType) {
|
|
24
|
-
projType[projType["aggregate"] = 0] = "aggregate";
|
|
25
|
-
projType[projType["geoaggregate"] = 1] = "geoaggregate";
|
|
26
|
-
projType[projType["geohashgeoaggregate"] = 2] = "geohashgeoaggregate";
|
|
27
|
-
projType[projType["geotilegeoaggregate"] = 3] = "geotilegeoaggregate";
|
|
28
|
-
projType[projType["count"] = 4] = "count";
|
|
29
|
-
projType[projType["search"] = 5] = "search";
|
|
30
|
-
projType[projType["geosearch"] = 6] = "geosearch";
|
|
31
|
-
projType[projType["tiledgeosearch"] = 7] = "tiledgeosearch";
|
|
32
|
-
/**range is deprecated and will be removed in v13.0.0 */
|
|
33
|
-
projType[projType["range"] = 8] = "range";
|
|
34
|
-
projType[projType["compute"] = 9] = "compute";
|
|
35
|
-
projType[projType["shapesearch"] = 10] = "shapesearch";
|
|
36
|
-
projType[projType["shapeaggregate"] = 11] = "shapeaggregate";
|
|
37
|
-
})(projType || (projType = {}));
|
|
38
|
-
//# sourceMappingURL=projections.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projections.js","sourceRoot":"","sources":["../../src/models/projections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;EAEE;AACF,MAAM,CAAN,IAAY,QAcX;AAdD,WAAY,QAAQ;IAClB,iDAAS,CAAA;IACT,uDAAY,CAAA;IACZ,qEAAmB,CAAA;IACnB,qEAAmB,CAAA;IACnB,yCAAK,CAAA;IACL,2CAAM,CAAA;IACN,iDAAS,CAAA;IACT,2DAAc,CAAA;IACd,wDAAwD;IACxD,yCAAK,CAAA;IACL,6CAAO,CAAA;IACP,sDAAW,CAAA;IACX,4DAAc,CAAA;AAChB,CAAC,EAdW,QAAQ,KAAR,QAAQ,QAcnB"}
|