@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.
Files changed (122) hide show
  1. package/activeRecord.js +32 -36
  2. package/cache/fallbackCache.js +15 -32
  3. package/cache/inMemoryCache.js +9 -10
  4. package/cache/index.js +1 -1
  5. package/cache/localStorageCache.js +24 -25
  6. package/channel/beaconSocketChannel.d.ts +1 -1
  7. package/channel/beaconSocketChannel.js +49 -79
  8. package/channel/channel.d.ts +1 -1
  9. package/channel/encodedChannel.js +8 -10
  10. package/channel/guaranteedChannel.d.ts +4 -4
  11. package/channel/guaranteedChannel.js +41 -43
  12. package/channel/index.js +1 -1
  13. package/channel/queuedChannel.js +35 -64
  14. package/channel/retryChannel.d.ts +1 -1
  15. package/channel/retryChannel.js +44 -77
  16. package/channel/sandboxChannel.js +17 -18
  17. package/channel/socketChannel.d.ts +4 -4
  18. package/channel/socketChannel.js +77 -79
  19. package/cid/cachedAssigner.js +15 -27
  20. package/cid/fixedAssigner.js +5 -6
  21. package/cid/index.js +1 -1
  22. package/cid/remoteAssigner.js +23 -36
  23. package/constants.d.ts +3 -2
  24. package/constants.js +6 -5
  25. package/container.d.ts +13 -6
  26. package/container.js +152 -168
  27. package/contentFetcher.d.ts +59 -0
  28. package/contentFetcher.js +129 -0
  29. package/context.d.ts +3 -3
  30. package/context.js +36 -38
  31. package/error.js +2 -2
  32. package/evaluator.d.ts +33 -24
  33. package/evaluator.js +126 -117
  34. package/eventManager.d.ts +1 -1
  35. package/eventManager.js +14 -15
  36. package/facade/contentFetcherFacade.d.ts +27 -0
  37. package/facade/contentFetcherFacade.js +40 -0
  38. package/facade/evaluatorFacade.d.ts +13 -3
  39. package/facade/evaluatorFacade.js +57 -72
  40. package/facade/sdkFacade.d.ts +10 -3
  41. package/facade/sdkFacade.js +129 -141
  42. package/facade/sessionFacade.js +6 -7
  43. package/facade/sessionPatch.js +9 -13
  44. package/facade/trackerFacade.js +32 -38
  45. package/facade/userFacade.js +10 -11
  46. package/facade/userPatch.js +9 -13
  47. package/index.js +2 -2
  48. package/logging/consoleLogger.js +18 -35
  49. package/logging/index.js +1 -1
  50. package/logging/namespacedLogger.js +14 -15
  51. package/logging/nullLogger.js +10 -13
  52. package/namespacedStorage.js +30 -47
  53. package/package.json +13 -16
  54. package/patch.d.ts +1 -1
  55. package/queue/capacityRestrictedQueue.js +17 -18
  56. package/queue/inMemoryQueue.js +22 -28
  57. package/queue/index.js +1 -1
  58. package/queue/monitoredQueue.d.ts +2 -2
  59. package/queue/monitoredQueue.js +39 -40
  60. package/queue/persistentQueue.js +33 -38
  61. package/retry/arbitraryPolicy.js +8 -10
  62. package/retry/backoffPolicy.d.ts +1 -1
  63. package/retry/backoffPolicy.js +11 -13
  64. package/retry/index.js +1 -1
  65. package/retry/maxAttemptsPolicy.js +7 -8
  66. package/retry/neverPolicy.js +6 -9
  67. package/schema/attributeSchema.js +1 -1
  68. package/schema/contentFetcherSchemas.d.ts +2 -0
  69. package/schema/contentFetcherSchemas.js +22 -0
  70. package/schema/contentSchemas.js +1 -1
  71. package/schema/contextSchemas.js +1 -1
  72. package/schema/ecommerceSchemas.js +1 -1
  73. package/schema/evaluatorSchemas.d.ts +2 -0
  74. package/schema/{evaluationSchemas.js → evaluatorSchemas.js} +3 -3
  75. package/schema/eventSchemas.js +5 -7
  76. package/schema/index.d.ts +2 -1
  77. package/schema/index.js +3 -2
  78. package/schema/loggerSchema.js +1 -1
  79. package/schema/operationSchemas.js +8 -8
  80. package/schema/sdkFacadeSchemas.js +9 -6
  81. package/schema/sdkSchemas.js +8 -5
  82. package/schema/tokenSchema.js +5 -4
  83. package/schema/userSchema.js +2 -2
  84. package/sdk.d.ts +9 -3
  85. package/sdk.js +81 -127
  86. package/sdkEvents.d.ts +3 -3
  87. package/sourceLocation.d.ts +3 -3
  88. package/sourceLocation.js +13 -14
  89. package/tab.d.ts +5 -5
  90. package/tab.js +50 -80
  91. package/token/cachedTokenStore.js +9 -10
  92. package/token/inMemoryTokenStore.js +7 -8
  93. package/token/index.js +1 -1
  94. package/token/replicatedTokenStore.js +7 -8
  95. package/token/token.d.ts +9 -5
  96. package/token/token.js +63 -57
  97. package/tracker.d.ts +4 -4
  98. package/tracker.js +145 -122
  99. package/trackingEvents.d.ts +36 -36
  100. package/trackingEvents.js +12 -6
  101. package/transformer.js +1 -1
  102. package/utilityTypes.d.ts +2 -2
  103. package/uuid.js +9 -7
  104. package/validation/arrayType.d.ts +2 -2
  105. package/validation/arrayType.js +29 -27
  106. package/validation/booleanType.js +11 -15
  107. package/validation/functionType.js +11 -15
  108. package/validation/index.js +1 -1
  109. package/validation/jsonType.d.ts +2 -2
  110. package/validation/jsonType.js +61 -80
  111. package/validation/mixedSchema.js +4 -7
  112. package/validation/nullType.js +11 -15
  113. package/validation/numberType.d.ts +1 -1
  114. package/validation/numberType.js +23 -22
  115. package/validation/objectType.d.ts +1 -1
  116. package/validation/objectType.js +61 -72
  117. package/validation/schema.js +6 -10
  118. package/validation/stringType.d.ts +1 -1
  119. package/validation/stringType.js +36 -47
  120. package/validation/unionType.js +27 -77
  121. package/validation/violation.js +1 -2
  122. package/schema/evaluationSchemas.d.ts +0 -2
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MonitoredQueue = void 0;
4
- var logging_1 = require("../logging");
5
- var MonitoredQueue = /** @class */ (function () {
6
- function MonitoredQueue(queue, logger) {
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
- MonitoredQueue.prototype.all = function () {
12
+ all() {
13
13
  return this.queue.all();
14
- };
15
- MonitoredQueue.prototype.getCapacity = function () {
14
+ }
15
+ getCapacity() {
16
16
  return this.queue.getCapacity();
17
- };
18
- MonitoredQueue.prototype.addCallback = function (status, callback) {
19
- var callbacks = this.callbacks[status] || [];
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
- MonitoredQueue.prototype.removeCallback = function (type, callback) {
43
- var callbacks = this.callbacks[type];
44
- if (!callbacks) {
42
+ }
43
+ removeCallback(type, callback) {
44
+ const callbacks = this.callbacks[type];
45
+ if (callbacks == null) {
45
46
  return;
46
47
  }
47
- var index = callbacks.indexOf(callback);
48
+ const index = callbacks.indexOf(callback);
48
49
  if (index >= 0) {
49
50
  callbacks.splice(index, 1);
50
51
  }
51
- };
52
- MonitoredQueue.prototype.setStatus = function (status) {
52
+ }
53
+ setStatus(status) {
53
54
  if (this.status === status) {
54
55
  return;
55
56
  }
56
- this.logger.debug("Queue status changed to \"".concat(status, "\""));
57
+ this.logger.debug(`Queue status changed to "${status}"`);
57
58
  this.report(status);
58
59
  this.status = status;
59
- };
60
- MonitoredQueue.prototype.report = function (status) {
61
- var _this = this;
62
- var callbacks = this.callbacks[status];
60
+ }
61
+ report(status) {
62
+ const callbacks = this.callbacks[status];
63
63
  if (callbacks !== undefined) {
64
- callbacks.forEach(function (callback) { return callback(_this); });
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
- MonitoredQueue.prototype.isEmpty = function () {
78
+ }
79
+ isEmpty() {
80
80
  return this.queue.isEmpty();
81
- };
82
- MonitoredQueue.prototype.length = function () {
81
+ }
82
+ length() {
83
83
  return this.queue.length();
84
- };
85
- MonitoredQueue.prototype.peek = function () {
84
+ }
85
+ peek() {
86
86
  return this.queue.peek();
87
- };
88
- MonitoredQueue.prototype.push = function (value) {
87
+ }
88
+ push(value) {
89
89
  this.queue.push(value);
90
90
  this.updateStatus();
91
- };
92
- MonitoredQueue.prototype.shift = function () {
93
- var value = this.queue.shift();
91
+ }
92
+ shift() {
93
+ const value = this.queue.shift();
94
94
  this.updateStatus();
95
95
  return value;
96
- };
97
- MonitoredQueue.prototype.updateStatus = function () {
98
- var length = this.queue.length();
99
- var capacity = this.getCapacity();
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
- return MonitoredQueue;
123
- }());
121
+ }
122
+ }
124
123
  exports.MonitoredQueue = MonitoredQueue;
@@ -1,58 +1,54 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PersistentQueue = void 0;
4
- var PersistentQueue = /** @class */ (function () {
5
- function PersistentQueue(storage, key) {
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
- PersistentQueue.prototype.all = function () {
9
+ all() {
11
10
  return this.queue.slice();
12
- };
13
- PersistentQueue.prototype.getCapacity = function () {
11
+ }
12
+ getCapacity() {
14
13
  return Infinity;
15
- };
16
- PersistentQueue.prototype.isEmpty = function () {
14
+ }
15
+ isEmpty() {
17
16
  return this.length() === 0;
18
- };
19
- PersistentQueue.prototype.length = function () {
17
+ }
18
+ length() {
20
19
  return this.queue.length;
21
- };
22
- PersistentQueue.prototype.push = function (value) {
20
+ }
21
+ push(value) {
23
22
  this.queue.push(value);
24
23
  this.flush();
25
- };
26
- PersistentQueue.prototype.peek = function () {
27
- var item = this.queue[0];
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
- PersistentQueue.prototype.shift = function () {
34
- var value = this.queue.shift();
35
- if (!value) {
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
- Object.defineProperty(PersistentQueue.prototype, "queue", {
42
- get: function () {
43
- if (!this.cache) {
44
- this.cache = this.load();
45
- }
46
- return this.cache;
47
- },
48
- enumerable: false,
49
- configurable: true
50
- });
51
- PersistentQueue.prototype.flush = function () {
52
- this.storage.setItem(this.key, JSON.stringify(this.cache || []));
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
- return PersistentQueue;
67
- }());
61
+ }
62
+ }
68
63
  exports.PersistentQueue = PersistentQueue;
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArbitraryPolicy = void 0;
4
- var tslib_1 = require("tslib");
5
- var ArbitraryPolicy = /** @class */ (function () {
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 = tslib_1.__spreadArray([], tslib_1.__read(delays), false);
9
+ this.delays = [...delays];
11
10
  }
12
- ArbitraryPolicy.prototype.getDelay = function (attempt) {
11
+ getDelay(attempt) {
13
12
  return this.delays[Math.min(attempt < 0 ? 0 : attempt, this.delays.length - 1)];
14
- };
15
- ArbitraryPolicy.prototype.shouldRetry = function () {
13
+ }
14
+ shouldRetry() {
16
15
  return true;
17
- };
18
- return ArbitraryPolicy;
19
- }());
16
+ }
17
+ }
20
18
  exports.ArbitraryPolicy = ArbitraryPolicy;
@@ -1,5 +1,5 @@
1
1
  import { RetryPolicy } from './policy';
2
- declare type Options = {
2
+ type Options = {
3
3
  minRetryDelay: number;
4
4
  maxRetryDelay: number;
5
5
  backoffFactor: number;
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackoffPolicy = void 0;
4
- var BackoffPolicy = /** @class */ (function () {
5
- function BackoffPolicy(options) {
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
- var _a = options.minRetryDelay, minRetryDelay = _a === void 0 ? this.minRetryDelay : _a, _b = options.maxRetryDelay, maxRetryDelay = _b === void 0 ? this.maxRetryDelay : _b, _c = options.backoffFactor, backoffFactor = _c === void 0 ? this.backoffFactor : _c, _d = options.backoffJitter, backoffJitter = _d === void 0 ? this.backoffJitter : _d, _e = options.maxAttempts, maxAttempts = _e === void 0 ? this.maxAttempts : _e;
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
- BackoffPolicy.prototype.getDelay = function (attempt) {
40
- var delay = Math.min(Math.max(Math.pow(this.backoffFactor, attempt), this.minRetryDelay), this.maxRetryDelay);
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
- var min = Math.ceil(this.minRetryDelay);
45
- var max = Math.floor(delay);
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
- BackoffPolicy.prototype.shouldRetry = function (attempt) {
50
+ }
51
+ shouldRetry(attempt) {
53
52
  return attempt < this.maxAttempts;
54
- };
55
- return BackoffPolicy;
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
- var tslib_1 = require("tslib");
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
- var MaxAttemptsPolicy = /** @class */ (function () {
5
- function MaxAttemptsPolicy(delay, maxAttempts) {
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
- MaxAttemptsPolicy.prototype.getDelay = function () {
15
+ getDelay() {
16
16
  return this.delay;
17
- };
18
- MaxAttemptsPolicy.prototype.shouldRetry = function (attempt) {
17
+ }
18
+ shouldRetry(attempt) {
19
19
  return attempt < this.maxAttempts;
20
- };
21
- return MaxAttemptsPolicy;
22
- }());
20
+ }
21
+ }
23
22
  exports.MaxAttemptsPolicy = MaxAttemptsPolicy;
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NeverPolicy = void 0;
4
- var NeverPolicy = /** @class */ (function () {
5
- function NeverPolicy() {
6
- }
7
- NeverPolicy.prototype.getDelay = function () {
4
+ class NeverPolicy {
5
+ getDelay() {
8
6
  return Infinity;
9
- };
10
- NeverPolicy.prototype.shouldRetry = function () {
7
+ }
8
+ shouldRetry() {
11
9
  return false;
12
- };
13
- return NeverPolicy;
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
- var validation_1 = require("../validation");
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,2 @@
1
+ import { ObjectType } from '../validation';
2
+ export declare const fetchOptionsSchema: ObjectType;
@@ -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
+ });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.postDetails = void 0;
4
- var validation_1 = require("../validation");
4
+ const validation_1 = require("../validation");
5
5
  exports.postDetails = new validation_1.ObjectType({
6
6
  required: ['postId', 'title', 'publishTime'],
7
7
  properties: {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tokenScopeSchema = void 0;
4
- var validation_1 = require("../validation");
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
- var validation_1 = require("../validation");
4
+ const validation_1 = require("../validation");
5
5
  exports.productDetails = new validation_1.ObjectType({
6
6
  required: ['productId', 'name', 'displayPrice'],
7
7
  properties: {
@@ -0,0 +1,2 @@
1
+ import { ObjectType } from '../validation';
2
+ export declare const evaluationOptionsSchema: ObjectType;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optionsSchema = void 0;
4
- var validation_1 = require("../validation");
5
- exports.optionsSchema = new validation_1.ObjectType({
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,
@@ -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
- var validation_1 = require("../validation");
5
- var ecommerceSchemas_1 = require("./ecommerceSchemas");
6
- var userSchema_1 = require("./userSchema");
7
- var contentSchemas_1 = require("./contentSchemas");
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: {
@@ -88,9 +88,7 @@ exports.postViewed = new validation_1.ObjectType({
88
88
  exports.linkOpened = new validation_1.ObjectType({
89
89
  required: ['link'],
90
90
  properties: {
91
- link: new validation_1.StringType({
92
- format: 'uri-reference',
93
- }),
91
+ link: new validation_1.StringType(),
94
92
  },
95
93
  });
96
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 './evaluationSchemas';
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
- var tslib_1 = require("tslib");
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("./evaluationSchemas"), exports);
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);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loggerSchema = void 0;
4
- var validation_1 = require("../validation");
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
- var validation_1 = require("../validation");
5
- var attributeSchema_1 = require("./attributeSchema");
6
- var pointer = new validation_1.StringType({
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
- var simpleArray = new validation_1.JsonArrayType({
9
+ const simpleArray = new validation_1.JsonArrayType({
10
10
  items: new validation_1.JsonPrimitiveType(),
11
11
  });
12
- var simpleMap = new validation_1.JsonObjectType({
12
+ const simpleMap = new validation_1.JsonObjectType({
13
13
  properties: new validation_1.JsonPrimitiveType(),
14
14
  propertyNames: attributeSchema_1.attributeNameSchema,
15
15
  });
16
- var complexMap = new validation_1.JsonObjectType({
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
- var collectionValue = new validation_1.UnionType(simpleArray, complexMap);
21
- var mixedValue = new validation_1.UnionType(new validation_1.JsonPrimitiveType(), simpleArray, complexMap);
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
- var validation_1 = require("../validation");
5
- var contextSchemas_1 = require("./contextSchemas");
6
- var sdkSchemas_1 = require("./sdkSchemas");
7
- var loggerSchema_1 = require("./loggerSchema");
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
- cid: new validation_1.StringType({
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
- bootstrapEndpointUrl: new validation_1.StringType({
36
+ contentEndpointUrl: new validation_1.StringType({
37
+ format: 'url',
38
+ }),
39
+ cidAssignerEndpointUrl: new validation_1.StringType({
37
40
  format: 'url',
38
41
  }),
39
42
  },
@@ -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
- var validation_1 = require("../validation");
5
- var contextSchemas_1 = require("./contextSchemas");
6
- var loggerSchema_1 = require("./loggerSchema");
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
- cid: new validation_1.StringType({
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
- bootstrapEndpointUrl: new validation_1.StringType({
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({