@stacksjs/defaults 0.75.255 → 0.75.256

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.
@@ -11,7 +11,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
11
11
  | Package | Task guidance | Source entry | Retained tests |
12
12
  |---|---|---|---|
13
13
  | `@stacksjs/action-runner` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/action-runner/src/index.ts) | 1 |
14
- | `@stacksjs/actions` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/index.ts) | 75 |
14
+ | `@stacksjs/actions` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/index.ts) | 76 |
15
15
  | `@stacksjs/ai` | [`stacks-ai`](../stacks-ai/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ai/src/index.ts) | 17 |
16
16
  | `@stacksjs/alias` | [`stacks-alias`](../stacks-alias/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/alias/src/index.ts) | 1 |
17
17
  | `@stacksjs/analytics` | [`stacks-analytics`](../stacks-analytics/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/analytics/src/index.ts) | 6 |
@@ -37,7 +37,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
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) | 4 |
38
38
  | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 125 |
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) | 13 |
40
- | `@stacksjs/defaults` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/package.json) | 1 |
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 |
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) | 12 |
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 |
@@ -67,7 +67,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
67
67
  | `@stacksjs/objects` | [`stacks-objects`](../stacks-objects/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/objects/src/index.ts) | 4 |
68
68
  | `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) | 65 |
69
69
  | `@stacksjs/pagination` | [`stacks-pagination`](../stacks-pagination/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/pagination/src/index.ts) | 0 |
70
- | `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 12 |
70
+ | `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 13 |
71
71
  | `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 28 |
72
72
  | `@stacksjs/push` | [`stacks-push`](../stacks-push/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts) | 6 |
73
73
  | `@stacksjs/query-builder` | [`stacks-query-builder`](../stacks-query-builder/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/query-builder/src/index.ts) | 6 |
