skedyul 0.1.39 → 0.1.40

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
- 1768452178260
1
+ 1768537680901
package/dist/config.d.ts CHANGED
@@ -242,6 +242,30 @@ export interface ModelDefinition {
242
242
  /** Model-level dependencies - other models this model requires to be provisioned */
243
243
  requires?: ResourceDependency[];
244
244
  }
245
+ /** Relationship cardinality */
246
+ export type RelationshipCardinality = 'ONE_TO_ONE' | 'ONE_TO_MANY' | 'MANY_TO_ONE' | 'MANY_TO_MANY';
247
+ /** On-delete behavior for relationships */
248
+ export type OnDeleteBehavior = 'NONE' | 'CASCADE' | 'RESTRICT';
249
+ /** One side of a relationship */
250
+ export interface RelationshipLink {
251
+ /** Model handle for this side */
252
+ model: string;
253
+ /** Field handle on this model */
254
+ field: string;
255
+ /** Field label for display */
256
+ label: string;
257
+ /** Cardinality from this side */
258
+ cardinality: RelationshipCardinality;
259
+ /** On-delete behavior */
260
+ onDelete?: OnDeleteBehavior;
261
+ }
262
+ /** Bidirectional relationship definition between two models */
263
+ export interface RelationshipDefinition {
264
+ /** Source side of the relationship */
265
+ source: RelationshipLink;
266
+ /** Target side of the relationship */
267
+ target: RelationshipLink;
268
+ }
245
269
  export type ChannelIdentifierType = 'DEDICATED_PHONE' | 'TEXT' | 'EMAIL';
