Socket
Socket
Sign inDemoInstall

@big-whale-labs/botcaster

Package Overview
Dependencies
124
Maintainers
10
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.21 to 0.0.23

20

dist/helpers/currentNotificationId.js

@@ -1,2 +0,8 @@

import nodePersist from 'node-persist';
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentNotificationId = exports.setCurrentNotificationId = void 0;
const node_persist_1 = __importDefault(require("node-persist"));
let initialized = false;

@@ -6,14 +12,16 @@ async function checkInitialized() {

return;
await nodePersist.init();
await node_persist_1.default.init();
initialized = true;
}
const key = 'currentNotificationId';
export async function setCurrentNotificationId(currentNotificationId) {
async function setCurrentNotificationId(currentNotificationId) {
await checkInitialized();
await nodePersist.setItem(key, currentNotificationId);
await node_persist_1.default.setItem(key, currentNotificationId);
}
export async function getCurrentNotificationId() {
exports.setCurrentNotificationId = setCurrentNotificationId;
async function getCurrentNotificationId() {
await checkInitialized();
return nodePersist.getItem(key);
return node_persist_1.default.getItem(key);
}
exports.getCurrentNotificationId = getCurrentNotificationId;
//# sourceMappingURL=currentNotificationId.js.map

@@ -1,4 +0,6 @@

import { NeynarAPIClient } from '@standard-crypto/farcaster-js-neynar';
export default function (fid, cursor, apiKey) {
const client = new NeynarAPIClient(apiKey);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const farcaster_js_neynar_1 = require("@standard-crypto/farcaster-js-neynar");
function default_1(fid, cursor, apiKey) {
const client = new farcaster_js_neynar_1.NeynarAPIClient(apiKey);
return client.v1.apis.notifications.mentionsAndReplies({

@@ -10,2 +12,3 @@ fid,

}
exports.default = default_1;
//# sourceMappingURL=fetchNotifications.js.map

@@ -1,3 +0,9 @@

import { getCurrentNotificationId, setCurrentNotificationId, } from './currentNotificationId';
import fetchNotifications from './fetchNotifications';
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.startPolling = void 0;
const currentNotificationId_1 = require("@/helpers/currentNotificationId");
const fetchNotifications_1 = __importDefault(require("@/helpers/fetchNotifications"));
let polling = false;

@@ -9,3 +15,3 @@ async function pollNotifications(fid, apiKey, handler) {

try {
const currentNotificationId = await getCurrentNotificationId();
const currentNotificationId = await (0, currentNotificationId_1.getCurrentNotificationId)();
let currentNotificationIdInSet = true;

@@ -15,11 +21,11 @@ let cursor = '';

do {
const { data: { result, next }, } = await fetchNotifications(fid, cursor, apiKey);
notifications.push(...result.notifications);
const { data: { result: { notifications, next }, }, } = await (0, fetchNotifications_1.default)(fid, cursor, apiKey);
notifications.push(...notifications);
if (currentNotificationId) {
cursor = next?.cursor || '';
currentNotificationIdInSet = notifications.some((n) => n.id === currentNotificationId);
currentNotificationIdInSet = notifications.some((n) => n.hash === currentNotificationId);
}
} while (!!currentNotificationId && !currentNotificationIdInSet && !!cursor);
if (notifications[0]?.id) {
await setCurrentNotificationId(notifications[0].id);
await (0, currentNotificationId_1.setCurrentNotificationId)(notifications[0].id);
}

@@ -37,6 +43,7 @@ for (const notification of notifications) {

}
export function startPolling(fid, apiKey, handler) {
function startPolling(fid, apiKey, handler) {
void pollNotifications(fid, apiKey, handler);
setInterval(() => pollNotifications(fid, apiKey, handler), 10 * 1000);
}
exports.startPolling = startPolling;
//# sourceMappingURL=startPolling.js.map

@@ -1,3 +0,20 @@

export * from './helpers/startPolling';
export * from './models/Notification';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
require("module-alias/register");
__exportStar(require("@/helpers/startPolling"), exports);
__exportStar(require("@/models/Notification"), exports);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,3 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Notification.js.map
{
"name": "@big-whale-labs/botcaster",
"version": "0.0.21",
"version": "0.0.23",
"description": "Farcaster bot framework",

@@ -9,2 +9,3 @@ "main": "dist/index.js",

"author": "backmeupplz <backmeupplz@gmail.com>",
"prettier": "@big-whale-labs/prettier-config",
"license": "MIT",

@@ -14,3 +15,2 @@ "files": [

],
"type": "module",
"np": {

@@ -35,2 +35,6 @@ "2fa": false,

"devDependencies": {
"@big-whale-labs/bwl-eslint-backend": "^1.0.5",
"@big-whale-labs/prettier-config": "^1.1.3",
"@rushstack/eslint-patch": "^1.7.2",
"@types/module-alias": "^2",
"@types/node": "^20.11.10",

@@ -46,2 +50,3 @@ "@types/node-persist": "^3.1.8",

"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"module-alias": "^2.2.3",
"np": "^9.2.0",

@@ -48,0 +53,0 @@ "prettier": "^3.2.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc