@ankhorage/studio 2.6.3 → 2.7.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/README.md +1 -1
- package/apm/update.json +1 -1
- package/dist/authSettings.d.ts +5 -3
- package/dist/authSettings.d.ts.map +1 -1
- package/dist/authSettings.js +61 -49
- package/dist/authSettings.js.map +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/core/studioManifestDraftModel.d.ts.map +1 -1
- package/dist/core/studioManifestDraftModel.js +9 -2
- package/dist/core/studioManifestDraftModel.js.map +1 -1
- package/dist/features/infrastructure/adapters/outbound/createStudioInfraAdapterPackageResolver.d.ts +4 -0
- package/dist/features/infrastructure/adapters/outbound/createStudioInfraAdapterPackageResolver.d.ts.map +1 -0
- package/dist/features/infrastructure/adapters/outbound/createStudioInfraAdapterPackageResolver.js +22 -0
- package/dist/features/infrastructure/adapters/outbound/createStudioInfraAdapterPackageResolver.js.map +1 -0
- package/dist/features/infrastructure/application/use-cases/initializeProjectLocalInfraNetworking.d.ts +4 -0
- package/dist/features/infrastructure/application/use-cases/initializeProjectLocalInfraNetworking.d.ts.map +1 -0
- package/dist/features/infrastructure/application/use-cases/initializeProjectLocalInfraNetworking.js +36 -0
- package/dist/features/infrastructure/application/use-cases/initializeProjectLocalInfraNetworking.js.map +1 -0
- package/dist/features/infrastructure/composition/createStudioProjectInfraLifecycle.d.ts +27 -0
- package/dist/features/infrastructure/composition/createStudioProjectInfraLifecycle.d.ts.map +1 -0
- package/dist/features/infrastructure/composition/createStudioProjectInfraLifecycle.js +67 -0
- package/dist/features/infrastructure/composition/createStudioProjectInfraLifecycle.js.map +1 -0
- package/dist/features/project-updates/adapters/outbound/inspectPendingModuleLifecycleEvidenceAsync.d.ts.map +1 -1
- package/dist/features/project-updates/adapters/outbound/inspectPendingModuleLifecycleEvidenceAsync.js +23 -59
- package/dist/features/project-updates/adapters/outbound/inspectPendingModuleLifecycleEvidenceAsync.js.map +1 -1
- package/dist/features/project-updates/adapters/outbound/readPendingModuleLifecycleStateAsync.d.ts +21 -0
- package/dist/features/project-updates/adapters/outbound/readPendingModuleLifecycleStateAsync.d.ts.map +1 -0
- package/dist/features/project-updates/adapters/outbound/readPendingModuleLifecycleStateAsync.js +35 -0
- package/dist/features/project-updates/adapters/outbound/readPendingModuleLifecycleStateAsync.js.map +1 -0
- package/dist/features/project-updates/adapters/outbound/readStudioManifestDigestAsync.d.ts +3 -0
- package/dist/features/project-updates/adapters/outbound/readStudioManifestDigestAsync.d.ts.map +1 -0
- package/dist/features/project-updates/adapters/outbound/readStudioManifestDigestAsync.js +9 -0
- package/dist/features/project-updates/adapters/outbound/readStudioManifestDigestAsync.js.map +1 -0
- package/dist/features/project-updates/adapters/outbound/resolveCurrentStudioApmArtifactAsync.d.ts +15 -0
- package/dist/features/project-updates/adapters/outbound/resolveCurrentStudioApmArtifactAsync.d.ts.map +1 -0
- package/dist/features/project-updates/adapters/outbound/resolveCurrentStudioApmArtifactAsync.js +32 -0
- package/dist/features/project-updates/adapters/outbound/resolveCurrentStudioApmArtifactAsync.js.map +1 -0
- package/dist/features/project-updates/application/StudioPendingModuleLifecyclePort.d.ts +6 -0
- package/dist/features/project-updates/application/StudioPendingModuleLifecyclePort.d.ts.map +1 -0
- package/dist/features/project-updates/application/StudioPendingModuleLifecyclePort.js +2 -0
- package/dist/features/project-updates/application/StudioPendingModuleLifecyclePort.js.map +1 -0
- package/dist/features/project-updates/application/planPendingModuleLifecycleAsync.d.ts +15 -0
- package/dist/features/project-updates/application/planPendingModuleLifecycleAsync.d.ts.map +1 -0
- package/dist/features/project-updates/application/planPendingModuleLifecycleAsync.js +214 -0
- package/dist/features/project-updates/application/planPendingModuleLifecycleAsync.js.map +1 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.d.ts +5 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.d.ts.map +1 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.js +171 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.js.map +1 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.d.ts +9 -3
- package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.d.ts.map +1 -1
- package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.js +51 -12
- package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.js.map +1 -1
- package/dist/features/project-updates/composition/createStudioProjectUpdateService.d.ts +3 -2
- package/dist/features/project-updates/composition/createStudioProjectUpdateService.d.ts.map +1 -1
- package/dist/features/project-updates/composition/createStudioProjectUpdateService.js +13 -3
- package/dist/features/project-updates/composition/createStudioProjectUpdateService.js.map +1 -1
- package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.d.ts +5 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.d.ts.map +1 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.js +67 -0
- package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.js.map +1 -0
- package/dist/features/project-updates/domain/pendingModuleLifecycleState.d.ts +24 -0
- package/dist/features/project-updates/domain/pendingModuleLifecycleState.d.ts.map +1 -0
- package/dist/features/project-updates/domain/pendingModuleLifecycleState.js +48 -0
- package/dist/features/project-updates/domain/pendingModuleLifecycleState.js.map +1 -0
- package/dist/features/project-updates/domain/pendingModulePlanStep.d.ts +10 -0
- package/dist/features/project-updates/domain/pendingModulePlanStep.d.ts.map +1 -0
- package/dist/features/project-updates/domain/pendingModulePlanStep.js +25 -0
- package/dist/features/project-updates/domain/pendingModulePlanStep.js.map +1 -0
- package/dist/host/auth/projectAuthHealthService.d.ts +3 -4
- package/dist/host/auth/projectAuthHealthService.d.ts.map +1 -1
- package/dist/host/auth/projectAuthHealthService.js +14 -12
- package/dist/host/auth/projectAuthHealthService.js.map +1 -1
- package/dist/host/auth/projectAuthRuntimeDiagnostics.d.ts +10 -23
- package/dist/host/auth/projectAuthRuntimeDiagnostics.d.ts.map +1 -1
- package/dist/host/auth/projectAuthRuntimeDiagnostics.js +54 -118
- package/dist/host/auth/projectAuthRuntimeDiagnostics.js.map +1 -1
- package/dist/host/createStudioHost.d.ts +3 -3
- package/dist/host/createStudioHost.d.ts.map +1 -1
- package/dist/host/createStudioHost.js +5 -7
- package/dist/host/createStudioHost.js.map +1 -1
- package/dist/host/http/projectRuntimeRoutes.d.ts +2 -4
- package/dist/host/http/projectRuntimeRoutes.d.ts.map +1 -1
- package/dist/host/http/projectRuntimeRoutes.js +15 -44
- package/dist/host/http/projectRuntimeRoutes.js.map +1 -1
- package/dist/host/http/server.d.ts.map +1 -1
- package/dist/host/http/server.js +5 -91
- package/dist/host/http/server.js.map +1 -1
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js +2 -2
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js.map +1 -1
- package/dist/host/layout/layoutGenerator.d.ts.map +1 -1
- package/dist/host/layout/layoutGenerator.js +17 -13
- package/dist/host/layout/layoutGenerator.js.map +1 -1
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js +1 -1
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js.map +1 -1
- package/dist/host/media/projectMediaStorage.d.ts +1 -1
- package/dist/host/media/projectMediaStorage.d.ts.map +1 -1
- package/dist/host/media/projectMediaStorage.js +19 -28
- package/dist/host/media/projectMediaStorage.js.map +1 -1
- package/dist/host/orchestrator/createHostModuleOrchestrator.d.ts +4 -0
- package/dist/host/orchestrator/createHostModuleOrchestrator.d.ts.map +1 -0
- package/dist/host/orchestrator/createHostModuleOrchestrator.js +10 -0
- package/dist/host/orchestrator/createHostModuleOrchestrator.js.map +1 -0
- package/dist/host/orchestrator/createStudioPendingModuleLifecyclePort.d.ts +4 -0
- package/dist/host/orchestrator/createStudioPendingModuleLifecyclePort.d.ts.map +1 -0
- package/dist/host/orchestrator/createStudioPendingModuleLifecyclePort.js +20 -0
- package/dist/host/orchestrator/createStudioPendingModuleLifecyclePort.js.map +1 -0
- package/dist/host/orchestrator/moduleManager.d.ts.map +1 -1
- package/dist/host/orchestrator/moduleManager.js +6 -9
- package/dist/host/orchestrator/moduleManager.js.map +1 -1
- package/dist/host/orchestrator/projectManager.d.ts +16 -21
- package/dist/host/orchestrator/projectManager.d.ts.map +1 -1
- package/dist/host/orchestrator/projectManager.js +62 -55
- package/dist/host/orchestrator/projectManager.js.map +1 -1
- package/dist/host/orchestrator/studioInfraUp.d.ts +5 -11
- package/dist/host/orchestrator/studioInfraUp.d.ts.map +1 -1
- package/dist/host/orchestrator/studioInfraUp.js +8 -36
- package/dist/host/orchestrator/studioInfraUp.js.map +1 -1
- package/dist/host/secrets/projectSecretService.d.ts +2 -3
- package/dist/host/secrets/projectSecretService.d.ts.map +1 -1
- package/dist/host/secrets/projectSecretService.js +24 -46
- package/dist/host/secrets/projectSecretService.js.map +1 -1
- package/dist/host/secrets/resolveProjectSecretDatabaseUrl.d.ts +3 -5
- package/dist/host/secrets/resolveProjectSecretDatabaseUrl.d.ts.map +1 -1
- package/dist/host/secrets/resolveProjectSecretDatabaseUrl.js +4 -11
- package/dist/host/secrets/resolveProjectSecretDatabaseUrl.js.map +1 -1
- package/dist/host/secrets/trustedOAuthInfraEnvironment.d.ts.map +1 -1
- package/dist/host/secrets/trustedOAuthInfraEnvironment.js +2 -2
- package/dist/host/secrets/trustedOAuthInfraEnvironment.js.map +1 -1
- package/dist/manifestState.d.ts.map +1 -1
- package/dist/manifestState.js +13 -8
- package/dist/manifestState.js.map +1 -1
- package/dist/manifestSync.js +1 -1
- package/dist/manifestSync.js.map +1 -1
- package/dist/projectAuthApi.d.ts +2 -2
- package/dist/projectAuthApi.d.ts.map +1 -1
- package/dist/projectAuthApi.js +6 -6
- package/dist/projectAuthApi.js.map +1 -1
- package/dist/projectAuthHealth.d.ts +4 -3
- package/dist/projectAuthHealth.d.ts.map +1 -1
- package/dist/projectAuthHealth.js +8 -6
- package/dist/projectAuthHealth.js.map +1 -1
- package/dist/projectAuthRuntimeDiagnostics.d.ts +2 -1
- package/dist/projectAuthRuntimeDiagnostics.d.ts.map +1 -1
- package/dist/projectAuthRuntimeDiagnostics.js.map +1 -1
- package/dist/projectDeployRuntimeInput.d.ts +2 -2
- package/dist/projectDeployRuntimeInput.d.ts.map +1 -1
- package/dist/projectOAuthSetup.d.ts +4 -3
- package/dist/projectOAuthSetup.d.ts.map +1 -1
- package/dist/projectOAuthSetup.js +3 -2
- package/dist/projectOAuthSetup.js.map +1 -1
- package/dist/projectSecretUsage.js +17 -16
- package/dist/projectSecretUsage.js.map +1 -1
- package/dist/ui/admin/pages/AuthAdminPage.d.ts.map +1 -1
- package/dist/ui/admin/pages/AuthAdminPage.js +21 -10
- package/dist/ui/admin/pages/AuthAdminPage.js.map +1 -1
- package/dist/ui/admin/pages/OverviewAdminPage.js +1 -1
- package/dist/ui/admin/pages/OverviewAdminPage.js.map +1 -1
- package/dist/ui/admin/pages/adminAuthCredentialFlow.js +0 -1
- package/dist/ui/admin/pages/adminAuthCredentialFlow.js.map +1 -1
- package/dist/ui/admin/pages/deploy/DeployMonetizationSyncCard.d.ts.map +1 -1
- package/dist/ui/admin/pages/deploy/DeployMonetizationSyncCard.js +2 -2
- package/dist/ui/admin/pages/deploy/DeployMonetizationSyncCard.js.map +1 -1
- package/dist/ui/admin/pages/deploy/DeployReleaseOperationsCard.d.ts.map +1 -1
- package/dist/ui/admin/pages/deploy/DeployReleaseOperationsCard.js +2 -2
- package/dist/ui/admin/pages/deploy/DeployReleaseOperationsCard.js.map +1 -1
- package/package.json +9 -6
- package/dist/host/orchestrator/infraSession.d.ts +0 -31
- package/dist/host/orchestrator/infraSession.d.ts.map +0 -1
- package/dist/host/orchestrator/infraSession.js +0 -79
- package/dist/host/orchestrator/infraSession.js.map +0 -1
- package/dist/host/utils/trimOutput.d.ts +0 -11
- package/dist/host/utils/trimOutput.d.ts.map +0 -1
- package/dist/host/utils/trimOutput.js +0 -9
- package/dist/host/utils/trimOutput.js.map +0 -1
package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { readPendingModuleLifecycleStateAsync } from '../adapters/outbound/readPendingModuleLifecycleStateAsync';
|
|
2
|
+
import { readStudioManifestDigestAsync } from '../adapters/outbound/readStudioManifestDigestAsync';
|
|
3
|
+
import { readCurrentStudioApmArtifactBindingAsync } from '../adapters/outbound/resolveCurrentStudioApmArtifactAsync';
|
|
4
|
+
import { readReviewedPendingModuleStep } from '../domain/pendingModulePlanStep';
|
|
5
|
+
/*** Compose Studio pending-module execution around any pre-existing trusted owner step adapter. */
|
|
6
|
+
export function createStudioProjectUpdateApplyOwnerStepPort(lifecycle, base) {
|
|
7
|
+
return {
|
|
8
|
+
observeAsync: async (input) => {
|
|
9
|
+
const reviewed = readReviewedPendingModuleStep(input.step);
|
|
10
|
+
return reviewed === undefined
|
|
11
|
+
? delegateObservationAsync(base, input)
|
|
12
|
+
: observePendingModuleAsync(input.journal.rootPath, reviewed, lifecycle);
|
|
13
|
+
},
|
|
14
|
+
executeAsync: async (input) => {
|
|
15
|
+
const reviewed = readReviewedPendingModuleStep(input.step);
|
|
16
|
+
return reviewed === undefined
|
|
17
|
+
? delegateExecutionAsync(base, 'executeAsync', input)
|
|
18
|
+
: executePendingModuleAsync(input.journal.rootPath, reviewed, lifecycle);
|
|
19
|
+
},
|
|
20
|
+
rollbackAsync: async (input) => {
|
|
21
|
+
const reviewed = readReviewedPendingModuleStep(input.step);
|
|
22
|
+
return reviewed === undefined
|
|
23
|
+
? delegateExecutionAsync(base, 'rollbackAsync', input)
|
|
24
|
+
: unsupportedRollback(input.step.id);
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/*** Observe exact pending/manifest/artifact preconditions before one irreversible module effect. */
|
|
29
|
+
async function observePendingModuleAsync(rootPath, reviewed, lifecycle) {
|
|
30
|
+
const binding = await bindingObservationAsync(reviewed);
|
|
31
|
+
if (binding !== undefined)
|
|
32
|
+
return binding;
|
|
33
|
+
const pending = await pendingObservationAsync(rootPath, reviewed.pendingDigest);
|
|
34
|
+
if (pending !== undefined)
|
|
35
|
+
return pending;
|
|
36
|
+
const manifest = await manifestObservationAsync(rootPath, reviewed.manifestDigest);
|
|
37
|
+
if (manifest !== undefined)
|
|
38
|
+
return manifest;
|
|
39
|
+
const installed = await lifecycle.isModuleInstalledAsync(rootPath, reviewed.moduleId);
|
|
40
|
+
if (installed === undefined) {
|
|
41
|
+
return {
|
|
42
|
+
state: 'unknown',
|
|
43
|
+
evidence: [`module:${reviewed.moduleId}`],
|
|
44
|
+
reason: 'Orchestrator could not determine the reviewed module installation state.',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return installed
|
|
48
|
+
? { state: 'pending', evidence: [`module-installed:${reviewed.moduleId}`] }
|
|
49
|
+
: { state: 'satisfied', evidence: [`module-removed:${reviewed.moduleId}`] };
|
|
50
|
+
}
|
|
51
|
+
/*** Execute exactly one reviewed Orchestrator removal after all frozen preconditions still match. */
|
|
52
|
+
async function executePendingModuleAsync(rootPath, reviewed, lifecycle) {
|
|
53
|
+
const observation = await observePendingModuleAsync(rootPath, reviewed, lifecycle);
|
|
54
|
+
if (observation.state === 'satisfied')
|
|
55
|
+
return completed(observation.evidence);
|
|
56
|
+
if (observation.state !== 'pending')
|
|
57
|
+
return observationFailure(observation);
|
|
58
|
+
await lifecycle.removeModuleAsync(rootPath, reviewed.moduleId);
|
|
59
|
+
const installed = await lifecycle.isModuleInstalledAsync(rootPath, reviewed.moduleId);
|
|
60
|
+
if (installed === false)
|
|
61
|
+
return completed([`module-removed:${reviewed.moduleId}`]);
|
|
62
|
+
return installed === undefined
|
|
63
|
+
? {
|
|
64
|
+
state: 'unknown',
|
|
65
|
+
evidence: [`module:${reviewed.moduleId}`],
|
|
66
|
+
diagnostics: [],
|
|
67
|
+
failure: {
|
|
68
|
+
code: 'studio.pending-module-lifecycle.observation-unavailable',
|
|
69
|
+
reason: 'Module removal returned but its postcondition could not be observed.',
|
|
70
|
+
evidence: [reviewed.moduleId],
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
: failed('studio.pending-module-lifecycle.remove-incomplete', 'Orchestrator returned from removal but the reviewed module remains installed.', reviewed.moduleId);
|
|
74
|
+
}
|
|
75
|
+
/*** Reject a reviewed step when the running Studio package does not match its frozen owner artifact. */
|
|
76
|
+
async function bindingObservationAsync(reviewed) {
|
|
77
|
+
const binding = await readCurrentStudioApmArtifactBindingAsync();
|
|
78
|
+
const matches = reviewed.artifact.packageName === binding.packageName &&
|
|
79
|
+
reviewed.artifact.version === binding.version &&
|
|
80
|
+
reviewed.artifact.descriptorDigest === binding.descriptorDigest;
|
|
81
|
+
return matches
|
|
82
|
+
? undefined
|
|
83
|
+
: {
|
|
84
|
+
state: 'conflict',
|
|
85
|
+
evidence: [
|
|
86
|
+
`${reviewed.artifact.packageName}@${reviewed.artifact.version}`,
|
|
87
|
+
`${binding.packageName}@${binding.version}`,
|
|
88
|
+
reviewed.artifact.descriptorDigest,
|
|
89
|
+
binding.descriptorDigest,
|
|
90
|
+
],
|
|
91
|
+
reason: 'Loaded Studio owner code no longer matches the reviewed immutable artifact binding.',
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/*** Require the exact pending-state digest to remain unchanged until native APM file finalization. */
|
|
95
|
+
async function pendingObservationAsync(rootPath, expectedDigest) {
|
|
96
|
+
const pending = await readPendingModuleLifecycleStateAsync(rootPath);
|
|
97
|
+
if (pending.state === 'valid' && pending.digest === expectedDigest)
|
|
98
|
+
return undefined;
|
|
99
|
+
if (pending.state === 'unreadable') {
|
|
100
|
+
return {
|
|
101
|
+
state: 'unknown',
|
|
102
|
+
evidence: [pending.reason],
|
|
103
|
+
reason: 'Studio pending module lifecycle state cannot be read safely.',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
state: 'conflict',
|
|
108
|
+
evidence: [expectedDigest, pending.state === 'valid' ? pending.digest : pending.state],
|
|
109
|
+
reason: 'Studio pending module lifecycle state changed after the reviewed plan was created.',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/*** Require the canonical manifest to remain byte-identical before irreversible Orchestrator effects. */
|
|
113
|
+
async function manifestObservationAsync(rootPath, expectedDigest) {
|
|
114
|
+
try {
|
|
115
|
+
const actualDigest = await readStudioManifestDigestAsync(rootPath);
|
|
116
|
+
return actualDigest === expectedDigest
|
|
117
|
+
? undefined
|
|
118
|
+
: {
|
|
119
|
+
state: 'conflict',
|
|
120
|
+
evidence: [expectedDigest, actualDigest],
|
|
121
|
+
reason: 'Studio manifest changed after the reviewed pending-module plan was created.',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
state: 'unknown',
|
|
127
|
+
evidence: [error instanceof Error ? error.message : 'unknown manifest read failure'],
|
|
128
|
+
reason: 'Studio manifest cannot be read safely before the reviewed module removal.',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/*** Delegate an unrelated owner observation or remain explicitly unavailable. */
|
|
133
|
+
async function delegateObservationAsync(base, input) {
|
|
134
|
+
return base === undefined
|
|
135
|
+
? {
|
|
136
|
+
state: 'unknown',
|
|
137
|
+
evidence: [input.step.id],
|
|
138
|
+
reason: 'No trusted Studio owner adapter handles this reviewed step.',
|
|
139
|
+
}
|
|
140
|
+
: base.observeAsync(input);
|
|
141
|
+
}
|
|
142
|
+
/*** Delegate unrelated owner execution/rollback without swallowing its result. */
|
|
143
|
+
async function delegateExecutionAsync(base, action, input) {
|
|
144
|
+
return base === undefined
|
|
145
|
+
? failed('studio.owner-step.unavailable', 'No trusted Studio owner adapter handles this reviewed step.', input.step.id)
|
|
146
|
+
: action === 'executeAsync'
|
|
147
|
+
? base.executeAsync(input)
|
|
148
|
+
: base.rollbackAsync(input);
|
|
149
|
+
}
|
|
150
|
+
/*** Convert a non-executable observation into a deterministic owner-step failure. */
|
|
151
|
+
function observationFailure(observation) {
|
|
152
|
+
return failed('studio.pending-module-lifecycle.precondition-changed', observation.reason ?? 'Reviewed pending module lifecycle preconditions are not executable.', ...observation.evidence);
|
|
153
|
+
}
|
|
154
|
+
/*** Report one completed trusted owner effect. */
|
|
155
|
+
function completed(evidence) {
|
|
156
|
+
return { state: 'completed', evidence, diagnostics: [] };
|
|
157
|
+
}
|
|
158
|
+
/*** Report one deterministic owner execution failure. */
|
|
159
|
+
function failed(code, reason, ...evidence) {
|
|
160
|
+
return {
|
|
161
|
+
state: 'failed',
|
|
162
|
+
evidence,
|
|
163
|
+
diagnostics: [],
|
|
164
|
+
failure: { code, reason, evidence },
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/*** Keep dynamic Orchestrator effects explicitly non-reversible. */
|
|
168
|
+
function unsupportedRollback(stepId) {
|
|
169
|
+
return failed('studio.pending-module-lifecycle.rollback-unsupported', 'Reviewed Orchestrator module removal is not transactionally reversible by Studio.', stepId);
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=createStudioProjectUpdateApplyOwnerStepPort.js.map
|
package/dist/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateApplyOwnerStepPort.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateApplyOwnerStepPort.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oCAAoC,EAAE,MAAM,2DAA2D,CAAC;AACjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,wCAAwC,EAAE,MAAM,2DAA2D,CAAC;AAErH,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AA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c,EACd,GAAG,QAA2B;IAE9B,OAAO;QACL,KAAK,EAAE,QAAQ;QACf,QAAQ;QACR,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE;KACpC,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,SAAS,mBAAmB,CAAC,MAAc;IACzC,OAAO,MAAM,CACX,sDAAsD,EACtD,mFAAmF,EACnF,MAAM,CACP,CAAC;AACJ,CAAC"}
|
package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { ApmPlanProtocolPort } from '@ankhorage/apm/types';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ApmExtensionArtifactIdentityResolution, ApmPlanProtocolPort } from '@ankhorage/apm/types';
|
|
2
|
+
interface StudioProjectUpdateProtocolOptions {
|
|
3
|
+
readonly pendingLifecycleExecution?: boolean;
|
|
4
|
+
readonly resolveArtifactAsync?: (rootPath: string) => Promise<ApmExtensionArtifactIdentityResolution>;
|
|
5
|
+
readonly nowIso?: () => string;
|
|
6
|
+
}
|
|
7
|
+
/*** Extend package-owner planning with reviewed Studio pending-module lifecycle execution. */
|
|
8
|
+
export declare function createStudioProjectUpdateProtocolPort(base?: ApmPlanProtocolPort, options?: StudioProjectUpdateProtocolOptions): ApmPlanProtocolPort;
|
|
9
|
+
export {};
|
|
4
10
|
//# sourceMappingURL=createStudioProjectUpdateProtocolPort.d.ts.map
|
package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStudioProjectUpdateProtocolPort.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateProtocolPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateProtocolPort.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateProtocolPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sCAAsC,EAGtC,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAS9B,UAAU,kCAAkC;IAC1C,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CAChC;AAED,8FAA8F;AAC9F,wBAAgB,qCAAqC,CACnD,IAAI,CAAC,EAAE,mBAAmB,EAC1B,OAAO,GAAE,kCAAuC,GAC/C,mBAAmB,CAiCrB"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
+
import { resolveCurrentStudioApmArtifactAsync } from '../adapters/outbound/resolveCurrentStudioApmArtifactAsync';
|
|
2
|
+
import { planPendingModuleLifecycleAsync } from '../application/planPendingModuleLifecycleAsync';
|
|
1
3
|
import { STUDIO_PENDING_MODULE_LIFECYCLE_EVIDENCE, STUDIO_PENDING_MODULE_LIFECYCLE_PROJECTION_ID, } from '../constants';
|
|
2
|
-
/*** Extend package-owner planning with
|
|
3
|
-
export function createStudioProjectUpdateProtocolPort(base) {
|
|
4
|
+
/*** Extend package-owner planning with reviewed Studio pending-module lifecycle execution. */
|
|
5
|
+
export function createStudioProjectUpdateProtocolPort(base, options = {}) {
|
|
4
6
|
return {
|
|
5
7
|
planProtocolAsync: async (input) => {
|
|
6
8
|
const baseResult = await readBaseProtocolResultAsync(base, input);
|
|
7
9
|
const pending = input.status.extensions.observations.find(isPendingModuleLifecycleObservation);
|
|
10
|
+
const pendingSlice = await planPendingObservationAsync(pending, input.status.rootPath, options);
|
|
8
11
|
const unhandled = base === undefined
|
|
9
12
|
? input.status.extensions.observations.filter((observation) => !isPendingModuleLifecycleObservation(observation) &&
|
|
10
13
|
requiresProtocolPlanning(observation, input.policy.repairProjections))
|
|
11
14
|
: [];
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
...(unhandled.length === 0 ? [] : [protocolUnavailableBlocker(unhandled)]),
|
|
15
|
-
];
|
|
15
|
+
const unhandledBlockers = unhandled.length === 0 ? [] : [protocolUnavailableBlocker(unhandled)];
|
|
16
|
+
const blockers = [...baseResult.blockers, ...pendingSlice.blockers, ...unhandledBlockers];
|
|
16
17
|
return {
|
|
17
18
|
...baseResult,
|
|
18
|
-
complete: baseResult.complete &&
|
|
19
|
-
|
|
19
|
+
complete: baseResult.complete && blockers.length === 0,
|
|
20
|
+
files: [...baseResult.files, ...pendingSlice.files],
|
|
21
|
+
artifacts: [...baseResult.artifacts, ...pendingSlice.artifacts],
|
|
22
|
+
steps: [...baseResult.steps, ...pendingSlice.steps],
|
|
23
|
+
blockers,
|
|
20
24
|
};
|
|
21
25
|
},
|
|
22
26
|
};
|
|
@@ -32,26 +36,61 @@ const EMPTY_PROTOCOL_RESULT = {
|
|
|
32
36
|
blockers: [],
|
|
33
37
|
diagnostics: [],
|
|
34
38
|
};
|
|
39
|
+
const EMPTY_PENDING_SLICE = { files: [], artifacts: [], steps: [], blockers: [] };
|
|
35
40
|
/*** Delegate existing package-owner planning when present instead of replacing it. */
|
|
36
41
|
async function readBaseProtocolResultAsync(base, input) {
|
|
37
42
|
return base === undefined ? EMPTY_PROTOCOL_RESULT : base.planProtocolAsync(input);
|
|
38
43
|
}
|
|
44
|
+
/*** Plan the pending lifecycle observation only when the host supplied its trusted execution adapter. */
|
|
45
|
+
async function planPendingObservationAsync(observation, rootPath, options) {
|
|
46
|
+
if (observation === undefined)
|
|
47
|
+
return EMPTY_PENDING_SLICE;
|
|
48
|
+
if (options.pendingLifecycleExecution !== true) {
|
|
49
|
+
return { ...EMPTY_PENDING_SLICE, blockers: [pendingLifecycleBlocker(observation)] };
|
|
50
|
+
}
|
|
51
|
+
const expectedPendingDigest = readPendingDigest(observation);
|
|
52
|
+
if (expectedPendingDigest === undefined) {
|
|
53
|
+
return { ...EMPTY_PENDING_SLICE, blockers: [missingPendingDigestBlocker(observation)] };
|
|
54
|
+
}
|
|
55
|
+
return planPendingModuleLifecycleAsync({
|
|
56
|
+
rootPath,
|
|
57
|
+
expectedPendingDigest,
|
|
58
|
+
resolveArtifactAsync: options.resolveArtifactAsync ?? resolveCurrentStudioApmArtifactAsync,
|
|
59
|
+
nowIso: options.nowIso ?? (() => new Date().toISOString()),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
39
62
|
/*** Identify the Studio-owned pending module lifecycle observation by stable evidence. */
|
|
40
63
|
function isPendingModuleLifecycleObservation(observation) {
|
|
41
64
|
return observation.evidence.includes(STUDIO_PENDING_MODULE_LIFECYCLE_EVIDENCE);
|
|
42
65
|
}
|
|
43
|
-
/***
|
|
66
|
+
/*** Read the exact pending-file precondition frozen into status evidence. */
|
|
67
|
+
function readPendingDigest(observation) {
|
|
68
|
+
return observation.evidence
|
|
69
|
+
.find((item) => item.startsWith('pending-digest:'))
|
|
70
|
+
?.slice('pending-digest:'.length);
|
|
71
|
+
}
|
|
72
|
+
/*** Mirror APM's owner-planning requirement for evidence not handled by Studio's local planner. */
|
|
44
73
|
function requiresProtocolPlanning(observation, repairProjections) {
|
|
45
74
|
return (observation.migration === 'pending' || (repairProjections && observation.projection === 'stale'));
|
|
46
75
|
}
|
|
47
|
-
/*** Block apply
|
|
76
|
+
/*** Block apply when this service instance has no trusted module-lifecycle executor. */
|
|
48
77
|
function pendingLifecycleBlocker(observation) {
|
|
49
78
|
return {
|
|
50
79
|
code: 'protocol.studio-pending-module-lifecycle',
|
|
51
80
|
scope: { kind: 'projection', id: STUDIO_PENDING_MODULE_LIFECYCLE_PROJECTION_ID },
|
|
52
81
|
evidence: observation.evidence,
|
|
53
|
-
reason: 'Studio module removals are queued, but
|
|
54
|
-
nextAction: '
|
|
82
|
+
reason: 'Studio module removals are queued, but this host did not compose the trusted module-lifecycle owner executor.',
|
|
83
|
+
nextAction: 'Use the normal Studio host or compose its trusted pending-module lifecycle adapter.',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/*** Block planning when pending evidence lacks the immutable file digest required for reviewed execution. */
|
|
87
|
+
function missingPendingDigestBlocker(observation) {
|
|
88
|
+
return {
|
|
89
|
+
code: 'protocol.studio-pending-module-lifecycle-evidence-incomplete',
|
|
90
|
+
scope: { kind: 'projection', id: STUDIO_PENDING_MODULE_LIFECYCLE_PROJECTION_ID },
|
|
91
|
+
evidence: observation.evidence,
|
|
92
|
+
reason: 'Pending module lifecycle evidence is missing its reviewed file digest.',
|
|
93
|
+
nextAction: 'Refresh Studio status before planning pending module removals.',
|
|
55
94
|
};
|
|
56
95
|
}
|
|
57
96
|
/*** Preserve APM's fail-closed behavior when another owner observation lacks a planner. */
|
package/dist/features/project-updates/composition/createStudioProjectUpdateProtocolPort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStudioProjectUpdateProtocolPort.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateProtocolPort.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateProtocolPort.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateProtocolPort.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oCAAoC,EAAE,MAAM,2DAA2D,CAAC;AACjH,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,EACL,wCAAwC,EACxC,6CAA6C,GAC9C,MAAM,cAAc,CAAC;AAUtB,8FAA8F;AAC9F,MAAM,UAAU,qCAAqC,CACnD,IAA0B,EAC1B,UAA8C,EAAE;IAEhD,OAAO;QACL,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACjC,MAAM,UAAU,GAAG,MAAM,2BAA2B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,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BAA0B,CACjC,YAAgD;IAEhD,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC1B,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC;QACrE,MAAM,EAAE,mFAAmF;QAC3F,UAAU,EAAE,6EAA6E;KAC1F,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ProjectUpdateServiceOptions } from '../../../types/project-updates';
|
|
2
2
|
import { ProjectUpdateService } from '../application/ProjectUpdateService';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { StudioPendingModuleLifecyclePort } from '../application/StudioPendingModuleLifecyclePort';
|
|
4
|
+
/*** Compose Studio-owned APM evidence, planning, execution, and verification around one host lifecycle port. */
|
|
5
|
+
export declare function createStudioProjectUpdateService(options?: ProjectUpdateServiceOptions, lifecycle?: StudioPendingModuleLifecyclePort): ProjectUpdateService;
|
|
5
6
|
//# sourceMappingURL=createStudioProjectUpdateService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStudioProjectUpdateService.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateService.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AAMxG,gHAAgH;AAChH,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,2BAAgC,EACzC,SAAS,CAAC,EAAE,gCAAgC,GAC3C,oBAAoB,CAoBtB"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { ProjectUpdateService } from '../application/ProjectUpdateService';
|
|
2
|
+
import { createStudioProjectUpdateApplyOwnerStepPort } from './createStudioProjectUpdateApplyOwnerStepPort';
|
|
2
3
|
import { createStudioProjectUpdateExtensionEvidencePort } from './createStudioProjectUpdateExtensionEvidencePort';
|
|
3
4
|
import { createStudioProjectUpdateProtocolPort } from './createStudioProjectUpdateProtocolPort';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { createStudioProjectUpdateVerifyOwnerStepPort } from './createStudioProjectUpdateVerifyOwnerStepPort';
|
|
6
|
+
/*** Compose Studio-owned APM evidence, planning, execution, and verification around one host lifecycle port. */
|
|
7
|
+
export function createStudioProjectUpdateService(options = {}, lifecycle) {
|
|
6
8
|
return new ProjectUpdateService({
|
|
7
9
|
...options,
|
|
8
10
|
extensions: createStudioProjectUpdateExtensionEvidencePort(options.extensions),
|
|
9
|
-
protocol: createStudioProjectUpdateProtocolPort(options.protocol
|
|
11
|
+
protocol: createStudioProjectUpdateProtocolPort(options.protocol, {
|
|
12
|
+
pendingLifecycleExecution: lifecycle !== undefined,
|
|
13
|
+
}),
|
|
14
|
+
...(lifecycle === undefined
|
|
15
|
+
? {}
|
|
16
|
+
: {
|
|
17
|
+
applyOwnerStep: createStudioProjectUpdateApplyOwnerStepPort(lifecycle, options.applyOwnerStep),
|
|
18
|
+
verifyOwnerStep: createStudioProjectUpdateVerifyOwnerStepPort(lifecycle, options.verifyOwnerStep),
|
|
19
|
+
}),
|
|
10
20
|
});
|
|
11
21
|
}
|
|
12
22
|
//# sourceMappingURL=createStudioProjectUpdateService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStudioProjectUpdateService.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateService.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,2CAA2C,EAAE,MAAM,+CAA+C,CAAC;AAC5G,OAAO,EAAE,8CAA8C,EAAE,MAAM,kDAAkD,CAAC;AAClH,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,4CAA4C,EAAE,MAAM,gDAAgD,CAAC;AAE9G,gHAAgH;AAChH,MAAM,UAAU,gCAAgC,CAC9C,UAAuC,EAAE,EACzC,SAA4C;IAE5C,OAAO,IAAI,oBAAoB,CAAC;QAC9B,GAAG,OAAO;QACV,UAAU,EAAE,8CAA8C,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9E,QAAQ,EAAE,qCAAqC,CAAC,OAAO,CAAC,QAAQ,EAAE;YAChE,yBAAyB,EAAE,SAAS,KAAK,SAAS;SACnD,CAAC;QACF,GAAG,CAAC,SAAS,KAAK,SAAS;YACzB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,cAAc,EAAE,2CAA2C,CACzD,SAAS,EACT,OAAO,CAAC,cAAc,CACvB;gBACD,eAAe,EAAE,4CAA4C,CAC3D,SAAS,EACT,OAAO,CAAC,eAAe,CACxB;aACF,CAAC;KACP,CAAC,CAAC;AACL,CAAC"}
|
package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ApmVerifyStepPort } from '@ankhorage/apm/types';
|
|
2
|
+
import type { StudioPendingModuleLifecyclePort } from '../application/StudioPendingModuleLifecyclePort';
|
|
3
|
+
/*** Compose Studio pending-module verification around any pre-existing trusted owner verifier. */
|
|
4
|
+
export declare function createStudioProjectUpdateVerifyOwnerStepPort(lifecycle: StudioPendingModuleLifecyclePort, base?: ApmVerifyStepPort): ApmVerifyStepPort;
|
|
5
|
+
//# sourceMappingURL=createStudioProjectUpdateVerifyOwnerStepPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateVerifyOwnerStepPort.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGpF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AAGxG,kGAAkG;AAClG,wBAAgB,4CAA4C,CAC1D,SAAS,EAAE,gCAAgC,EAC3C,IAAI,CAAC,EAAE,iBAAiB,GACvB,iBAAiB,CAgBnB"}
|
package/dist/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { currentStudioApmArtifactMatchesAsync } from '../adapters/outbound/resolveCurrentStudioApmArtifactAsync';
|
|
2
|
+
import { readReviewedPendingModuleStep } from '../domain/pendingModulePlanStep';
|
|
3
|
+
/*** Compose Studio pending-module verification around any pre-existing trusted owner verifier. */
|
|
4
|
+
export function createStudioProjectUpdateVerifyOwnerStepPort(lifecycle, base) {
|
|
5
|
+
return {
|
|
6
|
+
verifyAsync: async (input) => {
|
|
7
|
+
const reviewed = readReviewedPendingModuleStep(input.step);
|
|
8
|
+
return reviewed === undefined
|
|
9
|
+
? delegateVerifyAsync(base, input)
|
|
10
|
+
: [
|
|
11
|
+
await verifyPendingModuleAsync(input.journal.rootPath, input.step.id, reviewed, lifecycle),
|
|
12
|
+
];
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/*** Verify the immutable owner binding and exact Orchestrator module postcondition. */
|
|
17
|
+
async function verifyPendingModuleAsync(rootPath, stepId, reviewed, lifecycle) {
|
|
18
|
+
if (!(await currentStudioApmArtifactMatchesAsync(reviewed.artifact))) {
|
|
19
|
+
return {
|
|
20
|
+
id: `verify:${stepId}`,
|
|
21
|
+
kind: 'projection',
|
|
22
|
+
status: 'unknown',
|
|
23
|
+
evidence: [`${reviewed.artifact.packageName}@${reviewed.artifact.version}`],
|
|
24
|
+
reason: 'Loaded Studio owner code no longer matches the reviewed immutable artifact binding.',
|
|
25
|
+
nextAction: 'Verify again with the exact reviewed Studio owner artifact.',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const installed = await lifecycle.isModuleInstalledAsync(rootPath, reviewed.moduleId);
|
|
29
|
+
if (installed === undefined) {
|
|
30
|
+
return {
|
|
31
|
+
id: `verify:${stepId}`,
|
|
32
|
+
kind: 'projection',
|
|
33
|
+
status: 'unknown',
|
|
34
|
+
evidence: [`module:${reviewed.moduleId}`],
|
|
35
|
+
reason: 'Orchestrator could not determine the reviewed module installation state.',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return installed
|
|
39
|
+
? {
|
|
40
|
+
id: `verify:${stepId}`,
|
|
41
|
+
kind: 'projection',
|
|
42
|
+
status: 'failed',
|
|
43
|
+
evidence: [`module-installed:${reviewed.moduleId}`],
|
|
44
|
+
reason: 'Reviewed pending module remains installed after the APM operation.',
|
|
45
|
+
}
|
|
46
|
+
: {
|
|
47
|
+
id: `verify:${stepId}`,
|
|
48
|
+
kind: 'projection',
|
|
49
|
+
status: 'passed',
|
|
50
|
+
evidence: [`module-removed:${reviewed.moduleId}`],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/*** Delegate unrelated owner verification or keep the missing verifier explicit. */
|
|
54
|
+
async function delegateVerifyAsync(base, input) {
|
|
55
|
+
return base === undefined
|
|
56
|
+
? [
|
|
57
|
+
{
|
|
58
|
+
id: `verify:${input.step.id}`,
|
|
59
|
+
kind: input.step.kind === 'migration' ? 'migration' : 'projection',
|
|
60
|
+
status: 'unknown',
|
|
61
|
+
evidence: [input.step.id],
|
|
62
|
+
reason: 'No trusted Studio owner verifier handles this reviewed step.',
|
|
63
|
+
},
|
|
64
|
+
]
|
|
65
|
+
: base.verifyAsync(input);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=createStudioProjectUpdateVerifyOwnerStepPort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStudioProjectUpdateVerifyOwnerStepPort.js","sourceRoot":"","sources":["../../../../src/features/project-updates/composition/createStudioProjectUpdateVerifyOwnerStepPort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,2DAA2D,CAAC;AAEjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,kGAAkG;AAClG,MAAM,UAAU,4CAA4C,CAC1D,SAA2C,EAC3C,IAAwB;IAExB,OAAO;QACL,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3D,OAAO,QAAQ,KAAK,SAAS;gBAC3B,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC;gBAClC,CAAC,CAAC;oBACE,MAAM,wBAAwB,CAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,EACtB,KAAK,CAAC,IAAI,CAAC,EAAE,EACb,QAAQ,EACR,SAAS,CACV;iBACF,CAAC;QACR,CAAC;KACF,CAAC;AACJ,CAAC;AAKD,uFAAuF;AACvF,KAAK,UAAU,wBAAwB,CACrC,QAAgB,EAChB,MAAc,EACd,QAAsB,EACtB,SAA2C;IAE3C,IAAI,CAAC,CAAC,MAAM,oCAAoC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACrE,OA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AAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY;gBAClE,MAAM,EAAE,SAAS;gBACjB,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,MAAM,EAAE,8DAA8D;aACvE;SACF;QACH,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface PendingModuleLifecycleOperation {
|
|
2
|
+
readonly type: 'uninstall';
|
|
3
|
+
readonly moduleId: string;
|
|
4
|
+
readonly at: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PendingModuleLifecycleState {
|
|
7
|
+
readonly ops: readonly PendingModuleLifecycleOperation[];
|
|
8
|
+
}
|
|
9
|
+
export type PendingModuleLifecycleParseResult = {
|
|
10
|
+
readonly valid: true;
|
|
11
|
+
readonly value: PendingModuleLifecycleState;
|
|
12
|
+
} | {
|
|
13
|
+
readonly valid: false;
|
|
14
|
+
};
|
|
15
|
+
/*** Parse Studio's persisted pending module lifecycle state without accepting ambiguous operations. */
|
|
16
|
+
export declare function parsePendingModuleLifecycleState(content: string): PendingModuleLifecycleParseResult;
|
|
17
|
+
/*** Serialize canonical Studio pending lifecycle state for one reviewed APM file change. */
|
|
18
|
+
export declare function serializePendingModuleLifecycleState(state: PendingModuleLifecycleState): string;
|
|
19
|
+
/*** Return pending module ids in the persisted execution order. */
|
|
20
|
+
export declare function pendingModuleLifecycleIds(state: PendingModuleLifecycleState): readonly string[];
|
|
21
|
+
/*** Remove only reviewed module ids while preserving unrelated pending operations. */
|
|
22
|
+
export declare function removeReviewedPendingModules(state: PendingModuleLifecycleState, moduleIds: ReadonlySet<string>): PendingModuleLifecycleState;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=pendingModuleLifecycleState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingModuleLifecycleState.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/domain/pendingModuleLifecycleState.ts"],"names":[],"mappings":"AAEA,UAAU,+BAA+B;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,GAAG,EAAE,SAAS,+BAA+B,EAAE,CAAC;CAC1D;AAED,MAAM,MAAM,iCAAiC,GAC3C;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpG,uGAAuG;AACvG,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,GACd,iCAAiC,CAYnC;AAED,4FAA4F;AAC5F,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,CAE/F;AAED,mEAAmE;AACnE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,MAAM,EAAE,CAE/F;AAED,sFAAsF;AACtF,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,2BAA2B,EAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,2BAA2B,CAE7B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
2
|
+
/*** Parse Studio's persisted pending module lifecycle state without accepting ambiguous operations. */
|
|
3
|
+
export function parsePendingModuleLifecycleState(content) {
|
|
4
|
+
const value = parseJson(content);
|
|
5
|
+
if (!isRecord(value) || !Array.isArray(value.ops))
|
|
6
|
+
return { valid: false };
|
|
7
|
+
const ops = value.ops.map(parseOperation);
|
|
8
|
+
if (ops.some((operation) => operation === undefined))
|
|
9
|
+
return { valid: false };
|
|
10
|
+
const parsed = ops.filter((operation) => operation !== undefined);
|
|
11
|
+
const uniqueIds = new Set(parsed.map(({ moduleId }) => moduleId));
|
|
12
|
+
return uniqueIds.size === parsed.length
|
|
13
|
+
? { valid: true, value: { ops: parsed } }
|
|
14
|
+
: { valid: false };
|
|
15
|
+
}
|
|
16
|
+
/*** Serialize canonical Studio pending lifecycle state for one reviewed APM file change. */
|
|
17
|
+
export function serializePendingModuleLifecycleState(state) {
|
|
18
|
+
return `${JSON.stringify(state, null, 2)}\n`;
|
|
19
|
+
}
|
|
20
|
+
/*** Return pending module ids in the persisted execution order. */
|
|
21
|
+
export function pendingModuleLifecycleIds(state) {
|
|
22
|
+
return state.ops.map(({ moduleId }) => moduleId);
|
|
23
|
+
}
|
|
24
|
+
/*** Remove only reviewed module ids while preserving unrelated pending operations. */
|
|
25
|
+
export function removeReviewedPendingModules(state, moduleIds) {
|
|
26
|
+
return { ops: state.ops.filter(({ moduleId }) => !moduleIds.has(moduleId)) };
|
|
27
|
+
}
|
|
28
|
+
/*** Parse JSON into unknown data without leaking JSON.parse's any type. */
|
|
29
|
+
function parseJson(content) {
|
|
30
|
+
try {
|
|
31
|
+
const value = JSON.parse(content);
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/*** Validate one persisted pending uninstall operation. */
|
|
39
|
+
function parseOperation(value) {
|
|
40
|
+
if (!isRecord(value) || value.type !== 'uninstall')
|
|
41
|
+
return undefined;
|
|
42
|
+
if (typeof value.moduleId !== 'string' || value.moduleId.trim() === '')
|
|
43
|
+
return undefined;
|
|
44
|
+
if (typeof value.at !== 'string' || value.at.trim() === '')
|
|
45
|
+
return undefined;
|
|
46
|
+
return { type: 'uninstall', moduleId: value.moduleId.trim(), at: value.at };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=pendingModuleLifecycleState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingModuleLifecycleState.js","sourceRoot":"","sources":["../../../../src/features/project-updates/domain/pendingModuleLifecycleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAerD,uGAAuG;AACvG,MAAM,UAAU,gCAAgC,CAC9C,OAAe;IAEf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC3E,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1C,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC9E,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CACvB,CAAC,SAAS,EAAgD,EAAE,CAAC,SAAS,KAAK,SAAS,CACrF,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM;QACrC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QACzC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACvB,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,oCAAoC,CAAC,KAAkC;IACrF,OAAO,GAAG,I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I,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApmExtensionArtifactIdentity, ApmPlanStep } from '@ankhorage/apm/types';
|
|
2
|
+
export interface ReviewedPendingModuleStep {
|
|
3
|
+
readonly moduleId: string;
|
|
4
|
+
readonly pendingDigest: string;
|
|
5
|
+
readonly manifestDigest: string;
|
|
6
|
+
readonly artifact: ApmExtensionArtifactIdentity;
|
|
7
|
+
}
|
|
8
|
+
/*** Parse one exact Studio pending-module owner step from a reviewed APM plan. */
|
|
9
|
+
export declare function readReviewedPendingModuleStep(step: ApmPlanStep): ReviewedPendingModuleStep | undefined;
|
|
10
|
+
//# sourceMappingURL=pendingModulePlanStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingModulePlanStep.d.ts","sourceRoot":"","sources":["../../../../src/features/project-updates/domain/pendingModulePlanStep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOtF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,4BAA4B,CAAC;CACjD;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,WAAW,GAChB,yBAAyB,GAAG,SAAS,CAUvC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const STUDIO_PACKAGE_NAME = '@ankhorage/studio';
|
|
2
|
+
const PROJECTION_PREFIX = 'pending-module-remove:';
|
|
3
|
+
const PENDING_DIGEST_PREFIX = 'pending-digest:';
|
|
4
|
+
const MANIFEST_DIGEST_PREFIX = 'manifest-digest:';
|
|
5
|
+
/*** Parse one exact Studio pending-module owner step from a reviewed APM plan. */
|
|
6
|
+
export function readReviewedPendingModuleStep(step) {
|
|
7
|
+
if (step.kind !== 'projection' || step.execution.kind !== 'projection')
|
|
8
|
+
return undefined;
|
|
9
|
+
if (step.owner !== STUDIO_PACKAGE_NAME)
|
|
10
|
+
return undefined;
|
|
11
|
+
if (!step.execution.descriptor.id.startsWith(PROJECTION_PREFIX))
|
|
12
|
+
return undefined;
|
|
13
|
+
const moduleId = step.execution.descriptor.id.slice(PROJECTION_PREFIX.length);
|
|
14
|
+
const pendingDigest = readEvidenceDigest(step.execution.plan.evidence, PENDING_DIGEST_PREFIX);
|
|
15
|
+
const manifestDigest = readEvidenceDigest(step.execution.plan.evidence, MANIFEST_DIGEST_PREFIX);
|
|
16
|
+
return moduleId === '' || pendingDigest === undefined || manifestDigest === undefined
|
|
17
|
+
? undefined
|
|
18
|
+
: { moduleId, pendingDigest, manifestDigest, artifact: step.execution.artifact };
|
|
19
|
+
}
|
|
20
|
+
/*** Read one required non-empty digest from reviewed step evidence. */
|
|
21
|
+
function readEvidenceDigest(evidence, prefix) {
|
|
22
|
+
const value = evidence.find((item) => item.startsWith(prefix))?.slice(prefix.length);
|
|
23
|
+
return value === undefined || value === '' ? undefined : value;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=pendingModulePlanStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pendingModulePlanStep.js","sourceRoot":"","sources":["../../../../src/features/project-updates/domain/pendingModulePlanStep.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AACnD,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAChD,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AASlD,kFAAkF;AAClF,MAAM,UAAU,6BAA6B,CAC3C,IAAiB;IAEjB,IAAI,IAAI,CAAC,IAAI,KAAK,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