@stacksjs/defaults 0.75.528 → 0.75.535

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 (248) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-build/SKILL.md +1 -1
  3. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  4. package/ai/skills/stacks-database/SKILL.md +1 -1
  5. package/ai/skills/stacks-migrations/SKILL.md +2 -2
  6. package/ai/skills/stacks-native/CATALOG.md +4 -4
  7. package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
  8. package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
  9. package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
  10. package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
  11. package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
  12. package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
  13. package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
  14. package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
  15. package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
  16. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
  17. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
  18. package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
  19. package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
  20. package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
  21. package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
  22. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
  23. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
  24. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
  25. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
  26. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
  27. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
  28. package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
  29. package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
  30. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
  31. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
  32. package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
  33. package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
  34. package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
  35. package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
  36. package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
  37. package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
  38. package/app/Actions/Dashboard/Models/model-write.ts +36 -3
  39. package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
  40. package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
  41. package/app/Actions/SitemapAction.ts +3 -1
  42. package/app/Models/Notification.ts +3 -1
  43. package/app/Models/NotificationDelivery.ts +4 -0
  44. package/app/Models/User.ts +10 -1
  45. package/bootstrap.ts +10 -2
  46. package/functions/commerce/tax-types.ts +21 -0
  47. package/functions/dashboard-list.test.ts +16 -0
  48. package/functions/dashboard-list.ts +14 -6
  49. package/functions/dashboard-model-record.test.ts +139 -0
  50. package/functions/dashboard-model-record.ts +353 -0
  51. package/functions/monitoring/errors.ts +22 -103
  52. package/functions/notifications/deliveries.ts +7 -38
  53. package/functions/queries.ts +7 -10
  54. package/ide/vscode/package.json +1 -1
  55. package/package.json +5 -5
  56. package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
  57. package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
  58. package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
  59. package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
  60. package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
  61. package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
  62. package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
  63. package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
  64. package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
  65. package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
  66. package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
  67. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
  68. package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
  69. package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
  70. package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
  71. package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
  72. package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
  73. package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
  74. package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
  75. package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
  76. package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
  77. package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
  78. package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
  79. package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
  80. package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
  81. package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
  82. package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
  83. package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
  84. package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
  85. package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
  86. package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
  87. package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
  88. package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
  89. package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
  90. package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
  91. package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
  92. package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
  93. package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
  94. package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
  95. package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
  96. package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
  97. package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
  98. package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
  99. package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
  100. package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
  101. package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
  102. package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
  103. package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
  104. package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
  105. package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
  106. package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
  107. package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
  108. package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
  109. package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
  110. package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
  111. package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
  112. package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
  113. package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
  114. package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
  115. package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
  116. package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
  117. package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
  118. package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
  119. package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
  120. package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
  121. package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
  122. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
  123. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
  124. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
  125. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
  126. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
  127. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
  128. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
  129. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
  130. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
  131. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
  132. package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
  133. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
  134. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
  135. package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
  136. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
  137. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
  138. package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
  139. package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
  140. package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
  141. package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
  142. package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
  143. package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
  144. package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
  145. package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
  146. package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
  147. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
  148. package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
  149. package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
  150. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
  151. package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
  152. package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
  153. package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
  154. package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
  155. package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
  156. package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
  157. package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
  158. package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
  159. package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
  160. package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
  161. package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
  162. package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
  163. package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
  164. package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
  165. package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
  166. package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
  167. package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
  168. package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
  169. package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
  170. package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
  171. package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
  172. package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
  173. package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
  174. package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
  175. package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
  176. package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
  177. package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
  178. package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
  179. package/resources/components/Dashboard/GlobalSearch.stx +19 -21
  180. package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
  181. package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
  182. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
  183. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
  184. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
  185. package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
  186. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
  187. package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
  188. package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
  189. package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
  190. package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
  191. package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
  192. package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
  193. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
  194. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
  195. package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
  196. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
  197. package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
  198. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
  199. package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
  200. package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
  201. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
  202. package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
  203. package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
  204. package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
  205. package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
  206. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
  207. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
  208. package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
  209. package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
  210. package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
  211. package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
  212. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
  213. package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
  214. package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
  215. package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
  216. package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
  217. package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
  218. package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
  219. package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
  220. package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
  221. package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
  222. package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
  223. package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
  224. package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
  225. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
  226. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
  227. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
  228. package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
  229. package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
  230. package/resources/components/Dashboard/UI/Button.stx +15 -0
  231. package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
  232. package/resources/components/Dashboard/UI/Pagination.stx +3 -5
  233. package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
  234. package/resources/components/Dashboard/UI/Select.stx +1 -0
  235. package/resources/components/Dashboard/UI/Table.stx +139 -96
  236. package/resources/components/Dashboard/UI/Tabs.stx +18 -20
  237. package/routes/dashboard-api.ts +2 -0
  238. package/routes/dashboard.ts +246 -253
  239. package/routes/storefront.ts +31 -0
  240. package/stx-components-plugin.ts +12 -1
  241. package/views/dashboard/content/categories/index.stx +1 -1
  242. package/views/dashboard/content/tags/index.stx +1 -1
  243. package/views/dashboard/layouts/default.stx +27 -12
  244. package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
  245. package/views/dashboard/models/[model]/[id].stx +8 -0
  246. package/views/dashboard/models/[model]/create.stx +8 -0
  247. package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
  248. package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-actions
