minimonolith 0.25.4 → 0.25.5

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.
Files changed (45) hide show
  1. package/README.md +209 -209
  2. package/api/getNewAPI/handler.js +53 -53
  3. package/api/getSyncedHandler/handler.js +40 -40
  4. package/api/postModule/handler.js +31 -31
  5. package/api/services.js +15 -15
  6. package/autotest/getMethodTest/handler.js +14 -14
  7. package/autotest/getTestServerResponse/index.js +14 -14
  8. package/autotest/services.js +1 -1
  9. package/control/get/handler.js +8 -8
  10. package/control/services.js +1 -1
  11. package/database/post/handler.js +24 -24
  12. package/database/postConnection/handler.js +27 -27
  13. package/database/services.js +1 -1
  14. package/environment/getDBEnvVars/handler.js +6 -6
  15. package/environment/getENVEnvVars/handler.js +7 -7
  16. package/environment/postEnvFile/handler.js +20 -20
  17. package/environment/postTestEnvironment/index.js +6 -6
  18. package/environment/services.js +5 -5
  19. package/error/index.js +4 -4
  20. package/error/postCompiletime/index.js +13 -13
  21. package/error/postRuntime/index.js +7 -7
  22. package/health/post/handler.js +14 -14
  23. package/health/services.js +1 -1
  24. package/index.js +23 -23
  25. package/log/index.js +5 -5
  26. package/log/post/index.js +3 -3
  27. package/log/postError/index.js +3 -3
  28. package/log/postQA/index.js +3 -3
  29. package/model/getSynced/handler.js +28 -28
  30. package/model/post/handler.js +17 -17
  31. package/model/services.js +1 -1
  32. package/package.json +33 -33
  33. package/server/getNodejsServerHandler/index.js +70 -70
  34. package/server/getServerFactory/handler.js +17 -17
  35. package/server/services.js +1 -1
  36. package/service/getParsedCode/handler.js +22 -22
  37. package/service/getParsedEvent/handler.js +12 -12
  38. package/service/getResponseCode/handler.js +11 -11
  39. package/service/getRouteCode/handler.js +15 -15
  40. package/service/getType/handler.js +11 -11
  41. package/service/postResponse/index.js +13 -13
  42. package/service/postRoute/handler.js +82 -82
  43. package/service/services.js +9 -9
  44. package/setupTesting.js +19 -0
  45. package/yarn-error.log +0 -4104
