@revoengine/cli 1.0.11 → 1.0.13

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 (81) hide show
  1. package/README.md +275 -479
  2. package/dist/src/cli.js +71 -5
  3. package/dist/src/client.d.ts +28 -12
  4. package/dist/src/client.js +234 -66
  5. package/dist/src/commands/component.d.ts +67 -0
  6. package/dist/src/commands/component.js +299 -27
  7. package/dist/src/commands/database-tables.d.ts +2 -0
  8. package/dist/src/commands/{database-schemas.js → database-tables.js} +21 -40
  9. package/dist/src/commands/database-views.js +21 -18
  10. package/dist/src/commands/endpoints.js +26 -16
  11. package/dist/src/commands/events.js +18 -20
  12. package/dist/src/commands/groups.js +13 -22
  13. package/dist/src/commands/index.d.ts +2 -1
  14. package/dist/src/commands/index.js +2 -1
  15. package/dist/src/commands/job-templates.js +21 -15
  16. package/dist/src/commands/metadata.js +58 -15
  17. package/dist/src/commands/migrate.d.ts +6 -0
  18. package/dist/src/commands/migrate.js +658 -0
  19. package/dist/src/commands/project.js +4 -4
  20. package/dist/src/commands/role-groups.js +14 -25
  21. package/dist/src/commands/schedules.js +19 -20
  22. package/dist/src/commands/terminal-browser.d.ts +16 -0
  23. package/dist/src/commands/terminal-browser.js +92 -0
  24. package/dist/src/commands/terminal-image.d.ts +7 -0
  25. package/dist/src/commands/terminal-image.js +40 -0
  26. package/dist/src/commands/terminal-patch-worker.d.ts +1 -0
  27. package/dist/src/commands/terminal-patch-worker.js +24 -0
  28. package/dist/src/commands/terminal-patch.d.ts +2 -0
  29. package/dist/src/commands/terminal-patch.js +156 -0
  30. package/dist/src/commands/terminal-sandbox.d.ts +8 -0
  31. package/dist/src/commands/terminal-sandbox.js +87 -0
  32. package/dist/src/commands/terminal-service.js +2 -2
  33. package/dist/src/commands/terminal.d.ts +31 -4
  34. package/dist/src/commands/terminal.js +360 -45
  35. package/dist/src/component-lock.d.ts +12 -2
  36. package/dist/src/component-lock.js +60 -1
  37. package/dist/src/diff-details.d.ts +8 -0
  38. package/dist/src/diff-details.js +152 -0
  39. package/dist/src/env-sync.js +8 -6
  40. package/dist/src/http-trace.d.ts +94 -0
  41. package/dist/src/http-trace.js +226 -0
  42. package/dist/src/metadata-backfill.d.ts +5 -4
  43. package/dist/src/metadata-backfill.js +82 -158
  44. package/dist/src/migration.d.ts +141 -0
  45. package/dist/src/migration.js +1632 -0
  46. package/dist/src/resource-inventory.d.ts +28 -0
  47. package/dist/src/resource-inventory.js +85 -0
  48. package/dist/src/resource-syncs/{database-schema-sync.d.ts → database-table-sync.d.ts} +13 -3
  49. package/dist/src/resource-syncs/{database-schema-sync.js → database-table-sync.js} +147 -62
  50. package/dist/src/resource-syncs/database-view-sync.d.ts +24 -2
  51. package/dist/src/resource-syncs/database-view-sync.js +156 -68
  52. package/dist/src/resource-syncs/endpoint-sync.d.ts +27 -0
  53. package/dist/src/resource-syncs/endpoint-sync.js +362 -82
  54. package/dist/src/resource-syncs/event-sync.d.ts +27 -0
  55. package/dist/src/resource-syncs/event-sync.js +123 -26
  56. package/dist/src/resource-syncs/group-sync.d.ts +7 -0
  57. package/dist/src/resource-syncs/group-sync.js +60 -14
  58. package/dist/src/resource-syncs/job-template-sync.d.ts +21 -0
  59. package/dist/src/resource-syncs/job-template-sync.js +91 -30
  60. package/dist/src/resource-syncs/role-group-sync.d.ts +7 -0
  61. package/dist/src/resource-syncs/role-group-sync.js +47 -9
  62. package/dist/src/resource-syncs/schedule-sync.d.ts +30 -1
  63. package/dist/src/resource-syncs/schedule-sync.js +114 -20
  64. package/dist/src/resource-syncs/util.d.ts +3 -0
  65. package/dist/src/resource-syncs/util.js +8 -6
  66. package/dist/src/resource-target.d.ts +11 -0
  67. package/dist/src/resource-target.js +48 -0
  68. package/dist/src/sync-output.d.ts +29 -1
  69. package/dist/src/sync-output.js +139 -2
  70. package/dist/src/tracked-resources.d.ts +1 -1
  71. package/dist/src/tracked-resources.js +8 -6
  72. package/dist/src/types.d.ts +3 -0
  73. package/dist/src/ui.js +18 -9
  74. package/dist/src/utils.d.ts +2 -0
  75. package/dist/src/utils.js +17 -0
  76. package/dist/src/workspace-diff.d.ts +25 -0
  77. package/dist/src/workspace-diff.js +75 -0
  78. package/package.json +9 -6
  79. package/dist/src/commands/database-schemas.d.ts +0 -2
  80. /package/dist/src/{database-schema-artifacts.d.ts → database-table-artifacts.d.ts} +0 -0
  81. /package/dist/src/{database-schema-artifacts.js → database-table-artifacts.js} +0 -0
