@shware/http 3.4.0 → 3.5.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/dist/cache/index.d.cts +1 -2
- package/dist/cache/index.d.cts.map +1 -1
- package/dist/cache/index.d.mts +1 -2
- package/dist/cache/index.d.mts.map +1 -1
- package/dist/error/detail.d.cts +14 -15
- package/dist/error/detail.d.cts.map +1 -1
- package/dist/error/detail.d.mts +14 -15
- package/dist/error/detail.d.mts.map +1 -1
- package/dist/error/i18n/en-us.d.cts +1 -2
- package/dist/error/i18n/en-us.d.cts.map +1 -1
- package/dist/error/i18n/en-us.d.mts +1 -2
- package/dist/error/i18n/en-us.d.mts.map +1 -1
- package/dist/error/index.d.cts +5 -6
- package/dist/error/index.d.cts.map +1 -1
- package/dist/error/index.d.mts +5 -6
- package/dist/error/index.d.mts.map +1 -1
- package/dist/error/parse.d.cts +4 -5
- package/dist/error/parse.d.cts.map +1 -1
- package/dist/error/parse.d.mts +4 -5
- package/dist/error/parse.d.mts.map +1 -1
- package/dist/error/reason.d.cts +2 -3
- package/dist/error/reason.d.cts.map +1 -1
- package/dist/error/reason.d.mts +2 -3
- package/dist/error/reason.d.mts.map +1 -1
- package/dist/error/status.d.cts +6 -7
- package/dist/error/status.d.cts.map +1 -1
- package/dist/error/status.d.mts +6 -7
- package/dist/error/status.d.mts.map +1 -1
- package/dist/google-one-tap/index.d.cts +8 -9
- package/dist/google-one-tap/index.d.cts.map +1 -1
- package/dist/google-one-tap/index.d.mts +8 -9
- package/dist/google-one-tap/index.d.mts.map +1 -1
- package/dist/google-one-tap/types.d.cts +6 -7
- package/dist/google-one-tap/types.d.cts.map +1 -1
- package/dist/google-one-tap/types.d.mts +6 -7
- package/dist/google-one-tap/types.d.mts.map +1 -1
- package/dist/hono/authorizer.d.cts +3 -4
- package/dist/hono/authorizer.d.cts.map +1 -1
- package/dist/hono/authorizer.d.mts +3 -4
- package/dist/hono/authorizer.d.mts.map +1 -1
- package/dist/hono/csrf.d.cts +3 -4
- package/dist/hono/csrf.d.cts.map +1 -1
- package/dist/hono/csrf.d.mts +3 -4
- package/dist/hono/csrf.d.mts.map +1 -1
- package/dist/hono/geolocation.d.cts +1 -2
- package/dist/hono/geolocation.d.cts.map +1 -1
- package/dist/hono/geolocation.d.mts +1 -2
- package/dist/hono/geolocation.d.mts.map +1 -1
- package/dist/hono/handler.d.cts +4 -5
- package/dist/hono/handler.d.cts.map +1 -1
- package/dist/hono/handler.d.mts +4 -5
- package/dist/hono/handler.d.mts.map +1 -1
- package/dist/hono/index.cjs +1 -0
- package/dist/hono/index.d.cts +2 -2
- package/dist/hono/index.d.mts +2 -2
- package/dist/hono/index.mjs +2 -2
- package/dist/hono/rate-limit.d.cts +5 -6
- package/dist/hono/rate-limit.d.cts.map +1 -1
- package/dist/hono/rate-limit.d.mts +5 -6
- package/dist/hono/rate-limit.d.mts.map +1 -1
- package/dist/hono/validator.cjs +40 -14
- package/dist/hono/validator.cjs.map +1 -1
- package/dist/hono/validator.d.cts +34 -17
- package/dist/hono/validator.d.cts.map +1 -1
- package/dist/hono/validator.d.mts +34 -17
- package/dist/hono/validator.d.mts.map +1 -1
- package/dist/hono/validator.mjs +40 -15
- package/dist/hono/validator.mjs.map +1 -1
- package/dist/iso/iso-3601-1.d.cts +2 -3
- package/dist/iso/iso-3601-1.d.cts.map +1 -1
- package/dist/iso/iso-3601-1.d.mts +2 -3
- package/dist/iso/iso-3601-1.d.mts.map +1 -1
- package/dist/max-length/index.d.cts +23 -23
- package/dist/max-length/index.d.cts.map +1 -1
- package/dist/max-length/index.d.mts +23 -23
- package/dist/max-length/index.d.mts.map +1 -1
- package/dist/message.d.cts +1 -2
- package/dist/message.d.cts.map +1 -1
- package/dist/message.d.mts +1 -2
- package/dist/message.d.mts.map +1 -1
- package/dist/response.d.cts +18 -19
- package/dist/response.d.cts.map +1 -1
- package/dist/response.d.mts +18 -19
- package/dist/response.d.mts.map +1 -1
- package/dist/snowflake.d.cts +2 -3
- package/dist/snowflake.d.cts.map +1 -1
- package/dist/snowflake.d.mts +2 -3
- package/dist/snowflake.d.mts.map +1 -1
- package/dist/utils/geolocation.d.cts +5 -6
- package/dist/utils/geolocation.d.cts.map +1 -1
- package/dist/utils/geolocation.d.mts +5 -6
- package/dist/utils/geolocation.d.mts.map +1 -1
- package/dist/utils/google-tag-gateway.d.cts +1 -2
- package/dist/utils/google-tag-gateway.d.cts.map +1 -1
- package/dist/utils/google-tag-gateway.d.mts +1 -2
- package/dist/utils/google-tag-gateway.d.mts.map +1 -1
- package/dist/utils/timing.d.cts +2 -3
- package/dist/utils/timing.d.cts.map +1 -1
- package/dist/utils/timing.d.mts +2 -3
- package/dist/utils/timing.d.mts.map +1 -1
- package/dist/webhook/index.d.cts +1 -2
- package/dist/webhook/index.d.cts.map +1 -1
- package/dist/webhook/index.d.mts +1 -2
- package/dist/webhook/index.d.mts.map +1 -1
- package/package.json +9 -9
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
import { ValidationTargets } from "hono";
|
|
2
|
-
import { ZodType
|
|
2
|
+
import { ZodType } from "zod";
|
|
3
3
|
import { ZodMiniType } from "zod/mini";
|
|
4
4
|
//#region src/hono/validator.d.ts
|
|
5
|
-
declare function zValidator<S extends ZodType | ZodMiniType>(target: keyof ValidationTargets, schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
5
|
+
export declare function zValidator<S extends ZodType | ZodMiniType>(target: keyof ValidationTargets, schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
6
6
|
in: {
|
|
7
|
-
cookie: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
8
|
-
form: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
9
|
-
header: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
10
|
-
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
11
|
-
param: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
12
|
-
query: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
7
|
+
cookie: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "cookie", import("hono/types").FormValue>;
|
|
8
|
+
form: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "form", import("hono/types").FormValue>;
|
|
9
|
+
header: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "header", import("hono/types").FormValue>;
|
|
10
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_1) ? T_1 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_1 extends Response | import("hono").TypedResponse<any, any, any> ? never : T_1 : never : never;
|
|
11
|
+
param: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "param", import("hono/types").FormValue>;
|
|
12
|
+
query: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "query", import("hono/types").FormValue>;
|
|
13
13
|
};
|
|
14
14
|
out: {
|
|
15
|
-
cookie: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
16
|
-
form: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
17
|
-
header: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
18
|
-
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
19
|
-
param: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
20
|
-
query: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
15
|
+
cookie: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
16
|
+
form: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
17
|
+
header: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
18
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
19
|
+
param: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
20
|
+
query: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
21
21
|
};
|
|
22
|
-
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
23
|
-
|
|
22
|
+
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_2) ? T_2 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_2 extends import("hono").TypedResponse<infer T_3, infer S_1 extends import("hono/utils/http-status").StatusCode, infer F extends string> ? import("hono").TypedResponse<T_3, S_1, F> : T_2 extends Response ? T_2 : T_2 extends undefined ? never : never : never : never>;
|
|
23
|
+
/**
|
|
24
|
+
* A JSON body that may also arrive as `text/plain`, validated as `json`: what a browser sends with
|
|
25
|
+
* `navigator.sendBeacon` to stay a CORS simple request. As `application/json` a cross-origin
|
|
26
|
+
* beacon needs a preflight, which a page being closed often cannot complete, and the beacon is
|
|
27
|
+
* then dropped — exactly the one sent as the visitor leaves. Hono's `json` target reads any
|
|
28
|
+
* content type but JSON as `{}`, so the text is parsed here. Anything else is read as before.
|
|
29
|
+
*
|
|
30
|
+
* Use it on the routes a beacon is sent to, and only there: it widens what a cross-site page can
|
|
31
|
+
* post without a preflight, which is harmless for an endpoint that takes no credentials.
|
|
32
|
+
*/
|
|
33
|
+
export declare function zBeaconJson<S extends ZodType | ZodMiniType>(schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
34
|
+
in: {
|
|
35
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
36
|
+
};
|
|
37
|
+
out: {
|
|
38
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_1) ? T_1 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_1 extends Response | import("hono").TypedResponse<any, any, any> ? never : T_1 : never : never;
|
|
39
|
+
};
|
|
40
|
+
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_2) ? T_2 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_2 extends import("hono").TypedResponse<infer T_3, infer S_1 extends import("hono/utils/http-status").StatusCode, infer F extends string> ? import("hono").TypedResponse<T_3, S_1, F> : T_2 extends Response ? T_2 : T_2 extends undefined ? never : never : never : never>;
|
|
41
|
+
export declare const bigintId: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<bigint, string>>;
|
|
24
42
|
//#endregion
|
|
25
|
-
export { bigintId, zValidator };
|
|
26
43
|
//# sourceMappingURL=validator.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.cts","names":[],"sources":["../../src/hono/validator.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"validator.d.cts","names":[],"sources":["../../src/hono/validator.ts"],"mappings":";;;;wBA+BgB,WAAW,UAAU,UAAU,aAC7C,cAAc,mBACd,QAAQ,mBAAC;;;;;;;;;;;;;;;;;IAGV,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,mBAAA,OAAA,aAAA,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,MAAA,2BAAA,oBAAA,WAAA,6CAAA,kBAAA,mCAAA,cAAA,KAAA,KAAA,KAAA,YAAA,WAAA,MAAA;;;;;;;;;;;wBAce,YAAY,UAAU,UAAU,aAAa,QAAQ,mBAAC;;;;;;;IAWrE,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,mBAAA,OAAA,aAAA,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,MAAA,2BAAA,oBAAA,WAAA,6CAAA,kBAAA,mCAAA,cAAA,KAAA,KAAA,KAAA,YAAA,WAAA,MAAA;qBAEY,6BAAQ,+BAAA,0CAAA"}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
import { ZodMiniType } from "zod/mini";
|
|
2
2
|
import { ValidationTargets } from "hono";
|
|
3
|
-
import { ZodType
|
|
3
|
+
import { ZodType } from "zod";
|
|
4
4
|
//#region src/hono/validator.d.ts
|
|
5
|
-
declare function zValidator<S extends ZodType | ZodMiniType>(target: keyof ValidationTargets, schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
5
|
+
export declare function zValidator<S extends ZodType | ZodMiniType>(target: keyof ValidationTargets, schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
6
6
|
in: {
|
|
7
|
-
cookie: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
8
|
-
form: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
9
|
-
header: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
10
|
-
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
11
|
-
param: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
12
|
-
query: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
7
|
+
cookie: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "cookie", import("hono/types").FormValue>;
|
|
8
|
+
form: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "form", import("hono/types").FormValue>;
|
|
9
|
+
header: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "header", import("hono/types").FormValue>;
|
|
10
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_1) ? T_1 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_1 extends Response | import("hono").TypedResponse<any, any, any> ? never : T_1 : never : never;
|
|
11
|
+
param: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "param", import("hono/types").FormValue>;
|
|
12
|
+
query: import("hono/validator").InferInput<(S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never, "query", import("hono/types").FormValue>;
|
|
13
13
|
};
|
|
14
14
|
out: {
|
|
15
|
-
cookie: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
16
|
-
form: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
17
|
-
header: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
18
|
-
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
19
|
-
param: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
20
|
-
query: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
15
|
+
cookie: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
16
|
+
form: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
17
|
+
header: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
18
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
19
|
+
param: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
20
|
+
query: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
21
21
|
};
|
|
22
|
-
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ?
|
|
23
|
-
|
|
22
|
+
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_2) ? T_2 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_2 extends import("hono").TypedResponse<infer T_3, infer S_1 extends import("hono/utils/http-status").StatusCode, infer F extends string> ? import("hono").TypedResponse<T_3, S_1, F> : T_2 extends Response ? T_2 : T_2 extends undefined ? never : never : never : never>;
|
|
23
|
+
/**
|
|
24
|
+
* A JSON body that may also arrive as `text/plain`, validated as `json`: what a browser sends with
|
|
25
|
+
* `navigator.sendBeacon` to stay a CORS simple request. As `application/json` a cross-origin
|
|
26
|
+
* beacon needs a preflight, which a page being closed often cannot complete, and the beacon is
|
|
27
|
+
* then dropped — exactly the one sent as the visitor leaves. Hono's `json` target reads any
|
|
28
|
+
* content type but JSON as `{}`, so the text is parsed here. Anything else is read as before.
|
|
29
|
+
*
|
|
30
|
+
* Use it on the routes a beacon is sent to, and only there: it widens what a cross-site page can
|
|
31
|
+
* post without a preflight, which is harmless for an endpoint that takes no credentials.
|
|
32
|
+
*/
|
|
33
|
+
export declare function zBeaconJson<S extends ZodType | ZodMiniType>(schema: S): import("hono").MiddlewareHandler<any, string, {
|
|
34
|
+
in: {
|
|
35
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T) ? T extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T extends Response | import("hono").TypedResponse<any, any, any> ? never : T : never : never;
|
|
36
|
+
};
|
|
37
|
+
out: {
|
|
38
|
+
json: (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_1) ? T_1 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_1 extends Response | import("hono").TypedResponse<any, any, any> ? never : T_1 : never : never;
|
|
39
|
+
};
|
|
40
|
+
}, (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) extends (infer T_2) ? T_2 extends (S extends ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<S> : import("zod").infer<S>) ? T_2 extends import("hono").TypedResponse<infer T_3, infer S_1 extends import("hono/utils/http-status").StatusCode, infer F extends string> ? import("hono").TypedResponse<T_3, S_1, F> : T_2 extends Response ? T_2 : T_2 extends undefined ? never : never : never : never>;
|
|
41
|
+
export declare const bigintId: import("zod/mini").ZodMiniPipe<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniTransform<bigint, string>>;
|
|
24
42
|
//#endregion
|
|
25
|
-
export { bigintId, zValidator };
|
|
26
43
|
//# sourceMappingURL=validator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.mts","names":[],"sources":["../../src/hono/validator.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"validator.d.mts","names":[],"sources":["../../src/hono/validator.ts"],"mappings":";;;;wBA+BgB,WAAW,UAAU,UAAU,aAC7C,cAAc,mBACd,QAAQ,mBAAC;;;;;;;;;;;;;;;;;IAGV,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,mBAAA,OAAA,aAAA,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,MAAA,2BAAA,oBAAA,WAAA,6CAAA,kBAAA,mCAAA,cAAA,KAAA,KAAA,KAAA,YAAA,WAAA,MAAA;;;;;;;;;;;wBAce,YAAY,UAAU,UAAU,aAAa,QAAQ,mBAAC;;;;;;;IAWrE,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,mBAAA,OAAA,aAAA,UAAA,gDAAA,qDAAA,MAAA,mBAAA,MAAA,MAAA,2BAAA,oBAAA,WAAA,6CAAA,kBAAA,mCAAA,cAAA,KAAA,KAAA,KAAA,YAAA,WAAA,MAAA;qBAEY,6BAAQ,+BAAA,0CAAA"}
|
package/dist/hono/validator.mjs
CHANGED
|
@@ -3,21 +3,46 @@ import { Status } from "../error/status.mjs";
|
|
|
3
3
|
import { NEVER, pipe, string, transform } from "zod/mini";
|
|
4
4
|
import { validator } from "hono/validator";
|
|
5
5
|
//#region src/hono/validator.ts
|
|
6
|
+
/** Validates with the schema; a violation is an `INVALID_ARGUMENT` listing every field. */
|
|
7
|
+
async function check(schema, value) {
|
|
8
|
+
const result = await schema.safeParseAsync(value);
|
|
9
|
+
if (result.success) return result.data;
|
|
10
|
+
const fieldViolations = result.error.issues.map(({ code, path, message }) => ({
|
|
11
|
+
field: path.join("."),
|
|
12
|
+
description: message,
|
|
13
|
+
reason: code.toUpperCase(),
|
|
14
|
+
localizedMessage: {
|
|
15
|
+
locale: "en-US",
|
|
16
|
+
message
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
const details = Details.new().badRequest({ fieldViolations });
|
|
20
|
+
throw Status.invalidArgument().error(details);
|
|
21
|
+
}
|
|
6
22
|
function zValidator(target, schema) {
|
|
7
|
-
return validator(target,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
return validator(target, (value) => check(schema, value));
|
|
24
|
+
}
|
|
25
|
+
const TEXT_PLAIN = /^text\/plain\b/i;
|
|
26
|
+
/**
|
|
27
|
+
* A JSON body that may also arrive as `text/plain`, validated as `json`: what a browser sends with
|
|
28
|
+
* `navigator.sendBeacon` to stay a CORS simple request. As `application/json` a cross-origin
|
|
29
|
+
* beacon needs a preflight, which a page being closed often cannot complete, and the beacon is
|
|
30
|
+
* then dropped — exactly the one sent as the visitor leaves. Hono's `json` target reads any
|
|
31
|
+
* content type but JSON as `{}`, so the text is parsed here. Anything else is read as before.
|
|
32
|
+
*
|
|
33
|
+
* Use it on the routes a beacon is sent to, and only there: it widens what a cross-site page can
|
|
34
|
+
* post without a preflight, which is harmless for an endpoint that takes no credentials.
|
|
35
|
+
*/
|
|
36
|
+
function zBeaconJson(schema) {
|
|
37
|
+
return validator("json", async (value, c) => {
|
|
38
|
+
if (!TEXT_PLAIN.test(c.req.header("Content-Type") ?? "")) return check(schema, value);
|
|
39
|
+
let body;
|
|
40
|
+
try {
|
|
41
|
+
body = JSON.parse(await c.req.text());
|
|
42
|
+
} catch {
|
|
43
|
+
throw Status.invalidArgument("Malformed JSON in request body").error();
|
|
44
|
+
}
|
|
45
|
+
return check(schema, body);
|
|
21
46
|
});
|
|
22
47
|
}
|
|
23
48
|
const bigintId = pipe(string(), transform((input, ctx) => {
|
|
@@ -43,6 +68,6 @@ const bigintId = pipe(string(), transform((input, ctx) => {
|
|
|
43
68
|
}
|
|
44
69
|
}));
|
|
45
70
|
//#endregion
|
|
46
|
-
export { bigintId, zValidator };
|
|
71
|
+
export { bigintId, zBeaconJson, zValidator };
|
|
47
72
|
|
|
48
73
|
//# sourceMappingURL=validator.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.mjs","names":[],"sources":["../../src/hono/validator.ts"],"sourcesContent":["import type { ValidationTargets } from 'hono';\nimport { validator } from 'hono/validator';\nimport type { ZodType, output as outputV4 } from 'zod';\nimport {\n NEVER,\n type ZodMiniType,\n type output as outputMini,\n pipe,\n string,\n transform,\n} from 'zod/mini';\nimport { type BadRequest, Details } from '../error/detail';\nimport { Status } from '../error/status';\n\
|
|
1
|
+
{"version":3,"file":"validator.mjs","names":[],"sources":["../../src/hono/validator.ts"],"sourcesContent":["import type { ValidationTargets } from 'hono';\nimport { validator } from 'hono/validator';\nimport type { ZodType, output as outputV4 } from 'zod';\nimport {\n NEVER,\n type ZodMiniType,\n type output as outputMini,\n pipe,\n string,\n transform,\n} from 'zod/mini';\nimport { type BadRequest, Details } from '../error/detail';\nimport { Status } from '../error/status';\n\n/** Validates with the schema; a violation is an `INVALID_ARGUMENT` listing every field. */\nasync function check<S extends ZodType | ZodMiniType>(schema: S, value: unknown) {\n const result = await schema.safeParseAsync(value);\n if (result.success) return result.data as S extends ZodType ? outputV4<S> : outputMini<S>;\n\n const fieldViolations: BadRequest['fieldViolations'] = result.error.issues.map(\n ({ code, path, message }) => ({\n field: path.join('.'),\n description: message,\n reason: code.toUpperCase(),\n localizedMessage: { locale: 'en-US', message },\n })\n );\n const details = Details.new().badRequest({ fieldViolations });\n throw Status.invalidArgument().error(details);\n}\n\nexport function zValidator<S extends ZodType | ZodMiniType>(\n target: keyof ValidationTargets,\n schema: S\n) {\n return validator(target, (value) => check(schema, value));\n}\n\nconst TEXT_PLAIN = /^text\\/plain\\b/i;\n\n/**\n * A JSON body that may also arrive as `text/plain`, validated as `json`: what a browser sends with\n * `navigator.sendBeacon` to stay a CORS simple request. As `application/json` a cross-origin\n * beacon needs a preflight, which a page being closed often cannot complete, and the beacon is\n * then dropped — exactly the one sent as the visitor leaves. Hono's `json` target reads any\n * content type but JSON as `{}`, so the text is parsed here. Anything else is read as before.\n *\n * Use it on the routes a beacon is sent to, and only there: it widens what a cross-site page can\n * post without a preflight, which is harmless for an endpoint that takes no credentials.\n */\nexport function zBeaconJson<S extends ZodType | ZodMiniType>(schema: S) {\n return validator('json', async (value, c) => {\n if (!TEXT_PLAIN.test(c.req.header('Content-Type') ?? '')) return check(schema, value);\n let body: unknown;\n try {\n body = JSON.parse(await c.req.text());\n } catch {\n throw Status.invalidArgument('Malformed JSON in request body').error();\n }\n return check(schema, body);\n });\n}\n\nexport const bigintId = pipe(\n string(),\n transform((input, ctx) => {\n if (!/^(0|[1-9]\\d{0,19})$/.test(input)) {\n const message = `Invalid bigint id: ${input}`;\n ctx.issues.push({ code: 'custom', input, message });\n return NEVER;\n }\n try {\n return BigInt(input);\n } catch {\n const message = `Parse bigint id: ${input} failed`;\n ctx.issues.push({ code: 'custom', input, message });\n return NEVER;\n }\n })\n);\n"],"mappings":";;;;;;AAeA,eAAe,MAAuC,QAAW,OAAgB;CAC/E,MAAM,SAAS,MAAM,OAAO,eAAe,KAAK;CAChD,IAAI,OAAO,SAAS,OAAO,OAAO;CAElC,MAAM,kBAAiD,OAAO,MAAM,OAAO,KACxE,EAAE,MAAM,MAAM,eAAe;EAC5B,OAAO,KAAK,KAAK,GAAG;EACpB,aAAa;EACb,QAAQ,KAAK,YAAY;EACzB,kBAAkB;GAAE,QAAQ;GAAS;EAAQ;CAC/C,EACF;CACA,MAAM,UAAU,QAAQ,IAAI,CAAC,CAAC,WAAW,EAAE,gBAAgB,CAAC;CAC5D,MAAM,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO;AAC9C;AAEA,SAAgB,WACd,QACA,QACA;CACA,OAAO,UAAU,SAAS,UAAU,MAAM,QAAQ,KAAK,CAAC;AAC1D;AAEA,MAAM,aAAa;;;;;;;;;;;AAYnB,SAAgB,YAA6C,QAAW;CACtE,OAAO,UAAU,QAAQ,OAAO,OAAO,MAAM;EAC3C,IAAI,CAAC,WAAW,KAAK,EAAE,IAAI,OAAO,cAAc,KAAK,EAAE,GAAG,OAAO,MAAM,QAAQ,KAAK;EACpF,IAAI;EACJ,IAAI;GACF,OAAO,KAAK,MAAM,MAAM,EAAE,IAAI,KAAK,CAAC;EACtC,QAAQ;GACN,MAAM,OAAO,gBAAgB,gCAAgC,CAAC,CAAC,MAAM;EACvE;EACA,OAAO,MAAM,QAAQ,IAAI;CAC3B,CAAC;AACH;AAEA,MAAa,WAAW,KACtB,OAAO,GACP,WAAW,OAAO,QAAQ;CACxB,IAAI,CAAC,sBAAsB,KAAK,KAAK,GAAG;EACtC,MAAM,UAAU,sBAAsB;EACtC,IAAI,OAAO,KAAK;GAAE,MAAM;GAAU;GAAO;EAAQ,CAAC;EAClD,OAAO;CACT;CACA,IAAI;EACF,OAAO,OAAO,KAAK;CACrB,QAAQ;EACN,MAAM,UAAU,oBAAoB,MAAM;EAC1C,IAAI,OAAO,KAAK;GAAE,MAAM;GAAU;GAAO;EAAQ,CAAC;EAClD,OAAO;CACT;AACF,CAAC,CACH"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
//#region src/iso/iso-3601-1.d.ts
|
|
2
|
-
type ISO3166CountryCode = {
|
|
2
|
+
export type ISO3166CountryCode = {
|
|
3
3
|
numeric: number;
|
|
4
4
|
name: string;
|
|
5
5
|
alpha2: string;
|
|
6
6
|
alpha3: string;
|
|
7
7
|
};
|
|
8
|
-
declare const ISO_3601_1: ISO3166CountryCode[];
|
|
8
|
+
export declare const ISO_3601_1: ISO3166CountryCode[];
|
|
9
9
|
//#endregion
|
|
10
|
-
export { ISO3166CountryCode, ISO_3601_1 };
|
|
11
10
|
//# sourceMappingURL=iso-3601-1.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iso-3601-1.d.cts","names":[],"sources":["../../src/iso/iso-3601-1.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"iso-3601-1.d.cts","names":[],"sources":["../../src/iso/iso-3601-1.ts"],"mappings":";YAAY;EACV;EACA;EACA;EACA;;qBAGW,YAAY"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
//#region src/iso/iso-3601-1.d.ts
|
|
2
|
-
type ISO3166CountryCode = {
|
|
2
|
+
export type ISO3166CountryCode = {
|
|
3
3
|
numeric: number;
|
|
4
4
|
name: string;
|
|
5
5
|
alpha2: string;
|
|
6
6
|
alpha3: string;
|
|
7
7
|
};
|
|
8
|
-
declare const ISO_3601_1: ISO3166CountryCode[];
|
|
8
|
+
export declare const ISO_3601_1: ISO3166CountryCode[];
|
|
9
9
|
//#endregion
|
|
10
|
-
export { ISO3166CountryCode, ISO_3601_1 };
|
|
11
10
|
//# sourceMappingURL=iso-3601-1.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iso-3601-1.d.mts","names":[],"sources":["../../src/iso/iso-3601-1.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"iso-3601-1.d.mts","names":[],"sources":["../../src/iso/iso-3601-1.ts"],"mappings":";YAAY;EACV;EACA;EACA;EACA;;qBAGW,YAAY"}
|
|
@@ -5,71 +5,71 @@ declare namespace index_d_exports {
|
|
|
5
5
|
* A Universally Unique Identifier (UUID) is a 36-character alphanumeric string that's typically represented in the following format:
|
|
6
6
|
* - Format: 8-4-4-4-12
|
|
7
7
|
* */
|
|
8
|
-
declare const UUID = 36;
|
|
8
|
+
export declare const UUID = 36;
|
|
9
9
|
/**
|
|
10
10
|
* The length of an Apple device's unique device identifier (UDID) depends on the model of the device:
|
|
11
11
|
* - iPhone X and earlier: The UDID is a 40-character alphanumeric string
|
|
12
12
|
* - iPhone XS and later: The UDID is a 24-character string with a dash after the 8th digit
|
|
13
13
|
* */
|
|
14
|
-
declare const UDID = 40;
|
|
14
|
+
export declare const UDID = 40;
|
|
15
15
|
/**
|
|
16
16
|
* Apple's Identifier for Vendors (IDFV).
|
|
17
17
|
* - `var identifierForVendor: UUID? { get }` An alphanumeric string that uniquely identifies a device to the app’s vendor.
|
|
18
18
|
* - Reference: [identifierForVendor](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)
|
|
19
19
|
* */
|
|
20
|
-
declare const IDFV = 36;
|
|
20
|
+
export declare const IDFV = 36;
|
|
21
21
|
/**
|
|
22
22
|
* Apple's Identifier for Advertisers (IDFA).
|
|
23
23
|
* - `var advertisingIdentifier: UUID { get }` The UUID that is specific to a device.
|
|
24
24
|
* - Reference: [advertisingIdentifier](https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier)
|
|
25
25
|
* */
|
|
26
|
-
declare const IDFA = 36;
|
|
26
|
+
export declare const IDFA = 36;
|
|
27
27
|
/**
|
|
28
28
|
* Android Device ID
|
|
29
29
|
* - 64-bit number (expressed as a hexadecimal string)
|
|
30
30
|
* - Reference: [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
31
31
|
* */
|
|
32
|
-
declare const ANDROID_ID = 16;
|
|
32
|
+
export declare const ANDROID_ID = 16;
|
|
33
33
|
/**
|
|
34
34
|
* - Web Device ID: UUID v4
|
|
35
35
|
* - iOS Device ID: IDFV
|
|
36
36
|
* - Android Device ID: ANDROID_ID
|
|
37
37
|
* */
|
|
38
|
-
declare const DEVICE_ID: number;
|
|
38
|
+
export declare const DEVICE_ID: number;
|
|
39
39
|
/**
|
|
40
40
|
* - The advertising ID is represented using version 3 of the universally unique identifier (UUID) format or an equivalent 128-bit format.
|
|
41
41
|
* - If this permission is not declared, the returned value will be 00000000-0000-0000-0000-000000000000 starting early 2022.
|
|
42
42
|
* - Reference: [AD_ID](https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#public-string-getid)
|
|
43
43
|
* */
|
|
44
|
-
declare const AAID = 36;
|
|
44
|
+
export declare const AAID = 36;
|
|
45
45
|
/**
|
|
46
46
|
* - Web: UUID
|
|
47
47
|
* - iOS: IDFA
|
|
48
48
|
* - Android: AAID
|
|
49
49
|
* */
|
|
50
|
-
declare const ADVERTISING_ID: number;
|
|
50
|
+
export declare const ADVERTISING_ID: number;
|
|
51
51
|
/**
|
|
52
52
|
* - An IPv4 address is at most 4 sets of 3 numbers (12 characters), each set separated by a dot (.). That makes 15 characters.
|
|
53
53
|
* - An IPv6 address, at its longest, would be 8 sets of 4 characters (32 total), each set separated by a colon. That makes 39 characters.
|
|
54
54
|
* */
|
|
55
|
-
declare const IPv4 = 15;
|
|
56
|
-
declare const IPv6 = 39;
|
|
57
|
-
declare const IPv4_MAPPED_IPv6 = 45;
|
|
58
|
-
declare const IP: number;
|
|
55
|
+
export declare const IPv4 = 15;
|
|
56
|
+
export declare const IPv6 = 39;
|
|
57
|
+
export declare const IPv4_MAPPED_IPv6 = 45;
|
|
58
|
+
export declare const IP: number;
|
|
59
59
|
/**
|
|
60
60
|
* - The longest string in the database is America/Argentina/ComodRivadavia. It's 32 characters long.
|
|
61
61
|
* - The mysql.time_zone_name table has a Name column defined with 64 characters.
|
|
62
62
|
* - It makes sense to use VARCHAR(64) for storing this information.
|
|
63
63
|
* - Reference: [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
|
64
64
|
* */
|
|
65
|
-
declare const TIMEZONE_LONGEST: number;
|
|
66
|
-
declare const TIMEZONE: number;
|
|
65
|
+
export declare const TIMEZONE_LONGEST: number;
|
|
66
|
+
export declare const TIMEZONE: number;
|
|
67
67
|
/**
|
|
68
68
|
* Reference: [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
|
|
69
69
|
* */
|
|
70
|
-
declare const COUNTRY_CODE_ALPHA_2 = 2;
|
|
71
|
-
declare const COUNTRY_CODE_ALPHA_3 = 3;
|
|
72
|
-
declare const COUNTRY_CODE: number;
|
|
70
|
+
export declare const COUNTRY_CODE_ALPHA_2 = 2;
|
|
71
|
+
export declare const COUNTRY_CODE_ALPHA_3 = 3;
|
|
72
|
+
export declare const COUNTRY_CODE: number;
|
|
73
73
|
/**
|
|
74
74
|
* Reference: [RFC5646 Tags for Identifying Languages](https://www.rfc-editor.org/rfc/rfc5646#section-4.4.1)
|
|
75
75
|
* The following illustration shows how the 35-character recommendation was derived:
|
|
@@ -87,7 +87,7 @@ declare const COUNTRY_CODE: number;
|
|
|
87
87
|
* total = 35 characters
|
|
88
88
|
* ```
|
|
89
89
|
* */
|
|
90
|
-
declare const LANGUAGE_CODE = 35;
|
|
90
|
+
export declare const LANGUAGE_CODE = 35;
|
|
91
91
|
/**
|
|
92
92
|
* Mailbox = Local-part "@" ( Domain / address-literal )
|
|
93
93
|
* - Local-part: The maximum total length of a user name or other local-part is 64 octets.
|
|
@@ -95,16 +95,16 @@ declare const LANGUAGE_CODE = 35;
|
|
|
95
95
|
* - Maximum length of an email address: 64 + 1 + 255 = 320
|
|
96
96
|
* - Reference: [Simple Mail Transfer Protocol - Size Limits and Minimums](https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1)
|
|
97
97
|
* */
|
|
98
|
-
declare const EMAIL_LOCAL_PART = 64;
|
|
99
|
-
declare const EMAIL_DOMAIN = 255;
|
|
100
|
-
declare const EMAIL: number;
|
|
98
|
+
export declare const EMAIL_LOCAL_PART = 64;
|
|
99
|
+
export declare const EMAIL_DOMAIN = 255;
|
|
100
|
+
export declare const EMAIL: number;
|
|
101
101
|
/**
|
|
102
102
|
* Reference: [E.164](https://en.wikipedia.org/wiki/E.164)
|
|
103
103
|
* */
|
|
104
|
-
declare const PHONE_NUMBER = 15;
|
|
104
|
+
export declare const PHONE_NUMBER = 15;
|
|
105
105
|
/**
|
|
106
106
|
* Reference: [How big can a user agent string get?](https://stackoverflow.com/questions/654921/how-big-can-a-user-agent-string-get)
|
|
107
107
|
* */
|
|
108
108
|
//#endregion
|
|
109
|
-
export {
|
|
109
|
+
export { index_d_exports };
|
|
110
110
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/max-length/index.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/max-length/index.ts"],"mappings":";;;;;;;qBAMa;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;qBAMA;qBACA;qBACA;qBACA;;;;;;;qBAQA;qBACA;;;;qBAKA;qBACA;qBACA;;;;;;;;;;;;;;;;;;qBAmBA;;;;;;;;qBASA;qBACA;qBACA;;;;qBAKA"}
|
|
@@ -5,71 +5,71 @@ declare namespace index_d_exports {
|
|
|
5
5
|
* A Universally Unique Identifier (UUID) is a 36-character alphanumeric string that's typically represented in the following format:
|
|
6
6
|
* - Format: 8-4-4-4-12
|
|
7
7
|
* */
|
|
8
|
-
declare const UUID = 36;
|
|
8
|
+
export declare const UUID = 36;
|
|
9
9
|
/**
|
|
10
10
|
* The length of an Apple device's unique device identifier (UDID) depends on the model of the device:
|
|
11
11
|
* - iPhone X and earlier: The UDID is a 40-character alphanumeric string
|
|
12
12
|
* - iPhone XS and later: The UDID is a 24-character string with a dash after the 8th digit
|
|
13
13
|
* */
|
|
14
|
-
declare const UDID = 40;
|
|
14
|
+
export declare const UDID = 40;
|
|
15
15
|
/**
|
|
16
16
|
* Apple's Identifier for Vendors (IDFV).
|
|
17
17
|
* - `var identifierForVendor: UUID? { get }` An alphanumeric string that uniquely identifies a device to the app’s vendor.
|
|
18
18
|
* - Reference: [identifierForVendor](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)
|
|
19
19
|
* */
|
|
20
|
-
declare const IDFV = 36;
|
|
20
|
+
export declare const IDFV = 36;
|
|
21
21
|
/**
|
|
22
22
|
* Apple's Identifier for Advertisers (IDFA).
|
|
23
23
|
* - `var advertisingIdentifier: UUID { get }` The UUID that is specific to a device.
|
|
24
24
|
* - Reference: [advertisingIdentifier](https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier)
|
|
25
25
|
* */
|
|
26
|
-
declare const IDFA = 36;
|
|
26
|
+
export declare const IDFA = 36;
|
|
27
27
|
/**
|
|
28
28
|
* Android Device ID
|
|
29
29
|
* - 64-bit number (expressed as a hexadecimal string)
|
|
30
30
|
* - Reference: [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
31
31
|
* */
|
|
32
|
-
declare const ANDROID_ID = 16;
|
|
32
|
+
export declare const ANDROID_ID = 16;
|
|
33
33
|
/**
|
|
34
34
|
* - Web Device ID: UUID v4
|
|
35
35
|
* - iOS Device ID: IDFV
|
|
36
36
|
* - Android Device ID: ANDROID_ID
|
|
37
37
|
* */
|
|
38
|
-
declare const DEVICE_ID: number;
|
|
38
|
+
export declare const DEVICE_ID: number;
|
|
39
39
|
/**
|
|
40
40
|
* - The advertising ID is represented using version 3 of the universally unique identifier (UUID) format or an equivalent 128-bit format.
|
|
41
41
|
* - If this permission is not declared, the returned value will be 00000000-0000-0000-0000-000000000000 starting early 2022.
|
|
42
42
|
* - Reference: [AD_ID](https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#public-string-getid)
|
|
43
43
|
* */
|
|
44
|
-
declare const AAID = 36;
|
|
44
|
+
export declare const AAID = 36;
|
|
45
45
|
/**
|
|
46
46
|
* - Web: UUID
|
|
47
47
|
* - iOS: IDFA
|
|
48
48
|
* - Android: AAID
|
|
49
49
|
* */
|
|
50
|
-
declare const ADVERTISING_ID: number;
|
|
50
|
+
export declare const ADVERTISING_ID: number;
|
|
51
51
|
/**
|
|
52
52
|
* - An IPv4 address is at most 4 sets of 3 numbers (12 characters), each set separated by a dot (.). That makes 15 characters.
|
|
53
53
|
* - An IPv6 address, at its longest, would be 8 sets of 4 characters (32 total), each set separated by a colon. That makes 39 characters.
|
|
54
54
|
* */
|
|
55
|
-
declare const IPv4 = 15;
|
|
56
|
-
declare const IPv6 = 39;
|
|
57
|
-
declare const IPv4_MAPPED_IPv6 = 45;
|
|
58
|
-
declare const IP: number;
|
|
55
|
+
export declare const IPv4 = 15;
|
|
56
|
+
export declare const IPv6 = 39;
|
|
57
|
+
export declare const IPv4_MAPPED_IPv6 = 45;
|
|
58
|
+
export declare const IP: number;
|
|
59
59
|
/**
|
|
60
60
|
* - The longest string in the database is America/Argentina/ComodRivadavia. It's 32 characters long.
|
|
61
61
|
* - The mysql.time_zone_name table has a Name column defined with 64 characters.
|
|
62
62
|
* - It makes sense to use VARCHAR(64) for storing this information.
|
|
63
63
|
* - Reference: [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
|
64
64
|
* */
|
|
65
|
-
declare const TIMEZONE_LONGEST: number;
|
|
66
|
-
declare const TIMEZONE: number;
|
|
65
|
+
export declare const TIMEZONE_LONGEST: number;
|
|
66
|
+
export declare const TIMEZONE: number;
|
|
67
67
|
/**
|
|
68
68
|
* Reference: [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
|
|
69
69
|
* */
|
|
70
|
-
declare const COUNTRY_CODE_ALPHA_2 = 2;
|
|
71
|
-
declare const COUNTRY_CODE_ALPHA_3 = 3;
|
|
72
|
-
declare const COUNTRY_CODE: number;
|
|
70
|
+
export declare const COUNTRY_CODE_ALPHA_2 = 2;
|
|
71
|
+
export declare const COUNTRY_CODE_ALPHA_3 = 3;
|
|
72
|
+
export declare const COUNTRY_CODE: number;
|
|
73
73
|
/**
|
|
74
74
|
* Reference: [RFC5646 Tags for Identifying Languages](https://www.rfc-editor.org/rfc/rfc5646#section-4.4.1)
|
|
75
75
|
* The following illustration shows how the 35-character recommendation was derived:
|
|
@@ -87,7 +87,7 @@ declare const COUNTRY_CODE: number;
|
|
|
87
87
|
* total = 35 characters
|
|
88
88
|
* ```
|
|
89
89
|
* */
|
|
90
|
-
declare const LANGUAGE_CODE = 35;
|
|
90
|
+
export declare const LANGUAGE_CODE = 35;
|
|
91
91
|
/**
|
|
92
92
|
* Mailbox = Local-part "@" ( Domain / address-literal )
|
|
93
93
|
* - Local-part: The maximum total length of a user name or other local-part is 64 octets.
|
|
@@ -95,16 +95,16 @@ declare const LANGUAGE_CODE = 35;
|
|
|
95
95
|
* - Maximum length of an email address: 64 + 1 + 255 = 320
|
|
96
96
|
* - Reference: [Simple Mail Transfer Protocol - Size Limits and Minimums](https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.3.1)
|
|
97
97
|
* */
|
|
98
|
-
declare const EMAIL_LOCAL_PART = 64;
|
|
99
|
-
declare const EMAIL_DOMAIN = 255;
|
|
100
|
-
declare const EMAIL: number;
|
|
98
|
+
export declare const EMAIL_LOCAL_PART = 64;
|
|
99
|
+
export declare const EMAIL_DOMAIN = 255;
|
|
100
|
+
export declare const EMAIL: number;
|
|
101
101
|
/**
|
|
102
102
|
* Reference: [E.164](https://en.wikipedia.org/wiki/E.164)
|
|
103
103
|
* */
|
|
104
|
-
declare const PHONE_NUMBER = 15;
|
|
104
|
+
export declare const PHONE_NUMBER = 15;
|
|
105
105
|
/**
|
|
106
106
|
* Reference: [How big can a user agent string get?](https://stackoverflow.com/questions/654921/how-big-can-a-user-agent-string-get)
|
|
107
107
|
* */
|
|
108
108
|
//#endregion
|
|
109
|
-
export {
|
|
109
|
+
export { index_d_exports };
|
|
110
110
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/max-length/index.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/max-length/index.ts"],"mappings":";;;;;;;qBAMa;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;qBAMA;qBACA;qBACA;qBACA;;;;;;;qBAQA;qBACA;;;;qBAKA;qBACA;qBACA;;;;;;;;;;;;;;;;;;qBAmBA;;;;;;;;qBASA;qBACA;qBACA;;;;qBAKA"}
|
package/dist/message.d.cts
CHANGED
package/dist/message.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.cts","names":[],"sources":["../src/message.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"message.d.cts","names":[],"sources":["../src/message.ts"],"mappings":";wBAAgB"}
|
package/dist/message.d.mts
CHANGED
package/dist/message.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.mts","names":[],"sources":["../src/message.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"message.d.mts","names":[],"sources":["../src/message.ts"],"mappings":";wBAAgB"}
|