@i2analyze/notebook-sdk 1.9.0-dev.1 → 1.9.0-dev.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.
@@ -1662,6 +1662,145 @@ export declare namespace chart {
1662
1662
  */
1663
1663
  getRecordsOfType(itemType: schema.ChartItemTypeSpecifier): data.IReadOnlyCollection<records.IChartRecord>;
1664
1664
  }
1665
+ /**
1666
+ * Detailed information about the specific properties, notes, and source references that changed within a record.
1667
+ *
1668
+ * @remarks
1669
+ * This interface provides granular change tracking at the property level.
1670
+ * Empty sets indicate no changes occurred in that category.
1671
+ *
1672
+ * **Known Limitations:**
1673
+ * - Only includes changes for properties that have been fetched. Changes to unfetched properties are not reported here.
1674
+ * - Security dimension changes are not included in this interface.
1675
+ * - If a record is reported as having changed but `recordChanges` shows empty sets for all categories, this may indicate unfetched property changes or security-only edits.
1676
+ *
1677
+ * @example
1678
+ * ```typescript
1679
+ * // Plugin code consuming recordChanges
1680
+ * chartChangeListener((change) => {
1681
+ * if (change.type === 'minor' && change.recordChanges) {
1682
+ * change.recordChanges.forEach((recordId, changes) => {
1683
+ * // Check for property changes
1684
+ * if (changes.properties?.changed.size > 0) {
1685
+ * console.log('Properties changed:', changes.properties.changed);
1686
+ * }
1687
+ *
1688
+ * // Check for note additions
1689
+ * if (changes.notes?.added.size > 0) {
1690
+ * console.log('Notes added:', changes.notes.added);
1691
+ * }
1692
+ *
1693
+ * // Check for source reference edits
1694
+ * if (changes.sourceReferences?.edited.size > 0) {
1695
+ * console.log('Source references edited:', changes.sourceReferences.edited);
1696
+ * }
1697
+ *
1698
+ * // Check for source reference removals
1699
+ * if (changes.sourceReferences?.removed.size > 0) {
1700
+ * console.log('Source references removed:', changes.sourceReferences.removed);
1701
+ * }
1702
+ * });
1703
+ * }
1704
+ * });
1705
+ * ```
1706
+ *
1707
+ * @i2since 1.9
1708
+ */
1709
+ export interface IRecordChanges {
1710
+ /**
1711
+ * Gets the property changes for this record.
1712
+ *
1713
+ * @remarks
1714
+ * The property changes are categorized as follows:
1715
+ * - Added: New properties that were set (property type IDs that were not previously set)
1716
+ * - Removed: Properties that were removed (set to `null` or deleted)
1717
+ * - Changed: Existing properties whose values were modified
1718
+ *
1719
+ * **Note:** If a property value oscillates within the same mutation (for example, A→B→A),
1720
+ * it is still reported as "changed" since this tracks mutations, not just final state.
1721
+ *
1722
+ * Empty sets indicate no changes in that category.
1723
+ *
1724
+ * @i2since 1.9
1725
+ */
1726
+ readonly properties?: {
1727
+ /**
1728
+ * Gets the property type IDs for properties that were added to the record.
1729
+ * @i2since 1.9
1730
+ */
1731
+ readonly added: data.IReadOnlyCollection<schema.PropertyTypeIdentifier>;
1732
+ /**
1733
+ * Gets the property type IDs for properties that were removed from the record.
1734
+ * @i2since 1.9
1735
+ */
1736
+ readonly removed: data.IReadOnlyCollection<schema.PropertyTypeIdentifier>;
1737
+ /**
1738
+ * Gets the property type IDs for properties whose values were changed.
1739
+ * @i2since 1.9
1740
+ */
1741
+ readonly changed: data.IReadOnlyCollection<schema.PropertyTypeIdentifier>;
1742
+ };
1743
+ /**
1744
+ * Gets the note changes for this record.
1745
+ *
1746
+ * @remarks
1747
+ * The note changes are categorized as follows:
1748
+ * - Added: New notes that were created
1749
+ * - Edited: Existing notes whose content was modified
1750
+ * - Removed: Notes that were deleted
1751
+ *
1752
+ * Empty sets indicate no changes in that category.
1753
+ *
1754
+ * @i2since 1.9
1755
+ */
1756
+ readonly notes?: {
1757
+ /**
1758
+ * Gets the note IDs for notes that were added to the record.
1759
+ * @i2since 1.9
1760
+ */
1761
+ readonly added: data.IReadOnlyCollection<data.NoteId>;
1762
+ /**
1763
+ * Gets the note IDs for notes whose content was edited.
1764
+ * @i2since 1.9
1765
+ */
1766
+ readonly edited: data.IReadOnlyCollection<data.NoteId>;
1767
+ /**
1768
+ * Gets the note IDs for notes that were removed from the record.
1769
+ * @i2since 1.9
1770
+ */
1771
+ readonly removed: data.IReadOnlyCollection<data.NoteId>;
1772
+ };
1773
+ /**
1774
+ * Gets the source reference changes for this record.
1775
+ *
1776
+ * @remarks
1777
+ * The source reference changes are categorized as follows:
1778
+ * - Added: New source references that were added
1779
+ * - Edited: Existing source references whose content was modified
1780
+ * - Removed: Source references that were deleted
1781
+ *
1782
+ * Empty sets indicate no changes in that category.
1783
+ *
1784
+ * @i2since 1.9
1785
+ */
1786
+ readonly sourceReferences?: {
1787
+ /**
1788
+ * Gets the source reference IDs for source references that were added to the record.
1789
+ * @i2since 1.9
1790
+ */
1791
+ readonly added: data.IReadOnlyCollection<data.SourceReferenceId>;
1792
+ /**
1793
+ * Gets the source reference IDs for source references whose content was edited.
1794
+ * @i2since 1.9
1795
+ */
1796
+ readonly edited: data.IReadOnlyCollection<data.SourceReferenceId>;
1797
+ /**
1798
+ * Gets the source reference IDs for source references that were removed from the record.
1799
+ * @i2since 1.9
1800
+ */
1801
+ readonly removed: data.IReadOnlyCollection<data.SourceReferenceId>;
1802
+ };
1803
+ }
1665
1804
  /**
1666
1805
  * A change that has occurred to the data in a chart.
1667
1806
  * @i2since 1.0
@@ -1671,14 +1810,18 @@ export declare namespace chart {
1671
1810
  * Gets the type of change (minor or major) made to the chart.
1672
1811
  *
1673
1812
  * @remarks
1674
- * When a "minor" change takes place, the change reports the detail of the affected elements and records.
1675
- * When a "major" change takes place, the expectation is that client code reloads the whole chart.
1813
+ * The `type` field is always "minor" in current versions. The distinction between major and minor changes has been removed.
1814
+ * This field will be removed in the next major release.
1815
+ *
1816
+ * @deprecated This field will be removed in the next major release. All changes now report detailed affected elements and records.
1676
1817
  * @i2since 1.0
1818
+ *
1677
1819
  */
