@revoengine/cli 2.1.0 → 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.
- package/CHANGELOG.md +17 -0
- package/README.md +113 -12
- package/dist/src/application-access.d.ts +4 -0
- package/dist/src/application-access.js +18 -0
- package/dist/src/application-cors.d.ts +2 -0
- package/dist/src/application-cors.js +19 -0
- package/dist/src/argument-contract.js +24 -4
- package/dist/src/automation-contract.generated.d.ts +165 -6
- package/dist/src/automation-contract.generated.js +198 -6
- package/dist/src/cli.js +10 -2
- package/dist/src/client.d.ts +53 -1
- package/dist/src/client.js +84 -0
- package/dist/src/commands/applications.d.ts +2 -0
- package/dist/src/commands/applications.js +44 -0
- package/dist/src/commands/emulate.d.ts +1 -0
- package/dist/src/commands/emulate.js +79 -3
- package/dist/src/commands/index.d.ts +2 -0
- package/dist/src/commands/index.js +2 -0
- package/dist/src/commands/migrate.js +10 -2
- package/dist/src/commands/sites.d.ts +2 -0
- package/dist/src/commands/sites.js +156 -0
- package/dist/src/commands/terminal-pty.js +2 -1
- package/dist/src/component-lock.d.ts +2 -1
- package/dist/src/component-lock.js +22 -1
- package/dist/src/endpoint-application.d.ts +25 -0
- package/dist/src/endpoint-application.js +75 -0
- package/dist/src/endpoint-emulator.d.ts +5 -0
- package/dist/src/endpoint-emulator.js +29 -0
- package/dist/src/endpoint-storage-transports.d.ts +2 -0
- package/dist/src/endpoint-storage-transports.js +8 -0
- package/dist/src/metadata-backfill.d.ts +1 -1
- package/dist/src/metadata-backfill.js +10 -1
- package/dist/src/migration.d.ts +6 -2
- package/dist/src/migration.js +104 -41
- package/dist/src/project.d.ts +8 -1
- package/dist/src/project.js +4 -0
- package/dist/src/request-contract.d.ts +5 -0
- package/dist/src/request-contract.js +12 -0
- package/dist/src/resource-inventory.d.ts +4 -2
- package/dist/src/resource-inventory.js +16 -1
- package/dist/src/resource-syncs/account-principal.d.ts +2 -0
- package/dist/src/resource-syncs/account-principal.js +3 -0
- package/dist/src/resource-syncs/application-principals.d.ts +60 -0
- package/dist/src/resource-syncs/application-principals.js +151 -0
- package/dist/src/resource-syncs/application-sync.d.ts +110 -0
- package/dist/src/resource-syncs/application-sync.js +328 -0
- package/dist/src/resource-syncs/endpoint-sync.d.ts +38 -0
- package/dist/src/resource-syncs/endpoint-sync.js +278 -14
- package/dist/src/resource-syncs/group-sync.d.ts +12 -0
- package/dist/src/resource-syncs/group-sync.js +60 -6
- package/dist/src/resource-syncs/runtime-definition-validation.js +26 -1
- package/dist/src/resource-syncs/service-account-sync.d.ts +10 -0
- package/dist/src/resource-syncs/service-account-sync.js +32 -4
- package/dist/src/reviewed-plan.js +2 -2
- package/dist/src/sync-omit-write-fence.js +4 -1
- package/dist/src/sync-omit.d.ts +1 -1
- package/dist/src/sync-omit.js +7 -2
- package/dist/src/tracked-resources.d.ts +1 -1
- package/dist/src/tracked-resources.js +3 -2
- package/dist/src/types.d.ts +30 -0
- package/dist/src/ui.js +2 -0
- package/dist/src/workspace-diff.js +1 -0
- package/dist/src/workspace-digests.js +2 -0
- package/dist/src/workspace-prune.js +67 -9
- package/package.json +11 -6
- package/scripts/postinstall.mjs +40 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Storage directives require the matching native RUN transport, not JSON body emulation. */
|
|
2
|
+
export function usesEndpointStorageTransport(options) {
|
|
3
|
+
if (!options || typeof options !== 'object' || Array.isArray(options))
|
|
4
|
+
return false;
|
|
5
|
+
const value = options;
|
|
6
|
+
return [value.requestBody, value.responseBody].some(body => body && typeof body === 'object' && !Array.isArray(body)
|
|
7
|
+
&& body.mode === 'storage');
|
|
8
|
+
}
|
|
@@ -11,7 +11,7 @@ export type MetadataBackfillPlanItem = {
|
|
|
11
11
|
category: string | null;
|
|
12
12
|
parentName?: string;
|
|
13
13
|
action: Exclude<MetadataBackfillAction, 'failed'>;
|
|
14
|
-
metadataField: 'metadata' | 'definition[].metadata';
|
|
14
|
+
metadataField: 'metadata' | 'definition[].metadata' | 'none';
|
|
15
15
|
stableKeyName: string;
|
|
16
16
|
stableKey?: string;
|
|
17
17
|
columnName?: string;
|
|
@@ -271,6 +271,13 @@ function buildJobTemplateMetadataUpdatePayload(jobTemplate, stableKeyName, stabl
|
|
|
271
271
|
export async function buildMetadataBackfillPlan(input) {
|
|
272
272
|
const { client, envName, stableKeyName, trackedResources, force = false, skipPartitions = false } = input;
|
|
273
273
|
const items = [];
|
|
274
|
+
if (shouldTrackResource(trackedResources, 'application') && typeof client.listAllApplications === 'function') {
|
|
275
|
+
for await (const { resource } of readResourceInventory(client, 'application', { allowUnsupportedApplications: trackedResources.length > 1 || trackedResources.includes('all') })) {
|
|
276
|
+
items.push({ resourceType: 'application', resourceId: resource.serviceId, name: resource.name, category: null,
|
|
277
|
+
action: 'skip', metadataField: 'none', stableKeyName, stableKey: resource.key,
|
|
278
|
+
reason: 'Application identity is its immutable key; no metadata backfill is supported or required.' });
|
|
279
|
+
}
|
|
280
|
+
}
|
|
274
281
|
if (shouldTrackResource(trackedResources, 'component')) {
|
|
275
282
|
for await (const { listedId, resource: component } of readResourceInventory(client, 'component')) {
|
|
276
283
|
if (!listedId) {
|
|
@@ -755,13 +762,15 @@ export async function applyMetadataBackfillPlan(input) {
|
|
|
755
762
|
if (plan.blockers.length > 0) {
|
|
756
763
|
throw new Error(`Metadata plan has ${plan.blockers.length} blocking validation error(s): ${plan.blockers.join(' ')}`);
|
|
757
764
|
}
|
|
765
|
+
if (plan.items.some(item => item.resourceType === 'application' && item.action !== 'skip'))
|
|
766
|
+
throw new Error('Application identity is its immutable key; metadata mutation is unsupported.');
|
|
758
767
|
if (plan.items.some((item) => item.action === 'blocked')) {
|
|
759
768
|
throw new Error('Metadata plan contains blocked items and cannot be applied.');
|
|
760
769
|
}
|
|
761
770
|
const currentResources = new Map();
|
|
762
771
|
const resourceTypes = new Set(plan.items.map((item) => item.resourceType));
|
|
763
772
|
const readOrder = [
|
|
764
|
-
'component', 'database-table', 'database-view', 'endpoint',
|
|
773
|
+
'component', 'database-table', 'database-view', 'application', 'endpoint',
|
|
765
774
|
'role-group', 'service-account', 'group', 'job-template', 'schedule', 'event', 'agent-plugin', 'agent',
|
|
766
775
|
];
|
|
767
776
|
for (const resourceType of readOrder) {
|
package/dist/src/migration.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ApplicationsPlan, type ApplicationPullResult, type ApplicationPushResult } from './resource-syncs/application-sync.ts';
|
|
1
2
|
import { type SyncOmitTargetVersions } from './sync-omit-write-fence.ts';
|
|
2
3
|
import { type SyncOmitPolicy } from './sync-omit.ts';
|
|
3
4
|
import { type AgentSyncPlan, type AgentSyncPull, type AgentSyncResult } from './resource-syncs/agent-sync.ts';
|
|
@@ -14,12 +15,12 @@ import { type GroupPullResult, type GroupPushResult, type GroupsPlan } from './r
|
|
|
14
15
|
import { type JobTemplatePullResult, type JobTemplatePushResult, type JobTemplatesPlan } from './resource-syncs/job-template-sync.ts';
|
|
15
16
|
import { type SchedulePullResult, type SchedulePushResult, type SchedulesPlan } from './resource-syncs/schedule-sync.ts';
|
|
16
17
|
import { type RoleGroupPullResult, type RoleGroupPushResult, type RoleGroupsPlan } from './resource-syncs/role-group-sync.ts';
|
|
17
|
-
export type MigrationResource = 'database-table' | 'database-view' | 'component' | 'job-template' | 'endpoint' | 'schedule' | 'event' | 'group' | 'role-group' | 'service-account' | 'agent-plugin' | 'agent';
|
|
18
|
+
export type MigrationResource = 'database-table' | 'database-view' | 'component' | 'job-template' | 'application' | 'endpoint' | 'schedule' | 'event' | 'group' | 'role-group' | 'service-account' | 'agent-plugin' | 'agent';
|
|
18
19
|
export type MigrationVerdict = 'ready' | 'ready-with-warnings' | 'blocked';
|
|
19
20
|
export type MigrationOperations = Record<'noop' | 'create' | 'update' | 'adopt' | 'excluded' | 'blocked', number> & {
|
|
20
21
|
delete?: number;
|
|
21
22
|
};
|
|
22
|
-
type MigrationPushResult = DatabaseSchemaPushResult | DatabaseViewPushResult | ComponentSyncResult | JobTemplatePushResult | EndpointPushResult | SchedulePushResult | EventPushResult | GroupPushResult | RoleGroupPushResult | ServiceAccountPushResult | AgentSyncResult;
|
|
23
|
+
type MigrationPushResult = DatabaseSchemaPushResult | DatabaseViewPushResult | ComponentSyncResult | JobTemplatePushResult | ApplicationPushResult | EndpointPushResult | SchedulePushResult | EventPushResult | GroupPushResult | RoleGroupPushResult | ServiceAccountPushResult | AgentSyncResult;
|
|
23
24
|
export type MigrationPhasePlan = {
|
|
24
25
|
order: number;
|
|
25
26
|
resource: MigrationResource;
|
|
@@ -72,6 +73,7 @@ export type MigrationPlan = {
|
|
|
72
73
|
databaseViews?: MigrationResourcePlan<DatabaseViewsPlan>;
|
|
73
74
|
components?: MigrationResourcePlan<ComponentPlan>;
|
|
74
75
|
jobTemplates?: MigrationResourcePlan<JobTemplatesPlan>;
|
|
76
|
+
applications?: MigrationResourcePlan<ApplicationsPlan>;
|
|
75
77
|
endpoints?: MigrationResourcePlan<EndpointPlan>;
|
|
76
78
|
schedules?: MigrationResourcePlan<SchedulesPlan>;
|
|
77
79
|
events?: MigrationResourcePlan<EventsPlan>;
|
|
@@ -100,6 +102,7 @@ export type MigrationRun = {
|
|
|
100
102
|
databaseViews?: DatabaseViewPullResult;
|
|
101
103
|
components?: ComponentSyncResult[];
|
|
102
104
|
jobTemplates?: JobTemplatePullResult;
|
|
105
|
+
applications?: ApplicationPullResult;
|
|
103
106
|
endpoints?: EndpointPullResult;
|
|
104
107
|
schedules?: SchedulePullResult;
|
|
105
108
|
events?: EventPullResult;
|
|
@@ -144,6 +147,7 @@ export type ResourcePullResults = {
|
|
|
144
147
|
databaseViews?: DatabaseViewPullResult;
|
|
145
148
|
components?: ComponentSyncResult[];
|
|
146
149
|
jobTemplates?: JobTemplatePullResult;
|
|
150
|
+
applications?: ApplicationPullResult;
|
|
147
151
|
endpoints?: EndpointPullResult;
|
|
148
152
|
schedules?: SchedulePullResult;
|
|
149
153
|
events?: EventPullResult;
|
package/dist/src/migration.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildApplicationsPlan, pullApplicationsToWorkspace, pushApplications, applicationItemAction } from "./resource-syncs/application-sync.js";
|
|
1
2
|
import { fenceSyncOmitWrites } from "./sync-omit-write-fence.js";
|
|
2
3
|
import { currentSyncOmitPolicy, syncBaselineHash, withoutSyncOmit } from "./sync-omit.js";
|
|
3
4
|
import { AGENT_LAYOUT, buildAgentsPlan, pullAgentsToWorkspace, pushAgents } from "./resource-syncs/agent-sync.js";
|
|
@@ -33,6 +34,7 @@ const RESOURCE_ORDER = [
|
|
|
33
34
|
'agent-plugin',
|
|
34
35
|
'agent',
|
|
35
36
|
'job-template',
|
|
37
|
+
'application',
|
|
36
38
|
'endpoint',
|
|
37
39
|
'schedule',
|
|
38
40
|
'event',
|
|
@@ -228,6 +230,14 @@ function summarizeJobTemplatePhase(plan) {
|
|
|
228
230
|
blockers,
|
|
229
231
|
};
|
|
230
232
|
}
|
|
233
|
+
function summarizeApplicationPhase(plan) {
|
|
234
|
+
const operations = emptyOperations();
|
|
235
|
+
for (const item of plan.items)
|
|
236
|
+
operations[migrationItemOperation(item, applicationItemAction(item))]++;
|
|
237
|
+
return { order: RESOURCE_ORDER.indexOf('application') + 1, resource: 'application',
|
|
238
|
+
needsChanges: operations.create + operations.update > 0, readyToMigrate: plan.blockers.length === 0,
|
|
239
|
+
verdict: phaseVerdict(plan.blockers, plan.warnings), operations, warnings: [...plan.warnings, ...plan.exclusions], blockers: plan.blockers };
|
|
240
|
+
}
|
|
231
241
|
function summarizeEndpointPhase(plan) {
|
|
232
242
|
const operations = emptyOperations();
|
|
233
243
|
for (const item of plan.items) {
|
|
@@ -415,6 +425,8 @@ function summarizePulls(mode, pulls) {
|
|
|
415
425
|
skipped: pulls.jobTemplates.skipped.length,
|
|
416
426
|
};
|
|
417
427
|
}
|
|
428
|
+
if (pulls.applications)
|
|
429
|
+
byResource.application = { pulled: pulls.applications.pulled.length, pruned: pulls.applications.pruned.length, skipped: pulls.applications.skipped.length };
|
|
418
430
|
if (pulls.endpoints) {
|
|
419
431
|
byResource.endpoint = {
|
|
420
432
|
pulled: pulls.endpoints.pulled.length,
|
|
@@ -595,6 +607,8 @@ function combinePlan(input) {
|
|
|
595
607
|
if (input.jobTemplates) {
|
|
596
608
|
input.jobTemplates = { ...input.jobTemplates, items: projectRepositoryItems(input.jobTemplates.items, jobTemplateItemAction, baselineByKey('job-template', lock.jobTemplates)) };
|
|
597
609
|
}
|
|
610
|
+
if (input.applications)
|
|
611
|
+
input.applications = { ...input.applications, items: projectRepositoryItems(input.applications.items, applicationItemAction, baselineByKey('application', lock.applications)) };
|
|
598
612
|
if (input.endpoints) {
|
|
599
613
|
input.endpoints = { ...input.endpoints, items: projectRepositoryItems(input.endpoints.items, endpointItemAction, (item) => item.stableKey ? syncBaselineHash('endpoint', lock.endpoints[item.stableKey]?.environments[environment]) : undefined) };
|
|
600
614
|
}
|
|
@@ -619,6 +633,7 @@ function combinePlan(input) {
|
|
|
619
633
|
...(input.agentPlugins ? [summarizeAgentPhase(input.agentPlugins)] : []),
|
|
620
634
|
...(input.agents ? [summarizeAgentPhase(input.agents)] : []),
|
|
621
635
|
...(input.jobTemplates ? [summarizeJobTemplatePhase(input.jobTemplates)] : []),
|
|
636
|
+
...(input.applications ? [summarizeApplicationPhase(input.applications)] : []),
|
|
622
637
|
...(input.endpoints ? [summarizeEndpointPhase(input.endpoints)] : []),
|
|
623
638
|
...(input.schedules ? [summarizeSchedulePhase(input.schedules, input.migrationInput.sourceMode !== 'workspace' || input.migrationInput.activateAutomations === true)] : []),
|
|
624
639
|
...(input.events ? [summarizeEventPhase(input.events, input.migrationInput.sourceMode !== 'workspace' || input.migrationInput.activateAutomations === true)] : []),
|
|
@@ -643,34 +658,36 @@ function combinePlan(input) {
|
|
|
643
658
|
...(input.pulls.jobTemplates?.warnings || [])
|
|
644
659
|
.map((item) => `Source Job Template "${item.stableKey}": ${item.reason}.`),
|
|
645
660
|
]
|
|
646
|
-
: phase.resource === '
|
|
647
|
-
? (input.pulls.
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
.map((item) => `Source Schedule "${item.stableKey}": ${item.reason}.`),
|
|
653
|
-
...(input.pulls.schedules?.pulled || [])
|
|
654
|
-
.filter(({ manifest }) => manifest.activationCandidate === true)
|
|
655
|
-
.map(({ manifest }) => `Source Schedule "${manifest.stableKey}" is an activation candidate; migration syncs its portable definition but does not automatically change target activation state.`),
|
|
656
|
-
]
|
|
657
|
-
: phase.resource === 'event'
|
|
661
|
+
: phase.resource === 'application'
|
|
662
|
+
? (input.pulls.applications?.skipped || []).map(item => `Source Application skipped: ${item.reason}.`)
|
|
663
|
+
: phase.resource === 'endpoint'
|
|
664
|
+
? (input.pulls.endpoints?.skipped || [])
|
|
665
|
+
.map((item) => `Source Endpoint skipped: ${item.targetPath}: ${item.reason}.`)
|
|
666
|
+
: phase.resource === 'schedule'
|
|
658
667
|
? [
|
|
659
|
-
...(input.pulls.
|
|
660
|
-
.map((item) => `Source
|
|
661
|
-
...(input.pulls.
|
|
662
|
-
.filter(({ manifest }) => manifest.
|
|
663
|
-
.map(({ manifest }) => `Source
|
|
668
|
+
...(input.pulls.schedules?.warnings || [])
|
|
669
|
+
.map((item) => `Source Schedule "${item.stableKey}": ${item.reason}.`),
|
|
670
|
+
...(input.pulls.schedules?.pulled || [])
|
|
671
|
+
.filter(({ manifest }) => manifest.activationCandidate === true)
|
|
672
|
+
.map(({ manifest }) => `Source Schedule "${manifest.stableKey}" is an activation candidate; migration syncs its portable definition but does not automatically change target activation state.`),
|
|
664
673
|
]
|
|
665
|
-
: phase.resource === '
|
|
674
|
+
: phase.resource === 'event'
|
|
666
675
|
? [
|
|
667
|
-
...(input.pulls.
|
|
668
|
-
.map((item) => `Source
|
|
669
|
-
...(input.pulls.
|
|
670
|
-
.
|
|
676
|
+
...(input.pulls.events?.warnings || [])
|
|
677
|
+
.map((item) => `Source Event "${item.stableKey}": ${item.reason}.`),
|
|
678
|
+
...(input.pulls.events?.pulled || [])
|
|
679
|
+
.filter(({ manifest }) => manifest.active === true)
|
|
680
|
+
.map(({ manifest }) => `Source Event "${manifest.stableKey}" is active; migration syncs its portable configuration but does not automatically change target activation state.`),
|
|
671
681
|
]
|
|
672
|
-
:
|
|
673
|
-
|
|
682
|
+
: phase.resource === 'group'
|
|
683
|
+
? [
|
|
684
|
+
...(input.pulls.groups?.skipped || [])
|
|
685
|
+
.map((item) => `Source Group "${item.name}" skipped: ${item.reason}.`),
|
|
686
|
+
...(input.pulls.groups?.notices || [])
|
|
687
|
+
.map((item) => `Source Group "${item.stableKey}": ${item.reason}.`),
|
|
688
|
+
]
|
|
689
|
+
: (input.pulls.roleGroups?.skipped || [])
|
|
690
|
+
.map((item) => `Source Role Group "${item.name}" skipped: ${item.reason}.`);
|
|
674
691
|
const pruneWarnings = phase.resource === 'service-account'
|
|
675
692
|
? (input.pulls.serviceAccounts?.pruned || []).map((item) => `Pruned stale source workspace Service Account "${item.stableKey}".`)
|
|
676
693
|
: phase.resource === 'database-table'
|
|
@@ -684,20 +701,22 @@ function combinePlan(input) {
|
|
|
684
701
|
: phase.resource === 'job-template'
|
|
685
702
|
? (input.pulls.jobTemplates?.pruned || [])
|
|
686
703
|
.map((item) => `Pruned stale source workspace Job Template "${item.stableKey}".`)
|
|
687
|
-
: phase.resource === '
|
|
688
|
-
? (input.pulls.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
704
|
+
: phase.resource === 'application'
|
|
705
|
+
? (input.pulls.applications?.pruned || []).map(item => `Pruned stale source workspace Application ${item.stableKey}.`)
|
|
706
|
+
: phase.resource === 'endpoint'
|
|
707
|
+
? (input.pulls.endpoints?.pruned || [])
|
|
708
|
+
.map((item) => `Pruned stale source workspace Endpoint "${item.stableKey}".`)
|
|
709
|
+
: phase.resource === 'schedule'
|
|
710
|
+
? (input.pulls.schedules?.pruned || [])
|
|
711
|
+
.map((item) => `Pruned stale source workspace Schedule "${item.stableKey}".`)
|
|
712
|
+
: phase.resource === 'event'
|
|
713
|
+
? (input.pulls.events?.pruned || [])
|
|
714
|
+
.map((item) => `Pruned stale source workspace Event "${item.stableKey}".`)
|
|
715
|
+
: phase.resource === 'group'
|
|
716
|
+
? (input.pulls.groups?.pruned || [])
|
|
717
|
+
.map((item) => `Pruned stale source workspace Group "${item.stableKey}".`)
|
|
718
|
+
: (input.pulls.roleGroups?.pruned || [])
|
|
719
|
+
.map((item) => `Pruned stale source workspace Role Group "${item.stableKey}".`);
|
|
701
720
|
const warnings = [...new Set([...phase.warnings, ...pullWarnings, ...pruneWarnings])];
|
|
702
721
|
return { ...phase, warnings, verdict: phaseVerdict(phase.blockers, warnings) };
|
|
703
722
|
});
|
|
@@ -726,6 +745,7 @@ function combinePlan(input) {
|
|
|
726
745
|
...(input.databaseViews ? { databaseViews: input.databaseViews } : {}),
|
|
727
746
|
...(input.components ? { components: input.components } : {}),
|
|
728
747
|
...(input.jobTemplates ? { jobTemplates: input.jobTemplates } : {}),
|
|
748
|
+
...(input.applications ? { applications: input.applications } : {}),
|
|
729
749
|
...(input.endpoints ? { endpoints: input.endpoints } : {}),
|
|
730
750
|
...(input.schedules ? { schedules: input.schedules } : {}),
|
|
731
751
|
...(input.events ? { events: input.events } : {}),
|
|
@@ -905,6 +925,8 @@ export async function pullResourcesToWorkspace(input) {
|
|
|
905
925
|
pruneOrphans: input.pruneOrphans === true,
|
|
906
926
|
}));
|
|
907
927
|
}
|
|
928
|
+
if (resources.includes('application'))
|
|
929
|
+
pulls.applications = await runMigrationStage('source pull', 'application', input.sourceLabel, () => pullApplicationsToWorkspace({ client, cwd: input.cwd, envName: input.sourceKey, stableKeyName, force: input.force, pruneOrphans: input.pruneOrphans, allowUnsupported: resources.length > 1 }));
|
|
908
930
|
if (resources.includes('endpoint')) {
|
|
909
931
|
pulls.endpoints = await runMigrationStage('source pull', 'endpoint', input.sourceLabel, () => pullEndpointsToWorkspace({
|
|
910
932
|
client,
|
|
@@ -1131,6 +1153,7 @@ async function planWorkspace(input) {
|
|
|
1131
1153
|
: {}),
|
|
1132
1154
|
}))
|
|
1133
1155
|
: undefined;
|
|
1156
|
+
const applications = resources.includes('application') ? await planStage('target plan', 'application', environmentLabel, () => buildApplicationsPlan({ client, cwd: input.cwd, envName: environmentKey, stableKeyName, projectedServiceAccounts: identities?.projection.serviceAccounts, projectedGroups: identities?.projection.groups, allowUnsupported: resources.length > 1 })) : undefined;
|
|
1134
1157
|
const endpoints = resources.includes('endpoint')
|
|
1135
1158
|
? await planStage('target plan', 'endpoint', environmentLabel, () => buildEndpointsPlan({
|
|
1136
1159
|
client,
|
|
@@ -1138,6 +1161,7 @@ async function planWorkspace(input) {
|
|
|
1138
1161
|
envName: environmentKey,
|
|
1139
1162
|
stableKeyName,
|
|
1140
1163
|
includeDependencyBlockers: input.sourceMode === 'workspace',
|
|
1164
|
+
projectedApplications: applications?.items.filter(item => item.desiredHash && applicationItemAction(item) !== 'blocked').map(item => ({ key: item.stableKey, desiredHash: item.desiredHash, state: item.status === 'create' ? 'pending-create' : item.status === 'clean' ? 'ready' : 'pending-update' })),
|
|
1141
1165
|
projectedServiceAccounts: identities?.projection.serviceAccounts,
|
|
1142
1166
|
...(input.projectDependencies === true && components
|
|
1143
1167
|
? { projectedComponents: projectedComponentDependencies(components) }
|
|
@@ -1197,6 +1221,7 @@ async function planWorkspace(input) {
|
|
|
1197
1221
|
databaseViews,
|
|
1198
1222
|
components,
|
|
1199
1223
|
jobTemplates,
|
|
1224
|
+
applications,
|
|
1200
1225
|
endpoints,
|
|
1201
1226
|
schedules,
|
|
1202
1227
|
events,
|
|
@@ -1332,6 +1357,9 @@ export async function runMigration(input) {
|
|
|
1332
1357
|
const environmentKey = targetKey(input);
|
|
1333
1358
|
const phaseResults = {};
|
|
1334
1359
|
const results = [];
|
|
1360
|
+
let verifiedApplications;
|
|
1361
|
+
const verifiedServiceAccounts = [];
|
|
1362
|
+
const verifiedGroups = [];
|
|
1335
1363
|
const pendingEvents = [];
|
|
1336
1364
|
const pendingSchedules = [];
|
|
1337
1365
|
let remainingPrune = initialPlan.prune;
|
|
@@ -1376,6 +1404,7 @@ export async function runMigration(input) {
|
|
|
1376
1404
|
databaseViews: initialPlan.databaseViews,
|
|
1377
1405
|
components: initialPlan.components,
|
|
1378
1406
|
jobTemplates: initialPlan.jobTemplates,
|
|
1407
|
+
applications: initialPlan.applications,
|
|
1379
1408
|
endpoints: initialPlan.endpoints,
|
|
1380
1409
|
schedules: initialPlan.schedules,
|
|
1381
1410
|
events: initialPlan.events,
|
|
@@ -1472,8 +1501,8 @@ export async function runMigration(input) {
|
|
|
1472
1501
|
}
|
|
1473
1502
|
for (const node of identityRun.ordered) {
|
|
1474
1503
|
const pushed = node.resource === 'service-account'
|
|
1475
|
-
? await pushServiceAccounts({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true, onlyStableKeys: [node.stableKey] })
|
|
1476
|
-
: await deployStage('group', () => pushGroups({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true, onlyStableKeys: [node.stableKey] }));
|
|
1504
|
+
? await pushServiceAccounts({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true, onlyStableKeys: [node.stableKey], reviewedPlan: initialPlan.serviceAccounts })
|
|
1505
|
+
: await deployStage('group', () => pushGroups({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true, onlyStableKeys: [node.stableKey], reviewedPlan: initialPlan.groups }));
|
|
1477
1506
|
const relevant = pushed.results.filter((item) => item.stableKey === node.stableKey);
|
|
1478
1507
|
phaseResults[node.resource] = [...(phaseResults[node.resource] || []), ...relevant];
|
|
1479
1508
|
results.push(...relevant);
|
|
@@ -1482,7 +1511,7 @@ export async function runMigration(input) {
|
|
|
1482
1511
|
}
|
|
1483
1512
|
}
|
|
1484
1513
|
if (resources.includes('service-account')) {
|
|
1485
|
-
const pushed = await pushServiceAccounts({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true });
|
|
1514
|
+
const pushed = await pushServiceAccounts({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, force: true, reviewedPlan: initialPlan.serviceAccounts ? { ...initialPlan.serviceAccounts, items: initialPlan.serviceAccounts.items.filter(item => !(phaseResults['service-account'] || []).some(prior => 'stableKey' in prior && prior.stableKey === item.stableKey)) } : undefined });
|
|
1486
1515
|
const remaining = pushed.results.filter((item) => !(phaseResults['service-account'] || []).some((prior) => 'stableKey' in prior && prior.stableKey === item.stableKey));
|
|
1487
1516
|
phaseResults['service-account'] = [...(phaseResults['service-account'] || []), ...remaining];
|
|
1488
1517
|
results.push(...remaining);
|
|
@@ -1491,6 +1520,24 @@ export async function runMigration(input) {
|
|
|
1491
1520
|
}
|
|
1492
1521
|
}
|
|
1493
1522
|
}
|
|
1523
|
+
for (const result of phaseResults.group ?? []) {
|
|
1524
|
+
if (!('verifiedGroup' in result) || !result.verifiedGroup)
|
|
1525
|
+
continue;
|
|
1526
|
+
const receipt = result.verifiedGroup;
|
|
1527
|
+
const reviewed = initialPlan.groups?.items.find(item => item.stableKey === receipt.stableKey);
|
|
1528
|
+
if (!reviewed?.desiredHash || reviewed.desiredHash !== receipt.desiredHash)
|
|
1529
|
+
throw new Error('Verified Group does not match the reviewed identity source.');
|
|
1530
|
+
verifiedGroups.push(receipt);
|
|
1531
|
+
}
|
|
1532
|
+
for (const result of phaseResults['service-account'] ?? []) {
|
|
1533
|
+
if (!('verifiedServiceAccount' in result) || !result.verifiedServiceAccount)
|
|
1534
|
+
continue;
|
|
1535
|
+
const receipt = result.verifiedServiceAccount;
|
|
1536
|
+
const reviewed = initialPlan.serviceAccounts?.items.find(item => item.stableKey === receipt.stableKey);
|
|
1537
|
+
if (!reviewed?.desiredHash || reviewed.desiredHash !== receipt.desiredHash)
|
|
1538
|
+
throw new Error('Verified Service Account does not match the reviewed identity source.');
|
|
1539
|
+
verifiedServiceAccounts.push(receipt);
|
|
1540
|
+
}
|
|
1494
1541
|
for (const family of ['agent-plugin', 'agent'])
|
|
1495
1542
|
if (resources.includes(family)) {
|
|
1496
1543
|
const pushed = await deployStage(family, () => pushAgents({ client: targetClient, cwd: input.cwd, envName: environmentKey, stableKeyName, family, force: true }));
|
|
@@ -1533,6 +1580,15 @@ export async function runMigration(input) {
|
|
|
1533
1580
|
return { ...base, verdict: 'failed', results, phaseResults, verification };
|
|
1534
1581
|
}
|
|
1535
1582
|
}
|
|
1583
|
+
if (resources.includes('application')) {
|
|
1584
|
+
const pushed = await deployStage('application', () => pushApplications({ client: targetClient, cwd: input.cwd,
|
|
1585
|
+
envName: environmentKey, stableKeyName, verifiedServiceAccounts, verifiedGroups, force: true, allowUnsupported: resources.length > 1, reviewedPlan: initialPlan.applications }));
|
|
1586
|
+
phaseResults.application = pushed.results;
|
|
1587
|
+
verifiedApplications = pushed.results.flatMap(item => item.verifiedApplication ? [item.verifiedApplication] : []);
|
|
1588
|
+
results.push(...pushed.results);
|
|
1589
|
+
if (!resultsAreComplete(pushed.results))
|
|
1590
|
+
return { ...base, verdict: 'failed', results, phaseResults };
|
|
1591
|
+
}
|
|
1536
1592
|
if (resources.includes('endpoint')) {
|
|
1537
1593
|
const liveEndpointPlan = await runMigrationStage('target plan', 'endpoint', targetLabel(input), () => buildEndpointsPlan({
|
|
1538
1594
|
client: targetClient,
|
|
@@ -1540,6 +1596,9 @@ export async function runMigration(input) {
|
|
|
1540
1596
|
envName: environmentKey,
|
|
1541
1597
|
stableKeyName,
|
|
1542
1598
|
includeDependencyBlockers: input.sourceMode === 'workspace',
|
|
1599
|
+
verifiedApplications,
|
|
1600
|
+
verifiedServiceAccounts,
|
|
1601
|
+
reviewedPlan: initialPlan.endpoints,
|
|
1543
1602
|
}), input.onProgress);
|
|
1544
1603
|
const liveEndpointPhase = summarizeEndpointPhase(liveEndpointPlan);
|
|
1545
1604
|
if (!liveEndpointPhase.readyToMigrate) {
|
|
@@ -1556,6 +1615,9 @@ export async function runMigration(input) {
|
|
|
1556
1615
|
envName: environmentKey,
|
|
1557
1616
|
stableKeyName,
|
|
1558
1617
|
force: true,
|
|
1618
|
+
verifiedApplications,
|
|
1619
|
+
verifiedServiceAccounts,
|
|
1620
|
+
reviewedPlan: initialPlan.endpoints,
|
|
1559
1621
|
}));
|
|
1560
1622
|
phaseResults.endpoint = pushed.results;
|
|
1561
1623
|
results.push(...pushed.results);
|
|
@@ -1664,6 +1726,7 @@ export async function runMigration(input) {
|
|
|
1664
1726
|
envName: environmentKey,
|
|
1665
1727
|
stableKeyName,
|
|
1666
1728
|
force: true,
|
|
1729
|
+
reviewedPlan: initialPlan.groups ? { ...initialPlan.groups, items: initialPlan.groups.items.filter(item => !(phaseResults.group || []).some(prior => 'stableKey' in prior && prior.stableKey === item.stableKey)) } : undefined,
|
|
1667
1730
|
}));
|
|
1668
1731
|
const groupRemaining = pushed.results.filter((item) => !(phaseResults.group || []).some((prior) => 'stableKey' in prior && prior.stableKey === item.stableKey));
|
|
1669
1732
|
phaseResults.group = [...(phaseResults.group || []), ...groupRemaining];
|
package/dist/src/project.d.ts
CHANGED
|
@@ -31,7 +31,14 @@ export type EditorTypesBundle = {
|
|
|
31
31
|
hash?: string;
|
|
32
32
|
lastSyncAt?: string;
|
|
33
33
|
};
|
|
34
|
+
export type ApplicationUserMapping = {
|
|
35
|
+
sourceInstanceId: string;
|
|
36
|
+
sourceUserId: string;
|
|
37
|
+
targetUserId: string;
|
|
38
|
+
};
|
|
34
39
|
export type RevoProjectMetadata = {
|
|
40
|
+
/** Explicit human-account mapping by selected environment; never inferred from email. */
|
|
41
|
+
applicationUserMappings?: Record<string, ApplicationUserMapping[]>;
|
|
35
42
|
schemaVersion: 1;
|
|
36
43
|
endpoint: string;
|
|
37
44
|
authProfile: string;
|
|
@@ -78,7 +85,7 @@ export declare function buildEditorTypesUrl(endpoint: string): string;
|
|
|
78
85
|
export declare function buildSandboxDebugUrl(endpoint: string): string;
|
|
79
86
|
export declare function buildSandboxDebugStreamUrl(endpoint: string): string;
|
|
80
87
|
export declare function extractSandboxEndpoint(profile: unknown): string | null;
|
|
81
|
-
export declare function extractServiceEndpoint(profile: unknown, service: 'sandbox' | 'run'): string | null;
|
|
88
|
+
export declare function extractServiceEndpoint(profile: unknown, service: 'sandbox' | 'run' | 'app'): string | null;
|
|
82
89
|
export declare function buildProjectMetadata(input: {
|
|
83
90
|
baseUrl: string;
|
|
84
91
|
bundle: EditorTypesBundle;
|
package/dist/src/project.js
CHANGED
|
@@ -322,6 +322,8 @@ export function extractServiceEndpoint(profile, service) {
|
|
|
322
322
|
}
|
|
323
323
|
const candidate = profile;
|
|
324
324
|
const roots = [candidate];
|
|
325
|
+
if (isRecord(candidate.data))
|
|
326
|
+
roots.push(candidate.data);
|
|
325
327
|
const nestedProfile = candidate.profile;
|
|
326
328
|
if (nestedProfile && typeof nestedProfile === 'object' && !Array.isArray(nestedProfile)) {
|
|
327
329
|
roots.push(nestedProfile);
|
|
@@ -494,7 +496,9 @@ export function syncProjectFiles(layoutOrTargetDir, input) {
|
|
|
494
496
|
schemaVersion: 1,
|
|
495
497
|
definitions: input.definitions,
|
|
496
498
|
});
|
|
499
|
+
const previousMetadata = readProjectMetadata(projectRoot);
|
|
497
500
|
writeJsonFile(metadataFile, {
|
|
501
|
+
...(previousMetadata?.applicationUserMappings === undefined ? {} : { applicationUserMappings: previousMetadata.applicationUserMappings }),
|
|
498
502
|
schemaVersion: 1,
|
|
499
503
|
endpoint: input.endpoint,
|
|
500
504
|
authProfile: input.authProfile || 'default',
|
|
@@ -9,10 +9,15 @@ export type RequestContractSchema = {
|
|
|
9
9
|
nullable?: boolean;
|
|
10
10
|
items?: RequestContractSchema;
|
|
11
11
|
enum?: readonly unknown[];
|
|
12
|
+
notEnum?: readonly unknown[];
|
|
13
|
+
applicationCors?: boolean;
|
|
14
|
+
applicationInvocationPolicy?: boolean;
|
|
15
|
+
applicationAnonymousAccess?: boolean;
|
|
12
16
|
minimum?: number;
|
|
13
17
|
maximum?: number;
|
|
14
18
|
minLength?: number;
|
|
15
19
|
maxLength?: number;
|
|
20
|
+
minItems?: number;
|
|
16
21
|
maxItems?: number;
|
|
17
22
|
nonBlank?: boolean;
|
|
18
23
|
pattern?: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { requestContracts as generatedContracts, requestContractDefaults } from "./automation-contract.generated.js";
|
|
2
|
+
import { validApplicationAnonymousAccess, validApplicationInvocationPolicy } from "./application-access.js";
|
|
3
|
+
import { validApplicationCors } from "./application-cors.js";
|
|
2
4
|
export const requestContracts = generatedContracts;
|
|
3
5
|
export { requestContractDefaults };
|
|
4
6
|
// Matches the backend class-validator default UUID mode (validator.js 13.15.35):
|
|
@@ -93,6 +95,14 @@ export function validateRequestContract(name, value, options = {}) {
|
|
|
93
95
|
}
|
|
94
96
|
if (rule.enum && !rule.enum.includes(input))
|
|
95
97
|
errors.push(`${label} must be one of ${rule.enum.join(', ')}`);
|
|
98
|
+
if (rule.notEnum?.includes(input))
|
|
99
|
+
errors.push(`${label} uses a reserved value`);
|
|
100
|
+
if (rule.applicationInvocationPolicy && !validApplicationInvocationPolicy(input))
|
|
101
|
+
errors.push(`${label} requires an explicit typed Application invocation policy`);
|
|
102
|
+
if (rule.applicationAnonymousAccess && !validApplicationAnonymousAccess(input))
|
|
103
|
+
errors.push(`${label} requires enabled, requestsPerMinute 1..1000 and maxConcurrent 1..10`);
|
|
104
|
+
if (rule.applicationCors && !validApplicationCors(input))
|
|
105
|
+
errors.push(`${label} requires a valid Application CORS policy with exact origins`);
|
|
96
106
|
if (typeof input === 'number') {
|
|
97
107
|
if (rule.minimum !== undefined && input < rule.minimum)
|
|
98
108
|
errors.push(`${label} must be at least ${rule.minimum}`);
|
|
@@ -114,6 +124,8 @@ export function validateRequestContract(name, value, options = {}) {
|
|
|
114
124
|
if (rule.userMetadata)
|
|
115
125
|
errors.push(...validateUserMetadata(input, label));
|
|
116
126
|
if (Array.isArray(input)) {
|
|
127
|
+
if (rule.minItems !== undefined && input.length < rule.minItems)
|
|
128
|
+
errors.push(`${label} must contain at least ${rule.minItems} items`);
|
|
117
129
|
if (rule.maxItems !== undefined && input.length > rule.maxItems)
|
|
118
130
|
errors.push(`${label} must contain at most ${rule.maxItems} items`);
|
|
119
131
|
if (rule.items)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { RevoClient } from './client.ts';
|
|
2
2
|
import type { TrackableResourceType } from './tracked-resources.ts';
|
|
3
|
-
import type { AgentRecord, AgentPluginRecord, ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord, ServiceAccountRecord } from './types.ts';
|
|
3
|
+
import type { AgentRecord, AgentPluginRecord, ApplicationRecord, ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord, ServiceAccountRecord } from './types.ts';
|
|
4
4
|
type ResourceRecordMap = {
|
|
5
|
+
application: ApplicationRecord;
|
|
5
6
|
agent: AgentRecord;
|
|
6
7
|
'agent-plugin': AgentPluginRecord;
|
|
7
8
|
'service-account': ServiceAccountRecord;
|
|
@@ -16,9 +17,10 @@ type ResourceRecordMap = {
|
|
|
16
17
|
event: EventRecord;
|
|
17
18
|
};
|
|
18
19
|
export type ResourceRecord = ResourceRecordMap[TrackableResourceType];
|
|
19
|
-
export type ResourceInventoryClient = Pick<RevoClient, 'listAllAgents' | 'getAgent' | 'listAllAgentPlugins' | 'getAgentPlugin' | 'listAllServiceAccounts' | 'getServiceAccount' | 'listAllComponents' | 'getComponent' | 'listAllDatabaseSchemas' | 'listAllDatabaseViewsForSync' | 'listAllEndpoints' | 'getEndpoint' | 'listAllRoleGroups' | 'getRoleGroup' | 'listAllGroups' | 'getGroup' | 'listAllJobTemplates' | 'getJobTemplate' | 'listAllSchedules' | 'getSchedule' | 'listAllEvents' | 'getEvent'>;
|
|
20
|
+
export type ResourceInventoryClient = Pick<RevoClient, 'listAllApplications' | 'listAllAgents' | 'getAgent' | 'listAllAgentPlugins' | 'getAgentPlugin' | 'listAllServiceAccounts' | 'getServiceAccount' | 'listAllComponents' | 'getComponent' | 'listAllDatabaseSchemas' | 'listAllDatabaseViewsForSync' | 'listAllEndpoints' | 'getEndpoint' | 'listAllRoleGroups' | 'getRoleGroup' | 'listAllGroups' | 'getGroup' | 'listAllJobTemplates' | 'getJobTemplate' | 'listAllSchedules' | 'getSchedule' | 'listAllEvents' | 'getEvent'>;
|
|
20
21
|
type InventoryOptions = {
|
|
21
22
|
skipPartitions?: boolean;
|
|
23
|
+
allowUnsupportedApplications?: boolean;
|
|
22
24
|
};
|
|
23
25
|
type InventoryEntry<T> = {
|
|
24
26
|
listedId: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applicationApiUnavailable, loadRemoteApplications } from "./resource-syncs/application-sync.js";
|
|
1
2
|
import { HTTP_REQUEST_CONCURRENCY } from "./request-queue.js";
|
|
2
3
|
import { mapWithConcurrency } from "./utils.js";
|
|
3
4
|
export function unwrapResource(value) {
|
|
@@ -10,7 +11,8 @@ export function unwrapResource(value) {
|
|
|
10
11
|
return value;
|
|
11
12
|
}
|
|
12
13
|
export function resourceIdOf(resource) {
|
|
13
|
-
return String(('
|
|
14
|
+
return String(('serviceId' in resource && !('endpointId' in resource) && resource.serviceId)
|
|
15
|
+
|| ('agentId' in resource && resource.agentId)
|
|
14
16
|
|| ('agentPluginId' in resource && resource.agentPluginId)
|
|
15
17
|
|| ('userId' in resource && resource.userId)
|
|
16
18
|
|| ('databaseId' in resource && resource.databaseId)
|
|
@@ -37,6 +39,19 @@ async function* readDetails(summaries, getDetail) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
const readers = {
|
|
42
|
+
async *application(client, options) {
|
|
43
|
+
let records;
|
|
44
|
+
try {
|
|
45
|
+
records = await loadRemoteApplications(client);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (options.allowUnsupportedApplications && applicationApiUnavailable(error))
|
|
49
|
+
return;
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
for (const resource of records)
|
|
53
|
+
yield { listedId: resource.serviceId, resource };
|
|
54
|
+
},
|
|
40
55
|
async *agent(client) {
|
|
41
56
|
const { agents } = await client.listAllAgents();
|
|
42
57
|
yield* readDetails(agents, (id) => client.getAgent(id));
|
|
@@ -38,3 +38,5 @@ export declare function validPortableExecutionPolicy(value: unknown, allowCurren
|
|
|
38
38
|
export declare function portableExecutionPolicy(client: RevoClient, policy: RuntimeExecutionPolicy | null | undefined, stableKeyName: string): Promise<PortableExecutionPolicy | undefined>;
|
|
39
39
|
export declare function runtimeExecutionPolicyPayload(client: RevoClient, policy: PortableExecutionPolicy | undefined, stableKeyName: string): Promise<RuntimeExecutionPolicy | undefined>;
|
|
40
40
|
export declare function executionPrincipalAvailable(client: RevoClient, principal: ExecutionPrincipal, stableKeyName: string, projected?: string[], requireExecutionAccess?: boolean): Promise<boolean>;
|
|
41
|
+
/** Sanitized account readback only; never credentials. */
|
|
42
|
+
export declare function serviceAccountRevisionHash(record: ServiceAccountRecord): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApiError } from "../client.js";
|
|
2
|
+
import { hashStable } from "../component-lock.js";
|
|
2
3
|
import { readConfiguredResourceMetadataStableKey } from "../resource-metadata.js";
|
|
3
4
|
import { unwrapData } from "./util.js";
|
|
4
5
|
export const SYSTEM_ACCOUNT_ID = '00000000-0000-0000-0000-000000000000';
|
|
@@ -174,3 +175,5 @@ export async function executionPrincipalAvailable(client, principal, stableKeyNa
|
|
|
174
175
|
}
|
|
175
176
|
return matches.length === 0 && projected.includes(principal.stableKey);
|
|
176
177
|
}
|
|
178
|
+
/** Sanitized account readback only; never credentials. */
|
|
179
|
+
export function serviceAccountRevisionHash(record) { return hashStable(record); }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RevoClient } from '../client.ts';
|
|
2
|
+
import type { ApplicationInvocationPolicy } from '../types.ts';
|
|
3
|
+
import { type ExecutionPrincipal } from './account-principal.ts';
|
|
4
|
+
import { type ApplicationUserMapping } from '../project.ts';
|
|
5
|
+
export type PortableApplicationUser = {
|
|
6
|
+
instanceId: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
};
|
|
9
|
+
export type PortableApplicationGroup = {
|
|
10
|
+
type: 'group';
|
|
11
|
+
stableKey: string;
|
|
12
|
+
};
|
|
13
|
+
export type PortableApplicationInvocationPolicy = {
|
|
14
|
+
mode: ApplicationInvocationPolicy['mode'];
|
|
15
|
+
users: PortableApplicationUser[];
|
|
16
|
+
serviceAccounts: ExecutionPrincipal[];
|
|
17
|
+
groups?: PortableApplicationGroup[];
|
|
18
|
+
};
|
|
19
|
+
export declare function validPortableApplicationInvocationPolicy(value: unknown): value is PortableApplicationInvocationPolicy;
|
|
20
|
+
export declare function applicationUserMappings(cwd: string, envName: string): ApplicationUserMapping[];
|
|
21
|
+
export declare function portableApplicationInvocationPolicy(client: RevoClient, policy: ApplicationInvocationPolicy, stableKeyName: string): Promise<PortableApplicationInvocationPolicy>;
|
|
22
|
+
export declare function resolveApplicationInvocationPolicy(input: {
|
|
23
|
+
client: RevoClient;
|
|
24
|
+
cwd: string;
|
|
25
|
+
envName: string;
|
|
26
|
+
stableKeyName?: string;
|
|
27
|
+
}, policy: PortableApplicationInvocationPolicy): Promise<ApplicationInvocationPolicy>;
|
|
28
|
+
/** A planned new SA is validated by the identity stage before Application upsert. */
|
|
29
|
+
export declare function canonicalApplicationInvocationPolicy(input: {
|
|
30
|
+
client: RevoClient;
|
|
31
|
+
cwd: string;
|
|
32
|
+
envName: string;
|
|
33
|
+
stableKeyName?: string;
|
|
34
|
+
projectedServiceAccounts?: string[];
|
|
35
|
+
projectedGroups?: string[];
|
|
36
|
+
}, policy: PortableApplicationInvocationPolicy): Promise<PortableApplicationInvocationPolicy>;
|
|
37
|
+
export type ApplicationPrincipalFence = {
|
|
38
|
+
principal: ExecutionPrincipal;
|
|
39
|
+
userId?: string;
|
|
40
|
+
revisionHash?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function applicationPrincipalFences(input: {
|
|
43
|
+
client: RevoClient;
|
|
44
|
+
stableKeyName?: string;
|
|
45
|
+
projectedServiceAccounts?: string[];
|
|
46
|
+
}, policy?: PortableApplicationInvocationPolicy | null): Promise<ApplicationPrincipalFence[]>;
|
|
47
|
+
export declare function applicationHumanFences(client: RevoClient, policy?: PortableApplicationInvocationPolicy | null): Promise<Array<{
|
|
48
|
+
userId: string;
|
|
49
|
+
revisionHash: string;
|
|
50
|
+
}>>;
|
|
51
|
+
export type ApplicationGroupFence = {
|
|
52
|
+
reference: PortableApplicationGroup;
|
|
53
|
+
groupId?: string;
|
|
54
|
+
revisionHash?: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function applicationGroupFences(input: {
|
|
57
|
+
client: RevoClient;
|
|
58
|
+
stableKeyName?: string;
|
|
59
|
+
projectedGroups?: string[];
|
|
60
|
+
}, policy?: PortableApplicationInvocationPolicy | null): Promise<ApplicationGroupFence[]>;
|