@rehearsal-db/core 0.1.0-beta.15 → 0.1.0-beta.17
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 +47 -1
- package/dist/package.json +10 -9
- package/dist/src/application/interactive_task.d.mts +30 -0
- package/dist/src/application/interactive_task.mjs +83 -0
- package/dist/src/application/session.d.mts +1 -0
- package/dist/src/baseline/privacy_contract.d.mts +147 -0
- package/dist/src/baseline/privacy_contract.mjs +2 -0
- package/dist/src/baseline/privacy_dependency_graph.d.mts +7 -0
- package/dist/src/baseline/privacy_dependency_graph.mjs +110 -0
- package/dist/src/baseline/privacy_engine.d.mts +5 -162
- package/dist/src/baseline/privacy_engine.mjs +4 -1162
- package/dist/src/baseline/privacy_key.d.mts +7 -0
- package/dist/src/baseline/privacy_key.mjs +42 -0
- package/dist/src/baseline/privacy_pipeline.d.mts +7 -0
- package/dist/src/baseline/privacy_pipeline.mjs +127 -0
- package/dist/src/baseline/privacy_policy.d.mts +6 -0
- package/dist/src/baseline/privacy_policy.mjs +237 -0
- package/dist/src/baseline/privacy_recipe_validation.d.mts +5 -0
- package/dist/src/baseline/privacy_recipe_validation.mjs +289 -0
- package/dist/src/baseline/privacy_rule_registry.d.mts +18 -0
- package/dist/src/baseline/privacy_rule_registry.mjs +143 -0
- package/dist/src/baseline/privacy_transforms.d.mts +18 -0
- package/dist/src/baseline/privacy_transforms.mjs +142 -0
- package/dist/src/baseline/privacy_validation_shared.d.mts +31 -0
- package/dist/src/baseline/privacy_validation_shared.mjs +127 -0
- package/dist/src/cli/application_command_handlers.d.mts +8 -0
- package/dist/src/cli/application_command_handlers.mjs +52 -0
- package/dist/src/cli/arguments.d.mts +0 -5
- package/dist/src/cli/arguments.mjs +2 -7
- package/dist/src/cli/basic_command_handlers.d.mts +4 -0
- package/dist/src/cli/basic_command_handlers.mjs +57 -0
- package/dist/src/cli/cli_commands.d.mts +14 -0
- package/dist/src/cli/cli_commands.mjs +34 -0
- package/dist/src/cli/command_contract.d.mts +57 -0
- package/dist/src/cli/command_contract.mjs +39 -0
- package/dist/src/cli/command_output.d.mts +12 -0
- package/dist/src/cli/command_output.mjs +20 -0
- package/dist/src/cli/command_registry.d.mts +7 -0
- package/dist/src/cli/command_registry.mjs +14 -0
- package/dist/src/cli/guided.d.mts +3 -1
- package/dist/src/cli/guided.mjs +21 -7
- package/dist/src/cli/identity_command_handlers.d.mts +12 -0
- package/dist/src/cli/identity_command_handlers.mjs +239 -0
- package/dist/src/cli/identity_renderer.d.mts +8 -0
- package/dist/src/cli/identity_renderer.mjs +33 -0
- package/dist/src/cli/init_command.d.mts +1 -1
- package/dist/src/cli/inspection_command_handlers.d.mts +3 -0
- package/dist/src/cli/inspection_command_handlers.mjs +79 -0
- package/dist/src/cli/project_command_handlers.d.mts +11 -0
- package/dist/src/cli/project_command_handlers.mjs +92 -0
- package/dist/src/cli/project_commands.d.mts +131 -5
- package/dist/src/cli/project_commands.mjs +17 -8
- package/dist/src/cli/rehearsal.d.mts +2 -2
- package/dist/src/cli/rehearsal.mjs +51 -567
- package/dist/src/cli/runtime_action_handlers.d.mts +12 -0
- package/dist/src/cli/runtime_action_handlers.mjs +201 -0
- package/dist/src/cli/runtime_commands.d.mts +32 -3
- package/dist/src/cli/runtime_commands.mjs +33 -13
- package/dist/src/cli/source_command_handlers.d.mts +8 -0
- package/dist/src/cli/source_command_handlers.mjs +62 -0
- package/dist/src/cli/source_commands.d.mts +5 -1
- package/dist/src/cli/source_commands.mjs +3 -1
- package/dist/src/identity/claim.d.mts +5 -144
- package/dist/src/identity/claim.mjs +4 -947
- package/dist/src/identity/claim_contract.d.mts +135 -0
- package/dist/src/identity/claim_contract.mjs +6 -0
- package/dist/src/identity/claim_executor.d.mts +10 -0
- package/dist/src/identity/claim_executor.mjs +358 -0
- package/dist/src/identity/claim_identity_lookup.d.mts +23 -0
- package/dist/src/identity/claim_identity_lookup.mjs +134 -0
- package/dist/src/identity/claim_plan.d.mts +8 -0
- package/dist/src/identity/claim_plan.mjs +61 -0
- package/dist/src/identity/claim_policy.d.mts +3 -0
- package/dist/src/identity/claim_policy.mjs +377 -0
- package/dist/src/identity/claim_sql.d.mts +10 -0
- package/dist/src/identity/claim_sql.mjs +46 -0
- package/dist/src/identity/claim_verification.d.mts +13 -0
- package/dist/src/identity/claim_verification.mjs +35 -0
- package/dist/src/identity/connect.d.mts +30 -0
- package/dist/src/identity/connect.mjs +111 -0
- package/dist/src/index.d.mts +1 -1
- package/dist/src/project/configuration.d.mts +11 -179
- package/dist/src/project/configuration.mjs +7 -956
- package/dist/src/project/configuration_contract.d.mts +125 -0
- package/dist/src/project/configuration_contract.mjs +27 -0
- package/dist/src/project/configuration_discovery.d.mts +7 -0
- package/dist/src/project/configuration_discovery.mjs +37 -0
- package/dist/src/project/configuration_normalization.d.mts +107 -0
- package/dist/src/project/configuration_normalization.mjs +302 -0
- package/dist/src/project/configuration_rendering.d.mts +14 -0
- package/dist/src/project/configuration_rendering.mjs +226 -0
- package/dist/src/project/configuration_resolution.d.mts +125 -0
- package/dist/src/project/configuration_resolution.mjs +81 -0
- package/dist/src/project/configuration_schema.d.mts +22 -0
- package/dist/src/project/configuration_schema.mjs +160 -0
- package/dist/src/project/configuration_validation.d.mts +22 -0
- package/dist/src/project/configuration_validation.mjs +136 -0
- package/dist/src/project/project_detection.d.mts +14 -0
- package/dist/src/project/project_detection.mjs +47 -0
- package/dist/src/runtime/lifecycle_engine.d.mts +63 -0
- package/dist/src/runtime/lifecycle_engine.mjs +114 -0
- package/dist/src/runtime/plan.mjs +2 -1
- package/dist/src/targets/postgresql.mjs +142 -163
- package/dist/src/targets/supabase.mjs +142 -174
- package/docs/architecture.md +120 -3
- package/docs/commands.md +18 -15
- package/docs/configuration.md +1 -0
- package/docs/releasing.md +8 -3
- package/docs/runtime-policies.md +12 -3
- package/docs/troubleshooting.md +17 -0
- package/docs/typescript.md +57 -10
- package/package.json +10 -9
- package/types/configuration.d.mts +5 -164
|
@@ -10,14 +10,14 @@ import { runRehearsalDoctor } from "../runtime/plan.mjs";
|
|
|
10
10
|
import { loadRuntimeTopology } from "../runtime/topology.mjs";
|
|
11
11
|
const isCleanupStackPlan = (plan) => "targets" in plan;
|
|
12
12
|
export const createProjectCommands = ({ projectRoot, runManager, }) => {
|
|
13
|
-
const runSetup = async ({ flags, planOptions, }) => {
|
|
13
|
+
const runSetup = async ({ flags, planOptions, session, }) => {
|
|
14
14
|
const setupTarget = flags.target === "supabase" || flags.target === "postgresql"
|
|
15
15
|
? flags.target
|
|
16
16
|
: undefined;
|
|
17
17
|
if (flags.target !== undefined && setupTarget === undefined) {
|
|
18
18
|
throw new Error("--target must be supabase or postgresql.");
|
|
19
19
|
}
|
|
20
|
-
const plan =
|
|
20
|
+
const plan = session?.setupPlan ??
|
|
21
21
|
(await planRehearsalSetup({
|
|
22
22
|
projectRoot,
|
|
23
23
|
...(planOptions.configPath === undefined
|
|
@@ -49,11 +49,11 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
|
|
|
49
49
|
].join("\n"),
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
const runBaselinePreparation = async ({ flags, planOptions, }) => {
|
|
52
|
+
const runBaselinePreparation = async ({ flags, planOptions, session, }) => {
|
|
53
53
|
if (!flags.recordsPath || !flags.ledgerPath) {
|
|
54
54
|
throw new Error("baseline prepare requires --records and --ledger input paths.");
|
|
55
55
|
}
|
|
56
|
-
const plan =
|
|
56
|
+
const plan = session?.preparationPlan ??
|
|
57
57
|
(await planBaselinePreparation({
|
|
58
58
|
...planOptions,
|
|
59
59
|
recordsPath: flags.recordsPath,
|
|
@@ -98,8 +98,8 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
|
|
|
98
98
|
targets,
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
const runCleanup = async ({ flags, planOptions, }) => {
|
|
102
|
-
const plan =
|
|
101
|
+
const runCleanup = async ({ flags, planOptions, session, }) => {
|
|
102
|
+
const plan = session?.cleanupPlan ??
|
|
103
103
|
(await planRuntimeStackCleanup({ flags, planOptions }));
|
|
104
104
|
if (!flags.write)
|
|
105
105
|
return { mode: "preview", plan };
|
|
@@ -156,15 +156,23 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
|
|
|
156
156
|
});
|
|
157
157
|
return { mode: "written", plan, applied };
|
|
158
158
|
};
|
|
159
|
-
const
|
|
159
|
+
const loadIdentityPolicy = async ({ planOptions }) => {
|
|
160
160
|
const loaded = await loadRehearsalConfig(planOptions);
|
|
161
161
|
if (!loaded.paths.identityPolicy) {
|
|
162
162
|
throw new Error("No config.identityPolicy is configured.");
|
|
163
163
|
}
|
|
164
|
+
const policy = validateIdentityPolicy(JSON.parse(await readFile(loaded.paths.identityPolicy, "utf8")));
|
|
165
|
+
return { loaded, policy };
|
|
166
|
+
};
|
|
167
|
+
const loadIdentityClaimPlan = async ({ flags, planOptions, session, }) => {
|
|
168
|
+
const { loaded, policy } = await loadIdentityPolicy({
|
|
169
|
+
flags,
|
|
170
|
+
planOptions,
|
|
171
|
+
...(session === undefined ? {} : { session }),
|
|
172
|
+
});
|
|
164
173
|
if (!flags.identityName) {
|
|
165
174
|
throw new Error("Choose a declared identity with --identity=<name>.");
|
|
166
175
|
}
|
|
167
|
-
const policy = validateIdentityPolicy(JSON.parse(await readFile(loaded.paths.identityPolicy, "utf8")));
|
|
168
176
|
return {
|
|
169
177
|
loaded,
|
|
170
178
|
plan: createIdentityClaimPlan({
|
|
@@ -175,6 +183,7 @@ export const createProjectCommands = ({ projectRoot, runManager, }) => {
|
|
|
175
183
|
};
|
|
176
184
|
return Object.freeze({
|
|
177
185
|
loadIdentityClaimPlan,
|
|
186
|
+
loadIdentityPolicy,
|
|
178
187
|
planRuntimeStackCleanup,
|
|
179
188
|
runBaselinePreparation,
|
|
180
189
|
runCleanup,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Purpose:
|
|
4
|
-
*
|
|
3
|
+
* Purpose: Parse one CLI request, protect project mutations, and delegate to
|
|
4
|
+
* the typed command registry shared by scripted and guided flows.
|
|
5
5
|
* Run: `npm run rehearsal -- doctor` or `npm run rehearsal -- explain`.
|
|
6
6
|
*/
|
|
7
7
|
export {};
|