api-def 0.6.0-alpha1 → 0.6.0-alpha5

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/CHANGELOG.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  ## Breaking Changes
4
4
 
5
- - axios will enforce ResponseType
5
+ - axios will enforce `ResponseType`
6
6
 
7
- ### Fixes
7
+ ## Features
8
+
9
+ - add `ResponseOf`, `QueryOf`, `BodyOf`, `ParamsOf` to quickly get types from endpoints
10
+
11
+ ## Fixes
8
12
 
9
13
  - absolute paths as `baseUrl` is now supported in fetch backend
10
14
 
@@ -0,0 +1,5 @@
1
+ import Endpoint from "./Endpoint";
2
+ export declare type ResponseOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<infer R, any, any, any> ? R : never;
3
+ export declare type ParamsOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, infer P, any, any> ? P : never;
4
+ export declare type QueryOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, any, infer Q, any> ? Q : never;
5
+ export declare type BodyOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, any, any, infer B> ? B : never;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./Api";
2
2
  export * from "./ApiTypes";
3
+ export * from "./UtilTypes";
3
4
  export * from "./ApiConstants";
4
5
  export { isRequestError } from "./RequestError";
5
6
  export { clearCache, setCacheBackend } from "./cache/Caching";
package/cjs/index.js CHANGED
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.LoggingMiddleware = exports.CacheMiddleware = exports.FetchRequestBackend = exports.AxiosRequestBackend = exports.LocaleForageCacheBackend = exports.LocalStorageCacheBackend = exports.setCacheBackend = exports.clearCache = exports.isRequestError = void 0;
15
15
  __exportStar(require("./Api"), exports);
16
16
  __exportStar(require("./ApiTypes"), exports);
17
+ __exportStar(require("./UtilTypes"), exports);
17
18
  __exportStar(require("./ApiConstants"), exports);
18
19
  var RequestError_1 = require("./RequestError");
19
20
  Object.defineProperty(exports, "isRequestError", { enumerable: true, get: function () { return RequestError_1.isRequestError; } });
@@ -0,0 +1,5 @@
1
+ import Endpoint from "./Endpoint";
2
+ export declare type ResponseOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<infer R, any, any, any> ? R : never;
3
+ export declare type ParamsOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, infer P, any, any> ? P : never;
4
+ export declare type QueryOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, any, infer Q, any> ? Q : never;
5
+ export declare type BodyOf<E extends Endpoint<any, any, any, any>> = E extends Endpoint<any, any, any, infer B> ? B : never;
@@ -0,0 +1 @@
1
+ export {};
package/esm/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./Api";
2
2
  export * from "./ApiTypes";
3
+ export * from "./UtilTypes";
3
4
  export * from "./ApiConstants";
4
5
  export { isRequestError } from "./RequestError";
5
6
  export { clearCache, setCacheBackend } from "./cache/Caching";
package/esm/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  "use strict";
3
3
  export * from "./Api";
4
4
  export * from "./ApiTypes";
5
+ export * from "./UtilTypes";
5
6
  export * from "./ApiConstants";
6
7
  export { isRequestError } from "./RequestError";
7
8
  export { clearCache, setCacheBackend } from "./cache/Caching";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-def",
3
- "version": "0.6.0-alpha1",
3
+ "version": "0.6.0-alpha5",
4
4
  "description": "Typed API definitions with middleware support",
5
5
  "main": "cjs/index.js",
6
6
  "types": "esm/index.d.ts",