@dxos/functions-runtime-cloudflare 0.8.4-main.3eb6e50203 → 0.8.4-main.422d1c7879
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +85 -166
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +85 -166
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/functions-client.d.ts.map +1 -1
- package/dist/types/src/internal/data-service-impl.d.ts +1 -1
- package/dist/types/src/internal/data-service-impl.d.ts.map +1 -1
- package/dist/types/src/internal/query-service-impl.d.ts +3 -9
- package/dist/types/src/internal/query-service-impl.d.ts.map +1 -1
- package/dist/types/src/internal/queue-service-impl.d.ts +3 -2
- package/dist/types/src/internal/queue-service-impl.d.ts.map +1 -1
- package/dist/types/src/internal/service-container.d.ts +1 -1
- package/dist/types/src/internal/service-container.d.ts.map +1 -1
- package/dist/types/src/queues-api.d.ts +7 -3
- package/dist/types/src/queues-api.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/functions-client.ts +1 -1
- package/src/internal/data-service-impl.ts +3 -2
- package/src/internal/query-service-impl.ts +8 -62
- package/src/internal/queue-service-impl.ts +5 -1
- package/src/internal/service-container.ts +2 -2
- package/src/logger.ts +10 -8
- package/src/queues-api.ts +23 -4
- package/src/space-proxy.ts +1 -1
- package/dist/types/src/internal/adapter.d.ts +0 -12
- package/dist/types/src/internal/adapter.d.ts.map +0 -1
- package/src/internal/adapter.ts +0 -48
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/functions-client.ts
|
|
2
2
|
import { Resource as Resource2 } from "@dxos/context";
|
|
3
3
|
import { EchoClient } from "@dxos/echo-db";
|
|
4
|
-
import { invariant as
|
|
4
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
5
5
|
|
|
6
6
|
// src/internal/data-service-impl.ts
|
|
7
7
|
import { Stream } from "@dxos/codec-protobuf/stream";
|
|
@@ -180,10 +180,16 @@ var DataServiceImpl = class {
|
|
|
180
180
|
hasError: false
|
|
181
181
|
};
|
|
182
182
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
+
});
|
|
192
|
+
const response = _ts_add_disposable_resource(env, await this._dataService.createDocument(this._executionContext, spaceId, initialValue), false);
|
|
187
193
|
return {
|
|
188
194
|
documentId: response.documentId
|
|
189
195
|
};
|
|
@@ -235,7 +241,7 @@ var DataServiceImpl = class {
|
|
|
235
241
|
async updateIndexes() {
|
|
236
242
|
log.error("updateIndexes is not available in EDGE env.", void 0, {
|
|
237
243
|
F: __dxlog_file,
|
|
238
|
-
L:
|
|
244
|
+
L: 134,
|
|
239
245
|
S: this,
|
|
240
246
|
C: (f, a) => f(...a)
|
|
241
247
|
});
|
|
@@ -248,83 +254,9 @@ var DataServiceImpl = class {
|
|
|
248
254
|
};
|
|
249
255
|
|
|
250
256
|
// src/internal/query-service-impl.ts
|
|
251
|
-
import * as Schema from "effect/Schema";
|
|
252
257
|
import { Stream as Stream2 } from "@dxos/codec-protobuf/stream";
|
|
253
|
-
import { QueryAST } from "@dxos/echo-protocol";
|
|
254
258
|
import { NotImplementedError as NotImplementedError2, RuntimeServiceError as RuntimeServiceError2 } from "@dxos/errors";
|
|
255
|
-
import { invariant as invariant3 } from "@dxos/invariant";
|
|
256
|
-
import { PublicKey } from "@dxos/keys";
|
|
257
|
-
import { SpaceId as SpaceId3 } from "@dxos/keys";
|
|
258
259
|
import { log as log2 } from "@dxos/log";
|
|
259
|
-
|
|
260
|
-
// src/internal/adapter.ts
|
|
261
|
-
import { failUndefined } from "@dxos/debug";
|
|
262
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
263
|
-
import { SpaceId as SpaceId2 } from "@dxos/keys";
|
|
264
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/adapter.ts";
|
|
265
|
-
var queryToDataServiceRequest = (query) => {
|
|
266
|
-
const { filter, options } = isSimpleSelectionQuery(query) ?? failUndefined();
|
|
267
|
-
invariant2(options?.spaceIds?.length === 1, "Only one space is supported", {
|
|
268
|
-
F: __dxlog_file2,
|
|
269
|
-
L: 13,
|
|
270
|
-
S: void 0,
|
|
271
|
-
A: [
|
|
272
|
-
"options?.spaceIds?.length === 1",
|
|
273
|
-
"'Only one space is supported'"
|
|
274
|
-
]
|
|
275
|
-
});
|
|
276
|
-
invariant2(filter.type === "object", "Only object filters are supported", {
|
|
277
|
-
F: __dxlog_file2,
|
|
278
|
-
L: 14,
|
|
279
|
-
S: void 0,
|
|
280
|
-
A: [
|
|
281
|
-
"filter.type === 'object'",
|
|
282
|
-
"'Only object filters are supported'"
|
|
283
|
-
]
|
|
284
|
-
});
|
|
285
|
-
const spaceId = options.spaceIds[0];
|
|
286
|
-
invariant2(SpaceId2.isValid(spaceId), void 0, {
|
|
287
|
-
F: __dxlog_file2,
|
|
288
|
-
L: 17,
|
|
289
|
-
S: void 0,
|
|
290
|
-
A: [
|
|
291
|
-
"SpaceId.isValid(spaceId)",
|
|
292
|
-
""
|
|
293
|
-
]
|
|
294
|
-
});
|
|
295
|
-
return {
|
|
296
|
-
spaceId,
|
|
297
|
-
type: filter.typename ?? void 0,
|
|
298
|
-
objectIds: [
|
|
299
|
-
...filter.id ?? []
|
|
300
|
-
]
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
var isSimpleSelectionQuery = (query) => {
|
|
304
|
-
switch (query.type) {
|
|
305
|
-
case "options": {
|
|
306
|
-
const maybeFilter = isSimpleSelectionQuery(query.query);
|
|
307
|
-
if (!maybeFilter) {
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
return {
|
|
311
|
-
filter: maybeFilter.filter,
|
|
312
|
-
options: query.options
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
case "select": {
|
|
316
|
-
return {
|
|
317
|
-
filter: query.filter,
|
|
318
|
-
options: void 0
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
default: {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// src/internal/query-service-impl.ts
|
|
328
260
|
function _ts_add_disposable_resource2(env, value, async) {
|
|
329
261
|
if (value !== null && value !== void 0) {
|
|
330
262
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
@@ -390,7 +322,7 @@ function _ts_dispose_resources2(env) {
|
|
|
390
322
|
return next();
|
|
391
323
|
})(env);
|
|
392
324
|
}
|
|
393
|
-
var
|
|
325
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/internal/query-service-impl.ts";
|
|
394
326
|
var QueryServiceImpl = class {
|
|
395
327
|
_executionContext;
|
|
396
328
|
_dataService;
|
|
@@ -403,23 +335,11 @@ var QueryServiceImpl = class {
|
|
|
403
335
|
log2.info("execQuery", {
|
|
404
336
|
request
|
|
405
337
|
}, {
|
|
406
|
-
F:
|
|
407
|
-
L:
|
|
338
|
+
F: __dxlog_file2,
|
|
339
|
+
L: 20,
|
|
408
340
|
S: this,
|
|
409
341
|
C: (f, a) => f(...a)
|
|
410
342
|
});
|
|
411
|
-
const query = QueryAST.Query.pipe(Schema.decodeUnknownSync)(JSON.parse(request.query));
|
|
412
|
-
const requestedSpaceIds = getTargetSpacesForQuery(query);
|
|
413
|
-
invariant3(requestedSpaceIds.length === 1, "Only one space is supported", {
|
|
414
|
-
F: __dxlog_file3,
|
|
415
|
-
L: 37,
|
|
416
|
-
S: this,
|
|
417
|
-
A: [
|
|
418
|
-
"requestedSpaceIds.length === 1",
|
|
419
|
-
"'Only one space is supported'"
|
|
420
|
-
]
|
|
421
|
-
});
|
|
422
|
-
const spaceId = requestedSpaceIds[0];
|
|
423
343
|
return Stream2.fromPromise((async () => {
|
|
424
344
|
try {
|
|
425
345
|
const env = {
|
|
@@ -430,37 +350,23 @@ var QueryServiceImpl = class {
|
|
|
430
350
|
try {
|
|
431
351
|
this._queryCount++;
|
|
432
352
|
log2.info("begin query", {
|
|
433
|
-
|
|
353
|
+
request
|
|
434
354
|
}, {
|
|
435
|
-
F:
|
|
436
|
-
L:
|
|
355
|
+
F: __dxlog_file2,
|
|
356
|
+
L: 26,
|
|
437
357
|
S: this,
|
|
438
358
|
C: (f, a) => f(...a)
|
|
439
359
|
});
|
|
440
|
-
const queryResponse = _ts_add_disposable_resource2(env, await this._dataService.
|
|
360
|
+
const queryResponse = _ts_add_disposable_resource2(env, await this._dataService.execQuery(this._executionContext, request), false);
|
|
441
361
|
log2.info("query response", {
|
|
442
|
-
|
|
443
|
-
filter: request.filter,
|
|
444
|
-
resultCount: queryResponse.results.length
|
|
362
|
+
resultCount: queryResponse.results?.length
|
|
445
363
|
}, {
|
|
446
|
-
F:
|
|
447
|
-
L:
|
|
364
|
+
F: __dxlog_file2,
|
|
365
|
+
L: 28,
|
|
448
366
|
S: this,
|
|
449
367
|
C: (f, a) => f(...a)
|
|
450
368
|
});
|
|
451
|
-
return
|
|
452
|
-
results: queryResponse.results.map((object) => ({
|
|
453
|
-
id: object.objectId,
|
|
454
|
-
spaceId,
|
|
455
|
-
spaceKey: PublicKey.ZERO,
|
|
456
|
-
documentId: object.document.documentId,
|
|
457
|
-
// Rank 1 for predicate matches where ranking is not determined.
|
|
458
|
-
rank: 1,
|
|
459
|
-
// Copy returned object to avoid hanging RPC stub.
|
|
460
|
-
// See https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/
|
|
461
|
-
documentAutomerge: copyUint8Array(object.document.data)
|
|
462
|
-
}))
|
|
463
|
-
};
|
|
369
|
+
return structuredClone(queryResponse);
|
|
464
370
|
} catch (e) {
|
|
465
371
|
env.error = e;
|
|
466
372
|
env.hasError = true;
|
|
@@ -471,16 +377,14 @@ var QueryServiceImpl = class {
|
|
|
471
377
|
log2.error("query failed", {
|
|
472
378
|
err: error
|
|
473
379
|
}, {
|
|
474
|
-
F:
|
|
475
|
-
L:
|
|
380
|
+
F: __dxlog_file2,
|
|
381
|
+
L: 31,
|
|
476
382
|
S: this,
|
|
477
383
|
C: (f, a) => f(...a)
|
|
478
384
|
});
|
|
479
385
|
throw new RuntimeServiceError2({
|
|
480
386
|
message: `Query execution failed (queryCount=${this._queryCount})`,
|
|
481
387
|
context: {
|
|
482
|
-
spaceId,
|
|
483
|
-
filter: request.filter,
|
|
484
388
|
queryCount: this._queryCount
|
|
485
389
|
},
|
|
486
390
|
cause: error
|
|
@@ -499,22 +403,6 @@ var QueryServiceImpl = class {
|
|
|
499
403
|
});
|
|
500
404
|
}
|
|
501
405
|
};
|
|
502
|
-
var getTargetSpacesForQuery = (query) => {
|
|
503
|
-
const spaces = /* @__PURE__ */ new Set();
|
|
504
|
-
const visitor = (node) => {
|
|
505
|
-
if (node.type === "options") {
|
|
506
|
-
if (node.options.spaceIds) {
|
|
507
|
-
for (const spaceId of node.options.spaceIds) {
|
|
508
|
-
spaces.add(SpaceId3.make(spaceId));
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
QueryAST.visit(query, visitor);
|
|
514
|
-
return [
|
|
515
|
-
...spaces
|
|
516
|
-
];
|
|
517
|
-
};
|
|
518
406
|
|
|
519
407
|
// src/internal/queue-service-impl.ts
|
|
520
408
|
import { RuntimeServiceError as RuntimeServiceError3 } from "@dxos/errors";
|
|
@@ -679,6 +567,8 @@ var QueueServiceImpl = class {
|
|
|
679
567
|
})(error);
|
|
680
568
|
}
|
|
681
569
|
}
|
|
570
|
+
async syncQueue(_) {
|
|
571
|
+
}
|
|
682
572
|
};
|
|
683
573
|
|
|
684
574
|
// src/internal/service-container.ts
|
|
@@ -819,17 +709,19 @@ var ServiceContainer = class {
|
|
|
819
709
|
subspaceTag,
|
|
820
710
|
spaceId,
|
|
821
711
|
queueId,
|
|
822
|
-
objects
|
|
712
|
+
objects: objects.map((obj) => JSON.stringify(obj))
|
|
823
713
|
});
|
|
824
714
|
}
|
|
825
715
|
};
|
|
826
716
|
|
|
827
717
|
// src/space-proxy.ts
|
|
828
718
|
import { Resource } from "@dxos/context";
|
|
829
|
-
import { invariant as
|
|
830
|
-
import { PublicKey
|
|
719
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
720
|
+
import { PublicKey } from "@dxos/keys";
|
|
831
721
|
|
|
832
722
|
// 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";
|
|
833
725
|
var QueuesAPIImpl = class {
|
|
834
726
|
_serviceContainer;
|
|
835
727
|
_spaceId;
|
|
@@ -837,8 +729,31 @@ var QueuesAPIImpl = class {
|
|
|
837
729
|
this._serviceContainer = _serviceContainer;
|
|
838
730
|
this._spaceId = _spaceId;
|
|
839
731
|
}
|
|
840
|
-
queryQueue(queue, options) {
|
|
841
|
-
|
|
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
|
+
};
|
|
842
757
|
}
|
|
843
758
|
insertIntoQueue(queue, objects) {
|
|
844
759
|
return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));
|
|
@@ -861,7 +776,7 @@ var SpaceProxy = class extends Resource {
|
|
|
861
776
|
return this._id;
|
|
862
777
|
}
|
|
863
778
|
get db() {
|
|
864
|
-
|
|
779
|
+
invariant2(this._db, void 0, {
|
|
865
780
|
F: __dxlog_file4,
|
|
866
781
|
L: 35,
|
|
867
782
|
S: this,
|
|
@@ -876,7 +791,7 @@ var SpaceProxy = class extends Resource {
|
|
|
876
791
|
* @deprecated Use db API.
|
|
877
792
|
*/
|
|
878
793
|
get crud() {
|
|
879
|
-
|
|
794
|
+
invariant2(this._db, void 0, {
|
|
880
795
|
F: __dxlog_file4,
|
|
881
796
|
L: 43,
|
|
882
797
|
S: this,
|
|
@@ -897,11 +812,11 @@ var SpaceProxy = class extends Resource {
|
|
|
897
812
|
}
|
|
898
813
|
this._db = this._echoClient.constructDatabase({
|
|
899
814
|
spaceId: this._id,
|
|
900
|
-
spaceKey:
|
|
815
|
+
spaceKey: PublicKey.from(meta.spaceKey),
|
|
901
816
|
reactiveSchemaQuery: false,
|
|
902
817
|
owningObject: this
|
|
903
818
|
});
|
|
904
|
-
await this._db.coreDatabase.open({
|
|
819
|
+
await this._db.coreDatabase.open(this._ctx, {
|
|
905
820
|
rootUrl: meta.rootDocumentId
|
|
906
821
|
});
|
|
907
822
|
}
|
|
@@ -916,7 +831,7 @@ var FunctionsClient = class extends Resource2 {
|
|
|
916
831
|
_spaces = /* @__PURE__ */ new Map();
|
|
917
832
|
constructor(services) {
|
|
918
833
|
super();
|
|
919
|
-
|
|
834
|
+
invariant3(typeof services.dataService !== "undefined", "DataService is required", {
|
|
920
835
|
F: __dxlog_file5,
|
|
921
836
|
L: 33,
|
|
922
837
|
S: this,
|
|
@@ -925,7 +840,7 @@ var FunctionsClient = class extends Resource2 {
|
|
|
925
840
|
"'DataService is required'"
|
|
926
841
|
]
|
|
927
842
|
});
|
|
928
|
-
|
|
843
|
+
invariant3(typeof services.queueService !== "undefined", "QueueService is required", {
|
|
929
844
|
F: __dxlog_file5,
|
|
930
845
|
L: 34,
|
|
931
846
|
S: this,
|
|
@@ -983,9 +898,9 @@ var FunctionRouteValue = /* @__PURE__ */ (function(FunctionRouteValue2) {
|
|
|
983
898
|
})({});
|
|
984
899
|
|
|
985
900
|
// src/wrap-handler-for-cloudflare.ts
|
|
986
|
-
import { invariant as
|
|
987
|
-
import { SpaceId as
|
|
988
|
-
import { log as
|
|
901
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
902
|
+
import { SpaceId as SpaceId2 } from "@dxos/keys";
|
|
903
|
+
import { log as log4 } from "@dxos/log";
|
|
989
904
|
import { EdgeResponse } from "@dxos/protocols";
|
|
990
905
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/functions-runtime-cloudflare/src/wrap-handler-for-cloudflare.ts";
|
|
991
906
|
var wrapHandlerForCloudflare = (func) => {
|
|
@@ -996,7 +911,7 @@ var wrapHandlerForCloudflare = (func) => {
|
|
|
996
911
|
try {
|
|
997
912
|
const spaceId = new URL(request.url).searchParams.get("spaceId");
|
|
998
913
|
if (spaceId) {
|
|
999
|
-
if (!
|
|
914
|
+
if (!SpaceId2.isValid(spaceId)) {
|
|
1000
915
|
return new Response("Invalid spaceId", {
|
|
1001
916
|
status: 400
|
|
1002
917
|
});
|
|
@@ -1009,7 +924,7 @@ var wrapHandlerForCloudflare = (func) => {
|
|
|
1009
924
|
});
|
|
1010
925
|
return EdgeResponse.success(await invokeFunction(func, context, request));
|
|
1011
926
|
} catch (error) {
|
|
1012
|
-
|
|
927
|
+
log4.error("error invoking function", {
|
|
1013
928
|
error,
|
|
1014
929
|
stack: error.stack
|
|
1015
930
|
}, {
|
|
@@ -1050,7 +965,7 @@ var decodeRequest = async (request) => {
|
|
|
1050
965
|
}
|
|
1051
966
|
};
|
|
1052
967
|
} catch (err) {
|
|
1053
|
-
|
|
968
|
+
log4.catch(err, void 0, {
|
|
1054
969
|
F: __dxlog_file6,
|
|
1055
970
|
L: 79,
|
|
1056
971
|
S: void 0,
|
|
@@ -1088,7 +1003,7 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
|
|
|
1088
1003
|
throw new Error(`Space not found: ${contextSpaceId}`);
|
|
1089
1004
|
}
|
|
1090
1005
|
spaceKey = meta.spaceKey;
|
|
1091
|
-
|
|
1006
|
+
invariant4(!meta.rootDocumentId.startsWith("automerge:"), void 0, {
|
|
1092
1007
|
F: __dxlog_file6,
|
|
1093
1008
|
L: 117,
|
|
1094
1009
|
S: void 0,
|
|
@@ -1113,36 +1028,40 @@ var createFunctionContext = async ({ serviceContainer, contextSpaceId }) => {
|
|
|
1113
1028
|
};
|
|
1114
1029
|
|
|
1115
1030
|
// src/logger.ts
|
|
1116
|
-
import { LogLevel, log as
|
|
1031
|
+
import { LogLevel, log as log5, shouldLog } from "@dxos/log";
|
|
1117
1032
|
var setupFunctionsLogger = () => {
|
|
1118
|
-
|
|
1119
|
-
|
|
1033
|
+
log5.runtimeConfig.processors.length = 0;
|
|
1034
|
+
log5.runtimeConfig.processors.push(functionLogProcessor);
|
|
1120
1035
|
};
|
|
1121
1036
|
var functionLogProcessor = (config, entry) => {
|
|
1122
1037
|
if (!shouldLog(entry, config.filters)) {
|
|
1123
1038
|
return;
|
|
1124
1039
|
}
|
|
1040
|
+
const context = entry.computedContext;
|
|
1041
|
+
const error = entry.computedError;
|
|
1042
|
+
const extras = [
|
|
1043
|
+
Object.keys(context).length > 0 ? context : void 0,
|
|
1044
|
+
error
|
|
1045
|
+
].filter((value) => value !== void 0);
|
|
1125
1046
|
switch (entry.level) {
|
|
1126
1047
|
case LogLevel.DEBUG:
|
|
1127
|
-
console.debug(entry.message, entry.context);
|
|
1128
|
-
break;
|
|
1129
1048
|
case LogLevel.TRACE:
|
|
1130
|
-
console.debug(entry.message,
|
|
1049
|
+
console.debug(entry.message, ...extras);
|
|
1131
1050
|
break;
|
|
1132
1051
|
case LogLevel.VERBOSE:
|
|
1133
|
-
console.log(entry.message,
|
|
1052
|
+
console.log(entry.message, ...extras);
|
|
1134
1053
|
break;
|
|
1135
1054
|
case LogLevel.INFO:
|
|
1136
|
-
console.info(entry.message,
|
|
1055
|
+
console.info(entry.message, ...extras);
|
|
1137
1056
|
break;
|
|
1138
1057
|
case LogLevel.WARN:
|
|
1139
|
-
console.warn(entry.message,
|
|
1058
|
+
console.warn(entry.message, ...extras);
|
|
1140
1059
|
break;
|
|
1141
1060
|
case LogLevel.ERROR:
|
|
1142
|
-
console.error(entry.message,
|
|
1061
|
+
console.error(entry.message, ...extras);
|
|
1143
1062
|
break;
|
|
1144
1063
|
default:
|
|
1145
|
-
console.log(entry.message,
|
|
1064
|
+
console.log(entry.message, ...extras);
|
|
1146
1065
|
break;
|
|
1147
1066
|
}
|
|
1148
1067
|
};
|