ismx-nexo-node-app 0.4.83 → 0.4.84

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.
@@ -154,16 +154,19 @@ class BusinessServer extends Business_1.default {
154
154
  }
155
155
  });
156
156
  }
157
- load(path) {
157
+ load(parent, path) {
158
158
  return __awaiter(this, void 0, void 0, function* () {
159
159
  const { readdir } = yield Promise.resolve().then(() => __importStar(require('fs/promises')));
160
160
  const pathModule = yield Promise.resolve().then(() => __importStar(require('path')));
161
161
  const { fileURLToPath } = yield Promise.resolve().then(() => __importStar(require('url')));
162
- const files = yield readdir(path);
162
+ // @ts-ignore
163
+ const __dirname = pathModule.dirname(fileURLToPath(parent));
164
+ const servicesPath = pathModule.join(__dirname, path);
165
+ const files = yield readdir(servicesPath);
163
166
  for (const file of files) {
164
167
  if (!file.endsWith('.ts') && !file.endsWith('.js'))
165
168
  continue;
166
- const modulePath = pathModule.join(path, file);
169
+ const modulePath = pathModule.join(servicesPath, file);
167
170
  const mod = yield Promise.resolve(`${modulePath}`).then(s => __importStar(require(s)));
168
171
  const ServiceClass = Object.values(mod)[0];
169
172
  // @ts-ignore
@@ -20,5 +20,5 @@ export default class BusinessServer extends Business {
20
20
  setOnEnd(listener: (request: HttpRequest, response: HttpResponse) => any): void;
21
21
  private publish;
22
22
  private run;
23
- load(path: string): Promise<void>;
23
+ load(parent: string, path: string): Promise<void>;
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.83",
3
+ "version": "0.4.84",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -116,16 +116,20 @@ export default class BusinessServer extends Business
116
116
  }
117
117
  }}
118
118
 
119
- public async load(path: string): Promise<void>
119
+ public async load(parent: string, path: string): Promise<void>
120
120
  {
121
121
  const { readdir } = await import('fs/promises');
122
122
  const pathModule = await import('path');
123
123
  const { fileURLToPath } = await import('url');
124
124
 
125
- const files = await readdir(path);
125
+ // @ts-ignore
126
+ const __dirname = pathModule.dirname(fileURLToPath(parent));
127
+ const servicesPath = pathModule.join(__dirname, path);
128
+
129
+ const files = await readdir(servicesPath);
126
130
  for (const file of files) {
127
131
  if (!file.endsWith('.ts') && !file.endsWith('.js')) continue;
128
- const modulePath = pathModule.join(path, file);
132
+ const modulePath = pathModule.join(servicesPath, file);
129
133
  const mod = await import(modulePath);
130
134
  const ServiceClass = Object.values(mod)[0];
131
135
  // @ts-ignore