@atproto/bsky 0.0.206 → 0.0.208
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/CHANGELOG.md +19 -0
- package/dist/api/well-known.d.ts.map +1 -1
- package/dist/api/well-known.js +3 -3
- package/dist/api/well-known.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +16 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +8 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +4 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +6 -6
- package/src/api/well-known.ts +3 -3
- package/src/lexicon/lexicons.ts +8 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +2 -0
- package/src/views/index.ts +4 -1
- package/tests/views/__snapshots__/profile.test.ts.snap +6 -2
- package/tests/views/profile.test.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.208",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"zod": "3.23.8",
|
|
54
54
|
"@atproto-labs/fetch-node": "0.2.0",
|
|
55
55
|
"@atproto-labs/xrpc-utils": "0.0.24",
|
|
56
|
-
"@atproto/api": "^0.18.
|
|
57
|
-
"@atproto/common": "^0.5.
|
|
56
|
+
"@atproto/api": "^0.18.12",
|
|
57
|
+
"@atproto/common": "^0.5.7",
|
|
58
58
|
"@atproto/crypto": "^0.4.5",
|
|
59
59
|
"@atproto/did": "^0.2.4",
|
|
60
60
|
"@atproto/identity": "^0.4.10",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atproto/repo": "^0.8.12",
|
|
63
63
|
"@atproto/sync": "^0.1.39",
|
|
64
64
|
"@atproto/syntax": "^0.4.2",
|
|
65
|
-
"@atproto/xrpc-server": "^0.10.
|
|
65
|
+
"@atproto/xrpc-server": "^0.10.8"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@bufbuild/buf": "^1.28.1",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"jest": "^28.1.2",
|
|
79
79
|
"ts-node": "^10.8.2",
|
|
80
80
|
"typescript": "^5.6.3",
|
|
81
|
-
"@atproto/api": "^0.18.
|
|
81
|
+
"@atproto/api": "^0.18.12",
|
|
82
82
|
"@atproto/lex-cli": "^0.9.8",
|
|
83
|
-
"@atproto/pds": "^0.4.
|
|
83
|
+
"@atproto/pds": "^0.4.203",
|
|
84
84
|
"@atproto/xrpc": "^0.7.7"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
package/src/api/well-known.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Router } from 'express'
|
|
2
|
+
import { didWebToUrl, isDidWeb } from '@atproto/did'
|
|
2
3
|
import { AppContext } from '../context'
|
|
3
4
|
|
|
4
5
|
export const createRouter = (ctx: AppContext): Router => {
|
|
5
6
|
const router = Router()
|
|
6
7
|
|
|
7
8
|
const did = ctx.cfg.serverDid
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
const serviceEndpoint = `https://${hostname}`
|
|
9
|
+
if (isDidWeb(did)) {
|
|
10
|
+
const serviceEndpoint = didWebToUrl(did).origin
|
|
11
11
|
|
|
12
12
|
router.get('/.well-known/did.json', (_req, res) => {
|
|
13
13
|
res.json({
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -812,6 +812,14 @@ export const schemaDict = {
|
|
|
812
812
|
type: 'object',
|
|
813
813
|
required: ['status', 'record'],
|
|
814
814
|
properties: {
|
|
815
|
+
uri: {
|
|
816
|
+
type: 'string',
|
|
817
|
+
format: 'at-uri',
|
|
818
|
+
},
|
|
819
|
+
cid: {
|
|
820
|
+
type: 'string',
|
|
821
|
+
format: 'cid',
|
|
822
|
+
},
|
|
815
823
|
status: {
|
|
816
824
|
type: 'string',
|
|
817
825
|
description: 'The status for the account.',
|
|
@@ -652,6 +652,8 @@ export function validatePostInteractionSettingsPref<V>(v: V) {
|
|
|
652
652
|
|
|
653
653
|
export interface StatusView {
|
|
654
654
|
$type?: 'app.bsky.actor.defs#statusView'
|
|
655
|
+
uri?: string
|
|
656
|
+
cid?: string
|
|
655
657
|
/** The status for the account. */
|
|
656
658
|
status: 'app.bsky.actor.status#live' | (string & {})
|
|
657
659
|
record: { [_ in string]: unknown }
|
package/src/views/index.ts
CHANGED
|
@@ -545,7 +545,8 @@ export class Views {
|
|
|
545
545
|
if (!actor?.status) return
|
|
546
546
|
|
|
547
547
|
const { status } = actor
|
|
548
|
-
const { record, sortedAt } = status
|
|
548
|
+
const { record, sortedAt, cid } = status
|
|
549
|
+
const uri = AtUri.make(did, ids.AppBskyActorStatus, 'self').toString()
|
|
549
550
|
|
|
550
551
|
const minDuration = 5 * MINUTE
|
|
551
552
|
const maxDuration = 4 * HOUR
|
|
@@ -564,6 +565,8 @@ export class Views {
|
|
|
564
565
|
const isActive = expiresAtMs ? expiresAtMs > Date.now() : undefined
|
|
565
566
|
|
|
566
567
|
return {
|
|
568
|
+
uri,
|
|
569
|
+
cid,
|
|
567
570
|
record: record,
|
|
568
571
|
status: record.status,
|
|
569
572
|
embed: isExternalEmbed(record.embed)
|
|
@@ -703,6 +703,7 @@ Object {
|
|
|
703
703
|
|
|
704
704
|
exports[`pds profile views status returns active status when within the duration 1`] = `
|
|
705
705
|
Object {
|
|
706
|
+
"cid": "cids(0)",
|
|
706
707
|
"embed": Object {
|
|
707
708
|
"$type": "app.bsky.embed.external#view",
|
|
708
709
|
"external": Object {
|
|
@@ -728,11 +729,13 @@ Object {
|
|
|
728
729
|
"status": "app.bsky.actor.status#live",
|
|
729
730
|
},
|
|
730
731
|
"status": "app.bsky.actor.status#live",
|
|
732
|
+
"uri": "record(0)",
|
|
731
733
|
}
|
|
732
734
|
`;
|
|
733
735
|
|
|
734
736
|
exports[`pds profile views status when outside the duration returns inactive status 1`] = `
|
|
735
737
|
Object {
|
|
738
|
+
"cid": "cids(0)",
|
|
736
739
|
"embed": Object {
|
|
737
740
|
"$type": "app.bsky.embed.external#view",
|
|
738
741
|
"external": Object {
|
|
@@ -741,11 +744,11 @@ Object {
|
|
|
741
744
|
"uri": "https://example.com",
|
|
742
745
|
},
|
|
743
746
|
},
|
|
744
|
-
"expiresAt": "
|
|
747
|
+
"expiresAt": "1970-01-01T00:00:00.000Z",
|
|
745
748
|
"isActive": false,
|
|
746
749
|
"record": Object {
|
|
747
750
|
"$type": "app.bsky.actor.status",
|
|
748
|
-
"createdAt": "
|
|
751
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
749
752
|
"durationMinutes": 10,
|
|
750
753
|
"embed": Object {
|
|
751
754
|
"$type": "app.bsky.embed.external",
|
|
@@ -758,5 +761,6 @@ Object {
|
|
|
758
761
|
"status": "app.bsky.actor.status#live",
|
|
759
762
|
},
|
|
760
763
|
"status": "app.bsky.actor.status#live",
|
|
764
|
+
"uri": "record(0)",
|
|
761
765
|
}
|
|
762
766
|
`;
|
|
@@ -490,7 +490,7 @@ describe('pds profile views', () => {
|
|
|
490
490
|
)
|
|
491
491
|
|
|
492
492
|
// Doesn't need `forSnapshot` because the dates are already mocked.
|
|
493
|
-
expect(data.status).toMatchSnapshot()
|
|
493
|
+
expect(forSnapshot(data.status)).toMatchSnapshot()
|
|
494
494
|
})
|
|
495
495
|
})
|
|
496
496
|
|
|
@@ -530,7 +530,7 @@ describe('pds profile views', () => {
|
|
|
530
530
|
},
|
|
531
531
|
)
|
|
532
532
|
|
|
533
|
-
expect(data.status).toBeUndefined()
|
|
533
|
+
expect(forSnapshot(data.status)).toBeUndefined()
|
|
534
534
|
})
|
|
535
535
|
})
|
|
536
536
|
})
|