skedyul 0.1.38 → 0.1.39

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1768437850820
1
+ 1768452178260
package/dist/config.d.ts CHANGED
@@ -127,12 +127,27 @@ export interface ChannelToolBindings {
127
127
  }
128
128
  /** Scope of a model: INTERNAL (app-owned) or SHARED (user-mapped) */
129
129
  export type ResourceScope = 'INTERNAL' | 'SHARED';
130
+ /**
131
+ * Field-level data ownership.
132
+ * APP: App exclusively controls this data (e.g., status field set by webhook)
133
+ * WORKPLACE: User/organization provides this data (e.g., file upload)
134
+ * BOTH: Collaborative - either can update
135
+ */
136
+ export type FieldOwner = 'APP' | 'WORKPLACE' | 'BOTH';
137
+ /**
138
+ * StructuredFilter for conditional dependencies.
139
+ * Format: { fieldHandle: { operator: value | value[] } }
140
+ * Operators: eq, neq, gt, gte, lt, lte, contains, etc.
141
+ */
142
+ export type StructuredFilter = Record<string, Record<string, string | number | boolean | (string | number | boolean)[]>>;
130
143
  /** Model dependency reference */
131
144
  export interface ModelDependency {
132
145
  /** Handle of the model being depended upon */
133
146
  model: string;
134
147
  /** Specific fields required (undefined = all fields) */
135
148
  fields?: string[];
149
+ /** Conditions the dependency instance must satisfy (StructuredFilter format) */
150
+ where?: StructuredFilter;
136
151
  }
137
152
  /** Channel dependency reference */
