@happyvertical/smrt-core 0.51.25 → 0.51.26
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/AGENTS.md +14 -5
- package/dist/manifest/manifest-loader.d.ts +37 -0
- package/dist/manifest/manifest-loader.d.ts.map +1 -1
- package/dist/manifest/manifest-loader.js +45 -14
- package/dist/manifest/manifest-loader.js.map +1 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/registry/__tests__/helpers/consumer-workspace.d.ts +42 -0
- package/dist/registry/__tests__/helpers/consumer-workspace.d.ts.map +1 -0
- package/dist/registry/class-registration.d.ts +15 -0
- package/dist/registry/class-registration.d.ts.map +1 -1
- package/dist/registry/class-registration.js +129 -19
- package/dist/registry/class-registration.js.map +1 -1
- package/dist/registry/collection-resolution.d.ts +8 -2
- package/dist/registry/collection-resolution.d.ts.map +1 -1
- package/dist/registry/collection-resolution.js +12 -2
- package/dist/registry/collection-resolution.js.map +1 -1
- package/dist/registry/collision-policy.d.ts +10 -0
- package/dist/registry/collision-policy.d.ts.map +1 -1
- package/dist/registry/collision-policy.js +7 -1
- package/dist/registry/collision-policy.js.map +1 -1
- package/dist/registry/shared-state.d.ts.map +1 -1
- package/dist/registry/shared-state.js +3 -4
- package/dist/registry/shared-state.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +16 -3
- package/dist/registry.js.map +1 -1
- package/dist/smrt-knowledge.json +5 -5
- package/dist/utils/stack-frames.d.ts +19 -0
- package/dist/utils/stack-frames.d.ts.map +1 -1
- package/dist/utils/stack-frames.js +59 -1
- package/dist/utils/stack-frames.js.map +1 -1
- package/package.json +4 -4
|
@@ -19,8 +19,14 @@ export interface CollectionRegistrationLookup {
|
|
|
19
19
|
* creates a base-columns-only table, dropping the junction's FK columns
|
|
20
20
|
* (#1342 — `place_assets` vs `profile_assets` asymmetry).
|
|
21
21
|
*
|
|
22
|
+
* `SmrtReportCollection` (`@happyvertical/smrt-reports`) is the same case: a
|
|
23
|
+
* framework collection base that is never registered, so a report collection
|
|
24
|
+
* (`class XCollection extends SmrtReportCollection<X>`) was classified as a
|
|
25
|
+
* table-bearing class and claimed its item's table. The schema planner then
|
|
26
|
+
* rejected the pair as two unrelated owners of one table (#3110).
|
|
27
|
+
*
|
|
22
28
|
* Keep in sync with the collection bases that extend `SmrtCollection` in
|
|
23
|
-
* `packages/core/src/junction.ts`. (`SmrtHierarchical` and
|
|
29
|
+
* `packages/core/src/junction.ts` and `packages/reports/src/report.ts`. (`SmrtHierarchical` and
|
|
24
30
|
* `SmrtPolymorphicAssociation` extend `SmrtObject`, not `SmrtCollection`, so
|
|
25
31
|
* they deliberately do NOT belong here.)
|
|
26
32
|
*
|
|
@@ -36,7 +42,7 @@ export interface CollectionRegistrationLookup {
|
|
|
36
42
|
* duplicate detector is exactly how the #1342 junction schema-drop bug
|
|
37
43
|
* half-survived the original core fix.
|
|
38
44
|
*/
|
|
39
|
-
export declare const SMRT_COLLECTION_BASE_NAMES: readonly ["SmrtCollection", "SmrtJunction"];
|
|
45
|
+
export declare const SMRT_COLLECTION_BASE_NAMES: readonly ["SmrtCollection", "SmrtJunction", "SmrtReportCollection"];
|
|
40
46
|
export declare function isSmrtCollectionExtendsName(extendsName: string | undefined): boolean;
|
|
41
47
|
export declare function resolveRelatedRegistration(className: string, origin: RegisteredClass, lookup: CollectionRegistrationLookup): RegisteredClass | undefined;
|
|
42
48
|
export declare function getCollectionChainRegistrations(className: string, registered: RegisteredClass, lookup: CollectionRegistrationLookup): RegisteredClass[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-resolution.d.ts","sourceRoot":"","sources":["../../src/registry/collection-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACzD,kBAAkB,CAAC,EAAE,CACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,eAAe,GAAG,SAAS,CAAC;IACjC,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;CACtD;AAED
|
|
1
|
+
{"version":3,"file":"collection-resolution.d.ts","sourceRoot":"","sources":["../../src/registry/collection-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACzD,kBAAkB,CAAC,EAAE,CACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,eAAe,GAAG,SAAS,CAAC;IACjC,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,0BAA0B,qEAI7B,CAAC;AAEX,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAOT;AAED,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,4BAA4B,GACnC,eAAe,GAAG,SAAS,CAa7B;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,eAAe,EAAE,CAiBnB;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAQT;AA+DD,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,MAAM,GAAG,SAAS,CAmCpB"}
|
|
@@ -14,8 +14,14 @@
|
|
|
14
14
|
* creates a base-columns-only table, dropping the junction's FK columns
|
|
15
15
|
* (#1342 — `place_assets` vs `profile_assets` asymmetry).
|
|
16
16
|
*
|
|
17
|
+
* `SmrtReportCollection` (`@happyvertical/smrt-reports`) is the same case: a
|
|
18
|
+
* framework collection base that is never registered, so a report collection
|
|
19
|
+
* (`class XCollection extends SmrtReportCollection<X>`) was classified as a
|
|
20
|
+
* table-bearing class and claimed its item's table. The schema planner then
|
|
21
|
+
* rejected the pair as two unrelated owners of one table (#3110).
|
|
22
|
+
*
|
|
17
23
|
* Keep in sync with the collection bases that extend `SmrtCollection` in
|
|
18
|
-
* `packages/core/src/junction.ts`. (`SmrtHierarchical` and
|
|
24
|
+
* `packages/core/src/junction.ts` and `packages/reports/src/report.ts`. (`SmrtHierarchical` and
|
|
19
25
|
* `SmrtPolymorphicAssociation` extend `SmrtObject`, not `SmrtCollection`, so
|
|
20
26
|
* they deliberately do NOT belong here.)
|
|
21
27
|
*
|
|
@@ -31,7 +37,11 @@
|
|
|
31
37
|
* duplicate detector is exactly how the #1342 junction schema-drop bug
|
|
32
38
|
* half-survived the original core fix.
|
|
33
39
|
*/
|
|
34
|
-
var SMRT_COLLECTION_BASE_NAMES = [
|
|
40
|
+
var SMRT_COLLECTION_BASE_NAMES = [
|
|
41
|
+
"SmrtCollection",
|
|
42
|
+
"SmrtJunction",
|
|
43
|
+
"SmrtReportCollection"
|
|
44
|
+
];
|
|
35
45
|
function isSmrtCollectionExtendsName(extendsName) {
|
|
36
46
|
if (!extendsName) return false;
|
|
37
47
|
return SMRT_COLLECTION_BASE_NAMES.some((base) => extendsName === base || extendsName.endsWith(`:${base}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-resolution.js","names":[],"sources":["../../src/registry/collection-resolution.ts"],"sourcesContent":["import type { RegisteredClass } from './types';\n\nexport interface CollectionRegistrationLookup {\n findClass: (name: string) => RegisteredClass | undefined;\n findClassInPackage?: (\n packageName: string,\n className: string,\n ) => RegisteredClass | undefined;\n getInheritanceChain: (className: string) => string[];\n}\n\n/**\n * Framework base classes that ARE collections (extend `SmrtCollection`).\n *\n * `SmrtJunction` is an abstract collection base — junction collections declare\n * `extends SmrtJunction<Item>`, and the manifest records that *direct* parent.\n * `SmrtJunction` is itself never registered in a consumer's registry, so the\n * inheritance-chain walk in `isCollectionRegistration()` cannot reach\n * `SmrtCollection` through it. Recognizing the junction base by name here is\n * what keeps a junction Collection classified as a collection (and therefore\n * redirected to its item class for schema generation) regardless of\n * registration order. Without it, a junction Collection that is iterated\n * before its item class is mistaken for a regular table-bearing class and\n * creates a base-columns-only table, dropping the junction's FK columns\n * (#1342 — `place_assets` vs `profile_assets` asymmetry).\n *\n * Keep in sync with the collection bases that extend `SmrtCollection` in\n * `packages/core/src/junction.ts`. (`SmrtHierarchical` and\n * `SmrtPolymorphicAssociation` extend `SmrtObject`, not `SmrtCollection`, so\n * they deliberately do NOT belong here.)\n *\n * A new framework collection base must also be added to the other parallel\n * framework-base lists so it is recognized everywhere it matters:\n * - `FRAMEWORK_BASE_CLASSES` in\n * `packages/scanner/src/inheritance-resolver.ts` (scanner chain termination).\n * - `FRAMEWORK_ABSTRACT_BASE_NAMES` in\n * `packages/core/src/scanner/manifest-generator.ts` (field-merge skipping).\n *\n * Downstream tooling that needs this detector (e.g. @happyvertical/smrt-vitest)\n * should IMPORT it from `@happyvertical/smrt-core` rather than keep a copy — a\n * duplicate detector is exactly how the #1342 junction schema-drop bug\n * half-survived the original core fix.\n */\nexport const SMRT_COLLECTION_BASE_NAMES = [\n 'SmrtCollection',\n 'SmrtJunction',\n] as const;\n\nexport function isSmrtCollectionExtendsName(\n extendsName: string | undefined,\n): boolean {\n if (!extendsName) {\n return false;\n }\n return SMRT_COLLECTION_BASE_NAMES.some(\n (base) => extendsName === base || extendsName.endsWith(`:${base}`),\n );\n}\n\nexport function resolveRelatedRegistration(\n className: string,\n origin: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): RegisteredClass | undefined {\n if (className.includes(':')) {\n return lookup.findClass(className);\n }\n\n if (origin.packageName && lookup.findClassInPackage) {\n return (\n lookup.findClassInPackage(origin.packageName, className) ||\n lookup.findClass(className)\n );\n }\n\n return lookup.findClass(className);\n}\n\nexport function getCollectionChainRegistrations(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): RegisteredClass[] {\n const lookupName = registered.qualifiedName || registered.name || className;\n const chain = lookup.getInheritanceChain(lookupName);\n const registrations: RegisteredClass[] = [];\n\n for (const chainName of chain) {\n const chainEntry = resolveRelatedRegistration(\n chainName,\n registered,\n lookup,\n );\n if (chainEntry) {\n registrations.push(chainEntry);\n }\n }\n\n return registrations;\n}\n\nexport function isCollectionRegistration(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): boolean {\n if (isSmrtCollectionExtendsName(registered.extends)) {\n return true;\n }\n\n return getCollectionChainRegistrations(className, registered, lookup).some(\n (chainEntry) => isSmrtCollectionExtendsName(chainEntry.extends),\n );\n}\n\nfunction getStaticItemClassName(\n registered: RegisteredClass,\n): string | undefined {\n const itemClass = (\n registered.constructor as unknown as {\n _itemClass?: { name?: string };\n }\n )._itemClass;\n return itemClass?.name;\n}\n\nfunction getCollectionItemNameCandidates(className: string): string[] {\n const candidates: string[] = [];\n const simpleName = className.includes(':')\n ? className.slice(className.lastIndexOf(':') + 1)\n : className;\n\n const addCandidate = (candidate: string): void => {\n if (\n candidate &&\n candidate !== simpleName &&\n !candidates.includes(candidate)\n ) {\n candidates.push(candidate);\n }\n };\n\n if (simpleName.endsWith('Collection')) {\n addCandidate(simpleName.slice(0, -'Collection'.length));\n }\n\n if (simpleName.endsWith('ies')) {\n addCandidate(`${simpleName.slice(0, -3)}y`);\n } else if (simpleName.endsWith('s')) {\n addCandidate(simpleName.slice(0, -1));\n }\n\n return candidates;\n}\n\nfunction inferCollectionItemClassName(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): string | undefined {\n const lookupName = registered.name || className;\n\n for (const candidate of getCollectionItemNameCandidates(lookupName)) {\n const candidateRegistration = resolveRelatedRegistration(\n candidate,\n registered,\n lookup,\n );\n if (candidateRegistration) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nexport function resolveCollectionItemClassName(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): string | undefined {\n const staticItemClassName = getStaticItemClassName(registered);\n if (staticItemClassName) {\n return staticItemClassName;\n }\n\n if (registered.extendsTypeArg) {\n return registered.extendsTypeArg;\n }\n\n const inferredItemClassName = inferCollectionItemClassName(\n className,\n registered,\n lookup,\n );\n if (inferredItemClassName) {\n return inferredItemClassName;\n }\n\n const chain = getCollectionChainRegistrations(\n className,\n registered,\n lookup,\n ).reverse();\n\n for (const chainEntry of chain) {\n if (chainEntry === registered) {\n continue;\n }\n if (chainEntry.extendsTypeArg) {\n return chainEntry.extendsTypeArg;\n }\n }\n\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection-resolution.js","names":[],"sources":["../../src/registry/collection-resolution.ts"],"sourcesContent":["import type { RegisteredClass } from './types';\n\nexport interface CollectionRegistrationLookup {\n findClass: (name: string) => RegisteredClass | undefined;\n findClassInPackage?: (\n packageName: string,\n className: string,\n ) => RegisteredClass | undefined;\n getInheritanceChain: (className: string) => string[];\n}\n\n/**\n * Framework base classes that ARE collections (extend `SmrtCollection`).\n *\n * `SmrtJunction` is an abstract collection base — junction collections declare\n * `extends SmrtJunction<Item>`, and the manifest records that *direct* parent.\n * `SmrtJunction` is itself never registered in a consumer's registry, so the\n * inheritance-chain walk in `isCollectionRegistration()` cannot reach\n * `SmrtCollection` through it. Recognizing the junction base by name here is\n * what keeps a junction Collection classified as a collection (and therefore\n * redirected to its item class for schema generation) regardless of\n * registration order. Without it, a junction Collection that is iterated\n * before its item class is mistaken for a regular table-bearing class and\n * creates a base-columns-only table, dropping the junction's FK columns\n * (#1342 — `place_assets` vs `profile_assets` asymmetry).\n *\n * `SmrtReportCollection` (`@happyvertical/smrt-reports`) is the same case: a\n * framework collection base that is never registered, so a report collection\n * (`class XCollection extends SmrtReportCollection<X>`) was classified as a\n * table-bearing class and claimed its item's table. The schema planner then\n * rejected the pair as two unrelated owners of one table (#3110).\n *\n * Keep in sync with the collection bases that extend `SmrtCollection` in\n * `packages/core/src/junction.ts` and `packages/reports/src/report.ts`. (`SmrtHierarchical` and\n * `SmrtPolymorphicAssociation` extend `SmrtObject`, not `SmrtCollection`, so\n * they deliberately do NOT belong here.)\n *\n * A new framework collection base must also be added to the other parallel\n * framework-base lists so it is recognized everywhere it matters:\n * - `FRAMEWORK_BASE_CLASSES` in\n * `packages/scanner/src/inheritance-resolver.ts` (scanner chain termination).\n * - `FRAMEWORK_ABSTRACT_BASE_NAMES` in\n * `packages/core/src/scanner/manifest-generator.ts` (field-merge skipping).\n *\n * Downstream tooling that needs this detector (e.g. @happyvertical/smrt-vitest)\n * should IMPORT it from `@happyvertical/smrt-core` rather than keep a copy — a\n * duplicate detector is exactly how the #1342 junction schema-drop bug\n * half-survived the original core fix.\n */\nexport const SMRT_COLLECTION_BASE_NAMES = [\n 'SmrtCollection',\n 'SmrtJunction',\n 'SmrtReportCollection',\n] as const;\n\nexport function isSmrtCollectionExtendsName(\n extendsName: string | undefined,\n): boolean {\n if (!extendsName) {\n return false;\n }\n return SMRT_COLLECTION_BASE_NAMES.some(\n (base) => extendsName === base || extendsName.endsWith(`:${base}`),\n );\n}\n\nexport function resolveRelatedRegistration(\n className: string,\n origin: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): RegisteredClass | undefined {\n if (className.includes(':')) {\n return lookup.findClass(className);\n }\n\n if (origin.packageName && lookup.findClassInPackage) {\n return (\n lookup.findClassInPackage(origin.packageName, className) ||\n lookup.findClass(className)\n );\n }\n\n return lookup.findClass(className);\n}\n\nexport function getCollectionChainRegistrations(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): RegisteredClass[] {\n const lookupName = registered.qualifiedName || registered.name || className;\n const chain = lookup.getInheritanceChain(lookupName);\n const registrations: RegisteredClass[] = [];\n\n for (const chainName of chain) {\n const chainEntry = resolveRelatedRegistration(\n chainName,\n registered,\n lookup,\n );\n if (chainEntry) {\n registrations.push(chainEntry);\n }\n }\n\n return registrations;\n}\n\nexport function isCollectionRegistration(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): boolean {\n if (isSmrtCollectionExtendsName(registered.extends)) {\n return true;\n }\n\n return getCollectionChainRegistrations(className, registered, lookup).some(\n (chainEntry) => isSmrtCollectionExtendsName(chainEntry.extends),\n );\n}\n\nfunction getStaticItemClassName(\n registered: RegisteredClass,\n): string | undefined {\n const itemClass = (\n registered.constructor as unknown as {\n _itemClass?: { name?: string };\n }\n )._itemClass;\n return itemClass?.name;\n}\n\nfunction getCollectionItemNameCandidates(className: string): string[] {\n const candidates: string[] = [];\n const simpleName = className.includes(':')\n ? className.slice(className.lastIndexOf(':') + 1)\n : className;\n\n const addCandidate = (candidate: string): void => {\n if (\n candidate &&\n candidate !== simpleName &&\n !candidates.includes(candidate)\n ) {\n candidates.push(candidate);\n }\n };\n\n if (simpleName.endsWith('Collection')) {\n addCandidate(simpleName.slice(0, -'Collection'.length));\n }\n\n if (simpleName.endsWith('ies')) {\n addCandidate(`${simpleName.slice(0, -3)}y`);\n } else if (simpleName.endsWith('s')) {\n addCandidate(simpleName.slice(0, -1));\n }\n\n return candidates;\n}\n\nfunction inferCollectionItemClassName(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): string | undefined {\n const lookupName = registered.name || className;\n\n for (const candidate of getCollectionItemNameCandidates(lookupName)) {\n const candidateRegistration = resolveRelatedRegistration(\n candidate,\n registered,\n lookup,\n );\n if (candidateRegistration) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nexport function resolveCollectionItemClassName(\n className: string,\n registered: RegisteredClass,\n lookup: CollectionRegistrationLookup,\n): string | undefined {\n const staticItemClassName = getStaticItemClassName(registered);\n if (staticItemClassName) {\n return staticItemClassName;\n }\n\n if (registered.extendsTypeArg) {\n return registered.extendsTypeArg;\n }\n\n const inferredItemClassName = inferCollectionItemClassName(\n className,\n registered,\n lookup,\n );\n if (inferredItemClassName) {\n return inferredItemClassName;\n }\n\n const chain = getCollectionChainRegistrations(\n className,\n registered,\n lookup,\n ).reverse();\n\n for (const chainEntry of chain) {\n if (chainEntry === registered) {\n continue;\n }\n if (chainEntry.extendsTypeArg) {\n return chainEntry.extendsTypeArg;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAa,6BAA6B;CACxC;CACA;CACA;AACF;AAEA,SAAgB,4BACd,aACS;CACT,IAAI,CAAC,aACH,OAAO;CAET,OAAO,2BAA2B,MAC/B,SAAS,gBAAgB,QAAQ,YAAY,SAAS,IAAI,MAAM,CACnE;AACF;AAEA,SAAgB,2BACd,WACA,QACA,QAC6B;CAC7B,IAAI,UAAU,SAAS,GAAG,GACxB,OAAO,OAAO,UAAU,SAAS;CAGnC,IAAI,OAAO,eAAe,OAAO,oBAC/B,OACE,OAAO,mBAAmB,OAAO,aAAa,SAAS,KACvD,OAAO,UAAU,SAAS;CAI9B,OAAO,OAAO,UAAU,SAAS;AACnC;AAEA,SAAgB,gCACd,WACA,YACA,QACmB;CACnB,MAAM,aAAa,WAAW,iBAAiB,WAAW,QAAQ;CAClE,MAAM,QAAQ,OAAO,oBAAoB,UAAU;CACnD,MAAM,gBAAmC,CAAC;CAE1C,KAAK,MAAM,aAAa,OAAO;EAC7B,MAAM,aAAa,2BACjB,WACA,YACA,MACF;EACA,IAAI,YACF,cAAc,KAAK,UAAU;CAEjC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EAEF,IAAI,WAAW,gBACb,OAAO,WAAW;CAEtB;AAGF"}
|
|
@@ -153,6 +153,16 @@ export interface CollisionInputs {
|
|
|
153
153
|
* treats it as promotion rather than collision.
|
|
154
154
|
*/
|
|
155
155
|
readonly existingHasNoPackage: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Decorator-origin only: the table the `@smrt()` decorator resolved for the
|
|
158
|
+
* new class (its explicit `tableName`, its STI parent's table, or the name
|
|
159
|
+
* derived from the class) differs from the existing entry's table. A
|
|
160
|
+
* duplicate of one class — pnpm copy, inlined chunk — resolves the same
|
|
161
|
+
* table, so this is positive evidence of a different class (#3106): ergot's
|
|
162
|
+
* `LicenseSale` resolves `license_sales` where smrt-commerce's STI subtype
|
|
163
|
+
* resolves `contracts`.
|
|
164
|
+
*/
|
|
165
|
+
readonly declaresDifferentTable: boolean;
|
|
156
166
|
}
|
|
157
167
|
export interface PolicyDecision {
|
|
158
168
|
readonly policy: Policy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collision-policy.d.ts","sourceRoot":"","sources":["../../src/registry/collision-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAE5E,MAAM,MAAM,MAAM;AAChB,yEAAyE;AACvE,QAAQ;AACV,kDAAkD;GAChD,SAAS;AACX;;;;;;GAMG;GACD,gBAAgB;AAClB;;;;GAIG;GACD,mBAAmB;AACrB,2DAA2D;GACzD,MAAM;AACR,0DAA0D;GACxD,OAAO,CAAC;AAEZ;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IA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AAC,qCAAqC,EAAE,OAAO,CAAC;IAExD;;;;;;OAMG;IACH,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAEvC;;;;;;;;OAQG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,GAAG;IACX,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,MAAM,CAAC;CACtD;AAwPD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,CAc7E;AAED,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,EAAE,SAAS,GAAG,EAAS,CAAC"}
|
|
@@ -17,7 +17,7 @@ var ROWS = [
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
scenario: "manifest-stub-replacement",
|
|
20
|
-
match: (i) => i.origin === "decorator" && i.existingIsManifestStub && !i.sameConstructor,
|
|
20
|
+
match: (i) => i.origin === "decorator" && i.existingIsManifestStub && !i.sameConstructor && !(i.hasNewQualifiedKey && i.existingHasAnyPackage && !i.samePackage && !i.sameSourceFile && (i.bothSourceFilesKnown && !i.newInBundledContext || i.declaresDifferentTable)),
|
|
21
21
|
policy: "replace",
|
|
22
22
|
reason: () => "Existing entry is a manifest stub placeholder; the real implementation takes over."
|
|
23
23
|
},
|
|
@@ -69,6 +69,12 @@ var ROWS = [
|
|
|
69
69
|
policy: "accept",
|
|
70
70
|
reason: () => "pnpm store duplicated the same package; different physical constructors but semantically identical."
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
scenario: "decorator-different-packages-qualified-coexist",
|
|
74
|
+
match: (i) => i.origin === "decorator" && i.hasNewQualifiedKey && i.existingHasAnyPackage && !i.samePackage && !i.sameSourceFile && !i.newExtendsExisting && !i.existingExtendsNew && (!i.newInBundledContext || i.declaresDifferentTable),
|
|
75
|
+
policy: "coexist-qualified",
|
|
76
|
+
reason: () => "Different packages declare the same simple name; both registrations live under their qualified keys (issue #3106)."
|
|
77
|
+
},
|
|
72
78
|
{
|
|
73
79
|
scenario: "decorator-bundled-context-known-package",
|
|
74
80
|
match: (i) => i.origin === "decorator" && i.newInBundledContext && i.existingIsPackageQualified,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collision-policy.js","names":[],"sources":["../../src/registry/collision-policy.ts"],"sourcesContent":["/**\n * Release C (#1134) — unified collision policy for class registration.\n *\n * `register()` and `registerFromManifest()` both need to decide what to do\n * when a new registration lands on an existing class with the same (or a\n * case-insensitive-matching) name. Before Release C the decision logic was\n * a ~300-line if/else tree duplicated across three code paths:\n *\n * - `register()` exact-match branch (class-registration.ts:159-275)\n * - `register()` case-insensitive branch (class-registration.ts:286-391)\n * - `resolveManifestCollision()` (class-registration.ts:876-929)\n *\n * This module collapses all three onto a single decision table. Each row\n * names a scenario that exists in the current test suite; the row order\n * encodes specificity (first match wins).\n *\n * # Invocation contract\n *\n * `decideCollisionPolicy(inputs)` is ONLY called when the caller has already\n * identified exactly one colliding candidate for the new registration. Two\n * cases MUST be handled upstream without consulting the table:\n *\n * 1. No colliding candidate exists → register fresh.\n * 2. Ambiguous simple name matches >1 existing entry across different\n * packages (`getCanonicalClassName()` returns undefined) → fall through\n * to the exact-key path and allow coexistence under qualified keys.\n * See issue #951 for the semantics being preserved.\n *\n * Feeding the ambiguous case through the table would lose the\n * `coexist-qualified` behavior that's crucial for multi-package apps.\n *\n * @see https://github.com/happyvertical/smrt/issues/1134\n */\n\nexport type RegistrationOrigin = 'decorator' | 'manifest';\n\n/**\n * How the colliding candidate was identified.\n *\n * - `exact-key` : `classes.get(name)` returned the candidate.\n * `existingKey === name`.\n * - `case-insensitive` : Iteration found a case-insensitive match on\n * either the registry key or the entry's `name`\n * property. `existingKey !== name`.\n * - `canonical-name` : Looked up via `getCanonicalClassName(simpleName)`\n * — unambiguous single match under a lowered\n * simple name. Used by the manifest path.\n */\nexport type MatchKind = 'exact-key' | 'case-insensitive' | 'canonical-name';\n\nexport type Policy =\n /** Keep existing identity, update metadata via `upsertExistingEntry`. */\n | 'accept'\n /** Drop existing, register new as replacement. */\n | 'replace'\n /**\n * Fold manifest fields into existing registration. The **caller MUST**:\n * (1) call `mergeManifestIntoExistingRegistration(existing, objectDef, packageName)`\n * (2) if `registrationKey !== existingCanonical`, alias the existing entry\n * under `registrationKey` via `classes.set()` + `constructorIndex.set()`\n * Both steps together preserve the `issue-951:144-200` contract.\n */\n | 'merge-manifest'\n /**\n * Different packages, different qualified keys. Both registrations stay\n * in the classes Map under their respective qualified keys. Ambiguity is\n * surfaced at `findClass` time. Preserves issue #951.\n */\n | 'coexist-qualified'\n /** Existing wins; silently ignore the new registration. */\n | 'skip'\n /** Unresolvable collision — raise a user-facing error. */\n | 'throw';\n\n/**\n * Every signal the decision table can read. Computed by the caller from\n * inspection of the new and existing registrations.\n */\nexport interface CollisionInputs {\n readonly origin: RegistrationOrigin;\n readonly matchKind: MatchKind;\n\n /** `new.ctor === existing.constructor` (decorator path only; false for manifest). */\n readonly sameConstructor: boolean;\n\n /** `new.sourceFile === existing.sourceFilePath`, both truthy. */\n readonly sameSourceFile: boolean;\n\n /** Both the new and existing registrations have known source files. */\n readonly bothSourceFilesKnown: boolean;\n\n /** `existing.constructor._isManifestStub === true`. */\n readonly existingIsManifestStub: boolean;\n\n /**\n * New registration's source file lives in a bundled output directory\n * (`.svelte-kit/output/`, `/dist/`, `/build/`, `.next/`, `.nuxt/`).\n */\n readonly newInBundledContext: boolean;\n\n /**\n * New class extends existing.\n * - decorator path: `new.ctor.prototype instanceof existing.constructor`\n * - manifest path : `new.objectDef.extends` names existing\n */\n readonly newExtendsExisting: boolean;\n\n /** Inverse direction: existing extends new. */\n readonly existingExtendsNew: boolean;\n\n /** `new.packageName === existing.packageName` (both truthy). */\n readonly samePackage: boolean;\n\n /**\n * `existing.packageName?.startsWith('@')` — existing entry came from a\n * **scoped** package manifest (e.g. `@happyvertical/smrt-core`). Used by\n * the external-package-replace (#584) and bundled-context scenarios\n * that were gated on `@` in pre-Release-C code.\n */\n readonly existingIsPackageQualified: boolean;\n\n /**\n * Existing entry carries any packageName, scoped or not. Broader than\n * `existingIsPackageQualified`. Used for the different-packages\n * coexistence scenario where pre-Release-C code only required both\n * packageNames to be present and different (unscoped manifests like\n * `smrt-profiles` count here).\n */\n readonly existingHasAnyPackage: boolean;\n\n /**\n * Case-sensitive equality between `new.name` and `existing.name`.\n * Used to distinguish a pnpm-duplicate (same exact name) from a genuine\n * case-insensitive collision (different names that lower to the same string).\n */\n readonly sameName: boolean;\n\n /**\n * New registration has (or can derive) a qualified key `@pkg:Name`.\n * Paired with `existingIsPackageQualified` to drive the different-packages\n * coexistence behavior from issue #951.\n */\n readonly hasNewQualifiedKey: boolean;\n\n /**\n * Existing registry key contains a `:` separator. Needed alongside\n * `existingIsPackageQualified` to identify valid pnpm-dup candidates\n * (old code required both).\n */\n readonly existingKeyIsQualified: boolean;\n\n /**\n * Manifest-origin only: the incoming `objectDef` carries at least one of\n * `fields`, `methods`, `schema`, or `decoratorConfig`. Without that, the\n * merge path has nothing to fold in and the caller should skip the\n * merge-manifest policy entirely.\n */\n readonly hasManifestContent: boolean;\n\n /**\n * Manifest-origin only: the new registration's qualified key differs\n * from the existing entry's canonical key. When true and the policy is\n * `merge-manifest`, the caller MUST also alias the existing entry under\n * the new qualified key (step 2 of the merge-manifest contract).\n */\n readonly registrationKeyDiffersFromExistingKey: boolean;\n\n /**\n * Existing registration has no `packageName` set. Distinct from\n * `!samePackage`: this specifically means the existing entry is a bare\n * source registration waiting for a package manifest to promote it. When\n * true and the new registration carries a packageName, merge-manifest\n * treats it as promotion rather than collision.\n */\n readonly existingHasNoPackage: boolean;\n}\n\nexport interface PolicyDecision {\n readonly policy: Policy;\n /** Stable id. Matches the scenario name in the test suite 1-to-1. */\n readonly scenario: string;\n /** Human-readable explanation. Used by verboseLog + the error message. */\n readonly reason: string;\n}\n\ninterface Row {\n readonly scenario: string;\n readonly match: (inputs: CollisionInputs) => boolean;\n readonly policy: Policy;\n readonly reason: (inputs: CollisionInputs) => string;\n}\n\n/**\n * Ordered decision table. First row whose `match` returns true wins.\n * Order reflects specificity — scenarios that narrow down earlier\n * scenarios come before them.\n *\n * Each row is named to match a scenario in the test suite so a reviewer\n * can bisect one-to-one between \"new class extends existing\" (the code)\n * and \"sti-child-wins\" (the test row and the verbose-log output).\n */\nconst ROWS: readonly Row[] = [\n // --- Cross-origin: constructor identity and stub replacement ----------\n\n {\n scenario: 'same-constructor-reregistration',\n match: (i) => i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'Same constructor identity — module re-evaluation. Update metadata only.',\n },\n\n {\n // Decorator-only: the decorator fires after a manifest builder\n // pre-registered a stub placeholder under this name. The real class\n // takes over. Manifest-origin stub-to-stub arrivals fall through to\n // the source-file / STI rows instead.\n scenario: 'manifest-stub-replacement',\n match: (i) =>\n i.origin === 'decorator' &&\n i.existingIsManifestStub &&\n !i.sameConstructor,\n policy: 'replace',\n reason: () =>\n 'Existing entry is a manifest stub placeholder; the real implementation takes over.',\n },\n\n // --- Manifest-origin rows (checked before decorator-origin) -----------\n\n {\n scenario: 'manifest-same-source-file',\n match: (i) => i.origin === 'manifest' && i.sameSourceFile,\n policy: 'skip',\n reason: () =>\n 'Same source file — consumer manifest re-export, not a real collision.',\n },\n\n {\n scenario: 'manifest-sti-child-wins',\n match: (i) =>\n i.origin === 'manifest' && i.newExtendsExisting && !i.existingExtendsNew,\n policy: 'replace',\n reason: () =>\n 'Manifest entry extends existing — STI child wins over parent.',\n },\n\n {\n scenario: 'manifest-sti-parent-skip',\n match: (i) =>\n i.origin === 'manifest' && i.existingExtendsNew && !i.newExtendsExisting,\n policy: 'skip',\n reason: () =>\n 'Existing entry is the STI child of the incoming manifest parent; keep the child.',\n },\n\n {\n // Uses `existingHasAnyPackage` not `existingIsPackageQualified`: the\n // pre-Release-C `allowCoexistingQualifiedRegistration` check only\n // required both packages to be present and differ, regardless of\n // whether they were scoped (`@scope/pkg`) or unscoped (`smrt-profiles`).\n // Narrowing to scoped would silently drop coexistence for unscoped\n // manifests. See PR #1140 review (willgriffin P2 at line 251).\n scenario: 'manifest-different-packages-qualified-coexist',\n match: (i) =>\n i.origin === 'manifest' &&\n !i.samePackage &&\n i.hasNewQualifiedKey &&\n i.existingHasAnyPackage,\n policy: 'coexist-qualified',\n reason: () =>\n 'Different packages share a simple name; both registrations live under their qualified keys (issue #951).',\n },\n\n {\n // Covers three related scenarios:\n // (a) `samePackage` — decorator + manifest from the same\n // package land on the same class; merge fields (issue #1000).\n // (b) `existingHasNoPackage` — source registration hasn't been\n // promoted to a qualified key yet and a manifest now provides\n // the package identity (issue #951:144-200). The merge runs\n // AND the caller aliases the existing entry under the new\n // qualified key.\n // (c) The same scenarios when the existing entry is a manifest\n // stub from an earlier unqualified/local manifest registration\n // — the pre-Release-C code merged whenever\n // `!existing.packageName || packageName === existing.packageName`\n // regardless of stub status. Release C preserves that: removing\n // the `!existingIsManifestStub` gate lets a later\n // package-qualified manifest upgrade a stub's fields + alias\n // under the qualified key. See PR #1140 review (willgriffin P1\n // at line 270).\n scenario: 'manifest-same-package-merge',\n match: (i) =>\n i.origin === 'manifest' &&\n (i.samePackage || (i.existingHasNoPackage && i.hasNewQualifiedKey)) &&\n i.hasManifestContent,\n policy: 'merge-manifest',\n reason: () =>\n 'Manifest arriving for an existing same-package or unqualified source registration; fold fields in and alias the qualified key if keys differ.',\n },\n\n {\n scenario: 'manifest-default-skip',\n match: (i) => i.origin === 'manifest',\n policy: 'skip',\n reason: () =>\n 'Manifest collision with no inheritance relationship; keep existing entry (pre-Release-C resolveManifestCollision default).',\n },\n\n // --- Decorator-origin rows --------------------------------------------\n\n {\n scenario: 'decorator-exact-match-same-package-external',\n match: (i) =>\n i.origin === 'decorator' &&\n i.matchKind === 'exact-key' &&\n i.existingIsPackageQualified &&\n i.samePackage &&\n !i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'External package manifest entry being replaced by its own decorator-registered class (issue #584).',\n },\n\n {\n // pnpm-dup allows unscoped package names (old code didn't gate on\n // scoped-only). `samePackage` already requires both sides to have a\n // packageName and match, so no extra existingHasAnyPackage check\n // is needed.\n scenario: 'decorator-case-insensitive-pnpm-duplicate',\n match: (i) =>\n i.origin === 'decorator' &&\n i.matchKind === 'case-insensitive' &&\n i.existingKeyIsQualified &&\n i.samePackage &&\n i.sameName &&\n !i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'pnpm store duplicated the same package; different physical constructors but semantically identical.',\n },\n\n {\n scenario: 'decorator-bundled-context-known-package',\n match: (i) =>\n i.origin === 'decorator' &&\n i.newInBundledContext &&\n i.existingIsPackageQualified,\n policy: 'accept',\n reason: () =>\n 'Bundled output duplicated a known package class across chunks; treat as re-registration.',\n },\n\n {\n scenario: 'decorator-same-source-file',\n match: (i) => i.origin === 'decorator' && i.sameSourceFile,\n policy: 'accept',\n reason: () =>\n 'Same source file — module re-evaluated (vitest test-isolation or HMR).',\n },\n\n {\n scenario: 'decorator-unknown-source-fallback',\n match: (i) => i.origin === 'decorator' && !i.bothSourceFilesKnown,\n policy: 'accept',\n reason: () =>\n 'Source file unavailable for comparison; allow re-registration rather than block legitimate updates.',\n },\n\n // --- Cross-origin STI fallbacks (used by decorator path; manifest\n // path has its own explicit rows above that come first) ------------\n\n {\n scenario: 'sti-child-wins',\n match: (i) => i.newExtendsExisting && !i.existingExtendsNew,\n policy: 'replace',\n reason: () => 'New class extends existing — STI child wins over parent.',\n },\n\n {\n scenario: 'sti-parent-skip',\n match: (i) => i.existingExtendsNew && !i.newExtendsExisting,\n policy: 'skip',\n reason: () => 'Existing entry extends new — STI child already registered.',\n },\n\n // --- Default: unresolvable decorator collision ------------------------\n\n {\n scenario: 'true-collision',\n match: () => true,\n policy: 'throw',\n reason: () =>\n 'Different constructors, different source files, no inheritance relationship. Unresolvable collision.',\n },\n];\n\n/**\n * Resolve a collision to a policy. See module docstring for the invocation\n * contract — callers MUST NOT invoke this for the no-candidate or\n * ambiguous-simple-name cases.\n */\nexport function decideCollisionPolicy(inputs: CollisionInputs): PolicyDecision {\n for (const row of ROWS) {\n if (row.match(inputs)) {\n return {\n policy: row.policy,\n scenario: row.scenario,\n reason: row.reason(inputs),\n };\n }\n }\n // Unreachable — `true-collision` is the final catch-all.\n throw new Error(\n `decideCollisionPolicy: no row matched (should be unreachable). Inputs: ${JSON.stringify(inputs)}`,\n );\n}\n\n/** Test-only: expose the row list so integration tests can scenario-id. */\nexport const __POLICY_ROWS_FOR_TEST: readonly Row[] = ROWS;\n"],"mappings":";;;;;;;;;;AAyMA,IAAM,OAAuB;CAG3B;EACE,UAAU;EACV,QAAQ,MAAM,EAAE;EAChB,QAAQ;EACR,cACE;CACJ;CAEA;EAKE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,0BACF,CAAC,EAAE;EACL,QAAQ;EACR,cACE;CACJ;CAIA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,WAAW,cAAc,EAAE;EAC3C,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,cAAc,EAAE,sBAAsB,CAAC,EAAE;EACxD,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,cAAc,EAAE,sBAAsB,CAAC,EAAE;EACxD,QAAQ;EACR,cACE;CACJ;CAEA;EAOE,UAAU;EACV,QAAQ,MACN,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QAAQ,IAAI,OAAO,MAAM;CAC3B;CAIJ,MAAM,IAAI,MACR,0EAA0E,KAAK,UAAU,MAAM,GACjG;AACF"}
|
|
1
|
+
{"version":3,"file":"collision-policy.js","names":[],"sources":["../../src/registry/collision-policy.ts"],"sourcesContent":["/**\n * Release C (#1134) — unified collision policy for class registration.\n *\n * `register()` and `registerFromManifest()` both need to decide what to do\n * when a new registration lands on an existing class with the same (or a\n * case-insensitive-matching) name. Before Release C the decision logic was\n * a ~300-line if/else tree duplicated across three code paths:\n *\n * - `register()` exact-match branch (class-registration.ts:159-275)\n * - `register()` case-insensitive branch (class-registration.ts:286-391)\n * - `resolveManifestCollision()` (class-registration.ts:876-929)\n *\n * This module collapses all three onto a single decision table. Each row\n * names a scenario that exists in the current test suite; the row order\n * encodes specificity (first match wins).\n *\n * # Invocation contract\n *\n * `decideCollisionPolicy(inputs)` is ONLY called when the caller has already\n * identified exactly one colliding candidate for the new registration. Two\n * cases MUST be handled upstream without consulting the table:\n *\n * 1. No colliding candidate exists → register fresh.\n * 2. Ambiguous simple name matches >1 existing entry across different\n * packages (`getCanonicalClassName()` returns undefined) → fall through\n * to the exact-key path and allow coexistence under qualified keys.\n * See issue #951 for the semantics being preserved.\n *\n * Feeding the ambiguous case through the table would lose the\n * `coexist-qualified` behavior that's crucial for multi-package apps.\n *\n * @see https://github.com/happyvertical/smrt/issues/1134\n */\n\nexport type RegistrationOrigin = 'decorator' | 'manifest';\n\n/**\n * How the colliding candidate was identified.\n *\n * - `exact-key` : `classes.get(name)` returned the candidate.\n * `existingKey === name`.\n * - `case-insensitive` : Iteration found a case-insensitive match on\n * either the registry key or the entry's `name`\n * property. `existingKey !== name`.\n * - `canonical-name` : Looked up via `getCanonicalClassName(simpleName)`\n * — unambiguous single match under a lowered\n * simple name. Used by the manifest path.\n */\nexport type MatchKind = 'exact-key' | 'case-insensitive' | 'canonical-name';\n\nexport type Policy =\n /** Keep existing identity, update metadata via `upsertExistingEntry`. */\n | 'accept'\n /** Drop existing, register new as replacement. */\n | 'replace'\n /**\n * Fold manifest fields into existing registration. The **caller MUST**:\n * (1) call `mergeManifestIntoExistingRegistration(existing, objectDef, packageName)`\n * (2) if `registrationKey !== existingCanonical`, alias the existing entry\n * under `registrationKey` via `classes.set()` + `constructorIndex.set()`\n * Both steps together preserve the `issue-951:144-200` contract.\n */\n | 'merge-manifest'\n /**\n * Different packages, different qualified keys. Both registrations stay\n * in the classes Map under their respective qualified keys. Ambiguity is\n * surfaced at `findClass` time. Preserves issue #951.\n */\n | 'coexist-qualified'\n /** Existing wins; silently ignore the new registration. */\n | 'skip'\n /** Unresolvable collision — raise a user-facing error. */\n | 'throw';\n\n/**\n * Every signal the decision table can read. Computed by the caller from\n * inspection of the new and existing registrations.\n */\nexport interface CollisionInputs {\n readonly origin: RegistrationOrigin;\n readonly matchKind: MatchKind;\n\n /** `new.ctor === existing.constructor` (decorator path only; false for manifest). */\n readonly sameConstructor: boolean;\n\n /** `new.sourceFile === existing.sourceFilePath`, both truthy. */\n readonly sameSourceFile: boolean;\n\n /** Both the new and existing registrations have known source files. */\n readonly bothSourceFilesKnown: boolean;\n\n /** `existing.constructor._isManifestStub === true`. */\n readonly existingIsManifestStub: boolean;\n\n /**\n * New registration's source file lives in a bundled output directory\n * (`.svelte-kit/output/`, `/dist/`, `/build/`, `.next/`, `.nuxt/`).\n */\n readonly newInBundledContext: boolean;\n\n /**\n * New class extends existing.\n * - decorator path: `new.ctor.prototype instanceof existing.constructor`\n * - manifest path : `new.objectDef.extends` names existing\n */\n readonly newExtendsExisting: boolean;\n\n /** Inverse direction: existing extends new. */\n readonly existingExtendsNew: boolean;\n\n /** `new.packageName === existing.packageName` (both truthy). */\n readonly samePackage: boolean;\n\n /**\n * `existing.packageName?.startsWith('@')` — existing entry came from a\n * **scoped** package manifest (e.g. `@happyvertical/smrt-core`). Used by\n * the external-package-replace (#584) and bundled-context scenarios\n * that were gated on `@` in pre-Release-C code.\n */\n readonly existingIsPackageQualified: boolean;\n\n /**\n * Existing entry carries any packageName, scoped or not. Broader than\n * `existingIsPackageQualified`. Used for the different-packages\n * coexistence scenario where pre-Release-C code only required both\n * packageNames to be present and different (unscoped manifests like\n * `smrt-profiles` count here).\n */\n readonly existingHasAnyPackage: boolean;\n\n /**\n * Case-sensitive equality between `new.name` and `existing.name`.\n * Used to distinguish a pnpm-duplicate (same exact name) from a genuine\n * case-insensitive collision (different names that lower to the same string).\n */\n readonly sameName: boolean;\n\n /**\n * New registration has (or can derive) a qualified key `@pkg:Name`.\n * Paired with `existingIsPackageQualified` to drive the different-packages\n * coexistence behavior from issue #951.\n */\n readonly hasNewQualifiedKey: boolean;\n\n /**\n * Existing registry key contains a `:` separator. Needed alongside\n * `existingIsPackageQualified` to identify valid pnpm-dup candidates\n * (old code required both).\n */\n readonly existingKeyIsQualified: boolean;\n\n /**\n * Manifest-origin only: the incoming `objectDef` carries at least one of\n * `fields`, `methods`, `schema`, or `decoratorConfig`. Without that, the\n * merge path has nothing to fold in and the caller should skip the\n * merge-manifest policy entirely.\n */\n readonly hasManifestContent: boolean;\n\n /**\n * Manifest-origin only: the new registration's qualified key differs\n * from the existing entry's canonical key. When true and the policy is\n * `merge-manifest`, the caller MUST also alias the existing entry under\n * the new qualified key (step 2 of the merge-manifest contract).\n */\n readonly registrationKeyDiffersFromExistingKey: boolean;\n\n /**\n * Existing registration has no `packageName` set. Distinct from\n * `!samePackage`: this specifically means the existing entry is a bare\n * source registration waiting for a package manifest to promote it. When\n * true and the new registration carries a packageName, merge-manifest\n * treats it as promotion rather than collision.\n */\n readonly existingHasNoPackage: boolean;\n\n /**\n * Decorator-origin only: the table the `@smrt()` decorator resolved for the\n * new class (its explicit `tableName`, its STI parent's table, or the name\n * derived from the class) differs from the existing entry's table. A\n * duplicate of one class — pnpm copy, inlined chunk — resolves the same\n * table, so this is positive evidence of a different class (#3106): ergot's\n * `LicenseSale` resolves `license_sales` where smrt-commerce's STI subtype\n * resolves `contracts`.\n */\n readonly declaresDifferentTable: boolean;\n}\n\nexport interface PolicyDecision {\n readonly policy: Policy;\n /** Stable id. Matches the scenario name in the test suite 1-to-1. */\n readonly scenario: string;\n /** Human-readable explanation. Used by verboseLog + the error message. */\n readonly reason: string;\n}\n\ninterface Row {\n readonly scenario: string;\n readonly match: (inputs: CollisionInputs) => boolean;\n readonly policy: Policy;\n readonly reason: (inputs: CollisionInputs) => string;\n}\n\n/**\n * Ordered decision table. First row whose `match` returns true wins.\n * Order reflects specificity — scenarios that narrow down earlier\n * scenarios come before them.\n *\n * Each row is named to match a scenario in the test suite so a reviewer\n * can bisect one-to-one between \"new class extends existing\" (the code)\n * and \"sti-child-wins\" (the test row and the verbose-log output).\n */\nconst ROWS: readonly Row[] = [\n // --- Cross-origin: constructor identity and stub replacement ----------\n\n {\n scenario: 'same-constructor-reregistration',\n match: (i) => i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'Same constructor identity — module re-evaluation. Update metadata only.',\n },\n\n {\n // Decorator-only: the decorator fires after a manifest builder\n // pre-registered a stub placeholder under this name. The real class\n // takes over. Manifest-origin stub-to-stub arrivals fall through to\n // the source-file / STI rows instead.\n // A stub another package's manifest registered is that package's class:\n // a class from another package that is known not to be the stub's — its\n // source file differs (outside bundled output, whose stack package is the\n // bundle's, not the declaring package's) or it declares another table —\n // is a different class and coexists instead (#3106).\n scenario: 'manifest-stub-replacement',\n match: (i) =>\n i.origin === 'decorator' &&\n i.existingIsManifestStub &&\n !i.sameConstructor &&\n !(\n i.hasNewQualifiedKey &&\n i.existingHasAnyPackage &&\n !i.samePackage &&\n !i.sameSourceFile &&\n ((i.bothSourceFilesKnown && !i.newInBundledContext) ||\n i.declaresDifferentTable)\n ),\n policy: 'replace',\n reason: () =>\n 'Existing entry is a manifest stub placeholder; the real implementation takes over.',\n },\n\n // --- Manifest-origin rows (checked before decorator-origin) -----------\n\n {\n scenario: 'manifest-same-source-file',\n match: (i) => i.origin === 'manifest' && i.sameSourceFile,\n policy: 'skip',\n reason: () =>\n 'Same source file — consumer manifest re-export, not a real collision.',\n },\n\n {\n scenario: 'manifest-sti-child-wins',\n match: (i) =>\n i.origin === 'manifest' && i.newExtendsExisting && !i.existingExtendsNew,\n policy: 'replace',\n reason: () =>\n 'Manifest entry extends existing — STI child wins over parent.',\n },\n\n {\n scenario: 'manifest-sti-parent-skip',\n match: (i) =>\n i.origin === 'manifest' && i.existingExtendsNew && !i.newExtendsExisting,\n policy: 'skip',\n reason: () =>\n 'Existing entry is the STI child of the incoming manifest parent; keep the child.',\n },\n\n {\n // Uses `existingHasAnyPackage` not `existingIsPackageQualified`: the\n // pre-Release-C `allowCoexistingQualifiedRegistration` check only\n // required both packages to be present and differ, regardless of\n // whether they were scoped (`@scope/pkg`) or unscoped (`smrt-profiles`).\n // Narrowing to scoped would silently drop coexistence for unscoped\n // manifests. See PR #1140 review (willgriffin P2 at line 251).\n scenario: 'manifest-different-packages-qualified-coexist',\n match: (i) =>\n i.origin === 'manifest' &&\n !i.samePackage &&\n i.hasNewQualifiedKey &&\n i.existingHasAnyPackage,\n policy: 'coexist-qualified',\n reason: () =>\n 'Different packages share a simple name; both registrations live under their qualified keys (issue #951).',\n },\n\n {\n // Covers three related scenarios:\n // (a) `samePackage` — decorator + manifest from the same\n // package land on the same class; merge fields (issue #1000).\n // (b) `existingHasNoPackage` — source registration hasn't been\n // promoted to a qualified key yet and a manifest now provides\n // the package identity (issue #951:144-200). The merge runs\n // AND the caller aliases the existing entry under the new\n // qualified key.\n // (c) The same scenarios when the existing entry is a manifest\n // stub from an earlier unqualified/local manifest registration\n // — the pre-Release-C code merged whenever\n // `!existing.packageName || packageName === existing.packageName`\n // regardless of stub status. Release C preserves that: removing\n // the `!existingIsManifestStub` gate lets a later\n // package-qualified manifest upgrade a stub's fields + alias\n // under the qualified key. See PR #1140 review (willgriffin P1\n // at line 270).\n scenario: 'manifest-same-package-merge',\n match: (i) =>\n i.origin === 'manifest' &&\n (i.samePackage || (i.existingHasNoPackage && i.hasNewQualifiedKey)) &&\n i.hasManifestContent,\n policy: 'merge-manifest',\n reason: () =>\n 'Manifest arriving for an existing same-package or unqualified source registration; fold fields in and alias the qualified key if keys differ.',\n },\n\n {\n scenario: 'manifest-default-skip',\n match: (i) => i.origin === 'manifest',\n policy: 'skip',\n reason: () =>\n 'Manifest collision with no inheritance relationship; keep existing entry (pre-Release-C resolveManifestCollision default).',\n },\n\n // --- Decorator-origin rows --------------------------------------------\n\n {\n scenario: 'decorator-exact-match-same-package-external',\n match: (i) =>\n i.origin === 'decorator' &&\n i.matchKind === 'exact-key' &&\n i.existingIsPackageQualified &&\n i.samePackage &&\n !i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'External package manifest entry being replaced by its own decorator-registered class (issue #584).',\n },\n\n {\n // pnpm-dup allows unscoped package names (old code didn't gate on\n // scoped-only). `samePackage` already requires both sides to have a\n // packageName and match, so no extra existingHasAnyPackage check\n // is needed.\n scenario: 'decorator-case-insensitive-pnpm-duplicate',\n match: (i) =>\n i.origin === 'decorator' &&\n i.matchKind === 'case-insensitive' &&\n i.existingKeyIsQualified &&\n i.samePackage &&\n i.sameName &&\n !i.sameConstructor,\n policy: 'accept',\n reason: () =>\n 'pnpm store duplicated the same package; different physical constructors but semantically identical.',\n },\n\n {\n // The decorator-path counterpart of\n // `manifest-different-packages-qualified-coexist` (#3106): a class whose\n // own package is known and differs from the existing entry's package is a\n // different class, not a duplicate — e.g. a consumer's `LicenseSale` next\n // to smrt-commerce's. Both live under their qualified keys. Inheritance\n // between them is left to the STI rows. In bundled output the declaring\n // package is only trusted when the new class declares another table: a\n // consumer bundle that inlined a dependency reports the consumer's\n // package for the dependency's classes, and the same class may also load\n // from the installed dependency (a SvelteKit build's analysis step does),\n // so neither the package nor the file location tells a duplicate apart.\n // Those duplicates are what the next row accepts.\n scenario: 'decorator-different-packages-qualified-coexist',\n match: (i) =>\n i.origin === 'decorator' &&\n i.hasNewQualifiedKey &&\n i.existingHasAnyPackage &&\n !i.samePackage &&\n !i.sameSourceFile &&\n !i.newExtendsExisting &&\n !i.existingExtendsNew &&\n (!i.newInBundledContext || i.declaresDifferentTable),\n policy: 'coexist-qualified',\n reason: () =>\n 'Different packages declare the same simple name; both registrations live under their qualified keys (issue #3106).',\n },\n\n {\n scenario: 'decorator-bundled-context-known-package',\n match: (i) =>\n i.origin === 'decorator' &&\n i.newInBundledContext &&\n i.existingIsPackageQualified,\n policy: 'accept',\n reason: () =>\n 'Bundled output duplicated a known package class across chunks; treat as re-registration.',\n },\n\n {\n scenario: 'decorator-same-source-file',\n match: (i) => i.origin === 'decorator' && i.sameSourceFile,\n policy: 'accept',\n reason: () =>\n 'Same source file — module re-evaluated (vitest test-isolation or HMR).',\n },\n\n {\n scenario: 'decorator-unknown-source-fallback',\n match: (i) => i.origin === 'decorator' && !i.bothSourceFilesKnown,\n policy: 'accept',\n reason: () =>\n 'Source file unavailable for comparison; allow re-registration rather than block legitimate updates.',\n },\n\n // --- Cross-origin STI fallbacks (used by decorator path; manifest\n // path has its own explicit rows above that come first) ------------\n\n {\n scenario: 'sti-child-wins',\n match: (i) => i.newExtendsExisting && !i.existingExtendsNew,\n policy: 'replace',\n reason: () => 'New class extends existing — STI child wins over parent.',\n },\n\n {\n scenario: 'sti-parent-skip',\n match: (i) => i.existingExtendsNew && !i.newExtendsExisting,\n policy: 'skip',\n reason: () => 'Existing entry extends new — STI child already registered.',\n },\n\n // --- Default: unresolvable decorator collision ------------------------\n\n {\n scenario: 'true-collision',\n match: () => true,\n policy: 'throw',\n reason: () =>\n 'Different constructors, different source files, no inheritance relationship. Unresolvable collision.',\n },\n];\n\n/**\n * Resolve a collision to a policy. See module docstring for the invocation\n * contract — callers MUST NOT invoke this for the no-candidate or\n * ambiguous-simple-name cases.\n */\nexport function decideCollisionPolicy(inputs: CollisionInputs): PolicyDecision {\n for (const row of ROWS) {\n if (row.match(inputs)) {\n return {\n policy: row.policy,\n scenario: row.scenario,\n reason: row.reason(inputs),\n };\n }\n }\n // Unreachable — `true-collision` is the final catch-all.\n throw new Error(\n `decideCollisionPolicy: no row matched (should be unreachable). Inputs: ${JSON.stringify(inputs)}`,\n );\n}\n\n/** Test-only: expose the row list so integration tests can scenario-id. */\nexport const __POLICY_ROWS_FOR_TEST: readonly Row[] = ROWS;\n"],"mappings":";;;;;;;;;;AAoNA,IAAM,OAAuB;CAG3B;EACE,UAAU;EACV,QAAQ,MAAM,EAAE;EAChB,QAAQ;EACR,cACE;CACJ;CAEA;EAUE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,0BACF,CAAC,EAAE,mBACH,EACE,EAAE,sBACF,EAAE,yBACF,CAAC,EAAE,eACH,CAAC,EAAE,mBACD,EAAE,wBAAwB,CAAC,EAAE,uBAC7B,EAAE;EAER,QAAQ;EACR,cACE;CACJ;CAIA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,WAAW,cAAc,EAAE;EAC3C,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,cAAc,EAAE,sBAAsB,CAAC,EAAE;EACxD,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,cAAc,EAAE,sBAAsB,CAAC,EAAE;EACxD,QAAQ;EACR,cACE;CACJ;CAEA;EAOE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,cACb,CAAC,EAAE,eACH,EAAE,sBACF,EAAE;EACJ,QAAQ;EACR,cACE;CACJ;CAEA;EAkBE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACZ,EAAE,eAAgB,EAAE,wBAAwB,EAAE,uBAC/C,EAAE;EACJ,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,WAAW;EAC3B,QAAQ;EACR,cACE;CACJ;CAIA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,cAAc,eAChB,EAAE,8BACF,EAAE,eACF,CAAC,EAAE;EACL,QAAQ;EACR,cACE;CACJ;CAEA;EAKE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,cAAc,sBAChB,EAAE,0BACF,EAAE,eACF,EAAE,YACF,CAAC,EAAE;EACL,QAAQ;EACR,cACE;CACJ;CAEA;EAaE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,sBACF,EAAE,yBACF,CAAC,EAAE,eACH,CAAC,EAAE,kBACH,CAAC,EAAE,sBACH,CAAC,EAAE,uBACF,CAAC,EAAE,uBAAuB,EAAE;EAC/B,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MACN,EAAE,WAAW,eACb,EAAE,uBACF,EAAE;EACJ,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,WAAW,eAAe,EAAE;EAC5C,QAAQ;EACR,cACE;CACJ;CAEA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,WAAW,eAAe,CAAC,EAAE;EAC7C,QAAQ;EACR,cACE;CACJ;CAKA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,sBAAsB,CAAC,EAAE;EACzC,QAAQ;EACR,cAAc;CAChB;CAEA;EACE,UAAU;EACV,QAAQ,MAAM,EAAE,sBAAsB,CAAC,EAAE;EACzC,QAAQ;EACR,cAAc;CAChB;CAIA;EACE,UAAU;EACV,aAAa;EACb,QAAQ;EACR,cACE;CACJ;AACF;;;;;;AAOA,SAAgB,sBAAsB,QAAyC;CAC7E,KAAK,MAAM,OAAO,MAChB,IAAI,IAAI,MAAM,MAAM,GAClB,OAAO;EACL,QAAQ,IAAI;EACZ,UAAU,IAAI;EACd,QAAQ,IAAI,OAAO,MAAM;CAC3B;CAIJ,MAAM,IAAI,MACR,0EAA0E,KAAK,UAAU,MAAM,GACjG;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-state.d.ts","sourceRoot":"","sources":["../../src/registry/shared-state.ts"],"names":[],"mappings":"AAAA;;;;;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MAAM,CAAC,CAKvD;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAQ5E;AAED,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAShE;AAED,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAK/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createGenerationTrackedMap, isGenerationTrackedMap } from "./generation.js";
|
|
2
|
-
import { isDecoratorRuntimeFramePath } from "../utils/stack-frames.js";
|
|
2
|
+
import { isDecoratorRuntimeFramePath, isSmrtCoreFramePath } from "../utils/stack-frames.js";
|
|
3
3
|
import { getSmrtModuleConfig } from "../config/global-config.js";
|
|
4
4
|
import { LRUCache } from "../utils/lru-cache.js";
|
|
5
5
|
import { createLogger } from "@happyvertical/logger";
|
|
@@ -63,11 +63,10 @@ function getInheritanceConfig() {
|
|
|
63
63
|
function getSourceFileFromStack(stackOverride) {
|
|
64
64
|
const stackLines = (stackOverride ?? (/* @__PURE__ */ new Error()).stack ?? "").split("\n");
|
|
65
65
|
for (const line of stackLines) {
|
|
66
|
-
const fileMatch = line.match(/(?:file:\/\/)?([^)\s]+\.(?:js|ts|mjs|mts|jsx|tsx|cjs|cts))(?::\d+:\d+)?/);
|
|
66
|
+
const fileMatch = line.match(/(?:file:\/\/)?([^()\s]+\.(?:js|ts|mjs|mts|jsx|tsx|cjs|cts))(?::\d+:\d+)?/);
|
|
67
67
|
if (fileMatch) {
|
|
68
68
|
const normalizedPath = fileMatch[1].replace(/^file:\/+/, "").replace(/\\/g, "/");
|
|
69
|
-
|
|
70
|
-
if (lowerPath.includes("/node_modules/@happyvertical/smrt-core/") || lowerPath.includes("/packages/core/src/") && !lowerPath.includes("__tests__") || lowerPath.includes("/manifest/manifest-loader") || isDecoratorRuntimeFramePath(normalizedPath)) continue;
|
|
69
|
+
if (isSmrtCoreFramePath(normalizedPath) || isDecoratorRuntimeFramePath(normalizedPath)) continue;
|
|
71
70
|
return normalizedPath;
|
|
72
71
|
}
|
|
73
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-state.js","names":[],"sources":["../../src/registry/shared-state.ts"],"sourcesContent":["/**\n * Shared state accessors for the SMRT ObjectRegistry.\n *\n * All registry sub-modules share state via globalThis to ensure\n * cross-module consistency in monorepo environments.\n *\n * Extracted from registry.ts as part of issue #1006.\n * @see https://github.com/happyvertical/smrt/issues/1006\n * @see https://github.com/happyvertical/smrt/issues/543\n */\n\nimport { createLogger } from '@happyvertical/logger';\nimport type { SmrtCollection } from '../collection';\nimport {\n getSmrtModuleConfig,\n type SmrtGlobalConfig,\n} from '../config/global-config.js';\nimport { LRUCache } from '../utils/lru-cache';\nimport { isDecoratorRuntimeFramePath } from '../utils/stack-frames';\nimport {\n createGenerationTrackedMap,\n isGenerationTrackedMap,\n} from './generation';\nimport type { RegisteredClass, SmrtObjectConstructor } from './types';\n\n// Re-export the globalThis augmentation so it's visible everywhere\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtRegistryClasses: Map<string, RegisteredClass> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryCollections: Map<string, typeof SmrtCollection> | undefined;\n // eslint-disable-next-line no-var\n // Heterogeneous cache: stores collections of many different item types keyed\n // by class name. `SmrtCollection` is invariant in its item type (it has\n // `create(options: SmrtCreateInput<ModelType>)`), so this cannot be narrowed\n // to `SmrtCollection<SmrtObject>` — the type argument stays `any` (read sites\n // cast back to the concrete collection type).\n var __smrtRegistryCollectionCache: // biome-ignore lint/suspicious/noExplicitAny: heterogeneous cache keyed by class name; `SmrtCollection` is invariant in `ModelType` so the type arg cannot narrow to `SmrtObject` (read sites cast back). S4 #1579.\n LRUCache<string, SmrtCollection<any>> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryDbInstanceIds: WeakMap<object, number> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryNextDbId: number | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryInheritanceChainCache:\n | LRUCache<string, string[]>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryFieldDecorators:\n | Map<string, Map<string, Record<string, unknown>>>\n | undefined;\n var __smrtRegistryLegacyFieldDecorators:\n | Map<string, Map<string, Record<string, unknown>>>\n | undefined;\n // Constructor-keyed metadata is necessary for declarations which must not\n // cross package boundaries when two classes share a simple name.\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorFieldDecorators:\n | Map<Function, Map<string, Record<string, unknown>>>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorTenantScopedDeclarations:\n | Map<Function, Record<string, unknown>>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryMethodDecorators:\n | WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n >\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryStiSiblingsLoaded: Set<string> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryCollectionTableNames: Map<string, string> | undefined;\n // Release B (#1133) removed __smrtRegistryClassNameMap — case-insensitive\n // lookups now iterate the `classes` Map directly. The globalThis slot is\n // left undeclared so any leftover code that reaches for it gets a clean\n // TS error instead of silently stale data.\n // eslint-disable-next-line no-var\n var __smrtRegistrySchemasInitialized: WeakSet<object> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorIndex:\n | WeakMap<SmrtObjectConstructor, string>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryDiscoveryAttemptCache: Map<string, boolean> | undefined;\n}\n\n/**\n * Cached verbose flag evaluated once at module load time.\n * Checks SMRT_VERBOSE=true or DEBUG containing 'smrt'.\n * Avoids repeated env var parsing on every log statement.\n * @see https://github.com/happyvertical/smrt/issues/782\n */\nexport const VERBOSE_ENABLED =\n process.env.SMRT_VERBOSE === 'true' ||\n (process.env.DEBUG?.includes('smrt') ?? false);\n\n// verboseLog() is gated by VERBOSE_ENABLED, so the level must allow debug when\n// it's set (a fixed 'info' would filter the trace out and break SMRT_VERBOSE).\nconst logger = createLogger({ level: VERBOSE_ENABLED ? 'debug' : 'info' });\n\n/**\n * Log a message only when verbose mode is enabled.\n * Used throughout registry modules to reduce noise during normal operation.\n * @param args - Arguments to pass to console.log\n */\nexport function verboseLog(...args: unknown[]): void {\n if (VERBOSE_ENABLED) {\n const [message, ...rest] = args;\n logger.debug(\n typeof message === 'string' ? message : String(message),\n rest.length > 0 ? { args: rest } : undefined,\n );\n }\n}\n\n/**\n * Get inheritance config synchronously.\n * Uses the config package's sync accessor which returns already-loaded config.\n */\nexport function getInheritanceConfig() {\n const config = getSmrtModuleConfig<SmrtGlobalConfig>('smrt', {});\n return {\n cacheSize: config.inheritance?.cacheSize ?? 200,\n onMissingAncestor:\n config.inheritance?.onMissingAncestor ?? ('warn' as 'warn' | 'error'),\n };\n}\n\n/**\n * Extract the source file path from the call stack.\n *\n * Used to identify where a class was defined for collision detection.\n * This allows the same class to be re-registered when modules are re-evaluated\n * (e.g., during vitest test file collection with isolation enabled).\n *\n * Frames from decorator-lowering runtime helpers (`@oxc-project/runtime` under\n * Vite 8, `tslib`/`@swc/helpers`/`@babel/runtime` elsewhere) are skipped too, so\n * the lowered `@smrt()` application resolves to the consumer module that declares\n * the class rather than the helper frame the compiler inserted (#1785).\n *\n * @param stackOverride - Optional stack string to parse instead of a fresh\n * `Error().stack`. Used by tests to simulate a lowered call pattern.\n * @returns The file path where the @smrt() decorator was called, or undefined\n */\nexport function getSourceFileFromStack(\n stackOverride?: string,\n): string | undefined {\n const stack = stackOverride ?? new Error().stack ?? '';\n const stackLines = stack.split('\\n');\n\n // Look for the first file path that's NOT from smrt-core internal files\n // Stack trace format: \" at FunctionName (file:///path/to/file.ts:line:col)\"\n // or \" at file:///path/to/file.ts:line:col\"\n for (const line of stackLines) {\n // Match file paths in stack trace (include all JS/TS file extensions)\n const fileMatch = line.match(\n /(?:file:\\/\\/)?([^)\\s]+\\.(?:js|ts|mjs|mts|jsx|tsx|cjs|cts))(?::\\d+:\\d+)?/,\n );\n if (fileMatch) {\n const rawPath = fileMatch[1];\n // Normalize the path:\n // - remove any leading file:// or file:/// prefix\n // - convert Windows backslashes to POSIX-style forward slashes\n const normalizedPath = rawPath\n .replace(/^file:\\/+/, '')\n .replace(/\\\\/g, '/');\n const lowerPath = normalizedPath.toLowerCase();\n\n // Skip smrt-core internal files using specific path patterns\n // to avoid false positives with user files containing \"registry\" in name\n if (\n // Installed package form: node_modules/@happyvertical/smrt-core/...\n lowerPath.includes('/node_modules/@happyvertical/smrt-core/') ||\n // Monorepo/workspace form: packages/core/src/...\n (lowerPath.includes('/packages/core/src/') &&\n !lowerPath.includes('__tests__')) ||\n // Specific manifest loader internals\n lowerPath.includes('/manifest/manifest-loader') ||\n // Decorator-lowering runtime helper (oxc/tslib/swc/babel) — the frame\n // the compiler inserts between @smrt() and the declaring module (#1785)\n isDecoratorRuntimeFramePath(normalizedPath)\n ) {\n continue;\n }\n return normalizedPath;\n }\n }\n return undefined;\n}\n\n// ── Shared state accessor functions ──────────────────────────────────────\n\nexport function getClasses(): Map<string, RegisteredClass> {\n const current = globalThis.__smrtRegistryClasses;\n if (current && isGenerationTrackedMap(current)) {\n return current;\n }\n // Every add/remove/replace of a registration invalidates the\n // generation-keyed registry memos (#3047). A plain map left by an older\n // smrt-core copy is adopted, entries intact.\n const tracked = createGenerationTrackedMap<string, RegisteredClass>(current);\n globalThis.__smrtRegistryClasses = tracked;\n return tracked;\n}\n\nexport function getCollections(): Map<string, typeof SmrtCollection> {\n if (!globalThis.__smrtRegistryCollections) {\n globalThis.__smrtRegistryCollections = new Map<\n string,\n typeof SmrtCollection\n >();\n }\n return globalThis.__smrtRegistryCollections;\n}\n\nexport function getCollectionTableNames(): Map<string, string> {\n if (!globalThis.__smrtRegistryCollectionTableNames) {\n globalThis.__smrtRegistryCollectionTableNames = new Map<string, string>();\n }\n return globalThis.__smrtRegistryCollectionTableNames;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: heterogeneous cache; `SmrtCollection` is invariant in `ModelType` so the type arg cannot narrow to `SmrtObject` (read sites cast back). S4 #1579.\nexport function getCollectionCache(): LRUCache<string, SmrtCollection<any>> {\n if (!globalThis.__smrtRegistryCollectionCache) {\n globalThis.__smrtRegistryCollectionCache = new LRUCache<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: same heterogeneous-cache invariance as the return type above. S4 #1579.\n SmrtCollection<any>\n >(100);\n }\n return globalThis.__smrtRegistryCollectionCache;\n}\n\nexport function getDbInstanceIds(): WeakMap<object, number> {\n if (!globalThis.__smrtRegistryDbInstanceIds) {\n globalThis.__smrtRegistryDbInstanceIds = new WeakMap<object, number>();\n }\n return globalThis.__smrtRegistryDbInstanceIds;\n}\n\nexport function getNextDbId(): number {\n if (globalThis.__smrtRegistryNextDbId === undefined) {\n globalThis.__smrtRegistryNextDbId = 1;\n }\n return globalThis.__smrtRegistryNextDbId;\n}\n\nexport function setNextDbId(value: number): void {\n globalThis.__smrtRegistryNextDbId = value;\n}\n\nexport function getFieldDecorators(): Map<\n string,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryFieldDecorators) {\n globalThis.__smrtRegistryFieldDecorators = new Map<\n string,\n Map<string, Record<string, unknown>>\n >();\n }\n return globalThis.__smrtRegistryFieldDecorators;\n}\n\n/**\n * Field-decorator metadata keyed by the exact runtime constructor. This is\n * used for identity-sensitive declarations while the string-keyed map remains\n * the compatibility store for legacy decorator consumers.\n */\nexport function getConstructorFieldDecorators(): Map<\n Function,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryConstructorFieldDecorators) {\n globalThis.__smrtRegistryConstructorFieldDecorators = new Map();\n }\n return globalThis.__smrtRegistryConstructorFieldDecorators;\n}\n\n/** Explicit string-only registrations, excluding constructor-owned mirrors. */\nexport function getLegacyFieldDecorators(): Map<\n string,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryLegacyFieldDecorators) {\n globalThis.__smrtRegistryLegacyFieldDecorators = new Map();\n }\n return globalThis.__smrtRegistryLegacyFieldDecorators;\n}\n\n/**\n * Class-level tenancy declarations keyed by their exact constructor.\n *\n * Unlike method metadata, these declarations participate in the registry's\n * explicit clear and test snapshot lifecycle, so they use an iterable Map.\n */\nexport function getConstructorTenantScopedDeclarations(): Map<\n Function,\n Record<string, unknown>\n> {\n if (!globalThis.__smrtRegistryConstructorTenantScopedDeclarations) {\n globalThis.__smrtRegistryConstructorTenantScopedDeclarations = new Map();\n }\n return globalThis.__smrtRegistryConstructorTenantScopedDeclarations;\n}\n\n/**\n * `@method()` decorator metadata,\n * `constructor -> methodName -> { options, isStatic }`.\n *\n * Stored on `globalThis` for the same reason as {@link getFieldDecorators}:\n * registration must survive HMR and multiple module instances. Keyed by the\n * CONSTRUCTOR rather than the class name, unlike the field store, because two\n * packages may declare the same simple name and the kernel forbids inferring\n * ownership from one; a `WeakMap` also lets a discarded class's metadata be\n * collected (#2686).\n */\nexport function getMethodDecorators(): WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n> {\n if (!globalThis.__smrtRegistryMethodDecorators) {\n globalThis.__smrtRegistryMethodDecorators = new WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n >();\n }\n return globalThis.__smrtRegistryMethodDecorators;\n}\n\nexport function getStiSiblingsLoaded(): Set<string> {\n if (!globalThis.__smrtRegistryStiSiblingsLoaded) {\n globalThis.__smrtRegistryStiSiblingsLoaded = new Set<string>();\n }\n return globalThis.__smrtRegistryStiSiblingsLoaded;\n}\n\n// getClassNameMap removed in Release B (#1133). The eagerly-maintained\n// lowercase-simple-name → qualified-key[] index was replaced by on-demand\n// iteration over the `classes` Map in name-resolver.ts. Any remaining\n// consumer should switch to `findClassesByName`, `getCanonicalClassName`,\n// or `findClass`.\n\nexport function getSchemasInitialized(): WeakSet<object> {\n if (!globalThis.__smrtRegistrySchemasInitialized) {\n globalThis.__smrtRegistrySchemasInitialized = new WeakSet<object>();\n }\n return globalThis.__smrtRegistrySchemasInitialized;\n}\n\nexport function getConstructorIndex(): WeakMap<SmrtObjectConstructor, string> {\n if (!globalThis.__smrtRegistryConstructorIndex) {\n globalThis.__smrtRegistryConstructorIndex = new WeakMap<\n SmrtObjectConstructor,\n string\n >();\n }\n return globalThis.__smrtRegistryConstructorIndex;\n}\n\nexport function getInheritanceCache(): LRUCache<string, string[]> {\n if (!globalThis.__smrtRegistryInheritanceChainCache) {\n const config = getInheritanceConfig();\n globalThis.__smrtRegistryInheritanceChainCache = new LRUCache<\n string,\n string[]\n >(config.cacheSize);\n }\n return globalThis.__smrtRegistryInheritanceChainCache;\n}\n\nexport function getDiscoveryAttemptCache(): Map<string, boolean> {\n if (!globalThis.__smrtRegistryDiscoveryAttemptCache) {\n globalThis.__smrtRegistryDiscoveryAttemptCache = new Map<string, boolean>();\n }\n return globalThis.__smrtRegistryDiscoveryAttemptCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+FA,IAAa,kBACX,QAAQ,IAAI,iBAAiB,WAC5B,QAAQ,IAAI,OAAO,SAAS,MAAM,KAAK;AAI1C,IAAM,SAAS,aAAa,EAAE,OAAO,kBAAkB,UAAU,OAAO,CAAC;;;;;;AAOzE,SAAgB,WAAW,GAAG,MAAuB;CACnD,IAAI,iBAAiB;EACnB,MAAM,CAAC,SAAS,GAAG,QAAQ;EAC3B,OAAO,MACL,OAAO,YAAY,WAAW,UAAU,OAAO,OAAO,GACtD,KAAK,SAAS,IAAI,EAAE,MAAM,KAAK,IAAI,KAAA,CACrC;CACF;AACF;;;;;AAMA,SAAgB,uBAAuB;CACrC,MAAM,SAAS,oBAAsC,QAAQ,CAAC,CAAC;CAC/D,OAAO;EACL,WAAW,OAAO,aAAa,aAAa;EAC5C,mBACE,OAAO,aAAa,qBAAsB;CAC9C;AACF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,uBACd,eAC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A,IAAI,CAAC,WAAW,+BACd,WAAW,gDAAgC,IAAI,IAG7C;CAEJ,OAAO,WAAW;AACpB;;;;;;AAOA,SAAgB,gCAGd;CACA,IAAI,CAAC,WAAW,0CACd,WAAW,2DAA2C,IAAI,IAAI;CAEhE,OAAO,WAAW;AACpB;;AAGA,SAAgB,2BAGd;CACA,IAAI,CAAC,WAAW,qCACd,WAAW,sDAAsC,IAAI,IAAI;CAE3D,OAAO,WAAW;AACpB;;;;;;;AAQA,SAAgB,yCAGd;CACA,IAAI,CAAC,WAAW,mDACd,WAAW,oEAAoD,IAAI,IAAI;CAEzE,OAAO,WAAW;AACpB;;;;;;;;;;;;AAaA,SAAgB,sBAGd;CACA,IAAI,CAAC,WAAW,gCACd,WAAW,iDAAiC,IAAI,QAG9C;CAEJ,OAAO,WAAW;AACpB;AAEA,SAAgB,uBAAoC;CAClD,IAAI,CAAC,WAAW,iCACd,WAAW,kDAAkC,IAAI,IAAY;CAE/D,OAAO,WAAW;AACpB;AAeA,SAAgB,sBAA8D;CAC5E,IAAI,CAAC,WAAW,gCACd,WAAW,iDAAiC,IAAI,QAG9C;CAEJ,OAAO,WAAW;AACpB;AAEA,SAAgB,sBAAkD;CAChE,IAAI,CAAC,WAAW,qCAAqC;EACnD,MAAM,SAAS,qBAAqB;EACpC,WAAW,sCAAsC,IAAI,SAGnD,OAAO,SAAS;CACpB;CACA,OAAO,WAAW;AACpB;AAEA,SAAgB,2BAAiD;CAC/D,IAAI,CAAC,WAAW,qCACd,WAAW,sDAAsC,IAAI,IAAqB;CAE5E,OAAO,WAAW;AACpB"}
|
|
1
|
+
{"version":3,"file":"shared-state.js","names":[],"sources":["../../src/registry/shared-state.ts"],"sourcesContent":["/**\n * Shared state accessors for the SMRT ObjectRegistry.\n *\n * All registry sub-modules share state via globalThis to ensure\n * cross-module consistency in monorepo environments.\n *\n * Extracted from registry.ts as part of issue #1006.\n * @see https://github.com/happyvertical/smrt/issues/1006\n * @see https://github.com/happyvertical/smrt/issues/543\n */\n\nimport { createLogger } from '@happyvertical/logger';\nimport type { SmrtCollection } from '../collection';\nimport {\n getSmrtModuleConfig,\n type SmrtGlobalConfig,\n} from '../config/global-config.js';\nimport { LRUCache } from '../utils/lru-cache';\nimport {\n isDecoratorRuntimeFramePath,\n isSmrtCoreFramePath,\n} from '../utils/stack-frames';\nimport {\n createGenerationTrackedMap,\n isGenerationTrackedMap,\n} from './generation';\nimport type { RegisteredClass, SmrtObjectConstructor } from './types';\n\n// Re-export the globalThis augmentation so it's visible everywhere\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtRegistryClasses: Map<string, RegisteredClass> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryCollections: Map<string, typeof SmrtCollection> | undefined;\n // eslint-disable-next-line no-var\n // Heterogeneous cache: stores collections of many different item types keyed\n // by class name. `SmrtCollection` is invariant in its item type (it has\n // `create(options: SmrtCreateInput<ModelType>)`), so this cannot be narrowed\n // to `SmrtCollection<SmrtObject>` — the type argument stays `any` (read sites\n // cast back to the concrete collection type).\n var __smrtRegistryCollectionCache: // biome-ignore lint/suspicious/noExplicitAny: heterogeneous cache keyed by class name; `SmrtCollection` is invariant in `ModelType` so the type arg cannot narrow to `SmrtObject` (read sites cast back). S4 #1579.\n LRUCache<string, SmrtCollection<any>> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryDbInstanceIds: WeakMap<object, number> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryNextDbId: number | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryInheritanceChainCache:\n | LRUCache<string, string[]>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryFieldDecorators:\n | Map<string, Map<string, Record<string, unknown>>>\n | undefined;\n var __smrtRegistryLegacyFieldDecorators:\n | Map<string, Map<string, Record<string, unknown>>>\n | undefined;\n // Constructor-keyed metadata is necessary for declarations which must not\n // cross package boundaries when two classes share a simple name.\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorFieldDecorators:\n | Map<Function, Map<string, Record<string, unknown>>>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorTenantScopedDeclarations:\n | Map<Function, Record<string, unknown>>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryMethodDecorators:\n | WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n >\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryStiSiblingsLoaded: Set<string> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryCollectionTableNames: Map<string, string> | undefined;\n // Release B (#1133) removed __smrtRegistryClassNameMap — case-insensitive\n // lookups now iterate the `classes` Map directly. The globalThis slot is\n // left undeclared so any leftover code that reaches for it gets a clean\n // TS error instead of silently stale data.\n // eslint-disable-next-line no-var\n var __smrtRegistrySchemasInitialized: WeakSet<object> | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryConstructorIndex:\n | WeakMap<SmrtObjectConstructor, string>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtRegistryDiscoveryAttemptCache: Map<string, boolean> | undefined;\n}\n\n/**\n * Cached verbose flag evaluated once at module load time.\n * Checks SMRT_VERBOSE=true or DEBUG containing 'smrt'.\n * Avoids repeated env var parsing on every log statement.\n * @see https://github.com/happyvertical/smrt/issues/782\n */\nexport const VERBOSE_ENABLED =\n process.env.SMRT_VERBOSE === 'true' ||\n (process.env.DEBUG?.includes('smrt') ?? false);\n\n// verboseLog() is gated by VERBOSE_ENABLED, so the level must allow debug when\n// it's set (a fixed 'info' would filter the trace out and break SMRT_VERBOSE).\nconst logger = createLogger({ level: VERBOSE_ENABLED ? 'debug' : 'info' });\n\n/**\n * Log a message only when verbose mode is enabled.\n * Used throughout registry modules to reduce noise during normal operation.\n * @param args - Arguments to pass to console.log\n */\nexport function verboseLog(...args: unknown[]): void {\n if (VERBOSE_ENABLED) {\n const [message, ...rest] = args;\n logger.debug(\n typeof message === 'string' ? message : String(message),\n rest.length > 0 ? { args: rest } : undefined,\n );\n }\n}\n\n/**\n * Get inheritance config synchronously.\n * Uses the config package's sync accessor which returns already-loaded config.\n */\nexport function getInheritanceConfig() {\n const config = getSmrtModuleConfig<SmrtGlobalConfig>('smrt', {});\n return {\n cacheSize: config.inheritance?.cacheSize ?? 200,\n onMissingAncestor:\n config.inheritance?.onMissingAncestor ?? ('warn' as 'warn' | 'error'),\n };\n}\n\n/**\n * Extract the source file path from the call stack.\n *\n * Used to identify where a class was defined for collision detection.\n * This allows the same class to be re-registered when modules are re-evaluated\n * (e.g., during vitest test file collection with isolation enabled).\n *\n * Frames from decorator-lowering runtime helpers (`@oxc-project/runtime` under\n * Vite 8, `tslib`/`@swc/helpers`/`@babel/runtime` elsewhere) are skipped too, so\n * the lowered `@smrt()` application resolves to the consumer module that declares\n * the class rather than the helper frame the compiler inserted (#1785).\n *\n * @param stackOverride - Optional stack string to parse instead of a fresh\n * `Error().stack`. Used by tests to simulate a lowered call pattern.\n * @returns The file path where the @smrt() decorator was called, or undefined\n */\nexport function getSourceFileFromStack(\n stackOverride?: string,\n): string | undefined {\n const stack = stackOverride ?? new Error().stack ?? '';\n const stackLines = stack.split('\\n');\n\n // Look for the first file path that's NOT from smrt-core internal files\n // Stack trace format: \" at FunctionName (file:///path/to/file.ts:line:col)\"\n // or \" at file:///path/to/file.ts:line:col\"\n for (const line of stackLines) {\n // Match file paths in stack trace (include all JS/TS file extensions).\n // The path excludes parentheses: a named frame's `(file:///...)` must not\n // leave its opening parenthesis on the path, or it never equals the same\n // file reported elsewhere (#3109).\n const fileMatch = line.match(\n /(?:file:\\/\\/)?([^()\\s]+\\.(?:js|ts|mjs|mts|jsx|tsx|cjs|cts))(?::\\d+:\\d+)?/,\n );\n if (fileMatch) {\n const rawPath = fileMatch[1];\n // Normalize the path:\n // - remove any leading file:// or file:/// prefix\n // - convert Windows backslashes to POSIX-style forward slashes\n const normalizedPath = rawPath\n .replace(/^file:\\/+/, '')\n .replace(/\\\\/g, '/');\n\n // Skip smrt-core's own frames (including source-mapped installed\n // paths, #3109) and decorator-lowering runtime helpers (#1785): the\n // class is declared in neither.\n if (\n isSmrtCoreFramePath(normalizedPath) ||\n isDecoratorRuntimeFramePath(normalizedPath)\n ) {\n continue;\n }\n return normalizedPath;\n }\n }\n return undefined;\n}\n\n// ── Shared state accessor functions ──────────────────────────────────────\n\nexport function getClasses(): Map<string, RegisteredClass> {\n const current = globalThis.__smrtRegistryClasses;\n if (current && isGenerationTrackedMap(current)) {\n return current;\n }\n // Every add/remove/replace of a registration invalidates the\n // generation-keyed registry memos (#3047). A plain map left by an older\n // smrt-core copy is adopted, entries intact.\n const tracked = createGenerationTrackedMap<string, RegisteredClass>(current);\n globalThis.__smrtRegistryClasses = tracked;\n return tracked;\n}\n\nexport function getCollections(): Map<string, typeof SmrtCollection> {\n if (!globalThis.__smrtRegistryCollections) {\n globalThis.__smrtRegistryCollections = new Map<\n string,\n typeof SmrtCollection\n >();\n }\n return globalThis.__smrtRegistryCollections;\n}\n\nexport function getCollectionTableNames(): Map<string, string> {\n if (!globalThis.__smrtRegistryCollectionTableNames) {\n globalThis.__smrtRegistryCollectionTableNames = new Map<string, string>();\n }\n return globalThis.__smrtRegistryCollectionTableNames;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: heterogeneous cache; `SmrtCollection` is invariant in `ModelType` so the type arg cannot narrow to `SmrtObject` (read sites cast back). S4 #1579.\nexport function getCollectionCache(): LRUCache<string, SmrtCollection<any>> {\n if (!globalThis.__smrtRegistryCollectionCache) {\n globalThis.__smrtRegistryCollectionCache = new LRUCache<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: same heterogeneous-cache invariance as the return type above. S4 #1579.\n SmrtCollection<any>\n >(100);\n }\n return globalThis.__smrtRegistryCollectionCache;\n}\n\nexport function getDbInstanceIds(): WeakMap<object, number> {\n if (!globalThis.__smrtRegistryDbInstanceIds) {\n globalThis.__smrtRegistryDbInstanceIds = new WeakMap<object, number>();\n }\n return globalThis.__smrtRegistryDbInstanceIds;\n}\n\nexport function getNextDbId(): number {\n if (globalThis.__smrtRegistryNextDbId === undefined) {\n globalThis.__smrtRegistryNextDbId = 1;\n }\n return globalThis.__smrtRegistryNextDbId;\n}\n\nexport function setNextDbId(value: number): void {\n globalThis.__smrtRegistryNextDbId = value;\n}\n\nexport function getFieldDecorators(): Map<\n string,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryFieldDecorators) {\n globalThis.__smrtRegistryFieldDecorators = new Map<\n string,\n Map<string, Record<string, unknown>>\n >();\n }\n return globalThis.__smrtRegistryFieldDecorators;\n}\n\n/**\n * Field-decorator metadata keyed by the exact runtime constructor. This is\n * used for identity-sensitive declarations while the string-keyed map remains\n * the compatibility store for legacy decorator consumers.\n */\nexport function getConstructorFieldDecorators(): Map<\n Function,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryConstructorFieldDecorators) {\n globalThis.__smrtRegistryConstructorFieldDecorators = new Map();\n }\n return globalThis.__smrtRegistryConstructorFieldDecorators;\n}\n\n/** Explicit string-only registrations, excluding constructor-owned mirrors. */\nexport function getLegacyFieldDecorators(): Map<\n string,\n Map<string, Record<string, unknown>>\n> {\n if (!globalThis.__smrtRegistryLegacyFieldDecorators) {\n globalThis.__smrtRegistryLegacyFieldDecorators = new Map();\n }\n return globalThis.__smrtRegistryLegacyFieldDecorators;\n}\n\n/**\n * Class-level tenancy declarations keyed by their exact constructor.\n *\n * Unlike method metadata, these declarations participate in the registry's\n * explicit clear and test snapshot lifecycle, so they use an iterable Map.\n */\nexport function getConstructorTenantScopedDeclarations(): Map<\n Function,\n Record<string, unknown>\n> {\n if (!globalThis.__smrtRegistryConstructorTenantScopedDeclarations) {\n globalThis.__smrtRegistryConstructorTenantScopedDeclarations = new Map();\n }\n return globalThis.__smrtRegistryConstructorTenantScopedDeclarations;\n}\n\n/**\n * `@method()` decorator metadata,\n * `constructor -> methodName -> { options, isStatic }`.\n *\n * Stored on `globalThis` for the same reason as {@link getFieldDecorators}:\n * registration must survive HMR and multiple module instances. Keyed by the\n * CONSTRUCTOR rather than the class name, unlike the field store, because two\n * packages may declare the same simple name and the kernel forbids inferring\n * ownership from one; a `WeakMap` also lets a discarded class's metadata be\n * collected (#2686).\n */\nexport function getMethodDecorators(): WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n> {\n if (!globalThis.__smrtRegistryMethodDecorators) {\n globalThis.__smrtRegistryMethodDecorators = new WeakMap<\n Function,\n Map<string, { options: Record<string, unknown>; isStatic: boolean }>\n >();\n }\n return globalThis.__smrtRegistryMethodDecorators;\n}\n\nexport function getStiSiblingsLoaded(): Set<string> {\n if (!globalThis.__smrtRegistryStiSiblingsLoaded) {\n globalThis.__smrtRegistryStiSiblingsLoaded = new Set<string>();\n }\n return globalThis.__smrtRegistryStiSiblingsLoaded;\n}\n\n// getClassNameMap removed in Release B (#1133). The eagerly-maintained\n// lowercase-simple-name → qualified-key[] index was replaced by on-demand\n// iteration over the `classes` Map in name-resolver.ts. Any remaining\n// consumer should switch to `findClassesByName`, `getCanonicalClassName`,\n// or `findClass`.\n\nexport function getSchemasInitialized(): WeakSet<object> {\n if (!globalThis.__smrtRegistrySchemasInitialized) {\n globalThis.__smrtRegistrySchemasInitialized = new WeakSet<object>();\n }\n return globalThis.__smrtRegistrySchemasInitialized;\n}\n\nexport function getConstructorIndex(): WeakMap<SmrtObjectConstructor, string> {\n if (!globalThis.__smrtRegistryConstructorIndex) {\n globalThis.__smrtRegistryConstructorIndex = new WeakMap<\n SmrtObjectConstructor,\n string\n >();\n }\n return globalThis.__smrtRegistryConstructorIndex;\n}\n\nexport function getInheritanceCache(): LRUCache<string, string[]> {\n if (!globalThis.__smrtRegistryInheritanceChainCache) {\n const config = getInheritanceConfig();\n globalThis.__smrtRegistryInheritanceChainCache = new LRUCache<\n string,\n string[]\n >(config.cacheSize);\n }\n return globalThis.__smrtRegistryInheritanceChainCache;\n}\n\nexport function getDiscoveryAttemptCache(): Map<string, boolean> {\n if (!globalThis.__smrtRegistryDiscoveryAttemptCache) {\n globalThis.__smrtRegistryDiscoveryAttemptCache = new Map<string, boolean>();\n }\n return globalThis.__smrtRegistryDiscoveryAttemptCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkGA,IAAa,kBACX,QAAQ,IAAI,iBAAiB,WAC5B,QAAQ,IAAI,OAAO,SAAS,MAAM,KAAK;AAI1C,IAAM,SAAS,aAAa,EAAE,OAAO,kBAAkB,UAAU,OAAO,CAAC;;;;;;AAOzE,SAAgB,WAAW,GAAG,MAAuB;CACnD,IAAI,iBAAiB;EACnB,MAAM,CAAC,SAAS,GAAG,QAAQ;EAC3B,OAAO,MACL,OAAO,YAAY,WAAW,UAAU,OAAO,OAAO,GACtD,KAAK,SAAS,IAAI,EAAE,MAAM,KAAK,IAAI,KAAA,CACrC;CACF;AACF;;;;;AAMA,SAAgB,uBAAuB;CACrC,MAAM,SAAS,oBAAsC,QAAQ,CAAC,CAAC;CAC/D,OAAO;EACL,WAAW,OAAO,aAAa,aAAa;EAC5C,mBACE,OAAO,aAAa,qBAAsB;CAC9C;AACF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,uBACd,eACoB;CAEpB,MAAM,cADQ,kCAAiB,IAAI,MAAM,EAAA,CAAE,SAAS,GAAA,CAC3B,MAAM,IAAI;CAKnC,KAAK,MAAM,QAAQ,YAAY;EAK7B,MAAM,YAAY,KAAK,MACrB,0EACF;EACA,IAAI,WAAW;GAKb,MAAM,iBAJU,UAAU,EAIH,CACpB,QAAQ,aAAa,EAAE,CAAC,CACxB,QAAQ,OAAO,GAAG;GAKrB,IACE,oBAAoB,cAAc,KAClC,4BAA4B,cAAc,GAE1C;GAEF,OAAO;EACT;CACF;AAEF;AAIA,SAAgB,aAA2C;CACzD,MAAM,UAAU,WAAW;CAC3B,IAAI,WAAW,uBAAuB,OAAO,GAC3C,OAAO;CAKT,MAAM,UAAU,2BAAoD,OAAO;CAC3E,WAAW,wBAAwB;CACnC,OA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,SAAgB,sBAA8D;CAC5E,IAAI,CAAC,WAAW,gCACd,WAAW,iDAAiC,IAAI,QAG9C;CAEJ,OAAO,WAAW;AACpB;AAEA,SAAgB,sBAAkD;CAChE,IAAI,CAAC,WAAW,qCAAqC;EACnD,MAAM,SAAS,qBAAqB;EACpC,WAAW,sCAAsC,IAAI,SAGnD,OAAO,SAAS;CACpB;CACA,OAAO,WAAW;AACpB;AAEA,SAAgB,2BAAiD;CAC/D,IAAI,CAAC,WAAW,qCACd,WAAW,sDAAsC,IAAI,IAAqB;CAE5E,OAAO,WAAW;AACpB"}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EACL,cAAc,EAEd,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAYhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAW3C,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAC;AAuEhC,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,oBAAoB,CA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CAAC,KAC1C,CAAC,CA0PL"}
|
package/dist/registry.js
CHANGED
|
@@ -5,7 +5,7 @@ import { applyPendingDecoratorRegistrations } from "./decorators/compatibility.j
|
|
|
5
5
|
import { bumpRegistryGeneration, getRegistryGeneration } from "./registry/generation.js";
|
|
6
6
|
import { createQualifiedName, isQualifiedName, parseQualifiedName } from "./utils/qualified-names.js";
|
|
7
7
|
import { LRUCache } from "./utils/lru-cache.js";
|
|
8
|
-
import { getClasses, getCollectionCache, getCollectionTableNames, getCollections, getConstructorFieldDecorators, getConstructorTenantScopedDeclarations, getDbInstanceIds, getDiscoveryAttemptCache, getFieldDecorators, getInheritanceCache, getLegacyFieldDecorators, getMethodDecorators, getNextDbId, getStiSiblingsLoaded, setNextDbId, verboseLog } from "./registry/shared-state.js";
|
|
8
|
+
import { getClasses, getCollectionCache, getCollectionTableNames, getCollections, getConstructorFieldDecorators, getConstructorTenantScopedDeclarations, getDbInstanceIds, getDiscoveryAttemptCache, getFieldDecorators, getInheritanceCache, getLegacyFieldDecorators, getMethodDecorators, getNextDbId, getSourceFileFromStack, getStiSiblingsLoaded, setNextDbId, verboseLog } from "./registry/shared-state.js";
|
|
9
9
|
import { defaultConflictColumns, resolveTenantColumn } from "./schema/conflict-target.js";
|
|
10
10
|
import { clearRegistryDiagnostics, flushRegistryDiagnostics, getRegistryDiagnostics, recordRegistryDiagnostic } from "./registry/diagnostics.js";
|
|
11
11
|
import { cloneManifestSchemaColumns, discoverCachedManifestSync, getManifestCache, getNodeBuiltins, loadExternalManifestSyncWithNode } from "./manifest/store.js";
|
|
@@ -19,7 +19,7 @@ import { compileValidators } from "./registry/validator.js";
|
|
|
19
19
|
import "./utils.js";
|
|
20
20
|
import { isFrameworkBaseClass } from "./registry/framework-base-classes.js";
|
|
21
21
|
import { createFieldFromManifest, manifestFieldDiffers, mergeManifestField } from "./registry/manifest-field-merge.js";
|
|
22
|
-
import { ensureTenantScopedField, invalidateInheritanceEntries, register, registerCollection, registerFromManifest } from "./registry/class-registration.js";
|
|
22
|
+
import { ensureTenantScopedField, invalidateInheritanceEntries, isBundledOutputPath, isSameSourcePath, register, registerCollection, registerFromManifest } from "./registry/class-registration.js";
|
|
23
23
|
import { resolveCollectionDbCacheKey } from "./registry/db-cache-key.js";
|
|
24
24
|
import { getEmbeddingClasses, getEmbeddingConfig, getProjectEmbeddingConfig, hasEmbeddings, resolveEmbeddingConfig } from "./registry/embedding-manager.js";
|
|
25
25
|
import { getDependencyGraph, getRelationshipMap, resolveRelationshipTarget } from "./registry/relationship-graph.js";
|
|
@@ -2366,6 +2366,16 @@ var ObjectRegistry = class ObjectRegistry {
|
|
|
2366
2366
|
return resolveCollectionCacheConfig(className);
|
|
2367
2367
|
}
|
|
2368
2368
|
};
|
|
2369
|
+
/** Whether `ctor` directly extends a framework base, i.e. is its own STI base. */
|
|
2370
|
+
function isOwnStiBase(ctor) {
|
|
2371
|
+
const parent = Object.getPrototypeOf(ctor);
|
|
2372
|
+
return !parent?.name || parent.name === "SmrtObject" || parent.name === "SmrtClass";
|
|
2373
|
+
}
|
|
2374
|
+
/** Whether a registered ancestor of `ctor` uses single-table inheritance. */
|
|
2375
|
+
function extendsStiClass(ctor) {
|
|
2376
|
+
for (let parent = Object.getPrototypeOf(ctor); parent && parent !== Function.prototype; parent = Object.getPrototypeOf(parent)) if (ObjectRegistry.getClassByConstructor(parent)?.config?.tableStrategy === "sti") return true;
|
|
2377
|
+
return false;
|
|
2378
|
+
}
|
|
2369
2379
|
/**
|
|
2370
2380
|
* Registers a `SmrtObject` or `SmrtCollection` subclass with the global `ObjectRegistry`.
|
|
2371
2381
|
*
|
|
@@ -2468,7 +2478,10 @@ function smrt(config = {}) {
|
|
|
2468
2478
|
if (!tableName) {
|
|
2469
2479
|
const ownPackage = config.packageName ?? getPackageName(ctor, true) ?? void 0;
|
|
2470
2480
|
const ownQualifiedKey = ownPackage ? createQualifiedName(ownPackage, ctor.name) : void 0;
|
|
2471
|
-
const
|
|
2481
|
+
const lookedUp = discoverCachedManifestSync(ownQualifiedKey && getClasses().has(ownQualifiedKey) ? ownQualifiedKey : ctor.name);
|
|
2482
|
+
const foreignEntry = !!lookedUp?.packageName && lookedUp.packageName !== ownPackage;
|
|
2483
|
+
const sourceFile = foreignEntry ? getSourceFileFromStack() : void 0;
|
|
2484
|
+
const manifestEntry = !foreignEntry || isSameSourcePath(sourceFile, lookedUp?.filePath) || !config.packageName && isBundledOutputPath(sourceFile) && config.tableStrategy === "sti" && !isOwnStiBase(ctor) && !extendsStiClass(ctor) ? lookedUp : void 0;
|
|
2472
2485
|
if (manifestEntry?.decoratorConfig?.tableName) tableName = manifestEntry.decoratorConfig.tableName;
|
|
2473
2486
|
else if (config.tableStrategy === "sti") {
|
|
2474
2487
|
let proto = Object.getPrototypeOf(ctor);
|