@opengeoweb/api 17.0.0 → 17.1.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.
Files changed (3) hide show
  1. package/package.json +25 -10
  2. package/index.d.ts +0 -1
  3. package/index.esm.js +0 -767
package/package.json CHANGED
@@ -1,23 +1,38 @@
1
1
  {
2
2
  "name": "@opengeoweb/api",
3
- "version": "17.0.0",
3
+ "version": "17.1.0",
4
4
  "description": "GeoWeb API library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
+ "main": "./dist/index.esm.js",
11
+ "module": "./dist/index.esm.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ "./package.json": "./package.json",
15
+ ".": {
16
+ "@opengeoweb/source": "./src/index.ts",
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.esm.js",
19
+ "default": "./dist/index.esm.js"
20
+ }
21
+ },
10
22
  "dependencies": {
11
- "@opengeoweb/authentication": "17.0.0",
12
- "@opengeoweb/store": "17.0.0",
13
- "lodash": "^4.17.21",
23
+ "@opengeoweb/authentication": "*",
24
+ "@opengeoweb/store": "*",
25
+ "lodash": "^4.18.1",
14
26
  "@tanstack/react-query": "^5.85.5",
15
27
  "@tanstack/query-core": "^5.79.0",
16
- "react": "^18.3.1",
17
28
  "@tanstack/react-query-devtools": "5.90.2"
18
29
  },
