@dxos/functions-runtime-cloudflare 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8

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.
Files changed (36) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/index.mjs +58 -157
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/index.mjs +58 -157
  7. package/dist/lib/node-esm/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/meta.json +1 -1
  9. package/dist/types/src/functions-client.d.ts +1 -6
  10. package/dist/types/src/functions-client.d.ts.map +1 -1
  11. package/dist/types/src/internal/data-service-impl.d.ts.map +1 -1
  12. package/dist/types/src/internal/query-service-impl.d.ts.map +1 -1
  13. package/dist/types/src/internal/queue-service-impl.d.ts +1 -0
  14. package/dist/types/src/internal/queue-service-impl.d.ts.map +1 -1
  15. package/dist/types/src/internal/service-container.d.ts +5 -5
  16. package/dist/types/src/internal/service-container.d.ts.map +1 -1
  17. package/dist/types/src/internal/utils.d.ts.map +1 -1
  18. package/dist/types/src/queues-api.d.ts +11 -6
  19. package/dist/types/src/queues-api.d.ts.map +1 -1
  20. package/dist/types/src/space-proxy.d.ts +1 -5
  21. package/dist/types/src/space-proxy.d.ts.map +1 -1
  22. package/dist/types/src/types.d.ts +1 -1
  23. package/dist/types/src/types.d.ts.map +1 -1
  24. package/dist/types/src/wrap-handler-for-cloudflare.d.ts +6 -0
  25. package/dist/types/src/wrap-handler-for-cloudflare.d.ts.map +1 -1
  26. package/dist/types/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +16 -16
  28. package/src/functions-client.ts +1 -7
  29. package/src/internal/data-service-impl.ts +6 -1
  30. package/src/internal/queue-service-impl.ts +4 -0
  31. package/src/internal/service-container.ts +17 -16
  32. package/src/logger.ts +10 -8
  33. package/src/queues-api.ts +12 -6
  34. package/src/space-proxy.ts +4 -11
  35. package/src/types.ts +1 -1
  36. package/src/wrap-handler-for-cloudflare.ts +2 -2
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
@@ -1,8 +1,11 @@
1
1
  // src/functions-client.ts
2
2
  import { Resource as Resource2 } from "@dxos/context";
3
- import { EchoClient } from "@dxos/echo-db";
3
+ import { EchoClient } from "@dxos/echo-client";
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,16 +654,16 @@ 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
- objects
666
+ objects: objects.map((obj) => JSON.stringify(obj))
713
667
  });
714
668
  }
715
669
  };
@@ -736,7 +690,7 @@ var QueuesAPIImpl = class {
736
690
  };
737
691
 
738
692
  // src/space-proxy.ts
739
- var __dxlog_file3 = "/__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";
740
694
  var SpaceProxy = class extends Resource {
741
695
  _serviceContainer;
742
696
  _echoClient;
@@ -751,32 +705,9 @@ var SpaceProxy = class extends Resource {
751
705
  return this._id;
752
706
  }
753
707
  get db() {
754
- invariant2(this._db, void 0, {
755
- F: __dxlog_file3,
756
- L: 35,
757
- S: this,
758
- A: [
759
- "this._db",
760
- ""
761
- ]
762
- });
708
+ invariant2(this._db, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 24, S: this, A: ["this._db", ""] });
763
709
  return this._db;
764
710
  }
765
- /**
766
- * @deprecated Use db API.
767
- */
768
- get crud() {
769
- invariant2(this._db, void 0, {
770
- F: __dxlog_file3,
771
- L: 43,
772
- S: this,
773
- A: [
774
- "this._db",
775
- ""
776
- ]
777
- });
778
- return this._db.coreDatabase;
779
- }
780
711
  get queues() {
781
712
  return this._queuesApi;
782
713
  }
@@ -791,14 +722,13 @@ var SpaceProxy = class extends Resource {
791
722
  reactiveSchemaQuery: false,
792
723
  owningObject: this
793
724
  });
794
- await this._db.coreDatabase.open(this._ctx, {
795
- rootUrl: meta.rootDocumentId
796
- });
725
+ await this._db.setSpaceRoot(meta.rootDocumentId);
726
+ await this._db.open(this._ctx);
797
727
  }
798
728
  };
799
729
 
800
730
  // src/functions-client.ts
