@disy/cadenza.js 10.4.3 → 10.4.4

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 (58) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/apidoc/assets/search.js +1 -1
  3. package/apidoc/classes/AbortError.html +3 -3
  4. package/apidoc/classes/CadenzaClient.html +22 -22
  5. package/apidoc/classes/CadenzaError.html +5 -5
  6. package/apidoc/functions/cadenza.html +4 -4
  7. package/apidoc/index.html +2 -2
  8. package/apidoc/interfaces/CadenzaClientOptions.html +7 -5
  9. package/apidoc/interfaces/CadenzaEvent.html +4 -4
  10. package/apidoc/interfaces/CommonEditGeometryOptions.html +11 -11
  11. package/apidoc/interfaces/Distance.html +2 -2
  12. package/apidoc/interfaces/ExternalLinkKey.html +4 -4
  13. package/apidoc/interfaces/Feature.html +9 -9
  14. package/apidoc/interfaces/FeatureCollection.html +4 -4
  15. package/apidoc/interfaces/Geometry.html +4 -4
  16. package/apidoc/interfaces/GeometryExtentStrategy.html +4 -4
  17. package/apidoc/interfaces/LayerDataExtentStrategy.html +4 -4
  18. package/apidoc/interfaces/LayerDefinition.html +4 -4
  19. package/apidoc/interfaces/LocationFinderExtentStrategy.html +4 -4
  20. package/apidoc/interfaces/PageSource.html +3 -3
  21. package/apidoc/interfaces/SnappingOptions.html +3 -3
  22. package/apidoc/interfaces/SpatialFilterValue.html +4 -4
  23. package/apidoc/interfaces/StaticExtentStrategy.html +4 -4
  24. package/apidoc/modules.html +1 -1
  25. package/apidoc/types/CadenzaActionEvent.html +2 -2
  26. package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
  27. package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
  28. package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
  29. package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
  30. package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
  31. package/apidoc/types/CadenzaErrorEvent.html +2 -2
  32. package/apidoc/types/CadenzaEventByType.html +1 -1
  33. package/apidoc/types/CadenzaEventType.html +2 -2
  34. package/apidoc/types/CadenzaObjectInfoEvent.html +2 -2
  35. package/apidoc/types/CadenzaReloadEvent.html +2 -2
  36. package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
  37. package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
  38. package/apidoc/types/Coordinate.html +2 -2
  39. package/apidoc/types/CustomValidityType.html +2 -2
  40. package/apidoc/types/DataType.html +2 -2
  41. package/apidoc/types/EmbeddingTargetId.html +2 -2
  42. package/apidoc/types/Extent.html +2 -2
  43. package/apidoc/types/ExtentStrategy.html +2 -2
  44. package/apidoc/types/FilterVariables.html +2 -2
  45. package/apidoc/types/GeometryType.html +2 -2
  46. package/apidoc/types/GlobalId.html +2 -2
  47. package/apidoc/types/Layout.html +2 -2
  48. package/apidoc/types/LengthUnit.html +1 -1
  49. package/apidoc/types/OpaqueString.html +2 -2
  50. package/apidoc/types/OperationMode.html +2 -2
  51. package/apidoc/types/Polygon.html +1 -1
  52. package/apidoc/types/SpatialRelation.html +2 -2
  53. package/apidoc/types/TablePart.html +2 -2
  54. package/apidoc/types/UiFeature.html +2 -2
  55. package/apidoc/types/WorkbookLayerPath.html +2 -2
  56. package/cadenza.d.ts +6 -1
  57. package/cadenza.js +104 -99
  58. package/package.json +1 -1
package/cadenza.js CHANGED
@@ -9,10 +9,11 @@
9
9
  * This is required if Cadenza and your application are not running on the same origin.
10
10
  * Please ensure that the user has view privilege for that link!
11
11
  * @property {boolean} [options.debug] - Whether to enable debug logging
12
+ * @property {boolean} [options.skipGuest] - Whether a configured guest authenticator should be ignored
12
13
  */
13
14
  // This placeholder is replaced when Cadenza JS is released,
