@everystack/cli 0.4.59 → 0.4.61
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 +2 -2
- package/src/backfill.ts +3 -3
- package/src/cli/alter-type-dependents.ts +1 -1
- package/src/cli/apply-authority.ts +1 -1
- package/src/cli/apply-execute.ts +10 -10
- package/src/cli/audit-api.ts +4 -4
- package/src/cli/audit-source-api.ts +2 -2
- package/src/cli/authz-adoption-class.ts +4 -4
- package/src/cli/authz-baseline.ts +2 -2
- package/src/cli/authz-canonical.ts +2 -2
- package/src/cli/authz-compile.ts +3 -3
- package/src/cli/authz-contract-io.ts +2 -2
- package/src/cli/authz-contract.ts +4 -4
- package/src/cli/authz-derive.ts +2 -2
- package/src/cli/authz-identity.ts +1 -1
- package/src/cli/authz-ownership.ts +1 -1
- package/src/cli/authz-reconcile.ts +4 -4
- package/src/cli/authz-redteam.ts +1 -1
- package/src/cli/authz-render.ts +2 -2
- package/src/cli/aws.ts +53 -4
- package/src/cli/backfill.ts +3 -3
- package/src/cli/branch-db.ts +5 -5
- package/src/cli/bundle-weight.ts +2 -2
- package/src/cli/commands/analyze.ts +2 -2
- package/src/cli/commands/audit.ts +10 -10
- package/src/cli/commands/bundle.ts +6 -6
- package/src/cli/commands/cache.ts +75 -3
- package/src/cli/commands/console.ts +6 -6
- package/src/cli/commands/db-apply.ts +25 -25
- package/src/cli/commands/db-approvers.ts +4 -4
- package/src/cli/commands/db-authz.ts +15 -15
- package/src/cli/commands/db-backfill.ts +10 -10
- package/src/cli/commands/db-backup.ts +25 -36
- package/src/cli/commands/db-branch.ts +8 -8
- package/src/cli/commands/db-build.ts +7 -7
- package/src/cli/commands/db-check.ts +16 -16
- package/src/cli/commands/db-diff.ts +6 -6
- package/src/cli/commands/db-exec.ts +8 -8
- package/src/cli/commands/db-export.ts +10 -10
- package/src/cli/commands/db-fingerprint.ts +14 -14
- package/src/cli/commands/db-fork.ts +15 -15
- package/src/cli/commands/db-generate.ts +19 -19
- package/src/cli/commands/db-plan.ts +25 -25
- package/src/cli/commands/db-pull.ts +18 -18
- package/src/cli/commands/db-reconcile.ts +14 -14
- package/src/cli/commands/db-refresh.ts +7 -7
- package/src/cli/commands/db-snapshot.ts +5 -5
- package/src/cli/commands/db-swap.ts +49 -37
- package/src/cli/commands/db-sync.ts +18 -18
- package/src/cli/commands/db.ts +15 -15
- package/src/cli/commands/deploy.ts +39 -5
- package/src/cli/commands/diag.ts +4 -4
- package/src/cli/commands/lighthouse.ts +3 -3
- package/src/cli/commands/logs.ts +5 -5
- package/src/cli/commands/pipeline-run.ts +7 -7
- package/src/cli/commands/runbook.ts +5 -5
- package/src/cli/commands/secrets.ts +5 -5
- package/src/cli/commands/security-probe.ts +4 -4
- package/src/cli/commands/security.ts +6 -6
- package/src/cli/commands/status.ts +3 -3
- package/src/cli/commands/task-probe.ts +4 -4
- package/src/cli/commands/ui-audit.ts +5 -5
- package/src/cli/commands/update.ts +64 -8
- package/src/cli/component-audit.ts +5 -5
- package/src/cli/config.ts +2 -2
- package/src/cli/db-build.ts +6 -6
- package/src/cli/db-source.ts +2 -2
- package/src/cli/declared-derived.ts +5 -5
- package/src/cli/declared-diff.ts +5 -5
- package/src/cli/deploy-probe.ts +3 -3
- package/src/cli/derived-apply.ts +5 -5
- package/src/cli/derived-compile.ts +4 -4
- package/src/cli/derived-grants.ts +1 -1
- package/src/cli/derived-introspect.ts +3 -3
- package/src/cli/derived-lint.ts +2 -2
- package/src/cli/derived-plan.ts +5 -5
- package/src/cli/derived-render.ts +6 -6
- package/src/cli/direct-venue.ts +2 -2
- package/src/cli/discover.ts +2 -2
- package/src/cli/edge-plan.ts +8 -8
- package/src/cli/exec-digest.ts +1 -1
- package/src/cli/exec-execute.ts +1 -1
- package/src/cli/exec-log.ts +1 -1
- package/src/cli/exec-run.ts +2 -2
- package/src/cli/git-descent.ts +5 -5
- package/src/cli/index.ts +46 -46
- package/src/cli/migration-compile.ts +7 -7
- package/src/cli/migration-generate.ts +6 -6
- package/src/cli/model-api.ts +16 -16
- package/src/cli/model-render.ts +6 -6
- package/src/cli/mutation-lease.ts +1 -1
- package/src/cli/observability.ts +1 -1
- package/src/cli/refresh-execute.ts +2 -2
- package/src/cli/runbook/generate.ts +3 -3
- package/src/cli/runbook/index.ts +7 -7
- package/src/cli/runbook/sections.ts +2 -2
- package/src/cli/schema-compile.ts +4 -4
- package/src/cli/schema-diff.ts +1 -1
- package/src/cli/schema-fingerprint.ts +7 -7
- package/src/cli/schema-introspect.ts +3 -3
- package/src/cli/schema-source.ts +1 -1
- package/src/cli/schema-swap.ts +4 -4
- package/src/cli/security-catalog.ts +1 -1
- package/src/cli/stage-backup.ts +229 -0
- package/src/cli/stage-read-consistency.ts +6 -6
- package/src/cli/state-apply.ts +7 -7
- package/src/cli/swap-execute.ts +3 -3
- package/src/cli/swap-heartbeat.ts +1 -1
- package/src/cli/swap-pair.ts +7 -7
- package/src/cli/task-poll.ts +2 -2
- package/src/cli/ui-bloat.ts +1 -1
- package/src/cli/utils/secrets.ts +1 -1
- package/src/exec.ts +7 -7
- package/src/reconcile.ts +2 -2
- package/src/refresh.ts +2 -2
- package/src/sst.ts +1 -1
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
type CatalogColumn,
|
|
26
26
|
type CatalogGrant,
|
|
27
27
|
type ProbeResult,
|
|
28
|
-
} from '../security-probe
|
|
29
|
-
import { resolveConfig, opsFunction } from '../config
|
|
30
|
-
import { invokeAction } from '../aws
|
|
31
|
-
import { step, info, fail, success, warn } from '../output
|
|
28
|
+
} from '../security-probe';
|
|
29
|
+
import { resolveConfig, opsFunction } from '../config';
|
|
30
|
+
import { invokeAction } from '../aws';
|
|
31
|
+
import { step, info, fail, success, warn } from '../output';
|
|
32
32
|
|
|
33
33
|
const SYS_SCHEMAS = "('pg_catalog','information_schema','pg_toast')";
|
|
34
34
|
|
|
@@ -22,17 +22,17 @@ import {
|
|
|
22
22
|
type AuditReport,
|
|
23
23
|
type FunctionDescriptor,
|
|
24
24
|
type ViewDescriptor,
|
|
25
|
-
} from '../security-audit
|
|
25
|
+
} from '../security-audit';
|
|
26
26
|
import {
|
|
27
27
|
FUNCTIONS_SQL,
|
|
28
28
|
RELATIONS_SQL,
|
|
29
29
|
catalogFunctionToDescriptor,
|
|
30
30
|
catalogRelationToDescriptor,
|
|
31
|
-
} from '../security-catalog
|
|
32
|
-
import { SCHEMA_ACL_SQL, parseSchemaAcl } from '../authz-contract
|
|
33
|
-
import { resolveConfig, opsFunction } from '../config
|
|
34
|
-
import { invokeAction } from '../aws
|
|
35
|
-
import { step, success, fail, info, warn } from '../output
|
|
31
|
+
} from '../security-catalog';
|
|
32
|
+
import { SCHEMA_ACL_SQL, parseSchemaAcl } from '../authz-contract';
|
|
33
|
+
import { resolveConfig, opsFunction } from '../config';
|
|
34
|
+
import { invokeAction } from '../aws';
|
|
35
|
+
import { step, success, fail, info, warn } from '../output';
|
|
36
36
|
|
|
37
37
|
const MIGRATION_DIRS = ['drizzle', 'db/migrations', 'migrations', 'db/drizzle'];
|
|
38
38
|
const WAIVER_FILES = ['security-audit.json', '.security-audit.json'];
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* CDN and Lambda metrics still work with nothing but IAM credentials.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { resolveConfig, opsFunction, type CliConfig } from '../config
|
|
15
|
-
import { invokeAction, importOptionalAws } from '../aws
|
|
16
|
-
import { fail, info, step } from '../output
|
|
14
|
+
import { resolveConfig, opsFunction, type CliConfig } from '../config';
|
|
15
|
+
import { invokeAction, importOptionalAws } from '../aws';
|
|
16
|
+
import { fail, info, step } from '../output';
|
|
17
17
|
|
|
18
18
|
export interface MetricSpec {
|
|
19
19
|
namespace: string;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* run id so the operator can reconcile (the task_log row + ECS both carry it).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { resolveConfig, opsFunction } from '../config
|
|
15
|
-
import { invokeAction } from '../aws
|
|
16
|
-
import { pollTaskUntilStopped } from '../task-poll
|
|
17
|
-
import { step, success, fail, info } from '../output
|
|
14
|
+
import { resolveConfig, opsFunction } from '../config';
|
|
15
|
+
import { invokeAction } from '../aws';
|
|
16
|
+
import { pollTaskUntilStopped } from '../task-poll';
|
|
17
|
+
import { step, success, fail, info } from '../output';
|
|
18
18
|
|
|
19
19
|
const DEADLINE_MS = 10 * 60_000; // 10 min — Fargate cold start + pull + handshake, with headroom.
|
|
20
20
|
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
-
import { discoverComponents } from '../component-model
|
|
18
|
-
import { auditComponents } from '../component-audit
|
|
19
|
-
import { resolveUiBloatBudget } from '../ui-bloat
|
|
20
|
-
import { summarize, type AuditFinding } from '../bundle-audit
|
|
21
|
-
import { fail, info, step, success, warn } from '../output
|
|
17
|
+
import { discoverComponents } from '../component-model';
|
|
18
|
+
import { auditComponents } from '../component-audit';
|
|
19
|
+
import { resolveUiBloatBudget } from '../ui-bloat';
|
|
20
|
+
import { summarize, type AuditFinding } from '../bundle-audit';
|
|
21
|
+
import { fail, info, step, success, warn } from '../output';
|
|
22
22
|
|
|
23
23
|
export interface UiAuditResult {
|
|
24
24
|
findings: AuditFinding[];
|
|
@@ -5,13 +5,13 @@ import zlib from 'node:zlib';
|
|
|
5
5
|
import { pipeline } from 'node:stream/promises';
|
|
6
6
|
import { createWriteStream } from 'node:fs';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
|
-
import { resolveConfig, type CliConfig } from '../config
|
|
9
|
-
import { uploadToS3, headS3, invokeAction } from '../aws
|
|
10
|
-
import { step, success, warn, fail, info } from '../output
|
|
11
|
-
import { opsAdviceLines, IAM_ADVICE } from '../ops-advice
|
|
12
|
-
import { exportApp } from '../utils/export
|
|
13
|
-
import { walkDirectory } from '../utils/walk
|
|
14
|
-
import { loadSstSecrets } from '../utils/secrets
|
|
8
|
+
import { resolveConfig, type CliConfig } from '../config';
|
|
9
|
+
import { uploadToS3, headS3, invokeAction, rollingRestart } from '../aws';
|
|
10
|
+
import { step, success, warn, fail, info } from '../output';
|
|
11
|
+
import { opsAdviceLines, IAM_ADVICE } from '../ops-advice';
|
|
12
|
+
import { exportApp } from '../utils/export';
|
|
13
|
+
import { walkDirectory } from '../utils/walk';
|
|
14
|
+
import { loadSstSecrets } from '../utils/secrets';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Embed an 8-char content hash in a filename for cache busting.
|
|
@@ -111,7 +111,7 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
|
|
|
111
111
|
// filter that gates what reaches the bundle (see env.config.js tiers).
|
|
112
112
|
// This avoids requiring `sst shell` in deploy scripts.
|
|
113
113
|
try {
|
|
114
|
-
const { parseAppName } = await import('../discover
|
|
114
|
+
const { parseAppName } = await import('../discover');
|
|
115
115
|
const appName = await parseAppName();
|
|
116
116
|
const region = resolvedConfig?.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1';
|
|
117
117
|
step('Loading SST secrets...');
|
|
@@ -627,6 +627,27 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
// 6. Rolling restart — retire warm containers so they cold-start with the new bundle.
|
|
631
|
+
step('Restarting Lambda containers...');
|
|
632
|
+
try {
|
|
633
|
+
const { newGen } = await rollingRestart(config.region, config.apiFunctionName);
|
|
634
|
+
success(`Containers restarting (gen ${newGen})`);
|
|
635
|
+
} catch (err: any) {
|
|
636
|
+
warn(`Rolling restart failed: ${err.message}`);
|
|
637
|
+
info('Warm containers will pick up the new bundle after the 60s TTL expires.');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// 7. Verify the origin is serving the new release.
|
|
641
|
+
step('Verifying origin serves new release...');
|
|
642
|
+
const verified = await verifyOriginRelease(config.baseUrl, updateId);
|
|
643
|
+
if (verified) {
|
|
644
|
+
success(`Origin confirmed: ${updateId.slice(0, 12)}...`);
|
|
645
|
+
} else {
|
|
646
|
+
warn('Origin did not confirm the new release within the timeout.');
|
|
647
|
+
info('The release may still be propagating. Check manually:');
|
|
648
|
+
info(` curl -sI ${config.baseUrl} | grep x-everystack-release`);
|
|
649
|
+
}
|
|
650
|
+
|
|
630
651
|
// Clean up archive
|
|
631
652
|
await fs.unlink(archivePath).catch(() => {});
|
|
632
653
|
|
|
@@ -787,3 +808,38 @@ export function getExpoRouterSsrFlags(appConfig: any): {
|
|
|
787
808
|
}
|
|
788
809
|
return { useServerRendering: false, useServerDataLoaders: false };
|
|
789
810
|
}
|
|
811
|
+
|
|
812
|
+
const VERIFY_CONSECUTIVE = 3;
|
|
813
|
+
const VERIFY_INTERVAL_MS = 2_000;
|
|
814
|
+
const VERIFY_TIMEOUT_MS = 30_000;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Poll the origin until N consecutive responses carry the expected updateId.
|
|
818
|
+
* Uses a cache-busting query param so each request reaches the Lambda origin.
|
|
819
|
+
* @internal Exported for testing.
|
|
820
|
+
*/
|
|
821
|
+
export async function verifyOriginRelease(
|
|
822
|
+
baseUrl: string,
|
|
823
|
+
expectedUpdateId: string,
|
|
824
|
+
): Promise<boolean> {
|
|
825
|
+
const deadline = Date.now() + VERIFY_TIMEOUT_MS;
|
|
826
|
+
let consecutive = 0;
|
|
827
|
+
|
|
828
|
+
while (Date.now() < deadline) {
|
|
829
|
+
try {
|
|
830
|
+
const probe = `${baseUrl}?_probe=${Date.now()}`;
|
|
831
|
+
const res = await fetch(probe, { redirect: 'follow' });
|
|
832
|
+
const release = res.headers.get('x-everystack-release');
|
|
833
|
+
if (release === expectedUpdateId) {
|
|
834
|
+
consecutive++;
|
|
835
|
+
if (consecutive >= VERIFY_CONSECUTIVE) return true;
|
|
836
|
+
} else {
|
|
837
|
+
consecutive = 0;
|
|
838
|
+
}
|
|
839
|
+
} catch {
|
|
840
|
+
consecutive = 0;
|
|
841
|
+
}
|
|
842
|
+
await new Promise((r) => setTimeout(r, VERIFY_INTERVAL_MS));
|
|
843
|
+
}
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
* this file; this file imports the model, never the reverse.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import type { AuditFinding, SourceLoc } from './bundle-audit
|
|
21
|
-
import type { ComponentDescriptor, JsxNode } from './component-model
|
|
22
|
-
import { canonicalizeStyle, isDesignStyle, type UiBloatBudget } from './ui-bloat
|
|
20
|
+
import type { AuditFinding, SourceLoc } from './bundle-audit';
|
|
21
|
+
import type { ComponentDescriptor, JsxNode } from './component-model';
|
|
22
|
+
import { canonicalizeStyle, isDesignStyle, type UiBloatBudget } from './ui-bloat';
|
|
23
23
|
|
|
24
|
-
export { DEFAULT_UI_BLOAT_BUDGET, type UiBloatBudget } from './ui-bloat
|
|
25
|
-
import { DEFAULT_UI_BLOAT_BUDGET } from './ui-bloat
|
|
24
|
+
export { DEFAULT_UI_BLOAT_BUDGET, type UiBloatBudget } from './ui-bloat';
|
|
25
|
+
import { DEFAULT_UI_BLOAT_BUDGET } from './ui-bloat';
|
|
26
26
|
|
|
27
27
|
const VERIFY = 'rerun ui:audit; this finding clears when its occurrence count drops below the threshold';
|
|
28
28
|
|
package/src/cli/config.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from 'node:fs/promises';
|
|
11
11
|
import path from 'node:path';
|
|
12
|
-
import { step } from './output
|
|
12
|
+
import { step } from './output';
|
|
13
13
|
|
|
14
14
|
export interface CliConfig {
|
|
15
15
|
baseUrl: string;
|
|
@@ -91,7 +91,7 @@ export async function resolveConfig(stage?: string): Promise<CliConfig> {
|
|
|
91
91
|
discoverConfig,
|
|
92
92
|
getCachedConfig,
|
|
93
93
|
setCachedConfig,
|
|
94
|
-
} = await import('./discover
|
|
94
|
+
} = await import('./discover');
|
|
95
95
|
|
|
96
96
|
// Check cache first
|
|
97
97
|
const cached = await getCachedConfig(stage);
|
package/src/cli/db-build.ts
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { ModelDescriptor } from '@everystack/model';
|
|
14
|
-
import type { TableContract, QueryRunner } from './authz-contract
|
|
15
|
-
import type { SourceObject } from './derived-source
|
|
14
|
+
import type { TableContract, QueryRunner } from './authz-contract';
|
|
15
|
+
import type { SourceObject } from './derived-source';
|
|
16
16
|
import type { SequenceDescriptor } from '@everystack/model';
|
|
17
|
-
import { compileDeclaredState } from './declared-diff
|
|
18
|
-
import { createUrlRunner } from './db-source
|
|
19
|
-
import { executeSync, buildSyncReport } from './commands/db-sync
|
|
20
|
-
import { executeReconcile } from './commands/db-reconcile
|
|
17
|
+
import { compileDeclaredState } from './declared-diff';
|
|
18
|
+
import { createUrlRunner } from './db-source';
|
|
19
|
+
import { executeSync, buildSyncReport } from './commands/db-sync';
|
|
20
|
+
import { executeReconcile } from './commands/db-reconcile';
|
|
21
21
|
|
|
22
22
|
const SAFE_NAME = /^[a-z_][a-z0-9_$]*$/;
|
|
23
23
|
|
package/src/cli/db-source.ts
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* driver only surfaces — with instructions — when the direct path is actually used.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import type { QueryRunner } from './authz-contract
|
|
28
|
-
import { buildSearchPathSql, type SessionRunner, type SessionResult } from './session
|
|
27
|
+
import type { QueryRunner } from './authz-contract';
|
|
28
|
+
import { buildSearchPathSql, type SessionRunner, type SessionResult } from './session';
|
|
29
29
|
|
|
30
30
|
export type DbSource =
|
|
31
31
|
| { kind: 'url'; url: string; from: 'flag' | 'env' | 'admin-env' | 'operator' }
|
|
@@ -13,11 +13,11 @@ import fs from 'node:fs/promises';
|
|
|
13
13
|
import { pathToFileURL } from 'node:url';
|
|
14
14
|
import type { Module, ModelDescriptor, SequenceDescriptor, DerivedDescriptor } from '@everystack/model';
|
|
15
15
|
import { moduleGovernedRoles } from '@everystack/model';
|
|
16
|
-
import { compileDerived } from './derived-compile
|
|
17
|
-
import { compileTableRenames, compileTableMoves } from './schema-compile
|
|
18
|
-
import type { SourceObject } from './derived-source
|
|
19
|
-
import { resolveModelsPath } from './models-path
|
|
20
|
-
import { asModelComposeError } from './ops-advice
|
|
16
|
+
import { compileDerived } from './derived-compile';
|
|
17
|
+
import { compileTableRenames, compileTableMoves } from './schema-compile';
|
|
18
|
+
import type { SourceObject } from './derived-source';
|
|
19
|
+
import { resolveModelsPath } from './models-path';
|
|
20
|
+
import { asModelComposeError } from './ops-advice';
|
|
21
21
|
|
|
22
22
|
export interface DeclaredDerived {
|
|
23
23
|
/** Descriptor-compiled derived objects, in dependency order. */
|
package/src/cli/declared-diff.ts
CHANGED
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import type { ModelDescriptor } from '@everystack/model';
|
|
30
|
-
import type { SchemaSnapshot } from './schema-introspect
|
|
31
|
-
import type { AuthzContract } from './authz-contract
|
|
32
|
-
import { compileTableSchema, compileEnums } from './schema-compile
|
|
33
|
-
import { compileTableContract } from './authz-compile
|
|
34
|
-
import { generateMigrationSql } from './migration-generate
|
|
30
|
+
import type { SchemaSnapshot } from './schema-introspect';
|
|
31
|
+
import type { AuthzContract } from './authz-contract';
|
|
32
|
+
import { compileTableSchema, compileEnums } from './schema-compile';
|
|
33
|
+
import { compileTableContract } from './authz-compile';
|
|
34
|
+
import { generateMigrationSql } from './migration-generate';
|
|
35
35
|
|
|
36
36
|
export interface DeclaredState {
|
|
37
37
|
snapshot: SchemaSnapshot;
|
package/src/cli/deploy-probe.ts
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* and must never fail the deploy.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { isOpsHandlerCrash } from './ops-diagnostics
|
|
20
|
-
import { diagnoseOpsCrash, importOptionalAws } from './aws
|
|
21
|
-
import { step, success, fail, info } from './output
|
|
19
|
+
import { isOpsHandlerCrash } from './ops-diagnostics';
|
|
20
|
+
import { diagnoseOpsCrash, importOptionalAws } from './aws';
|
|
21
|
+
import { step, success, fail, info } from './output';
|
|
22
22
|
|
|
23
23
|
/** The raw outcome of one probe invoke, before classification. */
|
|
24
24
|
export interface ProbeOutcome {
|
package/src/cli/derived-apply.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* the reconciler writes it and never reads it.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { normalizeSql, parseQualified, type SourceObject } from './derived-source
|
|
17
|
-
import type { ReconcilePlan } from './derived-plan
|
|
18
|
-
import { parseGrantAttachments } from './derived-grants
|
|
19
|
-
import { quoteIdent, quoteQualified } from './pg-ident
|
|
20
|
-
import { splitFunctionIdentity } from './pg-argtypes
|
|
16
|
+
import { normalizeSql, parseQualified, type SourceObject } from './derived-source';
|
|
17
|
+
import type { ReconcilePlan } from './derived-plan';
|
|
18
|
+
import { parseGrantAttachments } from './derived-grants';
|
|
19
|
+
import { quoteIdent, quoteQualified } from './pg-ident';
|
|
20
|
+
import { splitFunctionIdentity } from './pg-argtypes';
|
|
21
21
|
|
|
22
22
|
/** SQL string literal with '' doubling (standard_conforming_strings). */
|
|
23
23
|
export function escapeLiteral(value: string): string {
|
|
@@ -21,10 +21,10 @@ import type {
|
|
|
21
21
|
ModelDescriptor, DerivedDescriptor, ViewDescriptor, MaterializedViewDescriptor,
|
|
22
22
|
FunctionDescriptor, SqlDescriptor, TriggerSpec, TriggerDescriptor, Ability, SetofReturn, DependsOnRef,
|
|
23
23
|
} from '@everystack/model';
|
|
24
|
-
import { hashSourceContent, parseQualified, DECLARED_SOURCE_FILE, type Attachment, type SourceObject } from './derived-source
|
|
25
|
-
import { isPlainGrantAttachment } from './derived-grants
|
|
26
|
-
import { functionIdentity } from './pg-argtypes
|
|
27
|
-
import { findInvokerReachabilityGaps } from './derived-lint
|
|
24
|
+
import { hashSourceContent, parseQualified, DECLARED_SOURCE_FILE, type Attachment, type SourceObject } from './derived-source';
|
|
25
|
+
import { isPlainGrantAttachment } from './derived-grants';
|
|
26
|
+
import { functionIdentity } from './pg-argtypes';
|
|
27
|
+
import { findInvokerReachabilityGaps } from './derived-lint';
|
|
28
28
|
|
|
29
29
|
/** The provenance marker for descriptor-compiled objects (SourceObject.file). */
|
|
30
30
|
const DECLARED = DECLARED_SOURCE_FILE;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* silently half-diffed.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import type { Attachment } from './derived-source
|
|
26
|
+
import type { Attachment } from './derived-source';
|
|
27
27
|
|
|
28
28
|
export interface ParsedGrants {
|
|
29
29
|
/** grantee → sorted privileges. PUBLIC present-with-[] means explicitly revoked. */
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { createHash } from 'node:crypto';
|
|
21
|
-
import { IGNORED_SCHEMAS, type QueryRunner } from './authz-contract
|
|
22
|
-
import { normalizeSql, type DerivedKind } from './derived-source
|
|
23
|
-
import { INTROSPECTION_SESSION, rowsOrEmpty, type SessionRunner } from './session
|
|
21
|
+
import { IGNORED_SCHEMAS, type QueryRunner } from './authz-contract';
|
|
22
|
+
import { normalizeSql, type DerivedKind } from './derived-source';
|
|
23
|
+
import { INTROSPECTION_SESSION, rowsOrEmpty, type SessionRunner } from './session';
|
|
24
24
|
|
|
25
25
|
export interface LiveObject {
|
|
26
26
|
kind: DerivedKind;
|
package/src/cli/derived-lint.ts
CHANGED
|
@@ -31,8 +31,8 @@ import type {
|
|
|
31
31
|
ModelDescriptor, DerivedDescriptor, ViewDescriptor, MaterializedViewDescriptor,
|
|
32
32
|
FunctionDescriptor, DependsOnRef,
|
|
33
33
|
} from '@everystack/model';
|
|
34
|
-
import { parseQualified } from './derived-source
|
|
35
|
-
import { GOVERNED_VOCABULARY } from './authz-derive
|
|
34
|
+
import { parseQualified } from './derived-source';
|
|
35
|
+
import { GOVERNED_VOCABULARY } from './authz-derive';
|
|
36
36
|
|
|
37
37
|
export interface DerivedAuthzGap {
|
|
38
38
|
/** `schema.name` of the descriptor that fails the gate. */
|
package/src/cli/derived-plan.ts
CHANGED
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* drift report, not a silent skip.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { type ParsedSources, type SourceObject, type DerivedKind } from './derived-source
|
|
28
|
-
import type { DerivedCatalog, LiveObject } from './derived-introspect
|
|
29
|
-
import { triggerDropSql } from './derived-apply
|
|
30
|
-
import { parseGrantAttachments, diffObjectGrants } from './derived-grants
|
|
31
|
-
import { legacyFunctionIdentity, splitFunctionIdentity } from './pg-argtypes
|
|
27
|
+
import { type ParsedSources, type SourceObject, type DerivedKind } from './derived-source';
|
|
28
|
+
import type { DerivedCatalog, LiveObject } from './derived-introspect';
|
|
29
|
+
import { triggerDropSql } from './derived-apply';
|
|
30
|
+
import { parseGrantAttachments, diffObjectGrants } from './derived-grants';
|
|
31
|
+
import { legacyFunctionIdentity, splitFunctionIdentity } from './pg-argtypes';
|
|
32
32
|
|
|
33
33
|
export type ReconcileVerb = 'create' | 'replace' | 'refresh' | 'drop' | 'baseline' | 'rebaseline' | 'prune' | 'backfill';
|
|
34
34
|
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* checklist effect, on purpose — never a silent drop.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type { DerivedCatalog, LiveObject } from './derived-introspect
|
|
17
|
-
import type { ColumnSchema, SequenceSchema, TableSchema } from './schema-introspect
|
|
18
|
-
import { parseIndexDefinition } from './schema-introspect
|
|
19
|
-
import { modelImportPath, renderFieldLines } from './model-render
|
|
20
|
-
import { splitFunctionIdentity } from './pg-argtypes
|
|
21
|
-
import { GOVERNED_VOCABULARY, KNOWN_ROLES } from './authz-derive
|
|
16
|
+
import type { DerivedCatalog, LiveObject } from './derived-introspect';
|
|
17
|
+
import type { ColumnSchema, SequenceSchema, TableSchema } from './schema-introspect';
|
|
18
|
+
import { parseIndexDefinition } from './schema-introspect';
|
|
19
|
+
import { modelImportPath, renderFieldLines } from './model-render';
|
|
20
|
+
import { splitFunctionIdentity } from './pg-argtypes';
|
|
21
|
+
import { GOVERNED_VOCABULARY, KNOWN_ROLES } from './authz-derive';
|
|
22
22
|
|
|
23
23
|
export interface DerivedRenderResult {
|
|
24
24
|
/** The source block: `export const … = defineView(…)` etc., dependency-ordered. */
|
package/src/cli/direct-venue.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* never written, never exported. Callers pass it straight to createUrlRunner and drop it.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { resolveConfig, opsFunction } from './config
|
|
15
|
-
import { invokeAction } from './aws
|
|
14
|
+
import { resolveConfig, opsFunction } from './config';
|
|
15
|
+
import { invokeAction } from './aws';
|
|
16
16
|
|
|
17
17
|
export interface OperatorConnection {
|
|
18
18
|
/** The operator connection string — hold in memory, never print. */
|
package/src/cli/discover.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import fs from 'node:fs/promises';
|
|
15
15
|
import path from 'node:path';
|
|
16
|
-
import { importOptionalAws } from './aws
|
|
16
|
+
import { importOptionalAws } from './aws';
|
|
17
17
|
|
|
18
18
|
/** Mirrors CliConfig from config.ts — defined locally to avoid circular imports. */
|
|
19
19
|
interface DiscoveredConfig {
|
|
@@ -285,7 +285,7 @@ export async function discoverConfig(
|
|
|
285
285
|
// Distribution discovery is best-effort (status CDN section, cache:purge --invalidate)
|
|
286
286
|
let distributionId: string | undefined;
|
|
287
287
|
try {
|
|
288
|
-
const { discoverDistribution } = await import('./discover-distribution
|
|
288
|
+
const { discoverDistribution } = await import('./discover-distribution');
|
|
289
289
|
const routerHost = lambdaResult.routerUrl
|
|
290
290
|
? new URL(lambdaResult.routerUrl).host
|
|
291
291
|
: undefined;
|
package/src/cli/edge-plan.ts
CHANGED
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
|
|
27
27
|
import { createHash } from 'node:crypto';
|
|
28
28
|
import type { ModelDescriptor } from '@everystack/model';
|
|
29
|
-
import type { SchemaSnapshot } from './schema-introspect
|
|
30
|
-
import type { AuthzContract } from './authz-contract
|
|
31
|
-
import { generateMigrationSql, unmodeledTables } from './migration-generate
|
|
32
|
-
import { compileTableContract } from './authz-compile
|
|
33
|
-
import { classifyGeneratedStatements, classifyDestructive, partitionStatements, renderStatementHistogram } from './state-apply
|
|
34
|
-
import { fingerprintLive, fingerprintState, fingerprintModels, governedRolesForModels, stableStringify, compareStoredFingerprint, formatChangedMessage, FINGERPRINT_VERSION } from './schema-fingerprint
|
|
35
|
-
import { compileDeclaredState } from './declared-diff
|
|
36
|
-
import { compileTableRenames, compileTableMoves } from './schema-compile
|
|
29
|
+
import type { SchemaSnapshot } from './schema-introspect';
|
|
30
|
+
import type { AuthzContract } from './authz-contract';
|
|
31
|
+
import { generateMigrationSql, unmodeledTables } from './migration-generate';
|
|
32
|
+
import { compileTableContract } from './authz-compile';
|
|
33
|
+
import { classifyGeneratedStatements, classifyDestructive, partitionStatements, renderStatementHistogram } from './state-apply';
|
|
34
|
+
import { fingerprintLive, fingerprintState, fingerprintModels, governedRolesForModels, stableStringify, compareStoredFingerprint, formatChangedMessage, FINGERPRINT_VERSION } from './schema-fingerprint';
|
|
35
|
+
import { compileDeclaredState } from './declared-diff';
|
|
36
|
+
import { compileTableRenames, compileTableMoves } from './schema-compile';
|
|
37
37
|
|
|
38
38
|
export const PLAN_VERSION = 2;
|
|
39
39
|
|
package/src/cli/exec-digest.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* models?". Server-side, no CLI/model dependency: a plain string that any runner can execute.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { escapeLiteral } from './derived-apply
|
|
24
|
+
import { escapeLiteral } from './derived-apply';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Build the digest query. Returns SQL selecting a single `digest` column (md5 hex, or md5('')
|
package/src/cli/exec-execute.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { createHash } from 'node:crypto';
|
|
18
|
-
import { lex } from './derived-source
|
|
18
|
+
import { lex } from './derived-source';
|
|
19
19
|
|
|
20
20
|
export interface ExecIntent {
|
|
21
21
|
/** sha256 of the exact file bytes — content identity + a free join to a consumer's stage sha. */
|
package/src/cli/exec-log.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Mirrors everystack.backfill_log: a per-database ledger the way schema_log is a write-only memoir.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { escapeLiteral } from './derived-apply
|
|
14
|
+
import { escapeLiteral } from './derived-apply';
|
|
15
15
|
|
|
16
16
|
export const ENSURE_EXEC_LOG_SQL: string[] = [
|
|
17
17
|
'CREATE SCHEMA IF NOT EXISTS everystack',
|
package/src/cli/exec-run.ts
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* (against PostgreSQL) is in __tests__/integration/exec.test.ts.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { splitSqlStatements } from './derived-source
|
|
23
|
-
import { catalogDigestQuery } from './exec-digest
|
|
22
|
+
import { splitSqlStatements } from './derived-source';
|
|
23
|
+
import { catalogDigestQuery } from './exec-digest';
|
|
24
24
|
|
|
25
25
|
/** The normalized result of one statement: its rows and how many it affected. */
|
|
26
26
|
export interface ExecStmtResult {
|
package/src/cli/git-descent.ts
CHANGED
|
@@ -29,11 +29,11 @@ import os from 'node:os';
|
|
|
29
29
|
import path from 'node:path';
|
|
30
30
|
import { pathToFileURL } from 'node:url';
|
|
31
31
|
import type { ModelDescriptor } from '@everystack/model';
|
|
32
|
-
import type { SchemaSnapshot } from './schema-introspect
|
|
33
|
-
import type { AuthzContract } from './authz-contract
|
|
34
|
-
import { fingerprintLive } from './schema-fingerprint
|
|
35
|
-
import { predictLiveFingerprint, governedLiveFingerprint } from './edge-plan
|
|
36
|
-
import { governedRolesForModels } from './schema-fingerprint
|
|
32
|
+
import type { SchemaSnapshot } from './schema-introspect';
|
|
33
|
+
import type { AuthzContract } from './authz-contract';
|
|
34
|
+
import { fingerprintLive } from './schema-fingerprint';
|
|
35
|
+
import { predictLiveFingerprint, governedLiveFingerprint } from './edge-plan';
|
|
36
|
+
import { governedRolesForModels } from './schema-fingerprint';
|
|
37
37
|
|
|
38
38
|
/** Compile a models barrel on disk. The default rides the CLI's runtime (tsx). */
|
|
39
39
|
export type ModelsLoader = (barrel: string) => Promise<ModelDescriptor[]>;
|