@tailor-platform/create-sdk 2.0.0-next.1 → 2.0.0-next.11

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/package.json +10 -9
  3. package/templates/executor/.oxlintrc.json +10 -1
  4. package/templates/executor/__dot__gitignore +1 -1
  5. package/templates/executor/package.json +11 -9
  6. package/templates/executor/src/db/auditLog.ts +1 -1
  7. package/templates/executor/src/db/notification.ts +1 -1
  8. package/templates/executor/src/db/user.ts +1 -1
  9. package/templates/executor/src/generated/db.ts +3 -3
  10. package/templates/executor/tailor.d.ts +4 -2
  11. package/templates/generators/.oxlintrc.json +10 -1
  12. package/templates/generators/README.md +1 -1
  13. package/templates/generators/__dot__gitignore +1 -1
  14. package/templates/generators/package.json +14 -9
  15. package/templates/generators/src/db/category.ts +1 -1
  16. package/templates/generators/src/db/order.ts +1 -1
  17. package/templates/generators/src/db/product.ts +1 -1
  18. package/templates/generators/src/db/user.ts +1 -1
  19. package/templates/generators/src/generated/db.ts +3 -3
  20. package/templates/generators/src/generated/files.ts +5 -5
  21. package/templates/generators/src/resolver/getProduct.test.ts +31 -27
  22. package/templates/generators/src/seed/data/Order.schema.ts +2 -2
  23. package/templates/generators/src/seed/data/Product.schema.ts +2 -2
  24. package/templates/generators/src/seed/data/User.schema.ts +2 -2
  25. package/templates/generators/tailor.d.ts +4 -2
  26. package/templates/hello-world/.oxlintrc.json +10 -1
  27. package/templates/hello-world/README.md +6 -6
  28. package/templates/hello-world/__dot__gitignore +1 -1
  29. package/templates/hello-world/package.json +10 -8
  30. package/templates/hello-world/src/db/user.ts +1 -1
  31. package/templates/hello-world/src/generated/kysely-tailordb.ts +1 -1
  32. package/templates/hello-world/tailor.d.ts +4 -2
  33. package/templates/inventory-management/.oxlintrc.json +10 -1
  34. package/templates/inventory-management/README.md +8 -8
  35. package/templates/inventory-management/__dot__gitignore +1 -1
  36. package/templates/inventory-management/package.json +10 -8
  37. package/templates/inventory-management/src/db/category.ts +1 -1
  38. package/templates/inventory-management/src/db/contact.ts +1 -1
  39. package/templates/inventory-management/src/db/inventory.ts +2 -2
  40. package/templates/inventory-management/src/db/notification.ts +1 -1
  41. package/templates/inventory-management/src/db/order.ts +1 -1
  42. package/templates/inventory-management/src/db/orderItem.ts +12 -8
  43. package/templates/inventory-management/src/db/product.ts +1 -1
  44. package/templates/inventory-management/src/db/user.ts +1 -1
  45. package/templates/inventory-management/src/executor/checkInventory.ts +0 -1
  46. package/templates/inventory-management/src/generated/kysely-tailordb.ts +9 -9
  47. package/templates/inventory-management/src/resolver/registerOrder.ts +4 -2
  48. package/templates/inventory-management/tailor.d.ts +4 -2
  49. package/templates/multi-application/.oxlintrc.json +10 -1
  50. package/templates/multi-application/README.md +2 -2
  51. package/templates/multi-application/__dot__gitignore +1 -1
  52. package/templates/multi-application/apps/admin/db/adminNote.ts +2 -2
  53. package/templates/multi-application/apps/admin/tailor.config.ts +1 -1
  54. package/templates/multi-application/apps/user/db/user.ts +1 -1
  55. package/templates/multi-application/apps/user/tailor.config.ts +1 -1
  56. package/templates/multi-application/package.json +10 -8
  57. package/templates/resolver/.oxlintrc.json +10 -1
  58. package/templates/resolver/README.md +2 -2
  59. package/templates/resolver/__dot__gitignore +1 -1
  60. package/templates/resolver/package.json +11 -9
  61. package/templates/resolver/src/db/user.ts +1 -1
  62. package/templates/resolver/src/generated/db.ts +1 -1
  63. package/templates/resolver/src/resolver/add.test.ts +4 -3
  64. package/templates/resolver/src/resolver/incrementUserAge.test.ts +6 -5
  65. package/templates/resolver/src/resolver/showEnv.test.ts +2 -2
  66. package/templates/resolver/src/resolver/showUserInfo.test.ts +12 -9
  67. package/templates/resolver/src/resolver/showUserInfo.ts +3 -3
  68. package/templates/resolver/src/resolver/upsertUsers.test.ts +2 -2
  69. package/templates/resolver/tailor.d.ts +6 -4
  70. package/templates/static-web-site/.oxlintrc.json +10 -1
  71. package/templates/static-web-site/__dot__gitignore +1 -1
  72. package/templates/static-web-site/package.json +10 -8
  73. package/templates/static-web-site/src/db/user.ts +1 -1
  74. package/templates/static-web-site/tailor.d.ts +4 -2
  75. package/templates/tailordb/.oxlintrc.json +10 -1
  76. package/templates/tailordb/README.md +1 -1
  77. package/templates/tailordb/__dot__gitignore +1 -1
  78. package/templates/tailordb/package.json +11 -9
  79. package/templates/tailordb/src/db/category.ts +1 -1
  80. package/templates/tailordb/src/db/comment.ts +4 -2
  81. package/templates/tailordb/src/db/task.ts +19 -27
  82. package/templates/tailordb/src/db/user.ts +1 -1
  83. package/templates/tailordb/src/generated/db.ts +3 -3
  84. package/templates/tailordb/tailor.d.ts +4 -2
  85. package/templates/workflow/.oxlintrc.json +10 -1
  86. package/templates/workflow/README.md +2 -2
  87. package/templates/workflow/__dot__gitignore +1 -1
  88. package/templates/workflow/e2e/globalSetup.ts +1 -1
  89. package/templates/workflow/e2e/workflow.test.ts +1 -1
  90. package/templates/workflow/package.json +12 -10
  91. package/templates/workflow/src/db/order.ts +1 -1
  92. package/templates/workflow/src/db/user.ts +1 -1
  93. package/templates/workflow/src/generated/db.ts +2 -2
  94. package/templates/workflow/src/resolver/resolveApproval.test.ts +18 -13
  95. package/templates/workflow/src/workflow/approval.test.ts +16 -11
  96. package/templates/workflow/src/workflow/approval.ts +2 -2
  97. package/templates/workflow/src/workflow/order-fulfillment.test.ts +30 -18
  98. package/templates/workflow/src/workflow/order-fulfillment.ts +3 -3
  99. package/templates/workflow/tailor.d.ts +4 -2
  100. package/templates/generators/src/seed/exec.mjs +0 -485
@@ -1,4 +1,3 @@
1
- import { unauthenticatedTailorUser } from "@tailor-platform/sdk/test";
2
1
  import { mockTailordb } from "@tailor-platform/sdk/vitest";
3
2
  import { describe, expect, test } from "vitest";
4
3
  import resolver from "./getProduct";
@@ -6,23 +5,26 @@ import resolver from "./getProduct";
6
5
  describe("getProduct resolver", () => {
7
6
  test("returns product with category", async () => {
8
7
  using db = mockTailordb();
9
- // Select product
10
- db.enqueueResult({
11
- id: "product-1",
12
- name: "Widget",
13
- price: 9.99,
14
- status: "ACTIVE",
15
- categoryId: "cat-1",
16
- description: null,
17
- createdAt: new Date(),
18
- updatedAt: null,
19
- });
20
- // Select category
21
- db.enqueueResult({ name: "Gadgets" });
8
+ db.enqueueRows(
9
+ [
10
+ {
11
+ id: "product-1",
12
+ name: "Widget",
13
+ price: 9.99,
14
+ status: "ACTIVE",
15
+ categoryId: "cat-1",
16
+ description: null,
17
+ createdAt: new Date(),
18
+ updatedAt: null,
19
+ },
20
+ ],
21
+ [{ name: "Gadgets" }],
22
+ );
22
23
 
23
24
  const result = await resolver.body({
24
25
  input: { productId: "product-1" },
25
- user: unauthenticatedTailorUser,
26
+ caller: null,
27
+ invoker: null,
26
28
  env: {},
27
29
  });
28
30
 
@@ -37,21 +39,23 @@ describe("getProduct resolver", () => {
37
39
 
38
40
  test("returns product without category", async () => {
39
41
  using db = mockTailordb();
40
- // Select product (no categoryId)
41
- db.enqueueResult({
42
- id: "product-2",
43
- name: "Standalone Item",
44
- price: 19.99,
45
- status: "DRAFT",
46
- categoryId: null,
47
- description: null,
48
- createdAt: new Date(),
49
- updatedAt: null,
50
- });
42
+ db.enqueueRows([
43
+ {
44
+ id: "product-2",
45
+ name: "Standalone Item",
46
+ price: 19.99,
47
+ status: "DRAFT",
48
+ categoryId: null,
49
+ description: null,
50
+ createdAt: new Date(),
51
+ updatedAt: null,
52
+ },
53
+ ]);
51
54
 
52
55
  const result = await resolver.body({
53
56
  input: { productId: "product-2" },
54
- user: unauthenticatedTailorUser,
57
+ caller: null,
58
+ invoker: null,
55
59
  env: {},
56
60
  });
57
61
 
@@ -4,8 +4,8 @@ import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/t
4
4
  import { order } from "../../db/order";
5
5
 
6
6
  const schemaType = t.object({
7
- ...order.pickFields(["id","createdAt"], { optional: true }),
8
- ...order.omitFields(["id","createdAt"]),
7
+ ...order.pickFields(["id"], { optional: true }),
8
+ ...order.omitFields(["id"]),
9
9
  });
10
10
 
11
11
  const hook = createTailorDBHook(order);
@@ -4,8 +4,8 @@ import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/t
4
4
  import { product } from "../../db/product";
5
5
 
6
6
  const schemaType = t.object({
7
- ...product.pickFields(["id","createdAt"], { optional: true }),
8
- ...product.omitFields(["id","createdAt"]),
7
+ ...product.pickFields(["id"], { optional: true }),
8
+ ...product.omitFields(["id"]),
9
9
  });
10
10
 
11
11
  const hook = createTailorDBHook(product);
@@ -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","createdAt"], { optional: true }),
8
- ...user.omitFields(["id","createdAt"]),
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-sdk deploy' or 'tailor-sdk generate'
3
+ // Regenerated automatically when running 'tailor deploy' or 'tailor generate'
4
4
 
5
5
  declare module "@tailor-platform/sdk" {
6
- interface AttributeMap {
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,23 @@
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-sdk/", "tailor.d.ts"],
16
+ "ignorePatterns": [".tailor/", "tailor.d.ts"],
11
17
  "rules": {
18
+ "tailor-sdk/no-api-prefix-in-path-pattern": "warn",
19
+ "tailor-sdk/no-execute-script-arg-stringify": "warn",
20
+ "tailor-sdk/no-unconditional-permit": "warn",
12
21
  "no-case-declarations": "error",
13
22
  "no-empty": "error",
14
23
  "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-sdk login
13
- npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
14
- npx tailor-sdk workspace list
15
- # For yarn: yarn tailor-sdk <command>
16
- # For pnpm: pnpm tailor-sdk <command>
17
- # For bun: bun tailor-sdk <command>
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-sdk/
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-sdk deploy",
7
- "generate": "tailor-sdk generate",
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.0-next.1",
16
- "@types/node": "24.13.2",
17
- "oxfmt": "0.54.0",
18
- "oxlint": "1.69.0",
19
- "oxlint-tsgolint": "0.23.0",
20
- "typescript": "5.9.3"
16
+ "@tailor-platform/eslint-plugin-sdk": "0.2.0-next.1",
17
+ "@tailor-platform/sdk": "2.0.0-next.11",
18
+ "@types/node": "24.13.3",
19
+ "oxfmt": "0.61.0",
20
+ "oxlint": "1.76.0",
21
+ "oxlint-tsgolint": "7.0.2001",
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
- .type("User", {
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"]),
@@ -19,7 +19,7 @@ export interface Namespace {
19
19
  email: string;
20
20
  role: "MANAGER" | "STAFF";
21
21
  createdAt: Generated<Timestamp>;
22
- updatedAt: Timestamp | null;
22
+ updatedAt: Generated<Timestamp>;
23
23
  }
24
24
  }
25
25
  }
@@ -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-sdk deploy' or 'tailor-sdk generate'
3
+ // Regenerated automatically when running 'tailor deploy' or 'tailor generate'
4
4
 
5
5
  declare module "@tailor-platform/sdk" {
6
- interface AttributeMap {}
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,23 @@
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-sdk/", "src/generated/", "tailor.d.ts"],
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-execute-script-arg-stringify": "warn",
20
+ "tailor-sdk/no-unconditional-permit": "warn",
12
21
  "no-case-declarations": "error",
13
22
  "no-empty": "error",
14
23
  "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-sdk login
13
- npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
14
- npx tailor-sdk workspace list
15
- # For yarn: yarn tailor-sdk <command>
16
- # For pnpm: pnpm tailor-sdk <command>
17
- # For bun: bun tailor-sdk <command>
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-sdk machineuser token manager --workspace-id <your-workspace-id>
39
+ npx tailor machineuser token manager --workspace-id <your-workspace-id>
40
40
  # Get Staff's token
41
- npx tailor-sdk machineuser token staff --workspace-id <your-workspace-id>
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-sdk/
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-sdk deploy",
7
- "generate": "tailor-sdk generate",
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.0-next.1",
16
- "@types/node": "24.13.2",
17
- "oxfmt": "0.54.0",
18
- "oxlint": "1.69.0",
19
- "oxlint-tsgolint": "0.23.0",
20
- "typescript": "5.9.3"
16
+ "@tailor-platform/eslint-plugin-sdk": "0.2.0-next.1",
17
+ "@tailor-platform/sdk": "2.0.0-next.11",
18
+ "@types/node": "24.13.3",
19
+ "oxfmt": "0.61.0",
20
+ "oxlint": "1.76.0",
21
+ "oxlint-tsgolint": "7.0.2001",
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
- .type("Category", {
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
- .type("Contact", {
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
- .type("Inventory", {
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 >= 0),
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
- .type("Notification", {
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
- .type("Order", {
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
- .type("OrderItem", {
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 >= 0),
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 >= 0),
24
- totalPrice: db.float({ optional: true }).description("Total price of the order item"),
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
- totalPrice: {
29
- create: ({ data }) => (data?.quantity ?? 0) * (data.unitPrice ?? 0),
30
- update: ({ data }) => (data?.quantity ?? 0) * (data.unitPrice ?? 0),
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
- .type("Product", {
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
- .type("User", {
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"]),
@@ -21,6 +21,5 @@ export default createExecutor({
21
21
  })
22
22
  .execute();
23
23
  },
24
- authInvoker: "manager",
25
24
  },
26
25
  });
@@ -18,7 +18,7 @@ export interface Namespace {
18
18
  name: string;
19
19
  description: string | null;
20
20
  createdAt: Generated<Timestamp>;
21
- updatedAt: Timestamp | null;
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 | null;
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 | null;
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 | null;
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 | null;
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 | null>;
66
+ totalPrice: Generated<number>;
67
67
  createdAt: Generated<Timestamp>;
68
- updatedAt: Timestamp | null;
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 | null;
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 | null;
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"]), { array: true }),
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-sdk deploy' or 'tailor-sdk generate'
3
+ // Regenerated automatically when running 'tailor deploy' or 'tailor generate'
4
4
 
5
5
  declare module "@tailor-platform/sdk" {
6
- interface AttributeMap {
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,23 @@
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-sdk/", "tailor.d.ts"],
16
+ "ignorePatterns": [".tailor/", "tailor.d.ts"],
11
17
  "rules": {
18
+ "tailor-sdk/no-api-prefix-in-path-pattern": "warn",
19
+ "tailor-sdk/no-execute-script-arg-stringify": "warn",
20
+ "tailor-sdk/no-unconditional-permit": "warn",
12
21
  "no-case-declarations": "error",
13
22
  "no-empty": "error",
14
23
  "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-sdk login
20
- npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
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-sdk/
2
+ .tailor/