pmcf 2.32.2 → 2.32.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.32.2",
3
+ "version": "2.32.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "ip-utilties": "^1.3.1",
42
- "npm-pkgbuild": "^18.0.1",
42
+ "npm-pkgbuild": "^18.1.0",
43
43
  "pacc": "^3.4.0",
44
44
  "pkg-dir": "^8.0.0"
45
45
  },
package/src/base.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import { allOutputs } from "npm-pkgbuild";
3
3
  import { getAttribute } from "pacc";
4
- import { addType, primitives } from "./types.mjs";
4
+ import { addType, primitives, typeFactory } from "./types.mjs";
5
5
 
6
6
  const BaseTypeDefinition = {
7
7
  name: "base",
@@ -201,12 +201,13 @@ export class Base {
201
201
  if (value instanceof property.type[0].clazz) {
202
202
  assign(property, value);
203
203
  } else {
204
- const factory =
205
- property.type[0].factoryFor?.(this, value) || property.type[0].clazz;
206
-
207
204
  assign(
208
205
  property,
209
- new factory(this.ownerFor(property, value), value)
206
+ typeFactory(
207
+ property.type[0],
208
+ this.ownerFor(property, value),
209
+ value
210
+ )
210
211
  );
211
212
  }
212
213
  break;
package/src/root.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFile, glob } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { Location } from "./location.mjs";
4
- import { addType, types, resolveTypeLinks } from "./types.mjs";
4
+ import { addType, types, resolveTypeLinks, typeFactory } from "./types.mjs";
5
5
 
6
6
  const RootTypeDefinition = {
7
7
  name: "root",
@@ -49,8 +49,7 @@ export class Root extends Location {
49
49
  const fullName = this.fullName + "/" + name;
50
50
  data.name = fullName.substring(owner.fullName.length + 1);
51
51
 
52
- const object = new type.clazz(owner, data);
53
-
52
+ const object = typeFactory(type, owner, data);
54
53
  this.addTypeObject(type.clazz.typeName, name, object);
55
54
  return object;
56
55
  }
package/src/types.mjs CHANGED
@@ -83,3 +83,8 @@ export function resolveTypeLinks() {
83
83
  }
84
84
  }
85
85
  }
86
+
87
+ export function typeFactory(type, owner, data) {
88
+ const factory = type.factoryFor?.(owner, data) || type.clazz;
89
+ return new factory(owner, data);
90
+ }
package/types/root.d.mts CHANGED
@@ -283,7 +283,7 @@ export class Root extends Location {
283
283
  constructor(directory: any);
284
284
  get fullName(): string;
285
285
  get root(): this;
286
- _load(name: any, type: any): any;
286
+ _load(name: any, type: any): Promise<any>;
287
287
  load(name: any, options: any): any;
288
288
  loadAll(): Promise<void>;
289
289
  }
package/types/types.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export function addType(clazz: any): void;
2
2
  export function resolveTypeLinks(): void;
3
+ export function typeFactory(type: any, owner: any, data: any): any;
3
4
  export const types: {};
4
5
  export const primitives: Set<string>;