@diagonal-hq/cli 0.41.2 → 0.41.4

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.
@@ -7,7 +7,7 @@ import {
7
7
  importKind,
8
8
  isAuthoringModule,
9
9
  unsupportedImportMessage
10
- } from "./cli-chunk-A7Q2M4ZU.mjs";
10
+ } from "./cli-chunk-C3LVTOK3.mjs";
11
11
  import {
12
12
  __commonJS,
13
13
  __export,
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  SourceError,
5
5
  propertyKey
6
- } from "./cli-chunk-IUOUDHT2.mjs";
6
+ } from "./cli-chunk-2YX3ABIW.mjs";
7
7
  import {
8
8
  __commonJS,
9
9
  __require,
@@ -116,6 +116,7 @@ var PAGE_SDK_EXPORTS = Object.freeze({
116
116
  EmailMessages: ["Components", "EmailMessages"],
117
117
  EmptyState: ["Components", "EmptyState"],
118
118
  ErrorBoundary: ["Components", "ErrorBoundary"],
119
+ FilterPresets: ["Components", "FilterPresets"],
119
120
  ForgotPasswordForm: ["Components", "ForgotPasswordForm"],
120
121
  FormCheckbox: ["Components", "FormCheckbox"],
121
122
  FormCheckboxGroupInput: ["Components", "FormCheckboxGroupInput"],
@@ -247,6 +248,7 @@ var PAGE_SDK_EXPORTS = Object.freeze({
247
248
  useDataTable: ["hooks", "useDataTable"],
248
249
  useDeleteResourceRecord: ["hooks", "useDeleteResourceRecord"],
249
250
  useEmailMessages: ["hooks", "useEmailMessages"],
251
+ useFilterPresets: ["hooks", "useFilterPresets"],
250
252
  useForm: ["useForm"],
251
253
  useHoldScheduledNotification: ["hooks", "useHoldScheduledNotification"],
252
254
  useInfiniteRecords: ["hooks", "useInfiniteRecords"],
@@ -6,7 +6,7 @@ import {
6
6
  defaultExportOf,
7
7
  expectDefineCall,
8
8
  staticObject
9
- } from "./cli-chunk-IUOUDHT2.mjs";
9
+ } from "./cli-chunk-2YX3ABIW.mjs";
10
10
 
11
11
  // scripts/lib/runtime-build/assets.mjs
12
12
  var ASSET_KEY = /^[a-z][A-Za-z0-9]*$/;
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
3
3
  import {
4
4
  SourceError,
5
5
  parseSource
6
- } from "./cli-chunk-IUOUDHT2.mjs";
6
+ } from "./cli-chunk-2YX3ABIW.mjs";
7
7
  import {
8
8
  APP_PREFIX,
9
9
  AUTHORING_MODULE,
@@ -16,7 +16,7 @@ import {
16
16
  suggestedRelativeSpecifier,
17
17
  testSourceImportMessage,
18
18
  unsupportedImportMessage
19
- } from "./cli-chunk-A7Q2M4ZU.mjs";
19
+ } from "./cli-chunk-C3LVTOK3.mjs";
20
20
  import {
21
21
  __commonJS,
22
22
  __export,
@@ -4,17 +4,17 @@ import {
4
4
  frontMatterUidInsertion,
5
5
  readDefinitionUid,
6
6
  require_dist
7
- } from "./cli-chunk-54QINYR3.mjs";
7
+ } from "./cli-chunk-4FQYK2WG.mjs";
8
8
  import {
9
9
  SourceError,
10
10
  characterCount,
11
11
  diagnosticFromError
12
- } from "./cli-chunk-IUOUDHT2.mjs";
12
+ } from "./cli-chunk-2YX3ABIW.mjs";
13
13
  import {
14
14
  diagnostic,
15
15
  diagnosticAt,
16
16
  withoutDevInfix
17
- } from "./cli-chunk-A7Q2M4ZU.mjs";
17
+ } from "./cli-chunk-C3LVTOK3.mjs";
18
18
  import {
19
19
  __toESM
20
20
  } from "./cli-chunk-LRS5IEI3.mjs";
@@ -11,25 +11,25 @@ import {
11
11
  isAppSpecifier,
12
12
  resolveAppSpecifier,
13
13
  scriptSdkRuntimeFiles
14
- } from "./cli-chunk-L6DFO7SU.mjs";
14
+ } from "./cli-chunk-TEV2VFGB.mjs";
15
15
  import {
16
16
  PROFILES
17
17
  } from "./cli-chunk-WPC3DBHX.mjs";
