@revoengine/cli 1.0.38 → 2.0.0

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +22 -10
  3. package/dist/src/argument-contract.js +5 -5
  4. package/dist/src/automation-contract.generated.d.ts +6 -30
  5. package/dist/src/automation-contract.generated.js +6 -30
  6. package/dist/src/client.d.ts +2 -2
  7. package/dist/src/client.js +4 -14
  8. package/dist/src/commands/component.js +16 -0
  9. package/dist/src/commands/database-tables.js +1 -1
  10. package/dist/src/commands/emulate.js +67 -74
  11. package/dist/src/commands/terminal-browser-human-input.d.ts +28 -0
  12. package/dist/src/commands/terminal-browser-human-input.js +56 -7
  13. package/dist/src/commands/terminal-browser-live-protocol.d.ts +13 -1
  14. package/dist/src/commands/terminal-browser-live-protocol.js +20 -4
  15. package/dist/src/commands/terminal-browser-live-transport.d.ts +2 -0
  16. package/dist/src/commands/terminal-browser-live-transport.js +21 -4
  17. package/dist/src/commands/terminal-browser-live.d.ts +36 -1
  18. package/dist/src/commands/terminal-browser-live.js +435 -106
  19. package/dist/src/commands/terminal-browser-observation.d.ts +1 -1
  20. package/dist/src/commands/terminal-browser-observation.js +10 -1
  21. package/dist/src/commands/terminal-browser-page-input.d.ts +1 -0
  22. package/dist/src/commands/terminal-browser-page-input.js +20 -0
  23. package/dist/src/commands/terminal-browser-profile-sync.d.ts +5 -1
  24. package/dist/src/commands/terminal-browser-profile-sync.js +13 -2
  25. package/dist/src/commands/terminal-browser-profile-sync.protocol.d.ts +2 -0
  26. package/dist/src/commands/terminal-browser-recording.d.ts +6 -3
  27. package/dist/src/commands/terminal-browser-recording.js +45 -15
  28. package/dist/src/commands/terminal-browser.d.ts +17 -0
  29. package/dist/src/commands/terminal-browser.js +318 -111
  30. package/dist/src/commands/terminal-operational-log.js +2 -1
  31. package/dist/src/commands/terminal-output-buffer.d.ts +2 -0
  32. package/dist/src/commands/terminal-output-buffer.js +6 -0
  33. package/dist/src/commands/terminal-reconnect-grace.d.ts +1 -0
  34. package/dist/src/commands/terminal-reconnect-grace.js +1 -0
  35. package/dist/src/commands/terminal-sandbox.js +22 -6
  36. package/dist/src/commands/terminal.js +136 -40
  37. package/dist/src/endpoint-emulator.d.ts +16 -13
  38. package/dist/src/endpoint-emulator.js +26 -35
  39. package/dist/src/project.js +1 -0
  40. package/dist/src/request-contract.d.ts +2 -0
  41. package/dist/src/request-contract.js +11 -1
  42. package/dist/src/resource-syncs/database-table-sync.d.ts +2 -1
  43. package/dist/src/resource-syncs/database-table-sync.js +60 -23
  44. package/dist/src/sync-omit.js +1 -1
  45. package/dist/src/types.d.ts +0 -3
  46. package/dist/src/ui.js +2 -2
  47. package/package.json +1 -1
@@ -7,6 +7,7 @@ import { ApiError, RequestTimeoutError } from "./client.js";
7
7
  import { componentContentDigest } from "./component-contract.js";
8
8
  import { buildDebugElements, normalizeComponentType } from "./component-debug-source.js";
9
9
  import { readConfiguredResourceMetadataStableKey } from "./resource-metadata.js";
10
+ import { retiredLibraryOptionErrors } from "./request-contract.js";
10
11
  import { ENDPOINT_MANIFEST_FILE, ENDPOINTS_DIRECTORY, validateEndpointManifest, } from "./resource-syncs/endpoint-sync.js";
11
12
  import { normalizeEndpointPath } from "./resource-syncs/runtime-definition-validation.js";
12
13
  import { isRecord } from "./resource-syncs/util.js";
@@ -123,26 +124,22 @@ async function matchRoute(options, method, pathname) {
123
124
  if (matches[1]?.dynamic === match.dynamic) {
124
125
  throw new EmulatorError(409, 'AMBIGUOUS_ENDPOINT', 'More than one local route matches with the same specificity.');
125
126
  }
127
+ const retired = retiredLibraryOptionErrors(match.value.options);
128
+ if (retired.length)
129
+ throw new EmulatorError(422, 'EXECUTION_LIBRARY_OPTION_REMOVED', retired.join('\n'));
126
130
  if (!validateEndpointManifest(match.value, options.stableKeyName)) {
127
131
  throw new EmulatorError(422, 'INVALID_ENDPOINT', `Invalid local endpoint: ${path.basename(path.dirname(match.file))}.`);
128
132
  }
129
133
  return { endpoint: match.value, parameters: match.parameters };
130
134
  }
