@reverbia/sdk 1.0.0 → 1.1.0-next.20251230221037

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 (110) hide show
  1. package/README.md +290 -45
  2. package/dist/expo/index.cjs +3428 -0
  3. package/dist/expo/index.d.mts +1217 -0
  4. package/dist/expo/index.d.ts +1217 -0
  5. package/dist/expo/index.mjs +3395 -0
  6. package/dist/index.cjs +972 -0
  7. package/dist/index.d.mts +1514 -0
  8. package/dist/index.d.ts +1514 -0
  9. package/dist/index.mjs +934 -0
  10. package/dist/next/index.cjs +64 -0
  11. package/dist/next/index.d.mts +23 -0
  12. package/dist/next/index.d.ts +23 -0
  13. package/dist/next/index.mjs +39 -0
  14. package/dist/polyfills/index.cjs +61 -0
  15. package/dist/polyfills/index.d.mts +9 -0
  16. package/dist/polyfills/index.d.ts +9 -0
  17. package/dist/polyfills/index.mjs +34 -0
  18. package/dist/react/chunk-KUFGQF6E.mjs +290 -0
  19. package/dist/react/chunk-T56Y62G7.mjs +410 -0
  20. package/dist/react/index.cjs +7982 -0
  21. package/dist/react/index.d.mts +3139 -0
  22. package/dist/react/index.d.ts +3139 -0
  23. package/dist/react/index.mjs +7209 -0
  24. package/dist/react/storage-Z2NBANCK.mjs +29 -0
  25. package/dist/react/useEncryption-5RTXKDNZ.mjs +31 -0
  26. package/dist/vercel/index.cjs +86 -0
  27. package/dist/vercel/index.d.mts +119 -0
  28. package/dist/vercel/index.d.ts +119 -0
  29. package/dist/vercel/index.mjs +57 -0
  30. package/package.json +91 -16
  31. package/dist/cjs/client/client/client.gen.d.ts +0 -2
  32. package/dist/cjs/client/client/client.gen.js +0 -203
  33. package/dist/cjs/client/client/index.d.ts +0 -8
  34. package/dist/cjs/client/client/index.js +0 -16
  35. package/dist/cjs/client/client/types.gen.d.ts +0 -99
  36. package/dist/cjs/client/client/types.gen.js +0 -3
  37. package/dist/cjs/client/client/utils.gen.d.ts +0 -40
  38. package/dist/cjs/client/client/utils.gen.js +0 -314
  39. package/dist/cjs/client/client.gen.d.ts +0 -12
  40. package/dist/cjs/client/client.gen.js +0 -6
  41. package/dist/cjs/client/core/auth.gen.d.ts +0 -18
  42. package/dist/cjs/client/core/auth.gen.js +0 -18
  43. package/dist/cjs/client/core/bodySerializer.gen.d.ts +0 -25
  44. package/dist/cjs/client/core/bodySerializer.gen.js +0 -60
  45. package/dist/cjs/client/core/params.gen.d.ts +0 -43
  46. package/dist/cjs/client/core/params.gen.js +0 -104
  47. package/dist/cjs/client/core/pathSerializer.gen.d.ts +0 -33
  48. package/dist/cjs/client/core/pathSerializer.gen.js +0 -123
  49. package/dist/cjs/client/core/queryKeySerializer.gen.d.ts +0 -18
  50. package/dist/cjs/client/core/queryKeySerializer.gen.js +0 -105
  51. package/dist/cjs/client/core/serverSentEvents.gen.d.ts +0 -71
  52. package/dist/cjs/client/core/serverSentEvents.gen.js +0 -139
  53. package/dist/cjs/client/core/types.gen.d.ts +0 -78
  54. package/dist/cjs/client/core/types.gen.js +0 -3
  55. package/dist/cjs/client/core/utils.gen.d.ts +0 -19
  56. package/dist/cjs/client/core/utils.gen.js +0 -93
  57. package/dist/cjs/client/index.d.ts +0 -2
  58. package/dist/cjs/client/index.js +0 -18
  59. package/dist/cjs/client/sdk.gen.d.ts +0 -27
  60. package/dist/cjs/client/sdk.gen.js +0 -33
  61. package/dist/cjs/client/types.gen.d.ts +0 -120
  62. package/dist/cjs/client/types.gen.js +0 -3
  63. package/dist/esm/client/client/client.gen.d.ts +0 -2
  64. package/dist/esm/client/client/client.gen.js +0 -199
  65. package/dist/esm/client/client/index.d.ts +0 -8
  66. package/dist/esm/client/client/index.js +0 -6
  67. package/dist/esm/client/client/types.gen.d.ts +0 -99
  68. package/dist/esm/client/client/types.gen.js +0 -2
  69. package/dist/esm/client/client/utils.gen.d.ts +0 -40
  70. package/dist/esm/client/client/utils.gen.js +0 -302
  71. package/dist/esm/client/client.gen.d.ts +0 -12
  72. package/dist/esm/client/client.gen.js +0 -3
  73. package/dist/esm/client/core/auth.gen.d.ts +0 -18
  74. package/dist/esm/client/core/auth.gen.js +0 -14
  75. package/dist/esm/client/core/bodySerializer.gen.d.ts +0 -25
  76. package/dist/esm/client/core/bodySerializer.gen.js +0 -57
  77. package/dist/esm/client/core/params.gen.d.ts +0 -43
  78. package/dist/esm/client/core/params.gen.js +0 -100
  79. package/dist/esm/client/core/pathSerializer.gen.d.ts +0 -33
  80. package/dist/esm/client/core/pathSerializer.gen.js +0 -114
  81. package/dist/esm/client/core/queryKeySerializer.gen.d.ts +0 -18
  82. package/dist/esm/client/core/queryKeySerializer.gen.js +0 -99
  83. package/dist/esm/client/core/serverSentEvents.gen.d.ts +0 -71
  84. package/dist/esm/client/core/serverSentEvents.gen.js +0 -135
  85. package/dist/esm/client/core/types.gen.d.ts +0 -78
  86. package/dist/esm/client/core/types.gen.js +0 -2
  87. package/dist/esm/client/core/utils.gen.d.ts +0 -19
  88. package/dist/esm/client/core/utils.gen.js +0 -87
  89. package/dist/esm/client/index.d.ts +0 -2
  90. package/dist/esm/client/index.js +0 -2
  91. package/dist/esm/client/sdk.gen.d.ts +0 -27
  92. package/dist/esm/client/sdk.gen.js +0 -28
  93. package/dist/esm/client/types.gen.d.ts +0 -120
  94. package/dist/esm/client/types.gen.js +0 -2
  95. package/dist/types/client/client/client.gen.d.ts +0 -2
  96. package/dist/types/client/client/index.d.ts +0 -8
  97. package/dist/types/client/client/types.gen.d.ts +0 -99
  98. package/dist/types/client/client/utils.gen.d.ts +0 -40
  99. package/dist/types/client/client.gen.d.ts +0 -12
  100. package/dist/types/client/core/auth.gen.d.ts +0 -18
  101. package/dist/types/client/core/bodySerializer.gen.d.ts +0 -25
  102. package/dist/types/client/core/params.gen.d.ts +0 -43
  103. package/dist/types/client/core/pathSerializer.gen.d.ts +0 -33
  104. package/dist/types/client/core/queryKeySerializer.gen.d.ts +0 -18
  105. package/dist/types/client/core/serverSentEvents.gen.d.ts +0 -71
  106. package/dist/types/client/core/types.gen.d.ts +0 -78
  107. package/dist/types/client/core/utils.gen.d.ts +0 -19
  108. package/dist/types/client/index.d.ts +0 -2
  109. package/dist/types/client/sdk.gen.d.ts +0 -27
  110. package/dist/types/client/types.gen.d.ts +0 -120