138
153
  export interface ChannelDependency {
@@ -146,6 +161,37 @@ export interface WorkflowDependency {
146
161
  }
147
162
  /** Union of all resource dependency types */
148
163
  export type ResourceDependency = ModelDependency | ChannelDependency | WorkflowDependency;
164
+ /** Option for choice/enum fields */
165
+ export interface FieldOption {
166
+ /** Display label */
167
+ label: string;
168
+ /** Value stored in database */
169
+ value: string;
170
+ /** Optional color for UI display */
171
+ color?: string;
172
+ }
173
+ /**
174
+ * Inline field definition (constraints, options, etc.)
175
+ * Allows defining field behavior without referencing a metafield definition.
176
+ */
177
+ export interface InlineFieldDefinition {
178
+ /** For choice fields: number of selections allowed (1 = single select, >1 = multi) */
179
+ limitChoices?: number;
180
+ /** For choice fields: available options */
181
+ options?: FieldOption[];
182
+ /** For string fields: min length */
183
+ minLength?: number;
184
+ /** For string fields: max length */
185
+ maxLength?: number;
186
+ /** For number fields: min value */
187
+ min?: number;
188
+ /** For number fields: max value */
189
+ max?: number;
190
+ /** For relation fields: target model handle */
191
+ relatedModel?: string;
192
+ /** Validation regex pattern */
193
+ pattern?: string;
194
+ }
149
195
  /** Field definition for unified models (works for INTERNAL and SHARED) */
150
196
  export interface ModelFieldDefinition {
151
197
  /** Field handle (unique within model) */
@@ -154,8 +200,10 @@ export interface ModelFieldDefinition {
154
200
  label: string;
155
201
  /** Data type (required for INTERNAL, optional for SHARED) */
156
202
  type?: InternalFieldDataType;
157
- /** Field definition handle for SHARED fields */
203
+ /** Field definition handle for SHARED fields (references a metafield definition) */
158
204
  definitionHandle?: string;
205
+ /** Inline field definition (alternative to definitionHandle for INTERNAL fields) */
206
+ definition?: InlineFieldDefinition;
159
207
  /** Whether field is required */
160
208
  required?: boolean;
161
209
  /** Whether field must be unique */
@@ -172,6 +220,8 @@ export interface ModelFieldDefinition {
172
220
  description?: string;
173
221
  /** Visibility settings (for SHARED fields) */
174
222
  visibility?: AppFieldVisibility;
223
+ /** Data ownership: APP (app controls), WORKPLACE (user provides), BOTH (collaborative) */
224
+ owner?: FieldOwner;
175
225
  }
176
226
  /** Unified model definition (supports both INTERNAL and SHARED) */
177
227
  export interface ModelDefinition {
@@ -189,6 +239,8 @@ export interface ModelDefinition {
189
239
  description?: string;
190
240
  /** Field definitions */
191
241
  fields: ModelFieldDefinition[];
242
+ /** Model-level dependencies - other models this model requires to be provisioned */
243
+ requires?: ResourceDependency[];
192
244
  }
193
245
  export type ChannelIdentifierType = 'DEDICATED_PHONE' | 'TEXT' | 'EMAIL';
194
246
  export interface ChannelIdentifierValue {
package/dist/schemas.d.ts CHANGED
@@ -125,6 +125,19 @@ export declare const ResourceScopeSchema: z.ZodEnum<{
125
125
  INTERNAL: "INTERNAL";
126
126
  SHARED: "SHARED";
127
127
  }>;
128
+ /**
129
+ * Schema for field-level data ownership.
130
+ * Describes who owns/controls the data in a field.
131
+ * APP: App exclusively controls this data (e.g., status field set by webhook)
132
+ * WORKPLACE: User/organization provides this data (e.g., file upload)
133
+ * BOTH: Collaborative - either can update
134
+ */
135
+ export declare const FieldOwnerSchema: z.ZodEnum<{
136
+ APP: "APP";
137
+ WORKPLACE: "WORKPLACE";
138
+ BOTH: "BOTH";
139
+ }>;
140
+ export declare const StructuredFilterSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
128
141
  /**
129
142
  * Schema for a model dependency reference.
130
143
  * Used in `requires` arrays to specify model dependencies.
@@ -132,6 +145,7 @@ export declare const ResourceScopeSchema: z.ZodEnum<{
132
145
  export declare const ModelDependencySchema: z.ZodObject<{
133
146
  model: z.ZodString;
134
147
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
148
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
135
149
  }, z.core.$strip>;
136
150
  /**
137
151
  * Schema for a channel dependency reference.
@@ -154,6 +168,7 @@ export declare const WorkflowDependencySchema: z.ZodObject<{
154
168
  export declare const ResourceDependencySchema: z.ZodUnion<readonly [z.ZodObject<{
155
169
  model: z.ZodString;
156
170
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
171
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
157
172
  }, z.core.$strip>, z.ZodObject<{
158
173
  channel: z.ZodString;
159
174
  }, z.core.$strip>, z.ZodObject<{
@@ -198,6 +213,7 @@ export declare const CommunicationChannelDefinitionSchema: z.ZodObject<{
198
213
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
199
214
  model: z.ZodString;
200
215
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
216
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
201
217
  }, z.core.$strip>, z.ZodObject<{
202
218
  channel: z.ZodString;
203
219
  }, z.core.$strip>, z.ZodObject<{
@@ -243,6 +259,7 @@ export declare const ChannelDefinitionSchema: z.ZodObject<{
243
259
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
244
260
  model: z.ZodString;
245
261
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
262
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
246
263
  }, z.core.$strip>, z.ZodObject<{
247
264
  channel: z.ZodString;
248
265
  }, z.core.$strip>, z.ZodObject<{
@@ -290,6 +307,7 @@ export declare const WorkflowDefinitionSchema: z.ZodObject<{
290
307
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
291
308
  model: z.ZodString;
292
309
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
310
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
293
311
  }, z.core.$strip>, z.ZodObject<{
294
312
  channel: z.ZodString;
295
313
  }, z.core.$strip>, z.ZodObject<{
@@ -335,6 +353,32 @@ export declare const FieldDataTypeSchema: z.ZodEnum<{
335
353
  RELATION: "RELATION";
336
354
  OBJECT: "OBJECT";
337
355
  }>;
356
+ /**
357
+ * Schema for an option in a choice/enum field.
358
+ */
359
+ export declare const FieldOptionSchema: z.ZodObject<{
360
+ label: z.ZodString;
361
+ value: z.ZodString;
362
+ color: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strip>;
364
+ /**
365
+ * Schema for inline field definition (constraints, options, etc.)
366
+ * This allows defining field behavior without referencing a metafield definition.
367
+ */
368
+ export declare const InlineFieldDefinitionSchema: z.ZodObject<{
369
+ limitChoices: z.ZodOptional<z.ZodNumber>;
370
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
371
+ label: z.ZodString;
372
+ value: z.ZodString;
373
+ color: z.ZodOptional<z.ZodString>;
374
+ }, z.core.$strip>>>;
375
+ minLength: z.ZodOptional<z.ZodNumber>;
376
+ maxLength: z.ZodOptional<z.ZodNumber>;
377
+ min: z.ZodOptional<z.ZodNumber>;
378
+ max: z.ZodOptional<z.ZodNumber>;
379
+ relatedModel: z.ZodOptional<z.ZodString>;
380
+ pattern: z.ZodOptional<z.ZodString>;
381
+ }, z.core.$strip>;
338
382
  /**
339
383
  * Schema for a field within a model.
340
384
  * Works for both INTERNAL and SHARED models.
@@ -356,6 +400,20 @@ export declare const ModelFieldDefinitionSchema: z.ZodObject<{
356
400
  OBJECT: "OBJECT";
357
401
  }>>;
358
402
  definitionHandle: z.ZodOptional<z.ZodString>;
403
+ definition: z.ZodOptional<z.ZodObject<{
404
+ limitChoices: z.ZodOptional<z.ZodNumber>;
405
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
406
+ label: z.ZodString;
407
+ value: z.ZodString;
408
+ color: z.ZodOptional<z.ZodString>;
409
+ }, z.core.$strip>>>;
410
+ minLength: z.ZodOptional<z.ZodNumber>;
411
+ maxLength: z.ZodOptional<z.ZodNumber>;
412
+ min: z.ZodOptional<z.ZodNumber>;
413
+ max: z.ZodOptional<z.ZodNumber>;
414
+ relatedModel: z.ZodOptional<z.ZodString>;
415
+ pattern: z.ZodOptional<z.ZodString>;
416
+ }, z.core.$strip>>;
359
417
  required: z.ZodOptional<z.ZodBoolean>;
360
418
  unique: z.ZodOptional<z.ZodBoolean>;
361
419
  system: z.ZodOptional<z.ZodBoolean>;
@@ -369,6 +427,11 @@ export declare const ModelFieldDefinitionSchema: z.ZodObject<{
369
427
  list: z.ZodOptional<z.ZodBoolean>;
370
428
  filters: z.ZodOptional<z.ZodBoolean>;
371
429
  }, z.core.$strip>>;
430
+ owner: z.ZodOptional<z.ZodEnum<{
431
+ APP: "APP";
432
+ WORKPLACE: "WORKPLACE";
433
+ BOTH: "BOTH";
434
+ }>>;
372
435
  }, z.core.$strip>;
373
436
  /**
374
437
  * Schema for a unified model definition.
@@ -401,6 +464,20 @@ export declare const ModelDefinitionSchema: z.ZodObject<{
401
464
  OBJECT: "OBJECT";
402
465
  }>>;
403
466
  definitionHandle: z.ZodOptional<z.ZodString>;
467
+ definition: z.ZodOptional<z.ZodObject<{
468
+ limitChoices: z.ZodOptional<z.ZodNumber>;
469
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
470
+ label: z.ZodString;
471
+ value: z.ZodString;
472
+ color: z.ZodOptional<z.ZodString>;
473
+ }, z.core.$strip>>>;
474
+ minLength: z.ZodOptional<z.ZodNumber>;
475
+ maxLength: z.ZodOptional<z.ZodNumber>;
476
+ min: z.ZodOptional<z.ZodNumber>;
477
+ max: z.ZodOptional<z.ZodNumber>;
478
+ relatedModel: z.ZodOptional<z.ZodString>;
479
+ pattern: z.ZodOptional<z.ZodString>;
480
+ }, z.core.$strip>>;
404
481
  required: z.ZodOptional<z.ZodBoolean>;
405
482
  unique: z.ZodOptional<z.ZodBoolean>;
406
483
  system: z.ZodOptional<z.ZodBoolean>;
@@ -414,7 +491,21 @@ export declare const ModelDefinitionSchema: z.ZodObject<{
414
491
  list: z.ZodOptional<z.ZodBoolean>;
415
492
  filters: z.ZodOptional<z.ZodBoolean>;
416
493
  }, z.core.$strip>>;
494
+ owner: z.ZodOptional<z.ZodEnum<{
495
+ APP: "APP";
496
+ WORKPLACE: "WORKPLACE";
497
+ BOTH: "BOTH";
498
+ }>>;
417
499
  }, z.core.$strip>>;
500
+ requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
501
+ model: z.ZodString;
502
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
503
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
504
+ }, z.core.$strip>, z.ZodObject<{
505
+ channel: z.ZodString;
506
+ }, z.core.$strip>, z.ZodObject<{
507
+ workflow: z.ZodString;
508
+ }, z.core.$strip>]>>>;
418
509
  }, z.core.$strip>;
419
510
  /**
420
511
  * @deprecated Use FieldDataTypeSchema instead
@@ -598,6 +689,20 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
598
689
  OBJECT: "OBJECT";
599
690
  }>>;
600
691
  definitionHandle: z.ZodOptional<z.ZodString>;
692
+ definition: z.ZodOptional<z.ZodObject<{
693
+ limitChoices: z.ZodOptional<z.ZodNumber>;
694
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
695
+ label: z.ZodString;
696
+ value: z.ZodString;
697
+ color: z.ZodOptional<z.ZodString>;
698
+ }, z.core.$strip>>>;
699
+ minLength: z.ZodOptional<z.ZodNumber>;
700
+ maxLength: z.ZodOptional<z.ZodNumber>;
701
+ min: z.ZodOptional<z.ZodNumber>;
702
+ max: z.ZodOptional<z.ZodNumber>;
703
+ relatedModel: z.ZodOptional<z.ZodString>;
704
+ pattern: z.ZodOptional<z.ZodString>;
705
+ }, z.core.$strip>>;
601
706
  required: z.ZodOptional<z.ZodBoolean>;
602
707
  unique: z.ZodOptional<z.ZodBoolean>;
603
708
  system: z.ZodOptional<z.ZodBoolean>;
@@ -611,7 +716,21 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
611
716
  list: z.ZodOptional<z.ZodBoolean>;
612
717
  filters: z.ZodOptional<z.ZodBoolean>;
613
718
  }, z.core.$strip>>;
719
+ owner: z.ZodOptional<z.ZodEnum<{
720
+ APP: "APP";
721
+ WORKPLACE: "WORKPLACE";
722
+ BOTH: "BOTH";
723
+ }>>;
614
724
  }, z.core.$strip>>;
725
+ requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
726
+ model: z.ZodString;
727
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
728
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
729
+ }, z.core.$strip>, z.ZodObject<{
730
+ channel: z.ZodString;
731
+ }, z.core.$strip>, z.ZodObject<{
732
+ workflow: z.ZodString;
733
+ }, z.core.$strip>]>>>;
615
734
  }, z.core.$strip>>>;
616
735
  channels: z.ZodOptional<z.ZodArray<z.ZodObject<{
617
736
  handle: z.ZodString;
@@ -649,6 +768,7 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
649
768
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
650
769
  model: z.ZodString;
651
770
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
771
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
652
772
  }, z.core.$strip>, z.ZodObject<{
653
773
  channel: z.ZodString;
654
774
  }, z.core.$strip>, z.ZodObject<{
@@ -691,6 +811,7 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
691
811
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
692
812
  model: z.ZodString;
693
813
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
814
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
694
815
  }, z.core.$strip>, z.ZodObject<{
695
816
  channel: z.ZodString;
696
817
  }, z.core.$strip>, z.ZodObject<{
@@ -705,6 +826,7 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
705
826
  requires: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
706
827
  model: z.ZodString;
707
828
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
829
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>>;
708
830
  }, z.core.$strip>, z.ZodObject<{
709
831
  channel: z.ZodString;
710
832
  }, z.core.$strip>, z.ZodObject<{
@@ -770,6 +892,14 @@ export type ParsedSkedyulConfig = z.infer<typeof SkedyulConfigSchema>;
770
892
  export declare function safeParseConfig(data: unknown): ParsedSkedyulConfig | null;
771
893
  /** Resource scope type */
772
894
  export type ResourceScope = z.infer<typeof ResourceScopeSchema>;
895
+ /** Field owner type (data ownership) */
896
+ export type FieldOwner = z.infer<typeof FieldOwnerSchema>;
897
+ /** StructuredFilter type for conditional dependencies */
898
+ export type StructuredFilter = z.infer<typeof StructuredFilterSchema>;
899
+ /** Field option for choice/enum fields */
900
+ export type FieldOption = z.infer<typeof FieldOptionSchema>;
901
+ /** Inline field definition (constraints, options, etc.) */
902
+ export type InlineFieldDefinition = z.infer<typeof InlineFieldDefinitionSchema>;
773
903
  /** Model dependency reference */
774
904
  export type ModelDependency = z.infer<typeof ModelDependencySchema>;
775
905
  /** Channel dependency reference */
package/dist/schemas.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SkedyulConfigSchema = exports.InternalModelDefinitionSchema = exports.InternalFieldDefinitionSchema = exports.InternalFieldDataTypeSchema = exports.ModelDefinitionSchema = exports.ModelFieldDefinitionSchema = exports.FieldDataTypeSchema = exports.ComputeLayerTypeSchema = exports.WorkflowDefinitionSchema = exports.WorkflowActionSchema = exports.WorkflowActionInputSchema = exports.ChannelDefinitionSchema = exports.CommunicationChannelDefinitionSchema = exports.ResourceDependencySchema = exports.WorkflowDependencySchema = exports.ChannelDependencySchema = exports.ModelDependencySchema = exports.ResourceScopeSchema = exports.ChannelIdentifierValueSchema = exports.ChannelIdentifierTypeSchema = exports.ChannelToolBindingsSchema = exports.AppFieldDefinitionSchema = exports.AppFieldVisibilitySchema = exports.InstallConfigSchema = exports.AppModelDefinitionSchema = exports.EnvSchemaSchema = exports.EnvVariableDefinitionSchema = exports.EnvVisibilitySchema = void 0;
3
+ exports.SkedyulConfigSchema = exports.InternalModelDefinitionSchema = exports.InternalFieldDefinitionSchema = exports.InternalFieldDataTypeSchema = exports.ModelDefinitionSchema = exports.ModelFieldDefinitionSchema = exports.InlineFieldDefinitionSchema = exports.FieldOptionSchema = exports.FieldDataTypeSchema = exports.ComputeLayerTypeSchema = exports.WorkflowDefinitionSchema = exports.WorkflowActionSchema = exports.WorkflowActionInputSchema = exports.ChannelDefinitionSchema = exports.CommunicationChannelDefinitionSchema = exports.ResourceDependencySchema = exports.WorkflowDependencySchema = exports.ChannelDependencySchema = exports.ModelDependencySchema = exports.StructuredFilterSchema = exports.FieldOwnerSchema = exports.ResourceScopeSchema = exports.ChannelIdentifierValueSchema = exports.ChannelIdentifierTypeSchema = exports.ChannelToolBindingsSchema = exports.AppFieldDefinitionSchema = exports.AppFieldVisibilitySchema = exports.InstallConfigSchema = exports.AppModelDefinitionSchema = exports.EnvSchemaSchema = exports.EnvVariableDefinitionSchema = exports.EnvVisibilitySchema = void 0;
4
4
  exports.safeParseConfig = safeParseConfig;
5
5
  exports.isModelDependency = isModelDependency;
6
6
  exports.isChannelDependency = isChannelDependency;
@@ -99,6 +99,21 @@ exports.ChannelIdentifierValueSchema = zod_1.z.object({
99
99
  * SHARED: Maps to user's existing resource, requires user selection
100
100
  */
101
101
  exports.ResourceScopeSchema = zod_1.z.enum(['INTERNAL', 'SHARED']);
102
+ /**
103
+ * Schema for field-level data ownership.
104
+ * Describes who owns/controls the data in a field.
105
+ * APP: App exclusively controls this data (e.g., status field set by webhook)
106
+ * WORKPLACE: User/organization provides this data (e.g., file upload)
107
+ * BOTH: Collaborative - either can update
108
+ */
109
+ exports.FieldOwnerSchema = zod_1.z.enum(['APP', 'WORKPLACE', 'BOTH']);
110
+ /**
111
+ * Schema for StructuredFilter conditions.
112
+ * Used for conditional dependencies (e.g., require model where status = APPROVED)
113
+ * Format: { fieldHandle: { operator: value } }
114
+ */
115
+ const PrimitiveSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean()]);
116
+ exports.StructuredFilterSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.union([PrimitiveSchema, zod_1.z.array(PrimitiveSchema)])));
102
117
  /**
103
118
  * Schema for a model dependency reference.
104
119
  * Used in `requires` arrays to specify model dependencies.
@@ -108,6 +123,8 @@ exports.ModelDependencySchema = zod_1.z.object({
108
123
  model: zod_1.z.string(),
109
124
  /** Specific fields required (undefined = all fields) */
110
125
  fields: zod_1.z.array(zod_1.z.string()).optional(),
126
+ /** Conditions the dependency instance must satisfy (StructuredFilter format) */
127
+ where: exports.StructuredFilterSchema.optional(),
111
128
  });
112
129
  /**
113
130
  * Schema for a channel dependency reference.
@@ -217,6 +234,39 @@ exports.FieldDataTypeSchema = zod_1.z.enum([
217
234
  'RELATION',
218
235
  'OBJECT',
219
236
  ]);
237
+ /**
238
+ * Schema for an option in a choice/enum field.
239
+ */
240
+ exports.FieldOptionSchema = zod_1.z.object({
241
+ /** Display label */
242
+ label: zod_1.z.string(),
243
+ /** Value stored in database */
244
+ value: zod_1.z.string(),
245
+ /** Optional color for UI display */
246
+ color: zod_1.z.string().optional(),
247
+ });
248
+ /**
249
+ * Schema for inline field definition (constraints, options, etc.)
250
+ * This allows defining field behavior without referencing a metafield definition.
251
+ */
252
+ exports.InlineFieldDefinitionSchema = zod_1.z.object({
253
+ /** For choice fields: number of selections allowed (1 = single select, >1 = multi) */
254
+ limitChoices: zod_1.z.number().optional(),
255
+ /** For choice fields: available options */
256
+ options: zod_1.z.array(exports.FieldOptionSchema).optional(),
257
+ /** For string fields: min length */
258
+ minLength: zod_1.z.number().optional(),
259
+ /** For string fields: max length */
260
+ maxLength: zod_1.z.number().optional(),
261
+ /** For number fields: min value */
262
+ min: zod_1.z.number().optional(),
263
+ /** For number fields: max value */
264
+ max: zod_1.z.number().optional(),
265
+ /** For relation fields: target model handle */
266
+ relatedModel: zod_1.z.string().optional(),
267
+ /** Validation regex pattern */
268
+ pattern: zod_1.z.string().optional(),
269
+ });
220
270
  /**
221
271
  * Schema for a field within a model.
222
272
  * Works for both INTERNAL and SHARED models.
@@ -228,8 +278,10 @@ exports.ModelFieldDefinitionSchema = zod_1.z.object({
228
278
  label: zod_1.z.string(),
229
279
  /** Data type (required for INTERNAL, optional for SHARED) */
230
280
  type: exports.FieldDataTypeSchema.optional(),
231
- /** Field definition handle for SHARED fields */
281
+ /** Field definition handle for SHARED fields (references a metafield definition) */
232
282
  definitionHandle: zod_1.z.string().optional(),
283
+ /** Inline field definition (alternative to definitionHandle for INTERNAL fields) */
284
+ definition: exports.InlineFieldDefinitionSchema.optional(),
233
285
  /** Whether field is required */
234
286
  required: zod_1.z.boolean().optional(),
235
287
  /** Whether field must be unique */
@@ -244,6 +296,8 @@ exports.ModelFieldDefinitionSchema = zod_1.z.object({
244
296
  description: zod_1.z.string().optional(),
245
297
  /** Visibility settings for SHARED fields */
246
298
  visibility: exports.AppFieldVisibilitySchema.optional(),
299
+ /** Data ownership: APP (app controls), WORKPLACE (user provides), BOTH (collaborative) */
300
+ owner: exports.FieldOwnerSchema.optional(),
247
301
  });
248
302
  /**
249
303
  * Schema for a unified model definition.
@@ -264,6 +318,8 @@ exports.ModelDefinitionSchema = zod_1.z.object({
264
318
  description: zod_1.z.string().optional(),
265
319
  /** Field definitions */
266
320
  fields: zod_1.z.array(exports.ModelFieldDefinitionSchema),
321
+ /** Model-level dependencies - other models this model requires to be provisioned */
322
+ requires: zod_1.z.array(exports.ResourceDependencySchema).optional(),
267
323
  });
268
324
  // ─────────────────────────────────────────────────────────────────────────────
269
325
  // Legacy Internal Model Schemas (deprecated - use ModelDefinitionSchema)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",