@alpha.consultings/eloquent-orm.js 1.0.10 → 1.1.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 +16 -0
- package/PACKAGE-UPDATE-SUMMARY.md +10 -10
- package/README.md +5 -5
- package/dist/Model.d.ts +1 -1
- package/dist/Model.js +3 -3
- package/dist/cli/commands/cacheClear.js +12 -12
- package/dist/cli/commands/cacheStats.js +12 -12
- package/dist/cli/commands/dbSeed.d.ts +1 -1
- package/dist/cli/commands/dbSeed.js +23 -23
- package/dist/cli/commands/dbSeedBootstrapPrecheck.d.ts +1 -1
- package/dist/cli/commands/dbSeedBootstrapPrecheck.js +2 -2
- package/dist/cli/commands/dbSeedFresh.d.ts +1 -1
- package/dist/cli/commands/dbSeedFresh.js +10 -10
- package/dist/cli/commands/demoScenario.js +11 -11
- package/dist/cli/commands/factoryStatus.js +13 -13
- package/dist/cli/commands/makeController.js +11 -11
- package/dist/cli/commands/makeFactory.js +21 -21
- package/dist/cli/commands/makeMigration.d.ts +1 -1
- package/dist/cli/commands/makeMigration.js +19 -17
- package/dist/cli/commands/makeModel.js +30 -30
- package/dist/cli/commands/makeRegistry.d.ts +5 -8
- package/dist/cli/commands/makeRegistry.js +18 -68
- package/dist/cli/commands/makeScenario.js +49 -43
- package/dist/cli/commands/makeSeed.js +12 -9
- package/dist/cli/commands/makeService.js +10 -10
- package/dist/cli/commands/migrateFresh.d.ts +1 -1
- package/dist/cli/commands/migrateFresh.js +14 -14
- package/dist/cli/commands/migrateReset.d.ts +1 -1
- package/dist/cli/commands/migrateReset.js +4 -4
- package/dist/cli/commands/migrateRollback.d.ts +1 -1
- package/dist/cli/commands/migrateRollback.js +36 -36
- package/dist/cli/commands/migrateRun.d.ts +2 -2
- package/dist/cli/commands/migrateRun.js +34 -34
- package/dist/cli/commands/migrateStatus.d.ts +1 -1
- package/dist/cli/commands/migrateStatus.js +16 -16
- package/dist/cli/eloquent.d.ts +1 -1
- package/dist/cli/eloquent.js +30 -30
- package/dist/cli/utils/ArtifactRoutingReport.d.ts +1 -1
- package/dist/cli/utils/ArtifactRoutingReport.js +3 -3
- package/dist/cli/utils/ArtifactStorage.d.ts +2 -2
- package/dist/cli/utils/ArtifactStorage.js +30 -17
- package/dist/cli/utils/AuditTrail.js +2 -2
- package/dist/cli/utils/CliBootstrapSupport.d.ts +1 -1
- package/dist/cli/utils/CliCommandTargets.d.ts +2 -2
- package/dist/cli/utils/CliCommandTargets.js +2 -2
- package/dist/cli/utils/CliMakeArtifactCommandRegistration.js +15 -15
- package/dist/cli/utils/CliMigrationCommandRegistration.js +29 -29
- package/dist/cli/utils/CliProductionGuards.d.ts +1 -1
- package/dist/cli/utils/CliProductionGuards.js +6 -6
- package/dist/cli/utils/CliScaffoldCommandRegistration.js +13 -13
- package/dist/cli/utils/CliSeedScenarioCommandRegistration.js +23 -23
- package/dist/cli/utils/CliSupportCommandRegistration.js +8 -8
- package/dist/cli/utils/ImportResolver.d.ts +12 -3
- package/dist/cli/utils/ImportResolver.js +76 -17
- package/dist/cli/utils/ModelIntrospector.d.ts +1 -1
- package/dist/cli/utils/ModelIntrospector.js +4 -4
- package/dist/cli/utils/ScaffoldGeneratorSupport.js +2 -2
- package/dist/cli/utils/ScenarioMorphAliasRouting.js +8 -8
- package/dist/cli/utils/SeedBootstrapPrecheck.d.ts +1 -1
- package/dist/cli/utils/SeedBootstrapPrecheck.js +10 -10
- package/dist/cli/utils/TemplateEngine.js +2 -2
- package/dist/cli/utils/factories/Factory.d.ts +1 -1
- package/dist/cli/utils/factories/FactoryDisplay.d.ts +1 -1
- package/dist/cli/utils/factories/FactoryGraph.js +5 -5
- package/dist/cli/utils/factories/FactoryLoader.d.ts +1 -1
- package/dist/cli/utils/factories/FactoryLoader.js +4 -4
- package/dist/cli/utils/factories/FactoryRegistry.d.ts +3 -3
- package/dist/cli/utils/factories/FactoryRegistry.js +10 -10
- package/dist/cli/utils/migrations/MigrationLockStrategy.d.ts +1 -1
- package/dist/cli/utils/migrations/MigrationLockStrategy.js +2 -2
- package/dist/cli/utils/migrations/MigrationTracker.d.ts +2 -2
- package/dist/cli/utils/migrations/MigrationTracker.js +6 -6
- package/dist/cli/utils/migrations/MongoMigrationTracker.js +3 -3
- package/dist/cli/utils/resolveConnectionFlags.d.ts +1 -1
- package/dist/cli/utils/resolveConnectionFlags.js +3 -3
- package/dist/cli/utils/resolveSqlConnectionFlags.d.ts +1 -1
- package/dist/cli/utils/typescript/BaseCommand.d.ts +1 -1
- package/dist/cli/utils/typescript/BaseCommand.js +3 -3
- package/dist/cli/utils/typescript/TypeScriptCompiler.js +0 -1
- package/dist/cli/utils/typescript/tsRuntime.js +26 -4
- package/dist/config/database.js +9 -9
- package/dist/core/cache/CacheFallbackManager.d.ts +1 -1
- package/dist/core/cache/CacheManager.d.ts +1 -1
- package/dist/core/cache/CacheManager.js +2 -2
- package/dist/core/cache/CacheRegistry.js +4 -4
- package/dist/core/cache/drivers/FileCacheDriver.d.ts +1 -1
- package/dist/core/cache/drivers/FileCacheDriver.js +2 -2
- package/dist/core/cache/drivers/MemcachedCacheDriver.d.ts +1 -1
- package/dist/core/cache/drivers/MemcachedCacheDriver.js +2 -2
- package/dist/core/cache/drivers/MemoryCacheDriver.d.ts +1 -1
- package/dist/core/cache/drivers/MemoryCacheDriver.js +2 -2
- package/dist/core/cache/setupCache.js +12 -12
- package/dist/core/connection/ConnectionFactory.d.ts +2 -2
- package/dist/core/connection/ConnectionFactory.js +9 -9
- package/dist/core/connection/DatabaseConnection.d.ts +2 -2
- package/dist/core/connection/DatabaseConnection.js +4 -4
- package/dist/core/connection/DriverAdapter.d.ts +1 -1
- package/dist/core/connection/DriverAdapter.js +2 -2
- package/dist/core/connection/resolveConnectionName.d.ts +1 -1
- package/dist/core/connection/resolveConnectionName.js +7 -7
- package/dist/core/model/BaseModel.d.ts +31 -30
- package/dist/core/model/BaseModel.js +38 -38
- package/dist/core/model/BaseModelSafeFinderStatics.d.ts +1 -1
- package/dist/core/model/BaseModelSafeFinderStatics.js +19 -19
- package/dist/core/model/CoreModel.d.ts +6 -4
- package/dist/core/model/CoreModel.js +28 -28
- package/dist/core/model/CoreModelPersistenceState.d.ts +1 -1
- package/dist/core/model/CoreModelSafeFinderSupport.d.ts +2 -2
- package/dist/core/model/CoreModelSafeFinderSupport.js +2 -2
- package/dist/core/model/CoreModelValidationEvents.d.ts +2 -2
- package/dist/core/model/CoreModelValidationEvents.js +2 -2
- package/dist/core/model/SafeFinder.d.ts +1 -1
- package/dist/core/model/SafeFinder.js +2 -2
- package/dist/core/orm/mixins/CastsMixin.js +2 -2
- package/dist/core/orm/mixins/HooksMixin.js +8 -8
- package/dist/core/orm/mixins/MorphableMixin.js +4 -4
- package/dist/core/orm/mixins/PivotHelperMixin.js +3 -3
- package/dist/core/orm/mixins/QueryCacheMixin.js +20 -20
- package/dist/core/orm/mixins/ScopeMixin.js +2 -2
- package/dist/core/orm/mixins/SoftDeletesMixin.js +2 -2
- package/dist/core/orm/mixins/utils/HookStore.d.ts +1 -1
- package/dist/core/orm/mixins/utils/HookStore.js +2 -2
- package/dist/core/orm/mixins/utils/modelRegistration.d.ts +1 -1
- package/dist/core/orm/mixins/utils/modelRegistration.js +6 -6
- package/dist/core/orm/relations/BelongsTo.d.ts +1 -1
- package/dist/core/orm/relations/BelongsTo.js +2 -2
- package/dist/core/orm/relations/BelongsToMany.d.ts +1 -1
- package/dist/core/orm/relations/BelongsToMany.js +2 -2
- package/dist/core/orm/relations/HasMany.d.ts +1 -1
- package/dist/core/orm/relations/HasMany.js +2 -2
- package/dist/core/orm/relations/HasOne.d.ts +1 -1
- package/dist/core/orm/relations/HasOne.js +2 -2
- package/dist/core/orm/relations/MorphMany.d.ts +1 -1
- package/dist/core/orm/relations/MorphMany.js +2 -2
- package/dist/core/orm/relations/MorphOne.d.ts +1 -1
- package/dist/core/orm/relations/MorphOne.js +2 -2
- package/dist/core/orm/relations/MorphTo.d.ts +1 -1
- package/dist/core/orm/relations/MorphTo.js +5 -5
- package/dist/core/schema/SchemaBlueprint.d.ts +21 -0
- package/dist/core/schema/SchemaBuilder.d.ts +16 -3
- package/dist/core/schema/SchemaBuilder.js +191 -48
- package/dist/core/schema/SchemaValidator.d.ts +1 -1
- package/dist/core/security/AbstractSecurity.d.ts +1 -1
- package/dist/core/security/EnvKeySecurity.d.ts +1 -1
- package/dist/core/security/EnvKeySecurity.js +2 -2
- package/dist/core/security/NoSecurity.d.ts +1 -1
- package/dist/core/security/NoSecurity.js +2 -2
- package/dist/core/security/SecurityFactory.d.ts +1 -1
- package/dist/core/security/SecurityFactory.js +4 -4
- package/dist/core/security/index.d.ts +5 -5
- package/dist/core/security/index.js +5 -5
- package/dist/index.d.ts +10 -10
- package/dist/index.js +30 -30
- package/esm/Factory.mjs +113 -136
- package/esm/Model.mjs +4 -0
- package/esm/index.mjs +23 -28
- package/package.json +14 -5
- package/src/cli/templates/factory.tpl +1 -1
- package/src/cli/templates/seed.tpl +1 -1
|
@@ -1,54 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.SchemaBuilder = void 0;
|
|
37
4
|
/* ============================================================
|
|
38
5
|
* SchemaBuilder v4.0
|
|
39
6
|
* Auto-detects CREATE / ALTER / DROP COLUMN schema differences
|
|
40
7
|
* ============================================================ */
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
8
|
+
const SchemaBlueprint_js_1 = require("./SchemaBlueprint.js");
|
|
9
|
+
const SQLDialect_js_1 = require("./SQLDialect.js");
|
|
10
|
+
const database_js_1 = require("../../config/database.js");
|
|
11
|
+
const ConnectionFactory_js_1 = require("../connection/ConnectionFactory.js");
|
|
44
12
|
class SchemaBuilder {
|
|
45
|
-
static async toCreateSQL(tableName, schema, explicitDialect, smartUpdate = false, connectionNameOverride, forceCreate = false) {
|
|
13
|
+
static async toCreateSQL(tableName, schema, explicitDialect, smartUpdate = false, connectionNameOverride, forceCreate = false, database) {
|
|
46
14
|
const supportedDialects = ["mysql", "pg", "sqlite"];
|
|
47
15
|
let dialectName = supportedDialects.includes(explicitDialect)
|
|
48
16
|
? explicitDialect
|
|
49
|
-
: (
|
|
17
|
+
: (database_js_1.dbConfig.default || "mysql");
|
|
50
18
|
if (!supportedDialects.includes(dialectName)) {
|
|
51
|
-
const maybe = explicitDialect ?
|
|
19
|
+
const maybe = explicitDialect ? database_js_1.dbConfig.connections[explicitDialect] : undefined;
|
|
52
20
|
const driver = maybe?.driver;
|
|
53
21
|
if (driver && supportedDialects.includes(driver)) {
|
|
54
22
|
dialectName = driver;
|
|
@@ -57,8 +25,8 @@ class SchemaBuilder {
|
|
|
57
25
|
if (!supportedDialects.includes(dialectName)) {
|
|
58
26
|
throw new Error(`ERROR: Unsupported dialect: ${explicitDialect}`);
|
|
59
27
|
}
|
|
60
|
-
const dialect = new
|
|
61
|
-
const errors = (0,
|
|
28
|
+
const dialect = new SQLDialect_js_1.SQLDialect(dialectName);
|
|
29
|
+
const errors = (0, SchemaBlueprint_js_1.validateSchema)(schema);
|
|
62
30
|
if (errors.length > 0)
|
|
63
31
|
throw new Error(`ERROR: Schema validation failed for ${tableName}:\n${errors.join("\n")}`);
|
|
64
32
|
const columns = [];
|
|
@@ -67,6 +35,7 @@ class SchemaBuilder {
|
|
|
67
35
|
const rollbackExtraTables = [];
|
|
68
36
|
const columnSqlByName = new Map();
|
|
69
37
|
const desiredConstraintsByKey = new Map();
|
|
38
|
+
const desiredIndexesByKey = new Map();
|
|
70
39
|
const desiredPivotTables = new Map();
|
|
71
40
|
for (const [name, field] of Object.entries(schema)) {
|
|
72
41
|
switch (field.kind) {
|
|
@@ -123,6 +92,15 @@ class SchemaBuilder {
|
|
|
123
92
|
}
|
|
124
93
|
}
|
|
125
94
|
}
|
|
95
|
+
for (const foreignKey of database?.foreignKeys ?? []) {
|
|
96
|
+
const definition = this.databaseForeignKeyConstraintDefinition(tableName, foreignKey, dialect, dialectName);
|
|
97
|
+
columns.push(definition.createSql);
|
|
98
|
+
desiredConstraintsByKey.set(definition.key, definition);
|
|
99
|
+
}
|
|
100
|
+
for (const index of database?.indexes ?? []) {
|
|
101
|
+
const definition = this.indexDefinition(tableName, index, dialect, dialectName);
|
|
102
|
+
desiredIndexesByKey.set(definition.key, definition);
|
|
103
|
+
}
|
|
126
104
|
if (primaryColumns.length > 1) {
|
|
127
105
|
const pkCols = primaryColumns.map((c) => dialect.wrap(c)).join(", ");
|
|
128
106
|
columns.push(`PRIMARY KEY (${pkCols})`);
|
|
@@ -134,11 +112,11 @@ class SchemaBuilder {
|
|
|
134
112
|
let existingColumns = [];
|
|
135
113
|
const existingColumnSqlByName = new Map();
|
|
136
114
|
const existingConstraintsByKey = new Map();
|
|
115
|
+
const existingIndexesByKey = new Map();
|
|
137
116
|
let introspectionAdapter = null;
|
|
138
117
|
if (!forceCreate) {
|
|
139
118
|
try {
|
|
140
|
-
const
|
|
141
|
-
const adapter = await getAdapter((connectionNameOverride || dialectName));
|
|
119
|
+
const adapter = await (0, ConnectionFactory_js_1.getAdapter)((connectionNameOverride || dialectName));
|
|
142
120
|
introspectionAdapter = adapter;
|
|
143
121
|
if (dialectName === "mysql") {
|
|
144
122
|
const rows = await adapter.query(`SHOW TABLES LIKE ${adapter.placeholder(1)}`, [tableName]);
|
|
@@ -153,6 +131,10 @@ class SchemaBuilder {
|
|
|
153
131
|
for (const constraint of constraints) {
|
|
154
132
|
existingConstraintsByKey.set(constraint.key, constraint);
|
|
155
133
|
}
|
|
134
|
+
const indexes = await this.mysqlIndexes(adapter, tableName);
|
|
135
|
+
for (const index of indexes) {
|
|
136
|
+
existingIndexesByKey.set(index.key, index);
|
|
137
|
+
}
|
|
156
138
|
}
|
|
157
139
|
}
|
|
158
140
|
else if (dialectName === "pg") {
|
|
@@ -177,6 +159,10 @@ class SchemaBuilder {
|
|
|
177
159
|
for (const constraint of constraints) {
|
|
178
160
|
existingConstraintsByKey.set(constraint.key, constraint);
|
|
179
161
|
}
|
|
162
|
+
const indexes = await this.pgIndexes(adapter, tableName);
|
|
163
|
+
for (const index of indexes) {
|
|
164
|
+
existingIndexesByKey.set(index.key, index);
|
|
165
|
+
}
|
|
180
166
|
}
|
|
181
167
|
else {
|
|
182
168
|
// mysql/pg were handled above; with validated dialects, the remaining branch is sqlite.
|
|
@@ -190,6 +176,10 @@ class SchemaBuilder {
|
|
|
190
176
|
for (const constraint of constraints) {
|
|
191
177
|
existingConstraintsByKey.set(constraint.key, constraint);
|
|
192
178
|
}
|
|
179
|
+
const indexes = await this.sqliteIndexes(adapter, tableName);
|
|
180
|
+
for (const index of indexes) {
|
|
181
|
+
existingIndexesByKey.set(index.key, index);
|
|
182
|
+
}
|
|
193
183
|
}
|
|
194
184
|
}
|
|
195
185
|
catch {
|
|
@@ -214,6 +204,12 @@ class SchemaBuilder {
|
|
|
214
204
|
}
|
|
215
205
|
}
|
|
216
206
|
}
|
|
207
|
+
for (const index of desiredIndexesByKey.values()) {
|
|
208
|
+
if (!tableExists || !smartUpdate || !existingIndexesByKey.has(index.key)) {
|
|
209
|
+
extraTables.push(index.createSql);
|
|
210
|
+
rollbackExtraTables.push(index.dropSql);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
217
213
|
let mainSQL = "";
|
|
218
214
|
let rollbackMainSQL = "";
|
|
219
215
|
if (!tableExists) {
|
|
@@ -250,7 +246,9 @@ class SchemaBuilder {
|
|
|
250
246
|
}
|
|
251
247
|
}
|
|
252
248
|
for (const [key, constraint] of existingConstraintsByKey.entries()) {
|
|
253
|
-
if (
|
|
249
|
+
if (constraint.managed &&
|
|
250
|
+
!desiredConstraintsByKey.has(key) &&
|
|
251
|
+
constraint.dropClause.trim().length > 0) {
|
|
254
252
|
dropConstraints.push(constraint);
|
|
255
253
|
}
|
|
256
254
|
}
|
|
@@ -310,7 +308,10 @@ class SchemaBuilder {
|
|
|
310
308
|
if (rollbackCombined.length > 0) {
|
|
311
309
|
rollbackMainSQL = `ALTER TABLE ${dialect.wrap(tableName)}\n ${rollbackCombined};`;
|
|
312
310
|
}
|
|
313
|
-
console.log(`Schema diff -> +[${missingColumnNames.join(", ") || "-"}], -[${dropColumns.join(", ") || "-"}], +fk[${addConstraints.map((constraint) => constraint.key).join(", ") || "-"}], -fk[${dropConstraints.map((constraint) => constraint.key).join(", ") || "-"}]
|
|
311
|
+
console.log(`Schema diff -> +[${missingColumnNames.join(", ") || "-"}], -[${dropColumns.join(", ") || "-"}], +fk[${addConstraints.map((constraint) => constraint.key).join(", ") || "-"}], -fk[${dropConstraints.map((constraint) => constraint.key).join(", ") || "-"}], +idx[${[...desiredIndexesByKey.values()]
|
|
312
|
+
.filter((index) => !existingIndexesByKey.has(index.key))
|
|
313
|
+
.map((index) => index.name)
|
|
314
|
+
.join(", ") || "-"}]`);
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
return { mainSQL, extraTables, rollbackMainSQL, rollbackExtraTables };
|
|
@@ -321,7 +322,7 @@ class SchemaBuilder {
|
|
|
321
322
|
static toDropSQL(tableName, schema, dialectName = "mysql") {
|
|
322
323
|
const dropSQL = [];
|
|
323
324
|
const pivotTables = [];
|
|
324
|
-
const dialect = new
|
|
325
|
+
const dialect = new SQLDialect_js_1.SQLDialect(dialectName);
|
|
325
326
|
for (const [, field] of Object.entries(schema)) {
|
|
326
327
|
if (field.kind === "relation" && field.relation === "belongsToMany" && field.model) {
|
|
327
328
|
const modelA = tableName.toLowerCase();
|
|
@@ -553,14 +554,30 @@ class SchemaBuilder {
|
|
|
553
554
|
static foreignKeyConstraintKey(foreignKey, referencedTable, referencedColumn) {
|
|
554
555
|
return `fk:${foreignKey}:${referencedTable}:${referencedColumn}`;
|
|
555
556
|
}
|
|
557
|
+
static normalizeRelationalAction(action) {
|
|
558
|
+
if (!action)
|
|
559
|
+
return null;
|
|
560
|
+
return action.trim().toUpperCase();
|
|
561
|
+
}
|
|
562
|
+
static appendForeignKeyActions(baseSql, onDelete, onUpdate) {
|
|
563
|
+
const clauses = [baseSql];
|
|
564
|
+
const normalizedOnDelete = this.normalizeRelationalAction(onDelete);
|
|
565
|
+
const normalizedOnUpdate = this.normalizeRelationalAction(onUpdate);
|
|
566
|
+
if (normalizedOnDelete)
|
|
567
|
+
clauses.push(`ON DELETE ${normalizedOnDelete}`);
|
|
568
|
+
if (normalizedOnUpdate)
|
|
569
|
+
clauses.push(`ON UPDATE ${normalizedOnUpdate}`);
|
|
570
|
+
return clauses.join(" ");
|
|
571
|
+
}
|
|
556
572
|
static foreignKeyConstraintDefinition(tableName, foreignKey, referencedTable, referencedColumn, dialect, dialectName, existingName) {
|
|
557
573
|
const wrap = (value) => dialect.wrap(value);
|
|
558
574
|
const constraintName = existingName ?? this.foreignKeyConstraintName(tableName, foreignKey);
|
|
559
575
|
const key = this.foreignKeyConstraintKey(foreignKey, referencedTable, referencedColumn);
|
|
560
|
-
const
|
|
576
|
+
const foreignKeySql = `FOREIGN KEY (${wrap(foreignKey)}) REFERENCES ${wrap(referencedTable)}(${wrap(referencedColumn)})`;
|
|
577
|
+
const createSql = `CONSTRAINT ${wrap(constraintName)} ${foreignKeySql}`;
|
|
561
578
|
const addClause = dialectName === "sqlite"
|
|
562
579
|
? ""
|
|
563
|
-
: `ADD
|
|
580
|
+
: `ADD ${createSql}`;
|
|
564
581
|
const dropClause = dialectName === "mysql"
|
|
565
582
|
? `DROP FOREIGN KEY ${wrap(constraintName)}`
|
|
566
583
|
: dialectName === "pg"
|
|
@@ -568,9 +585,47 @@ class SchemaBuilder {
|
|
|
568
585
|
: "";
|
|
569
586
|
return {
|
|
570
587
|
key,
|
|
588
|
+
name: constraintName,
|
|
571
589
|
createSql,
|
|
572
590
|
addClause,
|
|
573
591
|
dropClause,
|
|
592
|
+
managed: constraintName === this.foreignKeyConstraintName(tableName, foreignKey),
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
static databaseForeignKeyConstraintDefinition(tableName, definition, dialect, dialectName) {
|
|
596
|
+
const referencedColumn = definition.references.column ?? "id";
|
|
597
|
+
const baseDefinition = this.foreignKeyConstraintDefinition(tableName, definition.column, definition.references.table, referencedColumn, dialect, dialectName, definition.name);
|
|
598
|
+
const createSql = this.appendForeignKeyActions(baseDefinition.createSql, definition.onDelete, definition.onUpdate);
|
|
599
|
+
const addClause = dialectName === "sqlite"
|
|
600
|
+
? ""
|
|
601
|
+
: `ADD ${createSql}`;
|
|
602
|
+
return {
|
|
603
|
+
...baseDefinition,
|
|
604
|
+
name: definition.name ?? baseDefinition.name,
|
|
605
|
+
createSql,
|
|
606
|
+
addClause,
|
|
607
|
+
managed: true,
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
static indexKey(columns, unique, where) {
|
|
611
|
+
const normalizedWhere = where?.trim().replace(/\s+/g, " ").toLowerCase() ?? "";
|
|
612
|
+
return `idx:${unique ? "unique" : "plain"}:${columns.join(",").toLowerCase()}:${normalizedWhere}`;
|
|
613
|
+
}
|
|
614
|
+
static defaultIndexName(tableName, columns, unique) {
|
|
615
|
+
return `${tableName}_${columns.join("_")}_${unique ? "unique" : "idx"}`;
|
|
616
|
+
}
|
|
617
|
+
static indexDefinition(tableName, definition, dialect, _dialectName) {
|
|
618
|
+
const name = definition.name ?? this.defaultIndexName(tableName, definition.columns, !!definition.unique);
|
|
619
|
+
const wrappedColumns = definition.columns.map((column) => dialect.wrap(column)).join(", ");
|
|
620
|
+
const uniqueSql = definition.unique ? "UNIQUE " : "";
|
|
621
|
+
const whereSql = definition.where?.trim() ? ` WHERE ${definition.where.trim()}` : "";
|
|
622
|
+
const createSql = `CREATE ${uniqueSql}INDEX IF NOT EXISTS ${dialect.wrap(name)} ON ${dialect.wrap(tableName)} (${wrappedColumns})${whereSql};`;
|
|
623
|
+
const dropSql = `DROP INDEX IF EXISTS ${dialect.wrap(name)};`;
|
|
624
|
+
return {
|
|
625
|
+
key: this.indexKey(definition.columns, !!definition.unique, definition.where),
|
|
626
|
+
name,
|
|
627
|
+
createSql,
|
|
628
|
+
dropSql,
|
|
574
629
|
};
|
|
575
630
|
}
|
|
576
631
|
static async mysqlForeignKeys(adapter, tableName, dialect) {
|
|
@@ -587,8 +642,10 @@ class SchemaBuilder {
|
|
|
587
642
|
const definition = this.foreignKeyConstraintDefinition(tableName, row.column_name, row.referenced_table_name, row.referenced_column_name, dialect, "mysql", row.constraint_name);
|
|
588
643
|
return {
|
|
589
644
|
key: definition.key,
|
|
645
|
+
name: definition.name,
|
|
590
646
|
addClause: definition.addClause,
|
|
591
647
|
dropClause: definition.dropClause,
|
|
648
|
+
managed: definition.managed,
|
|
592
649
|
};
|
|
593
650
|
});
|
|
594
651
|
}
|
|
@@ -612,22 +669,108 @@ class SchemaBuilder {
|
|
|
612
669
|
const definition = this.foreignKeyConstraintDefinition(tableName, row.column_name, row.referenced_table_name, row.referenced_column_name, dialect, "pg", row.constraint_name);
|
|
613
670
|
return {
|
|
614
671
|
key: definition.key,
|
|
672
|
+
name: definition.name,
|
|
615
673
|
addClause: definition.addClause,
|
|
616
674
|
dropClause: definition.dropClause,
|
|
675
|
+
managed: definition.managed,
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
static async mysqlIndexes(adapter, tableName) {
|
|
680
|
+
const rows = await adapter.query(`SHOW INDEX FROM \`${tableName}\`;`);
|
|
681
|
+
const grouped = new Map();
|
|
682
|
+
for (const row of rows) {
|
|
683
|
+
if (row.Key_name === "PRIMARY")
|
|
684
|
+
continue;
|
|
685
|
+
const current = grouped.get(row.Key_name) ?? {
|
|
686
|
+
unique: row.Non_unique === 0,
|
|
687
|
+
columns: [],
|
|
688
|
+
};
|
|
689
|
+
current.columns.push({ seq: row.Seq_in_index, name: row.Column_name });
|
|
690
|
+
grouped.set(row.Key_name, current);
|
|
691
|
+
}
|
|
692
|
+
return [...grouped.entries()].map(([name, value]) => {
|
|
693
|
+
const columns = value.columns
|
|
694
|
+
.sort((left, right) => left.seq - right.seq)
|
|
695
|
+
.map((column) => column.name);
|
|
696
|
+
return {
|
|
697
|
+
key: this.indexKey(columns, value.unique),
|
|
698
|
+
name,
|
|
617
699
|
};
|
|
618
700
|
});
|
|
619
701
|
}
|
|
702
|
+
static parsePgIndexDefinition(indexName, indexDefinition) {
|
|
703
|
+
if (indexName.endsWith("_pkey"))
|
|
704
|
+
return null;
|
|
705
|
+
const unique = /\bCREATE\s+UNIQUE\s+INDEX\b/i.test(indexDefinition);
|
|
706
|
+
const columnsMatch = indexDefinition.match(/\(([^)]+)\)(?:\s+WHERE\s+(.+))?$/i);
|
|
707
|
+
if (!columnsMatch)
|
|
708
|
+
return null;
|
|
709
|
+
const columns = columnsMatch[1]
|
|
710
|
+
.split(",")
|
|
711
|
+
.map((column) => column.trim().replace(/^"|"$/g, ""))
|
|
712
|
+
.filter(Boolean);
|
|
713
|
+
const where = columnsMatch[2]?.trim();
|
|
714
|
+
return {
|
|
715
|
+
key: this.indexKey(columns, unique, where),
|
|
716
|
+
name: indexName,
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
static async pgIndexes(adapter, tableName) {
|
|
720
|
+
const rows = await adapter.query(`SELECT indexname, indexdef
|
|
721
|
+
FROM pg_indexes
|
|
722
|
+
WHERE schemaname = current_schema()
|
|
723
|
+
AND tablename = ${adapter.placeholder(1)}`, [tableName]);
|
|
724
|
+
return rows
|
|
725
|
+
.map((row) => this.parsePgIndexDefinition(row.indexname, row.indexdef))
|
|
726
|
+
.filter((row) => row !== null);
|
|
727
|
+
}
|
|
620
728
|
static async sqliteForeignKeys(adapter, tableName, dialect) {
|
|
621
729
|
const rows = await adapter.query(`PRAGMA foreign_key_list(${dialect.wrap(tableName)});`);
|
|
622
730
|
return rows.map((row) => {
|
|
623
731
|
const definition = this.foreignKeyConstraintDefinition(tableName, row.from, row.table, row.to || "id", dialect, "sqlite");
|
|
624
732
|
return {
|
|
625
733
|
key: definition.key,
|
|
734
|
+
name: definition.name,
|
|
626
735
|
addClause: definition.addClause,
|
|
627
736
|
dropClause: definition.dropClause,
|
|
737
|
+
managed: definition.managed,
|
|
628
738
|
};
|
|
629
739
|
});
|
|
630
740
|
}
|
|
741
|
+
/* istanbul ignore next -- full-suite babel/ts-jest coverage misanchors a synthetic statement/function into this sqlite index introspection block */
|
|
742
|
+
static async sqliteIndexes(adapter, tableName) {
|
|
743
|
+
const indexes = await adapter.query(`PRAGMA index_list("${tableName}");`);
|
|
744
|
+
const existing = [];
|
|
745
|
+
for (const index of indexes) {
|
|
746
|
+
if (index.origin === "pk")
|
|
747
|
+
continue;
|
|
748
|
+
const columns = await adapter.query(`PRAGMA index_info("${index.name}");`);
|
|
749
|
+
existing.push(this.sqliteExistingIndex(index.name, index.unique === 1, columns));
|
|
750
|
+
}
|
|
751
|
+
function finalizeExistingIndexes(value) {
|
|
752
|
+
return value;
|
|
753
|
+
}
|
|
754
|
+
return finalizeExistingIndexes(existing);
|
|
755
|
+
}
|
|
756
|
+
static sqliteExistingIndex(indexName, unique, columns) {
|
|
757
|
+
const columnNames = this.sqliteIndexColumnNames(columns);
|
|
758
|
+
return {
|
|
759
|
+
key: this.indexKey(columnNames, unique),
|
|
760
|
+
name: indexName,
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
static sqliteIndexColumnNames(columns) {
|
|
764
|
+
const columnNames = [];
|
|
765
|
+
const orderedColumns = [...columns].sort(this.compareSqliteIndexColumnSeqno);
|
|
766
|
+
for (const column of orderedColumns) {
|
|
767
|
+
columnNames.push(column.name);
|
|
768
|
+
}
|
|
769
|
+
return columnNames;
|
|
770
|
+
}
|
|
771
|
+
static compareSqliteIndexColumnSeqno(left, right) {
|
|
772
|
+
return left.seqno - right.seqno;
|
|
773
|
+
}
|
|
631
774
|
static async pivotTableExists(adapter, dialectName, dialect, pivotTable) {
|
|
632
775
|
if (dialectName === "mysql") {
|
|
633
776
|
const rows = await adapter.query(`SHOW TABLES LIKE ${adapter.placeholder(1)}`, [pivotTable]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 🧠 SchemaValidator
|
|
3
3
|
* Runtime validation engine for models with hooks and custom rules.
|
|
4
4
|
*/
|
|
5
|
-
import type { ValidationRule } from "./SchemaBlueprint";
|
|
5
|
+
import type { ValidationRule } from "./SchemaBlueprint.js";
|
|
6
6
|
export interface ValidationError {
|
|
7
7
|
field: string;
|
|
8
8
|
message: string;
|
|
@@ -7,12 +7,12 @@ exports.EnvKeySecurity = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const crypto_1 = __importDefault(require("crypto"));
|
|
9
9
|
const readline_1 = __importDefault(require("readline"));
|
|
10
|
-
const
|
|
10
|
+
const AbstractSecurity_js_1 = require("./AbstractSecurity.js");
|
|
11
11
|
/**
|
|
12
12
|
* 🔑 EnvKeySecurity
|
|
13
13
|
* Requires a migration key from environment and user confirmation.
|
|
14
14
|
*/
|
|
15
|
-
class EnvKeySecurity extends
|
|
15
|
+
class EnvKeySecurity extends AbstractSecurity_js_1.AbstractSecurity {
|
|
16
16
|
async init() {
|
|
17
17
|
this.hashKey = process.env.ELOQUENT_MIGRATION_KEY
|
|
18
18
|
? crypto_1.default.createHash("sha256").update(process.env.ELOQUENT_MIGRATION_KEY).digest("hex")
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NoSecurity = void 0;
|
|
4
|
-
const
|
|
4
|
+
const AbstractSecurity_js_1 = require("./AbstractSecurity.js");
|
|
5
5
|
/**
|
|
6
6
|
* 🚧 NoSecurity
|
|
7
7
|
* Used when no security checks are required (e.g., local dev or testing).
|
|
8
8
|
*/
|
|
9
|
-
class NoSecurity extends
|
|
9
|
+
class NoSecurity extends AbstractSecurity_js_1.AbstractSecurity {
|
|
10
10
|
async confirmPrivilege() {
|
|
11
11
|
return true; // Always allow
|
|
12
12
|
}
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SecurityFactory = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const EnvKeySecurity_js_1 = require("./EnvKeySecurity.js");
|
|
8
|
+
const NoSecurity_js_1 = require("./NoSecurity.js");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
10
|
/**
|
|
11
11
|
* 🧠 SecurityFactory
|
|
@@ -17,11 +17,11 @@ class SecurityFactory {
|
|
|
17
17
|
switch (mode.toLowerCase()) {
|
|
18
18
|
case "envkey":
|
|
19
19
|
console.log(chalk_1.default.gray("🔐 Security mode: EnvKey"));
|
|
20
|
-
return new
|
|
20
|
+
return new EnvKeySecurity_js_1.EnvKeySecurity();
|
|
21
21
|
case "none":
|
|
22
22
|
default:
|
|
23
23
|
console.log(chalk_1.default.gray("🔓 Security mode: Disabled (NoSecurity)"));
|
|
24
|
-
return new
|
|
24
|
+
return new NoSecurity_js_1.NoSecurity();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./SecurityContract";
|
|
2
|
-
export * from "./AbstractSecurity";
|
|
3
|
-
export * from "./NoSecurity";
|
|
4
|
-
export * from "./EnvKeySecurity";
|
|
5
|
-
export * from "./SecurityFactory";
|
|
1
|
+
export * from "./SecurityContract.js";
|
|
2
|
+
export * from "./AbstractSecurity.js";
|
|
3
|
+
export * from "./NoSecurity.js";
|
|
4
|
+
export * from "./EnvKeySecurity.js";
|
|
5
|
+
export * from "./SecurityFactory.js";
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./SecurityContract"), exports);
|
|
18
|
-
__exportStar(require("./AbstractSecurity"), exports);
|
|
19
|
-
__exportStar(require("./NoSecurity"), exports);
|
|
20
|
-
__exportStar(require("./EnvKeySecurity"), exports);
|
|
21
|
-
__exportStar(require("./SecurityFactory"), exports);
|
|
17
|
+
__exportStar(require("./SecurityContract.js"), exports);
|
|
18
|
+
__exportStar(require("./AbstractSecurity.js"), exports);
|
|
19
|
+
__exportStar(require("./NoSecurity.js"), exports);
|
|
20
|
+
__exportStar(require("./EnvKeySecurity.js"), exports);
|
|
21
|
+
__exportStar(require("./SecurityFactory.js"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Only exports from this file are semver-tracked and supported for consumers.
|
|
4
4
|
* Deep imports into internal `dist/core/*`, `dist/cli/*`, or `src/*` paths are private.
|
|
5
5
|
*/
|
|
6
|
-
export { BaseModel, Model, SqlModel, MongoModel, MorphRegistry, type ORMRecord, type ModelAttrs, type ModelInstance, type TypedRelation, type PivotRelation, } from "./core/model/BaseModel";
|
|
7
|
-
export { PivotHelperMixin } from "./core/orm/mixins/PivotHelperMixin";
|
|
8
|
-
export { Factory, type PlainObject, type ModelCtor, type FactoryCtor, } from "./cli/utils/factories/Factory";
|
|
9
|
-
export { CoreModel, type ModelEventHooks, } from "./core/model/CoreModel";
|
|
10
|
-
export { column, validate, relation, mixin, validateSchema, type ColumnType, type ColumnOptions, type ValidationRule, type RelationType, type RelationOptions, type MixinName, type MixinDefinition, type ColumnDefinition, type RelationDefinition, type SchemaField, } from "./core/schema/SchemaBlueprint";
|
|
11
|
-
export { SchemaValidator, type ValidationError, type SchemaValidatorOptions, type ValidationHooks, type CustomRuleFunction, type CustomRuleResult, } from "./core/schema/SchemaValidator";
|
|
12
|
-
export { SchemaBuilder, type SchemaBuildResult } from "./core/schema/SchemaBuilder";
|
|
13
|
-
export { CacheManager } from "./core/cache/CacheManager";
|
|
14
|
-
export { setupCache } from "./core/cache/setupCache";
|
|
15
|
-
export { registerModels, isModelRegistered, setModelRegistryStrictMode, isModelRegistryStrictMode, type RegisterModelsOptions, } from "./core/orm/mixins/utils/modelRegistration";
|
|
6
|
+
export { BaseModel, Model, SqlModel, MongoModel, MorphRegistry, type ORMRecord, type ModelAttrs, type ModelInstance, type TypedRelation, type PivotRelation, } from "./core/model/BaseModel.js";
|
|
7
|
+
export { PivotHelperMixin } from "./core/orm/mixins/PivotHelperMixin.js";
|
|
8
|
+
export { Factory, type PlainObject, type ModelCtor, type FactoryCtor, } from "./cli/utils/factories/Factory.js";
|
|
9
|
+
export { CoreModel, type ModelEventHooks, } from "./core/model/CoreModel.js";
|
|
10
|
+
export { column, validate, relation, mixin, validateSchema, type ColumnType, type ColumnOptions, type ValidationRule, type RelationType, type RelationOptions, type MixinName, type MixinDefinition, type ColumnDefinition, type RelationDefinition, type SchemaField, } from "./core/schema/SchemaBlueprint.js";
|
|
11
|
+
export { SchemaValidator, type ValidationError, type SchemaValidatorOptions, type ValidationHooks, type CustomRuleFunction, type CustomRuleResult, } from "./core/schema/SchemaValidator.js";
|
|
12
|
+
export { SchemaBuilder, type SchemaBuildResult } from "./core/schema/SchemaBuilder.js";
|
|
13
|
+
export { CacheManager } from "./core/cache/CacheManager.js";
|
|
14
|
+
export { setupCache } from "./core/cache/setupCache.js";
|
|
15
|
+
export { registerModels, isModelRegistered, setModelRegistryStrictMode, isModelRegistryStrictMode, type RegisterModelsOptions, } from "./core/orm/mixins/utils/modelRegistration.js";
|
package/dist/index.js
CHANGED
|
@@ -6,33 +6,33 @@ exports.isModelRegistryStrictMode = exports.setModelRegistryStrictMode = exports
|
|
|
6
6
|
* Only exports from this file are semver-tracked and supported for consumers.
|
|
7
7
|
* Deep imports into internal `dist/core/*`, `dist/cli/*`, or `src/*` paths are private.
|
|
8
8
|
*/
|
|
9
|
-
var
|
|
10
|
-
Object.defineProperty(exports, "BaseModel", { enumerable: true, get: function () { return
|
|
11
|
-
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return
|
|
12
|
-
Object.defineProperty(exports, "SqlModel", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "MongoModel", { enumerable: true, get: function () { return
|
|
14
|
-
Object.defineProperty(exports, "MorphRegistry", { enumerable: true, get: function () { return
|
|
15
|
-
var
|
|
16
|
-
Object.defineProperty(exports, "PivotHelperMixin", { enumerable: true, get: function () { return
|
|
17
|
-
Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return require("./cli/utils/factories/Factory").Factory; } });
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "CoreModel", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "column", { enumerable: true, get: function () { return
|
|
22
|
-
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return
|
|
23
|
-
Object.defineProperty(exports, "relation", { enumerable: true, get: function () { return
|
|
24
|
-
Object.defineProperty(exports, "mixin", { enumerable: true, get: function () { return
|
|
25
|
-
Object.defineProperty(exports, "validateSchema", { enumerable: true, get: function () { return
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(exports, "SchemaValidator", { enumerable: true, get: function () { return
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "SchemaBuilder", { enumerable: true, get: function () { return
|
|
30
|
-
var
|
|
31
|
-
Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return
|
|
32
|
-
var
|
|
33
|
-
Object.defineProperty(exports, "setupCache", { enumerable: true, get: function () { return
|
|
34
|
-
var
|
|
35
|
-
Object.defineProperty(exports, "registerModels", { enumerable: true, get: function () { return
|
|
36
|
-
Object.defineProperty(exports, "isModelRegistered", { enumerable: true, get: function () { return
|
|
37
|
-
Object.defineProperty(exports, "setModelRegistryStrictMode", { enumerable: true, get: function () { return
|
|
38
|
-
Object.defineProperty(exports, "isModelRegistryStrictMode", { enumerable: true, get: function () { return
|
|
9
|
+
var BaseModel_js_1 = require("./core/model/BaseModel.js");
|
|
10
|
+
Object.defineProperty(exports, "BaseModel", { enumerable: true, get: function () { return BaseModel_js_1.BaseModel; } });
|
|
11
|
+
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return BaseModel_js_1.Model; } });
|
|
12
|
+
Object.defineProperty(exports, "SqlModel", { enumerable: true, get: function () { return BaseModel_js_1.SqlModel; } });
|
|
13
|
+
Object.defineProperty(exports, "MongoModel", { enumerable: true, get: function () { return BaseModel_js_1.MongoModel; } });
|
|
14
|
+
Object.defineProperty(exports, "MorphRegistry", { enumerable: true, get: function () { return BaseModel_js_1.MorphRegistry; } });
|
|
15
|
+
var PivotHelperMixin_js_1 = require("./core/orm/mixins/PivotHelperMixin.js");
|
|
16
|
+
Object.defineProperty(exports, "PivotHelperMixin", { enumerable: true, get: function () { return PivotHelperMixin_js_1.PivotHelperMixin; } });
|
|
17
|
+
Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return require("./cli/utils/factories/Factory.js").Factory; } });
|
|
18
|
+
var CoreModel_js_1 = require("./core/model/CoreModel.js");
|
|
19
|
+
Object.defineProperty(exports, "CoreModel", { enumerable: true, get: function () { return CoreModel_js_1.CoreModel; } });
|
|
20
|
+
var SchemaBlueprint_js_1 = require("./core/schema/SchemaBlueprint.js");
|
|
21
|
+
Object.defineProperty(exports, "column", { enumerable: true, get: function () { return SchemaBlueprint_js_1.column; } });
|
|
22
|
+
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return SchemaBlueprint_js_1.validate; } });
|
|
23
|
+
Object.defineProperty(exports, "relation", { enumerable: true, get: function () { return SchemaBlueprint_js_1.relation; } });
|
|
24
|
+
Object.defineProperty(exports, "mixin", { enumerable: true, get: function () { return SchemaBlueprint_js_1.mixin; } });
|
|
25
|
+
Object.defineProperty(exports, "validateSchema", { enumerable: true, get: function () { return SchemaBlueprint_js_1.validateSchema; } });
|
|
26
|
+
var SchemaValidator_js_1 = require("./core/schema/SchemaValidator.js");
|
|
27
|
+
Object.defineProperty(exports, "SchemaValidator", { enumerable: true, get: function () { return SchemaValidator_js_1.SchemaValidator; } });
|
|
28
|
+
var SchemaBuilder_js_1 = require("./core/schema/SchemaBuilder.js");
|
|
29
|
+
Object.defineProperty(exports, "SchemaBuilder", { enumerable: true, get: function () { return SchemaBuilder_js_1.SchemaBuilder; } });
|
|
30
|
+
var CacheManager_js_1 = require("./core/cache/CacheManager.js");
|
|
31
|
+
Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return CacheManager_js_1.CacheManager; } });
|
|
32
|
+
var setupCache_js_1 = require("./core/cache/setupCache.js");
|
|
33
|
+
Object.defineProperty(exports, "setupCache", { enumerable: true, get: function () { return setupCache_js_1.setupCache; } });
|
|
34
|
+
var modelRegistration_js_1 = require("./core/orm/mixins/utils/modelRegistration.js");
|
|
35
|
+
Object.defineProperty(exports, "registerModels", { enumerable: true, get: function () { return modelRegistration_js_1.registerModels; } });
|
|
36
|
+
Object.defineProperty(exports, "isModelRegistered", { enumerable: true, get: function () { return modelRegistration_js_1.isModelRegistered; } });
|
|
37
|
+
Object.defineProperty(exports, "setModelRegistryStrictMode", { enumerable: true, get: function () { return modelRegistration_js_1.setModelRegistryStrictMode; } });
|
|
38
|
+
Object.defineProperty(exports, "isModelRegistryStrictMode", { enumerable: true, get: function () { return modelRegistration_js_1.isModelRegistryStrictMode; } });
|