@archilogic/extension-sdk 0.2.1 → 0.2.3
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 +15 -15
- 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.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67f694a: chore: update space-graph and floor-plan-engine dependencies
|
|
8
|
+
|
|
9
|
+
## 0.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 235928e: fix(extension-sdk): enable any localhost and deployed frontend url
|
|
14
|
+
|
|
3
15
|
## 0.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/extension-sdk.js
CHANGED
|
@@ -138,9 +138,9 @@ var Pe = class extends Error {
|
|
|
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 ke, { timeout: p, transferables:
|
|
141
|
+
const i = he(), E = o[o.length - 1], u = E instanceof ke, { timeout: p, transferables: K } = u ? E : {}, F = u ? o.slice(0, -1) : o;
|
|
142
142
|
return new Promise((Y, O) => {
|
|
143
|
-
const
|
|
143
|
+
const g = 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: g });
|
|
154
154
|
try {
|
|
155
155
|
const T = {
|
|
156
156
|
namespace: M,
|
|
@@ -160,7 +160,7 @@ var Pe = class extends Error {
|
|
|
160
160
|
methodPath: h,
|
|
161
161
|
args: F
|
|
162
162
|
};
|
|
163
|
-
r == null || r(`Sending ${C(h)}() call`, T), e.sendMessage(T,
|
|
163
|
+
r == null || r(`Sending ${C(h)}() call`, T), e.sendMessage(T, K);
|
|
164
164
|
} catch (T) {
|
|
165
165
|
O(
|
|
166
166
|
new w("TRANSMISSION_FAILED", T.message)
|
|
@@ -271,7 +271,7 @@ var Pe = class extends Error {
|
|
|
271
271
|
returnValue: e.value
|
|
272
272
|
};
|
|
273
273
|
throw fe(e);
|
|
274
|
-
},
|
|
274
|
+
}, Ke = ({
|
|
275
275
|
messenger: e,
|
|
276
276
|
methods: t,
|
|
277
277
|
timeout: r,
|
|
@@ -289,7 +289,7 @@ var Pe = class extends Error {
|
|
|
289
289
|
`Connection timed out after ${r}ms`
|
|
290
290
|
)
|
|
291
291
|
);
|
|
292
|
-
}, r) : void 0,
|
|
292
|
+
}, r) : void 0, K = () => {
|
|
293
293
|
for (const c of v)
|
|
294
294
|
c();
|
|
295
295
|
}, F = () => {
|
|
@@ -299,7 +299,7 @@ var Pe = class extends Error {
|
|
|
299
299
|
const { remoteProxy: c, destroy: m } = xe(e, a, n);
|
|
300
300
|
v.push(m), clearTimeout(p), h = !0, E({
|
|
301
301
|
remoteProxy: c,
|
|
302
|
-
destroy:
|
|
302
|
+
destroy: K
|
|
303
303
|
});
|
|
304
304
|
}, Y = () => {
|
|
305
305
|
const c = {
|
|
@@ -332,7 +332,7 @@ var Pe = class extends Error {
|
|
|
332
332
|
u(new w("TRANSMISSION_FAILED", Me.message));
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, g = (c) => {
|
|
336
336
|
n == null || n("Received handshake ACK1", c);
|
|
337
337
|
const m = {
|
|
338
338
|
namespace: M,
|
|
@@ -350,10 +350,10 @@ var Pe = class extends Error {
|
|
|
350
350
|
}, T = (c) => {
|
|
351
351
|
n == null || n("Received handshake ACK2", c), F();
|
|
352
352
|
}, q = (c) => {
|
|
353
|
-
j(c) && O(c), X(c) &&
|
|
353
|
+
j(c) && O(c), X(c) && g(c), z(c) && T(c);
|
|
354
354
|
};
|
|
355
355
|
return e.addMessageHandler(q), v.push(() => e.removeMessageHandler(q)), Y(), i;
|
|
356
|
-
},
|
|
356
|
+
}, ge = Ke, ze = (e) => {
|
|
357
357
|
let t = !1, r;
|
|
358
358
|
return (...a) => (t || (t = !0, r = e(...a)), r);
|
|
359
359
|
}, Ge = ze, ne = /* @__PURE__ */ new WeakSet(), Be = ({
|
|
@@ -393,7 +393,7 @@ 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 ge({
|
|
397
397
|
messenger: e,
|
|
398
398
|
methods: t,
|
|
399
399
|
timeout: r,
|
|
@@ -533,7 +533,7 @@ 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: [/^http:\/\/localhost(:\d+)/, "https://archilogic-com.github.io"]
|
|
537
537
|
// Alternatively,
|
|
538
538
|
// allowedOrigins: [new Url(iframe.src).origin]
|
|
539
539
|
});
|
|
@@ -560,9 +560,9 @@ const Qe = (e, t) => {
|
|
|
560
560
|
remoteWindow: window.parent,
|
|
561
561
|
// Defaults to the current origin.
|
|
562
562
|
allowedOrigins: [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
/^http:\/\/localhost(:\d+)/,
|
|
564
|
+
/^https:\/\/(.*)app.archilogic.com/,
|
|
565
|
+
/^https:\/\/(.*).archilogic-frontend.com/
|
|
566
566
|
]
|
|
567
567
|
}), r = ve({
|
|
568
568
|
messenger: t,
|
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.3",
|
|
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
|
}
|