Skip to content

Commit

Permalink
fix the package
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Dec 22, 2022
1 parent f05a117 commit e4a659c
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 9 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"prepublishOnly": "yarn lint && yarn build"
},
"dependencies": {
"ky": "^0.33.0",
"ky-universal": "^0.11.0",
"axios": "^1.2.1",
"node-persist": "^3.1.0"
},
"devDependencies": {
Expand Down
13 changes: 7 additions & 6 deletions src/helpers/fetchNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { Notification } from '../models/Notification'
import ky from 'ky-universal'
import axios from 'axios'

export default function (cursor: string, bearerToken: string) {
return ky(
return axios.get<{
result: { notifications: Notification[] }
next?: { cursor?: string }
}>(
cursor
? `https://api.farcaster.xyz/v2/mention-and-reply-notifications?limit=10&cursor=${cursor}`
: 'https://api.farcaster.xyz/v2/mention-and-reply-notifications?limit=10',
{
headers: {
accept: 'application/json',
authorization: `Bearer ${bearerToken}`,
'Accept-Encoding': 'gzip,deflate,compress',
},
}
).json() as Promise<{
result: { notifications: Notification[] }
next?: { cursor?: string }
}>
)
}
4 changes: 3 additions & 1 deletion src/helpers/startPolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ async function pollNotifications(
let cursor = ''
const notifications = [] as Notification[]
do {
const { result, next } = await fetchNotifications(cursor, bearerToken)
const {
data: { result, next },
} = await fetchNotifications(cursor, bearerToken)
notifications.push(...result.notifications)
if (currentNotificationId) {
cursor = next?.cursor || ''
Expand Down
79 changes: 79 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ __metadata:
"@types/node-persist": ^3.1.3
"@typescript-eslint/eslint-plugin": ^5.45.0
"@typescript-eslint/parser": ^5.45.0
axios: ^1.2.1
eslint: ^8.28.0
eslint-config-prettier: ^8.5.0
eslint-plugin-import: ^2.26.0
Expand Down Expand Up @@ -597,6 +598,24 @@ __metadata:
languageName: node
linkType: hard

"asynckit@npm:^0.4.0":
version: 0.4.0
resolution: "asynckit@npm:0.4.0"
checksum: 7b78c451df768adba04e2d02e63e2d0bf3b07adcd6e42b4cf665cb7ce899bedd344c69a1dcbce355b5f972d597b25aaa1c1742b52cffd9caccb22f348114f6be
languageName: node
linkType: hard

"axios@npm:^1.2.1":
version: 1.2.1
resolution: "axios@npm:1.2.1"
dependencies:
follow-redirects: ^1.15.0
form-data: ^4.0.0
proxy-from-env: ^1.1.0
checksum: c4dc4e119064c9aed09a3de309bedb797a139a6fb372223aafe3e0c10a7d4a14e4d3e9c9d309467fadb9d2b490b891ee3df96ef5b55716bb971910466ff9f0c5
languageName: node
linkType: hard

"balanced-match@npm:^1.0.0":
version: 1.0.2
resolution: "balanced-match@npm:1.0.2"
Expand Down Expand Up @@ -880,6 +899,15 @@ __metadata:
languageName: node
linkType: hard

"combined-stream@npm:^1.0.8":
version: 1.0.8
resolution: "combined-stream@npm:1.0.8"
dependencies:
delayed-stream: ~1.0.0
checksum: 49fa4aeb4916567e33ea81d088f6584749fc90c7abec76fd516bf1c5aa5c79f3584b5ba3de6b86d26ddd64bae5329c4c7479343250cfe71c75bb366eae53bb7c
languageName: node
linkType: hard

"concat-map@npm:0.0.1":
version: 0.0.1
resolution: "concat-map@npm:0.0.1"
Expand Down Expand Up @@ -1076,6 +1104,13 @@ __metadata:
languageName: node
linkType: hard

"delayed-stream@npm:~1.0.0":
version: 1.0.0
resolution: "delayed-stream@npm:1.0.0"
checksum: 46fe6e83e2cb1d85ba50bd52803c68be9bd953282fa7096f51fc29edd5d67ff84ff753c51966061e5ba7cb5e47ef6d36a91924eddb7f3f3483b1c560f77a0020
languageName: node
linkType: hard

"dir-glob@npm:^3.0.1":
version: 3.0.1
resolution: "dir-glob@npm:3.0.1"
Expand Down Expand Up @@ -1680,6 +1715,27 @@ __metadata:
languageName: node
linkType: hard

"follow-redirects@npm:^1.15.0":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
peerDependenciesMeta:
debug:
optional: true
checksum: faa66059b66358ba65c234c2f2a37fcec029dc22775f35d9ad6abac56003268baf41e55f9ee645957b32c7d9f62baf1f0b906e68267276f54ec4b4c597c2b190
languageName: node
linkType: hard

"form-data@npm:^4.0.0":
version: 4.0.0
resolution: "form-data@npm:4.0.0"
dependencies:
asynckit: ^0.4.0
combined-stream: ^1.0.8
mime-types: ^2.1.12
checksum: 01135bf8675f9d5c61ff18e2e2932f719ca4de964e3be90ef4c36aacfc7b9cb2fceb5eca0b7e0190e3383fe51c5b37f4cb80b62ca06a99aaabfcfd6ac7c9328c
languageName: node
linkType: hard

"formdata-polyfill@npm:^4.0.10":
version: 4.0.10
resolution: "formdata-polyfill@npm:4.0.10"
Expand Down Expand Up @@ -2919,6 +2975,22 @@ __metadata:
languageName: node
linkType: hard

"mime-db@npm:1.52.0":
version: 1.52.0
resolution: "mime-db@npm:1.52.0"
checksum: 0d99a03585f8b39d68182803b12ac601d9c01abfa28ec56204fa330bc9f3d1c5e14beb049bafadb3dbdf646dfb94b87e24d4ec7b31b7279ef906a8ea9b6a513f
languageName: node
linkType: hard

"mime-types@npm:^2.1.12":
version: 2.1.35
resolution: "mime-types@npm:2.1.35"
dependencies:
mime-db: 1.52.0
checksum: 89a5b7f1def9f3af5dad6496c5ed50191ae4331cc5389d7c521c8ad28d5fdad2d06fd81baf38fed813dc4e46bb55c8145bb0ff406330818c9cf712fb2e9b3836
languageName: node
linkType: hard

"mimic-fn@npm:^1.0.0":
version: 1.2.0
resolution: "mimic-fn@npm:1.2.0"
Expand Down Expand Up @@ -3636,6 +3708,13 @@ __metadata:
languageName: node
linkType: hard

"proxy-from-env@npm:^1.1.0":
version: 1.1.0
resolution: "proxy-from-env@npm:1.1.0"
checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4
languageName: node
linkType: hard

"pump@npm:^3.0.0":
version: 3.0.0
resolution: "pump@npm:3.0.0"
Expand Down

0 comments on commit e4a659c

Please sign in to comment.