@dxos/functions-runtime-cloudflare 0.8.4-main.e00bdcdb52 → 0.8.4-main.effb148878

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.
@@ -5,6 +5,9 @@ import { Resource as Resource2 } from "@dxos/context";
5
5
  import { EchoClient } from "@dxos/echo-db";
6
6
  import { invariant as invariant3 } from "@dxos/invariant";
7
7
 
8
+ // src/internal/service-container.ts
9
+ import { EchoURI } from "@dxos/keys";
10
+
8
11
  // src/internal/data-service-impl.ts
9
12
  import { Stream } from "@dxos/codec-protobuf/stream";
10
13
  import { raise } from "@dxos/debug";
@@ -17,7 +20,7 @@ import { log } from "@dxos/log";
17
20
  var copyUint8Array = (value) => new Uint8Array(value);
18
21
 
19
22
  // src/internal/data-service-impl.ts
20
- var __dxlog_file = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/data-service-impl.ts";
23
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/internal/data-service-impl.ts";
21
24
  function _ts_add_disposable_resource(env, value, async) {
22
25
  if (value !== null && value !== void 0) {
23
26
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -180,6 +183,9 @@ var DataServiceImpl = class {
180
183
  }));
181
184
  try {
182
185
  for (const update of updates ?? []) {
186
+ if (!update.mutation) {
187
+ continue;
188
+ }
183
189
  await this._dataService.changeDocument(this._executionContext, sub.spaceId, update.documentId, update.mutation);
184
190
  }
185
191
  } catch (error) {
@@ -210,7 +216,7 @@ var DataServiceImpl = class {
210
216
  });
211
217
  }
212
218
  async updateIndexes() {
213
- log.error("updateIndexes is not available in EDGE env.", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 206, S: this });
219
+ log.verbose("updateIndexes called, but it is a no-op in EDGE env.", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 211, S: this });
214
220
  }
