@dxos/functions 0.8.0 → 0.8.1-main.ae460ac

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 (35) hide show
  1. package/dist/lib/browser/{chunk-WI2RVE6E.mjs → chunk-TMUL6AZC.mjs} +2 -2
  2. package/dist/lib/browser/{chunk-6XYG2TNO.mjs → chunk-XK3NINVF.mjs} +29 -11
  3. package/dist/lib/{node-esm/chunk-A3BWJQVO.mjs.map → browser/chunk-XK3NINVF.mjs.map} +3 -3
  4. package/dist/lib/browser/index.mjs +7 -5
  5. package/dist/lib/browser/index.mjs.map +2 -2
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/testing/index.mjs +2 -2
  8. package/dist/lib/browser/types/index.mjs +5 -3
  9. package/dist/lib/node/{chunk-UNB65EWP.cjs → chunk-3J6FVYUV.cjs} +33 -14
  10. package/dist/lib/node/{chunk-UNB65EWP.cjs.map → chunk-3J6FVYUV.cjs.map} +3 -3
  11. package/dist/lib/node/{chunk-HH4ZO3YY.cjs → chunk-BGDVH6JU.cjs} +15 -15
  12. package/dist/lib/node/index.cjs +25 -23
  13. package/dist/lib/node/index.cjs.map +2 -2
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node/testing/index.cjs +7 -7
  16. package/dist/lib/node/types/index.cjs +17 -15
  17. package/dist/lib/node/types/index.cjs.map +2 -2
  18. package/dist/lib/node-esm/{chunk-A3BWJQVO.mjs → chunk-QRMVAODA.mjs} +29 -11
  19. package/dist/lib/{browser/chunk-6XYG2TNO.mjs.map → node-esm/chunk-QRMVAODA.mjs.map} +3 -3
  20. package/dist/lib/node-esm/{chunk-CM2LOG4A.mjs → chunk-V3VOPFP3.mjs} +2 -2
  21. package/dist/lib/node-esm/index.mjs +7 -5
  22. package/dist/lib/node-esm/index.mjs.map +2 -2
  23. package/dist/lib/node-esm/meta.json +1 -1
  24. package/dist/lib/node-esm/testing/index.mjs +2 -2
  25. package/dist/lib/node-esm/types/index.mjs +5 -3
  26. package/dist/types/src/handler.d.ts +1 -1
  27. package/dist/types/src/handler.d.ts.map +1 -1
  28. package/dist/types/src/types/trace.d.ts +36 -10
  29. package/dist/types/src/types/trace.d.ts.map +1 -1
  30. package/package.json +18 -19
  31. package/src/handler.ts +1 -1
  32. package/src/types/trace.ts +26 -9
  33. /package/dist/lib/browser/{chunk-WI2RVE6E.mjs.map → chunk-TMUL6AZC.mjs.map} +0 -0
  34. /package/dist/lib/node/{chunk-HH4ZO3YY.cjs.map → chunk-BGDVH6JU.cjs.map} +0 -0
  35. /package/dist/lib/node-esm/{chunk-CM2LOG4A.mjs.map → chunk-V3VOPFP3.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts", "../../../src/types/trace.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n name: S.optional(S.String),\n description: S.optional(S.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: S.optional(S.Boolean),\n source: Ref(TextType),\n}) {}\n\n/**\n * Function deployment.\n */\n// TODO(burdon): Move to core/functions.\nexport class FunctionType extends TypedObject({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n})({\n // TODO(burdon): Rename to id/uri?\n name: S.NonEmptyString,\n version: S.String,\n\n description: S.optional(S.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: S.optional(Ref(ScriptType)),\n\n inputSchema: S.optional(JsonSchemaType),\n outputSchema: S.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AST, OptionsAnnotationId, RawObject, S, TypedObject, DXN } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport enum TriggerKind {\n Timer = 'timer',\n Webhook = 'webhook',\n Subscription = 'subscription',\n Email = 'email',\n Queue = 'queue',\n}\n\n// TODO(burdon): Rename prop kind.\nconst typeLiteralAnnotations = { [AST.TitleAnnotationId]: 'Type' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),\n cron: S.String.annotations({\n [AST.TitleAnnotationId]: 'Cron',\n [AST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(S.mutable);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),\n}).pipe(S.mutable);\n\nexport type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),\n queue: DXN,\n}).pipe(S.mutable);\n\nexport type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),\n method: S.optional(\n S.String.annotations({\n [AST.TitleAnnotationId]: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: S.optional(\n S.Number.annotations({\n [AST.TitleAnnotationId]: 'Port',\n }),\n ),\n}).pipe(S.mutable);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = S.Struct({\n type: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Type' })),\n props: S.optional(S.Record({ key: S.String, value: S.Any })),\n}).annotations({ [AST.TitleAnnotationId]: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: S.optional(\n S.Struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Delay' })),\n }).annotations({ [AST.TitleAnnotationId]: 'Options' }),\n ),\n}).pipe(S.mutable);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = S.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n [AST.TitleAnnotationId]: 'Trigger',\n});\n\nexport type TriggerType = S.Schema.Type<typeof TriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport const FunctionTriggerSchema = S.Struct({\n // TODO(burdon): What type does this reference.\n // TODO(wittjosiah): This should probably be a Ref?\n function: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Function' })),\n\n enabled: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Enabled' })),\n\n // TODO(burdon): Flatten entire schema.\n spec: S.optional(TriggerSchema),\n\n // TODO(burdon): Get meta from function.\n // The `meta` property is merged into the event data passed to the function.\n meta: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),\n});\n\nexport type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})(FunctionTriggerSchema.fields) {}\n\n/**\n * Function definition.\n * @deprecated (Use dxos.org/type/Function)\n */\n// TODO(burdon): Reconcile with FunctionType.\nexport class FunctionDef extends TypedObject({\n typename: 'dxos.org/type/FunctionDef',\n version: '0.1.0',\n})({\n uri: S.String,\n description: S.optional(S.String),\n route: S.String,\n handler: S.String,\n}) {}\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = S.Struct({\n functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),\n triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),\n});\n\nexport type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionDef, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoObject, Expando, ObjectId, Ref, S } from '@dxos/echo-schema';\n\nimport { FunctionTrigger } from './types';\n\nexport const InvocationTrace = S.Struct({\n id: ObjectId,\n /**\n * Queue DXN for function/workflow invocation events.\n */\n invocationTraceQueue: Ref(Expando),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Ref(Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: S.optional(Ref(FunctionTrigger)),\n}).pipe(EchoObject('dxos.org/type/InvocationTrace', '0.1.0'));\n\nexport type InvocationTraceEvent = S.Schema.Type<typeof InvocationTrace>;\n\nexport const TraceEventLog = S.Struct({\n timestampMs: S.Number,\n level: S.String,\n message: S.String,\n context: S.optional(S.Object),\n});\n\nexport const TraceEventException = S.Struct({\n timestampMs: S.Number,\n message: S.String,\n name: S.String,\n stack: S.optional(S.String),\n});\n\nexport const TraceEvent = S.Struct({\n id: ObjectId,\n outcome: S.String,\n truncated: S.Boolean,\n logs: S.Array(TraceEventLog),\n exceptions: S.Array(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/TraceEvent', '0.1.0'));\n\nexport type TraceEvent = S.Schema.Type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F,oBAAAA,EAAEoB,OAAO;EAC1CwD,aAAa5E,oBAAAA,EAAEoC;EACf0C,SAAS9E,oBAAAA,EAAEE;EACXH,MAAMC,oBAAAA,EAAEE;EACRgF,OAAOlF,oBAAAA,EAAEC,SAASD,oBAAAA,EAAEE,MAAM;AAC5B,CAAA;AAEO,IAAMiF,aAAanF,oBAAAA,EAAEoB,OAAO;EACjCgD,IAAIC;EACJe,SAASpF,oBAAAA,EAAEE;EACXmF,WAAWrF,oBAAAA,EAAEK;EACbiF,MAAMtF,oBAAAA,EAAE+D,MAAMY,aAAAA;EACdY,YAAYvF,oBAAAA,EAAE+D,MAAMkB,mBAAAA;AACtB,CAAA,EAAGvD,SAAKgD,gCAAW,4BAA4B,OAAA,CAAA;",
