@ifc-lite/cli 0.24.4 → 0.25.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.
Files changed (36) hide show
  1. package/dist/commands/ask.d.ts.map +1 -1
  2. package/dist/commands/ask.js +4 -0
  3. package/dist/commands/ask.js.map +1 -1
  4. package/dist/commands/clash.d.ts +12 -0
  5. package/dist/commands/clash.d.ts.map +1 -1
  6. package/dist/commands/clash.js +17 -3
  7. package/dist/commands/clash.js.map +1 -1
  8. package/dist/commands/export.d.ts.map +1 -1
  9. package/dist/commands/export.js +8 -11
  10. package/dist/commands/export.js.map +1 -1
  11. package/dist/commands/gym/ops.d.ts.map +1 -1
  12. package/dist/commands/gym/ops.js +3 -8
  13. package/dist/commands/gym/ops.js.map +1 -1
  14. package/dist/commands/ids.d.ts.map +1 -1
  15. package/dist/commands/ids.js +6 -0
  16. package/dist/commands/ids.js.map +1 -1
  17. package/dist/commands/lod.d.ts.map +1 -1
  18. package/dist/commands/lod.js +2 -15
  19. package/dist/commands/lod.js.map +1 -1
  20. package/dist/commands/mcp.d.ts +24 -0
  21. package/dist/commands/mcp.d.ts.map +1 -1
  22. package/dist/commands/mcp.js +40 -17
  23. package/dist/commands/mcp.js.map +1 -1
  24. package/dist/commands/mutate.d.ts +22 -0
  25. package/dist/commands/mutate.d.ts.map +1 -1
  26. package/dist/commands/mutate.js +25 -15
  27. package/dist/commands/mutate.js.map +1 -1
  28. package/dist/headless-backend.d.ts +20 -3
  29. package/dist/headless-backend.d.ts.map +1 -1
  30. package/dist/headless-backend.js +51 -72
  31. package/dist/headless-backend.js.map +1 -1
  32. package/dist/headless-test-helpers.d.ts +25 -0
  33. package/dist/headless-test-helpers.d.ts.map +1 -0
  34. package/dist/headless-test-helpers.js +72 -0
  35. package/dist/headless-test-helpers.js.map +1 -0
  36. package/package.json +19 -19