246
270
  export interface ChannelIdentifierValue {
247
271
  /** Type of identifier */
@@ -450,6 +474,34 @@ export interface SkedyulConfig {
450
474
  * ```
451
475
  */
452
476
  models?: ModelDefinition[];
477
+ /**
478
+ * Relationships between models.
479
+ * Defines bidirectional links between INTERNAL models.
480
+ * Creates relationship fields on both sides automatically.
481
+ *
482
+ * @example
483
+ * ```typescript
484
+ * relationships: [
485
+ * {
486
+ * source: {
487
+ * model: 'phone_number',
488
+ * field: 'compliance_record',
489
+ * label: 'Compliance Record',
490
+ * cardinality: 'MANY_TO_ONE',
491
+ * onDelete: 'RESTRICT',
492
+ * },
493
+ * target: {
494
+ * model: 'compliance_record',
495
+ * field: 'phone_numbers',
496
+ * label: 'Phone Numbers',
497
+ * cardinality: 'ONE_TO_MANY',
498
+ * onDelete: 'NONE',
499
+ * },
500
+ * },
501
+ * ]
502
+ * ```
503
+ */
504
+ relationships?: RelationshipDefinition[];
453
505
  /**
454
506
  * Communication channels this app provides (new syntax).
455
507
  * Uses typed `requires` for dependencies.
package/dist/schemas.d.ts CHANGED
@@ -361,6 +361,81 @@ export declare const FieldOptionSchema: z.ZodObject<{
361
361
  value: z.ZodString;
362
362
  color: z.ZodOptional<z.ZodString>;
363
363
  }, z.core.$strip>;
364
+ /**
365
+ * Schema for relationship cardinality.
366
+ * Defines how many records can be linked on each side.
367
+ */
368
+ export declare const RelationshipCardinalitySchema: z.ZodEnum<{
369
+ ONE_TO_ONE: "ONE_TO_ONE";
370
+ ONE_TO_MANY: "ONE_TO_MANY";
371
+ MANY_TO_ONE: "MANY_TO_ONE";
372
+ MANY_TO_MANY: "MANY_TO_MANY";
373
+ }>;
374
+ /**
375
+ * Schema for on-delete behavior in relationships.
376
+ */
377
+ export declare const OnDeleteBehaviorSchema: z.ZodEnum<{
378
+ NONE: "NONE";
379
+ CASCADE: "CASCADE";
380
+ RESTRICT: "RESTRICT";
381
+ }>;
382
+ /**
383
+ * Schema for a relationship link (one side of a relationship).
384
+ */
385
+ export declare const RelationshipLinkSchema: z.ZodObject<{
386
+ model: z.ZodString;
387
+ field: z.ZodString;
388
+ label: z.ZodString;
389
+ cardinality: z.ZodEnum<{
390
+ ONE_TO_ONE: "ONE_TO_ONE";
391
+ ONE_TO_MANY: "ONE_TO_MANY";
392
+ MANY_TO_ONE: "MANY_TO_ONE";
393
+ MANY_TO_MANY: "MANY_TO_MANY";
394
+ }>;
395
+ onDelete: z.ZodDefault<z.ZodEnum<{
396
+ NONE: "NONE";
397
+ CASCADE: "CASCADE";
398
+ RESTRICT: "RESTRICT";
399
+ }>>;
400
+ }, z.core.$strip>;
401
+ /**
402
+ * Schema for a relationship definition.
403
+ * Relationships are bidirectional - they define links from both sides.
404
+ */
405
+ export declare const RelationshipDefinitionSchema: z.ZodObject<{
406
+ source: z.ZodObject<{
407
+ model: z.ZodString;
408
+ field: z.ZodString;
409
+ label: z.ZodString;
410
+ cardinality: z.ZodEnum<{
411
+ ONE_TO_ONE: "ONE_TO_ONE";
412
+ ONE_TO_MANY: "ONE_TO_MANY";
413
+ MANY_TO_ONE: "MANY_TO_ONE";
414
+ MANY_TO_MANY: "MANY_TO_MANY";
415
+ }>;
416
+ onDelete: z.ZodDefault<z.ZodEnum<{
417
+ NONE: "NONE";
418
+ CASCADE: "CASCADE";
419
+ RESTRICT: "RESTRICT";
420
+ }>>;
421
+ }, z.core.$strip>;
422
+ target: z.ZodObject<{
423
+ model: z.ZodString;
424
+ field: z.ZodString;
425
+ label: z.ZodString;
426
+ cardinality: z.ZodEnum<{
427
+ ONE_TO_ONE: "ONE_TO_ONE";
428
+ ONE_TO_MANY: "ONE_TO_MANY";
429
+ MANY_TO_ONE: "MANY_TO_ONE";
430
+ MANY_TO_MANY: "MANY_TO_MANY";
431
+ }>;
432
+ onDelete: z.ZodDefault<z.ZodEnum<{
433
+ NONE: "NONE";
434
+ CASCADE: "CASCADE";
435
+ RESTRICT: "RESTRICT";
436
+ }>>;
437
+ }, z.core.$strip>;
438
+ }, z.core.$strip>;
364
439
  /**
365
440
  * Schema for inline field definition (constraints, options, etc.)
366
441
  * This allows defining field behavior without referencing a metafield definition.
@@ -376,7 +451,6 @@ export declare const InlineFieldDefinitionSchema: z.ZodObject<{
376
451
  maxLength: z.ZodOptional<z.ZodNumber>;
377
452
  min: z.ZodOptional<z.ZodNumber>;
378
453
  max: z.ZodOptional<z.ZodNumber>;
379
- relatedModel: z.ZodOptional<z.ZodString>;
380
454
  pattern: z.ZodOptional<z.ZodString>;
381
455
  }, z.core.$strip>;
382
456
  /**
@@ -411,7 +485,6 @@ export declare const ModelFieldDefinitionSchema: z.ZodObject<{
411
485
  maxLength: z.ZodOptional<z.ZodNumber>;
412
486
  min: z.ZodOptional<z.ZodNumber>;
413
487
  max: z.ZodOptional<z.ZodNumber>;
414
- relatedModel: z.ZodOptional<z.ZodString>;
415
488
  pattern: z.ZodOptional<z.ZodString>;
416
489
  }, z.core.$strip>>;
417
490
  required: z.ZodOptional<z.ZodBoolean>;
@@ -475,7 +548,6 @@ export declare const ModelDefinitionSchema: z.ZodObject<{
475
548
  maxLength: z.ZodOptional<z.ZodNumber>;
476
549
  min: z.ZodOptional<z.ZodNumber>;
477
550
  max: z.ZodOptional<z.ZodNumber>;
478
- relatedModel: z.ZodOptional<z.ZodString>;
479
551
  pattern: z.ZodOptional<z.ZodString>;
480
552
  }, z.core.$strip>>;
481
553
  required: z.ZodOptional<z.ZodBoolean>;
@@ -700,7 +772,6 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
700
772
  maxLength: z.ZodOptional<z.ZodNumber>;
701
773
  min: z.ZodOptional<z.ZodNumber>;
702
774
  max: z.ZodOptional<z.ZodNumber>;
703
- relatedModel: z.ZodOptional<z.ZodString>;
704
775
  pattern: z.ZodOptional<z.ZodString>;
705
776
  }, z.core.$strip>>;
706
777
  required: z.ZodOptional<z.ZodBoolean>;
@@ -732,6 +803,40 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
732
803
  workflow: z.ZodString;
733
804
  }, z.core.$strip>]>>>;
734
805
  }, z.core.$strip>>>;
806
+ relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
807
+ source: z.ZodObject<{
808
+ model: z.ZodString;
809
+ field: z.ZodString;
810
+ label: z.ZodString;
811
+ cardinality: z.ZodEnum<{
812
+ ONE_TO_ONE: "ONE_TO_ONE";
813
+ ONE_TO_MANY: "ONE_TO_MANY";
814
+ MANY_TO_ONE: "MANY_TO_ONE";
815
+ MANY_TO_MANY: "MANY_TO_MANY";
816
+ }>;
817
+ onDelete: z.ZodDefault<z.ZodEnum<{
818
+ NONE: "NONE";
819
+ CASCADE: "CASCADE";
820
+ RESTRICT: "RESTRICT";
821
+ }>>;
822
+ }, z.core.$strip>;
823
+ target: z.ZodObject<{
824
+ model: z.ZodString;
825
+ field: z.ZodString;
826
+ label: z.ZodString;
827
+ cardinality: z.ZodEnum<{
828
+ ONE_TO_ONE: "ONE_TO_ONE";
829
+ ONE_TO_MANY: "ONE_TO_MANY";
830
+ MANY_TO_ONE: "MANY_TO_ONE";
831
+ MANY_TO_MANY: "MANY_TO_MANY";
832
+ }>;
833
+ onDelete: z.ZodDefault<z.ZodEnum<{
834
+ NONE: "NONE";
835
+ CASCADE: "CASCADE";
836
+ RESTRICT: "RESTRICT";
837
+ }>>;
838
+ }, z.core.$strip>;
839
+ }, z.core.$strip>>>;
735
840
  channels: z.ZodOptional<z.ZodArray<z.ZodObject<{
736
841
  handle: z.ZodString;
737
842
  name: z.ZodString;
@@ -900,6 +1005,14 @@ export type StructuredFilter = z.infer<typeof StructuredFilterSchema>;
900
1005
  export type FieldOption = z.infer<typeof FieldOptionSchema>;
901
1006
  /** Inline field definition (constraints, options, etc.) */
902
1007
  export type InlineFieldDefinition = z.infer<typeof InlineFieldDefinitionSchema>;
1008
+ /** Relationship cardinality type */
1009
+ export type RelationshipCardinality = z.infer<typeof RelationshipCardinalitySchema>;
1010
+ /** On-delete behavior type */
1011
+ export type OnDeleteBehavior = z.infer<typeof OnDeleteBehaviorSchema>;
1012
+ /** Relationship link (one side of a relationship) */
1013
+ export type RelationshipLink = z.infer<typeof RelationshipLinkSchema>;
1014
+ /** Relationship definition */
1015
+ export type RelationshipDefinition = z.infer<typeof RelationshipDefinitionSchema>;
903
1016
  /** Model dependency reference */
904
1017
  export type ModelDependency = z.infer<typeof ModelDependencySchema>;
905
1018
  /** 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.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;
3
+ exports.SkedyulConfigSchema = exports.InternalModelDefinitionSchema = exports.InternalFieldDefinitionSchema = exports.InternalFieldDataTypeSchema = exports.ModelDefinitionSchema = exports.ModelFieldDefinitionSchema = exports.InlineFieldDefinitionSchema = exports.RelationshipDefinitionSchema = exports.RelationshipLinkSchema = exports.OnDeleteBehaviorSchema = exports.RelationshipCardinalitySchema = 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;
@@ -245,6 +245,49 @@ exports.FieldOptionSchema = zod_1.z.object({
245
245
  /** Optional color for UI display */
246
246
  color: zod_1.z.string().optional(),
247
247
  });
248
+ /**
249
+ * Schema for relationship cardinality.
250
+ * Defines how many records can be linked on each side.
251
+ */
252
+ exports.RelationshipCardinalitySchema = zod_1.z.enum([
253
+ 'ONE_TO_ONE',
254
+ 'ONE_TO_MANY',
255
+ 'MANY_TO_ONE',
256
+ 'MANY_TO_MANY',
257
+ ]);
258
+ /**
259
+ * Schema for on-delete behavior in relationships.
260
+ */
261
+ exports.OnDeleteBehaviorSchema = zod_1.z.enum([
262
+ 'NONE', // No action
263
+ 'CASCADE', // Delete related records
264
+ 'RESTRICT', // Prevent deletion
265
+ ]);
266
+ /**
267
+ * Schema for a relationship link (one side of a relationship).
268
+ */
269
+ exports.RelationshipLinkSchema = zod_1.z.object({
270
+ /** Model handle for this side of the relationship */
271
+ model: zod_1.z.string(),
272
+ /** Field handle on this model */
273
+ field: zod_1.z.string(),
274
+ /** Field label for display */
275
+ label: zod_1.z.string(),
276
+ /** Cardinality from this side */
277
+ cardinality: exports.RelationshipCardinalitySchema,
278
+ /** On-delete behavior */
279
+ onDelete: exports.OnDeleteBehaviorSchema.default('NONE'),
280
+ });
281
+ /**
282
+ * Schema for a relationship definition.
283
+ * Relationships are bidirectional - they define links from both sides.
284
+ */
285
+ exports.RelationshipDefinitionSchema = zod_1.z.object({
286
+ /** Source side of the relationship */
287
+ source: exports.RelationshipLinkSchema,
288
+ /** Target side of the relationship */
289
+ target: exports.RelationshipLinkSchema,
290
+ });
248
291
  /**
249
292
  * Schema for inline field definition (constraints, options, etc.)
250
293
  * This allows defining field behavior without referencing a metafield definition.
@@ -262,8 +305,6 @@ exports.InlineFieldDefinitionSchema = zod_1.z.object({
262
305
  min: zod_1.z.number().optional(),
263
306
  /** For number fields: max value */
264
307
  max: zod_1.z.number().optional(),
265
- /** For relation fields: target model handle */
266
- relatedModel: zod_1.z.string().optional(),
267
308
  /** Validation regex pattern */
268
309
  pattern: zod_1.z.string().optional(),
269
310
  });
@@ -385,6 +426,8 @@ exports.SkedyulConfigSchema = zod_1.z.object({
385
426
  .optional(),
386
427
  // New unified model definitions (INTERNAL + SHARED)
387
428
  models: zod_1.z.array(exports.ModelDefinitionSchema).optional(),
429
+ // Relationships between models
430
+ relationships: zod_1.z.array(exports.RelationshipDefinitionSchema).optional(),
388
431
  // New channel syntax (alias for communicationChannels)
389
432
  channels: zod_1.z.array(exports.ChannelDefinitionSchema).optional(),
390
433
  // Legacy: communication channels (deprecated - use channels)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",