@vc-shell/framework 2.5.0-pr333.50c07fa → 2.5.0-pr334.23413b7
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/core/composables/useApiClient/index.d.ts +19 -3
- package/dist/core/composables/useApiClient/index.d.ts.map +1 -1
- package/dist/core/composables/useLatestRequest/index.d.ts +12 -4
- package/dist/core/composables/useLatestRequest/index.d.ts.map +1 -1
- package/dist/core/interceptors/index.d.ts.map +1 -1
- package/dist/framework.js +1171 -1155
- package/dist/framework.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/de.js +5 -0
- package/dist/locales/en.js +5 -0
- package/dist/locales/en.json +5 -0
- package/dist/locales/types.d.ts +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -3,12 +3,28 @@ export interface IAuthApiBase {
|
|
|
3
3
|
setAuthToken(token: string): void;
|
|
4
4
|
getBaseUrl(defaultUrl: string, baseUrl: string): string;
|
|
5
5
|
}
|
|
6
|
+
/** The HTTP seam the generated clients accept as their second constructor argument. */
|
|
7
|
+
export interface ApiClientHttp {
|
|
8
|
+
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
9
|
+
}
|
|
10
|
+
export type ApiClientCtor<ApiClient extends IAuthApiBase> = new (baseUrl?: string, http?: ApiClientHttp) => ApiClient;
|
|
11
|
+
export interface UseApiClientOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Cancels every request the returned client makes.
|
|
14
|
+
*
|
|
15
|
+
* The generated clients take no `AbortSignal` of their own — they build their
|
|
16
|
+
* own `RequestInit` — so the signal travels through the `http` seam instead,
|
|
17
|
+
* which every operation of every client already routes through.
|
|
18
|
+
*/
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
6
21
|
export interface UseApiClientReturn<ApiClient extends IAuthApiBase> {
|
|
7
22
|
getApiClient: () => Promise<ApiClient>;
|
|
8
23
|
}
|
|
9
24
|
/** @deprecated Use UseApiClientReturn instead */
|
|
10
25
|
export type UseApiClient<ApiClient extends IAuthApiBase> = UseApiClientReturn<ApiClient>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
/** Builds the client instance. Replaceable so an app or a test can supply its own. */
|
|
27
|
+
export type ApiClientFactory = <ApiClient extends IAuthApiBase>(ctor: ApiClientCtor<ApiClient>, options: UseApiClientOptions) => ApiClient;
|
|
28
|
+
export declare function setApiClientFactory(factory: ApiClientFactory | undefined): void;
|
|
29
|
+
export declare function useApiClient<ApiClient extends IAuthApiBase>(c: ApiClientCtor<ApiClient>, options?: UseApiClientOptions): UseApiClientReturn<ApiClient>;
|
|
14
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useApiClient/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CACzD;AAED,MAAM,WAAW,kBAAkB,CAAC,SAAS,SAAS,YAAY;IAChE,YAAY,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;AAED,iDAAiD;AACjD,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,YAAY,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAEzF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useApiClient/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CACzD;AAED,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAChE;AAED,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,YAAY,IAAI,KAAK,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,KAAK,SAAS,CAAC;AAEtH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB,CAAC,SAAS,SAAS,YAAY;IAChE,YAAY,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;AAED,iDAAiD;AACjD,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,YAAY,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAEzF,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,SAAS,YAAY,EAC5D,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAC9B,OAAO,EAAE,mBAAmB,KACzB,SAAS,CAAC;AASf,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAE/E;AAsBD,wBAAgB,YAAY,CAAC,SAAS,SAAS,YAAY,EACzD,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,EAC3B,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAAC,SAAS,CAAC,CAQ/B"}
|
|
@@ -34,10 +34,18 @@ export interface UseLatestRequestReturn {
|
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
|
-
* This discards the late result rather than cancelling the request
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* This discards the late result rather than cancelling the request. To also save
|
|
38
|
+
* the round trip, give the client a signal and abort it when a newer request
|
|
39
|
+
* supersedes the last:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const controller = new AbortController();
|
|
43
|
+
* const { getApiClient } = useApiClient(SearchClient, { signal: controller.signal });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* The two compose rather than replace each other: aborting stops the request that
|
|
47
|
+
* is still in flight, and `isCurrent()` still guards a response that had already
|
|
48
|
+
* come back before the newer request started.
|
|
41
49
|
*/
|
|
42
50
|
export declare function useLatestRequest(): UseLatestRequestReturn;
|
|
43
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA2CzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/interceptors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/interceptors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA4CpC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,wFAsMlD"}
|