@disy/cadenza.js 10.4.7 → 10.4.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/apidoc/assets/navigation.js +1 -1
  3. package/apidoc/assets/search.js +1 -1
  4. package/apidoc/classes/AbortError.html +3 -3
  5. package/apidoc/classes/CadenzaClient.html +63 -23
  6. package/apidoc/classes/CadenzaError.html +5 -5
  7. package/apidoc/functions/cadenza.html +4 -4
  8. package/apidoc/index.html +4 -4
  9. package/apidoc/interfaces/AreaIntersectionsResult.html +4 -4
  10. package/apidoc/interfaces/CadenzaClientOptions.html +6 -6
  11. package/apidoc/interfaces/CadenzaEvent.html +4 -4
  12. package/apidoc/interfaces/CommonEditGeometryOptions.html +11 -11
  13. package/apidoc/interfaces/Distance.html +2 -2
  14. package/apidoc/interfaces/ExternalLinkKey.html +4 -4
  15. package/apidoc/interfaces/Feature.html +9 -9
  16. package/apidoc/interfaces/FeatureCollection.html +4 -4
  17. package/apidoc/interfaces/Geometry.html +4 -4
  18. package/apidoc/interfaces/GeometryExtentStrategy.html +4 -4
  19. package/apidoc/interfaces/LayerDataExtentStrategy.html +4 -4
  20. package/apidoc/interfaces/LayerDefinition.html +4 -4
  21. package/apidoc/interfaces/LocationFinderExtentStrategy.html +4 -4
  22. package/apidoc/interfaces/PageSource.html +3 -3
  23. package/apidoc/interfaces/ProblemDetails.html +6 -6
  24. package/apidoc/interfaces/SnappingOptions.html +3 -3
  25. package/apidoc/interfaces/SpatialFilterValue.html +4 -4
  26. package/apidoc/interfaces/StaticExtentStrategy.html +4 -4
  27. package/apidoc/modules.html +1 -1
  28. package/apidoc/types/CadenzaActionEvent.html +2 -2
  29. package/apidoc/types/CadenzaChangeExtentEvent.html +3 -0
  30. package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
  31. package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
  32. package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
  33. package/apidoc/types/CadenzaEditGeometryCreateEvent.html +2 -2
  34. package/apidoc/types/CadenzaEditGeometryDeleteEvent.html +2 -2
  35. package/apidoc/types/CadenzaEditGeometryEditEvent.html +2 -2
  36. package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
  37. package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
  38. package/apidoc/types/CadenzaErrorEvent.html +2 -2
  39. package/apidoc/types/CadenzaEventByType.html +1 -1
  40. package/apidoc/types/CadenzaEventType.html +2 -2
  41. package/apidoc/types/CadenzaReloadEvent.html +2 -2
  42. package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
  43. package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
  44. package/apidoc/types/Coordinate.html +2 -2
  45. package/apidoc/types/CustomValidityType.html +2 -2
  46. package/apidoc/types/DataType.html +2 -2
  47. package/apidoc/types/EmbeddingTargetId.html +2 -2
  48. package/apidoc/types/Extent.html +2 -2
  49. package/apidoc/types/ExtentStrategy.html +2 -2
  50. package/apidoc/types/FilterVariables.html +2 -2
  51. package/apidoc/types/GeometryType.html +2 -2
  52. package/apidoc/types/GlobalId.html +2 -2
  53. package/apidoc/types/Layout.html +2 -2
  54. package/apidoc/types/LengthUnit.html +1 -1
  55. package/apidoc/types/OpaqueString.html +2 -2
  56. package/apidoc/types/OperationMode.html +2 -2
  57. package/apidoc/types/Polygon.html +1 -1
  58. package/apidoc/types/SpatialRelation.html +2 -2
  59. package/apidoc/types/TablePart.html +2 -2
  60. package/apidoc/types/UiFeature.html +2 -2
  61. package/apidoc/types/WorkbookLayerPath.html +2 -2
  62. package/cadenza.d.ts +27 -9
  63. package/cadenza.js +64 -15
  64. package/package.json +1 -1
