@jant/core 0.3.7 → 0.3.8

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 (241) hide show
  1. package/dist/app.js +4 -0
  2. package/dist/client.js +1 -0
  3. package/dist/db/schema.js +13 -0
  4. package/dist/i18n/locales/en.js +1 -1
  5. package/dist/i18n/locales/zh-Hans.js +1 -1
  6. package/dist/i18n/locales/zh-Hant.js +1 -1
  7. package/dist/lib/image.js +3 -3
  8. package/dist/lib/media-helpers.js +43 -0
  9. package/dist/lib/nav-reorder.js +27 -0
  10. package/dist/lib/navigation.js +35 -0
  11. package/dist/lib/theme-components.js +49 -0
  12. package/dist/routes/api/timeline.js +115 -0
  13. package/dist/routes/api/upload.js +9 -5
  14. package/dist/routes/dash/navigation.js +274 -0
  15. package/dist/routes/pages/archive.js +14 -27
  16. package/dist/routes/pages/collection.js +10 -19
  17. package/dist/routes/pages/home.js +83 -126
  18. package/dist/routes/pages/page.js +19 -38
  19. package/dist/routes/pages/post.js +38 -51
  20. package/dist/routes/pages/search.js +13 -26
  21. package/dist/services/index.js +3 -1
  22. package/dist/services/media.js +1 -1
  23. package/dist/services/navigation.js +115 -0
  24. package/dist/services/post.js +26 -1
  25. package/dist/theme/components/PostList.js +5 -0
  26. package/dist/theme/components/index.js +2 -0
  27. package/dist/theme/components/timeline/ArticleCard.js +50 -0
  28. package/dist/theme/components/timeline/ImageCard.js +86 -0
  29. package/dist/theme/components/timeline/LinkCard.js +62 -0
  30. package/dist/theme/components/timeline/NoteCard.js +37 -0
  31. package/dist/theme/components/timeline/QuoteCard.js +51 -0
  32. package/dist/theme/components/timeline/ThreadPreview.js +52 -0
  33. package/dist/theme/components/timeline/TimelineFeed.js +43 -0
  34. package/dist/theme/components/timeline/TimelineItem.js +25 -0
  35. package/dist/theme/components/timeline/index.js +8 -0
  36. package/dist/theme/layouts/DashLayout.js +8 -0
  37. package/dist/theme/layouts/SiteLayout.js +160 -0
  38. package/dist/theme/layouts/index.js +1 -0
  39. package/dist/types/sortablejs.d.js +5 -0
  40. package/package.json +3 -2
  41. package/src/__tests__/helpers/db.ts +10 -0
  42. package/src/app.tsx +4 -0
  43. package/src/client.ts +1 -0
  44. package/src/db/migrations/0003_add_navigation_links.sql +8 -0
  45. package/src/db/migrations/meta/0003_snapshot.json +821 -0
  46. package/src/db/migrations/meta/_journal.json +14 -0
  47. package/src/db/schema.ts +13 -0
  48. package/src/i18n/locales/en.po +100 -32
  49. package/src/i18n/locales/en.ts +1 -1
  50. package/src/i18n/locales/zh-Hans.po +102 -55
  51. package/src/i18n/locales/zh-Hans.ts +1 -1
  52. package/src/i18n/locales/zh-Hant.po +102 -55
  53. package/src/i18n/locales/zh-Hant.ts +1 -1
  54. package/src/index.ts +5 -0
  55. package/src/lib/__tests__/theme-components.test.ts +107 -0
  56. package/src/lib/image.ts +3 -3
  57. package/src/lib/media-helpers.ts +54 -0
  58. package/src/lib/nav-reorder.ts +26 -0
  59. package/src/lib/navigation.ts +46 -0
  60. package/src/lib/theme-components.ts +76 -0
  61. package/src/routes/api/__tests__/posts.test.ts +8 -8
  62. package/src/routes/api/__tests__/timeline.test.ts +242 -0
  63. package/src/routes/api/timeline.tsx +145 -0
  64. package/src/routes/api/upload.ts +9 -5
  65. package/src/routes/dash/navigation.tsx +306 -0
  66. package/src/routes/pages/archive.tsx +15 -23
  67. package/src/routes/pages/collection.tsx +8 -15
  68. package/src/routes/pages/home.tsx +111 -122
  69. package/src/routes/pages/page.tsx +17 -30
  70. package/src/routes/pages/post.tsx +33 -42
  71. package/src/routes/pages/search.tsx +18 -22
  72. package/src/services/__tests__/media.test.ts +34 -7
  73. package/src/services/__tests__/navigation.test.ts +213 -0
  74. package/src/services/__tests__/post-timeline.test.ts +220 -0
  75. package/src/services/index.ts +7 -0
  76. package/src/services/media.ts +2 -1
  77. package/src/services/navigation.ts +165 -0
  78. package/src/services/post.ts +48 -1
  79. package/src/styles/components.css +59 -0
  80. package/src/theme/components/PostList.tsx +7 -0
  81. package/src/theme/components/index.ts +12 -0
  82. package/src/theme/components/timeline/ArticleCard.tsx +57 -0
  83. package/src/theme/components/timeline/ImageCard.tsx +80 -0
  84. package/src/theme/components/timeline/LinkCard.tsx +66 -0
  85. package/src/theme/components/timeline/NoteCard.tsx +41 -0
  86. package/src/theme/components/timeline/QuoteCard.tsx +55 -0
  87. package/src/theme/components/timeline/ThreadPreview.tsx +49 -0
  88. package/src/theme/components/timeline/TimelineFeed.tsx +52 -0
  89. package/src/theme/components/timeline/TimelineItem.tsx +39 -0
  90. package/src/theme/components/timeline/index.ts +8 -0
  91. package/src/theme/layouts/DashLayout.tsx +10 -0
  92. package/src/theme/layouts/SiteLayout.tsx +184 -0
  93. package/src/theme/layouts/index.ts +1 -0
  94. package/src/types/sortablejs.d.ts +23 -0
  95. package/src/types.ts +61 -0
  96. package/dist/app.d.ts +0 -38
  97. package/dist/app.d.ts.map +0 -1
  98. package/dist/auth.d.ts +0 -25
  99. package/dist/auth.d.ts.map +0 -1
  100. package/dist/db/index.d.ts +0 -10
  101. package/dist/db/index.d.ts.map +0 -1
  102. package/dist/db/schema.d.ts +0 -1543
  103. package/dist/db/schema.d.ts.map +0 -1
  104. package/dist/i18n/Trans.d.ts +0 -25
  105. package/dist/i18n/Trans.d.ts.map +0 -1
  106. package/dist/i18n/context.d.ts +0 -69
  107. package/dist/i18n/context.d.ts.map +0 -1
  108. package/dist/i18n/detect.d.ts +0 -20
  109. package/dist/i18n/detect.d.ts.map +0 -1
  110. package/dist/i18n/i18n.d.ts +0 -32
  111. package/dist/i18n/i18n.d.ts.map +0 -1
  112. package/dist/i18n/index.d.ts +0 -41
  113. package/dist/i18n/index.d.ts.map +0 -1
  114. package/dist/i18n/locales/en.d.ts +0 -3
  115. package/dist/i18n/locales/en.d.ts.map +0 -1
  116. package/dist/i18n/locales/zh-Hans.d.ts +0 -3
  117. package/dist/i18n/locales/zh-Hans.d.ts.map +0 -1
  118. package/dist/i18n/locales/zh-Hant.d.ts +0 -3
  119. package/dist/i18n/locales/zh-Hant.d.ts.map +0 -1
  120. package/dist/i18n/locales.d.ts +0 -11
  121. package/dist/i18n/locales.d.ts.map +0 -1
  122. package/dist/i18n/middleware.d.ts +0 -21
  123. package/dist/i18n/middleware.d.ts.map +0 -1
  124. package/dist/index.d.ts +0 -16
  125. package/dist/index.d.ts.map +0 -1
  126. package/dist/lib/config.d.ts +0 -83
  127. package/dist/lib/config.d.ts.map +0 -1
  128. package/dist/lib/constants.d.ts +0 -37
  129. package/dist/lib/constants.d.ts.map +0 -1
  130. package/dist/lib/image.d.ts +0 -73
  131. package/dist/lib/image.d.ts.map +0 -1
  132. package/dist/lib/index.d.ts +0 -9
  133. package/dist/lib/index.d.ts.map +0 -1
  134. package/dist/lib/markdown.d.ts +0 -60
  135. package/dist/lib/markdown.d.ts.map +0 -1
  136. package/dist/lib/schemas.d.ts +0 -130
  137. package/dist/lib/schemas.d.ts.map +0 -1
  138. package/dist/lib/sqid.d.ts +0 -60
  139. package/dist/lib/sqid.d.ts.map +0 -1
  140. package/dist/lib/sse.d.ts +0 -192
  141. package/dist/lib/sse.d.ts.map +0 -1
  142. package/dist/lib/theme.d.ts +0 -44
  143. package/dist/lib/theme.d.ts.map +0 -1
  144. package/dist/lib/time.d.ts +0 -90
  145. package/dist/lib/time.d.ts.map +0 -1
  146. package/dist/lib/url.d.ts +0 -82
  147. package/dist/lib/url.d.ts.map +0 -1
  148. package/dist/middleware/auth.d.ts +0 -24
  149. package/dist/middleware/auth.d.ts.map +0 -1
  150. package/dist/middleware/onboarding.d.ts +0 -26
  151. package/dist/middleware/onboarding.d.ts.map +0 -1
  152. package/dist/routes/api/posts.d.ts +0 -13
  153. package/dist/routes/api/posts.d.ts.map +0 -1
  154. package/dist/routes/api/search.d.ts +0 -13
  155. package/dist/routes/api/search.d.ts.map +0 -1
  156. package/dist/routes/api/upload.d.ts +0 -16
  157. package/dist/routes/api/upload.d.ts.map +0 -1
  158. package/dist/routes/dash/collections.d.ts +0 -13
  159. package/dist/routes/dash/collections.d.ts.map +0 -1
  160. package/dist/routes/dash/index.d.ts +0 -15
  161. package/dist/routes/dash/index.d.ts.map +0 -1
  162. package/dist/routes/dash/media.d.ts +0 -16
  163. package/dist/routes/dash/media.d.ts.map +0 -1
  164. package/dist/routes/dash/pages.d.ts +0 -15
  165. package/dist/routes/dash/pages.d.ts.map +0 -1
  166. package/dist/routes/dash/posts.d.ts +0 -13
  167. package/dist/routes/dash/posts.d.ts.map +0 -1
  168. package/dist/routes/dash/redirects.d.ts +0 -13
  169. package/dist/routes/dash/redirects.d.ts.map +0 -1
  170. package/dist/routes/dash/settings.d.ts +0 -15
  171. package/dist/routes/dash/settings.d.ts.map +0 -1
  172. package/dist/routes/feed/rss.d.ts +0 -13
  173. package/dist/routes/feed/rss.d.ts.map +0 -1
  174. package/dist/routes/feed/sitemap.d.ts +0 -13
  175. package/dist/routes/feed/sitemap.d.ts.map +0 -1
  176. package/dist/routes/pages/archive.d.ts +0 -15
  177. package/dist/routes/pages/archive.d.ts.map +0 -1
  178. package/dist/routes/pages/collection.d.ts +0 -13
  179. package/dist/routes/pages/collection.d.ts.map +0 -1
  180. package/dist/routes/pages/home.d.ts +0 -13
  181. package/dist/routes/pages/home.d.ts.map +0 -1
  182. package/dist/routes/pages/page.d.ts +0 -15
  183. package/dist/routes/pages/page.d.ts.map +0 -1
  184. package/dist/routes/pages/post.d.ts +0 -13
  185. package/dist/routes/pages/post.d.ts.map +0 -1
  186. package/dist/routes/pages/search.d.ts +0 -13
  187. package/dist/routes/pages/search.d.ts.map +0 -1
  188. package/dist/services/collection.d.ts +0 -32
  189. package/dist/services/collection.d.ts.map +0 -1
  190. package/dist/services/index.d.ts +0 -28
  191. package/dist/services/index.d.ts.map +0 -1
  192. package/dist/services/media.d.ts +0 -34
  193. package/dist/services/media.d.ts.map +0 -1
  194. package/dist/services/post.d.ts +0 -31
  195. package/dist/services/post.d.ts.map +0 -1
  196. package/dist/services/redirect.d.ts +0 -15
  197. package/dist/services/redirect.d.ts.map +0 -1
  198. package/dist/services/search.d.ts +0 -26
  199. package/dist/services/search.d.ts.map +0 -1
  200. package/dist/services/settings.d.ts +0 -18
  201. package/dist/services/settings.d.ts.map +0 -1
  202. package/dist/theme/color-themes.d.ts +0 -30
  203. package/dist/theme/color-themes.d.ts.map +0 -1
  204. package/dist/theme/components/ActionButtons.d.ts +0 -43
  205. package/dist/theme/components/ActionButtons.d.ts.map +0 -1
  206. package/dist/theme/components/CrudPageHeader.d.ts +0 -23
  207. package/dist/theme/components/CrudPageHeader.d.ts.map +0 -1
  208. package/dist/theme/components/DangerZone.d.ts +0 -36
  209. package/dist/theme/components/DangerZone.d.ts.map +0 -1
  210. package/dist/theme/components/EmptyState.d.ts +0 -27
  211. package/dist/theme/components/EmptyState.d.ts.map +0 -1
  212. package/dist/theme/components/ListItemRow.d.ts +0 -15
  213. package/dist/theme/components/ListItemRow.d.ts.map +0 -1
  214. package/dist/theme/components/MediaGallery.d.ts +0 -13
  215. package/dist/theme/components/MediaGallery.d.ts.map +0 -1
  216. package/dist/theme/components/PageForm.d.ts +0 -14
  217. package/dist/theme/components/PageForm.d.ts.map +0 -1
  218. package/dist/theme/components/Pagination.d.ts +0 -46
  219. package/dist/theme/components/Pagination.d.ts.map +0 -1
  220. package/dist/theme/components/PostForm.d.ts +0 -16
  221. package/dist/theme/components/PostForm.d.ts.map +0 -1
  222. package/dist/theme/components/PostList.d.ts +0 -10
  223. package/dist/theme/components/PostList.d.ts.map +0 -1
  224. package/dist/theme/components/ThreadView.d.ts +0 -15
  225. package/dist/theme/components/ThreadView.d.ts.map +0 -1
  226. package/dist/theme/components/TypeBadge.d.ts +0 -12
  227. package/dist/theme/components/TypeBadge.d.ts.map +0 -1
  228. package/dist/theme/components/VisibilityBadge.d.ts +0 -12
  229. package/dist/theme/components/VisibilityBadge.d.ts.map +0 -1
  230. package/dist/theme/components/index.d.ts +0 -14
  231. package/dist/theme/components/index.d.ts.map +0 -1
  232. package/dist/theme/index.d.ts +0 -21
  233. package/dist/theme/index.d.ts.map +0 -1
  234. package/dist/theme/layouts/BaseLayout.d.ts +0 -23
  235. package/dist/theme/layouts/BaseLayout.d.ts.map +0 -1
  236. package/dist/theme/layouts/DashLayout.d.ts +0 -17
  237. package/dist/theme/layouts/DashLayout.d.ts.map +0 -1
  238. package/dist/theme/layouts/index.d.ts +0 -3
  239. package/dist/theme/layouts/index.d.ts.map +0 -1
  240. package/dist/types.d.ts +0 -237
  241. package/dist/types.d.ts.map +0 -1
