skedyul 0.1.29 → 0.1.31
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/config.d.ts +33 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/schemas.d.ts +328 -0
- package/dist/schemas.js +171 -0
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolRegistry, WebhookRegistry } from './types';
|
|
1
|
+
import type { ToolRegistry, WebhookRegistry, ToolMetadata, WebhookMetadata } from './types';
|
|
2
2
|
export type EnvVisibility = 'visible' | 'encrypted';
|
|
3
3
|
export interface EnvVariableDefinition {
|
|
4
4
|
/** Human-readable label for the variable */
|
|
@@ -189,6 +189,38 @@ export interface SkedyulConfig {
|
|
|
189
189
|
*/
|
|
190
190
|
workflows?: WorkflowDefinition[];
|
|
191
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Serializable snapshot of SkedyulConfig for database storage.
|
|
194
|
+
*
|
|
195
|
+
* This type mirrors SkedyulConfig but replaces non-serializable fields
|
|
196
|
+
* (dynamic imports, handlers) with their serializable metadata equivalents.
|
|
197
|
+
*
|
|
198
|
+
* Use this type when storing executable configuration in the database.
|
|
199
|
+
*/
|
|
200
|
+
export interface SerializableSkedyulConfig {
|
|
201
|
+
/** App name */
|
|
202
|
+
name: string;
|
|
203
|
+
/** App version (semver) */
|
|
204
|
+
version?: string;
|
|
205
|
+
/** App description */
|
|
206
|
+
description?: string;
|
|
207
|
+
/** Compute layer: 'serverless' (Lambda) or 'dedicated' (ECS/Docker) */
|
|
208
|
+
computeLayer?: ComputeLayerType;
|
|
209
|
+
/** Tool metadata array (serialized from ToolRegistry) */
|
|
210
|
+
tools?: ToolMetadata[];
|
|
211
|
+
/** Webhook metadata array (serialized from WebhookRegistry) */
|
|
212
|
+
webhooks?: WebhookMetadata[];
|
|
213
|
+
/** Path to the workflows directory */
|
|
214
|
+
workflowsPath?: string;
|
|
215
|
+
/** Global/version-level environment variable schema */
|
|
216
|
+
env?: EnvSchema;
|
|
217
|
+
/** Install-time configuration */
|
|
218
|
+
install?: InstallConfig;
|
|
219
|
+
/** Communication channels this app provides */
|
|
220
|
+
communicationChannels?: CommunicationChannelDefinition[];
|
|
221
|
+
/** Workflows this app provides */
|
|
222
|
+
workflows?: WorkflowDefinition[];
|
|
223
|
+
}
|
|
192
224
|
/**
|
|
193
225
|
* Define a Skedyul app configuration with full type safety.
|
|
194
226
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
+
export * from './schemas';
|
|
2
3
|
export { server } from './server';
|
|
3
4
|
export { workplace, communicationChannel, configure, getConfig } from './core/client';
|
|
4
5
|
export { defineConfig, loadConfig, validateConfig, getRequiredInstallEnvKeys, getAllEnvKeys, CONFIG_FILE_NAMES, } from './config';
|
|
5
|
-
export type { SkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType, AppFieldVisibility, AppFieldDefinition, ChannelToolBindings, ChannelIdentifierType, ChannelIdentifierValue, CommunicationChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, } from './config';
|
|
6
|
+
export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType, AppFieldVisibility, AppFieldDefinition, ChannelToolBindings, ChannelIdentifierType, ChannelIdentifierValue, CommunicationChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, } from './config';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.CONFIG_FILE_NAMES = exports.getAllEnvKeys = exports.getRequiredInstallEnvKeys = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.getConfig = exports.configure = exports.communicationChannel = exports.workplace = exports.server = void 0;
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./schemas"), exports);
|
|
19
20
|
var server_1 = require("./server");
|
|
20
21
|
Object.defineProperty(exports, "server", { enumerable: true, get: function () { return server_1.server; } });
|
|
21
22
|
var client_1 = require("./core/client");
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Schema for environment variable visibility
|
|
4
|
+
*/
|
|
5
|
+
export declare const EnvVisibilitySchema: z.ZodEnum<{
|
|
6
|
+
visible: "visible";
|
|
7
|
+
encrypted: "encrypted";
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Schema for a single environment variable definition.
|
|
11
|
+
*/
|
|
12
|
+
export declare const EnvVariableDefinitionSchema: z.ZodObject<{
|
|
13
|
+
label: z.ZodString;
|
|
14
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
visible: "visible";
|
|
17
|
+
encrypted: "encrypted";
|
|
18
|
+
}>>;
|
|
19
|
+
default: z.ZodOptional<z.ZodString>;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* Schema for a collection of environment variable definitions.
|
|
25
|
+
*/
|
|
26
|
+
export declare const EnvSchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
27
|
+
label: z.ZodString;
|
|
28
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
visible: "visible";
|
|
31
|
+
encrypted: "encrypted";
|
|
32
|
+
}>>;
|
|
33
|
+
default: z.ZodOptional<z.ZodString>;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
/**
|
|
38
|
+
* Schema for app model definition.
|
|
39
|
+
*/
|
|
40
|
+
export declare const AppModelDefinitionSchema: z.ZodObject<{
|
|
41
|
+
entityHandle: z.ZodString;
|
|
42
|
+
label: z.ZodString;
|
|
43
|
+
description: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* Schema for install configuration.
|
|
47
|
+
*/
|
|
48
|
+
export declare const InstallConfigSchema: z.ZodObject<{
|
|
49
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
50
|
+
label: z.ZodString;
|
|
51
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
visible: "visible";
|
|
54
|
+
encrypted: "encrypted";
|
|
55
|
+
}>>;
|
|
56
|
+
default: z.ZodOptional<z.ZodString>;
|
|
57
|
+
description: z.ZodOptional<z.ZodString>;
|
|
58
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>>>;
|
|
60
|
+
appModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
entityHandle: z.ZodString;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
/**
|
|
67
|
+
* Schema for app field visibility.
|
|
68
|
+
*/
|
|
69
|
+
export declare const AppFieldVisibilitySchema: z.ZodObject<{
|
|
70
|
+
data: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
list: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
filters: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
/**
|
|
75
|
+
* Schema for app field definition (communication channels).
|
|
76
|
+
*/
|
|
77
|
+
export declare const AppFieldDefinitionSchema: z.ZodObject<{
|
|
78
|
+
label: z.ZodString;
|
|
79
|
+
fieldHandle: z.ZodString;
|
|
80
|
+
entityHandle: z.ZodString;
|
|
81
|
+
definitionHandle: z.ZodString;
|
|
82
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
system: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
value: z.ZodUnknown;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
visibility: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
data: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
list: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
filters: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
/**
|
|
95
|
+
* Schema for channel tool bindings.
|
|
96
|
+
*/
|
|
97
|
+
export declare const ChannelToolBindingsSchema: z.ZodObject<{
|
|
98
|
+
send_message: z.ZodString;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
/**
|
|
101
|
+
* Schema for channel identifier type.
|
|
102
|
+
*/
|
|
103
|
+
export declare const ChannelIdentifierTypeSchema: z.ZodEnum<{
|
|
104
|
+
DEDICATED_PHONE: "DEDICATED_PHONE";
|
|
105
|
+
TEXT: "TEXT";
|
|
106
|
+
EMAIL: "EMAIL";
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Schema for channel identifier value.
|
|
110
|
+
*/
|
|
111
|
+
export declare const ChannelIdentifierValueSchema: z.ZodObject<{
|
|
112
|
+
type: z.ZodEnum<{
|
|
113
|
+
DEDICATED_PHONE: "DEDICATED_PHONE";
|
|
114
|
+
TEXT: "TEXT";
|
|
115
|
+
EMAIL: "EMAIL";
|
|
116
|
+
}>;
|
|
117
|
+
definitionHandle: z.ZodString;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
/**
|
|
120
|
+
* Schema for communication channel definition.
|
|
121
|
+
*/
|
|
122
|
+
export declare const CommunicationChannelDefinitionSchema: z.ZodObject<{
|
|
123
|
+
handle: z.ZodString;
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
126
|
+
tools: z.ZodObject<{
|
|
127
|
+
send_message: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
identifierValue: z.ZodObject<{
|
|
130
|
+
type: z.ZodEnum<{
|
|
131
|
+
DEDICATED_PHONE: "DEDICATED_PHONE";
|
|
132
|
+
TEXT: "TEXT";
|
|
133
|
+
EMAIL: "EMAIL";
|
|
134
|
+
}>;
|
|
135
|
+
definitionHandle: z.ZodString;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
appFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
label: z.ZodString;
|
|
139
|
+
fieldHandle: z.ZodString;
|
|
140
|
+
entityHandle: z.ZodString;
|
|
141
|
+
definitionHandle: z.ZodString;
|
|
142
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
system: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
value: z.ZodUnknown;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
visibility: z.ZodOptional<z.ZodObject<{
|
|
149
|
+
data: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
list: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
filters: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
}, z.core.$strip>>>;
|
|
154
|
+
settings: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
/**
|
|
157
|
+
* Schema for workflow action input.
|
|
158
|
+
*/
|
|
159
|
+
export declare const WorkflowActionInputSchema: z.ZodObject<{
|
|
160
|
+
key: z.ZodString;
|
|
161
|
+
label: z.ZodString;
|
|
162
|
+
fieldRef: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
fieldHandle: z.ZodString;
|
|
164
|
+
entityHandle: z.ZodString;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
template: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
/**
|
|
169
|
+
* Schema for workflow action.
|
|
170
|
+
*/
|
|
171
|
+
export declare const WorkflowActionSchema: z.ZodObject<{
|
|
172
|
+
label: z.ZodString;
|
|
173
|
+
handle: z.ZodString;
|
|
174
|
+
batch: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
entityHandle: z.ZodOptional<z.ZodString>;
|
|
176
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
key: z.ZodString;
|
|
178
|
+
label: z.ZodString;
|
|
179
|
+
fieldRef: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
fieldHandle: z.ZodString;
|
|
181
|
+
entityHandle: z.ZodString;
|
|
182
|
+
}, z.core.$strip>>;
|
|
183
|
+
template: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
/**
|
|
187
|
+
* Schema for workflow definition.
|
|
188
|
+
*/
|
|
189
|
+
export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
190
|
+
path: z.ZodString;
|
|
191
|
+
label: z.ZodOptional<z.ZodString>;
|
|
192
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
193
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
194
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
195
|
+
label: z.ZodString;
|
|
196
|
+
handle: z.ZodString;
|
|
197
|
+
batch: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
entityHandle: z.ZodOptional<z.ZodString>;
|
|
199
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
200
|
+
key: z.ZodString;
|
|
201
|
+
label: z.ZodString;
|
|
202
|
+
fieldRef: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
fieldHandle: z.ZodString;
|
|
204
|
+
entityHandle: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
template: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>>>;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
/**
|
|
211
|
+
* Schema for compute layer type.
|
|
212
|
+
*/
|
|
213
|
+
export declare const ComputeLayerTypeSchema: z.ZodEnum<{
|
|
214
|
+
dedicated: "dedicated";
|
|
215
|
+
serverless: "serverless";
|
|
216
|
+
}>;
|
|
217
|
+
/**
|
|
218
|
+
* Schema for the full skedyul.config.ts stored on an Executable.
|
|
219
|
+
* This is the single source of truth for all app configuration.
|
|
220
|
+
*
|
|
221
|
+
* Note: tools and webhooks are stored as null/unknown since they are
|
|
222
|
+
* dynamic imports that cannot be serialized. Use SerializableSkedyulConfigSchema
|
|
223
|
+
* for database storage which uses ToolMetadata[] and WebhookMetadata[] instead.
|
|
224
|
+
*/
|
|
225
|
+
export declare const SkedyulConfigSchema: z.ZodObject<{
|
|
226
|
+
name: z.ZodString;
|
|
227
|
+
version: z.ZodOptional<z.ZodString>;
|
|
228
|
+
description: z.ZodOptional<z.ZodString>;
|
|
229
|
+
computeLayer: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
dedicated: "dedicated";
|
|
231
|
+
serverless: "serverless";
|
|
232
|
+
}>>;
|
|
233
|
+
tools: z.ZodOptional<z.ZodUnknown>;
|
|
234
|
+
webhooks: z.ZodOptional<z.ZodUnknown>;
|
|
235
|
+
workflowsPath: z.ZodOptional<z.ZodString>;
|
|
236
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
237
|
+
label: z.ZodString;
|
|
238
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
240
|
+
visible: "visible";
|
|
241
|
+
encrypted: "encrypted";
|
|
242
|
+
}>>;
|
|
243
|
+
default: z.ZodOptional<z.ZodString>;
|
|
244
|
+
description: z.ZodOptional<z.ZodString>;
|
|
245
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
246
|
+
}, z.core.$strip>>>;
|
|
247
|
+
install: z.ZodOptional<z.ZodObject<{
|
|
248
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
249
|
+
label: z.ZodString;
|
|
250
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
252
|
+
visible: "visible";
|
|
253
|
+
encrypted: "encrypted";
|
|
254
|
+
}>>;
|
|
255
|
+
default: z.ZodOptional<z.ZodString>;
|
|
256
|
+
description: z.ZodOptional<z.ZodString>;
|
|
257
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
258
|
+
}, z.core.$strip>>>;
|
|
259
|
+
appModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
260
|
+
entityHandle: z.ZodString;
|
|
261
|
+
label: z.ZodString;
|
|
262
|
+
description: z.ZodOptional<z.ZodString>;
|
|
263
|
+
}, z.core.$strip>>>;
|
|
264
|
+
}, z.core.$strip>>;
|
|
265
|
+
communicationChannels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
266
|
+
handle: z.ZodString;
|
|
267
|
+
name: z.ZodString;
|
|
268
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
269
|
+
tools: z.ZodObject<{
|
|
270
|
+
send_message: z.ZodString;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
identifierValue: z.ZodObject<{
|
|
273
|
+
type: z.ZodEnum<{
|
|
274
|
+
DEDICATED_PHONE: "DEDICATED_PHONE";
|
|
275
|
+
TEXT: "TEXT";
|
|
276
|
+
EMAIL: "EMAIL";
|
|
277
|
+
}>;
|
|
278
|
+
definitionHandle: z.ZodString;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
appFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
281
|
+
label: z.ZodString;
|
|
282
|
+
fieldHandle: z.ZodString;
|
|
283
|
+
entityHandle: z.ZodString;
|
|
284
|
+
definitionHandle: z.ZodString;
|
|
285
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
286
|
+
system: z.ZodOptional<z.ZodBoolean>;
|
|
287
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
value: z.ZodUnknown;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
visibility: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
data: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
list: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
+
filters: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
}, z.core.$strip>>;
|
|
296
|
+
}, z.core.$strip>>>;
|
|
297
|
+
settings: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
298
|
+
}, z.core.$strip>>>;
|
|
299
|
+
workflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
300
|
+
path: z.ZodString;
|
|
301
|
+
label: z.ZodOptional<z.ZodString>;
|
|
302
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
303
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
304
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
305
|
+
label: z.ZodString;
|
|
306
|
+
handle: z.ZodString;
|
|
307
|
+
batch: z.ZodOptional<z.ZodBoolean>;
|
|
308
|
+
entityHandle: z.ZodOptional<z.ZodString>;
|
|
309
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
310
|
+
key: z.ZodString;
|
|
311
|
+
label: z.ZodString;
|
|
312
|
+
fieldRef: z.ZodOptional<z.ZodObject<{
|
|
313
|
+
fieldHandle: z.ZodString;
|
|
314
|
+
entityHandle: z.ZodString;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
template: z.ZodOptional<z.ZodString>;
|
|
317
|
+
}, z.core.$strip>>>;
|
|
318
|
+
}, z.core.$strip>>;
|
|
319
|
+
}, z.core.$strip>>>;
|
|
320
|
+
}, z.core.$strip>;
|
|
321
|
+
/**
|
|
322
|
+
* Inferred type from SkedyulConfigSchema for runtime-validated configs.
|
|
323
|
+
*/
|
|
324
|
+
export type ParsedSkedyulConfig = z.infer<typeof SkedyulConfigSchema>;
|
|
325
|
+
/**
|
|
326
|
+
* Safely parse a skedyul config, returning null if invalid.
|
|
327
|
+
*/
|
|
328
|
+
export declare function safeParseConfig(data: unknown): ParsedSkedyulConfig | null;
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkedyulConfigSchema = exports.ComputeLayerTypeSchema = exports.WorkflowDefinitionSchema = exports.WorkflowActionSchema = exports.WorkflowActionInputSchema = exports.CommunicationChannelDefinitionSchema = exports.ChannelIdentifierValueSchema = exports.ChannelIdentifierTypeSchema = exports.ChannelToolBindingsSchema = exports.AppFieldDefinitionSchema = exports.AppFieldVisibilitySchema = exports.InstallConfigSchema = exports.AppModelDefinitionSchema = exports.EnvSchemaSchema = exports.EnvVariableDefinitionSchema = exports.EnvVisibilitySchema = void 0;
|
|
4
|
+
exports.safeParseConfig = safeParseConfig;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
// Zod Schemas for SkedyulConfig
|
|
8
|
+
// These schemas are used for runtime validation of config files.
|
|
9
|
+
// TypeScript types in config.ts should match these schemas.
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* Schema for environment variable visibility
|
|
13
|
+
*/
|
|
14
|
+
exports.EnvVisibilitySchema = zod_1.z.enum(['visible', 'encrypted']);
|
|
15
|
+
/**
|
|
16
|
+
* Schema for a single environment variable definition.
|
|
17
|
+
*/
|
|
18
|
+
exports.EnvVariableDefinitionSchema = zod_1.z.object({
|
|
19
|
+
label: zod_1.z.string(),
|
|
20
|
+
required: zod_1.z.boolean().optional(),
|
|
21
|
+
visibility: exports.EnvVisibilitySchema.optional(),
|
|
22
|
+
default: zod_1.z.string().optional(),
|
|
23
|
+
description: zod_1.z.string().optional(),
|
|
24
|
+
placeholder: zod_1.z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Schema for a collection of environment variable definitions.
|
|
28
|
+
*/
|
|
29
|
+
exports.EnvSchemaSchema = zod_1.z.record(zod_1.z.string(), exports.EnvVariableDefinitionSchema);
|
|
30
|
+
/**
|
|
31
|
+
* Schema for app model definition.
|
|
32
|
+
*/
|
|
33
|
+
exports.AppModelDefinitionSchema = zod_1.z.object({
|
|
34
|
+
entityHandle: zod_1.z.string(),
|
|
35
|
+
label: zod_1.z.string(),
|
|
36
|
+
description: zod_1.z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Schema for install configuration.
|
|
40
|
+
*/
|
|
41
|
+
exports.InstallConfigSchema = zod_1.z.object({
|
|
42
|
+
env: exports.EnvSchemaSchema.optional(),
|
|
43
|
+
appModels: zod_1.z.array(exports.AppModelDefinitionSchema).optional(),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Schema for app field visibility.
|
|
47
|
+
*/
|
|
48
|
+
exports.AppFieldVisibilitySchema = zod_1.z.object({
|
|
49
|
+
data: zod_1.z.boolean().optional(),
|
|
50
|
+
list: zod_1.z.boolean().optional(),
|
|
51
|
+
filters: zod_1.z.boolean().optional(),
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Schema for app field definition (communication channels).
|
|
55
|
+
*/
|
|
56
|
+
exports.AppFieldDefinitionSchema = zod_1.z.object({
|
|
57
|
+
label: zod_1.z.string(),
|
|
58
|
+
fieldHandle: zod_1.z.string(),
|
|
59
|
+
entityHandle: zod_1.z.string(),
|
|
60
|
+
definitionHandle: zod_1.z.string(),
|
|
61
|
+
required: zod_1.z.boolean().optional(),
|
|
62
|
+
system: zod_1.z.boolean().optional(),
|
|
63
|
+
unique: zod_1.z.boolean().optional(),
|
|
64
|
+
defaultValue: zod_1.z.object({ value: zod_1.z.unknown() }).optional(),
|
|
65
|
+
visibility: exports.AppFieldVisibilitySchema.optional(),
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Schema for channel tool bindings.
|
|
69
|
+
*/
|
|
70
|
+
exports.ChannelToolBindingsSchema = zod_1.z.object({
|
|
71
|
+
send_message: zod_1.z.string(),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Schema for channel identifier type.
|
|
75
|
+
*/
|
|
76
|
+
exports.ChannelIdentifierTypeSchema = zod_1.z.enum([
|
|
77
|
+
'DEDICATED_PHONE',
|
|
78
|
+
'TEXT',
|
|
79
|
+
'EMAIL',
|
|
80
|
+
]);
|
|
81
|
+
/**
|
|
82
|
+
* Schema for channel identifier value.
|
|
83
|
+
*/
|
|
84
|
+
exports.ChannelIdentifierValueSchema = zod_1.z.object({
|
|
85
|
+
type: exports.ChannelIdentifierTypeSchema,
|
|
86
|
+
definitionHandle: zod_1.z.string(),
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* Schema for communication channel definition.
|
|
90
|
+
*/
|
|
91
|
+
exports.CommunicationChannelDefinitionSchema = zod_1.z.object({
|
|
92
|
+
handle: zod_1.z.string(),
|
|
93
|
+
name: zod_1.z.string(),
|
|
94
|
+
icon: zod_1.z.string().optional(),
|
|
95
|
+
tools: exports.ChannelToolBindingsSchema,
|
|
96
|
+
identifierValue: exports.ChannelIdentifierValueSchema,
|
|
97
|
+
appFields: zod_1.z.array(exports.AppFieldDefinitionSchema).optional(),
|
|
98
|
+
settings: zod_1.z.array(zod_1.z.unknown()).optional(),
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Schema for workflow action input.
|
|
102
|
+
*/
|
|
103
|
+
exports.WorkflowActionInputSchema = zod_1.z.object({
|
|
104
|
+
key: zod_1.z.string(),
|
|
105
|
+
label: zod_1.z.string(),
|
|
106
|
+
fieldRef: zod_1.z
|
|
107
|
+
.object({
|
|
108
|
+
fieldHandle: zod_1.z.string(),
|
|
109
|
+
entityHandle: zod_1.z.string(),
|
|
110
|
+
})
|
|
111
|
+
.optional(),
|
|
112
|
+
template: zod_1.z.string().optional(),
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Schema for workflow action.
|
|
116
|
+
*/
|
|
117
|
+
exports.WorkflowActionSchema = zod_1.z.object({
|
|
118
|
+
label: zod_1.z.string(),
|
|
119
|
+
handle: zod_1.z.string(),
|
|
120
|
+
batch: zod_1.z.boolean().optional(),
|
|
121
|
+
entityHandle: zod_1.z.string().optional(),
|
|
122
|
+
inputs: zod_1.z.array(exports.WorkflowActionInputSchema).optional(),
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* Schema for workflow definition.
|
|
126
|
+
*/
|
|
127
|
+
exports.WorkflowDefinitionSchema = zod_1.z.object({
|
|
128
|
+
/** Path to external YAML workflow file (relative to config) */
|
|
129
|
+
path: zod_1.z.string(),
|
|
130
|
+
/** Human-readable label (optional when path is provided, inferred from YAML) */
|
|
131
|
+
label: zod_1.z.string().optional(),
|
|
132
|
+
/** Workflow handle/key (optional when path is provided, inferred from YAML) */
|
|
133
|
+
handle: zod_1.z.string().optional(),
|
|
134
|
+
/** Channel handle (optional) */
|
|
135
|
+
channelHandle: zod_1.z.string().optional(),
|
|
136
|
+
/** Actions in this workflow */
|
|
137
|
+
actions: zod_1.z.array(exports.WorkflowActionSchema),
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* Schema for compute layer type.
|
|
141
|
+
*/
|
|
142
|
+
exports.ComputeLayerTypeSchema = zod_1.z.enum(['serverless', 'dedicated']);
|
|
143
|
+
/**
|
|
144
|
+
* Schema for the full skedyul.config.ts stored on an Executable.
|
|
145
|
+
* This is the single source of truth for all app configuration.
|
|
146
|
+
*
|
|
147
|
+
* Note: tools and webhooks are stored as null/unknown since they are
|
|
148
|
+
* dynamic imports that cannot be serialized. Use SerializableSkedyulConfigSchema
|
|
149
|
+
* for database storage which uses ToolMetadata[] and WebhookMetadata[] instead.
|
|
150
|
+
*/
|
|
151
|
+
exports.SkedyulConfigSchema = zod_1.z.object({
|
|
152
|
+
name: zod_1.z.string(),
|
|
153
|
+
version: zod_1.z.string().optional(),
|
|
154
|
+
description: zod_1.z.string().optional(),
|
|
155
|
+
computeLayer: exports.ComputeLayerTypeSchema.optional(),
|
|
156
|
+
// Dynamic imports become null after transpilation
|
|
157
|
+
tools: zod_1.z.unknown().optional(),
|
|
158
|
+
webhooks: zod_1.z.unknown().optional(),
|
|
159
|
+
workflowsPath: zod_1.z.string().optional(),
|
|
160
|
+
env: exports.EnvSchemaSchema.optional(),
|
|
161
|
+
install: exports.InstallConfigSchema.optional(),
|
|
162
|
+
communicationChannels: zod_1.z.array(exports.CommunicationChannelDefinitionSchema).optional(),
|
|
163
|
+
workflows: zod_1.z.array(exports.WorkflowDefinitionSchema).optional(),
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* Safely parse a skedyul config, returning null if invalid.
|
|
167
|
+
*/
|
|
168
|
+
function safeParseConfig(data) {
|
|
169
|
+
const result = exports.SkedyulConfigSchema.safeParse(data);
|
|
170
|
+
return result.success ? result.data : null;
|
|
171
|
+
}
|