@revoengine/cli 1.0.10 → 1.0.11

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 (79) hide show
  1. package/README.md +312 -33
  2. package/dist/src/cli.js +58 -7
  3. package/dist/src/client.d.ts +356 -5
  4. package/dist/src/client.js +803 -19
  5. package/dist/src/commands/auth.js +4 -2
  6. package/dist/src/commands/component.js +260 -141
  7. package/dist/src/commands/database-schemas.d.ts +2 -0
  8. package/dist/src/commands/database-schemas.js +188 -0
  9. package/dist/src/commands/database-views.d.ts +2 -0
  10. package/dist/src/commands/database-views.js +123 -0
  11. package/dist/src/commands/endpoints.js +114 -0
  12. package/dist/src/commands/env.js +44 -24
  13. package/dist/src/commands/events.d.ts +2 -0
  14. package/dist/src/commands/events.js +146 -0
  15. package/dist/src/commands/groups.d.ts +2 -0
  16. package/dist/src/commands/groups.js +169 -0
  17. package/dist/src/commands/index.d.ts +8 -0
  18. package/dist/src/commands/index.js +8 -0
  19. package/dist/src/commands/job-templates.d.ts +2 -0
  20. package/dist/src/commands/job-templates.js +101 -0
  21. package/dist/src/commands/metadata.js +29 -7
  22. package/dist/src/commands/project.js +10 -3
  23. package/dist/src/commands/role-groups.d.ts +2 -0
  24. package/dist/src/commands/role-groups.js +152 -0
  25. package/dist/src/commands/schedules.d.ts +2 -0
  26. package/dist/src/commands/schedules.js +141 -0
  27. package/dist/src/commands/terminal-service.d.ts +38 -0
  28. package/dist/src/commands/terminal-service.js +210 -0
  29. package/dist/src/commands/terminal.d.ts +22 -0
  30. package/dist/src/commands/terminal.js +511 -0
  31. package/dist/src/component-lock.d.ts +100 -2
  32. package/dist/src/component-lock.js +304 -15
  33. package/dist/src/config.d.ts +10 -2
  34. package/dist/src/config.js +49 -14
  35. package/dist/src/database-schema-artifacts.d.ts +7 -0
  36. package/dist/src/database-schema-artifacts.js +8 -0
  37. package/dist/src/env-sync.d.ts +0 -3
  38. package/dist/src/env-sync.js +3 -19
  39. package/dist/src/metadata-backfill.d.ts +16 -6
  40. package/dist/src/metadata-backfill.js +1069 -18
  41. package/dist/src/project.d.ts +2 -0
  42. package/dist/src/project.js +4 -17
  43. package/dist/src/prompt.js +10 -18
  44. package/dist/src/resource-metadata.d.ts +1 -0
  45. package/dist/src/resource-metadata.js +3 -0
  46. package/dist/src/resource-syncs/database-schema-sync.d.ts +117 -0
  47. package/dist/src/resource-syncs/database-schema-sync.js +2289 -0
  48. package/dist/src/resource-syncs/database-view-sync.d.ts +124 -0
  49. package/dist/src/resource-syncs/database-view-sync.js +1317 -0
  50. package/dist/src/resource-syncs/endpoint-sync.d.ts +96 -0
  51. package/dist/src/resource-syncs/endpoint-sync.js +1283 -0
  52. package/dist/src/resource-syncs/event-sync.d.ts +99 -0
  53. package/dist/src/resource-syncs/event-sync.js +949 -0
  54. package/dist/src/resource-syncs/group-sync.d.ts +86 -0
  55. package/dist/src/resource-syncs/group-sync.js +882 -0
  56. package/dist/src/resource-syncs/job-template-sync.d.ts +85 -0
  57. package/dist/src/resource-syncs/job-template-sync.js +782 -0
  58. package/dist/src/resource-syncs/role-group-sync.d.ts +83 -0
  59. package/dist/src/resource-syncs/role-group-sync.js +597 -0
  60. package/dist/src/resource-syncs/schedule-sync.d.ts +111 -0
  61. package/dist/src/resource-syncs/schedule-sync.js +1302 -0
  62. package/dist/src/resource-syncs/util.d.ts +19 -0
  63. package/dist/src/resource-syncs/util.js +116 -0
  64. package/dist/src/runtime-view.d.ts +1 -0
  65. package/dist/src/runtime-view.js +6 -1
  66. package/dist/src/sync-output.d.ts +38 -0
  67. package/dist/src/sync-output.js +131 -0
  68. package/dist/src/tracked-resources.d.ts +1 -1
  69. package/dist/src/tracked-resources.js +26 -2
  70. package/dist/src/types.d.ts +224 -0
  71. package/dist/src/ui.d.ts +3 -0
  72. package/dist/src/ui.js +67 -18
  73. package/dist/src/utils.d.ts +2 -0
  74. package/dist/src/utils.js +64 -0
  75. package/dist/src/workspace-component.d.ts +2 -0
  76. package/dist/src/workspace-component.js +34 -0
  77. package/dist/src/workspace-resource.d.ts +2 -0
  78. package/dist/src/workspace-resource.js +52 -0
  79. package/package.json +8 -3
