thatcher 1.0.46 → 1.0.47

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thatcher",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "A config-driven application framework for building data-intensive web apps without code.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/cli.js CHANGED
@@ -100,20 +100,16 @@ async function startRepl() {
100
100
  const thatcher = new Thatcher({});
101
101
  await thatcher.init();
102
102
 
103
- // Expose thatcher in REPL context
104
- const context = {
105
- thatcher,
106
- create: async (entity, data, user) => thatcher.create(entity, data, user),
107
- get: async (entity, id) => thatcher.get(entity, id),
108
- list: async (entity, where) => thatcher.list(entity, where),
109
- update: async (entity, id, data, user) => thatcher.update(entity, id, data, user),
110
- remove: async (entity, id) => thatcher.delete(entity, id),
111
- search: async (entity, q, where) => thatcher.search(entity, q, where),
112
- transition: async (entityType, entityId, wf, toState, user, reason) =>
113
- thatcher.transition(entityType, entityId, wf, toState, user, reason),
114
- config: thatcher.config,
115
- entities: thatcher.getAllEntities(),
116
- };
103
+ const create = async (entity, data, user) => thatcher.create(entity, data, user);
104
+ const get = async (entity, id) => thatcher.get(entity, id);
105
+ const list = async (entity, where) => thatcher.list(entity, where);
106
+ const update = async (entity, id, data, user) => thatcher.update(entity, id, data, user);
107
+ const remove = async (entity, id) => thatcher.delete(entity, id);
108
+ const search = async (entity, q, where) => thatcher.search(entity, q, where);
109
+ const transition = async (entityType, entityId, wf, toState, user, reason) =>
110
+ thatcher.transition(entityType, entityId, wf, toState, user, reason);
111
+ const config = thatcher.config;
112
+ const entities = thatcher.getAllEntities();
117
113
 
118
114
  rl.prompt();
119
115
 
@@ -14,7 +14,7 @@ export async function loadConfig(configSource) {
14
14
  }
15
15
  const content = fs.readFileSync(configPath, 'utf-8');
16
16
  config = yamlLoad(content);
17
- } else if (typeof configSource === 'object') {
17
+ } else if (typeof configSource === 'object' && configSource !== null) {
18
18
  config = configSource;
19
19
  } else {
20
20
  throw new Error('Config must be a file path or object');
package/src/index.js CHANGED
@@ -84,7 +84,7 @@ export class Thatcher {
84
84
  const content = fs.readFileSync(configPath, 'utf-8');
85
85
  const { load: yamlLoad } = await import('js-yaml');
86
86
  masterConfig = yamlLoad(content);
87
- } else if (typeof config === 'object') {
87
+ } else if (typeof config === 'object' && config !== null) {
88
88
  masterConfig = config;
89
89
  } else {
90
90
  // Auto-discover