@dxos/functions 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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/index.mjs +795 -360
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +795 -360
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/errors.d.ts +129 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/example/fib.d.ts +7 -0
- package/dist/types/src/example/fib.d.ts.map +1 -0
- package/dist/types/src/example/forex-effect.d.ts +3 -0
- package/dist/types/src/example/forex-effect.d.ts.map +1 -0
- package/dist/types/src/example/index.d.ts +12 -0
- package/dist/types/src/example/index.d.ts.map +1 -0
- package/dist/types/src/example/reply.d.ts +3 -0
- package/dist/types/src/example/reply.d.ts.map +1 -0
- package/dist/types/src/example/sleep.d.ts +5 -0
- package/dist/types/src/example/sleep.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -6
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol/index.d.ts +2 -0
- package/dist/types/src/protocol/index.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.d.ts +7 -0
- package/dist/types/src/protocol/protocol.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.test.d.ts +2 -0
- package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
- package/dist/types/src/sdk.d.ts +89 -0
- package/dist/types/src/sdk.d.ts.map +1 -0
- package/dist/types/src/services/credentials.d.ts +21 -3
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +80 -30
- package/dist/types/src/services/event-logger.d.ts.map +1 -1
- package/dist/types/src/services/function-invocation-service.d.ts +11 -0
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +6 -7
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +33 -4
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +44 -5
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/Function.d.ts +58 -0
- package/dist/types/src/types/Function.d.ts.map +1 -0
- package/dist/types/src/types/Script.d.ts +28 -0
- package/dist/types/src/types/Script.d.ts.map +1 -0
- package/dist/types/src/types/Trigger.d.ts +139 -0
- package/dist/types/src/types/Trigger.d.ts.map +1 -0
- package/dist/types/src/types/TriggerEvent.d.ts +44 -0
- package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/url.d.ts +12 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -66
- package/src/errors.ts +21 -0
- package/src/example/fib.ts +32 -0
- package/src/example/forex-effect.ts +40 -0
- package/src/example/index.ts +13 -0
- package/src/example/reply.ts +21 -0
- package/src/example/sleep.ts +24 -0
- package/src/index.ts +5 -8
- package/src/{executor → protocol}/index.ts +1 -1
- package/src/protocol/protocol.test.ts +59 -0
- package/src/protocol/protocol.ts +145 -0
- package/src/sdk.ts +226 -0
- package/src/services/credentials.ts +92 -4
- package/src/services/event-logger.ts +77 -37
- package/src/services/function-invocation-service.ts +23 -0
- package/src/services/index.ts +7 -7
- package/src/services/queues.ts +50 -8
- package/src/services/tracing.ts +92 -11
- package/src/types/Function.ts +62 -0
- package/src/types/Script.ts +33 -0
- package/src/types/Trigger.ts +139 -0
- package/src/types/TriggerEvent.ts +62 -0
- package/src/types/index.ts +9 -0
- package/src/types/url.ts +31 -0
- package/dist/lib/browser/bundler/index.mjs +0 -247
- package/dist/lib/browser/bundler/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-54U464M4.mjs +0 -360
- package/dist/lib/browser/chunk-54U464M4.mjs.map +0 -7
- package/dist/lib/browser/edge/index.mjs +0 -69
- package/dist/lib/browser/edge/index.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -79
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/bundler/index.mjs +0 -249
- package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XDSX35BS.mjs +0 -362
- package/dist/lib/node-esm/chunk-XDSX35BS.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -71
- package/dist/lib/node-esm/edge/index.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -80
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/bundler/bundler.d.ts +0 -50
- package/dist/types/src/bundler/bundler.d.ts.map +0 -1
- package/dist/types/src/bundler/bundler.test.d.ts +0 -2
- package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
- package/dist/types/src/bundler/index.d.ts +0 -2
- package/dist/types/src/bundler/index.d.ts.map +0 -1
- package/dist/types/src/edge/functions.d.ts +0 -16
- package/dist/types/src/edge/functions.d.ts.map +0 -1
- package/dist/types/src/edge/index.d.ts +0 -2
- package/dist/types/src/edge/index.d.ts.map +0 -1
- package/dist/types/src/executor/executor.d.ts +0 -8
- package/dist/types/src/executor/executor.d.ts.map +0 -1
- package/dist/types/src/executor/index.d.ts +0 -2
- package/dist/types/src/executor/index.d.ts.map +0 -1
- package/dist/types/src/handler.d.ts +0 -61
- package/dist/types/src/handler.d.ts.map +0 -1
- package/dist/types/src/schema.d.ts +0 -38
- package/dist/types/src/schema.d.ts.map +0 -1
- package/dist/types/src/services/ai.d.ts +0 -12
- package/dist/types/src/services/ai.d.ts.map +0 -1
- package/dist/types/src/services/database.d.ts +0 -15
- package/dist/types/src/services/database.d.ts.map +0 -1
- package/dist/types/src/services/function-call-service.d.ts +0 -16
- package/dist/types/src/services/function-call-service.d.ts.map +0 -1
- package/dist/types/src/services/service-container.d.ts +0 -46
- package/dist/types/src/services/service-container.d.ts.map +0 -1
- package/dist/types/src/services/tool-resolver.d.ts +0 -14
- package/dist/types/src/services/tool-resolver.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/logger.d.ts +0 -5
- package/dist/types/src/testing/logger.d.ts.map +0 -1
- package/dist/types/src/testing/services.d.ts +0 -71
- package/dist/types/src/testing/services.d.ts.map +0 -1
- package/dist/types/src/trace.d.ts +0 -124
- package/dist/types/src/trace.d.ts.map +0 -1
- package/dist/types/src/translations.d.ts +0 -12
- package/dist/types/src/translations.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -411
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/types/src/url.d.ts +0 -17
- package/dist/types/src/url.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -59
- package/src/bundler/bundler.ts +0 -292
- package/src/bundler/index.ts +0 -5
- package/src/edge/functions.ts +0 -64
- package/src/edge/index.ts +0 -9
- package/src/executor/executor.ts +0 -54
- package/src/handler.ts +0 -113
- package/src/schema.ts +0 -57
- package/src/services/ai.ts +0 -32
- package/src/services/database.ts +0 -50
- package/src/services/function-call-service.ts +0 -64
- package/src/services/service-container.ts +0 -127
- package/src/services/tool-resolver.ts +0 -31
- package/src/testing/index.ts +0 -5
- package/src/testing/logger.ts +0 -16
- package/src/testing/services.ts +0 -174
- package/src/trace.ts +0 -180
- package/src/translations.ts +0 -20
- package/src/types.ts +0 -211
- package/src/url.ts +0 -52
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { Expando, Ref } from '@dxos/echo-schema';
|
|
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 enum TriggerKind {
|
|
9
|
-
Timer = "timer",
|
|
10
|
-
Webhook = "webhook",
|
|
11
|
-
Subscription = "subscription",
|
|
12
|
-
Email = "email",
|
|
13
|
-
Queue = "queue"
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Cron timer.
|
|
17
|
-
*/
|
|
18
|
-
declare const TimerTriggerSchema: Schema.mutable<Schema.Struct<{
|
|
19
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
20
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
21
|
-
}>>;
|
|
22
|
-
export type TimerTrigger = Schema.Schema.Type<typeof TimerTriggerSchema>;
|
|
23
|
-
declare const EmailTriggerSchema: Schema.mutable<Schema.Struct<{
|
|
24
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
25
|
-
}>>;
|
|
26
|
-
export type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;
|
|
27
|
-
declare const QueueTriggerSchema: Schema.mutable<Schema.Struct<{
|
|
28
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
29
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
30
|
-
}>>;
|
|
31
|
-
export type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;
|
|
32
|
-
/**
|
|
33
|
-
* Webhook.
|
|
34
|
-
*/
|
|
35
|
-
declare const WebhookTriggerSchema: Schema.mutable<Schema.Struct<{
|
|
36
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
37
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
38
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
39
|
-
}>>;
|
|
40
|
-
export type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;
|
|
41
|
-
/**
|
|
42
|
-
* Subscription.
|
|
43
|
-
*/
|
|
44
|
-
declare const SubscriptionTriggerSchema: Schema.mutable<Schema.Struct<{
|
|
45
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
46
|
-
filter: Schema.Struct<{
|
|
47
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
48
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
49
|
-
}>;
|
|
50
|
-
options: Schema.optional<Schema.Struct<{
|
|
51
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
52
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
53
|
-
}>>;
|
|
54
|
-
}>>;
|
|
55
|
-
export type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;
|
|
56
|
-
/**
|
|
57
|
-
* Trigger schema (discriminated union).
|
|
58
|
-
*/
|
|
59
|
-
export declare const TriggerSchema: Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
60
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
61
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
62
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
63
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
64
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
65
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
66
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
67
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
68
|
-
filter: Schema.Struct<{
|
|
69
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
70
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
71
|
-
}>;
|
|
72
|
-
options: Schema.optional<Schema.Struct<{
|
|
73
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
74
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
75
|
-
}>>;
|
|
76
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
77
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
78
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
79
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
80
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
81
|
-
}>>]>;
|
|
82
|
-
export type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;
|
|
83
|
-
export type EventType = EmailTriggerOutput | WebhookTriggerOutput | QueueTriggerOutput | SubscriptionTriggerOutput | TimerTriggerOutput;
|
|
84
|
-
export declare const EmailTriggerOutput: Schema.mutable<Schema.Struct<{
|
|
85
|
-
from: typeof Schema.String;
|
|
86
|
-
to: typeof Schema.String;
|
|
87
|
-
subject: typeof Schema.String;
|
|
88
|
-
created: typeof Schema.String;
|
|
89
|
-
body: typeof Schema.String;
|
|
90
|
-
}>>;
|
|
91
|
-
export type EmailTriggerOutput = Schema.Schema.Type<typeof EmailTriggerOutput>;
|
|
92
|
-
export declare const WebhookTriggerOutput: Schema.mutable<Schema.Struct<{
|
|
93
|
-
url: typeof Schema.String;
|
|
94
|
-
method: Schema.Literal<["GET", "POST"]>;
|
|
95
|
-
headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
96
|
-
bodyText: typeof Schema.String;
|
|
97
|
-
}>>;
|
|
98
|
-
export type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutput>;
|
|
99
|
-
export declare const QueueTriggerOutput: Schema.mutable<Schema.Struct<{
|
|
100
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
101
|
-
item: typeof Schema.Any;
|
|
102
|
-
cursor: typeof Schema.String;
|
|
103
|
-
}>>;
|
|
104
|
-
export type QueueTriggerOutput = Schema.Schema.Type<typeof QueueTriggerOutput>;
|
|
105
|
-
export declare const SubscriptionTriggerOutput: Schema.mutable<Schema.Struct<{
|
|
106
|
-
type: typeof Schema.String;
|
|
107
|
-
changedObjectId: typeof Schema.String;
|
|
108
|
-
}>>;
|
|
109
|
-
export type SubscriptionTriggerOutput = Schema.Schema.Type<typeof SubscriptionTriggerOutput>;
|
|
110
|
-
export declare const TimerTriggerOutput: Schema.mutable<Schema.Struct<{
|
|
111
|
-
tick: typeof Schema.Number;
|
|
112
|
-
}>>;
|
|
113
|
-
export type TimerTriggerOutput = Schema.Schema.Type<typeof TimerTriggerOutput>;
|
|
114
|
-
/**
|
|
115
|
-
* Function trigger.
|
|
116
|
-
* Function is invoked with the `payload` passed as input data.
|
|
117
|
-
* The event that triggers the function is available in the function context.
|
|
118
|
-
*/
|
|
119
|
-
export declare const FunctionTriggerSchema: Schema.Struct<{
|
|
120
|
-
/**
|
|
121
|
-
* Function or workflow to invoke.
|
|
122
|
-
*/
|
|
123
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
124
|
-
/**
|
|
125
|
-
* Only used for workflowSchema.
|
|
126
|
-
* Specifies the input node in the circuit.
|
|
127
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
128
|
-
*/
|
|
129
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
130
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
131
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
132
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
133
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
134
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
135
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
136
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
137
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
138
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
139
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
140
|
-
filter: Schema.Struct<{
|
|
141
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
142
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
143
|
-
}>;
|
|
144
|
-
options: Schema.optional<Schema.Struct<{
|
|
145
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
146
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
147
|
-
}>>;
|
|
148
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
149
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
150
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
151
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
152
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
153
|
-
}>>]>>;
|
|
154
|
-
/**
|
|
155
|
-
* Passed as the input data to the function.
|
|
156
|
-
* Must match the function's input schema.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* {
|
|
160
|
-
* item: '{{$.trigger.event}}',
|
|
161
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
162
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
163
|
-
* }
|
|
164
|
-
*/
|
|
165
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
166
|
-
}>;
|
|
167
|
-
export type FunctionTriggerType = Schema.Schema.Type<typeof FunctionTriggerSchema>;
|
|
168
|
-
declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<Readonly<{
|
|
169
|
-
/**
|
|
170
|
-
* Function or workflow to invoke.
|
|
171
|
-
*/
|
|
172
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
173
|
-
/**
|
|
174
|
-
* Only used for workflowSchema.
|
|
175
|
-
* Specifies the input node in the circuit.
|
|
176
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
177
|
-
*/
|
|
178
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
179
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
180
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
181
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
182
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
183
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
184
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
185
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
186
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
187
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
188
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
189
|
-
filter: Schema.Struct<{
|
|
190
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
191
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
192
|
-
}>;
|
|
193
|
-
options: Schema.optional<Schema.Struct<{
|
|
194
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
195
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
196
|
-
}>>;
|
|
197
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
198
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
199
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
200
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
201
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
202
|
-
}>>]>>;
|
|
203
|
-
/**
|
|
204
|
-
* Passed as the input data to the function.
|
|
205
|
-
* Must match the function's input schema.
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* {
|
|
209
|
-
* item: '{{$.trigger.event}}',
|
|
210
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
211
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
212
|
-
* }
|
|
213
|
-
*/
|
|
214
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
215
|
-
}>, import("@dxos/echo-schema").TypedObjectOptions>, Schema.Struct.Encoded<Readonly<{
|
|
216
|
-
/**
|
|
217
|
-
* Function or workflow to invoke.
|
|
218
|
-
*/
|
|
219
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
220
|
-
/**
|
|
221
|
-
* Only used for workflowSchema.
|
|
222
|
-
* Specifies the input node in the circuit.
|
|
223
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
224
|
-
*/
|
|
225
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
226
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
227
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
228
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
229
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
230
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
231
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
232
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
233
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
234
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
235
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
236
|
-
filter: Schema.Struct<{
|
|
237
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
238
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
239
|
-
}>;
|
|
240
|
-
options: Schema.optional<Schema.Struct<{
|
|
241
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
242
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
243
|
-
}>>;
|
|
244
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
245
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
246
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
247
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
248
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
249
|
-
}>>]>>;
|
|
250
|
-
/**
|
|
251
|
-
* Passed as the input data to the function.
|
|
252
|
-
* Must match the function's input schema.
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
* {
|
|
256
|
-
* item: '{{$.trigger.event}}',
|
|
257
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
258
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
259
|
-
* }
|
|
260
|
-
*/
|
|
261
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
262
|
-
}>>>;
|
|
263
|
-
/**
|
|
264
|
-
* Function trigger.
|
|
265
|
-
*/
|
|
266
|
-
export declare class FunctionTrigger extends FunctionTrigger_base {
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Function manifest file.
|
|
270
|
-
*/
|
|
271
|
-
export declare const FunctionManifestSchema: Schema.Struct<{
|
|
272
|
-
functions: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
273
|
-
name: string;
|
|
274
|
-
description?: string | undefined;
|
|
275
|
-
source?: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
276
|
-
name?: string | undefined;
|
|
277
|
-
description?: string | undefined;
|
|
278
|
-
changed?: boolean | undefined;
|
|
279
|
-
source: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
280
|
-
content: string;
|
|
281
|
-
}>;
|
|
282
|
-
}> | undefined;
|
|
283
|
-
version: string;
|
|
284
|
-
inputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
|
|
285
|
-
outputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
|
|
286
|
-
binding?: string | undefined;
|
|
287
|
-
}> & import("@dxos/echo-schema").WithMeta, {
|
|
288
|
-
id: string;
|
|
289
|
-
name: string;
|
|
290
|
-
version: string;
|
|
291
|
-
description?: string | undefined;
|
|
292
|
-
source?: import("@dxos/echo-protocol").EncodedReference | undefined;
|
|
293
|
-
inputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
|
|
294
|
-
outputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
|
|
295
|
-
binding?: string | undefined;
|
|
296
|
-
}, never>>>>;
|
|
297
|
-
triggers: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<Readonly<{
|
|
298
|
-
/**
|
|
299
|
-
* Function or workflow to invoke.
|
|
300
|
-
*/
|
|
301
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
302
|
-
/**
|
|
303
|
-
* Only used for workflowSchema.
|
|
304
|
-
* Specifies the input node in the circuit.
|
|
305
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
306
|
-
*/
|
|
307
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
308
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
309
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
310
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
311
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
312
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
313
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
314
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
315
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
316
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
317
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
318
|
-
filter: Schema.Struct<{
|
|
319
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
320
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
321
|
-
}>;
|
|
322
|
-
options: Schema.optional<Schema.Struct<{
|
|
323
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
324
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
325
|
-
}>>;
|
|
326
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
327
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
328
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
329
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
330
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
331
|
-
}>>]>>;
|
|
332
|
-
/**
|
|
333
|
-
* Passed as the input data to the function.
|
|
334
|
-
* Must match the function's input schema.
|
|
335
|
-
*
|
|
336
|
-
* @example
|
|
337
|
-
* {
|
|
338
|
-
* item: '{{$.trigger.event}}',
|
|
339
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
340
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
341
|
-
* }
|
|
342
|
-
*/
|
|
343
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
344
|
-
}>, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, Schema.Struct.Encoded<Readonly<{
|
|
345
|
-
/**
|
|
346
|
-
* Function or workflow to invoke.
|
|
347
|
-
*/
|
|
348
|
-
function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
349
|
-
/**
|
|
350
|
-
* Only used for workflowSchema.
|
|
351
|
-
* Specifies the input node in the circuit.
|
|
352
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
353
|
-
*/
|
|
354
|
-
inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
355
|
-
enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
356
|
-
spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
|
|
357
|
-
kind: Schema.Literal<[TriggerKind.Timer]>;
|
|
358
|
-
cron: Schema.SchemaClass<string, string, never>;
|
|
359
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
360
|
-
kind: Schema.Literal<[TriggerKind.Webhook]>;
|
|
361
|
-
method: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
362
|
-
port: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
363
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
364
|
-
kind: Schema.Literal<[TriggerKind.Subscription]>;
|
|
365
|
-
filter: Schema.Struct<{
|
|
366
|
-
type: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
367
|
-
props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
|
|
368
|
-
}>;
|
|
369
|
-
options: Schema.optional<Schema.Struct<{
|
|
370
|
-
deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
371
|
-
delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
372
|
-
}>>;
|
|
373
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
374
|
-
kind: Schema.Literal<[TriggerKind.Email]>;
|
|
375
|
-
}>>, Schema.mutable<Schema.Struct<{
|
|
376
|
-
kind: Schema.Literal<[TriggerKind.Queue]>;
|
|
377
|
-
queue: Schema.refine<string, typeof Schema.NonEmptyString>;
|
|
378
|
-
}>>]>>;
|
|
379
|
-
/**
|
|
380
|
-
* Passed as the input data to the function.
|
|
381
|
-
* Must match the function's input schema.
|
|
382
|
-
*
|
|
383
|
-
* @example
|
|
384
|
-
* {
|
|
385
|
-
* item: '{{$.trigger.event}}',
|
|
386
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
387
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
388
|
-
* }
|
|
389
|
-
*/
|
|
390
|
-
input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
391
|
-
}>>, never>>>>;
|
|
392
|
-
}>;
|
|
393
|
-
export type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;
|
|
394
|
-
export declare const FUNCTION_TYPES: (import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
395
|
-
name: typeof Schema.NonEmptyString;
|
|
396
|
-
version: typeof Schema.String;
|
|
397
|
-
description: Schema.optional<typeof Schema.String>;
|
|
398
|
-
source: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
399
|
-
name?: string | undefined;
|
|
400
|
-
description?: string | undefined;
|
|
401
|
-
changed?: boolean | undefined;
|
|
402
|
-
source: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
403
|
-
content: string;
|
|
404
|
-
}>;
|
|
405
|
-
}>>;
|
|
406
|
-
inputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
407
|
-
outputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
408
|
-
binding: Schema.optional<typeof Schema.String>;
|
|
409
|
-
}>> | typeof FunctionTrigger)[];
|
|
410
|
-
export {};
|
|
411
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types/src/url.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type ObjectMeta } from '@dxos/echo-schema';
|
|
2
|
-
import { type SpaceId } from '@dxos/keys';
|
|
3
|
-
export declare const FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
4
|
-
export declare const getUserFunctionUrlInMetadata: (meta: ObjectMeta) => string | undefined;
|
|
5
|
-
export declare const setUserFunctionUrlInMetadata: (meta: ObjectMeta, functionUrl: string) => void;
|
|
6
|
-
/**
|
|
7
|
-
* NOTE: functionId is backend ID, not ECHO object id.
|
|
8
|
-
*/
|
|
9
|
-
export declare const makeFunctionUrl: (fn: {
|
|
10
|
-
functionId: string;
|
|
11
|
-
}) => string;
|
|
12
|
-
export declare const getInvocationUrl: (functionUrl: string, edgeUrl: string, options?: InvocationOptions) => string;
|
|
13
|
-
export type InvocationOptions = {
|
|
14
|
-
spaceId?: SpaceId;
|
|
15
|
-
subjectId?: string;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/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,GAAI,MAAM,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,MAAM,UAAU,EAAE,aAAa,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAwB,CAAC;AAEnF,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,EAAE,UAAS,iBAAsB,WAUrG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
7
|
-
import { beforeAll, describe, expect, test } from 'vitest';
|
|
8
|
-
|
|
9
|
-
import { isNode } from '@dxos/util';
|
|
10
|
-
|
|
11
|
-
import { Bundler, initializeBundler } from './bundler';
|
|
12
|
-
|
|
13
|
-
describe('Bundler', () => {
|
|
14
|
-
beforeAll(async () => {
|
|
15
|
-
if (!isNode()) {
|
|
16
|
-
await initializeBundler({ wasmUrl });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('Basic', async () => {
|
|
21
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
22
|
-
const result = await bundler.bundle({ source: 'const x = 100' }); // TODO(burdon): Test import.
|
|
23
|
-
expect(result.bundle).to.exist;
|
|
24
|
-
expect(result.error).to.not.exist;
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('Import', async () => {
|
|
28
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
29
|
-
const result = await bundler.bundle({
|
|
30
|
-
source: `
|
|
31
|
-
import { Filter } from './runtime.js';
|
|
32
|
-
|
|
33
|
-
const query = Filter.typename('dxos.org/type/Example');
|
|
34
|
-
`,
|
|
35
|
-
});
|
|
36
|
-
expect(result.bundle).to.exist;
|
|
37
|
-
expect(result.error).to.not.exist;
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// TODO(dmaretskyi): Flaky on CI.
|
|
41
|
-
test.skip('HTTPS Import', async () => {
|
|
42
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
43
|
-
const result = await bundler.bundle({
|
|
44
|
-
source: `
|
|
45
|
-
import { invariant } from 'https://esm.sh/@dxos/invariant';
|
|
46
|
-
invariant(true);
|
|
47
|
-
`,
|
|
48
|
-
});
|
|
49
|
-
expect(result.bundle).to.exist;
|
|
50
|
-
expect(result.error).to.not.exist;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('Error', async () => {
|
|
54
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
55
|
-
const result = await bundler.bundle({ source: "import missing from './module'; missing();" });
|
|
56
|
-
expect(result.bundle).to.not.exist;
|
|
57
|
-
expect(result.error).to.exist;
|
|
58
|
-
});
|
|
59
|
-
});
|