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 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)?** attrubute name used by external system
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.1",
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.47",
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
@@ -37,7 +37,7 @@ export function parseBytes(value) {
37
37
  const v = parseFloat(match[1]);
38
38
 
39
39
  if (match[2]) {
40
- bytes += v * units[match[2]];
40
+ bytes += v * units[match[2].toLocaleLowerCase()];
41
41
  } else {
42
42
  bytes += v;
43
43
  }
@@ -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] attrubute name used by external system
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
- function error(message) {
65
- throw new Error(message);
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
- error(`Unknown type ${type} in '${origin}'`);
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] attrubute name used by external system
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
- * attrubute name used by external system
245
+ * attribute name used by external system
246
246
  */
247
247
  externalName?: string;
248
248
  /**
@@ -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: any;
12
+ root?: any;
13
13
  stopClass?: Function;
14
14
  leadIn?: string;
15
15
  leadOut?: string;