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.
Files changed (162) hide show
  1. package/dist/admin.d.mts +43 -106
  2. package/dist/admin.d.ts +43 -106
  3. package/dist/admin.js +1 -1
  4. package/dist/admin.mjs +1 -1
  5. package/dist/auth.d.mts +2 -2
  6. package/dist/auth.d.ts +2 -2
  7. package/dist/auth.js +1 -1
  8. package/dist/auth.mjs +1 -1
  9. package/dist/{chunk-AVPKHYGS.js → chunk-7USVOK77.js} +5 -5
  10. package/dist/{chunk-X6YDNXYV.js → chunk-ERD2XKSM.js} +1 -1
  11. package/dist/chunk-G3M5QMRX.js +1 -0
  12. package/dist/chunk-HSPTEN45.mjs +1 -0
  13. package/dist/chunk-HWXE5WBF.js +7 -0
  14. package/dist/chunk-MUN3POSM.mjs +7 -0
  15. package/dist/{chunk-4WSHB6U6.mjs → chunk-PCR54D6A.mjs} +1 -1
  16. package/dist/chunk-ZUZHOLAX.mjs +7 -0
  17. package/dist/{create-api-client-ebyTfhcm.d.ts → create-api-client-ADSlg8HX.d.ts} +1 -1
  18. package/dist/{create-api-client-C-LEZku2.d.mts → create-api-client-B4Q01gHp.d.mts} +1 -1
  19. package/dist/{create-auth-DsnHpEf0.d.mts → create-auth-CT_IFt3T.d.mts} +53 -47
  20. package/dist/{create-auth-DsnHpEf0.d.ts → create-auth-CT_IFt3T.d.ts} +53 -47
  21. package/dist/extensions/alchemy.d.mts +3 -3
  22. package/dist/extensions/alchemy.d.ts +3 -3
  23. package/dist/extensions/alchemy.js +5 -5
  24. package/dist/extensions/alchemy.mjs +5 -5
  25. package/dist/extensions/app.d.mts +3 -3
  26. package/dist/extensions/app.d.ts +3 -3
  27. package/dist/extensions/app.js +5 -5
  28. package/dist/extensions/app.mjs +5 -5
  29. package/dist/extensions/billing.d.mts +3 -3
  30. package/dist/extensions/billing.d.ts +3 -3
  31. package/dist/extensions/billing.js +5 -5
  32. package/dist/extensions/billing.mjs +5 -5
  33. package/dist/extensions/bridge.d.mts +16 -190
  34. package/dist/extensions/bridge.d.ts +16 -190
  35. package/dist/extensions/bridge.js +5 -5
  36. package/dist/extensions/bridge.mjs +5 -5
  37. package/dist/extensions/builder.d.mts +3 -3
  38. package/dist/extensions/builder.d.ts +3 -3
  39. package/dist/extensions/builder.js +5 -5
  40. package/dist/extensions/builder.mjs +5 -5
  41. package/dist/extensions/business.d.mts +47 -82
  42. package/dist/extensions/business.d.ts +47 -82
  43. package/dist/extensions/business.js +5 -5
  44. package/dist/extensions/business.mjs +5 -5
  45. package/dist/extensions/conversion.d.mts +3 -3
  46. package/dist/extensions/conversion.d.ts +3 -3
  47. package/dist/extensions/conversion.js +5 -5
  48. package/dist/extensions/conversion.mjs +5 -5
  49. package/dist/extensions/mass-send.d.mts +3 -3
  50. package/dist/extensions/mass-send.d.ts +3 -3
  51. package/dist/extensions/mass-send.js +5 -5
  52. package/dist/extensions/mass-send.mjs +5 -5
  53. package/dist/extensions/notifications.d.mts +3 -3
  54. package/dist/extensions/notifications.d.ts +3 -3
  55. package/dist/extensions/notifications.js +5 -5
  56. package/dist/extensions/notifications.mjs +5 -5
  57. package/dist/extensions/payment-requests.d.mts +3 -7
  58. package/dist/extensions/payment-requests.d.ts +3 -7
  59. package/dist/extensions/payment-requests.js +5 -5
  60. package/dist/extensions/payment-requests.mjs +5 -5
  61. package/dist/extensions/products.d.mts +3 -3
  62. package/dist/extensions/products.d.ts +3 -3
  63. package/dist/extensions/products.js +5 -5
  64. package/dist/extensions/products.mjs +5 -5
  65. package/dist/extensions/rain.d.mts +3 -3
  66. package/dist/extensions/rain.d.ts +3 -3
  67. package/dist/extensions/rain.js +5 -5
  68. package/dist/extensions/rain.mjs +5 -5
  69. package/dist/extensions/rewards.d.mts +3 -3
  70. package/dist/extensions/rewards.d.ts +3 -3
  71. package/dist/extensions/rewards.js +5 -5
  72. package/dist/extensions/rewards.mjs +5 -5
  73. package/dist/extensions/stellar-testnet.d.mts +3 -3
  74. package/dist/extensions/stellar-testnet.d.ts +3 -3
  75. package/dist/extensions/stellar-testnet.js +5 -5
  76. package/dist/extensions/stellar-testnet.mjs +5 -5
  77. package/dist/extensions/stellar.d.mts +3 -3
  78. package/dist/extensions/stellar.d.ts +3 -3
  79. package/dist/extensions/stellar.js +5 -5
  80. package/dist/extensions/stellar.mjs +5 -5
  81. package/dist/index.d.mts +2 -2
  82. package/dist/index.d.ts +2 -2
  83. package/dist/index.js +1 -1
  84. package/dist/index.mjs +1 -1
  85. package/dist/react.d.mts +11 -3
  86. package/dist/react.d.ts +11 -3
  87. package/dist/react.js +1 -1
  88. package/dist/react.mjs +1 -1
  89. package/dist/user.d.mts +6 -16
  90. package/dist/user.d.ts +6 -16
  91. package/dist/user.js +1 -1
  92. package/dist/user.mjs +1 -1
  93. package/package.json +1 -1
  94. package/src/auth/create-auth.ts +773 -169
  95. package/src/auth/index.ts +25 -2
  96. package/src/auth/types/index.ts +48 -0
  97. package/src/extensions/alchemy/openapi-ts/client/client.gen.ts +3 -5
  98. package/src/extensions/alchemy/openapi-ts/core/bodySerializer.gen.ts +8 -6
  99. package/src/extensions/alchemy/openapi-ts/core/params.gen.ts +1 -1
  100. package/src/extensions/app/openapi-ts/client/client.gen.ts +3 -5
  101. package/src/extensions/app/openapi-ts/core/bodySerializer.gen.ts +8 -6
  102. package/src/extensions/app/openapi-ts/core/params.gen.ts +1 -1
  103. package/src/extensions/billing/openapi-ts/client/client.gen.ts +3 -5
  104. package/src/extensions/billing/openapi-ts/core/bodySerializer.gen.ts +8 -6
  105. package/src/extensions/billing/openapi-ts/core/params.gen.ts +1 -1
  106. package/src/extensions/bridge/openapi-ts/client/client.gen.ts +3 -5
  107. package/src/extensions/bridge/openapi-ts/core/bodySerializer.gen.ts +8 -6
  108. package/src/extensions/bridge/openapi-ts/core/params.gen.ts +1 -1
  109. package/src/extensions/bridge/openapi-ts/index.ts +2 -2
  110. package/src/extensions/bridge/openapi-ts/sdk.gen.ts +1 -43
  111. package/src/extensions/bridge/openapi-ts/types.gen.ts +11 -201
  112. package/src/extensions/builder/openapi-ts/client/client.gen.ts +3 -5
  113. package/src/extensions/builder/openapi-ts/core/bodySerializer.gen.ts +8 -6
  114. package/src/extensions/builder/openapi-ts/core/params.gen.ts +1 -1
  115. package/src/extensions/business/openapi-ts/client/client.gen.ts +3 -5
  116. package/src/extensions/business/openapi-ts/core/bodySerializer.gen.ts +8 -6
  117. package/src/extensions/business/openapi-ts/core/params.gen.ts +1 -1
  118. package/src/extensions/business/openapi-ts/types.gen.ts +44 -79
  119. package/src/extensions/conversion/openapi-ts/client/client.gen.ts +3 -5
  120. package/src/extensions/conversion/openapi-ts/core/bodySerializer.gen.ts +8 -6
  121. package/src/extensions/conversion/openapi-ts/core/params.gen.ts +1 -1
  122. package/src/extensions/mass-send/openapi-ts/client/client.gen.ts +3 -5
  123. package/src/extensions/mass-send/openapi-ts/core/bodySerializer.gen.ts +8 -6
  124. package/src/extensions/mass-send/openapi-ts/core/params.gen.ts +1 -1
  125. package/src/extensions/notifications/openapi-ts/client/client.gen.ts +3 -5
  126. package/src/extensions/notifications/openapi-ts/core/bodySerializer.gen.ts +8 -6
  127. package/src/extensions/notifications/openapi-ts/core/params.gen.ts +1 -1
  128. package/src/extensions/payment-requests/openapi-ts/client/client.gen.ts +3 -5
  129. package/src/extensions/payment-requests/openapi-ts/core/bodySerializer.gen.ts +8 -6
  130. package/src/extensions/payment-requests/openapi-ts/core/params.gen.ts +1 -1
  131. package/src/extensions/payment-requests/openapi-ts/types.gen.ts +0 -4
  132. package/src/extensions/products/openapi-ts/client/client.gen.ts +3 -5
  133. package/src/extensions/products/openapi-ts/core/bodySerializer.gen.ts +8 -6
  134. package/src/extensions/products/openapi-ts/core/params.gen.ts +1 -1
  135. package/src/extensions/rain/openapi-ts/client/client.gen.ts +3 -5
  136. package/src/extensions/rain/openapi-ts/core/bodySerializer.gen.ts +8 -6
  137. package/src/extensions/rain/openapi-ts/core/params.gen.ts +1 -1
  138. package/src/extensions/rewards/openapi-ts/client/client.gen.ts +3 -5
  139. package/src/extensions/rewards/openapi-ts/core/bodySerializer.gen.ts +8 -6
  140. package/src/extensions/rewards/openapi-ts/core/params.gen.ts +1 -1
  141. package/src/extensions/stellar/openapi-ts/client/client.gen.ts +3 -5
  142. package/src/extensions/stellar/openapi-ts/core/bodySerializer.gen.ts +8 -6
  143. package/src/extensions/stellar/openapi-ts/core/params.gen.ts +1 -1
  144. package/src/extensions/stellar-testnet/openapi-ts/client/client.gen.ts +3 -5
  145. package/src/extensions/stellar-testnet/openapi-ts/core/bodySerializer.gen.ts +8 -6
  146. package/src/extensions/stellar-testnet/openapi-ts/core/params.gen.ts +1 -1
  147. package/src/platform/admin/openapi-ts/client/client.gen.ts +3 -5
  148. package/src/platform/admin/openapi-ts/core/bodySerializer.gen.ts +8 -6
  149. package/src/platform/admin/openapi-ts/core/params.gen.ts +1 -1
  150. package/src/platform/admin/openapi-ts/sdk.gen.ts +10 -10
  151. package/src/platform/admin/openapi-ts/types.gen.ts +40 -103
  152. package/src/platform/user/openapi-ts/client/client.gen.ts +3 -5
  153. package/src/platform/user/openapi-ts/core/bodySerializer.gen.ts +8 -6
  154. package/src/platform/user/openapi-ts/core/params.gen.ts +1 -1
  155. package/src/platform/user/openapi-ts/index.ts +2 -2
  156. package/src/platform/user/openapi-ts/sdk.gen.ts +3 -29
  157. package/src/platform/user/openapi-ts/types.gen.ts +7 -54
  158. package/dist/chunk-KUT5NSX7.mjs +0 -7
  159. package/dist/chunk-KZWBOQHZ.mjs +0 -7
  160. package/dist/chunk-PE6PG7ZE.js +0 -1
  161. package/dist/chunk-UYYU5OJ4.js +0 -7
  162. 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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
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 as string | 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) as string | undefined;
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: _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: unknown) => unknown;
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: (body: unknown): FormData => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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: unknown): string =>
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: unknown): string => {
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 as Record<string, unknown>).forEach(([key, value]) => {
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' && !Array.isArray(value) && !Object.keys(value).length) {
99
+ if (value && typeof value === 'object' && !Object.keys(value).length) {
100
100
  delete params[slot as Slot];
101
101
  }
102
102
  }