@revoengine/cli 1.0.17 → 1.0.19
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/README.md +19 -7
- package/dist/src/client.d.ts +25 -4
- package/dist/src/client.js +1 -1
- package/dist/src/commands/component.js +25 -0
- package/dist/src/commands/migrate.js +47 -173
- package/dist/src/migration-actions.d.ts +44 -0
- package/dist/src/migration-actions.js +211 -0
- package/dist/src/migration.d.ts +11 -10
- package/dist/src/migration.js +94 -217
- package/dist/src/project.js +1 -1
- package/dist/src/resource-syncs/endpoint-sync.d.ts +2 -0
- package/dist/src/resource-syncs/endpoint-sync.js +7 -0
- package/dist/src/resource-syncs/job-template-sync.d.ts +1 -0
- package/dist/src/resource-syncs/job-template-sync.js +31 -0
- package/dist/src/resource-syncs/service-account-sync.js +38 -3
- package/dist/src/types.d.ts +17 -0
- package/dist/src/ui.js +1 -1
- package/dist/src/workspace-prune.d.ts +2 -0
- package/dist/src/workspace-prune.js +85 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,9 +8,11 @@ The CLI has three main capabilities:
|
|
|
8
8
|
2. **Project migration** — plan, run, and verify a direct migration between two saved projects with `--from` and `--to`.
|
|
9
9
|
3. **Resource synchronization** — work with one supported resource family through its dedicated `pull`, `plan`, and `push` commands.
|
|
10
10
|
|
|
11
|
-
## Version 1.0.
|
|
11
|
+
## Version 1.0.18
|
|
12
12
|
|
|
13
|
-
Repository
|
|
13
|
+
Repository `plan/deploy --prune` now releases occupied Job Template names before upserts by deleting the reviewed obsolete templates and their obsolete Event/Schedule consumers. Retained references block this early phase; remaining deletions follow verified upserts. Saved plans include deletion timing, so regenerate older replacement plans before deployment. See the repository workflow below for approval, scope and failure behavior.
|
|
14
|
+
|
|
15
|
+
Repository CI reports now classify converged definitions as `operation: "noop"` and report missing or stale lock baselines separately through `baselineAction`, preserving dependency and permission checks.
|
|
14
16
|
|
|
15
17
|
## Requirements and installation
|
|
16
18
|
|
|
@@ -297,6 +299,12 @@ revo plan --json
|
|
|
297
299
|
revo deploy --yes --json
|
|
298
300
|
```
|
|
299
301
|
|
|
302
|
+
Repository `plan` and `deploy` reports separate resource operations from lock bookkeeping across all ten resource families. An existing resource whose managed definition matches the repository is `operation: "noop"`, including when its baseline is absent or stale. Per-item `baselineAction` is `"adopt"` for a missing baseline, `"refresh"` for a stale baseline, or `"none"`. It describes separate bookkeeping for converged resources; create/update operations still save their verified baselines through the existing deployment flow. Use `revo plan --hints` to see this diagnostic in terminal output.
|
|
303
|
+
|
|
304
|
+
The JSON extension retains schema version 2, raw family `status`/`counts`, and `operations.adopt`. Repository summaries count converged resources as `operations.noop`; CI consumers should use item `operation` or aggregate `operations` rather than raw family status to identify resource changes. Validation failures, owner/role changes, and activation exclusions still take precedence over content equality. Dedicated resource commands and named `migrate` keep their existing contract.
|
|
305
|
+
|
|
306
|
+
`plan` does not save manifests or baselines. `deploy` recomputes live state and may save a verified baseline in the runner checkout without modifying a converged resource. The next fresh checkout can therefore report the same `noop` without committing that lock back to Git. View validation can still issue a read-only preview POST when the runner lacks a trusted dependency fingerprint.
|
|
307
|
+
|
|
300
308
|
Repository deployment uses desired-source-wins upsert: it can adopt a missing baseline or overwrite target content drift with the repository state. Its Database Table policy permits supported table renames, column additions and changes, and copying foreign-reference declarations as metadata. Copying those declarations does not create physical SQL foreign-key constraints.
|
|
301
309
|
|
|
302
310
|
`deploy --force` additionally approves supported high-impact operations reported by `plan`, including column removal, managed partition deletion, Materialized View Schedule writes, Schedule target-type changes, and Group or Role Group writes. Review them with `revo plan --force` before deployment. Force does not bypass invalid identity, missing dependencies, unsupported DDL, ambiguity, or failed verification. Full repository reconciliation explicitly selects these supported operations with `--prune`; it does not require `--force`.
|
|
@@ -313,9 +321,11 @@ revo version --json
|
|
|
313
321
|
|
|
314
322
|
`--prune` makes local manifests authoritative for the configured `trackedResources`. A keyed target resource absent locally is a deletion candidate even without an old lock entry. Unkeyed resources are unmanaged and preserved. This covers Components, Job Templates, Endpoints, Events, Schedules, Database Tables (including partitions), Database Views, Groups, Role Groups and Service Accounts when selected. Runtime Job executions/history and Webhook deliveries are outside this definition-sync scope; their existing lifecycle is unaffected. Choose only resource families owned by the repository: an empty selected family intentionally means deleting all its managed target definitions. Environment-local Service Accounts should be excluded from `trackedResources`.
|
|
315
323
|
|
|
316
|
-
The planner lists exact target IDs, names and Stable Keys in deletion order. Duplicate identity, retained local/unmanaged/out-of-scope consumers, system resources and deletion of the authenticated Service Account block the plan.
|
|
324
|
+
The planner lists exact target IDs, names and Stable Keys in deletion order. Duplicate identity, retained local/unmanaged/out-of-scope consumers, system resources and deletion of the authenticated Service Account block the plan. When a desired Job Template name is occupied by a different Stable Key scheduled for deletion, the plan explicitly marks that template and its obsolete Event/Schedule consumers for deletion **before upserts**. An inactive consumer still retains its reference. Retained, unmanaged or out-of-scope consumers block this early deletion, including retained consumers that would otherwise rebind during upsert. An occupied name outside the approved prune scope or duplicate desired names block planning instead of failing later with HTTP 409.
|
|
325
|
+
|
|
326
|
+
All other deletions run after upserts and their readback verification, allowing a retained Job Template or Endpoint to move to a replacement Component. Pruning removes obsolete consumers before dependencies. API errors or failed readback stop further deletes; a failed early delete prevents upserts, and a failed upsert prevents the remaining prune. Early deletions can remain applied if a later write fails, so review both deletion phases before approval. The owning APIs retain their existing permission and reference guards and soft-delete semantics, including the table subtree lifecycle and view automation deactivation. Root deletion is blocked by any retained or unmanaged partition. No arbitrary implicit consumer cleanup is performed.
|
|
317
327
|
|
|
318
|
-
`plan --out <file>` saves the plan without mutation or lock changes. `deploy --reviewed-plan <file>` requires `--prune` and compares the saved deletion list, revisions, authenticated instance and tracked scope with the live plan before any write. Upserts are followed by another live prune plan
|
|
328
|
+
`plan --out <file>` saves the plan without mutation or lock changes. `deploy --reviewed-plan <file>` requires `--prune` and compares the saved deletion list, timing (`beforeUpserts: true` where required), revisions, authenticated instance and tracked scope with the live plan before any write. Regenerate reviewed plans saved by older CLI versions for replacements that now require early deletion. Each early deletion rechecks the remaining Job Template/Event/Schedule graph. Upserts are followed by another live comparison of the remaining prune plan. Each deletion rechecks identity and definition, verifies disappearance from the active catalog and clears only the selected target baseline; verified partition deletion retains its lock tombstone. Cascading table/view operations additionally recheck the remaining dependency graph. Plans are advisory, not an atomic server-side transaction: concurrent edits can still cause API rejection or partial progress. A fresh plan is required after target drift or a failed partial deployment.
|
|
319
329
|
|
|
320
330
|
`deploy` always shows the plan before interactive confirmation; `--yes` supplies noninteractive approval. Ordinary resource rows, field names, dependency hints and metadata use one line per item. Field/value diffs, list changes and code/SQL diffs retain multiline Git-style formatting. `revo version --json` advertises `workspacePrune` and `reviewedPrunePlan` so CI can reject older releases that ignore unknown flags. Without `--prune`, repository deployment remains upsert-only.
|
|
321
331
|
|
|
@@ -500,7 +510,9 @@ revo request GET /api/component/list
|
|
|
500
510
|
revo request POST /api/component '{"name":"Customer Card"}'
|
|
501
511
|
|
|
502
512
|
# Debug a local component in the sandbox
|
|
503
|
-
revo component debug <componentId> --stream
|
|
513
|
+
revo component debug <componentId> --read-only=true --stream
|
|
514
|
+
# Full execution requires a component execution role:
|
|
515
|
+
revo component debug <componentId> --read-only=false
|
|
504
516
|
```
|
|
505
517
|
|
|
506
518
|
Use low-level `request` carefully; it bypasses the higher-level migration planner.
|
|
@@ -550,7 +562,7 @@ The same family is included in `revo pull --all`, repository `diff`/`plan`/`depl
|
|
|
550
562
|
Select it alone with `--resources service-account`. Named profiles (`--project`/`--env`), URL/token environment variables,
|
|
551
563
|
and the ordinary authenticated runtime work through the existing config resolution. `--force` retains the existing drift policy.
|
|
552
564
|
|
|
553
|
-
The portable manifest contains the Stable Key, name, and
|
|
565
|
+
The portable manifest contains the Stable Key, name, and a single Group or Service Account management principal. The manifest field `owner` remains the portable dependency policy; Platform 1.6.4 writes it as a restricted management `access` ACL, with target UUIDs and no legacy `ownerId`/`ownerType` fields.
|
|
554
566
|
Group USER owners and Job Template `triggerUser` references to Service Accounts are resolved to target `userId` at write time.
|
|
555
567
|
Human principals are reported for manual configuration; an account with a human owner needs a target account with the exact Stable Key before it can be adopted.
|
|
556
568
|
A missing or circular owner dependency blocks writes. Groups and accounts are created in dependency order before their consumers.
|
|
@@ -558,4 +570,4 @@ A missing or circular owner dependency blocks writes. Groups and accounts are cr
|
|
|
558
570
|
API keys and secrets cannot be exported. Every newly created Service Account is active and has platform access but has no migrated credentials.
|
|
559
571
|
The push result contains `credentials: { stableKey, environment, policy: "target-local", status: "configure-manually" }`.
|
|
560
572
|
Existing target secrets remain local and are never compared, copied, rotated, or exposed in manifests, plans, lock files, or HTTP trace.
|
|
561
|
-
|
|
573
|
+
Execution memberships, unrestricted or multiple-principal management ACLs, other account metadata, and `metadataAdvanced` remain target-local. Existing self access is preserved when a portable management principal changes; name/metadata updates omit the ACL. Complex target ACLs cannot be replaced through the single-principal manifest, including with `--force`.
|
package/dist/src/client.d.ts
CHANGED
|
@@ -144,8 +144,31 @@ export type EndpointCreatePayload = Omit<EndpointWritePayload, 'version'> & {
|
|
|
144
144
|
export type ServiceAccountWritePayload = {
|
|
145
145
|
name?: string;
|
|
146
146
|
metadata?: Record<string, unknown>;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
access?: {
|
|
148
|
+
restricted: boolean;
|
|
149
|
+
users?: Array<string | {
|
|
150
|
+
id: string;
|
|
151
|
+
} | {
|
|
152
|
+
mail: string;
|
|
153
|
+
}>;
|
|
154
|
+
groups?: Array<string | {
|
|
155
|
+
id: string;
|
|
156
|
+
} | {
|
|
157
|
+
name: string;
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
memberships?: {
|
|
161
|
+
groups?: Array<string | {
|
|
162
|
+
id: string;
|
|
163
|
+
} | {
|
|
164
|
+
name: string;
|
|
165
|
+
}>;
|
|
166
|
+
roleGroups?: Array<string | {
|
|
167
|
+
id: string;
|
|
168
|
+
} | {
|
|
169
|
+
name: string;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
149
172
|
version?: number;
|
|
150
173
|
};
|
|
151
174
|
export type RoleGroupListRequest = {
|
|
@@ -416,8 +439,6 @@ export declare class RevoClient {
|
|
|
416
439
|
getServiceAccount(userId: string): Promise<ServiceAccountRecord>;
|
|
417
440
|
createServiceAccount(body: ServiceAccountWritePayload & {
|
|
418
441
|
name: string;
|
|
419
|
-
ownerId: string;
|
|
420
|
-
ownerType: 'USER' | 'GROUP';
|
|
421
442
|
}): Promise<ServiceAccountRecord>;
|
|
422
443
|
updateServiceAccount(userId: string, body: ServiceAccountWritePayload): Promise<ServiceAccountRecord>;
|
|
423
444
|
listRoleGroups(options?: RoleGroupListRequest): Promise<unknown>;
|
package/dist/src/client.js
CHANGED
|
@@ -1208,7 +1208,7 @@ export class RevoClient {
|
|
|
1208
1208
|
throw new Error('Invalid account response.');
|
|
1209
1209
|
}
|
|
1210
1210
|
const record = {};
|
|
1211
|
-
for (const field of ['userId', 'name', 'serviceAccount', 'ownerId', 'ownerType', 'version', 'deletedAt']) {
|
|
1211
|
+
for (const field of ['userId', 'name', 'serviceAccount', 'ownerId', 'ownerType', 'access', 'memberships', 'version', 'deletedAt']) {
|
|
1212
1212
|
if (wrapper[field] !== undefined) {
|
|
1213
1213
|
Object.assign(record, { [field]: wrapper[field] });
|
|
1214
1214
|
}
|
|
@@ -1855,6 +1855,28 @@ function readLibraryDebugCode(cwd, type) {
|
|
|
1855
1855
|
const filePath = path.join(cwd, '.revoengine', fileName);
|
|
1856
1856
|
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';
|
|
1857
1857
|
}
|
|
1858
|
+
function resolveDebugReadOnly(cwd, flag) {
|
|
1859
|
+
if (flag !== undefined) {
|
|
1860
|
+
if (flag === true || flag === 'true')
|
|
1861
|
+
return true;
|
|
1862
|
+
if (flag === false || flag === 'false')
|
|
1863
|
+
return false;
|
|
1864
|
+
throw new Error('--read-only must be true or false.');
|
|
1865
|
+
}
|
|
1866
|
+
const configPath = path.join(getProjectRoot(cwd) || cwd, '.revoengine', 'debug.json');
|
|
1867
|
+
if (!fs.existsSync(configPath))
|
|
1868
|
+
return true;
|
|
1869
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1870
|
+
if (typeof config.readOnly === 'boolean')
|
|
1871
|
+
return config.readOnly;
|
|
1872
|
+
if (typeof config.production === 'boolean') {
|
|
1873
|
+
const { production, ...rest } = config;
|
|
1874
|
+
const readOnly = !production;
|
|
1875
|
+
fs.writeFileSync(configPath, `${JSON.stringify({ ...rest, readOnly }, null, 2)}\n`);
|
|
1876
|
+
return readOnly;
|
|
1877
|
+
}
|
|
1878
|
+
return true;
|
|
1879
|
+
}
|
|
1858
1880
|
function buildDebugPayload(cwd, component, input) {
|
|
1859
1881
|
const type = normalizeComponentType(component);
|
|
1860
1882
|
const base = {
|
|
@@ -1862,6 +1884,7 @@ function buildDebugPayload(cwd, component, input) {
|
|
|
1862
1884
|
inputs: input.inputs,
|
|
1863
1885
|
timeout: input.timeout,
|
|
1864
1886
|
memory: input.memory,
|
|
1887
|
+
readOnly: input.readOnly,
|
|
1865
1888
|
...(input.extraLibs?.length ? { extraLibs: input.extraLibs } : {}),
|
|
1866
1889
|
};
|
|
1867
1890
|
if (!isDebugLibraryType(type)) {
|
|
@@ -1977,6 +2000,7 @@ async function debugSingleComponent(context, componentId) {
|
|
|
1977
2000
|
const inputs = parseDebugInputs(context.args);
|
|
1978
2001
|
const timeout = parseDebugNumber(context.args, ['timeout', 't'], 10, 600, 'Timeout');
|
|
1979
2002
|
const memory = parseDebugNumber(context.args, ['memory', 'm'], 128, 1024, 'Memory');
|
|
2003
|
+
const readOnly = resolveDebugReadOnly(context.cwd, context.args['read-only']);
|
|
1980
2004
|
const stream = readBoolFlag(context.args, ['stream']);
|
|
1981
2005
|
const includeExtraLibs = context.args['extra-libs'] !== false
|
|
1982
2006
|
&& !readBoolFlag(context.args, ['no-extra-libs']);
|
|
@@ -1991,6 +2015,7 @@ async function debugSingleComponent(context, componentId) {
|
|
|
1991
2015
|
inputs,
|
|
1992
2016
|
timeout,
|
|
1993
2017
|
memory,
|
|
2018
|
+
readOnly,
|
|
1994
2019
|
extraLibs: extraLibs.map((entry) => entry.payload),
|
|
1995
2020
|
});
|
|
1996
2021
|
const endpoint = stream ? buildSandboxDebugStreamUrl(sandboxEndpoint) : buildSandboxDebugUrl(sandboxEndpoint);
|
|
@@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { normalizeStableKeyValue } from "../resource-metadata.js";
|
|
4
4
|
import { samePrunePlan } from "../workspace-prune.js";
|
|
5
|
+
import { schemaItemAction, viewItemAction, componentItemAction, jobTemplateItemAction, endpointItemAction, scheduleItemAction, eventItemAction, groupItemAction, roleGroupItemAction, } from "../migration-actions.js";
|
|
5
6
|
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
6
7
|
import { buildMigrationPlan, pullResourcesToWorkspace, runMigration, } from "../migration.js";
|
|
7
8
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
@@ -108,6 +109,9 @@ function retainedPlanItems(plan, resource, items) {
|
|
|
108
109
|
const removed = new Set(plan.prune?.items.filter((item) => item.resource === resource).map((item) => normalizeStableKeyValue(item.stableKey)));
|
|
109
110
|
return items.filter((item) => !item.stableKey || !removed.has(normalizeStableKeyValue(item.stableKey)));
|
|
110
111
|
}
|
|
112
|
+
function baselineHints(item, existing = []) {
|
|
113
|
+
return [...(item.baselineAction ? [{ label: 'baseline', values: item.baselineAction }] : []), ...existing];
|
|
114
|
+
}
|
|
111
115
|
function printMigrationPlan(context, plan) {
|
|
112
116
|
const phaseLabel = plan.from === 'workspace' ? 'Deployment plan' : 'Migration';
|
|
113
117
|
context.println(`${phaseLabel} ${plan.from} -> ${plan.to}`);
|
|
@@ -140,12 +144,12 @@ function printMigrationPlan(context, plan) {
|
|
|
140
144
|
counts: phase.operations,
|
|
141
145
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
142
146
|
items: retainedPlanItems(plan, 'database-table', plan.databaseSchemas.items).map((item) => ({
|
|
143
|
-
status:
|
|
147
|
+
status: migrationItemActionLabel(item, schemaItemAction(item)),
|
|
144
148
|
target: item.stableKey || item.name,
|
|
145
149
|
reason: item.reason,
|
|
146
150
|
changedFields: item.changedFields,
|
|
147
151
|
details: planValueChanges(item.changes || []),
|
|
148
|
-
hints: item.hints.length > 0 ? [{ label: 'hints', values: item.hints }] : undefined,
|
|
152
|
+
hints: baselineHints(item, item.hints.length > 0 ? [{ label: 'hints', values: item.hints }] : undefined),
|
|
149
153
|
})),
|
|
150
154
|
warnings: phase.warnings,
|
|
151
155
|
blockers: phase.blockers,
|
|
@@ -158,7 +162,7 @@ function printMigrationPlan(context, plan) {
|
|
|
158
162
|
counts: phase.operations,
|
|
159
163
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
160
164
|
items: retainedPlanItems(plan, 'database-view', plan.databaseViews.items).map((item) => ({
|
|
161
|
-
status:
|
|
165
|
+
status: migrationItemActionLabel(item, item.status === 'validation-failed' ? item.status : viewItemAction(item)),
|
|
162
166
|
target: item.stableKey || item.name,
|
|
163
167
|
reason: item.reason,
|
|
164
168
|
changedFields: item.changedFields,
|
|
@@ -167,9 +171,9 @@ function printMigrationPlan(context, plan) {
|
|
|
167
171
|
...(item.rawQueryDiff?.length ? [{ label: 'rawQuery diff', lines: item.rawQueryDiff }] : []),
|
|
168
172
|
...(item.risks?.length ? [{ label: 'risks', values: item.risks }] : []),
|
|
169
173
|
],
|
|
170
|
-
hints: item.scheduleDependencies?.length
|
|
174
|
+
hints: baselineHints(item, item.scheduleDependencies?.length
|
|
171
175
|
? [{ label: 'schedule dependencies', values: item.scheduleDependencies }]
|
|
172
|
-
: undefined,
|
|
176
|
+
: undefined),
|
|
173
177
|
})),
|
|
174
178
|
warnings: phase.warnings,
|
|
175
179
|
blockers: phase.blockers,
|
|
@@ -182,7 +186,7 @@ function printMigrationPlan(context, plan) {
|
|
|
182
186
|
counts: phase.operations,
|
|
183
187
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
184
188
|
items: retainedPlanItems(plan, 'component', plan.components.items).map((item) => ({
|
|
185
|
-
status:
|
|
189
|
+
status: migrationItemActionLabel(item, componentItemAction(item)),
|
|
186
190
|
target: item.stableKey || item.path,
|
|
187
191
|
reason: item.reason,
|
|
188
192
|
changedFields: item.status === 'create' ? undefined : item.changedFields,
|
|
@@ -190,9 +194,9 @@ function printMigrationPlan(context, plan) {
|
|
|
190
194
|
details: item.status === 'create' ? undefined : [
|
|
191
195
|
...(item.codeDiffs || []).map((code) => ({ label: `element ${code.element}`, lines: code.lines })),
|
|
192
196
|
],
|
|
193
|
-
hints: item.status !== 'create' && item.componentType
|
|
197
|
+
hints: baselineHints(item, item.status !== 'create' && item.componentType
|
|
194
198
|
? [{ label: 'type', values: item.componentType }]
|
|
195
|
-
: undefined,
|
|
199
|
+
: undefined),
|
|
196
200
|
})),
|
|
197
201
|
warnings: phase.warnings,
|
|
198
202
|
blockers: phase.blockers,
|
|
@@ -200,7 +204,11 @@ function printMigrationPlan(context, plan) {
|
|
|
200
204
|
}
|
|
201
205
|
if (phase.resource === 'service-account' && plan.serviceAccounts) {
|
|
202
206
|
printSyncPlan(context.println, { title: `${phaseLabel} phase ${phase.order} / Service Account`, environment: plan.to,
|
|
203
|
-
counts: phase.operations,
|
|
207
|
+
counts: phase.operations, showHints: readBoolFlag(context.args, ['hints']),
|
|
208
|
+
items: retainedPlanItems(plan, 'service-account', plan.serviceAccounts.items).map((item) => ({ ...item,
|
|
209
|
+
status: item.operation ?? item.status,
|
|
210
|
+
hints: baselineHints(item),
|
|
211
|
+
})), warnings: phase.warnings, blockers: phase.blockers });
|
|
204
212
|
}
|
|
205
213
|
if (phase.resource === 'job-template' && plan.jobTemplates) {
|
|
206
214
|
printSyncPlan(context.println, {
|
|
@@ -209,15 +217,15 @@ function printMigrationPlan(context, plan) {
|
|
|
209
217
|
counts: phase.operations,
|
|
210
218
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
211
219
|
items: retainedPlanItems(plan, 'job-template', plan.jobTemplates.items).map((item) => ({
|
|
212
|
-
status:
|
|
220
|
+
status: migrationItemActionLabel(item, jobTemplateItemAction(item)),
|
|
213
221
|
target: item.stableKey || item.name,
|
|
214
222
|
reason: item.reason,
|
|
215
223
|
changedFields: item.changedFields,
|
|
216
224
|
fieldChanges: item.fieldChanges,
|
|
217
|
-
hints: [
|
|
225
|
+
hints: baselineHints(item, [
|
|
218
226
|
...(item.componentStableKey ? [{ label: 'component', values: item.componentStableKey }] : []),
|
|
219
227
|
...(item.dependencyReadiness ? [{ label: 'dependency', values: item.dependencyReadiness }] : []),
|
|
220
|
-
],
|
|
228
|
+
]),
|
|
221
229
|
})),
|
|
222
230
|
warnings: phase.warnings,
|
|
223
231
|
blockers: phase.blockers,
|
|
@@ -230,12 +238,12 @@ function printMigrationPlan(context, plan) {
|
|
|
230
238
|
counts: phase.operations,
|
|
231
239
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
232
240
|
items: retainedPlanItems(plan, 'endpoint', plan.endpoints.items).map((item) => ({
|
|
233
|
-
status:
|
|
241
|
+
status: migrationItemActionLabel(item, endpointItemAction(item)),
|
|
234
242
|
target: item.stableKey || item.name,
|
|
235
243
|
reason: item.reason,
|
|
236
244
|
changedFields: item.changedFields,
|
|
237
245
|
fieldChanges: item.fieldChanges,
|
|
238
|
-
hints: [
|
|
246
|
+
hints: baselineHints(item, [
|
|
239
247
|
...(item.details || []),
|
|
240
248
|
...(item.dependencies || []).map((dependency) => ({
|
|
241
249
|
label: `${dependency.relation} dependency`,
|
|
@@ -244,7 +252,7 @@ function printMigrationPlan(context, plan) {
|
|
|
244
252
|
...(item.routeDependencies?.length
|
|
245
253
|
? [{ label: 'route waits for', values: item.routeDependencies.join(', ') }]
|
|
246
254
|
: []),
|
|
247
|
-
],
|
|
255
|
+
]),
|
|
248
256
|
})),
|
|
249
257
|
warnings: phase.warnings,
|
|
250
258
|
blockers: phase.blockers,
|
|
@@ -257,12 +265,12 @@ function printMigrationPlan(context, plan) {
|
|
|
257
265
|
counts: phase.operations,
|
|
258
266
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
259
267
|
items: retainedPlanItems(plan, 'schedule', plan.schedules.items).map((item) => ({
|
|
260
|
-
status:
|
|
268
|
+
status: migrationItemActionLabel(item, scheduleItemAction(item)),
|
|
261
269
|
target: item.stableKey || item.name,
|
|
262
270
|
reason: item.reason,
|
|
263
271
|
changedFields: item.changedFields,
|
|
264
272
|
fieldChanges: item.fieldChanges,
|
|
265
|
-
hints: item.dependency ? planDependencyHints(item.dependency) : undefined,
|
|
273
|
+
hints: baselineHints(item, item.dependency ? planDependencyHints(item.dependency) : undefined),
|
|
266
274
|
})),
|
|
267
275
|
warnings: phase.warnings,
|
|
268
276
|
blockers: phase.blockers,
|
|
@@ -275,14 +283,14 @@ function printMigrationPlan(context, plan) {
|
|
|
275
283
|
counts: phase.operations,
|
|
276
284
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
277
285
|
items: retainedPlanItems(plan, 'event', plan.events.items).map((item) => ({
|
|
278
|
-
status:
|
|
286
|
+
status: migrationItemActionLabel(item, eventItemAction(item)),
|
|
279
287
|
target: item.stableKey || item.name,
|
|
280
288
|
reason: item.reason,
|
|
281
289
|
changedFields: item.changedFields,
|
|
282
290
|
fieldChanges: item.fieldChanges,
|
|
283
|
-
hints: item.dependency
|
|
291
|
+
hints: baselineHints(item, item.dependency
|
|
284
292
|
? planDependencyHints({ ...item.dependency, resource: 'job-template' })
|
|
285
|
-
: undefined,
|
|
293
|
+
: undefined),
|
|
286
294
|
})),
|
|
287
295
|
warnings: phase.warnings,
|
|
288
296
|
blockers: phase.blockers,
|
|
@@ -295,14 +303,14 @@ function printMigrationPlan(context, plan) {
|
|
|
295
303
|
counts: phase.operations,
|
|
296
304
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
297
305
|
items: retainedPlanItems(plan, 'group', plan.groups.items).map((item) => ({
|
|
298
|
-
status:
|
|
306
|
+
status: migrationItemActionLabel(item, groupItemAction(item)),
|
|
299
307
|
target: item.stableKey || item.name,
|
|
300
308
|
reason: item.reason,
|
|
301
309
|
changedFields: item.changedFields,
|
|
302
310
|
fieldChanges: item.fieldChanges,
|
|
303
|
-
hints: item.ownerStableKey
|
|
311
|
+
hints: baselineHints(item, item.ownerStableKey
|
|
304
312
|
? [{ label: 'owner', values: item.ownerStableKey }]
|
|
305
|
-
: undefined,
|
|
313
|
+
: undefined),
|
|
306
314
|
})),
|
|
307
315
|
warnings: phase.warnings,
|
|
308
316
|
blockers: phase.blockers,
|
|
@@ -315,12 +323,13 @@ function printMigrationPlan(context, plan) {
|
|
|
315
323
|
counts: phase.operations,
|
|
316
324
|
showHints: readBoolFlag(context.args, ['hints']),
|
|
317
325
|
items: retainedPlanItems(plan, 'role-group', plan.roleGroups.items).map((item) => ({
|
|
318
|
-
status:
|
|
326
|
+
status: migrationItemActionLabel(item, roleGroupItemAction(item)),
|
|
319
327
|
target: item.stableKey || item.name,
|
|
320
328
|
reason: item.reason,
|
|
321
329
|
changedFields: item.changedFields,
|
|
322
330
|
fieldChanges: item.fieldChanges,
|
|
323
331
|
details: planListChanges('roles', item.rolesToRemove, item.rolesToAdd),
|
|
332
|
+
hints: baselineHints(item),
|
|
324
333
|
})),
|
|
325
334
|
warnings: phase.warnings,
|
|
326
335
|
blockers: phase.blockers,
|
|
@@ -328,157 +337,22 @@ function printMigrationPlan(context, plan) {
|
|
|
328
337
|
}
|
|
329
338
|
}
|
|
330
339
|
if (plan.prune) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
if (item.status === 'remote-changed' || item.status === 'conflict' || item.status === 'safe-update') {
|
|
345
|
-
return 'update';
|
|
346
|
-
}
|
|
347
|
-
if (item.status === 'reconciled') {
|
|
348
|
-
return 'adopt';
|
|
349
|
-
}
|
|
350
|
-
if (item.status === 'manual-schema-migration-required'
|
|
351
|
-
|| item.status === 'access-policy-required'
|
|
352
|
-
|| item.status === 'previously-deleted-partition'
|
|
353
|
-
|| item.status === 'replacement-requires-two-phases'
|
|
354
|
-
|| item.status === 'collision') {
|
|
355
|
-
return 'blocked';
|
|
356
|
-
}
|
|
357
|
-
if (item.status === 'orphan-root'
|
|
358
|
-
|| item.status === 'orphan-partition'
|
|
359
|
-
|| item.status === 'delete-partition'
|
|
360
|
-
|| item.status === 'unmanaged') {
|
|
361
|
-
return 'excluded';
|
|
362
|
-
}
|
|
363
|
-
return item.status;
|
|
364
|
-
}
|
|
365
|
-
function viewItemActionLabel(item) {
|
|
366
|
-
if (item.status === 'collision' || (item.status === 'conflict' && item.reason)) {
|
|
367
|
-
return 'blocked';
|
|
368
|
-
}
|
|
369
|
-
if (item.status === 'missing-lock') {
|
|
370
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
371
|
-
}
|
|
372
|
-
if (item.status === 'remote-changed' || item.status === 'conflict' || item.status === 'safe-update') {
|
|
373
|
-
return 'update';
|
|
374
|
-
}
|
|
375
|
-
if (item.status === 'orphan' || item.status === 'skipped') {
|
|
376
|
-
return 'excluded';
|
|
377
|
-
}
|
|
378
|
-
return item.status;
|
|
379
|
-
}
|
|
380
|
-
function componentItemActionLabel(item) {
|
|
381
|
-
if (item.status === 'clean' && item.lockHash === null && item.localHash !== null && item.localHash === item.remoteHash) {
|
|
382
|
-
return 'adopt';
|
|
383
|
-
}
|
|
384
|
-
if (item.status === 'local-changed' || item.status === 'remote-changed' || item.status === 'conflict' || item.status === 'missing-lock') {
|
|
385
|
-
return 'update';
|
|
386
|
-
}
|
|
387
|
-
if (item.status === 'safe-update') {
|
|
388
|
-
return 'excluded';
|
|
389
|
-
}
|
|
390
|
-
return item.status;
|
|
391
|
-
}
|
|
392
|
-
function jobTemplateItemActionLabel(item) {
|
|
393
|
-
if (item.status === 'collision' || (item.status === 'conflict' && !item.desiredHash)) {
|
|
394
|
-
return 'blocked';
|
|
395
|
-
}
|
|
396
|
-
if (item.status === 'missing-lock') {
|
|
397
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
398
|
-
}
|
|
399
|
-
if (item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
400
|
-
return 'update';
|
|
401
|
-
}
|
|
402
|
-
if (item.status === 'orphan' || item.status === 'skipped') {
|
|
403
|
-
return 'excluded';
|
|
404
|
-
}
|
|
405
|
-
return item.status;
|
|
406
|
-
}
|
|
407
|
-
function endpointItemActionLabel(item) {
|
|
408
|
-
if (item.status === 'restore-blocked' || item.status === 'collision') {
|
|
409
|
-
return 'blocked';
|
|
410
|
-
}
|
|
411
|
-
if (item.status === 'restore' || item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
412
|
-
return 'update';
|
|
413
|
-
}
|
|
414
|
-
if (item.status === 'missing-lock') {
|
|
415
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
416
|
-
}
|
|
417
|
-
if (item.status === 'orphan' || item.status === 'skipped') {
|
|
418
|
-
return 'excluded';
|
|
419
|
-
}
|
|
420
|
-
return item.status;
|
|
421
|
-
}
|
|
422
|
-
function scheduleItemActionLabel(item) {
|
|
423
|
-
if (item.blocked === true || item.status === 'collision') {
|
|
424
|
-
return 'blocked';
|
|
425
|
-
}
|
|
426
|
-
if (item.status === 'missing-lock') {
|
|
427
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
428
|
-
}
|
|
429
|
-
if (item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
430
|
-
return 'update';
|
|
431
|
-
}
|
|
432
|
-
if (item.status === 'orphan' || item.status === 'skipped') {
|
|
433
|
-
return 'excluded';
|
|
434
|
-
}
|
|
435
|
-
return item.status;
|
|
436
|
-
}
|
|
437
|
-
function eventItemActionLabel(item) {
|
|
438
|
-
if (item.blocked === true || item.status === 'collision') {
|
|
439
|
-
return 'blocked';
|
|
440
|
-
}
|
|
441
|
-
if (item.status === 'missing-lock') {
|
|
442
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
443
|
-
}
|
|
444
|
-
if (item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
445
|
-
return 'update';
|
|
446
|
-
}
|
|
447
|
-
if (item.status === 'orphan' || item.status === 'skipped' || item.status === 'activation-drift') {
|
|
448
|
-
return 'excluded';
|
|
449
|
-
}
|
|
450
|
-
return item.status;
|
|
451
|
-
}
|
|
452
|
-
function groupItemActionLabel(item) {
|
|
453
|
-
if (item.status === 'collision'
|
|
454
|
-
|| ((item.status === 'conflict' || item.status === 'missing-lock') && !item.currentHash)) {
|
|
455
|
-
return 'blocked';
|
|
456
|
-
}
|
|
457
|
-
if (item.status === 'missing-lock') {
|
|
458
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
459
|
-
}
|
|
460
|
-
if (item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
461
|
-
return 'update';
|
|
462
|
-
}
|
|
463
|
-
if (item.status === 'manual-owner' || item.status === 'orphan' || item.status === 'skipped') {
|
|
464
|
-
return 'excluded';
|
|
340
|
+
for (const beforeUpserts of [true, false]) {
|
|
341
|
+
const items = plan.prune.items.filter((item) => Boolean(item.beforeUpserts) === beforeUpserts);
|
|
342
|
+
if (beforeUpserts && items.length === 0)
|
|
343
|
+
continue;
|
|
344
|
+
printSyncPlan(context.println, {
|
|
345
|
+
title: beforeUpserts ? 'Deletion before upserts to release conflicting names' : 'Deletion after verified upserts', environment: plan.to,
|
|
346
|
+
counts: { delete: items.length },
|
|
347
|
+
items: items.map((item) => ({ status: 'delete', target: `${item.resource}:${item.stableKey}`,
|
|
348
|
+
details: [{ label: 'target', values: item.targetId }, { label: 'name', values: item.name }] })),
|
|
349
|
+
blockers: plan.prune.blockers,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
465
352
|
}
|
|
466
|
-
return item.status;
|
|
467
353
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
return 'blocked';
|
|
471
|
-
}
|
|
472
|
-
if (item.status === 'missing-lock') {
|
|
473
|
-
return item.desiredHash === item.currentHash ? 'adopt' : 'update';
|
|
474
|
-
}
|
|
475
|
-
if (item.status === 'safe-update' || item.status === 'remote-changed' || item.status === 'conflict') {
|
|
476
|
-
return 'update';
|
|
477
|
-
}
|
|
478
|
-
if (item.status === 'orphan' || item.status === 'skipped') {
|
|
479
|
-
return 'excluded';
|
|
480
|
-
}
|
|
481
|
-
return item.status;
|
|
354
|
+
function migrationItemActionLabel(item, legacyAction) {
|
|
355
|
+
return item.operation ?? (legacyAction === 'noop' ? item.status : legacyAction);
|
|
482
356
|
}
|
|
483
357
|
async function confirmRun(context, from, to) {
|
|
484
358
|
if (readBoolFlag(context.args, ['yes', 'y'])) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { MigrationOperations } from './migration.ts';
|
|
2
|
+
import type { ComponentPlanItem } from './commands/component.ts';
|
|
3
|
+
import type { DatabaseSchemaPlanItem, DatabaseSchemaPlanStatus } from './resource-syncs/database-table-sync.ts';
|
|
4
|
+
import type { DatabaseViewPlanItem } from './resource-syncs/database-view-sync.ts';
|
|
5
|
+
import type { JobTemplatePlanItem } from './resource-syncs/job-template-sync.ts';
|
|
6
|
+
import type { EndpointPlanItem } from './resource-syncs/endpoint-sync.ts';
|
|
7
|
+
import type { SchedulePlanItem } from './resource-syncs/schedule-sync.ts';
|
|
8
|
+
import type { EventPlanItem } from './resource-syncs/event-sync.ts';
|
|
9
|
+
import type { GroupPlanItem } from './resource-syncs/group-sync.ts';
|
|
10
|
+
import type { RoleGroupPlanItem } from './resource-syncs/role-group-sync.ts';
|
|
11
|
+
import type { ServiceAccountPlanItem } from './resource-syncs/service-account-sync.ts';
|
|
12
|
+
export declare const BLOCKING_SCHEMA_STATUSES: Set<DatabaseSchemaPlanStatus>;
|
|
13
|
+
export declare function schemaItemAction(item: DatabaseSchemaPlanItem): keyof MigrationOperations;
|
|
14
|
+
export declare function viewItemIsBlocked(item: DatabaseViewPlanItem): boolean;
|
|
15
|
+
export declare function viewItemAction(item: DatabaseViewPlanItem): keyof MigrationOperations;
|
|
16
|
+
export declare function componentItemAction(item: ComponentPlanItem): keyof MigrationOperations;
|
|
17
|
+
export declare function jobTemplateItemAction(item: JobTemplatePlanItem): keyof MigrationOperations;
|
|
18
|
+
export declare function endpointItemAction(item: EndpointPlanItem): keyof MigrationOperations;
|
|
19
|
+
export declare function scheduleItemAction(item: SchedulePlanItem): keyof MigrationOperations;
|
|
20
|
+
export declare function eventItemAction(item: EventPlanItem): keyof MigrationOperations;
|
|
21
|
+
export declare function groupItemAction(item: GroupPlanItem): keyof MigrationOperations;
|
|
22
|
+
export declare function roleGroupItemAction(item: RoleGroupPlanItem): keyof MigrationOperations;
|
|
23
|
+
export declare function serviceAccountItemAction(item: ServiceAccountPlanItem): keyof MigrationOperations;
|
|
24
|
+
export type RepositoryItemDecision = {
|
|
25
|
+
operation: keyof MigrationOperations;
|
|
26
|
+
baselineAction: 'adopt' | 'refresh' | 'none';
|
|
27
|
+
};
|
|
28
|
+
export type MigrationResourcePlan<T extends {
|
|
29
|
+
items: unknown[];
|
|
30
|
+
}> = Omit<T, 'items'> & {
|
|
31
|
+
items: Array<T['items'][number] & Partial<RepositoryItemDecision>>;
|
|
32
|
+
};
|
|
33
|
+
type ComparableRepositoryItem = {
|
|
34
|
+
status: string;
|
|
35
|
+
desiredHash?: string | null;
|
|
36
|
+
currentHash?: string | null;
|
|
37
|
+
localHash?: string | null;
|
|
38
|
+
remoteHash?: string | null;
|
|
39
|
+
};
|
|
40
|
+
export declare function projectRepositoryItems<T extends ComparableRepositoryItem>(items: T[], classify: (item: T) => keyof MigrationOperations, baselineHash: (item: T) => string | null | undefined): Array<T & RepositoryItemDecision>;
|
|
41
|
+
export declare function migrationItemOperation(item: {
|
|
42
|
+
status: string;
|
|
43
|
+
} & Partial<RepositoryItemDecision>, legacyAction: keyof MigrationOperations): keyof MigrationOperations;
|
|
44
|
+
export {};
|