@archilogic/extension-sdk 0.17.3 → 0.19.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @archilogic/extension-sdk
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9264f69: add `hostApi.getApiAccess()`, so an extension whose temporary access token is about to expire can
8
+ ask the host for a fresh one instead of holding the one it got at connect. The credentials are now
9
+ a named `ApiAccess` type rather than an inline shape repeated on both sides.
10
+
11
+ ## 0.18.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 4c40dff: feat: `setPlanConfig` takes `showFloorPlan` to show or hide the floor plan underlay (image or DXF) through the host's floor plan toggle; `null` puts back the user's setting from when the extension started. Older hosts ignore it.
16
+
3
17
  ## 0.17.3
4
18
 
5
19
  ### Patch Changes
package/dist/actions.d.ts CHANGED
@@ -131,6 +131,21 @@ declare type AnnotationUpdateValue = Partial<LayoutAnnotationJson> & {
131
131
  parameters?: Partial<LayoutAnnotationJson['parameters']>;
132
132
  };
133
133
 
134
+ /**
135
+ * Space API credentials the host issues to an extension that declares `apiAccess` under
136
+ * `parameters` in its manifest. Delivered once in the `onConnect` parameters and, from then on,
137
+ * on demand via `hostApi.getApiAccess()` — the token is short-lived (an hour today), so an
138
+ * extension that outlives it has to ask for a fresh one rather than hold the first forever.
139
+ */
140
+ declare type ApiAccess = {
141
+ /** Value for the `authorization` header. */
142
+ temporaryAccessToken: string;
143
+ /** Unix timestamp in **seconds** at which the token stops working. */
144
+ expiresAt: number;
145
+ /** Base URL of the Space API, e.g. `https://api.archilogic.com`. */
146
+ apiUrl: string;
147
+ };
148
+
134
149
  declare interface Arc {
135
150
  center: Vector2;
136
151
  radius: number;
@@ -1359,6 +1374,7 @@ declare type HostApi = {
1359
1374
  setPlanConfig: (config: {
1360
1375
  theme?: FloorPlanTheme;
1361
1376
  hideElements?: HideableElement[];
1377
+ showFloorPlan?: boolean | null;
1362
1378
  }) => Promise<boolean>;
1363
1379
  addPlanLayer: (args: {
1364
1380
  id?: string;
@@ -1403,6 +1419,25 @@ declare type HostApi = {
1403
1419
  }) => Promise<NodeResult[]>;
1404
1420
  getSpaceGraphJson: () => Promise<SpaceGraphJson>;
1405
1421
  getSharedViewStyles: () => Promise<SharedViewStyle[]>;
1422
+ /**
1423
+ * Space API credentials for this extension, freshly minted by the host. Only extensions that
1424
+ * declare `apiAccess` under `parameters` in their manifest get them — anything else resolves
1425
+ * `null`, as does a host that cannot issue a token.
1426
+ *
1427
+ * The host also delivers credentials once in the `onConnect` parameters, so an extension that
1428
+ * finishes its work inside the token's lifetime never needs this. Call it when the token you
1429
+ * hold is close to `expiresAt` — the host returns a new one with a full lifetime rather than
1430
+ * extending the old.
1431
+ *
1432
+ * @example
1433
+ * ```ts
1434
+ * // ~1 minute of headroom, expiresAt is in seconds
1435
+ * if (apiAccess.expiresAt - Date.now() / 1000 < 60) {
1436
+ * apiAccess = (await hostApi.getApiAccess()) ?? apiAccess
1437
+ * }
1438
+ * ```
1439
+ */
1440
+ getApiAccess: () => Promise<ApiAccess | null>;
1406
1441
  exportPdf: (args?: ExportPdfOptions) => Promise<void | ExportPdfResult>;
1407
1442
  exportSvg: (args?: ExportSvgOptions) => Promise<void | ExportSvgResult>;
1408
1443
  getPath: (args: {
package/dist/actions.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/action-runner.ts
1
+ // src/action-runner.ts
2
2
  var e = (e) => {
3
3
  if (!e || typeof e != "object") return !1;
4
4
  let { code: t, message: n } = e;
@@ -70,5 +70,4 @@ var e = (e) => {
70
70
  }
71
71
  };
72
72
  };
73
- //#endregion
74
73
  export { t as createActionRunner };
package/dist/index.d.ts CHANGED
@@ -59,6 +59,21 @@ declare type AnnotationUpdateValue = Partial<LayoutAnnotationJson> & {
59
59
  parameters?: Partial<LayoutAnnotationJson['parameters']>;
60
60
  };
61
61
 
62
+ /**
63
+ * Space API credentials the host issues to an extension that declares `apiAccess` under
64
+ * `parameters` in its manifest. Delivered once in the `onConnect` parameters and, from then on,
65
+ * on demand via `hostApi.getApiAccess()` — the token is short-lived (an hour today), so an
66
+ * extension that outlives it has to ask for a fresh one rather than hold the first forever.
67
+ */
68
+ export declare type ApiAccess = {
69
+ /** Value for the `authorization` header. */
70
+ temporaryAccessToken: string;
71
+ /** Unix timestamp in **seconds** at which the token stops working. */
72
+ expiresAt: number;
73
+ /** Base URL of the Space API, e.g. `https://api.archilogic.com`. */
74
+ apiUrl: string;
75
+ };
76
+
62
77
  declare interface Arc {
63
78
  center: Vector2;
64
79
  radius: number;
@@ -1266,6 +1281,7 @@ export declare type HostApi = {
1266
1281
  setPlanConfig: (config: {
1267
1282
  theme?: FloorPlanTheme;
1268
1283
  hideElements?: HideableElement[];
1284
+ showFloorPlan?: boolean | null;
1269
1285
  }) => Promise<boolean>;
1270
1286
  addPlanLayer: (args: {
1271
1287
  id?: string;
@@ -1310,6 +1326,25 @@ export declare type HostApi = {
1310
1326
  }) => Promise<NodeResult[]>;
1311
1327
  getSpaceGraphJson: () => Promise<SpaceGraphJson>;
1312
1328
  getSharedViewStyles: () => Promise<SharedViewStyle[]>;
1329
+ /**
1330
+ * Space API credentials for this extension, freshly minted by the host. Only extensions that
1331
+ * declare `apiAccess` under `parameters` in their manifest get them — anything else resolves
1332
+ * `null`, as does a host that cannot issue a token.
1333
+ *
1334
+ * The host also delivers credentials once in the `onConnect` parameters, so an extension that
1335
+ * finishes its work inside the token's lifetime never needs this. Call it when the token you
1336
+ * hold is close to `expiresAt` — the host returns a new one with a full lifetime rather than
1337
+ * extending the old.
1338
+ *
1339
+ * @example
1340
+ * ```ts
1341
+ * // ~1 minute of headroom, expiresAt is in seconds
1342
+ * if (apiAccess.expiresAt - Date.now() / 1000 < 60) {
1343
+ * apiAccess = (await hostApi.getApiAccess()) ?? apiAccess
1344
+ * }
1345
+ * ```
1346
+ */
1347
+ getApiAccess: () => Promise<ApiAccess | null>;
1313
1348
  exportPdf: (args?: ExportPdfOptions) => Promise<void | ExportPdfResult>;
1314
1349
  exportSvg: (args?: ExportSvgOptions) => Promise<void | ExportSvgResult>;
1315
1350
  getPath: (args: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@archilogic/extension-sdk",
3
3
  "description": "",
4
- "version": "0.17.3",
4
+ "version": "0.19.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },