pmcf 3.20.3 → 3.21.1

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,6 +1,5 @@
1
1
  import {
2
2
  addType,
3
- toExternal,
4
3
  duration_attribute_writable,
5
4
  string_attribute_writable,
6
5
  boolean_attribute_writable,
@@ -10,9 +9,10 @@ import {
10
9
  ExtraSourceService,
11
10
  ExtraSourceServiceTypeDefinition,
12
11
  ServiceTypeDefinition,
13
- serviceEndpoints
12
+ serviceEndpoints,
13
+ addServiceType
14
14
  } from "pmcf";
15
- import { yesno } from "../utils.mjs";
15
+ import { filterConfigurable, yesno } from "../utils.mjs";
16
16
 
17
17
  const SystemdResolvedServiceTypeDefinition = {
18
18
  name: "systemd-resolved",
@@ -21,27 +21,32 @@ const SystemdResolvedServiceTypeDefinition = {
21
21
  owners: ServiceTypeDefinition.owners,
22
22
  key: "name",
23
23
  attributes: {
24
- DNS: string_attribute_writable,
25
- FallbackDNS: string_attribute_writable,
26
- Domains: string_attribute_writable,
27
- MulticastDNS: boolean_attribute_writable,
28
- Cache: boolean_attribute_writable,
29
- CacheFromLocalhost: boolean_attribute_writable,
30
- DNSStubListener: boolean_attribute_writable,
31
- DNSStubListenerExtra: string_attribute_writable,
32
- ReadEtcHosts: boolean_attribute_writable,
33
- ResolveUnicastSingleLabel: boolean_attribute_writable,
34
- StaleRetentionSec: duration_attribute_writable,
35
- RefuseRecordTypes: string_attribute_writable,
36
- DNSSEC: { ...yesno_attribute_writable, default: false },
37
- DNSOverTLS: yesno_attribute_writable,
38
- LLMNR: yesno_attribute_writable
39
- }
24
+ DNS: { ...string_attribute_writable, configurable: true },
25
+ FallbackDNS: { ...string_attribute_writable, configurable: true },
26
+ Domains: { ...string_attribute_writable, configurable: true },
27
+ MulticastDNS: { ...boolean_attribute_writable, configurable: true },
28
+ Cache: { ...boolean_attribute_writable, configurable: true },
29
+ CacheFromLocalhost: { ...boolean_attribute_writable, configurable: true },
30
+ DNSStubListener: { ...boolean_attribute_writable, configurable: true },
31
+ DNSStubListenerExtra: { ...string_attribute_writable, configurable: true },
32
+ ReadEtcHosts: { ...boolean_attribute_writable, configurable: true },
33
+ ResolveUnicastSingleLabel: {
34
+ ...boolean_attribute_writable,
35
+ configurable: true
36
+ },
37
+ StaleRetentionSec: { ...duration_attribute_writable, configurable: true },
38
+ RefuseRecordTypes: { ...string_attribute_writable, configurable: true },
39
+ DNSSEC: { ...yesno_attribute_writable, default: false, configurable: true },
40
+ DNSOverTLS: { ...yesno_attribute_writable, configurable: true },
41
+ LLMNR: { ...yesno_attribute_writable, configurable: true }
42
+ },
43
+ service: {}
40
44
  };
41
45
 
42
46
  export class SystemdResolvedService extends ExtraSourceService {
43
47
  static {
44
48
  addType(this);
49
+ addServiceType(this.typeDefinition.service, this.typeDefinition.name);
45
50
  }
46
51
 
47
52
  static get typeDefinition() {
@@ -80,13 +85,7 @@ export class SystemdResolvedService extends ExtraSourceService {
80
85
  FallbackDNS: serviceEndpoints(this, options(100, 199, 4)),
81
86
  Domains: [...this.localDomains].join(" "),
82
87
  MulticastDNS: yesno(this.network.multicastDNS),
83
-
84
- // TODO extendet properties with getAttribute()
85
- ...Object.fromEntries(
86
- Object.entries(SystemdResolvedServiceTypeDefinition.attributes)
87
- .map(([k, v]) => [k, toExternal(this.extendedProperty(k), v)])
88
- .filter(([k, v]) => v !== undefined)
89
- )
88
+ ...this.getProperties(filterConfigurable)
90
89
  }
91
90
  ]
92
91
  };
@@ -1,21 +1,39 @@
1
- import { addType } from "pacc";
1
+ import {
2
+ addType,
3
+ string_attribute_writable,
4
+ duration_attribute_writable
5
+ } from "pacc";
2
6
  import {
3
7
  ExtraSourceService,
4
8
  ExtraSourceServiceTypeDefinition,
5
9
  ServiceTypeDefinition,
6
- serviceEndpoints
10
+ serviceEndpoints,
11
+ addServiceType
7
12
  } from "pmcf";
13
+ import { filterConfigurable } from "../utils.mjs";
8
14
 
9
15
  const SystemdTimesyncdServiceTypeDefinition = {
10
16
  name: "systemd-timesyncd",
11
17
  extends: ExtraSourceServiceTypeDefinition,
12
18
  specializationOf: ServiceTypeDefinition,
13
19
  owners: ServiceTypeDefinition.owners,
20
+
21
+ attributes: {
22
+ NTP: {...string_attribute_writable, configurable: true },
23
+ FallbackNTP: {...string_attribute_writable, configurable: true },
24
+ RootDistanceMaxSec: {...duration_attribute_writable, configurable: true },
25
+ PollIntervalMinSec: {...duration_attribute_writable, configurable: true },
26
+ PollIntervalMaxSec: {...duration_attribute_writable, configurable: true },
27
+ ConnectionRetrySec: {...duration_attribute_writable, configurable: true },
28
+ SaveIntervalSec: {...duration_attribute_writable, configurable: true }
29
+ },
30
+ service: {}
14
31
  };
15
32
 
16
33
  export class SystemdTimesyncdService extends ExtraSourceService {
17
34
  static {
18
35
  addType(this);
36
+ addServiceType(this.typeDefinition.service, this.typeDefinition.name);
19
37
  }
20
38
 
21
39
  static get typeDefinition() {
@@ -49,7 +67,8 @@ export class SystemdTimesyncdService extends ExtraSourceService {
49
67
  "Time",
50
68
  {
51
69
  NTP: serviceEndpoints(this, options(300, 399)),
52
- FallbackNTP: serviceEndpoints(this, options(100, 199))
70
+ FallbackNTP: serviceEndpoints(this, options(100, 199)),
71
+ ...this.getProperties(filterConfigurable)
53
72
  }
54
73
  ]
55
74
  };
package/src/utils.mjs CHANGED
@@ -107,3 +107,6 @@ export function asIterator(value) {
107
107
 
108
108
  return asArray(value);
109
109
  }
110
+
111
+
112
+ export const filterConfigurable = (name, attribute) => !attribute.private & attribute.configurable;
package/types/base.d.mts CHANGED
@@ -69,6 +69,11 @@ export class Base {
69
69
  _extendedPropertyIterator(propertyName: any, seen: any): Generator<any, void, any>;
70
70
  _extendedProperty(propertyName: any, seen: any): any;
71
71
  extendedProperty(propertyName: any): any;
72
+ /**
73
+ * Retrive attribute values from an object.
74
+ * @return {Object} values
75
+ */
76
+ getProperties(filter?: typeof filterPublic): any;
72
77
  get root(): any;
73
78
  get location(): any;
74
79
  get host(): any;
@@ -131,3 +136,4 @@ export class Base {
131
136
  toString(): string;
132
137
  toJSON(): any;
133
138
  }
139
+ import { filterPublic } from "pacc";
@@ -748,6 +748,7 @@ export class SystemdJournalRemoteService extends Service {
748
748
  key: string;
749
749
  attributes: {
750
750
  Seal: {
751
+ configurable: boolean;
751
752
  type: object;
752
753
  isKey: boolean;
753
754
  writable: boolean;
@@ -770,6 +771,7 @@ export class SystemdJournalRemoteService extends Service {
770
771
  };
771
772
  SplitMode: {
772
773
  values: (string | boolean)[];
774
+ configurable: boolean;
773
775
  type: object;
774
776
  isKey: boolean;
775
777
  writable: boolean;
@@ -790,6 +792,7 @@ export class SystemdJournalRemoteService extends Service {
790
792
  additionalValues?: object;
791
793
  };
792
794
  ServerKeyFile: {
795
+ configurable: boolean;
793
796
  type: object;
794
797
  isKey: boolean;
795
798
  writable: boolean;
@@ -811,6 +814,7 @@ export class SystemdJournalRemoteService extends Service {
811
814
  additionalValues?: object;
812
815
  };
813
816
  ServerCertificateFile: {
817
+ configurable: boolean;
814
818
  type: object;
815
819
  isKey: boolean;
816
820
  writable: boolean;
@@ -832,6 +836,7 @@ export class SystemdJournalRemoteService extends Service {
832
836
  additionalValues?: object;
833
837
  };
834
838
  TrustedCertificateFile: {
839
+ configurable: boolean;
835
840
  type: object;
836
841
  isKey: boolean;
837
842
  writable: boolean;
@@ -853,6 +858,7 @@ export class SystemdJournalRemoteService extends Service {
853
858
  additionalValues?: object;
854
859
  };
855
860
  MaxUse: {
861
+ configurable: boolean;
856
862
  type: object;
857
863
  isKey: boolean;
858
864
  writable: boolean;
@@ -874,6 +880,7 @@ export class SystemdJournalRemoteService extends Service {
874
880
  additionalValues?: object;
875
881
  };
876
882
  KeepFree: {
883
+ configurable: boolean;
877
884
  type: object;
878
885
  isKey: boolean;
879
886
  writable: boolean;
@@ -895,6 +902,7 @@ export class SystemdJournalRemoteService extends Service {
895
902
  additionalValues?: object;
896
903
  };
897
904
  MaxFileSize: {
905
+ configurable: boolean;
898
906
  type: object;
899
907
  isKey: boolean;
900
908
  writable: boolean;
@@ -916,6 +924,7 @@ export class SystemdJournalRemoteService extends Service {
916
924
  additionalValues?: object;
917
925
  };
918
926
  MaxFiles: {
927
+ configurable: boolean;
919
928
  type: object;
920
929
  isKey: boolean;
921
930
  writable: boolean;
@@ -937,6 +946,7 @@ export class SystemdJournalRemoteService extends Service {
937
946
  additionalValues?: object;
938
947
  };
939
948
  Compression: {
949
+ configurable: boolean;
940
950
  type: object;
941
951
  isKey: boolean;
942
952
  writable: boolean;
@@ -959,14 +969,12 @@ export class SystemdJournalRemoteService extends Service {
959
969
  };
960
970
  };
961
971
  service: {
962
- services: {
963
- endpoints: {
964
- family: string;
965
- port: number;
966
- protocol: string;
967
- tls: boolean;
968
- }[];
969
- };
972
+ endpoints: {
973
+ family: string;
974
+ port: number;
975
+ protocol: string;
976
+ tls: boolean;
977
+ }[];
970
978
  };
971
979
  };
972
980
  get type(): string;
@@ -748,8 +748,30 @@ export class SystemdJournalUploadService extends Service {
748
748
  })[];
749
749
  key: string;
750
750
  attributes: {
751
- URL: import("pacc").AttributeDefinition;
751
+ URL: {
752
+ configurable: boolean;
753
+ type: object;
754
+ isKey: boolean;
755
+ writable: boolean;
756
+ mandatory: boolean;
757
+ collection: boolean;
758
+ private?: boolean;
759
+ credential?: boolean;
760
+ persistent?: boolean;
761
+ depends?: string;
762
+ description?: string;
763
+ default?: any;
764
+ set?: Function;
765
+ get?: Function;
766
+ toInternal?: Function;
767
+ toExternal?: Function;
768
+ values?: Set<any>;
769
+ externalName?: string;
770
+ env?: string[] | string;
771
+ additionalValues?: object;
772
+ };
752
773
  ServerKeyFile: {
774
+ configurable: boolean;
753
775
  type: object;
754
776
  isKey: boolean;
755
777
  writable: boolean;
@@ -771,6 +793,7 @@ export class SystemdJournalUploadService extends Service {
771
793
  additionalValues?: object;
772
794
  };
773
795
  ServerCertificateFile: {
796
+ configurable: boolean;
774
797
  type: object;
775
798
  isKey: boolean;
776
799
  writable: boolean;
@@ -792,6 +815,7 @@ export class SystemdJournalUploadService extends Service {
792
815
  additionalValues?: object;
793
816
  };
794
817
  TrustedCertificateFile: {
818
+ configurable: boolean;
795
819
  type: object;
796
820
  isKey: boolean;
797
821
  writable: boolean;
@@ -813,6 +837,7 @@ export class SystemdJournalUploadService extends Service {
813
837
  additionalValues?: object;
814
838
  };
815
839
  Compression: {
840
+ configurable: boolean;
816
841
  type: object;
817
842
  isKey: boolean;
818
843
  writable: boolean;
@@ -834,6 +859,7 @@ export class SystemdJournalUploadService extends Service {
834
859
  additionalValues?: object;
835
860
  };
836
861
  ForceCompression: {
862
+ configurable: boolean;
837
863
  type: object;
838
864
  isKey: boolean;
839
865
  writable: boolean;
@@ -855,6 +881,7 @@ export class SystemdJournalUploadService extends Service {
855
881
  additionalValues?: object;
856
882
  };
857
883
  };
884
+ service: {};
858
885
  };
859
886
  get type(): string;
860
887
  get systemdServices(): string;
@@ -744,6 +744,7 @@ export class SystemdJournalService extends Service {
744
744
  key: string;
745
745
  attributes: {
746
746
  Storage: {
747
+ configurable: boolean;
747
748
  type: object;
748
749
  isKey: boolean;
749
750
  writable: boolean;
@@ -765,6 +766,7 @@ export class SystemdJournalService extends Service {
765
766
  additionalValues?: object;
766
767
  };
767
768
  Seal: {
769
+ configurable: boolean;
768
770
  type: object;
769
771
  isKey: boolean;
770
772
  writable: boolean;
@@ -786,6 +788,7 @@ export class SystemdJournalService extends Service {
786
788
  additionalValues?: object;
787
789
  };
788
790
  SplitMode: {
791
+ configurable: boolean;
789
792
  type: object;
790
793
  isKey: boolean;
791
794
  writable: boolean;
@@ -807,6 +810,7 @@ export class SystemdJournalService extends Service {
807
810
  additionalValues?: object;
808
811
  };
809
812
  SyncIntervalSec: {
813
+ configurable: boolean;
810
814
  type: object;
811
815
  isKey: boolean;
812
816
  writable: boolean;
@@ -828,6 +832,7 @@ export class SystemdJournalService extends Service {
828
832
  additionalValues?: object;
829
833
  };
830
834
  RateLimitIntervalSec: {
835
+ configurable: boolean;
831
836
  type: object;
832
837
  isKey: boolean;
833
838
  writable: boolean;
@@ -849,6 +854,7 @@ export class SystemdJournalService extends Service {
849
854
  additionalValues?: object;
850
855
  };
851
856
  RateLimitBurst: {
857
+ configurable: boolean;
852
858
  type: object;
853
859
  isKey: boolean;
854
860
  writable: boolean;
@@ -870,6 +876,7 @@ export class SystemdJournalService extends Service {
870
876
  additionalValues?: object;
871
877
  };
872
878
  SystemMaxUse: {
879
+ configurable: boolean;
873
880
  type: object;
874
881
  isKey: boolean;
875
882
  writable: boolean;
@@ -891,6 +898,7 @@ export class SystemdJournalService extends Service {
891
898
  additionalValues?: object;
892
899
  };
893
900
  SystemKeepFree: {
901
+ configurable: boolean;
894
902
  type: object;
895
903
  isKey: boolean;
896
904
  writable: boolean;
@@ -912,6 +920,7 @@ export class SystemdJournalService extends Service {
912
920
  additionalValues?: object;
913
921
  };
914
922
  SystemMaxFileSize: {
923
+ configurable: boolean;
915
924
  type: object;
916
925
  isKey: boolean;
917
926
  writable: boolean;
@@ -933,6 +942,7 @@ export class SystemdJournalService extends Service {
933
942
  additionalValues?: object;
934
943
  };
935
944
  SystemMaxFiles: {
945
+ configurable: boolean;
936
946
  type: object;
937
947
  isKey: boolean;
938
948
  writable: boolean;
@@ -954,6 +964,7 @@ export class SystemdJournalService extends Service {
954
964
  additionalValues?: object;
955
965
  };
956
966
  RuntimeMaxUse: {
967
+ configurable: boolean;
957
968
  type: object;
958
969
  isKey: boolean;
959
970
  writable: boolean;
@@ -975,6 +986,7 @@ export class SystemdJournalService extends Service {
975
986
  additionalValues?: object;
976
987
  };
977
988
  RuntimeKeepFree: {
989
+ configurable: boolean;
978
990
  type: object;
979
991
  isKey: boolean;
980
992
  writable: boolean;
@@ -996,6 +1008,7 @@ export class SystemdJournalService extends Service {
996
1008
  additionalValues?: object;
997
1009
  };
998
1010
  RuntimeMaxFileSize: {
1011
+ configurable: boolean;
999
1012
  type: object;
1000
1013
  isKey: boolean;
1001
1014
  writable: boolean;
@@ -1017,6 +1030,7 @@ export class SystemdJournalService extends Service {
1017
1030
  additionalValues?: object;
1018
1031
  };
1019
1032
  RuntimeMaxFiles: {
1033
+ configurable: boolean;
1020
1034
  type: object;
1021
1035
  isKey: boolean;
1022
1036
  writable: boolean;
@@ -1038,6 +1052,7 @@ export class SystemdJournalService extends Service {
1038
1052
  additionalValues?: object;
1039
1053
  };
1040
1054
  MaxRetentionSec: {
1055
+ configurable: boolean;
1041
1056
  type: object;
1042
1057
  isKey: boolean;
1043
1058
  writable: boolean;
@@ -1059,6 +1074,7 @@ export class SystemdJournalService extends Service {
1059
1074
  additionalValues?: object;
1060
1075
  };
1061
1076
  MaxFileSec: {
1077
+ configurable: boolean;
1062
1078
  type: object;
1063
1079
  isKey: boolean;
1064
1080
  writable: boolean;
@@ -1080,6 +1096,7 @@ export class SystemdJournalService extends Service {
1080
1096
  additionalValues?: object;
1081
1097
  };
1082
1098
  ForwardToSyslog: {
1099
+ configurable: boolean;
1083
1100
  type: object;
1084
1101
  isKey: boolean;
1085
1102
  writable: boolean;
@@ -1101,6 +1118,7 @@ export class SystemdJournalService extends Service {
1101
1118
  additionalValues?: object;
1102
1119
  };
1103
1120
  ForwardToKMsg: {
1121
+ configurable: boolean;
1104
1122
  type: object;
1105
1123
  isKey: boolean;
1106
1124
  writable: boolean;
@@ -1122,6 +1140,7 @@ export class SystemdJournalService extends Service {
1122
1140
  additionalValues?: object;
1123
1141
  };
1124
1142
  ForwardToConsole: {
1143
+ configurable: boolean;
1125
1144
  type: object;
1126
1145
  isKey: boolean;
1127
1146
  writable: boolean;
@@ -1143,6 +1162,7 @@ export class SystemdJournalService extends Service {
1143
1162
  additionalValues?: object;
1144
1163
  };
1145
1164
  ForwardToWall: {
1165
+ configurable: boolean;
1146
1166
  type: object;
1147
1167
  isKey: boolean;
1148
1168
  writable: boolean;
@@ -1164,6 +1184,7 @@ export class SystemdJournalService extends Service {
1164
1184
  additionalValues?: object;
1165
1185
  };
1166
1186
  TTYPath: {
1187
+ configurable: boolean;
1167
1188
  type: object;
1168
1189
  isKey: boolean;
1169
1190
  writable: boolean;
@@ -1185,6 +1206,7 @@ export class SystemdJournalService extends Service {
1185
1206
  additionalValues?: object;
1186
1207
  };
1187
1208
  MaxLevelStore: {
1209
+ configurable: boolean;
1188
1210
  type: object;
1189
1211
  isKey: boolean;
1190
1212
  writable: boolean;
@@ -1206,6 +1228,7 @@ export class SystemdJournalService extends Service {
1206
1228
  additionalValues?: object;
1207
1229
  };
1208
1230
  Compress: {
1231
+ configurable: boolean;
1209
1232
  type: object;
1210
1233
  isKey: boolean;
1211
1234
  writable: boolean;
@@ -1227,6 +1250,7 @@ export class SystemdJournalService extends Service {
1227
1250
  additionalValues?: object;
1228
1251
  };
1229
1252
  };
1253
+ service: {};
1230
1254
  };
1231
1255
  get type(): string;
1232
1256
  get systemdServices(): string;