@aopslabs/aops 0.3.1 → 0.3.2
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 +11 -12
- package/THIRD_PARTY_NOTICES +16169 -0
- package/dist/commands/community-server.js +5 -2
- package/dist/lib/community-diagnostic.js +1 -1
- package/dist/lib/community-native-lifecycle.js +70 -7
- package/dist/lib/setup-readiness.js +2 -2
- package/native/tui/win32-x64/aops-tui.exe +0 -0
- package/package.json +3 -2
|
@@ -13,7 +13,7 @@ import { resolveCommunityOfflineRelease, resolveCommunityPublishedRelease, } fro
|
|
|
13
13
|
import { inspectCommunityDoctor } from './community-doctor.js';
|
|
14
14
|
import { buildCommunityInstanceContract, } from '../lib/community-instance-contract.js';
|
|
15
15
|
import { asCommunityDiagnosticError } from '../lib/community-diagnostic.js';
|
|
16
|
-
import { assertCommunityNativePathLayout, attestCommunityNativeExternalSnapshot, inspectCommunityNativeInstall, inspectCommunityNativeRuntime, loadExternalPostgresUrl, loadExternalServerAuthConfig, planCommunityNativeInstalledMigration, readCommunityNativeLogs, rollbackCommunityNativeApplication, resolveCommunityNativeLaunchMode, resolveCommunityNativePaths, setupCommunityNativeInstall, startCommunityNativeInstall, stopCommunityNativeInstall, } from '../lib/community-native-lifecycle.js';
|
|
16
|
+
import { assertCommunityNativePathLayout, attestCommunityNativeExternalSnapshot, inspectCommunityNativeInstall, inspectCommunityNativeRuntime, loadExternalPostgresUrl, loadExternalServerAuthConfig, planCommunityNativeInstalledMigration, readCommunityNativeLogs, rollbackCommunityNativeApplication, resolveCommunityNativeInstalledNpmSourceRoot, resolveCommunityNativeLaunchMode, resolveCommunityNativePaths, setupCommunityNativeInstall, startCommunityNativeInstall, stopCommunityNativeInstall, } from '../lib/community-native-lifecycle.js';
|
|
17
17
|
import { inspectCommunityNativeApplicationRecoveryStatus } from '../lib/community-native-application-recovery.js';
|
|
18
18
|
import { inspectCommunityNativeDatabaseRecoveryStatus, restoreCommunityNativeDatabaseForUpdate, } from '../lib/community-native-database-recovery.js';
|
|
19
19
|
import { inspectCommunityNativePostgres, removeCommunityNativePostgresContainerForReset, removeCommunityNativeManagedPostgres, } from '../lib/community-native-postgres.js';
|
|
@@ -214,6 +214,8 @@ function resolveDependencies(dependencies = {}) {
|
|
|
214
214
|
planNativeMigration: dependencies.planNativeMigration ?? planCommunityNativeInstalledMigration,
|
|
215
215
|
attestNativeExternalSnapshot: dependencies.attestNativeExternalSnapshot ?? attestCommunityNativeExternalSnapshot,
|
|
216
216
|
setupNativeInstall: dependencies.setupNativeInstall ?? setupCommunityNativeInstall,
|
|
217
|
+
startNativeInstall: dependencies.startNativeInstall ?? startCommunityNativeInstall,
|
|
218
|
+
resolveNativeInstalledNpmSourceRoot: dependencies.resolveNativeInstalledNpmSourceRoot ?? resolveCommunityNativeInstalledNpmSourceRoot,
|
|
217
219
|
rollbackNativeApplication: dependencies.rollbackNativeApplication ?? rollbackCommunityNativeApplication,
|
|
218
220
|
restoreNativeDatabase: dependencies.restoreNativeDatabase ?? restoreCommunityNativeDatabaseForUpdate,
|
|
219
221
|
stopNativeCockpit: dependencies.stopNativeCockpit ?? stopCommunityNativeCockpit,
|
|
@@ -764,8 +766,9 @@ export async function runCommunityServerStart(options, dependencies = {}) {
|
|
|
764
766
|
await withMutatingCommandScope(dependencies, async (runtime, signal) => {
|
|
765
767
|
const native = inspectNativeFrom(options);
|
|
766
768
|
if (native.status === 'installed') {
|
|
767
|
-
const launch = await withNativeOperation(options, 'start', runtime, signal, () =>
|
|
769
|
+
const launch = await withNativeOperation(options, 'start', runtime, signal, () => runtime.startNativeInstall({
|
|
768
770
|
...installSelection(options),
|
|
771
|
+
adoptSourceRoot: runtime.resolveNativeInstalledNpmSourceRoot(),
|
|
769
772
|
mode: resolveCommunityNativeLaunchMode(options),
|
|
770
773
|
signal,
|
|
771
774
|
}));
|
|
@@ -66,7 +66,7 @@ function guidance(code) {
|
|
|
66
66
|
return {
|
|
67
67
|
summary: 'The installed npm server package no longer matches the source or build fingerprint AOPS previously verified.',
|
|
68
68
|
nextActions: Object.freeze([
|
|
69
|
-
'Reinstall the
|
|
69
|
+
'Reinstall the public `@aopslabs/aops` package so npm restores its exact Server dependency.',
|
|
70
70
|
'Re-run `aops setup init` for the selected path after the verified package bytes have been restored.',
|
|
71
71
|
]),
|
|
72
72
|
};
|
|
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { parseEnv } from 'node:util';
|
|
8
8
|
import { COMMUNITY_NATIVE_CHILD_PROTOCOL, COMMUNITY_NATIVE_CONTROL_PROTOCOL, } from './community-native-child.js';
|
|
9
9
|
import { resolveCommunityInstallPaths } from './community-lifecycle.js';
|
|
10
|
+
import { buildCommunityInstanceContract, } from './community-instance-contract.js';
|
|
10
11
|
import { COMMUNITY_NATIVE_POSTGRES_CONTRACT_PATH, assertCommunityNativePostgresInstanceState, assertCommunityNativePostgresState, buildCommunityNativePostgresUrl, setupCommunityNativePostgres, startCommunityNativePostgres, stopCommunityNativePostgres, } from './community-native-postgres.js';
|
|
11
12
|
import { COMMUNITY_NATIVE_MIGRATION_POLICY_PATH, assertCommunityNativeMigrationReceiptV1, planCommunityNativeMigration, runCommunityNativeMigration, } from './community-native-migration.js';
|
|
12
13
|
import { createCommunityExternalSnapshotAttestationV1, writeCommunityExternalSnapshotAttestationV1, } from './community-migration-snapshot.js';
|
|
@@ -660,20 +661,29 @@ function sourceLayout(root, manifest = sourcePackage(root)) {
|
|
|
660
661
|
function isPackagedCommunityServerSource(source) {
|
|
661
662
|
return sourceLayout(source.root).kind === 'npm-package';
|
|
662
663
|
}
|
|
664
|
+
function isPersistedPackagedCommunityServerState(state) {
|
|
665
|
+
return samePhysicalPath(state.build.hostEntry, path.join(state.source.root, PACKAGE_BUILD_PATHS.hostEntry)) &&
|
|
666
|
+
samePhysicalPath(state.build.handlerEntry, path.join(state.source.root, PACKAGE_BUILD_PATHS.handlerEntry)) &&
|
|
667
|
+
samePhysicalPath(state.build.cockpitIndex, path.join(state.source.root, PACKAGE_BUILD_PATHS.cockpitIndex));
|
|
668
|
+
}
|
|
663
669
|
export function isCommunityNativeNpmPackageSource(sourceRoot) {
|
|
664
670
|
const resolved = path.resolve(sourceRoot);
|
|
665
671
|
return sourceLayout(realpathSync(resolved)).kind === 'npm-package';
|
|
666
672
|
}
|
|
667
673
|
export function resolveCommunityNativeDefaultSourceRoot(fallbackRoot = process.cwd(), moduleUrl = import.meta.url) {
|
|
674
|
+
return resolveCommunityNativeInstalledNpmSourceRoot(moduleUrl) ?? path.resolve(fallbackRoot);
|
|
675
|
+
}
|
|
676
|
+
export function resolveCommunityNativeInstalledNpmSourceRoot(moduleUrl = import.meta.url) {
|
|
668
677
|
try {
|
|
669
678
|
const require = createRequire(moduleUrl);
|
|
670
679
|
const packageJsonPath = require.resolve(`${PUBLIC_SERVER_PACKAGE_NAME}/package.json`);
|
|
671
680
|
const packageRoot = path.dirname(packageJsonPath);
|
|
672
|
-
sourceLayout(packageRoot)
|
|
681
|
+
if (sourceLayout(packageRoot).kind !== 'npm-package')
|
|
682
|
+
return null;
|
|
673
683
|
return packageRoot;
|
|
674
684
|
}
|
|
675
685
|
catch {
|
|
676
|
-
return
|
|
686
|
+
return null;
|
|
677
687
|
}
|
|
678
688
|
}
|
|
679
689
|
export function inspectCommunityNativeSource(sourceRoot = process.cwd()) {
|
|
@@ -827,6 +837,12 @@ export function reconcileCommunityNativePriorApplication(params) {
|
|
|
827
837
|
throw new Error('community_native_container_postgres_contract_required');
|
|
828
838
|
}
|
|
829
839
|
if (!samePhysicalPath(state.source.root, selectedSource.root)) {
|
|
840
|
+
if (sourceLayout(selectedSource.root).kind === 'npm-package') {
|
|
841
|
+
const comparison = compareCommunityReleaseVersions(selectedSource.releaseVersion, state.source.releaseVersion);
|
|
842
|
+
if (comparison < 0) {
|
|
843
|
+
throw new Error(`community_native_application_downgrade_refused:${state.source.releaseVersion}:to:${selectedSource.releaseVersion}`);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
830
846
|
return 'application-source-adopted';
|
|
831
847
|
}
|
|
832
848
|
try {
|
|
@@ -2443,15 +2459,62 @@ export async function startCommunityNativeInstall(params) {
|
|
|
2443
2459
|
if (inspection.status !== 'installed' || !inspection.state) {
|
|
2444
2460
|
throw new Error(`community_native_not_installed:${inspection.status}:${inspection.error ?? 'run_server_setup'}`);
|
|
2445
2461
|
}
|
|
2462
|
+
const runtime = params.runtime ?? communityNativeRuntime;
|
|
2463
|
+
const now = params.now ?? (() => new Date());
|
|
2464
|
+
const createId = params.createId ?? randomUUID;
|
|
2465
|
+
const mode = params.mode ?? 'detached';
|
|
2466
|
+
const readyTimeoutMs = params.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
|
|
2467
|
+
if (params.adoptSourceRoot
|
|
2468
|
+
&& isPersistedPackagedCommunityServerState(inspection.state)
|
|
2469
|
+
&& inspection.state.server.host === '127.0.0.1'
|
|
2470
|
+
&& inspection.state.server.exposure === 'loopback'
|
|
2471
|
+
&& inspection.state.server.authProvider === 'trusted-local') {
|
|
2472
|
+
const selectedSource = inspectCommunityNativeSource(params.adoptSourceRoot);
|
|
2473
|
+
const state = inspection.state;
|
|
2474
|
+
const contract = buildCommunityInstanceContract({
|
|
2475
|
+
runtime: 'native',
|
|
2476
|
+
postgres: state.postgres.mode,
|
|
2477
|
+
postgresConfig: state.postgres.mode === 'external' ? state.postgres.configRef : undefined,
|
|
2478
|
+
postgresTls: state.postgres.mode === 'external' ? state.postgres.tlsPolicy : undefined,
|
|
2479
|
+
exposure: state.server.exposure,
|
|
2480
|
+
auth: state.server.authProvider,
|
|
2481
|
+
publicPort: state.server.publicPort,
|
|
2482
|
+
instance: state.instanceName,
|
|
2483
|
+
port: state.server.port,
|
|
2484
|
+
processEnv: params.env,
|
|
2485
|
+
});
|
|
2486
|
+
const reconciliation = reconcileCommunityNativePriorApplication({
|
|
2487
|
+
state,
|
|
2488
|
+
selectedSource,
|
|
2489
|
+
contract,
|
|
2490
|
+
selectedExternalConfigRef: state.postgres.mode === 'external' ? state.postgres.configRef : undefined,
|
|
2491
|
+
});
|
|
2492
|
+
if (reconciliation === 'application-source-adopted') {
|
|
2493
|
+
const refreshed = await setupCommunityNativeInstall({
|
|
2494
|
+
contract,
|
|
2495
|
+
sourceRoot: selectedSource.root,
|
|
2496
|
+
dataRoot: params.dataRoot,
|
|
2497
|
+
mode,
|
|
2498
|
+
runtime,
|
|
2499
|
+
postgresRuntime: params.postgresRuntime,
|
|
2500
|
+
now,
|
|
2501
|
+
createId,
|
|
2502
|
+
readyTimeoutMs,
|
|
2503
|
+
env: params.env,
|
|
2504
|
+
signal: params.signal,
|
|
2505
|
+
});
|
|
2506
|
+
return refreshed.launch;
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2446
2509
|
return launchInstalledNative({
|
|
2447
2510
|
paths: inspection.paths,
|
|
2448
2511
|
state: inspection.state,
|
|
2449
|
-
mode
|
|
2450
|
-
runtime
|
|
2512
|
+
mode,
|
|
2513
|
+
runtime,
|
|
2451
2514
|
postgresRuntime: params.postgresRuntime,
|
|
2452
|
-
now
|
|
2453
|
-
createId
|
|
2454
|
-
readyTimeoutMs
|
|
2515
|
+
now,
|
|
2516
|
+
createId,
|
|
2517
|
+
readyTimeoutMs,
|
|
2455
2518
|
env: params.env,
|
|
2456
2519
|
signal: params.signal,
|
|
2457
2520
|
});
|
|
@@ -709,12 +709,12 @@ export async function inspectSetupReadiness(options = {}) {
|
|
|
709
709
|
: 'Native source runtime requirements are available.'
|
|
710
710
|
: needsDocker
|
|
711
711
|
? 'The installed npm server runtime (or an explicit source checkout) and a running Docker daemon are required.'
|
|
712
|
-
: 'Install
|
|
712
|
+
: 'Install or update @aopslabs/aops so its matching Server dependency is present, or provide a valid development checkout with pnpm 11.',
|
|
713
713
|
next: runtimeReady
|
|
714
714
|
? undefined
|
|
715
715
|
: needsDocker
|
|
716
716
|
? 'Install and start Docker Desktop/Engine, then retry the npm-server setup.'
|
|
717
|
-
: 'Install
|
|
717
|
+
: 'Install or update the @aopslabs/aops package, or provide a valid Community source checkout.',
|
|
718
718
|
data: {
|
|
719
719
|
node: process.version,
|
|
720
720
|
sourceRoot: selectedSourceRoot,
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aopslabs/aops",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AOPS CLI and terminal setup application.",
|
|
6
|
-
"aopsDockerServerVersion": "0.2.
|
|
6
|
+
"aopsDockerServerVersion": "0.2.4",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"start": "node dist/main.js"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
+
"@aopslabs/aops-server": "0.2.4",
|
|
58
59
|
"@aopslabs/artifact-trust-contracts": "0.3.0",
|
|
59
60
|
"@aopslabs/cli-kit": "0.1.0",
|
|
60
61
|
"@aopslabs/aops-host-registration": "0.2.0",
|