@ifc-lite/encoding 1.16.0 → 2.0.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
@@ -34,7 +34,7 @@ parsePropertyValue(['IFCBOOLEAN', '.T.']); // { displayValue: 'True', ifcType: .
34
34
  - `generateIfcGuid`, `generateUuid`: new identifiers
35
35
  - `uuidToIfcGuid`, `ifcGuidToUuid`: convert between UUIDs and 22-char IFC GUIDs
36
36
  - `isValidIfcGuid`, `isValidUuid`: validation
37
- - `parsePropertyValue`: turn raw STEP property values (typed arrays, `.T.`/`.F.`, enums) into a display string plus optional IFC type name
37
+ - `parsePropertyValue`: turn a parsed STEP property value (typed arrays, `.T.`/`.F.`, enums) into a display string plus optional IFC type name. It does **not** decode `\X2\`-style escapes: every ifc-lite parse path already decodes exactly once, at the parse boundary, and decoding a second time would collapse an authored `\\` a second time. Pass a still-encoded literal through `decodeIfcString` first.
38
38
 
39
39
  ## Links
40
40
 
@@ -11,9 +11,23 @@ export interface ParsedPropertyValue {
11
11
  * Handles:
12
12
  * - TypedValues like [IFCIDENTIFIER, '100 x 150mm'] -> display '100 x 150mm', tooltip 'Identifier'
13
13
  * - Boolean enums like '.T.' -> 'True'
14
- * - IFC encoded strings with \X2\, \X\ escape sequences
15
14
  * - Null/undefined -> '\u2014'
16
15
  * - Regular values -> string conversion
16
+ *
17
+ * It deliberately does NOT decode STEP escapes. Every producer of a property
18
+ * value decodes exactly once, at parse time: the TypeScript path via
19
+ * `EntityExtractor.parseAttributeValue` / `columnar-parser-attributes.ts`, the
20
+ * Rust/WASM and server paths via `AttributeValue::from_token`. The input here
21
+ * is therefore already literal text, and decoding a second time is not a no-op
22
+ * \u2014 since #2394 `decodeIfcString` collapses `\\` to `\`, so an authored UNC
23
+ * path `\\server\share` would render as `\server\share`. `C:\temp` is a fixed
24
+ * point of the decoder, which is why the defect hides on the common case.
25
+ *
26
+ * Making the decoder idempotent instead would not work: idempotence requires
27
+ * treating an already-decoded `\` and an authored, still-doubled `\\` the same
28
+ * way, which is exactly the ambiguity the one-decode rule removes. The
29
+ * invariant to hold is "decode once, at the parse boundary", not "decode
30
+ * defensively wherever a string is displayed".
17
31
  */
18
32
  export declare function parsePropertyValue(value: unknown): ParsedPropertyValue;
19
33
  //# sourceMappingURL=property-value.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"property-value.d.ts","sourceRoot":"","sources":["../src/property-value.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuCD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAqEtE"}
1
+ {"version":3,"file":"property-value.d.ts","sourceRoot":"","sources":["../src/property-value.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAqEtE"}
@@ -1,7 +1,6 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- import { decodeIfcString } from './ifc-string.js';
5
4
  /**
6
5
  * Map of IFC boolean enumeration values to human-readable text
7
6
  */
@@ -42,9 +41,23 @@ const IFC_TYPE_DISPLAY_NAMES = {
42
41
  * Handles:
43
42
  * - TypedValues like [IFCIDENTIFIER, '100 x 150mm'] -> display '100 x 150mm', tooltip 'Identifier'
44
43
  * - Boolean enums like '.T.' -> 'True'
45
- * - IFC encoded strings with \X2\, \X\ escape sequences
46
44
  * - Null/undefined -> '\u2014'
47
45
  * - Regular values -> string conversion
46
+ *
47
+ * It deliberately does NOT decode STEP escapes. Every producer of a property
48
+ * value decodes exactly once, at parse time: the TypeScript path via
49
+ * `EntityExtractor.parseAttributeValue` / `columnar-parser-attributes.ts`, the
50
+ * Rust/WASM and server paths via `AttributeValue::from_token`. The input here
51
+ * is therefore already literal text, and decoding a second time is not a no-op
52
+ * \u2014 since #2394 `decodeIfcString` collapses `\\` to `\`, so an authored UNC
53
+ * path `\\server\share` would render as `\server\share`. `C:\temp` is a fixed
54
+ * point of the decoder, which is why the defect hides on the common case.
55
+ *
56
+ * Making the decoder idempotent instead would not work: idempotence requires
57
+ * treating an already-decoded `\` and an authored, still-doubled `\\` the same
58
+ * way, which is exactly the ambiguity the one-decode rule removes. The
59
+ * invariant to hold is "decode once, at the parse boundary", not "decode
60
+ * defensively wherever a string is displayed".
48
61
  */
49
62
  export function parsePropertyValue(value) {
50
63
  // Handle null/undefined
@@ -85,11 +98,11 @@ export function parsePropertyValue(value) {
85
98
  if (BOOLEAN_MAP[upperInner]) {
86
99
  return { displayValue: BOOLEAN_MAP[upperInner], ifcType: friendlyType };
87
100
  }
88
- // Decode IFC string encoding and return
89
- return { displayValue: decodeIfcString(innerValue), ifcType: friendlyType };
101
+ // Already decoded by the parse path (see the note on this function).
102
+ return { displayValue: innerValue, ifcType: friendlyType };
90
103
  }
91
- // Regular string - decode IFC encoding
92
- return { displayValue: decodeIfcString(value) };
104
+ // Already decoded by the parse path (see the note on this function).
105
+ return { displayValue: value };
93
106
  }
94
107
  // Handle native booleans
95
108
  if (typeof value === 'boolean') {
@@ -1 +1 @@
1
- {"version":3,"file":"property-value.js","sourceRoot":"","sources":["../src/property-value.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAWlD;;GAEG;AACH,MAAM,WAAW,GAA2B;IAC1C,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,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ACzB,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACxE,CAAC;IAED,iBAAiB;IACjB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACvC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE;YACxB,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC;QAClE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,2BAA2B;IAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/encoding",
3
- "version": "1.16.0",
3
+ "version": "2.0.0",
4
4
  "description": "IFC string encoding/decoding and property value parsing for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",