@diagonal-hq/cli 0.14.2 → 0.15.1

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.
Files changed (4) hide show
  1. package/README.md +32 -16
  2. package/dist/cli.mjs +6306 -5344
  3. package/dist/index.d.ts +48 -27
  4. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -543,14 +543,22 @@ export type WorkflowConfig =
543
543
  */
544
544
  export type LiquidSource = string | { readonly file: `./${string}.liquid` };
545
545
 
546
- /** The key of a notification type. */
547
- export type NotificationTypeReference = string;
546
+ /**
547
+ * The slug of a notification type, template, or email layout: a
548
+ * {@link DefinitionSlug} of at most 64 characters, for example
549
+ * `'member-welcome'`. Other files refer to the definition by its slug. A slug
550
+ * change keeps the `uid`, so the deploy updates the same row.
551
+ */
552
+ export type NotificationSlug = DefinitionSlug;
553
+
554
+ /** The slug of a notification type. */
555
+ export type NotificationTypeReference = NotificationSlug;
548
556
 
549
- /** The key of a template, unique within its notification type. */
550
- export type NotificationTemplateReference = string;
557
+ /** The slug of a template of the notification type. */
558
+ export type NotificationTemplateReference = NotificationSlug;
551
559
 
552
- /** The key of an email layout, or `'default'` for the built-in layout. */
553
- export type EmailLayoutReference = string;
560
+ /** The slug of an email layout, or `'default'` for the built-in layout. */
561
+ export type EmailLayoutReference = NotificationSlug;
554
562
 
555
563
  /** A variable whose value is one record. The sender passes the record id. */
556
564
  export type RecordVariableDefinition = {
@@ -570,13 +578,14 @@ export type NotificationVariableDefinition =
570
578
  | FieldDefinition<Exclude<FieldType, 'relation'>>
571
579
  | RecordVariableDefinition;
572
580
 
573
- /** A `notifications/<key>/type.ts` file. `diagonal check` writes a missing `uid`. */
581
+ /**
582
+ * A notification type. The build reads it only from a
583
+ * `notifications/<folder>/type.ts` file. `diagonal check` writes a missing
584
+ * `uid`.
585
+ */
574
586
  export type NotificationTypeDefinition = UidOption & {
575
- /**
576
- * Lowercase letters, digits, and hyphens, for example `'member-welcome'`.
577
- * Templates, fixtures, and workflows refer to it. Moving the file keeps it.
578
- */
579
- key: string;
587
+ /** Unique in the workspace. Templates, fixtures, and workflows refer to it. */
588
+ slug: NotificationSlug;
580
589
  name: string;
581
590
  /**
582
591
  * The resource that receives the notification. The resource maps the email
@@ -591,12 +600,20 @@ export declare function defineNotificationType<const T extends NotificationTypeD
591
600
  type: T
592
601
  ): T;
593
602
 
594
- export type NotificationReference = {
595
- label: string;
596
- /** The server generator, for example `'page.url'` or `'workspace.login_url'`. */
597
- generator: string;
598
- settings?: { readonly [setting: string]: StaticValue };
599
- };
603
+ /**
604
+ * A server generator that a template reads as `{{ ref.<key> }}`. A file can
605
+ * deploy `date.current`, `time.current`, and `workspace.login_url`. The
606
+ * `page.url`, `workflow.url`, and `calendar.generate_link` generators of the
607
+ * template editor cannot be deployed from a file yet.
608
+ */
609
+ export type NotificationReference =
610
+ | { label: string; generator: 'date.current' | 'time.current' }
611
+ | {
612
+ label: string;
613
+ generator: 'workspace.login_url';
614
+ /** The resource whose members sign in, as `Resources.<Name>.slug`. */
615
+ settings: { resource: ResourceReference };
616
+ };
600
617
 
601
618
  export type NotificationTemplateEmail = {
602
619
  subject: string;
@@ -609,12 +626,14 @@ export type NotificationTemplateEmail = {
609
626
  export type NotificationTemplateSms = { body: LiquidSource };
610
627
 
611
628
  /**
612
- * A `notifications/<type key>/<key>.template.ts` file. A template has an email, an SMS, or both.
613
- * `diagonal check` writes a missing `uid`.
629
+ * A template. The build reads it only from a
630
+ * `notifications/<folder>/<name>.template.ts` file. A template has an email,
631
+ * an SMS, or both. `diagonal check` writes a missing `uid`.
614
632
  */
615
633
  export type NotificationTemplateDefinition = UidOption & {
616
634
  /** Unique within its type, for example `'standard'`. */
617
- key: string;
635
+ slug: NotificationSlug;
636
+ /** The type of the template. A template cannot move to another type: give the moved template a new uid. */
618
637
  type: NotificationTypeReference;
619
638
  name: string;
620
639
  /** Generators that the template reads as `{{ ref.<key> }}`. */
@@ -635,13 +654,15 @@ export type EmailLayoutFieldDefinition = {
635
654
  required?: boolean;
636
655
  };
637
656
 
638
- /** An `email-layouts/<key>/layout.ts` file. `diagonal check` writes a missing `uid`. */
657
+ /**
658
+ * An email layout. The build reads it only from an
659
+ * `email-layouts/<folder>/layout.ts` file. `diagonal check` writes a missing
660
+ * `uid`.
661
+ */
639
662
  export type EmailLayoutDefinition = UidOption & {
640
- /**
641
- * Lowercase letters, digits, and hyphens, for example `'standard'`. Templates
642
- * refer to it. `'default'` is the built-in layout.
643
- */
644
- key: string;
663
+ /** Unique in the workspace. Templates refer to it. It cannot be `'default'`, the built-in layout. */
664
+ slug: NotificationSlug;
665
+ /** Unique among the workspace's email layouts, also those made in the app. */
645
666
  name: string;
646
667
  body: LiquidSource;
647
668
  /** The fields that each template fills in. The body reads them as `{{ <field> }}`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.14.2",
3
+ "version": "0.15.1",
4
4
  "description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {