@tailor-platform/create-sdk 1.40.1 → 1.43.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tailor-platform/create-sdk
2
2
 
3
+ ## 1.43.0
4
+
5
+ ## 1.42.0
6
+
7
+ ## 1.41.0
8
+
3
9
  ## 1.40.1
4
10
 
5
11
  ## 1.40.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/create-sdk",
3
- "version": "1.40.1",
3
+ "version": "1.43.0",
4
4
  "description": "A CLI tool to quickly create a new Tailor Platform SDK project",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,18 +22,18 @@
22
22
  "execa": "9.6.1",
23
23
  "picocolors": "1.1.1",
24
24
  "pkg-types": "2.3.0",
25
- "politty": "0.4.12",
25
+ "politty": "0.4.14",
26
26
  "zod": "4.3.6"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@eslint/js": "10.0.1",
30
30
  "@types/node": "24.12.2",
31
- "eslint": "10.2.0",
32
- "eslint-plugin-oxlint": "1.60.0",
33
- "oxlint": "1.60.0",
31
+ "eslint": "10.2.1",
32
+ "eslint-plugin-oxlint": "1.61.0",
33
+ "oxlint": "1.61.0",
34
34
  "tsdown": "0.21.9",
35
35
  "typescript": "5.9.3",
36
- "typescript-eslint": "8.58.2"
36
+ "typescript-eslint": "8.59.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsdown",
@@ -15,15 +15,15 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@eslint/js": "10.0.1",
18
- "@tailor-platform/sdk": "1.40.1",
18
+ "@tailor-platform/sdk": "1.43.0",
19
19
  "@types/node": "24.12.2",
20
- "eslint": "10.2.0",
21
- "eslint-plugin-oxlint": "1.60.0",
22
- "oxfmt": "0.45.0",
23
- "oxlint": "1.60.0",
24
- "oxlint-tsgolint": "0.20.0",
20
+ "eslint": "10.2.1",
21
+ "eslint-plugin-oxlint": "1.61.0",
22
+ "oxfmt": "0.46.0",
23
+ "oxlint": "1.61.0",
24
+ "oxlint-tsgolint": "0.21.1",
25
25
  "typescript": "5.9.3",
26
- "typescript-eslint": "8.58.2",
26
+ "typescript-eslint": "8.59.0",
27
27
  "vitest": "4.1.4"
28
28
  }
29
29
  }
@@ -15,15 +15,15 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@eslint/js": "10.0.1",
18
- "@tailor-platform/sdk": "1.40.1",
18
+ "@tailor-platform/sdk": "1.43.0",
19
19
  "@types/node": "24.12.2",
20
- "eslint": "10.2.0",
21
- "eslint-plugin-oxlint": "1.60.0",
22
- "oxfmt": "0.45.0",
23
- "oxlint": "1.60.0",
24
- "oxlint-tsgolint": "0.20.0",
20
+ "eslint": "10.2.1",
21
+ "eslint-plugin-oxlint": "1.61.0",
22
+ "oxfmt": "0.46.0",
23
+ "oxlint": "1.61.0",
24
+ "oxlint-tsgolint": "0.21.1",
25
25
  "typescript": "5.9.3",
26
- "typescript-eslint": "8.58.2",
26
+ "typescript-eslint": "8.59.0",
27
27
  "vitest": "4.1.4"
28
28
  }
29
29
  }
@@ -13,14 +13,14 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@eslint/js": "10.0.1",
16
- "@tailor-platform/sdk": "1.40.1",
16
+ "@tailor-platform/sdk": "1.43.0",
17
17
  "@types/node": "24.12.2",
18
- "eslint": "10.2.0",
19
- "eslint-plugin-oxlint": "1.60.0",
20
- "oxfmt": "0.45.0",
21
- "oxlint": "1.60.0",
22
- "oxlint-tsgolint": "0.20.0",
18
+ "eslint": "10.2.1",
19
+ "eslint-plugin-oxlint": "1.61.0",
20
+ "oxfmt": "0.46.0",
21
+ "oxlint": "1.61.0",
22
+ "oxlint-tsgolint": "0.21.1",
23
23
  "typescript": "5.9.3",
24
- "typescript-eslint": "8.58.2"
24
+ "typescript-eslint": "8.59.0"
25
25
  }
26
26
  }
@@ -13,14 +13,14 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@eslint/js": "10.0.1",
16
- "@tailor-platform/sdk": "1.40.1",
16
+ "@tailor-platform/sdk": "1.43.0",
17
17
  "@types/node": "24.12.2",
