vovk 3.0.0-draft.6 → 3.0.0-draft.60
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/README.md +8 -95
- package/{HttpException.d.ts → dist/HttpException.d.ts} +2 -2
- package/{HttpException.js → dist/HttpException.js} +3 -3
- package/{StreamResponse.d.ts → dist/StreamJSONResponse.d.ts} +3 -3
- package/{StreamResponse.js → dist/StreamJSONResponse.js} +5 -5
- package/{Segment.d.ts → dist/VovkApp.d.ts} +3 -3
- package/{Segment.js → dist/VovkApp.js} +26 -23
- package/dist/client/createRPC.d.ts +4 -0
- package/{client/clientizeController.js → dist/client/createRPC.js} +21 -39
- package/dist/client/defaultFetcher.d.ts +4 -0
- package/{client → dist/client}/defaultFetcher.js +11 -10
- package/{client → dist/client}/defaultHandler.d.ts +1 -1
- package/dist/client/defaultHandler.js +22 -0
- package/dist/client/defaultStreamHandler.d.ts +4 -0
- package/{client → dist/client}/defaultStreamHandler.js +5 -5
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +8 -0
- package/dist/client/types.d.ts +103 -0
- package/dist/createDecorator.d.ts +4 -0
- package/{createDecorator.js → dist/createDecorator.js} +4 -4
- package/{createSegment.d.ts → dist/createVovkApp.d.ts} +2 -3
- package/{createSegment.js → dist/createVovkApp.js} +25 -25
- package/dist/index.d.ts +59 -0
- package/dist/index.js +22 -0
- package/dist/types.d.ts +145 -0
- package/dist/types.js +65 -0
- package/dist/utils/generateStaticAPI.d.ts +4 -0
- package/{generateStaticAPI.js → dist/utils/generateStaticAPI.js} +3 -3
- package/{utils → dist/utils}/getSchema.d.ts +1 -2
- package/{utils → dist/utils}/getSchema.js +5 -16
- package/dist/utils/parseQuery.d.ts +25 -0
- package/dist/utils/parseQuery.js +156 -0
- package/dist/utils/reqForm.d.ts +2 -0
- package/dist/utils/reqForm.js +13 -0
- package/{utils → dist/utils}/reqMeta.d.ts +1 -2
- package/{utils → dist/utils}/reqQuery.d.ts +1 -2
- package/dist/utils/reqQuery.js +10 -0
- package/dist/utils/serializeQuery.d.ts +13 -0
- package/dist/utils/serializeQuery.js +65 -0
- package/dist/utils/setClientValidatorsForHandler.d.ts +5 -0
- package/{utils → dist/utils}/setClientValidatorsForHandler.js +4 -6
- package/package.json +5 -2
- package/src/HttpException.ts +16 -0
- package/src/StreamJSONResponse.ts +61 -0
- package/src/VovkApp.ts +242 -0
- package/src/client/createRPC.ts +119 -0
- package/src/client/defaultFetcher.ts +59 -0
- package/src/client/defaultHandler.ts +23 -0
- package/src/client/defaultStreamHandler.ts +88 -0
- package/src/client/index.ts +9 -0
- package/src/client/types.ts +120 -0
- package/src/createDecorator.ts +60 -0
- package/src/createVovkApp.ts +167 -0
- package/src/index.ts +69 -0
- package/src/types.ts +198 -0
- package/src/utils/generateStaticAPI.ts +18 -0
- package/src/utils/getSchema.ts +35 -0
- package/src/utils/parseQuery.ts +160 -0
- package/src/utils/reqForm.ts +16 -0
- package/src/utils/reqMeta.ts +16 -0
- package/src/utils/reqQuery.ts +6 -0
- package/src/utils/serializeQuery.ts +69 -0
- package/src/utils/setClientValidatorsForHandler.ts +45 -0
- package/src/utils/shim.ts +17 -0
- package/.npmignore +0 -2
- package/client/clientizeController.d.ts +0 -4
- package/client/defaultFetcher.d.ts +0 -4
- package/client/defaultHandler.js +0 -21
- package/client/defaultStreamHandler.d.ts +0 -4
- package/client/index.d.ts +0 -4
- package/client/index.js +0 -5
- package/client/types.d.ts +0 -102
- package/createDecorator.d.ts +0 -4
- package/generateStaticAPI.d.ts +0 -4
- package/index.d.ts +0 -60
- package/index.js +0 -20
- package/types.d.ts +0 -191
- package/types.js +0 -65
- package/utils/reqQuery.js +0 -25
- package/utils/setClientValidatorsForHandler.d.ts +0 -5
- package/worker/index.d.ts +0 -3
- package/worker/index.js +0 -7
- package/worker/promisifyWorker.d.ts +0 -2
- package/worker/promisifyWorker.js +0 -143
- package/worker/types.d.ts +0 -31
- package/worker/types.js +0 -2
- package/worker/worker.d.ts +0 -1
- package/worker/worker.js +0 -44
- /package/{client → dist/client}/types.js +0 -0
- /package/{utils → dist/utils}/reqMeta.js +0 -0
- /package/{utils → dist/utils}/shim.d.ts +0 -0
- /package/{utils → dist/utils}/shim.js +0 -0
package/client/defaultHandler.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._defaultHandler = exports.DEFAULT_ERROR_MESSAGE = void 0;
|
|
4
|
-
const HttpException_1 = require("../HttpException");
|
|
5
|
-
exports.DEFAULT_ERROR_MESSAGE = 'Unknown error at defaultHandler';
|
|
6
|
-
const _defaultHandler = async (response) => {
|
|
7
|
-
let result;
|
|
8
|
-
try {
|
|
9
|
-
result = await response.json();
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
// handle parsing errors
|
|
13
|
-
throw new HttpException_1._HttpException(response.status, e?.message ?? exports.DEFAULT_ERROR_MESSAGE);
|
|
14
|
-
}
|
|
15
|
-
if (!response.ok) {
|
|
16
|
-
// handle server errors
|
|
17
|
-
throw new HttpException_1._HttpException(response.status, result?.message ?? exports.DEFAULT_ERROR_MESSAGE);
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
exports._defaultHandler = _defaultHandler;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { _StreamAsyncIterator as StreamAsyncIterator } from './types';
|
|
2
|
-
import '../utils/shim';
|
|
3
|
-
export declare const DEFAULT_ERROR_MESSAGE = "Unknown error at defaultStreamHandler";
|
|
4
|
-
export declare const _defaultStreamHandler: (response: Response) => Promise<StreamAsyncIterator<unknown>>;
|
package/client/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { _clientizeController as clientizeController } from './clientizeController';
|
|
2
|
-
import type { _VovkClientFetcher as VovkClientFetcher, _VovkClientOptions as VovkClientOptions, _VovkDefaultFetcherOptions as VovkDefaultFetcherOptions } from './types';
|
|
3
|
-
export { clientizeController };
|
|
4
|
-
export type { VovkClientFetcher, VovkClientOptions, VovkDefaultFetcherOptions };
|
package/client/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clientizeController = void 0;
|
|
4
|
-
const clientizeController_1 = require("./clientizeController");
|
|
5
|
-
Object.defineProperty(exports, "clientizeController", { enumerable: true, get: function () { return clientizeController_1._clientizeController; } });
|
package/client/types.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { _KnownAny as KnownAny, _HttpMethod as HttpMethod, _ControllerStaticMethod, _VovkControllerBody, _VovkControllerQuery, _VovkControllerParams } from '../types';
|
|
2
|
-
import { _StreamResponse as StreamResponse } from '../StreamResponse';
|
|
3
|
-
import type { NextResponse } from 'next/server';
|
|
4
|
-
export type _StaticMethodInput<T extends _ControllerStaticMethod> = (_VovkControllerBody<T> extends undefined | void ? {
|
|
5
|
-
body?: undefined;
|
|
6
|
-
} : _VovkControllerBody<T> extends null ? {
|
|
7
|
-
body?: null;
|
|
8
|
-
} : {
|
|
9
|
-
body: _VovkControllerBody<T>;
|
|
10
|
-
}) & (_VovkControllerQuery<T> extends undefined | void ? {
|
|
11
|
-
query?: undefined;
|
|
12
|
-
} : {
|
|
13
|
-
query: _VovkControllerQuery<T>;
|
|
14
|
-
}) & (_VovkControllerParams<T> extends undefined | void ? {
|
|
15
|
-
params?: undefined;
|
|
16
|
-
} : {
|
|
17
|
-
params: _VovkControllerParams<T>;
|
|
18
|
-
});
|
|
19
|
-
type ToPromise<T> = T extends PromiseLike<unknown> ? T : Promise<T>;
|
|
20
|
-
export type _StreamAsyncIterator<T> = {
|
|
21
|
-
status: number;
|
|
22
|
-
[Symbol.dispose](): Promise<void> | void;
|
|
23
|
-
[Symbol.asyncDispose](): Promise<void> | void;
|
|
24
|
-
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
25
|
-
cancel: () => Promise<void> | void;
|
|
26
|
-
};
|
|
27
|
-
type StaticMethodReturn<T extends _ControllerStaticMethod> = ReturnType<T> extends NextResponse<infer U> | Promise<NextResponse<infer U>> ? U : ReturnType<T> extends Response | Promise<Response> ? unknown : ReturnType<T>;
|
|
28
|
-
type StaticMethodReturnPromise<T extends _ControllerStaticMethod> = ToPromise<StaticMethodReturn<T>>;
|
|
29
|
-
type ClientMethod<T extends (...args: KnownAny[]) => void | object | StreamResponse<STREAM> | Promise<StreamResponse<STREAM>>, OPTS extends Record<string, KnownAny>, STREAM extends KnownAny = unknown> = <R>(options: (_StaticMethodInput<T> extends {
|
|
30
|
-
body?: undefined | null;
|
|
31
|
-
query?: undefined;
|
|
32
|
-
params?: undefined;
|
|
33
|
-
} ? unknown : Parameters<T>[0] extends void ? _StaticMethodInput<T>['params'] extends object ? {
|
|
34
|
-
params: _StaticMethodInput<T>['params'];
|
|
35
|
-
} : unknown : _StaticMethodInput<T>) & (Partial<OPTS & {
|
|
36
|
-
transform: (staticMethodReturn: Awaited<StaticMethodReturn<T>>) => R;
|
|
37
|
-
}> | void)) => ReturnType<T> extends Promise<StreamResponse<infer U>> | StreamResponse<infer U> | Iterator<infer U> | AsyncIterator<infer U> ? Promise<_StreamAsyncIterator<U>> : R extends object ? Promise<R> : StaticMethodReturnPromise<T>;
|
|
38
|
-
type OmitNever<T> = {
|
|
39
|
-
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
40
|
-
};
|
|
41
|
-
type _VovkClientWithNever<T, OPTS extends {
|
|
42
|
-
[key: string]: KnownAny;
|
|
43
|
-
}> = {
|
|
44
|
-
[K in keyof T]: T[K] extends (...args: KnownAny) => KnownAny ? ClientMethod<T[K], OPTS> & {
|
|
45
|
-
__isClientMethod: boolean;
|
|
46
|
-
} : never;
|
|
47
|
-
};
|
|
48
|
-
export type _VovkClient<T, OPTS extends {
|
|
49
|
-
[key: string]: KnownAny;
|
|
50
|
-
}> = OmitNever<_VovkClientWithNever<T, OPTS>>;
|
|
51
|
-
export type _VovkClientFetcher<OPTS extends Record<string, KnownAny> = Record<string, never>, T = KnownAny> = (options: {
|
|
52
|
-
name: keyof T;
|
|
53
|
-
httpMethod: HttpMethod;
|
|
54
|
-
getEndpoint: (data: {
|
|
55
|
-
prefix: string;
|
|
56
|
-
params: {
|
|
57
|
-
[key: string]: string;
|
|
58
|
-
};
|
|
59
|
-
query: {
|
|
60
|
-
[key: string]: string;
|
|
61
|
-
};
|
|
62
|
-
}) => string;
|
|
63
|
-
validate: (input: {
|
|
64
|
-
body?: unknown;
|
|
65
|
-
query?: unknown;
|
|
66
|
-
endpoint: string;
|
|
67
|
-
}) => void | Promise<void>;
|
|
68
|
-
defaultStreamHandler: (response: Response) => Promise<_StreamAsyncIterator<unknown>>;
|
|
69
|
-
defaultHandler: (response: Response) => Promise<unknown>;
|
|
70
|
-
}, input: {
|
|
71
|
-
body: unknown;
|
|
72
|
-
query: {
|
|
73
|
-
[key: string]: string;
|
|
74
|
-
};
|
|
75
|
-
params: {
|
|
76
|
-
[key: string]: string;
|
|
77
|
-
};
|
|
78
|
-
} & OPTS) => KnownAny;
|
|
79
|
-
export interface _VovkDefaultFetcherOptions extends Omit<RequestInit, 'body' | 'method'> {
|
|
80
|
-
reactNative?: {
|
|
81
|
-
textStreaming: boolean;
|
|
82
|
-
};
|
|
83
|
-
prefix?: string;
|
|
84
|
-
segmentName?: string;
|
|
85
|
-
disableClientValidation?: boolean;
|
|
86
|
-
validateOnClient?: _VovkValidateOnClient;
|
|
87
|
-
fetcher?: _VovkClientFetcher;
|
|
88
|
-
}
|
|
89
|
-
export type _VovkValidateOnClient = (input: {
|
|
90
|
-
body?: unknown;
|
|
91
|
-
query?: unknown;
|
|
92
|
-
endpoint: string;
|
|
93
|
-
}, validators: {
|
|
94
|
-
body?: unknown;
|
|
95
|
-
query?: unknown;
|
|
96
|
-
}) => void | Promise<void>;
|
|
97
|
-
export type _VovkClientOptions<OPTS extends Record<string, KnownAny> = Record<string, never>> = {
|
|
98
|
-
fetcher?: _VovkClientFetcher<OPTS>;
|
|
99
|
-
validateOnClient?: _VovkValidateOnClient;
|
|
100
|
-
defaultOptions?: Partial<OPTS>;
|
|
101
|
-
};
|
|
102
|
-
export {};
|
package/createDecorator.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { _HandlerSchema as HandlerSchema, _KnownAny as KnownAny, _VovkController as VovkController, _VovkRequest as VovkRequest } from './types';
|
|
2
|
-
type Next = () => Promise<unknown>;
|
|
3
|
-
export declare function _createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(handler: null | ((this: VovkController, req: REQUEST, next: Next, ...args: ARGS) => unknown), initHandler?: (this: VovkController, ...args: ARGS) => Omit<HandlerSchema, 'path' | 'httpMethod'> | ((handlerSchema: HandlerSchema | null) => Omit<HandlerSchema, 'path' | 'httpMethod'>) | null | undefined): (...args: ARGS) => (target: KnownAny, propertyKey: string) => void;
|
|
4
|
-
export {};
|
package/generateStaticAPI.d.ts
DELETED
package/index.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { _createSegment as createSegment } from './createSegment';
|
|
2
|
-
import { type _VovkErrorResponse as VovkErrorResponse, type _VovkRequest as VovkRequest, type _VovkBody as VovkBody, type _VovkQuery as VovkQuery, type _VovkParams as VovkParams, type _VovkReturnType as VovkReturnType, type _VovkYieldType as VovkYieldType, type _VovkSchema as VovkSchema, _HttpStatus as HttpStatus, _HttpMethod as HttpMethod } from './types';
|
|
3
|
-
import type { _VovkClientOptions as VovkClientOptions, _VovkClientFetcher as VovkClientFetcher, _VovkDefaultFetcherOptions as VovkDefaultFetcherOptions, _VovkValidateOnClient as VovkValidateOnClient } from './client/types';
|
|
4
|
-
import { _HttpException as HttpException } from './HttpException';
|
|
5
|
-
import { _createDecorator as createDecorator } from './createDecorator';
|
|
6
|
-
import { _StreamResponse as StreamResponse } from './StreamResponse';
|
|
7
|
-
import { worker } from './worker';
|
|
8
|
-
import { _generateStaticAPI as generateStaticAPI } from './generateStaticAPI';
|
|
9
|
-
export { type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkValidateOnClient, type VovkSchema, type VovkErrorResponse, type VovkRequest, type VovkBody, type VovkQuery, type VovkParams, type VovkReturnType, type VovkYieldType, type VovkClientOptions, StreamResponse, HttpException, HttpStatus, HttpMethod, createSegment, createDecorator, worker, generateStaticAPI, };
|
|
10
|
-
export declare const get: {
|
|
11
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
12
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
13
|
-
}, post: {
|
|
14
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
15
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
16
|
-
}, put: {
|
|
17
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
18
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
19
|
-
}, patch: {
|
|
20
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
21
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
22
|
-
}, del: {
|
|
23
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
24
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
25
|
-
}, head: {
|
|
26
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
27
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
28
|
-
}, options: {
|
|
29
|
-
(givenPath?: string | undefined, options?: import("./types")._DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void>;
|
|
30
|
-
auto: (options?: import("./types")._DecoratorOptions) => (givenTarget: import("./types")._KnownAny, propertyKey: string) => void;
|
|
31
|
-
}, prefix: (givenPath?: string) => (givenTarget: import("./types")._KnownAny) => any, initVovk: (options: {
|
|
32
|
-
segmentName?: string;
|
|
33
|
-
controllers: Record<string, import("./types")._StaticClass>;
|
|
34
|
-
workers?: Record<string, import("./types")._StaticClass>;
|
|
35
|
-
exposeValidation?: boolean;
|
|
36
|
-
emitSchema?: boolean;
|
|
37
|
-
onError?: (err: Error, req: VovkRequest) => void | Promise<void>;
|
|
38
|
-
}) => {
|
|
39
|
-
GET: (req: VovkRequest, data: {
|
|
40
|
-
params: Promise<Record<string, string[]>>;
|
|
41
|
-
}) => Promise<Response>;
|
|
42
|
-
POST: (req: VovkRequest, data: {
|
|
43
|
-
params: Promise<Record<string, string[]>>;
|
|
44
|
-
}) => Promise<Response>;
|
|
45
|
-
PUT: (req: VovkRequest, data: {
|
|
46
|
-
params: Promise<Record<string, string[]>>;
|
|
47
|
-
}) => Promise<Response>;
|
|
48
|
-
PATCH: (req: VovkRequest, data: {
|
|
49
|
-
params: Promise<Record<string, string[]>>;
|
|
50
|
-
}) => Promise<Response>;
|
|
51
|
-
DELETE: (req: VovkRequest, data: {
|
|
52
|
-
params: Promise<Record<string, string[]>>;
|
|
53
|
-
}) => Promise<Response>;
|
|
54
|
-
HEAD: (req: VovkRequest, data: {
|
|
55
|
-
params: Promise<Record<string, string[]>>;
|
|
56
|
-
}) => Promise<Response>;
|
|
57
|
-
OPTIONS: (req: VovkRequest, data: {
|
|
58
|
-
params: Promise<Record<string, string[]>>;
|
|
59
|
-
}) => Promise<Response>;
|
|
60
|
-
};
|
package/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.initVovk = exports.prefix = exports.options = exports.head = exports.del = exports.patch = exports.put = exports.post = exports.get = exports.generateStaticAPI = exports.worker = exports.createDecorator = exports.createSegment = exports.HttpMethod = exports.HttpStatus = exports.HttpException = exports.StreamResponse = void 0;
|
|
5
|
-
const createSegment_1 = require("./createSegment");
|
|
6
|
-
Object.defineProperty(exports, "createSegment", { enumerable: true, get: function () { return createSegment_1._createSegment; } });
|
|
7
|
-
const types_1 = require("./types");
|
|
8
|
-
Object.defineProperty(exports, "HttpStatus", { enumerable: true, get: function () { return types_1._HttpStatus; } });
|
|
9
|
-
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return types_1._HttpMethod; } });
|
|
10
|
-
const HttpException_1 = require("./HttpException");
|
|
11
|
-
Object.defineProperty(exports, "HttpException", { enumerable: true, get: function () { return HttpException_1._HttpException; } });
|
|
12
|
-
const createDecorator_1 = require("./createDecorator");
|
|
13
|
-
Object.defineProperty(exports, "createDecorator", { enumerable: true, get: function () { return createDecorator_1._createDecorator; } });
|
|
14
|
-
const StreamResponse_1 = require("./StreamResponse");
|
|
15
|
-
Object.defineProperty(exports, "StreamResponse", { enumerable: true, get: function () { return StreamResponse_1._StreamResponse; } });
|
|
16
|
-
const worker_1 = require("./worker");
|
|
17
|
-
Object.defineProperty(exports, "worker", { enumerable: true, get: function () { return worker_1.worker; } });
|
|
18
|
-
const generateStaticAPI_1 = require("./generateStaticAPI");
|
|
19
|
-
Object.defineProperty(exports, "generateStaticAPI", { enumerable: true, get: function () { return generateStaticAPI_1._generateStaticAPI; } });
|
|
20
|
-
_a = (0, createSegment_1._createSegment)(), exports.get = _a.get, exports.post = _a.post, exports.put = _a.put, exports.patch = _a.patch, exports.del = _a.del, exports.head = _a.head, exports.options = _a.options, exports.prefix = _a.prefix, exports.initVovk = _a.initVovk;
|
package/types.d.ts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import type { NextRequest } from 'next/server';
|
|
2
|
-
import type { _StreamResponse as StreamResponse } from './StreamResponse';
|
|
3
|
-
import { _StreamAsyncIterator as StreamAsyncIterator } from './client/types';
|
|
4
|
-
export type _KnownAny = any;
|
|
5
|
-
export type _StaticClass = Function;
|
|
6
|
-
export type _VovkSchema = {
|
|
7
|
-
emitSchema: boolean;
|
|
8
|
-
segmentName: string;
|
|
9
|
-
workers: Record<string, _VovkWorkerSchema>;
|
|
10
|
-
controllers: Record<string, _VovkControllerSchema>;
|
|
11
|
-
};
|
|
12
|
-
export type _VovkErrorResponse = {
|
|
13
|
-
statusCode: _HttpStatus;
|
|
14
|
-
message: string;
|
|
15
|
-
isError: true;
|
|
16
|
-
};
|
|
17
|
-
export type _HandlerSchema = {
|
|
18
|
-
path: string;
|
|
19
|
-
httpMethod: _HttpMethod;
|
|
20
|
-
clientValidators?: {
|
|
21
|
-
query?: _KnownAny;
|
|
22
|
-
body?: _KnownAny;
|
|
23
|
-
};
|
|
24
|
-
customSchema?: Record<string, _KnownAny>;
|
|
25
|
-
};
|
|
26
|
-
export type _VovkControllerSchema = {
|
|
27
|
-
_controllerName: string;
|
|
28
|
-
_originalControllerName: string;
|
|
29
|
-
_prefix?: string;
|
|
30
|
-
_handlers: Record<string, _HandlerSchema>;
|
|
31
|
-
};
|
|
32
|
-
export type _VovkWorkerSchema = {
|
|
33
|
-
_workerName: string;
|
|
34
|
-
_originalWorkerName: string;
|
|
35
|
-
_handlers: Record<string, {
|
|
36
|
-
isGenerator?: true;
|
|
37
|
-
}>;
|
|
38
|
-
};
|
|
39
|
-
export type _VovkControllerInternal = _VovkControllerSchema & {
|
|
40
|
-
_activated?: true;
|
|
41
|
-
_onError?: (err: Error, req: _VovkRequest) => void | Promise<void>;
|
|
42
|
-
};
|
|
43
|
-
export type _VovkController = _StaticClass & _VovkControllerInternal & {
|
|
44
|
-
[key: string]: unknown;
|
|
45
|
-
};
|
|
46
|
-
export type _VovkWorker = _StaticClass & _VovkWorkerSchema & {
|
|
47
|
-
[key: string]: unknown;
|
|
48
|
-
};
|
|
49
|
-
export type _DecoratorOptions = {
|
|
50
|
-
cors?: boolean;
|
|
51
|
-
headers?: Record<string, string>;
|
|
52
|
-
};
|
|
53
|
-
export type _RouteHandler = ((req: _VovkRequest, params: Record<string, string>) => Response | Promise<Response> | Iterable<unknown> | AsyncIterable<unknown>) & {
|
|
54
|
-
_options?: _DecoratorOptions;
|
|
55
|
-
};
|
|
56
|
-
export interface _VovkRequest<BODY = undefined, QUERY extends object | undefined = undefined> extends Omit<NextRequest, 'json' | 'nextUrl'> {
|
|
57
|
-
json: () => Promise<BODY>;
|
|
58
|
-
nextUrl: Omit<NextRequest['nextUrl'], 'searchParams'> & {
|
|
59
|
-
searchParams: Omit<NextRequest['nextUrl']['searchParams'], 'get' | 'getAll' | 'entries' | 'forEach' | 'keys' | 'values'> & {
|
|
60
|
-
get: <KEY extends keyof QUERY>(key: KEY) => QUERY[KEY] extends readonly (infer ITEM)[] ? ITEM : QUERY[KEY];
|
|
61
|
-
getAll: <KEY extends keyof QUERY>(key: KEY) => QUERY[KEY] extends _KnownAny[] ? QUERY[KEY] : QUERY[KEY][];
|
|
62
|
-
entries: () => IterableIterator<[keyof QUERY, QUERY[keyof QUERY]]>;
|
|
63
|
-
forEach: (callbackfn: (value: QUERY[keyof QUERY], key: keyof QUERY, searchParams: NextRequest['nextUrl']['searchParams']) => void) => void;
|
|
64
|
-
keys: () => IterableIterator<keyof QUERY>;
|
|
65
|
-
values: () => IterableIterator<QUERY[keyof QUERY]>;
|
|
66
|
-
readonly __queryType: QUERY;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
vovk: {
|
|
70
|
-
body: () => Promise<BODY>;
|
|
71
|
-
query: () => QUERY;
|
|
72
|
-
meta: <T = Record<_KnownAny, _KnownAny>>(meta?: T | null) => T;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export type _ControllerStaticMethod<REQ extends _VovkRequest<undefined, _KnownAny> = _VovkRequest<undefined, Record<string, string | string[]>>, PARAMS extends {
|
|
76
|
-
[key: string]: string;
|
|
77
|
-
} = _KnownAny> = ((req: REQ, params: PARAMS) => unknown) & {
|
|
78
|
-
_controller?: _VovkController;
|
|
79
|
-
};
|
|
80
|
-
export type _VovkControllerBody<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
81
|
-
[key: string]: string;
|
|
82
|
-
} = _KnownAny> = Awaited<ReturnType<Parameters<T>[0]['json']>>;
|
|
83
|
-
export type _VovkControllerQuery<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
84
|
-
[key: string]: string;
|
|
85
|
-
} = _KnownAny> = Parameters<T>[0]['nextUrl']['searchParams']['__queryType'];
|
|
86
|
-
export type _VovkControllerParams<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
87
|
-
[key: string]: string;
|
|
88
|
-
} = _KnownAny> = Parameters<T>[1];
|
|
89
|
-
export type _VovkControllerReturnType<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
90
|
-
[key: string]: string;
|
|
91
|
-
} = _KnownAny> = Awaited<ReturnType<T>>;
|
|
92
|
-
export type _VovkControlerYieldType<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
93
|
-
[key: string]: string;
|
|
94
|
-
} = _KnownAny> = T extends (...args: _KnownAny[]) => AsyncGenerator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Generator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Promise<StreamResponse<infer Y>> | StreamResponse<infer Y> ? Y : never;
|
|
95
|
-
export type _VovkClientBody<T extends (options: OPTIONS) => _KnownAny, OPTIONS extends {
|
|
96
|
-
body: B;
|
|
97
|
-
[key: string]: _KnownAny;
|
|
98
|
-
} = Parameters<T>[0], B = _KnownAny> = Parameters<T>[0]['body'];
|
|
99
|
-
export type _VovkClientQuery<T extends (options: OPTIONS) => _KnownAny, OPTIONS extends {
|
|
100
|
-
query: Q;
|
|
101
|
-
[key: string]: _KnownAny;
|
|
102
|
-
} = Parameters<T>[0], Q = _KnownAny> = Parameters<T>[0]['query'];
|
|
103
|
-
export type _VovkClientParams<T extends (options: OPTIONS) => _KnownAny, OPTIONS extends {
|
|
104
|
-
params: P;
|
|
105
|
-
[key: string]: _KnownAny;
|
|
106
|
-
} = Parameters<T>[0], P = _KnownAny> = Parameters<T>[0]['params'];
|
|
107
|
-
export type _VovkClientYieldType<T extends (...args: _KnownAny[]) => unknown> = T extends (...args: _KnownAny[]) => Promise<StreamAsyncIterator<infer Y>> ? Y : never;
|
|
108
|
-
export type _VovkClientReturnType<T extends (...args: _KnownAny) => unknown> = Awaited<ReturnType<T>>;
|
|
109
|
-
type ClientStaticMethod = ((...args: _KnownAny[]) => _KnownAny) & {
|
|
110
|
-
__isClientMethod: boolean;
|
|
111
|
-
};
|
|
112
|
-
export type _VovkBody<T extends ClientStaticMethod | _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
113
|
-
[key: string]: string;
|
|
114
|
-
} = _KnownAny> = T extends ClientStaticMethod ? _VovkClientBody<T> : T extends _ControllerStaticMethod<REQ, PARAMS> ? _VovkControllerBody<T, REQ, PARAMS> : never;
|
|
115
|
-
export type _VovkQuery<T extends ClientStaticMethod | _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
116
|
-
[key: string]: string;
|
|
117
|
-
} = _KnownAny> = T extends ClientStaticMethod ? _VovkClientQuery<T> : T extends _ControllerStaticMethod<REQ, PARAMS> ? _VovkControllerQuery<T, REQ, PARAMS> : never;
|
|
118
|
-
export type _VovkParams<T extends ClientStaticMethod | _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
119
|
-
[key: string]: string;
|
|
120
|
-
} = _KnownAny> = T extends ClientStaticMethod ? _VovkClientParams<T> : T extends _ControllerStaticMethod<REQ, PARAMS> ? _VovkControllerParams<T, REQ, PARAMS> : never;
|
|
121
|
-
export type _VovkYieldType<T extends ClientStaticMethod | _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
122
|
-
[key: string]: string;
|
|
123
|
-
} = _KnownAny> = T extends ClientStaticMethod ? _VovkClientYieldType<T> : T extends _ControllerStaticMethod<REQ, PARAMS> ? _VovkControlerYieldType<T, REQ, PARAMS> : never;
|
|
124
|
-
export type _VovkReturnType<T extends ClientStaticMethod | _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
|
|
125
|
-
[key: string]: string;
|
|
126
|
-
} = _KnownAny> = T extends ClientStaticMethod ? _VovkClientReturnType<T> : T extends _ControllerStaticMethod<REQ, PARAMS> ? _VovkControllerReturnType<T, REQ, PARAMS> : never;
|
|
127
|
-
export type _StreamAbortMessage = {
|
|
128
|
-
isError: true;
|
|
129
|
-
reason: _KnownAny;
|
|
130
|
-
};
|
|
131
|
-
export declare enum _HttpMethod {
|
|
132
|
-
GET = "GET",
|
|
133
|
-
POST = "POST",
|
|
134
|
-
PUT = "PUT",
|
|
135
|
-
PATCH = "PATCH",
|
|
136
|
-
DELETE = "DELETE",
|
|
137
|
-
HEAD = "HEAD",
|
|
138
|
-
OPTIONS = "OPTIONS"
|
|
139
|
-
}
|
|
140
|
-
export declare enum _HttpStatus {
|
|
141
|
-
NULL = 0,
|
|
142
|
-
CONTINUE = 100,
|
|
143
|
-
SWITCHING_PROTOCOLS = 101,
|
|
144
|
-
PROCESSING = 102,
|
|
145
|
-
EARLYHINTS = 103,
|
|
146
|
-
OK = 200,
|
|
147
|
-
CREATED = 201,
|
|
148
|
-
ACCEPTED = 202,
|
|
149
|
-
NON_AUTHORITATIVE_INFORMATION = 203,
|
|
150
|
-
NO_CONTENT = 204,
|
|
151
|
-
RESET_CONTENT = 205,
|
|
152
|
-
PARTIAL_CONTENT = 206,
|
|
153
|
-
AMBIGUOUS = 300,
|
|
154
|
-
MOVED_PERMANENTLY = 301,
|
|
155
|
-
FOUND = 302,
|
|
156
|
-
SEE_OTHER = 303,
|
|
157
|
-
NOT_MODIFIED = 304,
|
|
158
|
-
TEMPORARY_REDIRECT = 307,
|
|
159
|
-
PERMANENT_REDIRECT = 308,
|
|
160
|
-
BAD_REQUEST = 400,
|
|
161
|
-
UNAUTHORIZED = 401,
|
|
162
|
-
PAYMENT_REQUIRED = 402,
|
|
163
|
-
FORBIDDEN = 403,
|
|
164
|
-
NOT_FOUND = 404,
|
|
165
|
-
METHOD_NOT_ALLOWED = 405,
|
|
166
|
-
NOT_ACCEPTABLE = 406,
|
|
167
|
-
PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
168
|
-
REQUEST_TIMEOUT = 408,
|
|
169
|
-
CONFLICT = 409,
|
|
170
|
-
GONE = 410,
|
|
171
|
-
LENGTH_REQUIRED = 411,
|
|
172
|
-
PRECONDITION_FAILED = 412,
|
|
173
|
-
PAYLOAD_TOO_LARGE = 413,
|
|
174
|
-
URI_TOO_LONG = 414,
|
|
175
|
-
UNSUPPORTED_MEDIA_TYPE = 415,
|
|
176
|
-
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
177
|
-
EXPECTATION_FAILED = 417,
|
|
178
|
-
I_AM_A_TEAPOT = 418,
|
|
179
|
-
MISDIRECTED = 421,
|
|
180
|
-
UNPROCESSABLE_ENTITY = 422,
|
|
181
|
-
FAILED_DEPENDENCY = 424,
|
|
182
|
-
PRECONDITION_REQUIRED = 428,
|
|
183
|
-
TOO_MANY_REQUESTS = 429,
|
|
184
|
-
INTERNAL_SERVER_ERROR = 500,
|
|
185
|
-
NOT_IMPLEMENTED = 501,
|
|
186
|
-
BAD_GATEWAY = 502,
|
|
187
|
-
SERVICE_UNAVAILABLE = 503,
|
|
188
|
-
GATEWAY_TIMEOUT = 504,
|
|
189
|
-
HTTP_VERSION_NOT_SUPPORTED = 505
|
|
190
|
-
}
|
|
191
|
-
export {};
|
package/types.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._HttpStatus = exports._HttpMethod = void 0;
|
|
4
|
-
var _HttpMethod;
|
|
5
|
-
(function (_HttpMethod) {
|
|
6
|
-
_HttpMethod["GET"] = "GET";
|
|
7
|
-
_HttpMethod["POST"] = "POST";
|
|
8
|
-
_HttpMethod["PUT"] = "PUT";
|
|
9
|
-
_HttpMethod["PATCH"] = "PATCH";
|
|
10
|
-
_HttpMethod["DELETE"] = "DELETE";
|
|
11
|
-
_HttpMethod["HEAD"] = "HEAD";
|
|
12
|
-
_HttpMethod["OPTIONS"] = "OPTIONS";
|
|
13
|
-
})(_HttpMethod || (exports._HttpMethod = _HttpMethod = {}));
|
|
14
|
-
var _HttpStatus;
|
|
15
|
-
(function (_HttpStatus) {
|
|
16
|
-
_HttpStatus[_HttpStatus["NULL"] = 0] = "NULL";
|
|
17
|
-
_HttpStatus[_HttpStatus["CONTINUE"] = 100] = "CONTINUE";
|
|
18
|
-
_HttpStatus[_HttpStatus["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
19
|
-
_HttpStatus[_HttpStatus["PROCESSING"] = 102] = "PROCESSING";
|
|
20
|
-
_HttpStatus[_HttpStatus["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
21
|
-
_HttpStatus[_HttpStatus["OK"] = 200] = "OK";
|
|
22
|
-
_HttpStatus[_HttpStatus["CREATED"] = 201] = "CREATED";
|
|
23
|
-
_HttpStatus[_HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
|
|
24
|
-
_HttpStatus[_HttpStatus["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
25
|
-
_HttpStatus[_HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
26
|
-
_HttpStatus[_HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
27
|
-
_HttpStatus[_HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
28
|
-
_HttpStatus[_HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
29
|
-
_HttpStatus[_HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
30
|
-
_HttpStatus[_HttpStatus["FOUND"] = 302] = "FOUND";
|
|
31
|
-
_HttpStatus[_HttpStatus["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
32
|
-
_HttpStatus[_HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
33
|
-
_HttpStatus[_HttpStatus["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
34
|
-
_HttpStatus[_HttpStatus["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
35
|
-
_HttpStatus[_HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
36
|
-
_HttpStatus[_HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
37
|
-
_HttpStatus[_HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
38
|
-
_HttpStatus[_HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
39
|
-
_HttpStatus[_HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
40
|
-
_HttpStatus[_HttpStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
41
|
-
_HttpStatus[_HttpStatus["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
42
|
-
_HttpStatus[_HttpStatus["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
43
|
-
_HttpStatus[_HttpStatus["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
44
|
-
_HttpStatus[_HttpStatus["CONFLICT"] = 409] = "CONFLICT";
|
|
45
|
-
_HttpStatus[_HttpStatus["GONE"] = 410] = "GONE";
|
|
46
|
-
_HttpStatus[_HttpStatus["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
47
|
-
_HttpStatus[_HttpStatus["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
48
|
-
_HttpStatus[_HttpStatus["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
49
|
-
_HttpStatus[_HttpStatus["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
50
|
-
_HttpStatus[_HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
51
|
-
_HttpStatus[_HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
52
|
-
_HttpStatus[_HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
53
|
-
_HttpStatus[_HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
54
|
-
_HttpStatus[_HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
|
|
55
|
-
_HttpStatus[_HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
56
|
-
_HttpStatus[_HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
57
|
-
_HttpStatus[_HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
58
|
-
_HttpStatus[_HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
59
|
-
_HttpStatus[_HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
60
|
-
_HttpStatus[_HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
61
|
-
_HttpStatus[_HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
62
|
-
_HttpStatus[_HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
63
|
-
_HttpStatus[_HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
64
|
-
_HttpStatus[_HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
65
|
-
})(_HttpStatus || (exports._HttpStatus = _HttpStatus = {}));
|
package/utils/reqQuery.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = reqQuery;
|
|
4
|
-
const clientizeController_1 = require("../client/clientizeController");
|
|
5
|
-
function reqQuery(req) {
|
|
6
|
-
const queryArr = req.nextUrl.searchParams.get(clientizeController_1.ARRAY_QUERY_KEY)?.split(',') ?? null;
|
|
7
|
-
const entries = [...req.nextUrl.searchParams.entries()];
|
|
8
|
-
const query = entries.reduce((acc, [key, value]) => {
|
|
9
|
-
if (key === clientizeController_1.ARRAY_QUERY_KEY)
|
|
10
|
-
return acc;
|
|
11
|
-
if (queryArr?.includes(key)) {
|
|
12
|
-
if (!(key in acc)) {
|
|
13
|
-
acc[key] = [value];
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
acc[key].push(value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
acc[key] = value;
|
|
21
|
-
}
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
return query;
|
|
25
|
-
}
|
package/worker/index.d.ts
DELETED
package/worker/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promisifyWorker = exports.worker = void 0;
|
|
4
|
-
const worker_1 = require("./worker");
|
|
5
|
-
Object.defineProperty(exports, "worker", { enumerable: true, get: function () { return worker_1._worker; } });
|
|
6
|
-
const promisifyWorker_1 = require("./promisifyWorker");
|
|
7
|
-
Object.defineProperty(exports, "promisifyWorker", { enumerable: true, get: function () { return promisifyWorker_1._promisifyWorker; } });
|