@revoengine/cli 1.0.31 → 1.0.34

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 (113) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +152 -24
  3. package/dist/src/argument-contract.d.ts +17 -0
  4. package/dist/src/argument-contract.js +359 -0
  5. package/dist/src/automation-contract.generated.d.ts +56 -22
  6. package/dist/src/automation-contract.generated.js +68 -26
  7. package/dist/src/cli.js +15 -13
  8. package/dist/src/client.d.ts +34 -2
  9. package/dist/src/client.js +76 -13
  10. package/dist/src/commands/agents.js +5 -1
  11. package/dist/src/commands/auth.js +2 -0
  12. package/dist/src/commands/component.js +34 -17
  13. package/dist/src/commands/database-tables.js +15 -4
  14. package/dist/src/commands/database-views.js +5 -1
  15. package/dist/src/commands/endpoints.js +5 -1
  16. package/dist/src/commands/env.js +5 -1
  17. package/dist/src/commands/events.js +5 -1
  18. package/dist/src/commands/groups.js +5 -1
  19. package/dist/src/commands/info.js +2 -0
  20. package/dist/src/commands/job-templates.js +5 -1
  21. package/dist/src/commands/metadata.js +2 -0
  22. package/dist/src/commands/migrate.d.ts +2 -2
  23. package/dist/src/commands/migrate.js +33 -7
  24. package/dist/src/commands/project.js +19 -14
  25. package/dist/src/commands/request.js +2 -0
  26. package/dist/src/commands/role-groups.js +5 -1
  27. package/dist/src/commands/schedules.js +5 -1
  28. package/dist/src/commands/search.js +2 -0
  29. package/dist/src/commands/service-accounts.js +5 -1
  30. package/dist/src/commands/studio.js +2 -0
  31. package/dist/src/commands/terminal-browser-central-profile.d.ts +65 -0
  32. package/dist/src/commands/terminal-browser-central-profile.js +203 -0
  33. package/dist/src/commands/terminal-browser-human-input.d.ts +3 -1
  34. package/dist/src/commands/terminal-browser-human-input.js +3 -1
  35. package/dist/src/commands/terminal-browser-interaction.js +1 -1
  36. package/dist/src/commands/terminal-browser-live-protocol.d.ts +34 -2
  37. package/dist/src/commands/terminal-browser-live-protocol.js +28 -12
  38. package/dist/src/commands/terminal-browser-live-transport.d.ts +1 -0
  39. package/dist/src/commands/terminal-browser-live-transport.js +9 -5
  40. package/dist/src/commands/terminal-browser-live.d.ts +24 -3
  41. package/dist/src/commands/terminal-browser-live.js +199 -30
  42. package/dist/src/commands/terminal-browser-page-input.d.ts +4 -1
  43. package/dist/src/commands/terminal-browser-page-input.js +46 -1
  44. package/dist/src/commands/terminal-browser-profile-crypto.d.ts +30 -0
  45. package/dist/src/commands/terminal-browser-profile-crypto.js +101 -0
  46. package/dist/src/commands/terminal-browser-profile-import-runner.d.ts +31 -0
  47. package/dist/src/commands/terminal-browser-profile-import-runner.js +112 -0
  48. package/dist/src/commands/terminal-browser-profile-import.d.ts +28 -0
  49. package/dist/src/commands/terminal-browser-profile-import.js +125 -0
  50. package/dist/src/commands/terminal-browser-profile-import.protocol.d.ts +50 -0
  51. package/dist/src/commands/terminal-browser-profile-import.protocol.js +52 -0
  52. package/dist/src/commands/terminal-browser-profile-preferences.d.ts +1 -0
  53. package/dist/src/commands/terminal-browser-profile-preferences.js +16 -0
  54. package/dist/src/commands/terminal-browser-profile-sync.d.ts +14 -0
  55. package/dist/src/commands/terminal-browser-profile-sync.js +169 -0
  56. package/dist/src/commands/terminal-browser-profile-sync.protocol.d.ts +50 -0
  57. package/dist/src/commands/terminal-browser-profile-sync.protocol.js +19 -0
  58. package/dist/src/commands/terminal-browser-profile.d.ts +10 -1
  59. package/dist/src/commands/terminal-browser-profile.js +30 -4
  60. package/dist/src/commands/terminal-browser-recording.d.ts +39 -0
  61. package/dist/src/commands/terminal-browser-recording.js +74 -0
  62. package/dist/src/commands/terminal-browser-recording.protocol.d.ts +49 -0
  63. package/dist/src/commands/terminal-browser-recording.protocol.js +16 -0
  64. package/dist/src/commands/terminal-browser.d.ts +14 -1
  65. package/dist/src/commands/terminal-browser.js +98 -33
  66. package/dist/src/commands/terminal-file-descriptor.d.ts +9 -0
  67. package/dist/src/commands/terminal-file-descriptor.js +39 -0
  68. package/dist/src/commands/terminal-file.js +41 -6
  69. package/dist/src/commands/terminal-image.js +3 -31
  70. package/dist/src/commands/terminal-output-buffer.d.ts +18 -1
  71. package/dist/src/commands/terminal-output-buffer.js +95 -8
  72. package/dist/src/commands/terminal-process-group.d.ts +25 -0
  73. package/dist/src/commands/terminal-process-group.js +144 -0
  74. package/dist/src/commands/terminal.d.ts +3 -1
  75. package/dist/src/commands/terminal.js +366 -80
  76. package/dist/src/commands/tests.js +2 -0
  77. package/dist/src/component-lock.d.ts +15 -1
  78. package/dist/src/component-lock.js +96 -10
  79. package/dist/src/env-sync.js +12 -6
  80. package/dist/src/migration.d.ts +7 -0
  81. package/dist/src/migration.js +39 -21
  82. package/dist/src/planning-snapshot.d.ts +3 -0
  83. package/dist/src/planning-snapshot.js +60 -2
  84. package/dist/src/project.d.ts +1 -0
  85. package/dist/src/project.js +7 -8
  86. package/dist/src/resource-syncs/agent-sync.js +76 -24
  87. package/dist/src/resource-syncs/database-table-sync.d.ts +8 -1
  88. package/dist/src/resource-syncs/database-table-sync.js +66 -32
  89. package/dist/src/resource-syncs/database-view-sync.js +41 -28
  90. package/dist/src/resource-syncs/endpoint-sync.js +90 -18
  91. package/dist/src/resource-syncs/event-sync.js +33 -14
  92. package/dist/src/resource-syncs/group-sync.js +21 -11
  93. package/dist/src/resource-syncs/job-template-sync.js +98 -37
  94. package/dist/src/resource-syncs/role-group-sync.js +22 -11
  95. package/dist/src/resource-syncs/schedule-sync.js +26 -11
  96. package/dist/src/resource-syncs/service-account-sync.js +22 -11
  97. package/dist/src/reviewed-plan.js +3 -0
  98. package/dist/src/runtime-view.js +2 -18
  99. package/dist/src/sync-omit-command.d.ts +6 -0
  100. package/dist/src/sync-omit-command.js +49 -0
  101. package/dist/src/sync-omit-write-fence.d.ts +10 -0
  102. package/dist/src/sync-omit-write-fence.js +134 -0
  103. package/dist/src/sync-omit.d.ts +59 -0
  104. package/dist/src/sync-omit.js +469 -0
  105. package/dist/src/sync-output.d.ts +3 -3
  106. package/dist/src/ui.js +11 -5
  107. package/dist/src/update-notifier.d.ts +1 -1
  108. package/dist/src/update-notifier.js +2 -1
  109. package/dist/src/utils.js +46 -17
  110. package/dist/src/workspace-prune.js +11 -3
  111. package/dist/src/workspace-write-lock.d.ts +7 -0
  112. package/dist/src/workspace-write-lock.js +144 -0
  113. package/package.json +6 -5
