@efebia/fastify-zod-reply 1.2.0 → 1.2.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/lib/cjs/index.d.ts +4 -3
- package/lib/cjs/index.js +3 -7
- package/lib/cjs/plugin.d.ts +1 -2
- package/lib/cjs/plugin.js +2 -2
- package/lib/cjs/pluginV4.d.ts +1 -2
- package/lib/cjs/pluginV4.js +2 -2
- package/lib/esm/index.d.ts +4 -3
- package/lib/esm/index.js +3 -3
- package/lib/esm/plugin.d.ts +1 -2
- package/lib/esm/plugin.js +1 -1
- package/lib/esm/pluginV4.d.ts +1 -2
- package/lib/esm/pluginV4.js +1 -1
- package/package.json +1 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { plugin, type FastifyReplyPluginOptions, type StatusCode, type StatusCodeBuilder } from './plugin.js';
|
|
2
2
|
import { StatusCodeKey } from './types.js';
|
|
3
3
|
export type DecoratedReply = {
|
|
4
4
|
[key in StatusCodeKey]: <T>(val?: T) => T;
|
|
@@ -8,8 +8,9 @@ declare module 'fastify' {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export * from './error.js';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './pluginV4.js';
|
|
12
12
|
export * from './route.js';
|
|
13
13
|
export * from './routeV4.js';
|
|
14
14
|
export * from './types.js';
|
|
15
|
-
export {
|
|
15
|
+
export { type FastifyReplyPluginOptions, type StatusCode, type StatusCodeBuilder };
|
|
16
|
+
export default plugin;
|
package/lib/cjs/index.js
CHANGED
|
@@ -13,15 +13,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
|
|
21
|
-
const pluginV4_js_1 = __importDefault(require("./pluginV4.js"));
|
|
22
|
-
exports.pluginV4 = pluginV4_js_1.default;
|
|
17
|
+
const plugin_js_1 = require("./plugin.js");
|
|
23
18
|
__exportStar(require("./error.js"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./pluginV4.js"), exports);
|
|
25
20
|
__exportStar(require("./route.js"), exports);
|
|
26
21
|
__exportStar(require("./routeV4.js"), exports);
|
|
27
22
|
__exportStar(require("./types.js"), exports);
|
|
23
|
+
exports.default = plugin_js_1.plugin;
|
package/lib/cjs/plugin.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export declare class StatusCodeBuilder<TOpts extends Partial<Record<StatusCodeKe
|
|
|
16
16
|
export type FastifyReplyPluginOptions = {
|
|
17
17
|
statusCodes?: StatusCodeBuilder;
|
|
18
18
|
};
|
|
19
|
-
declare const
|
|
20
|
-
export default _default;
|
|
19
|
+
export declare const plugin: import("fastify").FastifyPluginCallback<FastifyReplyPluginOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
package/lib/cjs/plugin.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StatusCodeBuilder = void 0;
|
|
6
|
+
exports.plugin = exports.StatusCodeBuilder = void 0;
|
|
7
7
|
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
9
|
const reply_js_1 = require("./reply.js");
|
|
@@ -32,7 +32,7 @@ const defaultOptions = {
|
|
|
32
32
|
.set("conflict", { schema: messageSchema, payload: { message: "conflict" } })
|
|
33
33
|
.set("internalServerError", { schema: messageSchema, payload: { message: "internalServerError" } })
|
|
34
34
|
};
|
|
35
|
-
exports.
|
|
35
|
+
exports.plugin = (0, fastify_plugin_1.default)(async (fastify, opts) => {
|
|
36
36
|
var _a, _b, _c;
|
|
37
37
|
const finalOptions = {
|
|
38
38
|
statusCodes: new StatusCodeBuilder(Object.assign(Object.assign({}, (_a = defaultOptions.statusCodes) === null || _a === void 0 ? void 0 : _a.obj), (_b = opts.statusCodes) === null || _b === void 0 ? void 0 : _b.obj)),
|
package/lib/cjs/pluginV4.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export declare class StatusCodeV4Builder<TOpts extends Partial<Record<StatusCode
|
|
|
16
16
|
export type FastifyReplyV4PluginOptions = {
|
|
17
17
|
statusCodes?: StatusCodeV4Builder;
|
|
18
18
|
};
|
|
19
|
-
declare const
|
|
20
|
-
export default _default;
|
|
19
|
+
export declare const pluginV4: import("fastify").FastifyPluginCallback<FastifyReplyV4PluginOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
package/lib/cjs/pluginV4.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StatusCodeV4Builder = void 0;
|
|
6
|
+
exports.pluginV4 = exports.StatusCodeV4Builder = void 0;
|
|
7
7
|
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
|
|
8
8
|
const v4_1 = require("zod/v4");
|
|
9
9
|
const reply_js_1 = require("./reply.js");
|
|
@@ -32,7 +32,7 @@ const defaultOptions = {
|
|
|
32
32
|
.set("conflict", { schema: messageSchema, payload: { message: "conflict" } })
|
|
33
33
|
.set("internalServerError", { schema: messageSchema, payload: { message: "internalServerError" } })
|
|
34
34
|
};
|
|
35
|
-
exports.
|
|
35
|
+
exports.pluginV4 = (0, fastify_plugin_1.default)(async (fastify, opts) => {
|
|
36
36
|
var _a, _b, _c;
|
|
37
37
|
const finalOptions = {
|
|
38
38
|
statusCodes: new StatusCodeV4Builder(Object.assign(Object.assign({}, (_a = defaultOptions.statusCodes) === null || _a === void 0 ? void 0 : _a.obj), (_b = opts.statusCodes) === null || _b === void 0 ? void 0 : _b.obj)),
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { plugin, type FastifyReplyPluginOptions, type StatusCode, type StatusCodeBuilder } from './plugin.js';
|
|
2
2
|
import { StatusCodeKey } from './types.js';
|
|
3
3
|
export type DecoratedReply = {
|
|
4
4
|
[key in StatusCodeKey]: <T>(val?: T) => T;
|
|
@@ -8,8 +8,9 @@ declare module 'fastify' {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export * from './error.js';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './pluginV4.js';
|
|
12
12
|
export * from './route.js';
|
|
13
13
|
export * from './routeV4.js';
|
|
14
14
|
export * from './types.js';
|
|
15
|
-
export {
|
|
15
|
+
export { type FastifyReplyPluginOptions, type StatusCode, type StatusCodeBuilder };
|
|
16
|
+
export default plugin;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { plugin } from './plugin.js';
|
|
2
2
|
export * from './error.js';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './pluginV4.js';
|
|
4
4
|
export * from './route.js';
|
|
5
5
|
export * from './routeV4.js';
|
|
6
6
|
export * from './types.js';
|
|
7
|
-
export
|
|
7
|
+
export default plugin;
|
package/lib/esm/plugin.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export declare class StatusCodeBuilder<TOpts extends Partial<Record<StatusCodeKe
|
|
|
16
16
|
export type FastifyReplyPluginOptions = {
|
|
17
17
|
statusCodes?: StatusCodeBuilder;
|
|
18
18
|
};
|
|
19
|
-
declare const
|
|
20
|
-
export default _default;
|
|
19
|
+
export declare const plugin: import("fastify").FastifyPluginCallback<FastifyReplyPluginOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
package/lib/esm/plugin.js
CHANGED
|
@@ -25,7 +25,7 @@ const defaultOptions = {
|
|
|
25
25
|
.set("conflict", { schema: messageSchema, payload: { message: "conflict" } })
|
|
26
26
|
.set("internalServerError", { schema: messageSchema, payload: { message: "internalServerError" } })
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export const plugin = fp(async (fastify, opts) => {
|
|
29
29
|
var _a, _b, _c;
|
|
30
30
|
const finalOptions = {
|
|
31
31
|
statusCodes: new StatusCodeBuilder(Object.assign(Object.assign({}, (_a = defaultOptions.statusCodes) === null || _a === void 0 ? void 0 : _a.obj), (_b = opts.statusCodes) === null || _b === void 0 ? void 0 : _b.obj)),
|
package/lib/esm/pluginV4.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export declare class StatusCodeV4Builder<TOpts extends Partial<Record<StatusCode
|
|
|
16
16
|
export type FastifyReplyV4PluginOptions = {
|
|
17
17
|
statusCodes?: StatusCodeV4Builder;
|
|
18
18
|
};
|
|
19
|
-
declare const
|
|
20
|
-
export default _default;
|
|
19
|
+
export declare const pluginV4: import("fastify").FastifyPluginCallback<FastifyReplyV4PluginOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
package/lib/esm/pluginV4.js
CHANGED
|
@@ -25,7 +25,7 @@ const defaultOptions = {
|
|
|
25
25
|
.set("conflict", { schema: messageSchema, payload: { message: "conflict" } })
|
|
26
26
|
.set("internalServerError", { schema: messageSchema, payload: { message: "internalServerError" } })
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export const pluginV4 = fp(async (fastify, opts) => {
|
|
29
29
|
var _a, _b, _c;
|
|
30
30
|
const finalOptions = {
|
|
31
31
|
statusCodes: new StatusCodeV4Builder(Object.assign(Object.assign({}, (_a = defaultOptions.statusCodes) === null || _a === void 0 ? void 0 : _a.obj), (_b = opts.statusCodes) === null || _b === void 0 ? void 0 : _b.obj)),
|