@superhero/http-server-using-oas 4.7.12 → 4.7.14

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,3 +1,15 @@
1
+ ---
2
+ #### v4.7.14
3
+ ---
4
+
5
+ Bugfixed reference error.
6
+
7
+ ---
8
+ #### v4.7.13
9
+ ---
10
+
11
+ Added support for a bootstrap process that builds routes automatically if an or field is defined
12
+
1
13
  ---
2
14
  #### v4.7.12
3
15
  ---
package/config.json CHANGED
@@ -14,6 +14,11 @@
14
14
  "@superhero/http-server"
15
15
  ]
16
16
  },
17
+ "@superhero/http-server-using-oas/oas-to-routes":
18
+ {
19
+ "path": "./oas-to-routes.js",
20
+ "uses": [ "@superhero/http-server-using-oas" ]
21
+ },
17
22
  "@superhero/http-server-using-oas/dispatcher/options":
18
23
  {
19
24
  "path": "./dispatcher/options.js",
@@ -0,0 +1,29 @@
1
+ export function locate(locator)
2
+ {
3
+ const router = locator.locate('@superhero/http-server-using-oas')
4
+ return new OasToRoutes(router)
5
+ }
6
+
7
+ export default class OasToRoutes
8
+ {
9
+ constructor(router)
10
+ {
11
+ this.router = router
12
+ }
13
+
14
+ bootstrap()
15
+ {
16
+ for(const [ path, operations ] of Object.entries(this.oas.specification.paths))
17
+ {
18
+ for(const [ method, operation ] of Object.entries(operations))
19
+ {
20
+ const dispatcher = operation['operationId'] ?? operation['x-dispatcher']
21
+
22
+ if('string' === typeof dispatcher)
23
+ {
24
+ this.router.setOasRoute(path, method, dispatcher, operation['x-middlewares'] ?? [])
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/http-server-using-oas",
3
- "version": "4.7.12",
3
+ "version": "4.7.14",
4
4
  "description": "Integrates the HTTP server and OAS (OpenAPI Specification) @superhero components",
5
5
  "keywords": [
6
6
  "HTTP 2.0",
@@ -14,6 +14,7 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": "./index.js",
17
+ "./oas-to-routes": "./oas-to-routes.js",
17
18
  "./dispatcher/*": "./dispatcher/*.js",
18
19
  "./dispatcher/downstream/*": "./dispatcher/downstream/*.js",
19
20
  "./dispatcher/upstream/*": "./dispatcher/upstream/*.js"
@@ -23,14 +24,14 @@
23
24
  "test": "syntax-check; node --test --test-reporter=@superhero/audit/reporter --experimental-test-coverage"
24
25
  },
25
26
  "dependencies": {
26
- "@superhero/oas": "4.7.12",
27
- "@superhero/http-server": "4.7.12"
27
+ "@superhero/oas": "4.7.14",
28
+ "@superhero/http-server": "4.7.14"
28
29
  },
29
30
  "devDependencies": {
30
- "@superhero/audit": "4.7.12",
31
+ "@superhero/audit": "4.7.14",
31
32
  "@superhero/syntax-check": "0.0.2",
32
- "@superhero/http-request": "4.7.12",
33
- "@superhero/core": "4.7.12"
33
+ "@superhero/http-request": "4.7.14",
34
+ "@superhero/core": "4.7.14"
34
35
  },
35
36
  "author": {
36
37
  "name": "Erik Landvall",