@ifc-lite/flow-nodes 0.2.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 (67) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +34 -0
  3. package/dist/apply-table-node.d.ts +3 -0
  4. package/dist/apply-table-node.d.ts.map +1 -0
  5. package/dist/apply-table-node.js +119 -0
  6. package/dist/apply-table-node.js.map +1 -0
  7. package/dist/connector-nodes.d.ts +3 -0
  8. package/dist/connector-nodes.d.ts.map +1 -0
  9. package/dist/connector-nodes.js +192 -0
  10. package/dist/connector-nodes.js.map +1 -0
  11. package/dist/core-nodes.d.ts +3 -0
  12. package/dist/core-nodes.d.ts.map +1 -0
  13. package/dist/core-nodes.js +277 -0
  14. package/dist/core-nodes.js.map +1 -0
  15. package/dist/csv-nodes.d.ts +3 -0
  16. package/dist/csv-nodes.d.ts.map +1 -0
  17. package/dist/csv-nodes.js +111 -0
  18. package/dist/csv-nodes.js.map +1 -0
  19. package/dist/csv-parse.d.ts +26 -0
  20. package/dist/csv-parse.d.ts.map +1 -0
  21. package/dist/csv-parse.js +83 -0
  22. package/dist/csv-parse.js.map +1 -0
  23. package/dist/element-nodes.d.ts +36 -0
  24. package/dist/element-nodes.d.ts.map +1 -0
  25. package/dist/element-nodes.js +224 -0
  26. package/dist/element-nodes.js.map +1 -0
  27. package/dist/host.d.ts +107 -0
  28. package/dist/host.d.ts.map +1 -0
  29. package/dist/host.js +94 -0
  30. package/dist/host.js.map +1 -0
  31. package/dist/index.d.ts +19 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +50 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/model-nodes.d.ts +3 -0
  36. package/dist/model-nodes.d.ts.map +1 -0
  37. package/dist/model-nodes.js +200 -0
  38. package/dist/model-nodes.js.map +1 -0
  39. package/dist/script-node.d.ts +4 -0
  40. package/dist/script-node.d.ts.map +1 -0
  41. package/dist/script-node.js +140 -0
  42. package/dist/script-node.js.map +1 -0
  43. package/dist/strict-cell.d.ts +20 -0
  44. package/dist/strict-cell.d.ts.map +1 -0
  45. package/dist/strict-cell.js +33 -0
  46. package/dist/strict-cell.js.map +1 -0
  47. package/dist/table-nodes.d.ts +17 -0
  48. package/dist/table-nodes.d.ts.map +1 -0
  49. package/dist/table-nodes.js +200 -0
  50. package/dist/table-nodes.js.map +1 -0
  51. package/dist/viewer-nodes.d.ts +3 -0
  52. package/dist/viewer-nodes.d.ts.map +1 -0
  53. package/dist/viewer-nodes.js +93 -0
  54. package/dist/viewer-nodes.js.map +1 -0
  55. package/dist/write-nodes.d.ts +3 -0
  56. package/dist/write-nodes.d.ts.map +1 -0
  57. package/dist/write-nodes.js +63 -0
  58. package/dist/write-nodes.js.map +1 -0
  59. package/dist/xlsx-io.d.ts +24 -0
  60. package/dist/xlsx-io.d.ts.map +1 -0
  61. package/dist/xlsx-io.js +160 -0
  62. package/dist/xlsx-io.js.map +1 -0
  63. package/dist/xlsx-nodes.d.ts +3 -0
  64. package/dist/xlsx-nodes.d.ts.map +1 -0
  65. package/dist/xlsx-nodes.js +99 -0
  66. package/dist/xlsx-nodes.js.map +1 -0
  67. package/package.json +60 -0
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A minimal RFC 4180 CSV text parser, split out of `csv-nodes.ts` so that
3
+ * module stays small. This is a READER, not the CWE-1236 escaper — writing
4
+ * goes through `@ifc-lite/export`'s `tableToCsv`/`escapeCsvCell`, the one
5
+ * canonical implementation `scripts/check-csv-escaper-copies.mjs` gates.
6
+ *
7
+ * Handles quoted fields (`"a,b"`), doubled-quote escaping (`"a""b"` → `a"b`),
8
+ * and both `\n` and `\r\n` line endings. A field is never dropped: a row with
9
+ * too few or too many fields relative to the header is still parsed and
10
+ * returned, with a `fieldCountMismatch` flag the caller reports instead of
11
+ * silently truncating or padding.
12
+ */
13
+ export interface CsvParseRow {
14
+ readonly fields: readonly string[];
15
+ /** True when this row's field count does not match the header's. */
16
+ readonly fieldCountMismatch: boolean;
17
+ }
18
+ export interface CsvParseResult {
19
+ readonly header: readonly string[];
20
+ readonly rows: readonly CsvParseRow[];
21
+ }
22
+ /** Parse CSV text into a header row and data rows. Blank trailing rows (a
23
+ * file ending in a newline) are dropped; a genuinely blank line elsewhere
24
+ * is kept as a one-empty-field row and reported like any other mismatch. */
25
+ export declare function parseCsvText(text: string, delimiter?: string): CsvParseResult;
26
+ //# sourceMappingURL=csv-parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-parse.d.ts","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAgED;;6EAE6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAM,GAAG,cAAc,CAW1E"}
@@ -0,0 +1,83 @@
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
+ /** Split raw CSV text into fields per physical row, honouring quoting. */
5
+ function splitRows(text, delimiter) {
6
+ const rows = [];
7
+ let field = '';
8
+ let row = [];
9
+ let inQuotes = false;
10
+ let i = 0;
11
+ const n = text.length;
12
+ const pushField = () => {
13
+ row.push(field);
14
+ field = '';
15
+ };
16
+ const pushRow = () => {
17
+ pushField();
18
+ rows.push(row);
19
+ row = [];
20
+ };
21
+ while (i < n) {
22
+ const ch = text[i];
23
+ if (inQuotes) {
24
+ if (ch === '"') {
25
+ if (text[i + 1] === '"') {
26
+ field += '"';
27
+ i += 2;
28
+ continue;
29
+ }
30
+ inQuotes = false;
31
+ i += 1;
32
+ continue;
33
+ }
34
+ field += ch;
35
+ i += 1;
36
+ continue;
37
+ }
38
+ if (ch === '"' && field.length === 0) {
39
+ inQuotes = true;
40
+ i += 1;
41
+ continue;
42
+ }
43
+ if (ch === delimiter) {
44
+ pushField();
45
+ i += 1;
46
+ continue;
47
+ }
48
+ if (ch === '\r' && text[i + 1] === '\n') {
49
+ pushRow();
50
+ i += 2;
51
+ continue;
52
+ }
53
+ if (ch === '\n' || ch === '\r') {
54
+ pushRow();
55
+ i += 1;
56
+ continue;
57
+ }
58
+ field += ch;
59
+ i += 1;
60
+ }
61
+ // A trailing field/row with no terminating newline is still real content.
62
+ if (field.length > 0 || row.length > 0)
63
+ pushRow();
64
+ return rows;
65
+ }
66
+ /** Parse CSV text into a header row and data rows. Blank trailing rows (a
67
+ * file ending in a newline) are dropped; a genuinely blank line elsewhere
68
+ * is kept as a one-empty-field row and reported like any other mismatch. */
69
+ export function parseCsvText(text, delimiter = ',') {
70
+ // Excel's "CSV UTF-8" export starts with a byte-order mark. Left in, it
71
+ // becomes part of the first header ("\uFEFFGlobalId"), so the default
72
+ // GlobalId key is not found — and a quoted first header keeps its quotes.
73
+ if (text.charCodeAt(0) === 0xfeff)
74
+ text = text.slice(1);
75
+ const all = splitRows(text, delimiter).filter((r, idx, arr) => !(idx === arr.length - 1 && r.length === 1 && r[0] === ''));
76
+ if (all.length === 0)
77
+ return { header: [], rows: [] };
78
+ const [header, ...dataRows] = all;
79
+ const width = header.length;
80
+ const rows = dataRows.map((fields) => ({ fields, fieldCountMismatch: fields.length !== width }));
81
+ return { header, rows };
82
+ }
83
+ //# sourceMappingURL=csv-parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-parse.js","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,0EAA0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E,IAAI,EAAE,EAAE,EAAE,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,CAAC;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5B,MAAM,IAAI,GAAkB,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC;IAChH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `geometry.*` and `element.*` — parametric element specs, and the one
3
+ * tracked node that materialises them: `model.addElement`.
4
+ *
5
+ * A spec is a value (`ElementSpec`), so building geometry and writing it
6
+ * are separate steps: specs can be inspected, tabulated, or filtered before
7
+ * anything touches the model. `model.addElement` is `tracked`: the
8
+ * scheduler hands it create / update / keep per lane with a GlobalId
9
+ * derived from the node's tracking key, and calls `remove` for lanes that
10
+ * vanished — so a re-run updates elements instead of duplicating them.
11
+ *
12
+ * Geometry is parametric only (what `bim.store.add*` can author): there
13
+ * is no BRep / Solid write path, and this file does not pretend otherwise.
14
+ */
15
+ import type { EntityRef } from '@ifc-lite/flow';
16
+ import type { AddBeamInStoreParams, AddColumnInStoreParams, AddSlabRectangleParams, AddWallInStoreParams } from '@ifc-lite/sdk';
17
+ import { type FlowNodeDef } from './host.js';
18
+ export type ElementSpec = {
19
+ readonly kind: 'wall';
20
+ readonly storey: EntityRef;
21
+ readonly params: AddWallInStoreParams;
22
+ } | {
23
+ readonly kind: 'column';
24
+ readonly storey: EntityRef;
25
+ readonly params: AddColumnInStoreParams;
26
+ } | {
27
+ readonly kind: 'beam';
28
+ readonly storey: EntityRef;
29
+ readonly params: AddBeamInStoreParams;
30
+ } | {
31
+ readonly kind: 'slab';
32
+ readonly storey: EntityRef;
33
+ readonly params: AddSlabRectangleParams;
34
+ };
35
+ export declare const elementNodes: FlowNodeDef[];
36
+ //# sourceMappingURL=element-nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-nodes.d.ts","sourceRoot":"","sources":["../src/element-nodes.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,oBAAoB,EAA6B,MAAM,eAAe,CAAC;AAC3J,OAAO,EAAwH,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnK,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GAChG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAsBnG,eAAO,MAAM,YAAY,EAAE,WAAW,EAqLrC,CAAC"}
@@ -0,0 +1,224 @@
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
+ import { ENTITY_ITEM, SCALAR_ITEM, forgetGlobalId, rememberGlobalId, requireCapability, resolveByGlobalId, toSdkRef } from './host.js';
5
+ const POINT_ITEM = { kind: 'point', access: 'item' };
6
+ const SPEC_ITEM = { kind: 'elementSpec', access: 'item' };
7
+ const num = (v, name) => {
8
+ if (typeof v !== 'number' || !Number.isFinite(v))
9
+ throw new Error(`"${name}" must be a finite number`);
10
+ return v;
11
+ };
12
+ /** A fresh mutable triple: the SDK params are mutable tuples, flow points are readonly. */
13
+ const point = (v, name) => {
14
+ if (!Array.isArray(v) || v.length !== 3 || !v.every((x) => typeof x === 'number' && Number.isFinite(x)))
15
+ throw new Error(`"${name}" must be a point [x, y, z]`);
16
+ return [v[0], v[1], v[2]];
17
+ };
18
+ const optName = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
19
+ function specOf(v) {
20
+ const s = v;
21
+ if (!s || typeof s !== 'object' || !s.kind || !s.storey || !s.params)
22
+ throw new Error('"spec" must be an element spec from an element.* node');
23
+ return s;
24
+ }
25
+ export const elementNodes = [
26
+ {
27
+ type: 'geometry.point',
28
+ title: 'Point',
29
+ category: 'geometry',
30
+ inputs: [
31
+ { name: 'x', type: SCALAR_ITEM },
32
+ { name: 'y', type: SCALAR_ITEM },
33
+ { name: 'z', type: SCALAR_ITEM, optional: true, nullable: true },
34
+ ],
35
+ outputs: [{ name: 'point', type: POINT_ITEM }],
36
+ params: [],
37
+ capabilities: [],
38
+ run: (_c, i) => ({ point: [num(i.x, 'x'), num(i.y, 'y'), i.z === undefined || i.z === null ? 0 : num(i.z, 'z')] }),
39
+ },
40
+ {
41
+ type: 'element.wall',
42
+ title: 'Wall spec',
43
+ category: 'element',
44
+ inputs: [
45
+ { name: 'storey', type: ENTITY_ITEM },
46
+ { name: 'start', type: POINT_ITEM },
47
+ { name: 'end', type: POINT_ITEM },
48
+ ],
49
+ outputs: [{ name: 'spec', type: SPEC_ITEM }],
50
+ params: [
51
+ { name: 'thickness', kind: 'number', default: 0.2 },
52
+ { name: 'height', kind: 'number', default: 3 },
53
+ { name: 'name', kind: 'string' },
54
+ ],
55
+ capabilities: [],
56
+ run: (_c, i, p) => ({
57
+ spec: {
58
+ kind: 'wall',
59
+ storey: i.storey,
60
+ params: { Start: point(i.start, 'start'), End: point(i.end, 'end'), Thickness: num(p.thickness, 'thickness'), Height: num(p.height, 'height'), Name: optName(p.name) },
61
+ },
62
+ }),
63
+ },
64
+ {
65
+ type: 'element.column',
66
+ title: 'Column spec',
67
+ category: 'element',
68
+ inputs: [
69
+ { name: 'storey', type: ENTITY_ITEM },
70
+ { name: 'position', type: POINT_ITEM },
71
+ ],
72
+ outputs: [{ name: 'spec', type: SPEC_ITEM }],
73
+ params: [
74
+ { name: 'width', kind: 'number', default: 0.3 },
75
+ { name: 'depth', kind: 'number', default: 0.3 },
76
+ { name: 'height', kind: 'number', default: 3 },
77
+ { name: 'name', kind: 'string' },
78
+ ],
79
+ capabilities: [],
80
+ run: (_c, i, p) => ({
81
+ spec: {
82
+ kind: 'column',
83
+ storey: i.storey,
84
+ params: { Position: point(i.position, 'position'), Width: num(p.width, 'width'), Depth: num(p.depth, 'depth'), Height: num(p.height, 'height'), Name: optName(p.name) },
85
+ },
86
+ }),
87
+ },
88
+ {
89
+ type: 'element.beam',
90
+ title: 'Beam spec',
91
+ category: 'element',
92
+ inputs: [
93
+ { name: 'storey', type: ENTITY_ITEM },
94
+ { name: 'start', type: POINT_ITEM },
95
+ { name: 'end', type: POINT_ITEM },
96
+ ],
97
+ outputs: [{ name: 'spec', type: SPEC_ITEM }],
98
+ params: [
99
+ { name: 'width', kind: 'number', default: 0.2 },
100
+ { name: 'height', kind: 'number', default: 0.4 },
101
+ { name: 'name', kind: 'string' },
102
+ ],
103
+ capabilities: [],
104
+ run: (_c, i, p) => ({
105
+ spec: {
106
+ kind: 'beam',
107
+ storey: i.storey,
108
+ params: { Start: point(i.start, 'start'), End: point(i.end, 'end'), Width: num(p.width, 'width'), Height: num(p.height, 'height'), Name: optName(p.name) },
109
+ },
110
+ }),
111
+ },
112
+ {
113
+ type: 'element.slab',
114
+ title: 'Slab spec',
115
+ category: 'element',
116
+ inputs: [
117
+ { name: 'storey', type: ENTITY_ITEM },
118
+ { name: 'position', type: POINT_ITEM },
119
+ ],
120
+ outputs: [{ name: 'spec', type: SPEC_ITEM }],
121
+ params: [
122
+ { name: 'width', kind: 'number', default: 5 },
123
+ { name: 'depth', kind: 'number', default: 5 },
124
+ { name: 'thickness', kind: 'number', default: 0.25 },
125
+ { name: 'name', kind: 'string' },
126
+ ],
127
+ capabilities: [],
128
+ run: (_c, i, p) => ({
129
+ spec: {
130
+ kind: 'slab',
131
+ storey: i.storey,
132
+ params: { Profile: 'rectangle', Position: point(i.position, 'position'), Width: num(p.width, 'width'), Depth: num(p.depth, 'depth'), Thickness: num(p.thickness, 'thickness'), Name: optName(p.name) },
133
+ },
134
+ }),
135
+ },
136
+ {
137
+ type: 'model.addElement',
138
+ title: 'Add element',
139
+ category: 'model',
140
+ doc: 'Materialises a spec in the model. Tracked: a re-run updates the element it made instead of adding another.',
141
+ inputs: [{ name: 'spec', type: SPEC_ITEM }],
142
+ outputs: [{ name: 'entity', type: ENTITY_ITEM }],
143
+ params: [],
144
+ capabilities: ['model.create'],
145
+ writes: 'model',
146
+ tracked: true,
147
+ requires: { backend: ['store'] },
148
+ run: (ctx, i) => {
149
+ requireCapability(ctx, 'model.create');
150
+ const spec = specOf(i.spec);
151
+ const t = ctx.tracking;
152
+ if (!t)
153
+ throw new Error('model.addElement must run as a tracked node');
154
+ const storey = toSdkRef(ctx, spec.storey);
155
+ const existing = resolveByGlobalId(ctx.host.bim, t.globalId);
156
+ ctx.log('info', `${t.action} ${spec.kind} ${t.globalId}${existing ? ` (#${existing.expressId})` : ''}`);
157
+ if (t.action === 'keep' && existing) {
158
+ return { entity: { globalId: t.globalId, modelId: existing.modelId, expressId: existing.expressId } };
159
+ }
160
+ if (t.action === 'create' && existing) {
161
+ throw new Error(`GlobalId ${t.globalId} already exists in the model; change the node's tracking key rather than overwrite a foreign element`);
162
+ }
163
+ // `update` and a `keep` whose element is gone (deleted by hand, or the
164
+ // model was rebuilt from an older file) both end in a fresh element under
165
+ // the same GlobalId; a keep that returned a handle to nothing would read
166
+ // as success downstream.
167
+ if (t.action === 'update' && existing) {
168
+ // A removal the store refused leaves a live element under this
169
+ // GlobalId; creating a second one would make the key ambiguous.
170
+ if (!ctx.host.bim.store.removeEntity(existing))
171
+ throw new Error(`element ${t.globalId} (#${existing.expressId}) could not be removed for update`);
172
+ forgetGlobalId(ctx.host.bim, t.globalId);
173
+ }
174
+ else if (t.action !== 'create') {
175
+ ctx.log('warn', `element ${t.globalId} was tracked but is no longer in the model; re-creating it`);
176
+ }
177
+ const ref = addSpec(ctx, storey, spec, t.globalId);
178
+ rememberGlobalId(ctx.host.bim, t.globalId, ref);
179
+ return { entity: { globalId: t.globalId, modelId: ref.modelId, expressId: ref.expressId } };
180
+ },
181
+ remove: (ctx, globalId) => {
182
+ const existing = resolveByGlobalId(ctx.host.bim, globalId);
183
+ if (existing) {
184
+ if (!ctx.host.bim.store.removeEntity(existing))
185
+ throw new Error(`element ${globalId} (#${existing.expressId}) could not be removed`);
186
+ forgetGlobalId(ctx.host.bim, globalId);
187
+ }
188
+ else
189
+ ctx.log('warn', `tracked element ${globalId} was already gone`);
190
+ },
191
+ },
192
+ {
193
+ type: 'model.delete',
194
+ title: 'Delete element',
195
+ category: 'model',
196
+ inputs: [{ name: 'entity', type: ENTITY_ITEM }],
197
+ outputs: [{ name: 'removed', type: SCALAR_ITEM }],
198
+ params: [],
199
+ capabilities: ['model.delete'],
200
+ writes: 'model',
201
+ requires: { backend: ['store'] },
202
+ run: (ctx, i) => {
203
+ requireCapability(ctx, 'model.delete');
204
+ const entity = i.entity;
205
+ const removed = ctx.host.bim.store.removeEntity(toSdkRef(ctx, entity));
206
+ // The index would otherwise keep resolving the tombstoned address, and a
207
+ // later tracked create under that GlobalId would see a "foreign" element.
208
+ if (removed)
209
+ forgetGlobalId(ctx.host.bim, entity.globalId);
210
+ return { removed };
211
+ },
212
+ },
213
+ ];
214
+ function addSpec(ctx, storey, spec, GlobalId) {
215
+ const store = ctx.host.bim.store;
216
+ switch (spec.kind) {
217
+ case 'wall': return store.addWall(storey.modelId, storey.expressId, { ...spec.params, GlobalId });
218
+ case 'column': return store.addColumn(storey.modelId, storey.expressId, { ...spec.params, GlobalId });
219
+ case 'beam': return store.addBeam(storey.modelId, storey.expressId, { ...spec.params, GlobalId });
220
+ case 'slab': return store.addSlab(storey.modelId, storey.expressId, { ...spec.params, GlobalId });
221
+ default: throw new Error(`unknown element kind "${String(spec.kind)}"`);
222
+ }
223
+ }
224
+ //# sourceMappingURL=element-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-nodes.js","sourceRoot":"","sources":["../src/element-nodes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,QAAQ,EAA8B,MAAM,WAAW,CAAC;AAQnK,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AAC9D,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AAEnE,MAAM,GAAG,GAAG,CAAC,CAAU,EAAE,IAAY,EAAU,EAAE;IAC/C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,2BAA2B,CAAC,CAAC;IACvG,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AACF,2FAA2F;AAC3F,MAAM,KAAK,GAAG,CAAC,CAAU,EAAE,IAAY,EAA4B,EAAE;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,C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O,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClG,KAAK,MAAM,CAAC,CAAC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClG,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,CAAE,IAA0B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;AACH,CAAC"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ /**
2
+ * The host services every standard node receives, and the capability gate.
3
+ *
4
+ * Nodes run on the host (viewer or CLI) as trusted code, so the gate is
5
+ * not a sandbox: it is the same grant check the extension runtime applies
6
+ * (`hasCapability` over the extension grammar), evaluated with the node's
7
+ * *actual* target — `model.mutate:Pset_WallCommon` is checked against the
8
+ * pset the node is about to write, which `assertMethodCall` cannot do
9
+ * because it never sees arguments.
10
+ */
11
+ import { type Capability } from '@ifc-lite/extensions';
12
+ import type { NodeDef, NodeRunContext } from '@ifc-lite/flow';
13
+ import type { BimContext, EntityData, EntityRef as SdkEntityRef } from '@ifc-lite/sdk';
14
+ import type { EntityRef } from '@ifc-lite/flow';
15
+ import type { EntityTable } from '@ifc-lite/data';
16
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
17
+ /** A string-interning lookup, the shape `csv-match.ts`'s match-context builder
18
+ * needs for `globalId`/`name` strategies (an entity table's `name`/`globalId`
19
+ * columns are interned string indices, not inline strings). */
20
+ export type StringLookup = {
21
+ get(idx: number): string;
22
+ } | null;
23
+ /**
24
+ * Bulk entity access for `table.joinByKey`'s `tag`/`property` strategies,
25
+ * which reuse `@ifc-lite/mutations`' `csv-match.ts` index builder verbatim
26
+ * (issue #5230) instead of re-implementing tag/property matching. That
27
+ * builder scans a whole `EntityTable` once (`O(entities + rows)`) rather than
28
+ * once per candidate entity, so it needs the raw table, not `BimContext`'s
29
+ * per-`EntityRef` accessors.
30
+ *
31
+ * Optional on `FlowHost`: a host that cannot cheaply provide this (nothing
32
+ * today besides the CLI's `HeadlessBackend`) simply cannot run those two
33
+ * match strategies, and `table.joinByKey` reports that plainly rather than
34
+ * falling back to a slow re-implementation.
35
+ */
36
+ export interface TableAccess {
37
+ readonly entities: EntityTable;
38
+ readonly mutationView: MutablePropertyView;
39
+ readonly strings: StringLookup;
40
+ }
41
+ export interface FlowHost {
42
+ readonly bim: BimContext;
43
+ /**
44
+ * Capabilities granted to the running graph. `undefined` means "trusted
45
+ * caller, no gate" (the CLI running a local file); the viewer always
46
+ * passes the grants the user accepted.
47
+ */
48
+ readonly grants?: readonly Capability[];
49
+ /** Model to query when a node does not name one. */
50
+ readonly defaultModelId?: string;
51
+ /** See {@link TableAccess}. `modelId` defaults to `defaultModelId`. */
52
+ tables?(modelId?: string): TableAccess | undefined;
53
+ }
54
+ export type FlowNodeDef = NodeDef<FlowHost>;
55
+ export type Ctx = NodeRunContext<FlowHost>;
56
+ /** Throws `CapabilityDeniedError` unless the host's grants cover `raw`. */
57
+ export declare function requireCapability(ctx: Ctx, raw: string): void;
58
+ /** Flow handle from an SDK entity: GlobalId is the identity, the address is a cache. */
59
+ export declare function toRef(e: EntityData): EntityRef;
60
+ export declare function resolveByGlobalId(bim: BimContext, globalId: string): SdkEntityRef | undefined;
61
+ export declare function rememberGlobalId(bim: BimContext, globalId: string, ref: SdkEntityRef): void;
62
+ export declare function forgetGlobalId(bim: BimContext, globalId: string): void;
63
+ export declare function invalidateGlobalIdIndex(bim: BimContext): void;
64
+ /**
65
+ * Resolve a flow handle to an SDK address. A handle whose address is
66
+ * present and still names the same GlobalId is used as is; anything else
67
+ * goes through the GlobalId index.
68
+ */
69
+ export declare function toSdkRef(ctx: Ctx, ref: EntityRef): SdkEntityRef;
70
+ export declare function entityOf(ctx: Ctx, ref: EntityRef): EntityData;
71
+ export declare const ENTITY_ITEM: {
72
+ readonly kind: "entity";
73
+ readonly access: "item";
74
+ };
75
+ export declare const ENTITY_LIST: {
76
+ readonly kind: "entity";
77
+ readonly access: "list";
78
+ };
79
+ export declare const ENTITY_GROUP: {
80
+ readonly kind: "entity";
81
+ readonly access: "group";
82
+ };
83
+ export declare const SCALAR_ITEM: {
84
+ readonly kind: "scalar";
85
+ readonly access: "item";
86
+ };
87
+ export declare const SCALAR_LIST: {
88
+ readonly kind: "scalar";
89
+ readonly access: "list";
90
+ };
91
+ export declare const TABLE_ITEM: {
92
+ readonly kind: "table";
93
+ readonly access: "item";
94
+ };
95
+ export declare const ANY_ITEM: {
96
+ readonly kind: "any";
97
+ readonly access: "item";
98
+ };
99
+ export declare const ANY_LIST: {
100
+ readonly kind: "any";
101
+ readonly access: "list";
102
+ };
103
+ export declare const ANY_GROUP: {
104
+ readonly kind: "any";
105
+ readonly access: "group";
106
+ };
107
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAAyD,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;gEAEgE;AAChE,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IA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,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,CAS/D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,GAAG,UAAU,CAI7D;AAED,eAAO,MAAM,WAAW;;;CAA8C,CAAC;AACvE,eAAO,MAAM,WAAW;;;CAA8C,CAAC;AACvE,eAAO,MAAM,YAAY;;;CAA+C,CAAC;AACzE,eAAO,MAAM,WAAW;;;CAA8C,CAAC;AACvE,eAAO,MAAM,WAAW;;;CAA8C,CAAC;AACvE,eAAO,MAAM,UAAU;;;CAA6C,CAAC;AACrE,eAAO,MAAM,QAAQ;;;CAA2C,CAAC;AACjE,eAAO,MAAM,QAAQ;;;CAA2C,CAAC;AACjE,eAAO,MAAM,SAAS;;;CAA4C,CAAC"}
package/dist/host.js ADDED
@@ -0,0 +1,94 @@
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
+ * The host services every standard node receives, and the capability gate.
6
+ *
7
+ * Nodes run on the host (viewer or CLI) as trusted code, so the gate is
8
+ * not a sandbox: it is the same grant check the extension runtime applies
9
+ * (`hasCapability` over the extension grammar), evaluated with the node's
10
+ * *actual* target — `model.mutate:Pset_WallCommon` is checked against the
11
+ * pset the node is about to write, which `assertMethodCall` cannot do
12
+ * because it never sees arguments.
13
+ */
14
+ import { CapabilityDeniedError, hasCapability, parseCapability } from '@ifc-lite/extensions';
15
+ /** Throws `CapabilityDeniedError` unless the host's grants cover `raw`. */
16
+ export function requireCapability(ctx, raw) {
17
+ if (!ctx.host.grants)
18
+ return;
19
+ const parsed = parseCapability(raw);
20
+ if (!parsed.ok)
21
+ throw new Error(`node requested a malformed capability "${raw}": ${parsed.errors.map((e) => e.message).join('; ')}`);
22
+ if (!hasCapability(ctx.host.grants, parsed.value)) {
23
+ throw new CapabilityDeniedError(`flow node (${raw})`, [raw], ctx.host.grants.map((g) => g.raw));
24
+ }
25
+ }
26
+ /** Flow handle from an SDK entity: GlobalId is the identity, the address is a cache. */
27
+ export function toRef(e) {
28
+ return { globalId: e.globalId, modelId: e.ref.modelId, expressId: e.ref.expressId };
29
+ }
30
+ /**
31
+ * GlobalId → address index, built lazily per `BimContext` with one full
32
+ * scan the first time a handle arrives without a usable address (from a
33
+ * sidecar, a table, another session). The SDK query has no GlobalId lookup.
34
+ * A miss is *not* a rebuild trigger — a tracked create node asks for every
35
+ * GlobalId it is about to mint, and each of those misses is expected —
36
+ * so creators register what they add with `rememberGlobalId`, and hosts
37
+ * call `invalidateGlobalIdIndex` when a model is loaded or removed.
38
+ */
39
+ const indexes = new WeakMap();
40
+ function indexFor(bim) {
41
+ let index = indexes.get(bim);
42
+ if (!index) {
43
+ index = new Map();
44
+ for (const e of bim.query().toArray())
45
+ index.set(e.globalId, e.ref);
46
+ indexes.set(bim, index);
47
+ }
48
+ return index;
49
+ }
50
+ export function resolveByGlobalId(bim, globalId) {
51
+ return indexFor(bim).get(globalId);
52
+ }
53
+ export function rememberGlobalId(bim, globalId, ref) {
54
+ indexFor(bim).set(globalId, ref);
55
+ }
56
+ export function forgetGlobalId(bim, globalId) {
57
+ indexes.get(bim)?.delete(globalId);
58
+ }
59
+ export function invalidateGlobalIdIndex(bim) {
60
+ indexes.delete(bim);
61
+ }
62
+ /**
63
+ * Resolve a flow handle to an SDK address. A handle whose address is
64
+ * present and still names the same GlobalId is used as is; anything else
65
+ * goes through the GlobalId index.
66
+ */
67
+ export function toSdkRef(ctx, ref) {
68
+ if (ref.modelId !== undefined && ref.expressId !== undefined) {
69
+ const addr = { modelId: ref.modelId, expressId: ref.expressId };
70
+ const live = ctx.host.bim.entity(addr);
71
+ if (live && live.globalId === ref.globalId)
72
+ return addr;
73
+ }
74
+ const found = resolveByGlobalId(ctx.host.bim, ref.globalId);
75
+ if (!found)
76
+ throw new Error(`entity ${ref.globalId} is not in any loaded model`);
77
+ return found;
78
+ }
79
+ export function entityOf(ctx, ref) {
80
+ const data = ctx.host.bim.entity(toSdkRef(ctx, ref));
81
+ if (!data)
82
+ throw new Error(`entity ${ref.globalId} is not in any loaded model`);
83
+ return data;
84
+ }
85
+ export const ENTITY_ITEM = { kind: 'entity', access: 'item' };
86
+ export const ENTITY_LIST = { kind: 'entity', access: 'list' };
87
+ export const ENTITY_GROUP = { kind: 'entity', access: 'group' };
88
+ export const SCALAR_ITEM = { kind: 'scalar', access: 'item' };
89
+ export const SCALAR_LIST = { kind: 'scalar', access: 'list' };
90
+ export const TABLE_ITEM = { kind: 'table', access: 'item' };
91
+ export const ANY_ITEM = { kind: 'any', access: 'item' };
92
+ export const ANY_LIST = { kind: 'any', access: 'list' };
93
+ export const ANY_GROUP = { kind: 'any', access: 'group' };
94
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAgD9G,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,GAAQ,EAAE,GAAW;IACrD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO;IAC7B,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC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,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACvE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAW,CAAC;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAW,CAAC;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAW,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { NodeRegistry, type HostFeatures } from '@ifc-lite/flow';
2
+ import type { FlowHost } from './host.js';
3
+ export type { FlowHost, FlowNodeDef, TableAccess, StringLookup } from './host.js';
4
+ export { requireCapability, toRef, toSdkRef, resolveByGlobalId, rememberGlobalId, forgetGlobalId, invalidateGlobalIdIndex } from './host.js';
5
+ export { columnTypeOf, VALUE_TYPE_BY_COLUMN_TYPE } from './table-nodes.js';
6
+ export type { ElementSpec } from './element-nodes.js';
7
+ export { readXlsxTable, writeXlsxTable } from './xlsx-io.js';
8
+ export type { ReadXlsxOptions, ReadXlsxResult, XlsxColumnSpec } from './xlsx-io.js';
9
+ /** Every standard node, in one registry. */
10
+ export declare function createStandardRegistry(): NodeRegistry<FlowHost>;
11
+ /** What a viewer-embedded host offers. Secrets are never available in the browser. */
12
+ export declare const BROWSER_FEATURES: HostFeatures;
13
+ /**
14
+ * What the CLI's `HeadlessBackend` offers. It implements the viewer
15
+ * methods as inert no-ops, so `viewer`/`visibility`/`selection` are
16
+ * deliberately absent here: a viewer node must report `noop`, not pretend.
17
+ */
18
+ export declare function headlessFeatures(secrets?: Iterable<string>): HostFeatures;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAQ1C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAC7I,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEpF,4CAA4C;AAC5C,wBAAgB,sBAAsB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAe/D;AAED,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,EAAE,YAI9B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAM,GAAG,YAAY,CAE7E"}