@alteran/astro 0.3.9 → 0.6.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.
- package/LICENSE +21 -0
- package/README.md +19 -30
- package/index.js +34 -28
- package/migrations/0007_bored_spitfire.sql +26 -0
- package/migrations/0008_furry_ozymandias.sql +2 -0
- package/migrations/meta/0007_snapshot.json +534 -0
- package/migrations/meta/0008_snapshot.json +548 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +10 -9
- package/src/app.ts +8 -4
- package/src/db/account.ts +25 -6
- package/src/db/client.ts +1 -1
- package/src/db/dal.ts +34 -23
- package/src/db/repo.ts +38 -38
- package/src/db/schema.ts +5 -1
- package/src/db/seed.ts +5 -13
- package/src/entrypoints/server.ts +2 -22
- package/src/handlers/debug.ts +1 -1
- package/src/handlers/ready.ts +1 -1
- package/src/handlers/root.ts +4 -4
- package/src/handlers/xrpc.server.refreshSession.ts +6 -6
- package/src/lib/account-state.ts +156 -0
- package/src/lib/actor.ts +29 -13
- package/src/lib/appview/auth-policy.ts +66 -0
- package/src/lib/appview/did-resolver.ts +233 -0
- package/src/lib/appview/proxy.ts +221 -0
- package/src/lib/appview/service-config.ts +61 -0
- package/src/lib/appview/service-jwt.ts +93 -0
- package/src/lib/appview/types.ts +25 -0
- package/src/lib/appview.ts +5 -532
- package/src/lib/auth-errors.ts +24 -0
- package/src/lib/auth.ts +63 -15
- package/src/lib/blockstore-gc.ts +6 -5
- package/src/lib/cache.ts +30 -4
- package/src/lib/chat.ts +20 -14
- package/src/lib/commit-log-pruning.ts +2 -2
- package/src/lib/commit.ts +26 -36
- package/src/lib/config.ts +26 -15
- package/src/lib/did-document.ts +32 -0
- package/src/lib/errors.ts +54 -0
- package/src/lib/feed.ts +18 -19
- package/src/lib/firehose/frames.ts +87 -47
- package/src/lib/firehose/validation.ts +3 -3
- package/src/lib/jwt.ts +85 -177
- package/src/lib/labeler.ts +43 -30
- package/src/lib/logger.ts +4 -0
- package/src/lib/mst/block-map.ts +172 -0
- package/src/lib/mst/blockstore.ts +56 -93
- package/src/lib/mst/index.ts +1 -0
- package/src/lib/mst/leaf.ts +25 -0
- package/src/lib/mst/mst.ts +81 -237
- package/src/lib/mst/serialize.ts +97 -0
- package/src/lib/mst/types.ts +21 -0
- package/src/lib/oauth/clients.ts +67 -0
- package/src/lib/oauth/dpop-errors.ts +15 -0
- package/src/lib/oauth/dpop.ts +150 -0
- package/src/lib/oauth/resource.ts +199 -0
- package/src/lib/oauth/store.ts +77 -0
- package/src/lib/preferences.ts +12 -37
- package/src/lib/ratelimit.ts +4 -4
- package/src/lib/refresh-session.ts +161 -0
- package/src/lib/relay.ts +10 -8
- package/src/lib/secrets.ts +6 -7
- package/src/lib/sequencer.ts +14 -5
- package/src/lib/service-auth.ts +184 -0
- package/src/lib/session-tokens.ts +28 -76
- package/src/lib/streaming-car.ts +3 -0
- package/src/lib/tracing.ts +4 -3
- package/src/lib/util.ts +65 -15
- package/src/middleware.ts +1 -1
- package/src/pages/.well-known/did.json.ts +27 -30
- package/src/pages/.well-known/oauth-authorization-server.ts +31 -0
- package/src/pages/.well-known/oauth-protected-resource.ts +22 -0
- package/src/pages/debug/blob/[...key].ts +2 -2
- package/src/pages/debug/db/bootstrap.ts +1 -1
- package/src/pages/debug/db/commits.ts +1 -1
- package/src/pages/debug/gc/blobs.ts +1 -1
- package/src/pages/debug/record.ts +1 -1
- package/src/pages/debug/sequencer.ts +28 -0
- package/src/pages/health.ts +4 -4
- package/src/pages/oauth/authorize.ts +78 -0
- package/src/pages/oauth/consent.ts +80 -0
- package/src/pages/oauth/par.ts +121 -0
- package/src/pages/oauth/token.ts +158 -0
- package/src/pages/ready.ts +2 -2
- package/src/pages/xrpc/[...nsid].ts +61 -0
- package/src/pages/xrpc/app.bsky.actor.getPreferences.ts +12 -13
- package/src/pages/xrpc/app.bsky.actor.putPreferences.ts +23 -23
- package/src/pages/xrpc/app.bsky.unspecced.getAgeAssuranceState.ts +9 -2
- package/src/pages/xrpc/chat.bsky.convo.getLog.ts +9 -2
- package/src/pages/xrpc/chat.bsky.convo.listConvos.ts +9 -2
- package/src/pages/xrpc/com.atproto.identity.getRecommendedDidCredentials.ts +43 -41
- package/src/pages/xrpc/com.atproto.identity.requestPlcOperationSignature.ts +10 -3
- package/src/pages/xrpc/com.atproto.identity.resolveHandle.ts +40 -9
- package/src/pages/xrpc/com.atproto.identity.signPlcOperation.ts +41 -29
- package/src/pages/xrpc/com.atproto.identity.submitPlcOperation.ts +20 -6
- package/src/pages/xrpc/com.atproto.identity.updateHandle.ts +1 -1
- package/src/pages/xrpc/com.atproto.repo.applyWrites.ts +101 -11
- package/src/pages/xrpc/com.atproto.repo.createRecord.ts +44 -14
- package/src/pages/xrpc/com.atproto.repo.deleteRecord.ts +41 -13
- package/src/pages/xrpc/com.atproto.repo.describeRepo.ts +2 -2
- package/src/pages/xrpc/com.atproto.repo.getRecord.ts +14 -1
- package/src/pages/xrpc/com.atproto.repo.listMissingBlobs.ts +14 -6
- package/src/pages/xrpc/com.atproto.repo.listRecords.ts +1 -1
- package/src/pages/xrpc/com.atproto.repo.putRecord.ts +42 -14
- package/src/pages/xrpc/com.atproto.repo.uploadBlob.ts +76 -15
- package/src/pages/xrpc/com.atproto.server.checkAccountStatus.ts +20 -8
- package/src/pages/xrpc/com.atproto.server.createSession.ts +32 -12
- package/src/pages/xrpc/com.atproto.server.describeServer.ts +1 -1
- package/src/pages/xrpc/com.atproto.server.getServiceAuth.ts +12 -5
- package/src/pages/xrpc/com.atproto.server.getSession.ts +22 -8
- package/src/pages/xrpc/com.atproto.server.refreshSession.ts +30 -72
- package/src/pages/xrpc/com.atproto.sync.getBlob.ts +72 -23
- package/src/pages/xrpc/com.atproto.sync.getCheckout.json.ts +1 -1
- package/src/pages/xrpc/com.atproto.sync.getCheckout.ts +1 -1
- package/src/pages/xrpc/com.atproto.sync.getHead.ts +7 -2
- package/src/pages/xrpc/com.atproto.sync.getLatestCommit.ts +1 -1
- package/src/pages/xrpc/com.atproto.sync.getRecord.ts +5 -27
- package/src/pages/xrpc/com.atproto.sync.getRepo.json.ts +1 -1
- package/src/pages/xrpc/com.atproto.sync.getRepo.ts +50 -5
- package/src/pages/xrpc/com.atproto.sync.getRepoStatus.ts +58 -0
- package/src/pages/xrpc/com.atproto.sync.listBlobs.ts +2 -2
- package/src/pages/xrpc/com.atproto.sync.listRepos.ts +5 -3
- package/src/services/car.ts +209 -57
- package/src/services/r2-blob-store.ts +4 -4
- package/src/services/repo/blockstore-ops.ts +29 -0
- package/src/services/repo/operations.ts +133 -0
- package/src/services/repo-manager.ts +203 -254
- package/src/worker/runtime.ts +56 -11
- package/src/worker/sequencer/broadcast.ts +91 -0
- package/src/worker/sequencer/cid-helpers.ts +39 -0
- package/src/worker/sequencer/payload.ts +84 -0
- package/src/worker/sequencer/types.ts +36 -0
- package/src/worker/sequencer/upgrade.ts +141 -0
- package/src/worker/sequencer.ts +264 -406
- package/types/env.d.ts +18 -6
- package/src/pages/xrpc/app.bsky.actor.getProfile.ts +0 -49
- package/src/pages/xrpc/app.bsky.actor.getProfiles.ts +0 -51
- package/src/pages/xrpc/app.bsky.feed.getActorFeeds.ts +0 -25
- package/src/pages/xrpc/app.bsky.feed.getAuthorFeed.ts +0 -42
- package/src/pages/xrpc/app.bsky.feed.getFeedGenerators.ts +0 -25
- package/src/pages/xrpc/app.bsky.feed.getPostThread.ts +0 -37
- package/src/pages/xrpc/app.bsky.feed.getPosts.ts +0 -26
- package/src/pages/xrpc/app.bsky.feed.getSuggestedFeeds.ts +0 -23
- package/src/pages/xrpc/app.bsky.feed.getTimeline.ts +0 -47
- package/src/pages/xrpc/app.bsky.graph.getFollowers.ts +0 -29
- package/src/pages/xrpc/app.bsky.graph.getFollows.ts +0 -29
- package/src/pages/xrpc/app.bsky.notification.getUnreadCount.ts +0 -20
- package/src/pages/xrpc/app.bsky.notification.listNotifications.ts +0 -27
- package/src/pages/xrpc/app.bsky.unspecced.getSuggestedFeeds.ts +0 -23
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rawkode Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Alteran
|
|
2
2
|
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> This project was built using agentic coding tools and is currently undergoing a systematic review by a human in their spare time. Nobody should use this project as their PDS yet.
|
|
5
|
+
|
|
3
6
|
## Astro Integration
|
|
4
7
|
|
|
5
8
|
This repository now ships an Astro integration that turns any Cloudflare Worker-backed Astro app into a single-user ATProto Personal Data Server. Install the package (or link it locally), then add the integration to your `astro.config.mjs`:
|
|
@@ -111,15 +114,15 @@ This project uses Drizzle Kit for database schema management and migrations.
|
|
|
111
114
|
### Migration Workflow
|
|
112
115
|
|
|
113
116
|
1. **Modify Schema**: Edit [`src/db/schema.ts`](src/db/schema.ts:1) to add/modify tables or indexes
|
|
114
|
-
2. **Generate Migration**: Run `bun run db:generate` to create a new migration file in `
|
|
115
|
-
3. **Review Migration**: Check the generated SQL in `
|
|
117
|
+
2. **Generate Migration**: Run `bun run db:generate` to create a new migration file in `migrations/`
|
|
118
|
+
3. **Review Migration**: Check the generated SQL in `migrations/XXXX_*.sql`
|
|
116
119
|
4. **Apply Locally**: Run `bun run db:apply:local` to apply to local D1 database
|
|
117
120
|
5. **Apply to Production**: Run `wrangler d1 migrations apply pds --remote` after deployment
|
|
118
121
|
|
|
119
122
|
### Migration Versioning
|
|
120
123
|
|
|
121
124
|
- Migrations are versioned sequentially (0000, 0001, 0002, etc.)
|
|
122
|
-
- Each migration is tracked in `
|
|
125
|
+
- Each migration is tracked in `migrations/meta/_journal.json`
|
|
123
126
|
- Migrations are applied in order and cannot be skipped
|
|
124
127
|
- Applied migrations are recorded in D1's `_cf_KV` table
|
|
125
128
|
|
|
@@ -181,7 +184,7 @@ Set these secrets for each environment using `wrangler secret put <NAME> --env <
|
|
|
181
184
|
| `USER_PASSWORD` | Login password | Strong password |
|
|
182
185
|
| `ACCESS_TOKEN` | JWT access token secret | Random 32+ char string |
|
|
183
186
|
| `REFRESH_TOKEN` | JWT refresh token secret | Random 32+ char string |
|
|
184
|
-
| `REPO_SIGNING_KEY` |
|
|
187
|
+
| `REPO_SIGNING_KEY` | secp256k1 signing key (hex or base64 32 bytes). Used for commits and service-auth | From `scripts/setup-secrets.ts` |
|
|
185
188
|
|
|
186
189
|
**Generate secrets:**
|
|
187
190
|
```bash
|
|
@@ -189,9 +192,6 @@ Set these secrets for each environment using `wrangler secret put <NAME> --env <
|
|
|
189
192
|
# Generates all required secrets and prints wrangler commands
|
|
190
193
|
bun run scripts/setup-secrets.ts --env production --did did:web:example.com --handle user.example.com
|
|
191
194
|
|
|
192
|
-
# Or generate only the repo signing key
|
|
193
|
-
bun run scripts/generate-signing-key.ts
|
|
194
|
-
|
|
195
195
|
# After generation, set secrets (example for production)
|
|
196
196
|
wrangler secret put PDS_DID --env production
|
|
197
197
|
wrangler secret put PDS_HANDLE --env production
|
|
@@ -199,8 +199,6 @@ wrangler secret put USER_PASSWORD --env production
|
|
|
199
199
|
wrangler secret put ACCESS_TOKEN --env production
|
|
200
200
|
wrangler secret put REFRESH_TOKEN --env production
|
|
201
201
|
wrangler secret put REPO_SIGNING_KEY --env production
|
|
202
|
-
# Optional: publish public key for DID document
|
|
203
|
-
wrangler secret put REPO_SIGNING_KEY_PUBLIC --env production
|
|
204
202
|
```
|
|
205
203
|
|
|
206
204
|
### Using Cloudflare Secret Store (optional)
|
|
@@ -333,7 +331,7 @@ This PDS now implements full AT Protocol core compliance with:
|
|
|
333
331
|
- ✅ D1 blockstore integration
|
|
334
332
|
|
|
335
333
|
### Signed Commits
|
|
336
|
-
- ✅
|
|
334
|
+
- ✅ secp256k1 cryptographic signatures
|
|
337
335
|
- ✅ AT Protocol v3 commit structure
|
|
338
336
|
- ✅ TID-based revisions
|
|
339
337
|
- ✅ Commit chain tracking
|
|
@@ -358,31 +356,26 @@ This PDS now implements full AT Protocol core compliance with:
|
|
|
358
356
|
# Recommended: bootstrap all secrets (prints wrangler commands)
|
|
359
357
|
bun run scripts/setup-secrets.ts --env production --did did:web:example.com --handle user.example.com
|
|
360
358
|
|
|
361
|
-
#
|
|
362
|
-
bun run scripts/generate-signing-key.ts
|
|
359
|
+
# Alternatively, supply your own secp256k1 key (32‑byte hex/base64)
|
|
363
360
|
```
|
|
364
361
|
|
|
365
362
|
### 2. Configure Secrets
|
|
366
363
|
|
|
367
364
|
**Required Secrets:**
|
|
368
365
|
```bash
|
|
369
|
-
wrangler secret put REPO_SIGNING_KEY
|
|
370
|
-
wrangler secret put PDS_DID
|
|
371
|
-
wrangler secret put PDS_HANDLE
|
|
372
|
-
wrangler secret put USER_PASSWORD
|
|
366
|
+
wrangler secret put REPO_SIGNING_KEY # secp256k1 (from setup-secrets)
|
|
367
|
+
wrangler secret put PDS_DID # Your DID
|
|
368
|
+
wrangler secret put PDS_HANDLE # Your handle
|
|
369
|
+
wrangler secret put USER_PASSWORD # Login password
|
|
373
370
|
wrangler secret put REFRESH_TOKEN
|
|
374
371
|
wrangler secret put REFRESH_TOKEN_SECRET
|
|
375
|
-
# Optional: publish raw public key for DID document
|
|
376
|
-
wrangler secret put REPO_SIGNING_KEY_PUBLIC
|
|
377
372
|
```
|
|
378
373
|
|
|
379
374
|
**For Local Development (.dev.vars):**
|
|
380
375
|
```env
|
|
381
376
|
PDS_DID=did:plc:your-did-here
|
|
382
377
|
PDS_HANDLE=your-handle.bsky.social
|
|
383
|
-
REPO_SIGNING_KEY=<
|
|
384
|
-
# Optional: publish raw 32-byte public key in did.json
|
|
385
|
-
REPO_SIGNING_KEY_PUBLIC=<base64-raw-public-key>
|
|
378
|
+
REPO_SIGNING_KEY=<hex-secp256k1-private-key>
|
|
386
379
|
USER_PASSWORD=your-password
|
|
387
380
|
REFRESH_TOKEN=your-access-secret
|
|
388
381
|
REFRESH_TOKEN_SECRET=your-refresh-secret
|
|
@@ -458,7 +451,7 @@ curl "http://localhost:4321/xrpc/com.atproto.repo.listRecords?repo=did:example:s
|
|
|
458
451
|
- [`PROGRESS.md`](PROGRESS.md) - Development progress notes
|
|
459
452
|
|
|
460
453
|
Repo signing key (REQUIRED)
|
|
461
|
-
|
|
454
|
+
|
|
462
455
|
- Store as `REPO_SIGNING_KEY` secret (base64-encoded private key)
|
|
463
456
|
|
|
464
457
|
## P1 Implementation - Production Readiness 🚀
|
|
@@ -470,7 +463,7 @@ This PDS now includes production-grade features for security, observability, and
|
|
|
470
463
|
- ✅ **Token rotation** on every refresh
|
|
471
464
|
- ✅ **Automatic token cleanup** (lazy cleanup on 1% of requests)
|
|
472
465
|
- ✅ **Account lockout** after 5 failed login attempts (15-minute lockout)
|
|
473
|
-
|
|
466
|
+
|
|
474
467
|
- ✅ **Proper JWT claims**: `sub`, `aud`, `iat`, `exp`, `jti`, `scope`
|
|
475
468
|
- ✅ **Production CORS validation** (no wildcard in production)
|
|
476
469
|
|
|
@@ -490,15 +483,11 @@ This PDS now includes production-grade features for security, observability, and
|
|
|
490
483
|
|
|
491
484
|
**JWT Configuration:**
|
|
492
485
|
```bash
|
|
493
|
-
#
|
|
486
|
+
# Service-auth uses ES256K (secp256k1) exclusively
|
|
494
487
|
PDS_HOSTNAME=your-pds.example.com
|
|
495
488
|
PDS_ACCESS_TTL_SEC=3600 # 1 hour
|
|
496
489
|
PDS_REFRESH_TTL_SEC=2592000 # 30 days
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
# For EdDSA (optional)
|
|
500
|
-
JWT_ED25519_PRIVATE_KEY=<base64-encoded-key>
|
|
501
|
-
JWT_ED25519_PUBLIC_KEY=<base64-encoded-key>
|
|
490
|
+
# No JWT_ALGORITHM flag; ES256K is always used for AppView service tokens
|
|
502
491
|
```
|
|
503
492
|
|
|
504
493
|
**CORS Configuration:**
|
|
@@ -560,7 +549,7 @@ Returns `503` if any dependency is unhealthy.
|
|
|
560
549
|
|
|
561
550
|
1. **Never use wildcard CORS in production** - Set explicit origins in `PDS_CORS_ORIGIN`
|
|
562
551
|
2. **Use strong secrets** - Generate cryptographically secure values for all secrets
|
|
563
|
-
3. **
|
|
552
|
+
3. **Use ES256K (secp256k1) signing**
|
|
564
553
|
4. **Monitor failed login attempts** - Check logs for suspicious activity
|
|
565
554
|
5. **Set appropriate token TTLs** - Balance security and user experience
|
|
566
555
|
|
package/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const CORE_ROUTES = [
|
|
|
36
36
|
{ pattern: '/xrpc/com.atproto.sync.getLatestCommit', entrypoint: './src/pages/xrpc/com.atproto.sync.getLatestCommit.ts' },
|
|
37
37
|
{ pattern: '/xrpc/com.atproto.sync.getRecord', entrypoint: './src/pages/xrpc/com.atproto.sync.getRecord.ts' },
|
|
38
38
|
{ pattern: '/xrpc/com.atproto.sync.getRepo', entrypoint: './src/pages/xrpc/com.atproto.sync.getRepo.ts' },
|
|
39
|
+
{ pattern: '/xrpc/com.atproto.sync.getRepoStatus', entrypoint: './src/pages/xrpc/com.atproto.sync.getRepoStatus.ts' },
|
|
39
40
|
{ pattern: '/xrpc/com.atproto.sync.getRepo.json', entrypoint: './src/pages/xrpc/com.atproto.sync.getRepo.json.ts' },
|
|
40
41
|
{ pattern: '/xrpc/com.atproto.sync.getRepo.range', entrypoint: './src/pages/xrpc/com.atproto.sync.getRepo.range.ts' },
|
|
41
42
|
{ pattern: '/xrpc/com.atproto.sync.listBlobs', entrypoint: './src/pages/xrpc/com.atproto.sync.listBlobs.ts' },
|
|
@@ -43,22 +44,14 @@ const CORE_ROUTES = [
|
|
|
43
44
|
// Additional atproto endpoints
|
|
44
45
|
{ pattern: '/xrpc/com.atproto.identity.signPlcOperation', entrypoint: './src/pages/xrpc/com.atproto.identity.signPlcOperation.ts' },
|
|
45
46
|
{ pattern: '/xrpc/com.atproto.server.getServiceAuth', entrypoint: './src/pages/xrpc/com.atproto.server.getServiceAuth.ts' },
|
|
46
|
-
// AppView proxy endpoints (bsky)
|
|
47
|
-
{ pattern: '/xrpc/app.bsky.actor.getProfile', entrypoint: './src/pages/xrpc/app.bsky.actor.getProfile.ts' },
|
|
48
|
-
{ pattern: '/xrpc/app.bsky.actor.getProfiles', entrypoint: './src/pages/xrpc/app.bsky.actor.getProfiles.ts' },
|
|
47
|
+
// AppView proxy endpoints (bsky) — local-only where required
|
|
49
48
|
{ pattern: '/xrpc/app.bsky.actor.getPreferences', entrypoint: './src/pages/xrpc/app.bsky.actor.getPreferences.ts' },
|
|
50
49
|
{ pattern: '/xrpc/app.bsky.actor.putPreferences', entrypoint: './src/pages/xrpc/app.bsky.actor.putPreferences.ts' },
|
|
51
|
-
{ pattern: '/xrpc/app.bsky.feed.getAuthorFeed', entrypoint: './src/pages/xrpc/app.bsky.feed.getAuthorFeed.ts' },
|
|
52
|
-
{ pattern: '/xrpc/app.bsky.feed.getPostThread', entrypoint: './src/pages/xrpc/app.bsky.feed.getPostThread.ts' },
|
|
53
|
-
{ pattern: '/xrpc/app.bsky.feed.getPosts', entrypoint: './src/pages/xrpc/app.bsky.feed.getPosts.ts' },
|
|
54
|
-
{ pattern: '/xrpc/app.bsky.feed.getTimeline', entrypoint: './src/pages/xrpc/app.bsky.feed.getTimeline.ts' },
|
|
55
|
-
{ pattern: '/xrpc/app.bsky.graph.getFollowers', entrypoint: './src/pages/xrpc/app.bsky.graph.getFollowers.ts' },
|
|
56
|
-
{ pattern: '/xrpc/app.bsky.graph.getFollows', entrypoint: './src/pages/xrpc/app.bsky.graph.getFollows.ts' },
|
|
57
50
|
{ pattern: '/xrpc/app.bsky.labeler.getServices', entrypoint: './src/pages/xrpc/app.bsky.labeler.getServices.ts' },
|
|
58
|
-
{ pattern: '/xrpc/app.bsky.notification.getUnreadCount', entrypoint: './src/pages/xrpc/app.bsky.notification.getUnreadCount.ts' },
|
|
59
|
-
{ pattern: '/xrpc/app.bsky.notification.listNotifications', entrypoint: './src/pages/xrpc/app.bsky.notification.listNotifications.ts' },
|
|
60
51
|
{ pattern: '/xrpc/app.bsky.unspecced.getAgeAssuranceState', entrypoint: './src/pages/xrpc/app.bsky.unspecced.getAgeAssuranceState.ts' },
|
|
61
52
|
{ pattern: '/xrpc/app.bsky.unspecced.getConfig', entrypoint: './src/pages/xrpc/app.bsky.unspecced.getConfig.ts' },
|
|
53
|
+
// Catchall for proxied XRPC endpoints (app.bsky.*, chat.bsky.*, tools.ozone.*)
|
|
54
|
+
{ pattern: '/xrpc/[...nsid]', entrypoint: './src/pages/xrpc/[...nsid].ts' },
|
|
62
55
|
// Chat endpoints (proxied)
|
|
63
56
|
{ pattern: '/xrpc/chat.bsky.convo.getLog', entrypoint: './src/pages/xrpc/chat.bsky.convo.getLog.ts' },
|
|
64
57
|
{ pattern: '/xrpc/chat.bsky.convo.listConvos', entrypoint: './src/pages/xrpc/chat.bsky.convo.listConvos.ts' },
|
|
@@ -75,6 +68,7 @@ const DEBUG_ROUTES = [
|
|
|
75
68
|
{ pattern: '/debug/db/commits', entrypoint: './src/pages/debug/db/commits.ts' },
|
|
76
69
|
{ pattern: '/debug/gc/blobs', entrypoint: './src/pages/debug/gc/blobs.ts' },
|
|
77
70
|
{ pattern: '/debug/record', entrypoint: './src/pages/debug/record.ts' },
|
|
71
|
+
{ pattern: '/debug/sequencer', entrypoint: './src/pages/debug/sequencer.ts' },
|
|
78
72
|
];
|
|
79
73
|
|
|
80
74
|
const pkgRoot = new URL('.', import.meta.url);
|
|
@@ -133,23 +127,35 @@ export default function alteran(options = {}) {
|
|
|
133
127
|
enforce: 'post',
|
|
134
128
|
apply: 'build',
|
|
135
129
|
transform(code, id) {
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
|
|
130
|
+
if (code.includes("_exports['Sequencer']") || code.includes('_exports.Sequencer')) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Astro 6: virtual:astro:legacy-ssr-entry — the resolved id is `\0virtual:astro:legacy-ssr-entry`.
|
|
135
|
+
// The body is a thin wrapper that re-exports `_exports.default`; we tack on a named Sequencer export.
|
|
136
|
+
if (id.includes('virtual:astro:legacy-ssr-entry')) {
|
|
137
|
+
return {
|
|
138
|
+
code: `${code}\nexport const Sequencer = _exports['Sequencer'];\n`,
|
|
139
|
+
map: null,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Astro 5: @astrojs-ssr-virtual-entry — the body assigns `_exports` and exports a default; patch both.
|
|
144
|
+
if (id.includes('@astrojs-ssr-virtual-entry')) {
|
|
145
|
+
if (!code.includes('const _exports = createExports')) return null;
|
|
146
|
+
const withSequencer = code.replace(
|
|
147
|
+
'const __astrojsSsrVirtualEntry = _exports.default;',
|
|
148
|
+
"const Sequencer = _exports['Sequencer'];\nconst __astrojsSsrVirtualEntry = _exports.default;",
|
|
149
|
+
);
|
|
150
|
+
if (withSequencer === code) return null;
|
|
151
|
+
const reexported = withSequencer.replace(
|
|
152
|
+
'export { __astrojsSsrVirtualEntry as default, pageMap };',
|
|
153
|
+
'export { Sequencer, __astrojsSsrVirtualEntry as default, pageMap };',
|
|
154
|
+
);
|
|
155
|
+
return { code: reexported, map: null };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return null;
|
|
153
159
|
},
|
|
154
160
|
});
|
|
155
161
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
CREATE TABLE `account` (
|
|
2
|
+
`did` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`handle` text NOT NULL,
|
|
4
|
+
`password_scrypt` text,
|
|
5
|
+
`email` text,
|
|
6
|
+
`created_at` integer NOT NULL,
|
|
7
|
+
`updated_at` integer NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE UNIQUE INDEX `account_handle_unique` ON `account` (`handle`);--> statement-breakpoint
|
|
11
|
+
CREATE TABLE `refresh_token` (
|
|
12
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
13
|
+
`did` text NOT NULL,
|
|
14
|
+
`expires_at` integer NOT NULL,
|
|
15
|
+
`app_password_name` text,
|
|
16
|
+
`next_id` text
|
|
17
|
+
);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE INDEX `refresh_token_did_idx` ON `refresh_token` (`did`);--> statement-breakpoint
|
|
20
|
+
CREATE TABLE `secret` (
|
|
21
|
+
`key` text PRIMARY KEY NOT NULL,
|
|
22
|
+
`value` text NOT NULL,
|
|
23
|
+
`updated_at` integer NOT NULL
|
|
24
|
+
);
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
DROP TABLE `token_revocation`;
|