@@ -215,6 +215,17 @@ export const requestContracts = {
215
215
  "type": "integer",
216
216
  "maximum": 1024
217
217
  },
218
+ "responseMode": {
219
+ "nullable": true,
220
+ "enum": [
221
+ "http",
222
+ "sse"
223
+ ]
224
+ },
225
+ "sse": {
226
+ "$ref": "#/components/schemas/EndpointSseDto",
227
+ "nullable": true
228
+ },
218
229
  "input": {
219
230
  "nullable": true,
220
231
  "type": "object"
@@ -289,6 +300,41 @@ export const requestContracts = {
289
300
  },
290
301
  "additionalProperties": false
291
302
  },
303
+ "EndpointSseDto": {
304
+ "type": "object",
305
+ "properties": {
306
+ "disconnect": {
307
+ "nullable": true,
308
+ "enum": [
309
+ "cancel",
310
+ "continue",
311
+ "continue-and-notify"
312
+ ]
313
+ },
314
+ "resultEvent": {
315
+ "nullable": true,
316
+ "type": "string",
317
+ "maxLength": 1024,
318
+ "pattern": "^[^\\r\\n\\0]+$",
319
+ "patternFlags": ""
320
+ },
321
+ "errorEvent": {
322
+ "nullable": true,
323
+ "type": "string",
324
+ "maxLength": 1024,
325
+ "pattern": "^[^\\r\\n\\0]+$",
326
+ "patternFlags": ""
327
+ },
328
+ "doneEvent": {
329
+ "nullable": true,
330
+ "type": "string",
331
+ "maxLength": 1024,
332
+ "pattern": "^[^\\r\\n\\0]+$",
333
+ "patternFlags": ""
334
+ }
335
+ },
336
+ "additionalProperties": false
337
+ },
292
338
  "JobTemplateRequestDto": {
293
339
  "type": "object",
294
340
  "properties": {
@@ -608,6 +654,14 @@ export const requestContracts = {
608
654
  "UpdateComponentDto": {
609
655
  "type": "object",
610
656
  "properties": {
657
+ "testConfig": {
658
+ "allOf": [
659
+ {
660
+ "$ref": "#/components/schemas/ComponentTestConfigDto"
661
+ }
662
+ ],
663
+ "nullable": true
664
+ },
611
665
  "name": {
612
666
  "nullable": true,
613
667
  "type": "string",
@@ -632,14 +686,6 @@ export const requestContracts = {
632
686
  },
633
687
  "version": {
634
688
  "type": "integer"
635
- },
636
- "testConfig": {
637
- "allOf": [
638
- {
639
- "$ref": "#/components/schemas/ComponentTestConfigDto"
640
- }
641
- ],
642
- "nullable": true
643
689
  }
644
690
  },
645
691
  "required": [
@@ -761,9 +807,9 @@ export const requestContractDefaults = {
761
807
  "CODE_JS",
762
808
  "CODE_JS_LIB",
763
809
  "CODE_TS",
764
- "CODE_TS_LIB",
765
810
  "CODE_JS_TEST",
766
- "CODE_TS_TEST"
811
+ "CODE_TS_TEST",
812
+ "CODE_TS_LIB"
767
813
  ],
768
814
  "libraryTypes": [
769
815
  "CODE_JS_LIB",
@@ -837,6 +883,7 @@ export const requestContractDefaults = {
837
883
  "switch",
838
884
  "symbol",
839
885
  "this",
886
+ "test",
840
887
  "throw",
841
888
  "true",
842
889
  "try",
@@ -977,17 +1024,17 @@ export const requestContractSemanticSources = {
977
1024
  "packages/platform-shared/src/utils/job-retry-policy.util.ts#normalizeJobRetryPolicy": "facef84884b5b4311af06bfb4469f071ff42a4bca067b6d9092d4f6571e8ee86",
978
1025
  "packages/platform-shared/src/utils/job-retry-policy.util.ts#assertJobRetryPolicyValid": "6511ccafc15233a4ffe4e024f13e6c0e5c9d8a53c261ecc571300495afd804cf",
979
1026
  "packages/domain/src/dto/components/component.validator.ts#validateEndpointGuardSemantics": "fd885b48c2990e47d1f05965af044aef8e2256da5fa4a86d1248967b04a3fd1e",
980
- "apps/api/src/modules/endpoints/endpoint.service.ts#create": "67e4b6747981dd61cb33ca9f72e49d8d7ccfaa41f16bd57780591e1e5939d51d",
981
- "apps/api/src/modules/endpoints/endpoint.service.ts#update": "9f8e05e2f68248bcff43d2f5a5430c372ab61c2c00efd2dd8214229fa313f47f",
1027
+ "apps/api/src/modules/endpoints/endpoint.service.ts#create": "cb10fc198892423088d396acd09618d8c64504a57fac0df3a892d57993913067",
1028
+ "apps/api/src/modules/endpoints/endpoint.service.ts#update": "bc59acaffdb7275659bddb65b8d71e9d8266447054723ea87495eaa0dd512fe1",
982
1029
  "apps/api/src/modules/endpoints/endpoint.service.ts#validateEndpointOptions": "07401218669a87a9488b0aeb59f15b8d51341a172fb346ff83d38ed563a2988f",
983
1030
  "apps/api/src/modules/endpoints/endpoint.service.ts#applyEndpointOptionDefaults": "990c27ae925b613215601c215a6e38f6ecb4e2b34b77d6e2819f0921d4e56230",
984
1031
  "apps/api/src/modules/automation/jobs.service.ts#createJobTemplate": "1513bad8634fdf6abcca52f0041044512b3e53b3e7451f1b443f7e79fc026b01",
985
- "apps/api/src/modules/automation/jobs.service.ts#update": "f11808497fa36a7965b496314e1255920945df365ee62aba810612bf6b2cd30c",
1032
+ "apps/api/src/modules/automation/jobs.service.ts#update": "950fad34e7ac3ffdfce9114ba213c11e113aea036a44569b126a8c1e5e589228",
986
1033
  "packages/platform-shared/src/services/job.scheduler.service.ts#resolveTemplateInputs": "a9a4cc5df4627abf7ee2d2df7f2494d290292a15f4889a5f07a9de104ee33d9f",
987
- "packages/domain/src/dto/components/component-element-key.const.ts#isLowCodeComponentType": "f597e0a4bb99ec8cc5cd327f2556592471d62258366bd55b12ce321ad44cce9b",
1034
+ "packages/domain/src/dto/components/component-element-key.const.ts#isLowCodeComponentType": "4918470ef562727becb8c97c5afb7761a49734ecd21a6d3d5436576dbd10a6da",
988
1035
  "packages/domain/src/dto/components/component-element-key.const.ts#isDefaultLibraryElement": "4faa356b91be5c44ebe3d442b6da26088d6d35d2db5fb073e1103165431cee48",
989
1036
  "apps/api/src/modules/components/component.service.ts#assertComponentElementsSize": "30b14e4c7a1c62b4061aa13b1476d815002bf3273b4129551dde9b9a45bb87ca",
990
- "apps/api/src/modules/components/component.service.ts#validateElements": "1ff874a47bf80ed760c292c8ec9fb9b6fe48d185ea080098ff21ef8f6ac93bfa",
1037
+ "apps/api/src/modules/components/component.service.ts#validateElements": "57b292450bfdd3d26c11b4b4f12160848f4983e4b5f74850aca69b92fa2b751c",
991
1038
  "packages/execution-core/src/modules/@core/services/virtualization.service.ts#requestedMemoryLimit": "ca32691eb31e1bf5d17d80d56861bb73fa698b6f08ae047ab48a1a4927594fe4",
992
1039
  "packages/platform-shared/src/utils/custom-node-component.util.ts#normalizeCustomNodeElementPath": "486eb7ca53b95d7b49de4735d5b5ca8f15dc994852eeff0009d8a72189474455",
993
1040
  "packages/platform-shared/src/utils/custom-node-component.util.ts#hasExportedCustomNodeInit": "9979558e29219c2545a11b20924b14401aef26df99d251efe261f0447aebd98b"
@@ -996,7 +1043,8 @@ export const requestContractSourceProvenance = {
996
1043
  "main": {
997
1044
  "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointRequestDto": "45a1a84e200b2cdf9b44051fe36cb7bda1b577a0f5bbcc88942764336a6d7302",
998
1045
  "packages/domain/src/dto/automation/update.api.template.request.dto.ts#UpdateEndpointRequestDto": "20ee0c9afbfa594f189ead2b751aa00b6003efe0b70c5e1158ee78c1e0d29567",
999
- "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointOptionsDto": "398396ec9aa9a592f7e26bed333aa050d0b24adb35a314c64144f3a0528a1623",
1046
+ "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointOptionsDto": "acb07cc1e2c80d1721150691ea185eb3fa2f255a0833749973bf8175d85d9a32",
1047
+ "packages/domain/src/dto/automation/endpoint.sse.dto.ts#EndpointSseDto": "960d56ebb300ded00f61f1318522c010135675e0f32a8084fb3e9b16a1c20ecc",
1000
1048
  "packages/domain/src/dto/automation/job.template.request.dto.ts#JobTemplateRequestDto": "c47123206c187f0e16b08d7033ed9c455932f2e78e34455577663eb09410559d",
1001
1049
  "packages/domain/src/dto/automation/update.job.template.dto.ts#UpdateJobTemplate": "0f79fefc76e749a331b5c848b9dcd6061e7dc247c2094dd975d7d2fe9a101c08",
1002
1050
  "packages/domain/src/dto/automation/run.options.dto.ts#JobOptionsDto": "6e8f3f4b7aa6d8f38bc9227ced3158e4697031e68c78be9ea0e24e5af29e37d3",
@@ -1004,18 +1052,12 @@ export const requestContractSourceProvenance = {
1004
1052
  "packages/domain/src/dto/automation/run.options.dto.ts#RetryJobDto": "e42fcd447fe111bdf2da20ad42654e536a01d566f33a1d8f52ec1bb0bd1ee8b1",
1005
1053
  "packages/domain/src/dto/automation/runtime.execution.policy.dto.ts#RuntimeExecutionPolicyDto": "9978ee21a9b7da26c93a4e1516dfc319166a2b55520edee9319d17922b375474",
1006
1054
  "packages/domain/src/dto/automation/runtime.execution.policy.dto.ts#RuntimeJobExecutionPolicyDto": "d900a693362a9de02839e2ae959c4e8ac2ac8e0206a4cbe69e889a3636793d23",
1007
- "packages/domain/src/dto/components/update.component.dto.ts#UpdateComponentDto": "c0e39996b17c6d3cb46f4bda921dfe45e21e18ef6dbcd4ed55eb7ede82aeabe0",
1008
- "packages/domain/src/dto/components/component.element.dto.ts#ComponentElementsDto": "4aa2ccd5613c116213525b0c686060973f657e7b81bed7362d925958d829c527"
1009
- },
1010
- "studioOverlay": {
1011
- "packages/domain/src/dto/components/update.component.dto.ts": "afce9903cf51c6f6cb670b9c2be15e6e6a2c6d842b4155966c26c4f82106ee2a",
1012
- "packages/domain/src/dto/components/component.test-config.dto.ts": "7d52ad25cd536115d10024f11ce101c21d1070f7ddb2da49a014a53ca40c2b74",
1013
- "packages/domain/src/dto/components/component-element-key.const.ts": "270b1198d0538b1d0e3b74912185d016075e21900c04e7a79747f9b7199919f6",
1014
- "packages/domain/src/enum/component.element.type.enum.ts": "898f455e0512063de81bda9eeb9e9fb4f7719dc66de172a1d61caaac9baf6f66",
1015
- "packages/domain/src/dto/components/update.component.dto.ts#UpdateComponentDto": "f54a535edf919df5ff1d6e3653a8df9c54ff51eb766a131ccdf6592291b83146",
1055
+ "packages/domain/src/dto/components/update.component.dto.ts#UpdateComponentDto": "bac5c210c38eb230ae6ca2b42428956ea1c2065ffc947c40478152098a50e673",
1056
+ "packages/domain/src/dto/components/component.element.dto.ts#ComponentElementsDto": "4aa2ccd5613c116213525b0c686060973f657e7b81bed7362d925958d829c527",
1016
1057
  "packages/domain/src/dto/components/component.test-config.dto.ts#ComponentTestConfigDto": "bd160d9217d45584cd7ab29680edef807d8a56fa61283000e1a3db88b8d74d19",
1017
1058
  "apps/api/src/modules/components/component.service.ts#assertNativeTestConfiguration": "f2089642a94765e9f6168fcf39204c18a8585cdb377ada3ed98f53b2c21aae0c",
1018
1059
  "packages/domain/src/dto/components/component-element-key.const.ts#COMPONENT_ELEMENT_RESERVED_KEYS": "ef9367438b70f78facd959c66002f51e3b035b5b23594a7850d3d86bf75ea4e9",
1019
1060
  "packages/domain/src/dto/components/component-element-key.const.ts#COMPONENT_ELEMENT_JS_IDENTIFIER_PATTERN": "9d2b9a943361651239e3730e29cc11e0e204d46f3b8f03f69a6bef38c1754c7c"
1020
- }
1061
+ },
1062
+ "studioOverlay": {}
1021
1063
  };
package/dist/src/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { realpathSync } from 'node:fs';
2
2
  import { pathToFileURL } from 'node:url';
3
+ import { recordParsedOption, runtimeConnectionOverrides, validateCommandArguments } from "./argument-contract.js";
3
4
  import { RevoClient } from "./client.js";
4
5
  import { readComponentLock } from "./component-lock.js";
5
6
  import { getActiveEnvironmentName } from "./config.js";
@@ -34,7 +35,8 @@ export function parseArgs(argv) {
34
35
  const result = { _: [] };
35
36
  let stopOptions = false;
36
37
  const setValue = (key, value) => {
37
- const current = result[key];
38
+ recordParsedOption(result, key, value);
39
+ const current = Object.hasOwn(result, key) ? result[key] : undefined;
38
40
  if (current === undefined) {
39
41
  result[key] = value;
40
42
  return;
@@ -140,12 +142,7 @@ function printError(error) {
140
142
  process.stderr.write(`${danger('Error:')} ${message}\n`);
141
143
  }
142
144
  function resolveClient(args) {
143
- return new RevoClient({
144
- baseUrl: typeof args.url === 'string' ? args.url : typeof args.baseUrl === 'string' ? args.baseUrl : undefined,
145
- instance: typeof args.instance === 'string' ? args.instance : typeof args.i === 'string' ? args.i : undefined,
146
- token: typeof args.token === 'string' ? args.token : typeof args.t === 'string' ? args.t : undefined,
147
- envName: typeof args.env === 'string' ? args.env : undefined,
148
- });
145
+ return new RevoClient(runtimeConnectionOverrides(args));
149
146
  }
150
147
  function createContext(args) {
151
148
  if (args.project !== undefined && args.env !== undefined) {
@@ -197,18 +194,14 @@ async function runMain(args, argv) {
197
194
  });
198
195
  const command = args._[0];
199
196
  const noPositionals = args._.length === 0;
200
- if (command === 'version' || ((args.version !== undefined || args.V !== undefined) && noPositionals)) {
201
- print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true } } : packageVersion);
197
+ if (command === 'version' || ((args.version === true || args.V === true) && noPositionals)) {
198
+ print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true, syncOmit: true } } : packageVersion);
202
199
  return;
203
200
  }
204
201
  if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
205
202
  await handleInfoCommand(createContext(args));
206
203
  return;
207
204
  }
208
- if (command === 'help' || ((args.help !== undefined || args.h !== undefined) && noPositionals)) {
209
- printHelp();
210
- return;
211
- }
212
205
  const context = createContext(args);
213
206
  if (!command) {
214
207
  const view = await buildRuntimeViewModel(context);
@@ -328,6 +321,15 @@ export async function main(argv = process.argv.slice(2)) {
328
321
  }
329
322
  async function runCommandWithTrace(argv) {
330
323
  const args = parseArgs(argv);
324
+ validateCommandArguments(args, { allowHelp: true });
325
+ if (args._[0] === 'help' || args.help === true || args.help === 'true' || args.h === true || args.h === 'true') {
326
+ printHelp();
327
+ return;
328
+ }
329
+ if (args.help === false || args.help === 'false')
330
+ delete args.help;
331
+ if (args.h === false || args.h === 'false')
332
+ delete args.h;
331
333
  const trace = configuredHttpTrace(args);
332
334
  if (!trace) {
333
335
  await runMain(args, argv);
@@ -3,6 +3,29 @@ 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';
5
5
  import type { NativeTestCatalog, NativeTestRun, NativeTestRunInput } from './native-tests.ts';
6
+ export type DatabaseSchemaOperation = {
7
+ accepted: true;
8
+ jobId: string;
9
+ status: string;
10
+ };
11
+ export declare function isDatabaseSchemaOperation(value: unknown): value is DatabaseSchemaOperation;
12
+ export declare class DatabaseSchemaOperationWaitError extends Error {
13
+ readonly operation: DatabaseSchemaOperation;
14
+ constructor(operation: DatabaseSchemaOperation, cause: unknown);
15
+ }
16
+ export type DatabaseSchemaOperationStatus = {
17
+ jobId: string;
18
+ status: string;
19
+ operationStage?: string;
20
+ output?: {
21
+ databaseId?: string;
22
+ version?: number;
23
+ error?: {
24
+ code?: string;
25
+ message?: string;
26
+ };
27
+ };
28
+ };
6
29
  export type RequestOptions = {
7
30
  query?: Record<string, unknown>;
8
31
  body?: unknown;
@@ -370,6 +393,7 @@ export declare class RevoClient {
370
393
  private retryDelayMs;
371
394
  private requestQueue;
372
395
  private componentSyncManifestsSupported?;
396
+ private atomicResourceUpdatesValidation?;
373
397
  constructor(options?: ClientOptions);
374
398
  get authHeader(): string;
375
399
  get authValidationKey(): string;
@@ -385,6 +409,7 @@ export declare class RevoClient {
385
409
  fromCache: false;
386
410
  profile: unknown;
387
411
  }>;
412
+ private requireAtomicResourceUpdates;
388
413
  request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
389
414
  requestData<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
390
415
  me(options?: {
@@ -402,9 +427,16 @@ export declare class RevoClient {
402
427
  findActiveDatabaseSchemasByField(field: string, value: unknown, path?: Array<string | number>): Promise<DatabaseSchemaRecord[]>;
403
428
  getDatabaseSchemaStats(): Promise<DatabaseSchemaStatsRecord[]>;
404
429
  getDatabaseSchema(databaseId: string): Promise<DatabaseSchemaResponse>;
405
- createDatabaseSchema(body: DatabaseSchemaCreatePayload): Promise<DatabaseSchemaResponse>;
430
+ getDatabaseOperation(jobId: string): Promise<DatabaseSchemaOperationStatus>;
431
+ acceptDatabaseSchema(body: DatabaseSchemaCreatePayload | DatabaseSchemaUpdatePayload, databaseId?: string, idempotencyKey?: string): Promise<DatabaseSchemaOperation | DatabaseSchemaResponse>;
432
+ waitForDatabaseSchemaOperation(receipt: DatabaseSchemaOperation | DatabaseSchemaResponse): Promise<DatabaseSchemaResponse>;
433
+ createDatabaseSchema(body: DatabaseSchemaCreatePayload, options?: {
434
+ idempotencyKey?: string;
435
+ }): Promise<DatabaseSchemaResponse>;
406
436
  updateDatabaseSchemaMetadata(databaseId: string, body: DatabaseSchemaMetadataWritePayload): Promise<DatabaseSchemaResponse>;
407
- updateDatabaseSchema(databaseId: string, body: DatabaseSchemaUpdatePayload): Promise<DatabaseSchemaResponse>;
437
+ updateDatabaseSchema(databaseId: string, body: DatabaseSchemaUpdatePayload, options?: {
438
+ idempotencyKey?: string;
439
+ }): Promise<DatabaseSchemaResponse>;
408
440
  deleteDatabaseSchema(databaseId: string): Promise<unknown>;
409
441
  listAllDatabaseViews(): Promise<DatabaseViewRecord[]>;
410
442
  getDatabaseView(databaseViewId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<DatabaseViewRecord | {
@@ -1,9 +1,23 @@
1
+ import { randomUUID } from 'node:crypto';
1
2
  import { setTimeout as waitForDelay } from 'node:timers/promises';
2
3
  import { AUTH_VALIDATION_TTL_MS, buildAuthValidationKey, DEFAULT_BASE_URL, readAuthValidationState, resolveRuntimeConfig, saveAuthValidationState, } from "./config.js";
3
4
  import { beginHttpTraceRequest, completeHttpTraceRequest, responseSize, } from "./http-trace.js";
4
5
  import { currentRequestQueue, RequestQueue } from "./request-queue.js";
5
6
  import { createSpinner } from "./spinner.js";
7
+ import { currentSyncOmitPolicy } from "./sync-omit.js";
6
8
  import { mapWithConcurrency } from "./utils.js";
9
+ export function isDatabaseSchemaOperation(value) {
10
+ return Boolean(value && typeof value === 'object' && value.accepted === true
11
+ && typeof value.jobId === 'string' && typeof value.status === 'string');
12
+ }
13
+ export class DatabaseSchemaOperationWaitError extends Error {
14
+ operation;
15
+ constructor(operation, cause) {
16
+ super(`Schema operation ${operation.jobId} was accepted; status/readback is unavailable: ${cause instanceof Error ? cause.message : String(cause)}`);
17
+ this.name = 'DatabaseSchemaOperationWaitError';
18
+ this.operation = operation;
19
+ }
20
+ }
7
21
  export class ApiError extends Error {
8
22
  status;
9
23
  data;
@@ -412,6 +426,7 @@ export class RevoClient {
412
426
  retryDelayMs;
413
427
  requestQueue;
414
428
  componentSyncManifestsSupported;
429
+ atomicResourceUpdatesValidation;
415
430
  constructor(options = {}) {
416
431
  const config = resolveRuntimeConfig(options);
417
432
  this.baseUrl = config.baseUrl;
@@ -489,8 +504,28 @@ export class RevoClient {
489
504
  throw error;
490
505
  }
491
506
  }
507
+ requireAtomicResourceUpdates() {
508
+ const key = this.authValidationKey;
509
+ if (this.atomicResourceUpdatesValidation?.key === key)
510
+ return this.atomicResourceUpdatesValidation.promise;
511
+ const validation = { key, promise: Promise.resolve() };
512
+ this.atomicResourceUpdatesValidation = validation;
513
+ // A stored auth profile can predate the API rollout. Always fetch the
514
+ // capability from this client's current target once before omitted writes.
515
+ validation.promise = this.validateSession({ force: true }).then(({ profile }) => {
516
+ validation.key = this.authValidationKey;
517
+ const value = isRecord(profile) && isRecord(profile.data) ? profile.data : profile;
518
+ if (!isRecord(value) || !isRecord(value.capabilities) || value.capabilities.atomicResourceUpdates !== true) {
519
+ throw new Error('The target API does not support atomic resource updates required by --omit. Upgrade the RevoEngine API before retrying.');
520
+ }
521
+ });
522
+ return validation.promise;
523
+ }
492
524
  async request(method, path, options = {}) {
493
525
  this.assertReady();
526
+ if (currentSyncOmitPolicy().rules.length && !['GET', 'HEAD', 'OPTIONS'].includes(method.toUpperCase()) && path !== '/api/v1/me') {
527
+ await this.requireAtomicResourceUpdates();
528
+ }
494
529
  if (options.authGuard !== false && path !== '/api/v1/me') {
495
530
  await this.validateSession();
496
531
  }
@@ -814,23 +849,51 @@ export class RevoClient {
814
849
  async getDatabaseSchema(databaseId) {
815
850
  return this.requestData('GET', `/api/v1/databases/${encodeURIComponent(databaseId)}`);
816
851
  }
817
- async createDatabaseSchema(body) {
818
- return this.requestData('POST', '/api/v1/databases', {
819
- body,
820
- spinnerLabel: 'Creating database schema',
852
+ async getDatabaseOperation(jobId) {
853
+ return this.requestData('GET', `/api/v1/databases/operations/${encodeURIComponent(jobId)}`);
854
+ }
855
+ async acceptDatabaseSchema(body, databaseId, idempotencyKey = randomUUID()) {
856
+ // All transport retries reuse the exact request, base version and admission identity.
857
+ return this.requestData(databaseId ? 'PUT' : 'POST', `/api/v1/databases${databaseId ? `/${encodeURIComponent(databaseId)}` : ''}`, {
858
+ body, query: { async: true }, headers: { 'Idempotency-Key': idempotencyKey },
859
+ maxRetries: 2, spinnerLabel: 'Submitting database schema operation',
821
860
  });
822
861
  }
862
+ async waitForDatabaseSchemaOperation(receipt) {
863
+ if (!isDatabaseSchemaOperation(receipt))
864
+ return receipt;
865
+ for (;;) {
866
+ let operation;
867
+ try {
868
+ operation = await this.getDatabaseOperation(receipt.jobId);
869
+ }
870
+ catch (error) {
871
+ throw new DatabaseSchemaOperationWaitError(receipt, error);
872
+ }
873
+ if (operation.status === 'FINISHED') {
874
+ if (!operation.output?.databaseId)
875
+ throw new Error(`Schema operation ${receipt.jobId} completed without a database identity.`);
876
+ try {
877
+ return await this.getDatabaseSchema(operation.output.databaseId);
878
+ }
879
+ catch (error) {
880
+ throw new DatabaseSchemaOperationWaitError({ ...receipt, status: 'FINISHED' }, error);
881
+ }
882
+ }
883
+ if (['ERROR', 'CANCELLED', 'ACTION_REQUIRED'].includes(operation.status)) {
884
+ throw new Error(`Schema operation ${receipt.jobId} ${operation.status}: ${operation.output?.error?.message ?? 'schema was not published'}`);
885
+ }
886
+ await waitForDelay(1000);
887
+ }
888
+ }
889
+ async createDatabaseSchema(body, options = {}) {
890
+ return this.waitForDatabaseSchemaOperation(await this.acceptDatabaseSchema(body, undefined, options.idempotencyKey));
891
+ }
823
892
  async updateDatabaseSchemaMetadata(databaseId, body) {
824
- return this.requestData('PUT', `/api/v1/databases/${encodeURIComponent(databaseId)}`, {
825
- body,
826
- spinnerLabel: 'Updating database schema metadata',
827
- });
893
+ return this.updateDatabaseSchema(databaseId, body);
828
894
  }
829
- async updateDatabaseSchema(databaseId, body) {
830
- return this.requestData('PUT', `/api/v1/databases/${encodeURIComponent(databaseId)}`, {
831
- body,
832
- spinnerLabel: 'Updating database schema',
833
- });
895
+ async updateDatabaseSchema(databaseId, body, options = {}) {
896
+ return this.waitForDatabaseSchemaOperation(await this.acceptDatabaseSchema(body, databaseId, options.idempotencyKey));
834
897
  }
835
898
  async deleteDatabaseSchema(databaseId) {
836
899
  return this.requestData('DELETE', `/api/v1/databases/${encodeURIComponent(databaseId)}`, {
@@ -1,10 +1,11 @@
1
+ import { withCommandSyncOmit } from "../sync-omit-command.js";
1
2
  import { resolveResourceTarget } from "../resource-target.js";
2
3
  import { readProjectStableKeyName } from "../project.js";
3
4
  import { buildAgentsPlan, pullAgentsToWorkspace, pushAgents } from "../resource-syncs/agent-sync.js";
4
5
  import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
5
6
  import { printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
6
7
  import { readBoolFlag } from "../utils.js";
7
- export async function handleAgentsCommand(context) {
8
+ async function executeAgentsCommand(context) {
8
9
  const family = context.args._[0] === 'agent-plugins' ? 'agent-plugin' : 'agent';
9
10
  const command = context.args._[1];
10
11
  if (!['pull', 'plan', 'push'].includes(command))
@@ -54,3 +55,6 @@ export async function handleAgentsCommand(context) {
54
55
  if (result.results.some(item => item.status === 'failed'))
55
56
  throw new Error(`${family} push failed; inspect results.`);
56
57
  }
58
+ export async function handleAgentsCommand(context) {
59
+ return withCommandSyncOmit(context, [context.args._[0] === 'agent-plugins' ? 'agent-plugin' : 'agent'], scoped => executeAgentsCommand(scoped));
60
+ }
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { validateCommandArguments } from "../argument-contract.js";
2
3
  import { clearAuthValidationState, clearStoredConfig, getConfigDir, loadStoredConfig, resolveRuntimeConfig, saveStoredConfig, } from "../config.js";
3
4
  import { readLegacyImportFromFile } from "../legacy.js";
4
5
  import { promptSecret } from "../prompt.js";
@@ -26,6 +27,7 @@ async function promptMissingConfig(runtime) {
26
27
  };
27
28
  }
28
29
  export async function handleAuthCommand(context) {
30
+ validateCommandArguments(context.args);
29
31
  const { args, client, print, println, error } = context;
30
32
  const subcommand = args._[1] || 'login';
31
33
  if (subcommand === 'logout') {
@@ -1,3 +1,5 @@
1
+ import { withCommandSyncOmit } from "../sync-omit-command.js";
2
+ import { preserveOmittedProperties, syncBaselineHash, syncSourceBaselineHash, withoutSyncOmit, assertOmittedPropertiesPreserved, omitPaths } from "../sync-omit.js";
1
3
  import { hydrateComponentManifest, listComponentManifests } from "../component-manifests.js";
2
4
  import { verifyComponentRuntime } from "../component-contract.js";
3
5
  import { changeComponentActivation } from "../component-lifecycle.js";
@@ -583,19 +585,23 @@ function migrateComponentLockIdentity(cwd, identity, localCatalog, remoteCatalog
583
585
  if (!legacy || !remoteComponentId) {
584
586
  continue;
585
587
  }
586
- const remoteLegacyHash = hashComponentSource(remote.component);
587
- const localLegacyHash = local ? hashComponentSource(local.component) : null;
588
+ const remoteLegacyHash = withoutSyncOmit(() => hashComponentSource(remote.component));
589
+ const localLegacyHash = local ? withoutSyncOmit(() => hashComponentSource(local.component)) : null;
588
590
  let portableBaselineHash = null;
591
+ let sourceBaselineComponent;
589
592
  if (legacy.remoteHash === remoteLegacyHash) {
590
593
  portableBaselineHash = remote.hash;
594
+ sourceBaselineComponent = remote.component;
591
595
  }
592
596
  else if (local && legacy.remoteHash === localLegacyHash) {
593
597
  portableBaselineHash = local.hash;
598
+ sourceBaselineComponent = local.component;
594
599
  }
595
- else if (local && local.hash === remote.hash) {
600
+ else if (local && withoutSyncOmit(() => componentSourceHash(local.component, identity)) === withoutSyncOmit(() => componentSourceHash(remote.component, identity))) {
596
601
  portableBaselineHash = remote.hash;
602
+ sourceBaselineComponent = remote.component;
597
603
  }
598
- if (!portableBaselineHash) {
604
+ if (!portableBaselineHash || !sourceBaselineComponent) {
599
605
  continue;
600
606
  }
601
607
  migratedComponents[stableKey] = {
@@ -611,12 +617,13 @@ function migrateComponentLockIdentity(cwd, identity, localCatalog, remoteCatalog
611
617
  : legacy.path || componentTargetPath(cwd, remote.component),
612
618
  remoteVersion: legacy.remoteVersion,
613
619
  remoteHash: portableBaselineHash,
614
- sourceHash: local?.hash || portableBaselineHash,
620
+ sourceHash: withoutSyncOmit(() => componentSourceHash(sourceBaselineComponent, identity)),
615
621
  pulledAt: legacy.pulledAt,
616
622
  };
617
623
  }
618
624
  }
619
625
  const migrated = {
626
+ ...lock,
620
627
  schemaVersion: 2,
621
628
  componentIdentity: identity,
622
629
  components: migratedComponents,
@@ -685,7 +692,7 @@ function upsertLockFromRemote(context, remote, targetPath, local, environmentNam
685
692
  path: targetPath || componentTargetPath(cwd, local || remote),
686
693
  remoteVersion: componentVersion(remote),
687
694
  remoteHash,
688
- sourceHash: local ? componentSourceHash(local, identity) : remoteHash,
695
+ sourceHash: withoutSyncOmit(() => componentSourceHash(local || remote, identity)),
689
696
  pulledAt: new Date().toISOString(),
690
697
  }, identity, environmentName);
691
698
  }
@@ -730,21 +737,23 @@ function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalo
730
737
  reason: 'missing lock',
731
738
  };
732
739
  }
733
- if (localHash === lockEntry.remoteHash && remoteHash !== lockEntry.remoteHash) {
740
+ const sourceBaseline = syncSourceBaselineHash('component', lockEntry);
741
+ const remoteBaseline = syncBaselineHash('component', lockEntry);
742
+ if (localHash === sourceBaseline) {
734
743
  return {
735
744
  kind: 'pull',
736
745
  ...base,
737
746
  reason: 'remote changed',
738
747
  };
739
748
  }
740
- if (localHash !== lockEntry.remoteHash && remoteHash === lockEntry.remoteHash) {
749
+ if (remoteHash === remoteBaseline) {
741
750
  return {
742
751
  kind: 'skip',
743
752
  ...base,
744
753
  reason: 'local changes',
745
754
  };
746
755
  }
747
- if (localHash !== lockEntry.remoteHash && remoteHash !== lockEntry.remoteHash && localHash !== remoteHash) {
756
+ if (localHash !== remoteHash) {
748
757
  return {
749
758
  kind: 'skip',
750
759
  ...base,
@@ -948,9 +957,10 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
948
957
  }
949
958
  }
950
959
  const root = getWorkspaceRoot(cwd);
960
+ const effectiveComponent = preserveOmittedProperties('component', component, decision.localComponent);
951
961
  const folder = decision.manifestPath
952
962
  ? path.dirname(decision.manifestPath)
953
- : path.join(root, getComponentFolder(component));
963
+ : path.join(root, getComponentFolder(effectiveComponent));
954
964
  const targetPath = path.relative(cwd, folder);
955
965
  const populate = (directory) => {
956
966
  const elementsDir = path.join(directory, 'elements');
@@ -961,7 +971,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
961
971
  const filePath = path.join(elementsDir, `${element.order}_${element.key}.${extension}`);
962
972
  fs.writeFileSync(filePath, content);
963
973
  }
964
- writeJsonFile(path.join(directory, 'component.json'), buildPulledManifest(component, decision.localComponent, identity));
974
+ writeJsonFile(path.join(directory, 'component.json'), buildPulledManifest(effectiveComponent, decision.localComponent, identity));
965
975
  };
966
976
  if (mode.force) {
967
977
  replaceWorkspaceResourceDirectory(root, folder, populate);
@@ -1205,7 +1215,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1205
1215
  }
1206
1216
  await client.saveComponentElements(createdComponentId, buildPushElements(component, { elements: [] }, identity));
1207
1217
  const refreshedRemote = unwrapComponent(await client.getComponent(createdComponentId));
1208
- if (componentSourceHash(refreshedRemote, identity) !== componentSourceHash(component, identity)) {
1218
+ if (withoutSyncOmit(() => componentSourceHash(refreshedRemote, identity)) !== withoutSyncOmit(() => componentSourceHash(component, identity))) {
1209
1219
  const logPath = writeComponentPushVerificationLog({
1210
1220
  cwd: context.cwd,
1211
1221
  targetPath,
@@ -1272,7 +1282,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1272
1282
  }
1273
1283
  const remoteHash = componentSourceHash(remote, identity);
1274
1284
  const localHash = componentSourceHash(component, identity);
1275
- if (remoteHash !== lockEntry.remoteHash) {
1285
+ if (remoteHash !== syncBaselineHash('component', lockEntry)) {
1276
1286
  if (localHash === remoteHash) {
1277
1287
  upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
1278
1288
  const result = {
@@ -1290,7 +1300,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1290
1300
  }
1291
1301
  throw new Error(`Cannot push ${targetPath}: remote changed since the last lock baseline. Run \`revo component plan --all\` and pull/reconcile first.`);
1292
1302
  }
1293
- if (localHash === lockEntry.remoteHash) {
1303
+ if (localHash === syncBaselineHash('component', lockEntry)) {
1294
1304
  const result = {
1295
1305
  status: 'skipped',
1296
1306
  targetPath,
@@ -1437,6 +1447,8 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1437
1447
  });
1438
1448
  throw new Error(`Cannot push ${targetPath}: updated component did not verify against local source. Diagnostic: ${logPath}`);
1439
1449
  }
1450
+ if (hasLiveRemote && omitPaths('component').length)
1451
+ assertOmittedPropertiesPreserved('component', normalizePortableComponentSource(remote), normalizePortableComponentSource(refreshedRemote));
1440
1452
  await verifyComponentRuntime(client, refreshedRemote, 120_000);
1441
1453
  upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
1442
1454
  if (!configurationChanged && !elementsChanged) {
@@ -1648,8 +1660,10 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
1648
1660
  ...Object.keys(lockEntries),
1649
1661
  ])].sort();
1650
1662
  const items = allIdentityKeys.map((identityKey) => {
1651
- const local = localCatalog.byIdentity.get(identityKey) || null;
1663
+ let local = localCatalog.byIdentity.get(identityKey) || null;
1652
1664
  const remote = remoteCatalog.byIdentity.get(identityKey) || null;
1665
+ if (local && remote)
1666
+ local = { ...local, component: preserveOmittedProperties('component', local.component, remote.component) };
1653
1667
  const lockEntry = lockEntries[identityKey] || null;
1654
1668
  const component = local?.component || remote?.component;
1655
1669
  const localComponentId = local ? componentIdOf(local.component) : '';
@@ -1665,7 +1679,7 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
1665
1679
  : lockEntry?.path || identityKey;
1666
1680
  const localHash = local?.hash || null;
1667
1681
  const remoteHash = remote?.hash || null;
1668
- const lockHash = lockEntry?.remoteHash || null;
1682
+ const lockHash = syncBaselineHash('component', lockEntry || undefined) || null;
1669
1683
  const changedFields = local && remote
1670
1684
  ? diffPortableComponentSource(local.component, remote.component).changedFields
1671
1685
  : [];
@@ -2148,7 +2162,7 @@ async function debugSingleComponent(context, componentId) {
2148
2162
  writeDebugOutputFile(context.cwd, response);
2149
2163
  context.print(extractResultPayload(response));
2150
2164
  }
2151
- export async function handleComponentCommand(context) {
2165
+ async function executeComponentCommand(context) {
2152
2166
  const { args } = context;
2153
2167
  const subcommand = args._[1] || '';
2154
2168
  const targets = parseTargets(args, ['id', 'i']);
@@ -2261,3 +2275,6 @@ export async function handleComponentCommand(context) {
2261
2275
  }
2262
2276
  throw new Error('Unknown component command.');
2263
2277
  }
2278
+ export async function handleComponentCommand(context) {
2279
+ return withCommandSyncOmit(context, ['component'], scoped => executeComponentCommand(scoped));
2280
+ }