@shware/http 1.2.0 → 1.2.2

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 (208) hide show
  1. package/README.md +1 -3
  2. package/dist/__tests__/index.test.cjs +27 -0
  3. package/dist/__tests__/index.test.cjs.map +1 -0
  4. package/dist/__tests__/index.test.d.cts +2 -0
  5. package/dist/__tests__/index.test.d.ts +2 -0
  6. package/dist/__tests__/index.test.mjs +25 -0
  7. package/dist/__tests__/index.test.mjs.map +1 -0
  8. package/dist/cache/index.cjs +32 -0
  9. package/dist/cache/index.cjs.map +1 -0
  10. package/dist/cache/index.d.cts +9 -0
  11. package/dist/cache/index.d.ts +9 -0
  12. package/dist/cache/index.mjs +7 -0
  13. package/dist/cache/index.mjs.map +1 -0
  14. package/dist/error/detail.cjs +93 -0
  15. package/dist/error/detail.cjs.map +1 -0
  16. package/dist/error/detail.d.cts +99 -0
  17. package/dist/error/detail.d.ts +99 -0
  18. package/dist/error/detail.mjs +67 -0
  19. package/dist/error/detail.mjs.map +1 -0
  20. package/dist/error/i18n/en-us.cjs +31 -0
  21. package/dist/error/i18n/en-us.cjs.map +1 -0
  22. package/dist/error/i18n/en-us.d.cts +3 -0
  23. package/dist/error/i18n/en-us.d.ts +3 -0
  24. package/dist/error/i18n/en-us.mjs +6 -0
  25. package/dist/error/i18n/en-us.mjs.map +1 -0
  26. package/dist/error/index.cjs +63 -0
  27. package/dist/error/index.cjs.map +1 -0
  28. package/dist/error/index.d.cts +19 -0
  29. package/dist/error/index.d.ts +19 -0
  30. package/dist/error/index.mjs +35 -0
  31. package/dist/error/index.mjs.map +1 -0
  32. package/dist/error/parse.cjs +52 -0
  33. package/dist/error/parse.cjs.map +1 -0
  34. package/dist/error/parse.d.cts +16 -0
  35. package/dist/error/parse.d.ts +16 -0
  36. package/dist/error/parse.mjs +27 -0
  37. package/dist/error/parse.mjs.map +1 -0
  38. package/dist/error/reason.cjs +19 -0
  39. package/dist/error/reason.cjs.map +1 -0
  40. package/dist/error/reason.d.cts +66 -0
  41. package/dist/error/reason.d.ts +66 -0
  42. package/dist/error/reason.mjs +1 -0
  43. package/dist/error/reason.mjs.map +1 -0
  44. package/dist/error/status.cjs +263 -0
  45. package/dist/error/status.cjs.map +1 -0
  46. package/dist/error/status.d.cts +69 -0
  47. package/dist/error/status.d.ts +69 -0
  48. package/dist/error/status.mjs +234 -0
  49. package/dist/error/status.mjs.map +1 -0
  50. package/dist/google-one-tap/index.cjs +51 -0
  51. package/dist/google-one-tap/index.cjs.map +1 -0
  52. package/dist/google-one-tap/index.d.cts +17 -0
  53. package/dist/google-one-tap/index.d.ts +17 -0
  54. package/dist/google-one-tap/index.mjs +26 -0
  55. package/dist/google-one-tap/index.mjs.map +1 -0
  56. package/dist/google-one-tap/types.cjs +19 -0
  57. package/dist/google-one-tap/types.cjs.map +1 -0
  58. package/dist/google-one-tap/types.d.cts +155 -0
  59. package/dist/google-one-tap/types.d.ts +155 -0
  60. package/dist/google-one-tap/types.mjs +1 -0
  61. package/dist/google-one-tap/types.mjs.map +1 -0
  62. package/dist/hono/__tests__/authorizer.test.cjs +483 -0
  63. package/dist/hono/__tests__/authorizer.test.cjs.map +1 -0
  64. package/dist/hono/__tests__/authorizer.test.d.cts +2 -0
  65. package/dist/hono/__tests__/authorizer.test.d.ts +2 -0
  66. package/dist/hono/__tests__/authorizer.test.mjs +481 -0
  67. package/dist/hono/__tests__/authorizer.test.mjs.map +1 -0
  68. package/dist/hono/__tests__/csrf.test.cjs +162 -0
  69. package/dist/hono/__tests__/csrf.test.cjs.map +1 -0
  70. package/dist/hono/__tests__/csrf.test.d.cts +2 -0
  71. package/dist/hono/__tests__/csrf.test.d.ts +2 -0
  72. package/dist/hono/__tests__/csrf.test.mjs +160 -0
  73. package/dist/hono/__tests__/csrf.test.mjs.map +1 -0
  74. package/dist/hono/authorizer.cjs +67 -0
  75. package/dist/hono/authorizer.cjs.map +1 -0
  76. package/dist/hono/authorizer.d.cts +18 -0
  77. package/dist/hono/authorizer.d.ts +18 -0
  78. package/dist/hono/authorizer.mjs +42 -0
  79. package/dist/hono/authorizer.mjs.map +1 -0
  80. package/dist/hono/csrf.cjs +95 -0
  81. package/dist/hono/csrf.cjs.map +1 -0
  82. package/dist/hono/csrf.d.cts +65 -0
  83. package/dist/hono/csrf.d.ts +65 -0
  84. package/dist/hono/csrf.mjs +70 -0
  85. package/dist/hono/csrf.mjs.map +1 -0
  86. package/dist/hono/geolocation.cjs +75 -0
  87. package/dist/hono/geolocation.cjs.map +1 -0
  88. package/dist/hono/geolocation.d.cts +17 -0
  89. package/dist/hono/geolocation.d.ts +17 -0
  90. package/dist/hono/geolocation.mjs +50 -0
  91. package/dist/hono/geolocation.mjs.map +1 -0
  92. package/dist/hono/handler.cjs +68 -0
  93. package/dist/hono/handler.cjs.map +1 -0
  94. package/dist/hono/handler.d.cts +13 -0
  95. package/dist/hono/handler.d.ts +13 -0
  96. package/dist/hono/handler.mjs +42 -0
  97. package/dist/hono/handler.mjs.map +1 -0
  98. package/dist/hono/index.cjs +45 -0
  99. package/dist/hono/index.cjs.map +1 -0
  100. package/dist/hono/index.d.cts +12 -0
  101. package/dist/hono/index.d.ts +12 -0
  102. package/dist/hono/index.mjs +15 -0
  103. package/dist/hono/index.mjs.map +1 -0
  104. package/dist/hono/validator.cjs +64 -0
  105. package/dist/hono/validator.cjs.map +1 -0
  106. package/dist/hono/validator.d.cts +28 -0
  107. package/dist/hono/validator.d.ts +28 -0
  108. package/dist/hono/validator.mjs +38 -0
  109. package/dist/hono/validator.mjs.map +1 -0
  110. package/dist/index-BnPgRQDl.d.cts +129 -0
  111. package/dist/index-BnPgRQDl.d.ts +129 -0
  112. package/dist/index.cjs +91 -0
  113. package/dist/index.cjs.map +1 -0
  114. package/dist/index.d.cts +18 -0
  115. package/dist/index.d.ts +18 -0
  116. package/dist/index.mjs +46 -0
  117. package/dist/index.mjs.map +1 -0
  118. package/dist/iso/iso_3601_1.cjs +292 -0
  119. package/dist/iso/iso_3601_1.cjs.map +1 -0
  120. package/dist/iso/iso_3601_1.d.cts +9 -0
  121. package/dist/iso/iso_3601_1.d.ts +9 -0
  122. package/dist/iso/iso_3601_1.mjs +267 -0
  123. package/dist/iso/iso_3601_1.mjs.map +1 -0
  124. package/dist/max-length/index.cjs +94 -0
  125. package/dist/max-length/index.cjs.map +1 -0
  126. package/dist/max-length/index.d.cts +1 -0
  127. package/dist/max-length/index.d.ts +1 -0
  128. package/dist/max-length/index.mjs +48 -0
  129. package/dist/max-length/index.mjs.map +1 -0
  130. package/dist/message.cjs +32 -0
  131. package/dist/message.cjs.map +1 -0
  132. package/dist/message.d.cts +3 -0
  133. package/dist/message.d.ts +3 -0
  134. package/dist/message.mjs +7 -0
  135. package/dist/message.mjs.map +1 -0
  136. package/dist/polyfills/index.cjs +7 -0
  137. package/dist/polyfills/index.cjs.map +1 -0
  138. package/dist/polyfills/index.d.cts +2 -0
  139. package/dist/polyfills/index.d.ts +2 -0
  140. package/dist/polyfills/index.mjs +5 -0
  141. package/dist/polyfills/index.mjs.map +1 -0
  142. package/dist/response.cjs +73 -0
  143. package/dist/response.cjs.map +1 -0
  144. package/dist/response.d.cts +65 -0
  145. package/dist/response.d.ts +65 -0
  146. package/dist/response.mjs +44 -0
  147. package/dist/response.mjs.map +1 -0
  148. package/dist/snowflake.cjs +75 -0
  149. package/dist/snowflake.cjs.map +1 -0
  150. package/dist/snowflake.d.cts +29 -0
  151. package/dist/snowflake.d.ts +29 -0
  152. package/dist/snowflake.mjs +49 -0
  153. package/dist/snowflake.mjs.map +1 -0
  154. package/dist/utils/__tests__/ip.test.cjs +38 -0
  155. package/dist/utils/__tests__/ip.test.cjs.map +1 -0
  156. package/dist/utils/__tests__/ip.test.d.cts +2 -0
  157. package/dist/utils/__tests__/ip.test.d.ts +2 -0
  158. package/dist/utils/__tests__/ip.test.mjs +36 -0
  159. package/dist/utils/__tests__/ip.test.mjs.map +1 -0
  160. package/dist/utils/invariant.cjs +37 -0
  161. package/dist/utils/invariant.cjs.map +1 -0
  162. package/dist/utils/invariant.d.cts +3 -0
  163. package/dist/utils/invariant.d.ts +3 -0
  164. package/dist/utils/invariant.mjs +12 -0
  165. package/dist/utils/invariant.mjs.map +1 -0
  166. package/dist/utils/ip.cjs +53 -0
  167. package/dist/utils/ip.cjs.map +1 -0
  168. package/dist/utils/ip.d.cts +3 -0
  169. package/dist/utils/ip.d.ts +3 -0
  170. package/dist/utils/ip.mjs +28 -0
  171. package/dist/utils/ip.mjs.map +1 -0
  172. package/dist/utils/promise.cjs +47 -0
  173. package/dist/utils/promise.cjs.map +1 -0
  174. package/dist/utils/promise.d.cts +3 -0
  175. package/dist/utils/promise.d.ts +3 -0
  176. package/dist/utils/promise.mjs +22 -0
  177. package/dist/utils/promise.mjs.map +1 -0
  178. package/dist/utils/string.cjs +33 -0
  179. package/dist/utils/string.cjs.map +1 -0
  180. package/dist/utils/string.d.cts +6 -0
  181. package/dist/utils/string.d.ts +6 -0
  182. package/dist/utils/string.mjs +8 -0
  183. package/dist/utils/string.mjs.map +1 -0
  184. package/dist/utils/timing.cjs +74 -0
  185. package/dist/utils/timing.cjs.map +1 -0
  186. package/dist/utils/timing.d.cts +13 -0
  187. package/dist/utils/timing.d.ts +13 -0
  188. package/dist/utils/timing.mjs +49 -0
  189. package/dist/utils/timing.mjs.map +1 -0
  190. package/dist/utils/token-bucket.cjs +73 -0
  191. package/dist/utils/token-bucket.cjs.map +1 -0
  192. package/dist/utils/token-bucket.d.cts +20 -0
  193. package/dist/utils/token-bucket.d.ts +20 -0
  194. package/dist/utils/token-bucket.mjs +48 -0
  195. package/dist/utils/token-bucket.mjs.map +1 -0
  196. package/dist/vaild.cjs +51 -0
  197. package/dist/vaild.cjs.map +1 -0
  198. package/dist/vaild.d.cts +13 -0
  199. package/dist/vaild.d.ts +13 -0
  200. package/dist/vaild.mjs +26 -0
  201. package/dist/vaild.mjs.map +1 -0
  202. package/dist/webhook/index.cjs +77 -0
  203. package/dist/webhook/index.cjs.map +1 -0
  204. package/dist/webhook/index.d.cts +10 -0
  205. package/dist/webhook/index.d.ts +10 -0
  206. package/dist/webhook/index.mjs +52 -0
  207. package/dist/webhook/index.mjs.map +1 -0
  208. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,4 @@