18
- import "./cli-chunk-54QINYR3.mjs";
18
+ import "./cli-chunk-4FQYK2WG.mjs";
19
19
  import {
20
20
  GENERATED_ASSETS_PATH
21
- } from "./cli-chunk-7RZQ5V7O.mjs";
21
+ } from "./cli-chunk-GCF6XYTF.mjs";
22
22
  import {
23
23
  SourceError,
24
24
  childNodes,
25
25
  diagnosticFromError,
26
26
  parseSource
27
- } from "./cli-chunk-IUOUDHT2.mjs";
27
+ } from "./cli-chunk-2YX3ABIW.mjs";
28
28
  import {
29
29
  AUTHORING_MODULE,
30
30
  diagnostic,
31
31
  diagnosticAt
32
- } from "./cli-chunk-A7Q2M4ZU.mjs";
32
+ } from "./cli-chunk-C3LVTOK3.mjs";
33
33
  import "./cli-chunk-LRS5IEI3.mjs";
34
34
 
35
35
  // scripts/lib/runtime-build/workflows.mjs
package/dist/cli.mjs CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  resourceChildOf,
30
30
  sortDiagnostics,
31
31
  withoutDevInfix
32
- } from "./cli-chunk-A7Q2M4ZU.mjs";
32
+ } from "./cli-chunk-C3LVTOK3.mjs";
33
33
  import "./cli-chunk-LRS5IEI3.mjs";
34
34
 
35
35
  // scripts/lib/runtime-build/check-cli.mjs
@@ -613,7 +613,7 @@ async function checkSources() {
613
613
  if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
614
614
  return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
615
615
  }
616
- const { checkData, scriptSdk } = await import("./cli-check-data-NXPG2DJD.mjs");
616
+ const { checkData, scriptSdk } = await import("./cli-check-data-PQDHTVM6.mjs");
617
617
  return { data: checkData(), sdk: scriptSdk() };
618
618
  }
