@diagonal-hq/cli 0.37.3 → 0.37.5

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 CHANGED
@@ -549,7 +549,7 @@ email-layouts/
549
549
  default.json
550
550
  ```
551
551
 
552
- The type sets the recipient resource, the variables, and the default template. The recipient resource maps the email and phone fields. A type without `recipient` sends to email addresses. `recipient.relations` lists the relation paths from the recipient resource whose records a send loads with the recipient. Templates read them below `record`, for example `{{ record.account.name }}`. A variable uses a `field` builder other than `field.relation`, or `{ resource }` for one record of a resource. Templates read a record variable's fields, for example `{{ first_event.name }}`.
552
+ The type sets the recipient resource, the variables, and the default template. The recipient resource maps the email and phone fields. A type without `recipient` sends to email addresses. `recipient.relations` lists the relation paths from the recipient resource whose records a send loads with the recipient. Templates read them below `record`, for example `{{ record.account.name }}`. A variable uses a `field` builder other than `field.relation`, or `{ resource }` for one record of a resource. Templates read a record variable's fields, for example `{{ first_event.name }}`. A record variable's `relations` lists the relation paths from its resource whose records a send loads with the record, and templates read them below the variable, for example `{{ first_event.venue.name }}`.
553
553
 
554
554
  ```ts
555
555
  import { NotificationTypes } from '@app/generated/notification-types';
@@ -562,7 +562,7 @@ export default defineNotificationType({
562
562
  recipient: { resource: Resources.Members.slug, relations: ['account'] },
563
563
  variables: {
564
564
  joined_on: field.date({ label: 'Joined on', required: true }),
565
- first_event: { resource: Resources.Events.slug, label: 'First event' }
565
+ first_event: { resource: Resources.Events.slug, relations: ['venue'], label: 'First event' }
566
566
  },
567
567
  defaultTemplate: NotificationTypes.MemberWelcome.templates.Standard.uid
568
568
  });
@@ -770,7 +770,7 @@ The editor checks the shape of each definition. `diagonal check` and the build a
770
770
  - Each type, template, and layout has a `uid` and a slug of at most 64 characters: its `slug` option, or the name of its folder or file. Each schedule has a `uid`. No two definitions of one kind have the same uid or the same slug, and no two templates of one type have the same slug. No two layouts have the same name. A `name` has 1 to 255 characters.
771
771
  - A `{ file }` Liquid source names a `.liquid` file in the folder of the definition, and the file exists.
772
772
  - A type's `recipient` resource and the resource of each record variable are resources of the workspace. A type has at most 100 variables. A variable key starts with a letter or `_` and has only letters, digits, and `_`. A variable cannot be named `record` or `ref`: templates read the recipient as `{{ record.* }}` and the generators as `{{ ref.* }}`. A variable is a value that the sender passes, so a `field` builder cannot have `default`, `unique`, `index`, `guard`, `computed`, `getter`, `setter`, or `setterWhenEmpty`.
773
- - Each path in a type's `recipient.relations` follows relation fields from the recipient resource, for example `'account'` or `'account.owner'`. A path has at most 5 relations and passes through a resource only once; only its last relation can return to a resource that the path already reached. A type has at most 100 paths, and no path twice.
773
+ - Each path in a type's `recipient.relations` follows relation fields from the recipient resource, for example `'account'` or `'account.owner'`. Each path in a record variable's `relations` follows relation fields from the variable's resource in the same way. A path has at most 5 relations and passes through a resource only once; only its last relation can return to a resource that the path already reached. Each list has at most 100 paths, and no path twice.
774
774
  - A type's `recipient` resource declares the Notifiable capability. When a template of the type has an email, the resource maps `email_field`. When a template has an SMS, the resource maps `phone_field`. The resource check makes sure that `email_field` names an `email` field and `phone_field` names a `phone` or `text` field.
775
775
  - A type has at least one template, and its `defaultTemplate` names one of them.
776
776
  - A template's folder has a `type.ts`. A template has no `type`. A template has an email, an SMS, or both. An email `subject` has 1 to 10,000 characters. `email.layout` names a layout of the workspace files, or `'default'`. An email's `fields` match the fields of its layout and fill each required field. A layout field key differs from `record` and from each variable key of the template's type. The built-in layout has the field `content`. An SMS `body` is not empty.
@@ -792,7 +792,7 @@ A deploy writes each type, template, layout, and schedule into the workspace, ma
792
792
  These rules need server data, so the check does not check them yet:
793
793
 
794
794
  - A built-in `recipient` resource can receive notifications.
795
- - The relation paths of `recipient.relations` past a built-in resource. A send checks them.
795
+ - The relation paths of `recipient.relations` and of a record variable's `relations` past a built-in resource. A send checks them.
796
796
  - The fields of a built-in resource. The deploy checks them.
797
797
  - The field paths of a schedule's `filters`. The deploy does not check them either: a filter that names a field that does not exist deploys.
798
798