@osdk/seed-compiler 0.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 ADDED
@@ -0,0 +1,12 @@
1
+ # @osdk/seed-compiler
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d6f67f6: add seed data compiler. New `@osdk/seed-helpers` package exports `createSeed` and `SeedBuilder` for declaring typed seed objects and links. New `@osdk/seed-compiler` package compiles all top-level `.mts` files in a directory into a merged seed JSON (sorted by filename for deterministic output) for foundry-cli's local ontology server to load into SQLite on startup. Schema-aware validation (primary-key uniqueness, string format checks for `timestamp`/`date`/`datetime`/`long`/`decimal`) reads from `ontology-metadata.json` produced by the SDK generator, so the same compiler works against both ontology-as-code projects and imported ontologies.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [d6f67f6]
12
+ - @osdk/seed-helpers@0.2.0
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @osdk/seed-compiler
2
+
3
+ Compiles seed data files (`.mts`) into a single merged JSON output for the
4
+ local ontology server to load into SQLite on startup.
5
+
6
+ ## Usage
7
+
8
+ ### CLI
9
+
10
+ ```bash
11
+ seed-compiler \
12
+ --metadata path/to/ontology-metadata.json \
13
+ --seed-dir path/to/seed/ \
14
+ --output path/to/seed-data.json
15
+ ```
16
+
17
+ | Flag | Description |
18
+ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | `--metadata` | Path to the `ontology-metadata.json` file written by the SDK generator. Provides per-property wire types for format validation and per-object-type primary key field names. |
20
+ | `--seed-dir` | Directory containing seed `.mts` files. All top-level `.mts` files are loaded, sorted by filename for deterministic output, and merged. |
21
+ | `--output` | Path where the merged seed JSON is written. |
22
+
23
+ ## Authoring seed files
24
+
25
+ Seed files use `@osdk/seed-helpers` and the user's generated `@ontology/sdk`:
26
+
27
+ ```ts
28
+ import { Product, Seller } from "@ontology/sdk";
29
+ import { createSeed } from "@osdk/seed-helpers";
30
+
31
+ export default createSeed((seed) => {
32
+ const widget = seed.add(Product, {
33
+ pk: "prod-001",
34
+ title: "Widget",
35
+ price: 100,
36
+ });
37
+ const alice = seed.add(Seller, {
38
+ pk: "seller-001",
39
+ name: "Alice",
40
+ });
41
+
42
+ // Link by reference — full compile-time validation on link names and target types.
43
+ seed.link("widget-seller", widget, "sellers", alice, "products");
44
+ });
45
+ ```
46
+
47
+ The `link()` method also supports a type + primary-key form for cases where
48
+ keeping refs in scope is awkward:
49
+
50
+ ```ts
51
+ seed.add(Product, { pk: "prod-001", title: "Widget", price: 100 });
52
+ seed.add(Seller, { pk: "seller-001", name: "Alice" });
53
+
54
+ seed.link(
55
+ "widget-seller",
56
+ Product,
57
+ "prod-001",
58
+ "sellers",
59
+ Seller,
60
+ "seller-001",
61
+ "products",
62
+ );
63
+ ```
64
+
65
+ Both forms produce identical output.
66
+
67
+ ## Validation
68
+
69
+ The compiler validates:
70
+
71
+ - **Object types** in seed data must be defined in the ontology (via the metadata file).
72
+ - **Primary keys** must be unique within an object type, across all seed files in the directory.
73
+ - **String-encoded property values** must match the regex format for their wire type
74
+ (`timestamp`, `date`, `datetime`, `long`, `decimal`).
75
+ - **Links** must reference objects that were `add`-ed in the same seed file.
76
+ Cross-file linking is not supported — the link source and target must be
77
+ registered in the same `createSeed(...)` call.
78
+
79
+ Duplicate links (same source, target, link type) across files are deduplicated
80
+ with a warning rather than an error.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+
4
+ import cli from "../build/esm/cli/main.js";
5
+
6
+ cli();
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { consola } from "consola";
18
+ import * as fs from "node:fs";
19
+ import * as path from "node:path";
20
+ import invariant from "tiny-invariant";
21
+ import yargs from "yargs";
22
+ import { hideBin } from "yargs/helpers";
23
+ import { compileSeedData } from "../compileSeedData.js";
24
+ import { schemaFromMetadata } from "../schema.js";
25
+ export default async function main(args = process.argv) {
26
+ const opts = await yargs(hideBin(args)).version("0.2.0" ?? "").wrap(Math.min(120, yargs().terminalWidth())).strict().help().options({
27
+ metadata: {
28
+ describe: "Path to the ontology-metadata.json file written by the SDK generator. " + "Provides primary-key field names and property wire types.",
29
+ type: "string",
30
+ demandOption: true,
31
+ coerce: path.resolve
32
+ },
33
+ seedDir: {
34
+ describe: "Directory containing seed data .mts files. All top-level .mts " + "files are compiled (sorted by filename for deterministic output).",
35
+ type: "string",
36
+ demandOption: true,
37
+ coerce: path.resolve
38
+ },
39
+ output: {
40
+ alias: "o",
41
+ describe: "Output path for the compiled seed data JSON.",
42
+ type: "string",
43
+ demandOption: true,
44
+ coerce: path.resolve
45
+ }
46
+ }).parseAsync();
47
+ const metadataStat = fs.statSync(opts.metadata);
48
+ !metadataStat.isFile() ? process.env.NODE_ENV !== "production" ? invariant(false, `--metadata '${opts.metadata}' is not a file`) : invariant(false) : void 0;
49
+ const metadata = JSON.parse(fs.readFileSync(opts.metadata, "utf-8"));
50
+ const seedDirStat = fs.statSync(opts.seedDir);
51
+ !seedDirStat.isDirectory() ? process.env.NODE_ENV !== "production" ? invariant(false, `--seed-dir '${opts.seedDir}' is not a directory`) : invariant(false) : void 0;
52
+ const seedFiles = fs.readdirSync(opts.seedDir).filter(f => f.endsWith(".mts")).sort().map(f => path.join(opts.seedDir, f));
53
+ if (seedFiles.length === 0) {
54
+ consola.warn(`No .mts seed files found in ${opts.seedDir}`);
55
+ return;
56
+ }
57
+ const schema = schemaFromMetadata(metadata);
58
+ await compileSeedData(seedFiles, opts.output, schema);
59
+ }
60
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","compileSeedData","schemaFromMetadata","main","args","process","argv","opts","version","wrap","Math","min","terminalWidth","strict","help","options","metadata","describe","type","demandOption","coerce","resolve","seedDir","output","alias","parseAsync","metadataStat","statSync","isFile","env","NODE_ENV","JSON","parse","readFileSync","seedDirStat","isDirectory","seedFiles","readdirSync","filter","f","endsWith","sort","map","join","length","warn","schema"],"sources":["main.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { compileSeedData } from \"../compileSeedData.js\";\nimport { schemaFromMetadata } from \"../schema.js\";\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const opts: {\n metadata: string;\n seedDir: string;\n output: string;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(120, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n metadata: {\n describe:\n \"Path to the ontology-metadata.json file written by the SDK generator. \"\n + \"Provides primary-key field names and property wire types.\",\n type: \"string\" as const,\n demandOption: true,\n coerce: path.resolve,\n },\n seedDir: {\n describe:\n \"Directory containing seed data .mts files. All top-level .mts \"\n + \"files are compiled (sorted by filename for deterministic output).\",\n type: \"string\" as const,\n demandOption: true,\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output path for the compiled seed data JSON.\",\n type: \"string\" as const,\n demandOption: true,\n coerce: path.resolve,\n },\n })\n .parseAsync();\n\n const metadataStat = fs.statSync(opts.metadata);\n invariant(\n metadataStat.isFile(),\n `--metadata '${opts.metadata}' is not a file`,\n );\n const metadata = JSON.parse(\n fs.readFileSync(opts.metadata, \"utf-8\"),\n ) as OntologyFullMetadata;\n\n const seedDirStat = fs.statSync(opts.seedDir);\n invariant(\n seedDirStat.isDirectory(),\n `--seed-dir '${opts.seedDir}' is not a directory`,\n );\n const seedFiles = fs.readdirSync(opts.seedDir)\n .filter((f) => f.endsWith(\".mts\"))\n .sort()\n .map((f) => path.join(opts.seedDir, f));\n\n if (seedFiles.length === 0) {\n consola.warn(`No .mts seed files found in ${opts.seedDir}`);\n return;\n }\n\n const schema = schemaFromMetadata(metadata);\n await compileSeedData(seedFiles, opts.output, schema);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AAEjD,eAAe,eAAeC,IAAIA,CAChCC,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,IAIL,GAAG,MAAMR,KAAK,CAACC,OAAO,CAACI,IAAI,CAAC,CAAC,CAC3BI,OAAO,CAAC,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wB,GAAA,CAAAC,QAAA,oBAD3BhC,SAAS,QAEP,eAAeS,IAAI,CAACe,OAAO,sBAAsB,IAFnDxB,SAAS;EAIT,MAAMsC,SAAS,GAAGxC,EAAE,CAACyC,WAAW,CAAC9B,IAAI,CAACe,OAAO,CAAC,CAC3CgB,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAAC,MAAM,CAAC,CAAC,CACjCC,IAAI,CAAC,CAAC,CACNC,GAAG,CAAEH,CAAC,IAAK1C,IAAI,CAAC8C,IAAI,CAACpC,IAAI,CAACe,OAAO,EAAEiB,CAAC,CAAC,CAAC;EAEzC,IAAIH,SAAS,CAACQ,MAAM,KAAK,CAAC,EAAE;IAC1BjD,OAAO,CAACkD,IAAI,CAAC,+BAA+BtC,IAAI,CAACe,OAAO,EAAE,CAAC;IAC3D;EACF;EAEA,MAAMwB,MAAM,GAAG5C,kBAAkB,CAACc,QAAQ,CAAC;EAC3C,MAAMf,eAAe,CAACmC,SAAS,EAAE7B,IAAI,CAACgB,MAAM,EAAEuB,MAAM,CAAC;AACvD","ignoreList":[]}
@@ -0,0 +1,322 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { consola } from "consola";
18
+ import { createJiti } from "jiti";
19
+ import * as fs from "node:fs";
20
+ import * as path from "node:path";
21
+
22
+ /**
23
+ * One string-format validation failure (e.g., a timestamp value that doesn't
24
+ * match the wire format regex). Format failures are collected across the
25
+ * whole output and reported together at the end so users can fix many
26
+ * content mistakes in one pass. Structural failures (unknown object type,
27
+ * unknown property name, null value, wrong JS type) throw immediately
28
+ * instead — they're not aggregated, so they don't need this struct.
29
+ */
30
+
31
+ /**
32
+ * Expected runtime JS type for each cataloged wire type.
33
+ *
34
+ * Used to fail fast on `as any` callers that pass a value of the wrong shape
35
+ * (e.g., `age: "30"` when `age` is an integer). Wire types not listed here
36
+ * are not strictly typed by this validator — currently `attachment`,
37
+ * `mediaReference`, `geopoint`, `geoshape`, `vector`, `array`, `struct`,
38
+ * which have non-primitive runtime shapes that need bespoke validation.
39
+ */
40
+ const EXPECTED_JS_TYPE = {
41
+ // string-encoded primitives
42
+ string: "string",
43
+ marking: "string",
44
+ timestamp: "string",
45
+ date: "string",
46
+ datetime: "string",
47
+ long: "string",
48
+ decimal: "string",
49
+ ipAddress: "string",
50
+ cipherText: "string",
51
+ // numeric primitives
52
+ integer: "number",
53
+ byte: "number",
54
+ short: "number",
55
+ double: "number",
56
+ float: "number",
57
+ // boolean
58
+ boolean: "boolean"
59
+ };
60
+
61
+ /**
62
+ * Regex patterns for string-encoded wire types that TypeScript cannot validate.
63
+ *
64
+ * These patterns are aligned with the Rust backend's actual parsing behavior:
65
+ * - timestamp: RFC 3339 parse on the Rust side — requires timezone, rejects trailing garbage
66
+ * - date: stored as raw string, but only YYYY-MM-DD works in SQLite queries
67
+ * - datetime: stored as raw string, same YYYY-MM-DD requirement for query correctness
68
+ * - long: strict decimal integer parse on the Rust side — no scientific notation
69
+ * - decimal: Rust stores any string (no validation), but we enforce numeric format
70
+ * to prevent obviously invalid values from silently passing through
71
+ */
72
+ const WIRE_TYPE_FORMAT = {
73
+ timestamp: {
74
+ pattern: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,
75
+ example: "2025-01-01T00:00:00Z"
76
+ },
77
+ date: {
78
+ pattern: /^\d{4}-\d{2}-\d{2}$/,
79
+ example: "2025-01-01"
80
+ },
81
+ datetime: {
82
+ pattern: /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/,
83
+ example: "2025-01-01T12:00:00Z"
84
+ },
85
+ long: {
86
+ // Strict decimal integer — matches Rust's str::parse::<i64>().
87
+ // No scientific notation, no decimal point, no whitespace.
88
+ pattern: /^-?\d+$/,
89
+ example: "9007199254740993"
90
+ },
91
+ decimal: {
92
+ // Numeric string with optional decimal point. Anchored.
93
+ // Rust stores any string (no validation), but we reject obviously invalid values.
94
+ pattern: /^-?\d+(\.\d+)?$/,
95
+ example: "123.45"
96
+ }
97
+ };
98
+
99
+ /**
100
+ * Compiles one or more seed data files into a single merged JSON output.
101
+ *
102
+ * Pipeline: load each file → merge → validate against schema → write JSON.
103
+ *
104
+ * @param seedFiles - Absolute paths to seed `.mts` / `.ts` files.
105
+ * @param outputPath - Where to write the merged seed JSON.
106
+ * @param schema - Per-object-type schema, typically built from
107
+ * {@link import("./schema.js").schemaFromMetadata}.
108
+ * @throws if any seed file fails to compile or has an invalid export, if any
109
+ * object type or property name is unknown to the schema, if any
110
+ * primary key is duplicated across files, if any property value is
111
+ * null/undefined or has the wrong JS type, or if any string-encoded
112
+ * value has an invalid format.
113
+ */
114
+ export async function compileSeedData(seedFiles, outputPath, schema) {
115
+ consola.info(`Compiling seed data from ${seedFiles.length} file(s)...`);
116
+ const outputs = [];
117
+ for (const seedFile of seedFiles) {
118
+ outputs.push(await loadSeedFile(seedFile));
119
+ }
120
+ const merged = mergeSeedOutputs(outputs, schema);
121
+ validateSeedOutput(merged, schema);
122
+ const totalObjects = Object.values(merged.objects).reduce((sum, arr) => sum + arr.length, 0);
123
+ const outputDir = path.dirname(outputPath);
124
+ await fs.promises.mkdir(outputDir, {
125
+ recursive: true
126
+ });
127
+ await fs.promises.writeFile(outputPath, JSON.stringify(merged, null, 2));
128
+ consola.success(`Seed data compiled successfully (${totalObjects} objects, ${merged.links.length} links)`);
129
+ }
130
+
131
+ /**
132
+ * Merges multiple {@link SeedOutput}s into one.
133
+ *
134
+ * - Objects for the same type combine additively.
135
+ * - Duplicate primary keys across files cause an error (checked by the actual
136
+ * PK field from the schema, not by comparing the full serialized object).
137
+ * - Duplicate links (same source, target, and link type) are deduplicated
138
+ * with a warning logged to the console.
139
+ *
140
+ * @param outputs - The individual seed outputs to merge.
141
+ * @param schemaMap - Used to resolve the primary key field name per object type.
142
+ * @returns A single merged SeedOutput ready for validation and writing.
143
+ * @throws if any primary key appears in more than one file for the same type.
144
+ */
145
+ export function mergeSeedOutputs(outputs, schemaMap) {
146
+ const merged = {
147
+ objects: {},
148
+ links: []
149
+ };
150
+ const seenPks = new Map();
151
+ const seenLinks = new Set();
152
+ for (const output of outputs) {
153
+ mergeObjectsInto(merged, output.objects, schemaMap, seenPks);
154
+ mergeLinksInto(merged, output.links, seenLinks);
155
+ }
156
+ return merged;
157
+ }
158
+ function mergeObjectsInto(merged, source, schemaMap, seenPks) {
159
+ for (const [apiName, objects] of Object.entries(source)) {
160
+ const schema = schemaMap.get(apiName);
161
+ if (!schema) {
162
+ throw new Error(`Object type '${apiName}' in seed data is not defined in the ontology`);
163
+ }
164
+ const bucket = merged.objects[apiName] ??= [];
165
+ const pkSet = getOrInit(seenPks, apiName, () => new Set());
166
+ for (const obj of objects) {
167
+ const pk = String(obj[schema.primaryKeyApiName] ?? "");
168
+ if (pkSet.has(pk)) {
169
+ throw new Error(`Duplicate primary key '${pk}' for '${apiName}' across seed files`);
170
+ }
171
+ pkSet.add(pk);
172
+ bucket.push(obj);
173
+ }
174
+ }
175
+ }
176
+ function mergeLinksInto(merged, source, seenLinks) {
177
+ for (const link of source) {
178
+ const key = linkKey(link);
179
+ if (seenLinks.has(key)) {
180
+ consola.warn(`Duplicate link deduplicated: ${link.linkType}` + ` from ${link.sourceObjectType}:${link.sourceKey}` + ` to ${link.targetObjectType}:${link.targetKey}`);
181
+ continue;
182
+ }
183
+ seenLinks.add(key);
184
+ merged.links.push(link);
185
+ }
186
+ }
187
+ function linkKey(link) {
188
+ return `${link.sourceObjectType}:${link.sourceKey}` + `:${link.linkType}` + `:${link.targetObjectType}:${link.targetKey}`;
189
+ }
190
+ function getOrInit(map, key, init) {
191
+ let value = map.get(key);
192
+ if (value === undefined) {
193
+ value = init();
194
+ map.set(key, value);
195
+ }
196
+ return value;
197
+ }
198
+
199
+ /**
200
+ * Validates the seed output against the ontology schema.
201
+ *
202
+ * Hard errors (thrown immediately) for any of:
203
+ *
204
+ * - Object types in the seed output not defined in the ontology.
205
+ * - Property names on a seed object not defined on that type.
206
+ * - `null`/`undefined` property values. Typed callers can't reach this
207
+ * (the builder's `SeedProps<Q>` rejects `null`); any null at runtime is
208
+ * a sign of `as any` or a hand-rolled output.
209
+ * - JS type mismatches against the cataloged wire-type-to-JS-type map
210
+ * (e.g., `age: "30"` when `age` is an integer, or `score: 30` when
211
+ * `score` is a long).
212
+ *
213
+ * For wire types whose runtime shape this validator doesn't catalog
214
+ * (`attachment`, `mediaReference`, `geopoint`, `geoshape`, `vector`,
215
+ * `array`, `struct`), JS-type checking is skipped — they have non-primitive
216
+ * shapes that would need bespoke validation. They still go through the
217
+ * earlier object-type / property-name / null checks.
218
+ *
219
+ * After JS-type validation, string values are checked against the format
220
+ * regex for their wire type (timestamp, date, datetime, long, decimal).
221
+ * The one thing TypeScript cannot distinguish on its own is whether a
222
+ * `string` value matches its wire format (e.g., `"not-a-date"` vs
223
+ * `"2025-01-01T00:00:00Z"` are both valid `string` to the type system);
224
+ * format validation fills that gap.
225
+ *
226
+ * @throws Error on any structural violation listed above, or listing all
227
+ * format failures grouped by object type.
228
+ */
229
+ export function validateSeedOutput(output, schemaMap) {
230
+ const errors = validateAndCollectFormatErrors(output, schemaMap);
231
+ if (errors.length > 0) {
232
+ throw new Error(formatValidationErrors(errors));
233
+ }
234
+ }
235
+ function validateAndCollectFormatErrors(output, schemaMap) {
236
+ const errors = [];
237
+ for (const [apiName, objects] of Object.entries(output.objects)) {
238
+ const schema = schemaMap.get(apiName);
239
+ if (!schema) {
240
+ throw new Error(`Object type '${apiName}' in seed data is not defined in the ontology`);
241
+ }
242
+ for (const [i, obj] of objects.entries()) {
243
+ for (const [key, value] of Object.entries(obj)) {
244
+ const wireType = schema.properties.get(key);
245
+ if (wireType === undefined) {
246
+ throw new Error(`Property '${key}' on '${apiName}' object` + ` (index ${i}) is not defined in the ontology`);
247
+ }
248
+ if (value == null) {
249
+ throw new Error(`Property '${key}' on '${apiName}' object` + ` (index ${i}) is null or undefined`);
250
+ }
251
+ const expectedJsType = EXPECTED_JS_TYPE[wireType];
252
+ if (expectedJsType !== undefined && typeof value !== expectedJsType) {
253
+ throw new Error(`Property '${key}' on '${apiName}' object` + ` (index ${i}) expects ${wireType} (a ${expectedJsType})` + ` but got ${typeof value}`);
254
+ }
255
+ const format = WIRE_TYPE_FORMAT[wireType];
256
+ if (!format) continue;
257
+
258
+ // Format regex only applies to string-encoded wire types, all of
259
+ // which have EXPECTED_JS_TYPE === "string"; the cast is safe here
260
+ // because the JS-type check above would have thrown otherwise.
261
+ if (format.pattern.test(value)) continue;
262
+ errors.push({
263
+ objectType: apiName,
264
+ objectIndex: i,
265
+ field: key,
266
+ message: `property '${key}' has invalid ${wireType}` + ` format: '${String(value)}'. Expected format like '${format.example}'`
267
+ });
268
+ }
269
+ }
270
+ }
271
+ return errors;
272
+ }
273
+ function formatValidationErrors(errors) {
274
+ const grouped = new Map();
275
+ for (const err of errors) {
276
+ const messages = getOrInit(grouped, err.objectType, () => []);
277
+ messages.push(` object[${err.objectIndex}]: ${err.message}`);
278
+ }
279
+ const body = [...grouped.entries()].map(([type, msgs]) => `${type}:\n${msgs.join("\n")}`).join("\n\n");
280
+ const errorWord = errors.length === 1 ? "error" : "errors";
281
+ const typeWord = grouped.size === 1 ? "object type" : "object types";
282
+ return `Seed data validation failed ` + `(${errors.length} ${errorWord} across ${grouped.size} ${typeWord}` + `):\n\n${body}`;
283
+ }
284
+
285
+ /**
286
+ * Loads a single seed file via jiti and extracts its default export.
287
+ *
288
+ * jiti.import() fully executes the module — the `createSeed()` builder
289
+ * function runs during import and the default export is the resulting
290
+ * SeedOutput.
291
+ *
292
+ * @throws with a contextual message wrapping the original error and filename.
293
+ */
294
+ async function loadSeedFile(seedFile) {
295
+ consola.info(`Loading seed file: ${seedFile}`);
296
+ let seedModule;
297
+ try {
298
+ const jiti = createJiti(seedFile, {
299
+ moduleCache: false,
300
+ debug: false
301
+ });
302
+ seedModule = await jiti.import(seedFile);
303
+ } catch (e) {
304
+ const message = e instanceof Error ? e.message : String(e);
305
+ throw new Error(`Seed file '${path.basename(seedFile)}' failed to compile:\n ${message}`);
306
+ }
307
+ if (!seedModule.default || typeof seedModule.default !== "object") {
308
+ throw new Error(`Seed file '${path.basename(seedFile)}' must have a default export. ` + `Use createSeed() from @osdk/seed-helpers.`);
309
+ }
310
+ const output = seedModule.default;
311
+ if (!output.objects || typeof output.objects !== "object") {
312
+ throw new Error(`Seed file '${path.basename(seedFile)}' default export is not a valid` + ` SeedOutput. Use createSeed() from @osdk/seed-helpers.`);
313
+ }
314
+
315
+ // Normalize: links are optional in the export but required in SeedOutput.
316
+ // Spread to avoid mutating the module's exported object.
317
+ return {
318
+ ...output,
319
+ links: output.links ?? []
320
+ };
321
+ }
322
+ //# sourceMappingURL=compileSeedData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileSeedData.js","names":["consola","createJiti","fs","path","EXPECTED_JS_TYPE","string","marking","timestamp","date","datetime","long","decimal","ipAddress","cipherText","integer","byte","short","double","float","boolean","WIRE_TYPE_FORMAT","pattern","example","compileSeedData","seedFiles","outputPath","schema","info","length","outputs","seedFile","push","loadSeedFile","merged","mergeSeedOutputs","validateSeedOutput","totalObjects","Object","values","objects","reduce","sum","arr","outputDir","dirname","promises","mkdir","recursive","writeFile","JSON","stringify","success","links","schemaMap","seenPks","Map","seenLinks","Set","output","mergeObjectsInto","mergeLinksInto","source","apiName","entries","get","Error","bucket","pkSet","getOrInit","obj","pk","String","primaryKeyApiName","has","add","link","key","linkKey","warn","linkType","sourceObjectType","sourceKey","targetObjectType","targetKey","map","init","value","undefined","set","errors","validateAndCollectFormatErrors","formatValidationErrors","i","wireType","properties","expectedJsType","format","test","objectType","objectIndex","field","message","grouped","err","messages","body","type","msgs","join","errorWord","typeWord","size","seedModule","jiti","moduleCache","debug","import","e","basename","default"],"sources":["compileSeedData.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SeedLinkEntry, SeedOutput } from \"@osdk/seed-helpers\";\nimport { consola } from \"consola\";\nimport { createJiti } from \"jiti\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { SchemaMap } from \"./schema.js\";\n\n/**\n * One string-format validation failure (e.g., a timestamp value that doesn't\n * match the wire format regex). Format failures are collected across the\n * whole output and reported together at the end so users can fix many\n * content mistakes in one pass. Structural failures (unknown object type,\n * unknown property name, null value, wrong JS type) throw immediately\n * instead — they're not aggregated, so they don't need this struct.\n */\ninterface FormatError {\n objectType: string;\n objectIndex: number;\n field: string;\n message: string;\n}\n\n/**\n * Expected runtime JS type for each cataloged wire type.\n *\n * Used to fail fast on `as any` callers that pass a value of the wrong shape\n * (e.g., `age: \"30\"` when `age` is an integer). Wire types not listed here\n * are not strictly typed by this validator — currently `attachment`,\n * `mediaReference`, `geopoint`, `geoshape`, `vector`, `array`, `struct`,\n * which have non-primitive runtime shapes that need bespoke validation.\n */\nconst EXPECTED_JS_TYPE: Record<string, \"string\" | \"number\" | \"boolean\"> = {\n // string-encoded primitives\n string: \"string\",\n marking: \"string\",\n timestamp: \"string\",\n date: \"string\",\n datetime: \"string\",\n long: \"string\",\n decimal: \"string\",\n ipAddress: \"string\",\n cipherText: \"string\",\n // numeric primitives\n integer: \"number\",\n byte: \"number\",\n short: \"number\",\n double: \"number\",\n float: \"number\",\n // boolean\n boolean: \"boolean\",\n};\n\n/**\n * Regex patterns for string-encoded wire types that TypeScript cannot validate.\n *\n * These patterns are aligned with the Rust backend's actual parsing behavior:\n * - timestamp: RFC 3339 parse on the Rust side — requires timezone, rejects trailing garbage\n * - date: stored as raw string, but only YYYY-MM-DD works in SQLite queries\n * - datetime: stored as raw string, same YYYY-MM-DD requirement for query correctness\n * - long: strict decimal integer parse on the Rust side — no scientific notation\n * - decimal: Rust stores any string (no validation), but we enforce numeric format\n * to prevent obviously invalid values from silently passing through\n */\nconst WIRE_TYPE_FORMAT: Record<string, { pattern: RegExp; example: string }> = {\n timestamp: {\n pattern: /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/,\n example: \"2025-01-01T00:00:00Z\",\n },\n date: {\n pattern: /^\\d{4}-\\d{2}-\\d{2}$/,\n example: \"2025-01-01\",\n },\n datetime: {\n pattern:\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/,\n example: \"2025-01-01T12:00:00Z\",\n },\n long: {\n // Strict decimal integer — matches Rust's str::parse::<i64>().\n // No scientific notation, no decimal point, no whitespace.\n pattern: /^-?\\d+$/,\n example: \"9007199254740993\",\n },\n decimal: {\n // Numeric string with optional decimal point. Anchored.\n // Rust stores any string (no validation), but we reject obviously invalid values.\n pattern: /^-?\\d+(\\.\\d+)?$/,\n example: \"123.45\",\n },\n};\n\n/**\n * Compiles one or more seed data files into a single merged JSON output.\n *\n * Pipeline: load each file → merge → validate against schema → write JSON.\n *\n * @param seedFiles - Absolute paths to seed `.mts` / `.ts` files.\n * @param outputPath - Where to write the merged seed JSON.\n * @param schema - Per-object-type schema, typically built from\n * {@link import(\"./schema.js\").schemaFromMetadata}.\n * @throws if any seed file fails to compile or has an invalid export, if any\n * object type or property name is unknown to the schema, if any\n * primary key is duplicated across files, if any property value is\n * null/undefined or has the wrong JS type, or if any string-encoded\n * value has an invalid format.\n */\nexport async function compileSeedData(\n seedFiles: string[],\n outputPath: string,\n schema: SchemaMap,\n): Promise<void> {\n consola.info(`Compiling seed data from ${seedFiles.length} file(s)...`);\n\n const outputs: SeedOutput[] = [];\n for (const seedFile of seedFiles) {\n outputs.push(await loadSeedFile(seedFile));\n }\n\n const merged = mergeSeedOutputs(outputs, schema);\n validateSeedOutput(merged, schema);\n\n const totalObjects = Object.values(merged.objects)\n .reduce((sum, arr) => sum + arr.length, 0);\n\n const outputDir = path.dirname(outputPath);\n await fs.promises.mkdir(outputDir, { recursive: true });\n await fs.promises.writeFile(outputPath, JSON.stringify(merged, null, 2));\n\n consola.success(\n `Seed data compiled successfully (${totalObjects} objects, ${merged.links.length} links)`,\n );\n}\n\n/**\n * Merges multiple {@link SeedOutput}s into one.\n *\n * - Objects for the same type combine additively.\n * - Duplicate primary keys across files cause an error (checked by the actual\n * PK field from the schema, not by comparing the full serialized object).\n * - Duplicate links (same source, target, and link type) are deduplicated\n * with a warning logged to the console.\n *\n * @param outputs - The individual seed outputs to merge.\n * @param schemaMap - Used to resolve the primary key field name per object type.\n * @returns A single merged SeedOutput ready for validation and writing.\n * @throws if any primary key appears in more than one file for the same type.\n */\nexport function mergeSeedOutputs(\n outputs: SeedOutput[],\n schemaMap: SchemaMap,\n): SeedOutput {\n const merged: SeedOutput = { objects: {}, links: [] };\n const seenPks = new Map<string, Set<string>>();\n const seenLinks = new Set<string>();\n\n for (const output of outputs) {\n mergeObjectsInto(merged, output.objects, schemaMap, seenPks);\n mergeLinksInto(merged, output.links, seenLinks);\n }\n return merged;\n}\n\nfunction mergeObjectsInto(\n merged: SeedOutput,\n source: SeedOutput[\"objects\"],\n schemaMap: SchemaMap,\n seenPks: Map<string, Set<string>>,\n): void {\n for (const [apiName, objects] of Object.entries(source)) {\n const schema = schemaMap.get(apiName);\n if (!schema) {\n throw new Error(\n `Object type '${apiName}' in seed data is not defined in the ontology`,\n );\n }\n\n const bucket = (merged.objects[apiName] ??= []);\n const pkSet = getOrInit(seenPks, apiName, () => new Set<string>());\n\n for (const obj of objects) {\n const pk = String(obj[schema.primaryKeyApiName] ?? \"\");\n if (pkSet.has(pk)) {\n throw new Error(\n `Duplicate primary key '${pk}' for '${apiName}' across seed files`,\n );\n }\n pkSet.add(pk);\n bucket.push(obj);\n }\n }\n}\n\nfunction mergeLinksInto(\n merged: SeedOutput,\n source: SeedOutput[\"links\"],\n seenLinks: Set<string>,\n): void {\n for (const link of source) {\n const key = linkKey(link);\n if (seenLinks.has(key)) {\n consola.warn(\n `Duplicate link deduplicated: ${link.linkType}`\n + ` from ${link.sourceObjectType}:${link.sourceKey}`\n + ` to ${link.targetObjectType}:${link.targetKey}`,\n );\n continue;\n }\n seenLinks.add(key);\n merged.links.push(link);\n }\n}\n\nfunction linkKey(link: SeedLinkEntry): string {\n return `${link.sourceObjectType}:${link.sourceKey}`\n + `:${link.linkType}`\n + `:${link.targetObjectType}:${link.targetKey}`;\n}\n\nfunction getOrInit<K, V>(map: Map<K, V>, key: K, init: () => V): V {\n let value = map.get(key);\n if (value === undefined) {\n value = init();\n map.set(key, value);\n }\n return value;\n}\n\n/**\n * Validates the seed output against the ontology schema.\n *\n * Hard errors (thrown immediately) for any of:\n *\n * - Object types in the seed output not defined in the ontology.\n * - Property names on a seed object not defined on that type.\n * - `null`/`undefined` property values. Typed callers can't reach this\n * (the builder's `SeedProps<Q>` rejects `null`); any null at runtime is\n * a sign of `as any` or a hand-rolled output.\n * - JS type mismatches against the cataloged wire-type-to-JS-type map\n * (e.g., `age: \"30\"` when `age` is an integer, or `score: 30` when\n * `score` is a long).\n *\n * For wire types whose runtime shape this validator doesn't catalog\n * (`attachment`, `mediaReference`, `geopoint`, `geoshape`, `vector`,\n * `array`, `struct`), JS-type checking is skipped — they have non-primitive\n * shapes that would need bespoke validation. They still go through the\n * earlier object-type / property-name / null checks.\n *\n * After JS-type validation, string values are checked against the format\n * regex for their wire type (timestamp, date, datetime, long, decimal).\n * The one thing TypeScript cannot distinguish on its own is whether a\n * `string` value matches its wire format (e.g., `\"not-a-date\"` vs\n * `\"2025-01-01T00:00:00Z\"` are both valid `string` to the type system);\n * format validation fills that gap.\n *\n * @throws Error on any structural violation listed above, or listing all\n * format failures grouped by object type.\n */\nexport function validateSeedOutput(\n output: SeedOutput,\n schemaMap: SchemaMap,\n): void {\n const errors = validateAndCollectFormatErrors(output, schemaMap);\n if (errors.length > 0) {\n throw new Error(formatValidationErrors(errors));\n }\n}\n\nfunction validateAndCollectFormatErrors(\n output: SeedOutput,\n schemaMap: SchemaMap,\n): FormatError[] {\n const errors: FormatError[] = [];\n\n for (const [apiName, objects] of Object.entries(output.objects)) {\n const schema = schemaMap.get(apiName);\n if (!schema) {\n throw new Error(\n `Object type '${apiName}' in seed data is not defined in the ontology`,\n );\n }\n\n for (const [i, obj] of objects.entries()) {\n for (const [key, value] of Object.entries(obj)) {\n const wireType = schema.properties.get(key);\n if (wireType === undefined) {\n throw new Error(\n `Property '${key}' on '${apiName}' object`\n + ` (index ${i}) is not defined in the ontology`,\n );\n }\n\n if (value == null) {\n throw new Error(\n `Property '${key}' on '${apiName}' object`\n + ` (index ${i}) is null or undefined`,\n );\n }\n\n const expectedJsType = EXPECTED_JS_TYPE[wireType];\n if (expectedJsType !== undefined && typeof value !== expectedJsType) {\n throw new Error(\n `Property '${key}' on '${apiName}' object`\n + ` (index ${i}) expects ${wireType} (a ${expectedJsType})`\n + ` but got ${typeof value}`,\n );\n }\n\n const format = WIRE_TYPE_FORMAT[wireType];\n if (!format) continue;\n\n // Format regex only applies to string-encoded wire types, all of\n // which have EXPECTED_JS_TYPE === \"string\"; the cast is safe here\n // because the JS-type check above would have thrown otherwise.\n if (format.pattern.test(value as string)) continue;\n\n errors.push({\n objectType: apiName,\n objectIndex: i,\n field: key,\n message: `property '${key}' has invalid ${wireType}`\n + ` format: '${\n String(value)\n }'. Expected format like '${format.example}'`,\n });\n }\n }\n }\n\n return errors;\n}\n\nfunction formatValidationErrors(errors: FormatError[]): string {\n const grouped = new Map<string, string[]>();\n for (const err of errors) {\n const messages = getOrInit(grouped, err.objectType, () => []);\n messages.push(` object[${err.objectIndex}]: ${err.message}`);\n }\n\n const body = [...grouped.entries()]\n .map(([type, msgs]) => `${type}:\\n${msgs.join(\"\\n\")}`)\n .join(\"\\n\\n\");\n\n const errorWord = errors.length === 1 ? \"error\" : \"errors\";\n const typeWord = grouped.size === 1 ? \"object type\" : \"object types\";\n\n return `Seed data validation failed `\n + `(${errors.length} ${errorWord} across ${grouped.size} ${typeWord}`\n + `):\\n\\n${body}`;\n}\n\n/**\n * Loads a single seed file via jiti and extracts its default export.\n *\n * jiti.import() fully executes the module — the `createSeed()` builder\n * function runs during import and the default export is the resulting\n * SeedOutput.\n *\n * @throws with a contextual message wrapping the original error and filename.\n */\nasync function loadSeedFile(seedFile: string): Promise<SeedOutput> {\n consola.info(`Loading seed file: ${seedFile}`);\n\n let seedModule: { default: SeedOutput };\n try {\n const jiti = createJiti(seedFile, {\n moduleCache: false,\n debug: false,\n });\n seedModule = await jiti.import(seedFile) as { default: SeedOutput };\n } catch (e: unknown) {\n const message = e instanceof Error ? e.message : String(e);\n throw new Error(\n `Seed file '${path.basename(seedFile)}' failed to compile:\\n ${message}`,\n );\n }\n\n if (!seedModule.default || typeof seedModule.default !== \"object\") {\n throw new Error(\n `Seed file '${path.basename(seedFile)}' must have a default export. `\n + `Use createSeed() from @osdk/seed-helpers.`,\n );\n }\n\n const output = seedModule.default;\n\n if (!output.objects || typeof output.objects !== \"object\") {\n throw new Error(\n `Seed file '${path.basename(seedFile)}' default export is not a valid`\n + ` SeedOutput. Use createSeed() from @osdk/seed-helpers.`,\n );\n }\n\n // Normalize: links are optional in the export but required in SeedOutput.\n // Spread to avoid mutating the module's exported object.\n return { ...output, links: output.links ?? [] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,OAAO,QAAQ,SAAS;AACjC,SAASC,UAAU,QAAQ,MAAM;AACjC,OAAO,KAAKC,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;;AAGjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAiE,GAAG;EACxE;EACAC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,QAAQ;EACjBC,SAAS,EAAE,QAAQ;EACnBC,IAAI,EAAE,QAAQ;EACdC,QAAQ,EAAE,QAAQ;EAClBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE,QAAQ;EACjBC,SAAS,EAAE,QAAQ;EACnBC,UAAU,EAAE,QAAQ;EACpB;EACAC,OAAO,EAAE,QAAQ;EACjBC,IAAI,EAAE,QAAQ;EACdC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,QAAQ;EACf;EACAC,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAsE,GAAG;EAC7Eb,SAAS,EAAE;IACTc,OAAO,EAAE,kEAAkE;IAC3EC,OAAO,EAAE;EACX,CAAC;EACDd,IAAI,EAAE;IACJa,OAAO,EAAE,qBAAqB;IAC9BC,OAAO,EAAE;EACX,CAAC;EACDb,QAAQ,EAAE;IACRY,OAAO,EACL,sEAAsE;IACxEC,OAAO,EAAE;EACX,CAAC;EACDZ,IAAI,EAAE;IACJ;IACA;IACAW,OAAO,EAAE,S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H;EAEA,IAAI,CAACW,UAAU,CAACO,OAAO,IAAI,OAAOP,UAAU,CAACO,OAAO,KAAK,QAAQ,EAAE;IACjE,MAAM,IAAItD,KAAK,CACb,cAAc9D,IAAI,CAACmH,QAAQ,CAACxF,QAAQ,CAAC,gCAAgC,GACjE,2CACN,CAAC;EACH;EAEA,MAAM4B,MAAM,GAAGsD,UAAU,CAACO,OAAO;EAEjC,IAAI,CAAC7D,MAAM,CAACnB,OAAO,IAAI,OAAOmB,MAAM,CAACnB,OAAO,KAAK,QAAQ,EAAE;IACzD,MAAM,IAAI0B,KAAK,CACb,cAAc9D,IAAI,CAACmH,QAAQ,CAACxF,QAAQ,CAAC,iCAAiC,GAClE,wDACN,CAAC;EACH;;EAEA;EACA;EACA,OAAO;IAAE,GAAG4B,MAAM;IAAEN,KAAK,EAAEM,MAAM,CAACN,KAAK,IAAI;EAAG,CAAC;AACjD","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export { compileSeedData, mergeSeedOutputs, validateSeedOutput } from "./compileSeedData.js";
18
+ export { schemaFromMetadata } from "./schema.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["compileSeedData","mergeSeedOutputs","validateSeedOutput","schemaFromMetadata"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {\n compileSeedData,\n mergeSeedOutputs,\n validateSeedOutput,\n} from \"./compileSeedData.js\";\nexport { schemaFromMetadata } from \"./schema.js\";\nexport type { ObjectTypeSchema, SchemaMap } from \"./schema.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,eAAe,EACfC,gBAAgB,EAChBC,kBAAkB,QACb,sBAAsB;AAC7B,SAASC,kBAAkB,QAAQ,aAAa","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Minimal schema for one object type — only what the compiler needs.
19
+ *
20
+ * - `properties`: property API name → wire type (e.g. `"timestamp"`, `"long"`),
21
+ * used by the validator to enforce property existence, JS-type expectations,
22
+ * and string format regexes.
23
+ * - `primaryKeyApiName`: PK field name (for cross-file duplicate detection in merge).
24
+ */
25
+
26
+ /** Maps object type API name → its schema. */
27
+
28
+ /**
29
+ * Builds a {@link SchemaMap} from an `OntologyFullMetadata` document — the
30
+ * shape produced by the OSDK SDK generator and serialized to
31
+ * `ontology-metadata.json` alongside the generated `@ontology/sdk` package.
32
+ *
33
+ * Only `objectTypes` are read; the other top-level fields (action types,
34
+ * query types, interfaces, etc.) are not relevant to seed validation.
35
+ */
36
+ export function schemaFromMetadata(metadata) {
37
+ const map = new Map();
38
+ for (const [apiName, full] of Object.entries(metadata.objectTypes)) {
39
+ const ot = full.objectType;
40
+ const properties = new Map();
41
+ for (const [propApiName, prop] of Object.entries(ot.properties)) {
42
+ properties.set(propApiName, prop.dataType.type);
43
+ }
44
+ map.set(apiName, {
45
+ properties,
46
+ primaryKeyApiName: ot.primaryKey
47
+ });
48
+ }
49
+ return map;
50
+ }
51
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":["schemaFromMetadata","metadata","map","Map","apiName","full","Object","entries","objectTypes","ot","objectType","properties","propApiName","prop","set","dataType","type","primaryKeyApiName","primaryKey"],"sources":["schema.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\n\n/**\n * Minimal schema for one object type — only what the compiler needs.\n *\n * - `properties`: property API name → wire type (e.g. `\"timestamp\"`, `\"long\"`),\n * used by the validator to enforce property existence, JS-type expectations,\n * and string format regexes.\n * - `primaryKeyApiName`: PK field name (for cross-file duplicate detection in merge).\n */\nexport interface ObjectTypeSchema {\n properties: Map<string, string>;\n primaryKeyApiName: string;\n}\n\n/** Maps object type API name → its schema. */\nexport type SchemaMap = Map<string, ObjectTypeSchema>;\n\n/**\n * Builds a {@link SchemaMap} from an `OntologyFullMetadata` document — the\n * shape produced by the OSDK SDK generator and serialized to\n * `ontology-metadata.json` alongside the generated `@ontology/sdk` package.\n *\n * Only `objectTypes` are read; the other top-level fields (action types,\n * query types, interfaces, etc.) are not relevant to seed validation.\n */\nexport function schemaFromMetadata(\n metadata: OntologyFullMetadata,\n): SchemaMap {\n const map: SchemaMap = new Map();\n\n for (const [apiName, full] of Object.entries(metadata.objectTypes)) {\n const ot = full.objectType;\n\n const properties = new Map<string, string>();\n for (const [propApiName, prop] of Object.entries(ot.properties)) {\n properties.set(propApiName, prop.dataType.type);\n }\n\n map.set(apiName, {\n properties,\n primaryKeyApiName: ot.primaryKey,\n });\n }\n\n return map;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,kBAAkBA,CAChCC,QAA8B,EACnB;EACX,MAAMC,GAAc,GAAG,IAAIC,GAAG,CAAC,CAAC;EAEhC,KAAK,MAAM,CAACC,OAAO,EAAEC,IAAI,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IAClE,MAAMC,EAAE,GAAGJ,IAAI,CAACK,UAAU;IAE1B,MAAMC,UAAU,GAAG,IAAIR,GAAG,CAAiB,CAAC;IAC5C,KAAK,MAAM,CAACS,WAAW,EAAEC,IAAI,CAAC,IAAIP,MAAM,CAACC,OAAO,CAACE,EAAE,CAACE,UAAU,CAAC,EAAE;MAC/DA,UAAU,CAACG,GAAG,CAACF,WAAW,EAAEC,IAAI,CAACE,QAAQ,CAACC,IAAI,CAAC;IACjD;IAEAd,GAAG,CAACY,GAAG,CAACV,OAAO,EAAE;MACfO,UAAU;MACVM,iBAAiB,EAAER,EAAE,CAACS;IACxB,CAAC,CAAC;EACJ;EAEA,OAAOhB,GAAG;AACZ","ignoreList":[]}