@silvana-one/api 1.0.22 → 1.0.24

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