6
- "names": ["import_echo_schema", "ScriptType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "TextType", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "Struct", "type", "Literal", "annotations", "cron", "ExamplesAnnotationId", "pipe", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "fields", "FunctionDef", "uri", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "InvocationTrace", "id", "ObjectId", "invocationTraceQueue", "Expando", "invocationTarget", "trigger", "EchoObject", "TraceEventLog", "timestampMs", "level", "message", "context", "Object", "TraceEventException", "stack", "TraceEvent", "outcome", "truncated", "logs", "exceptions"]
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n name: S.optional(S.String),\n description: S.optional(S.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: S.optional(S.Boolean),\n source: Ref(TextType),\n}) {}\n\n/**\n * Function deployment.\n */\n// TODO(burdon): Move to core/functions.\nexport class FunctionType extends TypedObject({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n})({\n // TODO(burdon): Rename to id/uri?\n name: S.NonEmptyString,\n version: S.String,\n\n description: S.optional(S.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: S.optional(Ref(ScriptType)),\n\n inputSchema: S.optional(JsonSchemaType),\n outputSchema: S.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AST, OptionsAnnotationId, RawObject, S, TypedObject, DXN } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport enum TriggerKind {\n Timer = 'timer',\n Webhook = 'webhook',\n Subscription = 'subscription',\n Email = 'email',\n Queue = 'queue',\n}\n\n// TODO(burdon): Rename prop kind.\nconst typeLiteralAnnotations = { [AST.TitleAnnotationId]: 'Type' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),\n cron: S.String.annotations({\n [AST.TitleAnnotationId]: 'Cron',\n [AST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(S.mutable);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),\n}).pipe(S.mutable);\n\nexport type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),\n queue: DXN,\n}).pipe(S.mutable);\n\nexport type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),\n method: S.optional(\n S.String.annotations({\n [AST.TitleAnnotationId]: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: S.optional(\n S.Number.annotations({\n [AST.TitleAnnotationId]: 'Port',\n }),\n ),\n}).pipe(S.mutable);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = S.Struct({\n type: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Type' })),\n props: S.optional(S.Record({ key: S.String, value: S.Any })),\n}).annotations({ [AST.TitleAnnotationId]: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: S.optional(\n S.Struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Delay' })),\n }).annotations({ [AST.TitleAnnotationId]: 'Options' }),\n ),\n}).pipe(S.mutable);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = S.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n [AST.TitleAnnotationId]: 'Trigger',\n});\n\nexport type TriggerType = S.Schema.Type<typeof TriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport const FunctionTriggerSchema = S.Struct({\n // TODO(burdon): What type does this reference.\n // TODO(wittjosiah): This should probably be a Ref?\n function: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Function' })),\n\n enabled: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Enabled' })),\n\n // TODO(burdon): Flatten entire schema.\n spec: S.optional(TriggerSchema),\n\n // TODO(burdon): Get meta from function.\n // The `meta` property is merged into the event data passed to the function.\n meta: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),\n});\n\nexport type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})(FunctionTriggerSchema.fields) {}\n\n/**\n * Function definition.\n * @deprecated (Use dxos.org/type/Function)\n */\n// TODO(burdon): Reconcile with FunctionType.\nexport class FunctionDef extends TypedObject({\n typename: 'dxos.org/type/FunctionDef',\n version: '0.1.0',\n})({\n uri: S.String,\n description: S.optional(S.String),\n route: S.String,\n handler: S.String,\n}) {}\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = S.Struct({\n functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),\n triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),\n});\n\nexport type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionDef, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoObject, Expando, ObjectId, Ref, S } from '@dxos/echo-schema';\n\nimport { FunctionTrigger } from './types';\n\nexport enum InvocationOutcome {\n SUCCESS = 'success',\n FAILURE = 'failure',\n}\n\nexport const TraceEventException = S.Struct({\n timestampMs: S.Number,\n message: S.String,\n name: S.String,\n stack: S.optional(S.String),\n});\n\nexport const InvocationTraceEvent = S.Struct({\n id: ObjectId,\n timestampMs: S.Number,\n outcome: S.Enums(InvocationOutcome),\n input: S.Object,\n durationMs: S.Number,\n /**\n * Queue DXN for function/workflow invocation events.\n */\n invocationTraceQueue: Ref(Expando),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Ref(Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: S.optional(Ref(FunctionTrigger)),\n /**\n * Present for outcome FAILURE.\n */\n exception: S.optional(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/InvocationTrace', '0.1.0'));\n\nexport type InvocationTraceEvent = S.Schema.Type<typeof InvocationTraceEvent>;\n\nexport const TraceEventLog = S.Struct({\n timestampMs: S.Number,\n level: S.String,\n message: S.String,\n context: S.optional(S.Object),\n});\n\nexport const TraceEvent = S.Struct({\n id: ObjectId,\n outcome: S.String,\n truncated: S.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: S.Number,\n logs: S.Array(TraceEventLog),\n exceptions: S.Array(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/TraceEvent', '0.1.0'));\n\nexport type TraceEvent = S.Schema.Type<typeof TraceEvent>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAoD;AACpD,oBAAyB;ACDzB,IAAAA,sBAAyE;ACAzE,IAAAA,sBAAsD;AFM/C,IAAMC,aAAN,kBAAyBC,gCAAY;EAC1CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,MAAMC,qBAAEC,SAASD,qBAAEE,MAAM;EACzBC,aAAaH,qBAAEC,SAASD,qBAAEE,MAAM;;;EAGhCE,SAASJ,qBAAEC,SAASD,qBAAEK,OAAO;EAC7BC,YAAQC,wBAAIC,sBA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,EAAEC,SAASD,oBAAAA,EAAE8E,MAAM;AAC9B,CAAA;AAEO,IAAMW,aAAazF,oBAAAA,EAAEoB,OAAO;EACjCqD,IAAIC;EACJC,SAAS3E,oBAAAA,EAAEE;EACXwF,WAAW1F,oBAAAA,EAAEK;;;;EAIbsF,sBAAsB3F,oBAAAA,EAAEoC;EACxBwD,MAAM5F,oBAAAA,EAAE+D,MAAMuB,aAAAA;EACdO,YAAY7F,oBAAAA,EAAE+D,MAAMK,mBAAAA;AACtB,CAAA,EAAG1C,SAAK2D,gCAAW,4BAA4B,OAAA,CAAA;",
6
+ "names": ["import_echo_schema", "ScriptType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "TextType", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "Struct", "type", "Literal", "annotations", "cron", "ExamplesAnnotationId", "pipe", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "fields", "FunctionDef", "uri", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "TraceEventException", "timestampMs", "message", "stack", "InvocationTraceEvent", "id", "ObjectId", "outcome", "Enums", "input", "Object", "durationMs", "invocationTraceQueue", "Expando", "invocationTarget", "trigger", "exception", "EchoObject", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "ingestionTimestampMs", "logs", "exceptions"]
7
7
  }
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_HH4ZO3YY_exports = {};
20
- __export(chunk_HH4ZO3YY_exports, {
19
+ var chunk_BGDVH6JU_exports = {};
20
+ __export(chunk_BGDVH6JU_exports, {
21
21
  FunctionRegistry: () => FunctionRegistry,
22
22
  TriggerRegistry: () => TriggerRegistry,
23
23
  createSubscriptionTrigger: () => createSubscriptionTrigger,
24
24
  createTimerTrigger: () => createTimerTrigger
25
25
  });
26
- module.exports = __toCommonJS(chunk_HH4ZO3YY_exports);
27
- var import_chunk_UNB65EWP = require("./chunk-UNB65EWP.cjs");
26
+ module.exports = __toCommonJS(chunk_BGDVH6JU_exports);
27
+ var import_chunk_3J6FVYUV = require("./chunk-3J6FVYUV.cjs");
28
28
  var import_async = require("@dxos/async");
29
29
  var import_echo = require("@dxos/client/echo");
30
30
  var import_context = require("@dxos/context");
@@ -85,14 +85,14 @@ var FunctionRegistry = class extends import_context.Resource {
85
85
  if (!functions?.length) {
86
86
  return;
87
87
  }
88
- if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_UNB65EWP.FunctionDef)) {
88
+ if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_3J6FVYUV.FunctionDef)) {
89
89
  space.db.graph.schemaRegistry.addSchema([
90
- import_chunk_UNB65EWP.FunctionDef
90
+ import_chunk_3J6FVYUV.FunctionDef
91
91
  ]);
92
92
  }
