@jrojaspin/security-map-api-cli 2.4.3 → 2.4.5

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/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
  }
@@ -5079,8 +5068,11 @@ class HealthcheckApi extends BaseAPI {
5079
5068
  }
5080
5069
 
5081
5070
  class ItemApi extends BaseAPI {
5082
- async apiV1ItemGetRaw(initOverrides) {
5071
+ async apiV1ItemGetRaw(requestParameters, initOverrides) {
5083
5072
  const queryParameters = {};
5073
+ if (requestParameters['itemTypes'] != null) {
5074
+ queryParameters['itemTypes'] = requestParameters['itemTypes'];
5075
+ }
5084
5076
  const headerParameters = {};
5085
5077
  if (this.configuration && this.configuration.apiKey) {
5086
5078
  headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
@@ -5093,8 +5085,8 @@ class ItemApi extends BaseAPI {
5093
5085
  }, initOverrides);
5094
5086
  return new JSONApiResponse(response, (jsonValue) => ItemsOutputFromJSON(jsonValue));
5095
5087
  }
5096
- async apiV1ItemGet(initOverrides) {
5097
- const response = await this.apiV1ItemGetRaw(initOverrides);
5088
+ async apiV1ItemGet(requestParameters = {}, initOverrides) {
5089
+ const response = await this.apiV1ItemGetRaw(requestParameters, initOverrides);
5098
5090
  return await response.value();
5099
5091
  }
5100
5092
  async apiV1ItemItemIdGetRaw(requestParameters, initOverrides) {
@@ -5271,6 +5263,12 @@ class ItemApi extends BaseAPI {
5271
5263
  throw new RequiredError('fieldDefinitionId', 'Required parameter "fieldDefinitionId" was null or undefined when calling apiV1ItemTypeDynamicfieldFieldDefinitionIdAutocompleteGet().');
5272
5264
  }
5273
5265
  const queryParameters = {};
5266
+ if (requestParameters['query'] != null) {
5267
+ queryParameters['query'] = requestParameters['query'];
5268
+ }
5269
+ if (requestParameters['q'] != null) {
5270
+ queryParameters['q'] = requestParameters['q'];
5271
+ }
5274
5272
  const headerParameters = {};
5275
5273
  if (this.configuration && this.configuration.apiKey) {
5276
5274
  headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
@@ -5324,10 +5322,16 @@ class ItemApi extends BaseAPI {
5324
5322
  return await response.value();
5325
5323
  }
5326
5324
  async apiV1ItemTypeItemTypeIdFormGetRaw(requestParameters, initOverrides) {
5325
+ if (requestParameters['action'] == null) {
5326
+ throw new RequiredError('action', 'Required parameter "action" was null or undefined when calling apiV1ItemTypeItemTypeIdFormGet().');
5327
+ }
5327
5328
  if (requestParameters['itemTypeId'] == null) {
5328
5329
  throw new RequiredError('itemTypeId', 'Required parameter "itemTypeId" was null or undefined when calling apiV1ItemTypeItemTypeIdFormGet().');
5329
5330
  }
5330
5331
  const queryParameters = {};
5332
+ if (requestParameters['action'] != null) {
5333
+ queryParameters['action'] = requestParameters['action'];
5334
+ }
5331
5335
  const headerParameters = {};
5332
5336
  if (this.configuration && this.configuration.apiKey) {
5333
5337
  headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
@@ -6096,8 +6100,26 @@ const ApiV1ReportReportIdDataPostFormatEnum = {
6096
6100
  };
6097
6101
 
6098
6102
  class SearchApi extends BaseAPI {
6099
- async apiV1SearchAutocompletePostRaw(initOverrides) {
6103
+ async apiV1SearchAutocompletePostRaw(requestParameters, initOverrides) {
6104
+ if (requestParameters['q'] == null) {
6105
+ throw new RequiredError('q', 'Required parameter "q" was null or undefined when calling apiV1SearchAutocompletePost().');
6106
+ }
6100
6107
  const queryParameters = {};
6108
+ if (requestParameters['q'] != null) {
6109
+ queryParameters['q'] = requestParameters['q'];
6110
+ }
6111
+ if (requestParameters['itemTypes'] != null) {
6112
+ queryParameters['itemTypes'] = requestParameters['itemTypes'];
6113
+ }
6114
+ if (requestParameters['distance'] != null) {
6115
+ queryParameters['distance'] = requestParameters['distance'];
6116
+ }
6117
+ if (requestParameters['coordTopLeft'] != null) {
6118
+ queryParameters['coordTopLeft'] = requestParameters['coordTopLeft'];
6119
+ }
6120
+ if (requestParameters['coordBottomRight'] != null) {
6121
+ queryParameters['coordBottomRight'] = requestParameters['coordBottomRight'];
6122
+ }
6101
6123
  const headerParameters = {};
6102
6124
  if (this.configuration && this.configuration.apiKey) {
6103
6125
  headerParameters["apiKey"] = await this.configuration.apiKey("apiKey");
@@ -6110,8 +6132,8 @@ class SearchApi extends BaseAPI {
6110
6132
  }, initOverrides);
6111
6133
  return new JSONApiResponse(response, (jsonValue) => SearchOutputFromJSON(jsonValue));
6112
6134
  }
6113
- async apiV1SearchAutocompletePost(initOverrides) {
6114
- const response = await this.apiV1SearchAutocompletePostRaw(initOverrides);
6135
+ async apiV1SearchAutocompletePost(requestParameters, initOverrides) {
6136
+ const response = await this.apiV1SearchAutocompletePostRaw(requestParameters, initOverrides);
6115
6137
  return await response.value();
6116
6138
  }
6117
6139
  async apiV1SearchPostRaw(requestParameters, initOverrides) {