@snaptrude/plugin-core 0.9.7 → 0.9.9
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 +11 -0
- package/api-manifest.json +222 -4
- 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 +14 -6
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +41 -18
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +10 -2
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +20 -13
- package/dist/api/design/doors/index.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/index.cjs +1084 -833
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1039 -833
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/api/core/tags.ts +76 -0
- package/src/api/design/create/bulk-items.ts +10 -6
- package/src/api/design/create/index.ts +43 -24
- package/src/api/design/create/opening-fields.ts +10 -2
- package/src/api/design/doors/index.ts +20 -13
- 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/api-manifest.full.json +0 -8442
|
@@ -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
|
+
>
|