@stacksjs/defaults 0.75.529 → 0.75.537
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.
- package/ai/skills/stacks-actions/SKILL.md +1 -1
- package/ai/skills/stacks-build/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +2 -2
- package/ai/skills/stacks-database/SKILL.md +1 -1
- package/ai/skills/stacks-migrations/SKILL.md +2 -2
- package/ai/skills/stacks-native/CATALOG.md +6 -6
- package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
- package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
- package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
- package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
- package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
- package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
- package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
- package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
- package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
- package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
- package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
- package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
- package/app/Actions/Dashboard/Models/model-write.ts +36 -3
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
- package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
- package/app/Actions/SitemapAction.ts +3 -1
- package/app/Models/Notification.ts +3 -1
- package/app/Models/NotificationDelivery.ts +4 -0
- package/app/Models/User.ts +10 -1
- package/bootstrap.ts +10 -2
- package/functions/commerce/tax-types.ts +21 -0
- package/functions/dashboard-list.test.ts +16 -0
- package/functions/dashboard-list.ts +14 -6
- package/functions/dashboard-model-record.test.ts +139 -0
- package/functions/dashboard-model-record.ts +353 -0
- package/functions/monitoring/errors.ts +22 -103
- package/functions/notifications/deliveries.ts +7 -38
- package/functions/queries.ts +7 -10
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
- package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
- package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
- package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
- package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
- package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
- package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
- package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
- package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
- package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
- package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
- package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
- package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
- package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
- package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
- package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
- package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
- package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
- package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
- package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
- package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
- package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
- package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
- package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
- package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
- package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
- package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
- package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
- package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
- package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
- package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
- package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
- package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
- package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
- package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
- package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
- package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
- package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
- package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
- package/resources/components/Dashboard/GlobalSearch.stx +19 -21
- package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
- package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
- package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
- package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
- package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
- package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
- package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
- package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
- package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
- package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
- package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
- package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
- package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
- package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
- package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
- package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
- package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
- package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
- package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
- package/resources/components/Dashboard/UI/Button.stx +15 -0
- package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
- package/resources/components/Dashboard/UI/Pagination.stx +3 -5
- package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
- package/resources/components/Dashboard/UI/Select.stx +1 -0
- package/resources/components/Dashboard/UI/Table.stx +139 -96
- package/resources/components/Dashboard/UI/Tabs.stx +18 -20
- package/routes/dashboard-api.ts +2 -0
- package/routes/dashboard.ts +246 -253
- package/routes/storefront.ts +31 -0
- package/stx-components-plugin.ts +12 -1
- package/views/dashboard/content/categories/index.stx +1 -1
- package/views/dashboard/content/tags/index.stx +1 -1
- package/views/dashboard/layouts/default.stx +27 -12
- package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
- package/views/dashboard/models/[model]/[id].stx +8 -0
- package/views/dashboard/models/[model]/create.stx +8 -0
- package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
- 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
|
|
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
|
-
|
|
|
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
|
|
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,
|
|
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/` (
|
|
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
|
|
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
|
-
-
|
|
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) |
|
|
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 |
|
|
@@ -75,7 +75,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
75
75
|
| `@stacksjs/realtime` | [`stacks-realtime`](../stacks-realtime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts) | 13 |
|
|
76
76
|
| `@stacksjs/registry` | [`stacks-registry`](../stacks-registry/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/registry/src/index.ts) | 1 |
|
|
77
77
|
| `@stacksjs/repl` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/repl/src/index.ts) | 2 |
|
|
78
|
-
| `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) |
|
|
78
|
+
| `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) | 103 |
|
|
79
79
|
| `@stacksjs/scheduler` | [`stacks-scheduler`](../stacks-scheduler/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/index.ts) | 19 |
|
|
80
80
|
| `@stacksjs/search-engine` | [`stacks-search-engine`](../stacks-search-engine/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/search-engine/src/index.ts) | 11 |
|
|
81
81
|
| `@stacksjs/security` | [`stacks-security`](../stacks-security/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/security/src/index.ts) | 12 |
|
|
@@ -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) |
|
|
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: [
|
|
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
|
|
|
@@ -735,7 +735,7 @@ Declared runtime exports: `DASHBOARD_ROUTE_GROUPS`, `DEFAULT_ROUTE_BUNDLE_FEATUR
|
|
|
735
735
|
|
|
736
736
|
Local source modules: [src/api-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/api-shape.ts), [src/body.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/body.ts), [src/dashboard-access.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/dashboard-access.ts), [src/encrypted-session-store.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/encrypted-session-store.ts), [src/error-handler.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/error-handler.ts), [src/health.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/health.ts), [src/json.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/json.ts), [src/middleware.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/middleware.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/path-sanitize.ts), [src/rate-limit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/rate-limit.ts), [src/request-augmentation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-augmentation.ts), [src/request-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-context.ts), [src/route-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-loader.ts), [src/route-model-binding.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-model-binding.ts), [src/security-settings.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/security-settings.ts), [src/session-factory.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/session-factory.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/signed-url.ts), [src/stacks-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/stacks-router.ts), [src/typed-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/typed-router.ts).
|
|
737
737
|
|
|
738
|
-
Evidence directory: [
|
|
738
|
+
Evidence directory: [103 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
739
739
|
|
|
740
740
|
### @stacksjs/scheduler
|
|
741
741
|
|
|
@@ -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: [
|
|
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 {
|
|
3
|
+
import { config } from '@stacksjs/config'
|
|
4
|
+
import { response } from '@stacksjs/router'
|
|
3
5
|
import { dashboardOperationalError } from '../dashboard-response'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
|
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
|
-
|
|
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 {
|
|
4
|
+
import { response } from '@stacksjs/router'
|
|
4
5
|
import { dashboardOperationalError } from '../dashboard-response'
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
|
20
|
-
const records = customers.map(normalizeCommerceCustomerRecord)
|
|
27
|
+
const customers = await readCustomerPage(query)
|
|
21
28
|
return {
|
|
22
|
-
records,
|
|
23
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
42
|
-
const manufacturerOptions = manufacturers
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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')
|