@snail-js/api 0.1.27 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -605
  3. package/dist/adapter/plain.d.ts +12 -0
  4. package/dist/adapter/plain.d.ts.map +1 -0
  5. package/dist/adapter/react.d.ts +14 -0
  6. package/dist/adapter/react.d.ts.map +1 -0
  7. package/dist/adapter/registry.d.ts +16 -0
  8. package/dist/adapter/registry.d.ts.map +1 -0
  9. package/dist/adapter/vue.d.ts +15 -0
  10. package/dist/adapter/vue.d.ts.map +1 -0
  11. package/dist/chunks/custom-UchOSg_s.js +466 -0
  12. package/dist/chunks/custom-UchOSg_s.js.map +1 -0
  13. package/dist/chunks/download-lBC7oOTT.js +160 -0
  14. package/dist/chunks/download-lBC7oOTT.js.map +1 -0
  15. package/dist/chunks/object-Ct0w-h4i.js +74 -0
  16. package/dist/chunks/object-Ct0w-h4i.js.map +1 -0
  17. package/dist/chunks/plugin-D3RDffDG.js +742 -0
  18. package/dist/chunks/plugin-D3RDffDG.js.map +1 -0
  19. package/dist/chunks/react-C1em-gxy.js +62 -0
  20. package/dist/chunks/react-C1em-gxy.js.map +1 -0
  21. package/dist/chunks/request-qeRhihEF.js +40 -0
  22. package/dist/chunks/request-qeRhihEF.js.map +1 -0
  23. package/dist/chunks/response-D-ubkAFl.js +127 -0
  24. package/dist/chunks/response-D-ubkAFl.js.map +1 -0
  25. package/dist/chunks/use-download-FAjtdJ58.js +1816 -0
  26. package/dist/chunks/use-download-FAjtdJ58.js.map +1 -0
  27. package/dist/chunks/vue-Dd9EhkQ3.js +34 -0
  28. package/dist/chunks/vue-Dd9EhkQ3.js.map +1 -0
  29. package/dist/core/args.d.ts +54 -0
  30. package/dist/core/args.d.ts.map +1 -0
  31. package/dist/core/connection.d.ts +15 -0
  32. package/dist/core/connection.d.ts.map +1 -0
  33. package/dist/core/context.d.ts +124 -0
  34. package/dist/core/context.d.ts.map +1 -0
  35. package/dist/core/http-stream.d.ts +28 -0
  36. package/dist/core/http-stream.d.ts.map +1 -0
  37. package/dist/core/logger.d.ts +22 -0
  38. package/dist/core/logger.d.ts.map +1 -0
  39. package/dist/core/metadata.d.ts +92 -0
  40. package/dist/core/metadata.d.ts.map +1 -0
  41. package/dist/core/metadata.keys.d.ts +41 -0
  42. package/dist/core/metadata.keys.d.ts.map +1 -0
  43. package/dist/core/method.d.ts +177 -0
  44. package/dist/core/method.d.ts.map +1 -0
  45. package/dist/core/plugin-manager.d.ts +106 -0
  46. package/dist/core/plugin-manager.d.ts.map +1 -0
  47. package/dist/core/plugin.d.ts +113 -0
  48. package/dist/core/plugin.d.ts.map +1 -0
  49. package/dist/core/reconnect.d.ts +22 -0
  50. package/dist/core/reconnect.d.ts.map +1 -0
  51. package/dist/core/resolve-stream.d.ts +45 -0
  52. package/dist/core/resolve-stream.d.ts.map +1 -0
  53. package/dist/core/resolve.d.ts +50 -0
  54. package/dist/core/resolve.d.ts.map +1 -0
  55. package/dist/core/response.d.ts +60 -0
  56. package/dist/core/response.d.ts.map +1 -0
  57. package/dist/core/server.d.ts +132 -0
  58. package/dist/core/server.d.ts.map +1 -0
  59. package/dist/core/sse.d.ts +27 -0
  60. package/dist/core/sse.d.ts.map +1 -0
  61. package/dist/core/state-bag.d.ts +36 -0
  62. package/dist/core/state-bag.d.ts.map +1 -0
  63. package/dist/core/websocket.d.ts +29 -0
  64. package/dist/core/websocket.d.ts.map +1 -0
  65. package/dist/decorators/api.d.ts +24 -4
  66. package/dist/decorators/api.d.ts.map +1 -0
  67. package/dist/decorators/args.d.ts +77 -14
  68. package/dist/decorators/args.d.ts.map +1 -0
  69. package/dist/decorators/custom.d.ts +81 -0
  70. package/dist/decorators/custom.d.ts.map +1 -0
  71. package/dist/decorators/header.d.ts +22 -0
  72. package/dist/decorators/header.d.ts.map +1 -0
  73. package/dist/decorators/index.d.ts +17 -0
  74. package/dist/decorators/index.d.ts.map +1 -0
  75. package/dist/decorators/methods.d.ts +33 -0
  76. package/dist/decorators/methods.d.ts.map +1 -0
  77. package/dist/decorators/progress.d.ts +24 -6
  78. package/dist/decorators/progress.d.ts.map +1 -0
  79. package/dist/decorators/server.d.ts +28 -7
  80. package/dist/decorators/server.d.ts.map +1 -0
  81. package/dist/decorators/stream.d.ts +113 -0
  82. package/dist/decorators/stream.d.ts.map +1 -0
  83. package/dist/default/options.d.ts +19 -0
  84. package/dist/default/options.d.ts.map +1 -0
  85. package/dist/error/base.d.ts +20 -0
  86. package/dist/error/base.d.ts.map +1 -0
  87. package/dist/error/decorator.d.ts +14 -0
  88. package/dist/error/decorator.d.ts.map +1 -0
  89. package/dist/error/hook.d.ts +14 -0
  90. package/dist/error/hook.d.ts.map +1 -0
  91. package/dist/error/index.d.ts +8 -0
  92. package/dist/error/index.d.ts.map +1 -0
  93. package/dist/error/options.d.ts +12 -0
  94. package/dist/error/options.d.ts.map +1 -0
  95. package/dist/error/plugin.d.ts +11 -0
  96. package/dist/error/plugin.d.ts.map +1 -0
  97. package/dist/error/request.d.ts +29 -0
  98. package/dist/error/request.d.ts.map +1 -0
  99. package/dist/error/response.d.ts +36 -0
  100. package/dist/error/response.d.ts.map +1 -0
  101. package/dist/index.d.ts +56 -11
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +2034 -0
  104. package/dist/index.js.map +1 -0
  105. package/dist/locale/en.d.ts +5 -0
  106. package/dist/locale/en.d.ts.map +1 -0
  107. package/dist/locale/index.d.ts +57 -0
  108. package/dist/locale/index.d.ts.map +1 -0
  109. package/dist/locale/types.d.ts +11 -0
  110. package/dist/locale/types.d.ts.map +1 -0
  111. package/dist/locale/zh.d.ts +5 -0
  112. package/dist/locale/zh.d.ts.map +1 -0
  113. package/dist/plugins/cache/adapters/indexeddb.d.ts +52 -0
  114. package/dist/plugins/cache/adapters/indexeddb.d.ts.map +1 -0
  115. package/dist/plugins/cache/adapters/memory.d.ts +60 -0
  116. package/dist/plugins/cache/adapters/memory.d.ts.map +1 -0
  117. package/dist/plugins/cache/adapters/web-storage.d.ts +43 -0
  118. package/dist/plugins/cache/adapters/web-storage.d.ts.map +1 -0
  119. package/dist/plugins/cache/decorators.d.ts +62 -0
  120. package/dist/plugins/cache/decorators.d.ts.map +1 -0
  121. package/dist/plugins/cache/index.d.ts +41 -0
  122. package/dist/plugins/cache/index.d.ts.map +1 -0
  123. package/dist/plugins/cache/key.d.ts +48 -0
  124. package/dist/plugins/cache/key.d.ts.map +1 -0
  125. package/dist/plugins/cache/manager.d.ts +124 -0
  126. package/dist/plugins/cache/manager.d.ts.map +1 -0
  127. package/dist/plugins/cache/plugin.d.ts +64 -0
  128. package/dist/plugins/cache/plugin.d.ts.map +1 -0
  129. package/dist/plugins/cache/type.d.ts +116 -0
  130. package/dist/plugins/cache/type.d.ts.map +1 -0
  131. package/dist/plugins/index.d.ts +75 -0
  132. package/dist/plugins/index.d.ts.map +1 -0
  133. package/dist/plugins/index.js +2265 -0
  134. package/dist/plugins/index.js.map +1 -0
  135. package/dist/plugins/interceptor/decorators.d.ts +44 -0
  136. package/dist/plugins/interceptor/decorators.d.ts.map +1 -0
  137. package/dist/plugins/interceptor/index.d.ts +31 -0
  138. package/dist/plugins/interceptor/index.d.ts.map +1 -0
  139. package/dist/plugins/interceptor/manager.d.ts +27 -0
  140. package/dist/plugins/interceptor/manager.d.ts.map +1 -0
  141. package/dist/plugins/interceptor/plugin.d.ts +65 -0
  142. package/dist/plugins/interceptor/plugin.d.ts.map +1 -0
  143. package/dist/plugins/interceptor/type.d.ts +45 -0
  144. package/dist/plugins/interceptor/type.d.ts.map +1 -0
  145. package/dist/plugins/pool/index.d.ts +26 -0
  146. package/dist/plugins/pool/index.d.ts.map +1 -0
  147. package/dist/plugins/pool/plugin.d.ts +83 -0
  148. package/dist/plugins/pool/plugin.d.ts.map +1 -0
  149. package/dist/plugins/pool/scheduler.d.ts +153 -0
  150. package/dist/plugins/pool/scheduler.d.ts.map +1 -0
  151. package/dist/plugins/pool/type.d.ts +38 -0
  152. package/dist/plugins/pool/type.d.ts.map +1 -0
  153. package/dist/plugins/react/index.d.ts +20 -0
  154. package/dist/plugins/react/index.d.ts.map +1 -0
  155. package/dist/plugins/react/index.js +145 -0
  156. package/dist/plugins/react/index.js.map +1 -0
  157. package/dist/plugins/react/plugin.d.ts +33 -0
  158. package/dist/plugins/react/plugin.d.ts.map +1 -0
  159. package/dist/plugins/react/type.d.ts +32 -0
  160. package/dist/plugins/react/type.d.ts.map +1 -0
  161. package/dist/plugins/transform/decorators.d.ts +54 -0
  162. package/dist/plugins/transform/decorators.d.ts.map +1 -0
  163. package/dist/plugins/transform/hydrate.d.ts +47 -0
  164. package/dist/plugins/transform/hydrate.d.ts.map +1 -0
  165. package/dist/plugins/transform/index.d.ts +41 -0
  166. package/dist/plugins/transform/index.d.ts.map +1 -0
  167. package/dist/plugins/transform/plugin.d.ts +20 -0
  168. package/dist/plugins/transform/plugin.d.ts.map +1 -0
  169. package/dist/plugins/transform/type.d.ts +67 -0
  170. package/dist/plugins/transform/type.d.ts.map +1 -0
  171. package/dist/plugins/validate/decorators.d.ts +24 -0
  172. package/dist/plugins/validate/decorators.d.ts.map +1 -0
  173. package/dist/plugins/validate/index.d.ts +40 -0
  174. package/dist/plugins/validate/index.d.ts.map +1 -0
  175. package/dist/plugins/validate/plugin.d.ts +13 -0
  176. package/dist/plugins/validate/plugin.d.ts.map +1 -0
  177. package/dist/plugins/validate/type.d.ts +54 -0
  178. package/dist/plugins/validate/type.d.ts.map +1 -0
  179. package/dist/plugins/version/decorators.d.ts +22 -0
  180. package/dist/plugins/version/decorators.d.ts.map +1 -0
  181. package/dist/plugins/version/index.d.ts +23 -0
  182. package/dist/plugins/version/index.d.ts.map +1 -0
  183. package/dist/plugins/version/plugin.d.ts +13 -0
  184. package/dist/plugins/version/plugin.d.ts.map +1 -0
  185. package/dist/plugins/version/type.d.ts +47 -0
  186. package/dist/plugins/version/type.d.ts.map +1 -0
  187. package/dist/plugins/vue/index.d.ts +21 -0
  188. package/dist/plugins/vue/index.d.ts.map +1 -0
  189. package/dist/plugins/vue/index.js +114 -0
  190. package/dist/plugins/vue/index.js.map +1 -0
  191. package/dist/plugins/vue/plugin.d.ts +15 -0
  192. package/dist/plugins/vue/plugin.d.ts.map +1 -0
  193. package/dist/plugins/vue/type.d.ts +34 -0
  194. package/dist/plugins/vue/type.d.ts.map +1 -0
  195. package/dist/strategies/index.d.ts +2 -0
  196. package/dist/strategies/index.d.ts.map +1 -0
  197. package/dist/strategies/index.js +29 -0
  198. package/dist/strategies/index.js.map +1 -0
  199. package/dist/strategies/plain.d.ts +2 -0
  200. package/dist/strategies/plain.d.ts.map +1 -0
  201. package/dist/strategies/plain.js +23 -0
  202. package/dist/strategies/plain.js.map +1 -0
  203. package/dist/strategies/react.d.ts +2 -0
  204. package/dist/strategies/react.d.ts.map +1 -0
  205. package/dist/strategies/react.js +30 -0
  206. package/dist/strategies/react.js.map +1 -0
  207. package/dist/strategies/shared/adapter.d.ts +23 -0
  208. package/dist/strategies/shared/adapter.d.ts.map +1 -0
  209. package/dist/strategies/shared/dom.d.ts +53 -0
  210. package/dist/strategies/shared/dom.d.ts.map +1 -0
  211. package/dist/strategies/shared/error.d.ts +30 -0
  212. package/dist/strategies/shared/error.d.ts.map +1 -0
  213. package/dist/strategies/shared/method.d.ts +51 -0
  214. package/dist/strategies/shared/method.d.ts.map +1 -0
  215. package/dist/strategies/shared/public.d.ts +33 -0
  216. package/dist/strategies/shared/public.d.ts.map +1 -0
  217. package/dist/strategies/shared/queue.d.ts +30 -0
  218. package/dist/strategies/shared/queue.d.ts.map +1 -0
  219. package/dist/strategies/shared/retry.d.ts +51 -0
  220. package/dist/strategies/shared/retry.d.ts.map +1 -0
  221. package/dist/strategies/shared/state.d.ts +117 -0
  222. package/dist/strategies/shared/state.d.ts.map +1 -0
  223. package/dist/strategies/shared/timing.d.ts +53 -0
  224. package/dist/strategies/shared/timing.d.ts.map +1 -0
  225. package/dist/strategies/shared/watcher.d.ts +37 -0
  226. package/dist/strategies/shared/watcher.d.ts.map +1 -0
  227. package/dist/strategies/use-auto-request.d.ts +77 -0
  228. package/dist/strategies/use-auto-request.d.ts.map +1 -0
  229. package/dist/strategies/use-download.d.ts +103 -0
  230. package/dist/strategies/use-download.d.ts.map +1 -0
  231. package/dist/strategies/use-fetcher.d.ts +52 -0
  232. package/dist/strategies/use-fetcher.d.ts.map +1 -0
  233. package/dist/strategies/use-pagination.d.ts +101 -0
  234. package/dist/strategies/use-pagination.d.ts.map +1 -0
  235. package/dist/strategies/use-request.d.ts +50 -0
  236. package/dist/strategies/use-request.d.ts.map +1 -0
  237. package/dist/strategies/use-retriable-request.d.ts +46 -0
  238. package/dist/strategies/use-retriable-request.d.ts.map +1 -0
  239. package/dist/strategies/use-sse.d.ts +103 -0
  240. package/dist/strategies/use-sse.d.ts.map +1 -0
  241. package/dist/strategies/use-token-auth.d.ts +88 -0
  242. package/dist/strategies/use-token-auth.d.ts.map +1 -0
  243. package/dist/strategies/use-uploader.d.ts +88 -0
  244. package/dist/strategies/use-uploader.d.ts.map +1 -0
  245. package/dist/strategies/use-watcher.d.ts +69 -0
  246. package/dist/strategies/use-watcher.d.ts.map +1 -0
  247. package/dist/typings/adapter.d.ts +61 -0
  248. package/dist/typings/adapter.d.ts.map +1 -0
  249. package/dist/typings/api.d.ts +122 -0
  250. package/dist/typings/api.d.ts.map +1 -0
  251. package/dist/typings/args.d.ts +51 -0
  252. package/dist/typings/args.d.ts.map +1 -0
  253. package/dist/typings/index.d.ts +8 -12
  254. package/dist/typings/index.d.ts.map +1 -0
  255. package/dist/typings/meta.d.ts +44 -0
  256. package/dist/typings/meta.d.ts.map +1 -0
  257. package/dist/typings/plugin.d.ts +114 -0
  258. package/dist/typings/plugin.d.ts.map +1 -0
  259. package/dist/typings/response.d.ts +118 -0
  260. package/dist/typings/response.d.ts.map +1 -0
  261. package/dist/typings/server.d.ts +83 -0
  262. package/dist/typings/server.d.ts.map +1 -0
  263. package/dist/typings/stream.d.ts +150 -0
  264. package/dist/typings/stream.d.ts.map +1 -0
  265. package/dist/utils/download.d.ts +97 -0
  266. package/dist/utils/download.d.ts.map +1 -0
  267. package/dist/utils/emitter.d.ts +36 -0
  268. package/dist/utils/emitter.d.ts.map +1 -0
  269. package/dist/utils/index.d.ts +6 -1
  270. package/dist/utils/index.d.ts.map +1 -0
  271. package/dist/utils/is.d.ts +22 -0
  272. package/dist/utils/is.d.ts.map +1 -0
  273. package/dist/utils/object.d.ts +44 -0
  274. package/dist/utils/object.d.ts.map +1 -0
  275. package/dist/utils/url.d.ts +44 -0
  276. package/dist/utils/url.d.ts.map +1 -0
  277. package/package.json +90 -27
  278. package/README_EN.md +0 -607
  279. package/dist/cache/index.d.ts +0 -9
  280. package/dist/cache/indexDBCache.d.ts +0 -13
  281. package/dist/cache/localstorageCache.d.ts +0 -10
  282. package/dist/cache/memoryCache.d.ts +0 -11
  283. package/dist/core/index.d.ts +0 -4
  284. package/dist/core/snailApi.d.ts +0 -22
  285. package/dist/core/snailMethod.d.ts +0 -49
  286. package/dist/core/snailServer.d.ts +0 -35
  287. package/dist/core/snailSse.d.ts +0 -20
  288. package/dist/decorators/cache.d.ts +0 -15
  289. package/dist/decorators/method.d.ts +0 -38
  290. package/dist/decorators/sse.d.ts +0 -30
  291. package/dist/decorators/strategy.d.ts +0 -10
  292. package/dist/decorators/versioning.d.ts +0 -16
  293. package/dist/eventEmmit/index.d.ts +0 -1
  294. package/dist/eventEmmit/snail.event.d.ts +0 -10
  295. package/dist/snail-api.js +0 -4868
  296. package/dist/snail-api.umd.cjs +0 -4872
  297. package/dist/strategies/jwtStrategy.d.ts +0 -4
  298. package/dist/typings/api.option.d.ts +0 -10
  299. package/dist/typings/apiProxy.d.ts +0 -8
  300. package/dist/typings/cache.management.option.d.ts +0 -25
  301. package/dist/typings/cache.type.d.ts +0 -23
  302. package/dist/typings/content.type.d.ts +0 -5
  303. package/dist/typings/request.body.d.ts +0 -3
  304. package/dist/typings/response.data.d.ts +0 -13
  305. package/dist/typings/snail.event.d.ts +0 -6
  306. package/dist/typings/snail.method.d.ts +0 -14
  307. package/dist/typings/snail.option.d.ts +0 -16
  308. package/dist/typings/sse.d.ts +0 -15
  309. package/dist/typings/strategy.d.ts +0 -5
  310. package/dist/typings/versioning.option.d.ts +0 -30
  311. package/dist/utils/function.d.ts +0 -31
  312. package/dist/versioning/index.d.ts +0 -1
  313. package/dist/versioning/versioning.d.ts +0 -12
