pacc 3.7.0 → 3.9.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 +120 -13
- package/package.json +1 -1
- package/src/common-attributes.mjs +188 -0
- package/src/module.mjs +1 -0
- package/src/multiple.mjs +20 -28
- package/types/common-attributes.d.mts +141 -0
- package/types/module.d.mts +1 -0
- package/types/multiple.d.mts +5 -42
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)?** 
|
|
135
|
-
|
|
136
|
-
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 
|
|
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)** 
|
|
145
153
|
* `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
146
154
|
* `isKey` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
147
155
|
* `writable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
@@ -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)?** 
|
|
262
|
+
|
|
263
|
+
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 
|
|
264
|
+
|
|
158
265
|
## prepareAttributesDefinitions
|
|
159
266
|
|
|
160
267
|
Create attributes from its definition.
|
package/package.json
CHANGED
|
@@ -0,0 +1,188 @@
|
|
|
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 token_attribute = {
|
|
107
|
+
...default_attribute,
|
|
108
|
+
private: true,
|
|
109
|
+
writable: true
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @type {AttributeDefinition}
|
|
114
|
+
*/
|
|
115
|
+
export const count_attribute = { ...default_attribute, type: "integer" };
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @type {AttributeDefinition}
|
|
119
|
+
*/
|
|
120
|
+
export const size_attribute = { ...default_attribute, type: "integer" };
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @type {AttributeDefinition}
|
|
124
|
+
*/
|
|
125
|
+
export const url_attribute = {
|
|
126
|
+
...default_attribute,
|
|
127
|
+
type: "url",
|
|
128
|
+
description: "home of the object"
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Unique id within the provider.
|
|
133
|
+
* @type {AttributeDefinition}
|
|
134
|
+
*/
|
|
135
|
+
export const id_attribute = {
|
|
136
|
+
...default_attribute,
|
|
137
|
+
isKey: true,
|
|
138
|
+
description: "internal identifier"
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The body text of the pull request.
|
|
143
|
+
* @type {AttributeDefinition}
|
|
144
|
+
*/
|
|
145
|
+
export const body_attribute = {
|
|
146
|
+
...default_attribute,
|
|
147
|
+
writable: true
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The one line description of the pull request.
|
|
152
|
+
* @type {AttributeDefinition}
|
|
153
|
+
*/
|
|
154
|
+
export const title_attribute = {
|
|
155
|
+
...default_attribute,
|
|
156
|
+
description: "human readable title",
|
|
157
|
+
writable: true
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* In case there are several providers able to support a given source which one sould be used ?
|
|
162
|
+
* this defines the order.
|
|
163
|
+
* @type {AttributeDefinition}
|
|
164
|
+
*/
|
|
165
|
+
export const priority_attribute = {
|
|
166
|
+
...default_attribute,
|
|
167
|
+
type: "number",
|
|
168
|
+
default: 0,
|
|
169
|
+
writable: true
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @type {AttributeDefinition}
|
|
174
|
+
*/
|
|
175
|
+
export const active_attribute = {
|
|
176
|
+
...default_attribute,
|
|
177
|
+
type: "boolean",
|
|
178
|
+
default: true,
|
|
179
|
+
writable: true
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @type {AttributeDefinition}
|
|
184
|
+
*/
|
|
185
|
+
export const language_attribute = {
|
|
186
|
+
...default_attribute,
|
|
187
|
+
description: "human spoken language"
|
|
188
|
+
};
|
package/src/module.mjs
CHANGED
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" },
|
|
@@ -29,36 +12,45 @@ const types = {
|
|
|
29
12
|
|
|
30
13
|
/**
|
|
31
14
|
* Create attributes from its definition.
|
|
32
|
-
* @param {Object}
|
|
15
|
+
* @param {Object} newDefinitions
|
|
16
|
+
* @param {Object?} baseDefinitions optional merg in attributes
|
|
33
17
|
* @return {Object} attributes
|
|
34
18
|
*/
|
|
35
|
-
export function prepareAttributesDefinitions(
|
|
36
|
-
for (const [name, d] of Object.entries(
|
|
19
|
+
export function prepareAttributesDefinitions(newDefinitions, presentDefinitions) {
|
|
20
|
+
for (const [name, d] of Object.entries(newDefinitions)) {
|
|
37
21
|
if (d.attributes === undefined) {
|
|
38
22
|
d.type = types[d.type] || types.base;
|
|
39
23
|
}
|
|
24
|
+
else {
|
|
25
|
+
prepareAttributesDefinitions(d.attributes);
|
|
26
|
+
}
|
|
40
27
|
}
|
|
41
|
-
|
|
28
|
+
|
|
29
|
+
return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
|
|
42
30
|
}
|
|
43
31
|
|
|
44
32
|
/**
|
|
45
33
|
* Merge attribute definitions.
|
|
46
34
|
* @param {Object} dest attribute definitions to be used also the merge target
|
|
47
|
-
* @param {Object} atts attribute definitions to be used
|
|
35
|
+
* @param {Object?} atts attribute definitions to be used
|
|
48
36
|
* @return {Object} merged definitions (dest)
|
|
49
37
|
*/
|
|
50
38
|
export function mergeAttributeDefinitions(dest, atts) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
if (atts) {
|
|
40
|
+
for (const [name, ca] of Object.entries(atts)) {
|
|
41
|
+
if (ca.attributes !== undefined) {
|
|
42
|
+
const bn = dest[name];
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
if (bn !== undefined) {
|
|
45
|
+
Object.assign(ca.attributes, bn.attributes);
|
|
46
|
+
}
|
|
57
47
|
}
|
|
58
48
|
}
|
|
49
|
+
|
|
50
|
+
return Object.assign(dest, atts);
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
return
|
|
53
|
+
return dest;
|
|
62
54
|
}
|
|
63
55
|
|
|
64
56
|
/**
|
|
@@ -0,0 +1,141 @@
|
|
|
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 token_attribute: AttributeDefinition;
|
|
63
|
+
/**
|
|
64
|
+
* @type {AttributeDefinition}
|
|
65
|
+
*/
|
|
66
|
+
export const count_attribute: AttributeDefinition;
|
|
67
|
+
/**
|
|
68
|
+
* @type {AttributeDefinition}
|
|
69
|
+
*/
|
|
70
|
+
export const size_attribute: AttributeDefinition;
|
|
71
|
+
/**
|
|
72
|
+
* @type {AttributeDefinition}
|
|
73
|
+
*/
|
|
74
|
+
export const url_attribute: AttributeDefinition;
|
|
75
|
+
/**
|
|
76
|
+
* Unique id within the provider.
|
|
77
|
+
* @type {AttributeDefinition}
|
|
78
|
+
*/
|
|
79
|
+
export const id_attribute: AttributeDefinition;
|
|
80
|
+
/**
|
|
81
|
+
* The body text of the pull request.
|
|
82
|
+
* @type {AttributeDefinition}
|
|
83
|
+
*/
|
|
84
|
+
export const body_attribute: AttributeDefinition;
|
|
85
|
+
/**
|
|
86
|
+
* The one line description of the pull request.
|
|
87
|
+
* @type {AttributeDefinition}
|
|
88
|
+
*/
|
|
89
|
+
export const title_attribute: AttributeDefinition;
|
|
90
|
+
/**
|
|
91
|
+
* In case there are several providers able to support a given source which one sould be used ?
|
|
92
|
+
* this defines the order.
|
|
93
|
+
* @type {AttributeDefinition}
|
|
94
|
+
*/
|
|
95
|
+
export const priority_attribute: AttributeDefinition;
|
|
96
|
+
/**
|
|
97
|
+
* @type {AttributeDefinition}
|
|
98
|
+
*/
|
|
99
|
+
export const active_attribute: AttributeDefinition;
|
|
100
|
+
/**
|
|
101
|
+
* @type {AttributeDefinition}
|
|
102
|
+
*/
|
|
103
|
+
export const language_attribute: AttributeDefinition;
|
|
104
|
+
export type AttributeDefinition = {
|
|
105
|
+
type: string;
|
|
106
|
+
isKey: boolean;
|
|
107
|
+
writable: boolean;
|
|
108
|
+
mandatory: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* should the value be shown
|
|
111
|
+
*/
|
|
112
|
+
private?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* name of an attribute we depend on
|
|
115
|
+
*/
|
|
116
|
+
depends?: string;
|
|
117
|
+
/**
|
|
118
|
+
* extra attributes that are present in case our attribute is set
|
|
119
|
+
*/
|
|
120
|
+
additionalAttributes: string[];
|
|
121
|
+
/**
|
|
122
|
+
* human readable
|
|
123
|
+
*/
|
|
124
|
+
description?: string;
|
|
125
|
+
/**
|
|
126
|
+
* the default value
|
|
127
|
+
*/
|
|
128
|
+
default?: any;
|
|
129
|
+
/**
|
|
130
|
+
* set the value
|
|
131
|
+
*/
|
|
132
|
+
set?: Function;
|
|
133
|
+
/**
|
|
134
|
+
* get the value can be used to calculate default values
|
|
135
|
+
*/
|
|
136
|
+
get?: Function;
|
|
137
|
+
/**
|
|
138
|
+
* environment variable(s) used to provide the value
|
|
139
|
+
*/
|
|
140
|
+
env?: string[] | string;
|
|
141
|
+
};
|
package/types/module.d.mts
CHANGED
package/types/multiple.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create attributes from its definition.
|
|
3
|
-
* @param {Object}
|
|
3
|
+
* @param {Object} newDefinitions
|
|
4
|
+
* @param {Object?} baseDefinitions optional merg in attributes
|
|
4
5
|
* @return {Object} attributes
|
|
5
6
|
*/
|
|
6
|
-
export function prepareAttributesDefinitions(
|
|
7
|
+
export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any): any;
|
|
7
8
|
/**
|
|
8
9
|
* Merge attribute definitions.
|
|
9
10
|
* @param {Object} dest attribute definitions to be used also the merge target
|
|
10
|
-
* @param {Object} atts attribute definitions to be used
|
|
11
|
+
* @param {Object?} atts attribute definitions to be used
|
|
11
12
|
* @return {Object} merged definitions (dest)
|
|
12
13
|
*/
|
|
13
|
-
export function mergeAttributeDefinitions(dest: any, atts: any): any;
|
|
14
|
+
export function mergeAttributeDefinitions(dest: any, atts: any | null): any;
|
|
14
15
|
/**
|
|
15
16
|
* Copies attribute values from a source object into a destination object.
|
|
16
17
|
* @param {Object} object target object to be modified
|
|
@@ -27,41 +28,3 @@ export function setAttributes(object: any, source: any, definitions: any, cb: Fu
|
|
|
27
28
|
* @return {Object} values
|
|
28
29
|
*/
|
|
29
30
|
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
|
-
};
|