@@ -0,0 +1,28 @@
1
+ import type { RevoClient } from './client.ts';
2
+ import type { TrackableResourceType } from './tracked-resources.ts';
3
+ import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord } from './types.ts';
4
+ type ResourceRecordMap = {
5
+ component: ComponentRecord;
6
+ 'database-table': DatabaseSchemaRecord;
7
+ 'database-view': DatabaseViewRecord;
8
+ endpoint: EndpointRecord;
9
+ 'role-group': RoleGroupRecord;
10
+ group: GroupRecord;
11
+ 'job-template': JobTemplateRecord;
12
+ schedule: ScheduleRecord;
13
+ event: EventRecord;
14
+ };
15
+ export type ResourceRecord = ResourceRecordMap[TrackableResourceType];
16
+ export type ResourceInventoryClient = Pick<RevoClient, 'listAllComponents' | 'getComponent' | 'listAllDatabaseSchemas' | 'listAllDatabaseViewsForSync' | 'listAllEndpoints' | 'getEndpoint' | 'listAllRoleGroups' | 'getRoleGroup' | 'listAllGroups' | 'getGroup' | 'listAllJobTemplates' | 'getJobTemplate' | 'listAllSchedules' | 'getSchedule' | 'listAllEvents' | 'getEvent'>;
17
+ type InventoryOptions = {
18
+ skipPartitions?: boolean;
19
+ };
20
+ type InventoryEntry<T> = {
21
+ listedId: string;
22
+ resource: T;
23
+ };
24
+ export declare function unwrapResource<T extends ResourceRecord>(value: unknown): T;
25
+ export declare function resourceIdOf(resource: ResourceRecord): string;
26
+ /** Read one resource family, without applying sync scope or Stable Key policy. */
27
+ export declare function readResourceInventory<K extends TrackableResourceType>(client: ResourceInventoryClient, resourceType: K, options?: InventoryOptions): AsyncIterable<InventoryEntry<ResourceRecordMap[K]>>;
28
+ export {};
@@ -0,0 +1,85 @@
1
+ export function unwrapResource(value) {
2
+ if (value && typeof value === 'object' && !Array.isArray(value) && 'data' in value) {
3
+ const data = value.data;
4
+ if (data && typeof data === 'object' && !Array.isArray(data)) {
5
+ return data;
6
+ }
7
+ }
8
+ return value;
9
+ }
10
+ export function resourceIdOf(resource) {
11
+ return String(('databaseId' in resource && resource.databaseId)
12
+ || ('databaseViewId' in resource && resource.databaseViewId)
13
+ || ('jobTemplateId' in resource && resource.jobTemplateId)
14
+ || ('endpointId' in resource && resource.endpointId)
15
+ || ('scheduleId' in resource && resource.scheduleId)
16
+ || ('jobEventId' in resource && resource.jobEventId)
17
+ || ('eventId' in resource && resource.eventId)
18
+ || ('groupId' in resource && resource.groupId)
19
+ || resource.componentId
20
+ || resource.roleGroupId
21
+ || resource.id
22
+ || '');
23
+ }
24
+ async function* readDetails(summaries, getDetail) {
25
+ for (let offset = 0; offset < summaries.length; offset += 10) {
26
+ const chunk = summaries.slice(offset, offset + 10);
27
+ const entries = await Promise.all(chunk.map(async (summary) => {
28
+ const listedId = resourceIdOf(summary);
29
+ const resource = listedId ? unwrapResource(await getDetail(listedId)) : summary;
30
+ return { listedId, resource };
31
+ }));
32
+ for (const entry of entries) {
33
+ yield entry;
34
+ }
35
+ }
36
+ }
37
+ const readers = {
38
+ async *component(client) {
39
+ const { components } = await client.listAllComponents();
40
+ yield* readDetails(components, (id) => client.getComponent(id));
41
+ },
42
+ async *'database-table'(client, options) {
43
+ const { databases } = await client.listAllDatabaseSchemas({
44
+ projection: 'pull',
45
+ skipPartitions: options.skipPartitions,
46
+ });
47
+ for (const resource of databases) {
48
+ yield { listedId: resourceIdOf(resource), resource };
49
+ }
50
+ },
51
+ async *'database-view'(client) {
52
+ const views = await client.listAllDatabaseViewsForSync();
53
+ for (const resource of views) {
54
+ yield { listedId: resourceIdOf(resource), resource };
55
+ }
56
+ },
57
+ async *endpoint(client) {
58
+ const { endpoints } = await client.listAllEndpoints();
59
+ yield* readDetails(endpoints, (id) => client.getEndpoint(id));
60
+ },
61
+ async *'role-group'(client) {
62
+ const { roleGroups } = await client.listAllRoleGroups();
63
+ yield* readDetails(roleGroups, (id) => client.getRoleGroup(id));
64
+ },
65
+ async *group(client) {
66
+ const { groups } = await client.listAllGroups();
67
+ yield* readDetails(groups, (id) => client.getGroup(id));
68
+ },
69
+ async *'job-template'(client) {
70
+ const { jobTemplates } = await client.listAllJobTemplates();
71
+ yield* readDetails(jobTemplates, (id) => client.getJobTemplate(id));
72
+ },
73
+ async *schedule(client) {
74
+ const { schedules } = await client.listAllSchedules();
75
+ yield* readDetails(schedules, (id) => client.getSchedule(id));
76
+ },
77
+ async *event(client) {
78
+ const { events } = await client.listAllEvents({ includeDeleted: true });
79
+ yield* readDetails(events, (id) => client.getEvent(id));
80
+ },
81
+ };
82
+ /** Read one resource family, without applying sync scope or Stable Key policy. */
83
+ export function readResourceInventory(client, resourceType, options = {}) {
84
+ return readers[resourceType](client, options);
85
+ }
@@ -1,6 +1,6 @@
1
1
  import type { DatabaseSchemaStatsRecord, RevoClient } from '../client.ts';
