@masterportal/masterportalapi 2.37.0 → 2.38.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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
 
4
4
  The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
5
 
6
+ ## 2.38.0 - 2024-06-04
7
+
8
+ ### Added
9
+ - Added support for Node LTS version ^20.12.2 and npm Version ^10.5.0.
10
+
11
+ ### Changed
12
+ - The following packages have been updated:
13
+ - dependencies:
14
+ - ol: 9.1.0 to 9.2.4
15
+ - olcs: 2.19.3 to 2.20.0
16
+
17
+ ### Fixed
18
+ - The mitigation for issue 666 in ol-cesium since version 2.37.0 is removed
19
+ - Webgl: vectorTiles were not displayed.
20
+ - WMS-Layer: special loadFunction is only used if layer's attribute `isSecured` is true.
21
+
22
+ ---
23
+
6
24
  ## 2.37.0 - 2024-04-23
7
25
 
8
26
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@masterportal/masterportalapi",
3
3
  "author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
4
- "version": "2.37.0",
4
+ "version": "2.38.0",
5
5
  "license": "MIT",
6
6
  "description": "Basic functions of the Masterportal as api",
7
7
  "repository": {
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "core-js": "^3.33.1",
23
23
  "dayjs": "^1.11.10",
24
- "ol": "9.1.0",
24
+ "ol": "9.2.4",
25
25
  "ol-mapbox-style": "12.2.1",
26
- "olcs": "2.19.3",
26
+ "olcs": "2.20.0",
27
27
  "proj4": "^2.10.0",
28
28
  "xml2js": "^0.6.2"
29
29
  },
@@ -59,8 +59,8 @@
59
59
  "@cesium/engine": "^6.2.0"
60
60
  },
61
61
  "engines": {
62
- "node": "^16.13.2 || ^18.12.0 || ^20.9.0",
63
- "npm": "^8.1.2 || ^9.3.1 || ^10.1.0"
62
+ "node": "^16.13.2 || ^18.12.0 || ^20.12.2",
63
+ "npm": "^8.1.2 || ^9.3.1 || ^10.5.0"
64
64
  },
65
65
  "homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
