axe-api 0.30.0 → 0.30.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release Notes
2
2
 
3
+ ## [0.30.2 (2023-04-18)](https://github.com/axe-api/axe-api/compare/0.30.2...0.30.1)
4
+
5
+ ### Features
6
+
7
+ - Event/Hook type warning added [#163](https://github.com/axe-api/axe-api/issues/163)
8
+
9
+ ## [0.30.1 (2023-04-15)](https://github.com/axe-api/axe-api/compare/0.30.1...0.30.0)
10
+
11
+ ### Fixed
12
+
13
+ - Fixed URL slash character difference between windows and *nix [#164](https://github.com/axe-api/axe-api/issues/164)
14
+
3
15
  ## [0.30.0 (2023-04-05)](https://github.com/axe-api/axe-api/compare/0.30.0...0.22.0)
4
16
 
5
17
  ### Breaking Changes
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const pluralize_1 = __importDefault(require("pluralize"));
16
- const path_1 = __importDefault(require("path"));
17
16
  const change_case_1 = require("change-case");
18
17
  const Resolvers_1 = require("../Resolvers");
19
18
  const constants_1 = require("../constants");
@@ -78,7 +77,7 @@ class RouterBuilder {
78
77
  continue;
79
78
  }
80
79
  const urlCreator = constants_1.API_ROUTE_TEMPLATES[handlerType];
81
- const url = urlCreator(path_1.default.join(yield this.getRootPrefix(), this.version.name), urlPrefix, resource, model.instance.primaryKey);
80
+ const url = urlCreator(`${yield this.getRootPrefix()}/${this.version.name}`, urlPrefix, resource, model.instance.primaryKey);
82
81
  // Creating the middleware list for the route. As default, we support some
83
82
  // internal middlewares such as `Accept Language Middleware` which parse
84
83
  // the "accept-language" header to use in the application general.
@@ -88,6 +88,7 @@ class ModelResolver {
88
88
  }
89
89
  setModelHooks(modelList, hookType) {
90
90
  return __awaiter(this, void 0, void 0, function* () {
91
+ const logger = Services_1.LogService.getInstance();
91
92
  // What kind of hooks that we can have
92
93
  const hookList = Object.keys(Enums_1.HookFunctionTypes);
93
94
  const fileResolver = new FileResolver_1.default();
@@ -111,12 +112,15 @@ class ModelResolver {
111
112
  }
112
113
  // Loading all hooks files in the subfolder
113
114
  const hooks = yield fileResolver.resolveContent(subfolderPath);
114
- for (const hookName of hookList) {
115
+ for (const hookName in hooks) {
115
116
  // If we have an acceptable hook
116
- if (hooks[hookName]) {
117
+ if (hookList.includes(hookName)) {
117
118
  // We bind the hook with the model
118
119
  currentModel.setExtensions(hookType, hookName, hooks[hookName].default);
119
120
  }
121
+ else {
122
+ logger.warn(`Invalid ${hookType} type: "${hookName}" in this folder: "${subfolderPath}"`);
123
+ }
120
124
  }
121
125
  }
122
126
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axe-api",
3
- "version": "0.30.0",
3
+ "version": "0.30.2",
4
4
  "description": "AXE API is a simple tool which has been created based on Express and Knex.js to create Rest APIs quickly.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",