@clioplaylists/clio 0.1.1 → 0.1.3
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/package.json +4 -4
- package/dist/.env +0 -7
- package/dist/api/com/clioplaylists/alpha/actor/getProfile.d.ts +0 -0
- package/dist/api/com/clioplaylists/alpha/actor/getProfile.js +0 -37
- package/dist/api/com/clioplaylists/alpha/feed/getSongs.d.ts +0 -0
- package/dist/api/com/clioplaylists/alpha/feed/getSongs.js +0 -37
- package/dist/api/health.d.ts +0 -3
- package/dist/api/health.js +0 -32
- package/dist/api/index.d.ts +0 -4
- package/dist/api/index.js +0 -43
- package/dist/api/util.d.ts +0 -9
- package/dist/api/util.js +0 -17
- package/dist/auth-verifier.d.ts +0 -92
- package/dist/auth-verifier.js +0 -473
- package/dist/client.d.ts +0 -9
- package/dist/client.js +0 -40
- package/dist/config.d.ts +0 -21
- package/dist/config.js +0 -65
- package/dist/context.d.ts +0 -11
- package/dist/context.js +0 -19
- package/dist/dataplane/bsync/index.js +0 -150
- package/dist/dataplane/client.d.ts +0 -27
- package/dist/dataplane/client.js +0 -165
- package/dist/dataplane/index.d.ts +0 -2
- package/dist/dataplane/index.js +0 -18
- package/dist/dataplane/server/background.d.ts +0 -13
- package/dist/dataplane/server/background.js +0 -51
- package/dist/dataplane/server/db/database-schema.d.ts +0 -13
- package/dist/dataplane/server/db/database-schema.js +0 -2
- package/dist/dataplane/server/db/db.d.ts +0 -32
- package/dist/dataplane/server/db/db.js +0 -228
- package/dist/dataplane/server/db/index.d.ts +0 -1
- package/dist/dataplane/server/db/index.js +0 -17
- package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.d.ts +0 -3
- package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.js +0 -117
- package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.d.ts +0 -3
- package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.js +0 -15
- package/dist/dataplane/server/db/migrations/index.d.ts +0 -2
- package/dist/dataplane/server/db/migrations/index.js +0 -41
- package/dist/dataplane/server/db/migrations/provider.d.ts +0 -11
- package/dist/dataplane/server/db/migrations/provider.js +0 -31
- package/dist/dataplane/server/db/pagination.d.ts +0 -86
- package/dist/dataplane/server/db/pagination.js +0 -144
- package/dist/dataplane/server/db/tables/actor-sync.d.ts +0 -9
- package/dist/dataplane/server/db/tables/actor-sync.js +0 -4
- package/dist/dataplane/server/db/tables/actor.d.ts +0 -11
- package/dist/dataplane/server/db/tables/actor.js +0 -4
- package/dist/dataplane/server/db/tables/artist-list-item.d.ts +0 -11
- package/dist/dataplane/server/db/tables/artist-list-item.js +0 -4
- package/dist/dataplane/server/db/tables/artist.d.ts +0 -10
- package/dist/dataplane/server/db/tables/artist.js +0 -4
- package/dist/dataplane/server/db/tables/playlist-idea.d.ts +0 -14
- package/dist/dataplane/server/db/tables/playlist-idea.js +0 -4
- package/dist/dataplane/server/db/tables/playlist-item.d.ts +0 -11
- package/dist/dataplane/server/db/tables/playlist-item.js +0 -4
- package/dist/dataplane/server/db/tables/playlist.d.ts +0 -10
- package/dist/dataplane/server/db/tables/playlist.js +0 -4
- package/dist/dataplane/server/db/tables/profile.d.ts +0 -15
- package/dist/dataplane/server/db/tables/profile.js +0 -4
- package/dist/dataplane/server/db/tables/record.d.ts +0 -12
- package/dist/dataplane/server/db/tables/record.js +0 -4
- package/dist/dataplane/server/db/tables/song.d.ts +0 -12
- package/dist/dataplane/server/db/tables/song.js +0 -4
- package/dist/dataplane/server/db/types.d.ts +0 -9
- package/dist/dataplane/server/db/types.js +0 -2
- package/dist/dataplane/server/db/util.d.ts +0 -20
- package/dist/dataplane/server/db/util.js +0 -48
- package/dist/dataplane/server/index.d.ts +0 -11
- package/dist/dataplane/server/index.js +0 -52
- package/dist/dataplane/server/indexing/index.d.ts +0 -32
- package/dist/dataplane/server/indexing/index.js +0 -321
- package/dist/dataplane/server/indexing/plugins/playlist-idea.d.ts +0 -14
- package/dist/dataplane/server/indexing/plugins/playlist-idea.js +0 -163
- package/dist/dataplane/server/indexing/plugins/profile.d.ts +0 -8
- package/dist/dataplane/server/indexing/plugins/profile.js +0 -81
- package/dist/dataplane/server/indexing/processor.d.ts +0 -22
- package/dist/dataplane/server/indexing/processor.js +0 -90
- package/dist/dataplane/server/routes/blocks.js +0 -95
- package/dist/dataplane/server/routes/feed-gens.js +0 -56
- package/dist/dataplane/server/routes/feeds.js +0 -128
- package/dist/dataplane/server/routes/follows.js +0 -122
- package/dist/dataplane/server/routes/identity.d.ts +0 -6
- package/dist/dataplane/server/routes/identity.js +0 -56
- package/dist/dataplane/server/routes/index.d.ts +0 -5
- package/dist/dataplane/server/routes/index.js +0 -19
- package/dist/dataplane/server/routes/interactions.js +0 -111
- package/dist/dataplane/server/routes/labels.js +0 -73
- package/dist/dataplane/server/routes/likes.js +0 -76
- package/dist/dataplane/server/routes/lists.js +0 -77
- package/dist/dataplane/server/routes/moderation.js +0 -92
- package/dist/dataplane/server/routes/mutes.js +0 -166
- package/dist/dataplane/server/routes/notifs.js +0 -137
- package/dist/dataplane/server/routes/posts.js +0 -19
- package/dist/dataplane/server/routes/profile.d.ts +0 -5
- package/dist/dataplane/server/routes/profile.js +0 -61
- package/dist/dataplane/server/routes/quotes.js +0 -26
- package/dist/dataplane/server/routes/records.d.ts +0 -11
- package/dist/dataplane/server/routes/records.js +0 -88
- package/dist/dataplane/server/routes/relationships.js +0 -157
- package/dist/dataplane/server/routes/reposts.js +0 -59
- package/dist/dataplane/server/routes/search.js +0 -70
- package/dist/dataplane/server/routes/starter-packs.js +0 -24
- package/dist/dataplane/server/routes/suggestions.js +0 -134
- package/dist/dataplane/server/routes/sync.d.ts +0 -5
- package/dist/dataplane/server/routes/sync.js +0 -14
- package/dist/dataplane/server/routes/threads.js +0 -31
- package/dist/dataplane/server/subscription.d.ts +0 -25
- package/dist/dataplane/server/subscription.js +0 -114
- package/dist/dataplane/server/util.js +0 -117
- package/dist/error.d.ts +0 -2
- package/dist/error.js +0 -14
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -115
- package/dist/lexicons/index.d.ts +0 -278
- package/dist/lexicons/index.js +0 -638
- package/dist/lexicons/lexicons.d.ts +0 -8466
- package/dist/lexicons/lexicons.js +0 -4551
- package/dist/lexicons/types/com/atproto/admin/defs.d.ts +0 -50
- package/dist/lexicons/types/com/atproto/admin/defs.js +0 -54
- package/dist/lexicons/types/com/atproto/admin/deleteAccount.d.ts +0 -29
- package/dist/lexicons/types/com/atproto/admin/deleteAccount.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.d.ts +0 -31
- package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.d.ts +0 -31
- package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/getAccountInfo.d.ts +0 -33
- package/dist/lexicons/types/com/atproto/admin/getAccountInfo.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/getAccountInfos.d.ts +0 -36
- package/dist/lexicons/types/com/atproto/admin/getAccountInfos.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/getInviteCodes.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/admin/getInviteCodes.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.d.ts +0 -44
- package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/searchAccounts.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/admin/searchAccounts.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/sendEmail.d.ts +0 -45
- package/dist/lexicons/types/com/atproto/admin/sendEmail.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.d.ts +0 -31
- package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.js +0 -2
- package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.d.ts +0 -51
- package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/defs.d.ts +0 -14
- package/dist/lexicons/types/com/atproto/identity/defs.js +0 -14
- package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.d.ts +0 -38
- package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/refreshIdentity.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/identity/refreshIdentity.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/resolveDid.d.ts +0 -38
- package/dist/lexicons/types/com/atproto/identity/resolveDid.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/resolveHandle.d.ts +0 -37
- package/dist/lexicons/types/com/atproto/identity/resolveHandle.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/resolveIdentity.d.ts +0 -35
- package/dist/lexicons/types/com/atproto/identity/resolveIdentity.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/signPlcOperation.d.ts +0 -46
- package/dist/lexicons/types/com/atproto/identity/signPlcOperation.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.d.ts +0 -29
- package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.js +0 -2
- package/dist/lexicons/types/com/atproto/identity/updateHandle.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/identity/updateHandle.js +0 -2
- package/dist/lexicons/types/com/atproto/label/defs.d.ts +0 -73
- package/dist/lexicons/types/com/atproto/label/defs.js +0 -54
- package/dist/lexicons/types/com/atproto/label/queryLabels.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/label/queryLabels.js +0 -2
- package/dist/lexicons/types/com/atproto/label/subscribeLabels.d.ts +0 -38
- package/dist/lexicons/types/com/atproto/label/subscribeLabels.js +0 -24
- package/dist/lexicons/types/com/atproto/lexicon/schema.d.ts +0 -11
- package/dist/lexicons/types/com/atproto/lexicon/schema.js +0 -15
- package/dist/lexicons/types/com/atproto/moderation/createReport.d.ts +0 -57
- package/dist/lexicons/types/com/atproto/moderation/createReport.js +0 -2
- package/dist/lexicons/types/com/atproto/moderation/defs.d.ts +0 -20
- package/dist/lexicons/types/com/atproto/moderation/defs.js +0 -20
- package/dist/lexicons/types/com/atproto/repo/applyWrites.d.ts +0 -98
- package/dist/lexicons/types/com/atproto/repo/applyWrites.js +0 -64
- package/dist/lexicons/types/com/atproto/repo/createRecord.d.ts +0 -56
- package/dist/lexicons/types/com/atproto/repo/createRecord.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/defs.d.ts +0 -11
- package/dist/lexicons/types/com/atproto/repo/defs.js +0 -14
- package/dist/lexicons/types/com/atproto/repo/deleteRecord.d.ts +0 -51
- package/dist/lexicons/types/com/atproto/repo/deleteRecord.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/describeRepo.d.ts +0 -43
- package/dist/lexicons/types/com/atproto/repo/describeRepo.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/getRecord.d.ts +0 -45
- package/dist/lexicons/types/com/atproto/repo/getRecord.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/importRepo.d.ts +0 -27
- package/dist/lexicons/types/com/atproto/repo/importRepo.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.d.ts +0 -45
- package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.js +0 -14
- package/dist/lexicons/types/com/atproto/repo/listRecords.d.ts +0 -53
- package/dist/lexicons/types/com/atproto/repo/listRecords.js +0 -14
- package/dist/lexicons/types/com/atproto/repo/putRecord.d.ts +0 -58
- package/dist/lexicons/types/com/atproto/repo/putRecord.js +0 -2
- package/dist/lexicons/types/com/atproto/repo/strongRef.d.ts +0 -11
- package/dist/lexicons/types/com/atproto/repo/strongRef.js +0 -15
- package/dist/lexicons/types/com/atproto/repo/uploadBlob.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/repo/uploadBlob.js +0 -2
- package/dist/lexicons/types/com/atproto/server/activateAccount.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/server/activateAccount.js +0 -2
- package/dist/lexicons/types/com/atproto/server/checkAccountStatus.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/server/checkAccountStatus.js +0 -2
- package/dist/lexicons/types/com/atproto/server/confirmEmail.d.ts +0 -31
- package/dist/lexicons/types/com/atproto/server/confirmEmail.js +0 -2
- package/dist/lexicons/types/com/atproto/server/createAccount.d.ts +0 -61
- package/dist/lexicons/types/com/atproto/server/createAccount.js +0 -2
- package/dist/lexicons/types/com/atproto/server/createAppPassword.d.ts +0 -51
- package/dist/lexicons/types/com/atproto/server/createAppPassword.js +0 -14
- package/dist/lexicons/types/com/atproto/server/createInviteCode.d.ts +0 -41
- package/dist/lexicons/types/com/atproto/server/createInviteCode.js +0 -2
- package/dist/lexicons/types/com/atproto/server/createInviteCodes.d.ts +0 -50
- package/dist/lexicons/types/com/atproto/server/createInviteCodes.js +0 -14
- package/dist/lexicons/types/com/atproto/server/createSession.d.ts +0 -56
- package/dist/lexicons/types/com/atproto/server/createSession.js +0 -2
- package/dist/lexicons/types/com/atproto/server/deactivateAccount.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/server/deactivateAccount.js +0 -2
- package/dist/lexicons/types/com/atproto/server/defs.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/server/defs.js +0 -24
- package/dist/lexicons/types/com/atproto/server/deleteAccount.d.ts +0 -32
- package/dist/lexicons/types/com/atproto/server/deleteAccount.js +0 -2
- package/dist/lexicons/types/com/atproto/server/deleteSession.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/server/deleteSession.js +0 -2
- package/dist/lexicons/types/com/atproto/server/describeServer.d.ts +0 -56
- package/dist/lexicons/types/com/atproto/server/describeServer.js +0 -24
- package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.js +0 -2
- package/dist/lexicons/types/com/atproto/server/getServiceAuth.d.ts +0 -41
- package/dist/lexicons/types/com/atproto/server/getServiceAuth.js +0 -2
- package/dist/lexicons/types/com/atproto/server/getSession.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/server/getSession.js +0 -2
- package/dist/lexicons/types/com/atproto/server/listAppPasswords.d.ts +0 -44
- package/dist/lexicons/types/com/atproto/server/listAppPasswords.js +0 -14
- package/dist/lexicons/types/com/atproto/server/refreshSession.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/server/refreshSession.js +0 -2
- package/dist/lexicons/types/com/atproto/server/requestAccountDelete.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/server/requestAccountDelete.js +0 -2
- package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.d.ts +0 -23
- package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.js +0 -2
- package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.d.ts +0 -34
- package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.js +0 -2
- package/dist/lexicons/types/com/atproto/server/requestPasswordReset.d.ts +0 -29
- package/dist/lexicons/types/com/atproto/server/requestPasswordReset.js +0 -2
- package/dist/lexicons/types/com/atproto/server/reserveSigningKey.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/server/reserveSigningKey.js +0 -2
- package/dist/lexicons/types/com/atproto/server/resetPassword.d.ts +0 -31
- package/dist/lexicons/types/com/atproto/server/resetPassword.js +0 -2
- package/dist/lexicons/types/com/atproto/server/revokeAppPassword.d.ts +0 -29
- package/dist/lexicons/types/com/atproto/server/revokeAppPassword.js +0 -2
- package/dist/lexicons/types/com/atproto/server/updateEmail.d.ts +0 -33
- package/dist/lexicons/types/com/atproto/server/updateEmail.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getBlob.d.ts +0 -36
- package/dist/lexicons/types/com/atproto/sync/getBlob.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getBlocks.d.ts +0 -35
- package/dist/lexicons/types/com/atproto/sync/getBlocks.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getCheckout.d.ts +0 -33
- package/dist/lexicons/types/com/atproto/sync/getCheckout.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getHead.d.ts +0 -37
- package/dist/lexicons/types/com/atproto/sync/getHead.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getLatestCommit.d.ts +0 -38
- package/dist/lexicons/types/com/atproto/sync/getLatestCommit.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getRecord.d.ts +0 -37
- package/dist/lexicons/types/com/atproto/sync/getRecord.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getRepo.d.ts +0 -36
- package/dist/lexicons/types/com/atproto/sync/getRepo.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/getRepoStatus.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/sync/getRepoStatus.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/listBlobs.d.ts +0 -42
- package/dist/lexicons/types/com/atproto/sync/listBlobs.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/listRepos.d.ts +0 -50
- package/dist/lexicons/types/com/atproto/sync/listRepos.js +0 -14
- package/dist/lexicons/types/com/atproto/sync/listReposByCollection.d.ts +0 -46
- package/dist/lexicons/types/com/atproto/sync/listReposByCollection.js +0 -14
- package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/requestCrawl.d.ts +0 -30
- package/dist/lexicons/types/com/atproto/sync/requestCrawl.js +0 -2
- package/dist/lexicons/types/com/atproto/sync/subscribeRepos.d.ts +0 -111
- package/dist/lexicons/types/com/atproto/sync/subscribeRepos.js +0 -64
- package/dist/lexicons/types/com/atproto/temp/addReservedHandle.d.ts +0 -39
- package/dist/lexicons/types/com/atproto/temp/addReservedHandle.js +0 -2
- package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.d.ts +0 -36
- package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.js +0 -2
- package/dist/lexicons/types/com/atproto/temp/fetchLabels.d.ts +0 -37
- package/dist/lexicons/types/com/atproto/temp/fetchLabels.js +0 -2
- package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.d.ts +0 -29
- package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.js +0 -2
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.d.ts +0 -19
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.js +0 -15
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.d.ts +0 -32
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.js +0 -24
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.d.ts +0 -37
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.js +0 -2
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.d.ts +0 -32
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.js +0 -35
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/song.js +0 -25
- package/dist/lexicons/util.d.ts +0 -5
- package/dist/lexicons/util.js +0 -13
- package/dist/logger.d.ts +0 -6
- package/dist/logger.js +0 -26
- package/dist/rpc/clio_connect.d.ts +0 -103
- package/dist/rpc/clio_connect.js +0 -110
- package/dist/rpc/clio_pb.d.ts +0 -457
- package/dist/rpc/clio_pb.js +0 -1365
- package/dist/start.d.ts +0 -1
- package/dist/util/retry.d.ts +0 -2
- package/dist/util/retry.js +0 -16
- package/dist/util/uris.d.ts +0 -1
- package/dist/util/uris.js +0 -7
- package/dist/util.d.ts +0 -23
- package/dist/util.js +0 -119
- /package/{dist/start.js → start.js} +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const kysely_1 = require("kysely");
|
|
4
|
-
exports.default = (db) => ({
|
|
5
|
-
async getFollowSuggestions(req) {
|
|
6
|
-
const { actorDid, relativeToDid, cursor, limit } = req;
|
|
7
|
-
if (relativeToDid) {
|
|
8
|
-
return getFollowSuggestionsRelativeTo(db, {
|
|
9
|
-
actorDid,
|
|
10
|
-
relativeToDid,
|
|
11
|
-
cursor: cursor || undefined,
|
|
12
|
-
limit: limit || undefined,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return getFollowSuggestionsGlobal(db, {
|
|
17
|
-
actorDid,
|
|
18
|
-
cursor: cursor || undefined,
|
|
19
|
-
limit: limit || undefined,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
async getSuggestedEntities() {
|
|
24
|
-
const entities = await db.db
|
|
25
|
-
.selectFrom('tagged_suggestion')
|
|
26
|
-
.selectAll()
|
|
27
|
-
.execute();
|
|
28
|
-
return {
|
|
29
|
-
entities,
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
const getFollowSuggestionsGlobal = async (db, input) => {
|
|
34
|
-
const alreadyIncluded = parseCursor(input.cursor);
|
|
35
|
-
const suggestions = await db.db
|
|
36
|
-
.selectFrom('suggested_follow')
|
|
37
|
-
.innerJoin('actor', 'actor.did', 'suggested_follow.did')
|
|
38
|
-
.if(alreadyIncluded.length > 0, (qb) => qb.where('suggested_follow.order', 'not in', alreadyIncluded))
|
|
39
|
-
.selectAll()
|
|
40
|
-
.orderBy('suggested_follow.order', 'asc')
|
|
41
|
-
.execute();
|
|
42
|
-
// always include first two
|
|
43
|
-
const firstTwo = suggestions.filter((row) => row.order === 1 || row.order === 2);
|
|
44
|
-
const rest = suggestions.filter((row) => row.order !== 1 && row.order !== 2);
|
|
45
|
-
const limited = firstTwo.concat(shuffle(rest)).slice(0, input.limit);
|
|
46
|
-
// if the result set ends up getting larger, consider using a seed included in the cursor for for the randomized shuffle
|
|
47
|
-
const cursor = limited.length > 0
|
|
48
|
-
? limited
|
|
49
|
-
.map((row) => row.order.toString())
|
|
50
|
-
.concat(alreadyIncluded.map((id) => id.toString()))
|
|
51
|
-
.join(':')
|
|
52
|
-
: undefined;
|
|
53
|
-
return {
|
|
54
|
-
dids: limited.map((s) => s.did),
|
|
55
|
-
cursor,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
const getFollowSuggestionsRelativeTo = async (db, input) => {
|
|
59
|
-
if (input.cursor)
|
|
60
|
-
return { dids: [] };
|
|
61
|
-
const limit = input.limit ? Math.min(10, input.limit) : 10;
|
|
62
|
-
const actorsViewerFollows = db.db
|
|
63
|
-
.selectFrom('follow')
|
|
64
|
-
.where('creator', '=', input.actorDid)
|
|
65
|
-
.select('subjectDid');
|
|
66
|
-
const mostLikedAccounts = await db.db
|
|
67
|
-
.selectFrom(db.db
|
|
68
|
-
.selectFrom('like')
|
|
69
|
-
.where('creator', '=', input.relativeToDid)
|
|
70
|
-
.select((0, kysely_1.sql) `split_part(subject, '/', 3)`.as('subjectDid'))
|
|
71
|
-
.orderBy('sortAt', 'desc')
|
|
72
|
-
.limit(1000) // limit to 1000
|
|
73
|
-
.as('likes'))
|
|
74
|
-
.select('likes.subjectDid as did')
|
|
75
|
-
.select((qb) => qb.fn.count('likes.subjectDid').as('count'))
|
|
76
|
-
.where('likes.subjectDid', 'not in', actorsViewerFollows)
|
|
77
|
-
.where('likes.subjectDid', 'not in', [input.actorDid, input.relativeToDid])
|
|
78
|
-
.groupBy('likes.subjectDid')
|
|
79
|
-
.orderBy('count', 'desc')
|
|
80
|
-
.limit(limit)
|
|
81
|
-
.execute();
|
|
82
|
-
const resultDids = mostLikedAccounts.map((a) => ({ did: a.did }));
|
|
83
|
-
if (resultDids.length < limit) {
|
|
84
|
-
// backfill with popular accounts followed by actor
|
|
85
|
-
const mostPopularAccountsActorFollows = await db.db
|
|
86
|
-
.selectFrom('follow')
|
|
87
|
-
.innerJoin('profile_agg', 'follow.subjectDid', 'profile_agg.did')
|
|
88
|
-
.select('follow.subjectDid as did')
|
|
89
|
-
.where('follow.creator', '=', input.actorDid)
|
|
90
|
-
.where('follow.subjectDid', '!=', input.relativeToDid)
|
|
91
|
-
.where('follow.subjectDid', 'not in', actorsViewerFollows)
|
|
92
|
-
.if(resultDids.length > 0, (qb) => qb.where('subjectDid', 'not in', resultDids.map((a) => a.did)))
|
|
93
|
-
.orderBy('profile_agg.followersCount', 'desc')
|
|
94
|
-
.limit(limit)
|
|
95
|
-
.execute();
|
|
96
|
-
resultDids.push(...mostPopularAccountsActorFollows);
|
|
97
|
-
}
|
|
98
|
-
if (resultDids.length < limit) {
|
|
99
|
-
// backfill with suggested_follow table
|
|
100
|
-
const additional = await db.db
|
|
101
|
-
.selectFrom('suggested_follow')
|
|
102
|
-
.where('did', 'not in',
|
|
103
|
-
// exclude any we already have
|
|
104
|
-
resultDids
|
|
105
|
-
.map((a) => a.did)
|
|
106
|
-
.concat([input.actorDid, input.relativeToDid]))
|
|
107
|
-
// and aren't already followed by viewer
|
|
108
|
-
.where('did', 'not in', actorsViewerFollows)
|
|
109
|
-
.selectAll()
|
|
110
|
-
.execute();
|
|
111
|
-
resultDids.push(...additional);
|
|
112
|
-
}
|
|
113
|
-
return { dids: resultDids.map((x) => x.did) };
|
|
114
|
-
};
|
|
115
|
-
const parseCursor = (cursor) => {
|
|
116
|
-
if (!cursor) {
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
return cursor
|
|
121
|
-
.split(':')
|
|
122
|
-
.map((id) => parseInt(id, 10))
|
|
123
|
-
.filter((id) => !isNaN(id));
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const shuffle = (arr) => {
|
|
130
|
-
return arr
|
|
131
|
-
.map((value) => ({ value, sort: Math.random() }))
|
|
132
|
-
.sort((a, b) => a.sort - b.sort)
|
|
133
|
-
.map(({ value }) => value);
|
|
134
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (db) => ({
|
|
4
|
-
async getLatestRev(req) {
|
|
5
|
-
const res = await db.db
|
|
6
|
-
.selectFrom('actor_sync')
|
|
7
|
-
.where('did', '=', req.actorDid)
|
|
8
|
-
.select('repoRev')
|
|
9
|
-
.executeTakeFirst();
|
|
10
|
-
return {
|
|
11
|
-
rev: res?.repoRev ?? undefined,
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("../util");
|
|
4
|
-
exports.default = (db) => ({
|
|
5
|
-
async getThread(req) {
|
|
6
|
-
const { postUri, above, below } = req;
|
|
7
|
-
const [ancestors, descendents] = await Promise.all([
|
|
8
|
-
(0, util_1.getAncestorsAndSelfQb)(db.db, {
|
|
9
|
-
uri: postUri,
|
|
10
|
-
parentHeight: above,
|
|
11
|
-
})
|
|
12
|
-
.selectFrom('ancestor')
|
|
13
|
-
.selectAll()
|
|
14
|
-
.execute(),
|
|
15
|
-
(0, util_1.getDescendentsQb)(db.db, {
|
|
16
|
-
uri: postUri,
|
|
17
|
-
depth: below,
|
|
18
|
-
})
|
|
19
|
-
.selectFrom('descendent')
|
|
20
|
-
.innerJoin('post', 'post.uri', 'descendent.uri')
|
|
21
|
-
.orderBy('post.sortAt', 'desc')
|
|
22
|
-
.selectAll()
|
|
23
|
-
.execute(),
|
|
24
|
-
]);
|
|
25
|
-
const uris = [
|
|
26
|
-
...ancestors.map((p) => p.uri),
|
|
27
|
-
...descendents.map((p) => p.uri),
|
|
28
|
-
];
|
|
29
|
-
return { uris };
|
|
30
|
-
},
|
|
31
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IdResolver } from '@atproto/identity';
|
|
2
|
-
import { Firehose, MemoryRunner } from '@atproto/sync';
|
|
3
|
-
import { BackgroundQueue } from './background';
|
|
4
|
-
import { Database } from './db';
|
|
5
|
-
import { IndexingService } from './indexing';
|
|
6
|
-
export declare class RepoSubscription {
|
|
7
|
-
opts: {
|
|
8
|
-
service: string;
|
|
9
|
-
db: Database;
|
|
10
|
-
idResolver: IdResolver;
|
|
11
|
-
};
|
|
12
|
-
firehose: Firehose;
|
|
13
|
-
runner: MemoryRunner;
|
|
14
|
-
background: BackgroundQueue;
|
|
15
|
-
indexingSvc: IndexingService;
|
|
16
|
-
constructor(opts: {
|
|
17
|
-
service: string;
|
|
18
|
-
db: Database;
|
|
19
|
-
idResolver: IdResolver;
|
|
20
|
-
});
|
|
21
|
-
start(): void;
|
|
22
|
-
restart(): Promise<void>;
|
|
23
|
-
processAll(): Promise<void>;
|
|
24
|
-
destroy(): Promise<void>;
|
|
25
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RepoSubscription = void 0;
|
|
4
|
-
const repo_1 = require("@atproto/repo");
|
|
5
|
-
const sync_1 = require("@atproto/sync");
|
|
6
|
-
const logger_1 = require("../../logger");
|
|
7
|
-
const background_1 = require("./background");
|
|
8
|
-
const indexing_1 = require("./indexing");
|
|
9
|
-
class RepoSubscription {
|
|
10
|
-
constructor(opts) {
|
|
11
|
-
Object.defineProperty(this, "opts", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: opts
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "firehose", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(this, "runner", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "background", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: void 0
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "indexingSvc", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
const { service, db, idResolver } = opts;
|
|
42
|
-
this.background = new background_1.BackgroundQueue(db);
|
|
43
|
-
this.indexingSvc = new indexing_1.IndexingService(db, idResolver);
|
|
44
|
-
const { runner, firehose } = createFirehose({
|
|
45
|
-
idResolver,
|
|
46
|
-
service,
|
|
47
|
-
indexingSvc: this.indexingSvc,
|
|
48
|
-
});
|
|
49
|
-
this.runner = runner;
|
|
50
|
-
this.firehose = firehose;
|
|
51
|
-
}
|
|
52
|
-
start() {
|
|
53
|
-
this.firehose.start();
|
|
54
|
-
}
|
|
55
|
-
async restart() {
|
|
56
|
-
await this.destroy();
|
|
57
|
-
const { runner, firehose } = createFirehose({
|
|
58
|
-
idResolver: this.opts.idResolver,
|
|
59
|
-
service: this.opts.service,
|
|
60
|
-
indexingSvc: this.indexingSvc,
|
|
61
|
-
});
|
|
62
|
-
this.runner = runner;
|
|
63
|
-
this.firehose = firehose;
|
|
64
|
-
this.start();
|
|
65
|
-
}
|
|
66
|
-
async processAll() {
|
|
67
|
-
await this.runner.processAll();
|
|
68
|
-
await this.background.processAll();
|
|
69
|
-
}
|
|
70
|
-
async destroy() {
|
|
71
|
-
await this.firehose.destroy();
|
|
72
|
-
await this.runner.destroy();
|
|
73
|
-
await this.background.processAll();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.RepoSubscription = RepoSubscription;
|
|
77
|
-
const createFirehose = (opts) => {
|
|
78
|
-
const { idResolver, service, indexingSvc } = opts;
|
|
79
|
-
const runner = new sync_1.MemoryRunner({ startCursor: 0 });
|
|
80
|
-
const firehose = new sync_1.Firehose({
|
|
81
|
-
idResolver,
|
|
82
|
-
runner,
|
|
83
|
-
service,
|
|
84
|
-
unauthenticatedHandles: true, // indexing service handles these
|
|
85
|
-
unauthenticatedCommits: true, // @TODO there seems to be a very rare issue where the authenticator thinks a block is missing in deletion ops
|
|
86
|
-
onError: (err) => logger_1.subLogger.error({ err }, 'error in subscription'),
|
|
87
|
-
handleEvent: async (evt) => {
|
|
88
|
-
if (evt.event === 'identity') {
|
|
89
|
-
await indexingSvc.indexHandle(evt.did, evt.time, true);
|
|
90
|
-
}
|
|
91
|
-
else if (evt.event === 'account') {
|
|
92
|
-
if (evt.active === false && evt.status === 'deleted') {
|
|
93
|
-
await indexingSvc.deleteActor(evt.did);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
await indexingSvc.updateActorStatus(evt.did, evt.active, evt.status);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
const indexFn = evt.event === 'delete'
|
|
101
|
-
? indexingSvc.deleteRecord(evt.uri)
|
|
102
|
-
: indexingSvc.indexRecord(evt.uri, evt.cid, evt.record, evt.event === 'create'
|
|
103
|
-
? repo_1.WriteOpAction.Create
|
|
104
|
-
: repo_1.WriteOpAction.Update, evt.time);
|
|
105
|
-
await Promise.all([
|
|
106
|
-
indexFn,
|
|
107
|
-
indexingSvc.setCommitLastSeen(evt.did, evt.commit, evt.rev),
|
|
108
|
-
indexingSvc.indexHandle(evt.did, evt.time),
|
|
109
|
-
]);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
return { firehose, runner };
|
|
114
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.violatesThreadGate = exports.invalidReplyRoot = exports.getAncestorsAndSelfQb = exports.getDescendentsQb = void 0;
|
|
4
|
-
const kysely_1 = require("kysely");
|
|
5
|
-
const util_1 = require("../../views/util");
|
|
6
|
-
const util_2 = require("./db/util");
|
|
7
|
-
const getDescendentsQb = (db, opts) => {
|
|
8
|
-
const { uri, depth } = opts;
|
|
9
|
-
const query = db.withRecursive('descendent(uri, depth)', (cte) => {
|
|
10
|
-
return cte
|
|
11
|
-
.selectFrom('post')
|
|
12
|
-
.select(['post.uri as uri', (0, kysely_1.sql) `1`.as('depth')])
|
|
13
|
-
.where((0, kysely_1.sql) `1`, '<=', depth)
|
|
14
|
-
.where('replyParent', '=', uri)
|
|
15
|
-
.unionAll(cte
|
|
16
|
-
.selectFrom('post')
|
|
17
|
-
.innerJoin('descendent', 'descendent.uri', 'post.replyParent')
|
|
18
|
-
.where('descendent.depth', '<', depth)
|
|
19
|
-
.select([
|
|
20
|
-
'post.uri as uri',
|
|
21
|
-
(0, kysely_1.sql) `descendent.depth + 1`.as('depth'),
|
|
22
|
-
]));
|
|
23
|
-
});
|
|
24
|
-
return query;
|
|
25
|
-
};
|
|
26
|
-
exports.getDescendentsQb = getDescendentsQb;
|
|
27
|
-
const getAncestorsAndSelfQb = (db, opts) => {
|
|
28
|
-
const { uri, parentHeight } = opts;
|
|
29
|
-
const query = db.withRecursive('ancestor(uri, ancestorUri, height)', (cte) => {
|
|
30
|
-
return cte
|
|
31
|
-
.selectFrom('post')
|
|
32
|
-
.select([
|
|
33
|
-
'post.uri as uri',
|
|
34
|
-
'post.replyParent as ancestorUri',
|
|
35
|
-
(0, kysely_1.sql) `0`.as('height'),
|
|
36
|
-
])
|
|
37
|
-
.where('uri', '=', uri)
|
|
38
|
-
.unionAll(cte
|
|
39
|
-
.selectFrom('post')
|
|
40
|
-
.innerJoin('ancestor', 'ancestor.ancestorUri', 'post.uri')
|
|
41
|
-
.where('ancestor.height', '<', parentHeight)
|
|
42
|
-
.select([
|
|
43
|
-
'post.uri as uri',
|
|
44
|
-
'post.replyParent as ancestorUri',
|
|
45
|
-
(0, kysely_1.sql) `ancestor.height + 1`.as('height'),
|
|
46
|
-
]));
|
|
47
|
-
});
|
|
48
|
-
return query;
|
|
49
|
-
};
|
|
50
|
-
exports.getAncestorsAndSelfQb = getAncestorsAndSelfQb;
|
|
51
|
-
const invalidReplyRoot = (reply, parent) => {
|
|
52
|
-
const replyRoot = reply.root.uri;
|
|
53
|
-
const replyParent = reply.parent.uri;
|
|
54
|
-
// if parent is not a valid reply, transitively this is not a valid one either
|
|
55
|
-
if (parent.invalidReplyRoot) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
// replying to root post: ensure the root looks correct
|
|
59
|
-
if (replyParent === replyRoot) {
|
|
60
|
-
return !!parent.record.reply;
|
|
61
|
-
}
|
|
62
|
-
// replying to a reply: ensure the parent is a reply for the same root post
|
|
63
|
-
return parent.record.reply?.root.uri !== replyRoot;
|
|
64
|
-
};
|
|
65
|
-
exports.invalidReplyRoot = invalidReplyRoot;
|
|
66
|
-
const violatesThreadGate = async (db, replierDid, ownerDid, rootPost, gate) => {
|
|
67
|
-
const { canReply, allowFollower, allowFollowing, allowListUris = [], } = (0, util_1.parseThreadGate)(replierDid, ownerDid, rootPost, gate);
|
|
68
|
-
if (canReply) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (!allowFollower && !allowFollowing && !allowListUris?.length) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
const { ref } = db.dynamic;
|
|
75
|
-
const nullResult = (0, kysely_1.sql) `${null}`;
|
|
76
|
-
const check = await db
|
|
77
|
-
.selectFrom((0, util_2.valuesList)([replierDid]).as((0, kysely_1.sql) `subject (did)`))
|
|
78
|
-
.select([
|
|
79
|
-
allowFollower
|
|
80
|
-
? db
|
|
81
|
-
.selectFrom('follow')
|
|
82
|
-
.where('subjectDid', '=', ownerDid)
|
|
83
|
-
.whereRef('creator', '=', ref('subject.did'))
|
|
84
|
-
.select('subjectDid')
|
|
85
|
-
.as('isFollower')
|
|
86
|
-
: nullResult.as('isFollower'),
|
|
87
|
-
allowFollowing
|
|
88
|
-
? db
|
|
89
|
-
.selectFrom('follow')
|
|
90
|
-
.where('creator', '=', ownerDid)
|
|
91
|
-
.whereRef('subjectDid', '=', ref('subject.did'))
|
|
92
|
-
.select('creator')
|
|
93
|
-
.as('isFollowed')
|
|
94
|
-
: nullResult.as('isFollowed'),
|
|
95
|
-
allowListUris.length
|
|
96
|
-
? db
|
|
97
|
-
.selectFrom('list_item')
|
|
98
|
-
.where('list_item.listUri', 'in', allowListUris)
|
|
99
|
-
.whereRef('list_item.subjectDid', '=', ref('subject.did'))
|
|
100
|
-
.limit(1)
|
|
101
|
-
.select('listUri')
|
|
102
|
-
.as('isInList')
|
|
103
|
-
: nullResult.as('isInList'),
|
|
104
|
-
])
|
|
105
|
-
.executeTakeFirst();
|
|
106
|
-
if (allowFollowing && check?.isFollowed) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
else if (allowFollower && check?.isFollower) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
else if (allowListUris.length && check?.isInList) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
return true;
|
|
116
|
-
};
|
|
117
|
-
exports.violatesThreadGate = violatesThreadGate;
|
package/dist/error.d.ts
DELETED
package/dist/error.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = void 0;
|
|
4
|
-
const xrpc_server_1 = require("@atproto/xrpc-server");
|
|
5
|
-
const logger_1 = require("./logger");
|
|
6
|
-
const handler = (err, _req, res, next) => {
|
|
7
|
-
logger_1.httpLogger.error(err, 'unexpected internal server error');
|
|
8
|
-
if (res.headersSent) {
|
|
9
|
-
return next(err);
|
|
10
|
-
}
|
|
11
|
-
const serverError = xrpc_server_1.XRPCError.fromError(err);
|
|
12
|
-
res.status(serverError.type).json(serverError.payload);
|
|
13
|
-
};
|
|
14
|
-
exports.handler = handler;
|
package/dist/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import { Server } from 'http';
|
|
3
|
-
import { ServerConfig } from './config';
|
|
4
|
-
import AppContext from './context';
|
|
5
|
-
export declare class ClioAppView {
|
|
6
|
-
ctx: AppContext;
|
|
7
|
-
app: express.Application;
|
|
8
|
-
server?: Server;
|
|
9
|
-
private terminator?;
|
|
10
|
-
constructor(opts: {
|
|
11
|
-
ctx: AppContext;
|
|
12
|
-
app: express.Application;
|
|
13
|
-
});
|
|
14
|
-
static create(opts: {
|
|
15
|
-
config: ServerConfig;
|
|
16
|
-
}): ClioAppView;
|
|
17
|
-
start(): Promise<Server>;
|
|
18
|
-
destroy(): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export default ClioAppView;
|
package/dist/index.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ClioAppView = void 0;
|
|
40
|
-
const common_1 = require("@atproto/common");
|
|
41
|
-
const cors_1 = __importDefault(require("cors"));
|
|
42
|
-
const dotenv_1 = require("dotenv");
|
|
43
|
-
const events_1 = __importDefault(require("events"));
|
|
44
|
-
const express_1 = __importDefault(require("express"));
|
|
45
|
-
const http_terminator_1 = require("http-terminator");
|
|
46
|
-
const api_1 = __importStar(require("./api"));
|
|
47
|
-
const client_1 = require("./client");
|
|
48
|
-
const context_1 = __importDefault(require("./context"));
|
|
49
|
-
const error = __importStar(require("./error"));
|
|
50
|
-
const lexicons_1 = require("./lexicons");
|
|
51
|
-
const logger_1 = require("./logger");
|
|
52
|
-
(0, dotenv_1.config)();
|
|
53
|
-
class ClioAppView {
|
|
54
|
-
constructor(opts) {
|
|
55
|
-
Object.defineProperty(this, "ctx", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: void 0
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, "app", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: void 0
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "server", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: void 0
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "terminator", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: void 0
|
|
78
|
-
});
|
|
79
|
-
this.ctx = opts.ctx;
|
|
80
|
-
this.app = opts.app;
|
|
81
|
-
}
|
|
82
|
-
static create(opts) {
|
|
83
|
-
const { config } = opts;
|
|
84
|
-
const app = (0, express_1.default)();
|
|
85
|
-
app.use((0, cors_1.default)({ maxAge: common_1.DAY / common_1.SECOND }));
|
|
86
|
-
app.use(logger_1.loggerMiddleware);
|
|
87
|
-
const dataplane = (0, client_1.createBaseClient)('http://localhost:4000', {});
|
|
88
|
-
const server = (0, lexicons_1.createServer)();
|
|
89
|
-
const ctx = new context_1.default({
|
|
90
|
-
cfg: config,
|
|
91
|
-
dataplane,
|
|
92
|
-
});
|
|
93
|
-
const api = (0, api_1.default)(server, ctx);
|
|
94
|
-
app.use(api_1.health.createRouter(ctx));
|
|
95
|
-
app.use(api.xrpc.router);
|
|
96
|
-
app.use(error.handler);
|
|
97
|
-
return new ClioAppView({ ctx, app });
|
|
98
|
-
}
|
|
99
|
-
async start() {
|
|
100
|
-
console.log('Starting Clio AppView...');
|
|
101
|
-
const server = this.app.listen(this.ctx.cfg.port);
|
|
102
|
-
this.server = server;
|
|
103
|
-
server.keepAliveTimeout = 90000;
|
|
104
|
-
this.terminator = (0, http_terminator_1.createHttpTerminator)({ server });
|
|
105
|
-
await events_1.default.once(server, 'listening');
|
|
106
|
-
const { port } = server.address();
|
|
107
|
-
this.ctx.cfg.assignPort(port);
|
|
108
|
-
return server;
|
|
109
|
-
}
|
|
110
|
-
async destroy() {
|
|
111
|
-
await this.terminator?.terminate();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.ClioAppView = ClioAppView;
|
|
115
|
-
exports.default = ClioAppView;
|