latticesql 0.16.1 → 0.16.2
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/dist/cli.js +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -47,13 +47,13 @@ function buildParsedConfig(raw, sourceName, configDir) {
|
|
|
47
47
|
const dbPath = resolve(configDir, config.db);
|
|
48
48
|
const tables = [];
|
|
49
49
|
for (const [entityName, entityDef] of Object.entries(config.entities)) {
|
|
50
|
-
const definition = entityToTableDef(entityName, entityDef
|
|
50
|
+
const definition = entityToTableDef(entityName, entityDef);
|
|
51
51
|
tables.push({ name: entityName, definition });
|
|
52
52
|
}
|
|
53
53
|
const entityContexts = parseEntityContexts(config.entityContexts);
|
|
54
54
|
return { dbPath, tables, entityContexts };
|
|
55
55
|
}
|
|
56
|
-
function entityToTableDef(entityName, entity
|
|
56
|
+
function entityToTableDef(entityName, entity) {
|
|
57
57
|
const rawFields = entity.fields;
|
|
58
58
|
if (!rawFields || typeof rawFields !== "object" || Array.isArray(rawFields)) {
|
|
59
59
|
throw new Error(`Lattice: entity "${entityName}" must have a "fields" object`);
|
|
@@ -77,7 +77,7 @@ function entityToTableDef(entityName, entity, configDir) {
|
|
|
77
77
|
}
|
|
78
78
|
const primaryKey = entity.primaryKey ?? pkFromField;
|
|
79
79
|
const render = parseEntityRender(entity.render);
|
|
80
|
-
const outputFile =
|
|
80
|
+
const outputFile = entity.outputFile;
|
|
81
81
|
return {
|
|
82
82
|
columns,
|
|
83
83
|
render,
|
package/dist/index.cjs
CHANGED
|
@@ -1407,13 +1407,13 @@ function buildParsedConfig(raw, sourceName, configDir) {
|
|
|
1407
1407
|
const dbPath = (0, import_node_path7.resolve)(configDir, config.db);
|
|
1408
1408
|
const tables = [];
|
|
1409
1409
|
for (const [entityName, entityDef] of Object.entries(config.entities)) {
|
|
1410
|
-
const definition = entityToTableDef(entityName, entityDef
|
|
1410
|
+
const definition = entityToTableDef(entityName, entityDef);
|
|
1411
1411
|
tables.push({ name: entityName, definition });
|
|
1412
1412
|
}
|
|
1413
1413
|
const entityContexts = parseEntityContexts(config.entityContexts);
|
|
1414
1414
|
return { dbPath, tables, entityContexts };
|
|
1415
1415
|
}
|
|
1416
|
-
function entityToTableDef(entityName, entity
|
|
1416
|
+
function entityToTableDef(entityName, entity) {
|
|
1417
1417
|
const rawFields = entity.fields;
|
|
1418
1418
|
if (!rawFields || typeof rawFields !== "object" || Array.isArray(rawFields)) {
|
|
1419
1419
|
throw new Error(`Lattice: entity "${entityName}" must have a "fields" object`);
|
|
@@ -1437,7 +1437,7 @@ function entityToTableDef(entityName, entity, configDir) {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
const primaryKey = entity.primaryKey ?? pkFromField;
|
|
1439
1439
|
const render = parseEntityRender(entity.render);
|
|
1440
|
-
const outputFile =
|
|
1440
|
+
const outputFile = entity.outputFile;
|
|
1441
1441
|
return {
|
|
1442
1442
|
columns,
|
|
1443
1443
|
render,
|
package/dist/index.d.cts
CHANGED
|
@@ -1403,8 +1403,9 @@ interface ParsedConfig {
|
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Read, parse, and validate a `lattice.config.yml` file.
|
|
1405
1405
|
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1406
|
+
* The `db` path is resolved relative to the config file's directory.
|
|
1407
|
+
* `outputFile` values are kept as-is (they are relative to the `outputDir`
|
|
1408
|
+
* passed to `render()`, not to the config file location).
|
|
1408
1409
|
*
|
|
1409
1410
|
* @throws If the file cannot be read, the YAML is malformed, or required
|
|
1410
1411
|
* keys are missing.
|
|
@@ -1413,7 +1414,8 @@ declare function parseConfigFile(configPath: string): ParsedConfig;
|
|
|
1413
1414
|
/**
|
|
1414
1415
|
* Parse and validate a raw YAML string as a Lattice config.
|
|
1415
1416
|
*
|
|
1416
|
-
* `configDir` is used to resolve
|
|
1417
|
+
* `configDir` is used to resolve the `db` path. `outputFile` values are kept
|
|
1418
|
+
* as-is (relative to the `outputDir` passed to `render()`).
|
|
1417
1419
|
* Typically this should be the directory that contains `lattice.config.yml`.
|
|
1418
1420
|
*
|
|
1419
1421
|
* Useful for testing without touching the filesystem.
|
package/dist/index.d.ts
CHANGED
|
@@ -1403,8 +1403,9 @@ interface ParsedConfig {
|
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Read, parse, and validate a `lattice.config.yml` file.
|
|
1405
1405
|
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1406
|
+
* The `db` path is resolved relative to the config file's directory.
|
|
1407
|
+
* `outputFile` values are kept as-is (they are relative to the `outputDir`
|
|
1408
|
+
* passed to `render()`, not to the config file location).
|
|
1408
1409
|
*
|
|
1409
1410
|
* @throws If the file cannot be read, the YAML is malformed, or required
|
|
1410
1411
|
* keys are missing.
|
|
@@ -1413,7 +1414,8 @@ declare function parseConfigFile(configPath: string): ParsedConfig;
|
|
|
1413
1414
|
/**
|
|
1414
1415
|
* Parse and validate a raw YAML string as a Lattice config.
|
|
1415
1416
|
*
|
|
1416
|
-
* `configDir` is used to resolve
|
|
1417
|
+
* `configDir` is used to resolve the `db` path. `outputFile` values are kept
|
|
1418
|
+
* as-is (relative to the `outputDir` passed to `render()`).
|
|
1417
1419
|
* Typically this should be the directory that contains `lattice.config.yml`.
|
|
1418
1420
|
*
|
|
1419
1421
|
* Useful for testing without touching the filesystem.
|
package/dist/index.js
CHANGED
|
@@ -1345,13 +1345,13 @@ function buildParsedConfig(raw, sourceName, configDir) {
|
|
|
1345
1345
|
const dbPath = resolve(configDir, config.db);
|
|
1346
1346
|
const tables = [];
|
|
1347
1347
|
for (const [entityName, entityDef] of Object.entries(config.entities)) {
|
|
1348
|
-
const definition = entityToTableDef(entityName, entityDef
|
|
1348
|
+
const definition = entityToTableDef(entityName, entityDef);
|
|
1349
1349
|
tables.push({ name: entityName, definition });
|
|
1350
1350
|
}
|
|
1351
1351
|
const entityContexts = parseEntityContexts(config.entityContexts);
|
|
1352
1352
|
return { dbPath, tables, entityContexts };
|
|
1353
1353
|
}
|
|
1354
|
-
function entityToTableDef(entityName, entity
|
|
1354
|
+
function entityToTableDef(entityName, entity) {
|
|
1355
1355
|
const rawFields = entity.fields;
|
|
1356
1356
|
if (!rawFields || typeof rawFields !== "object" || Array.isArray(rawFields)) {
|
|
1357
1357
|
throw new Error(`Lattice: entity "${entityName}" must have a "fields" object`);
|
|
@@ -1375,7 +1375,7 @@ function entityToTableDef(entityName, entity, configDir) {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
const primaryKey = entity.primaryKey ?? pkFromField;
|
|
1377
1377
|
const render = parseEntityRender(entity.render);
|
|
1378
|
-
const outputFile =
|
|
1378
|
+
const outputFile = entity.outputFile;
|
|
1379
1379
|
return {
|
|
1380
1380
|
columns,
|
|
1381
1381
|
render,
|