package/cadenza.d.ts CHANGED
@@ -119,6 +119,8 @@ export class CadenzaClient {
119
119
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
120
120
  * @throws For invalid arguments
121
121
  * @fires
122
+ * - {@link CadenzaChangeExtentEvent}
123
+ * - {@link CadenzaChangeSelectionEvent}
122
124
  * - {@link CadenzaDrillThroughEvent}
123
125
  * - {@link CadenzaActionEvent}
124
126
  * @embed
@@ -166,7 +168,6 @@ export class CadenzaClient {
166
168
  /**
167
169
  * Set filter variables in the currently shown workbook.
168
170
  *
169
- * @hidden
170
171
  * @param {FilterVariables} filter - The variable values
171
172
  * @return {Promise<void>} A `Promise` for when the filter variables were set.
172
173
  * @postMessage
@@ -178,7 +179,6 @@ export class CadenzaClient {
178
179
  * When making a layer visible, its ancestors will be made visible, too.
179
180
  * When hiding a layer, the ancestors are not affected.
180
181
  *
181
- * @hidden
182
182
  * @param {WorkbookLayerPath | string} layer - The layer to show or hide
183
183
  * (identified using a layer path or a print name)
184
184
  * @param {boolean} visible - The visibility state of the layer
@@ -189,7 +189,6 @@ export class CadenzaClient {
189
189
  /**
190
190
  * Set the selection in the currently shown workbook map view.
191
191
  *
192
- * @hidden
193
192
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
194
193
  * @param {unknown[][]} values - The IDs of the objects to select
195
194
  * @param {object} [__namedParameters]
@@ -203,7 +202,6 @@ export class CadenzaClient {
203
202
  /**
204
203
  * Add to the selection in the currently shown workbook map view.
205
204
  *
206
- * @hidden
207
205
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
208
206
  * @param {unknown[][]} values - The IDs of the objects to select
209
207
  * @param {object} [__namedParameters]
@@ -217,7 +215,6 @@ export class CadenzaClient {
217
215
  /**
218
216
  * Remove from the selection in the currently shown workbook map view.
219
217
  *
220
- * @hidden
221
218
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
222
219
  * @param {unknown[][]} values - The IDs of the objects to unselect
223
220
  * @param {object} [__namedParameters]
@@ -239,6 +236,8 @@ export class CadenzaClient {
239
236
  * @param {CommonEditGeometryOptions} [editGeometryOptions] - Options for the initialization of the geometry editor.
240
237
  * @throws For invalid arguments
241
238
  * @fires
239
+ * - {@link CadenzaChangeExtentEvent}
240
+ * - {@link CadenzaChangeSelectionEvent}
242
241
  * - {@link CadenzaEditGeometryUpdateEvent}
243
242
  * - {@link CadenzaEditGeometryOkEvent}
244
243
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -254,6 +253,8 @@ export class CadenzaClient {
254
253
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
255
254
  * @throws For invalid arguments
256
255
  * @fires
256
+ * - {@link CadenzaChangeExtentEvent}
257
+ * - {@link CadenzaChangeSelectionEvent}
257
258
  * - {@link CadenzaEditGeometryUpdateEvent}
258
259
  * - {@link CadenzaEditGeometryOkEvent}
259
260
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -269,6 +270,8 @@ export class CadenzaClient {
269
270
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
270
271
  * @throws For invalid arguments
271
272
  * @fires
273
+ * - {@link CadenzaChangeExtentEvent}
274
+ * - {@link CadenzaChangeSelectionEvent}
272
275
  * - {@link CadenzaEditGeometryUpdateEvent}
273
276
  * - {@link CadenzaEditGeometryOkEvent}
274
277
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -287,6 +290,8 @@ export class CadenzaClient {
287
290
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
288
291
  * @throws For invalid arguments
289
292
  * @fires
293
+ * - {@link CadenzaChangeExtentEvent}
294
+ * - {@link CadenzaChangeSelectionEvent}
290
295
  * - {@link CadenzaEditGeometryUpdateEvent}
291
296
  * - {@link CadenzaEditGeometryOkEvent}
292
297
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -442,6 +447,7 @@ export class CadenzaClient {
442
447
  }
443
448
  /**
444
449
  * @typedef {'action'
450
+ * | 'change:extent'
445
451
  * | 'change:selection'
446
452
  * | 'drillThrough'
447
453
  * | 'editGeometry:ok'
@@ -458,6 +464,7 @@ export class CadenzaClient {
458
464
  /**
459
465
  * @template {CadenzaEventType} T
460
466
  * @typedef {T extends 'action' ? CadenzaActionEvent
467
+ * : T extends 'change:extent' ? CadenzaChangeExtentEvent
461
468
  * : T extends 'change:selection' ? CadenzaChangeSelectionEvent
462
469
  * : T extends 'drillThrough' ? CadenzaDrillThroughEvent
463
470
  * : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
@@ -482,6 +489,10 @@ export class CadenzaClient {
482
489
  /**
483
490
  * @typedef {CadenzaEvent<'action', {context: string}>} CadenzaActionEvent - When the user executed a POST message action, which is defined on an external link in the Cadenza management center.
484
491
  */
492
+ /**
493
+ * @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map.
494
+ * The extent is transformed according to the `useMapSrs` option.
495
+ */
485
496
  /**
486
497
  * @typedef {CadenzaEvent<'change:selection', undefined | {layer: WorkbookLayerPath, values: unknown[][]}>} CadenzaChangeSelectionEvent - When the user changed the selection. `undefined` if no objects were selected.
487
498
  *
@@ -500,7 +511,7 @@ export class CadenzaClient {
500
511
  /** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
501
512
  /** @typedef {CadenzaEvent<'editGeometry:create', FeatureCollection | Feature>} CadenzaEditGeometryCreateEvent - Whenever new geometry features were created. `Feature` if only one feature was created. Only available in batch mode */
502
513
  /** @typedef {CadenzaEvent<'editGeometry:edit', Feature>} CadenzaEditGeometryEditEvent - Whenever a geometry feature was edited. Only available in batch mode */
503
- /** @typedef {CadenzaEvent<'editGeometry:delete', {featureIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
514
+ /** @typedef {CadenzaEvent<'editGeometry:delete', {objectIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
504
515
  /** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
505
516
  /** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
506
517
  /**
@@ -928,8 +939,8 @@ export type Layout = 'dashboard' | 'linear';
928
939
  /**
929
940
  * - An event type to subscribe to using {@link CadenzaClienton }
930
941
  */
931
- export type CadenzaEventType = 'action' | 'change:selection' | 'drillThrough' | 'editGeometry:ok' | 'editGeometry:create' | 'editGeometry:edit' | 'editGeometry:delete' | 'editGeometry:update' | 'editGeometry:cancel' | 'reload' | 'selectObjects:ok' | 'selectObjects:cancel';
932
- export type CadenzaEventByType<T extends CadenzaEventType> = T extends 'action' ? CadenzaActionEvent : T extends 'change:selection' ? CadenzaChangeSelectionEvent : T extends 'drillThrough' ? CadenzaDrillThroughEvent : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent : T extends 'editGeometry:create' ? CadenzaEditGeometryCreateEvent : T extends 'editGeometry:edit' ? CadenzaEditGeometryEditEvent : T extends 'editGeometry:delete' ? CadenzaEditGeometryDeleteEvent : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent : T extends 'reload' ? CadenzaReloadEvent : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent : never;
942
+ export type CadenzaEventType = 'action' | 'change:extent' | 'change:selection' | 'drillThrough' | 'editGeometry:ok' | 'editGeometry:create' | 'editGeometry:edit' | 'editGeometry:delete' | 'editGeometry:update' | 'editGeometry:cancel' | 'reload' | 'selectObjects:ok' | 'selectObjects:cancel';
943
+ export type CadenzaEventByType<T extends CadenzaEventType> = T extends 'action' ? CadenzaActionEvent : T extends 'change:extent' ? CadenzaChangeExtentEvent : T extends 'change:selection' ? CadenzaChangeSelectionEvent : T extends 'drillThrough' ? CadenzaDrillThroughEvent : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent : T extends 'editGeometry:create' ? CadenzaEditGeometryCreateEvent : T extends 'editGeometry:edit' ? CadenzaEditGeometryEditEvent : T extends 'editGeometry:delete' ? CadenzaEditGeometryDeleteEvent : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent : T extends 'reload' ? CadenzaReloadEvent : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent : never;
933
944
  /**
934
945
  * - A Cadenza `postMessage()` event
935
946
  */
@@ -949,6 +960,13 @@ export type CadenzaEvent<TYPE extends string, DETAIL = unknown> = {
949
960
  export type CadenzaActionEvent = CadenzaEvent<'action', {
950
961
  context: string;
951
962
  }>;
963
+ /**
964
+ * - When the user moved the map.
965
+ * The extent is transformed according to the `useMapSrs` option.
966
+ */
967
+ export type CadenzaChangeExtentEvent = CadenzaEvent<'change:extent', {
968
+ extent: [number, number, number, number];
969
+ }>;
952
970
  /**
953
971
  * - When the user changed the selection. `undefined` if no objects were selected.
954
972
  *
@@ -991,7 +1009,7 @@ export type CadenzaEditGeometryEditEvent = CadenzaEvent<'editGeometry:edit', Fea
991
1009
  * - Whenever geometry features were deleted. Only available in batch mode
992
1010
  */
993
1011
  export type CadenzaEditGeometryDeleteEvent = CadenzaEvent<'editGeometry:delete', {
994
- featureIds: any[][];
1012
+ objectIds: any[][];
995
1013
  }>;
996
1014
  /**
997
1015
  * - When the user cancelled the geometry editing.
package/cadenza.js CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
  // This placeholder is replaced when Cadenza JS is released,
20
20
  // i.e. during development, the version is not available.
21
- const CADENZAJS_VERSION = '10.4.7';
21
+ const CADENZAJS_VERSION = '10.4.9';
22
22
  /**
23
23
  * Creates an instance of the Cadenza JS client.
24
24
  *
@@ -422,6 +422,8 @@ export class CadenzaClient {
422
422
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
423
423
  * @throws For invalid arguments
424
424
  * @fires
425
+ * - {@link CadenzaChangeExtentEvent}
426
+ * - {@link CadenzaChangeSelectionEvent}
425
427
  * - {@link CadenzaDrillThroughEvent}
426
428
  * - {@link CadenzaActionEvent}
427
429
  * @embed
@@ -492,7 +494,6 @@ export class CadenzaClient {
492
494
  /**
493
495
  * Set filter variables in the currently shown workbook.
494
496
  *
495
- * @hidden
496
497
  * @param {FilterVariables} filter - The variable values
497
498
  * @return {Promise<void>} A `Promise` for when the filter variables were set.
498
499
  * @postMessage
@@ -508,7 +509,6 @@ export class CadenzaClient {
508
509
  * When making a layer visible, its ancestors will be made visible, too.
509
510
  * When hiding a layer, the ancestors are not affected.
510
511
  *
511
- * @hidden
512
512
  * @param {WorkbookLayerPath | string} layer - The layer to show or hide
513
513
  * (identified using a layer path or a print name)
514
514
  * @param {boolean} visible - The visibility state of the layer
@@ -525,7 +525,6 @@ export class CadenzaClient {
525
525
  /**
526
526
  * Set the selection in the currently shown workbook map view.
527
527
  *
528
- * @hidden
529
528
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
530
529
  * @param {unknown[][]} values - The IDs of the objects to select
531
530
  * @param {object} [__namedParameters]
@@ -545,7 +544,6 @@ export class CadenzaClient {
545
544
  /**
546
545
  * Add to the selection in the currently shown workbook map view.
547
546
  *
548
- * @hidden
549
547
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
550
548
  * @param {unknown[][]} values - The IDs of the objects to select
551
549
  * @param {object} [__namedParameters]
@@ -565,7 +563,6 @@ export class CadenzaClient {
565
563
  /**
566
564
  * Remove from the selection in the currently shown workbook map view.
567
565
  *
568
- * @hidden
569
566
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
570
567
  * @param {unknown[][]} values - The IDs of the objects to unselect
571
568
  * @param {object} [__namedParameters]
@@ -593,6 +590,8 @@ export class CadenzaClient {
593
590
  * @param {CommonEditGeometryOptions} [editGeometryOptions] - Options for the initialization of the geometry editor.
594
591
  * @throws For invalid arguments
595
592
  * @fires
593
+ * - {@link CadenzaChangeExtentEvent}
594
+ * - {@link CadenzaChangeSelectionEvent}
596
595
  * - {@link CadenzaEditGeometryUpdateEvent}
597
596
  * - {@link CadenzaEditGeometryOkEvent}
598
597
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -630,6 +629,8 @@ export class CadenzaClient {
630
629
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
631
630
  * @throws For invalid arguments
632
631
  * @fires
632
+ * - {@link CadenzaChangeExtentEvent}
633
+ * - {@link CadenzaChangeSelectionEvent}
633
634
  * - {@link CadenzaEditGeometryUpdateEvent}
634
635
  * - {@link CadenzaEditGeometryOkEvent}
635
636
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -671,6 +672,8 @@ export class CadenzaClient {
671
672
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
672
673
  * @throws For invalid arguments
673
674
  * @fires
675
+ * - {@link CadenzaChangeExtentEvent}
676
+ * - {@link CadenzaChangeSelectionEvent}
674
677
  * - {@link CadenzaEditGeometryUpdateEvent}
675
678
  * - {@link CadenzaEditGeometryOkEvent}
676
679
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -713,6 +716,8 @@ export class CadenzaClient {
713
716
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
714
717
  * @throws For invalid arguments
715
718
  * @fires
719
+ * - {@link CadenzaChangeExtentEvent}
720
+ * - {@link CadenzaChangeSelectionEvent}
716
721
  * - {@link CadenzaEditGeometryUpdateEvent}
717
722
  * - {@link CadenzaEditGeometryOkEvent}
718
723
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -744,8 +749,8 @@ export class CadenzaClient {
744
749
  await this.#setupEditorViaPostRequests({
745
750
  additionalLayers,
746
751
  validExtentStrategy,
747
- features,
748
752
  });
753
+ await this.#createFeaturesAndEditLastCreatedFeature(features);
749
754
  await this.#setEditorStateToReady();
750
755
  }
751
756
  /**
@@ -753,10 +758,9 @@ export class CadenzaClient {
753
758
  * @param [__namedParameters.geometry] {Geometry} - The geometry to edit
754
759
  * @param [__namedParameters.additionalLayers] {LayerDefinition[]} - Layer definitions to be imported and shown in the background, as a basis for the drawing. IMPORTANT: The Cadenza referenced with `cadenzaClient` must be configured to support the import of GeoJSON, and the (system) privileges of the corresponding user must also be set in such a way that the import of GeoJSON is possible.
755
760
  * @param [__namedParameters.validExtentStrategy] {ExtentStrategy} - Defines the initial map extent; If not given, Cadenza's default logic is used.
756
- * @param [__namedParameters.features] {FeatureCollection} - The features to edit. The last feature in this collection is directly set up for editing.
757
761
  * @returns {Promise<Awaited<unknown>[]>}
758
762
  */
759
- #setupEditorViaPostRequests({ geometry, additionalLayers, validExtentStrategy, features, }) {
763
+ #setupEditorViaPostRequests({ geometry, additionalLayers, validExtentStrategy, }) {
760
764
  const postRequests = [];
761
765
  postRequests.push(this.#setExtentStrategy(validExtentStrategy));
762
766
  if (geometry) {
@@ -769,11 +773,41 @@ export class CadenzaClient {
769
773
  postRequests.push(this.#postRequest('importLayer', layer));
770
774
  }
771
775
  }
772
- if (features) {
773
- postRequests.push(this.#postRequest('addFeatures', features));
774
- }
775
776
  return Promise.all(postRequests);
776
777
  }
778
+ /**
779
+ * @param {FeatureCollection} features - The features to edit.
780
+ */
781
+ async #createFeaturesAndEditLastCreatedFeature(features) {
782
+ const editFeaturePromise = new Promise((resolve) => {
783
+ this.#once('editGeometry:create',
784
+ /** @param {CadenzaEditGeometryCreateEvent} event */ async (event) => {
785
+ const featureOrCollection = event.detail;
786
+ let lastAddedFeature;
787
+ if (featureOrCollection.type === 'Feature') {
788
+ lastAddedFeature = featureOrCollection;
789
+ }
790
+ else {
791
+ const addedFeatures = featureOrCollection.features;
792
+ lastAddedFeature = addedFeatures[addedFeatures.length - 1];
793
+ }
794
+ await this.#setEditFeature(lastAddedFeature.objectId);
795
+ resolve(undefined);
796
+ });
797
+ });
798
+ await this.#postRequest('createFeatures', features);
799
+ return editFeaturePromise;
800
+ }
801
+ /**
802
+ * Send a request to the geometry editor to edit the feature with the given ID.
803
+ * If another feature is currently being edited or created,
804
+ * the user is prompted to save (if possible), discard the current changes, or to abort the request.
805
+ *
806
+ * @param {any[]} objectId - The id of the feature
807
+ */
808
+ #setEditFeature(objectId) {
809
+ return this.#postRequest('requestEditFeature', objectId);
810
+ }
777
811
  #setEditorStateToReady() {
778
812
  return this.#postRequest('setEditorState', 'READY');
779
813
  }
@@ -948,6 +982,20 @@ export class CadenzaClient {
948
982
  }
949
983
  };
