masterrecord 0.3.51 → 0.3.53
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/Entity/entityModel.js +5 -0
- package/QueryLanguage/queryMethods.js +2 -2
- package/context.js +24 -15
- package/package.json +1 -1
package/Entity/entityModel.js
CHANGED
|
@@ -448,11 +448,11 @@ class queryMethods{
|
|
|
448
448
|
}
|
|
449
449
|
else if(this.__context.isMySQL){
|
|
450
450
|
var entityValue = await this.__context._SQLEngine.get(this.__queryObject.script, this.__entity, this.__context);
|
|
451
|
-
result = this.__singleEntityBuilder(entityValue
|
|
451
|
+
result = this.__singleEntityBuilder(entityValue);
|
|
452
452
|
}
|
|
453
453
|
else if(this.__context.isPostgres){
|
|
454
454
|
var entityValue = await this.__context._SQLEngine.get(this.__queryObject.script, this.__entity, this.__context);
|
|
455
|
-
result = this.__singleEntityBuilder(entityValue
|
|
455
|
+
result = this.__singleEntityBuilder(entityValue);
|
|
456
456
|
}
|
|
457
457
|
else {
|
|
458
458
|
this.__reset();
|
package/context.js
CHANGED
|
@@ -663,8 +663,13 @@ class context {
|
|
|
663
663
|
*/
|
|
664
664
|
env(rootFolderLocationOrConfig) {
|
|
665
665
|
try {
|
|
666
|
-
// Determine environment: prefer explicit, then NODE_ENV
|
|
667
|
-
const envType = this.__environment || process.env.NODE_ENV
|
|
666
|
+
// Determine environment: prefer explicit 'master' env var, then NODE_ENV
|
|
667
|
+
const envType = this.__environment || process.env.NODE_ENV;
|
|
668
|
+
if (!envType) {
|
|
669
|
+
throw new ConfigurationError(
|
|
670
|
+
"No environment specified. Set the 'master' or 'NODE_ENV' environment variable (e.g., master=production or NODE_ENV=development)."
|
|
671
|
+
);
|
|
672
|
+
}
|
|
668
673
|
const contextName = this.__name;
|
|
669
674
|
|
|
670
675
|
// Try multiple base roots for robustness
|
|
@@ -897,7 +902,12 @@ class context {
|
|
|
897
902
|
this.isPostgres = false;
|
|
898
903
|
|
|
899
904
|
const root = process.cwd();
|
|
900
|
-
const envType = this.__environment ||
|
|
905
|
+
const envType = this.__environment || process.env.NODE_ENV;
|
|
906
|
+
if (!envType) {
|
|
907
|
+
throw new ConfigurationError(
|
|
908
|
+
"No environment specified. Set the 'master' or 'NODE_ENV' environment variable (e.g., master=production or NODE_ENV=development)."
|
|
909
|
+
);
|
|
910
|
+
}
|
|
901
911
|
const contextName = this.__name;
|
|
902
912
|
const file = this.__findSettings(root, rootFolderLocation, envType);
|
|
903
913
|
const settings = require(file.file);
|
|
@@ -970,19 +980,13 @@ class context {
|
|
|
970
980
|
throw new ConfigurationError('Configuration object is missing or invalid');
|
|
971
981
|
}
|
|
972
982
|
|
|
973
|
-
// Normalize type
|
|
983
|
+
// Normalize type — require explicit type, no silent inference
|
|
974
984
|
let type = (options.type || '').toString().toLowerCase();
|
|
975
985
|
if (!type) {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
} else if (options.host || options.user || options.database) {
|
|
981
|
-
type = DB_TYPES.MYSQL;
|
|
982
|
-
options.type = DB_TYPES.MYSQL;
|
|
983
|
-
} else {
|
|
984
|
-
throw new ConfigurationError('Cannot infer database type from configuration. Please specify type: "sqlite", "mysql", or "postgres".');
|
|
985
|
-
}
|
|
986
|
+
throw new ConfigurationError(
|
|
987
|
+
'Database type is required. Please specify type: "sqlite", "mysql", or "postgres" in your configuration.',
|
|
988
|
+
{ providedOptions: Object.keys(options) }
|
|
989
|
+
);
|
|
986
990
|
}
|
|
987
991
|
|
|
988
992
|
// SQLite validation
|
|
@@ -1061,7 +1065,12 @@ class context {
|
|
|
1061
1065
|
this.isSQLite = false;
|
|
1062
1066
|
this.isPostgres = false;
|
|
1063
1067
|
|
|
1064
|
-
const envType = this.__environment ||
|
|
1068
|
+
const envType = this.__environment || process.env.NODE_ENV;
|
|
1069
|
+
if (!envType) {
|
|
1070
|
+
throw new ConfigurationError(
|
|
1071
|
+
"No environment specified. Set the 'master' or 'NODE_ENV' environment variable (e.g., master=production or NODE_ENV=development)."
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1065
1074
|
const contextName = this.__name;
|
|
1066
1075
|
const root = appRoot.path;
|
|
1067
1076
|
const file = this.__findSettings(root, rootFolderLocation, envType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "masterrecord",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.53",
|
|
4
4
|
"description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
|
|
5
5
|
"main": "MasterRecord.js",
|
|
6
6
|
"bin": {
|