@archilogic/extension-sdk 0.2.2 → 0.2.4
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/CHANGELOG.md +12 -0
- package/dist/extension-sdk.js +60 -60
- package/dist/index.d.ts +95 -26
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @archilogic/extension-sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c5b34f8: fix: update extension host url
|
|
8
|
+
|
|
9
|
+
## 0.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 67f694a: chore: update space-graph and floor-plan-engine dependencies
|
|
14
|
+
|
|
3
15
|
## 0.2.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/extension-sdk.js
CHANGED
|
@@ -34,11 +34,11 @@ var Pe = class extends Error {
|
|
|
34
34
|
f(this, B, Se);
|
|
35
35
|
this.value = e, this.transferables = t == null ? void 0 : t.transferables;
|
|
36
36
|
}
|
|
37
|
-
}, B = new WeakMap(), ae), me = Ce, M = "penpal", W = (e) => typeof e == "object" && e !== null,
|
|
37
|
+
}, B = new WeakMap(), ae), me = Ce, M = "penpal", W = (e) => typeof e == "object" && e !== null, de = (e) => typeof e == "function", Re = (e) => W(e) && e.namespace === M, j = (e) => e.type === "SYN", X = (e) => e.type === "ACK1", g = (e) => e.type === "ACK2", ce = (e) => e.type === "CALL", le = (e) => e.type === "REPLY", Ne = (e) => e.type === "DESTROY", ue = (e, t = []) => {
|
|
38
38
|
const r = [];
|
|
39
39
|
for (const a of Object.keys(e)) {
|
|
40
40
|
const n = e[a];
|
|
41
|
-
|
|
41
|
+
de(n) ? r.push([...t, a]) : W(n) && r.push(
|
|
42
42
|
...ue(n, [...t, a])
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -48,7 +48,7 @@ var Pe = class extends Error {
|
|
|
48
48
|
(a, n) => W(a) ? a[n] : void 0,
|
|
49
49
|
t
|
|
50
50
|
);
|
|
51
|
-
return
|
|
51
|
+
return de(r) ? r : void 0;
|
|
52
52
|
}, C = (e) => e.join("."), ee = (e, t, r) => ({
|
|
53
53
|
namespace: M,
|
|
54
54
|
channel: e,
|
|
@@ -58,8 +58,8 @@ var Pe = class extends Error {
|
|
|
58
58
|
...r instanceof Error ? { value: Ie(r), isSerializedErrorInstance: !0 } : { value: r }
|
|
59
59
|
}), Te = (e, t, r, a) => {
|
|
60
60
|
let n = !1;
|
|
61
|
-
const
|
|
62
|
-
if (n || !
|
|
61
|
+
const c = async (l) => {
|
|
62
|
+
if (n || !ce(l))
|
|
63
63
|
return;
|
|
64
64
|
a == null || a(`Received ${C(l.methodPath)}() call`, l);
|
|
65
65
|
const { methodPath: v, args: h, id: o } = l;
|
|
@@ -89,12 +89,12 @@ var Pe = class extends Error {
|
|
|
89
89
|
throw u.name === "DataCloneError" && (i = ee(r, o, u), a == null || a(`Sending ${C(v)}() reply`, i), e.sendMessage(i)), u;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
return e.addMessageHandler(
|
|
93
|
-
n = !0, e.removeMessageHandler(
|
|
92
|
+
return e.addMessageHandler(c), () => {
|
|
93
|
+
n = !0, e.removeMessageHandler(c);
|
|
94
94
|
};
|
|
95
95
|
}, De = Te, se, he = ((se = crypto.randomUUID) == null ? void 0 : se.bind(crypto)) ?? (() => new Array(4).fill(0).map(
|
|
96
96
|
() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)
|
|
97
|
-
).join("-")), Le = Symbol("CallOptions"), J, ie,
|
|
97
|
+
).join("-")), Le = Symbol("CallOptions"), J, ie, ke = (ie = class {
|
|
98
98
|
constructor(e) {
|
|
99
99
|
P(this, "transferables");
|
|
100
100
|
P(this, "timeout");
|
|
@@ -104,7 +104,7 @@ var Pe = class extends Error {
|
|
|
104
104
|
f(this, J, Le);
|
|
105
105
|
this.transferables = e == null ? void 0 : e.transferables, this.timeout = e == null ? void 0 : e.timeout;
|
|
106
106
|
}
|
|
107
|
-
}, J = new WeakMap(), ie),
|
|
107
|
+
}, J = new WeakMap(), ie), be = ke, Oe = /* @__PURE__ */ new Set(["apply", "call", "bind"]), pe = (e, t, r = []) => new Proxy(
|
|
108
108
|
r.length ? () => {
|
|
109
109
|
} : /* @__PURE__ */ Object.create(null),
|
|
110
110
|
{
|
|
@@ -112,8 +112,8 @@ var Pe = class extends Error {
|
|
|
112
112
|
if (n !== "then")
|
|
113
113
|
return r.length && Oe.has(n) ? Reflect.get(a, n) : pe(e, t, [...r, n]);
|
|
114
114
|
},
|
|
115
|
-
apply(a, n,
|
|
116
|
-
return e(r,
|
|
115
|
+
apply(a, n, c) {
|
|
116
|
+
return e(r, c);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
), te = (e) => new w(
|
|
@@ -123,7 +123,7 @@ var Pe = class extends Error {
|
|
|
123
123
|
)}() failed due to destroyed connection`
|
|
124
124
|
), He = (e, t, r) => {
|
|
125
125
|
let a = !1;
|
|
126
|
-
const n = /* @__PURE__ */ new Map(),
|
|
126
|
+
const n = /* @__PURE__ */ new Map(), c = (h) => {
|
|
127
127
|
if (!le(h))
|
|
128
128
|
return;
|
|
129
129
|
const { callId: o, value: i, isError: E, isSerializedErrorInstance: u } = h, p = n.get(o);
|
|
@@ -134,13 +134,13 @@ var Pe = class extends Error {
|
|
|
134
134
|
u ? Ae(i) : i
|
|
135
135
|
) : p.resolve(i));
|
|
136
136
|
};
|
|
137
|
-
return e.addMessageHandler(
|
|
137
|
+
return e.addMessageHandler(c), {
|
|
138
138
|
remoteProxy: pe((h, o) => {
|
|
139
139
|
if (a)
|
|
140
140
|
throw te(h);
|
|
141
|
-
const i = he(), E = o[o.length - 1], u = E instanceof
|
|
141
|
+
const i = he(), E = o[o.length - 1], u = E instanceof be, { timeout: p, transferables: K } = u ? E : {}, F = u ? o.slice(0, -1) : o;
|
|
142
142
|
return new Promise((Y, O) => {
|
|
143
|
-
const
|
|
143
|
+
const z = p !== void 0 ? window.setTimeout(() => {
|
|
144
144
|
n.delete(i), O(
|
|
145
145
|
new w(
|
|
146
146
|
"METHOD_CALL_TIMEOUT",
|
|
@@ -150,7 +150,7 @@ var Pe = class extends Error {
|
|
|
150
150
|
)
|
|
151
151
|
);
|
|
152
152
|
}, p) : void 0;
|
|
153
|
-
n.set(i, { methodPath: h, resolve: Y, reject: O, timeoutId:
|
|
153
|
+
n.set(i, { methodPath: h, resolve: Y, reject: O, timeoutId: z });
|
|
154
154
|
try {
|
|
155
155
|
const T = {
|
|
156
156
|
namespace: M,
|
|
@@ -169,7 +169,7 @@ var Pe = class extends Error {
|
|
|
169
169
|
});
|
|
170
170
|
}, r),
|
|
171
171
|
destroy: () => {
|
|
172
|
-
a = !0, e.removeMessageHandler(
|
|
172
|
+
a = !0, e.removeMessageHandler(c);
|
|
173
173
|
for (const { methodPath: h, reject: o, timeoutId: i } of n.values())
|
|
174
174
|
clearTimeout(i), o(te(h));
|
|
175
175
|
n.clear();
|
|
@@ -245,7 +245,7 @@ var Pe = class extends Error {
|
|
|
245
245
|
penpal: "synAck",
|
|
246
246
|
methodNames: e.methodPaths.map(re)
|
|
247
247
|
};
|
|
248
|
-
if (
|
|
248
|
+
if (ce(e))
|
|
249
249
|
return {
|
|
250
250
|
penpal: "call",
|
|
251
251
|
// Actually converting the ID to a number would break communication.
|
|
@@ -278,7 +278,7 @@ var Pe = class extends Error {
|
|
|
278
278
|
channel: a,
|
|
279
279
|
log: n
|
|
280
280
|
}) => {
|
|
281
|
-
const
|
|
281
|
+
const c = he();
|
|
282
282
|
let l;
|
|
283
283
|
const v = [];
|
|
284
284
|
let h = !1;
|
|
@@ -290,33 +290,33 @@ var Pe = class extends Error {
|
|
|
290
290
|
)
|
|
291
291
|
);
|
|
292
292
|
}, r) : void 0, K = () => {
|
|
293
|
-
for (const
|
|
294
|
-
|
|
293
|
+
for (const d of v)
|
|
294
|
+
d();
|
|
295
295
|
}, F = () => {
|
|
296
296
|
if (h)
|
|
297
297
|
return;
|
|
298
298
|
v.push(De(e, t, a, n));
|
|
299
|
-
const { remoteProxy:
|
|
299
|
+
const { remoteProxy: d, destroy: m } = xe(e, a, n);
|
|
300
300
|
v.push(m), clearTimeout(p), h = !0, E({
|
|
301
|
-
remoteProxy:
|
|
301
|
+
remoteProxy: d,
|
|
302
302
|
destroy: K
|
|
303
303
|
});
|
|
304
304
|
}, Y = () => {
|
|
305
|
-
const
|
|
305
|
+
const d = {
|
|
306
306
|
namespace: M,
|
|
307
307
|
type: "SYN",
|
|
308
308
|
channel: a,
|
|
309
|
-
participantId:
|
|
309
|
+
participantId: c
|
|
310
310
|
};
|
|
311
|
-
n == null || n("Sending handshake SYN",
|
|
311
|
+
n == null || n("Sending handshake SYN", d);
|
|
312
312
|
try {
|
|
313
|
-
e.sendMessage(
|
|
313
|
+
e.sendMessage(d);
|
|
314
314
|
} catch (m) {
|
|
315
315
|
u(new w("TRANSMISSION_FAILED", m.message));
|
|
316
316
|
}
|
|
317
|
-
}, O = (
|
|
318
|
-
if (n == null || n("Received handshake SYN",
|
|
319
|
-
l !== G || (l =
|
|
317
|
+
}, O = (d) => {
|
|
318
|
+
if (n == null || n("Received handshake SYN", d), d.participantId === l && // TODO: Used for backward-compatibility. Remove in next major version.
|
|
319
|
+
l !== G || (l = d.participantId, Y(), !(c > l || // TODO: Used for backward-compatibility. Remove in next major version.
|
|
320
320
|
l === G)))
|
|
321
321
|
return;
|
|
322
322
|
const $ = {
|
|
@@ -332,8 +332,8 @@ var Pe = class extends Error {
|
|
|
332
332
|
u(new w("TRANSMISSION_FAILED", Me.message));
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
|
-
},
|
|
336
|
-
n == null || n("Received handshake ACK1",
|
|
335
|
+
}, z = (d) => {
|
|
336
|
+
n == null || n("Received handshake ACK1", d);
|
|
337
337
|
const m = {
|
|
338
338
|
namespace: M,
|
|
339
339
|
channel: a,
|
|
@@ -347,16 +347,16 @@ var Pe = class extends Error {
|
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
349
|
F();
|
|
350
|
-
}, T = (
|
|
351
|
-
n == null || n("Received handshake ACK2",
|
|
352
|
-
}, q = (
|
|
353
|
-
j(
|
|
350
|
+
}, T = (d) => {
|
|
351
|
+
n == null || n("Received handshake ACK2", d), F();
|
|
352
|
+
}, q = (d) => {
|
|
353
|
+
j(d) && O(d), X(d) && z(d), g(d) && T(d);
|
|
354
354
|
};
|
|
355
355
|
return e.addMessageHandler(q), v.push(() => e.removeMessageHandler(q)), Y(), i;
|
|
356
|
-
},
|
|
356
|
+
}, ze = Ke, ge = (e) => {
|
|
357
357
|
let t = !1, r;
|
|
358
358
|
return (...a) => (t || (t = !0, r = e(...a)), r);
|
|
359
|
-
}, Ge =
|
|
359
|
+
}, Ge = ge, ne = /* @__PURE__ */ new WeakSet(), Be = ({
|
|
360
360
|
messenger: e,
|
|
361
361
|
methods: t = {},
|
|
362
362
|
timeout: r,
|
|
@@ -371,7 +371,7 @@ var Pe = class extends Error {
|
|
|
371
371
|
"A messenger can only be used for a single connection"
|
|
372
372
|
);
|
|
373
373
|
ne.add(e);
|
|
374
|
-
const
|
|
374
|
+
const c = [e.destroy], l = Ge((o) => {
|
|
375
375
|
if (o) {
|
|
376
376
|
const i = {
|
|
377
377
|
namespace: M,
|
|
@@ -383,7 +383,7 @@ var Pe = class extends Error {
|
|
|
383
383
|
} catch {
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
for (const i of
|
|
386
|
+
for (const i of c)
|
|
387
387
|
i();
|
|
388
388
|
n == null || n("Connection destroyed");
|
|
389
389
|
}), v = (o) => Re(o) && o.channel === a;
|
|
@@ -393,14 +393,14 @@ var Pe = class extends Error {
|
|
|
393
393
|
e.initialize({ log: n, validateReceivedMessage: v }), e.addMessageHandler((E) => {
|
|
394
394
|
Ne(E) && l(!1);
|
|
395
395
|
});
|
|
396
|
-
const { remoteProxy: o, destroy: i } = await
|
|
396
|
+
const { remoteProxy: o, destroy: i } = await ze({
|
|
397
397
|
messenger: e,
|
|
398
398
|
methods: t,
|
|
399
399
|
timeout: r,
|
|
400
400
|
channel: a,
|
|
401
401
|
log: n
|
|
402
402
|
});
|
|
403
|
-
return
|
|
403
|
+
return c.push(i), o;
|
|
404
404
|
} catch (o) {
|
|
405
405
|
throw l(!0), o;
|
|
406
406
|
}
|
|
@@ -411,7 +411,7 @@ var Pe = class extends Error {
|
|
|
411
411
|
l(!0);
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
|
-
}, ve = Be, A, R, D, L, N, S, y, _, V,
|
|
414
|
+
}, ve = Be, A, R, D, L, N, S, y, _, V, k, H, x, b, oe, Je = (oe = class {
|
|
415
415
|
constructor({ remoteWindow: e, allowedOrigins: t }) {
|
|
416
416
|
f(this, A);
|
|
417
417
|
f(this, R);
|
|
@@ -430,7 +430,7 @@ var Pe = class extends Error {
|
|
|
430
430
|
});
|
|
431
431
|
P(this, "sendMessage", (e, t) => {
|
|
432
432
|
if (j(e)) {
|
|
433
|
-
const r = s(this,
|
|
433
|
+
const r = s(this, k).call(this, e);
|
|
434
434
|
s(this, A).postMessage(e, {
|
|
435
435
|
targetOrigin: r,
|
|
436
436
|
transfer: t
|
|
@@ -441,19 +441,19 @@ var Pe = class extends Error {
|
|
|
441
441
|
// downgrade the message and send it through the window rather than
|
|
442
442
|
// the port because older versions of Penpal don't use MessagePorts.
|
|
443
443
|
s(this, _)) {
|
|
444
|
-
const r = s(this, _) ? We(e) : e, a = s(this,
|
|
444
|
+
const r = s(this, _) ? We(e) : e, a = s(this, k).call(this, e);
|
|
445
445
|
s(this, A).postMessage(r, {
|
|
446
446
|
targetOrigin: a,
|
|
447
447
|
transfer: t
|
|
448
448
|
});
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
if (
|
|
451
|
+
if (g(e)) {
|
|
452
452
|
const { port1: r, port2: a } = new MessageChannel();
|
|
453
|
-
I(this, y, r), r.addEventListener("message", s(this,
|
|
454
|
-
const n = [a, ...t || []],
|
|
453
|
+
I(this, y, r), r.addEventListener("message", s(this, b)), r.start();
|
|
454
|
+
const n = [a, ...t || []], c = s(this, k).call(this, e);
|
|
455
455
|
s(this, A).postMessage(e, {
|
|
456
|
-
targetOrigin:
|
|
456
|
+
targetOrigin: c,
|
|
457
457
|
transfer: n
|
|
458
458
|
});
|
|
459
459
|
return;
|
|
@@ -478,7 +478,7 @@ var Pe = class extends Error {
|
|
|
478
478
|
f(this, V, (e) => s(this, R).some(
|
|
479
479
|
(t) => t instanceof RegExp ? t.test(e) : t === e || t === "*"
|
|
480
480
|
));
|
|
481
|
-
f(this,
|
|
481
|
+
f(this, k, (e) => {
|
|
482
482
|
if (j(e))
|
|
483
483
|
return "*";
|
|
484
484
|
if (!s(this, N))
|
|
@@ -487,7 +487,7 @@ var Pe = class extends Error {
|
|
|
487
487
|
});
|
|
488
488
|
f(this, H, () => {
|
|
489
489
|
var e, t;
|
|
490
|
-
(e = s(this, y)) == null || e.removeEventListener("message", s(this,
|
|
490
|
+
(e = s(this, y)) == null || e.removeEventListener("message", s(this, b)), (t = s(this, y)) == null || t.close(), I(this, y, void 0);
|
|
491
491
|
});
|
|
492
492
|
f(this, x, ({
|
|
493
493
|
source: e,
|
|
@@ -495,11 +495,11 @@ var Pe = class extends Error {
|
|
|
495
495
|
ports: r,
|
|
496
496
|
data: a
|
|
497
497
|
}) => {
|
|
498
|
-
var n,
|
|
498
|
+
var n, c, l;
|
|
499
499
|
if (e === s(this, A) && (je(a) && ((n = s(this, D)) == null || n.call(
|
|
500
500
|
this,
|
|
501
501
|
"Please upgrade the child window to the latest version of Penpal."
|
|
502
|
-
), I(this, _, !0), a = Ve(a)), !!((
|
|
502
|
+
), I(this, _, !0), a = Ve(a)), !!((c = s(this, L)) != null && c.call(this, a)))) {
|
|
503
503
|
if (!s(this, V).call(this, t)) {
|
|
504
504
|
(l = s(this, D)) == null || l.call(
|
|
505
505
|
this,
|
|
@@ -507,18 +507,18 @@ var Pe = class extends Error {
|
|
|
507
507
|
);
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
if (j(a) && (s(this, H).call(this), I(this, N, t)),
|
|
510
|
+
if (j(a) && (s(this, H).call(this), I(this, N, t)), g(a) && // Previous versions of Penpal don't use MessagePorts and do all
|
|
511
511
|
// communication through the window.
|
|
512
512
|
!s(this, _)) {
|
|
513
513
|
if (I(this, y, r[0]), !s(this, y))
|
|
514
514
|
throw new U("No port received on ACK2");
|
|
515
|
-
s(this, y).addEventListener("message", s(this,
|
|
515
|
+
s(this, y).addEventListener("message", s(this, b)), s(this, y).start();
|
|
516
516
|
}
|
|
517
517
|
for (const v of s(this, S))
|
|
518
518
|
v(a);
|
|
519
519
|
}
|
|
520
520
|
});
|
|
521
|
-
f(this,
|
|
521
|
+
f(this, b, ({ data: e }) => {
|
|
522
522
|
var t;
|
|
523
523
|
if ((t = s(this, L)) != null && t.call(this, e))
|
|
524
524
|
for (const r of s(this, S))
|
|
@@ -528,12 +528,12 @@ var Pe = class extends Error {
|
|
|
528
528
|
throw new w("INVALID_ARGUMENT", "remoteWindow must be defined");
|
|
529
529
|
I(this, A, e), I(this, R, t != null && t.length ? t : [window.origin]);
|
|
530
530
|
}
|
|
531
|
-
}, A = new WeakMap(), R = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), S = new WeakMap(), y = new WeakMap(), _ = new WeakMap(), V = new WeakMap(),
|
|
531
|
+
}, A = new WeakMap(), R = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), S = new WeakMap(), y = new WeakMap(), _ = new WeakMap(), V = new WeakMap(), k = new WeakMap(), H = new WeakMap(), x = new WeakMap(), b = new WeakMap(), oe), ye = Je;
|
|
532
532
|
const Qe = (e, t) => {
|
|
533
533
|
const r = new ye({
|
|
534
534
|
remoteWindow: e.contentWindow,
|
|
535
535
|
// Defaults to the current origin.
|
|
536
|
-
allowedOrigins: [/^http:\/\/localhost(:\d+)/, "https://archilogic
|
|
536
|
+
allowedOrigins: [/^http:\/\/localhost(:\d+)/, "https://extensions.archilogic.io"]
|
|
537
537
|
// Alternatively,
|
|
538
538
|
// allowedOrigins: [new Url(iframe.src).origin]
|
|
539
539
|
});
|
|
@@ -572,8 +572,8 @@ const Qe = (e, t) => {
|
|
|
572
572
|
return new Proxy(
|
|
573
573
|
{},
|
|
574
574
|
{
|
|
575
|
-
get(n,
|
|
576
|
-
return async (...l) => (await r.promise)[
|
|
575
|
+
get(n, c) {
|
|
576
|
+
return async (...l) => (await r.promise)[c](...l);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
);
|
package/dist/index.d.ts
CHANGED
|
@@ -531,8 +531,6 @@ declare type EdgeSplitValue = {
|
|
|
531
531
|
updateSpaceBoundaries?: boolean;
|
|
532
532
|
};
|
|
533
533
|
|
|
534
|
-
declare type EdgeType = 'graph:adjacentTo' | 'graph:connectedTo';
|
|
535
|
-
|
|
536
534
|
declare class EdgeUpdate extends OperationBase {
|
|
537
535
|
type: typeof EdgeUpdateTypeValue;
|
|
538
536
|
value: EdgeVertexValue;
|
|
@@ -848,21 +846,38 @@ declare const GeometryUnionTypeValue = "csg:union";
|
|
|
848
846
|
/**
|
|
849
847
|
* undirected graph for traversal without edge weights
|
|
850
848
|
*/
|
|
851
|
-
declare class Graph {
|
|
852
|
-
nodeMap: Map<
|
|
853
|
-
addNode(node:
|
|
854
|
-
addEdge(type:
|
|
855
|
-
removeNode(node:
|
|
856
|
-
removeEdge(type:
|
|
849
|
+
declare class Graph<T extends GraphNodeType = GraphNodeType, K extends string = GraphEdgeType> {
|
|
850
|
+
nodeMap: Map<T, Map<K, Set<T>>>;
|
|
851
|
+
addNode(node: T): Map<K, Set<T>>;
|
|
852
|
+
addEdge(type: K, source: T, destination: T): void;
|
|
853
|
+
removeNode(node: T): void;
|
|
854
|
+
removeEdge(type: K, source: T, destination: T): void;
|
|
857
855
|
/**
|
|
858
856
|
* Breadth-First Search
|
|
859
857
|
* if edges have weights this needs to be replaces with dijkstra algorithm
|
|
860
858
|
*/
|
|
861
|
-
findShortestPath(edgeType:
|
|
859
|
+
findShortestPath(edgeType: K, start: T, end: T, options?: {
|
|
862
860
|
depthLimit?: number;
|
|
863
|
-
}):
|
|
861
|
+
}): T[] | null;
|
|
862
|
+
toJSON(): {
|
|
863
|
+
nodes: {
|
|
864
|
+
id: string;
|
|
865
|
+
type: string;
|
|
866
|
+
}[];
|
|
867
|
+
edges: {
|
|
868
|
+
type: string;
|
|
869
|
+
nodes: string[];
|
|
870
|
+
}[];
|
|
871
|
+
};
|
|
864
872
|
}
|
|
865
873
|
|
|
874
|
+
declare type GraphEdgeType = 'graph:adjacentTo' | 'graph:connectedTo';
|
|
875
|
+
|
|
876
|
+
declare type GraphNodeType = {
|
|
877
|
+
id: string;
|
|
878
|
+
type: string;
|
|
879
|
+
};
|
|
880
|
+
|
|
866
881
|
declare class GroupRelation extends SpaceGraphNodeBase {
|
|
867
882
|
type: GroupRelationType;
|
|
868
883
|
elements: Set<LayoutElement>;
|
|
@@ -1202,6 +1217,8 @@ declare class LayoutAsset extends LayoutTransformElementBase {
|
|
|
1202
1217
|
parameters: LayoutAssetParameters;
|
|
1203
1218
|
product: SpaceGraphProduct | null;
|
|
1204
1219
|
constructor(id: string);
|
|
1220
|
+
get isComponentInstance(): boolean;
|
|
1221
|
+
get isComponentInstanceChild(): boolean;
|
|
1205
1222
|
setParameters(parameters: RecursivePartial<LayoutAssetParameters>): void;
|
|
1206
1223
|
setProduct(product: SpaceGraphProduct): void;
|
|
1207
1224
|
getBoundingBox(localTransform?: boolean): {
|
|
@@ -2636,7 +2653,8 @@ declare class SpaceGraph {
|
|
|
2636
2653
|
products: SpaceGraphProduct[];
|
|
2637
2654
|
productsById: Record<string, SpaceGraphProduct>;
|
|
2638
2655
|
productsByType: NodesByType<{
|
|
2639
|
-
readonly 'product:static': typeof
|
|
2656
|
+
readonly 'product:static': typeof SpaceGraphProductStatic;
|
|
2657
|
+
readonly 'product:component': typeof SpaceGraphProductComponent;
|
|
2640
2658
|
}>;
|
|
2641
2659
|
customAttributes: SpaceGraphCustomAttribute[];
|
|
2642
2660
|
customAttributesById: Record<string, SpaceGraphCustomAttribute>;
|
|
@@ -2673,7 +2691,8 @@ declare class SpaceGraph {
|
|
|
2673
2691
|
readonly 'spatialStructure:floor': typeof SpaceGraphFloor;
|
|
2674
2692
|
readonly 'spatialStructure:layout': typeof SpaceGraphLayout;
|
|
2675
2693
|
readonly 'relation:group': typeof GroupRelation;
|
|
2676
|
-
readonly 'product:static': typeof
|
|
2694
|
+
readonly 'product:static': typeof SpaceGraphProductStatic;
|
|
2695
|
+
readonly 'product:component': typeof SpaceGraphProductComponent;
|
|
2677
2696
|
readonly 'material:embedded': typeof SpaceGraphEmbeddedMaterial;
|
|
2678
2697
|
readonly 'material:basic': typeof SpaceGraphBasicMaterial;
|
|
2679
2698
|
readonly 'material:color': typeof SpaceGraphColorMaterial;
|
|
@@ -2731,7 +2750,7 @@ declare class SpaceGraph {
|
|
|
2731
2750
|
createSpatialStructure(type: SpaceGraphSpatialStructureType, id: string): SpaceGraphSpatialStructure;
|
|
2732
2751
|
insertProduct(product: SpaceGraphProduct): void;
|
|
2733
2752
|
removeProduct(product: SpaceGraphProduct): void;
|
|
2734
|
-
createProduct(id: string): SpaceGraphProduct;
|
|
2753
|
+
createProduct(id: string, type: SpaceGraphProductType): SpaceGraphProduct;
|
|
2735
2754
|
insertGeometry(geometryJson: SpaceGraphGeometryJson): void;
|
|
2736
2755
|
removeGeometry(geometryJson: SpaceGraphGeometryJson): void;
|
|
2737
2756
|
insertMaterial(material: SpaceGraphMaterial): void;
|
|
@@ -3026,7 +3045,7 @@ declare class SpaceGraphLayout extends SpaceGraphSpatialStructureBase {
|
|
|
3026
3045
|
include?: string[];
|
|
3027
3046
|
};
|
|
3028
3047
|
}): number;
|
|
3029
|
-
getLayoutGraph(): Graph
|
|
3048
|
+
getLayoutGraph(): Graph<LayoutNode>;
|
|
3030
3049
|
getUniqueId(prefix: string, nodesById: Record<string, SpaceGraphNode>): string;
|
|
3031
3050
|
getSpaceId(prefix?: string): string;
|
|
3032
3051
|
getElementId(element: LayoutElement, prefix?: string): string;
|
|
@@ -3093,15 +3112,7 @@ declare interface SpaceGraphNodeWithCustomAttributesBaseJson extends SpaceGraphN
|
|
|
3093
3112
|
customAttributes?: SpaceGraphCustomAttributeValueJson | null;
|
|
3094
3113
|
}
|
|
3095
3114
|
|
|
3096
|
-
declare
|
|
3097
|
-
type: SpaceGraphProductType;
|
|
3098
|
-
attributes: SpaceGraphProductAttributes;
|
|
3099
|
-
geometries: GeometryOperationJson[];
|
|
3100
|
-
constructor(id: string);
|
|
3101
|
-
copyForClone(product: SpaceGraphProduct): void;
|
|
3102
|
-
setAttributes(attributesJson: SpaceGraphProductAttributesJson): void;
|
|
3103
|
-
toJSON(): SpaceGraphProductJson;
|
|
3104
|
-
}
|
|
3115
|
+
declare type SpaceGraphProduct = SpaceGraphProductStatic | SpaceGraphProductComponent;
|
|
3105
3116
|
|
|
3106
3117
|
declare type SpaceGraphProductAttributes = {
|
|
3107
3118
|
manufacturer: string;
|
|
@@ -3123,15 +3134,73 @@ declare type SpaceGraphProductAttributesJson = {
|
|
|
3123
3134
|
updatedAt?: string;
|
|
3124
3135
|
};
|
|
3125
3136
|
|
|
3126
|
-
declare
|
|
3137
|
+
declare class SpaceGraphProductBase extends SpaceGraphNodeWithCustomAttributesBase {
|
|
3138
|
+
#private;
|
|
3127
3139
|
type: SpaceGraphProductType;
|
|
3140
|
+
attributes: SpaceGraphProductAttributes;
|
|
3141
|
+
instances: Set<LayoutAsset>;
|
|
3142
|
+
constructor(id: string, type: SpaceGraphProductType);
|
|
3143
|
+
copyForClone(product: SpaceGraphProductStatic | SpaceGraphProductComponent): void;
|
|
3144
|
+
setAttributes(attributesJson: SpaceGraphProductAttributesJson): void;
|
|
3145
|
+
toJSON(): SpaceGraphProductJson;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
declare class SpaceGraphProductComponent extends SpaceGraphProductBase {
|
|
3149
|
+
type: SpaceGraphProductComponentType;
|
|
3150
|
+
attributes: SpaceGraphProductAttributes;
|
|
3151
|
+
products: {
|
|
3152
|
+
position: PositionEntry;
|
|
3153
|
+
rotation: RotationEntry;
|
|
3154
|
+
product: string;
|
|
3155
|
+
}[];
|
|
3156
|
+
geometries: GeometryOperationJson[];
|
|
3157
|
+
constructor(id: string);
|
|
3158
|
+
copyForClone(product: SpaceGraphProductComponent): void;
|
|
3159
|
+
toJSON(): SpaceGraphProductComponentJson;
|
|
3160
|
+
setProducts(products: {
|
|
3161
|
+
position: PositionEntry;
|
|
3162
|
+
rotation: RotationEntry;
|
|
3163
|
+
product: string;
|
|
3164
|
+
}[]): void;
|
|
3165
|
+
setInstances(): void;
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
declare interface SpaceGraphProductComponentJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
|
|
3169
|
+
type: SpaceGraphProductComponentType;
|
|
3170
|
+
attributes?: SpaceGraphProductAttributesJson;
|
|
3171
|
+
products: {
|
|
3172
|
+
position: PositionEntry;
|
|
3173
|
+
rotation: RotationEntry;
|
|
3174
|
+
product: string;
|
|
3175
|
+
}[];
|
|
3176
|
+
geometries: GeometryOperationJson[];
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
declare type SpaceGraphProductComponentType = typeof SpaceGraphProductComponentTypeValue;
|
|
3180
|
+
|
|
3181
|
+
declare const SpaceGraphProductComponentTypeValue = "product:component";
|
|
3182
|
+
|
|
3183
|
+
declare type SpaceGraphProductJson = SpaceGraphProductStaticJson | SpaceGraphProductComponentJson;
|
|
3184
|
+
|
|
3185
|
+
declare class SpaceGraphProductStatic extends SpaceGraphProductBase {
|
|
3186
|
+
type: SpaceGraphProductStaticType;
|
|
3187
|
+
geometries: GeometryOperationJson[];
|
|
3188
|
+
constructor(id: string);
|
|
3189
|
+
copyForClone(product: SpaceGraphProductStatic): void;
|
|
3190
|
+
toJSON(): SpaceGraphProductStaticJson;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
declare interface SpaceGraphProductStaticJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
|
|
3194
|
+
type: SpaceGraphProductStaticType;
|
|
3128
3195
|
attributes?: SpaceGraphProductAttributesJson;
|
|
3129
3196
|
geometries: GeometryOperationJson[];
|
|
3130
3197
|
}
|
|
3131
3198
|
|
|
3132
|
-
declare type
|
|
3199
|
+
declare type SpaceGraphProductStaticType = typeof SpaceGraphProductStaticTypeValue;
|
|
3200
|
+
|
|
3201
|
+
declare const SpaceGraphProductStaticTypeValue = "product:static";
|
|
3133
3202
|
|
|
3134
|
-
declare
|
|
3203
|
+
declare type SpaceGraphProductType = SpaceGraphProductStaticType | SpaceGraphProductComponentType;
|
|
3135
3204
|
|
|
3136
3205
|
declare type SpaceGraphRelation = GroupRelation;
|
|
3137
3206
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archilogic/extension-sdk",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"penpal": "^7.0.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@archilogic/space-graph-core": "^0.
|
|
35
|
+
"@archilogic/space-graph-core": "^0.22.3"
|
|
36
36
|
},
|
|
37
37
|
"nx": {}
|
|
38
38
|
}
|