@sprucelabs/mercury-client 41.0.316 → 41.0.317

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.
@@ -14,8 +14,8 @@ import SpruceError from '../errors/SpruceError.js';
14
14
  import MutableContractClient from './MutableContractClient.js';
15
15
  class MercuryClientFactory {
16
16
  static Client(connectionOptions) {
17
- var _a;
18
17
  return __awaiter(this, void 0, void 0, function* () {
18
+ var _a;
19
19
  const { host: hostOption, contracts, reconnectDelayMs, allowSelfSignedCrt, emitTimeoutMs = this.timeoutMs, shouldReconnect, maxEmitRetries, connectionRetries, } = connectionOptions || {};
20
20
  const host = hostOption !== null && hostOption !== void 0 ? hostOption : DEFAULT_HOST;
21
21
  if (host.substr(0, 4) !== 'http') {
@@ -117,8 +117,8 @@ class MercurySocketIoClient {
117
117
  }
118
118
  }));
119
119
  }
120
- attemptReconnectAfterDelay(retriesLeft = this.maxEmitRetries) {
121
- return __awaiter(this, void 0, void 0, function* () {
120
+ attemptReconnectAfterDelay() {
121
+ return __awaiter(this, arguments, void 0, function* (retriesLeft = this.maxEmitRetries) {
122
122
  if (this.isManuallyDisconnected) {
123
123
  this.isReconnecting = false;
124
124
  return;
@@ -143,8 +143,8 @@ class MercurySocketIoClient {
143
143
  });
144
144
  }
145
145
  reconnect(resolve, reject, retriesLeft) {
146
- var _a;
147
146
  return __awaiter(this, void 0, void 0, function* () {
147
+ var _a;
148
148
  try {
149
149
  this.connectionRetriesRemaining--;
150
150
  const key = new Date().getTime();
@@ -279,8 +279,8 @@ class MercurySocketIoClient {
279
279
  });
280
280
  }
281
281
  _emit(retriesRemaining, eventName, payload, cb) {
282
- var _a;
283
282
  return __awaiter(this, void 0, void 0, function* () {
283
+ var _a;
284
284
  if (!this.skipWaitIfReconnecting) {
285
285
  yield this.waitIfReconnecting();
286
286
  }
@@ -421,8 +421,8 @@ class MercurySocketIoClient {
421
421
  this.shouldAutoRegisterListeners = should;
422
422
  }
423
423
  on(eventName, cb) {
424
- var _a, _b, _c;
425
424
  return __awaiter(this, void 0, void 0, function* () {
425
+ var _a, _b, _c;
426
426
  this.registeredListeners.push([eventName, cb]);
427
427
  const isLocalEvent = this.isEventLocal(eventName);
428
428
  if (isLocalEvent) {
@@ -498,8 +498,8 @@ class MercurySocketIoClient {
498
498
  return this.id;
499
499
  }
500
500
  disconnect() {
501
- var _a;
502
501
  return __awaiter(this, void 0, void 0, function* () {
502
+ var _a;
503
503
  this.isManuallyDisconnected = true;
504
504
  if (this.isSocketConnected()) {
505
505
  //@ts-ignore
@@ -517,8 +517,8 @@ class MercurySocketIoClient {
517
517
  });
518
518
  }
519
519
  authenticate(options) {
520
- var _a, _b;
521
520
  return __awaiter(this, void 0, void 0, function* () {
521
+ var _a, _b;
522
522
  const { skillId, apiKey, token } = options;
523
523
  if (this.authPromise) {
524
524
  yield this.authPromise;
@@ -88,8 +88,8 @@ class MercuryTestClient extends MutableContractClient {
88
88
  const _super = Object.create(null, {
89
89
  off: { get: () => super.off }
90
90
  });
91
- var _a, _b;
92
91
  return __awaiter(this, void 0, void 0, function* () {
92
+ var _a, _b;
93
93
  yield ((_a = MercuryTestClient.emitter) === null || _a === void 0 ? void 0 : _a.off(eventName, cb));
94
94
  if (((_b = MercuryTestClient.emitter) === null || _b === void 0 ? void 0 : _b.listenCount(eventName)) === 0) {
95
95
  return _super.off.call(this, eventName);
@@ -122,8 +122,8 @@ class MercuryTestClient extends MutableContractClient {
122
122
  const _super = Object.create(null, {
123
123
  emit: { get: () => super.emit }
124
124
  });
125
- var _a, _b, _c, _d, _e;
126
125
  return __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b, _c, _d, _e;
127
127
  const fqen = args[0];
128
128
  try {
129
129
  if (this.shouldHandleEventLocally(fqen)) {
@@ -173,8 +173,8 @@ class MercuryTestClient extends MutableContractClient {
173
173
  return emitter.listenCount(fqen) > 0;
174
174
  }
175
175
  handleEventLocally(args) {
176
- var _a;
177
176
  return __awaiter(this, void 0, void 0, function* () {
177
+ var _a;
178
178
  const emitter = MercuryTestClient.emitter;
179
179
  const fqen = args[0];
180
180
  const payload = args[1];
@@ -249,8 +249,8 @@ class MercuryTestClient extends MutableContractClient {
249
249
  }
250
250
  }
251
251
  optionallyCheckPermissions(args, permissionContractId, fqen) {
252
- var _a;
253
252
  return __awaiter(this, void 0, void 0, function* () {
253
+ var _a;
254
254
  if (!MercuryTestClient.shouldCheckPermissionsOnLocalEvents) {
255
255
  return true;
256
256
  }
@@ -77,8 +77,8 @@ class AbstractClientTest extends AbstractSpruceTest {
77
77
  return client;
78
78
  });
79
79
  }
80
- static loginAsDemoPerson(phone = process.env.DEMO_PHONE) {
81
- return __awaiter(this, void 0, void 0, function* () {
80
+ static loginAsDemoPerson() {
81
+ return __awaiter(this, arguments, void 0, function* (phone = process.env.DEMO_PHONE) {
82
82
  const client = yield this.connectToApi();
83
83
  if (!phone) {
84
84
  throw new SchemaError({
@@ -142,8 +142,8 @@ class AbstractClientTest extends AbstractSpruceTest {
142
142
  });
143
143
  }
144
144
  static seedDemoSkill(client) {
145
- var _a;
146
145
  return __awaiter(this, void 0, void 0, function* () {
146
+ var _a;
147
147
  const skill1Results = yield client.emit('register-skill::v2020_12_25', {
148
148
  payload: {
149
149
  name: `${this.skillName} ${++this.dummySkillCount} ${new Date().getTime() * Math.random()}`,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "41.0.316",
6
+ "version": "41.0.317",
7
7
  "files": [
8
8
  "build"
9
9
  ],
@@ -65,25 +65,25 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@sprucelabs/error": "^5.1.65",
68
- "@sprucelabs/schema": "^29.4.10",
69
- "@sprucelabs/spruce-core-schemas": "^39.0.241",
70
- "@sprucelabs/spruce-event-utils": "^38.0.287",
68
+ "@sprucelabs/schema": "^29.4.11",
69
+ "@sprucelabs/spruce-core-schemas": "^39.0.242",
70
+ "@sprucelabs/spruce-event-utils": "^38.0.288",
71
71
  "dotenv": "^16.4.5",
72
72
  "just-clone": "^6.2.0",
73
73
  "socket.io-client": "^4.7.4"
74
74
  },
75
75
  "devDependencies": {
76
- "@sprucelabs/esm-postbuild": "^5.0.161",
77
- "@sprucelabs/jest-json-reporter": "^7.0.173",
76
+ "@sprucelabs/esm-postbuild": "^5.0.162",
77
+ "@sprucelabs/jest-json-reporter": "^7.0.174",
78
78
  "@sprucelabs/jest-sheets-reporter": "^3.0.26",
79
- "@sprucelabs/mercury-core-events": "^22.2.20",
80
- "@sprucelabs/mercury-event-emitter": "^41.0.316",
81
- "@sprucelabs/mercury-types": "^46.0.243",
79
+ "@sprucelabs/mercury-core-events": "^22.2.21",
80
+ "@sprucelabs/mercury-event-emitter": "^41.0.317",
81
+ "@sprucelabs/mercury-types": "^46.0.244",
82
82
  "@sprucelabs/resolve-path-aliases": "^1.1.283",
83
83
  "@sprucelabs/semantic-release": "^4.0.8",
84
84
  "@sprucelabs/test": "^8.0.41",
85
- "@sprucelabs/test-utils": "^4.0.108",
86
- "@types/node": "^20.11.24",
85
+ "@sprucelabs/test-utils": "^4.0.109",
86
+ "@types/node": "^20.11.25",
87
87
  "chokidar-cli": "^3.0.0",
88
88
  "concurrently": "^8.2.2",
89
89
  "eslint": "^8.57.0",
@@ -127,5 +127,5 @@
127
127
  ]
128
128
  ]
129
129
  },
130
- "gitHead": "dabe2971a7d0a02df233c50a13991be904d0c4c0"
130
+ "gitHead": "71b27295df5d293ce54079677abddead8fc329de"
131
131
  }