18
- "eslint": "10.2.0",
19
- "eslint-plugin-oxlint": "1.60.0",
20
- "oxfmt": "0.45.0",
21
- "oxlint": "1.60.0",
22
- "oxlint-tsgolint": "0.20.0",
18
+ "eslint": "10.2.1",
19
+ "eslint-plugin-oxlint": "1.61.0",
20
+ "oxfmt": "0.46.0",
21
+ "oxlint": "1.61.0",
22
+ "oxlint-tsgolint": "0.21.1",
23
23
  "typescript": "5.9.3",
24
- "typescript-eslint": "8.58.2"
24
+ "typescript-eslint": "8.59.0"
25
25
  }
26
26
  }
@@ -14,14 +14,14 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@eslint/js": "10.0.1",
17
- "@tailor-platform/sdk": "1.40.1",
17
+ "@tailor-platform/sdk": "1.43.0",
18
18
  "@types/node": "24.12.2",
19
- "eslint": "10.2.0",
20
- "eslint-plugin-oxlint": "1.60.0",
21
- "oxfmt": "0.45.0",
22
- "oxlint": "1.60.0",
23
- "oxlint-tsgolint": "0.20.0",
19
+ "eslint": "10.2.1",
20
+ "eslint-plugin-oxlint": "1.61.0",
21
+ "oxfmt": "0.46.0",
22
+ "oxlint": "1.61.0",
23
+ "oxlint-tsgolint": "0.21.1",
24
24
  "typescript": "5.9.3",
25
- "typescript-eslint": "8.58.2"
25
+ "typescript-eslint": "8.59.0"
26
26
  }
27
27
  }
@@ -17,15 +17,15 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@eslint/js": "10.0.1",
20
- "@tailor-platform/sdk": "1.40.1",
20
+ "@tailor-platform/sdk": "1.43.0",
21
21
  "@types/node": "24.12.2",
22
- "eslint": "10.2.0",
23
- "eslint-plugin-oxlint": "1.60.0",
24
- "oxfmt": "0.45.0",
25
- "oxlint": "1.60.0",
26
- "oxlint-tsgolint": "0.20.0",
22
+ "eslint": "10.2.1",
23
+ "eslint-plugin-oxlint": "1.61.0",
24
+ "oxfmt": "0.46.0",
25
+ "oxlint": "1.61.0",
26
+ "oxlint-tsgolint": "0.21.1",
27
27
  "typescript": "5.9.3",
28
- "typescript-eslint": "8.58.2",
28
+ "typescript-eslint": "8.59.0",
29
29
  "vitest": "4.1.4"
30
30
  }
31
31
  }
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import { createImportMain, setupTailordbMock } from "@tailor-platform/sdk/test";
2
+ import { createImportMain, setupInvokerMock, setupTailordbMock } from "@tailor-platform/sdk/test";
3
3
  import { beforeAll, beforeEach, describe, expect, test } from "vitest";
4
4
 
5
5
  const outputDir = path.join(__dirname, "../.tailor-sdk");
@@ -11,6 +11,7 @@ describe("bundled resolver execution", () => {
11
11
 
12
12
  beforeAll(() => {
13
13
  ({ executedQueries } = setupTailordbMock());
14
+ setupInvokerMock(null);
14
15
  });
15
16
 
16
17
  beforeEach(() => {
@@ -13,14 +13,14 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@eslint/js": "10.0.1",
16
- "@tailor-platform/sdk": "1.40.1",
16
+ "@tailor-platform/sdk": "1.43.0",
17
17
  "@types/node": "24.12.2",
18
- "eslint": "10.2.0",
19
- "eslint-plugin-oxlint": "1.60.0",
20
- "oxfmt": "0.45.0",
21
- "oxlint": "1.60.0",
22
- "oxlint-tsgolint": "0.20.0",
18
+ "eslint": "10.2.1",
19
+ "eslint-plugin-oxlint": "1.61.0",
20
+ "oxfmt": "0.46.0",
21
+ "oxlint": "1.61.0",
22
+ "oxlint-tsgolint": "0.21.1",
23
23
  "typescript": "5.9.3",
24
- "typescript-eslint": "8.58.2"
24
+ "typescript-eslint": "8.59.0"
25
25
  }
26
26
  }
@@ -15,15 +15,15 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@eslint/js": "10.0.1",
18
- "@tailor-platform/sdk": "1.40.1",
18
+ "@tailor-platform/sdk": "1.43.0",
19
19
  "@types/node": "24.12.2",
20
- "eslint": "10.2.0",
21
- "eslint-plugin-oxlint": "1.60.0",
22
- "oxfmt": "0.45.0",
23
- "oxlint": "1.60.0",
24
- "oxlint-tsgolint": "0.20.0",
20
+ "eslint": "10.2.1",
21
+ "eslint-plugin-oxlint": "1.61.0",
22
+ "oxfmt": "0.46.0",
23
+ "oxlint": "1.61.0",
24
+ "oxlint-tsgolint": "0.21.1",
25
25
  "typescript": "5.9.3",
26
- "typescript-eslint": "8.58.2",
26
+ "typescript-eslint": "8.59.0",
27
27
  "vitest": "4.1.4"
28
28
  }
29
29
  }
