@diagonal-hq/cli 0.41.4 → 0.41.6
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 +47 -8
- package/dist/check-data.json +1 -1
- package/dist/{cli-assets-cli-FMLE5XEF.mjs → cli-assets-cli-WEGERBBR.mjs} +8 -134
- package/dist/{cli-check-data-PQDHTVM6.mjs → cli-check-data-7TKAM34J.mjs} +152 -2259
- package/dist/cli-chunk-25JQRNTW.mjs +24138 -0
- package/dist/{cli-chunk-U2ET6LQJ.mjs → cli-chunk-3SEADNVJ.mjs} +153 -1
- package/dist/{cli-chunk-TEV2VFGB.mjs → cli-chunk-77DCVFIZ.mjs} +7 -23955
- package/dist/{cli-chunk-4FQYK2WG.mjs → cli-chunk-ES45EAOO.mjs} +4 -1
- package/dist/{cli-skill-file-26B4RRZZ.mjs → cli-chunk-KZOQCV4Y.mjs} +7 -8
- package/dist/{cli-chunk-2YX3ABIW.mjs → cli-chunk-NEXRHJ3X.mjs} +1500 -44
- package/dist/{cli-chunk-XMVYLKEB.mjs → cli-chunk-TDGR3ENO.mjs} +278 -1
- package/dist/cli-chunk-XO3FRXQ4.mjs +3200 -0
- package/dist/{cli-chunk-GCF6XYTF.mjs → cli-chunk-XQQBHS6I.mjs} +18 -2
- package/dist/cli-skill-file-XEFKCU5Y.mjs +27 -0
- package/dist/{cli-workflows-YLHANSO2.mjs → cli-workflows-VFKTQW7H.mjs} +14 -18
- package/dist/cli.mjs +10361 -99
- package/dist/index.d.ts +55 -15
- package/dist/sdk-contract.d.ts +4 -1
- package/package.json +4 -4
- package/dist/cli-chunk-C3LVTOK3.mjs +0 -1054
- package/dist/cli-chunk-WPC3DBHX.mjs +0 -52
package/README.md
CHANGED
|
@@ -259,6 +259,25 @@ export default defineConfig({
|
|
|
259
259
|
- `domains` declares the domains of the workspace, and `primaryDomain` names the one that is primary. See [Domains](#domains).
|
|
260
260
|
- `defaultMenu` names the default menu as `Menus.<Name>.uid` from `@app/generated/navigation`, such as `defaultMenu: Menus.Main.uid` for `navigation/main.ts`. The name is the studly case of the file name, so `navigation/front-desk-team.ts` is `Menus.FrontDeskTeam`. `diagonal check` writes `generated/navigation.ts`, which exports `Menus` and exports the default menu as `defaultMenu`, or an empty menu without `defaultMenu`. A layout that imports `defaultMenu` from `@app/generated/navigation` and passes it to `useMenu` shows the default menu. A sign-in without a login redirect lands on the first page of the default menu that the visitor can open. The check refuses an unknown name, a value that is not a uid, and a uid that no menu file exports. **Set as Default Menu** on the Navigation settings page commits this option and deploys it.
|
|
261
261
|
|
|
262
|
+
### Installed package configuration
|
|
263
|
+
|
|
264
|
+
The optional `packages` object in `defineConfig` holds this workspace's choices for all installed packages. Each key is the dependency's npm name. Each package entry maps its input identities (`kind:uid`) to a selected source UID, a `{ value: ... }` choice, or an opaque `{ secret: ... }` revision. Actual passwords stay in encrypted workspace storage.
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
export default defineConfig({
|
|
268
|
+
name: 'Northstar Association',
|
|
269
|
+
packages: {
|
|
270
|
+
'@northstar/member-kit': {
|
|
271
|
+
'workspace_field:019a5b1e-2c3d-7e4f-8a9b-0c1d2e3f4f01': {
|
|
272
|
+
value: 'Welcome to Northstar'
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Omitted value choices follow the package release's defaults. Required mappings and credentials must be supplied. An explicit `{ value: null }` clears a value. An explicit `{ secret: null }` clears a credential. Install, update, and removal save package choices with dependency changes in one commit. An unsuccessful build or a stale form preserves the previous source and active values. Removing the last package choice removes only `packages`; other workspace configuration stays intact. The config file does not ship in a package release. See [Package inputs](../../app/packages/README.md#file-based-packages).
|
|
280
|
+
|
|
262
281
|
### Domains
|
|
263
282
|
|
|
264
283
|
- Each key of `domains` starts with a lowercase letter, contains only letters and digits, and has at most 64 characters. A declaration is `{}` or `{ fallback: 'primary' }`. With `fallback: 'primary'`, the routes of the domain serve on the primary hostname while the domain has no active hostname. The check refuses any other value or option, and `fallback` on the primary domain, at its line.
|
|
@@ -344,7 +363,7 @@ export default defineWorkspaceField({
|
|
|
344
363
|
- `key` is the field key. It is optional: without it, the file name without `.ts` is the key. The build uses the file name as it is: `support-email.ts` does not give the key `support_email`. A key starts with a lowercase letter and contains only a-z, 0-9, and `_`. It cannot be the key of a built-in setting, such as `name` or `website`, or a record key, such as `id`. The file name gives the `WorkspaceFields` name, so it follows the same rule. The check reports a file name that breaks the rule at the file, and a `key` that breaks it at the `key`. A workspace field has no `slug` option: use `key`.
|
|
345
364
|
- The build reads only the `.ts` files directly in `workspace-fields/`. It reports any other file in the folder.
|
|
346
365
|
- `definition` is a `field.<type>({...})` builder. A workspace field takes `label`, `description`, `required`, `guard`, and `settings`. It cannot be a `relation`, and the builder has no `uid`, `unique`, `index`, `computed`, `getter`, or `setter`.
|
|
347
|
-
- `value` is the value of the field. It is required: write `null` for a field without a value. The type of `value` follows the field type.
|
|
366
|
+
- `value` is the value of the field. It is required: write `null` for a field without a value. The type of `value` follows the field type. For workspace-owned fields, the file owns the value. Installed package definitions remain publisher-owned. Saved destination values use `diagonal.config.ts.packages`; an absent choice follows the release value. See [Package inputs](../../app/packages/README.md#file-based-packages).
|
|
348
367
|
- The build does not use `default`. A `default` in `definition` gives a warning at the `default`, and the field takes its value from `value`.
|
|
349
368
|
- The check refuses a value that does not match its definition at the line of the value. The deploy checks each literal value again with the `guard` rules of the field.
|
|
350
369
|
- A value can contain `RecordBindings.<Name>.reference` from `@app/generated/record-bindings`, for example as the value of a UUID field. The deploy stores the reference and does not check it with the `guard` rules. Each read resolves the reference to the record that the workspace selects, and then checks the resolved value with the `guard` rules. A missing selection, a missing or archived record, or a failed guard rule gives a setup error when a page or workflow reads that field. The other fields stay available.
|
|
@@ -352,7 +371,7 @@ export default defineWorkspaceField({
|
|
|
352
371
|
- A removed file archives its field on the next deploy, and a file with the same uid restores it. A field that something still uses, such as a workflow, stops the deploy with the message of the entity graph.
|
|
353
372
|
- A deploy refuses a field without a `uid`. Run `diagonal check` to write one.
|
|
354
373
|
- A new field takes its place in the byte order of the file names. A deploy does not reorder the fields that the workspace already has.
|
|
355
|
-
- The files own every custom workspace field. A deploy archives each custom field that no file declares, and never writes a built-in field.
|
|
374
|
+
- The files own every custom workspace field. A deploy archives each custom field that no file declares, and never writes a built-in field. Supported admin, API, and AI field edits commit and deploy source changes. Workspace-owned definitions and values use their `workspace-fields/` files. Installed package definitions remain publisher-owned; these editors can change only their destination values, through `diagonal.config.ts.packages`.
|
|
356
375
|
- `diagonal.config.ts` has no `workspaceFields` option. The check refuses it and names the `workspace-fields/` folder.
|
|
357
376
|
|
|
358
377
|
### WorkspaceFields
|
|
@@ -667,10 +686,14 @@ export default defineNotificationTemplate({
|
|
|
667
686
|
|
|
668
687
|
The deploy stores each reference as the template editor stores it, so a send renders the same link. The page id of a page file is its uid, and the workflow id comes from the active deployment.
|
|
669
688
|
|
|
670
|
-
An email layout is the frame that templates fill in. Each field is a slot that a template fills
|
|
689
|
+
An email layout is the frame that templates fill in. Each field is a slot that a template fills.
|
|
690
|
+
|
|
691
|
+
- An object, `{ label, description?, required? }`, declares a Liquid field. A template fills it with Liquid.
|
|
692
|
+
- A `field.<type>({...})` call declares a field with a type and the settings of the type, as a variable of a notification type does. It takes `label`, `description`, `required`, and the settings of the type. It cannot be a `field.relation` or a `field.liquid`, and it has none of the options of a stored field: `default`, `guard`, `unique`, `index`, `computed`, `getter`, `setter`, and `setterWhenEmpty`.
|
|
693
|
+
- An object with a `type` of `'text'`, `'url'`, `'email'`, or `'phone'` declares the same field as the call of that type without settings.
|
|
671
694
|
|
|
672
695
|
```ts
|
|
673
|
-
import { defineEmailLayout } from '@diagonal-hq/cli';
|
|
696
|
+
import { defineEmailLayout, field } from '@diagonal-hq/cli';
|
|
674
697
|
|
|
675
698
|
export default defineEmailLayout({
|
|
676
699
|
uid: '019a4d6e-5b2c-7d3e-9f4a-7b8c9d0e1f2a',
|
|
@@ -679,12 +702,26 @@ export default defineEmailLayout({
|
|
|
679
702
|
fields: {
|
|
680
703
|
heading: { label: 'Heading', required: true },
|
|
681
704
|
body: { label: 'Body', required: true },
|
|
682
|
-
action_url: { label: 'Action URL'
|
|
705
|
+
action_url: field.url({ label: 'Action URL' }),
|
|
706
|
+
show_banner: field.boolean({ label: 'Show banner' }),
|
|
707
|
+
button_style: field.select({
|
|
708
|
+
label: 'Button style',
|
|
709
|
+
options: [
|
|
710
|
+
{ label: 'Primary', value: 'primary' },
|
|
711
|
+
{ label: 'Outline', value: 'outline' }
|
|
712
|
+
]
|
|
713
|
+
})
|
|
683
714
|
}
|
|
684
715
|
});
|
|
685
716
|
```
|
|
686
717
|
|
|
687
|
-
|
|
718
|
+
The layout body reads each field by its key. A typed value keeps its type, so the body can test it, such as `{% if show_banner %}`.
|
|
719
|
+
|
|
720
|
+
A template gives each field a value in one of three forms:
|
|
721
|
+
|
|
722
|
+
- **Liquid text**, for a Liquid field and for a `text`, `url`, `email`, or `phone` field. The send renders the text. It checks the result of a typed field against the type.
|
|
723
|
+
- **`{ value: <value> }`**, for a field of any other type. Such a field renders no Liquid, so the value is a literal: a string, a number, `true`, `false`, `null`, a list, or an object. The hosted build checks the value against the type, the required rule, and the settings of the field, and fails the build at the template file when the value is not valid. For example, a value that is not an option of a select field fails the build. `diagonal check` checks only the form.
|
|
724
|
+
- **`{ variable: '<path>' }`**, for any field with a type. The send reads the value at the path and checks it against the type of the field. It does not render the value as Liquid.
|
|
688
725
|
|
|
689
726
|
```ts
|
|
690
727
|
email: {
|
|
@@ -693,7 +730,9 @@ email: {
|
|
|
693
730
|
fields: {
|
|
694
731
|
heading: 'Thank you for your payment',
|
|
695
732
|
body: { file: './receipt.email.liquid' },
|
|
696
|
-
action_url: { variable: 'invoice_url' }
|
|
733
|
+
action_url: { variable: 'invoice_url' },
|
|
734
|
+
show_banner: { value: true },
|
|
735
|
+
button_style: { value: 'outline' }
|
|
697
736
|
}
|
|
698
737
|
}
|
|
699
738
|
```
|
|
@@ -805,7 +844,7 @@ The editor checks the shape of each definition. `diagonal check` and the build a
|
|
|
805
844
|
- 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.
|
|
806
845
|
- 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.
|
|
807
846
|
- A type has at least one template, and its `defaultTemplate` names one of them.
|
|
808
|
-
- 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. Only a field with a
|
|
847
|
+
- 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 `{ value: null }` does not fill a required field. A Liquid, `text`, `url`, `email`, or `phone` field takes Liquid text, and a field of another type takes `{ value }`. Only a field with a type takes `{ variable }`, and the first segment of its path is a variable of the type, `record` when the type has a `recipient`, or `workspace`. A `text` or `url` field can also read `ref.<key>` of a `page.url` reference of the template. 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.
|
|
809
848
|
- A template has at most 50 references. A reference key starts with a lowercase letter, has only a-z, 0-9, and `_`, and has at most 64 characters. A label has at most 255 characters.
|
|
810
849
|
- A `page.url` or `workflow.url` reference names a page or a workflow of the workspace. An unknown `Pages` or `Workflows` name is an error at its line and column. `params` has a value for each required route parameter of the page or workflow and no other name. A `workflow.url` workflow has a `request` trigger. A `calendar.generate_link` resource has the `eventable` capability. The first segment of a `{ variable }` path is a variable of the type, or `record` when the type has a `recipient`.
|
|
811
850
|
- A layout's slug and its folder name are not `default`, and its `body` is not empty. A layout field key starts with a letter or `_` and has only letters, digits, and `_`. Each field has a `label` of at most 255 characters. A field `type` is `'text'`, `'url'`, `'email'`, or `'phone'`. Leave it out for a Liquid field.
|