@archilogic/extension-sdk 0.2.5 → 0.4.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/CHANGELOG.md +12 -0
- package/dist/extension-sdk.js +72 -64
- package/dist/index.d.ts +213 -149
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @archilogic/extension-sdk
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8532ccf: feat: rename onPluginConnect / Destroy to onConnect / Destroy
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 52c9e56: feat(sdk): use space-graph-core query method types
|
|
14
|
+
|
|
3
15
|
## 0.2.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/extension-sdk.js
CHANGED
|
@@ -3,15 +3,15 @@ var Q = (e) => {
|
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
5
|
var Ee = (e, t, r) => t in e ? we(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
6
|
-
var
|
|
7
|
-
var s = (e, t, r) => (Z(e, t, "read from private field"), r ? r.call(e) : t.get(e)), f = (e, t, r) => t.has(e) ? Q("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r),
|
|
8
|
-
var
|
|
6
|
+
var I = (e, t, r) => Ee(e, typeof t != "symbol" ? t + "" : t, r), Z = (e, t, r) => t.has(e) || Q("Cannot " + r);
|
|
7
|
+
var s = (e, t, r) => (Z(e, t, "read from private field"), r ? r.call(e) : t.get(e)), f = (e, t, r) => t.has(e) ? Q("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), P = (e, t, r, a) => (Z(e, t, "write to private field"), a ? a.call(e, r) : t.set(e, r), r);
|
|
8
|
+
var Ie = class extends Error {
|
|
9
9
|
constructor(t, r) {
|
|
10
10
|
super(r);
|
|
11
|
-
|
|
11
|
+
I(this, "code");
|
|
12
12
|
this.name = "PenpalError", this.code = t;
|
|
13
13
|
}
|
|
14
|
-
}, w =
|
|
14
|
+
}, w = Ie, Pe = (e) => ({
|
|
15
15
|
name: e.name,
|
|
16
16
|
message: e.message,
|
|
17
17
|
stack: e.stack,
|
|
@@ -26,19 +26,19 @@ var Pe = class extends Error {
|
|
|
26
26
|
return n.name = e, n.stack = r, n;
|
|
27
27
|
}, Se = Symbol("Reply"), B, ae, Ce = (ae = class {
|
|
28
28
|
constructor(e, t) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
I(this, "value");
|
|
30
|
+
I(this, "transferables");
|
|
31
31
|
// Allows TypeScript to distinguish between an actual instance of this
|
|
32
32
|
// class versus an object that looks structurally similar.
|
|
33
33
|
// eslint-disable-next-line no-unused-private-class-members
|
|
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, ce = (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", de = (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
|
+
ce(n) ? r.push([...t, a]) : W(n) && r.push(
|
|
42
42
|
...ue(n, [...t, a])
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -48,18 +48,18 @@ var Pe = class extends Error {
|
|
|
48
48
|
(a, n) => W(a) ? a[n] : void 0,
|
|
49
49
|
t
|
|
50
50
|
);
|
|
51
|
-
return
|
|
51
|
+
return ce(r) ? r : void 0;
|
|
52
52
|
}, C = (e) => e.join("."), ee = (e, t, r) => ({
|
|
53
53
|
namespace: M,
|
|
54
54
|
channel: e,
|
|
55
55
|
type: "REPLY",
|
|
56
56
|
callId: t,
|
|
57
57
|
isError: !0,
|
|
58
|
-
...r instanceof Error ? { value:
|
|
58
|
+
...r instanceof Error ? { value: Pe(r), isSerializedErrorInstance: !0 } : { value: r }
|
|
59
59
|
}), Te = (e, t, r, a) => {
|
|
60
60
|
let n = !1;
|
|
61
|
-
const
|
|
62
|
-
if (n || !
|
|
61
|
+
const d = async (l) => {
|
|
62
|
+
if (n || !de(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,15 +89,15 @@ 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(d), () => {
|
|
93
|
+
n = !0, e.removeMessageHandler(d);
|
|
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
97
|
).join("-")), Le = Symbol("CallOptions"), J, ie, ke = (ie = class {
|
|
98
98
|
constructor(e) {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
I(this, "transferables");
|
|
100
|
+
I(this, "timeout");
|
|
101
101
|
// Allows TypeScript to distinguish between an actual instance of this
|
|
102
102
|
// class versus an object that looks structurally similar.
|
|
103
103
|
// eslint-disable-next-line no-unused-private-class-members
|
|
@@ -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, d) {
|
|
116
|
+
return e(r, d);
|
|
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(), d = (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,7 +134,7 @@ 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(d), {
|
|
138
138
|
remoteProxy: pe((h, o) => {
|
|
139
139
|
if (a)
|
|
140
140
|
throw te(h);
|
|
@@ -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(d);
|
|
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 (de(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 d = 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 c of v)
|
|
294
|
+
c();
|
|
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: c, destroy: m } = xe(e, a, n);
|
|
300
300
|
v.push(m), clearTimeout(p), h = !0, E({
|
|
301
|
-
remoteProxy:
|
|
301
|
+
remoteProxy: c,
|
|
302
302
|
destroy: K
|
|
303
303
|
});
|
|
304
304
|
}, Y = () => {
|
|
305
|
-
const
|
|
305
|
+
const c = {
|
|
306
306
|
namespace: M,
|
|
307
307
|
type: "SYN",
|
|
308
308
|
channel: a,
|
|
309
|
-
participantId:
|
|
309
|
+
participantId: d
|
|
310
310
|
};
|
|
311
|
-
n == null || n("Sending handshake SYN",
|
|
311
|
+
n == null || n("Sending handshake SYN", c);
|
|
312
312
|
try {
|
|
313
|
-
e.sendMessage(
|
|
313
|
+
e.sendMessage(c);
|
|
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 = (c) => {
|
|
318
|
+
if (n == null || n("Received handshake SYN", c), c.participantId === l && // TODO: Used for backward-compatibility. Remove in next major version.
|
|
319
|
+
l !== G || (l = c.participantId, Y(), !(d > 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
|
-
}, z = (
|
|
336
|
-
n == null || n("Received handshake ACK1",
|
|
335
|
+
}, z = (c) => {
|
|
336
|
+
n == null || n("Received handshake ACK1", c);
|
|
337
337
|
const m = {
|
|
338
338
|
namespace: M,
|
|
339
339
|
channel: a,
|
|
@@ -347,10 +347,10 @@ 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 = (c) => {
|
|
351
|
+
n == null || n("Received handshake ACK2", c), F();
|
|
352
|
+
}, q = (c) => {
|
|
353
|
+
j(c) && O(c), X(c) && z(c), g(c) && T(c);
|
|
354
354
|
};
|
|
355
355
|
return e.addMessageHandler(q), v.push(() => e.removeMessageHandler(q)), Y(), i;
|
|
356
356
|
}, ze = Ke, ge = (e) => {
|
|
@@ -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 d = [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 d)
|
|
387
387
|
i();
|
|
388
388
|
n == null || n("Connection destroyed");
|
|
389
389
|
}), v = (o) => Re(o) && o.channel === a;
|
|
@@ -400,7 +400,7 @@ var Pe = class extends Error {
|
|
|
400
400
|
channel: a,
|
|
401
401
|
log: n
|
|
402
402
|
});
|
|
403
|
-
return
|
|
403
|
+
return d.push(i), o;
|
|
404
404
|
} catch (o) {
|
|
405
405
|
throw l(!0), o;
|
|
406
406
|
}
|
|
@@ -422,13 +422,13 @@ var Pe = class extends Error {
|
|
|
422
422
|
f(this, y);
|
|
423
423
|
// TODO: Used for backward-compatibility. Remove in next major version.
|
|
424
424
|
f(this, _, !1);
|
|
425
|
-
|
|
425
|
+
I(this, "initialize", ({
|
|
426
426
|
log: e,
|
|
427
427
|
validateReceivedMessage: t
|
|
428
428
|
}) => {
|
|
429
|
-
|
|
429
|
+
P(this, D, e), P(this, L, t), window.addEventListener("message", s(this, x));
|
|
430
430
|
});
|
|
431
|
-
|
|
431
|
+
I(this, "sendMessage", (e, t) => {
|
|
432
432
|
if (j(e)) {
|
|
433
433
|
const r = s(this, k).call(this, e);
|
|
434
434
|
s(this, A).postMessage(e, {
|
|
@@ -450,10 +450,10 @@ var Pe = class extends Error {
|
|
|
450
450
|
}
|
|
451
451
|
if (g(e)) {
|
|
452
452
|
const { port1: r, port2: a } = new MessageChannel();
|
|
453
|
-
|
|
454
|
-
const n = [a, ...t || []],
|
|
453
|
+
P(this, y, r), r.addEventListener("message", s(this, b)), r.start();
|
|
454
|
+
const n = [a, ...t || []], d = s(this, k).call(this, e);
|
|
455
455
|
s(this, A).postMessage(e, {
|
|
456
|
-
targetOrigin:
|
|
456
|
+
targetOrigin: d,
|
|
457
457
|
transfer: n
|
|
458
458
|
});
|
|
459
459
|
return;
|
|
@@ -466,13 +466,13 @@ var Pe = class extends Error {
|
|
|
466
466
|
}
|
|
467
467
|
throw new U("Port is undefined");
|
|
468
468
|
});
|
|
469
|
-
|
|
469
|
+
I(this, "addMessageHandler", (e) => {
|
|
470
470
|
s(this, S).add(e);
|
|
471
471
|
});
|
|
472
|
-
|
|
472
|
+
I(this, "removeMessageHandler", (e) => {
|
|
473
473
|
s(this, S).delete(e);
|
|
474
474
|
});
|
|
475
|
-
|
|
475
|
+
I(this, "destroy", () => {
|
|
476
476
|
window.removeEventListener("message", s(this, x)), s(this, H).call(this), s(this, S).clear();
|
|
477
477
|
});
|
|
478
478
|
f(this, V, (e) => s(this, R).some(
|
|
@@ -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, b)), (t = s(this, y)) == null || t.close(),
|
|
490
|
+
(e = s(this, y)) == null || e.removeEventListener("message", s(this, b)), (t = s(this, y)) == null || t.close(), P(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, d, 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
|
-
),
|
|
502
|
+
), P(this, _, !0), a = Ve(a)), !!((d = s(this, L)) != null && d.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,10 +507,10 @@ var Pe = class extends Error {
|
|
|
507
507
|
);
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
if (j(a) && (s(this, H).call(this),
|
|
510
|
+
if (j(a) && (s(this, H).call(this), P(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
|
-
if (
|
|
513
|
+
if (P(this, y, r[0]), !s(this, y))
|
|
514
514
|
throw new U("No port received on ACK2");
|
|
515
515
|
s(this, y).addEventListener("message", s(this, b)), s(this, y).start();
|
|
516
516
|
}
|
|
@@ -526,14 +526,18 @@ var Pe = class extends Error {
|
|
|
526
526
|
});
|
|
527
527
|
if (!e)
|
|
528
528
|
throw new w("INVALID_ARGUMENT", "remoteWindow must be defined");
|
|
529
|
-
|
|
529
|
+
P(this, A, e), P(this, R, t != null && t.length ? t : [window.origin]);
|
|
530
530
|
}
|
|
531
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: [
|
|
536
|
+
allowedOrigins: [
|
|
537
|
+
/^http:\/\/localhost(:\d+)/,
|
|
538
|
+
"https://extensions.archilogic.io",
|
|
539
|
+
"https://testing-extensions.archilogic.io"
|
|
540
|
+
]
|
|
537
541
|
// Alternatively,
|
|
538
542
|
// allowedOrigins: [new Url(iframe.src).origin]
|
|
539
543
|
});
|
|
@@ -543,9 +547,13 @@ const Qe = (e, t) => {
|
|
|
543
547
|
methods: t
|
|
544
548
|
});
|
|
545
549
|
}, Xe = {
|
|
546
|
-
|
|
550
|
+
/**
|
|
551
|
+
* event handler for initial connection of the extension
|
|
552
|
+
* for a headless extension ( without UI ) the host will await this method before it terminates the extension
|
|
553
|
+
*/
|
|
554
|
+
onConnect: () => {
|
|
547
555
|
},
|
|
548
|
-
|
|
556
|
+
onDestroy: () => {
|
|
549
557
|
},
|
|
550
558
|
onLayoutChange: () => {
|
|
551
559
|
},
|
|
@@ -572,8 +580,8 @@ const Qe = (e, t) => {
|
|
|
572
580
|
return new Proxy(
|
|
573
581
|
{},
|
|
574
582
|
{
|
|
575
|
-
get(n,
|
|
576
|
-
return async (...l) => (await r.promise)[
|
|
583
|
+
get(n, d) {
|
|
584
|
+
return async (...l) => (await r.promise)[d](...l);
|
|
577
585
|
}
|
|
578
586
|
}
|
|
579
587
|
);
|
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ declare interface BaseData {
|
|
|
74
74
|
name: string;
|
|
75
75
|
type: string;
|
|
76
76
|
customId: string;
|
|
77
|
-
customAttributes:
|
|
77
|
+
customAttributes: SpaceGraphCustomAttributeValue;
|
|
78
78
|
/** dimensions in meters */
|
|
79
79
|
dimensions: {
|
|
80
80
|
width: number;
|
|
@@ -99,6 +99,34 @@ declare interface BaseData {
|
|
|
99
99
|
boundingBoxContour: Vector2[];
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
declare interface BaseFilter {
|
|
103
|
+
id?: StringComparator;
|
|
104
|
+
type?: StringComparator;
|
|
105
|
+
name?: StringComparator;
|
|
106
|
+
customId?: StringComparator;
|
|
107
|
+
customAttributes?: Record<string, StringComparator | NumberComparator | BooleanComparator>;
|
|
108
|
+
dimensions?: {
|
|
109
|
+
width?: NumberComparator;
|
|
110
|
+
length?: NumberComparator;
|
|
111
|
+
height?: NumberComparator;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare interface BaseSelect {
|
|
116
|
+
id?: boolean;
|
|
117
|
+
type?: boolean;
|
|
118
|
+
name?: boolean;
|
|
119
|
+
customId?: boolean;
|
|
120
|
+
customAttributes?: boolean | Record<string, boolean>;
|
|
121
|
+
dimensions?: boolean | {
|
|
122
|
+
width?: boolean;
|
|
123
|
+
length?: boolean;
|
|
124
|
+
height?: boolean;
|
|
125
|
+
};
|
|
126
|
+
boundingBox?: boolean;
|
|
127
|
+
boundingBoxContour?: boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
102
130
|
declare interface BaseShape {
|
|
103
131
|
type: string;
|
|
104
132
|
style?: ShapeStyle;
|
|
@@ -109,6 +137,12 @@ declare interface BezierCurve extends BaseShape {
|
|
|
109
137
|
points: Polygon;
|
|
110
138
|
}
|
|
111
139
|
|
|
140
|
+
declare type BooleanComparator = boolean | {
|
|
141
|
+
eq: boolean;
|
|
142
|
+
} | {
|
|
143
|
+
neq: boolean;
|
|
144
|
+
};
|
|
145
|
+
|
|
112
146
|
declare type BoundingBox3d = {
|
|
113
147
|
min: Vector3;
|
|
114
148
|
max: Vector3;
|
|
@@ -231,19 +265,20 @@ export declare type Connection<TMethods extends Methods = Methods> = {
|
|
|
231
265
|
|
|
232
266
|
/**
|
|
233
267
|
* @example
|
|
234
|
-
* const
|
|
235
|
-
* const
|
|
236
|
-
*
|
|
237
|
-
*
|
|
268
|
+
* const connection = createExtensionConnection(methods)
|
|
269
|
+
* const extension = await connection.promise
|
|
270
|
+
* // dispatch onConnect event
|
|
271
|
+
* await extension.onConnect({ floorMetaData })
|
|
272
|
+
* connection.destroy()
|
|
238
273
|
*/
|
|
239
274
|
export declare const createExtensionConnection: (iframe: HTMLIFrameElement, methods: any) => Connection<ExtensionApi>;
|
|
240
275
|
|
|
241
276
|
/**
|
|
242
277
|
* @example
|
|
243
278
|
* const hostApi = createHostConnection({
|
|
244
|
-
*
|
|
279
|
+
* onConnect: () => {}
|
|
245
280
|
* })
|
|
246
|
-
* const
|
|
281
|
+
* const spaces = await hostApi.getSpaces()
|
|
247
282
|
*/
|
|
248
283
|
export declare const createHostConnection: (methods?: Partial<ExtensionApi>) => HostApi;
|
|
249
284
|
|
|
@@ -354,6 +389,11 @@ declare type CustomStairsParametersJson = Partial<CustomStairsParameters>;
|
|
|
354
389
|
|
|
355
390
|
declare type CustomStairsType = 'custom';
|
|
356
391
|
|
|
392
|
+
declare type DefaultSelect = {
|
|
393
|
+
id: true;
|
|
394
|
+
type: true;
|
|
395
|
+
};
|
|
396
|
+
|
|
357
397
|
declare type DimensionParameters = {
|
|
358
398
|
/** @minimum 0.01 */
|
|
359
399
|
length: number;
|
|
@@ -552,7 +592,7 @@ declare class ElementCreate extends OperationBase {
|
|
|
552
592
|
type: typeof ElementCreateTypeValue;
|
|
553
593
|
value: LayoutElementJson;
|
|
554
594
|
parentId?: string;
|
|
555
|
-
constructor(value: LayoutElementJson
|
|
595
|
+
constructor(value: Partial<LayoutElementJson>, parentId?: string);
|
|
556
596
|
do(layout: SpaceGraphLayout): void;
|
|
557
597
|
undo(layout: SpaceGraphLayout): void;
|
|
558
598
|
}
|
|
@@ -563,11 +603,24 @@ declare const ElementCreateTypeValue: "operation:elementCreate";
|
|
|
563
603
|
|
|
564
604
|
export declare interface ElementData extends BaseData {
|
|
565
605
|
type: LayoutElementJson['type'];
|
|
606
|
+
isExternal: boolean;
|
|
566
607
|
parameters: LayoutElementJson['parameters'];
|
|
567
608
|
product: ProductData;
|
|
609
|
+
position: Vector3;
|
|
610
|
+
rotation: number;
|
|
568
611
|
elements: ElementData[];
|
|
569
612
|
}
|
|
570
613
|
|
|
614
|
+
export declare interface ElementFilter extends BaseFilter {
|
|
615
|
+
product?: ProductFilter;
|
|
616
|
+
isExternal?: BooleanComparator;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
declare type ElementQuery = {
|
|
620
|
+
select?: ElementSelect;
|
|
621
|
+
where?: ElementFilter;
|
|
622
|
+
};
|
|
623
|
+
|
|
571
624
|
declare class ElementRemove extends OperationBase {
|
|
572
625
|
type: typeof ElementRemoveTypeValue;
|
|
573
626
|
previousValue: LayoutElementJson;
|
|
@@ -582,6 +635,13 @@ declare type ElementRemoveOperationJson = Pick<ElementRemove, 'nodeId' | 'type'>
|
|
|
582
635
|
|
|
583
636
|
declare const ElementRemoveTypeValue: "operation:elementRemove";
|
|
584
637
|
|
|
638
|
+
export declare interface ElementSelect extends BaseSelect {
|
|
639
|
+
product?: ProductSelect | boolean;
|
|
640
|
+
isExternal?: boolean;
|
|
641
|
+
position?: boolean;
|
|
642
|
+
rotation?: boolean;
|
|
643
|
+
}
|
|
644
|
+
|
|
585
645
|
declare class ElementUpdate extends OperationBase {
|
|
586
646
|
type: typeof ElementUpdateTypeValue;
|
|
587
647
|
value: ElementUpdateValue;
|
|
@@ -600,17 +660,15 @@ declare type ElementUpdateValue = Partial<LayoutElementJson> & {
|
|
|
600
660
|
parameters?: Partial<LayoutElementJson['parameters']>;
|
|
601
661
|
};
|
|
602
662
|
|
|
603
|
-
declare
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
};
|
|
607
|
-
}
|
|
663
|
+
declare type EntityResult = {
|
|
664
|
+
id: string;
|
|
665
|
+
};
|
|
608
666
|
|
|
609
667
|
export declare type ExtensionApi = {
|
|
610
|
-
|
|
668
|
+
onConnect({ floorMetaData }: {
|
|
611
669
|
floorMetaData: any;
|
|
612
670
|
}): void;
|
|
613
|
-
|
|
671
|
+
onDestroy(): void;
|
|
614
672
|
onLayoutChange(args: any): void;
|
|
615
673
|
onSelectionChange({ selectedNodes }: {
|
|
616
674
|
selectedNodes: {
|
|
@@ -667,7 +725,7 @@ declare type FloorPlanTheme = {
|
|
|
667
725
|
/** show the area information in room stamps */
|
|
668
726
|
roomStampDisplay?: ('usage' | 'area' | 'customId' | 'name' | 'id' | ['customAttribute', string])[];
|
|
669
727
|
/** text color for room stamps */
|
|
670
|
-
text?:
|
|
728
|
+
text?: Rgb_2;
|
|
671
729
|
/** whether the room stamp text should have an outline to assist with contrast issues */
|
|
672
730
|
textOutline?: boolean;
|
|
673
731
|
};
|
|
@@ -909,189 +967,139 @@ declare type HingeSide = 'left' | 'right';
|
|
|
909
967
|
export declare type HostApi = {
|
|
910
968
|
/**
|
|
911
969
|
* @example
|
|
912
|
-
* const
|
|
970
|
+
* const element = await hostApi.getElementsById({ id, select: { type: true, dimensions: { length: true }}})
|
|
913
971
|
*/
|
|
914
|
-
getElementById: <
|
|
972
|
+
getElementById: <S extends ElementSelect = DefaultSelect>(args: {
|
|
915
973
|
id: string;
|
|
916
|
-
|
|
917
|
-
}) => Promise<
|
|
918
|
-
data?: Pick<ElementData, K>;
|
|
919
|
-
error?: string;
|
|
920
|
-
ok: boolean;
|
|
921
|
-
}>;
|
|
922
|
-
/**
|
|
923
|
-
* @example
|
|
924
|
-
* const { data: elements } = await hostApi.getElements({ include: ['id', 'name', 'type']})
|
|
925
|
-
*/
|
|
926
|
-
getElements: <K extends keyof ElementData>(args: {
|
|
927
|
-
include: K[];
|
|
928
|
-
}) => Promise<{
|
|
929
|
-
data: Pick<ElementData, K>[];
|
|
930
|
-
error?: string;
|
|
931
|
-
ok: boolean;
|
|
932
|
-
}>;
|
|
974
|
+
select?: S;
|
|
975
|
+
}) => Promise<QueryPick<ElementData, S> | null>;
|
|
933
976
|
/**
|
|
934
977
|
* @example
|
|
935
|
-
* const
|
|
978
|
+
* const elements = await hostApi.getElements({ where: { customAttributes: { broken: true }}})
|
|
936
979
|
*/
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}) => Promise<
|
|
941
|
-
|
|
942
|
-
error?: string;
|
|
943
|
-
ok: boolean;
|
|
944
|
-
}>;
|
|
945
|
-
getSpaceById: <K extends keyof SpaceData>(args: {
|
|
980
|
+
getElements: <S extends ElementSelect = DefaultSelect>(args?: {
|
|
981
|
+
select?: S;
|
|
982
|
+
where?: ElementFilter;
|
|
983
|
+
}) => Promise<QueryPick<ElementData, S>[]>;
|
|
984
|
+
getSpaceById: <S extends SpaceSelect = DefaultSelect>(args: {
|
|
946
985
|
id: string;
|
|
947
|
-
|
|
948
|
-
}) => Promise<
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}>;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
data: SpaceGraphJson;
|
|
962
|
-
error?: string;
|
|
963
|
-
}>;
|
|
986
|
+
select?: S;
|
|
987
|
+
}) => Promise<QueryPick<SpaceData, S> | null>;
|
|
988
|
+
getSpaces: <S extends SpaceSelect = DefaultSelect>(args?: {
|
|
989
|
+
select?: S;
|
|
990
|
+
where?: SpaceFilter;
|
|
991
|
+
}) => Promise<QueryPick<SpaceData, S>[]>;
|
|
992
|
+
getProductById: <S extends ProductSelect = DefaultSelect>(args: {
|
|
993
|
+
id: string;
|
|
994
|
+
select?: S;
|
|
995
|
+
}) => Promise<QueryPick<ProductData, S> | null>;
|
|
996
|
+
getProducts: <S extends ProductSelect = DefaultSelect>(args?: {
|
|
997
|
+
select?: S;
|
|
998
|
+
where?: ProductFilter;
|
|
999
|
+
}) => Promise<QueryPick<ProductData, S>[]>;
|
|
964
1000
|
runOperations: (args: {
|
|
965
1001
|
operations: OperationJson[];
|
|
966
|
-
}) => Promise<
|
|
1002
|
+
}) => Promise<OperationsResult>;
|
|
967
1003
|
setPlanConfig: (config: {
|
|
968
1004
|
theme: FloorPlanTheme;
|
|
969
|
-
}) => Promise<
|
|
1005
|
+
}) => Promise<boolean>;
|
|
970
1006
|
addPlanLayer: (args: {
|
|
971
1007
|
id?: string;
|
|
972
1008
|
baseLayer?: string;
|
|
973
|
-
}) => Promise<
|
|
1009
|
+
}) => Promise<EntityResult>;
|
|
974
1010
|
addPlanGraphic: (args: {
|
|
975
1011
|
shapes: Shape[];
|
|
976
1012
|
isHandler?: boolean;
|
|
977
1013
|
layerId?: string;
|
|
978
1014
|
id?: string;
|
|
979
1015
|
clearLayer?: boolean;
|
|
980
|
-
}) => Promise<
|
|
1016
|
+
}) => Promise<EntityResult>;
|
|
981
1017
|
zoomToNode: (args: {
|
|
982
1018
|
nodeId: string;
|
|
983
1019
|
margin?: number;
|
|
984
1020
|
animate?: number | boolean;
|
|
985
|
-
}) => Promise<
|
|
1021
|
+
}) => Promise<boolean>;
|
|
986
1022
|
zoomExtents: (args?: {
|
|
987
1023
|
margin?: number;
|
|
988
1024
|
animate?: number | boolean;
|
|
989
|
-
}) => Promise<
|
|
1025
|
+
}) => Promise<boolean>;
|
|
990
1026
|
drawNodeUpdate: (args: {
|
|
991
1027
|
nodeId: string;
|
|
992
1028
|
style: 'selected' | ShapeStyle | false;
|
|
993
|
-
}) => Promise<
|
|
1029
|
+
}) => Promise<boolean>;
|
|
994
1030
|
selectNodes: (args: {
|
|
995
1031
|
nodeIds: string[];
|
|
996
|
-
}) => Promise<
|
|
1032
|
+
}) => Promise<NodeResult[]>;
|
|
997
1033
|
};
|
|
998
1034
|
|
|
999
1035
|
export declare type HostApiSync = {
|
|
1000
1036
|
/**
|
|
1001
1037
|
* @example
|
|
1002
|
-
* const
|
|
1038
|
+
* const element = await hostApi.getElementsById({ id, select: { type: true, dimensions: { length: true }}})
|
|
1003
1039
|
*/
|
|
1004
|
-
getElementById: <
|
|
1040
|
+
getElementById: <S extends ElementSelect = DefaultSelect>(args: {
|
|
1005
1041
|
id: string;
|
|
1006
|
-
|
|
1007
|
-
}) =>
|
|
1008
|
-
data?: Pick<ElementData, K>;
|
|
1009
|
-
error?: string;
|
|
1010
|
-
ok: boolean;
|
|
1011
|
-
};
|
|
1042
|
+
select?: S;
|
|
1043
|
+
}) => QueryPick<ElementData, S> | null;
|
|
1012
1044
|
/**
|
|
1013
1045
|
* @example
|
|
1014
|
-
* const
|
|
1046
|
+
* const elements = await hostApi.getElements({ where: { customAttributes: { broken: true }}})
|
|
1015
1047
|
*/
|
|
1016
|
-
getElements: <
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
ok: boolean;
|
|
1022
|
-
};
|
|
1023
|
-
/**
|
|
1024
|
-
* @example
|
|
1025
|
-
* const { data: elementsByType } = await hostApi.getElementsByType({ type, include: ['id', 'name', 'dimensions']})
|
|
1026
|
-
*/
|
|
1027
|
-
getElementsByType: <K extends keyof ElementData>(args: {
|
|
1028
|
-
type: LayoutElementJson['type'];
|
|
1029
|
-
include: K[];
|
|
1030
|
-
}) => {
|
|
1031
|
-
data: Pick<ElementData, K>[];
|
|
1032
|
-
error?: string;
|
|
1033
|
-
ok: boolean;
|
|
1034
|
-
};
|
|
1035
|
-
getSpaceById: <K extends keyof SpaceData>(args: {
|
|
1048
|
+
getElements: <S extends ElementSelect = DefaultSelect>(args?: {
|
|
1049
|
+
select?: S;
|
|
1050
|
+
where?: ElementFilter;
|
|
1051
|
+
}) => QueryPick<ElementData, S>[];
|
|
1052
|
+
getSpaceById: <S extends SpaceSelect = DefaultSelect>(args: {
|
|
1036
1053
|
id: string;
|
|
1037
|
-
|
|
1038
|
-
}) =>
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
data: SpaceGraphJson;
|
|
1052
|
-
error?: string;
|
|
1053
|
-
};
|
|
1054
|
+
select?: S;
|
|
1055
|
+
}) => QueryPick<SpaceData, S> | null;
|
|
1056
|
+
getSpaces: <S extends SpaceSelect = DefaultSelect>(args?: {
|
|
1057
|
+
select?: S;
|
|
1058
|
+
where?: SpaceFilter;
|
|
1059
|
+
}) => QueryPick<SpaceData, S>[];
|
|
1060
|
+
getProductById: <S extends ProductSelect = DefaultSelect>(args: {
|
|
1061
|
+
id: string;
|
|
1062
|
+
select?: S;
|
|
1063
|
+
}) => QueryPick<ProductData, S> | null;
|
|
1064
|
+
getProducts: <S extends ProductSelect = DefaultSelect>(args?: {
|
|
1065
|
+
select?: S;
|
|
1066
|
+
where?: ProductFilter;
|
|
1067
|
+
}) => QueryPick<ProductData, S>[];
|
|
1054
1068
|
runOperations: (args: {
|
|
1055
1069
|
operations: OperationJson[];
|
|
1056
|
-
}) =>
|
|
1070
|
+
}) => OperationsResult;
|
|
1057
1071
|
setPlanConfig: (config: {
|
|
1058
1072
|
theme: FloorPlanTheme;
|
|
1059
|
-
}) =>
|
|
1073
|
+
}) => boolean;
|
|
1060
1074
|
addPlanLayer: (args: {
|
|
1061
1075
|
id?: string;
|
|
1062
1076
|
baseLayer?: string;
|
|
1063
|
-
}) =>
|
|
1077
|
+
}) => EntityResult;
|
|
1064
1078
|
addPlanGraphic: (args: {
|
|
1065
1079
|
shapes: Shape[];
|
|
1066
1080
|
isHandler?: boolean;
|
|
1067
1081
|
layerId?: string;
|
|
1068
1082
|
id?: string;
|
|
1069
1083
|
clearLayer?: boolean;
|
|
1070
|
-
}) =>
|
|
1084
|
+
}) => EntityResult;
|
|
1071
1085
|
zoomToNode: (args: {
|
|
1072
1086
|
nodeId: string;
|
|
1073
1087
|
margin?: number;
|
|
1074
1088
|
animate?: number | boolean;
|
|
1075
|
-
}) =>
|
|
1089
|
+
}) => boolean;
|
|
1076
1090
|
zoomExtents: (args?: {
|
|
1077
1091
|
margin?: number;
|
|
1078
1092
|
animate?: number | boolean;
|
|
1079
|
-
}) =>
|
|
1093
|
+
}) => boolean;
|
|
1080
1094
|
drawNodeUpdate: (args: {
|
|
1081
1095
|
nodeId: string;
|
|
1082
1096
|
style: 'selected' | ShapeStyle | false;
|
|
1083
|
-
}) =>
|
|
1097
|
+
}) => boolean;
|
|
1084
1098
|
selectNodes: (args: {
|
|
1085
1099
|
nodeIds: string[];
|
|
1086
|
-
}) =>
|
|
1100
|
+
}) => NodeResult[];
|
|
1087
1101
|
};
|
|
1088
1102
|
|
|
1089
|
-
export declare interface HostResponse {
|
|
1090
|
-
ok: boolean;
|
|
1091
|
-
data?: unknown;
|
|
1092
|
-
error?: string;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
1103
|
declare type IndexRange = {
|
|
1096
1104
|
type: 'index:range';
|
|
1097
1105
|
start: number;
|
|
@@ -2281,17 +2289,33 @@ declare type Methods = {
|
|
|
2281
2289
|
[index: string]: Methods | Function;
|
|
2282
2290
|
};
|
|
2283
2291
|
|
|
2292
|
+
declare type NodeResult = {
|
|
2293
|
+
id: string;
|
|
2294
|
+
type: string;
|
|
2295
|
+
};
|
|
2296
|
+
|
|
2284
2297
|
declare type NodesByType<NodeMap extends NodeTypeMap = {}> = {
|
|
2285
2298
|
-readonly [K in keyof NodeMap]: InstanceType<NodeMap[K]>[];
|
|
2286
2299
|
};
|
|
2287
2300
|
|
|
2288
|
-
declare type NodeSelection = {
|
|
2289
|
-
id: string;
|
|
2290
|
-
type: string;
|
|
2291
|
-
}[];
|
|
2292
|
-
|
|
2293
2301
|
declare type NodeTypeMap = Record<string, any>;
|
|
2294
2302
|
|
|
2303
|
+
declare type NumberComparator = number | {
|
|
2304
|
+
eq: number;
|
|
2305
|
+
} | {
|
|
2306
|
+
neq: number;
|
|
2307
|
+
} | {
|
|
2308
|
+
in: number[];
|
|
2309
|
+
} | {
|
|
2310
|
+
gt: number;
|
|
2311
|
+
} | {
|
|
2312
|
+
gte: number;
|
|
2313
|
+
} | {
|
|
2314
|
+
lt: number;
|
|
2315
|
+
} | {
|
|
2316
|
+
lte: number;
|
|
2317
|
+
};
|
|
2318
|
+
|
|
2295
2319
|
declare interface NumberList extends SpaceGraphTypedValueJson {
|
|
2296
2320
|
type: 'number:list';
|
|
2297
2321
|
list: number[];
|
|
@@ -2328,6 +2352,13 @@ declare class OperationBase {
|
|
|
2328
2352
|
*/
|
|
2329
2353
|
declare type OperationJson = VertexCreateOperationJson | EdgeCreateOperationJson | SpaceCreateOperationJson | ElementCreateOperationJson | AnnotationCreateOperationJson | ViewCreateOperationJson | ProductCreateOperationJson | RelationCreateOperationJson | MaterialCreateOperationJson | CustomAttributeCreateOperationJson | VertexRemoveOperationJson | VertexUpdateOperationJson | VertexReplaceOperationJson | EdgeConnectOperationJson | EdgeRemoveOperationJson | EdgeReplaceOperationJson | EdgeMergeOperationJson | EdgeSplitOperationJson | EdgeUpdateOperationJson | SpaceUpdateOperationJson | SpaceRemoveOperationJson | ElementUpdateOperationJson | ElementRemoveOperationJson | AnnotationUpdateOperationJson | AnnotationRemoveOperationJson | ViewUpdateOperationJson | ViewRemoveOperationJson | ProductUpdateOperationJson | ProductRemoveOperationJson | RelationUpdateOperationJson | RelationRemoveOperationJson | RelationInsertNodesOperationJson | RelationRemoveNodesOperationJson | MaterialUpdateOperationJson | MaterialRemoveOperationJson | LayoutUpdateOperationJson | CustomAttributeUpdateOperationJson | CustomAttributeRemoveOperationJson;
|
|
2330
2354
|
|
|
2355
|
+
declare type OperationsResult = {
|
|
2356
|
+
created: NodeResult[];
|
|
2357
|
+
removed: NodeResult[];
|
|
2358
|
+
updated: NodeResult[];
|
|
2359
|
+
errors: string[];
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2331
2362
|
declare type OrthogonalStairsParameters = {
|
|
2332
2363
|
stairsType: OrthogonalStairsType;
|
|
2333
2364
|
/** @minimum 0.01 */
|
|
@@ -2455,10 +2486,13 @@ declare type ProductCreateValue = SpaceGraphProductJson;
|
|
|
2455
2486
|
|
|
2456
2487
|
export declare interface ProductData extends BaseData {
|
|
2457
2488
|
type: SpaceGraphProduct['type'];
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2489
|
+
category: string;
|
|
2490
|
+
subCategory: string;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
declare interface ProductFilter extends BaseFilter {
|
|
2494
|
+
category?: StringComparator;
|
|
2495
|
+
subCategory?: StringComparator;
|
|
2462
2496
|
}
|
|
2463
2497
|
|
|
2464
2498
|
declare class ProductRemove extends OperationBase {
|
|
@@ -2476,6 +2510,11 @@ declare const ProductRemoveTypeValue: "operation:productRemove";
|
|
|
2476
2510
|
|
|
2477
2511
|
declare type ProductRemoveValue = SpaceGraphProductJson;
|
|
2478
2512
|
|
|
2513
|
+
declare interface ProductSelect extends BaseSelect {
|
|
2514
|
+
category?: boolean;
|
|
2515
|
+
subCategory?: boolean;
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2479
2518
|
declare class ProductUpdate extends OperationBase {
|
|
2480
2519
|
type: typeof ProductUpdateTypeValue;
|
|
2481
2520
|
value: ProductUpdateValue;
|
|
@@ -2491,6 +2530,10 @@ declare const ProductUpdateTypeValue: "operation:productUpdate";
|
|
|
2491
2530
|
|
|
2492
2531
|
declare type ProductUpdateValue = Partial<SpaceGraphProductJson>;
|
|
2493
2532
|
|
|
2533
|
+
declare type QueryPick<T, S> = {
|
|
2534
|
+
[K in keyof S as S[K] extends false | undefined ? never : K]: K extends keyof T ? S[K] extends true ? T[K] : S[K] extends ElementQuery ? QueryPick<ElementData, S[K]['select'] extends undefined ? DefaultSelect : NonNullable<S[K]['select']>>[] : S[K] extends object ? T[K] extends any[] ? QueryPick<T[K][number], S[K]>[] : QueryPick<T[K], S[K]> : never : never;
|
|
2535
|
+
};
|
|
2536
|
+
|
|
2494
2537
|
declare interface RectangleCurve extends CurveBase {
|
|
2495
2538
|
type: RectangleCurveType;
|
|
2496
2539
|
dimensions: Vector2;
|
|
@@ -2600,16 +2643,12 @@ declare class Reply<T = unknown> {
|
|
|
2600
2643
|
|
|
2601
2644
|
declare type Rgb = [number, number, number];
|
|
2602
2645
|
|
|
2646
|
+
declare type Rgb_2 = [number, number, number];
|
|
2647
|
+
|
|
2603
2648
|
declare type RgbA = [number, number, number, number];
|
|
2604
2649
|
|
|
2605
2650
|
declare type RotationEntry = number | NumberList | NumberRange;
|
|
2606
2651
|
|
|
2607
|
-
declare interface SelectionResponse extends HostResponse {
|
|
2608
|
-
data: {
|
|
2609
|
-
selectedNodes: NodeSelection;
|
|
2610
|
-
};
|
|
2611
|
-
}
|
|
2612
|
-
|
|
2613
2652
|
declare type Shape = PolygonCurve_2 | PolygonWithHolesCurve_2 | PolylineCurve_2 | RectangleCurve_2 | CircleCurve_2 | LineCurve_2 | GroupShape | TextShape | ArcCurve_2 | BezierCurve | CompositeCurve_2;
|
|
2614
2653
|
|
|
2615
2654
|
declare interface ShapeStyle {
|
|
@@ -2638,16 +2677,22 @@ declare type SpaceCreateValue = LayoutSpaceJson;
|
|
|
2638
2677
|
|
|
2639
2678
|
export declare interface SpaceData extends BaseData {
|
|
2640
2679
|
type: LayoutSpaceJson['type'];
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
};
|
|
2680
|
+
isExternal: boolean;
|
|
2681
|
+
category: string;
|
|
2682
|
+
subCategory: string;
|
|
2645
2683
|
area: number;
|
|
2646
2684
|
labelPoint: Vector2;
|
|
2647
2685
|
polygons: PolygonWithHoles;
|
|
2648
2686
|
elements: ElementData[];
|
|
2649
2687
|
}
|
|
2650
2688
|
|
|
2689
|
+
export declare interface SpaceFilter extends BaseFilter {
|
|
2690
|
+
category?: StringComparator;
|
|
2691
|
+
subCategory?: StringComparator;
|
|
2692
|
+
isExternal?: BooleanComparator;
|
|
2693
|
+
area?: NumberComparator;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2651
2696
|
declare class SpaceGraph {
|
|
2652
2697
|
spatialStructure: SpaceGraphSpatialStructure;
|
|
2653
2698
|
products: SpaceGraphProduct[];
|
|
@@ -3142,6 +3187,7 @@ declare class SpaceGraphProductBase extends SpaceGraphNodeWithCustomAttributesBa
|
|
|
3142
3187
|
constructor(id: string, type: SpaceGraphProductType);
|
|
3143
3188
|
copyForClone(product: SpaceGraphProductStatic | SpaceGraphProductComponent): void;
|
|
3144
3189
|
setAttributes(attributesJson: SpaceGraphProductAttributesJson): void;
|
|
3190
|
+
getBoundingBox(): BoundingBox3d;
|
|
3145
3191
|
toJSON(): SpaceGraphProductJson;
|
|
3146
3192
|
}
|
|
3147
3193
|
|
|
@@ -3271,6 +3317,16 @@ declare const SpaceRemoveTypeValue: "operation:spaceRemove";
|
|
|
3271
3317
|
|
|
3272
3318
|
declare type SpaceRemoveValue = LayoutSpaceJson;
|
|
3273
3319
|
|
|
3320
|
+
export declare interface SpaceSelect extends BaseSelect {
|
|
3321
|
+
category?: boolean;
|
|
3322
|
+
subCategory?: boolean;
|
|
3323
|
+
isExternal?: boolean;
|
|
3324
|
+
area?: boolean;
|
|
3325
|
+
labelPoint?: boolean;
|
|
3326
|
+
polygons?: boolean;
|
|
3327
|
+
elements?: ElementQuery;
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3274
3330
|
declare interface SpaceShapeStyle extends ShapeStyle {
|
|
3275
3331
|
usage?: {
|
|
3276
3332
|
[key: string]: ShapeStyle;
|
|
@@ -3414,6 +3470,14 @@ declare type StraightStairsParametersJson = Partial<StraightStairsParameters>;
|
|
|
3414
3470
|
|
|
3415
3471
|
declare type StraightStairsType = 'straight' | 'straightLanding';
|
|
3416
3472
|
|
|
3473
|
+
declare type StringComparator = string | {
|
|
3474
|
+
eq: string;
|
|
3475
|
+
} | {
|
|
3476
|
+
neq: string;
|
|
3477
|
+
} | {
|
|
3478
|
+
in: string[];
|
|
3479
|
+
};
|
|
3480
|
+
|
|
3417
3481
|
declare interface SurfaceMaterials {
|
|
3418
3482
|
[surface: string]: SpaceGraphMaterial;
|
|
3419
3483
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archilogic/extension-sdk",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
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.23.0"
|
|
36
36
|
},
|
|
37
37
|
"nx": {}
|
|
38
38
|
}
|