@archilogic/floor-plan-sdk 5.1.8 → 5.1.10

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/dist/fpe.d.ts CHANGED
@@ -311,8 +311,6 @@ declare interface EdgeSplitReturnValue {
311
311
  element?: LayoutEdgeElement;
312
312
  }
313
313
 
314
- declare type EdgeType = 'graph:adjacentTo' | 'graph:connectedTo';
315
-
316
314
  declare interface ExportImage {
317
315
  /** output format: png, jpg */
318
316
  format?: 'png' | 'jpg';
@@ -892,21 +890,33 @@ declare const GeometryUnionTypeValue = "csg:union";
892
890
  /**
893
891
  * undirected graph for traversal without edge weights
894
892
  */
895
- declare class Graph {
896
- nodeMap: Map<LayoutNode, Map<EdgeType, Set<LayoutNode>>>;
897
- addNode(node: LayoutNode): Map<EdgeType, Set<LayoutNode>>;
898
- addEdge(type: EdgeType, source: LayoutNode, destination: LayoutNode): void;
899
- removeNode(node: LayoutNode): void;
900
- removeEdge(type: EdgeType, source: LayoutNode, destination: LayoutNode): void;
893
+ declare class Graph<T extends GraphNodeType = GraphNodeType, K extends string = GraphEdgeType> {
894
+ nodeMap: Map<T, Map<K, Set<T>>>;
895
+ addNode(node: T): Map<K, Set<T>>;
896
+ addEdge(type: K, source: T, destination: T): void;
897
+ removeNode(node: T): void;
898
+ removeEdge(type: K, source: T, destination: T): void;
901
899
  /**
902
900
  * Breadth-First Search
903
901
  * if edges have weights this needs to be replaces with dijkstra algorithm
904
902
  */
905
- findShortestPath(edgeType: EdgeType, start: LayoutNode, end: LayoutNode, options?: {
903
+ findShortestPath(edgeType: K, start: T, end: T, options?: {
906
904
  depthLimit?: number;
907
- }): LayoutNode[] | null;
905
+ }): T[] | null;
906
+ toJSON(): {
907
+ nodes: {
908
+ id: string;
909
+ type: string;
910
+ }[];
911
+ edges: {
912
+ type: string;
913
+ nodes: string[];
914
+ }[];
915
+ };
908
916
  }
909
917
 
918
+ declare type GraphEdgeType = 'graph:adjacentTo' | 'graph:connectedTo';
919
+
910
920
  export declare interface GraphicArgs {
911
921
  shapes: Shape[];
912
922
  position?: Vector2;
@@ -927,6 +937,11 @@ declare type GraphicUpdate = {
927
937
  shapes?: Shape[];
928
938
  };
929
939
 
940
+ declare type GraphNodeType = {
941
+ id: string;
942
+ type: string;
943
+ };
944
+
930
945
  declare class GroupRelation extends SpaceGraphNodeBase {
931
946
  type: GroupRelationType;
932
947
  elements: Set<LayoutElement>;
@@ -1164,6 +1179,8 @@ declare class LayoutAsset extends LayoutTransformElementBase {
1164
1179
  parameters: LayoutAssetParameters;
1165
1180
  product: SpaceGraphProduct | null;
1166
1181
  constructor(id: string);
1182
+ get isComponentInstance(): boolean;
1183
+ get isComponentInstanceChild(): boolean;
1167
1184
  setParameters(parameters: RecursivePartial<LayoutAssetParameters>): void;
1168
1185
  setProduct(product: SpaceGraphProduct): void;
1169
1186
  getBoundingBox(localTransform?: boolean): {
@@ -2416,7 +2433,8 @@ declare type ResourceScope =
2416
2433
  | "superadmin"
2417
2434
  | "token"
2418
2435
  | "subscription"
2419
- | "graphql";
2436
+ | "graphql"
2437
+ | "extension";
2420
2438
 
2421
2439
  declare type Rgb = [number, number, number];
2422
2440
 
@@ -2466,7 +2484,8 @@ declare class SpaceGraph {
2466
2484
  products: SpaceGraphProduct[];
2467
2485
  productsById: Record<string, SpaceGraphProduct>;
2468
2486
  productsByType: NodesByType<{
2469
- readonly 'product:static': typeof SpaceGraphProduct;
2487
+ readonly 'product:static': typeof SpaceGraphProductStatic;
2488
+ readonly 'product:component': typeof SpaceGraphProductComponent;
2470
2489
  }>;
2471
2490
  customAttributes: SpaceGraphCustomAttribute[];
2472
2491
  customAttributesById: Record<string, SpaceGraphCustomAttribute>;
@@ -2503,7 +2522,8 @@ declare class SpaceGraph {
2503
2522
  readonly 'spatialStructure:floor': typeof SpaceGraphFloor;
2504
2523
  readonly 'spatialStructure:layout': typeof SpaceGraphLayout;
2505
2524
  readonly 'relation:group': typeof GroupRelation;
2506
- readonly 'product:static': typeof SpaceGraphProduct;
2525
+ readonly 'product:static': typeof SpaceGraphProductStatic;
2526
+ readonly 'product:component': typeof SpaceGraphProductComponent;
2507
2527
  readonly 'material:embedded': typeof SpaceGraphEmbeddedMaterial;
2508
2528
  readonly 'material:basic': typeof SpaceGraphBasicMaterial;
2509
2529
  readonly 'material:color': typeof SpaceGraphColorMaterial;
@@ -2561,7 +2581,7 @@ declare class SpaceGraph {
2561
2581
  createSpatialStructure(type: SpaceGraphSpatialStructureType, id: string): SpaceGraphSpatialStructure;
2562
2582
  insertProduct(product: SpaceGraphProduct): void;
2563
2583
  removeProduct(product: SpaceGraphProduct): void;
2564
- createProduct(id: string): SpaceGraphProduct;
2584
+ createProduct(id: string, type: SpaceGraphProductType): SpaceGraphProduct;
2565
2585
  insertGeometry(geometryJson: SpaceGraphGeometryJson): void;
2566
2586
  removeGeometry(geometryJson: SpaceGraphGeometryJson): void;
2567
2587
  insertMaterial(material: SpaceGraphMaterial): void;
@@ -2856,7 +2876,7 @@ declare class SpaceGraphLayout extends SpaceGraphSpatialStructureBase {
2856
2876
  include?: string[];
2857
2877
  };
2858
2878
  }): number;
2859
- getLayoutGraph(): Graph;
2879
+ getLayoutGraph(): Graph<LayoutNode>;
2860
2880
  getUniqueId(prefix: string, nodesById: Record<string, SpaceGraphNode>): string;
2861
2881
  getSpaceId(prefix?: string): string;
2862
2882
  getElementId(element: LayoutElement, prefix?: string): string;
@@ -2923,15 +2943,7 @@ declare interface SpaceGraphNodeWithCustomAttributesBaseJson extends SpaceGraphN
2923
2943
  customAttributes?: SpaceGraphCustomAttributeValueJson | null;
2924
2944
  }
2925
2945
 
2926
- declare class SpaceGraphProduct extends SpaceGraphNodeWithCustomAttributesBase {
2927
- type: SpaceGraphProductType;
2928
- attributes: SpaceGraphProductAttributes;
2929
- geometries: GeometryOperationJson[];
2930
- constructor(id: string);
2931
- copyForClone(product: SpaceGraphProduct): void;
2932
- setAttributes(attributesJson: SpaceGraphProductAttributesJson): void;
2933
- toJSON(): SpaceGraphProductJson;
2934
- }
2946
+ declare type SpaceGraphProduct = SpaceGraphProductStatic | SpaceGraphProductComponent;
2935
2947
 
2936
2948
  declare type SpaceGraphProductAttributes = {
2937
2949
  manufacturer: string;
@@ -2953,15 +2965,73 @@ declare type SpaceGraphProductAttributesJson = {
2953
2965
  updatedAt?: string;
2954
2966
  };
2955
2967
 
2956
- declare interface SpaceGraphProductJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
2968
+ declare class SpaceGraphProductBase extends SpaceGraphNodeWithCustomAttributesBase {
2969
+ #private;
2957
2970
  type: SpaceGraphProductType;
2971
+ attributes: SpaceGraphProductAttributes;
2972
+ instances: Set<LayoutAsset>;
2973
+ constructor(id: string, type: SpaceGraphProductType);
2974
+ copyForClone(product: SpaceGraphProductStatic | SpaceGraphProductComponent): void;
2975
+ setAttributes(attributesJson: SpaceGraphProductAttributesJson): void;
2976
+ toJSON(): SpaceGraphProductJson;
2977
+ }
2978
+
2979
+ declare class SpaceGraphProductComponent extends SpaceGraphProductBase {
2980
+ type: SpaceGraphProductComponentType;
2981
+ attributes: SpaceGraphProductAttributes;
2982
+ products: {
2983
+ position: PositionEntry;
2984
+ rotation: RotationEntry;
2985
+ product: string;
2986
+ }[];
2987
+ geometries: GeometryOperationJson[];
2988
+ constructor(id: string);
2989
+ copyForClone(product: SpaceGraphProductComponent): void;
2990
+ toJSON(): SpaceGraphProductComponentJson;
2991
+ setProducts(products: {
2992
+ position: PositionEntry;
2993
+ rotation: RotationEntry;
2994
+ product: string;
2995
+ }[]): void;
2996
+ setInstances(): void;
2997
+ }
2998
+
2999
+ declare interface SpaceGraphProductComponentJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
3000
+ type: SpaceGraphProductComponentType;
2958
3001
  attributes?: SpaceGraphProductAttributesJson;
3002
+ products: {
3003
+ position: PositionEntry;
3004
+ rotation: RotationEntry;
3005
+ product: string;
3006
+ }[];
2959
3007
  geometries: GeometryOperationJson[];
2960
3008
  }
2961
3009
 
2962
- declare type SpaceGraphProductType = typeof SpaceGraphProductTypeValue;
3010
+ declare type SpaceGraphProductComponentType = typeof SpaceGraphProductComponentTypeValue;
3011
+
3012
+ declare const SpaceGraphProductComponentTypeValue = "product:component";
3013
+
3014
+ declare type SpaceGraphProductJson = SpaceGraphProductStaticJson | SpaceGraphProductComponentJson;
3015
+
3016
+ declare class SpaceGraphProductStatic extends SpaceGraphProductBase {
3017
+ type: SpaceGraphProductStaticType;
3018
+ geometries: GeometryOperationJson[];
3019
+ constructor(id: string);
3020
+ copyForClone(product: SpaceGraphProductStatic): void;
3021
+ toJSON(): SpaceGraphProductStaticJson;
3022
+ }
3023
+
3024
+ declare interface SpaceGraphProductStaticJson extends SpaceGraphNodeWithCustomAttributesBaseJson {
3025
+ type: SpaceGraphProductStaticType;
3026
+ attributes?: SpaceGraphProductAttributesJson;
3027
+ geometries: GeometryOperationJson[];
3028
+ }
3029
+
3030
+ declare type SpaceGraphProductStaticType = typeof SpaceGraphProductStaticTypeValue;
3031
+
3032
+ declare const SpaceGraphProductStaticTypeValue = "product:static";
2963
3033
 
2964
- declare const SpaceGraphProductTypeValue = "product:static";
3034
+ declare type SpaceGraphProductType = SpaceGraphProductStaticType | SpaceGraphProductComponentType;
2965
3035
 
2966
3036
  declare type SpaceGraphRelation = GroupRelation;
2967
3037