@dxos/functions-runtime-cloudflare 0.8.4-main.422d1c7879 → 0.8.4-main.4668b7de9b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -44,4 +44,4 @@ pnpm i @dxos/functions-runtime-cloudflare
44
44
 
45
45
  Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
46
46
 
47
- License: [MIT](./LICENSE) Copyright 2022 © DXOS
47
+ License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2022 © DXOS
@@ -3,6 +3,9 @@ import { Resource as Resource2 } from "@dxos/context";
3
3
  import { EchoClient } from "@dxos/echo-db";
4
4
  import { invariant as invariant3 } from "@dxos/invariant";
5
5
 
6
+ // src/internal/service-container.ts
7
+ import { EID } from "@dxos/keys";
8
+
6
9
  // src/internal/data-service-impl.ts
7
10
  import { Stream } from "@dxos/codec-protobuf/stream";
8
11
  import { raise } from "@dxos/debug";
@@ -15,6 +18,7 @@ import { log } from "@dxos/log";
15
18
  var copyUint8Array = (value) => new Uint8Array(value);
16
19
 
17
20
  // src/internal/data-service-impl.ts
21
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/internal/data-service-impl.ts";
18
22
  function _ts_add_disposable_resource(env, value, async) {
19
23
  if (value !== null && value !== void 0) {
20
24
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -80,7 +84,6 @@ function _ts_dispose_resources(env) {
80
84
  return next();
81
85
  })(env);
82
86
  }
