@tailor-platform/create-sdk 2.0.0-next.1 → 2.0.0-next.10
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 +175 -0
- package/package.json +10 -9
- package/templates/executor/.oxlintrc.json +9 -1
- package/templates/executor/__dot__gitignore +1 -1
- package/templates/executor/package.json +11 -9
- package/templates/executor/src/db/auditLog.ts +1 -1
- package/templates/executor/src/db/notification.ts +1 -1
- package/templates/executor/src/db/user.ts +1 -1
- package/templates/executor/src/generated/db.ts +3 -3
- package/templates/executor/tailor.d.ts +4 -2
- package/templates/generators/.oxlintrc.json +9 -1
- package/templates/generators/README.md +1 -1
- package/templates/generators/__dot__gitignore +1 -1
- package/templates/generators/package.json +14 -9
- package/templates/generators/src/db/category.ts +1 -1
- package/templates/generators/src/db/order.ts +1 -1
- package/templates/generators/src/db/product.ts +1 -1
- package/templates/generators/src/db/user.ts +1 -1
- package/templates/generators/src/generated/db.ts +3 -3
- package/templates/generators/src/generated/files.ts +5 -5
- package/templates/generators/src/resolver/getProduct.test.ts +31 -27
- package/templates/generators/src/seed/data/Order.schema.ts +2 -2
- package/templates/generators/src/seed/data/Product.schema.ts +2 -2
- package/templates/generators/src/seed/data/User.schema.ts +2 -2
- package/templates/generators/tailor.d.ts +4 -2
- package/templates/hello-world/.oxlintrc.json +9 -1
- package/templates/hello-world/README.md +6 -6
- package/templates/hello-world/__dot__gitignore +1 -1
- package/templates/hello-world/package.json +10 -8
- package/templates/hello-world/src/db/user.ts +1 -1
- package/templates/hello-world/src/generated/kysely-tailordb.ts +1 -1
- package/templates/hello-world/tailor.d.ts +4 -2
- package/templates/inventory-management/.oxlintrc.json +9 -1
- package/templates/inventory-management/README.md +8 -8
- package/templates/inventory-management/__dot__gitignore +1 -1
- package/templates/inventory-management/package.json +10 -8
- package/templates/inventory-management/src/db/category.ts +1 -1
- package/templates/inventory-management/src/db/contact.ts +1 -1
- package/templates/inventory-management/src/db/inventory.ts +2 -2
- package/templates/inventory-management/src/db/notification.ts +1 -1
- package/templates/inventory-management/src/db/order.ts +1 -1
- package/templates/inventory-management/src/db/orderItem.ts +12 -8
- package/templates/inventory-management/src/db/product.ts +1 -1
- package/templates/inventory-management/src/db/user.ts +1 -1
- package/templates/inventory-management/src/executor/checkInventory.ts +0 -1
- package/templates/inventory-management/src/generated/kysely-tailordb.ts +9 -9
- package/templates/inventory-management/src/resolver/registerOrder.ts +4 -2
- package/templates/inventory-management/tailor.d.ts +4 -2
- package/templates/multi-application/.oxlintrc.json +9 -1
- package/templates/multi-application/README.md +2 -2
- package/templates/multi-application/__dot__gitignore +1 -1
- package/templates/multi-application/apps/admin/db/adminNote.ts +2 -2
- package/templates/multi-application/apps/admin/tailor.config.ts +1 -1
- package/templates/multi-application/apps/user/db/user.ts +1 -1
- package/templates/multi-application/apps/user/tailor.config.ts +1 -1
- package/templates/multi-application/package.json +10 -8
- package/templates/resolver/.oxlintrc.json +9 -1
- package/templates/resolver/README.md +2 -2
- package/templates/resolver/__dot__gitignore +1 -1
- package/templates/resolver/package.json +11 -9
- package/templates/resolver/src/db/user.ts +1 -1
- package/templates/resolver/src/generated/db.ts +1 -1
- package/templates/resolver/src/resolver/add.test.ts +4 -3
- package/templates/resolver/src/resolver/incrementUserAge.test.ts +6 -5
- package/templates/resolver/src/resolver/showEnv.test.ts +2 -2
- package/templates/resolver/src/resolver/showUserInfo.test.ts +12 -9
- package/templates/resolver/src/resolver/showUserInfo.ts +3 -3
- package/templates/resolver/src/resolver/upsertUsers.test.ts +2 -2
- package/templates/resolver/tailor.d.ts +4 -2
- package/templates/static-web-site/.oxlintrc.json +9 -1
- package/templates/static-web-site/__dot__gitignore +1 -1
- package/templates/static-web-site/package.json +10 -8
- package/templates/static-web-site/src/db/user.ts +1 -1
- package/templates/static-web-site/tailor.d.ts +4 -2
- package/templates/tailordb/.oxlintrc.json +9 -1
- package/templates/tailordb/README.md +1 -1
- package/templates/tailordb/__dot__gitignore +1 -1
- package/templates/tailordb/package.json +11 -9
- package/templates/tailordb/src/db/category.ts +1 -1
- package/templates/tailordb/src/db/comment.ts +4 -2
- package/templates/tailordb/src/db/task.ts +19 -27
- package/templates/tailordb/src/db/user.ts +1 -1
- package/templates/tailordb/src/generated/db.ts +3 -3
- package/templates/tailordb/tailor.d.ts +4 -2
- package/templates/workflow/.oxlintrc.json +9 -1
- package/templates/workflow/README.md +2 -2
- package/templates/workflow/__dot__gitignore +1 -1
- package/templates/workflow/e2e/globalSetup.ts +1 -1
- package/templates/workflow/e2e/workflow.test.ts +1 -1
- package/templates/workflow/package.json +12 -10
- package/templates/workflow/src/db/order.ts +1 -1
- package/templates/workflow/src/db/user.ts +1 -1
- package/templates/workflow/src/generated/db.ts +2 -2
- package/templates/workflow/src/resolver/resolveApproval.test.ts +18 -13
- package/templates/workflow/src/workflow/approval.test.ts +16 -11
- package/templates/workflow/src/workflow/approval.ts +2 -2
- package/templates/workflow/src/workflow/order-fulfillment.test.ts +30 -18
- package/templates/workflow/src/workflow/order-fulfillment.ts +3 -3
- package/templates/workflow/tailor.d.ts +4 -2
- package/templates/generators/src/seed/exec.mjs +0 -485
|
@@ -4,8 +4,8 @@ import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/t
|
|
|
4
4
|
import { user } from "../../db/user";
|
|
5
5
|
|
|
6
6
|
const schemaType = t.object({
|
|
7
|
-
...user.pickFields(["id"
|
|
8
|
-
...user.omitFields(["id"
|
|
7
|
+
...user.pickFields(["id"], { optional: true }),
|
|
8
|
+
...user.omitFields(["id"]),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const hook = createTailorDBHook(user);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by @tailor-platform/sdk
|
|
2
2
|
// Do not edit this file manually
|
|
3
|
-
// Regenerated automatically when running 'tailor
|
|
3
|
+
// Regenerated automatically when running 'tailor deploy' or 'tailor generate'
|
|
4
4
|
|
|
5
5
|
declare module "@tailor-platform/sdk" {
|
|
6
|
-
interface
|
|
6
|
+
interface Attributes {
|
|
7
7
|
role: string;
|
|
8
8
|
}
|
|
9
9
|
interface AttributeList {
|
|
@@ -16,6 +16,8 @@ declare module "@tailor-platform/sdk" {
|
|
|
16
16
|
interface IdpNameRegistry {
|
|
17
17
|
"main-idp": true;
|
|
18
18
|
}
|
|
19
|
+
interface ConnectionNameRegistry {}
|
|
20
|
+
interface AIGatewayNameRegistry {}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export {};
|
|
@@ -1,14 +1,22 @@
|
|
|
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
|
},
|
|
7
13
|
"env": {
|
|
8
14
|
"builtin": true
|
|
9
15
|
},
|
|
10
|
-
"ignorePatterns": [".tailor
|
|
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",
|
|
@@ -9,12 +9,12 @@ This project was bootstrapped with [Create Tailor Platform SDK](https://www.npmj
|
|
|
9
9
|
1. Create a new workspace:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx tailor
|
|
13
|
-
npx tailor
|
|
14
|
-
npx tailor
|
|
15
|
-
# For yarn: yarn tailor
|
|
16
|
-
# For pnpm: pnpm tailor
|
|
17
|
-
# For bun: bun tailor
|
|
12
|
+
npx tailor login
|
|
13
|
+
npx tailor workspace create --name <workspace-name> --region <workspace-region>
|
|
14
|
+
npx tailor workspace list
|
|
15
|
+
# For yarn: yarn tailor <command>
|
|
16
|
+
# For pnpm: pnpm tailor <command>
|
|
17
|
+
# For bun: bun tailor <command>
|
|
18
18
|
|
|
19
19
|
# OR
|
|
20
20
|
# Create a new workspace using Tailor Platform Console
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
node_modules/
|
|
2
|
-
.tailor
|
|
2
|
+
.tailor/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hello-world",
|
|
3
|
+
"version": "0.0.0",
|
|
3
4
|
"private": true,
|
|
4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
|
-
"deploy": "tailor
|
|
7
|
-
"generate": "tailor
|
|
7
|
+
"deploy": "tailor deploy",
|
|
8
|
+
"generate": "tailor generate",
|
|
8
9
|
"format": "oxfmt --write .",
|
|
9
10
|
"format:check": "oxfmt --check .",
|
|
10
11
|
"lint": "oxlint --type-aware .",
|
|
@@ -12,11 +13,12 @@
|
|
|
12
13
|
"typecheck": "tsc --noEmit"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
|
-
"@tailor-platform/sdk": "2.0
|
|
16
|
-
"@
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"oxlint
|
|
20
|
-
"
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.0-next.0",
|
|
17
|
+
"@tailor-platform/sdk": "2.0.0-next.10",
|
|
18
|
+
"@types/node": "24.13.3",
|
|
19
|
+
"oxfmt": "0.59.0",
|
|
20
|
+
"oxlint": "1.74.0",
|
|
21
|
+
"oxlint-tsgolint": "0.25.0",
|
|
22
|
+
"typescript": "6.0.3"
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "@tailor-platform/sdk";
|
|
6
6
|
|
|
7
7
|
export const user = db
|
|
8
|
-
.
|
|
8
|
+
.table("User", {
|
|
9
9
|
name: db.string().description("Name of the user"),
|
|
10
10
|
email: db.string().unique().description("Email address of the user"),
|
|
11
11
|
role: db.enum(["MANAGER", "STAFF"]),
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// This file is auto-generated by @tailor-platform/sdk
|
|
2
2
|
// Do not edit this file manually
|
|
3
|
-
// Regenerated automatically when running 'tailor
|
|
3
|
+
// Regenerated automatically when running 'tailor deploy' or 'tailor generate'
|
|
4
4
|
|
|
5
5
|
declare module "@tailor-platform/sdk" {
|
|
6
|
-
interface
|
|
6
|
+
interface Attributes {}
|
|
7
7
|
interface AttributeList {
|
|
8
8
|
__tuple?: [];
|
|
9
9
|
}
|
|
10
10
|
interface Env {}
|
|
11
11
|
interface MachineUserNameRegistry {}
|
|
12
12
|
interface IdpNameRegistry {}
|
|
13
|
+
interface ConnectionNameRegistry {}
|
|
14
|
+
interface AIGatewayNameRegistry {}
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export {};
|
|
@@ -1,14 +1,22 @@
|
|
|
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
|
},
|
|
7
13
|
"env": {
|
|
8
14
|
"builtin": true
|
|
9
15
|
},
|
|
10
|
-
"ignorePatterns": [".tailor
|
|
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",
|
|
@@ -9,12 +9,12 @@ This project was bootstrapped with [Create Tailor Platform SDK](https://www.npmj
|
|
|
9
9
|
1. Create a new workspace:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx tailor
|
|
13
|
-
npx tailor
|
|
14
|
-
npx tailor
|
|
15
|
-
# For yarn: yarn tailor
|
|
16
|
-
# For pnpm: pnpm tailor
|
|
17
|
-
# For bun: bun tailor
|
|
12
|
+
npx tailor login
|
|
13
|
+
npx tailor workspace create --name <workspace-name> --region <workspace-region>
|
|
14
|
+
npx tailor workspace list
|
|
15
|
+
# For yarn: yarn tailor <command>
|
|
16
|
+
# For pnpm: pnpm tailor <command>
|
|
17
|
+
# For bun: bun tailor <command>
|
|
18
18
|
|
|
19
19
|
# OR
|
|
20
20
|
# Create a new workspace using Tailor Platform Console
|
|
@@ -36,9 +36,9 @@ npm run deploy -- --workspace-id <your-workspace-id>
|
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
# Get Manager's token
|
|
39
|
-
npx tailor
|
|
39
|
+
npx tailor machineuser token manager --workspace-id <your-workspace-id>
|
|
40
40
|
# Get Staff's token
|
|
41
|
-
npx tailor
|
|
41
|
+
npx tailor machineuser token staff --workspace-id <your-workspace-id>
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Features
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
node_modules/
|
|
2
|
-
.tailor
|
|
2
|
+
.tailor/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inventory-management",
|
|
3
|
+
"version": "0.0.0",
|
|
3
4
|
"private": true,
|
|
4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
|
-
"deploy": "tailor
|
|
7
|
-
"generate": "tailor
|
|
7
|
+
"deploy": "tailor deploy",
|
|
8
|
+
"generate": "tailor generate",
|
|
8
9
|
"format": "oxfmt --write .",
|
|
9
10
|
"format:check": "oxfmt --check .",
|
|
10
11
|
"lint": "oxlint --type-aware .",
|
|
@@ -12,11 +13,12 @@
|
|
|
12
13
|
"typecheck": "tsc --noEmit"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
|
-
"@tailor-platform/sdk": "2.0
|
|
16
|
-
"@
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"oxlint
|
|
20
|
-
"
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.0-next.0",
|
|
17
|
+
"@tailor-platform/sdk": "2.0.0-next.10",
|
|
18
|
+
"@types/node": "24.13.3",
|
|
19
|
+
"oxfmt": "0.59.0",
|
|
20
|
+
"oxlint": "1.74.0",
|
|
21
|
+
"oxlint-tsgolint": "0.25.0",
|
|
22
|
+
"typescript": "6.0.3"
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -2,7 +2,7 @@ import { db } from "@tailor-platform/sdk";
|
|
|
2
2
|
import { gqlPermissionManager, permissionManager } from "./common/permission";
|
|
3
3
|
|
|
4
4
|
export const category = db
|
|
5
|
-
.
|
|
5
|
+
.table("Category", {
|
|
6
6
|
name: db.string().description("Name of the category").unique(),
|
|
7
7
|
description: db.string({ optional: true }).description("Description of the category"),
|
|
8
8
|
...db.fields.timestamps(),
|
|
@@ -2,7 +2,7 @@ import { db } from "@tailor-platform/sdk";
|
|
|
2
2
|
import { gqlPermissionManager, permissionManager } from "./common/permission";
|
|
3
3
|
|
|
4
4
|
export const contact = db
|
|
5
|
-
.
|
|
5
|
+
.table("Contact", {
|
|
6
6
|
name: db.string().description("Name of the contact"),
|
|
7
7
|
email: db.string().unique().description("Email address of the contact"),
|
|
8
8
|
phone: db.string({ optional: true }).description("Phone number of the contact"),
|
|
@@ -3,7 +3,7 @@ import { gqlPermissionLoggedIn, permissionLoggedIn } from "./common/permission";
|
|
|
3
3
|
import { product } from "./product";
|
|
4
4
|
|
|
5
5
|
export const inventory = db
|
|
6
|
-
.
|
|
6
|
+
.table("Inventory", {
|
|
7
7
|
productId: db
|
|
8
8
|
.uuid()
|
|
9
9
|
.description("ID of the product")
|
|
@@ -11,7 +11,7 @@ export const inventory = db
|
|
|
11
11
|
quantity: db
|
|
12
12
|
.int()
|
|
13
13
|
.description("Quantity of the product in inventory")
|
|
14
|
-
.validate(({ value }) => value
|
|
14
|
+
.validate(({ value }) => (value < 0 ? "Quantity must be non-negative" : undefined)),
|
|
15
15
|
...db.fields.timestamps(),
|
|
16
16
|
})
|
|
17
17
|
.permission(permissionLoggedIn)
|
|
@@ -2,7 +2,7 @@ import { db } from "@tailor-platform/sdk";
|
|
|
2
2
|
import { loggedIn, managerRole, permissionManager } from "./common/permission";
|
|
3
3
|
|
|
4
4
|
export const notification = db
|
|
5
|
-
.
|
|
5
|
+
.table("Notification", {
|
|
6
6
|
message: db.string().description("Notification message"),
|
|
7
7
|
...db.fields.timestamps(),
|
|
8
8
|
})
|
|
@@ -3,7 +3,7 @@ import { contact } from "./contact";
|
|
|
3
3
|
import { gqlPermissionLoggedIn, permissionLoggedIn } from "./common/permission";
|
|
4
4
|
|
|
5
5
|
export const order = db
|
|
6
|
-
.
|
|
6
|
+
.table("Order", {
|
|
7
7
|
name: db.string().description("Name of the order"),
|
|
8
8
|
description: db.string({ optional: true }).description("Description of the order"),
|
|
9
9
|
orderDate: db.datetime().description("Date of the order"),
|
|
@@ -4,7 +4,7 @@ import { product } from "./product";
|
|
|
4
4
|
import { gqlPermissionLoggedIn, permissionLoggedIn } from "./common/permission";
|
|
5
5
|
|
|
6
6
|
export const orderItem = db
|
|
7
|
-
.
|
|
7
|
+
.table("OrderItem", {
|
|
8
8
|
orderId: db
|
|
9
9
|
.uuid()
|
|
10
10
|
.description("ID of the order")
|
|
@@ -16,19 +16,23 @@ export const orderItem = db
|
|
|
16
16
|
quantity: db
|
|
17
17
|
.int()
|
|
18
18
|
.description("Quantity of the product")
|
|
19
|
-
.validate(({ value }) => value
|
|
19
|
+
.validate(({ value }) => (value < 0 ? "Quantity must be non-negative" : undefined)),
|
|
20
20
|
unitPrice: db
|
|
21
21
|
.float()
|
|
22
22
|
.description("Unit price of the product")
|
|
23
|
-
.validate(({ value }) => value
|
|
24
|
-
totalPrice: db.float(
|
|
23
|
+
.validate(({ value }) => (value < 0 ? "Unit price must be non-negative" : undefined)),
|
|
24
|
+
totalPrice: db.float().default(0).description("Total price of the order item"),
|
|
25
25
|
...db.fields.timestamps(),
|
|
26
26
|
})
|
|
27
27
|
.hooks({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
28
|
+
create: ({ input }) => ({
|
|
29
|
+
totalPrice: (input?.quantity ?? 0) * (input?.unitPrice ?? 0),
|
|
30
|
+
}),
|
|
31
|
+
update: ({ input, oldRecord }) => ({
|
|
32
|
+
totalPrice:
|
|
33
|
+
(input?.quantity ?? oldRecord?.quantity ?? 0) *
|
|
34
|
+
(input?.unitPrice ?? oldRecord?.unitPrice ?? 0),
|
|
35
|
+
}),
|
|
32
36
|
})
|
|
33
37
|
.permission(permissionLoggedIn)
|
|
34
38
|
.gqlPermission(gqlPermissionLoggedIn);
|
|
@@ -3,7 +3,7 @@ import { category } from "./category";
|
|
|
3
3
|
import { gqlPermissionManager, permissionManager } from "./common/permission";
|
|
4
4
|
|
|
5
5
|
export const product = db
|
|
6
|
-
.
|
|
6
|
+
.table("Product", {
|
|
7
7
|
name: db.string().description("Name of the product"),
|
|
8
8
|
description: db.string({ optional: true }).description("Description of the product"),
|
|
9
9
|
categoryId: db
|
|
@@ -2,7 +2,7 @@ import { db } from "@tailor-platform/sdk";
|
|
|
2
2
|
import { gqlPermissionManager, permissionManager } from "./common/permission";
|
|
3
3
|
|
|
4
4
|
export const user = db
|
|
5
|
-
.
|
|
5
|
+
.table("User", {
|
|
6
6
|
name: db.string().description("Name of the user"),
|
|
7
7
|
email: db.string().unique().description("Email address of the user"),
|
|
8
8
|
role: db.enum(["MANAGER", "STAFF"]),
|
|
@@ -18,7 +18,7 @@ export interface Namespace {
|
|
|
18
18
|
name: string;
|
|
19
19
|
description: string | null;
|
|
20
20
|
createdAt: Generated<Timestamp>;
|
|
21
|
-
updatedAt: Timestamp
|
|
21
|
+
updatedAt: Generated<Timestamp>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
Contact: {
|
|
@@ -28,7 +28,7 @@ export interface Namespace {
|
|
|
28
28
|
phone: string | null;
|
|
29
29
|
address: string | null;
|
|
30
30
|
createdAt: Generated<Timestamp>;
|
|
31
|
-
updatedAt: Timestamp
|
|
31
|
+
updatedAt: Generated<Timestamp>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
Inventory: {
|
|
@@ -36,14 +36,14 @@ export interface Namespace {
|
|
|
36
36
|
productId: string;
|
|
37
37
|
quantity: number;
|
|
38
38
|
createdAt: Generated<Timestamp>;
|
|
39
|
-
updatedAt: Timestamp
|
|
39
|
+
updatedAt: Generated<Timestamp>;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
Notification: {
|
|
43
43
|
id: Generated<string>;
|
|
44
44
|
message: string;
|
|
45
45
|
createdAt: Generated<Timestamp>;
|
|
46
|
-
updatedAt: Timestamp
|
|
46
|
+
updatedAt: Generated<Timestamp>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
Order: {
|
|
@@ -54,7 +54,7 @@ export interface Namespace {
|
|
|
54
54
|
orderType: "PURCHASE" | "SALES";
|
|
55
55
|
contactId: string;
|
|
56
56
|
createdAt: Generated<Timestamp>;
|
|
57
|
-
updatedAt: Timestamp
|
|
57
|
+
updatedAt: Generated<Timestamp>;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
OrderItem: {
|
|
@@ -63,9 +63,9 @@ export interface Namespace {
|
|
|
63
63
|
productId: string;
|
|
64
64
|
quantity: number;
|
|
65
65
|
unitPrice: number;
|
|
66
|
-
totalPrice: Generated<number
|
|
66
|
+
totalPrice: Generated<number>;
|
|
67
67
|
createdAt: Generated<Timestamp>;
|
|
68
|
-
updatedAt: Timestamp
|
|
68
|
+
updatedAt: Generated<Timestamp>;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
Product: {
|
|
@@ -74,7 +74,7 @@ export interface Namespace {
|
|
|
74
74
|
description: string | null;
|
|
75
75
|
categoryId: string;
|
|
76
76
|
createdAt: Generated<Timestamp>;
|
|
77
|
-
updatedAt: Timestamp
|
|
77
|
+
updatedAt: Generated<Timestamp>;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
User: {
|
|
@@ -83,7 +83,7 @@ export interface Namespace {
|
|
|
83
83
|
email: string;
|
|
84
84
|
role: "MANAGER" | "STAFF";
|
|
85
85
|
createdAt: Generated<Timestamp>;
|
|
86
|
-
updatedAt: Timestamp
|
|
86
|
+
updatedAt: Generated<Timestamp>;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -4,8 +4,10 @@ import { orderItem } from "../db/orderItem";
|
|
|
4
4
|
import { type DB, getDB } from "../generated/kysely-tailordb";
|
|
5
5
|
|
|
6
6
|
const input = {
|
|
7
|
-
order: t.object(order.omitFields(["id", "createdAt"])),
|
|
8
|
-
items: t.object(orderItem.omitFields(["id", "createdAt"]), {
|
|
7
|
+
order: t.object(order.omitFields(["id", "createdAt", "updatedAt"])),
|
|
8
|
+
items: t.object(orderItem.omitFields(["id", "createdAt", "updatedAt", "totalPrice"]), {
|
|
9
|
+
array: true,
|
|
10
|
+
}),
|
|
9
11
|
};
|
|
10
12
|
interface Input {
|
|
11
13
|
order: t.infer<typeof input.order>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by @tailor-platform/sdk
|
|
2
2
|
// Do not edit this file manually
|
|
3
|
-
// Regenerated automatically when running 'tailor
|
|
3
|
+
// Regenerated automatically when running 'tailor deploy' or 'tailor generate'
|
|
4
4
|
|
|
5
5
|
declare module "@tailor-platform/sdk" {
|
|
6
|
-
interface
|
|
6
|
+
interface Attributes {
|
|
7
7
|
role: "MANAGER" | "STAFF";
|
|
8
8
|
}
|
|
9
9
|
interface AttributeList {
|
|
@@ -15,6 +15,8 @@ declare module "@tailor-platform/sdk" {
|
|
|
15
15
|
staff: true;
|
|
16
16
|
}
|
|
17
17
|
interface IdpNameRegistry {}
|
|
18
|
+
interface ConnectionNameRegistry {}
|
|
19
|
+
interface AIGatewayNameRegistry {}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export {};
|
|
@@ -1,14 +1,22 @@
|
|
|
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
|
},
|
|
7
13
|
"env": {
|
|
8
14
|
"builtin": true
|
|
9
15
|
},
|
|
10
|
-
"ignorePatterns": [".tailor
|
|
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",
|
|
@@ -16,8 +16,8 @@ This project contains two applications: `user` and `admin`.
|
|
|
16
16
|
1. Create a new workspace:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npx tailor
|
|
20
|
-
npx tailor
|
|
19
|
+
npx tailor login
|
|
20
|
+
npx tailor workspace create --name <workspace-name> --region <workspace-region>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
2. Deploy the project:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
node_modules/
|
|
2
|
-
.tailor
|
|
2
|
+
.tailor/
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "@tailor-platform/sdk";
|
|
6
6
|
|
|
7
7
|
export const adminNote = db
|
|
8
|
-
.
|
|
8
|
+
.table("AdminNote", {
|
|
9
9
|
title: db.string(),
|
|
10
10
|
content: db.string(),
|
|
11
|
-
authorId: db.uuid().hooks({ create: ({
|
|
11
|
+
authorId: db.uuid().hooks({ create: ({ invoker }) => invoker?.id ?? crypto.randomUUID() }),
|
|
12
12
|
...db.fields.timestamps(),
|
|
13
13
|
})
|
|
14
14
|
// NOTE: This permits all operations for simplicity.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multi-application",
|
|
3
|
+
"version": "0.0.0",
|
|
3
4
|
"private": true,
|
|
4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"deploy": "pnpm run deploy:user && pnpm run deploy:admin",
|
|
7
|
-
"deploy:user": "tailor
|
|
8
|
-
"deploy:admin": "tailor
|
|
8
|
+
"deploy:user": "tailor deploy -c apps/user/tailor.config.ts",
|
|
9
|
+
"deploy:admin": "tailor deploy -c apps/admin/tailor.config.ts",
|
|
9
10
|
"format": "oxfmt --write .",
|
|
10
11
|
"format:check": "oxfmt --check .",
|
|
11
12
|
"lint": "oxlint --type-aware .",
|
|
@@ -13,11 +14,12 @@
|
|
|
13
14
|
"typecheck": "tsc --noEmit"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/sdk": "2.0
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"oxlint
|
|
21
|
-
"
|
|
17
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.0-next.0",
|
|
18
|
+
"@tailor-platform/sdk": "2.0.0-next.10",
|
|
19
|
+
"@types/node": "24.13.3",
|
|
20
|
+
"oxfmt": "0.59.0",
|
|
21
|
+
"oxlint": "1.74.0",
|
|
22
|
+
"oxlint-tsgolint": "0.25.0",
|
|
23
|
+
"typescript": "6.0.3"
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
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
|
},
|
|
7
13
|
"env": {
|
|
8
14
|
"builtin": true
|
|
9
15
|
},
|
|
10
|
-
"ignorePatterns": [".tailor
|
|
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",
|
|
@@ -8,11 +8,11 @@ Demonstrates all resolver patterns with comprehensive testing approaches.
|
|
|
8
8
|
- Database query resolver (Kysely with transactions)
|
|
9
9
|
- Database mutation resolver (dependency injection pattern)
|
|
10
10
|
- Environment variable access
|
|
11
|
-
-
|
|
11
|
+
- Caller and invoker context access
|
|
12
12
|
|
|
13
13
|
## Testing Approaches
|
|
14
14
|
|
|
15
|
-
1. **Direct `body()` call** - Simple resolvers with `
|
|
15
|
+
1. **Direct `body()` call** - Simple resolvers with explicit `caller` / `invoker` context values
|
|
16
16
|
2. **`tailor-runtime` environment + `mockTailordb`** - Database resolvers via `mockTailordb` from `@tailor-platform/sdk/vitest` (no `vi.stubGlobal` needed)
|
|
17
17
|
3. **Dependency injection** - Extract `DbOperations` interface for testability
|
|
18
18
|
|