@onecx/accelerator 7.5.0 → 7.6.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/package.json +10 -3
- package/src/lib/declarations.d.ts +72 -32
- package/src/lib/declarations.js +9 -9
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/topic/message.d.ts +0 -5
- package/src/lib/topic/message.js +4 -3
- package/src/lib/topic/message.js.map +1 -1
- package/src/lib/topic/topic-publisher.js +11 -8
- package/src/lib/topic/topic-publisher.js.map +1 -1
- package/src/lib/topic/topic.d.ts +0 -1
- package/src/lib/topic/topic.js +19 -22
- package/src/lib/topic/topic.js.map +1 -1
- package/src/lib/utils/gatherer.d.ts +0 -1
- package/src/lib/utils/gatherer.js +11 -11
- package/src/lib/utils/gatherer.js.map +1 -1
- package/src/lib/utils/get-normalized-browser-locales.utils.js +3 -2
- package/src/lib/utils/get-normalized-browser-locales.utils.js.map +1 -1
- package/src/lib/utils/get-onecx-shared-recommendations.d.ts +8 -1
- package/src/lib/utils/get-onecx-shared-recommendations.js.map +1 -1
- package/src/lib/utils/is-test.utils.js.map +1 -1
- package/src/lib/utils/logs.utils.js +6 -9
- package/src/lib/utils/logs.utils.js.map +1 -1
- package/src/lib/utils/path.utils.js +9 -4
- package/src/lib/utils/path.utils.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onecx/accelerator",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,8 +10,15 @@
|
|
|
10
10
|
"tslib": "^2.6.3",
|
|
11
11
|
"rxjs": "^7.8.1",
|
|
12
12
|
"@nx/devkit": "^22.0.2",
|
|
13
|
-
"@nx
|
|
14
|
-
|
|
13
|
+
"@onecx/nx-migration-utils": "^7.6.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependenciesMeta": {
|
|
16
|
+
"@nx/devkit": {
|
|
17
|
+
"optional": true
|
|
18
|
+
},
|
|
19
|
+
"@onecx/nx-migration-utils": {
|
|
20
|
+
"optional": true
|
|
21
|
+
}
|
|
15
22
|
},
|
|
16
23
|
"type": "commonjs",
|
|
17
24
|
"main": "./src/index.js",
|
|
@@ -1,32 +1,72 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
declare const topicTabId: object & {
|
|
2
|
+
"@onecx/accelerator": {
|
|
3
|
+
gatherer: object & {
|
|
4
|
+
promises: Record<number, Promise<any>[]>;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
} & {
|
|
8
|
+
"@onecx/accelerator": {
|
|
9
|
+
gatherer: object & {
|
|
10
|
+
promises: Record<number, Promise<any>[]>;
|
|
11
|
+
} & {
|
|
12
|
+
debug: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} & {
|
|
16
|
+
"@onecx/accelerator": {
|
|
17
|
+
gatherer: object & {
|
|
18
|
+
promises: Record<number, Promise<any>[]>;
|
|
19
|
+
} & {
|
|
20
|
+
debug: string[];
|
|
21
|
+
};
|
|
22
|
+
topic: object & {
|
|
23
|
+
useBroadcastChannel: boolean | "V2";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
} & {
|
|
27
|
+
"@onecx/accelerator": {
|
|
28
|
+
gatherer: object & {
|
|
29
|
+
promises: Record<number, Promise<any>[]>;
|
|
30
|
+
} & {
|
|
31
|
+
debug: string[];
|
|
32
|
+
};
|
|
33
|
+
topic: object & {
|
|
34
|
+
useBroadcastChannel: boolean | "V2";
|
|
35
|
+
} & {
|
|
36
|
+
debug: string[] | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
} & {
|
|
40
|
+
"@onecx/accelerator": {
|
|
41
|
+
gatherer: object & {
|
|
42
|
+
promises: Record<number, Promise<any>[]>;
|
|
43
|
+
} & {
|
|
44
|
+
debug: string[];
|
|
45
|
+
};
|
|
46
|
+
topic: object & {
|
|
47
|
+
useBroadcastChannel: boolean | "V2";
|
|
48
|
+
} & {
|
|
49
|
+
debug: string[] | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
initDate: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
} & {
|
|
55
|
+
"@onecx/accelerator": {
|
|
56
|
+
gatherer: object & {
|
|
57
|
+
promises: Record<number, Promise<any>[]>;
|
|
58
|
+
} & {
|
|
59
|
+
debug: string[];
|
|
60
|
+
};
|
|
61
|
+
topic: object & {
|
|
62
|
+
useBroadcastChannel: boolean | "V2";
|
|
63
|
+
} & {
|
|
64
|
+
debug: string[] | undefined;
|
|
65
|
+
} & {
|
|
66
|
+
initDate: number;
|
|
67
|
+
} & {
|
|
68
|
+
tabId: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export { topicTabId as acceleratorState };
|
package/src/lib/declarations.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.
|
|
3
|
+
exports.acceleratorState = void 0;
|
|
4
|
+
const ensure_property_utils_1 = require("./utils/ensure-property.utils");
|
|
5
|
+
const gatherPromises = (0, ensure_property_utils_1.ensureProperty)(globalThis, ['@onecx/accelerator', 'gatherer', 'promises'], {});
|
|
6
|
+
const gatherDebug = (0, ensure_property_utils_1.ensureProperty)(gatherPromises, ['@onecx/accelerator', 'gatherer', 'debug'], []);
|
|
7
|
+
const topicUseBroadcastChannel = (0, ensure_property_utils_1.ensureProperty)(gatherDebug, ['@onecx/accelerator', 'topic', 'useBroadcastChannel'], 'V2');
|
|
8
|
+
const topicDebug = (0, ensure_property_utils_1.ensureProperty)(topicUseBroadcastChannel, ['@onecx/accelerator', 'topic', 'debug'], []);
|
|
9
|
+
const topicInitDate = (0, ensure_property_utils_1.ensureProperty)(topicDebug, ['@onecx/accelerator', 'topic', 'initDate'], Date.now());
|
|
10
|
+
const topicTabId = (0, ensure_property_utils_1.ensureProperty)(topicInitDate, ['@onecx/accelerator', 'topic', 'tabId'], Math.ceil(globalThis.performance?.now?.() ?? 0));
|
|
11
|
+
exports.acceleratorState = topicTabId;
|
|
12
12
|
//# sourceMappingURL=declarations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../../../libs/accelerator/src/lib/declarations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../../../libs/accelerator/src/lib/declarations.ts"],"names":[],"mappings":";;;AAAA,yEAA8D;AAE9D,MAAM,cAAc,GAAG,IAAA,sCAAc,EAAC,UAAoB,EAAE,CAAC,oBAAoB,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,EAAyC,CAAC,CAAA;AACtJ,MAAM,WAAW,GAAG,IAAA,sCAAc,EAAC,cAAc,EAAE,CAAC,oBAAoB,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,EAAc,CAAC,CAAA;AAC/G,MAAM,wBAAwB,GAAG,IAAA,sCAAc,EAAC,WAAW,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,qBAAqB,CAAC,EAAE,IAAsB,CAAC,CAAA;AAC5I,MAAM,UAAU,GAAG,IAAA,sCAAc,EAAC,wBAAwB,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,EAA0B,CAAC,CAAA;AACjI,MAAM,aAAa,GAAG,IAAA,sCAAc,EAAC,UAAU,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;AACzG,MAAM,UAAU,GAAG,IAAA,sCAAc,EAAC,aAAa,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AAEpH,sCAAgB"}
|
package/src/lib/topic/message.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Message = void 0;
|
|
4
|
-
|
|
4
|
+
const ensure_property_utils_1 = require("../utils/ensure-property.utils");
|
|
5
|
+
const g = (0, ensure_property_utils_1.ensureProperty)(globalThis, ['onecxMessageId'], 1);
|
|
5
6
|
class Message {
|
|
6
7
|
type;
|
|
7
8
|
timestamp;
|
|
8
9
|
id; // id can be undefined while used via old implementation
|
|
9
10
|
constructor(type) {
|
|
10
11
|
this.type = type;
|
|
11
|
-
this.timestamp =
|
|
12
|
-
this.id =
|
|
12
|
+
this.timestamp = globalThis.performance?.now?.() ?? Date.now();
|
|
13
|
+
this.id = g.onecxMessageId++;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.Message = Message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/message.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/message.ts"],"names":[],"mappings":";;;AAAA,0EAA+D;AAE/D,MAAM,CAAC,GAAG,IAAA,sCAAc,EAAC,UAAU,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAA;AAE3D,MAAa,OAAO;IAIC;IAHnB,SAAS,CAAQ;IACjB,EAAE,CAAQ,CAAC,wDAAwD;IAEnE,YAAmB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAC7B,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAA;QAC9D,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,cAAc,EAAE,CAAA;IAC9B,CAAC;CACF;AARD,0BAQC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TopicPublisher = void 0;
|
|
4
4
|
const topic_data_message_1 = require("./topic-data-message");
|
|
5
5
|
const topic_resolve_message_1 = require("./topic-resolve-message");
|
|
6
|
+
const declarations_1 = require("../declarations");
|
|
6
7
|
class TopicPublisher {
|
|
7
8
|
name;
|
|
8
9
|
version;
|
|
@@ -27,29 +28,31 @@ class TopicPublisher {
|
|
|
27
28
|
if (this.publishBroadcastChannel && this.publishBroadcastChannelV2) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel) {
|
|
31
32
|
if (typeof BroadcastChannel === 'undefined') {
|
|
32
33
|
console.log('BroadcastChannel not supported. Disabling BroadcastChannel for topic publisher');
|
|
33
|
-
|
|
34
|
-
window['@onecx/accelerator'].topic ??= {};
|
|
35
|
-
window['@onecx/accelerator'].topic.useBroadcastChannel = false;
|
|
34
|
+
declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel = false;
|
|
36
35
|
}
|
|
37
36
|
else {
|
|
38
37
|
this.publishBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
|
|
39
|
-
this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${
|
|
38
|
+
this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${declarations_1.acceleratorState['@onecx/accelerator'].topic.tabId}`);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
sendMessage(message) {
|
|
44
43
|
this.createBroadcastChannel();
|
|
45
|
-
if (
|
|
44
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel === 'V2') {
|
|
46
45
|
this.publishBroadcastChannelV2?.postMessage(message);
|
|
47
46
|
}
|
|
48
|
-
else if (
|
|
47
|
+
else if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel) {
|
|
49
48
|
this.publishBroadcastChannel?.postMessage(message);
|
|
50
49
|
}
|
|
51
50
|
else {
|
|
52
|
-
|
|
51
|
+
const postMessage = globalThis.postMessage;
|
|
52
|
+
if (typeof postMessage !== 'function') {
|
|
53
|
+
throw new TypeError('postMessage is not available in this environment');
|
|
54
|
+
}
|
|
55
|
+
postMessage(message, '*');
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic-publisher.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/topic-publisher.ts"],"names":[],"mappings":";;;AAAA,6DAAuD;AAGvD,mEAA6D;
|
|
1
|
+
{"version":3,"file":"topic-publisher.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/topic-publisher.ts"],"names":[],"mappings":";;;AAAA,6DAAuD;AAGvD,mEAA6D;AAC7D,kDAAkD;AAElD,MAAa,cAAc;IAMhB;IACA;IANC,sBAAsB,GAA+B,EAAE,CAAA;IACvD,uBAAuB,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BAAyB,GAAG,IAAI,gBAAgB,CACnD,WAAW,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,+BAAgB,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAC7F,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAES,WAAW,CAAC,OAAqB;QACzC,IAAI,CAAC,sBAAsB,EAAE,CAAA;QAC7B,IAAI,+BAAgB,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;YAC9E,IAAI,CAAC,yBAAyB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;QACtD,CAAC;aAAM,IAAI,+BAAgB,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAC5E,IAAI,CAAC,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;QACpD,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAA;YAC1C,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;gBACtC,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAA;YACzE,CAAC;YACD,WAAW,CAAE,OAAO,EAAE,GAAG,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;CACF;AArDD,wCAqDC"}
|
package/src/lib/topic/topic.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable, Observer, OperatorFunction, Subscribable, Subscription, UnaryFunction } from 'rxjs';
|
|
2
2
|
import { TopicDataMessage } from './topic-data-message';
|
|
3
3
|
import { TopicPublisher } from './topic-publisher';
|
|
4
|
-
import '../declarations';
|
|
5
4
|
export declare class Topic<T> extends TopicPublisher<T> implements Subscribable<T> {
|
|
6
5
|
protected isInitializedPromise: Promise<void>;
|
|
7
6
|
protected data: BehaviorSubject<TopicDataMessage<T> | undefined>;
|
package/src/lib/topic/topic.js
CHANGED
|
@@ -5,8 +5,8 @@ const operators_1 = require("rxjs/operators");
|
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const topic_message_1 = require("./topic-message");
|
|
7
7
|
const topic_publisher_1 = require("./topic-publisher");
|
|
8
|
-
require("../declarations");
|
|
9
8
|
const logs_utils_1 = require("../utils/logs.utils");
|
|
9
|
+
const declarations_1 = require("../declarations");
|
|
10
10
|
class Topic extends topic_publisher_1.TopicPublisher {
|
|
11
11
|
isInitializedPromise;
|
|
12
12
|
data = new rxjs_1.BehaviorSubject(undefined);
|
|
@@ -17,19 +17,14 @@ class Topic extends topic_publisher_1.TopicPublisher {
|
|
|
17
17
|
readBroadcastChannelV2;
|
|
18
18
|
constructor(name, version, sendGetMessage = true) {
|
|
19
19
|
super(name, version);
|
|
20
|
-
|
|
21
|
-
window['@onecx/accelerator'].topic ??= {};
|
|
22
|
-
window['@onecx/accelerator'].topic.initDate ??= Date.now();
|
|
23
|
-
if (window['@onecx/accelerator']?.topic?.useBroadcastChannel) {
|
|
20
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel) {
|
|
24
21
|
if (typeof BroadcastChannel === 'undefined') {
|
|
25
22
|
console.log('BroadcastChannel not supported. Disabling BroadcastChannel for topic');
|
|
26
|
-
|
|
27
|
-
window['@onecx/accelerator'].topic ??= {};
|
|
28
|
-
window['@onecx/accelerator'].topic.useBroadcastChannel = false;
|
|
23
|
+
declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel = false;
|
|
29
24
|
}
|
|
30
25
|
else {
|
|
31
26
|
this.readBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
|
|
32
|
-
this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${
|
|
27
|
+
this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${declarations_1.acceleratorState['@onecx/accelerator'].topic.tabId}`);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
30
|
if ((0, logs_utils_1.isStatsEnabled)()) {
|
|
@@ -38,12 +33,15 @@ class Topic extends topic_publisher_1.TopicPublisher {
|
|
|
38
33
|
this.isInitializedPromise = new Promise((resolve) => {
|
|
39
34
|
this.resolveInitPromise = resolve;
|
|
40
35
|
});
|
|
41
|
-
|
|
36
|
+
const addEventListener = globalThis.addEventListener;
|
|
37
|
+
if (typeof addEventListener === 'function') {
|
|
38
|
+
addEventListener.call(globalThis, 'message', this.windowEventListener);
|
|
39
|
+
}
|
|
42
40
|
this.readBroadcastChannel?.addEventListener('message', (m) => this.onBroadcastChannelMessage(m));
|
|
43
41
|
this.readBroadcastChannelV2?.addEventListener('message', (m) => this.onBroadcastChannelMessageV2(m));
|
|
44
42
|
if (sendGetMessage) {
|
|
45
|
-
if (
|
|
46
|
-
Date.now() -
|
|
43
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.initDate &&
|
|
44
|
+
Date.now() - declarations_1.acceleratorState['@onecx/accelerator'].topic.initDate < 2000) {
|
|
47
45
|
// Delay the get message a bit to give other topics time to initialize
|
|
48
46
|
setTimeout(() => {
|
|
49
47
|
if (!this.isInit) {
|
|
@@ -101,7 +99,10 @@ class Topic extends topic_publisher_1.TopicPublisher {
|
|
|
101
99
|
return this.asObservable().toPromise();
|
|
102
100
|
}
|
|
103
101
|
destroy() {
|
|
104
|
-
|
|
102
|
+
const removeEventListener = globalThis.removeEventListener;
|
|
103
|
+
if (typeof removeEventListener === 'function') {
|
|
104
|
+
removeEventListener('message', this.windowEventListener, true);
|
|
105
|
+
}
|
|
105
106
|
this.readBroadcastChannel?.close();
|
|
106
107
|
this.publishBroadcastChannel?.close();
|
|
107
108
|
this.readBroadcastChannelV2?.close();
|
|
@@ -159,23 +160,19 @@ class Topic extends topic_publisher_1.TopicPublisher {
|
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
disableBroadcastChannel() {
|
|
162
|
-
|
|
163
|
-
window['@onecx/accelerator'].topic ??= {};
|
|
164
|
-
if (window['@onecx/accelerator'].topic.useBroadcastChannel === true) {
|
|
163
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel === true) {
|
|
165
164
|
console.log('Disabling BroadcastChannel for topic');
|
|
166
165
|
}
|
|
167
|
-
|
|
166
|
+
declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel = false;
|
|
168
167
|
}
|
|
169
168
|
isLogEnabled() {
|
|
170
|
-
return
|
|
169
|
+
return declarations_1.acceleratorState['@onecx/accelerator'].topic.debug?.includes(this.name);
|
|
171
170
|
}
|
|
172
171
|
disableBroadcastChannelV2() {
|
|
173
|
-
|
|
174
|
-
window['@onecx/accelerator'].topic ??= {};
|
|
175
|
-
if (window['@onecx/accelerator'].topic.useBroadcastChannel === "V2") {
|
|
172
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel === 'V2') {
|
|
176
173
|
console.log('Disabling BroadcastChannel V2 for topic');
|
|
177
174
|
}
|
|
178
|
-
|
|
175
|
+
declarations_1.acceleratorState['@onecx/accelerator'].topic.useBroadcastChannel = true;
|
|
179
176
|
}
|
|
180
177
|
handleTopicResolveMessage(m) {
|
|
181
178
|
const publishPromiseResolver = this.publishPromiseResolver[m.data.resolveId];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/topic.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAC5C,+BAQa;AAEb,mDAA8C;AAE9C,uDAAkD;AAElD,
|
|
1
|
+
{"version":3,"file":"topic.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/topic/topic.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAC5C,+BAQa;AAEb,mDAA8C;AAE9C,uDAAkD;AAElD,oDAA2E;AAC3E,kDAAkD;AAElD,MAAa,KAAS,SAAQ,gCAAiB;IACnC,oBAAoB,CAAe;IACnC,I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__esModule", { value: true });
|
|
3
3
|
exports.Gatherer = void 0;
|
|
4
4
|
const topic_1 = require("../topic/topic");
|
|
5
|
-
require("../declarations");
|
|
5
|
+
const declarations_1 = require("../declarations");
|
|
6
6
|
/**
|
|
7
7
|
* Implementation of the Scatter-Gather pattern.
|
|
8
8
|
*/
|
|
@@ -18,14 +18,14 @@ class Gatherer {
|
|
|
18
18
|
this.topic = new topic_1.Topic(name, version, false);
|
|
19
19
|
// Perform a callback every time a request is received in the topic.
|
|
20
20
|
this.topicSub = this.topic.subscribe((m) => {
|
|
21
|
-
if (!this.isOwnerOfRequest(m) &&
|
|
21
|
+
if (!this.isOwnerOfRequest(m) && declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises) {
|
|
22
22
|
this.logReceivedIfDebug(name, version, m);
|
|
23
|
-
if (!
|
|
23
|
+
if (!declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[m.id]) {
|
|
24
24
|
console.warn('Expected an array of promises to gather for id ', m.id, ' but the id was not present');
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
let resolve;
|
|
28
|
-
|
|
28
|
+
declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[m.id].push(new Promise((r) => {
|
|
29
29
|
resolve = r;
|
|
30
30
|
}));
|
|
31
31
|
callback(m.request).then((response) => {
|
|
@@ -40,27 +40,27 @@ class Gatherer {
|
|
|
40
40
|
this.topicSub?.unsubscribe();
|
|
41
41
|
this.topic.destroy();
|
|
42
42
|
for (const id of this.ownIds) {
|
|
43
|
-
if (
|
|
44
|
-
delete
|
|
43
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises?.[id]) {
|
|
44
|
+
delete declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[id];
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
async gather(request) {
|
|
49
|
-
if (!
|
|
49
|
+
if (!declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises) {
|
|
50
50
|
throw new Error('Gatherer is not initialized');
|
|
51
51
|
}
|
|
52
52
|
const id = Gatherer.id++;
|
|
53
53
|
// Save the id to ownIds to prevent processing own requests.
|
|
54
54
|
this.ownIds.add(id);
|
|
55
|
-
|
|
55
|
+
declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[id] = [];
|
|
56
56
|
// Publish the request to the topic.
|
|
57
57
|
// This will trigger the callback for all instances of gatherer.
|
|
58
58
|
// Await is crucial here to ensure that promises are created before awaiting them.
|
|
59
59
|
// See Why Awaiting the Promise Works in dev-docs/topics/scheduling.adoc.
|
|
60
60
|
const message = { id, request };
|
|
61
61
|
await this.topic.publish(message);
|
|
62
|
-
const promises =
|
|
63
|
-
delete
|
|
62
|
+
const promises = declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[id];
|
|
63
|
+
delete declarations_1.acceleratorState['@onecx/accelerator'].gatherer.promises[id];
|
|
64
64
|
this.ownIds.delete(id);
|
|
65
65
|
return Promise.all(promises).then((v) => {
|
|
66
66
|
this.logIfDebug(this.topicName, 'Finished gathering responses', v);
|
|
@@ -74,7 +74,7 @@ class Gatherer {
|
|
|
74
74
|
this.logIfDebug(name, 'Gatherer ' + name + ': ' + version + ' answered request ' + m.request + ' with response', response);
|
|
75
75
|
}
|
|
76
76
|
logIfDebug(name, ...args) {
|
|
77
|
-
if (
|
|
77
|
+
if (declarations_1.acceleratorState['@onecx/accelerator'].gatherer.debug.includes(name)) {
|
|
78
78
|
console.log(...args);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/gatherer.ts"],"names":[],"mappings":";;;AACA,0CAAsC;AAEtC,
|
|
1
|
+
{"version":3,"file":"gatherer.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/gatherer.ts"],"names":[],"mappings":";;;AACA,0CAAsC;AAEtC,kDAAkD;AAElD;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QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,CAAmC;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;;AA3FH,4BA4FC"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getNormalizedBrowserLocales = getNormalizedBrowserLocales;
|
|
4
4
|
const normalize_locales_utils_1 = require("./normalize-locales.utils");
|
|
5
5
|
function getNormalizedBrowserLocales() {
|
|
6
|
-
|
|
6
|
+
const navigator = globalThis.navigator;
|
|
7
|
+
if (!navigator) {
|
|
7
8
|
return ['en'];
|
|
8
9
|
}
|
|
9
|
-
const langs =
|
|
10
|
+
const langs = navigator.languages || [navigator.language];
|
|
10
11
|
return (0, normalize_locales_utils_1.normalizeLocales)(langs.filter(Boolean));
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=get-normalized-browser-locales.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-normalized-browser-locales.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/get-normalized-browser-locales.utils.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"get-normalized-browser-locales.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/get-normalized-browser-locales.utils.ts"],"names":[],"mappings":";;AAEA,kEAQC;AAVD,uEAA4D;AAE5D,SAAgB,2BAA2B;IACzC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAkC,CAAA;IAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACzD,OAAO,IAAA,0CAAgB,EAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
export interface SharedLibraryConfig {
|
|
2
|
+
singleton?: boolean;
|
|
3
|
+
strictVersion?: boolean;
|
|
4
|
+
eager?: boolean;
|
|
5
|
+
requiredVersion?: string | false;
|
|
6
|
+
version?: string;
|
|
7
|
+
includeSecondaries?: boolean;
|
|
8
|
+
}
|
|
2
9
|
export declare function getOneCXSharedRecommendations(libraryName: string, sharedConfig: SharedLibraryConfig): false | SharedLibraryConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-onecx-shared-recommendations.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/get-onecx-shared-recommendations.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"get-onecx-shared-recommendations.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/get-onecx-shared-recommendations.ts"],"names":[],"mappings":";;AAWA,sEAYC;AAdD,MAAM,qBAAqB,GAAa,CAAC,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAA;AAEvH,SAAgB,6BAA6B,CAC3C,WAAmB,EACnB,YAAiC;IAEjC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAA;IACd,CAAC;IAED,YAAY,CAAC,SAAS,GAAG,KAAK,CAAA;IAC9B,YAAY,CAAC,aAAa,GAAG,KAAK,CAAA;IAClC,YAAY,CAAC,KAAK,GAAG,KAAK,CAAA;IAC1B,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-test.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/is-test.utils.ts"],"names":[],"mappings":";;AAMA,wBAQC;AAdD;;;;;GAKG;AACH,SAAgB,MAAM;IACpB,IAAG,OAAQ,
|
|
1
|
+
{"version":3,"file":"is-test.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/is-test.utils.ts"],"names":[],"mappings":";;AAMA,wBAQC;AAdD;;;;;GAKG;AACH,SAAgB,MAAM;IACpB,IAAG,OAAQ,UAAoC,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,SAAS,EAAE,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -4,15 +4,14 @@ exports.isStatsEnabled = isStatsEnabled;
|
|
|
4
4
|
exports.increaseMessageCount = increaseMessageCount;
|
|
5
5
|
exports.increaseInstanceCount = increaseInstanceCount;
|
|
6
6
|
require("../declarations");
|
|
7
|
+
const ensure_property_utils_1 = require("./ensure-property.utils");
|
|
7
8
|
function isStatsEnabled() {
|
|
8
|
-
return
|
|
9
|
+
return globalThis['@onecx/accelerator']?.topic?.statsEnabled === true;
|
|
9
10
|
}
|
|
10
11
|
function increaseMessageCount(topicName, messageType) {
|
|
11
|
-
|
|
12
|
-
window['@onecx/accelerator'].topic.stats ??= {};
|
|
13
|
-
window['@onecx/accelerator'].topic.stats.messagesPublished ??= {};
|
|
12
|
+
const g = (0, ensure_property_utils_1.ensureProperty)(globalThis, ['@onecx/accelerator', 'topic', 'stats', 'messagesPublished'], {});
|
|
14
13
|
if (isStatsEnabled()) {
|
|
15
|
-
const messageStats =
|
|
14
|
+
const messageStats = g['@onecx/accelerator'].topic.stats.messagesPublished;
|
|
16
15
|
if (!messageStats[topicName]) {
|
|
17
16
|
messageStats[topicName] = {
|
|
18
17
|
TopicNext: 0,
|
|
@@ -24,11 +23,9 @@ function increaseMessageCount(topicName, messageType) {
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
function increaseInstanceCount(topicName) {
|
|
27
|
-
|
|
28
|
-
window['@onecx/accelerator'].topic.stats ??= {};
|
|
29
|
-
window['@onecx/accelerator'].topic.stats.instancesCreated ??= {};
|
|
26
|
+
const g = (0, ensure_property_utils_1.ensureProperty)(globalThis, ['@onecx/accelerator', 'topic', 'stats', 'instancesCreated'], {});
|
|
30
27
|
if (isStatsEnabled()) {
|
|
31
|
-
const instanceStats =
|
|
28
|
+
const instanceStats = g['@onecx/accelerator'].topic.stats.instancesCreated;
|
|
32
29
|
if (!instanceStats[topicName]) {
|
|
33
30
|
instanceStats[topicName] = 0;
|
|
34
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/logs.utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"logs.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/logs.utils.ts"],"names":[],"mappings":";;AAIA,wCAEC;AAED,oDAaC;AAED,sDASC;AAhCD,2BAAwB;AAExB,mEAAwD;AAExD,SAAgB,cAAc;IAC5B,OAAQ,UAAkB,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;AAChF,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAAiB,EAAE,WAA6B;IACnF,MAAM,CAAC,GAAG,IAAA,sCAAc,EAAC,UAAU,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,EAAE,EAAsD,CAAC,CAAA;IAC3J,IAAI,cAAc,EAAE,EAAE,CAAC;QACrB,MAAM,YAAY,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAA;QAC1E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,YAAY,CAAC,SAAS,CAAC,GAAG;gBACxB,SAAS,EAAE,CAAC;gBACZ,QAAQ,EAAE,CAAC;gBACX,YAAY,EAAE,CAAC;aAChB,CAAA;QACH,CAAC;QACD,YAAY,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;IACxC,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,SAAiB;IACrD,MAAM,CAAC,GAAG,IAAA,sCAAc,EAAC,UAAU,EAAE,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAAE,EAA4B,CAAC,CAAA;IAChI,IAAI,cAAc,EAAE,EAAE,CAAC;QACrB,MAAM,aAAa,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAA;QAC1E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC;QACD,aAAa,CAAC,SAAS,CAAC,EAAE,CAAA;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -7,10 +7,15 @@ exports.getLocation = getLocation;
|
|
|
7
7
|
* applicationPath contains the rest of the path which is identifying the workspace and the application to be opened
|
|
8
8
|
*/
|
|
9
9
|
function getLocation() {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const doc = globalThis.document;
|
|
11
|
+
const loc = globalThis.location;
|
|
12
|
+
if (!doc || !loc) {
|
|
13
|
+
throw new Error('getLocation() is only available in browser environments');
|
|
14
|
+
}
|
|
15
|
+
const baseHref = doc.getElementsByTagName('base')[0]?.href ?? loc.origin + '/';
|
|
16
|
+
const location = loc;
|
|
17
|
+
location.deploymentPath = baseHref.substring(loc.origin.length);
|
|
18
|
+
location.applicationPath = loc.href.substring(baseHref.length - 1);
|
|
14
19
|
return location;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=path.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/path.utils.ts"],"names":[],"mappings":";;AAOA,
|
|
1
|
+
{"version":3,"file":"path.utils.js","sourceRoot":"","sources":["../../../../../../libs/accelerator/src/lib/utils/path.utils.ts"],"names":[],"mappings":";;AAOA,kCAaC;AAlBD;;;;GAIG;AACH,SAAgB,WAAW;IACzB,MAAM,GAAG,GAAG,UAAU,CAAC,QAAgC,CAAA;IACvD,MAAM,GAAG,GAAG,UAAU,CAAC,QAAgC,CAAA;IACvD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;IAC5E,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAA;IAC9E,MAAM,QAAQ,GAAG,GAAkB,CAAA;IACnC,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC/D,QAAQ,CAAC,eAAe,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAElE,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|