@@ -18,17 +18,17 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@eslint/js": "10.0.1",
21
- "@tailor-platform/sdk": "1.40.1",
21
+ "@tailor-platform/sdk": "1.43.0",
22
22
  "@types/node": "24.12.2",
23
- "eslint": "10.2.0",
24
- "eslint-plugin-oxlint": "1.60.0",
23
+ "eslint": "10.2.1",
24
+ "eslint-plugin-oxlint": "1.61.0",
25
25
  "graphql": "16.13.2",
26
26
  "graphql-request": "7.4.0",
27
- "oxfmt": "0.45.0",
28
- "oxlint": "1.60.0",
29
- "oxlint-tsgolint": "0.20.0",
27
+ "oxfmt": "0.46.0",
28
+ "oxlint": "1.61.0",
29
+ "oxlint-tsgolint": "0.21.1",
30
30
  "typescript": "5.9.3",
31
- "typescript-eslint": "8.58.2",
31
+ "typescript-eslint": "8.59.0",
32
32
  "vitest": "4.1.4"
33
33
  }
34
34
  }
@@ -0,0 +1,47 @@
1
+ import { afterEach, describe, expect, test } from "vitest";
2
+ import { setupWaitPointMock, unauthenticatedTailorUser } from "@tailor-platform/sdk/test";
3
+ import resolver from "./resolveApproval";
4
+
5
+ const TailorGlobal = globalThis as { tailor?: { workflow?: Record<string, unknown> } };
6
+
7
+ describe("resolveApproval resolver", () => {
8
+ afterEach(() => {
9
+ delete TailorGlobal.tailor;
10
+ });
11
+
12
+ test("resolves approval with approved=true", async () => {
13
+ const { resolveCalls } = setupWaitPointMock({
14
+ onResolve: (_execId, _key, callback) => {
15
+ const result = callback({ message: "Please approve order order-1", orderId: "order-1" });
16
+ expect(result).toEqual({ approved: true });
17
+ },
18
+ });
19
+
20
+ const result = await resolver.body({
21
+ input: { executionId: "exec-1", approved: true },
22
+ user: unauthenticatedTailorUser,
23
+ env: {},
24
+ });
25
+
26
+ expect(result).toEqual({ resolved: true });
27
+ expect(resolveCalls).toHaveLength(1);
28
+ expect(resolveCalls[0]).toEqual({ executionId: "exec-1", key: "approval" });
29
+ });
30
+
31
+ test("resolves approval with approved=false", async () => {
32
+ setupWaitPointMock({
33
+ onResolve: (_execId, _key, callback) => {
34
+ const result = callback({ message: "Please approve", orderId: "order-2" });
35
+ expect(result).toEqual({ approved: false });
36
+ },
37
+ });
38
+
39
+ const result = await resolver.body({
40
+ input: { executionId: "exec-2", approved: false },
41
+ user: unauthenticatedTailorUser,
42
+ env: {},
43
+ });
44
+
45
+ expect(result).toEqual({ resolved: true });
46
+ });
47
+ });
@@ -0,0 +1,22 @@
1
+ import { createResolver, t } from "@tailor-platform/sdk";
2
+ import { approval } from "../workflow/approval";
3
+
4
+ export default createResolver({
5
+ name: "resolveApproval",
6
+ description: "Resolve a waiting approval",
7
+ operation: "mutation",
8
+ input: {
9
+ executionId: t.string(),
10
+ approved: t.bool(),
11
+ },
12
+ body: async ({ input }) => {
13
+ await approval.resolve(input.executionId, () => {
14
+ return { approved: input.approved };
15
+ });
16
+
17
+ return { resolved: true };
18
+ },
19
+ output: t.object({
20
+ resolved: t.bool(),
21
+ }),
22
+ });
@@ -0,0 +1,41 @@
1
+ import { afterEach, describe, expect, test, vi } from "vitest";
2
+ import { setupWaitPointMock } from "@tailor-platform/sdk/test";
3
+ import workflow, { processWithApproval } from "./approval";
4
+
5
+ const TailorGlobal = globalThis as { tailor?: { workflow?: Record<string, unknown> } };
6
+
7
+ describe("approval workflow", () => {
8
+ afterEach(() => {
9
+ delete TailorGlobal.tailor;
10
+ vi.restoreAllMocks();
11
+ });
12
+
13
+ test("approved flow returns approved status", async () => {
14
+ const { waitCalls } = setupWaitPointMock({
15
+ onWait: (_key, _payload) => ({ approved: true }),
16
+ });
17
+
18
+ const result = await processWithApproval.body({ orderId: "order-1" }, { env: {} });
19
+
20
+ expect(result).toEqual({ orderId: "order-1", status: "approved" });
21
+ expect(waitCalls).toHaveLength(1);
22
+ expect(waitCalls[0]).toEqual({
23
+ key: "approval",
24
+ payload: { message: "Please approve order order-1", orderId: "order-1" },
25
+ });
26
+ });
27
+
28
+ test("rejected flow returns rejected status", async () => {
29
+ setupWaitPointMock({
30
+ onWait: () => ({ approved: false }),
31
+ });
32
+
33
+ const result = await processWithApproval.body({ orderId: "order-2" }, { env: {} });
34
+
35
+ expect(result).toEqual({ orderId: "order-2", status: "rejected" });
36
+ });
37
+
38
+ test("workflow.mainJob references processWithApproval", () => {
39
+ expect(workflow.mainJob).toBe(processWithApproval);
40
+ });
41
+ });
@@ -0,0 +1,27 @@
1
+ import { createWorkflow, createWorkflowJob, defineWaitPoints } from "@tailor-platform/sdk";
2
+
3
+ export const { approval } = defineWaitPoints((define) => ({
4
+ /** Approval for order processing */
5
+ approval: define<{ message: string; orderId: string }, { approved: boolean }>(),
6
+ }));
7
+
8
+ export const processWithApproval = createWorkflowJob({
9
+ name: "process-with-approval",
10
+ body: async (input: { orderId: string }) => {
11
+ const result = await approval.wait({
12
+ message: `Please approve order ${input.orderId}`,
13
+ orderId: input.orderId,
14
+ });
15
+
16
+ if (!result.approved) {
17
+ return { orderId: input.orderId, status: "rejected" as const };
18
+ }
19
+
20
+ return { orderId: input.orderId, status: "approved" as const };
21
+ },
22
+ });
23
+
24
+ export default createWorkflow({
25
+ name: "approval-workflow",
26
+ mainJob: processWithApproval,
27
+ });
@@ -1,5 +1,11 @@
1
1
  import path from "node:path";