2
- export declare const DATABASE_SCHEMAS_DIRECTORY = "DatabaseSchemas";
3
- export declare const DATABASE_SCHEMA_MANIFEST_FILE = "database-schema.json";
2
+ export declare const DATABASE_SCHEMAS_DIRECTORY = "DatabaseTables";
3
+ export declare const DATABASE_SCHEMA_MANIFEST_FILE = "database-table.json";
4
4
  type PortableDefinition = Record<string, unknown>;
5
5
  export type DatabaseSchemaManifest = {
6
6
  kind: 'database-schema' | 'database-partition';
@@ -63,7 +63,7 @@ export type DatabaseSchemaPlanItem = {
63
63
  stats?: DatabaseSchemaStatsRecord['size'];
64
64
  };
65
65
  export type DatabaseSchemasPlan = {
66
- resourceType: 'database-schema';
66
+ resourceType: 'database-table';
67
67
  env: string;
68
68
  withStats: boolean;
69
69
  skipPartitions: boolean;
@@ -73,6 +73,10 @@ export type DatabaseSchemasPlan = {
73
73
  exclusions: string[];
74
74
  items: DatabaseSchemaPlanItem[];
75
75
  };
76
+ export type DatabaseSchemaMigrationPolicy = {
77
+ sourceWins: boolean;
78
+ allowDestructive: boolean;
79
+ };
76
80
  export type DatabaseSchemaPushResult = {
77
81
  stableKey: string;
78
82
  action: 'create' | 'update' | 'reconcile' | 'delete' | 'skipped';
@@ -89,6 +93,7 @@ export declare function buildDatabaseSchemasPlan(input: {
89
93
  stableKeyName: string;
90
94
  withStats?: boolean;
91
95
  skipPartitions?: boolean;
96
+ migrationPolicy?: DatabaseSchemaMigrationPolicy;
92
97
  }): Promise<DatabaseSchemasPlan>;
93
98
  export declare function pullDatabaseSchemasToWorkspace(input: {
94
99
  client: RevoClient;
@@ -99,6 +104,10 @@ export declare function pullDatabaseSchemasToWorkspace(input: {
99
104
  strict?: boolean;
100
105
  pruneOrphans?: boolean;
101
106
  }): Promise<DatabaseSchemaPullResult>;
107
+ export declare function readWorkspaceDatabaseSchemas(cwd: string, stableKeyName: string): {
108
+ manifest: DatabaseSchemaManifest;
109
+ targetPath: string;
110
+ }[];
102
111
  export declare function pushDatabaseSchemas(input: {
103
112
  client: RevoClient;
104
113
  cwd: string;
@@ -110,6 +119,7 @@ export declare function pushDatabaseSchemas(input: {
110
119
  prunePartitionsConfirmed?: boolean;
111
120
  pruneOrphans?: boolean;
112
121
  pruneOrphansConfirmed?: boolean;
122
+ migrationPolicy?: DatabaseSchemaMigrationPolicy;
113
123
  }): Promise<{
114
124
  plan: DatabaseSchemasPlan;
115
125
  results: DatabaseSchemaPushResult[];