215
221
  async waitUntilHeadsReplicated({ heads: _heads }) {
216
222
  throw new NotImplementedError({
@@ -223,7 +229,7 @@ var DataServiceImpl = class {
223
229
  import { Stream as Stream2 } from "@dxos/codec-protobuf/stream";
224
230
  import { NotImplementedError as NotImplementedError2, RuntimeServiceError as RuntimeServiceError2 } from "@dxos/errors";
225
231
  import { log as log2 } from "@dxos/log";
226
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/query-service-impl.ts";
232
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/internal/query-service-impl.ts";
227
233
  function _ts_add_disposable_resource2(env, value, async) {
228
234
  if (value !== null && value !== void 0) {
229
235
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -515,6 +521,11 @@ var QueueServiceImpl = class {
515
521
  }
516
522
  async syncQueue(_) {
517
523
  }
524
+ async getSyncState(_) {
525
+ return {
526
+ namespaces: []
527
+ };
528
+ }
518
529
  };
519
530
 
520
531
  // src/internal/service-container.ts
@@ -625,15 +636,14 @@ var ServiceContainer = class {
625
636
  };
626
637
  }
627
638
  async queryQueue(queue) {
628
- const parts = queue.asQueueDXN();
629
- if (!parts) {
630
- throw new Error("Invalid queue DXN");
639
+ const spaceId = EchoURI.getSpaceId(queue);
640
+ const queueId = EchoURI.getObjectId(queue);
641
+ if (!spaceId || !queueId) {
642
+ throw new Error("Invalid queue EchoURI");
631
643
  }
632
- const { subspaceTag, spaceId, queueId } = parts;
633
644
  const result = await this._queueService.queryQueue(this._executionContext, {
634
645
  query: {
635
646
  spaceId,
636
- queuesNamespace: subspaceTag,
637
647
  queueIds: [
638
648
  queueId
639
649
  ]
@@ -646,13 +656,13 @@ var ServiceContainer = class {
646
656
  };
647
657
  }
648
658
  async insertIntoQueue(queue, objects) {
649
- const parts = queue.asQueueDXN();
650
- if (!parts) {
651
- throw new Error("Invalid queue DXN");
659
+ const spaceId = EchoURI.getSpaceId(queue);
660
+ const queueId = EchoURI.getObjectId(queue);
661
+ if (!spaceId || !queueId) {
662
+ throw new Error("Invalid queue EchoURI");
652
663
  }
653
- const { subspaceTag, spaceId, queueId } = parts;
654
664
  await this._queueService.insertIntoQueue(this._executionContext, {
655
- subspaceTag,
665
+ subspaceTag: "data",
656
666
  spaceId,
657
667
  queueId,
658
668
  objects: objects.map((obj) => JSON.stringify(obj))
@@ -666,8 +676,6 @@ import { invariant as invariant2 } from "@dxos/invariant";
666
676
  import { PublicKey } from "@dxos/keys";
667
677
 
668
678
  // src/queues-api.ts
669
- import { log as log3 } from "@dxos/log";
670
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/queues-api.ts";
671
679
  var QueuesAPIImpl = class {
672
680
  _serviceContainer;
673
681
  _spaceId;
@@ -675,26 +683,8 @@ var QueuesAPIImpl = class {
675
683
  this._serviceContainer = _serviceContainer;
676
684
  this._spaceId = _spaceId;
677
685
  }
678
- async queryQueue(queue, options) {
679
- const result = await this._serviceContainer.queryQueue(queue);
680
- const objects = (result.objects ?? []).flatMap((encoded) => {
681
- try {
682
- return [
683
- JSON.parse(encoded)
684
- ];
685
- } catch (err) {
686
- log3.verbose("queue object JSON parse failed; object ignored", {
687
- encoded,
688
- error: err
689
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 22, S: this });
690
- return [];
691
- }
692
- });
693
- return {
694
- objects,
695
- nextCursor: result.nextCursor ?? null,
696
- prevCursor: result.prevCursor ?? null
697
- };
686
+ queryQueue(queue, options) {
687
+ return this._serviceContainer.queryQueue(queue);
698
688
  }
699
689
  insertIntoQueue(queue, objects) {
700
690
  return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));
@@ -702,7 +692,7 @@ var QueuesAPIImpl = class {
702
692
  };
703
693
 
704
694
  // src/space-proxy.ts
705
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/space-proxy.ts";
695
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/space-proxy.ts";
706
696
  var SpaceProxy = class extends Resource {
707
697
  _serviceContainer;
708
698
  _echoClient;
@@ -717,14 +707,14 @@ var SpaceProxy = class extends Resource {
717
707
  return this._id;
718
708
  }
719
709
  get db() {
720
- invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 24, S: this, A: ["this._db", ""] });
710
+ invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 24, S: this, A: ["this._db", ""] });
721
711
  return this._db;
722
712
  }
723
713
  /**
724
714
  * @deprecated Use db API.
725
715
  */
726
716
  get crud() {
727
- invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 30, S: this, A: ["this._db", ""] });
717
+ invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 30, S: this, A: ["this._db", ""] });
728
718
  return this._db.coreDatabase;
729
719
  }
730
720
  get queues() {
@@ -748,7 +738,7 @@ var SpaceProxy = class extends Resource {
748
738
  };
749
739
 
750
740
  // src/functions-client.ts
751
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/functions-client.ts";
741
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/functions-client.ts";
752
742
  var FunctionsClient = class extends Resource2 {
753
743
  _serviceContainer;
754
744
  _echoClient;
@@ -756,8 +746,8 @@ var FunctionsClient = class extends Resource2 {
756
746
  _spaces = /* @__PURE__ */ new Map();
757
747
  constructor(services) {
758
748
  super();
759
- invariant3(typeof services.dataService !== "undefined", "DataService is required", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 19, S: this, A: ["typeof services.dataService !== 'undefined'", "'DataService is required'"] });
760
- invariant3(typeof services.queueService !== "undefined", "QueueService is required", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 20, S: this, A: ["typeof services.queueService !== 'undefined'", "'QueueService is required'"] });
749
+ invariant3(typeof services.dataService !== "undefined", "DataService is required", { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 19, S: this, A: ["typeof services.dataService !== 'undefined'", "'DataService is required'"] });
750
+ invariant3(typeof services.queueService !== "undefined", "QueueService is required", { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 20, S: this, A: ["typeof services.queueService !== 'undefined'", "'QueueService is required'"] });
761
751
  this._serviceContainer = new ServiceContainer(this._executionContext, services.dataService, services.queueService, services.functionsAiService);
762
752
  this._echoClient = new EchoClient({});
763
753
  }
@@ -809,9 +799,9 @@ var FunctionRouteValue = /* @__PURE__ */ (function(FunctionRouteValue2) {
809
799
  // src/wrap-handler-for-cloudflare.ts
810
800
  import { invariant as invariant4 } from "@dxos/invariant";
811
801
  import { SpaceId as SpaceId2 } from "@dxos/keys";
812
- import { log as log4 } from "@dxos/log";
802
+ import { log as log3 } from "@dxos/log";
813
803
  import { EdgeResponse } from "@dxos/protocols";
814
- var __dxlog_file6 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
804
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
815
805
  var wrapHandlerForCloudflare = (func) => {
816
806
  return async (request, env) => {
817
807
  if (request.headers.get(FUNCTION_ROUTE_HEADER) === FunctionRouteValue.Meta) {
@@ -833,10 +823,10 @@ var wrapHandlerForCloudflare = (func) => {
833
823
  });
834
824
  return EdgeResponse.success(await invokeFunction(func, context, request));
835
825
  } catch (error) {
836
- log4.error("error invoking function", {
826
+ log3.error("error invoking function", {
837
827
  error,
838
828
  stack: error.stack
839
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 37, S: void 0 });
829
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 37, S: void 0 });
840
830
  return EdgeResponse.failure({
841
831
  message: error?.message ?? "Internal error",
842
832
  error
@@ -869,7 +859,7 @@ var decodeRequest = async (request) => {
869
859
  }
870
860
  };
871
861
  } catch (err) {
872
- log4.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 76, S: void 0 });
862
+ log3.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 76, S: void 0 });
873
863
  return {
874
864
  data: {
875
865
  bodyText,
@@ -902,7 +892,7 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
902
892
  throw new Error(`Space not found: ${contextSpaceId}`);
903
893
  }
904
894
  spaceKey = meta.spaceKey;
905
- invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 109, S: void 0, A: ["!meta.rootDocumentId.startsWith('automerge:')", ""] });
895
+ invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 109, S: void 0, A: ["!meta.rootDocumentId.startsWith('automerge:')", ""] });
906
896
  rootUrl = `automerge:${meta.rootDocumentId}`;
907
897
  }
908
898
  return {
@@ -919,10 +909,10 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
919
909
  };
920
910
 
921
911
  // src/logger.ts
922
- import { LogLevel, log as log5, shouldLog } from "@dxos/log";
912
+ import { LogLevel, log as log4, shouldLog } from "@dxos/log";
923
913
  var setupFunctionsLogger = () => {
924
- log5.runtimeConfig.processors.length = 0;
925
- log5.runtimeConfig.processors.push(functionLogProcessor);
914
+ log4.runtimeConfig.processors.length = 0;
915
+ log4.runtimeConfig.processors.push(functionLogProcessor);
926
916
  };
927
917
  var functionLogProcessor = (config, entry) => {
928
918
  if (!shouldLog(entry, config.filters)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/functions-client.ts", "../../../src/internal/data-service-impl.ts", "../../../src/internal/utils.ts", "../../../src/internal/query-service-impl.ts", "../../../src/internal/queue-service-impl.ts", "../../../src/internal/service-container.ts", "../../../src/space-proxy.ts", "../../../src/queues-api.ts", "../../../src/types.ts", "../../../src/wrap-handler-for-cloudflare.ts", "../../../src/logger.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Resource } from '@dxos/context';\nimport { EchoClient } from '@dxos/echo-db';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceId } from '@dxos/keys';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\n\nimport { ServiceContainer } from './internal';\nimport { SpaceProxy } from './space-proxy';\n\ntype Services = {\n dataService: EdgeFunctionEnv.DataService;\n queueService: EdgeFunctionEnv.QueueService;\n functionsAiService: EdgeFunctionEnv.FunctionsAiService;\n};\n\n/**\n * API for functions to integrate with ECHO and HALO.\n * @deprecated\n */\nexport class FunctionsClient extends Resource {\n private readonly _serviceContainer;\n private readonly _echoClient;\n private readonly _executionContext: EdgeFunctionEnv.TraceContext = {};\n\n private readonly _spaces = new Map<SpaceId, SpaceProxy>();\n\n constructor(services: Services) {\n super();\n invariant(typeof services.dataService !== 'undefined', 'DataService is required');\n invariant(typeof services.queueService !== 'undefined', 'QueueService is required');\n this._serviceContainer = new ServiceContainer(\n this._executionContext,\n services.dataService,\n services.queueService,\n services.functionsAiService,\n );\n this._echoClient = new EchoClient({});\n }\n\n get echo(): EchoClient {\n return this._echoClient;\n }\n\n protected override async _open() {\n const { dataService, queryService } = await this._serviceContainer.createServices();\n this._echoClient.connectToService({ dataService, queryService });\n await this._echoClient.open();\n }\n\n protected override async _close() {\n for (const space of this._spaces.values()) {\n await space.close();\n }\n this._spaces.clear();\n\n await this._echoClient.close();\n }\n\n async getSpace(spaceId: SpaceId): Promise<SpaceProxy> {\n if (!this._spaces.has(spaceId)) {\n const space = new SpaceProxy(this._serviceContainer, this._echoClient, spaceId);\n this._spaces.set(spaceId, space);\n }\n const space = this._spaces.get(spaceId)!;\n await space.open(); // No-op if already open.\n return space;\n }\n}\n\nexport const createClientFromEnv = async (env: any): Promise<FunctionsClient> => {\n const client = new FunctionsClient({\n dataService: env.DATA_SERVICE,\n queueService: env.QUEUE_SERVICE,\n functionsAiService: env.FUNCTIONS_AI_SERVICE,\n });\n await client.open();\n return client;\n};\n\n/**\n - Provides data access capabilities for user functions.\n - No real-time replication or reactive queries -- function receives a snapshot.\n - Function event contains the metadata but doesn't need to include the data.\n */\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { RequestOptions } from '@dxos/codec-protobuf';\nimport { Stream } from '@dxos/codec-protobuf/stream';\nimport { raise } from '@dxos/debug';\nimport { NotImplementedError, RuntimeServiceError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\nimport type {\n BatchedDocumentUpdates,\n CreateDocumentRequest,\n CreateDocumentResponse,\n DataService as DataServiceProto,\n GetDocumentHeadsRequest,\n GetDocumentHeadsResponse,\n GetSpaceSyncStateRequest,\n ReIndexHeadsRequest,\n SpaceSyncState,\n UpdateRequest,\n UpdateSubscriptionRequest,\n} from '@dxos/protocols/proto/dxos/echo/service';\n\nimport { copyUint8Array } from './utils';\n\nexport class DataServiceImpl implements DataServiceProto {\n private dataSubscriptions = new Map<string, { spaceId: SpaceId; next: (msg: BatchedDocumentUpdates) => void }>();\n\n constructor(\n private _executionContext: EdgeFunctionEnv.TraceContext,\n private _dataService: EdgeFunctionEnv.DataService,\n ) {}\n\n subscribe({ subscriptionId, spaceId }: { subscriptionId: string; spaceId: string }): Stream<BatchedDocumentUpdates> {\n return new Stream(({ next }) => {\n invariant(SpaceId.isValid(spaceId));\n this.dataSubscriptions.set(subscriptionId, { spaceId, next });\n\n return () => {\n this.dataSubscriptions.delete(subscriptionId);\n };\n });\n }\n\n async updateSubscription({ subscriptionId, addIds }: UpdateSubscriptionRequest): Promise<void> {\n const sub =\n this.dataSubscriptions.get(subscriptionId) ??\n raise(\n new RuntimeServiceError({\n message: 'Subscription not found.',\n context: { subscriptionId },\n }),\n );\n\n if (addIds) {\n log.info('request documents', { count: addIds.length });\n // TODO(dmaretskyi): Batch.\n for (const documentId of addIds) {\n using document = await this._dataService.getDocument(this._executionContext, sub.spaceId, documentId);\n log.info('document loaded', { documentId, spaceId: sub.spaceId, found: !!document });\n if (!document) {\n log.warn('not found', { documentId });\n continue;\n }\n sub.next({\n updates: [\n {\n documentId,\n // Copy returned object to avoid hanging RPC stub\n // See https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/\n mutation: copyUint8Array(document.data),\n },\n ],\n });\n }\n }\n }\n\n async createDocument({ spaceId, initialValue }: CreateDocumentRequest): Promise<CreateDocumentResponse> {\n invariant(SpaceId.isValid(spaceId));\n using response = await this._dataService.createDocument(this._executionContext, spaceId, initialValue);\n return { documentId: response.documentId };\n }\n\n async update({ updates, subscriptionId }: UpdateRequest): Promise<void> {\n const sub =\n this.dataSubscriptions.get(subscriptionId) ??\n raise(\n new RuntimeServiceError({\n message: 'Subscription not found.',\n context: { subscriptionId },\n }),\n );\n // TODO(dmaretskyi): Batch.\n try {\n for (const update of updates ?? []) {\n await this._dataService.changeDocument(this._executionContext, sub.spaceId, update.documentId, update.mutation);\n }\n } catch (error) {\n throw RuntimeServiceError.wrap({\n message: 'Failed to apply document updates.',\n context: { subscriptionId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async flush(): Promise<void> {\n // No-op.\n }\n\n subscribeSpaceSyncState(_request: GetSpaceSyncStateRequest, _options?: RequestOptions): Stream<SpaceSyncState> {\n throw new NotImplementedError({\n message: 'subscribeSpaceSyncState is not implemented.',\n });\n }\n\n async getDocumentHeads({ documentIds: _documentIds }: GetDocumentHeadsRequest): Promise<GetDocumentHeadsResponse> {\n throw new NotImplementedError({\n message: 'getDocumentHeads is not implemented.',\n });\n }\n\n async reIndexHeads({ documentIds: _documentIds }: ReIndexHeadsRequest): Promise<void> {\n throw new NotImplementedError({\n message: 'reIndexHeads is not implemented.',\n });\n }\n\n async updateIndexes(): Promise<void> {\n log.error('updateIndexes is not available in EDGE env.');\n // No-op.\n }\n\n async waitUntilHeadsReplicated({ heads: _heads }: { heads: any }): Promise<void> {\n throw new NotImplementedError({\n message: 'waitUntilHeadsReplicated is not implemented.',\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport const copyUint8Array = (value: Uint8Array): Uint8Array => new Uint8Array(value);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Stream } from '@dxos/codec-protobuf/stream';\nimport { NotImplementedError, RuntimeServiceError } from '@dxos/errors';\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\nimport { type QueryRequest, type QueryResponse, type QueryService } from '@dxos/protocols/proto/dxos/echo/query';\n\nexport class QueryServiceImpl implements QueryService {\n private _queryCount = 0;\n\n constructor(\n private readonly _executionContext: EdgeFunctionEnv.TraceContext,\n private readonly _dataService: EdgeFunctionEnv.DataService,\n ) {}\n\n execQuery(request: QueryRequest): Stream<QueryResponse> {\n log.info('execQuery', { request });\n\n return Stream.fromPromise<QueryResponse>(\n (async () => {\n try {\n this._queryCount++;\n log.info('begin query', { request });\n using queryResponse = await this._dataService.execQuery(this._executionContext, request);\n log.info('query response', { resultCount: queryResponse.results?.length });\n return structuredClone(queryResponse);\n } catch (error) {\n log.error('query failed', { err: error });\n throw new RuntimeServiceError({\n message: `Query execution failed (queryCount=${this._queryCount})`,\n context: { queryCount: this._queryCount },\n cause: error,\n });\n }\n })(),\n );\n }\n\n async reindex() {\n throw new NotImplementedError({\n message: 'Reindex is not implemented.',\n });\n }\n\n async setConfig() {\n throw new NotImplementedError({\n message: 'SetConfig is not implemented.',\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RuntimeServiceError } from '@dxos/errors';\nimport { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';\n\nexport class QueueServiceImpl implements FeedProtocol.QueueService {\n constructor(\n protected _ctx: EdgeFunctionEnv.TraceContext,\n private readonly _queueService: EdgeFunctionEnv.QueueService,\n ) {}\n\n async queryQueue(request: FeedProtocol.QueryQueueRequest): Promise<FeedProtocol.QueryResult> {\n try {\n using result = await this._queueService.queryQueue(this._ctx, request);\n // Copy to avoid hanging RPC stub (Workers RPC lifecycle).\n return {\n objects: structuredClone(result.objects),\n nextCursor: result.nextCursor,\n prevCursor: result.prevCursor,\n };\n } catch (error) {\n const { query } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue query failed.',\n context: {\n subspaceTag: query?.queuesNamespace,\n spaceId: query?.spaceId,\n queueId: query?.queueIds?.[0],\n },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async insertIntoQueue(request: FeedProtocol.InsertIntoQueueRequest): Promise<void> {\n try {\n using _ = await this._queueService.insertIntoQueue(this._ctx, request);\n } catch (error) {\n const { subspaceTag, spaceId, queueId } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue append failed.',\n context: { subspaceTag, spaceId, queueId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async deleteFromQueue(request: FeedProtocol.DeleteFromQueueRequest): Promise<void> {\n try {\n using _ = await this._queueService.deleteFromQueue(this._ctx, request);\n } catch (error) {\n const { subspaceTag, spaceId, queueId } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue delete failed.',\n context: { subspaceTag, spaceId, queueId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async syncQueue(_: FeedProtocol.SyncQueueRequest): Promise<void> {\n // No-op in Cloudflare runtime.\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type AnyEntity } from '@dxos/echo/internal';\nimport { type DXN, type SpaceId } from '@dxos/keys';\nimport { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';\nimport { type QueryService as QueryServiceProto } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService as DataServiceProto } from '@dxos/protocols/proto/dxos/echo/service';\n\nimport { DataServiceImpl } from './data-service-impl';\nimport { QueryServiceImpl } from './query-service-impl';\nimport { QueueServiceImpl } from './queue-service-impl';\n\n/**\n * TODO: make this implement DataService and QueryService to unify API over edge and web backend\n */\nexport class ServiceContainer {\n constructor(\n private readonly _executionContext: EdgeFunctionEnv.TraceContext,\n private readonly _dataService: EdgeFunctionEnv.DataService,\n private readonly _queueService: EdgeFunctionEnv.QueueService,\n private readonly _functionsService: EdgeFunctionEnv.FunctionsAiService,\n ) {}\n\n async getSpaceMeta(spaceId: SpaceId): Promise<EdgeFunctionEnv.SpaceMeta | undefined> {\n using result = await this._dataService.getSpaceMeta(this._executionContext, spaceId);\n // Copy returned object to avoid hanging RPC stub\n // See https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/\n return result\n ? {\n spaceKey: result.spaceKey,\n rootDocumentId: result.rootDocumentId,\n }\n : undefined;\n }\n\n async createServices(): Promise<{\n dataService: DataServiceProto;\n queryService: QueryServiceProto;\n queueService: FeedProtocol.QueueService;\n functionsAiService: EdgeFunctionEnv.FunctionsAiService;\n }> {\n const dataService = new DataServiceImpl(this._executionContext, this._dataService);\n const queryService = new QueryServiceImpl(this._executionContext, this._dataService);\n const queueService = new QueueServiceImpl(this._executionContext, this._queueService);\n\n return {\n dataService,\n queryService,\n queueService,\n functionsAiService: this._functionsService,\n };\n }\n\n async queryQueue(queue: DXN): Promise<FeedProtocol.QueryResult> {\n const parts = queue.asQueueDXN();\n if (!parts) {\n throw new Error('Invalid queue DXN');\n }\n const { subspaceTag, spaceId, queueId } = parts;\n const result = await this._queueService.queryQueue(this._executionContext, {\n query: {\n spaceId,\n queuesNamespace: subspaceTag,\n queueIds: [queueId],\n },\n });\n return {\n objects: structuredClone(result.objects),\n nextCursor: result.nextCursor ?? null,\n prevCursor: result.prevCursor ?? null,\n };\n }\n\n async insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void> {\n const parts = queue.asQueueDXN();\n if (!parts) {\n throw new Error('Invalid queue DXN');\n }\n const { subspaceTag, spaceId, queueId } = parts;\n await this._queueService.insertIntoQueue(this._executionContext, {\n subspaceTag,\n spaceId,\n queueId,\n objects: objects.map((obj) => JSON.stringify(obj)),\n });\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Resource } from '@dxos/context';\nimport { type Database } from '@dxos/echo';\nimport { type CoreDatabase, type EchoClient, type EchoDatabaseImpl } from '@dxos/echo-db';\nimport { invariant } from '@dxos/invariant';\nimport { PublicKey, type SpaceId } from '@dxos/keys';\n\nimport type { ServiceContainer } from './internal';\nimport { type QueuesAPI, QueuesAPIImpl } from './queues-api';\n\n/**\n * @deprecated\n */\nexport class SpaceProxy extends Resource {\n private _db?: EchoDatabaseImpl = undefined;\n private _queuesApi: QueuesAPIImpl;\n\n constructor(\n private readonly _serviceContainer: ServiceContainer,\n private readonly _echoClient: EchoClient,\n private readonly _id: SpaceId,\n ) {\n super();\n this._queuesApi = new QueuesAPIImpl(this._serviceContainer, this._id);\n }\n\n get id(): SpaceId {\n return this._id;\n }\n\n get db(): Database.Database {\n invariant(this._db);\n return this._db;\n }\n\n /**\n * @deprecated Use db API.\n */\n get crud(): CoreDatabase {\n invariant(this._db);\n return this._db.coreDatabase;\n }\n\n get queues(): QueuesAPI {\n return this._queuesApi;\n }\n\n protected override async _open() {\n const meta = await this._serviceContainer.getSpaceMeta(this._id);\n if (!meta) {\n throw new Error(`Space not found: ${this._id}`);\n }\n\n this._db = this._echoClient.constructDatabase({\n spaceId: this._id,\n spaceKey: PublicKey.from(meta.spaceKey),\n reactiveSchemaQuery: false,\n owningObject: this,\n });\n\n await this._db.coreDatabase.open(this._ctx, { rootUrl: meta.rootDocumentId });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AnyEntity } from '@dxos/echo/internal';\nimport type { DXN, SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\n\nimport type { ServiceContainer } from './internal';\n\nexport interface QueuesQueryResult {\n objects: AnyEntity[];\n nextCursor: string | null;\n prevCursor: string | null;\n}\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\n/**\n * @deprecated\n */\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueuesQueryResult>;\n insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void>;\n}\n\n/**\n * @deprecated\n */\nexport class QueuesAPIImpl implements QueuesAPI {\n constructor(\n private readonly _serviceContainer: ServiceContainer,\n private readonly _spaceId: SpaceId,\n ) {}\n\n async queryQueue(queue: DXN, options?: {}): Promise<QueuesQueryResult> {\n const result = await this._serviceContainer.queryQueue(queue);\n const objects = (result.objects ?? []).flatMap((encoded): AnyEntity[] => {\n try {\n return [JSON.parse(encoded) as AnyEntity];\n } catch (err) {\n log.verbose('queue object JSON parse failed; object ignored', { encoded, error: err });\n return [];\n }\n });\n return {\n objects,\n nextCursor: result.nextCursor ?? null,\n prevCursor: result.prevCursor ?? null,\n };\n }\n\n insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void> {\n // TODO(dmaretskyi): Ugly.\n return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { JsonSchemaType } from '@dxos/echo/internal';\n\n/**\n * Is used for to route the request to the metadata handler instead of the main handler.\n */\nexport const FUNCTION_ROUTE_HEADER = 'X-DXOS-Function-Route';\n\nexport enum FunctionRouteValue {\n Meta = 'meta',\n}\n\nexport type FunctionMetadata = {\n /**\n * FQN.\n */\n key: string;\n /**\n * Human-readable name.\n */\n name?: string;\n\n /**\n * Description.\n */\n description?: string;\n\n /**\n * Input schema.\n */\n inputSchema?: JsonSchemaType;\n\n /**\n * Output schema.\n */\n outputSchema?: JsonSchemaType;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { JsonSchemaType } from '@dxos/echo/internal';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { EdgeResponse } from '@dxos/protocols';\nimport type { EdgeFunctionEnv, FunctionProtocol } from '@dxos/protocols';\n\nimport { ServiceContainer } from './internal';\nimport { FUNCTION_ROUTE_HEADER, type FunctionMetadata, FunctionRouteValue } from './types';\n\n/**\n * Wraps a user function in a Cloudflare-compatible handler.\n */\nexport const wrapHandlerForCloudflare = (func: FunctionProtocol.Func): ExportedHandlerFetchHandler<any> => {\n return async (request: Request, env: EdgeFunctionEnv.Env): Promise<Response> => {\n // TODO(dmaretskyi): Should theÓ scope name reflect the function name?\n // TODO(mykola): Wrap in withCleanAutomergeWasmState;\n // TODO(mykola): Wrap in withNewExecutionContext;\n // Meta route is used to get the input schema of the function by the functions service.\n if (request.headers.get(FUNCTION_ROUTE_HEADER) === FunctionRouteValue.Meta) {\n return handleFunctionMetaCall(func, request);\n }\n\n try {\n const spaceId = new URL(request.url).searchParams.get('spaceId');\n if (spaceId) {\n if (!SpaceId.isValid(spaceId)) {\n return new Response('Invalid spaceId', { status: 400 });\n }\n }\n\n const serviceContainer = new ServiceContainer({}, env.DATA_SERVICE, env.QUEUE_SERVICE, env.FUNCTIONS_AI_SERVICE);\n const context = await createFunctionContext({\n serviceContainer,\n contextSpaceId: spaceId as SpaceId | undefined,\n });\n\n return EdgeResponse.success(await invokeFunction(func, context, request));\n } catch (error: any) {\n log.error('error invoking function', { error, stack: error.stack });\n return EdgeResponse.failure({\n message: error?.message ?? 'Internal error',\n error,\n });\n }\n };\n};\n\nconst invokeFunction = async (func: FunctionProtocol.Func, context: FunctionProtocol.Context, request: Request) => {\n // TODO(dmaretskyi): For some reason requests get wrapped like this.\n const { data } = await decodeRequest(request);\n\n return func.handler({\n context,\n data,\n });\n};\n\nconst decodeRequest = async (request: Request) => {\n const {\n data: { bodyText, ...rest },\n trigger,\n } = (await request.json()) as any;\n\n if (!bodyText) {\n return { data: rest, trigger };\n }\n\n // Webhook passed body as bodyText. Use it as function input if a well-formatted JSON\n // TODO: better trigger input mapping\n try {\n const data = JSON.parse(bodyText);\n return { data, trigger: { ...trigger, ...rest } };\n } catch (err) {\n log.catch(err);\n return { data: { bodyText, ...rest } };\n }\n};\n\nconst handleFunctionMetaCall = (functionDefinition: FunctionProtocol.Func, request: Request): Response => {\n const response: FunctionMetadata = {\n key: functionDefinition.meta.key,\n name: functionDefinition.meta.name,\n description: functionDefinition.meta.description,\n inputSchema: functionDefinition.meta.inputSchema as JsonSchemaType | undefined,\n outputSchema: functionDefinition.meta.outputSchema as JsonSchemaType | undefined,\n };\n\n return new Response(JSON.stringify(response), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n\nexport const createFunctionContext = async ({\n serviceContainer,\n contextSpaceId,\n}: {\n serviceContainer: ServiceContainer;\n contextSpaceId: SpaceId | undefined;\n}): Promise<FunctionProtocol.Context> => {\n const { dataService, queryService, queueService, functionsAiService } = await serviceContainer.createServices();\n\n let spaceKey: string | undefined;\n let rootUrl: string | undefined;\n if (contextSpaceId) {\n const meta = await serviceContainer.getSpaceMeta(contextSpaceId);\n if (!meta) {\n throw new Error(`Space not found: ${contextSpaceId}`);\n }\n spaceKey = meta.spaceKey;\n invariant(!meta.rootDocumentId.startsWith('automerge:'));\n rootUrl = `automerge:${meta.rootDocumentId}`;\n }\n\n return {\n services: {\n dataService,\n queryService,\n queueService,\n functionsAiService,\n },\n spaceId: contextSpaceId,\n spaceKey,\n spaceRootUrl: rootUrl,\n } as any; // TODO(dmaretskyi): Link and fix before merging\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/* eslint-disable no-console */\n\nimport { LogLevel, type LogProcessor, log, shouldLog } from '@dxos/log';\n\nexport const setupFunctionsLogger = () => {\n log.runtimeConfig.processors.length = 0;\n log.runtimeConfig.processors.push(functionLogProcessor);\n};\n\nconst functionLogProcessor: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const context = entry.computedContext;\n const error = entry.computedError;\n const extras = [Object.keys(context).length > 0 ? context : undefined, error].filter((value) => value !== undefined);\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n case LogLevel.TRACE:\n console.debug(entry.message, ...extras);\n break;\n case LogLevel.VERBOSE:\n console.log(entry.message, ...extras);\n break;\n case LogLevel.INFO:\n console.info(entry.message, ...extras);\n break;\n case LogLevel.WARN:\n console.warn(entry.message, ...extras);\n break;\n case LogLevel.ERROR:\n console.error(entry.message, ...extras);\n break;\n default:\n console.log(entry.message, ...extras);\n break;\n }\n};\n"],
5
- "mappings": ";;;AAIA,SAASA,YAAAA,iBAAgB;AACzB,SAASC,kBAAkB;AAC3B,SAASC,aAAAA,kBAAiB;;;ACA1B,SAASC,cAAa;AACtB,SAASC,aAAAA;AACT,SAASC,qBAAiB,2BAAkB;AAC5C,SAASC,iBAAe;AACxB,SAASC,eAAW;AAgBpB,SAASC,WAAAA;;;ACtBF,IAAMC,iBAAiB,CAACC,UAAkC,IAAIC,WAAWD,KAAAA;;;ADJhF,IAAE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKF;;;EAwBUE;EAER,oBACUC,oBAAAA,IAAAA;cAAAA,mBAAAA,cAAAA;SACAC,oBAAAA;AACP,SAAA,eAAA;EAEHC;YACE,EAAO,gBAAcC,QAAM,GAAA;WACzBC,IAAAA,OAAUC,CAAAA,EAAAA,KAAQC,MAAQC;AAC1B,gBAAKR,QAAAA,QAAqB,OAACS,GAAAA,QAAAA,EAAgB,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,4BAAA,EAAA,EAAA,CAAA;WAAED,kBAAAA,IAAAA,gBAAAA;QAASJ;QAAK;MAE3D,CAAA;aACE,MAAKJ;AACP,aAAA,kBAAA,OAAA,cAAA;MACF;IACF,CAAA;EAEA;QACE,mBACOA,EAAAA,gBAAsBS,OAAAA,GAAAA;UAGvBC,MAAAA,KAAS,kBAAA,IAAA,cAAA,KAAA,MAAA,IAAA,oBAAA;MACTC,SAAS;eAAEF;QAAe;MAC5B;IAGJ,CAAA,CAAA;QACEG,QAAQ;UAAwBC,KAAAA,q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AA;;;cAGH+B;MACAC;MACAC;MACF;MACA9B;IACAwB;IACAO,SAAAA;IACQ;IACV,cAAA;;;;;AC7HF,SAASC,UAA6BC,OAAAA,MAAKC,iBAAiB;AAI1DC,IAAIC,uBAAyBC,MAAKC;AAClC,EAAAH,KAAA,cAAA,WAAA,SAAA;AAEF,EAAAA,KAAMG,cAAAA,WAAsCC,KAAQC,oBAAAA;;2BAEhD,CAAA,QAAA,UAAA;AACF,MAAA,CAAA,UAAA,OAAA,OAAA,OAAA,GAAA;AAEA;EACA;AACA,QAAMC,UAAS,MAAA;QAACC,QAAOC,MAAKC;QAA2CC,SAAAA;IAAOC,OAAQC,KAAAA,OAAUA,EAAAA,SAAUC,IAAAA,UAAAA;IAE1G;WACOC,CAAAA,UAASC,UAAK,MAAA;UACnB,MAAKD,OAASE;SACZC,SAAQC;SACR,SAAA;AACF,cAAKJ,MAASK,MAAO,SAAA,GAAA,MAAA;AACnBF;SACA,SAAA;AACF,cAAKH,IAASM,MAAI,SAAA,GAAA,MAAA;AAChBH;SACA,SAAA;AACF,cAAKH,KAASO,MAAI,SAAA,GAAA,MAAA;AAChBJ;SACA,SAAA;AACF,cAAKH,KAASQ,MAAK,SAAA,GAAA,MAAA;AACjBL;SACA,SAAA;AACF,cAAA,MAAA,MAAA,SAAA,GAAA,MAAA;AACEA;;AAEJ,cAAA,IAAA,MAAA,SAAA,GAAA,MAAA;AACF;;;",
6
- "names": ["Resource", "EchoClient", "invariant", "raise", "NotImplementedError", "invariant", "SpaceId", "log", "copyUint8Array", "copyUint8Array", "value", "Uint8Array", "dataSubscriptions", "_executionContext", "_dataService", "subscribe", "next", "invariant", "SpaceId", "isValid", "spaceId", "subscriptionId", "message", "context", "log", "count", "info", "documentId", "found", "document", "sub", "updates", "response", "createDocument", "initialValue", "get", "changeDocument", "RuntimeServiceError", "ifTypeDiffers", "error", "subscribeSpaceSyncState", "NotImplementedError", "NotImplementedError", "log", "RuntimeServiceError", "QueryServiceImpl", "__dxlog_file", "_queryCount", "_executionContext", "_dataService", "execQuery", "info", "request", "fromPromise", "Stream", "queryResponse", "_ts_add_disposable_resource", "resultCount", "structuredClone", "error", "err", "message", "context", "queryCount", "cause", "RuntimeServiceError", "QueueServiceImpl", "_ctx", "_queueService", "queryQueue", "request", "result", "objects", "structuredClone", "nextCursor", "prevCursor", "error", "query", "wrap", "message", "context", "subspaceTag", "queuesNamespace", "spaceId", "queueId", "queueIds", "ifTypeDiffers", "insertIntoQueue", "_", "deleteFromQueue", "syncQueue", "ServiceContainer", "_executionContext", "_dataService", "_queueService", "_functionsService", "getSpaceMeta", "spaceId", "result", "spaceKey", "rootDocumentId", "undefined", "createServices", "dataService", "DataServiceImpl", "queryService", "QueryServiceImpl", "queueService", "QueueServiceImpl", "functionsAiService", "queryQueue", "queue", "parts", "asQueueDXN", "Error", "subspaceTag", "queueId", "query", "queuesNamespace", "queueIds", "objects", "structuredClone", "nextCursor", "prevCursor", "insertIntoQueue", "map", "obj", "JSON", "stringify", "Resource", "invariant", "PublicKey", "log", "__dxlog_file", "_spaceId", "queryQueue", "queue", "objects", "result", "err", "encoded", "error", "nextCursor", "prevCursor", "insertIntoQueue", "_serviceContainer", "__dxlog_file", "_db", "_queuesApi", "QueuesAPIImpl", "_serviceContainer", "id", "db", "invariant", "queues", "_open", "meta", "Error", "_echoClient", "constructDatabase", "spaceKey", "PublicKey", "reactiveSchemaQuery", "owningObject", "coreDatabase", "__dxlog_file", "_echoClient", "Resource", "_executionContext", "_spaces", "invariant", "services", "_serviceContainer", "ServiceContainer", "dataService", "queueService", "functionsAiService", "EchoClient", "echo", "_open", "queryService", "_close", "space", "clear", "getSpace", "spaceId", "set", "DATA_SERVICE", "env", "FUNCTION_ROUTE_HEADER", "FunctionRouteValue", "invariant", "SpaceId", "log", "EdgeResponse", "__dxlog_file", "SpaceId", "isValid", "spaceId", "status", "serviceContainer", "contextSpaceId", "success", "log", "error", "stack", "EdgeResponse", "message", "decodeRequest", "request", "context", "data", "rest", "trigger", "functionDefinition", "meta", "name", "description", "inputSchema", "outputSchema", "Response", "response", "spaceKey", "rootUrl", "Error", "invariant", "queryService", "queueService", "functionsAiService", "spaceRootUrl", "LogLevel", "log", "shouldLog", "log", "runtimeConfig", "push", "functionLogProcessor", "config", "entry", "extras", "Object", "keys", "context", "error", "filter", "value", "undefined", "LogLevel", "DEBUG", "TRACE", "console", "debug", "VERBOSE", "INFO", "WARN", "ERROR"]
3
+ "sources": ["../../../src/functions-client.ts", "../../../src/internal/service-container.ts", "../../../src/internal/data-service-impl.ts", "../../../src/internal/utils.ts", "../../../src/internal/query-service-impl.ts", "../../../src/internal/queue-service-impl.ts", "../../../src/space-proxy.ts", "../../../src/queues-api.ts", "../../../src/types.ts", "../../../src/wrap-handler-for-cloudflare.ts", "../../../src/logger.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Resource } from '@dxos/context';\nimport { EchoClient } from '@dxos/echo-db';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceId } from '@dxos/keys';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\n\nimport { ServiceContainer } from './internal';\nimport { SpaceProxy } from './space-proxy';\n\ntype Services = {\n dataService: EdgeFunctionEnv.DataService;\n queueService: EdgeFunctionEnv.QueueService;\n functionsAiService: EdgeFunctionEnv.FunctionsAiService;\n};\n\n/**\n * API for functions to integrate with ECHO and HALO.\n * @deprecated\n */\nexport class FunctionsClient extends Resource {\n private readonly _serviceContainer;\n private readonly _echoClient;\n private readonly _executionContext: EdgeFunctionEnv.TraceContext = {};\n\n private readonly _spaces = new Map<SpaceId, SpaceProxy>();\n\n constructor(services: Services) {\n super();\n invariant(typeof services.dataService !== 'undefined', 'DataService is required');\n invariant(typeof services.queueService !== 'undefined', 'QueueService is required');\n this._serviceContainer = new ServiceContainer(\n this._executionContext,\n services.dataService,\n services.queueService,\n services.functionsAiService,\n );\n this._echoClient = new EchoClient({});\n }\n\n get echo(): EchoClient {\n return this._echoClient;\n }\n\n protected override async _open() {\n const { dataService, queryService } = await this._serviceContainer.createServices();\n this._echoClient.connectToService({ dataService, queryService });\n await this._echoClient.open();\n }\n\n protected override async _close() {\n for (const space of this._spaces.values()) {\n await space.close();\n }\n this._spaces.clear();\n\n await this._echoClient.close();\n }\n\n async getSpace(spaceId: SpaceId): Promise<SpaceProxy> {\n if (!this._spaces.has(spaceId)) {\n const space = new SpaceProxy(this._serviceContainer, this._echoClient, spaceId);\n this._spaces.set(spaceId, space);\n }\n const space = this._spaces.get(spaceId)!;\n await space.open(); // No-op if already open.\n return space;\n }\n}\n\nexport const createClientFromEnv = async (env: any): Promise<FunctionsClient> => {\n const client = new FunctionsClient({\n dataService: env.DATA_SERVICE,\n queueService: env.QUEUE_SERVICE,\n functionsAiService: env.FUNCTIONS_AI_SERVICE,\n });\n await client.open();\n return client;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type AnyEntity } from '@dxos/echo/internal';\nimport { EchoURI, type SpaceId } from '@dxos/keys';\nimport { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';\nimport { type QueryService as QueryServiceProto } from '@dxos/protocols/proto/dxos/echo/query';\nimport { type DataService as DataServiceProto } from '@dxos/protocols/proto/dxos/echo/service';\n\nimport { DataServiceImpl } from './data-service-impl';\nimport { QueryServiceImpl } from './query-service-impl';\nimport { QueueServiceImpl } from './queue-service-impl';\n\n/**\n * TODO: make this implement DataService and QueryService to unify API over edge and web backend\n */\nexport class ServiceContainer {\n constructor(\n private readonly _executionContext: EdgeFunctionEnv.TraceContext,\n private readonly _dataService: EdgeFunctionEnv.DataService,\n private readonly _queueService: EdgeFunctionEnv.QueueService,\n private readonly _functionsService: EdgeFunctionEnv.FunctionsAiService,\n ) {}\n\n async getSpaceMeta(spaceId: SpaceId): Promise<EdgeFunctionEnv.SpaceMeta | undefined> {\n using result = await this._dataService.getSpaceMeta(this._executionContext, spaceId);\n // Copy returned object to avoid hanging RPC stub\n // See https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/\n return result\n ? {\n spaceKey: result.spaceKey,\n rootDocumentId: result.rootDocumentId,\n }\n : undefined;\n }\n\n async createServices(): Promise<{\n dataService: DataServiceProto;\n queryService: QueryServiceProto;\n queueService: FeedProtocol.QueueService;\n functionsAiService: EdgeFunctionEnv.FunctionsAiService;\n }> {\n const dataService = new DataServiceImpl(this._executionContext, this._dataService);\n const queryService = new QueryServiceImpl(this._executionContext, this._dataService);\n const queueService = new QueueServiceImpl(this._executionContext, this._queueService);\n\n return {\n dataService,\n queryService,\n queueService,\n functionsAiService: this._functionsService,\n };\n }\n\n async queryQueue(queue: EchoURI.EchoURI): Promise<FeedProtocol.QueryResult> {\n const spaceId = EchoURI.getSpaceId(queue);\n const queueId = EchoURI.getObjectId(queue);\n if (!spaceId || !queueId) {\n throw new Error('Invalid queue EchoURI');\n }\n const result = await this._queueService.queryQueue(this._executionContext, {\n query: {\n spaceId,\n queueIds: [queueId],\n },\n });\n\n return {\n objects: structuredClone(result.objects),\n nextCursor: result.nextCursor ?? null,\n prevCursor: result.prevCursor ?? null,\n };\n }\n\n async insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void> {\n const spaceId = EchoURI.getSpaceId(queue);\n const queueId = EchoURI.getObjectId(queue);\n if (!spaceId || !queueId) {\n throw new Error('Invalid queue EchoURI');\n }\n // TODO(dmaretskyi): EchoURI does not encode the subspaceTag — defaulting to 'data'.\n await this._queueService.insertIntoQueue(this._executionContext, {\n subspaceTag: 'data',\n spaceId,\n queueId,\n objects: objects.map((obj) => JSON.stringify(obj)),\n });\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { RequestOptions } from '@dxos/codec-protobuf';\nimport { Stream } from '@dxos/codec-protobuf/stream';\nimport { raise } from '@dxos/debug';\nimport { NotImplementedError, RuntimeServiceError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\nimport type {\n BatchedDocumentUpdates,\n CreateDocumentRequest,\n CreateDocumentResponse,\n DataService as DataServiceProto,\n GetDocumentHeadsRequest,\n GetDocumentHeadsResponse,\n GetSpaceSyncStateRequest,\n ReIndexHeadsRequest,\n SpaceSyncState,\n UpdateRequest,\n UpdateSubscriptionRequest,\n} from '@dxos/protocols/proto/dxos/echo/service';\n\nimport { copyUint8Array } from './utils';\n\nexport class DataServiceImpl implements DataServiceProto {\n private dataSubscriptions = new Map<string, { spaceId: SpaceId; next: (msg: BatchedDocumentUpdates) => void }>();\n\n constructor(\n private _executionContext: EdgeFunctionEnv.TraceContext,\n private _dataService: EdgeFunctionEnv.DataService,\n ) {}\n\n subscribe({ subscriptionId, spaceId }: { subscriptionId: string; spaceId: string }): Stream<BatchedDocumentUpdates> {\n return new Stream(({ next }) => {\n invariant(SpaceId.isValid(spaceId));\n this.dataSubscriptions.set(subscriptionId, { spaceId, next });\n\n return () => {\n this.dataSubscriptions.delete(subscriptionId);\n };\n });\n }\n\n async updateSubscription({ subscriptionId, addIds }: UpdateSubscriptionRequest): Promise<void> {\n const sub =\n this.dataSubscriptions.get(subscriptionId) ??\n raise(\n new RuntimeServiceError({\n message: 'Subscription not found.',\n context: { subscriptionId },\n }),\n );\n\n if (addIds) {\n log.info('request documents', { count: addIds.length });\n // TODO(dmaretskyi): Batch.\n for (const documentId of addIds) {\n using document = await this._dataService.getDocument(this._executionContext, sub.spaceId, documentId);\n log.info('document loaded', { documentId, spaceId: sub.spaceId, found: !!document });\n if (!document) {\n log.warn('not found', { documentId });\n continue;\n }\n sub.next({\n updates: [\n {\n documentId,\n // Copy returned object to avoid hanging RPC stub\n // See https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/\n mutation: copyUint8Array(document.data),\n },\n ],\n });\n }\n }\n }\n\n async createDocument({ spaceId, initialValue }: CreateDocumentRequest): Promise<CreateDocumentResponse> {\n invariant(SpaceId.isValid(spaceId));\n using response = await this._dataService.createDocument(this._executionContext, spaceId, initialValue);\n return { documentId: response.documentId };\n }\n\n async update({ updates, subscriptionId }: UpdateRequest): Promise<void> {\n const sub =\n this.dataSubscriptions.get(subscriptionId) ??\n raise(\n new RuntimeServiceError({\n message: 'Subscription not found.',\n context: { subscriptionId },\n }),\n );\n // TODO(dmaretskyi): Batch.\n try {\n for (const update of updates ?? []) {\n // Mutation-less updates (e.g. `requesting: true` transition signals from the worker) carry no\n // bytes to apply; this runtime only forwards real document writes.\n if (!update.mutation) {\n continue;\n }\n await this._dataService.changeDocument(this._executionContext, sub.spaceId, update.documentId, update.mutation);\n }\n } catch (error) {\n throw RuntimeServiceError.wrap({\n message: 'Failed to apply document updates.',\n context: { subscriptionId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async flush(): Promise<void> {\n // No-op.\n }\n\n subscribeSpaceSyncState(_request: GetSpaceSyncStateRequest, _options?: RequestOptions): Stream<SpaceSyncState> {\n throw new NotImplementedError({\n message: 'subscribeSpaceSyncState is not implemented.',\n });\n }\n\n async getDocumentHeads({ documentIds: _documentIds }: GetDocumentHeadsRequest): Promise<GetDocumentHeadsResponse> {\n throw new NotImplementedError({\n message: 'getDocumentHeads is not implemented.',\n });\n }\n\n async reIndexHeads({ documentIds: _documentIds }: ReIndexHeadsRequest): Promise<void> {\n throw new NotImplementedError({\n message: 'reIndexHeads is not implemented.',\n });\n }\n\n async updateIndexes(): Promise<void> {\n log.verbose('updateIndexes called, but it is a no-op in EDGE env.');\n // No-op.\n }\n\n async waitUntilHeadsReplicated({ heads: _heads }: { heads: any }): Promise<void> {\n throw new NotImplementedError({\n message: 'waitUntilHeadsReplicated is not implemented.',\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport const copyUint8Array = (value: Uint8Array): Uint8Array => new Uint8Array(value);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Stream } from '@dxos/codec-protobuf/stream';\nimport { NotImplementedError, RuntimeServiceError } from '@dxos/errors';\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv } from '@dxos/protocols';\nimport { type QueryRequest, type QueryResponse, type QueryService } from '@dxos/protocols/proto/dxos/echo/query';\n\nexport class QueryServiceImpl implements QueryService {\n private _queryCount = 0;\n\n constructor(\n private readonly _executionContext: EdgeFunctionEnv.TraceContext,\n private readonly _dataService: EdgeFunctionEnv.DataService,\n ) {}\n\n execQuery(request: QueryRequest): Stream<QueryResponse> {\n log.info('execQuery', { request });\n\n return Stream.fromPromise<QueryResponse>(\n (async () => {\n try {\n this._queryCount++;\n log.info('begin query', { request });\n using queryResponse = await this._dataService.execQuery(this._executionContext, request);\n log.info('query response', { resultCount: queryResponse.results?.length });\n return structuredClone(queryResponse);\n } catch (error) {\n log.error('query failed', { err: error });\n throw new RuntimeServiceError({\n message: `Query execution failed (queryCount=${this._queryCount})`,\n context: { queryCount: this._queryCount },\n cause: error,\n });\n }\n })(),\n );\n }\n\n async reindex() {\n throw new NotImplementedError({\n message: 'Reindex is not implemented.',\n });\n }\n\n async setConfig() {\n throw new NotImplementedError({\n message: 'SetConfig is not implemented.',\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RuntimeServiceError } from '@dxos/errors';\nimport { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';\n\nexport class QueueServiceImpl implements FeedProtocol.QueueService {\n constructor(\n protected _ctx: EdgeFunctionEnv.TraceContext,\n private readonly _queueService: EdgeFunctionEnv.QueueService,\n ) {}\n\n async queryQueue(request: FeedProtocol.QueryQueueRequest): Promise<FeedProtocol.QueryResult> {\n try {\n using result = await this._queueService.queryQueue(this._ctx, request);\n // Copy to avoid hanging RPC stub (Workers RPC lifecycle).\n return {\n objects: structuredClone(result.objects),\n nextCursor: result.nextCursor,\n prevCursor: result.prevCursor,\n };\n } catch (error) {\n const { query } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue query failed.',\n context: {\n subspaceTag: query?.queuesNamespace,\n spaceId: query?.spaceId,\n queueId: query?.queueIds?.[0],\n },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async insertIntoQueue(request: FeedProtocol.InsertIntoQueueRequest): Promise<void> {\n try {\n using _ = await this._queueService.insertIntoQueue(this._ctx, request);\n } catch (error) {\n const { subspaceTag, spaceId, queueId } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue append failed.',\n context: { subspaceTag, spaceId, queueId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async deleteFromQueue(request: FeedProtocol.DeleteFromQueueRequest): Promise<void> {\n try {\n using _ = await this._queueService.deleteFromQueue(this._ctx, request);\n } catch (error) {\n const { subspaceTag, spaceId, queueId } = request;\n throw RuntimeServiceError.wrap({\n message: 'Queue delete failed.',\n context: { subspaceTag, spaceId, queueId },\n ifTypeDiffers: true,\n })(error);\n }\n }\n\n async syncQueue(_: FeedProtocol.SyncQueueRequest): Promise<void> {\n // No-op in Cloudflare runtime.\n }\n\n async getSyncState(_: FeedProtocol.GetSyncStateRequest): Promise<FeedProtocol.GetSyncStateResponse> {\n return { namespaces: [] };\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Resource } from '@dxos/context';\nimport { type Database } from '@dxos/echo';\nimport { type CoreDatabase, type EchoClient, type EchoDatabaseImpl } from '@dxos/echo-db';\nimport { invariant } from '@dxos/invariant';\nimport { PublicKey, type SpaceId } from '@dxos/keys';\n\nimport type { ServiceContainer } from './internal';\nimport { type QueuesAPI, QueuesAPIImpl } from './queues-api';\n\n/**\n * @deprecated\n */\nexport class SpaceProxy extends Resource {\n private _db?: EchoDatabaseImpl = undefined;\n private _queuesApi: QueuesAPIImpl;\n\n constructor(\n private readonly _serviceContainer: ServiceContainer,\n private readonly _echoClient: EchoClient,\n private readonly _id: SpaceId,\n ) {\n super();\n this._queuesApi = new QueuesAPIImpl(this._serviceContainer, this._id);\n }\n\n get id(): SpaceId {\n return this._id;\n }\n\n get db(): Database.Database {\n invariant(this._db);\n return this._db;\n }\n\n /**\n * @deprecated Use db API.\n */\n get crud(): CoreDatabase {\n invariant(this._db);\n return this._db.coreDatabase;\n }\n\n get queues(): QueuesAPI {\n return this._queuesApi;\n }\n\n protected override async _open() {\n const meta = await this._serviceContainer.getSpaceMeta(this._id);\n if (!meta) {\n throw new Error(`Space not found: ${this._id}`);\n }\n\n this._db = this._echoClient.constructDatabase({\n spaceId: this._id,\n spaceKey: PublicKey.from(meta.spaceKey),\n reactiveSchemaQuery: false,\n owningObject: this,\n });\n\n await this._db.coreDatabase.open(this._ctx, { rootUrl: meta.rootDocumentId });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AnyEntity } from '@dxos/echo/internal';\nimport { type EchoURI, type SpaceId } from '@dxos/keys';\nimport { type FeedProtocol } from '@dxos/protocols';\n\nimport type { ServiceContainer } from './internal';\n\nexport interface QueuesQueryResult {\n objects: AnyEntity[];\n nextCursor: string | null;\n prevCursor: string | null;\n}\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\n/**\n * @deprecated\n */\nexport interface QueuesAPI {\n queryQueue(queue: EchoURI.EchoURI, options?: {}): Promise<FeedProtocol.QueryResult>;\n insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void>;\n}\n\n/**\n * @deprecated\n */\nexport class QueuesAPIImpl implements QueuesAPI {\n constructor(\n private readonly _serviceContainer: ServiceContainer,\n private readonly _spaceId: SpaceId,\n ) {}\n\n queryQueue(queue: EchoURI.EchoURI, options?: {}): Promise<FeedProtocol.QueryResult> {\n return this._serviceContainer.queryQueue(queue);\n }\n\n insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void> {\n // TODO(dmaretskyi): Ugly.\n return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { JsonSchemaType } from '@dxos/echo/internal';\n\n/**\n * Is used for to route the request to the metadata handler instead of the main handler.\n */\nexport const FUNCTION_ROUTE_HEADER = 'X-DXOS-Function-Route';\n\nexport enum FunctionRouteValue {\n Meta = 'meta',\n}\n\nexport type FunctionMetadata = {\n /**\n * FQN.\n */\n key: string;\n /**\n * Human-readable name.\n */\n name?: string;\n\n /**\n * Description.\n */\n description?: string;\n\n /**\n * Input schema.\n */\n inputSchema?: JsonSchemaType;\n\n /**\n * Output schema.\n */\n outputSchema?: JsonSchemaType;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { JsonSchemaType } from '@dxos/echo/internal';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { EdgeResponse } from '@dxos/protocols';\nimport type { EdgeFunctionEnv, FunctionProtocol } from '@dxos/protocols';\n\nimport { ServiceContainer } from './internal';\nimport { FUNCTION_ROUTE_HEADER, type FunctionMetadata, FunctionRouteValue } from './types';\n\n/**\n * Wraps a user function in a Cloudflare-compatible handler.\n */\nexport const wrapHandlerForCloudflare = (func: FunctionProtocol.Func): ExportedHandlerFetchHandler<any> => {\n return async (request: Request, env: EdgeFunctionEnv.Env): Promise<Response> => {\n // TODO(dmaretskyi): Should theÓ scope name reflect the function name?\n // TODO(mykola): Wrap in withCleanAutomergeWasmState;\n // TODO(mykola): Wrap in withNewExecutionContext;\n // Meta route is used to get the input schema of the function by the functions service.\n if (request.headers.get(FUNCTION_ROUTE_HEADER) === FunctionRouteValue.Meta) {\n return handleFunctionMetaCall(func, request);\n }\n\n try {\n const spaceId = new URL(request.url).searchParams.get('spaceId');\n if (spaceId) {\n if (!SpaceId.isValid(spaceId)) {\n return new Response('Invalid spaceId', { status: 400 });\n }\n }\n\n const serviceContainer = new ServiceContainer({}, env.DATA_SERVICE, env.QUEUE_SERVICE, env.FUNCTIONS_AI_SERVICE);\n const context = await createFunctionContext({\n serviceContainer,\n contextSpaceId: spaceId as SpaceId | undefined,\n });\n\n return EdgeResponse.success(await invokeFunction(func, context, request));\n } catch (error: any) {\n log.error('error invoking function', { error, stack: error.stack });\n return EdgeResponse.failure({\n message: error?.message ?? 'Internal error',\n error,\n });\n }\n };\n};\n\nconst invokeFunction = async (func: FunctionProtocol.Func, context: FunctionProtocol.Context, request: Request) => {\n // TODO(dmaretskyi): For some reason requests get wrapped like this.\n const { data } = await decodeRequest(request);\n\n return func.handler({\n context,\n data,\n });\n};\n\nconst decodeRequest = async (request: Request) => {\n const {\n data: { bodyText, ...rest },\n trigger,\n } = (await request.json()) as any;\n\n if (!bodyText) {\n return { data: rest, trigger };\n }\n\n // Webhook passed body as bodyText. Use it as function input if a well-formatted JSON\n // TODO: better trigger input mapping\n try {\n const data = JSON.parse(bodyText);\n return { data, trigger: { ...trigger, ...rest } };\n } catch (err) {\n log.catch(err);\n return { data: { bodyText, ...rest } };\n }\n};\n\nconst handleFunctionMetaCall = (functionDefinition: FunctionProtocol.Func, request: Request): Response => {\n const response: FunctionMetadata = {\n key: functionDefinition.meta.key,\n name: functionDefinition.meta.name,\n description: functionDefinition.meta.description,\n inputSchema: functionDefinition.meta.inputSchema as JsonSchemaType | undefined,\n outputSchema: functionDefinition.meta.outputSchema as JsonSchemaType | undefined,\n };\n\n return new Response(JSON.stringify(response), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n\nexport const createFunctionContext = async ({\n serviceContainer,\n contextSpaceId,\n}: {\n serviceContainer: ServiceContainer;\n contextSpaceId: SpaceId | undefined;\n}): Promise<FunctionProtocol.Context> => {\n const { dataService, queryService, queueService, functionsAiService } = await serviceContainer.createServices();\n\n let spaceKey: string | undefined;\n let rootUrl: string | undefined;\n if (contextSpaceId) {\n const meta = await serviceContainer.getSpaceMeta(contextSpaceId);\n if (!meta) {\n throw new Error(`Space not found: ${contextSpaceId}`);\n }\n spaceKey = meta.spaceKey;\n invariant(!meta.rootDocumentId.startsWith('automerge:'));\n rootUrl = `automerge:${meta.rootDocumentId}`;\n }\n\n return {\n services: {\n dataService,\n queryService,\n queueService,\n functionsAiService,\n },\n spaceId: contextSpaceId,\n spaceKey,\n spaceRootUrl: rootUrl,\n } as any; // TODO(dmaretskyi): Link and fix before merging\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/* eslint-disable no-console */\n\nimport { LogLevel, type LogProcessor, log, shouldLog } from '@dxos/log';\n\nexport const setupFunctionsLogger = () => {\n log.runtimeConfig.processors.length = 0;\n log.runtimeConfig.processors.push(functionLogProcessor);\n};\n\nconst functionLogProcessor: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const context = entry.computedContext;\n const error = entry.computedError;\n const extras = [Object.keys(context).length > 0 ? context : undefined, error].filter((value) => value !== undefined);\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n case LogLevel.TRACE:\n console.debug(entry.message, ...extras);\n break;\n case LogLevel.VERBOSE:\n console.log(entry.message, ...extras);\n break;\n case LogLevel.INFO:\n console.info(entry.message, ...extras);\n break;\n case LogLevel.WARN:\n console.warn(entry.message, ...extras);\n break;\n case LogLevel.ERROR:\n console.error(entry.message, ...extras);\n break;\n default:\n console.log(entry.message, ...extras);\n break;\n }\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,YAAAA,iBAAgB;AACzB,SAASC,kBAAkB;AAC3B,SAASC,aAAAA,kBAAiB;;;ACD1B,SAASC,eAA6B;;;ACCtC,SAASC,cAAa;AACtB,SAASC,aAAAA;AACT,SAASC,qBAAiB,2BAAkB;AAC5C,SAASC,iBAAe;AACxB,SAASC,eAAW;AAgBpB,SAASC,WAAAA;;;ACtBF,IAAMC,iBAAiB,CAACC,UAAkC,IAAIC,WAAWD,KAAAA;;;ADJhF,IAAE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKF;;;EAwBUE;EAER,oBACUC,oBAAAA,IAAAA;cAAAA,mBAAAA,cAAAA;SACAC,oBAAAA;AACP,SAAA,eAAA;EAEHC;YACE,EAAO,gBAAcC,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oClient", "invariant", "EchoURI", "raise", "NotImplementedError", "invariant", "SpaceId", "log", "copyUint8Array", "copyUint8Array", "value", "Uint8Array", "dataSubscriptions", "_executionContext", "_dataService", "subscribe", "next", "invariant", "SpaceId", "isValid", "spaceId", "subscriptionId", "message", "context", "log", "count", "info", "documentId", "found", "document", "sub", "updates", "response", "createDocument", "initialValue", "get", "RuntimeServiceError", "ifTypeDiffers", "error", "subscribeSpaceSyncState", "NotImplementedError", "NotImplementedError", "log", "RuntimeServiceError", "QueryServiceImpl", "_queryCount", "_executionContext", "_dataService", "execQuery", "info", "request", "fromPromise", "__dxlog_file", "Stream", "queryResponse", "_ts_add_disposable_resource", "resultCount", "structuredClone", "error", "err", "message", "context", "queryCount", "cause", "RuntimeServiceError", "QueueServiceImpl", "_ctx", "_queueService", "queryQueue", "request", "result", "objects", "structuredClone", "nextCursor", "prevCursor", "error", "query", "wrap", "message", "context", "subspaceTag", "queuesNamespace", "spaceId", "queueId", "queueIds", "ifTypeDiffers", "insertIntoQueue", "_", "deleteFromQueue", "syncQueue", "getSyncState", "namespaces", "ServiceContainer", "_executionContext", "_dataService", "_queueService", "_functionsService", "getSpaceMeta", "spaceId", "result", "spaceKey", "rootDocumentId", "undefined", "createServices", "dataService", "DataServiceImpl", "queryService", "QueryServiceImpl", "queueService", "QueueServiceImpl", "functionsAiService", "queryQueue", "queue", "EchoURI", "getSpaceId", "queueId", "getObjectId", "Error", "query", "queueIds", "objects", "structuredClone", "nextCursor", "prevCursor", "insertIntoQueue", "subspaceTag", "map", "obj", "JSON", "stringify", "Resource", "invariant", "PublicKey", "QueuesAPIImpl", "_serviceContainer", "_spaceId", "queryQueue", "queue", "options", "insertIntoQueue", "objects", "JSON", "parse", "stringify", "__dxlog_file", "_db", "_queuesApi", "QueuesAPIImpl", "_serviceContainer", "id", "db", "invariant", "queues", "_open", "meta", "Error", "_echoClient", "constructDatabase", "spaceKey", "PublicKey", "reactiveSchemaQuery", "owningObject", "coreDatabase", "__dxlog_file", "_echoClient", "Resource", "_executionContext", "_spaces", "invariant", "services", "_serviceContainer", "ServiceContainer", "dataService", "queueService", "functionsAiService", "EchoClient", "echo", "_open", "queryService", "_close", "space", "clear", "getSpace", "spaceId", "set", "DATA_SERVICE", "env", "FUNCTION_ROUTE_HEADER", "FunctionRouteValue", "invariant", "SpaceId", "log", "EdgeResponse", "__dxlog_file", "SpaceId", "isValid", "spaceId", "status", "serviceContainer", "contextSpaceId", "success", "log", "error", "stack", "EdgeResponse", "message", "decodeRequest", "request", "context", "data", "rest", "trigger", "functionDefinition", "meta", "name", "description", "inputSchema", "outputSchema", "Response", "response", "spaceKey", "rootUrl", "Error", "invariant", "queryService", "queueService", "functionsAiService", "spaceRootUrl", "LogLevel", "log", "shouldLog", "log", "runtimeConfig", "push", "functionLogProcessor", "config", "entry", "extras", "Object", "keys", "context", "error", "filter", "value", "undefined", "LogLevel", "DEBUG", "TRACE", "console", "debug", "VERBOSE", "INFO", "WARN", "ERROR"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/internal/utils.ts":{"bytes":590,"imports":[],"format":"esm"},"src/internal/data-service-impl.ts":{"bytes":19256,"imports":[{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/internal/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/internal/query-service-impl.ts":{"bytes":9324,"imports":[{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/internal/queue-service-impl.ts":{"bytes":11248,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/internal/service-container.ts":{"bytes":12950,"imports":[{"path":"src/internal/data-service-impl.ts","kind":"import-statement","original":"./data-service-impl"},{"path":"src/internal/query-service-impl.ts","kind":"import-statement","original":"./query-service-impl"},{"path":"src/internal/queue-service-impl.ts","kind":"import-statement","original":"./queue-service-impl"}],"format":"esm"},"src/internal/index.ts":{"bytes":401,"imports":[{"path":"src/internal/service-container.ts","kind":"import-statement","original":"./service-container"}],"format":"esm"},"src/queues-api.ts":{"bytes":4985,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/space-proxy.ts":{"bytes":6098,"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/queues-api.ts","kind":"import-statement","original":"./queues-api"}],"format":"esm"},"src/functions-client.ts":{"bytes":9115,"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/space-proxy.ts","kind":"import-statement","original":"./space-proxy"}],"format":"esm"},"src/types.ts":{"bytes":1603,"imports":[],"format":"esm"},"src/wrap-handler-for-cloudflare.ts":{"bytes":15140,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/logger.ts":{"bytes":4864,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":786,"imports":[{"path":"src/functions-client.ts","kind":"import-statement","original":"./functions-client"},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/wrap-handler-for-cloudflare.ts","kind":"import-statement","original":"./wrap-handler-for-cloudflare"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":39601},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTION_ROUTE_HEADER","FunctionRouteValue","FunctionsClient","ServiceContainer","createClientFromEnv","createFunctionContext","setupFunctionsLogger","wrapHandlerForCloudflare"],"entryPoint":"src/index.ts","inputs":{"src/functions-client.ts":{"bytesInOutput":2107},"src/internal/data-service-impl.ts":{"bytesInOutput":6995},"src/internal/utils.ts":{"bytesInOutput":55},"src/internal/query-service-impl.ts":{"bytesInOutput":4388},"src/internal/queue-service-impl.ts":{"bytesInOutput":4790},"src/internal/service-container.ts":{"bytesInOutput":4452},"src/space-proxy.ts":{"bytesInOutput":1501},"src/queues-api.ts":{"bytesInOutput":1078},"src/index.ts":{"bytesInOutput":0},"src/types.ts":{"bytesInOutput":205},"src/wrap-handler-for-cloudflare.ts":{"bytesInOutput":3427},"src/logger.ts":{"bytesInOutput":1064}},"bytes":30802}}}
1
+ {"inputs":{"src/internal/utils.ts":{"bytes":590,"imports":[],"format":"esm"},"src/internal/data-service-impl.ts":{"bytes":20010,"imports":[{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/internal/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/internal/query-service-impl.ts":{"bytes":9332,"imports":[{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/internal/queue-service-impl.ts":{"bytes":11657,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/internal/service-container.ts":{"bytes":13305,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/internal/data-service-impl.ts","kind":"import-statement","original":"./data-service-impl"},{"path":"src/internal/query-service-impl.ts","kind":"import-statement","original":"./query-service-impl"},{"path":"src/internal/queue-service-impl.ts","kind":"import-statement","original":"./queue-service-impl"}],"format":"esm"},"src/internal/index.ts":{"bytes":401,"imports":[{"path":"src/internal/service-container.ts","kind":"import-statement","original":"./service-container"}],"format":"esm"},"src/queues-api.ts":{"bytes":3155,"imports":[],"format":"esm"},"src/space-proxy.ts":{"bytes":6106,"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/queues-api.ts","kind":"import-statement","original":"./queues-api"}],"format":"esm"},"src/functions-client.ts":{"bytes":8574,"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/space-proxy.ts","kind":"import-statement","original":"./space-proxy"}],"format":"esm"},"src/types.ts":{"bytes":1603,"imports":[],"format":"esm"},"src/wrap-handler-for-cloudflare.ts":{"bytes":15148,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/logger.ts":{"bytes":4872,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":786,"imports":[{"path":"src/functions-client.ts","kind":"import-statement","original":"./functions-client"},{"path":"src/internal/index.ts","kind":"import-statement","original":"./internal"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/wrap-handler-for-cloudflare.ts","kind":"import-statement","original":"./wrap-handler-for-cloudflare"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":39393},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf/stream","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTION_ROUTE_HEADER","FunctionRouteValue","FunctionsClient","ServiceContainer","createClientFromEnv","createFunctionContext","setupFunctionsLogger","wrapHandlerForCloudflare"],"entryPoint":"src/index.ts","inputs":{"src/functions-client.ts":{"bytesInOutput":2115},"src/internal/service-container.ts":{"bytesInOutput":4504},"src/internal/data-service-impl.ts":{"bytesInOutput":7076},"src/internal/utils.ts":{"bytesInOutput":55},"src/internal/query-service-impl.ts":{"bytesInOutput":4396},"src/internal/queue-service-impl.ts":{"bytesInOutput":4861},"src/space-proxy.ts":{"bytesInOutput":1509},"src/queues-api.ts":{"bytesInOutput":414},"src/index.ts":{"bytesInOutput":0},"src/types.ts":{"bytesInOutput":205},"src/wrap-handler-for-cloudflare.ts":{"bytesInOutput":3435},"src/logger.ts":{"bytesInOutput":1064}},"bytes":30412}}}
@@ -25,9 +25,4 @@ export declare class FunctionsClient extends Resource {
25
25
  }
26
26
  export declare const createClientFromEnv: (env: any) => Promise<FunctionsClient>;
27
27
  export {};
28
- /**
29
- - Provides data access capabilities for user functions.
30
- - No real-time replication or reactive queries -- function receives a snapshot.
31
- - Function event contains the metadata but doesn't need to include the data.
32
- */
33
28
  //# sourceMappingURL=functions-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"functions-client.d.ts","sourceRoot":"","sources":["../../../src/functions-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC;IACzC,YAAY,EAAE,eAAe,CAAC,YAAY,CAAC;IAC3C,kBAAkB,EAAE,eAAe,CAAC,kBAAkB,CAAC;CACxD,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoC;IAEtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,YAAY,QAAQ,EAAE,QAAQ,EAW7B;IAED,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,UAAyB,KAAK,kBAI7B;IAED,UAAyB,MAAM,kBAO9B;IAEK,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAQpD;CACF;AAED,eAAO,MAAM,mBAAmB,QAAe,GAAG,KAAG,OAAO,CAAC,eAAe,CAQ3E,CAAC;;AAEF;;;;GAIG"}
1
+ {"version":3,"file":"functions-client.d.ts","sourceRoot":"","sources":["../../../src/functions-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;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QAAQ,EAAE,wBAAwB,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAI7G;IAEK,gBAAgB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAIhH;IAEK,YAAY,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpF;IAEK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAGnC;IAEK,wBAAwB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/E;CACF"}
@@ -7,5 +7,6 @@ export declare class QueueServiceImpl implements FeedProtocol.QueueService {
7
7
  insertIntoQueue(request: FeedProtocol.InsertIntoQueueRequest): Promise<void>;
8
8
  deleteFromQueue(request: FeedProtocol.DeleteFromQueueRequest): Promise<void>;
9
9
  syncQueue(_: FeedProtocol.SyncQueueRequest): Promise<void>;
10
+ getSyncState(_: FeedProtocol.GetSyncStateRequest): Promise<FeedProtocol.GetSyncStateResponse>;
10
11
  }
11
12
  //# sourceMappingURL=queue-service-impl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queue-service-impl.d.ts","sourceRoot":"","sources":["../../../../src/internal/queue-service-impl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1E,qBAAa,gBAAiB,YAAW,YAAY,CAAC,YAAY;IAE9D,SAAS,CAAC,IAAI,EAAE,eAAe,CAAC,YAAY;IAC5C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAFhC,YACY,IAAI,EAAE,eAAe,CAAC,YAAY,EAC3B,aAAa,EAAE,eAAe,CAAC,YAAY,EAC1D;IAEE,UAAU,CAAC,OAAO,EAAE,YA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from '@dxos/echo/internal';
2
- import { type DXN, type SpaceId } from '@dxos/keys';
2
+ import { EchoURI, type SpaceId } from '@dxos/keys';
3
3
  import { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';
4
4
  import { type QueryService as QueryServiceProto } from '@dxos/protocols/proto/dxos/echo/query';
5
- import type { DataService as DataServiceProto } from '@dxos/protocols/proto/dxos/echo/service';
5
+ import { type DataService as DataServiceProto } from '@dxos/protocols/proto/dxos/echo/service';
6
6
  /**
7
7
  * TODO: make this implement DataService and QueryService to unify API over edge and web backend
8
8
  */
@@ -19,7 +19,7 @@ export declare class ServiceContainer {
19
19
  queueService: FeedProtocol.QueueService;
20
20
  functionsAiService: EdgeFunctionEnv.FunctionsAiService;
21
21
  }>;
22
- queryQueue(queue: DXN): Promise<FeedProtocol.QueryResult>;
23
- insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void>;
22
+ queryQueue(queue: EchoURI.EchoURI): Promise<FeedProtocol.QueryResult>;
23
+ insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void>;
24
24
  }
25
25
  //# sourceMappingURL=service-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/internal/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,KAAK,YAAY,IAAI,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,KAAK,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAM/F;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OA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zB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAJpC,YACmB,iBAAiB,EAAE,eAAe,CAAC,YAAY,EAC/C,YAAY,EAAE,eAAe,CAAC,WAAW,EACzC,aAAa,EAAE,eAAe,CAAC,YAAY,EAC3C,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,EACpE;IAEE,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,GAAG,SAAS,CAAC,CAUnF;IAEK,cAAc,IAAI,OAAO,CAAC;QAC9B,WAAW,EAAE,gBAAgB,CAAC;QAC9B,YAAY,EAAE,iBAAiB,CAAC;QAChC,YAAY,EAAE,YAAY,CAAC,YAAY,CAAC;QACxC,kBAAkB,EAAE,eAAe,CAAC,kBAAkB,CAAC;KACxD,CAAC,CAWD;IAEK,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAkB1E;IAEK,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAajF;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { type AnyEntity } from '@dxos/echo/internal';
2
- import type { DXN, SpaceId } from '@dxos/keys';
2
+ import { type EchoURI, type SpaceId } from '@dxos/keys';
3
+ import { type FeedProtocol } from '@dxos/protocols';
3
4
  import type { ServiceContainer } from './internal';
4
5
  export interface QueuesQueryResult {
5
6
  objects: AnyEntity[];
@@ -10,8 +11,8 @@ export interface QueuesQueryResult {
10
11
  * @deprecated
11
12
  */
12
13
  export interface QueuesAPI {
13
- queryQueue(queue: DXN, options?: {}): Promise<QueuesQueryResult>;
14
- insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void>;
14
+ queryQueue(queue: EchoURI.EchoURI, options?: {}): Promise<FeedProtocol.QueryResult>;
15
+ insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void>;
15
16
  }
16
17
  /**
17
18
  * @deprecated
@@ -20,7 +21,7 @@ export declare class QueuesAPIImpl implements QueuesAPI {
20
21
  private readonly _serviceContainer;
21
22
  private readonly _spaceId;
22
23
  constructor(_serviceContainer: ServiceContainer, _spaceId: SpaceId);
23
- queryQueue(queue: DXN, options?: {}): Promise<QueuesQueryResult>;
24
- insertIntoQueue(queue: DXN, objects: AnyEntity[]): Promise<void>;
24
+ queryQueue(queue: EchoURI.EchoURI, options?: {}): Promise<FeedProtocol.QueryResult>;
25
+ insertIntoQueue(queue: EchoURI.EchoURI, objects: AnyEntity[]): Promise<void>;
25
26
  }
26
27
  //# sourceMappingURL=queues-api.d.ts.map