@@ -1,4 +1,4 @@
1
- import { hashPortableComponentSource, normalizePortableComponentSource, sanitizeComponentSource, } from "./component-lock.js";
1
+ import { buildPortableComponentUpdatePayload, diffPortableComponentSource, hashPortableComponentSource, normalizePortableComponentSource, sanitizeComponentSource, } from "./component-lock.js";
2
2
  import { buildStableKey as buildComponentStableKey, DEFAULT_STABLE_KEY_NAME, NULL_CATEGORY_KEY, sanitizeUserMetadata, } from "./resource-metadata.js";
3
3
  export function normalizeKeyPart(value) {
4
4
  return (value ?? '').trim().replace(/\s+/g, ' ').toLowerCase();
@@ -69,10 +69,6 @@ export async function captureEnvSnapshot(client, envName, options = {}) {
69
69
  collisions,
70
70
  };
71
71
  }
72
- const PORTABLE_METADATA_FIELDS = ['name', 'category', 'desc', 'active', 'type', 'async'];
73
- function diffMetadataFields(source, target) {
74
- return PORTABLE_METADATA_FIELDS.filter((field) => source[field] !== target[field]);
75
- }
76
72
  function diffElementKeys(source, target) {
77
73
  const sourceByKey = new Map(source.elements.map((element) => [element.key, element]));
78
74
  const targetByKey = new Map(target.elements.map((element) => [element.key, element]));
@@ -174,7 +170,7 @@ export function buildEnvSyncPlan(source, target, options) {
174
170
  items.push({ ...base, action: 'noop', reason: 'up to date' });
175
171
  continue;
176
172
  }
177
- const changedFields = diffMetadataFields(sourceEntry.portable, targetEntry.portable);
173
+ const changedFields = diffPortableComponentSource(sourceEntry.component, targetEntry.component).configurationFields;
178
174
  const elementDiff = diffElementKeys(sourceEntry.portable, targetEntry.portable);
179
175
  items.push({
180
176
  ...base,
@@ -240,18 +236,6 @@ function buildCreatePayload(component) {
240
236
  elements: buildPortableElementPayload(component),
241
237
  };
242
238
  }
243
- function buildMetadataPayload(source, target, changedFields) {
244
- if (!Number.isInteger(target.version)) {
245
- throw new Error('target component version is required to update component metadata');
246
- }
247
- const payload = { version: target.version };
248
- for (const field of PORTABLE_METADATA_FIELDS) {
249
- if (changedFields.includes(field)) {
250
- payload[field] = source[field];
251
- }
252
- }
253
- return payload;
254
- }
255
239
  async function verifyAppliedComponent(targetClient, componentId, expectedHash) {
256
240
  const component = unwrapComponent(await targetClient.getComponent(componentId));
257
241
  return hashPortableComponentSource(component) === expectedHash;
@@ -300,7 +284,7 @@ async function applyPlanItem(targetClient, item, source, target, stableKeyName =
300
284
  throw new Error('component disappeared from the snapshot');
301
285
  }
302
286
  if (item.changedFields && item.changedFields.length > 0) {
303
- await targetClient.updateComponent(targetEntry.componentId, buildMetadataPayload(sourceEntry.portable, targetEntry.component, item.changedFields));
287
+ await targetClient.updateComponent(targetEntry.componentId, buildPortableComponentUpdatePayload(sourceEntry.component, targetEntry.component, item.changedFields));
304
288
  }
305
289
  const hasElementChanges = Boolean(item.addedElementKeys?.length || item.removedElementKeys?.length || item.changedElementKeys?.length);
306
290
  if (hasElementChanges) {
@@ -1,16 +1,20 @@
1
1
  import type { RevoClient } from './client.ts';
2
2
  import { type TrackedResource } from './tracked-resources.ts';
3
- import type { ComponentRecord } from './types.ts';
4
- export type MetadataBackfillAction = 'update' | 'skip' | 'failed';
3
+ import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord } from './types.ts';
4
+ export type MetadataBackfillAction = 'update' | 'skip' | 'blocked' | 'failed';
5
+ type MetadataBackfillResourceType = 'component' | 'endpoint' | 'group' | 'role-group' | 'job-template' | 'schedule' | 'event' | 'database-schema' | 'database-view';
6
+ type MetadataResourceRecord = ComponentRecord | DatabaseSchemaRecord | DatabaseViewRecord | EndpointRecord | GroupRecord | RoleGroupRecord | JobTemplateRecord | ScheduleRecord | EventRecord;
5
7
  export type MetadataBackfillPlanItem = {
6
- resourceType: 'component';
8
+ resourceType: MetadataBackfillResourceType;
7
9
  resourceId: string;
8
10
  name: string;
9
11
  category: string | null;
10
12
  action: Exclude<MetadataBackfillAction, 'failed'>;
11
- metadataField: 'metadata';
13
+ metadataField: 'metadata' | 'definition[].metadata';
12
14
  stableKeyName: string;
13
15
  stableKey?: string;
16
+ columnName?: string;
17
+ columnDefinitionId?: string;
14
18
  reason: string;
15
19
  };
16
20
  export type MetadataBackfillPlan = {
@@ -21,26 +25,32 @@ export type MetadataBackfillPlan = {
21
25
  instance: string;
22
26
  stableKeyName: string;
23
27
  trackedResources: TrackedResource[];
28
+ force: boolean;
29
+ skipPartitions?: boolean;
24
30
  counts: Record<Exclude<MetadataBackfillAction, 'failed'>, number>;
31
+ blockers: string[];
25
32
  items: MetadataBackfillPlanItem[];
26
33
  };
27
34
  export type MetadataBackfillResult = {
28
- resourceType: 'component';
35
+ resourceType: MetadataBackfillResourceType;
29
36
  resourceId: string;
30
37
  stableKey?: string;
38
+ columnName?: string;
31
39
  action: MetadataBackfillAction;
32
40
  error?: string;
33
41
  };
34
42
  export declare function generateStableKeySuffix(bytes?: number): string;
35
- export declare function buildGeneratedStableKey(component: ComponentRecord): string;
43
+ export declare function buildGeneratedStableKey(resource: MetadataResourceRecord): string;
36
44
  export declare function buildMetadataBackfillPlan(input: {
37
45
  client: RevoClient;
38
46
  envName: string;
39
47
  stableKeyName: string;
40
48
  trackedResources: TrackedResource[];
41
49
  force?: boolean;
50
+ skipPartitions?: boolean;
42
51
  }): Promise<MetadataBackfillPlan>;
43
52
  export declare function applyMetadataBackfillPlan(input: {
44
53
  client: RevoClient;
45
54
  plan: MetadataBackfillPlan;
46
55
  }): Promise<MetadataBackfillResult[]>;
56
+ export {};