@tailor-platform/create-sdk 2.0.1 → 2.2.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 +41 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/templates/executor/package.json +2 -2
- package/templates/executor/tailor.config.ts +8 -1
- package/templates/generators/package.json +4 -3
- package/templates/generators/src/seed/data/Category.schema.ts +2 -2
- 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.config.ts +8 -1
- package/templates/hello-world/package.json +2 -2
- package/templates/hello-world/tailor.config.ts +7 -1
- package/templates/inventory-management/package.json +2 -2
- package/templates/inventory-management/tailor.config.ts +8 -1
- package/templates/multi-application/package.json +2 -2
- package/templates/resolver/package.json +2 -2
- package/templates/resolver/src/resolver/add.ts +3 -0
- package/templates/resolver/tailor.config.ts +8 -1
- package/templates/static-web-site/package.json +2 -2
- package/templates/tailordb/README.md +1 -1
- package/templates/tailordb/package.json +2 -2
- package/templates/workflow/package.json +2 -2
- package/templates/workflow/tailor.config.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @tailor-platform/create-sdk
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1975](https://github.com/tailor-platform/sdk/pull/1975) [`b5ca25b`](https://github.com/tailor-platform/sdk/commit/b5ca25b796e8a5e4262ea2e3527973d77cab766a) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `tailor seed fill` to fill in the values a record gets on create for the JSONL seed data rows that are missing them. It fills `id` by default, so rows can reference each other by id, and `--fields` names any other create-time field:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# ./seed/data/Customer.jsonl: {"name":"Acme Corporation"}
|
|
11
|
+
tailor seed fill
|
|
12
|
+
# ./seed/data/Customer.jsonl: {"id":"0b6b6f5e-...","name":"Acme Corporation"}
|
|
13
|
+
|
|
14
|
+
# also stamp a creation time on rows that have none
|
|
15
|
+
tailor seed fill --fields id,createdAt
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The values come from the type itself — its `id`, its field defaults, its create hooks — applied to each row on its own. Nothing is validated, so a row can be filled while a required field is still missing or while another file references an id that does not exist yet; that is the point, since the ids are what you need in order to write the rows that reference them. Run `tailor seed validate` when the data is ready.
|
|
19
|
+
|
|
20
|
+
Only the named fields are written, and only into a row that has no value for them, so a value already in the file is never replaced. A line that gains nothing is left byte for byte as it was; a line that takes a value is written with its keys in the order the type declares its fields, so a filled-in `id` lands at the front. A field the type gives no value to is skipped, so `--fields id` covers a whole data directory and leaves the IdP `_User` data alone, and naming a field the platform assigns — a `serial` field, for instance — fills nothing and says so.
|
|
21
|
+
|
|
22
|
+
`tailor seed apply --upsert` now points at the command when a row has no `id`, since that is the run it blocks, and newly scaffolded projects get a `seed:fill` script next to `seed:validate`.
|
|
23
|
+
|
|
24
|
+
The generated seed schema files now export the type's create hook, which is where the values come from. Run `tailor generate` after upgrading; until then `tailor seed fill` reports which file needs regenerating.
|
|
25
|
+
|
|
26
|
+
`createTailorDBHook` from `@tailor-platform/sdk/test` no longer runs the type's own `validate`. Computing the values a record gets on create and deciding whether a record is acceptable are separate jobs, and the second one now sits where the field-level validation already was: `createStandardSchema` takes the type as a third argument and reports type-level issues through its result.
|
|
27
|
+
|
|
28
|
+
`tailor seed validate` also stops printing two markers on the header of a failed run (`\u2716 \u2717 Found 2 error(s) in ...`), now that it hands the CLI a report that is already formatted.
|
|
29
|
+
|
|
30
|
+
That also fixes how `tailor seed validate` reports them. A type-level `validate` failure used to end the run at the first offending row with a bare message; it now lands in the same report as every other issue, naming the file and every row that fails.
|
|
31
|
+
|
|
32
|
+
A test calling `createTailorDBHook` directly to assert a type-level `validate` throws needs to go through `createStandardSchema` instead.
|
|
33
|
+
|
|
34
|
+
The same operation is available as `fillSeedData` from `@tailor-platform/sdk/seed`.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- [#2008](https://github.com/tailor-platform/sdk/pull/2008) [`f2135ab`](https://github.com/tailor-platform/sdk/commit/f2135ab6dd3d130d88803b9829a26024de930ed3) Thanks [@toiroakr](https://github.com/toiroakr)! - Consistently call a TailorDB schema definition a "table" instead of a "type" across the docs, matching the `db.type()` → `db.table()` rename. Also fix three leftover `db.type(...)` code samples in `docs/services/tailordb.md` that should have read `db.table(...)`.
|
|
39
|
+
|
|
40
|
+
Update the `v2/idp-publish-events-rename` codemod registry description to say "tables" instead of "types", matching the same wording fix.
|
|
41
|
+
|
|
42
|
+
## 2.1.0
|
|
43
|
+
|
|
3
44
|
## 2.0.1
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ A complete inventory management system demonstrating real-world patterns.
|
|
|
48
48
|
|
|
49
49
|
**Includes:**
|
|
50
50
|
|
|
51
|
-
- TailorDB
|
|
51
|
+
- TailorDB tables: User, Product, Category, Order, Inventory, Contact, Notification
|
|
52
52
|
- Role-based permissions (Manager, Staff)
|
|
53
53
|
- Custom resolver for order registration with inventory updates
|
|
54
54
|
- Executor for inventory threshold monitoring
|
package/package.json
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
19
|
-
"@tailor-platform/sdk": "2.0
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
19
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
20
20
|
"@types/node": "24.13.3",
|
|
21
21
|
"oxfmt": "0.61.0",
|
|
22
22
|
"oxlint": "1.76.0",
|
|
@@ -38,7 +38,14 @@ export default defineConfig({
|
|
|
38
38
|
}),
|
|
39
39
|
idp: [idp],
|
|
40
40
|
db: { "main-db": { files: ["./src/db/*.ts"] } },
|
|
41
|
-
resolver: {
|
|
41
|
+
resolver: {
|
|
42
|
+
"main-resolver": {
|
|
43
|
+
files: ["./src/resolver/*.ts"],
|
|
44
|
+
// Every resolver in this namespace requires an authenticated caller.
|
|
45
|
+
// A single resolver opts out with `permission: "allowAnonymous"`.
|
|
46
|
+
defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
42
49
|
executor: { files: ["./src/executor/*.ts"] },
|
|
43
50
|
workflow: { files: ["./src/workflow/*.ts"] },
|
|
44
51
|
});
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"generate": "tailor generate",
|
|
8
8
|
"deploy": "tailor deploy",
|
|
9
9
|
"seed": "tailor seed apply",
|
|
10
|
+
"seed:fill": "tailor seed fill",
|
|
10
11
|
"seed:validate": "tailor seed validate",
|
|
11
12
|
"test": "vitest --project unit",
|
|
12
13
|
"test:unit": "vitest --project unit",
|
|
@@ -17,9 +18,9 @@
|
|
|
17
18
|
"typecheck": "tsc --noEmit"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
21
|
-
"@tailor-platform/sdk": "2.0
|
|
22
|
-
"@tailor-platform/sdk-plugin-seed": "0.
|
|
21
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
22
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
23
|
+
"@tailor-platform/sdk-plugin-seed": "0.2.0",
|
|
23
24
|
"@types/node": "24.13.3",
|
|
24
25
|
"oxfmt": "0.61.0",
|
|
25
26
|
"oxlint": "1.76.0",
|
|
@@ -8,10 +8,10 @@ const schemaType = t.object({
|
|
|
8
8
|
...category.omitFields(["id"]),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const hook = createTailorDBHook(category);
|
|
11
|
+
export const hook = createTailorDBHook(category);
|
|
12
12
|
|
|
13
13
|
export const schema = defineSchema(
|
|
14
|
-
createStandardSchema(schemaType, hook),
|
|
14
|
+
createStandardSchema(schemaType, hook, category),
|
|
15
15
|
{
|
|
16
16
|
foreignKeys: [
|
|
17
17
|
{"column":"parentCategoryId","references":{"table":"Category","column":"id"}},
|
|
@@ -8,10 +8,10 @@ const schemaType = t.object({
|
|
|
8
8
|
...order.omitFields(["id"]),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const hook = createTailorDBHook(order);
|
|
11
|
+
export const hook = createTailorDBHook(order);
|
|
12
12
|
|
|
13
13
|
export const schema = defineSchema(
|
|
14
|
-
createStandardSchema(schemaType, hook),
|
|
14
|
+
createStandardSchema(schemaType, hook, order),
|
|
15
15
|
{
|
|
16
16
|
foreignKeys: [
|
|
17
17
|
{"column":"productId","references":{"table":"Product","column":"id"}},
|
|
@@ -8,10 +8,10 @@ const schemaType = t.object({
|
|
|
8
8
|
...product.omitFields(["id"]),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const hook = createTailorDBHook(product);
|
|
11
|
+
export const hook = createTailorDBHook(product);
|
|
12
12
|
|
|
13
13
|
export const schema = defineSchema(
|
|
14
|
-
createStandardSchema(schemaType, hook),
|
|
14
|
+
createStandardSchema(schemaType, hook, product),
|
|
15
15
|
{
|
|
16
16
|
foreignKeys: [
|
|
17
17
|
{"column":"categoryId","references":{"table":"Category","column":"id"}},
|
|
@@ -8,10 +8,10 @@ const schemaType = t.object({
|
|
|
8
8
|
...user.omitFields(["id"]),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const hook = createTailorDBHook(user);
|
|
11
|
+
export const hook = createTailorDBHook(user);
|
|
12
12
|
|
|
13
13
|
export const schema = defineSchema(
|
|
14
|
-
createStandardSchema(schemaType, hook),
|
|
14
|
+
createStandardSchema(schemaType, hook, user),
|
|
15
15
|
{
|
|
16
16
|
indexes: [
|
|
17
17
|
{"name":"user_email_unique_idx","columns":["email"],"unique":true},
|
|
@@ -31,7 +31,14 @@ export default defineConfig({
|
|
|
31
31
|
}),
|
|
32
32
|
idp: [idp],
|
|
33
33
|
db: { "main-db": { files: ["./src/db/*.ts"] } },
|
|
34
|
-
resolver: {
|
|
34
|
+
resolver: {
|
|
35
|
+
"main-resolver": {
|
|
36
|
+
files: ["./src/resolver/*.ts"],
|
|
37
|
+
// Every resolver in this namespace requires an authenticated caller.
|
|
38
|
+
// A single resolver opts out with `permission: "allowAnonymous"`.
|
|
39
|
+
defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
35
42
|
});
|
|
36
43
|
|
|
37
44
|
export const plugins = definePlugins(
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
17
|
-
"@tailor-platform/sdk": "2.0
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
17
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
18
18
|
"@types/node": "24.13.3",
|
|
19
19
|
"oxfmt": "0.61.0",
|
|
20
20
|
"oxlint": "1.76.0",
|
|
@@ -4,7 +4,13 @@ import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
name: "hello-world",
|
|
6
6
|
db: { "main-db": { files: [`./src/db/*.ts`] } },
|
|
7
|
-
resolver: {
|
|
7
|
+
resolver: {
|
|
8
|
+
"main-resolver": {
|
|
9
|
+
files: [`./src/resolvers/**/*.ts`],
|
|
10
|
+
// This template defines no auth, so its resolvers are public by design.
|
|
11
|
+
defaultPermission: "allowAnonymous",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
8
14
|
});
|
|
9
15
|
|
|
10
16
|
export const plugins = definePlugins(
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
17
|
-
"@tailor-platform/sdk": "2.0
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
17
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
18
18
|
"@types/node": "24.13.3",
|
|
19
19
|
"oxfmt": "0.61.0",
|
|
20
20
|
"oxlint": "1.76.0",
|
|
@@ -5,7 +5,14 @@ import { user } from "./src/db/user";
|
|
|
5
5
|
export default defineConfig({
|
|
6
6
|
name: "inventory-management",
|
|
7
7
|
db: { "main-db": { files: [`./src/db/*.ts`] } },
|
|
8
|
-
resolver: {
|
|
8
|
+
resolver: {
|
|
9
|
+
"main-resolver": {
|
|
10
|
+
files: ["./src/resolver/*.ts"],
|
|
11
|
+
// Every resolver in this namespace requires an authenticated caller.
|
|
12
|
+
// A single resolver opts out with `permission: "allowAnonymous"`.
|
|
13
|
+
defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
9
16
|
auth: defineAuth("main-auth", {
|
|
10
17
|
userProfile: {
|
|
11
18
|
type: user,
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"typecheck": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
18
|
-
"@tailor-platform/sdk": "2.0
|
|
17
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
18
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
19
19
|
"@types/node": "24.13.3",
|
|
20
20
|
"oxfmt": "0.61.0",
|
|
21
21
|
"oxlint": "1.76.0",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
19
|
-
"@tailor-platform/sdk": "2.0
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
19
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
20
20
|
"@types/node": "24.13.3",
|
|
21
21
|
"oxfmt": "0.61.0",
|
|
22
22
|
"oxlint": "1.76.0",
|
|
@@ -3,6 +3,9 @@ import { createResolver, t } from "@tailor-platform/sdk";
|
|
|
3
3
|
const resolver = createResolver({
|
|
4
4
|
name: "add",
|
|
5
5
|
operation: "query",
|
|
6
|
+
// Overrides the namespace's `defaultPermission`: this resolver reads no
|
|
7
|
+
// data, so anonymous callers are allowed.
|
|
8
|
+
permission: "allowAnonymous",
|
|
6
9
|
input: {
|
|
7
10
|
left: t.int(),
|
|
8
11
|
right: t.int(),
|
|
@@ -20,7 +20,14 @@ export default defineConfig({
|
|
|
20
20
|
},
|
|
21
21
|
}),
|
|
22
22
|
db: { "main-db": { files: ["./src/db/*.ts"] } },
|
|
23
|
-
resolver: {
|
|
23
|
+
resolver: {
|
|
24
|
+
"main-resolver": {
|
|
25
|
+
files: ["./src/resolver/*.ts"],
|
|
26
|
+
// Every resolver in this namespace requires an authenticated caller.
|
|
27
|
+
// A single resolver opts out with `permission: "allowAnonymous"`.
|
|
28
|
+
defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
24
31
|
});
|
|
25
32
|
|
|
26
33
|
export const plugins = definePlugins(kyselyTypePlugin({ distPath: "./src/generated/db.ts" }));
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
17
|
-
"@tailor-platform/sdk": "2.0
|
|
16
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
17
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
18
18
|
"@types/node": "24.13.3",
|
|
19
19
|
"oxfmt": "0.61.0",
|
|
20
20
|
"oxlint": "1.76.0",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
19
|
-
"@tailor-platform/sdk": "2.0
|
|
18
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
19
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
20
20
|
"@types/node": "24.13.3",
|
|
21
21
|
"oxfmt": "0.61.0",
|
|
22
22
|
"oxlint": "1.76.0",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tailor-platform/eslint-plugin-sdk": "0.2.
|
|
20
|
-
"@tailor-platform/sdk": "2.0
|
|
19
|
+
"@tailor-platform/eslint-plugin-sdk": "0.2.1",
|
|
20
|
+
"@tailor-platform/sdk": "2.2.0",
|
|
21
21
|
"@types/node": "24.13.3",
|
|
22
22
|
"graphql": "17.0.2",
|
|
23
23
|
"graphql-request": "7.4.0",
|
|
@@ -16,7 +16,14 @@ export default defineConfig({
|
|
|
16
16
|
},
|
|
17
17
|
}),
|
|
18
18
|
db: { "main-db": { files: ["./src/db/*.ts"] } },
|
|
19
|
-
resolver: {
|
|
19
|
+
resolver: {
|
|
20
|
+
"main-resolver": {
|
|
21
|
+
files: ["./src/resolver/*.ts"],
|
|
22
|
+
// Every resolver in this namespace requires an authenticated caller.
|
|
23
|
+
// A single resolver opts out with `permission: "allowAnonymous"`.
|
|
24
|
+
defaultPermission: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
20
27
|
workflow: { files: ["./src/workflow/*.ts"] },
|
|
21
28
|
});
|
|
22
29
|
|