@tailor-platform/create-sdk 1.24.0 → 1.25.1
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 +4 -0
- package/package.json +1 -1
- package/templates/executor/package.json +1 -1
- package/templates/generators/package.json +1 -1
- package/templates/generators/src/seed/data/Category.schema.ts +1 -1
- package/templates/generators/src/seed/data/Order.schema.ts +1 -1
- package/templates/generators/src/seed/data/Product.schema.ts +1 -1
- package/templates/generators/src/seed/data/User.schema.ts +1 -1
- package/templates/generators/src/seed/exec.mjs +59 -2
- package/templates/hello-world/package.json +1 -1
- package/templates/inventory-management/package.json +1 -1
- package/templates/multi-application/package.json +1 -1
- package/templates/resolver/package.json +1 -1
- package/templates/static-web-site/package.json +1 -1
- package/templates/tailordb/package.json +1 -1
- package/templates/workflow/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "9.39.4",
|
|
18
18
|
"@tailor-platform/function-types": "0.8.2",
|
|
19
|
-
"@tailor-platform/sdk": "1.
|
|
19
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
20
20
|
"@types/node": "24.10.9",
|
|
21
21
|
"eslint": "9.39.4",
|
|
22
22
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "9.39.4",
|
|
18
18
|
"@tailor-platform/function-types": "0.8.2",
|
|
19
|
-
"@tailor-platform/sdk": "1.
|
|
19
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
20
20
|
"@types/node": "24.10.9",
|
|
21
21
|
"eslint": "9.39.4",
|
|
22
22
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from "@tailor-platform/sdk";
|
|
2
|
+
import { defineSchema } from "@tailor-platform/sdk/seed";
|
|
2
3
|
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
|
|
3
|
-
import { defineSchema } from "@toiroakr/lines-db";
|
|
4
4
|
import { category } from "../../db/category";
|
|
5
5
|
|
|
6
6
|
const schemaType = t.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from "@tailor-platform/sdk";
|
|
2
|
+
import { defineSchema } from "@tailor-platform/sdk/seed";
|
|
2
3
|
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
|
|
3
|
-
import { defineSchema } from "@toiroakr/lines-db";
|
|
4
4
|
import { order } from "../../db/order";
|
|
5
5
|
|
|
6
6
|
const schemaType = t.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from "@tailor-platform/sdk";
|
|
2
|
+
import { defineSchema } from "@tailor-platform/sdk/seed";
|
|
2
3
|
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
|
|
3
|
-
import { defineSchema } from "@toiroakr/lines-db";
|
|
4
4
|
import { product } from "../../db/product";
|
|
5
5
|
|
|
6
6
|
const schemaType = t.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from "@tailor-platform/sdk";
|
|
2
|
+
import { defineSchema } from "@tailor-platform/sdk/seed";
|
|
2
3
|
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
|
|
3
|
-
import { defineSchema } from "@toiroakr/lines-db";
|
|
4
4
|
import { user } from "../../db/user";
|
|
5
5
|
|
|
6
6
|
const schemaType = t.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
2
|
+
import { join, isAbsolute } from "node:path";
|
|
3
3
|
import { parseArgs, styleText } from "node:util";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
5
5
|
import {
|
|
@@ -13,6 +13,58 @@ import {
|
|
|
13
13
|
loadWorkspaceId,
|
|
14
14
|
} from "@tailor-platform/sdk/cli";
|
|
15
15
|
|
|
16
|
+
// Handle "validate" subcommand before parseArgs
|
|
17
|
+
const subcommand = process.argv[2];
|
|
18
|
+
if (subcommand === "validate") {
|
|
19
|
+
const { validateSeedData } = await import("@tailor-platform/sdk/seed");
|
|
20
|
+
const validateArgs = parseArgs({
|
|
21
|
+
args: process.argv.slice(3),
|
|
22
|
+
options: {
|
|
23
|
+
verbose: { type: "boolean", short: "v", default: false },
|
|
24
|
+
help: { type: "boolean", short: "h", default: false },
|
|
25
|
+
},
|
|
26
|
+
allowPositionals: true,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (validateArgs.values.help) {
|
|
30
|
+
console.log(`
|
|
31
|
+
Usage: node exec.mjs validate [options] [path]
|
|
32
|
+
|
|
33
|
+
Validate JSONL seed data against schema definitions.
|
|
34
|
+
|
|
35
|
+
Arguments:
|
|
36
|
+
path File or directory to validate (default: ./data)
|
|
37
|
+
|
|
38
|
+
Options:
|
|
39
|
+
-v, --verbose Show verbose error output
|
|
40
|
+
-h, --help Show help
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
node exec.mjs validate # Validate all seed data
|
|
44
|
+
node exec.mjs validate ./data/User.jsonl # Validate specific file
|
|
45
|
+
node exec.mjs validate -v # Verbose error output
|
|
46
|
+
`);
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const configDir = import.meta.dirname;
|
|
51
|
+
const targetPath = validateArgs.positionals[0] || join(configDir, "data");
|
|
52
|
+
const resolvedPath = isAbsolute(targetPath) ? targetPath : join(process.cwd(), targetPath);
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const result = await validateSeedData({ path: resolvedPath, verbose: validateArgs.values.verbose });
|
|
56
|
+
if (result.output) console.log(result.output);
|
|
57
|
+
if (!result.valid) {
|
|
58
|
+
console.error(result.error);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
process.exit(0);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(styleText("red", `Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
16
68
|
// Parse command-line arguments
|
|
17
69
|
const { values, positionals } = parseArgs({
|
|
18
70
|
options: {
|
|
@@ -29,7 +81,10 @@ const { values, positionals } = parseArgs({
|
|
|
29
81
|
|
|
30
82
|
if (values.help) {
|
|
31
83
|
console.log(`
|
|
32
|
-
Usage: node exec.mjs [options] [types...]
|
|
84
|
+
Usage: node exec.mjs [command] [options] [types...]
|
|
85
|
+
|
|
86
|
+
Commands:
|
|
87
|
+
validate [path] Validate seed data against schema (default: ./data)
|
|
33
88
|
|
|
34
89
|
Options:
|
|
35
90
|
-m, --machine-user <name> Machine user name for authentication (required if not configured)
|
|
@@ -49,6 +104,8 @@ Examples:
|
|
|
49
104
|
node exec.mjs --truncate --yes # Truncate all tables without confirmation, then seed all
|
|
50
105
|
node exec.mjs --truncate --namespace <namespace> # Truncate tailordb, then seed tailordb
|
|
51
106
|
node exec.mjs --truncate User Order # Truncate User and Order, then seed them
|
|
107
|
+
node exec.mjs validate # Validate all seed data
|
|
108
|
+
node exec.mjs validate ./data/User.jsonl # Validate specific file
|
|
52
109
|
`);
|
|
53
110
|
process.exit(0);
|
|
54
111
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@eslint/js": "9.39.4",
|
|
16
16
|
"@tailor-platform/function-types": "0.8.2",
|
|
17
|
-
"@tailor-platform/sdk": "1.
|
|
17
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
18
18
|
"@types/node": "24.10.9",
|
|
19
19
|
"eslint": "9.39.4",
|
|
20
20
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@eslint/js": "9.39.4",
|
|
20
20
|
"@tailor-platform/function-types": "0.8.2",
|
|
21
|
-
"@tailor-platform/sdk": "1.
|
|
21
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
22
22
|
"@types/node": "24.10.9",
|
|
23
23
|
"eslint": "9.39.4",
|
|
24
24
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@eslint/js": "9.39.4",
|
|
16
16
|
"@tailor-platform/function-types": "0.8.2",
|
|
17
|
-
"@tailor-platform/sdk": "1.
|
|
17
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
18
18
|
"@types/node": "24.10.9",
|
|
19
19
|
"eslint": "9.39.4",
|
|
20
20
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@eslint/js": "9.39.4",
|
|
18
18
|
"@tailor-platform/function-types": "0.8.2",
|
|
19
|
-
"@tailor-platform/sdk": "1.
|
|
19
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
20
20
|
"@types/node": "24.10.9",
|
|
21
21
|
"eslint": "9.39.4",
|
|
22
22
|
"eslint-plugin-oxlint": "1.39.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@eslint/js": "9.39.4",
|
|
21
21
|
"@tailor-platform/function-types": "0.8.2",
|
|
22
|
-
"@tailor-platform/sdk": "1.
|
|
22
|
+
"@tailor-platform/sdk": "1.25.1",
|
|
23
23
|
"@types/node": "24.10.9",
|
|
24
24
|
"eslint": "9.39.4",
|
|
25
25
|
"eslint-plugin-oxlint": "1.39.0",
|