@happyvertical/smrt-core 0.51.27 → 0.51.28

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.
@@ -1 +1 @@
1
- {"version":3,"file":"class-registration.d.ts","sourceRoot":"","sources":["../../src/registry/class-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuBH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAKV,qBAAqB,EAGtB,MAAM,qBAAqB,CAAC;AA2C7B,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EAElB,MAAM,YAAY,CAAC;AA0BpB;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAS3E;AA4BD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAeT;AA+mBD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,UAAU,EACvB,MAAM,GAAE,iBAAsB,GAC7B,IAAI,CAON;AA0gCD,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAMlB,qBAAqB,EAAE,WAAW,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC,GAC3E,IAAI,CAeN;AA+BD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EACpC,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CAAC,GAAG,SAAS,GACpE,IAAI,CAyCN;AAoHD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EACzB,gBAAgB,CAAC,EAAE;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACx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AAE,MAAM,CAAC;CACxB,GACA,IAAI,CA4CN;AAkLD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,qBAAqB,EAChC,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAQN"}
@@ -44,6 +44,25 @@ function pluralizeCollection(className) {
44
44
  return `${lower}s`;
45
45
  }
46
46
  /**
47
+ * The collection an STI subtype shares with its STI base, for a class that
48
+ * registers with no manifest `collection` (#3125). The manifest generator
49
+ * gives every STI subtype its base's collection (`findSTIBase`: the oldest
50
+ * ancestor declaring `tableStrategy: 'sti'`); a subtype decorated before its
51
+ * manifest loads — a consumer's bundled model chunk — must resolve the same
52
+ * one, or permission slugs and route segments derived from it name a
53
+ * collection nothing catalogues. Ancestors resolve by constructor identity, so
54
+ * a same-named class in another package cannot stand in for the base.
55
+ */
56
+ function inheritedStiCollection(ctor) {
57
+ let base;
58
+ for (let parent = Object.getPrototypeOf(ctor); parent && parent !== Function.prototype; parent = Object.getPrototypeOf(parent)) {
59
+ const key = getConstructorIndex().get(parent);
60
+ const registered = key ? getClasses().get(key) : void 0;
61
+ if (registered?.config?.tableStrategy === "sti") base = registered;
62
+ }
63
+ return base?.collection;
64
+ }
65
+ /**
47
66
  * Shared bundled-context detector. Source files in these output
48
67
  * directories come from a bundler (Vite library mode, webpack, Next.js,
49
68
  * Nuxt, svelte-kit) that can duplicate module code across chunks.
@@ -752,7 +771,7 @@ function registerUntracked(ctor, config = {}) {
752
771
  validators,
753
772
  validationRules,
754
773
  tools: manifestEntry?.tools,
755
- collection: manifestEntry?.collection ?? pluralizeCollection(name),
774
+ collection: manifestEntry?.collection ?? inheritedStiCollection(ctor) ?? pluralizeCollection(name),
756
775
  collectionConstructor: promotedCollectionConstructor,
757
776
  packageName,
758
777
  sourceFilePath,
@@ -1019,6 +1038,7 @@ function mergeManifestIntoExistingRegistration(existing, objectDef, packageName)
1019
1038
  } else if (!existing.packageName && objectDef.packageName) existing.packageName = objectDef.packageName;
1020
1039
  if (objectDef.extends) existing.extends = packageName ? qualifyExtendsName(objectDef.extends, packageName) : objectDef.extends;
1021
1040
  if (!existing.sourceFilePath && objectDef.filePath) existing.sourceFilePath = objectDef.filePath;
1041
+ if (objectDef.collection) existing.collection = objectDef.collection;
1022
1042
  existing.visibility = objectDef.visibility || manifestConfig.visibility || existing.visibility;
1023
1043
  invalidateInheritanceEntries(existing);
1024
1044
  }