primitive-admin 1.2.0-alpha.11 → 1.2.0-alpha.12
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/src/commands/agent-sessions.d.ts +26 -10
- package/dist/src/commands/agent-sessions.js +80 -83
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/init.js +101 -34
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +17 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +0 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/sync.d.ts +6 -0
- package/dist/src/commands/sync.js +129 -60
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +6 -4
- package/dist/src/lib/api-client.js +4 -14
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/function-typecheck.js +3 -0
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +19 -2
- package/dist/src/lib/generated-config-surfaces.js +29 -2
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-schema.d.ts +8 -0
- package/dist/src/lib/init-schema.js +31 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +54 -0
- package/dist/src/lib/sync-resource-types.js +92 -1
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,22 +3,22 @@ import { resolveAppId } from "../lib/config.js";
|
|
|
3
3
|
import { success, error, info, keyValue, formatTable, formatDate, json, } from "../lib/output.js";
|
|
4
4
|
import { wholeListEnvelope } from "../lib/paginate.js";
|
|
5
5
|
/**
|
|
6
|
-
* `primitive locks` —
|
|
6
|
+
* `primitive locks` — an app admin's view of the named locks (#1518).
|
|
7
7
|
*
|
|
8
|
-
* `list` / `status` are the "what's held / who holds it" operational path
|
|
9
|
-
* `
|
|
8
|
+
* `list` / `status` are the "what's held / who holds it" operational path, and
|
|
9
|
+
* `force-release` frees a stuck key with no handle. Taking and freeing a lock
|
|
10
|
+
* by handle is a server function's (`ctx.locks`): since #4959 the lock routes
|
|
11
|
+
* answer only a function, so the CLI has no `acquire` or `release`.
|
|
10
12
|
*/
|
|
11
13
|
export function registerLocksCommands(program) {
|
|
12
14
|
const locks = program
|
|
13
15
|
.command("locks")
|
|
14
|
-
.description("Inspect and
|
|
16
|
+
.description("Inspect and free named locks (admin)")
|
|
15
17
|
.addHelpText("after", `
|
|
16
18
|
Examples:
|
|
17
19
|
$ primitive locks list
|
|
18
20
|
$ primitive locks status portfolio-import:user-123
|
|
19
|
-
$ primitive locks
|
|
20
|
-
$ primitive locks acquire portfolio-import:user-123 --owner run-01M2H5EYQQ
|
|
21
|
-
$ primitive locks release portfolio-import:user-123 --handle 01HXY...
|
|
21
|
+
$ primitive locks force-release portfolio-import:user-123
|
|
22
22
|
`);
|
|
23
23
|
// ─── list ───
|
|
24
24
|
locks
|
|
@@ -95,76 +95,32 @@ Examples:
|
|
|
95
95
|
process.exit(1);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
// ───
|
|
98
|
+
// ─── force-release ───
|
|
99
99
|
locks
|
|
100
|
-
.command("
|
|
101
|
-
.description("
|
|
100
|
+
.command("force-release")
|
|
101
|
+
.description("Free a stuck lock with no handle (admin)")
|
|
102
102
|
.argument("<key>", "Lock key")
|
|
103
103
|
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
104
104
|
.option("--app <app-id>", "App ID")
|
|
105
|
-
.option("--ttl <ms>", "Lease duration in milliseconds", "60000")
|
|
106
|
-
.option("--owner <owner>", "Who is taking this lease. Presenting the owner that already holds the " +
|
|
107
|
-
"key re-takes it with a fresh handle; omit it and the lock is strictly " +
|
|
108
|
-
"non-reentrant")
|
|
109
105
|
.option("--json", "Output as JSON")
|
|
110
106
|
.action(async (key, appId, options) => {
|
|
111
107
|
const resolvedAppId = resolveAppId(appId, options);
|
|
112
|
-
const ttlMs = Number(options.ttl);
|
|
113
|
-
if (!Number.isFinite(ttlMs) || ttlMs <= 0) {
|
|
114
|
-
error("--ttl must be a positive number of milliseconds.");
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
108
|
const client = new ApiClient();
|
|
118
109
|
try {
|
|
119
|
-
const res = await client.
|
|
110
|
+
const res = await client.forceReleaseLock(resolvedAppId, key);
|
|
120
111
|
if (options.json) {
|
|
121
112
|
json(res);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (res?.acquired) {
|
|
125
|
-
success(`Acquired lock "${key}".`);
|
|
126
|
-
keyValue("Handle", res.handle.handleId);
|
|
127
|
-
keyValue("Lease expires", formatDate(res.handle.leaseExpiresAt));
|
|
128
|
-
info("Pass the handle to `locks release` to free the lock.");
|
|
129
113
|
}
|
|
130
|
-
else {
|
|
131
|
-
info(`Lock "${key}" is held by ${res?.heldBy ?? "another caller"}.`);
|
|
132
|
-
if (res?.owner)
|
|
133
|
-
keyValue("Owner", res.owner);
|
|
134
|
-
keyValue("Lease expires", formatDate(res?.leaseExpiresAt));
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
error(err.message);
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
// ─── release ───
|
|
144
|
-
locks
|
|
145
|
-
.command("release")
|
|
146
|
-
.description("Release a held lock (requires the acquire handle)")
|
|
147
|
-
.argument("<key>", "Lock key")
|
|
148
|
-
.argument("[app-id]", "App ID (uses current app if not specified)")
|
|
149
|
-
.option("--app <app-id>", "App ID")
|
|
150
|
-
.requiredOption("--handle <handleId>", "The handle returned by acquire")
|
|
151
|
-
.option("--json", "Output as JSON")
|
|
152
|
-
.action(async (key, appId, options) => {
|
|
153
|
-
const resolvedAppId = resolveAppId(appId, options);
|
|
154
|
-
const client = new ApiClient();
|
|
155
|
-
try {
|
|
156
|
-
const res = await client.releaseLock(resolvedAppId, key, options.handle);
|
|
157
|
-
if (options.json) {
|
|
158
|
-
json(res);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (res?.released) {
|
|
114
|
+
else if (res?.released) {
|
|
162
115
|
success(`Released lock "${key}".`);
|
|
163
116
|
}
|
|
164
117
|
else {
|
|
165
|
-
|
|
166
|
-
process.exit(1);
|
|
118
|
+
info(`Lock "${key}" is not held.`);
|
|
167
119
|
}
|
|
120
|
+
// A free key, or one whose lease already expired: nothing to free.
|
|
121
|
+
// Exit 1 in both output modes so a script can tell.
|
|
122
|
+
if (!res?.released)
|
|
123
|
+
process.exit(1);
|
|
168
124
|
}
|
|
169
125
|
catch (err) {
|
|
170
126
|
error(err.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../../src/commands/locks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,IAAI,GACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE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C;SACvD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;SAC7B,QAAQ,CAAC,UAAU,EAAE,4CAA4C,CAAC;SAClE,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC;SAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACpC,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;YAC9D,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjB,IAAI,CAAC,GAAG,CAAC,CAAC;YACZ,CAAC;iBAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC;gBACzB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC,CAAC;YACrC,CAAC;YACD,mEAAmE;YACnE,oDAAoD;YACpD,IAAI,CAAC,GAAG,EAAE,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
export declare const RULE_SET_RESOURCE_TYPES: readonly ["document", "workflow", "api", "group", "collection", "database_type", "blob_bucket", "analytics"
|
|
2
|
+
export declare const RULE_SET_RESOURCE_TYPES: readonly ["document", "workflow", "api", "group", "collection", "database_type", "blob_bucket", "analytics"];
|
|
3
3
|
export declare function registerRuleSetsCommands(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-sets.js","sourceRoot":"","sources":["../../../src/commands/rule-sets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAEL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,IAAI,WAAW,EACrB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,IAAI,GACL,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,4EAA4E;AAC5E,qDAAqD;AACrD,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AAClF,iFAAiF;AACjF,mFAAmF;AACnF,4EAA4E;AAC5E,gFAAgF;AAChF,kEAAkE;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU;IACV,UAAU;IACV,KAAK;IACL,OAAO;IACP,YAAY;IACZ,eAAe;IACf,aAAa;IACb,WAAW;
|
|
1
|
+
{"version":3,"file":"rule-sets.js","sourceRoot":"","sources":["../../../src/commands/rule-sets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAEL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,IAAI,WAAW,EACrB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,IAAI,GACL,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,4EAA4E;AAC5E,qDAAqD;AACrD,gFAAgF;AAChF,gFAAgF;AAChF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AAM,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;iBAC3E,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AAEP,CAAC"}
|
|
@@ -611,6 +611,12 @@ export declare function retiredConfigDirectoriesIn(configDir: string): string[];
|
|
|
611
611
|
* an older pull left behind holds nothing to apply and is not refused.
|
|
612
612
|
*/
|
|
613
613
|
export declare function retiredTypeConfigFilesIn(configDir: string): string[];
|
|
614
|
+
/**
|
|
615
|
+
* Every `rule-sets/*.toml` whose `[ruleSet] resourceType` is retired (#4959:
|
|
616
|
+
* `lock`), as `<file>: ruleSet.resourceType = "<type>" — <sentence>`. A file
|
|
617
|
+
* that does not parse is left to the rule-set validators.
|
|
618
|
+
*/
|
|
619
|
+
export declare function retiredRuleSetFilesIn(configDir: string): string[];
|
|
614
620
|
/**
|
|
615
621
|
* `config push`'s preflight — every check the authored files decide on their
|
|
616
622
|
* own, run before the FIRST mutating call (#976 fix A, #3320, #3375).
|
|
@@ -9,7 +9,8 @@ import { buildDatabaseTypeTomlData } from "../lib/toml-database-config.js";
|
|
|
9
9
|
// #3317 — see `config-json-field.ts`.
|
|
10
10
|
import { serializeJsonField } from "../lib/config-json-field.js";
|
|
11
11
|
import { parseMetadataCategoryToml, validateMetadataCategoryConfig, serializeMetadataCategoryConfig, parseDeclaredAccessManifestToml, validateDeclaredAccessManifest, } from "../lib/toml-metadata-config.js";
|
|
12
|
-
import { getCurrentAppId, getServerUrl } from "../lib/config.js";
|
|
12
|
+
import { getCurrentAppId, getServerUrl, loadCredentials } from "../lib/config.js";
|
|
13
|
+
import { sessionHoldsScope, tokenReachesScope, } from "../lib/session-scope.js";
|
|
13
14
|
import { requireCurrentEnvironment } from "../lib/env-resolver.js";
|
|
14
15
|
import { ensureFileIgnored } from "../lib/local-state.js";
|
|
15
16
|
import { PROJECT_TREE_DIR } from "../lib/env-resolver-core.js";
|
|
@@ -27,6 +28,9 @@ import { collectAppSettingsPushErrors, writePulledAppSettings, diffAppSettings,
|
|
|
27
28
|
import { BLOB_BUCKET_TABLE, DATABASE_TYPE_TABLE, DB3_TYPE_TABLE, EMAIL_TEMPLATE_TABLE, INTEGRATION_TABLE, METADATA_CATEGORY_CONFIG_TABLE, PROMPT_CONFIG_TABLE, PROMPT_TABLE, RULE_SET_TABLE, SERVER_FUNCTION_TABLE, TEST_CASE_SURFACE, TEST_CASE_TABLE, configDeclaredTypeErrors, deprecatedConfigKey, fieldServerDefault, findMisshapenTables, findUnknownDocumentKeys, findUnknownGroupedTomlKeys, findUnknownTomlKeys, misshapenTableMessage, retiredTomlKey, retiredDocumentKey, spellsDecimalNumber, unrecognizedPushKeysMessage, unrecognizedPushTablesMessage, warnUnrecognizedServerKeys, } from "../lib/config-surface.js";
|
|
28
29
|
import { buildPayloadFromToml, projectEntityToPayload, projectRecordToToml, tomlOwned, } from "../lib/config-payload.js";
|
|
29
30
|
import { CONFIG_SURFACES, isEmptyForEmit, tomlGroupsOf, RETIRED_CONFIG_DIRECTORIES, RETIRED_TYPE_CONFIG_DIRECTORIES, } from "../lib/generated-config-surfaces.js";
|
|
31
|
+
// #4959 — the retired rule-set resource types, vendored with the one sentence
|
|
32
|
+
// the rule-set routes answer, so the preflight refuses exactly what they do.
|
|
33
|
+
import { retiredRuleSetResourceType } from "../lib/generated-config-surfaces.js";
|
|
30
34
|
// #3626 — the prompt KIND rule, vendored with the definitions so the CLI's
|
|
31
35
|
// preflight refuses exactly what the admin routes refuse.
|
|
32
36
|
import { promptKindOf, resolvePromptKind, } from "../lib/generated-config-surfaces.js";
|
|
@@ -66,7 +70,7 @@ import { isFunctionDeclarationFile, resolveDocumentSchema, } from "../lib/functi
|
|
|
66
70
|
import { createFunctionTypechecker, } from "../lib/function-typecheck.js";
|
|
67
71
|
import { resolveFunctionSourceRoots } from "../lib/function-source-roots.js";
|
|
68
72
|
import { detectLayout, migrateLegacyToV2 } from "../lib/block-layout.js";
|
|
69
|
-
import { ABSENT_FROM_EXPORT, LOCAL_ONLY_ABSENT, LOCAL_ONLY_NEW, PUSH_PRUNE_SPECS, REMOTE_ONLY_UNMANAGED, REMOTE_ONLY_WILL_DELETE, SYNC_RESOURCE_TYPES, VALIDATION_ERROR, applyPrune, attachmentWritePath, attemptFetch, classifyLocalOnly, classifyPruneDeleteFailure, classifyRemoteOnly,
|
|
73
|
+
import { ABSENT_FROM_EXPORT, LOCAL_ONLY_ABSENT, LOCAL_ONLY_NEW, PUSH_PRUNE_SPECS, REMOTE_ONLY_UNMANAGED, REMOTE_ONLY_WILL_DELETE, SYNC_RESOURCE_TYPES, VALIDATION_ERROR, applyPrune, attachmentWritePath, attemptFetch, classifyLocalOnly, classifyPruneDeleteFailure, classifyRemoteOnly, formatPrunePlan, hasUncommittedChanges, isSafeAttachmentFilename, planPrune, planPushPrune, preserveUnwrittenEntries, pruneAdminScopeRefusal, pruneScopeUnknownRefusal, removePrunedSidecar, ruleSetFileKey, } from "../lib/sync-resource-types.js";
|
|
70
74
|
import { normalizeTestCaseKey, testCaseKeyError, } from "../lib/test-case-keys.js";
|
|
71
75
|
import { slugifyTestCaseName, testCaseFileBasenames } from "../lib/test-case-file-names.js";
|
|
72
76
|
// The sidecar naming rules live in `lib/` (#3061); re-exported here because
|
|
@@ -1459,6 +1463,37 @@ export function configUnknownKeyError(filePath, tomlData, table) {
|
|
|
1459
1463
|
* spelling with no scheduled removal (a function's frozen `access`, #4738) is
|
|
1460
1464
|
* not one of them. A repeated table's entries are read one by one.
|
|
1461
1465
|
*/
|
|
1466
|
+
/**
|
|
1467
|
+
* #4989 — whether this session can make the prune's hard deletes in `appId`:
|
|
1468
|
+
* read from the stored token and step-up where they say, with the app's
|
|
1469
|
+
* parent looked up only when a pin on it could be what reaches the app, and
|
|
1470
|
+
* from the server for an opaque CI token. Rejects when a read it needs fails;
|
|
1471
|
+
* the caller treats that as unknown, never as `admin`.
|
|
1472
|
+
*/
|
|
1473
|
+
async function sessionHoldsAdminFor(client, appId) {
|
|
1474
|
+
const credentials = loadCredentials();
|
|
1475
|
+
// No stored session to read: the server judges each delete.
|
|
1476
|
+
if (!credentials)
|
|
1477
|
+
return true;
|
|
1478
|
+
const target = { appId };
|
|
1479
|
+
let holds = sessionHoldsScope(credentials, "admin", target);
|
|
1480
|
+
if (holds === true)
|
|
1481
|
+
return true;
|
|
1482
|
+
const app = (await client.getApp(appId));
|
|
1483
|
+
target.parentAppId = app?.parentAppId ?? null;
|
|
1484
|
+
holds = sessionHoldsScope(credentials, "admin", target);
|
|
1485
|
+
if (holds !== null)
|
|
1486
|
+
return holds;
|
|
1487
|
+
// An opaque CI token: the server says what it holds. "full" is unscoped.
|
|
1488
|
+
const me = (await client.getMe());
|
|
1489
|
+
const session = me?.session;
|
|
1490
|
+
if (!session)
|
|
1491
|
+
return true;
|
|
1492
|
+
return tokenReachesScope({
|
|
1493
|
+
scope: Array.isArray(session.scope) ? session.scope : undefined,
|
|
1494
|
+
apps: session.apps,
|
|
1495
|
+
}, "admin", target);
|
|
1496
|
+
}
|
|
1462
1497
|
function deprecatedKeysPresent(tomlData, table) {
|
|
1463
1498
|
const prefix = table.tomlPath.join(".");
|
|
1464
1499
|
const at = table.tomlPath.reduce((node, segment) => (node == null ? node : node[segment]), tomlData);
|
|
@@ -1680,6 +1715,31 @@ export function retiredTypeConfigFilesIn(configDir) {
|
|
|
1680
1715
|
}
|
|
1681
1716
|
return refusals;
|
|
1682
1717
|
}
|
|
1718
|
+
/**
|
|
1719
|
+
* Every `rule-sets/*.toml` whose `[ruleSet] resourceType` is retired (#4959:
|
|
1720
|
+
* `lock`), as `<file>: ruleSet.resourceType = "<type>" — <sentence>`. A file
|
|
1721
|
+
* that does not parse is left to the rule-set validators.
|
|
1722
|
+
*/
|
|
1723
|
+
export function retiredRuleSetFilesIn(configDir) {
|
|
1724
|
+
const dir = join(configDir, "rule-sets");
|
|
1725
|
+
if (!existsSync(dir))
|
|
1726
|
+
return [];
|
|
1727
|
+
const refusals = [];
|
|
1728
|
+
for (const file of readdirSync(dir).filter((f) => f.endsWith(".toml")).sort()) {
|
|
1729
|
+
let resourceType;
|
|
1730
|
+
try {
|
|
1731
|
+
resourceType = parseTomlFile(join(dir, file))?.ruleSet?.resourceType;
|
|
1732
|
+
}
|
|
1733
|
+
catch {
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
const retired = retiredRuleSetResourceType(resourceType);
|
|
1737
|
+
if (!retired)
|
|
1738
|
+
continue;
|
|
1739
|
+
refusals.push(`${file}: ruleSet.resourceType = ${JSON.stringify(resourceType)} — ${retired.message}`);
|
|
1740
|
+
}
|
|
1741
|
+
return refusals;
|
|
1742
|
+
}
|
|
1683
1743
|
/**
|
|
1684
1744
|
* `config push`'s preflight — every check the authored files decide on their
|
|
1685
1745
|
* own, run before the FIRST mutating call (#976 fix A, #3320, #3375).
|
|
@@ -1755,6 +1815,13 @@ export async function runConfigPushPreflight(input) {
|
|
|
1755
1815
|
}
|
|
1756
1816
|
if (retiredTypeConfigFiles.length > 0)
|
|
1757
1817
|
abortOnPreflightErrors();
|
|
1818
|
+
// #4959 — a rule set of a retired resource type (`lock`) is refused here,
|
|
1819
|
+
// with the sentence the rule-set routes give, before the rule-set loop could
|
|
1820
|
+
// skip it as unchanged. Deleting the file and pushing with `--prune` removes
|
|
1821
|
+
// the stored row.
|
|
1822
|
+
for (const refusal of retiredRuleSetFilesIn(configDir)) {
|
|
1823
|
+
preflightValidationErrors.push(` ${refusal}`);
|
|
1824
|
+
}
|
|
1758
1825
|
// Validate all database-type TOMLs: the parse itself refuses an invalid
|
|
1759
1826
|
// declared-access manifest. (#3189 — the `[[operations]]` `$params` and
|
|
1760
1827
|
// `[[subscriptions]]` checks retired with the two tables, which the
|
|
@@ -8747,6 +8814,39 @@ What a push guarantees (two stages):
|
|
|
8747
8814
|
if (varsOverrideKeys && varsOverrideFile) {
|
|
8748
8815
|
info(varsOverrideSummaryLine(varsOverrideFile, varsOverrideKeys));
|
|
8749
8816
|
}
|
|
8817
|
+
// #4989 — a prune whose plan hard-deletes needs `admin`. A session
|
|
8818
|
+
// without it is refused here, before anything below mutates, rather
|
|
8819
|
+
// than having each delete refused after the rest of the push landed.
|
|
8820
|
+
// A session whose scope cannot be read is refused too: assuming
|
|
8821
|
+
// `admin` would let the push land halfway all the same.
|
|
8822
|
+
if (options.prune) {
|
|
8823
|
+
const refusal = pruneAdminScopeRefusal(await planPushPrune({
|
|
8824
|
+
specs: PUSH_PRUNE_SPECS.filter((spec) => spec.deleteNeedsAdmin),
|
|
8825
|
+
configDir,
|
|
8826
|
+
entities: syncState?.entities,
|
|
8827
|
+
includes: (label, key) => selectionIncludesKey(pushSelection, label, key),
|
|
8828
|
+
client,
|
|
8829
|
+
appId: resolvedAppId,
|
|
8830
|
+
force: !!options.force,
|
|
8831
|
+
}));
|
|
8832
|
+
let stop = null;
|
|
8833
|
+
if (refusal) {
|
|
8834
|
+
try {
|
|
8835
|
+
if (!(await sessionHoldsAdminFor(client, resolvedAppId)))
|
|
8836
|
+
stop = refusal;
|
|
8837
|
+
}
|
|
8838
|
+
catch (err) {
|
|
8839
|
+
stop = pruneScopeUnknownRefusal(err?.message ?? String(err));
|
|
8840
|
+
}
|
|
8841
|
+
}
|
|
8842
|
+
if (stop && options.dryRun) {
|
|
8843
|
+
warn(stop);
|
|
8844
|
+
}
|
|
8845
|
+
else if (stop) {
|
|
8846
|
+
error(stop);
|
|
8847
|
+
process.exit(1);
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8750
8850
|
// Re-derived, not returned: both are one-line functions of inputs the
|
|
8751
8851
|
// entry point already took, and widening its return type to carry them
|
|
8752
8852
|
// would make the vars apply leg depend on the preflight's internals.
|
|
@@ -12426,65 +12526,25 @@ What a push guarantees (two stages):
|
|
|
12426
12526
|
const toDelete = [];
|
|
12427
12527
|
const alreadyAbsent = [];
|
|
12428
12528
|
const skipped = [];
|
|
12429
|
-
for (const
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
configDir,
|
|
12434
|
-
priorEntities,
|
|
12435
|
-
}).filter(({ key }) =>
|
|
12529
|
+
for (const item of await planPushPrune({
|
|
12530
|
+
specs: PUSH_PRUNE_SPECS,
|
|
12531
|
+
configDir,
|
|
12532
|
+
entities: syncState?.entities,
|
|
12436
12533
|
// `--only` bounds prune to the selection. Without this a
|
|
12437
12534
|
// single-object push with `--prune` would delete every managed
|
|
12438
12535
|
// entity whose file happens to be missing — objects the operator
|
|
12439
12536
|
// did not name and is not looking at.
|
|
12440
|
-
selectionIncludesKey(pushSelection,
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
priorModifiedAt: entry?.modifiedAt,
|
|
12452
|
-
fetch: { ok: false },
|
|
12453
|
-
force: !!options.force,
|
|
12454
|
-
});
|
|
12455
|
-
skipped.push({ spec, key, entry, address, decision });
|
|
12456
|
-
continue;
|
|
12457
|
-
}
|
|
12458
|
-
// Point read: confirm live presence + drift. Fail closed — any
|
|
12459
|
-
// non-404 error leaves the entity and its state slot untouched.
|
|
12460
|
-
let fetchOutcome;
|
|
12461
|
-
try {
|
|
12462
|
-
const detail = await spec.fetchDetail(client, resolvedAppId, address);
|
|
12463
|
-
fetchOutcome = { ok: true, detail };
|
|
12464
|
-
}
|
|
12465
|
-
catch (err) {
|
|
12466
|
-
if (err instanceof ApiError && err.statusCode === 404) {
|
|
12467
|
-
fetchOutcome = { ok: false, status: 404 };
|
|
12468
|
-
}
|
|
12469
|
-
else {
|
|
12470
|
-
fetchOutcome = { ok: false };
|
|
12471
|
-
}
|
|
12472
|
-
}
|
|
12473
|
-
const decision = decidePushPruneCandidate({
|
|
12474
|
-
spec,
|
|
12475
|
-
address,
|
|
12476
|
-
priorModifiedAt: entry?.modifiedAt,
|
|
12477
|
-
fetch: fetchOutcome,
|
|
12478
|
-
force: !!options.force,
|
|
12479
|
-
});
|
|
12480
|
-
const item = { spec, key, entry, address, decision };
|
|
12481
|
-
if (decision.action === "delete")
|
|
12482
|
-
toDelete.push(item);
|
|
12483
|
-
else if (decision.action === "drop-state")
|
|
12484
|
-
alreadyAbsent.push(item);
|
|
12485
|
-
else
|
|
12486
|
-
skipped.push(item);
|
|
12487
|
-
}
|
|
12537
|
+
includes: (label, key) => selectionIncludesKey(pushSelection, label, key),
|
|
12538
|
+
client,
|
|
12539
|
+
appId: resolvedAppId,
|
|
12540
|
+
force: !!options.force,
|
|
12541
|
+
})) {
|
|
12542
|
+
if (item.decision.action === "delete")
|
|
12543
|
+
toDelete.push(item);
|
|
12544
|
+
else if (item.decision.action === "drop-state")
|
|
12545
|
+
alreadyAbsent.push(item);
|
|
12546
|
+
else
|
|
12547
|
+
skipped.push(item);
|
|
12488
12548
|
}
|
|
12489
12549
|
const totalPlanned = toDelete.length +
|
|
12490
12550
|
alreadyAbsent.length +
|
|
@@ -12570,6 +12630,7 @@ What a push guarantees (two stages):
|
|
|
12570
12630
|
else {
|
|
12571
12631
|
let prunedCount = 0;
|
|
12572
12632
|
let blockedCount = 0;
|
|
12633
|
+
let failedCount = 0;
|
|
12573
12634
|
// Entities already gone server-side: drop their stale state (2).
|
|
12574
12635
|
for (const item of alreadyAbsent) {
|
|
12575
12636
|
dropPruneState(item.spec, item.key);
|
|
@@ -12603,8 +12664,16 @@ What a push guarantees (two stages):
|
|
|
12603
12664
|
warn(` Blocked — ${item.spec.resourceType.label} ${item.key} is still referenced: ${message}`);
|
|
12604
12665
|
break;
|
|
12605
12666
|
default:
|
|
12606
|
-
|
|
12607
|
-
|
|
12667
|
+
// #4989 — any other refusal fails the push with the
|
|
12668
|
+
// server's error, as every other apply failure does
|
|
12669
|
+
// (#2731 B2), and keeps the state so a re-run retries.
|
|
12670
|
+
failedCount++;
|
|
12671
|
+
applyFailures.push({
|
|
12672
|
+
type: item.spec.resourceType.label,
|
|
12673
|
+
key: item.key,
|
|
12674
|
+
message,
|
|
12675
|
+
});
|
|
12676
|
+
error(` Failed — could not delete ${item.spec.resourceType.label} ${item.key}: ${message}`);
|
|
12608
12677
|
}
|
|
12609
12678
|
}
|
|
12610
12679
|
}
|
|
@@ -12621,7 +12690,7 @@ What a push guarantees (two stages):
|
|
|
12621
12690
|
});
|
|
12622
12691
|
prunedCount += testCasePrune.deleted + testCasePrune.deletedAttachments;
|
|
12623
12692
|
if (totalPlanned > 0) {
|
|
12624
|
-
info(`Prune: ${prunedCount} deleted, ${alreadyAbsent.length} already absent, ${skipped.length + blockedCount} skipped.`);
|
|
12693
|
+
info(`Prune: ${prunedCount} deleted, ${alreadyAbsent.length} already absent, ${skipped.length + blockedCount} skipped${failedCount > 0 ? `, ${failedCount} failed` : ""}.`);
|
|
12625
12694
|
}
|
|
12626
12695
|
}
|
|
12627
12696
|
}
|