pacc 9.5.0 → 10.0.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.
- package/README.md +15 -0
- package/package.json +2 -2
- package/src/attributes.mjs +4 -4
- package/src/common-attributes.mjs +5 -5
- package/src/environment.mjs +1 -1
- package/src/types.mjs +0 -8
- package/types/attributes.d.mts +2 -2
- package/types/common-attributes.d.mts +3 -3
- package/types/types.d.mts +0 -1
package/README.md
CHANGED
|
@@ -96,6 +96,7 @@ tokens "abc" "
|
|
|
96
96
|
* [version\_attribute\_writable](#version_attribute_writable)
|
|
97
97
|
* [description\_attribute](#description_attribute)
|
|
98
98
|
* [type\_attribute](#type_attribute)
|
|
99
|
+
* [type\_attribute\_writable](#type_attribute_writable)
|
|
99
100
|
* [state\_attribute\_writable](#state_attribute_writable)
|
|
100
101
|
* [boolean\_attribute](#boolean_attribute)
|
|
101
102
|
* [boolean\_attribute\_writable](#boolean_attribute_writable)
|
|
@@ -126,10 +127,12 @@ tokens "abc" "
|
|
|
126
127
|
* [url\_attribute\_writable](#url_attribute_writable)
|
|
127
128
|
* [hostname\_attribute](#hostname_attribute)
|
|
128
129
|
* [port\_attribute](#port_attribute)
|
|
130
|
+
* [port\_attribute\_writable](#port_attribute_writable)
|
|
129
131
|
* [id\_attribute](#id_attribute)
|
|
130
132
|
* [body\_attribute\_writable](#body_attribute_writable)
|
|
131
133
|
* [title\_attribute\_writable](#title_attribute_writable)
|
|
132
134
|
* [priority\_attribute](#priority_attribute)
|
|
135
|
+
* [priority\_attribute](#priority_attribute-1)
|
|
133
136
|
* [duration\_attribute](#duration_attribute)
|
|
134
137
|
* [duration\_attribute\_writable](#duration_attribute_writable)
|
|
135
138
|
* [duration\_ms\_attribute](#duration_ms_attribute)
|
|
@@ -365,6 +368,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
365
368
|
|
|
366
369
|
Type: [AttributeDefinition](#attributedefinition)
|
|
367
370
|
|
|
371
|
+
## type\_attribute\_writable
|
|
372
|
+
|
|
373
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
374
|
+
|
|
368
375
|
## state\_attribute\_writable
|
|
369
376
|
|
|
370
377
|
Type: [AttributeDefinition](#attributedefinition)
|
|
@@ -485,6 +492,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
485
492
|
|
|
486
493
|
Type: [AttributeDefinition](#attributedefinition)
|
|
487
494
|
|
|
495
|
+
## port\_attribute\_writable
|
|
496
|
+
|
|
497
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
498
|
+
|
|
488
499
|
## id\_attribute
|
|
489
500
|
|
|
490
501
|
Unique id within.
|
|
@@ -510,6 +521,10 @@ this defines the order.
|
|
|
510
521
|
|
|
511
522
|
Type: [AttributeDefinition](#attributedefinition)
|
|
512
523
|
|
|
524
|
+
## priority\_attribute
|
|
525
|
+
|
|
526
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
527
|
+
|
|
513
528
|
## duration\_attribute
|
|
514
529
|
|
|
515
530
|
Duration in seconds.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@mitata/counters": "^0.0.8",
|
|
46
|
-
"aggregated-map": "^1.0.
|
|
46
|
+
"aggregated-map": "^1.0.5",
|
|
47
47
|
"ava": "^8.0.1",
|
|
48
48
|
"browser-ava": "^2.3.62",
|
|
49
49
|
"c8": "^11.0.0",
|
package/src/attributes.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export function* attributeIterator(definition, filter, path = []) {
|
|
|
55
55
|
if (definition) {
|
|
56
56
|
for (const [name, def] of Object.entries(definition)) {
|
|
57
57
|
const path2 = [...path, name];
|
|
58
|
-
if (typeof filter !== "function" || filter(
|
|
58
|
+
if (typeof filter !== "function" || filter(def)) {
|
|
59
59
|
yield [path2, def];
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -78,8 +78,8 @@ export function* extendingAttributeIterator(type, filter, path) {
|
|
|
78
78
|
yield* attributeIterator(type.attributes, filter, path);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export const filterWritable =
|
|
82
|
-
export const filterPublic =
|
|
81
|
+
export const filterWritable = attribute => attribute.writable;
|
|
82
|
+
export const filterPublic = attribute => !attribute.private;
|
|
83
83
|
|
|
84
84
|
export function* writableAttributeIterator(definition) {
|
|
85
85
|
yield* attributeIterator(definition, filterWritable);
|
|
@@ -108,7 +108,7 @@ export function toExternal(value, attribute) {
|
|
|
108
108
|
export function mandatoryAttributesPresent(object, attributes) {
|
|
109
109
|
for (const [path, attribute] of attributeIterator(
|
|
110
110
|
attributes,
|
|
111
|
-
|
|
111
|
+
attribute => attribute.mandatory
|
|
112
112
|
)) {
|
|
113
113
|
const name = path.join(".");
|
|
114
114
|
if (getAttribute(object, name) === undefined) {
|
|
@@ -5,7 +5,7 @@ import { types } from "./types.mjs";
|
|
|
5
5
|
*
|
|
6
6
|
* @property {string} name
|
|
7
7
|
* @property {object} type
|
|
8
|
-
* @property {boolean}
|
|
8
|
+
* @property {boolean} key
|
|
9
9
|
* @property {boolean} writable
|
|
10
10
|
* @property {boolean} mandatory
|
|
11
11
|
* @property {boolean} collection are we a collection (set, map, array, object)
|
|
@@ -41,7 +41,7 @@ export const default_attribute = {
|
|
|
41
41
|
persistent: false,
|
|
42
42
|
private: false,
|
|
43
43
|
credential: false,
|
|
44
|
-
|
|
44
|
+
key: false
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -101,7 +101,7 @@ export const string_set_attribute_writable = {
|
|
|
101
101
|
export const name_attribute = {
|
|
102
102
|
...default_attribute,
|
|
103
103
|
name: "name",
|
|
104
|
-
|
|
104
|
+
key: true
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -240,7 +240,7 @@ export const empty_attribute = { ...boolean_attribute, name: "empty" };
|
|
|
240
240
|
export const uuid_attribute = {
|
|
241
241
|
...default_attribute,
|
|
242
242
|
name: "uuid",
|
|
243
|
-
|
|
243
|
+
key: true
|
|
244
244
|
};
|
|
245
245
|
|
|
246
246
|
/**
|
|
@@ -400,7 +400,7 @@ export const port_attribute_writable = {
|
|
|
400
400
|
*/
|
|
401
401
|
export const id_attribute = {
|
|
402
402
|
...default_attribute,
|
|
403
|
-
|
|
403
|
+
key: true,
|
|
404
404
|
name: "id",
|
|
405
405
|
description: "identifier"
|
|
406
406
|
};
|
package/src/environment.mjs
CHANGED
package/src/types.mjs
CHANGED
|
@@ -201,11 +201,3 @@ export function resolveTypeLinks() {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
export function typeFactory(type, owner, data) {
|
|
205
|
-
const factory = type.factoryFor?.(owner, data) || type.clazz || type;
|
|
206
|
-
const object = new factory(owner);
|
|
207
|
-
|
|
208
|
-
object.read(data);
|
|
209
|
-
owner.addObject(object);
|
|
210
|
-
return object;
|
|
211
|
-
}
|
package/types/attributes.d.mts
CHANGED
|
@@ -25,5 +25,5 @@ export function writableAttributeIterator(definition: any): Generator<[string[],
|
|
|
25
25
|
export function toInternal(value: any, attribute: any): any;
|
|
26
26
|
export function toExternal(value: any, attribute: any): any;
|
|
27
27
|
export function mandatoryAttributesPresent(object: any, attributes: any): boolean;
|
|
28
|
-
export function filterWritable(
|
|
29
|
-
export function filterPublic(
|
|
28
|
+
export function filterWritable(attribute: any): any;
|
|
29
|
+
export function filterPublic(attribute: any): boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @property {string} name
|
|
5
5
|
* @property {object} type
|
|
6
|
-
* @property {boolean}
|
|
6
|
+
* @property {boolean} key
|
|
7
7
|
* @property {boolean} writable
|
|
8
8
|
* @property {boolean} mandatory
|
|
9
9
|
* @property {boolean} collection are we a collection (set, map, array, object)
|
|
@@ -115,7 +115,7 @@ export namespace yesno_attribute_writable {
|
|
|
115
115
|
export let writable: boolean;
|
|
116
116
|
export let name: string;
|
|
117
117
|
export let type: object;
|
|
118
|
-
export let
|
|
118
|
+
export let key: boolean;
|
|
119
119
|
export let mandatory: boolean;
|
|
120
120
|
export let collection: boolean;
|
|
121
121
|
export let owner: boolean;
|
|
@@ -271,7 +271,7 @@ export const language_attribute: AttributeDefinition;
|
|
|
271
271
|
export type AttributeDefinition = {
|
|
272
272
|
name: string;
|
|
273
273
|
type: object;
|
|
274
|
-
|
|
274
|
+
key: boolean;
|
|
275
275
|
writable: boolean;
|
|
276
276
|
mandatory: boolean;
|
|
277
277
|
/**
|
package/types/types.d.mts
CHANGED