2
- import { createImportMain, setupTailordbMock, setupWorkflowMock } from "@tailor-platform/sdk/test";
2
+ import {
3
+ createImportMain,
4
+ setupInvokerMock,
5
+ setupTailordbMock,
6
+ setupWaitPointMock,
7
+ setupWorkflowMock,
8
+ } from "@tailor-platform/sdk/test";
3
9
  import { beforeAll, beforeEach, describe, expect, test } from "vitest";
4
10
 
5
11
  const outputDir = path.join(__dirname, "../.tailor-sdk");
@@ -11,6 +17,7 @@ describe("bundled workflow execution", () => {
11
17
 
12
18
  beforeAll(() => {
13
19
  ({ executedQueries } = setupTailordbMock());
20
+ setupInvokerMock(null);
14
21
  });
15
22
 
16
23
  beforeEach(() => {
@@ -76,6 +83,28 @@ describe("bundled workflow execution", () => {
76
83
  });
77
84
  });
78
85
 
86
+ describe("approval workflow job", () => {
87
+ test("process-with-approval returns approved when resolved with true", async () => {
88
+ setupWaitPointMock({
89
+ onWait: (_key, _payload) => ({ approved: true }),
90
+ });
91
+
92
+ const main = await importMain("workflow-jobs/process-with-approval.js");
93
+ const result = await main({ orderId: "order-1" });
94
+ expect(result).toEqual({ orderId: "order-1", status: "approved" });
95
+ });
96
+
97
+ test("process-with-approval returns rejected when resolved with false", async () => {
98
+ setupWaitPointMock({
99
+ onWait: (_key, _payload) => ({ approved: false }),
100
+ });
101
+
102
+ const main = await importMain("workflow-jobs/process-with-approval.js");
103
+ const result = await main({ orderId: "order-2" });
104
+ expect(result).toEqual({ orderId: "order-2", status: "rejected" });
105
+ });
106
+ });
107
+
79
108
  describe("order-fulfillment jobs", () => {
80
109
  test("validate-order validates positive amount", async () => {
81
110
  const main = await importMain("workflow-jobs/validate-order.js");