@opengeoweb/api 14.1.0 → 14.2.2
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/index.esm.js
CHANGED
|
@@ -288,33 +288,50 @@ var getHeaders = function getHeaders(auth) {
|
|
|
288
288
|
}, auth ? [] : ['Authorization']);
|
|
289
289
|
};
|
|
290
290
|
// 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
|
|
291
|
-
// eslint-disable-next-line @typescript-eslint/explicit-
|
|
292
|
-
var handleResponse = function
|
|
293
|
-
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
|
+
var handleResponse = /*#__PURE__*/function () {
|
|
293
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
295
|
+
while (1) switch (_context.prev = _context.next) {
|
|
296
|
+
case 0:
|
|
297
|
+
if (!response.ok) {
|
|
298
|
+
_context.next = 2;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
return _context.abrupt("return", response.json().then(function (json) {
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
303
|
+
return json != null ? json : response.headers;
|
|
304
|
+
})["catch"](function () {
|
|
305
|
+
// No JSON response
|
|
306
|
+
}));
|
|
307
|
+
case 2:
|
|
308
|
+
return _context.abrupt("return", response.json()["catch"](function () {
|
|
309
|
+
// Couldn't parse the JSON
|
|
310
|
+
throw new Error("" + response.status);
|
|
311
|
+
}).then(function (json) {
|
|
312
|
+
// Got valid JSON with error response, use it
|
|
313
|
+
if (json) {
|
|
314
|
+
var message = json.message;
|
|
315
|
+
if (message) {
|
|
316
|
+
throw new Error(message, {
|
|
317
|
+
cause: response.status
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
var result = JSON.stringify(json);
|
|
321
|
+
throw new Error(result);
|
|
322
|
+
}
|
|
323
|
+
throw new Error("" + response.status);
|
|
324
|
+
}));
|
|
325
|
+
case 3:
|
|
326
|
+
case "end":
|
|
327
|
+
return _context.stop();
|
|
311
328
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
};
|
|
329
|
+
}, _callee);
|
|
330
|
+
}));
|
|
331
|
+
return function handleResponse(_x) {
|
|
332
|
+
return _ref.apply(this, arguments);
|
|
333
|
+
};
|
|
334
|
+
}();
|
|
318
335
|
var useAuthQuery = function useAuthQuery(queryKey, _queryFn, disabled, refetchInterval) {
|
|
319
336
|
if (disabled === void 0) {
|
|
320
337
|
disabled = false;
|
|
@@ -327,9 +344,23 @@ var useAuthQuery = function useAuthQuery(queryKey, _queryFn, disabled, refetchIn
|
|
|
327
344
|
var enabled = !!auth && !disabled;
|
|
328
345
|
return useQuery({
|
|
329
346
|
queryKey: queryKey,
|
|
330
|
-
queryFn: function
|
|
331
|
-
|
|
332
|
-
|
|
347
|
+
queryFn: function () {
|
|
348
|
+
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
349
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
350
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
351
|
+
case 0:
|
|
352
|
+
return _context2.abrupt("return", _queryFn(auth));
|
|
353
|
+
case 1:
|
|
354
|
+
case "end":
|
|
355
|
+
return _context2.stop();
|
|
356
|
+
}
|
|
357
|
+
}, _callee2);
|
|
358
|
+
}));
|
|
359
|
+
function queryFn() {
|
|
360
|
+
return _queryFn2.apply(this, arguments);
|
|
361
|
+
}
|
|
362
|
+
return queryFn;
|
|
363
|
+
}(),
|
|
333
364
|
enabled: enabled,
|
|
334
365
|
refetchInterval: refetchInterval
|
|
335
366
|
});
|
|
@@ -337,10 +368,10 @@ var useAuthQuery = function useAuthQuery(queryKey, _queryFn, disabled, refetchIn
|
|
|
337
368
|
var optimisticUpdate = function optimisticUpdate(updatedQueryKey, queryClient, _optimisticUpdate, errorCallback) {
|
|
338
369
|
return {
|
|
339
370
|
onMutate: function () {
|
|
340
|
-
var _onMutate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
371
|
+
var _onMutate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(variables) {
|
|
341
372
|
var oldData;
|
|
342
|
-
return _regeneratorRuntime().wrap(function
|
|
343
|
-
while (1) switch (
|
|
373
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
374
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
344
375
|
case 0:
|
|
345
376
|
void queryClient.cancelQueries({
|
|
346
377
|
queryKey: updatedQueryKey
|
|
@@ -353,16 +384,16 @@ var optimisticUpdate = function optimisticUpdate(updatedQueryKey, queryClient, _
|
|
|
353
384
|
});
|
|
354
385
|
});
|
|
355
386
|
}
|
|
356
|
-
return
|
|
387
|
+
return _context3.abrupt("return", {
|
|
357
388
|
oldData: oldData
|
|
358
389
|
});
|
|
359
390
|
case 4:
|
|
360
391
|
case "end":
|
|
361
|
-
return
|
|
392
|
+
return _context3.stop();
|
|
362
393
|
}
|
|
363
|
-
},
|
|
394
|
+
}, _callee3);
|
|
364
395
|
}));
|
|
365
|
-
function onMutate(
|
|
396
|
+
function onMutate(_x2) {
|
|
366
397
|
return _onMutate.apply(this, arguments);
|
|
367
398
|
}
|
|
368
399
|
return onMutate;
|
|
@@ -398,9 +429,17 @@ var makeMockApiCall = function makeMockApiCall(response, responseInit, delayDura
|
|
|
398
429
|
}, _callee);
|
|
399
430
|
})));
|
|
400
431
|
}
|
|
401
|
-
return jest.fn().mockImplementation(function () {
|
|
402
|
-
return
|
|
403
|
-
|
|
432
|
+
return jest.fn().mockImplementation(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
433
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
434
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
435
|
+
case 0:
|
|
436
|
+
return _context2.abrupt("return", Promise.resolve(HttpResponse.json(response, responseInit)));
|
|
437
|
+
case 1:
|
|
438
|
+
case "end":
|
|
439
|
+
return _context2.stop();
|
|
440
|
+
}
|
|
441
|
+
}, _callee2);
|
|
442
|
+
})));
|
|
404
443
|
};
|
|
405
444
|
|
|
406
445
|
/* *
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/api",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.2",
|
|
4
4
|
"description": "GeoWeb API library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/authentication": "14.
|
|
12
|
-
"@opengeoweb/store": "14.
|
|
11
|
+
"@opengeoweb/authentication": "14.2.2",
|
|
12
|
+
"@opengeoweb/store": "14.2.2",
|
|
13
13
|
"lodash": "^4.17.21",
|
|
14
14
|
"@tanstack/react-query": "^5.85.5",
|
|
15
15
|
"@tanstack/query-core": "^5.79.0",
|
package/src/fakeApi.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HttpResponseInit, JsonBodyType } from 'msw';
|
|
1
|
+
import type { HttpResponseInit, JsonBodyType } from 'msw';
|
|
2
2
|
export declare const makeMockApiCall: (response: JsonBodyType, responseInit?: HttpResponseInit, delayDuration?: number) => jest.Mock;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AirmetMovementType, AirmetPhenomena, ATSRLocation, ATSULocation, Change, CloudLevelInfoMode, CloudLevelUnits, DateType, Direction, ICAOLocation, LevelInfoMode, LevelUnits, MovementUnit, MWOLocation, ObservationOrForcast, ProductCanbe, ProductSequenceId, ProductStatus, SigmetMovementType, SigmetPhenomena, VisibilityCause, VisibilityUnit, WindUnit } from './definitions';
|
|
1
|
+
import type { AirmetMovementType, AirmetPhenomena, ATSRLocation, ATSULocation, Change, CloudLevelInfoMode, CloudLevelUnits, DateType, Direction, ICAOLocation, LevelInfoMode, LevelUnits, MovementUnit, MWOLocation, ObservationOrForcast, ProductCanbe, ProductSequenceId, ProductStatus, SigmetMovementType, SigmetPhenomena, VisibilityCause, VisibilityUnit, WindUnit } from './definitions';
|
|
2
2
|
export interface LevelType {
|
|
3
3
|
value: number;
|
|
4
4
|
unit: LevelUnits;
|
package/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MutationOptions, QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { Credentials } from '@opengeoweb/authentication';
|
|
1
|
+
import type { MutationOptions, QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { Credentials } from '@opengeoweb/authentication';
|
|
3
3
|
export declare const getHeaders: (auth?: Credentials) => HeadersInit;
|
|
4
4
|
export declare const handleResponse: (response: Response) => Promise<any>;
|
|
5
5
|
export declare const useAuthQuery: <T>(queryKey: string[], queryFn: (auth: Credentials) => Promise<T>, disabled?: boolean, refetchInterval?: number | false) => UseQueryResult<T>;
|