@duplojs/http 0.6.2 → 0.7.1
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/getBody.cjs +1 -1
- package/dist/client/getBody.mjs +1 -1
- package/dist/client/hooks.d.ts +1 -25
- package/dist/client/httpClient.d.ts +29 -25
- package/dist/client/promiseRequest.cjs +3 -0
- package/dist/client/promiseRequest.d.ts +31 -39
- package/dist/client/promiseRequest.mjs +4 -1
- package/dist/client/queryToString.cjs +2 -2
- package/dist/client/queryToString.mjs +2 -2
- package/dist/client/types/clientRequestParams.d.ts +9 -3
- package/dist/client/types/clientResponse.d.ts +6 -6
- package/dist/client/types/hooks.d.ts +25 -0
- package/dist/client/types/index.cjs +2 -0
- package/dist/client/types/index.d.ts +2 -0
- package/dist/client/types/index.mjs +2 -0
- package/dist/client/types/promiseRequestParams.cjs +2 -0
- package/dist/client/types/promiseRequestParams.d.ts +9 -0
- package/dist/client/types/promiseRequestParams.mjs +1 -0
- package/dist/client/types/serverRoute.d.ts +28 -4
- package/dist/client/unexpectedResponseError.d.ts +1 -2
- package/dist/core/builders/preflight/route.cjs +1 -0
- package/dist/core/builders/preflight/route.d.ts +4 -2
- package/dist/core/builders/preflight/route.mjs +1 -0
- package/dist/core/builders/route/builder.cjs +1 -0
- package/dist/core/builders/route/builder.d.ts +4 -2
- package/dist/core/builders/route/builder.mjs +1 -0
- package/dist/core/clean/newType.d.ts +1 -1
- package/dist/core/clean/primitive.d.ts +1 -1
- package/dist/core/defaultHooks/index.cjs +50 -0
- package/dist/core/defaultHooks/index.d.ts +5 -0
- package/dist/core/defaultHooks/index.mjs +48 -0
- package/dist/{interfaces/node/error → core/errors}/bodyParseWrongChunkReceived.cjs +6 -4
- package/dist/core/errors/bodyParseWrongChunkReceived.d.ts +9 -0
- package/dist/core/errors/bodyParseWrongChunkReceived.mjs +14 -0
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.cjs +2 -2
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.d.ts +2 -2
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.mjs +2 -2
- package/dist/{interfaces/node/error → core/errors}/index.cjs +6 -4
- package/dist/{interfaces/node/error → core/errors}/index.d.ts +3 -2
- package/dist/{interfaces/node/error → core/errors}/index.mjs +3 -2
- package/dist/core/errors/parseJsonError.cjs +16 -0
- package/dist/core/errors/parseJsonError.d.ts +9 -0
- package/dist/core/errors/parseJsonError.mjs +14 -0
- package/dist/core/errors/wrongContentTypeError.cjs +16 -0
- package/dist/core/errors/wrongContentTypeError.d.ts +9 -0
- package/dist/core/errors/wrongContentTypeError.mjs +14 -0
- package/dist/core/functionsBuilders/route/create.d.ts +2 -2
- package/dist/core/functionsBuilders/route/default.cjs +0 -11
- package/dist/core/functionsBuilders/route/default.mjs +0 -11
- package/dist/core/functionsBuilders/route/hook.d.ts +2 -2
- package/dist/core/functionsBuilders/steps/create.d.ts +2 -2
- package/dist/core/functionsBuilders/steps/defaults/cutStep.cjs +15 -18
- package/dist/core/functionsBuilders/steps/defaults/cutStep.mjs +15 -18
- package/dist/core/functionsBuilders/steps/defaults/extractStep.cjs +43 -19
- package/dist/core/functionsBuilders/steps/defaults/extractStep.d.ts +2 -1
- package/dist/core/functionsBuilders/steps/defaults/extractStep.mjs +44 -20
- package/dist/core/functionsBuilders/steps/defaults/handlerStep.cjs +14 -8
- package/dist/core/functionsBuilders/steps/defaults/handlerStep.mjs +14 -8
- package/dist/core/hub/defaultBodyController.cjs +8 -0
- package/dist/core/hub/defaultBodyController.d.ts +1 -0
- package/dist/core/hub/defaultBodyController.mjs +6 -0
- package/dist/core/hub/hooks.cjs +3 -1
- package/dist/core/hub/hooks.d.ts +2 -3
- package/dist/core/hub/hooks.mjs +3 -1
- package/dist/core/hub/index.cjs +101 -127
- package/dist/core/hub/index.d.ts +33 -34
- package/dist/core/hub/index.mjs +100 -128
- package/dist/core/implementHttpServer.cjs +5 -5
- package/dist/core/implementHttpServer.d.ts +2 -1
- package/dist/core/implementHttpServer.mjs +5 -5
- package/dist/core/index.cjs +34 -10
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.mjs +13 -2
- package/dist/core/request/bodyController/base.cjs +36 -0
- package/dist/core/request/bodyController/base.d.ts +28 -0
- package/dist/core/request/bodyController/base.mjs +34 -0
- package/dist/core/request/bodyController/formData.cjs +28 -0
- package/dist/core/request/bodyController/formData.d.ts +22 -0
- package/dist/core/request/bodyController/formData.mjs +25 -0
- package/dist/core/request/bodyController/index.cjs +13 -0
- package/dist/core/request/bodyController/index.d.ts +3 -0
- package/dist/core/request/bodyController/index.mjs +3 -0
- package/dist/core/request/bodyController/text.cjs +14 -0
- package/dist/core/request/bodyController/text.d.ts +10 -0
- package/dist/core/request/bodyController/text.mjs +11 -0
- package/dist/core/{request.cjs → request/index.cjs} +21 -3
- package/dist/core/{request.d.ts → request/index.d.ts} +10 -3
- package/dist/core/request/index.mjs +50 -0
- package/dist/core/response/contract.d.ts +1 -1
- package/dist/core/route/hooks.d.ts +0 -2
- package/dist/core/route/index.d.ts +2 -1
- package/dist/core/router/index.cjs +27 -8
- package/dist/core/router/index.d.ts +2 -1
- package/dist/core/router/index.mjs +28 -10
- package/dist/core/router/notFoundBodyReaderImplementationError.cjs +16 -0
- package/dist/core/router/notFoundBodyReaderImplementationError.d.ts +11 -0
- package/dist/core/router/notFoundBodyReaderImplementationError.mjs +14 -0
- package/dist/core/router/types/buildedRouter.d.ts +3 -3
- package/dist/core/steps/extract.d.ts +3 -1
- package/dist/core/steps/types/steps.d.ts +1 -3
- package/dist/core/types/hosts.cjs +2 -0
- package/dist/core/types/hosts.d.ts +4 -0
- package/dist/core/types/hosts.mjs +1 -0
- package/dist/core/types/httpServerParams.cjs +2 -0
- package/dist/core/types/httpServerParams.d.ts +11 -0
- package/dist/core/types/httpServerParams.mjs +1 -0
- package/dist/core/types/index.cjs +2 -0
- package/dist/core/types/index.d.ts +2 -0
- package/dist/core/types/index.mjs +2 -0
- package/dist/interfaces/bun/types/request.cjs +1 -1
- package/dist/interfaces/bun/types/request.mjs +1 -1
- package/dist/interfaces/node/bodyReaders/formData/error.cjs +14 -0
- package/dist/interfaces/node/bodyReaders/formData/error.d.ts +8 -0
- package/dist/interfaces/node/bodyReaders/formData/error.mjs +12 -0
- package/dist/interfaces/node/bodyReaders/formData/index.cjs +94 -0
- package/dist/interfaces/node/bodyReaders/formData/index.d.ts +4 -0
- package/dist/interfaces/node/bodyReaders/formData/index.mjs +90 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.cjs +175 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.d.ts +21 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.mjs +173 -0
- package/dist/interfaces/node/bodyReaders/index.cjs +9 -0
- package/dist/interfaces/node/bodyReaders/index.d.ts +2 -0
- package/dist/interfaces/node/bodyReaders/index.mjs +2 -0
- package/dist/interfaces/node/bodyReaders/text/index.cjs +41 -0
- package/dist/interfaces/node/bodyReaders/text/index.d.ts +3 -0
- package/dist/interfaces/node/bodyReaders/text/index.mjs +38 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.cjs +37 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.d.ts +6 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.mjs +35 -0
- package/dist/interfaces/node/createHttpServer.cjs +13 -5
- package/dist/interfaces/node/createHttpServer.d.ts +13 -12
- package/dist/interfaces/node/createHttpServer.mjs +13 -5
- package/dist/interfaces/node/hooks/index.cjs +47 -0
- package/dist/interfaces/node/hooks/index.d.ts +5 -0
- package/dist/interfaces/node/hooks/index.mjs +45 -0
- package/dist/interfaces/node/index.cjs +13 -9
- package/dist/interfaces/node/index.d.ts +1 -1
- package/dist/interfaces/node/index.mjs +7 -5
- package/dist/interfaces/node/types/index.cjs +0 -1
- package/dist/interfaces/node/types/index.d.ts +0 -1
- package/dist/interfaces/node/types/index.mjs +0 -1
- package/dist/interfaces/node/types/request.cjs +1 -1
- package/dist/interfaces/node/types/request.mjs +1 -1
- package/dist/plugins/codeGenerator/index.cjs +2 -0
- package/dist/plugins/codeGenerator/index.mjs +1 -1
- package/dist/plugins/codeGenerator/plugin.cjs +11 -4
- package/dist/plugins/codeGenerator/plugin.mjs +12 -5
- package/dist/plugins/codeGenerator/routeToDataParser.cjs +24 -1
- package/dist/plugins/codeGenerator/routeToDataParser.d.ts +34 -0
- package/dist/plugins/codeGenerator/routeToDataParser.mjs +24 -3
- package/dist/plugins/codeGenerator/typescriptTransfomer.cjs +28 -0
- package/dist/plugins/codeGenerator/typescriptTransfomer.d.ts +4 -0
- package/dist/plugins/codeGenerator/typescriptTransfomer.mjs +24 -0
- package/dist/plugins/openApiGenerator/makeOpenApiRoute.d.ts +3 -0
- package/dist/plugins/openApiGenerator/plugin.cjs +3 -3
- package/dist/plugins/openApiGenerator/plugin.mjs +4 -4
- package/dist/plugins/openApiGenerator/routeToOpenApi.cjs +16 -6
- package/dist/plugins/openApiGenerator/routeToOpenApi.d.ts +10 -1
- package/dist/plugins/openApiGenerator/routeToOpenApi.mjs +16 -6
- package/dist/plugins/openApiGenerator/types/entrypoint.d.ts +6 -1
- package/dist/plugins/openApiGenerator/types/openApiMethod.d.ts +1 -1
- package/package.json +5 -6
- package/dist/core/request.mjs +0 -32
- package/dist/interfaces/node/error/bodyParseUnknownError.cjs +0 -16
- package/dist/interfaces/node/error/bodyParseUnknownError.d.ts +0 -9
- package/dist/interfaces/node/error/bodyParseUnknownError.mjs +0 -14
- package/dist/interfaces/node/error/bodyParseWrongChunkReceived.d.ts +0 -8
- package/dist/interfaces/node/error/bodyParseWrongChunkReceived.mjs +0 -12
- package/dist/interfaces/node/hooks.cjs +0 -126
- package/dist/interfaces/node/hooks.d.ts +0 -8
- package/dist/interfaces/node/hooks.mjs +0 -124
- package/dist/interfaces/node/types/host.d.ts +0 -4
- /package/dist/{interfaces/node/types/host.cjs → client/types/hooks.cjs} +0 -0
- /package/dist/{interfaces/node/types/host.mjs → client/types/hooks.mjs} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../../../../core/errors/index.cjs');
|
|
4
|
+
var utils = require('@duplojs/utils');
|
|
5
|
+
var bodyParseWrongChunkReceived = require('../../../../core/errors/bodyParseWrongChunkReceived.cjs');
|
|
6
|
+
var bodySizeExceedsLimitError = require('../../../../core/errors/bodySizeExceedsLimitError.cjs');
|
|
7
|
+
|
|
8
|
+
async function readRequestText(request, params, onEnd) {
|
|
9
|
+
let result = "";
|
|
10
|
+
let size = 0;
|
|
11
|
+
try {
|
|
12
|
+
for await (const chunk of request) {
|
|
13
|
+
if (!(chunk instanceof Buffer) && typeof chunk !== "string") {
|
|
14
|
+
return utils.E.error(new bodyParseWrongChunkReceived.BodyParseWrongChunkReceived("Buffer or String.", chunk));
|
|
15
|
+
}
|
|
16
|
+
size += chunk instanceof Buffer
|
|
17
|
+
? chunk.byteLength
|
|
18
|
+
: Buffer.byteLength(chunk);
|
|
19
|
+
if (size > params.maxBodySize) {
|
|
20
|
+
return utils.E.error(new bodySizeExceedsLimitError.BodySizeExceedsLimitError(params.maxBodySize));
|
|
21
|
+
}
|
|
22
|
+
result += chunk.toString();
|
|
23
|
+
}
|
|
24
|
+
if (onEnd) {
|
|
25
|
+
return await onEnd(result);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return utils.E.left("server-error", error);
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
request.destroy();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.readRequestText = readRequestText;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { E } from "@duplojs/utils";
|
|
2
|
+
import type http from "http";
|
|
3
|
+
export interface ReadRequestTextParams {
|
|
4
|
+
maxBodySize: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function readRequestText<GenericOutputValue extends unknown = string>(request: http.IncomingMessage, params: ReadRequestTextParams, onEnd?: (result: string) => GenericOutputValue): Promise<E.Left<"server-error", unknown> | E.Error<Error> | GenericOutputValue>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import '../../../../core/errors/index.mjs';
|
|
2
|
+
import { E } from '@duplojs/utils';
|
|
3
|
+
import { BodyParseWrongChunkReceived } from '../../../../core/errors/bodyParseWrongChunkReceived.mjs';
|
|
4
|
+
import { BodySizeExceedsLimitError } from '../../../../core/errors/bodySizeExceedsLimitError.mjs';
|
|
5
|
+
|
|
6
|
+
async function readRequestText(request, params, onEnd) {
|
|
7
|
+
let result = "";
|
|
8
|
+
let size = 0;
|
|
9
|
+
try {
|
|
10
|
+
for await (const chunk of request) {
|
|
11
|
+
if (!(chunk instanceof Buffer) && typeof chunk !== "string") {
|
|
12
|
+
return E.error(new BodyParseWrongChunkReceived("Buffer or String.", chunk));
|
|
13
|
+
}
|
|
14
|
+
size += chunk instanceof Buffer
|
|
15
|
+
? chunk.byteLength
|
|
16
|
+
: Buffer.byteLength(chunk);
|
|
17
|
+
if (size > params.maxBodySize) {
|
|
18
|
+
return E.error(new BodySizeExceedsLimitError(params.maxBodySize));
|
|
19
|
+
}
|
|
20
|
+
result += chunk.toString();
|
|
21
|
+
}
|
|
22
|
+
if (onEnd) {
|
|
23
|
+
return await onEnd(result);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return E.left("server-error", error);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
request.destroy();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { readRequestText };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var utils = require('@duplojs/utils');
|
|
4
3
|
var http = require('http');
|
|
5
4
|
var https = require('https');
|
|
6
|
-
var
|
|
5
|
+
var index$3 = require('./hooks/index.cjs');
|
|
7
6
|
var implementHttpServer = require('../../core/implementHttpServer.cjs');
|
|
7
|
+
var utils = require('@duplojs/utils');
|
|
8
|
+
var index$2 = require('../../core/defaultHooks/index.cjs');
|
|
9
|
+
require('./bodyReaders/index.cjs');
|
|
10
|
+
var index = require('./bodyReaders/text/index.cjs');
|
|
11
|
+
var index$1 = require('./bodyReaders/formData/index.cjs');
|
|
8
12
|
|
|
9
|
-
function createHttpServer(
|
|
13
|
+
function createHttpServer(hub, params) {
|
|
10
14
|
const httpServerParams = utils.O.override({
|
|
11
15
|
host: "localhost",
|
|
12
16
|
port: 80,
|
|
@@ -15,9 +19,13 @@ function createHttpServer(inputHub, params) {
|
|
|
15
19
|
predictedHeaderKey: "predicted",
|
|
16
20
|
fromHookHeaderKey: "from-hook",
|
|
17
21
|
interface: "node",
|
|
22
|
+
uploadFolder: "./upload",
|
|
18
23
|
}, params);
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
hub.addBodyReaderImplementation([
|
|
25
|
+
index.createTextBodyReaderImplementation(httpServerParams),
|
|
26
|
+
index$1.createFormDataBodyReaderImplementation(httpServerParams),
|
|
27
|
+
]);
|
|
28
|
+
hub.addRouteHooks([index$2.initDefaultHook(hub, httpServerParams), index$3.nodeHook]);
|
|
21
29
|
function whenUncaughtError(error, routerInitializationData) {
|
|
22
30
|
const serverResponse = routerInitializationData.raw.response;
|
|
23
31
|
if (!serverResponse.headersSent && !serverResponse.writableEnded) {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type Hosts } from "./types/host";
|
|
3
|
-
import { type BytesInString, O } from "@duplojs/utils";
|
|
1
|
+
import { type Hub } from "../../core/hub";
|
|
4
2
|
import http from "http";
|
|
5
3
|
import https from "https";
|
|
6
|
-
|
|
4
|
+
import { O } from "@duplojs/utils";
|
|
5
|
+
import { type HttpServerParams } from "../../core/types";
|
|
6
|
+
declare module "../../core/types" {
|
|
7
7
|
interface HttpServerParams {
|
|
8
8
|
readonly interface: "node";
|
|
9
|
-
readonly host: Hosts;
|
|
10
|
-
readonly port: number;
|
|
11
|
-
readonly maxBodySize: BytesInString | number;
|
|
12
|
-
readonly informationHeaderKey: string;
|
|
13
|
-
readonly predictedHeaderKey: string;
|
|
14
|
-
readonly fromHookHeaderKey: string;
|
|
15
9
|
readonly http?: http.ServerOptions;
|
|
16
10
|
readonly https?: https.ServerOptions;
|
|
17
11
|
}
|
|
12
|
+
interface HostCustom {
|
|
13
|
+
"::": true;
|
|
14
|
+
"0.0.0.0": true;
|
|
15
|
+
localhost: true;
|
|
16
|
+
"127.0.0.1": true;
|
|
17
|
+
"::1": true;
|
|
18
|
+
}
|
|
18
19
|
}
|
|
19
|
-
export type CreateHttpServerParams = O.PartialKeys<Omit<HttpServerParams, "interface">, "maxBodySize" | "informationHeaderKey" | "predictedHeaderKey" | "fromHookHeaderKey">;
|
|
20
|
-
export declare function createHttpServer(
|
|
20
|
+
export type CreateHttpServerParams = O.PartialKeys<Omit<HttpServerParams, "interface">, "maxBodySize" | "informationHeaderKey" | "predictedHeaderKey" | "fromHookHeaderKey" | "uploadFolder">;
|
|
21
|
+
export declare function createHttpServer(hub: Hub, params: CreateHttpServerParams): Promise<https.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { O } from '@duplojs/utils';
|
|
2
1
|
import http from 'http';
|
|
3
2
|
import https from 'https';
|
|
4
|
-
import {
|
|
3
|
+
import { nodeHook } from './hooks/index.mjs';
|
|
5
4
|
import { implementHttpServer } from '../../core/implementHttpServer.mjs';
|
|
5
|
+
import { O } from '@duplojs/utils';
|
|
6
|
+
import { initDefaultHook } from '../../core/defaultHooks/index.mjs';
|
|
7
|
+
import './bodyReaders/index.mjs';
|
|
8
|
+
import { createTextBodyReaderImplementation } from './bodyReaders/text/index.mjs';
|
|
9
|
+
import { createFormDataBodyReaderImplementation } from './bodyReaders/formData/index.mjs';
|
|
6
10
|
|
|
7
|
-
function createHttpServer(
|
|
11
|
+
function createHttpServer(hub, params) {
|
|
8
12
|
const httpServerParams = O.override({
|
|
9
13
|
host: "localhost",
|
|
10
14
|
port: 80,
|
|
@@ -13,9 +17,13 @@ function createHttpServer(inputHub, params) {
|
|
|
13
17
|
predictedHeaderKey: "predicted",
|
|
14
18
|
fromHookHeaderKey: "from-hook",
|
|
15
19
|
interface: "node",
|
|
20
|
+
uploadFolder: "./upload",
|
|
16
21
|
}, params);
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
hub.addBodyReaderImplementation([
|
|
23
|
+
createTextBodyReaderImplementation(httpServerParams),
|
|
24
|
+
createFormDataBodyReaderImplementation(httpServerParams),
|
|
25
|
+
]);
|
|
26
|
+
hub.addRouteHooks([initDefaultHook(hub, httpServerParams), nodeHook]);
|
|
19
27
|
function whenUncaughtError(error, routerInitializationData) {
|
|
20
28
|
const serverResponse = routerInitializationData.raw.response;
|
|
21
29
|
if (!serverResponse.headersSent && !serverResponse.writableEnded) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../../../core/route/index.cjs');
|
|
4
|
+
var serverUtils = require('@duplojs/server-utils');
|
|
5
|
+
var utils = require('@duplojs/utils');
|
|
6
|
+
var node_fs = require('node:fs');
|
|
7
|
+
var hooks = require('../../../core/route/hooks.cjs');
|
|
8
|
+
|
|
9
|
+
const nodeHook = hooks.createHookRouteLifeCycle({
|
|
10
|
+
beforeSendResponse({ request, currentResponse, exit }) {
|
|
11
|
+
request.raw.response.writeHead(Number(currentResponse.code), currentResponse.headers);
|
|
12
|
+
return exit();
|
|
13
|
+
},
|
|
14
|
+
async sendResponse({ request, currentResponse, exit }) {
|
|
15
|
+
const { response: rawResponse } = request.raw;
|
|
16
|
+
const body = currentResponse.body;
|
|
17
|
+
if (body instanceof Error) {
|
|
18
|
+
rawResponse.write(body.toString());
|
|
19
|
+
}
|
|
20
|
+
else if (serverUtils.SF.isFileInterface(body)) {
|
|
21
|
+
await new Promise((resolve, reject) => {
|
|
22
|
+
node_fs.createReadStream(body.path)
|
|
23
|
+
.pipe(request.raw.response
|
|
24
|
+
.once("error", reject)
|
|
25
|
+
.once("close", resolve));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else if (typeof body === "object"
|
|
29
|
+
|| typeof body === "number"
|
|
30
|
+
|| typeof body === "boolean") {
|
|
31
|
+
rawResponse.write(JSON.stringify(body));
|
|
32
|
+
}
|
|
33
|
+
else if (typeof body === "string") {
|
|
34
|
+
rawResponse.write(body);
|
|
35
|
+
}
|
|
36
|
+
rawResponse.end();
|
|
37
|
+
return exit();
|
|
38
|
+
},
|
|
39
|
+
async afterSendResponse({ request, next }) {
|
|
40
|
+
if (request.filesAttache) {
|
|
41
|
+
await Promise.all(utils.A.map(request.filesAttache, (path) => serverUtils.SF.remove(path)));
|
|
42
|
+
}
|
|
43
|
+
return next();
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
exports.nodeHook = nodeHook;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const nodeHook: {
|
|
2
|
+
beforeSendResponse({ request, currentResponse, exit }: import("../../../core/route").RouteHookParamsAfter<import("../../../core/request").Request>): import("../../../core/route").RouteHookExit;
|
|
3
|
+
sendResponse({ request, currentResponse, exit }: import("../../../core/route").RouteHookParamsAfter<import("../../../core/request").Request>): Promise<import("../../../core/route").RouteHookExit>;
|
|
4
|
+
afterSendResponse({ request, next }: import("../../../core/route").RouteHookParamsAfter<import("../../../core/request").Request>): Promise<import("../../../core/route").RouteHookNext>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import '../../../core/route/index.mjs';
|
|
2
|
+
import { SF } from '@duplojs/server-utils';
|
|
3
|
+
import { A } from '@duplojs/utils';
|
|
4
|
+
import { createReadStream } from 'node:fs';
|
|
5
|
+
import { createHookRouteLifeCycle } from '../../../core/route/hooks.mjs';
|
|
6
|
+
|
|
7
|
+
const nodeHook = createHookRouteLifeCycle({
|
|
8
|
+
beforeSendResponse({ request, currentResponse, exit }) {
|
|
9
|
+
request.raw.response.writeHead(Number(currentResponse.code), currentResponse.headers);
|
|
10
|
+
return exit();
|
|
11
|
+
},
|
|
12
|
+
async sendResponse({ request, currentResponse, exit }) {
|
|
13
|
+
const { response: rawResponse } = request.raw;
|
|
14
|
+
const body = currentResponse.body;
|
|
15
|
+
if (body instanceof Error) {
|
|
16
|
+
rawResponse.write(body.toString());
|
|
17
|
+
}
|
|
18
|
+
else if (SF.isFileInterface(body)) {
|
|
19
|
+
await new Promise((resolve, reject) => {
|
|
20
|
+
createReadStream(body.path)
|
|
21
|
+
.pipe(request.raw.response
|
|
22
|
+
.once("error", reject)
|
|
23
|
+
.once("close", resolve));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else if (typeof body === "object"
|
|
27
|
+
|| typeof body === "number"
|
|
28
|
+
|| typeof body === "boolean") {
|
|
29
|
+
rawResponse.write(JSON.stringify(body));
|
|
30
|
+
}
|
|
31
|
+
else if (typeof body === "string") {
|
|
32
|
+
rawResponse.write(body);
|
|
33
|
+
}
|
|
34
|
+
rawResponse.end();
|
|
35
|
+
return exit();
|
|
36
|
+
},
|
|
37
|
+
async afterSendResponse({ request, next }) {
|
|
38
|
+
if (request.filesAttache) {
|
|
39
|
+
await Promise.all(A.map(request.filesAttache, (path) => SF.remove(path)));
|
|
40
|
+
}
|
|
41
|
+
return next();
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export { nodeHook };
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
require('./types/index.cjs');
|
|
4
4
|
var kind = require('./kind.cjs');
|
|
5
|
-
require('./error/index.cjs');
|
|
6
5
|
var createHttpServer = require('./createHttpServer.cjs');
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
6
|
+
var index = require('./hooks/index.cjs');
|
|
7
|
+
require('./bodyReaders/index.cjs');
|
|
8
|
+
var error = require('./bodyReaders/formData/error.cjs');
|
|
9
|
+
var readRequestFormData = require('./bodyReaders/formData/readRequestFormData.cjs');
|
|
10
|
+
var index$1 = require('./bodyReaders/formData/index.cjs');
|
|
11
|
+
var readRequestText = require('./bodyReaders/text/readRequestText.cjs');
|
|
12
|
+
var index$2 = require('./bodyReaders/text/index.cjs');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
exports.createInterfacesNodeLibKind = kind.createInterfacesNodeLibKind;
|
|
15
17
|
exports.createHttpServer = createHttpServer.createHttpServer;
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
18
|
+
exports.nodeHook = index.nodeHook;
|
|
19
|
+
exports.BodyParseFormDataError = error.BodyParseFormDataError;
|
|
20
|
+
exports.readRequestFormData = readRequestFormData.readRequestFormData;
|
|
21
|
+
exports.createFormDataBodyReaderImplementation = index$1.createFormDataBodyReaderImplementation;
|
|
22
|
+
exports.readRequestText = readRequestText.readRequestText;
|
|
23
|
+
exports.createTextBodyReaderImplementation = index$2.createTextBodyReaderImplementation;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import './types/index.mjs';
|
|
2
2
|
export { createInterfacesNodeLibKind } from './kind.mjs';
|
|
3
|
-
import './error/index.mjs';
|
|
4
3
|
export { createHttpServer } from './createHttpServer.mjs';
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
4
|
+
export { nodeHook } from './hooks/index.mjs';
|
|
5
|
+
import './bodyReaders/index.mjs';
|
|
6
|
+
export { BodyParseFormDataError } from './bodyReaders/formData/error.mjs';
|
|
7
|
+
export { readRequestFormData } from './bodyReaders/formData/readRequestFormData.mjs';
|
|
8
|
+
export { createFormDataBodyReaderImplementation } from './bodyReaders/formData/index.mjs';
|
|
9
|
+
export { readRequestText } from './bodyReaders/text/readRequestText.mjs';
|
|
10
|
+
export { createTextBodyReaderImplementation } from './bodyReaders/text/index.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../../../core/request.mjs';
|
|
1
|
+
import '../../../core/request/index.mjs';
|
|
2
2
|
import '../../../core/steps/index.mjs';
|
|
@@ -10,6 +10,8 @@ var metadata = require('./metadata.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
exports.codeGeneratorPlugin = plugin.codeGeneratorPlugin;
|
|
13
|
+
exports.bodyAsFormData = routeToDataParser.bodyAsFormData;
|
|
14
|
+
exports.convertRoutePath = routeToDataParser.convertRoutePath;
|
|
13
15
|
exports.routeToDataParser = routeToDataParser.routeToDataParser;
|
|
14
16
|
exports.aggregateStepContract = aggregateStepContract.aggregateStepContract;
|
|
15
17
|
exports.IgnoreByCodeGeneratorMetadata = metadata.IgnoreByCodeGeneratorMetadata;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@duplojs/data-parser-tools/toTypescript';
|
|
2
2
|
import './types/index.mjs';
|
|
3
3
|
export { codeGeneratorPlugin } from './plugin.mjs';
|
|
4
|
-
export { routeToDataParser } from './routeToDataParser.mjs';
|
|
4
|
+
export { bodyAsFormData, convertRoutePath, routeToDataParser } from './routeToDataParser.mjs';
|
|
5
5
|
export { aggregateStepContract } from './aggregateStepContract.mjs';
|
|
6
6
|
export { IgnoreByCodeGeneratorMetadata } from './metadata.mjs';
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
var DataParserToTypescript = require('@duplojs/data-parser-tools/toTypescript');
|
|
4
4
|
var utils = require('@duplojs/utils');
|
|
5
5
|
var routeToDataParser = require('./routeToDataParser.cjs');
|
|
6
|
-
var
|
|
6
|
+
var serverUtils = require('@duplojs/server-utils');
|
|
7
|
+
var typescriptTransfomer = require('./typescriptTransfomer.cjs');
|
|
7
8
|
|
|
8
9
|
function _interopNamespaceDefault(e) {
|
|
9
10
|
var n = Object.create(null);
|
|
@@ -33,7 +34,7 @@ function codeGeneratorPlugin(pluginParams) {
|
|
|
33
34
|
if (!utils.equal(hub.config.environment, ["DEV", "BUILD"])) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
const routes = hub.
|
|
37
|
+
const routes = utils.A.from(hub.routes);
|
|
37
38
|
const dataParserRoutes = utils.A.flatMap(routes, (route) => routeToDataParser.routeToDataParser(route, {
|
|
38
39
|
defaultExtractContract: hub.defaultExtractContract,
|
|
39
40
|
}));
|
|
@@ -42,9 +43,15 @@ function codeGeneratorPlugin(pluginParams) {
|
|
|
42
43
|
}
|
|
43
44
|
const output = DataParserToTypescript__namespace.render(utils.DP.union(dataParserRoutes), {
|
|
44
45
|
identifier: "Routes",
|
|
45
|
-
|
|
46
|
+
mode: "in",
|
|
47
|
+
transformers: [
|
|
48
|
+
typescriptTransfomer.fileTransformer,
|
|
49
|
+
typescriptTransfomer.dateTransformer,
|
|
50
|
+
typescriptTransfomer.timeTransformer,
|
|
51
|
+
...DataParserToTypescript__namespace.defaultTransformers,
|
|
52
|
+
],
|
|
46
53
|
});
|
|
47
|
-
await
|
|
54
|
+
utils.asserts(await serverUtils.SF.writeTextFile(pluginParams.outputFile, output), utils.E.isRight);
|
|
48
55
|
},
|
|
49
56
|
},
|
|
50
57
|
],
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as DataParserToTypescript from '@duplojs/data-parser-tools/toTypescript';
|
|
2
|
-
import { equal, A, DP } from '@duplojs/utils';
|
|
2
|
+
import { equal, A, DP, asserts, E } from '@duplojs/utils';
|
|
3
3
|
import { routeToDataParser } from './routeToDataParser.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { SF } from '@duplojs/server-utils';
|
|
5
|
+
import { fileTransformer, dateTransformer, timeTransformer } from './typescriptTransfomer.mjs';
|
|
5
6
|
|
|
6
7
|
function codeGeneratorPlugin(pluginParams) {
|
|
7
8
|
return () => ({
|
|
@@ -12,7 +13,7 @@ function codeGeneratorPlugin(pluginParams) {
|
|
|
12
13
|
if (!equal(hub.config.environment, ["DEV", "BUILD"])) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
const routes = hub.
|
|
16
|
+
const routes = A.from(hub.routes);
|
|
16
17
|
const dataParserRoutes = A.flatMap(routes, (route) => routeToDataParser(route, {
|
|
17
18
|
defaultExtractContract: hub.defaultExtractContract,
|
|
18
19
|
}));
|
|
@@ -21,9 +22,15 @@ function codeGeneratorPlugin(pluginParams) {
|
|
|
21
22
|
}
|
|
22
23
|
const output = DataParserToTypescript.render(DP.union(dataParserRoutes), {
|
|
23
24
|
identifier: "Routes",
|
|
24
|
-
|
|
25
|
+
mode: "in",
|
|
26
|
+
transformers: [
|
|
27
|
+
fileTransformer,
|
|
28
|
+
dateTransformer,
|
|
29
|
+
timeTransformer,
|
|
30
|
+
...DataParserToTypescript.defaultTransformers,
|
|
31
|
+
],
|
|
25
32
|
});
|
|
26
|
-
await
|
|
33
|
+
asserts(await SF.writeTextFile(pluginParams.outputFile, output), E.isRight);
|
|
27
34
|
},
|
|
28
35
|
},
|
|
29
36
|
],
|
|
@@ -3,7 +3,21 @@
|
|
|
3
3
|
var aggregateStepContract = require('./aggregateStepContract.cjs');
|
|
4
4
|
var utils = require('@duplojs/utils');
|
|
5
5
|
var metadata = require('./metadata.cjs');
|
|
6
|
+
require('../../core/request/index.cjs');
|
|
7
|
+
var typescript = require('typescript');
|
|
8
|
+
var formData = require('../../core/request/bodyController/formData.cjs');
|
|
6
9
|
|
|
10
|
+
const bodyAsFormData = (dataParser, { transformer, success, addImport }) => {
|
|
11
|
+
const result = transformer(dataParser);
|
|
12
|
+
if (utils.E.isLeft(result)) {
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
addImport("@duplojs/utils", "TheFormData");
|
|
16
|
+
return success(typescript.factory.createTypeReferenceNode("TheFormData", [utils.unwrap(result)]));
|
|
17
|
+
};
|
|
18
|
+
const convertRoutePath = (path) => utils.pipe(path, utils.S.split("*"), utils.A.flatMap((element, { index, self }) => utils.A.isLastIndex(self, index)
|
|
19
|
+
? element
|
|
20
|
+
: [element, utils.DP.string()]), utils.P.when(utils.A.minElements(2), (template) => utils.DP.templateLiteral(template)), utils.P.otherwise(() => utils.DP.literal(path)));
|
|
7
21
|
function routeToDataParser(route, params) {
|
|
8
22
|
const isIgnore = utils.A.find(route.definition.metadata, metadata.IgnoreByCodeGeneratorMetadata.is);
|
|
9
23
|
if (isIgnore) {
|
|
@@ -24,10 +38,19 @@ function routeToDataParser(route, params) {
|
|
|
24
38
|
return skip();
|
|
25
39
|
}), utils.O.fromEntries)), ({ endpointContract, entrypointContract }) => utils.A.map(route.definition.paths, (path) => utils.DP.object({
|
|
26
40
|
method: utils.DP.literal(route.definition.method),
|
|
27
|
-
path:
|
|
41
|
+
path: convertRoutePath(path),
|
|
28
42
|
...entrypointContract,
|
|
43
|
+
...(entrypointContract.body && formData.FormDataBodyController.is(route.definition.bodyController)
|
|
44
|
+
? {
|
|
45
|
+
body: entrypointContract
|
|
46
|
+
.body
|
|
47
|
+
.addOverrideTypescriptTransformer(bodyAsFormData),
|
|
48
|
+
}
|
|
49
|
+
: {}),
|
|
29
50
|
responses: utils.DP.union(endpointContract),
|
|
30
51
|
})));
|
|
31
52
|
}
|
|
32
53
|
|
|
54
|
+
exports.bodyAsFormData = bodyAsFormData;
|
|
55
|
+
exports.convertRoutePath = convertRoutePath;
|
|
33
56
|
exports.routeToDataParser = routeToDataParser;
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import { type Route } from "../../core/route";
|
|
2
2
|
import { DP } from "@duplojs/utils";
|
|
3
3
|
import { type ResponseContract } from "../../core/response";
|
|
4
|
+
import { type TransformerBuildFunction } from "@duplojs/data-parser-tools/toTypescript";
|
|
4
5
|
export interface RouteToDataParserParams {
|
|
5
6
|
readonly defaultExtractContract: ResponseContract.Contract;
|
|
6
7
|
}
|
|
8
|
+
export declare const bodyAsFormData: TransformerBuildFunction;
|
|
9
|
+
export declare const convertRoutePath: (path: string) => DP.DataParserLiteral<{
|
|
10
|
+
readonly value: readonly string[];
|
|
11
|
+
readonly errorMessage?: string | undefined;
|
|
12
|
+
readonly identifier?: string | undefined;
|
|
13
|
+
readonly overrideTypescriptTransformer?: TransformerBuildFunction | undefined;
|
|
14
|
+
readonly checkers: readonly [];
|
|
15
|
+
}> | DP.DataParserTemplateLiteral<{
|
|
16
|
+
readonly template: [string | DP.DataParserString<{
|
|
17
|
+
readonly errorMessage?: string | undefined;
|
|
18
|
+
readonly identifier?: string | undefined;
|
|
19
|
+
readonly overrideTypescriptTransformer?: TransformerBuildFunction | undefined;
|
|
20
|
+
readonly coerce: boolean;
|
|
21
|
+
readonly checkers: readonly [];
|
|
22
|
+
}>, string | DP.DataParserString<{
|
|
23
|
+
readonly errorMessage?: string | undefined;
|
|
24
|
+
readonly identifier?: string | undefined;
|
|
25
|
+
readonly overrideTypescriptTransformer?: TransformerBuildFunction | undefined;
|
|
26
|
+
readonly coerce: boolean;
|
|
27
|
+
readonly checkers: readonly [];
|
|
28
|
+
}>, ...(string | DP.DataParserString<{
|
|
29
|
+
readonly errorMessage?: string | undefined;
|
|
30
|
+
readonly identifier?: string | undefined;
|
|
31
|
+
readonly overrideTypescriptTransformer?: TransformerBuildFunction | undefined;
|
|
32
|
+
readonly coerce: boolean;
|
|
33
|
+
readonly checkers: readonly [];
|
|
34
|
+
}>)[]];
|
|
35
|
+
readonly errorMessage?: string | undefined;
|
|
36
|
+
readonly identifier?: string | undefined;
|
|
37
|
+
readonly overrideTypescriptTransformer?: TransformerBuildFunction | undefined;
|
|
38
|
+
readonly pattern: RegExp;
|
|
39
|
+
readonly checkers: readonly [];
|
|
40
|
+
}>;
|
|
7
41
|
export declare function routeToDataParser(route: Route, params: RouteToDataParserParams): DP.DataParser[];
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { aggregateStepContract } from './aggregateStepContract.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { E, unwrap, pipe, S, A, DP, P, O, innerPipe } from '@duplojs/utils';
|
|
3
3
|
import { IgnoreByCodeGeneratorMetadata } from './metadata.mjs';
|
|
4
|
+
import '../../core/request/index.mjs';
|
|
5
|
+
import { factory } from 'typescript';
|
|
6
|
+
import { FormDataBodyController } from '../../core/request/bodyController/formData.mjs';
|
|
4
7
|
|
|
8
|
+
const bodyAsFormData = (dataParser, { transformer, success, addImport }) => {
|
|
9
|
+
const result = transformer(dataParser);
|
|
10
|
+
if (E.isLeft(result)) {
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
addImport("@duplojs/utils", "TheFormData");
|
|
14
|
+
return success(factory.createTypeReferenceNode("TheFormData", [unwrap(result)]));
|
|
15
|
+
};
|
|
16
|
+
const convertRoutePath = (path) => pipe(path, S.split("*"), A.flatMap((element, { index, self }) => A.isLastIndex(self, index)
|
|
17
|
+
? element
|
|
18
|
+
: [element, DP.string()]), P.when(A.minElements(2), (template) => DP.templateLiteral(template)), P.otherwise(() => DP.literal(path)));
|
|
5
19
|
function routeToDataParser(route, params) {
|
|
6
20
|
const isIgnore = A.find(route.definition.metadata, IgnoreByCodeGeneratorMetadata.is);
|
|
7
21
|
if (isIgnore) {
|
|
@@ -22,10 +36,17 @@ function routeToDataParser(route, params) {
|
|
|
22
36
|
return skip();
|
|
23
37
|
}), O.fromEntries)), ({ endpointContract, entrypointContract }) => A.map(route.definition.paths, (path) => DP.object({
|
|
24
38
|
method: DP.literal(route.definition.method),
|
|
25
|
-
path:
|
|
39
|
+
path: convertRoutePath(path),
|
|
26
40
|
...entrypointContract,
|
|
41
|
+
...(entrypointContract.body && FormDataBodyController.is(route.definition.bodyController)
|
|
42
|
+
? {
|
|
43
|
+
body: entrypointContract
|
|
44
|
+
.body
|
|
45
|
+
.addOverrideTypescriptTransformer(bodyAsFormData),
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
27
48
|
responses: DP.union(endpointContract),
|
|
28
49
|
})));
|
|
29
50
|
}
|
|
30
51
|
|
|
31
|
-
export { routeToDataParser };
|
|
52
|
+
export { bodyAsFormData, convertRoutePath, routeToDataParser };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DataParserToTypescript = require('@duplojs/data-parser-tools/toTypescript');
|
|
4
|
+
var serverUtils = require('@duplojs/server-utils');
|
|
5
|
+
var utils = require('@duplojs/utils');
|
|
6
|
+
var typescript = require('typescript');
|
|
7
|
+
|
|
8
|
+
const fileTransformer = DataParserToTypescript.createTransformer(serverUtils.SDP.fileKind.has, (__, { success }) => success(typescript.factory.createTypeReferenceNode("File")));
|
|
9
|
+
const dateTransformer = DataParserToTypescript.createTransformer(utils.DP.dateKind.has, (__, { success, addImport }) => {
|
|
10
|
+
addImport("@duplojs/utils/date", "TheDate");
|
|
11
|
+
addImport("@duplojs/utils/date", "SerializedTheDate");
|
|
12
|
+
return success(typescript.factory.createUnionTypeNode([
|
|
13
|
+
typescript.factory.createTypeReferenceNode(typescript.factory.createIdentifier("SerializedTheDate")),
|
|
14
|
+
typescript.factory.createTypeReferenceNode(typescript.factory.createIdentifier("TheDate")),
|
|
15
|
+
]));
|
|
16
|
+
});
|
|
17
|
+
const timeTransformer = DataParserToTypescript.createTransformer(utils.DP.timeKind.has, (__, { success, addImport }) => {
|
|
18
|
+
addImport("@duplojs/utils/date", "TheTime");
|
|
19
|
+
addImport("@duplojs/utils/date", "SerializedTheTime");
|
|
20
|
+
return success(typescript.factory.createUnionTypeNode([
|
|
21
|
+
typescript.factory.createTypeReferenceNode(typescript.factory.createIdentifier("SerializedTheTime")),
|
|
22
|
+
typescript.factory.createTypeReferenceNode(typescript.factory.createIdentifier("TheTime")),
|
|
23
|
+
]));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
exports.dateTransformer = dateTransformer;
|
|
27
|
+
exports.fileTransformer = fileTransformer;
|
|
28
|
+
exports.timeTransformer = timeTransformer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DP } from "@duplojs/utils";
|
|
2
|
+
export declare const fileTransformer: (schema: DP.DataParsers, params: import("@duplojs/data-parser-tools/toTypescript").TransformerParams) => import("@duplojs/data-parser-tools/toTypescript").MaybeTransformerEither;
|
|
3
|
+
export declare const dateTransformer: (schema: DP.DataParsers, params: import("@duplojs/data-parser-tools/toTypescript").TransformerParams) => import("@duplojs/data-parser-tools/toTypescript").MaybeTransformerEither;
|
|
4
|
+
export declare const timeTransformer: (schema: DP.DataParsers, params: import("@duplojs/data-parser-tools/toTypescript").TransformerParams) => import("@duplojs/data-parser-tools/toTypescript").MaybeTransformerEither;
|