@tailor-platform/sdk 1.76.2 → 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 +38 -0
- package/dist/application-BB6BlUfk.mjs +3 -0
- package/dist/{application-CqjCcZ2n.mjs → application-fjqb-Gh8.mjs} +57 -10
- package/dist/application-fjqb-Gh8.mjs.map +1 -0
- package/dist/cli/commands/deploy/deploy.d.mts +8 -3
- package/dist/cli/commands/show.d.mts +9 -3
- package/dist/cli/commands/workspace/create.d.mts +3 -0
- package/dist/cli/commands/workspace/list.d.mts +1 -0
- package/dist/cli/commands/workspace/transform.d.mts +2 -0
- package/dist/cli/index.mjs +47 -22
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +2 -2
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/cli/skills.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +18 -1
- package/dist/configure/index.mjs +202 -7
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/idp/index.d.mts +1 -4
- 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/{crashreport-DZDr-TvH.mjs → crashreport-BNWUM6Kf.mjs} +2 -2
- package/dist/{crashreport-DZDr-TvH.mjs.map → crashreport-BNWUM6Kf.mjs.map} +1 -1
- package/dist/{crashreport-np4-_DX2.mjs → crashreport-BafWvjjX.mjs} +1 -1
- package/dist/errors-DVFS0AZk.mjs +100 -0
- package/dist/errors-DVFS0AZk.mjs.map +1 -0
- package/dist/{globals-z6zYMjlr.mjs → globals-B-n_3uYu.mjs} +11 -5
- package/dist/globals-B-n_3uYu.mjs.map +1 -0
- package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
- package/dist/logger-BwS4ppwO.mjs.map +1 -0
- package/dist/{registry-CTgoVWc_.mjs → registry-CXi7rJq7.mjs} +4 -3
- 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-DlklyuHN.mjs → runtime-CjMeYuPA.mjs} +1169 -539
- package/dist/runtime-CjMeYuPA.mjs.map +1 -0
- package/dist/{schema-DbTR1c6M.mjs → schema-CYrle8JZ.mjs} +222 -4
- package/dist/schema-CYrle8JZ.mjs.map +1 -0
- package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
- package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
- package/dist/service-CghpdV-9.mjs +3 -0
- package/dist/{service-DBFZQloR.mjs → service-Cp0I7ZFe.mjs} +3 -3
- package/dist/{service-DBFZQloR.mjs.map → service-Cp0I7ZFe.mjs.map} +1 -1
- package/dist/{service-BCRJ-3NV.mjs → service-D12iQGcS.mjs} +2 -2
- package/dist/{service-BCRJ-3NV.mjs.map → service-D12iQGcS.mjs.map} +1 -1
- package/dist/{test-env-key-IPapa1KJ.mjs → test-env-key-DuZycyWM.mjs} +2 -2
- package/dist/{test-env-key-IPapa1KJ.mjs.map → test-env-key-DuZycyWM.mjs.map} +1 -1
- package/dist/types/auth.generated.d.mts +9 -36
- package/dist/types/executor.generated.d.mts +19 -59
- package/dist/types/idp.generated.d.mts +518 -517
- package/dist/types/resolver.generated.d.mts +6 -2
- package/dist/types/tailordb.generated.d.mts +8 -7
- package/dist/utils/test/index.mjs +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +8 -8
- package/dist/vitest/index.mjs +635 -195
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock.d.mts +8 -8
- package/dist/vitest/mocks/aigateway.d.mts +14 -4
- package/dist/vitest/mocks/authconnection.d.mts +14 -4
- package/dist/vitest/mocks/file.d.mts +24 -6
- package/dist/vitest/mocks/iconv.d.mts +28 -4
- package/dist/vitest/mocks/idp.d.mts +25 -9
- package/dist/vitest/mocks/secretmanager.d.mts +13 -4
- package/dist/vitest/mocks/tailordb.d.mts +48 -7
- package/dist/vitest/mocks/workflow.d.mts +68 -22
- package/dist/vitest/setup.mjs +2 -2
- package/dist/workflow-CkIDJpdg.mjs +69 -0
- package/dist/workflow-CkIDJpdg.mjs.map +1 -0
- package/docs/cli/application.md +58 -11
- package/docs/cli/setup.md +1 -1
- package/docs/cli/workspace.md +6 -4
- package/docs/cli-reference.md +12 -8
- package/docs/runtime.md +5 -6
- package/docs/services/aigateway.md +2 -0
- package/docs/services/tailordb.md +44 -0
- package/docs/services/workflow.md +3 -3
- package/docs/testing.md +105 -91
- package/package.json +7 -7
- package/dist/application-6zsDLGKv.mjs +0 -3
- package/dist/application-CqjCcZ2n.mjs.map +0 -1
- package/dist/configure/types/field-runtime.d.mts +0 -17
- package/dist/errors-Dtf2WPaW.mjs +0 -42
- package/dist/errors-Dtf2WPaW.mjs.map +0 -1
- package/dist/field-runtime-D4QWRiB1.mjs +0 -203
- package/dist/field-runtime-D4QWRiB1.mjs.map +0 -1
- package/dist/globals-z6zYMjlr.mjs.map +0 -1
- package/dist/logger-BEiZZ3qT.mjs.map +0 -1
- package/dist/registry-CTgoVWc_.mjs.map +0 -1
- package/dist/runtime-DlklyuHN.mjs.map +0 -1
- package/dist/schema-DbTR1c6M.mjs.map +0 -1
- package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
- package/dist/service-CPMlIg3X.mjs +0 -3
- package/dist/types-BzJ7A_fn.mjs +0 -199
- package/dist/types-BzJ7A_fn.mjs.map +0 -1
- package/dist/types-CG9H7HuE.mjs +0 -4
- package/dist/workflow-DSwnYPPP.mjs +0 -45
- package/dist/workflow-DSwnYPPP.mjs.map +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileStreamIterator, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions } from "../../runtime/file.mjs";
|
|
2
|
+
import { Mock } from "vitest";
|
|
1
3
|
//#region src/vitest/mocks/file.d.ts
|
|
2
4
|
type FileResolver = (method: string, call: FileCall) => unknown;
|
|
3
5
|
interface FileCall {
|
|
@@ -7,8 +9,14 @@ interface FileCall {
|
|
|
7
9
|
fieldName: string;
|
|
8
10
|
recordId: string;
|
|
9
11
|
}
|
|
12
|
+
/** Controls fallback behavior for File calls without a configured result. */
|
|
13
|
+
interface MockFileOptions {
|
|
14
|
+
/** Return a type-compatible fixture or throw when no behavior is configured. */
|
|
15
|
+
onUnhandled?: "fallback" | "error";
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* Acquire a disposable mock for `tailordb.file`. Restored on dispose.
|
|
19
|
+
* @param options - Controls behavior for calls without a configured result
|
|
12
20
|
* @returns Disposable File mock control object
|
|
13
21
|
* @example
|
|
14
22
|
* ```typescript
|
|
@@ -16,26 +24,36 @@ interface FileCall {
|
|
|
16
24
|
*
|
|
17
25
|
* test("mock file download", async () => {
|
|
18
26
|
* using file = mockFile();
|
|
19
|
-
* file.
|
|
27
|
+
* file.download.mockResolvedValue({ data: new Uint8Array(), metadata: { ... } });
|
|
20
28
|
* // …
|
|
21
29
|
* });
|
|
22
30
|
* ```
|
|
23
31
|
*/
|
|
24
|
-
declare function mockFile(): {
|
|
32
|
+
declare function mockFile(options?: MockFileOptions): {
|
|
25
33
|
setResolver(value: FileResolver): void;
|
|
26
34
|
/**
|
|
27
|
-
* Enqueue a single result for the next `tailordb.file` call
|
|
28
|
-
*
|
|
35
|
+
* Enqueue a single result for the next `tailordb.file` call.
|
|
36
|
+
* The queue is shared across all methods and namespaces.
|
|
29
37
|
* @param result - Result to return from the next file call
|
|
30
38
|
*/
|
|
31
39
|
enqueueResult(result: unknown): void;
|
|
32
40
|
/**
|
|
33
41
|
* Enqueue results for multiple subsequent `tailordb.file` calls.
|
|
42
|
+
* The queue is shared across all methods and namespaces.
|
|
34
43
|
* @param results - Results to enqueue, one per upcoming call
|
|
35
44
|
*/
|
|
36
45
|
enqueueResults(...results: unknown[]): void;
|
|
37
|
-
|
|
46
|
+
calls: FileCall[];
|
|
47
|
+
clear(): void;
|
|
38
48
|
reset(): void;
|
|
49
|
+
delete: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>>;
|
|
50
|
+
upload: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions) => Promise<FileUploadResponse>>;
|
|
51
|
+
download: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>>;
|
|
52
|
+
downloadAsBase64: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>>;
|
|
53
|
+
getMetadata: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileMetadata>>;
|
|
54
|
+
openDownloadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileStreamIterator>>;
|
|
55
|
+
downloadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>>;
|
|
56
|
+
uploadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions) => Promise<FileUploadResponse>>;
|
|
39
57
|
} & Disposable;
|
|
40
58
|
//#endregion
|
|
41
|
-
export { mockFile };
|
|
59
|
+
export { MockFileOptions, mockFile };
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
import { MockInstance } from "vitest";
|
|
1
2
|
//#region src/vitest/mocks/iconv.d.ts
|
|
2
3
|
type IconvResolver = (method: string, args: unknown[]) => unknown;
|
|
4
|
+
type IconvMethod = "convert" | "convertBuffer" | "decode" | "encode" | "encodings";
|
|
3
5
|
interface IconvCall {
|
|
4
|
-
method:
|
|
6
|
+
method: IconvMethod;
|
|
5
7
|
args: unknown[];
|
|
6
8
|
}
|
|
9
|
+
type ConversionResult = string | Uint8Array;
|
|
10
|
+
type ConvertMockProcedure = (input: string | Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: string) => ConversionResult;
|
|
11
|
+
type ConvertBufferMockProcedure = (input: Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: string) => ConversionResult;
|
|
12
|
+
type EncodeMockProcedure = (input: string, encoding: string) => ConversionResult;
|
|
13
|
+
type TypedOperationMock<RuntimeProcedure, MockProcedure extends (...args: never[]) => unknown> = RuntimeProcedure & MockInstance<MockProcedure>;
|
|
14
|
+
/** Controls how unconfigured Iconv operations are handled. */
|
|
15
|
+
interface MockIconvOptions {
|
|
16
|
+
/** Return an empty type-compatible value or throw when no behavior is configured. */
|
|
17
|
+
onUnhandled?: "fallback" | "error";
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* Acquire a disposable mock for `tailor.iconv`. Restored on dispose.
|
|
21
|
+
* @param options - Fallback behavior for unconfigured operations
|
|
9
22
|
* @returns Disposable Iconv mock control object
|
|
10
23
|
* @example
|
|
11
24
|
* ```typescript
|
|
@@ -13,15 +26,26 @@ interface IconvCall {
|
|
|
13
26
|
*
|
|
14
27
|
* test("mock encoding conversion", () => {
|
|
15
28
|
* using iconv = mockIconv();
|
|
16
|
-
* iconv.
|
|
29
|
+
* iconv.decode.mockReturnValue("decoded-text");
|
|
17
30
|
* // …
|
|
18
31
|
* });
|
|
19
32
|
* ```
|
|
20
33
|
*/
|
|
21
|
-
declare function mockIconv(): {
|
|
34
|
+
declare function mockIconv(options?: MockIconvOptions): {
|
|
35
|
+
/** The `convert` `vi.fn`. */
|
|
36
|
+
convert: TypedOperationMock<(<T extends string>(str: string | Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), ConvertMockProcedure>;
|
|
37
|
+
/** The `convertBuffer` `vi.fn`. */
|
|
38
|
+
convertBuffer: TypedOperationMock<(<T extends string>(buffer: Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), ConvertBufferMockProcedure>;
|
|
39
|
+
/** The `decode` `vi.fn`. */
|
|
40
|
+
decode: import("vitest").Mock<(input: Uint8Array | ArrayBuffer, encoding: string) => string>;
|
|
41
|
+
/** The `encode` `vi.fn`. */
|
|
42
|
+
encode: TypedOperationMock<(<T extends string>(str: string, encoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), EncodeMockProcedure>;
|
|
43
|
+
/** The `encodings` `vi.fn`. */
|
|
44
|
+
encodings: import("vitest").Mock<() => string[]>;
|
|
22
45
|
setResolver(value: IconvResolver): void;
|
|
23
46
|
readonly calls: IconvCall[];
|
|
47
|
+
clear: () => void;
|
|
24
48
|
reset(): void;
|
|
25
49
|
} & Disposable;
|
|
26
50
|
//#endregion
|
|
27
|
-
export { mockIconv };
|
|
51
|
+
export { MockIconvOptions, mockIconv };
|
|
@@ -1,44 +1,60 @@
|
|
|
1
|
+
import { IdpClientConstructor, IdpClientInstance } from "../../runtime/idp.mjs";
|
|
1
2
|
import { Mock } from "vitest";
|
|
2
3
|
//#region src/vitest/mocks/idp.d.ts
|
|
4
|
+
type IdpMethod = keyof IdpClientInstance;
|
|
3
5
|
type IdpResolver = (method: string, args: unknown[], namespace: string) => unknown;
|
|
4
6
|
interface IdpCall {
|
|
5
7
|
method: string;
|
|
6
8
|
args: unknown[];
|
|
7
9
|
namespace: string;
|
|
8
10
|
}
|
|
11
|
+
/** Controls fallback behavior for IdP calls without a configured result. */
|
|
12
|
+
interface MockIdpOptions {
|
|
13
|
+
/** Return a type-compatible fixture or throw when no behavior is configured. */
|
|
14
|
+
onUnhandled?: "fallback" | "error";
|
|
15
|
+
}
|
|
16
|
+
type IdpNamespaceMocks = { [Method in IdpMethod]: Mock<IdpClientInstance[Method]>; };
|
|
9
17
|
/**
|
|
10
18
|
* Acquire a disposable mock for `tailor.idp`. Restored on dispose.
|
|
19
|
+
* @param options - Controls behavior for calls without a configured result
|
|
11
20
|
* @returns Disposable IDP mock control object
|
|
12
21
|
* @example
|
|
13
22
|
* ```typescript
|
|
14
23
|
* import { mockIdp } from "@tailor-platform/sdk/vitest";
|
|
15
24
|
*
|
|
16
|
-
* test("
|
|
25
|
+
* test("returns a user", async () => {
|
|
17
26
|
* using idp = mockIdp();
|
|
18
|
-
* idp.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
27
|
+
* idp.namespace("my-idp").user.mockResolvedValue({
|
|
28
|
+
* id: "u-1",
|
|
29
|
+
* name: "alice",
|
|
30
|
+
* disabled: false,
|
|
31
|
+
* mfaEnrolled: false,
|
|
32
|
+
* mfaFactorIds: [],
|
|
33
|
+
* });
|
|
21
34
|
* // …
|
|
22
35
|
* });
|
|
23
36
|
* ```
|
|
24
37
|
*/
|
|
25
|
-
declare function mockIdp(): {
|
|
38
|
+
declare function mockIdp(options?: MockIdpOptions): {
|
|
26
39
|
/** The mock IDP `Client` constructor (`vi.fn`). */
|
|
27
|
-
Client: Mock
|
|
40
|
+
Client: Mock<IdpClientConstructor>;
|
|
41
|
+
namespace: (name: string) => IdpNamespaceMocks;
|
|
28
42
|
setResolver(value: IdpResolver): void;
|
|
29
43
|
/**
|
|
30
|
-
* Enqueue a single result for the next IDP call
|
|
31
|
-
*
|
|
44
|
+
* Enqueue a single result for the next IDP call.
|
|
45
|
+
* The queue is shared across all methods and namespaces.
|
|
32
46
|
* @param result - Result to return from the next IDP call
|
|
33
47
|
*/
|
|
34
48
|
enqueueResult(result: unknown): void;
|
|
35
49
|
/**
|
|
36
50
|
* Enqueue results for multiple subsequent IDP calls.
|
|
51
|
+
* The queue is shared across all methods and namespaces.
|
|
37
52
|
* @param results - Results to enqueue, one per upcoming call
|
|
38
53
|
*/
|
|
39
54
|
enqueueResults(...results: unknown[]): void;
|
|
40
55
|
readonly calls: IdpCall[];
|
|
56
|
+
clear(): void;
|
|
41
57
|
reset(): void;
|
|
42
58
|
} & Disposable;
|
|
43
59
|
//#endregion
|
|
44
|
-
export { mockIdp };
|
|
60
|
+
export { MockIdpOptions, mockIdp };
|
|
@@ -5,31 +5,40 @@ interface SecretCall {
|
|
|
5
5
|
name?: string;
|
|
6
6
|
names?: readonly string[];
|
|
7
7
|
}
|
|
8
|
+
/** Initial fixtures for a Secret Manager mock. */
|
|
9
|
+
interface MockSecretmanagerOptions {
|
|
10
|
+
/** Secrets to merge over fixtures inherited from the currently installed mock. */
|
|
11
|
+
secrets?: Record<string, Record<string, string>>;
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* Acquire a disposable mock for `tailor.secretmanager`. The secret store is
|
|
10
15
|
* inherited (cloned) from the currently-installed mock on acquisition and
|
|
11
16
|
* restored on dispose, so secrets seeded outside the test survive across
|
|
12
17
|
* `using` scopes while per-test `setSecrets()` overrides stay isolated.
|
|
18
|
+
* @param options - Initial Secret Manager fixtures
|
|
13
19
|
* @returns Disposable SecretManager mock control object
|
|
14
20
|
* @example
|
|
15
21
|
* ```typescript
|
|
16
22
|
* import { mockSecretmanager } from "@tailor-platform/sdk/vitest";
|
|
17
23
|
*
|
|
18
24
|
* test("reads secrets from vault", async () => {
|
|
19
|
-
* using sm = mockSecretmanager();
|
|
20
|
-
* sm.
|
|
25
|
+
* using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
|
|
26
|
+
* sm.setSecret("my-vault", "API_KEY", "replacement");
|
|
21
27
|
* // …
|
|
22
28
|
* });
|
|
23
29
|
* ```
|
|
24
30
|
*/
|
|
25
|
-
declare function mockSecretmanager(): {
|
|
31
|
+
declare function mockSecretmanager(options?: MockSecretmanagerOptions): {
|
|
26
32
|
/** The `getSecret` `vi.fn`. */
|
|
27
33
|
getSecret: import("vitest").Mock<(vault: string, name: string) => Promise<string | undefined>>;
|
|
28
34
|
/** The `getSecrets` `vi.fn`. */
|
|
29
35
|
getSecrets: import("vitest").Mock<(<const T extends readonly string[]>(vault: string, names: T) => Promise<Partial<Record<T[number], string>>>)>;
|
|
30
36
|
setSecrets(secrets: Record<string, Record<string, string>>): void;
|
|
37
|
+
setSecret(vault: string, name: string, value: string): void;
|
|
38
|
+
mergeSecrets(vault: string, secrets: Record<string, string>): void;
|
|
31
39
|
readonly calls: SecretCall[];
|
|
40
|
+
clear(): void;
|
|
32
41
|
reset(): void;
|
|
33
42
|
} & Disposable;
|
|
34
43
|
//#endregion
|
|
35
|
-
export { mockSecretmanager };
|
|
44
|
+
export { MockSecretmanagerOptions, mockSecretmanager };
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
//#region src/vitest/mocks/tailordb.d.ts
|
|
2
|
-
type QueryResolver = (query: string, params: unknown[]) => unknown[];
|
|
2
|
+
type QueryResolver = (query: string, params: unknown[]) => unknown[] | undefined;
|
|
3
|
+
/** Controls how unmatched TailorDB queries are handled. */
|
|
4
|
+
interface MockTailordbOptions {
|
|
5
|
+
/** Return an empty result or throw when no configured query behavior matches. */
|
|
6
|
+
onUnhandled?: "fallback" | "error";
|
|
7
|
+
}
|
|
8
|
+
/** Matches a TailorDB query by SQL text and optionally by parameters. */
|
|
9
|
+
interface QueryMatch {
|
|
10
|
+
/** Exact SQL text or regular expression to match. */
|
|
11
|
+
sql: string | RegExp;
|
|
12
|
+
/** Exact parameters or a predicate for parameter matching. */
|
|
13
|
+
params?: readonly unknown[] | ((params: unknown[]) => boolean);
|
|
14
|
+
}
|
|
15
|
+
/** Selects TailorDB queries that receive a configured response. */
|
|
16
|
+
type QueryMatcher = string | RegExp | QueryMatch | ((query: string, params: unknown[]) => boolean);
|
|
17
|
+
/** Configures persistent and one-time responses for matched queries. */
|
|
18
|
+
interface QueryBehavior<Row> {
|
|
19
|
+
/** Return these rows for every matching query after one-time responses are consumed. */
|
|
20
|
+
returnsRows(rows: Row[]): QueryBehavior<Row>;
|
|
21
|
+
/** Return these rows for the next matching query. */
|
|
22
|
+
returnsRowsOnce(rows: Row[]): QueryBehavior<Row>;
|
|
23
|
+
/** Reject every matching query after one-time responses are consumed. */
|
|
24
|
+
rejects(error: unknown): QueryBehavior<Row>;
|
|
25
|
+
/** Reject the next matching query. */
|
|
26
|
+
rejectsOnce(error: unknown): QueryBehavior<Row>;
|
|
27
|
+
}
|
|
3
28
|
interface ExecutedQuery {
|
|
4
29
|
query: string;
|
|
5
30
|
params: unknown[];
|
|
@@ -19,32 +44,41 @@ declare class MockQueryResult {
|
|
|
19
44
|
* `tailordb.Client` whose `queryObject` is a shared `vi.fn()` (so query
|
|
20
45
|
* responses can be staged before the client is constructed). Restored on
|
|
21
46
|
* dispose.
|
|
47
|
+
* @param options - Query fallback behavior
|
|
22
48
|
* @returns Disposable TailorDB mock control object
|
|
23
49
|
* @example
|
|
24
50
|
* ```typescript
|
|
25
51
|
* import { mockTailordb } from "@tailor-platform/sdk/vitest";
|
|
26
52
|
*
|
|
27
|
-
* test("
|
|
53
|
+
* test("query-based", async () => {
|
|
28
54
|
* using db = mockTailordb();
|
|
29
|
-
* db.
|
|
55
|
+
* db.onQuery({ sql: /FROM users/, params: ["u-1"] }).returnsRows([{ age: 30 }]);
|
|
30
56
|
* // …
|
|
31
|
-
* expect(db.queryObject).
|
|
57
|
+
* expect(db.queryObject).toHaveBeenCalled();
|
|
32
58
|
* expect(db.Client).toHaveBeenCalledWith({ namespace: "tailordb" });
|
|
33
59
|
* });
|
|
34
60
|
* ```
|
|
35
61
|
*/
|
|
36
|
-
declare function mockTailordb(): {
|
|
62
|
+
declare function mockTailordb(options?: MockTailordbOptions): {
|
|
37
63
|
/** The mock `tailordb.Client` constructor (`vi.fn`). */
|
|
38
64
|
Client: import("vitest").Mock<(this: any, config?: {
|
|
39
65
|
namespace?: string;
|
|
40
66
|
}) => void>;
|
|
41
67
|
/** The shared `queryObject` `vi.fn` used by every client and transaction. */
|
|
42
|
-
queryObject: import("vitest").Mock<(
|
|
68
|
+
queryObject: import("vitest").Mock<(query: string, params?: unknown[]) => Promise<MockQueryResult>>;
|
|
43
69
|
/**
|
|
44
70
|
* Set a fallback query resolver. Called when the enqueue queue is empty.
|
|
45
71
|
* @param resolver - Function that returns rows for a given query and params
|
|
46
72
|
*/
|
|
47
73
|
setQueryResolver(resolver: QueryResolver): void;
|
|
74
|
+
/**
|
|
75
|
+
* Configure responses for queries matching SQL text, parameters, or a predicate.
|
|
76
|
+
* More recently registered matchers take precedence.
|
|
77
|
+
* Do not combine matchers with a direct `queryObject.mockImplementation()` override.
|
|
78
|
+
* @param matcher - Query matcher
|
|
79
|
+
* @returns Chainable query behavior
|
|
80
|
+
*/
|
|
81
|
+
onQuery<Row = unknown>(matcher: QueryMatcher): QueryBehavior<Row>;
|
|
48
82
|
/**
|
|
49
83
|
* Enqueue rows for the next `queryObject` call (FIFO; takes priority over
|
|
50
84
|
* `setQueryResolver`). Call with no arguments for an empty result.
|
|
@@ -56,6 +90,11 @@ declare function mockTailordb(): {
|
|
|
56
90
|
* @param rowsList - Rows arrays, one per upcoming query
|
|
57
91
|
*/
|
|
58
92
|
enqueueResults(...rowsList: unknown[][]): void;
|
|
93
|
+
/**
|
|
94
|
+
* Enqueue row arrays for subsequent queries whose exact order is under test.
|
|
95
|
+
* @param rowsList - Rows arrays, one per upcoming query
|
|
96
|
+
*/
|
|
97
|
+
enqueueRows(...rowsList: unknown[][]): void;
|
|
59
98
|
/**
|
|
60
99
|
* All queries executed via `queryObject`, in order, derived from the vi.fn
|
|
61
100
|
* call records.
|
|
@@ -67,8 +106,10 @@ declare function mockTailordb(): {
|
|
|
67
106
|
* @returns Created clients array
|
|
68
107
|
*/
|
|
69
108
|
readonly createdClients: CreatedClient[];
|
|
109
|
+
/** Clear recorded calls while preserving configured query behavior. */
|
|
110
|
+
clear(): void;
|
|
70
111
|
/** Reset query responses and recorded calls (keeps the mock installed). */
|
|
71
112
|
reset(): void;
|
|
72
113
|
} & Disposable;
|
|
73
114
|
//#endregion
|
|
74
|
-
export { mockTailordb };
|
|
115
|
+
export { MockTailordbOptions, QueryBehavior, QueryMatch, QueryMatcher, mockTailordb };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { TailorEnv } from "../../runtime/types.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { StartJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
|
|
3
|
+
import { WorkflowJob } from "../../configure/services/workflow/job.mjs";
|
|
4
|
+
import { Workflow } from "../../configure/services/workflow/workflow.mjs";
|
|
5
|
+
import { WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
|
|
6
|
+
import { Mock } from "vitest";
|
|
3
7
|
//#region src/vitest/mocks/workflow.d.ts
|
|
4
|
-
type JobHandler = (jobName: string, args: unknown, options?:
|
|
5
|
-
type
|
|
6
|
-
authInvoker?: {
|
|
7
|
-
namespace: string;
|
|
8
|
-
machineUserName: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
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;
|
|
12
10
|
type ResumeHandlerFn = (executionId: string) => string;
|
|
13
11
|
type WaitHandlerFn = (key: string, payload: unknown) => unknown;
|
|
14
12
|
type ResolveHandler = (executionId: string, key: string, callback: (payload: unknown) => unknown) => unknown | Promise<unknown>;
|
|
@@ -19,35 +17,81 @@ type SetWaitHandler = {
|
|
|
19
17
|
interface TriggeredJob {
|
|
20
18
|
jobName: string;
|
|
21
19
|
args: unknown;
|
|
22
|
-
options?:
|
|
20
|
+
options?: StartJobFunctionOptions;
|
|
23
21
|
}
|
|
22
|
+
type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
|
|
24
23
|
/**
|
|
25
24
|
* Acquire a disposable mock for workflow operations (`tailor.workflow`).
|
|
26
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.
|
|
27
31
|
* @returns Disposable workflow mock control object
|
|
28
32
|
* @example
|
|
29
33
|
* ```typescript
|
|
30
34
|
* import { mockWorkflow } from "@tailor-platform/sdk/vitest";
|
|
31
35
|
*
|
|
32
|
-
* test("job
|
|
36
|
+
* test("job trigger", async () => {
|
|
33
37
|
* using wf = mockWorkflow();
|
|
34
|
-
* wf.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
38
|
+
* const job = wf.job(validateOrder);
|
|
39
|
+
* job.mockResolvedValue({ valid: true });
|
|
40
|
+
* await runWorkflowUnderTest();
|
|
41
|
+
* expect(job).toHaveBeenCalled();
|
|
37
42
|
* });
|
|
38
43
|
* ```
|
|
39
44
|
*/
|
|
40
45
|
declare function mockWorkflow(): {
|
|
41
|
-
/** The `
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
*/
|
|
66
|
+
resumeWorkflow: Mock<(executionId: string) => Promise<string>>;
|
|
47
67
|
/** The `wait` `vi.fn`. */
|
|
48
|
-
wait:
|
|
68
|
+
wait: Mock<(_key: string, _payload?: unknown) => unknown>;
|
|
49
69
|
/** The `resolve` `vi.fn`. */
|
|
50
|
-
resolve:
|
|
70
|
+
resolve: Mock<(_executionId: string, _key: string, _callback: (payload: unknown) => unknown) => Promise<void>>;
|
|
71
|
+
/**
|
|
72
|
+
* Get a stable, typed mock for a workflow job's `trigger` method.
|
|
73
|
+
* The real trigger behavior is used until an implementation or result is configured.
|
|
74
|
+
* @param definition - Workflow job definition to mock
|
|
75
|
+
* @returns Typed `trigger` mock for the definition
|
|
76
|
+
*/
|
|
77
|
+
job<Name extends string, Input, Output>(definition: WorkflowJob<Name, Input, Output>): Mock<WorkflowJob<Name, Input, Output>["trigger"]>;
|
|
78
|
+
/**
|
|
79
|
+
* Get a stable, typed mock for a workflow definition's `trigger` method.
|
|
80
|
+
* The real trigger behavior is used until an implementation or result is configured.
|
|
81
|
+
* @param definition - Workflow definition to mock
|
|
82
|
+
* @returns Typed `trigger` mock for the definition
|
|
83
|
+
*/
|
|
84
|
+
workflow<Definition extends Workflow>(definition: Definition): Mock<Definition["trigger"]>;
|
|
85
|
+
/**
|
|
86
|
+
* Get stable, typed mocks for a wait point's `wait` and `resolve` methods.
|
|
87
|
+
* @param definition - Wait point definition to mock
|
|
88
|
+
* @returns Typed wait point mock control object
|
|
89
|
+
*/
|
|
90
|
+
waitPoint<Payload, Result>(definition: WaitPointInstance<Payload, Result>): {
|
|
91
|
+
wait: Mock<WaitPointInstance<Payload, Result>["wait"]>;
|
|
92
|
+
resolve: Mock<WaitPointInstance<Payload, Result>["resolve"]>;
|
|
93
|
+
setResolvePayload(payload: WaitPayload<Payload>): void;
|
|
94
|
+
};
|
|
51
95
|
/**
|
|
52
96
|
* Set a fallback job handler. Called when the enqueue queue is empty.
|
|
53
97
|
* @param handler - Function returning a result for a job name, args, and options
|
|
@@ -115,6 +159,8 @@ declare function mockWorkflow(): {
|
|
|
115
159
|
executionId: string;
|
|
116
160
|
key: string;
|
|
117
161
|
}[];
|
|
162
|
+
/** Clear recorded calls while preserving configured responses. */
|
|
163
|
+
clear(): void;
|
|
118
164
|
/** Reset all workflow responses and recorded calls (keeps the mock installed). */
|
|
119
165
|
reset(): void;
|
|
120
166
|
} & Disposable;
|
package/dist/vitest/setup.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as RUNTIME_FLAG_KEY } from "../globals-
|
|
2
|
-
import { t as mockSecretmanager } from "../secretmanager-
|
|
1
|
+
import { t as RUNTIME_FLAG_KEY } from "../globals-B-n_3uYu.mjs";
|
|
2
|
+
import { t as mockSecretmanager } from "../secretmanager-IY4UvinW.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { afterEach, beforeAll, beforeEach } from "vitest";
|
|
5
5
|
|
|
@@ -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"}
|