@tstdl/base 0.90.77 → 0.90.79
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/api/client/client.d.ts +4 -1
- package/api/client/client.js +6 -2
- package/package.json +5 -5
package/api/client/client.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { HttpClient, type HttpClientOptions } from '../../http/client/index.js';
|
|
2
2
|
import { type Resolvable } from '../../injector/interfaces.js';
|
|
3
|
+
import type { Type } from '../../types.js';
|
|
3
4
|
import { type ApiClientImplementation, type ApiDefinition, type ApiEndpointDefinition } from '../types.js';
|
|
4
|
-
export type ApiClient<T extends ApiDefinition> =
|
|
5
|
+
export type ApiClient<T extends ApiDefinition> = Type<ApiClientImplementation<T> & Resolvable<HttpClient | HttpClientOptions>, [httpClientOrOptions?: HttpClient | HttpClientOptions]>;
|
|
5
6
|
export type ClientOptions = {
|
|
6
7
|
/**
|
|
7
8
|
* Url prefix
|
|
@@ -15,6 +16,8 @@ export type ApiClientHttpRequestContext = {
|
|
|
15
16
|
};
|
|
16
17
|
export declare const httpClientSymbol: unique symbol;
|
|
17
18
|
export declare const apiDefinitionSymbol: unique symbol;
|
|
19
|
+
export declare const defaultOptions: ClientOptions;
|
|
20
|
+
export declare function setDefaultApiClientOptions(options: ClientOptions): void;
|
|
18
21
|
export declare function compileClient<T extends ApiDefinition>(definition: T, options?: ClientOptions): ApiClient<T>;
|
|
19
22
|
export declare function getHttpClientOfApiClient(apiClient: any): HttpClient;
|
|
20
23
|
export declare function getApiDefinitionOfApiClient(apiClient: any): ApiDefinition;
|
package/api/client/client.js
CHANGED
|
@@ -6,7 +6,7 @@ import { resolveArgumentType } from '../../injector/interfaces.js';
|
|
|
6
6
|
import { Schema } from '../../schema/index.js';
|
|
7
7
|
import { ServerSentEvents } from '../../sse/server-sent-events.js';
|
|
8
8
|
import { toArray } from '../../utils/array/array.js';
|
|
9
|
-
import { objectEntries } from '../../utils/object/object.js';
|
|
9
|
+
import { copyObjectProperties, objectEntries } from '../../utils/object/object.js';
|
|
10
10
|
import { toTitleCase } from '../../utils/string/title-case.js';
|
|
11
11
|
import { isArray, isBlob, isDefined, isObject, isReadableStream, isString, isUint8Array, isUndefined } from '../../utils/type-guards.js';
|
|
12
12
|
import { buildUrl } from '../../utils/url-builder.js';
|
|
@@ -15,8 +15,12 @@ import { normalizedApiDefinitionEndpointsEntries } from '../types.js';
|
|
|
15
15
|
import { getFullApiEndpointResource } from '../utils.js';
|
|
16
16
|
export const httpClientSymbol = Symbol('ApiTransport');
|
|
17
17
|
export const apiDefinitionSymbol = Symbol('ApiDefinition');
|
|
18
|
+
export const defaultOptions = {};
|
|
19
|
+
export function setDefaultApiClientOptions(options) {
|
|
20
|
+
copyObjectProperties(options, defaultOptions);
|
|
21
|
+
}
|
|
18
22
|
// eslint-disable-next-line max-lines-per-function
|
|
19
|
-
export function compileClient(definition, options =
|
|
23
|
+
export function compileClient(definition, options = defaultOptions) {
|
|
20
24
|
const { resource: path, endpoints } = definition;
|
|
21
25
|
const constructedApiName = toTitleCase(path[0] ?? '');
|
|
22
26
|
const apiName = `${constructedApiName}ApiClient`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.90.
|
|
3
|
+
"version": "0.90.79",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@mxssfd/typedoc-theme": "1.1",
|
|
118
|
-
"@stylistic/eslint-plugin": "1
|
|
118
|
+
"@stylistic/eslint-plugin": "2.1",
|
|
119
119
|
"@types/chroma-js": "2.4",
|
|
120
120
|
"@types/koa__router": "12.0",
|
|
121
121
|
"@types/luxon": "3.4",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"typedoc": "0.25",
|
|
132
132
|
"typedoc-plugin-missing-exports": "2.2",
|
|
133
133
|
"typescript": "5.4",
|
|
134
|
-
"typescript-eslint": "7.
|
|
134
|
+
"typescript-eslint": "7.10"
|
|
135
135
|
},
|
|
136
136
|
"peerDependencies": {
|
|
137
137
|
"@elastic/elasticsearch": "^8.13",
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"nodemailer": "^6.9",
|
|
151
151
|
"playwright": "^1.44",
|
|
152
152
|
"preact": "^10.22",
|
|
153
|
-
"preact-render-to-string": "^6.
|
|
154
|
-
"undici": "^6.
|
|
153
|
+
"preact-render-to-string": "^6.5",
|
|
154
|
+
"undici": "^6.18",
|
|
155
155
|
"urlpattern-polyfill": "^10.0"
|
|
156
156
|
},
|
|
157
157
|
"peerDependenciesMeta": {
|