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 +1 -1
- package/src/cli.js +10 -14
- package/src/config/config-loader.js +1 -1
- package/src/index.js +1 -1
package/package.json
CHANGED
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
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|