@kazzle/app 0.1.945 → 0.1.946
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/README.md +2 -2
- package/dist/definition.d.ts +434 -0
- package/dist/definition.js +171 -0
- package/dist/index.d.ts +1 -105
- package/dist/index.js +3 -15
- package/dist/installations.d.ts +13 -0
- package/dist/installations.js +69 -0
- package/dist/vendor/kazzle/agents.d.ts +38 -0
- package/dist/vendor/kazzle/agents.js +46 -0
- package/dist/vendor/kazzle/generated/operations.js +18 -1
- package/dist/vendor/kazzle/index.d.ts +3 -0
- package/dist/vendor/kazzle/index.js +4 -2
- package/dist/vendor/kazzle/kazzle.d.ts +4 -0
- package/dist/vendor/kazzle/kazzle.js +7 -2
- package/dist/vendor/kazzle/thread-stream.d.ts +11 -0
- package/dist/vendor/kazzle/thread-stream.js +41 -0
- package/dist/vendor/kazzle/threads.d.ts +77 -0
- package/dist/vendor/kazzle/threads.js +70 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -1
- package/package.json +8 -4
- package/templates/ai-app/README.md +3 -0
- package/templates/ai-app/kazzle.config.ts +10 -2
- package/templates/empty-app/README.md +3 -0
- package/templates/empty-app/kazzle.config.ts +10 -2
- package/templates/login-app/KAZZLE.md +1 -1
- package/templates/login-app/README.md +3 -0
- package/templates/login-app/kazzle.config.ts +10 -2
- package/templates/process-app/README.md +3 -0
- package/templates/process-app/components/process/index.ts +1 -1
- package/templates/process-app/kazzle.config.ts +12 -6
- package/templates/realtime-app/KAZZLE.md +1 -1
- package/templates/realtime-app/README.md +3 -0
- package/templates/realtime-app/kazzle.config.ts +10 -2
- package/templates/ui-app/README.md +3 -0
- package/templates/ui-app/kazzle.config.ts +10 -2
- package/templates/ui-db-app/KAZZLE.md +1 -1
- package/templates/ui-db-app/README.md +3 -0
- package/templates/ui-db-app/kazzle.config.ts +10 -2
- package/dist/connections.d.ts +0 -11
- package/dist/connections.js +0 -56
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ App contracts used to be copied into every generated app repo as vendored files
|
|
|
15
15
|
the AI stale types. This package replaces the copies with real imports:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import {
|
|
18
|
+
import { defineApp } from '@kazzle/app';
|
|
19
19
|
import { defineTools } from '@kazzle/app/tools';
|
|
20
20
|
import { kazzleAppVite, kazzleAppPwa } from '@kazzle/app/vite';
|
|
21
21
|
import { registerAppSW } from '@kazzle/app/pwa';
|
|
@@ -29,7 +29,7 @@ and the root export must stay tiny and dependency-free.
|
|
|
29
29
|
|
|
30
30
|
| Subpath | Owns | Runtime deps |
|
|
31
31
|
|---|---|---|
|
|
32
|
-
| `@kazzle/app` | `
|
|
32
|
+
| `@kazzle/app` | `defineApp`, `AppDefinition` + component/trigger/env types | none |
|
|
33
33
|
| `@kazzle/app/tools` | `defineTools`, `KazzleTool` types, Zod input helper types | `zod` (peer, type-only) |
|
|
34
34
|
| `@kazzle/app/client` | install-scoped client: per-install secrets, sibling component URLs | none |
|
|
35
35
|
| `@kazzle/app/vite` | `kazzleAppVite` + `kazzleAppPwa` (HOST/PORT + production SW plugins) | `vite` (peer), `vite-plugin-pwa` |
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const ComponentEnvSchema: z.ZodObject<{
|
|
3
|
+
collection: z.ZodString;
|
|
4
|
+
environment: z.ZodString;
|
|
5
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
declare const RuntimeModeSchema: z.ZodObject<{
|
|
8
|
+
command: z.ZodString;
|
|
9
|
+
build: z.ZodOptional<z.ZodString>;
|
|
10
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
collection: z.ZodString;
|
|
12
|
+
environment: z.ZodString;
|
|
13
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
declare const TriggerSchema: z.ZodObject<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
kind: z.ZodEnum<{
|
|
19
|
+
schedule: "schedule";
|
|
20
|
+
webhook: "webhook";
|
|
21
|
+
}>;
|
|
22
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
23
|
+
path: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export declare const AppDefinitionComponentSchema: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
process: "process";
|
|
29
|
+
ui: "ui";
|
|
30
|
+
}>;
|
|
31
|
+
path: z.ZodString;
|
|
32
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
collection: z.ZodString;
|
|
34
|
+
environment: z.ZodString;
|
|
35
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
dev: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
command: z.ZodString;
|
|
40
|
+
build: z.ZodOptional<z.ZodString>;
|
|
41
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
collection: z.ZodString;
|
|
43
|
+
environment: z.ZodString;
|
|
44
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
prod: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
command: z.ZodString;
|
|
49
|
+
build: z.ZodOptional<z.ZodString>;
|
|
50
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
collection: z.ZodString;
|
|
52
|
+
environment: z.ZodString;
|
|
53
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
processMode: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
persistent: "persistent";
|
|
59
|
+
triggered: "triggered";
|
|
60
|
+
}>>;
|
|
61
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
kind: z.ZodEnum<{
|
|
64
|
+
schedule: "schedule";
|
|
65
|
+
webhook: "webhook";
|
|
66
|
+
}>;
|
|
67
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
68
|
+
path: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export declare const AppDefinitionSetupFieldSchema: z.ZodObject<{
|
|
72
|
+
key: z.ZodString;
|
|
73
|
+
label: z.ZodString;
|
|
74
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
kind: z.ZodEnum<{
|
|
76
|
+
email: "email";
|
|
77
|
+
hostname: "hostname";
|
|
78
|
+
password: "password";
|
|
79
|
+
select: "select";
|
|
80
|
+
text: "text";
|
|
81
|
+
url: "url";
|
|
82
|
+
}>;
|
|
83
|
+
required: z.ZodBoolean;
|
|
84
|
+
secret: z.ZodBoolean;
|
|
85
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
value: z.ZodString;
|
|
91
|
+
label: z.ZodString;
|
|
92
|
+
}, z.core.$strict>>>;
|
|
93
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export declare const AppDefinitionSetupSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"none">;
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"oauth">;
|
|
99
|
+
version: z.ZodLiteral<"2.0">;
|
|
100
|
+
metadata: z.ZodUnion<readonly [z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"discovery">;
|
|
102
|
+
url: z.ZodURL;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"endpoints">;
|
|
105
|
+
authorizationUrl: z.ZodURL;
|
|
106
|
+
tokenUrl: z.ZodURL;
|
|
107
|
+
}, z.core.$strict>]>;
|
|
108
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
109
|
+
pkce: z.ZodEnum<{
|
|
110
|
+
none: "none";
|
|
111
|
+
required: "required";
|
|
112
|
+
supported: "supported";
|
|
113
|
+
}>;
|
|
114
|
+
authorizationParams: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
115
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
116
|
+
key: z.ZodString;
|
|
117
|
+
label: z.ZodString;
|
|
118
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
|
+
kind: z.ZodEnum<{
|
|
120
|
+
email: "email";
|
|
121
|
+
hostname: "hostname";
|
|
122
|
+
password: "password";
|
|
123
|
+
select: "select";
|
|
124
|
+
text: "text";
|
|
125
|
+
url: "url";
|
|
126
|
+
}>;
|
|
127
|
+
required: z.ZodBoolean;
|
|
128
|
+
secret: z.ZodBoolean;
|
|
129
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
131
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
134
|
+
value: z.ZodString;
|
|
135
|
+
label: z.ZodString;
|
|
136
|
+
}, z.core.$strict>>>;
|
|
137
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
138
|
+
}, z.core.$strict>>;
|
|
139
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"oauth">;
|
|
141
|
+
version: z.ZodLiteral<"1.0a">;
|
|
142
|
+
requestTokenUrl: z.ZodURL;
|
|
143
|
+
authorizationUrl: z.ZodURL;
|
|
144
|
+
accessTokenUrl: z.ZodURL;
|
|
145
|
+
authorizationParams: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
146
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
147
|
+
key: z.ZodString;
|
|
148
|
+
label: z.ZodString;
|
|
149
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
150
|
+
kind: z.ZodEnum<{
|
|
151
|
+
email: "email";
|
|
152
|
+
hostname: "hostname";
|
|
153
|
+
password: "password";
|
|
154
|
+
select: "select";
|
|
155
|
+
text: "text";
|
|
156
|
+
url: "url";
|
|
157
|
+
}>;
|
|
158
|
+
required: z.ZodBoolean;
|
|
159
|
+
secret: z.ZodBoolean;
|
|
160
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
161
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
165
|
+
value: z.ZodString;
|
|
166
|
+
label: z.ZodString;
|
|
167
|
+
}, z.core.$strict>>>;
|
|
168
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
169
|
+
}, z.core.$strict>>;
|
|
170
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"form">;
|
|
172
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
173
|
+
key: z.ZodString;
|
|
174
|
+
label: z.ZodString;
|
|
175
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
176
|
+
kind: z.ZodEnum<{
|
|
177
|
+
email: "email";
|
|
178
|
+
hostname: "hostname";
|
|
179
|
+
password: "password";
|
|
180
|
+
select: "select";
|
|
181
|
+
text: "text";
|
|
182
|
+
url: "url";
|
|
183
|
+
}>;
|
|
184
|
+
required: z.ZodBoolean;
|
|
185
|
+
secret: z.ZodBoolean;
|
|
186
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
191
|
+
value: z.ZodString;
|
|
192
|
+
label: z.ZodString;
|
|
193
|
+
}, z.core.$strict>>>;
|
|
194
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
195
|
+
}, z.core.$strict>>;
|
|
196
|
+
labelField: z.ZodNullable<z.ZodString>;
|
|
197
|
+
}, z.core.$strict>]>;
|
|
198
|
+
export declare const AppDefinitionLaunchSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"none">;
|
|
200
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
201
|
+
type: z.ZodLiteral<"component">;
|
|
202
|
+
component: z.ZodString;
|
|
203
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"url">;
|
|
205
|
+
url: z.ZodURL;
|
|
206
|
+
target: z.ZodEnum<{
|
|
207
|
+
embedded: "embedded";
|
|
208
|
+
external: "external";
|
|
209
|
+
}>;
|
|
210
|
+
}, z.core.$strict>]>;
|
|
211
|
+
export declare const AppDefinitionToolSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
212
|
+
name: z.ZodString;
|
|
213
|
+
type: z.ZodLiteral<"file">;
|
|
214
|
+
path: z.ZodString;
|
|
215
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
216
|
+
name: z.ZodString;
|
|
217
|
+
type: z.ZodLiteral<"connection_actions">;
|
|
218
|
+
actions: z.ZodArray<z.ZodString>;
|
|
219
|
+
}, z.core.$strict>]>;
|
|
220
|
+
export declare const AppDefinitionSchema: z.ZodObject<{
|
|
221
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
222
|
+
name: z.ZodString;
|
|
223
|
+
subtitle: z.ZodString;
|
|
224
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
225
|
+
description: z.ZodObject<{
|
|
226
|
+
type: z.ZodLiteral<"markdown">;
|
|
227
|
+
path: z.ZodString;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
version: z.ZodOptional<z.ZodString>;
|
|
230
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
231
|
+
accentColor: z.ZodOptional<z.ZodString>;
|
|
232
|
+
maxInstallations: z.ZodNullable<z.ZodNumber>;
|
|
233
|
+
setup: z.ZodUnion<readonly [z.ZodObject<{
|
|
234
|
+
type: z.ZodLiteral<"none">;
|
|
235
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"oauth">;
|
|
237
|
+
version: z.ZodLiteral<"2.0">;
|
|
238
|
+
metadata: z.ZodUnion<readonly [z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"discovery">;
|
|
240
|
+
url: z.ZodURL;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<"endpoints">;
|
|
243
|
+
authorizationUrl: z.ZodURL;
|
|
244
|
+
tokenUrl: z.ZodURL;
|
|
245
|
+
}, z.core.$strict>]>;
|
|
246
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
247
|
+
pkce: z.ZodEnum<{
|
|
248
|
+
none: "none";
|
|
249
|
+
required: "required";
|
|
250
|
+
supported: "supported";
|
|
251
|
+
}>;
|
|
252
|
+
authorizationParams: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
253
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
254
|
+
key: z.ZodString;
|
|
255
|
+
label: z.ZodString;
|
|
256
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
257
|
+
kind: z.ZodEnum<{
|
|
258
|
+
email: "email";
|
|
259
|
+
hostname: "hostname";
|
|
260
|
+
password: "password";
|
|
261
|
+
select: "select";
|
|
262
|
+
text: "text";
|
|
263
|
+
url: "url";
|
|
264
|
+
}>;
|
|
265
|
+
required: z.ZodBoolean;
|
|
266
|
+
secret: z.ZodBoolean;
|
|
267
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
268
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
269
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
270
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
272
|
+
value: z.ZodString;
|
|
273
|
+
label: z.ZodString;
|
|
274
|
+
}, z.core.$strict>>>;
|
|
275
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
276
|
+
}, z.core.$strict>>;
|
|
277
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
278
|
+
type: z.ZodLiteral<"oauth">;
|
|
279
|
+
version: z.ZodLiteral<"1.0a">;
|
|
280
|
+
requestTokenUrl: z.ZodURL;
|
|
281
|
+
authorizationUrl: z.ZodURL;
|
|
282
|
+
accessTokenUrl: z.ZodURL;
|
|
283
|
+
authorizationParams: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
284
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
285
|
+
key: z.ZodString;
|
|
286
|
+
label: z.ZodString;
|
|
287
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
288
|
+
kind: z.ZodEnum<{
|
|
289
|
+
email: "email";
|
|
290
|
+
hostname: "hostname";
|
|
291
|
+
password: "password";
|
|
292
|
+
select: "select";
|
|
293
|
+
text: "text";
|
|
294
|
+
url: "url";
|
|
295
|
+
}>;
|
|
296
|
+
required: z.ZodBoolean;
|
|
297
|
+
secret: z.ZodBoolean;
|
|
298
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
299
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
300
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
301
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
302
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
303
|
+
value: z.ZodString;
|
|
304
|
+
label: z.ZodString;
|
|
305
|
+
}, z.core.$strict>>>;
|
|
306
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
307
|
+
}, z.core.$strict>>;
|
|
308
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
309
|
+
type: z.ZodLiteral<"form">;
|
|
310
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
311
|
+
key: z.ZodString;
|
|
312
|
+
label: z.ZodString;
|
|
313
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
314
|
+
kind: z.ZodEnum<{
|
|
315
|
+
email: "email";
|
|
316
|
+
hostname: "hostname";
|
|
317
|
+
password: "password";
|
|
318
|
+
select: "select";
|
|
319
|
+
text: "text";
|
|
320
|
+
url: "url";
|
|
321
|
+
}>;
|
|
322
|
+
required: z.ZodBoolean;
|
|
323
|
+
secret: z.ZodBoolean;
|
|
324
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
325
|
+
prefix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
326
|
+
suffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
327
|
+
pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
328
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
329
|
+
value: z.ZodString;
|
|
330
|
+
label: z.ZodString;
|
|
331
|
+
}, z.core.$strict>>>;
|
|
332
|
+
documentationUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
333
|
+
}, z.core.$strict>>;
|
|
334
|
+
labelField: z.ZodNullable<z.ZodString>;
|
|
335
|
+
}, z.core.$strict>]>;
|
|
336
|
+
launch: z.ZodUnion<readonly [z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"none">;
|
|
338
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
339
|
+
type: z.ZodLiteral<"component">;
|
|
340
|
+
component: z.ZodString;
|
|
341
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
342
|
+
type: z.ZodLiteral<"url">;
|
|
343
|
+
url: z.ZodURL;
|
|
344
|
+
target: z.ZodEnum<{
|
|
345
|
+
embedded: "embedded";
|
|
346
|
+
external: "external";
|
|
347
|
+
}>;
|
|
348
|
+
}, z.core.$strict>]>;
|
|
349
|
+
components: z.ZodArray<z.ZodObject<{
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
type: z.ZodEnum<{
|
|
352
|
+
process: "process";
|
|
353
|
+
ui: "ui";
|
|
354
|
+
}>;
|
|
355
|
+
path: z.ZodString;
|
|
356
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
357
|
+
collection: z.ZodString;
|
|
358
|
+
environment: z.ZodString;
|
|
359
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
360
|
+
}, z.core.$strict>>;
|
|
361
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
362
|
+
dev: z.ZodOptional<z.ZodObject<{
|
|
363
|
+
command: z.ZodString;
|
|
364
|
+
build: z.ZodOptional<z.ZodString>;
|
|
365
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
366
|
+
collection: z.ZodString;
|
|
367
|
+
environment: z.ZodString;
|
|
368
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
369
|
+
}, z.core.$strict>>;
|
|
370
|
+
}, z.core.$strict>>;
|
|
371
|
+
prod: z.ZodOptional<z.ZodObject<{
|
|
372
|
+
command: z.ZodString;
|
|
373
|
+
build: z.ZodOptional<z.ZodString>;
|
|
374
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
375
|
+
collection: z.ZodString;
|
|
376
|
+
environment: z.ZodString;
|
|
377
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
378
|
+
}, z.core.$strict>>;
|
|
379
|
+
}, z.core.$strict>>;
|
|
380
|
+
}, z.core.$strict>>;
|
|
381
|
+
processMode: z.ZodOptional<z.ZodEnum<{
|
|
382
|
+
persistent: "persistent";
|
|
383
|
+
triggered: "triggered";
|
|
384
|
+
}>>;
|
|
385
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
386
|
+
name: z.ZodString;
|
|
387
|
+
kind: z.ZodEnum<{
|
|
388
|
+
schedule: "schedule";
|
|
389
|
+
webhook: "webhook";
|
|
390
|
+
}>;
|
|
391
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
392
|
+
path: z.ZodOptional<z.ZodString>;
|
|
393
|
+
}, z.core.$strict>>>;
|
|
394
|
+
}, z.core.$strict>>;
|
|
395
|
+
tools: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
396
|
+
name: z.ZodString;
|
|
397
|
+
type: z.ZodLiteral<"file">;
|
|
398
|
+
path: z.ZodString;
|
|
399
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
400
|
+
name: z.ZodString;
|
|
401
|
+
type: z.ZodLiteral<"connection_actions">;
|
|
402
|
+
actions: z.ZodArray<z.ZodString>;
|
|
403
|
+
}, z.core.$strict>]>>;
|
|
404
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
405
|
+
name: z.ZodString;
|
|
406
|
+
source: z.ZodUnion<readonly [z.ZodObject<{
|
|
407
|
+
type: z.ZodLiteral<"file">;
|
|
408
|
+
path: z.ZodString;
|
|
409
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
410
|
+
type: z.ZodLiteral<"inline">;
|
|
411
|
+
instructions: z.ZodString;
|
|
412
|
+
}, z.core.$strict>]>;
|
|
413
|
+
}, z.core.$strict>>;
|
|
414
|
+
kazzleAuth: z.ZodOptional<z.ZodEnum<{
|
|
415
|
+
optional: "optional";
|
|
416
|
+
required: "required";
|
|
417
|
+
}>>;
|
|
418
|
+
webhookUrl: z.ZodOptional<z.ZodURL>;
|
|
419
|
+
appLogin: z.ZodOptional<z.ZodBoolean>;
|
|
420
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
421
|
+
local: "local";
|
|
422
|
+
remote: "remote";
|
|
423
|
+
}>>;
|
|
424
|
+
}, z.core.$strict>;
|
|
425
|
+
export type AppDefinition = z.infer<typeof AppDefinitionSchema>;
|
|
426
|
+
export type AppDefinitionComponent = z.infer<typeof AppDefinitionComponentSchema>;
|
|
427
|
+
export type AppDefinitionComponentEnv = z.infer<typeof ComponentEnvSchema>;
|
|
428
|
+
export type AppDefinitionRuntimeMode = z.infer<typeof RuntimeModeSchema>;
|
|
429
|
+
export type AppDefinitionTrigger = z.infer<typeof TriggerSchema>;
|
|
430
|
+
export type AppDefinitionToolSource = z.infer<typeof AppDefinitionToolSourceSchema>;
|
|
431
|
+
export type AppDefinitionSetup = z.infer<typeof AppDefinitionSetupSchema>;
|
|
432
|
+
export type AppDefinitionSetupField = z.infer<typeof AppDefinitionSetupFieldSchema>;
|
|
433
|
+
export declare function defineApp(definition: AppDefinition): AppDefinition;
|
|
434
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ComponentEnvSchema = z.object({
|
|
3
|
+
collection: z.string().min(1),
|
|
4
|
+
environment: z.string().min(1),
|
|
5
|
+
include: z.array(z.string().min(1)).optional(),
|
|
6
|
+
}).strict();
|
|
7
|
+
const RuntimeModeSchema = z.object({
|
|
8
|
+
command: z.string().min(1),
|
|
9
|
+
build: z.string().min(1).optional(),
|
|
10
|
+
env: ComponentEnvSchema.optional(),
|
|
11
|
+
}).strict();
|
|
12
|
+
const TriggerSchema = z.object({
|
|
13
|
+
name: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
14
|
+
kind: z.enum(['schedule', 'webhook']),
|
|
15
|
+
schedule: z.string().optional(),
|
|
16
|
+
path: z.string().startsWith('/').optional(),
|
|
17
|
+
}).strict().superRefine((trigger, ctx) => {
|
|
18
|
+
if (trigger.kind === 'schedule' && !trigger.schedule) {
|
|
19
|
+
ctx.addIssue({ code: 'custom', path: ['schedule'], message: 'A schedule trigger requires a cron expression.' });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export const AppDefinitionComponentSchema = z.object({
|
|
23
|
+
name: z.string().min(1),
|
|
24
|
+
type: z.enum(['ui', 'process']),
|
|
25
|
+
path: z.string().min(1),
|
|
26
|
+
env: ComponentEnvSchema.optional(),
|
|
27
|
+
runtime: z.object({ dev: RuntimeModeSchema.optional(), prod: RuntimeModeSchema.optional() }).strict().optional(),
|
|
28
|
+
processMode: z.enum(['persistent', 'triggered']).optional(),
|
|
29
|
+
triggers: z.array(TriggerSchema).optional(),
|
|
30
|
+
}).strict().superRefine((component, ctx) => {
|
|
31
|
+
const names = new Set();
|
|
32
|
+
for (const [index, trigger] of (component.triggers ?? []).entries()) {
|
|
33
|
+
if (component.type !== 'process') {
|
|
34
|
+
ctx.addIssue({ code: 'custom', path: ['triggers'], message: 'Only process components can declare triggers.' });
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
if (names.has(trigger.name)) {
|
|
38
|
+
ctx.addIssue({ code: 'custom', path: ['triggers', index, 'name'], message: `Duplicate trigger name "${trigger.name}".` });
|
|
39
|
+
}
|
|
40
|
+
names.add(trigger.name);
|
|
41
|
+
if ((component.processMode ?? 'persistent') === 'persistent' && !trigger.path) {
|
|
42
|
+
ctx.addIssue({ code: 'custom', path: ['triggers', index, 'path'], message: `Persistent trigger "${trigger.name}" requires a path.` });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export const AppDefinitionSetupFieldSchema = z.object({
|
|
47
|
+
key: z.string().regex(/^[A-Za-z][A-Za-z0-9_]*$/),
|
|
48
|
+
label: z.string().min(1),
|
|
49
|
+
description: z.string().min(1).nullable().optional(),
|
|
50
|
+
kind: z.enum(['text', 'password', 'url', 'hostname', 'email', 'select']),
|
|
51
|
+
required: z.boolean(),
|
|
52
|
+
secret: z.boolean(),
|
|
53
|
+
placeholder: z.string().nullable().optional(),
|
|
54
|
+
prefix: z.string().nullable().optional(),
|
|
55
|
+
suffix: z.string().nullable().optional(),
|
|
56
|
+
pattern: z.string().nullable().optional(),
|
|
57
|
+
options: z.array(z.object({ value: z.string(), label: z.string().min(1) }).strict()).optional(),
|
|
58
|
+
documentationUrl: z.url().nullable().optional(),
|
|
59
|
+
}).strict().superRefine((field, ctx) => {
|
|
60
|
+
if (field.kind === 'select' && !field.options?.length) {
|
|
61
|
+
ctx.addIssue({ code: 'custom', path: ['options'], message: `Select field "${field.key}" requires options.` });
|
|
62
|
+
}
|
|
63
|
+
if (field.pattern) {
|
|
64
|
+
try {
|
|
65
|
+
new RegExp(field.pattern);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
ctx.addIssue({ code: 'custom', path: ['pattern'], message: `Field "${field.key}" has an invalid pattern.` });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const OAuthFieldsSchema = z.array(AppDefinitionSetupFieldSchema);
|
|
73
|
+
const OAuth2MetadataSchema = z.union([
|
|
74
|
+
z.object({ type: z.literal('discovery'), url: z.url() }).strict(),
|
|
75
|
+
z.object({ type: z.literal('endpoints'), authorizationUrl: z.url(), tokenUrl: z.url() }).strict(),
|
|
76
|
+
]);
|
|
77
|
+
export const AppDefinitionSetupSchema = z.union([
|
|
78
|
+
z.object({ type: z.literal('none') }).strict(),
|
|
79
|
+
z.object({
|
|
80
|
+
type: z.literal('oauth'),
|
|
81
|
+
version: z.literal('2.0'),
|
|
82
|
+
metadata: OAuth2MetadataSchema,
|
|
83
|
+
scopes: z.array(z.string().min(1)),
|
|
84
|
+
pkce: z.enum(['required', 'supported', 'none']),
|
|
85
|
+
authorizationParams: z.record(z.string(), z.string()),
|
|
86
|
+
fields: OAuthFieldsSchema,
|
|
87
|
+
}).strict(),
|
|
88
|
+
z.object({
|
|
89
|
+
type: z.literal('oauth'),
|
|
90
|
+
version: z.literal('1.0a'),
|
|
91
|
+
requestTokenUrl: z.url(),
|
|
92
|
+
authorizationUrl: z.url(),
|
|
93
|
+
accessTokenUrl: z.url(),
|
|
94
|
+
authorizationParams: z.record(z.string(), z.string()),
|
|
95
|
+
fields: OAuthFieldsSchema,
|
|
96
|
+
}).strict(),
|
|
97
|
+
z.object({
|
|
98
|
+
type: z.literal('form'),
|
|
99
|
+
fields: z.array(AppDefinitionSetupFieldSchema).min(1),
|
|
100
|
+
labelField: z.string().min(1).nullable(),
|
|
101
|
+
}).strict().superRefine((setup, ctx) => {
|
|
102
|
+
const names = new Set();
|
|
103
|
+
for (const [index, field] of setup.fields.entries()) {
|
|
104
|
+
if (names.has(field.key))
|
|
105
|
+
ctx.addIssue({ code: 'custom', path: ['fields', index, 'key'], message: `Duplicate setup field "${field.key}".` });
|
|
106
|
+
names.add(field.key);
|
|
107
|
+
}
|
|
108
|
+
const label = setup.fields.find((field) => field.key === setup.labelField);
|
|
109
|
+
if (setup.labelField && !label) {
|
|
110
|
+
ctx.addIssue({ code: 'custom', path: ['labelField'], message: 'Credential label field does not exist.' });
|
|
111
|
+
}
|
|
112
|
+
else if (label?.secret) {
|
|
113
|
+
ctx.addIssue({ code: 'custom', path: ['labelField'], message: 'Credential label field cannot be secret.' });
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
]);
|
|
117
|
+
export const AppDefinitionLaunchSchema = z.union([
|
|
118
|
+
z.object({ type: z.literal('none') }).strict(),
|
|
119
|
+
z.object({ type: z.literal('component'), component: z.string().min(1) }).strict(),
|
|
120
|
+
z.object({ type: z.literal('url'), url: z.url(), target: z.enum(['embedded', 'external']) }).strict(),
|
|
121
|
+
]);
|
|
122
|
+
export const AppDefinitionToolSourceSchema = z.union([
|
|
123
|
+
z.object({ name: z.string().min(1), type: z.literal('file'), path: z.string().min(1) }).strict(),
|
|
124
|
+
z.object({ name: z.string().min(1), type: z.literal('connection_actions'), actions: z.array(z.string().min(1)).min(1) }).strict(),
|
|
125
|
+
]);
|
|
126
|
+
const SkillSchema = z.object({
|
|
127
|
+
name: z.string().min(1),
|
|
128
|
+
source: z.union([
|
|
129
|
+
z.object({ type: z.literal('file'), path: z.string().min(1) }).strict(),
|
|
130
|
+
z.object({ type: z.literal('inline'), instructions: z.string().min(1) }).strict(),
|
|
131
|
+
]),
|
|
132
|
+
}).strict();
|
|
133
|
+
export const AppDefinitionSchema = z.object({
|
|
134
|
+
schemaVersion: z.literal(1),
|
|
135
|
+
name: z.string().min(1),
|
|
136
|
+
subtitle: z.string().min(1),
|
|
137
|
+
categories: z.array(z.string().min(1)).optional(),
|
|
138
|
+
description: z.object({ type: z.literal('markdown'), path: z.string().min(1) }).strict(),
|
|
139
|
+
version: z.string().min(1).optional(),
|
|
140
|
+
icon: z.string().min(1).optional(),
|
|
141
|
+
accentColor: z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional(),
|
|
142
|
+
maxInstallations: z.number().int().positive().nullable(),
|
|
143
|
+
setup: AppDefinitionSetupSchema,
|
|
144
|
+
launch: AppDefinitionLaunchSchema,
|
|
145
|
+
components: z.array(AppDefinitionComponentSchema),
|
|
146
|
+
tools: z.array(AppDefinitionToolSourceSchema),
|
|
147
|
+
skills: z.array(SkillSchema),
|
|
148
|
+
kazzleAuth: z.enum(['optional', 'required']).optional(),
|
|
149
|
+
webhookUrl: z.url().optional(),
|
|
150
|
+
appLogin: z.boolean().optional(),
|
|
151
|
+
target: z.enum(['local', 'remote']).optional(),
|
|
152
|
+
}).strict().superRefine((definition, ctx) => {
|
|
153
|
+
const components = new Map(definition.components.map((component) => [component.name, component]));
|
|
154
|
+
if (definition.components.filter((component) => component.type === 'ui').length > 1) {
|
|
155
|
+
ctx.addIssue({ code: 'custom', path: ['components'], message: 'Only one UI component is allowed.' });
|
|
156
|
+
}
|
|
157
|
+
if (definition.launch.type === 'component' && !components.has(definition.launch.component)) {
|
|
158
|
+
ctx.addIssue({ code: 'custom', path: ['launch', 'component'], message: 'Launch component does not exist.' });
|
|
159
|
+
}
|
|
160
|
+
for (const field of ['components', 'tools', 'skills']) {
|
|
161
|
+
const names = new Set();
|
|
162
|
+
for (const [index, item] of definition[field].entries()) {
|
|
163
|
+
if (names.has(item.name))
|
|
164
|
+
ctx.addIssue({ code: 'custom', path: [field, index, 'name'], message: `Duplicate ${field} name "${item.name}".` });
|
|
165
|
+
names.add(item.name);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
export function defineApp(definition) {
|
|
170
|
+
return AppDefinitionSchema.parse(definition);
|
|
171
|
+
}
|