@onlineapps/conn-orch-api-mapper 1.0.25 → 1.0.27
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/API.md +3 -3
- package/package.json +2 -2
- package/src/ApiMapper.js +6 -3
- package/src/index.js +1 -1
package/API.md
CHANGED
|
@@ -67,7 +67,7 @@ Create API mapper instance
|
|
|
67
67
|
```js
|
|
68
68
|
const apiMapper = create({
|
|
69
69
|
openApiSpec: require('./openapi.json'),
|
|
70
|
-
serviceUrl: 'http://
|
|
70
|
+
serviceUrl: 'http://127.0.0.1:3000'
|
|
71
71
|
});
|
|
72
72
|
```
|
|
73
73
|
<a name="ApiMapper"></a>
|
|
@@ -98,7 +98,7 @@ Create a new ApiMapper instance
|
|
|
98
98
|
| --- | --- | --- | --- |
|
|
99
99
|
| config | <code>Object</code> | | Configuration object |
|
|
100
100
|
| config.openApiSpec | <code>Object</code> \| <code>string</code> | | OpenAPI specification object or path |
|
|
101
|
-
|
|
|
101
|
+
| config.serviceUrl | <code>string</code> | | Base URL of the service (required; no defaults) |
|
|
102
102
|
| [config.service] | <code>Object</code> | | Express app instance for direct calls |
|
|
103
103
|
| [config.directCall] | <code>boolean</code> | <code>false</code> | Use direct Express calls instead of HTTP |
|
|
104
104
|
| [config.logger] | <code>Object</code> | | Logger instance |
|
|
@@ -139,7 +139,7 @@ Create a new ApiMapper instance
|
|
|
139
139
|
| --- | --- | --- | --- |
|
|
140
140
|
| config | <code>Object</code> | | Configuration object |
|
|
141
141
|
| config.openApiSpec | <code>Object</code> \| <code>string</code> | | OpenAPI specification object or path |
|
|
142
|
-
|
|
|
142
|
+
| config.serviceUrl | <code>string</code> | | Base URL of the service (required; no defaults) |
|
|
143
143
|
| [config.service] | <code>Object</code> | | Express app instance for direct calls |
|
|
144
144
|
| [config.directCall] | <code>boolean</code> | <code>false</code> | Use direct Express calls instead of HTTP |
|
|
145
145
|
| [config.logger] | <code>Object</code> | | Logger instance |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-orch-api-mapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "API mapping connector for OA Drive - maps cookbook operations to HTTP endpoints",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"axios": "^1.4.0",
|
|
24
|
-
"@onlineapps/content-resolver": "1.1.
|
|
24
|
+
"@onlineapps/content-resolver": "1.1.15"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"jest": "^29.5.0",
|
package/src/ApiMapper.js
CHANGED
|
@@ -17,11 +17,10 @@ class ApiMapper {
|
|
|
17
17
|
* @constructor
|
|
18
18
|
* @param {Object} config - Configuration object
|
|
19
19
|
* @param {Object|string} config.openApiSpec - OpenAPI specification object or path
|
|
20
|
-
* @param {string}
|
|
20
|
+
* @param {string} config.serviceUrl - Base URL of the service (required; no topology defaults)
|
|
21
21
|
* @param {Object} [config.service] - Express app instance for direct calls
|
|
22
22
|
* @param {boolean} [config.directCall=false] - Use direct Express calls instead of HTTP
|
|
23
23
|
* @param {Object} [config.logger] - Logger instance
|
|
24
|
-
* @param {number} [config.port=3000] - Service port for direct calls
|
|
25
24
|
*
|
|
26
25
|
* @example
|
|
27
26
|
* const apiMapper = new ApiMapper({
|
|
@@ -34,8 +33,12 @@ class ApiMapper {
|
|
|
34
33
|
throw new Error('OpenAPI specification is required');
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
if (typeof config.serviceUrl !== 'string' || config.serviceUrl.trim().length === 0) {
|
|
37
|
+
throw new Error('[ApiMapper] Missing configuration - serviceUrl is required (no defaults)');
|
|
38
|
+
}
|
|
39
|
+
|
|
37
40
|
this.openApiSpec = config.openApiSpec;
|
|
38
|
-
this.serviceUrl = config.serviceUrl
|
|
41
|
+
this.serviceUrl = config.serviceUrl;
|
|
39
42
|
this.service = config.service; // Express app for direct calls
|
|
40
43
|
this.directCall = config.directCall === true;
|
|
41
44
|
this.logger = config.logger || console;
|
package/src/index.js
CHANGED