19
- "module": "./index.esm.js",
20
- "type": "module",
21
- "main": "./index.esm.js",
22
- "types": "./index.d.ts"
23
- }
30
+ "peerDependencies": {
31
+ "react": "18"
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md",
36
+ "package.json"
37
+ ]
38
+ }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
package/index.esm.js DELETED
@@ -1,767 +0,0 @@
1
- import { useAuthenticationContext } from '@opengeoweb/authentication';
2
- export * from '@opengeoweb/authentication';
3
- import { useQuery, QueryClientProvider } from '@tanstack/react-query';
4
- import { omit } from 'lodash';
5
- import { HttpResponse, delay } from 'msw';
6
- import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
7
- import React from 'react';
8
- import { QueryClient, keepPreviousData } from '@tanstack/query-core';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
-
11
- function _OverloadYield(e, d) {
12
- this.v = e, this.k = d;
13
- }
14
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
15
- try {
16
- var i = n[a](c),
17
- u = i.value;
18
- } catch (n) {
19
- return void e(n);
20
- }
21
- i.done ? t(u) : Promise.resolve(u).then(r, o);
22
- }
23
- function _asyncToGenerator(n) {
24
- return function () {
25
- var t = this,
26
- e = arguments;
27
- return new Promise(function (r, o) {
28
- var a = n.apply(t, e);
29
- function _next(n) {
30
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
31
- }
32
- function _throw(n) {
33
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
34
- }
35
- _next(void 0);
36
- });
37
- };
38
- }
39
- function _regenerator() {
40
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
41
- var e,
42
- t,
43
- r = "function" == typeof Symbol ? Symbol : {},
44
- n = r.iterator || "@@iterator",
45
- o = r.toStringTag || "@@toStringTag";
46
- function i(r, n, o, i) {
47
- var c = n && n.prototype instanceof Generator ? n : Generator,
48
- u = Object.create(c.prototype);
49
- return _regeneratorDefine(u, "_invoke", function (r, n, o) {
50
- var i,
51
- c,
52
- u,
53
- f = 0,
54
- p = o || [],
55
- y = false,
56
- G = {
57
- p: 0,
58
- n: 0,
59
- v: e,
60
- a: d,
61
- f: d.bind(e, 4),
62
- d: function (t, r) {
63
- return i = t, c = 0, u = e, G.n = r, a;
64
- }
65
- };
66
- function d(r, n) {
67
- for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
68
- var o,
69
- i = p[t],
70
- d = G.p,
71
- l = i[2];
72
- r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
73
- }
74
- if (o || r > 1) return a;
75
- throw y = true, n;
76
- }
77
- return function (o, p, l) {
78
- if (f > 1) throw TypeError("Generator is already running");
79
- for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
80
- i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
81
- try {
82
- if (f = 2, i) {
83
- if (c || (o = "next"), t = i[o]) {
84
- if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
85
- if (!t.done) return t;
86
- u = t.value, c < 2 && (c = 0);
87
- } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
88
- i = e;
89
- } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
90
- } catch (t) {
91
- i = e, c = 1, u = t;
92
- } finally {
93
- f = 1;
94
- }
95
- }
96
- return {
97
- value: t,
98
- done: y
99
- };
100
- };
101
- }(r, o, i), true), u;
102
- }
103
- var a = {};
104
- function Generator() {}
105
- function GeneratorFunction() {}
106
- function GeneratorFunctionPrototype() {}
107
- t = Object.getPrototypeOf;
108
- var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
109
- return this;
110
- }), t),
111
- u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
112
- function f(e) {
113
- return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
114
- }
115
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
116
- return this;
117
- }), _regeneratorDefine(u, "toString", function () {
118
- return "[object Generator]";
119
- }), (_regenerator = function () {
120
- return {
121
- w: i,
122
- m: f
123
- };
124
- })();
125
- }
126
- function _regeneratorAsync(n, e, r, t, o) {
127
- var a = _regeneratorAsyncGen(n, e, r, t, o);
128
- return a.next().then(function (n) {
129
- return n.done ? n.value : a.next();
130
- });
131
- }
132
- function _regeneratorAsyncGen(r, e, t, o, n) {
133
- return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
134
- }
135
- function _regeneratorAsyncIterator(t, e) {
136
- function n(r, o, i, f) {
137
- try {
138
- var c = t[r](o),
139
- u = c.value;
140
- return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
141
- n("next", t, i, f);
142
- }, function (t) {
143
- n("throw", t, i, f);
144
- }) : e.resolve(u).then(function (t) {
145
- c.value = t, i(c);
146
- }, function (t) {
147
- return n("throw", t, i, f);
148
- });
149
- } catch (t) {
150
- f(t);
151
- }
152
- }
153
- var r;
154
- this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
155
- return this;
156
- })), _regeneratorDefine(this, "_invoke", function (t, o, i) {
157
- function f() {
158
- return new e(function (e, r) {
159
- n(t, i, e, r);
160
- });
161
- }
162
- return r = r ? r.then(f, f) : f();
163
- }, true);
164
- }
165
- function _regeneratorDefine(e, r, n, t) {
166
- var i = Object.defineProperty;
167
- try {
168
- i({}, "", {});
169
- } catch (e) {
170
- i = 0;
171
- }
172
- _regeneratorDefine = function (e, r, n, t) {
173
- if (r) i ? i(e, r, {
174
- value: n,
175
- enumerable: !t,
176
- configurable: !t,
177
- writable: !t
178
- }) : e[r] = n;else {
179
- function o(r, n) {
180
- _regeneratorDefine(e, r, function (e) {
181
- return this._invoke(r, n, e);
182
- });
183
- }
184
- o("next", 0), o("throw", 1), o("return", 2);
185
- }
186
- }, _regeneratorDefine(e, r, n, t);
187
- }
188
- function _regeneratorKeys(e) {
189
- var n = Object(e),
190
- r = [];
191
- for (var t in n) r.unshift(t);
192
- return function e() {
193
- for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = false, e;
194
- return e.done = true, e;
195
- };
196
- }
197
- function _regeneratorValues(e) {
198
- if (null != e) {
199
- var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
200
- r = 0;
201
- if (t) return t.call(e);
202
- if ("function" == typeof e.next) return e;
203
- if (!isNaN(e.length)) return {
204
- next: function () {
205
- return e && r >= e.length && (e = void 0), {
206
- value: e && e[r++],
207
- done: !e
208
- };
209
- }
210
- };
211
- }
212
- throw new TypeError(typeof e + " is not iterable");
213
- }
214
- function _regeneratorRuntime() {
215
-
216
- var r = _regenerator(),
217
- e = r.m(_regeneratorRuntime),
218
- t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
219
- function n(r) {
220
- var e = "function" == typeof r && r.constructor;
221
- return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
222
- }
223
- var o = {
224
- throw: 1,
225
- return: 2,
226
- break: 3,
227
- continue: 3
228
- };
229
- function a(r) {
230
- var e, t;
231
- return function (n) {
232
- e || (e = {
233
- stop: function () {
234
- return t(n.a, 2);
235
- },
236
- catch: function () {
237
- return n.v;
238
- },
239
- abrupt: function (r, e) {
240
- return t(n.a, o[r], e);
241
- },
242
- delegateYield: function (r, o, a) {
243
- return e.resultName = o, t(n.d, _regeneratorValues(r), a);
244
- },
245
- finish: function (r) {
246
- return t(n.f, r);
247
- }
248
- }, t = function (r, t, o) {
249
- n.p = e.prev, n.n = e.next;
250
- try {
251
- return r(t, o);
252
- } finally {
253
- e.next = n.n;
254
- }
255
- }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
256
- try {
257
- return r.call(this, e);
258
- } finally {
259
- n.p = e.prev, n.n = e.next;
260
- }
261
- };
262
- }
263
- return (_regeneratorRuntime = function () {
264
- return {
265
- wrap: function (e, t, n, o) {
266
- return r.w(a(e), t, n, o && o.reverse());
267
- },
268
- isGeneratorFunction: n,
269
- mark: r.m,
270
- awrap: function (r, e) {
271
- return new _OverloadYield(r, e);
272
- },
273
- AsyncIterator: _regeneratorAsyncIterator,
274
- async: function (r, e, t, o, u) {
275
- return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
276
- },
277
- keys: _regeneratorKeys,
278
- values: _regeneratorValues
279
- };
280
- })();
281
- }
282
-
283
- var getHeaders = function getHeaders(auth) {
284
- return omit({
285
- 'Content-Type': 'application/json',
286
- Authorization: "Bearer " + (auth == null ? void 0 : auth.token),
287
- Accept: 'application/json'
288
- }, auth ? [] : ['Authorization']);
289
- };
290
- var withJsonFormat = function withJsonFormat(url) {
291
- var urlObj = new URL(url);
292
- urlObj.searchParams.set('f', 'json');
293
- return urlObj.toString();
294
- };
295
-
296
- // This function has a copy in libs/webmap-react/src/lib/edr-layer-api/api.ts. This cannot be used there due to circular dependency
297
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
298
- var handleResponse = /*#__PURE__*/function () {
299
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
300
- return _regeneratorRuntime().wrap(function _callee$(_context) {
301
- while (1) switch (_context.prev = _context.next) {
302
- case 0:
303
- if (!response.ok) {
304
- _context.next = 2;
305
- break;
306
- }
307
- return _context.abrupt("return", response.json().then(function (json) {
308
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
309
- return json != null ? json : response.headers;
310
- })["catch"](function () {
311
- // No JSON response
312
- }));
313
- case 2:
314
- return _context.abrupt("return", response.json()["catch"](function () {
315
- // Couldn't parse the JSON
316
- throw new Error("" + response.status);
317
- }).then(function (json) {
318
- // Got valid JSON with error response, use it
319
- if (json) {
320
- var message = json.message;
321
- if (message) {
322
- throw new Error(message, {
323
- cause: response.status
324
- });
325
- }
326
- var result = JSON.stringify(json);
327
- throw new Error(result);
328
- }
329
- throw new Error("" + response.status);
330
- }));
331
- case 3:
332
- case "end":
333
- return _context.stop();
334
- }
335
- }, _callee);
336
- }));
337
- return function handleResponse(_x) {
338
- return _ref.apply(this, arguments);
339
- };
340
- }();
341
- var useAuthQuery = function useAuthQuery(queryKey, _queryFn, disabled, refetchInterval) {
342
- if (disabled === void 0) {
343
- disabled = false;
344
- }
345
- if (refetchInterval === void 0) {
346
- refetchInterval = false;
347
- }
348
- var _useAuthenticationCon = useAuthenticationContext(),
349
- auth = _useAuthenticationCon.auth;
350
- var enabled = !!auth && !disabled;
351
- return useQuery({
352
- queryKey: queryKey,
353
- queryFn: function () {
354
- var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
355
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
356
- while (1) switch (_context2.prev = _context2.next) {
357
- case 0:
358
- return _context2.abrupt("return", _queryFn(auth));
359
- case 1:
360
- case "end":
361
- return _context2.stop();
362
- }
363
- }, _callee2);
364
- }));
365
- function queryFn() {
366
- return _queryFn2.apply(this, arguments);
367
- }
368
- return queryFn;
369
- }(),
370
- enabled: enabled,
371
- refetchInterval: refetchInterval
372
- });
373
- };
374
- var optimisticUpdate = function optimisticUpdate(updatedQueryKey, queryClient, _optimisticUpdate, errorCallback) {
375
- return {
376
- onMutate: function () {
377
- var _onMutate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(variables) {
378
- var oldData;
379
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
380
- while (1) switch (_context3.prev = _context3.next) {
381
- case 0:
382
- void queryClient.cancelQueries({
383
- queryKey: updatedQueryKey
384
- });
385
- oldData = queryClient.getQueryData(updatedQueryKey);
386
- if (variables.id) {
387
- queryClient.setQueryData(updatedQueryKey, function (old) {
388
- return old == null ? void 0 : old.map(function (item) {
389
- return item.id === variables.id ? _optimisticUpdate(item, variables) : item;
390
- });
391
- });
392
- }
393
- return _context3.abrupt("return", {
394
- oldData: oldData
395
- });
396
- case 4:
397
- case "end":
398
- return _context3.stop();
399
- }
400
- }, _callee3);
401
- }));
402
- function onMutate(_x2) {
403
- return _onMutate.apply(this, arguments);
404
- }
405
- return onMutate;
406
- }(),
407
- onError: function onError(err, _, context) {
408
- if (context != null && context.oldData) {
409
- queryClient.setQueryData(updatedQueryKey, context == null ? void 0 : context.oldData);
410
- }
411
- if (errorCallback) {
412
- errorCallback(err);
413
- }
414
- }
415
- };
416
- };
417
-
418
- var makeMockApiCall = function makeMockApiCall(response, responseInit, delayDuration) {
419
- if (delayDuration === void 0) {
420
- delayDuration = 0;
421
- }
422
- if (delayDuration) {
423
- return jest.fn().mockImplementation(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
424
- return _regeneratorRuntime().wrap(function _callee$(_context) {
425
- while (1) switch (_context.prev = _context.next) {
426
- case 0:
427
- _context.next = 2;
428
- return delay(delayDuration);
429
- case 2:
430
- return _context.abrupt("return", HttpResponse.json(response, responseInit));
431
- case 3:
432
- case "end":
433
- return _context.stop();
434
- }
435
- }, _callee);
436
- })));
437
- }
438
- return jest.fn().mockImplementation(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
439
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
440
- while (1) switch (_context2.prev = _context2.next) {
441
- case 0:
442
- return _context2.abrupt("return", Promise.resolve(HttpResponse.json(response, responseInit)));
443
- case 1:
444
- case "end":
445
- return _context2.stop();
446
- }
447
- }, _callee2);
448
- })));
449
- };
450
-
451
- /* *
452
- * Licensed under the Apache License, Version 2.0 (the "License");
453
- * you may not use this file except in compliance with the License.
454
- * You may obtain a copy of the License at
455
- *
456
- * http://www.apache.org/licenses/LICENSE-2.0
457
- *
458
- * Unless required by applicable law or agreed to in writing, software
459
- * distributed under the License is distributed on an "AS IS" BASIS,
460
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
461
- * See the License for the specific language governing permissions and
462
- * limitations under the License.
463
- *
464
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
465
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
466
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
467
- * */
468
-
469
- /* Date object, eg ISO8601 `2020-09-18T12:00:00Z` */
470
-
471
- // International Civil Aviation Organization (ICAO) locations
472
- // For example 'AMSTERDAM FIR';
473
-
474
- // Meteorological Watch Office (MWO) locations
475
- // For example 'EHDB'; Use getMWO() from utils to get the current MWO
476
-
477
- /* Air Traffic Services Unit locations */
478
- // For example 'EHAA';
479
-
480
- /* Air Traffic Services Region locations */
481
- // For example 'EHAA';
482
-
483
- /**
484
- * ProductStatus is returned by the backend. The backend fills in this property.
485
- * For the backend, it should only need to store 'DRAFT' | 'PUBLISHED' | 'CANCELLED' in its DB.
486
- * The backend should derive and return the status 'EXPIRED' from the product properties.
487
- *
488
- * Note: ProductStatus from the backend should be refreshed regularly to display status updates. */
489
- var ProductStatus = /*#__PURE__*/function (ProductStatus) {
490
- ProductStatus["DRAFT"] = "DRAFT";
491
- ProductStatus["PUBLISHED"] = "PUBLISHED";
492
- ProductStatus["RENEWED"] = "RENEWED";
493
- ProductStatus["CANCELLED"] = "CANCELLED";
494
- ProductStatus["EXPIRED"] = "EXPIRED";
495
- ProductStatus["DISCARDED"] = "DISCARDED";
496
- return ProductStatus;
497
- }({});
498
-
499
- /**
500
- * ProductSequence is a sequence label with a counter of the SIGMETs/AIRMETs issued on a day (starting at with 1 01:00),
501
- * max 3 characters long; first character should be a capital letter,
502
- * others are numbers: A01-A99, 01-99 or 1-99 */
503
-
504
- /**
505
- * ProductCanbe lifecycle is determined by the backend. E.g. the backend fills in these properties:
506
- * 'DRAFTED': product can be saved as draft
507
- * 'DISCARDED': This product can be thrown away
508
- * 'PUBLISHED': product can be PUBLISHED
509
- * 'CANCELLED': product can be CANCELLED */
510
-
511
- var LevelUnits = /*#__PURE__*/function (LevelUnits) {
512
- LevelUnits["FT"] = "ft";
513
- LevelUnits["M"] = "m";
514
- LevelUnits["FL"] = "FL";
515
- return LevelUnits;
516
- }({});
517
- var CloudLevelUnits = /*#__PURE__*/function (CloudLevelUnits) {
518
- CloudLevelUnits["FT"] = "ft";
519
- CloudLevelUnits["M"] = "m";
520
- return CloudLevelUnits;
521
- }({});
522
-
523
- /** Change type of the Product, can be:
524
- * INTSF:Intensifying
525
- * WKN: Weakening
526
- * NC: No change */
527
-
528
- /**
529
- * The possible phenomena for the sigmet
530
- */
531
- var SigmetPhenomena = /*#__PURE__*/function (SigmetPhenomena) {
532
- SigmetPhenomena["EMBD_TS"] = "Embedded thunderstorm(s)";
533
- SigmetPhenomena["EMBD_TSGR"] = "Embedded thunderstorm(s) with hail";
534
- SigmetPhenomena["FRQ_TS"] = "Frequent thunderstorm(s)";
535
- SigmetPhenomena["FRQ_TSGR"] = "Frequent thunderstorm(s) with hail";
536
- SigmetPhenomena["HVY_DS"] = "Heavy duststorm";
537
- SigmetPhenomena["HVY_SS"] = "Heavy sandstorm";
538
- SigmetPhenomena["OBSC_TS"] = "Obscured thunderstorm(s)";
539
- SigmetPhenomena["OBSC_TSGR"] = "Obscured thunderstorm(s) with hail";
540
- SigmetPhenomena["RDOACT_CLD"] = "Radioactive cloud";
541
- SigmetPhenomena["SEV_ICE"] = "Severe icing";
542
- SigmetPhenomena["SEV_ICE_FRZ_RN"] = "Severe icing due to freezing rain";
543
- SigmetPhenomena["SEV_MTW"] = "Severe mountain wave";
544
- SigmetPhenomena["SEV_TURB"] = "Severe turbulence";
545
- SigmetPhenomena["SQL_TS"] = "Squall line thunderstorm(s)";
546
- SigmetPhenomena["SQL_TSGR"] = "Squall line thunderstorm(s) with hail";
547
- SigmetPhenomena["VA_CLD"] = "Volcanic ash cloud";
548
- return SigmetPhenomena;
549
- }({});
550
-
551
- /**
552
- * The possible phenomena for the airmet
553
- */
554
- var AirmetPhenomena = /*#__PURE__*/function (AirmetPhenomena) {
555
- AirmetPhenomena["SFC_VIS"] = "Surface visibility";
556
- AirmetPhenomena["SFC_WIND"] = "Surface wind";
557
- AirmetPhenomena["OVC_CLD"] = "Overcast cloud";
558
- AirmetPhenomena["BKN_CLD"] = "Broken cloud";
559
- AirmetPhenomena["ISOL_CB"] = "Isolated cumulonimbus cloud";
560
- AirmetPhenomena["OCNL_CB"] = "Occasional cumulonimbus cloud";
561
- AirmetPhenomena["FRQ_CB"] = "Frequent cumulonimbus cloud";
562
- AirmetPhenomena["ISOL_TS"] = "Isolated thunderstorm(s)";
563
- AirmetPhenomena["OCNL_TS"] = "Occasional thunderstorm(s)";
564
- AirmetPhenomena["ISOL_TSGR"] = "Isolated thunderstorm(s) with hail";
565
- AirmetPhenomena["OCNL_TSGR"] = "Occasional thunderstorm(s) with hail";
566
- AirmetPhenomena["ISOL_TCU"] = "Isolated towering cumulus cloud";
567
- AirmetPhenomena["OCNL_TCU"] = "Occasional towering cumulus cloud";
568
- AirmetPhenomena["FRQ_TCU"] = "Frequent towering cumulus cloud";
569
- AirmetPhenomena["MOD_ICE"] = "Moderate icing";
570
- AirmetPhenomena["MOD_MTW"] = "Moderate mountain wave";
571
- AirmetPhenomena["MOD_TURB"] = "Moderate turbulence";
572
- AirmetPhenomena["MT_OBSC"] = "Mountains obscured";
573
- return AirmetPhenomena;
574
- }({});
575
-
576
- /* STATIONARY: not moving
577
- * MOVEMENT: moving, specified by speed/direction, (If not STATIONARY and no end geometry is given)
578
- * FORECAST_POSITION: moving, specified by end geometry
579
- * NO_VA_EXP: no volcanic ash expected, option only available for phenomenon VA_CLD */
580
-
581
- /* STATIONARY: not moving
582
- * MOVEMENT: moving, specified by speed/direction */
583
-
584
- /* Speed unit, e.g. 'KT', 'KMH' */
585
- var MovementUnit = /*#__PURE__*/function (MovementUnit) {
586
- MovementUnit["KT"] = "kt";
587
- MovementUnit["KMH"] = "kmh";
588
- return MovementUnit;
589
- }({});
590
- // can these be unified as SpeedUnit?
591
- var WindUnit = /*#__PURE__*/function (WindUnit) {
592
- WindUnit["KT"] = "kt";
593
- WindUnit["MPS"] = "mps";
594
- return WindUnit;
595
- }({});
596
- var Direction = /*#__PURE__*/function (Direction) {
597
- Direction["N"] = "N";
598
- Direction["NNE"] = "NNE";
599
- Direction["NE"] = "NE";
600
- Direction["ENE"] = "ENE";
601
- Direction["E"] = "E";
602
- Direction["ESE"] = "ESE";
603
- Direction["SE"] = "SE";
604
- Direction["SSE"] = "SSE";
605
- Direction["S"] = "S";
606
- Direction["SSW"] = "SSW";
607
- Direction["SW"] = "SW";
608
- Direction["WSW"] = "WSW";
609
- Direction["W"] = "W";
610
- Direction["WNW"] = "WNW";
611
- Direction["NW"] = "NW";
612
- Direction["NNW"] = "NNW";
613
- return Direction;
614
- }({});
615
- var VisibilityCause = /*#__PURE__*/function (VisibilityCause) {
616
- VisibilityCause["DZ"] = "Drizzle";
617
- VisibilityCause["DU"] = "Dust";
618
- VisibilityCause["PO"] = "Dust or sand devil";
619
- VisibilityCause["DS"] = "Dust storm";
620
- VisibilityCause["FG"] = "Fog";
621
- VisibilityCause["FC"] = "Funnel clouds";
622
- VisibilityCause["GR"] = "Hail";
623
- VisibilityCause["HZ"] = "Haze";
624
- VisibilityCause["PL"] = "Ice pellets";
625
- VisibilityCause["BR"] = "Mist";
626
- VisibilityCause["RA"] = "Rain";
627
- VisibilityCause["SA"] = "Sand";
628
- VisibilityCause["SS"] = "Sand storm";
629
- VisibilityCause["FU"] = "Smoke";
630
- VisibilityCause["SN"] = "Snow";
631
- VisibilityCause["SG"] = "Snow grains";
632
- VisibilityCause["GS"] = "Soft hail";
633
- VisibilityCause["SQ"] = "Squalls";
634
- VisibilityCause["VA"] = "Volcanic Ash";
635
- return VisibilityCause;
636
- }({});
637
-
638
- /* *
639
- * Licensed under the Apache License, Version 2.0 (the "License");
640
- * you may not use this file except in compliance with the License.
641
- * You may obtain a copy of the License at
642
- *
643
- * http://www.apache.org/licenses/LICENSE-2.0
644
- *
645
- * Unless required by applicable law or agreed to in writing, software
646
- * distributed under the License is distributed on an "AS IS" BASIS,
647
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
648
- * See the License for the specific language governing permissions and
649
- * limitations under the License.
650
- *
651
- * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
652
- * Copyright 2025 - Finnish Meteorological Institute (FMI)
653
- * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
654
- * */
655
-
656
- var queryClientInstance = null;
657
- var getQueryClient = function getQueryClient() {
658
- var _queryClientInstance;
659
- (_queryClientInstance = queryClientInstance) != null ? _queryClientInstance : queryClientInstance = new QueryClient({
660
- defaultOptions: {
661
- queries: {
662
- refetchOnWindowFocus: false,
663
- refetchOnMount: false,
664
- refetchOnReconnect: false,
665
- refetchInterval: false,
666
- placeholderData: keepPreviousData,
667
- staleTime: 1000 * 60 * 5
668
- }
669
- }
670
- });
671
- return queryClientInstance;
672
- };
673
- var setQueryClient = function setQueryClient(client) {
674
- queryClientInstance = client;
675
- };
676
- var configureLibraryDefaults = function configureLibraryDefaults(queryKeyPrefix, options) {
677
- var client = getQueryClient();
678
- client.setQueryDefaults(queryKeyPrefix, options);
679
- };
680
- var createTestQueryClient = function createTestQueryClient(overrides) {
681
- var client = new QueryClient({
682
- defaultOptions: {
683
- queries: Object.assign({
684
- retry: false,
685
- staleTime: 0,
686
- gcTime: 0,
687
- refetchOnWindowFocus: false,
688
- refetchOnMount: false,
689
- refetchOnReconnect: false,
690
- refetchInterval: false
691
- }, overrides == null ? void 0 : overrides.queries),
692
- mutations: Object.assign({
693
- retry: false
694
- }, overrides == null ? void 0 : overrides.mutations)
695
- }
696
- });
697
- setQueryClient(client);
698
- return client;
699
- };
700
- var resetQueryClient = function resetQueryClient() {
701
- var _queryClientInstance2, _queryClientInstance3;
702
- void ((_queryClientInstance2 = queryClientInstance) == null ? void 0 : _queryClientInstance2.cancelQueries());
703
- (_queryClientInstance3 = queryClientInstance) == null || _queryClientInstance3.clear();
704
- queryClientInstance = null;
705
- };
706
-
707
- /* *
708
- * Licensed under the Apache License, Version 2.0 (the "License");
709
- * you may not use this file except in compliance with the License.
710
- * You may obtain a copy of the License at
711
- *
712
- * http://www.apache.org/licenses/LICENSE-2.0
713
- *
714
- * Unless required by applicable law or agreed to in writing, software
715
- * distributed under the License is distributed on an "AS IS" BASIS,
716
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717
- * See the License for the specific language governing permissions and
718
- * limitations under the License.
719
- *
720
- * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
721
- * Copyright 2025 - Finnish Meteorological Institute (FMI)
722
- * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
723
- * */
724
-
725
- var QueryClientProviderWrapper = function QueryClientProviderWrapper(_ref) {
726
- var client = _ref.client,
727
- children = _ref.children,
728
- _ref$mode = _ref.mode,
729
- mode = _ref$mode === void 0 ? 'production' : _ref$mode;
730
- var queryClient = React.useMemo(function () {
731
- if (client) {
732
- setQueryClient(client);
733
- return client;
734
- }
735
- return mode === 'test' ? createTestQueryClient() : getQueryClient();
736
- }, [client, mode]);
737
- return /*#__PURE__*/jsxs(QueryClientProvider, {
738
- client: queryClient,
739
- children: [children, /*#__PURE__*/jsx(ReactQueryDevtools, {
740
- initialIsOpen: false
741
- })]
742
- });
743
- };
744
-
745
- /* *
746
- * Licensed under the Apache License, Version 2.0 (the "License");
747
- * you may not use this file except in compliance with the License.
748
- * You may obtain a copy of the License at
749
- *
750
- * http://www.apache.org/licenses/LICENSE-2.0
751
- *
752
- * Unless required by applicable law or agreed to in writing, software
753
- * distributed under the License is distributed on an "AS IS" BASIS,
754
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
755
- * See the License for the specific language governing permissions and
756
- * limitations under the License.
757
- *
758
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
759
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
760
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
761
- * */
762
-
763
- var API_NAMESPACE = 'api';
764
-
765
- // Initialize and create provider if needed
766
-
767
- export { API_NAMESPACE, AirmetPhenomena, CloudLevelUnits, Direction, LevelUnits, MovementUnit, ProductStatus, QueryClientProviderWrapper, SigmetPhenomena, VisibilityCause, WindUnit, configureLibraryDefaults, createTestQueryClient, getHeaders, getQueryClient, handleResponse, makeMockApiCall, optimisticUpdate, resetQueryClient, setQueryClient, useAuthQuery, withJsonFormat };