ifcopenshell 0.0.0-stage → 0.9.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 +38 -2
- package/dist/entity_instance.d.ts +44 -0
- package/dist/entity_instance.d.ts.map +1 -0
- package/dist/entity_instance.js +97 -0
- package/dist/entity_instance.js.map +1 -0
- package/dist/file.d.ts +52 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +121 -0
- package/dist/file.js.map +1 -0
- package/dist/geom/index.d.ts +7 -0
- package/dist/geom/index.d.ts.map +1 -0
- package/dist/geom/index.js +5 -0
- package/dist/geom/index.js.map +1 -0
- package/dist/geom/iterator.d.ts +19 -0
- package/dist/geom/iterator.d.ts.map +1 -0
- package/dist/geom/iterator.js +26 -0
- package/dist/geom/iterator.js.map +1 -0
- package/dist/geom/settings.d.ts +10 -0
- package/dist/geom/settings.d.ts.map +1 -0
- package/dist/geom/settings.js +15 -0
- package/dist/geom/settings.js.map +1 -0
- package/dist/geom/shape.d.ts +5 -0
- package/dist/geom/shape.d.ts.map +1 -0
- package/dist/geom/shape.js +7 -0
- package/dist/geom/shape.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +27 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +137 -0
- package/dist/init.js.map +1 -0
- package/dist/serializers/index.d.ts +46 -0
- package/dist/serializers/index.d.ts.map +1 -0
- package/dist/serializers/index.js +161 -0
- package/dist/serializers/index.js.map +1 -0
- package/dist/types.d.ts +116 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/util/color.d.ts +34 -0
- package/dist/util/color.d.ts.map +1 -0
- package/dist/util/color.js +52 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +8 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/inspect.d.ts +15 -0
- package/dist/util/inspect.d.ts.map +1 -0
- package/dist/util/inspect.js +24 -0
- package/dist/util/inspect.js.map +1 -0
- package/package.json +61 -4
package/dist/init.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { EntityInstance } from './entity_instance.js';
|
|
2
|
+
import { IfcOpenShellError, IfcOpenShellErrorCode, IfcOpenShellErrorKind, abortError, isIfcOpenShellAbortError, } from '@ifcopenshell/wasm/api';
|
|
3
|
+
export { IfcOpenShellError, IfcOpenShellErrorCode, IfcOpenShellErrorKind, abortError, isIfcOpenShellAbortError, };
|
|
4
|
+
/**
|
|
5
|
+
* Initialize the packaged or explicitly configured WASM runtime.
|
|
6
|
+
*
|
|
7
|
+
* Plugins are loaded lazily through {@link IfcOpenShell.loadPlugin}.
|
|
8
|
+
* File and Iterator support explicit disposal; other handles use GC cleanup.
|
|
9
|
+
*
|
|
10
|
+
* @param options Asset locations and optional plugin-loader overrides.
|
|
11
|
+
* @returns An initialized, frozen runtime facade.
|
|
12
|
+
*/
|
|
13
|
+
export function init(options = {}) {
|
|
14
|
+
if (initialization) {
|
|
15
|
+
if (Object.keys(options).length) {
|
|
16
|
+
return Promise.reject(new IfcOpenShellError('Runtime is already initializing or initialized; configure it only on the first init() call'));
|
|
17
|
+
}
|
|
18
|
+
return initialization;
|
|
19
|
+
}
|
|
20
|
+
initialization = initialize(options).then(value => {
|
|
21
|
+
ifcopenshell = value.raw;
|
|
22
|
+
fs = value.fs;
|
|
23
|
+
return value;
|
|
24
|
+
}).catch(error => {
|
|
25
|
+
initialization = undefined;
|
|
26
|
+
throw error;
|
|
27
|
+
});
|
|
28
|
+
return initialization;
|
|
29
|
+
}
|
|
30
|
+
/** Native module, available after awaiting init(). */
|
|
31
|
+
export let ifcopenshell;
|
|
32
|
+
/** Retrieve the loaded schema declaration by its full identifier. */
|
|
33
|
+
export function schemaByName(name) {
|
|
34
|
+
return ifcopenshell.parse.schemaByName(name);
|
|
35
|
+
}
|
|
36
|
+
/** Emscripten filesystem, available after awaiting init(). */
|
|
37
|
+
export let fs;
|
|
38
|
+
let initialization;
|
|
39
|
+
async function initialize(options) {
|
|
40
|
+
let assets;
|
|
41
|
+
if (options.wasmAssets) {
|
|
42
|
+
assets = options.wasmAssets;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
try {
|
|
46
|
+
assets = await resolveRuntime();
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
throw new IfcOpenShellError('Failed to resolve packaged WASM assets', error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const loader = options.pluginLoader ?? assets.pluginLoader;
|
|
53
|
+
validateAssets(assets);
|
|
54
|
+
let fs = null;
|
|
55
|
+
const initModule = (opts) => Promise.resolve(assets.initModule(opts)).then((mod) => {
|
|
56
|
+
fs = readFs(mod);
|
|
57
|
+
return mod;
|
|
58
|
+
});
|
|
59
|
+
const createModule = await resolveApiFactory(assets);
|
|
60
|
+
let raw;
|
|
61
|
+
try {
|
|
62
|
+
raw = await createModule(initModule, assets.wasmUrl, {
|
|
63
|
+
pluginBaseUrl: assets.pluginBaseUrl,
|
|
64
|
+
pluginManifest: assets.manifest,
|
|
65
|
+
pluginLoader: loader,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw new IfcOpenShellError('Failed to instantiate IfcOpenShell WASM', error);
|
|
70
|
+
}
|
|
71
|
+
const runtime = {
|
|
72
|
+
raw,
|
|
73
|
+
fs,
|
|
74
|
+
loadPlugin: (kind, id) => loadPlugin(raw, kind, id),
|
|
75
|
+
loadedPlugins: () => raw.loadedPlugins(),
|
|
76
|
+
};
|
|
77
|
+
raw.setInstanceFactory((handle) => new EntityInstance(handle));
|
|
78
|
+
return Object.freeze(runtime);
|
|
79
|
+
}
|
|
80
|
+
async function resolveRuntime() {
|
|
81
|
+
const wasm = await import('@ifcopenshell/wasm');
|
|
82
|
+
return await wasm.resolveWasmAssets();
|
|
83
|
+
}
|
|
84
|
+
async function resolveApiFactory(assets) {
|
|
85
|
+
if (typeof assets.createIfcOpenshellModule === 'function')
|
|
86
|
+
return assets.createIfcOpenshellModule;
|
|
87
|
+
const specifier = assets.apiModuleUrl;
|
|
88
|
+
try {
|
|
89
|
+
const mod = await import(/* @vite-ignore */ /* webpackIgnore: true */ specifier);
|
|
90
|
+
if (typeof mod.createIfcOpenshellModule !== 'function') {
|
|
91
|
+
throw new IfcOpenShellError(`${specifier} does not export createIfcOpenshellModule`);
|
|
92
|
+
}
|
|
93
|
+
return mod.createIfcOpenshellModule;
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new IfcOpenShellError(`Failed to load IfcOpenShell API module from ${specifier}`, error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function validateAssets(assets) {
|
|
100
|
+
if (typeof assets?.initModule !== 'function') {
|
|
101
|
+
throw new IfcOpenShellError('wasmAssets.initModule must be the ifcopenshell_wasm.mjs module factory');
|
|
102
|
+
}
|
|
103
|
+
if (typeof assets.wasmUrl !== 'string' || assets.wasmUrl.length === 0) {
|
|
104
|
+
throw new IfcOpenShellError('wasmAssets.wasmUrl must point to ifcopenshell_wasm.wasm');
|
|
105
|
+
}
|
|
106
|
+
if (typeof assets.pluginBaseUrl !== 'string' || assets.pluginBaseUrl.length === 0) {
|
|
107
|
+
throw new IfcOpenShellError('wasmAssets.pluginBaseUrl must point to the plugin directory');
|
|
108
|
+
}
|
|
109
|
+
if (!assets.manifest || typeof assets.manifest !== 'object') {
|
|
110
|
+
throw new IfcOpenShellError('wasmAssets.manifest must be a plugin manifest object');
|
|
111
|
+
}
|
|
112
|
+
if (typeof assets.createIfcOpenshellModule !== 'function' &&
|
|
113
|
+
(typeof assets.apiModuleUrl !== 'string' || assets.apiModuleUrl.length === 0)) {
|
|
114
|
+
throw new IfcOpenShellError('wasmAssets must provide createIfcOpenshellModule or apiModuleUrl');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function readFs(mod) {
|
|
118
|
+
const fs = mod?.FS;
|
|
119
|
+
if (fs &&
|
|
120
|
+
typeof fs === 'object' &&
|
|
121
|
+
typeof fs.writeFile === 'function' &&
|
|
122
|
+
typeof fs.readFile === 'function') {
|
|
123
|
+
return fs;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
async function loadPlugin(raw, kind, id) {
|
|
128
|
+
try {
|
|
129
|
+
await raw.loadPlugin(kind, id);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const key = `${kind}:${id}`;
|
|
133
|
+
const suffix = error instanceof Error && error.message ? `: ${error.message}` : '';
|
|
134
|
+
throw new IfcOpenShellError(`Failed to load plugin ${key}${suffix}`, error);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAmBhC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,GACzB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,UAAuB,EAAE;IAC5C,IAAI,cAAc,EAAE,CAAC;QACnB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,4FAA4F,CAAC,CAAC,CAAC;QAC7I,CAAC;QACD,OAAO,cAAc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AAY,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,EAC7E,CAAC;QACD,MAAM,IAAI,iBAAiB,CACzB,kEAAkE,CACnE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,GAAY;IAC1B,MAAM,EAAE,GAAI,GAA+B,EAAE,EAAE,CAAC;IAChD,IACE,EAAE;QACF,OAAO,EAAE,KAAK,QAAQ;QACtB,OAAQ,EAA8B,CAAC,SAAS,KAAK,UAAU;QAC/D,OAAQ,EAA6B,CAAC,QAAQ,KAAK,UAAU,EAC7D,CAAC;QACD,OAAO,EAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,GAAuB,EAAE,IAAgB,EAAE,EAAU;IAC7E,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,iBAAiB,CAAC,yBAAyB,GAAG,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializer APIs for exporting IFC geometry and data.
|
|
3
|
+
*
|
|
4
|
+
* @module Serializers
|
|
5
|
+
*/
|
|
6
|
+
import type { File } from '../file.js';
|
|
7
|
+
/** Serializer progress in native processing order. */
|
|
8
|
+
export interface OperationProgress {
|
|
9
|
+
phase: string;
|
|
10
|
+
message: string;
|
|
11
|
+
ratio?: number;
|
|
12
|
+
current?: number;
|
|
13
|
+
}
|
|
14
|
+
import type { Settings } from '../geom/settings.js';
|
|
15
|
+
/** Formats supported by {@link exportToBuffer}. */
|
|
16
|
+
export type SerializerFormat = 'obj' | 'svg' | 'ttl';
|
|
17
|
+
/** Text buffers returned by a serializer; OBJ uses `secondary` for MTL data. */
|
|
18
|
+
export interface ExportResult {
|
|
19
|
+
/** Primary serialized content. */
|
|
20
|
+
primary: string;
|
|
21
|
+
/** Secondary content, used for the OBJ material file. */
|
|
22
|
+
secondary: string;
|
|
23
|
+
}
|
|
24
|
+
/** Geometry loading, serializer, cancellation, and progress options. */
|
|
25
|
+
export interface ExportOptions {
|
|
26
|
+
/** Previously loaded geometry kernel. Defaults to `passthrough`. */
|
|
27
|
+
kernel?: string;
|
|
28
|
+
/** Number of native geometry iterator threads. */
|
|
29
|
+
numThreads?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Abort the export between geometry elements. Checked between synchronous
|
|
32
|
+
* native calls; it cannot interrupt one native call already in progress.
|
|
33
|
+
*/
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Receive write and completion progress events. */
|
|
36
|
+
onProgress?(progress: OperationProgress): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Serialize the file into in-memory text buffers. Load kernel, mapping and serializer plugins first.
|
|
40
|
+
*
|
|
41
|
+
* OBJ returns its material data in `secondary`; SVG and TTL return an empty
|
|
42
|
+
* secondary buffer. The function returns `null` when the native iterator
|
|
43
|
+
* cannot initialize and throws when a serializer or geometry element fails.
|
|
44
|
+
*/
|
|
45
|
+
export declare function exportToBuffer(file: File, geomSettings: Settings, format: SerializerFormat, options?: ExportOptions): Promise<ExportResult | null>;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serializers/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAErD,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oDAAoD;IACpD,UAAU,CAAC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAChD;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,QAAQ,EACtB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAyE9B"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializer APIs for exporting IFC geometry and data.
|
|
3
|
+
*
|
|
4
|
+
* @module Serializers
|
|
5
|
+
*/
|
|
6
|
+
import { IfcOpenShellError, abortError, ifcopenshell, fs } from '../init.js';
|
|
7
|
+
/**
|
|
8
|
+
* Serialize the file into in-memory text buffers. Load kernel, mapping and serializer plugins first.
|
|
9
|
+
*
|
|
10
|
+
* OBJ returns its material data in `secondary`; SVG and TTL return an empty
|
|
11
|
+
* secondary buffer. The function returns `null` when the native iterator
|
|
12
|
+
* cannot initialize and throws when a serializer or geometry element fails.
|
|
13
|
+
*/
|
|
14
|
+
export async function exportToBuffer(file, geomSettings, format, options = {}) {
|
|
15
|
+
if (format !== 'obj' && format !== 'svg' && format !== 'ttl') {
|
|
16
|
+
throw new IfcOpenShellError(`Unsupported serializer format: ${format}`);
|
|
17
|
+
}
|
|
18
|
+
throwIfAborted(options.signal);
|
|
19
|
+
const kernel = options.kernel ?? 'passthrough';
|
|
20
|
+
let obj = null;
|
|
21
|
+
let mtl = null;
|
|
22
|
+
let serializer = null;
|
|
23
|
+
let iterator = null;
|
|
24
|
+
let outputPath = null;
|
|
25
|
+
try {
|
|
26
|
+
if (format === 'obj') {
|
|
27
|
+
obj = ifcopenshell.geom.createBuffer();
|
|
28
|
+
mtl = ifcopenshell.geom.createBuffer();
|
|
29
|
+
serializer = ifcopenshell.geom.createGeometrySerializerByStream('obj', mtl, obj, geomSettings);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
outputPath = uniquePath(format);
|
|
33
|
+
serializer = ifcopenshell.geom.createGeometrySerializerByPath(format, outputPath, outputPath, geomSettings);
|
|
34
|
+
}
|
|
35
|
+
if (!serializer || serializer.ptr === 0)
|
|
36
|
+
throw new IfcOpenShellError(`Failed to create ${format} serializer`);
|
|
37
|
+
serializer.setFile(file);
|
|
38
|
+
serializer.writeHeader();
|
|
39
|
+
iterator = ifcopenshell.geom.createIterator(kernel, geomSettings, file, options.numThreads ?? 1);
|
|
40
|
+
if (!iterator || iterator.ptr === 0)
|
|
41
|
+
throw new IfcOpenShellError('Failed to create geometry iterator');
|
|
42
|
+
if (!iterator.initialize())
|
|
43
|
+
return null;
|
|
44
|
+
const preferTriangulation = serializer.isTesselated();
|
|
45
|
+
let written = 0;
|
|
46
|
+
do {
|
|
47
|
+
throwIfAborted(options.signal);
|
|
48
|
+
writeElement(iterator, serializer, preferTriangulation);
|
|
49
|
+
written++;
|
|
50
|
+
if (written % 16 === 0) {
|
|
51
|
+
options.onProgress?.({
|
|
52
|
+
phase: 'write',
|
|
53
|
+
message: `Exporting ${format}`,
|
|
54
|
+
current: written,
|
|
55
|
+
ratio: progressRatio(iterator.progress()),
|
|
56
|
+
});
|
|
57
|
+
await tick();
|
|
58
|
+
}
|
|
59
|
+
} while (iterator.next());
|
|
60
|
+
serializer.finalize();
|
|
61
|
+
if (format === 'obj') {
|
|
62
|
+
return {
|
|
63
|
+
primary: obj?.isReady() ? obj.getValue() : '',
|
|
64
|
+
secondary: mtl?.isReady() ? mtl.getValue() : '',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (!fs)
|
|
68
|
+
throw new IfcOpenShellError(`Cannot read ${format} output without Emscripten FS`);
|
|
69
|
+
const bytes = fs.readFile(outputPath, { encoding: 'utf8' });
|
|
70
|
+
return { primary: typeof bytes === 'string' ? bytes : new TextDecoder().decode(bytes), secondary: '' };
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
release(iterator);
|
|
74
|
+
release(serializer);
|
|
75
|
+
release(obj);
|
|
76
|
+
release(mtl);
|
|
77
|
+
if (outputPath && fs) {
|
|
78
|
+
try {
|
|
79
|
+
fs.unlink(outputPath);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// ignore cleanup failure
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function writeElement(iterator, serializer, preferTriangulation) {
|
|
88
|
+
const failures = [];
|
|
89
|
+
const tri = () => {
|
|
90
|
+
let item = null;
|
|
91
|
+
try {
|
|
92
|
+
item = iterator.getAsTriangulationElement();
|
|
93
|
+
if (!item || item.ptr === 0) {
|
|
94
|
+
failures.push(new IfcOpenShellError('Geometry iterator did not provide a triangulation element'));
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
serializer.writeTriangulationElement(item);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
failures.push(error);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
release(item);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const brep = () => {
|
|
109
|
+
let item = null;
|
|
110
|
+
try {
|
|
111
|
+
item = iterator.getAsBrepElement();
|
|
112
|
+
if (!item || item.ptr === 0) {
|
|
113
|
+
failures.push(new IfcOpenShellError('Geometry iterator did not provide a BRep element'));
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
serializer.writeBrepElement(item);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
failures.push(error);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
release(item);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const written = preferTriangulation ? tri() || brep() : brep() || tri();
|
|
128
|
+
if (!written) {
|
|
129
|
+
const cause = failures.length === 1
|
|
130
|
+
? failures[0]
|
|
131
|
+
: new AggregateError(failures, 'Neither geometry representation could be serialized');
|
|
132
|
+
throw new IfcOpenShellError('Failed to serialize a geometry element as triangulation or BRep', cause);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function uniquePath(format) {
|
|
136
|
+
const stamp = `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
137
|
+
return `/ifcopenshell-js-${format}-${stamp}.${format}`;
|
|
138
|
+
}
|
|
139
|
+
function progressRatio(progress) {
|
|
140
|
+
if (!Number.isFinite(progress))
|
|
141
|
+
return 0;
|
|
142
|
+
if (progress > 1)
|
|
143
|
+
return Math.max(0, Math.min(1, progress / 100));
|
|
144
|
+
return Math.max(0, Math.min(1, progress));
|
|
145
|
+
}
|
|
146
|
+
function tick() {
|
|
147
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
148
|
+
}
|
|
149
|
+
function release(handle) {
|
|
150
|
+
try {
|
|
151
|
+
handle?.destroy();
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// ignore double destroy
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function throwIfAborted(signal) {
|
|
158
|
+
if (signal?.aborted)
|
|
159
|
+
throw abortError('IfcOpenShell operation was cancelled', signal.reason);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/serializers/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAmBH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AA4B7E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAU,EACV,YAAsB,EACtB,MAAwB,EACxB,UAAyB,EAAE;IAE3B,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAC7D,MAAM,IAAI,iBAAiB,CAAC,kCAAkC,MAAgB,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC;IAC/C,IAAI,GAAG,GAAkC,IAAI,CAAC;IAC9C,IAAI,GAAG,GAAkC,IAAI,CAAC;IAC9C,IAAI,UAAU,GAA8C,IAAI,CAAC;IACjE,IAAI,QAAQ,GAAoC,IAAI,CAAC;IACrD,IAAI,UAAU,GAAkB,IAAI,CAAC;IAErC,IAAI,CAAC;QACH,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvC,GAAG,GAAG,YAAY,CAAC,IAAI,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CAAC;AAED,SAAS,IAAI;IACX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,OAAO,CAAC,MAA8C;IAC7D,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,wBAAwB;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAA+B;IACrD,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,UAAU,CAAC,sCAAsC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/F,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { IfcOpenshellModule } from '@ifcopenshell/wasm/api';
|
|
2
|
+
export type { IfcOpenshellModule };
|
|
3
|
+
/** Raw pointer address in WASM linear memory. */
|
|
4
|
+
export type Ptr = number;
|
|
5
|
+
/**
|
|
6
|
+
* Subset of the Emscripten MEMFS filesystem API exposed by the underlying
|
|
7
|
+
* WASM runtime. Used by higher-level wrappers (for example the SVG/TTL
|
|
8
|
+
* serializers) to read, write, and delete files inside the virtual
|
|
9
|
+
* filesystem that the C++ layer writes to.
|
|
10
|
+
*/
|
|
11
|
+
export interface EmscriptenFS {
|
|
12
|
+
/**
|
|
13
|
+
* Write data to a virtual filesystem path.
|
|
14
|
+
*
|
|
15
|
+
* @param path - Destination path inside MEMFS.
|
|
16
|
+
* @param data - String or byte view to write.
|
|
17
|
+
* @param opts - Optional flags (e.g. `{ flags: 'w' }`).
|
|
18
|
+
*/
|
|
19
|
+
writeFile(path: string, data: string | ArrayBufferView | ArrayBuffer, opts?: {
|
|
20
|
+
flags?: string;
|
|
21
|
+
}): void;
|
|
22
|
+
/**
|
|
23
|
+
* Read a virtual filesystem file.
|
|
24
|
+
*
|
|
25
|
+
* When `opts.encoding === 'utf8'` the file is decoded to a string;
|
|
26
|
+
* otherwise a `Uint8Array` of the raw bytes is returned.
|
|
27
|
+
*/
|
|
28
|
+
readFile(path: string, opts?: {
|
|
29
|
+
encoding?: string;
|
|
30
|
+
flags?: string;
|
|
31
|
+
}): string | Uint8Array;
|
|
32
|
+
/** Delete a virtual filesystem entry. */
|
|
33
|
+
unlink(path: string): void;
|
|
34
|
+
/** Return whether a path exists in MEMFS. */
|
|
35
|
+
analyzePath(path: string): {
|
|
36
|
+
exists: boolean;
|
|
37
|
+
object?: object;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Identifiers for the plugin kinds supported by the WASM loader. */
|
|
41
|
+
export type PluginKind = 'schema' | 'kernel' | 'mapping' | 'tree' | 'document' | 'geometry_serializer';
|
|
42
|
+
/** A single entry in the plugin manifest, describing a loadable side module. */
|
|
43
|
+
export interface PluginEntry {
|
|
44
|
+
/** Relative path to the `.wasm` side module (resolved against `pluginBaseUrl`). */
|
|
45
|
+
wasm: string;
|
|
46
|
+
/** Plugin keys this entry depends on, e.g. `["kernel:occt"]`. */
|
|
47
|
+
depends?: string[];
|
|
48
|
+
}
|
|
49
|
+
/** The full plugin manifest (content of `ifcopenshell_plugins.json`). */
|
|
50
|
+
export interface PluginManifest {
|
|
51
|
+
schema?: Record<string, PluginEntry>;
|
|
52
|
+
kernel?: Record<string, PluginEntry>;
|
|
53
|
+
mapping?: Record<string, PluginEntry>;
|
|
54
|
+
document?: Record<string, PluginEntry>;
|
|
55
|
+
geometry_serializer?: Record<string, PluginEntry>;
|
|
56
|
+
tree?: Record<string, PluginEntry>;
|
|
57
|
+
}
|
|
58
|
+
/** Recursive value accepted by an Emscripten module factory. */
|
|
59
|
+
export type EmscriptenOption = null | boolean | number | string | EmscriptenOption[] | {
|
|
60
|
+
[key: string]: EmscriptenOption;
|
|
61
|
+
} | ((path: string, prefix: string) => string);
|
|
62
|
+
/** Emscripten module factory option map. */
|
|
63
|
+
export type EmscriptenOptions = Record<string, EmscriptenOption>;
|
|
64
|
+
/** Emscripten module factory — the default export of `ifcopenshell_wasm.mjs`. */
|
|
65
|
+
export type EmscriptenModuleFactory = (options?: EmscriptenOptions) => Promise<object>;
|
|
66
|
+
/** Generated API factory exported by `ifcopenshell_api.mjs`. */
|
|
67
|
+
export type IfcOpenshellApiFactory = (initModule: EmscriptenModuleFactory, wasmUrl?: string, opts?: {
|
|
68
|
+
pluginBaseUrl?: string;
|
|
69
|
+
pluginManifest?: Record<string, Record<string, {
|
|
70
|
+
wasm: string;
|
|
71
|
+
depends?: string[];
|
|
72
|
+
}>>;
|
|
73
|
+
pluginLoader?: PluginLoader;
|
|
74
|
+
}) => Promise<IfcOpenshellModule>;
|
|
75
|
+
/**
|
|
76
|
+
* Custom plugin loader function.
|
|
77
|
+
*
|
|
78
|
+
* Override this to change how plugin `.wasm` bytes are fetched.
|
|
79
|
+
* The default loader uses `fetch()` in the browser and is filesystem-backed in Node.
|
|
80
|
+
*/
|
|
81
|
+
export type PluginLoader = (url: string, plugin: {
|
|
82
|
+
kind: string;
|
|
83
|
+
id: string;
|
|
84
|
+
entry: PluginEntry;
|
|
85
|
+
}) => Promise<Uint8Array | ArrayBuffer | ArrayBufferView> | Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
86
|
+
/** Configuration for locating the WASM build artifacts. */
|
|
87
|
+
export interface WasmAssets {
|
|
88
|
+
/** The Emscripten module factory (default export of `ifcopenshell_wasm.mjs`). */
|
|
89
|
+
initModule: EmscriptenModuleFactory;
|
|
90
|
+
/** URL or path to `ifcopenshell_wasm.wasm`. */
|
|
91
|
+
wasmUrl: string;
|
|
92
|
+
/** Base URL for resolving plugin `.wasm` paths from the manifest. */
|
|
93
|
+
pluginBaseUrl: string;
|
|
94
|
+
/** Parsed content of `ifcopenshell_plugins.json`. */
|
|
95
|
+
manifest: PluginManifest;
|
|
96
|
+
/** Environment-appropriate loader for plugin WASM files. */
|
|
97
|
+
pluginLoader?: PluginLoader;
|
|
98
|
+
/**
|
|
99
|
+
* URL or module specifier for the generated `ifcopenshell_api.mjs`.
|
|
100
|
+
* Required when `createIfcOpenshellModule` is not provided.
|
|
101
|
+
*/
|
|
102
|
+
apiModuleUrl?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Generated API factory. Bundler-friendly wasm packages should provide this
|
|
105
|
+
* so app bundles do not need runtime string imports for `ifcopenshell_api.mjs`.
|
|
106
|
+
*/
|
|
107
|
+
createIfcOpenshellModule?: IfcOpenshellApiFactory;
|
|
108
|
+
}
|
|
109
|
+
/** Options for {@link init}. */
|
|
110
|
+
export interface InitOptions {
|
|
111
|
+
/** WASM asset configuration. */
|
|
112
|
+
wasmAssets?: WasmAssets;
|
|
113
|
+
/** Custom plugin loader override. Defaults to the loader supplied by the asset descriptor. */
|
|
114
|
+
pluginLoader?: PluginLoader;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,iDAAiD;AACjD,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,WAAW,EAC5C,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GACxB,IAAI,CAAC;IACR;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,UAAU,CAAC;IAC1F,yCAAyC;I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AChC,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** RGB triplet with components normalized to the `[0, 1]` range. */
|
|
2
|
+
export type RGB = [number, number, number];
|
|
3
|
+
/**
|
|
4
|
+
* Generate a deterministic RGB color from a string hash.
|
|
5
|
+
*
|
|
6
|
+
* Uses an FNV-1a style hash so that the same input always maps to the same
|
|
7
|
+
* color — handy for assigning consistent display colors to IFC entity
|
|
8
|
+
* types (e.g. `hashColor('IfcWall')`).
|
|
9
|
+
*
|
|
10
|
+
* Components are returned in the `[0, 1]` range and deliberately biased
|
|
11
|
+
* away from pure black / pure white so they remain visible on both light
|
|
12
|
+
* and dark backgrounds.
|
|
13
|
+
*
|
|
14
|
+
* @param input - Arbitrary string to hash.
|
|
15
|
+
* @returns A deterministic `[r, g, b]` triplet in `[0, 1]`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function hashColor(input: string): RGB;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the display color for a mesh, preferring material colors
|
|
20
|
+
* defined on the IFC representation over a type-based hash color.
|
|
21
|
+
*
|
|
22
|
+
* The `colors` buffer follows the IfcOpenShell convention: each material
|
|
23
|
+
* contributes four consecutive floats (`[r, g, b, a]`), and `materialIds`
|
|
24
|
+
* maps each face item to a material index. When a material color is
|
|
25
|
+
* available it is used directly; otherwise the entity `type` is hashed to
|
|
26
|
+
* produce a stable fallback color.
|
|
27
|
+
*
|
|
28
|
+
* @param type - IFC entity type name (e.g. `'IfcWall'`).
|
|
29
|
+
* @param materialIds - Per-face material indices (may be empty).
|
|
30
|
+
* @param colors - Flat RGBA material color buffer (may be empty).
|
|
31
|
+
* @returns A `[r, g, b]` triplet in `[0, 1]`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function meshColor(type: string, materialIds: ArrayLike<number>, colors: ArrayLike<number>): RGB;
|
|
34
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/util/color.ts"],"names":[],"mappings":"AACA,oEAAoE;AACpE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAM3C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAU5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,GAAG,CAOtG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Minimum brightness floor and maximum lift applied to hashed colors. */
|
|
2
|
+
const HASH_MIN = 0.25;
|
|
3
|
+
const HASH_SPAN = 0.55;
|
|
4
|
+
/**
|
|
5
|
+
* Generate a deterministic RGB color from a string hash.
|
|
6
|
+
*
|
|
7
|
+
* Uses an FNV-1a style hash so that the same input always maps to the same
|
|
8
|
+
* color — handy for assigning consistent display colors to IFC entity
|
|
9
|
+
* types (e.g. `hashColor('IfcWall')`).
|
|
10
|
+
*
|
|
11
|
+
* Components are returned in the `[0, 1]` range and deliberately biased
|
|
12
|
+
* away from pure black / pure white so they remain visible on both light
|
|
13
|
+
* and dark backgrounds.
|
|
14
|
+
*
|
|
15
|
+
* @param input - Arbitrary string to hash.
|
|
16
|
+
* @returns A deterministic `[r, g, b]` triplet in `[0, 1]`.
|
|
17
|
+
*/
|
|
18
|
+
export function hashColor(input) {
|
|
19
|
+
let h = 2166136261;
|
|
20
|
+
for (let i = 0; i < input.length; i++) {
|
|
21
|
+
h ^= input.charCodeAt(i);
|
|
22
|
+
h = Math.imul(h, 16777619);
|
|
23
|
+
}
|
|
24
|
+
const r = ((h >>> 0) & 0xff) / 255;
|
|
25
|
+
const g = ((h >>> 8) & 0xff) / 255;
|
|
26
|
+
const b = ((h >>> 16) & 0xff) / 255;
|
|
27
|
+
return [HASH_MIN + HASH_SPAN * r, HASH_MIN + HASH_SPAN * g, HASH_MIN + HASH_SPAN * b];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the display color for a mesh, preferring material colors
|
|
31
|
+
* defined on the IFC representation over a type-based hash color.
|
|
32
|
+
*
|
|
33
|
+
* The `colors` buffer follows the IfcOpenShell convention: each material
|
|
34
|
+
* contributes four consecutive floats (`[r, g, b, a]`), and `materialIds`
|
|
35
|
+
* maps each face item to a material index. When a material color is
|
|
36
|
+
* available it is used directly; otherwise the entity `type` is hashed to
|
|
37
|
+
* produce a stable fallback color.
|
|
38
|
+
*
|
|
39
|
+
* @param type - IFC entity type name (e.g. `'IfcWall'`).
|
|
40
|
+
* @param materialIds - Per-face material indices (may be empty).
|
|
41
|
+
* @param colors - Flat RGBA material color buffer (may be empty).
|
|
42
|
+
* @returns A `[r, g, b]` triplet in `[0, 1]`.
|
|
43
|
+
*/
|
|
44
|
+
export function meshColor(type, materialIds, colors) {
|
|
45
|
+
const materialId = materialIds.length > 0 ? materialIds[0] : -1;
|
|
46
|
+
const start = materialId >= 0 ? materialId * 4 : -1;
|
|
47
|
+
if (start >= 0 && colors.length >= start + 3) {
|
|
48
|
+
return [colors[start], colors[start + 1], colors[start + 2]];
|
|
49
|
+
}
|
|
50
|
+
return hashColor(type);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/util/color.ts"],"names":[],"mappings":"AAIA,0EAA0E;AAC1E,M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,MAAM,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAE,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAE,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility APIs for inspecting IFC entities and working with colors.
|
|
3
|
+
*
|
|
4
|
+
* @module Utilities
|
|
5
|
+
*/
|
|
6
|
+
export { hashColor, meshColor, type RGB, } from './color.js';
|
|
7
|
+
export { formatAttributeValue, inspectEntity, type AttributeEntry, type EntityInspection, } from './inspect.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,EACT,KAAK,GAAG,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,GAEV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,aAAa,GAGd,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AttributeValueType } from '../entity_instance.js';
|
|
2
|
+
import type { File } from '../file.js';
|
|
3
|
+
export interface AttributeEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface EntityInspection {
|
|
8
|
+
id: number;
|
|
9
|
+
type: string;
|
|
10
|
+
guid: string | null;
|
|
11
|
+
attributes: AttributeEntry[];
|
|
12
|
+
}
|
|
13
|
+
export declare function formatAttributeValue(value: AttributeValueType): string;
|
|
14
|
+
export declare function inspectEntity(file: File, id: number): Promise<EntityInspection | null>;
|
|
15
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/util/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;CAAE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAKtE;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAU5F"}
|