pacc 3.7.0 → 3.8.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
@@ -36,10 +36,29 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
36
36
  * [Parameters](#parameters-2)
37
37
  * [getAttributeAndOperator](#getattributeandoperator)
38
38
  * [Parameters](#parameters-3)
39
- * [filter](#filter)
40
- * [Parameters](#parameters-4)
41
39
  * [AttributeDefinition](#attributedefinition)
42
40
  * [Properties](#properties)
41
+ * [default\_attribute](#default_attribute)
42
+ * [name\_attribute](#name_attribute)
43
+ * [description\_attribute](#description_attribute)
44
+ * [type\_attribute](#type_attribute)
45
+ * [state\_attribute](#state_attribute)
46
+ * [boolean\_attribute](#boolean_attribute)
47
+ * [boolean\_read\_only\_attribute](#boolean_read_only_attribute)
48
+ * [uuid\_attribute](#uuid_attribute)
49
+ * [empty\_attribute](#empty_attribute)
50
+ * [secret\_attribute](#secret_attribute)
51
+ * [count\_attribute](#count_attribute)
52
+ * [size\_attribute](#size_attribute)
53
+ * [url\_attribute](#url_attribute)
54
+ * [id\_attribute](#id_attribute)
55
+ * [body\_attribute](#body_attribute)
56
+ * [title\_attribute](#title_attribute)
57
+ * [priority\_attribute](#priority_attribute)
58
+ * [active\_attribute](#active_attribute)
59
+ * [language\_attribute](#language_attribute)
60
+ * [filter](#filter)
61
+ * [Parameters](#parameters-4)
43
62
  * [prepareAttributesDefinitions](#prepareattributesdefinitions)
44
63
  * [Parameters](#parameters-5)
45
64
  * [mergeAttributeDefinitions](#mergeattributedefinitions)
@@ -125,23 +144,12 @@ The name may be a property path like 'a.b.c <='.
125
144
 
126
145
  Returns **\[any, [Token](#token)]** value associated with the given property name
127
146
 
128
- ## filter
129
-
130
- Generate filter function.
131
-
132
- ### Parameters
133
-
134
- * `filterBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
135
-
136
- Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**&#x20;
137
-
138
147
  ## AttributeDefinition
139
148
 
140
149
  Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
141
150
 
142
151
  ### Properties
143
152
 
144
- * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
145
153
  * `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
146
154
  * `isKey` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
147
155
  * `writable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
@@ -155,6 +163,105 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
155
163
  * `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
156
164
  * `env` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))?** environment variable(s) used to provide the value
157
165
 
166
+ ## default\_attribute
167
+
168
+ Common attribute properties.
169
+
170
+ Type: [AttributeDefinition](#attributedefinition)
171
+
172
+ ## name\_attribute
173
+
174
+ Type: [AttributeDefinition](#attributedefinition)
175
+
176
+ ## description\_attribute
177
+
178
+ The description of the object content.
179
+
180
+ Type: [AttributeDefinition](#attributedefinition)
181
+
182
+ ## type\_attribute
183
+
184
+ Type: [AttributeDefinition](#attributedefinition)
185
+
186
+ ## state\_attribute
187
+
188
+ Type: [AttributeDefinition](#attributedefinition)
189
+
190
+ ## boolean\_attribute
191
+
192
+ Type: [AttributeDefinition](#attributedefinition)
193
+
194
+ ## boolean\_read\_only\_attribute
195
+
196
+ Type: [AttributeDefinition](#attributedefinition)
197
+
198
+ ## uuid\_attribute
199
+
200
+ Type: [AttributeDefinition](#attributedefinition)
201
+
202
+ ## empty\_attribute
203
+
204
+ Type: [AttributeDefinition](#attributedefinition)
205
+
206
+ ## secret\_attribute
207
+
208
+ Type: [AttributeDefinition](#attributedefinition)
209
+
210
+ ## count\_attribute
211
+
212
+ Type: [AttributeDefinition](#attributedefinition)
213
+
214
+ ## size\_attribute
215
+
216
+ Type: [AttributeDefinition](#attributedefinition)
217
+
218
+ ## url\_attribute
219
+
220
+ Type: [AttributeDefinition](#attributedefinition)
221
+
222
+ ## id\_attribute
223
+
224
+ Unique id within the provider.
225
+
226
+ Type: [AttributeDefinition](#attributedefinition)
227
+
228
+ ## body\_attribute
229
+
230
+ The body text of the pull request.
231
+
232
+ Type: [AttributeDefinition](#attributedefinition)
233
+
234
+ ## title\_attribute
235
+
236
+ The one line description of the pull request.
237
+
238
+ Type: [AttributeDefinition](#attributedefinition)
239
+
240
+ ## priority\_attribute
241
+
242
+ In case there are several providers able to support a given source which one sould be used ?
243
+ this defines the order.
244
+
245
+ Type: [AttributeDefinition](#attributedefinition)
246
+
247
+ ## active\_attribute
248
+
249
+ Type: [AttributeDefinition](#attributedefinition)
250
+
251
+ ## language\_attribute
252
+
253
+ Type: [AttributeDefinition](#attributedefinition)
254
+
255
+ ## filter
256
+
257
+ Generate filter function.
258
+
259
+ ### Parameters
260
+
261
+ * `filterBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
262
+
263
+ Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**&#x20;
264
+
158
265
  ## prepareAttributesDefinitions
159
266
 
160
267
  Create attributes from its definition.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @typedef {Object} AttributeDefinition
3
+ *
4
+ * @property {string} type
5
+ * @property {boolean} isKey
6
+ * @property {boolean} writable
7
+ * @property {boolean} mandatory
8
+ * @property {boolean} [private] should the value be shown
9
+ * @property {string} [depends] name of an attribute we depend on
10
+ * @property {string[]} additionalAttributes extra attributes that are present in case our attribute is set
11
+ * @property {string} [description] human readable
12
+ * @property {any} [default] the default value
13
+ * @property {Function} [set] set the value
14
+ * @property {Function} [get] get the value can be used to calculate default values
15
+ * @property {string[]|string} [env] environment variable(s) used to provide the value
16
+ */
17
+
18
+ /**
19
+ * Common attribute properties.
20
+ * @type {AttributeDefinition}
21
+ */
22
+ export const default_attribute = {
23
+ type: "string",
24
+ writable: false,
25
+ mandatory: false,
26
+ private: false,
27
+ isKey: false,
28
+ additionalAttributes: []
29
+ };
30
+
31
+ /**
32
+ * @type {AttributeDefinition}
33
+ */
34
+ export const name_attribute = {
35
+ ...default_attribute,
36
+ isKey: true
37
+ };
38
+
39
+ /**
40
+ * The description of the object content.
41
+ * @type {AttributeDefinition}
42
+ */
43
+ export const description_attribute = {
44
+ ...default_attribute,
45
+ description: "human readable description",
46
+ writable: true
47
+ };
48
+
49
+ /**
50
+ * @type {AttributeDefinition}
51
+ */
52
+ export const type_attribute = default_attribute;
53
+
54
+ /**
55
+ * @type {AttributeDefinition}
56
+ */
57
+ export const state_attribute = {
58
+ ...default_attribute,
59
+ writable: true
60
+ };
61
+
62
+ /**
63
+ * @type {AttributeDefinition}
64
+ */
65
+ export const boolean_attribute = {
66
+ ...default_attribute,
67
+ type: "boolean",
68
+ writable: true,
69
+ default: false
70
+ };
71
+
72
+ /**
73
+ * @type {AttributeDefinition}
74
+ */
75
+ export const boolean_read_only_attribute = {
76
+ ...default_attribute,
77
+ type: "boolean",
78
+ default: false
79
+ };
80
+
81
+ /**
82
+ * @type {AttributeDefinition}
83
+ */
84
+ export const uuid_attribute = {
85
+ ...default_attribute,
86
+ isKey: true
87
+ };
88
+
89
+ /**
90
+ * @type {AttributeDefinition}
91
+ */
92
+ export const empty_attribute = { ...default_attribute, type: "boolean" };
93
+
94
+ /**
95
+ * @type {AttributeDefinition}
96
+ */
97
+ export const secret_attribute = {
98
+ ...default_attribute,
99
+ private: true,
100
+ writable: true
101
+ };
102
+
103
+ /**
104
+ * @type {AttributeDefinition}
105
+ */
106
+ export const count_attribute = { ...default_attribute, type: "integer" };
107
+
108
+ /**
109
+ * @type {AttributeDefinition}
110
+ */
111
+ export const size_attribute = { ...default_attribute, type: "integer" };
112
+
113
+ /**
114
+ * @type {AttributeDefinition}
115
+ */
116
+ export const url_attribute = {
117
+ ...default_attribute,
118
+ type: "url",
119
+ description: "home of the object"
120
+ };
121
+
122
+ /**
123
+ * Unique id within the provider.
124
+ * @type {AttributeDefinition}
125
+ */
126
+ export const id_attribute = {
127
+ ...default_attribute,
128
+ isKey: true,
129
+ description: "internal identifier"
130
+ };
131
+
132
+ /**
133
+ * The body text of the pull request.
134
+ * @type {AttributeDefinition}
135
+ */
136
+ export const body_attribute = {
137
+ ...default_attribute,
138
+ writable: true
139
+ };
140
+
141
+ /**
142
+ * The one line description of the pull request.
143
+ * @type {AttributeDefinition}
144
+ */
145
+ export const title_attribute = {
146
+ ...default_attribute,
147
+ description: "human readable title",
148
+ writable: true
149
+ };
150
+
151
+ /**
152
+ * In case there are several providers able to support a given source which one sould be used ?
153
+ * this defines the order.
154
+ * @type {AttributeDefinition}
155
+ */
156
+ export const priority_attribute = {
157
+ ...default_attribute,
158
+ type: "number",
159
+ default: 0,
160
+ writable: true
161
+ };
162
+
163
+ /**
164
+ * @type {AttributeDefinition}
165
+ */
166
+ export const active_attribute = {
167
+ ...default_attribute,
168
+ type: "boolean",
169
+ default: true,
170
+ writable: true
171
+ };
172
+
173
+ /**
174
+ * @type {AttributeDefinition}
175
+ */
176
+ export const language_attribute = {
177
+ ...default_attribute,
178
+ description: "human spoken language"
179
+ };
package/src/module.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./common-attributes.mjs";
4
5
  export {
5
6
  setAttribute,
6
7
  getAttribute,
package/src/multiple.mjs CHANGED
@@ -1,22 +1,5 @@
1
1
  import { setAttribute, getAttribute } from "./attribute.mjs";
2
2
 
3
- /**
4
- * @typedef {Object} AttributeDefinition
5
- *
6
- * @property {string} type
7
- * @property {boolean} isKey
8
- * @property {boolean} writable
9
- * @property {boolean} mandatory
10
- * @property {boolean} [private] should the value be shown
11
- * @property {string} [depends] name of an attribute we depend on
12
- * @property {string[]} additionalAttributes extra attributes that are present in case our attribute is set
13
- * @property {string} [description] human readable
14
- * @property {any} [default] the default value
15
- * @property {Function} [set] set the value
16
- * @property {Function} [get] get the value can be used to calculate default values
17
- * @property {string[]|string} [env] environment variable(s) used to provide the value
18
- */
19
-
20
3
  const types = {
21
4
  base: { name: "base" },
22
5
  string: { name: "string" },
@@ -0,0 +1,137 @@
1
+ /**
2
+ * @typedef {Object} AttributeDefinition
3
+ *
4
+ * @property {string} type
5
+ * @property {boolean} isKey
6
+ * @property {boolean} writable
7
+ * @property {boolean} mandatory
8
+ * @property {boolean} [private] should the value be shown
9
+ * @property {string} [depends] name of an attribute we depend on
10
+ * @property {string[]} additionalAttributes extra attributes that are present in case our attribute is set
11
+ * @property {string} [description] human readable
12
+ * @property {any} [default] the default value
13
+ * @property {Function} [set] set the value
14
+ * @property {Function} [get] get the value can be used to calculate default values
15
+ * @property {string[]|string} [env] environment variable(s) used to provide the value
16
+ */
17
+ /**
18
+ * Common attribute properties.
19
+ * @type {AttributeDefinition}
20
+ */
21
+ export const default_attribute: AttributeDefinition;
22
+ /**
23
+ * @type {AttributeDefinition}
24
+ */
25
+ export const name_attribute: AttributeDefinition;
26
+ /**
27
+ * The description of the object content.
28
+ * @type {AttributeDefinition}
29
+ */
30
+ export const description_attribute: AttributeDefinition;
31
+ /**
32
+ * @type {AttributeDefinition}
33
+ */
34
+ export const type_attribute: AttributeDefinition;
35
+ /**
36
+ * @type {AttributeDefinition}
37
+ */
38
+ export const state_attribute: AttributeDefinition;
39
+ /**
40
+ * @type {AttributeDefinition}
41
+ */
42
+ export const boolean_attribute: AttributeDefinition;
43
+ /**
44
+ * @type {AttributeDefinition}
45
+ */
46
+ export const boolean_read_only_attribute: AttributeDefinition;
47
+ /**
48
+ * @type {AttributeDefinition}
49
+ */
50
+ export const uuid_attribute: AttributeDefinition;
51
+ /**
52
+ * @type {AttributeDefinition}
53
+ */
54
+ export const empty_attribute: AttributeDefinition;
55
+ /**
56
+ * @type {AttributeDefinition}
57
+ */
58
+ export const secret_attribute: AttributeDefinition;
59
+ /**
60
+ * @type {AttributeDefinition}
61
+ */
62
+ export const count_attribute: AttributeDefinition;
63
+ /**
64
+ * @type {AttributeDefinition}
65
+ */
66
+ export const size_attribute: AttributeDefinition;
67
+ /**
68
+ * @type {AttributeDefinition}
69
+ */
70
+ export const url_attribute: AttributeDefinition;
71
+ /**
72
+ * Unique id within the provider.
73
+ * @type {AttributeDefinition}
74
+ */
75
+ export const id_attribute: AttributeDefinition;
76
+ /**
77
+ * The body text of the pull request.
78
+ * @type {AttributeDefinition}
79
+ */
80
+ export const body_attribute: AttributeDefinition;
81
+ /**
82
+ * The one line description of the pull request.
83
+ * @type {AttributeDefinition}
84
+ */
85
+ export const title_attribute: AttributeDefinition;
86
+ /**
87
+ * In case there are several providers able to support a given source which one sould be used ?
88
+ * this defines the order.
89
+ * @type {AttributeDefinition}
90
+ */
91
+ export const priority_attribute: AttributeDefinition;
92
+ /**
93
+ * @type {AttributeDefinition}
94
+ */
95
+ export const active_attribute: AttributeDefinition;
96
+ /**
97
+ * @type {AttributeDefinition}
98
+ */
99
+ export const language_attribute: AttributeDefinition;
100
+ export type AttributeDefinition = {
101
+ type: string;
102
+ isKey: boolean;
103
+ writable: boolean;
104
+ mandatory: boolean;
105
+ /**
106
+ * should the value be shown
107
+ */
108
+ private?: boolean;
109
+ /**
110
+ * name of an attribute we depend on
111
+ */
112
+ depends?: string;
113
+ /**
114
+ * extra attributes that are present in case our attribute is set
115
+ */
116
+ additionalAttributes: string[];
117
+ /**
118
+ * human readable
119
+ */
120
+ description?: string;
121
+ /**
122
+ * the default value
123
+ */
124
+ default?: any;
125
+ /**
126
+ * set the value
127
+ */
128
+ set?: Function;
129
+ /**
130
+ * get the value can be used to calculate default values
131
+ */
132
+ get?: Function;
133
+ /**
134
+ * environment variable(s) used to provide the value
135
+ */
136
+ env?: string[] | string;
137
+ };
@@ -1,4 +1,5 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./common-attributes.mjs";
4
5
  export { setAttribute, getAttribute, getAttributeAndOperator } from "./attribute.mjs";
@@ -27,41 +27,3 @@ export function setAttributes(object: any, source: any, definitions: any, cb: Fu
27
27
  * @return {Object} values
28
28
  */
29
29
  export function getAttributes(object: any, definitions: any): any;
30
- export type AttributeDefinition = {
31
- type: string;
32
- isKey: boolean;
33
- writable: boolean;
34
- mandatory: boolean;
35
- /**
36
- * should the value be shown
37
- */
38
- private?: boolean;
39
- /**
40
- * name of an attribute we depend on
41
- */
42
- depends?: string;
43
- /**
44
- * extra attributes that are present in case our attribute is set
45
- */
46
- additionalAttributes: string[];
47
- /**
48
- * human readable
49
- */
50
- description?: string;
51
- /**
52
- * the default value
53
- */
54
- default?: any;
55
- /**
56
- * set the value
57
- */
58
- set?: Function;
59
- /**
60
- * get the value can be used to calculate default values
61
- */
62
- get?: Function;
63
- /**
64
- * environment variable(s) used to provide the value
65
- */
66
- env?: string[] | string;
67
- };