pounce-agent-data 1.0.0 → 1.1.0
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/README.md +2 -2
- package/dist/index.d.mts +4 -25
- package/dist/index.d.ts +4 -25
- package/dist/index.js +3 -76
- package/dist/index.mjs +3 -76
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ TypeScript SDK for the [Pounce Agent Data API](https://pounce.ch/developers) - C
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install pounce-agent-data
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { PounceClient } from '
|
|
14
|
+
import { PounceClient } from 'pounce-agent-data';
|
|
15
15
|
|
|
16
16
|
const client = new PounceClient({ apiKey: 'pounce_live_xxx' });
|
|
17
17
|
|
package/dist/index.d.mts
CHANGED
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
* // Semantic search
|
|
17
17
|
* const results = await client.search('AI companies in healthcare', { limit: 20 });
|
|
18
18
|
*
|
|
19
|
-
* //
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* }
|
|
19
|
+
* // Use search for targeted queries
|
|
20
|
+
* const results = await client.search('AI healthcare');
|
|
21
|
+
* results.json.items.forEach(r => console.log(r.domain));
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
24
|
type RateLimitInfo = {
|
|
@@ -128,11 +127,6 @@ type SemanticSearchOptions = {
|
|
|
128
127
|
country?: string;
|
|
129
128
|
tlds?: string[];
|
|
130
129
|
};
|
|
131
|
-
type StreamOptions = {
|
|
132
|
-
minScore?: number;
|
|
133
|
-
category?: string;
|
|
134
|
-
since?: string;
|
|
135
|
-
};
|
|
136
130
|
declare class PounceAgentDataClient {
|
|
137
131
|
private readonly apiKey;
|
|
138
132
|
private readonly baseUrl;
|
|
@@ -182,23 +176,8 @@ declare class PounceAgentDataClient {
|
|
|
182
176
|
json: AgentDataUsageResponse;
|
|
183
177
|
rateLimit: RateLimitInfo;
|
|
184
178
|
}>;
|
|
185
|
-
/**
|
|
186
|
-
* Stream new signals in real-time via SSE.
|
|
187
|
-
*
|
|
188
|
-
* @param options - Stream options
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```typescript
|
|
192
|
-
* for await (const signal of client.stream({ minScore: 70 })) {
|
|
193
|
-
* console.log(`New signal: ${signal.domain} (score=${signal.signalScore})`);
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
196
|
-
*
|
|
197
|
-
* @note This is an async generator. Make sure to handle connection errors and reconnect if needed.
|
|
198
|
-
*/
|
|
199
|
-
stream(options?: StreamOptions): AsyncGenerator<Signal, void, unknown>;
|
|
200
179
|
private parseSignal;
|
|
201
180
|
}
|
|
202
181
|
declare const PounceClient: typeof PounceAgentDataClient;
|
|
203
182
|
|
|
204
|
-
export { type AgentDataRecentSignal, type AgentDataUsageResponse, PounceAgentDataClient, PounceClient, type RateLimitInfo, type RecentSignalsOptions, type RecentSignalsResponse, type SemanticSearchItem, type SemanticSearchOptions, type SemanticSearchResponse, type Signal, type SignalDetailResponse
|
|
183
|
+
export { type AgentDataRecentSignal, type AgentDataUsageResponse, PounceAgentDataClient, PounceClient, type RateLimitInfo, type RecentSignalsOptions, type RecentSignalsResponse, type SemanticSearchItem, type SemanticSearchOptions, type SemanticSearchResponse, type Signal, type SignalDetailResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
* // Semantic search
|
|
17
17
|
* const results = await client.search('AI companies in healthcare', { limit: 20 });
|
|
18
18
|
*
|
|
19
|
-
* //
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* }
|
|
19
|
+
* // Use search for targeted queries
|
|
20
|
+
* const results = await client.search('AI healthcare');
|
|
21
|
+
* results.json.items.forEach(r => console.log(r.domain));
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
24
|
type RateLimitInfo = {
|
|
@@ -128,11 +127,6 @@ type SemanticSearchOptions = {
|
|
|
128
127
|
country?: string;
|
|
129
128
|
tlds?: string[];
|
|
130
129
|
};
|
|
131
|
-
type StreamOptions = {
|
|
132
|
-
minScore?: number;
|
|
133
|
-
category?: string;
|
|
134
|
-
since?: string;
|
|
135
|
-
};
|
|
136
130
|
declare class PounceAgentDataClient {
|
|
137
131
|
private readonly apiKey;
|
|
138
132
|
private readonly baseUrl;
|
|
@@ -182,23 +176,8 @@ declare class PounceAgentDataClient {
|
|
|
182
176
|
json: AgentDataUsageResponse;
|
|
183
177
|
rateLimit: RateLimitInfo;
|
|
184
178
|
}>;
|
|
185
|
-
/**
|
|
186
|
-
* Stream new signals in real-time via SSE.
|
|
187
|
-
*
|
|
188
|
-
* @param options - Stream options
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```typescript
|
|
192
|
-
* for await (const signal of client.stream({ minScore: 70 })) {
|
|
193
|
-
* console.log(`New signal: ${signal.domain} (score=${signal.signalScore})`);
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
196
|
-
*
|
|
197
|
-
* @note This is an async generator. Make sure to handle connection errors and reconnect if needed.
|
|
198
|
-
*/
|
|
199
|
-
stream(options?: StreamOptions): AsyncGenerator<Signal, void, unknown>;
|
|
200
179
|
private parseSignal;
|
|
201
180
|
}
|
|
202
181
|
declare const PounceClient: typeof PounceAgentDataClient;
|
|
203
182
|
|
|
204
|
-
export { type AgentDataRecentSignal, type AgentDataUsageResponse, PounceAgentDataClient, PounceClient, type RateLimitInfo, type RecentSignalsOptions, type RecentSignalsResponse, type SemanticSearchItem, type SemanticSearchOptions, type SemanticSearchResponse, type Signal, type SignalDetailResponse
|
|
183
|
+
export { type AgentDataRecentSignal, type AgentDataUsageResponse, PounceAgentDataClient, PounceClient, type RateLimitInfo, type RecentSignalsOptions, type RecentSignalsResponse, type SemanticSearchItem, type SemanticSearchOptions, type SemanticSearchResponse, type Signal, type SignalDetailResponse };
|
package/dist/index.js
CHANGED
|
@@ -90,7 +90,7 @@ var PounceAgentDataClient = class {
|
|
|
90
90
|
*/
|
|
91
91
|
async recentSignals(options = {}) {
|
|
92
92
|
const { hours = 24, limit = 100, minScore = 50, category, country, tlds } = options;
|
|
93
|
-
return this.getJson("/api/v1/agent-data/recent", {
|
|
93
|
+
return this.getJson("/api/v1/agent-data/signals/recent", {
|
|
94
94
|
hours,
|
|
95
95
|
limit,
|
|
96
96
|
min_score: minScore,
|
|
@@ -144,81 +144,8 @@ var PounceAgentDataClient = class {
|
|
|
144
144
|
async usage() {
|
|
145
145
|
return this.getJson("/api/v1/agent-data/usage");
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
* @param options - Stream options
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* for await (const signal of client.stream({ minScore: 70 })) {
|
|
155
|
-
* console.log(`New signal: ${signal.domain} (score=${signal.signalScore})`);
|
|
156
|
-
* }
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* @note This is an async generator. Make sure to handle connection errors and reconnect if needed.
|
|
160
|
-
*/
|
|
161
|
-
async *stream(options = {}) {
|
|
162
|
-
const { minScore = 50, category, since } = options;
|
|
163
|
-
const url = new URL(`${this.baseUrl}/api/v1/agent-data/streams/signals`);
|
|
164
|
-
url.searchParams.set("min_score", String(minScore));
|
|
165
|
-
if (category) url.searchParams.set("category", category);
|
|
166
|
-
if (since) url.searchParams.set("since", since);
|
|
167
|
-
const res = await fetch(url.toString(), {
|
|
168
|
-
method: "GET",
|
|
169
|
-
headers: {
|
|
170
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
171
|
-
Accept: "text/event-stream"
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
if (!res.ok) {
|
|
175
|
-
const text = await res.text();
|
|
176
|
-
throw new Error(`HTTP ${res.status}: ${text}`);
|
|
177
|
-
}
|
|
178
|
-
if (!res.body) {
|
|
179
|
-
throw new Error("Response body is null");
|
|
180
|
-
}
|
|
181
|
-
const reader = res.body.getReader();
|
|
182
|
-
const decoder = new TextDecoder();
|
|
183
|
-
let buffer = "";
|
|
184
|
-
let eventType = null;
|
|
185
|
-
let dataBuffer = [];
|
|
186
|
-
try {
|
|
187
|
-
while (true) {
|
|
188
|
-
const { done, value } = await reader.read();
|
|
189
|
-
if (done) break;
|
|
190
|
-
buffer += decoder.decode(value, { stream: true });
|
|
191
|
-
const lines = buffer.split("\n");
|
|
192
|
-
buffer = lines.pop() ?? "";
|
|
193
|
-
for (const line of lines) {
|
|
194
|
-
const trimmed = line.replace(/\r$/, "");
|
|
195
|
-
if (!trimmed) {
|
|
196
|
-
if (eventType === "signal" && dataBuffer.length > 0) {
|
|
197
|
-
try {
|
|
198
|
-
const rawData = dataBuffer.join("\n");
|
|
199
|
-
const parsed = JSON.parse(rawData);
|
|
200
|
-
yield this.parseSignal(parsed);
|
|
201
|
-
} catch {
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
eventType = null;
|
|
205
|
-
dataBuffer = [];
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
if (trimmed.startsWith(":")) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
if (trimmed.startsWith("event:")) {
|
|
212
|
-
eventType = trimmed.slice(6).trim();
|
|
213
|
-
} else if (trimmed.startsWith("data:")) {
|
|
214
|
-
dataBuffer.push(trimmed.slice(5).trim());
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
} finally {
|
|
219
|
-
reader.releaseLock();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
147
|
+
// stream() method removed - streaming endpoint deprecated
|
|
148
|
+
// See https://gitlab.pounce.ch/pounce/pounce/-/issues/829
|
|
222
149
|
parseSignal(raw) {
|
|
223
150
|
return {
|
|
224
151
|
signalId: raw.signal_id ?? String(raw.id),
|
package/dist/index.mjs
CHANGED
|
@@ -65,7 +65,7 @@ var PounceAgentDataClient = class {
|
|
|
65
65
|
*/
|
|
66
66
|
async recentSignals(options = {}) {
|
|
67
67
|
const { hours = 24, limit = 100, minScore = 50, category, country, tlds } = options;
|
|
68
|
-
return this.getJson("/api/v1/agent-data/recent", {
|
|
68
|
+
return this.getJson("/api/v1/agent-data/signals/recent", {
|
|
69
69
|
hours,
|
|
70
70
|
limit,
|
|
71
71
|
min_score: minScore,
|
|
@@ -119,81 +119,8 @@ var PounceAgentDataClient = class {
|
|
|
119
119
|
async usage() {
|
|
120
120
|
return this.getJson("/api/v1/agent-data/usage");
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
* @param options - Stream options
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* for await (const signal of client.stream({ minScore: 70 })) {
|
|
130
|
-
* console.log(`New signal: ${signal.domain} (score=${signal.signalScore})`);
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* @note This is an async generator. Make sure to handle connection errors and reconnect if needed.
|
|
135
|
-
*/
|
|
136
|
-
async *stream(options = {}) {
|
|
137
|
-
const { minScore = 50, category, since } = options;
|
|
138
|
-
const url = new URL(`${this.baseUrl}/api/v1/agent-data/streams/signals`);
|
|
139
|
-
url.searchParams.set("min_score", String(minScore));
|
|
140
|
-
if (category) url.searchParams.set("category", category);
|
|
141
|
-
if (since) url.searchParams.set("since", since);
|
|
142
|
-
const res = await fetch(url.toString(), {
|
|
143
|
-
method: "GET",
|
|
144
|
-
headers: {
|
|
145
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
146
|
-
Accept: "text/event-stream"
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
if (!res.ok) {
|
|
150
|
-
const text = await res.text();
|
|
151
|
-
throw new Error(`HTTP ${res.status}: ${text}`);
|
|
152
|
-
}
|
|
153
|
-
if (!res.body) {
|
|
154
|
-
throw new Error("Response body is null");
|
|
155
|
-
}
|
|
156
|
-
const reader = res.body.getReader();
|
|
157
|
-
const decoder = new TextDecoder();
|
|
158
|
-
let buffer = "";
|
|
159
|
-
let eventType = null;
|
|
160
|
-
let dataBuffer = [];
|
|
161
|
-
try {
|
|
162
|
-
while (true) {
|
|
163
|
-
const { done, value } = await reader.read();
|
|
164
|
-
if (done) break;
|
|
165
|
-
buffer += decoder.decode(value, { stream: true });
|
|
166
|
-
const lines = buffer.split("\n");
|
|
167
|
-
buffer = lines.pop() ?? "";
|
|
168
|
-
for (const line of lines) {
|
|
169
|
-
const trimmed = line.replace(/\r$/, "");
|
|
170
|
-
if (!trimmed) {
|
|
171
|
-
if (eventType === "signal" && dataBuffer.length > 0) {
|
|
172
|
-
try {
|
|
173
|
-
const rawData = dataBuffer.join("\n");
|
|
174
|
-
const parsed = JSON.parse(rawData);
|
|
175
|
-
yield this.parseSignal(parsed);
|
|
176
|
-
} catch {
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
eventType = null;
|
|
180
|
-
dataBuffer = [];
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (trimmed.startsWith(":")) {
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (trimmed.startsWith("event:")) {
|
|
187
|
-
eventType = trimmed.slice(6).trim();
|
|
188
|
-
} else if (trimmed.startsWith("data:")) {
|
|
189
|
-
dataBuffer.push(trimmed.slice(5).trim());
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
} finally {
|
|
194
|
-
reader.releaseLock();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
122
|
+
// stream() method removed - streaming endpoint deprecated
|
|
123
|
+
// See https://gitlab.pounce.ch/pounce/pounce/-/issues/829
|
|
197
124
|
parseSignal(raw) {
|
|
198
125
|
return {
|
|
199
126
|
signalId: raw.signal_id ?? String(raw.id),
|