@happyvertical/smrt-core 0.57.9 → 0.57.11

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.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-core",
5
- "packageVersion": "0.57.9",
5
+ "packageVersion": "0.57.11",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-core:SmrtClass": {
8
8
  "name": "smrtclass",
@@ -1 +1 @@
1
- {"version":3,"file":"class-registration.d.ts","sourceRoot":"","sources":["../../src/registry/class-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwBH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAW,CAAC;AACvC,OAAO,KAAK,EAKV,qBAAqB,EAGtB,MAAM,qBAAqB,CAAC;AAsD7B,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EAElB,MAAM,YAAY,CAAC;AA0EpB;;;;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;AAstBD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,UAAU,EACvB,MAAM,GAAE,iBAAsB,GAC7B,IAAI,CASN;AA+nCD,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;CACxB,GACA,IAAI,CA4CN;AA0LD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,qBAAqB,EAChC,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAUN"}
1
+ {"version":3,"file":"class-registration.d.ts","sourceRoot":"","sources":["../../src/registry/class-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwBH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAW,CAAC;AACvC,OAAO,KAAK,EAKV,qBAAqB,EAGtB,MAAM,qBAAqB,CAAC;AAsD7B,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAiGpB;;;;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;AAstBD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,UAAU,EACvB,MAAM,GAAE,iBAAsB,GAC7B,IAAI,CASN;AAioCD,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;CACxB,GACA,IAAI,CA4CN;AAmMD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,qBAAqB,EAChC,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAUN"}
@@ -47,6 +47,19 @@ function pluralizeCollection(className) {
47
47
  return `${lower}s`;
48
48
  }
49
49
  /**
50
+ * The registry key of the class `ctor` actually extends, when that parent is
51
+ * registered under a qualified name and (if the manifest names a parent) has
52
+ * the manifest's simple name (#4145). Constructor identity is exact: two
53
+ * packages may export a same-named class, and only the prototype says which
54
+ * one this class extends, even when the manifest predates `extendsQualified`.
55
+ */
56
+ function registeredParentKey(ctor, manifestParent) {
57
+ const parentKey = getConstructorIndex().get(Object.getPrototypeOf(ctor));
58
+ if (!parentKey || !isQualifiedName(parentKey)) return void 0;
59
+ if (manifestParent && manifestParent !== parentKey && parseQualifiedName(parentKey).className !== manifestParent) return;
60
+ return parentKey;
61
+ }
62
+ /**
50
63
  * The collection an STI subtype shares with its STI base, for a class that
51
64
  * registers with no manifest `collection` (#3125). The manifest generator
52
65
  * gives every STI subtype its base's collection (`findSTIBase`: the oldest
@@ -870,7 +883,7 @@ function registerUntracked(ctor, config = {}) {
870
883
  let validators;
871
884
  if (validationRules === void 0) validators = compileValidators(name, fields);
872
885
  else verboseLog(`[registry] Using ${validationRules.length} pre-computed validation rules for ${name}`);
873
- let extendsClass = manifestEntry?.extendsQualified ?? manifestEntry?.extends;
886
+ let extendsClass = manifestEntry?.extendsQualified ?? registeredParentKey(ctor, manifestEntry?.extends) ?? manifestEntry?.extends;
874
887
  assertRegisteredStiParent(ctor);
875
888
  if (!extendsClass) {
876
889
  const proto = Object.getPrototypeOf(ctor);
@@ -1185,7 +1198,10 @@ function mergeManifestIntoExistingRegistration(existing, objectDef, packageName)
1185
1198
  existing.qualifiedName = createQualifiedName(packageName, existing.name);
1186
1199
  } else if (!existing.packageName && objectDef.packageName) existing.packageName = objectDef.packageName;
1187
1200
  const manifestParent = objectDef.extendsQualified ?? objectDef.extends;
1188
- if (manifestParent) existing.extends = packageName ? qualifyExtendsName(manifestParent, packageName) : manifestParent;
1201
+ if (manifestParent) {
1202
+ const qualifiedParent = packageName ? qualifyExtendsName(manifestParent, packageName) : manifestParent;
1203
+ if (!(!isQualifiedName(qualifiedParent) && !!existing.extends && isQualifiedName(existing.extends) && parseQualifiedName(existing.extends).className === qualifiedParent)) existing.extends = qualifiedParent;
1204
+ }
1189
1205
  if (!existing.sourceFilePath && objectDef.filePath) existing.sourceFilePath = objectDef.filePath;
1190
1206
  if (objectDef.collection) existing.collection = existing.config.collection ?? objectDef.collection;
1191
1207
  existing.visibility = objectDef.visibility || manifestConfig.visibility || existing.visibility;