@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.
Files changed (105) hide show
  1. package/dist/cache/index.d.cts +1 -2
  2. package/dist/cache/index.d.cts.map +1 -1
  3. package/dist/cache/index.d.mts +1 -2
  4. package/dist/cache/index.d.mts.map +1 -1
  5. package/dist/error/detail.d.cts +14 -15
  6. package/dist/error/detail.d.cts.map +1 -1
  7. package/dist/error/detail.d.mts +14 -15
  8. package/dist/error/detail.d.mts.map +1 -1
  9. package/dist/error/i18n/en-us.d.cts +1 -2
  10. package/dist/error/i18n/en-us.d.cts.map +1 -1
  11. package/dist/error/i18n/en-us.d.mts +1 -2
  12. package/dist/error/i18n/en-us.d.mts.map +1 -1
  13. package/dist/error/index.d.cts +5 -6
  14. package/dist/error/index.d.cts.map +1 -1
  15. package/dist/error/index.d.mts +5 -6
  16. package/dist/error/index.d.mts.map +1 -1
  17. package/dist/error/parse.d.cts +4 -5
  18. package/dist/error/parse.d.cts.map +1 -1
  19. package/dist/error/parse.d.mts +4 -5
  20. package/dist/error/parse.d.mts.map +1 -1
  21. package/dist/error/reason.d.cts +2 -3
  22. package/dist/error/reason.d.cts.map +1 -1
  23. package/dist/error/reason.d.mts +2 -3
  24. package/dist/error/reason.d.mts.map +1 -1
  25. package/dist/error/status.d.cts +6 -7
  26. package/dist/error/status.d.cts.map +1 -1
  27. package/dist/error/status.d.mts +6 -7
  28. package/dist/error/status.d.mts.map +1 -1
  29. package/dist/google-one-tap/index.d.cts +8 -9
  30. package/dist/google-one-tap/index.d.cts.map +1 -1
  31. package/dist/google-one-tap/index.d.mts +8 -9
  32. package/dist/google-one-tap/index.d.mts.map +1 -1
  33. package/dist/google-one-tap/types.d.cts +6 -7
  34. package/dist/google-one-tap/types.d.cts.map +1 -1
  35. package/dist/google-one-tap/types.d.mts +6 -7
  36. package/dist/google-one-tap/types.d.mts.map +1 -1
  37. package/dist/hono/authorizer.d.cts +3 -4
  38. package/dist/hono/authorizer.d.cts.map +1 -1
  39. package/dist/hono/authorizer.d.mts +3 -4
  40. package/dist/hono/authorizer.d.mts.map +1 -1
  41. package/dist/hono/csrf.d.cts +3 -4
  42. package/dist/hono/csrf.d.cts.map +1 -1
  43. package/dist/hono/csrf.d.mts +3 -4
  44. package/dist/hono/csrf.d.mts.map +1 -1
  45. package/dist/hono/geolocation.d.cts +1 -2
  46. package/dist/hono/geolocation.d.cts.map +1 -1
  47. package/dist/hono/geolocation.d.mts +1 -2
  48. package/dist/hono/geolocation.d.mts.map +1 -1
  49. package/dist/hono/handler.d.cts +4 -5
  50. package/dist/hono/handler.d.cts.map +1 -1
  51. package/dist/hono/handler.d.mts +4 -5
  52. package/dist/hono/handler.d.mts.map +1 -1
  53. package/dist/hono/index.cjs +1 -0
  54. package/dist/hono/index.d.cts +2 -2
  55. package/dist/hono/index.d.mts +2 -2
  56. package/dist/hono/index.mjs +2 -2
  57. package/dist/hono/rate-limit.d.cts +5 -6
  58. package/dist/hono/rate-limit.d.cts.map +1 -1
  59. package/dist/hono/rate-limit.d.mts +5 -6
  60. package/dist/hono/rate-limit.d.mts.map +1 -1
  61. package/dist/hono/validator.cjs +40 -14
  62. package/dist/hono/validator.cjs.map +1 -1
  63. package/dist/hono/validator.d.cts +34 -17
  64. package/dist/hono/validator.d.cts.map +1 -1
  65. package/dist/hono/validator.d.mts +34 -17
  66. package/dist/hono/validator.d.mts.map +1 -1
  67. package/dist/hono/validator.mjs +40 -15
  68. package/dist/hono/validator.mjs.map +1 -1
  69. package/dist/iso/iso-3601-1.d.cts +2 -3
  70. package/dist/iso/iso-3601-1.d.cts.map +1 -1
  71. package/dist/iso/iso-3601-1.d.mts +2 -3
  72. package/dist/iso/iso-3601-1.d.mts.map +1 -1
  73. package/dist/max-length/index.d.cts +23 -23
  74. package/dist/max-length/index.d.cts.map +1 -1
  75. package/dist/max-length/index.d.mts +23 -23
  76. package/dist/max-length/index.d.mts.map +1 -1
  77. package/dist/message.d.cts +1 -2
  78. package/dist/message.d.cts.map +1 -1
  79. package/dist/message.d.mts +1 -2
  80. package/dist/message.d.mts.map +1 -1
  81. package/dist/response.d.cts +18 -19
  82. package/dist/response.d.cts.map +1 -1
  83. package/dist/response.d.mts +18 -19
  84. package/dist/response.d.mts.map +1 -1
  85. package/dist/snowflake.d.cts +2 -3
  86. package/dist/snowflake.d.cts.map +1 -1
  87. package/dist/snowflake.d.mts +2 -3
  88. package/dist/snowflake.d.mts.map +1 -1
  89. package/dist/utils/geolocation.d.cts +5 -6
  90. package/dist/utils/geolocation.d.cts.map +1 -1
  91. package/dist/utils/geolocation.d.mts +5 -6
  92. package/dist/utils/geolocation.d.mts.map +1 -1
  93. package/dist/utils/google-tag-gateway.d.cts +1 -2
  94. package/dist/utils/google-tag-gateway.d.cts.map +1 -1
  95. package/dist/utils/google-tag-gateway.d.mts +1 -2
  96. package/dist/utils/google-tag-gateway.d.mts.map +1 -1
  97. package/dist/utils/timing.d.cts +2 -3
  98. package/dist/utils/timing.d.cts.map +1 -1
  99. package/dist/utils/timing.d.mts +2 -3
  100. package/dist/utils/timing.d.mts.map +1 -1
  101. package/dist/webhook/index.d.cts +1 -2
  102. package/dist/webhook/index.d.cts.map +1 -1
  103. package/dist/webhook/index.d.mts +1 -2
  104. package/dist/webhook/index.d.mts.map +1 -1
  105. package/package.json +9 -9
