@dxos/edge-client 0.7.5-main.ff8607b → 0.7.5-staging.2ff1350

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.
@@ -9,9 +9,9 @@ import {
9
9
  export * from "@dxos/protocols/buf/dxos/edge/messenger_pb";
10
10
 
11
11
  // packages/core/mesh/edge-client/src/edge-client.ts
12
- import { Trigger, scheduleMicroTask, TriggerState } from "@dxos/async";
13
- import { Resource as Resource3 } from "@dxos/context";
14
- import { log as log3, logInfo as logInfo2 } from "@dxos/log";
12
+ import { Trigger, scheduleMicroTask, TriggerState, PersistentLifecycle } from "@dxos/async";
13
+ import { Resource as Resource2 } from "@dxos/context";
14
+ import { log as log2, logInfo as logInfo2 } from "@dxos/log";
15
15
 
16
16
  // packages/core/mesh/edge-client/src/edge-identity.ts
17
17
  import { invariant } from "@dxos/invariant";
@@ -68,7 +68,8 @@ function _ts_decorate(decorators, target, key, desc) {
68
68
  return c > 3 && r && Object.defineProperty(target, key, r), r;
69
69
  }
70
70
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-ws-connection.ts";
71
- var SIGNAL_KEEPALIVE_INTERVAL = 5e3;
71
+ var SIGNAL_KEEPALIVE_INTERVAL = 4e3;
72
+ var SIGNAL_KEEPALIVE_TIMEOUT = 12e3;
72
73
  var CLOUDFLARE_MESSAGE_LENGTH_LIMIT = 1024 * 1024;
73
74
  var EdgeWsConnection = class extends Resource {
74
75
  constructor(_identity, _connectionInfo, _callbacks) {
@@ -87,7 +88,7 @@ var EdgeWsConnection = class extends Resource {
87
88
  send(message) {
88
89
  invariant2(this._ws, void 0, {
89
90
  F: __dxlog_file2,
90
- L: 53,
91
+ L: 54,
91
92
  S: this,
92
93
  A: [
93
94
  "this._ws",
@@ -99,7 +100,7 @@ var EdgeWsConnection = class extends Resource {
99
100
  payload: protocol.getPayloadType(message)
100
101
  }, {
101
102
  F: __dxlog_file2,
102
- L: 54,
103
+ L: 55,
103
104
  S: this,
104
105
  C: (f, a) => f(...a)
105
106
  });
@@ -111,7 +112,7 @@ var EdgeWsConnection = class extends Resource {
111
112
  payload: protocol.getPayloadType(message)
112
113
  }, {
113
114
  F: __dxlog_file2,
114
- L: 57,
115
+ L: 58,
115
116
  S: this,
116
117
  C: (f, a) => f(...a)
117
118
  });
@@ -127,7 +128,7 @@ var EdgeWsConnection = class extends Resource {
127
128
  if (this.isOpen) {
128
129
  log("connected", void 0, {
129
130
  F: __dxlog_file2,
130
- L: 75,
131
+ L: 76,
131
132
  S: this,
132
133
  C: (f, a) => f(...a)
133
134
  });
@@ -138,17 +139,20 @@ var EdgeWsConnection = class extends Resource {
138
139
  currentIdentity: this._identity
139
140
  }, {
140
141
  F: __dxlog_file2,
141
- L: 79,
142
+ L: 80,
142
143
  S: this,
143
144
  C: (f, a) => f(...a)
144
145
  });
145
146
  }
146
147
  };
147
- this._ws.onclose = () => {
148
+ this._ws.onclose = (event) => {
148
149
  if (this.isOpen) {
149
- log("disconnected while being open", void 0, {
150
+ log.warn("disconnected while being open", {
151
+ code: event.code,
152
+ reason: event.reason
153
+ }, {
150
154
  F: __dxlog_file2,
151
- L: 84,
155
+ L: 85,
152
156
  S: this,
153
157
  C: (f, a) => f(...a)
154
158
  });
@@ -162,7 +166,7 @@ var EdgeWsConnection = class extends Resource {
162
166
  info: event.message
163
167
  }, {
164
168
  F: __dxlog_file2,
165
- L: 90,
169
+ L: 91,
166
170
  S: this,
167
171
  C: (f, a) => f(...a)
168
172
  });
@@ -172,7 +176,7 @@ var EdgeWsConnection = class extends Resource {
172
176
  error: event.error
173
177
  }, {
174
178
  F: __dxlog_file2,
175
- L: 93,
179
+ L: 94,
176
180
  S: this,
177
181
  C: (f, a) => f(...a)
178
182
  });
@@ -184,7 +188,7 @@ var EdgeWsConnection = class extends Resource {
184
188
  event: event.type
185
189
  }, {
186
190
  F: __dxlog_file2,
187
- L: 101,
191
+ L: 102,
188
192
  S: this,
189
193
  C: (f, a) => f(...a)
190
194
  });
@@ -202,7 +206,7 @@ var EdgeWsConnection = class extends Resource {
202
206
  payload: protocol.getPayloadType(message)
203
207
  }, {
204
208
  F: __dxlog_file2,
205
- L: 111,
209
+ L: 112,
206
210
  S: this,
207
211
  C: (f, a) => f(...a)
208
212
  });
@@ -224,7 +228,7 @@ var EdgeWsConnection = class extends Resource {
224
228
  err
225
229
  }, {
226
230
  F: __dxlog_file2,
227
- L: 127,
231
+ L: 128,
228
232
  S: this,
229
233
  C: (f, a) => f(...a)
230
234
  });
@@ -233,7 +237,7 @@ var EdgeWsConnection = class extends Resource {
233
237
  _scheduleHeartbeats() {
234
238
  invariant2(this._ws, void 0, {
235
239
  F: __dxlog_file2,
236
- L: 132,
240
+ L: 133,
237
241
  S: this,
238
242
  A: [
239
243
  "this._ws",
@@ -253,13 +257,19 @@ var EdgeWsConnection = class extends Resource {
253
257
  void this._inactivityTimeoutCtx?.dispose();
254
258
  this._inactivityTimeoutCtx = new Context(void 0, {
255
259
  F: __dxlog_file2,
256
- L: 151
260
+ L: 152
257
261
  });
258
262
  scheduleTask(this._inactivityTimeoutCtx, () => {
259
263
  if (this.isOpen) {
264
+ log.warn("restart due to inactivity timeout", void 0, {
265
+ F: __dxlog_file2,
266
+ L: 157,
267
+ S: this,
268
+ C: (f, a) => f(...a)
269
+ });
260
270
  this._callbacks.onRestartRequired();
261
271
  }
262
- }, 2 * SIGNAL_KEEPALIVE_INTERVAL);
272
+ }, SIGNAL_KEEPALIVE_TIMEOUT);
263
273
  }
264
274
  };
265
275
  _ts_decorate([
@@ -278,118 +288,6 @@ var EdgeIdentityChangedError = class extends Error {
278
288
  }
279
289
  };
280
290
 
281
- // packages/core/mesh/edge-client/src/persistent-lifecycle.ts
282
- import { DeferredTask, sleep, synchronized } from "@dxos/async";
283
- import { cancelWithContext, LifecycleState, Resource as Resource2 } from "@dxos/context";
284
- import { warnAfterTimeout } from "@dxos/debug";
285
- import { log as log2 } from "@dxos/log";
286
- function _ts_decorate2(decorators, target, key, desc) {
287
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
288
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
289
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
290
- return c > 3 && r && Object.defineProperty(target, key, r), r;
291
- }
292
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/persistent-lifecycle.ts";
293
- var INIT_RESTART_DELAY = 100;
294
- var DEFAULT_MAX_RESTART_DELAY = 5e3;
295
- var PersistentLifecycle = class extends Resource2 {
296
- constructor({ start, stop, onRestart, maxRestartDelay = DEFAULT_MAX_RESTART_DELAY }) {
297
- super();
298
- this._currentContext = void 0;
299
- this._restartTask = void 0;
300
- this._restartAfter = 0;
301
- this._start = start;
302
- this._stop = stop;
303
- this._onRestart = onRestart;
304
- this._maxRestartDelay = maxRestartDelay;
305
- }
306
- async _open() {
307
- this._restartTask = new DeferredTask(this._ctx, async () => {
308
- try {
309
- await this._restart();
310
- } catch (err) {
311
- log2.warn("Restart failed", {
312
- err
313
- }, {
314
- F: __dxlog_file3,
315
- L: 65,
316
- S: this,
317
- C: (f, a) => f(...a)
318
- });
319
- this._restartTask?.schedule();
320
- }
321
- });
322
- this._currentContext = await this._start().catch((err) => {
323
- log2.warn("Start failed", {
324
- err
325
- }, {
326
- F: __dxlog_file3,
327
- L: 70,
328
- S: this,
329
- C: (f, a) => f(...a)
330
- });
331
- this._restartTask?.schedule();
332
- return void 0;
333
- });
334
- }
335
- async _close() {
336
- await this._restartTask?.join();
337
- await this._stopCurrentContext();
338
- this._restartTask = void 0;
339
- }
340
- async _restart() {
341
- log2(`restarting in ${this._restartAfter}ms`, {
342
- state: this._lifecycleState
343
- }, {
344
- F: __dxlog_file3,
345
- L: 83,
346
- S: this,
347
- C: (f, a) => f(...a)
348
- });
349
- await this._stopCurrentContext();
350
- if (this._lifecycleState !== LifecycleState.OPEN) {
351
- return;
352
- }
353
- await cancelWithContext(this._ctx, sleep(this._restartAfter));
354
- this._restartAfter = Math.min(Math.max(this._restartAfter * 2, INIT_RESTART_DELAY), this._maxRestartDelay);
355
- await warnAfterTimeout(5e3, "Connection establishment takes too long", async () => {
356
- this._currentContext = await this._start();
357
- });
358
- this._restartAfter = 0;
359
- await this._onRestart?.();
360
- }
361
- async _stopCurrentContext() {
362
- if (this._currentContext) {
363
- try {
364
- await this._stop(this._currentContext);
365
- } catch (err) {
366
- log2.catch(err, void 0, {
367
- F: __dxlog_file3,
368
- L: 105,
369
- S: this,
370
- C: (f, a) => f(...a)
371
- });
372
- }
373
- this._currentContext = void 0;
374
- }
375
- }
376
- /**
377
- * Scheduling restart should be done from outside.
378
- */
379
- scheduleRestart() {
380
- if (this._lifecycleState !== LifecycleState.OPEN) {
381
- return;
382
- }
383
- this._restartTask.schedule();
384
- }
385
- };
386
- _ts_decorate2([
387
- synchronized
388
- ], PersistentLifecycle.prototype, "_open", null);
389
- _ts_decorate2([
390
- synchronized
391
- ], PersistentLifecycle.prototype, "scheduleRestart", null);
392
-
393
291
  // packages/core/mesh/edge-client/src/utils.ts
394
292
  var getEdgeUrlWithProtocol = (baseUrl, protocol2) => {
395
293
  const isSecure = baseUrl.startsWith("https") || baseUrl.startsWith("wss");
@@ -399,15 +297,15 @@ var getEdgeUrlWithProtocol = (baseUrl, protocol2) => {
399
297
  };
400
298
 
401
299
  // packages/core/mesh/edge-client/src/edge-client.ts
402
- function _ts_decorate3(decorators, target, key, desc) {
300
+ function _ts_decorate2(decorators, target, key, desc) {
403
301
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
404
302
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
405
303
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
406
304
  return c > 3 && r && Object.defineProperty(target, key, r), r;
407
305
  }
408
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-client.ts";
306
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-client.ts";
409
307
  var DEFAULT_TIMEOUT = 1e4;
410
- var EdgeClient = class extends Resource3 {
308
+ var EdgeClient = class extends Resource2 {
411
309
  constructor(_identity, _config) {
412
310
  super();
413
311
  this._identity = _identity;
@@ -442,12 +340,12 @@ var EdgeClient = class extends Resource3 {
442
340
  }
443
341
  setIdentity(identity) {
444
342
  if (identity.identityKey !== this._identity.identityKey || identity.peerKey !== this._identity.peerKey) {
445
- log3("Edge identity changed", {
343
+ log2("Edge identity changed", {
446
344
  identity,
447
345
  oldIdentity: this._identity
448
346
  }, {
449
- F: __dxlog_file4,
450
- L: 95,
347
+ F: __dxlog_file3,
348
+ L: 94,
451
349
  S: this,
452
350
  C: (f, a) => f(...a)
453
351
  });
@@ -468,9 +366,9 @@ var EdgeClient = class extends Resource3 {
468
366
  try {
469
367
  listener();
470
368
  } catch (error) {
471
- log3.catch(error, void 0, {
472
- F: __dxlog_file4,
473
- L: 117,
369
+ log2.catch(error, void 0, {
370
+ F: __dxlog_file3,
371
+ L: 116,
474
372
  S: this,
475
373
  C: (f, a) => f(...a)
476
374
  });
@@ -484,20 +382,20 @@ var EdgeClient = class extends Resource3 {
484
382
  * Open connection to messaging service.
485
383
  */
486
384
  async _open() {
487
- log3("opening...", {
385
+ log2("opening...", {
488
386
  info: this.info
489
387
  }, {
490
- F: __dxlog_file4,
491
- L: 129,
388
+ F: __dxlog_file3,
389
+ L: 128,
492
390
  S: this,
493
391
  C: (f, a) => f(...a)
494
392
  });
495
393
  this._persistentLifecycle.open().catch((err) => {
496
- log3.warn("Error while opening connection", {
394
+ log2.warn("Error while opening connection", {
497
395
  err
498
396
  }, {
499
- F: __dxlog_file4,
500
- L: 131,
397
+ F: __dxlog_file3,
398
+ L: 130,
501
399
  S: this,
502
400
  C: (f, a) => f(...a)
503
401
  });
@@ -507,11 +405,11 @@ var EdgeClient = class extends Resource3 {
507
405
  * Close connection and free resources.
508
406
  */
509
407
  async _close() {
510
- log3("closing...", {
408
+ log2("closing...", {
511
409
  peerKey: this._identity.peerKey
512
410
  }, {
513
- F: __dxlog_file4,
514
- L: 139,
411
+ F: __dxlog_file3,
412
+ L: 138,
515
413
  S: this,
516
414
  C: (f, a) => f(...a)
517
415
  });
@@ -526,9 +424,9 @@ var EdgeClient = class extends Resource3 {
526
424
  const path = `/ws/${identity.identityKey}/${identity.peerKey}`;
527
425
  const protocolHeader = this._config.disableAuth ? void 0 : await this._createAuthHeader(path);
528
426
  if (this._identity !== identity) {
529
- log3("identity changed during auth header request", void 0, {
530
- F: __dxlog_file4,
531
- L: 153,
427
+ log2("identity changed during auth header request", void 0, {
428
+ F: __dxlog_file3,
429
+ L: 152,
532
430
  S: this,
533
431
  C: (f, a) => f(...a)
534
432
  });
@@ -536,12 +434,12 @@ var EdgeClient = class extends Resource3 {
536
434
  }
537
435
  const restartRequired = new Trigger();
538
436
  const url = new URL(path, this._baseWsUrl);
539
- log3("Opening websocket", {
437
+ log2("Opening websocket", {
540
438
  url: url.toString(),
541
439
  protocolHeader
542
440
  }, {
543
- F: __dxlog_file4,
544
- L: 159,
441
+ F: __dxlog_file3,
442
+ L: 158,
545
443
  S: this,
546
444
  C: (f, a) => f(...a)
547
445
  });
@@ -554,9 +452,9 @@ var EdgeClient = class extends Resource3 {
554
452
  this._ready.wake();
555
453
  this._notifyReconnected();
556
454
  } else {
557
- log3.verbose("connected callback ignored, because connection is not active", void 0, {
558
- F: __dxlog_file4,
559
- L: 169,
455
+ log2.verbose("connected callback ignored, because connection is not active", void 0, {
456
+ F: __dxlog_file3,
457
+ L: 168,
560
458
  S: this,
561
459
  C: (f, a) => f(...a)
562
460
  });
@@ -567,9 +465,9 @@ var EdgeClient = class extends Resource3 {
567
465
  this._closeCurrentConnection();
568
466
  this._persistentLifecycle.scheduleRestart();
569
467
  } else {
570
- log3.verbose("restart requested by inactive connection", void 0, {
571
- F: __dxlog_file4,
572
- L: 177,
468
+ log2.verbose("restart requested by inactive connection", void 0, {
469
+ F: __dxlog_file3,
470
+ L: 176,
573
471
  S: this,
574
472
  C: (f, a) => f(...a)
575
473
  });
@@ -580,12 +478,12 @@ var EdgeClient = class extends Resource3 {
580
478
  if (this._isActive(connection)) {
581
479
  this._notifyMessageReceived(message);
582
480
  } else {
583
- log3.verbose("ignored a message on inactive connection", {
481
+ log2.verbose("ignored a message on inactive connection", {
584
482
  from: message.source,
585
483
  type: message.payload?.typeUrl
586
484
  }, {
587
- F: __dxlog_file4,
588
- L: 185,
485
+ F: __dxlog_file3,
486
+ L: 184,
589
487
  S: this,
590
488
  C: (f, a) => f(...a)
591
489
  });
@@ -615,11 +513,11 @@ var EdgeClient = class extends Resource3 {
615
513
  try {
616
514
  listener();
617
515
  } catch (err) {
618
- log3.error("ws reconnect listener failed", {
516
+ log2.error("ws reconnect listener failed", {
619
517
  err
620
518
  }, {
621
- F: __dxlog_file4,
622
- L: 218,
519
+ F: __dxlog_file3,
520
+ L: 217,
623
521
  S: this,
624
522
  C: (f, a) => f(...a)
625
523
  });
@@ -631,12 +529,12 @@ var EdgeClient = class extends Resource3 {
631
529
  try {
632
530
  listener(message);
633
531
  } catch (err) {
634
- log3.error("ws incoming message processing failed", {
532
+ log2.error("ws incoming message processing failed", {
635
533
  err,
636
534
  payload: protocol.getPayloadType(message)
637
535
  }, {
638
- F: __dxlog_file4,
639
- L: 228,
536
+ F: __dxlog_file3,
537
+ L: 227,
640
538
  S: this,
641
539
  C: (f, a) => f(...a)
642
540
  });
@@ -649,9 +547,9 @@ var EdgeClient = class extends Resource3 {
649
547
  */
650
548
  async send(message) {
651
549
  if (this._ready.state !== TriggerState.RESOLVED) {
652
- log3("waiting for websocket to become ready", void 0, {
653
- F: __dxlog_file4,
654
- L: 239,
550
+ log2("waiting for websocket to become ready", void 0, {
551
+ F: __dxlog_file3,
552
+ L: 238,
655
553
  S: this,
656
554
  C: (f, a) => f(...a)
657
555
  });
@@ -676,12 +574,12 @@ var EdgeClient = class extends Resource3 {
676
574
  if (response.status === 401) {
677
575
  return encodePresentationWsAuthHeader(await handleAuthChallenge(response, this._identity));
678
576
  } else {
679
- log3.warn("no auth challenge from edge", {
577
+ log2.warn("no auth challenge from edge", {
680
578
  status: response.status,
681
579
  statusText: response.statusText
682
580
  }, {
683
- F: __dxlog_file4,
684
- L: 264,
581
+ F: __dxlog_file3,
582
+ L: 263,
685
583
  S: this,
686
584
  C: (f, a) => f(...a)
687
585
  });
@@ -689,7 +587,7 @@ var EdgeClient = class extends Resource3 {
689
587
  }
690
588
  }
691
589
  };
692
- _ts_decorate3([
590
+ _ts_decorate2([
693
591
  logInfo2
694
592
  ], EdgeClient.prototype, "info", null);
695
593
  var encodePresentationWsAuthHeader = (encodedPresentation) => {
@@ -702,7 +600,7 @@ import { createCredential, signPresentation } from "@dxos/credentials";
702
600
  import { invariant as invariant3 } from "@dxos/invariant";
703
601
  import { Keyring } from "@dxos/keyring";
704
602
  import { PublicKey } from "@dxos/keys";
705
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/auth.ts";
603
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/auth.ts";
706
604
  var createDeviceEdgeIdentity = async (signer, key) => {
707
605
  return {
708
606
  identityKey: key.toHex(),
@@ -747,7 +645,7 @@ var createChainEdgeIdentity = async (signer, identityKey, peerKey, chain, creden
747
645
  peerKey: peerKey.toHex(),
748
646
  presentCredentials: async ({ challenge }) => {
749
647
  invariant3(chain, void 0, {
750
- F: __dxlog_file5,
648
+ F: __dxlog_file4,
751
649
  L: 75,
752
650
  S: void 0,
753
651
  A: [
@@ -809,26 +707,29 @@ var createStubEdgeIdentity = () => {
809
707
  };
810
708
 
811
709
  // packages/core/mesh/edge-client/src/edge-http-client.ts
812
- import { sleep as sleep2 } from "@dxos/async";
710
+ import { sleep } from "@dxos/async";
813
711
  import { Context as Context2 } from "@dxos/context";
814
- import { log as log4 } from "@dxos/log";
712
+ import { log as log3 } from "@dxos/log";
815
713
  import { EdgeCallFailedError, EdgeAuthChallengeError } from "@dxos/protocols";
816
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-http-client.ts";
714
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/edge-http-client.ts";
817
715
  var DEFAULT_RETRY_TIMEOUT = 1500;
818
716
  var DEFAULT_RETRY_JITTER = 500;
819
717
  var DEFAULT_MAX_RETRIES_COUNT = 3;
820
718
  var EdgeHttpClient = class {
821
719
  constructor(baseUrl) {
822
720
  this._baseUrl = getEdgeUrlWithProtocol(baseUrl, "http");
823
- log4("created", {
721
+ log3("created", {
824
722
  url: this._baseUrl
825
723
  }, {
826
- F: __dxlog_file6,
827
- L: 44,
724
+ F: __dxlog_file5,
725
+ L: 49,
828
726
  S: this,
829
727
  C: (f, a) => f(...a)
830
728
  });
831
729
  }
730
+ get baseUrl() {
731
+ return this._baseUrl;
732
+ }
832
733
  setIdentity(identity) {
833
734
  if (this._edgeIdentity?.identityKey !== identity.identityKey || this._edgeIdentity?.peerKey !== identity.peerKey) {
834
735
  this._edgeIdentity = identity;
@@ -875,6 +776,13 @@ var EdgeHttpClient = class {
875
776
  method: "POST"
876
777
  });
877
778
  }
779
+ async executeWorkflow(spaceId, graphId, input, args) {
780
+ return this._call(`/workflows/${spaceId}/${graphId}`, {
781
+ ...args,
782
+ body: input,
783
+ method: "POST"
784
+ });
785
+ }
878
786
  async uploadFunction(pathParts, body, args) {
879
787
  const path = [
880
788
  "functions",
@@ -889,20 +797,68 @@ var EdgeHttpClient = class {
889
797
  method: "PUT"
890
798
  });
891
799
  }
800
+ async queryQueue(subspaceTag, spaceId, query, args) {
801
+ const { queueId } = query;
802
+ const queryParams = new URLSearchParams();
803
+ if (query.after != null) {
804
+ queryParams.set("after", query.after);
805
+ }
806
+ if (query.before != null) {
807
+ queryParams.set("before", query.before);
808
+ }
809
+ if (query.limit != null) {
810
+ queryParams.set("limit", query.limit.toString());
811
+ }
812
+ if (query.reverse != null) {
813
+ queryParams.set("reverse", query.reverse.toString());
814
+ }
815
+ if (query.objectIds != null) {
816
+ queryParams.set("objectIds", query.objectIds.join(","));
817
+ }
818
+ return this._call(`/spaces/${subspaceTag}/${spaceId}/queue/${queueId}/query?${queryParams.toString()}`, {
819
+ ...args,
820
+ method: "GET"
821
+ });
822
+ }
823
+ async insertIntoQueue(subspaceTag, spaceId, queueId, objects, args) {
824
+ return this._call(`/spaces/${subspaceTag}/${spaceId}/queue/${queueId}`, {
825
+ ...args,
826
+ body: {
827
+ objects
828
+ },
829
+ method: "POST"
830
+ });
831
+ }
832
+ async deleteFromQueue(subspaceTag, spaceId, queueId, objectIds, args) {
833
+ return this._call(`/spaces/${subspaceTag}/${spaceId}/queue/${queueId}`, {
834
+ ...args,
835
+ query: {
836
+ ids: objectIds.join(",")
837
+ },
838
+ method: "DELETE"
839
+ });
840
+ }
892
841
  async _call(path, args) {
893
842
  const requestContext = args.context ?? new Context2(void 0, {
894
- F: __dxlog_file6,
895
- L: 102
843
+ F: __dxlog_file5,
844
+ L: 177
896
845
  });
897
846
  const shouldRetry = createRetryHandler(args);
898
- const url = `${this._baseUrl}${path.startsWith("/") ? path.slice(1) : path}`;
899
- log4.info("call", {
847
+ let url = `${this._baseUrl}${path.startsWith("/") ? path.slice(1) : path}`;
848
+ if (args.query) {
849
+ const queryParams = new URLSearchParams();
850
+ for (const [key, value] of Object.entries(args.query)) {
851
+ queryParams.set(key, value.toString());
852
+ }
853
+ url += `?${queryParams.toString()}`;
854
+ }
855
+ log3("call", {
900
856
  method: args.method,
901
857
  path,
902
858
  request: args.body
903
859
  }, {
904
- F: __dxlog_file6,
905
- L: 106,
860
+ F: __dxlog_file5,
861
+ L: 189,
906
862
  S: this,
907
863
  C: (f, a) => f(...a)
908
864
  });
@@ -920,12 +876,12 @@ var EdgeHttpClient = class {
920
876
  if (body.success) {
921
877
  return body.data;
922
878
  }
923
- log4.info("unsuccessful edge response", {
879
+ log3("unsuccessful edge response", {
924
880
  path,
925
881
  body
926
882
  }, {
927
- F: __dxlog_file6,
928
- L: 125,
883
+ F: __dxlog_file5,
884
+ L: 208,
929
885
  S: this,
930
886
  C: (f, a) => f(...a)
931
887
  });
@@ -945,12 +901,12 @@ var EdgeHttpClient = class {
945
901
  processingError = EdgeCallFailedError.fromProcessingFailureCause(error);
946
902
  }
947
903
  if (processingError.isRetryable && await shouldRetry(requestContext, retryAfterHeaderValue)) {
948
- log4.info("retrying edge request", {
904
+ log3("retrying edge request", {
949
905
  path,
950
906
  processingError
951
907
  }, {
952
- F: __dxlog_file6,
953
- L: 144,
908
+ F: __dxlog_file5,
909
+ L: 227,
954
910
  S: this,
955
911
  C: (f, a) => f(...a)
956
912
  });
@@ -961,9 +917,9 @@ var EdgeHttpClient = class {
961
917
  }
962
918
  async _handleUnauthorized(response) {
963
919
  if (!this._edgeIdentity) {
964
- log4.warn("edge unauthorized response received before identity was set", void 0, {
965
- F: __dxlog_file6,
966
- L: 153,
920
+ log3.warn("edge unauthorized response received before identity was set", void 0, {
921
+ F: __dxlog_file5,
922
+ L: 236,
967
923
  S: this,
968
924
  C: (f, a) => f(...a)
969
925
  });
@@ -971,9 +927,9 @@ var EdgeHttpClient = class {
971
927
  }
972
928
  const challenge = await handleAuthChallenge(response, this._edgeIdentity);
973
929
  this._authHeader = encodeAuthHeader(challenge);
974
- log4("auth header updated", void 0, {
975
- F: __dxlog_file6,
976
- L: 158,
930
+ log3("auth header updated", void 0, {
931
+ F: __dxlog_file5,
932
+ L: 241,
977
933
  S: this,
978
934
  C: (f, a) => f(...a)
979
935
  });
@@ -993,10 +949,10 @@ var createRetryHandler = (args) => {
993
949
  return false;
994
950
  }
995
951
  if (retryAfter) {
996
- await sleep2(retryAfter);
952
+ await sleep(retryAfter);
997
953
  } else {
998
954
  const timeout = baseTimeout + Math.random() * jitter;
999
- await sleep2(timeout);
955
+ await sleep(timeout);
1000
956
  }
1001
957
  return true;
1002
958
  };