@croct/sdk 0.10.0 → 0.11.0-alpha
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/activeRecord.js +32 -36
- package/cache/fallbackCache.js +15 -32
- package/cache/inMemoryCache.js +9 -10
- package/cache/index.js +1 -1
- package/cache/localStorageCache.js +24 -25
- package/channel/beaconSocketChannel.d.ts +1 -1
- package/channel/beaconSocketChannel.js +49 -79
- package/channel/channel.d.ts +1 -1
- package/channel/encodedChannel.js +8 -10
- package/channel/guaranteedChannel.d.ts +4 -4
- package/channel/guaranteedChannel.js +41 -43
- package/channel/index.js +1 -1
- package/channel/queuedChannel.js +35 -64
- package/channel/retryChannel.d.ts +1 -1
- package/channel/retryChannel.js +44 -77
- package/channel/sandboxChannel.js +17 -18
- package/channel/socketChannel.d.ts +4 -4
- package/channel/socketChannel.js +77 -79
- package/cid/cachedAssigner.js +15 -27
- package/cid/fixedAssigner.js +5 -6
- package/cid/index.js +1 -1
- package/cid/remoteAssigner.js +23 -36
- package/constants.d.ts +3 -2
- package/constants.js +6 -5
- package/container.d.ts +13 -6
- package/container.js +152 -168
- package/contentFetcher.d.ts +59 -0
- package/contentFetcher.js +129 -0
- package/context.d.ts +3 -3
- package/context.js +36 -38
- package/error.js +2 -2
- package/evaluator.d.ts +33 -24
- package/evaluator.js +126 -117
- package/eventManager.d.ts +1 -1
- package/eventManager.js +14 -15
- package/facade/contentFetcherFacade.d.ts +27 -0
- package/facade/contentFetcherFacade.js +40 -0
- package/facade/evaluatorFacade.d.ts +13 -3
- package/facade/evaluatorFacade.js +57 -72
- package/facade/sdkFacade.d.ts +10 -3
- package/facade/sdkFacade.js +129 -141
- package/facade/sessionFacade.js +6 -7
- package/facade/sessionPatch.js +9 -13
- package/facade/trackerFacade.js +32 -38
- package/facade/userFacade.js +10 -11
- package/facade/userPatch.js +9 -13
- package/index.js +2 -2
- package/logging/consoleLogger.js +18 -35
- package/logging/index.js +1 -1
- package/logging/namespacedLogger.js +14 -15
- package/logging/nullLogger.js +10 -13
- package/namespacedStorage.js +30 -47
- package/package.json +13 -16
- package/patch.d.ts +1 -1
- package/queue/capacityRestrictedQueue.js +17 -18
- package/queue/inMemoryQueue.js +22 -28
- package/queue/index.js +1 -1
- package/queue/monitoredQueue.d.ts +2 -2
- package/queue/monitoredQueue.js +39 -40
- package/queue/persistentQueue.js +33 -38
- package/retry/arbitraryPolicy.js +8 -10
- package/retry/backoffPolicy.d.ts +1 -1
- package/retry/backoffPolicy.js +11 -13
- package/retry/index.js +1 -1
- package/retry/maxAttemptsPolicy.js +7 -8
- package/retry/neverPolicy.js +6 -9
- package/schema/attributeSchema.js +1 -1
- package/schema/contentFetcherSchemas.d.ts +2 -0
- package/schema/contentFetcherSchemas.js +22 -0
- package/schema/contentSchemas.js +1 -1
- package/schema/contextSchemas.js +1 -1
- package/schema/ecommerceSchemas.js +1 -1
- package/schema/evaluatorSchemas.d.ts +2 -0
- package/schema/{evaluationSchemas.js → evaluatorSchemas.js} +3 -3
- package/schema/eventSchemas.js +5 -7
- package/schema/index.d.ts +2 -1
- package/schema/index.js +3 -2
- package/schema/loggerSchema.js +1 -1
- package/schema/operationSchemas.js +8 -8
- package/schema/sdkFacadeSchemas.js +9 -6
- package/schema/sdkSchemas.js +8 -5
- package/schema/tokenSchema.js +5 -4
- package/schema/userSchema.js +2 -2
- package/sdk.d.ts +9 -3
- package/sdk.js +81 -127
- package/sdkEvents.d.ts +3 -3
- package/sourceLocation.d.ts +3 -3
- package/sourceLocation.js +13 -14
- package/tab.d.ts +5 -5
- package/tab.js +50 -80
- package/token/cachedTokenStore.js +9 -10
- package/token/inMemoryTokenStore.js +7 -8
- package/token/index.js +1 -1
- package/token/replicatedTokenStore.js +7 -8
- package/token/token.d.ts +9 -5
- package/token/token.js +63 -57
- package/tracker.d.ts +4 -4
- package/tracker.js +145 -122
- package/trackingEvents.d.ts +36 -36
- package/trackingEvents.js +12 -6
- package/transformer.js +1 -1
- package/utilityTypes.d.ts +2 -2
- package/uuid.js +9 -7
- package/validation/arrayType.d.ts +2 -2
- package/validation/arrayType.js +29 -27
- package/validation/booleanType.js +11 -15
- package/validation/functionType.js +11 -15
- package/validation/index.js +1 -1
- package/validation/jsonType.d.ts +2 -2
- package/validation/jsonType.js +61 -80
- package/validation/mixedSchema.js +4 -7
- package/validation/nullType.js +11 -15
- package/validation/numberType.d.ts +1 -1
- package/validation/numberType.js +23 -22
- package/validation/objectType.d.ts +1 -1
- package/validation/objectType.js +61 -72
- package/validation/schema.js +6 -10
- package/validation/stringType.d.ts +1 -1
- package/validation/stringType.js +36 -47
- package/validation/unionType.js +27 -77
- package/validation/violation.js +1 -2
- package/schema/evaluationSchemas.d.ts +0 -2
package/channel/socketChannel.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SocketChannel = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _b, _c, _d;
|
|
10
|
-
var url = _a.url, logger = _a.logger, options = tslib_1.__rest(_a, ["url", "logger"]);
|
|
4
|
+
const logging_1 = require("../logging");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
class SocketChannel {
|
|
7
|
+
constructor({ url, logger, ...options }) {
|
|
8
|
+
var _a, _b, _c;
|
|
11
9
|
this.listeners = [];
|
|
12
10
|
this.closed = false;
|
|
13
11
|
this.url = url;
|
|
14
12
|
this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
|
|
15
|
-
this.options =
|
|
13
|
+
this.options = {
|
|
14
|
+
...options,
|
|
15
|
+
closeTimeout: (_a = options.closeTimeout) !== null && _a !== void 0 ? _a : 5000,
|
|
16
|
+
connectionTimeout: (_b = options.connectionTimeout) !== null && _b !== void 0 ? _b : 10000,
|
|
17
|
+
protocols: (_c = options.protocols) !== null && _c !== void 0 ? _c : [],
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
configurable: true
|
|
26
|
-
});
|
|
27
|
-
SocketChannel.prototype.publish = function (message) {
|
|
28
|
-
var _this = this;
|
|
29
|
-
return this.connect().then(function (socket) {
|
|
20
|
+
get connected() {
|
|
21
|
+
if (this.connection === undefined) {
|
|
22
|
+
return Promise.resolve(false);
|
|
23
|
+
}
|
|
24
|
+
return this.connection.then(() => true, () => false);
|
|
25
|
+
}
|
|
26
|
+
publish(message) {
|
|
27
|
+
return this.connect().then(socket => {
|
|
30
28
|
socket.send(message);
|
|
31
|
-
|
|
29
|
+
this.logger.debug('Message sent.');
|
|
32
30
|
});
|
|
33
|
-
}
|
|
34
|
-
|
|
31
|
+
}
|
|
32
|
+
subscribe(listener) {
|
|
35
33
|
if (!this.listeners.includes(listener)) {
|
|
36
34
|
this.listeners.push(listener);
|
|
37
35
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
}
|
|
37
|
+
unsubscribe(listener) {
|
|
38
|
+
const index = this.listeners.indexOf(listener);
|
|
41
39
|
if (index >= 0) {
|
|
42
40
|
this.listeners.splice(index, 1);
|
|
43
41
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this.listeners.forEach(
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var _this = this;
|
|
42
|
+
}
|
|
43
|
+
notify(message) {
|
|
44
|
+
this.listeners.forEach(dispatch => dispatch(message));
|
|
45
|
+
}
|
|
46
|
+
connect() {
|
|
50
47
|
if (this.closed) {
|
|
51
48
|
return Promise.reject(new Error('Channel has been closed.'));
|
|
52
49
|
}
|
|
53
50
|
if (this.connection !== undefined) {
|
|
54
|
-
return this.connection
|
|
55
|
-
|
|
51
|
+
return this.connection
|
|
52
|
+
.then(connection => {
|
|
53
|
+
const state = connection.readyState;
|
|
56
54
|
if (state === WebSocket.OPEN) {
|
|
57
55
|
return connection;
|
|
58
56
|
}
|
|
59
57
|
throw new Error('Connection lost.');
|
|
60
|
-
})
|
|
58
|
+
})
|
|
59
|
+
.catch(() => {
|
|
61
60
|
// Reconnect
|
|
62
|
-
delete
|
|
63
|
-
return
|
|
61
|
+
delete this.connection;
|
|
62
|
+
return this.connect();
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
this.connection = new Promise(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
connection.binaryType =
|
|
65
|
+
this.connection = new Promise((resolve, reject) => {
|
|
66
|
+
this.logger.debug('Connecting...');
|
|
67
|
+
const connection = new window.WebSocket(this.url, this.options.protocols);
|
|
68
|
+
if (this.options.binaryType !== undefined) {
|
|
69
|
+
connection.binaryType = this.options.binaryType;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const abortListener = () => {
|
|
72
|
+
const reason = 'Maximum connection timeout reached.';
|
|
73
|
+
this.logger.error(reason);
|
|
75
74
|
reject(new Error(reason));
|
|
76
75
|
connection.close(1000, reason);
|
|
77
76
|
};
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
const abortTimer = window.setTimeout(abortListener, this.options.connectionTimeout);
|
|
78
|
+
const openListener = () => {
|
|
80
79
|
window.clearTimeout(abortTimer);
|
|
81
|
-
|
|
80
|
+
this.logger.info('Connection established.');
|
|
82
81
|
connection.removeEventListener('open', openListener);
|
|
83
82
|
resolve(connection);
|
|
84
83
|
};
|
|
85
|
-
|
|
86
|
-
if (!
|
|
87
|
-
|
|
84
|
+
const errorListener = () => {
|
|
85
|
+
if (!this.closed) {
|
|
86
|
+
this.logger.error('Connection error.');
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const messageListener = (event) => {
|
|
90
|
+
this.logger.debug('Message received.');
|
|
91
|
+
this.notify(event.data);
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
const closeListener = (event) => {
|
|
94
|
+
var _a;
|
|
95
95
|
window.clearTimeout(abortTimer);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (!
|
|
99
|
-
|
|
96
|
+
const reason = `${(0, error_1.formatCause)((_a = event.reason) !== null && _a !== void 0 ? _a : 'unknown')} (code ${event.code})`;
|
|
97
|
+
const message = `Connection has been closed, reason: ${reason}`;
|
|
98
|
+
if (!this.closed) {
|
|
99
|
+
this.logger.info(message);
|
|
100
100
|
}
|
|
101
101
|
connection.removeEventListener('open', openListener);
|
|
102
102
|
connection.removeEventListener('error', errorListener);
|
|
@@ -110,37 +110,35 @@ var SocketChannel = /** @class */ (function () {
|
|
|
110
110
|
connection.addEventListener('message', messageListener);
|
|
111
111
|
});
|
|
112
112
|
return this.connection;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var _this = this;
|
|
113
|
+
}
|
|
114
|
+
close() {
|
|
116
115
|
this.logger.debug('Closing connection...');
|
|
117
|
-
return new Promise(
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
this.closed = true;
|
|
118
|
+
if (this.connection === undefined) {
|
|
119
|
+
this.logger.debug('Connection is not open.');
|
|
121
120
|
resolve();
|
|
122
121
|
return;
|
|
123
122
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
this.connection.then((connection) => {
|
|
124
|
+
let abortTimer;
|
|
125
|
+
const abort = () => {
|
|
126
|
+
this.logger.warn('Connection could not be closed within the timeout period.');
|
|
128
127
|
reject(new Error('Maximum close timeout reached.'));
|
|
129
128
|
};
|
|
130
|
-
|
|
129
|
+
const close = () => {
|
|
131
130
|
window.clearTimeout(abortTimer);
|
|
132
|
-
|
|
131
|
+
this.logger.info('Connection gracefully closed.');
|
|
133
132
|
resolve();
|
|
134
133
|
};
|
|
135
134
|
connection.addEventListener('close', close, { once: true });
|
|
136
135
|
connection.close(1000, 'Deliberate disconnection.');
|
|
137
|
-
abortTimer = window.setTimeout(abort,
|
|
138
|
-
},
|
|
139
|
-
|
|
136
|
+
abortTimer = window.setTimeout(abort, this.options.closeTimeout);
|
|
137
|
+
}, () => {
|
|
138
|
+
this.logger.info('Connection closed.');
|
|
140
139
|
resolve();
|
|
141
140
|
});
|
|
142
141
|
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
146
144
|
exports.SocketChannel = SocketChannel;
|
package/cid/cachedAssigner.js
CHANGED
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CachedAssigner = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function CachedAssigner(assigner, cache, logger) {
|
|
4
|
+
const logging_1 = require("../logging");
|
|
5
|
+
class CachedAssigner {
|
|
6
|
+
constructor(assigner, cache, logger) {
|
|
8
7
|
this.assigner = assigner;
|
|
9
8
|
this.cache = cache;
|
|
10
9
|
this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
case 1:
|
|
25
|
-
newCid = _a.sent();
|
|
26
|
-
this.cache.put(newCid);
|
|
27
|
-
this.logger.debug('New CID stored into cache');
|
|
28
|
-
return [2 /*return*/, newCid];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
return CachedAssigner;
|
|
34
|
-
}());
|
|
11
|
+
async assignCid() {
|
|
12
|
+
const cid = this.cache.get();
|
|
13
|
+
if (cid !== null) {
|
|
14
|
+
this.logger.debug('Previous CID loaded from cache');
|
|
15
|
+
return cid;
|
|
16
|
+
}
|
|
17
|
+
const newCid = await this.assigner.assignCid();
|
|
18
|
+
this.cache.put(newCid);
|
|
19
|
+
this.logger.debug('New CID stored into cache');
|
|
20
|
+
return newCid;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
35
23
|
exports.CachedAssigner = CachedAssigner;
|
package/cid/fixedAssigner.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FixedAssigner = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class FixedAssigner {
|
|
5
|
+
constructor(cid) {
|
|
6
6
|
this.cid = cid;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
assignCid() {
|
|
9
9
|
return Promise.resolve(this.cid);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
}());
|
|
10
|
+
}
|
|
11
|
+
}
|
|
13
12
|
exports.FixedAssigner = FixedAssigner;
|
package/cid/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoteAssigner = exports.FixedAssigner = exports.CachedAssigner = void 0;
|
|
4
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./assigner"), exports);
|
|
6
6
|
var cachedAssigner_1 = require("./cachedAssigner");
|
|
7
7
|
Object.defineProperty(exports, "CachedAssigner", { enumerable: true, get: function () { return cachedAssigner_1.CachedAssigner; } });
|
package/cid/remoteAssigner.js
CHANGED
|
@@ -1,47 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoteAssigner = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function RemoteAssigner(endpoint, logger) {
|
|
4
|
+
const logging_1 = require("../logging");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
class RemoteAssigner {
|
|
7
|
+
constructor(endpoint, logger) {
|
|
9
8
|
this.endpoint = endpoint;
|
|
10
9
|
this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
var _this = this;
|
|
11
|
+
assignCid() {
|
|
14
12
|
if (this.pending === undefined) {
|
|
15
|
-
this.pending = this.fetchCid().finally(
|
|
16
|
-
|
|
13
|
+
this.pending = this.fetchCid().finally(() => {
|
|
14
|
+
this.pending = undefined;
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
return this.pending;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.logger.error(error.message);
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
this.logger.debug('New CID successfully assigned');
|
|
40
|
-
return [2 /*return*/, response.text()];
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return RemoteAssigner;
|
|
46
|
-
}());
|
|
18
|
+
}
|
|
19
|
+
async fetchCid() {
|
|
20
|
+
const options = {
|
|
21
|
+
method: 'GET',
|
|
22
|
+
credentials: 'include',
|
|
23
|
+
};
|
|
24
|
+
const response = await window.fetch(this.endpoint, options);
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const error = new Error(`Failed to assign CID: ${(0, error_1.formatCause)(response.statusText)}`);
|
|
27
|
+
this.logger.error(error.message);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
this.logger.debug('New CID successfully assigned');
|
|
31
|
+
return response.text();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
47
34
|
exports.RemoteAssigner = RemoteAssigner;
|
package/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export declare const CID_ASSIGNER_ENDPOINT_URL = "<@cidAssignerEndpointUrl@>";
|
|
1
2
|
export declare const TRACKER_ENDPOINT_URL = "<@trackerEndpointUrl@>";
|
|
2
3
|
export declare const EVALUATION_ENDPOINT_URL = "<@evaluationEndpointUrl@>";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const CONTENT_ENDPOINT_URL = "<@contentEndpointUrl@>";
|
|
5
|
+
export declare const MAX_QUERY_LENGTH: number;
|
|
5
6
|
export declare const VERSION = "<@version@>";
|
package/constants.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERSION = exports.
|
|
3
|
+
exports.VERSION = exports.MAX_QUERY_LENGTH = exports.CONTENT_ENDPOINT_URL = exports.EVALUATION_ENDPOINT_URL = exports.TRACKER_ENDPOINT_URL = exports.CID_ASSIGNER_ENDPOINT_URL = void 0;
|
|
4
|
+
exports.CID_ASSIGNER_ENDPOINT_URL = 'https://api.croct.io/client/web/bootstrap';
|
|
4
5
|
exports.TRACKER_ENDPOINT_URL = 'wss://api.croct.io/client/web/connect';
|
|
5
|
-
exports.EVALUATION_ENDPOINT_URL = 'https://api.croct.io
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.VERSION = '0.
|
|
6
|
+
exports.EVALUATION_ENDPOINT_URL = 'https://api.croct.io';
|
|
7
|
+
exports.CONTENT_ENDPOINT_URL = 'https://api.croct.io';
|
|
8
|
+
exports.MAX_QUERY_LENGTH = 500;
|
|
9
|
+
exports.VERSION = '0.11.0-alpha';
|
package/container.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { Logger } from './logging';
|
|
2
2
|
import { Context, TokenScope } from './context';
|
|
3
3
|
import { MonitoredQueue } from './queue';
|
|
4
|
-
import {
|
|
4
|
+
import { TokenStore } from './token';
|
|
5
5
|
import { Tracker } from './tracker';
|
|
6
6
|
import { Evaluator } from './evaluator';
|
|
7
7
|
import { CidAssigner } from './cid';
|
|
8
8
|
import { EventManager } from './eventManager';
|
|
9
9
|
import { SdkEventMap } from './sdkEvents';
|
|
10
10
|
import { UrlSanitizer } from './tab';
|
|
11
|
-
|
|
11
|
+
import { ContentFetcher } from './contentFetcher';
|
|
12
|
+
export type Configuration = {
|
|
12
13
|
appId: string;
|
|
13
14
|
tokenScope: TokenScope;
|
|
14
|
-
|
|
15
|
+
clientId?: string;
|
|
15
16
|
debug: boolean;
|
|
16
17
|
test: boolean;
|
|
17
18
|
trackerEndpointUrl: string;
|
|
18
19
|
evaluationEndpointUrl: string;
|
|
19
|
-
|
|
20
|
+
contentEndpointUrl: string;
|
|
21
|
+
cidAssignerEndpointUrl: string;
|
|
20
22
|
beaconQueueSize: number;
|
|
21
23
|
logger?: Logger;
|
|
22
24
|
urlSanitizer?: UrlSanitizer;
|
|
@@ -27,9 +29,11 @@ export declare type Configuration = {
|
|
|
27
29
|
export declare class Container {
|
|
28
30
|
private readonly configuration;
|
|
29
31
|
private context?;
|
|
30
|
-
private
|
|
32
|
+
private userTokenProvider?;
|
|
33
|
+
private previewTokenStore?;
|
|
31
34
|
private tracker?;
|
|
32
35
|
private evaluator?;
|
|
36
|
+
private contentFetcher?;
|
|
33
37
|
private cidAssigner?;
|
|
34
38
|
private beaconChannel?;
|
|
35
39
|
private beaconQueue?;
|
|
@@ -39,9 +43,12 @@ export declare class Container {
|
|
|
39
43
|
getConfiguration(): Configuration;
|
|
40
44
|
getEvaluator(): Evaluator;
|
|
41
45
|
private createEvaluator;
|
|
46
|
+
getContentFetcher(): ContentFetcher;
|
|
47
|
+
private createContentFetcher;
|
|
48
|
+
getPreviewTokenStore(): TokenStore;
|
|
42
49
|
getTracker(): Tracker;
|
|
43
50
|
private createTracker;
|
|
44
|
-
|
|
51
|
+
getUserTokenStore(): TokenStore;
|
|
45
52
|
getContext(): Context;
|
|
46
53
|
private createContext;
|
|
47
54
|
private getBeaconChannel;
|