@bryanguffey/astro-standard-site 1.0.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.
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Publisher for standard.site documents
3
+ *
4
+ * Publishes documents to ATProto repositories using the standard.site lexicon,
5
+ * enabling your Astro site to sync content to Leaflet, WhiteWind, or any
6
+ * compatible platform.
7
+ *
8
+ * The publisher automatically resolves the correct PDS from your DID document,
9
+ * so it works with any PDS (bsky.app, Blacksky, self-hosted, etc.).
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { StandardSitePublisher } from 'astro-standard-site/publisher';
14
+ *
15
+ * const publisher = new StandardSitePublisher({
16
+ * identifier: 'your-handle.bsky.social',
17
+ * password: process.env.ATPROTO_APP_PASSWORD!,
18
+ * });
19
+ *
20
+ * await publisher.login();
21
+ *
22
+ * await publisher.publishDocument({
23
+ * title: 'My Blog Post',
24
+ * url: 'https://myblog.com/posts/my-post',
25
+ * publishedAt: new Date().toISOString(),
26
+ * visibility: 'public',
27
+ * });
28
+ * ```
29
+ */
30
+ import { AtpAgent } from '@atproto/api';
31
+ import type { PublisherConfig, Document, Publication } from './schemas.js';
32
+ export interface PublishDocumentInput {
33
+ /** Site/publication URI (https or at-uri) - REQUIRED */
34
+ site: string;
35
+ /** Document title - REQUIRED */
36
+ title: string;
37
+ /** When the document was published (ISO 8601) - REQUIRED */
38
+ publishedAt: string;
39
+ /** Path to combine with site URL */
40
+ path?: string;
41
+ /** Document description/excerpt */
42
+ description?: string;
43
+ /** When the document was last updated (ISO 8601) */
44
+ updatedAt?: string;
45
+ /** Tags/categories */
46
+ tags?: string[];
47
+ /** Plain text content for indexing */
48
+ textContent?: string;
49
+ /** Platform-specific content */
50
+ content?: unknown;
51
+ /** Reference to associated Bluesky post */
52
+ bskyPostRef?: {
53
+ uri: string;
54
+ cid: string;
55
+ };
56
+ }
57
+ export interface PublishPublicationInput {
58
+ /** Publication name */
59
+ name: string;
60
+ /** Base URL */
61
+ url: string;
62
+ /** Description */
63
+ description?: string;
64
+ /** Basic theme colors */
65
+ basicTheme?: {
66
+ background: {
67
+ r: number;
68
+ g: number;
69
+ b: number;
70
+ };
71
+ foreground: {
72
+ r: number;
73
+ g: number;
74
+ b: number;
75
+ };
76
+ accent: {
77
+ r: number;
78
+ g: number;
79
+ b: number;
80
+ };
81
+ accentForeground: {
82
+ r: number;
83
+ g: number;
84
+ b: number;
85
+ };
86
+ };
87
+ /** Publication preferences */
88
+ preferences?: {
89
+ showInDiscover?: boolean;
90
+ };
91
+ }
92
+ export interface PublishResult {
93
+ uri: string;
94
+ cid: string;
95
+ }
96
+ /**
97
+ * Publisher for standard.site documents on ATProto
98
+ */
99
+ export declare class StandardSitePublisher {
100
+ private agent;
101
+ private config;
102
+ private did;
103
+ private pdsUrl;
104
+ constructor(config: Partial<PublisherConfig>);
105
+ /**
106
+ * Authenticate with the PDS
107
+ * Automatically resolves the correct PDS from the DID document
108
+ */
109
+ login(): Promise<void>;
110
+ /**
111
+ * Get the authenticated DID
112
+ */
113
+ getDid(): string;
114
+ /**
115
+ * Get the PDS URL being used
116
+ */
117
+ getPdsUrl(): string;
118
+ private getAgent;
119
+ /**
120
+ * Publish a document record
121
+ */
122
+ publishDocument(input: PublishDocumentInput): Promise<PublishResult>;
123
+ /**
124
+ * Update an existing document
125
+ */
126
+ updateDocument(rkey: string, input: PublishDocumentInput): Promise<PublishResult>;
127
+ /**
128
+ * Delete a document
129
+ */
130
+ deleteDocument(rkey: string): Promise<void>;
131
+ /**
132
+ * Publish a publication record
133
+ */
134
+ publishPublication(input: PublishPublicationInput): Promise<PublishResult>;
135
+ /**
136
+ * Get all documents for the current account
137
+ */
138
+ listDocuments(limit?: number): Promise<Array<{
139
+ uri: string;
140
+ cid: string;
141
+ value: Document;
142
+ }>>;
143
+ /**
144
+ * Get all publications for the current account
145
+ */
146
+ listPublications(limit?: number): Promise<Array<{
147
+ uri: string;
148
+ cid: string;
149
+ value: Publication;
150
+ }>>;
151
+ /**
152
+ * Get the underlying ATP agent for advanced operations
153
+ */
154
+ getAtpAgent(): AtpAgent;
155
+ }
156
+ export type { PublisherConfig };
157
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../src/publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,QAAQ,EAAY,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA8C3E,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,UAAU,CAAC,EAAE;QACX,UAAU,EAAE;YAAE,CAAC,EAAE,MA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AAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjD;;OAEG;IACG,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,aAAa,CAAC;IAiChF;;OAEG;IACG,aAAa,CAAC,KAAK,SAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;IAiB/F;;OAEG;IACG,gBAAgB,CAAC,KAAK,SAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAiBrG;;OAEG;IACH,WAAW,IAAI,QAAQ;CAGxB;AAED,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Publisher for standard.site documents
3
+ *
4
+ * Publishes documents to ATProto repositories using the standard.site lexicon,
5
+ * enabling your Astro site to sync content to Leaflet, WhiteWind, or any
6
+ * compatible platform.
7
+ *
8
+ * The publisher automatically resolves the correct PDS from your DID document,
9
+ * so it works with any PDS (bsky.app, Blacksky, self-hosted, etc.).
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { StandardSitePublisher } from 'astro-standard-site/publisher';
14
+ *
15
+ * const publisher = new StandardSitePublisher({
16
+ * identifier: 'your-handle.bsky.social',
17
+ * password: process.env.ATPROTO_APP_PASSWORD!,
18
+ * });
19
+ *
20
+ * await publisher.login();
21
+ *
22
+ * await publisher.publishDocument({
23
+ * title: 'My Blog Post',
24
+ * url: 'https://myblog.com/posts/my-post',
25
+ * publishedAt: new Date().toISOString(),
26
+ * visibility: 'public',
27
+ * });
28
+ * ```
29
+ */
30
+ import { AtpAgent } from '@atproto/api';
31
+ import { PublisherConfigSchema, COLLECTIONS } from './schemas.js';
32
+ /**
33
+ * Resolve a handle to a DID using the public API
34
+ */
35
+ async function resolveHandle(handle) {
36
+ const res = await fetch(`https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(handle)}`);
37
+ if (!res.ok)
38
+ throw new Error(`Failed to resolve handle: ${handle}`);
39
+ const data = await res.json();
40
+ return data.did;
41
+ }
42
+ /**
43
+ * Get the PDS endpoint from a DID document
44
+ */
45
+ async function getPdsFromDid(did) {
46
+ let didDoc;
47
+ if (did.startsWith('did:plc:')) {
48
+ // Resolve from plc.directory
49
+ const res = await fetch(`https://plc.directory/${did}`);
50
+ if (!res.ok)
51
+ throw new Error(`Failed to resolve DID: ${did}`);
52
+ didDoc = await res.json();
53
+ }
54
+ else if (did.startsWith('did:web:')) {
55
+ // Resolve from the domain
56
+ const domain = did.replace('did:web:', '');
57
+ const res = await fetch(`https://${domain}/.well-known/did.json`);
58
+ if (!res.ok)
59
+ throw new Error(`Failed to resolve DID: ${did}`);
60
+ didDoc = await res.json();
61
+ }
62
+ else {
63
+ throw new Error(`Unsupported DID method: ${did}`);
64
+ }
65
+ // Find the AtprotoPersonalDataServer service
66
+ const pdsService = didDoc.service?.find((s) => s.type === 'AtprotoPersonalDataServer' || s.id === '#atproto_pds');
67
+ if (!pdsService?.serviceEndpoint) {
68
+ throw new Error(`No PDS found in DID document for ${did}`);
69
+ }
70
+ return pdsService.serviceEndpoint;
71
+ }
72
+ /**
73
+ * Generate a record key from a string (slug-like)
74
+ */
75
+ function generateRkey(input) {
76
+ if (input) {
77
+ // Sanitize and truncate for use as record key
78
+ return input
79
+ .toLowerCase()
80
+ .replace(/[^a-z0-9]+/g, '-')
81
+ .replace(/^-|-$/g, '')
82
+ .slice(0, 64);
83
+ }
84
+ // Fallback to timestamp-based key
85
+ return Date.now().toString(36) + Math.random().toString(36).slice(2, 7);
86
+ }
87
+ /**
88
+ * Generate a TID (Timestamp ID) for record keys
89
+ * TIDs are base32-sortable identifiers used in ATProto
90
+ */
91
+ /**
92
+ * Generate a TID (Timestamp Identifier) per ATProto spec
93
+ * @see https://atproto.com/specs/tid
94
+ *
95
+ * Structure:
96
+ * - 64-bit integer, big-endian
97
+ * - Top bit always 0
98
+ * - Next 53 bits: microseconds since UNIX epoch
99
+ * - Final 10 bits: random clock identifier
100
+ * - Encoded as base32-sortable (chars: 234567abcdefghijklmnopqrstuvwxyz)
101
+ * - Always 13 characters
102
+ */
103
+ const BASE32_SORTABLE = '234567abcdefghijklmnopqrstuvwxyz';
104
+ function generateTid() {
105
+ const now = Date.now() * 1000; // Convert to microseconds
106
+ const clockId = Math.floor(Math.random() * 1024); // 10 bits
107
+ // Combine: (timestamp << 10) | clockId
108
+ // Ensure top bit is 0 by masking with 0x7FFFFFFFFFFFFFFF
109
+ const tid = ((BigInt(now) << 10n) | BigInt(clockId)) & 0x7fffffffffffffffn;
110
+ // Encode as base32-sortable
111
+ let encoded = '';
112
+ let remaining = tid;
113
+ for (let i = 0; i < 13; i++) {
114
+ const index = Number(remaining & 31n);
115
+ encoded = BASE32_SORTABLE[index] + encoded;
116
+ remaining = remaining >> 5n;
117
+ }
118
+ return encoded;
119
+ }
120
+ /**
121
+ * Publisher for standard.site documents on ATProto
122
+ */
123
+ export class StandardSitePublisher {
124
+ agent = null;
125
+ config;
126
+ did = null;
127
+ pdsUrl = null;
128
+ constructor(config) {
129
+ this.config = PublisherConfigSchema.parse(config);
130
+ }
131
+ /**
132
+ * Authenticate with the PDS
133
+ * Automatically resolves the correct PDS from the DID document
134
+ */
135
+ async login() {
136
+ // Resolve handle to DID if needed
137
+ let did = this.config.identifier;
138
+ if (!did.startsWith('did:')) {
139
+ did = await resolveHandle(this.config.identifier);
140
+ }
141
+ this.did = did;
142
+ // Get PDS URL from DID document (unless manually overridden)
143
+ if (this.config.service) {
144
+ this.pdsUrl = this.config.service;
145
+ }
146
+ else {
147
+ this.pdsUrl = await getPdsFromDid(did);
148
+ }
149
+ // Create agent and login
150
+ this.agent = new AtpAgent({ service: this.pdsUrl });
151
+ await this.agent.login({
152
+ identifier: this.config.identifier,
153
+ password: this.config.password,
154
+ });
155
+ }
156
+ /**
157
+ * Get the authenticated DID
158
+ */
159
+ getDid() {
160
+ if (!this.did) {
161
+ throw new Error('Not logged in. Call login() first.');
162
+ }
163
+ return this.did;
164
+ }
165
+ /**
166
+ * Get the PDS URL being used
167
+ */
168
+ getPdsUrl() {
169
+ if (!this.pdsUrl) {
170
+ throw new Error('Not logged in. Call login() first.');
171
+ }
172
+ return this.pdsUrl;
173
+ }
174
+ getAgent() {
175
+ if (!this.agent) {
176
+ throw new Error('Not logged in. Call login() first.');
177
+ }
178
+ return this.agent;
179
+ }
180
+ /**
181
+ * Publish a document record
182
+ */
183
+ async publishDocument(input) {
184
+ const did = this.getDid();
185
+ const agent = this.getAgent();
186
+ const record = {
187
+ $type: 'site.standard.document',
188
+ site: input.site,
189
+ title: input.title,
190
+ publishedAt: input.publishedAt,
191
+ path: input.path,
192
+ description: input.description,
193
+ updatedAt: input.updatedAt,
194
+ tags: input.tags,
195
+ textContent: input.textContent,
196
+ content: input.content,
197
+ bskyPostRef: input.bskyPostRef,
198
+ };
199
+ // Remove undefined values
200
+ const cleanRecord = Object.fromEntries(Object.entries(record).filter(([_, v]) => v !== undefined));
201
+ // Generate TID for record key per lexicon spec (key: "tid")
202
+ const rkey = generateTid();
203
+ const response = await agent.api.com.atproto.repo.createRecord({
204
+ repo: did,
205
+ collection: COLLECTIONS.DOCUMENT,
206
+ rkey,
207
+ record: cleanRecord,
208
+ });
209
+ return {
210
+ uri: response.data.uri,
211
+ cid: response.data.cid,
212
+ };
213
+ }
214
+ /**
215
+ * Update an existing document
216
+ */
217
+ async updateDocument(rkey, input) {
218
+ const did = this.getDid();
219
+ const agent = this.getAgent();
220
+ const record = {
221
+ $type: 'site.standard.document',
222
+ site: input.site,
223
+ title: input.title,
224
+ publishedAt: input.publishedAt,
225
+ path: input.path,
226
+ description: input.description,
227
+ updatedAt: input.updatedAt ?? new Date().toISOString(),
228
+ tags: input.tags,
229
+ textContent: input.textContent,
230
+ content: input.content,
231
+ bskyPostRef: input.bskyPostRef,
232
+ };
233
+ const cleanRecord = Object.fromEntries(Object.entries(record).filter(([_, v]) => v !== undefined));
234
+ const response = await agent.api.com.atproto.repo.putRecord({
235
+ repo: did,
236
+ collection: COLLECTIONS.DOCUMENT,
237
+ rkey,
238
+ record: cleanRecord,
239
+ });
240
+ return {
241
+ uri: response.data.uri,
242
+ cid: response.data.cid,
243
+ };
244
+ }
245
+ /**
246
+ * Delete a document
247
+ */
248
+ async deleteDocument(rkey) {
249
+ const did = this.getDid();
250
+ const agent = this.getAgent();
251
+ await agent.api.com.atproto.repo.deleteRecord({
252
+ repo: did,
253
+ collection: COLLECTIONS.DOCUMENT,
254
+ rkey,
255
+ });
256
+ }
257
+ /**
258
+ * Publish a publication record
259
+ */
260
+ async publishPublication(input) {
261
+ const did = this.getDid();
262
+ const agent = this.getAgent();
263
+ const record = {
264
+ $type: 'site.standard.publication',
265
+ name: input.name,
266
+ url: input.url,
267
+ description: input.description,
268
+ basicTheme: input.basicTheme,
269
+ preferences: input.preferences,
270
+ };
271
+ const cleanRecord = Object.fromEntries(Object.entries(record).filter(([_, v]) => v !== undefined));
272
+ // Generate TID for record key per lexicon spec (key: "tid")
273
+ const rkey = generateTid();
274
+ const response = await agent.api.com.atproto.repo.createRecord({
275
+ repo: did,
276
+ collection: COLLECTIONS.PUBLICATION,
277
+ rkey,
278
+ record: cleanRecord,
279
+ });
280
+ return {
281
+ uri: response.data.uri,
282
+ cid: response.data.cid,
283
+ };
284
+ }
285
+ /**
286
+ * Get all documents for the current account
287
+ */
288
+ async listDocuments(limit = 100) {
289
+ const did = this.getDid();
290
+ const agent = this.getAgent();
291
+ const response = await agent.api.com.atproto.repo.listRecords({
292
+ repo: did,
293
+ collection: COLLECTIONS.DOCUMENT,
294
+ limit,
295
+ });
296
+ return response.data.records.map(r => ({
297
+ uri: r.uri,
298
+ cid: r.cid,
299
+ value: r.value,
300
+ }));
301
+ }
302
+ /**
303
+ * Get all publications for the current account
304
+ */
305
+ async listPublications(limit = 100) {
306
+ const did = this.getDid();
307
+ const agent = this.getAgent();
308
+ const response = await agent.api.com.atproto.repo.listRecords({
309
+ repo: did,
310
+ collection: COLLECTIONS.PUBLICATION,
311
+ limit,
312
+ });
313
+ return response.data.records.map(r => ({
314
+ uri: r.uri,
315
+ cid: r.cid,
316
+ value: r.value,
317
+ }));
318
+ }
319
+ /**
320
+ * Get the underlying ATP agent for advanced operations
321
+ */
322
+ getAtpAgent() {
323
+ return this.getAgent();
324
+ }
325
+ }
326
+ //# sourceMappingURL=publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../src/publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,QAAQ,EAAY,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAElE;;GAEG;AACH,KAAK,UAAU,aAAa,CAAC,MAAc;IACzC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,8EAA8E,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpI,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,EAAE,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAqB,CAAC;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,IAAI,MAAW,CAAC;IAEhB,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,6BAA6B;QAC7B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,GAA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