1678
1820
  readonly type: 'minor' | 'major';
1679
1821
  }
1680
1822
  /**
1681
1823
  * A major change that has occurred to the data on a chart.
1824
+ * @deprecated Use {@link chart.IChartChange} instead. The `type` field is always "minor" and the distinction between major and minor changes has been removed. This interface will be removed in the next major release.
1682
1825
  * @i2since 1.0
1683
1826
  */
1684
1827
  export interface IChartChangeMajor extends IChartChangeBase {
@@ -1784,9 +1927,44 @@ export declare namespace chart {
1784
1927
  */
1785
1928
  readonly removed: data.IReadOnlyCollection<visual.ElementId>;
1786
1929
  };
1930
+ /**
1931
+ * Gets granular change details for records that changed in this chart update.
1932
+ *
1933
+ * @remarks
1934
+ * This optional field provides property-level change tracking for records.
1935
+ * When populated, it contains an entry for each record that changed, with detailed information about:
1936
+ * - Which properties were added, removed, or changed
1937
+ * - Which notes were added, edited, or removed
1938
+ * - Which source references were added or removed
1939
+ * *
1940
+ * **Usage Pattern:**
1941
+ * ```typescript
1942
+ * // New opt-in granularity
1943
+ * change.recordChanges?.forEach((recordId, changes) => {
1944
+ * if (changes.properties?.changed.size > 0) {
1945
+ * console.log('Properties changed for', recordId);
1946
+ * }
1947
+ * });
1948
+ * ```
1949
+ *
1950
+ * **Known Limitations:**
1951
+ * Changes to unfetched properties are not reported here.
1952
+ * - Security dimension changes are not included.
1953
+ * - If a record appears in `records.changed` but has no corresponding entry in `recordChanges`,
1954
+ * or if the entry shows empty sets for all categories, this may indicate unfetched property changes
1955
+ * or security-only edits.
1956
+ *
1957
+ * @i2since 1.9
1958
+ */
1959
+ readonly recordChanges?: data.IKeyedReadOnlyCollection<records.AnalyzeRecordId, IRecordChanges>;
1787
1960
  }
