create-feedbax 0.1.0 → 0.2.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 (210) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +11 -1
  3. package/dist/cli.js +1261 -26
  4. package/dist/index.js +1402 -160
  5. package/package.json +40 -14
  6. package/template/.feedbax-template.sha256 +1 -0
  7. package/template/.gitignore.template +6 -0
  8. package/template/.npmignore.template +5 -0
  9. package/template/.prettierignore.template +4 -0
  10. package/template/LICENSE +201 -0
  11. package/template/components.json +25 -0
  12. package/template/eslint.config.mjs +25 -0
  13. package/template/package.json +70 -14
  14. package/template/public/feedbax-mark.svg +4 -0
  15. package/template/public/robots.txt +3 -0
  16. package/template/src/authorized-draft-post.test.tsx +212 -0
  17. package/template/src/authorized-draft-post.tsx +204 -0
  18. package/template/src/authorized-draft-query.ts +74 -0
  19. package/template/src/browser-post-state.test.ts +120 -0
  20. package/template/src/browser-post-state.ts +134 -0
  21. package/template/src/browser-vote-state.test.ts +14 -0
  22. package/template/src/browser-vote-state.ts +27 -0
  23. package/template/src/capability-authorization-error.ts +3 -0
  24. package/template/src/changelog-page.test.tsx +139 -0
  25. package/template/src/changelog-page.tsx +219 -0
  26. package/template/src/changelog-query.ts +13 -0
  27. package/template/src/changelog-runtime.ts +27 -0
  28. package/template/src/cloudflare-turnstile.ts +31 -0
  29. package/template/src/cloudflare-workers-test.ts +3 -0
  30. package/template/src/cloudflare-workers.d.ts +18 -0
  31. package/template/src/comment-creation.test.tsx +270 -0
  32. package/template/src/comment-profile.ts +5 -0
  33. package/template/src/comment-thread-page.ts +18 -0
  34. package/template/src/components/command-palette-context.tsx +71 -0
  35. package/template/src/components/command-palette.tsx +246 -0
  36. package/template/src/components/create-post-trigger.tsx +44 -0
  37. package/template/src/components/device-profile-provider.tsx +309 -0
  38. package/template/src/components/header.tsx +95 -0
  39. package/template/src/components/loader.tsx +10 -0
  40. package/template/src/components/profile-menu.tsx +89 -0
  41. package/template/src/components/ui/components/alert-dialog.tsx +185 -0
  42. package/template/src/components/ui/components/attachment.tsx +207 -0
  43. package/template/src/components/ui/components/avatar.tsx +107 -0
  44. package/template/src/components/ui/components/badge.tsx +52 -0
  45. package/template/src/components/ui/components/bubble.tsx +128 -0
  46. package/template/src/components/ui/components/button-group.tsx +87 -0
  47. package/template/src/components/ui/components/button.tsx +56 -0
  48. package/template/src/components/ui/components/card.tsx +103 -0
  49. package/template/src/components/ui/components/checkbox.tsx +26 -0
  50. package/template/src/components/ui/components/command.tsx +194 -0
  51. package/template/src/components/ui/components/dialog.tsx +154 -0
  52. package/template/src/components/ui/components/drawer.tsx +229 -0
  53. package/template/src/components/ui/components/dropdown-menu.tsx +270 -0
  54. package/template/src/components/ui/components/empty.tsx +101 -0
  55. package/template/src/components/ui/components/field.tsx +236 -0
  56. package/template/src/components/ui/components/input-group.tsx +155 -0
  57. package/template/src/components/ui/components/input.tsx +20 -0
  58. package/template/src/components/ui/components/item.tsx +201 -0
  59. package/template/src/components/ui/components/kbd.tsx +26 -0
  60. package/template/src/components/ui/components/label.tsx +18 -0
  61. package/template/src/components/ui/components/marker.tsx +71 -0
  62. package/template/src/components/ui/components/message-scroller.tsx +128 -0
  63. package/template/src/components/ui/components/message.tsx +92 -0
  64. package/template/src/components/ui/components/native-select.tsx +65 -0
  65. package/template/src/components/ui/components/popover.tsx +88 -0
  66. package/template/src/components/ui/components/portal-primitives.test.tsx +85 -0
  67. package/template/src/components/ui/components/radio-group.tsx +36 -0
  68. package/template/src/components/ui/components/scroll-area.tsx +52 -0
  69. package/template/src/components/ui/components/secondary-form-actions.test.tsx +23 -0
  70. package/template/src/components/ui/components/select.tsx +199 -0
  71. package/template/src/components/ui/components/separator.tsx +23 -0
  72. package/template/src/components/ui/components/sheet.tsx +135 -0
  73. package/template/src/components/ui/components/skeleton.tsx +13 -0
  74. package/template/src/components/ui/components/sonner.tsx +43 -0
  75. package/template/src/components/ui/components/spinner.tsx +16 -0
  76. package/template/src/components/ui/components/tabs.tsx +80 -0
  77. package/template/src/components/ui/components/textarea.tsx +18 -0
  78. package/template/src/components/ui/components/tooltip.tsx +64 -0
  79. package/template/src/components/ui/hooks/.gitkeep +0 -0
  80. package/template/src/components/ui/lib/utils.ts +6 -0
  81. package/template/src/components/ui/styles/globals.css +151 -0
  82. package/template/src/create-post-overlay.tsx +82 -0
  83. package/template/src/draft-post-list.tsx +39 -0
  84. package/template/src/feedback-cache-invalidation.test.ts +185 -0
  85. package/template/src/feedback-cache-invalidation.ts +97 -0
  86. package/template/src/feedback-runtime.ts +38 -0
  87. package/template/src/feedbax/changelog/index.test.ts +156 -0
  88. package/template/src/feedbax/changelog/index.ts +206 -0
  89. package/template/src/feedbax/changelog/notion-changelog.test.ts +395 -0
  90. package/template/src/feedbax/changelog/notion-changelog.ts +400 -0
  91. package/template/src/feedbax/config/index.test.ts +111 -0
  92. package/template/src/feedbax/config/index.ts +271 -0
  93. package/template/src/feedbax/feedback/feedback-storage.ts +43 -0
  94. package/template/src/feedbax/feedback/index.test.ts +900 -0
  95. package/template/src/feedbax/feedback/index.ts +942 -0
  96. package/template/src/feedbax/feedback/notion-comments.test.ts +171 -0
  97. package/template/src/feedbax/feedback/notion-comments.ts +231 -0
  98. package/template/src/feedbax/feedback/notion-data-source.test.ts +364 -0
  99. package/template/src/feedbax/feedback/notion-data-source.ts +458 -0
  100. package/template/src/feedbax/feedback/notion-feedback.test.ts +998 -0
  101. package/template/src/feedbax/feedback/notion-feedback.ts +651 -0
  102. package/template/src/feedbax/feedback/notion-request.ts +74 -0
  103. package/template/src/feedbax.test-fixture.ts +64 -0
  104. package/template/src/feedbax.ts +69 -0
  105. package/template/src/index.css +2138 -0
  106. package/template/src/lazy-create-post-overlay.tsx +6 -0
  107. package/template/src/lazy-post-detail-overlay.tsx +10 -0
  108. package/template/src/masked-post-link.tsx +27 -0
  109. package/template/src/overlay-post-detail.test.tsx +130 -0
  110. package/template/src/overlay-post-detail.tsx +92 -0
  111. package/template/src/portal-comments.test.ts +375 -0
  112. package/template/src/portal-comments.ts +384 -0
  113. package/template/src/portal-features.test.tsx +150 -0
  114. package/template/src/portal-feedback-form.tsx +515 -0
  115. package/template/src/portal-feedback-runtime.test.ts +32 -0
  116. package/template/src/portal-feedback-runtime.ts +55 -0
  117. package/template/src/portal-feedback-server-function.ts +93 -0
  118. package/template/src/portal-feedback-submission.test.ts +307 -0
  119. package/template/src/portal-feedback-submission.ts +214 -0
  120. package/template/src/portal-head.ts +58 -0
  121. package/template/src/portal-server-entry.ts +64 -0
  122. package/template/src/portal-voting.test.ts +106 -0
  123. package/template/src/portal-voting.ts +149 -0
  124. package/template/src/post-badges.tsx +27 -0
  125. package/template/src/post-creation-flow.test.tsx +230 -0
  126. package/template/src/post-creation-flow.tsx +88 -0
  127. package/template/src/post-detail-overlay.test.tsx +114 -0
  128. package/template/src/post-detail-overlay.tsx +67 -0
  129. package/template/src/post-feed-controls.test.tsx +239 -0
  130. package/template/src/post-feed-controls.tsx +298 -0
  131. package/template/src/post-presentation.ts +37 -0
  132. package/template/src/post-queries.test.ts +158 -0
  133. package/template/src/post-queries.ts +26 -0
  134. package/template/src/post-results.tsx +165 -0
  135. package/template/src/public-cache-policy.test.ts +141 -0
  136. package/template/src/public-cache-policy.ts +119 -0
  137. package/template/src/public-cache-tags.ts +7 -0
  138. package/template/src/public-changelog-page.ts +15 -0
  139. package/template/src/public-changelog-server-function.ts +27 -0
  140. package/template/src/public-date.ts +11 -0
  141. package/template/src/public-failure-state.test.tsx +69 -0
  142. package/template/src/public-feedback-index.tsx +124 -0
  143. package/template/src/public-feedback-page.test.tsx +290 -0
  144. package/template/src/public-feedback-page.ts +75 -0
  145. package/template/src/public-feedback-server-function.ts +22 -0
  146. package/template/src/public-portal-error.tsx +27 -0
  147. package/template/src/public-post-detail.tsx +682 -0
  148. package/template/src/public-post-page.test.tsx +173 -0
  149. package/template/src/public-post-page.ts +15 -0
  150. package/template/src/public-post-route.test.tsx +214 -0
  151. package/template/src/public-post-route.tsx +171 -0
  152. package/template/src/public-post-server-function.ts +48 -0
  153. package/template/src/public-post-unavailable.tsx +10 -0
  154. package/template/src/public-roadmap-page.test.tsx +139 -0
  155. package/template/src/public-roadmap-page.ts +24 -0
  156. package/template/src/public-roadmap-route.test.tsx +218 -0
  157. package/template/src/public-roadmap-route.tsx +50 -0
  158. package/template/src/public-roadmap-server-function.ts +44 -0
  159. package/template/src/public-roadmap-view.tsx +378 -0
  160. package/template/src/public-shell.test.tsx +518 -0
  161. package/template/src/roadmap-query.ts +21 -0
  162. package/template/src/root-branding.test.ts +53 -0
  163. package/template/src/routeTree.gen.ts +131 -0
  164. package/template/src/routed-post-creation-form.tsx +28 -0
  165. package/template/src/router.tsx +25 -0
  166. package/template/src/routes/__root.tsx +116 -0
  167. package/template/src/routes/changelog.tsx +39 -0
  168. package/template/src/routes/index.tsx +61 -0
  169. package/template/src/routes/p.$slug.tsx +16 -0
  170. package/template/src/routes/roadmap.tsx +11 -0
  171. package/template/src/routes/submit.tsx +28 -0
  172. package/template/src/safe-public-failure.ts +45 -0
  173. package/template/src/server.ts +111 -0
  174. package/template/src/similar-posts.tsx +45 -0
  175. package/template/src/submit-route.test.tsx +134 -0
  176. package/template/src/trusted-feedback-handler.test.ts +425 -0
  177. package/template/src/trusted-feedback-handler.ts +181 -0
  178. package/template/src/trusted-feedback-runtime.ts +17 -0
  179. package/template/src/turnstile-configuration.test.ts +37 -0
  180. package/template/src/turnstile-configuration.ts +19 -0
  181. package/template/src/use-media-query.ts +17 -0
  182. package/template/src/vote-toggle.test.tsx +171 -0
  183. package/template/src/vote-toggle.tsx +211 -0
  184. package/template/tsconfig.json +45 -0
  185. package/template/vite.config.ts +20 -0
  186. package/template/vitest.config.ts +4 -0
  187. package/template/vitest.setup.ts +3 -0
  188. package/template/wrangler.jsonc +35 -0
  189. package/dist/cli.d.ts +0 -3
  190. package/dist/cli.d.ts.map +0 -1
  191. package/dist/cli.js.map +0 -1
  192. package/dist/index.d.ts +0 -21
  193. package/dist/index.d.ts.map +0 -1
  194. package/dist/index.js.map +0 -1
  195. package/template/.env.example +0 -4
  196. package/template/README.md +0 -7
  197. package/template/apps/portal/components.json +0 -20
  198. package/template/apps/portal/package.json +0 -31
  199. package/template/apps/portal/src/lib/utils.ts +0 -6
  200. package/template/apps/portal/src/routeTree.gen.ts +0 -59
  201. package/template/apps/portal/src/router.tsx +0 -10
  202. package/template/apps/portal/src/routes/__root.tsx +0 -31
  203. package/template/apps/portal/src/routes/index.tsx +0 -35
  204. package/template/apps/portal/src/styles.css +0 -91
  205. package/template/apps/portal/tsconfig.json +0 -15
  206. package/template/apps/portal/vite.config.ts +0 -13
  207. package/template/feedbax.config.ts +0 -13
  208. package/template/feedbax.jsonc +0 -11
  209. package/template/pnpm-workspace.yaml +0 -3
  210. package/template/turbo.json +0 -8