66
66
  "directories": {
package/src/layer/wms.js CHANGED
@@ -77,13 +77,12 @@ export function makeParams (rawLayer) {
77
77
  }
78
78
 
79
79
  /**
80
- * Return a ol tile or image load function for the rawLayer.
81
- * @param {object} rawLayer - layer specification as in services.json
80
+ * Return a ol tile or image load function for the rawLayer. Fetches with credentials: 'include'.
82
81
  * @returns {function} tile/image load function
83
82
  */
84
- export function defaultLoadFunction ({isSecured}) {
83
+ export function loadFunctionWithCredentials () {
85
84
  return async (image, src) => {
86
- const response = await fetch(src, {credentials: isSecured ? "include" : "omit"}),
85
+ const response = await fetch(src, {credentials: "include"}),
87
86
  data = await response.blob();
88
87
 
89
88
  image.getImage().src = URL.createObjectURL(data);
@@ -100,7 +99,7 @@ export function defaultLoadFunction ({isSecured}) {
100
99
  * @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
101
100
  * @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
102
101
  * @param {string} [rawLayer.cqlFilter] - optional CQL filter to add to the request
103
- * @param {boolean} [rawLayer.isSecured] - whether the layer is secured by BasicAuth and should include or omit the credentials prompt
102
+ * @param {boolean} [rawLayer.isSecured] - if the layer is secured by BasicAuth, images are loaded with credentials: 'include'.
104
103
  * @param {object} options - optional resolutions and origin to create the TileGrid
105
104
  * @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
106
105
  * @param {Array} [options.origin] - optional origin to create the TileGrid
@@ -120,8 +119,8 @@ export function createLayerSource (rawLayer, options) {
120
119
  projection: projection,
121
120
  attributions: rawLayer.olAttribution,
122
121
  crossOrigin: rawLayer.crossOrigin,
123
- ...rawLayer.isSecured ? { // TODO: Remove this guard when olcs#666 is resolved
124
- imageLoadFunction: defaultLoadFunction(rawLayer)
122
+ ...rawLayer.isSecured ? {
123
+ imageLoadFunction: loadFunctionWithCredentials()
125
124
  } : {}
126
125
  });
127
126
  }
@@ -140,7 +139,9 @@ export function createLayerSource (rawLayer, options) {
140
139
  projection: projection,
141
140
  attributions: rawLayer.olAttribution,
142
141
  crossOrigin: rawLayer.crossOrigin,
143
- tileLoadFunction: defaultLoadFunction(rawLayer)
142
+ ...rawLayer.isSecured ? {
143
+ tileLoadFunction: loadFunctionWithCredentials()
144
+ } : {}
144
145
  });
145
146
  }
146
147
 
@@ -148,7 +148,8 @@ export function createMap (config = defaults, {mapParams, callback, errorCallbac
148
148
  crs.registerProjections(config.namedProjections);
149
149
  setBackgroundImage(config);
150
150
  setGazetteerUrl(config.gazetteerUrl);
151
- const selectedInteractions = config.mapInteractions?.interactionModes ? config.mapInteractions?.interactionModes : {dragPan: false, altShiftDragRotate: false, pinchRotate: false},
151
+
152
+ const selectedInteractions = Object.assign({}, {dragPan: false, altShiftDragRotate: false, pinchRotate: false}, config.mapInteractions?.interactionModes),
152
153
  map = new Map(Object.assign({
153
154
  target: config.target || defaults.target,
154
155
  interactions: olDefaultInteractions(selectedInteractions).extend([
@@ -157,7 +158,7 @@ export function createMap (config = defaults, {mapParams, callback, errorCallbac
157
158
  if (event.originalEvent.shiftKey) {
158
159
  return false;
159
160
  }
160
- return (!event.originalEvent.pointerType || event.originalEvent.pointerType === "mouse") || (config.twoFingerPan && this.getPointerCount() === 2) || !config.twoFingerPan;
161
+ return (!event.originalEvent.pointerType || event.originalEvent.pointerType === "mouse") || (config.mapInteractions?.interactionModes?.twoFingerPan && this.getPointerCount() === 2) || !config.mapInteractions?.interactionModes?.twoFingerPan;
161
162
  }
162
163
  })
163
164
  ]),
@@ -107,6 +107,7 @@ export function createVectorTileLayerRenderer () {
107
107
  fragment: result.builder.getSymbolFragmentShader(),
108
108
  vertex: result.builder.getSymbolVertexShader()
109
109
  },
110
+ builder: result.builder,
110
111
  attributes: {
111
112
  fillColor: {
112
113
  size: 2,
@@ -102,7 +102,7 @@ describe("wms.js", function () {
102
102
  });
103
103
  });
104
104
 
105
- describe("defaultLoadFunction", function () {
105
+ describe("loadFunctionWithCredentials", function () {
106
106
  beforeEach(() => {
107
107
  const blob = new Blob();
108
108
 
@@ -121,19 +121,12 @@ describe("wms.js", function () {
121
121
  });
122
122
 
123
123
  it("passes credentials if isSecured is set", async function () {
124
- const result = wms.defaultLoadFunction({isSecured: true}),
124
+ const result = wms.loadFunctionWithCredentials(),
125
125
  input = {src: ""};
126
126
 
127
127
  await result({getImage: () => input}, "SECURE_WMS");
128
128
  expect(input.src).toEqual("blob:BLOB");
129
129
  });
130
- it("does not pass credentials if isSecured is not set", async function () {
131
- const result = wms.defaultLoadFunction({isSecured: false}),
132
- input = {src: ""};
133
-
134
- await result({getImage: () => input}, "INSECURE_WMS");
135
- expect(input.src).toEqual("blob:BLOB");
136
- });
137
130
  });
138
131
 
139
132
  describe("createLayerSource", function () {