3
- description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 720 default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
3
+ description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 728 default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -243,7 +243,7 @@ enum Action {
243
243
  |------|-------|
244
244
  | **Bun** | Primary bundler (`target: 'bun'`, `format: 'esm'`) |
245
245
  | **stx** | Component library builds |
246
- | **bun-plugin-dtsx** | TypeScript declaration generation |
246
+ | **@dtsx/bun** | TypeScript declaration generation |
247
247
  | **Docker** | Server containerization |
248
248
  | **@babel/traverse** | AST traversal for export cleanup |
249
249
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-dashboard
3
- description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 416 built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
3
+ description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 417 built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -8,7 +8,7 @@ allowed-tools: Read Edit Write Bash Grep Glob
8
8
 
9
9
  # Stacks Dashboard
10
10
 
11
- The Stacks admin dashboard provides a full-featured admin panel with 100+ route views, 416 components, and a multi-section layout.
11
+ The Stacks admin dashboard provides a full-featured admin panel with 100+ route views, 417 components, and a multi-section layout.
12
12
 
13
13
  ## Key Paths
14
14
  - Dashboard components: `storage/framework/defaults/resources/components/Dashboard/`
@@ -12,7 +12,7 @@ allowed-tools: Read Edit Write Bash Grep Glob
12
12
  - Database package: `storage/framework/core/database/src/`
13
13
  - Configuration: `config/database.ts`
14
14
  - QB config: `config/query-builder.ts`
15
- - Migrations: `database/migrations/` (248 migration files, `.sql` format)
15
+ - Migrations: `database/migrations/` (249 migration files, `.sql` format)
16
16
  - QB state: `.qb/`
17
17
  - ORM: `storage/framework/orm/`
18
18
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-migrations
3
- description: Use when working with database migrations in a Stacks application - creating migration files, running migrations, fresh migration (drop + recreate), seeding after migration, migration file naming conventions, or the 248 built-in migration files. For the database API itself (queries, connections, SQL helpers), see stacks-database.
3
+ description: Use when working with database migrations in a Stacks application - creating migration files, running migrations, fresh migration (drop + recreate), seeding after migration, migration file naming conventions, or the 249 built-in migration files. For the database API itself (queries, connections, SQL helpers), see stacks-database.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -236,7 +236,7 @@ lossless widenings; reports everything destructive), then
236
236
  - Do not commit a second snapshot under `.qb/`; that indicates a missing `snapshotDir` configuration
