@jrojaspin/security-map-api-cli 2.4.2 → 2.4.4
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/apis/ItemApi.d.ts +1 -0
- package/dist/apis/ItemApi.js +6 -0
- package/dist/apis/ItemApi.js.map +1 -1
- package/dist/index.d.ts +1931 -3
- package/dist/index.mjs +69 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
2
2
|
class Configuration {
|
|
3
|
-
configuration;
|
|
4
3
|
constructor(configuration = {}) {
|
|
5
4
|
this.configuration = configuration;
|
|
6
5
|
}
|
|
@@ -48,11 +47,55 @@ class Configuration {
|
|
|
48
47
|
}
|
|
49
48
|
const DefaultConfig = new Configuration();
|
|
50
49
|
class BaseAPI {
|
|
51
|
-
configuration;
|
|
52
|
-
static jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
53
|
-
middleware;
|
|
54
50
|
constructor(configuration = DefaultConfig) {
|
|
55
51
|
this.configuration = configuration;
|
|
52
|
+
this.fetchApi = async (url, init) => {
|
|
53
|
+
let fetchParams = { url, init };
|
|
54
|
+
for (const middleware of this.middleware) {
|
|
55
|
+
if (middleware.pre) {
|
|
56
|
+
fetchParams = await middleware.pre({
|
|
57
|
+
fetch: this.fetchApi,
|
|
58
|
+
...fetchParams,
|
|
59
|
+
}) || fetchParams;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
let response = undefined;
|
|
63
|
+
try {
|
|
64
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
for (const middleware of this.middleware) {
|
|
68
|
+
if (middleware.onError) {
|
|
69
|
+
response = await middleware.onError({
|
|
70
|
+
fetch: this.fetchApi,
|
|
71
|
+
url: fetchParams.url,
|
|
72
|
+
init: fetchParams.init,
|
|
73
|
+
error: e,
|
|
74
|
+
response: response ? response.clone() : undefined,
|
|
75
|
+
}) || response;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (response === undefined) {
|
|
79
|
+
if (e instanceof Error) {
|
|
80
|
+
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw e;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for (const middleware of this.middleware) {
|
|
88
|
+
if (middleware.post) {
|
|
89
|
+
response = await middleware.post({
|
|
90
|
+
fetch: this.fetchApi,
|
|
91
|
+
url: fetchParams.url,
|
|
92
|
+
init: fetchParams.init,
|
|
93
|
+
response: response.clone(),
|
|
94
|
+
}) || response;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return response;
|
|
98
|
+
};
|
|
56
99
|
this.middleware = configuration.middleware;
|
|
57
100
|
}
|
|
58
101
|
withMiddleware(...middlewares) {
|
|
@@ -123,53 +166,6 @@ class BaseAPI {
|
|
|
123
166
|
};
|
|
124
167
|
return { url, init };
|
|
125
168
|
}
|
|
126
|
-
fetchApi = async (url, init) => {
|
|
127
|
-
let fetchParams = { url, init };
|
|
128
|
-
for (const middleware of this.middleware) {
|
|
129
|
-
if (middleware.pre) {
|
|
130
|
-
fetchParams = await middleware.pre({
|
|
131
|
-
fetch: this.fetchApi,
|
|
132
|
-
...fetchParams,
|
|
133
|
-
}) || fetchParams;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
let response = undefined;
|
|
137
|
-
try {
|
|
138
|
-
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
139
|
-
}
|
|
140
|
-
catch (e) {
|
|
141
|
-
for (const middleware of this.middleware) {
|
|
142
|
-
if (middleware.onError) {
|
|
143
|
-
response = await middleware.onError({
|
|
144
|
-
fetch: this.fetchApi,
|
|
145
|
-
url: fetchParams.url,
|
|
146
|
-
init: fetchParams.init,
|
|
147
|
-
error: e,
|
|
148
|
-
response: response ? response.clone() : undefined,
|
|
149
|
-
}) || response;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (response === undefined) {
|
|
153
|
-
if (e instanceof Error) {
|
|
154
|
-
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
throw e;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
for (const middleware of this.middleware) {
|
|
162
|
-
if (middleware.post) {
|
|
163
|
-
response = await middleware.post({
|
|
164
|
-
fetch: this.fetchApi,
|
|
165
|
-
url: fetchParams.url,
|
|
166
|
-
init: fetchParams.init,
|
|
167
|
-
response: response.clone(),
|
|
168
|
-
}) || response;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return response;
|
|
172
|
-
};
|
|
173
169
|
clone() {
|
|
174
170
|
const constructor = this.constructor;
|
|
175
171
|
const next = new constructor(this.configuration);
|
|
@@ -177,6 +173,7 @@ class BaseAPI {
|
|
|
177
173
|
return next;
|
|
178
174
|
}
|
|
179
175
|
}
|
|
176
|
+
BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
180
177
|
function isBlob(value) {
|
|
181
178
|
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
182
179
|
}
|
|
@@ -184,27 +181,24 @@ function isFormData(value) {
|
|
|
184
181
|
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
185
182
|
}
|
|
186
183
|
class ResponseError extends Error {
|
|
187
|
-
response;
|
|
188
|
-
name = "ResponseError";
|
|
189
184
|
constructor(response, msg) {
|
|
190
185
|
super(msg);
|
|
191
186
|
this.response = response;
|
|
187
|
+
this.name = "ResponseError";
|
|
192
188
|
}
|
|
193
189
|
}
|
|
194
190
|
class FetchError extends Error {
|
|
195
|
-
cause;
|
|
196
|
-
name = "FetchError";
|
|
197
191
|
constructor(cause, msg) {
|
|
198
192
|
super(msg);
|
|
199
193
|
this.cause = cause;
|
|
194
|
+
this.name = "FetchError";
|
|
200
195
|
}
|
|
201
196
|
}
|
|
202
197
|
class RequiredError extends Error {
|
|
203
|
-
field;
|
|
204
|
-
name = "RequiredError";
|
|
205
198
|
constructor(field, msg) {
|
|
206
199
|
super(msg);
|
|
207
200
|
this.field = field;
|
|
201
|
+
this.name = "RequiredError";
|
|
208
202
|
}
|
|
209
203
|
}
|
|
210
204
|
const COLLECTION_FORMATS = {
|
|
@@ -254,8 +248,6 @@ function canConsumeForm(consumes) {
|
|
|
254
248
|
return false;
|
|
255
249
|
}
|
|
256
250
|
class JSONApiResponse {
|
|
257
|
-
raw;
|
|
258
|
-
transformer;
|
|
259
251
|
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
260
252
|
this.raw = raw;
|
|
261
253
|
this.transformer = transformer;
|
|
@@ -265,7 +257,6 @@ class JSONApiResponse {
|
|
|
265
257
|
}
|
|
266
258
|
}
|
|
267
259
|
class VoidApiResponse {
|
|
268
|
-
raw;
|
|
269
260
|
constructor(raw) {
|
|
270
261
|
this.raw = raw;
|
|
271
262
|
}
|
|
@@ -274,7 +265,6 @@ class VoidApiResponse {
|
|
|
274
265
|
}
|
|
275
266
|
}
|
|
276
267
|
class BlobApiResponse {
|
|
277
|
-
raw;
|
|
278
268
|
constructor(raw) {
|
|
279
269
|
this.raw = raw;
|
|
280
270
|
}
|
|
@@ -284,7 +274,6 @@ class BlobApiResponse {
|
|
|
284
274
|
;
|
|
285
275
|
}
|
|
286
276
|
class TextApiResponse {
|
|
287
|
-
raw;
|
|
288
277
|
constructor(raw) {
|
|
289
278
|
this.raw = raw;
|
|
290
279
|
}
|
|
@@ -5324,10 +5313,16 @@ class ItemApi extends BaseAPI {
|
|
|
5324
5313
|
return await response.value();
|
|
5325
5314
|
}
|
|
5326
5315
|
async apiV1ItemTypeItemTypeIdFormGetRaw(requestParameters, initOverrides) {
|
|
5316
|
+
if (requestParameters['action'] == null) {
|
|
5317
|
+
throw new RequiredError('action', 'Required parameter "action" was null or undefined when calling apiV1ItemTypeItemTypeIdFormGet().');
|
|
5318
|
+
}
|
|
5327
5319
|
if (requestParameters['itemTypeId'] == null) {
|
|
5328
5320
|
throw new RequiredError('itemTypeId', 'Required parameter "itemTypeId" was null or undefined when calling apiV1ItemTypeItemTypeIdFormGet().');
|
|
5329
5321
|
}
|
|
5330
5322
|
const queryParameters = {};
|
|
5323
|
+
if (requestParameters['action'] != null) {
|
|
5324
|
+
queryParameters['action'] = requestParameters['action'];
|
|
5325
|
+
}
|
|
5331
5326
|
const headerParameters = {};
|
|
5332
5327
|
if (this.configuration && this.configuration.apiKey) {
|
|
5333
5328
|
headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
|
|
@@ -6096,8 +6091,17 @@ const ApiV1ReportReportIdDataPostFormatEnum = {
|
|
|
6096
6091
|
};
|
|
6097
6092
|
|
|
6098
6093
|
class SearchApi extends BaseAPI {
|
|
6099
|
-
async apiV1SearchAutocompletePostRaw(initOverrides) {
|
|
6094
|
+
async apiV1SearchAutocompletePostRaw(requestParameters, initOverrides) {
|
|
6095
|
+
if (requestParameters['q'] == null) {
|
|
6096
|
+
throw new RequiredError('q', 'Required parameter "q" was null or undefined when calling apiV1SearchAutocompletePost().');
|
|
6097
|
+
}
|
|
6100
6098
|
const queryParameters = {};
|
|
6099
|
+
if (requestParameters['q'] != null) {
|
|
6100
|
+
queryParameters['q'] = requestParameters['q'];
|
|
6101
|
+
}
|
|
6102
|
+
if (requestParameters['itemTypes'] != null) {
|
|
6103
|
+
queryParameters['itemTypes'] = requestParameters['itemTypes'];
|
|
6104
|
+
}
|
|
6101
6105
|
const headerParameters = {};
|
|
6102
6106
|
if (this.configuration && this.configuration.apiKey) {
|
|
6103
6107
|
headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
|
|
@@ -6110,8 +6114,8 @@ class SearchApi extends BaseAPI {
|
|
|
6110
6114
|
}, initOverrides);
|
|
6111
6115
|
return new JSONApiResponse(response, (jsonValue) => SearchOutputFromJSON(jsonValue));
|
|
6112
6116
|
}
|
|
6113
|
-
async apiV1SearchAutocompletePost(initOverrides) {
|
|
6114
|
-
const response = await this.apiV1SearchAutocompletePostRaw(initOverrides);
|
|
6117
|
+
async apiV1SearchAutocompletePost(requestParameters, initOverrides) {
|
|
6118
|
+
const response = await this.apiV1SearchAutocompletePostRaw(requestParameters, initOverrides);
|
|
6115
6119
|
return await response.value();
|
|
6116
6120
|
}
|
|
6117
6121
|
async apiV1SearchPostRaw(requestParameters, initOverrides) {
|