@stacksjs/defaults 0.75.560 → 0.75.562
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-desktop/SKILL.md +27 -2
- package/ai/skills/stacks-native/CATALOG.md +6 -6
- package/ai/skills/stacks-orm/SKILL.md +40 -2
- package/ai/skills/stacks-repl/SKILL.md +6 -4
- package/app/Actions/Dashboard/DashboardStatsAction.ts +1 -1
- package/app/Actions/Dashboard/Kanban/kanban-model.ts +2 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +3 -3
|
@@ -438,6 +438,8 @@ buddy dev:desktop # run from source, stx views
|
|
|
438
438
|
buddy build:desktop # this machine's target
|
|
439
439
|
buddy build:desktop --target linux-x64,win32-x64 # cross-compile the agents
|
|
440
440
|
buddy build:desktop --target all --package # also make the installers this OS can make
|
|
441
|
+
buddy build:desktop --identity "Developer ID Application: Example (ABCDE12345)" # macOS: sign with this certificate
|
|
442
|
+
buddy build:desktop --import ./ci-output # add targets built on another machine to this build
|
|
441
443
|
```
|
|
442
444
|
|
|
443
445
|
Output goes to `storage/framework/desktop/webview/<target>/`, with `build.json` listing every artifact.
|
|
@@ -458,7 +460,8 @@ machine's target; else the build fetches it. Craft publishes `craft-<os>-<arch>.
|
|
|
458
460
|
`build:desktop --target ...` downloads the one for the installed `craft-native` version, checks its size and SHA-256
|
|
459
461
|
against that release's `release-manifest.json`, and keeps it unpacked in `storage/framework/desktop/runtimes/<target>/`
|
|
460
462
|
(gitignored; a later build reuses it and a new Craft version replaces it). An app needs no script of its own for
|
|
461
|
-
this. Craft
|
|
463
|
+
this. A machine with no Craft of its own (a CI runner with no `CRAFT_BIN` and no `craft` on PATH) fetches its own
|
|
464
|
+
target's runtime the same way. Craft publishes runtimes for `darwin-arm64`, `darwin-x64`, `linux-x64` and `win32-x64`; the arm64 Linux and
|
|
462
465
|
Windows targets still need a runtime named in the config. `DESKTOP_RUNTIME_FETCH=0` keeps a build off the network.
|
|
463
466
|
|
|
464
467
|
On Windows, `WebView2Loader.dll` is copied into the app from beside the runtime (Craft's archive ships it there)
|
|
@@ -493,11 +496,33 @@ serves. Then per target:
|
|
|
493
496
|
|
|
494
497
|
Artifacts and manifests go through `@stacksjs/storage` to `updates.disk` under `updates.prefix`
|
|
495
498
|
(`desktop-updates/<channel>/<platform>-<arch>/latest.json`, artifacts under `<version>/`), plus a `release.json`
|
|
496
|
-
a download page can read.
|
|
499
|
+
a download page can read. Each target in it has `update` (what an installed app updates from) and `downloads` (what a
|
|
500
|
+
person takes, the usual choice first: the DMG on macOS, the MSI on Windows, the AppImage and then the deb and rpm on
|
|
501
|
+
Linux), every entry with `name`, `format` (`dmg`, `msi`, `appimage`, `deb`, `rpm`, `zip`), `url`, `sha256` and `bytes`,
|
|
502
|
+
so a download page needs no rules of its own. A release is often made in several runs, the Mac from a Mac and then
|
|
497
503
|
`release:desktop --target linux-x64 --skip-build` for installers built elsewhere: a run for the same version and
|
|
498
504
|
channel adds its targets to `release.json` and replaces only the ones it published again. A new version starts a
|
|
499
505
|
new record.
|
|
500
506
|
|
|
507
|
+
**Targets built on another machine.** `build.json` in the output folder records every target and the SHA-256 of each
|
|
508
|
+
file, and a release publishes from it. To bring in what CI built, carry its output folder (the target folders and its
|
|
509
|
+
`build.json`) to the machine that releases and run `buddy build:desktop --import <folder>` (`--target` narrows it, and
|
|
510
|
+
a single target's folder works too). The import refuses a build of another app, version or commit (it must be the
|
|
511
|
+
commit this checkout is at) and any file that does not match its recorded hash, then copies the folders in and adds
|
|
512
|
+
the targets to the local record beside what was built here. An installer found under a target's `packages/` that the
|
|
513
|
+
record does not list (an MSI made by Craft's `packageApp` on its own) is recorded as found, with a warning that
|
|
514
|
+
there was nothing to check it against. With `--package`, an imported target for this operating system that has no
|
|
515
|
+
installer yet gets one made here: on a Windows runner, `buddy build:desktop --import <folder> --package` turns a
|
|
516
|
+
folder cross-compiled on Linux into a recorded MSI. Then `release:desktop --skip-build` publishes them. A build also
|
|
517
|
+
keeps the record's other targets when they are from the same version and commit.
|
|
518
|
+
|
|
519
|
+
**The identity a Mac build is signed with.** `build:desktop` signs with `--identity` or `DESKTOP_SIGNING_IDENTITY`
|
|
520
|
+
when one is given. Without one it uses the first Apple Development certificate it finds (which keeps Keychain items
|
|
521
|
+
trusted across rebuilds), else signs ad hoc, and says so in its output: neither can be notarized.
|
|
522
|
+
`release:desktop --identity` signs the bundle again with the identity it was given when the bundle is not already
|
|
523
|
+
signed with a Developer ID, hardened runtime and timestamp, so `--skip-build` works on a development build. It
|
|
524
|
+
refuses, before notarizing, when that identity is not a Developer ID Application certificate.
|
|
525
|
+
|
|
501
526
|
The server side is one default action, `Actions/Desktop/UpdateFeedAction`, mounted at
|
|
502
527
|
`/api/updates/{platform}/{arch}` whenever `webview.updates` is configured. It serves the stored manifest as is
|
|
503
528
|
(204 when `?current=` is already that version, 404 when nothing was published). Override the action in
|
|
@@ -39,7 +39,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
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) | 3 |
|
|
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
|
-
| `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) |
|
|
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) | 22 |
|
|
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
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 |
|
|
@@ -66,7 +66,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
66
66
|
| `@stacksjs/newsletter` | [`stacks-newsletter`](../stacks-newsletter/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/index.ts) | 10 |
|
|
67
67
|
| `@stacksjs/notifications` | [`stacks-notifications`](../stacks-notifications/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/index.ts) | 18 |
|
|
68
68
|
| `@stacksjs/objects` | [`stacks-objects`](../stacks-objects/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/objects/src/index.ts) | 10 |
|
|
69
|
-
| `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) |
|
|
69
|
+
| `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) | 78 |
|
|
70
70
|
| `@stacksjs/pagination` | [`stacks-pagination`](../stacks-pagination/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/pagination/src/index.ts) | 1 |
|
|
71
71
|
| `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 13 |
|
|
72
72
|
| `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 39 |
|
|
@@ -392,9 +392,9 @@ Guidance: [`stacks-desktop`](../stacks-desktop/SKILL.md). Source: [storage/frame
|
|
|
392
392
|
|
|
393
393
|
Declared runtime exports: `BUN_EXECUTABLE_MARKER`, `RESERVED_PLIST_KEYS`, `USERLAND_LAUNCHER`, `bundleDirectoryFor`, `codesignArgs`, `craftDevCommand`, `createUpdateManifestUrl`, `describeRuntimeDuplication`, `desktopAppVersion`, `desktopLauncherCompileArgs`, `developerIdProblem`, `dmgVolumeName`, `hasUserlandDesktopLauncher`, `isMachO`, `looksLikeBunExecutable`, `notarizationOutcome`, `notarytoolAuthArgs`, `openDevWindow`, `plistValue`, `renderInfoPlist`, `renderUserlandPlistEntries`, `resolveCraftBinary`, `resolveCraftExecutable`, `resolveDesktopLauncher`, `resolveDevWindowUrl`, `resolveDmgPackaging`, `xmlEscape`.
|
|
394
394
|
|
|
395
|
-
Local source modules: [src/agent-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent-launcher.ts), [src/agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent.ts), [src/craft-runtime.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/craft-runtime.ts), [src/invites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/invites.ts), [src/macos-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-app.ts), [src/macos-bundle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-bundle.ts), [src/support.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/support.ts), [src/update-feed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-feed.ts), [src/update-install.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-install.ts), [src/update-signing.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-signing.ts), [src/updater.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/updater.ts), [src/webview-agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-agent.ts), [src/webview-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-app.ts), [src/webview-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-launcher.ts).
|
|
395
|
+
Local source modules: [src/agent-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent-launcher.ts), [src/agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent.ts), [src/craft-runtime.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/craft-runtime.ts), [src/invites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/invites.ts), [src/macos-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-app.ts), [src/macos-bundle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-bundle.ts), [src/support.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/support.ts), [src/update-feed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-feed.ts), [src/update-install.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-install.ts), [src/update-signing.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-signing.ts), [src/updater.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/updater.ts), [src/webview-agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-agent.ts), [src/webview-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-app.ts), [src/webview-build-record.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-build-record.ts), [src/webview-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-launcher.ts).
|
|
396
396
|
|
|
397
|
-
Evidence directory: [
|
|
397
|
+
Evidence directory: [22 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
398
398
|
|
|
399
399
|
### @stacksjs/development
|
|
400
400
|
|
|
@@ -648,11 +648,11 @@ Evidence directory: [10 retained tests](https://github.com/stacksjs/stacks/blob/
|
|
|
648
648
|
|
|
649
649
|
Guidance: [`stacks-orm`](../stacks-orm/SKILL.md). Source: [storage/framework/core/orm/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts).
|
|
650
650
|
|
|
651
|
-
Declared runtime exports: `Activity`, `AnalyticsEvent`, `Auction`, `AuctionItem`, `Author`, `Automation`, `AutomationRun`, `BILLABLE_INSTANCE_METHODS`, `Bid`, `Board`, `BoardColumn`, `Campaign`, `CampaignSend`, `CampaignVariant`, `Card`, `CardAttachment`, `CardComment`, `Cart`, `CartItem`, `Categorizable`, `Category`, `Comment`, `CommunicationSuppression`, `ConsentEvent`, `Coupon`, `Courier`, `CourierPing`, `Customer`, `DeliveryRoute`, `DeliveryStop`, `Deployment`, `DigitalDelivery`, `EmailIdempotency`, `EmailList`, `EmailListSubscriber`, `EmailSuppression`, `EmailWebhookEvent`, `ErrorModel`, `FailedJob`, `FeedbackToken`, `Form`, `FormField`, `FormSubmission`, `GdprRequest`, `GiftCard`, `Job`, `Label`, `LicenseActivation`, `LicenseKey`, `LicenseSeat`, `Log`, `LoyaltyPoint`, `LoyaltyReward`, `MagicLinkToken`, `MailPreference`, `Manufacturer`, `Menu`, `MenuItem`, `ModelUnavailableError`, `Notification`, `NotificationDelivery`, `Order`, `OrderIdempotency`, `OrderItem`, `Page`, `PageRevision`, `Payment`, `PaymentMethod`, `PaymentProduct`, `PaymentTransaction`, `PaymentWebhookEvent`, `PersonalAccessToken`, `Pledge`, `Post`, `PrintDevice`, `Product`, `ProductUnit`, `ProductVariant`, `QueryLog`, `QueueWorker`, `Receipt`, `Redirect`, `Referral`, `ReferralCode`, `Release`, `Request`, `Review`, `SenderDomain`, `ShippingMethod`, `ShippingRate`, `ShippingZone`, `Site`, `SiteDomain`, `SmsOptOut`, `SocialAccount`, `SocialPost`, `StorageItem`, `StorageItemTask`, `Subscriber`, `SubscriberEmail`, `Subscription`, `SubscriptionNotOwnedError`, `Tag`, `TaxRate`, `Team`, `TeamInvitation`, `TeamMember`, `Transaction`, `UsageEvent`, `User`, `WaitlistProduct`, `WaitlistRestaurant`, `Websocket`, `buildDatabaseSchema`, `collectEncryptedAttributes`, `createAuditMethods`, `createCategorizableMethods`, `createCommentableMethods`, `createLikeableMethods`, `createTaggableMethods`, `customerOwnership`, `decryptValue`, `encryptValue`, `enrichPaginatorUrls`, `filterFillable`, `frameworkModelFeature`, `getWritableFields`, `isBillable`, `isCursorPaginator`, `isEncrypted`, `isPaginator`, `isSimplePaginator`, `isUniqueViolation`, `mapWriteError`, `modelGlobalNames`, `ormReady`, `parentOwnership`, `parseCursor`, `renderDatabaseTypeFile`, `resolveCursorArgs`, `resolvePageArgs`, `selfOwnership`, `setAuditUser`, `siteOwnership`, `teamMembershipOwnership`, `toCursorPaginator`, `toPaginator`, `toSimplePaginator`, `toSnakeCaseKeys`.
|
|
651
|
+
Declared runtime exports: `Activity`, `AnalyticsEvent`, `Auction`, `AuctionItem`, `Author`, `Automation`, `AutomationRun`, `BILLABLE_INSTANCE_METHODS`, `Bid`, `Board`, `BoardColumn`, `Campaign`, `CampaignSend`, `CampaignVariant`, `Card`, `CardAttachment`, `CardComment`, `Cart`, `CartItem`, `Categorizable`, `Category`, `Comment`, `CommunicationSuppression`, `ConsentEvent`, `Coupon`, `Courier`, `CourierPing`, `Customer`, `DeliveryRoute`, `DeliveryStop`, `Deployment`, `DigitalDelivery`, `EmailIdempotency`, `EmailList`, `EmailListSubscriber`, `EmailSuppression`, `EmailWebhookEvent`, `ErrorModel`, `FailedJob`, `FeedbackToken`, `Form`, `FormField`, `FormSubmission`, `GdprRequest`, `GiftCard`, `Job`, `Label`, `LicenseActivation`, `LicenseKey`, `LicenseSeat`, `Log`, `LoyaltyPoint`, `LoyaltyReward`, `MagicLinkToken`, `MailPreference`, `Manufacturer`, `Menu`, `MenuItem`, `ModelUnavailableError`, `Notification`, `NotificationDelivery`, `Order`, `OrderIdempotency`, `OrderItem`, `Page`, `PageRevision`, `Payment`, `PaymentMethod`, `PaymentProduct`, `PaymentTransaction`, `PaymentWebhookEvent`, `PersonalAccessToken`, `Pledge`, `Post`, `PrintDevice`, `Product`, `ProductUnit`, `ProductVariant`, `QueryLog`, `QueueWorker`, `Receipt`, `Redirect`, `Referral`, `ReferralCode`, `Release`, `Request`, `Review`, `SenderDomain`, `ShippingMethod`, `ShippingRate`, `ShippingZone`, `Site`, `SiteDomain`, `SmsOptOut`, `SocialAccount`, `SocialPost`, `StorageItem`, `StorageItemTask`, `Subscriber`, `SubscriberEmail`, `Subscription`, `SubscriptionNotOwnedError`, `Tag`, `TaxRate`, `Team`, `TeamInvitation`, `TeamMember`, `Transaction`, `UsageEvent`, `User`, `WaitlistProduct`, `WaitlistRestaurant`, `Websocket`, `buildDatabaseSchema`, `collectEncryptedAttributes`, `createAuditMethods`, `createCategorizableMethods`, `createCommentableMethods`, `createLikeableMethods`, `createTaggableMethods`, `customerOwnership`, `decryptValue`, `decryptValueInPlace`, `encryptValue`, `enrichPaginatorUrls`, `filterFillable`, `frameworkModelFeature`, `getWritableFields`, `isBillable`, `isCursorPaginator`, `isEncrypted`, `isPaginator`, `isSimplePaginator`, `isUniqueViolation`, `mapWriteError`, `modelGlobalNames`, `ormReady`, `parentOwnership`, `parseCursor`, `renderDatabaseTypeFile`, `resolveCursorArgs`, `resolvePageArgs`, `selfOwnership`, `setAuditUser`, `siteOwnership`, `teamMembershipOwnership`, `toCursorPaginator`, `toPaginator`, `toSimplePaginator`, `toSnakeCaseKeys`.
|
|
652
652
|
|
|
653
653
|
Local source modules: [src/auto-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/auto-crud.ts), [src/batch-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/batch-loader.ts), [src/db.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/db.ts), [src/define-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/define-model.ts), [src/extend-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/extend-model.ts), [src/gdpr/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/gdpr/index.ts), [src/generate-database-schema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/generate-database-schema.ts), [src/locked-row.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/locked-row.ts), [src/messaging.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/messaging.ts), [src/model-types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/model-types.ts), [src/ownership.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/ownership.ts), [src/paginator-request.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/paginator-request.ts), [src/row-token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/row-token.ts), [src/subquery.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/subquery.ts), [src/traits/audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/audit.ts), [src/traits/billable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/billable.ts), [src/traits/categorizable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/categorizable.ts), [src/traits/commentable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/commentable.ts), [src/traits/likeable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/likeable.ts), [src/traits/taggable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/taggable.ts), [src/transaction.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/transaction.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/types.ts), [src/utils/encrypted.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/encrypted.ts), [src/utils/prunable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/prunable.ts).
|
|
654
654
|
|
|
655
|
-
Evidence directory: [
|
|
655
|
+
Evidence directory: [78 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
656
656
|
|
|
657
657
|
### @stacksjs/pagination
|
|
658
658
|
|
|
@@ -25,8 +25,8 @@ import type { ModelRow, ModelCreateData } from '@stacksjs/orm'
|
|
|
25
25
|
type WorkItemRow = ModelRow<typeof WorkItem>
|
|
26
26
|
type NewWorkItem = ModelCreateData<typeof WorkItem>
|
|
27
27
|
|
|
28
|
-
const item =
|
|
29
|
-
const open =
|
|
28
|
+
const item = WorkItem.find(id)
|
|
29
|
+
const open = WorkItem.where('done', false).orderBy('id', 'desc').get()
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
`find` can return no row; `findOrFail` throws `ModelNotFoundError`. Do not invent
|
|
@@ -34,6 +34,44 @@ const open = await WorkItem.where('done', false).orderBy('id', 'desc').get()
|
|
|
34
34
|
load lazily; server boot waits for model initialization. A feature-disabled
|
|
35
35
|
model is not made usable merely by an ambient declaration.
|
|
36
36
|
|
|
37
|
+
## Reads answer in place, writes are promises
|
|
38
|
+
|
|
39
|
+
A model read returns its value where it is written, on SQLite, MySQL and
|
|
40
|
+
Postgres:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const user = User.where('email', 'like', '%@example.com').orderByDesc('created_at').first()
|
|
44
|
+
user?.email // the row is already here
|
|
45
|
+
|
|
46
|
+
const total = User.count()
|
|
47
|
+
if (User.where('email', email).exists()) return response.badRequest('Taken')
|
|
48
|
+
for (const post of Post.where('published', true).get()) titles.push(post.title)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- **Which calls:** every read. `find`, `findOrFail`, `findMany`, `first`,
|
|
52
|
+
`firstOrFail`, `last`, `all`, `get`, `count`, `exists`, `pluck`, `sum`,
|
|
53
|
+
`avg`, `min`, `max`, `paginate`, `simplePaginate`, `cursorPaginate`, eager
|
|
54
|
+
loading through `with()`, and reads of encrypted attributes.
|
|
55
|
+
- **`await` still works.** `await` on a value is that value, so existing code
|
|
56
|
+
and code written by habit run unchanged. The types say the same: a read is
|
|
57
|
+
typed as the row, not as a promise of it.
|
|
58
|
+
- **A failure is thrown where the call stands.** `findOrFail` on a missing
|
|
59
|
+
row throws; wrap it in `try`/`catch`. `.catch()` and `.then()` do not exist
|
|
60
|
+
on a row. In a test, `expect(() => User.findOrFail(0)).toThrow()`, not
|
|
61
|
+
`await expect(...).rejects`.
|
|
62
|
+
- **A write is a promise, on every model.** `create`, `createMany`,
|
|
63
|
+
`firstOrCreate`, `updateOrCreate`, `update`, `save`, `delete`, `forceDelete`
|
|
64
|
+
and a query's `delete()` run setters, validation, encryption and lifecycle
|
|
65
|
+
events, any of which may wait. Keep their `await`.
|
|
66
|
+
- **How.** SQLite runs a query in place. MySQL and Postgres run on Bun's
|
|
67
|
+
driver, held by a worker thread the caller waits on, so nothing else runs on
|
|
68
|
+
the calling thread while a query is in flight (the cost `bun:sqlite` always
|
|
69
|
+
had). `models: { execution: 'async' }` in the query-builder config makes
|
|
70
|
+
MySQL and Postgres reads promises again for an app that needs the event loop
|
|
71
|
+
free during queries; every read then has to be awaited.
|
|
72
|
+
- **Not covered.** The `db` query builder (`db.selectFrom(...)`) and
|
|
73
|
+
`transaction()` still return promises.
|
|
74
|
+
|
|
37
75
|
## Write behavior
|
|
38
76
|
|
|
39
77
|
Ordinary create/update paths apply mass-assignment rules, declared validation,
|
|
@@ -107,10 +107,12 @@ if (User.where('active', true).exists()) dump(User.count())
|
|
|
107
107
|
for (const post of Post.latest().limit(5).get()) dump(post.title)
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
A model read is a value everywhere, in app code as well as here (see
|
|
111
|
+
`stacks-orm`). What a session adds is the rest: outside a function, a call
|
|
112
|
+
that returns a promise is waited for where it stands, and so is a promise a
|
|
113
|
+
statement names (the value of a line, of a declaration, of an assignment). So
|
|
114
|
+
a write (`User.create(...)`), a `fetch` or a job dispatch reads the same way a
|
|
115
|
+
query does. A rejection is thrown there.
|
|
114
116
|
|
|
115
117
|
- **Inside a function nothing changes.** `await` there is yours to write:
|
|
116
118
|
`users.map(async user => await user.posts())`.
|
|
@@ -3,7 +3,8 @@ import type { ReadableRecord } from '@stacksjs/orm'
|
|
|
3
3
|
export type KanbanModelRecord = ReadableRecord
|
|
4
4
|
|
|
5
5
|
export interface RefreshableKanbanModelRecord extends KanbanModelRecord {
|
|
6
|
-
|
|
6
|
+
/** A read answers in place; a caller's own record type may still hand back a promise. */
|
|
7
|
+
fresh: () => KanbanModelRecord | null | Promise<KanbanModelRecord | null>
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export async function refreshModel(record: RefreshableKanbanModelRecord): Promise<KanbanModelRecord> {
|
package/ide/vscode/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"publisher": "Stacks",
|
|
3
3
|
"name": "vscode-stacks",
|
|
4
4
|
"displayName": "Stacks",
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.562",
|
|
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.
|
|
5
|
+
"version": "0.75.562",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@iconify-json/f7": "^1.2.2",
|
|
47
47
|
"@iconify-json/hugeicons": "^1.2.35",
|
|
48
|
-
"@stacksjs/mobile": "0.75.
|
|
48
|
+
"@stacksjs/mobile": "0.75.562",
|
|
49
49
|
"@stacksjs/sanitizer": "^0.2.864",
|
|
50
50
|
"@stacksjs/stx": "^0.2.864",
|
|
51
|
-
"@stacksjs/strings": "0.75.
|
|
51
|
+
"@stacksjs/strings": "0.75.562",
|
|
52
52
|
"@xterm/addon-fit": "^0.11.0",
|
|
53
53
|
"@xterm/xterm": "^6.0.0",
|
|
54
54
|
"ts-qr-codes": "^0.1.8"
|