keq 5.0.0-alpha.6 → 5.0.0-alpha.7
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 +187 -240
- package/jest.browser.config.ts +22 -0
- package/jest.config.cts +22 -0
- package/package.json +21 -24
- package/dist/index.cjs.js +0 -1115
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +0 -1082
- package/dist/package.json +0 -65
- package/dist/src/constant.d.ts +0 -2
- package/dist/src/core.d.ts +0 -36
- package/dist/src/create-request.d.ts +0 -9
- package/dist/src/exception/exception.d.ts +0 -4
- package/dist/src/exception/invalid-arguments.exception.d.ts +0 -4
- package/dist/src/index.d.ts +0 -23
- package/dist/src/is/is-array-buffer.d.ts +0 -1
- package/dist/src/is/is-blob.d.ts +0 -4
- package/dist/src/is/is-browser.d.ts +0 -1
- package/dist/src/is/is-buffer.d.ts +0 -1
- package/dist/src/is/is-file.d.ts +0 -1
- package/dist/src/is/is-form-data.d.ts +0 -1
- package/dist/src/is/is-function.d.ts +0 -1
- package/dist/src/is/is-headers.d.ts +0 -1
- package/dist/src/is/is-object.d.ts +0 -1
- package/dist/src/is/is-readable-stream.d.ts +0 -1
- package/dist/src/is/is-string.d.ts +0 -1
- package/dist/src/is/is-url-search-params.d.ts +0 -1
- package/dist/src/keq.d.ts +0 -93
- package/dist/src/middlewares/abort-flow-control-middleware.d.ts +0 -2
- package/dist/src/middlewares/fetch-arguments-middleware.d.ts +0 -2
- package/dist/src/middlewares/fetch-middleware.d.ts +0 -5
- package/dist/src/middlewares/proxy-response-middleware.d.ts +0 -2
- package/dist/src/middlewares/retry-middleware.d.ts +0 -2
- package/dist/src/middlewares/serial-flow-control-middleware.d.ts +0 -2
- package/dist/src/middlewares/timeout-middleware.d.ts +0 -2
- package/dist/src/request.d.ts +0 -1
- package/dist/src/router/keq-host-route.d.ts +0 -2
- package/dist/src/router/keq-location-route.d.ts +0 -2
- package/dist/src/router/keq-method-route.d.ts +0 -2
- package/dist/src/router/keq-module-route.d.ts +0 -2
- package/dist/src/router/keq-pathname-route.d.ts +0 -2
- package/dist/src/router/keq-router.d.ts +0 -12
- package/dist/src/types/content-type.d.ts +0 -2
- package/dist/src/types/exclude-property.d.ts +0 -3
- package/dist/src/types/extract-property.d.ts +0 -3
- package/dist/src/types/keq-context-request.d.ts +0 -18
- package/dist/src/types/keq-context.d.ts +0 -62
- package/dist/src/types/keq-events.d.ts +0 -8
- package/dist/src/types/keq-flow-control.d.ts +0 -7
- package/dist/src/types/keq-global.d.ts +0 -6
- package/dist/src/types/keq-init.d.ts +0 -2
- package/dist/src/types/keq-middleware.d.ts +0 -3
- package/dist/src/types/keq-next.d.ts +0 -1
- package/dist/src/types/keq-operation.d.ts +0 -44
- package/dist/src/types/keq-options.d.ts +0 -55
- package/dist/src/types/keq-query-value.d.ts +0 -6
- package/dist/src/types/keq-request.d.ts +0 -32
- package/dist/src/types/keq-resolve-with-mode.d.ts +0 -1
- package/dist/src/types/keq-retry.d.ts +0 -3
- package/dist/src/types/keq-route.d.ts +0 -2
- package/dist/src/types/keq-timeout.d.ts +0 -3
- package/dist/src/util/base64.d.ts +0 -2
- package/dist/src/util/clone-body.d.ts +0 -1
- package/dist/src/util/compile-url.d.ts +0 -1
- package/dist/src/util/compose-middleware.d.ts +0 -2
- package/dist/src/util/compose-route.d.ts +0 -2
- package/dist/src/util/create-response-proxy.d.ts +0 -1
- package/dist/src/util/fix-content-type.d.ts +0 -3
- package/dist/src/util/get-unique-code-identifier.d.ts +0 -1
- package/dist/src/util/is-valid-header-value.d.ts +0 -1
- package/dist/src/util/merge-keq-request-body.d.ts +0 -2
- package/dist/src/util/shallow-clone.d.ts +0 -4
- package/project.json +0 -16
- package/tsconfig.json +0 -28
- package/tsconfig.lib.json +0 -15
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FlattenOperations, KeqOperation, KeqOperations } from './keq-operation.js';
|
|
2
|
-
import type { KeqRouter } from '~/router/keq-router.js';
|
|
3
|
-
import type { Keq } from '~/keq.js';
|
|
4
|
-
import type { KeqMiddleware } from './keq-middleware.js';
|
|
5
|
-
import type { KeqInit } from './keq-init.js';
|
|
6
|
-
interface KeqRequestFn<OPERATIONS extends Record<string, KeqOperation>> {
|
|
7
|
-
<Path extends keyof OPERATIONS>(url: Path): Keq<OPERATIONS[Path]['responseBody'], OPERATIONS[Path]>;
|
|
8
|
-
<OUTPUT = any>(url: string): Keq<OUTPUT>;
|
|
9
|
-
<OUTPUT = any>(url: URL): Keq<OUTPUT>;
|
|
10
|
-
}
|
|
11
|
-
type PickKeqOperationsProperty<T extends KeqOperations, P extends keyof T, X extends keyof KeqOperation> = T extends {
|
|
12
|
-
[Path in keyof T as Path extends P ? Path : never]: {
|
|
13
|
-
[Method in keyof T[Path] as T[Path][Method] extends KeqOperation ? Method : never]: infer R;
|
|
14
|
-
};
|
|
15
|
-
} ? R extends KeqOperation ? R[X] : never : never;
|
|
16
|
-
export interface KeqRequest<OPERATIONS extends KeqOperations = KeqOperations> {
|
|
17
|
-
<Path extends keyof OPERATIONS>(url: Path, init: Omit<KeqInit, 'global'>): Keq<Exclude<PickKeqOperationsProperty<OPERATIONS, Path, 'responseBody'>, undefined>>;
|
|
18
|
-
<OUTPUT = any>(url: string, init: Omit<KeqInit, 'global'>): Keq<OUTPUT>;
|
|
19
|
-
<OUTPUT = any>(url: URL, init: Omit<KeqInit, 'global'>): Keq<OUTPUT>;
|
|
20
|
-
baseOrigin: (baseOrigin: string) => void;
|
|
21
|
-
get: KeqRequestFn<FlattenOperations<OPERATIONS, 'get'>>;
|
|
22
|
-
post: KeqRequestFn<FlattenOperations<OPERATIONS, 'post'>>;
|
|
23
|
-
del: KeqRequestFn<FlattenOperations<OPERATIONS, 'delete'>>;
|
|
24
|
-
delete: KeqRequestFn<FlattenOperations<OPERATIONS, 'delete'>>;
|
|
25
|
-
put: KeqRequestFn<FlattenOperations<OPERATIONS, 'put'>>;
|
|
26
|
-
patch: KeqRequestFn<FlattenOperations<OPERATIONS, 'patch'>>;
|
|
27
|
-
head: KeqRequestFn<FlattenOperations<OPERATIONS, 'head'>>;
|
|
28
|
-
options: KeqRequestFn<FlattenOperations<OPERATIONS, 'options'>>;
|
|
29
|
-
use(firstMiddleware: KeqMiddleware, ...middleware: KeqMiddleware[]): this;
|
|
30
|
-
useRouter(): KeqRouter;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type KeqResolveMethod = 'intelligent' | 'response' | 'text' | 'json' | 'form-data' | 'blob' | 'array-buffer';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { KeqContext } from './keq-context.js';
|
|
2
|
-
export type KeqRetryOn = (attempt: number, error: unknown | null, ctx: KeqContext) => (boolean | Promise<boolean>);
|
|
3
|
-
export type KeqRetryDelay = number | ((attempt: number, error: unknown | null, ctx: KeqContext) => number | Promise<number>);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cloneBody<T>(obj: T): T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compileUrl(obj: string | URL, routeParams: Record<string, string | number>): URL;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createResponseProxy(res: Response): Response;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getUniqueCodeIdentifier(depth?: number): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isValidHeaderValue(str: any): boolean;
|
package/project.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"targets": {
|
|
3
|
-
"rollup:build": {
|
|
4
|
-
"executor": "@nx/rollup:rollup",
|
|
5
|
-
"outputs": ["{options.outputPath}"],
|
|
6
|
-
|
|
7
|
-
"options": {
|
|
8
|
-
"useLegacyTypescriptPlugin": false,
|
|
9
|
-
"format": ["esm", "cjs"],
|
|
10
|
-
"main": "./src/index.ts",
|
|
11
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
12
|
-
"outputPath": "./dist"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"strict": true,
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"noImplicitAny": false,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"noEmitOnError": true,
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"module": "ESNext",
|
|
12
|
-
"target": "ESNext",
|
|
13
|
-
"baseUrl": "./",
|
|
14
|
-
"rootDir": "./",
|
|
15
|
-
"lib": ["DOM", "Es2015.Proxy", "ESNext", "DOM.Iterable"],
|
|
16
|
-
"paths": {
|
|
17
|
-
"~/*": ["./src/*"],
|
|
18
|
-
"~~/*": ["./*"]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"exclude": ["node_modules", "dist"],
|
|
22
|
-
"include": ["**/*.ts", ".eslintrc.cjs", "jest.config.ts"],
|
|
23
|
-
"ts-node": {
|
|
24
|
-
"compilerOptions": {
|
|
25
|
-
"module": "CommonJS"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"target": "esnext",
|
|
6
|
-
"preserveWatchOutput": true,
|
|
7
|
-
"resolveJsonModule": false
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"./src/**/*.ts"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"./src/**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|