237
237
  - If a generated SQLite migration rebuilds tables, test it against a copy of the current database and run `PRAGMA integrity_check` plus `PRAGMA foreign_key_check`
238
238
  - `--seed` flag after `migrate:fresh` seeds the database with factory data
239
- - 248 migration files exist by default for all framework models
239
+ - 249 migration files exist by default for all framework models
240
240
  - SQLite >= 3.47.2 is required (system requirement)
241
241
  - For the database API (queries, connections), see the `stacks-database` skill
242
242
 
@@ -42,7 +42,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
42
42
  | `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) | 15 |
43
43
  | `@stacksjs/development` | [`stacks-development`](../stacks-development/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/development/package.json) | 1 |
44
44
  | `@stacksjs/dns` | [`stacks-dns`](../stacks-dns/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/dns/src/index.ts) | 4 |
45
- | `@stacksjs/docs` | [`stacks-docs`](../stacks-docs/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/src/index.ts) | 2 |
45
+ | `@stacksjs/docs` | [`stacks-docs`](../stacks-docs/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/src/index.ts) | 3 |
46
46
  | `@stacksjs/email` | [`stacks-email`](../stacks-email/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/email/src/index.ts) | 24 |
47
47
  | `@stacksjs/enums` | [`stacks-enums`](../stacks-enums/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/enums/src/index.ts) | 3 |
48
48
  | `@stacksjs/env` | [`stacks-env`](../stacks-env/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/env/src/index.ts) | 31 |
@@ -87,7 +87,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
87
87
  | `@stacksjs/sms` | [`stacks-sms`](../stacks-sms/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/sms/src/index.ts) | 6 |
88
88
  | `@stacksjs/socials` | [`stacks-socials`](../stacks-socials/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/index.ts) | 18 |
89
89
  | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 50 |
90
- | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 11 |
90
+ | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
91
91
  | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 24 |
92
92
  | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 1 |
93
93
  | `@stacksjs/tunnel` | [`stacks-tunnel`](../stacks-tunnel/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tunnel/src/index.ts) | 1 |
@@ -421,7 +421,7 @@ Declared runtime exports: `docsConfig`, `frameworkDefaults`.
421
421
 
422
422
  Local source modules: [src/meta.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/src/meta.ts).
423
423
 
424
- Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
424
+ Evidence directory: [3 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
425
425
 
426
426
  ### @stacksjs/email
427
427
 
@@ -853,7 +853,7 @@ Declared runtime exports: `string`.
853
853
 
854
854
  Local source modules: [src/string.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/string.ts).
855
855
 
856
- Evidence directory: [11 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
856
+ Evidence directory: [12 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
857
857
 
858
858
  ### @stacksjs/testing
859
859
 
@@ -1,28 +1,40 @@
1
+ import type { RequestInstance } from '@stacksjs/types'
1
2
  import { Action } from '@stacksjs/actions/runtime'
2
- import { Coupon, Product } from '@stacksjs/orm'
3
+ import { config } from '@stacksjs/config'
4
+ import { response } from '@stacksjs/router'
3
5
  import { dashboardOperationalError } from '../dashboard-response'
4
- import { normalizeCouponRecord, summarizeCoupons } from './coupon-records'
5
- import { commerceIdentifier, commerceValue } from './commerce-record'
6
+ import { parseCouponListQuery, readCouponPage } from './commerce-coupon-list'
7
+ import { normalizeCommerceCurrency } from './commerce-product-records'
6
8
 
9
+ /**
10
+ * `GET /api/dashboard/commerce/coupons` - one page of coupons, searched,
11
+ * filtered, sorted and counted by the database, with the summary and
12
+ * breakdowns of every coupon (commerce-coupon-list.ts, stacksjs/stacks#3218).
13
+ * This used to send the newest 500, checked against the first 500 products.
14
+ *
15
+ * The store currency comes with it: fixed amounts are minor units of it, and
16
+ * the page, its table and its dialogs read and write them in it.
17
+ */
7
18
  export default new Action({
8
19
  name: 'CommerceCouponsAction',
9
- description: 'Returns persisted Coupon records for dashboard management.',
20
+ description: 'Returns one page of persisted Coupon records for dashboard management.',
10
21
  method: 'GET',
11
22
  apiResponse: true,
12
23
 
13
- async handle() {
24
+ async handle(request: RequestInstance) {
25
+ const query = parseCouponListQuery(key => request.get<unknown>(key, ''))
26
+ if ('error' in query)
27
+ return response.json({ message: query.error }, 422)
28
+
14
29
  try {
15
- const [coupons, products] = await Promise.all([
16
- Coupon.orderByDesc('id').limit(500).get(),
17
- Product.orderBy('id', 'asc').limit(500).get(),
18
- ])
19
- const productIds = new Set(products.map(product =>
20
- commerceIdentifier(commerceValue(product, 'id', 'uuid'), 'Product'),
21
- ))
22
- const records = coupons.map(coupon => normalizeCouponRecord(coupon, productIds))
30
+ const coupons = await readCouponPage(query)
23
31
  return {
24
- records,
25
- summary: summarizeCoupons(records),
32
+ records: coupons.records,
33
+ total: coupons.total,
34
+ page: coupons.page,
35
+ perPage: query.perPage,
36
+ summary: coupons.summary,
37
+ currency: normalizeCommerceCurrency(config.commerce?.currency),
26
38
  }
27
39
  }
28
40
  catch (error) {
@@ -0,0 +1,45 @@
1
+ import type { RequestInstance } from '@stacksjs/types'
2
+ import { Action } from '@stacksjs/actions/runtime'
3
+ import { minorToInput } from '@stacksjs/commerce/money'
4
+ import { config } from '@stacksjs/config'
5
+ import { response } from '@stacksjs/router'
6
+ import { dashboardOperationalError } from '../dashboard-response'
7
+ import { couponsCsv, parseCouponListQuery, readCouponsForExport } from './commerce-coupon-list'
8
+ import { normalizeCommerceCurrency } from './commerce-product-records'
9
+
10
+ /**
11
+ * `GET /api/dashboard/commerce/coupons/export` - every coupon matching the
12
+ * Coupons page's search, filters and sort, as CSV (stacksjs/stacks#3218).
13
+ * The page built the file from the newest 500, with fixed amounts in US
14
+ * dollars whatever the store used.
15
+ */
16
+ export default new Action({
17
+ name: 'CommerceCouponsExportAction',
18
+ description: 'Exports every coupon matching the Coupons page filters as CSV.',
19
+ method: 'GET',
20
+ apiResponse: false,
21
+
22
+ async handle(request: RequestInstance) {
23
+ const query = parseCouponListQuery(key => request.get<unknown>(key, ''))
24
+ if ('error' in query)
25
+ return response.json({ message: query.error }, 422)
26
+
27
+ try {
28
+ const currency = normalizeCommerceCurrency(config.commerce?.currency)
29
+ const csv = couponsCsv(await readCouponsForExport(query), currency, minorToInput)
30
+ const day = new Date().toISOString().slice(0, 10)
31
+ return new Response(csv, {
32
+ status: 200,
33
+ headers: {
34
+ 'Cache-Control': 'private, no-store',
35
+ 'Content-Disposition': `attachment; filename="coupons-${day}.csv"`,
36
+ 'Content-Type': 'text/csv; charset=utf-8',
37
+ 'X-Content-Type-Options': 'nosniff',
38
+ },
39
+ })
40
+ }
41
+ catch (error) {
42
+ return dashboardOperationalError(error, 'Coupons could not be exported.', 'CommerceCouponsExportAction')
43
+ }
44
+ },
45
+ })
@@ -1,26 +1,36 @@
1
+ import type { RequestInstance } from '@stacksjs/types'
1
2
  import { Action } from '@stacksjs/actions/runtime'
2
3
  import { config } from '@stacksjs/config'
3
- import { Customer } from '@stacksjs/orm'
4
+ import { response } from '@stacksjs/router'
4
5
  import { dashboardOperationalError } from '../dashboard-response'
5
- import {
6
- normalizeCommerceCustomerCurrency,
7
- normalizeCommerceCustomerRecord,
8
- summarizeCommerceCustomers,
9
- } from './commerce-customer-records'
6
+ import { normalizeCommerceCustomerCurrency } from './commerce-customer-records'
7
+ import { parseCustomerListQuery, readCustomerPage } from './commerce-customer-list'
10
8
 
9
+ /**
10
+ * `GET /api/dashboard/commerce/customers` - one page of customers, searched,
11
+ * filtered, sorted and counted by the database, with the summary of every
12
+ * customer (commerce-customer-list.ts, stacksjs/stacks#3218). This used to
13
+ * send the first 500 by name.
14
+ */
11
15
  export default new Action({
12
16
  name: 'CommerceCustomersAction',
13
- description: 'Returns persisted Customer records and summary values for dashboard management.',
17
+ description: 'Returns one page of persisted Customer records and summary values for dashboard management.',
14
18
  method: 'GET',
15
19
  apiResponse: true,
16
20
 
17
- async handle() {
21
+ async handle(request: RequestInstance) {
22
+ const query = parseCustomerListQuery(key => request.get<unknown>(key, ''))
23
+ if ('error' in query)
24
+ return response.json({ message: query.error }, 422)
25
+
18
26
  try {
19
- const customers = await Customer.orderBy('name', 'asc').limit(500).get()
20
- const records = customers.map(normalizeCommerceCustomerRecord)
27
+ const customers = await readCustomerPage(query)
21
28
  return {
22
- records,
23
- summary: summarizeCommerceCustomers(records),
29
+ records: customers.records,
30
+ total: customers.total,
31
+ page: customers.page,
32
+ perPage: query.perPage,
33
+ summary: customers.summary,
24
34
  currency: normalizeCommerceCustomerCurrency(config.commerce?.currency),
25
35
  }
26
36
  }
@@ -0,0 +1,44 @@
1
+ import type { RequestInstance } from '@stacksjs/types'
2
+ import { Action } from '@stacksjs/actions/runtime'
3
+ import { minorToInput } from '@stacksjs/commerce/money'
4
+ import { config } from '@stacksjs/config'
5
+ import { response } from '@stacksjs/router'
6
+ import { dashboardOperationalError } from '../dashboard-response'
7
+ import { normalizeCommerceCustomerCurrency } from './commerce-customer-records'
8
+ import { customersCsv, parseCustomerListQuery, readCustomersForExport } from './commerce-customer-list'
9
+
10
+ /**
11
+ * `GET /api/dashboard/commerce/customers/export` - every customer matching
12
+ * the Customers page's search, filter and sort, as CSV
13
+ * (stacksjs/stacks#3218). The page built the file from the first 500.
14
+ */
15
+ export default new Action({
16
+ name: 'CommerceCustomersExportAction',
17
+ description: 'Exports every customer matching the Customers page filters as CSV.',
18
+ method: 'GET',
19
+ apiResponse: false,
20
+
21
+ async handle(request: RequestInstance) {
22
+ const query = parseCustomerListQuery(key => request.get<unknown>(key, ''))
23
+ if ('error' in query)
24
+ return response.json({ message: query.error }, 422)
25
+
26
+ try {
27
+ const currency = normalizeCommerceCustomerCurrency(config.commerce?.currency)
28
+ const csv = customersCsv(await readCustomersForExport(query), currency, minorToInput)
29
+ const day = new Date().toISOString().slice(0, 10)
30
+ return new Response(csv, {
31
+ status: 200,
32
+ headers: {
33
+ 'Cache-Control': 'private, no-store',
34
+ 'Content-Disposition': `attachment; filename="customers-${day}.csv"`,
35
+ 'Content-Type': 'text/csv; charset=utf-8',
36
+ 'X-Content-Type-Options': 'nosniff',
37
+ },
38
+ })
39
+ }
40
+ catch (error) {
41
+ return dashboardOperationalError(error, 'Customers could not be exported.', 'CommerceCustomersExportAction')
42
+ }
43
+ },
44
+ })
@@ -4,23 +4,17 @@ import { Action } from '@stacksjs/actions/runtime'
4
4
  import { orders } from '@stacksjs/commerce'
5
5
  import { config } from '@stacksjs/config'
6
6
  import { log } from '@stacksjs/logging'
7
- import { Category, Customer, Manufacturer, OrderItem, Payment, Product, TaxRate } from '@stacksjs/orm'
7
+ import { Customer, OrderItem, Payment, Product } from '@stacksjs/orm'
8
8
  import { response } from '@stacksjs/router'
9
9
  import { dashboardOperationalError } from '../dashboard-response'
10
10
  import {
11
11
  calculateCommercePosSale,
12
12
  CommercePosAvailabilityError,
13
13
  deriveCommercePosTaxRate,
14
- normalizeCommercePosProduct,
15
14
  parseCommercePosLines,
16
- selectCommercePosTaxRate,
17
15
  } from './commerce-pos'
18
- import {
19
- normalizeCommerceProductRecord,
20
- normalizeCommerceCurrency,
21
- normalizeManufacturerOption,
22
- normalizeProductOption,
23
- } from './commerce-product-records'
16
+ import { readPosProducts, readPosTaxRate } from './commerce-pos-catalog'
17
+ import { normalizeCommerceCurrency } from './commerce-product-records'
24
18
 
25
19
  function field(record: any, ...names: string[]): unknown {
26
20
  for (const name of names) {
@@ -239,27 +233,13 @@ export default new Action({
239
233
  return response.json({ message: 'Order instructions must be 1,000 characters or fewer.' }, 422)
240
234
 
241
235
  const productIds = parsed.lines.map(line => line.productId)
236
+ // The products as the point of sale reads them, against exactly the
237
+ // categories and manufacturers they name. This used to read the first 500
238
+ // of each by name, so a product in a later one could not be sold
239
+ // (stacksjs/stacks#3218).
242
240
  let products
243
- let taxRates
244
241
  try {
245
- const [productRows, categories, manufacturers, persistedTaxRates] = await Promise.all([
246
- Product.whereIn('id', productIds).get(),
247
- Category.orderBy('name', 'asc').limit(500).get(),
248
- Manufacturer.orderBy('manufacturer', 'asc').limit(500).get(),
249
- TaxRate.orderBy('id', 'asc').limit(500).get(),
250
- ])
251
- const categoryMap = new Map(categories.map(normalizeProductOption).map(option => [option.id, option.label]))
252
- const manufacturerMap = new Map(manufacturers.map(normalizeManufacturerOption).map(option => [option.id, option.label]))
253
- const emptyCounts = new Map<string, number>()
254
- products = productRows.map(product => normalizeCommercePosProduct(normalizeCommerceProductRecord(
255
- product,
256
- categoryMap,
257
- manufacturerMap,
258
- emptyCounts,
259
- emptyCounts,
260
- emptyCounts,
261
- )))
262
- taxRates = persistedTaxRates
242
+ products = await readPosProducts(productIds)
263
243
  }
264
244
  catch (error) {
265
245
  return dashboardOperationalError(error, 'Product records could not be read.', 'CommercePosCheckoutAction')
@@ -269,7 +249,7 @@ export default new Action({
269
249
 
270
250
  let taxRate
271
251
  try {
272
- taxRate = selectCommercePosTaxRate(taxRates)
252
+ taxRate = await readPosTaxRate()
273
253
  }
274
254
  catch (error) {
275
255
  return dashboardOperationalError(error, 'Tax rate records could not be read.', 'CommercePosCheckoutAction')
@@ -1,22 +1,20 @@
1
1
  import { Action } from '@stacksjs/actions/runtime'
2
- import { PrintDevice } from '@stacksjs/orm'
3
2
  import { dashboardOperationalError } from '../dashboard-response'
4
- import { normalizePrintDeviceRecord, summarizePrintDevices } from './print-device-records'
3
+ import { readPrintDevices } from './commerce-print-device-list'
5
4
 
5
+ /**
6
+ * `GET /api/dashboard/commerce/print-devices` - every print device, read whole (commerce-print-device-list.ts,
7
+ * stacksjs/stacks#3218). This used to send the newest 500.
8
+ */
6
9
  export default new Action({
7
10
  name: 'CommercePrintDevicesAction',
8
- description: 'Returns persisted PrintDevice records for dashboard management.',
11
+ description: 'Returns every persisted PrintDevice record for dashboard management.',
9
12
  method: 'GET',
10
13
  apiResponse: true,
11
14
 
12
15
  async handle() {
13
16
  try {
14
- const devices = await PrintDevice.orderByDesc('id').limit(500).get()
15
- const records = devices.map(normalizePrintDeviceRecord)
16
- return {
17
- records,
18
- summary: summarizePrintDevices(records),
19
- }
17
+ return await readPrintDevices()
20
18
  }
21
19
  catch (error) {
22
20
  return dashboardOperationalError(error, 'Print device records could not be read.', 'CommercePrintDevicesAction')
@@ -1,19 +1,18 @@
1
1
  import type { RequestInstance } from '@stacksjs/types'
2
2
  import { Action } from '@stacksjs/actions/runtime'
3
3
  import { config } from '@stacksjs/config'
4
- import { Category, Manufacturer, Product, ProductUnit, ProductVariant, Review } from '@stacksjs/orm'
4
+ import { Product, ProductUnit, ProductVariant, Review } from '@stacksjs/orm'
5
5
  import { response } from '@stacksjs/router'
6
6
  import { dashboardOperationalError } from '../dashboard-response'
7
7
  import {
8
8
  countProductRelations,
9
9
  normalizeCommerceCurrency,
10
10
  normalizeCommerceProductRecord,
11
- normalizeManufacturerOption,
12
- normalizeProductOption,
13
11
  normalizeProductUnitDetail,
14
12
  normalizeProductVariantDetail,
15
13
  summarizeProductReviews,
16
14
  } from './commerce-product-records'
15
+ import { readProductOptions } from './commerce-product-list'
17
16
 
18
17
  export default new Action({
19
18
  name: 'CommerceProductDetailAction',
@@ -31,15 +30,17 @@ export default new Action({
31
30
  if (!product)
32
31
  return response.notFound('Product not found')
33
32
 
34
- const [categories, manufacturers, variants, units, reviews] = await Promise.all([
35
- Category.orderBy('name', 'asc').limit(500).get(),
36
- Manufacturer.orderBy('manufacturer', 'asc').limit(500).get(),
33
+ // Every category and manufacturer, for the edit dialog and to name the
34
+ // product's own; this used to read the first 500 of each by name, so a
35
+ // product in a later one failed its page (stacksjs/stacks#3218).
36
+ const [options, variants, units, reviews] = await Promise.all([
37
+ readProductOptions(),
37
38
  ProductVariant.where('product_id', id).get(),
38
39
  ProductUnit.where('product_id', id).get(),
39
40
  Review.where('product_id', id).get(),
40
41
  ])
41
- const categoryOptions = categories.map(normalizeProductOption)
42
- const manufacturerOptions = manufacturers.map(normalizeManufacturerOption)
42
+ const categoryOptions = options.categories
43
+ const manufacturerOptions = options.manufacturers
43
44
  const categoryMap = new Map(categoryOptions.map(option => [option.id, option.label]))
44
45
  const manufacturerMap = new Map(manufacturerOptions.map(option => [option.id, option.label]))
45
46
  const record = normalizeCommerceProductRecord(
@@ -1,22 +1,20 @@
1
1
  import { Action } from '@stacksjs/actions/runtime'
2
- import { TaxRate } from '@stacksjs/orm'
3
2
  import { dashboardOperationalError } from '../dashboard-response'
4
- import { normalizeTaxRateRecord, summarizeTaxRates } from './tax-rate-records'
3
+ import { readTaxRates } from './commerce-tax-rate-list'
5
4
 
5
+ /**
6
+ * `GET /api/dashboard/commerce/taxes` - every tax rate, read whole (commerce-tax-rate-list.ts,
7
+ * stacksjs/stacks#3218). This used to send the newest 500.
8
+ */
6
9
  export default new Action({
7
10
  name: 'CommerceTaxesAction',
8
- description: 'Returns persisted TaxRate records for dashboard management.',
11
+ description: 'Returns every persisted TaxRate record for dashboard management.',
9
12
  method: 'GET',
10
13
  apiResponse: true,
11
14
 
12
15
  async handle() {
13
16
  try {
14
- const rates = await TaxRate.orderByDesc('id').limit(500).get()
15
- const records = rates.map(normalizeTaxRateRecord)
16
- return {
17
- records,
18
- summary: summarizeTaxRates(records),
19
- }
17
+ return await readTaxRates()
20
18
  }
21
19
  catch (error) {
22
20
  return dashboardOperationalError(error, 'Tax rate records could not be read.', 'CommerceTaxesAction')
@@ -1,13 +1,13 @@
1
1
  import { Action } from '@stacksjs/actions/runtime'
2
- import { Manufacturer, Product } from '@stacksjs/orm'
3
2
  import { dashboardOperationalError } from '../dashboard-response'
4
- import {
5
- manufacturerIdentifiers,
6
- manufacturerProductCounts,
7
- normalizeManufacturerRecord,
8
- summarizeManufacturers,
9
- } from './manufacturer-records'
3
+ import { readManufacturers } from './commerce-manufacturer-list'
10
4
 
5
+ /**
6
+ * `GET /api/dashboard/commerce/manufacturers` - every manufacturer with how
7
+ * many products it makes, counted by the database (commerce-manufacturer-list.ts,
8
+ * stacksjs/stacks#3218). This used to read the newest 500 manufacturers and
9
+ * count over the first 500 products.
10
+ */
11
11
  export default new Action({
12
12
  name: 'ManufacturerIndexAction',
13
13
  description: 'Returns persisted manufacturers with linked product counts for dashboard management.',
@@ -16,19 +16,7 @@ export default new Action({
16
16
 
17
17
  async handle() {
18
18
  try {
19
- const [manufacturers, products] = await Promise.all([
20
- Manufacturer.orderByDesc('id').limit(500).get(),
21
- Product.orderBy('id', 'asc').limit(500).get(),
22
- ])
23
- const productCounts = manufacturerProductCounts(products, manufacturerIdentifiers(manufacturers))
24
- const records = manufacturers.map(manufacturer =>
25
- normalizeManufacturerRecord(manufacturer, productCounts),
26
- )
27
-
28
- return {
29
- records,
30
- summary: summarizeManufacturers(records),
31
- }
19
+ return await readManufacturers()
32
20
  }
33
21
  catch (error) {
34
22
  return dashboardOperationalError(error, 'Manufacturer records could not be read.', 'ManufacturerIndexAction')