@revoengine/cli 1.0.28 → 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 +6 -0
- package/dist/src/client.d.ts +4 -4
- 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/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:
|
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;
|
|
@@ -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;
|