1788
1961
  /**
1789
1962
  * A change to the data in a chart in i2 Notebook.
1963
+ *
1964
+ * @remarks
1965
+ * Use this type for all chart change handling. The distinction between major and minor changes has been removed,
1966
+ * and all changes now report detailed information about affected elements and records.
1967
+ *
1790
1968
  * @i2since 1.0
1791
1969
  */
1792
1970
  export type IChartChange = IChartChangeMajor | IChartChangeMinor;
@@ -2295,6 +2473,47 @@ export declare namespace commands {
2295
2473
  * @i2since 1.0
2296
2474
  */
2297
2475
  surfaceCommands(...commandsOrCommandIds: (ICommand | CommandId)[]): void;
2476
+ /**
2477
+ * Adds a dynamic group whose commands are determined at runtime based on the current application state.
2478
+ *
2479
+ * @remarks
2480
+ * Dynamic groups allow commands to be created and surfaced at runtime, when the group is displayed
2481
+ * from a menu or ribbon popup. The group's `onSurface` callback is invoked when the group needs to
2482
+ * be rendered, and receives the current context along with a scoped {@link commands.IDynamicActionArea}
2483
+ * for creating and positioning commands.
2484
+ *
2485
+ * Commands created within a dynamic group are transient - they exist only while the group is visible
2486
+ * and are automatically cleaned up when the group is removed from the surface.
2487
+ *
2488
+ * @example
2489
+ * ```typescript
2490
+ * // Add a dynamic group to the chart item popup menu
2491
+ * api.commands.chartItemPopupMenu.addDynamicGroup({
2492
+ * id: 'context-actions',
2493
+ * label: 'Context Actions',
2494
+ * type: 'records',
2495
+ * onSurface: (commandArea, context, signal) => {
2496
+ * // Create commands based on current selection
2497
+ * const entityCount = context.entityRecords.count;
2498
+ * if (entityCount > 0) {
2499
+ * const cmd = commandArea.createCommand({
2500
+ * id: 'process-selected',
2501
+ * name: `Process ${entityCount} selected items`,
2502
+ * type: 'records',
2503
+ * onExecute: (payload) => { /* ... *\/ }
2504
+ * });
2505
+ * commandArea.surfaceCommands(cmd);
2506
+ * }
2507
+ * }
2508
+ * });
2509
+ * ```
2510
+ *
2511
+ * @typeParam TCommandType - The type of commands in this group, which determines the context passed to `onSurface`.
2512
+ * @param config - The configuration for the dynamic group.
2513
+ * @throws `Error` if the configuration is invalid or a group with the same identifier already exists.
2514
+ * @i2since 1.9
2515
+ */
2516
+ addDynamicGroup<TCommandType extends CommandType = CommandType>(config: IDynamicGroupConfig<TCommandType>): void;
2298
2517
  /**
2299
2518
  * Gets the system groups for the action area, which you can use to specify relative locations for your actions and groups.
2300
2519
  * @i2since 1.0
@@ -2419,6 +2638,128 @@ export declare namespace commands {
2419
2638
  */
2420
2639
  export interface IMenuGroup extends IGroupBase {
2421
2640
  }
2641
+ /**
2642
+ * Configuration for a dynamic group whose contents is determined at runtime.
2643
+ *
2644
+ * @typeParam TCommandType - The type of commands in this group, which determines the context passed to `onSurface`.
2645
+ * @i2since 1.9
2646
+ */
2647
+ export interface IDynamicGroupConfig<TCommandType extends CommandType = CommandType> {
2648
+ /**
2649
+ * Gets the identifier of the group, which should be a GUID.
2650
+ * @i2since 1.9
2651
+ */
2652
+ readonly id: GroupId;
2653
+ /**
2654
+ * Gets the label of the group, which is displayed to users.
2655
+ *
2656
+ * @remarks
2657
+ * The label appears in popup menus and submenus, and also as the label for ribbon buttons
2658
+ * that open a pop-out menu.
2659
+ *
2660
+ * @i2since 1.9
2661
+ */
2662
+ readonly label: string;
2663
+ /**
2664
+ * Gets the icon of the group, which is displayed in the user interface.
2665
+ * @i2since 1.9
2666
+ */
2667
+ readonly icon?: IIcon;
2668
+ /**
2669
+ * Gets the type of context that is passed to the `onSurface` callback.
2670
+ *
2671
+ * @remarks
2672
+ * The value `'unscoped'` means no context (the context parameter is `undefined`).
2673
+ * The value `'records'` provides a chart selection records context ({@link commands.IRecordsContext}).
2674
+ * The value `'application'` provides the full application contents context ({@link app.IApplicationContents}).
2675
+ *
2676
+ * @i2since 1.9
2677
+ */
2678
+ readonly type: TCommandType;
2679
+ /**
2680
+ * Invokes a callback when the group needs to be rendered in the user interface.
2681
+ *
2682
+ * @remarks
2683
+ * Receives a scoped {@link commands.IDynamicActionArea} for creating and surfacing commands.
2684
+ * Commands created in this callback are transient and exist only while the group is visible.
2685
+ * They are automatically unregistered when the group is removed from the surface.
2686
+ *
2687
+ * The `signal` parameter fires when the group is being removed, allowing you to cancel pending
2688
+ * async operations or clean up resources.
2689
+ *
2690
+ * @param commandArea - A scoped action area for creating and positioning commands within this group.
2691
+ * @param context - The context based on the group type, determined by {@link commands.CommandPayloadMap}.
2692
+ * @param signal - An `AbortSignal` that fires when the group is removed from the surface.
2693
+ * @returns An optional cleanup function that is called when the group is removed.
2694
+ * @i2since 1.9
2695
+ */
2696
+ onSurface(commandArea: IDynamicActionArea, context: CommandPayloadMap[TCommandType], signal: AbortSignal): void | (() => void);
2697
+ }
2698
+ /**
2699
+ * A scoped action area for creating and positioning commands within a dynamic group.
2700
+ *
2701
+ * @remarks
2702
+ * This interface is provided to the `onSurface` callback of {@link commands.IDynamicGroupConfig}.
2703
+ * It allows you to create commands and organize them within the dynamic group using positioning
2704
+ * methods like `before`, `after`, and `getGroup`.
2705
+ *
2706
+ * Commands created through this area are automatically cleaned up when the dynamic group is removed
2707
+ * from the surface.
2708
+ *
2709
+ * @i2since 1.9
2710
+ */
2711
+ export interface IDynamicActionArea extends Pick<ICommandApi, 'createCommand'> {
2712
+ /**
2713
+ * Locates the area of the user interface that appears immediately before a particular action or group of actions.
2714
+ *
2715
+ * @param idOrCommand - The identifier of the action or group to use as a reference, or a command object.
2716
+ * @returns An object that you can use to add actions or a group to the located area.
2717
+ * @i2since 1.9
2718
+ */
2719
+ before(idOrCommand: CommandId | GroupId | ICommand): IDynamicActionArea;
2720
+ /**
2721
+ * Locates the area of the user interface that appears immediately after a particular action or group of actions.
2722
+ *
2723
+ * @param idOrCommand - The identifier of the action or group to use as a reference, or a command object.
2724
+ * @returns An object that you can use to add actions or a group to the located area.
2725
+ * @i2since 1.9
2726
+ */
2727
+ after(idOrCommand: CommandId | GroupId | ICommand): IDynamicActionArea;
2728
+ /**
2729
+ * Locates the area of the user interface that is occupied by a particular group of actions.
2730
+ *
2731
+ * @param id - The identifier of the group to use as a reference.
2732
+ * @returns An action area representing the specified group.
2733
+ * @i2since 1.9
2734
+ */
2735
+ getGroup(id: GroupId): IDynamicActionArea;
2736
+ /**
2737
+ * Adds the specified group of actions to the user interface.
2738
+ *
2739
+ * @param group - The group to add.
2740
+ * @returns An object that you can use to add actions or a further group to the new group.
2741
+ * @i2since 1.9
2742
+ */
2743
+ addGroup(group: IGroup): IDynamicActionArea;
2744
+ /**
2745
+ * Adds the specified group of actions to the user interface, or gets an existing group with the same identifier.
2746
+ *
2747
+ * @param group - The group to add or get.
2748
+ * @returns An object that you can use to add actions or a further group to the new or existing group.
2749
+ * @i2since 1.9
2750
+ */
2751
+ addOrGetGroup(group: IGroup): IDynamicActionArea;
2752
+ /**
2753
+ * Adds actions for the specified registered commands to the user interface.
2754
+ *
2755
+ * @remarks
2756
+ * When you surface multiple commands, the actions are added to the user interface in the same order as you specify them.
2757
+ *
2758
+ * @param commandsOrCommandIds - The registered commands, or the identifiers of the commands, to surface.
2759
+ * @i2since 1.9
2760
+ */
2761
+ surfaceCommands(...commandsOrCommandIds: (ICommand | CommandId)[]): void;
2762
+ }
2422
2763
  /**
2423
2764
  * A representation of a command in the user interface. An action is created when a command is surfaced.
2424
2765
  * @i2since 1.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i2analyze/notebook-sdk",
3
- "version": "1.9.0-dev.1",
3
+ "version": "1.9.0-dev.3",
4
4
  "description": "i2 Notebook SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {