@gravito/mass 3.0.2 β 3.0.3
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 +34 -8
- package/dist/coercion.d.ts +4 -15
- package/dist/errors.d.ts +0 -1
- package/dist/formats.d.ts +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -506
- package/dist/openapi.d.ts +0 -1
- package/dist/types.d.ts +2 -5
- package/dist/utils.d.ts +0 -1
- package/dist/validator.d.ts +27 -34
- package/package.json +6 -4
- package/dist/coercion.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/formats.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/openapi.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/validator.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -4,14 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
`@gravito/mass` provides the "weight" of data integrity to your Gravito applications. Built on top of **TypeBox**, it offers ultra-fast runtime validation with full TypeScript type inference, designed to work seamlessly with the **Photon** HTTP engine.
|
|
6
6
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
7
|
+
## β¨ Key Features
|
|
8
|
+
|
|
9
|
+
- π **Performance-First**: Built on TypeBox, it generates ultra-fast validators that outperform standard libraries like Zod.
|
|
10
|
+
- π **Galaxy-Ready**: The "Data Quality Layer" ensuring integrity across all Gravito Satellites and Orbits.
|
|
11
|
+
- π‘οΈ **Full Type Safety**: Zero-config type inferenceβyour schemas are your TypeScript types.
|
|
12
|
+
- π‘ **Beam Integration**: Share schemas between backend and frontend for end-to-end type-safe RPC.
|
|
13
|
+
- π **Photon Integration**: Native middleware for `@gravito/photon` to validate JSON, query, params, and form data.
|
|
14
|
+
- π¦ **Binary (CBOR) Support**: Optimized validation for binary protocols in high-performance microservices.
|
|
15
|
+
|
|
16
|
+
## π Role in Galaxy Architecture
|
|
17
|
+
|
|
18
|
+
In the **Gravito Galaxy Architecture**, Mass serves as the **Data Quality Layer (Immune System)**.
|
|
19
|
+
|
|
20
|
+
- **Sensing Filter**: Acts as the first line of defense in the `Photon` Sensing Layer, filtering out malformed or malicious data before it reaches your business logic.
|
|
21
|
+
- **Contract Definition**: Provides the shared language (Schemas) used by `Beam` to ensure that Satellites and clients communicate with perfect understanding.
|
|
22
|
+
- **Type Propagation**: Injects strong types from the edge of the network into the deepest parts of your IoC container.
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
graph LR
|
|
26
|
+
Request([Request]) --> Mass{Mass Filter}
|
|
27
|
+
Mass -- "Valid" --> Satellite[Satellite Business Logic]
|
|
28
|
+
Mass -- "Invalid" --> Error[400 Bad Request]
|
|
29
|
+
Satellite -- "Beam RPC" --> Client([Typed Client])
|
|
30
|
+
Mass -.->|Schema| Client
|
|
31
|
+
```
|
|
15
32
|
|
|
16
33
|
## π¦ Installation
|
|
17
34
|
|
|
@@ -129,6 +146,15 @@ The central builder for defining data structures. Re-exports all TypeBox builder
|
|
|
129
146
|
### `partial(schema)`
|
|
130
147
|
Recursively makes all properties in an object schema optional.
|
|
131
148
|
|
|
149
|
+
## π Documentation
|
|
150
|
+
|
|
151
|
+
Detailed guides and references for the Galaxy Architecture:
|
|
152
|
+
|
|
153
|
+
- [ποΈ **Architecture Overview**](./README.md) β Data integrity and schema validation.
|
|
154
|
+
- [π **Schema Design**](./doc/SCHEMA_DESIGN.md) β **NEW**: Best practices for domain-specific schemas and composition.
|
|
155
|
+
- [π‘οΈ **Validation Strategy**](./doc/VALIDATION_STRATEGY.md) β **NEW**: Multi-source validation, hooks, and performance tuning.
|
|
156
|
+
- [π **Photon Integration**](#-photon-integration) β Native middleware for request validation.
|
|
157
|
+
|
|
132
158
|
## π€ Contributing
|
|
133
159
|
|
|
134
160
|
We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
|
package/dist/coercion.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { GravitoContext, GravitoMiddleware } from '@gravito/core';
|
|
2
|
+
import type { TBoolean, TInteger, TNumber, TSchema } from '@sinclair/typebox';
|
|
3
3
|
/**
|
|
4
4
|
* String to Number Coercion Helper.
|
|
5
5
|
*
|
|
@@ -164,14 +164,11 @@ export declare function coerceData<T extends TSchema>(data: unknown, schema: T):
|
|
|
164
164
|
* are string-based.
|
|
165
165
|
*
|
|
166
166
|
* @template T - TypeBox schema type
|
|
167
|
-
* @template S - Validation source type
|
|
168
|
-
* @template E - Photon environment type
|
|
169
|
-
* @template P - Route path type
|
|
170
167
|
*
|
|
171
168
|
* @param source - Validation source (recommend using 'query' or 'param')
|
|
172
169
|
* @param schema - TypeBox schema definition
|
|
173
170
|
* @param hook - Optional validation result hook
|
|
174
|
-
* @returns
|
|
171
|
+
* @returns Gravito middleware handler
|
|
175
172
|
*
|
|
176
173
|
* @example Query Parameter Coercion
|
|
177
174
|
* ```typescript
|
|
@@ -222,12 +219,4 @@ export declare function coerceData<T extends TSchema>(data: unknown, schema: T):
|
|
|
222
219
|
* )
|
|
223
220
|
* ```
|
|
224
221
|
*/
|
|
225
|
-
export declare function validateWithCoercion<T extends TSchema
|
|
226
|
-
in: {
|
|
227
|
-
[K in S]: Static<T>;
|
|
228
|
-
};
|
|
229
|
-
out: {
|
|
230
|
-
[K in S]: Static<T>;
|
|
231
|
-
};
|
|
232
|
-
}>;
|
|
233
|
-
//# sourceMappingURL=coercion.d.ts.map
|
|
222
|
+
export declare function validateWithCoercion<T extends TSchema>(source: 'json' | 'query' | 'param' | 'form', schema: T, hook?: (result: unknown, c: GravitoContext) => Response | Promise<Response> | undefined): GravitoMiddleware;
|
package/dist/errors.d.ts
CHANGED
package/dist/formats.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
*
|
|
69
69
|
* @packageDocumentation
|
|
70
70
|
*/
|
|
71
|
-
export { tbValidator as validator } from '@hono/typebox-validator';
|
|
72
71
|
export type { Static, TSchema } from '@sinclair/typebox';
|
|
73
72
|
export * as Schema from '@sinclair/typebox';
|
|
74
73
|
export { CoercibleBoolean, CoercibleInteger, CoercibleNumber, coerceBoolean, coerceData, coerceDate, coerceInteger, coerceNumber, validateWithCoercion, } from './coercion';
|
|
@@ -78,4 +77,3 @@ export { type AstralResource, createAstralResource, createCrudResources, type Op
|
|
|
78
77
|
export type { ValidationError, ValidationHook, ValidationResult, } from './types';
|
|
79
78
|
export { partial } from './utils';
|
|
80
79
|
export { type ValidationSource, validate } from './validator';
|
|
81
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,511 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/index.ts
|
|
3
|
-
import { tbValidator as tbValidator3 } from "@hono/typebox-validator";
|
|
4
|
-
import * as Schema from "@sinclair/typebox";
|
|
5
|
-
|
|
6
|
-
// src/coercion.ts
|
|
7
|
-
import { tbValidator } from "@hono/typebox-validator";
|
|
8
|
-
import { Type } from "@sinclair/typebox";
|
|
9
|
-
function coerceNumber(value) {
|
|
10
|
-
const num = Number(value);
|
|
11
|
-
return Number.isNaN(num) ? NaN : num;
|
|
12
|
-
}
|
|
13
|
-
function coerceInteger(value) {
|
|
14
|
-
const num = Number.parseInt(value, 10);
|
|
15
|
-
return Number.isNaN(num) ? NaN : num;
|
|
16
|
-
}
|
|
17
|
-
function coerceBoolean(value) {
|
|
18
|
-
const lowerValue = value.toLowerCase().trim();
|
|
19
|
-
return ["true", "1", "yes", "on"].includes(lowerValue);
|
|
20
|
-
}
|
|
21
|
-
function coerceDate(value) {
|
|
22
|
-
return new Date(value);
|
|
23
|
-
}
|
|
24
|
-
function CoercibleNumber(options) {
|
|
25
|
-
return Type.Number({
|
|
26
|
-
...options,
|
|
27
|
-
[Symbol.for("TypeBox.Transform")]: coerceNumber
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function CoercibleInteger(options) {
|
|
31
|
-
return Type.Integer({
|
|
32
|
-
...options,
|
|
33
|
-
[Symbol.for("TypeBox.Transform")]: coerceInteger
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function CoercibleBoolean(options) {
|
|
37
|
-
return Type.Boolean({
|
|
38
|
-
...options,
|
|
39
|
-
[Symbol.for("TypeBox.Transform")]: coerceBoolean
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function coerceData(data, schema) {
|
|
43
|
-
if (typeof data !== "object" || data === null) {
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
const dataObj = data;
|
|
47
|
-
const result = {};
|
|
48
|
-
if (schema.type !== "object" || !schema.properties) {
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
|
-
for (const [key, value] of Object.entries(dataObj)) {
|
|
52
|
-
const propertySchema = schema.properties[key];
|
|
53
|
-
if (!propertySchema) {
|
|
54
|
-
result[key] = value;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (typeof value === "string") {
|
|
58
|
-
if (propertySchema.type === "number" || propertySchema.type === "integer") {
|
|
59
|
-
result[key] = propertySchema.type === "integer" ? coerceInteger(value) : coerceNumber(value);
|
|
60
|
-
} else if (propertySchema.type === "boolean") {
|
|
61
|
-
result[key] = coerceBoolean(value);
|
|
62
|
-
} else {
|
|
63
|
-
result[key] = value;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
result[key] = value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
function validateWithCoercion(source, schema, hook) {
|
|
72
|
-
return async (c, next) => {
|
|
73
|
-
let data;
|
|
74
|
-
switch (source) {
|
|
75
|
-
case "json":
|
|
76
|
-
data = await c.req.json();
|
|
77
|
-
break;
|
|
78
|
-
case "query":
|
|
79
|
-
data = c.req.query();
|
|
80
|
-
break;
|
|
81
|
-
case "param":
|
|
82
|
-
data = c.req.param();
|
|
83
|
-
break;
|
|
84
|
-
case "form":
|
|
85
|
-
data = await c.req.parseBody();
|
|
86
|
-
break;
|
|
87
|
-
default:
|
|
88
|
-
data = {};
|
|
89
|
-
}
|
|
90
|
-
if (source === "query" || source === "param") {
|
|
91
|
-
data = coerceData(data, schema);
|
|
92
|
-
}
|
|
93
|
-
const validator = tbValidator(source, schema, hook);
|
|
94
|
-
const originalQueryMethod = c.req.query;
|
|
95
|
-
const originalParamMethod = c.req.param;
|
|
96
|
-
if (source === "query") {
|
|
97
|
-
c.req.query = () => data;
|
|
98
|
-
} else if (source === "param") {
|
|
99
|
-
c.req.param = () => data;
|
|
100
|
-
}
|
|
101
|
-
await validator(c, next);
|
|
102
|
-
if (source === "query") {
|
|
103
|
-
c.req.query = originalQueryMethod;
|
|
104
|
-
} else if (source === "param") {
|
|
105
|
-
c.req.param = originalParamMethod;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
// src/errors.ts
|
|
110
|
-
var ERROR_MESSAGES_ZH_TW = {
|
|
111
|
-
REQUIRED: "\u6B64\u6B04\u4F4D\u70BA\u5FC5\u586B",
|
|
112
|
-
INVALID_TYPE: "\u8CC7\u6599\u578B\u5225\u4E0D\u6B63\u78BA",
|
|
113
|
-
INVALID_EMAIL: "\u96FB\u5B50\u90F5\u4EF6\u683C\u5F0F\u4E0D\u6B63\u78BA",
|
|
114
|
-
INVALID_URL: "\u7DB2\u5740\u683C\u5F0F\u4E0D\u6B63\u78BA",
|
|
115
|
-
INVALID_UUID: "UUID \u683C\u5F0F\u4E0D\u6B63\u78BA",
|
|
116
|
-
INVALID_DATE: "\u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u78BA",
|
|
117
|
-
TOO_SHORT: "\u9577\u5EA6\u904E\u77ED",
|
|
118
|
-
TOO_LONG: "\u9577\u5EA6\u904E\u9577",
|
|
119
|
-
TOO_SMALL: "\u6578\u503C\u904E\u5C0F",
|
|
120
|
-
TOO_LARGE: "\u6578\u503C\u904E\u5927",
|
|
121
|
-
INVALID_PATTERN: "\u683C\u5F0F\u4E0D\u7B26\u5408\u898F\u5247",
|
|
122
|
-
INVALID_FORMAT: "\u683C\u5F0F\u4E0D\u6B63\u78BA"
|
|
123
|
-
};
|
|
124
|
-
var ERROR_MESSAGES_EN = {
|
|
125
|
-
REQUIRED: "This field is required",
|
|
126
|
-
INVALID_TYPE: "Invalid data type",
|
|
127
|
-
INVALID_EMAIL: "Invalid email format",
|
|
128
|
-
INVALID_URL: "Invalid URL format",
|
|
129
|
-
INVALID_UUID: "Invalid UUID format",
|
|
130
|
-
INVALID_DATE: "Invalid date format",
|
|
131
|
-
TOO_SHORT: "Too short",
|
|
132
|
-
TOO_LONG: "Too long",
|
|
133
|
-
TOO_SMALL: "Value too small",
|
|
134
|
-
TOO_LARGE: "Value too large",
|
|
135
|
-
INVALID_PATTERN: "Does not match required pattern",
|
|
136
|
-
INVALID_FORMAT: "Invalid format"
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
class MassValidationError extends Error {
|
|
140
|
-
source;
|
|
141
|
-
errors;
|
|
142
|
-
constructor(source, errors) {
|
|
143
|
-
super(`Validation failed for ${source}`);
|
|
144
|
-
this.source = source;
|
|
145
|
-
this.errors = errors;
|
|
146
|
-
this.name = "MassValidationError";
|
|
147
|
-
}
|
|
148
|
-
toJSON() {
|
|
149
|
-
return {
|
|
150
|
-
error: "ValidationError",
|
|
151
|
-
source: this.source,
|
|
152
|
-
details: this.errors
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function enhanceError(error, locale = "zh-TW") {
|
|
157
|
-
const messages = locale === "zh-TW" ? ERROR_MESSAGES_ZH_TW : ERROR_MESSAGES_EN;
|
|
158
|
-
const { path, message, schema, value } = error;
|
|
159
|
-
let enhancedMessage = message;
|
|
160
|
-
if (message.includes("required property")) {
|
|
161
|
-
enhancedMessage = messages.REQUIRED;
|
|
162
|
-
} else if (message.includes("email")) {
|
|
163
|
-
enhancedMessage = messages.INVALID_EMAIL;
|
|
164
|
-
} else if (message.includes("url")) {
|
|
165
|
-
enhancedMessage = messages.INVALID_URL;
|
|
166
|
-
} else if (message.includes("uuid")) {
|
|
167
|
-
enhancedMessage = messages.INVALID_UUID;
|
|
168
|
-
} else if (message.includes("date-time") || message.includes("date")) {
|
|
169
|
-
enhancedMessage = messages.INVALID_DATE;
|
|
170
|
-
} else if (message.includes("length greater or equal")) {
|
|
171
|
-
const minLength = schema.minLength;
|
|
172
|
-
enhancedMessage = locale === "zh-TW" ? `${messages.TOO_SHORT}\uFF08\u6700\u5C11 ${minLength} \u500B\u5B57\u5143\uFF09` : `${messages.TOO_SHORT} (minimum ${minLength} characters)`;
|
|
173
|
-
} else if (message.includes("length less or equal")) {
|
|
174
|
-
const maxLength = schema.maxLength;
|
|
175
|
-
enhancedMessage = locale === "zh-TW" ? `${messages.TOO_LONG}\uFF08\u6700\u591A ${maxLength} \u500B\u5B57\u5143\uFF09` : `${messages.TOO_LONG} (maximum ${maxLength} characters)`;
|
|
176
|
-
} else if (message.includes("greater or equal")) {
|
|
177
|
-
const minimum = schema.minimum;
|
|
178
|
-
enhancedMessage = locale === "zh-TW" ? `${messages.TOO_SMALL}\uFF08\u6700\u5C0F\u503C\uFF1A${minimum}\uFF09` : `${messages.TOO_SMALL} (minimum: ${minimum})`;
|
|
179
|
-
} else if (message.includes("less or equal")) {
|
|
180
|
-
const maximum = schema.maximum;
|
|
181
|
-
enhancedMessage = locale === "zh-TW" ? `${messages.TOO_LARGE}\uFF08\u6700\u5927\u503C\uFF1A${maximum}\uFF09` : `${messages.TOO_LARGE} (maximum: ${maximum})`;
|
|
182
|
-
} else if (message.includes("to match")) {
|
|
183
|
-
enhancedMessage = messages.INVALID_PATTERN;
|
|
184
|
-
} else if (message.includes("format")) {
|
|
185
|
-
enhancedMessage = messages.INVALID_FORMAT;
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
path,
|
|
189
|
-
message: enhancedMessage,
|
|
190
|
-
expected: schema.type ? String(schema.type) : undefined,
|
|
191
|
-
received: typeof value
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function createErrorFormatter(formatter) {
|
|
195
|
-
return (error) => {
|
|
196
|
-
const formatted = formatter(error);
|
|
197
|
-
return {
|
|
198
|
-
path: formatted.path,
|
|
199
|
-
message: formatted.message,
|
|
200
|
-
expected: formatted.expected,
|
|
201
|
-
received: formatted.received
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function formatErrors(errors) {
|
|
206
|
-
const fields = {};
|
|
207
|
-
for (const err of errors) {
|
|
208
|
-
const fieldName = err.path.replace(/^\//, "").replace(/\//g, ".");
|
|
209
|
-
if (!fields[fieldName]) {
|
|
210
|
-
fields[fieldName] = [];
|
|
211
|
-
}
|
|
212
|
-
fields[fieldName].push(err.message);
|
|
213
|
-
}
|
|
214
|
-
return { fields };
|
|
215
|
-
}
|
|
216
|
-
// src/formats.ts
|
|
217
|
-
import { FormatRegistry } from "@sinclair/typebox";
|
|
218
|
-
var REGISTERED_FORMATS = [
|
|
219
|
-
"email",
|
|
220
|
-
"uri",
|
|
221
|
-
"uri-reference",
|
|
222
|
-
"uuid",
|
|
223
|
-
"date-time",
|
|
224
|
-
"date",
|
|
225
|
-
"time",
|
|
226
|
-
"ipv4",
|
|
227
|
-
"ipv6"
|
|
228
|
-
];
|
|
229
|
-
var EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
230
|
-
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
231
|
-
var URL_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/;
|
|
232
|
-
var URI_REFERENCE_REGEX = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/)?[^\s]*$/i;
|
|
233
|
-
var DATE_TIME_REGEX = /^\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}:\d{2}(?:\.\d{3})?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
234
|
-
var DATE_REGEX = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
235
|
-
var TIME_REGEX = /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)(?:\.\d{3})?$/;
|
|
236
|
-
var IPV4_REGEX = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
237
|
-
var IPV6_REGEX = /^(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?:(?::[0-9a-fA-F]{1,4}){1,6})|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
238
|
-
var FORMAT_VALIDATORS = {
|
|
239
|
-
email: (value) => EMAIL_REGEX.test(value),
|
|
240
|
-
uri: (value) => URL_REGEX.test(value),
|
|
241
|
-
"uri-reference": (value) => URI_REFERENCE_REGEX.test(value),
|
|
242
|
-
uuid: (value) => UUID_REGEX.test(value),
|
|
243
|
-
"date-time": (value) => DATE_TIME_REGEX.test(value),
|
|
244
|
-
date: (value) => DATE_REGEX.test(value),
|
|
245
|
-
time: (value) => TIME_REGEX.test(value),
|
|
246
|
-
ipv4: (value) => IPV4_REGEX.test(value),
|
|
247
|
-
ipv6: (value) => IPV6_REGEX.test(value)
|
|
248
|
-
};
|
|
249
|
-
function registerFormat(name, validator) {
|
|
250
|
-
FormatRegistry.Set(name, validator);
|
|
251
|
-
}
|
|
252
|
-
function registerAllFormats() {
|
|
253
|
-
for (const [name, validator] of Object.entries(FORMAT_VALIDATORS)) {
|
|
254
|
-
FormatRegistry.Set(name, validator);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
function isFormatRegistered(name) {
|
|
258
|
-
return FormatRegistry.Has(name);
|
|
259
|
-
}
|
|
260
|
-
function getFormatValidator(name) {
|
|
261
|
-
return FormatRegistry.Has(name) ? FormatRegistry.Get(name) : undefined;
|
|
262
|
-
}
|
|
263
|
-
function unregisterFormat(name) {
|
|
264
|
-
FormatRegistry.Delete(name);
|
|
265
|
-
}
|
|
266
|
-
// src/openapi.ts
|
|
267
|
-
import { Kind } from "@sinclair/typebox";
|
|
268
|
-
function typeboxToOpenApi(schema) {
|
|
269
|
-
const result = {};
|
|
270
|
-
if (schema.description) {
|
|
271
|
-
result.description = schema.description;
|
|
272
|
-
}
|
|
273
|
-
if (schema.default !== undefined) {
|
|
274
|
-
result.default = schema.default;
|
|
275
|
-
}
|
|
276
|
-
if (schema.examples && Array.isArray(schema.examples) && schema.examples.length > 0) {
|
|
277
|
-
result.example = schema.examples[0];
|
|
278
|
-
}
|
|
279
|
-
switch (schema[Kind]) {
|
|
280
|
-
case "String": {
|
|
281
|
-
const stringSchema = schema;
|
|
282
|
-
result.type = "string";
|
|
283
|
-
if (stringSchema.format) {
|
|
284
|
-
result.format = stringSchema.format;
|
|
285
|
-
}
|
|
286
|
-
if (stringSchema.minLength !== undefined) {
|
|
287
|
-
result.minLength = stringSchema.minLength;
|
|
288
|
-
}
|
|
289
|
-
if (stringSchema.maxLength !== undefined) {
|
|
290
|
-
result.maxLength = stringSchema.maxLength;
|
|
291
|
-
}
|
|
292
|
-
if (stringSchema.pattern) {
|
|
293
|
-
result.pattern = stringSchema.pattern;
|
|
294
|
-
}
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
case "Number":
|
|
298
|
-
case "Integer": {
|
|
299
|
-
const numberSchema = schema;
|
|
300
|
-
result.type = schema[Kind] === "Integer" ? "integer" : "number";
|
|
301
|
-
if (numberSchema.minimum !== undefined) {
|
|
302
|
-
result.minimum = numberSchema.minimum;
|
|
303
|
-
}
|
|
304
|
-
if (numberSchema.maximum !== undefined) {
|
|
305
|
-
result.maximum = numberSchema.maximum;
|
|
306
|
-
}
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
case "Boolean": {
|
|
310
|
-
result.type = "boolean";
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
case "Array": {
|
|
314
|
-
const arraySchema = schema;
|
|
315
|
-
result.type = "array";
|
|
316
|
-
if (arraySchema.items) {
|
|
317
|
-
result.items = typeboxToOpenApi(arraySchema.items);
|
|
318
|
-
}
|
|
319
|
-
if (arraySchema.minItems !== undefined) {
|
|
320
|
-
result.minItems = arraySchema.minItems;
|
|
321
|
-
}
|
|
322
|
-
if (arraySchema.maxItems !== undefined) {
|
|
323
|
-
result.maxItems = arraySchema.maxItems;
|
|
324
|
-
}
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
case "Object": {
|
|
328
|
-
const objectSchema = schema;
|
|
329
|
-
result.type = "object";
|
|
330
|
-
if (objectSchema.properties) {
|
|
331
|
-
result.properties = {};
|
|
332
|
-
const required = [];
|
|
333
|
-
for (const [key, value] of Object.entries(objectSchema.properties)) {
|
|
334
|
-
const optionalSymbol = Symbol.for("TypeBox.Optional");
|
|
335
|
-
const isOptional = value[optionalSymbol] === "Optional";
|
|
336
|
-
if (isOptional) {
|
|
337
|
-
result.properties[key] = typeboxToOpenApi(value);
|
|
338
|
-
} else {
|
|
339
|
-
result.properties[key] = typeboxToOpenApi(value);
|
|
340
|
-
required.push(key);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (required.length > 0) {
|
|
344
|
-
result.required = required;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (objectSchema.additionalProperties !== undefined) {
|
|
348
|
-
if (typeof objectSchema.additionalProperties === "boolean") {
|
|
349
|
-
result.additionalProperties = objectSchema.additionalProperties;
|
|
350
|
-
} else {
|
|
351
|
-
result.additionalProperties = typeboxToOpenApi(objectSchema.additionalProperties);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
case "Union": {
|
|
357
|
-
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
358
|
-
result.anyOf = schema.anyOf.map((s) => typeboxToOpenApi(s));
|
|
359
|
-
}
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
case "Intersect": {
|
|
363
|
-
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
364
|
-
result.allOf = schema.allOf.map((s) => typeboxToOpenApi(s));
|
|
365
|
-
}
|
|
366
|
-
break;
|
|
367
|
-
}
|
|
368
|
-
case "Literal": {
|
|
369
|
-
if (schema.const !== undefined) {
|
|
370
|
-
result.enum = [schema.const];
|
|
371
|
-
result.type = typeof schema.const;
|
|
372
|
-
}
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
case "Enum": {
|
|
376
|
-
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
377
|
-
result.enum = schema.anyOf.map((s) => s.const);
|
|
378
|
-
if (result.enum.length > 0) {
|
|
379
|
-
result.type = typeof result.enum[0];
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
break;
|
|
383
|
-
}
|
|
384
|
-
case "Null": {
|
|
385
|
-
result.type = "null";
|
|
386
|
-
break;
|
|
387
|
-
}
|
|
388
|
-
case "Optional": {
|
|
389
|
-
if (schema[Kind] === "Optional" && schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
390
|
-
const innerSchema = schema.anyOf[0];
|
|
391
|
-
return typeboxToOpenApi(innerSchema);
|
|
392
|
-
}
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
default: {
|
|
396
|
-
if (schema.type) {
|
|
397
|
-
result.type = schema.type;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return result;
|
|
402
|
-
}
|
|
403
|
-
function createAstralResource(options) {
|
|
404
|
-
const {
|
|
405
|
-
path,
|
|
406
|
-
method,
|
|
407
|
-
summary,
|
|
408
|
-
description,
|
|
409
|
-
tags,
|
|
410
|
-
requestSchema,
|
|
411
|
-
requestDescription,
|
|
412
|
-
requestRequired = true,
|
|
413
|
-
responseSchema,
|
|
414
|
-
responseDescription = "Successful response",
|
|
415
|
-
responseStatusCode = 200
|
|
416
|
-
} = options;
|
|
417
|
-
const resource = {
|
|
418
|
-
path,
|
|
419
|
-
method: method.toUpperCase(),
|
|
420
|
-
responses: {
|
|
421
|
-
[responseStatusCode]: {
|
|
422
|
-
description: responseDescription,
|
|
423
|
-
content: {
|
|
424
|
-
"application/json": {
|
|
425
|
-
schema: typeboxToOpenApi(responseSchema)
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
if (summary) {
|
|
432
|
-
resource.summary = summary;
|
|
433
|
-
}
|
|
434
|
-
if (description) {
|
|
435
|
-
resource.description = description;
|
|
436
|
-
}
|
|
437
|
-
if (tags && tags.length > 0) {
|
|
438
|
-
resource.tags = tags;
|
|
439
|
-
}
|
|
440
|
-
if (requestSchema && ["POST", "PUT", "PATCH"].includes(method.toUpperCase())) {
|
|
441
|
-
resource.requestBody = {
|
|
442
|
-
description: requestDescription,
|
|
443
|
-
required: requestRequired,
|
|
444
|
-
content: {
|
|
445
|
-
"application/json": {
|
|
446
|
-
schema: typeboxToOpenApi(requestSchema)
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
return resource;
|
|
452
|
-
}
|
|
453
|
-
function createCrudResources(options) {
|
|
454
|
-
const { resourceName, basePath, tags = [resourceName], schemas } = options;
|
|
455
|
-
const capitalizedName = resourceName.charAt(0).toUpperCase() + resourceName.slice(1);
|
|
456
|
-
return {
|
|
457
|
-
list: createAstralResource({
|
|
458
|
-
path: basePath,
|
|
459
|
-
method: "GET",
|
|
460
|
-
summary: `Get ${capitalizedName} List`,
|
|
461
|
-
tags,
|
|
462
|
-
responseSchema: schemas.list || schemas.item
|
|
463
|
-
}),
|
|
464
|
-
get: createAstralResource({
|
|
465
|
-
path: `${basePath}/:id`,
|
|
466
|
-
method: "GET",
|
|
467
|
-
summary: `Get Single ${capitalizedName}`,
|
|
468
|
-
tags,
|
|
469
|
-
responseSchema: schemas.item
|
|
470
|
-
}),
|
|
471
|
-
create: createAstralResource({
|
|
472
|
-
path: basePath,
|
|
473
|
-
method: "POST",
|
|
474
|
-
summary: `Create ${capitalizedName}`,
|
|
475
|
-
tags,
|
|
476
|
-
requestSchema: schemas.create,
|
|
477
|
-
responseSchema: schemas.item,
|
|
478
|
-
responseStatusCode: 201
|
|
479
|
-
}),
|
|
480
|
-
update: createAstralResource({
|
|
481
|
-
path: `${basePath}/:id`,
|
|
482
|
-
method: "PATCH",
|
|
483
|
-
summary: `Update ${capitalizedName}`,
|
|
484
|
-
tags,
|
|
485
|
-
requestSchema: schemas.update,
|
|
486
|
-
responseSchema: schemas.item
|
|
487
|
-
}),
|
|
488
|
-
delete: createAstralResource({
|
|
489
|
-
path: `${basePath}/:id`,
|
|
490
|
-
method: "DELETE",
|
|
491
|
-
summary: `Delete ${capitalizedName}`,
|
|
492
|
-
tags,
|
|
493
|
-
responseSchema: schemas.item
|
|
494
|
-
})
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
// src/utils.ts
|
|
498
|
-
import { Type as Type2 } from "@sinclair/typebox";
|
|
499
|
-
function partial(schema) {
|
|
500
|
-
return Type2.Partial(schema);
|
|
501
|
-
}
|
|
502
|
-
// src/validator.ts
|
|
503
|
-
import { tbValidator as tbValidator2 } from "@hono/typebox-validator";
|
|
504
|
-
function validate(source, schema, hook) {
|
|
505
|
-
return tbValidator2(source, schema, hook);
|
|
506
|
-
}
|
|
507
2
|
export {
|
|
508
|
-
tbValidator3 as validator,
|
|
509
3
|
validateWithCoercion,
|
|
510
4
|
validate,
|
|
511
5
|
unregisterFormat,
|
package/dist/openapi.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GravitoContext } from '@gravito/photon';
|
|
2
2
|
import type { Static, TSchema } from '@sinclair/typebox';
|
|
3
3
|
/**
|
|
4
4
|
* Supported data sources for validation.
|
|
@@ -43,11 +43,8 @@ export interface ValidationResult<T extends TSchema> {
|
|
|
43
43
|
* after validation but before the main route handler.
|
|
44
44
|
*
|
|
45
45
|
* @template T - The TypeBox schema type
|
|
46
|
-
* @template E - The Photon environment type
|
|
47
|
-
*
|
|
48
46
|
* @param result - The outcome of the validation
|
|
49
47
|
* @param context - The Photon request context
|
|
50
48
|
* @returns A Response object to short-circuit the request, or undefined to proceed
|
|
51
49
|
*/
|
|
52
|
-
export type ValidationHook<T extends TSchema
|
|
53
|
-
//# sourceMappingURL=types.d.ts.map
|
|
50
|
+
export type ValidationHook<T extends TSchema> = (result: ValidationResult<T>, context: GravitoContext) => Response | Promise<Response> | undefined;
|
package/dist/utils.d.ts
CHANGED
package/dist/validator.d.ts
CHANGED
|
@@ -1,47 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export type { ValidationError, ValidationHook, ValidationResult,
|
|
1
|
+
import type { GravitoContext, GravitoMiddleware } from '@gravito/core';
|
|
2
|
+
import type { TSchema } from '@sinclair/typebox';
|
|
3
|
+
export type { ValidationError, ValidationHook, ValidationResult, } from './types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Validation source types.
|
|
6
|
+
*/
|
|
7
|
+
export type ValidationSource = 'json' | 'form' | 'query' | 'param' | 'header' | 'cookie';
|
|
8
|
+
/**
|
|
9
|
+
* Validates request data using TypeBox schema.
|
|
6
10
|
*
|
|
7
|
-
* This middleware
|
|
8
|
-
* It
|
|
9
|
-
* for validated data in the request context.
|
|
11
|
+
* This middleware provides high-performance validation with full TypeScript
|
|
12
|
+
* support. It leverages @hono/typebox-validator for runtime validation.
|
|
10
13
|
*
|
|
11
14
|
* @param source - The request data source to validate (json, query, param, form)
|
|
12
15
|
* @param schema - The TypeBox schema defining the expected data structure
|
|
13
16
|
* @param hook - Optional callback to handle validation results manually
|
|
14
|
-
* @returns A
|
|
17
|
+
* @returns A Gravito middleware handler that enforces the schema
|
|
15
18
|
*
|
|
16
19
|
* @example Validating a JSON body
|
|
17
20
|
* ```typescript
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* name: Schema.String(),
|
|
21
|
-
* age: Schema.Number()
|
|
22
|
-
* })),
|
|
23
|
-
* (c) => {
|
|
24
|
-
* const user = c.req.valid('json')
|
|
25
|
-
* return c.json({ created: user.name })
|
|
26
|
-
* }
|
|
27
|
-
* )
|
|
28
|
-
* ```
|
|
21
|
+
* import { Type } from '@sinclair/typebox'
|
|
22
|
+
* import { validate } from '@gravito/mass'
|
|
29
23
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
24
|
+
* const schema = Type.Object({
|
|
25
|
+
* name: Type.String()
|
|
26
|
+
* })
|
|
27
|
+
*
|
|
28
|
+
* app.post('/users', validate('json', schema), (c) => {
|
|
29
|
+
* const data = c.req.valid('json')
|
|
30
|
+
* return c.json(data)
|
|
36
31
|
* })
|
|
37
32
|
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param source - The data source to validate (json, query, param, etc.)
|
|
35
|
+
* @param schema - TypeBox schema
|
|
36
|
+
* @param hook - Optional validation hook for custom error handling
|
|
37
|
+
* @returns Photon middleware handler
|
|
38
|
+
* @public
|
|
38
39
|
*/
|
|
39
|
-
export declare function validate<T extends TSchema
|
|
40
|
-
in: {
|
|
41
|
-
[K in S]: Static<T>;
|
|
42
|
-
};
|
|
43
|
-
out: {
|
|
44
|
-
[K in S]: Static<T>;
|
|
45
|
-
};
|
|
46
|
-
}>;
|
|
47
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
40
|
+
export declare function validate<T extends TSchema>(source: 'json' | 'query' | 'param' | 'form', schema: T, hook?: (result: unknown, c: GravitoContext) => Response | Promise<Response> | undefined): GravitoMiddleware;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/mass",
|
|
3
|
-
"
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "3.0.3",
|
|
4
5
|
"description": "TypeBox-based validation for Gravito - High-performance schema validation with full TypeScript support",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "./dist/index.js",
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "bun run build.ts",
|
|
20
|
+
"build:dts": "bun run build.ts --dts-only",
|
|
19
21
|
"typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
|
|
20
22
|
"test": "bun test --timeout=10000",
|
|
21
23
|
"prepublishOnly": "bun run build",
|
|
@@ -28,15 +30,15 @@
|
|
|
28
30
|
"access": "public"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@hono/typebox-validator": "^1.1.0",
|
|
32
33
|
"@sinclair/typebox": "^0.34.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
|
-
"@gravito/core": "^
|
|
36
|
+
"@gravito/core": "^2.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
39
|
+
"@gravito/core": "workspace:*",
|
|
38
40
|
"bun-types": "^1.1.0",
|
|
39
|
-
"@gravito/photon": "
|
|
41
|
+
"@gravito/photon": "workspace:*",
|
|
40
42
|
"typescript": "^5.9.3"
|
|
41
43
|
},
|
|
42
44
|
"author": "Carl Lee <carllee0520@gmail.com>",
|
package/dist/coercion.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../src/coercion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGrF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MA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GAAG,SAAS,CAEzF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnD"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAGH,OAAO,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGlE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,cAAc,EACnB,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,aAAa,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/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CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CACnE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAChB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA"}
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAEjE"}
|
package/dist/validator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD,YAAY,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,QAAQ,CACtB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,EAC7C,CAAC,SAAS,GAAG,GAAG,GAAG,EACnB,CAAC,SAAS,MAAM,GAAG,MAAM,EAEzB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,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