@@ -56,7 +56,7 @@ import { SystemFieldName, scalarOverridesPackagedBase } from '@objectstack/spec/
5656import { resolveTenancyPosture , resolveSearchPinyinEnabled } from '@objectstack/types' ;
5757import { postureEnforcesWall } from '@objectstack/spec/security' ;
5858import { provisionSearchCompanion , SEARCH_COMPANION_FIELD } from './search-companion.js' ;
59- import { ObjectStackManifest , ManifestSchema , InstalledPackage , InstalledPackageSchema , InstalledPackageSourceSchema , type InstalledPackageSource , checkFieldCompleteness } from '@objectstack/spec/kernel' ;
59+ import { ObjectStackManifest , ManifestSchema , InstalledPackage , InstalledPackageSchema , InstalledPackageSourceSchema , type InstalledPackageSource , checkFieldCompleteness , customizationBasePackageId } from '@objectstack/spec/kernel' ;
6060import { DEFAULT_FLOW_FUNCTION_EFFECT } from '@objectstack/spec/automation' ;
6161import { AppSchema , ActionSchema } from '@objectstack/spec/ui' ;
6262import { applyProtection } from '@objectstack/spec/shared' ;
@@ -3336,7 +3336,7 @@ const EXTENDED_OBJECTS_LISTED = 5;
33363336 * so one answer is the whole way out rather than the first step of several.
33373337 *
33383338 * [#28408, ADR-0146 D3] …and the uninstall refusal of a base whose paired
3339- * customization package is installed and stands on it: the App's pair of an
3339+ * customization package is installed and named for it: the App's pair of an
33403340 * App, or the per-package pair an earlier version created for a package
33413341 * ({@link pairsOf}), held by this registry. That package
33423342 * holds every customization of the base, so uninstalling the base under it
@@ -7353,9 +7353,9 @@ export class SchemaRegistry {
73537353 * package is refused exactly when the first such object exists.
73547354 *
73557355 * [#28408, ADR-0146 D3] It also refuses while this registry holds the
7356- * package's paired customization package that declares `packageId` — one
7357- * of the ids {@link pairsOf} looks up for it (the App's pair stands on the
7358- * App, not on a member) — so the pair is
7356+ * package's paired customization package named for `packageId` — one
7357+ * of the ids {@link pairsOf} looks up for it (the App's pair is named for
7358+ * the App, not for a member) — so the pair is
73597359 * found by id alone, whichever door created or installed it. The same
73607360 * refusal, carrying both causes when both hold. Uninstalling the pair itself
73617361 * asks nothing of this kind: a `.custom` id derives no pair of its own. An
@@ -7386,15 +7386,14 @@ export class SchemaRegistry {
73867386 extended . push ( { objectName : fqn , extenders : otherExtenders . map ( c => String ( c . packageId ) ) } ) ;
73877387 }
73887388 }
7389- // [ADR-0146 D3 · merge questions 11, 12] The installed pair that stands
7390- // on this package: the App's pair when this is the App (a member's
7389+ // [ADR-0146 D3 · merge questions 11, 12] The installed pair named for
7390+ // this package: the App's pair when this is the App (a member's
73917391 // uninstall keeps and marks its overrides in the App's pair, and is not
73927392 // refused for it), or the per-package pair an earlier version created
7393- // for this package — each declares the package it stands on.
7394- const installedPair = pairsOf ( packageId , installedManifestsOf ( this ) ) . find ( ( id ) => {
7395- const dependencies = ( this . getPackage ( id ) ?. manifest as { dependencies ?: unknown } | undefined ) ?. dependencies ;
7396- return typeof dependencies === 'object' && dependencies !== null && Object . prototype . hasOwnProperty . call ( dependencies , packageId ) ;
7397- } ) ;
7393+ // for this package.
7394+ const installedPair = pairsOf ( packageId , installedManifestsOf ( this ) ) . find (
7395+ ( id ) => customizationBasePackageId ( id ) === packageId && this . getPackage ( id ) !== undefined ,
7396+ ) ;
73987397 if ( extended . length > 0 || installedPair !== undefined ) {
73997398 throw new PackageUninstallExtendedError ( packageId , extended , installedPair ) ;
74007399 }
0 commit comments