@@ -115,11 +115,11 @@ Evidence directory: [1 retained tests](https://github.com/stacksjs/stacks/blob/m
115
115
 
116
116
  Guidance: [`stacks-actions`](../stacks-actions/SKILL.md). Source: [storage/framework/core/actions/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/index.ts).
117
117
 
118
- Declared runtime exports: `BlogAdminError`, `DEFAULT_IOS_DEPENDENCIES`, `DEFAULT_STX_LINT_CONFIG`, `IosToolchainError`, `XCODE_NOTE`, `blogSlugify`, `createComponent`, `createDatabase`, `createFactory`, `createFunction`, `createLanguage`, `createMail`, `createMiddleware`, `createMigration`, `createModel`, `createNotification`, `createPage`, `deleteBlogPost`, `describeDanglingRouteActions`, `describeGitHubRelease`, `discoverPackages`, `ensureDiscoveredPackages`, `findDanglingRouteActions`, `formatProject`, `getBlogPost`, `installStack`, `isDryRunActive`, `lintFix`, `lintProject`, `listBlogPosts`, `listStacks`, `loadIosDependencies`, `loadStxLintConfig`, `makeAction`, `makeCertificate`, `makeCommand`, `makeComponent`, `makeDatabase`, `makeFunction`, `makeJob`, `makeLanguage`, `makeMail`, `makeNotification`, `makePage`, `makePolicy`, `makeQueueTable`, `makeResource`, `makeStack`, `measureDefaultsDrift`, `pantryExecutable`, `pantryInstallArgs`, `parseFields`, `parseGitHubRemote`, `publishGitHubRelease`, `resolveXcodegen`, `runAdd`, `runCommit`, `runMake`, `runStxLint`, `saveBlogPost`, `scaffoldCrud`, `setDryRun`, `summarizeStructureChanges`, `uninstallStack`, `xcodeDeveloperDir`.
118
+ Declared runtime exports: `BlogAdminError`, `DEFAULT_IOS_DEPENDENCIES`, `DEFAULT_STX_LINT_CONFIG`, `IosToolchainError`, `XCODE_NOTE`, `blogSlugify`, `createComponent`, `createDatabase`, `createFactory`, `createFunction`, `createLanguage`, `createMail`, `createMiddleware`, `createMigration`, `createModel`, `createNotification`, `createPage`, `deleteBlogPost`, `describeDanglingRouteActions`, `describeGitHubRelease`, `discoverPackages`, `ensureDiscoveredPackages`, `findDanglingRouteActions`, `formatProject`, `getBlogPost`, `installStack`, `isDryRunActive`, `lintFix`, `lintProject`, `listBlogPosts`, `listStacks`, `loadIosDependencies`, `loadStxLintConfig`, `makeAction`, `makeCertificate`, `makeCommand`, `makeComponent`, `makeDatabase`, `makeFunction`, `makeJob`, `makeLanguage`, `makeMail`, `makeNotification`, `makePage`, `makePolicy`, `makeQueueTable`, `makeResource`, `makeStack`, `measureDefaultsDrift`, `pantryExecutable`, `pantryInstallArgs`, `parseFields`, `parseGitHubRemote`, `publishGitHubRelease`, `resolveStxSource`, `resolveXcodegen`, `runAdd`, `runCommit`, `runMake`, `runStxLint`, `saveBlogPost`, `scaffoldCrud`, `setDryRun`, `summarizeStructureChanges`, `uninstallStack`, `xcodeDeveloperDir`.
119
119
 
120
- Local source modules: [src/action.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/action.ts), [src/add.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/add.ts), [src/blog-admin.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/blog-admin.ts), [src/build/ios-toolchain.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/build/ios-toolchain.ts), [src/commit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/commit.ts), [src/dev/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/dev/index.ts), [src/discover-packages.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/discover-packages.ts), [src/generate/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/generate/index.ts), [src/github-release.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/github-release.ts), [src/helpers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/helpers/index.ts), [src/library/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/library/index.ts), [src/lint/lint.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/lint.ts), [src/lint/stx-gate.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/stx-gate.ts), [src/make-command.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-command.ts), [src/make-job.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-job.ts), [src/make-policy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-policy.ts), [src/make-resource.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-resource.ts), [src/make.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make.ts), [src/scaffold-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/scaffold-crud.ts), [src/setup/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/setup/index.ts), [src/stacks.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/stacks.ts), [src/upgrade/package-project.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/package-project.ts), [src/upgrade/route-actions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/route-actions.ts).
120
+ Local source modules: [src/action.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/action.ts), [src/add.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/add.ts), [src/blog-admin.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/blog-admin.ts), [src/build/ios-toolchain.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/build/ios-toolchain.ts), [src/commit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/commit.ts), [src/dev/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/dev/index.ts), [src/discover-packages.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/discover-packages.ts), [src/generate/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/generate/index.ts), [src/github-release.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/github-release.ts), [src/helpers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/helpers/index.ts), [src/library/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/library/index.ts), [src/lint/lint.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/lint.ts), [src/lint/stx-gate.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/stx-gate.ts), [src/make-command.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-command.ts), [src/make-job.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-job.ts), [src/make-policy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-policy.ts), [src/make-resource.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-resource.ts), [src/make.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make.ts), [src/scaffold-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/scaffold-crud.ts), [src/setup/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/setup/index.ts), [src/stacks.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/stacks.ts), [src/stx-source.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/stx-source.ts), [src/upgrade/package-project.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/package-project.ts), [src/upgrade/route-actions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/route-actions.ts).
121
121
 
122
- Evidence directory: [75 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
122
+ Evidence directory: [76 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
123
123
 
124
124
  ### @stacksjs/ai
125
125
 
@@ -369,7 +369,7 @@ Guidance: [`stacks-build`](../stacks-build/SKILL.md). Source: [storage/framework
369
369
 
370
370
  Read the entrypoint and package export map for re-exported or type-only surfaces.
371
371
 
372
- Evidence directory: [1 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
372
+ Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
373
373
 
374
374
  ### @stacksjs/deploy
375
375
 
@@ -645,11 +645,11 @@ Declared runtime exports: `isCursorPaginator`, `isPaginator`, `isSimplePaginator
645
645
 
646
646
  Guidance: [`stacks-path`](../stacks-path/SKILL.md). Source: [storage/framework/core/path/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts).
647
647
 
648
- Declared runtime exports: `DEFAULTS_SYNC_MARKER`, `actionRunnerPath`, `actionsPath`, `aiPath`, `aliasPath`, `analyticsPath`, `appPath`, `applyRuntimeDirectoryEnv`, `arraysPath`, `assetsPath`, `authPath`, `basename`, `browserPath`, `buddyPath`, `buildEnginePath`, `buildPath`, `builtUserActionsPath`, `cachePath`, `chartsPath`, `chatPath`, `cliPath`, `cloudPath`, `cloudStatePath`, `collectionsPath`, `commandsPath`, `componentsPath`, `configPath`, `coreApiPath`, `coreEnvPath`, `corePath`, `coreStoragePath`, `customElementsDataPath`, `databasePath`, `datetimePath`, `defaultsAppPath`, `defaultsPackagePath`, `defaultsResourcesPath`, `delimiter`, `desktopPath`, `developmentPath`, `dirname`, `dnsPath`, `docsPath`, `emailPath`, `ensureRuntimeDirectories`, `enumsPath`, `errorHandlingPath`, `eslintPluginPath`, `eventsPath`, `examplesPath`, `extname`, `fakerPath`, `featureFlagsPath`, `featuresPath`, `findProjectPath`, `frameworkCloudPath`, `frameworkDefaultsRoot`, `frameworkPath`, `frameworkRuntimePath`, `functionsPath`, `gitPath`, `healthPath`, `homeDir`, `inspectDefaultsProvenance`, `installedDefaultsVersion`, `isAbsolute`, `isCompiledBinary`, `isInstalledDefaultsRoot`, `jobsPath`, `join`, `langPath`, `layoutsPath`, `libraryPackagePath`, `libsEntriesPath`, `libsPath`, `linkPackagedDefaults`, `lintPath`, `listenersPath`, `loggingPath`, `logsPath`, `mergeDirectoryInto`, `modelMetaPath`, `modelsPath`, `modulesPath`, `newsletterPath`, `normalize`, `notificationsPath`, `objectsPath`, `onboardingPath`, `ormPath`, `packagedDefaultsRoot`, `paginationPath`, `path`, `pathPath`, `paymentsPath`, `projectConfigPath`, `projectPath`, `publicPath`, `pushPath`, `queryBuilderPath`, `queuePath`, `realtimePath`, `relative`, `relativeActionsPath`, `replPath`, `resolve`, `resolveModulePath`, `resolveUserLibBase`, `resourcesPath`, `routerPath`, `routesPath`, `runtimeDirectoryEnv`, `runtimePath`, `schedulerPath`, `scriptsPath`, `searchEnginePath`, `securityPath`, `sep`, `serverPath`, `serverlessPath`, `settingsPath`, `shellPath`, `siteConfigPath`, `skillsPath`, `slugPath`, `smsPath`, `socialsPath`, `stacksBackupPath`, `stacksLockPath`, `stacksPath`, `storagePath`, `storesPath`, `stringsPath`, `stxPath`, `testingPath`, `testsPath`, `tinkerPath`, `toNamespacedPath`, `typesPath`, `uiPath`, `userActionsPath`, `userComponentsPath`, `userControllersPath`, `userDatabasePath`, `userEmailsPath`, `userEventsPath`, `userFunctionsPath`, `userJobsPath`, `userLibsPath`, `userListenersPath`, `userMailPath`, `userMiddlewarePath`, `userMigrationsPath`, `userModelsPath`, `userNotificationsPath`, `userServerPath`, `userViewsPath`, `usesVendoredDefaults`, `utilsPath`, `validationPath`, `viewsPath`.
648
+ Declared runtime exports: `DEFAULTS_SYNC_MARKER`, `actionRunnerPath`, `actionsPath`, `aiPath`, `aliasPath`, `analyticsPath`, `appPath`, `applyRuntimeDirectoryEnv`, `arraysPath`, `assetsPath`, `authPath`, `basename`, `browserPath`, `buddyPath`, `buildEnginePath`, `buildPath`, `builtUserActionsPath`, `cachePath`, `chartsPath`, `chatPath`, `cliPath`, `cloudPath`, `cloudStatePath`, `collectionsPath`, `commandsPath`, `componentsPath`, `configPath`, `coreApiPath`, `coreEnvPath`, `corePath`, `coreStoragePath`, `customElementsDataPath`, `databasePath`, `datetimePath`, `defaultsAppPath`, `defaultsPackagePath`, `defaultsPath`, `defaultsResourcesPath`, `delimiter`, `desktopPath`, `developmentPath`, `dirname`, `dnsPath`, `docsPath`, `emailPath`, `ensureRuntimeDirectories`, `enumsPath`, `errorHandlingPath`, `eslintPluginPath`, `eventsPath`, `examplesPath`, `extname`, `fakerPath`, `featureFlagsPath`, `featuresPath`, `findProjectPath`, `frameworkCloudPath`, `frameworkDefaultsRoot`, `frameworkPath`, `frameworkRuntimePath`, `functionsPath`, `gitPath`, `healthPath`, `homeDir`, `inspectDefaultsProvenance`, `installedDefaultsVersion`, `isAbsolute`, `isCompiledBinary`, `isInstalledDefaultsRoot`, `jobsPath`, `join`, `langPath`, `layoutsPath`, `libraryPackagePath`, `libsEntriesPath`, `libsPath`, `linkPackagedDefaults`, `lintPath`, `listenersPath`, `loggingPath`, `logsPath`, `mergeDirectoryInto`, `modelMetaPath`, `modelsPath`, `modulesPath`, `newsletterPath`, `normalize`, `notificationsPath`, `objectsPath`, `onboardingPath`, `ormPath`, `packagedDefaultsRoot`, `paginationPath`, `path`, `pathPath`, `paymentsPath`, `projectConfigPath`, `projectPath`, `publicPath`, `pushPath`, `queryBuilderPath`, `queuePath`, `realtimePath`, `relative`, `relativeActionsPath`, `replPath`, `resolve`, `resolveModulePath`, `resolveUserLibBase`, `resourcesPath`, `routerPath`, `routesPath`, `runtimeDirectoryEnv`, `runtimePath`, `schedulerPath`, `scriptsPath`, `searchEnginePath`, `securityPath`, `sep`, `serverPath`, `serverlessPath`, `settingsPath`, `shellPath`, `siteConfigPath`, `skillsPath`, `slugPath`, `smsPath`, `socialsPath`, `stacksBackupPath`, `stacksLockPath`, `stacksPath`, `storagePath`, `storesPath`, `stringsPath`, `stxPath`, `testingPath`, `testsPath`, `tinkerPath`, `toNamespacedPath`, `typesPath`, `uiPath`, `userActionsPath`, `userComponentsPath`, `userControllersPath`, `userDatabasePath`, `userEmailsPath`, `userEventsPath`, `userFunctionsPath`, `userJobsPath`, `userLibsPath`, `userListenersPath`, `userMailPath`, `userMiddlewarePath`, `userMigrationsPath`, `userModelsPath`, `userNotificationsPath`, `userServerPath`, `userViewsPath`, `usesVendoredDefaults`, `utilsPath`, `validationPath`, `viewsPath`.
649
649
 
650
650
  Local source modules: [src/module-resolution.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/module-resolution.ts), [src/project.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/project.ts).
651
651
 
652
- Evidence directory: [12 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
652
+ Evidence directory: [13 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
653
653
 
654
654
  ### @stacksjs/payments
655
655
 
package/functions/api.ts CHANGED
@@ -9,6 +9,55 @@ import { useAuth } from './auth'
9
9
 
10
10
  const baseUrl = resolveApiBaseUrl()
11
11
 
12
+ /**
13
+ * Where this client is allowed to send a request from.
14
+ *
15
+ * `resolveApiBaseUrl()` answers with the relative `/api` when there is no
16
+ * `window.location` and no injected `__STACKS_API_URL__`, which is the honest
17
+ * answer for a browser bundle and deliberate (stacksjs/stacks#2421). `fetch`
18
+ * cannot use it: off the DOM there is no origin to resolve a relative URL
19
+ * against, so every verb below would reach `ERR_INVALID_URL` after building
20
+ * its headers, reading the auth token and serialising its body.
21
+ *
22
+ * That failure arrived as a bare `TypeError: fetch() URL is invalid` in a dev
23
+ * server log while the page still returned 200, which is how a dashboard
24
+ * template calling `post()` by accident during server-side rendering went
25
+ * unnoticed (stacksjs/stacks#2944). It is also only an accident that nothing
26
+ * was sent: with `__STACKS_API_URL__` injected for a split-origin deployment
27
+ * the URL is absolute, and the same mistake issues a real mutating request
28
+ * while a page renders.
29
+ *
30
+ * So refuse first, by name, before any of that work happens. This client is
31
+ * for the browser; server-side code has the ORM and the actions.
32
+ */
33
+ function requestUrl(endpoint: string): string {
34
+ if (/^https?:\/\//i.test(baseUrl))
35
+ return `${baseUrl}${endpoint}`
36
+
37
+ throw new DashboardApiEnvironmentError(endpoint)
38
+ }
39
+
40
+ /**
41
+ * Thrown when a dashboard API verb is called where it cannot send a request.
42
+ *
43
+ * Named rather than generic: the thing worth knowing is which endpoint was
44
+ * about to be called from the wrong place, and the stack alone does not say
45
+ * so once the evaluator that called it is several frames of template
46
+ * machinery deep.
47
+ */
48
+ export class DashboardApiEnvironmentError extends Error {
49
+ readonly endpoint: string
50
+
51
+ constructor(endpoint: string) {
52
+ super(
53
+ `The dashboard API client cannot request "${endpoint}" here: it needs an absolute base URL and resolved "${baseUrl}". `
54
+ + `This client runs in the browser. Server-side code should use the ORM or an action instead.`,
55
+ )
56
+ this.name = 'DashboardApiEnvironmentError'
57
+ this.endpoint = endpoint
58
+ }
59
+ }
60
+
12
61
  export interface ApiResponse<T> {
13
62
  data: T
14
63
  message?: string
@@ -55,7 +104,7 @@ async function handleResponse<T>(response: Response): Promise<T> {
55
104
  * GET request
56
105
  */
57
106
  export async function get<T>(endpoint: string): Promise<T> {
58
- const response = await fetch(`${baseUrl}${endpoint}`, {
107
+ const response = await fetch(requestUrl(endpoint), {
59
108
  method: 'GET',
60
109
  headers: createHeaders(),
61
110
  })
@@ -67,7 +116,7 @@ export async function get<T>(endpoint: string): Promise<T> {
67
116
  * POST request
68
117
  */
69
118
  export async function post<T>(endpoint: string, body?: unknown): Promise<T> {
70
- const response = await fetch(`${baseUrl}${endpoint}`, {
119
+ const response = await fetch(requestUrl(endpoint), {
71
120
  method: 'POST',
72
121
  headers: createHeaders(),
73
122
  body: body ? JSON.stringify(body) : undefined,
@@ -80,7 +129,7 @@ export async function post<T>(endpoint: string, body?: unknown): Promise<T> {
80
129
  * PUT request
81
130
  */
82
131
  export async function put<T>(endpoint: string, body?: unknown): Promise<T> {
83
- const response = await fetch(`${baseUrl}${endpoint}`, {
132
+ const response = await fetch(requestUrl(endpoint), {
84
133
  method: 'PUT',
85
134
  headers: createHeaders(),
86
135
  body: body ? JSON.stringify(body) : undefined,
@@ -93,7 +142,7 @@ export async function put<T>(endpoint: string, body?: unknown): Promise<T> {
93
142
  * PATCH request
94
143
  */
95
144
  export async function patch<T>(endpoint: string, body?: unknown): Promise<T> {
96
- const response = await fetch(`${baseUrl}${endpoint}`, {
145
+ const response = await fetch(requestUrl(endpoint), {
97
146
  method: 'PATCH',
98
147
  headers: createHeaders(),
99
148
  body: body ? JSON.stringify(body) : undefined,
@@ -106,7 +155,7 @@ export async function patch<T>(endpoint: string, body?: unknown): Promise<T> {
106
155
  * DELETE request
107
156
  */
108
157
  export async function del<T>(endpoint: string): Promise<T> {
109
- const response = await fetch(`${baseUrl}${endpoint}`, {
158
+ const response = await fetch(requestUrl(endpoint), {
110
159
  method: 'DELETE',
111
160
  headers: createHeaders(),
112
161
  })
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.255",
5
+ "version": "0.75.256",
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.255",
5
+ "version": "0.75.256",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -24,6 +24,7 @@
24
24
  "ide",
25
25
  "lang",
26
26
  "routes",
27
+ "scaffold",
27
28
  "stores",
28
29
  "styles",
29
30
  "types",
@@ -44,7 +45,7 @@
44
45
  "dependencies": {
45
46
  "@iconify-json/f7": "^1.2.2",
46
47
  "@iconify-json/hugeicons": "^1.2.35",
47
- "@stacksjs/mobile": "0.75.255",
48
+ "@stacksjs/mobile": "0.75.256",
48
49
  "@stacksjs/sanitizer": "^0.2.534",
49
50
  "@stacksjs/stx": "^0.2.631",
50
51
  "@xterm/addon-fit": "^0.11.0",
@@ -24,7 +24,11 @@ interface BlogPostDraft {
24
24
  }
25
25
 
26
26
  const open = useReactiveProp('open', false)
27
- const post = useReactiveProp('post', null as BlogPostRecord | null)
27
+ // Named `editing`, not `post`, while still reading the `post` prop.
28
+ // A bare `post` in a `{{ … }}` interpolation is resolved server-side
29
+ // against module and global scope, where it finds the dashboard API
30
+ // client's own `post()` and calls it mid-render (stacksjs/stacks#2944).
31
+ const editing = useReactiveProp('post', null as BlogPostRecord | null)
28
32
  const loadedBody = useReactiveProp('loadedBody', '')
29
33
  const bodyLoading = useReactiveProp('bodyLoading', false)
30
34
  const bodyLoadFailed = useReactiveProp('bodyLoadFailed', false)
@@ -54,13 +58,13 @@ function slugify(input: string): string {
54
58
  const suggestedSlug = derived(() => slugify(title()))
55
59
  const wordCount = derived(() => body().split(/\s+/).filter(Boolean).length)
56
60
  const readingTime = derived(() => Math.max(1, Math.round(wordCount() / 200)))
57
- const dialogTitle = derived(() => post() ? 'Edit post' : 'New post')
58
- const actionLabel = derived(() => post() ? 'Save post' : 'Create post')
61
+ const dialogTitle = derived(() => editing() ? 'Edit post' : 'New post')
62
+ const actionLabel = derived(() => editing() ? 'Save post' : 'Create post')
59
63
 
60
64
  effect(() => {
61
65
  const isOpen = open()
62
66
  if (isOpen && !wasOpen) {
63
- const record = post()
67
+ const record = editing()
64
68
  activeSlug = record?.slug || ''
65
69
  title.set(record?.title || '')
66
70
  slug.set(record?.slug || '')
@@ -76,7 +80,7 @@ effect(() => {
76
80
  })
77
81
 
78
82
  effect(() => {
79
- if (open() && post()?.slug === activeSlug && !bodyLoading())
83
+ if (open() && editing()?.slug === activeSlug && !bodyLoading())
80
84
  body.set(loadedBody())
81
85
  })
82
86
 
@@ -28,7 +28,11 @@ interface PostDraft {
28
28
  }
29
29
 
30
30
  const open = useReactiveProp('open', false)
31
- const post = useReactiveProp('post', null as PostRecord | null)
31
+ // Named `editing`, not `post`, while still reading the `post` prop.
32
+ // A bare `post` in a `{{ … }}` interpolation is resolved server-side
33
+ // against module and global scope, where it finds the dashboard API
34
+ // client's own `post()` and calls it mid-render (stacksjs/stacks#2944).
35
+ const editing = useReactiveProp('post', null as PostRecord | null)
32
36
  const categories = useReactiveProp('categories', [] as OptionRecord[])
33
37
  const tags = useReactiveProp('tags', [] as OptionRecord[])
34
38
  const authors = useReactiveProp('authors', [] as AuthorRecord[])
@@ -49,7 +53,7 @@ let wasOpen = false
49
53
  effect(() => {
50
54
  const isOpen = open()
51
55
  if (isOpen && !wasOpen) {
52
- const record = post()
56
+ const record = editing()
53
57
  title.set(record?.title || '')
54
58
  excerpt.set(record?.excerpt || '')
55
59
  content.set(record?.content || '')
@@ -93,7 +97,7 @@ function submit(): void {
93
97
 
94
98
  <Modal
95
99
  :isOpen="open()"
96
- :title="post() ? 'Edit post' : 'New post'"
100
+ :title="editing() ? 'Edit post' : 'New post'"
97
101
  description="Content, ownership, and taxonomies are persisted together."
98
102
  size="xl"
99
103
  :closable="!busy()"
@@ -169,7 +173,7 @@ function submit(): void {
169
173
  <div class="flex gap-2 justify-end w-full">
170
174
  <Button :disabled="busy()" variant="secondary" @click="close">Cancel</Button>
171
175
  <Button type="submit" form="post-editor-form" :disabled="!valid()" :loading="busy()">
172
- {{ post() ? 'Save changes' : 'Create post' }}
176
+ {{ editing() ? 'Save changes' : 'Create post' }}
173
177
  </Button>
174
178
  </div>
175
179
  </template>
@@ -17,123 +17,110 @@
17
17
  */
18
18
 
19
19
  import { existsSync } from 'node:fs'
20
- import { basename, dirname, resolve } from 'node:path'
21
-
22
- let projectRootCache: string | null = null
23
-
24
- const VENDORED_DEFAULTS_PREFIX = 'storage/framework/defaults/'
25
- let defaultsRootCache: string | null = null
20
+ import { basename, resolve } from 'node:path'
21
+ import { defaultsPath, projectPath } from '@stacksjs/path'
26
22
 
27
23
  /**
28
- * The framework defaults tree: `storage/framework/defaults` in a project that
29
- * vendors it, `node_modules/@stacksjs/defaults` in one that does not. Counted
30
- * from this file first, which is inside that tree in both layouts; the project
31
- * root is the fallback for a copy that was bundled somewhere else.
24
+ * The project root, and where the defaults tree is, both from
25
+ * `@stacksjs/path`.
26
+ *
27
+ * This file used to hand-roll the walk, explicitly to avoid importing the
28
+ * path package, which was recorded as having "its own evaluation graph" that
29
+ * "would slow page renders". Measured rather than inherited: importing
30
+ * `@stacksjs/path` in this checkout costs 1.5-2.7ms, once per process because
31
+ * the module cache holds it, not once per render. `preloader.ts` next door
32
+ * already imports it.
33
+ *
34
+ * The walk also had to go, independently of cost. It anchored on a directory
35
+ * containing `storage/framework/defaults`, which is the one directory
36
+ * stacksjs/stacks#2941 is removing: in a project resolving its defaults from
37
+ * `node_modules`, the walk would find no anchor and fall through to
38
+ * `process.cwd()`, which is right only by luck.
32
39
  */
33
- function defaultsRoot(): string {
34
- if (defaultsRootCache) return defaultsRootCache
35
- const own = resolve(dirname(new URL(import.meta.url).pathname), '../../..')
36
- const candidates = [
37
- own,
38
- resolve(projectRoot(), 'storage/framework/defaults'),
39
- resolve(projectRoot(), 'node_modules/@stacksjs/defaults'),
40
- ]
41
- defaultsRootCache = candidates.find(candidate => existsSync(resolve(candidate, 'app/Models'))) ?? candidates[1]!
42
- return defaultsRootCache
43
- }
44
-
45
40
  function projectRoot(): string {
46
- if (projectRootCache) return projectRootCache
47
- // Walk up from this file location to find the project root (the dir
48
- // that contains `storage/framework`). This mirrors what
49
- // `@stacksjs/path` does, but without pulling in the path package
50
- // (which has its own evaluation graph and would slow page renders).
51
- let dir = dirname(new URL(import.meta.url).pathname)
52
- for (let i = 0; i < 12; i++) {
53
- if (existsSync(resolve(dir, 'storage/framework'))) {
54
- projectRootCache = dir
55
- return dir
56
- }
57
- const parent = dirname(dir)
58
- if (parent === dir) break
59
- dir = parent
60
- }
61
- // Fall back to cwd — STX serves run from the project root.
62
- projectRootCache = process.cwd()
63
- return projectRootCache
41
+ return projectPath()
64
42
  }
65
43
 
66
44
  /**
67
- * Fast-path map of common model names to relative paths. The first existing
68
- * file wins, and user overrides always take priority over framework defaults.
69
- * A cached filesystem index below covers newly-added and nested models so
70
- * this map is an optimization rather than a correctness requirement.
45
+ * Fast-path map of common model names to the two places they can live:
46
+ * `[path under the project, path under the defaults tree]`.
47
+ *
48
+ * The first existing file wins, and user overrides always take priority over
49
+ * framework defaults. A cached filesystem index below covers newly-added and
50
+ * nested models, so this map is an optimization rather than a correctness
51
+ * requirement.
52
+ *
53
+ * The second element is relative to the defaults tree rather than to the
54
+ * project, because that tree is not always inside the project: it is
55
+ * `storage/framework/defaults` when the project vendors a current copy and the
56
+ * installed `@stacksjs/defaults` otherwise (stacksjs/stacks#2941). Fifty-five
57
+ * rows used to spell `storage/framework/defaults/` out by hand.
71
58
  */
72
- const MODEL_PATHS: Record<string, string[]> = {
59
+ const MODEL_PATHS: Record<string, [string, string]> = {
73
60
  // Auth / core
74
- User: ['app/Models/User.ts', 'storage/framework/defaults/app/Models/User.ts'],
75
- Team: ['app/Models/Team.ts', 'storage/framework/defaults/app/Models/Team.ts'],
76
- Subscriber: ['app/Models/Subscriber.ts', 'storage/framework/defaults/app/Models/Subscriber.ts'],
77
- SubscriberEmail: ['app/Models/SubscriberEmail.ts', 'storage/framework/defaults/app/Models/SubscriberEmail.ts'],
78
- Subscription: ['app/Models/Subscription.ts', 'storage/framework/defaults/app/Models/Subscription.ts'],
61
+ User: ['app/Models/User.ts', 'app/Models/User.ts'],
62
+ Team: ['app/Models/Team.ts', 'app/Models/Team.ts'],
63
+ Subscriber: ['app/Models/Subscriber.ts', 'app/Models/Subscriber.ts'],
64
+ SubscriberEmail: ['app/Models/SubscriberEmail.ts', 'app/Models/SubscriberEmail.ts'],
65
+ Subscription: ['app/Models/Subscription.ts', 'app/Models/Subscription.ts'],
79
66
 
80
67
  // Content
81
- Post: ['app/Models/Post.ts', 'storage/framework/defaults/app/Models/Content/Post.ts'],
82
- Page: ['app/Models/Page.ts', 'storage/framework/defaults/app/Models/Content/Page.ts'],
83
- Author: ['app/Models/Author.ts', 'storage/framework/defaults/app/Models/Content/Author.ts'],
84
- Comment: ['app/Models/Comment.ts', 'storage/framework/defaults/app/Models/Comment.ts'],
85
- Tag: ['app/Models/Tag.ts', 'storage/framework/defaults/app/Models/Tag.ts'],
86
- Category: ['app/Models/Category.ts', 'storage/framework/defaults/app/Models/commerce/Category.ts'],
68
+ Post: ['app/Models/Post.ts', 'app/Models/Content/Post.ts'],
69
+ Page: ['app/Models/Page.ts', 'app/Models/Content/Page.ts'],
70
+ Author: ['app/Models/Author.ts', 'app/Models/Content/Author.ts'],
71
+ Comment: ['app/Models/Comment.ts', 'app/Models/Comment.ts'],
72
+ Tag: ['app/Models/Tag.ts', 'app/Models/Tag.ts'],
73
+ Category: ['app/Models/Category.ts', 'app/Models/commerce/Category.ts'],
87
74
 
88
75
  // App / operations
89
- Activity: ['app/Models/Activity.ts', 'storage/framework/defaults/app/Models/Activity.ts'],
90
- Deployment: ['app/Models/Deployment.ts', 'storage/framework/defaults/app/Models/Deployment.ts'],
91
- Release: ['app/Models/Release.ts', 'storage/framework/defaults/app/Models/Release.ts'],
92
- Notification: ['app/Models/Notification.ts', 'storage/framework/defaults/app/Models/Notification.ts'],
93
- Job: ['app/Models/Job.ts', 'storage/framework/defaults/app/Models/Job.ts'],
94
- FailedJob: ['app/Models/FailedJob.ts', 'storage/framework/defaults/app/Models/FailedJob.ts'],
95
- Log: ['app/Models/Log.ts', 'storage/framework/defaults/app/Models/Log.ts'],
96
- Request: ['app/Models/Request.ts', 'storage/framework/defaults/app/Models/Request.ts'],
97
- Error: ['app/Models/Error.ts', 'storage/framework/defaults/app/Models/Error.ts'],
98
- Websocket: ['app/Models/Websocket.ts', 'storage/framework/defaults/app/Models/realtime/Websocket.ts'],
76
+ Activity: ['app/Models/Activity.ts', 'app/Models/Activity.ts'],
77
+ Deployment: ['app/Models/Deployment.ts', 'app/Models/Deployment.ts'],
78
+ Release: ['app/Models/Release.ts', 'app/Models/Release.ts'],
79
+ Notification: ['app/Models/Notification.ts', 'app/Models/Notification.ts'],
80
+ Job: ['app/Models/Job.ts', 'app/Models/Job.ts'],
81
+ FailedJob: ['app/Models/FailedJob.ts', 'app/Models/FailedJob.ts'],
82
+ Log: ['app/Models/Log.ts', 'app/Models/Log.ts'],
83
+ Request: ['app/Models/Request.ts', 'app/Models/Request.ts'],
84
+ Error: ['app/Models/Error.ts', 'app/Models/Error.ts'],
85
+ Websocket: ['app/Models/Websocket.ts', 'app/Models/realtime/Websocket.ts'],
99
86
 
100
87
  // Marketing
101
- Campaign: ['app/Models/Campaign.ts', 'storage/framework/defaults/app/Models/Campaign.ts'],
102
- EmailList: ['app/Models/EmailList.ts', 'storage/framework/defaults/app/Models/EmailList.ts'],
103
- SocialPost: ['app/Models/SocialPost.ts', 'storage/framework/defaults/app/Models/SocialPost.ts'],
88
+ Campaign: ['app/Models/Campaign.ts', 'app/Models/Campaign.ts'],
89
+ EmailList: ['app/Models/EmailList.ts', 'app/Models/EmailList.ts'],
90
+ SocialPost: ['app/Models/SocialPost.ts', 'app/Models/SocialPost.ts'],
104
91
 
105
92
  // Commerce
106
- Order: ['app/Models/Order.ts', 'storage/framework/defaults/app/Models/commerce/Order.ts'],
107
- OrderItem: ['app/Models/OrderItem.ts', 'storage/framework/defaults/app/Models/commerce/OrderItem.ts'],
108
- Cart: ['app/Models/Cart.ts', 'storage/framework/defaults/app/Models/commerce/Cart.ts'],
109
- CartItem: ['app/Models/CartItem.ts', 'storage/framework/defaults/app/Models/commerce/CartItem.ts'],
110
- Customer: ['app/Models/Customer.ts', 'storage/framework/defaults/app/Models/commerce/Customer.ts'],
111
- Product: ['app/Models/Product.ts', 'storage/framework/defaults/app/Models/commerce/Product.ts'],
112
- ProductVariant: ['app/Models/ProductVariant.ts', 'storage/framework/defaults/app/Models/commerce/ProductVariant.ts'],
113
- ProductUnit: ['app/Models/ProductUnit.ts', 'storage/framework/defaults/app/Models/commerce/ProductUnit.ts'],
114
- Manufacturer: ['app/Models/Manufacturer.ts', 'storage/framework/defaults/app/Models/commerce/Manufacturer.ts'],
115
- Coupon: ['app/Models/Coupon.ts', 'storage/framework/defaults/app/Models/commerce/Coupon.ts'],
116
- GiftCard: ['app/Models/GiftCard.ts', 'storage/framework/defaults/app/Models/commerce/GiftCard.ts'],
117
- LicenseKey: ['app/Models/LicenseKey.ts', 'storage/framework/defaults/app/Models/commerce/LicenseKey.ts'],
118
- Review: ['app/Models/Review.ts', 'storage/framework/defaults/app/Models/commerce/Review.ts'],
119
- Receipt: ['app/Models/Receipt.ts', 'storage/framework/defaults/app/Models/commerce/Receipt.ts'],
120
- PrintDevice: ['app/Models/PrintDevice.ts', 'storage/framework/defaults/app/Models/commerce/PrintDevice.ts'],
121
- ShippingMethod: ['app/Models/ShippingMethod.ts', 'storage/framework/defaults/app/Models/commerce/ShippingMethod.ts'],
122
- ShippingRate: ['app/Models/ShippingRate.ts', 'storage/framework/defaults/app/Models/commerce/ShippingRate.ts'],
123
- ShippingZone: ['app/Models/ShippingZone.ts', 'storage/framework/defaults/app/Models/commerce/ShippingZone.ts'],
124
- DeliveryRoute: ['app/Models/DeliveryRoute.ts', 'storage/framework/defaults/app/Models/commerce/DeliveryRoute.ts'],
125
- DigitalDelivery: ['app/Models/DigitalDelivery.ts', 'storage/framework/defaults/app/Models/commerce/DigitalDelivery.ts'],
126
- Courier: ['app/Models/Courier.ts', 'storage/framework/defaults/app/Models/commerce/Courier.ts'],
127
- TaxRate: ['app/Models/TaxRate.ts', 'storage/framework/defaults/app/Models/commerce/TaxRate.ts'],
128
- WaitlistProduct: ['app/Models/WaitlistProduct.ts', 'storage/framework/defaults/app/Models/commerce/WaitlistProduct.ts'],
129
- WaitlistRestaurant: ['app/Models/WaitlistRestaurant.ts', 'storage/framework/defaults/app/Models/commerce/WaitlistRestaurant.ts'],
130
- LoyaltyPoint: ['app/Models/LoyaltyPoint.ts', 'storage/framework/defaults/app/Models/commerce/LoyaltyPoint.ts'],
131
- LoyaltyReward: ['app/Models/LoyaltyReward.ts', 'storage/framework/defaults/app/Models/commerce/LoyaltyReward.ts'],
132
- Payment: ['app/Models/Payment.ts', 'storage/framework/defaults/app/Models/commerce/Payment.ts'],
133
- PaymentMethod: ['app/Models/PaymentMethod.ts', 'storage/framework/defaults/app/Models/PaymentMethod.ts'],
134
- PaymentProduct: ['app/Models/PaymentProduct.ts', 'storage/framework/defaults/app/Models/PaymentProduct.ts'],
135
- PaymentTransaction: ['app/Models/PaymentTransaction.ts', 'storage/framework/defaults/app/Models/PaymentTransaction.ts'],
136
- Transaction: ['app/Models/Transaction.ts', 'storage/framework/defaults/app/Models/commerce/Transaction.ts'],
93
+ Order: ['app/Models/Order.ts', 'app/Models/commerce/Order.ts'],
94
+ OrderItem: ['app/Models/OrderItem.ts', 'app/Models/commerce/OrderItem.ts'],
95
+ Cart: ['app/Models/Cart.ts', 'app/Models/commerce/Cart.ts'],
96
+ CartItem: ['app/Models/CartItem.ts', 'app/Models/commerce/CartItem.ts'],
97
+ Customer: ['app/Models/Customer.ts', 'app/Models/commerce/Customer.ts'],
98
+ Product: ['app/Models/Product.ts', 'app/Models/commerce/Product.ts'],
99
+ ProductVariant: ['app/Models/ProductVariant.ts', 'app/Models/commerce/ProductVariant.ts'],
100
+ ProductUnit: ['app/Models/ProductUnit.ts', 'app/Models/commerce/ProductUnit.ts'],
101
+ Manufacturer: ['app/Models/Manufacturer.ts', 'app/Models/commerce/Manufacturer.ts'],
102
+ Coupon: ['app/Models/Coupon.ts', 'app/Models/commerce/Coupon.ts'],
103
+ GiftCard: ['app/Models/GiftCard.ts', 'app/Models/commerce/GiftCard.ts'],
104
+ LicenseKey: ['app/Models/LicenseKey.ts', 'app/Models/commerce/LicenseKey.ts'],
105
+ Review: ['app/Models/Review.ts', 'app/Models/commerce/Review.ts'],
106
+ Receipt: ['app/Models/Receipt.ts', 'app/Models/commerce/Receipt.ts'],
107
+ PrintDevice: ['app/Models/PrintDevice.ts', 'app/Models/commerce/PrintDevice.ts'],
108
+ ShippingMethod: ['app/Models/ShippingMethod.ts', 'app/Models/commerce/ShippingMethod.ts'],
109
+ ShippingRate: ['app/Models/ShippingRate.ts', 'app/Models/commerce/ShippingRate.ts'],
110
+ ShippingZone: ['app/Models/ShippingZone.ts', 'app/Models/commerce/ShippingZone.ts'],
111
+ DeliveryRoute: ['app/Models/DeliveryRoute.ts', 'app/Models/commerce/DeliveryRoute.ts'],
112
+ DigitalDelivery: ['app/Models/DigitalDelivery.ts', 'app/Models/commerce/DigitalDelivery.ts'],
113
+ Courier: ['app/Models/Courier.ts', 'app/Models/commerce/Courier.ts'],
114
+ TaxRate: ['app/Models/TaxRate.ts', 'app/Models/commerce/TaxRate.ts'],
115
+ WaitlistProduct: ['app/Models/WaitlistProduct.ts', 'app/Models/commerce/WaitlistProduct.ts'],
116
+ WaitlistRestaurant: ['app/Models/WaitlistRestaurant.ts', 'app/Models/commerce/WaitlistRestaurant.ts'],
117
+ LoyaltyPoint: ['app/Models/LoyaltyPoint.ts', 'app/Models/commerce/LoyaltyPoint.ts'],
118
+ LoyaltyReward: ['app/Models/LoyaltyReward.ts', 'app/Models/commerce/LoyaltyReward.ts'],
119
+ Payment: ['app/Models/Payment.ts', 'app/Models/commerce/Payment.ts'],
120
+ PaymentMethod: ['app/Models/PaymentMethod.ts', 'app/Models/PaymentMethod.ts'],
121
+ PaymentProduct: ['app/Models/PaymentProduct.ts', 'app/Models/PaymentProduct.ts'],
122
+ PaymentTransaction: ['app/Models/PaymentTransaction.ts', 'app/Models/PaymentTransaction.ts'],
123
+ Transaction: ['app/Models/Transaction.ts', 'app/Models/commerce/Transaction.ts'],
137
124
  }
138
125
 
139
126
  const modelCache = new Map<string, any>()
@@ -153,7 +140,7 @@ async function discoverModelPaths(): Promise<Map<string, string[]>> {
153
140
  const paths = new Map<string, string[]>()
154
141
  const modelRoots = [
155
142
  resolve(root, 'app/Models'),
156
- resolve(defaultsRoot(), 'app/Models'),
143
+ defaultsPath('app/Models'),
157
144
  ]
158
145
 
159
146
  for (const modelsRoot of modelRoots) {
@@ -178,11 +165,11 @@ async function discoverModelPaths(): Promise<Map<string, string[]>> {
178
165
  }
179
166
 
180
167
  async function modelCandidatePaths(name: string): Promise<string[]> {
181
- const root = projectRoot()
182
168
  const discovered = (await discoverModelPaths()).get(name) ?? []
183
- const explicit = (MODEL_PATHS[name] ?? []).map(path => path.startsWith(VENDORED_DEFAULTS_PREFIX)
184
- ? resolve(defaultsRoot(), path.slice(VENDORED_DEFAULTS_PREFIX.length))
185
- : resolve(root, path))
169
+ const entry = MODEL_PATHS[name]
170
+ const explicit = entry
171
+ ? [resolve(projectRoot(), entry[0]), defaultsPath(entry[1])]
172
+ : []
186
173
  return [...new Set([...discovered, ...explicit])]
187
174
  }
188
175
 
@@ -111,15 +111,41 @@ interface NavItem {
111
111
  }
112
112
 
113
113
  /**
114
- * Pull the discovered-models manifest `buddy dev:dashboard` writes into the
115
- * project's runtime state.
116
- * Returns the default empty payload when the file is absent (fresh project
114
+ * Where `buddy dev --dashboard` writes the discovered-models manifest, and
115
+ * where this reads it: under `storage/framework/runtime/`, which `.gitignore`
116
+ * covers.
117
+ */
118
+ export const DISCOVERED_MANIFEST_PATH = 'storage/framework/runtime/dashboard/.discovered-models.json'
119
+
120
+ /**
121
+ * Where it used to be written, inside the vendored framework tree.
122
+ *
123
+ * Read as a fallback rather than dropped, because an app that upgrades does
124
+ * not get a new manifest until its next `buddy dev --dashboard` - and without
125
+ * this it would render an empty sidebar until then. New writes only ever go
126
+ * to the path above.
127
+ */
128
+ export const LEGACY_DISCOVERED_MANIFEST_PATH = 'storage/framework/defaults/views/dashboard/.discovered-models.json'
129
+
130
+ /** The first of the two manifest paths that exists, or null when neither does. */
131
+ function discoveredManifestPath(cwd: string): string | null {
132
+ for (const rel of [DISCOVERED_MANIFEST_PATH, LEGACY_DISCOVERED_MANIFEST_PATH]) {
133
+ const candidate = resolve(cwd, rel)
134
+ if (existsSync(candidate))
135
+ return candidate
136
+ }
137
+ return null
138
+ }
139
+
140
+ /**
141
+ * Pull the discovered-models manifest written by the dashboard dev server.
142
+ * Returns the default empty payload when neither path has one (fresh project
117
143
  * before the first dashboard run regenerates it).
118
144
  */
119
145
  export function loadDiscoveredManifest(
120
- manifestPath = resolve(process.cwd(), 'storage/framework/runtime/dashboard/discovered-models.json'),
146
+ manifestPath = discoveredManifestPath(process.cwd()),
121
147
  ): DiscoveredManifest {
122
- if (!existsSync(manifestPath))
148
+ if (manifestPath === null || !existsSync(manifestPath))
123
149
  return { models: [], sections: defaultToggles(), nav: [] }
124
150
 
125
151
  try {