619
619
  function isScriptTestPath(path) {
@@ -633,8 +633,8 @@ function holdsSkills(root, plan) {
633
633
  async function checkCheckout(root, options) {
634
634
  const sources = await checkSources();
635
635
  const plan = composePackages(root);
636
- const testRunner = async () => (await import("./cli-workflows-46U7AJ2H.mjs")).runBuildTests;
637
- const skillReader = async () => (await import("./cli-skill-file-JUXNBWMU.mjs")).skillFrontMatter;
636
+ const testRunner = async () => (await import("./cli-workflows-YLHANSO2.mjs")).runBuildTests;
637
+ const skillReader = async () => (await import("./cli-skill-file-26B4RRZZ.mjs")).skillFrontMatter;
638
638
  const finish = (checkoutRoot, buildPlan, answer, runTests2) => {
639
639
  const run = hasScriptTests(answer) ? runTests2(checkoutRoot, answer.tests) : null;
640
640
  const diagnostics = finishedDiagnostics(withTestDiagnostics(answer, run), buildPlan);
@@ -719,9 +719,9 @@ async function main(argv, io) {
719
719
  case "assets": {
720
720
  const [subcommand, ...assetArgs] = args;
721
721
  if (subcommand === "upload")
722
- return (await import("./cli-assets-cli-L67BFKVC.mjs")).uploadAsset(assetArgs, io);
722
+ return (await import("./cli-assets-cli-FMLE5XEF.mjs")).uploadAsset(assetArgs, io);
723
723
  if (subcommand === "list")
724
- return (await import("./cli-assets-cli-L67BFKVC.mjs")).listAssets(assetArgs, io);
724
+ return (await import("./cli-assets-cli-FMLE5XEF.mjs")).listAssets(assetArgs, io);
725
725
  io.stderr.write(`${ASSETS_UPLOAD_USAGE}
726
726
  ${ASSETS_LIST_USAGE}
727
727
  `);
@@ -158,6 +158,7 @@ export type EventScheduleFieldSettings = CommonFieldSettings & {
158
158
  "show_on_creating"?: boolean | null;
159
159
  "show_on_updating"?: boolean | null;
160
160
  "placeholder"?: string | null;
161
+ "display_format"?: string | null;
161
162
  };
162
163
  };
163
164
 
@@ -188,6 +189,7 @@ export type ListFieldSettings = CommonFieldSettings & {
188
189
  "show_on_creating"?: boolean | null;
189
190
  "show_on_updating"?: boolean | null;
190
191
  "placeholder"?: string | null;
192
+ "options"?: readonly { label: string; value: string; color?: string | null }[] | null;
191
193
  };
192
194
  };
193
195
 
@@ -232,6 +234,7 @@ export type NumberFieldSettings = CommonFieldSettings & {
232
234
  "show_on_creating"?: boolean | null;
233
235
  "show_on_updating"?: boolean | null;
234
236
  "placeholder"?: string | null;
237
+ "display_format"?: string | null;
235
238
  };
236
239
  };
237
240
 
@@ -279,11 +282,11 @@ export type RelationFieldSettings = CommonFieldSettings & {
279
282
  inverse?: RelationInverse | null;
280
283
  ui?: {
281
284
  field_type?: "relation" | null;
285
+ "placeholder"?: string | null;
282
286
  "allow_inline_create_on_creating"?: boolean | null;
283
287
  "allow_inline_attach_on_creating"?: boolean | null;
284
288
  "allow_inline_create_on_updating"?: boolean | null;
285
289
  "allow_inline_attach_on_updating"?: boolean | null;
286
- "placeholder"?: string | null;
287
290
  };
288
291
  };
289
292
 
@@ -297,6 +300,7 @@ export type ResourceReferenceFieldSettings = CommonFieldSettings & {
297
300
  };
298
301
 
299
302
  export type SelectFieldSettings = CommonFieldSettings & {
303
+ "allow_custom_value"?: boolean | null;
300
304
  ui?: {
301
305
  field_type?: "select" | "inline_select" | null;
302
306
  "show_on_creating"?: boolean | null;
@@ -6387,6 +6387,7 @@ type ComponentRegistry = {
6387
6387
  "EmailMessages": SdkComponent<EmailMessagesProps>;
6388
6388
  "EmptyState": SdkComponent<EmptyStateProps>;
6389
6389
  "ErrorBoundary": SdkComponent<ErrorBoundaryProps>;
6390
+ "FilterPresets": SdkComponent<FilterPresetsProps>;
6390
6391
  "ForgotPasswordForm": SdkComponent<ForgotPasswordFormProps>;
6391
6392
  "FormFieldDisplay": SdkComponent<FormFieldDisplayProps>;
6392
6393
  "FormFieldInput": SdkComponent<FormFieldInputProps>;
@@ -7103,6 +7104,56 @@ type SdkHooks = {
7103
7104
  options?: SdkUseSharedFiltersOptions
7104
7105
  ): SharedFiltersApi;
7105
7106
 
7107
+ /**
7108
+ * Fixed filter choices, such as Status or Period, kept in sync with a filter. `groups`
7109
+ * lists the groups; each option's `filters` is a list of conditions, or `null` for no
7110
+ * condition. Selecting an option replaces the group's conditions in the filter, and each
7111
+ * group reads its selection back from the filter, so the choices stay correct when the
7112
+ * viewer edits chips, picks a saved view, or opens a shared link. A group is `isCustom`
7113
+ * when the filter holds conditions on its fields that equal no option. Each group owns
7114
+ * the fields its options use; two groups cannot filter the same field, and options cannot
7115
+ * nest groups or use or/nor logic. `control` picks how `Sdk.Components.FilterPresets`
7116
+ * renders each group: `select` (the default), `combobox` (with a search box), or
7117
+ * `buttons`. `showLabel: false` hides the group labels when the option labels describe
7118
+ * themselves.
7119
+ *
7120
+ * Without a binding the hook keeps its own filter: pass `presets.filter` to `useRecords`
7121
+ * or `useInfiniteRecords`. Pass `{ filter, setFilter }` from `useSharedFilters` to keep
7122
+ * the choices in sync with saved views. For a table, use `useResourceDataTable`'s
7123
+ * `filterPresets` option instead.
7124
+ *
7125
+ * @example
7126
+ * ```tsx
7127
+ * function InvoiceList() {
7128
+ * const invoices = Sdk.resource('...');
7129
+ * const presets = Sdk.hooks.useFilterPresets({
7130
+ * control: 'buttons',
7131
+ * groups: [
7132
+ * {
7133
+ * key: 'status',
7134
+ * label: 'Status',
7135
+ * options: [
7136
+ * { label: 'All', filters: null },
7137
+ * { label: 'Paid', filters: [{ field: 'status', operator: '=', value: 'paid' }] }
7138
+ * ]
7139
+ * }
7140
+ * ]
7141
+ * });
7142
+ * const { data } = Sdk.hooks.useRecords(invoices, { filter: presets.filter });
7143
+ *
7144
+ * return (
7145
+ * <div className="grid gap-2">
7146
+ * <Sdk.Components.FilterPresets presets={presets} />
7147
+ * {data.map((invoice) => (
7148
+ * <Sdk.Components.Card key={invoice.id}>{invoice.number}</Sdk.Components.Card>
7149
+ * ))}
7150
+ * </div>
7151
+ * );
7152
+ * }
7153
+ * ```
7154
+ */
7155
+ useFilterPresets(presets: FilterPresetsConfig, binding?: FilterPresetsBinding): FilterPresetsApi;
7156
+
7106
7157
  /**
7107
7158
  * Infinite-scroll counterpart to `useRecords`. It accepts the same `relations`,
7108
7159
  * `filter`, `sort`, `perPage`, `scope`, and `enabled` options, then returns up to
@@ -8531,6 +8582,68 @@ type SharedFilter = SharedFiltersResponse['data'][number];
8531
8582
 
8532
8583
  type SharedFiltersResponse = any;
8533
8584
 
8585
+ type FilterPresetsConfig = {
8586
+ groups: readonly FilterPresetGroup[];
8587
+ /**
8588
+ * Shows each group's `label` next to its control. Defaults to `true`. Set `false` when the
8589
+ * option labels describe themselves, such as "All statuses" and "Any method".
8590
+ */
8591
+ showLabel?: boolean;
8592
+ /** Defaults to `select`. */
8593
+ control?: FilterPresetControl;
8594
+ };
8595
+
8596
+ type FilterPresetGroup = {
8597
+ /** Identifies the group in `select`. Unique among the groups. */
8598
+ key: string;
8599
+ /** Names the group's control. It stays the control's accessible name when it is hidden. */
8600
+ label: string;
8601
+ options: readonly FilterPresetOption[];
8602
+ };
8603
+
8604
+ type FilterPresetOption = {
8605
+ /** Unique among the group's options. */
8606
+ label: string;
8607
+ /** Conditions ANDed into the filter when the option is selected. `null` adds no condition. */
8608
+ filters: readonly FilterPresetCondition[] | null;
8609
+ };
8610
+
8611
+ type FilterPresetCondition = {
8612
+ field: string;
8613
+ operator: string;
8614
+ value?: any;
8615
+ };
8616
+
8617
+ type FilterPresetControl = 'select' | 'combobox' | 'buttons';
8618
+
8619
+ type FilterPresetsBinding = {
8620
+ filter: FilterGroup | null;
8621
+ setFilter: (filter: FilterGroup | null) => void;
8622
+ };
8623
+
8624
+ type FilterPresetsApi = {
8625
+ groups: FilterPresetGroupState[];
8626
+ showLabel: boolean;
8627
+ control: FilterPresetControl;
8628
+ /** Replaces the group's conditions in the filter with the option's conditions. */
8629
+ select: (groupKey: string, optionIndex: number) => void;
8630
+ /** The filter that the presets read and write. Pass it to `useRecords` or `useInfiniteRecords`. */
8631
+ filter: FilterGroup | null;
8632
+ };
8633
+
8634
+ type FilterPresetGroupState = {
8635
+ key: string;
8636
+ label: string;
8637
+ options: readonly FilterPresetOption[];
8638
+ /** The option whose conditions the filter holds, or `null` when no option matches. */
8639
+ selectedIndex: number | null;
8640
+ /**
8641
+ * The filter holds conditions on the group's fields that equal no option, for example a
8642
+ * chip the viewer edited. `selectedIndex` is then `null`.
8643
+ */
8644
+ isCustom: boolean;
8645
+ };
8646
+
8534
8647
  type DeleteResourceRecordResource = Pick<
8535
8648
  SdkResource,
8536
8649
  'id' | 'name' | 'disabled_data_api_endpoints'
@@ -9007,6 +9120,39 @@ type UseResourceDataTableOptions<
9007
9120
  * { operator: 'and', conditions: [{ field: 'family.id', operator: '=', value: familyId }] }
9008
9121
  */
9009
9122
  filters?: Record<string, any> | any[] | null;
9123
+ /**
9124
+ * Fixed filter choices that render as one control per group above the table. `groups`
9125
+ * lists the groups. Each option's `filters` is a list of conditions ANDed into the
9126
+ * end-user filter, or `null` for no condition. `control` picks how each group renders:
9127
+ * `select` (the default), `combobox` (a dropdown with a search box, for many options), or
9128
+ * `buttons` (a row of buttons, for a few short options). `showLabel: false` hides the
9129
+ * group labels when the option labels describe themselves ("All statuses"). The controls
9130
+ * stay in sync with the filter chips: a choice replaces the group's conditions and shows
9131
+ * them as chips, and each control reads its value back from the filter. A Select or
9132
+ * combobox shows "Custom" when the viewer edits the conditions to values that equal no
9133
+ * option. Saved views and `urlStateKey` keep the choices because they keep the filter.
9134
+ * Each group owns the fields its options use, so two groups cannot filter the same field.
9135
+ * Requires `enableFilters`. Place the controls in a custom layout with
9136
+ * `Sdk.Components.FilterPresets`.
9137
+ *
9138
+ * @example
9139
+ * filterPresets: {
9140
+ * control: 'buttons',
9141
+ * showLabel: false,
9142
+ * groups: [
9143
+ * {
9144
+ * key: 'status',
9145
+ * label: 'Status',
9146
+ * options: [
9147
+ * { label: 'All statuses', filters: null },
9148
+ * { label: 'Paid', filters: [{ field: 'status', operator: '=', value: 'paid' }] },
9149
+ * { label: 'Overdue', filters: [{ field: 'status', operator: '=', value: 'overdue' }] }
9150
+ * ]
9151
+ * }
9152
+ * ]
9153
+ * }
9154
+ */
9155
+ filterPresets?: FilterPresetsConfig;
9010
9156
  /**
9011
9157
  * Compose end-user filtering into queries: the runtime filter (filter chips and the
9012
9158
  * advanced-filters dialog) plus the resource's saved views, which render a selector
@@ -9139,6 +9285,12 @@ type DataTableFiltersApi = {
9139
9285
  * can't offer shared filters.
9140
9286
  */
9141
9287
  sharedFilters?: SharedFiltersApi;
9288
+ /**
9289
+ * Filter preset groups bound to the runtime filter (`useResourceDataTable`'s
9290
+ * `filterPresets`). When present, `DataTable`'s default layout renders one control per
9291
+ * group above the toolbar. A choice edits the runtime filter, so it shows as chips.
9292
+ */
9293
+ presets?: FilterPresetsApi;
9142
9294
  /**
9143
9295
  * CSV-export state for the backing resource. When present (resource-backed tables
9144
9296
  * whose resource has the export endpoint enabled), `DataTable`'s `isExportable` prop
@@ -10555,6 +10707,8 @@ type DataTableProps<TData extends RowData> = {
10555
10707
  * `Sdk.hooks.useResourceDataTable`. When it carries quick-filter fields (resource-backed
10556
10708
  * tables), the default layout renders a Notion-style filter chip bar below the toolbar;
10557
10709
  * otherwise the toolbar shows the classic "Filters" button opening the advanced dialog.
10710
+ * When it carries filter presets (`useResourceDataTable`'s `filterPresets`), the default
10711
+ * layout renders their controls above the toolbar.
10558
10712
  */
10559
10713
  filters?: DataTableFiltersApi;
10560
10714
 
@@ -10607,8 +10761,8 @@ type DataTableProps<TData extends RowData> = {
10607
10761
  /**
10608
10762
  * Advanced: provide a custom layout instead of the default toolbar/table/pagination.
10609
10763
  * Compose `Sdk.Components.DataTableContent`, `DataTableToolbar`, `DataTableSearch`,
10610
- * `DataTableFilters`, `DataTableAddFilter`, `DataTableFilterChips`,
10611
- * `SharedFilters`, `DataTableColumnToggle`, and `DataTablePagination` in any
10764
+ * `DataTableFilters`, `DataTableAddFilter`, `DataTableFilterChips`, `SharedFilters`,
10765
+ * `FilterPresets`, `DataTableColumnToggle`, and `DataTablePagination` in any
10612
10766
  * order — they read the same table (and filters state) from context.
10613
10767
  */
10614
10768
  children?: ReactNode;
@@ -11141,6 +11295,16 @@ type ErrorBoundaryFallbackProps = {
11141
11295
  reset: () => void;
11142
11296
  };
11143
11297
 
11298
+ type FilterPresetsProps = {
11299
+ /**
11300
+ * Preset state from `Sdk.hooks.useFilterPresets` (or the `filters.presets` returned by
11301
+ * `Sdk.hooks.useResourceDataTable`). Optional inside a
11302
+ * `<Sdk.Components.DataTable filters={...}>`, which provides it.
11303
+ */
11304
+ presets?: FilterPresetsApi;
11305
+ className?: string;
11306
+ };
11307
+
11144
11308
  type ForgotPasswordFormProps = {
11145
11309
  /**
11146
11310
  * The authenticatable resource whose password is being reset. Defaults to the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.41.2",
3
+ "version": "0.41.4",
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": {
@@ -51,8 +51,8 @@
51
51
  "bun": "1.4.4"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h867e44050232",
55
- "@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h867e44050232",
56
- "@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h867e44050232"
54
+ "@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h794cfa98b141",
55
+ "@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h794cfa98b141",
56
+ "@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h794cfa98b141"
57
57
  }
58
58
  }