83
- var __dxlog_file = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/data-service-impl.ts";
84
87
  var DataServiceImpl = class {
85
88
  _executionContext;
86
89
  _dataService;
@@ -91,15 +94,7 @@ var DataServiceImpl = class {
91
94
  }
92
95
  subscribe({ subscriptionId, spaceId }) {
93
96
  return new Stream(({ next }) => {
94
- invariant(SpaceId.isValid(spaceId), void 0, {
95
- F: __dxlog_file,
96
- L: 39,
97
- S: this,
98
- A: [
99
- "SpaceId.isValid(spaceId)",
100
- ""
101
- ]
102
- });
97
+ invariant(SpaceId.isValid(spaceId), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 86, S: this, A: ["SpaceId.isValid(spaceId)", ""] });
103
98
  this.dataSubscriptions.set(subscriptionId, {
104
99
  spaceId,
105
100
  next
@@ -119,12 +114,7 @@ var DataServiceImpl = class {
119
114
  if (addIds) {
120
115
  log.info("request documents", {
121
116
  count: addIds.length
122
- }, {
123
- F: __dxlog_file,
124
- L: 59,
125
- S: this,
126
- C: (f, a) => f(...a)
127
- });
117
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 104, S: this });
128
118
  for (const documentId of addIds) {
129
119
  const env = {
130
120
  stack: [],
@@ -137,21 +127,11 @@ var DataServiceImpl = class {
137
127
  documentId,
138
128
  spaceId: sub.spaceId,
139
129
  found: !!document
140
- }, {
141
- F: __dxlog_file,
142
- L: 63,
143
- S: this,
144
- C: (f, a) => f(...a)
145
- });
130
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 116, S: this });
146
131
  if (!document) {
147
132
  log.warn("not found", {
148
133
  documentId
149
- }, {
150
- F: __dxlog_file,
151
- L: 65,
152
- S: this,
153
- C: (f, a) => f(...a)
154
- });
134
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 122, S: this });
155
135
  continue;
156
136
  }
157
137
  sub.next({
@@ -180,15 +160,7 @@ var DataServiceImpl = class {
180
160
  hasError: false
181
161
  };
182
162
  try {
183
- invariant(SpaceId.isValid(spaceId), void 0, {
184
- F: __dxlog_file,
185
- L: 83,
186
- S: this,
187
- A: [
188
- "SpaceId.isValid(spaceId)",
189
- ""
190
- ]
191
- });
163
+ invariant(SpaceId.isValid(spaceId), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 153, S: this, A: ["SpaceId.isValid(spaceId)", ""] });
192
164
  const response = _ts_add_disposable_resource(env, await this._dataService.createDocument(this._executionContext, spaceId, initialValue), false);
193
165
  return {
194
166
  documentId: response.documentId
@@ -209,6 +181,9 @@ var DataServiceImpl = class {
209
181
  }));
210
182
  try {
211
183
  for (const update of updates ?? []) {
184
+ if (!update.mutation) {
185
+ continue;
186
+ }
212
187
  await this._dataService.changeDocument(this._executionContext, sub.spaceId, update.documentId, update.mutation);
213
188
  }
214
189
  } catch (error) {
@@ -239,12 +214,7 @@ var DataServiceImpl = class {
239
214
  });
240
215
  }
241
216
  async updateIndexes() {
242
- log.error("updateIndexes is not available in EDGE env.", void 0, {
243
- F: __dxlog_file,
244
- L: 134,
245
- S: this,
246
- C: (f, a) => f(...a)
247
- });
217
+ log.verbose("updateIndexes called, but it is a no-op in EDGE env.", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 211, S: this });
248
218
  }
249
219
  async waitUntilHeadsReplicated({ heads: _heads }) {
250
220
  throw new NotImplementedError({
@@ -257,6 +227,7 @@ var DataServiceImpl = class {
257
227
  import { Stream as Stream2 } from "@dxos/codec-protobuf/stream";
258
228
  import { NotImplementedError as NotImplementedError2, RuntimeServiceError as RuntimeServiceError2 } from "@dxos/errors";
259
229
  import { log as log2 } from "@dxos/log";
230
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/internal/query-service-impl.ts";
260
231
  function _ts_add_disposable_resource2(env, value, async) {
261
232
  if (value !== null && value !== void 0) {
262
233
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -322,7 +293,6 @@ function _ts_dispose_resources2(env) {
322
293
  return next();
323
294
  })(env);
324
295
  }
325
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/query-service-impl.ts";
326
296
  var QueryServiceImpl = class {
327
297
  _executionContext;
328
298
  _dataService;
@@ -334,12 +304,7 @@ var QueryServiceImpl = class {
334
304
  execQuery(request) {
335
305
  log2.info("execQuery", {
336
306
  request
337
- }, {
338
- F: __dxlog_file2,
339
- L: 20,
340
- S: this,
341
- C: (f, a) => f(...a)
342
- });
307
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 81, S: this });
343
308
  return Stream2.fromPromise((async () => {
344
309
  try {
345
310
  const env = {
@@ -351,21 +316,11 @@ var QueryServiceImpl = class {
351
316
  this._queryCount++;
352
317
  log2.info("begin query", {
353
318
  request
354
- }, {
355
- F: __dxlog_file2,
356
- L: 26,
357
- S: this,
358
- C: (f, a) => f(...a)
359
- });
319
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 93, S: this });
360
320
  const queryResponse = _ts_add_disposable_resource2(env, await this._dataService.execQuery(this._executionContext, request), false);
361
321
  log2.info("query response", {
362
322
  resultCount: queryResponse.results?.length
363
- }, {
364
- F: __dxlog_file2,
365
- L: 28,
366
- S: this,
367
- C: (f, a) => f(...a)
368
- });
323
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 97, S: this });
369
324
  return structuredClone(queryResponse);
370
325
  } catch (e) {
371
326
  env.error = e;
@@ -376,12 +331,7 @@ var QueryServiceImpl = class {
376
331
  } catch (error) {
377
332
  log2.error("query failed", {
378
333
  err: error
379
- }, {
380
- F: __dxlog_file2,
381
- L: 31,
382
- S: this,
383
- C: (f, a) => f(...a)
384
- });
334
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 108, S: this });
385
335
  throw new RuntimeServiceError2({
386
336
  message: `Query execution failed (queryCount=${this._queryCount})`,
387
337
  context: {
@@ -569,6 +519,11 @@ var QueueServiceImpl = class {
569
519
  }
570
520
  async syncQueue(_) {
571
521
  }
522
+ async getSyncState(_) {
523
+ return {
524
+ namespaces: []
525
+ };
526
+ }
572
527
  };
573
528
 
574
529
  // src/internal/service-container.ts
@@ -679,15 +634,14 @@ var ServiceContainer = class {
679
634
  };
680
635
  }
681
636
  async queryQueue(queue) {
682
- const parts = queue.asQueueDXN();
683
- if (!parts) {
684
- throw new Error("Invalid queue DXN");
637
+ const spaceId = EID.getSpaceId(queue);
638
+ const queueId = EID.getEntityId(queue);
639
+ if (!spaceId || !queueId) {
640
+ throw new Error("Invalid queue EID");
685
641
  }
686
- const { subspaceTag, spaceId, queueId } = parts;
687
642
  const result = await this._queueService.queryQueue(this._executionContext, {
688
643
  query: {
689
644
  spaceId,
690
- queuesNamespace: subspaceTag,
691
645
  queueIds: [
692
646
  queueId
693
647
  ]
@@ -700,13 +654,13 @@ var ServiceContainer = class {
700
654
  };
701
655
  }
702
656
  async insertIntoQueue(queue, objects) {
703
- const parts = queue.asQueueDXN();
704
- if (!parts) {
705
- throw new Error("Invalid queue DXN");
657
+ const spaceId = EID.getSpaceId(queue);
658
+ const queueId = EID.getEntityId(queue);
659
+ if (!spaceId || !queueId) {
660
+ throw new Error("Invalid queue EID");
706
661
  }
707
- const { subspaceTag, spaceId, queueId } = parts;
708
662
  await this._queueService.insertIntoQueue(this._executionContext, {
709
- subspaceTag,
663
+ subspaceTag: "data",
710
664
  spaceId,
711
665
  queueId,
712
666
  objects: objects.map((obj) => JSON.stringify(obj))
@@ -720,8 +674,6 @@ import { invariant as invariant2 } from "@dxos/invariant";
720
674
  import { PublicKey } from "@dxos/keys";
721
675
 
722
676
  // src/queues-api.ts
723
- import { log as log3 } from "@dxos/log";
724
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/queues-api.ts";
725
677
  var QueuesAPIImpl = class {
726
678
  _serviceContainer;
727
679
  _spaceId;
@@ -729,31 +681,8 @@ var QueuesAPIImpl = class {
729
681
  this._serviceContainer = _serviceContainer;
730
682
  this._spaceId = _spaceId;
731
683
  }
732
- async queryQueue(queue, options) {
733
- const result = await this._serviceContainer.queryQueue(queue);
734
- const objects = (result.objects ?? []).flatMap((encoded) => {
735
- try {
736
- return [
737
- JSON.parse(encoded)
738
- ];
739
- } catch (err) {
740
- log3.verbose("queue object JSON parse failed; object ignored", {
741
- encoded,
742
- error: err
743
- }, {
744
- F: __dxlog_file3,
745
- L: 42,
746
- S: this,
747
- C: (f, a) => f(...a)
748
- });
749
- return [];
750
- }
751
- });
752
- return {
753
- objects,
754
- nextCursor: result.nextCursor ?? null,
755
- prevCursor: result.prevCursor ?? null
756
- };
684
+ queryQueue(queue, options) {
685
+ return this._serviceContainer.queryQueue(queue);
757
686
  }
758
687
  insertIntoQueue(queue, objects) {
759
688
  return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));
@@ -761,7 +690,7 @@ var QueuesAPIImpl = class {
761
690
  };
762
691
 
763
692
  // src/space-proxy.ts
764
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/space-proxy.ts";
693
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/space-proxy.ts";
765
694
  var SpaceProxy = class extends Resource {
766
695
  _serviceContainer;
767
696
  _echoClient;
@@ -776,30 +705,14 @@ var SpaceProxy = class extends Resource {
776
705
  return this._id;
777
706
  }
778
707
  get db() {
779
- invariant2(this._db, void 0, {
780
- F: __dxlog_file4,
781
- L: 35,
782
- S: this,
783
- A: [
784
- "this._db",
785
- ""
786
- ]
787
- });
708
+ invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 24, S: this, A: ["this._db", ""] });
788
709
  return this._db;
789
710
  }
790
711
  /**
791
712
  * @deprecated Use db API.
792
713
  */
793
714
  get crud() {
794
- invariant2(this._db, void 0, {
795
- F: __dxlog_file4,
796
- L: 43,
797
- S: this,
798
- A: [
799
- "this._db",
800
- ""
801
- ]
802
- });
715
+ invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 30, S: this, A: ["this._db", ""] });
803
716
  return this._db.coreDatabase;
804
717
  }
805
718
  get queues() {
@@ -823,7 +736,7 @@ var SpaceProxy = class extends Resource {
823
736
  };
824
737
 
825
738
  // src/functions-client.ts
826
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/functions-client.ts";
739
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/functions-client.ts";
827
740
  var FunctionsClient = class extends Resource2 {
828
741
  _serviceContainer;
829
742
  _echoClient;
@@ -831,24 +744,8 @@ var FunctionsClient = class extends Resource2 {
831
744
  _spaces = /* @__PURE__ */ new Map();
832
745
  constructor(services) {
833
746
  super();
834
- invariant3(typeof services.dataService !== "undefined", "DataService is required", {
835
- F: __dxlog_file5,
836
- L: 33,
837
- S: this,
838
- A: [
839
- "typeof services.dataService !== 'undefined'",
840
- "'DataService is required'"
841
- ]
842
- });
843
- invariant3(typeof services.queueService !== "undefined", "QueueService is required", {
844
- F: __dxlog_file5,
845
- L: 34,
846
- S: this,
847
- A: [
848
- "typeof services.queueService !== 'undefined'",
849
- "'QueueService is required'"
850
- ]
851
- });
747
+ 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'"] });
748
+ 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'"] });
852
749
  this._serviceContainer = new ServiceContainer(this._executionContext, services.dataService, services.queueService, services.functionsAiService);
853
750
  this._echoClient = new EchoClient({});
854
751
  }
@@ -900,9 +797,9 @@ var FunctionRouteValue = /* @__PURE__ */ (function(FunctionRouteValue2) {
900
797
  // src/wrap-handler-for-cloudflare.ts
901
798
  import { invariant as invariant4 } from "@dxos/invariant";
902
799
  import { SpaceId as SpaceId2 } from "@dxos/keys";
903
- import { log as log4 } from "@dxos/log";
800
+ import { log as log3 } from "@dxos/log";
904
801
  import { EdgeResponse } from "@dxos/protocols";
905
- var __dxlog_file6 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
802
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
906
803
  var wrapHandlerForCloudflare = (func) => {
907
804
  return async (request, env) => {
908
805
  if (request.headers.get(FUNCTION_ROUTE_HEADER) === FunctionRouteValue.Meta) {
@@ -924,15 +821,10 @@ var wrapHandlerForCloudflare = (func) => {
924
821
  });
925
822
  return EdgeResponse.success(await invokeFunction(func, context, request));
926
823
  } catch (error) {
927
- log4.error("error invoking function", {
824
+ log3.error("error invoking function", {
928
825
  error,
929
826
  stack: error.stack
930
- }, {
931
- F: __dxlog_file6,
932
- L: 44,
933
- S: void 0,
934
- C: (f, a) => f(...a)
935
- });
827
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 37, S: void 0 });
936
828
  return EdgeResponse.failure({
937
829
  message: error?.message ?? "Internal error",
938
830
  error
@@ -965,12 +857,7 @@ var decodeRequest = async (request) => {
965
857
  }
966
858
  };
967
859
  } catch (err) {
968
- log4.catch(err, void 0, {
969
- F: __dxlog_file6,
970
- L: 79,
971
- S: void 0,
972
- C: (f, a) => f(...a)
973
- });
860
+ log3.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 76, S: void 0 });
974
861
  return {
975
862
  data: {
976
863
  bodyText,
@@ -1003,15 +890,7 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
1003
890
  throw new Error(`Space not found: ${contextSpaceId}`);
1004
891
  }
1005
892
  spaceKey = meta.spaceKey;
1006
- invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, {
1007
- F: __dxlog_file6,
1008
- L: 117,
1009
- S: void 0,
1010
- A: [
1011
- "!meta.rootDocumentId.startsWith('automerge:')",
1012
- ""
1013
- ]
1014
- });
893
+ invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 109, S: void 0, A: ["!meta.rootDocumentId.startsWith('automerge:')", ""] });
1015
894
  rootUrl = `automerge:${meta.rootDocumentId}`;
1016
895
  }
1017
896
  return {
@@ -1028,10 +907,10 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
1028
907
  };
1029
908
 
1030
909
  // src/logger.ts
1031
- import { LogLevel, log as log5, shouldLog } from "@dxos/log";
910
+ import { LogLevel, log as log4, shouldLog } from "@dxos/log";
1032
911
  var setupFunctionsLogger = () => {
1033
- log5.runtimeConfig.processors.length = 0;
1034
- log5.runtimeConfig.processors.push(functionLogProcessor);
912
+ log4.runtimeConfig.processors.length = 0;
913
+ log4.runtimeConfig.processors.push(functionLogProcessor);
1035
914
  };
1036
915
  var functionLogProcessor = (config, entry) => {
1037
916
  if (!shouldLog(entry, config.filters)) {
@@ -1071,6 +950,7 @@ export {
1071
950
  FunctionsClient,
1072
951
  ServiceContainer,
1073
952
  createClientFromEnv,
953
+ createFunctionContext,
1074
954
  setupFunctionsLogger,
1075
955
  wrapHandlerForCloudflare
1076
956
  };