owservable 0.4.9 → 0.5.0

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/README.md CHANGED
@@ -48,14 +48,6 @@ This is a map of all defined Data Middleware methods.
48
48
  A Data Middleware is tied to a store scope ```'count' | 'one' | 'many'``` and collection name and is used to modify an observed payload if necessary. For example, if based on users
49
49
  access permissions a portion of the payload needs to be removed or replaced, etc.
50
50
 
51
- ### initiateWorkers
52
-
53
- Method that initiates all workers. Takes folder path as attribute.
54
-
55
- ### initiateCronjobs
56
-
57
- Method that initiates all cronjobs. Takes folder path as attribute.
58
-
59
51
  ## MongoDB
60
52
 
61
53
  ### MongoDBConnector
@@ -130,8 +122,6 @@ Store factory method, creates an appropriate AStore instance based on passed sub
130
122
 
131
123
  These types are self explanatory.
132
124
 
133
- - CronJobType
134
- - WorkerType
135
125
  - StoreScopeType
136
126
  - StoreSubscriptionConfigType
137
127
  - StoreSubscriptionUpdateType
@@ -1,14 +1,10 @@
1
1
  import OwservableClient from './owservable.client';
2
2
  import EStoreType from './_enums/store.type.enum';
3
3
  import ConnectionManagerRefreshType from './_types/connection.manager.refresh.type';
4
- import CronJobType from './_types/cronjob.type';
5
4
  import StoreScopeType from './_types/store.scope.type';
6
5
  import StoreSubscriptionConfigType from './_types/store.subscription.config.type';
7
6
  import StoreSubscriptionUpdateType from './_types/store.subscription.update.type';
8
- import WorkerType from './_types/worker.type';
9
7
  import IConnectionManager from './auth/i.connection.manager';
10
- import initiateWorkers from './functions/initiate.workers';
11
- import initiateCronjobs from './functions/initiate.cronjobs';
12
8
  import DataMiddlewareMap from './middleware/data.middleware.map';
13
9
  import MongoDBConnector from './mongodb/mongodb.connector';
14
10
  import CollectionsModelsMap from './mongodb/collections.models.map';
@@ -24,6 +20,6 @@ import CountStore from './store/count.store';
24
20
  import DocumentStore from './store/document.store';
25
21
  import CollectionStore from './store/collection.store';
26
22
  import storeFactory from './store/factories/store.factory';
27
- export { OwservableClient, EStoreType, ConnectionManagerRefreshType, CronJobType, StoreScopeType, StoreSubscriptionConfigType, StoreSubscriptionUpdateType, WorkerType, IConnectionManager, initiateWorkers, initiateCronjobs, DataMiddlewareMap, MongoDBConnector, CollectionsModelsMap, processModels, observableModel, observableDatabase, RoutesMap, addFastifyRoutes, cleanRelativePath, processFastifyBlipp, AStore, CountStore, DocumentStore, CollectionStore, storeFactory };
23
+ export { OwservableClient, EStoreType, ConnectionManagerRefreshType, StoreScopeType, StoreSubscriptionConfigType, StoreSubscriptionUpdateType, IConnectionManager, DataMiddlewareMap, MongoDBConnector, CollectionsModelsMap, processModels, observableModel, observableDatabase, RoutesMap, addFastifyRoutes, cleanRelativePath, processFastifyBlipp, AStore, CountStore, DocumentStore, CollectionStore, storeFactory };
28
24
  declare const Owservable: {};
29
25
  export default Owservable;
package/lib/owservable.js CHANGED
@@ -1,14 +1,10 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeFactory = exports.CollectionStore = exports.DocumentStore = exports.CountStore = exports.AStore = exports.processFastifyBlipp = exports.cleanRelativePath = exports.addFastifyRoutes = exports.RoutesMap = exports.observableDatabase = exports.observableModel = exports.processModels = exports.CollectionsModelsMap = exports.MongoDBConnector = exports.DataMiddlewareMap = exports.initiateCronjobs = exports.initiateWorkers = exports.EStoreType = exports.OwservableClient = void 0;
3
+ exports.storeFactory = exports.CollectionStore = exports.DocumentStore = exports.CountStore = exports.AStore = exports.processFastifyBlipp = exports.cleanRelativePath = exports.addFastifyRoutes = exports.RoutesMap = exports.observableDatabase = exports.observableModel = exports.processModels = exports.CollectionsModelsMap = exports.MongoDBConnector = exports.DataMiddlewareMap = exports.EStoreType = exports.OwservableClient = void 0;
4
4
  const owservable_client_1 = require("./owservable.client");
