@tailor-platform/create-sdk 0.16.3 → 0.18.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/README.md +55 -0
- package/package.json +4 -4
- package/templates/hello-world/README.md +1 -1
- package/templates/hello-world/package.json +5 -5
- package/templates/hello-world/tsconfig.json +2 -1
- package/templates/inventory-management/README.md +2 -2
- package/templates/inventory-management/package.json +5 -5
- package/templates/multi-application/package.json +5 -5
- package/templates/multi-application/tsconfig.json +2 -1
- package/templates/testing/e2e/globalSetup.ts +10 -10
- package/templates/testing/e2e/workflow.test.ts +3 -3
- package/templates/testing/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tailor-platform/create-sdk
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
## 0.17.0
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#182](https://github.com/tailor-platform/sdk/pull/182) [`a74af85`](https://github.com/tailor-platform/sdk/commit/a74af854b796cfdb701a1f8f78dbabcdfbd3fe02) Thanks [@toiroakr](https://github.com/toiroakr)! - chore: Add comprehensive documentation
|
|
10
|
+
|
|
3
11
|
## 0.16.3
|
|
4
12
|
|
|
5
13
|
## 0.16.2
|
package/README.md
CHANGED
|
@@ -20,6 +20,57 @@ pnpm create @tailor-platform/sdk [OPTIONS] [NAME]
|
|
|
20
20
|
|
|
21
21
|
- `--template <template-name>`: (Optional) Specify a template to use for your project. If not provided, you'll be prompted to select one from a list of available templates.
|
|
22
22
|
|
|
23
|
+
## Available Templates
|
|
24
|
+
|
|
25
|
+
| Template | Description | Features |
|
|
26
|
+
| ---------------------- | -------------------------------- | ----------------------------------------- |
|
|
27
|
+
| `hello-world` | Minimal starter project | Simple resolver example |
|
|
28
|
+
| `inventory-management` | Full-featured sample application | TailorDB, Resolver, Executor, Permissions |
|
|
29
|
+
| `testing` | Testing patterns guide | Unit tests, E2E tests, Vitest setup |
|
|
30
|
+
| `multi-application` | Multi-app architecture | Shared databases, multiple applications |
|
|
31
|
+
|
|
32
|
+
### hello-world
|
|
33
|
+
|
|
34
|
+
A minimal starter project with a single resolver. Best for learning the basics of the SDK.
|
|
35
|
+
|
|
36
|
+
**Includes:**
|
|
37
|
+
|
|
38
|
+
- Simple "hello" query resolver
|
|
39
|
+
- Basic project configuration
|
|
40
|
+
|
|
41
|
+
### inventory-management
|
|
42
|
+
|
|
43
|
+
A complete inventory management system demonstrating real-world patterns.
|
|
44
|
+
|
|
45
|
+
**Includes:**
|
|
46
|
+
|
|
47
|
+
- TailorDB types: User, Product, Category, Order, Inventory, Contact, Notification
|
|
48
|
+
- Role-based permissions (Manager, Staff)
|
|
49
|
+
- Custom resolver for order registration with inventory updates
|
|
50
|
+
- Executor for inventory threshold monitoring
|
|
51
|
+
- Machine users for API access
|
|
52
|
+
|
|
53
|
+
### testing
|
|
54
|
+
|
|
55
|
+
A comprehensive guide to testing patterns with Vitest.
|
|
56
|
+
|
|
57
|
+
**Includes:**
|
|
58
|
+
|
|
59
|
+
- Unit test examples (simple resolver, mock TailorDB, dependency injection)
|
|
60
|
+
- E2E test setup with deployed application
|
|
61
|
+
- CI/CD integration patterns
|
|
62
|
+
- Global setup for test credentials
|
|
63
|
+
|
|
64
|
+
### multi-application
|
|
65
|
+
|
|
66
|
+
Demonstrates multiple applications sharing databases within a workspace.
|
|
67
|
+
|
|
68
|
+
**Includes:**
|
|
69
|
+
|
|
70
|
+
- User application (owns shared database)
|
|
71
|
+
- Admin application (references shared database as external)
|
|
72
|
+
- Coordinated deployment scripts
|
|
73
|
+
|
|
23
74
|
## What it does
|
|
24
75
|
|
|
25
76
|
This tool will:
|
|
@@ -33,3 +84,7 @@ This tool will:
|
|
|
33
84
|
|
|
34
85
|
- If none of the supported package managers (npm, yarn, pnpm) are found, dependency installation will be skipped.
|
|
35
86
|
- If the project already exists within a git repository, git initialization will be skipped.
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
For complete SDK documentation, see the [SDK documentation](https://github.com/tailor-platform/sdk/blob/main/packages/sdk/docs/quickstart.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/create-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "A CLI tool to quickly create a new Tailor Platform SDK project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"pkg-types": "2.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@eslint/js": "9.39.
|
|
29
|
-
"@types/node": "22.19.
|
|
30
|
-
"eslint": "9.39.
|
|
28
|
+
"@eslint/js": "9.39.2",
|
|
29
|
+
"@types/node": "22.19.3",
|
|
30
|
+
"eslint": "9.39.2",
|
|
31
31
|
"tsdown": "0.15.6",
|
|
32
32
|
"typescript": "5.9.3",
|
|
33
33
|
"typescript-eslint": "8.49.0"
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"typecheck": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@eslint/js": "9.39.
|
|
15
|
-
"@tailor-platform/sdk": "0.
|
|
16
|
-
"@types/node": "22.19.
|
|
17
|
-
"eslint": "9.39.
|
|
18
|
-
"prettier": "3.7.
|
|
14
|
+
"@eslint/js": "9.39.2",
|
|
15
|
+
"@tailor-platform/sdk": "0.18.0",
|
|
16
|
+
"@types/node": "22.19.3",
|
|
17
|
+
"eslint": "9.39.2",
|
|
18
|
+
"prettier": "3.7.4",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"typescript-eslint": "8.49.0"
|
|
21
21
|
}
|
|
@@ -34,9 +34,9 @@ npm run deploy -- --workspace-id <your-workspace-id>
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Get Manager's token
|
|
37
|
-
npx tailor-sdk machineuser token
|
|
37
|
+
npx tailor-sdk machineuser token manager --workspace-id <your-workspace-id>
|
|
38
38
|
# Get Staff's token
|
|
39
|
-
npx tailor-sdk machineuser token
|
|
39
|
+
npx tailor-sdk machineuser token staff --workspace-id <your-workspace-id>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Features
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"kysely": "0.28.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@eslint/js": "9.39.
|
|
19
|
+
"@eslint/js": "9.39.2",
|
|
20
20
|
"@tailor-platform/function-types": "0.8.0",
|
|
21
|
-
"@tailor-platform/sdk": "0.
|
|
22
|
-
"@types/node": "22.19.
|
|
23
|
-
"eslint": "9.39.
|
|
24
|
-
"prettier": "3.7.
|
|
21
|
+
"@tailor-platform/sdk": "0.18.0",
|
|
22
|
+
"@types/node": "22.19.3",
|
|
23
|
+
"eslint": "9.39.2",
|
|
24
|
+
"prettier": "3.7.4",
|
|
25
25
|
"typescript": "5.9.3",
|
|
26
26
|
"typescript-eslint": "8.49.0"
|
|
27
27
|
}
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@eslint/js": "9.39.
|
|
17
|
-
"@tailor-platform/sdk": "0.
|
|
18
|
-
"@types/node": "22.19.
|
|
19
|
-
"eslint": "9.39.
|
|
20
|
-
"prettier": "3.7.
|
|
16
|
+
"@eslint/js": "9.39.2",
|
|
17
|
+
"@tailor-platform/sdk": "0.18.0",
|
|
18
|
+
"@types/node": "22.19.3",
|
|
19
|
+
"eslint": "9.39.2",
|
|
20
|
+
"prettier": "3.7.4",
|
|
21
21
|
"typescript": "5.9.3",
|
|
22
22
|
"typescript-eslint": "8.49.0"
|
|
23
23
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
apply,
|
|
3
|
-
|
|
3
|
+
getMachineUserToken,
|
|
4
4
|
show,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
createWorkspace,
|
|
6
|
+
deleteWorkspace,
|
|
7
7
|
type WorkspaceInfo,
|
|
8
8
|
} from "@tailor-platform/sdk/cli";
|
|
9
9
|
import type { TestProject } from "vitest/node";
|
|
@@ -17,9 +17,9 @@ declare module "vitest" {
|
|
|
17
17
|
|
|
18
18
|
let createdWorkspace: WorkspaceInfo | null = null;
|
|
19
19
|
|
|
20
|
-
async function
|
|
20
|
+
async function setupWorkspace(name: string, region: string) {
|
|
21
21
|
console.log(`Creating workspace "${name}" in region "${region}"...`);
|
|
22
|
-
const workspace = await
|
|
22
|
+
const workspace = await createWorkspace({ name, region });
|
|
23
23
|
console.log(`Workspace "${workspace.name}" created successfully.`);
|
|
24
24
|
return workspace;
|
|
25
25
|
}
|
|
@@ -30,9 +30,9 @@ async function deployApplication() {
|
|
|
30
30
|
console.log("Application deployed successfully.");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
async function
|
|
33
|
+
async function cleanupWorkspace(workspaceId: string) {
|
|
34
34
|
console.log("Deleting workspace...");
|
|
35
|
-
await
|
|
35
|
+
await deleteWorkspace({ workspaceId });
|
|
36
36
|
console.log("Workspace deleted successfully.");
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -46,20 +46,20 @@ export async function setup(project: TestProject) {
|
|
|
46
46
|
"TAILOR_PLATFORM_WORKSPACE_NAME and TAILOR_PLATFORM_WORKSPACE_REGION must be set when CI=true",
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
createdWorkspace = await
|
|
49
|
+
createdWorkspace = await setupWorkspace(workspaceName, workspaceRegion);
|
|
50
50
|
process.env.TAILOR_PLATFORM_WORKSPACE_ID = createdWorkspace.id;
|
|
51
51
|
await deployApplication();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const app = await show();
|
|
55
|
-
const tokens = await
|
|
55
|
+
const tokens = await getMachineUserToken({ name: "admin" });
|
|
56
56
|
project.provide("url", app.url);
|
|
57
57
|
project.provide("token", tokens.accessToken);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export async function teardown() {
|
|
61
61
|
if (createdWorkspace) {
|
|
62
|
-
await
|
|
62
|
+
await cleanupWorkspace(createdWorkspace.id);
|
|
63
63
|
createdWorkspace = null;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import {
|
|
3
|
+
import { startWorkflow } from "@tailor-platform/sdk/cli";
|
|
4
4
|
|
|
5
5
|
describe.concurrent("workflow", () => {
|
|
6
6
|
test(
|
|
7
7
|
"simple-calculation: execute workflow and verify success",
|
|
8
8
|
{ timeout: 120000 },
|
|
9
9
|
async () => {
|
|
10
|
-
const { executionId, wait } = await
|
|
10
|
+
const { executionId, wait } = await startWorkflow({
|
|
11
11
|
nameOrId: "simple-calculation",
|
|
12
12
|
machineUser: "admin",
|
|
13
13
|
arg: { a: 2, b: 3 },
|
|
@@ -30,7 +30,7 @@ describe.concurrent("workflow", () => {
|
|
|
30
30
|
const uuid = randomUUID();
|
|
31
31
|
const testEmail = `workflow-test-${uuid}@example.com`;
|
|
32
32
|
|
|
33
|
-
const { executionId, wait } = await
|
|
33
|
+
const { executionId, wait } = await startWorkflow({
|
|
34
34
|
nameOrId: "user-profile-sync",
|
|
35
35
|
machineUser: "admin",
|
|
36
36
|
arg: {
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"kysely": "0.28.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@eslint/js": "9.39.
|
|
22
|
+
"@eslint/js": "9.39.2",
|
|
23
23
|
"@tailor-platform/function-types": "0.8.0",
|
|
24
|
-
"@tailor-platform/sdk": "0.
|
|
25
|
-
"@types/node": "22.19.
|
|
26
|
-
"eslint": "9.39.
|
|
27
|
-
"graphql-request": "7.
|
|
28
|
-
"prettier": "3.7.
|
|
24
|
+
"@tailor-platform/sdk": "0.18.0",
|
|
25
|
+
"@types/node": "22.19.3",
|
|
26
|
+
"eslint": "9.39.2",
|
|
27
|
+
"graphql-request": "7.4.0",
|
|
28
|
+
"prettier": "3.7.4",
|
|
29
29
|
"typescript": "5.9.3",
|
|
30
30
|
"typescript-eslint": "8.49.0",
|
|
31
|
-
"vitest": "4.0.
|
|
31
|
+
"vitest": "4.0.15"
|
|
32
32
|
}
|
|
33
33
|
}
|