@@ -0,0 +1,395 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+
3
+ import {
4
+ createChangelogModule,
5
+ createNotionChangelogDataSource,
6
+ createNotionChangelogStorage,
7
+ validateNotionChangelogDataSource,
8
+ type ChangelogPropertyIds,
9
+ } from ".";
10
+
11
+ const propertyIds: ChangelogPropertyIds = {
12
+ title: "title-id",
13
+ slug: "slug-id",
14
+ date: "date-id",
15
+ summary: "summary-id",
16
+ body: "body-id",
17
+ labels: "labels-id",
18
+ image: "image-id",
19
+ published: "published-id",
20
+ createdAt: "created-id",
21
+ updatedAt: "updated-id",
22
+ };
23
+
24
+ describe("Notion Changelog Data Source contract", () => {
25
+ it("creates an empty sibling data source with the canonical schema", async () => {
26
+ const request = vi
27
+ .fn<typeof fetch>()
28
+ .mockResolvedValueOnce(Response.json(notionDataSource()));
29
+
30
+ await expect(
31
+ createNotionChangelogDataSource({
32
+ token: "token",
33
+ databaseId: "feedbax-database",
34
+ request,
35
+ }),
36
+ ).resolves.toEqual({
37
+ databaseId: "feedbax-database",
38
+ dataSourceId: "changelog-source",
39
+ propertyIds,
40
+ });
41
+ const body = JSON.parse(String(request.mock.calls[0]?.[1]?.body));
42
+ expect(request.mock.calls[0]?.[0]).toBe(
43
+ "https://api.notion.com/v1/data_sources",
44
+ );
45
+ expect(body.parent).toEqual({ database_id: "feedbax-database" });
46
+ expect(body.properties).toMatchObject({
47
+ Title: { title: {} },
48
+ Slug: { rich_text: {} },
49
+ Date: { date: {} },
50
+ Summary: { rich_text: {} },
51
+ Body: { rich_text: {} },
52
+ Labels: { multi_select: { options: [] } },
53
+ Image: { files: {} },
54
+ Published: { checkbox: {} },
55
+ "Created At": { created_time: {} },
56
+ "Updated At": { last_edited_time: {} },
57
+ });
58
+ expect(request).toHaveBeenCalledTimes(1);
59
+ });
60
+
61
+ it("accepts a compatible data source in another database and reports wrong types", async () => {
62
+ const validRequest = vi
63
+ .fn<typeof fetch>()
64
+ .mockResolvedValueOnce(
65
+ Response.json(notionDataSource({ databaseId: "marketing-database" })),
66
+ );
67
+ await expect(
68
+ validateNotionChangelogDataSource({
69
+ token: "token",
70
+ dataSourceId: "changelog-source",
71
+ propertyIds,
72
+ request: validRequest,
73
+ }),
74
+ ).resolves.toMatchObject({ databaseId: "marketing-database" });
75
+
76
+ const invalid = notionDataSource();
77
+ invalid.properties.Summary.type = "number";
78
+ await expect(
79
+ validateNotionChangelogDataSource({
80
+ token: "token",
81
+ dataSourceId: "changelog-source",
82
+ propertyIds,
83
+ request: vi
84
+ .fn<typeof fetch>()
85
+ .mockResolvedValue(Response.json(invalid)),
86
+ }),
87
+ ).rejects.toThrow(
88
+ 'Change the property configured as "Summary" (ID "summary-id") from "number" to "rich_text"',
89
+ );
90
+ });
91
+ });
92
+
93
+ describe("Notion Changelog query contract", () => {
94
+ it("maps projected properties when Notion keys them by property name", async () => {
95
+ const page = notionPage();
96
+ page.properties = Object.fromEntries(
97
+ Object.entries(page.properties).map(([id, property]) => [
98
+ id === propertyIds.title
99
+ ? "Title"
100
+ : id === propertyIds.slug
101
+ ? "Slug"
102
+ : id === propertyIds.date
103
+ ? "Date"
104
+ : id === propertyIds.summary
105
+ ? "Summary"
106
+ : id === propertyIds.body
107
+ ? "Body"
108
+ : id === propertyIds.labels
109
+ ? "Labels"
110
+ : "Image",
111
+ { ...property, id },
112
+ ]),
113
+ );
114
+ const storage = createNotionChangelogStorage({
115
+ token: "token",
116
+ dataSourceId: "changelog-source",
117
+ propertyIds,
118
+ request: vi
119
+ .fn<typeof fetch>()
120
+ .mockResolvedValueOnce(
121
+ Response.json({ results: [page], has_more: false }),
122
+ ),
123
+ });
124
+
125
+ await expect(storage.listPublished({})).resolves.toMatchObject({
126
+ items: [{ slug: "entry", title: "Entry", body: "Body text" }],
127
+ });
128
+ });
129
+
130
+ it("queries only Published entries with public properties, ordering, Labels, and cursors", async () => {
131
+ const request = vi.fn<typeof fetch>().mockResolvedValueOnce(
132
+ Response.json({
133
+ results: [notionPage()],
134
+ has_more: true,
135
+ next_cursor: "notion-next",
136
+ }),
137
+ );
138
+ const storage = createNotionChangelogStorage({
139
+ token: "token",
140
+ dataSourceId: "changelog-source",
141
+ propertyIds,
142
+ request,
143
+ });
144
+
145
+ await expect(
146
+ storage.listPublished({ cursor: "notion-current", label: "Improved" }),
147
+ ).resolves.toMatchObject({
148
+ items: [
149
+ {
150
+ slug: "entry",
151
+ title: "Entry",
152
+ summary: "Summary text",
153
+ body: "Body text",
154
+ labels: ["Improved"],
155
+ },
156
+ ],
157
+ nextCursor: "notion-next",
158
+ });
159
+ const [url, init] = request.mock.calls[0] ?? [];
160
+ const query = new URL(String(url)).searchParams.getAll("filter_properties");
161
+ expect(query).toEqual([
162
+ propertyIds.title,
163
+ propertyIds.slug,
164
+ propertyIds.date,
165
+ propertyIds.summary,
166
+ propertyIds.body,
167
+ propertyIds.labels,
168
+ propertyIds.image,
169
+ propertyIds.updatedAt,
170
+ ]);
171
+ expect(query).not.toContain(propertyIds.published);
172
+ expect(JSON.parse(String(init?.body))).toEqual({
173
+ page_size: 20,
174
+ start_cursor: "notion-current",
175
+ filter: {
176
+ and: [
177
+ { property: propertyIds.published, checkbox: { equals: true } },
178
+ {
179
+ property: propertyIds.labels,
180
+ multi_select: { contains: "Improved" },
181
+ },
182
+ ],
183
+ },
184
+ sorts: [
185
+ { property: propertyIds.date, direction: "descending" },
186
+ { timestamp: "created_time", direction: "ascending" },
187
+ { property: propertyIds.slug, direction: "ascending" },
188
+ ],
189
+ });
190
+ });
191
+
192
+ it("maps one temporary File reference with its expiry and reports additional files", async () => {
193
+ const page = notionPage();
194
+ page.properties[propertyIds.image] = {
195
+ type: "files",
196
+ files: [
197
+ {
198
+ name: "release.png",
199
+ type: "file",
200
+ file: {
201
+ url: "https://files.notion.example/release.png",
202
+ expiry_time: "2026-08-26T14:00:00.000Z",
203
+ },
204
+ },
205
+ {
206
+ name: "extra.png",
207
+ type: "external",
208
+ external: { url: "https://cdn.example/extra.png" },
209
+ },
210
+ ],
211
+ };
212
+ const diagnostics: string[] = [];
213
+ const storage = createNotionChangelogStorage({
214
+ token: "token",
215
+ dataSourceId: "changelog-source",
216
+ propertyIds,
217
+ request: vi
218
+ .fn<typeof fetch>()
219
+ .mockResolvedValueOnce(
220
+ Response.json({ results: [page], has_more: false }),
221
+ ),
222
+ onDiagnostic: (message) => diagnostics.push(message),
223
+ });
224
+
225
+ await expect(storage.listPublished({})).resolves.toMatchObject({
226
+ items: [
227
+ {
228
+ title: "Entry",
229
+ image: {
230
+ src: "https://files.notion.example/release.png",
231
+ alt: "Entry image",
232
+ expiresAt: new Date("2026-08-26T14:00:00.000Z"),
233
+ },
234
+ },
235
+ ],
236
+ });
237
+ expect(diagnostics).toEqual([
238
+ 'Changelog Entry "entry" has 2 Image files; only the first file is in the public contract.',
239
+ ]);
240
+ });
241
+
242
+ it("maps a temporary File reference's exact expiry while preserving entry text", async () => {
243
+ const page = notionPage();
244
+ page.properties[propertyIds.image] = {
245
+ type: "files",
246
+ files: [
247
+ {
248
+ name: "release.png",
249
+ type: "file",
250
+ file: {
251
+ url: "https://files.notion.example/release.png",
252
+ expiry_time: "2026-08-26T12:00:30.000Z",
253
+ },
254
+ },
255
+ ],
256
+ };
257
+ const storage = createNotionChangelogStorage({
258
+ token: "token",
259
+ dataSourceId: "changelog-source",
260
+ propertyIds,
261
+ request: vi
262
+ .fn<typeof fetch>()
263
+ .mockResolvedValueOnce(
264
+ Response.json({ results: [page], has_more: false }),
265
+ ),
266
+ });
267
+
268
+ await expect(storage.listPublished({})).resolves.toMatchObject({
269
+ items: [
270
+ {
271
+ title: "Entry",
272
+ summary: "Summary text",
273
+ body: "Body text",
274
+ image: { expiresAt: new Date("2026-08-26T12:00:30.000Z") },
275
+ },
276
+ ],
277
+ });
278
+ });
279
+
280
+ it("refreshes a discarded temporary reference and contains malformed Image data", async () => {
281
+ const expiringPage = notionPage();
282
+ expiringPage.properties[propertyIds.image] = {
283
+ type: "files",
284
+ files: [
285
+ {
286
+ type: "file",
287
+ file: {
288
+ url: "https://files.notion.example/release.png",
289
+ expiry_time: "2026-08-26T12:00:30.000Z",
290
+ },
291
+ },
292
+ ],
293
+ };
294
+ const refreshedPage = notionPage();
295
+ refreshedPage.properties[propertyIds.image] = {
296
+ type: "files",
297
+ files: [
298
+ {
299
+ type: "file",
300
+ file: {
301
+ url: "https://files.notion.example/release.png",
302
+ expiry_time: "2026-08-26T14:00:00.000Z",
303
+ },
304
+ },
305
+ ],
306
+ };
307
+ const malformedPage = notionPage();
308
+ malformedPage.properties[propertyIds.image] = {
309
+ type: "files",
310
+ files: ["not-a-file"],
311
+ };
312
+ const request = vi
313
+ .fn<typeof fetch>()
314
+ .mockResolvedValueOnce(
315
+ Response.json({ results: [expiringPage], has_more: false }),
316
+ )
317
+ .mockResolvedValueOnce(
318
+ Response.json({ results: [refreshedPage], has_more: false }),
319
+ )
320
+ .mockResolvedValueOnce(
321
+ Response.json({ results: [malformedPage], has_more: false }),
322
+ );
323
+ const storage = createNotionChangelogStorage({
324
+ token: "token",
325
+ dataSourceId: "changelog-source",
326
+ propertyIds,
327
+ request,
328
+ onDiagnostic: vi.fn(),
329
+ });
330
+ const changelog = createChangelogModule({
331
+ storage,
332
+ now: () => new Date("2026-08-26T12:00:00.000Z"),
333
+ });
334
+
335
+ expect(
336
+ (await changelog.listPublishedEntries()).items[0],
337
+ ).not.toHaveProperty("image");
338
+ expect((await changelog.listPublishedEntries()).items[0]).toHaveProperty(
339
+ "image.src",
340
+ "https://files.notion.example/release.png",
341
+ );
342
+ await expect(changelog.listPublishedEntries()).resolves.toMatchObject({
343
+ items: [{ title: "Entry", summary: "Summary text", body: "Body text" }],
344
+ });
345
+ });
346
+ });
347
+
348
+ function notionDataSource({ databaseId = "feedbax-database" } = {}) {
349
+ const properties = Object.fromEntries(
350
+ [
351
+ ["Title", propertyIds.title, "title"],
352
+ ["Slug", propertyIds.slug, "rich_text"],
353
+ ["Date", propertyIds.date, "date"],
354
+ ["Summary", propertyIds.summary, "rich_text"],
355
+ ["Body", propertyIds.body, "rich_text"],
356
+ ["Labels", propertyIds.labels, "multi_select"],
357
+ ["Image", propertyIds.image, "files"],
358
+ ["Published", propertyIds.published, "checkbox"],
359
+ ["Created At", propertyIds.createdAt, "created_time"],
360
+ ["Updated At", propertyIds.updatedAt, "last_edited_time"],
361
+ ].map(([name, id, type]) => [name, { id, name, type }]),
362
+ );
363
+ return {
364
+ id: "changelog-source",
365
+ parent: { type: "database_id", database_id: databaseId },
366
+ properties,
367
+ };
368
+ }
369
+
370
+ function notionPage() {
371
+ return {
372
+ id: "page-id",
373
+ created_time: "2026-08-01T00:00:00.000Z",
374
+ last_edited_time: "2026-08-02T00:00:00.000Z",
375
+ properties: {
376
+ [propertyIds.title]: { type: "title", title: [text("Entry")] },
377
+ [propertyIds.slug]: { type: "rich_text", rich_text: [text("entry")] },
378
+ [propertyIds.date]: { type: "date", date: { start: "2026-08-01" } },
379
+ [propertyIds.summary]: {
380
+ type: "rich_text",
381
+ rich_text: [text("Summary "), text("text")],
382
+ },
383
+ [propertyIds.body]: { type: "rich_text", rich_text: [text("Body text")] },
384
+ [propertyIds.labels]: {
385
+ type: "multi_select",
386
+ multi_select: [{ name: "Improved" }],
387
+ },
388
+ [propertyIds.image]: { type: "files", files: [] as unknown[] },
389
+ },
390
+ };
391
+ }
392
+
393
+ function text(content: string) {
394
+ return { type: "text", plain_text: content, text: { content } };
395
+ }