@croct/sdk 0.9.1 → 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 +8 -9
- 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 -73
- 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/queue/monitoredQueue.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MonitoredQueue = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const logging_1 = require("../logging");
|
|
5
|
+
class MonitoredQueue {
|
|
6
|
+
constructor(queue, logger) {
|
|
7
7
|
this.callbacks = {};
|
|
8
8
|
this.queue = queue;
|
|
9
9
|
this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
|
|
10
10
|
this.updateStatus();
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
all() {
|
|
13
13
|
return this.queue.all();
|
|
14
|
-
}
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
getCapacity() {
|
|
16
16
|
return this.queue.getCapacity();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
var
|
|
17
|
+
}
|
|
18
|
+
addCallback(status, callback) {
|
|
19
|
+
var _a;
|
|
20
|
+
const callbacks = (_a = this.callbacks[status]) !== null && _a !== void 0 ? _a : [];
|
|
20
21
|
if (!callbacks.includes(callback)) {
|
|
21
22
|
callbacks.push(callback);
|
|
22
23
|
}
|
|
@@ -38,30 +39,29 @@ var MonitoredQueue = /** @class */ (function () {
|
|
|
38
39
|
}
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
42
|
+
}
|
|
43
|
+
removeCallback(type, callback) {
|
|
44
|
+
const callbacks = this.callbacks[type];
|
|
45
|
+
if (callbacks == null) {
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
const index = callbacks.indexOf(callback);
|
|
48
49
|
if (index >= 0) {
|
|
49
50
|
callbacks.splice(index, 1);
|
|
50
51
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
52
|
+
}
|
|
53
|
+
setStatus(status) {
|
|
53
54
|
if (this.status === status) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
this.logger.debug(
|
|
57
|
+
this.logger.debug(`Queue status changed to "${status}"`);
|
|
57
58
|
this.report(status);
|
|
58
59
|
this.status = status;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var callbacks = this.callbacks[status];
|
|
60
|
+
}
|
|
61
|
+
report(status) {
|
|
62
|
+
const callbacks = this.callbacks[status];
|
|
63
63
|
if (callbacks !== undefined) {
|
|
64
|
-
callbacks.forEach(
|
|
64
|
+
callbacks.forEach(callback => callback(this));
|
|
65
65
|
}
|
|
66
66
|
switch (status) {
|
|
67
67
|
case 'empty':
|
|
@@ -75,28 +75,28 @@ var MonitoredQueue = /** @class */ (function () {
|
|
|
75
75
|
default:
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
78
|
+
}
|
|
79
|
+
isEmpty() {
|
|
80
80
|
return this.queue.isEmpty();
|
|
81
|
-
}
|
|
82
|
-
|
|
81
|
+
}
|
|
82
|
+
length() {
|
|
83
83
|
return this.queue.length();
|
|
84
|
-
}
|
|
85
|
-
|
|
84
|
+
}
|
|
85
|
+
peek() {
|
|
86
86
|
return this.queue.peek();
|
|
87
|
-
}
|
|
88
|
-
|
|
87
|
+
}
|
|
88
|
+
push(value) {
|
|
89
89
|
this.queue.push(value);
|
|
90
90
|
this.updateStatus();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
}
|
|
92
|
+
shift() {
|
|
93
|
+
const value = this.queue.shift();
|
|
94
94
|
this.updateStatus();
|
|
95
95
|
return value;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
}
|
|
97
|
+
updateStatus() {
|
|
98
|
+
const length = this.queue.length();
|
|
99
|
+
const capacity = this.getCapacity();
|
|
100
100
|
if (length <= capacity * 0.5) {
|
|
101
101
|
if (length === 0) {
|
|
102
102
|
this.setStatus('empty');
|
|
@@ -118,7 +118,6 @@ var MonitoredQueue = /** @class */ (function () {
|
|
|
118
118
|
else {
|
|
119
119
|
this.setStatus('halfFull');
|
|
120
120
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
}());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
124
123
|
exports.MonitoredQueue = MonitoredQueue;
|
package/queue/persistentQueue.js
CHANGED
|
@@ -1,58 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PersistentQueue = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (key === void 0) { key = 'queue'; }
|
|
4
|
+
class PersistentQueue {
|
|
5
|
+
constructor(storage, key = 'queue') {
|
|
7
6
|
this.storage = storage;
|
|
8
7
|
this.key = key;
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
all() {
|
|
11
10
|
return this.queue.slice();
|
|
12
|
-
}
|
|
13
|
-
|
|
11
|
+
}
|
|
12
|
+
getCapacity() {
|
|
14
13
|
return Infinity;
|
|
15
|
-
}
|
|
16
|
-
|
|
14
|
+
}
|
|
15
|
+
isEmpty() {
|
|
17
16
|
return this.length() === 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
17
|
+
}
|
|
18
|
+
length() {
|
|
20
19
|
return this.queue.length;
|
|
21
|
-
}
|
|
22
|
-
|
|
20
|
+
}
|
|
21
|
+
push(value) {
|
|
23
22
|
this.queue.push(value);
|
|
24
23
|
this.flush();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
}
|
|
25
|
+
peek() {
|
|
26
|
+
const item = this.queue[0];
|
|
28
27
|
if (item === undefined) {
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
30
|
return item;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
31
|
+
}
|
|
32
|
+
shift() {
|
|
33
|
+
const value = this.queue.shift();
|
|
34
|
+
if (value === undefined) {
|
|
36
35
|
throw new Error('The queue is empty.');
|
|
37
36
|
}
|
|
38
37
|
this.flush();
|
|
39
38
|
return value;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.storage.
|
|
53
|
-
};
|
|
54
|
-
PersistentQueue.prototype.load = function () {
|
|
55
|
-
var data = this.storage.getItem(this.key);
|
|
39
|
+
}
|
|
40
|
+
get queue() {
|
|
41
|
+
if (this.cache === undefined) {
|
|
42
|
+
this.cache = this.load();
|
|
43
|
+
}
|
|
44
|
+
return this.cache;
|
|
45
|
+
}
|
|
46
|
+
flush() {
|
|
47
|
+
var _a;
|
|
48
|
+
this.storage.setItem(this.key, JSON.stringify((_a = this.cache) !== null && _a !== void 0 ? _a : []));
|
|
49
|
+
}
|
|
50
|
+
load() {
|
|
51
|
+
const data = this.storage.getItem(this.key);
|
|
56
52
|
if (data === null) {
|
|
57
53
|
return [];
|
|
58
54
|
}
|
|
@@ -62,7 +58,6 @@ var PersistentQueue = /** @class */ (function () {
|
|
|
62
58
|
catch (error) {
|
|
63
59
|
return [];
|
|
64
60
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
68
63
|
exports.PersistentQueue = PersistentQueue;
|
package/retry/arbitraryPolicy.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArbitraryPolicy = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function ArbitraryPolicy(delays) {
|
|
4
|
+
class ArbitraryPolicy {
|
|
5
|
+
constructor(delays) {
|
|
7
6
|
if (delays.length < 1) {
|
|
8
7
|
throw new Error('The list of delays cannot be empty.');
|
|
9
8
|
}
|
|
10
|
-
this.delays =
|
|
9
|
+
this.delays = [...delays];
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
getDelay(attempt) {
|
|
13
12
|
return this.delays[Math.min(attempt < 0 ? 0 : attempt, this.delays.length - 1)];
|
|
14
|
-
}
|
|
15
|
-
|
|
13
|
+
}
|
|
14
|
+
shouldRetry() {
|
|
16
15
|
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
20
18
|
exports.ArbitraryPolicy = ArbitraryPolicy;
|
package/retry/backoffPolicy.d.ts
CHANGED
package/retry/backoffPolicy.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BackoffPolicy = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (options === void 0) { options = {}; }
|
|
4
|
+
class BackoffPolicy {
|
|
5
|
+
constructor(options = {}) {
|
|
7
6
|
this.minRetryDelay = 1000;
|
|
8
7
|
this.maxRetryDelay = 30000;
|
|
9
8
|
this.backoffFactor = 2;
|
|
10
9
|
this.backoffJitter = 1;
|
|
11
10
|
this.maxAttempts = Infinity;
|
|
12
|
-
|
|
11
|
+
const { minRetryDelay = this.minRetryDelay, maxRetryDelay = this.maxRetryDelay, backoffFactor = this.backoffFactor, backoffJitter = this.backoffJitter, maxAttempts = this.maxAttempts, } = options;
|
|
13
12
|
if (minRetryDelay < 0) {
|
|
14
13
|
throw new Error('The minimum retry delay must be non-negative.');
|
|
15
14
|
}
|
|
@@ -36,22 +35,21 @@ var BackoffPolicy = /** @class */ (function () {
|
|
|
36
35
|
*
|
|
37
36
|
* @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
getDelay(attempt) {
|
|
39
|
+
let delay = Math.min(Math.max(this.backoffFactor ** attempt, this.minRetryDelay), this.maxRetryDelay);
|
|
41
40
|
if (this.backoffJitter > 0) {
|
|
42
41
|
// Jitter will result in a random value between the minimum and
|
|
43
42
|
// calculated delay for a given attempt.
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const min = Math.ceil(this.minRetryDelay);
|
|
44
|
+
const max = Math.floor(delay);
|
|
46
45
|
delay = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
47
46
|
}
|
|
48
47
|
// Removing any fractional digits
|
|
49
48
|
delay -= delay % 1;
|
|
50
49
|
return delay;
|
|
51
|
-
}
|
|
52
|
-
|
|
50
|
+
}
|
|
51
|
+
shouldRetry(attempt) {
|
|
53
52
|
return attempt < this.maxAttempts;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
57
55
|
exports.BackoffPolicy = BackoffPolicy;
|
package/retry/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NeverPolicy = exports.MaxAttemptsPolicy = exports.BackoffPolicy = exports.ArbitraryPolicy = void 0;
|
|
4
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./policy"), exports);
|
|
6
6
|
var arbitraryPolicy_1 = require("./arbitraryPolicy");
|
|
7
7
|
Object.defineProperty(exports, "ArbitraryPolicy", { enumerable: true, get: function () { return arbitraryPolicy_1.ArbitraryPolicy; } });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MaxAttemptsPolicy = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class MaxAttemptsPolicy {
|
|
5
|
+
constructor(delay, maxAttempts) {
|
|
6
6
|
if (delay < 0) {
|
|
7
7
|
throw new Error('Delay must be non-negative.');
|
|
8
8
|
}
|
|
@@ -12,12 +12,11 @@ var MaxAttemptsPolicy = /** @class */ (function () {
|
|
|
12
12
|
this.maxAttempts = maxAttempts;
|
|
13
13
|
this.delay = delay;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
getDelay() {
|
|
16
16
|
return this.delay;
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
shouldRetry(attempt) {
|
|
19
19
|
return attempt < this.maxAttempts;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
23
22
|
exports.MaxAttemptsPolicy = MaxAttemptsPolicy;
|
package/retry/neverPolicy.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NeverPolicy = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
NeverPolicy.prototype.getDelay = function () {
|
|
4
|
+
class NeverPolicy {
|
|
5
|
+
getDelay() {
|
|
8
6
|
return Infinity;
|
|
9
|
-
}
|
|
10
|
-
|
|
7
|
+
}
|
|
8
|
+
shouldRetry() {
|
|
11
9
|
return false;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}());
|
|
10
|
+
}
|
|
11
|
+
}
|
|
15
12
|
exports.NeverPolicy = NeverPolicy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.attributeNameSchema = void 0;
|
|
4
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
5
|
exports.attributeNameSchema = new validation_1.StringType({
|
|
6
6
|
maxLength: 50,
|
|
7
7
|
format: 'identifier',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchOptionsSchema = void 0;
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
exports.fetchOptionsSchema = new validation_1.ObjectType({
|
|
6
|
+
properties: {
|
|
7
|
+
timeout: new validation_1.NumberType({
|
|
8
|
+
integer: true,
|
|
9
|
+
minimum: 0,
|
|
10
|
+
}),
|
|
11
|
+
version: new validation_1.UnionType(new validation_1.StringType({
|
|
12
|
+
pattern: /^\d+$/,
|
|
13
|
+
}), new validation_1.NumberType({
|
|
14
|
+
integer: true,
|
|
15
|
+
minimum: 1,
|
|
16
|
+
})),
|
|
17
|
+
preferredLocale: new validation_1.StringType({
|
|
18
|
+
pattern: /^[a-z]{2,3}([-_][a-z]{2,3})?$/i,
|
|
19
|
+
}),
|
|
20
|
+
attributes: new validation_1.JsonObjectType(),
|
|
21
|
+
},
|
|
22
|
+
});
|
package/schema/contentSchemas.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.postDetails = void 0;
|
|
4
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
5
|
exports.postDetails = new validation_1.ObjectType({
|
|
6
6
|
required: ['postId', 'title', 'publishTime'],
|
|
7
7
|
properties: {
|
package/schema/contextSchemas.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tokenScopeSchema = void 0;
|
|
4
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
5
|
exports.tokenScopeSchema = new validation_1.StringType({
|
|
6
6
|
enumeration: ['global', 'contextual', 'isolated'],
|
|
7
7
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.order = exports.orderItem = exports.cart = exports.cartItem = exports.productDetails = void 0;
|
|
4
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
5
|
exports.productDetails = new validation_1.ObjectType({
|
|
6
6
|
required: ['productId', 'name', 'displayPrice'],
|
|
7
7
|
properties: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
exports.
|
|
3
|
+
exports.evaluationOptionsSchema = void 0;
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
exports.evaluationOptionsSchema = new validation_1.ObjectType({
|
|
6
6
|
properties: {
|
|
7
7
|
timeout: new validation_1.NumberType({
|
|
8
8
|
integer: true,
|
package/schema/eventSchemas.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.eventOccurred = exports.linkOpened = exports.postViewed = exports.interestShown = exports.goalCompleted = exports.userSignedUp = exports.productViewed = exports.orderPlaced = exports.checkoutStarted = exports.cartViewed = exports.cartModified = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
const ecommerceSchemas_1 = require("./ecommerceSchemas");
|
|
6
|
+
const userSchema_1 = require("./userSchema");
|
|
7
|
+
const contentSchemas_1 = require("./contentSchemas");
|
|
8
8
|
exports.cartModified = new validation_1.ObjectType({
|
|
9
9
|
required: ['cart'],
|
|
10
10
|
properties: {
|
|
@@ -53,8 +53,9 @@ exports.goalCompleted = new validation_1.ObjectType({
|
|
|
53
53
|
required: ['goalId'],
|
|
54
54
|
properties: {
|
|
55
55
|
goalId: new validation_1.StringType({
|
|
56
|
-
minLength:
|
|
57
|
-
maxLength:
|
|
56
|
+
minLength: 3,
|
|
57
|
+
maxLength: 100,
|
|
58
|
+
pattern: /^[a-z0-9][a-z0-9:_-]+[a-z0-9]$/i,
|
|
58
59
|
}),
|
|
59
60
|
value: new validation_1.NumberType({
|
|
60
61
|
minimum: 0,
|
|
@@ -87,9 +88,7 @@ exports.postViewed = new validation_1.ObjectType({
|
|
|
87
88
|
exports.linkOpened = new validation_1.ObjectType({
|
|
88
89
|
required: ['link'],
|
|
89
90
|
properties: {
|
|
90
|
-
link: new validation_1.StringType(
|
|
91
|
-
format: 'uri-reference',
|
|
92
|
-
}),
|
|
91
|
+
link: new validation_1.StringType(),
|
|
93
92
|
},
|
|
94
93
|
});
|
|
95
94
|
exports.eventOccurred = new validation_1.ObjectType({
|
package/schema/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './contextSchemas';
|
|
2
2
|
export * from './ecommerceSchemas';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './evaluatorSchemas';
|
|
4
|
+
export * from './contentFetcherSchemas';
|
|
4
5
|
export * from './eventSchemas';
|
|
5
6
|
export * from './loggerSchema';
|
|
6
7
|
export * from './operationSchemas';
|
package/schema/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./contextSchemas"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./ecommerceSchemas"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./
|
|
6
|
+
tslib_1.__exportStar(require("./evaluatorSchemas"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./contentFetcherSchemas"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./eventSchemas"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./loggerSchema"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./operationSchemas"), exports);
|
package/schema/loggerSchema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loggerSchema = void 0;
|
|
4
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
5
|
exports.loggerSchema = new validation_1.ObjectType({
|
|
6
6
|
required: ['debug', 'info', 'warn', 'error'],
|
|
7
7
|
additionalProperties: true,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeOperation = exports.unsetOperation = exports.clearOperation = exports.incrementOperation = exports.decrementOperation = exports.mergeOperation = exports.combineOperation = exports.setOperation = exports.addOperation = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
const attributeSchema_1 = require("./attributeSchema");
|
|
6
|
+
const pointer = new validation_1.StringType({
|
|
7
7
|
format: 'pointer',
|
|
8
8
|
});
|
|
9
|
-
|
|
9
|
+
const simpleArray = new validation_1.JsonArrayType({
|
|
10
10
|
items: new validation_1.JsonPrimitiveType(),
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
const simpleMap = new validation_1.JsonObjectType({
|
|
13
13
|
properties: new validation_1.JsonPrimitiveType(),
|
|
14
14
|
propertyNames: attributeSchema_1.attributeNameSchema,
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
const complexMap = new validation_1.JsonObjectType({
|
|
17
17
|
properties: new validation_1.UnionType(new validation_1.JsonPrimitiveType(), simpleArray, simpleMap),
|
|
18
18
|
propertyNames: attributeSchema_1.attributeNameSchema,
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const collectionValue = new validation_1.UnionType(simpleArray, complexMap);
|
|
21
|
+
const mixedValue = new validation_1.UnionType(new validation_1.JsonPrimitiveType(), simpleArray, complexMap);
|
|
22
22
|
exports.addOperation = new validation_1.ObjectType({
|
|
23
23
|
required: ['path', 'value'],
|
|
24
24
|
properties: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sdkFacadeConfigurationSchema = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
const contextSchemas_1 = require("./contextSchemas");
|
|
6
|
+
const sdkSchemas_1 = require("./sdkSchemas");
|
|
7
|
+
const loggerSchema_1 = require("./loggerSchema");
|
|
8
8
|
exports.sdkFacadeConfigurationSchema = new validation_1.ObjectType({
|
|
9
9
|
required: ['appId'],
|
|
10
10
|
properties: {
|
|
11
11
|
appId: new validation_1.StringType({
|
|
12
12
|
format: 'uuid',
|
|
13
13
|
}),
|
|
14
|
-
|
|
14
|
+
clientId: new validation_1.StringType({
|
|
15
15
|
pattern: /^[0-9a-f]{32}$/i,
|
|
16
16
|
}),
|
|
17
17
|
tokenScope: contextSchemas_1.tokenScopeSchema,
|
|
@@ -33,7 +33,10 @@ exports.sdkFacadeConfigurationSchema = new validation_1.ObjectType({
|
|
|
33
33
|
evaluationEndpointUrl: new validation_1.StringType({
|
|
34
34
|
format: 'url',
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
contentEndpointUrl: new validation_1.StringType({
|
|
37
|
+
format: 'url',
|
|
38
|
+
}),
|
|
39
|
+
cidAssignerEndpointUrl: new validation_1.StringType({
|
|
37
40
|
format: 'url',
|
|
38
41
|
}),
|
|
39
42
|
},
|
package/schema/sdkSchemas.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sdkConfigurationSchema = exports.eventMetadataSchema = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const validation_1 = require("../validation");
|
|
5
|
+
const contextSchemas_1 = require("./contextSchemas");
|
|
6
|
+
const loggerSchema_1 = require("./loggerSchema");
|
|
7
7
|
exports.eventMetadataSchema = new validation_1.ObjectType({
|
|
8
8
|
maxProperties: 5,
|
|
9
9
|
propertyNames: new validation_1.StringType({
|
|
@@ -21,7 +21,7 @@ exports.sdkConfigurationSchema = new validation_1.ObjectType({
|
|
|
21
21
|
appId: new validation_1.StringType({
|
|
22
22
|
format: 'uuid',
|
|
23
23
|
}),
|
|
24
|
-
|
|
24
|
+
clientId: new validation_1.StringType({
|
|
25
25
|
pattern: /^[0-9a-f]{32}$/i,
|
|
26
26
|
}),
|
|
27
27
|
tokenScope: contextSchemas_1.tokenScopeSchema,
|
|
@@ -31,7 +31,10 @@ exports.sdkConfigurationSchema = new validation_1.ObjectType({
|
|
|
31
31
|
evaluationEndpointUrl: new validation_1.StringType({
|
|
32
32
|
format: 'url',
|
|
33
33
|
}),
|
|
34
|
-
|
|
34
|
+
contentEndpointUrl: new validation_1.StringType({
|
|
35
|
+
format: 'url',
|
|
36
|
+
}),
|
|
37
|
+
cidAssignerEndpointUrl: new validation_1.StringType({
|
|
35
38
|
format: 'url',
|
|
36
39
|
}),
|
|
37
40
|
beaconQueueSize: new validation_1.NumberType({
|