@stacksjs/defaults 0.75.492 → 0.75.494

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.
@@ -740,3 +740,11 @@ by itself: configure `createDatabaseErrorReporter()` from
740
740
  `Error`, and migrate it. Reporting is bounded, buffered, identity-deduplicated
741
741
  by `captureError`, and flushed by `flushErrorReporters`/the logger. The database
742
742
  reporter stores allowlisted operational context and excludes bodies and headers.
743
+
744
+ ### Pinned model rows
745
+
746
+ Declare `dashboard: { highlight: true }` on a model to pin its Data row, or use
747
+ numeric `highlight` values to order pinned rows. Other enabled Data models live
748
+ under the native Sidebar's collapsed More models disclosure. Labels, icons and
749
+ role gates apply to nested rows too. `enabled: false` omits navigation;
750
+ `access: false` excludes generic catalogs and reads as well.
@@ -519,3 +519,14 @@ commands, not a project's resolved models.
519
519
  of a validator is not a promise that an arbitrary request body is safe.
520
520
  - Dashboard-highlighted models (`dashboard: { highlight: true }`) appear
521
521
  prominently in the admin UI.
522
+
523
+ ### Bounded retention jobs
524
+
525
+ `pruneRetainedData({ models: { Request }, now, batchSize: 500, after })` scans at
526
+ most 500 candidates per model. Persist `result.next` in the next queue job and
527
+ reuse the same `now` until no cursors remain, even when a page changed zero rows.
528
+ This handles mixed SQL/ISO timestamps without skipping candidates. Each bounded
529
+ page commits its deletion/anonymization and retention audit together. A dry run
530
+ returns cursors without changing records. Omitting `batchSize` retains the CLI's
531
+ whole-run behavior. Declare the policy on `traits.gdpr.retention`, publish the
532
+ native `GdprRequest` audit model, and run cleanup through durable queue workers.
@@ -35,7 +35,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
35
35
  | `@stacksjs/composables` | [`stacks-composables`](../stacks-composables/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/composables/src/index.ts) | 18 |
36
36
  | `@stacksjs/config` | [`stacks-config`](../stacks-config/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts) | 16 |
37
37
  | `@stacksjs/cron` | [`stacks-cron`](../stacks-cron/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cron/src/index.ts) | 6 |
38
- | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 141 |
38
+ | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 142 |
39
39
  | `@stacksjs/datetime` | [`stacks-datetime`](../stacks-datetime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/datetime/src/index.ts) | 22 |
40
40
  | `@stacksjs/defaults` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/package.json) | 2 |
41
41
  | `@stacksjs/deploy` | [`stacks-deploy`](../stacks-deploy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/deploy/package.json) | 1 |
@@ -50,7 +50,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
50
50
  | `@stacksjs/events` | [`stacks-events`](../stacks-events/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/events/src/index.ts) | 13 |
51
51
  | `@stacksjs/faker` | [`stacks-faker`](../stacks-faker/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/faker/src/index.ts) | 1 |
52
52
  | `@stacksjs/feature-flags` | [`stacks-feature-flags`](../stacks-feature-flags/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/feature-flags/src/index.ts) | 8 |
53
- | `@stacksjs/features` | [`stacks-features`](../stacks-features/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/src/index.ts) | 1 |
53
+ | `@stacksjs/features` | [`stacks-features`](../stacks-features/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/src/index.ts) | 2 |
54
54
  | `@stacksjs/forms` | [`stacks-forms`](../stacks-forms/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/forms/src/index.ts) | 7 |
55
55
  | `@stacksjs/git` | [`stacks-git`](../stacks-git/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/git/src/index.ts) | 2 |
56
56
  | `@stacksjs/github` | [`stacks-git`](../stacks-git/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/github/src/index.ts) | 8 |
