@dxos/functions-testing 0.8.4-main.ef1bc66f44 → 0.8.4-main.fcfe5033a5

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.
@@ -1 +1 @@
1
- {"inputs":{"src/index.ts":{"bytes":414,"imports":[],"format":"esm"},"src/testing/util.ts":{"bytes":15297,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"format":"esm"},"src/testing/index.ts":{"bytes":458,"imports":[{"path":"src/testing/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":127},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8253},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"exports":["deployFunction","observeInvocations","setup","sync","writeBundle"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/util.ts":{"bytesInOutput":3620},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":3854}}}
1
+ {"inputs":{"src/index.ts":{"bytes":414,"imports":[],"format":"esm"},"src/testing/util.ts":{"bytes":16028,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"format":"esm"},"src/testing/index.ts":{"bytes":458,"imports":[{"path":"src/testing/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":127},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8422},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"exports":["deployFunction","observeInvocations","setup","sync","writeBundle"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/util.ts":{"bytesInOutput":3917},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":4151}}}
@@ -4,14 +4,16 @@ import { createRequire } from 'node:module';const require = createRequire(import
4
4
  import fs from "node:fs";
5
5
  import { sleep } from "@dxos/async";
6
6
  import { Client } from "@dxos/client";
7
- import { Filter, Obj, Query } from "@dxos/echo";
8
- import { Function } from "@dxos/functions";
7
+ import { Context } from "@dxos/context";
8
+ import { Feed, Obj } from "@dxos/echo";
9
9
  import { Trigger } from "@dxos/functions";
10
10
  import { InvocationTraceEndEvent, InvocationTraceStartEvent } from "@dxos/functions-runtime";
11
11
  import { FunctionsServiceClient } from "@dxos/functions-runtime/edge";
12
12
  import { bundleFunction } from "@dxos/functions-runtime/native";
13
+ import { Operation } from "@dxos/operation";
13
14
  import { ErrorCodec } from "@dxos/protocols";
14
15
  import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
16
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/functions-testing/src/testing/util.ts";
15
17
  var writeBundle = (path, bundle) => {
16
18
  fs.mkdirSync(path, {
17
19
  recursive: true
@@ -24,7 +26,7 @@ var setup = async (config) => {
24
26
  const client = await new Client({
25
27
  config,
26
28
  types: [
27
- Function.Function,
29
+ Operation.PersistentOperation,
28
30
  Trigger.Trigger
29
31
  ]
30
32
  }).initialize();
@@ -40,9 +42,7 @@ var setup = async (config) => {
40
42
  };
41
43
  };
42
44
  var sync = async (space) => {
43
- await space.db.flush({
44
- indexes: true
45
- });
45
+ await space.db.flush();
46
46
  await space.internal.syncToEdge({
47
47
  onProgress: (state) => console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : "connecting to edge...")
48
48
  });
@@ -52,7 +52,10 @@ var deployFunction = async (space, functionsServiceClient, entryPoint, runtime)
52
52
  entryPoint,
53
53
  verbose: true
54
54
  });
55
- const func = await functionsServiceClient.deploy({
55
+ const func = await functionsServiceClient.deploy(Context.default(void 0, {
56
+ F: __dxlog_file,
57
+ L: 62
58
+ }), {
56
59
  version: "0.0.1",
57
60
  ownerPublicKey: space.key,
58
61
  entryPoint: artifact.entryPoint,
@@ -68,7 +71,9 @@ var observeInvocations = async (space, maxCount) => {
68
71
  let count = 0;
69
72
  while (true) {
70
73
  try {
71
- const invocations = await space.properties.invocationTraceQueue?.target.query(Query.select(Filter.everything())).run() ?? [];
74
+ const traceFeed = space.properties.invocationTraceFeed?.target;
75
+ const traceQueueDxn = traceFeed ? Feed.getQueueDxn(traceFeed) : void 0;
76
+ const invocations = traceQueueDxn ? await space.queues.get(traceQueueDxn).queryObjects() ?? [] : [];
72
77
  for (const invocation of invocations) {
73
78
  if (Obj.instanceOf(InvocationTraceStartEvent, invocation)) {
74
79
  if (invocationData.has(invocation.invocationId)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/testing/util.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport fs from 'node:fs';\n\nimport { sleep } from '@dxos/async';\nimport { Client, type Config } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { Filter, Obj, Query } from '@dxos/echo';\nimport { Function } from '@dxos/functions';\nimport { Trigger } from '@dxos/functions';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent } from '@dxos/functions-runtime';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\nimport { bundleFunction } from '@dxos/functions-runtime/native';\nimport type { BundleResult } from '@dxos/functions-runtime/native';\nimport { ErrorCodec, type FunctionRuntimeKind } from '@dxos/protocols';\nimport { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';\n\nexport const writeBundle = (path: string, bundle: BundleResult) => {\n fs.mkdirSync(path, { recursive: true });\n Object.entries(bundle.assets).forEach(([name, content]) => {\n fs.writeFileSync(path + '/' + name, content);\n });\n};\n\nexport const setup = async (config: Config) => {\n const client = await new Client({\n config,\n types: [Function.Function, Trigger.Trigger],\n }).initialize();\n await client.halo.createIdentity();\n\n const space = await client.spaces.create();\n await space.waitUntilReady();\n await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);\n\n const functionsServiceClient = FunctionsServiceClient.fromClient(client);\n\n return { client, space, functionsServiceClient };\n};\n\nexport const sync = async (space: Space) => {\n await space.db.flush({ indexes: true });\n await space.internal.syncToEdge({\n onProgress: (state) =>\n console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),\n });\n};\n\nexport const deployFunction = async (\n space: Space,\n functionsServiceClient: FunctionsServiceClient,\n entryPoint: string,\n runtime: FunctionRuntimeKind,\n) => {\n const artifact = await bundleFunction({\n entryPoint,\n verbose: true,\n });\n const func = await functionsServiceClient.deploy({\n version: '0.0.1',\n ownerPublicKey: space.key,\n entryPoint: artifact.entryPoint,\n assets: artifact.assets,\n runtime,\n });\n space.db.add(func);\n\n return func;\n};\n\nexport const observeInvocations = async (space: Space, maxCount: number | null) => {\n let initialCount = null;\n const invocationData = new Map<\n string,\n {\n count: number;\n begin: InvocationTraceStartEvent;\n end?: InvocationTraceEndEvent;\n }\n >();\n let count = 0;\n while (true) {\n try {\n const invocations =\n (await space.properties.invocationTraceQueue?.target!.query(Query.select(Filter.everything())).run()) ?? [];\n\n for (const invocation of invocations) {\n if (Obj.instanceOf(InvocationTraceStartEvent, invocation)) {\n if (invocationData.has(invocation.invocationId)) {\n continue;\n }\n invocationData.set(invocation.invocationId, {\n count: count++,\n begin: invocation,\n });\n console.log(\n `${count.toString().padStart(3, ' ')}: BEGIN ${invocation.runtime ?? '(unknown runtime)'} ${JSON.stringify(invocation.input)}`,\n );\n } else if (Obj.instanceOf(InvocationTraceEndEvent, invocation)) {\n const data = invocationData.get(invocation.invocationId);\n if (!data || !!data.end) {\n continue;\n }\n data.end = invocation;\n\n const outcome = data.end.outcome;\n console.log(\n `${data.count.toString().padStart(3, ' ')}: END outcome=${outcome} duration=${data.end.timestamp - data.begin.timestamp}`,\n );\n if (outcome === 'failure' && data.end.error) {\n console.error(ErrorCodec.decode(data.end.error));\n }\n }\n }\n if (initialCount === null) {\n initialCount = invocations.length;\n }\n\n if (maxCount !== null && invocationData.size >= maxCount + initialCount) {\n break;\n }\n } catch (err) {\n console.error(err);\n }\n await sleep(1_000);\n }\n};\n"],
5
- "mappings": ";;;AAIA,OAAOA,QAAQ;AAEf,SAASC,aAAa;AACtB,SAASC,cAA2B;AAEpC,SAASC,QAAQC,KAAKC,aAAa;AACnC,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,yBAAyBC,iCAAiC;AACnE,SAASC,8BAA8B;AACvC,SAASC,sBAAsB;AAE/B,SAASC,kBAA4C;AACrD,SAASC,8BAA8B;AAEhC,IAAMC,cAAc,CAACC,MAAcC,WAAAA;AACxCC,KAAGC,UAAUH,MAAM;IAAEI,WAAW;EAAK,CAAA;AACrCC,SAAOC,QAAQL,OAAOM,MAAM,EAAEC,QAAQ,CAAC,CAACC,MAAMC,OAAAA,MAAQ;AACpDR,OAAGS,cAAcX,OAAO,MAAMS,MAAMC,OAAAA;EACtC,CAAA;AACF;AAEO,IAAME,QAAQ,OAAOC,WAAAA;AAC1B,QAAMC,SAAS,MAAM,IAAIC,OAAO;IAC9BF;IACAG,OAAO;MAACC,SAASA;MAAUC,QAAQA;;EACrC,CAAA,EAAGC,WAAU;AACb,QAAML,OAAOM,KAAKC,eAAc;AAEhC,QAAMC,QAAQ,MAAMR,OAAOS,OAAOC,OAAM;AACxC,QAAMF,MAAMG,eAAc;AAC1B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AAMmB,SAAQ,EAAGC,SAAS,GAAG,GAAA,CAAA,WAAeT,WAAW1B,WAAW,mBAAA,IAAuBoC,KAAKC,UAAUX,WAAWY,KAAK,CAAA,EAAG;QAElI,WAAWX,IAAIC,WAAWW,yBAAyBb,UAAAA,GAAa;AAC9D,gBAAMc,OAAO3B,eAAe4B,IAAIf,WAAWK,YAAY;AACvD,cAAI,CAACS,QAAQ,CAAC,CAACA,KAAKE,KAAK;AACvB;UACF;AACAF,eAAKE,MAAMhB;AAEX,gBAAMiB,UAAUH,KAAKE,IAAIC;AACzBhD,kBAAQC,IACN,GAAG4C,KAAKzB,MAAMmB,SAAQ,EAAGC,SAAS,GAAG,GAAA,CAAA,iBAAqBQ,OAAAA,aAAoBH,KAAKE,IAAIE,YAAYJ,KAAKP,MAAMW,SAAS,EAAE;AAE3H,cAAID,YAAY,aAAaH,KAAKE,IAAIG,OAAO;AAC3ClD,oBAAQkD,MAAMC,WAAWC,OAAOP,KAAKE,IAAIG,KAAK,CAAA;UAChD;QACF;MACF;AACA,UAAIjC,iBAAiB,MAAM;AACzBA,uBAAeI,YAAYgC;MAC7B;AAEA,UAAIrC,aAAa,QAAQE,eAAeoC,QAAQtC,WAAWC,cAAc;AACvE;MACF;IACF,SAASsC,KAAK;AACZvD,cAAQkD,MAAMK,GAAAA;IAChB;AACA,UAAMC,MAAM,GAAA;EACd;AACF;",
6
- "names": ["fs", "sleep", "Client", "Filter", "Obj", "Query", "Function", "Trigger", "InvocationTraceEndEvent", "InvocationTraceStartEvent", "FunctionsServiceClient", "bundleFunction", "ErrorCodec", "EdgeReplicationSetting", "writeBundle", "path", "bundle", "fs", "mkdirSync", "recursive", "Object", "entries", "assets", "forEach", "name", "content", "writeFileSync", "setup", "config", "client", "Client", "types", "Function", "Trigger", "initialize", "halo", "createIdentity", "space", "spaces", "create", "waitUntilReady", "internal", "setEdgeReplicationPreference", "EdgeReplicationSetting", "ENABLED", "functionsServiceClient", "FunctionsServiceClient", "fromClient", "sync", "db", "flush", "indexes", "syncToEdge", "onProgress", "state", "console", "log", "unsyncedDocumentCount", "deployFunction", "entryPoint", "runtime", "artifact", "bundleFunction", "verbose", "func", "deploy", "version", "ownerPublicKey", "key", "add", "observeInvocations", "maxCount", "initialCount", "invocationData", "Map", "count", "invocations", "properties", "invocationTraceQueue", "target", "query", "Query", "select", "Filter", "everything", "run", "invocation", "Obj", "instanceOf", "InvocationTraceStartEvent", "has", "invocationId", "set", "begin", "toString", "padStart", "JSON", "stringify", "input", "InvocationTraceEndEvent", "data", "get", "end", "outcome", "timestamp", "error", "ErrorCodec", "decode", "length", "size", "err", "sleep"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport fs from 'node:fs';\n\nimport { sleep } from '@dxos/async';\nimport { Client, type Config } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { Context } from '@dxos/context';\nimport { Feed, Obj } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent } from '@dxos/functions-runtime';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\nimport { bundleFunction } from '@dxos/functions-runtime/native';\nimport type { BundleResult } from '@dxos/functions-runtime/native';\nimport { Operation } from '@dxos/operation';\nimport { ErrorCodec, type FunctionRuntimeKind } from '@dxos/protocols';\nimport { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';\n\nexport const writeBundle = (path: string, bundle: BundleResult) => {\n fs.mkdirSync(path, { recursive: true });\n Object.entries(bundle.assets).forEach(([name, content]) => {\n fs.writeFileSync(path + '/' + name, content);\n });\n};\n\nexport const setup = async (config: Config) => {\n const client = await new Client({\n config,\n types: [Operation.PersistentOperation, Trigger.Trigger],\n }).initialize();\n await client.halo.createIdentity();\n\n const space = await client.spaces.create();\n await space.waitUntilReady();\n await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);\n\n const functionsServiceClient = FunctionsServiceClient.fromClient(client);\n\n return { client, space, functionsServiceClient };\n};\n\nexport const sync = async (space: Space) => {\n await space.db.flush();\n await space.internal.syncToEdge({\n onProgress: (state) =>\n console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),\n });\n};\n\nexport const deployFunction = async (\n space: Space,\n functionsServiceClient: FunctionsServiceClient,\n entryPoint: string,\n runtime: FunctionRuntimeKind,\n): Promise<Operation.PersistentOperation> => {\n const artifact = await bundleFunction({\n entryPoint,\n verbose: true,\n });\n const func = await functionsServiceClient.deploy(Context.default(), {\n version: '0.0.1',\n ownerPublicKey: space.key,\n entryPoint: artifact.entryPoint,\n assets: artifact.assets,\n runtime,\n });\n space.db.add(func);\n\n return func;\n};\n\nexport const observeInvocations = async (space: Space, maxCount: number | null) => {\n let initialCount = null;\n const invocationData = new Map<\n string,\n {\n count: number;\n begin: InvocationTraceStartEvent;\n end?: InvocationTraceEndEvent;\n }\n >();\n let count = 0;\n while (true) {\n try {\n const traceFeed = space.properties.invocationTraceFeed?.target;\n const traceQueueDxn = traceFeed ? Feed.getQueueDxn(traceFeed) : undefined;\n const invocations = traceQueueDxn ? ((await space.queues.get(traceQueueDxn).queryObjects()) ?? []) : [];\n\n for (const invocation of invocations) {\n if (Obj.instanceOf(InvocationTraceStartEvent, invocation)) {\n if (invocationData.has(invocation.invocationId)) {\n continue;\n }\n invocationData.set(invocation.invocationId, {\n count: count++,\n begin: invocation,\n });\n console.log(\n `${count.toString().padStart(3, ' ')}: BEGIN ${invocation.runtime ?? '(unknown runtime)'} ${JSON.stringify(invocation.input)}`,\n );\n } else if (Obj.instanceOf(InvocationTraceEndEvent, invocation)) {\n const data = invocationData.get(invocation.invocationId);\n if (!data || !!data.end) {\n continue;\n }\n data.end = invocation;\n\n const outcome = data.end.outcome;\n console.log(\n `${data.count.toString().padStart(3, ' ')}: END outcome=${outcome} duration=${data.end.timestamp - data.begin.timestamp}`,\n );\n if (outcome === 'failure' && data.end.error) {\n console.error(ErrorCodec.decode(data.end.error));\n }\n }\n }\n if (initialCount === null) {\n initialCount = invocations.length;\n }\n\n if (maxCount !== null && invocationData.size >= maxCount + initialCount) {\n break;\n }\n } catch (err) {\n console.error(err);\n }\n await sleep(1_000);\n }\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,QAAQ;AAEf,SAASC,aAAa;AACtB,SAASC,cAA2B;AAEpC,SAASC,eAAe;AACxB,SAASC,MAAMC,WAAW;AAC1B,SAASC,eAAe;AACxB,SAASC,yBAAyBC,iCAAiC;AACnE,SAASC,8BAA8B;AACvC,SAASC,sBAAsB;AAE/B,SAASC,iBAAiB;AAC1B,SAASC,kBAA4C;AACrD,SAASC,8BAA8B;;AAEhC,IAAMC,cAAc,CAACC,MAAcC,WAAAA;AACxChB,KAAGiB,UAAUF,MAAM;IAAEG,WAAW;EAAK,CAAA;AACrCC,SAAOC,QAAQJ,OAAOK,MAAM,EAAEC,QAAQ,CAAC,CAACC,MAAMC,OAAAA,MAAQ;AACpDxB,OAAGyB,cAAcV,OAAO,MAAMQ,MAAMC,OAAAA;EACtC,CAAA;AACF;AAEO,IAAME,QAAQ,OAAOC,WAAAA;AAC1B,QAAMC,SAAS,MAAM,IAAI1B,OAAO;IAC9ByB;IACAE,OAAO;MAAClB,UAAUmB;MAAqBxB,QAAQA;;EACjD,CAAA,EAAGyB,WAAU;AACb,QAAMH,OAAOI,KAAKC,eAAc;AAEhC,QAAMC,QAAQ,MAAMN,OAAOO,OAAOC,OAAM;AACxC,QAAMF,MAAMG,eAAc;AAC1B,QAAMH,MAAMI,SAASC,6BAA6B1B,uBAAuB2B,OAAO;AAEhF,QAAMC,yBAAyBhC,uBAAuBiC,WAAWd,MAAAA;AAEjE,SAAO;IAAEA;IAAQM;IAAOO;EAAuB;AACjD;AAEO,IAAME,OAAO,OAAOT,UAAAA;AACzB,QAAMA,MAAMU,GAAGC,MAAK;AACpB,QAAMX,MAAMI,SAASQ,WAAW;IAC9BC,YAAY,CAACC,UACXC,QAAQC,IAAIF,QAAQ,GAAGA,M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AIE,WAAWG,YAAY;AACvD,cAAI,CAACQ,QAAQ,CAAC,CAACA,KAAKC,KAAK;AACvB;UACF;AACAD,eAAKC,MAAMZ;AAEX,gBAAMa,UAAUF,KAAKC,IAAIC;AACzB7C,kBAAQC,IACN,GAAG0C,KAAKvB,MAAMkB,SAAQ,EAAGC,SAAS,GAAG,GAAA,CAAA,iBAAqBM,OAAAA,aAAoBF,KAAKC,IAAIE,YAAYH,KAAKN,MAAMS,SAAS,EAAE;AAE3H,cAAID,YAAY,aAAaF,KAAKC,IAAIG,OAAO;AAC3C/C,oBAAQ+C,MAAMpF,WAAWqF,OAAOL,KAAKC,IAAIG,KAAK,CAAA;UAChD;QACF;MACF;AACA,UAAI9B,iBAAiB,MAAM;AACzBA,uBAAeW,YAAYqB;MAC7B;AAEA,UAAIjC,aAAa,QAAQE,eAAegC,QAAQlC,WAAWC,cAAc;AACvE;MACF;IACF,SAASkC,KAAK;AACZnD,cAAQ+C,MAAMI,GAAAA;IAChB;AACA,UAAMnG,MAAM,GAAA;EACd;AACF;",
6
+ "names": ["fs", "sleep", "Client", "Context", "Feed", "Obj", "Trigger", "InvocationTraceEndEvent", "InvocationTraceStartEvent", "FunctionsServiceClient", "bundleFunction", "Operation", "ErrorCodec", "EdgeReplicationSetting", "writeBundle", "path", "bundle", "mkdirSync", "recursive", "Object", "entries", "assets", "forEach", "name", "content", "writeFileSync", "setup", "config", "client", "types", "PersistentOperation", "initialize", "halo", "createIdentity", "space", "spaces", "create", "waitUntilReady", "internal", "setEdgeReplicationPreference", "ENABLED", "functionsServiceClient", "fromClient", "sync", "db", "flush", "syncToEdge", "onProgress", "state", "console", "log", "unsyncedDocumentCount", "deployFunction", "entryPoint", "runtime", "artifact", "verbose", "func", "deploy", "default", "version", "ownerPublicKey", "key", "add", "observeInvocations", "maxCount", "initialCount", "invocationData", "Map", "count", "traceFeed", "properties", "invocationTraceFeed", "target", "traceQueueDxn", "getQueueDxn", "undefined", "invocations", "queues", "get", "queryObjects", "invocation", "instanceOf", "has", "invocationId", "set", "begin", "toString", "padStart", "JSON", "stringify", "input", "data", "end", "outcome", "timestamp", "error", "decode", "length", "size", "err"]
7
7
  }
@@ -0,0 +1,13 @@
1
+ import { Database } from '@dxos/echo';
2
+ import { Operation } from '@dxos/operation';
3
+ export declare const Fibonacci: Operation.Definition<{
4
+ readonly iterations?: number | undefined;
5
+ }, {
6
+ readonly result: string;
7
+ }, never>;
8
+ export declare const Reply: Operation.Definition<any, any, never>;
9
+ export declare const Sleep: Operation.Definition<{
10
+ readonly duration?: number | undefined;
11
+ }, void, never>;
12
+ export declare const QueryDb: Operation.Definition<any, any, Database.Service>;
13
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/functions/definitions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,SAAS;;;;SAepB,CAAC;AAEH,eAAO,MAAM,KAAK,uCAQhB,CAAC;AAEH,eAAO,MAAM,KAAK;;eAahB,CAAC;AAEH,eAAO,MAAM,OAAO,kDASlB,CAAC"}
@@ -1,7 +1,8 @@
1
- declare const _default: import("@dxos/functions").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly iterations?: number | undefined;
3
4
  }, {
4
5
  readonly result: string;
5
- }, import("@dxos/functions").FunctionServices>;
6
+ }, never>>;
6
7
  export default _default;
7
8
  //# sourceMappingURL=fib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/functions/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
1
+ {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/functions/fib.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;;;AAI5C,wBAYE"}
@@ -1,6 +1,7 @@
1
- declare const _default: import("@dxos/functions").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly from: string;
3
4
  readonly to: string;
4
- }, string, import("@dxos/functions").FunctionServices>;
5
+ }, string, never>>;
5
6
  export default _default;
6
7
  //# sourceMappingURL=forex-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/functions/forex-effect.ts"],"names":[],"mappings":";;;;AAcA,wBA6BG"}
1
+ {"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/functions/forex-effect.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;;AAe5C,wBAoBE"}
@@ -1,3 +1,5 @@
1
- declare const _default: import("@dxos/functions").FunctionDefinition<any, any, import("@dxos/functions").FunctionServices>;
1
+ import { Database } from '@dxos/echo';
2
+ import { Operation } from '@dxos/operation';
3
+ declare const _default: Operation.WithHandler<Operation.Definition<any, any, Database.Service>>;
2
4
  export default _default;
3
5
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/functions/query.ts"],"names":[],"mappings":";AAUA,wBAUG"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/functions/query.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAA8B,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;AAI5C,wBAOE"}
@@ -1,3 +1,4 @@
1
- declare const _default: import("@dxos/functions").FunctionDefinition<any, any, import("@dxos/functions").FunctionServices>;
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<any, any, never>>;
2
3
  export default _default;
3
4
  //# sourceMappingURL=reply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/functions/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
1
+ {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/functions/reply.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;AAI5C,wBAOE"}
@@ -1,5 +1,6 @@
1
- declare const _default: import("@dxos/functions").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly duration?: number | undefined;
3
- }, void, import("@dxos/functions").FunctionServices>;
4
+ }, void, never>>;
4
5
  export default _default;
5
6
  //# sourceMappingURL=sleep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/functions/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/functions/sleep.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;AAI5C,wBAME"}
@@ -1,8 +1,8 @@
1
1
  import { Client, type Config } from '@dxos/client';
2
2
  import { type Space } from '@dxos/client/echo';
3
- import { Function } from '@dxos/functions';
4
3
  import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
5
4
  import type { BundleResult } from '@dxos/functions-runtime/native';
5
+ import { Operation } from '@dxos/operation';
6
6
  import { type FunctionRuntimeKind } from '@dxos/protocols';
7
7
  export declare const writeBundle: (path: string, bundle: BundleResult) => void;
8
8
  export declare const setup: (config: Config) => Promise<{
@@ -11,6 +11,6 @@ export declare const setup: (config: Config) => Promise<{
11
11
  functionsServiceClient: FunctionsServiceClient;
12
12
  }>;
13
13
  export declare const sync: (space: Space) => Promise<void>;
14
- export declare const deployFunction: (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string, runtime: FunctionRuntimeKind) => Promise<Function.Function>;
14
+ export declare const deployFunction: (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string, runtime: FunctionRuntimeKind) => Promise<Operation.PersistentOperation>;
15
15
  export declare const observeInvocations: (space: Space, maxCount: number | null) => Promise<void>;
16
16
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/testing/util.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGvE,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,YAAY,SAK7D,CAAC;AAEF,eAAO,MAAM,KAAK,GAAU,QAAQ,MAAM;;;;EAczC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAU,OAAO,KAAK,kBAMtC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,OAAO,KAAK,EACZ,wBAAwB,sBAAsB,EAC9C,YAAY,MAAM,EAClB,SAAS,mBAAmB,+BAgB7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,OAAO,KAAK,EAAE,UAAU,MAAM,GAAG,IAAI,kBAwD7E,CAAC"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/testing/util.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;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