@revoengine/cli 1.0.27 → 1.0.29
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 +9 -3
- package/dist/src/cli.js +1 -1
- package/dist/src/client.d.ts +4 -4
- package/dist/src/commands/migrate.js +2 -0
- package/dist/src/migration.js +11 -9
- package/dist/src/resource-syncs/automation-input.d.ts +7 -0
- package/dist/src/resource-syncs/automation-input.js +38 -0
- package/dist/src/resource-syncs/event-sync.d.ts +2 -1
- package/dist/src/resource-syncs/event-sync.js +49 -21
- package/dist/src/resource-syncs/schedule-sync.d.ts +2 -1
- package/dist/src/resource-syncs/schedule-sync.js +17 -4
- package/dist/src/types.d.ts +7 -2
- package/dist/src/ui.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -422,6 +422,12 @@ Existing `database-schema` selectors and `revo database-schemas` commands remain
|
|
|
422
422
|
|
|
423
423
|
Older Event manifests without `custom` must be refreshed with `revo events pull` from the source environment or edited to set `custom` explicitly. The pull upgrades an unchanged, locked manifest without `--force`. Check the `type` too: a legacy `CUSTOM_EXPORT` event now uses `type: "EXPORT", custom: true` when that is the source definition. An Event plan blocks manifests with no `custom` classifier.
|
|
424
424
|
|
|
425
|
+
Event and Schedule manifests retain runtime `input` (a JSON object) and `inputMode` at the top level. Pull, plan, push, migration and readback verification include both fields. Supported modes are `override` (shallow overlay onto Job template input), `deep_override` (nested object overlay, replacing arrays and retaining null values), and `replace` (whole-input replacement, including clearing it with `{}`). The CLI migrates these definitions; the backend resolves the Job input. Unknown modes, null/scalar/array input and duplicate top-level/extension fields block writes, including with `--force`.
|
|
426
|
+
|
|
427
|
+
Previously pulled Event manifests with `extensions.input` and `extensions.inputMode` remain accepted; only those extension fields are writable. A fresh pull writes them at the top level. Old Event lock hashes are recognized using the complete live input values, so they cannot hide remote drift. Other extension fields still block deployment.
|
|
428
|
+
|
|
429
|
+
Omitted fields mean `input: {}` and `inputMode: "override"` in the CLI's desired definition, including updates. Older Schedule pulls did not export these fields: re-pull from the source before promotion if that source uses nondefault automation input. A plan shows any difference from the target; approving an overwrite applies the manifest defaults. Regenerate saved reviewed plans after updating the CLI because input and mode now participate in definition hashes.
|
|
430
|
+
|
|
425
431
|
### Work with one resource family
|
|
426
432
|
|
|
427
433
|
Every resource family has a dedicated synchronization flow. With a stored login or `REVO_URL` and `REVO_TOKEN`, omit `--project` to use the active connection:
|
|
@@ -444,7 +450,7 @@ revo schedules push --all --yes --force
|
|
|
444
450
|
|
|
445
451
|
`--force` permits adopting a missing Schedule baseline or overwriting reviewed target drift. It also approves a reviewed transition between Job Template and Materialized View targets under one Schedule Stable Key. Materialized View refresh Schedules are included with the other Schedules and identify their Database View by Stable Key and refresh mode, never by a source UUID. User-managed `JOB_TEMPLATE` and `PLATFORM_OPERATION` schedules of kind `refresh_materialized_view` are supported. Other platform operations, `AGENT`, and system-managed Schedules are excluded; `--strict` treats exclusions as incomplete coverage.
|
|
446
452
|
|
|
447
|
-
Pull initializes each Schedule's editable activation candidate from the source. A new target Schedule is created inactive, while a configuration update preserves its target activation state. `activationCandidate` records the desired active state. Plans report activation-only differences as `activation-drift`, including without a target lock baseline
|
|
453
|
+
Pull initializes each Schedule's editable activation candidate from the source. A new target Schedule is created inactive, while a configuration update preserves its target activation state. `activationCandidate` records the desired active state. Plans report activation-only differences as `activation-drift`, including without a target lock baseline. Repository `plan/deploy` without `--activate` verifies definition convergence and preserves target activation; activation-only drift remains informational and does not fail a strict plan or final verification. With `--activate`, activation differences require changes and are aligned only after verified writes and pruning. Plan and deploy must use the same activation policy. `schedules push --all --yes --activate` also aligns verified new, updated and otherwise unchanged Schedules, including disabling them. Failed configuration preflight skips activation; changed definitions or dependencies block activation. Interactive activation asks for a second confirmation. Named `migrate` retains its separate activation-convergence checks.
|
|
448
454
|
|
|
449
455
|
Use `--project` to select a saved project explicitly (`--env` remains a compatible alias):
|
|
450
456
|
|
|
@@ -508,7 +514,7 @@ Resource plans support `--json` for automation and generally support `--strict`
|
|
|
508
514
|
- `--force` approves only explicitly supported risky or drifted operations; it is not a universal bypass.
|
|
509
515
|
- Writes resolve the target UUID and version immediately before mutation and verify the portable result afterward.
|
|
510
516
|
- Stable Keys cross environments; source UUIDs, versions, members, users, ACLs, and other target-local identities do not.
|
|
511
|
-
- New Schedules and Events are created inactive; ordinary updates preserve target activation. Dedicated `schedules push --all --yes --activate` aligns manifest activation intent for verified new, updated and otherwise unchanged Schedules, including disabling them. Activation drift is shown by plans and
|
|
517
|
+
- New Schedules and Events are created inactive; ordinary updates preserve target activation. Dedicated `schedules push --all --yes --activate` aligns manifest activation intent for verified new, updated and otherwise unchanged Schedules, including disabling them. Activation drift is shown by plans and affects repository convergence only with --activate. `events push --all --yes --activate` aligns verified Events with manifest activation intent, including disabling them; configuration failures skip Event activation. Interactive activation requires an additional confirmation. `deploy --activate` runs this phase after verified writes and pruning; named `migrate` leaves activation to dedicated commands.
|
|
512
518
|
- Groups and Role Groups are intentionally late phases because they can affect ownership and access.
|
|
513
519
|
- Lock data is stored in `.revoengine/revo.lock.json`; API tokens are never persisted in the project.
|
|
514
520
|
|
|
@@ -643,7 +649,7 @@ Portable comparison includes ordinary Component metadata and full structured Dat
|
|
|
643
649
|
|
|
644
650
|
Endpoint and Job Template pins use the API content identity `v1:sha256:<64 lowercase hex characters>`, independently of the configuration hash. Latest bindings explicitly clear old digest pins. Endpoint `pinnedDigest` fingerprints from older CLI versions are upgraded in memory only when their exact local Component source proves the content identity; otherwise re-pull the source definition. Numeric-only Job Template pins remain explicitly unsupported; use a canonical digest pin instead.
|
|
645
651
|
|
|
646
|
-
Schedule and
|
|
652
|
+
Repository `plan/deploy` without `--activate` preserves existing Event and Schedule activation and creates new definitions inactive. Differences from manifest activation remain visible as `activation-drift`, but do not prevent definition convergence. With `--activate`, strict plans and final verification require activation to match the manifest. Reviewed deployment still fences live target activation and rejects changes after planning, in either mode. Named migration and dedicated family plans retain their activation-convergence checks. Deprecated Schedule `targetVersion` is reported diagnostically; the backend does not use it to select a Job Template revision.
|
|
647
653
|
|
|
648
654
|
`CUSTOM_NODEJS` deployment verifies runtime availability and the active desired revision after source readback. Automatic deployment waits up to two minutes for readiness; failed attempts, manual activation requirements and unavailable/pending revisions fail verification without adopting a deployment baseline. Re-run after the runtime is ready. Named `env diff/apply` also reports unavailable unchanged custom runtimes and returns an error on unverified writes. Definition synchronization does not invoke provider/plugin tests; component dependencies and their pinned revisions are checked with read-only API calls, including unchanged definitions.
|
|
649
655
|
|
package/dist/src/cli.js
CHANGED
|
@@ -198,7 +198,7 @@ async function runMain(args, argv) {
|
|
|
198
198
|
const command = args._[0];
|
|
199
199
|
const noPositionals = args._.length === 0;
|
|
200
200
|
if (command === 'version' || ((args.version !== undefined || args.V !== undefined) && noPositionals)) {
|
|
201
|
-
print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true } } : packageVersion);
|
|
201
|
+
print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true } } : packageVersion);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeExecutionPolicy } from './types.ts';
|
|
1
|
+
import type { AutomationRuntimeInputFields, RuntimeExecutionPolicy } from './types.ts';
|
|
2
2
|
import { RequestQueue } from './request-queue.ts';
|
|
3
3
|
import type { AgentRecord, AgentPluginRecord, ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ServiceAccountRecord, ScheduleRecord } from './types.ts';
|
|
4
4
|
import type { TrackableResourceType } from './tracked-resources.ts';
|
|
@@ -198,7 +198,7 @@ export type EventMetadataWritePayload = {
|
|
|
198
198
|
version: number;
|
|
199
199
|
metadata: Record<string, unknown>;
|
|
200
200
|
};
|
|
201
|
-
export type EventWritePayload = EventMetadataWritePayload & {
|
|
201
|
+
export type EventWritePayload = EventMetadataWritePayload & AutomationRuntimeInputFields & {
|
|
202
202
|
custom?: boolean;
|
|
203
203
|
name?: string;
|
|
204
204
|
category?: string | null;
|
|
@@ -220,7 +220,7 @@ export type EventCreatePayload = Omit<EventWritePayload, 'version'> & {
|
|
|
220
220
|
export type EventListAllOptions = {
|
|
221
221
|
includeDeleted?: boolean;
|
|
222
222
|
};
|
|
223
|
-
export type ScheduleWritePayload = {
|
|
223
|
+
export type ScheduleWritePayload = AutomationRuntimeInputFields & {
|
|
224
224
|
version: number;
|
|
225
225
|
metadata: Record<string, unknown>;
|
|
226
226
|
name?: string;
|
|
@@ -233,7 +233,7 @@ export type ScheduleWritePayload = {
|
|
|
233
233
|
targetVersion?: number | null;
|
|
234
234
|
targetConfig?: Record<string, unknown> | null;
|
|
235
235
|
};
|
|
236
|
-
export type ScheduleCreatePayload = {
|
|
236
|
+
export type ScheduleCreatePayload = AutomationRuntimeInputFields & {
|
|
237
237
|
name: string;
|
|
238
238
|
category?: string | null;
|
|
239
239
|
active: boolean;
|
|
@@ -128,6 +128,8 @@ function printMigrationPlan(context, plan) {
|
|
|
128
128
|
context.println(`Diagnostics: ${plan.warnings.length} warning(s), ${plan.blockers.length} blocker(s).`);
|
|
129
129
|
if (plan.policy.activateAutomations)
|
|
130
130
|
context.println('Automation activation: align tracked Events and Schedules with repository active values after verified writes and pruning.');
|
|
131
|
+
else if (plan.from === 'workspace')
|
|
132
|
+
context.println('Automation activation: preserve target Event and Schedule active values; create new definitions inactive.');
|
|
131
133
|
if (plan.sourcePull.mode === 'repository') {
|
|
132
134
|
context.println('Source snapshot: repository workspace (no remote source pull).');
|
|
133
135
|
}
|
package/dist/src/migration.js
CHANGED
|
@@ -253,7 +253,7 @@ function summarizeEndpointPhase(plan) {
|
|
|
253
253
|
blockers,
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
function summarizeSchedulePhase(plan) {
|
|
256
|
+
function summarizeSchedulePhase(plan, alignActivation = true) {
|
|
257
257
|
const operations = emptyOperations();
|
|
258
258
|
for (const item of plan.items) {
|
|
259
259
|
operations[migrationItemOperation(item, scheduleItemAction(item))] += 1;
|
|
@@ -272,7 +272,7 @@ function summarizeSchedulePhase(plan) {
|
|
|
272
272
|
return {
|
|
273
273
|
order: 6,
|
|
274
274
|
resource: 'schedule',
|
|
275
|
-
needsChanges: operations.create + operations.update > 0 || plan.items.some((item) => item.status === 'activation-drift'),
|
|
275
|
+
needsChanges: operations.create + operations.update > 0 || (alignActivation && plan.items.some((item) => item.status === 'activation-drift')),
|
|
276
276
|
readyToMigrate: blockers.length === 0,
|
|
277
277
|
verdict: phaseVerdict(blockers, warnings),
|
|
278
278
|
operations,
|
|
@@ -280,7 +280,7 @@ function summarizeSchedulePhase(plan) {
|
|
|
280
280
|
blockers,
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
function summarizeEventPhase(plan) {
|
|
283
|
+
function summarizeEventPhase(plan, alignActivation = true) {
|
|
284
284
|
const operations = emptyOperations();
|
|
285
285
|
for (const item of plan.items) {
|
|
286
286
|
operations[migrationItemOperation(item, eventItemAction(item))] += 1;
|
|
@@ -296,13 +296,15 @@ function summarizeEventPhase(plan) {
|
|
|
296
296
|
.map((item) => `Event "${item.stableKey || item.name}" has no target lock baseline; source-wins migration will align or adopt it.`),
|
|
297
297
|
...plan.items
|
|
298
298
|
.filter((item) => item.status === 'activation-drift')
|
|
299
|
-
.map((item) =>
|
|
299
|
+
.map((item) => alignActivation
|
|
300
|
+
? `Event "${item.stableKey || item.name}" has activation drift; activation requires repository plan/deploy --activate or the dedicated events push --activate step.`
|
|
301
|
+
: `Event "${item.stableKey || item.name}" has activation drift; repository deployment preserves target activation without --activate.`),
|
|
300
302
|
])];
|
|
301
303
|
const blockers = [...new Set(plan.blockers)];
|
|
302
304
|
return {
|
|
303
305
|
order: 7,
|
|
304
306
|
resource: 'event',
|
|
305
|
-
needsChanges: operations.create + operations.update > 0 || plan.items.some(item => item.status === 'activation-drift'),
|
|
307
|
+
needsChanges: operations.create + operations.update > 0 || (alignActivation && plan.items.some(item => item.status === 'activation-drift')),
|
|
306
308
|
readyToMigrate: blockers.length === 0,
|
|
307
309
|
verdict: phaseVerdict(blockers, warnings),
|
|
308
310
|
operations,
|
|
@@ -616,8 +618,8 @@ function combinePlan(input) {
|
|
|
616
618
|
...(input.agents ? [summarizeAgentPhase(input.agents)] : []),
|
|
617
619
|
...(input.jobTemplates ? [summarizeJobTemplatePhase(input.jobTemplates)] : []),
|
|
618
620
|
...(input.endpoints ? [summarizeEndpointPhase(input.endpoints)] : []),
|
|
619
|
-
...(input.schedules ? [summarizeSchedulePhase(input.schedules)] : []),
|
|
620
|
-
...(input.events ? [summarizeEventPhase(input.events)] : []),
|
|
621
|
+
...(input.schedules ? [summarizeSchedulePhase(input.schedules, input.migrationInput.sourceMode !== 'workspace' || input.migrationInput.activateAutomations === true)] : []),
|
|
622
|
+
...(input.events ? [summarizeEventPhase(input.events, input.migrationInput.sourceMode !== 'workspace' || input.migrationInput.activateAutomations === true)] : []),
|
|
621
623
|
...(input.groups ? [summarizeGroupPhase(input.groups)] : []),
|
|
622
624
|
...(input.roleGroups ? [summarizeRoleGroupPhase(input.roleGroups)] : []),
|
|
623
625
|
].map((phase) => ({ ...phase, order: RESOURCE_ORDER.indexOf(phase.resource) + 1 })).map((phase) => applyWorkspaceDeploymentPolicy(input.migrationInput, phase, input))
|
|
@@ -1555,7 +1557,7 @@ export async function runMigration(input) {
|
|
|
1555
1557
|
envName: environmentKey,
|
|
1556
1558
|
stableKeyName,
|
|
1557
1559
|
}), input.onProgress);
|
|
1558
|
-
const liveSchedulePhase = applyWorkspaceDeploymentPolicy(input, summarizeSchedulePhase(liveSchedulePlan), {
|
|
1560
|
+
const liveSchedulePhase = applyWorkspaceDeploymentPolicy(input, summarizeSchedulePhase(liveSchedulePlan, input.sourceMode !== 'workspace' || input.activateAutomations === true), {
|
|
1559
1561
|
schedules: liveSchedulePlan,
|
|
1560
1562
|
});
|
|
1561
1563
|
if (!liveSchedulePhase.readyToMigrate) {
|
|
@@ -1592,7 +1594,7 @@ export async function runMigration(input) {
|
|
|
1592
1594
|
envName: environmentKey,
|
|
1593
1595
|
stableKeyName,
|
|
1594
1596
|
}), input.onProgress);
|
|
1595
|
-
const liveEventPhase = summarizeEventPhase(liveEventPlan);
|
|
1597
|
+
const liveEventPhase = summarizeEventPhase(liveEventPlan, input.sourceMode !== 'workspace' || input.activateAutomations === true);
|
|
1596
1598
|
if (!liveEventPhase.readyToMigrate) {
|
|
1597
1599
|
const verification = await planWorkspace({
|
|
1598
1600
|
...input,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AutomationRuntimeInputFields } from '../types.ts';
|
|
2
|
+
export declare const AUTOMATION_INPUT_FIELDS: Set<string>;
|
|
3
|
+
/** Old Event pulls placed these known REST fields under extensions. */
|
|
4
|
+
export declare function readAutomationInput(value: Record<string, unknown>, legacyExtensions?: boolean): Required<AutomationRuntimeInputFields>;
|
|
5
|
+
export declare function automationInputError(value: Record<string, unknown>, legacyExtensions?: boolean): string | undefined;
|
|
6
|
+
/** Preserve pre-input hashes for the original empty-input / override behavior. */
|
|
7
|
+
export declare function automationInputHashFields(value: Record<string, unknown>, legacyExtensions?: boolean): AutomationRuntimeInputFields;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isRecord } from "./util.js";
|
|
2
|
+
export const AUTOMATION_INPUT_FIELDS = new Set(['input', 'inputMode']);
|
|
3
|
+
const INPUT_MODES = ['override', 'deep_override', 'replace'];
|
|
4
|
+
/** Old Event pulls placed these known REST fields under extensions. */
|
|
5
|
+
export function readAutomationInput(value, legacyExtensions = false) {
|
|
6
|
+
const extensions = legacyExtensions && isRecord(value.extensions) ? value.extensions : {};
|
|
7
|
+
for (const field of AUTOMATION_INPUT_FIELDS) {
|
|
8
|
+
if (value[field] !== undefined && extensions[field] !== undefined) {
|
|
9
|
+
throw new Error(`Automation "${field}" is defined both at the top level and in extensions.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const input = value.input === undefined ? extensions.input : value.input;
|
|
13
|
+
const inputMode = value.inputMode === undefined ? extensions.inputMode : value.inputMode;
|
|
14
|
+
if (input !== undefined && (!isRecord(input) || ![Object.prototype, null].includes(Object.getPrototypeOf(input)))) {
|
|
15
|
+
throw new Error('Automation "input" must be a JSON object.');
|
|
16
|
+
}
|
|
17
|
+
if (inputMode !== undefined && !INPUT_MODES.includes(inputMode)) {
|
|
18
|
+
throw new Error('Automation "inputMode" must be override, deep_override or replace.');
|
|
19
|
+
}
|
|
20
|
+
return { input: input === undefined ? {} : input, inputMode: (inputMode ?? 'override') };
|
|
21
|
+
}
|
|
22
|
+
export function automationInputError(value, legacyExtensions = false) {
|
|
23
|
+
try {
|
|
24
|
+
readAutomationInput(value, legacyExtensions);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return error.message;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Preserve pre-input hashes for the original empty-input / override behavior. */
|
|
32
|
+
export function automationInputHashFields(value, legacyExtensions = false) {
|
|
33
|
+
const { input, inputMode } = readAutomationInput(value, legacyExtensions);
|
|
34
|
+
return {
|
|
35
|
+
...(Object.keys(input).length === 0 ? {} : { input }),
|
|
36
|
+
...(inputMode === 'override' ? {} : { inputMode }),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type FieldChange } from '../diff-details.ts';
|
|
2
2
|
import type { RevoClient } from '../client.ts';
|
|
3
|
+
import type { AutomationRuntimeInputFields } from '../types.ts';
|
|
3
4
|
export declare const EVENTS_DIRECTORY = "Events";
|
|
4
5
|
export declare const EVENT_MANIFEST_FILE = "event.json";
|
|
5
|
-
export type EventManifest = {
|
|
6
|
+
export type EventManifest = AutomationRuntimeInputFields & {
|
|
6
7
|
kind: 'event';
|
|
7
8
|
stableKey: string;
|
|
8
9
|
name: string;
|
|
@@ -3,13 +3,14 @@ import { describeFieldChanges } from "../diff-details.js";
|
|
|
3
3
|
import { hashStable, readComponentLock, writeComponentLock } from "../component-lock.js";
|
|
4
4
|
import { NULL_CATEGORY_KEY, normalizeStableKeyValue, readConfiguredResourceMetadataStableKey, sanitizeUserMetadata } from "../resource-metadata.js";
|
|
5
5
|
import { readJsonFile, sanitizeSegment } from "../utils.js";
|
|
6
|
+
import { AUTOMATION_INPUT_FIELDS, automationInputError, automationInputHashFields, readAutomationInput } from "./automation-input.js";
|
|
6
7
|
import { findManifestFiles, isRecord, localTargetPath, mapWithConcurrency, removeRelocatedManifest, requireProjectLayout, stableKeySuffix, toPortableRelativePath, unwrapData, writePulledManifest, } from "./util.js";
|
|
7
8
|
export const EVENTS_DIRECTORY = 'Events';
|
|
8
9
|
export const EVENT_MANIFEST_FILE = 'event.json';
|
|
9
10
|
const EVENT_TRANSPORT_FIELDS = new Set([
|
|
10
11
|
'jobEventId', 'eventId', 'id', 'name', 'category', 'desc', 'description', 'active', 'type',
|
|
11
12
|
'targetType', 'targetId', 'targetVersion', 'targetConfig', 'filter', 'version', 'metadata',
|
|
12
|
-
'metaData', 'resourceMetadata', 'topic', 'custom', 'deletedAt', 'deletedBy', 'createdAt', 'createdBy',
|
|
13
|
+
'metaData', 'resourceMetadata', 'topic', 'custom', 'input', 'inputMode', 'deletedAt', 'deletedBy', 'createdAt', 'createdBy',
|
|
13
14
|
'lastUpdateAt', 'lastUpdateBy', 'updatedAt', 'updatedBy', 'history', 'jobEventHistory',
|
|
14
15
|
]);
|
|
15
16
|
function eventIdOf(record) {
|
|
@@ -102,7 +103,10 @@ function validManifest(value, stableKeyName) {
|
|
|
102
103
|
if (value.extensions !== undefined && !isRecord(value.extensions)) {
|
|
103
104
|
return false;
|
|
104
105
|
}
|
|
105
|
-
if (value.extensions !== undefined && Object.keys(value.extensions).
|
|
106
|
+
if (value.extensions !== undefined && Object.keys(value.extensions).some((field) => !AUTOMATION_INPUT_FIELDS.has(field))) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (automationInputError(value, true)) {
|
|
106
110
|
return false;
|
|
107
111
|
}
|
|
108
112
|
return readConfiguredResourceMetadataStableKey(value, stableKeyName) === value.stableKey;
|
|
@@ -123,18 +127,42 @@ function manifestFromRecord(input) {
|
|
|
123
127
|
active: record.active === true,
|
|
124
128
|
custom: record.custom,
|
|
125
129
|
type: String(record.type || ''),
|
|
130
|
+
...readAutomationInput(record),
|
|
126
131
|
...(record.filter === undefined ? {} : { filter: canonicalValue(record.filter) }),
|
|
127
132
|
target: { type: 'JOB_TEMPLATE', jobTemplateStableKey },
|
|
128
133
|
...(Object.keys(extensions).length > 0 ? { extensions } : {}),
|
|
129
134
|
};
|
|
130
135
|
}
|
|
131
|
-
|
|
132
|
-
return
|
|
136
|
+
function eventHashShape(manifest, extensions) {
|
|
137
|
+
return {
|
|
133
138
|
kind: 'event', stableKey: manifest.stableKey, name: manifest.name, category: manifest.category ?? null,
|
|
134
139
|
description: manifest.description ?? '', metadata: canonicalValue(manifest.metadata), custom: manifest.custom, type: manifest.type,
|
|
135
|
-
filter: canonicalValue(manifest.filter ?? null), target: manifest.target, extensions: canonicalValue(
|
|
140
|
+
filter: canonicalValue(manifest.filter ?? null), target: manifest.target, extensions: canonicalValue(extensions),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function unsupportedEventExtensions(manifest) {
|
|
144
|
+
return Object.fromEntries(Object.entries(manifest.extensions || {}).filter(([field]) => !AUTOMATION_INPUT_FIELDS.has(field)));
|
|
145
|
+
}
|
|
146
|
+
export function hashEventContent(manifest) {
|
|
147
|
+
return hashStable({
|
|
148
|
+
...eventHashShape(manifest, unsupportedEventExtensions(manifest)),
|
|
149
|
+
...automationInputHashFields(manifest, true),
|
|
136
150
|
});
|
|
137
151
|
}
|
|
152
|
+
/** Recognize an old lock representation without discarding any live non-default input. */
|
|
153
|
+
function legacyEventBaselineHash(manifest, layout) {
|
|
154
|
+
const fields = Object.keys(layout.extensions || {}).filter(field => AUTOMATION_INPUT_FIELDS.has(field));
|
|
155
|
+
if (fields.length === 0)
|
|
156
|
+
return undefined;
|
|
157
|
+
const input = readAutomationInput(manifest, true);
|
|
158
|
+
if (Object.keys(automationInputHashFields(manifest, true)).some(field => !fields.includes(field)))
|
|
159
|
+
return undefined;
|
|
160
|
+
const extensions = {
|
|
161
|
+
...unsupportedEventExtensions(manifest),
|
|
162
|
+
...Object.fromEntries(fields.map(field => [field, input[field]])),
|
|
163
|
+
};
|
|
164
|
+
return hashStable({ content: hashStable(eventHashShape(manifest, extensions)), active: manifest.active });
|
|
165
|
+
}
|
|
138
166
|
export function hashPortableEvent(manifest) {
|
|
139
167
|
return hashStable({ content: hashEventContent(manifest), active: manifest.active });
|
|
140
168
|
}
|
|
@@ -191,6 +219,8 @@ function emptyPlanCounts() {
|
|
|
191
219
|
};
|
|
192
220
|
}
|
|
193
221
|
function diffEvents(desired, current) {
|
|
222
|
+
const desiredInput = readAutomationInput(desired, true);
|
|
223
|
+
const currentInput = readAutomationInput(current, true);
|
|
194
224
|
const fields = [
|
|
195
225
|
['name', desired.name, current.name],
|
|
196
226
|
['category', desired.category ?? null, current.category ?? null],
|
|
@@ -200,7 +230,9 @@ function diffEvents(desired, current) {
|
|
|
200
230
|
['type', desired.type, current.type],
|
|
201
231
|
['filter', desired.filter ?? null, current.filter ?? null],
|
|
202
232
|
['target.jobTemplateStableKey', desired.target.jobTemplateStableKey, current.target.jobTemplateStableKey],
|
|
203
|
-
['
|
|
233
|
+
['input', desiredInput.input, currentInput.input],
|
|
234
|
+
['inputMode', desiredInput.inputMode, currentInput.inputMode],
|
|
235
|
+
['extensions', unsupportedEventExtensions(desired), unsupportedEventExtensions(current)],
|
|
204
236
|
];
|
|
205
237
|
return fields
|
|
206
238
|
.filter(([, left, right]) => hashStable(left) !== hashStable(right))
|
|
@@ -257,13 +289,15 @@ export async function buildEventsPlan(input) {
|
|
|
257
289
|
const manifest = entry.manifest;
|
|
258
290
|
if (!validManifest(manifest, input.stableKeyName)) {
|
|
259
291
|
const unsupportedExtensions = isRecord(manifest) && isRecord(manifest.extensions)
|
|
260
|
-
? Object.keys(manifest.extensions).sort()
|
|
292
|
+
? Object.keys(manifest.extensions).filter((field) => !AUTOMATION_INPUT_FIELDS.has(field)).sort()
|
|
261
293
|
: [];
|
|
294
|
+
const inputError = isRecord(manifest) ? automationInputError(manifest, true) : undefined;
|
|
262
295
|
const reason = unsupportedExtensions.length > 0
|
|
263
296
|
? `unsupported extension fields: ${unsupportedExtensions.join(', ')}`
|
|
264
|
-
:
|
|
265
|
-
|
|
266
|
-
|
|
297
|
+
: inputError ? inputError
|
|
298
|
+
: isRecord(manifest) && manifest.custom === undefined
|
|
299
|
+
? 'missing custom classifier; re-pull the Event from its source or add custom: true/false explicitly'
|
|
300
|
+
: 'invalid manifest';
|
|
267
301
|
blockers.push(`Invalid Event manifest ${path.relative(projectRoot, entry.manifestPath)}: ${reason}.`);
|
|
268
302
|
items.push({ status: 'conflict', name: isRecord(manifest) && nonEmptyString(manifest.name) ? manifest.name : path.basename(entry.manifestPath), reason, blocked: true });
|
|
269
303
|
continue;
|
|
@@ -407,7 +441,7 @@ export async function buildEventsPlan(input) {
|
|
|
407
441
|
}
|
|
408
442
|
consumedTargets.add(stableKey);
|
|
409
443
|
const current = targets[0];
|
|
410
|
-
const fieldChanges = describeFieldChanges(desired, current.manifest, diffEvents(desired, current.manifest));
|
|
444
|
+
const fieldChanges = describeFieldChanges({ ...desired, ...readAutomationInput(desired, true) }, current.manifest, diffEvents(desired, current.manifest));
|
|
411
445
|
const currentHash = current.hash;
|
|
412
446
|
const baselineHash = lock.events[stableKey]?.environments[input.envName]?.remoteHash;
|
|
413
447
|
const currentContentHash = current.contentHash;
|
|
@@ -429,10 +463,10 @@ export async function buildEventsPlan(input) {
|
|
|
429
463
|
else if (!baselineHash) {
|
|
430
464
|
items.push({ status: 'missing-lock', ...common, fieldChanges, currentHash, changedFields: diffEvents(desired, current.manifest), reason: `missing ${input.envName} lock baseline` });
|
|
431
465
|
}
|
|
432
|
-
else if (currentHash === baselineHash) {
|
|
466
|
+
else if (currentHash === baselineHash || legacyEventBaselineHash(current.manifest, desired) === baselineHash) {
|
|
433
467
|
items.push({ status: 'safe-update', ...common, fieldChanges, currentHash, baselineHash, changedFields: diffEvents(desired, current.manifest), reason: 'local manifest changed; target matches lock baseline' });
|
|
434
468
|
}
|
|
435
|
-
else if (common.desiredHash === baselineHash) {
|
|
469
|
+
else if (common.desiredHash === baselineHash || legacyEventBaselineHash(desired, desired) === baselineHash) {
|
|
436
470
|
items.push({ status: 'remote-changed', ...common, fieldChanges, currentHash, baselineHash, changedFields: diffEvents(desired, current.manifest), reason: 'target changed; local manifest matches lock baseline' });
|
|
437
471
|
}
|
|
438
472
|
else {
|
|
@@ -475,9 +509,8 @@ export async function buildEventsPlan(input) {
|
|
|
475
509
|
};
|
|
476
510
|
}
|
|
477
511
|
function buildEventCreatePayload(manifest, targetId) {
|
|
478
|
-
const extensions = writableEventExtensions(manifest.extensions);
|
|
479
512
|
return {
|
|
480
|
-
...
|
|
513
|
+
...readAutomationInput(manifest, true),
|
|
481
514
|
name: manifest.name,
|
|
482
515
|
...(manifest.category === undefined || manifest.category === null ? {} : { category: manifest.category }),
|
|
483
516
|
active: false,
|
|
@@ -491,9 +524,8 @@ function buildEventCreatePayload(manifest, targetId) {
|
|
|
491
524
|
};
|
|
492
525
|
}
|
|
493
526
|
function buildEventUpdatePayload(manifest, targetId, version) {
|
|
494
|
-
const extensions = writableEventExtensions(manifest.extensions);
|
|
495
527
|
return {
|
|
496
|
-
...
|
|
528
|
+
...readAutomationInput(manifest, true),
|
|
497
529
|
name: manifest.name,
|
|
498
530
|
category: manifest.category ?? null,
|
|
499
531
|
desc: manifest.description ?? '',
|
|
@@ -506,10 +538,6 @@ function buildEventUpdatePayload(manifest, targetId, version) {
|
|
|
506
538
|
version,
|
|
507
539
|
};
|
|
508
540
|
}
|
|
509
|
-
function writableEventExtensions(extensions) {
|
|
510
|
-
return canonicalValue(Object.fromEntries(Object.entries(extensions || {})
|
|
511
|
-
.filter(([key]) => !EVENT_TRANSPORT_FIELDS.has(key))));
|
|
512
|
-
}
|
|
513
541
|
function workspaceEventsByStableKey(cwd, stableKeyName) {
|
|
514
542
|
const events = new Map();
|
|
515
543
|
for (const entry of readWorkspaceEvents(cwd)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FieldChange } from '../diff-details.ts';
|
|
2
2
|
import type { RevoClient } from '../client.ts';
|
|
3
|
+
import type { AutomationRuntimeInputFields } from '../types.ts';
|
|
3
4
|
export declare const SCHEDULES_DIRECTORY = "Schedules";
|
|
4
5
|
export declare const SCHEDULE_MANIFEST_FILE = "schedule.json";
|
|
5
6
|
export type JobTemplateScheduleTarget = {
|
|
@@ -12,7 +13,7 @@ export type MaterializedViewScheduleTarget = {
|
|
|
12
13
|
refreshMode: 'CONCURRENT' | 'BLOCKING';
|
|
13
14
|
};
|
|
14
15
|
export type ScheduleTarget = JobTemplateScheduleTarget | MaterializedViewScheduleTarget;
|
|
15
|
-
export type ScheduleManifest = {
|
|
16
|
+
export type ScheduleManifest = AutomationRuntimeInputFields & {
|
|
16
17
|
kind: 'schedule';
|
|
17
18
|
stableKey: string;
|
|
18
19
|
name: string;
|
|
@@ -3,6 +3,7 @@ import { describeFieldChanges } from "../diff-details.js";
|
|
|
3
3
|
import { hashStable, readComponentLock, writeComponentLock } from "../component-lock.js";
|
|
4
4
|
import { NULL_CATEGORY_KEY, normalizeStableKeyValue, readConfiguredResourceMetadataStableKey, sanitizeUserMetadata } from "../resource-metadata.js";
|
|
5
5
|
import { isValidNormalizedCron, normalizeCron, readJsonFile, sanitizeSegment } from "../utils.js";
|
|
6
|
+
import { automationInputError, automationInputHashFields, readAutomationInput } from "./automation-input.js";
|
|
6
7
|
import { findManifestFiles, isRecord, localTargetPath, mapWithConcurrency, removeRelocatedManifest, requireProjectLayout, stableKeySuffix, toPortableRelativePath, unwrapData, writePulledManifest, } from "./util.js";
|
|
7
8
|
export const SCHEDULES_DIRECTORY = 'Schedules';
|
|
8
9
|
export const SCHEDULE_MANIFEST_FILE = 'schedule.json';
|
|
@@ -97,7 +98,7 @@ function isValidNormalizedIanaTimezone(value) {
|
|
|
97
98
|
}
|
|
98
99
|
function validManifest(manifest, stableKeyName, { validateDiagnostics = true } = {}) {
|
|
99
100
|
if (!isRecord(manifest) || !hasOnlyKeys(manifest, new Set([
|
|
100
|
-
'kind', 'stableKey', 'name', 'category', 'description', 'metadata', 'cron', 'timezone', 'target', 'sourceTargetConfig', 'activationCandidate',
|
|
101
|
+
'kind', 'stableKey', 'name', 'category', 'description', 'metadata', 'cron', 'timezone', 'input', 'inputMode', 'target', 'sourceTargetConfig', 'activationCandidate',
|
|
101
102
|
]))) {
|
|
102
103
|
return false;
|
|
103
104
|
}
|
|
@@ -130,6 +131,9 @@ function validManifest(manifest, stableKeyName, { validateDiagnostics = true } =
|
|
|
130
131
|
if (!validJobTemplateTarget && !validMaterializedViewTarget) {
|
|
131
132
|
return false;
|
|
132
133
|
}
|
|
134
|
+
if (automationInputError(manifest)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
133
137
|
if (!validateDiagnostics) {
|
|
134
138
|
return readConfiguredResourceMetadataStableKey(manifest, stableKeyName) === manifest.stableKey;
|
|
135
139
|
}
|
|
@@ -152,6 +156,7 @@ function manifestFromRecord(input) {
|
|
|
152
156
|
metadata: canonicalMetadata(record, stableKeyName, stableKey),
|
|
153
157
|
cron: normalizeCron(String(record.cron || '')),
|
|
154
158
|
timezone: normalizeTimezone(String(record.timezone || '')),
|
|
159
|
+
...readAutomationInput(record),
|
|
155
160
|
target,
|
|
156
161
|
...(target.type === 'JOB_TEMPLATE' && record.targetConfig !== undefined
|
|
157
162
|
? { sourceTargetConfig: canonicalValue(record.targetConfig) }
|
|
@@ -171,6 +176,7 @@ export function hashPortableSchedule(manifest) {
|
|
|
171
176
|
cron: manifest.cron,
|
|
172
177
|
timezone: manifest.timezone,
|
|
173
178
|
target: canonicalValue(manifest.target),
|
|
179
|
+
...automationInputHashFields(manifest),
|
|
174
180
|
});
|
|
175
181
|
}
|
|
176
182
|
/** Local baseline shape. It deliberately includes editable/source-only pull data. */
|
|
@@ -303,6 +309,8 @@ function scheduleHint(value) {
|
|
|
303
309
|
return normalizeStableKeyValue(`${category}/${String(value.name || '')}`);
|
|
304
310
|
}
|
|
305
311
|
function diffSchedules(desired, target) {
|
|
312
|
+
const desiredInput = readAutomationInput(desired);
|
|
313
|
+
const targetInput = readAutomationInput(target);
|
|
306
314
|
const fields = [
|
|
307
315
|
['name', desired.name, target.name],
|
|
308
316
|
['category', desired.category ?? null, target.category ?? null],
|
|
@@ -310,6 +318,8 @@ function diffSchedules(desired, target) {
|
|
|
310
318
|
['metadata', canonicalValue(desired.metadata), canonicalValue(target.metadata)],
|
|
311
319
|
['cron', desired.cron, target.cron],
|
|
312
320
|
['timezone', desired.timezone, target.timezone],
|
|
321
|
+
['input', desiredInput.input, targetInput.input],
|
|
322
|
+
['inputMode', desiredInput.inputMode, targetInput.inputMode],
|
|
313
323
|
['target', canonicalValue(desired.target), canonicalValue(target.target)],
|
|
314
324
|
];
|
|
315
325
|
return fields
|
|
@@ -404,13 +414,14 @@ export async function buildSchedulesPlan(input) {
|
|
|
404
414
|
for (const entry of localEntries) {
|
|
405
415
|
const rawManifest = entry.manifest;
|
|
406
416
|
if (!validManifest(rawManifest, input.stableKeyName, { validateDiagnostics: false })) {
|
|
407
|
-
|
|
417
|
+
const reason = isRecord(rawManifest) ? automationInputError(rawManifest) : undefined;
|
|
418
|
+
blockers.push(`Invalid Schedule manifest ${path.relative(projectRoot, entry.manifestPath)}${reason ? `: ${reason}` : ''}.`);
|
|
408
419
|
items.push({
|
|
409
420
|
status: 'conflict',
|
|
410
421
|
name: isRecord(rawManifest) && isNonEmptyString(rawManifest.name)
|
|
411
422
|
? rawManifest.name
|
|
412
423
|
: path.basename(path.dirname(entry.manifestPath)),
|
|
413
|
-
reason: 'invalid Schedule manifest',
|
|
424
|
+
reason: reason || 'invalid Schedule manifest',
|
|
414
425
|
blocked: true,
|
|
415
426
|
});
|
|
416
427
|
continue;
|
|
@@ -713,7 +724,7 @@ export async function buildSchedulesPlan(input) {
|
|
|
713
724
|
const desiredActive = desired.activationCandidate;
|
|
714
725
|
const currentActive = target.record.active === true;
|
|
715
726
|
const activationDiffers = typeof desiredActive === 'boolean' && desiredActive !== currentActive;
|
|
716
|
-
const fieldChanges = describeFieldChanges(desired, target.manifest, changedFields);
|
|
727
|
+
const fieldChanges = describeFieldChanges({ ...desired, ...readAutomationInput(desired) }, target.manifest, changedFields);
|
|
717
728
|
if (activationDiffers) {
|
|
718
729
|
changedFields.push('active');
|
|
719
730
|
fieldChanges.push(...describeFieldChanges({ active: desiredActive }, { active: currentActive }, ['active']));
|
|
@@ -1007,6 +1018,7 @@ function buildScheduleCreatePayload(manifest, targetId) {
|
|
|
1007
1018
|
targetConfig: { kind: 'refresh_materialized_view', refreshMode: manifest.target.refreshMode },
|
|
1008
1019
|
};
|
|
1009
1020
|
return {
|
|
1021
|
+
...readAutomationInput(manifest),
|
|
1010
1022
|
name: manifest.name,
|
|
1011
1023
|
...(manifest.category === undefined || manifest.category === null ? {} : { category: manifest.category }),
|
|
1012
1024
|
active: false,
|
|
@@ -1026,6 +1038,7 @@ function buildScheduleUpdatePayload(manifest, targetId, version) {
|
|
|
1026
1038
|
targetConfig: { kind: 'refresh_materialized_view', refreshMode: manifest.target.refreshMode },
|
|
1027
1039
|
};
|
|
1028
1040
|
return {
|
|
1041
|
+
...readAutomationInput(manifest),
|
|
1029
1042
|
name: manifest.name,
|
|
1030
1043
|
category: manifest.category ?? null,
|
|
1031
1044
|
desc: manifest.description ?? '',
|
package/dist/src/types.d.ts
CHANGED
|
@@ -279,7 +279,12 @@ export type JobTemplateRecord = {
|
|
|
279
279
|
deletedAt?: string | null;
|
|
280
280
|
[key: string]: unknown;
|
|
281
281
|
};
|
|
282
|
-
export type
|
|
282
|
+
export type AutomationInputMode = 'override' | 'deep_override' | 'replace';
|
|
283
|
+
export type AutomationRuntimeInputFields = {
|
|
284
|
+
input?: Record<string, unknown>;
|
|
285
|
+
inputMode?: AutomationInputMode;
|
|
286
|
+
};
|
|
287
|
+
export type ScheduleRecord = AutomationRuntimeInputFields & {
|
|
283
288
|
scheduleId?: string;
|
|
284
289
|
id?: string;
|
|
285
290
|
name?: string;
|
|
@@ -302,7 +307,7 @@ export type ScheduleRecord = {
|
|
|
302
307
|
deletedBy?: string | null;
|
|
303
308
|
[key: string]: unknown;
|
|
304
309
|
};
|
|
305
|
-
export type EventRecord = {
|
|
310
|
+
export type EventRecord = AutomationRuntimeInputFields & {
|
|
306
311
|
jobEventId?: string;
|
|
307
312
|
eventId?: string;
|
|
308
313
|
id?: string;
|
package/dist/src/ui.js
CHANGED
|
@@ -179,9 +179,9 @@ function renderCommandCatalog() {
|
|
|
179
179
|
commandRow('revo metadata apply [--project <name>] --yes [--skip-partitions]', 'Populate missing stable-key metadata'),
|
|
180
180
|
commandRow('revo pull --all|--resources <list> --yes [--skip-groups] [--force] [--json]', 'Build the repository workspace from the configured runtime source'),
|
|
181
181
|
commandRow('revo diff [--json]', 'Show only workspace-to-target resource differences without writes'),
|
|
182
|
-
commandRow('revo plan [--activate] [--prune] [--out file] [--force] [--strict] [--json] [--hints]', 'Plan tracked
|
|
182
|
+
commandRow('revo plan [--activate] [--prune] [--out file] [--force] [--strict] [--json] [--hints]', 'Plan tracked definitions; preserve automation activation unless --activate'),
|
|
183
183
|
commandRow('revo plan update [--json]', 'Update the local Stable Key source digest index without contacting the target'),
|
|
184
|
-
commandRow('revo deploy [--yes] [--activate] [--prune] [--reviewed-plan file] [--force] [--json]', '
|
|
184
|
+
commandRow('revo deploy [--yes] [--activate] [--prune] [--reviewed-plan file] [--force] [--json]', 'Deploy tracked definitions; preserve automation activation unless --activate'),
|
|
185
185
|
commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview twelve resource families and identity dependencies'),
|
|
186
186
|
commandRow('revo migrate run --from <env> --to <env> [--resources <list>] [--skip-groups] --yes [--force] [--json]', 'Pull, plan, migrate, and verify resources in dependency order'),
|
|
187
187
|
commandRow('revo migrate verify --from <env> --to <env> [--resources <list>] [--json]', 'Verify target resources against a fresh temporary source pull'),
|