@revoengine/cli 1.0.17 → 1.0.18
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 +14 -4
- 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/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/workspace-prune.d.ts +2 -0
- package/dist/src/workspace-prune.js +59 -6
- 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
|
|
|
@@ -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 {};
|