@atproto/bsky 0.0.198 → 0.0.200
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 +26 -0
- package/dist/api/age-assurance/const.d.ts +11 -0
- package/dist/api/age-assurance/const.d.ts.map +1 -0
- package/dist/api/age-assurance/const.js +142 -0
- package/dist/api/age-assurance/const.js.map +1 -0
- package/dist/api/age-assurance/index.d.ts +4 -0
- package/dist/api/age-assurance/index.d.ts.map +1 -0
- package/dist/api/age-assurance/index.js +24 -0
- package/dist/api/age-assurance/index.js.map +1 -0
- package/dist/api/age-assurance/kws/age-verified.d.ts +109 -0
- package/dist/api/age-assurance/kws/age-verified.d.ts.map +1 -0
- package/dist/api/age-assurance/kws/age-verified.js +63 -0
- package/dist/api/age-assurance/kws/age-verified.js.map +1 -0
- package/dist/api/age-assurance/kws/const.d.ts +13 -0
- package/dist/api/age-assurance/kws/const.d.ts.map +1 -0
- package/dist/api/age-assurance/kws/const.js +36 -0
- package/dist/api/age-assurance/kws/const.js.map +1 -0
- package/dist/api/age-assurance/kws/external-payload.d.ts +75 -0
- package/dist/api/age-assurance/kws/external-payload.d.ts.map +1 -0
- package/dist/api/age-assurance/kws/external-payload.js +124 -0
- package/dist/api/age-assurance/kws/external-payload.js.map +1 -0
- package/dist/api/age-assurance/kws/external-payload.test.d.ts +2 -0
- package/dist/api/age-assurance/kws/external-payload.test.d.ts.map +1 -0
- package/dist/api/age-assurance/kws/external-payload.test.js +65 -0
- package/dist/api/age-assurance/kws/external-payload.test.js.map +1 -0
- package/dist/api/age-assurance/redirects/kws-age-verified.d.ts +4 -0
- package/dist/api/age-assurance/redirects/kws-age-verified.d.ts.map +1 -0
- package/dist/api/age-assurance/redirects/kws-age-verified.js +76 -0
- package/dist/api/age-assurance/redirects/kws-age-verified.js.map +1 -0
- package/dist/api/age-assurance/stash.d.ts +4 -0
- package/dist/api/age-assurance/stash.d.ts.map +1 -0
- package/dist/api/age-assurance/stash.js +19 -0
- package/dist/api/age-assurance/stash.js.map +1 -0
- package/dist/api/age-assurance/types.d.ts +10 -0
- package/dist/api/age-assurance/types.d.ts.map +1 -0
- package/dist/api/age-assurance/types.js +3 -0
- package/dist/api/age-assurance/types.js.map +1 -0
- package/dist/api/age-assurance/util.d.ts +15 -0
- package/dist/api/age-assurance/util.d.ts.map +1 -0
- package/dist/api/age-assurance/util.js +54 -0
- package/dist/api/age-assurance/util.js.map +1 -0
- package/dist/api/age-assurance/webhooks/kws-age-verified.d.ts +4 -0
- package/dist/api/age-assurance/webhooks/kws-age-verified.d.ts.map +1 -0
- package/dist/api/age-assurance/webhooks/kws-age-verified.js +63 -0
- package/dist/api/age-assurance/webhooks/kws-age-verified.js.map +1 -0
- package/dist/api/app/bsky/ageassurance/begin.d.ts +4 -0
- package/dist/api/app/bsky/ageassurance/begin.d.ts.map +1 -0
- package/dist/api/app/bsky/ageassurance/begin.js +131 -0
- package/dist/api/app/bsky/ageassurance/begin.js.map +1 -0
- package/dist/api/app/bsky/ageassurance/getConfig.d.ts +4 -0
- package/dist/api/app/bsky/ageassurance/getConfig.d.ts.map +1 -0
- package/dist/api/app/bsky/ageassurance/getConfig.js +16 -0
- package/dist/api/app/bsky/ageassurance/getConfig.js.map +1 -0
- package/dist/api/app/bsky/ageassurance/getState.d.ts +4 -0
- package/dist/api/app/bsky/ageassurance/getState.d.ts.map +1 -0
- package/dist/api/app/bsky/ageassurance/getState.js +42 -0
- package/dist/api/app/bsky/ageassurance/getState.js.map +1 -0
- package/dist/api/app/bsky/contact/dismissMatch.d.ts +4 -0
- package/dist/api/app/bsky/contact/dismissMatch.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/dismissMatch.js +23 -0
- package/dist/api/app/bsky/contact/dismissMatch.js.map +1 -0
- package/dist/api/app/bsky/contact/getMatches.d.ts +4 -0
- package/dist/api/app/bsky/contact/getMatches.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/getMatches.js +59 -0
- package/dist/api/app/bsky/contact/getMatches.js.map +1 -0
- package/dist/api/app/bsky/contact/getSyncStatus.d.ts +4 -0
- package/dist/api/app/bsky/contact/getSyncStatus.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/getSyncStatus.js +32 -0
- package/dist/api/app/bsky/contact/getSyncStatus.js.map +1 -0
- package/dist/api/app/bsky/contact/importContacts.d.ts +4 -0
- package/dist/api/app/bsky/contact/importContacts.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/importContacts.js +62 -0
- package/dist/api/app/bsky/contact/importContacts.js.map +1 -0
- package/dist/api/app/bsky/contact/removeData.d.ts +4 -0
- package/dist/api/app/bsky/contact/removeData.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/removeData.js +22 -0
- package/dist/api/app/bsky/contact/removeData.js.map +1 -0
- package/dist/api/app/bsky/contact/startPhoneVerification.d.ts +4 -0
- package/dist/api/app/bsky/contact/startPhoneVerification.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/startPhoneVerification.js +23 -0
- package/dist/api/app/bsky/contact/startPhoneVerification.js.map +1 -0
- package/dist/api/app/bsky/contact/util.d.ts +6 -0
- package/dist/api/app/bsky/contact/util.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/util.js +10 -0
- package/dist/api/app/bsky/contact/util.js.map +1 -0
- package/dist/api/app/bsky/contact/verifyPhone.d.ts +4 -0
- package/dist/api/app/bsky/contact/verifyPhone.d.ts.map +1 -0
- package/dist/api/app/bsky/contact/verifyPhone.js +26 -0
- package/dist/api/app/bsky/contact/verifyPhone.js.map +1 -0
- package/dist/api/app/bsky/graph/getRelationships.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getRelationships.js +4 -0
- package/dist/api/app/bsky/graph/getRelationships.js.map +1 -1
- package/dist/api/external.d.ts.map +1 -1
- package/dist/api/external.js +2 -0
- package/dist/api/external.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +22 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/kws/api.d.ts.map +1 -1
- package/dist/api/kws/api.js +44 -26
- package/dist/api/kws/api.js.map +1 -1
- package/dist/api/kws/index.d.ts.map +1 -1
- package/dist/api/kws/index.js +3 -1
- package/dist/api/kws/index.js.map +1 -1
- package/dist/api/kws/webhook.d.ts +3 -1
- package/dist/api/kws/webhook.d.ts.map +1 -1
- package/dist/api/kws/webhook.js +48 -20
- package/dist/api/kws/webhook.js.map +1 -1
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -2
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -0
- package/dist/context.js.map +1 -1
- package/dist/data-plane/bsync/index.d.ts.map +1 -1
- package/dist/data-plane/bsync/index.js +22 -0
- package/dist/data-plane/bsync/index.js.map +1 -1
- package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.d.ts +4 -0
- package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.d.ts.map +1 -0
- package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.js +30 -0
- package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.js.map +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/index.js +2 -1
- package/dist/data-plane/server/db/migrations/index.js.map +1 -1
- package/dist/data-plane/server/db/pagination.d.ts +3 -3
- package/dist/data-plane/server/db/tables/actor.d.ts +3 -0
- package/dist/data-plane/server/db/tables/actor.d.ts.map +1 -1
- package/dist/data-plane/server/db/tables/actor.js.map +1 -1
- package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
- package/dist/data-plane/server/routes/profile.js +13 -1
- package/dist/data-plane/server/routes/profile.js.map +1 -1
- package/dist/hydration/actor.js +1 -1
- package/dist/hydration/actor.js.map +1 -1
- package/dist/hydration/hydrator.js +1 -1
- package/dist/hydration/hydrator.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/kws.d.ts +35 -0
- package/dist/kws.d.ts.map +1 -1
- package/dist/kws.js +54 -0
- package/dist/kws.js.map +1 -1
- package/dist/lexicon/index.d.ts +19 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +48 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +664 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +354 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/contact/defs.d.ts +24 -0
- package/dist/lexicon/types/app/bsky/contact/defs.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/defs.js +25 -0
- package/dist/lexicon/types/app/bsky/contact/defs.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/dismissMatch.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/getMatches.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/getMatches.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts +21 -0
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts +30 -0
- package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/importContacts.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/importContacts.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/removeData.d.ts +23 -0
- package/dist/lexicon/types/app/bsky/contact/removeData.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/removeData.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/removeData.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.js +7 -0
- package/dist/lexicon/types/app/bsky/contact/verifyPhone.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +8 -0
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/defs.js.map +1 -1
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/proto/bsky_pb.d.ts +4 -0
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +10 -0
- package/dist/proto/bsky_pb.js.map +1 -1
- package/dist/proto/rolodex_connect.d.ts +83 -0
- package/dist/proto/rolodex_connect.d.ts.map +1 -0
- package/dist/proto/rolodex_connect.js +90 -0
- package/dist/proto/rolodex_connect.js.map +1 -0
- package/dist/proto/rolodex_pb.d.ts +363 -0
- package/dist/proto/rolodex_pb.d.ts.map +1 -0
- package/dist/proto/rolodex_pb.js +1032 -0
- package/dist/proto/rolodex_pb.js.map +1 -0
- package/dist/rolodex.d.ts +9 -0
- package/dist/rolodex.d.ts.map +1 -0
- package/dist/rolodex.js +25 -0
- package/dist/rolodex.js.map +1 -0
- package/dist/stash.d.ts +1 -0
- package/dist/stash.d.ts.map +1 -1
- package/dist/stash.js +1 -0
- package/dist/stash.js.map +1 -1
- package/dist/util/uris.d.ts +2 -2
- package/dist/util/uris.d.ts.map +1 -1
- package/package.json +16 -15
- package/proto/bsky.proto +1 -0
- package/proto/rolodex.proto +116 -0
- package/src/api/age-assurance/const.ts +142 -0
- package/src/api/age-assurance/index.ts +34 -0
- package/src/api/age-assurance/kws/age-verified.ts +75 -0
- package/src/api/age-assurance/kws/const.ts +33 -0
- package/src/api/age-assurance/kws/external-payload.test.ts +72 -0
- package/src/api/age-assurance/kws/external-payload.ts +149 -0
- package/src/api/age-assurance/redirects/kws-age-verified.ts +107 -0
- package/src/api/age-assurance/stash.ts +22 -0
- package/src/api/age-assurance/types.ts +10 -0
- package/src/api/age-assurance/util.ts +66 -0
- package/src/api/age-assurance/webhooks/kws-age-verified.ts +75 -0
- package/src/api/app/bsky/ageassurance/begin.ts +167 -0
- package/src/api/app/bsky/ageassurance/getConfig.ts +15 -0
- package/src/api/app/bsky/ageassurance/getState.ts +53 -0
- package/src/api/app/bsky/contact/dismissMatch.ts +24 -0
- package/src/api/app/bsky/contact/getMatches.ts +111 -0
- package/src/api/app/bsky/contact/getSyncStatus.ts +35 -0
- package/src/api/app/bsky/contact/importContacts.ts +118 -0
- package/src/api/app/bsky/contact/removeData.ts +23 -0
- package/src/api/app/bsky/contact/startPhoneVerification.ts +24 -0
- package/src/api/app/bsky/contact/util.ts +13 -0
- package/src/api/app/bsky/contact/verifyPhone.ts +27 -0
- package/src/api/app/bsky/graph/getRelationships.ts +4 -0
- package/src/api/external.ts +2 -0
- package/src/api/index.ts +20 -0
- package/src/api/kws/api.ts +55 -34
- package/src/api/kws/index.ts +7 -1
- package/src/api/kws/webhook.ts +57 -34
- package/src/config.ts +53 -2
- package/src/context.ts +6 -0
- package/src/data-plane/bsync/index.ts +31 -0
- package/src/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.ts +28 -0
- package/src/data-plane/server/db/migrations/index.ts +1 -0
- package/src/data-plane/server/db/tables/actor.ts +3 -0
- package/src/data-plane/server/routes/profile.ts +12 -1
- package/src/hydration/actor.ts +1 -1
- package/src/hydration/hydrator.ts +1 -1
- package/src/index.ts +13 -0
- package/src/kws.ts +81 -0
- package/src/lexicon/index.ts +101 -0
- package/src/lexicon/lexicons.ts +375 -0
- package/src/lexicon/types/app/bsky/contact/defs.ts +52 -0
- package/src/lexicon/types/app/bsky/contact/dismissMatch.ts +43 -0
- package/src/lexicon/types/app/bsky/contact/getMatches.ts +43 -0
- package/src/lexicon/types/app/bsky/contact/getSyncStatus.ts +39 -0
- package/src/lexicon/types/app/bsky/contact/importContacts.ts +49 -0
- package/src/lexicon/types/app/bsky/contact/removeData.ts +40 -0
- package/src/lexicon/types/app/bsky/contact/startPhoneVerification.ts +43 -0
- package/src/lexicon/types/app/bsky/contact/verifyPhone.ts +48 -0
- package/src/lexicon/types/app/bsky/graph/defs.ts +8 -0
- package/src/logger.ts +2 -0
- package/src/proto/bsky_pb.ts +6 -0
- package/src/proto/rolodex_connect.ts +89 -0
- package/src/proto/rolodex_pb.ts +746 -0
- package/src/rolodex.ts +42 -0
- package/src/stash.ts +3 -0
- package/tests/views/__snapshots__/profile.test.ts.snap +103 -0
- package/tests/views/age-assurance-v2.test.ts +745 -0
- package/tests/views/age-assurance.test.ts +2 -0
- package/tests/views/profile.test.ts +39 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/migrations/index.ts"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/F,mFAAkE;AAClE,gGAA+E;AAC/E,8FAA6E;AAC7E,wFAAuE;AACvE,iGAAgF;AAChF,gGAA+E;AAC/E,kGAAiF;AACjF,kGAAiF;AACjF,yFAAwE;AACxE,oFAAmE;AACnE,qFAAoE;AACpE,qGAAoF;AACpF,gGAA+E;AAC/E,0FAAyE;AACzE,yFAAwE;AACxE,8FAA6E;AAC7E,oGAAmF;AACnF,qGAAoF;AACpF,+FAA8E;AAC9E,mHAAkG;AAClG,uFAAsE;AACtE,8FAA6E;AAC7E,mGAAkF;AAClF,8FAA6E;AAC7E,0FAAyE;AACzE,4FAA2E;AAC3E,+FAA8E;AAC9E,oGAAmF;AACnF,+GAA8F;AAC9F,6FAA4E;AAC5E,iGAAgF;AAChF,uFAAsE;AACtE,mGAAkF;AAClF,2FAA0E;AAC1E,4FAA2E;AAC3E,8FAA6E;AAC7E,+FAA8E;AAC9E,qFAAoE;AACpE,wFAAuE;AACvE,8FAA6E;AAC7E,kGAAiF;AACjF,2FAA0E;AAC1E,qGAAoF;AACpF,+FAA8E;AAC9E,4FAA2E;AAC3E,4FAA2E;AAC3E,8FAA6E;AAC7E,8FAA6E;AAC7E,+FAA8E;AAC9E,wGAAuF;AACvF,8GAA6F;AAC7F,4FAA2E;AAC3E,qGAAoF","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20230309T045948368Z from './20230309T045948368Z-init'\nexport * as _20230408T152211201Z from './20230408T152211201Z-notification-init'\nexport * as _20230417T210628672Z from './20230417T210628672Z-moderation-init'\nexport * as _20230420T211446071Z from './20230420T211446071Z-did-cache'\nexport * as _20230427T194702079Z from './20230427T194702079Z-notif-record-index'\nexport * as _20230605T144730094Z from './20230605T144730094Z-post-profile-aggs'\nexport * as _20230607T211442112Z from './20230607T211442112Z-feed-generator-init'\nexport * as _20230608T155101190Z from './20230608T155101190Z-algo-whats-hot-view'\nexport * as _20230608T201813132Z from './20230608T201813132Z-mute-lists'\nexport * as _20230608T205147239Z from './20230608T205147239Z-mutes'\nexport * as _20230609T153623961Z from './20230609T153623961Z-blocks'\nexport * as _20230609T232122649Z from './20230609T232122649Z-actor-deletion-indexes'\nexport * as _20230610T203555962Z from './20230610T203555962Z-suggested-follows'\nexport * as _20230611T215300060Z from './20230611T215300060Z-actor-state'\nexport * as _20230620T161134972Z from './20230620T161134972Z-post-langs'\nexport * as _20230627T212437895Z from './20230627T212437895Z-optional-handle'\nexport * as _20230629T220835893Z from './20230629T220835893Z-remove-post-hierarchy'\nexport * as _20230703T045536691Z from './20230703T045536691Z-feed-and-label-indices'\nexport * as _20230720T164800037Z from './20230720T164800037Z-posts-cursor-idx'\nexport * as _20230807T035309811Z from './20230807T035309811Z-feed-item-delete-invite-for-user-idx'\nexport * as _20230808T172902639Z from './20230808T172902639Z-repo-rev'\nexport * as _20230810T203349843Z from './20230810T203349843Z-action-duration'\nexport * as _20230817T195936007Z from './20230817T195936007Z-native-notifications'\nexport * as _20230830T205507322Z from './20230830T205507322Z-suggested-feeds'\nexport * as _20230904T211011773Z from './20230904T211011773Z-block-lists'\nexport * as _20230906T222220386Z from './20230906T222220386Z-thread-gating'\nexport * as _20230920T213858047Z from './20230920T213858047Z-add-tags-to-post'\nexport * as _20230929T192920807Z from './20230929T192920807Z-record-cursor-indexes'\nexport * as _20231003T202833377Z from './20231003T202833377Z-create-moderation-subject-status'\nexport * as _20231220T225126090Z from './20231220T225126090Z-blob-takedowns'\nexport * as _20240124T023719200Z from './20240124T023719200Z-tagged-suggestions'\nexport * as _20240226T225725627Z from './20240226T225725627Z-labelers'\nexport * as _20240530T170337073Z from './20240530T170337073Z-account-deactivation'\nexport * as _20240606T171229898Z from './20240606T171229898Z-thread-mutes'\nexport * as _20240606T222548219Z from './20240606T222548219Z-starter-packs'\nexport * as _20240719T203853939Z from './20240719T203853939Z-priority-notifs'\nexport * as _20240723T220700077Z from './20240723T220700077Z-quotes-post-aggs'\nexport * as _20240723T220703655Z from './20240723T220703655Z-quotes'\nexport * as _20240801T193939827Z from './20240801T193939827Z-post-gate'\nexport * as _20240808T224251220Z from './20240808T224251220Z-post-gate-flags'\nexport * as _20240829T211238293Z from './20240829T211238293Z-simplify-actor-sync'\nexport * as _20240831T134810923Z from './20240831T134810923Z-pinned-posts'\nexport * as _20241114T153108102Z from './20241114T153108102Z-add-starter-packs-name'\nexport * as _20250116T222618297Z from './20250116T222618297Z-post-embed-video'\nexport * as _20250207T174822012Z from './20250207T174822012Z-add-label-exp'\nexport * as _20250404T163421487Z from './20250404T163421487Z-verifications'\nexport * as _20250526T023712742Z from './20250526T023712742Z-like-repost-via'\nexport * as _20250528T221913281Z from './20250528T221913281Z-add-record-tags'\nexport * as _20250602T190357447Z from './20250602T190357447Z-add-private-data'\nexport * as _20250611T140649895Z from './20250611T140649895Z-add-activity-subscription'\nexport * as _20250627T025331240Z from './20250627T025331240Z-add-actor-age-assurance-columns'\nexport * as _20250812T183735692Z from './20250812T183735692Z-add-bookmarks'\nexport * as _20250813T174955711Z from './20250813T174955711Z-add-post-agg-bookmarks'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/migrations/index.ts"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/F,mFAAkE;AAClE,gGAA+E;AAC/E,8FAA6E;AAC7E,wFAAuE;AACvE,iGAAgF;AAChF,gGAA+E;AAC/E,kGAAiF;AACjF,kGAAiF;AACjF,yFAAwE;AACxE,oFAAmE;AACnE,qFAAoE;AACpE,qGAAoF;AACpF,gGAA+E;AAC/E,0FAAyE;AACzE,yFAAwE;AACxE,8FAA6E;AAC7E,oGAAmF;AACnF,qGAAoF;AACpF,+FAA8E;AAC9E,mHAAkG;AAClG,uFAAsE;AACtE,8FAA6E;AAC7E,mGAAkF;AAClF,8FAA6E;AAC7E,0FAAyE;AACzE,4FAA2E;AAC3E,+FAA8E;AAC9E,oGAAmF;AACnF,+GAA8F;AAC9F,6FAA4E;AAC5E,iGAAgF;AAChF,uFAAsE;AACtE,mGAAkF;AAClF,2FAA0E;AAC1E,4FAA2E;AAC3E,8FAA6E;AAC7E,+FAA8E;AAC9E,qFAAoE;AACpE,wFAAuE;AACvE,8FAA6E;AAC7E,kGAAiF;AACjF,2FAA0E;AAC1E,qGAAoF;AACpF,+FAA8E;AAC9E,4FAA2E;AAC3E,4FAA2E;AAC3E,8FAA6E;AAC7E,8FAA6E;AAC7E,+FAA8E;AAC9E,wGAAuF;AACvF,8GAA6F;AAC7F,4FAA2E;AAC3E,qGAAoF;AACpF,4GAA2F","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20230309T045948368Z from './20230309T045948368Z-init'\nexport * as _20230408T152211201Z from './20230408T152211201Z-notification-init'\nexport * as _20230417T210628672Z from './20230417T210628672Z-moderation-init'\nexport * as _20230420T211446071Z from './20230420T211446071Z-did-cache'\nexport * as _20230427T194702079Z from './20230427T194702079Z-notif-record-index'\nexport * as _20230605T144730094Z from './20230605T144730094Z-post-profile-aggs'\nexport * as _20230607T211442112Z from './20230607T211442112Z-feed-generator-init'\nexport * as _20230608T155101190Z from './20230608T155101190Z-algo-whats-hot-view'\nexport * as _20230608T201813132Z from './20230608T201813132Z-mute-lists'\nexport * as _20230608T205147239Z from './20230608T205147239Z-mutes'\nexport * as _20230609T153623961Z from './20230609T153623961Z-blocks'\nexport * as _20230609T232122649Z from './20230609T232122649Z-actor-deletion-indexes'\nexport * as _20230610T203555962Z from './20230610T203555962Z-suggested-follows'\nexport * as _20230611T215300060Z from './20230611T215300060Z-actor-state'\nexport * as _20230620T161134972Z from './20230620T161134972Z-post-langs'\nexport * as _20230627T212437895Z from './20230627T212437895Z-optional-handle'\nexport * as _20230629T220835893Z from './20230629T220835893Z-remove-post-hierarchy'\nexport * as _20230703T045536691Z from './20230703T045536691Z-feed-and-label-indices'\nexport * as _20230720T164800037Z from './20230720T164800037Z-posts-cursor-idx'\nexport * as _20230807T035309811Z from './20230807T035309811Z-feed-item-delete-invite-for-user-idx'\nexport * as _20230808T172902639Z from './20230808T172902639Z-repo-rev'\nexport * as _20230810T203349843Z from './20230810T203349843Z-action-duration'\nexport * as _20230817T195936007Z from './20230817T195936007Z-native-notifications'\nexport * as _20230830T205507322Z from './20230830T205507322Z-suggested-feeds'\nexport * as _20230904T211011773Z from './20230904T211011773Z-block-lists'\nexport * as _20230906T222220386Z from './20230906T222220386Z-thread-gating'\nexport * as _20230920T213858047Z from './20230920T213858047Z-add-tags-to-post'\nexport * as _20230929T192920807Z from './20230929T192920807Z-record-cursor-indexes'\nexport * as _20231003T202833377Z from './20231003T202833377Z-create-moderation-subject-status'\nexport * as _20231220T225126090Z from './20231220T225126090Z-blob-takedowns'\nexport * as _20240124T023719200Z from './20240124T023719200Z-tagged-suggestions'\nexport * as _20240226T225725627Z from './20240226T225725627Z-labelers'\nexport * as _20240530T170337073Z from './20240530T170337073Z-account-deactivation'\nexport * as _20240606T171229898Z from './20240606T171229898Z-thread-mutes'\nexport * as _20240606T222548219Z from './20240606T222548219Z-starter-packs'\nexport * as _20240719T203853939Z from './20240719T203853939Z-priority-notifs'\nexport * as _20240723T220700077Z from './20240723T220700077Z-quotes-post-aggs'\nexport * as _20240723T220703655Z from './20240723T220703655Z-quotes'\nexport * as _20240801T193939827Z from './20240801T193939827Z-post-gate'\nexport * as _20240808T224251220Z from './20240808T224251220Z-post-gate-flags'\nexport * as _20240829T211238293Z from './20240829T211238293Z-simplify-actor-sync'\nexport * as _20240831T134810923Z from './20240831T134810923Z-pinned-posts'\nexport * as _20241114T153108102Z from './20241114T153108102Z-add-starter-packs-name'\nexport * as _20250116T222618297Z from './20250116T222618297Z-post-embed-video'\nexport * as _20250207T174822012Z from './20250207T174822012Z-add-label-exp'\nexport * as _20250404T163421487Z from './20250404T163421487Z-verifications'\nexport * as _20250526T023712742Z from './20250526T023712742Z-like-repost-via'\nexport * as _20250528T221913281Z from './20250528T221913281Z-add-record-tags'\nexport * as _20250602T190357447Z from './20250602T190357447Z-add-private-data'\nexport * as _20250611T140649895Z from './20250611T140649895Z-add-activity-subscription'\nexport * as _20250627T025331240Z from './20250627T025331240Z-add-actor-age-assurance-columns'\nexport * as _20250812T183735692Z from './20250812T183735692Z-add-bookmarks'\nexport * as _20250813T174955711Z from './20250813T174955711Z-add-post-agg-bookmarks'\nexport * as _20251120T004738098Z from './20251120T004738098Z-update-actor-age-assurance-v2'\n"]}
|
|
@@ -54,7 +54,7 @@ export declare class TimeCidKeyset<TimeCidResult = SortAtCidResult> extends Gene
|
|
|
54
54
|
secondary: string;
|
|
55
55
|
};
|
|
56
56
|
cursorToLabeledResult(cursor: KeysetCursor): {
|
|
57
|
-
primary: string
|
|
57
|
+
primary: `${string}-${string}-${string}T${string}:${string}:${string}Z`;
|
|
58
58
|
secondary: string;
|
|
59
59
|
};
|
|
60
60
|
}
|
|
@@ -128,10 +128,10 @@ type TimeLabeledResult = SingleKeyCursor;
|
|
|
128
128
|
export declare class IsoTimeKey<TimeResult = SortAtResult> extends GenericSingleKey<TimeResult, TimeLabeledResult> {
|
|
129
129
|
labelResult(result: TimeResult): TimeLabeledResult;
|
|
130
130
|
labeledResultToCursor(labeled: TimeLabeledResult): {
|
|
131
|
-
primary: string
|
|
131
|
+
primary: `${string}-${string}-${string}T${string}:${string}:${string}Z`;
|
|
132
132
|
};
|
|
133
133
|
cursorToLabeledResult(cursor: SingleKeyCursor): {
|
|
134
|
-
primary: string
|
|
134
|
+
primary: `${string}-${string}-${string}T${string}:${string}:${string}Z`;
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
export declare class IsoSortAtKey extends IsoTimeKey<{
|
|
@@ -8,6 +8,9 @@ export interface Actor {
|
|
|
8
8
|
trustedVerifier: Generated<boolean>;
|
|
9
9
|
ageAssuranceStatus: string | null;
|
|
10
10
|
ageAssuranceLastInitiatedAt: string | null;
|
|
11
|
+
ageAssuranceAccess: string | null;
|
|
12
|
+
ageAssuranceCountryCode: string | null;
|
|
13
|
+
ageAssuranceRegionCode: string | null;
|
|
11
14
|
}
|
|
12
15
|
export declare const tableName = "actor";
|
|
13
16
|
export type PartialDB = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/tables/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/tables/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,eAAO,MAAM,SAAS,UAAU,CAAA;AAEhC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/tables/actor.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../../../../src/data-plane/server/db/tables/actor.ts"],"names":[],"mappings":";;;AAgBa,QAAA,SAAS,GAAG,OAAO,CAAA","sourcesContent":["import { Generated } from 'kysely'\n\nexport interface Actor {\n did: string\n handle: string | null\n indexedAt: string\n takedownRef: string | null\n upstreamStatus: string | null\n trustedVerifier: Generated<boolean>\n ageAssuranceStatus: string | null\n ageAssuranceLastInitiatedAt: string | null\n ageAssuranceAccess: string | null\n ageAssuranceCountryCode: string | null\n ageAssuranceRegionCode: string | null\n}\n\nexport const tableName = 'actor'\n\nexport type PartialDB = { [tableName]: Actor }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/data-plane/server/routes/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAQjD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;yBAWhB,IAAI,QAAQ,KAAG,OAAO,CAAC,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAAnE,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/data-plane/server/routes/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAQjD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;yBAWhB,IAAI,QAAQ,KAAG,OAAO,CAAC,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAAnE,wBAwLE"}
|
|
@@ -86,11 +86,23 @@ exports.default = (db) => ({
|
|
|
86
86
|
if (!ageAssuranceForDids.has(did)) {
|
|
87
87
|
return undefined;
|
|
88
88
|
}
|
|
89
|
+
const status = row?.ageAssuranceStatus ?? 'unknown';
|
|
90
|
+
let access = row?.ageAssuranceAccess;
|
|
91
|
+
if (status === 'assured') {
|
|
92
|
+
access = 'full';
|
|
93
|
+
}
|
|
94
|
+
else if (status === 'blocked') {
|
|
95
|
+
access = 'none';
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
access = 'unknown';
|
|
99
|
+
}
|
|
89
100
|
return {
|
|
90
|
-
status: row?.ageAssuranceStatus ?? 'unknown',
|
|
91
101
|
lastInitiatedAt: row?.ageAssuranceLastInitiatedAt
|
|
92
102
|
? protobuf_1.Timestamp.fromDate(new Date(row?.ageAssuranceLastInitiatedAt))
|
|
93
103
|
: undefined,
|
|
104
|
+
status,
|
|
105
|
+
access,
|
|
94
106
|
};
|
|
95
107
|
};
|
|
96
108
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../src/data-plane/server/routes/profile.ts"],"names":[],"mappings":";;AAAA,iDAA8C;AAE9C,mCAAwC;AAKxC,4CAAuC;AACvC,kDAA0D;AAK1D,uCAAsC;AAStC,kBAAe,CAAC,EAAY,EAAwC,EAAE,CAAC,CAAC;IACtE,KAAK,CAAC,SAAS,CAAC,GAAG;QACjB,M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C3B,OAAO,EAAE,CAAA;IACd,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { Timestamp } from '@bufbuild/protobuf'\nimport { ServiceImpl } from '@connectrpc/connect'\nimport { Selectable, sql } from 'kysely'\nimport {\n AppBskyNotificationDeclaration,\n ChatBskyActorDeclaration,\n} from '@atproto/api'\nimport { keyBy } from '@atproto/common'\nimport { parseRecordBytes } from '../../../hydration/util'\nimport { Service } from '../../../proto/bsky_connect'\nimport { VerificationMeta } from '../../../proto/bsky_pb'\nimport { Database } from '../db'\nimport { Verification } from '../db/tables/verification'\nimport { getRecords } from './records'\n\ntype VerifiedBy = {\n [handle: string]: Pick<\n VerificationMeta,\n 'rkey' | 'handle' | 'displayName' | 'sortedAt'\n >\n}\n\nexport default (db: Database): Partial<ServiceImpl<typeof Service>> => ({\n async getActors(req) {\n const { dids, returnAgeAssuranceForDids } = req\n if (dids.length === 0) {\n return { actors: [] }\n }\n const profileUris = dids.map(\n (did) => `at://${did}/app.bsky.actor.profile/self`,\n )\n const statusUris = dids.map(\n (did) => `at://${did}/app.bsky.actor.status/self`,\n )\n const chatDeclarationUris = dids.map(\n (did) => `at://${did}/chat.bsky.actor.declaration/self`,\n )\n const notifDeclarationUris = dids.map(\n (did) => `at://${did}/app.bsky.notification.declaration/self`,\n )\n const { ref } = db.db.dynamic\n const [\n handlesRes,\n verificationsReceived,\n profiles,\n statuses,\n chatDeclarations,\n notifDeclarations,\n ] = await Promise.all([\n db.db\n .selectFrom('actor')\n .leftJoin('actor_state', 'actor_state.did', 'actor.did')\n .where('actor.did', 'in', dids)\n .selectAll('actor')\n .select('actor_state.priorityNotifs')\n .select([\n db.db\n .selectFrom('labeler')\n .whereRef('creator', '=', ref('actor.did'))\n .select(sql<true>`${true}`.as('val'))\n .as('isLabeler'),\n ])\n .execute(),\n db.db\n .selectFrom('verification')\n .selectAll('verification')\n .innerJoin('actor', 'actor.did', 'verification.creator')\n .where('verification.subject', 'in', dids)\n .where('actor.trustedVerifier', '=', true)\n .orderBy('sortedAt', 'asc')\n .execute(),\n getRecords(db)({ uris: profileUris }),\n getRecords(db)({ uris: statusUris }),\n getRecords(db)({ uris: chatDeclarationUris }),\n getRecords(db)({ uris: notifDeclarationUris }),\n ])\n\n const verificationsBySubjectDid = verificationsReceived.reduce(\n (acc, cur) => {\n const list = acc.get(cur.subject) ?? []\n list.push(cur)\n acc.set(cur.subject, list)\n return acc\n },\n new Map<string, Selectable<Verification>[]>(),\n )\n\n const byDid = keyBy(handlesRes, 'did')\n const actors = dids.map((did, i) => {\n const row = byDid.get(did)\n\n const status = statuses.records[i]\n\n const chatDeclaration = parseRecordBytes<ChatBskyActorDeclaration.Record>(\n chatDeclarations.records[i].record,\n )\n\n const verifications = verificationsBySubjectDid.get(did) ?? []\n const verifiedBy: VerifiedBy = verifications.reduce((acc, cur) => {\n acc[cur.creator] = {\n rkey: cur.rkey,\n handle: cur.handle,\n displayName: cur.displayName,\n sortedAt: Timestamp.fromDate(new Date(cur.sortedAt)),\n }\n return acc\n }, {} as VerifiedBy)\n const ageAssuranceForDids = new Set(returnAgeAssuranceForDids)\n\n const activitySubscription = () => {\n const record = parseRecordBytes<AppBskyNotificationDeclaration.Record>(\n notifDeclarations.records[i].record,\n )\n\n // The dataplane is responsible for setting the default of \"followers\" (default according to the lexicon).\n const defaultVal = 'followers'\n\n if (typeof record?.allowSubscriptions !== 'string') {\n return defaultVal\n }\n\n switch (record.allowSubscriptions) {\n case 'followers':\n case 'mutuals':\n case 'none':\n return record.allowSubscriptions\n default:\n return defaultVal\n }\n }\n\n const ageAssuranceStatus = () => {\n if (!ageAssuranceForDids.has(did)) {\n return undefined\n }\n\n return {\n status: row?.ageAssuranceStatus ?? 'unknown',\n lastInitiatedAt: row?.ageAssuranceLastInitiatedAt\n ? Timestamp.fromDate(new Date(row?.ageAssuranceLastInitiatedAt))\n : undefined,\n }\n }\n\n return {\n exists: !!row,\n handle: row?.handle ?? undefined,\n profile: profiles.records[i],\n takenDown: !!row?.takedownRef,\n takedownRef: row?.takedownRef || undefined,\n tombstonedAt: undefined, // in current implementation, tombstoned actors are deleted\n labeler: row?.isLabeler ?? false,\n allowIncomingChatsFrom:\n typeof chatDeclaration?.['allowIncoming'] === 'string'\n ? chatDeclaration['allowIncoming']\n : undefined,\n upstreamStatus: row?.upstreamStatus ?? '',\n createdAt: profiles.records[i].createdAt, // @NOTE profile creation date not trusted in production\n priorityNotifications: row?.priorityNotifs ?? false,\n trustedVerifier: row?.trustedVerifier ?? false,\n verifiedBy,\n statusRecord: status,\n tags: [],\n profileTags: [],\n allowActivitySubscriptionsFrom: activitySubscription(),\n ageAssuranceStatus: ageAssuranceStatus(),\n }\n })\n return { actors }\n },\n\n // @TODO handle req.lookupUnidirectional w/ networked handle resolution\n async getDidsByHandles(req) {\n const { handles } = req\n if (handles.length === 0) {\n return { dids: [] }\n }\n const res = await db.db\n .selectFrom('actor')\n .where('handle', 'in', handles)\n .selectAll()\n .execute()\n const byHandle = keyBy(res, 'handle')\n const dids = handles.map((handle) => byHandle.get(handle)?.did ?? '')\n return { dids }\n },\n\n async updateActorUpstreamStatus(req) {\n const { actorDid, upstreamStatus } = req\n await db.db\n .updateTable('actor')\n .set({ upstreamStatus })\n .where('did', '=', actorDid)\n .execute()\n },\n})\n"]}
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../src/data-plane/server/routes/profile.ts"],"names":[],"mappings":";;AAAA,iDAA8C;AAE9C,mCAAwC;AAKxC,4CAAuC;AACvC,kDAA0D;AAK1D,uCAAsC;AAStC,kBAAe,CAAC,EAAY,EAAwC,EAAE,CAAC,CAAC;IACtE,KAAK,CAAC,SAAS,CAAC,GAAG;QACjB,MAAM,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,GAAG,CAAA;QAC/C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;QACvB,CAAC;QACD,MAAM,WAAW,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;aACR,WAAW,CAAC,OAAO,CAAC;aACpB,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC;aACvB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC;aAC3B,OAAO,EAAE,CAAA;IACd,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { Timestamp } from '@bufbuild/protobuf'\nimport { ServiceImpl } from '@connectrpc/connect'\nimport { Selectable, sql } from 'kysely'\nimport {\n AppBskyNotificationDeclaration,\n ChatBskyActorDeclaration,\n} from '@atproto/api'\nimport { keyBy } from '@atproto/common'\nimport { parseRecordBytes } from '../../../hydration/util'\nimport { Service } from '../../../proto/bsky_connect'\nimport { VerificationMeta } from '../../../proto/bsky_pb'\nimport { Database } from '../db'\nimport { Verification } from '../db/tables/verification'\nimport { getRecords } from './records'\n\ntype VerifiedBy = {\n [handle: string]: Pick<\n VerificationMeta,\n 'rkey' | 'handle' | 'displayName' | 'sortedAt'\n >\n}\n\nexport default (db: Database): Partial<ServiceImpl<typeof Service>> => ({\n async getActors(req) {\n const { dids, returnAgeAssuranceForDids } = req\n if (dids.length === 0) {\n return { actors: [] }\n }\n const profileUris = dids.map(\n (did) => `at://${did}/app.bsky.actor.profile/self`,\n )\n const statusUris = dids.map(\n (did) => `at://${did}/app.bsky.actor.status/self`,\n )\n const chatDeclarationUris = dids.map(\n (did) => `at://${did}/chat.bsky.actor.declaration/self`,\n )\n const notifDeclarationUris = dids.map(\n (did) => `at://${did}/app.bsky.notification.declaration/self`,\n )\n const { ref } = db.db.dynamic\n const [\n handlesRes,\n verificationsReceived,\n profiles,\n statuses,\n chatDeclarations,\n notifDeclarations,\n ] = await Promise.all([\n db.db\n .selectFrom('actor')\n .leftJoin('actor_state', 'actor_state.did', 'actor.did')\n .where('actor.did', 'in', dids)\n .selectAll('actor')\n .select('actor_state.priorityNotifs')\n .select([\n db.db\n .selectFrom('labeler')\n .whereRef('creator', '=', ref('actor.did'))\n .select(sql<true>`${true}`.as('val'))\n .as('isLabeler'),\n ])\n .execute(),\n db.db\n .selectFrom('verification')\n .selectAll('verification')\n .innerJoin('actor', 'actor.did', 'verification.creator')\n .where('verification.subject', 'in', dids)\n .where('actor.trustedVerifier', '=', true)\n .orderBy('sortedAt', 'asc')\n .execute(),\n getRecords(db)({ uris: profileUris }),\n getRecords(db)({ uris: statusUris }),\n getRecords(db)({ uris: chatDeclarationUris }),\n getRecords(db)({ uris: notifDeclarationUris }),\n ])\n\n const verificationsBySubjectDid = verificationsReceived.reduce(\n (acc, cur) => {\n const list = acc.get(cur.subject) ?? []\n list.push(cur)\n acc.set(cur.subject, list)\n return acc\n },\n new Map<string, Selectable<Verification>[]>(),\n )\n\n const byDid = keyBy(handlesRes, 'did')\n const actors = dids.map((did, i) => {\n const row = byDid.get(did)\n\n const status = statuses.records[i]\n\n const chatDeclaration = parseRecordBytes<ChatBskyActorDeclaration.Record>(\n chatDeclarations.records[i].record,\n )\n\n const verifications = verificationsBySubjectDid.get(did) ?? []\n const verifiedBy: VerifiedBy = verifications.reduce((acc, cur) => {\n acc[cur.creator] = {\n rkey: cur.rkey,\n handle: cur.handle,\n displayName: cur.displayName,\n sortedAt: Timestamp.fromDate(new Date(cur.sortedAt)),\n }\n return acc\n }, {} as VerifiedBy)\n const ageAssuranceForDids = new Set(returnAgeAssuranceForDids)\n\n const activitySubscription = () => {\n const record = parseRecordBytes<AppBskyNotificationDeclaration.Record>(\n notifDeclarations.records[i].record,\n )\n\n // The dataplane is responsible for setting the default of \"followers\" (default according to the lexicon).\n const defaultVal = 'followers'\n\n if (typeof record?.allowSubscriptions !== 'string') {\n return defaultVal\n }\n\n switch (record.allowSubscriptions) {\n case 'followers':\n case 'mutuals':\n case 'none':\n return record.allowSubscriptions\n default:\n return defaultVal\n }\n }\n\n const ageAssuranceStatus = () => {\n if (!ageAssuranceForDids.has(did)) {\n return undefined\n }\n\n const status = row?.ageAssuranceStatus ?? 'unknown'\n let access = row?.ageAssuranceAccess\n if (status === 'assured') {\n access = 'full'\n } else if (status === 'blocked') {\n access = 'none'\n } else {\n access = 'unknown'\n }\n\n return {\n lastInitiatedAt: row?.ageAssuranceLastInitiatedAt\n ? Timestamp.fromDate(new Date(row?.ageAssuranceLastInitiatedAt))\n : undefined,\n status,\n access,\n }\n }\n\n return {\n exists: !!row,\n handle: row?.handle ?? undefined,\n profile: profiles.records[i],\n takenDown: !!row?.takedownRef,\n takedownRef: row?.takedownRef || undefined,\n tombstonedAt: undefined, // in current implementation, tombstoned actors are deleted\n labeler: row?.isLabeler ?? false,\n allowIncomingChatsFrom:\n typeof chatDeclaration?.['allowIncoming'] === 'string'\n ? chatDeclaration['allowIncoming']\n : undefined,\n upstreamStatus: row?.upstreamStatus ?? '',\n createdAt: profiles.records[i].createdAt, // @NOTE profile creation date not trusted in production\n priorityNotifications: row?.priorityNotifs ?? false,\n trustedVerifier: row?.trustedVerifier ?? false,\n verifiedBy,\n statusRecord: status,\n tags: [],\n profileTags: [],\n allowActivitySubscriptionsFrom: activitySubscription(),\n ageAssuranceStatus: ageAssuranceStatus(),\n }\n })\n return { actors }\n },\n\n // @TODO handle req.lookupUnidirectional w/ networked handle resolution\n async getDidsByHandles(req) {\n const { handles } = req\n if (handles.length === 0) {\n return { dids: [] }\n }\n const res = await db.db\n .selectFrom('actor')\n .where('handle', 'in', handles)\n .selectAll()\n .execute()\n const byHandle = keyBy(res, 'handle')\n const dids = handles.map((handle) => byHandle.get(handle)?.did ?? '')\n return { dids }\n },\n\n async updateActorUpstreamStatus(req) {\n const { actorDid, upstreamStatus } = req\n await db.db\n .updateTable('actor')\n .set({ upstreamStatus })\n .where('did', '=', actorDid)\n .execute()\n },\n})\n"]}
|
package/dist/hydration/actor.js
CHANGED
|
@@ -59,7 +59,7 @@ class ActorHydrator {
|
|
|
59
59
|
!!actor.tombstonedAt) {
|
|
60
60
|
return acc.set(did, null);
|
|
61
61
|
}
|
|
62
|
-
const profile = actor.profile
|
|
62
|
+
const profile = actor.profile?.record
|
|
63
63
|
? (0, util_1.parseRecord)(actor.profile, includeTakedowns)
|
|
64
64
|
: undefined;
|
|
65
65
|
const status = actor.statusRecord
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/hydration/actor.ts"],"names":[],"mappings":";;;AACA,4CAA4C;AAO5C,iCAOe;AAkGf,MAAa,aAAa;IACxB,YAAmB,SAA0B;QAAjC;;;;mBAAO,SAAS;WAAiB;IAAG,CAAC;IAEjD,KAAK,CAAC,cAAc,CAAC,GAAkB;QACrC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;YAChE,OAAO,IAAA,kBAAW,EAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAA;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CACX,YAAsB,EACtB,IAAyC;QAEzC,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;QACzE,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM;YACxB,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;gBACpC,OAAO;gBACP,oBAAoB,EAAE,IAAI,EAAE,oBAAoB;aACjD,CAAC;YACJ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;QAChB,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;YACd,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACvB,IAAI,GAAG,IA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E,CAAC,CAAA;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;YACjC,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE;gBAClB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;gBACnC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;gBACjC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3B,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;aAC1C,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,mBAAY,EAAc,CAAC,CAAA;IACpC,CAAC;CACF;AAjSD,sCAiSC","sourcesContent":["import { AppBskyNotificationDeclaration } from '@atproto/api'\nimport { mapDefined } from '@atproto/common'\nimport { DataPlaneClient } from '../data-plane/client'\nimport { Record as ProfileRecord } from '../lexicon/types/app/bsky/actor/profile'\nimport { Record as StatusRecord } from '../lexicon/types/app/bsky/actor/status'\nimport { Record as NotificationDeclarationRecord } from '../lexicon/types/app/bsky/notification/declaration'\nimport { Record as ChatDeclarationRecord } from '../lexicon/types/chat/bsky/actor/declaration'\nimport { ActivitySubscription, VerificationMeta } from '../proto/bsky_pb'\nimport {\n HydrationMap,\n RecordInfo,\n isActivitySubscriptionEnabled,\n parseRecord,\n parseString,\n safeTakedownRef,\n} from './util'\n\ntype AllowActivitySubscriptions = Extract<\n AppBskyNotificationDeclaration.Record['allowSubscriptions'],\n 'followers' | 'mutuals' | 'none'\n>\n\nexport type Actor = {\n did: string\n handle?: string\n profile?: ProfileRecord\n profileCid?: string\n profileTakedownRef?: string\n sortedAt?: Date\n indexedAt?: Date\n takedownRef?: string\n isLabeler: boolean\n allowIncomingChatsFrom?: string\n upstreamStatus?: string\n createdAt?: Date\n priorityNotifications: boolean\n trustedVerifier?: boolean\n verifications: VerificationHydrationState[]\n status?: RecordInfo<StatusRecord>\n allowActivitySubscriptionsFrom: AllowActivitySubscriptions\n /**\n * Debug information for internal development\n */\n debug?: {\n pagerank?: number\n accountTags?: string[]\n profileTags?: string[]\n [key: string]: unknown\n }\n}\n\nexport type VerificationHydrationState = {\n issuer: string\n uri: string\n handle: string\n displayName: string\n createdAt: string\n}\n\nexport type VerificationMetaRequired = Required<VerificationMeta>\n\nexport type Actors = HydrationMap<Actor>\n\nexport type ChatDeclaration = RecordInfo<ChatDeclarationRecord>\n\nexport type ChatDeclarations = HydrationMap<ChatDeclaration>\nexport type NotificationDeclaration = RecordInfo<NotificationDeclarationRecord>\n\nexport type NotificationDeclarations = HydrationMap<NotificationDeclaration>\n\nexport type Status = RecordInfo<StatusRecord>\nexport type Statuses = HydrationMap<Status>\n\nexport type ProfileViewerState = {\n muted?: boolean\n mutedByList?: string\n blockedBy?: string\n blocking?: string\n blockedByList?: string\n blockingByList?: string\n following?: string\n followedBy?: string\n}\n\nexport type ProfileViewerStates = HydrationMap<ProfileViewerState>\n\ntype ActivitySubscriptionState = {\n post: boolean\n reply: boolean\n}\n\nexport type ActivitySubscriptionStates = HydrationMap<\n ActivitySubscriptionState | undefined\n>\n\ntype KnownFollowersState = {\n count: number\n followers: string[]\n}\n\nexport type KnownFollowersStates = HydrationMap<KnownFollowersState | undefined>\n\nexport type ProfileAgg = {\n followers: number\n follows: number\n posts: number\n lists: number\n feeds: number\n starterPacks: number\n}\n\nexport type ProfileAggs = HydrationMap<ProfileAgg>\n\nexport class ActorHydrator {\n constructor(public dataplane: DataPlaneClient) {}\n\n async getRepoRevSafe(did: string | null): Promise<string | null> {\n if (!did) return null\n try {\n const res = await this.dataplane.getLatestRev({ actorDid: did })\n return parseString(res.rev) ?? null\n } catch {\n return null\n }\n }\n\n async getDids(\n handleOrDids: string[],\n opts?: { lookupUnidirectional?: boolean },\n ): Promise<(string | undefined)[]> {\n const handles = handleOrDids.filter((actor) => !actor.startsWith('did:'))\n const res = handles.length\n ? await this.dataplane.getDidsByHandles({\n handles,\n lookupUnidirectional: opts?.lookupUnidirectional,\n })\n : { dids: [] }\n const didByHandle = handles.reduce(\n (acc, cur, i) => {\n const did = res.dids[i]\n if (did && did.length > 0) {\n return acc.set(cur, did)\n }\n return acc\n },\n new Map() as Map<string, string>,\n )\n return handleOrDids.map((id) =>\n id.startsWith('did:') ? id : didByHandle.get(id),\n )\n }\n\n async getDidsDefined(handleOrDids: string[]): Promise<string[]> {\n const res = await this.getDids(handleOrDids)\n // @ts-ignore\n return res.filter((did) => did !== undefined)\n }\n\n async getActors(\n dids: string[],\n opts: {\n includeTakedowns?: boolean\n skipCacheForDids?: string[]\n } = {},\n ): Promise<Actors> {\n const { includeTakedowns = false, skipCacheForDids } = opts\n if (!dids.length) return new HydrationMap<Actor>()\n const res = await this.dataplane.getActors({ dids, skipCacheForDids })\n return dids.reduce((acc, did, i) => {\n const actor = res.actors[i]\n const isNoHosted =\n actor.takenDown ||\n (actor.upstreamStatus && actor.upstreamStatus !== 'active')\n if (\n !actor.exists ||\n (isNoHosted && !includeTakedowns) ||\n !!actor.tombstonedAt\n ) {\n return acc.set(did, null)\n }\n\n const profile = actor.profile\n ? parseRecord<ProfileRecord>(actor.profile, includeTakedowns)\n : undefined\n\n const status = actor.statusRecord\n ? parseRecord<StatusRecord>(actor.statusRecord, includeTakedowns)\n : undefined\n\n const verifications = mapDefined(\n Object.entries(actor.verifiedBy),\n ([actorDid, verificationMeta]) => {\n if (\n verificationMeta.handle &&\n verificationMeta.rkey &&\n verificationMeta.sortedAt\n ) {\n return {\n issuer: actorDid,\n uri: `at://${actorDid}/app.bsky.graph.verification/${verificationMeta.rkey}`,\n handle: verificationMeta.handle,\n displayName: verificationMeta.displayName,\n createdAt: verificationMeta.sortedAt.toDate().toISOString(),\n }\n }\n // Filter out the verification meta that doesn't contain all info.\n return undefined\n },\n )\n\n const allowActivitySubscriptionsFrom = (\n val: string,\n ): AllowActivitySubscriptions => {\n switch (val) {\n case 'followers':\n case 'mutuals':\n case 'none':\n return val\n default:\n // The dataplane should set the default of \"FOLLOWERS\". Just in case.\n return 'followers'\n }\n }\n\n const debug = {\n pagerank: actor.pagerank,\n accountTags: actor.tags,\n profileTags: actor.profileTags,\n }\n\n return acc.set(did, {\n did,\n handle: parseString(actor.handle),\n profile: profile?.record,\n profileCid: profile?.cid,\n profileTakedownRef: profile?.takedownRef,\n sortedAt: profile?.sortedAt,\n indexedAt: profile?.indexedAt,\n takedownRef: safeTakedownRef(actor),\n isLabeler: actor.labeler ?? false,\n allowIncomingChatsFrom: actor.allowIncomingChatsFrom || undefined,\n upstreamStatus: actor.upstreamStatus || undefined,\n createdAt: actor.createdAt?.toDate(),\n priorityNotifications: actor.priorityNotifications,\n trustedVerifier: actor.trustedVerifier,\n verifications,\n status: status,\n allowActivitySubscriptionsFrom: allowActivitySubscriptionsFrom(\n actor.allowActivitySubscriptionsFrom,\n ),\n debug,\n })\n }, new HydrationMap<Actor>())\n }\n\n async getChatDeclarations(\n uris: string[],\n includeTakedowns = false,\n ): Promise<ChatDeclarations> {\n if (!uris.length) return new HydrationMap<ChatDeclaration>()\n const res = await this.dataplane.getActorChatDeclarationRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<ChatDeclarationRecord>(\n res.records[i],\n includeTakedowns,\n )\n return acc.set(uri, record ?? null)\n }, new HydrationMap<ChatDeclaration>())\n }\n\n async getNotificationDeclarations(\n uris: string[],\n includeTakedowns = false,\n ): Promise<NotificationDeclarations> {\n if (!uris.length) return new HydrationMap<NotificationDeclaration>()\n const res = await this.dataplane.getActorChatDeclarationRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<NotificationDeclarationRecord>(\n res.records[i],\n includeTakedowns,\n )\n return acc.set(uri, record ?? null)\n }, new HydrationMap<NotificationDeclaration>())\n }\n\n async getStatus(uris: string[], includeTakedowns = false): Promise<Statuses> {\n if (!uris.length) return new HydrationMap<Status>()\n const res = await this.dataplane.getStatusRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<StatusRecord>(res.records[i], includeTakedowns)\n return acc.set(uri, record ?? null)\n }, new HydrationMap<Status>())\n }\n\n // \"naive\" because this method does not verify the existence of the list itself\n // a later check in the main hydrator will remove list uris that have been deleted or\n // repurposed to \"curate lists\"\n async getProfileViewerStatesNaive(\n dids: string[],\n viewer: string,\n ): Promise<ProfileViewerStates> {\n if (!dids.length) return new HydrationMap<ProfileViewerState>()\n const res = await this.dataplane.getRelationships({\n actorDid: viewer,\n targetDids: dids,\n })\n\n return dids.reduce((acc, did, i) => {\n const rels = res.relationships[i]\n if (viewer === did) {\n // ignore self-follows, self-mutes, self-blocks, self-activity-subscriptions\n return acc.set(did, {})\n }\n return acc.set(did, {\n muted: rels.muted ?? false,\n mutedByList: parseString(rels.mutedByList),\n blockedBy: parseString(rels.blockedBy),\n blocking: parseString(rels.blocking),\n blockedByList: parseString(rels.blockedByList),\n blockingByList: parseString(rels.blockingByList),\n following: parseString(rels.following),\n followedBy: parseString(rels.followedBy),\n })\n }, new HydrationMap<ProfileViewerState>())\n }\n\n async getKnownFollowers(\n dids: string[],\n viewer: string | null,\n ): Promise<KnownFollowersStates> {\n if (!viewer) return new HydrationMap<KnownFollowersState | undefined>()\n const { results: knownFollowersResults } = await this.dataplane\n .getFollowsFollowing(\n {\n actorDid: viewer,\n targetDids: dids,\n },\n {\n signal: AbortSignal.timeout(100),\n },\n )\n .catch(() => ({ results: [] }))\n return dids.reduce((acc, did, i) => {\n const result = knownFollowersResults[i]?.dids\n return acc.set(\n did,\n result && result.length > 0\n ? {\n count: result.length,\n followers: result.slice(0, 5),\n }\n : undefined,\n )\n }, new HydrationMap<KnownFollowersState | undefined>())\n }\n\n async getActivitySubscriptions(\n dids: string[],\n viewer: string | null,\n ): Promise<ActivitySubscriptionStates> {\n if (!viewer) {\n return new HydrationMap<ActivitySubscriptionState | undefined>()\n }\n\n const activitySubscription = (val: ActivitySubscription | undefined) => {\n if (!val) return undefined\n\n const result = {\n post: !!val.post,\n reply: !!val.reply,\n }\n if (!isActivitySubscriptionEnabled(result)) return undefined\n\n return result\n }\n\n const { subscriptions } = await this.dataplane\n .getActivitySubscriptionsByActorAndSubjects(\n { actorDid: viewer, subjectDids: dids },\n { signal: AbortSignal.timeout(100) },\n )\n .catch(() => ({ subscriptions: [] }))\n\n return dids.reduce((acc, did, i) => {\n return acc.set(did, activitySubscription(subscriptions[i]))\n }, new HydrationMap<ActivitySubscriptionState | undefined>())\n }\n\n async getProfileAggregates(dids: string[]): Promise<ProfileAggs> {\n if (!dids.length) return new HydrationMap<ProfileAgg>()\n const counts = await this.dataplane.getCountsForUsers({ dids })\n return dids.reduce((acc, did, i) => {\n return acc.set(did, {\n followers: counts.followers[i] ?? 0,\n follows: counts.following[i] ?? 0,\n posts: counts.posts[i] ?? 0,\n lists: counts.lists[i] ?? 0,\n feeds: counts.feeds[i] ?? 0,\n starterPacks: counts.starterPacks[i] ?? 0,\n })\n }, new HydrationMap<ProfileAgg>())\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/hydration/actor.ts"],"names":[],"mappings":";;;AACA,4CAA4C;AAO5C,iCAOe;AAkGf,MAAa,aAAa;IACxB,YAAmB,SAA0B;QAAjC;;;;mBAAO,SAAS;WAAiB;IAAG,CAAC;IAEjD,KAAK,CAAC,cAAc,CAAC,GAAkB;QACrC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;YAChE,OAAO,IAAA,kBAAW,EAAC,GA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,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;aAC1C,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,mBAAY,EAAc,CAAC,CAAA;IACpC,CAAC;CACF;AAjSD,sCAiSC","sourcesContent":["import { AppBskyNotificationDeclaration } from '@atproto/api'\nimport { mapDefined } from '@atproto/common'\nimport { DataPlaneClient } from '../data-plane/client'\nimport { Record as ProfileRecord } from '../lexicon/types/app/bsky/actor/profile'\nimport { Record as StatusRecord } from '../lexicon/types/app/bsky/actor/status'\nimport { Record as NotificationDeclarationRecord } from '../lexicon/types/app/bsky/notification/declaration'\nimport { Record as ChatDeclarationRecord } from '../lexicon/types/chat/bsky/actor/declaration'\nimport { ActivitySubscription, VerificationMeta } from '../proto/bsky_pb'\nimport {\n HydrationMap,\n RecordInfo,\n isActivitySubscriptionEnabled,\n parseRecord,\n parseString,\n safeTakedownRef,\n} from './util'\n\ntype AllowActivitySubscriptions = Extract<\n AppBskyNotificationDeclaration.Record['allowSubscriptions'],\n 'followers' | 'mutuals' | 'none'\n>\n\nexport type Actor = {\n did: string\n handle?: string\n profile?: ProfileRecord\n profileCid?: string\n profileTakedownRef?: string\n sortedAt?: Date\n indexedAt?: Date\n takedownRef?: string\n isLabeler: boolean\n allowIncomingChatsFrom?: string\n upstreamStatus?: string\n createdAt?: Date\n priorityNotifications: boolean\n trustedVerifier?: boolean\n verifications: VerificationHydrationState[]\n status?: RecordInfo<StatusRecord>\n allowActivitySubscriptionsFrom: AllowActivitySubscriptions\n /**\n * Debug information for internal development\n */\n debug?: {\n pagerank?: number\n accountTags?: string[]\n profileTags?: string[]\n [key: string]: unknown\n }\n}\n\nexport type VerificationHydrationState = {\n issuer: string\n uri: string\n handle: string\n displayName: string\n createdAt: string\n}\n\nexport type VerificationMetaRequired = Required<VerificationMeta>\n\nexport type Actors = HydrationMap<Actor>\n\nexport type ChatDeclaration = RecordInfo<ChatDeclarationRecord>\n\nexport type ChatDeclarations = HydrationMap<ChatDeclaration>\nexport type NotificationDeclaration = RecordInfo<NotificationDeclarationRecord>\n\nexport type NotificationDeclarations = HydrationMap<NotificationDeclaration>\n\nexport type Status = RecordInfo<StatusRecord>\nexport type Statuses = HydrationMap<Status>\n\nexport type ProfileViewerState = {\n muted?: boolean\n mutedByList?: string\n blockedBy?: string\n blocking?: string\n blockedByList?: string\n blockingByList?: string\n following?: string\n followedBy?: string\n}\n\nexport type ProfileViewerStates = HydrationMap<ProfileViewerState>\n\ntype ActivitySubscriptionState = {\n post: boolean\n reply: boolean\n}\n\nexport type ActivitySubscriptionStates = HydrationMap<\n ActivitySubscriptionState | undefined\n>\n\ntype KnownFollowersState = {\n count: number\n followers: string[]\n}\n\nexport type KnownFollowersStates = HydrationMap<KnownFollowersState | undefined>\n\nexport type ProfileAgg = {\n followers: number\n follows: number\n posts: number\n lists: number\n feeds: number\n starterPacks: number\n}\n\nexport type ProfileAggs = HydrationMap<ProfileAgg>\n\nexport class ActorHydrator {\n constructor(public dataplane: DataPlaneClient) {}\n\n async getRepoRevSafe(did: string | null): Promise<string | null> {\n if (!did) return null\n try {\n const res = await this.dataplane.getLatestRev({ actorDid: did })\n return parseString(res.rev) ?? null\n } catch {\n return null\n }\n }\n\n async getDids(\n handleOrDids: string[],\n opts?: { lookupUnidirectional?: boolean },\n ): Promise<(string | undefined)[]> {\n const handles = handleOrDids.filter((actor) => !actor.startsWith('did:'))\n const res = handles.length\n ? await this.dataplane.getDidsByHandles({\n handles,\n lookupUnidirectional: opts?.lookupUnidirectional,\n })\n : { dids: [] }\n const didByHandle = handles.reduce(\n (acc, cur, i) => {\n const did = res.dids[i]\n if (did && did.length > 0) {\n return acc.set(cur, did)\n }\n return acc\n },\n new Map() as Map<string, string>,\n )\n return handleOrDids.map((id) =>\n id.startsWith('did:') ? id : didByHandle.get(id),\n )\n }\n\n async getDidsDefined(handleOrDids: string[]): Promise<string[]> {\n const res = await this.getDids(handleOrDids)\n // @ts-ignore\n return res.filter((did) => did !== undefined)\n }\n\n async getActors(\n dids: string[],\n opts: {\n includeTakedowns?: boolean\n skipCacheForDids?: string[]\n } = {},\n ): Promise<Actors> {\n const { includeTakedowns = false, skipCacheForDids } = opts\n if (!dids.length) return new HydrationMap<Actor>()\n const res = await this.dataplane.getActors({ dids, skipCacheForDids })\n return dids.reduce((acc, did, i) => {\n const actor = res.actors[i]\n const isNoHosted =\n actor.takenDown ||\n (actor.upstreamStatus && actor.upstreamStatus !== 'active')\n if (\n !actor.exists ||\n (isNoHosted && !includeTakedowns) ||\n !!actor.tombstonedAt\n ) {\n return acc.set(did, null)\n }\n\n const profile = actor.profile?.record\n ? parseRecord<ProfileRecord>(actor.profile, includeTakedowns)\n : undefined\n\n const status = actor.statusRecord\n ? parseRecord<StatusRecord>(actor.statusRecord, includeTakedowns)\n : undefined\n\n const verifications = mapDefined(\n Object.entries(actor.verifiedBy),\n ([actorDid, verificationMeta]) => {\n if (\n verificationMeta.handle &&\n verificationMeta.rkey &&\n verificationMeta.sortedAt\n ) {\n return {\n issuer: actorDid,\n uri: `at://${actorDid}/app.bsky.graph.verification/${verificationMeta.rkey}`,\n handle: verificationMeta.handle,\n displayName: verificationMeta.displayName,\n createdAt: verificationMeta.sortedAt.toDate().toISOString(),\n }\n }\n // Filter out the verification meta that doesn't contain all info.\n return undefined\n },\n )\n\n const allowActivitySubscriptionsFrom = (\n val: string,\n ): AllowActivitySubscriptions => {\n switch (val) {\n case 'followers':\n case 'mutuals':\n case 'none':\n return val\n default:\n // The dataplane should set the default of \"FOLLOWERS\". Just in case.\n return 'followers'\n }\n }\n\n const debug = {\n pagerank: actor.pagerank,\n accountTags: actor.tags,\n profileTags: actor.profileTags,\n }\n\n return acc.set(did, {\n did,\n handle: parseString(actor.handle),\n profile: profile?.record,\n profileCid: profile?.cid,\n profileTakedownRef: profile?.takedownRef,\n sortedAt: profile?.sortedAt,\n indexedAt: profile?.indexedAt,\n takedownRef: safeTakedownRef(actor),\n isLabeler: actor.labeler ?? false,\n allowIncomingChatsFrom: actor.allowIncomingChatsFrom || undefined,\n upstreamStatus: actor.upstreamStatus || undefined,\n createdAt: actor.createdAt?.toDate(),\n priorityNotifications: actor.priorityNotifications,\n trustedVerifier: actor.trustedVerifier,\n verifications,\n status: status,\n allowActivitySubscriptionsFrom: allowActivitySubscriptionsFrom(\n actor.allowActivitySubscriptionsFrom,\n ),\n debug,\n })\n }, new HydrationMap<Actor>())\n }\n\n async getChatDeclarations(\n uris: string[],\n includeTakedowns = false,\n ): Promise<ChatDeclarations> {\n if (!uris.length) return new HydrationMap<ChatDeclaration>()\n const res = await this.dataplane.getActorChatDeclarationRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<ChatDeclarationRecord>(\n res.records[i],\n includeTakedowns,\n )\n return acc.set(uri, record ?? null)\n }, new HydrationMap<ChatDeclaration>())\n }\n\n async getNotificationDeclarations(\n uris: string[],\n includeTakedowns = false,\n ): Promise<NotificationDeclarations> {\n if (!uris.length) return new HydrationMap<NotificationDeclaration>()\n const res = await this.dataplane.getActorChatDeclarationRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<NotificationDeclarationRecord>(\n res.records[i],\n includeTakedowns,\n )\n return acc.set(uri, record ?? null)\n }, new HydrationMap<NotificationDeclaration>())\n }\n\n async getStatus(uris: string[], includeTakedowns = false): Promise<Statuses> {\n if (!uris.length) return new HydrationMap<Status>()\n const res = await this.dataplane.getStatusRecords({ uris })\n return uris.reduce((acc, uri, i) => {\n const record = parseRecord<StatusRecord>(res.records[i], includeTakedowns)\n return acc.set(uri, record ?? null)\n }, new HydrationMap<Status>())\n }\n\n // \"naive\" because this method does not verify the existence of the list itself\n // a later check in the main hydrator will remove list uris that have been deleted or\n // repurposed to \"curate lists\"\n async getProfileViewerStatesNaive(\n dids: string[],\n viewer: string,\n ): Promise<ProfileViewerStates> {\n if (!dids.length) return new HydrationMap<ProfileViewerState>()\n const res = await this.dataplane.getRelationships({\n actorDid: viewer,\n targetDids: dids,\n })\n\n return dids.reduce((acc, did, i) => {\n const rels = res.relationships[i]\n if (viewer === did) {\n // ignore self-follows, self-mutes, self-blocks, self-activity-subscriptions\n return acc.set(did, {})\n }\n return acc.set(did, {\n muted: rels.muted ?? false,\n mutedByList: parseString(rels.mutedByList),\n blockedBy: parseString(rels.blockedBy),\n blocking: parseString(rels.blocking),\n blockedByList: parseString(rels.blockedByList),\n blockingByList: parseString(rels.blockingByList),\n following: parseString(rels.following),\n followedBy: parseString(rels.followedBy),\n })\n }, new HydrationMap<ProfileViewerState>())\n }\n\n async getKnownFollowers(\n dids: string[],\n viewer: string | null,\n ): Promise<KnownFollowersStates> {\n if (!viewer) return new HydrationMap<KnownFollowersState | undefined>()\n const { results: knownFollowersResults } = await this.dataplane\n .getFollowsFollowing(\n {\n actorDid: viewer,\n targetDids: dids,\n },\n {\n signal: AbortSignal.timeout(100),\n },\n )\n .catch(() => ({ results: [] }))\n return dids.reduce((acc, did, i) => {\n const result = knownFollowersResults[i]?.dids\n return acc.set(\n did,\n result && result.length > 0\n ? {\n count: result.length,\n followers: result.slice(0, 5),\n }\n : undefined,\n )\n }, new HydrationMap<KnownFollowersState | undefined>())\n }\n\n async getActivitySubscriptions(\n dids: string[],\n viewer: string | null,\n ): Promise<ActivitySubscriptionStates> {\n if (!viewer) {\n return new HydrationMap<ActivitySubscriptionState | undefined>()\n }\n\n const activitySubscription = (val: ActivitySubscription | undefined) => {\n if (!val) return undefined\n\n const result = {\n post: !!val.post,\n reply: !!val.reply,\n }\n if (!isActivitySubscriptionEnabled(result)) return undefined\n\n return result\n }\n\n const { subscriptions } = await this.dataplane\n .getActivitySubscriptionsByActorAndSubjects(\n { actorDid: viewer, subjectDids: dids },\n { signal: AbortSignal.timeout(100) },\n )\n .catch(() => ({ subscriptions: [] }))\n\n return dids.reduce((acc, did, i) => {\n return acc.set(did, activitySubscription(subscriptions[i]))\n }, new HydrationMap<ActivitySubscriptionState | undefined>())\n }\n\n async getProfileAggregates(dids: string[]): Promise<ProfileAggs> {\n if (!dids.length) return new HydrationMap<ProfileAgg>()\n const counts = await this.dataplane.getCountsForUsers({ dids })\n return dids.reduce((acc, did, i) => {\n return acc.set(did, {\n followers: counts.followers[i] ?? 0,\n follows: counts.following[i] ?? 0,\n posts: counts.posts[i] ?? 0,\n lists: counts.lists[i] ?? 0,\n feeds: counts.feeds[i] ?? 0,\n starterPacks: counts.starterPacks[i] ?? 0,\n })\n }, new HydrationMap<ProfileAgg>())\n }\n}\n"]}
|