@surrealdb/node 2.3.0 → 2.3.1
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/dist/surrealdb-node.darwin-arm64.node +0 -0
- package/dist/surrealdb-node.darwin-x64.node +0 -0
- package/dist/surrealdb-node.linux-arm64-gnu.node +0 -0
- package/dist/surrealdb-node.linux-arm64-musl.node +0 -0
- package/dist/surrealdb-node.linux-x64-gnu.node +0 -0
- package/dist/surrealdb-node.linux-x64-musl.node +0 -0
- package/dist/surrealdb-node.mjs +50 -28
- package/dist/surrealdb-node.win32-arm64-msvc.node +0 -0
- package/dist/surrealdb-node.win32-x64-msvc.node +0 -0
- package/package.json +2 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/surrealdb-node.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function requireNative() {
|
|
|
59
59
|
try {
|
|
60
60
|
const binding = require("@surrealdb/node-android-arm64");
|
|
61
61
|
const bindingPackageVersion = require("@surrealdb/node-android-arm64/package.json").version;
|
|
62
|
-
if (bindingPackageVersion !== "2.3.
|
|
62
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
63
63
|
return binding;
|
|
64
64
|
} catch (e) {
|
|
65
65
|
loadErrors.push(e);
|
|
@@ -73,7 +73,7 @@ function requireNative() {
|
|
|
73
73
|
try {
|
|
74
74
|
const binding = require("@surrealdb/node-android-arm-eabi");
|
|
75
75
|
const bindingPackageVersion = require("@surrealdb/node-android-arm-eabi/package.json").version;
|
|
76
|
-
if (bindingPackageVersion !== "2.3.
|
|
76
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
77
77
|
return binding;
|
|
78
78
|
} catch (e) {
|
|
79
79
|
loadErrors.push(e);
|
|
@@ -88,7 +88,7 @@ function requireNative() {
|
|
|
88
88
|
try {
|
|
89
89
|
const binding = require("@surrealdb/node-win32-x64-msvc");
|
|
90
90
|
const bindingPackageVersion = require("@surrealdb/node-win32-x64-msvc/package.json").version;
|
|
91
|
-
if (bindingPackageVersion !== "2.3.
|
|
91
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
92
92
|
return binding;
|
|
93
93
|
} catch (e) {
|
|
94
94
|
loadErrors.push(e);
|
|
@@ -102,7 +102,7 @@ function requireNative() {
|
|
|
102
102
|
try {
|
|
103
103
|
const binding = require("@surrealdb/node-win32-ia32-msvc");
|
|
104
104
|
const bindingPackageVersion = require("@surrealdb/node-win32-ia32-msvc/package.json").version;
|
|
105
|
-
if (bindingPackageVersion !== "2.3.
|
|
105
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
106
106
|
return binding;
|
|
107
107
|
} catch (e) {
|
|
108
108
|
loadErrors.push(e);
|
|
@@ -116,7 +116,7 @@ function requireNative() {
|
|
|
116
116
|
try {
|
|
117
117
|
const binding = require("@surrealdb/node-win32-arm64-msvc");
|
|
118
118
|
const bindingPackageVersion = require("@surrealdb/node-win32-arm64-msvc/package.json").version;
|
|
119
|
-
if (bindingPackageVersion !== "2.3.
|
|
119
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
120
120
|
return binding;
|
|
121
121
|
} catch (e) {
|
|
122
122
|
loadErrors.push(e);
|
|
@@ -131,7 +131,7 @@ function requireNative() {
|
|
|
131
131
|
try {
|
|
132
132
|
const binding = require("@surrealdb/node-darwin-universal");
|
|
133
133
|
const bindingPackageVersion = require("@surrealdb/node-darwin-universal/package.json").version;
|
|
134
|
-
if (bindingPackageVersion !== "2.3.
|
|
134
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
135
135
|
return binding;
|
|
136
136
|
} catch (e) {
|
|
137
137
|
loadErrors.push(e);
|
|
@@ -145,7 +145,7 @@ function requireNative() {
|
|
|
145
145
|
try {
|
|
146
146
|
const binding = require("@surrealdb/node-darwin-x64");
|
|
147
147
|
const bindingPackageVersion = require("@surrealdb/node-darwin-x64/package.json").version;
|
|
148
|
-
if (bindingPackageVersion !== "2.3.
|
|
148
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
149
149
|
return binding;
|
|
150
150
|
} catch (e) {
|
|
151
151
|
loadErrors.push(e);
|
|
@@ -159,7 +159,7 @@ function requireNative() {
|
|
|
159
159
|
try {
|
|
160
160
|
const binding = require("@surrealdb/node-darwin-arm64");
|
|
161
161
|
const bindingPackageVersion = require("@surrealdb/node-darwin-arm64/package.json").version;
|
|
162
|
-
if (bindingPackageVersion !== "2.3.
|
|
162
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
163
163
|
return binding;
|
|
164
164
|
} catch (e) {
|
|
165
165
|
loadErrors.push(e);
|
|
@@ -174,7 +174,7 @@ function requireNative() {
|
|
|
174
174
|
try {
|
|
175
175
|
const binding = require("@surrealdb/node-freebsd-x64");
|
|
176
176
|
const bindingPackageVersion = require("@surrealdb/node-freebsd-x64/package.json").version;
|
|
177
|
-
if (bindingPackageVersion !== "2.3.
|
|
177
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
178
178
|
return binding;
|
|
179
179
|
} catch (e) {
|
|
180
180
|
loadErrors.push(e);
|
|
@@ -188,7 +188,7 @@ function requireNative() {
|
|
|
188
188
|
try {
|
|
189
189
|
const binding = require("@surrealdb/node-freebsd-arm64");
|
|
190
190
|
const bindingPackageVersion = require("@surrealdb/node-freebsd-arm64/package.json").version;
|
|
191
|
-
if (bindingPackageVersion !== "2.3.
|
|
191
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
192
192
|
return binding;
|
|
193
193
|
} catch (e) {
|
|
194
194
|
loadErrors.push(e);
|
|
@@ -203,7 +203,7 @@ function requireNative() {
|
|
|
203
203
|
try {
|
|
204
204
|
const binding = require("@surrealdb/node-linux-x64-musl");
|
|
205
205
|
const bindingPackageVersion = require("@surrealdb/node-linux-x64-musl/package.json").version;
|
|
206
|
-
if (bindingPackageVersion !== "2.3.
|
|
206
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
207
207
|
return binding;
|
|
208
208
|
} catch (e) {
|
|
209
209
|
loadErrors.push(e);
|
|
@@ -217,7 +217,7 @@ function requireNative() {
|
|
|
217
217
|
try {
|
|
218
218
|
const binding = require("@surrealdb/node-linux-x64-gnu");
|
|
219
219
|
const bindingPackageVersion = require("@surrealdb/node-linux-x64-gnu/package.json").version;
|
|
220
|
-
if (bindingPackageVersion !== "2.3.
|
|
220
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
221
221
|
return binding;
|
|
222
222
|
} catch (e) {
|
|
223
223
|
loadErrors.push(e);
|
|
@@ -232,7 +232,7 @@ function requireNative() {
|
|
|
232
232
|
try {
|
|
233
233
|
const binding = require("@surrealdb/node-linux-arm64-musl");
|
|
234
234
|
const bindingPackageVersion = require("@surrealdb/node-linux-arm64-musl/package.json").version;
|
|
235
|
-
if (bindingPackageVersion !== "2.3.
|
|
235
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
236
236
|
return binding;
|
|
237
237
|
} catch (e) {
|
|
238
238
|
loadErrors.push(e);
|
|
@@ -246,7 +246,7 @@ function requireNative() {
|
|
|
246
246
|
try {
|
|
247
247
|
const binding = require("@surrealdb/node-linux-arm64-gnu");
|
|
248
248
|
const bindingPackageVersion = require("@surrealdb/node-linux-arm64-gnu/package.json").version;
|
|
249
|
-
if (bindingPackageVersion !== "2.3.
|
|
249
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
250
250
|
return binding;
|
|
251
251
|
} catch (e) {
|
|
252
252
|
loadErrors.push(e);
|
|
@@ -261,7 +261,7 @@ function requireNative() {
|
|
|
261
261
|
try {
|
|
262
262
|
const binding = require("@surrealdb/node-linux-arm-musleabihf");
|
|
263
263
|
const bindingPackageVersion = require("@surrealdb/node-linux-arm-musleabihf/package.json").version;
|
|
264
|
-
if (bindingPackageVersion !== "2.3.
|
|
264
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
265
265
|
return binding;
|
|
266
266
|
} catch (e) {
|
|
267
267
|
loadErrors.push(e);
|
|
@@ -275,7 +275,7 @@ function requireNative() {
|
|
|
275
275
|
try {
|
|
276
276
|
const binding = require("@surrealdb/node-linux-arm-gnueabihf");
|
|
277
277
|
const bindingPackageVersion = require("@surrealdb/node-linux-arm-gnueabihf/package.json").version;
|
|
278
|
-
if (bindingPackageVersion !== "2.3.
|
|
278
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
279
279
|
return binding;
|
|
280
280
|
} catch (e) {
|
|
281
281
|
loadErrors.push(e);
|
|
@@ -290,7 +290,7 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require("@surrealdb/node-linux-riscv64-musl");
|
|
292
292
|
const bindingPackageVersion = require("@surrealdb/node-linux-riscv64-musl/package.json").version;
|
|
293
|
-
if (bindingPackageVersion !== "2.3.
|
|
293
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
294
294
|
return binding;
|
|
295
295
|
} catch (e) {
|
|
296
296
|
loadErrors.push(e);
|
|
@@ -304,7 +304,7 @@ function requireNative() {
|
|
|
304
304
|
try {
|
|
305
305
|
const binding = require("@surrealdb/node-linux-riscv64-gnu");
|
|
306
306
|
const bindingPackageVersion = require("@surrealdb/node-linux-riscv64-gnu/package.json").version;
|
|
307
|
-
if (bindingPackageVersion !== "2.3.
|
|
307
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
308
308
|
return binding;
|
|
309
309
|
} catch (e) {
|
|
310
310
|
loadErrors.push(e);
|
|
@@ -319,7 +319,7 @@ function requireNative() {
|
|
|
319
319
|
try {
|
|
320
320
|
const binding = require("@surrealdb/node-linux-ppc64-gnu");
|
|
321
321
|
const bindingPackageVersion = require("@surrealdb/node-linux-ppc64-gnu/package.json").version;
|
|
322
|
-
if (bindingPackageVersion !== "2.3.
|
|
322
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
323
323
|
return binding;
|
|
324
324
|
} catch (e) {
|
|
325
325
|
loadErrors.push(e);
|
|
@@ -333,7 +333,7 @@ function requireNative() {
|
|
|
333
333
|
try {
|
|
334
334
|
const binding = require("@surrealdb/node-linux-s390x-gnu");
|
|
335
335
|
const bindingPackageVersion = require("@surrealdb/node-linux-s390x-gnu/package.json").version;
|
|
336
|
-
if (bindingPackageVersion !== "2.3.
|
|
336
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
337
337
|
return binding;
|
|
338
338
|
} catch (e) {
|
|
339
339
|
loadErrors.push(e);
|
|
@@ -348,7 +348,7 @@ function requireNative() {
|
|
|
348
348
|
try {
|
|
349
349
|
const binding = require("@surrealdb/node-openharmony-arm64");
|
|
350
350
|
const bindingPackageVersion = require("@surrealdb/node-openharmony-arm64/package.json").version;
|
|
351
|
-
if (bindingPackageVersion !== "2.3.
|
|
351
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
352
352
|
return binding;
|
|
353
353
|
} catch (e) {
|
|
354
354
|
loadErrors.push(e);
|
|
@@ -362,7 +362,7 @@ function requireNative() {
|
|
|
362
362
|
try {
|
|
363
363
|
const binding = require("@surrealdb/node-openharmony-x64");
|
|
364
364
|
const bindingPackageVersion = require("@surrealdb/node-openharmony-x64/package.json").version;
|
|
365
|
-
if (bindingPackageVersion !== "2.3.
|
|
365
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
366
366
|
return binding;
|
|
367
367
|
} catch (e) {
|
|
368
368
|
loadErrors.push(e);
|
|
@@ -376,7 +376,7 @@ function requireNative() {
|
|
|
376
376
|
try {
|
|
377
377
|
const binding = require("@surrealdb/node-openharmony-arm");
|
|
378
378
|
const bindingPackageVersion = require("@surrealdb/node-openharmony-arm/package.json").version;
|
|
379
|
-
if (bindingPackageVersion !== "2.3.
|
|
379
|
+
if (bindingPackageVersion !== "2.3.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
380
380
|
return binding;
|
|
381
381
|
} catch (e) {
|
|
382
382
|
loadErrors.push(e);
|
|
@@ -401,7 +401,7 @@ if (!nativeBinding) {
|
|
|
401
401
|
if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
|
|
402
402
|
throw new Error(`Failed to load native binding`);
|
|
403
403
|
}
|
|
404
|
-
const { SurrealNodeEngine } = nativeBinding;
|
|
404
|
+
const { NotificationReceiver, SurrealNodeEngine } = nativeBinding;
|
|
405
405
|
|
|
406
406
|
//#endregion
|
|
407
407
|
//#region src-ts/engine.ts
|
|
@@ -411,9 +411,11 @@ const { SurrealNodeEngine } = nativeBinding;
|
|
|
411
411
|
*/
|
|
412
412
|
var NodeEngine = class extends JsonEngine {
|
|
413
413
|
#engine;
|
|
414
|
+
#notificationReceiver;
|
|
414
415
|
#publisher = new Publisher();
|
|
415
416
|
#subscriptions = new Publisher();
|
|
416
417
|
#active = false;
|
|
418
|
+
#abort;
|
|
417
419
|
#options;
|
|
418
420
|
constructor(context, options) {
|
|
419
421
|
super(context);
|
|
@@ -421,15 +423,20 @@ var NodeEngine = class extends JsonEngine {
|
|
|
421
423
|
}
|
|
422
424
|
open(state) {
|
|
423
425
|
this.#publisher.publish("connecting");
|
|
426
|
+
this.#abort?.abort();
|
|
427
|
+
this.#abort = new AbortController();
|
|
424
428
|
this.#active = true;
|
|
425
429
|
this._state = state;
|
|
426
|
-
this.#initialize(state);
|
|
430
|
+
this.#initialize(state, this.#abort.signal);
|
|
427
431
|
}
|
|
428
432
|
async close() {
|
|
429
433
|
this._state = void 0;
|
|
434
|
+
this.#abort?.abort();
|
|
435
|
+
this.#abort = void 0;
|
|
430
436
|
this.#active = false;
|
|
431
437
|
this.#engine?.free();
|
|
432
438
|
this.#engine = void 0;
|
|
439
|
+
this.#notificationReceiver = void 0;
|
|
433
440
|
this.#publisher.publish("disconnected");
|
|
434
441
|
}
|
|
435
442
|
subscribe(event, listener) {
|
|
@@ -451,17 +458,32 @@ var NodeEngine = class extends JsonEngine {
|
|
|
451
458
|
async send(request) {
|
|
452
459
|
if (!this.#active || !this.#engine) throw new ConnectionUnavailable();
|
|
453
460
|
const id = this._context.uniqueId();
|
|
454
|
-
const payload = this._context.
|
|
461
|
+
const payload = this._context.codecs.cbor.encode({
|
|
455
462
|
id,
|
|
456
463
|
...request
|
|
457
464
|
});
|
|
458
465
|
const response = await this.#engine.execute(payload);
|
|
459
|
-
const result = this._context.
|
|
466
|
+
const result = this._context.codecs.cbor.decode(response);
|
|
460
467
|
return result;
|
|
461
468
|
}
|
|
462
|
-
async #initialize(state) {
|
|
469
|
+
async #initialize(state, signal) {
|
|
463
470
|
try {
|
|
464
471
|
this.#engine = await SurrealNodeEngine.connect(state.url.toString(), this.#options);
|
|
472
|
+
if (signal.aborted) return;
|
|
473
|
+
this.#notificationReceiver = await this.#engine.notifications();
|
|
474
|
+
(async () => {
|
|
475
|
+
while (this.#active && this.#notificationReceiver) {
|
|
476
|
+
const value = await this.#notificationReceiver.recv();
|
|
477
|
+
if (value === null) break;
|
|
478
|
+
const payload = this._context.codecs.cbor.decode(value);
|
|
479
|
+
if (payload.id) this.#subscriptions.publish(payload.id.toString(), {
|
|
480
|
+
queryId: payload.id,
|
|
481
|
+
action: payload.action,
|
|
482
|
+
recordId: payload.record,
|
|
483
|
+
value: payload.result
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
})();
|
|
465
487
|
this.#publisher.publish("connected");
|
|
466
488
|
} catch (err) {
|
|
467
489
|
this.#publisher.publish("error", new UnexpectedConnectionError(err));
|
|
Binary file
|
|
Binary file
|