@diagonal-hq/workflows 0.4.0 → 0.5.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/README.md +16 -0
- package/dist/chunks/{chunk-QLQ4NOFV.js → chunk-L5BNRN7L.js} +15 -3
- package/dist/data.d.ts +8 -24
- package/dist/generated/capabilities.d.ts +177 -9
- package/dist/generated/profiles/test.d.ts +2 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/profiles/shared.d.ts +1 -1
- package/dist/profiles/test.js +1 -1
- package/dist/workspace-values.d.ts +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,22 @@ The `/test` profile entry point exports every capability except its profile's de
|
|
|
15
15
|
|
|
16
16
|
Only `/testing` imports Node built-in modules (`node:async_hooks` and `node:crypto`). The other entry points need no Node API.
|
|
17
17
|
|
|
18
|
+
## Read and write workspace fields
|
|
19
|
+
|
|
20
|
+
The workspace's field definitions type `workspace.value`, `setValue`, `values`, and `setValues`. File-based builds add the custom field catalog to `generated/workspace-fields.ts`. Platform compilation reads the stored definitions. The SDK includes the built-in field types. The test profile uses the same types.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { WorkspaceFields } from '@app/generated/workspace-fields';
|
|
24
|
+
import { workspace } from '@diagonal/workflow';
|
|
25
|
+
|
|
26
|
+
const limit = await workspace.value({ key: WorkspaceFields.SeatLimit.key }); // number | null
|
|
27
|
+
const usableLimit = await workspace.value({ key: WorkspaceFields.SeatLimit.key, defaultValue: 0 }); // number
|
|
28
|
+
await workspace.setValue({ key: WorkspaceFields.SeatLimit.key, value: usableLimit + 1 });
|
|
29
|
+
const values = await workspace.values({}); // values.seat_limit is number | null
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
A field can be cleared to null, including a required field. A read includes null unless a non-null default replaces it. A default of another type adds that type to the result. Dictionary member paths and numeric list-item paths also resolve their declared types. A dynamic or undeclared key returns `unknown`. A write checks each known field's type and select options; dynamic keys keep the generic contract. Generated declarations contain field types, never stored values.
|
|
33
|
+
|
|
18
34
|
## Write a data migration
|
|
19
35
|
|
|
20
36
|
File-based workspace migrations use the ordinary workflow SDK. Export a default `defineWorkflow(config, handler)` from `@diagonal/workflow`. The config is a static object literal with `name` and `trigger: { type: 'manual' }`. Every migration runs as system, and the build ignores a `runAs` that the file sets. Use `data.each`, `data.update`, and other ordinary capabilities in the handler to perform the work directly.
|
|
@@ -27,7 +27,7 @@ async function transaction(fn) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// packages/workflows/src/generated/capabilities.ts
|
|
30
|
-
var SDK_VERSION =
|
|
30
|
+
var SDK_VERSION = 66;
|
|
31
31
|
var ai = {
|
|
32
32
|
/** Ask a decisions model typed questions about some content and get labelled answers with their probabilities */
|
|
33
33
|
decide: (input) => invoke("ai.decide", input),
|
|
@@ -391,6 +391,18 @@ var data2 = {
|
|
|
391
391
|
deleteMany: (input) => invoke("data.delete-many", input)
|
|
392
392
|
};
|
|
393
393
|
|
|
394
|
+
// packages/workflows/src/workspace-values.ts
|
|
395
|
+
function value(input) {
|
|
396
|
+
return invoke("workspace.value", input);
|
|
397
|
+
}
|
|
398
|
+
var workspace2 = {
|
|
399
|
+
...workspace,
|
|
400
|
+
value,
|
|
401
|
+
setValue: (input) => invoke("workspace.set_value", input),
|
|
402
|
+
values: (input = {}) => invoke("workspace.values", input),
|
|
403
|
+
setValues: (input) => invoke("workspace.set_values", input)
|
|
404
|
+
};
|
|
405
|
+
|
|
394
406
|
export {
|
|
395
407
|
transaction,
|
|
396
408
|
SDK_VERSION,
|
|
@@ -428,6 +440,6 @@ export {
|
|
|
428
440
|
user,
|
|
429
441
|
web,
|
|
430
442
|
workflow,
|
|
431
|
-
|
|
432
|
-
|
|
443
|
+
data2 as data,
|
|
444
|
+
workspace2 as workspace
|
|
433
445
|
};
|
package/dist/data.d.ts
CHANGED
|
@@ -60,20 +60,14 @@ export declare const data: {
|
|
|
60
60
|
create: <R extends ResourceKey>(input: Omit<DataCreateInput, "resource" | "data"> & {
|
|
61
61
|
resource: R;
|
|
62
62
|
data: InputOf<R>;
|
|
63
|
-
}) => Promise<
|
|
64
|
-
id: string;
|
|
65
|
-
} & Record<string, unknown>>;
|
|
63
|
+
}) => Promise<RecordOf<R>>;
|
|
66
64
|
find: <R extends ResourceKey>(input: Omit<DataFindInput, "resource"> & {
|
|
67
65
|
resource: R;
|
|
68
|
-
}) => Promise<
|
|
69
|
-
id: string;
|
|
70
|
-
} & Record<string, unknown>>;
|
|
66
|
+
}) => Promise<RecordOf<R>>;
|
|
71
67
|
update: <R extends ResourceKey>(input: Omit<DataUpdateInput, "resource" | "data"> & {
|
|
72
68
|
resource: R;
|
|
73
69
|
data: InputOf<R>;
|
|
74
|
-
}) => Promise<
|
|
75
|
-
id: string;
|
|
76
|
-
} & Record<string, unknown>>;
|
|
70
|
+
}) => Promise<RecordOf<R>>;
|
|
77
71
|
/**
|
|
78
72
|
* One page of the records that the search matches: 50 records by default, and at most 100 with
|
|
79
73
|
* `pageSize`. To read every match, use `data.each`, which requests the pages for you.
|
|
@@ -84,34 +78,24 @@ export declare const data: {
|
|
|
84
78
|
each: typeof each;
|
|
85
79
|
delete: <R extends ResourceKey>(input: Omit<DataDeleteInput, "resource"> & {
|
|
86
80
|
resource: R;
|
|
87
|
-
}) => Promise<
|
|
88
|
-
id: string;
|
|
89
|
-
} & Record<string, unknown>>;
|
|
81
|
+
}) => Promise<RecordOf<R>>;
|
|
90
82
|
restore: <R extends ResourceKey>(input: Omit<DataRestoreInput, "resource"> & {
|
|
91
83
|
resource: R;
|
|
92
|
-
}) => Promise<
|
|
93
|
-
id: string;
|
|
94
|
-
} & Record<string, unknown>>;
|
|
84
|
+
}) => Promise<RecordOf<R>>;
|
|
95
85
|
count: <R extends ResourceKey>(input: Omit<DataCountInput, "resource"> & {
|
|
96
86
|
resource: R;
|
|
97
87
|
}) => Promise<number>;
|
|
98
88
|
findOrCreate: <R extends ResourceKey>(input: Omit<DataFindOrCreateInput, "resource"> & {
|
|
99
89
|
resource: R;
|
|
100
|
-
}) => Promise<
|
|
101
|
-
id: string;
|
|
102
|
-
} & Record<string, unknown>>;
|
|
90
|
+
}) => Promise<RecordOf<R>>;
|
|
103
91
|
updateOrCreate: <R extends ResourceKey>(input: Omit<DataUpdateOrCreateInput, "resource"> & {
|
|
104
92
|
resource: R;
|
|
105
|
-
}) => Promise<
|
|
106
|
-
id: string;
|
|
107
|
-
} & Record<string, unknown>>;
|
|
93
|
+
}) => Promise<RecordOf<R>>;
|
|
108
94
|
/** Create all of `records` in one call. The call has no limit on the number of records. */
|
|
109
95
|
createMany: <R extends ResourceKey>(input: Omit<DataCreateManyInput, "resource" | "records"> & {
|
|
110
96
|
resource: R;
|
|
111
97
|
records: Array<InputOf<R>>;
|
|
112
|
-
}) => Promise<
|
|
113
|
-
id: string;
|
|
114
|
-
} & Record<string, unknown>)[]>;
|
|
98
|
+
}) => Promise<Array<RecordOf<R>>>;
|
|
115
99
|
deleteMany: <R extends ResourceKey>(input: Omit<DataDeleteManyInput, "resource"> & {
|
|
116
100
|
resource: R;
|
|
117
101
|
}) => Promise<DataDeleteManyOutput>;
|
|
@@ -1,6 +1,174 @@
|
|
|
1
1
|
import type { ResourceKeyWith } from "../data.js";
|
|
2
2
|
import type { ContentDocument } from "../input.js";
|
|
3
|
-
export declare const SDK_VERSION =
|
|
3
|
+
export declare const SDK_VERSION = 66;
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
2075
|
+
export type WorkspaceValueOutput = unknown;
|
|
1908
2076
|
export interface WorkspaceValuesInput {
|
|
1909
2077
|
}
|
|
1910
2078
|
export type WorkspaceValuesOutput = Record<string, unknown>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { data as rootData } from "../../data.js";
|
|
2
|
-
import {
|
|
2
|
+
import { workspace as rootWorkspace } from "../../workspace-values.js";
|
|
3
|
+
import { ai as rootAi, calendar as rootCalendar, callback as rootCallback, chart as rootChart, date as rootDate, file as rootFile, guard as rootGuard, http as rootHttp, lifecycle as rootLifecycle, mail as rootMail, markdown as rootMarkdown, mediaLibrary as rootMediaLibrary, money as rootMoney, notification as rootNotification, number as rootNumber, package as rootPackage, page as rootPage, payables as rootPayables, payment as rootPayment, payments as rootPayments, phone as rootPhone, scheduling as rootScheduling, schema as rootSchema, security as rootSecurity, sms as rootSms, subscriptions as rootSubscriptions, text as rootText, time as rootTime, timezone as rootTimezone, tiptap as rootTiptap, user as rootUser, web as rootWeb, workflow as rootWorkflow } from "../capabilities.js";
|
|
3
4
|
export declare const ai: {
|
|
4
5
|
decide: typeof rootAi.decide;
|
|
5
6
|
runPrompt: typeof rootAi.runPrompt;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { invoke, setTransport, type HostTransport } from "./transport.js";
|
|
|
4
4
|
export { transaction } from "./transaction.js";
|
|
5
5
|
export { data } from "./data.js";
|
|
6
6
|
export { mail, notification, sms } from "./notifications.js";
|
|
7
|
+
export { workspace } from "./workspace-values.js";
|
|
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.js";
|
|
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.js";
|
|
9
10
|
export * from "./generated/capabilities.js";
|
|
@@ -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
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { HostError, WorkflowFailure, fail, validationError } from "../errors.js";
|
|
2
2
|
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.js";
|
|
3
3
|
export { defineWorkflow, parseWorkflowInput, redirect, respond, validateWorkflowInput, type Identity, type InputErrors, type InputValidator, type RequestContext, type ScriptExecution, type WorkflowContext, type WorkflowDefinition, type WorkflowExecution } from "../workflow.js";
|
|
4
|
-
export type { ScriptHostContext, WorkspaceNotificationTypes, WorkspaceResources } from "../index.js";
|
|
4
|
+
export type { ScriptHostContext, WorkspaceFieldCatalog, WorkspaceNotificationTypes, WorkspaceResources } from "../index.js";
|
package/dist/profiles/test.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type WorkspaceSystemFields } from "./generated/capabilities.js";
|
|
2
|
+
import type { WorkspaceFieldCatalog } from "./index.js";
|
|
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.js").WorkspaceLoginUrlInput) => Promise<import("./index.js").WorkspaceLoginUrlOutput>;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/package.json
CHANGED