93
- const { objects: existing } = await space.db.query(import_echo.Filter.schema(import_chunk_UNB65EWP.FunctionDef)).run();
93
+ const { objects: existing } = await space.db.query(import_echo.Filter.schema(import_chunk_3J6FVYUV.FunctionDef)).run();
94
94
  const { added } = (0, import_util.diff)(existing, functions, (a, b) => a.uri === b.uri);
95
- added.forEach((def) => space.db.add((0, import_echo.create)(import_chunk_UNB65EWP.FunctionDef, def)));
95
+ added.forEach((def) => space.db.add((0, import_echo.create)(import_chunk_3J6FVYUV.FunctionDef, def)));
96
96
  if (added.length > 0) {
97
97
  await space.db.flush({
98
98
  indexes: true,
@@ -118,7 +118,7 @@ var FunctionRegistry = class extends import_context.Resource {
118
118
  if (this._ctx.disposed) {
119
119
  break;
120
120
  }
121
- this._ctx.onDispose(space.db.query(import_echo.Filter.schema(import_chunk_UNB65EWP.FunctionDef)).subscribe(({ objects }) => {
121
+ this._ctx.onDispose(space.db.query(import_echo.Filter.schema(import_chunk_3J6FVYUV.FunctionDef)).subscribe(({ objects }) => {
122
122
  const { added } = (0, import_util.diff)(registered, objects, (a, b) => a.uri === b.uri);
123
123
  if (added.length > 0) {
124
124
  registered.push(...added);
@@ -335,9 +335,9 @@ var TriggerRegistry = class extends import_context2.Resource {
335
335
  if (!manifest.triggers?.length) {
336
336
  return;
337
337
  }
338
- if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_UNB65EWP.FunctionTrigger)) {
338
+ if (!space.db.graph.schemaRegistry.hasSchema(import_chunk_3J6FVYUV.FunctionTrigger)) {
339
339
  space.db.graph.schemaRegistry.addSchema([
340
- import_chunk_UNB65EWP.FunctionTrigger
340
+ import_chunk_3J6FVYUV.FunctionTrigger
341
341
  ]);
342
342
  }
343
343
  const manifestTriggers = manifest.triggers.map((trigger) => {
@@ -351,11 +351,11 @@ var TriggerRegistry = class extends import_context2.Resource {
351
351
  ].join(":"))
352
352
  ];
353
353
  }
354
- return (0, import_echo3.create)(import_chunk_UNB65EWP.FunctionTrigger, trigger, {
354
+ return (0, import_echo3.create)(import_chunk_3J6FVYUV.FunctionTrigger, trigger, {
355
355
  keys
356
356
  });
357
357
  });
358
- const { objects: existing } = await space.db.query(import_echo3.Filter.schema(import_chunk_UNB65EWP.FunctionTrigger)).run();
358
+ const { objects: existing } = await space.db.query(import_echo3.Filter.schema(import_chunk_3J6FVYUV.FunctionTrigger)).run();
359
359
  const { added } = (0, import_util2.diff)(existing, manifestTriggers, import_echo3.compareForeignKeys);
360
360
  added.forEach((trigger) => {
361
361
  space.db.add(trigger);
@@ -390,7 +390,7 @@ var TriggerRegistry = class extends import_context2.Resource {
390
390
  if (this._ctx.disposed) {
391
391
  break;
392
392
  }
393
- this._ctx.onDispose(space.db.query(import_echo3.Filter.schema(import_chunk_UNB65EWP.FunctionTrigger)).subscribe(async ({ objects: current }) => {
393
+ this._ctx.onDispose(space.db.query(import_echo3.Filter.schema(import_chunk_3J6FVYUV.FunctionTrigger)).subscribe(async ({ objects: current }) => {
394
394
  import_log4.log.info("update", {
395
395
  space: space.key,
396
396
  registered: registered.length,
@@ -491,4 +491,4 @@ var TriggerRegistry = class extends import_context2.Resource {
491
491
  createSubscriptionTrigger,
492
492
  createTimerTrigger
493
493
  });
494
- //# sourceMappingURL=chunk-HH4ZO3YY.cjs.map
494
+ //# sourceMappingURL=chunk-BGDVH6JU.cjs.map
@@ -19,23 +19,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
21
  FUNCTIONS_PRESET_META_KEY: () => import_chunk_MZMHE4DC.FUNCTIONS_PRESET_META_KEY,
22
- FUNCTION_TYPES: () => import_chunk_UNB65EWP.FUNCTION_TYPES,
23
- FunctionDef: () => import_chunk_UNB65EWP.FunctionDef,
24
- FunctionManifestSchema: () => import_chunk_UNB65EWP.FunctionManifestSchema,
25
- FunctionRegistry: () => import_chunk_HH4ZO3YY.FunctionRegistry,
26
- FunctionTrigger: () => import_chunk_UNB65EWP.FunctionTrigger,
27
- FunctionTriggerSchema: () => import_chunk_UNB65EWP.FunctionTriggerSchema,
28
- FunctionType: () => import_chunk_UNB65EWP.FunctionType,
29
- InvocationTrace: () => import_chunk_UNB65EWP.InvocationTrace,
30
- ScriptType: () => import_chunk_UNB65EWP.ScriptType,
31
- TraceEvent: () => import_chunk_UNB65EWP.TraceEvent,
32
- TraceEventException: () => import_chunk_UNB65EWP.TraceEventException,
33
- TraceEventLog: () => import_chunk_UNB65EWP.TraceEventLog,
34
- TriggerKind: () => import_chunk_UNB65EWP.TriggerKind,
35
- TriggerRegistry: () => import_chunk_HH4ZO3YY.TriggerRegistry,
36
- TriggerSchema: () => import_chunk_UNB65EWP.TriggerSchema,
37
- createSubscriptionTrigger: () => import_chunk_HH4ZO3YY.createSubscriptionTrigger,
38
- createTimerTrigger: () => import_chunk_HH4ZO3YY.createTimerTrigger,
22
+ FUNCTION_TYPES: () => import_chunk_3J6FVYUV.FUNCTION_TYPES,
23
+ FunctionDef: () => import_chunk_3J6FVYUV.FunctionDef,
24
+ FunctionManifestSchema: () => import_chunk_3J6FVYUV.FunctionManifestSchema,
25
+ FunctionRegistry: () => import_chunk_BGDVH6JU.FunctionRegistry,
26
+ FunctionTrigger: () => import_chunk_3J6FVYUV.FunctionTrigger,
27
+ FunctionTriggerSchema: () => import_chunk_3J6FVYUV.FunctionTriggerSchema,
28
+ FunctionType: () => import_chunk_3J6FVYUV.FunctionType,
29
+ InvocationOutcome: () => import_chunk_3J6FVYUV.InvocationOutcome,
30
+ InvocationTraceEvent: () => import_chunk_3J6FVYUV.InvocationTraceEvent,
31
+ ScriptType: () => import_chunk_3J6FVYUV.ScriptType,
32
+ TraceEvent: () => import_chunk_3J6FVYUV.TraceEvent,
33
+ TraceEventException: () => import_chunk_3J6FVYUV.TraceEventException,
34
+ TraceEventLog: () => import_chunk_3J6FVYUV.TraceEventLog,
35
+ TriggerKind: () => import_chunk_3J6FVYUV.TriggerKind,
36
+ TriggerRegistry: () => import_chunk_BGDVH6JU.TriggerRegistry,
37
+ TriggerSchema: () => import_chunk_3J6FVYUV.TriggerSchema,
38
+ createSubscriptionTrigger: () => import_chunk_BGDVH6JU.createSubscriptionTrigger,
39
+ createTimerTrigger: () => import_chunk_BGDVH6JU.createTimerTrigger,
39
40
  defineFunction: () => defineFunction,
40
41
  getInvocationUrl: () => import_chunk_MZMHE4DC.getInvocationUrl,
41
42
  getUserFunctionUrlInMetadata: () => import_chunk_MZMHE4DC.getUserFunctionUrlInMetadata,
@@ -47,16 +48,16 @@ __export(node_exports, {
47
48
  });
48
49
  module.exports = __toCommonJS(node_exports);
49
50
  var import_chunk_MZMHE4DC = require("./chunk-MZMHE4DC.cjs");
50
- var import_chunk_HH4ZO3YY = require("./chunk-HH4ZO3YY.cjs");
51
- var import_chunk_UNB65EWP = require("./chunk-UNB65EWP.cjs");
51
+ var import_chunk_BGDVH6JU = require("./chunk-BGDVH6JU.cjs");
52
+ var import_chunk_3J6FVYUV = require("./chunk-3J6FVYUV.cjs");
52
53
  var import_chunk_JEQ2X3Z6 = require("./chunk-JEQ2X3Z6.cjs");
53
- var import_schema = require("@effect/schema");
54
+ var import_effect = require("effect");
54
55
  var import_client = require("@dxos/client");
55
56
  var import_log = require("@dxos/log");
56
57
  var import_util = require("@dxos/util");
57
58
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/handler.ts";
58
59
  var defineFunction = (params) => {
59
- if (!import_schema.Schema.isSchema(params.inputSchema)) {
60
+ if (!import_effect.Schema.isSchema(params.inputSchema)) {
60
61
  throw new Error("Input schema must be a valid schema");
61
62
  }
62
63
  if (typeof params.handler !== "function") {
@@ -65,7 +66,7 @@ var defineFunction = (params) => {
65
66
  return {
66
67
  description: params.description,
67
68
  inputSchema: params.inputSchema,
68
- outputSchema: params.outputSchema ?? import_schema.Schema.Any,
69
+ outputSchema: params.outputSchema ?? import_effect.Schema.Any,
69
70
  handler: params.handler
70
71
  };
71
72
  };
@@ -138,7 +139,8 @@ var registerTypes = (space, types = []) => {
138
139
  FunctionTrigger,
139
140
  FunctionTriggerSchema,
140
141
  FunctionType,
141
- InvocationTrace,
142
+ InvocationOutcome,
143
+ InvocationTraceEvent,
142
144
  ScriptType,
143
145
  TraceEvent,
144
146
  TraceEventException,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/handler.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from '@effect/schema';\nimport { type Effect } from 'effect';\n\nimport { type Client, PublicKey } from '@dxos/client';\nimport { type Space, type SpaceId } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type QueryResult } from '@dxos/protocols';\nimport { isNonNullable } from '@dxos/util';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TMeta = {}, TOutput = any> = (params: {\n context: FunctionContext;\n event: FunctionEvent<TData, TMeta>;\n /**\n * @deprecated\n */\n response: FunctionResponse;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: FunctionContextAi;\n\n /**\n * @deprecated\n */\n // TODO(burdon): Limit access to individual space.\n client: Client;\n /**\n * @deprecated\n */\n // TODO(burdon): Replace with storage service abstraction.\n dataDir?: string;\n}\n\nexport interface FunctionContextAi {\n // TODO(dmaretskyi): Refer to cloudflare AI docs for more comprehensive typedefs.\n run(model: string, inputs: any, options?: any): Promise<any>;\n}\n\n/**\n * Event payload.\n */\n// TODO(dmaretskyi): Update type definitions to match the actual payload.\nexport type FunctionEvent<TData = {}, TMeta = {}> = {\n data: FunctionEventMeta<TMeta> & TData;\n};\n\n/**\n * Metadata from trigger.\n */\nexport type FunctionEventMeta<TMeta = {}> = {\n meta: TMeta;\n};\n\n/**\n * Function response.\n */\nexport type FunctionResponse = {\n status(code: number): FunctionResponse;\n};\n\n//\n// API.\n//\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;\n insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;\n}\n\n/**\n * Space interface available to functions.\n */\nexport interface SpaceAPI {\n get id(): SpaceId;\n /**\n * @deprecated\n */\n get crud(): CoreDatabase;\n get db(): EchoDatabase;\n // TODO(dmaretskyi): Align with echo api --- queues.get(id).append(items);\n get queues(): QueuesAPI;\n}\n\n// TODO(wittjosiah): Fix this.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition = {\n description?: string;\n inputSchema: S.Schema.AnyNoContext;\n outputSchema?: S.Schema.AnyNoContext;\n handler: FunctionHandler<any>;\n};\n\nexport type DefineFunctionParams<T, O = any> = {\n description?: string;\n inputSchema: S.Schema<T, any>;\n outputSchema?: S.Schema<O, any>;\n handler: FunctionHandler<T, any, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>(params: DefineFunctionParams<T, O>): FunctionDefinition => {\n if (!S.isSchema(params.inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof params.handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n return {\n description: params.description,\n inputSchema: params.inputSchema,\n outputSchema: params.outputSchema ?? S.Any,\n handler: params.handler,\n };\n};\n\n//\n// Subscription utils.\n//\n\nexport type RawSubscriptionData = {\n spaceKey?: string;\n objects?: string[];\n};\n\nexport type SubscriptionData = {\n space?: Space;\n objects?: ReactiveEchoObject<any>[];\n};\n\n/**\n * Handler wrapper for subscription events; extracts space and objects.\n *\n * To test:\n * ```\n * curl -s -X POST -H \"Content-Type: application/json\" --data '{\"space\": \"0446...1cbb\"}' http://localhost:7100/dev/email-extractor\n * ```\n *\n * NOTE: Get space key from devtools or `dx space list --json`\n */\n// TODO(burdon): Evolve into plugin definition like Composer.\nexport const subscriptionHandler = <TMeta>(\n handler: FunctionHandler<SubscriptionData, TMeta>,\n types?: S.Schema<any>[],\n): FunctionHandler<RawSubscriptionData, TMeta> => {\n return async ({ event: { data }, context, response, ...rest }) => {\n const { client } = context;\n const space = data.spaceKey ? client.spaces.get(PublicKey.from(data.spaceKey)) : undefined;\n if (!space) {\n log.error('Invalid space');\n return response.status(500);\n }\n\n registerTypes(space, types);\n const objects = space\n ? data.objects\n ?.map<ReactiveEchoObject<any> | undefined>((id) => space!.db.getObjectById(id))\n .filter(isNonNullable)\n : [];\n\n if (!!data.spaceKey && !space) {\n log.warn('invalid space', { data });\n } else {\n log.info('handler', { space: space?.key.truncate(), objects: objects?.length });\n }\n\n return handler({ event: { data: { ...data, space, objects } }, context, response, ...rest });\n };\n};\n\n// TODO(burdon): Evolve types as part of function metadata.\nconst registerTypes = (space: Space, types: S.Schema<any>[] = []) => {\n const registry = space.db.graph.schemaRegistry;\n for (const type of types) {\n if (!registry.hasSchema(type)) {\n registry.addSchema([type]);\n }\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAA4B;AAG5B,oBAAuC;AAKvC,iBAAoB;AAEpB,kBAA8B;;AAoHvB,IAAMA,iBAAiB,CAAOC,WAAAA;AACnC,MAAI,CAACC,cAAAA,OAAEC,SAASF,OAAOG,WAAW,GAAG;AACnC,UAAM,IAAIC,MAAM,qCAAA;EAClB;AACA,MAAI,OAAOJ,OAAOK,YAAY,YAAY;AACxC,UAAM,IAAID,MAAM,4BAAA;EAClB;AAEA,SAAO;IACLE,aAAaN,OAAOM;IACpBH,aAAaH,OAAOG;IACpBI,cAAcP,OAAOO,gBAAgBN,cAAAA,OAAEO;IACvCH,SAASL,OAAOK;EAClB;AACF;AA2BO,IAAMI,sBAAsB,CACjCJ,SACAK,UAAAA;AAEA,SAAO,OAAO,EAAEC,OAAO,EAAEC,KAAI,GAAIC,SAASC,UAAU,GAAGC,KAAAA,MAAM;AAC3D,UAAM,EAAEC,OAAM,IAAKH;AACnB,UAAMI,QAAQL,KAAKM,WAAWF,OAAOG,OAAOC,IAAIC,wBAAUC,KAAKV,KAAKM,QAAQ,CAAA,IAAKK;AACjF,QAAI,CAACN,OAAO;AACVO,qBAAIC,MAAM,iBAAA,QAAA;;;;;;AACV,aAAOX,SAASY,OAAO,GAAA;IACzB;AAEAC,kBAAcV,OAAOP,KAAAA;AACrB,UAAMkB,UAAUX,QACZL,KAAKgB,SACDC,IAAyC,CAACC,OAAOb,MAAOc,GAAGC,cAAcF,EAAAA,CAAAA,EAC1EG,OAAOC,yBAAAA,IACV,CAAA;AAEJ,QAAI,CAAC,CAACtB,KAAKM,YAAY,CAACD,OAAO;AAC7BO,qBAAIW,KAAK,iBAAiB;QAAEvB;MAAK,GAAA;;;;;;IACnC,OAAO;AACLY,qBAAIY,KAAK,WAAW;QAAEnB,OAAOA,OAAOoB,IAAIC,SAAAA;QAAYV,SAASA,SAASW;MAAO,GAAA;;;;;;IAC/E;AAEA,WAAOlC,QAAQ;MAAEM,OAAO;QAAEC,MAAM;UAAE,GAAGA;UAAMK;UAAOW;QAAQ;MAAE;MAAGf;MAASC;MAAU,GAAGC;IAAK,CAAA;EAC5F;AACF;AAGA,IAAMY,gBAAgB,CAACV,OAAcP,QAAyB,CAAA,MAAE;AAC9D,QAAM8B,WAAWvB,MAAMc,GAAGU,MAAMC;AAChC,aAAWC,QAAQjC,OAAO;AACxB,QAAI,CAAC8B,SAASI,UAAUD,IAAAA,GAAO;AAC7BH,eAASK,UAAU;QAACF;OAAK;IAC3B;EACF;AACF;",
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\nimport { type Effect } from 'effect';\n\nimport { type Client, PublicKey } from '@dxos/client';\nimport { type Space, type SpaceId } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type QueryResult } from '@dxos/protocols';\nimport { isNonNullable } from '@dxos/util';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TMeta = {}, TOutput = any> = (params: {\n context: FunctionContext;\n event: FunctionEvent<TData, TMeta>;\n /**\n * @deprecated\n */\n response: FunctionResponse;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: FunctionContextAi;\n\n /**\n * @deprecated\n */\n // TODO(burdon): Limit access to individual space.\n client: Client;\n /**\n * @deprecated\n */\n // TODO(burdon): Replace with storage service abstraction.\n dataDir?: string;\n}\n\nexport interface FunctionContextAi {\n // TODO(dmaretskyi): Refer to cloudflare AI docs for more comprehensive typedefs.\n run(model: string, inputs: any, options?: any): Promise<any>;\n}\n\n/**\n * Event payload.\n */\n// TODO(dmaretskyi): Update type definitions to match the actual payload.\nexport type FunctionEvent<TData = {}, TMeta = {}> = {\n data: FunctionEventMeta<TMeta> & TData;\n};\n\n/**\n * Metadata from trigger.\n */\nexport type FunctionEventMeta<TMeta = {}> = {\n meta: TMeta;\n};\n\n/**\n * Function response.\n */\nexport type FunctionResponse = {\n status(code: number): FunctionResponse;\n};\n\n//\n// API.\n//\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;\n insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;\n}\n\n/**\n * Space interface available to functions.\n */\nexport interface SpaceAPI {\n get id(): SpaceId;\n /**\n * @deprecated\n */\n get crud(): CoreDatabase;\n get db(): EchoDatabase;\n // TODO(dmaretskyi): Align with echo api --- queues.get(id).append(items);\n get queues(): QueuesAPI;\n}\n\n// TODO(wittjosiah): Fix this.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition = {\n description?: string;\n inputSchema: S.Schema.AnyNoContext;\n outputSchema?: S.Schema.AnyNoContext;\n handler: FunctionHandler<any>;\n};\n\nexport type DefineFunctionParams<T, O = any> = {\n description?: string;\n inputSchema: S.Schema<T, any>;\n outputSchema?: S.Schema<O, any>;\n handler: FunctionHandler<T, any, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>(params: DefineFunctionParams<T, O>): FunctionDefinition => {\n if (!S.isSchema(params.inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof params.handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n return {\n description: params.description,\n inputSchema: params.inputSchema,\n outputSchema: params.outputSchema ?? S.Any,\n handler: params.handler,\n };\n};\n\n//\n// Subscription utils.\n//\n\nexport type RawSubscriptionData = {\n spaceKey?: string;\n objects?: string[];\n};\n\nexport type SubscriptionData = {\n space?: Space;\n objects?: ReactiveEchoObject<any>[];\n};\n\n/**\n * Handler wrapper for subscription events; extracts space and objects.\n *\n * To test:\n * ```\n * curl -s -X POST -H \"Content-Type: application/json\" --data '{\"space\": \"0446...1cbb\"}' http://localhost:7100/dev/email-extractor\n * ```\n *\n * NOTE: Get space key from devtools or `dx space list --json`\n */\n// TODO(burdon): Evolve into plugin definition like Composer.\nexport const subscriptionHandler = <TMeta>(\n handler: FunctionHandler<SubscriptionData, TMeta>,\n types?: S.Schema<any>[],\n): FunctionHandler<RawSubscriptionData, TMeta> => {\n return async ({ event: { data }, context, response, ...rest }) => {\n const { client } = context;\n const space = data.spaceKey ? client.spaces.get(PublicKey.from(data.spaceKey)) : undefined;\n if (!space) {\n log.error('Invalid space');\n return response.status(500);\n }\n\n registerTypes(space, types);\n const objects = space\n ? data.objects\n ?.map<ReactiveEchoObject<any> | undefined>((id) => space!.db.getObjectById(id))\n .filter(isNonNullable)\n : [];\n\n if (!!data.spaceKey && !space) {\n log.warn('invalid space', { data });\n } else {\n log.info('handler', { space: space?.key.truncate(), objects: objects?.length });\n }\n\n return handler({ event: { data: { ...data, space, objects } }, context, response, ...rest });\n };\n};\n\n// TODO(burdon): Evolve types as part of function metadata.\nconst registerTypes = (space: Space, types: S.Schema<any>[] = []) => {\n const registry = space.db.graph.schemaRegistry;\n for (const type of types) {\n if (!registry.hasSchema(type)) {\n registry.addSchema([type]);\n }\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAA4B;AAG5B,oBAAuC;AAKvC,iBAAoB;AAEpB,kBAA8B;;AAoHvB,IAAMA,iBAAiB,CAAOC,WAAAA;AACnC,MAAI,CAACC,cAAAA,OAAEC,SAASF,OAAOG,WAAW,GAAG;AACnC,UAAM,IAAIC,MAAM,qCAAA;EAClB;AACA,MAAI,OAAOJ,OAAOK,YAAY,YAAY;AACxC,UAAM,IAAID,MAAM,4BAAA;EAClB;AAEA,SAAO;IACLE,aAAaN,OAAOM;IACpBH,aAAaH,OAAOG;IACpBI,cAAcP,OAAOO,gBAAgBN,cAAAA,OAAEO;IACvCH,SAASL,OAAOK;EAClB;AACF;AA2BO,IAAMI,sBAAsB,CACjCJ,SACAK,UAAAA;AAEA,SAAO,OAAO,EAAEC,OAAO,EAAEC,KAAI,GAAIC,SAASC,UAAU,GAAGC,KAAAA,MAAM;AAC3D,UAAM,EAAEC,OAAM,IAAKH;AACnB,UAAMI,QAAQL,KAAKM,WAAWF,OAAOG,OAAOC,IAAIC,wBAAUC,KAAKV,KAAKM,QAAQ,CAAA,IAAKK;AACjF,QAAI,CAACN,OAAO;AACVO,qBAAIC,MAAM,iBAAA,QAAA;;;;;;AACV,aAAOX,SAASY,OAAO,GAAA;IACzB;AAEAC,kBAAcV,OAAOP,KAAAA;AACrB,UAAMkB,UAAUX,QACZL,KAAKgB,SACDC,IAAyC,CAACC,OAAOb,MAAOc,GAAGC,cAAcF,EAAAA,CAAAA,EAC1EG,OAAOC,yBAAAA,IACV,CAAA;AAEJ,QAAI,CAAC,CAACtB,KAAKM,YAAY,CAACD,OAAO;AAC7BO,qBAAIW,KAAK,iBAAiB;QAAEvB;MAAK,GAAA;;;;;;IACnC,OAAO;AACLY,qBAAIY,KAAK,WAAW;QAAEnB,OAAOA,OAAOoB,IAAIC,SAAAA;QAAYV,SAASA,SAASW;MAAO,GAAA;;;;;;IAC/E;AAEA,WAAOlC,QAAQ;MAAEM,OAAO;QAAEC,MAAM;UAAE,GAAGA;UAAMK;UAAOW;QAAQ;MAAE;MAAGf;MAASC;MAAU,GAAGC;IAAK,CAAA;EAC5F;AACF;AAGA,IAAMY,gBAAgB,CAACV,OAAcP,QAAyB,CAAA,MAAE;AAC9D,QAAM8B,WAAWvB,MAAMc,GAAGU,MAAMC;AAChC,aAAWC,QAAQjC,OAAO;AACxB,QAAI,CAAC8B,SAASI,UAAUD,IAAAA,GAAO;AAC7BH,eAASK,UAAU;QAACF;OAAK;IAC3B;EACF;AACF;",
6
6
  "names": ["defineFunction", "params", "S", "isSchema", "inputSchema", "Error", "handler", "description", "outputSchema", "Any", "subscriptionHandler", "types", "event", "data", "context", "response", "rest", "client", "space", "spaceKey", "spaces", "get", "PublicKey", "from", "undefined", "log", "error", "status", "registerTypes", "objects", "map", "id", "db", "getObjectById", "filter", "isNonNullable", "warn", "info", "key", "truncate", "length", "registry", "graph", "schemaRegistry", "type", "hasSchema", "addSchema"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30383,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":502,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":13907,"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":501,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/types/schema.ts":{"bytes":4417,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/types.ts":{"bytes":16526,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":4779,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":661,"imports":[{"path":"packages/core/functions/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/types/trace.ts","kind":"import-statement","original":"./trace"}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":13004,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":14030,"imports":[{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10314,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4173,"imports":[{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":751,"imports":[{"path":"packages/core/functions/src/trigger/type/subscription-trigger.ts","kind":"import-statement","original":"./subscription-trigger"},{"path":"packages/core/functions/src/trigger/type/timer-trigger.ts","kind":"import-statement","original":"./timer-trigger"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":28465,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":603,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":920,"imports":[{"path":"packages/core/functions/src/edge/index.ts","kind":"import-statement","original":"./edge"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"./function"},{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28958,"imports":[{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12707,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"../function"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"../runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"../trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4310,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14436},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7286},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/edge/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":476},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7881},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-HH4ZO3YY.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createSubscriptionTrigger","createTimerTrigger","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","subscriptionHandler","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":2084}},"bytes":3376},"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7183},"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs":{"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":3390},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":3674},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32289},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-HH4ZO3YY.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"exports":["TestType","createFunctionRuntime","createInitializedClients","inviteMember","startFunctionsHost","testFunctionManifest","triggerWebhook"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/setup.ts":{"bytesInOutput":2775},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7860},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5364},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1067},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":18145},"packages/core/functions/dist/lib/node/chunk-HH4ZO3YY.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26826},"packages/core/functions/dist/lib/node/chunk-HH4ZO3YY.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FunctionRegistry","TriggerRegistry","createSubscriptionTrigger","createTimerTrigger"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":3046},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2007},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":898},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":7538},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":13961},"packages/core/functions/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":594},"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13239},"packages/core/functions/dist/lib/node/chunk-UNB65EWP.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationTrace","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1010},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3644},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":997}},"bytes":6086},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":434}}}
1
+ {"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30383,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":502,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":13907,"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":501,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/types/schema.ts":{"bytes":4417,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/types.ts":{"bytes":16526,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":6233,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":661,"imports":[{"path":"packages/core/functions/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/types/trace.ts","kind":"import-statement","original":"./trace"}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":13004,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":14006,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10314,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4173,"imports":[{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":751,"imports":[{"path":"packages/core/functions/src/trigger/type/subscription-trigger.ts","kind":"import-statement","original":"./subscription-trigger"},{"path":"packages/core/functions/src/trigger/type/timer-trigger.ts","kind":"import-statement","original":"./timer-trigger"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":28465,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":603,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":920,"imports":[{"path":"packages/core/functions/src/edge/index.ts","kind":"import-statement","original":"./edge"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"./function"},{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28958,"imports":[{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12707,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"../function"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"../runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"../trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4310,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14436},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7286},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/edge/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":476},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7874},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-BGDVH6JU.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createSubscriptionTrigger","createTimerTrigger","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","subscriptionHandler","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":2076}},"bytes":3420},"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7183},"packages/core/functions/dist/lib/node/chunk-MZMHE4DC.cjs":{"imports":[{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":3390},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":3674},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32289},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-BGDVH6JU.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"exports":["TestType","createFunctionRuntime","createInitializedClients","inviteMember","startFunctionsHost","testFunctionManifest","triggerWebhook"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/setup.ts":{"bytesInOutput":2775},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7860},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5364},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1067},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":18145},"packages/core/functions/dist/lib/node/chunk-BGDVH6JU.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26826},"packages/core/functions/dist/lib/node/chunk-BGDVH6JU.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"cron","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FunctionRegistry","TriggerRegistry","createSubscriptionTrigger","createTimerTrigger"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":3046},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2007},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":898},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":7538},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":13961},"packages/core/functions/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":646},"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13917},"packages/core/functions/dist/lib/node/chunk-3J6FVYUV.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1010},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3644},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":1485}},"bytes":6600},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":434}}}
@@ -37,8 +37,8 @@ __export(testing_exports, {
37
37
  triggerWebhook: () => triggerWebhook
38
38
  });
39
39
  module.exports = __toCommonJS(testing_exports);
40
- var import_chunk_HH4ZO3YY = require("../chunk-HH4ZO3YY.cjs");
41
- var import_chunk_UNB65EWP = require("../chunk-UNB65EWP.cjs");
40
+ var import_chunk_BGDVH6JU = require("../chunk-BGDVH6JU.cjs");
41
+ var import_chunk_3J6FVYUV = require("../chunk-3J6FVYUV.cjs");
42
42
  var import_chunk_JEQ2X3Z6 = require("../chunk-JEQ2X3Z6.cjs");
43
43
  var import_get_port_please = require("get-port-please");
44
44
  var import_node_path = __toESM(require("node:path"));
@@ -572,8 +572,8 @@ var createInitializedClients = async (testBuilder, count = 1, config) => {
572
572
  config,
573
573
  services: testBuilder.createLocalClientServices(),
574
574
  types: [
575
- import_chunk_UNB65EWP.FunctionDef,
576
- import_chunk_UNB65EWP.FunctionTrigger,
575
+ import_chunk_3J6FVYUV.FunctionDef,
576
+ import_chunk_3J6FVYUV.FunctionTrigger,
577
577
  TestType
578
578
  ]
579
579
  }));
@@ -610,7 +610,7 @@ var createFunctionRuntime = async (testBuilder, pluginInitializer) => {
610
610
  };
611
611
  var startFunctionsHost = async (testBuilder, pluginInitializer, options) => {
612
612
  const functionRuntime = await createFunctionRuntime(testBuilder, pluginInitializer);
613
- const functionsRegistry = new import_chunk_HH4ZO3YY.FunctionRegistry(functionRuntime);
613
+ const functionsRegistry = new import_chunk_BGDVH6JU.FunctionRegistry(functionRuntime);
614
614
  const devServer = await startDevServer(testBuilder, functionRuntime, functionsRegistry, options);
615
615
  const scheduler = await startScheduler(testBuilder, functionRuntime, devServer, functionsRegistry);
616
616
  return {
@@ -624,7 +624,7 @@ var startFunctionsHost = async (testBuilder, pluginInitializer, options) => {
624
624
  };
625
625
  };
626
626
  var startScheduler = async (testBuilder, client, devServer, functionRegistry) => {
627
- const triggerRegistry = new import_chunk_HH4ZO3YY.TriggerRegistry(client);
627
+ const triggerRegistry = new import_chunk_BGDVH6JU.TriggerRegistry(client);
628
628
  const scheduler = new Scheduler(functionRegistry, triggerRegistry, {
629
629
  endpoint: devServer.endpoint
630
630
  });
@@ -644,7 +644,7 @@ var startDevServer = async (testBuilder, client, functionRegistry, options) => {
644
644
  };
645
645
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/functions/src/testing/util.ts";
646
646
  var triggerWebhook = async (space, uri) => {
647
- const trigger = (await space.db.query(import_echo2.Filter.schema(import_chunk_UNB65EWP.FunctionTrigger, (trigger2) => trigger2.function === uri)).run()).objects[0];
647
+ const trigger = (await space.db.query(import_echo2.Filter.schema(import_chunk_3J6FVYUV.FunctionTrigger, (trigger2) => trigger2.function === uri)).run()).objects[0];
648
648
  (0, import_invariant2.invariant)(trigger.spec?.type === "webhook", void 0, {
649
649
  F: __dxlog_file3,
650
650
  L: 17,
@@ -18,22 +18,23 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var types_exports = {};
20
20
  __export(types_exports, {
21
- FUNCTION_TYPES: () => import_chunk_UNB65EWP.FUNCTION_TYPES,
22
- FunctionDef: () => import_chunk_UNB65EWP.FunctionDef,
23
- FunctionManifestSchema: () => import_chunk_UNB65EWP.FunctionManifestSchema,
24
- FunctionTrigger: () => import_chunk_UNB65EWP.FunctionTrigger,
25
- FunctionTriggerSchema: () => import_chunk_UNB65EWP.FunctionTriggerSchema,
26
- FunctionType: () => import_chunk_UNB65EWP.FunctionType,
27
- InvocationTrace: () => import_chunk_UNB65EWP.InvocationTrace,
28
- ScriptType: () => import_chunk_UNB65EWP.ScriptType,
29
- TraceEvent: () => import_chunk_UNB65EWP.TraceEvent,
30
- TraceEventException: () => import_chunk_UNB65EWP.TraceEventException,
31
- TraceEventLog: () => import_chunk_UNB65EWP.TraceEventLog,
32
- TriggerKind: () => import_chunk_UNB65EWP.TriggerKind,
33
- TriggerSchema: () => import_chunk_UNB65EWP.TriggerSchema
21
+ FUNCTION_TYPES: () => import_chunk_3J6FVYUV.FUNCTION_TYPES,
22
+ FunctionDef: () => import_chunk_3J6FVYUV.FunctionDef,
23
+ FunctionManifestSchema: () => import_chunk_3J6FVYUV.FunctionManifestSchema,
24
+ FunctionTrigger: () => import_chunk_3J6FVYUV.FunctionTrigger,
25
+ FunctionTriggerSchema: () => import_chunk_3J6FVYUV.FunctionTriggerSchema,
26
+ FunctionType: () => import_chunk_3J6FVYUV.FunctionType,
27
+ InvocationOutcome: () => import_chunk_3J6FVYUV.InvocationOutcome,
28
+ InvocationTraceEvent: () => import_chunk_3J6FVYUV.InvocationTraceEvent,
29
+ ScriptType: () => import_chunk_3J6FVYUV.ScriptType,
30
+ TraceEvent: () => import_chunk_3J6FVYUV.TraceEvent,
31
+ TraceEventException: () => import_chunk_3J6FVYUV.TraceEventException,
32
+ TraceEventLog: () => import_chunk_3J6FVYUV.TraceEventLog,
33
+ TriggerKind: () => import_chunk_3J6FVYUV.TriggerKind,
34
+ TriggerSchema: () => import_chunk_3J6FVYUV.TriggerSchema
34
35
  });
35
36
  module.exports = __toCommonJS(types_exports);
36
- var import_chunk_UNB65EWP = require("../chunk-UNB65EWP.cjs");
37
+ var import_chunk_3J6FVYUV = require("../chunk-3J6FVYUV.cjs");
37
38
  var import_chunk_JEQ2X3Z6 = require("../chunk-JEQ2X3Z6.cjs");
38
39
  // Annotate the CommonJS export names for ESM import in node:
39
40
  0 && (module.exports = {
@@ -43,7 +44,8 @@ var import_chunk_JEQ2X3Z6 = require("../chunk-JEQ2X3Z6.cjs");
43
44
  FunctionTrigger,
44
45
  FunctionTriggerSchema,
45
46
  FunctionType,
46
- InvocationTrace,
47
+ InvocationOutcome,
48
+ InvocationTraceEvent,
47
49
  ScriptType,
48
50
  TraceEvent,
49
51
  TraceEventException,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.cjs"],
4
- "sourcesContent": ["import {\n FUNCTION_TYPES,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger,\n FunctionTriggerSchema,\n FunctionType,\n InvocationTrace,\n ScriptType,\n TraceEvent,\n TraceEventException,\n TraceEventLog,\n TriggerKind,\n TriggerSchema\n} from \"../chunk-UNB65EWP.cjs\";\nimport \"../chunk-JEQ2X3Z6.cjs\";\nexport {\n FUNCTION_TYPES,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger,\n FunctionTriggerSchema,\n FunctionType,\n InvocationTrace,\n ScriptType,\n TraceEvent,\n TraceEventException,\n TraceEventLog,\n TriggerKind,\n TriggerSchema\n};\n//# sourceMappingURL=index.cjs.map\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAcO;AACP,4BAAO;",
4
+ "sourcesContent": ["import {\n FUNCTION_TYPES,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger,\n FunctionTriggerSchema,\n FunctionType,\n InvocationOutcome,\n InvocationTraceEvent,\n ScriptType,\n TraceEvent,\n TraceEventException,\n TraceEventLog,\n TriggerKind,\n TriggerSchema\n} from \"../chunk-3J6FVYUV.cjs\";\nimport \"../chunk-JEQ2X3Z6.cjs\";\nexport {\n FUNCTION_TYPES,\n FunctionDef,\n FunctionManifestSchema,\n FunctionTrigger,\n FunctionTriggerSchema,\n FunctionType,\n InvocationOutcome,\n InvocationTraceEvent,\n ScriptType,\n TraceEvent,\n TraceEventException,\n TraceEventLog,\n TriggerKind,\n TriggerSchema\n};\n//# sourceMappingURL=index.cjs.map\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAeO;AACP,4BAAO;",
6
6
  "names": []
7
7
  }