@zipbul/baker 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -508
- package/dist/index-btgens0c.js +6 -0
- package/dist/index-k369bbht.js +6 -0
- package/dist/index.d.ts +5 -6
- package/dist/index.js +205 -202
- package/dist/src/collect.d.ts +0 -2
- package/dist/src/configure.d.ts +0 -6
- package/dist/src/create-rule.d.ts +1 -1
- package/dist/src/decorators/field.d.ts +0 -9
- package/dist/src/decorators/index.d.ts +1 -1
- package/dist/src/decorators/index.js +1 -1
- package/dist/src/errors.d.ts +19 -8
- package/dist/src/functions/_run-sealed.d.ts +7 -0
- package/dist/src/functions/deserialize.d.ts +5 -4
- package/dist/src/functions/index.d.ts +1 -2
- package/dist/src/functions/serialize.d.ts +2 -2
- package/dist/src/functions/validate.d.ts +13 -0
- package/dist/src/rules/index.d.ts +1 -1
- package/dist/src/rules/index.js +9 -9
- package/dist/src/rules/string.d.ts +6 -48
- package/dist/src/symbols.d.ts +0 -2
- package/dist/src/symbols.js +2 -2
- package/dist/src/types.d.ts +2 -58
- package/package.json +13 -3
- package/README.ko.md +0 -588
- package/dist/index-70ggmxsa.js +0 -6
- package/dist/index-gcptd79v.js +0 -6
- package/dist/src/functions/to-json-schema.d.ts +0 -20
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{e as v}from"./index-k369bbht.js";var z=new Set;function B(h,S){if(!Object.prototype.hasOwnProperty.call(h,v))h[v]=Object.create(null),z.add(h);let b=h[v];return b[S]??={validation:[],transform:[],expose:[],exclude:null,type:null,flags:{}}}function C(h){return h[Symbol.toStringTag]==="AsyncFunction"}var J=Symbol.for("baker:arrayOf");function E(...h){let S={rules:h};return S[J]=!0,S}function Q(h){return typeof h==="object"&&h!==null&&h[J]===!0}var T=new Set(["type","discriminator","keepDiscriminatorProperty","rules","optional","nullable","name","deserializeName","serializeName","exclude","groups","when","transform","transformDirection","message","context","mapValue","setValue"]);function H(h){if(typeof h==="function")return!1;if(typeof h!=="object"||h===null)return!1;if(Q(h))return!1;let S=Object.keys(h);if(S.length===0)return!0;return S.some((b)=>T.has(b))}function U(h){if(h.length===0)return{rules:[],options:{}};if(h.length===1&&H(h[0])){let b=h[0];return{rules:b.rules??[],options:b}}let S=h[h.length-1];if(H(S)){let b=S,j=h.slice(0,-1);if(b.rules)j=[...j,...b.rules];return{rules:j,options:b}}return{rules:h,options:{}}}function X(h,S,b){for(let j of S)if(Q(j))for(let q of j.rules){let c={rule:q,each:!0,groups:b.groups};if(b.message!==void 0)c.message=b.message;if(b.context!==void 0)c.context=b.context;h.validation.push(c)}else{let q={rule:j,groups:b.groups};if(b.message!==void 0)q.message=b.message;if(b.context!==void 0)q.context=b.context;h.validation.push(q)}}function Z(h,S){if(S.name)h.expose.push({name:S.name,groups:S.groups});else if(S.deserializeName||S.serializeName){if(S.deserializeName)h.expose.push({name:S.deserializeName,deserializeOnly:!0,groups:S.groups});if(S.serializeName)h.expose.push({name:S.serializeName,serializeOnly:!0,groups:S.groups})}else if(S.groups)h.expose.push({groups:S.groups});else h.expose.push({})}function $(h,S){if(!S.transform)return;let b=S.transform,q=C(b)?async(G)=>b({value:G.value,key:G.key,obj:G.obj,direction:G.type}):(G)=>b({value:G.value,key:G.key,obj:G.obj,direction:G.type}),c={};if(S.transformDirection==="deserializeOnly")c.deserializeOnly=!0;if(S.transformDirection==="serializeOnly")c.serializeOnly=!0;h.transform.push({fn:q,options:Object.keys(c).length>0?c:void 0})}function W(...h){return(S,b)=>{let j=S.constructor,c=B(j,b),{rules:G,options:w}=U(h);if(X(c,G,w),w.optional)c.flags.isOptional=!0;if(w.nullable)c.flags.isNullable=!0;if(w.when)c.flags.validateIf=w.when;if(w.type)c.type={fn:w.type,discriminator:w.discriminator,keepDiscriminatorProperty:w.keepDiscriminatorProperty,collectionValue:w.mapValue??w.setValue};if(Z(c,w),w.exclude){if(w.exclude===!0)c.exclude={};else if(w.exclude==="deserializeOnly")c.exclude={deserializeOnly:!0};else if(w.exclude==="serializeOnly")c.exclude={serializeOnly:!0}}$(c,w)}}
|
|
3
|
+
export{z as a,C as b,E as c,W as d};
|
|
4
|
+
|
|
5
|
+
//# debugId=97D01B7065BCEE5B64756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-btgens0c.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export { deserialize } from './src/functions/deserialize';
|
|
2
|
+
export { validate } from './src/functions/validate';
|
|
2
3
|
export { serialize } from './src/functions/serialize';
|
|
3
|
-
export { toJsonSchema } from './src/functions/to-json-schema';
|
|
4
4
|
export { configure } from './src/configure';
|
|
5
5
|
export { createRule } from './src/create-rule';
|
|
6
6
|
export { Field, arrayOf } from './src/decorators/index';
|
|
7
|
-
export type { FieldOptions, FieldTransformParams,
|
|
8
|
-
export type { BakerError } from './src/errors';
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
7
|
+
export type { FieldOptions, FieldTransformParams, ArrayOfMarker } from './src/decorators/index';
|
|
8
|
+
export type { BakerError, BakerErrors } from './src/errors';
|
|
9
|
+
export { isBakerError, SealError } from './src/errors';
|
|
10
|
+
export type { EmittableRule } from './src/types';
|
|
11
11
|
export type { BakerConfig, ConfigureResult } from './src/configure';
|
|
12
12
|
export type { RuntimeOptions } from './src/interfaces';
|
|
13
|
-
export type { ToJsonSchemaOptions } from './src/functions/to-json-schema';
|