+9
-9
src/leaflet-live-loader.ts
+9
-9
src/leaflet-live-loader.ts
···
1
-
import type { LiveLoader } from "astro/loaders";
2
1
import { Agent } from "@atproto/api";
3
2
import { isDid } from "@atproto/did";
4
3
import { isValidHandle } from "@atproto/syntax";
5
-
import {
6
-
getLeafletDocuments,
7
-
getSingleLeafletDocument,
8
-
leafletDocumentRecordToView,
9
-
resolveMiniDoc,
10
-
uriToRkey,
11
-
} from "./utils.js";
4
+
import type { LiveLoader } from "astro/loaders";
12
5
import type {
13
6
CollectionFilter,
14
7
EntryFilter,
···
16
9
LeafletDocumentView,
17
10
LeafletLoaderOptions,
18
11
} from "./types.js";
12
+
import {
13
+
getLeafletDocuments,
14
+
getSingleLeafletDocument,
15
+
leafletDocumentRecordToView,
16
+
resolveMiniDoc,
17
+
uriToRkey,
18
+
} from "./utils.js";
19
19
20
20
export class LiveLoaderError extends Error {
21
21
constructor(
···
82
82
};
83
83
}),
84
84
};
85
-
} catch (error) {
85
+
} catch {
86
86
return {
87
87
error: new LiveLoaderError(
88
88
"could not recover from error, please report on github",
+11
-11
src/utils.ts
+11
-11
src/utils.ts
···
1
-
import type {
2
-
Facet,
3
-
GetLeafletDocumentsParams,
4
-
GetSingleLeafletDocumentParams,
5
-
LeafletDocumentRecord,
6
-
LeafletDocumentView,
7
-
MiniDoc,
8
-
RichTextSegment,
9
-
} from "./types.js";
10
-
import { LiveLoaderError } from "./leaflet-live-loader.js";
11
1
import { UnicodeString } from "@atproto/api";
12
2
import sanitizeHTML from "sanitize-html";
13
3
import {
···
17
7
PubLeafletPagesLinearDocument,
18
8
PubLeafletRichtextFacet,
19
9
} from "./__generated__/lexicons/index.js";
10
+
import { LiveLoaderError } from "./leaflet-live-loader.js";
11
+
import type {
12
+
Facet,
13
+
GetLeafletDocumentsParams,
14
+
GetSingleLeafletDocumentParams,
15
+
LeafletDocumentRecord,
16
+
LeafletDocumentView,
17
+
MiniDoc,
18
+
RichTextSegment,
19
+
} from "./types.js";
20
20
21
21
export function uriToRkey(uri: string): string {
22
22
const rkey = uri.split("/").pop();
···
40
40
const data = (await response.json()) as MiniDoc;
41
41
42
42
return data.pds;
43
-
} catch (error) {
43
+
} catch {
44
44
throw new Error(`failed to resolve handle: ${handleOrDid}`);
45
45
}
46
46
}