@everystack/server 0.4.18 → 0.4.20
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/package.json +3 -3
- package/src/image.ts +9 -0
- package/src/plugin.ts +34 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everystack/server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
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>",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"sst": "4.13.1",
|
|
164
164
|
"ts-jest": "29.4.9",
|
|
165
165
|
"typescript": "5.9.3",
|
|
166
|
-
"@everystack/
|
|
167
|
-
"@everystack/
|
|
166
|
+
"@everystack/auth": "0.4.3",
|
|
167
|
+
"@everystack/cli": "0.4.57"
|
|
168
168
|
},
|
|
169
169
|
"scripts": {
|
|
170
170
|
"test": "jest",
|
package/src/image.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/// <reference path="./heic-decode.d.ts" />
|
|
2
|
+
// `heic-decode` ships no types, so this file needs the ambient shim NEXT TO IT — not merely
|
|
3
|
+
// present in the package. ts-jest compiles per file, and an ambient .d.ts nothing imports
|
|
4
|
+
// enters the program only via `include`/`files`, which this package's own tsconfig supplies
|
|
5
|
+
// and a CONSUMER's does not. So the shim covered `packages/server`'s suite and no one else:
|
|
6
|
+
// the example app type-checked this same source and failed on TS7016. The reference directive
|
|
7
|
+
// binds the declaration to the source that needs it, so every program compiling image.ts gets
|
|
8
|
+
// it. (Inert at runtime — erased with the types.)
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
11
|
* @everystack/server/image — On-demand image processing Lambda.
|
|
3
12
|
*
|
package/src/plugin.ts
CHANGED
|
@@ -481,6 +481,24 @@ export interface DbPluginOptions {
|
|
|
481
481
|
connectionInfo?: () => Promise<Record<string, string>>;
|
|
482
482
|
/** Enable console action (default: true) */
|
|
483
483
|
allowConsole?: boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Enable the `seed` action. Default FALSE.
|
|
486
|
+
*
|
|
487
|
+
* Previously gated on `ctx.environment !== 'dev'` — i.e. on the stage being NAMED `dev`.
|
|
488
|
+
* `ENVIRONMENT` comes from `$app.stage`, so that refused a genuine dev stage called
|
|
489
|
+
* `development` and allowed a shared pre-prod someone happened to call `dev`. Declare the
|
|
490
|
+
* intent instead of naming a stage into it.
|
|
491
|
+
*/
|
|
492
|
+
allowSeed?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Enable the `db:reset` action, which runs `DROP SCHEMA ... CASCADE` on every schema in
|
|
495
|
+
* `schemas` and replays migrations. Default FALSE. **There is no undo.**
|
|
496
|
+
*
|
|
497
|
+
* Same history as `allowSeed`, higher stakes: a stage name decided whether a destructive verb
|
|
498
|
+
* was reachable. IAM already controls who may invoke the action at all; this controls whether
|
|
499
|
+
* the deployment offers it in the first place.
|
|
500
|
+
*/
|
|
501
|
+
allowReset?: boolean;
|
|
484
502
|
/** Optional read-replica URL for db:query. When unset, db:query runs on the operator
|
|
485
503
|
* connection. (No env fallback — pass it explicitly if you have a replica.) */
|
|
486
504
|
readDatabaseUrl?: string;
|
|
@@ -581,17 +599,28 @@ export function dbPlugin(options: DbPluginOptions): Plugin {
|
|
|
581
599
|
if (options.seed) {
|
|
582
600
|
const seedFn = options.seed;
|
|
583
601
|
actions.seed = async (_payload, ctx) => {
|
|
584
|
-
if (
|
|
585
|
-
return {
|
|
602
|
+
if (!options.allowSeed) {
|
|
603
|
+
return {
|
|
604
|
+
error:
|
|
605
|
+
'seed is not enabled on this deployment. Pass `allowSeed: true` to dbPlugin for the '
|
|
606
|
+
+ 'stages where seeding is intended. (This was previously allowed whenever the stage '
|
|
607
|
+
+ 'was NAMED "dev", which is a deployment label, not a decision.)',
|
|
608
|
+
};
|
|
586
609
|
}
|
|
587
610
|
return await seedFn(opsDb, ctx.schema);
|
|
588
611
|
};
|
|
589
612
|
}
|
|
590
613
|
|
|
591
614
|
// --- db:reset ---
|
|
592
|
-
actions['db:reset'] = async (_payload,
|
|
593
|
-
if (
|
|
594
|
-
return {
|
|
615
|
+
actions['db:reset'] = async (_payload, _ctx) => {
|
|
616
|
+
if (!options.allowReset) {
|
|
617
|
+
return {
|
|
618
|
+
error:
|
|
619
|
+
'db:reset is not enabled on this deployment. It DROPS every schema in `schemas` and '
|
|
620
|
+
+ 'replays migrations, and there is no undo. Pass `allowReset: true` to dbPlugin only '
|
|
621
|
+
+ 'on stages where that is acceptable. (This was previously allowed whenever the stage '
|
|
622
|
+
+ 'was NAMED "dev", which is a deployment label, not a decision.)',
|
|
623
|
+
};
|
|
595
624
|
}
|
|
596
625
|
// Refuse BEFORE the drop: reset replays migrations after wiping the schemas — with no
|
|
597
626
|
// migrations there is nothing to rebuild from, and the drop would strand the database.
|