@@ -0,0 +1,12 @@
1
+ import type { SnailStateAdapter } from "../typings/adapter.js";
2
+ /**
3
+ * Framework-free state adapter.
4
+ *
5
+ * A plain mutable box. Values update correctly, they just do not *trigger*
6
+ * anything — which is exactly right for a test, an SSR pass or a script, and is
7
+ * the safe default when no UI framework is present.
8
+ *
9
+ * A framework adapter registered with `setStateAdapter` replaces it.
10
+ */
11
+ export declare const plainStateAdapter: SnailStateAdapter;
12
+ //# sourceMappingURL=plain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../src/adapter/plain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,oBAAoB,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAc/B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { SnailStateAdapter } from "../typings/adapter.js";
2
+ /**
3
+ * React state adapter.
4
+ *
5
+ * `create` returns a subscribable box; `useBind` is what a component calls during
6
+ * render to subscribe and re-render. Strategies therefore work in both a
7
+ * component (via `useBind`) and an event handler (via `read`).
8
+ *
9
+ * This module is the only place in the library that imports `react`. It is
10
+ * reachable solely from `@snail-js/api/strategies/react` and the `ReactAdapter`
11
+ * plugin.
12
+ */
13
+ export declare const reactStateAdapter: SnailStateAdapter;
14
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/adapter/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,oBAAoB,CAAC;AAqB3E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAsD/B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { SnailStateAdapter, SnailStateRef } from "../typings/adapter.js";
2
+ /** Replace the active adapter. Called once by a framework entry point. */
3
+ export declare function setStateAdapter(adapter: SnailStateAdapter): void;
4
+ /** The active adapter. */
5
+ export declare function getStateAdapter(): SnailStateAdapter;
6
+ /** `true` when an adapter other than the framework-free default is installed. */
7
+ export declare function hasFrameworkAdapter(): boolean;
8
+ /** Create a tracked value with the active adapter. */
9
+ export declare function createState<T>(initial: T): SnailStateRef<T>;
10
+ /** Read a tracked value. */
11
+ export declare function readState<T>(ref: SnailStateRef<T>): T;
12
+ /** Write a tracked value. */
13
+ export declare function writeState<T>(ref: SnailStateRef<T>, value: T): void;
14
+ /** Release a tracked value, if the adapter allocated anything. */
15
+ export declare function disposeState<T>(ref: SnailStateRef<T>): void;
16
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/adapter/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAY3E,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAOhE;AAED,0BAA0B;AAC1B,wBAAgB,eAAe,IAAI,iBAAiB,CAEnD;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE3D;AAED,4BAA4B;AAC5B,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAErD;AAED,6BAA6B;AAC7B,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAEnE;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAE3D"}
@@ -0,0 +1,15 @@
1
+ import type { SnailStateAdapter } from "../typings/adapter.js";
2
+ /**
3
+ * Vue 3 state adapter.
4
+ *
5
+ * A Vue `Ref<T>` already *is* a `{ value: T }` box, so this adapter is almost
6
+ * pure identity — `create` hands back the ref and `read`/`write` touch `.value`.
7
+ * Vue's render effect tracks the `.value` access itself, which is why no
8
+ * `subscribe` implementation is needed: there is nothing to notify manually.
9
+ *
10
+ * This module is the only place in the library that imports `vue`, and it is only
11
+ * reachable from the strategies' default entry point and the `VueAdapter` plugin.
12
+ * Applications that never import either never pull Vue in.
13
+ */
14
+ export declare const vueStateAdapter: SnailStateAdapter;
15
+ //# sourceMappingURL=vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/adapter/vue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,oBAAoB,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,iBAmB7B,CAAC"}
@@ -0,0 +1,466 @@
1
+ import { B as SnailError, b as t, p as sourceLabel, u as paramResolvers, z as SnailDecoratorError } from "./plugin-D3RDffDG.js";
2
+ import { d as LOG_LEVEL_WEIGHT } from "./response-D-ubkAFl.js";
3
+ //#region src/core/logger.ts
4
+ /** Create a logger honouring `@Server({ logLevel })`. */
5
+ function createLogger(level = "silent") {
6
+ const threshold = LOG_LEVEL_WEIGHT[level] ?? 0;
7
+ return {
8
+ level,
9
+ enabled(candidate) {
10
+ return threshold >= LOG_LEVEL_WEIGHT[candidate];
11
+ },
12
+ error(message, ...rest) {
13
+ if (threshold >= LOG_LEVEL_WEIGHT.error) console.error(message, ...rest);
14
+ },
15
+ warn(message, ...rest) {
16
+ if (threshold >= LOG_LEVEL_WEIGHT.warn) console.warn(message, ...rest);
17
+ },
18
+ info(message, ...rest) {
19
+ if (threshold >= LOG_LEVEL_WEIGHT.info) console.info(message, ...rest);
20
+ },
21
+ debug(message, ...rest) {
22
+ if (threshold >= LOG_LEVEL_WEIGHT.debug) console.debug(message, ...rest);
23
+ }
24
+ };
25
+ }
26
+ //#endregion
27
+ //#region src/core/metadata.keys.ts
28
+ /**
29
+ * Metadata keys used by every `@snail-js/api` decorator.
30
+ *
31
+ * `Symbol.for` is used instead of plain `Symbol()` on purpose: a monorepo can
32
+ * easily end up with two copies of this package (one hoisted for the app, one
33
+ * nested under a dependency). Global symbol registration keeps both copies
34
+ * reading and writing the *same* metadata slots.
35
+ */
36
+ /** `@Server(...)` options, stored on the server class. */
37
+ var SNAIL_SERVER_OPTIONS = Symbol.for("@snail-js/api:server-options");
38
+ /** `@Api(...)` options, stored on the api class. */
39
+ var SNAIL_API_OPTIONS = Symbol.for("@snail-js/api:api-options");
40
+ /** `@Get(...)` / `@Post(...)` / … options, stored per method. */
41
+ var SNAIL_REQUEST_METHOD = Symbol.for("@snail-js/api:request-method");
42
+ /** `@Params()` / `@Query()` / `@Data()` parameter descriptors, stored per method. */
43
+ var SNAIL_PARAMS = Symbol.for("@snail-js/api:params");
44
+ /** `@Header(...)` records, stored on the api class and per method. */
45
+ var SNAIL_HEADERS = Symbol.for("@snail-js/api:headers");
46
+ /** `@UploadProgress(...)` callback, stored per method. */
47
+ var SNAIL_UPLOAD_PROGRESS = Symbol.for("@snail-js/api:upload-progress");
48
+ /** `@DownloadProgress(...)` callback, stored per method. */
49
+ var SNAIL_DOWNLOAD_PROGRESS = Symbol.for("@snail-js/api:download-progress");
50
+ /** `@Sse(...)` options, stored on the stream class. */
51
+ var SNAIL_SSE_OPTIONS = Symbol.for("@snail-js/api:sse-options");
52
+ /** `@SseEvent(...)` / `@OnSseOpen()` / `@OnSseError()` handlers, stored on the stream class. */
53
+ var SNAIL_SSE_HANDLERS = Symbol.for("@snail-js/api:sse-handlers");
54
+ /** `@WebSocket(...)` options, stored on the stream class. */
55
+ var SNAIL_WS_OPTIONS = Symbol.for("@snail-js/api:ws-options");
56
+ /** `@OnWsOpen()` / `@OnWsMessage()` / … handlers, stored on the stream class. */
57
+ var SNAIL_WS_HANDLERS = Symbol.for("@snail-js/api:ws-handlers");
58
+ /** `@HttpStream(...)` options, stored per method. */
59
+ var SNAIL_HTTP_STREAM = Symbol.for("@snail-js/api:http-stream");
60
+ /**
61
+ * Prefix reserved for third-party decorators built with
62
+ * {@link createParamDecorator} and friends.
63
+ *
64
+ * Plugin authors should namespace their key, e.g.
65
+ * `Symbol.for("@acme/snail-plugin:tenant")`, so two plugins can never collide.
66
+ */
67
+ var SNAIL_CUSTOM_KEY_PREFIX = "@snail-js/api:custom:";
68
+ //#endregion
69
+ //#region src/core/metadata.ts
70
+ /**
71
+ * A dependency-free replacement for `reflect-metadata`.
72
+ *
73
+ * ## Why not `reflect-metadata`?
74
+ *
75
+ * TypeScript 7 dropped the ability to emit `design:*` metadata: enabling
76
+ * `emitDecoratorMetadata` is accepted but silently emits nothing (verified
77
+ * against `tsc` 7.0.2 — the `__metadata` helper is emitted, the calls are not).
78
+ * That removes the only capability `reflect-metadata` ever provided to this
79
+ * library: we have never needed inferred constructor parameter types, only the
80
+ * metadata our *own* decorators write.
81
+ *
82
+ * Dropping it buys three things:
83
+ * 1. no runtime polyfill to install or import at the app entry point;
84
+ * 2. one fewer entry in `dependencies` — axios stays the only one;
85
+ * 3. deterministic behaviour on every runtime (browser, Node, worker, edge)
86
+ * because the polyfill's `Reflect.defineMetadata` is not involved at all.
87
+ *
88
+ * Legacy decorators (`experimentalDecorators: true`) and parameter decorators
89
+ * remain fully supported by TypeScript 7.
90
+ *
91
+ * ## Storage model
92
+ *
93
+ * ```text
94
+ * WeakMap<owner, Map<slot, Map<key, value>>>
95
+ * │ └── the decorator's symbol key
96
+ * └── CLASS_SLOT for class metadata, else the method name
97
+ * ```
98
+ *
99
+ * `owner` is always a *class* (constructor function). A decorator applied to a
100
+ * method or parameter receives the prototype, so {@link resolveOwner} maps it
101
+ * back to the class.
102
+ *
103
+ * ## Decorator application order (important)
104
+ *
105
+ * For `@Api("/u") class U { @Get() list(@Query("a") a: string) {} }` the
106
+ * runtime order is:
107
+ *
108
+ * ```text
109
+ * 1. parameter decorators (reverse index order)
110
+ * 2. method decorators
111
+ * 3. class decorators
112
+ * ```
113
+ *
114
+ * Every writer below therefore *merges*; none of them may clobber an existing
115
+ * value. Array-shaped metadata is appended, never replaced.
116
+ */
117
+ /** Internal slot used for class-level (non method-specific) metadata. */
118
+ var CLASS_SLOT = Symbol.for("@snail-js/api:class-slot");
119
+ var registry = /* @__PURE__ */ new WeakMap();
120
+ /**
121
+ * Normalise whatever a decorator receives into the class that owns the metadata.
122
+ *
123
+ * - class decorator → the constructor itself
124
+ * - method / parameter decorator → `prototype.constructor`
125
+ * - a bare prototype passed by hand → `prototype.constructor`
126
+ */
127
+ function resolveOwner(target) {
128
+ if (typeof target === "function") return target;
129
+ if (target !== null && typeof target === "object") {
130
+ const ctor = target.constructor;
131
+ if (typeof ctor === "function") return ctor;
132
+ }
133
+ throw new TypeError("[snail] metadata target must be a class, a prototype or a constructor function");
134
+ }
135
+ function slotOf(propertyKey) {
136
+ return propertyKey ?? CLASS_SLOT;
137
+ }
138
+ function findSlotMap(owner, slot) {
139
+ return registry.get(owner)?.get(slot);
140
+ }
141
+ function ensureSlotMap(owner, slot) {
142
+ let record = registry.get(owner);
143
+ if (!record) {
144
+ record = /* @__PURE__ */ new Map();
145
+ registry.set(owner, record);
146
+ }
147
+ let slotMap = record.get(slot);
148
+ if (!slotMap) {
149
+ slotMap = /* @__PURE__ */ new Map();
150
+ record.set(slot, slotMap);
151
+ }
152
+ return slotMap;
153
+ }
154
+ /**
155
+ * Write metadata, replacing any value previously written for the same
156
+ * (owner, slot, key) triple.
157
+ */
158
+ function defineMetadata(key, value, target, propertyKey) {
159
+ ensureSlotMap(resolveOwner(target), slotOf(propertyKey)).set(key, value);
160
+ }
161
+ /** Read metadata from exactly this owner, ignoring the prototype chain. */
162
+ function getOwnMetadata(key, target, propertyKey) {
163
+ return findSlotMap(resolveOwner(target), slotOf(propertyKey))?.get(key);
164
+ }
165
+ /**
166
+ * Read metadata, walking the class prototype chain so a base api class or a base
167
+ * server class can supply defaults to its subclasses.
168
+ */
169
+ function getMetadata(key, target, propertyKey) {
170
+ const slot = slotOf(propertyKey);
171
+ let owner = resolveOwner(target);
172
+ while (owner && owner !== Function.prototype && owner !== Object.prototype) {
173
+ const slotMap = findSlotMap(owner, slot);
174
+ if (slotMap?.has(key)) return slotMap.get(key);
175
+ owner = Object.getPrototypeOf(owner);
176
+ }
177
+ }
178
+ /** `true` when {@link getMetadata} would find something. */
179
+ function hasMetadata(key, target, propertyKey) {
180
+ return getMetadata(key, target, propertyKey) !== void 0;
181
+ }
182
+ /**
183
+ * Append to array-shaped metadata, always creating a fresh array.
184
+ *
185
+ * Copy-on-write matters: several decorators legitimately contribute to one key
186
+ * (four `@Query()` parameters, a class-level `@Header()` plus a method-level
187
+ * one) and the array must never be shared with a base class.
188
+ */
189
+ function appendMetadata(key, value, target, propertyKey) {
190
+ const previous = getOwnMetadata(key, target, propertyKey);
191
+ defineMetadata(key, previous ? [...previous, value] : [value], target, propertyKey);
192
+ }
193
+ /** Merge a record into record-shaped metadata (class-level `@Header` and friends). */
194
+ function mergeMetadata(key, value, target, propertyKey) {
195
+ const previous = getOwnMetadata(key, target, propertyKey);
196
+ defineMetadata(key, previous ? {
197
+ ...previous,
198
+ ...value
199
+ } : { ...value }, target, propertyKey);
200
+ }
201
+ /** Delete metadata from exactly this owner. Returns whether anything was removed. */
202
+ function deleteMetadata(key, target, propertyKey) {
203
+ return findSlotMap(resolveOwner(target), slotOf(propertyKey))?.delete(key) ?? false;
204
+ }
205
+ /**
206
+ * Collect every method name that carries metadata for `key`, walking the class
207
+ * prototype chain from base to derived so subclasses may override.
208
+ */
209
+ function collectMethodKeys(key, target) {
210
+ const chain = [];
211
+ let owner = resolveOwner(target);
212
+ while (owner && owner !== Function.prototype && owner !== Object.prototype) {
213
+ chain.unshift(owner);
214
+ owner = Object.getPrototypeOf(owner);
215
+ }
216
+ const result = [];
217
+ const seen = /* @__PURE__ */ new Set();
218
+ for (const current of chain) {
219
+ const record = registry.get(current);
220
+ if (!record) continue;
221
+ for (const [slot, slotMap] of record) {
222
+ if (slot === CLASS_SLOT || !slotMap.has(key)) continue;
223
+ const name = String(slot);
224
+ if (seen.has(name)) continue;
225
+ seen.add(name);
226
+ result.push(name);
227
+ }
228
+ }
229
+ return result;
230
+ }
231
+ /**
232
+ * Test-only escape hatch: swap the registry for a fresh `WeakMap`. Existing
233
+ * owners become unreachable and are garbage collected.
234
+ */
235
+ function clearMetadataRegistry() {
236
+ registry = /* @__PURE__ */ new WeakMap();
237
+ }
238
+ //#endregion
239
+ //#region src/error/plugin.ts
240
+ /** Thrown for plugin registration, dependency and uninstall failures. */
241
+ var SnailPluginError = class extends SnailError {
242
+ constructor(message, options = {}) {
243
+ super(message, {
244
+ code: "SNAIL_PLUGIN_ERROR",
245
+ cause: options.cause
246
+ });
247
+ this.pluginName = options.pluginName;
248
+ }
249
+ };
250
+ //#endregion
251
+ //#region src/decorators/args.ts
252
+ /** Normalise `"key"` / `{ key, ...options }` / `undefined`. */
253
+ function normalizeParamInput(input) {
254
+ if (input === void 0) return {
255
+ key: void 0,
256
+ options: void 0
257
+ };
258
+ if (typeof input === "string") return {
259
+ key: input,
260
+ options: void 0
261
+ };
262
+ if (input === null || typeof input !== "object") throw new SnailDecoratorError(t("error.decorator.param.untyped", "Source"));
263
+ const { key, ...options } = input;
264
+ return {
265
+ key,
266
+ options: Object.keys(options).length > 0 ? options : void 0
267
+ };
268
+ }
269
+ /**
270
+ * Write one parameter descriptor onto the decorated method.
271
+ *
272
+ * Parameter decorators run *before* the method decorator and in reverse index
273
+ * order, so this only ever appends — the descriptor list is sorted by index when
274
+ * the arguments are applied.
275
+ */
276
+ function defineParamDescriptor(source, resolver, input, target, propertyKey, index) {
277
+ if (propertyKey === void 0) throw new SnailDecoratorError(t("error.decorator.param.context", sourceLabel(source)));
278
+ const { key, options } = normalizeParamInput(input);
279
+ appendMetadata(SNAIL_PARAMS, {
280
+ source,
281
+ index,
282
+ key,
283
+ options,
284
+ resolve: resolver
285
+ }, target, propertyKey);
286
+ }
287
+ /**
288
+ * Build a parameter decorator for a registered source.
289
+ *
290
+ * Built-in sources are `params`, `query`, `data` and `header`. A plugin can add
291
+ * its own with `createPlugin`'s `defineParamSource`.
292
+ */
293
+ function createParamDecoratorFor(source) {
294
+ return (input) => {
295
+ if (typeof input === "string" && input.length === 0) throw new SnailDecoratorError(t("error.decorator.param.untyped", sourceLabel(source)));
296
+ return (target, propertyKey, index) => {
297
+ const resolver = paramResolvers[source];
298
+ if (!resolver) throw new SnailDecoratorError(`[snail] no resolver registered for parameter source "${source}"`);
299
+ defineParamDescriptor(source, resolver, input, target, propertyKey, index);
300
+ };
301
+ };
302
+ }
303
+ /**
304
+ * Path placeholders.
305
+ *
306
+ * ```ts
307
+ * @Api("/user")
308
+ * class UserApi {
309
+ * @Get("/:id/:tab")
310
+ * get(@Params("id") id: string, @Params("tab") tab: string) {}
311
+ * // or, equivalently
312
+ * @Get("/:id/:tab")
313
+ * get(@Params() params: { id: string; tab: string }) {}
314
+ * }
315
+ * ```
316
+ */
317
+ var Params = createParamDecoratorFor("params");
318
+ /**
319
+ * Query string parameters.
320
+ *
321
+ * ```ts
322
+ * @Get("/list")
323
+ * list(@Query("page") page: number, @Query() filters: { q?: string }) {}
324
+ * ```
325
+ */
326
+ var Query = createParamDecoratorFor("query");
327
+ /**
328
+ * Request body.
329
+ *
330
+ * Keyed arguments merge into an object body. A key-less plain object merges too,
331
+ * while any other value (`FormData`, `Blob`, a raw string, an array) replaces the
332
+ * body outright so non-JSON uploads stay possible.
333
+ */
334
+ var Data = createParamDecoratorFor("data");
335
+ /**
336
+ * A single request header.
337
+ *
338
+ * ```ts
339
+ * @Get("/me")
340
+ * me(@HeaderValue("authorization") token: string) {}
341
+ * ```
342
+ *
343
+ * For *static* headers use the class/method level `@Header({ ... })` instead.
344
+ */
345
+ var HeaderValue = createParamDecoratorFor("header");
346
+ /** Legacy alias — the pre-rewrite library exposed the header source as `Header`. */
347
+ var HeaderParam = HeaderValue;
348
+ //#endregion
349
+ //#region src/decorators/custom.ts
350
+ /**
351
+ * Extension factories for third-party decorators.
352
+ *
353
+ * The library's own decorators are built from these, so anything the core can do
354
+ * a plugin can do too.
355
+ *
356
+ * ## Key namespacing
357
+ *
358
+ * Custom keys are derived from a name you supply:
359
+ *
360
+ * ```ts
361
+ * const TENANT = customMetadataKey("acme/tenant");
362
+ * ```
363
+ *
364
+ * Prefix your name with your package to make collisions impossible. The reserved
365
+ * prefix `@snail-js/api:` belongs to the core.
366
+ */
367
+ /** Build a namespaced metadata key for a custom decorator. */
368
+ function customMetadataKey(name) {
369
+ if (typeof name !== "string" || name.length === 0) throw new SnailDecoratorError("[snail] customMetadataKey() requires a non-empty name");
370
+ return Symbol.for(`${SNAIL_CUSTOM_KEY_PREFIX}${name}`);
371
+ }
372
+ /**
373
+ * Create a **parameter** decorator.
374
+ *
375
+ * ```ts
376
+ * // 1. register a source (usually inside a plugin's setup)
377
+ * api.defineParamSource("tenant", ({ ctx, value }) => {
378
+ * ctx.request.headers.set("x-tenant", String(value));
379
+ * });
380
+ *
381
+ * // 2. expose a decorator built on it
382
+ * export const Tenant = createParamDecorator("tenant");
383
+ *
384
+ * // 3. use it
385
+ * @Get("/orders")
386
+ * orders(@Tenant() tenantId: string) {}
387
+ * ```
388
+ *
389
+ * Pass an explicit `resolver` to skip step 1 and keep everything in one place.
390
+ */
391
+ function createParamDecorator(source, resolver) {
392
+ return (input) => {
393
+ const effective = resolver ?? paramResolvers[source];
394
+ if (!effective) throw new SnailDecoratorError(`[snail] no resolver registered for parameter source "${source}"; register one with createPlugin({ setup: (o, api) => api.defineParamSource("${source}", fn) }) or pass a resolver to createParamDecorator()`);
395
+ return (target, propertyKey, index) => {
396
+ defineParamDescriptor(source, effective, input, target, propertyKey, index);
397
+ };
398
+ };
399
+ }
400
+ /**
401
+ * Create a **class** decorator.
402
+ *
403
+ * ```ts
404
+ * export const Entity = createClassDecorator<string>("acme/entity");
405
+ * @Entity("orders") class OrderApi {}
406
+ * ```
407
+ *
408
+ * @param name metadata key name
409
+ * @param merge when `true` (the default) repeated applications keep every value
410
+ * in an array instead of overwriting
411
+ */
412
+ function createClassDecorator(name, merge = true) {
413
+ const key = customMetadataKey(name);
414
+ return (value) => (target) => {
415
+ if (merge) appendMetadata(key, value, target);
416
+ else defineMetadata(key, value, target);
417
+ };
418
+ }
419
+ /**
420
+ * Create a **method** decorator.
421
+ *
422
+ * ```ts
423
+ * export const Retry = createMethodDecorator<number>("acme/retry");
424
+ * @Get("/flaky") @Retry(3) flaky() {}
425
+ * ```
426
+ */
427
+ function createMethodDecorator(name, merge = true) {
428
+ const key = customMetadataKey(name);
429
+ return (value) => (target, propertyKey) => {
430
+ if (propertyKey === void 0) throw new SnailDecoratorError(`[snail] createMethodDecorator("${name}") must decorate a method`);
431
+ if (merge) appendMetadata(key, value, target, propertyKey);
432
+ else defineMetadata(key, value, target, propertyKey);
433
+ };
434
+ }
435
+ /** Read metadata written by a custom method decorator. */
436
+ function getMethodMetadata(name, target, methodName) {
437
+ return getMetadata(customMetadataKey(name), target, methodName);
438
+ }
439
+ /** Read metadata written by a custom class decorator. */
440
+ function getClassMetadata(name, target) {
441
+ return getMetadata(customMetadataKey(name), target);
442
+ }
443
+ /** Read metadata written by a custom method decorator on exactly this class. */
444
+ function getOwnMethodMetadata(name, target, methodName) {
445
+ return getOwnMetadata(customMetadataKey(name), target, methodName);
446
+ }
447
+ /**
448
+ * Create a **property** decorator.
449
+ *
450
+ * Property decorators are handy for DTO classes consumed by the transform plugin:
451
+ *
452
+ * ```ts
453
+ * const Alias = createPropertyDecorator<string>("acme/alias");
454
+ * class UserDto { @Alias("user_name") userName!: string }
455
+ * ```
456
+ */
457
+ function createPropertyDecorator(name) {
458
+ const key = customMetadataKey(name);
459
+ return (value) => (target, propertyKey) => {
460
+ defineMetadata(key, value, target, propertyKey);
461
+ };
462
+ }
463
+ //#endregion
464
+ export { SNAIL_DOWNLOAD_PROGRESS as A, SNAIL_WS_OPTIONS as B, getMetadata as C, resolveOwner as D, mergeMetadata as E, SNAIL_SERVER_OPTIONS as F, SNAIL_SSE_HANDLERS as I, SNAIL_SSE_OPTIONS as L, SNAIL_HTTP_STREAM as M, SNAIL_PARAMS as N, SNAIL_API_OPTIONS as O, SNAIL_REQUEST_METHOD as P, SNAIL_UPLOAD_PROGRESS as R, deleteMetadata as S, hasMetadata as T, createLogger as V, SnailPluginError as _, customMetadataKey as a, collectMethodKeys as b, getOwnMethodMetadata as c, HeaderValue as d, Params as f, normalizeParamInput as g, defineParamDescriptor as h, createPropertyDecorator as i, SNAIL_HEADERS as j, SNAIL_CUSTOM_KEY_PREFIX as k, Data as l, createParamDecoratorFor as m, createMethodDecorator as n, getClassMetadata as o, Query as p, createParamDecorator as r, getMethodMetadata as s, createClassDecorator as t, HeaderParam as u, appendMetadata as v, getOwnMetadata as w, defineMetadata as x, clearMetadataRegistry as y, SNAIL_WS_HANDLERS as z };
465
+
466
+ //# sourceMappingURL=custom-UchOSg_s.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-UchOSg_s.js","names":[],"sources":["../../src/core/logger.ts","../../src/core/metadata.keys.ts","../../src/core/metadata.ts","../../src/error/plugin.ts","../../src/decorators/args.ts","../../src/decorators/custom.ts"],"sourcesContent":["import { LOG_LEVEL_WEIGHT } from \"../default/options\";\nimport type { SnailLogLevel } from \"../typings/server\";\n\n/**\n * Level-gated logger.\n *\n * The pre-rewrite code called bare `console.log` from the middle of the request\n * pipeline, which made a request library noisy by default and impossible to\n * silence. Every diagnostic now goes through a logger whose level comes from\n * `@Server({ logLevel })`, and the default level is `\"silent\"`.\n */\nexport interface SnailLogger {\n /** Active level. */\n readonly level: SnailLogLevel;\n /** `true` when a message at `level` would be printed. */\n enabled(level: Exclude<SnailLogLevel, \"silent\">): boolean;\n error(message: string, ...rest: unknown[]): void;\n warn(message: string, ...rest: unknown[]): void;\n info(message: string, ...rest: unknown[]): void;\n debug(message: string, ...rest: unknown[]): void;\n}\n\n/** Create a logger honouring `@Server({ logLevel })`. */\nexport function createLogger(level: SnailLogLevel = \"silent\"): SnailLogger {\n const threshold = LOG_LEVEL_WEIGHT[level] ?? 0;\n\n return {\n level,\n enabled(candidate) {\n return threshold >= LOG_LEVEL_WEIGHT[candidate];\n },\n error(message, ...rest) {\n if (threshold >= LOG_LEVEL_WEIGHT.error) console.error(message, ...rest);\n },\n warn(message, ...rest) {\n if (threshold >= LOG_LEVEL_WEIGHT.warn) console.warn(message, ...rest);\n },\n info(message, ...rest) {\n if (threshold >= LOG_LEVEL_WEIGHT.info) console.info(message, ...rest);\n },\n debug(message, ...rest) {\n if (threshold >= LOG_LEVEL_WEIGHT.debug) console.debug(message, ...rest);\n }\n };\n}\n","/**\n * Metadata keys used by every `@snail-js/api` decorator.\n *\n * `Symbol.for` is used instead of plain `Symbol()` on purpose: a monorepo can\n * easily end up with two copies of this package (one hoisted for the app, one\n * nested under a dependency). Global symbol registration keeps both copies\n * reading and writing the *same* metadata slots.\n */\n\n/** `@Server(...)` options, stored on the server class. */\nexport const SNAIL_SERVER_OPTIONS = Symbol.for(\"@snail-js/api:server-options\");\n\n/** `@Api(...)` options, stored on the api class. */\nexport const SNAIL_API_OPTIONS = Symbol.for(\"@snail-js/api:api-options\");\n\n/** `@Get(...)` / `@Post(...)` / … options, stored per method. */\nexport const SNAIL_REQUEST_METHOD = Symbol.for(\"@snail-js/api:request-method\");\n\n/** `@Params()` / `@Query()` / `@Data()` parameter descriptors, stored per method. */\nexport const SNAIL_PARAMS = Symbol.for(\"@snail-js/api:params\");\n\n/** `@Header(...)` records, stored on the api class and per method. */\nexport const SNAIL_HEADERS = Symbol.for(\"@snail-js/api:headers\");\n\n/** `@UploadProgress(...)` callback, stored per method. */\nexport const SNAIL_UPLOAD_PROGRESS = Symbol.for(\"@snail-js/api:upload-progress\");\n\n/** `@DownloadProgress(...)` callback, stored per method. */\nexport const SNAIL_DOWNLOAD_PROGRESS = Symbol.for(\"@snail-js/api:download-progress\");\n\n/** `@Sse(...)` options, stored on the stream class. */\nexport const SNAIL_SSE_OPTIONS = Symbol.for(\"@snail-js/api:sse-options\");\n\n/** `@SseEvent(...)` / `@OnSseOpen()` / `@OnSseError()` handlers, stored on the stream class. */\nexport const SNAIL_SSE_HANDLERS = Symbol.for(\"@snail-js/api:sse-handlers\");\n\n/** `@WebSocket(...)` options, stored on the stream class. */\nexport const SNAIL_WS_OPTIONS = Symbol.for(\"@snail-js/api:ws-options\");\n\n/** `@OnWsOpen()` / `@OnWsMessage()` / … handlers, stored on the stream class. */\nexport const SNAIL_WS_HANDLERS = Symbol.for(\"@snail-js/api:ws-handlers\");\n\n/** `@HttpStream(...)` options, stored per method. */\nexport const SNAIL_HTTP_STREAM = Symbol.for(\"@snail-js/api:http-stream\");\n\n/**\n * Prefix reserved for third-party decorators built with\n * {@link createParamDecorator} and friends.\n *\n * Plugin authors should namespace their key, e.g.\n * `Symbol.for(\"@acme/snail-plugin:tenant\")`, so two plugins can never collide.\n */\nexport const SNAIL_CUSTOM_KEY_PREFIX = \"@snail-js/api:custom:\";\n","/**\n * A dependency-free replacement for `reflect-metadata`.\n *\n * ## Why not `reflect-metadata`?\n *\n * TypeScript 7 dropped the ability to emit `design:*` metadata: enabling\n * `emitDecoratorMetadata` is accepted but silently emits nothing (verified\n * against `tsc` 7.0.2 — the `__metadata` helper is emitted, the calls are not).\n * That removes the only capability `reflect-metadata` ever provided to this\n * library: we have never needed inferred constructor parameter types, only the\n * metadata our *own* decorators write.\n *\n * Dropping it buys three things:\n * 1. no runtime polyfill to install or import at the app entry point;\n * 2. one fewer entry in `dependencies` — axios stays the only one;\n * 3. deterministic behaviour on every runtime (browser, Node, worker, edge)\n * because the polyfill's `Reflect.defineMetadata` is not involved at all.\n *\n * Legacy decorators (`experimentalDecorators: true`) and parameter decorators\n * remain fully supported by TypeScript 7.\n *\n * ## Storage model\n *\n * ```text\n * WeakMap<owner, Map<slot, Map<key, value>>>\n * │ └── the decorator's symbol key\n * └── CLASS_SLOT for class metadata, else the method name\n * ```\n *\n * `owner` is always a *class* (constructor function). A decorator applied to a\n * method or parameter receives the prototype, so {@link resolveOwner} maps it\n * back to the class.\n *\n * ## Decorator application order (important)\n *\n * For `@Api(\"/u\") class U { @Get() list(@Query(\"a\") a: string) {} }` the\n * runtime order is:\n *\n * ```text\n * 1. parameter decorators (reverse index order)\n * 2. method decorators\n * 3. class decorators\n * ```\n *\n * Every writer below therefore *merges*; none of them may clobber an existing\n * value. Array-shaped metadata is appended, never replaced.\n */\n\n/** Internal slot used for class-level (non method-specific) metadata. */\nconst CLASS_SLOT = Symbol.for(\"@snail-js/api:class-slot\");\n\ntype OwnerRecord = Map<PropertyKey, Map<symbol, unknown>>;\n\nlet registry = new WeakMap<object, OwnerRecord>();\n\n/**\n * Normalise whatever a decorator receives into the class that owns the metadata.\n *\n * - class decorator → the constructor itself\n * - method / parameter decorator → `prototype.constructor`\n * - a bare prototype passed by hand → `prototype.constructor`\n */\nexport function resolveOwner(target: unknown): object {\n if (typeof target === \"function\") return target;\n if (target !== null && typeof target === \"object\") {\n const ctor = (target as { constructor?: unknown }).constructor;\n if (typeof ctor === \"function\") return ctor;\n }\n throw new TypeError(\n \"[snail] metadata target must be a class, a prototype or a constructor function\"\n );\n}\n\nfunction slotOf(propertyKey?: PropertyKey): PropertyKey {\n return propertyKey ?? CLASS_SLOT;\n}\n\nfunction findSlotMap(owner: object, slot: PropertyKey): Map<symbol, unknown> | undefined {\n return registry.get(owner)?.get(slot);\n}\n\nfunction ensureSlotMap(owner: object, slot: PropertyKey): Map<symbol, unknown> {\n let record = registry.get(owner);\n if (!record) {\n record = new Map<PropertyKey, Map<symbol, unknown>>();\n registry.set(owner, record);\n }\n let slotMap = record.get(slot);\n if (!slotMap) {\n slotMap = new Map<symbol, unknown>();\n record.set(slot, slotMap);\n }\n return slotMap;\n}\n\n/**\n * Write metadata, replacing any value previously written for the same\n * (owner, slot, key) triple.\n */\nexport function defineMetadata(\n key: symbol,\n value: unknown,\n target: unknown,\n propertyKey?: PropertyKey\n): void {\n ensureSlotMap(resolveOwner(target), slotOf(propertyKey)).set(key, value);\n}\n\n/** Read metadata from exactly this owner, ignoring the prototype chain. */\nexport function getOwnMetadata<T = unknown>(\n key: symbol,\n target: unknown,\n propertyKey?: PropertyKey\n): T | undefined {\n return findSlotMap(resolveOwner(target), slotOf(propertyKey))?.get(key) as T | undefined;\n}\n\n/**\n * Read metadata, walking the class prototype chain so a base api class or a base\n * server class can supply defaults to its subclasses.\n */\nexport function getMetadata<T = unknown>(\n key: symbol,\n target: unknown,\n propertyKey?: PropertyKey\n): T | undefined {\n const slot = slotOf(propertyKey);\n let owner: object | null = resolveOwner(target);\n\n while (owner && owner !== Function.prototype && owner !== Object.prototype) {\n const slotMap = findSlotMap(owner, slot);\n if (slotMap?.has(key)) return slotMap.get(key) as T;\n owner = Object.getPrototypeOf(owner) as object | null;\n }\n return undefined;\n}\n\n/** `true` when {@link getMetadata} would find something. */\nexport function hasMetadata(\n key: symbol,\n target: unknown,\n propertyKey?: PropertyKey\n): boolean {\n return getMetadata(key, target, propertyKey) !== undefined;\n}\n\n/**\n * Append to array-shaped metadata, always creating a fresh array.\n *\n * Copy-on-write matters: several decorators legitimately contribute to one key\n * (four `@Query()` parameters, a class-level `@Header()` plus a method-level\n * one) and the array must never be shared with a base class.\n */\nexport function appendMetadata<T>(\n key: symbol,\n value: T,\n target: unknown,\n propertyKey?: PropertyKey\n): void {\n const previous = getOwnMetadata<T[]>(key, target, propertyKey);\n defineMetadata(key, previous ? [...previous, value] : [value], target, propertyKey);\n}\n\n/** Merge a record into record-shaped metadata (class-level `@Header` and friends). */\nexport function mergeMetadata<T extends object>(\n key: symbol,\n value: T,\n target: unknown,\n propertyKey?: PropertyKey\n): void {\n const previous = getOwnMetadata<T>(key, target, propertyKey);\n defineMetadata(key, previous ? { ...previous, ...value } : { ...value }, target, propertyKey);\n}\n\n/** Delete metadata from exactly this owner. Returns whether anything was removed. */\nexport function deleteMetadata(\n key: symbol,\n target: unknown,\n propertyKey?: PropertyKey\n): boolean {\n return findSlotMap(resolveOwner(target), slotOf(propertyKey))?.delete(key) ?? false;\n}\n\n/**\n * Collect every method name that carries metadata for `key`, walking the class\n * prototype chain from base to derived so subclasses may override.\n */\nexport function collectMethodKeys(key: symbol, target: unknown): string[] {\n const chain: object[] = [];\n let owner: object | null = resolveOwner(target);\n while (owner && owner !== Function.prototype && owner !== Object.prototype) {\n chain.unshift(owner);\n owner = Object.getPrototypeOf(owner) as object | null;\n }\n\n const result: string[] = [];\n const seen = new Set<string>();\n for (const current of chain) {\n const record = registry.get(current);\n if (!record) continue;\n for (const [slot, slotMap] of record) {\n if (slot === CLASS_SLOT || !slotMap.has(key)) continue;\n const name = String(slot);\n if (seen.has(name)) continue;\n seen.add(name);\n result.push(name);\n }\n }\n return result;\n}\n\n/**\n * Test-only escape hatch: swap the registry for a fresh `WeakMap`. Existing\n * owners become unreachable and are garbage collected.\n */\nexport function clearMetadataRegistry(): void {\n registry = new WeakMap<object, OwnerRecord>();\n}\n","import { SnailError } from \"./base\";\n\n/** Thrown for plugin registration, dependency and uninstall failures. */\nexport class SnailPluginError extends SnailError {\n /** Name of the plugin the failure belongs to, when known. */\n readonly pluginName: string | undefined;\n\n constructor(\n message: string,\n options: { pluginName?: string; cause?: unknown } = {}\n ) {\n super(message, { code: \"SNAIL_PLUGIN_ERROR\", cause: options.cause });\n this.pluginName = options.pluginName;\n }\n}\n","import { SnailDecoratorError } from \"../error/decorator\";\nimport { t } from \"../locale\";\nimport type { SnailParamDescriptor, SnailParamResolver } from \"../typings/args\";\nimport { appendMetadata } from \"../core/metadata\";\nimport { SNAIL_PARAMS } from \"../core/metadata.keys\";\nimport { paramResolvers, sourceLabel } from \"../core/args\";\n\n/**\n * Parameter decorators.\n *\n * Two shapes, on purpose:\n *\n * - `@Query(\"page\") page: number` — a **keyed** argument places one value.\n * - `@Query() query: SomeShape` — a **key-less** argument spreads a plain object.\n *\n * A key-less argument that is not a plain object throws, naming the method and\n * the parameter. The pre-rewrite code logged to `console.error` and then threw a\n * message that did not say which method was at fault.\n */\n\n/** A parameter decorator's accepted argument. */\nexport type ParamDecoratorInput<O = void> = string | (O & { key?: string });\n\n/** Normalise `\"key\"` / `{ key, ...options }` / `undefined`. */\nexport function normalizeParamInput<O>(\n input: ParamDecoratorInput<O> | undefined\n): { key: string | undefined; options: O | undefined } {\n if (input === undefined) return { key: undefined, options: undefined };\n\n if (typeof input === \"string\") {\n return { key: input, options: undefined };\n }\n\n if (input === null || typeof input !== \"object\") {\n throw new SnailDecoratorError(t(\"error.decorator.param.untyped\", \"Source\"));\n }\n\n const { key, ...options } = input as { key?: string } & Record<string, unknown>;\n return {\n key,\n options: Object.keys(options).length > 0 ? (options as O) : undefined\n };\n}\n\n/**\n * Write one parameter descriptor onto the decorated method.\n *\n * Parameter decorators run *before* the method decorator and in reverse index\n * order, so this only ever appends — the descriptor list is sorted by index when\n * the arguments are applied.\n */\nexport function defineParamDescriptor(\n source: string,\n resolver: SnailParamResolver,\n input: ParamDecoratorInput<any> | undefined,\n target: unknown,\n propertyKey: string | symbol | undefined,\n index: number\n): void {\n if (propertyKey === undefined) {\n throw new SnailDecoratorError(t(\"error.decorator.param.context\", sourceLabel(source)));\n }\n\n const { key, options } = normalizeParamInput(input);\n\n const descriptor: SnailParamDescriptor = {\n source,\n index,\n key,\n options,\n resolve: resolver\n };\n\n appendMetadata(SNAIL_PARAMS, descriptor, target, propertyKey);\n}\n\n/**\n * Build a parameter decorator for a registered source.\n *\n * Built-in sources are `params`, `query`, `data` and `header`. A plugin can add\n * its own with `createPlugin`'s `defineParamSource`.\n */\nexport function createParamDecoratorFor<O = void>(\n source: string\n): (input?: ParamDecoratorInput<O>) => ParameterDecorator {\n return (input) => {\n if (typeof input === \"string\" && input.length === 0) {\n throw new SnailDecoratorError(t(\"error.decorator.param.untyped\", sourceLabel(source)));\n }\n\n return (target, propertyKey, index) => {\n const resolver = paramResolvers[source];\n if (!resolver) {\n throw new SnailDecoratorError(\n `[snail] no resolver registered for parameter source \"${source}\"`\n );\n }\n defineParamDescriptor(source, resolver, input, target, propertyKey, index);\n };\n };\n}\n\n/**\n * Path placeholders.\n *\n * ```ts\n * @Api(\"/user\")\n * class UserApi {\n * @Get(\"/:id/:tab\")\n * get(@Params(\"id\") id: string, @Params(\"tab\") tab: string) {}\n * // or, equivalently\n * @Get(\"/:id/:tab\")\n * get(@Params() params: { id: string; tab: string }) {}\n * }\n * ```\n */\nexport const Params = createParamDecoratorFor(\"params\");\n\n/**\n * Query string parameters.\n *\n * ```ts\n * @Get(\"/list\")\n * list(@Query(\"page\") page: number, @Query() filters: { q?: string }) {}\n * ```\n */\nexport const Query = createParamDecoratorFor(\"query\");\n\n/**\n * Request body.\n *\n * Keyed arguments merge into an object body. A key-less plain object merges too,\n * while any other value (`FormData`, `Blob`, a raw string, an array) replaces the\n * body outright so non-JSON uploads stay possible.\n */\nexport const Data = createParamDecoratorFor(\"data\");\n\n/**\n * A single request header.\n *\n * ```ts\n * @Get(\"/me\")\n * me(@HeaderValue(\"authorization\") token: string) {}\n * ```\n *\n * For *static* headers use the class/method level `@Header({ ... })` instead.\n */\nexport const HeaderValue = createParamDecoratorFor(\"header\");\n\n/** Legacy alias — the pre-rewrite library exposed the header source as `Header`. */\nexport const HeaderParam = HeaderValue;\n","import { SNAIL_CUSTOM_KEY_PREFIX } from \"../core/metadata.keys\";\nimport {\n appendMetadata,\n defineMetadata,\n getMetadata,\n getOwnMetadata\n} from \"../core/metadata\";\nimport { paramResolvers } from \"../core/args\";\nimport { SnailDecoratorError } from \"../error/decorator\";\nimport { t } from \"../locale\";\nimport type { SnailParamResolver } from \"../typings/args\";\nimport { defineParamDescriptor, type ParamDecoratorInput } from \"./args\";\n\n/**\n * Extension factories for third-party decorators.\n *\n * The library's own decorators are built from these, so anything the core can do\n * a plugin can do too.\n *\n * ## Key namespacing\n *\n * Custom keys are derived from a name you supply:\n *\n * ```ts\n * const TENANT = customMetadataKey(\"acme/tenant\");\n * ```\n *\n * Prefix your name with your package to make collisions impossible. The reserved\n * prefix `@snail-js/api:` belongs to the core.\n */\n\n/** Build a namespaced metadata key for a custom decorator. */\nexport function customMetadataKey(name: string): symbol {\n if (typeof name !== \"string\" || name.length === 0) {\n throw new SnailDecoratorError(\"[snail] customMetadataKey() requires a non-empty name\");\n }\n return Symbol.for(`${SNAIL_CUSTOM_KEY_PREFIX}${name}`);\n}\n\n/**\n * Create a **parameter** decorator.\n *\n * ```ts\n * // 1. register a source (usually inside a plugin's setup)\n * api.defineParamSource(\"tenant\", ({ ctx, value }) => {\n * ctx.request.headers.set(\"x-tenant\", String(value));\n * });\n *\n * // 2. expose a decorator built on it\n * export const Tenant = createParamDecorator(\"tenant\");\n *\n * // 3. use it\n * @Get(\"/orders\")\n * orders(@Tenant() tenantId: string) {}\n * ```\n *\n * Pass an explicit `resolver` to skip step 1 and keep everything in one place.\n */\nexport function createParamDecorator<O = void>(\n source: string,\n resolver?: SnailParamResolver\n): (input?: ParamDecoratorInput<O>) => ParameterDecorator {\n return (input) => {\n const effective = resolver ?? paramResolvers[source];\n if (!effective) {\n throw new SnailDecoratorError(\n `[snail] no resolver registered for parameter source \"${source}\"; ` +\n `register one with createPlugin({ setup: (o, api) => api.defineParamSource(\"${source}\", fn) }) ` +\n `or pass a resolver to createParamDecorator()`\n );\n }\n\n return (target, propertyKey, index) => {\n defineParamDescriptor(source, effective, input, target, propertyKey, index);\n };\n };\n}\n\n/**\n * Create a **class** decorator.\n *\n * ```ts\n * export const Entity = createClassDecorator<string>(\"acme/entity\");\n * @Entity(\"orders\") class OrderApi {}\n * ```\n *\n * @param name metadata key name\n * @param merge when `true` (the default) repeated applications keep every value\n * in an array instead of overwriting\n */\nexport function createClassDecorator<T = unknown>(\n name: string,\n merge = true\n): (value: T) => ClassDecorator {\n const key = customMetadataKey(name);\n return (value: T) => (target) => {\n if (merge) appendMetadata(key, value, target);\n else defineMetadata(key, value, target);\n };\n}\n\n/**\n * Create a **method** decorator.\n *\n * ```ts\n * export const Retry = createMethodDecorator<number>(\"acme/retry\");\n * @Get(\"/flaky\") @Retry(3) flaky() {}\n * ```\n */\nexport function createMethodDecorator<T = unknown>(\n name: string,\n merge = true\n): (value: T) => MethodDecorator {\n const key = customMetadataKey(name);\n return (value: T) => (target, propertyKey) => {\n if (propertyKey === undefined) {\n throw new SnailDecoratorError(\n `[snail] createMethodDecorator(\"${name}\") must decorate a method`\n );\n }\n if (merge) appendMetadata(key, value, target, propertyKey);\n else defineMetadata(key, value, target, propertyKey);\n };\n}\n\n/** Read metadata written by a custom method decorator. */\nexport function getMethodMetadata<T>(name: string, target: unknown, methodName: string): T | undefined {\n return getMetadata<T>(customMetadataKey(name), target, methodName);\n}\n\n/** Read metadata written by a custom class decorator. */\nexport function getClassMetadata<T>(name: string, target: unknown): T | undefined {\n return getMetadata<T>(customMetadataKey(name), target);\n}\n\n/** Read metadata written by a custom method decorator on exactly this class. */\nexport function getOwnMethodMetadata<T>(\n name: string,\n target: unknown,\n methodName: string\n): T | undefined {\n return getOwnMetadata<T>(customMetadataKey(name), target, methodName);\n}\n\n/**\n * Create a **property** decorator.\n *\n * Property decorators are handy for DTO classes consumed by the transform plugin:\n *\n * ```ts\n * const Alias = createPropertyDecorator<string>(\"acme/alias\");\n * class UserDto { @Alias(\"user_name\") userName!: string }\n * ```\n */\nexport function createPropertyDecorator<T = unknown>(\n name: string\n): (value: T) => PropertyDecorator {\n const key = customMetadataKey(name);\n return (value: T) => (target, propertyKey) => {\n defineMetadata(key, value, target, propertyKey);\n };\n}\n"],"mappings":";;;;AAuBA,SAAgB,aAAa,QAAuB,UAAuB;CACzE,MAAM,YAAY,iBAAiB,UAAU;CAE7C,OAAO;EACL;EACA,QAAQ,WAAW;GACjB,OAAO,aAAa,iBAAiB;EACvC;EACA,MAAM,SAAS,GAAG,MAAM;GACtB,IAAI,aAAa,iBAAiB,OAAO,QAAQ,MAAM,SAAS,GAAG,IAAI;EACzE;EACA,KAAK,SAAS,GAAG,MAAM;GACrB,IAAI,aAAa,iBAAiB,MAAM,QAAQ,KAAK,SAAS,GAAG,IAAI;EACvE;EACA,KAAK,SAAS,GAAG,MAAM;GACrB,IAAI,aAAa,iBAAiB,MAAM,QAAQ,KAAK,SAAS,GAAG,IAAI;EACvE;EACA,MAAM,SAAS,GAAG,MAAM;GACtB,IAAI,aAAa,iBAAiB,OAAO,QAAQ,MAAM,SAAS,GAAG,IAAI;EACzE;CACF;AACF;;;;;;;;;;;;AClCA,IAAa,uBAAuB,OAAO,IAAI,8BAA8B;;AAG7E,IAAa,oBAAoB,OAAO,IAAI,2BAA2B;;AAGvE,IAAa,uBAAuB,OAAO,IAAI,8BAA8B;;AAG7E,IAAa,eAAe,OAAO,IAAI,sBAAsB;;AAG7D,IAAa,gBAAgB,OAAO,IAAI,uBAAuB;;AAG/D,IAAa,wBAAwB,OAAO,IAAI,+BAA+B;;AAG/E,IAAa,0BAA0B,OAAO,IAAI,iCAAiC;;AAGnF,IAAa,oBAAoB,OAAO,IAAI,2BAA2B;;AAGvE,IAAa,qBAAqB,OAAO,IAAI,4BAA4B;;AAGzE,IAAa,mBAAmB,OAAO,IAAI,0BAA0B;;AAGrE,IAAa,oBAAoB,OAAO,IAAI,2BAA2B;;AAGvE,IAAa,oBAAoB,OAAO,IAAI,2BAA2B;;;;;;;;AASvE,IAAa,0BAA0B;;;;;;;;;;;;;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