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,364 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+
3
+ import {
4
+ createNotionFeedbackDataSource,
5
+ feedbackWorkflowProperties,
6
+ validateNotionFeedbackDataSource,
7
+ type FeedbackPropertyIds,
8
+ } from "./index";
9
+
10
+ const propertyIds: FeedbackPropertyIds = {
11
+ title: "title-id",
12
+ slug: "slug-id",
13
+ description: "description-id",
14
+ type: "type-id",
15
+ status: "status-id",
16
+ published: "published-id",
17
+ voteCount: "vote-count-id",
18
+ teamResponse: "team-response-id",
19
+ releaseNotesUrl: "release-notes-url-id",
20
+ submitterName: "submitter-name-id",
21
+ submitterEmail: "submitter-email-id",
22
+ source: "source-id",
23
+ externalId: "external-id",
24
+ editTokenHash: "edit-token-hash-id",
25
+ createdAt: "created-at-id",
26
+ updatedAt: "updated-at-id",
27
+ };
28
+
29
+ describe("Notion Feedback Data Source", () => {
30
+ it("retries transient failures while validating a Feedback Data Source", async () => {
31
+ const delays: number[] = [];
32
+ const request = vi
33
+ .fn<typeof fetch>()
34
+ .mockResolvedValueOnce(
35
+ Response.json(
36
+ { object: "error", message: "rate limited" },
37
+ { status: 429, headers: { "Retry-After": "1" } },
38
+ ),
39
+ )
40
+ .mockResolvedValueOnce(
41
+ Response.json({
42
+ object: "data_source",
43
+ id: "feedback-data-source",
44
+ parent: { type: "database_id", database_id: "feedback-database" },
45
+ properties: Object.fromEntries(
46
+ Object.entries(propertyIds).map(([key, id]) => [
47
+ key,
48
+ { id, name: key, type: expectedTypes[key] },
49
+ ]),
50
+ ),
51
+ }),
52
+ );
53
+
54
+ await expect(
55
+ validateNotionFeedbackDataSource({
56
+ token: "notion-token",
57
+ dataSourceId: "feedback-data-source",
58
+ propertyIds,
59
+ request,
60
+ retry: {
61
+ sleep: async (milliseconds) => {
62
+ delays.push(milliseconds);
63
+ },
64
+ random: () => 0,
65
+ },
66
+ }),
67
+ ).resolves.toMatchObject({ dataSourceId: "feedback-data-source" });
68
+ expect(request).toHaveBeenCalledTimes(2);
69
+ expect(delays).toEqual([1_000]);
70
+ });
71
+
72
+ it("creates every canonical property with Notion API 2026-03-11", async () => {
73
+ const request = vi
74
+ .fn<typeof fetch>()
75
+ .mockResolvedValueOnce(
76
+ Response.json({
77
+ object: "database",
78
+ id: "feedback-database",
79
+ data_sources: [
80
+ { id: "feedback-data-source", name: "Feedback data source" },
81
+ ],
82
+ }),
83
+ )
84
+ .mockResolvedValueOnce(
85
+ Response.json({
86
+ object: "data_source",
87
+ id: "feedback-data-source",
88
+ properties: Object.fromEntries(
89
+ [
90
+ ["Title", "title-id", "title"],
91
+ ["Slug", "slug-id", "rich_text"],
92
+ ["Description", "description-id", "rich_text"],
93
+ ["Type", "type-id", "select"],
94
+ ["Status", "status-id", "select"],
95
+ ["Published", "published-id", "checkbox"],
96
+ ["Vote Count", "vote-count-id", "number"],
97
+ ["Team Response", "team-response-id", "rich_text"],
98
+ ["Release Notes URL", "release-notes-url-id", "url"],
99
+ ["Submitter Name", "submitter-name-id", "rich_text"],
100
+ ["Submitter Email", "submitter-email-id", "email"],
101
+ ["Source", "source-id", "select"],
102
+ ["External ID", "external-id", "rich_text"],
103
+ ["Edit Token Hash", "edit-token-hash-id", "rich_text"],
104
+ ["Created At", "created-at-id", "created_time"],
105
+ ["Updated At", "updated-at-id", "last_edited_time"],
106
+ ].map(([name, id, type]) => [name, { id, name, type }]),
107
+ ),
108
+ }),
109
+ );
110
+
111
+ const result = await createNotionFeedbackDataSource({
112
+ token: "notion-token",
113
+ parentPageId: "parent-page",
114
+ request,
115
+ });
116
+
117
+ expect(request).toHaveBeenNthCalledWith(
118
+ 1,
119
+ "https://api.notion.com/v1/databases",
120
+ expect.objectContaining({
121
+ method: "POST",
122
+ headers: {
123
+ Authorization: "Bearer notion-token",
124
+ "Content-Type": "application/json",
125
+ "Notion-Version": "2026-03-11",
126
+ },
127
+ }),
128
+ );
129
+ const body = JSON.parse(String(request.mock.calls[0]?.[1]?.body)) as Record<
130
+ string,
131
+ unknown
132
+ >;
133
+ expect(body).toEqual({
134
+ parent: { type: "page_id", page_id: "parent-page" },
135
+ title: [{ type: "text", text: { content: "Feedback" } }],
136
+ initial_data_source: {
137
+ properties: {
138
+ Title: { title: {} },
139
+ Slug: { rich_text: {} },
140
+ Description: { rich_text: {} },
141
+ Type: {
142
+ select: {
143
+ options: [
144
+ { name: "Feature Request" },
145
+ { name: "Bug Report" },
146
+ { name: "General Feedback" },
147
+ ],
148
+ },
149
+ },
150
+ Status: {
151
+ select: {
152
+ options: [
153
+ { name: "New" },
154
+ { name: "Reviewing" },
155
+ { name: "Planned" },
156
+ { name: "In Progress" },
157
+ { name: "Shipped" },
158
+ { name: "Closed" },
159
+ ],
160
+ },
161
+ },
162
+ Published: { checkbox: {} },
163
+ "Vote Count": { number: { format: "number" } },
164
+ "Team Response": { rich_text: {} },
165
+ "Release Notes URL": { url: {} },
166
+ "Submitter Name": { rich_text: {} },
167
+ "Submitter Email": { email: {} },
168
+ Source: {
169
+ select: {
170
+ options: [{ name: "Portal" }, { name: "API" }, { name: "Team" }],
171
+ },
172
+ },
173
+ "External ID": { rich_text: {} },
174
+ "Edit Token Hash": { rich_text: {} },
175
+ "Created At": { created_time: {} },
176
+ "Updated At": { last_edited_time: {} },
177
+ ...feedbackWorkflowProperties,
178
+ },
179
+ },
180
+ });
181
+ expect(request).toHaveBeenNthCalledWith(
182
+ 2,
183
+ "https://api.notion.com/v1/data_sources/feedback-data-source",
184
+ {
185
+ method: "GET",
186
+ headers: {
187
+ Authorization: "Bearer notion-token",
188
+ "Content-Type": "application/json",
189
+ "Notion-Version": "2026-03-11",
190
+ },
191
+ },
192
+ );
193
+ expect(result).toEqual({
194
+ databaseId: "feedback-database",
195
+ dataSourceId: "feedback-data-source",
196
+ propertyIds: {
197
+ title: "title-id",
198
+ slug: "slug-id",
199
+ description: "description-id",
200
+ type: "type-id",
201
+ status: "status-id",
202
+ published: "published-id",
203
+ voteCount: "vote-count-id",
204
+ teamResponse: "team-response-id",
205
+ releaseNotesUrl: "release-notes-url-id",
206
+ submitterName: "submitter-name-id",
207
+ submitterEmail: "submitter-email-id",
208
+ source: "source-id",
209
+ externalId: "external-id",
210
+ editTokenHash: "edit-token-hash-id",
211
+ createdAt: "created-at-id",
212
+ updatedAt: "updated-at-id",
213
+ },
214
+ });
215
+ });
216
+
217
+ it("accepts renamed required properties and additional Product Team properties", async () => {
218
+ const request = vi.fn<typeof fetch>().mockResolvedValue(
219
+ Response.json({
220
+ object: "data_source",
221
+ id: "feedback-data-source",
222
+ parent: { type: "database_id", database_id: "feedback-database" },
223
+ properties: {
224
+ Summary: { id: "title-id", name: "Summary", type: "title" },
225
+ Path: { id: "slug-id", name: "Path", type: "rich_text" },
226
+ Details: {
227
+ id: "description-id",
228
+ name: "Details",
229
+ type: "rich_text",
230
+ },
231
+ Kind: { id: "type-id", name: "Kind", type: "select" },
232
+ Workflow: { id: "status-id", name: "Workflow", type: "select" },
233
+ Visible: {
234
+ id: "published-id",
235
+ name: "Visible",
236
+ type: "checkbox",
237
+ },
238
+ Votes: { id: "vote-count-id", name: "Votes", type: "number" },
239
+ Response: {
240
+ id: "team-response-id",
241
+ name: "Response",
242
+ type: "rich_text",
243
+ },
244
+ Release: {
245
+ id: "release-notes-url-id",
246
+ name: "Release",
247
+ type: "url",
248
+ },
249
+ Contact: {
250
+ id: "submitter-name-id",
251
+ name: "Contact",
252
+ type: "rich_text",
253
+ },
254
+ Email: {
255
+ id: "submitter-email-id",
256
+ name: "Email",
257
+ type: "email",
258
+ },
259
+ Origin: { id: "source-id", name: "Origin", type: "select" },
260
+ Reference: {
261
+ id: "external-id",
262
+ name: "Reference",
263
+ type: "rich_text",
264
+ },
265
+ Capability: {
266
+ id: "edit-token-hash-id",
267
+ name: "Capability",
268
+ type: "rich_text",
269
+ },
270
+ Submitted: {
271
+ id: "created-at-id",
272
+ name: "Submitted",
273
+ type: "created_time",
274
+ },
275
+ Changed: {
276
+ id: "updated-at-id",
277
+ name: "Changed",
278
+ type: "last_edited_time",
279
+ },
280
+ Priority: { id: "custom-priority", name: "Priority", type: "number" },
281
+ },
282
+ }),
283
+ );
284
+
285
+ await expect(
286
+ validateNotionFeedbackDataSource({
287
+ token: "notion-token",
288
+ dataSourceId: "feedback-data-source",
289
+ propertyIds,
290
+ request,
291
+ }),
292
+ ).resolves.toEqual({
293
+ databaseId: "feedback-database",
294
+ dataSourceId: "feedback-data-source",
295
+ propertyIds,
296
+ });
297
+ expect(request).toHaveBeenCalledWith(
298
+ "https://api.notion.com/v1/data_sources/feedback-data-source",
299
+ {
300
+ method: "GET",
301
+ headers: {
302
+ Authorization: "Bearer notion-token",
303
+ "Content-Type": "application/json",
304
+ "Notion-Version": "2026-03-11",
305
+ },
306
+ },
307
+ );
308
+ });
309
+
310
+ it("reports precise repairs for missing and incompatible required properties", async () => {
311
+ const request = vi.fn<typeof fetch>().mockResolvedValue(
312
+ Response.json({
313
+ object: "data_source",
314
+ id: "feedback-data-source",
315
+ parent: { type: "database_id", database_id: "feedback-database" },
316
+ properties: Object.fromEntries(
317
+ Object.entries(propertyIds)
318
+ .filter(([key]) => key !== "description")
319
+ .map(([key, id]) => [
320
+ key,
321
+ {
322
+ id,
323
+ name: key,
324
+ type: key === "published" ? "rich_text" : expectedTypes[key],
325
+ },
326
+ ]),
327
+ ),
328
+ }),
329
+ );
330
+
331
+ await expect(
332
+ validateNotionFeedbackDataSource({
333
+ token: "notion-token",
334
+ dataSourceId: "feedback-data-source",
335
+ propertyIds,
336
+ request,
337
+ }),
338
+ ).rejects.toThrow(
339
+ [
340
+ 'Restore the "Description" property with ID "description-id" and type "rich_text", then update the configured property ID if Notion assigns a new one.',
341
+ 'Change the property configured as "Published" (ID "published-id") from "rich_text" to "checkbox", or restore a checkbox property and configure its ID.',
342
+ ].join("\n"),
343
+ );
344
+ });
345
+ });
346
+
347
+ const expectedTypes: Record<string, string> = {
348
+ title: "title",
349
+ slug: "rich_text",
350
+ description: "rich_text",
351
+ type: "select",
352
+ status: "select",
353
+ published: "checkbox",
354
+ voteCount: "number",
355
+ teamResponse: "rich_text",
356
+ releaseNotesUrl: "url",
357
+ submitterName: "rich_text",
358
+ submitterEmail: "email",
359
+ source: "select",
360
+ externalId: "rich_text",
361
+ editTokenHash: "rich_text",
362
+ createdAt: "created_time",
363
+ updatedAt: "last_edited_time",
364
+ };