@@ -8,7 +8,7 @@ declare global {
8
8
  };
9
9
  }
10
10
  }
11
- type Props = {
11
+ export type Props = {
12
12
  /**
13
13
  * Opaque nonce string forwarded as-is to Google. Google echoes it back in
14
14
  * the ID Token's `nonce` claim per the OIDC spec; the caller is responsible
@@ -20,7 +20,7 @@ type Props = {
20
20
  cancel_on_tap_outside?: boolean;
21
21
  use_fedcm_for_prompt?: boolean;
22
22
  };
23
- type PromptMoment = {
23
+ export type PromptMoment = {
24
24
  skipped: boolean;
25
25
  dismissed: boolean;
26
26
  dismissedReason: ReturnType<PromptMomentNotification['getDismissedReason']>;
@@ -32,8 +32,8 @@ type PromptMoment = {
32
32
  * - `script_load_failed`: the GSI script failed to load (network/CSP).
33
33
  * - `prompt_error`: GIS threw synchronously while initializing/prompting.
34
34
  */
35
- type UnsupportedReason = 'fedcm_unsupported' | 'script_load_failed' | 'prompt_error';
36
- type PromptResult = {
35
+ export type UnsupportedReason = 'fedcm_unsupported' | 'script_load_failed' | 'prompt_error';
36
+ export type PromptResult = {
37
37
  authorized: true;
38
38
  credential: CredentialResponse;
39
39
  } | {
@@ -45,8 +45,8 @@ type PromptResult = {
45
45
  reason: UnsupportedReason;
46
46
  };
47
47
  /** debug: chrome://settings/content/federatedIdentityApi */
48
- declare function prompt({ nonce, client_id, auto_select, use_fedcm_for_prompt, cancel_on_tap_outside }: Props): Promise<PromptResult>;
49
- type CodeProps = {
48
+ export declare function prompt({ nonce, client_id, auto_select, use_fedcm_for_prompt, cancel_on_tap_outside }: Props): Promise<PromptResult>;
49
+ export type CodeProps = {
50
50
  client_id: string;
51
51
  /**
52
52
  * Space-delimited OAuth scopes. Defaults to OpenID Connect scopes so the
@@ -61,7 +61,7 @@ type CodeProps = {
61
61
  login_hint?: string;
62
62
  hd?: string;
63
63
  };
64
- type CodeResult = {
64
+ export type CodeResult = {
65
65
  ok: true;
66
66
  response: CodeResponse;
67
67
  } | {
@@ -77,7 +77,6 @@ type CodeResult = {
77
77
  * exchange, not an ID token, and it must be triggered by a user gesture or the
78
78
  * popup may be blocked.
79
79
  */
80
- declare function requestCode({ client_id, scope, ux_mode, redirect_uri, state, login_hint, hd }: CodeProps): Promise<CodeResult>;
80
+ export declare function requestCode({ client_id, scope, ux_mode, redirect_uri, state, login_hint, hd }: CodeProps): Promise<CodeResult>;
81
81
  //#endregion
82
- export { CodeProps, CodeResult, PromptMoment, PromptResult, Props, UnsupportedReason, prompt, requestCode };
83
82
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/google-one-tap/index.ts"],"mappings":";;QAQQ;YACI;;IAER;MACE,UAAU;;;;KAKJ;;;;;;EAMV;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,iBAAiB,WAAW;;;;;;;;;KAUlB;KAEA;EACN;EAAkB,YAAY;;EAC9B;EAAmB,QAAQ;;EAC3B;EAAmB;EAAmB,QAAQ;;;iBAwC9B,SACpB,OACA,WACA,aACA,sBACA,yBACC,QAAQ,QAAQ;KA+DP;EACV;;;;;EAKA;;EAEA;;EAEA;EACA;EACA;EACA;;KAGU;EACN;EAAU,UAAU;;EACpB;EAAW,OAAO,oBAAoB;;;;;;;;;;;iBAWtB,cACpB,WACA,OACA,SACA,cACA,OACA,YACA,MACC,YAAY,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/google-one-tap/index.ts"],"mappings":";;QAQQ;YACI;;IAER;MACE,UAAU;;;;YAKJ;;;;;;EAMV;EACA;EACA;EACA;EACA;;YAGU;EACV;EACA;EACA,iBAAiB,WAAW;;;;;;;;;YAUlB;YAEA;EACN;EAAkB,YAAY;;EAC9B;EAAmB,QAAQ;;EAC3B;EAAmB;EAAmB,QAAQ;;;wBAwC9B,SACpB,OACA,WACA,aACA,sBACA,yBACC,QAAQ,QAAQ;YA+DP;EACV;;;;;EAKA;;EAEA;;EAEA;EACA;EACA;EACA;;YAGU;EACN;EAAU,UAAU;;EACpB;EAAW,OAAO,oBAAoB;;;;;;;;;;;wBAWtB,cACpB,WACA,OACA,SACA,cACA,OACA,YACA,MACC,YAAY,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  //#region src/google-one-tap/types.d.ts
2
- interface ClientConfigError extends Error {
2
+ export interface ClientConfigError extends Error {
3
3
  message: string;
4
4
  stack?: string;
5
5
  type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';
@@ -32,7 +32,7 @@ interface TokenResponse {
32
32
  error_description: string;
33
33
  error_uri: string;
34
34
  }
35
- interface CodeResponse {
35
+ export interface CodeResponse {
36
36
  code: string;
37
37
  scope: string;
38
38
  state: string;
@@ -80,11 +80,11 @@ interface Credential {
80
80
  id: string;
81
81
  password: string;
82
82
  }
83
- interface CredentialResponse {
83
+ export interface CredentialResponse {
84
84
  credential: string;
85
85
  select_by: string;
86
86
  }
87
- interface IdConfiguration {
87
+ export interface IdConfiguration {
88
88
  client_id: string;
89
89
  auto_select?: boolean;
90
90
  login_uri?: string;
@@ -106,7 +106,7 @@ interface IdConfiguration {
106
106
  /**
107
107
  * ref: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc&utm_source=devtools&utm_campaign=stable#display_moment
108
108
  */
109
- interface PromptMomentNotification {
109
+ export interface PromptMomentNotification {
110
110
  /** @deprecated */
111
111
  isDisplayMoment(): boolean;
112
112
  /** @deprecated */
@@ -134,7 +134,7 @@ interface GsiButtonConfiguration {
134
134
  state?: string;
135
135
  click_listener?: () => void;
136
136
  }
137
- interface GoogleAccounts {
137
+ export interface GoogleAccounts {
138
138
  oauth2: {
139
139
  initCodeClient(config: CodeClientConfig): CodeClient;
140
140
  initTokenClient(config: TokenClientConfig): TokenClient;
@@ -153,5 +153,4 @@ interface GoogleAccounts {
153
153
  };
154
154
  }
155
155
  //#endregion
156
- export { ClientConfigError, CodeResponse, CredentialResponse, GoogleAccounts, IdConfiguration, PromptMomentNotification };
157
156
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/google-one-tap/types.ts"],"mappings":";UAAiB,0BAA0B;EACzC;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR,qBAAqB,iBAAiB;;UAG9B;EACR;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,eAAe;EAC1B,kBAAkB,OAAO;;UAGjB;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,kBAAkB,OAAO;;UAGjB;EACR;EACA;;UAGQ;EACR;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,mBAAmB,UAAU;EAC7B;;;;;UAKe;;EAEf;;EAGA;;EAGA;;EAGA;;EAWA;EAEA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;IACE,eAAe,QAAQ,mBAAmB;IAC1C,gBAAgB,QAAQ,oBAAoB;IAC5C,oBACE,eAAe,eACf,uBACG;IAEL,mBACE,eAAe,eACf,uBACG;IAEL,OAAO,qBAAqB;;EAE9B;IACE,WAAW,UAAU;IACrB,OAAO,kBAAkB,0BAA0B;IACnD,aAAa,QAAQ,aAAa,SAAS;IAC3C;IACA,gBAAgB,YAAY,YAAY;IACxC;IACA,OAAO,cAAc,YAAY,UAAU"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/google-one-tap/types.ts"],"mappings":";iBAAiB,0BAA0B;EACzC;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR,qBAAqB,iBAAiB;;UAG9B;EACR;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,eAAe;EAC1B,kBAAkB,OAAO;;UAGjB;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,kBAAkB,OAAO;;UAGjB;EACR;EACA;;UAGQ;EACR;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,mBAAmB,UAAU;EAC7B;;;;;iBAKe;;EAEf;;EAGA;;EAGA;;EAGA;;EAWA;EAEA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;IACE,eAAe,QAAQ,mBAAmB;IAC1C,gBAAgB,QAAQ,oBAAoB;IAC5C,oBACE,eAAe,eACf,uBACG;IAEL,mBACE,eAAe,eACf,uBACG;IAEL,OAAO,qBAAqB;;EAE9B;IACE,WAAW,UAAU;IACrB,OAAO,kBAAkB,0BAA0B;IACnD,aAAa,QAAQ,aAAa,SAAS;IAC3C;IACA,gBAAgB,YAAY,YAAY;IACxC;IACA,OAAO,cAAc,YAAY,UAAU"}
@@ -1,5 +1,5 @@
1
1
  //#region src/google-one-tap/types.d.ts
2
- interface ClientConfigError extends Error {
2
+ export interface ClientConfigError extends Error {
3
3
  message: string;
4
4
  stack?: string;
5
5
  type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';
@@ -32,7 +32,7 @@ interface TokenResponse {
32
32
  error_description: string;
33
33
  error_uri: string;
34
34
  }
35
- interface CodeResponse {
35
+ export interface CodeResponse {
36
36
  code: string;
37
37
  scope: string;
38
38
  state: string;
@@ -80,11 +80,11 @@ interface Credential {
80
80
  id: string;
81
81
  password: string;
82
82
  }
83
- interface CredentialResponse {
83
+ export interface CredentialResponse {
84
84
  credential: string;
85
85
  select_by: string;
86
86
  }
87
- interface IdConfiguration {
87
+ export interface IdConfiguration {
88
88
  client_id: string;
89
89
  auto_select?: boolean;
90
90
  login_uri?: string;
@@ -106,7 +106,7 @@ interface IdConfiguration {
106
106
  /**
107
107
  * ref: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc&utm_source=devtools&utm_campaign=stable#display_moment
108
108
  */
109
- interface PromptMomentNotification {
109
+ export interface PromptMomentNotification {
110
110
  /** @deprecated */
111
111
  isDisplayMoment(): boolean;
112
112
  /** @deprecated */
@@ -134,7 +134,7 @@ interface GsiButtonConfiguration {
134
134
  state?: string;
135
135
  click_listener?: () => void;
136
136
  }
137
- interface GoogleAccounts {
137
+ export interface GoogleAccounts {
138
138
  oauth2: {
139
139
  initCodeClient(config: CodeClientConfig): CodeClient;
140
140
  initTokenClient(config: TokenClientConfig): TokenClient;
@@ -153,5 +153,4 @@ interface GoogleAccounts {
153
153
  };
154
154
  }
155
155
  //#endregion
156
- export { ClientConfigError, CodeResponse, CredentialResponse, GoogleAccounts, IdConfiguration, PromptMomentNotification };
157
156
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/google-one-tap/types.ts"],"mappings":";UAAiB,0BAA0B;EACzC;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR,qBAAqB,iBAAiB;;UAG9B;EACR;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,eAAe;EAC1B,kBAAkB,OAAO;;UAGjB;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,kBAAkB,OAAO;;UAGjB;EACR;EACA;;UAGQ;EACR;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,mBAAmB,UAAU;EAC7B;;;;;UAKe;;EAEf;;EAGA;;EAGA;;EAGA;;EAWA;EAEA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;IACE,eAAe,QAAQ,mBAAmB;IAC1C,gBAAgB,QAAQ,oBAAoB;IAC5C,oBACE,eAAe,eACf,uBACG;IAEL,mBACE,eAAe,eACf,uBACG;IAEL,OAAO,qBAAqB;;EAE9B;IACE,WAAW,UAAU;IACrB,OAAO,kBAAkB,0BAA0B;IACnD,aAAa,QAAQ,aAAa,SAAS;IAC3C;IACA,gBAAgB,YAAY,YAAY;IACxC;IACA,OAAO,cAAc,YAAY,UAAU"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/google-one-tap/types.ts"],"mappings":";iBAAiB,0BAA0B;EACzC;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR,qBAAqB,iBAAiB;;UAG9B;EACR;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,eAAe;EAC1B,kBAAkB,OAAO;;UAGjB;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,kBAAkB,OAAO;;UAGjB;EACR;EACA;;UAGQ;EACR;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,UAAU;EACtB,mBAAmB,UAAU;EAC7B;;;;;iBAKe;;EAEf;;EAGA;;EAGA;;EAGA;;EAWA;EAEA;EACA;EACA;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;IACE,eAAe,QAAQ,mBAAmB;IAC1C,gBAAgB,QAAQ,oBAAoB;IAC5C,oBACE,eAAe,eACf,uBACG;IAEL,mBACE,eAAe,eACf,uBACG;IAEL,OAAO,qBAAqB;;EAE9B;IACE,WAAW,UAAU;IACrB,OAAO,kBAAkB,0BAA0B;IACnD,aAAa,QAAQ,aAAa,SAAS;IAC3C;IACA,gBAAgB,YAAY,YAAY;IACxC;IACA,OAAO,cAAc,YAAY,UAAU"}
@@ -4,16 +4,15 @@ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
4
4
  type Auth = {
5
5
  isAuthenticated: (request: Request) => Promise<boolean>;
6
6
  };
7
- type AuthRule = string | {
7
+ export type AuthRule = string | {
8
8
  path: string;
9
9
  methods?: [Methods, ...Methods[]];
10
10
  };
11
- interface AuthorizerConfig {
11
+ export interface AuthorizerConfig {
12
12
  auth: Auth;
13
13
  errorMessage?: string;
14
14
  rules?: AuthRule[];
15
15
  }
16
- declare function authorizer({ auth, errorMessage, rules }: AuthorizerConfig): MiddlewareHandler;
16
+ export declare function authorizer({ auth, errorMessage, rules }: AuthorizerConfig): MiddlewareHandler;
17
17
  //#endregion
18
- export { AuthRule, AuthorizerConfig, authorizer };
19
18
  //# sourceMappingURL=authorizer.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorizer.d.cts","names":[],"sources":["../../src/hono/authorizer.ts"],"mappings":";;KAOK;KAEA;EAAS,kBAAkB,SAAS,YAAY;;KAEzC;EAAsB;EAAc,WAAW,YAAY;;UAEtD;EACf,MAAM;EACN;EACA,QAAQ;;iBAGM,aACd,MACA,cACA,SACC,mBAAmB"}
1
+ {"version":3,"file":"authorizer.d.cts","names":[],"sources":["../../src/hono/authorizer.ts"],"mappings":";;KAOK;KAEA;EAAS,kBAAkB,SAAS,YAAY;;YAEzC;EAAsB;EAAc,WAAW,YAAY;;iBAEtD;EACf,MAAM;EACN;EACA,QAAQ;;wBAGM,aACd,MACA,cACA,SACC,mBAAmB"}
@@ -4,16 +4,15 @@ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
4
4
  type Auth = {
5
5
  isAuthenticated: (request: Request) => Promise<boolean>;
6
6
  };
7
- type AuthRule = string | {
7
+ export type AuthRule = string | {
8
8
  path: string;
9
9
  methods?: [Methods, ...Methods[]];
10
10
  };
11
- interface AuthorizerConfig {
11
+ export interface AuthorizerConfig {
12
12
  auth: Auth;
13
13
  errorMessage?: string;
14
14
  rules?: AuthRule[];
15
15
  }
16
- declare function authorizer({ auth, errorMessage, rules }: AuthorizerConfig): MiddlewareHandler;
16
+ export declare function authorizer({ auth, errorMessage, rules }: AuthorizerConfig): MiddlewareHandler;
17
17
  //#endregion
18
- export { AuthRule, AuthorizerConfig, authorizer };
19
18
  //# sourceMappingURL=authorizer.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorizer.d.mts","names":[],"sources":["../../src/hono/authorizer.ts"],"mappings":";;KAOK;KAEA;EAAS,kBAAkB,SAAS,YAAY;;KAEzC;EAAsB;EAAc,WAAW,YAAY;;UAEtD;EACf,MAAM;EACN;EACA,QAAQ;;iBAGM,aACd,MACA,cACA,SACC,mBAAmB"}
1
+ {"version":3,"file":"authorizer.d.mts","names":[],"sources":["../../src/hono/authorizer.ts"],"mappings":";;KAOK;KAEA;EAAS,kBAAkB,SAAS,YAAY;;YAEzC;EAAsB;EAAc,WAAW,YAAY;;iBAEtD;EACf,MAAM;EACN;EACA,QAAQ;;wBAGM,aACd,MACA,cACA,SACC,mBAAmB"}
@@ -1,11 +1,11 @@
1
1
  import { MiddlewareHandler } from "hono";
2
2
  //#region src/hono/csrf.d.ts
3
3
  type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
4
- type CSRFIgnoreRule = string | {
4
+ export type CSRFIgnoreRule = string | {
5
5
  path: string;
6
6
  methods?: [HTTPMethod, ...HTTPMethod[]];
7
7
  };
8
- interface CSRFConfig {
8
+ export interface CSRFConfig {
9
9
  /**
10
10
  * Cookie name for CSRF token
11
11
  * @default 'XSRF-TOKEN'
@@ -70,7 +70,6 @@ interface CSRFConfig {
70
70
  * }));
71
71
  * ```
72
72
  */
73
- declare function csrf(config?: CSRFConfig): MiddlewareHandler;
73
+ export declare function csrf(config?: CSRFConfig): MiddlewareHandler;
74
74
  //#endregion
75
- export { CSRFConfig, CSRFIgnoreRule, csrf };
76
75
  //# sourceMappingURL=csrf.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csrf.d.cts","names":[],"sources":["../../src/hono/csrf.ts"],"mappings":";;KASK;KAEO;EAA4B;EAAc,WAAW,eAAe;;UAE/D;;;;;EAKf;;;;;EAMA;;;;;;;;;EAUA,UAAU;;;;;EAMV,cAAc;;;;;EAMd;;;;;EAMA,eAAe;;;;;EAMf;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCc,KAAK,SAAQ,aAAkB"}
1
+ {"version":3,"file":"csrf.d.cts","names":[],"sources":["../../src/hono/csrf.ts"],"mappings":";;KASK;YAEO;EAA4B;EAAc,WAAW,eAAe;;iBAE/D;;;;;EAKf;;;;;EAMA;;;;;;;;;EAUA,UAAU;;;;;EAMV,cAAc;;;;;EAMd;;;;;EAMA,eAAe;;;;;EAMf;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsCc,KAAK,SAAQ,aAAkB"}
@@ -1,11 +1,11 @@
1
1
  import { MiddlewareHandler } from "hono";
2
2
  //#region src/hono/csrf.d.ts
3
3
  type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
4
- type CSRFIgnoreRule = string | {
4
+ export type CSRFIgnoreRule = string | {
5
5
  path: string;
6
6
  methods?: [HTTPMethod, ...HTTPMethod[]];
7
7
  };
8
- interface CSRFConfig {
8
+ export interface CSRFConfig {
9
9
  /**
10
10
  * Cookie name for CSRF token
11
11
  * @default 'XSRF-TOKEN'
@@ -70,7 +70,6 @@ interface CSRFConfig {
70
70
  * }));
71
71
  * ```
72
72
  */
73
- declare function csrf(config?: CSRFConfig): MiddlewareHandler;
73
+ export declare function csrf(config?: CSRFConfig): MiddlewareHandler;
74
74
  //#endregion
75
- export { CSRFConfig, CSRFIgnoreRule, csrf };
76
75
  //# sourceMappingURL=csrf.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csrf.d.mts","names":[],"sources":["../../src/hono/csrf.ts"],"mappings":";;KASK;KAEO;EAA4B;EAAc,WAAW,eAAe;;UAE/D;;;;;EAKf;;;;;EAMA;;;;;;;;;EAUA,UAAU;;;;;EAMV,cAAc;;;;;EAMd;;;;;EAMA,eAAe;;;;;EAMf;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCc,KAAK,SAAQ,aAAkB"}
1
+ {"version":3,"file":"csrf.d.mts","names":[],"sources":["../../src/hono/csrf.ts"],"mappings":";;KASK;YAEO;EAA4B;EAAc,WAAW,eAAe;;iBAE/D;;;;;EAKf;;;;;EAMA;;;;;;;;;EAUA,UAAU;;;;;EAMV,cAAc;;;;;EAMd;;;;;EAMA,eAAe;;;;;EAMf;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsCc,KAAK,SAAQ,aAAkB"}
@@ -1,7 +1,6 @@
1
1
  import { Geolocation } from "../utils/geolocation.cjs";
2
2
  import { Context } from "hono";
3
3
  //#region src/hono/geolocation.d.ts
4
- declare function geolocation(c: Context): Geolocation;
4
+ export declare function geolocation(c: Context): Geolocation;
5
5
  //#endregion
6
- export { geolocation };
7
6
  //# sourceMappingURL=geolocation.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.d.cts","names":[],"sources":["../../src/hono/geolocation.ts"],"mappings":";;;iBASgB,YAAY,GAAG,UAAU"}
1
+ {"version":3,"file":"geolocation.d.cts","names":[],"sources":["../../src/hono/geolocation.ts"],"mappings":";;;wBASgB,YAAY,GAAG,UAAU"}
@@ -1,7 +1,6 @@
1
1
  import { Geolocation } from "../utils/geolocation.mjs";
2
2
  import { Context } from "hono";
3
3
  //#region src/hono/geolocation.d.ts
4
- declare function geolocation(c: Context): Geolocation;
4
+ export declare function geolocation(c: Context): Geolocation;
5
5
  //#endregion
6
- export { geolocation };
7
6
  //# sourceMappingURL=geolocation.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.d.mts","names":[],"sources":["../../src/hono/geolocation.ts"],"mappings":";;;iBASgB,YAAY,GAAG,UAAU"}
1
+ {"version":3,"file":"geolocation.d.mts","names":[],"sources":["../../src/hono/geolocation.ts"],"mappings":";;;wBASgB,YAAY,GAAG,UAAU"}
@@ -3,7 +3,7 @@ import { Context } from "hono";
3
3
  import { RequestIdVariables } from "hono/request-id";
4
4
  import { Bindings, HTTPResponseError } from "hono/types";
5
5
  //#region src/hono/handler.d.ts
6
- type Env = {
6
+ export type Env = {
7
7
  Variables: RequestIdVariables;
8
8
  Bindings?: Bindings;
9
9
  };
@@ -26,14 +26,13 @@ type AxiosError = {
26
26
  headers?: Record<string, string>;
27
27
  };
28
28
  };
29
- declare function isAxiosError(payload: unknown): payload is AxiosError;
29
+ export declare function isAxiosError(payload: unknown): payload is AxiosError;
30
30
  /**
31
31
  * `instanceof` alone is not enough: two copies of this package (duplicated in a lockfile, or one
32
32
  * bundled into a dependency) produce distinct classes, and `Status.adapter` may swap in a
33
33
  * host-defined error class entirely. Fall back to recognizing the error by shape.
34
34
  */
35
- declare function isStatusError(payload: unknown): payload is StatusError;
36
- declare function errorHandler<E extends Env = never>(error: Error | HTTPResponseError, c: Context<E>): Response | Promise<Response>;
35
+ export declare function isStatusError(payload: unknown): payload is StatusError;
36
+ export declare function errorHandler<E extends Env = never>(error: Error | HTTPResponseError, c: Context<E>): Response | Promise<Response>;
37
37
  //#endregion
38
- export { Env, errorHandler, isAxiosError, isStatusError };
39
38
  //# sourceMappingURL=handler.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.cts","names":[],"sources":["../../src/hono/handler.ts"],"mappings":";;;;;KASY;EACV,WAAW;EACX,WAAW;;KAGR;EACH;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;IACA,SAAS;;EAEX;IAAW;IAAc;IAAgB;IAAiB,UAAU;;;iBA8BtD,aAAa,mBAAmB,WAAW;;;;;;iBAc3C,cAAc,mBAAmB,WAAW;iBAO5C,aAAa,UAAU,aACrC,OAAO,QAAQ,mBACf,GAAG,QAAQ,KACV,WAAW,QAAQ"}
1
+ {"version":3,"file":"handler.d.cts","names":[],"sources":["../../src/hono/handler.ts"],"mappings":";;;;;YASY;EACV,WAAW;EACX,WAAW;;KAGR;EACH;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;IACA,SAAS;;EAEX;IAAW;IAAc;IAAgB;IAAiB,UAAU;;;wBA8BtD,aAAa,mBAAmB,WAAW;;;;;;wBAc3C,cAAc,mBAAmB,WAAW;wBAO5C,aAAa,UAAU,aACrC,OAAO,QAAQ,mBACf,GAAG,QAAQ,KACV,WAAW,QAAQ"}
@@ -3,7 +3,7 @@ import { Context } from "hono";
3
3
  import { RequestIdVariables } from "hono/request-id";
4
4
  import { Bindings, HTTPResponseError } from "hono/types";
5
5
  //#region src/hono/handler.d.ts
6
- type Env = {
6
+ export type Env = {
7
7
  Variables: RequestIdVariables;
8
8
  Bindings?: Bindings;
9
9
  };
@@ -26,14 +26,13 @@ type AxiosError = {
26
26
  headers?: Record<string, string>;
27
27
  };
28
28
  };
29
- declare function isAxiosError(payload: unknown): payload is AxiosError;
29
+ export declare function isAxiosError(payload: unknown): payload is AxiosError;
30
30
  /**
31
31
  * `instanceof` alone is not enough: two copies of this package (duplicated in a lockfile, or one
32
32
  * bundled into a dependency) produce distinct classes, and `Status.adapter` may swap in a
33
33
  * host-defined error class entirely. Fall back to recognizing the error by shape.
34
34
  */
35
- declare function isStatusError(payload: unknown): payload is StatusError;
36
- declare function errorHandler<E extends Env = never>(error: Error | HTTPResponseError, c: Context<E>): Response | Promise<Response>;
35
+ export declare function isStatusError(payload: unknown): payload is StatusError;
36
+ export declare function errorHandler<E extends Env = never>(error: Error | HTTPResponseError, c: Context<E>): Response | Promise<Response>;
37
37
  //#endregion
38
- export { Env, errorHandler, isAxiosError, isStatusError };
39
38
  //# sourceMappingURL=handler.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.mts","names":[],"sources":["../../src/hono/handler.ts"],"mappings":";;;;;KASY;EACV,WAAW;EACX,WAAW;;KAGR;EACH;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;IACA,SAAS;;EAEX;IAAW;IAAc;IAAgB;IAAiB,UAAU;;;iBA8BtD,aAAa,mBAAmB,WAAW;;;;;;iBAc3C,cAAc,mBAAmB,WAAW;iBAO5C,aAAa,UAAU,aACrC,OAAO,QAAQ,mBACf,GAAG,QAAQ,KACV,WAAW,QAAQ"}
1
+ {"version":3,"file":"handler.d.mts","names":[],"sources":["../../src/hono/handler.ts"],"mappings":";;;;;YASY;EACV,WAAW;EACX,WAAW;;KAGR;EACH;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;IACA,SAAS;;EAEX;IAAW;IAAc;IAAgB;IAAiB,UAAU;;;wBA8BtD,aAAa,mBAAmB,WAAW;;;;;;wBAc3C,cAAc,mBAAmB,WAAW;wBAO5C,aAAa,UAAU,aACrC,OAAO,QAAQ,mBACf,GAAG,QAAQ,KACV,WAAW,QAAQ"}
@@ -11,4 +11,5 @@ exports.csrf = require_hono_csrf.csrf;
11
11
  exports.errorHandler = require_hono_handler.errorHandler;
12
12
  exports.geolocation = require_hono_geolocation.geolocation;
13
13
  exports.rateLimit = require_hono_rate_limit.rateLimit;
14
+ exports.zBeaconJson = require_hono_validator.zBeaconJson;
14
15
  exports.zValidator = require_hono_validator.zValidator;
@@ -2,6 +2,6 @@ import { AuthorizerConfig, authorizer } from "./authorizer.cjs";
2
2
  import { CSRFConfig, CSRFIgnoreRule, csrf } from "./csrf.cjs";
3
3
  import { geolocation } from "./geolocation.cjs";
4
4
  import { errorHandler } from "./handler.cjs";
5
- import { bigintId, zValidator } from "./validator.cjs";
5
+ import { bigintId, zBeaconJson, zValidator } from "./validator.cjs";
6
6
  import { RateLimitOptions, rateLimit } from "./rate-limit.cjs";
7
- export { type AuthorizerConfig, type CSRFConfig, type CSRFIgnoreRule, type RateLimitOptions, authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zValidator };
7
+ export { type AuthorizerConfig, type CSRFConfig, type CSRFIgnoreRule, type RateLimitOptions, authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zBeaconJson, zValidator };
@@ -2,6 +2,6 @@ import { AuthorizerConfig, authorizer } from "./authorizer.mjs";
2
2
  import { CSRFConfig, CSRFIgnoreRule, csrf } from "./csrf.mjs";
3
3
  import { geolocation } from "./geolocation.mjs";
4
4
  import { errorHandler } from "./handler.mjs";
5
- import { bigintId, zValidator } from "./validator.mjs";
5
+ import { bigintId, zBeaconJson, zValidator } from "./validator.mjs";
6
6
  import { RateLimitOptions, rateLimit } from "./rate-limit.mjs";
7
- export { type AuthorizerConfig, type CSRFConfig, type CSRFIgnoreRule, type RateLimitOptions, authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zValidator };
7
+ export { type AuthorizerConfig, type CSRFConfig, type CSRFIgnoreRule, type RateLimitOptions, authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zBeaconJson, zValidator };
@@ -2,6 +2,6 @@ import { authorizer } from "./authorizer.mjs";
2
2
  import { csrf } from "./csrf.mjs";
3
3
  import { geolocation } from "./geolocation.mjs";
4
4
  import { errorHandler } from "./handler.mjs";
5
- import { bigintId, zValidator } from "./validator.mjs";
5
+ import { bigintId, zBeaconJson, zValidator } from "./validator.mjs";
6
6
  import { rateLimit } from "./rate-limit.mjs";
7
- export { authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zValidator };
7
+ export { authorizer, bigintId, csrf, errorHandler, geolocation, rateLimit, zBeaconJson, zValidator };
@@ -1,11 +1,11 @@
1
1
  import { Context, MiddlewareHandler } from "hono";
2
2
  //#region src/hono/rate-limit.d.ts
3
- interface KV {
3
+ export interface KV {
4
4
  setItem(key: string, value: string, expiresIn?: number): Promise<void>;
5
5
  getItem(key: string): Promise<string | null>;
6
6
  removeItem(key: string): Promise<void>;
7
7
  }
8
- interface RateLimitOptions {
8
+ export interface RateLimitOptions {
9
9
  kv: KV;
10
10
  rate: number;
11
11
  capacity: number;
@@ -16,21 +16,20 @@ interface RateLimitOptions {
16
16
  onRateLimited?: (c: Context, retryAfter: number) => Response | Promise<Response>;
17
17
  skip?: (c: Context) => boolean | Promise<boolean>;
18
18
  }
19
- interface RateLimitResult {
19
+ export interface RateLimitResult {
20
20
  allowed: boolean;
21
21
  remaining: number;
22
22
  limit: number;
23
23
  reset: number;
24
24
  retryAfter?: number;
25
25
  }
26
- declare function checkRateLimit(kv: KV, identifier: string, options: {
26
+ export declare function checkRateLimit(kv: KV, identifier: string, options: {
27
27
  rate: number;
28
28
  capacity: number;
29
29
  requested?: number;
30
30
  keyPrefix?: string;
31
31
  expiresIn?: number;
32
32
  }): Promise<RateLimitResult>;
33
- declare function rateLimit(options: RateLimitOptions): MiddlewareHandler;
33
+ export declare function rateLimit(options: RateLimitOptions): MiddlewareHandler;
34
34
  //#endregion
35
- export { KV, RateLimitOptions, RateLimitResult, checkRateLimit, rateLimit };
36
35
  //# sourceMappingURL=rate-limit.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate-limit.d.cts","names":[],"sources":["../../src/hono/rate-limit.ts"],"mappings":";;UAKiB;EACf,QAAQ,aAAa,eAAe,qBAAqB;EACzD,QAAQ,cAAc;EACtB,WAAW,cAAc;;UAQV;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA,iBAAiB,GAAG;EACpB,iBAAiB,GAAG,SAAS,uBAAuB,WAAW,QAAQ;EACvE,QAAQ,GAAG,sBAAsB;;UAGlB;EACf;EACA;EACA;EACA;EACA;;iBAiCoB,eACpB,IAAI,IACJ,oBACA;EACE;EACA;EACA;EACA;EACA;IAED,QAAQ;iBAqCK,UAAU,SAAS,mBAAmB"}
1
+ {"version":3,"file":"rate-limit.d.cts","names":[],"sources":["../../src/hono/rate-limit.ts"],"mappings":";;iBAKiB;EACf,QAAQ,aAAa,eAAe,qBAAqB;EACzD,QAAQ,cAAc;EACtB,WAAW,cAAc;;iBAQV;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA,iBAAiB,GAAG;EACpB,iBAAiB,GAAG,SAAS,uBAAuB,WAAW,QAAQ;EACvE,QAAQ,GAAG,sBAAsB;;iBAGlB;EACf;EACA;EACA;EACA;EACA;;wBAiCoB,eACpB,IAAI,IACJ,oBACA;EACE;EACA;EACA;EACA;EACA;IAED,QAAQ;wBAqCK,UAAU,SAAS,mBAAmB"}
@@ -1,11 +1,11 @@
1
1
  import { Context, MiddlewareHandler } from "hono";
2
2
  //#region src/hono/rate-limit.d.ts
3
- interface KV {
3
+ export interface KV {
4
4
  setItem(key: string, value: string, expiresIn?: number): Promise<void>;
5
5
  getItem(key: string): Promise<string | null>;
6
6
  removeItem(key: string): Promise<void>;
7
7
  }
8
- interface RateLimitOptions {
8
+ export interface RateLimitOptions {
9
9
  kv: KV;
10
10
  rate: number;
11
11
  capacity: number;
@@ -16,21 +16,20 @@ interface RateLimitOptions {
16
16
  onRateLimited?: (c: Context, retryAfter: number) => Response | Promise<Response>;
17
17
  skip?: (c: Context) => boolean | Promise<boolean>;
18
18
  }
19
- interface RateLimitResult {
19
+ export interface RateLimitResult {
20
20
  allowed: boolean;
21
21
  remaining: number;
22
22
  limit: number;
23
23
  reset: number;
24
24
  retryAfter?: number;
25
25
  }
26
- declare function checkRateLimit(kv: KV, identifier: string, options: {
26
+ export declare function checkRateLimit(kv: KV, identifier: string, options: {
27
27
  rate: number;
28
28
  capacity: number;
29
29
  requested?: number;
30
30
  keyPrefix?: string;
31
31
  expiresIn?: number;
32
32
  }): Promise<RateLimitResult>;
33
- declare function rateLimit(options: RateLimitOptions): MiddlewareHandler;
33
+ export declare function rateLimit(options: RateLimitOptions): MiddlewareHandler;
34
34
  //#endregion
35
- export { KV, RateLimitOptions, RateLimitResult, checkRateLimit, rateLimit };
36
35
  //# sourceMappingURL=rate-limit.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate-limit.d.mts","names":[],"sources":["../../src/hono/rate-limit.ts"],"mappings":";;UAKiB;EACf,QAAQ,aAAa,eAAe,qBAAqB;EACzD,QAAQ,cAAc;EACtB,WAAW,cAAc;;UAQV;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA,iBAAiB,GAAG;EACpB,iBAAiB,GAAG,SAAS,uBAAuB,WAAW,QAAQ;EACvE,QAAQ,GAAG,sBAAsB;;UAGlB;EACf;EACA;EACA;EACA;EACA;;iBAiCoB,eACpB,IAAI,IACJ,oBACA;EACE;EACA;EACA;EACA;EACA;IAED,QAAQ;iBAqCK,UAAU,SAAS,mBAAmB"}
1
+ {"version":3,"file":"rate-limit.d.mts","names":[],"sources":["../../src/hono/rate-limit.ts"],"mappings":";;iBAKiB;EACf,QAAQ,aAAa,eAAe,qBAAqB;EACzD,QAAQ,cAAc;EACtB,WAAW,cAAc;;iBAQV;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA,iBAAiB,GAAG;EACpB,iBAAiB,GAAG,SAAS,uBAAuB,WAAW,QAAQ;EACvE,QAAQ,GAAG,sBAAsB;;iBAGlB;EACf;EACA;EACA;EACA;EACA;;wBAiCoB,eACpB,IAAI,IACJ,oBACA;EACE;EACA;EACA;EACA;EACA;IAED,QAAQ;wBAqCK,UAAU,SAAS,mBAAmB"}
@@ -4,21 +4,46 @@ const require_error_status = require("../error/status.cjs");
4
4
  let zod_mini = require("zod/mini");
5
5
  let hono_validator = require("hono/validator");
6
6
  //#region src/hono/validator.ts
7
+ /** Validates with the schema; a violation is an `INVALID_ARGUMENT` listing every field. */
8
+ async function check(schema, value) {
9
+ const result = await schema.safeParseAsync(value);
10
+ if (result.success) return result.data;
11
+ const fieldViolations = result.error.issues.map(({ code, path, message }) => ({
12
+ field: path.join("."),
13
+ description: message,
14
+ reason: code.toUpperCase(),
15
+ localizedMessage: {
16
+ locale: "en-US",
17
+ message
18
+ }
19
+ }));
20
+ const details = require_error_detail.Details.new().badRequest({ fieldViolations });
21
+ throw require_error_status.Status.invalidArgument().error(details);
22
+ }
7
23
  function zValidator(target, schema) {
8
- return (0, hono_validator.validator)(target, async (value) => {
9
- const result = await schema.safeParseAsync(value);
10
- if (result.success) return result.data;
11
- const fieldViolations = result.error.issues.map(({ code, path, message }) => ({
12
- field: path.join("."),
13
- description: message,
14
- reason: code.toUpperCase(),
15
- localizedMessage: {
16
- locale: "en-US",
17
- message
18
- }
19
- }));
20
- const details = require_error_detail.Details.new().badRequest({ fieldViolations });
21
- throw require_error_status.Status.invalidArgument().error(details);
24
+ return (0, hono_validator.validator)(target, (value) => check(schema, value));
25
+ }
26
+ const TEXT_PLAIN = /^text\/plain\b/i;
27
+ /**
28
+ * A JSON body that may also arrive as `text/plain`, validated as `json`: what a browser sends with
29
+ * `navigator.sendBeacon` to stay a CORS simple request. As `application/json` a cross-origin
30
+ * beacon needs a preflight, which a page being closed often cannot complete, and the beacon is
31
+ * then dropped — exactly the one sent as the visitor leaves. Hono's `json` target reads any
32
+ * content type but JSON as `{}`, so the text is parsed here. Anything else is read as before.
33
+ *
34
+ * Use it on the routes a beacon is sent to, and only there: it widens what a cross-site page can
35
+ * post without a preflight, which is harmless for an endpoint that takes no credentials.
36
+ */
37
+ function zBeaconJson(schema) {
38
+ return (0, hono_validator.validator)("json", async (value, c) => {
39
+ if (!TEXT_PLAIN.test(c.req.header("Content-Type") ?? "")) return check(schema, value);
40
+ let body;
41
+ try {
42
+ body = JSON.parse(await c.req.text());
43
+ } catch {
44
+ throw require_error_status.Status.invalidArgument("Malformed JSON in request body").error();
45
+ }
46
+ return check(schema, body);
22
47
  });
23
48
  }
24
49
  const bigintId = (0, zod_mini.pipe)((0, zod_mini.string)(), (0, zod_mini.transform)((input, ctx) => {
@@ -45,6 +70,7 @@ const bigintId = (0, zod_mini.pipe)((0, zod_mini.string)(), (0, zod_mini.transfo
45
70
  }));
46
71
  //#endregion
47
72
  exports.bigintId = bigintId;
73
+ exports.zBeaconJson = zBeaconJson;
48
74
  exports.zValidator = zValidator;
49
75
 
50
76
  //# sourceMappingURL=validator.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator.cjs","names":["validator","Details","Status","pipe","string","transform","NEVER"],"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\nexport function zValidator<S extends ZodType | ZodMiniType>(\n target: keyof ValidationTargets,\n schema: S\n) {\n return validator(target, async (value) => {\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}\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":";;;;;;AAcA,SAAgB,WACd,QACA,QACA;CACA,QAAA,GAAOA,eAAAA,UAAAA,CAAU,QAAQ,OAAO,UAAU;EACxC,MAAM,SAAS,MAAM,OAAO,eAAe,KAAK;EAChD,IAAI,OAAO,SAAS,OAAO,OAAO;EAElC,MAAM,kBAAiD,OAAO,MAAM,OAAO,KACxE,EAAE,MAAM,MAAM,eAAe;GAC5B,OAAO,KAAK,KAAK,GAAG;GACpB,aAAa;GACb,QAAQ,KAAK,YAAY;GACzB,kBAAkB;IAAE,QAAQ;IAAS;GAAQ;EAC/C,EACF;EACA,MAAM,UAAUC,qBAAAA,QAAQ,IAAI,CAAC,CAAC,WAAW,EAAE,gBAAgB,CAAC;EAC5D,MAAMC,qBAAAA,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO;CAC9C,CAAC;AACH;AAEA,MAAa,YAAA,GAAWC,SAAAA,KAAAA,EAAAA,GACtBC,SAAAA,OAAAA,CAAO,IAAA,GACPC,SAAAA,UAAAA,EAAW,OAAO,QAAQ;CACxB,IAAI,CAAC,sBAAsB,KAAK,KAAK,GAAG;EACtC,MAAM,UAAU,sBAAsB;EACtC,IAAI,OAAO,KAAK;GAAE,MAAM;GAAU;GAAO;EAAQ,CAAC;EAClD,OAAOC,SAAAA;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,OAAOA,SAAAA;CACT;AACF,CAAC,CACH"}
1
+ {"version":3,"file":"validator.cjs","names":["Details","Status","validator","pipe","string","transform","NEVER"],"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,UAAUA,qBAAAA,QAAQ,IAAI,CAAC,CAAC,WAAW,EAAE,gBAAgB,CAAC;CAC5D,MAAMC,qBAAAA,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO;AAC9C;AAEA,SAAgB,WACd,QACA,QACA;CACA,QAAA,GAAOC,eAAAA,UAAAA,CAAU,SAAS,UAAU,MAAM,QAAQ,KAAK,CAAC;AAC1D;AAEA,MAAM,aAAa;;;;;;;;;;;AAYnB,SAAgB,YAA6C,QAAW;CACtE,QAAA,GAAOA,eAAAA,UAAAA,CAAU,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,MAAMD,qBAAAA,OAAO,gBAAgB,gCAAgC,CAAC,CAAC,MAAM;EACvE;EACA,OAAO,MAAM,QAAQ,IAAI;CAC3B,CAAC;AACH;AAEA,MAAa,YAAA,GAAWE,SAAAA,KAAAA,EAAAA,GACtBC,SAAAA,OAAAA,CAAO,IAAA,GACPC,SAAAA,UAAAA,EAAW,OAAO,QAAQ;CACxB,IAAI,CAAC,sBAAsB,KAAK,KAAK,GAAG;EACtC,MAAM,UAAU,sBAAsB;EACtC,IAAI,OAAO,KAAK;GAAE,MAAM;GAAU;GAAO;EAAQ,CAAC;EAClD,OAAOC,SAAAA;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,OAAOA,SAAAA;CACT;AACF,CAAC,CACH"}