5
5
  exports.OwservableClient = owservable_client_1.default;
6
6
  const store_type_enum_1 = require("./_enums/store.type.enum");
7
7
  exports.EStoreType = store_type_enum_1.default;
8
- const initiate_workers_1 = require("./functions/initiate.workers");
9
- exports.initiateWorkers = initiate_workers_1.default;
10
- const initiate_cronjobs_1 = require("./functions/initiate.cronjobs");
11
- exports.initiateCronjobs = initiate_cronjobs_1.default;
12
8
  const data_middleware_map_1 = require("./middleware/data.middleware.map");
13
9
  exports.DataMiddlewareMap = data_middleware_map_1.default;
14
10
  const mongodb_connector_1 = require("./mongodb/mongodb.connector");
@@ -1 +1 @@
1
- {"version":3,"file":"owservable.js","sourceRoot":"","sources":["../src/owservable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,2DAAmD;AAkDlD,2BAlDM,2BAAgB,CAkDN;AA/CjB,8DAAkD;AAiDjD,qBAjDM,yBAAU,CAiDN;AAnCX,mEAA2D;AA8C1D,0BA9CM,0BAAe,CA8CN;AA7ChB,qEAA6D;AA8C5D,2BA9CM,2BAAgB,CA8CN;AA3CjB,0EAAiE;AA6ChE,4BA7CM,6BAAiB,CA6CN;AA1ClB,mEAA2D;AA4C1D,2BA5CM,2BAAgB,CA4CN;AA3CjB,6EAAoE;AA4CnE,+BA5CM,gCAAoB,CA4CN;AAzCrB,uEAA+D;AA2C9D,wBA3CM,wBAAa,CA2CN;AA1Cd,2EAAmE;AA2ClE,0BA3CM,0BAAe,CA2CN;AA1ChB,iFAAyE;AA2CxE,6BA3CM,6BAAkB,CA2CN;AAxCnB,qDAA6C;AA0C5C,oBA1CM,oBAAS,CA0CN;AAvCV,+EAAsE;AAyCrE,2BAzCM,4BAAgB,CAyCN;AAxCjB,iFAAwE;AAyCvE,4BAzCM,6BAAiB,CAyCN;AAxClB,qFAA4E;AAyC3E,8BAzCM,+BAAmB,CAyCN;AAtCpB,6CAAqC;AAwCpC,iBAxCM,iBAAM,CAwCN;AAvCP,qDAA6C;AAwC5C,qBAxCM,qBAAU,CAwCN;AAvCX,2DAAmD;AAwClD,wBAxCM,wBAAa,CAwCN;AAvCd,+DAAuD;AAwCtD,0BAxCM,0BAAe,CAwCN;AArChB,mEAA2D;AAuC1D,uBAvCM,uBAAY,CAuCN;AAGb,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,kBAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"owservable.js","sourceRoot":"","sources":["../src/owservable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,2DAAmD;AA4ClD,2BA5CM,2BAAgB,CA4CN;AAzCjB,8DAAkD;AA2CjD,qBA3CM,yBAAU,CA2CN;AA/BX,0EAAiE;AAwChE,4BAxCM,6BAAiB,CAwCN;AArClB,mEAA2D;AAuC1D,2BAvCM,2BAAgB,CAuCN;AAtCjB,6EAAoE;AAuCnE,+BAvCM,gCAAoB,CAuCN;AApCrB,uEAA+D;AAsC9D,wBAtCM,wBAAa,CAsCN;AArCd,2EAAmE;AAsClE,0BAtCM,0BAAe,CAsCN;AArChB,iFAAyE;AAsCxE,6BAtCM,6BAAkB,CAsCN;AAnCnB,qDAA6C;AAqC5C,oBArCM,oBAAS,CAqCN;AAlCV,+EAAsE;AAoCrE,2BApCM,4BAAgB,CAoCN;AAnCjB,iFAAwE;AAoCvE,4BApCM,6BAAiB,CAoCN;AAnClB,qFAA4E;AAoC3E,8BApCM,+BAAmB,CAoCN;AAjCpB,6CAAqC;AAmCpC,iBAnCM,iBAAM,CAmCN;AAlCP,qDAA6C;AAmC5C,qBAnCM,qBAAU,CAmCN;AAlCX,2DAAmD;AAmClD,wBAnCM,wBAAa,CAmCN;AAlCd,+DAAuD;AAmCtD,0BAnCM,0BAAe,CAmCN;AAhChB,mEAA2D;AAkC1D,uBAlCM,uBAAY,CAkCN;AAGb,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,kBAAe,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owservable",
3
- "version": "0.4.9",
3
+ "version": "0.5.0",
4
4
  "description": "owservable fastify backend",
5
5
  "engines": {
6
6
  "node": ">=14"
@@ -1,7 +0,0 @@
1
- declare type CronJobType = {
2
- schedule: string;
3
- job: () => void;
4
- options?: any;
5
- init?: () => Promise<void>;
6
- };
7
- export default CronJobType;
@@ -1,3 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=cronjob.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cronjob.type.js","sourceRoot":"","sources":["../../src/_types/cronjob.type.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC"}
@@ -1,5 +0,0 @@
1
- declare type WorkerType = {
2
- init?: () => Promise<void>;
3
- work: () => void;
4
- };
5
- export default WorkerType;
@@ -1,3 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=worker.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker.type.js","sourceRoot":"","sources":["../../src/_types/worker.type.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC"}
@@ -1,2 +0,0 @@
1
- declare const initiateCronjobs: (folder: string) => void;
2
- export default initiateCronjobs;
@@ -1,23 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs");
4
- const path = require("path");
5
- const lodash_1 = require("lodash");
6
- const cron = require("node-cron");
7
- const initiateCronjobs = (folder) => {
8
- const fileNames = fs.readdirSync(folder);
9
- const files = (0, lodash_1.filter)(fileNames, (name) => !fs.lstatSync(path.join(folder, name)).isDirectory());
10
- files.forEach((file) => {
11
- const absoluteFilePath = path.join(folder, file);
12
- const cronjob = require(absoluteFilePath).default;
13
- const { schedule, job, options, init } = cronjob;
14
- if ((0, lodash_1.isFunction)(init))
15
- init().then(() => cron.schedule(schedule, job, options));
16
- else
17
- cron.schedule(schedule, job, options);
18
- });
19
- const folders = (0, lodash_1.filter)(fileNames, (name) => fs.lstatSync(path.join(folder, name)).isDirectory());
20
- folders.forEach((sub) => initiateCronjobs(path.join(folder, sub)));
21
- };
22
- exports.default = initiateCronjobs;
23
- //# sourceMappingURL=initiate.cronjobs.js.map
@@ -1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W,EAAE,CAAC,CAAC;IACzG,OAAO,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC;AACF,kBAAe,gBAAgB,CAAC"}
@@ -1,2 +0,0 @@
1
- declare const initiateWorkers: (folder: string) => void;
2
- export default initiateWorkers;
@@ -1,22 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs");
4
- const path = require("path");
5
- const lodash_1 = require("lodash");
6
- const initiateWorkers = (folder) => {
7
- const fileNames = fs.readdirSync(folder);
8
- const files = (0, lodash_1.filter)(fileNames, (name) => !fs.lstatSync(path.join(folder, name)).isDirectory());
9
- files.forEach((file) => {
10
- const absoluteFilePath = path.join(folder, file);
11
- const worker = require(absoluteFilePath).default;
12
- const { init, work } = worker;
13
- if ((0, lodash_1.isFunction)(init))
14
- init().then(() => work === null || work === void 0 ? void 0 : work());
15
- else
16
- work === null || work === void 0 ? void 0 : work();
17
- });
18
- const folders = (0, lodash_1.filter)(fileNames, (name) => fs.lstatSync(path.join(folder, name)).isDirectory());
19
- folders.forEach((sub) => initiateWorkers(path.join(folder, sub)));
20
- };
21
- exports.default = initiateWorkers;
22
- //# sourceMappingURL=initiate.workers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initiate.workers.js","sourceRoot":"","sources":["../../src/functions/initiate.workers.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAE7B,mCAA0C;AAI1C,MAAM,eAAe,GAAG,CAAC,MAAc,EAAQ,EAAE;IAChD,MAAM,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAA,eAAM,EAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC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