pacc 6.6.1 → 6.6.3
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 +2 -2
- package/package.json +2 -2
- package/src/bytes.mjs +1 -1
- package/src/common-attributes.mjs +2 -2
- package/src/expand.mjs +2 -2
- package/src/types.mjs +7 -6
- package/types/common-attributes.d.mts +4 -4
- package/types/expand.d.mts +2 -2
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
204
204
|
* `collection` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
205
205
|
* `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should the value be shown
|
|
206
206
|
* `credential` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** any type of credential
|
|
207
|
-
* `persistent` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should we be stored
|
|
207
|
+
* `persistent` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should we be stored (especially critical for credentials)
|
|
208
208
|
* `depends` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of an attribute we depend on
|
|
209
209
|
* `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** human readable
|
|
210
210
|
* `default` **any?** the default value
|
|
@@ -212,7 +212,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
212
212
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
213
213
|
* `prepareValue` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
214
214
|
* `values` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\<any>?** allowed values
|
|
215
|
-
* `externalName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
|
|
215
|
+
* `externalName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** attribute name used by external system
|
|
216
216
|
* `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
|
|
217
217
|
* `additionalValues` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** other values to be set in case our attribute is set
|
|
218
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ava": "^6.4.1",
|
|
42
|
-
"browser-ava": "^2.3.
|
|
42
|
+
"browser-ava": "^2.3.49",
|
|
43
43
|
"c8": "^10.1.3",
|
|
44
44
|
"documentation": "^14.0.3",
|
|
45
45
|
"semantic-release": "^25.0.2",
|
package/src/bytes.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { types } from "./types.mjs";
|
|
|
10
10
|
* @property {boolean} collection
|
|
11
11
|
* @property {boolean} [private] should the value be shown
|
|
12
12
|
* @property {boolean} [credential] any type of credential
|
|
13
|
-
* @property {boolean} [persistent] should we be stored
|
|
13
|
+
* @property {boolean} [persistent] should we be stored (especially critical for credentials)
|
|
14
14
|
* @property {string} [depends] name of an attribute we depend on
|
|
15
15
|
* @property {string} [description] human readable
|
|
16
16
|
* @property {any} [default] the default value
|
|
@@ -18,7 +18,7 @@ import { types } from "./types.mjs";
|
|
|
18
18
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
19
19
|
* @property {Function} [prepareValue]
|
|
20
20
|
* @property {Set<any>} [values] allowed values
|
|
21
|
-
* @property {string} [externalName]
|
|
21
|
+
* @property {string} [externalName] attribute name used by external system
|
|
22
22
|
* @property {string[]|string} [env] environment variable(s) used to provide the value
|
|
23
23
|
* @property {object} [additionalValues] other values to be set in case our attribute is set
|
|
24
24
|
*/
|
package/src/expand.mjs
CHANGED
|
@@ -6,14 +6,14 @@ const maxNestingLevel = 5;
|
|
|
6
6
|
* Expand expressions inside of object graphs.
|
|
7
7
|
* @param {any} object
|
|
8
8
|
* @param {Object} context
|
|
9
|
-
* @param {any} context.root
|
|
9
|
+
* @param {any} [context.root]
|
|
10
10
|
* @param {function} [context.stopClass]
|
|
11
11
|
* @param {string} [context.leadIn]
|
|
12
12
|
* @param {string} [context.leadOut]
|
|
13
13
|
* @returns {any}
|
|
14
14
|
*/
|
|
15
15
|
export function expand(object, context = {}) {
|
|
16
|
-
const promises = [];
|
|
16
|
+
const /** @type {Array<Promise<any>>} */ promises = [];
|
|
17
17
|
|
|
18
18
|
const leadIn = context.leadIn ?? "${";
|
|
19
19
|
const leadOut = context.leadOut ?? "}";
|
package/src/types.mjs
CHANGED
|
@@ -61,10 +61,12 @@ export const types = {
|
|
|
61
61
|
object: { name: "object", primitive: false }
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {string|undefined} type
|
|
67
|
+
* @param {any} origin
|
|
68
|
+
* @returns {Type}
|
|
69
|
+
*/
|
|
68
70
|
function raiseOnUnknownType(type, origin) {
|
|
69
71
|
switch (typeof type) {
|
|
70
72
|
case "string":
|
|
@@ -72,7 +74,7 @@ function raiseOnUnknownType(type, origin) {
|
|
|
72
74
|
return types[type];
|
|
73
75
|
}
|
|
74
76
|
case "undefined":
|
|
75
|
-
|
|
77
|
+
throw new Error(`Unknown type ${type} in '${origin}'`, { cause: type });
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
return type;
|
|
@@ -174,7 +176,6 @@ export function resolveTypeLinks() {
|
|
|
174
176
|
|
|
175
177
|
export function typeFactory(type, owner, data) {
|
|
176
178
|
const factory = type.factoryFor?.(owner, data) || type.clazz;
|
|
177
|
-
//console.log(factory, type, owner, data);
|
|
178
179
|
const object = new factory(owner);
|
|
179
180
|
|
|
180
181
|
object.read(data);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @property {boolean} collection
|
|
9
9
|
* @property {boolean} [private] should the value be shown
|
|
10
10
|
* @property {boolean} [credential] any type of credential
|
|
11
|
-
* @property {boolean} [persistent] should we be stored
|
|
11
|
+
* @property {boolean} [persistent] should we be stored (especially critical for credentials)
|
|
12
12
|
* @property {string} [depends] name of an attribute we depend on
|
|
13
13
|
* @property {string} [description] human readable
|
|
14
14
|
* @property {any} [default] the default value
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
17
17
|
* @property {Function} [prepareValue]
|
|
18
18
|
* @property {Set<any>} [values] allowed values
|
|
19
|
-
* @property {string} [externalName]
|
|
19
|
+
* @property {string} [externalName] attribute name used by external system
|
|
20
20
|
* @property {string[]|string} [env] environment variable(s) used to provide the value
|
|
21
21
|
* @property {object} [additionalValues] other values to be set in case our attribute is set
|
|
22
22
|
*/
|
|
@@ -213,7 +213,7 @@ export type AttributeDefinition = {
|
|
|
213
213
|
*/
|
|
214
214
|
credential?: boolean;
|
|
215
215
|
/**
|
|
216
|
-
* should we be stored
|
|
216
|
+
* should we be stored (especially critical for credentials)
|
|
217
217
|
*/
|
|
218
218
|
persistent?: boolean;
|
|
219
219
|
/**
|
|
@@ -242,7 +242,7 @@ export type AttributeDefinition = {
|
|
|
242
242
|
*/
|
|
243
243
|
values?: Set<any>;
|
|
244
244
|
/**
|
|
245
|
-
*
|
|
245
|
+
* attribute name used by external system
|
|
246
246
|
*/
|
|
247
247
|
externalName?: string;
|
|
248
248
|
/**
|
package/types/expand.d.mts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Expand expressions inside of object graphs.
|
|
3
3
|
* @param {any} object
|
|
4
4
|
* @param {Object} context
|
|
5
|
-
* @param {any} context.root
|
|
5
|
+
* @param {any} [context.root]
|
|
6
6
|
* @param {function} [context.stopClass]
|
|
7
7
|
* @param {string} [context.leadIn]
|
|
8
8
|
* @param {string} [context.leadOut]
|
|
9
9
|
* @returns {any}
|
|
10
10
|
*/
|
|
11
11
|
export function expand(object: any, context?: {
|
|
12
|
-
root
|
|
12
|
+
root?: any;
|
|
13
13
|
stopClass?: Function;
|
|
14
14
|
leadIn?: string;
|
|
15
15
|
leadOut?: string;
|