@duplojs/http 0.5.1 → 0.6.2
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/client/httpClient.cjs +5 -0
- package/dist/client/httpClient.d.ts +1 -0
- package/dist/client/httpClient.mjs +5 -0
- package/dist/client/queryToString.cjs +1 -1
- package/dist/client/queryToString.mjs +1 -1
- package/dist/client/unexpectedResponseError.d.ts +4 -4
- package/dist/core/builders/preflight/route.d.ts +4 -4
- package/dist/core/clean/constraint.cjs +24 -0
- package/dist/core/clean/constraint.d.ts +8 -0
- package/dist/core/clean/constraint.mjs +22 -0
- package/dist/core/clean/constraintsSet.cjs +27 -0
- package/dist/core/clean/constraintsSet.d.ts +8 -0
- package/dist/core/clean/constraintsSet.mjs +25 -0
- package/dist/core/clean/entity.cjs +33 -0
- package/dist/core/clean/entity.d.ts +20 -0
- package/dist/core/clean/entity.mjs +31 -0
- package/dist/core/clean/index.cjs +8 -0
- package/dist/core/clean/index.d.ts +5 -0
- package/dist/core/clean/index.mjs +5 -0
- package/dist/core/clean/newType.cjs +15 -0
- package/dist/core/clean/newType.d.ts +8 -0
- package/dist/core/clean/newType.mjs +13 -0
- package/dist/core/clean/primitive.cjs +12 -0
- package/dist/core/clean/primitive.d.ts +8 -0
- package/dist/core/clean/primitive.mjs +10 -0
- package/dist/core/index.cjs +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +1 -0
- package/dist/core/response/contract.d.ts +1 -1
- package/dist/core/response/hook.d.ts +1 -1
- package/dist/core/response/predicted.d.ts +1 -1
- package/dist/core/router/buildError.d.ts +1 -1
- package/dist/interfaces/node/createHttpServer.cjs +3 -0
- package/dist/interfaces/node/createHttpServer.mjs +3 -0
- package/dist/interfaces/node/error/bodyParseUnknownError.d.ts +1 -1
- package/dist/interfaces/node/error/bodyParseWrongChunkReceived.d.ts +1 -1
- package/dist/interfaces/node/error/bodySizeExceedsLimitError.d.ts +1 -1
- package/dist/plugins/openApiGenerator/makeOpenApiRoute.cjs +9 -1
- package/dist/plugins/openApiGenerator/makeOpenApiRoute.d.ts +1 -1
- package/dist/plugins/openApiGenerator/makeOpenApiRoute.mjs +9 -1
- package/package.json +11 -7
|
@@ -140,6 +140,11 @@ function createHttpClient(clientParams) {
|
|
|
140
140
|
path,
|
|
141
141
|
...params,
|
|
142
142
|
})),
|
|
143
|
+
patch: ((path, params) => self.request({
|
|
144
|
+
method: "PATCH",
|
|
145
|
+
path,
|
|
146
|
+
...params,
|
|
147
|
+
})),
|
|
143
148
|
delete: ((path, params) => self.request({
|
|
144
149
|
method: "DELETE",
|
|
145
150
|
path,
|
|
@@ -45,6 +45,7 @@ export interface HttpClient<GenericServerRoute extends ServerRoute = ServerRoute
|
|
|
45
45
|
get: HttpClientRequestMethod<GenericServerRoute, GenericHookParams, "GET">;
|
|
46
46
|
post: HttpClientRequestMethod<GenericServerRoute, GenericHookParams, "POST">;
|
|
47
47
|
put: HttpClientRequestMethod<GenericServerRoute, GenericHookParams, "PUT">;
|
|
48
|
+
patch: HttpClientRequestMethod<GenericServerRoute, GenericHookParams, "PATCH">;
|
|
48
49
|
delete: HttpClientRequestMethod<GenericServerRoute, GenericHookParams, "DELETE">;
|
|
49
50
|
}
|
|
50
51
|
export interface CreateHttpClientParams {
|
|
@@ -118,6 +118,11 @@ function createHttpClient(clientParams) {
|
|
|
118
118
|
path,
|
|
119
119
|
...params,
|
|
120
120
|
})),
|
|
121
|
+
patch: ((path, params) => self.request({
|
|
122
|
+
method: "PATCH",
|
|
123
|
+
path,
|
|
124
|
+
...params,
|
|
125
|
+
})),
|
|
121
126
|
delete: ((path, params) => self.request({
|
|
122
127
|
method: "DELETE",
|
|
123
128
|
path,
|
|
@@ -6,7 +6,7 @@ export interface RequestErrorContent {
|
|
|
6
6
|
}
|
|
7
7
|
declare const UnexpectedInformationResponseError_base: new (params: {
|
|
8
8
|
"@DuplojsHttpClient/unexpected-information-response-error"?: unknown;
|
|
9
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-information-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-information-response-error", unknown>, unknown> & Error;
|
|
9
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-information-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-information-response-error", unknown>, unknown> & Error;
|
|
10
10
|
export declare class UnexpectedInformationResponseError extends UnexpectedInformationResponseError_base {
|
|
11
11
|
information: string | string[];
|
|
12
12
|
response: RequestErrorContent | ClientResponse;
|
|
@@ -14,7 +14,7 @@ export declare class UnexpectedInformationResponseError extends UnexpectedInform
|
|
|
14
14
|
}
|
|
15
15
|
declare const UnexpectedCodeResponseError_base: new (params: {
|
|
16
16
|
"@DuplojsHttpClient/unexpected-code-response-error"?: unknown;
|
|
17
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-code-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-code-response-error", unknown>, unknown>;
|
|
17
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-code-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-code-response-error", unknown>, unknown>;
|
|
18
18
|
export declare class UnexpectedCodeResponseError extends UnexpectedCodeResponseError_base {
|
|
19
19
|
code: string | string[];
|
|
20
20
|
response: RequestErrorContent | ClientResponse;
|
|
@@ -22,7 +22,7 @@ export declare class UnexpectedCodeResponseError extends UnexpectedCodeResponseE
|
|
|
22
22
|
}
|
|
23
23
|
declare const UnexpectedResponseTypeError_base: new (params: {
|
|
24
24
|
"@DuplojsHttpClient/unexpected-response-type-error"?: unknown;
|
|
25
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-response-type-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-response-type-error", unknown>, unknown>;
|
|
25
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-response-type-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-response-type-error", unknown>, unknown>;
|
|
26
26
|
export declare class UnexpectedResponseTypeError extends UnexpectedResponseTypeError_base {
|
|
27
27
|
expectType: "informational" | "successful" | "redirection" | "clientError" | "serverError";
|
|
28
28
|
response: RequestErrorContent | ClientResponse;
|
|
@@ -30,7 +30,7 @@ export declare class UnexpectedResponseTypeError extends UnexpectedResponseTypeE
|
|
|
30
30
|
}
|
|
31
31
|
declare const UnexpectedResponseError_base: new (params: {
|
|
32
32
|
"@DuplojsHttpClient/unexpected-response-error"?: unknown;
|
|
33
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-response-error", unknown>, unknown>;
|
|
33
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpClient/unexpected-response-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"unexpected-response-error", unknown>, unknown>;
|
|
34
34
|
export declare class UnexpectedResponseError extends UnexpectedResponseError_base {
|
|
35
35
|
response: RequestErrorContent | ClientResponse;
|
|
36
36
|
constructor(response: RequestErrorContent | ClientResponse);
|
|
@@ -15,12 +15,12 @@ declare module "./builder" {
|
|
|
15
15
|
readonly preflightSteps: GenericDefinition["preflightSteps"];
|
|
16
16
|
readonly steps: readonly [];
|
|
17
17
|
readonly hooks: readonly [
|
|
18
|
-
...
|
|
19
|
-
...
|
|
18
|
+
...GenericHooks,
|
|
19
|
+
...GenericDefinition["hooks"]
|
|
20
20
|
];
|
|
21
21
|
readonly metadata: readonly [
|
|
22
|
-
...
|
|
23
|
-
...
|
|
22
|
+
...GenericMetadata,
|
|
23
|
+
...GenericDefinition["metadata"]
|
|
24
24
|
];
|
|
25
25
|
}, GenericFloor, (GenericRequest & NeverCoalescing<MakeRequestFromHooks<GenericHooks>, Request>)>;
|
|
26
26
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@duplojs/utils');
|
|
4
|
+
var clean = require('@duplojs/utils/clean');
|
|
5
|
+
|
|
6
|
+
clean.createConstraint.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
7
|
+
const dataParserWithCheckers = self
|
|
8
|
+
.primitiveHandler
|
|
9
|
+
.dataParser
|
|
10
|
+
.addChecker(...self.checkers);
|
|
11
|
+
const valueContainer = clean.constrainedTypeKind.setTo({}, { [self.name]: null });
|
|
12
|
+
const dataParser = utils.DPE.transform(dataParserWithCheckers, (input) => ({
|
|
13
|
+
...valueContainer,
|
|
14
|
+
[utils.keyWrappedValue]: input,
|
|
15
|
+
}));
|
|
16
|
+
return dataParser;
|
|
17
|
+
});
|
|
18
|
+
clean.createConstraint.overrideHandler.setMethod("toEndpointSchema", (self) => {
|
|
19
|
+
const dataParser = self
|
|
20
|
+
.primitiveHandler
|
|
21
|
+
.dataParser
|
|
22
|
+
.addChecker(...self.checkers);
|
|
23
|
+
return utils.DPE.lazy(() => dataParser);
|
|
24
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DP, DPE } from "@duplojs/utils";
|
|
2
|
+
import { type ConstrainedType, type EligiblePrimitive } from "@duplojs/utils/clean";
|
|
3
|
+
declare module "@duplojs/utils/clean" {
|
|
4
|
+
interface ConstraintHandler<GenericName extends string = string, GenericPrimitiveValue extends EligiblePrimitive = EligiblePrimitive, GenericCheckers extends readonly DP.DataParserChecker[] = readonly DP.DataParserChecker[]> {
|
|
5
|
+
toExtractParser(): DPE.ContractExtended<ConstrainedType<GenericName, GenericPrimitiveValue>, unknown>;
|
|
6
|
+
toEndpointSchema(): DPE.ContractExtended<GenericPrimitiveValue>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DPE, keyWrappedValue } from '@duplojs/utils';
|
|
2
|
+
import { createConstraint, constrainedTypeKind } from '@duplojs/utils/clean';
|
|
3
|
+
|
|
4
|
+
createConstraint.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
5
|
+
const dataParserWithCheckers = self
|
|
6
|
+
.primitiveHandler
|
|
7
|
+
.dataParser
|
|
8
|
+
.addChecker(...self.checkers);
|
|
9
|
+
const valueContainer = constrainedTypeKind.setTo({}, { [self.name]: null });
|
|
10
|
+
const dataParser = DPE.transform(dataParserWithCheckers, (input) => ({
|
|
11
|
+
...valueContainer,
|
|
12
|
+
[keyWrappedValue]: input,
|
|
13
|
+
}));
|
|
14
|
+
return dataParser;
|
|
15
|
+
});
|
|
16
|
+
createConstraint.overrideHandler.setMethod("toEndpointSchema", (self) => {
|
|
17
|
+
const dataParser = self
|
|
18
|
+
.primitiveHandler
|
|
19
|
+
.dataParser
|
|
20
|
+
.addChecker(...self.checkers);
|
|
21
|
+
return DPE.lazy(() => dataParser);
|
|
22
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@duplojs/utils');
|
|
4
|
+
var clean = require('@duplojs/utils/clean');
|
|
5
|
+
|
|
6
|
+
clean.createConstraintsSet.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
7
|
+
const checkers = utils.A.flatMap(self.constraints, ({ checkers }) => checkers);
|
|
8
|
+
const dataParserWithCheckers = self
|
|
9
|
+
.primitiveHandler
|
|
10
|
+
.dataParser
|
|
11
|
+
.addChecker(...checkers);
|
|
12
|
+
const constraintsKindValue = utils.pipe(self.constraints, utils.A.map(({ name }) => utils.O.entry(name, null)), utils.O.fromEntries);
|
|
13
|
+
const valueContainer = clean.constrainedTypeKind.setTo({}, constraintsKindValue);
|
|
14
|
+
const dataParser = utils.DPE.transform(dataParserWithCheckers, (input) => ({
|
|
15
|
+
...valueContainer,
|
|
16
|
+
[utils.keyWrappedValue]: input,
|
|
17
|
+
}));
|
|
18
|
+
return dataParser;
|
|
19
|
+
});
|
|
20
|
+
clean.createConstraintsSet.overrideHandler.setMethod("toEndpointSchema", (self) => {
|
|
21
|
+
const checkers = utils.A.flatMap(self.constraints, ({ checkers }) => checkers);
|
|
22
|
+
const dataParserWithCheckers = self
|
|
23
|
+
.primitiveHandler
|
|
24
|
+
.dataParser
|
|
25
|
+
.addChecker(...checkers);
|
|
26
|
+
return utils.DPE.lazy(() => dataParserWithCheckers);
|
|
27
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DPE, type UnionToIntersection } from "@duplojs/utils";
|
|
2
|
+
import { type EligiblePrimitive, type GetConstraint, type Primitive } from "@duplojs/utils/clean";
|
|
3
|
+
declare module "@duplojs/utils/clean" {
|
|
4
|
+
interface ConstraintsSetHandler<GenericPrimitiveValue extends EligiblePrimitive = EligiblePrimitive, GenericConstraintsHandler extends readonly ConstraintHandler[] = readonly []> {
|
|
5
|
+
toExtractParser(): DPE.ContractExtended<(Primitive<GenericPrimitiveValue> & UnionToIntersection<GenericConstraintsHandler[number] extends infer InferredConstraint ? InferredConstraint extends ConstraintHandler ? GetConstraint<InferredConstraint> : never : never>), unknown>;
|
|
6
|
+
toEndpointSchema(): DPE.ContractExtended<GenericPrimitiveValue>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { A, pipe, O, DPE, keyWrappedValue } from '@duplojs/utils';
|
|
2
|
+
import { createConstraintsSet, constrainedTypeKind } from '@duplojs/utils/clean';
|
|
3
|
+
|
|
4
|
+
createConstraintsSet.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
5
|
+
const checkers = A.flatMap(self.constraints, ({ checkers }) => checkers);
|
|
6
|
+
const dataParserWithCheckers = self
|
|
7
|
+
.primitiveHandler
|
|
8
|
+
.dataParser
|
|
9
|
+
.addChecker(...checkers);
|
|
10
|
+
const constraintsKindValue = pipe(self.constraints, A.map(({ name }) => O.entry(name, null)), O.fromEntries);
|
|
11
|
+
const valueContainer = constrainedTypeKind.setTo({}, constraintsKindValue);
|
|
12
|
+
const dataParser = DPE.transform(dataParserWithCheckers, (input) => ({
|
|
13
|
+
...valueContainer,
|
|
14
|
+
[keyWrappedValue]: input,
|
|
15
|
+
}));
|
|
16
|
+
return dataParser;
|
|
17
|
+
});
|
|
18
|
+
createConstraintsSet.overrideHandler.setMethod("toEndpointSchema", (self) => {
|
|
19
|
+
const checkers = A.flatMap(self.constraints, ({ checkers }) => checkers);
|
|
20
|
+
const dataParserWithCheckers = self
|
|
21
|
+
.primitiveHandler
|
|
22
|
+
.dataParser
|
|
23
|
+
.addChecker(...checkers);
|
|
24
|
+
return DPE.lazy(() => dataParserWithCheckers);
|
|
25
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@duplojs/utils');
|
|
4
|
+
var clean = require('@duplojs/utils/clean');
|
|
5
|
+
|
|
6
|
+
function propertiesDefinitionToSchema(definition, method) {
|
|
7
|
+
return utils.pipe(definition, utils.P.when(clean.newTypeHandlerKind.has, (value) => value[method]()), utils.P.when(utils.isType("array"), utils.innerPipe(utils.A.map((element) => element[method]()), (options) => {
|
|
8
|
+
utils.asserts(options, utils.A.minElements(1));
|
|
9
|
+
return utils.DP.union(options);
|
|
10
|
+
})), utils.P.otherwise((definition) => utils.pipe(definition.type, (subDefinition) => propertiesDefinitionToSchema(subDefinition, method), (dataParser) => {
|
|
11
|
+
if (definition.inArray) {
|
|
12
|
+
return utils.pipe(dataParser, utils.DP.array, (dataParser) => typeof definition.inArray === "object"
|
|
13
|
+
&& typeof definition.inArray.min === "number"
|
|
14
|
+
? dataParser.addChecker(utils.DP.checkerArrayMin(definition.inArray.min))
|
|
15
|
+
: dataParser, (dataParser) => typeof definition.inArray === "object"
|
|
16
|
+
&& typeof definition.inArray.max === "number"
|
|
17
|
+
? dataParser.addChecker(utils.DP.checkerArrayMax(definition.inArray.max))
|
|
18
|
+
: dataParser);
|
|
19
|
+
}
|
|
20
|
+
return dataParser;
|
|
21
|
+
}, (dataParser) => definition.nullable === true
|
|
22
|
+
? utils.DP.nullable(dataParser)
|
|
23
|
+
: dataParser)));
|
|
24
|
+
}
|
|
25
|
+
clean.createEntity.overrideHandler.setMethod("toExtractParser", (self, keys) => utils.pipe(self.propertiesDefinition, utils.O.entries, utils.A.filter(([key]) => keys === undefined || utils.A.includes(keys, key)), utils.A.map(([key, value]) => utils.O.entry(key, propertiesDefinitionToSchema(value, "toExtractParser"))), utils.O.fromEntries, utils.DPE.object));
|
|
26
|
+
clean.createEntity.overrideHandler.setMethod("toEndpointSchema", (self, keys, params) => utils.pipe(self.propertiesDefinition, utils.O.entries, utils.A.filter(([key]) => keys === undefined || utils.A.includes(keys, key)), utils.A.map(([key, value]) => utils.O.entry(key, propertiesDefinitionToSchema(value, "toEndpointSchema"))), utils.O.fromEntries, (shape) => typeof params?.addEntityName !== "undefined"
|
|
27
|
+
? {
|
|
28
|
+
...shape,
|
|
29
|
+
_entityName: typeof params.addEntityName === "string"
|
|
30
|
+
? utils.DP.literal(`${self.name}/${params.addEntityName}`)
|
|
31
|
+
: utils.DP.literal(self.name),
|
|
32
|
+
}
|
|
33
|
+
: shape, utils.DPE.object));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DP, DPE, type IsEqual, type SimplifyTopLevel, type IsExtends } from "@duplojs/utils";
|
|
2
|
+
import { type EntityRawProperties, type EntityProperties, type EntityPropertiesDefinition } from "@duplojs/utils/clean";
|
|
3
|
+
interface ToEndpointSchemaParams {
|
|
4
|
+
addEntityName?: boolean | string;
|
|
5
|
+
}
|
|
6
|
+
declare module "@duplojs/utils/clean" {
|
|
7
|
+
interface EntityHandler<GenericName extends string = string, GenericPropertiesDefinition extends EntityPropertiesDefinition = EntityPropertiesDefinition> {
|
|
8
|
+
toExtractParser<GenericEntityProperties extends EntityProperties<GenericPropertiesDefinition>, const GenericKey extends keyof GenericEntityProperties = keyof GenericEntityProperties>(keys?: GenericKey[]): ReturnType<typeof DPE.object<{
|
|
9
|
+
[Prop in GenericKey]: DP.Contract<GenericEntityProperties[Prop], unknown>;
|
|
10
|
+
}>>;
|
|
11
|
+
toEndpointSchema<GenericEntityRawProperties extends EntityRawProperties<GenericPropertiesDefinition>, const GenericKey extends keyof GenericEntityRawProperties = keyof GenericEntityRawProperties, const GenericParams extends ToEndpointSchemaParams = {}>(keys?: GenericKey[], params?: GenericParams | ToEndpointSchemaParams): ReturnType<typeof DPE.object<SimplifyTopLevel<{
|
|
12
|
+
[Prop in GenericKey]: DP.Contract<GenericEntityRawProperties[Prop], unknown>;
|
|
13
|
+
} & (IsEqual<GenericParams["addEntityName"], true> extends true ? {
|
|
14
|
+
[Prop in "_entityName"]: DP.Contract<GenericName, unknown>;
|
|
15
|
+
} : {}) & (IsExtends<GenericParams["addEntityName"], string> extends true ? {
|
|
16
|
+
[Prop in "_entityName"]: DP.Contract<`${GenericName}/${GenericParams["addEntityName"]}`, unknown>;
|
|
17
|
+
} : {})>>>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { pipe, P, isType, innerPipe, A, asserts, DP, O, DPE } from '@duplojs/utils';
|
|
2
|
+
import { newTypeHandlerKind, createEntity } from '@duplojs/utils/clean';
|
|
3
|
+
|
|
4
|
+
function propertiesDefinitionToSchema(definition, method) {
|
|
5
|
+
return pipe(definition, P.when(newTypeHandlerKind.has, (value) => value[method]()), P.when(isType("array"), innerPipe(A.map((element) => element[method]()), (options) => {
|
|
6
|
+
asserts(options, A.minElements(1));
|
|
7
|
+
return DP.union(options);
|
|
8
|
+
})), P.otherwise((definition) => pipe(definition.type, (subDefinition) => propertiesDefinitionToSchema(subDefinition, method), (dataParser) => {
|
|
9
|
+
if (definition.inArray) {
|
|
10
|
+
return pipe(dataParser, DP.array, (dataParser) => typeof definition.inArray === "object"
|
|
11
|
+
&& typeof definition.inArray.min === "number"
|
|
12
|
+
? dataParser.addChecker(DP.checkerArrayMin(definition.inArray.min))
|
|
13
|
+
: dataParser, (dataParser) => typeof definition.inArray === "object"
|
|
14
|
+
&& typeof definition.inArray.max === "number"
|
|
15
|
+
? dataParser.addChecker(DP.checkerArrayMax(definition.inArray.max))
|
|
16
|
+
: dataParser);
|
|
17
|
+
}
|
|
18
|
+
return dataParser;
|
|
19
|
+
}, (dataParser) => definition.nullable === true
|
|
20
|
+
? DP.nullable(dataParser)
|
|
21
|
+
: dataParser)));
|
|
22
|
+
}
|
|
23
|
+
createEntity.overrideHandler.setMethod("toExtractParser", (self, keys) => pipe(self.propertiesDefinition, O.entries, A.filter(([key]) => keys === undefined || A.includes(keys, key)), A.map(([key, value]) => O.entry(key, propertiesDefinitionToSchema(value, "toExtractParser"))), O.fromEntries, DPE.object));
|
|
24
|
+
createEntity.overrideHandler.setMethod("toEndpointSchema", (self, keys, params) => pipe(self.propertiesDefinition, O.entries, A.filter(([key]) => keys === undefined || A.includes(keys, key)), A.map(([key, value]) => O.entry(key, propertiesDefinitionToSchema(value, "toEndpointSchema"))), O.fromEntries, (shape) => typeof params?.addEntityName !== "undefined"
|
|
25
|
+
? {
|
|
26
|
+
...shape,
|
|
27
|
+
_entityName: typeof params.addEntityName === "string"
|
|
28
|
+
? DP.literal(`${self.name}/${params.addEntityName}`)
|
|
29
|
+
: DP.literal(self.name),
|
|
30
|
+
}
|
|
31
|
+
: shape, DPE.object));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@duplojs/utils');
|
|
4
|
+
var clean = require('@duplojs/utils/clean');
|
|
5
|
+
|
|
6
|
+
clean.createNewType.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
7
|
+
const constraintsKindValue = utils.pipe(self.constraints, utils.A.map(({ name }) => utils.O.entry(name, null)), utils.O.fromEntries);
|
|
8
|
+
const valueContainer = clean.newTypeKind.setTo(clean.constrainedTypeKind.setTo({}, constraintsKindValue), self.name);
|
|
9
|
+
const dataParser = utils.DPE.transform(self.dataParser, (input) => ({
|
|
10
|
+
...valueContainer,
|
|
11
|
+
[utils.keyWrappedValue]: input,
|
|
12
|
+
}));
|
|
13
|
+
return dataParser;
|
|
14
|
+
});
|
|
15
|
+
clean.createNewType.overrideHandler.setMethod("toEndpointSchema", (self) => utils.DPE.lazy(() => self.dataParser));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DPE } from "@duplojs/utils";
|
|
2
|
+
import { type NewType } from "@duplojs/utils/clean";
|
|
3
|
+
declare module "@duplojs/utils/clean" {
|
|
4
|
+
interface NewTypeHandler<GenericName extends string = string, GenericValue extends unknown = unknown, GenericConstraintsHandler extends readonly ConstraintHandler[] = readonly []> {
|
|
5
|
+
toExtractParser(): DPE.ContractExtended<NewType<GenericName, GenericValue, GenericConstraintsHandler[number]["name"]>, unknown>;
|
|
6
|
+
toEndpointSchema(): DPE.ContractExtended<GenericValue>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { pipe, A, O, DPE, keyWrappedValue } from '@duplojs/utils';
|
|
2
|
+
import { createNewType, newTypeKind, constrainedTypeKind } from '@duplojs/utils/clean';
|
|
3
|
+
|
|
4
|
+
createNewType.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
5
|
+
const constraintsKindValue = pipe(self.constraints, A.map(({ name }) => O.entry(name, null)), O.fromEntries);
|
|
6
|
+
const valueContainer = newTypeKind.setTo(constrainedTypeKind.setTo({}, constraintsKindValue), self.name);
|
|
7
|
+
const dataParser = DPE.transform(self.dataParser, (input) => ({
|
|
8
|
+
...valueContainer,
|
|
9
|
+
[keyWrappedValue]: input,
|
|
10
|
+
}));
|
|
11
|
+
return dataParser;
|
|
12
|
+
});
|
|
13
|
+
createNewType.overrideHandler.setMethod("toEndpointSchema", (self) => DPE.lazy(() => self.dataParser));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@duplojs/utils');
|
|
4
|
+
var clean = require('@duplojs/utils/clean');
|
|
5
|
+
|
|
6
|
+
clean.createPrimitive.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
7
|
+
const dataParser = utils.DPE.transform(self.dataParser, (input) => ({
|
|
8
|
+
[utils.keyWrappedValue]: input,
|
|
9
|
+
}));
|
|
10
|
+
return dataParser;
|
|
11
|
+
});
|
|
12
|
+
clean.createPrimitive.overrideHandler.setMethod("toEndpointSchema", (self) => utils.DPE.lazy(() => self.dataParser));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DPE } from "@duplojs/utils";
|
|
2
|
+
import { type EligiblePrimitive, type Primitive } from "@duplojs/utils/clean";
|
|
3
|
+
declare module "@duplojs/utils/clean" {
|
|
4
|
+
interface PrimitiveHandler<GenericValue extends EligiblePrimitive = EligiblePrimitive> {
|
|
5
|
+
toExtractParser(): DPE.ContractExtended<Primitive<GenericValue>, unknown>;
|
|
6
|
+
toEndpointSchema(): DPE.ContractExtended<GenericValue>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DPE, keyWrappedValue } from '@duplojs/utils';
|
|
2
|
+
import { createPrimitive } from '@duplojs/utils/clean';
|
|
3
|
+
|
|
4
|
+
createPrimitive.overrideHandler.setMethod("toExtractParser", (self) => {
|
|
5
|
+
const dataParser = DPE.transform(self.dataParser, (input) => ({
|
|
6
|
+
[keyWrappedValue]: input,
|
|
7
|
+
}));
|
|
8
|
+
return dataParser;
|
|
9
|
+
});
|
|
10
|
+
createPrimitive.overrideHandler.setMethod("toEndpointSchema", (self) => DPE.lazy(() => self.dataParser));
|
package/dist/core/index.cjs
CHANGED
|
@@ -18,6 +18,7 @@ var stringIdentifier = require('./stringIdentifier.cjs');
|
|
|
18
18
|
require('./metadata/index.cjs');
|
|
19
19
|
var implementHttpServer = require('./implementHttpServer.cjs');
|
|
20
20
|
var narrowingInput = require('./narrowingInput.cjs');
|
|
21
|
+
require('./clean/index.cjs');
|
|
21
22
|
var checker = require('./builders/checker.cjs');
|
|
22
23
|
var builder = require('./builders/route/builder.cjs');
|
|
23
24
|
var store = require('./builders/route/store.cjs');
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ export { createCoreLibStringIdentifier } from './stringIdentifier.mjs';
|
|
|
16
16
|
import './metadata/index.mjs';
|
|
17
17
|
export { implementHttpServer } from './implementHttpServer.mjs';
|
|
18
18
|
export { createNarrowingInput } from './narrowingInput.mjs';
|
|
19
|
+
import './clean/index.mjs';
|
|
19
20
|
export { checkerBuilder, useCheckerBuilder } from './builders/checker.mjs';
|
|
20
21
|
export { routeBuilderHandler, useRouteBuilder } from './builders/route/builder.mjs';
|
|
21
22
|
export { routeStore } from './builders/route/store.mjs';
|
|
@@ -283,7 +283,7 @@ export declare namespace ResponseContract {
|
|
|
283
283
|
}>>(information: GenericInformation, schema?: (GenericSchema & ForbiddenBigintDataParser<GenericSchema>) | undefined) => NoInfer<Contract<"511", GenericInformation, NeverCoalescing<GenericSchema, DP.DataParserEmpty<DP.DataParserDefinitionEmpty>>>>;
|
|
284
284
|
const Error_base: new (params: {
|
|
285
285
|
"@DuplojsHttpCore/contract-error"?: unknown;
|
|
286
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/contract-error", unknown>, unknown> & Kind<import("@duplojs/utils").KindDefinition<"contract-error", unknown>, unknown> & globalThis.Error;
|
|
286
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/contract-error", unknown>, unknown> & Kind<import("@duplojs/utils").KindDefinition<"contract-error", unknown>, unknown> & globalThis.Error;
|
|
287
287
|
export class Error extends Error_base {
|
|
288
288
|
information: string;
|
|
289
289
|
dataParserError?: DP.DataParserError | undefined;
|
|
@@ -2,7 +2,7 @@ import { type ResponseCode, Response } from "../response";
|
|
|
2
2
|
import { type HookRouteLifeCycle } from "../route/hooks";
|
|
3
3
|
declare const HookResponse_base: new (params: {
|
|
4
4
|
"@DuplojsHttpCore/hook-response"?: unknown;
|
|
5
|
-
}, parentParams: [code: any, information: any, body: any]) => Response<any, any, any> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/hook-response", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"hook-response", unknown>, unknown>;
|
|
5
|
+
}, parentParams: readonly [code: any, information: any, body: any]) => Response<any, any, any> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/hook-response", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"hook-response", unknown>, unknown>;
|
|
6
6
|
export declare class HookResponse<GenericCode extends ResponseCode = ResponseCode, GenericInformation extends string = string, GenericBody extends unknown = unknown> extends HookResponse_base {
|
|
7
7
|
code: GenericCode;
|
|
8
8
|
information: GenericInformation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ResponseCode, Response } from "../response";
|
|
2
2
|
declare const PredictedResponse_base: new (params: {
|
|
3
3
|
"@DuplojsHttpCore/predicted-response"?: unknown;
|
|
4
|
-
}, parentParams: [code: any, information: any, body: any]) => Response<any, any, any> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/predicted-response", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"predicted-response", unknown>, unknown>;
|
|
4
|
+
}, parentParams: readonly [code: any, information: any, body: any]) => Response<any, any, any> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/predicted-response", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"predicted-response", unknown>, unknown>;
|
|
5
5
|
export declare class PredictedResponse<GenericCode extends ResponseCode = ResponseCode, GenericInformation extends string = string, GenericBody extends unknown = unknown> extends PredictedResponse_base {
|
|
6
6
|
code: GenericCode;
|
|
7
7
|
information: GenericInformation;
|
|
@@ -2,7 +2,7 @@ import { type Route } from "../route";
|
|
|
2
2
|
import { type Steps } from "../steps";
|
|
3
3
|
declare const RouterBuildError_base: new (params: {
|
|
4
4
|
"@DuplojsHttpCore/router-build-error"?: unknown;
|
|
5
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/router-build-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"router-build-error", unknown>, unknown>;
|
|
5
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/router-build-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"router-build-error", unknown>, unknown>;
|
|
6
6
|
export declare class RouterBuildError extends RouterBuildError_base {
|
|
7
7
|
route: Route;
|
|
8
8
|
element: Route | Steps;
|
|
@@ -51,6 +51,9 @@ function createHttpServer(inputHub, params) {
|
|
|
51
51
|
response: serverResponse,
|
|
52
52
|
},
|
|
53
53
|
}, whenUncaughtError));
|
|
54
|
+
if (hub.config.environment === "BUILD") {
|
|
55
|
+
return server;
|
|
56
|
+
}
|
|
54
57
|
return new Promise((resolve) => {
|
|
55
58
|
server.listen({
|
|
56
59
|
port: httpServerParams.port,
|
|
@@ -49,6 +49,9 @@ function createHttpServer(inputHub, params) {
|
|
|
49
49
|
response: serverResponse,
|
|
50
50
|
},
|
|
51
51
|
}, whenUncaughtError));
|
|
52
|
+
if (hub.config.environment === "BUILD") {
|
|
53
|
+
return server;
|
|
54
|
+
}
|
|
52
55
|
return new Promise((resolve) => {
|
|
53
56
|
server.listen({
|
|
54
57
|
port: httpServerParams.port,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const BodyParseUnknownError_base: new (params: {
|
|
2
2
|
"@DuplojsHttpInterfacesNode/body-parse-unknown-error"?: unknown;
|
|
3
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-parse-unknown-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-parse-unknown-error", unknown>, unknown>;
|
|
3
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-parse-unknown-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-parse-unknown-error", unknown>, unknown>;
|
|
4
4
|
export declare class BodyParseUnknownError extends BodyParseUnknownError_base {
|
|
5
5
|
contentType: string;
|
|
6
6
|
unknownError: unknown;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const BodyParseWrongChunkReceived_base: new (params: {
|
|
2
2
|
"@DuplojsHttpInterfacesNode/body-parse-wrong-chunk-received"?: unknown;
|
|
3
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-parse-wrong-chunk-received", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-parse-wrong-chunk-received", unknown>, unknown>;
|
|
3
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-parse-wrong-chunk-received", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-parse-wrong-chunk-received", unknown>, unknown>;
|
|
4
4
|
export declare class BodyParseWrongChunkReceived extends BodyParseWrongChunkReceived_base {
|
|
5
5
|
wrongChunk: unknown;
|
|
6
6
|
constructor(wrongChunk: unknown);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BytesInString } from "@duplojs/utils";
|
|
2
2
|
declare const BodySizeExceedsLimitError_base: new (params: {
|
|
3
3
|
"@DuplojsHttpInterfacesNode/body-size-exceeds-limit-error"?: unknown;
|
|
4
|
-
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-size-exceeds-limit-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-size-exceeds-limit-error", unknown>, unknown>;
|
|
4
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpInterfacesNode/body-size-exceeds-limit-error", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"body-size-exceeds-limit-error", unknown>, unknown>;
|
|
5
5
|
export declare class BodySizeExceedsLimitError extends BodySizeExceedsLimitError_base {
|
|
6
6
|
bytesInString: BytesInString | number;
|
|
7
7
|
constructor(bytesInString: BytesInString | number);
|
|
@@ -4,12 +4,20 @@ require('../../core/builders/index.cjs');
|
|
|
4
4
|
require('../../core/metadata/index.cjs');
|
|
5
5
|
require('../../core/response/index.cjs');
|
|
6
6
|
var utils = require('@duplojs/utils');
|
|
7
|
+
var metadata$1 = require('../codeGenerator/metadata.cjs');
|
|
8
|
+
var metadata = require('./metadata.cjs');
|
|
7
9
|
var builder = require('../../core/builders/route/builder.cjs');
|
|
8
10
|
var ignoreByRouteStore = require('../../core/metadata/ignoreByRouteStore.cjs');
|
|
9
11
|
var contract = require('../../core/response/contract.cjs');
|
|
10
12
|
|
|
11
13
|
function makeOpenApiRoute(routePath, openApiPage) {
|
|
12
|
-
return builder.useRouteBuilder("GET", routePath, {
|
|
14
|
+
return builder.useRouteBuilder("GET", routePath, {
|
|
15
|
+
metadata: [
|
|
16
|
+
ignoreByRouteStore.IgnoreByRouteStoreMetadata(),
|
|
17
|
+
metadata.IgnoreByOpenApiGeneratorMetadata(),
|
|
18
|
+
metadata$1.IgnoreByCodeGeneratorMetadata(),
|
|
19
|
+
],
|
|
20
|
+
})
|
|
13
21
|
.handler(contract.ResponseContract.ok("swaggerUi", utils.DP.string()), (__, { response }) => response("swaggerUi", openApiPage)
|
|
14
22
|
.setHeader("content-type", "text/html"));
|
|
15
23
|
}
|
|
@@ -3,7 +3,7 @@ import type { RoutePath } from "../../core/route";
|
|
|
3
3
|
import { DP } from "@duplojs/utils";
|
|
4
4
|
export declare function makeOpenApiRoute(routePath: RoutePath, openApiPage: string): import("../../core/route").Route<{
|
|
5
5
|
readonly method: "GET";
|
|
6
|
-
readonly metadata: readonly [import("../../core/metadata").Metadata<"ignore-by-route-store", unknown>];
|
|
6
|
+
readonly metadata: readonly [import("../../core/metadata").Metadata<"ignore-by-route-store", unknown>, import("../../core/metadata").Metadata<"ignore-by-open-api-generator", unknown>, import("../../core/metadata").Metadata<"ignore-by-code-generator", unknown>];
|
|
7
7
|
readonly hooks: readonly [];
|
|
8
8
|
readonly preflightSteps: readonly [];
|
|
9
9
|
readonly paths: readonly [`/${string}`];
|
|
@@ -2,12 +2,20 @@ import '../../core/builders/index.mjs';
|
|
|
2
2
|
import '../../core/metadata/index.mjs';
|
|
3
3
|
import '../../core/response/index.mjs';
|
|
4
4
|
import { DP } from '@duplojs/utils';
|
|
5
|
+
import { IgnoreByCodeGeneratorMetadata } from '../codeGenerator/metadata.mjs';
|
|
6
|
+
import { IgnoreByOpenApiGeneratorMetadata } from './metadata.mjs';
|
|
5
7
|
import { useRouteBuilder } from '../../core/builders/route/builder.mjs';
|
|
6
8
|
import { IgnoreByRouteStoreMetadata } from '../../core/metadata/ignoreByRouteStore.mjs';
|
|
7
9
|
import { ResponseContract } from '../../core/response/contract.mjs';
|
|
8
10
|
|
|
9
11
|
function makeOpenApiRoute(routePath, openApiPage) {
|
|
10
|
-
return useRouteBuilder("GET", routePath, {
|
|
12
|
+
return useRouteBuilder("GET", routePath, {
|
|
13
|
+
metadata: [
|
|
14
|
+
IgnoreByRouteStoreMetadata(),
|
|
15
|
+
IgnoreByOpenApiGeneratorMetadata(),
|
|
16
|
+
IgnoreByCodeGeneratorMetadata(),
|
|
17
|
+
],
|
|
18
|
+
})
|
|
11
19
|
.handler(ResponseContract.ok("swaggerUi", DP.string()), (__, { response }) => response("swaggerUi", openApiPage)
|
|
12
20
|
.setHeader("content-type", "text/html"));
|
|
13
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duplojs/http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"author": "mathcovax",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,16 +10,19 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "rollup --config",
|
|
13
|
+
"docs:dev": "npm -w docs run docs:dev",
|
|
14
|
+
"docs:build": "npm -w docs run docs:build",
|
|
15
|
+
"docs:preview": "npm -w docs run docs:preview",
|
|
13
16
|
"test:tu": "vitest --coverage",
|
|
14
17
|
"test:tu:bench": "vitest bench",
|
|
15
18
|
"test:tu:watch": "vitest --coverage --watch",
|
|
16
19
|
"test:tu:update": "vitest --coverage --update",
|
|
17
|
-
"test:types": "tsc -p tests/core/tsconfig.json && tsc -p tests/client/tsconfig.json && tsc -p tests/interfaces/node/tsconfig.json && tsc -p tests/interfaces/bun/tsconfig.json && tsc -p tests/interfaces/deno/tsconfig.json && tsc -p tests/plugins/codeGenerator/tsconfig.json && tsc -p tests/plugins/openApiGenerator/tsconfig.json && npm -w integration run test:types",
|
|
18
|
-
"test:lint": "eslint",
|
|
19
|
-
"test:lint:fix": "eslint --fix",
|
|
20
|
+
"test:types": "tsc -p tests/core/tsconfig.json && tsc -p tests/client/tsconfig.json && tsc -p tests/interfaces/node/tsconfig.json && tsc -p tests/interfaces/bun/tsconfig.json && tsc -p tests/interfaces/deno/tsconfig.json && tsc -p tests/plugins/codeGenerator/tsconfig.json && tsc -p tests/plugins/openApiGenerator/tsconfig.json && npm -w integration run test:types && npm -w docs run test:types",
|
|
21
|
+
"test:lint": "eslint --quiet",
|
|
22
|
+
"test:lint:fix": "eslint --fix --quiet",
|
|
20
23
|
"prepare": "husky"
|
|
21
24
|
},
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
25
|
+
"types": "./dist/core/index.d.ts",
|
|
23
26
|
"exports": {
|
|
24
27
|
".": {
|
|
25
28
|
"import": "./dist/core/index.mjs",
|
|
@@ -63,7 +66,7 @@
|
|
|
63
66
|
],
|
|
64
67
|
"peerDependencies": {
|
|
65
68
|
"@duplojs/data-parser-tools": ">=0.2.4 <1.0.0",
|
|
66
|
-
"@duplojs/utils": ">=1.4.
|
|
69
|
+
"@duplojs/utils": ">=1.4.57 <2.0.0"
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
72
|
"@commitlint/cli": "19.8.1",
|
|
@@ -89,7 +92,8 @@
|
|
|
89
92
|
"vitest": "3.2.4"
|
|
90
93
|
},
|
|
91
94
|
"workspaces": [
|
|
92
|
-
"integration"
|
|
95
|
+
"integration",
|
|
96
|
+
"docs"
|
|
93
97
|
],
|
|
94
98
|
"keywords": [],
|
|
95
99
|
"engines": {
|