@lwshen/vault-hub-ts-fetch-client 0.20250620.144136
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/.openapi-generator/FILES +17 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/README.md +46 -0
- package/dist/apis/AuthApi.d.ts +48 -0
- package/dist/apis/AuthApi.js +211 -0
- package/dist/apis/DefaultApi.d.ts +26 -0
- package/dist/apis/DefaultApi.js +121 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +20 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/models/HealthCheckResponse.d.ts +38 -0
- package/dist/models/HealthCheckResponse.js +51 -0
- package/dist/models/LoginRequest.d.ts +38 -0
- package/dist/models/LoginRequest.js +55 -0
- package/dist/models/LoginResponse.d.ts +32 -0
- package/dist/models/LoginResponse.js +51 -0
- package/dist/models/SignupRequest.d.ts +44 -0
- package/dist/models/SignupRequest.js +59 -0
- package/dist/models/SignupResponse.d.ts +32 -0
- package/dist/models/SignupResponse.js +51 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +23 -0
- package/dist/runtime.d.ts +184 -0
- package/dist/runtime.js +564 -0
- package/package.json +19 -0
- package/src/apis/AuthApi.ts +144 -0
- package/src/apis/DefaultApi.ts +56 -0
- package/src/apis/index.ts +4 -0
- package/src/index.ts +5 -0
- package/src/models/HealthCheckResponse.ts +73 -0
- package/src/models/LoginRequest.ts +75 -0
- package/src/models/LoginResponse.ts +66 -0
- package/src/models/SignupRequest.ts +84 -0
- package/src/models/SignupResponse.ts +66 -0
- package/src/models/index.ts +7 -0
- package/src/runtime.ts +432 -0
- package/tsconfig.json +20 -0
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Vault Hub Server
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __extends = (this && this.__extends) || (function () {
|
|
16
|
+
var extendStatics = function (d, b) {
|
|
17
|
+
extendStatics = Object.setPrototypeOf ||
|
|
18
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
19
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
20
|
+
return extendStatics(d, b);
|
|
21
|
+
};
|
|
22
|
+
return function (d, b) {
|
|
23
|
+
if (typeof b !== "function" && b !== null)
|
|
24
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
25
|
+
extendStatics(d, b);
|
|
26
|
+
function __() { this.constructor = d; }
|
|
27
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
28
|
+
};
|
|
29
|
+
})();
|
|
30
|
+
var __assign = (this && this.__assign) || function () {
|
|
31
|
+
__assign = Object.assign || function(t) {
|
|
32
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
33
|
+
s = arguments[i];
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
};
|
|
39
|
+
return __assign.apply(this, arguments);
|
|
40
|
+
};
|
|
41
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
42
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
51
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
52
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
53
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
54
|
+
function step(op) {
|
|
55
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
56
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
57
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
58
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
59
|
+
switch (op[0]) {
|
|
60
|
+
case 0: case 1: t = op; break;
|
|
61
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
62
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
63
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
64
|
+
default:
|
|
65
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
66
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
67
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
68
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
69
|
+
if (t[2]) _.ops.pop();
|
|
70
|
+
_.trys.pop(); continue;
|
|
71
|
+
}
|
|
72
|
+
op = body.call(thisArg, _);
|
|
73
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
74
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
78
|
+
exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
|
|
79
|
+
exports.querystring = querystring;
|
|
80
|
+
exports.exists = exists;
|
|
81
|
+
exports.mapValues = mapValues;
|
|
82
|
+
exports.canConsumeForm = canConsumeForm;
|
|
83
|
+
exports.BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
84
|
+
var Configuration = /** @class */ (function () {
|
|
85
|
+
function Configuration(configuration) {
|
|
86
|
+
if (configuration === void 0) { configuration = {}; }
|
|
87
|
+
this.configuration = configuration;
|
|
88
|
+
}
|
|
89
|
+
Object.defineProperty(Configuration.prototype, "config", {
|
|
90
|
+
set: function (configuration) {
|
|
91
|
+
this.configuration = configuration;
|
|
92
|
+
},
|
|
93
|
+
enumerable: false,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(Configuration.prototype, "basePath", {
|
|
97
|
+
get: function () {
|
|
98
|
+
return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
|
|
99
|
+
},
|
|
100
|
+
enumerable: false,
|
|
101
|
+
configurable: true
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(Configuration.prototype, "fetchApi", {
|
|
104
|
+
get: function () {
|
|
105
|
+
return this.configuration.fetchApi;
|
|
106
|
+
},
|
|
107
|
+
enumerable: false,
|
|
108
|
+
configurable: true
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(Configuration.prototype, "middleware", {
|
|
111
|
+
get: function () {
|
|
112
|
+
return this.configuration.middleware || [];
|
|
113
|
+
},
|
|
114
|
+
enumerable: false,
|
|
115
|
+
configurable: true
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(Configuration.prototype, "queryParamsStringify", {
|
|
118
|
+
get: function () {
|
|
119
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
120
|
+
},
|
|
121
|
+
enumerable: false,
|
|
122
|
+
configurable: true
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(Configuration.prototype, "username", {
|
|
125
|
+
get: function () {
|
|
126
|
+
return this.configuration.username;
|
|
127
|
+
},
|
|
128
|
+
enumerable: false,
|
|
129
|
+
configurable: true
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(Configuration.prototype, "password", {
|
|
132
|
+
get: function () {
|
|
133
|
+
return this.configuration.password;
|
|
134
|
+
},
|
|
135
|
+
enumerable: false,
|
|
136
|
+
configurable: true
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(Configuration.prototype, "apiKey", {
|
|
139
|
+
get: function () {
|
|
140
|
+
var apiKey = this.configuration.apiKey;
|
|
141
|
+
if (apiKey) {
|
|
142
|
+
return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
},
|
|
146
|
+
enumerable: false,
|
|
147
|
+
configurable: true
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(Configuration.prototype, "accessToken", {
|
|
150
|
+
get: function () {
|
|
151
|
+
var _this = this;
|
|
152
|
+
var accessToken = this.configuration.accessToken;
|
|
153
|
+
if (accessToken) {
|
|
154
|
+
return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
155
|
+
return [2 /*return*/, accessToken];
|
|
156
|
+
}); }); };
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
},
|
|
160
|
+
enumerable: false,
|
|
161
|
+
configurable: true
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(Configuration.prototype, "headers", {
|
|
164
|
+
get: function () {
|
|
165
|
+
return this.configuration.headers;
|
|
166
|
+
},
|
|
167
|
+
enumerable: false,
|
|
168
|
+
configurable: true
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(Configuration.prototype, "credentials", {
|
|
171
|
+
get: function () {
|
|
172
|
+
return this.configuration.credentials;
|
|
173
|
+
},
|
|
174
|
+
enumerable: false,
|
|
175
|
+
configurable: true
|
|
176
|
+
});
|
|
177
|
+
return Configuration;
|
|
178
|
+
}());
|
|
179
|
+
exports.Configuration = Configuration;
|
|
180
|
+
exports.DefaultConfig = new Configuration();
|
|
181
|
+
/**
|
|
182
|
+
* This is the base class for all generated API classes.
|
|
183
|
+
*/
|
|
184
|
+
var BaseAPI = /** @class */ (function () {
|
|
185
|
+
function BaseAPI(configuration) {
|
|
186
|
+
if (configuration === void 0) { configuration = exports.DefaultConfig; }
|
|
187
|
+
var _this = this;
|
|
188
|
+
this.configuration = configuration;
|
|
189
|
+
this.fetchApi = function (url, init) { return __awaiter(_this, void 0, void 0, function () {
|
|
190
|
+
var fetchParams, _i, _a, middleware, response, e_1, _b, _c, middleware, _d, _e, middleware;
|
|
191
|
+
return __generator(this, function (_f) {
|
|
192
|
+
switch (_f.label) {
|
|
193
|
+
case 0:
|
|
194
|
+
fetchParams = { url: url, init: init };
|
|
195
|
+
_i = 0, _a = this.middleware;
|
|
196
|
+
_f.label = 1;
|
|
197
|
+
case 1:
|
|
198
|
+
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
199
|
+
middleware = _a[_i];
|
|
200
|
+
if (!middleware.pre) return [3 /*break*/, 3];
|
|
201
|
+
return [4 /*yield*/, middleware.pre(__assign({ fetch: this.fetchApi }, fetchParams))];
|
|
202
|
+
case 2:
|
|
203
|
+
fetchParams = (_f.sent()) || fetchParams;
|
|
204
|
+
_f.label = 3;
|
|
205
|
+
case 3:
|
|
206
|
+
_i++;
|
|
207
|
+
return [3 /*break*/, 1];
|
|
208
|
+
case 4:
|
|
209
|
+
response = undefined;
|
|
210
|
+
_f.label = 5;
|
|
211
|
+
case 5:
|
|
212
|
+
_f.trys.push([5, 7, , 12]);
|
|
213
|
+
return [4 /*yield*/, (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init)];
|
|
214
|
+
case 6:
|
|
215
|
+
response = _f.sent();
|
|
216
|
+
return [3 /*break*/, 12];
|
|
217
|
+
case 7:
|
|
218
|
+
e_1 = _f.sent();
|
|
219
|
+
_b = 0, _c = this.middleware;
|
|
220
|
+
_f.label = 8;
|
|
221
|
+
case 8:
|
|
222
|
+
if (!(_b < _c.length)) return [3 /*break*/, 11];
|
|
223
|
+
middleware = _c[_b];
|
|
224
|
+
if (!middleware.onError) return [3 /*break*/, 10];
|
|
225
|
+
return [4 /*yield*/, middleware.onError({
|
|
226
|
+
fetch: this.fetchApi,
|
|
227
|
+
url: fetchParams.url,
|
|
228
|
+
init: fetchParams.init,
|
|
229
|
+
error: e_1,
|
|
230
|
+
response: response ? response.clone() : undefined,
|
|
231
|
+
})];
|
|
232
|
+
case 9:
|
|
233
|
+
response = (_f.sent()) || response;
|
|
234
|
+
_f.label = 10;
|
|
235
|
+
case 10:
|
|
236
|
+
_b++;
|
|
237
|
+
return [3 /*break*/, 8];
|
|
238
|
+
case 11:
|
|
239
|
+
if (response === undefined) {
|
|
240
|
+
if (e_1 instanceof Error) {
|
|
241
|
+
throw new FetchError(e_1, 'The request failed and the interceptors did not return an alternative response');
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
throw e_1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return [3 /*break*/, 12];
|
|
248
|
+
case 12:
|
|
249
|
+
_d = 0, _e = this.middleware;
|
|
250
|
+
_f.label = 13;
|
|
251
|
+
case 13:
|
|
252
|
+
if (!(_d < _e.length)) return [3 /*break*/, 16];
|
|
253
|
+
middleware = _e[_d];
|
|
254
|
+
if (!middleware.post) return [3 /*break*/, 15];
|
|
255
|
+
return [4 /*yield*/, middleware.post({
|
|
256
|
+
fetch: this.fetchApi,
|
|
257
|
+
url: fetchParams.url,
|
|
258
|
+
init: fetchParams.init,
|
|
259
|
+
response: response.clone(),
|
|
260
|
+
})];
|
|
261
|
+
case 14:
|
|
262
|
+
response = (_f.sent()) || response;
|
|
263
|
+
_f.label = 15;
|
|
264
|
+
case 15:
|
|
265
|
+
_d++;
|
|
266
|
+
return [3 /*break*/, 13];
|
|
267
|
+
case 16: return [2 /*return*/, response];
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}); };
|
|
271
|
+
this.middleware = configuration.middleware;
|
|
272
|
+
}
|
|
273
|
+
BaseAPI.prototype.withMiddleware = function () {
|
|
274
|
+
var _a;
|
|
275
|
+
var middlewares = [];
|
|
276
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
277
|
+
middlewares[_i] = arguments[_i];
|
|
278
|
+
}
|
|
279
|
+
var next = this.clone();
|
|
280
|
+
next.middleware = (_a = next.middleware).concat.apply(_a, middlewares);
|
|
281
|
+
return next;
|
|
282
|
+
};
|
|
283
|
+
BaseAPI.prototype.withPreMiddleware = function () {
|
|
284
|
+
var preMiddlewares = [];
|
|
285
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
286
|
+
preMiddlewares[_i] = arguments[_i];
|
|
287
|
+
}
|
|
288
|
+
var middlewares = preMiddlewares.map(function (pre) { return ({ pre: pre }); });
|
|
289
|
+
return this.withMiddleware.apply(this, middlewares);
|
|
290
|
+
};
|
|
291
|
+
BaseAPI.prototype.withPostMiddleware = function () {
|
|
292
|
+
var postMiddlewares = [];
|
|
293
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
294
|
+
postMiddlewares[_i] = arguments[_i];
|
|
295
|
+
}
|
|
296
|
+
var middlewares = postMiddlewares.map(function (post) { return ({ post: post }); });
|
|
297
|
+
return this.withMiddleware.apply(this, middlewares);
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Check if the given MIME is a JSON MIME.
|
|
301
|
+
* JSON MIME examples:
|
|
302
|
+
* application/json
|
|
303
|
+
* application/json; charset=UTF8
|
|
304
|
+
* APPLICATION/JSON
|
|
305
|
+
* application/vnd.company+json
|
|
306
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
307
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
308
|
+
*/
|
|
309
|
+
BaseAPI.prototype.isJsonMime = function (mime) {
|
|
310
|
+
if (!mime) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
return BaseAPI.jsonRegex.test(mime);
|
|
314
|
+
};
|
|
315
|
+
BaseAPI.prototype.request = function (context, initOverrides) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
+
var _a, url, init, response;
|
|
318
|
+
return __generator(this, function (_b) {
|
|
319
|
+
switch (_b.label) {
|
|
320
|
+
case 0: return [4 /*yield*/, this.createFetchParams(context, initOverrides)];
|
|
321
|
+
case 1:
|
|
322
|
+
_a = _b.sent(), url = _a.url, init = _a.init;
|
|
323
|
+
return [4 /*yield*/, this.fetchApi(url, init)];
|
|
324
|
+
case 2:
|
|
325
|
+
response = _b.sent();
|
|
326
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
327
|
+
return [2 /*return*/, response];
|
|
328
|
+
}
|
|
329
|
+
throw new ResponseError(response, 'Response returned an error code');
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
BaseAPI.prototype.createFetchParams = function (context, initOverrides) {
|
|
335
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
336
|
+
var url, headers, initOverrideFn, initParams, overriddenInit, _a, body, init;
|
|
337
|
+
var _this = this;
|
|
338
|
+
return __generator(this, function (_b) {
|
|
339
|
+
switch (_b.label) {
|
|
340
|
+
case 0:
|
|
341
|
+
url = this.configuration.basePath + context.path;
|
|
342
|
+
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
343
|
+
// only add the querystring to the URL if there are query parameters.
|
|
344
|
+
// this is done to avoid urls ending with a "?" character which buggy webservers
|
|
345
|
+
// do not handle correctly sometimes.
|
|
346
|
+
url += '?' + this.configuration.queryParamsStringify(context.query);
|
|
347
|
+
}
|
|
348
|
+
headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
349
|
+
Object.keys(headers).forEach(function (key) { return headers[key] === undefined ? delete headers[key] : {}; });
|
|
350
|
+
initOverrideFn = typeof initOverrides === "function"
|
|
351
|
+
? initOverrides
|
|
352
|
+
: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
353
|
+
return [2 /*return*/, initOverrides];
|
|
354
|
+
}); }); };
|
|
355
|
+
initParams = {
|
|
356
|
+
method: context.method,
|
|
357
|
+
headers: headers,
|
|
358
|
+
body: context.body,
|
|
359
|
+
credentials: this.configuration.credentials,
|
|
360
|
+
};
|
|
361
|
+
_a = [__assign({}, initParams)];
|
|
362
|
+
return [4 /*yield*/, initOverrideFn({
|
|
363
|
+
init: initParams,
|
|
364
|
+
context: context,
|
|
365
|
+
})];
|
|
366
|
+
case 1:
|
|
367
|
+
overriddenInit = __assign.apply(void 0, _a.concat([(_b.sent())]));
|
|
368
|
+
if (isFormData(overriddenInit.body)
|
|
369
|
+
|| (overriddenInit.body instanceof URLSearchParams)
|
|
370
|
+
|| isBlob(overriddenInit.body)) {
|
|
371
|
+
body = overriddenInit.body;
|
|
372
|
+
}
|
|
373
|
+
else if (this.isJsonMime(headers['Content-Type'])) {
|
|
374
|
+
body = JSON.stringify(overriddenInit.body);
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
body = overriddenInit.body;
|
|
378
|
+
}
|
|
379
|
+
init = __assign(__assign({}, overriddenInit), { body: body });
|
|
380
|
+
return [2 /*return*/, { url: url, init: init }];
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
387
|
+
* and then shallow cloning data members.
|
|
388
|
+
*/
|
|
389
|
+
BaseAPI.prototype.clone = function () {
|
|
390
|
+
var constructor = this.constructor;
|
|
391
|
+
var next = new constructor(this.configuration);
|
|
392
|
+
next.middleware = this.middleware.slice();
|
|
393
|
+
return next;
|
|
394
|
+
};
|
|
395
|
+
BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
396
|
+
return BaseAPI;
|
|
397
|
+
}());
|
|
398
|
+
exports.BaseAPI = BaseAPI;
|
|
399
|
+
;
|
|
400
|
+
function isBlob(value) {
|
|
401
|
+
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
402
|
+
}
|
|
403
|
+
function isFormData(value) {
|
|
404
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
405
|
+
}
|
|
406
|
+
var ResponseError = /** @class */ (function (_super) {
|
|
407
|
+
__extends(ResponseError, _super);
|
|
408
|
+
function ResponseError(response, msg) {
|
|
409
|
+
var _this = _super.call(this, msg) || this;
|
|
410
|
+
_this.response = response;
|
|
411
|
+
_this.name = "ResponseError";
|
|
412
|
+
return _this;
|
|
413
|
+
}
|
|
414
|
+
return ResponseError;
|
|
415
|
+
}(Error));
|
|
416
|
+
exports.ResponseError = ResponseError;
|
|
417
|
+
var FetchError = /** @class */ (function (_super) {
|
|
418
|
+
__extends(FetchError, _super);
|
|
419
|
+
function FetchError(cause, msg) {
|
|
420
|
+
var _this = _super.call(this, msg) || this;
|
|
421
|
+
_this.cause = cause;
|
|
422
|
+
_this.name = "FetchError";
|
|
423
|
+
return _this;
|
|
424
|
+
}
|
|
425
|
+
return FetchError;
|
|
426
|
+
}(Error));
|
|
427
|
+
exports.FetchError = FetchError;
|
|
428
|
+
var RequiredError = /** @class */ (function (_super) {
|
|
429
|
+
__extends(RequiredError, _super);
|
|
430
|
+
function RequiredError(field, msg) {
|
|
431
|
+
var _this = _super.call(this, msg) || this;
|
|
432
|
+
_this.field = field;
|
|
433
|
+
_this.name = "RequiredError";
|
|
434
|
+
return _this;
|
|
435
|
+
}
|
|
436
|
+
return RequiredError;
|
|
437
|
+
}(Error));
|
|
438
|
+
exports.RequiredError = RequiredError;
|
|
439
|
+
exports.COLLECTION_FORMATS = {
|
|
440
|
+
csv: ",",
|
|
441
|
+
ssv: " ",
|
|
442
|
+
tsv: "\t",
|
|
443
|
+
pipes: "|",
|
|
444
|
+
};
|
|
445
|
+
function querystring(params, prefix) {
|
|
446
|
+
if (prefix === void 0) { prefix = ''; }
|
|
447
|
+
return Object.keys(params)
|
|
448
|
+
.map(function (key) { return querystringSingleKey(key, params[key], prefix); })
|
|
449
|
+
.filter(function (part) { return part.length > 0; })
|
|
450
|
+
.join('&');
|
|
451
|
+
}
|
|
452
|
+
function querystringSingleKey(key, value, keyPrefix) {
|
|
453
|
+
if (keyPrefix === void 0) { keyPrefix = ''; }
|
|
454
|
+
var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
|
|
455
|
+
if (value instanceof Array) {
|
|
456
|
+
var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
|
|
457
|
+
.join("&".concat(encodeURIComponent(fullKey), "="));
|
|
458
|
+
return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
|
|
459
|
+
}
|
|
460
|
+
if (value instanceof Set) {
|
|
461
|
+
var valueAsArray = Array.from(value);
|
|
462
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
463
|
+
}
|
|
464
|
+
if (value instanceof Date) {
|
|
465
|
+
return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
|
|
466
|
+
}
|
|
467
|
+
if (value instanceof Object) {
|
|
468
|
+
return querystring(value, fullKey);
|
|
469
|
+
}
|
|
470
|
+
return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
|
|
471
|
+
}
|
|
472
|
+
function exists(json, key) {
|
|
473
|
+
var value = json[key];
|
|
474
|
+
return value !== null && value !== undefined;
|
|
475
|
+
}
|
|
476
|
+
function mapValues(data, fn) {
|
|
477
|
+
var result = {};
|
|
478
|
+
for (var _i = 0, _a = Object.keys(data); _i < _a.length; _i++) {
|
|
479
|
+
var key = _a[_i];
|
|
480
|
+
result[key] = fn(data[key]);
|
|
481
|
+
}
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
function canConsumeForm(consumes) {
|
|
485
|
+
for (var _i = 0, consumes_1 = consumes; _i < consumes_1.length; _i++) {
|
|
486
|
+
var consume = consumes_1[_i];
|
|
487
|
+
if ('multipart/form-data' === consume.contentType) {
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
var JSONApiResponse = /** @class */ (function () {
|
|
494
|
+
function JSONApiResponse(raw, transformer) {
|
|
495
|
+
if (transformer === void 0) { transformer = function (jsonValue) { return jsonValue; }; }
|
|
496
|
+
this.raw = raw;
|
|
497
|
+
this.transformer = transformer;
|
|
498
|
+
}
|
|
499
|
+
JSONApiResponse.prototype.value = function () {
|
|
500
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
501
|
+
var _a;
|
|
502
|
+
return __generator(this, function (_b) {
|
|
503
|
+
switch (_b.label) {
|
|
504
|
+
case 0:
|
|
505
|
+
_a = this.transformer;
|
|
506
|
+
return [4 /*yield*/, this.raw.json()];
|
|
507
|
+
case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])];
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
return JSONApiResponse;
|
|
513
|
+
}());
|
|
514
|
+
exports.JSONApiResponse = JSONApiResponse;
|
|
515
|
+
var VoidApiResponse = /** @class */ (function () {
|
|
516
|
+
function VoidApiResponse(raw) {
|
|
517
|
+
this.raw = raw;
|
|
518
|
+
}
|
|
519
|
+
VoidApiResponse.prototype.value = function () {
|
|
520
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
521
|
+
return __generator(this, function (_a) {
|
|
522
|
+
return [2 /*return*/, undefined];
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
};
|
|
526
|
+
return VoidApiResponse;
|
|
527
|
+
}());
|
|
528
|
+
exports.VoidApiResponse = VoidApiResponse;
|
|
529
|
+
var BlobApiResponse = /** @class */ (function () {
|
|
530
|
+
function BlobApiResponse(raw) {
|
|
531
|
+
this.raw = raw;
|
|
532
|
+
}
|
|
533
|
+
BlobApiResponse.prototype.value = function () {
|
|
534
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
535
|
+
return __generator(this, function (_a) {
|
|
536
|
+
switch (_a.label) {
|
|
537
|
+
case 0: return [4 /*yield*/, this.raw.blob()];
|
|
538
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
;
|
|
544
|
+
return BlobApiResponse;
|
|
545
|
+
}());
|
|
546
|
+
exports.BlobApiResponse = BlobApiResponse;
|
|
547
|
+
var TextApiResponse = /** @class */ (function () {
|
|
548
|
+
function TextApiResponse(raw) {
|
|
549
|
+
this.raw = raw;
|
|
550
|
+
}
|
|
551
|
+
TextApiResponse.prototype.value = function () {
|
|
552
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
553
|
+
return __generator(this, function (_a) {
|
|
554
|
+
switch (_a.label) {
|
|
555
|
+
case 0: return [4 /*yield*/, this.raw.text()];
|
|
556
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
;
|
|
562
|
+
return TextApiResponse;
|
|
563
|
+
}());
|
|
564
|
+
exports.TextApiResponse = TextApiResponse;
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lwshen/vault-hub-ts-fetch-client",
|
|
3
|
+
"version": "0.20250620.144136",
|
|
4
|
+
"description": "OpenAPI client for @lwshen/vault-hub-ts-fetch-client",
|
|
5
|
+
"author": "OpenAPI-Generator",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/lwshen/vault-hub.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"typings": "./dist/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"prepare": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^4.0 || ^5.0"
|
|
18
|
+
}
|
|
19
|
+
}
|