pacc 9.2.6 → 9.2.8

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
@@ -529,6 +529,7 @@ Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
529
529
  ## expandContextDefault
530
530
 
531
531
  Default expand context
532
+ using '§{' and '}' as lead in/out
532
533
 
533
534
  ## expandContextDoubbleCurly
534
535
 
@@ -608,7 +609,7 @@ Split expression path into tokens.
608
609
  ### Parameters
609
610
 
610
611
  * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
611
- * `context` (optional, default `{}`)
612
+ * `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
612
613
 
613
614
  ## setAttribute
614
615
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "9.2.6",
3
+ "version": "9.2.8",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
- "packageManager": "npm@11.10.0",
8
+ "packageManager": "npm@11.13.0",
9
9
  "types": "./types/module.d.mts",
10
10
  "exports": {
11
11
  ".": {
@@ -43,16 +43,21 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@mitata/counters": "^0.0.8",
46
- "ava": "^7.0.0",
47
- "browser-ava": "^2.3.54",
46
+ "ava": "^8.0.1",
47
+ "browser-ava": "^2.3.57",
48
48
  "c8": "^11.0.0",
49
49
  "documentation": "^14.0.3",
50
50
  "mitata": "^1.0.34",
51
51
  "semantic-release": "^25.0.3",
52
- "typescript": "^5.9.3"
52
+ "typescript": "^6.0.3"
53
+ },
54
+ "overrides": {
55
+ "c8": {
56
+ "yargs": "^18.0.0"
57
+ }
53
58
  },
54
59
  "engines": {
55
- "node": ">=24.14.0"
60
+ "node": ">=26.1.0"
56
61
  },
57
62
  "repository": {
58
63
  "type": "git",
@@ -23,6 +23,7 @@ import { types } from "./types.mjs";
23
23
  * @property {string} [externalName] attribute name used by external system
24
24
  * @property {string[]|string} [env] environment variable(s) used to provide the value
25
25
  * @property {object} [additionalValues] other values to be set in case our attribute is set
26
+ * @property {string} [separator] separator for collections
26
27
  */
27
28
 
28
29
  /**
package/src/expand.mjs CHANGED
@@ -4,6 +4,7 @@ const maxNestingLevel = 8;
4
4
 
5
5
  /**
6
6
  * Default expand context
7
+ * using '§{' and '}' as lead in/out
7
8
  */
8
9
  export const expandContextDefault = {
9
10
  root: {},
@@ -105,7 +105,8 @@ export function getAttributeAndOperator(object, expression) {
105
105
  let predicateTokens;
106
106
  let op = EQUAL;
107
107
 
108
- const next = tokens(expression);
108
+ const context = {};
109
+ const next = tokens(expression, context);
109
110
 
110
111
  for (const token of next) {
111
112
  switch (token[0]) {
package/src/tokens.mjs CHANGED
@@ -317,14 +317,12 @@ export const keywords = {
317
317
 
318
318
  function evalAll(args, current, context) {
319
319
  return args.map(a =>
320
- typeof a?.eval === "function" ? a.eval(a, current, context) : a
320
+ a.eval === undefined ? a : a.eval(a, current, context)
321
321
  );
322
322
  }
323
323
 
324
324
  function evalOne(arg, current, context) {
325
- return typeof arg?.eval === "function"
326
- ? arg.eval(arg, current, context)
327
- : arg;
325
+ return arg.eval === undefined ? arg : arg.eval(arg, current, context);
328
326
  }
329
327
 
330
328
  export const globals = {
@@ -414,9 +412,10 @@ export const globals = {
414
412
  * Split expression path into tokens.
415
413
  * @generator
416
414
  * @param {string} string
415
+ * @param {Object} context
417
416
  * @yields {Token}
418
417
  */
419
- export function* tokens(string, context = {}) {
418
+ export function* tokens(string, context) {
420
419
  context.keywords ||= keywords;
421
420
  context.parseFloat ||= parseFloat;
422
421
  context.valueFor ||= (name, at) => globals[name];
package/types/ast.d.mts CHANGED
@@ -12,5 +12,5 @@ export namespace ASTNullFilter {
12
12
  export { nullFilterEval as eval };
13
13
  }
14
14
  export type AST = {
15
- eval?: Function;
15
+ eval?: Function | undefined;
16
16
  };
@@ -4,7 +4,7 @@
4
4
  * @param {Object} [presentDefinitions] optional merge in attributes
5
5
  * @return {Object} attributes
6
6
  */
7
- export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions?: any): any;
7
+ export function prepareAttributesDefinitions(newDefinitions: Object, presentDefinitions?: Object): Object;
8
8
  /**
9
9
  * Iterate over all attributes.
10
10
  * @param {Object} definition
@@ -12,8 +12,8 @@ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinit
12
12
  * @param {string[]} path
13
13
  * @return {Iterable<[string[],object]>}
14
14
  */
15
- export function attributeIterator(definition: any, filter?: Function, path?: string[]): Iterable<[string[], object]>;
16
- export function writableAttributeIterator(definition: any): Generator<[string[], any], void, any>;
15
+ export function attributeIterator(definition: Object, filter?: Function, path?: string[]): Iterable<[string[], object]>;
16
+ export function writableAttributeIterator(definition: any): Generator<[string[], object], void, any>;
17
17
  export function toInternal(value: any, attribute: any): any;
18
18
  export function toExternal(value: any, attribute: any): any;
19
19
  export function mandatoryAttributesPresent(object: any, attributes: any): boolean;
@@ -21,6 +21,7 @@
21
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
+ * @property {string} [separator] separator for collections
24
25
  */
25
26
  /**
26
27
  * Common attribute properties.
@@ -102,23 +103,24 @@ export namespace yesno_attribute_writable {
102
103
  export let isKey: boolean;
103
104
  export let mandatory: boolean;
104
105
  export let collection: boolean;
105
- export let constructor: Function;
106
- let _private: boolean;
106
+ export let constructor: Function | undefined;
107
+ let _private: boolean | undefined;
107
108
  export { _private as private };
108
- export let credential: boolean;
109
- export let persistent: boolean;
110
- export let depends: string;
111
- export let description: string;
109
+ export let credential: boolean | undefined;
110
+ export let persistent: boolean | undefined;
111
+ export let depends: string | undefined;
112
+ export let description: string | undefined;
112
113
  let _default: any;
113
114
  export { _default as default };
114
- export let set: Function;
115
- export let get: Function;
116
- export let toInternal: Function;
117
- export let toExternal: Function;
118
- export let values: Set<any>;
119
- export let externalName: string;
120
- export let env: string[] | string;
121
- export let additionalValues: object;
115
+ export let set: Function | undefined;
116
+ export let get: Function | undefined;
117
+ export let toInternal: Function | undefined;
118
+ export let toExternal: Function | undefined;
119
+ export let values: Set<any> | undefined;
120
+ export let externalName: string | undefined;
121
+ export let env: string | string[] | undefined;
122
+ export let additionalValues: object | undefined;
123
+ export let separator: string | undefined;
122
124
  }
123
125
  /**
124
126
  * @type {AttributeDefinition}
@@ -232,27 +234,27 @@ export type AttributeDefinition = {
232
234
  /**
233
235
  * (collection) constructor
234
236
  */
235
- constructor?: Function;
237
+ constructor?: Function | undefined;
236
238
  /**
237
239
  * should the value be shown
238
240
  */
239
- private?: boolean;
241
+ private?: boolean | undefined;
240
242
  /**
241
243
  * any type of credential
242
244
  */
243
- credential?: boolean;
245
+ credential?: boolean | undefined;
244
246
  /**
245
247
  * should we be stored (especially critical for credentials)
246
248
  */
247
- persistent?: boolean;
249
+ persistent?: boolean | undefined;
248
250
  /**
249
251
  * name of an attribute we depend on
250
252
  */
251
- depends?: string;
253
+ depends?: string | undefined;
252
254
  /**
253
255
  * human readable
254
256
  */
255
- description?: string;
257
+ description?: string | undefined;
256
258
  /**
257
259
  * the default value
258
260
  */
@@ -260,28 +262,32 @@ export type AttributeDefinition = {
260
262
  /**
261
263
  * set the value
262
264
  */
263
- set?: Function;
265
+ set?: Function | undefined;
264
266
  /**
265
267
  * get the value can be used to calculate default values
266
268
  */
267
- get?: Function;
268
- toInternal?: Function;
269
- toExternal?: Function;
269
+ get?: Function | undefined;
270
+ toInternal?: Function | undefined;
271
+ toExternal?: Function | undefined;
270
272
  /**
271
273
  * allowed values
272
274
  */
273
- values?: Set<any>;
275
+ values?: Set<any> | undefined;
274
276
  /**
275
277
  * attribute name used by external system
276
278
  */
277
- externalName?: string;
279
+ externalName?: string | undefined;
278
280
  /**
279
281
  * environment variable(s) used to provide the value
280
282
  */
281
- env?: string[] | string;
283
+ env?: string | string[] | undefined;
282
284
  /**
283
285
  * other values to be set in case our attribute is set
284
286
  */
285
- additionalValues?: object;
287
+ additionalValues?: object | undefined;
288
+ /**
289
+ * separator for collections
290
+ */
291
+ separator?: string | undefined;
286
292
  };
287
293
  export { default_attribute as string_attribute, default_attribute_writable as string_attribute_writable, description_attribute as description_attribute_writable, default_attribute as type_attribute, default_attribute_writable as state_attribute_writable, boolean_attribute_writable_true as active_attribute, boolean_attribute as empty_attribute, secret_attribute as username_attribute, secret_attribute as password_attribute, secret_attribute as token_attribute, secret_attribute as certificate_attribute, integer_attribute as count_attribute, integer_attribute_writable as count_attribute_writable, integer_attribute as size_attribute, default_attribute_writable as body_attribute_writable };
@@ -5,4 +5,4 @@
5
5
  * @param {string} instanceIdentifier part of variable name.
6
6
  * @return {Object|undefined} undefined if no suitable environment variables have been found
7
7
  */
8
- export function environmentValues(env: any, attributes: any, instanceIdentifier: string): any | undefined;
8
+ export function environmentValues(env: Object, attributes: Object, instanceIdentifier: string): Object | undefined;
@@ -10,9 +10,9 @@
10
10
  */
11
11
  export function expand(object: any, context: {
12
12
  root?: any;
13
- stopClass?: Function;
14
- leadIn?: string;
15
- leadOut?: string;
13
+ stopClass?: Function | undefined;
14
+ leadIn?: string | undefined;
15
+ leadOut?: string | undefined;
16
16
  }): any | Promise<any>;
17
17
  export namespace expandContextDefault {
18
18
  let root: {};
@@ -3,4 +3,4 @@
3
3
  * @param {Object} [filterBy]
4
4
  * @returns {Function}
5
5
  */
6
- export function filter(filterBy?: any): Function;
6
+ export function filter(filterBy?: Object): Function;
@@ -5,7 +5,7 @@
5
5
  * @param {Object} definitions attribute definitions to be used
6
6
  * @param {function?} cb callback to be executed for each copied value
7
7
  */
8
- export function setAttributes(object: any, source: any, definitions: any, cb: Function | null): void;
8
+ export function setAttributes(object: Object, source: Object, definitions: Object, cb: Function | null): void;
9
9
  /**
10
10
  * Retrive attribute values from an object.
11
11
  * @param {Object} object attribute value source
@@ -13,7 +13,7 @@ export function setAttributes(object: any, source: any, definitions: any, cb: Fu
13
13
  * @param {Function} [filter]
14
14
  * @return {Object} values
15
15
  */
16
- export function getAttributes(object: any, definitions: any, filter?: Function): any;
16
+ export function getAttributes(object: Object, definitions: Object, filter?: Function): Object;
17
17
  /**
18
18
  * Retrive attribute values from an object.
19
19
  * @param {Object} object attribute value source
@@ -21,4 +21,4 @@ export function getAttributes(object: any, definitions: any, filter?: Function):
21
21
  * @param {Function} [filter]
22
22
  * @return {Object} values
23
23
  */
24
- export function getAttributesJSON(object: any, definitions: any, filter?: Function): any;
24
+ export function getAttributesJSON(object: Object, definitions: Object, filter?: Function): Object;
@@ -6,7 +6,7 @@
6
6
  * @param {any} value
7
7
  * @param {Object} [definition] type def
8
8
  */
9
- export function setAttribute(object: any, expression: string, value: any, definition?: any): void;
9
+ export function setAttribute(object: Object, expression: string, value: any, definition?: Object): void;
10
10
  /**
11
11
  * Deliver attribute value.
12
12
  * The name may be a property path like 'a.b.c' or a[2]
@@ -15,7 +15,7 @@ export function setAttribute(object: any, expression: string, value: any, defini
15
15
  * @param {Object} [definition]
16
16
  * @returns {any} value associated with the given property name
17
17
  */
18
- export function getAttribute(object: any, expression: string, definition?: any): any;
18
+ export function getAttribute(object: Object, expression: string, definition?: Object): any;
19
19
  /**
20
20
  * Deliver attribute value and operator.
21
21
  * The name may be a property path like 'a.b.c <='.
@@ -23,5 +23,5 @@ export function getAttribute(object: any, expression: string, definition?: any):
23
23
  * @param {string} expression
24
24
  * @returns {[any,Token]} value associated with the given property name
25
25
  */
26
- export function getAttributeAndOperator(object: any, expression: string): [any, Token];
26
+ export function getAttributeAndOperator(object: Object, expression: string): [any, Token];
27
27
  export type Token = import("./tokens.mjs").Token;
@@ -2,9 +2,10 @@
2
2
  * Split expression path into tokens.
3
3
  * @generator
4
4
  * @param {string} string
5
+ * @param {Object} context
5
6
  * @yields {Token}
6
7
  */
7
- export function tokens(string: string, context?: {}): Generator<any, void, unknown>;
8
+ export function tokens(string: string, context: Object): Generator<any, void, unknown>;
8
9
  export namespace PLUS {
9
10
  let str: string;
10
11
  }
package/types/types.d.mts CHANGED
@@ -23,7 +23,7 @@ export const types: {
23
23
  name: string;
24
24
  primitive: boolean;
25
25
  toInternal: (value: any, attribute: any) => any;
26
- toExternal: (value: any) => "no" | "yes";
26
+ toExternal: (value: any) => "no" | "yes" | undefined;
27
27
  };
28
28
  integer: {
29
29
  name: string;
@@ -39,7 +39,7 @@ export const types: {
39
39
  name: string;
40
40
  primitive: boolean;
41
41
  toInternal: (value: any) => number;
42
- toExternal: (value: any) => string;
42
+ toExternal: (value: any) => string | undefined;
43
43
  };
44
44
  duration_ms: {
45
45
  name: string;
@@ -63,8 +63,8 @@ export const types: {
63
63
  };
64
64
  export type Type = {
65
65
  name: string;
66
- primitive?: boolean;
67
- toInternal?: Function;
68
- toExternal?: Function;
66
+ primitive?: boolean | undefined;
67
+ toInternal?: Function | undefined;
68
+ toExternal?: Function | undefined;
69
69
  };
70
70
  import { parseBytes } from "./bytes.mjs";