14
15
  // i.e. during development, the version is not available.
15
- const CADENZAJS_VERSION = '10.4.3';
16
+ const CADENZAJS_VERSION = '10.4.4';
16
17
  /**
17
18
  * Creates an instance of the Cadenza JS client.
18
19
  *
@@ -253,6 +254,8 @@ export class CadenzaClient {
253
254
  #iframeElement;
254
255
  /** @readonly */
255
256
  #debug;
257
+ /** @readonly */
258
+ #skipGuest;
256
259
  /** @type {[ CadenzaEventType | string, (event: CadenzaEvent<never>) => void ][]} */
257
260
  #subscriptions = [];
258
261
  /**
@@ -260,7 +263,7 @@ export class CadenzaClient {
260
263
  * @hidden
261
264
  * @param {CadenzaClientOptions} [__namedParameters]
262
265
  */
263
- constructor({ baseUrl, debug = false, iframe, webApplication } = {}) {
266
+ constructor({ baseUrl, debug = false, skipGuest = false, iframe, webApplication, } = {}) {
264
267
  if (webApplication) {
265
268
  assert(validExternalLinkKey(webApplication), `Invalid webApplication parameter: ${webApplication}`);
266
269
  }
@@ -280,6 +283,7 @@ export class CadenzaClient {
280
283
  this.#log('Create Cadenza client for parent Cadenza');
281
284
  }
282
285
  this.#debug = debug;
286
+ this.#skipGuest = skipGuest;
283
287
  this.#webApplication = webApplication;
284
288
  }
285
289
  /** The base URL of the Cadenza server this client is requesting */
@@ -346,7 +350,7 @@ export class CadenzaClient {
346
350
  'page' in source &&
347
351
  source.page === 'welcome', 'labelSet is only supported on the welcome page');
348
352
  }
