pacc 10.4.0 → 10.5.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 CHANGED
@@ -83,6 +83,7 @@ tokens "abc" "
83
83
  * [Properties](#properties-1)
84
84
  * [default\_attribute](#default_attribute)
85
85
  * [default\_attribute\_writable](#default_attribute_writable)
86
+ * [default\_collection\_attribute](#default_collection_attribute)
86
87
  * [default\_collection\_attribute\_writable](#default_collection_attribute_writable)
87
88
  * [string\_attribute](#string_attribute)
88
89
  * [string\_attribute\_writable](#string_attribute_writable)
@@ -299,6 +300,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
299
300
  * `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
300
301
  * `toInternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
301
302
  * `toExternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
303
+ * `asMapEntry` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** deliver key and value for Map insertion
302
304
  * `externalName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** attribute name used by external system
303
305
  * `values` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\<any>?** allowed values
304
306
  * `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
@@ -315,6 +317,10 @@ Type: [AttributeDefinition](#attributedefinition)
315
317
 
316
318
  Type: [AttributeDefinition](#attributedefinition)
317
319
 
320
+ ## default\_collection\_attribute
321
+
322
+ Type: [AttributeDefinition](#attributedefinition)
323
+
318
324
  ## default\_collection\_attribute\_writable
319
325
 
320
326
  Type: [AttributeDefinition](#attributedefinition)
@@ -583,7 +589,7 @@ Expand expressions inside of object graphs.
583
589
  * `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
584
590
 
585
591
  * `context.root` **any?** actual replacement values
586
- * `context.stopClass` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?**&#x20;
592
+ * `context.stopClass` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** do not expand instancif
587
593
  * `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** starting separator
588
594
  * `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** ending separator
589
595
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
- "packageManager": "npm@11.16.0",
8
+ "packageManager": "npm@11.18.0",
9
9
  "types": "./types/module.d.mts",
10
10
  "exports": {
11
11
  ".": {
@@ -43,22 +43,17 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@mitata/counters": "^0.0.8",
46
- "aggregated-map": "^1.0.6",
46
+ "aggregated-map": "^1.0.8",
47
47
  "ava": "^8.0.1",
48
- "browser-ava": "^2.3.63",
49
- "c8": "^11.0.0",
48
+ "browser-ava": "^2.3.69",
49
+ "c8": "^12.0.0",
50
50
  "documentation": "^14.0.3",
51
51
  "mitata": "^1.0.34",
52
- "semantic-release": "^25.0.5",
53
- "typescript": "^6.0.3"
54
- },
55
- "overrides": {
56
- "c8": {
57
- "yargs": "^18.0.0"
58
- }
52
+ "semantic-release": "^25.0.8",
53
+ "typescript": "^7.0.2"
59
54
  },
60
55
  "engines": {
61
- "node": ">=26.3.1"
56
+ "node": ">=26.4.0"
62
57
  },
63
58
  "repository": {
64
59
  "type": "git",
@@ -21,6 +21,7 @@ import { types } from "./types.mjs";
21
21
  * @property {Function} [get] get the value can be used to calculate default values
22
22
  * @property {Function} [toInternal]
23
23
  * @property {Function} [toExternal]
24
+ * @property {Function} [asMapEntry] deliver key and value for Map insertion
24
25
  * @property {string} [externalName] attribute name used by external system
25
26
  * @property {Set<any>} [values] allowed values
26
27
  * @property {string[]|string} [env] environment variable(s) used to provide the value
package/src/expand.mjs CHANGED
@@ -2,6 +2,8 @@ import { parse } from "./parser.mjs";
2
2
 
3
3
  const maxNestingLevel = 8;
4
4
 
5
+ class _Dummy {}
6
+
5
7
  /**
6
8
  * Default expand context
7
9
  * using '§{' and '}' as lead in/out
@@ -9,7 +11,8 @@ const maxNestingLevel = 8;
9
11
  export const expandContextDefault = {
10
12
  root: {},
11
13
  leadIn: "${",
12
- leadOut: "}"
14
+ leadOut: "}",
15
+ stopClass: _Dummy
13
16
  };
14
17
 
15
18
  /**
@@ -26,7 +29,7 @@ export const expandContextDoubbleCurly = {
26
29
  * @param {any} object
27
30
  * @param {Object} context
28
31
  * @param {any} [context.root] actual replacement values
29
- * @param {function} [context.stopClass]
32
+ * @param {function} [context.stopClass] do not expand instancif
30
33
  * @param {string} [context.leadIn] starting separator
31
34
  * @param {string} [context.leadOut] ending separator
32
35
  * @returns {any|Promise<any>}
@@ -140,6 +143,7 @@ export function expand(object, context) {
140
143
 
141
144
  if (typeof object.entries === "function") {
142
145
  const copy = new object.constructor[Symbol.species]();
146
+
143
147
  for (const [key, value] of object.entries()) {
144
148
  const path2 = [
145
149
  ...path,
@@ -155,11 +159,11 @@ export function expand(object, context) {
155
159
  return copy;
156
160
  }
157
161
 
158
- if (context.stopClass && object instanceof context.stopClass) {
162
+ if (object instanceof context.stopClass) {
159
163
  return object;
160
164
  }
161
165
 
162
- if(Object.prototype.toString.call(object) !== '[object Object]') {
166
+ if (Object.prototype.toString.call(object) !== "[object Object]") {
163
167
  return object;
164
168
  }
165
169
 
package/src/tokens.mjs CHANGED
@@ -15,8 +15,21 @@ const lookup = {};
15
15
  /**
16
16
  * @typedef {Object} Token
17
17
  * @property {string} str
18
+ * @property {number} precedence
19
+ * @property {Function} led
20
+ * @property {Function} nud
21
+ *
18
22
  */
19
23
 
24
+ /**
25
+ *
26
+ * @param {Token} token
27
+ */
28
+ export function registerToken(token) {
29
+ lookup[token.str] = [token];
30
+ return token;
31
+ }
32
+
20
33
  /**
21
34
  *
22
35
  * @param {string} str
@@ -48,8 +61,8 @@ function createToken(
48
61
  }
49
62
 
50
63
  token.nud = nud;
51
- lookup[str] = [token];
52
- return token;
64
+
65
+ return registerToken(token);
53
66
  }
54
67
 
55
68
  function createBinopToken(str, precedence, type, binop) {
package/types/ast.d.mts CHANGED
@@ -2,15 +2,15 @@
2
2
  * @typedef {Object} AST
3
3
  * @property {Function} [eval]
4
4
  */
5
- export function pathEval(node: any, current: any, context: any): any;
6
- export function functionEval(node: any, current: any, context: any): any;
7
- export function keyedAccessOrGlobalEval(node: any, current: any, context: any): any;
8
- export function keyedAccessEval(node: any, current: any, context: any): any;
9
- export function filterEval(node: any, current: any, context: any): any;
10
- export function nullFilterEval(node: any, current: any, context: any): any;
11
- export namespace ASTNullFilter {
12
- export { nullFilterEval as eval };
13
- }
14
5
  export type AST = {
15
- eval?: Function | undefined;
6
+ eval?: Function;
7
+ };
8
+ export declare function pathEval(node: any, current: any, context: any): any;
9
+ export declare function functionEval(node: any, current: any, context: any): any;
10
+ export declare function keyedAccessOrGlobalEval(node: any, current: any, context: any): any;
11
+ export declare function keyedAccessEval(node: any, current: any, context: any): any;
12
+ export declare function filterEval(node: any, current: any, context: any): any;
13
+ export declare function nullFilterEval(node: any, current: any, context: any): any;
14
+ export declare const ASTNullFilter: {
15
+ eval: typeof nullFilterEval;
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: Object, presentDefinitions?: Object): Object;
7
+ export declare function prepareAttributesDefinitions(newDefinitions: Object, presentDefinitions?: Object): Object;
8
8
  /**
9
9
  * Iterate over attributes.
10
10
  * @param {Object} attribute definition
@@ -12,7 +12,7 @@ export function prepareAttributesDefinitions(newDefinitions: Object, presentDefi
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]>;
15
+ export declare function attributeIterator(definition: any, filter?: Function, path?: string[]): Iterable<[string[], object]>;
16
16
  /**
17
17
  * Iterate over all attributes of a type.
18
18
  * @param {Type} type definition
@@ -20,10 +20,10 @@ export function attributeIterator(definition: any, filter?: Function, path?: str
20
20
  * @param {string[]} [path]
21
21
  * @return {Iterable<[string[],object]>}
22
22
  */
23
- export function extendingAttributeIterator(type: Type, filter?: Function, path?: string[]): Iterable<[string[], object]>;
24
- export function writableAttributeIterator(definition: any): Generator<[string[], object], void, any>;
25
- export function toInternal(value: any, attribute: any): any;
26
- export function toExternal(value: any, attribute: any): any;
27
- export function mandatoryAttributesPresent(object: any, attributes: any): boolean;
28
- export function filterWritable(attribute: any): any;
29
- export function filterPublic(attribute: any): boolean;
23
+ export declare function extendingAttributeIterator(type: Type, filter?: Function, path?: string[]): Iterable<[string[], object]>;
24
+ export declare const filterWritable: (attribute: any) => any;
25
+ export declare const filterPublic: (attribute: any) => boolean;
26
+ export declare function writableAttributeIterator(definition: any): Generator<[string[], object], void, any>;
27
+ export declare function toInternal(value: any, attribute: any): any;
28
+ export declare function toExternal(value: any, attribute: any): any;
29
+ export declare function mandatoryAttributesPresent(object: any, attributes: any): boolean;
package/types/bytes.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- export function formatBytes(bytes: any, decimals?: number): string;
1
+ export declare function formatBytes(bytes: any, decimals?: number): string;
2
2
  /**
3
3
  * Convert byte size formatted string into number of bytes.
4
4
  * @param {number|string} value
5
5
  * @returns {number} number of total bytes
6
6
  */
7
- export function parseBytes(value: number | string): number;
7
+ export declare function parseBytes(value: number | string): number;
@@ -1,3 +1,83 @@
1
+ export type AttributeDefinition = {
2
+ name: string;
3
+ type: Type;
4
+ /**
5
+ * are we an identifying attribute
6
+ */
7
+ key: boolean;
8
+ /**
9
+ * can this attribute be modified
10
+ */
11
+ writable: boolean;
12
+ mandatory: boolean;
13
+ /**
14
+ * are we a collection (set, map, array, object)
15
+ */
16
+ collection: boolean;
17
+ /**
18
+ * should the value be shown
19
+ */
20
+ private?: boolean;
21
+ /**
22
+ * any type of credential
23
+ */
24
+ credential?: boolean;
25
+ /**
26
+ * should we be stored (especially critical for credentials)
27
+ */
28
+ persistent?: boolean;
29
+ backpointer?: AttributeDefinition;
30
+ /**
31
+ * (collection) constructor
32
+ */
33
+ constructor?: Function;
34
+ /**
35
+ * name of an attribute we depend on
36
+ */
37
+ depends?: string;
38
+ /**
39
+ * human readable
40
+ */
41
+ description?: string;
42
+ /**
43
+ * the default value
44
+ */
45
+ default?: any;
46
+ /**
47
+ * set the value
48
+ */
49
+ set?: Function;
50
+ /**
51
+ * get the value can be used to calculate default values
52
+ */
53
+ get?: Function;
54
+ toInternal?: Function;
55
+ toExternal?: Function;
56
+ /**
57
+ * deliver key and value for Map insertion
58
+ */
59
+ asMapEntry?: Function;
60
+ /**
61
+ * attribute name used by external system
62
+ */
63
+ externalName?: string;
64
+ /**
65
+ * allowed values
66
+ */
67
+ values?: Set<any>;
68
+ /**
69
+ * environment variable(s) used to provide the value
70
+ */
71
+ env?: string[] | string;
72
+ /**
73
+ * other values to be set in case our attribute is set
74
+ */
75
+ additionalValues?: object;
76
+ /**
77
+ * separator for collections
78
+ */
79
+ separator?: string;
80
+ };
1
81
  /**
2
82
  * @typedef {Object} AttributeDefinition
3
83
  *
@@ -19,6 +99,7 @@
19
99
  * @property {Function} [get] get the value can be used to calculate default values
20
100
  * @property {Function} [toInternal]
21
101
  * @property {Function} [toExternal]
102
+ * @property {Function} [asMapEntry] deliver key and value for Map insertion
22
103
  * @property {string} [externalName] attribute name used by external system
23
104
  * @property {Set<any>} [values] allowed values
24
105
  * @property {string[]|string} [env] environment variable(s) used to provide the value
@@ -29,339 +110,300 @@
29
110
  * Common attribute properties.
30
111
  * @type {AttributeDefinition}
31
112
  */
32
- export const default_attribute: AttributeDefinition;
113
+ export declare const default_attribute: AttributeDefinition;
33
114
  /**
34
115
  * @type {AttributeDefinition}
35
116
  */
36
- export const default_attribute_writable: AttributeDefinition;
117
+ export declare const default_attribute_writable: AttributeDefinition;
37
118
  /**
38
119
  * @type {AttributeDefinition}
39
120
  */
40
- export const default_collection_attribute: AttributeDefinition;
121
+ export declare const default_collection_attribute: AttributeDefinition;
41
122
  /**
42
123
  * @type {AttributeDefinition}
43
124
  */
44
- export const default_collection_attribute_writable: AttributeDefinition;
125
+ export declare const default_collection_attribute_writable: AttributeDefinition;
45
126
  /**
46
127
  * @type {AttributeDefinition}
47
128
  */
48
- export const string_attribute: AttributeDefinition;
129
+ export declare const string_attribute: AttributeDefinition;
49
130
  /**
50
131
  * @type {AttributeDefinition}
51
132
  */
52
- export const string_attribute_writable: AttributeDefinition;
133
+ export declare const string_attribute_writable: AttributeDefinition;
53
134
  /**
54
135
  * @type {AttributeDefinition}
55
136
  */
56
- export const string_collection_attribute: AttributeDefinition;
137
+ export declare const string_collection_attribute: AttributeDefinition;
57
138
  /**
58
139
  * @type {AttributeDefinition}
59
140
  */
60
- export const string_collection_attribute_writable: AttributeDefinition;
141
+ export declare const string_collection_attribute_writable: AttributeDefinition;
61
142
  /**
62
143
  * @type {AttributeDefinition}
63
144
  */
64
- export const string_set_attribute: AttributeDefinition;
145
+ export declare const string_set_attribute: AttributeDefinition;
65
146
  /**
66
147
  * @type {AttributeDefinition}
67
148
  */
68
- export const string_set_attribute_writable: AttributeDefinition;
149
+ export declare const string_set_attribute_writable: AttributeDefinition;
69
150
  /**
70
151
  * @type {AttributeDefinition}
71
152
  */
72
- export const name_attribute: AttributeDefinition;
153
+ export declare const name_attribute: AttributeDefinition;
73
154
  /**
74
155
  * @type {AttributeDefinition}
75
156
  */
76
- export const name_attribute_writable: AttributeDefinition;
157
+ export declare const name_attribute_writable: AttributeDefinition;
77
158
  /**
78
159
  * @type {AttributeDefinition}
79
160
  */
80
- export const email_attribute: AttributeDefinition;
161
+ export declare const email_attribute: AttributeDefinition;
81
162
  /**
82
163
  * @type {AttributeDefinition}
83
164
  */
84
- export const version_attribute: AttributeDefinition;
165
+ export declare const version_attribute: AttributeDefinition;
85
166
  /**
86
167
  * @type {AttributeDefinition}
87
168
  */
88
- export const version_attribute_writable: AttributeDefinition;
169
+ export declare const version_attribute_writable: AttributeDefinition;
89
170
  /**
90
171
  * The description of the object content.
91
172
  * @type {AttributeDefinition}
92
173
  */
93
- export const description_attribute: AttributeDefinition;
174
+ export declare const description_attribute: AttributeDefinition;
175
+ export { description_attribute as description_attribute_writable };
176
+ /**
177
+ * @type {AttributeDefinition}
178
+ */
179
+ export declare const type_attribute: AttributeDefinition;
180
+ /**
181
+ * @type {AttributeDefinition}
182
+ */
183
+ export declare const type_attribute_writable: AttributeDefinition;
94
184
  /**
95
185
  * @type {AttributeDefinition}
96
186
  */
97
- export const type_attribute: AttributeDefinition;
187
+ export declare const state_attribute_writable: AttributeDefinition;
98
188
  /**
99
189
  * @type {AttributeDefinition}
100
190
  */
101
- export const type_attribute_writable: AttributeDefinition;
191
+ export declare const boolean_attribute: AttributeDefinition;
102
192
  /**
103
193
  * @type {AttributeDefinition}
104
194
  */
105
- export const state_attribute_writable: AttributeDefinition;
195
+ export declare const boolean_attribute_writable: AttributeDefinition;
106
196
  /**
107
197
  * @type {AttributeDefinition}
108
198
  */
109
- export const boolean_attribute: AttributeDefinition;
199
+ export declare const boolean_attribute_writable_true: AttributeDefinition;
110
200
  /**
111
201
  * @type {AttributeDefinition}
112
202
  */
113
- export const boolean_attribute_writable: AttributeDefinition;
203
+ export declare const boolean_attribute_writable_false: AttributeDefinition;
114
204
  /**
115
205
  * @type {AttributeDefinition}
116
206
  */
117
- export const boolean_attribute_writable_true: AttributeDefinition;
207
+ export declare const boolean_attribute_false: AttributeDefinition;
118
208
  /**
119
209
  * @type {AttributeDefinition}
120
210
  */
121
- export const boolean_attribute_writable_false: AttributeDefinition;
211
+ export { boolean_attribute_writable_true as active_attribute };
212
+ /**
213
+ * @type {AttributeDefinition}
214
+ */
215
+ export declare const yesno_attribute: AttributeDefinition;
216
+ export declare const yesno_attribute_writable: {
217
+ name: string;
218
+ type: Type;
219
+ key: boolean;
220
+ mandatory: boolean;
221
+ collection: boolean;
222
+ private?: boolean;
223
+ credential?: boolean;
224
+ persistent?: boolean;
225
+ backpointer?: AttributeDefinition;
226
+ constructor?: Function | undefined;
227
+ depends?: string;
228
+ description?: string;
229
+ default?: any;
230
+ set?: Function | undefined;
231
+ get?: Function | undefined;
232
+ toInternal?: Function | undefined;
233
+ toExternal?: Function | undefined;
234
+ asMapEntry?: Function | undefined;
235
+ externalName?: string;
236
+ values?: Set<any>;
237
+ env?: string[] | string;
238
+ additionalValues?: object;
239
+ separator?: string;
240
+ writable: boolean;
241
+ };
122
242
  /**
123
243
  * @type {AttributeDefinition}
124
244
  */
125
- export const boolean_attribute_false: AttributeDefinition;
245
+ export declare const empty_attribute: AttributeDefinition;
126
246
  /**
127
247
  * @type {AttributeDefinition}
128
248
  */
129
- export const yesno_attribute: AttributeDefinition;
130
- export namespace yesno_attribute_writable {
131
- export let writable: boolean;
132
- export let name: string;
133
- export let type: Type;
134
- export let key: boolean;
135
- export let mandatory: boolean;
136
- export let collection: boolean;
137
- let _private: boolean | undefined;
138
- export { _private as private };
139
- export let credential: boolean | undefined;
140
- export let persistent: boolean | undefined;
141
- export let backpointer: AttributeDefinition | undefined;
142
- export let constructor: Function | undefined;
143
- export let depends: string | undefined;
144
- export let description: string | undefined;
145
- let _default: any;
146
- export { _default as default };
147
- export let set: Function | undefined;
148
- export let get: Function | undefined;
149
- export let toInternal: Function | undefined;
150
- export let toExternal: Function | undefined;
151
- export let externalName: string | undefined;
152
- export let values: Set<any> | undefined;
153
- export let env: string | string[] | undefined;
154
- export let additionalValues: object | undefined;
155
- export let separator: string | undefined;
156
- }
249
+ export declare const uuid_attribute: AttributeDefinition;
157
250
  /**
158
251
  * @type {AttributeDefinition}
159
252
  */
160
- export const empty_attribute: AttributeDefinition;
253
+ export declare const secret_attribute: AttributeDefinition;
161
254
  /**
162
255
  * @type {AttributeDefinition}
163
256
  */
164
- export const uuid_attribute: AttributeDefinition;
257
+ export declare const secret_attribute_writable: AttributeDefinition;
165
258
  /**
166
259
  * @type {AttributeDefinition}
167
260
  */
168
- export const secret_attribute: AttributeDefinition;
261
+ export declare const username_attribute: AttributeDefinition;
169
262
  /**
170
263
  * @type {AttributeDefinition}
171
264
  */
172
- export const secret_attribute_writable: AttributeDefinition;
265
+ export declare const password_attribute: AttributeDefinition;
173
266
  /**
174
267
  * @type {AttributeDefinition}
175
268
  */
176
- export const username_attribute: AttributeDefinition;
269
+ export declare const token_attribute: AttributeDefinition;
177
270
  /**
178
271
  * @type {AttributeDefinition}
179
272
  */
180
- export const password_attribute: AttributeDefinition;
273
+ export { secret_attribute as certificate_attribute };
181
274
  /**
182
275
  * @type {AttributeDefinition}
183
276
  */
184
- export const token_attribute: AttributeDefinition;
277
+ export declare const private_key_attribute: AttributeDefinition;
185
278
  /**
186
279
  * @type {AttributeDefinition}
187
280
  */
188
- export const private_key_attribute: AttributeDefinition;
281
+ export declare const public_key_attribute: AttributeDefinition;
189
282
  /**
190
283
  * @type {AttributeDefinition}
191
284
  */
192
- export const public_key_attribute: AttributeDefinition;
285
+ export declare const number_attribute: AttributeDefinition;
193
286
  /**
194
287
  * @type {AttributeDefinition}
195
288
  */
196
- export const number_attribute: AttributeDefinition;
289
+ export declare const number_attribute_writable: AttributeDefinition;
197
290
  /**
198
291
  * @type {AttributeDefinition}
199
292
  */
200
- export const number_attribute_writable: AttributeDefinition;
293
+ export declare const integer_attribute: AttributeDefinition;
201
294
  /**
202
295
  * @type {AttributeDefinition}
203
296
  */
204
- export const integer_attribute: AttributeDefinition;
297
+ export declare const integer_attribute_writable: AttributeDefinition;
205
298
  /**
206
299
  * @type {AttributeDefinition}
207
300
  */
208
- export const integer_attribute_writable: AttributeDefinition;
301
+ export { integer_attribute as count_attribute };
209
302
  /**
210
303
  * @type {AttributeDefinition}
211
304
  */
212
- export const size_attribute: AttributeDefinition;
213
- export namespace bytes_size_attribute {
214
- let type_1: {
305
+ export { integer_attribute_writable as count_attribute_writable };
306
+ /**
307
+ * @type {AttributeDefinition}
308
+ */
309
+ export declare const size_attribute: AttributeDefinition;
310
+ export declare const bytes_size_attribute: {
311
+ key: boolean;
312
+ writable: boolean;
313
+ mandatory: boolean;
314
+ collection: boolean;
315
+ private?: boolean;
316
+ credential?: boolean;
317
+ persistent?: boolean;
318
+ backpointer?: AttributeDefinition;
319
+ constructor?: Function | undefined;
320
+ depends?: string;
321
+ description?: string;
322
+ default?: any;
323
+ set?: Function | undefined;
324
+ get?: Function | undefined;
325
+ toInternal?: Function | undefined;
326
+ toExternal?: Function | undefined;
327
+ asMapEntry?: Function | undefined;
328
+ externalName?: string;
329
+ values?: Set<any>;
330
+ env?: string[] | string;
331
+ additionalValues?: object;
332
+ separator?: string;
333
+ type: {
215
334
  name: string;
216
335
  primitive: boolean;
217
336
  toInternal: typeof import("./bytes.mjs").parseBytes;
218
337
  };
219
- export { type_1 as type };
220
- let name_1: string;
221
- export { name_1 as name };
222
- let writable_1: boolean;
223
- export { writable_1 as writable };
224
- }
338
+ name: string;
339
+ };
225
340
  /**
226
341
  * @type {AttributeDefinition}
227
342
  */
228
- export const object_attribute: AttributeDefinition;
343
+ export declare const object_attribute: AttributeDefinition;
229
344
  /**
230
345
  * @type {AttributeDefinition}
231
346
  */
232
- export const url_attribute: AttributeDefinition;
347
+ export declare const url_attribute: AttributeDefinition;
233
348
  /**
234
349
  * @type {AttributeDefinition}
235
350
  */
236
- export const url_attribute_writable: AttributeDefinition;
351
+ export declare const url_attribute_writable: AttributeDefinition;
237
352
  /**
238
353
  * @type {AttributeDefinition}
239
354
  */
240
- export const hostname_attribute: AttributeDefinition;
355
+ export declare const hostname_attribute: AttributeDefinition;
241
356
  /**
242
357
  * @type {AttributeDefinition}
243
358
  */
244
- export const port_attribute: AttributeDefinition;
359
+ export declare const port_attribute: AttributeDefinition;
245
360
  /**
246
361
  * @type {AttributeDefinition}
247
362
  */
248
- export const port_attribute_writable: AttributeDefinition;
363
+ export declare const port_attribute_writable: AttributeDefinition;
249
364
  /**
250
365
  * Unique id within.
251
366
  * @type {AttributeDefinition}
252
367
  */
253
- export const id_attribute: AttributeDefinition;
368
+ export declare const id_attribute: AttributeDefinition;
254
369
  /**
255
370
  * The body text.
256
371
  * @type {AttributeDefinition}
257
372
  */
258
- export const body_attribute_writable: AttributeDefinition;
373
+ export declare const body_attribute_writable: AttributeDefinition;
259
374
  /**
260
375
  * The one line description.
261
376
  * @type {AttributeDefinition}
262
377
  */
263
- export const title_attribute_writable: AttributeDefinition;
378
+ export declare const title_attribute_writable: AttributeDefinition;
264
379
  /**
265
380
  * In case there are several providers able to support a given source which one sould be used ?
266
381
  * this defines the order.
267
382
  * @type {AttributeDefinition}
268
383
  */
269
- export const priority_attribute: AttributeDefinition;
384
+ export declare const priority_attribute: AttributeDefinition;
385
+ /**
386
+ * @type {AttributeDefinition}
387
+ */
388
+ export { priority_attribute as priority_attribute_writable };
270
389
  /**
271
390
  * Duration in seconds.
272
391
  * @type {AttributeDefinition}
273
392
  */
274
- export const duration_attribute: AttributeDefinition;
393
+ export declare const duration_attribute: AttributeDefinition;
275
394
  /**
276
395
  * @type {AttributeDefinition}
277
396
  */
278
- export const duration_attribute_writable: AttributeDefinition;
397
+ export declare const duration_attribute_writable: AttributeDefinition;
279
398
  /**
280
399
  * @type {AttributeDefinition}
281
400
  */
282
- export const duration_ms_attribute: AttributeDefinition;
401
+ export declare const duration_ms_attribute: AttributeDefinition;
283
402
  /**
284
403
  * @type {AttributeDefinition}
285
404
  */
286
- export const timeout_attribute: AttributeDefinition;
405
+ export declare const timeout_attribute: AttributeDefinition;
287
406
  /**
288
407
  * @type {AttributeDefinition}
289
408
  */
290
- export const language_attribute: AttributeDefinition;
291
- export type AttributeDefinition = {
292
- name: string;
293
- type: Type;
294
- /**
295
- * are we an identifying attribute
296
- */
297
- key: boolean;
298
- /**
299
- * can this attribute be modified
300
- */
301
- writable: boolean;
302
- mandatory: boolean;
303
- /**
304
- * are we a collection (set, map, array, object)
305
- */
306
- collection: boolean;
307
- /**
308
- * should the value be shown
309
- */
310
- private?: boolean | undefined;
311
- /**
312
- * any type of credential
313
- */
314
- credential?: boolean | undefined;
315
- /**
316
- * should we be stored (especially critical for credentials)
317
- */
318
- persistent?: boolean | undefined;
319
- backpointer?: AttributeDefinition | undefined;
320
- /**
321
- * (collection) constructor
322
- */
323
- constructor?: Function | undefined;
324
- /**
325
- * name of an attribute we depend on
326
- */
327
- depends?: string | undefined;
328
- /**
329
- * human readable
330
- */
331
- description?: string | undefined;
332
- /**
333
- * the default value
334
- */
335
- default?: any;
336
- /**
337
- * set the value
338
- */
339
- set?: Function | undefined;
340
- /**
341
- * get the value can be used to calculate default values
342
- */
343
- get?: Function | undefined;
344
- toInternal?: Function | undefined;
345
- toExternal?: Function | undefined;
346
- /**
347
- * attribute name used by external system
348
- */
349
- externalName?: string | undefined;
350
- /**
351
- * allowed values
352
- */
353
- values?: Set<any> | undefined;
354
- /**
355
- * environment variable(s) used to provide the value
356
- */
357
- env?: string | string[] | undefined;
358
- /**
359
- * other values to be set in case our attribute is set
360
- */
361
- additionalValues?: object | undefined;
362
- /**
363
- * separator for collections
364
- */
365
- separator?: string | undefined;
366
- };
367
- export { description_attribute as description_attribute_writable, boolean_attribute_writable_true as active_attribute, secret_attribute as certificate_attribute, integer_attribute as count_attribute, integer_attribute_writable as count_attribute_writable, priority_attribute as priority_attribute_writable };
409
+ export declare const language_attribute: AttributeDefinition;
@@ -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: Object, attributes: Object, instanceIdentifier: string): Object | undefined;
8
+ export declare function environmentValues(env: Object, attributes: Object, instanceIdentifier: string): Object | undefined;
@@ -1,27 +1,38 @@
1
+ declare class _Dummy {
2
+ }
3
+ /**
4
+ * Default expand context
5
+ * using '§{' and '}' as lead in/out
6
+ */
7
+ export declare const expandContextDefault: {
8
+ root: {};
9
+ leadIn: string;
10
+ leadOut: string;
11
+ stopClass: typeof _Dummy;
12
+ };
13
+ /**
14
+ * Expand context with doubble curly separaion '{{' '}}'
15
+ */
16
+ export declare const expandContextDoubbleCurly: {
17
+ root: {};
18
+ stopClass: typeof _Dummy;
19
+ leadIn: string;
20
+ leadOut: string;
21
+ };
1
22
  /**
2
23
  * Expand expressions inside of object graphs.
3
24
  * @param {any} object
4
25
  * @param {Object} context
5
26
  * @param {any} [context.root] actual replacement values
6
- * @param {function} [context.stopClass]
27
+ * @param {function} [context.stopClass] do not expand instancif
7
28
  * @param {string} [context.leadIn] starting separator
8
29
  * @param {string} [context.leadOut] ending separator
9
30
  * @returns {any|Promise<any>}
10
31
  */
11
- export function expand(object: any, context: {
32
+ export declare function expand(object: any, context: {
12
33
  root?: any;
13
- stopClass?: Function | undefined;
14
- leadIn?: string | undefined;
15
- leadOut?: string | undefined;
34
+ stopClass?: Function;
35
+ leadIn?: string;
36
+ leadOut?: string;
16
37
  }): any | Promise<any>;
17
- export namespace expandContextDefault {
18
- let root: {};
19
- let leadIn: string;
20
- let leadOut: string;
21
- }
22
- export namespace expandContextDoubbleCurly {
23
- let leadIn_1: string;
24
- export { leadIn_1 as leadIn };
25
- let leadOut_1: string;
26
- export { leadOut_1 as leadOut };
27
- }
38
+ export {};
@@ -1 +1 @@
1
- export function extract(object: any, type?: any): {};
1
+ export declare function extract(object: any, type?: any): {};
@@ -3,4 +3,4 @@
3
3
  * @param {Object} [filterBy]
4
4
  * @returns {Function}
5
5
  */
6
- export function filter(filterBy?: Object): Function;
6
+ export declare 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: Object, source: Object, definitions: Object, cb: Function | null): void;
8
+ export declare 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: Object, source: Object, definitions: Objec
13
13
  * @param {Function} [filter]
14
14
  * @return {Object} values
15
15
  */
16
- export function getAttributes(object: Object, definitions: Object, filter?: Function): Object;
16
+ export declare 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: Object, definitions: Object, filter?: Func
21
21
  * @param {Function} [filter]
22
22
  * @return {Object} values
23
23
  */
24
- export function getAttributesJSON(object: Object, definitions: Object, filter?: Function): Object;
24
+ export declare function getAttributesJSON(object: Object, definitions: Object, filter?: Function): Object;
@@ -1,2 +1,2 @@
1
- export function parseOnly(input: any, context: any): any;
2
- export function parse(input: any, context?: {}): any;
1
+ export declare function parseOnly(input: any, context: any): any;
2
+ export declare function parse(input: any, context?: {}): any;
@@ -1 +1 @@
1
- export function definePropertiesFromAttributes(object: any, attributes: any, initialValues: any, properties?: {}): void;
1
+ export declare function definePropertiesFromAttributes(object: any, attributes: any, initialValues: any, properties?: {}): void;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @typedef {import('./tokens.mjs').Token} Token
3
+ */
4
+ export type Token = import('./tokens.mjs').Token;
1
5
  /**
2
6
  * Set object attribute.
3
7
  * The name may be a property path like 'a.b.c'.
@@ -6,7 +10,7 @@
6
10
  * @param {any} value
7
11
  * @param {Object} [definition] type def
8
12
  */
9
- export function setAttribute(object: Object, expression: string, value: any, definition?: Object): void;
13
+ export declare function setAttribute(object: Object, expression: string, value: any, definition?: Object): void;
10
14
  /**
11
15
  * Deliver attribute value.
12
16
  * The name may be a property path like 'a.b.c' or a[2]
@@ -15,7 +19,7 @@ export function setAttribute(object: Object, expression: string, value: any, def
15
19
  * @param {Object} [definition]
16
20
  * @returns {any} value associated with the given property name
17
21
  */
18
- export function getAttribute(object: Object, expression: string, definition?: Object): any;
22
+ export declare function getAttribute(object: Object, expression: string, definition?: Object): any;
19
23
  /**
20
24
  * Deliver attribute value and operator.
21
25
  * The name may be a property path like 'a.b.c <='.
@@ -23,5 +27,4 @@ export function getAttribute(object: Object, expression: string, definition?: Ob
23
27
  * @param {string} expression
24
28
  * @returns {[any,Token]} value associated with the given property name
25
29
  */
26
- export function getAttributeAndOperator(object: Object, expression: string): [any, Token];
27
- export type Token = import("./tokens.mjs").Token;
30
+ export declare function getAttributeAndOperator(object: Object, expression: string): [any, Token];
package/types/time.d.mts CHANGED
@@ -3,16 +3,16 @@
3
3
  * @param {number|string} value
4
4
  * @returns {number} seconds
5
5
  */
6
- export function parseDuration(value: number | string): number;
6
+ export declare function parseDuration(value: number | string): number;
7
7
  /**
8
8
  *
9
9
  * @param {number} seconds
10
10
  * @returns {string} formatted duration
11
11
  */
12
- export function formatDuration(seconds: number): string;
12
+ export declare function formatDuration(seconds: number): string;
13
13
  /**
14
14
  *
15
15
  * @param {number} seconds
16
16
  * @returns {string} formatted duration
17
17
  */
18
- export function formatDurationISO(seconds: number): string;
18
+ export declare function formatDurationISO(seconds: number): string;
@@ -1,3 +1,77 @@
1
+ export type Token = {
2
+ str: string;
3
+ precedence: number;
4
+ led: Function;
5
+ nud: Function;
6
+ };
7
+ /**
8
+ * @typedef {Object} Token
9
+ * @property {string} str
10
+ * @property {number} precedence
11
+ * @property {Function} led
12
+ * @property {Function} nud
13
+ *
14
+ */
15
+ /**
16
+ *
17
+ * @param {Token} token
18
+ */
19
+ export declare function registerToken(token: Token): Token;
20
+ export declare const PLUS: Token;
21
+ export declare const MINUS: Token;
22
+ export declare const STAR: Token;
23
+ export declare const DIVIDE: Token;
24
+ export declare const NOT: Token;
25
+ export declare const NOT_EQUAL: Token;
26
+ export declare const EQUAL: Token;
27
+ export declare const GREATER: Token;
28
+ export declare const GREATER_EQUAL: Token;
29
+ export declare const LESS: Token;
30
+ export declare const LESS_EQUAL: Token;
31
+ export declare const OPEN_ROUND: Token;
32
+ export declare const CLOSE_ROUND: Token;
33
+ export declare const OPEN_BRACKET: Token;
34
+ export declare const CLOSE_BRACKET: Token;
35
+ export declare const OPEN_CURLY: Token;
36
+ export declare const CLOSE_CURLY: Token;
37
+ export declare const QUESTION: Token;
38
+ export declare const COLON: Token;
39
+ export declare const SEMICOLON: Token;
40
+ export declare const COMMA: Token;
41
+ export declare const DOT: Token;
42
+ export declare const AMPERSAND: Token;
43
+ export declare const DOUBLE_AMPERSAND: Token;
44
+ export declare const BAR: Token;
45
+ export declare const DOUBLE_BAR: Token;
46
+ export declare const IDENTIFIER: Token;
47
+ export declare const STRING: Token;
48
+ export declare const NUMBER: Token;
49
+ export declare const BOOLEAN: Token;
50
+ export declare const EOF: Token;
51
+ export declare const keywords: {
52
+ true: (boolean | Token)[];
53
+ false: (boolean | Token)[];
54
+ };
55
+ export declare const globals: {
56
+ in: (args: any, current: any, context: any) => boolean;
57
+ ceil: (args: any, current: any, context: any) => number;
58
+ floor: (args: any, current: any, context: any) => number;
59
+ abs: (args: any, current: any, context: any) => number;
60
+ min: (args: any, current: any, context: any) => number;
61
+ max: (args: any, current: any, context: any) => number;
62
+ encodeURI: (args: any, current: any, context: any) => string;
63
+ decodeURI: (args: any, current: any, context: any) => string;
64
+ encodeURIComponent: (args: any, current: any, context: any) => string;
65
+ decodeURIComponent: (args: any, current: any, context: any) => string;
66
+ trim: (args: any, current: any, context: any) => any;
67
+ length: (args: any, current: any, context: any) => any;
68
+ uppercase: (args: any, current: any, context: any) => any;
69
+ lowercase: (args: any, current: any, context: any) => any;
70
+ substring: (args: any, current: any, context: any) => any;
71
+ join: (args: any, current: any, context: any) => any;
72
+ sort: (args: any, current: any, context: any) => any;
73
+ truncate: (args: any, current: any, context: any) => any;
74
+ };
1
75
  /**
2
76
  * Split expression path into tokens.
3
77
  * @generator
@@ -5,69 +79,4 @@
5
79
  * @param {Object} context
6
80
  * @yields {Token}
7
81
  */
8
- export function tokens(string: string, context: Object): Generator<any, void, unknown>;
9
- export namespace PLUS {
10
- let str: string;
11
- }
12
- export namespace MINUS {
13
- function nud(parser: any): number;
14
- }
15
- export namespace STAR { }
16
- export namespace DIVIDE { }
17
- export namespace NOT { }
18
- export namespace NOT_EQUAL { }
19
- export namespace EQUAL { }
20
- export namespace GREATER { }
21
- export namespace GREATER_EQUAL { }
22
- export namespace LESS { }
23
- export namespace LESS_EQUAL { }
24
- export namespace OPEN_ROUND { }
25
- export namespace CLOSE_ROUND { }
26
- export namespace OPEN_BRACKET { }
27
- export namespace CLOSE_BRACKET { }
28
- export namespace OPEN_CURLY { }
29
- export namespace CLOSE_CURLY { }
30
- export namespace QUESTION { }
31
- export namespace COLON { }
32
- export namespace SEMICOLON { }
33
- export namespace COMMA { }
34
- export namespace DOT { }
35
- export namespace AMPERSAND { }
36
- export namespace DOUBLE_AMPERSAND { }
37
- export namespace BAR { }
38
- export namespace DOUBLE_BAR { }
39
- export namespace IDENTIFIER { }
40
- export namespace STRING { }
41
- export namespace NUMBER { }
42
- export namespace BOOLEAN { }
43
- export namespace EOF { }
44
- export namespace keywords {
45
- let _true: (boolean | Token)[];
46
- export { _true as true };
47
- let _false: (boolean | Token)[];
48
- export { _false as false };
49
- }
50
- export namespace globals {
51
- export function _in(args: any, current: any, context: any): boolean;
52
- export { _in as in };
53
- export function ceil(args: any, current: any, context: any): number;
54
- export function floor(args: any, current: any, context: any): number;
55
- export function abs(args: any, current: any, context: any): number;
56
- export function min(args: any, current: any, context: any): number;
57
- export function max(args: any, current: any, context: any): number;
58
- export function encodeURI(args: any, current: any, context: any): string;
59
- export function decodeURI(args: any, current: any, context: any): string;
60
- export function encodeURIComponent(args: any, current: any, context: any): string;
61
- export function decodeURIComponent(args: any, current: any, context: any): string;
62
- export function trim(args: any, current: any, context: any): any;
63
- export function length(args: any, current: any, context: any): any;
64
- export function uppercase(args: any, current: any, context: any): any;
65
- export function lowercase(args: any, current: any, context: any): any;
66
- export function substring(args: any, current: any, context: any): any;
67
- export function join(args: any, current: any, context: any): any;
68
- export function sort(args: any, current: any, context: any): any;
69
- export function truncate(args: any, current: any, context: any): any;
70
- }
71
- export type Token = {
72
- str: string;
73
- };
82
+ export declare function tokens(string: string, context: Object): Generator<any, void, unknown>;
package/types/types.d.mts CHANGED
@@ -1,8 +1,25 @@
1
- export function addType(type: any): any;
2
- export function oneOfType(definition: any): any;
3
- export function resolveTypeLinks(): void;
4
- export function create(type: any, owner: any, data: any): any;
5
- export const types: {
1
+ import { parseBytes } from "./bytes.mjs";
2
+ export type Type = {
3
+ name: string;
4
+ primitive?: boolean;
5
+ extends?: Type;
6
+ members?: Set<Type>;
7
+ clazz?: Function;
8
+ toInternal?: Function;
9
+ toExternal?: Function;
10
+ };
11
+ /**
12
+ * @typedef {Object} Type
13
+ * @property {string} name
14
+ * @property {boolean} [primitive]
15
+ * @property {Type} [extends]
16
+ * @property {Set<Type>} [members]
17
+ * @property {Function} [clazz]
18
+ * @property {Function} [toInternal]
19
+ * @property {Function} [toExternal]
20
+ */
21
+ declare const emptyStringIsUndefined: (value: any) => any;
22
+ export declare const types: {
6
23
  string: {
7
24
  name: string;
8
25
  primitive: boolean;
@@ -54,20 +71,15 @@ export const types: {
54
71
  url: {
55
72
  name: string;
56
73
  primitive: boolean;
57
- toInternal: (value: any) => any;
74
+ toInternal: typeof emptyStringIsUndefined;
58
75
  };
59
76
  object: {
60
77
  name: string;
61
78
  primitive: boolean;
62
79
  };
63
80
  };
64
- export type Type = {
65
- name: string;
66
- primitive?: boolean | undefined;
67
- extends?: Type | undefined;
68
- members?: Set<Type> | undefined;
69
- clazz?: Function | undefined;
70
- toInternal?: Function | undefined;
71
- toExternal?: Function | undefined;
72
- };
73
- import { parseBytes } from "./bytes.mjs";
81
+ export declare function addType(type: any): any;
82
+ export declare function oneOfType(definition: any): any;
83
+ export declare function resolveTypeLinks(): void;
84
+ export declare function create(type: any, owner: any, data: any): any;
85
+ export {};