pmcf 4.17.3 → 4.18.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/bin/pmcf-info CHANGED
@@ -1,26 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { prepare } from "../src/cli.mjs";
3
3
 
4
- const { root, args, options } = await prepare({
5
- service: {
6
- type: "string"
7
- },
8
- address: {
9
- type: "boolean"
10
- }
11
- });
4
+ const { root, args, options } = await prepare({});
12
5
 
13
6
  for (const name of args) {
14
- const object = await root.load(name);
15
- if (options.service) {
16
- for (const service of root.findServices(`type="${options.service}"`)) {
17
- console.log(service.toString());
18
- }
19
- } else if (options.address) {
20
- for (const na of object.networkAddresses()) {
21
- console.log(na.toString());
22
- }
23
- } else {
24
- console.log(object.toJSON());
7
+ const [path, expression] = name.split("?");
8
+
9
+ const object = await root.load(path);
10
+
11
+ let result = object.expression(expression);
12
+
13
+ if (result instanceof Iterator) {
14
+ result = Array.from(result);
25
15
  }
16
+
17
+ console.log(result);
26
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.17.3",
3
+ "version": "4.18.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -148,8 +148,13 @@ export class Base {
148
148
  this[name].add(value);
149
149
  }
150
150
  } else if (current instanceof Map) {
151
- // TODO
152
- this[name] = value;
151
+ const keyName = attribute.type.key;
152
+ if (keyName) {
153
+ current.set(value[keyName], value);
154
+ } else {
155
+ // TODO
156
+ this[name] = value;
157
+ }
153
158
  } else {
154
159
  this.error("Unknown collection type", name, current);
155
160
  }
