@dxos/functions 0.8.3 → 0.8.4-main.03d5cd7b56

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 (142) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/index.mjs +593 -0
  3. package/dist/lib/neutral/index.mjs.map +7 -0
  4. package/dist/lib/neutral/meta.json +1 -0
  5. package/dist/types/src/index.d.ts +3 -6
  6. package/dist/types/src/index.d.ts.map +1 -1
  7. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  8. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  9. package/dist/types/src/protocol/functions-ai-http-client.test.d.ts +2 -0
  10. package/dist/types/src/protocol/functions-ai-http-client.test.d.ts.map +1 -0
  11. package/dist/types/src/protocol/index.d.ts +2 -0
  12. package/dist/types/src/protocol/index.d.ts.map +1 -0
  13. package/dist/types/src/protocol/protocol.d.ts +19 -0
  14. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  15. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  16. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  17. package/dist/types/src/sdk.d.ts +10 -0
  18. package/dist/types/src/sdk.d.ts.map +1 -0
  19. package/dist/types/src/services/credentials.d.ts +24 -27
  20. package/dist/types/src/services/credentials.d.ts.map +1 -1
  21. package/dist/types/src/services/function-invocation-service.d.ts +15 -0
  22. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  23. package/dist/types/src/services/index.d.ts +3 -7
  24. package/dist/types/src/services/index.d.ts.map +1 -1
  25. package/dist/types/src/services/queues.d.ts +1 -17
  26. package/dist/types/src/services/queues.d.ts.map +1 -1
  27. package/dist/types/src/services/tracing.d.ts +4 -14
  28. package/dist/types/src/services/tracing.d.ts.map +1 -1
  29. package/dist/types/src/types/index.d.ts +2 -0
  30. package/dist/types/src/types/index.d.ts.map +1 -0
  31. package/dist/types/src/types/url.d.ts +13 -0
  32. package/dist/types/src/types/url.d.ts.map +1 -0
  33. package/dist/types/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +28 -65
  35. package/src/index.ts +3 -8
  36. package/src/protocol/functions-ai-http-client.test.ts +105 -0
  37. package/src/protocol/functions-ai-http-client.ts +141 -0
  38. package/src/{executor → protocol}/index.ts +1 -1
  39. package/src/protocol/protocol.test.ts +58 -0
  40. package/src/protocol/protocol.ts +428 -0
  41. package/src/sdk.ts +31 -0
  42. package/src/services/credentials.ts +96 -35
  43. package/src/services/function-invocation-service.ts +33 -0
  44. package/src/services/index.ts +3 -7
  45. package/src/services/queues.ts +1 -33
  46. package/src/services/tracing.ts +4 -23
  47. package/src/{testing → types}/index.ts +1 -1
  48. package/src/types/url.ts +32 -0
  49. package/dist/lib/browser/bundler/index.mjs +0 -236
  50. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  51. package/dist/lib/browser/chunk-WEFZUEL2.mjs +0 -300
  52. package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +0 -7
  53. package/dist/lib/browser/edge/index.mjs +0 -69
  54. package/dist/lib/browser/edge/index.mjs.map +0 -7
  55. package/dist/lib/browser/index.mjs +0 -486
  56. package/dist/lib/browser/index.mjs.map +0 -7
  57. package/dist/lib/browser/meta.json +0 -1
  58. package/dist/lib/browser/testing/index.mjs +0 -28
  59. package/dist/lib/browser/testing/index.mjs.map +0 -7
  60. package/dist/lib/node/bundler/index.cjs +0 -260
  61. package/dist/lib/node/bundler/index.cjs.map +0 -7
  62. package/dist/lib/node/chunk-IJAE7FZK.cjs +0 -320
  63. package/dist/lib/node/chunk-IJAE7FZK.cjs.map +0 -7
  64. package/dist/lib/node/edge/index.cjs +0 -94
  65. package/dist/lib/node/edge/index.cjs.map +0 -7
  66. package/dist/lib/node/index.cjs +0 -522
  67. package/dist/lib/node/index.cjs.map +0 -7
  68. package/dist/lib/node/meta.json +0 -1
  69. package/dist/lib/node/testing/index.cjs +0 -43
  70. package/dist/lib/node/testing/index.cjs.map +0 -7
  71. package/dist/lib/node-esm/bundler/index.mjs +0 -238
  72. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  73. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +0 -302
  74. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +0 -7
  75. package/dist/lib/node-esm/edge/index.mjs +0 -71
  76. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  77. package/dist/lib/node-esm/index.mjs +0 -487
  78. package/dist/lib/node-esm/index.mjs.map +0 -7
  79. package/dist/lib/node-esm/meta.json +0 -1
  80. package/dist/lib/node-esm/testing/index.mjs +0 -29
  81. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  82. package/dist/types/src/bundler/bundler.d.ts +0 -51
  83. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  84. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  85. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  86. package/dist/types/src/bundler/index.d.ts +0 -2
  87. package/dist/types/src/bundler/index.d.ts.map +0 -1
  88. package/dist/types/src/edge/functions.d.ts +0 -16
  89. package/dist/types/src/edge/functions.d.ts.map +0 -1
  90. package/dist/types/src/edge/index.d.ts +0 -2
  91. package/dist/types/src/edge/index.d.ts.map +0 -1
  92. package/dist/types/src/executor/executor.d.ts +0 -8
  93. package/dist/types/src/executor/executor.d.ts.map +0 -1
  94. package/dist/types/src/executor/index.d.ts +0 -2
  95. package/dist/types/src/executor/index.d.ts.map +0 -1
  96. package/dist/types/src/handler.d.ts +0 -64
  97. package/dist/types/src/handler.d.ts.map +0 -1
  98. package/dist/types/src/schema.d.ts +0 -38
  99. package/dist/types/src/schema.d.ts.map +0 -1
  100. package/dist/types/src/services/ai.d.ts +0 -12
  101. package/dist/types/src/services/ai.d.ts.map +0 -1
  102. package/dist/types/src/services/database.d.ts +0 -11
  103. package/dist/types/src/services/database.d.ts.map +0 -1
  104. package/dist/types/src/services/event-logger.d.ts +0 -37
  105. package/dist/types/src/services/event-logger.d.ts.map +0 -1
  106. package/dist/types/src/services/function-call-service.d.ts +0 -16
  107. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  108. package/dist/types/src/services/service-container.d.ts +0 -44
  109. package/dist/types/src/services/service-container.d.ts.map +0 -1
  110. package/dist/types/src/testing/index.d.ts +0 -2
  111. package/dist/types/src/testing/index.d.ts.map +0 -1
  112. package/dist/types/src/testing/logger.d.ts +0 -5
  113. package/dist/types/src/testing/logger.d.ts.map +0 -1
  114. package/dist/types/src/testing/services.d.ts +0 -13
  115. package/dist/types/src/testing/services.d.ts.map +0 -1
  116. package/dist/types/src/trace.d.ts +0 -124
  117. package/dist/types/src/trace.d.ts.map +0 -1
  118. package/dist/types/src/translations.d.ts +0 -12
  119. package/dist/types/src/translations.d.ts.map +0 -1
  120. package/dist/types/src/types.d.ts +0 -411
  121. package/dist/types/src/types.d.ts.map +0 -1
  122. package/dist/types/src/url.d.ts +0 -17
  123. package/dist/types/src/url.d.ts.map +0 -1
  124. package/src/bundler/bundler.test.ts +0 -59
  125. package/src/bundler/bundler.ts +0 -270
  126. package/src/bundler/index.ts +0 -5
  127. package/src/edge/functions.ts +0 -64
  128. package/src/edge/index.ts +0 -9
  129. package/src/executor/executor.ts +0 -47
  130. package/src/handler.ts +0 -113
  131. package/src/schema.ts +0 -57
  132. package/src/services/ai.ts +0 -32
  133. package/src/services/database.ts +0 -28
  134. package/src/services/event-logger.ts +0 -87
  135. package/src/services/function-call-service.ts +0 -64
  136. package/src/services/service-container.ts +0 -109
  137. package/src/testing/logger.ts +0 -16
  138. package/src/testing/services.ts +0 -32
  139. package/src/trace.ts +0 -180
  140. package/src/translations.ts +0 -20
  141. package/src/types.ts +0 -211
  142. package/src/url.ts +0 -52
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/handler.ts", "../../../src/schema.ts", "../../../src/trace.ts", "../../../src/types.ts", "../../../src/url.ts", "../../../src/executor/executor.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, type Context, type Effect } from 'effect';\n\nimport { type AiServiceClient } from '@dxos/ai';\n// import { type Space } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type SpaceId, type DXN } from '@dxos/keys';\nimport { type QueryResult } from '@dxos/protocols';\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 = {}, TOutput = any> = (params: {\n /**\n * Services and context available to the function.\n */\n context: FunctionContext;\n\n /**\n * Data passed as the input to the function.\n * Must match the function's input schema.\n * This will be the payload from the trigger or other data passed into the function in a workflow.\n */\n data: TData;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n /**\n * Resolves a service available to the function.\n * @throws if the service is not available.\n */\n getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;\n\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: AiServiceClient;\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// 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): Queues are incompatible.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition<T = {}, O = any> = {\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n handler: FunctionHandler<T, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>(params: FunctionDefinition<T, O>): FunctionDefinition<T, O> => {\n if (!Schema.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 ?? Schema.Any,\n handler: params.handler,\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '@dxos/echo';\nimport { JsonSchemaType, LabelAnnotation, Ref } from '@dxos/echo-schema';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const ScriptType = Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.optional(Schema.Boolean),\n source: Ref(DataType.Text),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {}\n\n/**\n * Function deployment.\n */\nexport const FunctionType = Schema.Struct({\n // TODO(burdon): Rename to id/uri?\n name: Schema.NonEmptyString,\n version: Schema.String,\n\n description: Schema.optional(Schema.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: Schema.optional(Ref(ScriptType)),\n\n inputSchema: Schema.optional(JsonSchemaType),\n outputSchema: Schema.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: Schema.optional(Schema.String),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\nexport interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type, type Ref } from '@dxos/echo';\nimport { Queue } from '@dxos/echo-db';\nimport { ObjectId } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\n\nimport { FunctionTrigger, type FunctionTriggerType } from './types';\n\nexport enum InvocationOutcome {\n SUCCESS = 'success',\n FAILURE = 'failure',\n PENDING = 'pending',\n}\n\n// TODO(burdon): Convert to extensible discriminated union of EDGE events.\nexport enum InvocationTraceEventType {\n START = 'start',\n END = 'end',\n}\n\nexport const TraceEventException = Schema.Struct({\n timestampMs: Schema.Number,\n message: Schema.String,\n name: Schema.String,\n stack: Schema.optional(Schema.String),\n});\nexport type TraceEventException = Schema.Schema.Type<typeof TraceEventException>;\n\nexport const InvocationTraceStartEvent = Schema.Struct({\n /**\n * Queue message id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.START),\n /**\n * Invocation id, the same for invocation start and end events.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n timestampMs: Schema.Number,\n /**\n * Data passed to function / workflow as an argument.\n */\n // TODO(burdon): Input schema?\n input: Schema.Object,\n /**\n * Queue for function/workflow invocation events.\n */\n invocationTraceQueue: Type.Ref(Queue),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Type.Ref(Type.Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: Schema.optional(Type.Ref(FunctionTrigger)),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/InvocationTraceStart', version: '0.1.0' }));\n\nexport type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;\n\nexport const InvocationTraceEndEvent = Schema.Struct({\n /**\n * Trace event id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.END),\n /**\n * Invocation id, will be the same for invocation start and end.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n // TODO(burdon): Remove ms suffix.\n timestampMs: Schema.Number,\n outcome: Schema.Enums(InvocationOutcome),\n exception: Schema.optional(TraceEventException),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/InvocationTraceEnd', version: '0.1.0' }));\n\nexport type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;\n\nexport type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;\n\nexport const TraceEventLog = Schema.Struct({\n timestampMs: Schema.Number,\n level: Schema.String,\n message: Schema.String,\n context: Schema.optional(Schema.Object),\n});\n\nexport const TraceEvent = Schema.Struct({\n id: ObjectId,\n // TODO(burdon): Need enum/numeric result (not string).\n outcome: Schema.String,\n truncated: Schema.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: Schema.Number,\n logs: Schema.Array(TraceEventLog),\n exceptions: Schema.Array(TraceEventException),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));\n\nexport type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;\n\n/**\n * InvocationTrace event format.\n * This is the combined format of InvocationTraceStartEvent and InvocationTraceEndEvents for UI consumption.\n */\nexport type InvocationSpan = {\n id: string;\n timestampMs: number;\n outcome: InvocationOutcome;\n input: object;\n durationMs: number;\n invocationTraceQueue: Ref.Ref<Queue>;\n invocationTarget: Ref.Ref<Type.Expando>;\n trigger?: Ref.Ref<FunctionTriggerType>;\n exception?: TraceEventException;\n};\n\nexport const createInvocationSpans = (items?: InvocationTraceEvent[]): InvocationSpan[] => {\n if (!items) {\n return [];\n }\n\n const eventsByInvocationId = new Map<string, { start?: InvocationTraceStartEvent; end?: InvocationTraceEndEvent }>();\n for (const event of items) {\n if (!('invocationId' in event)) {\n // Skip legacy format entries.\n continue;\n }\n\n const invocationId = event.invocationId;\n const entry = eventsByInvocationId.get(invocationId) || { start: undefined, end: undefined };\n if (event.type === InvocationTraceEventType.START) {\n entry.start = event as InvocationTraceStartEvent;\n } else if (event.type === InvocationTraceEventType.END) {\n entry.end = event as InvocationTraceEndEvent;\n }\n\n eventsByInvocationId.set(invocationId, entry);\n }\n\n const now = Date.now();\n const result: InvocationSpan[] = [];\n\n // Create spans for each invocation\n for (const [invocationId, { start, end }] of eventsByInvocationId.entries()) {\n if (!start) {\n // No start event, can't create a meaningful span\n log.warn('found end event without matching start', { invocationId });\n continue;\n }\n\n const isInProgress = end === undefined;\n\n result.push({\n id: invocationId,\n timestampMs: start.timestampMs,\n durationMs: isInProgress ? now - start.timestampMs : end!.timestampMs - start.timestampMs,\n outcome: end?.outcome ?? InvocationOutcome.PENDING,\n exception: end?.exception,\n input: start.input,\n invocationTraceQueue: start.invocationTraceQueue,\n invocationTarget: start.invocationTarget,\n trigger: start.trigger,\n });\n }\n\n return result;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, SchemaAST } from 'effect';\n\nimport { Expando, OptionsAnnotationId, TypedObject, Ref, RawObject } from '@dxos/echo-schema';\nimport { DXN } from '@dxos/keys';\n\nimport { FunctionType } from './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\nconst kindLiteralAnnotations = { title: 'Kind' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Timer).annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(Schema.mutable);\nexport type TimerTrigger = Schema.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Email).annotations(kindLiteralAnnotations),\n}).pipe(Schema.mutable);\nexport type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Queue).annotations(kindLiteralAnnotations),\n queue: DXN.Schema,\n}).pipe(Schema.mutable);\nexport type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Webhook).annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n}).pipe(Schema.mutable);\nexport type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = Schema.Struct({\n type: Schema.optional(Schema.String.annotations({ title: 'Type' })),\n props: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).annotations({ title: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Subscription).annotations(kindLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n}).pipe(Schema.mutable);\nexport type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = Schema.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n title: 'Trigger',\n});\nexport type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;\n\nexport type EventType =\n | EmailTriggerOutput\n | WebhookTriggerOutput\n | QueueTriggerOutput\n | SubscriptionTriggerOutput\n | TimerTriggerOutput;\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailTriggerOutput = Schema.mutable(\n Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n }),\n);\nexport type EmailTriggerOutput = Schema.Schema.Type<typeof EmailTriggerOutput>;\n\nexport const WebhookTriggerOutput = Schema.mutable(\n Schema.Struct({\n url: Schema.String,\n method: Schema.Literal('GET', 'POST'),\n headers: Schema.Record({ key: Schema.String, value: Schema.String }),\n bodyText: Schema.String,\n }),\n);\nexport type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutput>;\n\nexport const QueueTriggerOutput = Schema.mutable(\n Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n }),\n);\nexport type QueueTriggerOutput = Schema.Schema.Type<typeof QueueTriggerOutput>;\n\nexport const SubscriptionTriggerOutput = Schema.mutable(\n Schema.Struct({ type: Schema.String, changedObjectId: Schema.String }),\n);\nexport type SubscriptionTriggerOutput = Schema.Schema.Type<typeof SubscriptionTriggerOutput>;\n\nexport const TimerTriggerOutput = Schema.mutable(Schema.Struct({ tick: Schema.Number }));\nexport type TimerTriggerOutput = Schema.Schema.Type<typeof TimerTriggerOutput>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nexport const FunctionTriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Ref(Expando).annotations({ title: 'Function' })),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(TriggerSchema),\n\n /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{$.trigger.event}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any }))),\n});\n\nexport type FunctionTriggerType = Schema.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.2.0',\n})(FunctionTriggerSchema.fields) {}\n\n// TODO(wittjosiah): Remove?\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = Schema.Struct({\n functions: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionType)))),\n triggers: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionTrigger)))),\n});\nexport type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionType, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ObjectMeta } from '@dxos/echo-schema';\nimport { type SpaceId } from '@dxos/keys';\n\n// TODO: use URL scheme for source?\nconst FUNCTIONS_META_KEY = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\nexport const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\nexport const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionUrl) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });\n }\n};\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const makeFunctionUrl = (fn: { functionId: string }) => `/${fn.functionId}`;\n\nexport const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {\n const baseUrl = new URL('functions/', edgeUrl);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = functionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n options.spaceId && url.searchParams.set('spaceId', options.spaceId);\n options.subjectId && url.searchParams.set('subjectId', options.subjectId);\n url.protocol = isSecure(url.protocol) ? 'https' : 'http';\n return url.toString();\n};\n\nexport type InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, Schema } from 'effect';\n\nimport type { SpaceId } from '@dxos/client/echo';\n\nimport type { FunctionContext, FunctionDefinition } from '../handler';\nimport type { ServiceContainer } from '../services';\n\nexport class FunctionExecutor {\n constructor(private readonly _services: ServiceContainer) {}\n\n // TODO(dmaretskyi): Invocation context: queue, space, etc...\n async invoke<F extends FunctionDefinition<any, any>>(\n fnDef: F,\n input: F extends FunctionDefinition<infer I, infer _O> ? I : never,\n ): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never> {\n // Assert input matches schema\n const assertInput = fnDef.inputSchema.pipe(Schema.asserts);\n (assertInput as any)(input);\n\n const context: FunctionContext = {\n getService: this._services.getService.bind(this._services),\n getSpace: async (_spaceId: SpaceId) => {\n throw new Error('Not available. Use the database service instead.');\n },\n space: undefined,\n get ai(): never {\n throw new Error('Not available. Use the ai service instead.');\n },\n };\n\n const result = await fnDef.handler({ context, data: input });\n\n // Assert output matches schema\n const assertOutput = fnDef.outputSchema?.pipe(Schema.asserts);\n (assertOutput as any)(result);\n\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as any);\n }\n\n return result as any;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAIA,SAASA,cAAyC;AA8F3C,IAAMC,iBAAiB,CAAOC,WAAAA;AACnC,MAAI,CAACC,OAAOC,SAASF,OAAOG,WAAW,GAAG;AACxC,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,OAAOO;IAC5CH,SAASL,OAAOK;EAClB;AACF;;;AC5GA,SAASI,UAAAA,eAAc;AAEvB,SAASC,YAAY;AACrB,SAASC,gBAAgBC,iBAAiBC,WAAW;AACrD,SAASC,gBAAgB;AAKlB,IAAMC,aAAaC,QAAOC,OAAO;EACtCC,MAAMF,QAAOG,SAASH,QAAOI,MAAM;EACnCC,aAAaL,QAAOG,SAASH,QAAOI,MAAM;;;EAG1CE,SAASN,QAAOG,SAASH,QAAOO,OAAO;EACvCC,QAAQC,IAAIC,SAASC,IAAI;AAC3B,CAAA,EAAGC,KACDC,KAAKC,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBC,IAAI;EAAC;CAAO,CAAA;AAQvB,IAAMC,eAAenB,QAAOC,OAAO;;EAExCC,MAAMF,QAAOoB;EACbJ,SAAShB,QAAOI;EAEhBC,aAAaL,QAAOG,SAASH,QAAOI,MAAM;;;EAI1CI,QAAQR,QAAOG,SAASM,IAAIV,UAAAA,CAAAA;EAE5BsB,aAAarB,QAAOG,SAASmB,cAA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T,QAAQU,SAAS;AACxEL,MAAItB,WAAWD,SAASuB,IAAItB,QAAQ,IAAI,UAAU;AAClD,SAAOsB,IAAIC,SAAQ;AACrB;;;AC1CA,SAASK,QAAQC,UAAAA,eAAc;AAOxB,IAAMC,mBAAN,MAAMA;EACX,YAA6BC,WAA6B;SAA7BA,YAAAA;EAA8B;;EAG3D,MAAMC,OACJC,OACAC,OACsE;AAEtE,UAAMC,cAAcF,MAAMG,YAAYC,KAAKC,QAAOC,OAAO;AACxDJ,gBAAoBD,KAAAA;AAErB,UAAMM,UAA2B;MAC/BC,YAAY,KAAKV,UAAUU,WAAWC,KAAK,KAAKX,SAAS;MACzDY,UAAU,OAAOC,aAAAA;AACf,cAAM,IAAIC,MAAM,kDAAA;MAClB;MACAC,OAAOC;MACP,IAAIC,KAAY;AACd,cAAM,IAAIH,MAAM,4CAAA;MAClB;IACF;AAEA,UAAMI,SAAS,MAAMhB,MAAMiB,QAAQ;MAAEV;MAASW,MAAMjB;IAAM,CAAA;AAG1D,UAAMkB,eAAenB,MAAMoB,cAAchB,KAAKC,QAAOC,OAAO;AAC3Da,iBAAqBH,MAAAA;AAEtB,QAAIK,OAAOC,SAASN,MAAAA,GAAS;AAC3B,aAAOK,OAAOE,WAAWP,MAAAA;IAC3B;AAEA,WAAOA;EACT;AACF;",
6
- "names": ["Schema", "defineFunction", "params", "Schema", "isSchema", "inputSchema", "Error", "handler", "description", "outputSchema", "Any", "Schema", "Type", "JsonSchemaType", "LabelAnnotation", "Ref", "DataType", "ScriptType", "Schema", "Struct", "name", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "DataType", "Text", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "Schema", "Type", "Queue", "ObjectId", "log", "Schema", "SchemaAST", "Expando", "OptionsAnnotationId", "TypedObject", "Ref", "RawObject", "DXN", "TriggerKind", "kindLiteralAnnotations", "title", "TimerTriggerSchema", "Schema", "Struct", "kind", "Literal", "annotations", "cron", "String", "SchemaAST", "ExamplesAnnotationId", "pipe", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "optional", "OptionsAnnotationId", "port", "Number", "QuerySchema", "type", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "Boolean", "delay", "TriggerSchema", "Union", "EmailTriggerOutput", "from", "to", "subject", "created", "body", "WebhookTriggerOutput", "url", "headers", "bodyText", "QueueTriggerOutput", "item", "cursor", "SubscriptionTriggerOutput", "changedObjectId", "TimerTriggerOutput", "tick", "FunctionTriggerSchema", "function", "Ref", "Expando", "inputNodeId", "enabled", "spec", "input", "FunctionTrigger", "TypedObject", "typename", "version", "fields", "FunctionManifestSchema", "functions", "Array", "RawObject", "FunctionType", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "InvocationTraceEventType", "TraceEventException", "Schema", "Struct", "timestampMs", "Number", "message", "String", "name", "stack", "optional", "InvocationTraceStartEvent", "id", "ObjectId", "type", "Literal", "invocationId", "input", "Object", "invocationTraceQueue", "Type", "Ref", "Queue", "invocationTarget", "Expando", "trigger", "FunctionTrigger", "pipe", "Obj", "typename", "version", "InvocationTraceEndEvent", "outcome", "Enums", "exception", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "Boolean", "ingestionTimestampMs", "logs", "Array", "exceptions", "createInvocationSpans", "items", "eventsByInvocationId", "Map", "event", "entry", "get", "start", "undefined", "end", "set", "now", "Date", "result", "entries", "log", "warn", "isInProgress", "push", "durationMs", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "isSecure", "protocol", "getUserFunctionUrlInMetadata", "meta", "keys", "find", "key", "source", "id", "setUserFunctionUrlInMetadata", "functionUrl", "Error", "push", "makeFunctionUrl", "fn", "functionId", "getInvocationUrl", "edgeUrl", "options", "baseUrl", "URL", "relativeUrl", "replace", "url", "toString", "spaceId", "searchParams", "set", "subjectId", "Effect", "Schema", "FunctionExecutor", "_services", "invoke", "fnDef", "input", "assertInput", "inputSchema", "pipe", "Schema", "asserts", "context", "getService", "bind", "getSpace", "_spaceId", "Error", "space", "undefined", "ai", "result", "handler", "data", "assertOutput", "outputSchema", "Effect", "isEffect", "runPromise"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30207,"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":470,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":6609,"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"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":877,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":6306,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/schema.ts":{"bytes":5377,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types.ts":{"bytes":21482,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"packages/core/functions/src/trace.ts":{"bytes":16924,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/url.ts":{"bytes":6002,"imports":[],"format":"esm"},"packages/core/functions/src/services/ai.ts":{"bytes":2435,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/database.ts":{"bytes":1984,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/queues.ts":{"bytes":2458,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/credentials.ts":{"bytes":4258,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/event-logger.ts":{"bytes":6510,"imports":[{"path":"effect","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/services/function-call-service.ts":{"bytes":7080,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/tracing.ts":{"bytes":1894,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/service-container.ts":{"bytes":11424,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"packages/core/functions/src/services/ai.ts","kind":"import-statement","original":"./ai"},{"path":"packages/core/functions/src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/functions/src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"packages/core/functions/src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"packages/core/functions/src/services/function-call-service.ts","kind":"import-statement","original":"./function-call-service"},{"path":"packages/core/functions/src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"packages/core/functions/src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"packages/core/functions/src/services/index.ts":{"bytes":1148,"imports":[{"path":"packages/core/functions/src/services/ai.ts","kind":"import-statement","original":"./ai"},{"path":"packages/core/functions/src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"packages/core/functions/src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"packages/core/functions/src/services/service-container.ts","kind":"import-statement","original":"./service-container"},{"path":"packages/core/functions/src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/functions/src/services/tracing.ts","kind":"import-statement","original":"./tracing"},{"path":"packages/core/functions/src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"packages/core/functions/src/services/function-call-service.ts","kind":"import-statement","original":"./function-call-service"}],"format":"esm"},"packages/core/functions/src/executor/executor.ts":{"bytes":4794,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/executor/index.ts":{"bytes":472,"imports":[{"path":"packages/core/functions/src/executor/executor.ts","kind":"import-statement","original":"./executor"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":1022,"imports":[{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/trace.ts","kind":"import-statement","original":"./trace"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/url.ts","kind":"import-statement","original":"./url"},{"path":"packages/core/functions/src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"packages/core/functions/src/executor/index.ts","kind":"import-statement","original":"./executor"}],"format":"esm"},"packages/core/functions/src/testing/logger.ts":{"bytes":1620,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/functions/src/services/index.ts","kind":"import-statement","original":"../services"}],"format":"esm"},"packages/core/functions/src/testing/services.ts":{"bytes":2917,"imports":[{"path":"packages/core/functions/src/testing/logger.ts","kind":"import-statement","original":"./logger"},{"path":"packages/core/functions/src/services/index.ts","kind":"import-statement","original":"../services"}],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":471,"imports":[{"path":"packages/core/functions/src/testing/services.ts","kind":"import-statement","original":"./services"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node-esm/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14574},"packages/core/functions/dist/lib/node-esm/bundler/index.mjs":{"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}],"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":7346},"packages/core/functions/dist/lib/node-esm/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3363},"packages/core/functions/dist/lib/node-esm/edge/index.mjs":{"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"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":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":1692},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1946},"packages/core/functions/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32026},"packages/core/functions/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-LIYPMWNQ.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["AiService","ConfiguredCredentialsService","CredentialsService","DatabaseService","EmailTriggerOutput","EventLogger","FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionCallService","FunctionExecutor","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","QueueService","QueueTriggerOutput","SERVICE_TAGS","ScriptType","ServiceContainer","SubscriptionTriggerOutput","TimerTriggerOutput","TraceEvent","TraceEventException","TraceEventLog","TracingService","TriggerKind","TriggerSchema","WebhookTriggerOutput","createDefectLogger","createEventLogger","createInvocationSpans","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","logCustomEvent","makeFunctionUrl","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/handler.ts":{"bytesInOutput":453},"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/schema.ts":{"bytesInOutput":1255},"packages/core/functions/src/trace.ts":{"bytesInOutput":4279},"packages/core/functions/src/types.ts":{"bytesInOutput":4732},"packages/core/functions/src/url.ts":{"bytesInOutput":1189},"packages/core/functions/src/executor/executor.ts":{"bytesInOutput":949},"packages/core/functions/src/executor/index.ts":{"bytesInOutput":0}},"bytes":14467},"packages/core/functions/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2358},"packages/core/functions/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-LIYPMWNQ.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["createTestServices"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/logger.ts":{"bytesInOutput":201},"packages/core/functions/src/testing/services.ts":{"bytesInOutput":348},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0}},"bytes":921},"packages/core/functions/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":19929},"packages/core/functions/dist/lib/node-esm/chunk-LIYPMWNQ.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["AiService","ConfiguredCredentialsService","CredentialsService","DatabaseService","EventLogger","FunctionCallService","QueueService","SERVICE_TAGS","ServiceContainer","TracingService","createDefectLogger","createEventLogger","logCustomEvent"],"inputs":{"packages/core/functions/src/services/ai.ts":{"bytesInOutput":504},"packages/core/functions/src/services/database.ts":{"bytesInOutput":435},"packages/core/functions/src/services/queues.ts":{"bytesInOutput":458},"packages/core/functions/src/services/credentials.ts":{"bytesInOutput":737},"packages/core/functions/src/services/event-logger.ts":{"bytesInOutput":1424},"packages/core/functions/src/services/function-call-service.ts":{"bytesInOutput":1522},"packages/core/functions/src/services/tracing.ts":{"bytesInOutput":293},"packages/core/functions/src/services/service-container.ts":{"bytesInOutput":2392},"packages/core/functions/src/services/index.ts":{"bytesInOutput":0}},"bytes":8612}}}
@@ -1,29 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AiService,
4
- QueueService,
5
- ServiceContainer,
6
- createEventLogger
7
- } from "../chunk-LIYPMWNQ.mjs";
8
-
9
- // packages/core/functions/src/testing/logger.ts
10
- import { Effect } from "effect";
11
- import { LogLevel } from "@dxos/log";
12
- var noopLogger = {
13
- log: () => Effect.succeed(void 0),
14
- nodeId: void 0
15
- };
16
- var consoleLogger = createEventLogger(LogLevel.INFO);
17
-
18
- // packages/core/functions/src/testing/services.ts
19
- var createTestServices = ({ ai, queueFactory, enableLogging = false, logger = enableLogging ? consoleLogger : noopLogger } = {}) => {
20
- return new ServiceContainer().setServices({
21
- ai: ai != null ? AiService.make(ai) : void 0,
22
- eventLogger: logger,
23
- queues: queueFactory != null ? QueueService.make(queueFactory, void 0) : void 0
24
- });
25
- };
26
- export {
27
- createTestServices
28
- };
29
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/testing/logger.ts", "../../../../src/testing/services.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, type Context } from 'effect';\n\nimport { LogLevel } from '@dxos/log';\n\nimport { type EventLogger, createEventLogger } from '../services';\n\nexport const noopLogger: Context.Tag.Service<EventLogger> = {\n log: () => Effect.succeed(undefined),\n nodeId: undefined,\n};\n\nexport const consoleLogger: Context.Tag.Service<EventLogger> = createEventLogger(LogLevel.INFO);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context } from 'effect';\n\nimport type { AiServiceClient } from '@dxos/ai';\nimport type { QueueFactory } from '@dxos/echo-db';\n\nimport { consoleLogger, noopLogger } from './logger';\nimport { AiService, QueueService, ServiceContainer } from '../services';\nimport type { EventLogger } from '../services/event-logger';\n\nexport type TestServiceOptions = {\n ai?: AiServiceClient;\n queueFactory?: QueueFactory;\n enableLogging?: boolean;\n logger?: Context.Tag.Service<EventLogger>;\n};\n\nexport const createTestServices = ({\n ai,\n queueFactory,\n enableLogging = false,\n logger = enableLogging ? consoleLogger : noopLogger,\n}: TestServiceOptions = {}): ServiceContainer => {\n return new ServiceContainer().setServices({\n ai: ai != null ? AiService.make(ai) : undefined,\n eventLogger: logger,\n queues: queueFactory != null ? QueueService.make(queueFactory, undefined) : undefined,\n });\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,cAA4B;AAErC,SAASC,gBAAgB;AAIlB,IAAMC,aAA+C;EAC1DC,KAAK,MAAMC,OAAOC,QAAQC,MAAAA;EAC1BC,QAAQD;AACV;AAEO,IAAME,gBAAkDC,kBAAkBC,SAASC,IAAI;;;ACKvF,IAAMC,qBAAqB,CAAC,EACjCC,IACAC,cACAC,gBAAgB,OAChBC,SAASD,gBAAgBE,gBAAgBC,WAAU,IAC7B,CAAC,MAAC;AACxB,SAAO,IAAIC,iBAAAA,EAAmBC,YAAY;IACxCP,IAAIA,MAAM,OAAOQ,UAAUC,KAAKT,EAAAA,IAAMU;IACtCC,aAAaR;IACbS,QAAQX,gBAAgB,OAAOY,aAAaJ,KAAKR,cAAcS,MAAAA,IAAaA;EAC9E,CAAA;AACF;",
6
- "names": ["Effect", "LogLevel", "noopLogger", "log", "Effect", "succeed", "undefined", "nodeId", "consoleLogger", "createEventLogger", "LogLevel", "INFO", "createTestServices", "ai", "queueFactory", "enableLogging", "logger", "consoleLogger", "noopLogger", "ServiceContainer", "setServices", "AiService", "make", "undefined", "eventLogger", "queues", "QueueService"]
7
- }
@@ -1,51 +0,0 @@
1
- import { type BuildOptions } from 'esbuild';
2
- import { type BuildResult } from 'esbuild-wasm';
3
- export type Import = {
4
- moduleUrl: string;
5
- defaultImport: boolean;
6
- namedImports: string[];
7
- };
8
- export type BundleOptions = {
9
- /**
10
- * Path to the source file on the local file system.
11
- * If provided, the path will be used instead of the `source` code.
12
- */
13
- path?: string;
14
- /**
15
- * Source code to bundle.
16
- * Required if `path` is not provided.
17
- */
18
- source?: string;
19
- };
20
- export type BundleResult = {
21
- timestamp: number;
22
- sourceHash?: Buffer;
23
- imports?: Import[];
24
- bundle?: string;
25
- error?: any;
26
- };
27
- export type BundlerOptions = {
28
- platform: BuildOptions['platform'];
29
- sandboxedModules: string[];
30
- remoteModules: Record<string, string>;
31
- };
32
- export declare const initializeBundler: (options: {
33
- wasmUrl: string;
34
- }) => Promise<void>;
35
- /**
36
- * ESBuild bundler.
37
- */
38
- export declare class Bundler {
39
- private readonly _options;
40
- constructor(_options: BundlerOptions);
41
- bundle({ path, source }: BundleOptions): Promise<BundleResult>;
42
- analyzeImports(result: BuildResult): Import[];
43
- analyzeSourceFileImports(code: string): {
44
- defaultImportName: string;
45
- namedImports: string[];
46
- wildcardImportName: string;
47
- moduleIdentifier: string;
48
- quotes: string;
49
- }[];
50
- }
51
- //# sourceMappingURL=bundler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,KAAK,WAAW,EAAe,MAAM,cAAc,CAAC;AAMhF,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAInE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE/C,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAwFpE,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG;QACtC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE;CAaJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=bundler.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.test.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './bundler';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -1,16 +0,0 @@
1
- import { type DID } from 'iso-did/types';
2
- import { type Client } from '@dxos/client';
3
- import type { PublicKey } from '@dxos/keys';
4
- import { type UploadFunctionResponseBody } from '@dxos/protocols';
5
- export type UploadWorkerArgs = {
6
- client: Client;
7
- source: string;
8
- version: string;
9
- name?: string;
10
- functionId?: string;
11
- ownerPublicKey: PublicKey;
12
- };
13
- export declare const uploadWorkerFunction: ({ client, version, source, name, functionId, ownerPublicKey, }: UploadWorkerArgs) => Promise<UploadFunctionResponseBody>;
14
- export declare const incrementSemverPatch: (version: string) => string;
15
- export declare const publicKeyToDid: (key: PublicKey) => DID;
16
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,gEAOxC,gBAAgB,KAAG,OAAO,CAAC,0BAA0B,CAqBvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,MAKtD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,KAAG,GAE/C,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './functions';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/edge/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { FunctionDefinition } from '../handler';
2
- import type { ServiceContainer } from '../services';
3
- export declare class FunctionExecutor {
4
- private readonly _services;
5
- constructor(_services: ServiceContainer);
6
- invoke<F extends FunctionDefinition<any, any>>(fnDef: F, input: F extends FunctionDefinition<infer I, infer _O> ? I : never): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never>;
7
- }
8
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAGlD,MAAM,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,GACjE,OAAO,CAAC,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CA4BxE"}
@@ -1,2 +0,0 @@
1
- export * from './executor';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/executor/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,64 +0,0 @@
1
- import { Schema, type Context, type Effect } from 'effect';
2
- import { type AiServiceClient } from '@dxos/ai';
3
- import type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';
4
- import { type HasId } from '@dxos/echo-schema';
5
- import { type SpaceId, type DXN } from '@dxos/keys';
6
- import { type QueryResult } from '@dxos/protocols';
7
- /**
8
- * Function handler.
9
- */
10
- export type FunctionHandler<TData = {}, TOutput = any> = (params: {
11
- /**
12
- * Services and context available to the function.
13
- */
14
- context: FunctionContext;
15
- /**
16
- * Data passed as the input to the function.
17
- * Must match the function's input schema.
18
- * This will be the payload from the trigger or other data passed into the function in a workflow.
19
- */
20
- data: TData;
21
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;
22
- /**
23
- * Function context.
24
- */
25
- export interface FunctionContext {
26
- /**
27
- * Resolves a service available to the function.
28
- * @throws if the service is not available.
29
- */
30
- getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
31
- getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
32
- /**
33
- * Space from which the function was invoked.
34
- */
35
- space: SpaceAPI | undefined;
36
- ai: AiServiceClient;
37
- }
38
- export interface FunctionContextAi {
39
- run(model: string, inputs: any, options?: any): Promise<any>;
40
- }
41
- export interface QueuesAPI {
42
- queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;
43
- insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;
44
- }
45
- /**
46
- * Space interface available to functions.
47
- */
48
- export interface SpaceAPI {
49
- get id(): SpaceId;
50
- /**
51
- * @deprecated
52
- */
53
- get crud(): CoreDatabase;
54
- get db(): EchoDatabase;
55
- get queues(): QueuesAPI;
56
- }
57
- export type FunctionDefinition<T = {}, O = any> = {
58
- description?: string;
59
- inputSchema: Schema.Schema<T, any>;
60
- outputSchema?: Schema.Schema<O, any>;
61
- handler: FunctionHandler<T, O>;
62
- };
63
- export declare const defineFunction: <T, O>(params: FunctionDefinition<T, O>) => FunctionDefinition<T, O>;
64
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"A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,CAAC,CAAC;CAC9D;AAQD,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,IAAI,IAAI,YAAY,CAAC;IACzB,IAAI,EAAE,IAAI,YAAY,CAAC;IAEvB,IAAI,MAAM,IAAI,SAAS,CAAC;CACzB;AAOD,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChC,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAc9F,CAAC"}
@@ -1,38 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Type } from '@dxos/echo';
3
- import { Ref } from '@dxos/echo-schema';
4
- /**
5
- * Source script.
6
- */
7
- export declare const ScriptType: Type.obj<Schema.Struct<{
8
- name: Schema.optional<typeof Schema.String>;
9
- description: Schema.optional<typeof Schema.String>;
10
- changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
12
- content: string;
13
- }>;
14
- }>>;
15
- export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {
16
- }
17
- /**
18
- * Function deployment.
19
- */
20
- export declare const FunctionType: Type.obj<Schema.Struct<{
21
- name: typeof Schema.NonEmptyString;
22
- version: typeof Schema.String;
23
- description: Schema.optional<typeof Schema.String>;
24
- source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
25
- name?: string | undefined;
26
- description?: string | undefined;
27
- changed?: boolean | undefined;
28
- source: Ref<Type.OfKind<Type.Kind.Object> & {
29
- content: string;
30
- }>;
31
- }>>;
32
- inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
33
- outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
34
- binding: Schema.optional<typeof Schema.String>;
35
- }>>;
36
- export interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {
37
- }
38
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;GAatB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;GAsBxB,CAAC;AACF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1,12 +0,0 @@
1
- import { Context, Layer } from 'effect';
2
- import type { AiServiceClient } from '@dxos/ai';
3
- declare const AiService_base: Context.TagClass<AiService, "AiService", {
4
- readonly client: AiServiceClient;
5
- }>;
6
- export declare class AiService extends AiService_base {
7
- static make: (client: AiServiceClient) => Context.Tag.Service<AiService>;
8
- static makeLayer: (client: AiServiceClient) => Layer.Layer<AiService>;
9
- static notAvailable: Layer.Layer<AiService, never, never>;
10
- }
11
- export {};
12
- //# sourceMappingURL=ai.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../../src/services/ai.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;;qBAM3B,eAAe;;AAHpC,qBAAa,SAAU,SAAQ,cAK5B;IACD,MAAM,CAAC,IAAI,GAAI,QAAQ,eAAe,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAMrE;IAEF,MAAM,CAAC,SAAS,GAAI,QAAQ,eAAe,KAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CACjB;IAEnD,MAAM,CAAC,YAAY,uCAIhB;CACJ"}
@@ -1,11 +0,0 @@
1
- import { Context, Layer } from 'effect';
2
- import type { EchoDatabase } from '@dxos/echo-db';
3
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "DatabaseService", {
4
- readonly db: EchoDatabase;
5
- }>;
6
- export declare class DatabaseService extends DatabaseService_base {
7
- static notAvailable: Layer.Layer<DatabaseService, never, never>;
8
- static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
9
- }
10
- export {};
11
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;iBAKjC,YAAY;;AAH7B,qBAAa,eAAgB,SAAQ,oBAKlC;IACD,MAAM,CAAC,YAAY,6CAIhB;IAEH,MAAM,CAAC,IAAI,GAAI,IAAI,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAMpE;CACH"}
@@ -1,37 +0,0 @@
1
- import { Effect, Context } from 'effect';
2
- import { LogLevel } from '@dxos/log';
3
- export type ComputeEvent = {
4
- type: 'begin-compute';
5
- nodeId: string;
6
- inputs: Record<string, any>;
7
- } | {
8
- type: 'end-compute';
9
- nodeId: string;
10
- outputs: Record<string, any>;
11
- } | {
12
- type: 'compute-input';
13
- nodeId: string;
14
- property: string;
15
- value: any;
16
- } | {
17
- type: 'compute-output';
18
- nodeId: string;
19
- property: string;
20
- value: any;
21
- } | {
22
- type: 'custom';
23
- nodeId: string;
24
- event: any;
25
- };
26
- declare const EventLogger_base: Context.TagClass<EventLogger, "EventLogger", {
27
- readonly log: (event: ComputeEvent) => void;
28
- readonly nodeId: string | undefined;
29
- }>;
30
- export declare class EventLogger extends EventLogger_base {
31
- static noop: Context.Tag.Service<EventLogger>;
32
- }
33
- export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, EventLogger>;
34
- export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
35
- export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<EventLogger>;
36
- export {};
37
- //# sourceMappingURL=event-logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAAO,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,eAAe,CAAC;IAC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Context } from 'effect';
2
- import type { SpaceId } from '@dxos/keys';
3
- declare const FunctionCallService_base: Context.TagClass<FunctionCallService, "FunctionCallService", {
4
- callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
5
- }>;
6
- /**
7
- * Allows calling into other functions.
8
- */
9
- export declare class FunctionCallService extends FunctionCallService_base {
10
- static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<FunctionCallService>;
11
- static mock: () => {
12
- callFunction: (deployedFunctionId: string, input: any) => Promise<any>;
13
- };
14
- }
15
- export {};
16
- //# sourceMappingURL=function-call-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-call-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-call-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;qCAQL,MAAM,SAAS,GAAG,YAAY,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;;AANzF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAiB9F,MAAM,CAAC,IAAI;2CAEkC,MAAM,SAAS,GAAG;MAI7D;CACH"}
@@ -1,44 +0,0 @@
1
- import { Layer, type Context } from 'effect';
2
- import { AiService } from './ai';
3
- import { CredentialsService } from './credentials';
4
- import { DatabaseService } from './database';
5
- import { EventLogger } from './event-logger';
6
- import { FunctionCallService } from './function-call-service';
7
- import { QueueService } from './queues';
8
- import { TracingService } from './tracing';
9
- /**
10
- * List of all service tags and their names.
11
- */
12
- export interface ServiceTagRecord {
13
- ai: AiService;
14
- credentials: CredentialsService;
15
- database: DatabaseService;
16
- eventLogger: EventLogger;
17
- functionCallService: FunctionCallService;
18
- tracing: TracingService;
19
- queues: QueueService;
20
- }
21
- /**
22
- * List of all services and their runtime types.
23
- */
24
- export type ServiceRecord = {
25
- [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
26
- };
27
- /**
28
- * Union of all services.
29
- */
30
- export type Services = ServiceTagRecord[keyof ServiceTagRecord];
31
- export declare const SERVICE_TAGS: Context.Tag<any, any>[];
32
- export declare class ServiceContainer {
33
- private _services;
34
- /**
35
- * Set services.
36
- * @param services - Services to set.
37
- * @returns The container instance.
38
- */
39
- setServices(services: Partial<ServiceRecord>): this;
40
- getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T>;
41
- clone(): ServiceContainer;
42
- createLayer(): Layer.Layer<Services>;
43
- }
44
- //# sourceMappingURL=service-container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAgC,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACxE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAYhE,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAQ/C,CAAC;AAMF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAmD;IAEpE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAKnD,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAS3E,KAAK,IAAI,gBAAgB;IAKzB,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;CAkBrC"}
@@ -1,2 +0,0 @@
1
- export * from './services';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,5 +0,0 @@
1
- import { type Context } from 'effect';
2
- import { type EventLogger } from '../services';
3
- export declare const noopLogger: Context.Tag.Service<EventLogger>;
4
- export declare const consoleLogger: Context.Tag.Service<EventLogger>;
5
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,aAAa,CAAC;AAElE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAGvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAoC,CAAC"}
@@ -1,13 +0,0 @@
1
- import { type Context } from 'effect';
2
- import type { AiServiceClient } from '@dxos/ai';
3
- import type { QueueFactory } from '@dxos/echo-db';
4
- import { ServiceContainer } from '../services';
5
- import type { EventLogger } from '../services/event-logger';
6
- export type TestServiceOptions = {
7
- ai?: AiServiceClient;
8
- queueFactory?: QueueFactory;
9
- enableLogging?: boolean;
10
- logger?: Context.Tag.Service<EventLogger>;
11
- };
12
- export declare const createTestServices: ({ ai, queueFactory, enableLogging, logger, }?: TestServiceOptions) => ServiceContainer;
13
- //# sourceMappingURL=services.d.ts.map