@tailor-platform/sdk 1.78.0 → 1.79.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/CHANGELOG.md +12 -0
- package/dist/application-BB6BlUfk.mjs +3 -0
- package/dist/{application-CUxVA7Fs.mjs → application-fjqb-Gh8.mjs} +50 -3
- package/dist/application-fjqb-Gh8.mjs.map +1 -0
- package/dist/cli/index.mjs +13 -35
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/index.mjs +7 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/tailordb/schema.d.mts +1 -7
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
- package/dist/configure/types/type.d.mts +1 -9
- package/dist/{globals-CvizbGLY.mjs → globals-B-n_3uYu.mjs} +11 -5
- package/dist/globals-B-n_3uYu.mjs.map +1 -0
- package/dist/{registry-CYBRvfaU.mjs → registry-CXi7rJq7.mjs} +3 -2
- package/dist/registry-CXi7rJq7.mjs.map +1 -0
- package/dist/runtime/field-parse.d.mts +11 -0
- package/dist/runtime/globals.d.mts +4 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +79 -15
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{runtime-BD2vYJFT.mjs → runtime-CjMeYuPA.mjs} +4 -4
- package/dist/{runtime-BD2vYJFT.mjs.map → runtime-CjMeYuPA.mjs.map} +1 -1
- package/dist/{schema-U6DxoZ8D.mjs → schema-CYrle8JZ.mjs} +42 -24
- package/dist/schema-CYrle8JZ.mjs.map +1 -0
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +36 -10
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +29 -15
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workflow-CkIDJpdg.mjs +69 -0
- package/dist/workflow-CkIDJpdg.mjs.map +1 -0
- package/docs/runtime.md +2 -2
- package/docs/services/tailordb.md +2 -0
- package/docs/services/workflow.md +2 -2
- package/docs/testing.md +2 -2
- package/package.json +1 -1
- package/dist/application-CUxVA7Fs.mjs.map +0 -1
- package/dist/application-Dp_-ioiP.mjs +0 -3
- package/dist/configure/types/field-runtime.d.mts +0 -17
- package/dist/globals-CvizbGLY.mjs.map +0 -1
- package/dist/registry-CYBRvfaU.mjs.map +0 -1
- package/dist/schema-U6DxoZ8D.mjs.map +0 -1
- package/dist/workflow-DSwnYPPP.mjs +0 -45
- package/dist/workflow-DSwnYPPP.mjs.map +0 -1
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { TailorEnv } from "../../runtime/types.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { StartJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
|
|
3
3
|
import { WorkflowJob } from "../../configure/services/workflow/job.mjs";
|
|
4
4
|
import { Workflow } from "../../configure/services/workflow/workflow.mjs";
|
|
5
5
|
import { WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
|
|
6
6
|
import { Mock } from "vitest";
|
|
7
7
|
//#region src/vitest/mocks/workflow.d.ts
|
|
8
|
-
type JobHandler = (jobName: string, args: unknown, options?:
|
|
9
|
-
type
|
|
10
|
-
authInvoker?: {
|
|
11
|
-
namespace: string;
|
|
12
|
-
machineUserName: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
type TriggerHandlerFn = (workflowName: string, args: unknown, options?: TriggerWorkflowOptions) => string;
|
|
8
|
+
type JobHandler = (jobName: string, args: unknown, options?: StartJobFunctionOptions) => unknown;
|
|
9
|
+
type TriggerHandlerFn = (workflowName: string, args: unknown, options?: StartWorkflowOptions) => string;
|
|
16
10
|
type ResumeHandlerFn = (executionId: string) => string;
|
|
17
11
|
type WaitHandlerFn = (key: string, payload: unknown) => unknown;
|
|
18
12
|
type ResolveHandler = (executionId: string, key: string, callback: (payload: unknown) => unknown) => unknown | Promise<unknown>;
|
|
@@ -23,12 +17,17 @@ type SetWaitHandler = {
|
|
|
23
17
|
interface TriggeredJob {
|
|
24
18
|
jobName: string;
|
|
25
19
|
args: unknown;
|
|
26
|
-
options?:
|
|
20
|
+
options?: StartJobFunctionOptions;
|
|
27
21
|
}
|
|
28
22
|
type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
|
|
29
23
|
/**
|
|
30
24
|
* Acquire a disposable mock for workflow operations (`tailor.workflow`).
|
|
31
25
|
* Restored on dispose.
|
|
26
|
+
*
|
|
27
|
+
* Canonical names (`startWorkflow`, `startJobFunction`, `resumeWorkflowExecution`)
|
|
28
|
+
* and their frozen aliases (`triggerWorkflow`, `triggerJobFunction`, `resumeWorkflow`)
|
|
29
|
+
* share the same underlying `vi.fn`, so calls through either name are recorded
|
|
30
|
+
* once and handlers configured on either name apply to both.
|
|
32
31
|
* @returns Disposable workflow mock control object
|
|
33
32
|
* @example
|
|
34
33
|
* ```typescript
|
|
@@ -44,11 +43,26 @@ type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
|
|
|
44
43
|
* ```
|
|
45
44
|
*/
|
|
46
45
|
declare function mockWorkflow(): {
|
|
47
|
-
/** The `
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/** The `startJobFunction` `vi.fn`. */
|
|
47
|
+
startJobFunction: Mock<(jobName: string, args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Frozen alias of `startJobFunction` (same `vi.fn` reference).
|
|
50
|
+
* @deprecated Use `startJobFunction` instead.
|
|
51
|
+
*/
|
|
52
|
+
triggerJobFunction: Mock<(jobName: string, args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
|
|
53
|
+
/** The `startWorkflow` `vi.fn`. */
|
|
54
|
+
startWorkflow: Mock<(workflowName: string, args?: unknown, _options?: StartWorkflowOptions) => Promise<string>>;
|
|
55
|
+
/**
|
|
56
|
+
* Frozen alias of `startWorkflow` (same `vi.fn` reference).
|
|
57
|
+
* @deprecated Use `startWorkflow` instead.
|
|
58
|
+
*/
|
|
59
|
+
triggerWorkflow: Mock<(workflowName: string, args?: unknown, _options?: StartWorkflowOptions) => Promise<string>>;
|
|
60
|
+
/** The `resumeWorkflowExecution` `vi.fn`. */
|
|
61
|
+
resumeWorkflowExecution: Mock<(executionId: string) => Promise<string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Frozen alias of `resumeWorkflowExecution` (same `vi.fn` reference).
|
|
64
|
+
* @deprecated Use `resumeWorkflowExecution` instead.
|
|
65
|
+
*/
|
|
52
66
|
resumeWorkflow: Mock<(executionId: string) => Promise<string>>;
|
|
53
67
|
/** The `wait` `vi.fn`. */
|
|
54
68
|
wait: Mock<(_key: string, _payload?: unknown) => unknown>;
|
package/dist/vitest/setup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RUNTIME_FLAG_KEY } from "../globals-
|
|
1
|
+
import { t as RUNTIME_FLAG_KEY } from "../globals-B-n_3uYu.mjs";
|
|
2
2
|
import { t as mockSecretmanager } from "../secretmanager-IY4UvinW.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { afterEach, beforeAll, beforeEach } from "vitest";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-DXywRVcq.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/workflow.ts
|
|
4
|
+
var workflow_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
resolve: () => resolve,
|
|
6
|
+
resumeWorkflow: () => resumeWorkflow,
|
|
7
|
+
resumeWorkflowExecution: () => resumeWorkflowExecution,
|
|
8
|
+
startJobFunction: () => startJobFunction,
|
|
9
|
+
startWorkflow: () => startWorkflow,
|
|
10
|
+
triggerJobFunction: () => triggerJobFunction,
|
|
11
|
+
triggerWorkflow: () => triggerWorkflow,
|
|
12
|
+
wait: () => wait
|
|
13
|
+
});
|
|
14
|
+
const api = () => globalThis.tailor.workflow;
|
|
15
|
+
/**
|
|
16
|
+
* See {@link TailorWorkflowAPI.startWorkflow}.
|
|
17
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.startWorkflow}
|
|
18
|
+
* @returns The execution ID of the started workflow
|
|
19
|
+
*/
|
|
20
|
+
const startWorkflow = (...args) => api().startWorkflow(...args);
|
|
21
|
+
/**
|
|
22
|
+
* Frozen alias for {@link startWorkflow}. Kept for backward compatibility.
|
|
23
|
+
* @deprecated Use {@link startWorkflow} instead.
|
|
24
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}
|
|
25
|
+
* @returns The execution ID of the triggered workflow
|
|
26
|
+
*/
|
|
27
|
+
const triggerWorkflow = (...args) => api().triggerWorkflow(...args);
|
|
28
|
+
/**
|
|
29
|
+
* See {@link TailorWorkflowAPI.resumeWorkflowExecution}.
|
|
30
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflowExecution}
|
|
31
|
+
* @returns The execution ID of the resumed workflow
|
|
32
|
+
*/
|
|
33
|
+
const resumeWorkflowExecution = (...args) => api().resumeWorkflowExecution(...args);
|
|
34
|
+
/**
|
|
35
|
+
* Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.
|
|
36
|
+
* @deprecated Use {@link resumeWorkflowExecution} instead.
|
|
37
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflow}
|
|
38
|
+
* @returns The execution ID of the resumed workflow
|
|
39
|
+
*/
|
|
40
|
+
const resumeWorkflow = (...args) => api().resumeWorkflow(...args);
|
|
41
|
+
/**
|
|
42
|
+
* See {@link TailorWorkflowAPI.startJobFunction}.
|
|
43
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}
|
|
44
|
+
* @returns The job's return value
|
|
45
|
+
*/
|
|
46
|
+
const startJobFunction = (...args) => api().startJobFunction(...args);
|
|
47
|
+
/**
|
|
48
|
+
* Frozen alias for {@link startJobFunction}. Kept for backward compatibility.
|
|
49
|
+
* @deprecated Use {@link startJobFunction} instead.
|
|
50
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}
|
|
51
|
+
* @returns The job's return value
|
|
52
|
+
*/
|
|
53
|
+
const triggerJobFunction = (...args) => api().triggerJobFunction(...args);
|
|
54
|
+
/**
|
|
55
|
+
* See {@link TailorWorkflowAPI.wait}.
|
|
56
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.wait}
|
|
57
|
+
* @returns The payload supplied by the corresponding `resolve` call
|
|
58
|
+
*/
|
|
59
|
+
const wait = (...args) => api().wait(...args);
|
|
60
|
+
/**
|
|
61
|
+
* See {@link TailorWorkflowAPI.resolve}.
|
|
62
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.resolve}
|
|
63
|
+
* @returns A promise that resolves once the resolve has been recorded
|
|
64
|
+
*/
|
|
65
|
+
const resolve = (...args) => api().resolve(...args);
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { startWorkflow as a, wait as c, startJobFunction as i, workflow_exports as l, resumeWorkflow as n, triggerJobFunction as o, resumeWorkflowExecution as r, triggerWorkflow as s, resolve as t };
|
|
69
|
+
//# sourceMappingURL=workflow-CkIDJpdg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-CkIDJpdg.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `mockWorkflow`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n *\n * The canonical names (`startWorkflow`, `startJobFunction`,\n * `resumeWorkflowExecution`) mirror the public `tailor.v1` RPC vocabulary.\n * The pre-alignment names (`triggerWorkflow`, `triggerJobFunction`,\n * `resumeWorkflow`) are kept as frozen aliases that reference the same platform\n * implementations, so existing code continues to work unchanged.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.startWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface AuthInvoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link startWorkflow}. */\nexport interface StartWorkflowOptions {\n /** Optional authentication invoker to specify which machine user should execute the workflow */\n authInvoker?: AuthInvoker;\n}\n\n/**\n * Frozen alias for {@link StartWorkflowOptions}. Kept for backward compatibility.\n * @deprecated Use {@link StartWorkflowOptions} instead.\n */\nexport type TriggerWorkflowOptions = StartWorkflowOptions;\n\ndeclare const executionPolicyKeyBrand: unique symbol;\n\n/**\n * A concrete runtime key produced by an execution policy instance — either an\n * exact-match policy's `.key`, or a wildcard policy's `.keyFor(suffix)` (see\n * `defineWorkflowExecutionPolicies`). Branded so an arbitrary string that\n * wasn't derived from a declared policy can't be passed as `executionPolicyKey`.\n */\nexport type ExecutionPolicyKey = string & { readonly [executionPolicyKeyBrand]: never };\n\n/** Options for {@link startJobFunction}. */\nexport interface StartJobFunctionOptions {\n /**\n * Execution policy key matched by the platform against the policies\n * declared with `defineWorkflowExecutionPolicies` in `tailor.config.ts`.\n */\n executionPolicyKey?: ExecutionPolicyKey;\n}\n\n/**\n * Frozen alias for {@link StartJobFunctionOptions}. Kept for backward compatibility.\n * @deprecated Use {@link StartJobFunctionOptions} instead.\n */\nexport type TriggerJobFunctionOptions = StartJobFunctionOptions;\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as workflow from\n * \"@tailor-platform/sdk/runtime/workflow\"` or pick individual methods.\n */\nexport interface TailorWorkflowAPI {\n /**\n * Starts a workflow and returns its execution ID.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link triggerWorkflow} is a frozen alias that resolves to the same\n * platform implementation.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional start options (e.g. `authInvoker`)\n * @returns The execution ID of the started workflow\n */\n startWorkflow(workflowName: string, args?: any, options?: StartWorkflowOptions): Promise<string>;\n\n /**\n * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.\n * @deprecated Use {@link startWorkflow} instead.\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Resumes a failed or pending-retry workflow execution and returns its execution ID.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link resumeWorkflow} is a frozen alias that resolves to the same\n * platform implementation.\n * @param executionId - The execution to resume\n * @returns The execution ID of the resumed workflow\n */\n resumeWorkflowExecution(executionId: string): Promise<string>;\n\n /**\n * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.\n * @deprecated Use {@link resumeWorkflowExecution} instead.\n */\n resumeWorkflow(executionId: string): Promise<string>;\n\n /**\n * Starts a job function and returns its result.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link triggerJobFunction} is a frozen alias that resolves to the same\n * platform implementation.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @param options - Optional start options (e.g. `executionPolicyKey`)\n * @returns The job's return value\n */\n startJobFunction(jobName: string, args?: any, options?: StartJobFunctionOptions): any;\n\n /**\n * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link startJobFunction} instead.\n */\n triggerJobFunction(jobName: string, args?: any, options?: TriggerJobFunctionOptions): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\nconst api = (): TailorWorkflowAPI =>\n (globalThis as { tailor: { workflow: TailorWorkflowAPI } }).tailor.workflow;\n\n/**\n * See {@link TailorWorkflowAPI.startWorkflow}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.startWorkflow}\n * @returns The execution ID of the started workflow\n */\nexport const startWorkflow: TailorWorkflowAPI[\"startWorkflow\"] = (...args) =>\n api().startWorkflow(...args);\n\n/**\n * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.\n * @deprecated Use {@link startWorkflow} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}\n * @returns The execution ID of the triggered workflow\n */\nexport const triggerWorkflow: TailorWorkflowAPI[\"triggerWorkflow\"] = (...args) =>\n api().triggerWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.resumeWorkflowExecution}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflowExecution}\n * @returns The execution ID of the resumed workflow\n */\nexport const resumeWorkflowExecution: TailorWorkflowAPI[\"resumeWorkflowExecution\"] = (...args) =>\n api().resumeWorkflowExecution(...args);\n\n/**\n * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.\n * @deprecated Use {@link resumeWorkflowExecution} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflow}\n * @returns The execution ID of the resumed workflow\n */\nexport const resumeWorkflow: TailorWorkflowAPI[\"resumeWorkflow\"] = (...args) =>\n api().resumeWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.startJobFunction}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}\n * @returns The job's return value\n */\nexport const startJobFunction: TailorWorkflowAPI[\"startJobFunction\"] = (...args) =>\n api().startJobFunction(...args);\n\n/**\n * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link startJobFunction} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}\n * @returns The job's return value\n */\nexport const triggerJobFunction: TailorWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\n/**\n * See {@link TailorWorkflowAPI.wait}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.wait}\n * @returns The payload supplied by the corresponding `resolve` call\n */\nexport const wait: TailorWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\n/**\n * See {@link TailorWorkflowAPI.resolve}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resolve}\n * @returns A promise that resolves once the resolve has been recorded\n */\nexport const resolve: TailorWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n"],"mappings":";;;;;;;;;;;;;AA0JA,MAAM,YACH,WAA2D,OAAO;;;;;;AAOrE,MAAa,iBAAqD,GAAG,SACnE,IAAI,CAAC,CAAC,cAAc,GAAG,IAAI;;;;;;;AAQ7B,MAAa,mBAAyD,GAAG,SACvE,IAAI,CAAC,CAAC,gBAAgB,GAAG,IAAI;;;;;;AAO/B,MAAa,2BAAyE,GAAG,SACvF,IAAI,CAAC,CAAC,wBAAwB,GAAG,IAAI;;;;;;;AAQvC,MAAa,kBAAuD,GAAG,SACrE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;;;;;;AAO9B,MAAa,oBAA2D,GAAG,SACzE,IAAI,CAAC,CAAC,iBAAiB,GAAG,IAAI;;;;;;;AAQhC,MAAa,sBAA+D,GAAG,SAC7E,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI;;;;;;AAOlC,MAAa,QAAmC,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI;;;;;;AAO9E,MAAa,WAAyC,GAAG,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI"}
|
package/docs/runtime.md
CHANGED
|
@@ -31,7 +31,7 @@ const token = await authconnection.getConnectionToken("google");
|
|
|
31
31
|
const client = new idp.Client({ namespace: "my-namespace" });
|
|
32
32
|
const { users } = await client.users({ first: 10 });
|
|
33
33
|
|
|
34
|
-
const executionId = await workflow.
|
|
34
|
+
const executionId = await workflow.startWorkflow("approval", { reportId });
|
|
35
35
|
|
|
36
36
|
const invoker = context.getInvoker();
|
|
37
37
|
|
|
@@ -79,7 +79,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
|
|
|
79
79
|
- `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
|
|
80
80
|
- `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
|
|
81
81
|
- `idp` — IdP user management (`new Client({ namespace })`)
|
|
82
|
-
- `workflow` — workflow & job control (`
|
|
82
|
+
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
|
|
83
83
|
- `context` — execution context (`getInvoker`)
|
|
84
84
|
- `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`, `openDownloadStream` _(deprecated)_)
|
|
85
85
|
- `aigateway` — AI Gateway URL resolution (`get`)
|
|
@@ -672,6 +672,8 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
|
|
|
672
672
|
|
|
673
673
|
**Important**: Following the secure-by-default principle, all operations are denied if permissions are not configured. You must explicitly grant permissions for each operation (create, read, update, delete).
|
|
674
674
|
|
|
675
|
+
`generate`/`deploy` reject a type that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a type only needs record-level permission.
|
|
676
|
+
|
|
675
677
|
```typescript
|
|
676
678
|
db.type("User", {
|
|
677
679
|
name: db.string(),
|
|
@@ -401,7 +401,7 @@ An exact-key policy applies to dispatches whose runtime key equals the policy ke
|
|
|
401
401
|
|
|
402
402
|
### Referencing a Policy from a Workflow
|
|
403
403
|
|
|
404
|
-
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.
|
|
404
|
+
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.startJobFunction()` (or its frozen alias `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
|
|
405
405
|
|
|
406
406
|
```typescript
|
|
407
407
|
import { createWorkflowJob } from "@tailor-platform/sdk";
|
|
@@ -427,7 +427,7 @@ export const mainJob = createWorkflowJob({
|
|
|
427
427
|
});
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
The same `executionPolicyKey` option is available on `tailor.workflow.
|
|
430
|
+
The same `executionPolicyKey` option is available on `tailor.workflow.startJobFunction(name, args, options)` (or the frozen alias `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
|
|
431
431
|
|
|
432
432
|
## Triggering a Workflow from a Resolver
|
|
433
433
|
|
package/docs/testing.md
CHANGED
|
@@ -598,7 +598,7 @@ describe("resolveApproval resolver", () => {
|
|
|
598
598
|
|
|
599
599
|
#### Resolvers that resume failed workflows
|
|
600
600
|
|
|
601
|
-
Resolvers or executors that call `workflow.
|
|
601
|
+
Resolvers or executors that call `workflow.resumeWorkflowExecution(executionId)` delegate to `tailor.workflow.resumeWorkflowExecution` at runtime. With the `tailor-runtime` environment active, use `mockWorkflow().setResumeHandler` to control the returned execution ID and inspect `resumeWorkflowExecution.mock.calls`:
|
|
602
602
|
|
|
603
603
|
```typescript
|
|
604
604
|
import { unauthenticatedTailorUser } from "@tailor-platform/sdk/test";
|
|
@@ -618,7 +618,7 @@ describe("retryFailedWorkflow resolver", () => {
|
|
|
618
618
|
});
|
|
619
619
|
|
|
620
620
|
expect(result).toEqual({ resumedExecutionId: "exec-resumed-123" });
|
|
621
|
-
expect(wf.
|
|
621
|
+
expect(wf.resumeWorkflowExecution.mock.calls).toEqual([["exec-failed-456"]]);
|
|
622
622
|
});
|
|
623
623
|
});
|
|
624
624
|
```
|