@xyo-network/react-map 2.59.2 → 2.60.0-rc.1

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.
@@ -1,42 +0,0 @@
1
- /* eslint-disable deprecation/deprecation */
2
- import { useAsyncEffect } from '@xylabs/react-async-effect';
3
- import { useArchivistFromNode } from '@xyo-network/react-archivist';
4
- import { useState } from 'react';
5
- import { useQuadKeyPayloadsToFeatures } from './useQuadKeyPayloadsToFeatures';
6
- /** @deprecated - use useArchivistGet */
7
- const useFetchPayloads = (hashes) => {
8
- const [archivist] = useArchivistFromNode();
9
- const [apiError, setApiError] = useState();
10
- const [payloads, setPayloads] = useState();
11
- const { features, multipleFeatureSets } = useQuadKeyPayloadsToFeatures(payloads);
12
- const [notFound, setNotFound] = useState(false);
13
- const [inFlight, setInFlight] = useState(false);
14
- useAsyncEffect(
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- async (mounted) => {
17
- if (archivist && payloads === undefined && hashes?.length && !inFlight) {
18
- try {
19
- setInFlight(true);
20
- const payloads = await archivist.get(hashes);
21
- if (mounted()) {
22
- if (payloads.length === 0 && apiError === undefined) {
23
- setNotFound(true);
24
- setPayloads([]);
25
- }
26
- else {
27
- setPayloads(payloads);
28
- }
29
- }
30
- }
31
- catch (e) {
32
- const error = e;
33
- if (mounted()) {
34
- setApiError(error.errors.reduce((answer, error) => answer ?? error ?? null, null) ?? undefined);
35
- }
36
- }
37
- }
38
- }, [apiError, hashes, inFlight, payloads, archivist]);
39
- return { apiError, features, multipleFeatureSets, notFound };
40
- };
41
- export { useFetchPayloads };
42
- //# sourceMappingURL=useFetchPayloads.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchPayloads.js","sourceRoot":"","sources":["../../../src/hooks/useFetchPayloads.tsx"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAG3D,OAAO,EAAE,oBAAoB,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A;gBAC/B,IAAI,OAAO,EAAE,EAAE;oBACb,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,CAAA;iBAChG;aACF;SACF;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAClD,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAA;AAC9D,CAAC,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,17 +0,0 @@
1
- /** @deprecated - use useArchivistGet */
2
- declare const useFetchPayloads: (hashes?: string[]) => {
3
- apiError: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
4
- message?: string | undefined;
5
- name?: string | undefined;
6
- query?: string | undefined;
7
- schema: "network.xyo.error.module";
8
- sources?: string[] | undefined;
9
- } & {
10
- schema: "network.xyo.error.module";
11
- }) | undefined;
12
- features: import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[];
13
- multipleFeatureSets: import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[][];
14
- notFound: boolean;
15
- };
16
- export { useFetchPayloads };
17
- //# sourceMappingURL=useFetchPayloads.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFetchPayloads.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFetchPayloads.tsx"],"names":[],"mappings":"AAUA,wCAAwC;AACxC,QAAA,MAAM,gBAAgB,YAAa,MAAM,EAAE;;;;;;;;;;;;;CAoC1C,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,50 +0,0 @@
1
- /* eslint-disable deprecation/deprecation */
2
- import { useAsyncEffect } from '@xylabs/react-async-effect'
3
- import { WrapperError } from '@xyo-network/module'
4
- import { ModuleError } from '@xyo-network/payload-model'
5
- import { useArchivistFromNode } from '@xyo-network/react-archivist'
6
- import { useState } from 'react'
7
-
8
- import { NetworkLocationHeatmapQuadkeyAnswerPayload } from '../types'
9
- import { useQuadKeyPayloadsToFeatures } from './useQuadKeyPayloadsToFeatures'
10
-
11
- /** @deprecated - use useArchivistGet */
12
- const useFetchPayloads = (hashes?: string[]) => {
13
- const [archivist] = useArchivistFromNode()
14
-
15
- const [apiError, setApiError] = useState<ModuleError>()
16
- const [payloads, setPayloads] = useState<NetworkLocationHeatmapQuadkeyAnswerPayload[]>()
17
- const { features, multipleFeatureSets } = useQuadKeyPayloadsToFeatures(payloads)
18
- const [notFound, setNotFound] = useState(false)
19
- const [inFlight, setInFlight] = useState(false)
20
-
21
- useAsyncEffect(
22
- // eslint-disable-next-line react-hooks/exhaustive-deps
23
- async (mounted) => {
24
- if (archivist && payloads === undefined && hashes?.length && !inFlight) {
25
- try {
26
- setInFlight(true)
27
- const payloads = await archivist.get(hashes)
28
- if (mounted()) {
29
- if (payloads.length === 0 && apiError === undefined) {
30
- setNotFound(true)
31
- setPayloads([])
32
- } else {
33
- setPayloads(payloads as NetworkLocationHeatmapQuadkeyAnswerPayload[])
34
- }
35
- }
36
- } catch (e) {
37
- const error = e as WrapperError
38
- if (mounted()) {
39
- setApiError(error.errors.reduce((answer, error) => answer ?? error ?? null, null) ?? undefined)
40
- }
41
- }
42
- }
43
- },
44
- [apiError, hashes, inFlight, payloads, archivist],
45
- )
46
-
47
- return { apiError, features, multipleFeatureSets, notFound }
48
- }
49
-
50
- export { useFetchPayloads }