@ifc-lite/sdk 1.7.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/LICENSE +373 -0
- package/dist/context.d.ts +76 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +106 -0
- package/dist/context.js.map +1 -0
- package/dist/host.d.ts +29 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +91 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/namespaces/bcf.d.ts +36 -0
- package/dist/namespaces/bcf.d.ts.map +1 -0
- package/dist/namespaces/bcf.js +42 -0
- package/dist/namespaces/bcf.js.map +1 -0
- package/dist/namespaces/drawing.d.ts +30 -0
- package/dist/namespaces/drawing.d.ts.map +1 -0
- package/dist/namespaces/drawing.js +33 -0
- package/dist/namespaces/drawing.js.map +1 -0
- package/dist/namespaces/events.d.ts +14 -0
- package/dist/namespaces/events.d.ts.map +1 -0
- package/dist/namespaces/events.js +30 -0
- package/dist/namespaces/events.js.map +1 -0
- package/dist/namespaces/export.d.ts +38 -0
- package/dist/namespaces/export.d.ts.map +1 -0
- package/dist/namespaces/export.js +136 -0
- package/dist/namespaces/export.js.map +1 -0
- package/dist/namespaces/ids.d.ts +28 -0
- package/dist/namespaces/ids.d.ts.map +1 -0
- package/dist/namespaces/ids.js +40 -0
- package/dist/namespaces/ids.js.map +1 -0
- package/dist/namespaces/lens.d.ts +15 -0
- package/dist/namespaces/lens.d.ts.map +1 -0
- package/dist/namespaces/lens.js +25 -0
- package/dist/namespaces/lens.js.map +1 -0
- package/dist/namespaces/list.d.ts +19 -0
- package/dist/namespaces/list.d.ts.map +1 -0
- package/dist/namespaces/list.js +19 -0
- package/dist/namespaces/list.js.map +1 -0
- package/dist/namespaces/model.d.ts +15 -0
- package/dist/namespaces/model.d.ts.map +1 -0
- package/dist/namespaces/model.js +30 -0
- package/dist/namespaces/model.js.map +1 -0
- package/dist/namespaces/mutate.d.ts +21 -0
- package/dist/namespaces/mutate.d.ts.map +1 -0
- package/dist/namespaces/mutate.js +41 -0
- package/dist/namespaces/mutate.js.map +1 -0
- package/dist/namespaces/query.d.ts +60 -0
- package/dist/namespaces/query.d.ts.map +1 -0
- package/dist/namespaces/query.js +158 -0
- package/dist/namespaces/query.js.map +1 -0
- package/dist/namespaces/spatial.d.ts +20 -0
- package/dist/namespaces/spatial.d.ts.map +1 -0
- package/dist/namespaces/spatial.js +28 -0
- package/dist/namespaces/spatial.js.map +1 -0
- package/dist/namespaces/viewer.d.ts +46 -0
- package/dist/namespaces/viewer.d.ts.map +1 -0
- package/dist/namespaces/viewer.js +91 -0
- package/dist/namespaces/viewer.js.map +1 -0
- package/dist/transport/broadcast.d.ts +23 -0
- package/dist/transport/broadcast.d.ts.map +1 -0
- package/dist/transport/broadcast.js +59 -0
- package/dist/transport/broadcast.js.map +1 -0
- package/dist/transport/message-port.d.ts +20 -0
- package/dist/transport/message-port.d.ts.map +1 -0
- package/dist/transport/message-port.js +57 -0
- package/dist/transport/message-port.js.map +1 -0
- package/dist/transport/remote-backend.d.ts +23 -0
- package/dist/transport/remote-backend.d.ts.map +1 -0
- package/dist/transport/remote-backend.js +36 -0
- package/dist/transport/remote-backend.js.map +1 -0
- package/dist/transport/types.d.ts +10 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +5 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/types.d.ts +236 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +33 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
export function entityRefToString(ref) {
|
|
5
|
+
return `${ref.modelId}:${ref.expressId}`;
|
|
6
|
+
}
|
|
7
|
+
export function stringToEntityRef(s) {
|
|
8
|
+
const idx = s.indexOf(':');
|
|
9
|
+
if (idx < 1) {
|
|
10
|
+
throw new Error(`Invalid EntityRefString: "${s}" — expected "modelId:expressId"`);
|
|
11
|
+
}
|
|
12
|
+
const expressId = Number(s.slice(idx + 1));
|
|
13
|
+
if (!Number.isFinite(expressId) || expressId < 0) {
|
|
14
|
+
throw new Error(`Invalid expressId in EntityRefString: "${s}"`);
|
|
15
|
+
}
|
|
16
|
+
return { modelId: s.slice(0, idx), expressId };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Route a string-based SdkRequest to the appropriate typed method on a BimBackend.
|
|
20
|
+
* Used by BimHost for wire protocol compatibility.
|
|
21
|
+
*/
|
|
22
|
+
export function dispatchToBackend(backend, namespace, method, args) {
|
|
23
|
+
const ns = backend[namespace];
|
|
24
|
+
if (!ns || typeof ns !== 'object') {
|
|
25
|
+
throw new Error(`Unknown namespace '${namespace}'`);
|
|
26
|
+
}
|
|
27
|
+
const fn = ns[method];
|
|
28
|
+
if (typeof fn !== 'function') {
|
|
29
|
+
throw new Error(`Unknown method '${namespace}.${method}'`);
|
|
30
|
+
}
|
|
31
|
+
return fn(...args);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAsB/D,MAAM,UAAU,iBAAiB,CAAC,GAAc;IAC9C,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAkB;IAClD,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,kCAAkC,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC;AAkRD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB,EAAE,SAAiB,EAAE,MAAc,EAAE,IAAe;IACvG,MAAM,EAAE,GAAI,OAAmF,CAAC,SAAS,CAAC,CAAC;IAC3G,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,GAAG,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,IAAI,MAAM,GAAG,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ifc-lite/sdk",
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "Scripting SDK for ifc-lite — the bim.* API for BIM automation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@ifc-lite/parser": "^1.8.0",
|
|
16
|
+
"@ifc-lite/query": "^1.8.0",
|
|
17
|
+
"@ifc-lite/lens": "^1.8.0",
|
|
18
|
+
"@ifc-lite/ids": "^1.8.0",
|
|
19
|
+
"@ifc-lite/bcf": "^1.8.0",
|
|
20
|
+
"@ifc-lite/data": "^1.8.0",
|
|
21
|
+
"@ifc-lite/lists": "^1.8.0",
|
|
22
|
+
"@ifc-lite/mutations": "^1.8.0",
|
|
23
|
+
"@ifc-lite/export": "^1.8.0",
|
|
24
|
+
"@ifc-lite/drawing-2d": "^1.8.0",
|
|
25
|
+
"@ifc-lite/encoding": "^1.8.0",
|
|
26
|
+
"@ifc-lite/spatial": "^1.8.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.3.0",
|
|
30
|
+
"vitest": "^1.6.0"
|
|
31
|
+
},
|
|
32
|
+
"license": "MPL-2.0",
|
|
33
|
+
"author": "Louis True",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/louistrue/ifc-lite.git",
|
|
37
|
+
"directory": "packages/sdk"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://louistrue.github.io/ifc-lite/",
|
|
40
|
+
"bugs": "https://github.com/louistrue/ifc-lite/issues",
|
|
41
|
+
"keywords": [
|
|
42
|
+
"ifc",
|
|
43
|
+
"bim",
|
|
44
|
+
"sdk",
|
|
45
|
+
"scripting",
|
|
46
|
+
"automation",
|
|
47
|
+
"aec"
|
|
48
|
+
],
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"README.md"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc",
|
|
58
|
+
"dev": "tsc --watch",
|
|
59
|
+
"test": "vitest run"
|
|
60
|
+
}
|
|
61
|
+
}
|