@@ -566,6 +571,7 @@ export class Base {
566
571
  sources: [],
567
572
  outputs: this.outputs,
568
573
  properties: {
574
+ name: `${this.typeName}-${this.owner.name}-${this.name}`,
569
575
  access: "private",
570
576
  dependencies: this.depends,
571
577
  groups: [this.type]
package/src/host.mjs CHANGED
@@ -409,34 +409,30 @@ export class Host extends ServiceOwner {
409
409
  }
410
410
 
411
411
  async *preparePackages(dir) {
412
- const pkgName = `${this.typeName}-${this.owner.name}-${this.name}`;
413
- let packageData = {
414
- sources: [
415
- await Array.fromAsync(this.templateContent()),
416
- new FileContentProvider(
417
- { dir: this.directory, pattern: "*.pub" },
418
- { destination: "/etc/ssh/", mode: 0o644 }
419
- ),
420
- new FileContentProvider(
421
- { dir: this.directory, pattern: "*_key" },
422
- { destination: "/etc/ssh/", mode: 0o600 }
423
- ),
424
- new FileContentProvider({ dir, pattern: ["**/*", "**/.ssh/*"] })
412
+ const packageData = this.packageData;
413
+ packageData.sources.push(
414
+ await Array.fromAsync(this.templateContent()),
415
+ new FileContentProvider(
416
+ { dir: this.directory, pattern: "*.pub" },
417
+ { destination: "/etc/ssh/", mode: 0o644 }
418
+ ),
419
+ new FileContentProvider(
420
+ { dir: this.directory, pattern: "*_key" },
421
+ { destination: "/etc/ssh/", mode: 0o600 }
422
+ ),
423
+ new FileContentProvider({ dir, pattern: ["**/*", "**/.ssh/*"] })
424
+ );
425
+
426
+ Object.assign(packageData.properties, {
427
+ description: `${this.typeName} definitions for ${this.fullName}`,
428
+ dependencies: [
429
+ `${this.location.typeName}-${this.location.name}`,
430
+ ...this.depends
425
431
  ],
426
- outputs: this.outputs,
427
- properties: {
428
- name: pkgName,
429
- description: `${this.typeName} definitions for ${this.fullName}`,
430
- access: "private",
431
- dependencies: [
432
- `${this.location.typeName}-${this.location.name}`,
433
- ...this.depends
434
- ],
435
- provides: [...this.provides],
436
- replaces: [...this.replaces],
437
- backup: "root/.ssh/known_hosts"
438
- }
439
- };
432
+ provides: [...this.provides],
433
+ replaces: [...this.replaces],
434
+ backup: "root/.ssh/known_hosts"
435
+ });
440
436
 
441
437
  await loadHooks(
442
438
  packageData,
@@ -484,7 +480,7 @@ export class Host extends ServiceOwner {
484
480
  name: `${this.typeName}-extra-${this.owner.name}-${this.name}`,
485
481
  description: `additional files for ${this.fullName}`,
486
482
  access: "private",
487
- dependencies: [pkgName]
483
+ dependencies: [packageData.properties.name]
488
484
  }
489
485
  };
490
486
  }
package/src/owner.mjs CHANGED
@@ -169,7 +169,7 @@ export class Owner extends Base {
169
169
  return this.typeNamed("location", name);
170
170
  }
171
171
 
172
- locations() {
172
+ get locations() {
173
173
  return this.typeList("location");
174
174
  }
175
175
 
@@ -11,6 +11,7 @@ import { ServiceTypeDefinition, Service } from "../service.mjs";
11
11
  const ALPMRepositoryTypeDefinition = {
12
12
  name: "alpm_repository",
13
13
  extends: Base.typeDefinition,
14
+ key: "name",
14
15
  attributes: {
15
16
  name: name_attribute_writable,
16
17
  base: string_attribute_writable,
@@ -26,6 +27,9 @@ class ALPMRepository extends Base {
26
27
  static get typeDefinition() {
27
28
  return ALPMRepositoryTypeDefinition;
28
29
  }
30
+
31
+ architectures = new Set();
32
+
29
33
  }
30
34
 
31
35
  const ALPMServiceTypeDefinition = {
@@ -56,9 +60,5 @@ export class ALPMService extends Service {
56
60
  return ALPMServiceTypeDefinition;
57
61
  }
58
62
 
59
- _repositories = new Map();
60
-
61
- set repositories(repository) {
62
- this._repositories.set(repository.name, repository);
63
- }
63
+ repositories = new Map();
64
64
  }
package/types/base.d.mts CHANGED
@@ -135,6 +135,7 @@ export class Base {
135
135
  sources: any[];
136
136
  outputs: Set<typeof import("npm-pkgbuild").DEBIAN | typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
137
137
  properties: {
138
+ name: string;
138
139
  access: string;
139
140
  dependencies: any;
140
141
  groups: any[];
package/types/host.d.mts CHANGED
@@ -261,16 +261,13 @@ export class Host extends ServiceOwner {
261
261
  get subnets(): Set<any>;
262
262
  publicKey(type?: string): Promise<string>;
263
263
  preparePackages(dir: any): AsyncGenerator<{
264
- sources: (FileContentProvider | ContentProvider[])[];
264
+ sources: any[];
265
265
  outputs: Set<typeof import("npm-pkgbuild").DEBIAN | typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
266
266
  properties: {
267
267
  name: string;
268
- description: string;
269
268
  access: string;
270
- dependencies: any[];
271
- provides: any[];
272
- replaces: any[];
273
- backup: string;
269
+ dependencies: any;
270
+ groups: any[];
274
271
  };
275
272
  } | {
276
273
  sources: FileContentProvider[];
package/types/owner.d.mts CHANGED
@@ -192,7 +192,7 @@ export class Owner extends Base {
192
192
  addObject(object: any): void;
193
193
  findServices(filter: any): Generator<any, void, any>;
194
194
  locationNamed(name: any): any;
195
- locations(): any;
195
+ get locations(): any;
196
196
  hostNamed(name: any): any;
197
197
  directHosts(): Set<any>;
198
198
  hosts(): Set<any>;
@@ -662,6 +662,7 @@ export class Service extends Base {
662
662
  sources: any[];
663
663
  outputs: Set<typeof import("npm-pkgbuild").DEBIAN | typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").OCI | typeof import("npm-pkgbuild").DOCKER>;
664
664
  properties: {
665
+ name: string;
665
666
  access: string;
666
667
  dependencies: any;
667
668
  groups: any[];
@@ -799,8 +799,7 @@ export class ALPMService extends Service {
799
799
  extends: string[];
800
800
  };
801
801
  };
802
- _repositories: Map<any, any>;
803
- set repositories(repository: any);
802
+ repositories: Map<any, any>;
804
803
  }
805
804
  import { Service } from "../service.mjs";
806
805
  import { Base } from "pmcf";