349
- const params = createParams({
353
+ const params = this.#createParams({
350
354
  dataType,
351
355
  disabledUiFeatures,
352
356
  expandNavigator,
@@ -414,7 +418,7 @@ export class CadenzaClient {
414
418
  extentStrategy,
415
419
  geometry,
416
420
  });
417
- const params = createParams({
421
+ const params = this.#createParams({
418
422
  disabledUiFeatures,
419
423
  expandNavigator,
420
424
  filter,
@@ -582,7 +586,7 @@ export class CadenzaClient {
582
586
  const validExtentStrategy = sanitizeExtentStrategy({
583
587
  extentStrategy,
584
588
  });
585
- const params = createParams({
589
+ const params = this.#createParams({
586
590
  action: 'editGeometry',
587
591
  disabledUiFeatures,
588
592
  filter,
@@ -622,7 +626,7 @@ export class CadenzaClient {
622
626
  extentStrategy,
623
627
  geometry,
624
628
  });
625
- const params = createParams({
629
+ const params = this.#createParams({
626
630
  action: 'editGeometry',
627
631
  disabledUiFeatures,
628
632
  filter,
@@ -661,7 +665,7 @@ export class CadenzaClient {
661
665
  const validExtentStrategy = sanitizeExtentStrategy({
662
666
  extentStrategy,
663
667
  });
664
- const params = createParams({
668
+ const params = this.#createParams({
665
669
  action: 'editGeometry',
666
670
  batchModeEnabled: true,
667
671
  disabledUiFeatures,
@@ -701,7 +705,7 @@ export class CadenzaClient {
701
705
  extentStrategy,
702
706
  geometry: features.features[features.features.length - 1].geometry,
703
707
  });
704
- const params = createParams({
708
+ const params = this.#createParams({
705
709
  action: 'editGeometry',
706
710
  batchModeEnabled: true,
707
711
  disabledUiFeatures,
@@ -790,7 +794,7 @@ export class CadenzaClient {
790
794
  const validExtentStrategy = sanitizeExtentStrategy({
791
795
  extentStrategy,
792
796
  });
793
- const params = createParams({
797
+ const params = this.#createParams({
794
798
  action: 'selectObjects',
795
799
  disabledUiFeatures,
796
800
  filter,
@@ -1006,7 +1010,7 @@ export class CadenzaClient {
1006
1010
  fetchData(source, dataType, { filter, parts, signal } = {}) {
1007
1011
  this.#log('CadenzaClient#fetchData', ...arguments);
1008
1012
  assertSupportedDataType(dataType, ['csv', 'excel', 'json', 'pdf']);
1009
- const params = createParams({ dataType, filter, parts });
1013
+ const params = this.#createParams({ dataType, filter, parts });
1010
1014
  return this.#fetch(resolvePath(source), params, signal);
1011
1015
  }
1012
1016
  /**
@@ -1026,7 +1030,7 @@ export class CadenzaClient {
1026
1030
  */
1027
1031
  fetchObjectInfo(source, layerPath, objectIds, { filter, signal, fullGeometries, useMapSrs } = {}) {
1028
1032
  this.#log('CadenzaClient#fetchObjectInfo', ...arguments);
1029
- const params = createParams({
1033
+ const params = this.#createParams({
1030
1034
  filter,
1031
1035
  });
1032
1036
  return this.#fetch(resolvePath(source) + '/objectinfo', params, signal, JSON.stringify({
@@ -1052,7 +1056,7 @@ export class CadenzaClient {
1052
1056
  */
1053
1057
  fetchAreaIntersections(source, layerPath, geometry, { buffer, signal, useMapSrs } = {}) {
1054
1058
  this.#log('CadenzaClient#areaIntersections', ...arguments);
1055
- const params = createParams({});
1059
+ const params = this.#createParams({});
1056
1060
  return this.#fetch(resolvePath(source) + '/area-intersections', params, signal, JSON.stringify({
1057
1061
  buffer,
1058
1062
  layerPath: array(layerPath),
@@ -1109,7 +1113,7 @@ export class CadenzaClient {
1109
1113
  downloadData(source, dataType, { fileName, filter, parts } = {}) {
1110
1114
  this.#log('CadenzaClient#downloadData', ...arguments);
1111
1115
  assertSupportedDataType(dataType, ['csv', 'excel', 'json', 'pdf']);
1112
- const params = createParams({ dataType, fileName, filter, parts });
1116
+ const params = this.#createParams({ dataType, fileName, filter, parts });
1113
1117
  this.#download(resolvePath(source), params);
1114
1118
  }
1115
1119
  #download(/** @type string */ path, /** @type URLSearchParams */ params) {
@@ -1133,6 +1137,93 @@ export class CadenzaClient {
1133
1137
  }
1134
1138
  return url;
1135
1139
  }
1140
+ /**
1141
+ * @param {object} params
1142
+ * @param {string} [params.action]
1143
+ * @param {boolean} [params.batchModeEnabled]
1144
+ * @param {DataType} [params.dataType]
1145
+ * @param {UiFeature[]} [params.disabledUiFeatures]
1146
+ * @param {boolean} [params.expandNavigator]
1147
+ * @param {string} [params.fileName]
1148
+ * @param {FilterVariables} [params.filter]
1149
+ * @param {GeometryType} [params.geometryType]
1150
+ * @param {boolean} [params.hideMainHeaderAndFooter]
1151
+ * @param {boolean} [params.hideWorkbookToolBar]
1152
+ * @param {GlobalId} [params.highlightGlobalId]
1153
+ * @param {string} [params.labelSet]
1154
+ * @param {WorkbookLayerPath[]} [params.layers]
1155
+ * @param {number} [params.minScale]
1156
+ * @param {OperationMode} [params.operationMode]
1157
+ * @param {TablePart[]} [params.parts]
1158
+ * @param {'MAP'} [params.targetType]
1159
+ * @param {SnappingOptions} [params.snapping]
1160
+ * @param {boolean} [params.useMapSrs]
1161
+ * @param {ExtentStrategy} [params.validExtentStrategy]
1162
+ * @param {Layout} [params.layout]
1163
+ * @return {URLSearchParams}
1164
+ */
1165
+ #createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
1166
+ if (disabledUiFeatures) {
1167
+ disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
1168
+ }
1169
+ if (filter) {
1170
+ assertValidFilterVariables(filter);
1171
+ }
1172
+ if (geometryType) {
1173
+ assertValidGeometryType(geometryType);
1174
+ }
1175
+ if (operationMode) {
1176
+ assert(validOperationMode(operationMode), `Invalid operation mode: ${operationMode}`);
1177
+ }
1178
+ if (layout) {
1179
+ assert(validLayout(layout), `Invalid layout: ${layout}`);
1180
+ }
1181
+ if (parts) {
1182
+ parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
1183
+ }
1184
+ let locationFinder;
1185
+ let mapExtent;
1186
+ if (validExtentStrategy) {
1187
+ if (validExtentStrategy.type === 'static') {
1188
+ mapExtent = validExtentStrategy.extent;
1189
+ }
1190
+ else if (validExtentStrategy.type === 'locationFinder') {
1191
+ locationFinder = validExtentStrategy.query;
1192
+ }
1193
+ }
1194
+ return new URLSearchParams({
1195
+ ...(action && { action }),
1196
+ ...(batchModeEnabled && { batchModeEnabled: 'true' }),
1197
+ ...(dataType && { dataType }),
1198
+ ...(disabledUiFeatures && {
1199
+ disabledUiFeatures: disabledUiFeatures.join(),
1200
+ }),
1201
+ ...(expandNavigator && { expandNavigator: 'true' }),
1202
+ ...(fileName && { fileName }),
1203
+ ...(filter &&
1204
+ Object.fromEntries(Object.entries(filter).map(([variable, value]) => [
1205
+ `filter.${variable}`,
1206
+ JSON.stringify(value instanceof Date ? value.toISOString() : value),
1207
+ ]))),
1208
+ ...(geometryType && { geometryType }),
1209
+ ...(hideMainHeaderAndFooter && { hideMainHeaderAndFooter: 'true' }),
1210
+ ...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
1211
+ ...(highlightGlobalId && { highlightGlobalId }),
1212
+ ...(labelSet && { labelSet }),
1213
+ ...(layers?.length && { layers: JSON.stringify(layers) }),
1214
+ ...(locationFinder && { locationFinder }),
1215
+ ...(mapExtent && { mapExtent: mapExtent.join() }),
1216
+ ...(minScale && { minScale: String(minScale) }),
1217
+ ...(operationMode && { operationMode }),
1218
+ ...(parts && { parts: parts.join() }),
1219
+ ...(snapping && { snappingLayer: JSON.stringify(array(snapping.layer)) }),
1220
+ ...(snapping?.types?.length && { snappingTypes: snapping.types.join() }),
1221
+ ...(targetType && { targetType }),
1222
+ ...(useMapSrs && { useMapSrs: 'true' }),
1223
+ ...(layout && { layout }),
1224
+ ...(this.#skipGuest && { skipGuestAccess: 'true' }),
1225
+ });
1226
+ }
1136
1227
  #log(/** @type unknown[] */ ...args) {
1137
1228
  if (this.#debug) {
1138
1229
  /** @type {unknown[]} */
@@ -1260,92 +1351,6 @@ function assertValidFilterVariables(/** @type {FilterVariables} */ filter) {
1260
1351
  validSpatialFilterValue(/** @type {SpatialFilterValue} */ ($spatial)), 'Invalid value for spatial filter value under $spatial property');
1261
1352
  Object.keys(otherFilter).forEach((varName) => assert(validKebabCaseString(varName), `Invalid filter variable name: ${varName}`));
1262
1353
  }
1263
- /**
1264
- * @param {object} params
1265
- * @param {string} [params.action]
1266
- * @param {boolean} [params.batchModeEnabled]
1267
- * @param {DataType} [params.dataType]
1268
- * @param {UiFeature[]} [params.disabledUiFeatures]
1269
- * @param {boolean} [params.expandNavigator]
1270
- * @param {string} [params.fileName]
1271
- * @param {FilterVariables} [params.filter]
1272
- * @param {GeometryType} [params.geometryType]
1273
- * @param {boolean} [params.hideMainHeaderAndFooter]
1274
- * @param {boolean} [params.hideWorkbookToolBar]
1275
- * @param {GlobalId} [params.highlightGlobalId]
1276
- * @param {string} [params.labelSet]
1277
- * @param {WorkbookLayerPath[]} [params.layers]
1278
- * @param {number} [params.minScale]
1279
- * @param {OperationMode} [params.operationMode]
1280
- * @param {TablePart[]} [params.parts]
1281
- * @param {'MAP'} [params.targetType]
1282
- * @param {SnappingOptions} [params.snapping]
1283
- * @param {boolean} [params.useMapSrs]
1284
- * @param {ExtentStrategy | undefined} [params.validExtentStrategy]
1285
- * @param {Layout | undefined} [params.layout]
1286
- * @return {URLSearchParams}
1287
- */
1288
- function createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
1289
- if (disabledUiFeatures) {
1290
- disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
1291
- }
1292
- if (filter) {
1293
- assertValidFilterVariables(filter);
1294
- }
1295
- if (geometryType) {
1296
- assertValidGeometryType(geometryType);
1297
- }
1298
- if (operationMode) {
1299
- assert(validOperationMode(operationMode), `Invalid operation mode: ${operationMode}`);
1300
- }
1301
- if (layout) {
1302
- assert(validLayout(layout), `Invalid layout: ${layout}`);
1303
- }
1304
- if (parts) {
1305
- parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
1306
- }
1307
- let locationFinder;
1308
- let mapExtent;
1309
- if (validExtentStrategy) {
1310
- if (validExtentStrategy.type === 'static') {
1311
- mapExtent = validExtentStrategy.extent;
1312
- }
1313
- else if (validExtentStrategy.type === 'locationFinder') {
1314
- locationFinder = validExtentStrategy.query;
1315
- }
1316
- }
1317
- return new URLSearchParams({
1318
- ...(action && { action }),
1319
- ...(batchModeEnabled && { batchModeEnabled: 'true' }),
1320
- ...(dataType && { dataType }),
1321
- ...(disabledUiFeatures && {
1322
- disabledUiFeatures: disabledUiFeatures.join(),
1323
- }),
1324
- ...(expandNavigator && { expandNavigator: 'true' }),
1325
- ...(fileName && { fileName }),
1326
- ...(filter &&
1327
- Object.fromEntries(Object.entries(filter).map(([variable, value]) => [
1328
- `filter.${variable}`,
1329
- JSON.stringify(value instanceof Date ? value.toISOString() : value),
1330
- ]))),
1331
- ...(geometryType && { geometryType }),
1332
- ...(hideMainHeaderAndFooter && { hideMainHeaderAndFooter: 'true' }),
1333
- ...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
1334
- ...(highlightGlobalId && { highlightGlobalId }),
1335
- ...(labelSet && { labelSet }),
1336
- ...(layers?.length && { layers: JSON.stringify(layers) }),
1337
- ...(locationFinder && { locationFinder }),
1338
- ...(mapExtent && { mapExtent: mapExtent.join() }),
1339
- ...(minScale && { minScale: String(minScale) }),
1340
- ...(operationMode && { operationMode }),
1341
- ...(parts && { parts: parts.join() }),
1342
- ...(snapping && { snappingLayer: JSON.stringify(array(snapping.layer)) }),
1343
- ...(snapping?.types?.length && { snappingTypes: snapping.types.join() }),
1344
- ...(targetType && { targetType }),
1345
- ...(useMapSrs && { useMapSrs: 'true' }),
1346
- ...(layout && { layout }),
1347
- });
1348
- }
1349
1354
  function array(/** @type unknown */ value) {
1350
1355
  return Array.isArray(value) ? value : [value];
1351
1356
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disy/cadenza.js",
3
- "version": "10.4.3",
3
+ "version": "10.4.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": "github:DisyInformationssysteme/cadenza.js",
6
6
  "type": "module",