package/api/services.js CHANGED
@@ -1,15 +1,15 @@
1
- export default [
2
- 'getNewAPI',
3
- 'getSyncedHandler',
4
- 'postModule',
5
- 'getService',
6
- 'getServices',
7
- 'getORM',
8
- 'getModels',
9
- 'getSchemas',
10
- 'postRoute',
11
- 'postRawModule',
12
- 'postSchema',
13
- 'postORM',
14
- 'postModel',
15
- ];
1
+ export default [
2
+ 'getNewAPI',
3
+ 'getSyncedHandler',
4
+ 'postModule',
5
+ 'getService',
6
+ 'getServices',
7
+ 'getORM',
8
+ 'getModels',
9
+ 'getSchemas',
10
+ 'postRoute',
11
+ 'postRawModule',
12
+ 'postSchema',
13
+ 'postORM',
14
+ 'postModel',
15
+ ];
@@ -1,14 +1,14 @@
1
- export default async ({ body }) => {
2
- const server = body;
3
-
4
- const fetch = (await import('cross-fetch')).default;
5
-
6
- return async ({ path, method, expectedCode, headers, body }) => {
7
-
8
- const port = server.address().port
9
- const url = `http://localhost:${port}${path}`;
10
-
11
- const response = await fetch(url, { method, headers, body });
12
- expect(response.status).toBe(expectedCode);
13
- };
14
- };
1
+ export default async ({ body }) => {
2
+ const server = body;
3
+
4
+ const fetch = (await import('cross-fetch')).default;
5
+
6
+ return async ({ path, method, expectedCode, headers, body }) => {
7
+
8
+ const port = server.address().port
9
+ const url = `http://localhost:${port}${path}`;
10
+
11
+ const response = await fetch(url, { method, headers, body });
12
+ expect(response.status).toBe(expectedCode);
13
+ };
14
+ };
@@ -1,14 +1,14 @@
1
- import http from 'http';
2
-
3
- export default () => {
4
- let resolveAsyncResult;
5
- const asyncResultPromise = new Promise(resolve => { resolveAsyncResult = resolve; });
6
-
7
- const res = {
8
- statusCode: null,
9
- asyncResult: () => asyncResultPromise,
10
- end: body => { res.body = body; resolveAsyncResult(res); },
11
- };
12
-
13
- return res;
14
- };
1
+ import http from 'http';
2
+
3
+ export default () => {
4
+ let resolveAsyncResult;
5
+ const asyncResultPromise = new Promise(resolve => { resolveAsyncResult = resolve; });
6
+
7
+ const res = {
8
+ statusCode: null,
9
+ asyncResult: () => asyncResultPromise,
10
+ end: body => { res.body = body; resolveAsyncResult(res); },
11
+ };
12
+
13
+ return res;
14
+ };
@@ -1 +1 @@
1
- export default ['getMethodTest'];
1
+ export default ['getMethodTest'];
@@ -1,8 +1,8 @@
1
- export default async ({ body }) => {
2
- const SERVICE_NAME = body.SERVICE_NAME;
3
- const MODULE_URL = body.MODULE_URL;
4
-
5
- const handler = (await import(new URL(`${SERVICE_NAME}/index.js`,
6
- MODULE_URL))).default;
7
- return handler;
8
- }
1
+ export default async ({ body }) => {
2
+ const SERVICE_NAME = body.SERVICE_NAME;
3
+ const MODULE_URL = body.MODULE_URL;
4
+
5
+ const handler = (await import(new URL(`${SERVICE_NAME}/index.js`,
6
+ MODULE_URL))).default;
7
+ return handler;
8
+ }
@@ -1 +1 @@
1
- export default ['get'];
1
+ export default ['get'];
@@ -1,24 +1,24 @@
1
- import Sequelize from 'sequelize';
2
- //import SequelizeDynamo from 'dynamo-sequelize';
3
-
4
- //import { LOG_SERVICE } from '@minimonolith/lib';
5
-
6
- export default async ({ body, SERVICES, ROUTE }) => {
7
- const dialect = body.dialect;
8
- const host = body.host;
9
- const port = body.port;
10
- const user = body.user;
11
- const pass = body.pass;
12
- const db = body.db;
13
- const storage = body.storage;
14
-
15
- const SEQUELIZE_OPTIONS = { dialect, host, port, storage, logging: false };
16
- console.log('SEQUELIZE_OPTIONS', SEQUELIZE_OPTIONS);
17
-
18
- //LOG_SERVICE.postQA({ ROUTE, DB_VARS: {
19
- // dialect, host, port, db, user, pass, storage }});
20
-
21
- const ORM = new Sequelize(db, user, pass, SEQUELIZE_OPTIONS);
22
- await SERVICES.api.postORM.handler({ ORM });
23
- await SERVICES.database.postConnection.handler({ ORM });
24
- };
1
+ import Sequelize from 'sequelize';
2
+ //import SequelizeDynamo from 'dynamo-sequelize';
3
+
4
+ //import { LOG_SERVICE } from '@minimonolith/lib';
5
+
6
+ export default async ({ body, SERVICES, ROUTE }) => {
7
+ const dialect = body.dialect;
8
+ const host = body.host;
9
+ const port = body.port;
10
+ const user = body.user;
11
+ const pass = body.pass;
12
+ const db = body.db;
13
+ const storage = body.storage;
14
+
15
+ const SEQUELIZE_OPTIONS = { dialect, host, port, storage, logging: false };
16
+ console.log('SEQUELIZE_OPTIONS', SEQUELIZE_OPTIONS);
17
+
18
+ //LOG_SERVICE.postQA({ ROUTE, DB_VARS: {
19
+ // dialect, host, port, db, user, pass, storage }});
20
+
21
+ const ORM = new Sequelize(db, user, pass, SEQUELIZE_OPTIONS);
22
+ await SERVICES.api.postORM.handler({ ORM });
23
+ await SERVICES.database.postConnection.handler({ ORM });
24
+ };
@@ -1,27 +1,27 @@
1
- //import { LOG_SERVICE } from '@minimonolith/lib';
2
-
3
- export default async ({ body, ROUTE_CODE }) => {
4
- const ORM = body.ORM;
5
-
6
- const MAX_RETRIES = 5, INITIAL_WAIT = 100;
7
- let connectionRetries = 0, waitTime = INITIAL_WAIT;
8
-
9
- while (connectionRetries < MAX_RETRIES) {
10
- try {
11
- //LOG_SERVICE.post({ ROUTE_CODE, AUTH_INTENT: connectionRetries });
12
- console.log({ ROUTE_CODE, AUTH_INTENT: connectionRetries });
13
- await ORM.authenticate();
14
- break;
15
-
16
- } catch (META_METHOD_ERROR) {
17
- await new Promise(resolve => setTimeout(resolve, waitTime));
18
-
19
- connectionRetries += 1;
20
- const jitter = Math.random() * 0.3 + 0.7;
21
- waitTime = Math.min(2 * waitTime * jitter,
22
- INITIAL_WAIT * Math.pow(2, MAX_RETRIES));
23
- }
24
- }
25
-
26
- return connectionRetries;
27
- };
1
+ //import { LOG_SERVICE } from '@minimonolith/lib';
2
+
3
+ export default async ({ body, ROUTE_CODE }) => {
4
+ const ORM = body.ORM;
5
+
6
+ const MAX_RETRIES = 5, INITIAL_WAIT = 100;
7
+ let connectionRetries = 0, waitTime = INITIAL_WAIT;
8
+
9
+ while (connectionRetries < MAX_RETRIES) {
10
+ try {
11
+ //LOG_SERVICE.post({ ROUTE_CODE, AUTH_INTENT: connectionRetries });
12
+ console.log({ ROUTE_CODE, AUTH_INTENT: connectionRetries });
13
+ await ORM.authenticate();
14
+ break;
15
+
16
+ } catch (META_METHOD_ERROR) {
17
+ await new Promise(resolve => setTimeout(resolve, waitTime));
18
+
19
+ connectionRetries += 1;
20
+ const jitter = Math.random() * 0.3 + 0.7;
21
+ waitTime = Math.min(2 * waitTime * jitter,
22
+ INITIAL_WAIT * Math.pow(2, MAX_RETRIES));
23
+ }
24
+ }
25
+
26
+ return connectionRetries;
27
+ };
@@ -1 +1 @@
1
- export default ['post', 'postConnection'];
1
+ export default ['post', 'postConnection'];
@@ -1,6 +1,6 @@
1
- export default envVars => {
2
- const DB_ENV_VARS = ['DB_DIALECT', 'DB_HOST', 'DB_PORT', 'DB_DB',
3
- 'DB_USER', 'DB_PASS', 'DB_STORAGE'];
4
- return Object.fromEntries(Object.entries(envVars).filter(
5
- ([envVar]) => DB_ENV_VARS.includes(envVar)));
6
- }
1
+ export default envVars => {
2
+ const DB_ENV_VARS = ['DB_DIALECT', 'DB_HOST', 'DB_PORT', 'DB_DB',
3
+ 'DB_USER', 'DB_PASS', 'DB_STORAGE'];
4
+ return Object.fromEntries(Object.entries(envVars).filter(
5
+ ([envVar]) => DB_ENV_VARS.includes(envVar)));
6
+ }
@@ -1,7 +1,7 @@
1
- export default ({ body }) => {
2
- const envVars = body.envVars;
3
-
4
- const API_ENV_VARS = ['DEV_ENV', 'PROD_ENV', 'TEST_ENV'];
5
- return Object.fromEntries(Object.entries(envVars).filter(
6
- ([envVar]) => API_ENV_VARS.includes(envVar)));
7
- }
1
+ export default ({ body }) => {
2
+ const envVars = body.envVars;
3
+
4
+ const API_ENV_VARS = ['DEV_ENV', 'PROD_ENV', 'TEST_ENV'];
5
+ return Object.fromEntries(Object.entries(envVars).filter(
6
+ ([envVar]) => API_ENV_VARS.includes(envVar)));
7
+ }
@@ -1,20 +1,20 @@
1
- import path from 'path';
2
- import url from 'url';
3
- import dotenv from 'dotenv';
4
-
5
- import { /*LOG_SERVICE,*/ PATH_MODULE } from '@minimonolith/lib';
6
-
7
- export default async ({ body }) => {
8
- const envFile = body.envFile;
9
- const modulesFolder = body.modulesFolder;
10
-
11
- const projectRootFileUrl = PATH_MODULE.getProjectRoot(
12
- import.meta.url, modulesFolder);
13
- console.log('meta url', import.meta.url);
14
- console.log('modulesFolder', modulesFolder);
15
- const projectRootPath = url.fileURLToPath(projectRootFileUrl + path.sep);
16
- console.log('projectRootPath', projectRootPath);
17
- const envFilePath = path.resolve(projectRootPath, envFile)
18
- console.log('envFilePath', envFilePath);
19
- dotenv.config({ path: envFilePath });
20
- };
1
+ import path from 'path';
2
+ import url from 'url';
3
+ import dotenv from 'dotenv';
4
+
5
+ import { /*LOG_SERVICE,*/ PATH_MODULE } from '@minimonolith/lib';
6
+
7
+ export default async ({ body }) => {
8
+ const envFile = body.envFile;
9
+ const modulesFolder = body.modulesFolder;
10
+
11
+ const projectRootFileUrl = PATH_MODULE.getProjectRoot(
12
+ import.meta.url, modulesFolder);
13
+ console.log('meta url', import.meta.url);
14
+ console.log('modulesFolder', modulesFolder);
15
+ const projectRootPath = url.fileURLToPath(projectRootFileUrl + path.sep);
16
+ console.log('projectRootPath', projectRootPath);
17
+ const envFilePath = path.resolve(projectRootPath, envFile)
18
+ console.log('envFilePath', envFilePath);
19
+ dotenv.config({ path: envFilePath });
20
+ };
@@ -1,6 +1,6 @@
1
- export default () => {
2
- process.env.DEV_ENV = 'TRUE';
3
- process.env.PROD_ENV = 'FALSE';
4
- process.env.DB_DIALECT = 'sqlite';
5
- process.env.DB_STORAGE = ':memory:';
6
- }
1
+ export default () => {
2
+ process.env.DEV_ENV = 'TRUE';
3
+ process.env.PROD_ENV = 'FALSE';
4
+ process.env.DB_DIALECT = 'sqlite';
5
+ process.env.DB_STORAGE = ':memory:';
6
+ }
@@ -1,5 +1,5 @@
1
- export default [
2
- //'getENVEnvVars',
3
- //'getDBEnvVars',
4
- 'postEnvFile'
5
- ];
1
+ export default [
2
+ //'getENVEnvVars',
3
+ //'getDBEnvVars',
4
+ 'postEnvFile'
5
+ ];
package/error/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import postCompiletime from './postCompiletime/index.js';
2
- import postRuntime from './postRuntime/index.js';
3
-
4
- export default { postCompiletime, postRuntime };
1
+ import postCompiletime from './postCompiletime/index.js';
2
+ import postRuntime from './postRuntime/index.js';
3
+
4
+ export default { postCompiletime, postRuntime };
@@ -1,13 +1,13 @@
1
- import API_SERVICE from '../../api/index.js';
2
- import LOG_SERVICE from '../../log/index.js';
3
-
4
- export default ({ META_SERVICE_NAME, META_METHOD_NAME, ROUTE_CODE, META_METHOD_ERROR }) => {
5
- LOG_SERVICE.postError({
6
- META_SERVICE_NAME,
7
- META_METHOD_NAME,
8
- ROUTE_CODE,
9
- META_METHOD_ERROR,
10
- STACK_TRACE: META_METHOD_ERROR?.stack,
11
- });
12
- if (API_SERVICE.get().DEV_ENV==='TRUE') throw META_METHOD_ERROR;
13
- };
1
+ import API_SERVICE from '../../api/index.js';
2
+ import LOG_SERVICE from '../../log/index.js';
3
+
4
+ export default ({ META_SERVICE_NAME, META_METHOD_NAME, ROUTE_CODE, META_METHOD_ERROR }) => {
5
+ LOG_SERVICE.postError({
6
+ META_SERVICE_NAME,
7
+ META_METHOD_NAME,
8
+ ROUTE_CODE,
9
+ META_METHOD_ERROR,
10
+ STACK_TRACE: META_METHOD_ERROR?.stack,
11
+ });
12
+ if (API_SERVICE.get().DEV_ENV==='TRUE') throw META_METHOD_ERROR;
13
+ };
@@ -1,7 +1,7 @@
1
- import LOG_SERVICE from '../../log/index.js';
2
-
3
- export default (res, ROUTE_CODE, METHOD_ERROR) => {
4
- const MESSAGE = { ROUTE_CODE, METHOD_ERROR: METHOD_ERROR.stack.toString() };
5
- LOG_SERVICE.postError(MESSAGE);
6
- res.status(500).json(MESSAGE);
7
- }
1
+ import LOG_SERVICE from '../../log/index.js';
2
+
3
+ export default (res, ROUTE_CODE, METHOD_ERROR) => {
4
+ const MESSAGE = { ROUTE_CODE, METHOD_ERROR: METHOD_ERROR.stack.toString() };
5
+ LOG_SERVICE.postError(MESSAGE);
6
+ res.status(500).json(MESSAGE);
7
+ }
@@ -1,14 +1,14 @@
1
- //import { LOG_SERVICE } from '@minimonolith/lib';
2
-
3
- export default async ({ SERVICES }) => {
4
- const method = 'get';
5
- const route = '/';
6
- const handler = async (req, res) => {
7
- const SERVICE_RESPONSE = "API_RUNNING";
8
- //LOG_SERVICE.post({ SERVICE_RESPONSE });
9
- console.log({ SERVICE_RESPONSE });
10
- return { SERVICE_RESPONSE: "API_RUNNING" };
11
- }
12
-
13
- await SERVICES.api.postRoute.handler({ method, route, handler })
14
- }
1
+ //import { LOG_SERVICE } from '@minimonolith/lib';
2
+
3
+ export default async ({ SERVICES }) => {
4
+ const method = 'get';
5
+ const route = '/';
6
+ const handler = async (req, res) => {
7
+ const SERVICE_RESPONSE = "API_RUNNING";
8
+ //LOG_SERVICE.post({ SERVICE_RESPONSE });
9
+ console.log({ SERVICE_RESPONSE });
10
+ return { SERVICE_RESPONSE: "API_RUNNING" };
11
+ }
12
+
13
+ await SERVICES.api.postRoute.handler({ method, route, handler })
14
+ }
@@ -1 +1 @@
1
- export default ['post'];
1
+ export default ['post'];
package/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import path from 'path';
2
- import { getNewLib, z } from '@minimonolith/lib';
3
-
4
- import modules from './modules.js';
5
-
6
- //const LIB = await getNewLib({ DEBUG: 'TRUE' });
7
- const LIB = await getNewLib();
8
-
9
- await Promise.all(modules.map(module => LIB.postModule(
10
- module,
11
- //'minimonolith' + path.sep,
12
- //path.join('@minimonolith', 'lib') + path.sep
13
- )));
14
-
15
-
16
- const { SERVICES, COMPONENTS } = LIB;
17
- const zdb = COMPONENTS.zdb;
18
- const database = SERVICES.database;
19
- const getServerFactory = SERVICES.server.getServerFactory.handler;
20
- const autotest = SERVICES.autotest;
21
- const getNewAPI = SERVICES.api.getNewAPI.handler;
22
-
23
- export { z, zdb, database, getServerFactory, autotest, getNewAPI };
1
+ import path from 'path';
2
+ import { getNewLib, z } from '@minimonolith/lib';
3
+
4
+ import modules from './modules.js';
5
+
6
+ //const LIB = await getNewLib({ DEBUG: 'TRUE' });
7
+ const LIB = await getNewLib();
8
+
9
+ await Promise.all(modules.map(module => LIB.postModule(
10
+ module,
11
+ 'minimonolith' + path.sep,
12
+ path.join('@minimonolith', 'lib') + path.sep
13
+ )));
14
+
15
+
16
+ const { SERVICES, COMPONENTS } = LIB;
17
+ const zdb = COMPONENTS.zdb;
18
+ const database = SERVICES.database;
19
+ const getServerFactory = SERVICES.server.getServerFactory.handler;
20
+ const autotest = SERVICES.autotest;
21
+ const getNewAPI = SERVICES.api.getNewAPI.handler;
22
+
23
+ export { z, zdb, database, getServerFactory, autotest, getNewAPI };
package/log/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import post from './post/index.js';
2
- import postError from './postError/index.js';
3
- import postQA from './postQA/index.js';
4
-
5
- export default { post, postError, postQA };
1
+ import post from './post/index.js';
2
+ import postError from './postError/index.js';
3
+ import postQA from './postQA/index.js';
4
+
5
+ export default { post, postError, postQA };
package/log/post/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import API_SERVICE from '../../api/index.js';
2
-
3
- export default (...MESSAGE) => { console.log(...MESSAGE); };
1
+ import API_SERVICE from '../../api/index.js';
2
+
3
+ export default (...MESSAGE) => { console.log(...MESSAGE); };
@@ -1,3 +1,3 @@
1
- import API_SERVICE from '../../api/index.js';
2
-
3
- export default (...ERROR) => { console.error(...ERROR); };
1
+ import API_SERVICE from '../../api/index.js';
2
+
3
+ export default (...ERROR) => { console.error(...ERROR); };
@@ -1,3 +1,3 @@
1
- import API_SERVICE from '../../api/index.js';
2
-
3
- export default (...MESSAGE) => { if (API_SERVICE.get().PROD_ENV==='FALSE') { console.log(...MESSAGE); } };
1
+ import API_SERVICE from '../../api/index.js';
2
+
3
+ export default (...MESSAGE) => { if (API_SERVICE.get().PROD_ENV==='FALSE') { console.log(...MESSAGE); } };
@@ -1,28 +1,28 @@
1
- import { DataTypes } from 'sequelize';
2
-
3
- //import { LOG_SERVICE } from '@minimonolith/lib';
4
-
5
- export default async ({ ROUTE_CODE, SERVICES }) => {
6
- const SCHEMAS = await SERVICES.api.getSchemas.handler();
7
- const ORM = await SERVICES.api.getORM.handler();
8
-
9
- //for (const moduleName of SCHEMAS) {
10
- for (const moduleName of Object.keys(SCHEMAS)) {
11
- //LOG_SERVICE.post({ ROUTE_CODE, LOADING: moduleName });
12
-
13
- const model = SCHEMAS[moduleName](ORM, DataTypes);
14
- await SERVICES.api.postModel.handler({ moduleName, model });
15
- }
16
-
17
- const MODELS = await SERVICES.api.getModels.handler();
18
-
19
- for (const [moduleName, MODEL] of Object.entries(MODELS)) {
20
- //LOG_SERVICE.post({ ROUTE_CODE, ASSOCIATING: moduleName });
21
- MODEL.associate(MODELS);
22
- }
23
-
24
- //LOG_SERVICE.post({ ROUTE_CODE, SYNCING_ORM: 'WAITING_ORM_SYNCING' });
25
- await ORM.sync({ alter: process.env.DEV_ENV==='TRUE' ? true : false });
26
-
27
- //LOG_SERVICE.post({ ROUTE_CODE, SYNCING_ORM: 'DONE_ORM_SYNCING' });
28
- };
1
+ import { DataTypes } from 'sequelize';
2
+
3
+ //import { LOG_SERVICE } from '@minimonolith/lib';
4
+
5
+ export default async ({ ROUTE_CODE, SERVICES }) => {
6
+ const SCHEMAS = await SERVICES.api.getSchemas.handler();
7
+ const ORM = await SERVICES.api.getORM.handler();
8
+
9
+ //for (const moduleName of SCHEMAS) {
10
+ for (const moduleName of Object.keys(SCHEMAS)) {
11
+ //LOG_SERVICE.post({ ROUTE_CODE, LOADING: moduleName });
12
+
13
+ const model = SCHEMAS[moduleName](ORM, DataTypes);
14
+ await SERVICES.api.postModel.handler({ moduleName, model });
15
+ }
16
+
17
+ const MODELS = await SERVICES.api.getModels.handler();
18
+
19
+ for (const [moduleName, MODEL] of Object.entries(MODELS)) {
20
+ //LOG_SERVICE.post({ ROUTE_CODE, ASSOCIATING: moduleName });
21
+ MODEL.associate(MODELS);
22
+ }
23
+
24
+ //LOG_SERVICE.post({ ROUTE_CODE, SYNCING_ORM: 'WAITING_ORM_SYNCING' });
25
+ await ORM.sync({ alter: process.env.DEV_ENV==='TRUE' ? true : false });
26
+
27
+ //LOG_SERVICE.post({ ROUTE_CODE, SYNCING_ORM: 'DONE_ORM_SYNCING' });
28
+ };
@@ -1,17 +1,17 @@
1
- import fs from 'fs';
2
- import url from 'url';
3
-
4
- //import { LOG_SERVICE } from '@minimonolith/lib';
5
-
6
- export default async ({ body, SERVICES }) => {
7
- const moduleName = body.moduleName;
8
- const moduleURL = body.moduleURL;
9
-
10
- console.log('moduleURL', moduleURL);
11
- if (!fs.existsSync(url.fileURLToPath(`${moduleURL}model.js`))) return;
12
- //LOG_SERVICE.post({ messages: [' FOUND_MODEL'] })
13
-
14
- const moduleSchema =
15
- (await import(`${moduleURL}model.js`)).default(moduleName);
16
- await SERVICES.api.postSchema.handler({ moduleName, moduleSchema });
17
- };
1
+ import fs from 'fs';
2
+ import url from 'url';
3
+
4
+ //import { LOG_SERVICE } from '@minimonolith/lib';
5
+
6
+ export default async ({ body, SERVICES }) => {
7
+ const moduleName = body.moduleName;
8
+ const moduleURL = body.moduleURL;
9
+
10
+ console.log('moduleURL', moduleURL);
11
+ if (!fs.existsSync(url.fileURLToPath(`${moduleURL}model.js`))) return;
12
+ //LOG_SERVICE.post({ messages: [' FOUND_MODEL'] })
13
+
14
+ const moduleSchema =
15
+ (await import(`${moduleURL}model.js`)).default(moduleName);
16
+ await SERVICES.api.postSchema.handler({ moduleName, moduleSchema });
17
+ };
package/model/services.js CHANGED
@@ -1 +1 @@
1
- export default ['getSynced', 'post'];
1
+ export default ['getSynced', 'post'];