@@ -357,7 +357,7 @@ Declared runtime exports: `Database`, `EntityQueryBuilder`, `__flushAfterCommitN
357
357
 
358
358
  Local source modules: [src/affected-rows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/affected-rows.ts), [src/auth-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/auth-tables.ts), [src/custom/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/custom/index.ts), [src/database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/database.ts), [src/datetime-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/datetime-columns.ts), [src/ddl-constraints.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ddl-constraints.ts), [src/defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/defaults.ts), [src/dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/dialect.ts), [src/driver-config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/driver-config.ts), [src/drivers/dynamodb.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/dynamodb.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/index.ts), [src/ensure-database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ensure-database.ts), [src/erd.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/erd.ts), [src/fk-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/fk-audit.ts), [src/framework-renames.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-renames.ts), [src/framework-route-admission.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-route-admission.ts), [src/hand-written-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/hand-written-migrations.ts), [src/ignored-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ignored-migrations.ts), [src/index-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index-shape.ts), [src/managed-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/managed-columns.ts), [src/migration-dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-dialect.ts), [src/migration-ledger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-ledger.ts), [src/migration-names.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-names.ts), [src/migration-path.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-path.ts), [src/migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migrations.ts), [src/model-sources.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/model-sources.ts), [src/notification-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/notification-tables.ts), [src/package-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-migrations.ts), [src/package-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-models.ts), [src/query-logger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/query-logger.ts), [src/rbac-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/rbac-tables.ts), [src/relation-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/relation-columns.ts), [src/replicas.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/replicas.ts), [src/row-lease.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lease.ts), [src/row-lock.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lock.ts), [src/safe-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/safe-migrations.ts), [src/schema-align.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-align.ts), [src/schema-drift.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-drift.ts), [src/seeder.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/seeder.ts), [src/shadowed-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/shadowed-models.ts), [src/sql-helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/sql-helpers.ts), [src/table-exists.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/table-exists.ts), [src/trait-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/trait-tables.ts), [src/transaction-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-context.ts), [src/transaction-options.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-options.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/types.ts), [src/unique-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/unique-audit.ts), [src/utc-defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utc-defaults.ts), [src/utils.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utils.ts), [src/uuid-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/uuid-columns.ts), [src/vschema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/vschema.ts).
359
359
 
360
- Evidence directory: [141 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
360
+ Evidence directory: [142 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
361
361
 
362
362
  ### @stacksjs/datetime
363
363
 
@@ -493,11 +493,11 @@ Evidence directory: [8 retained tests](https://github.com/stacksjs/stacks/blob/m
493
493
 
494
494
  Guidance: [`stacks-features`](../stacks-features/SKILL.md). Source: [storage/framework/core/features/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/src/index.ts).
495
495
 
496
- Declared runtime exports: `FEATURE_FILES`, `FEATURE_NAMES`, `FEATURE_TABLES`, `appModelClaimsTable`, `migrationFeature`, `migrationTable`.
496
+ Declared runtime exports: `FEATURE_FILES`, `FEATURE_NAMES`, `FEATURE_TABLES`, `appModelClaimsTable`, `appModelFiles`, `migrationFeature`, `migrationTable`.
497
497
 
498
498
  Local source modules: [src/names.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/src/names.ts).
499
499
 
500
- Evidence directory: [1 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
500
+ Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/features/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
501
501
 
502
502
  ### @stacksjs/forms
503
503
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.492",
5
+ "version": "0.75.494",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.492",
5
+ "version": "0.75.494",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/mobile": "0.75.492",
48
+ "@stacksjs/mobile": "0.75.494",
49
49
  "@stacksjs/sanitizer": "0.2.807",
50
50
  "@stacksjs/stx": "0.2.807",
51
51
  "@xterm/addon-fit": "^0.11.0",
@@ -18,6 +18,7 @@ type ModelCategory = 'userland' | 'data' | 'commerce' | 'content' | 'marketing'
18
18
  * full type imports aren't available. Keep in sync with the source.
19
19
  */
20
20
  interface DashboardModelOptionsLite {
21
+ highlight?: boolean | number
21
22
  access?: boolean
22
23
  enabled?: boolean
23
24
  label?: string
@@ -102,6 +103,9 @@ export const DEFAULT_TOGGLES: DashboardSectionToggles = {
102
103
  }
103
104
 
104
105
  interface NavItem {
106
+ id?: string
107
+ children?: NavItem[]
108
+ expanded?: boolean
105
109
  to: string
106
110
  icon: string
107
111
  text: string
@@ -413,13 +417,13 @@ export function buildNavSections(
413
417
  ...categoryNavItems(discoveredModels, 'system', new Set()),
414
418
  ]])
415
419
 
416
- // Data section: configurable basic rows + ALL userland models + any
417
- // root-level framework `data` models. Per-row toggles let projects hide
418
- // the basic rows they don't need; userland models always appear.
420
+ // Data pins model-declared highlights. Other visible models stay accessible
421
+ // through a collapsed disclosure using the shared Sidebar component.
419
422
  // Per-model rows link to `/models/<id>` (dynamic ORM viewer); the
420
423
  // built-in dashboard / activity / users / teams / subscribers rows keep
421
424
  // their bespoke pages under `/data/<row>`.
422
425
  const dataRows = toggles.data ?? DEFAULT_DATA_TOGGLES
426
+ const dedicatedDataRows: Record<string, keyof DataRowToggles> = { user: 'users', team: 'teams', subscriber: 'subscribers', activity: 'activity' }
423
427
  const dataNav: NavItem[] = []
424
428
  if (dataRows.dashboard) dataNav.push({ to: '/data/dashboard', icon: 'dashboard', text: 'Dashboard' })
425
429
  if (dataRows.activity) dataNav.push({ to: '/data/activity', icon: 'activity', text: 'Activity' })
@@ -427,23 +431,36 @@ export function buildNavSections(
427
431
  if (dataRows.teams) dataNav.push({ to: '/data/teams', icon: 'group', text: 'Teams' })
428
432
  if (dataRows.subscribers) dataNav.push({ to: '/data/subscribers', icon: 'mail', text: 'Subscribers' })
429
433
  if (dataRows.allModels) dataNav.push({ to: '/models', icon: 'table', text: 'All Models' })
430
- for (const m of discoveredModels) {
434
+ const moreModels: NavItem[] = []
435
+ const highlighted = (model: DiscoveredModel) => model.dashboard?.highlight === true
436
+ || (typeof model.dashboard?.highlight === 'number' && Number.isFinite(model.dashboard.highlight))
437
+ const rank = (model: DiscoveredModel) => typeof model.dashboard?.highlight === 'number' ? model.dashboard.highlight : Number.POSITIVE_INFINITY
438
+ const dataModels = [...discoveredModels].sort((a, b) => {
439
+ if (highlighted(a) !== highlighted(b)) return highlighted(a) ? -1 : 1
440
+ if (highlighted(a)) return rank(a) - rank(b) || a.name.localeCompare(b.name)
441
+ return a.name.localeCompare(b.name)
442
+ })
443
+ for (const m of dataModels) {
431
444
  // Skip when:
432
445
  // - explicit `dashboard.enabled === false` (effectiveCategory returns undefined)
433
446
  // - pinned to a different section via `dashboard.section`
434
447
  // - already has a dedicated dashboard page
435
448
  const eff = effectiveCategory(m)
436
449
  if (eff !== 'userland' && eff !== 'data') continue
437
- if (m.hasDedicatedPage) continue
438
- dataNav.push({
450
+ const dedicatedRow = dedicatedDataRows[m.id]
451
+ if (m.hasDedicatedPage && (!dedicatedRow || dataRows[dedicatedRow])) continue
452
+ const item: NavItem = {
439
453
  to: `/models/${m.id}`,
440
454
  icon: m.dashboard?.icon ?? m.icon ?? 'table',
441
455
  text: m.dashboard?.label ?? m.name,
442
456
  ...(m.dashboard?.roles && m.dashboard.roles.length > 0
443
457
  ? { roles: m.dashboard.roles }
444
458
  : {}),
445
- })
459
+ }
460
+ if (highlighted(m)) dataNav.push(item)
461
+ else moreModels.push(item)
446
462
  }
463
+ if (moreModels.length) dataNav.push({ id: 'models-more', to: '', text: 'More models', icon: 'table', expanded: false, children: moreModels })
447
464
  sections.push(['data', 'data', dataNav])
448
465
 
449
466
  if (toggles.commerce) {
@@ -650,7 +667,9 @@ export interface WebSidebarItem {
650
667
  icon: string
651
668
  /** macOS system color name or CSS color for the icon tint. */
652
669
  iconColor: string
653
- href: string
670
+ href?: string
671
+ children?: WebSidebarItem[]
672
+ expanded?: boolean
654
673
  roles?: string[]
655
674
  }
656
675
 
@@ -726,6 +745,15 @@ export function buildWebSidebarSections(): WebSidebarSection[] {
726
745
  const appNav = manifest.nav.length > 0 ? manifest.nav : loadAppNavFromConfig()
727
746
  const sections = filterSchemaNavSections(buildNavSections(manifest.models, manifest.sections, appNav), manifest.schemaModels)
728
747
 
748
+ const webItem = (item: NavItem): WebSidebarItem => ({
749
+ id: item.id ?? navItemId(item.to),
750
+ label: item.text,
751
+ icon: resolveNavIcon(item.icon),
752
+ iconColor: 'blue',
753
+ ...(item.to ? { href: item.to } : {}),
754
+ ...(item.roles?.length ? { roles: item.roles } : {}),
755
+ ...(item.children ? { children: item.children.map(webItem), expanded: item.expanded ?? false } : {}),
756
+ })
729
757
  return [
730
758
  {
731
759
  id: 'top',
@@ -735,14 +763,20 @@ export function buildWebSidebarSections(): WebSidebarSection[] {
735
763
  ...sections.map(([key, label, items]) => ({
736
764
  id: key,
737
765
  label: titleCase(label),
738
- items: items.map(item => ({
739
- id: navItemId(item.to),
740
- label: item.text,
741
- icon: resolveNavIcon(item.icon),
742
- iconColor: 'blue',
743
- href: item.to,
744
- ...(item.roles && item.roles.length > 0 ? { roles: item.roles } : {}),
745
- })),
766
+ items: items.map(webItem),
746
767
  })),
747
768
  ]
748
769
  }
770
+
771
+ /** Role metadata follows nested model rows as well as pinned rows. */
772
+ export function webSidebarRoleMap(sections: WebSidebarSection[]): Record<string, string[]> {
773
+ const roles: Record<string, string[]> = Object.create(null)
774
+ const visit = (items: WebSidebarItem[]) => {
775
+ for (const item of items) {
776
+ if (item.roles?.length) roles[item.id] = item.roles
777
+ if (item.children) visit(item.children)
778
+ }
779
+ }
780
+ for (const section of sections) visit(section.items)
781
+ return roles
782
+ }
@@ -16,7 +16,7 @@
16
16
  // vendored or linked. `@stacksjs/defaults/*` is mapped onto the vendored tree in
17
17
  // `storage/framework/tsconfig.app.json` and falls back to the installed
18
18
  // package when there is none, so it resolves in both layouts.
19
- import { buildWebSidebarSections } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
19
+ import { buildWebSidebarSections, webSidebarRoleMap } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
20
20
 
21
21
  export const sidebarSections = buildWebSidebarSections()
22
22
 
@@ -31,15 +31,7 @@ export const sidebarSections = buildWebSidebarSections()
31
31
  // then ran `Object.entries` over that string, which yields index/character
32
32
  // pairs, and called `.some()` on a single character. Every dashboard load
33
33
  // threw inside applyRoleFilter before it could filter anything.
34
- export const sidebarRoleMap: Record<string, string[]> = Object.fromEntries(
35
- sidebarSections.flatMap(section =>
36
- section.items.flatMap(item =>
37
- item.roles && item.roles.length > 0
38
- ? [[item.id, item.roles] as const]
39
- : [],
40
- ),
41
- ),
42
- )
34
+ export const sidebarRoleMap: Record<string, string[]> = webSidebarRoleMap(sidebarSections)
43
35
 
44
36
  // Declared, so the client block below gets the map typed rather than inferred
45
37
  // off the implicit bridge - which is what let the mismatch above go unseen.