@bldrs-ai/conway 1.388.1220 → 1.398.1224

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.
Files changed (25) hide show
  1. package/compiled/examples/browser-bundled.cjs +60 -5
  2. package/compiled/examples/cli-bundled.cjs +60 -5
  3. package/compiled/examples/cli-step-bundled.cjs +60 -5
  4. package/compiled/examples/validator-bundled.cjs +60 -5
  5. package/compiled/src/compat/web-ifc/ap214_properties.d.ts.map +1 -1
  6. package/compiled/src/compat/web-ifc/ap214_properties.js +34 -1
  7. package/compiled/src/compat/web-ifc/ap214_properties.test.js +30 -0
  8. package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
  9. package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
  10. package/compiled/src/parsing/parsing_buffer.js +31 -0
  11. package/compiled/src/step/parsing/byte_source.d.ts +55 -0
  12. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
  13. package/compiled/src/step/parsing/byte_source.js +35 -0
  14. package/compiled/src/step/parsing/step_parser.d.ts +14 -0
  15. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  16. package/compiled/src/step/parsing/step_parser.js +41 -4
  17. package/compiled/src/step/parsing/streaming_index_builder.d.ts +60 -0
  18. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
  19. package/compiled/src/step/parsing/streaming_index_builder.js +115 -0
  20. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
  21. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
  22. package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
  23. package/compiled/src/version/version.js +1 -1
  24. package/compiled/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +1 -1
@@ -30,7 +30,7 @@ var import_node_process = require("node:process");
30
30
  var readline = __toESM(require("node:readline"), 1);
31
31
 
32
32
  // compiled/src/version/version.js
33
- var versionString = "Conway v1.388.1220";
33
+ var versionString = "Conway v1.398.1224";
34
34
 
35
35
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
36
36
  var wasmType = "";
@@ -1286,6 +1286,37 @@ var ParsingBuffer = class {
1286
1286
  this.buffer = buffer;
1287
1287
  this.end = endOffset;
1288
1288
  }
1289
+ /**
1290
+ * Streaming support: repoint this buffer at a fresh window over the same
1291
+ * logical stream while keeping `address` file-absolute.
1292
+ *
1293
+ * A moving-window parse holds only a slice of the source in memory at a
1294
+ * time. Between top-level records (where the rewind stack is empty) the
1295
+ * driver slides the window forward: it copies the unconsumed tail to the
1296
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
1297
+ * repoint the parser. `addressBase` is the file offset that window index 0
1298
+ * now corresponds to; we store it as a negative initial offset so
1299
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
1300
+ * non-streaming parse would have produced.
1301
+ *
1302
+ * Must only be called with the rewind stack empty (i.e. at a record
1303
+ * boundary) — the stack holds window-relative cursors that a slide would
1304
+ * invalidate. Throws otherwise.
1305
+ *
1306
+ * @param buffer The new window buffer.
1307
+ * @param cursorInWindow The cursor position within the new window.
1308
+ * @param endInWindow The count of valid bytes in the new window.
1309
+ * @param addressBase The file offset that window index 0 maps to.
1310
+ */
1311
+ rebaseWindow(buffer, cursorInWindow, endInWindow, addressBase) {
1312
+ if (this.rewindStack_.length !== 0) {
1313
+ throw Error("rebaseWindow called mid-transaction (rewind stack non-empty)");
1314
+ }
1315
+ this.buffer = buffer;
1316
+ this.cursor_ = cursorInWindow;
1317
+ this.initialOffset_ = -addressBase;
1318
+ this.end = endInWindow;
1319
+ }
1289
1320
  /**
1290
1321
  * Construct this with a buffer, initial offset into the buffer and an end offset.
1291
1322
  *
@@ -2538,6 +2569,29 @@ var StepParser = class extends StepHeaderParser {
2538
2569
  onProgress?.(next.value);
2539
2570
  }
2540
2571
  }
2572
+ /**
2573
+ * Streaming driver over parseDataBlockIncremental: identical parse (same
2574
+ * generator body) but invokes `onRecordBoundary` at every top-level record
2575
+ * boundary so a caller feeding the parser from a moving window can slide
2576
+ * that window forward while the rewind stack is empty. See
2577
+ * streaming_index_builder.ts for the coordinator that owns the window.
2578
+ *
2579
+ * @param input The input parsing buffer, positioned at the data section.
2580
+ * @param onRecordBoundary Called at each top-level record boundary with the
2581
+ * buffer; the callback may rebase the buffer's window in place.
2582
+ * @param onProgress Optional byte-cursor progress callback.
2583
+ * @return {BlockParseResult} The parsing result, including the index and result enum.
2584
+ */
2585
+ parseDataBlockStreamed(input2, onRecordBoundary, onProgress) {
2586
+ const parser211 = this.parseDataBlockIncremental(input2, onRecordBoundary);
2587
+ while (true) {
2588
+ const next = parser211.next();
2589
+ if (next.done === true) {
2590
+ return next.value;
2591
+ }
2592
+ onProgress?.(next.value);
2593
+ }
2594
+ }
2541
2595
  /**
2542
2596
  * Cooperative variant of parseDataBlock: identical parse (same generator
2543
2597
  * body), but periodically awaits a macrotask so the event loop can run —
@@ -2575,7 +2629,7 @@ var StepParser = class extends StepHeaderParser {
2575
2629
  * @yields {number} The current byte cursor within the input buffer.
2576
2630
  * @return {BlockParseResult} The parsing result, including the index and result enum.
2577
2631
  */
