@remit/api-http-client 0.0.20 → 0.0.22

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/core/types.gen.ts CHANGED
@@ -1,11 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
3
  import type { Auth, AuthToken } from './auth.gen.js';
4
- import type {
5
- BodySerializer,
6
- QuerySerializer,
7
- QuerySerializerOptions,
8
- } from './bodySerializer.gen.js';
4
+ import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen.js';
9
5
 
10
6
  export type HttpMethod =
11
7
  | 'connect'
@@ -34,9 +30,7 @@ export type Client<
34
30
  setConfig: (config: Config) => Config;
35
31
  } & {
36
32
  [K in HttpMethod]: MethodFn;
37
- } & ([SseFn] extends [never]
38
- ? { sse?: never }
39
- : { sse: { [K in HttpMethod]: SseFn } });
33
+ } & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } });
40
34
 
41
35
  export interface Config {
42
36
  /**
@@ -59,13 +53,7 @@ export interface Config {
59
53
  | RequestInit['headers']
60
54
  | Record<
61
55
  string,
62
- | string
63
- | number
64
- | boolean
65
- | (string | number | boolean)[]
66
- | null
67
- | undefined
68
- | unknown
56
+ string | number | boolean | (string | number | boolean)[] | null | undefined | unknown
69
57
  >;
70
58
  /**
71
59
  * The request method.
@@ -92,7 +80,7 @@ export interface Config {
92
80
  requestValidator?: (data: unknown) => Promise<unknown>;
93
81
  /**
94
82
  * A function transforming response data before it's returned. This is useful
95
- * for post-processing data, e.g. converting ISO strings into Date objects.
83
+ * for post-processing data, e.g., converting ISO strings into Date objects.
96
84
  */
97
85
  responseTransformer?: (data: unknown) => Promise<unknown>;
98
86
  /**
@@ -103,6 +91,12 @@ export interface Config {
103
91
  responseValidator?: (data: unknown) => Promise<unknown>;
104
92
  }
105
93
 
94
+ /**
95
+ * Arbitrary metadata passed through the `meta` request option.
96
+ */
97
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
98
+ export interface ClientMeta {}
99
+
106
100
  type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
107
101
  ? true
108
102
  : [T] extends [never | undefined]
@@ -112,7 +106,5 @@ type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
112
106
  : false;
113
107
 
114
108
  export type OmitNever<T extends Record<string, unknown>> = {
115
- [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
116
- ? never
117
- : K]: T[K];
109
+ [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
118
110
  };
package/core/utils.gen.ts CHANGED
@@ -13,9 +13,9 @@ export interface PathSerializer {
13
13
  url: string;
14
14
  }
15
15
 
16
- export const PATH_PARAM_RE = /\{[^{}]+\}/g;
16
+ export const PATH_PARAM_RE: RegExp = /\{[^{}]+\}/g;
17
17
 
18
- export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
18
+ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {
19
19
  let url = _url;
20
20
  const matches = _url.match(PATH_PARAM_RE);
21
21
  if (matches) {
@@ -44,10 +44,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
44
44
  }
45
45
 
46
46
  if (Array.isArray(value)) {
47
- url = url.replace(
48
- match,
49
- serializeArrayParam({ explode, name, style, value }),
50
- );
47
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
51
48
  continue;
52
49
  }
53
50
 
@@ -97,7 +94,7 @@ export const getUrl = ({
97
94
  query?: Record<string, unknown>;
98
95
  querySerializer: QuerySerializer;
99
96
  url: string;
100
- }) => {
97
+ }): string => {
101
98
  const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
102
99
  let url = (baseUrl ?? '') + pathUrl;
103
100
  if (path) {
@@ -117,7 +114,7 @@ export function getValidRequestBody(options: {
117
114
  body?: unknown;
118
115
  bodySerializer?: BodySerializer | null;
119
116
  serializedBody?: unknown;
120
- }) {
117
+ }): unknown {
121
118
  const hasBody = options.body !== undefined;
122
119
  const isSerializedBody = hasBody && options.bodySerializer;
123
120
 
@@ -129,7 +126,7 @@ export function getValidRequestBody(options: {
129
126
  return hasSerializedBody ? options.serializedBody : null;
130
127
  }
131
128
 
132
- // not all clients implement a serializedBody property (i.e. client-axios)
129
+ // not all clients implement a serializedBody property (i.e., client-axios)
133
130
  return options.body !== '' ? options.body : null;
134
131
  }
135
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/api-http-client",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts",