@revoengine/cli 2.1.1 → 2.2.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 (64) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +111 -12
  3. package/dist/src/application-access.d.ts +4 -0
  4. package/dist/src/application-access.js +18 -0
  5. package/dist/src/application-cors.d.ts +2 -0
  6. package/dist/src/application-cors.js +19 -0
  7. package/dist/src/argument-contract.js +24 -4
  8. package/dist/src/automation-contract.generated.d.ts +165 -6
  9. package/dist/src/automation-contract.generated.js +198 -6
  10. package/dist/src/cli.js +10 -2
  11. package/dist/src/client.d.ts +53 -1
  12. package/dist/src/client.js +84 -0
  13. package/dist/src/commands/applications.d.ts +2 -0
  14. package/dist/src/commands/applications.js +44 -0
  15. package/dist/src/commands/emulate.d.ts +1 -0
  16. package/dist/src/commands/emulate.js +79 -3
  17. package/dist/src/commands/index.d.ts +2 -0
  18. package/dist/src/commands/index.js +2 -0
  19. package/dist/src/commands/migrate.js +10 -2
  20. package/dist/src/commands/sites.d.ts +2 -0
  21. package/dist/src/commands/sites.js +156 -0
  22. package/dist/src/component-lock.d.ts +2 -1
  23. package/dist/src/component-lock.js +22 -1
  24. package/dist/src/endpoint-application.d.ts +25 -0
  25. package/dist/src/endpoint-application.js +75 -0
  26. package/dist/src/endpoint-emulator.d.ts +5 -0
  27. package/dist/src/endpoint-emulator.js +29 -0
  28. package/dist/src/endpoint-storage-transports.d.ts +2 -0
  29. package/dist/src/endpoint-storage-transports.js +8 -0
  30. package/dist/src/metadata-backfill.d.ts +1 -1
  31. package/dist/src/metadata-backfill.js +10 -1
  32. package/dist/src/migration.d.ts +6 -2
  33. package/dist/src/migration.js +104 -41
  34. package/dist/src/project.d.ts +8 -1
  35. package/dist/src/project.js +4 -0
  36. package/dist/src/request-contract.d.ts +5 -0
  37. package/dist/src/request-contract.js +12 -0
  38. package/dist/src/resource-inventory.d.ts +4 -2
  39. package/dist/src/resource-inventory.js +16 -1
  40. package/dist/src/resource-syncs/account-principal.d.ts +2 -0
  41. package/dist/src/resource-syncs/account-principal.js +3 -0
  42. package/dist/src/resource-syncs/application-principals.d.ts +60 -0
  43. package/dist/src/resource-syncs/application-principals.js +151 -0
  44. package/dist/src/resource-syncs/application-sync.d.ts +110 -0
  45. package/dist/src/resource-syncs/application-sync.js +328 -0
  46. package/dist/src/resource-syncs/endpoint-sync.d.ts +38 -0
  47. package/dist/src/resource-syncs/endpoint-sync.js +278 -14
  48. package/dist/src/resource-syncs/group-sync.d.ts +12 -0
  49. package/dist/src/resource-syncs/group-sync.js +60 -6
  50. package/dist/src/resource-syncs/runtime-definition-validation.js +26 -1
  51. package/dist/src/resource-syncs/service-account-sync.d.ts +10 -0
  52. package/dist/src/resource-syncs/service-account-sync.js +32 -4
  53. package/dist/src/reviewed-plan.js +2 -2
  54. package/dist/src/sync-omit-write-fence.js +4 -1
  55. package/dist/src/sync-omit.d.ts +1 -1
  56. package/dist/src/sync-omit.js +7 -2
  57. package/dist/src/tracked-resources.d.ts +1 -1
  58. package/dist/src/tracked-resources.js +3 -2
  59. package/dist/src/types.d.ts +30 -0
  60. package/dist/src/ui.js +2 -0
  61. package/dist/src/workspace-diff.js +1 -0
  62. package/dist/src/workspace-digests.js +2 -0
  63. package/dist/src/workspace-prune.js +67 -9
  64. package/package.json +2 -2
@@ -26,9 +26,103 @@ export const normalizeCustomNodeElementPath = (value) => {
26
26
  return normalized;
27
27
  };
28
28
  export const requestContracts = {
29
+ "CreateEndpointServiceDto": {
30
+ "type": "object",
31
+ "properties": {
32
+ "invocationPolicy": {
33
+ "nullable": true,
34
+ "applicationInvocationPolicy": true
35
+ },
36
+ "anonymousAccess": {
37
+ "nullable": true,
38
+ "applicationAnonymousAccess": true
39
+ },
40
+ "key": {
41
+ "type": "string",
42
+ "pattern": "^(?=.{1,63}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?![\\s\\S])",
43
+ "patternFlags": "",
44
+ "notEnum": [
45
+ "default"
46
+ ],
47
+ "maxLength": 63
48
+ },
49
+ "name": {
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "maxLength": 100
53
+ },
54
+ "description": {
55
+ "nullable": true,
56
+ "type": "string",
57
+ "maxLength": 2000
58
+ },
59
+ "cors": {
60
+ "applicationCors": true
61
+ }
62
+ },
63
+ "required": [
64
+ "key",
65
+ "name"
66
+ ],
67
+ "additionalProperties": false
68
+ },
69
+ "UpdateEndpointServiceDto": {
70
+ "type": "object",
71
+ "properties": {
72
+ "invocationPolicy": {
73
+ "nullable": true,
74
+ "applicationInvocationPolicy": true
75
+ },
76
+ "anonymousAccess": {
77
+ "nullable": true,
78
+ "applicationAnonymousAccess": true
79
+ },
80
+ "version": {
81
+ "type": "integer",
82
+ "minimum": 0
83
+ },
84
+ "name": {
85
+ "type": "string",
86
+ "minLength": 1,
87
+ "maxLength": 100
88
+ },
89
+ "description": {
90
+ "nullable": true,
91
+ "type": "string",
92
+ "maxLength": 2000
93
+ },
94
+ "cors": {
95
+ "applicationCors": true
96
+ }
97
+ },
98
+ "required": [
99
+ "version"
100
+ ],
101
+ "additionalProperties": false
102
+ },
103
+ "EndpointApplicationCorsDto": {
104
+ "type": "object",
105
+ "properties": {
106
+ "mode": {},
107
+ "allowedOrigins": {}
108
+ },
109
+ "required": [
110
+ "mode",
111
+ "allowedOrigins"
112
+ ],
113
+ "additionalProperties": false
114
+ },
29
115
  "EndpointRequestDto": {
30
116
  "type": "object",
31
117
  "properties": {
118
+ "allowUnauthenticated": {
119
+ "type": "boolean"
120
+ },
121
+ "serviceId": {
122
+ "nullable": true,
123
+ "type": "string",
124
+ "format": "uuid"
125
+ },
32
126
  "executionPolicy": {
33
127
  "allOf": [
34
128
  {
@@ -113,6 +207,14 @@ export const requestContracts = {
113
207
  "UpdateEndpointRequestDto": {
114
208
  "type": "object",
115
209
  "properties": {
210
+ "allowUnauthenticated": {
211
+ "type": "boolean"
212
+ },
213
+ "serviceId": {
214
+ "nullable": true,
215
+ "type": "string",
216
+ "format": "uuid"
217
+ },
116
218
  "executionPolicy": {
117
219
  "allOf": [
118
220
  {
@@ -211,6 +313,22 @@ export const requestContracts = {
211
313
  "type": "integer",
212
314
  "maximum": 1024
213
315
  },
316
+ "requestBody": {
317
+ "allOf": [
318
+ {
319
+ "$ref": "#/components/schemas/EndpointRequestBodyDto"
320
+ }
321
+ ],
322
+ "nullable": true
323
+ },
324
+ "responseBody": {
325
+ "allOf": [
326
+ {
327
+ "$ref": "#/components/schemas/EndpointResponseBodyDto"
328
+ }
329
+ ],
330
+ "nullable": true
331
+ },
214
332
  "responseMode": {
215
333
  "nullable": true,
216
334
  "enum": [
@@ -808,6 +926,66 @@ export const requestContracts = {
808
926
  ],
809
927
  "additionalProperties": false
810
928
  },
929
+ "EndpointRequestBodyDto": {
930
+ "type": "object",
931
+ "properties": {
932
+ "mode": {
933
+ "enum": [
934
+ "json",
935
+ "form",
936
+ "text",
937
+ "xml",
938
+ "binary",
939
+ "multipart",
940
+ "raw",
941
+ "storage"
942
+ ]
943
+ },
944
+ "maxBytes": {
945
+ "nullable": true,
946
+ "type": "integer",
947
+ "minimum": 1,
948
+ "maximum": 33554432
949
+ }
950
+ },
951
+ "required": [
952
+ "mode"
953
+ ],
954
+ "additionalProperties": false
955
+ },
956
+ "EndpointResponseBodyDto": {
957
+ "type": "object",
958
+ "properties": {
959
+ "mode": {
960
+ "enum": [
961
+ "json",
962
+ "text",
963
+ "xml",
964
+ "binary",
965
+ "storage"
966
+ ]
967
+ },
968
+ "contentType": {
969
+ "nullable": true,
970
+ "type": "string",
971
+ "maxLength": 256
972
+ },
973
+ "headers": {
974
+ "nullable": true,
975
+ "type": "object"
976
+ },
977
+ "maxBytes": {
978
+ "nullable": true,
979
+ "type": "integer",
980
+ "minimum": 1,
981
+ "maximum": 33554432
982
+ }
983
+ },
984
+ "required": [
985
+ "mode"
986
+ ],
987
+ "additionalProperties": false
988
+ },
811
989
  "ComponentTestConfigDto": {
812
990
  "type": "object",
813
991
  "properties": {
@@ -1078,6 +1256,10 @@ export const requestContractDefaults = {
1078
1256
  "maxDepth": 64
1079
1257
  },
1080
1258
  "endpoint": {
1259
+ "requestBody": {
1260
+ "maxBytes": 33554432,
1261
+ "inlineMaxBytes": 8388608
1262
+ },
1081
1263
  "maxPathSegments": 7,
1082
1264
  "optionDefaults": {
1083
1265
  "input": {},
@@ -1089,6 +1271,7 @@ export const requestContractDefaults = {
1089
1271
  }
1090
1272
  };
1091
1273
  export const requestContractSemanticSources = {
1274
+ "packages/domain/src/interfaces/application-invocation-policy.interface.ts#completePolicy": "dc5a73d6a37abbeaf00f733044e3bc5768ac2fe66e91b6d8479e0ecbf2efc04d",
1092
1275
  "packages/domain/src/utils/backend-metadata.util.ts#assertJsonValue": "e3856d26eb4c43aae24e033691f677f700d6d4f7793dd2be79ce89b8a60ad067",
1093
1276
  "packages/domain/src/dto/automation/run.options.dto.ts#JobRetryMinBackoffWithinMaxConstraint": "2c8eb4f844ffabfd03f5ae9617a2b0e9e578fa0b9d2a563081648b6688629439",
1094
1277
  "packages/execution-core/src/modules/@core/services/virtualization.service.ts#normalizeIsolateMemoryLimit": "4cce767b32d7b848cea9502eec5d3df2b7a7dc3e41227eeffda1a6a1e8fc9d96",
@@ -1097,9 +1280,13 @@ export const requestContractSemanticSources = {
1097
1280
  "packages/platform-shared/src/utils/job-retry-policy.util.ts#normalizeJobRetryPolicy": "facef84884b5b4311af06bfb4469f071ff42a4bca067b6d9092d4f6571e8ee86",
1098
1281
  "packages/platform-shared/src/utils/job-retry-policy.util.ts#assertJobRetryPolicyValid": "6511ccafc15233a4ffe4e024f13e6c0e5c9d8a53c261ecc571300495afd804cf",
1099
1282
  "packages/domain/src/dto/components/component.validator.ts#validateEndpointGuardSemantics": "fd885b48c2990e47d1f05965af044aef8e2256da5fa4a86d1248967b04a3fd1e",
1100
- "apps/api/src/modules/endpoints/endpoint.service.ts#create": "cb10fc198892423088d396acd09618d8c64504a57fac0df3a892d57993913067",
1101
- "apps/api/src/modules/endpoints/endpoint.service.ts#update": "bc59acaffdb7275659bddb65b8d71e9d8266447054723ea87495eaa0dd512fe1",
1102
- "apps/api/src/modules/endpoints/endpoint.service.ts#validateEndpointOptions": "64686ee1c1e2611aa00847b771de637797a3007062b95e303046ad2cba69e729",
1283
+ "packages/domain/src/interfaces/endpoint-application-cors.interface.ts#isEndpointApplicationOrigin": "eb84b57e431702e454328e55ea3b0c7a133c874f835e276d1cfc1bd6e7863f95",
1284
+ "packages/domain/src/interfaces/endpoint-application-cors.interface.ts#isEndpointApplicationCors": "e204d8b2d6f43d114451657699fc8299d2cc1e02a0aa6d808bcd860d3a38c989",
1285
+ "packages/domain/src/interfaces/application-invocation-policy.interface.ts#isApplicationInvocationPolicy": "5436748c8323a9b7e17e79e49b12335836f085f2ad64798ef633c32e4e665867",
1286
+ "packages/domain/src/interfaces/application-invocation-policy.interface.ts#isApplicationAnonymousAccess": "123b56d08ffe2f739d758dff76a4c649dc8be70b2c9d570dc5fef817f3c40248",
1287
+ "apps/api/src/modules/endpoints/endpoint.service.ts#create": "8e19c9775b30f19af20b5b8082198af45d495993d9d4b4b131f5cd9da8fbcc42",
1288
+ "apps/api/src/modules/endpoints/endpoint.service.ts#update": "23d45b6a276ba06ba7db99e183f76fce5cdfe5ae70f51cebfa9bb09d8a77ed7f",
1289
+ "apps/api/src/modules/endpoints/endpoint.service.ts#validateEndpointOptions": "b729c5539813e2a6e239bfba180bf5d2c45f9ff49087e79cbf6c7af73e8b6d3b",
1103
1290
  "apps/api/src/modules/endpoints/endpoint.service.ts#applyEndpointOptionDefaults": "9da1bdfd83a3142b7f44d4ce5ee2aac6cf4ed70bef790f979c412c411fe2790d",
1104
1291
  "apps/api/src/modules/automation/jobs.service.ts#createJobTemplate": "59a8433530980f3970c5915f696611f14820c10183b0f917a74912245f1cbd78",
1105
1292
  "apps/api/src/modules/automation/jobs.service.ts#update": "d8b3ccef6ae812e8bcdcd21cf5184c2afe9ede28055f355f684e13a64b094933",
@@ -1114,9 +1301,12 @@ export const requestContractSemanticSources = {
1114
1301
  };
1115
1302
  export const requestContractSourceProvenance = {
1116
1303
  "main": {
1117
- "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointRequestDto": "45a1a84e200b2cdf9b44051fe36cb7bda1b577a0f5bbcc88942764336a6d7302",
1118
- "packages/domain/src/dto/automation/update.api.template.request.dto.ts#UpdateEndpointRequestDto": "20ee0c9afbfa594f189ead2b751aa00b6003efe0b70c5e1158ee78c1e0d29567",
1119
- "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointOptionsDto": "1ade11735627613a81b5cfaa796dfdc49d4c7e0db01ae6467da6a99a9f3af683",
1304
+ "packages/domain/src/dto/automation/endpoint-service.dto.ts#CreateEndpointServiceDto": "b6a4a1f3f92d8323e75f68cf87160243d483b4a8bd90c382b10979eedaf05ef5",
1305
+ "packages/domain/src/dto/automation/endpoint-service.dto.ts#UpdateEndpointServiceDto": "068377dc274764b07eba1ba7b1d07ee488f2349a39541579a7bd5309fe790900",
1306
+ "packages/domain/src/dto/automation/endpoint-service.dto.ts#EndpointApplicationCorsDto": "d9c645987e746a6334b885d5d8d809b4c653cae9f0aea0f73d1b768ac2dc5af6",
1307
+ "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointRequestDto": "d8884bdad6b2cb37c2ee144d56388f36c5fbb843f0d779fd9f5808e113463aa7",
1308
+ "packages/domain/src/dto/automation/update.api.template.request.dto.ts#UpdateEndpointRequestDto": "ff8296066eb9d40a144b0b4e63aef70a7e28a7b999032e701446c0ca67544d03",
1309
+ "packages/domain/src/dto/automation/endpoint.template.request.dto.ts#EndpointOptionsDto": "0e4e3079e7966bb4611c67f230a5e841fd50036f3b68bcb6dfd679690a32fd8d",
1120
1310
  "packages/domain/src/dto/automation/endpoint.sse.dto.ts#EndpointSseDto": "960d56ebb300ded00f61f1318522c010135675e0f32a8084fb3e9b16a1c20ecc",
1121
1311
  "packages/domain/src/dto/automation/job.template.request.dto.ts#JobTemplateRequestDto": "fcbcfa8fd7b600dabe25d9d1e36414db1894bff89980a106b2cc7fbc7feb94d8",
1122
1312
  "packages/domain/src/dto/automation/update.job.template.dto.ts#UpdateJobTemplate": "bb83065b8ae816cc917ec73abc83af6749bc5fdc00e460b889c41cd34443123e",
@@ -1129,6 +1319,8 @@ export const requestContractSourceProvenance = {
1129
1319
  "packages/domain/src/dto/automation/runtime.execution.policy.dto.ts#RuntimeJobExecutionPolicyDto": "d900a693362a9de02839e2ae959c4e8ac2ac8e0206a4cbe69e889a3636793d23",
1130
1320
  "packages/domain/src/dto/components/update.component.dto.ts#UpdateComponentDto": "bac5c210c38eb230ae6ca2b42428956ea1c2065ffc947c40478152098a50e673",
1131
1321
  "packages/domain/src/dto/components/component.element.dto.ts#ComponentElementsDto": "4aa2ccd5613c116213525b0c686060973f657e7b81bed7362d925958d829c527",
1322
+ "packages/domain/src/dto/automation/endpoint.request-body.dto.ts#EndpointRequestBodyDto": "8dd7d90bb5bee398fb750844f08229863d90b027f974747ce9422880abebc8d4",
1323
+ "packages/domain/src/dto/automation/endpoint.response-body.dto.ts#EndpointResponseBodyDto": "c02535326d7b97544f01b4210a225e8dd9d77e93e392cb5c02c0df11765bc2f5",
1132
1324
  "packages/domain/src/dto/components/component.test-config.dto.ts#ComponentTestConfigDto": "bd160d9217d45584cd7ab29680edef807d8a56fa61283000e1a3db88b8d74d19",
1133
1325
  "apps/api/src/modules/components/component.service.ts#assertNativeTestConfiguration": "f2089642a94765e9f6168fcf39204c18a8585cdb377ada3ed98f53b2c21aae0c",
1134
1326
  "packages/domain/src/dto/components/component-element-key.const.ts#COMPONENT_ELEMENT_RESERVED_KEYS": "ef9367438b70f78facd959c66002f51e3b035b5b23594a7850d3d86bf75ea4e9",
package/dist/src/cli.js CHANGED
@@ -4,7 +4,7 @@ import { recordParsedOption, runtimeConnectionOverrides, validateCommandArgument
4
4
  import { RevoClient } from "./client.js";
5
5
  import { readComponentLock } from "./component-lock.js";
6
6
  import { getActiveEnvironmentName } from "./config.js";
7
- import { handleAgentsCommand, handleAuthCommand, handleComponentCommand, handleDatabaseTablesCommand, handleDatabaseViewsCommand, handleDeployCommand, handleDiffCommand, handleEndpointsCommand, handleEmulateCommand, handleEnvCommand, handleEventsCommand, handleGroupsCommand, handleInfoCommand, handleJobTemplatesCommand, handleMetadataCommand, handleMigrateCommand, handlePlanCommand, handlePullCommand, handleProjectCommand, handleRequestCommand, handleRoleGroupsCommand, handleServiceAccountsCommand, handleSearchCommand, handleStudioCommand, handleSchedulesCommand, handleTerminalCommand, handleTestsCommand, } from "./commands/index.js";
7
+ import { handleAgentsCommand, handleAuthCommand, handleComponentCommand, handleDatabaseTablesCommand, handleDatabaseViewsCommand, handleDeployCommand, handleDiffCommand, handleEndpointsCommand, handleApplicationsCommand, handleEmulateCommand, handleEnvCommand, handleEventsCommand, handleGroupsCommand, handleInfoCommand, handleJobTemplatesCommand, handleMetadataCommand, handleMigrateCommand, handlePlanCommand, handlePullCommand, handleProjectCommand, handleRequestCommand, handleRoleGroupsCommand, handleServiceAccountsCommand, handleSearchCommand, handleStudioCommand, handleSitesCommand, handleSchedulesCommand, handleTerminalCommand, handleTestsCommand, } from "./commands/index.js";
8
8
  import { createHttpTraceSession, finalizeHttpTraceSession, withHttpTraceSession, } from "./http-trace.js";
9
9
  import { resolveProjectRoot } from "./project.js";
10
10
  import { withRequestQueue } from "./request-queue.js";
@@ -197,7 +197,7 @@ async function runMain(args, argv) {
197
197
  const command = args._[0];
198
198
  const noPositionals = args._.length === 0;
199
199
  if (command === 'version' || ((args.version === true || args.V === true) && noPositionals)) {
200
- print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true, syncOmit: true } } : packageVersion);
200
+ print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true, syncOmit: true, applicationsSync: true, applicationAwareEndpoints: true } } : packageVersion);
201
201
  return;
202
202
  }
203
203
  if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
@@ -260,6 +260,10 @@ async function runMain(args, argv) {
260
260
  await handleEndpointsCommand(context);
261
261
  return;
262
262
  }
263
+ if (['applications', 'application', 'apps', 'app'].includes(command)) {
264
+ await handleApplicationsCommand(context);
265
+ return;
266
+ }
263
267
  if (command === 'projects' || command === 'env') {
264
268
  await handleEnvCommand(context);
265
269
  return;
@@ -288,6 +292,10 @@ async function runMain(args, argv) {
288
292
  await handleStudioCommand(context);
289
293
  return;
290
294
  }
295
+ if (command === 'sites') {
296
+ await handleSitesCommand(context);
297
+ return;
298
+ }
291
299
  if (command === 'tests') {
292
300
  await handleTestsCommand(context);
293
301
  return;
@@ -1,6 +1,6 @@
1
1
  import type { AutomationRuntimeInputFields, RuntimeExecutionPolicy } from './types.ts';
2
2
  import { RequestQueue } from './request-queue.ts';
3
- import type { AgentRecord, AgentPluginRecord, ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ServiceAccountRecord, ScheduleRecord } from './types.ts';
3
+ import type { AgentRecord, AgentPluginRecord, ApplicationRecord, ApplicationCors, ApplicationInvocationPolicy, ApplicationAnonymousAccess, 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
6
  export type DatabaseSchemaOperation = {
@@ -153,6 +153,8 @@ export type DatabaseViewUpdatePayload = {
153
153
  });
154
154
  export type EndpointListRequest = ComponentListRequest;
155
155
  export type EndpointWritePayload = {
156
+ allowUnauthenticated?: boolean;
157
+ serviceId?: string;
156
158
  executionPolicy?: RuntimeExecutionPolicy;
157
159
  version: number;
158
160
  metadata: Record<string, unknown>;
@@ -415,12 +417,36 @@ export declare class RevoClient {
415
417
  profile: unknown;
416
418
  }>;
417
419
  private requireAtomicResourceUpdates;
420
+ requireEndpointStorageTransports(): Promise<void>;
418
421
  request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
419
422
  requestData<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
420
423
  me(options?: {
421
424
  force?: boolean;
422
425
  }): Promise<unknown>;
423
426
  listEndpoints(options?: EndpointListRequest): Promise<unknown>;
427
+ listApplications(): Promise<unknown>;
428
+ listAllApplications(): Promise<{
429
+ applications: ApplicationRecord[];
430
+ }>;
431
+ getApplication(serviceId: string): Promise<ApplicationRecord>;
432
+ listApplicationEndpoints(serviceId: string): Promise<EndpointRecord[]>;
433
+ createApplication(body: {
434
+ key: string;
435
+ name: string;
436
+ description?: string | null;
437
+ cors: ApplicationCors;
438
+ invocationPolicy?: ApplicationInvocationPolicy | null;
439
+ anonymousAccess?: ApplicationAnonymousAccess | null;
440
+ }): Promise<ApplicationRecord>;
441
+ updateApplication(serviceId: string, body: {
442
+ version: number;
443
+ name?: string;
444
+ description?: string | null;
445
+ cors?: ApplicationCors;
446
+ invocationPolicy?: ApplicationInvocationPolicy | null;
447
+ anonymousAccess?: ApplicationAnonymousAccess | null;
448
+ }): Promise<ApplicationRecord>;
449
+ deleteApplication(serviceId: string, version: number): Promise<unknown>;
424
450
  listDatabaseSchemas(options?: DatabaseSchemaListRequest): Promise<unknown>;
425
451
  listAllDatabaseSchemas(options?: {
426
452
  projection?: 'thin' | 'pull';
@@ -492,6 +518,32 @@ export declare class RevoClient {
492
518
  createStudioSession(body: Record<string, unknown>): Promise<unknown>;
493
519
  getStudioSession(sessionId: string): Promise<unknown>;
494
520
  updateStudioSession(sessionId: string, body: Record<string, unknown>): Promise<unknown>;
521
+ private studioSitesRequest;
522
+ listStudioSites(): Promise<unknown>;
523
+ createStudioSite(body: {
524
+ key: string;
525
+ name: string;
526
+ description?: string;
527
+ }): Promise<unknown>;
528
+ getStudioSite(siteId: string): Promise<unknown>;
529
+ updateStudioSite(siteId: string, body: {
530
+ expectedRevision: number;
531
+ } & Record<string, unknown>): Promise<unknown>;
532
+ buildStudioSite(siteId: string, body: {
533
+ expectedRevision: number;
534
+ archiveBase64?: string;
535
+ hostingConfig?: Record<string, unknown>;
536
+ }): Promise<unknown>;
537
+ previewStudioSite(siteId: string, body: {
538
+ releaseId: string;
539
+ }): Promise<unknown>;
540
+ publishStudioSite(siteId: string, body: {
541
+ releaseId: string;
542
+ expectedActiveReleaseId: string | null;
543
+ }): Promise<unknown>;
544
+ unpublishStudioSite(siteId: string, body: {
545
+ expectedActiveReleaseId: string;
546
+ }): Promise<unknown>;
495
547
  deleteStudioSession(sessionId: string, body: Record<string, unknown>): Promise<unknown>;
496
548
  readStudioSession(sessionId: string, action: 'diff' | 'files' | 'events' | 'chat' | 'search' | 'rebase' | 'claims', query?: Record<string, unknown>): Promise<unknown>;
497
549
  readStudioFile(sessionId: string, fileId: string, query?: Record<string, unknown>): Promise<unknown>;
@@ -1,3 +1,4 @@
1
+ import { usesEndpointStorageTransport } from "./endpoint-storage-transports.js";
1
2
  import { randomUUID } from 'node:crypto';
2
3
  import { getGlobalDispatcher } from 'undici';
3
4
  import { setTimeout as waitForDelay } from 'node:timers/promises';
@@ -535,6 +536,15 @@ export class RevoClient {
535
536
  });
536
537
  return validation.promise;
537
538
  }
539
+ async requireEndpointStorageTransports() {
540
+ // Saved authentication can predate a deployment. This is a fresh check on
541
+ // this exact target, both while planning and immediately before mutation.
542
+ const { profile } = await this.validateSession({ force: true });
543
+ const value = isRecord(profile) && isRecord(profile.data) ? profile.data : profile;
544
+ if (!isRecord(value) || !isRecord(value.capabilities) || value.capabilities.endpointStorageTransports !== true) {
545
+ throw new Error('Endpoint Storage transports require target API capability endpointStorageTransports. Upgrade matching API/RUN services and verify the RUN storage canary before retrying.');
546
+ }
547
+ }
538
548
  async request(method, path, options = {}) {
539
549
  this.assertReady();
540
550
  if (currentSyncOmitPolicy().rules.length && !['GET', 'HEAD', 'OPTIONS'].includes(method.toUpperCase()) && path !== '/api/v1/me') {
@@ -545,6 +555,9 @@ export class RevoClient {
545
555
  }
546
556
  const url = buildUrl(this.baseUrl, path, options.query);
547
557
  assertCredentialDestination(this.baseUrl, url, options.allowExternalOrigin, this.trustedServiceOrigins, options.publishedRun ? 'run' : 'sbx');
558
+ if (!options.publishedRun && ['POST', 'PUT'].includes(method.toUpperCase()) && /\/(?:api\/)?v1\/endpoints(?:\/[^/]+)?\/?$/.test(url.pathname)
559
+ && isRecord(options.body) && usesEndpointStorageTransport(options.body.options))
560
+ await this.requireEndpointStorageTransports();
548
561
  const headers = new Headers(options.headers || {});
549
562
  headers.set('Authorization', this.authHeader);
550
563
  headers.set('x-api-key', this.token);
@@ -730,6 +743,40 @@ export class RevoClient {
730
743
  query: options.query,
731
744
  });
732
745
  }
746
+ async listApplications() {
747
+ return this.requestData('GET', '/api/v1/services');
748
+ }
749
+ async listAllApplications() {
750
+ const result = await this.listApplications();
751
+ const data = isRecord(result) ? result.data : result;
752
+ if (!Array.isArray(data) || data.some(record => !isRecord(record) || typeof record.serviceId !== 'string')) {
753
+ throw new Error('Incomplete Application catalog.');
754
+ }
755
+ return { applications: data };
756
+ }
757
+ async getApplication(serviceId) {
758
+ const { applications } = await this.listAllApplications();
759
+ const matches = applications.filter(record => record.serviceId === serviceId);
760
+ if (matches.length !== 1)
761
+ throw new Error(`Expected one Application with the selected target ID, found ${matches.length}.`);
762
+ return matches[0];
763
+ }
764
+ async listApplicationEndpoints(serviceId) {
765
+ const result = await this.requestData('GET', `/api/v1/services/${encodeURIComponent(serviceId)}/endpoints`);
766
+ const data = isRecord(result) ? result.data : result;
767
+ if (!Array.isArray(data))
768
+ throw new Error('Incomplete Application endpoint catalog.');
769
+ return data;
770
+ }
771
+ async createApplication(body) {
772
+ return this.requestData('POST', '/api/v1/services', { body, maxRetries: 0, spinnerLabel: 'Creating application' });
773
+ }
774
+ async updateApplication(serviceId, body) {
775
+ return this.requestData('PUT', `/api/v1/services/${encodeURIComponent(serviceId)}`, { body, maxRetries: 0, spinnerLabel: 'Updating application' });
776
+ }
777
+ async deleteApplication(serviceId, version) {
778
+ return this.requestData('DELETE', `/api/v1/services/${encodeURIComponent(serviceId)}`, { query: { version }, maxRetries: 0, spinnerLabel: 'Deleting application' });
779
+ }
733
780
  async listDatabaseSchemas(options = {}) {
734
781
  return this.requestData('GET', options.path || '/api/v1/databases', {
735
782
  query: options.query,
@@ -1317,6 +1364,37 @@ export class RevoClient {
1317
1364
  async updateStudioSession(sessionId, body) {
1318
1365
  return this.requestData('PATCH', `/api/v1/studio/sessions/${encodeURIComponent(sessionId)}`, { body });
1319
1366
  }
1367
+ studioSitesRequest(method, suffix = '', body) {
1368
+ return this.requestData(method, `/api/v1/studio/sites${suffix}`, {
1369
+ body,
1370
+ sensitiveAccountPayload: true,
1371
+ ...(method === 'GET' ? {} : { maxRetries: 0 }),
1372
+ });
1373
+ }
1374
+ listStudioSites() {
1375
+ return this.studioSitesRequest('GET');
1376
+ }
1377
+ createStudioSite(body) {
1378
+ return this.studioSitesRequest('POST', '', body);
1379
+ }
1380
+ getStudioSite(siteId) {
1381
+ return this.studioSitesRequest('GET', `/${encodeURIComponent(siteId)}`);
1382
+ }
1383
+ updateStudioSite(siteId, body) {
1384
+ return this.studioSitesRequest('PATCH', `/${encodeURIComponent(siteId)}`, body);
1385
+ }
1386
+ buildStudioSite(siteId, body) {
1387
+ return this.studioSitesRequest('POST', `/${encodeURIComponent(siteId)}/build`, body);
1388
+ }
1389
+ previewStudioSite(siteId, body) {
1390
+ return this.studioSitesRequest('POST', `/${encodeURIComponent(siteId)}/preview`, body);
1391
+ }
1392
+ publishStudioSite(siteId, body) {
1393
+ return this.studioSitesRequest('POST', `/${encodeURIComponent(siteId)}/publish`, body);
1394
+ }
1395
+ unpublishStudioSite(siteId, body) {
1396
+ return this.studioSitesRequest('POST', `/${encodeURIComponent(siteId)}/unpublish`, body);
1397
+ }
1320
1398
  async deleteStudioSession(sessionId, body) {
1321
1399
  return this.requestData('DELETE', `/api/v1/studio/sessions/${encodeURIComponent(sessionId)}`, { body });
1322
1400
  }
@@ -1387,6 +1465,12 @@ export class RevoClient {
1387
1465
  });
1388
1466
  }
1389
1467
  async deleteWorkspaceResource(resource, id) {
1468
+ if (resource === 'application') {
1469
+ const current = await this.getApplication(id);
1470
+ if (current.system || current.key === '@default')
1471
+ throw new Error('The system Default Application cannot be deleted.');
1472
+ return this.deleteApplication(id, current.version);
1473
+ }
1390
1474
  const encoded = encodeURIComponent(id);
1391
1475
  const single = {
1392
1476
  agent: `/api/v1/agents/${encoded}`,
@@ -0,0 +1,2 @@
1
+ import type { CommandContext } from '../types.ts';
2
+ export declare function handleApplicationsCommand(context: CommandContext): Promise<void>;
@@ -0,0 +1,44 @@
1
+ import { readProjectStableKeyName } from "../project.js";
2
+ import { withCommandSyncOmit } from "../sync-omit-command.js";
3
+ import { resolveResourceTarget } from "../resource-target.js";
4
+ import { readBoolFlag } from "../utils.js";
5
+ import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
6
+ import { buildApplicationsPlan, pullApplicationsToWorkspace, pushApplications } from "../resource-syncs/application-sync.js";
7
+ export async function handleApplicationsCommand(context) {
8
+ return withCommandSyncOmit(context, ['application'], async (scoped) => {
9
+ const action = scoped.args._[1];
10
+ if (!action) {
11
+ scoped.print(await scoped.client.listApplications());
12
+ return;
13
+ }
14
+ if (!readBoolFlag(scoped.args, ['all', 'a']))
15
+ throw new Error('Application sync requires --all.');
16
+ const stableKeyName = readProjectStableKeyName(scoped.cwd);
17
+ const { client, envName, displayName } = await resolveResourceTarget(scoped, { resource: 'Application' });
18
+ if (action === 'pull') {
19
+ const result = await pullApplicationsToWorkspace({ client, cwd: scoped.cwd, envName, stableKeyName, force: readBoolFlag(scoped.args, ['force', 'f']) });
20
+ if (readBoolFlag(scoped.args, ['json']))
21
+ scoped.print(result);
22
+ else
23
+ scoped.println(`Pulled ${result.pulled.length} Applications.`);
24
+ return;
25
+ }
26
+ if (action === 'plan') {
27
+ const plan = await buildApplicationsPlan({ client, cwd: scoped.cwd, envName, stableKeyName });
28
+ scoped.print(plan);
29
+ if (readBoolFlag(scoped.args, ['strict']) && (plan.blockers.length || plan.items.some(item => !['clean', 'orphan', 'skipped'].includes(item.status))))
30
+ throw new Error('Applications require reconciliation.');
31
+ return;
32
+ }
33
+ if (action === 'push') {
34
+ if (!readBoolFlag(scoped.args, ['yes', 'y']) && (!isInteractiveTerminal() || !await promptConfirm(`Push Applications to "${displayName}"?`, false)))
35
+ throw new Error('Application push requires confirmation. Re-run with --yes.');
36
+ const result = await pushApplications({ client, cwd: scoped.cwd, envName, stableKeyName, force: readBoolFlag(scoped.args, ['force', 'f']) });
37
+ scoped.print(result);
38
+ if (result.results.some(item => item.status === 'failed'))
39
+ throw new Error('Application push finished with failures.');
40
+ return;
41
+ }
42
+ throw new Error('Usage: revo applications [pull|plan|push] --all');
43
+ });
44
+ }
@@ -1,2 +1,3 @@
1
1
  import type { CommandContext } from '../types.ts';
2
+ export declare function applicationPublishedRunUrl(runBase: string, applicationKey: string, instanceId: string): URL;
2
3
  export declare function handleEmulateCommand(context: CommandContext): Promise<void>;