rehive 4.1.4 → 4.2.0
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/admin.d.mts +43 -106
- package/dist/admin.d.ts +43 -106
- package/dist/admin.js +1 -1
- package/dist/admin.mjs +1 -1
- package/dist/auth.d.mts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/{chunk-AVPKHYGS.js → chunk-7USVOK77.js} +5 -5
- package/dist/{chunk-X6YDNXYV.js → chunk-ERD2XKSM.js} +1 -1
- package/dist/chunk-G3M5QMRX.js +1 -0
- package/dist/chunk-HSPTEN45.mjs +1 -0
- package/dist/chunk-HWXE5WBF.js +7 -0
- package/dist/chunk-MUN3POSM.mjs +7 -0
- package/dist/{chunk-4WSHB6U6.mjs → chunk-PCR54D6A.mjs} +1 -1
- package/dist/chunk-ZUZHOLAX.mjs +7 -0
- package/dist/{create-api-client-ebyTfhcm.d.ts → create-api-client-ADSlg8HX.d.ts} +1 -1
- package/dist/{create-api-client-C-LEZku2.d.mts → create-api-client-B4Q01gHp.d.mts} +1 -1
- package/dist/{create-auth-DsnHpEf0.d.mts → create-auth-CT_IFt3T.d.mts} +53 -47
- package/dist/{create-auth-DsnHpEf0.d.ts → create-auth-CT_IFt3T.d.ts} +53 -47
- package/dist/extensions/alchemy.d.mts +3 -3
- package/dist/extensions/alchemy.d.ts +3 -3
- package/dist/extensions/alchemy.js +5 -5
- package/dist/extensions/alchemy.mjs +5 -5
- package/dist/extensions/app.d.mts +3 -3
- package/dist/extensions/app.d.ts +3 -3
- package/dist/extensions/app.js +5 -5
- package/dist/extensions/app.mjs +5 -5
- package/dist/extensions/billing.d.mts +3 -3
- package/dist/extensions/billing.d.ts +3 -3
- package/dist/extensions/billing.js +5 -5
- package/dist/extensions/billing.mjs +5 -5
- package/dist/extensions/bridge.d.mts +16 -190
- package/dist/extensions/bridge.d.ts +16 -190
- package/dist/extensions/bridge.js +5 -5
- package/dist/extensions/bridge.mjs +5 -5
- package/dist/extensions/builder.d.mts +3 -3
- package/dist/extensions/builder.d.ts +3 -3
- package/dist/extensions/builder.js +5 -5
- package/dist/extensions/builder.mjs +5 -5
- package/dist/extensions/business.d.mts +47 -82
- package/dist/extensions/business.d.ts +47 -82
- package/dist/extensions/business.js +5 -5
- package/dist/extensions/business.mjs +5 -5
- package/dist/extensions/conversion.d.mts +3 -3
- package/dist/extensions/conversion.d.ts +3 -3
- package/dist/extensions/conversion.js +5 -5
- package/dist/extensions/conversion.mjs +5 -5
- package/dist/extensions/mass-send.d.mts +3 -3
- package/dist/extensions/mass-send.d.ts +3 -3
- package/dist/extensions/mass-send.js +5 -5
- package/dist/extensions/mass-send.mjs +5 -5
- package/dist/extensions/notifications.d.mts +3 -3
- package/dist/extensions/notifications.d.ts +3 -3
- package/dist/extensions/notifications.js +5 -5
- package/dist/extensions/notifications.mjs +5 -5
- package/dist/extensions/payment-requests.d.mts +3 -7
- package/dist/extensions/payment-requests.d.ts +3 -7
- package/dist/extensions/payment-requests.js +5 -5
- package/dist/extensions/payment-requests.mjs +5 -5
- package/dist/extensions/products.d.mts +3 -3
- package/dist/extensions/products.d.ts +3 -3
- package/dist/extensions/products.js +5 -5
- package/dist/extensions/products.mjs +5 -5
- package/dist/extensions/rain.d.mts +3 -3
- package/dist/extensions/rain.d.ts +3 -3
- package/dist/extensions/rain.js +5 -5
- package/dist/extensions/rain.mjs +5 -5
- package/dist/extensions/rewards.d.mts +3 -3
- package/dist/extensions/rewards.d.ts +3 -3
- package/dist/extensions/rewards.js +5 -5
- package/dist/extensions/rewards.mjs +5 -5
- package/dist/extensions/stellar-testnet.d.mts +3 -3
- package/dist/extensions/stellar-testnet.d.ts +3 -3
- package/dist/extensions/stellar-testnet.js +5 -5
- package/dist/extensions/stellar-testnet.mjs +5 -5
- package/dist/extensions/stellar.d.mts +3 -3
- package/dist/extensions/stellar.d.ts +3 -3
- package/dist/extensions/stellar.js +5 -5
- package/dist/extensions/stellar.mjs +5 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +11 -3
- package/dist/react.d.ts +11 -3
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/user.d.mts +6 -16
- package/dist/user.d.ts +6 -16
- package/dist/user.js +1 -1
- package/dist/user.mjs +1 -1
- package/package.json +1 -1
- package/src/auth/create-auth.ts +773 -169
- package/src/auth/index.ts +25 -2
- package/src/auth/types/index.ts +48 -0
- package/src/extensions/alchemy/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/alchemy/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/alchemy/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/app/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/app/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/app/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/billing/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/billing/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/billing/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/bridge/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/bridge/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/bridge/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/bridge/openapi-ts/index.ts +2 -2
- package/src/extensions/bridge/openapi-ts/sdk.gen.ts +1 -43
- package/src/extensions/bridge/openapi-ts/types.gen.ts +11 -201
- package/src/extensions/builder/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/builder/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/builder/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/business/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/business/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/business/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/business/openapi-ts/types.gen.ts +44 -79
- package/src/extensions/conversion/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/conversion/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/conversion/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/mass-send/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/mass-send/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/mass-send/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/notifications/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/notifications/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/notifications/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/payment-requests/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/payment-requests/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/payment-requests/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/payment-requests/openapi-ts/types.gen.ts +0 -4
- package/src/extensions/products/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/products/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/products/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/rain/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/rain/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/rain/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/rewards/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/rewards/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/rewards/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/stellar/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/stellar/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/stellar/openapi-ts/core/params.gen.ts +1 -1
- package/src/extensions/stellar-testnet/openapi-ts/client/client.gen.ts +3 -5
- package/src/extensions/stellar-testnet/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/extensions/stellar-testnet/openapi-ts/core/params.gen.ts +1 -1
- package/src/platform/admin/openapi-ts/client/client.gen.ts +3 -5
- package/src/platform/admin/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/platform/admin/openapi-ts/core/params.gen.ts +1 -1
- package/src/platform/admin/openapi-ts/sdk.gen.ts +10 -10
- package/src/platform/admin/openapi-ts/types.gen.ts +40 -103
- package/src/platform/user/openapi-ts/client/client.gen.ts +3 -5
- package/src/platform/user/openapi-ts/core/bodySerializer.gen.ts +8 -6
- package/src/platform/user/openapi-ts/core/params.gen.ts +1 -1
- package/src/platform/user/openapi-ts/index.ts +2 -2
- package/src/platform/user/openapi-ts/sdk.gen.ts +3 -29
- package/src/platform/user/openapi-ts/types.gen.ts +7 -54
- package/dist/chunk-KUT5NSX7.mjs +0 -7
- package/dist/chunk-KZWBOQHZ.mjs +0 -7
- package/dist/chunk-PE6PG7ZE.js +0 -1
- package/dist/chunk-UYYU5OJ4.js +0 -7
- package/dist/chunk-Z7BUNKND.mjs +0 -1
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -271,7 +271,6 @@ export type CompanyConfiguration = {
|
|
|
271
271
|
readonly request_notification_id: string | null;
|
|
272
272
|
reminder_default?: boolean;
|
|
273
273
|
request_param_config?: string | null;
|
|
274
|
-
generate_user_operational_accounts?: boolean;
|
|
275
274
|
};
|
|
276
275
|
|
|
277
276
|
export type CompanyConfigurationResponse = {
|
|
@@ -655,7 +654,6 @@ export type PatchedCompanyConfiguration = {
|
|
|
655
654
|
readonly request_notification_id?: string | null;
|
|
656
655
|
reminder_default?: boolean;
|
|
657
656
|
request_param_config?: string | null;
|
|
658
|
-
generate_user_operational_accounts?: boolean;
|
|
659
657
|
};
|
|
660
658
|
|
|
661
659
|
/**
|
|
@@ -1393,7 +1391,6 @@ export type CompanyConfigurationWritable = {
|
|
|
1393
1391
|
base_redirect_url?: string | null;
|
|
1394
1392
|
reminder_default?: boolean;
|
|
1395
1393
|
request_param_config?: string | null;
|
|
1396
|
-
generate_user_operational_accounts?: boolean;
|
|
1397
1394
|
};
|
|
1398
1395
|
|
|
1399
1396
|
export type CompanyConfigurationResponseWritable = {
|
|
@@ -1720,7 +1717,6 @@ export type PatchedCompanyConfigurationWritable = {
|
|
|
1720
1717
|
base_redirect_url?: string | null;
|
|
1721
1718
|
reminder_default?: boolean;
|
|
1722
1719
|
request_param_config?: string | null;
|
|
1723
|
-
generate_user_operational_accounts?: boolean;
|
|
1724
1720
|
};
|
|
1725
1721
|
|
|
1726
1722
|
/**
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
37
37
|
...options,
|
|
38
38
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
39
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
serializedBody: undefined
|
|
40
|
+
serializedBody: undefined,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
if (opts.security) {
|
|
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
55
|
-
opts.serializedBody = opts.bodySerializer(opts.body)
|
|
55
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -258,10 +258,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
262
|
-
|
|
263
261
|
return {
|
|
264
|
-
buildUrl
|
|
262
|
+
buildUrl,
|
|
265
263
|
connect: makeMethodFn('CONNECT'),
|
|
266
264
|
delete: makeMethodFn('DELETE'),
|
|
267
265
|
get: makeMethodFn('GET'),
|
|
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
4
4
|
|
|
5
5
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
6
6
|
|
|
7
|
-
export type BodySerializer = (body:
|
|
7
|
+
export type BodySerializer = (body: any) => any;
|
|
8
8
|
|
|
9
9
|
type QuerySerializerOptionsObject = {
|
|
10
10
|
allowReserved?: boolean;
|
|
@@ -39,10 +39,12 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const formDataBodySerializer = {
|
|
42
|
-
bodySerializer:
|
|
42
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
|
43
|
+
body: T,
|
|
44
|
+
): FormData => {
|
|
43
45
|
const data = new FormData();
|
|
44
46
|
|
|
45
|
-
Object.entries(body
|
|
47
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
46
48
|
if (value === undefined || value === null) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -58,15 +60,15 @@ export const formDataBodySerializer = {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer: (body:
|
|
63
|
+
bodySerializer: <T>(body: T): string =>
|
|
62
64
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer: (body:
|
|
68
|
+
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
|
67
69
|
const data = new URLSearchParams();
|
|
68
70
|
|
|
69
|
-
Object.entries(body
|
|
71
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
70
72
|
if (value === undefined || value === null) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
@@ -96,7 +96,7 @@ interface Params {
|
|
|
96
96
|
|
|
97
97
|
const stripEmptySlots = (params: Params) => {
|
|
98
98
|
for (const [slot, value] of Object.entries(params)) {
|
|
99
|
-
if (value && typeof value === 'object' && !
|
|
99
|
+
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
100
100
|
delete params[slot as Slot];
|
|
101
101
|
}
|
|
102
102
|
}
|