pacc 4.32.0 → 4.33.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
@@ -89,20 +89,22 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
89
89
  * [Parameters](#parameters-6)
90
90
  * [getAttributes](#getattributes)
91
91
  * [Parameters](#parameters-7)
92
+ * [getAttributesJSON](#getattributesjson)
93
+ * [Parameters](#parameters-8)
92
94
  * [tokens](#tokens)
93
95
  * [tokens](#tokens-1)
94
- * [Parameters](#parameters-8)
95
- * [setAttribute](#setattribute)
96
96
  * [Parameters](#parameters-9)
97
- * [getAttribute](#getattribute)
97
+ * [setAttribute](#setattribute)
98
98
  * [Parameters](#parameters-10)
99
- * [getAttributeAndOperator](#getattributeandoperator)
99
+ * [getAttribute](#getattribute)
100
100
  * [Parameters](#parameters-11)
101
+ * [getAttributeAndOperator](#getattributeandoperator)
102
+ * [Parameters](#parameters-12)
101
103
  * [lookup](#lookup)
102
104
  * [Token](#token)
103
105
  * [Properties](#properties-1)
104
106
  * [createToken](#createtoken)
105
- * [Parameters](#parameters-12)
107
+ * [Parameters](#parameters-13)
106
108
  * [PLUS](#plus)
107
109
  * [MINUS](#minus)
108
110
  * [STAR](#star)
@@ -438,6 +440,17 @@ Retrive attribute values from an object.
438
440
 
439
441
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
440
442
 
443
+ ## getAttributesJSON
444
+
445
+ Retrive attribute values from an object.
446
+
447
+ ### Parameters
448
+
449
+ * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute value source
450
+ * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
451
+
452
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
453
+
441
454
  ## tokens
442
455
 
443
456
  ## tokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.32.0",
3
+ "version": "4.33.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.9.2"
47
47
  },
48
48
  "engines": {
49
- "node": ">=22.19.0"
49
+ "node": ">=22.19.5"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",
@@ -16,7 +16,10 @@ export const types = {
16
16
  name: "boolean",
17
17
  extends: "base",
18
18
  prepareValue: value =>
19
- !value || value === "0" || value === "false" || value === "no"
19
+ !value ||
20
+ value === "0" ||
21
+ value === "false" ||
22
+ value === "no"
20
23
  ? false
21
24
  : true
22
25
  },
@@ -46,7 +49,9 @@ export function prepareAttributesDefinitions(
46
49
  presentDefinitions
47
50
  ) {
48
51
  for (const [path, def] of attributeIterator(newDefinitions)) {
49
- def.type = types[def.type] || types.base;
52
+ if (typeof def.type === "string") {
53
+ def.type = types[def.type] || types.base;
54
+ }
50
55
  }
51
56
 
52
57
  return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
@@ -1,7 +1,9 @@
1
+ import { types } from "./attributes.mjs";
2
+
1
3
  /**
2
4
  * @typedef {Object} AttributeDefinition
3
5
  *
4
- * @property {string} type
6
+ * @property {object} type
5
7
  * @property {boolean} isKey
6
8
  * @property {boolean} writable
7
9
  * @property {boolean} mandatory
@@ -24,7 +26,7 @@
24
26
  * @type {AttributeDefinition}
25
27
  */
26
28
  export const default_attribute = {
27
- type: "string",
29
+ type: types.string,
28
30
  writable: false,
29
31
  mandatory: false,
30
32
  collection: false,
@@ -115,12 +117,20 @@ export { default_attribute as type_attribute };
115
117
  */
116
118
  export { default_attribute_writable as state_attribute };
117
119
 
120
+ /**
121
+ * @type {AttributeDefinition}
122
+ */
123
+ export const boolean_attribute = {
124
+ ...default_attribute,
125
+ type: types.boolean
126
+ };
127
+
118
128
  /**
119
129
  * @type {AttributeDefinition}
120
130
  */
121
131
  export const boolean_attribute_writable = {
122
132
  ...default_attribute_writable,
123
- type: "boolean"
133
+ type: types.boolean
124
134
  };
125
135
 
126
136
  /**
@@ -139,8 +149,6 @@ export const boolean_attribute_writable_false = {
139
149
  default: false
140
150
  };
141
151
 
142
- export { boolean_attribute_writable_false as boolean_attribute };
143
-
144
152
  /**
145
153
  * @type {AttributeDefinition}
146
154
  */
@@ -159,7 +167,7 @@ export { boolean_attribute_writable_true as active_attribute };
159
167
  */
160
168
  export const empty_attribute = {
161
169
  ...default_attribute,
162
- type: "boolean"
170
+ type: types.boolean
163
171
  };
164
172
 
165
173
  /**
@@ -219,7 +227,7 @@ export const public_key_attribute = {
219
227
  /**
220
228
  * @type {AttributeDefinition}
221
229
  */
222
- export const number_attribute = { ...default_attribute, type: "number" };
230
+ export const number_attribute = { ...default_attribute, type: types.number };
223
231
 
224
232
  /**
225
233
  * @type {AttributeDefinition}
@@ -232,7 +240,7 @@ export const number_attribute_writable = {
232
240
  /**
233
241
  * @type {AttributeDefinition}
234
242
  */
235
- export const integer_attribute = { ...default_attribute, type: "integer" };
243
+ export const integer_attribute = { ...default_attribute, type: types.integer };
236
244
 
237
245
  /**
238
246
  * @type {AttributeDefinition}
@@ -255,21 +263,21 @@ export { integer_attribute as size_attribute };
255
263
  /**
256
264
  * @type {AttributeDefinition}
257
265
  */
258
- export const object_attribute = { ...default_attribute, type: "object" };
266
+ export const object_attribute = { ...default_attribute, type: types.object };
259
267
 
260
268
  /**
261
269
  * @type {AttributeDefinition}
262
270
  */
263
271
  export const url_attribute = {
264
272
  ...default_attribute,
265
- type: "url",
273
+ type: types.url,
266
274
  description: "home of the object"
267
275
  };
268
276
 
269
277
  /**
270
278
  * @type {AttributeDefinition}
271
279
  */
272
- export const url_attribute_writble = {
280
+ export const url_attribute_writable = {
273
281
  ...url_attribute,
274
282
  writable: true
275
283
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @typedef {Object} AttributeDefinition
3
3
  *
4
- * @property {string} type
4
+ * @property {object} type
5
5
  * @property {boolean} isKey
6
6
  * @property {boolean} writable
7
7
  * @property {boolean} mandatory
@@ -29,7 +29,7 @@ export const default_attribute: AttributeDefinition;
29
29
  export const default_attribute_writable: AttributeDefinition;
30
30
  export namespace string_collection_attribute {
31
31
  export let collection: boolean;
32
- export let type: string;
32
+ export let type: object;
33
33
  export let isKey: boolean;
34
34
  export let writable: boolean;
35
35
  export let mandatory: boolean;
@@ -72,6 +72,10 @@ export const version_attribute_writable: AttributeDefinition;
72
72
  * @type {AttributeDefinition}
73
73
  */
74
74
  export const description_attribute: AttributeDefinition;
75
+ /**
76
+ * @type {AttributeDefinition}
77
+ */
78
+ export const boolean_attribute: AttributeDefinition;
75
79
  /**
76
80
  * @type {AttributeDefinition}
77
81
  */
@@ -135,7 +139,7 @@ export const url_attribute: AttributeDefinition;
135
139
  /**
136
140
  * @type {AttributeDefinition}
137
141
  */
138
- export const url_attribute_writble: AttributeDefinition;
142
+ export const url_attribute_writable: AttributeDefinition;
139
143
  /**
140
144
  * @type {AttributeDefinition}
141
145
  */
@@ -169,7 +173,7 @@ export const timeout_attribute: AttributeDefinition;
169
173
  */
170
174
  export const language_attribute: AttributeDefinition;
171
175
  export type AttributeDefinition = {
172
- type: string;
176
+ type: object;
173
177
  isKey: boolean;
174
178
  writable: boolean;
175
179
  mandatory: boolean;
@@ -216,4 +220,4 @@ export type AttributeDefinition = {
216
220
  */
217
221
  additionalValues?: object;
218
222
  };
219
- export { default_attribute as string_attribute, default_attribute_writable as string_attribute_writable, default_attribute as type_attribute, default_attribute_writable as state_attribute, boolean_attribute_writable_false as boolean_attribute, boolean_attribute_writable_true as active_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 as size_attribute, default_attribute_writable as body_attribute, number_attribute as duration_attribute };
223
+ export { default_attribute as string_attribute, default_attribute_writable as string_attribute_writable, default_attribute as type_attribute, default_attribute_writable as state_attribute, boolean_attribute_writable_true as active_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 as size_attribute, default_attribute_writable as body_attribute, number_attribute as duration_attribute };