1
- # Client Side Error Handling
2
-
3
- # Server Side Error Handling
1
+ # Error Handling
4
2
 
5
3
  ## hono example
6
4
 
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ // src/__tests__/index.test.ts
4
+ var import__ = require("../index.cjs");
5
+ describe("error details", () => {
6
+ test("test detail list constructor", () => {
7
+ const details = import__.Details.new().requestInfo({ requestId: "123456", servingData: "/v1/tests" }).errorInfo({ reason: "ACCESS_DENIED" });
8
+ expect(details.list).toEqual([
9
+ {
10
+ type: import__.DetailType.REQUEST_INFO,
11
+ requestId: "123456",
12
+ servingData: "/v1/tests"
13
+ },
14
+ {
15
+ type: import__.DetailType.ERROR_INFO,
16
+ reason: "ACCESS_DENIED"
17
+ }
18
+ ]);
19
+ });
20
+ });
21
+ describe("error status", () => {
22
+ test("status type", () => {
23
+ const error = import__.Status.invalidArgument().error();
24
+ expect(error instanceof import__.StatusError).toBe(true);
25
+ });
26
+ });
27
+ //# sourceMappingURL=index.test.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/__tests__/index.test.ts"],"sourcesContent":["import { DetailType, Details, Status, StatusError } from '../index';\n\ndescribe('error details', () => {\n test('test detail list constructor', () => {\n const details = Details.new()\n .requestInfo({ requestId: '123456', servingData: '/v1/tests' })\n .errorInfo({ reason: 'ACCESS_DENIED' });\n\n expect(details.list).toEqual([\n {\n type: DetailType.REQUEST_INFO,\n requestId: '123456',\n servingData: '/v1/tests',\n },\n {\n type: DetailType.ERROR_INFO,\n reason: 'ACCESS_DENIED',\n },\n ]);\n });\n});\n\ndescribe('error status', () => {\n test('status type', () => {\n const error = Status.invalidArgument().error();\n expect(error instanceof StatusError).toBe(true);\n });\n});\n"],"mappings":";;;AAAA,eAAyD;AAEzD,SAAS,iBAAiB,MAAM;AAC9B,OAAK,gCAAgC,MAAM;AACzC,UAAM,UAAU,iBAAQ,IAAI,EACzB,YAAY,EAAE,WAAW,UAAU,aAAa,YAAY,CAAC,EAC7D,UAAU,EAAE,QAAQ,gBAAgB,CAAC;AAExC,WAAO,QAAQ,IAAI,EAAE,QAAQ;AAAA,MAC3B;AAAA,QACE,MAAM,oBAAW;AAAA,QACjB,WAAW;AAAA,QACX,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM,oBAAW;AAAA,QACjB,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,MAAM;AAC7B,OAAK,eAAe,MAAM;AACxB,UAAM,QAAQ,gBAAO,gBAAgB,EAAE,MAAM;AAC7C,WAAO,iBAAiB,oBAAW,EAAE,KAAK,IAAI;AAAA,EAChD,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,25 @@
1
+ // src/__tests__/index.test.ts
2
+ import { DetailType, Details, Status, StatusError } from "../index.mjs";
3
+ describe("error details", () => {
4
+ test("test detail list constructor", () => {
5
+ const details = Details.new().requestInfo({ requestId: "123456", servingData: "/v1/tests" }).errorInfo({ reason: "ACCESS_DENIED" });
6
+ expect(details.list).toEqual([
7
+ {
8
+ type: DetailType.REQUEST_INFO,
9
+ requestId: "123456",
10
+ servingData: "/v1/tests"
11
+ },
12
+ {
13
+ type: DetailType.ERROR_INFO,
14
+ reason: "ACCESS_DENIED"
15
+ }
16
+ ]);
17
+ });
18
+ });
19
+ describe("error status", () => {
20
+ test("status type", () => {
21
+ const error = Status.invalidArgument().error();
22
+ expect(error instanceof StatusError).toBe(true);
23
+ });
24
+ });
25
+ //# sourceMappingURL=index.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/__tests__/index.test.ts"],"sourcesContent":["import { DetailType, Details, Status, StatusError } from '../index';\n\ndescribe('error details', () => {\n test('test detail list constructor', () => {\n const details = Details.new()\n .requestInfo({ requestId: '123456', servingData: '/v1/tests' })\n .errorInfo({ reason: 'ACCESS_DENIED' });\n\n expect(details.list).toEqual([\n {\n type: DetailType.REQUEST_INFO,\n requestId: '123456',\n servingData: '/v1/tests',\n },\n {\n type: DetailType.ERROR_INFO,\n reason: 'ACCESS_DENIED',\n },\n ]);\n });\n});\n\ndescribe('error status', () => {\n test('status type', () => {\n const error = Status.invalidArgument().error();\n expect(error instanceof StatusError).toBe(true);\n });\n});\n"],"mappings":";AAAA,SAAS,YAAY,SAAS,QAAQ,mBAAmB;AAEzD,SAAS,iBAAiB,MAAM;AAC9B,OAAK,gCAAgC,MAAM;AACzC,UAAM,UAAU,QAAQ,IAAI,EACzB,YAAY,EAAE,WAAW,UAAU,aAAa,YAAY,CAAC,EAC7D,UAAU,EAAE,QAAQ,gBAAgB,CAAC;AAExC,WAAO,QAAQ,IAAI,EAAE,QAAQ;AAAA,MAC3B;AAAA,QACE,MAAM,WAAW;AAAA,QACjB,WAAW;AAAA,QACX,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM,WAAW;AAAA,QACjB,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,MAAM;AAC7B,OAAK,eAAe,MAAM;AACxB,UAAM,QAAQ,OAAO,gBAAgB,EAAE,MAAM;AAC7C,WAAO,iBAAiB,WAAW,EAAE,KAAK,IAAI;AAAA,EAChD,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/cache/index.ts
21
+ var cache_exports = {};
22
+ __export(cache_exports, {
23
+ cache: () => cache
24
+ });
25
+ module.exports = __toCommonJS(cache_exports);
26
+ function cache(_props) {
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ cache
31
+ });
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cache/index.ts"],"sourcesContent":["interface Props<A extends unknown[], R> {\n name: string;\n key: (...args: A) => string;\n fn: (...args: A) => R;\n condition?: (...args: A) => boolean;\n}\n\nexport function cache<A extends unknown[], R>(_props: Props<A, R>) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,MAA8B,QAAqB;AAAC;","names":[]}
@@ -0,0 +1,9 @@
1
+ interface Props<A extends unknown[], R> {
2
+ name: string;
3
+ key: (...args: A) => string;
4
+ fn: (...args: A) => R;
5
+ condition?: (...args: A) => boolean;
6
+ }
7
+ declare function cache<A extends unknown[], R>(_props: Props<A, R>): void;
8
+
9
+ export { cache };
@@ -0,0 +1,9 @@
1
+ interface Props<A extends unknown[], R> {
2
+ name: string;
3
+ key: (...args: A) => string;
4
+ fn: (...args: A) => R;
5
+ condition?: (...args: A) => boolean;
6
+ }
7
+ declare function cache<A extends unknown[], R>(_props: Props<A, R>): void;
8
+
9
+ export { cache };
@@ -0,0 +1,7 @@
1
+ // src/cache/index.ts
2
+ function cache(_props) {
3
+ }
4
+ export {
5
+ cache
6
+ };
7
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cache/index.ts"],"sourcesContent":["interface Props<A extends unknown[], R> {\n name: string;\n key: (...args: A) => string;\n fn: (...args: A) => R;\n condition?: (...args: A) => boolean;\n}\n\nexport function cache<A extends unknown[], R>(_props: Props<A, R>) {}\n"],"mappings":";AAOO,SAAS,MAA8B,QAAqB;AAAC;","names":[]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/error/detail.ts
21
+ var detail_exports = {};
22
+ __export(detail_exports, {
23
+ DetailType: () => DetailType,
24
+ Details: () => Details
25
+ });
26
+ module.exports = __toCommonJS(detail_exports);
27
+ var DetailType = /* @__PURE__ */ ((DetailType2) => {
28
+ DetailType2["ERROR_INFO"] = "ERROR_INFO";
29
+ DetailType2["RETRY_INFO"] = "RETRY_INFO";
30
+ DetailType2["DEBUG_INFO"] = "DEBUG_INFO";
31
+ DetailType2["QUOTA_FAILURE"] = "QUOTA_FAILURE";
32
+ DetailType2["PRECONDITION_FAILURE"] = "PRECONDITION_FAILURE";
33
+ DetailType2["BAD_REQUEST"] = "BAD_REQUEST";
34
+ DetailType2["REQUEST_INFO"] = "REQUEST_INFO";
35
+ DetailType2["RESOURCE_INFO"] = "RESOURCE_INFO";
36
+ DetailType2["HELP"] = "HELP";
37
+ DetailType2["LOCALIZED_MESSAGE"] = "LOCALIZED_MESSAGE";
38
+ return DetailType2;
39
+ })(DetailType || {});
40
+ var Details = class _Details {
41
+ list = [];
42
+ constructor() {
43
+ }
44
+ static new() {
45
+ return new _Details();
46
+ }
47
+ errorInfo(detail) {
48
+ this.list.push({ type: "ERROR_INFO" /* ERROR_INFO */, ...detail });
49
+ return this;
50
+ }
51
+ retryInfo(detail) {
52
+ this.list.push({ type: "RETRY_INFO" /* RETRY_INFO */, ...detail });
53
+ return this;
54
+ }
55
+ debugInfo(detail) {
56
+ this.list.push({ type: "DEBUG_INFO" /* DEBUG_INFO */, ...detail });
57
+ return this;
58
+ }
59
+ quotaFailure(detail) {
60
+ this.list.push({ type: "QUOTA_FAILURE" /* QUOTA_FAILURE */, ...detail });
61
+ return this;
62
+ }
63
+ preconditionFailure(detail) {
64
+ this.list.push({ type: "PRECONDITION_FAILURE" /* PRECONDITION_FAILURE */, ...detail });
65
+ return this;
66
+ }
67
+ badRequest(detail) {
68
+ this.list.push({ type: "BAD_REQUEST" /* BAD_REQUEST */, ...detail });
69
+ return this;
70
+ }
71
+ requestInfo(detail) {
72
+ this.list.push({ type: "REQUEST_INFO" /* REQUEST_INFO */, ...detail });
73
+ return this;
74
+ }
75
+ resourceInfo(detail) {
76
+ this.list.push({ type: "RESOURCE_INFO" /* RESOURCE_INFO */, ...detail });
77
+ return this;
78
+ }
79
+ help(detail) {
80
+ this.list.push({ type: "HELP" /* HELP */, ...detail });
81
+ return this;
82
+ }
83
+ localizedMessage(detail) {
84
+ this.list.push({ type: "LOCALIZED_MESSAGE" /* LOCALIZED_MESSAGE */, ...detail });
85
+ return this;
86
+ }
87
+ };
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ DetailType,
91
+ Details
92
+ });
93
+ //# sourceMappingURL=detail.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/error/detail.ts"],"sourcesContent":["import type { ErrorReason } from './reason';\n\nexport enum DetailType {\n ERROR_INFO = 'ERROR_INFO',\n RETRY_INFO = 'RETRY_INFO',\n DEBUG_INFO = 'DEBUG_INFO',\n QUOTA_FAILURE = 'QUOTA_FAILURE',\n PRECONDITION_FAILURE = 'PRECONDITION_FAILURE',\n BAD_REQUEST = 'BAD_REQUEST',\n REQUEST_INFO = 'REQUEST_INFO',\n RESOURCE_INFO = 'RESOURCE_INFO',\n HELP = 'HELP',\n LOCALIZED_MESSAGE = 'LOCALIZED_MESSAGE',\n}\n\nexport interface ErrorInfo {\n type: DetailType.ERROR_INFO;\n reason: keyof ErrorReason | (string & {});\n domain?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface RetryInfo {\n type: DetailType.RETRY_INFO;\n retryDelay: number;\n}\n\nexport interface DebugInfo {\n type: DetailType.DEBUG_INFO;\n stackEntries: string[];\n detail?: string;\n}\n\nexport interface QuotaFailure {\n type: DetailType.QUOTA_FAILURE;\n violations: { subject: string; description: string }[];\n}\n\nexport interface PreconditionFailure {\n type: DetailType.PRECONDITION_FAILURE;\n violations: { type: string; subject: string; description: string }[];\n}\n\nexport interface BadRequest {\n type: DetailType.BAD_REQUEST;\n fieldViolations: { field: string; description: string }[];\n}\n\nexport interface RequestInfo {\n type: DetailType.REQUEST_INFO;\n requestId: string;\n servingData: string;\n}\n\nexport interface ResourceInfo {\n type: DetailType.RESOURCE_INFO;\n resourceType: string;\n resourceName: string;\n owner: string;\n description: string;\n}\n\nexport interface Help {\n type: DetailType.HELP;\n links: { url: string; description: string }[];\n}\n\nexport interface LocalizedMessage {\n type: DetailType.LOCALIZED_MESSAGE;\n locale: string;\n message: string;\n}\n\nexport type Detail =\n | RetryInfo\n | DebugInfo\n | QuotaFailure\n | ErrorInfo\n | PreconditionFailure\n | BadRequest\n | RequestInfo\n | ResourceInfo\n | Help\n | LocalizedMessage;\n\n/**\n * Example usage:\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n * */\nexport class Details {\n readonly list: Detail[] = [];\n private constructor() {}\n\n static new() {\n return new Details();\n }\n\n errorInfo(detail: Omit<ErrorInfo, 'type'>) {\n this.list.push({ type: DetailType.ERROR_INFO, ...detail });\n return this;\n }\n\n retryInfo(detail: Omit<RetryInfo, 'type'>) {\n this.list.push({ type: DetailType.RETRY_INFO, ...detail });\n return this;\n }\n\n debugInfo(detail: Omit<DebugInfo, 'type'>) {\n this.list.push({ type: DetailType.DEBUG_INFO, ...detail });\n return this;\n }\n\n quotaFailure(detail: Omit<QuotaFailure, 'type'>) {\n this.list.push({ type: DetailType.QUOTA_FAILURE, ...detail });\n return this;\n }\n\n preconditionFailure(detail: Omit<PreconditionFailure, 'type'>) {\n this.list.push({ type: DetailType.PRECONDITION_FAILURE, ...detail });\n return this;\n }\n\n badRequest(detail: Omit<BadRequest, 'type'>) {\n this.list.push({ type: DetailType.BAD_REQUEST, ...detail });\n return this;\n }\n\n requestInfo(detail: Omit<RequestInfo, 'type'>) {\n this.list.push({ type: DetailType.REQUEST_INFO, ...detail });\n return this;\n }\n\n resourceInfo(detail: Omit<ResourceInfo, 'type'>) {\n this.list.push({ type: DetailType.RESOURCE_INFO, ...detail });\n return this;\n }\n\n help(detail: Omit<Help, 'type'>) {\n this.list.push({ type: DetailType.HELP, ...detail });\n return this;\n }\n\n localizedMessage(detail: Omit<LocalizedMessage, 'type'>) {\n this.list.push({ type: DetailType.LOCALIZED_MESSAGE, ...detail });\n return this;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,mBAAgB;AAChB,EAAAA,YAAA,0BAAuB;AACvB,EAAAA,YAAA,iBAAc;AACd,EAAAA,YAAA,kBAAe;AACf,EAAAA,YAAA,mBAAgB;AAChB,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,uBAAoB;AAVV,SAAAA;AAAA,GAAA;AAyFL,IAAM,UAAN,MAAM,SAAQ;AAAA,EACV,OAAiB,CAAC;AAAA,EACnB,cAAc;AAAA,EAAC;AAAA,EAEvB,OAAO,MAAM;AACX,WAAO,IAAI,SAAQ;AAAA,EACrB;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,QAAoC;AAC/C,SAAK,KAAK,KAAK,EAAE,MAAM,qCAA0B,GAAG,OAAO,CAAC;AAC5D,WAAO;AAAA,EACT;AAAA,EAEA,oBAAoB,QAA2C;AAC7D,SAAK,KAAK,KAAK,EAAE,MAAM,mDAAiC,GAAG,OAAO,CAAC;AACnE,WAAO;AAAA,EACT;AAAA,EAEA,WAAW,QAAkC;AAC3C,SAAK,KAAK,KAAK,EAAE,MAAM,iCAAwB,GAAG,OAAO,CAAC;AAC1D,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,QAAmC;AAC7C,SAAK,KAAK,KAAK,EAAE,MAAM,mCAAyB,GAAG,OAAO,CAAC;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,QAAoC;AAC/C,SAAK,KAAK,KAAK,EAAE,MAAM,qCAA0B,GAAG,OAAO,CAAC;AAC5D,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,QAA4B;AAC/B,SAAK,KAAK,KAAK,EAAE,MAAM,mBAAiB,GAAG,OAAO,CAAC;AACnD,WAAO;AAAA,EACT;AAAA,EAEA,iBAAiB,QAAwC;AACvD,SAAK,KAAK,KAAK,EAAE,MAAM,6CAA8B,GAAG,OAAO,CAAC;AAChE,WAAO;AAAA,EACT;AACF;","names":["DetailType"]}
@@ -0,0 +1,99 @@
1
+ import { ErrorReason } from './reason.cjs';
2
+
3
+ declare enum DetailType {
4
+ ERROR_INFO = "ERROR_INFO",
5
+ RETRY_INFO = "RETRY_INFO",
6
+ DEBUG_INFO = "DEBUG_INFO",
7
+ QUOTA_FAILURE = "QUOTA_FAILURE",
8
+ PRECONDITION_FAILURE = "PRECONDITION_FAILURE",
9
+ BAD_REQUEST = "BAD_REQUEST",
10
+ REQUEST_INFO = "REQUEST_INFO",
11
+ RESOURCE_INFO = "RESOURCE_INFO",
12
+ HELP = "HELP",
13
+ LOCALIZED_MESSAGE = "LOCALIZED_MESSAGE"
14
+ }
15
+ interface ErrorInfo {
16
+ type: DetailType.ERROR_INFO;
17
+ reason: keyof ErrorReason | (string & {});
18
+ domain?: string;
19
+ metadata?: Record<string, string>;
20
+ }
21
+ interface RetryInfo {
22
+ type: DetailType.RETRY_INFO;
23
+ retryDelay: number;
24
+ }
25
+ interface DebugInfo {
26
+ type: DetailType.DEBUG_INFO;
27
+ stackEntries: string[];
28
+ detail?: string;
29
+ }
30
+ interface QuotaFailure {
31
+ type: DetailType.QUOTA_FAILURE;
32
+ violations: {
33
+ subject: string;
34
+ description: string;
35
+ }[];
36
+ }
37
+ interface PreconditionFailure {
38
+ type: DetailType.PRECONDITION_FAILURE;
39
+ violations: {
40
+ type: string;
41
+ subject: string;
42
+ description: string;
43
+ }[];
44
+ }
45
+ interface BadRequest {
46
+ type: DetailType.BAD_REQUEST;
47
+ fieldViolations: {
48
+ field: string;
49
+ description: string;
50
+ }[];
51
+ }
52
+ interface RequestInfo {
53
+ type: DetailType.REQUEST_INFO;
54
+ requestId: string;
55
+ servingData: string;
56
+ }
57
+ interface ResourceInfo {
58
+ type: DetailType.RESOURCE_INFO;
59
+ resourceType: string;
60
+ resourceName: string;
61
+ owner: string;
62
+ description: string;
63
+ }
64
+ interface Help {
65
+ type: DetailType.HELP;
66
+ links: {
67
+ url: string;
68
+ description: string;
69
+ }[];
70
+ }
71
+ interface LocalizedMessage {
72
+ type: DetailType.LOCALIZED_MESSAGE;
73
+ locale: string;
74
+ message: string;
75
+ }
76
+ type Detail = RetryInfo | DebugInfo | QuotaFailure | ErrorInfo | PreconditionFailure | BadRequest | RequestInfo | ResourceInfo | Help | LocalizedMessage;
77
+ /**
78
+ * Example usage:
79
+ * const details = Details.new()
80
+ * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })
81
+ * .errorInfo({ reason: 'ACCOUNT_LOCKED' });
82
+ * */
83
+ declare class Details {
84
+ readonly list: Detail[];
85
+ private constructor();
86
+ static new(): Details;
87
+ errorInfo(detail: Omit<ErrorInfo, 'type'>): this;
88
+ retryInfo(detail: Omit<RetryInfo, 'type'>): this;
89
+ debugInfo(detail: Omit<DebugInfo, 'type'>): this;
90
+ quotaFailure(detail: Omit<QuotaFailure, 'type'>): this;
91
+ preconditionFailure(detail: Omit<PreconditionFailure, 'type'>): this;
92
+ badRequest(detail: Omit<BadRequest, 'type'>): this;
93
+ requestInfo(detail: Omit<RequestInfo, 'type'>): this;
94
+ resourceInfo(detail: Omit<ResourceInfo, 'type'>): this;
95
+ help(detail: Omit<Help, 'type'>): this;
96
+ localizedMessage(detail: Omit<LocalizedMessage, 'type'>): this;
97
+ }
98
+
99
+ export { type BadRequest, type DebugInfo, type Detail, DetailType, Details, type ErrorInfo, type Help, type LocalizedMessage, type PreconditionFailure, type QuotaFailure, type RequestInfo, type ResourceInfo, type RetryInfo };
@@ -0,0 +1,99 @@
1
+ import { ErrorReason } from './reason.js';
2
+
3
+ declare enum DetailType {
4
+ ERROR_INFO = "ERROR_INFO",
5
+ RETRY_INFO = "RETRY_INFO",
6
+ DEBUG_INFO = "DEBUG_INFO",
7
+ QUOTA_FAILURE = "QUOTA_FAILURE",
8
+ PRECONDITION_FAILURE = "PRECONDITION_FAILURE",
9
+ BAD_REQUEST = "BAD_REQUEST",
10
+ REQUEST_INFO = "REQUEST_INFO",
11
+ RESOURCE_INFO = "RESOURCE_INFO",
12
+ HELP = "HELP",
13
+ LOCALIZED_MESSAGE = "LOCALIZED_MESSAGE"
14
+ }
15
+ interface ErrorInfo {
16
+ type: DetailType.ERROR_INFO;
17
+ reason: keyof ErrorReason | (string & {});
18
+ domain?: string;
19
+ metadata?: Record<string, string>;
20
+ }
21
+ interface RetryInfo {
22
+ type: DetailType.RETRY_INFO;
23
+ retryDelay: number;
24
+ }
25
+ interface DebugInfo {
26
+ type: DetailType.DEBUG_INFO;
27
+ stackEntries: string[];
28
+ detail?: string;
29
+ }
30
+ interface QuotaFailure {
31
+ type: DetailType.QUOTA_FAILURE;
32
+ violations: {
33
+ subject: string;
34
+ description: string;
35
+ }[];
36
+ }
37
+ interface PreconditionFailure {
38
+ type: DetailType.PRECONDITION_FAILURE;
39
+ violations: {
40
+ type: string;
41
+ subject: string;
42
+ description: string;
43
+ }[];
44
+ }
45
+ interface BadRequest {
46
+ type: DetailType.BAD_REQUEST;
47
+ fieldViolations: {
48
+ field: string;
49
+ description: string;
50
+ }[];
51
+ }
52
+ interface RequestInfo {
53
+ type: DetailType.REQUEST_INFO;
54
+ requestId: string;
55
+ servingData: string;
56
+ }
57
+ interface ResourceInfo {
58
+ type: DetailType.RESOURCE_INFO;
59
+ resourceType: string;
60
+ resourceName: string;
61
+ owner: string;
62
+ description: string;
63
+ }
64
+ interface Help {
65
+ type: DetailType.HELP;
66
+ links: {
67
+ url: string;
68
+ description: string;
69
+ }[];
70
+ }
71
+ interface LocalizedMessage {
72
+ type: DetailType.LOCALIZED_MESSAGE;
73
+ locale: string;
74
+ message: string;
75
+ }
76
+ type Detail = RetryInfo | DebugInfo | QuotaFailure | ErrorInfo | PreconditionFailure | BadRequest | RequestInfo | ResourceInfo | Help | LocalizedMessage;
77
+ /**
78
+ * Example usage:
79
+ * const details = Details.new()
80
+ * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })
81
+ * .errorInfo({ reason: 'ACCOUNT_LOCKED' });
82
+ * */
83
+ declare class Details {
84
+ readonly list: Detail[];
85
+ private constructor();
86
+ static new(): Details;
87
+ errorInfo(detail: Omit<ErrorInfo, 'type'>): this;
88
+ retryInfo(detail: Omit<RetryInfo, 'type'>): this;
89
+ debugInfo(detail: Omit<DebugInfo, 'type'>): this;
90
+ quotaFailure(detail: Omit<QuotaFailure, 'type'>): this;
91
+ preconditionFailure(detail: Omit<PreconditionFailure, 'type'>): this;
92
+ badRequest(detail: Omit<BadRequest, 'type'>): this;
93
+ requestInfo(detail: Omit<RequestInfo, 'type'>): this;
94
+ resourceInfo(detail: Omit<ResourceInfo, 'type'>): this;
95
+ help(detail: Omit<Help, 'type'>): this;
96
+ localizedMessage(detail: Omit<LocalizedMessage, 'type'>): this;
97
+ }
98
+
99
+ export { type BadRequest, type DebugInfo, type Detail, DetailType, Details, type ErrorInfo, type Help, type LocalizedMessage, type PreconditionFailure, type QuotaFailure, type RequestInfo, type ResourceInfo, type RetryInfo };
@@ -0,0 +1,67 @@
1
+ // src/error/detail.ts
2
+ var DetailType = /* @__PURE__ */ ((DetailType2) => {
3
+ DetailType2["ERROR_INFO"] = "ERROR_INFO";
4
+ DetailType2["RETRY_INFO"] = "RETRY_INFO";
5
+ DetailType2["DEBUG_INFO"] = "DEBUG_INFO";
6
+ DetailType2["QUOTA_FAILURE"] = "QUOTA_FAILURE";
7
+ DetailType2["PRECONDITION_FAILURE"] = "PRECONDITION_FAILURE";
8
+ DetailType2["BAD_REQUEST"] = "BAD_REQUEST";
9
+ DetailType2["REQUEST_INFO"] = "REQUEST_INFO";
10
+ DetailType2["RESOURCE_INFO"] = "RESOURCE_INFO";
11
+ DetailType2["HELP"] = "HELP";
12
+ DetailType2["LOCALIZED_MESSAGE"] = "LOCALIZED_MESSAGE";
13
+ return DetailType2;
14
+ })(DetailType || {});
15
+ var Details = class _Details {
16
+ list = [];
17
+ constructor() {
18
+ }
19
+ static new() {
20
+ return new _Details();
21
+ }
22
+ errorInfo(detail) {
23
+ this.list.push({ type: "ERROR_INFO" /* ERROR_INFO */, ...detail });
24
+ return this;
25
+ }
26
+ retryInfo(detail) {
27
+ this.list.push({ type: "RETRY_INFO" /* RETRY_INFO */, ...detail });
28
+ return this;
29
+ }
30
+ debugInfo(detail) {
31
+ this.list.push({ type: "DEBUG_INFO" /* DEBUG_INFO */, ...detail });
32
+ return this;
33
+ }
34
+ quotaFailure(detail) {
35
+ this.list.push({ type: "QUOTA_FAILURE" /* QUOTA_FAILURE */, ...detail });
36
+ return this;
37
+ }
38
+ preconditionFailure(detail) {
39
+ this.list.push({ type: "PRECONDITION_FAILURE" /* PRECONDITION_FAILURE */, ...detail });
40
+ return this;
41
+ }
42
+ badRequest(detail) {
43
+ this.list.push({ type: "BAD_REQUEST" /* BAD_REQUEST */, ...detail });
44
+ return this;
45
+ }
46
+ requestInfo(detail) {
47
+ this.list.push({ type: "REQUEST_INFO" /* REQUEST_INFO */, ...detail });
48
+ return this;
49
+ }
50
+ resourceInfo(detail) {
51
+ this.list.push({ type: "RESOURCE_INFO" /* RESOURCE_INFO */, ...detail });
52
+ return this;
53
+ }
54
+ help(detail) {
55
+ this.list.push({ type: "HELP" /* HELP */, ...detail });
56
+ return this;
57
+ }
58
+ localizedMessage(detail) {
59
+ this.list.push({ type: "LOCALIZED_MESSAGE" /* LOCALIZED_MESSAGE */, ...detail });
60
+ return this;
61
+ }
62
+ };
63
+ export {
64
+ DetailType,
65
+ Details
66
+ };
67
+ //# sourceMappingURL=detail.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/error/detail.ts"],"sourcesContent":["import type { ErrorReason } from './reason';\n\nexport enum DetailType {\n ERROR_INFO = 'ERROR_INFO',\n RETRY_INFO = 'RETRY_INFO',\n DEBUG_INFO = 'DEBUG_INFO',\n QUOTA_FAILURE = 'QUOTA_FAILURE',\n PRECONDITION_FAILURE = 'PRECONDITION_FAILURE',\n BAD_REQUEST = 'BAD_REQUEST',\n REQUEST_INFO = 'REQUEST_INFO',\n RESOURCE_INFO = 'RESOURCE_INFO',\n HELP = 'HELP',\n LOCALIZED_MESSAGE = 'LOCALIZED_MESSAGE',\n}\n\nexport interface ErrorInfo {\n type: DetailType.ERROR_INFO;\n reason: keyof ErrorReason | (string & {});\n domain?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface RetryInfo {\n type: DetailType.RETRY_INFO;\n retryDelay: number;\n}\n\nexport interface DebugInfo {\n type: DetailType.DEBUG_INFO;\n stackEntries: string[];\n detail?: string;\n}\n\nexport interface QuotaFailure {\n type: DetailType.QUOTA_FAILURE;\n violations: { subject: string; description: string }[];\n}\n\nexport interface PreconditionFailure {\n type: DetailType.PRECONDITION_FAILURE;\n violations: { type: string; subject: string; description: string }[];\n}\n\nexport interface BadRequest {\n type: DetailType.BAD_REQUEST;\n fieldViolations: { field: string; description: string }[];\n}\n\nexport interface RequestInfo {\n type: DetailType.REQUEST_INFO;\n requestId: string;\n servingData: string;\n}\n\nexport interface ResourceInfo {\n type: DetailType.RESOURCE_INFO;\n resourceType: string;\n resourceName: string;\n owner: string;\n description: string;\n}\n\nexport interface Help {\n type: DetailType.HELP;\n links: { url: string; description: string }[];\n}\n\nexport interface LocalizedMessage {\n type: DetailType.LOCALIZED_MESSAGE;\n locale: string;\n message: string;\n}\n\nexport type Detail =\n | RetryInfo\n | DebugInfo\n | QuotaFailure\n | ErrorInfo\n | PreconditionFailure\n | BadRequest\n | RequestInfo\n | ResourceInfo\n | Help\n | LocalizedMessage;\n\n/**\n * Example usage:\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n * */\nexport class Details {\n readonly list: Detail[] = [];\n private constructor() {}\n\n static new() {\n return new Details();\n }\n\n errorInfo(detail: Omit<ErrorInfo, 'type'>) {\n this.list.push({ type: DetailType.ERROR_INFO, ...detail });\n return this;\n }\n\n retryInfo(detail: Omit<RetryInfo, 'type'>) {\n this.list.push({ type: DetailType.RETRY_INFO, ...detail });\n return this;\n }\n\n debugInfo(detail: Omit<DebugInfo, 'type'>) {\n this.list.push({ type: DetailType.DEBUG_INFO, ...detail });\n return this;\n }\n\n quotaFailure(detail: Omit<QuotaFailure, 'type'>) {\n this.list.push({ type: DetailType.QUOTA_FAILURE, ...detail });\n return this;\n }\n\n preconditionFailure(detail: Omit<PreconditionFailure, 'type'>) {\n this.list.push({ type: DetailType.PRECONDITION_FAILURE, ...detail });\n return this;\n }\n\n badRequest(detail: Omit<BadRequest, 'type'>) {\n this.list.push({ type: DetailType.BAD_REQUEST, ...detail });\n return this;\n }\n\n requestInfo(detail: Omit<RequestInfo, 'type'>) {\n this.list.push({ type: DetailType.REQUEST_INFO, ...detail });\n return this;\n }\n\n resourceInfo(detail: Omit<ResourceInfo, 'type'>) {\n this.list.push({ type: DetailType.RESOURCE_INFO, ...detail });\n return this;\n }\n\n help(detail: Omit<Help, 'type'>) {\n this.list.push({ type: DetailType.HELP, ...detail });\n return this;\n }\n\n localizedMessage(detail: Omit<LocalizedMessage, 'type'>) {\n this.list.push({ type: DetailType.LOCALIZED_MESSAGE, ...detail });\n return this;\n }\n}\n"],"mappings":";AAEO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,mBAAgB;AAChB,EAAAA,YAAA,0BAAuB;AACvB,EAAAA,YAAA,iBAAc;AACd,EAAAA,YAAA,kBAAe;AACf,EAAAA,YAAA,mBAAgB;AAChB,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,uBAAoB;AAVV,SAAAA;AAAA,GAAA;AAyFL,IAAM,UAAN,MAAM,SAAQ;AAAA,EACV,OAAiB,CAAC;AAAA,EACnB,cAAc;AAAA,EAAC;AAAA,EAEvB,OAAO,MAAM;AACX,WAAO,IAAI,SAAQ;AAAA,EACrB;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,QAAiC;AACzC,SAAK,KAAK,KAAK,EAAE,MAAM,+BAAuB,GAAG,OAAO,CAAC;AACzD,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,QAAoC;AAC/C,SAAK,KAAK,KAAK,EAAE,MAAM,qCAA0B,GAAG,OAAO,CAAC;AAC5D,WAAO;AAAA,EACT;AAAA,EAEA,oBAAoB,QAA2C;AAC7D,SAAK,KAAK,KAAK,EAAE,MAAM,mDAAiC,GAAG,OAAO,CAAC;AACnE,WAAO;AAAA,EACT;AAAA,EAEA,WAAW,QAAkC;AAC3C,SAAK,KAAK,KAAK,EAAE,MAAM,iCAAwB,GAAG,OAAO,CAAC;AAC1D,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,QAAmC;AAC7C,SAAK,KAAK,KAAK,EAAE,MAAM,mCAAyB,GAAG,OAAO,CAAC;AAC3D,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,QAAoC;AAC/C,SAAK,KAAK,KAAK,EAAE,MAAM,qCAA0B,GAAG,OAAO,CAAC;AAC5D,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,QAA4B;AAC/B,SAAK,KAAK,KAAK,EAAE,MAAM,mBAAiB,GAAG,OAAO,CAAC;AACnD,WAAO;AAAA,EACT;AAAA,EAEA,iBAAiB,QAAwC;AACvD,SAAK,KAAK,KAAK,EAAE,MAAM,6CAA8B,GAAG,OAAO,CAAC;AAChE,WAAO;AAAA,EACT;AACF;","names":["DetailType"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/error/i18n/en-us.ts
21
+ var en_us_exports = {};
22
+ __export(en_us_exports, {
23
+ enUS: () => enUS
24
+ });
25
+ module.exports = __toCommonJS(en_us_exports);
26
+ var enUS = {};
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ enUS
30
+ });
31
+ //# sourceMappingURL=en-us.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/error/i18n/en-us.ts"],"sourcesContent":["export const enUS = {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,OAAO,CAAC;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare const enUS: {};
2
+
3
+ export { enUS };
@@ -0,0 +1,3 @@
1
+ declare const enUS: {};
2
+
3
+ export { enUS };
@@ -0,0 +1,6 @@
1
+ // src/error/i18n/en-us.ts
2
+ var enUS = {};
3
+ export {
4
+ enUS
5
+ };
6
+ //# sourceMappingURL=en-us.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/error/i18n/en-us.ts"],"sourcesContent":["export const enUS = {};\n"],"mappings":";AAAO,IAAM,OAAO,CAAC;","names":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/error/index.ts
21
+ var error_exports = {};
22
+ __export(error_exports, {
23
+ CheckoutCreateError: () => CheckoutCreateError,
24
+ LoginCanceledError: () => LoginCanceledError,
25
+ LoginTimeoutError: () => LoginTimeoutError,
26
+ PurchaseError: () => PurchaseError
27
+ });
28
+ module.exports = __toCommonJS(error_exports);
29
+ var LoginTimeoutError = class extends Error {
30
+ constructor(timeout) {
31
+ super(`Login timeout after ${timeout}ms`);
32
+ this.name = "LoginTimeoutError";
33
+ }
34
+ };
35
+ var LoginCanceledError = class extends Error {
36
+ constructor() {
37
+ super("Login canceled by user");
38
+ this.name = "LoginCanceledError";
39
+ }
40
+ };
41
+ var CheckoutCreateError = class extends Error {
42
+ constructor() {
43
+ super("Failed to create checkout session");
44
+ this.name = "SessionCreateError";
45
+ }
46
+ };
47
+ var PurchaseError = /* @__PURE__ */ ((PurchaseError2) => {
48
+ PurchaseError2["LOGIN_TIMEOUT"] = "LOGIN_TIMEOUT";
49
+ PurchaseError2["LOGIN_CANCELED"] = "LOGIN_CANCELED";
50
+ PurchaseError2["CHECKOUT_CANCELED"] = "CHECKOUT_CANCELED";
51
+ PurchaseError2["CHECKOUT_CREATE_FAILED"] = "CHECKOUT_CREATE_FAILED";
52
+ PurchaseError2["CHECKOUT_SESSION_ID_NOT_FOUND"] = "CHECKOUT_SESSION_ID_NOT_FOUND";
53
+ PurchaseError2["UNKNOWN"] = "UNKNOWN";
54
+ return PurchaseError2;
55
+ })(PurchaseError || {});
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ CheckoutCreateError,
59
+ LoginCanceledError,
60
+ LoginTimeoutError,
61
+ PurchaseError
62
+ });
63
+ //# sourceMappingURL=index.cjs.map