@archilogic/extension-sdk 0.2.2 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.2.2
4
10
 
5
11
  ### Patch Changes
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<LayoutNode, Map<EdgeType, Set<LayoutNode>>>;
853
- addNode(node: LayoutNode): Map<EdgeType, Set<LayoutNode>>;
854
- addEdge(type: EdgeType, source: LayoutNode, destination: LayoutNode): void;
855
- removeNode(node: LayoutNode): void;
856
- removeEdge(type: EdgeType, source: LayoutNode, destination: LayoutNode): void;
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: EdgeType, start: LayoutNode, end: LayoutNode, options?: {
859
+ findShortestPath(edgeType: K, start: T, end: T, options?: {
862
860
  depthLimit?: number;
863
- }): LayoutNode[] | null;
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 SpaceGraphProduct;
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 SpaceGraphProduct;
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 class SpaceGraphProduct extends SpaceGraphNodeWithCustomAttributesBase {
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 interface SpaceGraphProductJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
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 SpaceGraphProductType = typeof SpaceGraphProductTypeValue;
3199
+ declare type SpaceGraphProductStaticType = typeof SpaceGraphProductStaticTypeValue;
3200
+
3201
+ declare const SpaceGraphProductStaticTypeValue = "product:static";
3133
3202
 
3134
- declare const SpaceGraphProductTypeValue = "product:static";
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.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.21.1"
35
+ "@archilogic/space-graph-core": "^0.22.3"
36
36
  },
37
37
  "nx": {}
38
38
  }