@tailor-platform/create-sdk 1.40.0 → 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 +8 -0
- package/package.json +7 -7
- package/templates/executor/.oxlintrc.json +1 -1
- package/templates/executor/eslint.config.js +1 -1
- package/templates/executor/package.json +7 -7
- package/templates/executor/tailor.config.ts +7 -1
- package/templates/executor/tailor.d.ts +18 -0
- package/templates/generators/.oxlintrc.json +1 -1
- package/templates/generators/eslint.config.js +1 -1
- package/templates/generators/package.json +7 -7
- package/templates/generators/tailor.config.ts +7 -1
- package/templates/generators/tailor.d.ts +18 -0
- package/templates/hello-world/.oxlintrc.json +1 -1
- package/templates/hello-world/eslint.config.js +1 -1
- package/templates/hello-world/package.json +7 -7
- package/templates/hello-world/tailor.d.ts +14 -0
- package/templates/inventory-management/.oxlintrc.json +1 -1
- package/templates/inventory-management/eslint.config.js +1 -1
- package/templates/inventory-management/package.json +7 -7
- package/templates/multi-application/.oxlintrc.json +1 -1
- package/templates/multi-application/eslint.config.js +1 -1
- package/templates/multi-application/package.json +7 -7
- package/templates/resolver/.oxlintrc.json +1 -1
- package/templates/resolver/eslint.config.js +1 -1
- package/templates/resolver/package.json +7 -7
- package/templates/resolver/tests/bundled.test.ts +2 -1
- package/templates/static-web-site/.oxlintrc.json +1 -1
- package/templates/static-web-site/eslint.config.js +1 -1
- package/templates/static-web-site/package.json +7 -7
- package/templates/static-web-site/tailor.config.ts +7 -1
- package/templates/static-web-site/tailor.d.ts +18 -0
- package/templates/tailordb/.oxlintrc.json +1 -1
- package/templates/tailordb/eslint.config.js +1 -1
- package/templates/tailordb/package.json +7 -7
- package/templates/workflow/.oxlintrc.json +1 -1
- package/templates/workflow/eslint.config.js +1 -1
- package/templates/workflow/package.json +7 -7
- package/templates/workflow/src/resolver/resolveApproval.test.ts +47 -0
- package/templates/workflow/src/resolver/resolveApproval.ts +22 -0
- package/templates/workflow/src/workflow/approval.test.ts +41 -0
- package/templates/workflow/src/workflow/approval.ts +27 -0
- package/templates/workflow/tests/bundled.test.ts +30 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/create-sdk",
|
|
3
|
-
"version": "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.
|
|
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.
|
|
32
|
-
"eslint-plugin-oxlint": "1.
|
|
33
|
-
"oxlint": "1.
|
|
34
|
-
"tsdown": "0.21.
|
|
31
|
+
"eslint": "10.2.1",
|
|
32
|
+
"eslint-plugin-oxlint": "1.61.0",
|
|
33
|
+
"oxlint": "1.61.0",
|
|
34
|
+
"tsdown": "0.21.9",
|
|
35
35
|
"typescript": "5.9.3",
|
|
36
|
-
"typescript-eslint": "8.
|
|
36
|
+
"typescript-eslint": "8.59.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown",
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "10.0.1",
|
|
18
|
-
"@tailor-platform/sdk": "1.
|
|
18
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
19
19
|
"@types/node": "24.12.2",
|
|
20
|
-
"eslint": "10.2.
|
|
21
|
-
"eslint-plugin-oxlint": "1.
|
|
22
|
-
"oxfmt": "0.
|
|
23
|
-
"oxlint": "1.
|
|
24
|
-
"oxlint-tsgolint": "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.
|
|
26
|
+
"typescript-eslint": "8.59.0",
|
|
27
27
|
"vitest": "4.1.4"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -2,8 +2,14 @@ import { defineAuth, defineConfig, defineIdp, definePlugins, t } from "@tailor-p
|
|
|
2
2
|
import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
|
|
3
3
|
|
|
4
4
|
const idp = defineIdp("main-idp", {
|
|
5
|
-
authorization: "loggedIn",
|
|
6
5
|
clients: ["default-idp-client"],
|
|
6
|
+
permission: {
|
|
7
|
+
create: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
8
|
+
read: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
9
|
+
update: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
10
|
+
delete: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
11
|
+
sendPasswordResetEmail: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
12
|
+
},
|
|
7
13
|
userAuthPolicy: {
|
|
8
14
|
useNonEmailIdentifier: false,
|
|
9
15
|
allowSelfPasswordReset: true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file is auto-generated by @tailor-platform/sdk
|
|
2
|
+
// Do not edit this file manually
|
|
3
|
+
// Regenerated automatically when running 'tailor-sdk apply' or 'tailor-sdk generate'
|
|
4
|
+
|
|
5
|
+
declare module "@tailor-platform/sdk" {
|
|
6
|
+
interface AttributeMap {
|
|
7
|
+
role: string;
|
|
8
|
+
}
|
|
9
|
+
interface AttributeList {
|
|
10
|
+
__tuple?: [];
|
|
11
|
+
}
|
|
12
|
+
interface Env {}
|
|
13
|
+
interface MachineUserNameRegistry {
|
|
14
|
+
admin: true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/", "src/seed/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "src/seed/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "10.0.1",
|
|
18
|
-
"@tailor-platform/sdk": "1.
|
|
18
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
19
19
|
"@types/node": "24.12.2",
|
|
20
|
-
"eslint": "10.2.
|
|
21
|
-
"eslint-plugin-oxlint": "1.
|
|
22
|
-
"oxfmt": "0.
|
|
23
|
-
"oxlint": "1.
|
|
24
|
-
"oxlint-tsgolint": "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.
|
|
26
|
+
"typescript-eslint": "8.59.0",
|
|
27
27
|
"vitest": "4.1.4"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -5,8 +5,14 @@ import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
|
|
|
5
5
|
import { seedPlugin } from "@tailor-platform/sdk/plugin/seed";
|
|
6
6
|
|
|
7
7
|
const idp = defineIdp("main-idp", {
|
|
8
|
-
authorization: "loggedIn",
|
|
9
8
|
clients: ["default-idp-client"],
|
|
9
|
+
permission: {
|
|
10
|
+
create: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
11
|
+
read: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
12
|
+
update: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
13
|
+
delete: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
14
|
+
sendPasswordResetEmail: [{ conditions: [[{ user: "role" }, "=", "admin"]], permit: true }],
|
|
15
|
+
},
|
|
10
16
|
});
|
|
11
17
|
|
|
12
18
|
export default defineConfig({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file is auto-generated by @tailor-platform/sdk
|
|
2
|
+
// Do not edit this file manually
|
|
3
|
+
// Regenerated automatically when running 'tailor-sdk apply' or 'tailor-sdk generate'
|
|
4
|
+
|
|
5
|
+
declare module "@tailor-platform/sdk" {
|
|
6
|
+
interface AttributeMap {
|
|
7
|
+
role: string;
|
|
8
|
+
}
|
|
9
|
+
interface AttributeList {
|
|
10
|
+
__tuple?: [];
|
|
11
|
+
}
|
|
12
|
+
interface Env {}
|
|
13
|
+
interface MachineUserNameRegistry {
|
|
14
|
+
admin: true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import oxlint from "eslint-plugin-oxlint";
|
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
7
|
// Ignore sdk's output directory.
|
|
8
|
-
globalIgnores([".tailor-sdk/"]),
|
|
8
|
+
globalIgnores([".tailor-sdk/", "tailor.d.ts"]),
|
|
9
9
|
// Use recommended rules.
|
|
10
10
|
// https://typescript-eslint.io/users/configs#projects-with-type-checking
|
|
11
11
|
eslint.configs.recommended,
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@eslint/js": "10.0.1",
|
|
16
|
-
"@tailor-platform/sdk": "1.
|
|
16
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
17
17
|
"@types/node": "24.12.2",
|
|
18
|
-
"eslint": "10.2.
|
|
19
|
-
"eslint-plugin-oxlint": "1.
|
|
20
|
-
"oxfmt": "0.
|
|
21
|
-
"oxlint": "1.
|
|
22
|
-
"oxlint-tsgolint": "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.
|
|
24
|
+
"typescript-eslint": "8.59.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// This file is auto-generated by @tailor-platform/sdk
|
|
2
|
+
// Do not edit this file manually
|
|
3
|
+
// Regenerated automatically when running 'tailor-sdk apply' or 'tailor-sdk generate'
|
|
4
|
+
|
|
5
|
+
declare module "@tailor-platform/sdk" {
|
|
6
|
+
interface AttributeMap {}
|
|
7
|
+
interface AttributeList {
|
|
8
|
+
__tuple?: [];
|
|
9
|
+
}
|
|
10
|
+
interface Env {}
|
|
11
|
+
interface MachineUserNameRegistry {}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import oxlint from "eslint-plugin-oxlint";
|
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
7
|
// Ignore sdk's output directory.
|
|
8
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
8
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
9
9
|
// Use recommended rules.
|
|
10
10
|
// https://typescript-eslint.io/users/configs#projects-with-type-checking
|
|
11
11
|
eslint.configs.recommended,
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@eslint/js": "10.0.1",
|
|
16
|
-
"@tailor-platform/sdk": "1.
|
|
16
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
17
17
|
"@types/node": "24.12.2",
|
|
18
|
-
"eslint": "10.2.
|
|
19
|
-
"eslint-plugin-oxlint": "1.
|
|
20
|
-
"oxfmt": "0.
|
|
21
|
-
"oxlint": "1.
|
|
22
|
-
"oxlint-tsgolint": "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.
|
|
24
|
+
"typescript-eslint": "8.59.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -5,7 +5,7 @@ import oxlint from "eslint-plugin-oxlint";
|
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
7
|
// Ignore sdk's output directory.
|
|
8
|
-
globalIgnores([".tailor-sdk/"]),
|
|
8
|
+
globalIgnores([".tailor-sdk/", "tailor.d.ts"]),
|
|
9
9
|
// Use recommended rules.
|
|
10
10
|
// https://typescript-eslint.io/users/configs#projects-with-type-checking
|
|
11
11
|
eslint.configs.recommended,
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@eslint/js": "10.0.1",
|
|
17
|
-
"@tailor-platform/sdk": "1.
|
|
17
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
18
18
|
"@types/node": "24.12.2",
|
|
19
|
-
"eslint": "10.2.
|
|
20
|
-
"eslint-plugin-oxlint": "1.
|
|
21
|
-
"oxfmt": "0.
|
|
22
|
-
"oxlint": "1.
|
|
23
|
-
"oxlint-tsgolint": "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.
|
|
25
|
+
"typescript-eslint": "8.59.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@eslint/js": "10.0.1",
|
|
20
|
-
"@tailor-platform/sdk": "1.
|
|
20
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
21
21
|
"@types/node": "24.12.2",
|
|
22
|
-
"eslint": "10.2.
|
|
23
|
-
"eslint-plugin-oxlint": "1.
|
|
24
|
-
"oxfmt": "0.
|
|
25
|
-
"oxlint": "1.
|
|
26
|
-
"oxlint-tsgolint": "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.
|
|
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(() => {
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@eslint/js": "10.0.1",
|
|
16
|
-
"@tailor-platform/sdk": "1.
|
|
16
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
17
17
|
"@types/node": "24.12.2",
|
|
18
|
-
"eslint": "10.2.
|
|
19
|
-
"eslint-plugin-oxlint": "1.
|
|
20
|
-
"oxfmt": "0.
|
|
21
|
-
"oxlint": "1.
|
|
22
|
-
"oxlint-tsgolint": "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.
|
|
24
|
+
"typescript-eslint": "8.59.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -6,8 +6,14 @@ const website = defineStaticWebSite("my-frontend", {
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const idp = defineIdp("my-idp", {
|
|
9
|
-
authorization: "loggedIn",
|
|
10
9
|
clients: ["default-idp-client"],
|
|
10
|
+
permission: {
|
|
11
|
+
create: [{ conditions: [[{ user: "role" }, "=", "ADMIN"]], permit: true }],
|
|
12
|
+
read: [{ conditions: [[{ user: "role" }, "=", "ADMIN"]], permit: true }],
|
|
13
|
+
update: [{ conditions: [[{ user: "role" }, "=", "ADMIN"]], permit: true }],
|
|
14
|
+
delete: [{ conditions: [[{ user: "role" }, "=", "ADMIN"]], permit: true }],
|
|
15
|
+
sendPasswordResetEmail: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
16
|
+
},
|
|
11
17
|
userAuthPolicy: {
|
|
12
18
|
useNonEmailIdentifier: false,
|
|
13
19
|
allowSelfPasswordReset: true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file is auto-generated by @tailor-platform/sdk
|
|
2
|
+
// Do not edit this file manually
|
|
3
|
+
// Regenerated automatically when running 'tailor-sdk apply' or 'tailor-sdk generate'
|
|
4
|
+
|
|
5
|
+
declare module "@tailor-platform/sdk" {
|
|
6
|
+
interface AttributeMap {
|
|
7
|
+
role: "ADMIN" | "MEMBER";
|
|
8
|
+
}
|
|
9
|
+
interface AttributeList {
|
|
10
|
+
__tuple?: [];
|
|
11
|
+
}
|
|
12
|
+
interface Env {}
|
|
13
|
+
interface MachineUserNameRegistry {
|
|
14
|
+
admin: true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "10.0.1",
|
|
18
|
-
"@tailor-platform/sdk": "1.
|
|
18
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
19
19
|
"@types/node": "24.12.2",
|
|
20
|
-
"eslint": "10.2.
|
|
21
|
-
"eslint-plugin-oxlint": "1.
|
|
22
|
-
"oxfmt": "0.
|
|
23
|
-
"oxlint": "1.
|
|
24
|
-
"oxlint-tsgolint": "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.
|
|
26
|
+
"typescript-eslint": "8.59.0",
|
|
27
27
|
"vitest": "4.1.4"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -4,7 +4,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
4
4
|
import oxlint from "eslint-plugin-oxlint";
|
|
5
5
|
|
|
6
6
|
export default defineConfig([
|
|
7
|
-
globalIgnores([".tailor-sdk/", "src/generated/"]),
|
|
7
|
+
globalIgnores([".tailor-sdk/", "src/generated/", "tailor.d.ts"]),
|
|
8
8
|
eslint.configs.recommended,
|
|
9
9
|
tseslint.configs.recommendedTypeChecked,
|
|
10
10
|
tseslint.configs.stylisticTypeChecked,
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@eslint/js": "10.0.1",
|
|
21
|
-
"@tailor-platform/sdk": "1.
|
|
21
|
+
"@tailor-platform/sdk": "1.43.0",
|
|
22
22
|
"@types/node": "24.12.2",
|
|
23
|
-
"eslint": "10.2.
|
|
24
|
-
"eslint-plugin-oxlint": "1.
|
|
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.
|
|
28
|
-
"oxlint": "1.
|
|
29
|
-
"oxlint-tsgolint": "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.
|
|
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 {
|
|
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");
|