vovk 3.0.0-draft.110 → 3.0.0-draft.111
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/{StreamJSONResponse.d.ts → JSONLinesResponse.d.ts} +1 -1
- package/dist/{StreamJSONResponse.js → JSONLinesResponse.js} +3 -3
- package/dist/VovkApp.js +2 -2
- package/dist/client/types.d.ts +3 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/types.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { headers } from 'next/headers';
|
|
2
2
|
import type { KnownAny, StreamAbortMessage } from './types';
|
|
3
3
|
import './utils/shim';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class JSONLinesResponse<T> extends Response {
|
|
5
5
|
isClosed: boolean;
|
|
6
6
|
controller?: ReadableStreamDefaultController;
|
|
7
7
|
readonly encoder: TextEncoder;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JSONLinesResponse = void 0;
|
|
4
4
|
require("./utils/shim");
|
|
5
|
-
class
|
|
5
|
+
class JSONLinesResponse extends Response {
|
|
6
6
|
isClosed = false;
|
|
7
7
|
controller;
|
|
8
8
|
encoder;
|
|
@@ -56,4 +56,4 @@ class StreamJSONResponse extends Response {
|
|
|
56
56
|
this.close();
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
exports.
|
|
59
|
+
exports.JSONLinesResponse = JSONLinesResponse;
|
package/dist/VovkApp.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.VovkApp = void 0;
|
|
8
8
|
const types_1 = require("./types");
|
|
9
9
|
const HttpException_1 = require("./HttpException");
|
|
10
|
-
const
|
|
10
|
+
const JSONLinesResponse_1 = require("./JSONLinesResponse");
|
|
11
11
|
const reqQuery_1 = __importDefault(require("./utils/reqQuery"));
|
|
12
12
|
const reqMeta_1 = __importDefault(require("./utils/reqMeta"));
|
|
13
13
|
const reqForm_1 = __importDefault(require("./utils/reqForm"));
|
|
@@ -144,7 +144,7 @@ class VovkApp {
|
|
|
144
144
|
(Reflect.has(result, Symbol.asyncIterator) &&
|
|
145
145
|
typeof result[Symbol.asyncIterator] === 'function'));
|
|
146
146
|
if (isIterator && !(result instanceof Array)) {
|
|
147
|
-
const streamResponse = new
|
|
147
|
+
const streamResponse = new JSONLinesResponse_1.JSONLinesResponse(await (0, headers_1.headers)(), {
|
|
148
148
|
headers: {
|
|
149
149
|
..._a.getHeadersFromOptions(staticMethod._options),
|
|
150
150
|
},
|
package/dist/client/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KnownAny, HttpMethod, ControllerStaticMethod, VovkControllerBody, VovkControllerQuery, VovkControllerParams, VovkHandlerSchema, VovkControllerSchema, VovkSegmentSchema, VovkFullSchema } from '../types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { JSONLinesResponse } from '../JSONLinesResponse';
|
|
3
3
|
import type { NextResponse } from 'next/server';
|
|
4
4
|
export type StaticMethodInput<T extends ControllerStaticMethod> = (VovkControllerBody<T> extends undefined | void ? {
|
|
5
5
|
body?: undefined;
|
|
@@ -26,7 +26,7 @@ export type VovkStreamAsyncIterable<T> = {
|
|
|
26
26
|
};
|
|
27
27
|
type StaticMethodReturn<T extends ControllerStaticMethod> = ReturnType<T> extends NextResponse<infer U> | Promise<NextResponse<infer U>> ? U : ReturnType<T> extends Response | Promise<Response> ? Awaited<ReturnType<T>> : ReturnType<T>;
|
|
28
28
|
type StaticMethodReturnPromise<T extends ControllerStaticMethod> = ToPromise<StaticMethodReturn<T>>;
|
|
29
|
-
type ClientMethod<T extends (...args: KnownAny[]) => void | object |
|
|
29
|
+
type ClientMethod<T extends (...args: KnownAny[]) => void | object | JSONLinesResponse<STREAM> | Promise<JSONLinesResponse<STREAM>>, OPTS extends Record<string, KnownAny>, STREAM extends KnownAny = unknown> = (<R>(options: (StaticMethodInput<T> extends {
|
|
30
30
|
body?: undefined | null;
|
|
31
31
|
query?: undefined;
|
|
32
32
|
params?: undefined;
|
|
@@ -34,7 +34,7 @@ type ClientMethod<T extends (...args: KnownAny[]) => void | object | StreamJSONR
|
|
|
34
34
|
params: StaticMethodInput<T>['params'];
|
|
35
35
|
} : unknown : StaticMethodInput<T>) & (Partial<OPTS & {
|
|
36
36
|
transform: (staticMethodReturn: Awaited<StaticMethodReturn<T>>) => R;
|
|
37
|
-
}> | void)) => ReturnType<T> extends Promise<
|
|
37
|
+
}> | void)) => ReturnType<T> extends Promise<JSONLinesResponse<infer U>> | JSONLinesResponse<infer U> | Iterator<infer U> | AsyncIterator<infer U> ? Promise<VovkStreamAsyncIterable<U>> : R extends object ? Promise<R> : StaticMethodReturnPromise<T>) & {
|
|
38
38
|
schema: VovkHandlerSchema;
|
|
39
39
|
controllerSchema: VovkControllerSchema;
|
|
40
40
|
segmentSchema: VovkSegmentSchema;
|
|
@@ -81,9 +81,6 @@ export type VovkClientFetcher<OPTS extends Record<string, KnownAny> = Record<str
|
|
|
81
81
|
};
|
|
82
82
|
} & OPTS) => KnownAny;
|
|
83
83
|
export interface VovkDefaultFetcherOptions {
|
|
84
|
-
reactNative?: {
|
|
85
|
-
textStreaming: boolean;
|
|
86
|
-
};
|
|
87
84
|
apiRoot?: string;
|
|
88
85
|
segmentName?: string;
|
|
89
86
|
disableClientValidation?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { HttpStatus as HttpStatus, HttpMethod as HttpMethod, type KnownAny, type
|
|
|
3
3
|
import { type VovkClient, type VovkClientOptions, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkValidateOnClient, type VovkStreamAsyncIterable, createRPC, fetcher } from './client';
|
|
4
4
|
import { HttpException } from './HttpException';
|
|
5
5
|
import { createDecorator } from './createDecorator';
|
|
6
|
-
import {
|
|
6
|
+
import { JSONLinesResponse } from './JSONLinesResponse';
|
|
7
7
|
import { generateStaticAPI } from './utils/generateStaticAPI';
|
|
8
8
|
import { withValidation } from './utils/withValidation';
|
|
9
|
-
export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkControllerBody, type VovkControllerQuery, type VovkControllerParams, type VovkControllerYieldType, type VovkControllerOutput, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkClientOptions, type VovkControllerSchema, type VovkHandlerSchema, type VovkFullSchema, type VovkConfig, type VovkStrictConfig, type VovkEnv, type VovkValidationType,
|
|
9
|
+
export { type KnownAny, type VovkClient, type VovkClientFetcher, type VovkDefaultFetcherOptions, type VovkStreamAsyncIterable, type VovkValidateOnClient, type VovkSegmentSchema, type VovkErrorResponse, type VovkRequest, type VovkControllerBody, type VovkControllerQuery, type VovkControllerParams, type VovkControllerYieldType, type VovkControllerOutput, type VovkBody, type VovkQuery, type VovkParams, type VovkYieldType, type VovkReturnType, type VovkClientOptions, type VovkControllerSchema, type VovkHandlerSchema, type VovkFullSchema, type VovkConfig, type VovkStrictConfig, type VovkEnv, type VovkValidationType, JSONLinesResponse, HttpException, HttpStatus, HttpMethod, createVovkApp, createDecorator, createRPC, fetcher, generateStaticAPI, withValidation, };
|
|
10
10
|
export declare const get: {
|
|
11
11
|
(givenPath?: string | undefined, options?: import("./types").DecoratorOptions | undefined): ReturnType<(givenPath?: string, options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void>;
|
|
12
12
|
auto: (options?: import("./types").DecoratorOptions) => (givenTarget: KnownAny, propertyKey: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
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.withValidation = exports.generateStaticAPI = exports.fetcher = exports.createRPC = exports.createDecorator = exports.createVovkApp = exports.HttpMethod = exports.HttpStatus = exports.HttpException = exports.
|
|
4
|
+
exports.initVovk = exports.prefix = exports.options = exports.head = exports.del = exports.patch = exports.put = exports.post = exports.get = exports.withValidation = exports.generateStaticAPI = exports.fetcher = exports.createRPC = exports.createDecorator = exports.createVovkApp = exports.HttpMethod = exports.HttpStatus = exports.HttpException = exports.JSONLinesResponse = void 0;
|
|
5
5
|
const createVovkApp_1 = require("./createVovkApp");
|
|
6
6
|
Object.defineProperty(exports, "createVovkApp", { enumerable: true, get: function () { return createVovkApp_1.createVovkApp; } });
|
|
7
7
|
const types_1 = require("./types");
|
|
@@ -14,8 +14,8 @@ const HttpException_1 = require("./HttpException");
|
|
|
14
14
|
Object.defineProperty(exports, "HttpException", { enumerable: true, get: function () { return HttpException_1.HttpException; } });
|
|
15
15
|
const createDecorator_1 = require("./createDecorator");
|
|
16
16
|
Object.defineProperty(exports, "createDecorator", { enumerable: true, get: function () { return createDecorator_1.createDecorator; } });
|
|
17
|
-
const
|
|
18
|
-
Object.defineProperty(exports, "
|
|
17
|
+
const JSONLinesResponse_1 = require("./JSONLinesResponse");
|
|
18
|
+
Object.defineProperty(exports, "JSONLinesResponse", { enumerable: true, get: function () { return JSONLinesResponse_1.JSONLinesResponse; } });
|
|
19
19
|
const generateStaticAPI_1 = require("./utils/generateStaticAPI");
|
|
20
20
|
Object.defineProperty(exports, "generateStaticAPI", { enumerable: true, get: function () { return generateStaticAPI_1.generateStaticAPI; } });
|
|
21
21
|
const withValidation_1 = require("./utils/withValidation");
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextRequest } from 'next/server';
|
|
2
2
|
import type { OperationObject } from 'openapi3-ts/oas31';
|
|
3
|
-
import type {
|
|
3
|
+
import type { JSONLinesResponse } from './JSONLinesResponse';
|
|
4
4
|
import { VovkStreamAsyncIterable } from './client/types';
|
|
5
5
|
export type KnownAny = any;
|
|
6
6
|
export type StaticClass = Function;
|
|
@@ -79,7 +79,7 @@ export type ControllerStaticMethod<REQ extends VovkRequest<KnownAny, KnownAny> =
|
|
|
79
79
|
export type VovkControllerBody<T extends (...args: KnownAny) => KnownAny> = Awaited<ReturnType<Parameters<T>[0]['vovk']['body']>>;
|
|
80
80
|
export type VovkControllerQuery<T extends (...args: KnownAny) => KnownAny> = ReturnType<Parameters<T>[0]['vovk']['query']>;
|
|
81
81
|
export type VovkControllerParams<T extends (...args: KnownAny) => KnownAny> = Parameters<T>[1] extends object ? Parameters<T>[1] : ReturnType<Parameters<T>[0]['vovk']['params']>;
|
|
82
|
-
export type VovkControllerYieldType<T extends (req: VovkRequest<KnownAny, KnownAny>) => 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<
|
|
82
|
+
export type VovkControllerYieldType<T extends (req: VovkRequest<KnownAny, KnownAny>) => 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<JSONLinesResponse<infer Y>> | JSONLinesResponse<infer Y> ? Y : never;
|
|
83
83
|
export type VovkControllerOutput<T extends ((...args: KnownAny) => KnownAny) & {
|
|
84
84
|
__output?: KnownAny;
|
|
85
85
|
}> = T['__output'];
|
|
@@ -102,9 +102,9 @@ export type VovkEnv = {
|
|
|
102
102
|
VOVK_EMIT_SEGMENT_CLIENT?: string;
|
|
103
103
|
VOVK_CLIENT_OUT_DIR?: string;
|
|
104
104
|
VOVK_SCHEMA_OUT_DIR?: string;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
VOVK_IMPORTS_FETCHER?: string;
|
|
106
|
+
VOVK_IMPORTS_VALIDATE_ON_CLIENT?: string;
|
|
107
|
+
VOVK_IMPORTS_CREATE_RPC?: string;
|
|
108
108
|
VOVK_MODULES_DIR?: string;
|
|
109
109
|
VOVK_ORIGIN?: string;
|
|
110
110
|
VOVK_ROOT_ENTRY?: string;
|
package/package.json
CHANGED