131
- function assertSupportedEndpoint(endpoint, serviceAccountAsCaller) {
135
+ function assertSupportedEndpoint(endpoint) {
132
136
  const options = endpoint.options ?? {};
133
- if (endpoint.executionPolicy?.currentUser === 'EXECUTION_ACCOUNT') {
134
- throw new EmulatorError(501, 'ENDPOINT_EXECUTION_POLICY_UNSUPPORTED', 'Endpoint emulator cannot expose a different execution account as the current user.');
137
+ const policy = endpoint.executionPolicy;
138
+ if (policy?.currentUser === 'EXECUTION_ACCOUNT' || (policy?.mode === 'SERVICE_ACCOUNT' && policy.currentUser !== 'CALLER')) {
139
+ throw new EmulatorError(501, 'ENDPOINT_EXECUTION_POLICY_UNSUPPORTED', 'Local preview uses the CLI identity. Select Published endpoints for this route.');
135
140
  }
136
- if (endpoint.executionPolicy?.mode === 'SERVICE_ACCOUNT') {
137
- if (!serviceAccountAsCaller) {
138
- throw new EmulatorError(501, 'ENDPOINT_EXECUTION_POLICY_UNSUPPORTED', 'Choose --service-account=caller or --service-account=published for this endpoint.');
139
- }
140
- if (endpoint.executionPolicy.currentUser !== 'CALLER') {
141
- throw new EmulatorError(501, 'ENDPOINT_EXECUTION_POLICY_UNSUPPORTED', 'Local caller preview requires an explicit CALLER identity. Use published execution for inherited identity.');
142
- }
143
- }
144
- if ((options.responseMode ?? 'http') !== 'http' || options.skipLibs === true) {
145
- throw new EmulatorError(501, 'ENDPOINT_OPTIONS_UNSUPPORTED', 'Endpoint SSE and skipLibs are unavailable through component debug.');
141
+ if ((options.responseMode ?? 'http') !== 'http') {
142
+ throw new EmulatorError(501, 'ENDPOINT_OPTIONS_UNSUPPORTED', 'Endpoint SSE is unavailable through component debug.');
146
143
  }
147
144
  }
148
145
  async function readRequestBody(request) {
@@ -200,12 +197,9 @@ async function loadComponent({ file, value }) {
200
197
  const extension = type.includes('_TS') ? 'ts' : type === 'JSON_VALIDATOR' ? 'json' : 'js';
201
198
  return readWorkspaceComponentSource(file, value, extension);
202
199
  }
203
- async function loadLibraries(files, options) {
204
- const include = Array.isArray(options.includeLibs) ? options.includeLibs : [];
205
- const exclude = Array.isArray(options.excludeLibs) ? options.excludeLibs : [];
200
+ async function loadLibraries(files) {
206
201
  const libs = files.filter(({ value }) => typeof value.name === 'string' && value.active !== false
207
- && LIB_TYPES.has(normalizeComponentType(value)) && (!include.length || include.includes(value.name))
208
- && !exclude.includes(value.name));
202
+ && LIB_TYPES.has(normalizeComponentType(value)));
209
203
  const names = libs.map(({ value }) => value.name);
210
204
  if (new Set(names).size !== libs.length || libs.length > 100) {
211
205
  throw new EmulatorError(422, 'INVALID_DEBUG_LIBRARIES', 'Selected local libraries have duplicate names or exceed the sandbox limit of 100.');
@@ -296,22 +290,14 @@ function debugResponse(result, endpoint, component) {
296
290
  return { status };
297
291
  return { status, body: Object.fromEntries(visible.flatMap(({ key }) => Object.hasOwn(results, key.toLowerCase()) ? [[key, results[key.toLowerCase()]]] : [])) };
298
292
  }
299
- async function executeRequest(emulator, request, signal, onRoute) {
293
+ async function executeRequest(emulator, request, signal, onRoute, onExecution) {
300
294
  const rawUrl = request.url ?? '';
301
295
  if (!rawUrl.startsWith('/') || rawUrl.startsWith('//') || rawUrl.split('?', 1)[0].includes('\\')) {
302
296
  throw new EmulatorError(400, 'INVALID_REQUEST_TARGET', 'Expected a relative HTTP request path.');
303
297
  }
304
298
  const url = new URL(rawUrl, 'http://localhost');
305
299
  const method = request.method ?? 'GET';
306
- const { endpoint, parameters } = await matchRoute(emulator, method, url.pathname);
307
- onRoute(endpoint.route.path);
308
- if (endpoint.executionPolicy?.mode === 'SERVICE_ACCOUNT' && emulator.runPublishedEndpoint) {
309
- if (emulator.readOnly) {
310
- throw new EmulatorError(403, 'PUBLISHED_ENDPOINT_REQUIRES_ALLOW_WRITES', 'The published endpoint uses normal Run execution and requires Allow writes.');
311
- }
312
- if (endpoint.route.path !== url.pathname || endpoint.route.path.split('/').some(part => part === '@' || part.startsWith(':'))) {
313
- throw new EmulatorError(501, 'PUBLISHED_ENDPOINT_REQUIRES_STATIC_ROUTE', 'Published execution requires an exact static endpoint path.');
314
- }
300
+ if ('runPublishedEndpoint' in emulator) {
315
301
  for (const name of [...url.searchParams.keys()]) {
316
302
  if (OMITTED_QUERY_PARAMETERS.has(name.toLowerCase()))
317
303
  url.searchParams.delete(name);
@@ -324,9 +310,12 @@ async function executeRequest(emulator, request, signal, onRoute) {
324
310
  }
325
311
  const body = await readRequestBody(request);
326
312
  signal.throwIfAborted();
327
- return emulator.runPublishedEndpoint({ endpoint, url, headers, body, signal });
313
+ onExecution('published');
314
+ return emulator.runPublishedEndpoint({ method, url, headers, body, signal });
328
315
  }
329
- assertSupportedEndpoint(endpoint, emulator.serviceAccountAsCaller === true);
316
+ const { endpoint, parameters } = await matchRoute(emulator, method, url.pathname);
317
+ onRoute(endpoint.route.path);
318
+ assertSupportedEndpoint(endpoint);
330
319
  const options = endpoint.options ?? {};
331
320
  const query = requestQuery(url);
332
321
  const body = await requestBody(request);
@@ -334,6 +323,8 @@ async function executeRequest(emulator, request, signal, onRoute) {
334
323
  .filter(([key]) => !OMITTED_HEADERS.has(key) && !key.startsWith('x-revo-')));
335
324
  const files = endpoint.execution || endpoint.schema
336
325
  ? await readManifests(path.join(emulator.workspaceRoot, 'Components'), 'component.json') : [];
326
+ if (endpoint.execution || endpoint.schema || options.guard !== undefined)
327
+ onExecution('sandbox');
337
328
  const validation = await validateInput(emulator, endpoint, files, { query, headers, body, parameters }, signal);
338
329
  if ('response' in validation)
339
330
  return validation.response;
@@ -350,16 +341,15 @@ async function executeRequest(emulator, request, signal, onRoute) {
350
341
  if (new Set(elements.map(element => element.key.toLowerCase())).size !== elements.length) {
351
342
  throw new EmulatorError(501, 'AMBIGUOUS_DEBUG_RESULT_KEYS', 'Component keys that differ only by case cannot be emulated through legacy debug results.');
352
343
  }
353
- const extraLibs = await loadLibraries(files, options);
344
+ const extraLibs = await loadLibraries(files);
354
345
  const timeout = endpoint.timeout ?? 60;
355
346
  const payload = {
347
+ ...(emulator.skipValidate ? { bypassValidation: true } : {}),
356
348
  type, elements, extraLibs, timeout, memory: options.memory || undefined, readOnly: emulator.readOnly,
357
349
  inputs: {
358
350
  ...validation.input,
359
351
  params: Object.values(isRecord(validation.input.parameters) ? validation.input.parameters : parameters),
360
352
  path: url.pathname, method, templateInputs: options.input ?? {},
361
- ...(Array.isArray(options.includeLibs) ? { includeLibs: options.includeLibs } : {}),
362
- ...(Array.isArray(options.excludeLibs) ? { excludeLibs: options.excludeLibs } : {}),
363
353
  },
364
354
  };
365
355
  signal.throwIfAborted();
@@ -426,12 +416,13 @@ export function createEndpointEmulator(emulator) {
426
416
  let requestId = 0;
427
417
  return createServer(async (request, response) => {
428
418
  let route;
419
+ let execution;
429
420
  if (emulator.onRequest) {
430
421
  const onRequest = emulator.onRequest;
431
422
  const started = performance.now();
432
423
  const requestInfo = { id: ++requestId, method: request.method ?? 'GET' };
433
424
  response.once('close', () => {
434
- const timing = { ...requestInfo, route, durationMs: Math.round(performance.now() - started) };
425
+ const timing = { ...requestInfo, route, execution, durationMs: Math.round(performance.now() - started) };
435
426
  if (response.writableFinished) {
436
427
  onRequest({ ...timing, event: 'request_finished', status: response.statusCode });
437
428
  }
@@ -457,7 +448,7 @@ export function createEndpointEmulator(emulator) {
457
448
  response.once('close', abort);
458
449
  inFlight++;
459
450
  try {
460
- const result = await executeRequest(emulator, request, controller.signal, matched => { route = matched; });
451
+ const result = await executeRequest(emulator, request, controller.signal, matched => { route = matched; }, selected => { execution = selected; });
461
452
  if (!response.destroyed)
462
453
  send(response, request.method, result);
463
454
  }
@@ -527,6 +527,7 @@ export function ensureProjectDebugScaffolding(rootDir) {
527
527
  timeout: 10,
528
528
  memory: 128,
529
529
  readOnly: true,
530
+ callStrategy: 'caller',
530
531
  }, null, 2)}\n`],
531
532
  [path.join(rootDir, REVO_PLAYGROUND_JS_FILE), ''],
532
533
  [path.join(rootDir, REVO_PLAYGROUND_TS_FILE), ''],
@@ -37,3 +37,5 @@ export declare function validateRequestContract(name: string, value: unknown, op
37
37
  partial?: boolean;
38
38
  path?: string;
39
39
  }): string[];
40
+ /** Only former compiler configuration locations are checked; business values remain unrestricted. */
41
+ export declare function retiredLibraryOptionErrors(value: unknown, path?: string): string[];
@@ -61,7 +61,10 @@ export function validateRequestContract(name, value, options = {}) {
61
61
  const schema = requestContracts[name];
62
62
  if (!schema)
63
63
  return [`Unknown request contract "${name}"`];
64
- const errors = [];
64
+ const errors = ['EndpointOptionsDto', 'RunOptionsDto', 'JobOptionsDto'].includes(name)
65
+ ? retiredLibraryOptionErrors(value, options.path || name)
66
+ : ['EndpointRequestDto', 'JobTemplateRequestDto', 'UpdateEndpointRequestDto', 'UpdateJobTemplate'].includes(name) && isObject(value)
67
+ ? retiredLibraryOptionErrors(value.options, `${options.path || name}.options`) : [];
65
68
  function visit(rule, input, label, parent, partial = false) {
66
69
  if (rule.whenEquals && parent?.[rule.whenEquals.field] !== rule.whenEquals.value)
67
70
  return;
@@ -136,3 +139,10 @@ export function validateRequestContract(name, value, options = {}) {
136
139
  visit(schema, value, options.path || name, undefined, options.partial);
137
140
  return errors;
138
141
  }
142
+ /** Only former compiler configuration locations are checked; business values remain unrestricted. */
143
+ export function retiredLibraryOptionErrors(value, path = 'options') {
144
+ if (!isObject(value))
145
+ return [];
146
+ return ['skipLibs', 'includeLibs', 'excludeLibs'].filter(key => Object.hasOwn(value, key))
147
+ .map(key => `${path}.${key} is no longer supported. Please update the client and remove this configuration field.`);
148
+ }
@@ -10,6 +10,7 @@ export type DatabaseSchemaManifest = {
10
10
  description?: string;
11
11
  metadata: Record<string, unknown>;
12
12
  type?: string;
13
+ audit?: boolean;
13
14
  definition?: PortableDefinition[];
14
15
  options?: {
15
16
  indexes: Record<string, unknown>[];
@@ -93,7 +94,7 @@ export type DatabaseSchemaPushResult = {
93
94
  reason?: string;
94
95
  error?: string;
95
96
  };
96
- export declare function hashPortableDatabaseSchema(manifest: DatabaseSchemaManifest): string;
97
+ export declare function hashPortableDatabaseSchema(manifest: DatabaseSchemaManifest, manageAudit?: boolean): string;
97
98
  export declare function buildDatabaseSchemasPlan(input: {
98
99
  client: RevoClient;
99
100
  cwd: string;
@@ -135,13 +135,14 @@ function manifestFromEntry(entry, stableKeyName) {
135
135
  kind: 'database-schema',
136
136
  ...common,
137
137
  ...(typeof record.type === 'string' ? { type: record.type } : {}),
138
+ ...(typeof record.audit === 'boolean' ? { audit: record.audit } : {}),
138
139
  definition,
139
140
  options: { indexes: databaseIndexPayload(isRecord(record.options) ? record.options.indexes : undefined) },
140
141
  ...(partition ? { partition } : {}),
141
142
  ...(hasForeignReferences(definition) ? { migration: { foreignReferences: 'manual' } } : {}),
142
143
  };
143
144
  }
144
- function portableDatabaseSchemaManifest(manifest) {
145
+ function portableDatabaseSchemaManifest(manifest, manageAudit = true) {
145
146
  const common = {
146
147
  stableKey: manifest.stableKey,
147
148
  name: manifest.name,
@@ -166,6 +167,7 @@ function portableDatabaseSchemaManifest(manifest) {
166
167
  kind: manifest.kind,
167
168
  ...common,
168
169
  ...(manifest.type === undefined ? {} : { type: manifest.type }),
170
+ ...(manageAudit && typeof manifest.audit === 'boolean' ? { audit: manifest.audit } : {}),
169
171
  options: { indexes: databaseIndexPayload(manifest.options?.indexes) },
170
172
  ...(manifest.definition === undefined
171
173
  ? {}
@@ -175,8 +177,19 @@ function portableDatabaseSchemaManifest(manifest) {
175
177
  : { partition: canonicalValue(manifest.partition, true) }),
176
178
  };
177
179
  }
178
- export function hashPortableDatabaseSchema(manifest) {
179
- return hashSyncDefinition('database-table', portableDatabaseSchemaManifest(manifest));
180
+ export function hashPortableDatabaseSchema(manifest, manageAudit = true) {
181
+ return hashSyncDefinition('database-table', portableDatabaseSchemaManifest(manifest, manageAudit));
182
+ }
183
+ function matchesDatabaseSchemaBaseline(manifest, hash, baseline, manageAudit) {
184
+ if (hash === baseline)
185
+ return true;
186
+ if (manifest.kind !== 'database-schema')
187
+ return false;
188
+ // Pre-audit locks contain the same schema with this property excluded.
189
+ if (manageAudit)
190
+ return hashPortableDatabaseSchema(manifest, false) === baseline;
191
+ // Once a manifest stops managing audit, either previous value is equivalent.
192
+ return [true, false].some((audit) => hashPortableDatabaseSchema({ ...manifest, audit }) === baseline);
180
193
  }
181
194
  function rootManifestPath(workspaceRoot, manifest) {
182
195
  const category = typeof manifest.category === 'string' && manifest.category.trim()
@@ -236,6 +249,9 @@ function validatePlanManifest(manifest, stableKeyName) {
236
249
  if (manifest.kind !== 'database-schema' && manifest.kind !== 'database-partition') {
237
250
  errors.push('kind must be database-schema or database-partition');
238
251
  }
252
+ if (Object.hasOwn(manifest, 'audit') && (manifest.kind !== 'database-schema' || typeof manifest.audit !== 'boolean')) {
253
+ errors.push('audit must be a boolean and can only be declared on a root database-schema');
254
+ }
239
255
  if (typeof manifest.stableKey !== 'string' || !manifest.stableKey.trim()) {
240
256
  errors.push('stableKey must be a non-empty string');
241
257
  }
@@ -639,6 +655,16 @@ function diffDatabaseSchemas(desired, current, stableKeyName) {
639
655
  hint: 'Foreign-reference declarations are not enforced as SQL constraints by the API; deploy and verify the relationship manually before reconciling this table.',
640
656
  });
641
657
  }
658
+ if (desired.audit !== undefined && desired.audit !== current.audit) {
659
+ changes.push({
660
+ kind: 'field-changed',
661
+ field: 'audit',
662
+ risk: 'operational',
663
+ before: current.audit,
664
+ after: desired.audit,
665
+ hint: 'Changing audit configures the target table trigger and affects capture of future row changes.',
666
+ });
667
+ }
642
668
  return changes;
643
669
  }
644
670
  function partitionBoundsOverlap(left, right) {
@@ -972,6 +998,8 @@ export async function buildDatabaseSchemasPlan(input) {
972
998
  }
973
999
  consumedTargetKeys.add(stableKey);
974
1000
  const current = matches[0];
1001
+ const manageAudit = entries[0].manifest.audit !== undefined;
1002
+ const currentHash = manageAudit ? current.hash : hashPortableDatabaseSchema(current.manifest, false);
975
1003
  const desiredHash = hashPortableDatabaseSchema(desired);
976
1004
  const changes = diffDatabaseSchemas(desired, current.manifest, input.stableKeyName);
977
1005
  if (changes.some((change) => (change.kind === 'column-renamed'
@@ -993,12 +1021,12 @@ export async function buildDatabaseSchemasPlan(input) {
993
1021
  });
994
1022
  }
995
1023
  }
996
- if (changes.length > 0 && desired.kind === 'database-schema' && current.record.audit === true) {
1024
+ if (changes.length > 0 && desired.kind === 'database-schema' && (current.record.audit === true || desired.audit === true)) {
997
1025
  changes.push({
998
1026
  kind: 'audit-trigger-rebuild',
999
1027
  field: 'audit',
1000
1028
  risk: 'operational',
1001
- hint: 'This target has audit enabled, so the API rebuilds its audit trigger during the update. Writes are serialized and retried once only after a fresh live hash and version check.',
1029
+ hint: 'This update configures the target audit trigger. Writes are serialized and retried once only after a fresh live hash and version check.',
1002
1030
  });
1003
1031
  }
1004
1032
  const changedFields = [...new Set(changes.map((change) => change.field))];
@@ -1011,7 +1039,7 @@ export async function buildDatabaseSchemasPlan(input) {
1011
1039
  kind: desired.kind,
1012
1040
  ...(desired.parentStableKey ? { parentStableKey: desired.parentStableKey } : {}),
1013
1041
  desiredHash,
1014
- currentHash: current.hash,
1042
+ currentHash,
1015
1043
  ...(baselineHash ? { baselineHash } : {}),
1016
1044
  ...(changes.length > 0 ? { changes, changedFields } : {}),
1017
1045
  hints: [...changes.map((change) => change.hint), ...(sizeHint ? [sizeHint] : [])],
@@ -1028,7 +1056,7 @@ export async function buildDatabaseSchemasPlan(input) {
1028
1056
  });
1029
1057
  continue;
1030
1058
  }
1031
- if (desiredHash === current.hash) {
1059
+ if (desiredHash === currentHash) {
1032
1060
  if (!baselineHash) {
1033
1061
  items.push({
1034
1062
  ...common,
@@ -1037,7 +1065,7 @@ export async function buildDatabaseSchemasPlan(input) {
1037
1065
  hints: ['Adopt this verified live match through the push workflow so the selected environment receives its own lock baseline.'],
1038
1066
  });
1039
1067
  }
1040
- else if (baselineHash !== current.hash) {
1068
+ else if (baselineHash !== currentHash) {
1041
1069
  items.push({
1042
1070
  ...common,
1043
1071
  status: 'reconciled',
@@ -1072,10 +1100,10 @@ export async function buildDatabaseSchemasPlan(input) {
1072
1100
  else if (!baselineHash) {
1073
1101
  items.push({ ...common, status: 'missing-lock', reason: `missing ${input.envName} lock baseline` });
1074
1102
  }
1075
- else if (desiredHash === baselineHash) {
1103
+ else if (desiredHash === baselineHash || (!manageAudit && matchesDatabaseSchemaBaseline(desired, desiredHash, baselineHash, false))) {
1076
1104
  items.push({ ...common, status: 'remote-changed', reason: 'target changed since lock baseline' });
1077
1105
  }
1078
- else if (current.hash === baselineHash) {
1106
+ else if (matchesDatabaseSchemaBaseline(current.manifest, currentHash, baselineHash, manageAudit)) {
1079
1107
  items.push({ ...common, status: 'safe-update' });
1080
1108
  }
1081
1109
  else {
@@ -1219,7 +1247,7 @@ export async function buildDatabaseSchemasPlan(input) {
1219
1247
  blockers: [...new Set(blockers)].sort((left, right) => left.localeCompare(right)),
1220
1248
  warnings,
1221
1249
  exclusions: [
1222
- 'audit configuration and audit history are target-local',
1250
+ 'audit history is target-local; manifests without audit preserve the target setting',
1223
1251
  'ACL users and groups are target-local; new root tables inherit the source restricted setting',
1224
1252
  'tags are target-local',
1225
1253
  'root schemas and unknown target-only partitions are never deleted by plan',
@@ -1550,7 +1578,7 @@ function createPayloadForDatabaseSchema(input) {
1550
1578
  ...(input.manifest.partition === undefined
1551
1579
  ? {}
1552
1580
  : { partition: canonicalValue(input.manifest.partition, true) }),
1553
- audit: false,
1581
+ audit: input.manifest.audit ?? false,
1554
1582
  restricted: input.restricted === true,
1555
1583
  };
1556
1584
  }
@@ -1641,12 +1669,13 @@ function verifyCreatedDatabaseSchema(input) {
1641
1669
  if (verified.length !== 1) {
1642
1670
  throw new Error('created target could not be resolved into the live partition graph');
1643
1671
  }
1644
- const remoteHash = withoutSyncOmit(() => hashPortableDatabaseSchema(verified[0].manifest));
1672
+ const manageAudit = input.desired.audit !== undefined;
1673
+ const remoteHash = withoutSyncOmit(() => hashPortableDatabaseSchema(verified[0].manifest, manageAudit));
1645
1674
  const desiredHash = withoutSyncOmit(() => hashPortableDatabaseSchema(input.desired));
1646
1675
  if (remoteHash !== desiredHash) {
1647
1676
  throw new Error(`created target did not match desired portable hash (desired: ${desiredHash}; actual: ${remoteHash})`);
1648
1677
  }
1649
- return verified[0].hash;
1678
+ return hashPortableDatabaseSchema(verified[0].manifest, manageAudit);
1650
1679
  }
1651
1680
  function updateDatabaseSchemaEnvironmentBaseline(input) {
1652
1681
  const { projectRoot } = requireProjectLayout(input.cwd, 'Database Table');
@@ -1703,14 +1732,15 @@ async function resolveLiveDatabaseSchemaWriteTarget(input) {
1703
1732
  stableKey: input.stableKey,
1704
1733
  stableKeyName: input.stableKeyName,
1705
1734
  });
1706
- if (resolved.hash !== input.expectedHash) {
1735
+ const hash = hashPortableDatabaseSchema(resolved.manifest, input.manageAudit);
1736
+ if (hash !== input.expectedHash) {
1707
1737
  throw new Error('target Database Table changed after planning');
1708
1738
  }
1709
1739
  return {
1710
1740
  databaseId,
1711
1741
  record,
1712
1742
  manifest: resolved.manifest,
1713
- hash: resolved.hash,
1743
+ hash,
1714
1744
  records: freshRecords,
1715
1745
  };
1716
1746
  }
@@ -1742,6 +1772,9 @@ function buildDatabaseSchemaUpdatePayload(input) {
1742
1772
  if (input.desired.kind === 'database-partition') {
1743
1773
  return payload;
1744
1774
  }
1775
+ if (input.desired.audit !== undefined && input.desired.audit !== input.target.audit) {
1776
+ payload.audit = input.desired.audit;
1777
+ }
1745
1778
  const targetDefinitions = Array.isArray(input.target.definition)
1746
1779
  ? input.target.definition.filter(isRecord)
1747
1780
  : [];
@@ -1809,16 +1842,17 @@ function verifyDatabaseSchemaWrite(input) {
1809
1842
  assertOmittedPropertiesPreserved('database-table', previous.manifest, verified.manifest);
1810
1843
  }
1811
1844
  const desiredHash = hashPortableDatabaseSchema(input.desired);
1812
- if (verified.hash !== desiredHash) {
1813
- throw new Error(`written target did not match desired portable hash (desired: ${desiredHash}; actual: ${verified.hash})`);
1845
+ const remoteHash = hashPortableDatabaseSchema(verified.manifest, input.desired.audit !== undefined);
1846
+ if (remoteHash !== desiredHash) {
1847
+ throw new Error(`written target did not match desired portable hash (desired: ${desiredHash}; actual: ${remoteHash})`);
1814
1848
  }
1815
- return verified.hash;
1849
+ return remoteHash;
1816
1850
  }
1817
- function isRetriableAuditedDatabaseSchemaWrite(error, target) {
1851
+ function isRetriableAuditedDatabaseSchemaWrite(error, audited) {
1818
1852
  if (error instanceof ApiError && error.status === 429) {
1819
1853
  return true;
1820
1854
  }
1821
- if (target.audit !== true) {
1855
+ if (!audited) {
1822
1856
  return false;
1823
1857
  }
1824
1858
  const message = error instanceof Error ? error.message : String(error);
@@ -2123,6 +2157,7 @@ export async function pushDatabaseSchemas(input) {
2123
2157
  stableKey,
2124
2158
  stableKeyName: input.stableKeyName,
2125
2159
  expectedHash: item.currentHash,
2160
+ manageAudit: desired.audit !== undefined,
2126
2161
  });
2127
2162
  if (!auditedByPlan && live.record.audit === true && lastAuditedWrite.at > 0) {
2128
2163
  await waitForAuditedDatabaseSchemaWrite(lastAuditedWrite.at);
@@ -2132,6 +2167,7 @@ export async function pushDatabaseSchemas(input) {
2132
2167
  stableKey,
2133
2168
  stableKeyName: input.stableKeyName,
2134
2169
  expectedHash: item.currentHash,
2170
+ manageAudit: desired.audit !== undefined,
2135
2171
  });
2136
2172
  }
2137
2173
  if (item.changes?.some((change) => change.kind === 'database-view-dependency')) {
@@ -2155,13 +2191,13 @@ export async function pushDatabaseSchemas(input) {
2155
2191
  }
2156
2192
  await input.client.updateDatabaseSchema(live.databaseId, payload, { idempotencyKey: input.idempotencyKey });
2157
2193
  writeAccepted = true;
2158
- if (live.record.audit === true) {
2194
+ if (auditedByPlan || live.record.audit === true) {
2159
2195
  lastAuditedWrite.at = Date.now();
2160
2196
  }
2161
2197
  break;
2162
2198
  }
2163
2199
  catch (error) {
2164
- if (attempt === 1 || !live || !isRetriableAuditedDatabaseSchemaWrite(error, live.record)) {
2200
+ if (attempt === 1 || !live || !isRetriableAuditedDatabaseSchemaWrite(error, auditedByPlan || live.record.audit === true)) {
2165
2201
  throw error;
2166
2202
  }
2167
2203
  lastAuditedWrite.at = Date.now();
@@ -2175,6 +2211,7 @@ export async function pushDatabaseSchemas(input) {
2175
2211
  stableKey,
2176
2212
  stableKeyName: input.stableKeyName,
2177
2213
  expectedHash: item.currentHash,
2214
+ manageAudit: desired.audit !== undefined,
2178
2215
  });
2179
2216
  }
2180
2217
  if (!live) {
@@ -64,7 +64,7 @@ function schemaAllows(schema, parts) {
64
64
  }
65
65
  const runtimeOptionRoots = { endpoint: 'EndpointOptionsDto', 'job-template': 'JobOptionsDto' };
66
66
  const ordinaryRoots = {
67
- 'database-table': ['name', 'category', 'description'],
67
+ 'database-table': ['name', 'category', 'description', 'audit'],
68
68
  'database-view': ['name', 'category', 'description'],
69
69
  component: ['name', 'category', 'desc', 'active', 'testConfig'],
70
70
  'service-account': ['name'],
@@ -144,9 +144,6 @@ export type EndpointOptions = {
144
144
  customValidateResponse?: unknown;
145
145
  validateResponse?: number;
146
146
  validateHideResponse?: boolean;
147
- includeLibs?: string[];
148
- excludeLibs?: string[];
149
- skipLibs?: boolean;
150
147
  legacyResults?: boolean;
151
148
  hideRequest?: boolean;
152
149
  hideResponse?: boolean;
package/dist/src/ui.js CHANGED
@@ -136,7 +136,7 @@ function renderCommandCatalog() {
136
136
  commandRow('revo component pull --all [--project <name>] [--yes] [--force]', 'Pull every available component safely'),
137
137
  commandRow('revo component push <identity...> [--project <name>]', 'Push by configured stable key or component ID'),
138
138
  commandRow('revo component push --all [--project <name>] [--yes] [--force] [--prune] [--changed --base <ref>]', 'Push local components with lock checks'),
139
- commandRow('revo component debug <componentId> [BODY] [--read-only=true|false] [--stream]', 'Run one local component in sandbox'),
139
+ commandRow('revo component debug <componentId> [BODY] [--read-only=true|false] [--call-strategy=caller|endpoints|jobs] [--stream]', 'Run one local component in sandbox'),
140
140
  '',
141
141
  paintHeader('Native tests'),
142
142
  commandRow('revo tests list [--workspace <path>] [--search <name>] [--json]', 'Discover native test suites in the local worktree'),
@@ -157,7 +157,7 @@ function renderCommandCatalog() {
157
157
  commandRow('revo database-views push <stableKey>|--all [--project <name>] --yes [--force]', 'Create or update Database Views after live preview'),
158
158
  '',
159
159
  paintHeader('Endpoints'),
160
- commandRow('revo emulate endpoints --read-only=true|false [--project <name>] [--host <address>] [--port <port>] [--service-account=caller|published] [--no-watch]', 'Serve local endpoint code and watch HTTP requests'),
160
+ commandRow('revo emulate endpoints [--mode=local|published] [--read-only=true|false] [--project <name>] [--host <address>] [--port <port>] [--skip-validate] [--no-watch]', 'Preview local changes or call published endpoints'),
161
161
  commandRow('revo endpoints', 'List available API endpoints'),
162
162
  commandRow('revo endpoints pull --all [--project <name>] [--force]', 'Pull managed endpoints into the configured workspace'),
163
163
  commandRow('revo endpoints plan --all [--project <name>] [--json] [--strict]', 'Preview Endpoint state and Component compatibility'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revoengine/cli",
3
- "version": "1.0.38",
3
+ "version": "2.0.0",
4
4
  "description": "CLI package for the RevoEngine Platform API",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",