@i2analyze/notebook-sdk 1.3.0-dev.9 → 1.4.0-dev.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/README.md +2 -1
- package/lib/gen/notebook-sdk-public.d.ts +247 -17
- package/lib/index.js +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,10 +8,11 @@ This npm package provides the JavaScript library for developing plug-ins and a t
|
|
|
8
8
|
|
|
9
9
|
| `@i2analyze/notebook-sdk` version | i2 Analyze version |
|
|
10
10
|
| --------------------------------- | ------------------ |
|
|
11
|
+
| 1.3.\* | 4.4.2.0 |
|
|
11
12
|
| 1.2.\* | 4.4.1.0 |
|
|
12
13
|
| 1.1.\* | 4.4.0.0 |
|
|
13
14
|
| 1.0.\* | 4.3.4.0 |
|
|
14
15
|
|
|
15
16
|
## Documentation
|
|
16
17
|
|
|
17
|
-
For more details, see the documentation at https://i2group.github.io/notebook-sdk
|
|
18
|
+
For more details, see the documentation at [https://i2group.github.io/notebook-sdk](https://i2group.github.io/notebook-sdk/).
|
|
@@ -53,10 +53,10 @@ export declare namespace app {
|
|
|
53
53
|
* The list is sorted in ascending order of {@link data.ITimeZone.rawUtcOffset}, and then alphabetically
|
|
54
54
|
* by {@link data.ITimeZone.fullDisplayName} if UTC offsets are equal. For example:
|
|
55
55
|
* ```text
|
|
56
|
-
* (GMT-08:00)
|
|
57
|
-
* (GMT-01:00)
|
|
58
|
-
* (GMT)
|
|
59
|
-
* (GMT+01:00)
|
|
56
|
+
* (GMT-08:00) Los Angeles Time
|
|
57
|
+
* (GMT-01:00) Azores Time [Atlantic/Azores]
|
|
58
|
+
* (GMT) United Kingdom Time [Europe/London]
|
|
59
|
+
* (GMT+01:00)Austria Time
|
|
60
60
|
* (GMT+01:00) Belgium Time
|
|
61
61
|
* ```
|
|
62
62
|
* @i2since 1.0
|
|
@@ -68,57 +68,62 @@ export declare namespace app {
|
|
|
68
68
|
*/
|
|
69
69
|
readonly serverComponents: IServerComponents;
|
|
70
70
|
/**
|
|
71
|
-
* Queues a function that performs tracked mutations on the application contents at the next available opportunity
|
|
71
|
+
* Queues a function that performs tracked mutations on the application contents at the next available opportunity,
|
|
72
|
+
* and can respond to the changes that the mutations cause.
|
|
72
73
|
*
|
|
73
74
|
* @remarks
|
|
74
75
|
* A mutation is an operation that can read or modify the contents of the application.
|
|
75
76
|
* A successful set of _tracked_ mutations is added as a single entry to the undo stack.
|
|
76
77
|
*
|
|
77
78
|
* @param mutationHandler - A function that performs one or more tracked mutations and reports on their success as a whole.
|
|
79
|
+
* @param responseHandler - A callback that receives the changes caused by the mutations.
|
|
78
80
|
* @param options - An object that can control the transaction.
|
|
79
81
|
* @i2since 1.1
|
|
80
82
|
*/
|
|
81
|
-
runTrackedMutations(mutationHandler: TrackedMutationHandler, options?: ITransactionOptions): void;
|
|
83
|
+
runTrackedMutations(mutationHandler: TrackedMutationHandler, responseHandler?: MutationResponseHandler, options?: ITransactionOptions): void;
|
|
82
84
|
/**
|
|
83
|
-
* Queues a function that performs tracked mutations on the application contents at the next available opportunity
|
|
84
|
-
* and can respond to the changes that the mutations cause.
|
|
85
|
+
* Queues a function that performs tracked mutations on the application contents at the next available opportunity.
|
|
85
86
|
*
|
|
86
87
|
* @remarks
|
|
87
88
|
* A mutation is an operation that can read or modify the contents of the application.
|
|
88
89
|
* A successful set of _tracked_ mutations is added as a single entry to the undo stack.
|
|
89
90
|
*
|
|
90
91
|
* @param mutationHandler - A function that performs one or more tracked mutations and reports on their success as a whole.
|
|
91
|
-
* @param responseHandler - A callback that receives the changes caused by the mutations.
|
|
92
92
|
* @param options - An object that can control the transaction.
|
|
93
93
|
* @i2since 1.1
|
|
94
94
|
*/
|
|
95
|
-
runTrackedMutations(mutationHandler: TrackedMutationHandler,
|
|
95
|
+
runTrackedMutations(mutationHandler: TrackedMutationHandler, options?: ITransactionOptions): void;
|
|
96
96
|
/**
|
|
97
|
-
* Queues a function that performs untracked mutations on the application contents at the next available opportunity
|
|
97
|
+
* Queues a function that performs untracked mutations on the application contents at the next available opportunity,
|
|
98
|
+
* and can respond to the changes that the mutations cause.
|
|
98
99
|
*
|
|
99
100
|
* @remarks
|
|
100
101
|
* A mutation is an operation that can read or modify the contents of the application.
|
|
101
102
|
* _Untracked_ mutations are not added to the undo stack, and therefore cannot be undone.
|
|
102
103
|
*
|
|
103
104
|
* @param mutationHandler - A function that performs one or more untracked mutations and reports on their success as a whole.
|
|
105
|
+
* @param responseHandler - A callback that receives the changes produced by the mutations.
|
|
104
106
|
* @param options - An object that can control the transaction.
|
|
105
107
|
* @i2since 1.1
|
|
106
108
|
*/
|
|
107
|
-
runUntrackedMutations(mutationHandler: UntrackedMutationHandler, options?: ITransactionOptions): void;
|
|
109
|
+
runUntrackedMutations(mutationHandler: UntrackedMutationHandler, responseHandler?: MutationResponseHandler, options?: ITransactionOptions): void;
|
|
108
110
|
/**
|
|
109
|
-
* Queues a function that performs untracked mutations on the application contents at the next available opportunity
|
|
110
|
-
* and can respond to the changes that the mutations cause.
|
|
111
|
+
* Queues a function that performs untracked mutations on the application contents at the next available opportunity.
|
|
111
112
|
*
|
|
112
113
|
* @remarks
|
|
113
114
|
* A mutation is an operation that can read or modify the contents of the application.
|
|
114
115
|
* _Untracked_ mutations are not added to the undo stack, and therefore cannot be undone.
|
|
115
116
|
*
|
|
116
117
|
* @param mutationHandler - A function that performs one or more untracked mutations and reports on their success as a whole.
|
|
117
|
-
* @param responseHandler - A callback that receives the changes produced by the mutations.
|
|
118
118
|
* @param options - An object that can control the transaction.
|
|
119
119
|
* @i2since 1.1
|
|
120
120
|
*/
|
|
121
|
-
runUntrackedMutations(mutationHandler: UntrackedMutationHandler,
|
|
121
|
+
runUntrackedMutations(mutationHandler: UntrackedMutationHandler, options?: ITransactionOptions): void;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the command identifiers of the default system dialog actions.
|
|
124
|
+
* @i2since 1.4
|
|
125
|
+
*/
|
|
126
|
+
readonly systemActions: dialog.ISystemDialogActions;
|
|
122
127
|
}
|
|
123
128
|
/**
|
|
124
129
|
* A report on the result of one or more mutations.
|
|
@@ -2270,6 +2275,16 @@ export declare namespace commands {
|
|
|
2270
2275
|
* @i2since 1.3
|
|
2271
2276
|
*/
|
|
2272
2277
|
readonly toggleLists: CommandId;
|
|
2278
|
+
/**
|
|
2279
|
+
* Gets the identifier of the "Export to PDF" system command.
|
|
2280
|
+
* @i2since 1.3
|
|
2281
|
+
*/
|
|
2282
|
+
readonly exportPdf: CommandId;
|
|
2283
|
+
/**
|
|
2284
|
+
* Gets the identifier of the system command that allows users to share records with each other.
|
|
2285
|
+
* @i2since 1.3
|
|
2286
|
+
*/
|
|
2287
|
+
readonly shareRecords: CommandId;
|
|
2273
2288
|
}
|
|
2274
2289
|
/**
|
|
2275
2290
|
* A lookup table for the identifiers of the system action groups in the Home tab.
|
|
@@ -2959,6 +2974,200 @@ export declare namespace data {
|
|
|
2959
2974
|
}
|
|
2960
2975
|
}
|
|
2961
2976
|
|
|
2977
|
+
/**
|
|
2978
|
+
* The members of the `dialog` namespace enable you to open the dialog over the application that you write for your plug-ins with the i2 Notebook application.
|
|
2979
|
+
*
|
|
2980
|
+
* @public
|
|
2981
|
+
* @i2since 1.4
|
|
2982
|
+
*/
|
|
2983
|
+
export declare namespace dialog {
|
|
2984
|
+
/**
|
|
2985
|
+
* The size of the dialog.
|
|
2986
|
+
* @i2since 1.4
|
|
2987
|
+
*/
|
|
2988
|
+
export type DialogSize = 'small' | 'medium' | 'large';
|
|
2989
|
+
/**
|
|
2990
|
+
* An identifier of dialog action.
|
|
2991
|
+
* @i2since 1.4
|
|
2992
|
+
*/
|
|
2993
|
+
export type DialogActionId = string;
|
|
2994
|
+
/**
|
|
2995
|
+
* A set of information to create dialog action button.
|
|
2996
|
+
* @i2since 1.4
|
|
2997
|
+
*/
|
|
2998
|
+
export interface IDialogAction {
|
|
2999
|
+
/**
|
|
3000
|
+
* Indicates the visibility state of the action button.
|
|
3001
|
+
* @i2since 1.4
|
|
3002
|
+
*/
|
|
3003
|
+
enabled?: boolean;
|
|
3004
|
+
/**
|
|
3005
|
+
* Gets the value to show in the action button.
|
|
3006
|
+
* @i2since 1.4
|
|
3007
|
+
*/
|
|
3008
|
+
label?: string;
|
|
3009
|
+
}
|
|
3010
|
+
/**
|
|
3011
|
+
* A Basic set of information to create dialog action button.
|
|
3012
|
+
* @i2since 1.4
|
|
3013
|
+
*/
|
|
3014
|
+
export interface IDialogActionConfig extends IDialogAction {
|
|
3015
|
+
/**
|
|
3016
|
+
* Gets the identifier of the dialog action.
|
|
3017
|
+
* @i2since 1.4
|
|
3018
|
+
*/
|
|
3019
|
+
readonly id: DialogActionId;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* A set of information for creating a dialog.
|
|
3023
|
+
*
|
|
3024
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3025
|
+
* @i2since 1.4
|
|
3026
|
+
*/
|
|
3027
|
+
export interface IDialogConfig<TInitialize> {
|
|
3028
|
+
/**
|
|
3029
|
+
* Gets the title of the dialog, which appears as a heading in the user interface.
|
|
3030
|
+
* @i2since 1.4
|
|
3031
|
+
*/
|
|
3032
|
+
readonly name: string;
|
|
3033
|
+
/**
|
|
3034
|
+
* Gets the path to the content to host the dialog content, relative to the plug-in entry point.
|
|
3035
|
+
*
|
|
3036
|
+
* @remarks
|
|
3037
|
+
* For example, if `path` is '`./`', then the server uses the folder that contains the entry point.
|
|
3038
|
+
* @i2since 1.4
|
|
3039
|
+
*/
|
|
3040
|
+
readonly path: string;
|
|
3041
|
+
/**
|
|
3042
|
+
* Gets the size of the dialog.
|
|
3043
|
+
* @i2since 1.4
|
|
3044
|
+
*/
|
|
3045
|
+
readonly size: DialogSize;
|
|
3046
|
+
/**
|
|
3047
|
+
* Gets the information that required to create the dialog content.
|
|
3048
|
+
*
|
|
3049
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3050
|
+
* @i2since 1.4
|
|
3051
|
+
*/
|
|
3052
|
+
readonly initialValue?: TInitialize;
|
|
3053
|
+
/**
|
|
3054
|
+
* Gets the information to show the button like OK, Cancel.
|
|
3055
|
+
*
|
|
3056
|
+
* @i2since 1.4
|
|
3057
|
+
*/
|
|
3058
|
+
readonly actions: (IDialogActionConfig | DialogActionId)[];
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* A collection of methods and properties that allow plug-in dialog to interact with i2 Notebook.
|
|
3062
|
+
*
|
|
3063
|
+
* @i2since 1.4
|
|
3064
|
+
*/
|
|
3065
|
+
export interface IDialogApi extends app.IApplication {
|
|
3066
|
+
/**
|
|
3067
|
+
* Updates the dialog action buttons it could be label or visibility.
|
|
3068
|
+
*
|
|
3069
|
+
* @param id - An id of action which needs to be updated.
|
|
3070
|
+
* @param action - An updated action.
|
|
3071
|
+
* @i2since 1.4
|
|
3072
|
+
*/
|
|
3073
|
+
updateAction(id: DialogActionId, action: IDialogAction): void;
|
|
3074
|
+
/**
|
|
3075
|
+
* Submits the committed value and close the dialog.
|
|
3076
|
+
*
|
|
3077
|
+
* @param value - A value that is committed/expected when the dialog is closed.
|
|
3078
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
3079
|
+
* @i2since 1.4
|
|
3080
|
+
*/
|
|
3081
|
+
submitAndClose<TResult>(value: TResult): void;
|
|
3082
|
+
/**
|
|
3083
|
+
* Closes the dialog.
|
|
3084
|
+
*
|
|
3085
|
+
* @i2since 1.4
|
|
3086
|
+
*/
|
|
3087
|
+
close(): void;
|
|
3088
|
+
/**
|
|
3089
|
+
* Gets the information that required to create the dialog content.
|
|
3090
|
+
*
|
|
3091
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3092
|
+
* @returns A value to populate the dialog content.
|
|
3093
|
+
* @i2since 1.4
|
|
3094
|
+
*/
|
|
3095
|
+
getInitiaValue<TInitialize>(): TInitialize;
|
|
3096
|
+
/**
|
|
3097
|
+
* Adds a listener for events that might affect the dialog.
|
|
3098
|
+
*
|
|
3099
|
+
* @param type - The type of event to subscribe to.
|
|
3100
|
+
* @param listener - A function to handle the event.
|
|
3101
|
+
* @typeParam K - The type of event to subscribe to.
|
|
3102
|
+
* @returns A function that can be called to remove the listener.
|
|
3103
|
+
* @i2since 1.4
|
|
3104
|
+
*/
|
|
3105
|
+
addEventListener<K extends keyof DialogEventMap>(type: K, listener: DialogEventMap[K]): () => void;
|
|
3106
|
+
/**
|
|
3107
|
+
* Removes a listener for events that might affect the dialog.
|
|
3108
|
+
*
|
|
3109
|
+
* @param type - The type of event to unsubscribe from.
|
|
3110
|
+
* @param listener - A function that was previously added as a listener.
|
|
3111
|
+
* @typeParam K - The type of event to unsubscribe from.
|
|
3112
|
+
* @i2since 1.4
|
|
3113
|
+
*/
|
|
3114
|
+
removeEventListener<K extends keyof DialogEventMap>(type: K, listener: DialogEventMap[K]): void;
|
|
3115
|
+
}
|
|
3116
|
+
/**
|
|
3117
|
+
* A mapping of dialog event types to their listener types.
|
|
3118
|
+
* @i2since 1.0
|
|
3119
|
+
*/
|
|
3120
|
+
export interface DialogEventMap extends app.ApplicationEventMap {
|
|
3121
|
+
/**
|
|
3122
|
+
* Gets the type of the callback method that listens for "action" events.
|
|
3123
|
+
* @i2since 1.4
|
|
3124
|
+
*/
|
|
3125
|
+
readonly action: DialogActionListener;
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* A callback function that handles dialog action button events.
|
|
3129
|
+
*
|
|
3130
|
+
* @remarks
|
|
3131
|
+
* Typically, this listener receieves an event after action button is clicked.
|
|
3132
|
+
*
|
|
3133
|
+
* @param actionId - An identifier of the action button which is clicked
|
|
3134
|
+
* @i2since 1.4
|
|
3135
|
+
*/
|
|
3136
|
+
export type DialogActionListener = (actionId: DialogActionId) => void;
|
|
3137
|
+
/**
|
|
3138
|
+
* A lookup table for the dialog action identifiers of the default actions.
|
|
3139
|
+
* @i2since 1.4
|
|
3140
|
+
*/
|
|
3141
|
+
export interface ISystemDialogActions {
|
|
3142
|
+
/**
|
|
3143
|
+
* Gets the identifier of the "submit" action.
|
|
3144
|
+
* @i2since 1.4
|
|
3145
|
+
*/
|
|
3146
|
+
submit: DialogActionId;
|
|
3147
|
+
/**
|
|
3148
|
+
* Gets the identifier of the "cancel" action.
|
|
3149
|
+
* @i2since 1.4
|
|
3150
|
+
*/
|
|
3151
|
+
cancel: DialogActionId;
|
|
3152
|
+
/**
|
|
3153
|
+
* Gets the identifier of the "close" action.
|
|
3154
|
+
* @i2since 1.4
|
|
3155
|
+
*/
|
|
3156
|
+
close: DialogActionId;
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
/**
|
|
3161
|
+
* Retrieves the plug-in dialog API.
|
|
3162
|
+
*
|
|
3163
|
+
* @returns A promise that resolves to the dialog API.
|
|
3164
|
+
* @throws `Error` (through the promise) if the version of the SDK was incompatible with the deployed version of i2 Notebook.
|
|
3165
|
+
*
|
|
3166
|
+
* @public
|
|
3167
|
+
* @i2since 1.4
|
|
3168
|
+
*/
|
|
3169
|
+
export declare function getDialogApi(): Promise<dialog.IDialogApi>;
|
|
3170
|
+
|
|
2962
3171
|
/**
|
|
2963
3172
|
* Retrieves the plug-in entry point API.
|
|
2964
3173
|
*
|
|
@@ -3015,6 +3224,7 @@ export declare interface IEntryPointApi extends app.IApplication {
|
|
|
3015
3224
|
* For example, setting `path` to '`./`' makes the server use the folder that contains the entry point.
|
|
3016
3225
|
* @returns The new tool view.
|
|
3017
3226
|
* @i2since 1.0
|
|
3227
|
+
* @deprecated since version 1.3. Use {@link (IEntryPointApi:interface).(createToolView:2)} instead.
|
|
3018
3228
|
*/
|
|
3019
3229
|
createToolView(name: string, path: string): toolview.IToolView;
|
|
3020
3230
|
/**
|
|
@@ -3025,6 +3235,16 @@ export declare interface IEntryPointApi extends app.IApplication {
|
|
|
3025
3235
|
* @i2since 1.3
|
|
3026
3236
|
*/
|
|
3027
3237
|
createToolView(config: toolview.IToolViewConfig): toolview.IToolView;
|
|
3238
|
+
/**
|
|
3239
|
+
* Opens a dialog with specified configuration.
|
|
3240
|
+
*
|
|
3241
|
+
* @param config - The information to create a modal dialog.
|
|
3242
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
3243
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3244
|
+
* @returns The value submitted from the dialog.
|
|
3245
|
+
* @i2since 1.4
|
|
3246
|
+
*/
|
|
3247
|
+
showDialog<TResult, TInitialize>(config: dialog.IDialogConfig<TInitialize>): Promise<TResult>;
|
|
3028
3248
|
/**
|
|
3029
3249
|
* Gets the core API for custom commands.
|
|
3030
3250
|
* @i2since 1.0
|
|
@@ -4202,7 +4422,7 @@ export declare namespace toolview {
|
|
|
4202
4422
|
* @i2since 1.0
|
|
4203
4423
|
* @deprecated `toolview.SerializableValue` is no longer used. Replace any existing use with `unknown`.
|
|
4204
4424
|
*/
|
|
4205
|
-
export type SerializableValue = string | number | boolean | null |
|
|
4425
|
+
export type SerializableValue = string | number | boolean | null | bigint | Date | SerializableValue[] | {
|
|
4206
4426
|
[key: string]: SerializableValue;
|
|
4207
4427
|
};
|
|
4208
4428
|
/**
|
|
@@ -4353,6 +4573,16 @@ export declare namespace toolview {
|
|
|
4353
4573
|
* @i2since 1.0
|
|
4354
4574
|
*/
|
|
4355
4575
|
removeEventListener<K extends keyof ToolViewApiEventMap>(type: K, listener: ToolViewApiEventMap[K]): void;
|
|
4576
|
+
/**
|
|
4577
|
+
* Opens a dialog with specified configuration.
|
|
4578
|
+
*
|
|
4579
|
+
* @param config - The information to create a modal dialog.
|
|
4580
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
4581
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
4582
|
+
* @returns The value submitted from the dialog.
|
|
4583
|
+
* @i2since 1.4
|
|
4584
|
+
*/
|
|
4585
|
+
showDialog<TResult, TInitialize>(config: dialog.IDialogConfig<TInitialize>): Promise<TResult>;
|
|
4356
4586
|
}
|
|
4357
4587
|
/**
|
|
4358
4588
|
* A mapping of tool view event types to their listener types.
|
package/lib/index.js
CHANGED
|
@@ -39,3 +39,27 @@ export function getToolViewApi() {
|
|
|
39
39
|
scan();
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
//TODO: DOCs REVIEW
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves the plug-in dialog API.
|
|
45
|
+
*
|
|
46
|
+
* @returns A promise that resolves to the dialog API.
|
|
47
|
+
* @throws `Error` (through the promise) if the version of the SDK was incompatible with the deployed version of i2 Notebook.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @i2since 1.4
|
|
51
|
+
*/
|
|
52
|
+
export function getDialogApi() {
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
function scan() {
|
|
55
|
+
const api = window._i2GetPluginDialogApi;
|
|
56
|
+
if (api) {
|
|
57
|
+
clearInterval(handle);
|
|
58
|
+
const result = api(apiVersion);
|
|
59
|
+
resolve(result);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const handle = setInterval(scan, 50);
|
|
63
|
+
scan();
|
|
64
|
+
});
|
|
65
|
+
}
|