logdb-client
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,1 +0,49 @@ | ||
export { LogDB } from './logdb.ts'; | ||
import * as axios from 'axios'; | ||
interface ClientOptions { | ||
url: string; | ||
token: string; | ||
listen: string[]; | ||
} | ||
interface EventObject { | ||
id: number; | ||
type: string; | ||
payload: string; | ||
timestamp: number; | ||
} | ||
interface EventContext { | ||
id: number; | ||
type: string; | ||
payload: string; | ||
createdAt: number; | ||
processed: boolean; | ||
} | ||
type Events = EventContext[]; | ||
type EventHandlerFn = (event: EventContext) => Promise<void> | void; | ||
type EventsReceivedHandlerFn = (events: Events) => Promise<void> | void; | ||
type FailEventHandlerFn = (error: Error, event: EventContext) => Promise<void> | void; | ||
interface MessageHandlerInternalMap { | ||
event: EventHandlerFn; | ||
fail: FailEventHandlerFn; | ||
response: EventsReceivedHandlerFn; | ||
} | ||
type EventHandlerName = keyof MessageHandlerInternalMap; | ||
type EventHandler<K extends EventHandlerName> = MessageHandlerInternalMap[K]; | ||
declare class LogDB { | ||
private handlers; | ||
private options; | ||
private logDB; | ||
lastEventId: number; | ||
constructor(options: ClientOptions); | ||
private createApiClient; | ||
private registerHandler; | ||
on<Type extends EventHandlerName>(type: Type, handler: EventHandler<Type>): void; | ||
fetchEvents(limit?: number): Promise<axios.AxiosResponse<EventObject[], any> | undefined>; | ||
ack(eventId: number): Promise<boolean>; | ||
nack(): Promise<boolean>; | ||
private eventReceiver; | ||
listen(): Promise<void>; | ||
} | ||
export { LogDB }; |
{ | ||
"name": "logdb-client", | ||
"version": "0.0.3", | ||
"module": "index.ts", | ||
"version": "0.0.4", | ||
"type": "module", | ||
"scripts": { | ||
"build": "bun build ./lib/index.ts --outfile=dist/index.js && bun run build:declaration", | ||
"build": "tsup", | ||
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json" | ||
}, | ||
"main": "dist/index.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/*.js", | ||
"dist/*.d.ts" | ||
], | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"files": ["dist"], | ||
"author": "azabroflovski", | ||
"devDependencies": { | ||
"@types/bun": "latest" | ||
"@types/bun": "latest", | ||
"tsup": "^8.2.4" | ||
}, | ||
@@ -20,0 +25,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
1
10324
2
6
281