@@ -0,0 +1,72 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Shared fixture plumbing for the headless-backend tests.
6
+ *
7
+ * The three suites all want the same thing: an inline IFC model on disk, a real
8
+ * headless context over it, and the exported STEP back as text. Written once
9
+ * here so a change to `createHeadlessContext` or to the header the parser
10
+ * accepts is one edit rather than three. Mirrors `diff-test-helpers.ts`.
11
+ */
12
+ import { mkdtemp, rm, writeFile } from 'node:fs/promises';
13
+ import { tmpdir } from 'node:os';
14
+ import { join } from 'node:path';
15
+ import { createHeadlessContext } from './loader.js';
16
+ /** Project, context, units — the prologue every fixture needs and none tests. */
17
+ export const IFC_PREAMBLE = `#1= IFCPROJECT('PROJ00000000000000000X',$,'Proj',$,$,$,$,(#20),#30);
18
+ #20= IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-5,#21,$);
19
+ #21= IFCAXIS2PLACEMENT3D(#22,$,$);
20
+ #22= IFCCARTESIANPOINT((0.,0.,0.));
21
+ #30= IFCUNITASSIGNMENT((#31));
22
+ #31= IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`;
23
+ /** Wrap DATA-section lines in a minimal valid STEP file. */
24
+ export function ifcFile(dataSection, schema = 'IFC4') {
25
+ return `ISO-10303-21;
26
+ HEADER;
27
+ FILE_DESCRIPTION((''),'2;1');
28
+ FILE_NAME('m','2024',(''),(''),'','','');
29
+ FILE_SCHEMA(('${schema}'));
30
+ ENDSEC;
31
+ DATA;
32
+ ${IFC_PREAMBLE}
33
+ ${dataSection}
34
+ ENDSEC;
35
+ END-ISO-10303-21;
36
+ `;
37
+ }
38
+ /**
39
+ * Write a model to a temp dir and open a real headless context over it.
40
+ *
41
+ * The directory is removed once the context is open: `loadIfcFile` reads the
42
+ * whole file into `store.source` before returning, so nothing reads it back off
43
+ * disk afterwards. Removed on the failure path too, so a broken fixture does
44
+ * not leave one behind per test.
45
+ */
46
+ export async function loadInlineModel(source, label = 'headless') {
47
+ const dir = await mkdtemp(join(tmpdir(), `ifc-lite-${label}-`));
48
+ try {
49
+ const path = join(dir, 'model.ifc');
50
+ await writeFile(path, source, 'utf-8');
51
+ return (await createHeadlessContext(path)).bim;
52
+ }
53
+ finally {
54
+ await rm(dir, { recursive: true, force: true });
55
+ }
56
+ }
57
+ /**
58
+ * Export and decode.
59
+ *
60
+ * Every mutation assertion in these suites goes through the export rather than
61
+ * reading the overlay back: the overlay answers correctly even when nothing
62
+ * reaches the file, which is exactly the bug these suites were written for.
63
+ */
64
+ export function exportStep(bim, schema = 'IFC4') {
65
+ const content = bim.export.ifc([], { schema });
66
+ return typeof content === 'string' ? content : new TextDecoder().decode(content);
67
+ }
68
+ /** The `Item` ref of every `IfcStyledItem` in an exported file. */
69
+ export function styledTargets(step) {
70
+ return [...step.matchAll(/IFCSTYLEDITEM\(#(\d+),/g)].map(m => Number(m[1]));
71
+ }
72
+ //# sourceMappingURL=headless-test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headless-test-helpers.js","sourceRoot":"","sources":["../src/headless-test-helpers.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;0CAKc,CAAC;AAE3C,4DAA4D;AAC5D,MAAM,UAAU,OAAO,CAAC,WAAmB,EAAE,MAAM,GAAG,MAAM;IAC1D,OAAO;;;;gBAIO,MAAM;;;EAGpB,YAAY;EACZ,WAAW;;;CAGZ,CAAC;AACF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,KAAK,GAAG,UAAU;IACtE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC;IAChE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QACpC,MAAM,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,OAAO,CAAC,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IACjD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAID;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAgB,EAAE,SAAuC,MAAM;IACxF,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACnF,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/cli",
3
- "version": "0.24.4",
3
+ "version": "0.25.0",
4
4
  "description": "CLI toolkit for IFC files — query, validate, export, create, and script BIM data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,25 +20,25 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@ifc-lite/bcf": "^1.18.2",
24
- "@ifc-lite/clash": "^1.9.0",
25
- "@ifc-lite/create": "^2.1.2",
23
+ "@ifc-lite/clash": "^1.9.1",
24
+ "@ifc-lite/create": "^2.2.0",
25
+ "@ifc-lite/data": "^3.4.1",
26
+ "@ifc-lite/bcf": "^2.0.0",
26
27
  "@ifc-lite/diff": "^0.7.0",
27
- "@ifc-lite/data": "^3.4.0",
28
- "@ifc-lite/extensions": "^0.4.2",
29
- "@ifc-lite/geometry": "^3.8.4",
30
- "@ifc-lite/export": "^2.9.4",
31
- "@ifc-lite/ifcx": "^2.3.7",
32
- "@ifc-lite/ids": "^1.15.48",
33
- "@ifc-lite/mcp": "^0.11.3",
34
- "@ifc-lite/parser": "^4.2.0",
35
- "@ifc-lite/merge": "^0.4.3",
36
- "@ifc-lite/sandbox": "^2.2.0",
37
- "@ifc-lite/query": "^1.14.17",
38
- "@ifc-lite/mutations": "^1.26.1",
39
- "@ifc-lite/sdk": "^2.1.3",
40
- "@ifc-lite/viewer-core": "^0.2.13",
41
- "@ifc-lite/wasm": "^5.0.0"
28
+ "@ifc-lite/extensions": "^0.5.0",
29
+ "@ifc-lite/export": "^3.0.0",
30
+ "@ifc-lite/ids": "^1.15.49",
31
+ "@ifc-lite/merge": "^0.4.4",
32
+ "@ifc-lite/mcp": "^0.12.0",
33
+ "@ifc-lite/mutations": "^1.27.0",
34
+ "@ifc-lite/geometry": "^4.0.0",
35
+ "@ifc-lite/ifcx": "^3.0.0",
36
+ "@ifc-lite/parser": "^4.3.0",
37
+ "@ifc-lite/sandbox": "^2.2.1",
38
+ "@ifc-lite/query": "^2.0.0",
39
+ "@ifc-lite/sdk": "^3.0.0",
40
+ "@ifc-lite/wasm": "^6.0.0",
41
+ "@ifc-lite/viewer-core": "^0.2.14"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^26.2.0",