@i2analyze/notebook-sdk 1.1.0-dev.29 → 1.1.0-dev.31

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,34 @@
1
1
  # @i2analyze/notebook-sdk
2
2
 
3
+ ## 1.1.0-dev.31
4
+
5
+ ### Minor Changes
6
+
7
+ - Deprecated `toolview.SerializableValue` which will be removed in the future. Usages have been replaced with the type `unknown` to make it easier to get and set values within the volatile store.
8
+
9
+ E.g.
10
+
11
+ ```ts
12
+ interface IData {
13
+ someString: string;
14
+ someNumber: number;
15
+ someOptionalBoolean?: boolean;
16
+ }
17
+ let toolView: toolview.IToolView = getToolView();
18
+
19
+ // Getting a value of type IData.
20
+ const myData = toolView.volatileStore.get<IData>('myKey');
21
+
22
+ // Setting a value of type IData.
23
+ toolView.volatileStore.set('myKey', myData);
24
+ ```
25
+
26
+ ## 1.1.0-dev.30
27
+
28
+ ### Minor Changes
29
+
30
+ - Update edit record API.
31
+
3
32
  ## 1.1.0-dev.29
4
33
 
5
34
  ### Minor Changes
@@ -72,25 +72,24 @@ export declare namespace app {
72
72
  *
73
73
  * @remarks
74
74
  * A mutation is an operation that can read or modify the contents of the application.
75
- * A successful set of tracked mutations is added as a single entry to the undo stack.
75
+ * A successful set of _tracked_ mutations is added as a single entry to the undo stack.
76
76
  *
77
77
  * @param mutationHandler - A function that performs one or more tracked mutations and reports on their success as a whole.
78
78
  * @param options - An object that can control the transaction.
79
- * @returns A promise that is fulfilled if the work completes successfully, or rejected if there is a problem performing it.
80
79
  * @i2since 1.1
81
80
  */
82
81
  runTrackedMutations(mutationHandler: TrackedMutationHandler, options?: ITransactionOptions): void;
83
82
  /**
84
- * Queues a function that performs tracked mutations on the application contents at the next available opportunity.
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
85
  *
86
86
  * @remarks
87
87
  * A mutation is an operation that can read or modify the contents of the application.
88
- * A successful set of tracked mutations is added as a single entry to the undo stack.
88
+ * A successful set of _tracked_ mutations is added as a single entry to the undo stack.
89
89
  *
90
90
  * @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 produced by the mutation.
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
- * @returns A promise that is fulfilled if the work completes successfully, or rejected if there is a problem performing it.
94
93
  * @i2since 1.1
95
94
  */
96
95
  runTrackedMutations(mutationHandler: TrackedMutationHandler, responseHandler?: MutationResponseHandler, options?: ITransactionOptions): void;
@@ -99,7 +98,7 @@ export declare namespace app {
99
98
  *
100
99
  * @remarks
101
100
  * A mutation is an operation that can read or modify the contents of the application.
102
- * Untracked mutations are not added to the undo stack, and therefore cannot be undone.
101
+ * _Untracked_ mutations are not added to the undo stack, and therefore cannot be undone.
103
102
  *
104
103
  * @param mutationHandler - A function that performs one or more untracked mutations and reports on their success as a whole.
105
104
  * @param options - An object that can control the transaction.
@@ -107,14 +106,15 @@ export declare namespace app {
107
106
  */
108
107
  runUntrackedMutations(mutationHandler: UntrackedMutationHandler, options?: ITransactionOptions): void;
109
108
  /**
110
- * Queues a function that performs untracked mutations on the application contents at the next available opportunity.
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
111
  *
112
112
  * @remarks
113
113
  * A mutation is an operation that can read or modify the contents of the application.
114
- * Untracked mutations are not added to the undo stack, and therefore cannot be undone.
114
+ * _Untracked_ mutations are not added to the undo stack, and therefore cannot be undone.
115
115
  *
116
116
  * @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 mutation.
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
  */
@@ -250,8 +250,8 @@ export declare namespace app {
250
250
  /**
251
251
  * A function that receives the results of a mutation.
252
252
  *
253
- * @param error - The error thrown if a mutation failed or was aborted.
254
- * @param result - The results of the mutation.
253
+ * @param error - The `Error` that was thrown if the mutation failed or was aborted.
254
+ * @param result - An `IMutationResult` that contains the results of the mutation.
255
255
  * @param application - The contents of the application after the mutation was performed.
256
256
  * @i2since 1.1
257
257
  */
@@ -262,7 +262,7 @@ export declare namespace app {
262
262
  */
263
263
  export interface IMutationResult {
264
264
  /**
265
- * Gets the changes that were the result of a mutation .
265
+ * Gets the changes that were caused by the mutation.
266
266
  * @i2since 1.1
267
267
  */
268
268
  change: chart.IChartChange;
@@ -332,6 +332,16 @@ export declare namespace app {
332
332
  * @i2since 1.1
333
333
  */
334
334
  export type ElementSpecifier = visual.ElementId | visual.IElement;
335
+ /**
336
+ * A common specifier for a note, for use in mutation APIs.
337
+ * @i2since 1.1
338
+ */
339
+ export type NoteSpecifier = records.NoteId | records.INote;
340
+ /**
341
+ * A common specifier for a source reference, for use in mutation APIs.
342
+ * @i2since 1.1
343
+ */
344
+ export type SourceReferenceSpecifier = records.SourceReferenceId | records.ISourceReference;
335
345
  /**
336
346
  * The identifier of a record group.
337
347
  * @i2since 1.1
@@ -353,6 +363,11 @@ export declare namespace app {
353
363
  * @i2since 1.1
354
364
  */
355
365
  export type RecordPropertiesSpecifier = Record<schema.ChartPropertyTypeId, data.PropertyValue> | Iterable<[schema.PropertyTypeSpecifier, data.PropertyValue]>;
366
+ /**
367
+ * A common specifier for editing record properties, for use in mutation APIs.
368
+ * @i2since 1.1
369
+ */
370
+ export type EditRecordPropertiesSpecifier = Record<schema.ChartPropertyTypeId, data.PropertyValue | null> | Iterable<[schema.PropertyTypeSpecifier, data.PropertyValue | null]>;
356
371
  /**
357
372
  * A set of data that is common to creating records of all types.
358
373
  * @i2since 1.1
@@ -458,57 +473,65 @@ export declare namespace app {
458
473
  * @returns This record, with the new properties in place.
459
474
  * @i2since 1.1
460
475
  */
461
- setProperties(properties: RecordPropertiesSpecifier): this;
476
+ setProperties(properties: EditRecordPropertiesSpecifier): this;
462
477
  /**
463
478
  * Adds a new note to the record.
464
479
  *
465
- * @param note - The data for the new note.
480
+ * @param noteData - The data for the new note.
466
481
  * @returns This record, with the new note in place.
467
482
  * @i2since 1.1
468
483
  */
469
- addNote(note: records.INoteData): this;
484
+ addNote(noteData: records.INoteData): this;
470
485
  /**
471
486
  * Replaces an existing note on the record with a new one.
472
487
  *
473
- * @param id - The identifier of the note to replace.
474
- * @param note - The data for the new note.
488
+ * @param note - The note to replace.
489
+ * @param noteData - The data for the new note.
475
490
  * @returns This record, with the new note in place.
476
491
  * @i2since 1.1
477
492
  */
478
- replaceNote(id: records.NoteId, note: records.INoteData): this;
493
+ replaceNote(note: NoteSpecifier, noteData: records.INoteData): this;
479
494
  /**
480
495
  * Removes a note from the record.
481
496
  *
482
- * @param id - The identifier of the note to remove.
497
+ * @param note - The note to remove.
483
498
  * @returns This record, without the note.
484
499
  * @i2since 1.1
485
500
  */
486
- removeNote(id: records.NoteId): this;
501
+ removeNote(note: NoteSpecifier): this;
487
502
  /**
488
503
  * Adds a new source reference to the record.
489
504
  *
490
- * @param ref - The data for the new source reference.
505
+ * @param refData - The data for the new source reference.
491
506
  * @returns This record, with the new source reference in place.
492
507
  * @i2since 1.1
493
508
  */
494
- addSourceReference(ref: records.ISourceReferenceData): this;
509
+ addSourceReference(refData: records.ISourceReferenceData): this;
495
510
  /**
496
511
  * Replaces an existing source reference on the record with a new one.
497
512
  *
498
- * @param id - The identifier of the source reference to replace.
499
- * @param ref - The data for the new source reference.
513
+ * @param ref - The source reference to replace.
514
+ * @param refData - The data for the new source reference.
500
515
  * @returns This record, with the new source reference in place.
501
516
  * @i2since 1.1
502
517
  */
503
- replaceSourceReference(id: records.SourceReferenceId, ref: records.ISourceReferenceData): this;
518
+ replaceSourceReference(ref: SourceReferenceSpecifier, refData: records.ISourceReferenceData): this;
504
519
  /**
505
520
  * Removes a source reference from the record.
506
521
  *
507
- * @param id - The identifier of the source reference to remove.
522
+ * @param ref - The source reference to remove.
508
523
  * @returns This record, without the source reference.
509
524
  * @i2since 1.1
510
525
  */
511
- removeSourceReference(id: records.SourceReferenceId): this;
526
+ removeSourceReference(ref: SourceReferenceSpecifier): this;
527
+ /**
528
+ * Adds a source identifier to the record.
529
+ *
530
+ * @param identifierData - The data for the new source identifier.
531
+ * @returns This record, with the new source identifier in place.
532
+ * @i2since 1.1
533
+ */
534
+ addSourceIdentifier(identifierData: records.ISourceIdentifierData): this;
512
535
  /**
513
536
  * Replaces the record's security settings with a new set.
514
537
  * @param security - The new security settings.
@@ -516,6 +539,17 @@ export declare namespace app {
516
539
  * @i2since 1.1
517
540
  */
518
541
  replaceSecurity(security: readonly records.ISecuritySetting[] | data.IKeyedReadOnlyCollection<schema.SecurityDimensionId, records.ISecuritySetting>): this;
542
+ /**
543
+ * Sets the link direction on the record.
544
+ *
545
+ * @remarks
546
+ * Calling this method on a entity record will throw an error.
547
+ *
548
+ * @param linkDirection - The link direction to set.
549
+ * @returns This record, with the new link direction in place.
550
+ * @i2since 1.1
551
+ */
552
+ setLinkDirection(linkDirection: data.LinkDirection): this;
519
553
  }
520
554
  /**
521
555
  * A record that has been created in a transaction handler, but has not yet been added to a chart.
@@ -3919,6 +3953,7 @@ export declare namespace toolview {
3919
3953
  * @remarks
3920
3954
  * Serializable values are constrained to the logical types that are listed in the definition.
3921
3955
  * @i2since 1.0
3956
+ * @deprecated toolview.SerializableValue is no longer used as usages have been replaced with 'unknown'
3922
3957
  */
3923
3958
  export type SerializableValue = string | number | boolean | null | BigInt | Date | SerializableValue[] | {
3924
3959
  [key: string]: SerializableValue;
@@ -3955,7 +3990,7 @@ export declare namespace toolview {
3955
3990
  * @returns The stored value, or `undefined` if the key does not exist in the store.
3956
3991
  * @i2since 1.0
3957
3992
  */
3958
- get<TValue extends SerializableValue>(key: string): TValue | undefined;
3993
+ get<TValue = unknown>(key: string): TValue | undefined;
3959
3994
  /**
3960
3995
  * Creates or updates a key in the volatile store.
3961
3996
  *
@@ -3963,7 +3998,7 @@ export declare namespace toolview {
3963
3998
  * @param value - The new value for the key.
3964
3999
  * @i2since 1.0
3965
4000
  */
3966
- set(key: string, value: SerializableValue): void;
4001
+ set(key: string, value: unknown): void;
3967
4002
  /**
3968
4003
  * Deletes a key from the volatile store.
3969
4004
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i2analyze/notebook-sdk",
3
- "version": "1.1.0-dev.29",
3
+ "version": "1.1.0-dev.31",
4
4
  "description": "i2 Notebook SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {