pmcf 1.12.0 → 1.14.0

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": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -48,7 +48,7 @@
48
48
  "typescript": "^5.7.3"
49
49
  },
50
50
  "engines": {
51
- "node": ">=22.13.0"
51
+ "node": ">=22.13.1"
52
52
  },
53
53
  "repository": {
54
54
  "type": "git",
package/src/model.mjs CHANGED
@@ -413,15 +413,13 @@ export class World extends Owner {
413
413
  }
414
414
  }
415
415
 
416
- class DNSService {
417
- owner;
418
-
416
+ class DNSService extends Base {
419
417
  allowedUpdates = [];
420
418
  recordTTL = "1W";
421
419
  forwardsTo = [];
422
420
 
423
421
  constructor(owner, data) {
424
- this.owner = owner;
422
+ super(owner, data);
425
423
  Object.assign(this, data);
426
424
  }
427
425
 
@@ -430,11 +428,15 @@ class DNSService {
430
428
 
431
429
  yield* this.owner.services(filter);
432
430
 
433
- for (const s of this.forwardsTo) {
431
+ for (const s of asArray(this.forwardsTo)) {
434
432
  const owner = await this.owner.world.load(s);
435
433
  yield* owner.services(filter);
436
434
  }
437
435
  }
436
+
437
+ get propertyNames() {
438
+ return ["recordTTL", "forwardsTo", "allowedUpdates"];
439
+ }
438
440
  }
439
441
 
440
442
  export class Location extends Owner {
@@ -481,7 +483,6 @@ export class Location extends Owner {
481
483
  return this.#dns;
482
484
  }
483
485
 
484
-
485
486
  async *networkAddresses() {
486
487
  for await (const host of this.hosts()) {
487
488
  for (const networkAddresses of host.networkAddresses()) {
@@ -495,7 +496,7 @@ export class Location extends Owner {
495
496
  }
496
497
 
497
498
  get propertyNames() {
498
- return [...super.propertyNames, "domain" /*, "hosts"*/];
499
+ return [...super.propertyNames, "domain", "administratorEmail", "dns"];
499
500
  }
500
501
  }
501
502
 
@@ -592,7 +593,9 @@ export class Host extends Base {
592
593
  }
593
594
 
594
595
  if (data.extends) {
595
- data.extends = await Promise.all(data.extends.map(e => world.host(e)));
596
+ data.extends = await Promise.all(
597
+ asArray(data.extends).map(e => world.host(e))
598
+ );
596
599
  }
597
600
 
598
601
  return this;
@@ -779,6 +782,10 @@ export class Host extends Base {
779
782
  }
780
783
  }
781
784
 
785
+ get ipAddresses() {
786
+ return [...this.networkAddresses()].map(na => na.address);
787
+ }
788
+
782
789
  get ipAddress() {
783
790
  for (const a of this.networkAddresses()) {
784
791
  return a.address;
@@ -881,7 +888,7 @@ export class Service extends Base {
881
888
  #priority;
882
889
  #type;
883
890
  #port;
884
- #ipAddress;
891
+ #ipAddresses;
885
892
 
886
893
  static get typeName() {
887
894
  return "service";
@@ -905,9 +912,9 @@ export class Service extends Base {
905
912
  this.#port = data.port;
906
913
  delete data.port;
907
914
  }
908
- if (data.ipAddress) {
909
- this.#ipAddress = data.ipAddress;
910
- delete data.ipAddress;
915
+ if (data.ipAddresses) {
916
+ this.#ipAddresses = data.ipAddresses;
917
+ delete data.ipAddresses;
911
918
  }
912
919
 
913
920
  Object.assign(this, data);
@@ -932,8 +939,8 @@ export class Service extends Base {
932
939
  if (this.#port) {
933
940
  data.port = this.#port;
934
941
  }
935
- if (this.#ipAddress) {
936
- data.ipAddress = this.#ipAddress;
942
+ if (this.#ipAddresses) {
943
+ data.ipAddresses = this.#ipAddresses;
937
944
  }
938
945
  return new this.constructor(owner, data);
939
946
  }
@@ -941,20 +948,19 @@ export class Service extends Base {
941
948
  return this;
942
949
  }
943
950
 
944
- get protocol()
945
- {
951
+ get protocol() {
946
952
  return ServiceTypes[this.type]?.protocol;
947
953
  }
948
-
954
+
949
955
  get srvPrefix() {
950
956
  const st = ServiceTypes[this.type];
951
- if(st) {
957
+ if (st) {
952
958
  return `_${this.type}._${st.protocol}`;
953
959
  }
954
960
  }
955
961
 
956
- get ipAddress() {
957
- return this.#ipAddress || this.owner.ipAddress;
962
+ get ipAddresses() {
963
+ return this.#ipAddresses || this.owner.ipAddresses;
958
964
  }
959
965
 
960
966
  get port() {
@@ -980,7 +986,7 @@ export class Service extends Base {
980
986
  get propertyNames() {
981
987
  return [
982
988
  ...super.propertyNames,
983
- "ipAddress",
989
+ "ipAddresses",
984
990
  "port",
985
991
  "protocol",
986
992
  "alias",
package/types/model.d.mts CHANGED
@@ -119,6 +119,7 @@ export class Host extends Base {
119
119
  address: any;
120
120
  networkInterface: any;
121
121
  }, void, unknown>;
122
+ get ipAddresses(): any[];
122
123
  get ipAddress(): any;
123
124
  publicKey(type?: string): Promise<string>;
124
125
  toJSON(): {
@@ -137,7 +138,7 @@ export class Service extends Base {
137
138
  alias: any;
138
139
  get protocol(): any;
139
140
  get srvPrefix(): string;
140
- get ipAddress(): any;
141
+ get ipAddresses(): any;
141
142
  get port(): any;
142
143
  get priority(): any;
143
144
  get weight(): any;
@@ -145,9 +146,7 @@ export class Service extends Base {
145
146
  get type(): any;
146
147
  #private;
147
148
  }
148
- declare class DNSService {
149
- constructor(owner: any, data: any);
150
- owner: any;
149
+ declare class DNSService extends Base {
151
150
  allowedUpdates: any[];
152
151
  recordTTL: string;
153
152
  forwardsTo: any[];