@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,80 +1,78 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GuaranteedChannel = exports.TimeStamper = void 0;
4
- var tslib_1 = require("tslib");
5
- var logging_1 = require("../logging");
6
- var TimeStamper = /** @class */ (function () {
7
- function TimeStamper() {
8
- }
9
- TimeStamper.prototype.generate = function () {
4
+ const logging_1 = require("../logging");
5
+ class TimeStamper {
6
+ generate() {
10
7
  return String(Date.now());
11
- };
12
- return TimeStamper;
13
- }());
8
+ }
9
+ }
14
10
  exports.TimeStamper = TimeStamper;
15
- var GuaranteedChannel = /** @class */ (function () {
16
- function GuaranteedChannel(_a) {
17
- var _b;
18
- var channel = _a.channel, logger = _a.logger, stamper = _a.stamper, options = tslib_1.__rest(_a, ["channel", "logger", "stamper"]);
11
+ class GuaranteedChannel {
12
+ constructor({ channel, logger, stamper, ...options }) {
13
+ var _a;
19
14
  this.closed = false;
20
15
  this.channel = channel;
21
16
  this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
22
17
  this.stamper = stamper;
23
- this.options = tslib_1.__assign(tslib_1.__assign({}, options), { ackTimeout: (_b = options.ackTimeout) !== null && _b !== void 0 ? _b : 5000 });
18
+ this.options = {
19
+ ...options,
20
+ ackTimeout: (_a = options.ackTimeout) !== null && _a !== void 0 ? _a : 5000,
21
+ };
24
22
  }
25
- GuaranteedChannel.prototype.publish = function (message) {
26
- var _this = this;
23
+ publish(message) {
27
24
  if (this.closed) {
28
25
  return Promise.reject(new Error('Channel is closed.'));
29
26
  }
30
- return new Promise(function (resolve, reject) {
31
- var id = _this.stamper.generate(message);
32
- var timeoutTimer;
33
- var closeWatcher;
34
- var confirmed = false;
35
- var start = Date.now();
36
- var acknowledge = function (response) {
27
+ return new Promise((resolve, reject) => {
28
+ const id = this.stamper.generate(message);
29
+ let timeoutTimer;
30
+ let closeWatcher;
31
+ let confirmed = false;
32
+ const start = Date.now();
33
+ const acknowledge = (response) => {
37
34
  if (response === id) {
38
35
  confirmed = true;
39
- var elapsed = Date.now() - start;
36
+ const elapsed = Date.now() - start;
40
37
  window.clearTimeout(timeoutTimer);
41
38
  window.clearInterval(closeWatcher);
42
- _this.logger.debug("Delivery confirmed #".concat(id, ", elapsed ").concat(elapsed, "ms."));
43
- _this.channel.unsubscribe(acknowledge);
39
+ this.logger.debug(`Delivery confirmed #${id}, elapsed ${elapsed}ms.`);
40
+ this.channel.unsubscribe(acknowledge);
44
41
  resolve();
45
42
  }
46
43
  };
47
- _this.channel.subscribe(acknowledge);
48
- var abort = function (error) {
44
+ this.channel.subscribe(acknowledge);
45
+ const abort = (error) => {
49
46
  window.clearTimeout(timeoutTimer);
50
47
  window.clearInterval(closeWatcher);
51
- _this.logger.error("Failed to send message #".concat(id));
52
- _this.channel.unsubscribe(acknowledge);
48
+ this.logger.error(`Failed to send message #${id}`);
49
+ this.channel.unsubscribe(acknowledge);
53
50
  reject(error);
54
51
  };
55
- var wait = function () {
52
+ const wait = () => {
56
53
  if (confirmed) {
57
54
  return;
58
55
  }
59
- closeWatcher = window.setInterval(function () {
60
- if (_this.closed) {
56
+ closeWatcher = window.setInterval(() => {
57
+ if (this.closed) {
61
58
  // Cancel delay immediately when the channel is closed
62
59
  abort(new Error('Connection deliberately closed.'));
63
60
  }
64
61
  }, 0);
65
- _this.logger.debug("Waiting confirmation #".concat(id, "..."));
66
- timeoutTimer = window.setTimeout(function () {
62
+ this.logger.debug(`Waiting confirmation #${id}...`);
63
+ timeoutTimer = window.setTimeout(() => {
67
64
  abort(new Error('Maximum confirmation time reached.'));
68
- }, _this.options.ackTimeout);
65
+ }, this.options.ackTimeout);
69
66
  };
70
- _this.logger.debug("Sending message #".concat(id, "..."));
71
- _this.channel.publish({ id: id, message: message }).then(wait, abort);
67
+ this.logger.debug(`Sending message #${id}...`);
68
+ this.channel
69
+ .publish({ id: id, message: message })
70
+ .then(wait, abort);
72
71
  });
73
- };
74
- GuaranteedChannel.prototype.close = function () {
72
+ }
73
+ close() {
75
74
  this.closed = true;
76
75
  return this.channel.close();
77
- };
78
- return GuaranteedChannel;
79
- }());
76
+ }
77
+ }
80
78
  exports.GuaranteedChannel = GuaranteedChannel;
package/channel/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SocketChannel = exports.SandboxChannel = exports.RetryChannel = exports.QueuedChannel = exports.GuaranteedChannel = exports.EncodedChannel = exports.BeaconSocketChannel = void 0;
4
- var tslib_1 = require("tslib");
4
+ const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./channel"), exports);
6
6
  var beaconSocketChannel_1 = require("./beaconSocketChannel");
7
7
  Object.defineProperty(exports, "BeaconSocketChannel", { enumerable: true, get: function () { return beaconSocketChannel_1.BeaconSocketChannel; } });
@@ -1,23 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QueuedChannel = void 0;
4
- var tslib_1 = require("tslib");
5
- var logging_1 = require("../logging");
6
- var QueuedChannel = /** @class */ (function () {
7
- function QueuedChannel(channel, queue, logger) {
4
+ const logging_1 = require("../logging");
5
+ class QueuedChannel {
6
+ constructor(channel, queue, logger) {
8
7
  this.closed = false;
9
8
  this.channel = channel;
10
9
  this.queue = queue;
11
10
  this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
12
11
  }
13
- QueuedChannel.prototype.flush = function () {
12
+ flush() {
14
13
  if (this.pending === undefined) {
15
14
  return this.requeue();
16
15
  }
17
16
  return this.pending.catch(this.requeue.bind(this));
18
- };
19
- QueuedChannel.prototype.publish = function (message) {
20
- var _this = this;
17
+ }
18
+ publish(message) {
21
19
  if (this.closed) {
22
20
  return Promise.reject(new Error('Channel is closed.'));
23
21
  }
@@ -31,22 +29,22 @@ var QueuedChannel = /** @class */ (function () {
31
29
  : Promise.reject(new Error('The queue must be flushed.'));
32
30
  }
33
31
  this.enqueue(message);
34
- this.pending = this.pending.then(function () { return _this.channel.publish(message).then(_this.dequeue.bind(_this)); });
32
+ this.pending = this.pending.then(() => this.channel
33
+ .publish(message)
34
+ .then(this.dequeue.bind(this)));
35
35
  return this.pending;
36
- };
37
- QueuedChannel.prototype.enqueue = function (message) {
36
+ }
37
+ enqueue(message) {
38
38
  this.logger.debug('Enqueueing message...');
39
- this.logger.debug("Queue length: ".concat(this.queue.length() + 1));
39
+ this.logger.debug(`Queue length: ${this.queue.length() + 1}`);
40
40
  this.queue.push(message);
41
- };
42
- QueuedChannel.prototype.dequeue = function () {
41
+ }
42
+ dequeue() {
43
43
  this.logger.debug('Dequeuing message...');
44
- this.logger.debug("Queue length: ".concat(Math.max(0, this.queue.length() - 1)));
44
+ this.logger.debug(`Queue length: ${Math.max(0, this.queue.length() - 1)}`);
45
45
  this.queue.shift();
46
- };
47
- QueuedChannel.prototype.requeue = function () {
48
- var e_1, _a;
49
- var _this = this;
46
+ }
47
+ requeue() {
50
48
  if (this.closed) {
51
49
  return Promise.reject(new Error('Channel is closed.'));
52
50
  }
@@ -54,54 +52,27 @@ var QueuedChannel = /** @class */ (function () {
54
52
  if (this.queue.isEmpty()) {
55
53
  return this.pending;
56
54
  }
57
- var length = this.queue.length();
55
+ const length = this.queue.length();
58
56
  this.logger.debug('Requeuing messages...');
59
- this.logger.debug("Queue length: ".concat(length));
60
- var _loop_1 = function (message) {
61
- this_1.pending = this_1.pending.then(function () { return _this.channel.publish(message).then(_this.dequeue.bind(_this)); });
62
- };
63
- var this_1 = this;
64
- try {
65
- for (var _b = tslib_1.__values(this.queue.all()), _c = _b.next(); !_c.done; _c = _b.next()) {
66
- var message = _c.value;
67
- _loop_1(message);
68
- }
57
+ this.logger.debug(`Queue length: ${length}`);
58
+ for (const message of this.queue.all()) {
59
+ this.pending = this.pending.then(() => this.channel
60
+ .publish(message)
61
+ .then(this.dequeue.bind(this)));
69
62
  }
70
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
71
- finally {
63
+ return this.pending;
64
+ }
65
+ async close() {
66
+ this.closed = true;
67
+ await this.channel.close();
68
+ if (this.pending !== undefined) {
72
69
  try {
73
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
70
+ await this.pending;
71
+ }
72
+ catch {
73
+ // suppress errors
74
74
  }
75
- finally { if (e_1) throw e_1.error; }
76
75
  }
77
- return this.pending;
78
- };
79
- QueuedChannel.prototype.close = function () {
80
- return tslib_1.__awaiter(this, void 0, void 0, function () {
81
- var _a;
82
- return tslib_1.__generator(this, function (_b) {
83
- switch (_b.label) {
84
- case 0:
85
- this.closed = true;
86
- return [4 /*yield*/, this.channel.close()];
87
- case 1:
88
- _b.sent();
89
- if (!(this.pending !== undefined)) return [3 /*break*/, 5];
90
- _b.label = 2;
91
- case 2:
92
- _b.trys.push([2, 4, , 5]);
93
- return [4 /*yield*/, this.pending];
94
- case 3:
95
- _b.sent();
96
- return [3 /*break*/, 5];
97
- case 4:
98
- _a = _b.sent();
99
- return [3 /*break*/, 5];
100
- case 5: return [2 /*return*/];
101
- }
102
- });
103
- });
104
- };
105
- return QueuedChannel;
106
- }());
76
+ }
77
+ }
107
78
  exports.QueuedChannel = QueuedChannel;
@@ -1,7 +1,7 @@
1
1
  import { OutputChannel } from './channel';
2
2
  import { Logger } from '../logging';
3
3
  import { RetryPolicy } from '../retry';
4
- declare type Configuration<T> = {
4
+ type Configuration<T> = {
5
5
  channel: OutputChannel<T>;
6
6
  retryPolicy: RetryPolicy<T>;
7
7
  logger?: Logger;
@@ -1,91 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RetryChannel = void 0;
4
- var tslib_1 = require("tslib");
5
- var logging_1 = require("../logging");
6
- var RetryChannel = /** @class */ (function () {
7
- function RetryChannel(_a) {
8
- var channel = _a.channel, retryPolicy = _a.retryPolicy, logger = _a.logger;
4
+ const logging_1 = require("../logging");
5
+ class RetryChannel {
6
+ constructor({ channel, retryPolicy, logger }) {
9
7
  this.closed = false;
10
8
  this.channel = channel;
11
9
  this.retryPolicy = retryPolicy;
12
10
  this.logger = logger !== null && logger !== void 0 ? logger : new logging_1.NullLogger();
13
11
  }
14
- RetryChannel.prototype.publish = function (message) {
15
- var _this = this;
12
+ publish(message) {
16
13
  if (this.closed) {
17
14
  return Promise.reject(new Error('The channel is closed.'));
18
15
  }
19
- return this.channel.publish(message).catch(function (error) { return _this.retry(message, error); });
20
- };
21
- RetryChannel.prototype.retry = function (message, error) {
22
- return tslib_1.__awaiter(this, void 0, void 0, function () {
23
- var attempt, _loop_1, this_1, state_1;
24
- var _this = this;
25
- return tslib_1.__generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0:
28
- attempt = 0;
29
- _loop_1 = function () {
30
- var delay, _b, _c;
31
- return tslib_1.__generator(this, function (_d) {
32
- switch (_d.label) {
33
- case 0:
34
- if (this_1.closed) {
35
- throw new Error('Connection deliberately closed.');
36
- }
37
- delay = this_1.retryPolicy.getDelay(attempt);
38
- this_1.logger.debug("Retry attempt ".concat(attempt + 1));
39
- if (!(delay > 0)) return [3 /*break*/, 2];
40
- this_1.logger.debug("Retry attempt delayed in ".concat(delay, "ms"));
41
- return [4 /*yield*/, new Promise(function (resolve, reject) {
42
- var closeWatcher = window.setInterval(function () {
43
- if (_this.closed) {
44
- // Cancel delay immediately when the channel is closed
45
- window.clearInterval(closeWatcher);
46
- reject(new Error('Connection deliberately closed.'));
47
- }
48
- }, 0);
49
- window.setTimeout(function () {
50
- window.clearInterval(closeWatcher);
51
- resolve();
52
- }, delay);
53
- })];
54
- case 1:
55
- _d.sent();
56
- _d.label = 2;
57
- case 2:
58
- _d.trys.push([2, 4, , 5]);
59
- _b = {};
60
- return [4 /*yield*/, this_1.channel.publish(message)];
61
- case 3: return [2 /*return*/, (_b.value = _d.sent(), _b)];
62
- case 4:
63
- _c = _d.sent();
64
- attempt += 1;
65
- return [3 /*break*/, 5];
66
- case 5: return [2 /*return*/];
67
- }
68
- });
69
- };
70
- this_1 = this;
71
- _a.label = 1;
72
- case 1:
73
- if (!this.retryPolicy.shouldRetry(attempt, message, error)) return [3 /*break*/, 3];
74
- return [5 /*yield**/, _loop_1()];
75
- case 2:
76
- state_1 = _a.sent();
77
- if (typeof state_1 === "object")
78
- return [2 /*return*/, state_1.value];
79
- return [3 /*break*/, 1];
80
- case 3: throw new Error('Maximum retry attempts reached.');
81
- }
82
- });
83
- });
84
- };
85
- RetryChannel.prototype.close = function () {
16
+ return this.channel
17
+ .publish(message)
18
+ .catch(error => this.retry(message, error));
19
+ }
20
+ async retry(message, error) {
21
+ let attempt = 0;
22
+ while (this.retryPolicy.shouldRetry(attempt, message, error)) {
23
+ if (this.closed) {
24
+ throw new Error('Connection deliberately closed.');
25
+ }
26
+ const delay = this.retryPolicy.getDelay(attempt);
27
+ this.logger.debug(`Retry attempt ${attempt + 1}`);
28
+ if (delay > 0) {
29
+ this.logger.debug(`Retry attempt delayed in ${delay}ms`);
30
+ await new Promise((resolve, reject) => {
31
+ const closeWatcher = window.setInterval(() => {
32
+ if (this.closed) {
33
+ // Cancel delay immediately when the channel is closed
34
+ window.clearInterval(closeWatcher);
35
+ reject(new Error('Connection deliberately closed.'));
36
+ }
37
+ }, 0);
38
+ window.setTimeout(() => {
39
+ window.clearInterval(closeWatcher);
40
+ resolve();
41
+ }, delay);
42
+ });
43
+ }
44
+ try {
45
+ return await this.channel.publish(message);
46
+ }
47
+ catch {
48
+ attempt += 1;
49
+ }
50
+ }
51
+ throw new Error('Maximum retry attempts reached.');
52
+ }
53
+ close() {
86
54
  this.closed = true;
87
55
  return this.channel.close();
88
- };
89
- return RetryChannel;
90
- }());
56
+ }
57
+ }
91
58
  exports.RetryChannel = RetryChannel;
@@ -1,37 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SandboxChannel = void 0;
4
- var SandboxChannel = /** @class */ (function () {
5
- function SandboxChannel() {
4
+ class SandboxChannel {
5
+ constructor() {
6
6
  this.listeners = [];
7
7
  this.messages = [];
8
8
  this.closed = false;
9
9
  }
10
- SandboxChannel.prototype.publish = function (message) {
10
+ publish(message) {
11
11
  this.messages.push(message);
12
12
  return Promise.resolve();
13
- };
14
- SandboxChannel.prototype.notify = function (message) {
15
- this.listeners.forEach(function (dispatch) { return dispatch(message); });
16
- };
17
- SandboxChannel.prototype.subscribe = function (listener) {
13
+ }
14
+ notify(message) {
15
+ this.listeners.forEach(dispatch => dispatch(message));
16
+ }
17
+ subscribe(listener) {
18
18
  if (!this.listeners.includes(listener)) {
19
19
  this.listeners.push(listener);
20
20
  }
21
- };
22
- SandboxChannel.prototype.unsubscribe = function (listener) {
23
- var index = this.listeners.indexOf(listener);
21
+ }
22
+ unsubscribe(listener) {
23
+ const index = this.listeners.indexOf(listener);
24
24
  if (index >= 0) {
25
25
  this.listeners.splice(index, 1);
26
26
  }
27
- };
28
- SandboxChannel.prototype.close = function () {
27
+ }
28
+ close() {
29
29
  this.closed = true;
30
30
  return Promise.resolve();
31
- };
32
- SandboxChannel.prototype.isClosed = function () {
31
+ }
32
+ isClosed() {
33
33
  return this.closed;
34
- };
35
- return SandboxChannel;
36
- }());
34
+ }
35
+ }
37
36
  exports.SandboxChannel = SandboxChannel;
@@ -1,14 +1,14 @@
1
1
  import { Logger } from '../logging';
2
2
  import { ChannelListener, DuplexChannel } from './channel';
3
- declare type Input = string | ArrayBufferLike | Blob | ArrayBufferView;
4
- declare type Output = string | ArrayBuffer | Blob;
5
- declare type Options = {
3
+ type Input = string | ArrayBufferLike | Blob | ArrayBufferView;
4
+ type Output = string | ArrayBuffer | Blob;
5
+ type Options = {
6
6
  closeTimeout: number;
7
7
  connectionTimeout: number;
8
8
  protocols: string | string[];
9
9
  binaryType?: BinaryType;
10
10
  };
11
- export declare type Configuration = Partial<Options> & {
11
+ export type Configuration = Partial<Options> & {
12
12
  url: string;
13
13
  logger?: Logger;
14
14
  };