@dxos/functions 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963
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/neutral/index.mjs +155 -920
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -1
- package/dist/types/src/protocol/protocol.d.ts +2 -2
- package/dist/types/src/protocol/protocol.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +5 -112
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/services/credentials.d.ts +15 -38
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/function-invocation-service.d.ts +5 -6
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
- package/dist/types/src/services/index.d.ts +1 -4
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +1 -46
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +1 -84
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/url.d.ts +3 -3
- package/dist/types/src/types/url.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/index.ts +0 -2
- package/src/protocol/protocol.test.ts +9 -10
- package/src/protocol/protocol.ts +68 -34
- package/src/sdk.ts +10 -278
- package/src/services/credentials.ts +75 -118
- package/src/services/function-invocation-service.ts +6 -10
- package/src/services/index.ts +1 -4
- package/src/services/queues.ts +1 -78
- package/src/services/tracing.ts +0 -159
- package/src/types/index.ts +0 -4
- package/src/types/url.ts +3 -3
- package/dist/types/src/errors.d.ts +0 -121
- package/dist/types/src/errors.d.ts.map +0 -1
- package/dist/types/src/example/fib.d.ts +0 -7
- package/dist/types/src/example/fib.d.ts.map +0 -1
- package/dist/types/src/example/forex-effect.d.ts +0 -3
- package/dist/types/src/example/forex-effect.d.ts.map +0 -1
- package/dist/types/src/example/index.d.ts +0 -12
- package/dist/types/src/example/index.d.ts.map +0 -1
- package/dist/types/src/example/reply.d.ts +0 -3
- package/dist/types/src/example/reply.d.ts.map +0 -1
- package/dist/types/src/example/sleep.d.ts +0 -5
- package/dist/types/src/example/sleep.d.ts.map +0 -1
- package/dist/types/src/operation-compatibility.test.d.ts +0 -2
- package/dist/types/src/operation-compatibility.test.d.ts.map +0 -1
- package/dist/types/src/services/event-logger.d.ts +0 -81
- package/dist/types/src/services/event-logger.d.ts.map +0 -1
- package/dist/types/src/types/Function.d.ts +0 -52
- package/dist/types/src/types/Function.d.ts.map +0 -1
- package/dist/types/src/types/Script.d.ts +0 -21
- package/dist/types/src/types/Script.d.ts.map +0 -1
- package/dist/types/src/types/Trigger.d.ts +0 -122
- package/dist/types/src/types/Trigger.d.ts.map +0 -1
- package/dist/types/src/types/TriggerEvent.d.ts +0 -75
- package/dist/types/src/types/TriggerEvent.d.ts.map +0 -1
- package/src/errors.ts +0 -21
- package/src/example/fib.ts +0 -32
- package/src/example/forex-effect.ts +0 -40
- package/src/example/index.ts +0 -13
- package/src/example/reply.ts +0 -21
- package/src/example/sleep.ts +0 -24
- package/src/operation-compatibility.test.ts +0 -185
- package/src/services/event-logger.ts +0 -127
- package/src/types/Function.ts +0 -83
- package/src/types/Script.ts +0 -34
- package/src/types/Trigger.ts +0 -153
- package/src/types/TriggerEvent.ts +0 -62
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/example/forex-effect.ts"],"names":[],"mappings":";AAeA,wBAwBG"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const ExampleFunctions: {
|
|
2
|
-
Fibonacci: import("..").FunctionDefinition<{
|
|
3
|
-
readonly iterations?: number | undefined;
|
|
4
|
-
}, {
|
|
5
|
-
readonly result: string;
|
|
6
|
-
}, import("..").FunctionServices>;
|
|
7
|
-
Reply: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
|
|
8
|
-
Sleep: import("..").FunctionDefinition<{
|
|
9
|
-
readonly duration?: number | undefined;
|
|
10
|
-
}, void, import("..").FunctionServices>;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/example/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB;;;;;;;;;;CAI5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/example/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/example/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-compatibility.test.d.ts","sourceRoot":"","sources":["../../../src/operation-compatibility.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import * as Context from 'effect/Context';
|
|
2
|
-
import * as Effect from 'effect/Effect';
|
|
3
|
-
import * as Layer from 'effect/Layer';
|
|
4
|
-
import * as Schema from 'effect/Schema';
|
|
5
|
-
import { Type } from '@dxos/echo';
|
|
6
|
-
import { LogLevel } from '@dxos/log';
|
|
7
|
-
import { TracingService } from './tracing';
|
|
8
|
-
export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
|
|
9
|
-
type: Schema.Literal<["begin-compute"]>;
|
|
10
|
-
nodeId: typeof Schema.String;
|
|
11
|
-
/**
|
|
12
|
-
* Names of the inputs begin computed.
|
|
13
|
-
*/
|
|
14
|
-
inputs: Schema.Array$<typeof Schema.String>;
|
|
15
|
-
}>, Schema.Struct<{
|
|
16
|
-
type: Schema.Literal<["end-compute"]>;
|
|
17
|
-
nodeId: typeof Schema.String;
|
|
18
|
-
/**
|
|
19
|
-
* Names of the outputs computed.
|
|
20
|
-
*/
|
|
21
|
-
outputs: Schema.Array$<typeof Schema.String>;
|
|
22
|
-
}>, Schema.Struct<{
|
|
23
|
-
type: Schema.Literal<["compute-input"]>;
|
|
24
|
-
nodeId: typeof Schema.String;
|
|
25
|
-
property: typeof Schema.String;
|
|
26
|
-
value: typeof Schema.Any;
|
|
27
|
-
}>, Schema.Struct<{
|
|
28
|
-
type: Schema.Literal<["compute-output"]>;
|
|
29
|
-
nodeId: typeof Schema.String;
|
|
30
|
-
property: typeof Schema.String;
|
|
31
|
-
value: typeof Schema.Any;
|
|
32
|
-
}>, Schema.Struct<{
|
|
33
|
-
type: Schema.Literal<["custom"]>;
|
|
34
|
-
nodeId: typeof Schema.String;
|
|
35
|
-
event: typeof Schema.Any;
|
|
36
|
-
}>]>;
|
|
37
|
-
export type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;
|
|
38
|
-
export declare const ComputeEvent: Type.Obj<{
|
|
39
|
-
readonly payload: {
|
|
40
|
-
readonly type: "begin-compute";
|
|
41
|
-
readonly nodeId: string;
|
|
42
|
-
readonly inputs: readonly string[];
|
|
43
|
-
} | {
|
|
44
|
-
readonly type: "end-compute";
|
|
45
|
-
readonly nodeId: string;
|
|
46
|
-
readonly outputs: readonly string[];
|
|
47
|
-
} | {
|
|
48
|
-
readonly type: "compute-input";
|
|
49
|
-
readonly value: any;
|
|
50
|
-
readonly nodeId: string;
|
|
51
|
-
readonly property: string;
|
|
52
|
-
} | {
|
|
53
|
-
readonly type: "compute-output";
|
|
54
|
-
readonly value: any;
|
|
55
|
-
readonly nodeId: string;
|
|
56
|
-
readonly property: string;
|
|
57
|
-
} | {
|
|
58
|
-
readonly type: "custom";
|
|
59
|
-
readonly nodeId: string;
|
|
60
|
-
readonly event: any;
|
|
61
|
-
};
|
|
62
|
-
}, Schema.Struct.Fields>;
|
|
63
|
-
declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
|
|
64
|
-
readonly log: (event: ComputeEventPayload) => void;
|
|
65
|
-
readonly nodeId: string | undefined;
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Logs event for the compute workflows.
|
|
69
|
-
*/
|
|
70
|
-
export declare class ComputeEventLogger extends ComputeEventLogger_base {
|
|
71
|
-
static noop: Context.Tag.Service<ComputeEventLogger>;
|
|
72
|
-
/**
|
|
73
|
-
* Implements ComputeEventLogger using TracingService.
|
|
74
|
-
*/
|
|
75
|
-
static layerFromTracing: Layer.Layer<ComputeEventLogger, never, TracingService>;
|
|
76
|
-
}
|
|
77
|
-
export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
|
|
78
|
-
export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
|
|
79
|
-
export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
|
|
80
|
-
export {};
|
|
81
|
-
//# 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,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAO,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;IAI5B;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;IAoBN,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;wBAEyD,CAAC;;kBAOjE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAGrC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAGlD;IAEF;;OAEG;IACH,MAAM,CAAC,gBAAgB,yDAWrB;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,mDAWpC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMrG,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,UAAS,MAAgB,KACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAiBxC,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Obj, Type } from '@dxos/echo';
|
|
3
|
-
/**
|
|
4
|
-
* Function deployment.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Function: Type.Obj<{
|
|
7
|
-
readonly version: string;
|
|
8
|
-
readonly source?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
9
|
-
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
10
|
-
readonly content: string;
|
|
11
|
-
}>;
|
|
12
|
-
readonly description?: string | undefined;
|
|
13
|
-
readonly name?: string | undefined;
|
|
14
|
-
readonly changed?: boolean | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly description?: string | undefined;
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly key?: string | undefined;
|
|
19
|
-
readonly updated?: string | undefined;
|
|
20
|
-
readonly inputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
21
|
-
readonly outputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
22
|
-
readonly services?: readonly string[] | undefined;
|
|
23
|
-
readonly binding?: string | undefined;
|
|
24
|
-
}, Schema.Struct.Fields>;
|
|
25
|
-
export interface Function extends Schema.Schema.Type<typeof Function> {
|
|
26
|
-
}
|
|
27
|
-
export declare const make: (props: Obj.MakeProps<typeof Function>) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
28
|
-
readonly version: string;
|
|
29
|
-
readonly source?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
30
|
-
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
31
|
-
readonly content: string;
|
|
32
|
-
}>;
|
|
33
|
-
readonly description?: string | undefined;
|
|
34
|
-
readonly name?: string | undefined;
|
|
35
|
-
readonly changed?: boolean | undefined;
|
|
36
|
-
}> | undefined;
|
|
37
|
-
readonly description?: string | undefined;
|
|
38
|
-
readonly name: string;
|
|
39
|
-
readonly key?: string | undefined;
|
|
40
|
-
readonly updated?: string | undefined;
|
|
41
|
-
readonly inputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
42
|
-
readonly outputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
43
|
-
readonly services?: readonly string[] | undefined;
|
|
44
|
-
readonly binding?: string | undefined;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Copies properties from source to target.
|
|
48
|
-
* @param target - Target object to copy properties to.
|
|
49
|
-
* @param source - Source object to copy properties from.
|
|
50
|
-
*/
|
|
51
|
-
export declare const setFrom: (target: Function, source: Function) => void;
|
|
52
|
-
//# sourceMappingURL=Function.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Function.d.ts","sourceRoot":"","sources":["../../../../src/types/Function.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAA0B,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAKpE;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;wBA6CpB,CAAC;AAEF,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,CAAC,SAAS,CAAC,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,QAAQ,QAAQ,SAYzD,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Obj, Type } from '@dxos/echo';
|
|
3
|
-
/**
|
|
4
|
-
* Source script.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Script: Type.Obj<{
|
|
7
|
-
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
8
|
-
readonly content: string;
|
|
9
|
-
}>;
|
|
10
|
-
readonly description?: string | undefined;
|
|
11
|
-
readonly name?: string | undefined;
|
|
12
|
-
readonly changed?: boolean | undefined;
|
|
13
|
-
}, Schema.Struct.Fields>;
|
|
14
|
-
export interface Script extends Schema.Schema.Type<typeof Script> {
|
|
15
|
-
}
|
|
16
|
-
type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
|
|
17
|
-
source?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const make: ({ source, ...props }?: Props) => Script;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=Script.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../../src/types/Script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAc,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;wBAalB,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC;CAAG;AAEpE,KAAK,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,eAAO,MAAM,IAAI,GAAI,uBAA2B,KAAU,KAAG,MACQ,CAAC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Obj, QueryAST, Type } from '@dxos/echo';
|
|
3
|
-
/**
|
|
4
|
-
* Type discriminator for TriggerType.
|
|
5
|
-
* Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
|
|
6
|
-
* https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
|
|
7
|
-
*/
|
|
8
|
-
export declare const Kinds: readonly ["email", "queue", "subscription", "timer", "webhook"];
|
|
9
|
-
export type Kind = (typeof Kinds)[number];
|
|
10
|
-
export declare const EmailSpec: Schema.Struct<{
|
|
11
|
-
kind: Schema.Literal<["email"]>;
|
|
12
|
-
}>;
|
|
13
|
-
export type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;
|
|
14
|
-
export declare const QueueSpec: Schema.Struct<{
|
|
15
|
-
kind: Schema.Literal<["queue"]>;
|
|
16
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
17
|
-
}>;
|
|
18
|
-
export type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;
|
|
19
|
-
/**
|
|
20
|
-
* Subscription.
|
|
21
|
-
*/
|
|
22
|
-
export declare const SubscriptionSpec: Schema.Struct<{
|
|
23
|
-
kind: Schema.Literal<["subscription"]>;
|
|
24
|
-
query: Schema.Struct<{
|
|
25
|
-
raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
26
|
-
ast: Schema.Schema<QueryAST.QuerySelectClause | QueryAST.QueryFilterClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryUnionClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryOrderClause | QueryAST.QueryOptionsClause | QueryAST.QueryLimitClause | QueryAST.QueryFromClause, QueryAST.QuerySelectClause | QueryAST.QueryFilterClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryUnionClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryOrderClause | QueryAST.QueryOptionsClause | QueryAST.QueryLimitClause | QueryAST.QueryFromClause, never>;
|
|
27
|
-
}>;
|
|
28
|
-
options: Schema.optional<Schema.Struct<{
|
|
29
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
30
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
31
|
-
}>>;
|
|
32
|
-
}>;
|
|
33
|
-
export type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;
|
|
34
|
-
/**
|
|
35
|
-
* Cron timer.
|
|
36
|
-
*/
|
|
37
|
-
export declare const TimerSpec: Schema.Struct<{
|
|
38
|
-
kind: Schema.Literal<["timer"]>;
|
|
39
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
40
|
-
}>;
|
|
41
|
-
export type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;
|
|
42
|
-
/**
|
|
43
|
-
* Webhook.
|
|
44
|
-
*/
|
|
45
|
-
export declare const WebhookSpec: Schema.Struct<{
|
|
46
|
-
kind: Schema.Literal<["webhook"]>;
|
|
47
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
48
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
49
|
-
}>;
|
|
50
|
-
export type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;
|
|
51
|
-
/**
|
|
52
|
-
* Trigger schema.
|
|
53
|
-
*/
|
|
54
|
-
export declare const Spec: Schema.Union<[Schema.Struct<{
|
|
55
|
-
kind: Schema.Literal<["email"]>;
|
|
56
|
-
}>, Schema.Struct<{
|
|
57
|
-
kind: Schema.Literal<["queue"]>;
|
|
58
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
59
|
-
}>, Schema.Struct<{
|
|
60
|
-
kind: Schema.Literal<["subscription"]>;
|
|
61
|
-
query: Schema.Struct<{
|
|
62
|
-
raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
63
|
-
ast: Schema.Schema<QueryAST.QuerySelectClause | QueryAST.QueryFilterClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryUnionClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryOrderClause | QueryAST.QueryOptionsClause | QueryAST.QueryLimitClause | QueryAST.QueryFromClause, QueryAST.QuerySelectClause | QueryAST.QueryFilterClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryUnionClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryOrderClause | QueryAST.QueryOptionsClause | QueryAST.QueryLimitClause | QueryAST.QueryFromClause, never>;
|
|
64
|
-
}>;
|
|
65
|
-
options: Schema.optional<Schema.Struct<{
|
|
66
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
67
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
68
|
-
}>>;
|
|
69
|
-
}>, Schema.Struct<{
|
|
70
|
-
kind: Schema.Literal<["timer"]>;
|
|
71
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
72
|
-
}>, Schema.Struct<{
|
|
73
|
-
kind: Schema.Literal<["webhook"]>;
|
|
74
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
75
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
76
|
-
}>]>;
|
|
77
|
-
export type Spec = Schema.Schema.Type<typeof Spec>;
|
|
78
|
-
/**
|
|
79
|
-
* Function trigger.
|
|
80
|
-
* Function is invoked with the `payload` passed as input data.
|
|
81
|
-
* The event that triggers the function is available in the function context.
|
|
82
|
-
*/
|
|
83
|
-
declare const TriggerSchema: Type.Obj<{
|
|
84
|
-
readonly function?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
85
|
-
readonly [x: string]: any;
|
|
86
|
-
}> | undefined;
|
|
87
|
-
readonly inputNodeId?: string | undefined;
|
|
88
|
-
readonly enabled?: boolean | undefined;
|
|
89
|
-
readonly spec?: {
|
|
90
|
-
readonly kind: "email";
|
|
91
|
-
} | {
|
|
92
|
-
readonly queue: string;
|
|
93
|
-
readonly kind: "queue";
|
|
94
|
-
} | {
|
|
95
|
-
readonly kind: "subscription";
|
|
96
|
-
readonly query: {
|
|
97
|
-
readonly raw?: string | undefined;
|
|
98
|
-
readonly ast: QueryAST.QuerySelectClause | QueryAST.QueryFilterClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryUnionClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryOrderClause | QueryAST.QueryOptionsClause | QueryAST.QueryLimitClause | QueryAST.QueryFromClause;
|
|
99
|
-
};
|
|
100
|
-
readonly options?: {
|
|
101
|
-
readonly deep?: boolean | undefined;
|
|
102
|
-
readonly delay?: number | undefined;
|
|
103
|
-
} | undefined;
|
|
104
|
-
} | {
|
|
105
|
-
readonly kind: "timer";
|
|
106
|
-
readonly cron: string;
|
|
107
|
-
} | {
|
|
108
|
-
readonly kind: "webhook";
|
|
109
|
-
readonly method?: string | undefined;
|
|
110
|
-
readonly port?: number | undefined;
|
|
111
|
-
} | undefined;
|
|
112
|
-
readonly concurrency?: number | undefined;
|
|
113
|
-
readonly input?: {
|
|
114
|
-
readonly [x: string]: any;
|
|
115
|
-
} | undefined;
|
|
116
|
-
}, Schema.Struct.Fields>;
|
|
117
|
-
export interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {
|
|
118
|
-
}
|
|
119
|
-
export declare const Trigger: Type.Obj<Trigger>;
|
|
120
|
-
export declare const make: (props: Obj.MakeProps<typeof Trigger>) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Trigger>;
|
|
121
|
-
export {};
|
|
122
|
-
//# sourceMappingURL=Trigger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../../src/types/Trigger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAc,GAAG,EAAE,QAAQ,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,KAAK,iEAAkE,CAAC;AACrF,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAI1C,eAAO,MAAM,SAAS;;EAEpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D,eAAO,MAAM,SAAS;;;EAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;EAc3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,SAAS;;;EAMpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,WAAW;;;;EAatB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;IAEf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnD;;;;GAIG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgDlB,CAAC;AAEF,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC;CAAG;AAC5E,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAwB,CAAC;AAE/D,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,CAAC,SAAS,CAAC,OAAO,OAAO,CAAC,+GAA6B,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
3
|
-
export declare const EmailEvent: Schema.Struct<{
|
|
4
|
-
from: typeof Schema.String;
|
|
5
|
-
to: typeof Schema.String;
|
|
6
|
-
subject: typeof Schema.String;
|
|
7
|
-
created: typeof Schema.String;
|
|
8
|
-
body: typeof Schema.String;
|
|
9
|
-
}>;
|
|
10
|
-
export type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;
|
|
11
|
-
export declare const QueueEvent: Schema.Struct<{
|
|
12
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
13
|
-
item: typeof Schema.Any;
|
|
14
|
-
cursor: typeof Schema.String;
|
|
15
|
-
}>;
|
|
16
|
-
export type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;
|
|
17
|
-
export declare const SubscriptionEvent: Schema.Struct<{
|
|
18
|
-
/**
|
|
19
|
-
* Type of the mutation.
|
|
20
|
-
*/
|
|
21
|
-
type: typeof Schema.String;
|
|
22
|
-
/**
|
|
23
|
-
* Reference to the object that was changed or created.
|
|
24
|
-
*/
|
|
25
|
-
subject: Ref.RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated
|
|
28
|
-
*/
|
|
29
|
-
changedObjectId: Schema.optional<typeof Schema.String>;
|
|
30
|
-
}>;
|
|
31
|
-
export type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;
|
|
32
|
-
export declare const TimerEvent: Schema.Struct<{
|
|
33
|
-
tick: typeof Schema.Number;
|
|
34
|
-
}>;
|
|
35
|
-
export type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;
|
|
36
|
-
export declare const WebhookEvent: Schema.Struct<{
|
|
37
|
-
url: typeof Schema.String;
|
|
38
|
-
method: Schema.Literal<["GET", "POST"]>;
|
|
39
|
-
headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
40
|
-
bodyText: typeof Schema.String;
|
|
41
|
-
}>;
|
|
42
|
-
export type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;
|
|
43
|
-
export declare const TriggerEvent: Schema.Union<[Schema.Struct<{
|
|
44
|
-
from: typeof Schema.String;
|
|
45
|
-
to: typeof Schema.String;
|
|
46
|
-
subject: typeof Schema.String;
|
|
47
|
-
created: typeof Schema.String;
|
|
48
|
-
body: typeof Schema.String;
|
|
49
|
-
}>, Schema.Struct<{
|
|
50
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
51
|
-
item: typeof Schema.Any;
|
|
52
|
-
cursor: typeof Schema.String;
|
|
53
|
-
}>, Schema.Struct<{
|
|
54
|
-
/**
|
|
55
|
-
* Type of the mutation.
|
|
56
|
-
*/
|
|
57
|
-
type: typeof Schema.String;
|
|
58
|
-
/**
|
|
59
|
-
* Reference to the object that was changed or created.
|
|
60
|
-
*/
|
|
61
|
-
subject: Ref.RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated
|
|
64
|
-
*/
|
|
65
|
-
changedObjectId: Schema.optional<typeof Schema.String>;
|
|
66
|
-
}>, Schema.Struct<{
|
|
67
|
-
tick: typeof Schema.Number;
|
|
68
|
-
}>, Schema.Struct<{
|
|
69
|
-
url: typeof Schema.String;
|
|
70
|
-
method: Schema.Literal<["GET", "POST"]>;
|
|
71
|
-
headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
72
|
-
bodyText: typeof Schema.String;
|
|
73
|
-
}>]>;
|
|
74
|
-
export type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;
|
|
75
|
-
//# sourceMappingURL=TriggerEvent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerEvent.d.ts","sourceRoot":"","sources":["../../../../src/types/TriggerEvent.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAO,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAQ3C,eAAO,MAAM,UAAU;;;;;;EAMrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,UAAU;;;;EAIrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB;IAC5B;;OAEG;;IAIH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7E,eAAO,MAAM,UAAU;;EAAyC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,YAAY;;;;;EAKvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;IA7BvB;;OAEG;;IAIH;;OAEG;;IAGH;;OAEG;;;;;;;;;IAgBwG,CAAC;AAC9G,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
package/src/errors.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { BaseError, type BaseErrorOptions } from '@dxos/errors';
|
|
6
|
-
|
|
7
|
-
export class ServiceNotAvailableError extends BaseError.extend('ServiceNotAvailable', 'Service not available') {
|
|
8
|
-
constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>) {
|
|
9
|
-
super({ context: { service }, ...options });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class FunctionNotFoundError extends BaseError.extend('FunctionNotFound', 'Function not found') {
|
|
14
|
-
constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>) {
|
|
15
|
-
super({ context: { function: functionKey }, ...options });
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class FunctionError extends BaseError.extend('FunctionError', 'Function invocation error') {}
|
|
20
|
-
|
|
21
|
-
export class TriggerStateNotFoundError extends BaseError.extend('TriggerStateNotFound', 'Trigger state not found') {}
|
package/src/example/fib.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { defineFunction } from '../sdk';
|
|
9
|
-
|
|
10
|
-
export default defineFunction({
|
|
11
|
-
key: 'example.org/function/fib',
|
|
12
|
-
name: 'Fibonacci',
|
|
13
|
-
description: 'Function that calculates a Fibonacci number',
|
|
14
|
-
inputSchema: Schema.Struct({
|
|
15
|
-
iterations: Schema.optional(Schema.Number).annotations({
|
|
16
|
-
description: 'Number of iterations',
|
|
17
|
-
default: 100_000,
|
|
18
|
-
}),
|
|
19
|
-
}),
|
|
20
|
-
outputSchema: Schema.Struct({
|
|
21
|
-
result: Schema.String,
|
|
22
|
-
}),
|
|
23
|
-
handler: Effect.fn(function* ({ data: { iterations = 100_000 } }) {
|
|
24
|
-
let a = 0n;
|
|
25
|
-
let b = 1n;
|
|
26
|
-
for (let i = 0; i < iterations; i++) {
|
|
27
|
-
a += b;
|
|
28
|
-
b = a - b;
|
|
29
|
-
}
|
|
30
|
-
return { result: a.toString() };
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import { S, defineFunction } from 'dxos:functions';
|
|
7
|
-
import {
|
|
8
|
-
FetchHttpClient,
|
|
9
|
-
HttpClient,
|
|
10
|
-
HttpClientRequest,
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
} from 'https://esm.sh/@effect/platform@0.89.0?deps=effect@3.17.0&bundle=false';
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import { Effect, Schedule } from 'https://esm.sh/effect@3.17.0?bundle=false';
|
|
15
|
-
|
|
16
|
-
export default defineFunction({
|
|
17
|
-
key: 'dxos.org/script/forex-effect',
|
|
18
|
-
name: 'Forex Effect',
|
|
19
|
-
description: 'Returns the exchange rate between two currencies.',
|
|
20
|
-
|
|
21
|
-
inputSchema: S.Struct({
|
|
22
|
-
from: S.String.annotations({ description: 'The source currency' }),
|
|
23
|
-
to: S.String.annotations({ description: 'The target currency' }),
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
outputSchema: S.String.annotations({ description: 'The exchange rate between the two currencies' }),
|
|
27
|
-
|
|
28
|
-
handler: async ({ data: { from, to } }: any) =>
|
|
29
|
-
Effect.gen(function* () {
|
|
30
|
-
const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(
|
|
31
|
-
HttpClient.execute,
|
|
32
|
-
Effect.flatMap((res: any) => res.json),
|
|
33
|
-
Effect.timeout('1 second'),
|
|
34
|
-
Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
|
|
35
|
-
Effect.scoped,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return res.data.rates[to].toString();
|
|
39
|
-
}).pipe(Effect.provide(FetchHttpClient.layer)),
|
|
40
|
-
});
|
package/src/example/index.ts
DELETED
package/src/example/reply.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Console from 'effect/Console';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { defineFunction } from '../sdk';
|
|
10
|
-
|
|
11
|
-
export default defineFunction({
|
|
12
|
-
key: 'example.org/function/reply',
|
|
13
|
-
name: 'Reply',
|
|
14
|
-
description: 'Function that echoes the input',
|
|
15
|
-
inputSchema: Schema.Any,
|
|
16
|
-
outputSchema: Schema.Any,
|
|
17
|
-
handler: Effect.fn(function* ({ data }) {
|
|
18
|
-
yield* Console.log('reply', { data });
|
|
19
|
-
return data;
|
|
20
|
-
}),
|
|
21
|
-
});
|
package/src/example/sleep.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
-
|
|
8
|
-
import { defineFunction } from '../sdk';
|
|
9
|
-
|
|
10
|
-
export default defineFunction({
|
|
11
|
-
key: 'example.org/function/sleep',
|
|
12
|
-
name: 'Sleep',
|
|
13
|
-
description: 'Function that sleeps for a given amount of time',
|
|
14
|
-
inputSchema: Schema.Struct({
|
|
15
|
-
duration: Schema.optional(Schema.Number).annotations({
|
|
16
|
-
description: 'Milliseconds to sleep',
|
|
17
|
-
default: 100_000,
|
|
18
|
-
}),
|
|
19
|
-
}),
|
|
20
|
-
outputSchema: Schema.Void,
|
|
21
|
-
handler: Effect.fn(function* ({ data: { duration = 100_000 } }) {
|
|
22
|
-
yield* Effect.sleep(duration);
|
|
23
|
-
}),
|
|
24
|
-
});
|