@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
package/src/cli/index.ts
CHANGED
|
@@ -2,51 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { updateCommand } from './commands/update
|
|
6
|
-
import { deployCommand } from './commands/deploy
|
|
7
|
-
import { certsCommand } from './commands/certs
|
|
8
|
-
import { channelsCommand } from './commands/channels
|
|
9
|
-
import { branchesCommand } from './commands/branches
|
|
10
|
-
import { dbMigrateCommand, dbSeedCommand, dbResetCommand, dbPsqlCommand, dbDoctorCommand, dbProvisionCommand } from './commands/db
|
|
11
|
-
import { dbAuthzPullCommand, dbAuthzDiffCommand, dbAuthzTestCommand, dbAuthzOwnerCommand, dbAuthzReportCommand } from './commands/db-authz
|
|
12
|
-
import { dbGenerateCommand } from './commands/db-generate
|
|
13
|
-
import { dbPullCommand } from './commands/db-pull
|
|
14
|
-
import { dbReconcileCommand } from './commands/db-reconcile
|
|
15
|
-
import { dbRefreshCommand } from './commands/db-refresh
|
|
16
|
-
import { dbFingerprintCommand } from './commands/db-fingerprint
|
|
17
|
-
import { dbSyncCommand } from './commands/db-sync
|
|
18
|
-
import { dbDiffCommand } from './commands/db-diff
|
|
19
|
-
import { dbPlanCommand } from './commands/db-plan
|
|
20
|
-
import { dbApplyCommand } from './commands/db-apply
|
|
21
|
-
import { dbCheckCommand } from './commands/db-check
|
|
22
|
-
import { dbBuildCommand } from './commands/db-build
|
|
23
|
-
import { dbApproversCommand } from './commands/db-approvers
|
|
24
|
-
import { dbBackfillCommand } from './commands/db-backfill
|
|
25
|
-
import { dbExecCommand } from './commands/db-exec
|
|
26
|
-
import { taskProbeCommand } from './commands/task-probe
|
|
27
|
-
import { pipelineRunCommand, pipelineListCommand } from './commands/pipeline-run
|
|
28
|
-
import { dbTemplateRefreshCommand, dbBranchCommand } from './commands/db-branch
|
|
29
|
-
import { dbForkCommand } from './commands/db-fork
|
|
30
|
-
import { dbSnapshotCommand, dbSnapshotsCommand } from './commands/db-snapshot
|
|
31
|
-
import { dbBackupCommand, dbBackupsCommand, dbRestoreCommand, dbBackupDownloadCommand } from './commands/db-backup
|
|
32
|
-
import { dbExportCommand } from './commands/db-export
|
|
33
|
-
import { dbSwapCommand } from './commands/db-swap
|
|
34
|
-
import { consoleCommand } from './commands/console
|
|
35
|
-
import { cachePurgeCommand } from './commands/cache
|
|
36
|
-
import { statusCommand } from './commands/status
|
|
37
|
-
import { diagCommand } from './commands/diag
|
|
38
|
-
import { analyzeSSRCommand } from './commands/analyze
|
|
39
|
-
import { logsErrorsCommand, logsTailCommand, logsQueryCommand } from './commands/logs
|
|
40
|
-
import { secretsCommand } from './commands/secrets
|
|
41
|
-
import { securityAuditCommand } from './commands/security
|
|
42
|
-
import { securityProbeCommand } from './commands/security-probe
|
|
43
|
-
import { bundleAnalyzeCommand, bundleAuditCommand } from './commands/bundle
|
|
44
|
-
import { auditLighthouseCommand } from './commands/lighthouse
|
|
45
|
-
import { auditCommand } from './commands/audit
|
|
46
|
-
import { uiAuditCommand } from './commands/ui-audit
|
|
47
|
-
import { runbookCommand } from './commands/runbook
|
|
48
|
-
import { fail } from './output
|
|
49
|
-
import { parseFlags } from './parse-flags
|
|
5
|
+
import { updateCommand } from './commands/update';
|
|
6
|
+
import { deployCommand } from './commands/deploy';
|
|
7
|
+
import { certsCommand } from './commands/certs';
|
|
8
|
+
import { channelsCommand } from './commands/channels';
|
|
9
|
+
import { branchesCommand } from './commands/branches';
|
|
10
|
+
import { dbMigrateCommand, dbSeedCommand, dbResetCommand, dbPsqlCommand, dbDoctorCommand, dbProvisionCommand } from './commands/db';
|
|
11
|
+
import { dbAuthzPullCommand, dbAuthzDiffCommand, dbAuthzTestCommand, dbAuthzOwnerCommand, dbAuthzReportCommand } from './commands/db-authz';
|
|
12
|
+
import { dbGenerateCommand } from './commands/db-generate';
|
|
13
|
+
import { dbPullCommand } from './commands/db-pull';
|
|
14
|
+
import { dbReconcileCommand } from './commands/db-reconcile';
|
|
15
|
+
import { dbRefreshCommand } from './commands/db-refresh';
|
|
16
|
+
import { dbFingerprintCommand } from './commands/db-fingerprint';
|
|
17
|
+
import { dbSyncCommand } from './commands/db-sync';
|
|
18
|
+
import { dbDiffCommand } from './commands/db-diff';
|
|
19
|
+
import { dbPlanCommand } from './commands/db-plan';
|
|
20
|
+
import { dbApplyCommand } from './commands/db-apply';
|
|
21
|
+
import { dbCheckCommand } from './commands/db-check';
|
|
22
|
+
import { dbBuildCommand } from './commands/db-build';
|
|
23
|
+
import { dbApproversCommand } from './commands/db-approvers';
|
|
24
|
+
import { dbBackfillCommand } from './commands/db-backfill';
|
|
25
|
+
import { dbExecCommand } from './commands/db-exec';
|
|
26
|
+
import { taskProbeCommand } from './commands/task-probe';
|
|
27
|
+
import { pipelineRunCommand, pipelineListCommand } from './commands/pipeline-run';
|
|
28
|
+
import { dbTemplateRefreshCommand, dbBranchCommand } from './commands/db-branch';
|
|
29
|
+
import { dbForkCommand } from './commands/db-fork';
|
|
30
|
+
import { dbSnapshotCommand, dbSnapshotsCommand } from './commands/db-snapshot';
|
|
31
|
+
import { dbBackupCommand, dbBackupsCommand, dbRestoreCommand, dbBackupDownloadCommand } from './commands/db-backup';
|
|
32
|
+
import { dbExportCommand } from './commands/db-export';
|
|
33
|
+
import { dbSwapCommand } from './commands/db-swap';
|
|
34
|
+
import { consoleCommand } from './commands/console';
|
|
35
|
+
import { cachePurgeCommand } from './commands/cache';
|
|
36
|
+
import { statusCommand } from './commands/status';
|
|
37
|
+
import { diagCommand } from './commands/diag';
|
|
38
|
+
import { analyzeSSRCommand } from './commands/analyze';
|
|
39
|
+
import { logsErrorsCommand, logsTailCommand, logsQueryCommand } from './commands/logs';
|
|
40
|
+
import { secretsCommand } from './commands/secrets';
|
|
41
|
+
import { securityAuditCommand } from './commands/security';
|
|
42
|
+
import { securityProbeCommand } from './commands/security-probe';
|
|
43
|
+
import { bundleAnalyzeCommand, bundleAuditCommand } from './commands/bundle';
|
|
44
|
+
import { auditLighthouseCommand } from './commands/lighthouse';
|
|
45
|
+
import { auditCommand } from './commands/audit';
|
|
46
|
+
import { uiAuditCommand } from './commands/ui-audit';
|
|
47
|
+
import { runbookCommand } from './commands/runbook';
|
|
48
|
+
import { fail } from './output';
|
|
49
|
+
import { parseFlags } from './parse-flags';
|
|
50
50
|
|
|
51
51
|
const args = process.argv.slice(2);
|
|
52
52
|
const command = args[0];
|
|
@@ -109,7 +109,7 @@ async function main() {
|
|
|
109
109
|
// (loadSstOutputs and resolveConfig both consult it). Use after a deploy the CLI didn't run,
|
|
110
110
|
// or whenever a stage command resolves to the wrong function.
|
|
111
111
|
if (flags.refresh && flags.stage) {
|
|
112
|
-
const { invalidateCachedConfig } = await import('./discover
|
|
112
|
+
const { invalidateCachedConfig } = await import('./discover');
|
|
113
113
|
await invalidateCachedConfig(flags.stage);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import type { ModelDescriptor, Module, SequenceDescriptor } from '@everystack/model';
|
|
23
|
-
import type { AuthzContract, TableContract } from './authz-contract
|
|
24
|
-
import { compileCreateTable, compileEnums, compileSequences, sequenceCreateSql, foreignKeySql, modelConstraintSpecs, qualifiedTable, toSnakeCase, type CompileTableOptions } from './schema-compile
|
|
25
|
-
import { compileTableContract } from './authz-compile
|
|
26
|
-
import { emitReconcileSql } from './authz-reconcile
|
|
27
|
-
import { emitSchemaSql, nextvalSequence, type SchemaChange } from './schema-diff
|
|
28
|
-
import { compileDerived } from './derived-compile
|
|
29
|
-
import { renderEnsureObjectSchemas } from './derived-apply
|
|
23
|
+
import type { AuthzContract, TableContract } from './authz-contract';
|
|
24
|
+
import { compileCreateTable, compileEnums, compileSequences, sequenceCreateSql, foreignKeySql, modelConstraintSpecs, qualifiedTable, toSnakeCase, type CompileTableOptions } from './schema-compile';
|
|
25
|
+
import { compileTableContract } from './authz-compile';
|
|
26
|
+
import { emitReconcileSql } from './authz-reconcile';
|
|
27
|
+
import { emitSchemaSql, nextvalSequence, type SchemaChange } from './schema-diff';
|
|
28
|
+
import { compileDerived } from './derived-compile';
|
|
29
|
+
import { renderEnsureObjectSchemas } from './derived-apply';
|
|
30
30
|
|
|
31
31
|
/** The empty (not-yet-created) authz state for a table — the greenfield baseline. */
|
|
32
32
|
function emptyTable(table: string): TableContract {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import type { ModelDescriptor, SequenceDescriptor } from '@everystack/model';
|
|
19
|
-
import type { SchemaSnapshot } from './schema-introspect
|
|
20
|
-
import type { AuthzContract } from './authz-contract
|
|
21
|
-
import { compileTableSchema, compileRenames, compileTableRenames, compileTableMoves, compileCreateTable, compileEnums, compileSequences } from './schema-compile
|
|
22
|
-
import { compileTableContract } from './authz-compile
|
|
23
|
-
import { emitReconcileSql, governedRoleSet } from './authz-reconcile
|
|
24
|
-
import { diffSchema, emitSchemaSql, type SchemaChange } from './schema-diff
|
|
19
|
+
import type { SchemaSnapshot } from './schema-introspect';
|
|
20
|
+
import type { AuthzContract } from './authz-contract';
|
|
21
|
+
import { compileTableSchema, compileRenames, compileTableRenames, compileTableMoves, compileCreateTable, compileEnums, compileSequences } from './schema-compile';
|
|
22
|
+
import { compileTableContract } from './authz-compile';
|
|
23
|
+
import { emitReconcileSql, governedRoleSet } from './authz-reconcile';
|
|
24
|
+
import { diffSchema, emitSchemaSql, type SchemaChange } from './schema-diff';
|
|
25
25
|
|
|
26
26
|
export interface GenerateOptions {
|
|
27
27
|
/** The Postgres schema the Models live in. Default: `public`. */
|
package/src/cli/model-api.ts
CHANGED
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
// --- data layer: compile, introspect, diff, render -------------------------
|
|
18
|
-
export * from './schema-compile
|
|
19
|
-
export * from './schema-introspect
|
|
20
|
-
export * from './schema-diff
|
|
21
|
-
export * from './schema-source
|
|
22
|
-
export * from './model-render
|
|
23
|
-
export * from './migration-compile
|
|
24
|
-
export * from './migration-generate
|
|
18
|
+
export * from './schema-compile';
|
|
19
|
+
export * from './schema-introspect';
|
|
20
|
+
export * from './schema-diff';
|
|
21
|
+
export * from './schema-source';
|
|
22
|
+
export * from './model-render';
|
|
23
|
+
export * from './migration-compile';
|
|
24
|
+
export * from './migration-generate';
|
|
25
25
|
|
|
26
26
|
// --- authz layer: contract compile/introspect/diff/reconcile ---------------
|
|
27
|
-
export * from './authz-compile
|
|
28
|
-
export * from './authz-contract
|
|
29
|
-
export * from './authz-reconcile
|
|
27
|
+
export * from './authz-compile';
|
|
28
|
+
export * from './authz-contract';
|
|
29
|
+
export * from './authz-reconcile';
|
|
30
30
|
|
|
31
31
|
// --- red-team: grant enforcement + owner isolation -------------------------
|
|
32
|
-
export * from './authz-redteam
|
|
33
|
-
export * from './authz-owner-probe
|
|
32
|
+
export * from './authz-redteam';
|
|
33
|
+
export * from './authz-owner-probe';
|
|
34
34
|
|
|
35
35
|
// --- the SECDEF function catalog the contract introspection needs -----------
|
|
36
|
-
export { FUNCTIONS_SQL, catalogFunctionToDescriptor } from './security-catalog
|
|
36
|
+
export { FUNCTIONS_SQL, catalogFunctionToDescriptor } from './security-catalog';
|
|
37
37
|
|
|
38
38
|
// --- how you HAND a database to the VERIFY calls ---------------------------
|
|
39
39
|
// `introspectSchema` and `introspectContract` take a `SessionRunner`, not a `QueryRunner`:
|
|
@@ -47,7 +47,7 @@ export { FUNCTIONS_SQL, catalogFunctionToDescriptor } from './security-catalog.j
|
|
|
47
47
|
// `sessionRunnerOver(sql)` wraps a postgres.js client whose pool is a SINGLE connection.
|
|
48
48
|
// `INTROSPECTION_SESSION` is the options both introspections expect — read only, repeatable
|
|
49
49
|
// read, canonical `search_path`. Pass it through; do not re-derive it.
|
|
50
|
-
export { sessionRunnerOver } from './db-source
|
|
50
|
+
export { sessionRunnerOver } from './db-source';
|
|
51
51
|
export {
|
|
52
52
|
INTROSPECTION_SESSION,
|
|
53
53
|
borrowedSessionRunner,
|
|
@@ -57,11 +57,11 @@ export {
|
|
|
57
57
|
type SessionStatement,
|
|
58
58
|
type SessionOptions,
|
|
59
59
|
type SessionResult,
|
|
60
|
-
} from './session
|
|
60
|
+
} from './session';
|
|
61
61
|
|
|
62
62
|
// --- databases FROM the declared state: ephemeral test DBs + the builder ----
|
|
63
63
|
// `createEphemeralDatabase(adminUrl, models, { sources })` is the packaged
|
|
64
64
|
// create-sync-drop shape for consumer test suites: a fresh database at the
|
|
65
65
|
// declared state (state + authz + derived), verified to fingerprint MATCH,
|
|
66
66
|
// dropped when you're done — never long-lived, never poisoned.
|
|
67
|
-
export * from './db-build
|
|
67
|
+
export * from './db-build';
|
package/src/cli/model-render.ts
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* Pure and deterministic — the command shell (commands/db-pull.ts) does the IO.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type { SchemaSnapshot, TableSchema, ColumnSchema, CheckConstraint } from './schema-introspect
|
|
19
|
-
import type { DerivedRenderResult } from './derived-render
|
|
20
|
-
import type { TableContract } from './authz-contract
|
|
21
|
-
import { deriveAbilities, renderDerivedAbilities } from './authz-derive
|
|
22
|
-
import { normalizeDefault, normalizeCheck } from './schema-diff
|
|
23
|
-
import { generatedIndexName, generatedForeignKeyName } from './schema-compile
|
|
18
|
+
import type { SchemaSnapshot, TableSchema, ColumnSchema, CheckConstraint } from './schema-introspect';
|
|
19
|
+
import type { DerivedRenderResult } from './derived-render';
|
|
20
|
+
import type { TableContract } from './authz-contract';
|
|
21
|
+
import { deriveAbilities, renderDerivedAbilities } from './authz-derive';
|
|
22
|
+
import { normalizeDefault, normalizeCheck } from './schema-diff';
|
|
23
|
+
import { generatedIndexName, generatedForeignKeyName } from './schema-compile';
|
|
24
24
|
// The soft-delete RULE itself — one boolean combination, shared with `defineModel`'s refusal.
|
|
25
25
|
// Only the FACT EXTRACTION is duplicated here (this renderer holds text, not descriptors);
|
|
26
26
|
// the rule is not, so the two surfaces cannot drift on when a declaration is required.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* lives in `pg_locks`, discoverable from the catalog rather than bookkeeping that can lie.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import type { QueryRunner } from './authz-contract
|
|
23
|
+
import type { QueryRunner } from './authz-contract';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The fixed lease key: `('ES','TK')` as two 16-bit ints — 0x4553, 0x544B. One key covers
|
package/src/cli/observability.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* pulls React Native (admin/ui) through its peer graph — wrong for a standalone CLI.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { listS3, getFromS3 } from './aws
|
|
20
|
+
import { listS3, getFromS3 } from './aws';
|
|
21
21
|
|
|
22
22
|
/** Severity ordering — mirrors LogLevel in @everystack/logging core/types. */
|
|
23
23
|
const LOG_LEVELS: Record<string, number> = {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* deliberate follow-on, not a silent default.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { quoteQualified } from './pg-ident
|
|
17
|
-
import type { SourceObject } from './derived-source
|
|
16
|
+
import { quoteQualified } from './pg-ident';
|
|
17
|
+
import type { SourceObject } from './derived-source';
|
|
18
18
|
|
|
19
19
|
export type RefreshRunner = (sql: string) => Promise<any[]>;
|
|
20
20
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* idempotent: unchanged project → byte-identical output.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { ProjectReality } from './detect
|
|
13
|
-
import { parseRunbook, composeRunbook, sha8, type Block } from './markers
|
|
14
|
-
import { buildStructure, headerStamp, PLACEHOLDER_PREFIX, type RunbookContext } from './sections
|
|
12
|
+
import type { ProjectReality } from './detect';
|
|
13
|
+
import { parseRunbook, composeRunbook, sha8, type Block } from './markers';
|
|
14
|
+
import { buildStructure, headerStamp, PLACEHOLDER_PREFIX, type RunbookContext } from './sections';
|
|
15
15
|
|
|
16
16
|
export interface RunbookResult {
|
|
17
17
|
text: string;
|
package/src/cli/runbook/index.ts
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* expect(status).toBe('current');
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export * from './detect
|
|
15
|
-
export * from './markers
|
|
16
|
-
export * from './sections
|
|
17
|
-
export * from './generate
|
|
18
|
-
export * from './model-section
|
|
19
|
-
export { runRunbook, checkRunbook, diffSummary } from '../commands/runbook
|
|
20
|
-
export type { RunbookRun, RunbookCheck, RunbookDiffSummary } from '../commands/runbook
|
|
14
|
+
export * from './detect';
|
|
15
|
+
export * from './markers';
|
|
16
|
+
export * from './sections';
|
|
17
|
+
export * from './generate';
|
|
18
|
+
export * from './model-section';
|
|
19
|
+
export { runRunbook, checkRunbook, diffSummary } from '../commands/runbook';
|
|
20
|
+
export type { RunbookRun, RunbookCheck, RunbookDiffSummary } from '../commands/runbook';
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* markdown) → same blocks, so `runbook --check` is trustworthy in CI.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { ProjectReality } from './detect
|
|
14
|
-
import type { Block } from './markers
|
|
13
|
+
import type { ProjectReality } from './detect';
|
|
14
|
+
import type { Block } from './markers';
|
|
15
15
|
|
|
16
16
|
export interface RunbookContext {
|
|
17
17
|
cliVersion: string;
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import type { ModelDescriptor, FieldSpec, SequenceDescriptor } from '@everystack/model';
|
|
23
|
-
import type { TableSchema, EnumType, SequenceSchema, UniqueConstraint, CheckConstraint, IndexSchema, ForeignKey } from './schema-introspect
|
|
24
|
-
import { nextvalSequence, identityClause, type RenameMap } from './schema-diff
|
|
25
|
-
import { normalizeDeparsedExpr } from './deparse-normal
|
|
23
|
+
import type { TableSchema, EnumType, SequenceSchema, UniqueConstraint, CheckConstraint, IndexSchema, ForeignKey } from './schema-introspect';
|
|
24
|
+
import { nextvalSequence, identityClause, type RenameMap } from './schema-diff';
|
|
25
|
+
import { normalizeDeparsedExpr } from './deparse-normal';
|
|
26
26
|
|
|
27
27
|
/** `authorId` -> `author_id`. SQL identifiers are snake_case. */
|
|
28
28
|
export function toSnakeCase(name: string): string {
|
|
@@ -606,7 +606,7 @@ export function compileSequences(sequences: readonly SequenceDescriptor[]): Sequ
|
|
|
606
606
|
|
|
607
607
|
// The DDL renderer lives in schema-diff (emitOne needs it; this file already imports
|
|
608
608
|
// schema-diff, so defining it there avoids a cycle) — re-exported here beside its compiler.
|
|
609
|
-
export { sequenceCreateSql } from './schema-diff
|
|
609
|
+
export { sequenceCreateSql } from './schema-diff';
|
|
610
610
|
|
|
611
611
|
/**
|
|
612
612
|
* Foreign-key constraints for a model — its `.references()` fields and its table-level
|
package/src/cli/schema-diff.ts
CHANGED
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
52
|
import { createHash } from 'node:crypto';
|
|
53
|
-
import { canonicalAuthz } from './authz-canonical
|
|
53
|
+
import { canonicalAuthz } from './authz-canonical';
|
|
54
54
|
import type { ModelDescriptor, SequenceDescriptor } from '@everystack/model';
|
|
55
|
-
import type { SchemaSnapshot, TableSchema } from './schema-introspect
|
|
56
|
-
import type { AuthzContract, TableContract } from './authz-contract
|
|
57
|
-
import { compileTableSchema, compileEnums, compileSequences } from './schema-compile
|
|
58
|
-
import { compileTableContract } from './authz-compile
|
|
59
|
-
import { governedRoleSet } from './authz-reconcile
|
|
60
|
-
import { normalizeDefault, normalizeCheck, indexKey } from './schema-diff
|
|
55
|
+
import type { SchemaSnapshot, TableSchema } from './schema-introspect';
|
|
56
|
+
import type { AuthzContract, TableContract } from './authz-contract';
|
|
57
|
+
import { compileTableSchema, compileEnums, compileSequences } from './schema-compile';
|
|
58
|
+
import { compileTableContract } from './authz-compile';
|
|
59
|
+
import { governedRoleSet } from './authz-reconcile';
|
|
60
|
+
import { normalizeDefault, normalizeCheck, indexKey } from './schema-diff';
|
|
61
61
|
|
|
62
62
|
// v2: expression fields (defaults, checks, partial-index WHERE) normalize through
|
|
63
63
|
// the diff's pg-deparse normalizers before hashing, so the model form and the live
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* 'numeric(12,2)', 'uuid' the Model compiler also emits), so the two sides diff.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { IGNORED_SCHEMAS, coerceBool, type QueryRunner } from './authz-contract
|
|
17
|
-
import { INTROSPECTION_SESSION, type SessionRunner } from './session
|
|
18
|
-
import { normalizeDeparsedExpr } from './deparse-normal
|
|
16
|
+
import { IGNORED_SCHEMAS, coerceBool, type QueryRunner } from './authz-contract';
|
|
17
|
+
import { INTROSPECTION_SESSION, type SessionRunner } from './session';
|
|
18
|
+
import { normalizeDeparsedExpr } from './deparse-normal';
|
|
19
19
|
|
|
20
20
|
// ---------------------------------------------------------------------------
|
|
21
21
|
// The data-layer snapshot — the structured shape both producers target.
|
package/src/cli/schema-source.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import type { ModelDescriptor, FieldSpec, DerivedDescriptor, ViewDescriptor, MaterializedViewDescriptor } from '@everystack/model';
|
|
29
|
-
import { parseQualified } from './derived-source
|
|
29
|
+
import { parseQualified } from './derived-source';
|
|
30
30
|
|
|
31
31
|
/** `author_id` is the SQL identifier; `authorId` the field key. The single snake-case rule. */
|
|
32
32
|
function toSnakeCase(name: string): string {
|
package/src/cli/schema-swap.ts
CHANGED
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
import type { ModelDescriptor } from '@everystack/model';
|
|
34
|
-
import { modelForeignKeys, qualifiedTable } from './schema-compile
|
|
35
|
-
import { compileTableContract } from './authz-compile
|
|
36
|
-
import { emitSwapAuthzSql } from './authz-reconcile
|
|
37
|
-
import { schemaOf } from './schema-fingerprint
|
|
34
|
+
import { modelForeignKeys, qualifiedTable } from './schema-compile';
|
|
35
|
+
import { compileTableContract } from './authz-compile';
|
|
36
|
+
import { emitSwapAuthzSql } from './authz-reconcile';
|
|
37
|
+
import { schemaOf } from './schema-fingerprint';
|
|
38
38
|
|
|
39
39
|
const SAFE_SCHEMA = /^[a-z_][a-z0-9_$]*$/;
|
|
40
40
|
|