@layer-drone/protocol 0.0.7 → 0.0.9-alpha
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.d.mts +220 -49
- package/dist/index.d.ts +220 -49
- package/dist/index.js +598 -11
- package/dist/index.mjs +594 -10
- package/package.json +3 -3
- package/src/client/client/client.ts +181 -0
- package/src/client/client/index.ts +22 -0
- package/src/client/client/types.ts +215 -0
- package/src/client/client/utils.ts +415 -0
- package/src/client/client.gen.ts +2 -3
- package/src/client/core/auth.ts +40 -0
- package/src/client/core/bodySerializer.ts +84 -0
- package/src/client/core/params.ts +141 -0
- package/src/client/core/pathSerializer.ts +179 -0
- package/src/client/core/types.ts +98 -0
- package/src/client/index.ts +2 -2
- package/src/client/sdk.gen.ts +162 -88
- package/src/client/transformers.gen.ts +40 -0
- package/src/client/types.gen.ts +74 -16
- package/src/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -27,12 +27,15 @@ __export(index_exports, {
|
|
|
27
27
|
apiTokenControllerGetToken: () => apiTokenControllerGetToken,
|
|
28
28
|
apiTokenControllerUpdateToken: () => apiTokenControllerUpdateToken,
|
|
29
29
|
appControllerGetHello: () => appControllerGetHello,
|
|
30
|
+
client: () => client,
|
|
31
|
+
conditionsControllerGetSunAltitudeTimeLimits: () => conditionsControllerGetSunAltitudeTimeLimits,
|
|
30
32
|
flightsControllerCreatePresignedUrls: () => flightsControllerCreatePresignedUrls,
|
|
31
33
|
flightsControllerGenerateFlightId: () => flightsControllerGenerateFlightId,
|
|
32
34
|
flightsControllerValidateFlight: () => flightsControllerValidateFlight,
|
|
33
35
|
keysControllerGetProvenanceCryptoKey: () => keysControllerGetProvenanceCryptoKey,
|
|
34
36
|
parseWebhookEvent: () => parseWebhookEvent,
|
|
35
37
|
quotesControllerCreateQuote: () => quotesControllerCreateQuote,
|
|
38
|
+
quotesControllerGetQuote: () => quotesControllerGetQuote,
|
|
36
39
|
rewardsControllerDepositRewards: () => rewardsControllerDepositRewards,
|
|
37
40
|
rewardsControllerDistributeRewards: () => rewardsControllerDistributeRewards,
|
|
38
41
|
schemaControllerGetEventSchema: () => schemaControllerGetEventSchema,
|
|
@@ -47,9 +50,572 @@ __export(index_exports, {
|
|
|
47
50
|
});
|
|
48
51
|
module.exports = __toCommonJS(index_exports);
|
|
49
52
|
|
|
53
|
+
// src/client/core/bodySerializer.ts
|
|
54
|
+
var jsonBodySerializer = {
|
|
55
|
+
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/client/core/params.ts
|
|
59
|
+
var extraPrefixesMap = {
|
|
60
|
+
$body_: "body",
|
|
61
|
+
$headers_: "headers",
|
|
62
|
+
$path_: "path",
|
|
63
|
+
$query_: "query"
|
|
64
|
+
};
|
|
65
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
66
|
+
|
|
67
|
+
// src/client/core/auth.ts
|
|
68
|
+
var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
69
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
70
|
+
if (!token) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (auth.scheme === "bearer") {
|
|
74
|
+
return `Bearer ${token}`;
|
|
75
|
+
}
|
|
76
|
+
if (auth.scheme === "basic") {
|
|
77
|
+
return `Basic ${btoa(token)}`;
|
|
78
|
+
}
|
|
79
|
+
return token;
|
|
80
|
+
}, "getAuthToken");
|
|
81
|
+
|
|
82
|
+
// src/client/core/pathSerializer.ts
|
|
83
|
+
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
84
|
+
switch (style) {
|
|
85
|
+
case "label":
|
|
86
|
+
return ".";
|
|
87
|
+
case "matrix":
|
|
88
|
+
return ";";
|
|
89
|
+
case "simple":
|
|
90
|
+
return ",";
|
|
91
|
+
default:
|
|
92
|
+
return "&";
|
|
93
|
+
}
|
|
94
|
+
}, "separatorArrayExplode");
|
|
95
|
+
var separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
96
|
+
switch (style) {
|
|
97
|
+
case "form":
|
|
98
|
+
return ",";
|
|
99
|
+
case "pipeDelimited":
|
|
100
|
+
return "|";
|
|
101
|
+
case "spaceDelimited":
|
|
102
|
+
return "%20";
|
|
103
|
+
default:
|
|
104
|
+
return ",";
|
|
105
|
+
}
|
|
106
|
+
}, "separatorArrayNoExplode");
|
|
107
|
+
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
108
|
+
switch (style) {
|
|
109
|
+
case "label":
|
|
110
|
+
return ".";
|
|
111
|
+
case "matrix":
|
|
112
|
+
return ";";
|
|
113
|
+
case "simple":
|
|
114
|
+
return ",";
|
|
115
|
+
default:
|
|
116
|
+
return "&";
|
|
117
|
+
}
|
|
118
|
+
}, "separatorObjectExplode");
|
|
119
|
+
var serializeArrayParam = /* @__PURE__ */ __name(({ allowReserved, explode, name, style, value }) => {
|
|
120
|
+
if (!explode) {
|
|
121
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
122
|
+
switch (style) {
|
|
123
|
+
case "label":
|
|
124
|
+
return `.${joinedValues2}`;
|
|
125
|
+
case "matrix":
|
|
126
|
+
return `;${name}=${joinedValues2}`;
|
|
127
|
+
case "simple":
|
|
128
|
+
return joinedValues2;
|
|
129
|
+
default:
|
|
130
|
+
return `${name}=${joinedValues2}`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const separator = separatorArrayExplode(style);
|
|
134
|
+
const joinedValues = value.map((v) => {
|
|
135
|
+
if (style === "label" || style === "simple") {
|
|
136
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
137
|
+
}
|
|
138
|
+
return serializePrimitiveParam({
|
|
139
|
+
allowReserved,
|
|
140
|
+
name,
|
|
141
|
+
value: v
|
|
142
|
+
});
|
|
143
|
+
}).join(separator);
|
|
144
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
145
|
+
}, "serializeArrayParam");
|
|
146
|
+
var serializePrimitiveParam = /* @__PURE__ */ __name(({ allowReserved, name, value }) => {
|
|
147
|
+
if (value === void 0 || value === null) {
|
|
148
|
+
return "";
|
|
149
|
+
}
|
|
150
|
+
if (typeof value === "object") {
|
|
151
|
+
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
152
|
+
}
|
|
153
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
154
|
+
}, "serializePrimitiveParam");
|
|
155
|
+
var serializeObjectParam = /* @__PURE__ */ __name(({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
156
|
+
if (value instanceof Date) {
|
|
157
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
158
|
+
}
|
|
159
|
+
if (style !== "deepObject" && !explode) {
|
|
160
|
+
let values = [];
|
|
161
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
162
|
+
values = [
|
|
163
|
+
...values,
|
|
164
|
+
key,
|
|
165
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
166
|
+
];
|
|
167
|
+
});
|
|
168
|
+
const joinedValues2 = values.join(",");
|
|
169
|
+
switch (style) {
|
|
170
|
+
case "form":
|
|
171
|
+
return `${name}=${joinedValues2}`;
|
|
172
|
+
case "label":
|
|
173
|
+
return `.${joinedValues2}`;
|
|
174
|
+
case "matrix":
|
|
175
|
+
return `;${name}=${joinedValues2}`;
|
|
176
|
+
default:
|
|
177
|
+
return joinedValues2;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const separator = separatorObjectExplode(style);
|
|
181
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
182
|
+
allowReserved,
|
|
183
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
184
|
+
value: v
|
|
185
|
+
})).join(separator);
|
|
186
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
187
|
+
}, "serializeObjectParam");
|
|
188
|
+
|
|
189
|
+
// src/client/client/utils.ts
|
|
190
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
191
|
+
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
192
|
+
let url = _url;
|
|
193
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
194
|
+
if (matches) {
|
|
195
|
+
for (const match of matches) {
|
|
196
|
+
let explode = false;
|
|
197
|
+
let name = match.substring(1, match.length - 1);
|
|
198
|
+
let style = "simple";
|
|
199
|
+
if (name.endsWith("*")) {
|
|
200
|
+
explode = true;
|
|
201
|
+
name = name.substring(0, name.length - 1);
|
|
202
|
+
}
|
|
203
|
+
if (name.startsWith(".")) {
|
|
204
|
+
name = name.substring(1);
|
|
205
|
+
style = "label";
|
|
206
|
+
} else if (name.startsWith(";")) {
|
|
207
|
+
name = name.substring(1);
|
|
208
|
+
style = "matrix";
|
|
209
|
+
}
|
|
210
|
+
const value = path[name];
|
|
211
|
+
if (value === void 0 || value === null) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (Array.isArray(value)) {
|
|
215
|
+
url = url.replace(match, serializeArrayParam({
|
|
216
|
+
explode,
|
|
217
|
+
name,
|
|
218
|
+
style,
|
|
219
|
+
value
|
|
220
|
+
}));
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (typeof value === "object") {
|
|
224
|
+
url = url.replace(match, serializeObjectParam({
|
|
225
|
+
explode,
|
|
226
|
+
name,
|
|
227
|
+
style,
|
|
228
|
+
value,
|
|
229
|
+
valueOnly: true
|
|
230
|
+
}));
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (style === "matrix") {
|
|
234
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
235
|
+
name,
|
|
236
|
+
value
|
|
237
|
+
})}`);
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
241
|
+
url = url.replace(match, replaceValue);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return url;
|
|
245
|
+
}, "defaultPathSerializer");
|
|
246
|
+
var createQuerySerializer = /* @__PURE__ */ __name(({ allowReserved, array, object } = {}) => {
|
|
247
|
+
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
248
|
+
const search = [];
|
|
249
|
+
if (queryParams && typeof queryParams === "object") {
|
|
250
|
+
for (const name in queryParams) {
|
|
251
|
+
const value = queryParams[name];
|
|
252
|
+
if (value === void 0 || value === null) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (Array.isArray(value)) {
|
|
256
|
+
const serializedArray = serializeArrayParam({
|
|
257
|
+
allowReserved,
|
|
258
|
+
explode: true,
|
|
259
|
+
name,
|
|
260
|
+
style: "form",
|
|
261
|
+
value,
|
|
262
|
+
...array
|
|
263
|
+
});
|
|
264
|
+
if (serializedArray) search.push(serializedArray);
|
|
265
|
+
} else if (typeof value === "object") {
|
|
266
|
+
const serializedObject = serializeObjectParam({
|
|
267
|
+
allowReserved,
|
|
268
|
+
explode: true,
|
|
269
|
+
name,
|
|
270
|
+
style: "deepObject",
|
|
271
|
+
value,
|
|
272
|
+
...object
|
|
273
|
+
});
|
|
274
|
+
if (serializedObject) search.push(serializedObject);
|
|
275
|
+
} else {
|
|
276
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
277
|
+
allowReserved,
|
|
278
|
+
name,
|
|
279
|
+
value
|
|
280
|
+
});
|
|
281
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return search.join("&");
|
|
286
|
+
}, "querySerializer");
|
|
287
|
+
return querySerializer;
|
|
288
|
+
}, "createQuerySerializer");
|
|
289
|
+
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
290
|
+
if (!contentType) {
|
|
291
|
+
return "stream";
|
|
292
|
+
}
|
|
293
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
294
|
+
if (!cleanContent) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
298
|
+
return "json";
|
|
299
|
+
}
|
|
300
|
+
if (cleanContent === "multipart/form-data") {
|
|
301
|
+
return "formData";
|
|
302
|
+
}
|
|
303
|
+
if ([
|
|
304
|
+
"application/",
|
|
305
|
+
"audio/",
|
|
306
|
+
"image/",
|
|
307
|
+
"video/"
|
|
308
|
+
].some((type) => cleanContent.startsWith(type))) {
|
|
309
|
+
return "blob";
|
|
310
|
+
}
|
|
311
|
+
if (cleanContent.startsWith("text/")) {
|
|
312
|
+
return "text";
|
|
313
|
+
}
|
|
314
|
+
}, "getParseAs");
|
|
315
|
+
var setAuthParams = /* @__PURE__ */ __name(async ({ security, ...options }) => {
|
|
316
|
+
for (const auth of security) {
|
|
317
|
+
const token = await getAuthToken(auth, options.auth);
|
|
318
|
+
if (!token) {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const name = auth.name ?? "Authorization";
|
|
322
|
+
switch (auth.in) {
|
|
323
|
+
case "query":
|
|
324
|
+
if (!options.query) {
|
|
325
|
+
options.query = {};
|
|
326
|
+
}
|
|
327
|
+
options.query[name] = token;
|
|
328
|
+
break;
|
|
329
|
+
case "cookie":
|
|
330
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
331
|
+
break;
|
|
332
|
+
case "header":
|
|
333
|
+
default:
|
|
334
|
+
options.headers.set(name, token);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
}, "setAuthParams");
|
|
340
|
+
var buildUrl = /* @__PURE__ */ __name((options) => {
|
|
341
|
+
const url = getUrl({
|
|
342
|
+
baseUrl: options.baseUrl,
|
|
343
|
+
path: options.path,
|
|
344
|
+
query: options.query,
|
|
345
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
346
|
+
url: options.url
|
|
347
|
+
});
|
|
348
|
+
return url;
|
|
349
|
+
}, "buildUrl");
|
|
350
|
+
var getUrl = /* @__PURE__ */ __name(({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
351
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
352
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
353
|
+
if (path) {
|
|
354
|
+
url = defaultPathSerializer({
|
|
355
|
+
path,
|
|
356
|
+
url
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
let search = query ? querySerializer(query) : "";
|
|
360
|
+
if (search.startsWith("?")) {
|
|
361
|
+
search = search.substring(1);
|
|
362
|
+
}
|
|
363
|
+
if (search) {
|
|
364
|
+
url += `?${search}`;
|
|
365
|
+
}
|
|
366
|
+
return url;
|
|
367
|
+
}, "getUrl");
|
|
368
|
+
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
369
|
+
const config = {
|
|
370
|
+
...a,
|
|
371
|
+
...b
|
|
372
|
+
};
|
|
373
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
374
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
375
|
+
}
|
|
376
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
377
|
+
return config;
|
|
378
|
+
}, "mergeConfigs");
|
|
379
|
+
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
380
|
+
const mergedHeaders = new Headers();
|
|
381
|
+
for (const header of headers) {
|
|
382
|
+
if (!header || typeof header !== "object") {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
const iterator = header instanceof Headers ? header.entries() : Object.entries(header);
|
|
386
|
+
for (const [key, value] of iterator) {
|
|
387
|
+
if (value === null) {
|
|
388
|
+
mergedHeaders.delete(key);
|
|
389
|
+
} else if (Array.isArray(value)) {
|
|
390
|
+
for (const v of value) {
|
|
391
|
+
mergedHeaders.append(key, v);
|
|
392
|
+
}
|
|
393
|
+
} else if (value !== void 0) {
|
|
394
|
+
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return mergedHeaders;
|
|
399
|
+
}, "mergeHeaders");
|
|
400
|
+
var Interceptors = class Interceptors2 {
|
|
401
|
+
static {
|
|
402
|
+
__name(this, "Interceptors");
|
|
403
|
+
}
|
|
404
|
+
_fns;
|
|
405
|
+
constructor() {
|
|
406
|
+
this._fns = [];
|
|
407
|
+
}
|
|
408
|
+
clear() {
|
|
409
|
+
this._fns = [];
|
|
410
|
+
}
|
|
411
|
+
getInterceptorIndex(id) {
|
|
412
|
+
if (typeof id === "number") {
|
|
413
|
+
return this._fns[id] ? id : -1;
|
|
414
|
+
} else {
|
|
415
|
+
return this._fns.indexOf(id);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
exists(id) {
|
|
419
|
+
const index = this.getInterceptorIndex(id);
|
|
420
|
+
return !!this._fns[index];
|
|
421
|
+
}
|
|
422
|
+
eject(id) {
|
|
423
|
+
const index = this.getInterceptorIndex(id);
|
|
424
|
+
if (this._fns[index]) {
|
|
425
|
+
this._fns[index] = null;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
update(id, fn) {
|
|
429
|
+
const index = this.getInterceptorIndex(id);
|
|
430
|
+
if (this._fns[index]) {
|
|
431
|
+
this._fns[index] = fn;
|
|
432
|
+
return id;
|
|
433
|
+
} else {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
use(fn) {
|
|
438
|
+
this._fns = [
|
|
439
|
+
...this._fns,
|
|
440
|
+
fn
|
|
441
|
+
];
|
|
442
|
+
return this._fns.length - 1;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
var createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
446
|
+
error: new Interceptors(),
|
|
447
|
+
request: new Interceptors(),
|
|
448
|
+
response: new Interceptors()
|
|
449
|
+
}), "createInterceptors");
|
|
450
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
451
|
+
allowReserved: false,
|
|
452
|
+
array: {
|
|
453
|
+
explode: true,
|
|
454
|
+
style: "form"
|
|
455
|
+
},
|
|
456
|
+
object: {
|
|
457
|
+
explode: true,
|
|
458
|
+
style: "deepObject"
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
var defaultHeaders = {
|
|
462
|
+
"Content-Type": "application/json"
|
|
463
|
+
};
|
|
464
|
+
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
465
|
+
...jsonBodySerializer,
|
|
466
|
+
headers: defaultHeaders,
|
|
467
|
+
parseAs: "auto",
|
|
468
|
+
querySerializer: defaultQuerySerializer,
|
|
469
|
+
...override
|
|
470
|
+
}), "createConfig");
|
|
471
|
+
|
|
472
|
+
// src/client/client/client.ts
|
|
473
|
+
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
474
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
475
|
+
const getConfig = /* @__PURE__ */ __name(() => ({
|
|
476
|
+
..._config
|
|
477
|
+
}), "getConfig");
|
|
478
|
+
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
479
|
+
_config = mergeConfigs(_config, config2);
|
|
480
|
+
return getConfig();
|
|
481
|
+
}, "setConfig");
|
|
482
|
+
const interceptors = createInterceptors();
|
|
483
|
+
const request = /* @__PURE__ */ __name(async (options) => {
|
|
484
|
+
const opts = {
|
|
485
|
+
..._config,
|
|
486
|
+
...options,
|
|
487
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
488
|
+
headers: mergeHeaders(_config.headers, options.headers)
|
|
489
|
+
};
|
|
490
|
+
if (opts.security) {
|
|
491
|
+
await setAuthParams({
|
|
492
|
+
...opts,
|
|
493
|
+
security: opts.security
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
if (opts.body && opts.bodySerializer) {
|
|
497
|
+
opts.body = opts.bodySerializer(opts.body);
|
|
498
|
+
}
|
|
499
|
+
if (opts.body === void 0 || opts.body === "") {
|
|
500
|
+
opts.headers.delete("Content-Type");
|
|
501
|
+
}
|
|
502
|
+
const url = buildUrl(opts);
|
|
503
|
+
const requestInit = {
|
|
504
|
+
redirect: "follow",
|
|
505
|
+
...opts
|
|
506
|
+
};
|
|
507
|
+
let request2 = new Request(url, requestInit);
|
|
508
|
+
for (const fn of interceptors.request._fns) {
|
|
509
|
+
if (fn) {
|
|
510
|
+
request2 = await fn(request2, opts);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const _fetch = opts.fetch;
|
|
514
|
+
let response = await _fetch(request2);
|
|
515
|
+
for (const fn of interceptors.response._fns) {
|
|
516
|
+
if (fn) {
|
|
517
|
+
response = await fn(response, request2, opts);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const result = {
|
|
521
|
+
request: request2,
|
|
522
|
+
response
|
|
523
|
+
};
|
|
524
|
+
if (response.ok) {
|
|
525
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
526
|
+
return opts.responseStyle === "data" ? {} : {
|
|
527
|
+
data: {},
|
|
528
|
+
...result
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
532
|
+
if (parseAs === "stream") {
|
|
533
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
534
|
+
data: response.body,
|
|
535
|
+
...result
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
let data = await response[parseAs]();
|
|
539
|
+
if (parseAs === "json") {
|
|
540
|
+
if (opts.responseValidator) {
|
|
541
|
+
await opts.responseValidator(data);
|
|
542
|
+
}
|
|
543
|
+
if (opts.responseTransformer) {
|
|
544
|
+
data = await opts.responseTransformer(data);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return opts.responseStyle === "data" ? data : {
|
|
548
|
+
data,
|
|
549
|
+
...result
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
let error = await response.text();
|
|
553
|
+
try {
|
|
554
|
+
error = JSON.parse(error);
|
|
555
|
+
} catch {
|
|
556
|
+
}
|
|
557
|
+
let finalError = error;
|
|
558
|
+
for (const fn of interceptors.error._fns) {
|
|
559
|
+
if (fn) {
|
|
560
|
+
finalError = await fn(error, response, request2, opts);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
finalError = finalError || {};
|
|
564
|
+
if (opts.throwOnError) {
|
|
565
|
+
throw finalError;
|
|
566
|
+
}
|
|
567
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
568
|
+
error: finalError,
|
|
569
|
+
...result
|
|
570
|
+
};
|
|
571
|
+
}, "request");
|
|
572
|
+
return {
|
|
573
|
+
buildUrl,
|
|
574
|
+
connect: /* @__PURE__ */ __name((options) => request({
|
|
575
|
+
...options,
|
|
576
|
+
method: "CONNECT"
|
|
577
|
+
}), "connect"),
|
|
578
|
+
delete: /* @__PURE__ */ __name((options) => request({
|
|
579
|
+
...options,
|
|
580
|
+
method: "DELETE"
|
|
581
|
+
}), "delete"),
|
|
582
|
+
get: /* @__PURE__ */ __name((options) => request({
|
|
583
|
+
...options,
|
|
584
|
+
method: "GET"
|
|
585
|
+
}), "get"),
|
|
586
|
+
getConfig,
|
|
587
|
+
head: /* @__PURE__ */ __name((options) => request({
|
|
588
|
+
...options,
|
|
589
|
+
method: "HEAD"
|
|
590
|
+
}), "head"),
|
|
591
|
+
interceptors,
|
|
592
|
+
options: /* @__PURE__ */ __name((options) => request({
|
|
593
|
+
...options,
|
|
594
|
+
method: "OPTIONS"
|
|
595
|
+
}), "options"),
|
|
596
|
+
patch: /* @__PURE__ */ __name((options) => request({
|
|
597
|
+
...options,
|
|
598
|
+
method: "PATCH"
|
|
599
|
+
}), "patch"),
|
|
600
|
+
post: /* @__PURE__ */ __name((options) => request({
|
|
601
|
+
...options,
|
|
602
|
+
method: "POST"
|
|
603
|
+
}), "post"),
|
|
604
|
+
put: /* @__PURE__ */ __name((options) => request({
|
|
605
|
+
...options,
|
|
606
|
+
method: "PUT"
|
|
607
|
+
}), "put"),
|
|
608
|
+
request,
|
|
609
|
+
setConfig,
|
|
610
|
+
trace: /* @__PURE__ */ __name((options) => request({
|
|
611
|
+
...options,
|
|
612
|
+
method: "TRACE"
|
|
613
|
+
}), "trace")
|
|
614
|
+
};
|
|
615
|
+
}, "createClient");
|
|
616
|
+
|
|
50
617
|
// src/client/client.gen.ts
|
|
51
|
-
var
|
|
52
|
-
var client = (0, import_client_fetch.createClient)((0, import_client_fetch.createConfig)());
|
|
618
|
+
var client = createClient(createConfig());
|
|
53
619
|
|
|
54
620
|
// src/client/sdk.gen.ts
|
|
55
621
|
var appControllerGetHello = /* @__PURE__ */ __name((options) => {
|
|
@@ -76,7 +642,7 @@ var rewardsControllerDepositRewards = /* @__PURE__ */ __name((options) => {
|
|
|
76
642
|
...options,
|
|
77
643
|
headers: {
|
|
78
644
|
"Content-Type": "application/json",
|
|
79
|
-
...options
|
|
645
|
+
...options.headers
|
|
80
646
|
}
|
|
81
647
|
});
|
|
82
648
|
}, "rewardsControllerDepositRewards");
|
|
@@ -92,7 +658,7 @@ var rewardsControllerDistributeRewards = /* @__PURE__ */ __name((options) => {
|
|
|
92
658
|
...options,
|
|
93
659
|
headers: {
|
|
94
660
|
"Content-Type": "application/json",
|
|
95
|
-
...options
|
|
661
|
+
...options.headers
|
|
96
662
|
}
|
|
97
663
|
});
|
|
98
664
|
}, "rewardsControllerDistributeRewards");
|
|
@@ -108,7 +674,7 @@ var apiTokenControllerCreateToken = /* @__PURE__ */ __name((options) => {
|
|
|
108
674
|
...options,
|
|
109
675
|
headers: {
|
|
110
676
|
"Content-Type": "application/json",
|
|
111
|
-
...options
|
|
677
|
+
...options.headers
|
|
112
678
|
}
|
|
113
679
|
});
|
|
114
680
|
}, "apiTokenControllerCreateToken");
|
|
@@ -148,7 +714,7 @@ var apiTokenControllerUpdateToken = /* @__PURE__ */ __name((options) => {
|
|
|
148
714
|
...options,
|
|
149
715
|
headers: {
|
|
150
716
|
"Content-Type": "application/json",
|
|
151
|
-
...options
|
|
717
|
+
...options.headers
|
|
152
718
|
}
|
|
153
719
|
});
|
|
154
720
|
}, "apiTokenControllerUpdateToken");
|
|
@@ -164,10 +730,22 @@ var quotesControllerCreateQuote = /* @__PURE__ */ __name((options) => {
|
|
|
164
730
|
...options,
|
|
165
731
|
headers: {
|
|
166
732
|
"Content-Type": "application/json",
|
|
167
|
-
...options
|
|
733
|
+
...options.headers
|
|
168
734
|
}
|
|
169
735
|
});
|
|
170
736
|
}, "quotesControllerCreateQuote");
|
|
737
|
+
var quotesControllerGetQuote = /* @__PURE__ */ __name((options) => {
|
|
738
|
+
return (options.client ?? client).get({
|
|
739
|
+
security: [
|
|
740
|
+
{
|
|
741
|
+
name: "x-api-token",
|
|
742
|
+
type: "apiKey"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
745
|
+
url: "/quotes/{id}",
|
|
746
|
+
...options
|
|
747
|
+
});
|
|
748
|
+
}, "quotesControllerGetQuote");
|
|
171
749
|
var flightsControllerGenerateFlightId = /* @__PURE__ */ __name((options) => {
|
|
172
750
|
return (options.client ?? client).get({
|
|
173
751
|
security: [
|
|
@@ -192,7 +770,7 @@ var flightsControllerCreatePresignedUrls = /* @__PURE__ */ __name((options) => {
|
|
|
192
770
|
...options,
|
|
193
771
|
headers: {
|
|
194
772
|
"Content-Type": "application/json",
|
|
195
|
-
...options
|
|
773
|
+
...options.headers
|
|
196
774
|
}
|
|
197
775
|
});
|
|
198
776
|
}, "flightsControllerCreatePresignedUrls");
|
|
@@ -208,10 +786,16 @@ var flightsControllerValidateFlight = /* @__PURE__ */ __name((options) => {
|
|
|
208
786
|
...options,
|
|
209
787
|
headers: {
|
|
210
788
|
"Content-Type": "application/json",
|
|
211
|
-
...options
|
|
789
|
+
...options.headers
|
|
212
790
|
}
|
|
213
791
|
});
|
|
214
792
|
}, "flightsControllerValidateFlight");
|
|
793
|
+
var conditionsControllerGetSunAltitudeTimeLimits = /* @__PURE__ */ __name((options) => {
|
|
794
|
+
return (options.client ?? client).get({
|
|
795
|
+
url: "/conditions/sun-altitude",
|
|
796
|
+
...options
|
|
797
|
+
});
|
|
798
|
+
}, "conditionsControllerGetSunAltitudeTimeLimits");
|
|
215
799
|
var schemaControllerGetEventSchema = /* @__PURE__ */ __name((options) => {
|
|
216
800
|
return (options?.client ?? client).get({
|
|
217
801
|
url: "/schema/event",
|
|
@@ -242,7 +826,7 @@ var webhooksControllerCreate = /* @__PURE__ */ __name((options) => {
|
|
|
242
826
|
...options,
|
|
243
827
|
headers: {
|
|
244
828
|
"Content-Type": "application/json",
|
|
245
|
-
...options
|
|
829
|
+
...options.headers
|
|
246
830
|
}
|
|
247
831
|
});
|
|
248
832
|
}, "webhooksControllerCreate");
|
|
@@ -282,7 +866,7 @@ var webhooksControllerUpdate = /* @__PURE__ */ __name((options) => {
|
|
|
282
866
|
...options,
|
|
283
867
|
headers: {
|
|
284
868
|
"Content-Type": "application/json",
|
|
285
|
-
...options
|
|
869
|
+
...options.headers
|
|
286
870
|
}
|
|
287
871
|
});
|
|
288
872
|
}, "webhooksControllerUpdate");
|
|
@@ -378,12 +962,15 @@ __name(getSecretHeader, "getSecretHeader");
|
|
|
378
962
|
apiTokenControllerGetToken,
|
|
379
963
|
apiTokenControllerUpdateToken,
|
|
380
964
|
appControllerGetHello,
|
|
965
|
+
client,
|
|
966
|
+
conditionsControllerGetSunAltitudeTimeLimits,
|
|
381
967
|
flightsControllerCreatePresignedUrls,
|
|
382
968
|
flightsControllerGenerateFlightId,
|
|
383
969
|
flightsControllerValidateFlight,
|
|
384
970
|
keysControllerGetProvenanceCryptoKey,
|
|
385
971
|
parseWebhookEvent,
|
|
386
972
|
quotesControllerCreateQuote,
|
|
973
|
+
quotesControllerGetQuote,
|
|
387
974
|
rewardsControllerDepositRewards,
|
|
388
975
|
rewardsControllerDistributeRewards,
|
|
389
976
|
schemaControllerGetEventSchema,
|