pacc 3.13.1 → 4.0.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/README.md CHANGED
@@ -27,15 +27,10 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
27
27
 
28
28
  ### Table of Contents
29
29
 
30
- * [tokens](#tokens)
31
- * [tokens](#tokens-1)
30
+ * [prepareAttributesDefinitions](#prepareattributesdefinitions)
32
31
  * [Parameters](#parameters)
33
- * [setAttribute](#setattribute)
32
+ * [mergeAttributeDefinitions](#mergeattributedefinitions)
34
33
  * [Parameters](#parameters-1)
35
- * [getAttribute](#getattribute)
36
- * [Parameters](#parameters-2)
37
- * [getAttributeAndOperator](#getattributeandoperator)
38
- * [Parameters](#parameters-3)
39
34
  * [AttributeDefinition](#attributedefinition)
40
35
  * [Properties](#properties)
41
36
  * [default\_attribute](#default_attribute)
@@ -69,14 +64,19 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
69
64
  * [active\_attribute](#active_attribute)
70
65
  * [language\_attribute](#language_attribute)
71
66
  * [filter](#filter)
67
+ * [Parameters](#parameters-2)
68
+ * [setAttributes](#setattributes)
69
+ * [Parameters](#parameters-3)
70
+ * [getAttributes](#getattributes)
72
71
  * [Parameters](#parameters-4)
73
- * [prepareAttributesDefinitions](#prepareattributesdefinitions)
72
+ * [tokens](#tokens)
73
+ * [tokens](#tokens-1)
74
74
  * [Parameters](#parameters-5)
75
- * [mergeAttributeDefinitions](#mergeattributedefinitions)
75
+ * [setAttribute](#setattribute)
76
76
  * [Parameters](#parameters-6)
77
- * [setAttributes](#setattributes)
77
+ * [getAttribute](#getattribute)
78
78
  * [Parameters](#parameters-7)
79
- * [getAttributes](#getattributes)
79
+ * [getAttributeAndOperator](#getattributeandoperator)
80
80
  * [Parameters](#parameters-8)
81
81
  * [lookup](#lookup)
82
82
  * [Token](#token)
@@ -110,50 +110,27 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
110
110
  * [BAR](#bar)
111
111
  * [DOUBLE\_BAR](#double_bar)
112
112
 
113
- ## tokens
114
-
115
- ## tokens
116
-
117
- Split property path into tokens
118
-
119
- ### Parameters
120
-
121
- * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
122
-
123
- ## setAttribute
124
-
125
- Set object attribute.
126
- The name may be a property path like 'a.b.c'.
127
-
128
- ### Parameters
129
-
130
- * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
131
- * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
132
- * `value` **any** 
133
-
134
- ## getAttribute
113
+ ## prepareAttributesDefinitions
135
114
 
136
- Deliver attribute value.
137
- The name may be a property path like 'a.b.c' or a\[2]
115
+ Create attributes from its definition.
138
116
 
139
117
  ### Parameters
140
118
 
141
- * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
142
- * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
119
+ * `newDefinitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
120
+ * `presentDefinitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** optional merg in attributes
143
121
 
144
- Returns **any** value associated with the given property name
122
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attributes
145
123
 
146
- ## getAttributeAndOperator
124
+ ## mergeAttributeDefinitions
147
125
 
148
- Deliver attribute value and operator.
149
- The name may be a property path like 'a.b.c <='.
126
+ Merge attribute definitions.
150
127
 
151
128
  ### Parameters
152
129
 
153
- * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
154
- * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
130
+ * `dest` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute definitions to be used also the merge target
131
+ * `atts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** attribute definitions to be used
155
132
 
156
- Returns **\[any, [Token](#token)]** value associated with the given property name
133
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** merged definitions (dest)
157
134
 
158
135
  ## AttributeDefinition
159
136
 
@@ -318,28 +295,6 @@ Generate filter function.
318
295
 
319
296
  Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**&#x20;
320
297
 
321
- ## prepareAttributesDefinitions
322
-
323
- Create attributes from its definition.
324
-
325
- ### Parameters
326
-
327
- * `newDefinitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
328
- * `presentDefinitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** optional merg in attributes
329
-
330
- Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attributes
331
-
332
- ## mergeAttributeDefinitions
333
-
334
- Merge attribute definitions.
335
-
336
- ### Parameters
337
-
338
- * `dest` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute definitions to be used also the merge target
339
- * `atts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** attribute definitions to be used
340
-
341
- Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** merged definitions (dest)
342
-
343
298
  ## setAttributes
344
299
 
345
300
  Copies attribute values from a source object into a destination object.
@@ -363,6 +318,51 @@ Retrive attribute values from an object.
363
318
 
364
319
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
365
320
 
321
+ ## tokens
322
+
323
+ ## tokens
324
+
325
+ Split property path into tokens
326
+
327
+ ### Parameters
328
+
329
+ * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
330
+
331
+ ## setAttribute
332
+
333
+ Set object attribute.
334
+ The name may be a property path like 'a.b.c'.
335
+
336
+ ### Parameters
337
+
338
+ * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
339
+ * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
340
+ * `value` **any**&#x20;
341
+
342
+ ## getAttribute
343
+
344
+ Deliver attribute value.
345
+ The name may be a property path like 'a.b.c' or a\[2]
346
+
347
+ ### Parameters
348
+
349
+ * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
350
+ * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
351
+
352
+ Returns **any** value associated with the given property name
353
+
354
+ ## getAttributeAndOperator
355
+
356
+ Deliver attribute value and operator.
357
+ The name may be a property path like 'a.b.c <='.
358
+
359
+ ### Parameters
360
+
361
+ * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
362
+ * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
363
+
364
+ Returns **\[any, [Token](#token)]** value associated with the given property name
365
+
366
366
  ## lookup
367
367
 
368
368
  Token lookup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "3.13.1",
3
+ "version": "4.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -0,0 +1,52 @@
1
+ const types = {
2
+ base: { name: "base" },
3
+ string: { name: "string" },
4
+ number: { name: "number" },
5
+ integer: { name: "integer" },
6
+ "unsigned-integer": { name: "unsigned-integer" },
7
+ boolean: { name: "boolean" },
8
+ object: { name: "object" }
9
+ };
10
+
11
+ /**
12
+ * Create attributes from its definition.
13
+ * @param {Object} newDefinitions
14
+ * @param {Object|undefined} presentDefinitions optional merg in attributes
15
+ * @return {Object} attributes
16
+ */
17
+ export function prepareAttributesDefinitions(newDefinitions, presentDefinitions) {
18
+ for (const [name, d] of Object.entries(newDefinitions)) {
19
+ if (d.attributes === undefined) {
20
+ d.type = types[d.type] || types.base;
21
+ }
22
+ else {
23
+ prepareAttributesDefinitions(d.attributes);
24
+ }
25
+ }
26
+
27
+ return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
28
+ }
29
+
30
+ /**
31
+ * Merge attribute definitions.
32
+ * @param {Object} dest attribute definitions to be used also the merge target
33
+ * @param {Object?} atts attribute definitions to be used
34
+ * @return {Object} merged definitions (dest)
35
+ */
36
+ function mergeAttributeDefinitions(dest, atts) {
37
+ if (atts) {
38
+ for (const [name, ca] of Object.entries(atts)) {
39
+ if (ca.attributes !== undefined) {
40
+ const bn = dest[name];
41
+
42
+ if (bn !== undefined) {
43
+ Object.assign(ca.attributes, bn.attributes);
44
+ }
45
+ }
46
+ }
47
+
48
+ return Object.assign(dest, atts);
49
+ }
50
+
51
+ return dest;
52
+ }
@@ -41,7 +41,10 @@ export const name_attribute = {
41
41
  /**
42
42
  * @type {AttributeDefinition}
43
43
  */
44
- export const email_attribute = default_attribute;
44
+ export const email_attribute = {
45
+ ...default_attribute,
46
+ description: "email address"
47
+ };
45
48
 
46
49
  /**
47
50
  * The description of the object content.
@@ -56,7 +59,7 @@ export const description_attribute = {
56
59
  /**
57
60
  * @type {AttributeDefinition}
58
61
  */
59
- export const type_attribute = default_attribute;
62
+ export { default_attribute as type_attribute };
60
63
 
61
64
  /**
62
65
  * @type {AttributeDefinition}
@@ -69,22 +72,38 @@ export const state_attribute = {
69
72
  /**
70
73
  * @type {AttributeDefinition}
71
74
  */
72
- export const boolean_attribute = {
75
+ export const boolean_attribute_writeable_true = {
73
76
  ...default_attribute,
74
77
  type: "boolean",
75
78
  writable: true,
76
- default: false
79
+ default: true
77
80
  };
78
81
 
79
82
  /**
80
83
  * @type {AttributeDefinition}
81
84
  */
82
- export const boolean_read_only_attribute = {
85
+ export const boolean_attribute_writeable_false = {
83
86
  ...default_attribute,
84
87
  type: "boolean",
88
+ writable: true,
85
89
  default: false
86
90
  };
87
91
 
92
+ export { boolean_attribute_writeable_false as boolean_attribute };
93
+
94
+ /**
95
+ * @type {AttributeDefinition}
96
+ */
97
+ export const boolean_attribute_false = {
98
+ ...boolean_attribute_writeable_false,
99
+ writable: false
100
+ };
101
+
102
+ /**
103
+ * @type {AttributeDefinition}
104
+ */
105
+ export { boolean_attribute_writeable_true as active_attribute };
106
+
88
107
  /**
89
108
  * @type {AttributeDefinition}
90
109
  */
@@ -171,12 +190,12 @@ export const integer_attribute = { ...default_attribute, type: "integer" };
171
190
  /**
172
191
  * @type {AttributeDefinition}
173
192
  */
174
- export const count_attribute = integer_attribute;
193
+ export { integer_attribute as count_attribute };
175
194
 
176
195
  /**
177
196
  * @type {AttributeDefinition}
178
197
  */
179
- export const size_attribute = integer_attribute;
198
+ export { integer_attribute as size_attribute };
180
199
 
181
200
  /**
182
201
  * @type {AttributeDefinition}
@@ -204,7 +223,7 @@ export const port_attribute = {
204
223
  };
205
224
 
206
225
  /**
207
- * Unique id within the provider.
226
+ * Unique id within.
208
227
  * @type {AttributeDefinition}
209
228
  */
210
229
  export const id_attribute = {
@@ -214,7 +233,7 @@ export const id_attribute = {
214
233
  };
215
234
 
216
235
  /**
217
- * The body text of the pull request.
236
+ * The body text.
218
237
  * @type {AttributeDefinition}
219
238
  */
220
239
  export const body_attribute = {
@@ -223,7 +242,7 @@ export const body_attribute = {
223
242
  };
224
243
 
225
244
  /**
226
- * The one line description of the pull request.
245
+ * The one line description.
227
246
  * @type {AttributeDefinition}
228
247
  */
229
248
  export const title_attribute = {
@@ -254,16 +273,6 @@ export const timeout_attribute = {
254
273
  writable: true
255
274
  };
256
275
 
257
-
258
- /**
259
- * @type {AttributeDefinition}
260
- */
261
- export const active_attribute = {
262
- ...boolean_attribute,
263
- default: true,
264
- writable: true
265
- };
266
-
267
276
  /**
268
277
  * @type {AttributeDefinition}
269
278
  */
package/src/module.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./attributes.mjs";
4
5
  export * from "./common-attributes.mjs";
5
6
  export {
6
7
  setAttribute,
7
8
  getAttribute,
8
9
  getAttributeAndOperator
9
- } from "./attribute.mjs";
10
+ } from "./settergetter.mjs";
package/src/multiple.mjs CHANGED
@@ -1,57 +1,4 @@
1
- import { setAttribute, getAttribute } from "./attribute.mjs";
2
-
3
- const types = {
4
- base: { name: "base" },
5
- string: { name: "string" },
6
- number: { name: "number" },
7
- integer: { name: "integer" },
8
- "unsigned-integer": { name: "unsigned-integer" },
9
- boolean: { name: "boolean" },
10
- object: { name: "object" }
11
- };
12
-
13
- /**
14
- * Create attributes from its definition.
15
- * @param {Object} newDefinitions
16
- * @param {Object|undefined} presentDefinitions optional merg in attributes
17
- * @return {Object} attributes
18
- */
19
- export function prepareAttributesDefinitions(newDefinitions, presentDefinitions) {
20
- for (const [name, d] of Object.entries(newDefinitions)) {
21
- if (d.attributes === undefined) {
22
- d.type = types[d.type] || types.base;
23
- }
24
- else {
25
- prepareAttributesDefinitions(d.attributes);
26
- }
27
- }
28
-
29
- return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
30
- }
31
-
32
- /**
33
- * Merge attribute definitions.
34
- * @param {Object} dest attribute definitions to be used also the merge target
35
- * @param {Object?} atts attribute definitions to be used
36
- * @return {Object} merged definitions (dest)
37
- */
38
- function mergeAttributeDefinitions(dest, atts) {
39
- if (atts) {
40
- for (const [name, ca] of Object.entries(atts)) {
41
- if (ca.attributes !== undefined) {
42
- const bn = dest[name];
43
-
44
- if (bn !== undefined) {
45
- Object.assign(ca.attributes, bn.attributes);
46
- }
47
- }
48
- }
49
-
50
- return Object.assign(dest, atts);
51
- }
52
-
53
- return dest;
54
- }
1
+ import { setAttribute, getAttribute } from "./settergetter.mjs";
55
2
 
56
3
  /**
57
4
  * Copies attribute values from a source object into a destination object.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Create attributes from its definition.
3
+ * @param {Object} newDefinitions
4
+ * @param {Object|undefined} presentDefinitions optional merg in attributes
5
+ * @return {Object} attributes
6
+ */
7
+ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any | undefined): any;
@@ -36,19 +36,19 @@ export const description_attribute: AttributeDefinition;
36
36
  /**
37
37
  * @type {AttributeDefinition}
38
38
  */
39
- export const type_attribute: AttributeDefinition;
39
+ export const state_attribute: AttributeDefinition;
40
40
  /**
41
41
  * @type {AttributeDefinition}
42
42
  */
43
- export const state_attribute: AttributeDefinition;
43
+ export const boolean_attribute_writeable_true: AttributeDefinition;
44
44
  /**
45
45
  * @type {AttributeDefinition}
46
46
  */
47
- export const boolean_attribute: AttributeDefinition;
47
+ export const boolean_attribute_writeable_false: AttributeDefinition;
48
48
  /**
49
49
  * @type {AttributeDefinition}
50
50
  */
51
- export const boolean_read_only_attribute: AttributeDefinition;
51
+ export const boolean_attribute_false: AttributeDefinition;
52
52
  /**
53
53
  * @type {AttributeDefinition}
54
54
  */
@@ -89,14 +89,6 @@ export const public_key_attribute: AttributeDefinition;
89
89
  * @type {AttributeDefinition}
90
90
  */
91
91
  export const integer_attribute: AttributeDefinition;
92
- /**
93
- * @type {AttributeDefinition}
94
- */
95
- export const count_attribute: AttributeDefinition;
96
- /**
97
- * @type {AttributeDefinition}
98
- */
99
- export const size_attribute: AttributeDefinition;
100
92
  /**
101
93
  * @type {AttributeDefinition}
102
94
  */
@@ -110,17 +102,17 @@ export const hostname_attribute: AttributeDefinition;
110
102
  */
111
103
  export const port_attribute: AttributeDefinition;
112
104
  /**
113
- * Unique id within the provider.
105
+ * Unique id within.
114
106
  * @type {AttributeDefinition}
115
107
  */
116
108
  export const id_attribute: AttributeDefinition;
117
109
  /**
118
- * The body text of the pull request.
110
+ * The body text.
119
111
  * @type {AttributeDefinition}
120
112
  */
121
113
  export const body_attribute: AttributeDefinition;
122
114
  /**
123
- * The one line description of the pull request.
115
+ * The one line description.
124
116
  * @type {AttributeDefinition}
125
117
  */
126
118
  export const title_attribute: AttributeDefinition;
@@ -134,10 +126,6 @@ export const priority_attribute: AttributeDefinition;
134
126
  * @type {AttributeDefinition}
135
127
  */
136
128
  export const timeout_attribute: AttributeDefinition;
137
- /**
138
- * @type {AttributeDefinition}
139
- */
140
- export const active_attribute: AttributeDefinition;
141
129
  /**
142
130
  * @type {AttributeDefinition}
143
131
  */
@@ -181,3 +169,4 @@ export type AttributeDefinition = {
181
169
  */
182
170
  env?: string[] | string;
183
171
  };
172
+ export { default_attribute as type_attribute, boolean_attribute_writeable_false as boolean_attribute, boolean_attribute_writeable_true as active_attribute, integer_attribute as count_attribute, integer_attribute as size_attribute };
@@ -1,5 +1,6 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./attributes.mjs";
4
5
  export * from "./common-attributes.mjs";
5
- export { setAttribute, getAttribute, getAttributeAndOperator } from "./attribute.mjs";
6
+ export { setAttribute, getAttribute, getAttributeAndOperator } from "./settergetter.mjs";
@@ -1,10 +1,3 @@
1
- /**
2
- * Create attributes from its definition.
3
- * @param {Object} newDefinitions
4
- * @param {Object|undefined} presentDefinitions optional merg in attributes
5
- * @return {Object} attributes
6
- */
7
- export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any | undefined): any;
8
1
  /**
9
2
  * Copies attribute values from a source object into a destination object.
10
3
  * @param {Object} object target object to be modified
File without changes
File without changes