@everystack/server 0.4.40 → 0.4.41
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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/destroy.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `@everystack/server` are documented here.
|
|
|
4
4
|
|
|
5
5
|
Format based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
6
|
|
|
7
|
+
## [0.4.41] - 2026-10-31
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- destroyExpired links a module's raw models itself
|
|
12
|
+
|
|
7
13
|
## [0.4.40] - 2026-10-30
|
|
8
14
|
|
|
9
15
|
### BREAKING CHANGES
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everystack/server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.41",
|
|
4
4
|
"description": "Server runtime primitives for Lambda — event adapters, routing, SSR, image processing",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": "Scalable Technology, Inc. <licensing@scalable.technology>",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"ts-jest": "29.4.9",
|
|
209
209
|
"typescript": "5.9.3",
|
|
210
210
|
"@everystack/auth": "0.4.10",
|
|
211
|
-
"@everystack/cli": "0.4.
|
|
211
|
+
"@everystack/cli": "0.4.105"
|
|
212
212
|
},
|
|
213
213
|
"dependencies": {
|
|
214
214
|
"@everystack/model": "0.4.25"
|
package/src/destroy.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Generated SQL owns removal; this module brackets it with root hooks. */
|
|
2
2
|
import { sql, type SQL } from 'drizzle-orm';
|
|
3
|
-
import { isVeto, lifecycleDestroyOrder, pgType, type DestroyContext, type ModelDescriptor } from '@everystack/model';
|
|
3
|
+
import { isVeto, lifecycleDestroyOrder, linkModels, pgType, type DestroyContext, type ModelDescriptor } from '@everystack/model';
|
|
4
4
|
import type { SessionCapableDb, SessionTx } from './db-session';
|
|
5
5
|
|
|
6
6
|
type Row = Record<string, unknown>;
|
|
@@ -127,6 +127,7 @@ const context = (row: Row): DestroyContext => Object.freeze({
|
|
|
127
127
|
* commit fails. afterDestroy runs after commit, best-effort: a crash can lose it.
|
|
128
128
|
* `role`: every transaction opens with SET LOCAL ROLE, so a least-privilege login (NOINHERIT,
|
|
129
129
|
* granted the app roles) runs it as a role that manages the tables. Never everystack_lifecycle.
|
|
130
|
+
* `models` may be a module's raw array: it is linked here (linkModels) before the destroy order is read.
|
|
130
131
|
*/
|
|
131
132
|
export async function destroyExpired(
|
|
132
133
|
db: SessionCapableDb,
|
|
@@ -149,7 +150,8 @@ export async function destroyExpired(
|
|
|
149
150
|
for (const [name, value] of [['batch', batch], ['statementTimeoutMs', timeout]] as const) {
|
|
150
151
|
if (!Number.isInteger(value) || value <= 0 || value > 2147483647) throw new Error(`${name} must be a positive PostgreSQL integer`);
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
// A module's raw models still hold name references; linking an already linked set is a no-op.
|
|
154
|
+
const order = lifecycleDestroyOrder(linkModels(models));
|
|
153
155
|
const byName = new Map(models.map(m => [m.schema === 'public' ? m.table : label(m), m]));
|
|
154
156
|
const result: DestroyResult = { perTable: {}, order };
|
|
155
157
|
const report = async (fault: DestroyFault): Promise<void> => {
|