950
984
  }
985
+ /**
986
+ * @template {CadenzaEventType | string} TYPE
987
+ * @template [DETAIL=unknown]
988
+ * @param {TYPE} type
989
+ * @param {(event: CadenzaEvent<TYPE, DETAIL>) => void} subscriber
990
+ * @return {() => void} An unsubscribe function
991
+ */
992
+ #once(type, subscriber) {
993
+ const unsubscribe = this.#on(type, (event) => {
994
+ subscriber(/** @type {CadenzaEvent<TYPE, DETAIL>} */ (event));
995
+ unsubscribe();
996
+ });
997
+ return unsubscribe;
998
+ }
951
999
  // Use arrow function so that it's bound to this.
952
1000
  #onMessage = (
953
1001
  /** @type MessageEvent<CadenzaEvent<never, never>> */ event) => {
@@ -1447,6 +1495,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1447
1495
  // Please do not add internal event types like 'ready' here.
1448
1496
  /**
1449
1497
  * @typedef {'action'
1498
+ * | 'change:extent'
1450
1499
  * | 'change:selection'
1451
1500
  * | 'drillThrough'
1452
1501
  * | 'editGeometry:ok'
@@ -1463,6 +1512,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1463
1512
  /**
1464
1513
  * @template {CadenzaEventType} T
1465
1514
  * @typedef {T extends 'action' ? CadenzaActionEvent
1515
+ * : T extends 'change:extent' ? CadenzaChangeExtentEvent
1466
1516
  * : T extends 'change:selection' ? CadenzaChangeSelectionEvent
1467
1517
  * : T extends 'drillThrough' ? CadenzaDrillThroughEvent
1468
1518
  * : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
@@ -1487,8 +1537,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1487
1537
  /**
1488
1538
  * @typedef {CadenzaEvent<'action', {context: string}>} CadenzaActionEvent - When the user executed a POST message action, which is defined on an external link in the Cadenza management center.
1489
1539
  */
1490
- /*
1491
- * @hidden
1540
+ /**
1492
1541
  * @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map.
1493
1542
  * The extent is transformed according to the `useMapSrs` option.
1494
1543
  */
@@ -1510,7 +1559,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1510
1559
  /** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
1511
1560
  /** @typedef {CadenzaEvent<'editGeometry:create', FeatureCollection | Feature>} CadenzaEditGeometryCreateEvent - Whenever new geometry features were created. `Feature` if only one feature was created. Only available in batch mode */
1512
1561
  /** @typedef {CadenzaEvent<'editGeometry:edit', Feature>} CadenzaEditGeometryEditEvent - Whenever a geometry feature was edited. Only available in batch mode */
1513
- /** @typedef {CadenzaEvent<'editGeometry:delete', {featureIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
1562
+ /** @typedef {CadenzaEvent<'editGeometry:delete', {objectIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
1514
1563
  /** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
1515
1564
  /** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
1516
1565
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disy/cadenza.js",
3
- "version": "10.4.7",
3
+ "version": "10.4.9",
4
4
  "license": "Apache-2.0",
5
5
  "repository": "github:DisyInformationssysteme/cadenza.js",
6
6
  "type": "module",