@simetrajs/designer 0.3.0-next.1 → 0.3.0-next.2
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/dist/{command-CHk1P9Dp.js → command-W8Mnvc9E.js} +13 -2
- package/dist/{invoke-BwP_5iN6.js → invoke-DLCOtVpB.js} +78 -9
- package/dist/main.js +3 -3
- package/dist/{mcp-jLOz0W7f.js → mcp-DYYIww-s.js} +6 -4
- package/dist/{package-hA0J8AMK.js → package-CN8Tgd0H.js} +1 -1
- package/package.json +3 -2
- package/skills/simetra-metadata/references/people-and-rights.md +21 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as toolByName, c as writeChanges, d as parseDataLaunch, f as databaseResource, i as structureOf, l as checkEnvName, o as formatDiagnostics, r as presentation, s as isMetadataFile, t as invoke, u as dataResource } from "./invoke-
|
|
2
|
+
import { a as toolByName, c as writeChanges, d as parseDataLaunch, f as databaseResource, i as structureOf, l as checkEnvName, o as formatDiagnostics, r as presentation, s as isMetadataFile, t as invoke, u as dataResource } from "./invoke-DLCOtVpB.js";
|
|
3
3
|
import { i as DEFAULT_DATABASE_URL_ENV, n as trimSlash, p as UsageError, t as DEFAULT_DIR } from "./default-dir-DerxTbci.js";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import { mkdtemp, readdir, rm, stat } from "node:fs/promises";
|
|
@@ -290,10 +290,14 @@ async function cliInput(tool, args, stdin) {
|
|
|
290
290
|
input: args.tables === void 0 ? {} : { tables: list("tables", args.tables) },
|
|
291
291
|
dirs: [trimSlash(positional[0] ?? "./metadata")]
|
|
292
292
|
};
|
|
293
|
-
if (tool.name === "plan"
|
|
293
|
+
if (tool.name === "plan") return {
|
|
294
294
|
input: {},
|
|
295
295
|
dirs: [trimSlash(positional[0] ?? "./metadata")]
|
|
296
296
|
};
|
|
297
|
+
if (tool.name === "roles") return {
|
|
298
|
+
input: args["dev-passwords"] === true ? { devPasswords: true } : {},
|
|
299
|
+
dirs: [trimSlash(positional[0] ?? "./metadata")]
|
|
300
|
+
};
|
|
297
301
|
if (tool.name === "apply") {
|
|
298
302
|
const plan = positional[0];
|
|
299
303
|
if (plan === void 0) throw new UsageError("apply needs the plan file: simetra apply <plans/….plan.json> [dir] --plan-hash <hex> --yes.");
|
|
@@ -465,6 +469,7 @@ async function runTool(tool, argv, stdin = readStdin, cwd = process.cwd(), env =
|
|
|
465
469
|
channel: "cli",
|
|
466
470
|
database,
|
|
467
471
|
databaseEnv,
|
|
472
|
+
env,
|
|
468
473
|
...baseline === void 0 ? {} : { baseline }
|
|
469
474
|
});
|
|
470
475
|
if (result.refusal !== void 0) return fail(result.refusal.message);
|
|
@@ -604,6 +609,11 @@ function argsFor(tool) {
|
|
|
604
609
|
description: `statement_timeout of the apply transaction (default ${DEFAULT_APPLY_TIMEOUTS.statementTimeoutMs})`
|
|
605
610
|
};
|
|
606
611
|
}
|
|
612
|
+
if (tool.name === "roles") args["dev-passwords"] = {
|
|
613
|
+
type: "boolean",
|
|
614
|
+
default: false,
|
|
615
|
+
description: "Postgres provider, a database on this machine only: set the passwords of the login roles this run creates from SIMETRA_OWNER_DEV_PASSWORD, SIMETRA_AUTH_DEV_PASSWORD, SIMETRA_RUNTIME_DEV_PASSWORD and SIMETRA_SIGNALS_DEV_PASSWORD"
|
|
616
|
+
};
|
|
607
617
|
if (tool.database !== "none") {
|
|
608
618
|
args["database-url-env"] = {
|
|
609
619
|
type: "string",
|
|
@@ -680,6 +690,7 @@ function toCliArgs(args) {
|
|
|
680
690
|
"plan-hash": str(args["plan-hash"]),
|
|
681
691
|
allow: str(args.allow),
|
|
682
692
|
rehearse: args.rehearse === true,
|
|
693
|
+
"dev-passwords": args["dev-passwords"] === true,
|
|
683
694
|
"lock-timeout-ms": str(args["lock-timeout-ms"]),
|
|
684
695
|
"statement-timeout-ms": str(args["statement-timeout-ms"]),
|
|
685
696
|
"data-url-env": str(args["data-url-env"]),
|
|
@@ -4,7 +4,7 @@ import { a as dataWriteHint, c as noDatabaseHint, d as installedPackageDir, f as
|
|
|
4
4
|
import { a as ShadowTemplateMissingError, i as ShadowServerMismatchError, n as ShadowCreateRefusedError, o as shadowDropOf, r as ShadowServerError, t as ShadowBaseUnsupportedError } from "./errors-D1P2kKbL.js";
|
|
5
5
|
import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
7
|
-
import { ATTRIBUTE_CASES, CENTRIFUGO_CHANNEL_MAX, CommandFailure, DATABASE_PROVIDERS, FUNCTIONS_FILE_SUFFIX, PLATFORM_LOGIN_ROLES, PLATFORM_ROLES, PLATFORM_SCHEMA, PROVIDER_API_ROLES, PROVIDER_IDENTITY_SOURCES, PROVIDER_SCHEMAS, SIGNAL_MERGE_THRESHOLD, SIGNAL_NOTIFY_CHANNEL, SIGNAL_OUTBOX, SQL_DEBT_FILE, UUID_TEXT, batchSchema, logicalTypeOf, metadataKindSchema, objectNameSchema, quoteIdent, readQuerySchema } from "simetra/model";
|
|
7
|
+
import { ATTRIBUTE_CASES, CENTRIFUGO_CHANNEL_MAX, CommandFailure, DATABASE_PROVIDERS, FUNCTIONS_FILE_SUFFIX, PLATFORM_LOGIN_ROLES, PLATFORM_ROLES, PLATFORM_SCHEMA, PROVIDER_API_ROLES, PROVIDER_IDENTITY_SOURCES, PROVIDER_LOGIN_ROLES, PROVIDER_OWNER_ROLES, PROVIDER_SCHEMAS, SIGNAL_MERGE_THRESHOLD, SIGNAL_NOTIFY_CHANNEL, SIGNAL_OUTBOX, SQL_DEBT_FILE, UUID_TEXT, batchSchema, logicalTypeOf, metadataKindSchema, objectNameSchema, quoteIdent, readQuerySchema } from "simetra/model";
|
|
8
8
|
import { ApplyConnectionLost, ApplyDbError, FINGERPRINT_VERSION, LOCK_MODE_SQL, PLATFORM_VERSION, applyStateOf, buildPlan, checkOwnerAttributes, checkOwnerMembership, checkPermissions, checkPlatformRoles, compareWithDesired, copiesShadowFromTemplate, desiredForApply, engineScope, ensurePlatformRoles, ensurePostgresCluster, executePlan, folderReference, parsePlan, parseRehearsal, planFileName, platformRoleSet, postgresClusterSet, readShadowEnvironment, rehearsalFileName, rehearsalReport, reverseGenerate, runRightsMaintenance, serializePlan, serializeRehearsal, verifyPlanHash } from "simetra/schema";
|
|
9
9
|
import pg from "pg";
|
|
10
10
|
import { agentWriteRefusal, createAgentCore, createCommandRuntime, fromPgPool, readRoleOf, toJson } from "simetra/server";
|
|
@@ -2052,6 +2052,60 @@ const rightsMaintenanceTool = defineTool({
|
|
|
2052
2052
|
});
|
|
2053
2053
|
// src/tools/roles-tool.ts
|
|
2054
2054
|
const PROJECT_FILE$1 = "project.meta.json";
|
|
2055
|
+
const [AUTH_ROLE] = PROVIDER_LOGIN_ROLES.postgres;
|
|
2056
|
+
if (AUTH_ROLE === void 0) throw new Error("the postgres profile data has no auth login role");
|
|
2057
|
+
/**
|
|
2058
|
+
* Змінні середовища з паролями розробника ролей входу профілю `postgres`
|
|
2059
|
+
* (спека профілю §3.4): імена ролей — з даних T0, змінні — ті самі, що в
|
|
2060
|
+
* стеку розробки (`login-secrets.env`).
|
|
2061
|
+
*/
|
|
2062
|
+
const DEV_PASSWORD_VARIABLES = [
|
|
2063
|
+
{
|
|
2064
|
+
role: PROVIDER_OWNER_ROLES.postgres,
|
|
2065
|
+
variable: "SIMETRA_OWNER_DEV_PASSWORD"
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
2068
|
+
role: AUTH_ROLE,
|
|
2069
|
+
variable: "SIMETRA_AUTH_DEV_PASSWORD"
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
role: PLATFORM_LOGIN_ROLES.runtime,
|
|
2073
|
+
variable: "SIMETRA_RUNTIME_DEV_PASSWORD"
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
role: PLATFORM_LOGIN_ROLES.signals,
|
|
2077
|
+
variable: "SIMETRA_SIGNALS_DEV_PASSWORD"
|
|
2078
|
+
}
|
|
2079
|
+
];
|
|
2080
|
+
/**
|
|
2081
|
+
* Паролі розробника за роллю або відмови до будь-якого з'єднання: хост, який
|
|
2082
|
+
* візьме `pg` (`?host=`, `PGHOST` теж), — лише ця машина, бо відомий пароль
|
|
2083
|
+
* на спільному сервері відкрив би його; кожна змінна задана й не порожня.
|
|
2084
|
+
* Значення в діагностики не потрапляють — лише імена змінних і хост.
|
|
2085
|
+
*/
|
|
2086
|
+
function devPasswordsFrom(env, url) {
|
|
2087
|
+
const diagnostics = [];
|
|
2088
|
+
let host;
|
|
2089
|
+
try {
|
|
2090
|
+
host = new pg.Client({ connectionString: url }).host;
|
|
2091
|
+
} catch {
|
|
2092
|
+
host = void 0;
|
|
2093
|
+
}
|
|
2094
|
+
if (!isLocalHost(host)) diagnostics.push(diagnostic("roles.dev-passwords-remote", "", "", { host: host === void 0 || host === "" ? "(none)" : host }));
|
|
2095
|
+
const passwords = /* @__PURE__ */ new Map();
|
|
2096
|
+
for (const { role, variable } of DEV_PASSWORD_VARIABLES) {
|
|
2097
|
+
const value = env[variable];
|
|
2098
|
+
if (value === void 0 || value === "") diagnostics.push(diagnostic("roles.dev-password-missing", "", "", { variable }));
|
|
2099
|
+
else passwords.set(role, value);
|
|
2100
|
+
}
|
|
2101
|
+
return diagnostics.length > 0 ? {
|
|
2102
|
+
ok: false,
|
|
2103
|
+
diagnostics
|
|
2104
|
+
} : {
|
|
2105
|
+
ok: true,
|
|
2106
|
+
passwords
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2055
2109
|
/**
|
|
2056
2110
|
* Набір ролей теки проєкту (спека П4 §6.2): провайдер — з файлу проєкту, тим самим
|
|
2057
2111
|
* читачем, що й `compile`. Без файлу ролі входу пропускаються явно — пропуск
|
|
@@ -2112,7 +2166,12 @@ function clusterRoles(value) {
|
|
|
2112
2166
|
* ціль і шаблон; окремий сервер тіней там не підтримано.
|
|
2113
2167
|
* Решта провайдерів і проєкт без файлу — ролі на цілі й на сервері тіні.
|
|
2114
2168
|
*/
|
|
2115
|
-
async function runRoles(dbs, db, project) {
|
|
2169
|
+
async function runRoles(dbs, db, project, options = {}) {
|
|
2170
|
+
if (options.devPasswords !== void 0 && project.provider !== "postgres") return {
|
|
2171
|
+
roles: [],
|
|
2172
|
+
skipped: [],
|
|
2173
|
+
diagnostics: [diagnostic("roles.dev-passwords-unsupported", "", "", project.provider === void 0 ? {} : { provider: project.provider })]
|
|
2174
|
+
};
|
|
2116
2175
|
if (project.provider === "postgres") {
|
|
2117
2176
|
if (db.shadowBase !== void 0) return {
|
|
2118
2177
|
roles: [],
|
|
@@ -2129,13 +2188,19 @@ async function runRoles(dbs, db, project) {
|
|
|
2129
2188
|
error: "the database address names no database"
|
|
2130
2189
|
})]
|
|
2131
2190
|
};
|
|
2191
|
+
const dev = options.devPasswords === void 0 ? void 0 : devPasswordsFrom(options.devPasswords, db.target.url);
|
|
2192
|
+
if (dev?.ok === false) return {
|
|
2193
|
+
roles: [],
|
|
2194
|
+
skipped: [],
|
|
2195
|
+
diagnostics: dev.diagnostics
|
|
2196
|
+
};
|
|
2132
2197
|
const set = postgresClusterSet(database);
|
|
2133
2198
|
const { withDatabaseName } = await import("@supabase/pg-delta");
|
|
2134
2199
|
const result = await ensurePostgresCluster(dbs, {
|
|
2135
2200
|
maintenance: { url: withDatabaseName(db.target.url, "postgres") },
|
|
2136
2201
|
target: db.target,
|
|
2137
2202
|
template: { url: withDatabaseName(db.target.url, set.template) }
|
|
2138
|
-
}, set);
|
|
2203
|
+
}, set, dev === void 0 ? {} : { passwords: dev.passwords });
|
|
2139
2204
|
if (!result.ok) return {
|
|
2140
2205
|
roles: [],
|
|
2141
2206
|
skipped: [],
|
|
@@ -2147,7 +2212,8 @@ async function runRoles(dbs, db, project) {
|
|
|
2147
2212
|
name,
|
|
2148
2213
|
reason: "identity-table-missing"
|
|
2149
2214
|
})),
|
|
2150
|
-
diagnostics: []
|
|
2215
|
+
diagnostics: [],
|
|
2216
|
+
...dev === void 0 ? {} : { passwords: DEV_PASSWORD_VARIABLES.filter((v) => result.value.passwords?.includes(v.role)) }
|
|
2151
2217
|
};
|
|
2152
2218
|
}
|
|
2153
2219
|
const ran = await ensurePlatformRoles(dbs, [{
|
|
@@ -2171,13 +2237,13 @@ async function runRoles(dbs, db, project) {
|
|
|
2171
2237
|
*/
|
|
2172
2238
|
const rolesTool = defineTool({
|
|
2173
2239
|
name: "roles",
|
|
2174
|
-
description: "Create the platform roles: NOLOGIN roles that generated SQL grants to on the target and the shadow server, and the login roles (the runtime and the signals consumer) on the target only, each a member of its parents WITH INHERIT FALSE, SET TRUE; the signals login role also gets a role setting (ALTER ROLE … SET) that makes its consumer group the role of every new session. Reads
|
|
2175
|
-
input: z.strictObject({}),
|
|
2240
|
+
description: "Create the platform roles: NOLOGIN roles that generated SQL grants to on the target and the shadow server, and the login roles (the runtime and the signals consumer) on the target only, each a member of its parents WITH INHERIT FALSE, SET TRUE; the signals login role also gets a role setting (ALTER ROLE … SET) that makes its consumer group the role of every new session. Reads `database.provider` from the project file; without it the login roles are skipped, and the output says so. An existing role is only checked, its role setting included; the one change is a missing membership of an existing login role in a parent of its profile, added WITH INHERIT FALSE, SET TRUE and named in the output. Needs CREATEROLE, and ADMIN OPTION on every parent role of a login role (without it that login role alone is refused, a missing membership with the GRANT statement to run); refuses before creating anything when a server lacks CREATEROLE or a role has an unsafe shape. With the provider `postgres` it prepares the cluster instead, as a superuser (a superuser URL of the target database): the owner, auth, grant and request roles, the target database owned by the owner, the schemas `extensions` and `better_auth`, `plpgsql_check`, and the sealed template for shadows. It refuses before writing when the session is not a superuser, a database or role has an unsafe shape, a Simetra login role can connect to another database, or the server lacks plpgsql_check; a separate shadow server is not supported there. devPasswords (postgres, local database only) sets the password of each login role it creates from SIMETRA_{OWNER,AUTH,RUNTIME,SIGNALS}_DEV_PASSWORD.",
|
|
2241
|
+
input: z.strictObject({ devPasswords: z.boolean().optional() }),
|
|
2176
2242
|
files: "read",
|
|
2177
2243
|
database: "write",
|
|
2178
2244
|
data: "none",
|
|
2179
2245
|
destructive: false,
|
|
2180
|
-
async run({ dir, database }) {
|
|
2246
|
+
async run({ dir, database, env }, input) {
|
|
2181
2247
|
const set = await projectRoleSet(dir);
|
|
2182
2248
|
if (!set.ok) return {
|
|
2183
2249
|
ok: false,
|
|
@@ -2185,7 +2251,7 @@ const rolesTool = defineTool({
|
|
|
2185
2251
|
diagnostics: set.diagnostics
|
|
2186
2252
|
};
|
|
2187
2253
|
const { createApplyDatabase } = await import("./schema-engine-8rVHcVYO.js");
|
|
2188
|
-
const ran = await withDatabase(required$1(database), "roles", (db) => runRoles(createApplyDatabase({ readOnly: false }), db, set));
|
|
2254
|
+
const ran = await withDatabase(required$1(database), "roles", (db) => runRoles(createApplyDatabase({ readOnly: false }), db, set, input.devPasswords === true ? { devPasswords: env ?? {} } : {}));
|
|
2189
2255
|
if (!ran.ok) return {
|
|
2190
2256
|
ok: false,
|
|
2191
2257
|
changes: [],
|
|
@@ -2193,7 +2259,8 @@ const rolesTool = defineTool({
|
|
|
2193
2259
|
};
|
|
2194
2260
|
const data = {
|
|
2195
2261
|
roles: ran.value.roles,
|
|
2196
|
-
skipped: [...set.skipped, ...ran.value.skipped]
|
|
2262
|
+
skipped: [...set.skipped, ...ran.value.skipped],
|
|
2263
|
+
...ran.value.passwords === void 0 ? {} : { passwords: ran.value.passwords }
|
|
2197
2264
|
};
|
|
2198
2265
|
return {
|
|
2199
2266
|
ok: ran.value.diagnostics.length === 0,
|
|
@@ -2209,6 +2276,7 @@ const rolesTool = defineTool({
|
|
|
2209
2276
|
const at = x.name.lastIndexOf(":");
|
|
2210
2277
|
return `target: ${x.name.slice(0, at)}: ${x.name.slice(at + 1)} not granted yet — run the Better Auth migration, then simetra roles again`;
|
|
2211
2278
|
}),
|
|
2279
|
+
...(data.passwords ?? []).map((x) => `target: ${x.role} password set from ${x.variable}`),
|
|
2212
2280
|
...v.diagnostics.length > 0 ? [v.report] : []
|
|
2213
2281
|
].join("\n") }
|
|
2214
2282
|
});
|
|
@@ -2625,6 +2693,7 @@ async function invoke(tool, input, o) {
|
|
|
2625
2693
|
dir: o.dir,
|
|
2626
2694
|
root,
|
|
2627
2695
|
...tool.database === "none" ? {} : { database: o.database },
|
|
2696
|
+
...tool.database === "none" || o.env === void 0 ? {} : { env: o.env },
|
|
2628
2697
|
...tool.data === "none" ? {} : { data: o.data },
|
|
2629
2698
|
...tool.data === "write" ? { allowRightsWrite: o.allowRightsWrite === true } : {},
|
|
2630
2699
|
...o.baseline === void 0 ? {} : { baseline: o.baseline }
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-CN8Tgd0H.js";
|
|
3
3
|
import { n as TOOL_NAMES } from "./types-CMcZhIci.js";
|
|
4
4
|
import { defineCommand, runCommand, runMain, showUsage } from "citty";
|
|
5
5
|
// src/main.ts
|
|
@@ -10,8 +10,8 @@ const main = defineCommand({
|
|
|
10
10
|
description: "Simetra metadata tooling"
|
|
11
11
|
},
|
|
12
12
|
subCommands: {
|
|
13
|
-
...Object.fromEntries(TOOL_NAMES.map((name) => [name, () => import("./command-
|
|
14
|
-
mcp: () => import("./mcp-
|
|
13
|
+
...Object.fromEntries(TOOL_NAMES.map((name) => [name, () => import("./command-W8Mnvc9E.js").then((m) => m.commandByName(name))])),
|
|
14
|
+
mcp: () => import("./mcp-DYYIww-s.js").then((m) => m.default),
|
|
15
15
|
init: () => import("./init-jr0Xsrpp.js").then((m) => m.default)
|
|
16
16
|
}
|
|
17
17
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { d as parseDataLaunch, f as databaseResource, i as structureOf, l as checkEnvName, n as TOOLS, o as formatDiagnostics, r as presentation, t as invoke, u as dataResource } from "./invoke-
|
|
2
|
+
import { d as parseDataLaunch, f as databaseResource, i as structureOf, l as checkEnvName, n as TOOLS, o as formatDiagnostics, r as presentation, t as invoke, u as dataResource } from "./invoke-DLCOtVpB.js";
|
|
3
3
|
import { a as dataWriteHint, l as readOnlyHint, n as trimSlash, o as databaseWriteHint, p as UsageError, r as ALLOW_RIGHTS_WRITE_FLAG } from "./default-dir-DerxTbci.js";
|
|
4
|
-
import { t as version } from "./package-
|
|
4
|
+
import { t as version } from "./package-CN8Tgd0H.js";
|
|
5
5
|
import { t as mcpArgs } from "./mcp-args-D63akJ97.js";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -130,7 +130,8 @@ function registerCatalog(server, o) {
|
|
|
130
130
|
...o.databaseEnv === void 0 ? {} : { databaseEnv: o.databaseEnv },
|
|
131
131
|
...o.data === void 0 ? {} : { data: o.data },
|
|
132
132
|
...o.dataEnv === void 0 ? {} : { dataEnv: o.dataEnv },
|
|
133
|
-
launchArgs: o.launchArgs
|
|
133
|
+
launchArgs: o.launchArgs,
|
|
134
|
+
...o.env === void 0 ? {} : { env: o.env }
|
|
134
135
|
});
|
|
135
136
|
return toResponse(tool, result, o, dry === true);
|
|
136
137
|
});
|
|
@@ -194,7 +195,8 @@ function mcpOptionsFrom(args, env, argv) {
|
|
|
194
195
|
databaseEnv,
|
|
195
196
|
...data === void 0 ? {} : { data },
|
|
196
197
|
...launch === void 0 ? {} : { dataEnv: launch.urlEnv },
|
|
197
|
-
launchArgs: argv
|
|
198
|
+
launchArgs: argv,
|
|
199
|
+
env
|
|
198
200
|
};
|
|
199
201
|
}
|
|
200
202
|
var mcp_default = defineCommand({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simetrajs/designer",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.2",
|
|
4
4
|
"description": "Simetra developer tools: command line and MCP server over the metadata compiler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"simetra",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"pg-connection-string": "2.14.1",
|
|
38
38
|
"smol-toml": "1.9.1",
|
|
39
39
|
"zod": "^4.6.7",
|
|
40
|
-
"simetra": "0.3.0-next.
|
|
40
|
+
"simetra": "0.3.0-next.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@arethetypeswrong/cli": "0.18.5",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
+
"gitHead": "bd2da08175642d706b7879ed34da1619e20c4951",
|
|
60
61
|
"scripts": {
|
|
61
62
|
"build": "tsc --noEmit",
|
|
62
63
|
"build:package": "tsdown",
|
|
@@ -689,7 +689,8 @@ on the target only (`LOGIN NOINHERIT`, a member of `simetra_command` and, for
|
|
|
689
689
|
`supabase`, of `authenticated` and `anon`, each `WITH INHERIT FALSE, SET TRUE`). It reads
|
|
690
690
|
`database.provider` from the project file; without a project file it skips the
|
|
691
691
|
login role, and the output says why. The operator sets the login role's
|
|
692
|
-
password; the platform keeps no secrets
|
|
692
|
+
password; the platform keeps no secrets (the one exception, a database on your
|
|
693
|
+
machine, is `--dev-passwords` below).
|
|
693
694
|
|
|
694
695
|
The login role needs `ADMIN OPTION` on each of its parent roles in the role
|
|
695
696
|
that runs `roles`. Without it `roles` still creates the grant roles, but
|
|
@@ -710,6 +711,19 @@ the profile, the application database owned by `simetra_owner`,
|
|
|
710
711
|
`simetra_template` that shadows and proof copies are built from. Running it
|
|
711
712
|
again converges the declared state and creates nothing.
|
|
712
713
|
|
|
714
|
+
For a database on your machine, `simetra roles --dev-passwords` (MCP input
|
|
715
|
+
`devPasswords: true`) also sets the password of each login role this run
|
|
716
|
+
creates (`simetra_owner`, `simetra_auth`, `simetra_runtime`,
|
|
717
|
+
`simetra_signals`) from `SIMETRA_OWNER_DEV_PASSWORD`,
|
|
718
|
+
`SIMETRA_AUTH_DEV_PASSWORD`, `SIMETRA_RUNTIME_DEV_PASSWORD` and
|
|
719
|
+
`SIMETRA_SIGNALS_DEV_PASSWORD` in the environment. A role that already exists
|
|
720
|
+
keeps its password. It refuses before anything is written when a variable is
|
|
721
|
+
missing or empty (`roles.dev-password-missing`), when the database host is not
|
|
722
|
+
this machine — `localhost`, `127.0.0.0/8`, `::1` or a unix socket
|
|
723
|
+
(`roles.dev-passwords-remote`), or when the provider is not `postgres`
|
|
724
|
+
(`roles.dev-passwords-unsupported`). On any other server set the passwords
|
|
725
|
+
yourself.
|
|
726
|
+
|
|
713
727
|
The identity provider's own roles get their grants here too: the role of the
|
|
714
728
|
platform owner receives `USAGE` on the `better_auth` schema and `TRIGGER` and
|
|
715
729
|
`REFERENCES` on `better_auth."user"`, so the provision triggers and the foreign
|
|
@@ -737,6 +751,12 @@ otherwise:
|
|
|
737
751
|
restore it by hand around a new `roles` run (the template is only dropped).
|
|
738
752
|
- `roles.shared-cluster` — a Simetra login role has an explicit `CONNECT` on
|
|
739
753
|
other databases; one cluster serves one application.
|
|
754
|
+
- `roles.extension-unavailable` — the server does not offer `plpgsql_check`
|
|
755
|
+
in `pg_available_extensions`; install the extension's package on the
|
|
756
|
+
database server (`postgresql-<major>-plpgsql-check` from PGDG) and run
|
|
757
|
+
`roles` again. `apply` refuses the same way with
|
|
758
|
+
`apply.extension-unavailable` before it locks any table when its plan checks
|
|
759
|
+
function bodies with the extension and the server no longer offers it.
|
|
740
760
|
- `plan.owner-not-bypassrls` — the role of `plan`, `apply` or `rehearse` has
|
|
741
761
|
neither `BYPASSRLS` nor superuser; run `ALTER ROLE <role> BYPASSRLS` as a
|
|
742
762
|
superuser.
|