@diagonal-hq/workflows 0.3.1 → 0.5.0
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 +62 -8
- package/dist/chunks/{chunk-KXVTSLCN.js → chunk-7MUIXOH5.js} +21 -4
- package/dist/chunks/{chunk-RWZW4V74.js → chunk-EU2ME5WR.js} +15 -6
- package/dist/data.d.ts +7 -1
- package/dist/generated/capabilities.d.ts +246 -9
- package/dist/generated/profiles/test.d.ts +2 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/notifications.d.ts +4 -3
- package/dist/profiles/shared.d.ts +1 -1
- package/dist/profiles/test.js +2 -3
- package/dist/testing/context.d.ts +6 -0
- package/dist/testing/index.d.ts +8 -5
- package/dist/testing/index.js +37 -25
- package/dist/workflow-config.d.ts +7 -0
- package/dist/workflow.d.ts +23 -6
- package/dist/workspace-values.d.ts +36 -0
- package/package.json +1 -5
- package/dist/chunks/chunk-CSWWU6TP.js +0 -0
- package/dist/generated/profiles/migration.d.ts +0 -155
- package/dist/profiles/migration.d.ts +0 -9
- package/dist/profiles/migration.js +0 -255
package/README.md
CHANGED
|
@@ -4,18 +4,61 @@ This package is the authoring API of Diagonal managed workflows. A workflow modu
|
|
|
4
4
|
|
|
5
5
|
## Entry points
|
|
6
6
|
|
|
7
|
-
| Entry point
|
|
8
|
-
|
|
|
9
|
-
| `@diagonal-hq/workflows`
|
|
10
|
-
| `@diagonal-hq/workflows/test`
|
|
11
|
-
| `@diagonal-hq/workflows/
|
|
12
|
-
| `@diagonal-hq/workflows/
|
|
13
|
-
| `@diagonal-hq/workflows/http` | Local runs against a real workspace | `HttpTransport` |
|
|
7
|
+
| Entry point | Used by | Exports |
|
|
8
|
+
| -------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `@diagonal-hq/workflows` | Workflows | `defineWorkflow`, `respond`, `redirect`, `fail`, `validationError`, the input schema builder `v`, `transaction`, `data`, `mail`, `notification`, `sms`, and the generated capability wrappers |
|
|
10
|
+
| `@diagonal-hq/workflows/test` | E2E setup and assert scripts | Every capability wrapper except the test profile's deny list (`auth`), `transaction`, and the root helpers that call no host capability |
|
|
11
|
+
| `@diagonal-hq/workflows/testing` | Local workflow tests in Node | `MockTransport`, `runWorkflow`, and `fake` |
|
|
12
|
+
| `@diagonal-hq/workflows/http` | Local runs against a real workspace | `HttpTransport` |
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
The `/test` profile entry point exports every capability except its profile's deny list. `ScriptProfile` in the platform owns the deny lists, and `generated/capabilities.json` publishes the allowed names under `profiles`. The workflow script compiler reports a reference to a denied capability, and the script host refuses the call. The entry point exports neither `invoke` nor `setTransport`, because the compiler cannot check a capability name that a script builds at run time.
|
|
16
15
|
|
|
17
16
|
Only `/testing` imports Node built-in modules (`node:async_hooks` and `node:crypto`). The other entry points need no Node API.
|
|
18
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
|
+
|
|
34
|
+
## Write a data migration
|
|
35
|
+
|
|
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.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Resources } from '@app/generated/resources';
|
|
40
|
+
import { data, defineWorkflow } from '@diagonal/workflow';
|
|
41
|
+
|
|
42
|
+
export default defineWorkflow(
|
|
43
|
+
{
|
|
44
|
+
name: 'Backfill post slug',
|
|
45
|
+
trigger: { type: 'manual' },
|
|
46
|
+
runAs: 'system'
|
|
47
|
+
},
|
|
48
|
+
async () => {
|
|
49
|
+
for await (const post of data.each({ resource: Resources.Posts.slug })) {
|
|
50
|
+
// ...
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
A migration with `export const config` or `title` still builds, with a warning.
|
|
57
|
+
|
|
58
|
+
Create a file with `diagonal make:migration <name>`, or `npm run migration -- <name>` in a workspace template. It creates `migrations/YYYYMMDDHHmmss_name.ts`. Deployment activation queues all new filenames independently as ordinary asynchronous workflows. They can run concurrently. The timestamp sorts filenames for listing and history and does not enforce execution order. Put dependent operations in one script. The platform records the filename for the workspace environment in Postgres before launch. It records every terminal outcome and never launches that filename again. Manual and nested workflow calls cannot run migration files. Inspect the existing workflow execution status for a failure, then add a new migration file to correct it.
|
|
59
|
+
|
|
60
|
+
Migrations run after schema activation. Existing schema safety guards still apply. Deploy a new field as optional, fill it in a migration, then make it required in a later release. A failed migration can leave completed writes in place, so account for those writes in the correction.
|
|
61
|
+
|
|
19
62
|
## Run a workflow in a test
|
|
20
63
|
|
|
21
64
|
```ts
|
|
@@ -29,6 +72,17 @@ const output = await runWorkflow(welcomeMember, {}, { transport });
|
|
|
29
72
|
|
|
30
73
|
`runWorkflow` sends each capability call to the transport of its own run. Overlapping and nested runs do not share transports. A call with no mock handler fails with `capability_denied`.
|
|
31
74
|
|
|
75
|
+
Imported from this package, `runWorkflow` runs the handler in Node. A deployed script runs in QuickJS, so the two engines can give different results. In a file-based workspace, the build and `diagonal check` run each `workflows/<name>.test.ts` and `migrations/<name>.test.ts` with a `runWorkflow` that runs the compiled code of the workflow file in QuickJS, with the production SDK runtime and limits. The test code itself still runs in Node. That `runWorkflow` has these differences:
|
|
76
|
+
|
|
77
|
+
- It always runs the `validate` option of the workflow config, as a deployed run does. It runs a `validateInput` export only when the test passes that export as the `validateInput` option. Another validator, or a `validateInput` option for a workflow with a `validate` option, is refused.
|
|
78
|
+
- Inputs, context, mock replies, and the result cross the engine boundary as JSON. A handler that returns `undefined` gives `null`, and a `Date` becomes a string.
|
|
79
|
+
- A `WorkflowFailure` or `HostError` from the script is rethrown as that class. A mock that throws another error reaches the script as a `HostError` with the code `internal_error`.
|
|
80
|
+
- A workflow that the test defines itself has no compiled code, so it runs in Node.
|
|
81
|
+
|
|
82
|
+
### QuickJS limits
|
|
83
|
+
|
|
84
|
+
The QuickJS build has no `Intl` and no locale data. `toLocaleDateString`, `toLocaleTimeString`, `toLocaleString`, and `localeCompare` ignore their locale and options arguments. For example, `new Date('2026-11-03T12:00:00Z').toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })` gives `November 3, 2026` in Node and `11/03/2026` in QuickJS. Use the host helpers `date.format`, `time.format`, and `money.format`, which format with ICU on the host.
|
|
85
|
+
|
|
32
86
|
## Source in the platform repository
|
|
33
87
|
|
|
34
88
|
`src/` is the same SDK source that the workflow script compiler embeds and that the QuickJS runtime bundles. Existing workspace modules import it as `@diagonal/workflow`. `php artisan workflows:script-sdk:build` regenerates `generated/capabilities.json`, `src/generated/capabilities.ts`, and `src/generated/profiles/*.ts`. Do not hand-edit them.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
invoke
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EU2ME5WR.js";
|
|
4
4
|
import {
|
|
5
5
|
HostError
|
|
6
6
|
} from "./chunk-OF5QITP7.js";
|
|
@@ -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 = 65;
|
|
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),
|
|
@@ -375,6 +375,10 @@ var data2 = {
|
|
|
375
375
|
create: (input) => invoke("data.create", input),
|
|
376
376
|
find: (input) => invoke("data.find", input),
|
|
377
377
|
update: (input) => invoke("data.update", input),
|
|
378
|
+
/**
|
|
379
|
+
* One page of the records that the search matches: 50 records by default, and at most 100 with
|
|
380
|
+
* `pageSize`. To read every match, use `data.each`, which requests the pages for you.
|
|
381
|
+
*/
|
|
378
382
|
search: (input) => invoke("data.search", input),
|
|
379
383
|
each,
|
|
380
384
|
delete: (input) => invoke("data.delete", input),
|
|
@@ -382,10 +386,23 @@ var data2 = {
|
|
|
382
386
|
count: (input) => invoke("data.count", input),
|
|
383
387
|
findOrCreate: (input) => invoke("data.find-or-create", input),
|
|
384
388
|
updateOrCreate: (input) => invoke("data.update-or-create", input),
|
|
389
|
+
/** Create all of `records` in one call. The call has no limit on the number of records. */
|
|
385
390
|
createMany: (input) => invoke("data.create-many", input),
|
|
386
391
|
deleteMany: (input) => invoke("data.delete-many", input)
|
|
387
392
|
};
|
|
388
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
|
+
|
|
389
406
|
export {
|
|
390
407
|
transaction,
|
|
391
408
|
SDK_VERSION,
|
|
@@ -423,6 +440,6 @@ export {
|
|
|
423
440
|
user,
|
|
424
441
|
web,
|
|
425
442
|
workflow,
|
|
426
|
-
|
|
427
|
-
|
|
443
|
+
data2 as data,
|
|
444
|
+
workspace2 as workspace
|
|
428
445
|
};
|
|
@@ -189,18 +189,27 @@ async function validateWorkflowInput(validator, input, ctx) {
|
|
|
189
189
|
validationError(errors);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
function defineWorkflow(
|
|
193
|
-
if (typeof
|
|
194
|
-
return { $diagonal: "workflow", run: async (input, ctx) =>
|
|
192
|
+
function defineWorkflow(first, maybeHandler) {
|
|
193
|
+
if (typeof first === "function") {
|
|
194
|
+
return { $diagonal: "workflow", run: async (input, ctx) => first(input, ctx) };
|
|
195
195
|
}
|
|
196
|
-
const
|
|
196
|
+
const schema = first instanceof InputSchema ? first : first.input;
|
|
197
|
+
const validate = first instanceof InputSchema ? void 0 : first.validate;
|
|
197
198
|
const handler = maybeHandler;
|
|
198
199
|
if (handler === void 0) {
|
|
199
|
-
throw new TypeError(
|
|
200
|
+
throw new TypeError(
|
|
201
|
+
schema === first ? "defineWorkflow(input, handler) needs a handler after the input schema." : "defineWorkflow(config, handler) needs a handler after the config."
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
if (validate !== void 0 && typeof validate !== "function") {
|
|
205
|
+
throw new TypeError(
|
|
206
|
+
"The validate option of defineWorkflow(config, handler) must be a function."
|
|
207
|
+
);
|
|
200
208
|
}
|
|
201
209
|
return {
|
|
202
210
|
$diagonal: "workflow",
|
|
203
|
-
input: spec,
|
|
211
|
+
...schema === void 0 ? {} : { input: schema.$spec },
|
|
212
|
+
...validate === void 0 ? {} : { validate },
|
|
204
213
|
run: async (input, ctx) => handler(input, ctx)
|
|
205
214
|
};
|
|
206
215
|
}
|
package/dist/data.d.ts
CHANGED
|
@@ -45,7 +45,8 @@ type EachInput<R> = Omit<DataSearchInput, 'resource' | 'page' | 'pageSize' | 'pa
|
|
|
45
45
|
maxRecords?: number;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
|
-
* Visit every record that the search matches, one record at a time
|
|
48
|
+
* Visit every record that the search matches, one record at a time. Use it in place of a loop
|
|
49
|
+
* over `data.search` pages: it calls `data.search` with cursor paging and pages of 100 records. The
|
|
49
50
|
* query is copied when `each` is called, so a change to the input object during the walk does
|
|
50
51
|
* not change the pages.
|
|
51
52
|
*
|
|
@@ -73,6 +74,10 @@ export declare const data: {
|
|
|
73
74
|
}) => Promise<{
|
|
74
75
|
id: string;
|
|
75
76
|
} & Record<string, unknown>>;
|
|
77
|
+
/**
|
|
78
|
+
* One page of the records that the search matches: 50 records by default, and at most 100 with
|
|
79
|
+
* `pageSize`. To read every match, use `data.each`, which requests the pages for you.
|
|
80
|
+
*/
|
|
76
81
|
search: <R extends ResourceKey>(input: Omit<DataSearchInput, "resource"> & {
|
|
77
82
|
resource: R;
|
|
78
83
|
}) => Promise<SearchOutput<R>>;
|
|
@@ -100,6 +105,7 @@ export declare const data: {
|
|
|
100
105
|
}) => Promise<{
|
|
101
106
|
id: string;
|
|
102
107
|
} & Record<string, unknown>>;
|
|
108
|
+
/** Create all of `records` in one call. The call has no limit on the number of records. */
|
|
103
109
|
createMany: <R extends ResourceKey>(input: Omit<DataCreateManyInput, "resource" | "records"> & {
|
|
104
110
|
resource: R;
|
|
105
111
|
records: Array<InputOf<R>>;
|
|
@@ -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 = 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 =
|
|
231
|
+
export type CallbackGetOutput = unknown;
|
|
64
232
|
export interface CallbackRemoveInput {
|
|
65
233
|
key: string;
|
|
66
234
|
}
|
|
@@ -69,12 +237,18 @@ 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;
|
|
76
244
|
valueField?: string | null;
|
|
77
245
|
filters?: unknown;
|
|
246
|
+
/**
|
|
247
|
+
* Maximum number of categories to show.
|
|
248
|
+
* From 1 to 50.
|
|
249
|
+
* @minimum 1
|
|
250
|
+
* @maximum 50
|
|
251
|
+
*/
|
|
78
252
|
limit?: number | null;
|
|
79
253
|
}
|
|
80
254
|
export type ChartDistributionOutput = Array<{
|
|
@@ -101,6 +275,12 @@ export interface ChartLeaderboardInput {
|
|
|
101
275
|
valueField?: string | null;
|
|
102
276
|
metricName: string;
|
|
103
277
|
filters?: unknown;
|
|
278
|
+
/**
|
|
279
|
+
* Number of top entries to return.
|
|
280
|
+
* From 1 to 100.
|
|
281
|
+
* @minimum 1
|
|
282
|
+
* @maximum 100
|
|
283
|
+
*/
|
|
104
284
|
limit: number;
|
|
105
285
|
}
|
|
106
286
|
export type ChartLeaderboardOutput = Array<{
|
|
@@ -120,6 +300,12 @@ export interface ChartTimeSeriesInput {
|
|
|
120
300
|
[key: string]: unknown;
|
|
121
301
|
}>;
|
|
122
302
|
filters?: unknown;
|
|
303
|
+
/**
|
|
304
|
+
* Maximum number of time periods to return.
|
|
305
|
+
* From 1 to 1000.
|
|
306
|
+
* @minimum 1
|
|
307
|
+
* @maximum 1000
|
|
308
|
+
*/
|
|
123
309
|
limit?: number | null;
|
|
124
310
|
}
|
|
125
311
|
export type ChartTimeSeriesOutput = Array<Record<string, unknown>>;
|
|
@@ -139,6 +325,12 @@ export interface DataAggregateMetricsInput {
|
|
|
139
325
|
direction?: "asc" | "desc";
|
|
140
326
|
[key: string]: unknown;
|
|
141
327
|
}>;
|
|
328
|
+
/**
|
|
329
|
+
* Maximum number of groups to return.
|
|
330
|
+
* From 1 to 1000.
|
|
331
|
+
* @minimum 1
|
|
332
|
+
* @maximum 1000
|
|
333
|
+
*/
|
|
142
334
|
limit?: number | null;
|
|
143
335
|
}
|
|
144
336
|
export type DataAggregateMetricsOutput = Array<Record<string, unknown>>;
|
|
@@ -153,7 +345,18 @@ export interface DataCountInput {
|
|
|
153
345
|
}>;
|
|
154
346
|
relations?: Array<string>;
|
|
155
347
|
recordScope?: "active" | "archived" | "activeOrArchived" | null;
|
|
348
|
+
/**
|
|
349
|
+
* The page number.
|
|
350
|
+
* At least 1.
|
|
351
|
+
* @minimum 1
|
|
352
|
+
*/
|
|
156
353
|
page?: number | null;
|
|
354
|
+
/**
|
|
355
|
+
* The number of records per page.
|
|
356
|
+
* From 1 to 100.
|
|
357
|
+
* @minimum 1
|
|
358
|
+
* @maximum 100
|
|
359
|
+
*/
|
|
157
360
|
pageSize?: number | null;
|
|
158
361
|
}
|
|
159
362
|
export type DataCountOutput = number;
|
|
@@ -253,7 +456,18 @@ export interface DataSearchInput {
|
|
|
253
456
|
}>;
|
|
254
457
|
relations?: Array<string>;
|
|
255
458
|
recordScope?: "active" | "archived" | "activeOrArchived" | null;
|
|
459
|
+
/**
|
|
460
|
+
* The page number.
|
|
461
|
+
* At least 1.
|
|
462
|
+
* @minimum 1
|
|
463
|
+
*/
|
|
256
464
|
page?: number | null;
|
|
465
|
+
/**
|
|
466
|
+
* The number of records per page.
|
|
467
|
+
* From 1 to 100.
|
|
468
|
+
* @minimum 1
|
|
469
|
+
* @maximum 100
|
|
470
|
+
*/
|
|
257
471
|
pageSize?: number | null;
|
|
258
472
|
paging?: "cursor" | "page" | null;
|
|
259
473
|
after?: string | null;
|
|
@@ -273,6 +487,12 @@ export interface DataSemanticSearchInput {
|
|
|
273
487
|
resource: string;
|
|
274
488
|
query: string;
|
|
275
489
|
filters?: unknown;
|
|
490
|
+
/**
|
|
491
|
+
* The maximum number of records to return.
|
|
492
|
+
* From 1 to 100.
|
|
493
|
+
* @minimum 1
|
|
494
|
+
* @maximum 100
|
|
495
|
+
*/
|
|
276
496
|
topK?: number | null;
|
|
277
497
|
recordScope?: "active" | "archived" | "activeOrArchived" | null;
|
|
278
498
|
}
|
|
@@ -292,7 +512,18 @@ export interface DataSumInput {
|
|
|
292
512
|
}>;
|
|
293
513
|
relations?: Array<string>;
|
|
294
514
|
recordScope?: "active" | "archived" | "activeOrArchived" | null;
|
|
515
|
+
/**
|
|
516
|
+
* The page number.
|
|
517
|
+
* At least 1.
|
|
518
|
+
* @minimum 1
|
|
519
|
+
*/
|
|
295
520
|
page?: number | null;
|
|
521
|
+
/**
|
|
522
|
+
* The number of records per page.
|
|
523
|
+
* From 1 to 100.
|
|
524
|
+
* @minimum 1
|
|
525
|
+
* @maximum 100
|
|
526
|
+
*/
|
|
296
527
|
pageSize?: number | null;
|
|
297
528
|
field: string;
|
|
298
529
|
}
|
|
@@ -317,7 +548,7 @@ export interface DataValidateInput {
|
|
|
317
548
|
resource: string;
|
|
318
549
|
data: Record<string, unknown>;
|
|
319
550
|
}
|
|
320
|
-
export type DataValidateOutput =
|
|
551
|
+
export type DataValidateOutput = unknown;
|
|
321
552
|
export interface DateAddInput {
|
|
322
553
|
date: string;
|
|
323
554
|
value: number;
|
|
@@ -476,6 +707,12 @@ export interface MailSearchInput {
|
|
|
476
707
|
statuses?: Array<"bounced" | "deferred" | "delivered" | "dropped" | "failed" | "sending" | "sent" | "spam_reported" | "suppressed"> | null;
|
|
477
708
|
dateFrom?: string | null;
|
|
478
709
|
dateBefore?: string | null;
|
|
710
|
+
/**
|
|
711
|
+
* Maximum number of emails to return, newest first. Total still counts every match.
|
|
712
|
+
* From 1 to 100.
|
|
713
|
+
* @minimum 1
|
|
714
|
+
* @maximum 100
|
|
715
|
+
*/
|
|
479
716
|
limit?: number | null;
|
|
480
717
|
}
|
|
481
718
|
export type MailSearchOutput = {
|
|
@@ -719,7 +956,7 @@ export interface NumberFormatInput {
|
|
|
719
956
|
export type NumberFormatOutput = string;
|
|
720
957
|
export interface PackageInstallInputInput {
|
|
721
958
|
}
|
|
722
|
-
export type PackageInstallInputOutput =
|
|
959
|
+
export type PackageInstallInputOutput = unknown;
|
|
723
960
|
export interface PageUrlInput {
|
|
724
961
|
page: {
|
|
725
962
|
id: string;
|
|
@@ -1623,7 +1860,7 @@ export interface TiptapParseInput {
|
|
|
1623
1860
|
oneLine?: boolean;
|
|
1624
1861
|
placeholder?: string;
|
|
1625
1862
|
}
|
|
1626
|
-
export type TiptapParseOutput =
|
|
1863
|
+
export type TiptapParseOutput = unknown;
|
|
1627
1864
|
export interface TransactionBeginInput {
|
|
1628
1865
|
}
|
|
1629
1866
|
export type TransactionBeginOutput = null;
|
|
@@ -1809,7 +2046,7 @@ export interface WorkflowRunInput {
|
|
|
1809
2046
|
runAsRecord?: string | null;
|
|
1810
2047
|
executionMode?: "async" | "sync" | null;
|
|
1811
2048
|
}
|
|
1812
|
-
export type WorkflowRunOutput =
|
|
2049
|
+
export type WorkflowRunOutput = unknown;
|
|
1813
2050
|
export interface WorkflowUrlInput {
|
|
1814
2051
|
workflow: {
|
|
1815
2052
|
id: string;
|
|
@@ -1826,7 +2063,7 @@ export interface WorkspaceSetValueInput {
|
|
|
1826
2063
|
key: string;
|
|
1827
2064
|
value?: unknown;
|
|
1828
2065
|
}
|
|
1829
|
-
export type WorkspaceSetValueOutput =
|
|
2066
|
+
export type WorkspaceSetValueOutput = unknown;
|
|
1830
2067
|
export interface WorkspaceSetValuesInput {
|
|
1831
2068
|
values?: Record<string, unknown>;
|
|
1832
2069
|
}
|
|
@@ -1835,7 +2072,7 @@ export interface WorkspaceValueInput {
|
|
|
1835
2072
|
key: string;
|
|
1836
2073
|
defaultValue?: unknown;
|
|
1837
2074
|
}
|
|
1838
|
-
export type WorkspaceValueOutput =
|
|
2075
|
+
export type WorkspaceValueOutput = unknown;
|
|
1839
2076
|
export interface WorkspaceValuesInput {
|
|
1840
2077
|
}
|
|
1841
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
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
web,
|
|
38
38
|
workflow,
|
|
39
39
|
workspace
|
|
40
|
-
} from "./chunks/chunk-
|
|
40
|
+
} from "./chunks/chunk-7MUIXOH5.js";
|
|
41
41
|
import {
|
|
42
42
|
InputField,
|
|
43
43
|
InputSchema,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
setTransport,
|
|
50
50
|
v,
|
|
51
51
|
validateWorkflowInput
|
|
52
|
-
} from "./chunks/chunk-
|
|
52
|
+
} from "./chunks/chunk-EU2ME5WR.js";
|
|
53
53
|
import {
|
|
54
54
|
HostError,
|
|
55
55
|
WorkflowFailure,
|
package/dist/notifications.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ type Declared = [keyof WorkspaceNotificationTypes] extends [never] ? false : tru
|
|
|
6
6
|
export type NotificationTypeKey = Declared extends true ? Entry extends {
|
|
7
7
|
id: infer I;
|
|
8
8
|
} ? I : never : string;
|
|
9
|
-
type
|
|
10
|
-
id:
|
|
11
|
-
}
|
|
9
|
+
type MatchingEntry<E, T> = E extends {
|
|
10
|
+
id: infer I;
|
|
11
|
+
} ? (T extends I ? E : never) : never;
|
|
12
|
+
type EntryFor<T> = MatchingEntry<Entry, T>;
|
|
12
13
|
/**
|
|
13
14
|
* The template ids of one notification type under `Channel`: every template, or only the
|
|
14
15
|
* templates with email or SMS on. Any string while the workspace declares no types.
|