@@ -1,130 +0,0 @@
1
- /**
2
- * Shared Zod schemas for validation
3
- *
4
- * These schemas ensure type-safe validation of user input
5
- * from forms, API requests, and other external sources.
6
- *
7
- * IMPORTANT: Types are defined in types.ts as the single source of truth.
8
- * This file only defines Zod validation schemas based on those types.
9
- */
10
- import { z } from "zod";
11
- import type { PostType } from "../types.js";
12
- /**
13
- * Post type enum schema
14
- * Based on POST_TYPES from types.ts
15
- */
16
- export declare const PostTypeSchema: z.ZodEnum<{
17
- note: "note";
18
- article: "article";
19
- link: "link";
20
- quote: "quote";
21
- image: "image";
22
- page: "page";
23
- }>;
24
- /**
25
- * Visibility enum schema
26
- * Based on VISIBILITY_LEVELS from types.ts
27
- */
28
- export declare const VisibilitySchema: z.ZodEnum<{
29
- featured: "featured";
30
- quiet: "quiet";
31
- unlisted: "unlisted";
32
- draft: "draft";
33
- }>;
34
- /**
35
- * Redirect type enum schema
36
- * Form input validation for redirect type (stored as number in DB)
37
- */
38
- export declare const RedirectTypeSchema: z.ZodEnum<{
39
- 301: "301";
40
- 302: "302";
41
- }>;
42
- /**
43
- * API request body schema for creating a post
44
- */
45
- export declare const CreatePostSchema: z.ZodObject<{
46
- type: z.ZodEnum<{
47
- note: "note";
48
- article: "article";
49
- link: "link";
50
- quote: "quote";
51
- image: "image";
52
- page: "page";
53
- }>;
54
- title: z.ZodOptional<z.ZodString>;
55
- content: z.ZodString;
56
- visibility: z.ZodEnum<{
57
- featured: "featured";
58
- quiet: "quiet";
59
- unlisted: "unlisted";
60
- draft: "draft";
61
- }>;
62
- sourceUrl: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodLiteral<"">]>;
63
- sourceName: z.ZodOptional<z.ZodString>;
64
- path: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
65
- replyToId: z.ZodOptional<z.ZodString>;
66
- publishedAt: z.ZodOptional<z.ZodNumber>;
67
- mediaIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
- }, z.core.$strip>;
69
- /**
70
- * API request body schema for updating a post
71
- */
72
- export declare const UpdatePostSchema: z.ZodObject<{
73
- type: z.ZodOptional<z.ZodEnum<{
74
- note: "note";
75
- article: "article";
76
- link: "link";
77
- quote: "quote";
78
- image: "image";
79
- page: "page";
80
- }>>;
81
- title: z.ZodOptional<z.ZodOptional<z.ZodString>>;
82
- content: z.ZodOptional<z.ZodString>;
83
- visibility: z.ZodOptional<z.ZodEnum<{
84
- featured: "featured";
85
- quiet: "quiet";
86
- unlisted: "unlisted";
87
- draft: "draft";
88
- }>>;
89
- sourceUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodLiteral<"">]>>;
90
- sourceName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
91
- path: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
92
- replyToId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
93
- publishedAt: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
94
- mediaIds: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
95
- }, z.core.$strip>;
96
- /**
97
- * Form data helper: safely parse a FormData value with a schema
98
- *
99
- * @example
100
- * ```ts
101
- * const type = parseFormData(formData, "type", PostTypeSchema);
102
- * // type is PostType, throws if invalid
103
- * ```
104
- */
105
- export declare function parseFormData<T>(formData: FormData, key: string, schema: z.ZodSchema<T>): T;
106
- /**
107
- * Form data helper: safely parse optional FormData value with a schema
108
- *
109
- * @example
110
- * ```ts
111
- * const slug = parseFormDataOptional(formData, "slug", z.string());
112
- * // slug is string | undefined
113
- * ```
114
- */
115
- export declare function parseFormDataOptional<T>(formData: FormData, key: string, schema: z.ZodSchema<T>): T | undefined;
116
- /**
117
- * Validates media attachment count against post type rules.
118
- *
119
- * @param type - The post type to validate against
120
- * @param mediaIds - Array of media IDs to attach
121
- * @returns null if valid, error string if invalid
122
- *
123
- * @example
124
- * ```ts
125
- * const error = validateMediaForPostType("image", []);
126
- * // Returns: "image posts require at least 1 media attachment"
127
- * ```
128
- */
129
- export declare function validateMediaForPostType(type: PostType, mediaIds: string[]): string | null;
130
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/lib/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;EAAqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;EAA4B,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;EAAyB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;iBAe3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;iBAA6B,CAAC;AAE3D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GACrB,CAAC,CAMH;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GACrB,CAAC,GAAG,SAAS,CAMf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,IAAI,CAqBf"}
@@ -1,60 +0,0 @@
1
- /**
2
- * Sqids - Short unique IDs for URLs
3
- *
4
- * Encodes numeric IDs to short strings like "jR3k"
5
- */
6
- /**
7
- * Encodes a numeric database ID to a short, URL-friendly string.
8
- *
9
- * Uses the Sqids library to generate short unique identifiers with a minimum length of 4 characters.
10
- * These are used in URLs (e.g., `/p/jR3k`) to obscure sequential integer IDs while maintaining
11
- * uniqueness and reversibility.
12
- *
13
- * @param id - The numeric database ID to encode
14
- * @returns A short string representation of the ID (minimum 4 characters)
15
- *
16
- * @example
17
- * ```ts
18
- * const sqid = encode(123);
19
- * // Returns: "jR3k" (or similar short string)
20
- * ```
21
- */
22
- export declare function encode(id: number): string;
23
- /**
24
- * Decodes a sqid string back to the original numeric database ID.
25
- *
26
- * Attempts to decode a sqid string generated by the `encode()` function. Returns the original
27
- * numeric ID if valid, or `null` if the string is not a valid sqid. This is used to extract
28
- * database IDs from URL parameters.
29
- *
30
- * @param str - The sqid string to decode
31
- * @returns The original numeric ID if valid, or `null` if decoding fails
32
- *
33
- * @example
34
- * ```ts
35
- * const id = decode("jR3k");
36
- * // Returns: 123
37
- *
38
- * const invalid = decode("invalid");
39
- * // Returns: null
40
- * ```
41
- */
42
- export declare function decode(str: string): number | null;
43
- /**
44
- * Checks if a string is a valid sqid that can be decoded.
45
- *
46
- * Validates whether a string can be successfully decoded to a numeric ID.
47
- * Useful for route validation and input sanitization.
48
- *
49
- * @param str - The string to validate
50
- * @returns `true` if the string is a valid sqid, `false` otherwise
51
- *
52
- * @example
53
- * ```ts
54
- * if (isValidSqid("jR3k")) {
55
- * // Process the valid sqid
56
- * }
57
- * ```
58
- */
59
- export declare function isValidSqid(str: string): boolean;
60
- //# sourceMappingURL=sqid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqid.d.ts","sourceRoot":"","sources":["../../src/lib/sqid.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD"}
package/dist/lib/sse.d.ts DELETED
@@ -1,192 +0,0 @@
1
- /**
2
- * Datastar response utilities for v1.0.0-RC.7
3
- *
4
- * Provides both SSE (multi-event) and plain HTTP (single-event) response helpers.
5
- *
6
- * **Non-SSE helpers** (preferred for single operations):
7
- * - `dsRedirect(url)` — redirect via text/html
8
- * - `dsToast(message, type)` — toast notification via text/html
9
- * - `dsSignals(signals)` — signal patch via application/json
10
- *
11
- * **SSE** (for multiple operations in one response):
12
- * - `sse(c, handler)` — streaming SSE with full stream API
13
- *
14
- * Datastar auto-detects response type by Content-Type:
15
- * - `text/html` → dispatches as `datastar-patch-elements`
16
- * - `application/json` → dispatches as `datastar-patch-signals`
17
- *
18
- * @see https://data-star.dev/
19
- */
20
- import type { Context } from "hono";
21
- /**
22
- * Patch modes for DOM element updates
23
- *
24
- * @see https://data-star.dev/reference/action_plugins/backend/sse
25
- */
26
- export type PatchMode = "outer" | "inner" | "replace" | "prepend" | "append" | "before" | "after" | "remove";
27
- /**
28
- * SSE stream writer for Datastar events
29
- */
30
- export interface SSEStream {
31
- /**
32
- * Update reactive signals on the client
33
- *
34
- * @param signals - Object containing signal values to update
35
- * @param options - Optional settings (e.g. onlyIfMissing)
36
- *
37
- * @example
38
- * ```ts
39
- * await stream.patchSignals({ count: 42, loading: false });
40
- * ```
41
- */
42
- patchSignals(signals: Record<string, unknown>, options?: {
43
- onlyIfMissing?: boolean;
44
- }): void;
45
- /**
46
- * Update DOM elements via patching
47
- *
48
- * @param html - HTML content (must include element with id for targeting)
49
- * @param options - Optional patch mode, selector, and view transition
50
- *
51
- * @example
52
- * ```ts
53
- * // Outer patch element with matching id (default)
54
- * await stream.patchElements('<div id="content">New content</div>');
55
- *
56
- * // Append to a container
57
- * await stream.patchElements('<div>New item</div>', {
58
- * mode: 'append',
59
- * selector: '#list'
60
- * });
61
- * ```
62
- */
63
- patchElements(html: string, options?: {
64
- mode?: PatchMode;
65
- selector?: string;
66
- useViewTransition?: boolean;
67
- }): void;
68
- /**
69
- * Redirect the client to a new URL
70
- *
71
- * Uses patchElements internally to inject a script that navigates the client.
72
- *
73
- * @param url - The URL to redirect to
74
- *
75
- * @example
76
- * ```ts
77
- * await stream.redirect('/dash/posts');
78
- * ```
79
- */
80
- redirect(url: string): void;
81
- /**
82
- * Remove elements matching a CSS selector
83
- *
84
- * @param selector - CSS selector for elements to remove
85
- *
86
- * @example
87
- * ```ts
88
- * await stream.remove('#placeholder');
89
- * ```
90
- */
91
- remove(selector: string): void;
92
- /**
93
- * Show a toast notification
94
- *
95
- * Appends a toast element to `#toast-container` with auto-dismiss after 3s.
96
- *
97
- * @param message - The message to display
98
- * @param type - Toast type: "success" (default) or "error"
99
- *
100
- * @example
101
- * ```ts
102
- * await stream.toast("Settings saved successfully.");
103
- * await stream.toast("Something went wrong.", "error");
104
- * ```
105
- */
106
- toast(message: string, type?: "success" | "error"): void;
107
- }
108
- /**
109
- * Create an SSE response for Datastar
110
- *
111
- * @param c - Hono context
112
- * @param handler - Async function that writes to the SSE stream
113
- * @param options - Optional response options (e.g. headers for cookie forwarding)
114
- * @returns Response with SSE content-type
115
- *
116
- * @example
117
- * ```ts
118
- * app.post("/api/upload", (c) => {
119
- * return sse(c, async (stream) => {
120
- * await stream.patchSignals({ uploading: false });
121
- * await stream.patchElements('<div id="new-item">...</div>', {
122
- * mode: 'append',
123
- * selector: '#items'
124
- * });
125
- * });
126
- * });
127
- *
128
- * // With cookie forwarding (for auth)
129
- * app.post("/signin", (c) => {
130
- * return sse(c, async (stream) => {
131
- * await stream.redirect('/dash');
132
- * }, { headers: { 'Set-Cookie': cookieValue } });
133
- * });
134
- * ```
135
- */
136
- export declare function sse(c: Context, handler: (stream: SSEStream) => Promise<void>, options?: {
137
- headers?: Record<string, string>;
138
- }): Response;
139
- /**
140
- * Datastar redirect via text/html
141
- *
142
- * Returns a plain HTML response that Datastar dispatches as `datastar-patch-elements`.
143
- * Use instead of `sse()` when the only action is a redirect.
144
- *
145
- * @param url - The URL to redirect to
146
- * @param options - Optional extra headers (accepts any `HeadersInit`)
147
- * @returns Response with text/html content-type
148
- *
149
- * @example
150
- * ```ts
151
- * return dsRedirect("/dash/posts");
152
- *
153
- * // With cookie forwarding (for auth)
154
- * return dsRedirect("/dash", { headers: authResponse.headers });
155
- * ```
156
- */
157
- export declare function dsRedirect(url: string, options?: {
158
- headers?: Headers | Record<string, string> | string[][];
159
- }): Response;
160
- /**
161
- * Datastar toast notification via text/html
162
- *
163
- * Returns a plain HTML response that Datastar dispatches as `datastar-patch-elements`.
164
- * Use instead of `sse()` when the only action is showing a toast.
165
- *
166
- * @param message - The message to display
167
- * @param type - Toast type: "success" (default) or "error"
168
- * @returns Response with text/html content-type
169
- *
170
- * @example
171
- * ```ts
172
- * return dsToast("Settings saved successfully.");
173
- * return dsToast("Something went wrong.", "error");
174
- * ```
175
- */
176
- export declare function dsToast(message: string, type?: "success" | "error"): Response;
177
- /**
178
- * Datastar signal patch via application/json
179
- *
180
- * Returns a JSON response that Datastar dispatches as `datastar-patch-signals`.
181
- * Use instead of `sse()` when the only action is updating signals.
182
- *
183
- * @param signals - Object containing signal values to update
184
- * @returns Response with application/json content-type
185
- *
186
- * @example
187
- * ```ts
188
- * return dsSignals({ _uploadError: "File too large" });
189
- * ```
190
- */
191
- export declare function dsSignals(signals: Record<string, unknown>): Response;
192
- //# sourceMappingURL=sse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/lib/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;OAUG;IACH,YAAY,CACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GACpC,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,GACA,IAAI,CAAC;IAER;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;OASG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC;CAC1D;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,GAAG,CACjB,CAAC,EAAE,OAAO,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC7C,QAAQ,CAoFV;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,EAAE,CAAA;CAAE,GACpE,QAAQ,CAQV;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,SAAS,GAAG,OAAmB,GACpC,QAAQ,CAQV;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAIpE"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Theme Resolution Helpers
3
- *
4
- * Resolves the active color theme and builds CSS for injection into `<head>`.
5
- */
6
- import type { ColorTheme } from "../theme/color-themes.js";
7
- import type { JantConfig } from "../types.js";
8
- /**
9
- * Get the list of available color themes.
10
- *
11
- * Returns `config.theme.colorThemes` if provided, otherwise the built-in list.
12
- *
13
- * @param config - The Jant configuration
14
- * @returns Array of available color themes
15
- *
16
- * @example
17
- * ```typescript
18
- * const themes = getAvailableThemes(c.var.config);
19
- * ```
20
- */
21
- export declare function getAvailableThemes(config: JantConfig): ColorTheme[];
22
- /**
23
- * Build a `<style>` CSS string from a color theme and optional cssVariables overlay.
24
- *
25
- * Priority (lowest → highest):
26
- * BaseCoat defaults → selected theme → cssVariables
27
- *
28
- * @param theme - The active color theme (undefined = no theme overrides)
29
- * @param cssVariables - Extra CSS variable overrides from `createApp({ theme: { cssVariables } })`
30
- * @returns CSS string to inject in `<head>`, or empty string if nothing to inject
31
- *
32
- * Uses `:root:root` and `:root.dark` selectors for higher specificity than
33
- * BaseCoat defaults (`:root` and `.dark`). This ensures theme overrides win
34
- * regardless of source order — important because Vite dev mode injects CSS
35
- * as `<style>` tags after the theme `<style>`.
36
- *
37
- * @example
38
- * ```typescript
39
- * const css = buildThemeStyle(blueTheme, { "--radius": "0.5rem" });
40
- * // => ":root:root { --primary: oklch(...); ... }\n:root.dark { ... }"
41
- * ```
42
- */
43
- export declare function buildThemeStyle(theme: ColorTheme | undefined, cssVariables?: Record<string, string>): string;
44
- //# sourceMappingURL=theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,CAEnE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,CAkCR"}
@@ -1,90 +0,0 @@
1
- /**
2
- * Time Utilities
3
- */
4
- /**
5
- * Gets the current Unix timestamp in seconds.
6
- *
7
- * Returns the number of seconds since the Unix epoch (January 1, 1970 00:00:00 UTC).
8
- * This is the standard time format used throughout the application for consistency
9
- * and database storage.
10
- *
11
- * @returns Current Unix timestamp in seconds (not milliseconds)
12
- *
13
- * @example
14
- * ```ts
15
- * const timestamp = now();
16
- * // Returns: 1706745600 (example value for Feb 1, 2024)
17
- * ```
18
- */
19
- export declare function now(): number;
20
- /**
21
- * Checks if a Unix timestamp is within the last 30 days.
22
- *
23
- * Compares the given timestamp to the current time to determine if it falls within
24
- * the last month (defined as 30 days). Useful for highlighting recent posts or
25
- * filtering time-sensitive content.
26
- *
27
- * @param timestamp - Unix timestamp in seconds to check
28
- * @returns `true` if the timestamp is within the last 30 days, `false` otherwise
29
- *
30
- * @example
31
- * ```ts
32
- * const recentPost = 1706745600; // Recent timestamp
33
- * if (isWithinMonth(recentPost)) {
34
- * // Show "new" badge
35
- * }
36
- * ```
37
- */
38
- export declare function isWithinMonth(timestamp: number): boolean;
39
- /**
40
- * Converts a Unix timestamp to an ISO 8601 date-time string.
41
- *
42
- * Formats a Unix timestamp (in seconds) as an ISO 8601 string suitable for HTML
43
- * `datetime` attributes and API responses. The output includes full date, time,
44
- * and timezone information in UTC.
45
- *
46
- * @param timestamp - Unix timestamp in seconds to convert
47
- * @returns ISO 8601 formatted string (e.g., "2024-02-01T12:00:00.000Z")
48
- *
49
- * @example
50
- * ```ts
51
- * const isoDate = toISOString(1706745600);
52
- * // Returns: "2024-02-01T00:00:00.000Z"
53
- * ```
54
- */
55
- export declare function toISOString(timestamp: number): string;
56
- /**
57
- * Formats a Unix timestamp as a human-readable date string.
58
- *
59
- * Converts a Unix timestamp (in seconds) to a localized date string in the format
60
- * "MMM DD, YYYY" (e.g., "Jan 15, 2024"). Always uses UTC timezone to ensure
61
- * consistent display regardless of server or client location.
62
- *
63
- * @param timestamp - Unix timestamp in seconds to format
64
- * @returns Formatted date string in "MMM DD, YYYY" format
65
- *
66
- * @example
67
- * ```ts
68
- * const readable = formatDate(1706745600);
69
- * // Returns: "Feb 1, 2024"
70
- * ```
71
- */
72
- export declare function formatDate(timestamp: number): string;
73
- /**
74
- * Formats a Unix timestamp as a year-month string for grouping.
75
- *
76
- * Converts a Unix timestamp (in seconds) to a "YYYY-MM" format string, useful for
77
- * grouping posts by month in archives or creating month-based URLs. Always uses
78
- * UTC timezone for consistency.
79
- *
80
- * @param timestamp - Unix timestamp in seconds to format
81
- * @returns Year-month string in "YYYY-MM" format
82
- *
83
- * @example
84
- * ```ts
85
- * const yearMonth = formatYearMonth(1706745600);
86
- * // Returns: "2024-02"
87
- * ```
88
- */
89
- export declare function formatYearMonth(timestamp: number): string;
90
- //# sourceMappingURL=time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/lib/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKzD"}
package/dist/lib/url.d.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- * URL Utilities
3
- */
4
- /**
5
- * Extracts the hostname (domain) from a URL string.
6
- *
7
- * Parses a full URL and returns just the hostname portion (e.g., "example.com" from
8
- * "https://example.com/path"). Returns `null` if the URL is malformed or cannot be parsed.
9
- *
10
- * @param url - The full URL string to extract the domain from
11
- * @returns The hostname/domain if valid, or `null` if parsing fails
12
- *
13
- * @example
14
- * ```ts
15
- * const domain = extractDomain("https://www.example.com/path");
16
- * // Returns: "www.example.com"
17
- *
18
- * const invalid = extractDomain("not-a-url");
19
- * // Returns: null
20
- * ```
21
- */
22
- export declare function extractDomain(url: string): string | null;
23
- /**
24
- * Normalizes a path by removing slashes and converting to lowercase.
25
- *
26
- * Trims whitespace, converts to lowercase, removes leading and trailing slashes,
27
- * and collapses multiple consecutive slashes into single slashes. Used to create
28
- * consistent path representations for routing and storage.
29
- *
30
- * @param path - The path string to normalize
31
- * @returns The normalized path string
32
- *
33
- * @example
34
- * ```ts
35
- * const normalized = normalizePath(" /About/Contact// ");
36
- * // Returns: "about/contact"
37
- * ```
38
- */
39
- export declare function normalizePath(path: string): string;
40
- /**
41
- * Checks if a string is a full URL with HTTP or HTTPS protocol.
42
- *
43
- * Validates whether a string starts with "http://" or "https://", indicating it's
44
- * a full URL rather than a relative path. Useful for distinguishing between internal
45
- * paths and external URLs.
46
- *
47
- * @param str - The string to check
48
- * @returns `true` if the string starts with http:// or https://, `false` otherwise
49
- *
50
- * @example
51
- * ```ts
52
- * isFullUrl("https://example.com"); // Returns: true
53
- * isFullUrl("/about"); // Returns: false
54
- * isFullUrl("example.com"); // Returns: false
55
- * ```
56
- */
57
- export declare function isFullUrl(str: string): boolean;
58
- /**
59
- * Converts text to a URL-friendly slug.
60
- *
61
- * Transforms text into a lowercase, hyphen-separated slug by:
62
- * - Converting to lowercase
63
- * - Removing special characters (keeping only word characters, spaces, and hyphens)
64
- * - Replacing whitespace and underscores with hyphens
65
- * - Removing leading and trailing hyphens
66
- *
67
- * Used for generating clean URLs from titles and names.
68
- *
69
- * @param text - The text to convert to a slug
70
- * @returns The slugified string
71
- *
72
- * @example
73
- * ```ts
74
- * const slug = slugify("Hello World! This is a Test.");
75
- * // Returns: "hello-world-this-is-a-test"
76
- *
77
- * const slug = slugify(" Multiple Spaces ");
78
- * // Returns: "multiple-spaces"
79
- * ```
80
- */
81
- export declare function slugify(text: string): string;
82
- //# sourceMappingURL=url.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/lib/url.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOxD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO5C"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Authentication Middleware
3
- *
4
- * Protects routes by requiring authentication
5
- */
6
- import type { MiddlewareHandler } from "hono";
7
- import type { Bindings } from "../types.js";
8
- import type { AppVariables } from "../app.js";
9
- type Env = {
10
- Bindings: Bindings;
11
- Variables: AppVariables;
12
- };
13
- /**
14
- * Middleware that requires authentication.
15
- * Redirects to signin page if not authenticated.
16
- */
17
- export declare function requireAuth(redirectTo?: string): MiddlewareHandler<Env>;
18
- /**
19
- * Middleware for API routes that requires authentication.
20
- * Returns 401 if not authenticated.
21
- */
22
- export declare function requireAuthApi(): MiddlewareHandler<Env>;
23
- export {};
24
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,UAAU,SAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAoB1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAoBvD"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Onboarding Middleware
3
- *
4
- * Redirects all requests to /setup if onboarding hasn't been completed.
5
- * Caches the result in memory so the DB is only queried once per isolate lifetime.
6
- */
7
- import type { MiddlewareHandler } from "hono";
8
- import type { Bindings } from "../types.js";
9
- import type { AppVariables } from "../app.js";
10
- type Env = {
11
- Bindings: Bindings;
12
- Variables: AppVariables;
13
- };
14
- /**
15
- * Middleware that redirects to /setup if onboarding is not complete.
16
- * Uses module-level caching: once onboarding is confirmed complete,
17
- * no further DB queries are made for the lifetime of the Worker isolate.
18
- */
19
- export declare function requireOnboarding(): MiddlewareHandler<Env>;
20
- /**
21
- * Reset the onboarding cache. Only for testing.
22
- * @internal
23
- */
24
- export declare function resetOnboardingCache(): void;
25
- export {};
26
- //# sourceMappingURL=onboarding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/middleware/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAK3D;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAmB1D;AAaD;;;GAGG;AACH,wBAAgB,oBAAoB,SAEnC"}