@dxos/functions 0.8.2-main.2f9c567 → 0.8.2-main.36232bc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/bundler/index.mjs +3 -0
- package/dist/lib/browser/bundler/index.mjs.map +1 -1
- package/dist/lib/browser/chunk-2YE6S7XY.mjs +360 -0
- package/dist/lib/browser/chunk-2YE6S7XY.mjs.map +7 -0
- package/dist/lib/browser/chunk-7CHDHCV3.mjs +482 -0
- package/dist/lib/browser/chunk-7CHDHCV3.mjs.map +7 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs +72 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs.map +7 -0
- package/dist/lib/browser/chunk-XRCXIG74.mjs +12 -0
- package/dist/lib/browser/chunk-XRCXIG74.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +7 -63
- package/dist/lib/browser/edge/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +99 -367
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +670 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +51 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node/bundler/index.cjs +1 -0
- package/dist/lib/node/bundler/index.cjs.map +1 -1
- package/dist/lib/node/chunk-FBIUZ7SD.cjs +496 -0
- package/dist/lib/node/chunk-FBIUZ7SD.cjs.map +7 -0
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs +34 -0
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs.map +7 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs +94 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs.map +7 -0
- package/dist/lib/node/chunk-SV5NRE5L.cjs +395 -0
- package/dist/lib/node/chunk-SV5NRE5L.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +5 -65
- package/dist/lib/node/edge/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +94 -382
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +687 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +72 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/lib/node-esm/bundler/index.mjs +1 -0
- package/dist/lib/node-esm/bundler/index.mjs.map +1 -1
- package/dist/lib/node-esm/chunk-3XMJFSID.mjs +360 -0
- package/dist/lib/node-esm/chunk-3XMJFSID.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C6YINTWG.mjs +482 -0
- package/dist/lib/node-esm/chunk-C6YINTWG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs +12 -0
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs +72 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map +7 -0
- package/dist/lib/node-esm/edge/index.mjs +6 -64
- package/dist/lib/node-esm/edge/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +97 -367
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +670 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +51 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/browser/index.d.ts +2 -0
- package/dist/types/src/browser/index.d.ts.map +1 -0
- package/dist/types/src/edge/index.d.ts.map +1 -1
- package/dist/types/src/function/function-registry.d.ts +25 -0
- package/dist/types/src/function/function-registry.d.ts.map +1 -0
- package/dist/types/src/function/function-registry.test.d.ts +2 -0
- package/dist/types/src/function/function-registry.test.d.ts.map +1 -0
- package/dist/types/src/function/index.d.ts +2 -0
- package/dist/types/src/function/index.d.ts.map +1 -0
- package/dist/types/src/handler.d.ts +61 -12
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/runtime/dev-server.d.ts +52 -0
- package/dist/types/src/runtime/dev-server.d.ts.map +1 -0
- package/dist/types/src/runtime/dev-server.test.d.ts +2 -0
- package/dist/types/src/runtime/dev-server.test.d.ts.map +1 -0
- package/dist/types/src/runtime/index.d.ts +3 -0
- package/dist/types/src/runtime/index.d.ts.map +1 -0
- package/dist/types/src/runtime/scheduler.d.ts +34 -0
- package/dist/types/src/runtime/scheduler.d.ts.map +1 -0
- package/dist/types/src/runtime/scheduler.test.d.ts +2 -0
- package/dist/types/src/runtime/scheduler.test.d.ts.map +1 -0
- package/dist/types/src/testing/functions-integration.test.d.ts +2 -0
- package/dist/types/src/testing/functions-integration.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +5 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/manifest.d.ts +3 -0
- package/dist/types/src/testing/manifest.d.ts.map +1 -0
- package/dist/types/src/testing/plugin-init.d.ts +6 -0
- package/dist/types/src/testing/plugin-init.d.ts.map +1 -0
- package/dist/types/src/testing/setup.d.ts +15 -0
- package/dist/types/src/testing/setup.d.ts.map +1 -0
- package/dist/types/src/testing/test/handler.d.ts +4 -0
- package/dist/types/src/testing/test/handler.d.ts.map +1 -0
- package/dist/types/src/testing/test/index.d.ts +3 -0
- package/dist/types/src/testing/test/index.d.ts.map +1 -0
- package/dist/types/src/testing/types.d.ts +10 -0
- package/dist/types/src/testing/types.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +5 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/src/trigger/index.d.ts +3 -0
- package/dist/types/src/trigger/index.d.ts.map +1 -0
- package/dist/types/src/trigger/trigger-registry.d.ts +38 -0
- package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -0
- package/dist/types/src/trigger/trigger-registry.test.d.ts +2 -0
- package/dist/types/src/trigger/trigger-registry.test.d.ts.map +1 -0
- package/dist/types/src/trigger/type/index.d.ts +3 -0
- package/dist/types/src/trigger/type/index.d.ts.map +1 -0
- package/dist/types/src/trigger/type/subscription-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +1 -0
- package/dist/types/src/trigger/type/timer-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -0
- package/dist/types/src/trigger/type/webhook-trigger.d.ts +4 -0
- package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +53 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/trace.d.ts +146 -0
- package/dist/types/src/types/trace.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/types.d.ts} +49 -191
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/dist/types/tools/schema.d.ts +2 -0
- package/dist/types/tools/schema.d.ts.map +1 -0
- package/package.json +36 -20
- package/schema/functions.json +211 -0
- package/src/browser/index.ts +5 -0
- package/src/edge/index.ts +0 -4
- package/src/function/function-registry.test.ts +118 -0
- package/src/function/function-registry.ts +104 -0
- package/src/function/index.ts +5 -0
- package/src/handler.ts +118 -14
- package/src/index.ts +5 -4
- package/src/runtime/dev-server.test.ts +79 -0
- package/src/runtime/dev-server.ts +240 -0
- package/src/runtime/index.ts +6 -0
- package/src/runtime/scheduler.test.ts +152 -0
- package/src/runtime/scheduler.ts +170 -0
- package/src/testing/functions-integration.test.ts +65 -0
- package/src/testing/index.ts +8 -0
- package/src/testing/manifest.ts +15 -0
- package/src/testing/plugin-init.ts +20 -0
- package/src/testing/setup.ts +109 -0
- package/src/testing/test/handler.ts +15 -0
- package/src/testing/test/index.ts +7 -0
- package/src/testing/types.ts +9 -0
- package/src/testing/util.ts +26 -0
- package/src/translations.ts +1 -1
- package/src/trigger/index.ts +6 -0
- package/src/trigger/trigger-registry.test.ts +278 -0
- package/src/trigger/trigger-registry.ts +218 -0
- package/src/trigger/type/index.ts +7 -0
- package/src/trigger/type/subscription-trigger.ts +84 -0
- package/src/trigger/type/timer-trigger.ts +48 -0
- package/src/trigger/type/webhook-trigger.ts +48 -0
- package/src/types/index.ts +8 -0
- package/src/types/schema.ts +46 -0
- package/src/{trace.ts → types/trace.ts} +31 -33
- package/src/types/types.ts +163 -0
- package/dist/types/src/schema.d.ts +0 -57
- package/dist/types/src/schema.d.ts.map +0 -1
- package/dist/types/src/trace.d.ts +0 -148
- package/dist/types/src/trace.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/types/src/url.d.ts.map +0 -1
- package/src/schema.ts +0 -53
- package/src/types.ts +0 -214
- /package/dist/types/src/{url.d.ts → types/url.d.ts} +0 -0
- /package/src/{url.ts → types/url.ts} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Event } from '@dxos/async';
|
|
2
|
+
import { type Client } from '@dxos/client';
|
|
3
|
+
import { type Space } from '@dxos/client/echo';
|
|
4
|
+
import { Context, Resource } from '@dxos/context';
|
|
5
|
+
import { type FunctionManifest, FunctionTrigger, type TriggerKind, type TriggerType } from '../types';
|
|
6
|
+
type ResponseCode = number;
|
|
7
|
+
export type TriggerCallback = (args: object) => Promise<ResponseCode>;
|
|
8
|
+
export type TriggerFactory<Spec extends TriggerType, Options = any> = (ctx: Context, space: Space, spec: Spec, callback: TriggerCallback, options?: Options) => Promise<void>;
|
|
9
|
+
export type TriggerFactoryMap = Partial<Record<TriggerKind, TriggerFactory<any>>>;
|
|
10
|
+
export type TriggerEvent = {
|
|
11
|
+
space: Space;
|
|
12
|
+
triggers: FunctionTrigger[];
|
|
13
|
+
};
|
|
14
|
+
export declare class TriggerRegistry extends Resource {
|
|
15
|
+
private readonly _client;
|
|
16
|
+
private readonly _options?;
|
|
17
|
+
private readonly _triggersBySpaceKey;
|
|
18
|
+
readonly registered: Event<TriggerEvent>;
|
|
19
|
+
readonly removed: Event<TriggerEvent>;
|
|
20
|
+
constructor(_client: Client, _options?: TriggerFactoryMap | undefined);
|
|
21
|
+
getActiveTriggers(space: Space): FunctionTrigger[];
|
|
22
|
+
getInactiveTriggers(space: Space): FunctionTrigger[];
|
|
23
|
+
/**
|
|
24
|
+
* Set callback for trigger.
|
|
25
|
+
*/
|
|
26
|
+
activate(space: Space, trigger: FunctionTrigger, callback: TriggerCallback): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Loads triggers from the manifest into the space.
|
|
29
|
+
*/
|
|
30
|
+
register(space: Space, manifest: FunctionManifest): Promise<void>;
|
|
31
|
+
protected _open(): Promise<void>;
|
|
32
|
+
protected _close(_: Context): Promise<void>;
|
|
33
|
+
private _handleNewTriggers;
|
|
34
|
+
private _handleRemovedTriggers;
|
|
35
|
+
private _getTriggers;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=trigger-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAyB,KAAK,KAAK,EAAsB,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtG,KAAK,YAAY,GAAG,MAAM,CAAC;AAE3B,MAAM,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tB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1D,OAAO,CAAC,kBAAkB;YAiBZ,sBAAsB;IA0BpC,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-registry.test.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/trigger/type/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/trigger/type/subscription-trigger.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEhF,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,mBAAmB,CAsEzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/trigger/type/timer-trigger.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEhF,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAiC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/trigger/type/webhook-trigger.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEhF,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAiC/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { JsonSchemaType, Ref, S } from '@dxos/echo-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Source script.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ScriptType: import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
6
|
+
name: S.optional<typeof S.String>;
|
|
7
|
+
description: S.optional<typeof S.String>;
|
|
8
|
+
changed: S.optional<typeof S.Boolean>;
|
|
9
|
+
source: import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<{
|
|
10
|
+
content: typeof S.String;
|
|
11
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>>;
|
|
12
|
+
}>>;
|
|
13
|
+
export type ScriptType = S.Schema.Type<typeof ScriptType>;
|
|
14
|
+
declare const FunctionType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
|
|
15
|
+
name: typeof S.NonEmptyString;
|
|
16
|
+
version: typeof S.String;
|
|
17
|
+
description: S.optional<typeof S.String>;
|
|
18
|
+
source: S.optional<import("@dxos/echo-schema").Ref$<{
|
|
19
|
+
readonly id: string;
|
|
20
|
+
source: Ref<import("@dxos/echo-schema").TypedObjectFields<{
|
|
21
|
+
content: typeof S.String;
|
|
22
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>>;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
description?: string | undefined;
|
|
25
|
+
changed?: boolean | undefined;
|
|
26
|
+
}>>;
|
|
27
|
+
inputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
28
|
+
outputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
29
|
+
binding: S.optional<typeof S.String>;
|
|
30
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<{
|
|
31
|
+
name: typeof S.NonEmptyString;
|
|
32
|
+
version: typeof S.String;
|
|
33
|
+
description: S.optional<typeof S.String>;
|
|
34
|
+
source: S.optional<import("@dxos/echo-schema").Ref$<{
|
|
35
|
+
readonly id: string;
|
|
36
|
+
source: Ref<import("@dxos/echo-schema").TypedObjectFields<{
|
|
37
|
+
content: typeof S.String;
|
|
38
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>>;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
description?: string | undefined;
|
|
41
|
+
changed?: boolean | undefined;
|
|
42
|
+
}>>;
|
|
43
|
+
inputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
44
|
+
outputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
45
|
+
binding: S.optional<typeof S.String>;
|
|
46
|
+
}>>;
|
|
47
|
+
/**
|
|
48
|
+
* Function deployment.
|
|
49
|
+
*/
|
|
50
|
+
export declare class FunctionType extends FunctionType_base {
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,cAAc,EAAqB,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAGvG;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;wBAFtB,EAAE,MAAM;;GAWkE,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;;;;;;;;4BAbzD,EAAE,MAAM;;;;;;;;;;;;;;;;4BAAR,EAAE,MAAM;;;;;;;;;;AAeT;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAmBhC;CAAG"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Expando, Ref, S } from '@dxos/echo-schema';
|
|
2
|
+
import { type FunctionTriggerType } from './types';
|
|
3
|
+
export declare enum InvocationOutcome {
|
|
4
|
+
SUCCESS = "success",
|
|
5
|
+
FAILURE = "failure",
|
|
6
|
+
PENDING = "pending"
|
|
7
|
+
}
|
|
8
|
+
export declare enum InvocationTraceEventType {
|
|
9
|
+
START = "start",
|
|
10
|
+
END = "end"
|
|
11
|
+
}
|
|
12
|
+
export declare const TraceEventException: S.Struct<{
|
|
13
|
+
timestampMs: typeof S.Number;
|
|
14
|
+
message: typeof S.String;
|
|
15
|
+
name: typeof S.String;
|
|
16
|
+
stack: S.optional<typeof S.String>;
|
|
17
|
+
}>;
|
|
18
|
+
export type TraceEventException = S.Schema.Type<typeof TraceEventException>;
|
|
19
|
+
export declare const InvocationTraceStartEvent: import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
20
|
+
/**
|
|
21
|
+
* Queue message id.
|
|
22
|
+
*/
|
|
23
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
24
|
+
type: S.Literal<[InvocationTraceEventType.START]>;
|
|
25
|
+
/**
|
|
26
|
+
* Invocation id, the same for invocation start and end events.
|
|
27
|
+
*/
|
|
28
|
+
invocationId: import("@dxos/echo-schema").ObjectIdClass;
|
|
29
|
+
/**
|
|
30
|
+
* Event generation time.
|
|
31
|
+
*/
|
|
32
|
+
timestampMs: typeof S.Number;
|
|
33
|
+
/**
|
|
34
|
+
* Data passed to function / workflow as an argument.
|
|
35
|
+
*/
|
|
36
|
+
input: typeof S.Object;
|
|
37
|
+
/**
|
|
38
|
+
* Queue DXN for function/workflow invocation events.
|
|
39
|
+
*/
|
|
40
|
+
invocationTraceQueue: import("@dxos/echo-schema").Ref$<Expando>;
|
|
41
|
+
/**
|
|
42
|
+
* DXN of the invoked function/workflow.
|
|
43
|
+
*/
|
|
44
|
+
invocationTarget: import("@dxos/echo-schema").Ref$<Expando>;
|
|
45
|
+
/**
|
|
46
|
+
* Present for automatic invocations.
|
|
47
|
+
*/
|
|
48
|
+
trigger: S.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<{
|
|
49
|
+
readonly function: S.optional<S.SchemaClass<string, string, never>>;
|
|
50
|
+
readonly enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
51
|
+
readonly spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
52
|
+
type: S.Literal<[import("./types").TriggerKind.Timer]>;
|
|
53
|
+
cron: S.SchemaClass<string, string, never>;
|
|
54
|
+
}>>, S.mutable<S.Struct<{
|
|
55
|
+
type: S.Literal<[import("./types").TriggerKind.Webhook]>;
|
|
56
|
+
method: S.optional<S.SchemaClass<string, string, never>>;
|
|
57
|
+
port: S.optional<S.SchemaClass<number, number, never>>;
|
|
58
|
+
}>>, S.mutable<S.Struct<{
|
|
59
|
+
type: S.Literal<[import("./types").TriggerKind.Subscription]>;
|
|
60
|
+
filter: S.Struct<{
|
|
61
|
+
type: S.optional<S.SchemaClass<string, string, never>>;
|
|
62
|
+
props: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
|
|
63
|
+
}>;
|
|
64
|
+
options: S.optional<S.Struct<{
|
|
65
|
+
deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
66
|
+
delay: S.optional<S.SchemaClass<number, number, never>>;
|
|
67
|
+
}>>;
|
|
68
|
+
}>>, S.mutable<S.Struct<{
|
|
69
|
+
type: S.Literal<[import("./types").TriggerKind.Email]>;
|
|
70
|
+
}>>, S.mutable<S.Struct<{
|
|
71
|
+
type: S.Literal<[import("./types").TriggerKind.Queue]>;
|
|
72
|
+
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
73
|
+
}>>]>>;
|
|
74
|
+
readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
75
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>>>;
|
|
76
|
+
}>>;
|
|
77
|
+
export type InvocationTraceStartEvent = S.Schema.Type<typeof InvocationTraceStartEvent>;
|
|
78
|
+
export declare const InvocationTraceEndEvent: import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
79
|
+
/**
|
|
80
|
+
* Trace event id.
|
|
81
|
+
*/
|
|
82
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
83
|
+
type: S.Literal<[InvocationTraceEventType.END]>;
|
|
84
|
+
/**
|
|
85
|
+
* Invocation id, will be the same for invocation start and end.
|
|
86
|
+
*/
|
|
87
|
+
invocationId: import("@dxos/echo-schema").ObjectIdClass;
|
|
88
|
+
/**
|
|
89
|
+
* Event generation time.
|
|
90
|
+
*/
|
|
91
|
+
timestampMs: typeof S.Number;
|
|
92
|
+
outcome: S.Enums<typeof InvocationOutcome>;
|
|
93
|
+
exception: S.optional<S.Struct<{
|
|
94
|
+
timestampMs: typeof S.Number;
|
|
95
|
+
message: typeof S.String;
|
|
96
|
+
name: typeof S.String;
|
|
97
|
+
stack: S.optional<typeof S.String>;
|
|
98
|
+
}>>;
|
|
99
|
+
}>>;
|
|
100
|
+
export type InvocationTraceEndEvent = S.Schema.Type<typeof InvocationTraceEndEvent>;
|
|
101
|
+
export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
|
|
102
|
+
export declare const TraceEventLog: S.Struct<{
|
|
103
|
+
timestampMs: typeof S.Number;
|
|
104
|
+
level: typeof S.String;
|
|
105
|
+
message: typeof S.String;
|
|
106
|
+
context: S.optional<typeof S.Object>;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const TraceEvent: import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
109
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
110
|
+
outcome: typeof S.String;
|
|
111
|
+
truncated: typeof S.Boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Time when the event was persisted.
|
|
114
|
+
*/
|
|
115
|
+
ingestionTimestampMs: typeof S.Number;
|
|
116
|
+
logs: S.Array$<S.Struct<{
|
|
117
|
+
timestampMs: typeof S.Number;
|
|
118
|
+
level: typeof S.String;
|
|
119
|
+
message: typeof S.String;
|
|
120
|
+
context: S.optional<typeof S.Object>;
|
|
121
|
+
}>>;
|
|
122
|
+
exceptions: S.Array$<S.Struct<{
|
|
123
|
+
timestampMs: typeof S.Number;
|
|
124
|
+
message: typeof S.String;
|
|
125
|
+
name: typeof S.String;
|
|
126
|
+
stack: S.optional<typeof S.String>;
|
|
127
|
+
}>>;
|
|
128
|
+
}>>;
|
|
129
|
+
export type TraceEvent = S.Schema.Type<typeof TraceEvent>;
|
|
130
|
+
/**
|
|
131
|
+
* Deprecated InvocationTrace event format.
|
|
132
|
+
* @deprecated
|
|
133
|
+
*/
|
|
134
|
+
export type InvocationSpan = {
|
|
135
|
+
id: string;
|
|
136
|
+
timestampMs: number;
|
|
137
|
+
outcome: InvocationOutcome;
|
|
138
|
+
input: object;
|
|
139
|
+
durationMs: number;
|
|
140
|
+
invocationTraceQueue: Ref<Expando>;
|
|
141
|
+
invocationTarget: Ref<Expando>;
|
|
142
|
+
trigger?: Ref<FunctionTriggerType>;
|
|
143
|
+
exception?: TraceEventException;
|
|
144
|
+
};
|
|
145
|
+
export declare const createInvocationSpans: (items?: InvocationTraceEvent[]) => InvocationSpan[];
|
|
146
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../../src/types/trace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,OAAO,EAAY,GAAG,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAmB,KAAK,mB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AM,CAAC;IACnB,oBAAoB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,oBAAoB,EAAE,KAAG,cAAc,EAkDpF,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Expando, Ref } from '@dxos/echo-schema';
|
|
3
|
-
import { FunctionType } from './schema';
|
|
1
|
+
import { S } from '@dxos/echo-schema';
|
|
4
2
|
/**
|
|
5
3
|
* Type discriminator for TriggerType.
|
|
6
4
|
* Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
|
|
@@ -81,53 +79,11 @@ export declare const TriggerSchema: S.Union<[S.mutable<S.Struct<{
|
|
|
81
79
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
82
80
|
}>>]>;
|
|
83
81
|
export type TriggerType = S.Schema.Type<typeof TriggerSchema>;
|
|
84
|
-
export type EventType = EmailTriggerOutput | WebhookTriggerOutput | QueueTriggerOutput | SubscriptionTriggerOutput | TimerTriggerOutput;
|
|
85
|
-
export declare const EmailTriggerOutput: S.mutable<S.Struct<{
|
|
86
|
-
from: typeof S.String;
|
|
87
|
-
to: typeof S.String;
|
|
88
|
-
subject: typeof S.String;
|
|
89
|
-
created: typeof S.String;
|
|
90
|
-
body: typeof S.String;
|
|
91
|
-
}>>;
|
|
92
|
-
export type EmailTriggerOutput = S.Schema.Type<typeof EmailTriggerOutput>;
|
|
93
|
-
export declare const WebhookTriggerOutput: S.mutable<S.Struct<{
|
|
94
|
-
url: typeof S.String;
|
|
95
|
-
method: S.Literal<["GET", "POST"]>;
|
|
96
|
-
headers: S.Record$<typeof S.String, typeof S.String>;
|
|
97
|
-
bodyText: typeof S.String;
|
|
98
|
-
}>>;
|
|
99
|
-
export type WebhookTriggerOutput = S.Schema.Type<typeof WebhookTriggerOutput>;
|
|
100
|
-
export declare const QueueTriggerOutput: S.mutable<S.Struct<{
|
|
101
|
-
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
102
|
-
item: typeof S.Any;
|
|
103
|
-
cursor: typeof S.String;
|
|
104
|
-
}>>;
|
|
105
|
-
export type QueueTriggerOutput = S.Schema.Type<typeof QueueTriggerOutput>;
|
|
106
|
-
export declare const SubscriptionTriggerOutput: S.mutable<S.Struct<{
|
|
107
|
-
type: typeof S.String;
|
|
108
|
-
changedObjectId: typeof S.String;
|
|
109
|
-
}>>;
|
|
110
|
-
export type SubscriptionTriggerOutput = S.Schema.Type<typeof SubscriptionTriggerOutput>;
|
|
111
|
-
export declare const TimerTriggerOutput: S.mutable<S.Struct<{
|
|
112
|
-
tick: typeof S.Number;
|
|
113
|
-
}>>;
|
|
114
|
-
export type TimerTriggerOutput = S.Schema.Type<typeof TimerTriggerOutput>;
|
|
115
82
|
/**
|
|
116
83
|
* Function trigger.
|
|
117
|
-
* Function is invoked with the `payload` passed as input data.
|
|
118
|
-
* The event that triggers the function is available in the function context.
|
|
119
84
|
*/
|
|
120
85
|
export declare const FunctionTriggerSchema: S.Struct<{
|
|
121
|
-
|
|
122
|
-
* Function or workflow to invoke.
|
|
123
|
-
*/
|
|
124
|
-
function: S.optional<S.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
125
|
-
/**
|
|
126
|
-
* Only used for workflows.
|
|
127
|
-
* Specifies the input node in the circuit.
|
|
128
|
-
* @deprecated Remove and enforce a single input node in all compute graphs.
|
|
129
|
-
*/
|
|
130
|
-
inputNodeId: S.optional<S.SchemaClass<string, string, never>>;
|
|
86
|
+
function: S.optional<S.SchemaClass<string, string, never>>;
|
|
131
87
|
enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
132
88
|
spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
133
89
|
type: S.Literal<[TriggerKind.Timer]>;
|
|
@@ -152,33 +108,13 @@ export declare const FunctionTriggerSchema: S.Struct<{
|
|
|
152
108
|
type: S.Literal<[TriggerKind.Queue]>;
|
|
153
109
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
154
110
|
}>>]>>;
|
|
155
|
-
|
|
156
|
-
* Passed as the input data to the function.
|
|
157
|
-
* Must match the function's input schema.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* {
|
|
161
|
-
* item: '{{$.trigger.event}}',
|
|
162
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
163
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
164
|
-
* }
|
|
165
|
-
*/
|
|
166
|
-
input: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
111
|
+
meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
167
112
|
}>;
|
|
168
113
|
export type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;
|
|
169
|
-
declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
function: S.optional<S.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
174
|
-
/**
|
|
175
|
-
* Only used for workflows.
|
|
176
|
-
* Specifies the input node in the circuit.
|
|
177
|
-
* @deprecated Remove and enforce a single input node in all compute graphs.
|
|
178
|
-
*/
|
|
179
|
-
inputNodeId: S.optional<S.SchemaClass<string, string, never>>;
|
|
180
|
-
enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
181
|
-
spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
114
|
+
declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
|
|
115
|
+
readonly function: S.optional<S.SchemaClass<string, string, never>>;
|
|
116
|
+
readonly enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
117
|
+
readonly spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
182
118
|
type: S.Literal<[TriggerKind.Timer]>;
|
|
183
119
|
cron: S.SchemaClass<string, string, never>;
|
|
184
120
|
}>>, S.mutable<S.Struct<{
|
|
@@ -201,31 +137,11 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
|
|
|
201
137
|
type: S.Literal<[TriggerKind.Queue]>;
|
|
202
138
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
203
139
|
}>>]>>;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
* {
|
|
210
|
-
* item: '{{$.trigger.event}}',
|
|
211
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
212
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
213
|
-
* }
|
|
214
|
-
*/
|
|
215
|
-
input: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
216
|
-
}>, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<Readonly<{
|
|
217
|
-
/**
|
|
218
|
-
* Function or workflow to invoke.
|
|
219
|
-
*/
|
|
220
|
-
function: S.optional<S.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
221
|
-
/**
|
|
222
|
-
* Only used for workflows.
|
|
223
|
-
* Specifies the input node in the circuit.
|
|
224
|
-
* @deprecated Remove and enforce a single input node in all compute graphs.
|
|
225
|
-
*/
|
|
226
|
-
inputNodeId: S.optional<S.SchemaClass<string, string, never>>;
|
|
227
|
-
enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
228
|
-
spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
140
|
+
readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
141
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<{
|
|
142
|
+
readonly function: S.optional<S.SchemaClass<string, string, never>>;
|
|
143
|
+
readonly enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
144
|
+
readonly spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
229
145
|
type: S.Literal<[TriggerKind.Timer]>;
|
|
230
146
|
cron: S.SchemaClass<string, string, never>;
|
|
231
147
|
}>>, S.mutable<S.Struct<{
|
|
@@ -248,76 +164,49 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
|
|
|
248
164
|
type: S.Literal<[TriggerKind.Queue]>;
|
|
249
165
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
250
166
|
}>>]>>;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* Must match the function's input schema.
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* {
|
|
257
|
-
* item: '{{$.trigger.event}}',
|
|
258
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
259
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
260
|
-
* }
|
|
261
|
-
*/
|
|
262
|
-
input: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
263
|
-
}>>>;
|
|
167
|
+
readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
168
|
+
}>>;
|
|
264
169
|
/**
|
|
265
170
|
* Function trigger.
|
|
266
171
|
*/
|
|
267
172
|
export declare class FunctionTrigger extends FunctionTrigger_base {
|
|
268
173
|
}
|
|
174
|
+
declare const FunctionDef_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
|
|
175
|
+
uri: typeof S.String;
|
|
176
|
+
description: S.optional<typeof S.String>;
|
|
177
|
+
route: typeof S.String;
|
|
178
|
+
handler: typeof S.String;
|
|
179
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<{
|
|
180
|
+
uri: typeof S.String;
|
|
181
|
+
description: S.optional<typeof S.String>;
|
|
182
|
+
route: typeof S.String;
|
|
183
|
+
handler: typeof S.String;
|
|
184
|
+
}>>;
|
|
185
|
+
/**
|
|
186
|
+
* Function definition.
|
|
187
|
+
* @deprecated (Use dxos.org/type/Function)
|
|
188
|
+
*/
|
|
189
|
+
export declare class FunctionDef extends FunctionDef_base {
|
|
190
|
+
}
|
|
269
191
|
/**
|
|
270
192
|
* Function manifest file.
|
|
271
193
|
*/
|
|
272
194
|
export declare const FunctionManifestSchema: S.Struct<{
|
|
273
195
|
functions: S.optional<S.mutable<S.Array$<S.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<{
|
|
274
|
-
|
|
275
|
-
version: typeof S.String;
|
|
196
|
+
uri: typeof S.String;
|
|
276
197
|
description: S.optional<typeof S.String>;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
name?: string | undefined;
|
|
280
|
-
description?: string | undefined;
|
|
281
|
-
changed?: boolean | undefined;
|
|
282
|
-
source: Ref<{
|
|
283
|
-
readonly id: string;
|
|
284
|
-
content: string;
|
|
285
|
-
}>;
|
|
286
|
-
}>>;
|
|
287
|
-
inputSchema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
288
|
-
outputSchema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
289
|
-
binding: S.optional<typeof S.String>;
|
|
198
|
+
route: typeof S.String;
|
|
199
|
+
handler: typeof S.String;
|
|
290
200
|
}, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, S.Struct.Encoded<{
|
|
291
|
-
|
|
292
|
-
version: typeof S.String;
|
|
201
|
+
uri: typeof S.String;
|
|
293
202
|
description: S.optional<typeof S.String>;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
name?: string | undefined;
|
|
297
|
-
description?: string | undefined;
|
|
298
|
-
changed?: boolean | undefined;
|
|
299
|
-
source: Ref<{
|
|
300
|
-
readonly id: string;
|
|
301
|
-
content: string;
|
|
302
|
-
}>;
|
|
303
|
-
}>>;
|
|
304
|
-
inputSchema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
305
|
-
outputSchema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
306
|
-
binding: S.optional<typeof S.String>;
|
|
203
|
+
route: typeof S.String;
|
|
204
|
+
handler: typeof S.String;
|
|
307
205
|
}>, never>>>>;
|
|
308
|
-
triggers: S.optional<S.mutable<S.Array$<S.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
function: S.optional<S.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
313
|
-
/**
|
|
314
|
-
* Only used for workflows.
|
|
315
|
-
* Specifies the input node in the circuit.
|
|
316
|
-
* @deprecated Remove and enforce a single input node in all compute graphs.
|
|
317
|
-
*/
|
|
318
|
-
inputNodeId: S.optional<S.SchemaClass<string, string, never>>;
|
|
319
|
-
enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
320
|
-
spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
206
|
+
triggers: S.optional<S.mutable<S.Array$<S.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<{
|
|
207
|
+
readonly function: S.optional<S.SchemaClass<string, string, never>>;
|
|
208
|
+
readonly enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
209
|
+
readonly spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
321
210
|
type: S.Literal<[TriggerKind.Timer]>;
|
|
322
211
|
cron: S.SchemaClass<string, string, never>;
|
|
323
212
|
}>>, S.mutable<S.Struct<{
|
|
@@ -340,31 +229,11 @@ export declare const FunctionManifestSchema: S.Struct<{
|
|
|
340
229
|
type: S.Literal<[TriggerKind.Queue]>;
|
|
341
230
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
342
231
|
}>>]>>;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
* {
|
|
349
|
-
* item: '{{$.trigger.event}}',
|
|
350
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
351
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
352
|
-
* }
|
|
353
|
-
*/
|
|
354
|
-
input: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
355
|
-
}>, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, S.Struct.Encoded<Readonly<{
|
|
356
|
-
/**
|
|
357
|
-
* Function or workflow to invoke.
|
|
358
|
-
*/
|
|
359
|
-
function: S.optional<S.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
360
|
-
/**
|
|
361
|
-
* Only used for workflows.
|
|
362
|
-
* Specifies the input node in the circuit.
|
|
363
|
-
* @deprecated Remove and enforce a single input node in all compute graphs.
|
|
364
|
-
*/
|
|
365
|
-
inputNodeId: S.optional<S.SchemaClass<string, string, never>>;
|
|
366
|
-
enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
367
|
-
spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
232
|
+
readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
233
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, S.Struct.Encoded<{
|
|
234
|
+
readonly function: S.optional<S.SchemaClass<string, string, never>>;
|
|
235
|
+
readonly enabled: S.optional<S.SchemaClass<boolean, boolean, never>>;
|
|
236
|
+
readonly spec: S.optional<S.Union<[S.mutable<S.Struct<{
|
|
368
237
|
type: S.Literal<[TriggerKind.Timer]>;
|
|
369
238
|
cron: S.SchemaClass<string, string, never>;
|
|
370
239
|
}>>, S.mutable<S.Struct<{
|
|
@@ -387,21 +256,10 @@ export declare const FunctionManifestSchema: S.Struct<{
|
|
|
387
256
|
type: S.Literal<[TriggerKind.Queue]>;
|
|
388
257
|
queue: S.refine<string, typeof S.NonEmptyString>;
|
|
389
258
|
}>>]>>;
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
* Must match the function's input schema.
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
|
-
* {
|
|
396
|
-
* item: '{{$.trigger.event}}',
|
|
397
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
398
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
399
|
-
* }
|
|
400
|
-
*/
|
|
401
|
-
input: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
402
|
-
}>>, never>>>>;
|
|
259
|
+
readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
|
|
260
|
+
}>, never>>>>;
|
|
403
261
|
}>;
|
|
404
262
|
export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
|
|
405
|
-
export declare const FUNCTION_TYPES: (typeof
|
|
263
|
+
export declare const FUNCTION_TYPES: (typeof FunctionTrigger | typeof FunctionDef)[];
|
|
406
264
|
export {};
|
|
407
265
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuC,CAAC,EAAoB,MAAM,mBAAmB,CAAC;AAE7F;;;;GAIG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,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GG;AAEH,qBAAa,WAAY,SAAQ,gBAQ/B;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,iDAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/types/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,OAAO,MAAM;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAmC,CAAC;AAEhH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../tools/schema.ts"],"names":[],"mappings":""}
|