@diagonal-hq/cli 0.33.8 → 0.34.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 +2 -2
- package/dist/cli.mjs +21 -11
- package/dist/index.d.ts +1 -1
- package/dist/sdk-contract.d.ts +2 -2
- package/dist/workflow/generated/capabilities.d.ts +1 -1
- package/dist/workflow/workflow.d.ts +27 -10
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1053,7 +1053,7 @@ type ConfigBase = UidOption & SlugOption & WorkflowLabel & { description?: strin
|
|
|
1053
1053
|
/**
|
|
1054
1054
|
* The config of a `workflows/<name>.ts` or migration file: the first argument of
|
|
1055
1055
|
* `export default defineWorkflow(config, handler)` from `@diagonal/workflow`, which adds the
|
|
1056
|
-
* `input`
|
|
1056
|
+
* `input` and `output` schemas and the `validate` function. The build reads every other option as static
|
|
1057
1057
|
* data and never runs it. `diagonal check` writes a missing `uid`. A background trigger
|
|
1058
1058
|
* (recordEvent, recordSchedule, scheduled, workflowEvent) needs `runAs`. A request workflow runs
|
|
1059
1059
|
* as the caller (`'session'`) by default.
|
package/dist/sdk-contract.d.ts
CHANGED
|
@@ -2004,7 +2004,7 @@ type ApiError = Error & {
|
|
|
2004
2004
|
readonly body: any;
|
|
2005
2005
|
};
|
|
2006
2006
|
|
|
2007
|
-
type SdkCalendarUnavailableReason = 'signed_out' | '
|
|
2007
|
+
type SdkCalendarUnavailableReason = 'signed_out' | 'branch' | 'not_schedulable';
|
|
2008
2008
|
|
|
2009
2009
|
type SdkCalendarLinkState = 'active' | 'waiting_for_write_access' | 'broken';
|
|
2010
2010
|
|
|
@@ -7335,7 +7335,7 @@ type SdkHooks = {
|
|
|
7335
7335
|
* signed-in identity's own calendars and needs no permission. Another staff record needs
|
|
7336
7336
|
* "Manage calendar connections" and Show access to the record. A viewer connects Google
|
|
7337
7337
|
* accounts and adds calendars only through their own accounts. Nothing is available
|
|
7338
|
-
*
|
|
7338
|
+
* in a branch, for a signed-out visitor (no request
|
|
7339
7339
|
* is made), and for an identity that is not a Schedulable record: check `available` and
|
|
7340
7340
|
* render nothing. Every write refreshes the data and rejects with an `ApiError` on a
|
|
7341
7341
|
* refusal: read its text with `Sdk.utils.error.apiErrorMessage(error)`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResourceKeyWith } from '../data';
|
|
2
2
|
import type { ContentDocument } from '../input';
|
|
3
3
|
import type { DeepReadonly, Liquid, StaticLiquid } from '../liquid';
|
|
4
|
-
export declare const SDK_VERSION =
|
|
4
|
+
export declare const SDK_VERSION = 77;
|
|
5
5
|
export interface WorkspaceSystemFields {
|
|
6
6
|
"ai_custom_system_prompt": string | null;
|
|
7
7
|
"brand_kit": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ResourceKeyWith } from './data';
|
|
2
2
|
import type { ScriptHostContext } from './index';
|
|
3
|
-
import { InputSchema, type InferInput, type InputFieldSpec, type InputShape } from './input';
|
|
3
|
+
import { type Infer, type InputField, InputSchema, type InferInput, type InputFieldSpec, type InputShape } from './input';
|
|
4
4
|
import type { WorkflowConfig } from './workflow-config';
|
|
5
5
|
export interface Identity {
|
|
6
6
|
id: string;
|
|
@@ -90,23 +90,40 @@ export type InputValidator<I> = (input: I, ctx: WorkflowContext) => InputErrors<
|
|
|
90
90
|
/** Runs a script's input validator and ends the run with a validation error when it reports one. */
|
|
91
91
|
export declare function validateWorkflowInput<I>(validator: InputValidator<I>, input: I, ctx: WorkflowContext): Promise<void>;
|
|
92
92
|
type Handler<I, O> = (input: I, ctx: WorkflowContext) => Promise<O> | O;
|
|
93
|
+
/** A declared output: any `v` field, usually `v.object({ ... })`. */
|
|
94
|
+
type OutputField = InputField<unknown, boolean>;
|
|
95
|
+
/** The handler input of a config: the type of its `input` schema, or `I` without one. */
|
|
96
|
+
type ConfigInput<C, I> = C extends InputSchema<infer S> ? InferInput<S> : I;
|
|
97
|
+
/**
|
|
98
|
+
* A value of a declared output type that a handler may return. A const context makes a returned
|
|
99
|
+
* array a readonly tuple, so arrays and objects may be readonly at every level.
|
|
100
|
+
*/
|
|
101
|
+
type Returnable<T> = T extends readonly (infer E)[] ? readonly Returnable<E>[] : T extends object ? {
|
|
102
|
+
readonly [K in keyof T]: Returnable<T[K]>;
|
|
103
|
+
} : T;
|
|
104
|
+
/** The handler result of a config: the type of its `output` schema, or `O` without one. */
|
|
105
|
+
type ConfigOutput<F, O> = F extends OutputField ? Infer<F> : O;
|
|
93
106
|
/**
|
|
94
107
|
* Declares a workflow. A file-based workflow passes its config first, as `definePage` does. The
|
|
95
108
|
* build reads the config as static data. With an `input` schema in the config, or a schema first,
|
|
96
109
|
* the platform validates every run's input against it before the script starts, and the handler's
|
|
97
110
|
* `input` type comes from the schema. A `validate` function in the config runs after that check
|
|
98
|
-
* and before the handler, with the same input type.
|
|
111
|
+
* and before the handler, with the same input type. With an `output` schema in the config of a
|
|
112
|
+
* file-based workflow, the handler must return a value of that type: the platform documents it as
|
|
113
|
+
* the response of a Request workflow and verifies each return value against it.
|
|
99
114
|
*/
|
|
100
|
-
export declare function defineWorkflow<
|
|
101
|
-
readonly input
|
|
102
|
-
readonly
|
|
103
|
-
|
|
115
|
+
export declare function defineWorkflow<const O, C extends InputSchema<InputShape> | undefined = undefined, I = Record<string, unknown>>(config: WorkflowConfig & {
|
|
116
|
+
readonly input?: C;
|
|
117
|
+
readonly output: InputField<O, boolean>;
|
|
118
|
+
readonly validate?: InputValidator<ConfigInput<C, I>>;
|
|
119
|
+
}, handler: Handler<ConfigInput<C, I>, Returnable<NoInfer<O>>>): WorkflowDefinition<ConfigInput<C, I>, O>;
|
|
104
120
|
export declare function defineWorkflow<S extends InputShape, O = unknown>(input: InputSchema<S>, handler: Handler<InferInput<S>, O>): WorkflowDefinition<InferInput<S>, O>;
|
|
105
|
-
export declare function defineWorkflow<I = Record<string, unknown>, O = unknown>(config: WorkflowConfig & {
|
|
106
|
-
readonly input?: undefined;
|
|
107
|
-
readonly validate?: InputValidator<I>;
|
|
108
|
-
}, handler: Handler<I, O>): WorkflowDefinition<I, O>;
|
|
109
121
|
export declare function defineWorkflow<I = Record<string, unknown>, O = unknown>(handler: Handler<I, O>): WorkflowDefinition<I, O>;
|
|
122
|
+
export declare function defineWorkflow<I = Record<string, unknown>, O = unknown, C extends InputSchema<InputShape> | undefined = undefined, F extends OutputField | undefined = undefined>(config: WorkflowConfig & {
|
|
123
|
+
readonly input?: C;
|
|
124
|
+
readonly output?: F;
|
|
125
|
+
readonly validate?: InputValidator<ConfigInput<C, I>>;
|
|
126
|
+
}, handler: Handler<ConfigInput<C, I>, ConfigOutput<F, O>>): WorkflowDefinition<ConfigInput<C, I>, ConfigOutput<F, O>>;
|
|
110
127
|
export type ResponseOutput = {
|
|
111
128
|
$response_status: number;
|
|
112
129
|
$response_body: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diagonal-hq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
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": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"bun": "1.4.4"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-
|
|
52
|
-
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-
|
|
53
|
-
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-
|
|
51
|
+
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h0ff9e054aa50",
|
|
52
|
+
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h0ff9e054aa50",
|
|
53
|
+
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h0ff9e054aa50"
|
|
54
54
|
}
|
|
55
55
|
}
|