nucleus-core-ts 0.9.758 → 0.9.759
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/package.json +1 -1
- package/scripts/generate-schema.ts +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.759",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -545,8 +545,29 @@ function main() {
|
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
const enabledFeatures = getEnabledFeatures(config)
|
|
548
|
-
const enabledSystemTables = systemTables.tables.filter((t) => isTableEnabled(t, enabledFeatures))
|
|
549
548
|
const customTables = config.entities || []
|
|
549
|
+
|
|
550
|
+
// A consumer's own entity WINS over a same-named system table.
|
|
551
|
+
//
|
|
552
|
+
// Without this, switching a feature on emits a second `export const <name>`
|
|
553
|
+
// for a table the app already declares, and the generated schema.ts no longer
|
|
554
|
+
// parses — the app crash-loops on boot with "already been declared", far from
|
|
555
|
+
// the config change that caused it. The app's own definition is the one its
|
|
556
|
+
// code and data depend on, so the system copy is the one to drop.
|
|
557
|
+
const customTableNames = new Set(customTables.map((t) => t.table_name))
|
|
558
|
+
const enabledSystemTables = systemTables.tables
|
|
559
|
+
.filter((t) => isTableEnabled(t, enabledFeatures))
|
|
560
|
+
.filter((t) => {
|
|
561
|
+
if (!customTableNames.has(t.table_name)) return true
|
|
562
|
+
console.warn(
|
|
563
|
+
`[Schema] "${t.table_name}" is declared in config.entities AND ships as a system table ` +
|
|
564
|
+
`(feature: ${t.feature_set?.join(', ') || 'none'}). Using YOUR definition and skipping ` +
|
|
565
|
+
`the built-in one. Nucleus features that read this table expect the built-in columns — ` +
|
|
566
|
+
`rename your entity if you want both.`
|
|
567
|
+
)
|
|
568
|
+
return false
|
|
569
|
+
})
|
|
570
|
+
|
|
550
571
|
const allTables = [...enabledSystemTables, ...customTables]
|
|
551
572
|
|
|
552
573
|
if (!fs.existsSync(outputDir)) {
|