801
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/functions-client.ts";
731
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/functions-client.ts";
802
732
  var FunctionsClient = class extends Resource2 {
803
733
  _serviceContainer;
804
734
  _echoClient;
@@ -806,24 +736,8 @@ var FunctionsClient = class extends Resource2 {
806
736
  _spaces = /* @__PURE__ */ new Map();
807
737
  constructor(services) {
808
738
  super();
809
- invariant3(typeof services.dataService !== "undefined", "DataService is required", {
810
- F: __dxlog_file4,
811
- L: 33,
812
- S: this,
813
- A: [
814
- "typeof services.dataService !== 'undefined'",
815
- "'DataService is required'"
816
- ]
817
- });
818
- invariant3(typeof services.queueService !== "undefined", "QueueService is required", {
819
- F: __dxlog_file4,
820
- L: 34,
821
- S: this,
822
- A: [
823
- "typeof services.queueService !== 'undefined'",
824
- "'QueueService is required'"
825
- ]
826
- });
739
+ 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'"] });
740
+ 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'"] });
827
741
  this._serviceContainer = new ServiceContainer(this._executionContext, services.dataService, services.queueService, services.functionsAiService);
828
742
  this._echoClient = new EchoClient({});
829
743
  }
@@ -877,7 +791,7 @@ import { invariant as invariant4 } from "@dxos/invariant";
877
791
  import { SpaceId as SpaceId2 } from "@dxos/keys";
878
792
  import { log as log3 } from "@dxos/log";
879
793
  import { EdgeResponse } from "@dxos/protocols";
880
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
794
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/core/compute/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
881
795
  var wrapHandlerForCloudflare = (func) => {
882
796
  return async (request, env) => {
883
797
  if (request.headers.get(FUNCTION_ROUTE_HEADER) === FunctionRouteValue.Meta) {
@@ -902,12 +816,7 @@ var wrapHandlerForCloudflare = (func) => {
902
816
  log3.error("error invoking function", {
903
817
  error,
904
818
  stack: error.stack
905
- }, {
906
- F: __dxlog_file5,
907
- L: 44,
908
- S: void 0,
909
- C: (f, a) => f(...a)
910
- });
819
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 37, S: void 0 });
911
820
  return EdgeResponse.failure({
912
821
  message: error?.message ?? "Internal error",
913
822
  error
@@ -940,12 +849,7 @@ var decodeRequest = async (request) => {
940
849
  }
941
850
  };
942
851
  } catch (err) {
943
- log3.catch(err, void 0, {
944
- F: __dxlog_file5,
945
- L: 79,
946
- S: void 0,
947
- C: (f, a) => f(...a)
948
- });
852
+ log3.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 76, S: void 0 });
949
853
  return {
950
854
  data: {
951
855
  bodyText,
@@ -978,15 +882,7 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
978
882
  throw new Error(`Space not found: ${contextSpaceId}`);
979
883
  }
980
884
  spaceKey = meta.spaceKey;
981
- invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, {
982
- F: __dxlog_file5,
983
- L: 117,
984
- S: void 0,
985
- A: [
986
- "!meta.rootDocumentId.startsWith('automerge:')",
987
- ""
988
- ]
989
- });
885
+ invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 109, S: void 0, A: ["!meta.rootDocumentId.startsWith('automerge:')", ""] });
990
886
  rootUrl = `automerge:${meta.rootDocumentId}`;
991
887
  }
992
888
  return {
@@ -1012,27 +908,31 @@ var functionLogProcessor = (config, entry) => {
1012
908
  if (!shouldLog(entry, config.filters)) {
1013
909
  return;
1014
910
  }
911
+ const context = entry.computedContext;
912
+ const error = entry.computedError;
913
+ const extras = [
914
+ Object.keys(context).length > 0 ? context : void 0,
915
+ error
916
+ ].filter((value) => value !== void 0);
1015
917
  switch (entry.level) {
1016
918
  case LogLevel.DEBUG:
1017
- console.debug(entry.message, entry.context);
1018
- break;
1019
919
  case LogLevel.TRACE:
1020
- console.debug(entry.message, entry.context);
920
+ console.debug(entry.message, ...extras);
1021
921
  break;
1022
922
  case LogLevel.VERBOSE:
1023
- console.log(entry.message, entry.context);
923
+ console.log(entry.message, ...extras);
1024
924
  break;
1025
925
  case LogLevel.INFO:
1026
- console.info(entry.message, entry.context);
926
+ console.info(entry.message, ...extras);
1027
927
  break;
1028
928
  case LogLevel.WARN:
1029
- console.warn(entry.message, entry.context);
929
+ console.warn(entry.message, ...extras);
1030
930
  break;
1031
931
  case LogLevel.ERROR:
1032
- console.error(entry.message, entry.context);
932
+ console.error(entry.message, ...extras);
1033
933
  break;
1034
934
  default:
1035
- console.log(entry.message, entry.context);
935
+ console.log(entry.message, ...extras);
1036
936
  break;
1037
937
  }
1038
938
  };
@@ -1042,6 +942,7 @@ export {
1042
942
  FunctionsClient,
1043
943
  ServiceContainer,
1044
944
  createClientFromEnv,
945
+ createFunctionContext,
1045
946
  setupFunctionsLogger,
1046
947
  wrapHandlerForCloudflare
1047
948
  };