2578
- *parseDataBlockIncremental(input2) {
2632
+ *parseDataBlockIncremental(input2, onRecordBoundary) {
2579
2633
  const indexResult = { elements: [] };
2580
2634
  const match = input2.match;
2581
2635
  const comment = () => match(commentParser2);
@@ -2622,7 +2676,7 @@ var StepParser = class extends StepHeaderParser {
2622
2676
  return syntaxError();
2623
2677
  }
2624
2678
  whitespace();
2625
- const startElement = input2.cursor;
2679
+ const startElement = input2.address;
2626
2680
  let stackDepth = 1;
2627
2681
  const savedInlineElements = inlineElements;
2628
2682
  inlineElements = void 0;
@@ -2716,6 +2770,7 @@ var StepParser = class extends StepHeaderParser {
2716
2770
  if ((++parsedElementCount & PARSE_PROGRESS_ELEMENT_MASK) === 0) {
2717
2771
  yield input2.cursor;
2718
2772
  }
2773
+ onRecordBoundary?.(input2);
2719
2774
  if (!charws(HASH2)) {
2720
2775
  if (tokenws(END_SECTION)) {
2721
2776
  return parseResult2(ParseResult.COMPLETE);
@@ -2738,7 +2793,7 @@ var StepParser = class extends StepHeaderParser {
2738
2793
  }
2739
2794
  whitespace();
2740
2795
  inlineElements = void 0;
2741
- const startElement2 = input2.cursor;
2796
+ const startElement2 = input2.address;
2742
2797
  while (!charws(CLOSE_PAREN2)) {
2743
2798
  input2.begin();
2744
2799
  const elementResult = parseInlineElement(expressID);
@@ -2769,7 +2824,7 @@ var StepParser = class extends StepHeaderParser {
2769
2824
  return syntaxError();
2770
2825
  }
2771
2826
  whitespace();
2772
- const startElement = input2.cursor;
2827
+ const startElement = input2.address;
2773
2828
  let stackDepth = 1;
2774
2829
  inlineElements = void 0;
2775
2830
  while (stackDepth > 0) {
@@ -14965,7 +14965,7 @@ ${t5.join("\n")}` : "";
14965
14965
  var import_process = require("process");
14966
14966
 
14967
14967
  // compiled/src/version/version.js
14968
- var versionString = "Conway v1.388.1220";
14968
+ var versionString = "Conway v1.398.1224";
14969
14969
 
14970
14970
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
14971
14971
  function pThreadsAllowed() {
@@ -17100,6 +17100,37 @@ var ParsingBuffer = class {
17100
17100
  this.buffer = buffer;
17101
17101
  this.end = endOffset;
17102
17102
  }
17103
+ /**
17104
+ * Streaming support: repoint this buffer at a fresh window over the same
17105
+ * logical stream while keeping `address` file-absolute.
17106
+ *
17107
+ * A moving-window parse holds only a slice of the source in memory at a
17108
+ * time. Between top-level records (where the rewind stack is empty) the
17109
+ * driver slides the window forward: it copies the unconsumed tail to the
17110
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
17111
+ * repoint the parser. `addressBase` is the file offset that window index 0
17112
+ * now corresponds to; we store it as a negative initial offset so
17113
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
17114
+ * non-streaming parse would have produced.
17115
+ *
17116
+ * Must only be called with the rewind stack empty (i.e. at a record
17117
+ * boundary) — the stack holds window-relative cursors that a slide would
17118
+ * invalidate. Throws otherwise.
17119
+ *
17120
+ * @param buffer The new window buffer.
17121
+ * @param cursorInWindow The cursor position within the new window.
17122
+ * @param endInWindow The count of valid bytes in the new window.
17123
+ * @param addressBase The file offset that window index 0 maps to.
17124
+ */
17125
+ rebaseWindow(buffer, cursorInWindow, endInWindow, addressBase) {
17126
+ if (this.rewindStack_.length !== 0) {
17127
+ throw Error("rebaseWindow called mid-transaction (rewind stack non-empty)");
17128
+ }
17129
+ this.buffer = buffer;
17130
+ this.cursor_ = cursorInWindow;
17131
+ this.initialOffset_ = -addressBase;
17132
+ this.end = endInWindow;
17133
+ }
17103
17134
  /**
17104
17135
  * Construct this with a buffer, initial offset into the buffer and an end offset.
17105
17136
  *
@@ -18352,6 +18383,29 @@ var StepParser = class extends StepHeaderParser {
18352
18383
  onProgress?.(next.value);
18353
18384
  }
18354
18385
  }
18386
+ /**
18387
+ * Streaming driver over parseDataBlockIncremental: identical parse (same
18388
+ * generator body) but invokes `onRecordBoundary` at every top-level record
18389
+ * boundary so a caller feeding the parser from a moving window can slide
18390
+ * that window forward while the rewind stack is empty. See
18391
+ * streaming_index_builder.ts for the coordinator that owns the window.
18392
+ *
18393
+ * @param input The input parsing buffer, positioned at the data section.
18394
+ * @param onRecordBoundary Called at each top-level record boundary with the
18395
+ * buffer; the callback may rebase the buffer's window in place.
18396
+ * @param onProgress Optional byte-cursor progress callback.
18397
+ * @return {BlockParseResult} The parsing result, including the index and result enum.
18398
+ */
18399
+ parseDataBlockStreamed(input, onRecordBoundary, onProgress) {
18400
+ const parser210 = this.parseDataBlockIncremental(input, onRecordBoundary);
18401
+ while (true) {
18402
+ const next = parser210.next();
18403
+ if (next.done === true) {
18404
+ return next.value;
18405
+ }
18406
+ onProgress?.(next.value);
18407
+ }
18408
+ }
18355
18409
  /**
18356
18410
  * Cooperative variant of parseDataBlock: identical parse (same generator
18357
18411
  * body), but periodically awaits a macrotask so the event loop can run —
@@ -18389,7 +18443,7 @@ var StepParser = class extends StepHeaderParser {
18389
18443
  * @yields {number} The current byte cursor within the input buffer.
18390
18444
  * @return {BlockParseResult} The parsing result, including the index and result enum.
18391
18445
  */
18392
- *parseDataBlockIncremental(input) {
18446
+ *parseDataBlockIncremental(input, onRecordBoundary) {
18393
18447
  const indexResult = { elements: [] };
18394
18448
  const match = input.match;
18395
18449
  const comment = () => match(commentParser2);
@@ -18436,7 +18490,7 @@ var StepParser = class extends StepHeaderParser {
18436
18490
  return syntaxError();
18437
18491
  }
18438
18492
  whitespace();
18439
- const startElement = input.cursor;
18493
+ const startElement = input.address;
18440
18494
  let stackDepth = 1;
18441
18495
  const savedInlineElements = inlineElements;
18442
18496
  inlineElements = void 0;
@@ -18530,6 +18584,7 @@ var StepParser = class extends StepHeaderParser {
18530
18584
  if ((++parsedElementCount & PARSE_PROGRESS_ELEMENT_MASK) === 0) {
18531
18585
  yield input.cursor;
18532
18586
  }
18587
+ onRecordBoundary?.(input);
18533
18588
  if (!charws(HASH2)) {
18534
18589
  if (tokenws(END_SECTION)) {
18535
18590
  return parseResult(ParseResult.COMPLETE);
@@ -18552,7 +18607,7 @@ var StepParser = class extends StepHeaderParser {
18552
18607
  }
18553
18608
  whitespace();
18554
18609
  inlineElements = void 0;
18555
- const startElement2 = input.cursor;
18610
+ const startElement2 = input.address;
18556
18611
  while (!charws(CLOSE_PAREN2)) {
18557
18612
  input.begin();
18558
18613
  const elementResult = parseInlineElement(expressID);
@@ -18583,7 +18638,7 @@ var StepParser = class extends StepHeaderParser {
18583
18638
  return syntaxError();
18584
18639
  }
18585
18640
  whitespace();
18586
- const startElement = input.cursor;
18641
+ const startElement = input.address;
18587
18642
  let stackDepth = 1;
18588
18643
  inlineElements = void 0;
18589
18644
  while (stackDepth > 0) {
@@ -15554,6 +15554,37 @@ var ParsingBuffer = class {
15554
15554
  this.buffer = buffer;
15555
15555
  this.end = endOffset;
15556
15556
  }
15557
+ /**
15558
+ * Streaming support: repoint this buffer at a fresh window over the same
15559
+ * logical stream while keeping `address` file-absolute.
15560
+ *
15561
+ * A moving-window parse holds only a slice of the source in memory at a
15562
+ * time. Between top-level records (where the rewind stack is empty) the
15563
+ * driver slides the window forward: it copies the unconsumed tail to the
15564
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
15565
+ * repoint the parser. `addressBase` is the file offset that window index 0
15566
+ * now corresponds to; we store it as a negative initial offset so
15567
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
15568
+ * non-streaming parse would have produced.
15569
+ *
15570
+ * Must only be called with the rewind stack empty (i.e. at a record
15571
+ * boundary) — the stack holds window-relative cursors that a slide would
15572
+ * invalidate. Throws otherwise.
15573
+ *
15574
+ * @param buffer The new window buffer.
15575
+ * @param cursorInWindow The cursor position within the new window.
15576
+ * @param endInWindow The count of valid bytes in the new window.
15577
+ * @param addressBase The file offset that window index 0 maps to.
15578
+ */
15579
+ rebaseWindow(buffer, cursorInWindow, endInWindow, addressBase) {
15580
+ if (this.rewindStack_.length !== 0) {
15581
+ throw Error("rebaseWindow called mid-transaction (rewind stack non-empty)");
15582
+ }
15583
+ this.buffer = buffer;
15584
+ this.cursor_ = cursorInWindow;
15585
+ this.initialOffset_ = -addressBase;
15586
+ this.end = endInWindow;
15587
+ }
15557
15588
  /**
15558
15589
  * Construct this with a buffer, initial offset into the buffer and an end offset.
15559
15590
  *
@@ -15912,7 +15943,7 @@ var ParsingBuffer = class {
15912
15943
  };
15913
15944
 
15914
15945
  // compiled/src/version/version.js
15915
- var versionString = "Conway v1.388.1220";
15946
+ var versionString = "Conway v1.398.1224";
15916
15947
 
15917
15948
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
15918
15949
  function pThreadsAllowed() {
@@ -18260,6 +18291,29 @@ var StepParser = class extends StepHeaderParser {
18260
18291
  onProgress?.(next.value);
18261
18292
  }
18262
18293
  }
18294
+ /**
18295
+ * Streaming driver over parseDataBlockIncremental: identical parse (same
18296
+ * generator body) but invokes `onRecordBoundary` at every top-level record
18297
+ * boundary so a caller feeding the parser from a moving window can slide
18298
+ * that window forward while the rewind stack is empty. See
18299
+ * streaming_index_builder.ts for the coordinator that owns the window.
18300
+ *
18301
+ * @param input The input parsing buffer, positioned at the data section.
18302
+ * @param onRecordBoundary Called at each top-level record boundary with the
18303
+ * buffer; the callback may rebase the buffer's window in place.
18304
+ * @param onProgress Optional byte-cursor progress callback.
18305
+ * @return {BlockParseResult} The parsing result, including the index and result enum.
18306
+ */
18307
+ parseDataBlockStreamed(input, onRecordBoundary, onProgress) {
18308
+ const parser28 = this.parseDataBlockIncremental(input, onRecordBoundary);
18309
+ while (true) {
18310
+ const next = parser28.next();
18311
+ if (next.done === true) {
18312
+ return next.value;
18313
+ }
18314
+ onProgress?.(next.value);
18315
+ }
18316
+ }
18263
18317
  /**
18264
18318
  * Cooperative variant of parseDataBlock: identical parse (same generator
18265
18319
  * body), but periodically awaits a macrotask so the event loop can run —
@@ -18297,7 +18351,7 @@ var StepParser = class extends StepHeaderParser {
18297
18351
  * @yields {number} The current byte cursor within the input buffer.
18298
18352
  * @return {BlockParseResult} The parsing result, including the index and result enum.
18299
18353
  */
18300
- *parseDataBlockIncremental(input) {
18354
+ *parseDataBlockIncremental(input, onRecordBoundary) {
18301
18355
  const indexResult = { elements: [] };
18302
18356
  const match = input.match;
18303
18357
  const comment = () => match(commentParser2);
@@ -18344,7 +18398,7 @@ var StepParser = class extends StepHeaderParser {
18344
18398
  return syntaxError();
18345
18399
  }
18346
18400
  whitespace();
18347
- const startElement = input.cursor;
18401
+ const startElement = input.address;
18348
18402
  let stackDepth = 1;
18349
18403
  const savedInlineElements = inlineElements;
18350
18404
  inlineElements = void 0;
@@ -18438,6 +18492,7 @@ var StepParser = class extends StepHeaderParser {
18438
18492
  if ((++parsedElementCount & PARSE_PROGRESS_ELEMENT_MASK) === 0) {
18439
18493
  yield input.cursor;
18440
18494
  }
18495
+ onRecordBoundary?.(input);
18441
18496
  if (!charws(HASH2)) {
18442
18497
  if (tokenws(END_SECTION)) {
18443
18498
  return parseResult(ParseResult.COMPLETE);
@@ -18460,7 +18515,7 @@ var StepParser = class extends StepHeaderParser {
18460
18515
  }
18461
18516
  whitespace();
18462
18517
  inlineElements = void 0;
18463
- const startElement2 = input.cursor;
18518
+ const startElement2 = input.address;
18464
18519
  while (!charws(CLOSE_PAREN2)) {
18465
18520
  input.begin();
18466
18521
  const elementResult = parseInlineElement(expressID);
@@ -18491,7 +18546,7 @@ var StepParser = class extends StepHeaderParser {
18491
18546
  return syntaxError();
18492
18547
  }
18493
18548
  whitespace();
18494
- const startElement = input.cursor;
18549
+ const startElement = input.address;
18495
18550
  let stackDepth = 1;
18496
18551
  inlineElements = void 0;
18497
18552
  while (stackDepth > 0) {
@@ -944,7 +944,7 @@ var EntityTypesIfcCount = 909;
944
944
  var entity_types_ifc_gen_default = EntityTypesIfc;
945
945
 
946
946
  // compiled/src/version/version.js
947
- var versionString = "Conway v1.388.1220";
947
+ var versionString = "Conway v1.398.1224";
948
948
 
949
949
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
950
950
  var wasmType = "";
@@ -2200,6 +2200,37 @@ var ParsingBuffer = class {
2200
2200
  this.buffer = buffer;
2201
2201
  this.end = endOffset;
2202
2202
  }
2203
+ /**
2204
+ * Streaming support: repoint this buffer at a fresh window over the same
2205
+ * logical stream while keeping `address` file-absolute.
2206
+ *
2207
+ * A moving-window parse holds only a slice of the source in memory at a
2208
+ * time. Between top-level records (where the rewind stack is empty) the
2209
+ * driver slides the window forward: it copies the unconsumed tail to the
2210
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
2211
+ * repoint the parser. `addressBase` is the file offset that window index 0
2212
+ * now corresponds to; we store it as a negative initial offset so
2213
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
2214
+ * non-streaming parse would have produced.
2215
+ *
2216
+ * Must only be called with the rewind stack empty (i.e. at a record
2217
+ * boundary) — the stack holds window-relative cursors that a slide would
2218
+ * invalidate. Throws otherwise.
2219
+ *
2220
+ * @param buffer The new window buffer.
2221
+ * @param cursorInWindow The cursor position within the new window.
2222
+ * @param endInWindow The count of valid bytes in the new window.
2223
+ * @param addressBase The file offset that window index 0 maps to.
2224
+ */
2225
+ rebaseWindow(buffer, cursorInWindow, endInWindow, addressBase) {
2226
+ if (this.rewindStack_.length !== 0) {
2227
+ throw Error("rebaseWindow called mid-transaction (rewind stack non-empty)");
2228
+ }
2229
+ this.buffer = buffer;
2230
+ this.cursor_ = cursorInWindow;
2231
+ this.initialOffset_ = -addressBase;
2232
+ this.end = endInWindow;
2233
+ }
2203
2234
  /**
2204
2235
  * Construct this with a buffer, initial offset into the buffer and an end offset.
2205
2236
  *
@@ -3452,6 +3483,29 @@ var StepParser = class extends StepHeaderParser {
3452
3483
  onProgress?.(next.value);
3453
3484
  }
3454
3485
  }
3486
+ /**
3487
+ * Streaming driver over parseDataBlockIncremental: identical parse (same
3488
+ * generator body) but invokes `onRecordBoundary` at every top-level record
3489
+ * boundary so a caller feeding the parser from a moving window can slide
3490
+ * that window forward while the rewind stack is empty. See
3491
+ * streaming_index_builder.ts for the coordinator that owns the window.
3492
+ *
3493
+ * @param input The input parsing buffer, positioned at the data section.
3494
+ * @param onRecordBoundary Called at each top-level record boundary with the
3495
+ * buffer; the callback may rebase the buffer's window in place.
3496
+ * @param onProgress Optional byte-cursor progress callback.
3497
+ * @return {BlockParseResult} The parsing result, including the index and result enum.
3498
+ */
3499
+ parseDataBlockStreamed(input, onRecordBoundary, onProgress) {
3500
+ const parser211 = this.parseDataBlockIncremental(input, onRecordBoundary);
3501
+ while (true) {
3502
+ const next = parser211.next();
3503
+ if (next.done === true) {
3504
+ return next.value;
3505
+ }
3506
+ onProgress?.(next.value);
3507
+ }
3508
+ }
3455
3509
  /**
3456
3510
  * Cooperative variant of parseDataBlock: identical parse (same generator
3457
3511
  * body), but periodically awaits a macrotask so the event loop can run —
@@ -3489,7 +3543,7 @@ var StepParser = class extends StepHeaderParser {
3489
3543
  * @yields {number} The current byte cursor within the input buffer.
3490
3544
  * @return {BlockParseResult} The parsing result, including the index and result enum.
3491
3545
  */
3492
- *parseDataBlockIncremental(input) {
3546
+ *parseDataBlockIncremental(input, onRecordBoundary) {
3493
3547
  const indexResult = { elements: [] };
3494
3548
  const match = input.match;
3495
3549
  const comment = () => match(commentParser2);
@@ -3536,7 +3590,7 @@ var StepParser = class extends StepHeaderParser {
3536
3590
  return syntaxError();
3537
3591
  }
3538
3592
  whitespace();
3539
- const startElement = input.cursor;
3593
+ const startElement = input.address;
3540
3594
  let stackDepth = 1;
3541
3595
  const savedInlineElements = inlineElements;
3542
3596
  inlineElements = void 0;
@@ -3630,6 +3684,7 @@ var StepParser = class extends StepHeaderParser {
3630
3684
  if ((++parsedElementCount & PARSE_PROGRESS_ELEMENT_MASK) === 0) {
3631
3685
  yield input.cursor;
3632
3686
  }
3687
+ onRecordBoundary?.(input);
3633
3688
  if (!charws(HASH2)) {
3634
3689
  if (tokenws(END_SECTION)) {
3635
3690
  return parseResult2(ParseResult.COMPLETE);
@@ -3652,7 +3707,7 @@ var StepParser = class extends StepHeaderParser {
3652
3707
  }
3653
3708
  whitespace();
3654
3709
  inlineElements = void 0;
3655
- const startElement2 = input.cursor;
3710
+ const startElement2 = input.address;
3656
3711
  while (!charws(CLOSE_PAREN2)) {
3657
3712
  input.begin();
3658
3713
  const elementResult = parseInlineElement(expressID);
@@ -3683,7 +3738,7 @@ var StepParser = class extends StepHeaderParser {
3683
3738
  return syntaxError();
3684
3739
  }
3685
3740
  whitespace();
3686
- const startElement = input.cursor;
3741
+ const startElement = input.address;
3687
3742
  let stackDepth = 1;
3688
3743
  inlineElements = void 0;
3689
3744
  while (stackDepth > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"ap214_properties.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/ap214_properties.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EACL,iBAAiB,EACjB,IAAI,EACJ,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AAiHjC;;;;;;;;;;;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IACG,sBAAsB,CAAE,SAAS,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAIpF;;;;;;;;;;OAUG;IACG,mBAAmB,CACrB,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,OAAO,CAAC,EAAE,uBAAuB,GAAI,OAAO,CAAC,IAAI,CAAC;IAwBtD;;;;;;OAMG;IACG,iBAAiB,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAmBzE;;;;;;;OAOG;YACW,aAAa;IAoC3B;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAmBtB;;;;;;;;;OASG;IACH;;;;;;OAMG;IACI,YAAY,IAAI,IAAI;IAI3B,OAAO,CAAC,YAAY;IA6BpB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAUlB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;;;;;;OAQG;IACH,OAAO,CAAC,0BAA0B;IAkBlC;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAQnB"}
@@ -1,5 +1,6 @@
1
1
  import { AP214ProductStructureExtraction, } from "../../AP214E3_2010/ap214_product_structure_extraction.js";
2
2
  import { AP214PropertyExtraction, } from "../../AP214E3_2010/ap214_property_extraction.js";
3
+ import EntityTypesAP214 from "../../AP214E3_2010/AP214E3_2010_gen/entity_types_ap214.gen.js";
3
4
  /**
4
5
  * web-ifc tape type codes `deref` switches on: 1 = string (decoded via
5
6
  * `decodeIFCString`), 4 = numeric measure (returned as-is).
@@ -84,9 +85,41 @@ export class AP214Properties {
84
85
  NominalValue: valueHandle(property.numericValue ?? property.value),
85
86
  };
86
87
  }
88
+ const nodeName = this.nodeNameByExpressID_.get(id);
89
+ if (nodeName !== void 0) {
90
+ return {
91
+ expressID: id,
92
+ Name: valueHandle(nodeName),
93
+ };
94
+ }
95
+ // Arbitrary-entity fallback: an id that is neither a property single nor
96
+ // a tree node — e.g. an *anonymous* solid or face a viewer picked
97
+ // (geometry below the ephemeral solid layer, issue #387). Resolve it
98
+ // through the model's O(1) express-id index and surface the STEP entity
99
+ // type name plus the item's own name (usually empty for anonymous
100
+ // geometry), so a consumer can synthesize a label like "Face #6321"
101
+ // without any tree or persisted state.
102
+ const element = this.api.StepModel.getElementByExpressID(id);
103
+ if (element !== void 0) {
104
+ let itemName = "";
105
+ try {
106
+ const candidate = element.name;
107
+ if (typeof candidate === "string") {
108
+ itemName = candidate;
109
+ }
110
+ }
111
+ catch {
112
+ // Malformed name attribute — the type name still identifies the item.
113
+ }
114
+ return {
115
+ expressID: id,
116
+ type: EntityTypesAP214[element.type],
117
+ Name: valueHandle(itemName),
118
+ };
119
+ }
87
120
  return {
88
121
  expressID: id,
89
- Name: valueHandle(this.nodeNameByExpressID_.get(id) ?? ""),
122
+ Name: valueHandle(""),
90
123
  };
91
124
  }
92
125
  /**
@@ -132,3 +132,33 @@ describe("compat/web-ifc/AP214Properties", () => {
132
132
  expect(await surface.getPropertySets(root.expressID)).toEqual([]);
133
133
  });
134
134
  });
135
+ describe("getItemProperties arbitrary-entity fallback (anonymous geometry)", () => {
136
+ test("resolves a non-tree solid id to its STEP type and body name", async () => {
137
+ // Body1 (#431) is a solid inside the widget product's representation —
138
+ // never a tree node unless the ephemeral solid layer is requested, so it
139
+ // exercises the express-id-index fallback a picked anonymous piece takes.
140
+ const surface = compatSurfaceFor("data/ap214-multibody-part.step");
141
+ const solidExpressId = 431;
142
+ const item = await surface.getItemProperties(solidExpressId);
143
+ expect(item.expressID).toBe(solidExpressId);
144
+ expect(item.type).toBe("MANIFOLD_SOLID_BREP");
145
+ expect(item.Name.value).toBe("Body1");
146
+ });
147
+ test("resolves an anonymous face id to its STEP type (label seed for #387)", async () => {
148
+ // NEMA face #29 has the placeholder name 'NONE' in-file; the type name is
149
+ // what lets a consumer synthesize "Face #29" for a picked face with no
150
+ // tree identity.
151
+ const surface = compatSurfaceFor("data/nema-23-76mm.step");
152
+ const faceExpressId = 29;
153
+ const item = await surface.getItemProperties(faceExpressId);
154
+ expect(item.expressID).toBe(faceExpressId);
155
+ expect(item.type).toBe("ADVANCED_FACE");
156
+ });
157
+ test("an unknown id still returns the bare identity shape", async () => {
158
+ const surface = compatSurfaceFor("data/ap214-multibody-part.step");
159
+ const item = await surface.getItemProperties(999999);
160
+ expect(item.expressID).toBe(999999);
161
+ expect(item.type).toBe(void 0);
162
+ expect(item.Name.value).toBe("");
163
+ });
164
+ });
@@ -61,6 +61,29 @@ export default class ParsingBuffer {
61
61
  * of the buffer.
62
62
  */
63
63
  reinit(buffer: Uint8Array, initialOffset: number, endOffset: number): void;
64
+ /**
65
+ * Streaming support: repoint this buffer at a fresh window over the same
66
+ * logical stream while keeping `address` file-absolute.
67
+ *
68
+ * A moving-window parse holds only a slice of the source in memory at a
69
+ * time. Between top-level records (where the rewind stack is empty) the
70
+ * driver slides the window forward: it copies the unconsumed tail to the
71
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
72
+ * repoint the parser. `addressBase` is the file offset that window index 0
73
+ * now corresponds to; we store it as a negative initial offset so
74
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
75
+ * non-streaming parse would have produced.
76
+ *
77
+ * Must only be called with the rewind stack empty (i.e. at a record
78
+ * boundary) — the stack holds window-relative cursors that a slide would
79
+ * invalidate. Throws otherwise.
80
+ *
81
+ * @param buffer The new window buffer.
82
+ * @param cursorInWindow The cursor position within the new window.
83
+ * @param endInWindow The count of valid bytes in the new window.
84
+ * @param addressBase The file offset that window index 0 maps to.
85
+ */
86
+ rebaseWindow(buffer: Uint8Array, cursorInWindow: number, endInWindow: number, addressBase: number): void;
64
87
  /**
65
88
  * Construct this with a buffer, initial offset into the buffer and an end offset.
66
89
  *
@@ -1 +1 @@
1
- {"version":3,"file":"parsing_buffer.d.ts","sourceRoot":"","sources":["../../../src/parsing/parsing_buffer.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,gBAAgB,CAA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,MAAM,GAAG,SAAS,CA4D1C;CAEF"}
@@ -86,6 +86,37 @@ export default class ParsingBuffer {
86
86
  this.buffer = buffer;
87
87
  this.end = endOffset;
88
88
  }
89
+ /**
90
+ * Streaming support: repoint this buffer at a fresh window over the same
91
+ * logical stream while keeping `address` file-absolute.
92
+ *
93
+ * A moving-window parse holds only a slice of the source in memory at a
94
+ * time. Between top-level records (where the rewind stack is empty) the
95
+ * driver slides the window forward: it copies the unconsumed tail to the
96
+ * front of a reused buffer, appends freshly-read bytes, and calls this to
97
+ * repoint the parser. `addressBase` is the file offset that window index 0
98
+ * now corresponds to; we store it as a negative initial offset so
99
+ * `address` ( = cursor − initialOffset ) stays the file-absolute value the
100
+ * non-streaming parse would have produced.
101
+ *
102
+ * Must only be called with the rewind stack empty (i.e. at a record
103
+ * boundary) — the stack holds window-relative cursors that a slide would
104
+ * invalidate. Throws otherwise.
105
+ *
106
+ * @param buffer The new window buffer.
107
+ * @param cursorInWindow The cursor position within the new window.
108
+ * @param endInWindow The count of valid bytes in the new window.
109
+ * @param addressBase The file offset that window index 0 maps to.
110
+ */
111
+ rebaseWindow(buffer, cursorInWindow, endInWindow, addressBase) {
112
+ if (this.rewindStack_.length !== 0) {
113
+ throw Error("rebaseWindow called mid-transaction (rewind stack non-empty)");
114
+ }
115
+ this.buffer = buffer;
116
+ this.cursor_ = cursorInWindow;
117
+ this.initialOffset_ = -addressBase;
118
+ this.end = endInWindow;
119
+ }
89
120
  /**
90
121
  * Construct this with a buffer, initial offset into the buffer and an end offset.
91
122
  *