pacc 4.28.0 → 4.29.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/package.json
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* @property {any} [default] the default value
|
|
13
13
|
* @property {Function} [set] set the value
|
|
14
14
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
15
|
+
* @property {Set<any>} [values] allowed values
|
|
16
|
+
* @property {string} [externalName] attrubute name used by external system
|
|
15
17
|
* @property {string[]|string} [env] environment variable(s) used to provide the value
|
|
16
18
|
*/
|
|
17
19
|
|
package/src/properties.mjs
CHANGED
|
@@ -12,8 +12,9 @@ export function definePropertiesFromAttributes(
|
|
|
12
12
|
|
|
13
13
|
for (const [path, attribute] of attributeIterator(attributes)) {
|
|
14
14
|
const name = path.join(".");
|
|
15
|
+
const externalName = attribute.externalName ?? name;
|
|
15
16
|
|
|
16
|
-
let value = getAttribute(initialValues,
|
|
17
|
+
let value = getAttribute(initialValues, externalName, attribute) ?? initialValues?.[externalName] ?? attribute.default;
|
|
17
18
|
|
|
18
19
|
if (value !== undefined) {
|
|
19
20
|
if (path.length === 1) {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* @property {any} [default] the default value
|
|
13
13
|
* @property {Function} [set] set the value
|
|
14
14
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
15
|
+
* @property {Set<any>} [values] allowed values
|
|
16
|
+
* @property {string} [externalName] attrubute name used by external system
|
|
15
17
|
* @property {string[]|string} [env] environment variable(s) used to provide the value
|
|
16
18
|
*/
|
|
17
19
|
/**
|
|
@@ -37,6 +39,8 @@ export namespace string_collection_attribute {
|
|
|
37
39
|
export { _default as default };
|
|
38
40
|
export let set: Function;
|
|
39
41
|
export let get: Function;
|
|
42
|
+
export let values: Set<any>;
|
|
43
|
+
export let externalName: string;
|
|
40
44
|
export let env: string[] | string;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
@@ -190,6 +194,14 @@ export type AttributeDefinition = {
|
|
|
190
194
|
* get the value can be used to calculate default values
|
|
191
195
|
*/
|
|
192
196
|
get?: Function;
|
|
197
|
+
/**
|
|
198
|
+
* allowed values
|
|
199
|
+
*/
|
|
200
|
+
values?: Set<any>;
|
|
201
|
+
/**
|
|
202
|
+
* attrubute name used by external system
|
|
203
|
+
*/
|
|
204
|
+
externalName?: string;
|
|
193
205
|
/**
|
|
194
206
|
* environment variable(s) used to provide the value
|
|
195
207
|
*/
|