@snaptrude/plugin-core 0.0.0-dev-20260908074328 → 0.0.0-dev-20260921132444
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/AGENTS.md +4 -0
- package/CHANGELOG.md +52 -16
- package/dist/api/core/io/import/index.d.ts +3 -1
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/core/mode/index.d.ts +19 -7
- package/dist/api/core/mode/index.d.ts.map +1 -1
- package/dist/api/core/tags.d.ts +81 -0
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/design/create/bulk-items.d.ts +185 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/grids.d.ts +132 -0
- package/dist/api/design/create/grids.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +424 -51
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +37 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +6 -20
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +20 -13
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +73 -5
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/grids.d.ts +237 -0
- package/dist/api/design/grids.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +9 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/query/grids.d.ts +287 -0
- package/dist/api/design/query/grids.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +29 -2
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +0 -61
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +74 -0
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +0 -3
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/presentation/annotate.d.ts +2 -2
- package/dist/api/presentation/placedViews.d.ts +1 -35
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +2 -20
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/program/departments.d.ts +58 -2
- package/dist/api/program/departments.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +16 -6
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/labels.d.ts +355 -0
- package/dist/api/program/labels.d.ts.map +1 -0
- package/dist/api/program/metadata.d.ts +328 -0
- package/dist/api/program/metadata.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +263 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +49 -2
- package/dist/api/workspace/index.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +3 -8
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/handles.d.ts +19 -0
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +2489 -1941
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2395 -1936
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/core/io/import/index.ts +11 -3
- package/src/api/core/mode/index.ts +19 -7
- package/src/api/core/tags.ts +76 -0
- package/src/api/design/create/bulk-items.ts +186 -0
- package/src/api/design/create/grids.ts +137 -0
- package/src/api/design/create/index.ts +472 -70
- package/src/api/design/create/opening-fields.ts +37 -0
- package/src/api/design/delete/index.ts +5 -20
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +20 -13
- package/src/api/design/family.ts +51 -4
- package/src/api/design/grids.ts +237 -0
- package/src/api/design/index.ts +10 -0
- package/src/api/design/query/grids.ts +197 -0
- package/src/api/design/query/index.ts +27 -2
- package/src/api/design/query/spaces.ts +0 -68
- package/src/api/design/update/index.ts +53 -0
- package/src/api/entity/space.ts +0 -2
- package/src/api/presentation/placedViews.ts +1 -29
- package/src/api/presentation/sheets.ts +3 -19
- package/src/api/program/departments.ts +54 -2
- package/src/api/program/index.ts +16 -6
- package/src/api/program/labels.ts +332 -0
- package/src/api/program/metadata.ts +364 -0
- package/src/api/program/spreadsheet.ts +282 -0
- package/src/api/workspace/index.ts +51 -2
- package/src/errors/codes.ts +2 -30
- package/src/handles.ts +24 -0
- package/test/errors.test.mjs +0 -4
- package/snaptrude-plugin-core-0.11.0.tgz +0 -0
|
@@ -820,6 +820,144 @@ export abstract class PluginProgramSpreadsheetApi {
|
|
|
820
820
|
* ```
|
|
821
821
|
*/
|
|
822
822
|
public abstract ping(): PluginApiReturn<PluginProgramSpreadsheetPingResult>
|
|
823
|
+
|
|
824
|
+
// --- Custom program sheets (grouped program views) -----------------------------
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Create a **custom program sheet** — a live view of the program grouped by a
|
|
828
|
+
* configurable hierarchy (the Program tab's "Custom" sheet with *Organize →
|
|
829
|
+
* Group by*).
|
|
830
|
+
*
|
|
831
|
+
* Unlike {@linkcode PluginProgramSpreadsheetApi.createSheet} (a blank sheet you
|
|
832
|
+
* write cells into), a custom sheet is data-bound: its rows are the project's
|
|
833
|
+
* spaces, re-rendered from the model, grouped by `groupBy` in order (e.g.
|
|
834
|
+
* `["departmentName", "<metadataHeaderId>", "label"]` for a healthcare
|
|
835
|
+
* department → sub-department → room hierarchy) and showing the `properties`
|
|
836
|
+
* columns. Valid property ids come from
|
|
837
|
+
* {@linkcode PluginProgramSpreadsheetApi.listCustomSheetProperties} — built-in
|
|
838
|
+
* properties plus every program metadata header id. The configuration is
|
|
839
|
+
* saved with the sheet.
|
|
840
|
+
*
|
|
841
|
+
* @param name - The sheet name to create (must not already exist).
|
|
842
|
+
* @param options - Optional `groupBy` (property ids, outermost first; default
|
|
843
|
+
* none), `properties` (column property ids, in order; default
|
|
844
|
+
* `["label", "areas"]`), and `groupColors` (property id → CSS hex fill for
|
|
845
|
+
* that level's group headers).
|
|
846
|
+
* @returns The sheet's {@linkcode PluginSpreadsheetCustomSheet} configuration.
|
|
847
|
+
* @throws If a sheet named `name` already exists, or a property id is unknown.
|
|
848
|
+
*
|
|
849
|
+
* @examplePrompt Create a custom sheet grouped by department then sub-department
|
|
850
|
+
* @examplePrompt Make a program view grouped by storey and label
|
|
851
|
+
* @examplePrompt Build a grouped program sheet for the healthcare hierarchy
|
|
852
|
+
* @examplePrompt Add a custom sheet with a department → room type group-by
|
|
853
|
+
*
|
|
854
|
+
* # Example
|
|
855
|
+
* ```ts
|
|
856
|
+
* const { headers } = await snaptrude.program.metadata.listHeaders()
|
|
857
|
+
* const subDept = headers.find((h) => h.name === "Sub-department")
|
|
858
|
+
* await snaptrude.program.spreadsheet.createCustomSheet("Clinical Program", {
|
|
859
|
+
* groupBy: ["departmentName", subDept.headerId, "label"],
|
|
860
|
+
* properties: ["label", "count", "areas", "netAreaAchieved"],
|
|
861
|
+
* })
|
|
862
|
+
* ```
|
|
863
|
+
*/
|
|
864
|
+
public abstract createCustomSheet(
|
|
865
|
+
name: string,
|
|
866
|
+
options?: {
|
|
867
|
+
groupBy?: string[]
|
|
868
|
+
properties?: string[]
|
|
869
|
+
groupColors?: Record<string, string>
|
|
870
|
+
},
|
|
871
|
+
): PluginApiReturn<PluginProgramSpreadsheetCustomSheetResult>
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Update a custom program sheet's group-by hierarchy, columns, or group colors.
|
|
875
|
+
*
|
|
876
|
+
* A **sparse** update: omitted fields are left unchanged. The sheet is
|
|
877
|
+
* re-rendered once and the configuration saved.
|
|
878
|
+
*
|
|
879
|
+
* @param sheetName - The custom sheet to update.
|
|
880
|
+
* @param options - Any of `groupBy`, `properties`, `groupColors` (see
|
|
881
|
+
* {@linkcode PluginProgramSpreadsheetApi.createCustomSheet}).
|
|
882
|
+
* @returns The sheet's updated {@linkcode PluginSpreadsheetCustomSheet}.
|
|
883
|
+
* @throws If `sheetName` is not a custom program sheet, or a property id is
|
|
884
|
+
* unknown.
|
|
885
|
+
*
|
|
886
|
+
* @examplePrompt Change the custom sheet to group by storey first
|
|
887
|
+
* @examplePrompt Add the Occupancy column to my grouped program sheet
|
|
888
|
+
* @examplePrompt Regroup the Clinical Program sheet by department only
|
|
889
|
+
*
|
|
890
|
+
* # Example
|
|
891
|
+
* ```ts
|
|
892
|
+
* await snaptrude.program.spreadsheet.updateCustomSheet("Clinical Program", {
|
|
893
|
+
* groupBy: ["storey", "departmentName"],
|
|
894
|
+
* })
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
public abstract updateCustomSheet(
|
|
898
|
+
sheetName: string,
|
|
899
|
+
options: {
|
|
900
|
+
groupBy?: string[]
|
|
901
|
+
properties?: string[]
|
|
902
|
+
groupColors?: Record<string, string>
|
|
903
|
+
},
|
|
904
|
+
): PluginApiReturn<PluginProgramSpreadsheetCustomSheetResult>
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Get a custom program sheet's configuration.
|
|
908
|
+
*
|
|
909
|
+
* @param sheetName - The sheet to read.
|
|
910
|
+
* @returns Its {@linkcode PluginSpreadsheetCustomSheet}, or `null` when no
|
|
911
|
+
* custom program sheet has that name (plain sheets return `null` too).
|
|
912
|
+
*
|
|
913
|
+
* @examplePrompt How is the Clinical Program sheet grouped?
|
|
914
|
+
* @examplePrompt Get the group-by configuration of this custom sheet
|
|
915
|
+
*
|
|
916
|
+
* # Example
|
|
917
|
+
* ```ts
|
|
918
|
+
* const cfg = await snaptrude.program.spreadsheet.getCustomSheet("Clinical Program")
|
|
919
|
+
* if (cfg) console.log(cfg.groupBy, cfg.properties)
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
public abstract getCustomSheet(
|
|
923
|
+
sheetName: string,
|
|
924
|
+
): PluginApiReturn<PluginProgramSpreadsheetGetCustomSheetResult>
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* List the custom program sheets in the workbook with their configurations.
|
|
928
|
+
*
|
|
929
|
+
* @returns A {@linkcode PluginProgramSpreadsheetListCustomSheetsResult} with a
|
|
930
|
+
* `sheets` array (empty when there are none).
|
|
931
|
+
*
|
|
932
|
+
* @examplePrompt List the custom program sheets
|
|
933
|
+
* @examplePrompt Which sheets are grouped program views?
|
|
934
|
+
*
|
|
935
|
+
* # Example
|
|
936
|
+
* ```ts
|
|
937
|
+
* const { sheets } = await snaptrude.program.spreadsheet.listCustomSheets()
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
public abstract listCustomSheets(): PluginApiReturn<PluginProgramSpreadsheetListCustomSheetsResult>
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* List the property ids a custom program sheet can show as columns or group by.
|
|
944
|
+
*
|
|
945
|
+
* Built-in properties (`label`, `departmentName`, `storey`, `areas`, …) plus
|
|
946
|
+
* one entry per program metadata header (its `headerId`). `groupable` is
|
|
947
|
+
* `false` for computed properties that can only be columns.
|
|
948
|
+
*
|
|
949
|
+
* @returns A {@linkcode PluginProgramSpreadsheetListCustomSheetPropertiesResult}.
|
|
950
|
+
*
|
|
951
|
+
* @examplePrompt What can I group a custom program sheet by?
|
|
952
|
+
* @examplePrompt List the columns available for a custom sheet
|
|
953
|
+
*
|
|
954
|
+
* # Example
|
|
955
|
+
* ```ts
|
|
956
|
+
* const { properties } = await snaptrude.program.spreadsheet.listCustomSheetProperties()
|
|
957
|
+
* const groupable = properties.filter((p) => p.groupable).map((p) => p.id)
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
public abstract listCustomSheetProperties(): PluginApiReturn<PluginProgramSpreadsheetListCustomSheetPropertiesResult>
|
|
823
961
|
}
|
|
824
962
|
|
|
825
963
|
/**
|
|
@@ -2414,3 +2552,147 @@ export const PluginProgramSpreadsheetAddImageResult = z.object({
|
|
|
2414
2552
|
export type PluginProgramSpreadsheetAddImageResult = z.infer<
|
|
2415
2553
|
typeof PluginProgramSpreadsheetAddImageResult
|
|
2416
2554
|
>
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* A custom program sheet's configuration — the grouped, data-bound program view
|
|
2558
|
+
* created by {@linkcode PluginProgramSpreadsheetApi.createCustomSheet}.
|
|
2559
|
+
*
|
|
2560
|
+
* | Property | Type | Description |
|
|
2561
|
+
* |---|---|---|
|
|
2562
|
+
* | `sheetName` | `string` | The sheet's name |
|
|
2563
|
+
* | `groupBy` | `string[]` | Group-by hierarchy, outermost first (property ids); `[]` when ungrouped |
|
|
2564
|
+
* | `properties` | `string[]` | Column property ids in column order (`""` marks an unassigned column) |
|
|
2565
|
+
* | `groupColors` | `Record<string, string>` | Property id → CSS hex fill of that level's group headers |
|
|
2566
|
+
* | `proposalId` | `string \| null` | The proposal the sheet belongs to, or `null` when the project has none |
|
|
2567
|
+
*/
|
|
2568
|
+
export const PluginSpreadsheetCustomSheet = z.object({
|
|
2569
|
+
sheetName: z.string(),
|
|
2570
|
+
groupBy: z.array(z.string()),
|
|
2571
|
+
properties: z.array(z.string()),
|
|
2572
|
+
groupColors: z.record(z.string(), z.string()),
|
|
2573
|
+
proposalId: z.string().nullable(),
|
|
2574
|
+
})
|
|
2575
|
+
export type PluginSpreadsheetCustomSheet = z.infer<
|
|
2576
|
+
typeof PluginSpreadsheetCustomSheet
|
|
2577
|
+
>
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* The configurable part of a custom program sheet, for
|
|
2581
|
+
* {@linkcode PluginProgramSpreadsheetApi.createCustomSheet} /
|
|
2582
|
+
* {@linkcode PluginProgramSpreadsheetApi.updateCustomSheet}. All fields optional.
|
|
2583
|
+
*
|
|
2584
|
+
* | Property | Type | Description |
|
|
2585
|
+
* |---|---|---|
|
|
2586
|
+
* | `groupBy` | `string[]?` | Group-by hierarchy, outermost first (property ids) |
|
|
2587
|
+
* | `properties` | `string[]?` | Column property ids, in order |
|
|
2588
|
+
* | `groupColors` | `Record<string, string>?` | Property id → CSS hex fill for that level's group headers |
|
|
2589
|
+
*/
|
|
2590
|
+
export const PluginSpreadsheetCustomSheetConfig = z.object({
|
|
2591
|
+
groupBy: z.array(z.string().trim().min(1)).max(10).optional(),
|
|
2592
|
+
properties: z.array(z.string()).max(50).optional(),
|
|
2593
|
+
groupColors: z.record(z.string(), z.string()).optional(),
|
|
2594
|
+
})
|
|
2595
|
+
export type PluginSpreadsheetCustomSheetConfig = z.infer<
|
|
2596
|
+
typeof PluginSpreadsheetCustomSheetConfig
|
|
2597
|
+
>
|
|
2598
|
+
|
|
2599
|
+
/**
|
|
2600
|
+
* Arguments for {@linkcode PluginProgramSpreadsheetApi.createCustomSheet}.
|
|
2601
|
+
*
|
|
2602
|
+
* | Property | Type | Description |
|
|
2603
|
+
* |---|---|---|
|
|
2604
|
+
* | `name` | `string` | The sheet name to create |
|
|
2605
|
+
* | `groupBy` / `properties` / `groupColors` | — | See {@linkcode PluginSpreadsheetCustomSheetConfig} |
|
|
2606
|
+
*/
|
|
2607
|
+
export const PluginProgramSpreadsheetCreateCustomSheetArgs =
|
|
2608
|
+
PluginSpreadsheetCustomSheetConfig.extend({
|
|
2609
|
+
name: z.string().trim().min(1),
|
|
2610
|
+
})
|
|
2611
|
+
export type PluginProgramSpreadsheetCreateCustomSheetArgs = z.infer<
|
|
2612
|
+
typeof PluginProgramSpreadsheetCreateCustomSheetArgs
|
|
2613
|
+
>
|
|
2614
|
+
|
|
2615
|
+
/**
|
|
2616
|
+
* Arguments for {@linkcode PluginProgramSpreadsheetApi.updateCustomSheet}.
|
|
2617
|
+
*
|
|
2618
|
+
* | Property | Type | Description |
|
|
2619
|
+
* |---|---|---|
|
|
2620
|
+
* | `sheetName` | `string` | The custom sheet to update |
|
|
2621
|
+
* | `groupBy` / `properties` / `groupColors` | — | Sparse; see {@linkcode PluginSpreadsheetCustomSheetConfig} |
|
|
2622
|
+
*/
|
|
2623
|
+
export const PluginProgramSpreadsheetUpdateCustomSheetArgs =
|
|
2624
|
+
PluginSpreadsheetCustomSheetConfig.extend({
|
|
2625
|
+
sheetName: z.string().trim().min(1),
|
|
2626
|
+
})
|
|
2627
|
+
export type PluginProgramSpreadsheetUpdateCustomSheetArgs = z.infer<
|
|
2628
|
+
typeof PluginProgramSpreadsheetUpdateCustomSheetArgs
|
|
2629
|
+
>
|
|
2630
|
+
|
|
2631
|
+
/** Result of `createCustomSheet` / `updateCustomSheet` — the sheet's configuration. */
|
|
2632
|
+
export const PluginProgramSpreadsheetCustomSheetResult = PluginSpreadsheetCustomSheet
|
|
2633
|
+
export type PluginProgramSpreadsheetCustomSheetResult = z.infer<
|
|
2634
|
+
typeof PluginProgramSpreadsheetCustomSheetResult
|
|
2635
|
+
>
|
|
2636
|
+
|
|
2637
|
+
/** Arguments for {@linkcode PluginProgramSpreadsheetApi.getCustomSheet}. */
|
|
2638
|
+
export const PluginProgramSpreadsheetGetCustomSheetArgs = z.object({
|
|
2639
|
+
sheetName: z.string().trim().min(1),
|
|
2640
|
+
})
|
|
2641
|
+
export type PluginProgramSpreadsheetGetCustomSheetArgs = z.infer<
|
|
2642
|
+
typeof PluginProgramSpreadsheetGetCustomSheetArgs
|
|
2643
|
+
>
|
|
2644
|
+
|
|
2645
|
+
/** Result of {@linkcode PluginProgramSpreadsheetApi.getCustomSheet} — the configuration, or `null`. */
|
|
2646
|
+
export const PluginProgramSpreadsheetGetCustomSheetResult =
|
|
2647
|
+
PluginSpreadsheetCustomSheet.nullable()
|
|
2648
|
+
export type PluginProgramSpreadsheetGetCustomSheetResult = z.infer<
|
|
2649
|
+
typeof PluginProgramSpreadsheetGetCustomSheetResult
|
|
2650
|
+
>
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* Result of {@linkcode PluginProgramSpreadsheetApi.listCustomSheets}.
|
|
2654
|
+
*
|
|
2655
|
+
* | Property | Type | Description |
|
|
2656
|
+
* |---|---|---|
|
|
2657
|
+
* | `sheets` | {@linkcode PluginSpreadsheetCustomSheet}`[]` | Every custom program sheet |
|
|
2658
|
+
*/
|
|
2659
|
+
export const PluginProgramSpreadsheetListCustomSheetsResult = z.object({
|
|
2660
|
+
sheets: z.array(PluginSpreadsheetCustomSheet),
|
|
2661
|
+
})
|
|
2662
|
+
export type PluginProgramSpreadsheetListCustomSheetsResult = z.infer<
|
|
2663
|
+
typeof PluginProgramSpreadsheetListCustomSheetsResult
|
|
2664
|
+
>
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* A property a custom program sheet can show or group by.
|
|
2668
|
+
*
|
|
2669
|
+
* | Property | Type | Description |
|
|
2670
|
+
* |---|---|---|
|
|
2671
|
+
* | `id` | `string` | Property id (built-in key, or a metadata `headerId`) |
|
|
2672
|
+
* | `name` | `string` | Display name |
|
|
2673
|
+
* | `groupable` | `boolean` | Whether the sheet can group by it |
|
|
2674
|
+
* | `custom` | `boolean` | `true` for program metadata headers, `false` for built-ins |
|
|
2675
|
+
*/
|
|
2676
|
+
export const PluginSpreadsheetCustomSheetProperty = z.object({
|
|
2677
|
+
id: z.string(),
|
|
2678
|
+
name: z.string(),
|
|
2679
|
+
groupable: z.boolean(),
|
|
2680
|
+
custom: z.boolean(),
|
|
2681
|
+
})
|
|
2682
|
+
export type PluginSpreadsheetCustomSheetProperty = z.infer<
|
|
2683
|
+
typeof PluginSpreadsheetCustomSheetProperty
|
|
2684
|
+
>
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Result of {@linkcode PluginProgramSpreadsheetApi.listCustomSheetProperties}.
|
|
2688
|
+
*
|
|
2689
|
+
* | Property | Type | Description |
|
|
2690
|
+
* |---|---|---|
|
|
2691
|
+
* | `properties` | {@linkcode PluginSpreadsheetCustomSheetProperty}`[]` | Built-ins first, then metadata headers |
|
|
2692
|
+
*/
|
|
2693
|
+
export const PluginProgramSpreadsheetListCustomSheetPropertiesResult = z.object({
|
|
2694
|
+
properties: z.array(PluginSpreadsheetCustomSheetProperty),
|
|
2695
|
+
})
|
|
2696
|
+
export type PluginProgramSpreadsheetListCustomSheetPropertiesResult = z.infer<
|
|
2697
|
+
typeof PluginProgramSpreadsheetListCustomSheetPropertiesResult
|
|
2698
|
+
>
|
|
@@ -10,13 +10,16 @@ import { PluginApiReturn } from "../../types"
|
|
|
10
10
|
* Teams are **read-only** here (no create/invite/delete in v1, a deliberate
|
|
11
11
|
* safety decision); there are no folders in v1. A `projectId` is the project's
|
|
12
12
|
* floorkey. Plan limits are enforced by the backend — a limit rejection surfaces
|
|
13
|
-
* as a normal host error. It also carries the workspace-level mode
|
|
13
|
+
* as a normal host error. It also carries the workspace-level mode switches for
|
|
14
14
|
* Present mode ({@linkcode PluginWorkspaceApi.openPresentMode} /
|
|
15
|
-
* {@linkcode PluginWorkspaceApi.closePresentMode})
|
|
15
|
+
* {@linkcode PluginWorkspaceApi.closePresentMode}) and Program mode
|
|
16
|
+
* ({@linkcode PluginWorkspaceApi.openProgramMode} /
|
|
17
|
+
* {@linkcode PluginWorkspaceApi.closeProgramMode}).
|
|
16
18
|
*
|
|
17
19
|
* - {@linkcode PluginWorkspaceApi.projects} — Create, copy, list, read & rename projects
|
|
18
20
|
* - {@linkcode PluginWorkspaceApi.teams} — Read teams and their members
|
|
19
21
|
* - {@linkcode PluginWorkspaceApi.openPresentMode} / {@linkcode PluginWorkspaceApi.closePresentMode} — Open/close the Present-mode documentation editor
|
|
22
|
+
* - {@linkcode PluginWorkspaceApi.openProgramMode} / {@linkcode PluginWorkspaceApi.closeProgramMode} — Open/close the Program tab (the spreadsheet the `program.spreadsheet.*` calls run in)
|
|
20
23
|
*/
|
|
21
24
|
export abstract class PluginWorkspaceApi {
|
|
22
25
|
/** Projects — create, copy, list, read & rename. See {@linkcode PluginWorkspaceProjectsApi}. */
|
|
@@ -68,6 +71,52 @@ export abstract class PluginWorkspaceApi {
|
|
|
68
71
|
*/
|
|
69
72
|
public abstract closePresentMode(): PluginApiReturn<void>
|
|
70
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Open Program mode — the Program tab the `program.spreadsheet.*` calls run in.
|
|
76
|
+
*
|
|
77
|
+
* Runs the top bar's own Program-button sequence (remember the preference,
|
|
78
|
+
* open or re-link the paired Program window) and resolves only once that tab
|
|
79
|
+
* has connected to the editor over its channel, so a `program.spreadsheet.*`
|
|
80
|
+
* call issued right after this resolves finds the tab open. The open happens
|
|
81
|
+
* outside a user gesture, so the browser may block the pop-up; the editor
|
|
82
|
+
* then shows its "Allow pop-up to continue" modal and this call keeps waiting
|
|
83
|
+
* (up to ~90s) for the user to confirm. Idempotent — resolves immediately
|
|
84
|
+
* when the Program tab is already connected, and is a no-op when the plugin is
|
|
85
|
+
* itself running in the Program tab. Write-gated.
|
|
86
|
+
*
|
|
87
|
+
* @throws `PRECONDITION_FAILED` if the user dismisses the pop-up modal or the
|
|
88
|
+
* Program tab does not connect within the timeout.
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Open program mode
|
|
91
|
+
* @examplePrompt Open the Program tab so I can build a custom sheet
|
|
92
|
+
* @examplePrompt Switch to the program spreadsheet
|
|
93
|
+
*
|
|
94
|
+
* # Example
|
|
95
|
+
* ```ts
|
|
96
|
+
* await snaptrude.workspace.openProgramMode()
|
|
97
|
+
* const { sheets } = await snaptrude.program.spreadsheet.listSheets()
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
public abstract openProgramMode(): PluginApiReturn<void>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Close the Program tab.
|
|
104
|
+
*
|
|
105
|
+
* Idempotent — a no-op when no Program tab is connected. Write-gated, like
|
|
106
|
+
* {@linkcode PluginWorkspaceApi.openProgramMode}.
|
|
107
|
+
*
|
|
108
|
+
* @throws `PRECONDITION_FAILED` if the tab is still connected after ~15s.
|
|
109
|
+
*
|
|
110
|
+
* @examplePrompt Close program mode
|
|
111
|
+
* @examplePrompt Close the Program tab
|
|
112
|
+
*
|
|
113
|
+
* # Example
|
|
114
|
+
* ```ts
|
|
115
|
+
* await snaptrude.workspace.closeProgramMode()
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
public abstract closeProgramMode(): PluginApiReturn<void>
|
|
119
|
+
|
|
71
120
|
constructor() {}
|
|
72
121
|
}
|
|
73
122
|
|
package/src/errors/codes.ts
CHANGED
|
@@ -5,13 +5,8 @@
|
|
|
5
5
|
* APPEND-ONLY: codes are a published contract; never rename or remove one.
|
|
6
6
|
* Handle-resolution failures deliberately collapse to ONE code
|
|
7
7
|
* (`HANDLE_INVALID`) so error responses cannot be used as an existence /
|
|
8
|
-
* ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6)
|
|
9
|
-
*
|
|
10
|
-
* parametric resolution (merge / split / rebuild) has since retired — a
|
|
11
|
-
* lifetime fact about the caller's own write-scoped handle, not an oracle
|
|
12
|
-
* (forged / never-issued ids still collapse to `HANDLE_INVALID`).
|
|
13
|
-
* `HANDLE_KIND_MISMATCH` stays distinct because the kind is information the
|
|
14
|
-
* caller already holds.
|
|
8
|
+
* ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6). `HANDLE_KIND_MISMATCH`
|
|
9
|
+
* stays distinct because the kind is information the caller already holds.
|
|
15
10
|
*/
|
|
16
11
|
export const PLUGIN_ERROR_CODES = [
|
|
17
12
|
"VALIDATION",
|
|
@@ -37,10 +32,6 @@ export const PLUGIN_ERROR_CODES = [
|
|
|
37
32
|
"NO_ACTIVE_STRUCTURE",
|
|
38
33
|
"NO_ELIGIBLE_ELEMENTS",
|
|
39
34
|
"PROPOSAL_SWITCH_BLOCKED",
|
|
40
|
-
"HANDLE_STALE",
|
|
41
|
-
"KIND_HIDDEN_IN_MODE",
|
|
42
|
-
"MERGED_INTO_EXISTING",
|
|
43
|
-
"BLOCKED_IN_BIM",
|
|
44
35
|
"INTERNAL",
|
|
45
36
|
"UNKNOWN",
|
|
46
37
|
] as const
|
|
@@ -132,25 +123,6 @@ export const CODE_META: Record<PluginErrorCode, CodeMeta> = {
|
|
|
132
123
|
category: "execution",
|
|
133
124
|
hintTemplate: "Wait for the in-canvas agent run to finish, then retry.",
|
|
134
125
|
},
|
|
135
|
-
HANDLE_STALE: {
|
|
136
|
-
category: "handle",
|
|
137
|
-
hintTemplate:
|
|
138
|
-
"The entity was retired by a parametric resolution (merge/split/rebuild); re-query for its successor.",
|
|
139
|
-
},
|
|
140
|
-
KIND_HIDDEN_IN_MODE: {
|
|
141
|
-
category: "execution",
|
|
142
|
-
hintTemplate:
|
|
143
|
-
"This entity kind has no representation in the current mode/LOD; switch mode or target a visible kind.",
|
|
144
|
-
},
|
|
145
|
-
MERGED_INTO_EXISTING: {
|
|
146
|
-
category: "execution",
|
|
147
|
-
hintTemplate:
|
|
148
|
-
"The created geometry merged into an existing entity; use the surviving handles from details.",
|
|
149
|
-
},
|
|
150
|
-
BLOCKED_IN_BIM: {
|
|
151
|
-
category: "execution",
|
|
152
|
-
hintTemplate: "This operation is unavailable in BIM mode; switch to Design and retry.",
|
|
153
|
-
},
|
|
154
126
|
INTERNAL: {
|
|
155
127
|
category: "internal",
|
|
156
128
|
hintTemplate: "Host-side fault. Report with errorId.",
|
package/src/handles.ts
CHANGED
|
@@ -115,6 +115,19 @@ export type UnderlayHandle = EntityId<"underlay">
|
|
|
115
115
|
*/
|
|
116
116
|
export type TerrainHandle = EntityId<"terrain">
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* A **dimension line** — one measurement annotation left behind by the Measuring
|
|
120
|
+
* Tape tool (NOT a width/height/depth property; see `design.dimensions`).
|
|
121
|
+
* Entity-style: the token IS the raw engine dimension id (`dim_…`), resolved live
|
|
122
|
+
* host-side from the dimension-line registry (`getDimensionLineMap()`) — not via
|
|
123
|
+
* `ComponentUtility.FindComponentById`, which does not index dimension lines (a
|
|
124
|
+
* dimension line is not a Component). No arena, no quota, stable across
|
|
125
|
+
* undo/redo and across reloads (the record persists with the project). Returned
|
|
126
|
+
* by `design.dimensions.create` and consumed by every other
|
|
127
|
+
* `design.dimensions.*` method.
|
|
128
|
+
*/
|
|
129
|
+
export type DimensionHandle = EntityId<"dimension">
|
|
130
|
+
|
|
118
131
|
/**
|
|
119
132
|
* A handle to an **asynchronous import job** (today: a DWG → Forge conversion, which
|
|
120
133
|
* can take minutes). Returned immediately by `core.io.import.dwg`; poll it via
|
|
@@ -233,6 +246,17 @@ export const ImportJobHandle = z
|
|
|
233
246
|
.min(1)
|
|
234
247
|
.transform((s) => s as ImportJobHandle)
|
|
235
248
|
|
|
249
|
+
/**
|
|
250
|
+
* {@linkcode DimensionHandle} is an entity-style handle — the raw `dim_…` engine
|
|
251
|
+
* id, validated only as a non-empty string (no `"<kind>_"` prefix enforcement),
|
|
252
|
+
* resolved live host-side against the dimension-line registry (existence
|
|
253
|
+
* enforced there, as `HANDLE_INVALID`).
|
|
254
|
+
*/
|
|
255
|
+
export const DimensionHandle = z
|
|
256
|
+
.string()
|
|
257
|
+
.min(1)
|
|
258
|
+
.transform((s) => s as DimensionHandle)
|
|
259
|
+
|
|
236
260
|
// Value-kind handle schemas (all-handle model, §11).
|
|
237
261
|
export const Vec3Handle = handleSchema("vec3")
|
|
238
262
|
export const QuatHandle = handleSchema("quat")
|
package/test/errors.test.mjs
CHANGED
|
@@ -178,10 +178,6 @@ test("PLUGIN_ERROR_CODES matches the reviewed snapshot (append-only contract)",
|
|
|
178
178
|
"NO_ACTIVE_STRUCTURE",
|
|
179
179
|
"NO_ELIGIBLE_ELEMENTS",
|
|
180
180
|
"PROPOSAL_SWITCH_BLOCKED",
|
|
181
|
-
"HANDLE_STALE",
|
|
182
|
-
"KIND_HIDDEN_IN_MODE",
|
|
183
|
-
"MERGED_INTO_EXISTING",
|
|
184
|
-
"BLOCKED_IN_BIM",
|
|
185
181
|
"INTERNAL",
|
|
186
182
|
"UNKNOWN",
|
|
187
183
|
])
|
|
Binary file
|