@tailor-platform/create-sdk 2.0.0-next.6 → 2.0.0-next.7
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 +20 -0
- package/package.json +2 -2
- package/templates/executor/.oxlintrc.json +8 -0
- package/templates/executor/package.json +2 -1
- package/templates/generators/.oxlintrc.json +8 -0
- package/templates/generators/package.json +2 -1
- package/templates/hello-world/.oxlintrc.json +8 -0
- package/templates/hello-world/package.json +2 -1
- package/templates/inventory-management/.oxlintrc.json +8 -0
- package/templates/inventory-management/package.json +2 -1
- package/templates/inventory-management/src/executor/checkInventory.ts +0 -1
- package/templates/multi-application/.oxlintrc.json +8 -0
- package/templates/multi-application/apps/admin/tailor.config.ts +1 -1
- package/templates/multi-application/apps/user/tailor.config.ts +1 -1
- package/templates/multi-application/package.json +2 -1
- package/templates/resolver/.oxlintrc.json +8 -0
- package/templates/resolver/package.json +2 -1
- package/templates/static-web-site/.oxlintrc.json +8 -0
- package/templates/static-web-site/package.json +2 -1
- package/templates/tailordb/.oxlintrc.json +8 -0
- package/templates/tailordb/package.json +2 -1
- package/templates/workflow/.oxlintrc.json +8 -0
- package/templates/workflow/README.md +2 -2
- package/templates/workflow/package.json +2 -1
- package/templates/workflow/src/workflow/order-fulfillment.test.ts +10 -10
- package/templates/workflow/src/workflow/order-fulfillment.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @tailor-platform/create-sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.7
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1782](https://github.com/tailor-platform/sdk/pull/1782) [`c971797`](https://github.com/tailor-platform/sdk/commit/c971797c9bfa035a43771c46f2b1c3bd93f989a9) Thanks [@toiroakr](https://github.com/toiroakr)! - Rename `Workflow.trigger()` (returned by `createWorkflow()`) and `WorkflowJob.trigger()` (returned by `createWorkflowJob()`) to `.start()`, aligning the SDK's ergonomic verb with the platform's `start*` RPC vocabulary:
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
const inventory = checkInventory.trigger({ orderId: input.orderId });
|
|
11
|
+
+const inventory = checkInventory.start({ orderId: input.orderId });
|
|
12
|
+
|
|
13
|
+
-const workflowRunId = await orderProcessingWorkflow.trigger(args, { invoker: "manager" });
|
|
14
|
+
+const workflowRunId = await orderProcessingWorkflow.start(args, { invoker: "manager" });
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`mockWorkflow()`'s `wf.job(definition)` / `wf.workflow(definition)` now return a mock of the `.start` method, and `wf.setTriggerHandler` / `wf.triggeredJobs` are renamed to `wf.setStartHandler` / `wf.startedJobs`. No codemod ships for the `.trigger()` → `.start()` call-site rename itself — see the `v2/workflow-start-rename` migration guide entry for manual migration steps.
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#1737](https://github.com/tailor-platform/sdk/pull/1737) [`e349b9e`](https://github.com/tailor-platform/sdk/commit/e349b9e3d9c61f324f21dea92dd08055493a2c6d) Thanks [@dqn](https://github.com/dqn)! - Add lint rules that flag the external /api prefix in HTTP adapter path patterns and permission settings that grant access unconditionally, and enable them in newly scaffolded projects.
|
|
22
|
+
|
|
3
23
|
## 2.0.0-next.6
|
|
4
24
|
|
|
5
25
|
## 2.0.0-next.5
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/create-sdk",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.7",
|
|
4
4
|
"description": "A CLI tool to quickly create a new Tailor Platform SDK project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"eslint-plugin-zod": "4.7.0",
|
|
30
30
|
"oxlint": "1.73.0",
|
|
31
31
|
"oxlint-tsgolint": "0.24.0",
|
|
32
|
-
"tsdown": "0.22.
|
|
32
|
+
"tsdown": "0.22.7",
|
|
33
33
|
"typescript": "6.0.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/sdk": "
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
19
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
19
20
|
"@types/node": "24.13.3",
|
|
20
21
|
"oxfmt": "0.58.0",
|
|
21
22
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "src/seed/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/sdk": "
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
19
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
19
20
|
"@types/node": "24.13.3",
|
|
20
21
|
"oxfmt": "0.58.0",
|
|
21
22
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/sdk": "
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
17
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
17
18
|
"@types/node": "24.13.3",
|
|
18
19
|
"oxfmt": "0.58.0",
|
|
19
20
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/sdk": "
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
17
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
17
18
|
"@types/node": "24.13.3",
|
|
18
19
|
"oxfmt": "0.58.0",
|
|
19
20
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"typecheck": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@tailor-platform/sdk": "
|
|
17
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
18
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
18
19
|
"@types/node": "24.13.3",
|
|
19
20
|
"oxfmt": "0.58.0",
|
|
20
21
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/sdk": "
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
19
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
19
20
|
"@types/node": "24.13.3",
|
|
20
21
|
"oxfmt": "0.58.0",
|
|
21
22
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/sdk": "
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
17
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
17
18
|
"@types/node": "24.13.3",
|
|
18
19
|
"oxfmt": "0.58.0",
|
|
19
20
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/sdk": "
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
19
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
19
20
|
"@types/node": "24.13.3",
|
|
20
21
|
"oxfmt": "0.58.0",
|
|
21
22
|
"oxlint": "1.73.0",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript"],
|
|
4
|
+
"jsPlugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "tailor-sdk",
|
|
7
|
+
"specifier": "@tailor-platform/eslint-plugin-sdk"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
4
10
|
"categories": {
|
|
5
11
|
"correctness": "error"
|
|
6
12
|
},
|
|
@@ -9,6 +15,8 @@
|
|
|
9
15
|
},
|
|
10
16
|
"ignorePatterns": [".tailor/", "src/generated/", "tailor.d.ts"],
|
|
11
17
|
"rules": {
|
|
18
|
+
"tailor-sdk/no-api-prefix-in-path-pattern": "warn",
|
|
19
|
+
"tailor-sdk/no-unconditional-permit": "warn",
|
|
12
20
|
"no-case-declarations": "error",
|
|
13
21
|
"no-empty": "error",
|
|
14
22
|
"no-fallthrough": "error",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Workflow Template
|
|
2
2
|
|
|
3
|
-
Demonstrates workflow patterns with job chaining,
|
|
3
|
+
Demonstrates workflow patterns with job chaining, start testing, and dependency injection.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Workflow with multiple jobs (`createWorkflow`, `createWorkflowJob`)
|
|
8
|
-
- Job chaining via `.
|
|
8
|
+
- Job chaining via `.start()`
|
|
9
9
|
- Database operations in workflow jobs (DI pattern)
|
|
10
10
|
- Integration testing with `runWorkflowLocally()`
|
|
11
11
|
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tailor-platform/sdk": "
|
|
19
|
+
"@tailor-platform/eslint-plugin-sdk": "0.1.0-next.0",
|
|
20
|
+
"@tailor-platform/sdk": "2.0.0-next.7",
|
|
20
21
|
"@types/node": "24.13.3",
|
|
21
22
|
"graphql": "17.0.2",
|
|
22
23
|
"graphql-request": "7.4.0",
|
|
@@ -48,18 +48,18 @@ describe("order fulfillment workflow", () => {
|
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
describe("orchestration tests with mocked
|
|
51
|
+
describe("orchestration tests with mocked starts", () => {
|
|
52
52
|
test("fulfillOrder chains all jobs", async () => {
|
|
53
|
-
using _validateSpy = vi.spyOn(validateOrder, "
|
|
53
|
+
using _validateSpy = vi.spyOn(validateOrder, "start").mockReturnValue({
|
|
54
54
|
valid: true,
|
|
55
55
|
orderId: "order-1",
|
|
56
56
|
});
|
|
57
|
-
using _paymentSpy = vi.spyOn(processPayment, "
|
|
57
|
+
using _paymentSpy = vi.spyOn(processPayment, "start").mockReturnValue({
|
|
58
58
|
transactionId: "txn-order-1",
|
|
59
59
|
amount: 100,
|
|
60
60
|
status: "completed" as const,
|
|
61
61
|
});
|
|
62
|
-
using _confirmSpy = vi.spyOn(sendConfirmation, "
|
|
62
|
+
using _confirmSpy = vi.spyOn(sendConfirmation, "start").mockReturnValue({
|
|
63
63
|
orderId: "order-1",
|
|
64
64
|
transactionId: "txn-order-1",
|
|
65
65
|
confirmed: true,
|
|
@@ -70,15 +70,15 @@ describe("order fulfillment workflow", () => {
|
|
|
70
70
|
{ env: {}, invoker: null },
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
expect(validateOrder.
|
|
73
|
+
expect(validateOrder.start).toHaveBeenCalledWith({
|
|
74
74
|
orderId: "order-1",
|
|
75
75
|
amount: 100,
|
|
76
76
|
});
|
|
77
|
-
expect(processPayment.
|
|
77
|
+
expect(processPayment.start).toHaveBeenCalledWith({
|
|
78
78
|
orderId: "order-1",
|
|
79
79
|
amount: 100,
|
|
80
80
|
});
|
|
81
|
-
expect(sendConfirmation.
|
|
81
|
+
expect(sendConfirmation.start).toHaveBeenCalledWith({
|
|
82
82
|
orderId: "order-1",
|
|
83
83
|
transactionId: "txn-order-1",
|
|
84
84
|
});
|
|
@@ -91,16 +91,16 @@ describe("order fulfillment workflow", () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
test("workflow.mainJob.body() chains all jobs", async () => {
|
|
94
|
-
using _validateSpy = vi.spyOn(validateOrder, "
|
|
94
|
+
using _validateSpy = vi.spyOn(validateOrder, "start").mockReturnValue({
|
|
95
95
|
valid: true,
|
|
96
96
|
orderId: "order-2",
|
|
97
97
|
});
|
|
98
|
-
using _paymentSpy = vi.spyOn(processPayment, "
|
|
98
|
+
using _paymentSpy = vi.spyOn(processPayment, "start").mockReturnValue({
|
|
99
99
|
transactionId: "txn-order-2",
|
|
100
100
|
amount: 200,
|
|
101
101
|
status: "completed" as const,
|
|
102
102
|
});
|
|
103
|
-
using _confirmSpy = vi.spyOn(sendConfirmation, "
|
|
103
|
+
using _confirmSpy = vi.spyOn(sendConfirmation, "start").mockReturnValue({
|
|
104
104
|
orderId: "order-2",
|
|
105
105
|
transactionId: "txn-order-2",
|
|
106
106
|
confirmed: true,
|
|
@@ -35,7 +35,7 @@ export const sendConfirmation = createWorkflowJob({
|
|
|
35
35
|
export const fulfillOrder = createWorkflowJob({
|
|
36
36
|
name: "fulfill-order",
|
|
37
37
|
body: (input: { orderId: string; amount: number }) => {
|
|
38
|
-
const validation = validateOrder.
|
|
38
|
+
const validation = validateOrder.start({
|
|
39
39
|
orderId: input.orderId,
|
|
40
40
|
amount: input.amount,
|
|
41
41
|
});
|
|
@@ -44,12 +44,12 @@ export const fulfillOrder = createWorkflowJob({
|
|
|
44
44
|
throw new Error("Order validation failed");
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const payment = processPayment.
|
|
47
|
+
const payment = processPayment.start({
|
|
48
48
|
orderId: input.orderId,
|
|
49
49
|
amount: input.amount,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const confirmation = sendConfirmation.
|
|
52
|
+
const confirmation = sendConfirmation.start({
|
|
53
53
|
orderId: input.orderId,
|
|
54
54
|
transactionId: payment.transactionId,
|
|
55
55
|
});
|