@diagonal-hq/cli 0.16.0 → 0.17.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.
package/dist/index.d.ts CHANGED
@@ -110,9 +110,10 @@ export type ConfigDefinition = {
110
110
  settings?: WorkspaceSettings;
111
111
  /**
112
112
  * The resource that the first administrator of a new workspace signs in as,
113
- * as `Resources.<Name>.slug`. It must declare the authenticatable capability.
113
+ * as `{ resource: Resources.<Name>.slug }`. It must declare the authenticatable
114
+ * capability. A bare slug is accepted with a build warning.
114
115
  */
115
- staffResource?: ResourceReference;
116
+ staffResource?: { resource: ResourceReference } | ResourceReference;
116
117
  } & ConfigDomains<DomainDeclarations>;
117
118
 
118
119
  /** One domain of `domains`, such as `{}` or `{ fallback: 'primary' }`. */
@@ -144,7 +144,7 @@ type ResourceSortInput =
144
144
  | ResourceSortDescriptor
145
145
  | ResourceSortFieldDescriptor
146
146
  | (ResourceSortDescriptor | ResourceSortFieldDescriptor)[]
147
- | Record<string, ResourceSortDirection>;
147
+ | Record<string, ResourceSortDirection | number | string>;
148
148
 
149
149
  type ResourceListParams<TRelations extends readonly string[] = readonly string[]> = {
150
150
  page?: number;
@@ -1,6 +1,174 @@
1
1
  import type { ResourceKeyWith } from '../data';
2
2
  import type { ContentDocument } from '../input';
3
- export declare const SDK_VERSION = 62;
3
+ export declare const SDK_VERSION = 65;
4
+ export interface WorkspaceSystemFields {
5
+ "ai_custom_system_prompt": string | null;
6
+ "brand_kit": {
7
+ "colors"?: {
8
+ "light"?: {
9
+ "--background"?: string;
10
+ "--foreground"?: string;
11
+ "--card"?: string;
12
+ "--card-foreground"?: string;
13
+ "--popover"?: string;
14
+ "--popover-foreground"?: string;
15
+ "--primary"?: string;
16
+ "--primary-foreground"?: string;
17
+ "--secondary"?: string;
18
+ "--secondary-foreground"?: string;
19
+ "--muted"?: string;
20
+ "--muted-foreground"?: string;
21
+ "--accent"?: string;
22
+ "--accent-foreground"?: string;
23
+ "--destructive"?: string;
24
+ "--destructive-foreground"?: string;
25
+ "--success"?: string;
26
+ "--success-foreground"?: string;
27
+ "--warning"?: string;
28
+ "--warning-foreground"?: string;
29
+ "--informative"?: string;
30
+ "--informative-foreground"?: string;
31
+ "--border"?: string;
32
+ "--input"?: string;
33
+ "--ring"?: string;
34
+ "--chart-1"?: string;
35
+ "--chart-2"?: string;
36
+ "--chart-3"?: string;
37
+ "--chart-4"?: string;
38
+ "--chart-5"?: string;
39
+ "--sidebar"?: string;
40
+ "--sidebar-foreground"?: string;
41
+ "--sidebar-primary"?: string;
42
+ "--sidebar-primary-foreground"?: string;
43
+ "--sidebar-accent"?: string;
44
+ "--sidebar-accent-foreground"?: string;
45
+ "--sidebar-border"?: string;
46
+ "--sidebar-ring"?: string;
47
+ } | null;
48
+ "dark"?: {
49
+ "--background"?: string;
50
+ "--foreground"?: string;
51
+ "--card"?: string;
52
+ "--card-foreground"?: string;
53
+ "--popover"?: string;
54
+ "--popover-foreground"?: string;
55
+ "--primary"?: string;
56
+ "--primary-foreground"?: string;
57
+ "--secondary"?: string;
58
+ "--secondary-foreground"?: string;
59
+ "--muted"?: string;
60
+ "--muted-foreground"?: string;
61
+ "--accent"?: string;
62
+ "--accent-foreground"?: string;
63
+ "--destructive"?: string;
64
+ "--destructive-foreground"?: string;
65
+ "--success"?: string;
66
+ "--success-foreground"?: string;
67
+ "--warning"?: string;
68
+ "--warning-foreground"?: string;
69
+ "--informative"?: string;
70
+ "--informative-foreground"?: string;
71
+ "--border"?: string;
72
+ "--input"?: string;
73
+ "--ring"?: string;
74
+ "--chart-1"?: string;
75
+ "--chart-2"?: string;
76
+ "--chart-3"?: string;
77
+ "--chart-4"?: string;
78
+ "--chart-5"?: string;
79
+ "--sidebar"?: string;
80
+ "--sidebar-foreground"?: string;
81
+ "--sidebar-primary"?: string;
82
+ "--sidebar-primary-foreground"?: string;
83
+ "--sidebar-accent"?: string;
84
+ "--sidebar-accent-foreground"?: string;
85
+ "--sidebar-border"?: string;
86
+ "--sidebar-ring"?: string;
87
+ } | null;
88
+ } | null;
89
+ "typography"?: {
90
+ "--font-sans"?: string | null;
91
+ "--font-serif"?: string | null;
92
+ "--font-mono"?: string | null;
93
+ "--radius"?: "0rem" | "0.125rem" | "0.25rem" | "0.375rem" | "0.5rem" | "0.75rem";
94
+ } | null;
95
+ "shadows"?: {
96
+ "light"?: {
97
+ "--shadow-2xs"?: "none" | "0px 1px 1px 0px hsl(0 0% 0% \/ 0.04)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.09)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18)";
98
+ "--shadow-xs"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.05)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.09)" | "0px 2px 4px 0px hsl(0 0% 0% \/ 0.18)";
99
+ "--shadow-sm"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 1px 1px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.18)" | "0px 1px 3px 0px hsl(0 0% 0% \/ 0.25), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.25)";
100
+ "--shadow"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.18)" | "0px 4px 6px -1px hsl(0 0% 0% \/ 0.25), 0px 2px 4px -2px hsl(0 0% 0% \/ 0.25)";
101
+ "--shadow-md"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 2px 4px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 2px 4px -1px hsl(0 0% 0% \/ 0.18)" | "0px 4px 6px -1px hsl(0 0% 0% \/ 0.25), 0px 2px 4px -2px hsl(0 0% 0% \/ 0.25)";
102
+ "--shadow-lg"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 4px 6px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 4px 6px -1px hsl(0 0% 0% \/ 0.18)" | "0px 10px 15px -3px hsl(0 0% 0% \/ 0.25), 0px 4px 6px -4px hsl(0 0% 0% \/ 0.25)";
103
+ "--shadow-xl"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 8px 10px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 8px 10px -1px hsl(0 0% 0% \/ 0.18)" | "0px 20px 25px -5px hsl(0 0% 0% \/ 0.25), 0px 8px 10px -6px hsl(0 0% 0% \/ 0.25)";
104
+ "--shadow-2xl"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.45)" | "0px 25px 50px -12px hsl(0 0% 0% \/ 0.5)";
105
+ } | null;
106
+ "dark"?: {
107
+ "--shadow-2xs"?: "none" | "0px 1px 1px 0px hsl(0 0% 0% \/ 0.04)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.09)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18)";
108
+ "--shadow-xs"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.05)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.09)" | "0px 2px 4px 0px hsl(0 0% 0% \/ 0.18)";
109
+ "--shadow-sm"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 1px 1px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.18)" | "0px 1px 3px 0px hsl(0 0% 0% \/ 0.25), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.25)";
110
+ "--shadow"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 1px 2px -1px hsl(0 0% 0% \/ 0.18)" | "0px 4px 6px -1px hsl(0 0% 0% \/ 0.25), 0px 2px 4px -2px hsl(0 0% 0% \/ 0.25)";
111
+ "--shadow-md"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 2px 4px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 2px 4px -1px hsl(0 0% 0% \/ 0.18)" | "0px 4px 6px -1px hsl(0 0% 0% \/ 0.25), 0px 2px 4px -2px hsl(0 0% 0% \/ 0.25)";
112
+ "--shadow-lg"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 4px 6px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 4px 6px -1px hsl(0 0% 0% \/ 0.18)" | "0px 10px 15px -3px hsl(0 0% 0% \/ 0.25), 0px 4px 6px -4px hsl(0 0% 0% \/ 0.25)";
113
+ "--shadow-xl"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.06), 0px 8px 10px -1px hsl(0 0% 0% \/ 0.06)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18), 0px 8px 10px -1px hsl(0 0% 0% \/ 0.18)" | "0px 20px 25px -5px hsl(0 0% 0% \/ 0.25), 0px 8px 10px -6px hsl(0 0% 0% \/ 0.25)";
114
+ "--shadow-2xl"?: "none" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.18)" | "0px 1px 2px 0px hsl(0 0% 0% \/ 0.45)" | "0px 25px 50px -12px hsl(0 0% 0% \/ 0.5)";
115
+ } | null;
116
+ } | null;
117
+ "logos"?: {
118
+ "horizontal"?: {
119
+ "dark"?: string;
120
+ "light"?: string;
121
+ } | null;
122
+ "icon"?: {
123
+ "dark"?: string;
124
+ "light"?: string;
125
+ } | null;
126
+ "wordmark"?: {
127
+ "dark"?: string;
128
+ "light"?: string;
129
+ } | null;
130
+ } | null;
131
+ "favicon"?: {
132
+ "dark"?: string;
133
+ "light"?: string;
134
+ } | null;
135
+ "seo"?: {
136
+ "title"?: string | null;
137
+ "description"?: string | null;
138
+ "og_image"?: string;
139
+ } | null;
140
+ "design_profile"?: string | null;
141
+ } | null;
142
+ "custom_401_error_page": string | {
143
+ id: string;
144
+ params?: Record<string, unknown>;
145
+ } | null;
146
+ "custom_403_error_page": string | {
147
+ id: string;
148
+ params?: Record<string, unknown>;
149
+ } | null;
150
+ "custom_404_error_page": string | {
151
+ id: string;
152
+ params?: Record<string, unknown>;
153
+ } | null;
154
+ "custom_422_error_page": string | {
155
+ id: string;
156
+ params?: Record<string, unknown>;
157
+ } | null;
158
+ "custom_500_error_page": string | {
159
+ id: string;
160
+ params?: Record<string, unknown>;
161
+ } | null;
162
+ "default_currency": "aed" | "ars" | "aud" | "brl" | "cad" | "chf" | "clp" | "cny" | "cop" | "czk" | "dkk" | "eur" | "gbp" | "hkd" | "idr" | "ils" | "inr" | "jpy" | "krw" | "mxn" | "myr" | "nok" | "nzd" | "pen" | "php" | "pln" | "sar" | "sek" | "sgd" | "thb" | "twd" | "usd" | "zar" | null;
163
+ "default_timezone": string | null;
164
+ "fathom_site_id": string | null;
165
+ "head_html": string | null;
166
+ "name": string | null;
167
+ "sidebar_icon": string | null;
168
+ "sidebar_icon_color": string | null;
169
+ "slug": string | null;
170
+ "website": string | null;
171
+ }
4
172
  export interface AiDecideInput {
5
173
  state: unknown;
6
174
  questions: Array<{
@@ -60,7 +228,7 @@ export interface CallbackGetInput {
60
228
  key: string;
61
229
  default?: unknown;
62
230
  }
63
- export type CallbackGetOutput = string;
231
+ export type CallbackGetOutput = unknown;
64
232
  export interface CallbackRemoveInput {
65
233
  key: string;
66
234
  }
@@ -69,7 +237,7 @@ export interface CallbackSetInput {
69
237
  key?: string;
70
238
  value?: unknown;
71
239
  }
72
- export type CallbackSetOutput = string;
240
+ export type CallbackSetOutput = unknown;
73
241
  export interface ChartDistributionInput {
74
242
  resource: string;
75
243
  categoryField: string;
@@ -380,7 +548,7 @@ export interface DataValidateInput {
380
548
  resource: string;
381
549
  data: Record<string, unknown>;
382
550
  }
383
- export type DataValidateOutput = string;
551
+ export type DataValidateOutput = unknown;
384
552
  export interface DateAddInput {
385
553
  date: string;
386
554
  value: number;
@@ -788,7 +956,7 @@ export interface NumberFormatInput {
788
956
  export type NumberFormatOutput = string;
789
957
  export interface PackageInstallInputInput {
790
958
  }
791
- export type PackageInstallInputOutput = string;
959
+ export type PackageInstallInputOutput = unknown;
792
960
  export interface PageUrlInput {
793
961
  page: {
794
962
  id: string;
@@ -1692,7 +1860,7 @@ export interface TiptapParseInput {
1692
1860
  oneLine?: boolean;
1693
1861
  placeholder?: string;
1694
1862
  }
1695
- export type TiptapParseOutput = string;
1863
+ export type TiptapParseOutput = unknown;
1696
1864
  export interface TransactionBeginInput {
1697
1865
  }
1698
1866
  export type TransactionBeginOutput = null;
@@ -1878,7 +2046,7 @@ export interface WorkflowRunInput {
1878
2046
  runAsRecord?: string | null;
1879
2047
  executionMode?: "async" | "sync" | null;
1880
2048
  }
1881
- export type WorkflowRunOutput = string;
2049
+ export type WorkflowRunOutput = unknown;
1882
2050
  export interface WorkflowUrlInput {
1883
2051
  workflow: {
1884
2052
  id: string;
@@ -1895,7 +2063,7 @@ export interface WorkspaceSetValueInput {
1895
2063
  key: string;
1896
2064
  value?: unknown;
1897
2065
  }
1898
- export type WorkspaceSetValueOutput = string;
2066
+ export type WorkspaceSetValueOutput = unknown;
1899
2067
  export interface WorkspaceSetValuesInput {
1900
2068
  values?: Record<string, unknown>;
1901
2069
  }
@@ -1904,7 +2072,7 @@ export interface WorkspaceValueInput {
1904
2072
  key: string;
1905
2073
  defaultValue?: unknown;
1906
2074
  }
1907
- export type WorkspaceValueOutput = string;
2075
+ export type WorkspaceValueOutput = unknown;
1908
2076
  export interface WorkspaceValuesInput {
1909
2077
  }
1910
2078
  export type WorkspaceValuesOutput = Record<string, unknown>;
@@ -4,6 +4,7 @@ export { invoke, setTransport, type HostTransport } from './transport';
4
4
  export { transaction } from './transaction';
5
5
  export { data } from './data';
6
6
  export { mail, notification, sms } from './notifications';
7
+ export { workspace } from './workspace-values';
7
8
  export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from './input';
8
9
  export { defineWorkflow, parseWorkflowInput, redirect, respond, validateWorkflowInput, type Identity, type InputErrors, type InputValidator, type RequestContext, type ScriptExecution, type WorkflowContext, type WorkflowDefinition, type WorkflowExecution } from './workflow';
9
10
  export * from './generated/capabilities';
@@ -13,6 +14,9 @@ export interface ScriptHostContext {
13
14
  /** Declaration-merged by the generated workspace module with one entry per resource. */
14
15
  export interface WorkspaceResources {
15
16
  }
17
+ /** Declaration-merged by the workspace's field definitions with each key's value type. */
18
+ export interface WorkspaceFieldCatalog {
19
+ }
16
20
  /**
17
21
  * Declaration-merged by the generated workspace module with one entry per notification type:
18
22
  * its id, the unions of its template ids (all, email-enabled, and SMS-enabled), and the shape
@@ -0,0 +1,36 @@
1
+ import { type WorkspaceSystemFields } from './generated/capabilities';
2
+ import type { WorkspaceFieldCatalog } from './index';
3
+ type Fields = Omit<WorkspaceSystemFields, keyof WorkspaceFieldCatalog> & WorkspaceFieldCatalog;
4
+ type Property<T, K extends string> = T extends null | undefined ? never : T extends readonly (infer Item)[] ? K extends `${number}` ? K extends keyof T ? T[K] : Item : unknown : T extends object ? K extends keyof T ? T[K] : unknown : unknown;
5
+ type PathValue<T, P extends string> = P extends `${infer Head}.${infer Tail}` ? PathValue<Property<T, Head>, Tail> : Property<T, P>;
6
+ export type WorkspaceValue<K extends string> = K extends keyof Fields ? Fields[K] : K extends `${infer Key}.${infer Path}` ? Key extends keyof Fields ? PathValue<Fields[Key], Path> : unknown : unknown;
7
+ type DefaultValue<D> = Exclude<D, undefined> | (undefined extends D ? null : never);
8
+ type ReadValue<K extends string, D> = Exclude<WorkspaceValue<K>, null | undefined> | DefaultValue<D>;
9
+ type WriteValue<K extends string> = K extends keyof Fields ? Fields[K] | null : unknown;
10
+ type WrittenValues<V> = {
11
+ [K in keyof V]: K extends string ? WriteValue<K> : unknown;
12
+ };
13
+ export type WorkspaceValues = {
14
+ [K in keyof Fields]: Fields[K] | null;
15
+ } & Record<string, unknown>;
16
+ declare function value<K extends string, D>(input: {
17
+ key: K;
18
+ defaultValue: D;
19
+ }): Promise<ReadValue<K, D>>;
20
+ declare function value<K extends string, D = never>(input: {
21
+ key: K;
22
+ defaultValue?: D;
23
+ }): Promise<ReadValue<K, D | undefined>>;
24
+ export declare const workspace: {
25
+ value: typeof value;
26
+ setValue: <K extends string>(input: {
27
+ key: K;
28
+ value?: WriteValue<NoInfer<K>>;
29
+ }) => Promise<WriteValue<K>>;
30
+ values: (input?: Record<never, never>) => Promise<WorkspaceValues>;
31
+ setValues: <V extends Record<string, unknown> = Record<never, never>>(input: {
32
+ values?: V & WrittenValues<NoInfer<V>>;
33
+ }) => Promise<WrittenValues<V>>;
34
+ loginUrl: (input: import("./index").WorkspaceLoginUrlInput) => Promise<import("./index").WorkspaceLoginUrlOutput>;
35
+ };
36
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.16.0",
3
+ "version": "0.17.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": {