masterrecord 0.3.52 → 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.
@@ -59,6 +59,11 @@ class EntityModel {
59
59
  return this;
60
60
  }
61
61
 
62
+ text(){
63
+ this.obj.type = "text";
64
+ return this;
65
+ }
66
+
62
67
  integer(){
63
68
  this.obj.type = "integer";
64
69
  return this;
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, fallback 'development'
667
- const envType = this.__environment || process.env.NODE_ENV || 'development';
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 || 'development';
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
- // Infer type when not provided
977
- if (typeof options.connection === 'string') {
978
- type = DB_TYPES.SQLITE;
979
- options.type = DB_TYPES.SQLITE;
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 || 'development';
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.52",
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": {