@revoengine/cli 1.0.21 → 1.0.22
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 +15 -2
- package/dist/src/client.d.ts +23 -7
- package/dist/src/client.js +14 -0
- package/dist/src/commands/component.js +17 -0
- package/dist/src/commands/env.js +8 -5
- package/dist/src/commands/migrate.js +5 -1
- package/dist/src/commands/schedules.js +11 -9
- package/dist/src/component-contract.d.ts +8 -0
- package/dist/src/component-contract.js +68 -0
- package/dist/src/component-lock.d.ts +4 -2
- package/dist/src/component-lock.js +4 -2
- package/dist/src/database-indexes.d.ts +14 -0
- package/dist/src/database-indexes.js +124 -0
- package/dist/src/env-sync.d.ts +2 -0
- package/dist/src/env-sync.js +18 -2
- package/dist/src/migration-actions.js +1 -1
- package/dist/src/migration.js +3 -3
- package/dist/src/resource-syncs/agent-sync.js +28 -2
- package/dist/src/resource-syncs/database-table-sync.d.ts +3 -0
- package/dist/src/resource-syncs/database-table-sync.js +10 -6
- package/dist/src/resource-syncs/database-view-sync.d.ts +2 -4
- package/dist/src/resource-syncs/database-view-sync.js +16 -38
- package/dist/src/resource-syncs/endpoint-sync.js +53 -26
- package/dist/src/resource-syncs/job-template-sync.d.ts +1 -0
- package/dist/src/resource-syncs/job-template-sync.js +31 -10
- package/dist/src/resource-syncs/schedule-sync.d.ts +7 -3
- package/dist/src/resource-syncs/schedule-sync.js +85 -16
- package/dist/src/types.d.ts +2 -0
- package/dist/src/ui.js +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { componentRevisionByDigest, isComponentDigest } from "../component-contract.js";
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { accountPrincipal, resolveExecutionPrincipal, executionPrincipalAvailable, portableExecutionPolicy, runtimeExecutionPolicyPayload, validExecutionPrincipal, validPortableExecutionPolicy } from "./account-principal.js";
|
|
3
4
|
import { describeFieldChanges } from "../diff-details.js";
|
|
@@ -7,7 +8,7 @@ import { readJsonFile, sanitizeSegment } from "../utils.js";
|
|
|
7
8
|
import { findManifestFiles, isRecord, localTargetPath, mapWithConcurrency, removeRelocatedManifest, requireProjectLayout, stableKeySuffix, toPortableRelativePath, unwrapData, writePulledManifest, } from "./util.js";
|
|
8
9
|
export const JOB_TEMPLATES_DIRECTORY = 'JobTemplates';
|
|
9
10
|
export const JOB_TEMPLATE_MANIFEST_FILE = 'job-template.json';
|
|
10
|
-
const DEFAULT_JOB_TEMPLATE_MEMORY_MB =
|
|
11
|
+
const DEFAULT_JOB_TEMPLATE_MEMORY_MB = 256;
|
|
11
12
|
function canonicalValue(value) {
|
|
12
13
|
if (Array.isArray(value))
|
|
13
14
|
return value.map((item) => canonicalValue(item));
|
|
@@ -37,7 +38,7 @@ function canonicalJobTemplateOptions(value, inputs) {
|
|
|
37
38
|
const inputIsEmpty = isRecord(normalized.input) && Object.keys(normalized.input).length === 0;
|
|
38
39
|
const inputDuplicatesLegacyInputs = inputs !== undefined
|
|
39
40
|
&& JSON.stringify(normalized.input) === JSON.stringify(canonicalInputs);
|
|
40
|
-
if (inputIsEmpty || inputDuplicatesLegacyInputs)
|
|
41
|
+
if ((inputIsEmpty && (canonicalInputs === undefined || (isRecord(canonicalInputs) && Object.keys(canonicalInputs).length === 0))) || inputDuplicatesLegacyInputs)
|
|
41
42
|
delete normalized.input;
|
|
42
43
|
return Object.keys(normalized).length === 0 ? undefined : normalized;
|
|
43
44
|
}
|
|
@@ -116,8 +117,9 @@ function isOptionalFiniteNumber(value) {
|
|
|
116
117
|
}
|
|
117
118
|
function hasValidJobTemplateComponent(value) {
|
|
118
119
|
return isRecord(value)
|
|
119
|
-
&& hasOnlyKeys(value, new Set(['stableKey']))
|
|
120
|
-
&& isNonEmptyString(value.stableKey)
|
|
120
|
+
&& hasOnlyKeys(value, new Set(['stableKey', 'pinnedDigest']))
|
|
121
|
+
&& isNonEmptyString(value.stableKey)
|
|
122
|
+
&& (value.pinnedDigest === undefined || isComponentDigest(value.pinnedDigest));
|
|
121
123
|
}
|
|
122
124
|
function hasValidJobTemplateMigration(value) {
|
|
123
125
|
return value === undefined || (isRecord(value)
|
|
@@ -182,7 +184,7 @@ function manifestFromRecord(record, stableKey, componentKey, stableKeyName) {
|
|
|
182
184
|
...(record.category === undefined ? {} : { category: record.category }),
|
|
183
185
|
...(typeof record.desc === 'string' ? { description: record.desc } : typeof record.description === 'string' ? { description: record.description } : {}),
|
|
184
186
|
metadata: canonicalMetadata(record, stableKeyName, stableKey),
|
|
185
|
-
component: { stableKey: componentKey },
|
|
187
|
+
component: { stableKey: componentKey, ...(record.componentDigest ? { pinnedDigest: String(record.componentDigest) } : {}) },
|
|
186
188
|
...(typeof record.timeout === 'number' ? { timeout: record.timeout } : {}),
|
|
187
189
|
...(record.options === undefined ? {} : { options: canonicalValue(record.options) }),
|
|
188
190
|
...(record.inputs === undefined ? {} : { inputs: canonicalValue(record.inputs) }),
|
|
@@ -218,6 +220,7 @@ function buildCreatePayload(manifest, componentId) {
|
|
|
218
220
|
...(manifest.description === undefined ? {} : { desc: manifest.description }),
|
|
219
221
|
metadata: canonicalValue(manifest.metadata),
|
|
220
222
|
componentId,
|
|
223
|
+
...(manifest.component.pinnedDigest ? { componentDigest: manifest.component.pinnedDigest } : {}),
|
|
221
224
|
...(manifest.timeout === undefined ? {} : { timeout: manifest.timeout }),
|
|
222
225
|
...(manifest.options === undefined ? {} : { options: canonicalValue(manifest.options) }),
|
|
223
226
|
...(manifest.inputs === undefined ? {} : { inputs: canonicalValue(manifest.inputs) }),
|
|
@@ -230,6 +233,8 @@ function buildUpdatePayload(manifest, componentId, version) {
|
|
|
230
233
|
desc: manifest.description ?? '',
|
|
231
234
|
metadata: canonicalValue(manifest.metadata),
|
|
232
235
|
componentId,
|
|
236
|
+
componentDigest: manifest.component.pinnedDigest ?? null,
|
|
237
|
+
componentVersion: null,
|
|
233
238
|
...(manifest.timeout === undefined ? {} : { timeout: manifest.timeout }),
|
|
234
239
|
...(manifest.options === undefined ? {} : { options: canonicalValue(manifest.options) }),
|
|
235
240
|
...(manifest.inputs === undefined ? {} : { inputs: canonicalValue(manifest.inputs) }),
|
|
@@ -245,7 +250,7 @@ export function hashPortableJobTemplate(manifest) {
|
|
|
245
250
|
category: manifest.category ?? null,
|
|
246
251
|
description: manifest.description ?? '',
|
|
247
252
|
metadata: canonicalValue(manifest.metadata),
|
|
248
|
-
component: {
|
|
253
|
+
component: { ...manifest.component },
|
|
249
254
|
...(manifest.executionPrincipal ? { executionPrincipal: manifest.executionPrincipal } : {}),
|
|
250
255
|
...(manifest.executionPolicy ? { executionPolicy: manifest.executionPolicy } : {}),
|
|
251
256
|
...(manifest.timeout === undefined ? {} : { timeout: manifest.timeout }),
|
|
@@ -260,6 +265,7 @@ function diffJobTemplates(desired, target) {
|
|
|
260
265
|
['description', desired.description ?? '', target.description ?? ''],
|
|
261
266
|
['metadata', canonicalValue(desired.metadata), canonicalValue(target.metadata)],
|
|
262
267
|
['component.stableKey', desired.component.stableKey, target.component.stableKey],
|
|
268
|
+
['component.pinnedDigest', desired.component.pinnedDigest, target.component.pinnedDigest],
|
|
263
269
|
...(desired.executionPrincipal ? [['executionPrincipal', desired.executionPrincipal, target.executionPrincipal]] : []),
|
|
264
270
|
...(desired.executionPolicy ? [['executionPolicy', desired.executionPolicy, target.executionPolicy]] : []),
|
|
265
271
|
['timeout', desired.timeout, target.timeout],
|
|
@@ -372,7 +378,7 @@ export async function buildJobTemplatesPlan(input) {
|
|
|
372
378
|
continue;
|
|
373
379
|
}
|
|
374
380
|
targetRecordsByKey.set(stableKey, [...(targetRecordsByKey.get(stableKey) || []), { record, stableKey }]);
|
|
375
|
-
if (typeof record.componentVersion === 'number') {
|
|
381
|
+
if ((typeof record.componentVersion === 'number' && !record.componentDigest)) {
|
|
376
382
|
blockers.push(`Target job template "${stableKey}" uses a pinned component version, which is unsupported.`);
|
|
377
383
|
}
|
|
378
384
|
}
|
|
@@ -411,7 +417,7 @@ export async function buildJobTemplatesPlan(input) {
|
|
|
411
417
|
record,
|
|
412
418
|
manifest,
|
|
413
419
|
hash: hashPortableJobTemplate(manifest),
|
|
414
|
-
pinned: typeof record.componentVersion === 'number',
|
|
420
|
+
pinned: (typeof record.componentVersion === 'number' && !record.componentDigest),
|
|
415
421
|
}]);
|
|
416
422
|
}
|
|
417
423
|
const consumedTargetKeys = new Set();
|
|
@@ -475,6 +481,17 @@ export async function buildJobTemplatesPlan(input) {
|
|
|
475
481
|
items.push({ status: 'conflict', stableKey: desired.stableKey, name: desired.name, reason: 'execution principal is unavailable or ambiguous' });
|
|
476
482
|
continue;
|
|
477
483
|
}
|
|
484
|
+
if (desired.component.pinnedDigest && dependencyReadiness === 'ready') {
|
|
485
|
+
try {
|
|
486
|
+
await componentRevisionByDigest(input.client, componentIdOf(liveDependencyMatches[0] || {}), desired.component.pinnedDigest);
|
|
487
|
+
}
|
|
488
|
+
catch (error) {
|
|
489
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
490
|
+
blockers.push(`Job template "${desired.stableKey}": ${reason}`);
|
|
491
|
+
items.push({ status: 'conflict', stableKey: desired.stableKey, name: desired.name, reason, ...dependencyDetails });
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
478
495
|
const desiredHash = hashPortableJobTemplate(desired);
|
|
479
496
|
const matches = targetByKey.get(stableKeyIdentity) || [];
|
|
480
497
|
if (matches.length === 0) {
|
|
@@ -551,7 +568,7 @@ export async function buildJobTemplatesPlan(input) {
|
|
|
551
568
|
blockers: [...new Set(blockers)].sort((left, right) => left.localeCompare(right)),
|
|
552
569
|
warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
|
|
553
570
|
items,
|
|
554
|
-
exclusions: ['UUID, version, componentVersion and triggerUser are never persisted', 'target-only orphans are informational and never deleted'],
|
|
571
|
+
exclusions: ['UUID, version, componentVersion/componentDigest and triggerUser are never persisted', 'target-only orphans are informational and never deleted'],
|
|
555
572
|
};
|
|
556
573
|
}
|
|
557
574
|
export async function pullJobTemplatesToWorkspace(input) {
|
|
@@ -583,7 +600,7 @@ export async function pullJobTemplatesToWorkspace(input) {
|
|
|
583
600
|
continue;
|
|
584
601
|
}
|
|
585
602
|
const migration = {
|
|
586
|
-
...(typeof record.componentVersion === 'number' ? { componentBinding: 'pinned-unsupported' } : {}),
|
|
603
|
+
...((typeof record.componentVersion === 'number' && !record.componentDigest) ? { componentBinding: 'pinned-unsupported' } : {}),
|
|
587
604
|
...(record.triggerUser && (!record.executionPolicy || record.executionPolicy.mode === 'INHERIT') && !await accountPrincipal(input.client, record.triggerUser, input.stableKeyName) ? { executionPrincipal: 'excluded' } : {}),
|
|
588
605
|
};
|
|
589
606
|
manifests.push({
|
|
@@ -770,6 +787,8 @@ export async function pushJobTemplates(input) {
|
|
|
770
787
|
const stableKey = prepared.manifest.stableKey;
|
|
771
788
|
const targetPath = localTargetPath(input.cwd, prepared.manifestPath);
|
|
772
789
|
try {
|
|
790
|
+
if (prepared.manifest.component.pinnedDigest)
|
|
791
|
+
await componentRevisionByDigest(input.client, prepared.componentId, prepared.manifest.component.pinnedDigest);
|
|
773
792
|
const created = unwrapData(await input.client.createJobTemplate({ ...buildCreatePayload(prepared.manifest, prepared.componentId), ...await targetPrincipalId(input.client, prepared.manifest, input.stableKeyName) }));
|
|
774
793
|
const createdId = jobTemplateIdOf(created);
|
|
775
794
|
if (!createdId)
|
|
@@ -882,6 +901,8 @@ export async function pushJobTemplates(input) {
|
|
|
882
901
|
const componentId = componentIdOf(componentMatches[0]);
|
|
883
902
|
if (!componentId)
|
|
884
903
|
throw new Error(`dependency "${local.manifest.component.stableKey}" has no target component id`);
|
|
904
|
+
if (local.manifest.component.pinnedDigest)
|
|
905
|
+
await componentRevisionByDigest(input.client, componentId, local.manifest.component.pinnedDigest);
|
|
885
906
|
await input.client.updateJobTemplate(targetId, { ...buildUpdatePayload(local.manifest, componentId, target.version), ...await targetPrincipalId(input.client, local.manifest, input.stableKeyName, target) });
|
|
886
907
|
const verified = unwrapData(await input.client.getJobTemplate(targetId));
|
|
887
908
|
const verifiedStableKey = readConfiguredResourceMetadataStableKey(verified, input.stableKeyName);
|
|
@@ -24,7 +24,7 @@ export type ScheduleManifest = {
|
|
|
24
24
|
target: ScheduleTarget;
|
|
25
25
|
/** Retained for operator context only. It is never used in a target write. */
|
|
26
26
|
sourceTargetConfig?: Record<string, unknown> | null;
|
|
27
|
-
/**
|
|
27
|
+
/** Desired active state, applied by the explicit activation phase. */
|
|
28
28
|
activationCandidate: boolean;
|
|
29
29
|
};
|
|
30
30
|
export type SchedulePullWarning = {
|
|
@@ -60,7 +60,7 @@ export type ScheduleDependencyEdge = {
|
|
|
60
60
|
actualHash: string | null;
|
|
61
61
|
readiness: ScheduleDependencyReadiness;
|
|
62
62
|
};
|
|
63
|
-
export type SchedulePlanStatus = 'clean' | 'create' | 'safe-update' | 'remote-changed' | 'conflict' | 'missing-lock' | 'orphan' | 'collision' | 'skipped';
|
|
63
|
+
export type SchedulePlanStatus = 'clean' | 'create' | 'safe-update' | 'remote-changed' | 'conflict' | 'missing-lock' | 'activation-drift' | 'orphan' | 'collision' | 'skipped';
|
|
64
64
|
export type SchedulePlanItem = {
|
|
65
65
|
fieldChanges?: FieldChange[];
|
|
66
66
|
status: SchedulePlanStatus;
|
|
@@ -76,6 +76,8 @@ export type SchedulePlanItem = {
|
|
|
76
76
|
databaseViewStableKey?: string;
|
|
77
77
|
dependency?: ScheduleDependencyEdge;
|
|
78
78
|
blocked?: boolean;
|
|
79
|
+
desiredActive?: boolean;
|
|
80
|
+
currentActive?: boolean;
|
|
79
81
|
};
|
|
80
82
|
export type SchedulesPlan = {
|
|
81
83
|
resourceType: 'schedule';
|
|
@@ -88,7 +90,7 @@ export type SchedulesPlan = {
|
|
|
88
90
|
};
|
|
89
91
|
export type SchedulePushResult = {
|
|
90
92
|
stableKey: string;
|
|
91
|
-
action: 'create' | 'update' | 'noop' | 'orphan' | 'skipped' | 'activate';
|
|
93
|
+
action: 'create' | 'update' | 'noop' | 'orphan' | 'skipped' | 'activate' | 'disable';
|
|
92
94
|
status: 'deployed' | 'skipped' | 'failed';
|
|
93
95
|
targetPath: string;
|
|
94
96
|
reason?: string;
|
|
@@ -101,6 +103,8 @@ export type VerifiedScheduleActivation = {
|
|
|
101
103
|
stableKeyName: string;
|
|
102
104
|
targetId: string;
|
|
103
105
|
target: ScheduleTarget;
|
|
106
|
+
desiredActive: boolean;
|
|
107
|
+
portableHash: string;
|
|
104
108
|
};
|
|
105
109
|
export declare function scheduleManifestPath(workspaceRoot: string, manifest: ScheduleManifest): string;
|
|
106
110
|
/** Desired target shape. Source-only configuration and activation are excluded. */
|
|
@@ -359,6 +359,7 @@ function emptyPlanCounts() {
|
|
|
359
359
|
'remote-changed': 0,
|
|
360
360
|
conflict: 0,
|
|
361
361
|
'missing-lock': 0,
|
|
362
|
+
'activation-drift': 0,
|
|
362
363
|
orphan: 0,
|
|
363
364
|
collision: 0,
|
|
364
365
|
skipped: 0,
|
|
@@ -375,6 +376,9 @@ export async function buildSchedulesPlan(input) {
|
|
|
375
376
|
const blockers = [];
|
|
376
377
|
const warnings = [];
|
|
377
378
|
const exclusions = [];
|
|
379
|
+
for (const record of targetRecords)
|
|
380
|
+
if (record.targetVersion != null)
|
|
381
|
+
warnings.push(`Schedule "${String(record.name || '')}" has deprecated targetVersion=${String(record.targetVersion)}; this field does not select a Job Template revision at runtime.`);
|
|
378
382
|
const items = [];
|
|
379
383
|
const lockEntriesByPath = new Map(Object.values(lock.schedules).map((entry) => [entry.path, entry]));
|
|
380
384
|
const identityConflictedTargetKeys = new Set();
|
|
@@ -706,17 +710,30 @@ export async function buildSchedulesPlan(input) {
|
|
|
706
710
|
continue;
|
|
707
711
|
}
|
|
708
712
|
const changedFields = diffSchedules(desired, target.manifest);
|
|
713
|
+
const desiredActive = desired.activationCandidate;
|
|
714
|
+
const currentActive = target.record.active === true;
|
|
715
|
+
const activationDiffers = typeof desiredActive === 'boolean' && desiredActive !== currentActive;
|
|
716
|
+
const fieldChanges = describeFieldChanges(desired, target.manifest, changedFields);
|
|
717
|
+
if (activationDiffers) {
|
|
718
|
+
changedFields.push('active');
|
|
719
|
+
fieldChanges.push(...describeFieldChanges({ active: desiredActive }, { active: currentActive }, ['active']));
|
|
720
|
+
warnings.push(`Schedule "${desired.stableKey}" has activation drift: desired active=${desiredActive}; target active=${currentActive}. Align with schedules push --all --yes --activate.`);
|
|
721
|
+
}
|
|
709
722
|
const common = {
|
|
710
723
|
stableKey: desired.stableKey,
|
|
711
724
|
name: desired.name,
|
|
712
725
|
desiredHash,
|
|
713
726
|
currentHash: target.hash,
|
|
727
|
+
...(typeof desiredActive === 'boolean' ? { desiredActive, currentActive } : {}),
|
|
714
728
|
...dependencyDetails,
|
|
715
729
|
...planTargetDetails(desired.target),
|
|
716
|
-
...(changedFields.length > 0 ? { changedFields, fieldChanges
|
|
730
|
+
...(changedFields.length > 0 ? { changedFields, fieldChanges } : {}),
|
|
717
731
|
};
|
|
718
732
|
const baselineHash = lock.schedules[desired.stableKey]?.environments[input.envName]?.remoteHash;
|
|
719
|
-
if (
|
|
733
|
+
if (desiredHash === target.hash && activationDiffers) {
|
|
734
|
+
items.push({ status: 'activation-drift', ...common, reason: `desired active=${desiredActive}; target active=${currentActive}`, ...(baselineHash ? { baselineHash } : {}) });
|
|
735
|
+
}
|
|
736
|
+
else if (!baselineHash) {
|
|
720
737
|
items.push({ status: 'missing-lock', ...common, reason: `missing ${input.envName} lock baseline` });
|
|
721
738
|
}
|
|
722
739
|
else if (desiredHash === target.hash) {
|
|
@@ -777,10 +794,11 @@ export async function buildSchedulesPlan(input) {
|
|
|
777
794
|
'remote-changed': 2,
|
|
778
795
|
conflict: 3,
|
|
779
796
|
'missing-lock': 4,
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
797
|
+
'activation-drift': 5,
|
|
798
|
+
clean: 6,
|
|
799
|
+
orphan: 7,
|
|
800
|
+
collision: 8,
|
|
801
|
+
skipped: 9,
|
|
784
802
|
};
|
|
785
803
|
items.sort((left, right) => {
|
|
786
804
|
const leftKey = left.stableKey || left.name;
|
|
@@ -1158,6 +1176,7 @@ async function verifyScheduleWrite(input) {
|
|
|
1158
1176
|
if (hashPortableSchedule(verifiedManifest) !== input.desiredHash) {
|
|
1159
1177
|
throw new Error('written Schedule did not match desired portable hash');
|
|
1160
1178
|
}
|
|
1179
|
+
return schedule;
|
|
1161
1180
|
}
|
|
1162
1181
|
export async function pushSchedules(input) {
|
|
1163
1182
|
const plan = await buildSchedulesPlan(input);
|
|
@@ -1210,7 +1229,7 @@ export async function pushSchedules(input) {
|
|
|
1210
1229
|
await input.client.updateSchedule(live.scheduleId, buildScheduleUpdatePayload(local.manifest, live.targetId, live.schedule.version));
|
|
1211
1230
|
scheduleId = live.scheduleId;
|
|
1212
1231
|
}
|
|
1213
|
-
await verifyScheduleWrite({
|
|
1232
|
+
const verified = await verifyScheduleWrite({
|
|
1214
1233
|
client: input.client,
|
|
1215
1234
|
stableKeyName: input.stableKeyName,
|
|
1216
1235
|
manifest: local.manifest,
|
|
@@ -1226,7 +1245,7 @@ export async function pushSchedules(input) {
|
|
|
1226
1245
|
remoteHash: desiredHash,
|
|
1227
1246
|
});
|
|
1228
1247
|
results.push({ stableKey, action, status: 'deployed', targetPath });
|
|
1229
|
-
if (local.manifest.activationCandidate === true) {
|
|
1248
|
+
if (typeof local.manifest.activationCandidate === 'boolean' && (verified.active === true) !== local.manifest.activationCandidate) {
|
|
1230
1249
|
verifiedActivationCandidates.push({
|
|
1231
1250
|
stableKey,
|
|
1232
1251
|
scheduleId,
|
|
@@ -1234,6 +1253,8 @@ export async function pushSchedules(input) {
|
|
|
1234
1253
|
stableKeyName: input.stableKeyName,
|
|
1235
1254
|
targetId: live.targetId,
|
|
1236
1255
|
target: local.manifest.target,
|
|
1256
|
+
desiredActive: local.manifest.activationCandidate,
|
|
1257
|
+
portableHash: desiredHash,
|
|
1237
1258
|
});
|
|
1238
1259
|
}
|
|
1239
1260
|
}
|
|
@@ -1263,6 +1284,35 @@ export async function pushSchedules(input) {
|
|
|
1263
1284
|
reason: 'no local changes',
|
|
1264
1285
|
});
|
|
1265
1286
|
}
|
|
1287
|
+
for (const item of plan.items.filter((candidate) => candidate.status === 'activation-drift')) {
|
|
1288
|
+
const stableKey = item.stableKey || '';
|
|
1289
|
+
const local = localByKey.get(stableKey);
|
|
1290
|
+
const targetPath = local ? localTargetPath(input.cwd, local.manifestPath) : stableKey;
|
|
1291
|
+
try {
|
|
1292
|
+
if (!local || !item.desiredHash || hashPortableSchedule(local.manifest) !== item.desiredHash) {
|
|
1293
|
+
throw new Error('desired Schedule manifest changed after planning');
|
|
1294
|
+
}
|
|
1295
|
+
const live = await resolveLiveScheduleWriteTarget({ client: input.client, stableKeyName: input.stableKeyName,
|
|
1296
|
+
manifest: local.manifest, action: 'update' });
|
|
1297
|
+
if (!live.scheduleId || live.currentHash !== item.currentHash) {
|
|
1298
|
+
throw new Error('target Schedule changed after planning');
|
|
1299
|
+
}
|
|
1300
|
+
const verified = await verifyScheduleWrite({ client: input.client, stableKeyName: input.stableKeyName,
|
|
1301
|
+
manifest: local.manifest, scheduleId: live.scheduleId, targetId: live.targetId, desiredHash: item.desiredHash });
|
|
1302
|
+
updateScheduleEnvironmentBaseline({ cwd: input.cwd, envName: input.envName, manifest: local.manifest,
|
|
1303
|
+
manifestPath: local.manifestPath, remoteHash: item.desiredHash });
|
|
1304
|
+
if ((verified.active === true) !== local.manifest.activationCandidate) {
|
|
1305
|
+
verifiedActivationCandidates.push({ stableKey, scheduleId: live.scheduleId, targetPath,
|
|
1306
|
+
stableKeyName: input.stableKeyName, targetId: live.targetId, target: local.manifest.target,
|
|
1307
|
+
desiredActive: local.manifest.activationCandidate, portableHash: item.desiredHash });
|
|
1308
|
+
}
|
|
1309
|
+
results.push({ stableKey, action: 'noop', status: 'skipped', targetPath,
|
|
1310
|
+
reason: 'activation differs; re-run with --activate to align it with source' });
|
|
1311
|
+
}
|
|
1312
|
+
catch (error) {
|
|
1313
|
+
results.push({ stableKey, action: 'noop', status: 'failed', targetPath, error: schedulePushError(error) });
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1266
1316
|
for (const item of plan.items.filter((candidate) => (input.force === true
|
|
1267
1317
|
&& candidate.status === 'missing-lock'
|
|
1268
1318
|
&& candidate.desiredHash === candidate.currentHash))) {
|
|
@@ -1337,6 +1387,7 @@ export async function pushSchedules(input) {
|
|
|
1337
1387
|
export async function activateVerifiedSchedules(input) {
|
|
1338
1388
|
const results = [];
|
|
1339
1389
|
for (const candidate of input.candidates) {
|
|
1390
|
+
const action = candidate.desiredActive ? 'activate' : 'disable';
|
|
1340
1391
|
try {
|
|
1341
1392
|
const current = unwrapData(await input.client.getSchedule(candidate.scheduleId));
|
|
1342
1393
|
if (readConfiguredResourceMetadataStableKey(current, candidate.stableKeyName) !== candidate.stableKey) {
|
|
@@ -1346,6 +1397,11 @@ export async function activateVerifiedSchedules(input) {
|
|
|
1346
1397
|
if (current.targetType !== expectedTargetType || current.targetId !== candidate.targetId) {
|
|
1347
1398
|
throw new Error('target Schedule dependency changed after activation preflight');
|
|
1348
1399
|
}
|
|
1400
|
+
const currentManifest = manifestFromRecord({ record: current, stableKey: candidate.stableKey,
|
|
1401
|
+
target: candidate.target, stableKeyName: candidate.stableKeyName });
|
|
1402
|
+
if (schedulePlanExclusionReason(current) || hashPortableSchedule(currentManifest) !== candidate.portableHash) {
|
|
1403
|
+
throw new Error('target Schedule definition changed after activation preflight');
|
|
1404
|
+
}
|
|
1349
1405
|
if (candidate.target.type === 'MATERIALIZED_VIEW'
|
|
1350
1406
|
&& materializedRefreshMode(current) !== candidate.target.refreshMode) {
|
|
1351
1407
|
throw new Error('target Schedule materialized view refresh mode changed after activation preflight');
|
|
@@ -1360,24 +1416,37 @@ export async function activateVerifiedSchedules(input) {
|
|
|
1360
1416
|
!== targetDependencyStableKey(candidate.target)) {
|
|
1361
1417
|
throw new Error('target Schedule dependency stable key changed after activation preflight');
|
|
1362
1418
|
}
|
|
1363
|
-
if (current.active === true) {
|
|
1419
|
+
if ((current.active === true) === candidate.desiredActive) {
|
|
1364
1420
|
results.push({
|
|
1365
1421
|
stableKey: candidate.stableKey,
|
|
1366
|
-
action
|
|
1422
|
+
action,
|
|
1367
1423
|
status: 'skipped',
|
|
1368
1424
|
targetPath: candidate.targetPath,
|
|
1369
|
-
reason: 'already
|
|
1425
|
+
reason: 'already aligned',
|
|
1370
1426
|
});
|
|
1371
1427
|
continue;
|
|
1372
1428
|
}
|
|
1373
|
-
|
|
1429
|
+
if (candidate.desiredActive) {
|
|
1430
|
+
await input.client.activateSchedule(candidate.scheduleId);
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
await input.client.disableSchedule(candidate.scheduleId);
|
|
1434
|
+
}
|
|
1374
1435
|
const verified = unwrapData(await input.client.getSchedule(candidate.scheduleId));
|
|
1375
|
-
if (verified.active !==
|
|
1376
|
-
throw new Error('activation did not leave the Schedule active');
|
|
1436
|
+
if (verified.active !== candidate.desiredActive) {
|
|
1437
|
+
throw new Error('activation did not leave the Schedule in the desired active state');
|
|
1438
|
+
}
|
|
1439
|
+
const verifiedManifest = manifestFromRecord({ record: verified, stableKey: candidate.stableKey,
|
|
1440
|
+
target: candidate.target, stableKeyName: candidate.stableKeyName });
|
|
1441
|
+
if (readConfiguredResourceMetadataStableKey(verified, candidate.stableKeyName) !== candidate.stableKey
|
|
1442
|
+
|| verified.targetType !== expectedTargetType || verified.targetId !== candidate.targetId
|
|
1443
|
+
|| (candidate.target.type === 'MATERIALIZED_VIEW' && materializedRefreshMode(verified) !== candidate.target.refreshMode)
|
|
1444
|
+
|| hashPortableSchedule(verifiedManifest) !== candidate.portableHash) {
|
|
1445
|
+
throw new Error('activated Schedule definition does not match the verified candidate');
|
|
1377
1446
|
}
|
|
1378
1447
|
results.push({
|
|
1379
1448
|
stableKey: candidate.stableKey,
|
|
1380
|
-
action
|
|
1449
|
+
action,
|
|
1381
1450
|
status: 'deployed',
|
|
1382
1451
|
targetPath: candidate.targetPath,
|
|
1383
1452
|
});
|
|
@@ -1385,7 +1454,7 @@ export async function activateVerifiedSchedules(input) {
|
|
|
1385
1454
|
catch (error) {
|
|
1386
1455
|
results.push({
|
|
1387
1456
|
stableKey: candidate.stableKey,
|
|
1388
|
-
action
|
|
1457
|
+
action,
|
|
1389
1458
|
status: 'failed',
|
|
1390
1459
|
targetPath: candidate.targetPath,
|
|
1391
1460
|
error: schedulePushError(error),
|
package/dist/src/types.d.ts
CHANGED
|
@@ -162,6 +162,7 @@ export type EndpointRecord = {
|
|
|
162
162
|
method?: string;
|
|
163
163
|
componentId?: string | null;
|
|
164
164
|
componentVersion?: number | null;
|
|
165
|
+
componentDigest?: string | null;
|
|
165
166
|
active?: boolean;
|
|
166
167
|
parts?: number;
|
|
167
168
|
options?: EndpointOptions | null;
|
|
@@ -263,6 +264,7 @@ export type JobTemplateRecord = {
|
|
|
263
264
|
componentId?: string;
|
|
264
265
|
component?: ComponentRecord;
|
|
265
266
|
componentVersion?: number | null;
|
|
267
|
+
componentDigest?: string | null;
|
|
266
268
|
timeout?: number;
|
|
267
269
|
triggerUser?: string | null;
|
|
268
270
|
options?: unknown;
|
package/dist/src/ui.js
CHANGED
|
@@ -167,7 +167,7 @@ function renderCommandCatalog() {
|
|
|
167
167
|
commandRow('revo job-templates push --all [--project <name>] --yes [--force] [--json]', 'Create or safely update job templates with live lock checks'),
|
|
168
168
|
commandRow('revo schedules pull --all [--project <name>] [--force]', 'Pull Job Template and Materialized View schedules into the configured workspace'),
|
|
169
169
|
commandRow('revo schedules plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, target schedules, and portable dependencies'),
|
|
170
|
-
commandRow('revo schedules push --all [--project <name>] --yes [--force] [--activate] [--json]', '
|
|
170
|
+
commandRow('revo schedules push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Sync Schedule definitions; --activate also aligns enabled/disabled state'),
|
|
171
171
|
commandRow('revo events pull --all [--project <name>] [--force] [--json]', 'Pull portable Job Template Event definitions into the configured workspace'),
|
|
172
172
|
commandRow('revo events plan --all [--project <name>] [--json] [--strict]', 'Preview Event manifests, lock baselines, target state, and Job Template dependencies'),
|
|
173
173
|
commandRow('revo events push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Create or safely update disabled-by-default Event definitions'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revoengine/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "CLI package for the RevoEngine Platform API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
13
13
|
"clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true });\"",
|
|
14
|
-
"check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
|
|
14
|
+
"check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/component-contract.ts'); await import('./src/database-indexes.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
|
|
15
15
|
"dev": "node ./scripts/dev.ts",
|
|
16
16
|
"prepack": "npm run build",
|
|
17
17
|
"test": "node --test ./test/*.test.ts",
|