@@ -1,12 +0,0 @@
1
- import { type ClientOptions, type Config } from './client';
2
- import type { ClientOptions as ClientOptions2 } from './types.gen';
3
- /**
4
- * The `createClientConfig()` function will be called on client initialization
5
- * and the returned object will become the client's initial configuration.
6
- *
7
- * You may want to initialize your client this way instead of calling
8
- * `setConfig()`. This is useful for example if you're using Next.js
9
- * to ensure your client always has the correct values.
10
- */
11
- export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
12
- export declare const client: import("./client").Client;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.client = void 0;
5
- const client_1 = require("./client");
6
- exports.client = (0, client_1.createClient)((0, client_1.createConfig)());
@@ -1,18 +0,0 @@
1
- export type AuthToken = string | undefined;
2
- export interface Auth {
3
- /**
4
- * Which part of the request do we use to send the auth?
5
- *
6
- * @default 'header'
7
- */
8
- in?: 'header' | 'query' | 'cookie';
9
- /**
10
- * Header or query parameter name.
11
- *
12
- * @default 'Authorization'
13
- */
14
- name?: string;
15
- scheme?: 'basic' | 'bearer';
16
- type: 'apiKey' | 'http';
17
- }
18
- export declare const getAuthToken: (auth: Auth, callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken) => Promise<string | undefined>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getAuthToken = void 0;
5
- const getAuthToken = async (auth, callback) => {
6
- const token = typeof callback === 'function' ? await callback(auth) : callback;
7
- if (!token) {
8
- return;
9
- }
10
- if (auth.scheme === 'bearer') {
11
- return `Bearer ${token}`;
12
- }
13
- if (auth.scheme === 'basic') {
14
- return `Basic ${btoa(token)}`;
15
- }
16
- return token;
17
- };
18
- exports.getAuthToken = getAuthToken;
@@ -1,25 +0,0 @@
1
- import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';
2
- export type QuerySerializer = (query: Record<string, unknown>) => string;
3
- export type BodySerializer = (body: any) => any;
4
- type QuerySerializerOptionsObject = {
5
- allowReserved?: boolean;
6
- array?: Partial<SerializerOptions<ArrayStyle>>;
7
- object?: Partial<SerializerOptions<ObjectStyle>>;
8
- };
9
- export type QuerySerializerOptions = QuerySerializerOptionsObject & {
10
- /**
11
- * Per-parameter serialization overrides. When provided, these settings
12
- * override the global array/object settings for specific parameter names.
13
- */
14
- parameters?: Record<string, QuerySerializerOptionsObject>;
15
- };
16
- export declare const formDataBodySerializer: {
17
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData;
18
- };
19
- export declare const jsonBodySerializer: {
20
- bodySerializer: <T>(body: T) => string;
21
- };
22
- export declare const urlSearchParamsBodySerializer: {
23
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string;
24
- };
25
- export {};
@@ -1,60 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.urlSearchParamsBodySerializer = exports.jsonBodySerializer = exports.formDataBodySerializer = void 0;
5
- const serializeFormDataPair = (data, key, value) => {
6
- if (typeof value === 'string' || value instanceof Blob) {
7
- data.append(key, value);
8
- }
9
- else if (value instanceof Date) {
10
- data.append(key, value.toISOString());
11
- }
12
- else {
13
- data.append(key, JSON.stringify(value));
14
- }
15
- };
16
- const serializeUrlSearchParamsPair = (data, key, value) => {
17
- if (typeof value === 'string') {
18
- data.append(key, value);
19
- }
20
- else {
21
- data.append(key, JSON.stringify(value));
22
- }
23
- };
24
- exports.formDataBodySerializer = {
25
- bodySerializer: (body) => {
26
- const data = new FormData();
27
- Object.entries(body).forEach(([key, value]) => {
28
- if (value === undefined || value === null) {
29
- return;
30
- }
31
- if (Array.isArray(value)) {
32
- value.forEach((v) => serializeFormDataPair(data, key, v));
33
- }
34
- else {
35
- serializeFormDataPair(data, key, value);
36
- }
37
- });
38
- return data;
39
- },
40
- };
41
- exports.jsonBodySerializer = {
42
- bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === 'bigint' ? value.toString() : value),
43
- };
44
- exports.urlSearchParamsBodySerializer = {
45
- bodySerializer: (body) => {
46
- const data = new URLSearchParams();
47
- Object.entries(body).forEach(([key, value]) => {
48
- if (value === undefined || value === null) {
49
- return;
50
- }
51
- if (Array.isArray(value)) {
52
- value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
53
- }
54
- else {
55
- serializeUrlSearchParamsPair(data, key, value);
56
- }
57
- });
58
- return data.toString();
59
- },
60
- };
@@ -1,43 +0,0 @@
1
- type Slot = 'body' | 'headers' | 'path' | 'query';
2
- export type Field = {
3
- in: Exclude<Slot, 'body'>;
4
- /**
5
- * Field name. This is the name we want the user to see and use.
6
- */
7
- key: string;
8
- /**
9
- * Field mapped name. This is the name we want to use in the request.
10
- * If omitted, we use the same value as `key`.
11
- */
12
- map?: string;
13
- } | {
14
- in: Extract<Slot, 'body'>;
15
- /**
16
- * Key isn't required for bodies.
17
- */
18
- key?: string;
19
- map?: string;
20
- } | {
21
- /**
22
- * Field name. This is the name we want the user to see and use.
23
- */
24
- key: string;
25
- /**
26
- * Field mapped name. This is the name we want to use in the request.
27
- * If `in` is omitted, `map` aliases `key` to the transport layer.
28
- */
29
- map: Slot;
30
- };
31
- export interface Fields {
32
- allowExtra?: Partial<Record<Slot, boolean>>;
33
- args?: ReadonlyArray<Field>;
34
- }
35
- export type FieldsConfig = ReadonlyArray<Field | Fields>;
36
- interface Params {
37
- body: unknown;
38
- headers: Record<string, unknown>;
39
- path: Record<string, unknown>;
40
- query: Record<string, unknown>;
41
- }
42
- export declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params;
43
- export {};
@@ -1,104 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.buildClientParams = void 0;
5
- const extraPrefixesMap = {
6
- $body_: 'body',
7
- $headers_: 'headers',
8
- $path_: 'path',
9
- $query_: 'query',
10
- };
11
- const extraPrefixes = Object.entries(extraPrefixesMap);
12
- const buildKeyMap = (fields, map) => {
13
- if (!map) {
14
- map = new Map();
15
- }
16
- for (const config of fields) {
17
- if ('in' in config) {
18
- if (config.key) {
19
- map.set(config.key, {
20
- in: config.in,
21
- map: config.map,
22
- });
23
- }
24
- }
25
- else if ('key' in config) {
26
- map.set(config.key, {
27
- map: config.map,
28
- });
29
- }
30
- else if (config.args) {
31
- buildKeyMap(config.args, map);
32
- }
33
- }
34
- return map;
35
- };
36
- const stripEmptySlots = (params) => {
37
- for (const [slot, value] of Object.entries(params)) {
38
- if (value && typeof value === 'object' && !Object.keys(value).length) {
39
- delete params[slot];
40
- }
41
- }
42
- };
43
- const buildClientParams = (args, fields) => {
44
- const params = {
45
- body: {},
46
- headers: {},
47
- path: {},
48
- query: {},
49
- };
50
- const map = buildKeyMap(fields);
51
- let config;
52
- for (const [index, arg] of args.entries()) {
53
- if (fields[index]) {
54
- config = fields[index];
55
- }
56
- if (!config) {
57
- continue;
58
- }
59
- if ('in' in config) {
60
- if (config.key) {
61
- const field = map.get(config.key);
62
- const name = field.map || config.key;
63
- if (field.in) {
64
- params[field.in][name] = arg;
65
- }
66
- }
67
- else {
68
- params.body = arg;
69
- }
70
- }
71
- else {
72
- for (const [key, value] of Object.entries(arg ?? {})) {
73
- const field = map.get(key);
74
- if (field) {
75
- if (field.in) {
76
- const name = field.map || key;
77
- params[field.in][name] = value;
78
- }
79
- else {
80
- params[field.map] = value;
81
- }
82
- }
83
- else {
84
- const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
85
- if (extra) {
86
- const [prefix, slot] = extra;
87
- params[slot][key.slice(prefix.length)] = value;
88
- }
89
- else if ('allowExtra' in config && config.allowExtra) {
90
- for (const [slot, allowed] of Object.entries(config.allowExtra)) {
91
- if (allowed) {
92
- params[slot][key] = value;
93
- break;
94
- }
95
- }
96
- }
97
- }
98
- }
99
- }
100
- }
101
- stripEmptySlots(params);
102
- return params;
103
- };
104
- exports.buildClientParams = buildClientParams;
@@ -1,33 +0,0 @@
1
- interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {
2
- }
3
- interface SerializePrimitiveOptions {
4
- allowReserved?: boolean;
5
- name: string;
6
- }
7
- export interface SerializerOptions<T> {
8
- /**
9
- * @default true
10
- */
11
- explode: boolean;
12
- style: T;
13
- }
14
- export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
15
- export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
16
- type MatrixStyle = 'label' | 'matrix' | 'simple';
17
- export type ObjectStyle = 'form' | 'deepObject';
18
- type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
19
- interface SerializePrimitiveParam extends SerializePrimitiveOptions {
20
- value: string;
21
- }
22
- export declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "." | ";" | "," | "&";
23
- export declare const separatorArrayNoExplode: (style: ArraySeparatorStyle) => "," | "|" | "%20";
24
- export declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "." | ";" | "," | "&";
25
- export declare const serializeArrayParam: ({ allowReserved, explode, name, style, value, }: SerializeOptions<ArraySeparatorStyle> & {
26
- value: unknown[];
27
- }) => string;
28
- export declare const serializePrimitiveParam: ({ allowReserved, name, value, }: SerializePrimitiveParam) => string;
29
- export declare const serializeObjectParam: ({ allowReserved, explode, name, style, value, valueOnly, }: SerializeOptions<ObjectSeparatorStyle> & {
30
- value: Record<string, unknown> | Date;
31
- valueOnly?: boolean;
32
- }) => string;
33
- export {};
@@ -1,123 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serializeObjectParam = exports.serializePrimitiveParam = exports.serializeArrayParam = exports.separatorObjectExplode = exports.separatorArrayNoExplode = exports.separatorArrayExplode = void 0;
5
- const separatorArrayExplode = (style) => {
6
- switch (style) {
7
- case 'label':
8
- return '.';
9
- case 'matrix':
10
- return ';';
11
- case 'simple':
12
- return ',';
13
- default:
14
- return '&';
15
- }
16
- };
17
- exports.separatorArrayExplode = separatorArrayExplode;
18
- const separatorArrayNoExplode = (style) => {
19
- switch (style) {
20
- case 'form':
21
- return ',';
22
- case 'pipeDelimited':
23
- return '|';
24
- case 'spaceDelimited':
25
- return '%20';
26
- default:
27
- return ',';
28
- }
29
- };
30
- exports.separatorArrayNoExplode = separatorArrayNoExplode;
31
- const separatorObjectExplode = (style) => {
32
- switch (style) {
33
- case 'label':
34
- return '.';
35
- case 'matrix':
36
- return ';';
37
- case 'simple':
38
- return ',';
39
- default:
40
- return '&';
41
- }
42
- };
43
- exports.separatorObjectExplode = separatorObjectExplode;
44
- const serializeArrayParam = ({ allowReserved, explode, name, style, value, }) => {
45
- if (!explode) {
46
- const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join((0, exports.separatorArrayNoExplode)(style));
47
- switch (style) {
48
- case 'label':
49
- return `.${joinedValues}`;
50
- case 'matrix':
51
- return `;${name}=${joinedValues}`;
52
- case 'simple':
53
- return joinedValues;
54
- default:
55
- return `${name}=${joinedValues}`;
56
- }
57
- }
58
- const separator = (0, exports.separatorArrayExplode)(style);
59
- const joinedValues = value
60
- .map((v) => {
61
- if (style === 'label' || style === 'simple') {
62
- return allowReserved ? v : encodeURIComponent(v);
63
- }
64
- return (0, exports.serializePrimitiveParam)({
65
- allowReserved,
66
- name,
67
- value: v,
68
- });
69
- })
70
- .join(separator);
71
- return style === 'label' || style === 'matrix'
72
- ? separator + joinedValues
73
- : joinedValues;
74
- };
75
- exports.serializeArrayParam = serializeArrayParam;
76
- const serializePrimitiveParam = ({ allowReserved, name, value, }) => {
77
- if (value === undefined || value === null) {
78
- return '';
79
- }
80
- if (typeof value === 'object') {
81
- throw new Error('Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.');
82
- }
83
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
84
- };
85
- exports.serializePrimitiveParam = serializePrimitiveParam;
86
- const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly, }) => {
87
- if (value instanceof Date) {
88
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
89
- }
90
- if (style !== 'deepObject' && !explode) {
91
- let values = [];
92
- Object.entries(value).forEach(([key, v]) => {
93
- values = [
94
- ...values,
95
- key,
96
- allowReserved ? v : encodeURIComponent(v),
97
- ];
98
- });
99
- const joinedValues = values.join(',');
100
- switch (style) {
101
- case 'form':
102
- return `${name}=${joinedValues}`;
103
- case 'label':
104
- return `.${joinedValues}`;
105
- case 'matrix':
106
- return `;${name}=${joinedValues}`;
107
- default:
108
- return joinedValues;
109
- }
110
- }
111
- const separator = (0, exports.separatorObjectExplode)(style);
112
- const joinedValues = Object.entries(value)
113
- .map(([key, v]) => (0, exports.serializePrimitiveParam)({
114
- allowReserved,
115
- name: style === 'deepObject' ? `${name}[${key}]` : key,
116
- value: v,
117
- }))
118
- .join(separator);
119
- return style === 'label' || style === 'matrix'
120
- ? separator + joinedValues
121
- : joinedValues;
122
- };
123
- exports.serializeObjectParam = serializeObjectParam;
@@ -1,18 +0,0 @@
1
- /**
2
- * JSON-friendly union that mirrors what Pinia Colada can hash.
3
- */
4
- export type JsonValue = null | string | number | boolean | JsonValue[] | {
5
- [key: string]: JsonValue;
6
- };
7
- /**
8
- * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
9
- */
10
- export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => {} | null | undefined;
11
- /**
12
- * Safely stringifies a value and parses it back into a JsonValue.
13
- */
14
- export declare const stringifyToJsonValue: (input: unknown) => JsonValue | undefined;
15
- /**
16
- * Normalizes any accepted value into a JSON-friendly shape for query keys.
17
- */
18
- export declare const serializeQueryKeyValue: (value: unknown) => JsonValue | undefined;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serializeQueryKeyValue = exports.stringifyToJsonValue = exports.queryKeyJsonReplacer = void 0;
5
- /**
6
- * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
7
- */
8
- const queryKeyJsonReplacer = (_key, value) => {
9
- if (value === undefined ||
10
- typeof value === 'function' ||
11
- typeof value === 'symbol') {
12
- return undefined;
13
- }
14
- if (typeof value === 'bigint') {
15
- return value.toString();
16
- }
17
- if (value instanceof Date) {
18
- return value.toISOString();
19
- }
20
- return value;
21
- };
22
- exports.queryKeyJsonReplacer = queryKeyJsonReplacer;
23
- /**
24
- * Safely stringifies a value and parses it back into a JsonValue.
25
- */
26
- const stringifyToJsonValue = (input) => {
27
- try {
28
- const json = JSON.stringify(input, exports.queryKeyJsonReplacer);
29
- if (json === undefined) {
30
- return undefined;
31
- }
32
- return JSON.parse(json);
33
- }
34
- catch {
35
- return undefined;
36
- }
37
- };
38
- exports.stringifyToJsonValue = stringifyToJsonValue;
39
- /**
40
- * Detects plain objects (including objects with a null prototype).
41
- */
42
- const isPlainObject = (value) => {
43
- if (value === null || typeof value !== 'object') {
44
- return false;
45
- }
46
- const prototype = Object.getPrototypeOf(value);
47
- return prototype === Object.prototype || prototype === null;
48
- };
49
- /**
50
- * Turns URLSearchParams into a sorted JSON object for deterministic keys.
51
- */
52
- const serializeSearchParams = (params) => {
53
- const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
54
- const result = {};
55
- for (const [key, value] of entries) {
56
- const existing = result[key];
57
- if (existing === undefined) {
58
- result[key] = value;
59
- continue;
60
- }
61
- if (Array.isArray(existing)) {
62
- existing.push(value);
63
- }
64
- else {
65
- result[key] = [existing, value];
66
- }
67
- }
68
- return result;
69
- };
70
- /**
71
- * Normalizes any accepted value into a JSON-friendly shape for query keys.
72
- */
73
- const serializeQueryKeyValue = (value) => {
74
- if (value === null) {
75
- return null;
76
- }
77
- if (typeof value === 'string' ||
78
- typeof value === 'number' ||
79
- typeof value === 'boolean') {
80
- return value;
81
- }
82
- if (value === undefined ||
83
- typeof value === 'function' ||
84
- typeof value === 'symbol') {
85
- return undefined;
86
- }
87
- if (typeof value === 'bigint') {
88
- return value.toString();
89
- }
90
- if (value instanceof Date) {
91
- return value.toISOString();
92
- }
93
- if (Array.isArray(value)) {
94
- return (0, exports.stringifyToJsonValue)(value);
95
- }
96
- if (typeof URLSearchParams !== 'undefined' &&
97
- value instanceof URLSearchParams) {
98
- return serializeSearchParams(value);
99
- }
100
- if (isPlainObject(value)) {
101
- return (0, exports.stringifyToJsonValue)(value);
102
- }
103
- return undefined;
104
- };
105
- exports.serializeQueryKeyValue = serializeQueryKeyValue;
@@ -1,71 +0,0 @@
1
- import type { Config } from './types.gen';
2
- export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
3
- /**
4
- * Fetch API implementation. You can use this option to provide a custom
5
- * fetch instance.
6
- *
7
- * @default globalThis.fetch
8
- */
9
- fetch?: typeof fetch;
10
- /**
11
- * Implementing clients can call request interceptors inside this hook.
12
- */
13
- onRequest?: (url: string, init: RequestInit) => Promise<Request>;
14
- /**
15
- * Callback invoked when a network or parsing error occurs during streaming.
16
- *
17
- * This option applies only if the endpoint returns a stream of events.
18
- *
19
- * @param error The error that occurred.
20
- */
21
- onSseError?: (error: unknown) => void;
22
- /**
23
- * Callback invoked when an event is streamed from the server.
24
- *
25
- * This option applies only if the endpoint returns a stream of events.
26
- *
27
- * @param event Event streamed from the server.
28
- * @returns Nothing (void).
29
- */
30
- onSseEvent?: (event: StreamEvent<TData>) => void;
31
- serializedBody?: RequestInit['body'];
32
- /**
33
- * Default retry delay in milliseconds.
34
- *
35
- * This option applies only if the endpoint returns a stream of events.
36
- *
37
- * @default 3000
38
- */
39
- sseDefaultRetryDelay?: number;
40
- /**
41
- * Maximum number of retry attempts before giving up.
42
- */
43
- sseMaxRetryAttempts?: number;
44
- /**
45
- * Maximum retry delay in milliseconds.
46
- *
47
- * Applies only when exponential backoff is used.
48
- *
49
- * This option applies only if the endpoint returns a stream of events.
50
- *
51
- * @default 30000
52
- */
53
- sseMaxRetryDelay?: number;
54
- /**
55
- * Optional sleep function for retry backoff.
56
- *
57
- * Defaults to using `setTimeout`.
58
- */
59
- sseSleepFn?: (ms: number) => Promise<void>;
60
- url: string;
61
- };
62
- export interface StreamEvent<TData = unknown> {
63
- data: TData;
64
- event?: string;
65
- id?: string;
66
- retry?: number;
67
- }
68
- export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
69
- stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
70
- };
71
- export declare const createSseClient: <TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions) => ServerSentEventsResult<TData>;