@ccci/micro-server 0.0.19 → 0.0.21
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/dist/index.d.ts +1 -0
- package/dist/index.js +22 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { ConstructQuery, ResponseHelper, ErrorResponseHandler, } from './utils/B
|
|
|
7
7
|
export { default as BaseModel } from './utils/BaseModel';
|
|
8
8
|
export { default as BaseModelClass } from './utils/BaseModelClass';
|
|
9
9
|
export { default as DatabaseConnector } from './utils/DatabaseConnector';
|
|
10
|
+
export { PublicAccess, PrivateAccess, endpoint } from './decorators/Endpoints';
|
package/dist/index.js
CHANGED
|
@@ -78109,14 +78109,13 @@ class DatabaseConnector {
|
|
|
78109
78109
|
static rootDir;
|
|
78110
78110
|
constructor(path) {
|
|
78111
78111
|
DatabaseConnector.rootDir = path;
|
|
78112
|
-
console.log("DatabaseConnector.rootDir :>> ", DatabaseConnector.rootDir);
|
|
78113
78112
|
}
|
|
78114
78113
|
static async init() {
|
|
78115
78114
|
DatabaseConnector.connections = [];
|
|
78116
78115
|
let connections = [];
|
|
78117
78116
|
const configPath = `${DatabaseConnector.rootDir}/config/config.json`;
|
|
78118
|
-
const configFile =
|
|
78119
|
-
const configs = await
|
|
78117
|
+
const configFile = fs.readFileSync(configPath, "utf8");
|
|
78118
|
+
const configs = await JSON.parse(configFile);
|
|
78120
78119
|
const config = configs[env];
|
|
78121
78120
|
const connection = new Sequelize(config);
|
|
78122
78121
|
DatabaseConnector.connection = connection;
|
|
@@ -78700,9 +78699,29 @@ class BaseModelClass extends Model {
|
|
|
78700
78699
|
static getCommonAssociations() {
|
|
78701
78700
|
}
|
|
78702
78701
|
}
|
|
78702
|
+
// src/decorators/Endpoints.ts
|
|
78703
|
+
var endpoint = (target, methodName, descriptor) => {
|
|
78704
|
+
console.log("Method decorator!");
|
|
78705
|
+
console.log(target);
|
|
78706
|
+
console.log(methodName);
|
|
78707
|
+
console.log(descriptor);
|
|
78708
|
+
};
|
|
78709
|
+
var PublicAccess = (constructor) => {
|
|
78710
|
+
return class extends constructor {
|
|
78711
|
+
grantPublicAccess = true;
|
|
78712
|
+
};
|
|
78713
|
+
};
|
|
78714
|
+
var PrivateAccess = (constructor) => {
|
|
78715
|
+
return class extends constructor {
|
|
78716
|
+
grantPublicAccess = false;
|
|
78717
|
+
};
|
|
78718
|
+
};
|
|
78703
78719
|
export {
|
|
78720
|
+
endpoint,
|
|
78704
78721
|
RouterFactory,
|
|
78705
78722
|
ResponseHelper,
|
|
78723
|
+
PublicAccess,
|
|
78724
|
+
PrivateAccess,
|
|
78706
78725
|
ErrorResponseHandler,
|
|
78707
78726
|
DatabaseConnector,
|
|
78708
78727
|
ConstructQuery,
|