@bubblelab/bubble-core 0.1.156 → 0.1.158
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/dist/bubble-bundle.d.ts +161 -122
- package/dist/bubble-factory.d.ts.map +1 -1
- package/dist/bubble-factory.js +4 -0
- package/dist/bubble-factory.js.map +1 -1
- package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
- package/dist/bubble-trigger/index.d.ts +2 -0
- package/dist/bubble-trigger/index.d.ts.map +1 -0
- package/dist/bubble-trigger/index.js +2 -0
- package/dist/bubble-trigger/index.js.map +1 -0
- package/dist/bubble-trigger/types.d.ts +87 -0
- package/dist/bubble-trigger/types.d.ts.map +1 -0
- package/dist/bubble-trigger/types.js +14 -0
- package/dist/bubble-trigger/types.js.map +1 -0
- package/dist/bubbles/service-bubble/agi-inc.d.ts +144 -144
- package/dist/bubbles/service-bubble/ai-agent.d.ts +8 -8
- package/dist/bubbles/service-bubble/airtable.d.ts +184 -184
- package/dist/bubbles/service-bubble/apify/apify.d.ts +24 -24
- package/dist/bubbles/service-bubble/ashby/ashby.d.ts +152 -152
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +55 -55
- package/dist/bubbles/service-bubble/confluence/confluence.d.ts +63 -63
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +98 -98
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +56 -56
- package/dist/bubbles/service-bubble/firecrawl.d.ts +264 -264
- package/dist/bubbles/service-bubble/followupboss.d.ts +282 -282
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +40 -40
- package/dist/bubbles/service-bubble/github.d.ts +216 -216
- package/dist/bubbles/service-bubble/gmail.d.ts +228 -228
- package/dist/bubbles/service-bubble/google-calendar.d.ts +62 -62
- package/dist/bubbles/service-bubble/google-drive.d.ts +152 -152
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +44 -44
- package/dist/bubbles/service-bubble/google-sheets.d.ts +1811 -0
- package/dist/bubbles/service-bubble/google-sheets.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets.js +904 -0
- package/dist/bubbles/service-bubble/google-sheets.js.map +1 -0
- package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
- package/dist/bubbles/service-bubble/http.d.ts +12 -12
- package/dist/bubbles/service-bubble/insforge-db.d.ts +6 -6
- package/dist/bubbles/service-bubble/jira/jira.d.ts +107 -107
- package/dist/bubbles/service-bubble/notion/notion.d.ts +932 -932
- package/dist/bubbles/service-bubble/postgresql.d.ts +6 -6
- package/dist/bubbles/service-bubble/posthog/index.d.ts +3 -0
- package/dist/bubbles/service-bubble/posthog/index.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/posthog/index.js +3 -0
- package/dist/bubbles/service-bubble/posthog/index.js.map +1 -0
- package/dist/bubbles/service-bubble/posthog/posthog.d.ts +469 -0
- package/dist/bubbles/service-bubble/posthog/posthog.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/posthog/posthog.js +309 -0
- package/dist/bubbles/service-bubble/posthog/posthog.js.map +1 -0
- package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts +545 -0
- package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/posthog/posthog.schema.js +352 -0
- package/dist/bubbles/service-bubble/posthog/posthog.schema.js.map +1 -0
- package/dist/bubbles/service-bubble/resend.d.ts +16 -16
- package/dist/bubbles/service-bubble/slack/slack.d.ts +325 -325
- package/dist/bubbles/service-bubble/slack.d.ts +5869 -0
- package/dist/bubbles/service-bubble/slack.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/slack.js +1536 -0
- package/dist/bubbles/service-bubble/slack.js.map +1 -0
- package/dist/bubbles/service-bubble/storage.d.ts +40 -40
- package/dist/bubbles/service-bubble/stripe/stripe.d.ts +161 -161
- package/dist/bubbles/service-bubble/telegram.d.ts +264 -264
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +26 -26
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +18 -18
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +22 -22
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.d.ts +3 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.js +3 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.js.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts +160 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.js +706 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts +93 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js +50 -0
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js.map +1 -0
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +108 -108
- package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +24 -24
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-capabilities-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/people-search-tool.d.ts +42 -42
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +16 -16
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +36 -36
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +16 -16
- package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +18 -18
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +114 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +777 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +24 -24
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +68 -68
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +24 -24
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +10 -10
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +62 -62
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +4 -4
- package/dist/bubbles.json +617 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/ai-models.d.ts +4 -0
- package/dist/types/ai-models.d.ts.map +1 -0
- package/dist/types/ai-models.js +16 -0
- package/dist/types/ai-models.js.map +1 -0
- package/dist/utils/param-helper.d.ts +2 -0
- package/dist/utils/param-helper.d.ts.map +1 -0
- package/dist/utils/param-helper.js +5 -0
- package/dist/utils/param-helper.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { CredentialType } from '@bubblelab/shared-schemas';
|
|
2
|
+
import { ServiceBubble } from '../../../types/service-bubble-class.js';
|
|
3
|
+
import { PosthogParamsSchema, PosthogResultSchema, } from './posthog.schema.js';
|
|
4
|
+
/**
|
|
5
|
+
* PosthogBubble - Integration with PostHog product analytics
|
|
6
|
+
*
|
|
7
|
+
* Provides read operations for retrieving analytics data from PostHog:
|
|
8
|
+
* - List events with filtering by event type, person, and date range
|
|
9
|
+
* - Execute HogQL queries for custom analytics
|
|
10
|
+
* - Look up person profiles and properties
|
|
11
|
+
* - Retrieve saved insight results
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // List recent pageview events
|
|
16
|
+
* const result = await new PosthogBubble({
|
|
17
|
+
* operation: 'list_events',
|
|
18
|
+
* project_id: '12345',
|
|
19
|
+
* event: '$pageview',
|
|
20
|
+
* limit: 50,
|
|
21
|
+
* }).action();
|
|
22
|
+
*
|
|
23
|
+
* // Execute a HogQL query
|
|
24
|
+
* const queryResult = await new PosthogBubble({
|
|
25
|
+
* operation: 'query',
|
|
26
|
+
* project_id: '12345',
|
|
27
|
+
* query: 'SELECT event, count() FROM events GROUP BY event ORDER BY count() DESC LIMIT 10',
|
|
28
|
+
* }).action();
|
|
29
|
+
*
|
|
30
|
+
* // Look up a person by distinct ID
|
|
31
|
+
* const person = await new PosthogBubble({
|
|
32
|
+
* operation: 'get_person',
|
|
33
|
+
* project_id: '12345',
|
|
34
|
+
* distinct_id: 'user_123',
|
|
35
|
+
* }).action();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class PosthogBubble extends ServiceBubble {
|
|
39
|
+
// REQUIRED: Static metadata for BubbleFactory
|
|
40
|
+
static service = 'posthog';
|
|
41
|
+
static authType = 'apikey';
|
|
42
|
+
static bubbleName = 'posthog';
|
|
43
|
+
static type = 'service';
|
|
44
|
+
static schema = PosthogParamsSchema;
|
|
45
|
+
static resultSchema = PosthogResultSchema;
|
|
46
|
+
static shortDescription = 'PostHog product analytics for events, persons, and insights';
|
|
47
|
+
static longDescription = `
|
|
48
|
+
PostHog is an open-source product analytics platform.
|
|
49
|
+
This bubble provides read operations for retrieving analytics data:
|
|
50
|
+
- List and filter captured events (pageviews, custom events, etc.)
|
|
51
|
+
- Execute HogQL queries for advanced custom analytics
|
|
52
|
+
- Look up person profiles and their properties
|
|
53
|
+
- Retrieve saved insight results
|
|
54
|
+
|
|
55
|
+
Authentication:
|
|
56
|
+
- Uses a Personal API Key via Bearer token
|
|
57
|
+
- Supports US Cloud, EU Cloud, and self-hosted instances via configurable host URL
|
|
58
|
+
|
|
59
|
+
Use Cases:
|
|
60
|
+
- Pull analytics data into automated workflows
|
|
61
|
+
- Query event data with HogQL for custom reports
|
|
62
|
+
- Look up user profiles and their properties
|
|
63
|
+
- Retrieve computed insight results for dashboards
|
|
64
|
+
`;
|
|
65
|
+
static alias = 'posthog-analytics';
|
|
66
|
+
constructor(params = {
|
|
67
|
+
operation: 'list_events',
|
|
68
|
+
project_id: '',
|
|
69
|
+
limit: 100,
|
|
70
|
+
}, context) {
|
|
71
|
+
super(params, context);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Choose the appropriate credential for PostHog API
|
|
75
|
+
*/
|
|
76
|
+
chooseCredential() {
|
|
77
|
+
const params = this.params;
|
|
78
|
+
const credentials = params.credentials;
|
|
79
|
+
if (!credentials || typeof credentials !== 'object') {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return credentials[CredentialType.POSTHOG_API_KEY];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Test if the credential is valid by listing projects
|
|
86
|
+
*/
|
|
87
|
+
async testCredential() {
|
|
88
|
+
try {
|
|
89
|
+
const apiKey = this.chooseCredential();
|
|
90
|
+
if (!apiKey) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const params = this.params;
|
|
94
|
+
const host = params.host || 'https://us.posthog.com';
|
|
95
|
+
// Use the /api/users/@me endpoint to validate the key
|
|
96
|
+
const response = await fetch(`${host}/api/users/@me/`, {
|
|
97
|
+
method: 'GET',
|
|
98
|
+
headers: {
|
|
99
|
+
Authorization: `Bearer ${apiKey}`,
|
|
100
|
+
'Content-Type': 'application/json',
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return response.ok;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Perform the PostHog operation
|
|
111
|
+
*/
|
|
112
|
+
async performAction(context) {
|
|
113
|
+
void context;
|
|
114
|
+
const params = this.params;
|
|
115
|
+
const { operation } = params;
|
|
116
|
+
try {
|
|
117
|
+
switch (operation) {
|
|
118
|
+
case 'list_projects':
|
|
119
|
+
return (await this.listProjects(params));
|
|
120
|
+
case 'list_events':
|
|
121
|
+
return (await this.listEvents(params));
|
|
122
|
+
case 'query':
|
|
123
|
+
return (await this.executeQuery(params));
|
|
124
|
+
case 'get_person':
|
|
125
|
+
return (await this.getPerson(params));
|
|
126
|
+
case 'get_insight':
|
|
127
|
+
return (await this.getInsight(params));
|
|
128
|
+
default:
|
|
129
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
134
|
+
return {
|
|
135
|
+
operation,
|
|
136
|
+
success: false,
|
|
137
|
+
error: errorMessage,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Make an authenticated GET request to the PostHog API
|
|
143
|
+
*/
|
|
144
|
+
async makePosthogGetRequest(host, path, queryParams) {
|
|
145
|
+
const apiKey = this.chooseCredential();
|
|
146
|
+
if (!apiKey) {
|
|
147
|
+
throw new Error('PostHog Personal API Key is required');
|
|
148
|
+
}
|
|
149
|
+
const url = new URL(`${host}${path}`);
|
|
150
|
+
if (queryParams) {
|
|
151
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
152
|
+
if (value !== undefined && value !== '') {
|
|
153
|
+
url.searchParams.set(key, value);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const response = await fetch(url.toString(), {
|
|
158
|
+
method: 'GET',
|
|
159
|
+
headers: {
|
|
160
|
+
Authorization: `Bearer ${apiKey}`,
|
|
161
|
+
'Content-Type': 'application/json',
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
if (!response.ok) {
|
|
165
|
+
const errorText = await response.text();
|
|
166
|
+
let errorMessage;
|
|
167
|
+
try {
|
|
168
|
+
const errorData = JSON.parse(errorText);
|
|
169
|
+
errorMessage =
|
|
170
|
+
errorData.detail || errorData.error || errorData.message || errorText;
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
errorMessage = errorText;
|
|
174
|
+
}
|
|
175
|
+
throw new Error(`PostHog API error (HTTP ${response.status}): ${errorMessage}`);
|
|
176
|
+
}
|
|
177
|
+
return (await response.json());
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Make an authenticated POST request to the PostHog API
|
|
181
|
+
*/
|
|
182
|
+
async makePosthogPostRequest(host, path, body) {
|
|
183
|
+
const apiKey = this.chooseCredential();
|
|
184
|
+
if (!apiKey) {
|
|
185
|
+
throw new Error('PostHog Personal API Key is required');
|
|
186
|
+
}
|
|
187
|
+
const response = await fetch(`${host}${path}`, {
|
|
188
|
+
method: 'POST',
|
|
189
|
+
headers: {
|
|
190
|
+
Authorization: `Bearer ${apiKey}`,
|
|
191
|
+
'Content-Type': 'application/json',
|
|
192
|
+
},
|
|
193
|
+
body: JSON.stringify(body),
|
|
194
|
+
});
|
|
195
|
+
if (!response.ok) {
|
|
196
|
+
const errorText = await response.text();
|
|
197
|
+
let errorMessage;
|
|
198
|
+
try {
|
|
199
|
+
const errorData = JSON.parse(errorText);
|
|
200
|
+
errorMessage =
|
|
201
|
+
errorData.detail || errorData.error || errorData.message || errorText;
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
errorMessage = errorText;
|
|
205
|
+
}
|
|
206
|
+
throw new Error(`PostHog API error (HTTP ${response.status}): ${errorMessage}`);
|
|
207
|
+
}
|
|
208
|
+
return (await response.json());
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* List all projects accessible with the API key
|
|
212
|
+
*/
|
|
213
|
+
async listProjects(params) {
|
|
214
|
+
const queryParams = {};
|
|
215
|
+
if (params.limit !== undefined)
|
|
216
|
+
queryParams.limit = String(params.limit);
|
|
217
|
+
const response = await this.makePosthogGetRequest(params.host, '/api/projects/', queryParams);
|
|
218
|
+
return {
|
|
219
|
+
operation: 'list_projects',
|
|
220
|
+
success: true,
|
|
221
|
+
projects: response.results,
|
|
222
|
+
next: response.next,
|
|
223
|
+
error: '',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* List events with optional filtering
|
|
228
|
+
*/
|
|
229
|
+
async listEvents(params) {
|
|
230
|
+
const queryParams = {};
|
|
231
|
+
if (params.event)
|
|
232
|
+
queryParams.event = params.event;
|
|
233
|
+
if (params.person_id)
|
|
234
|
+
queryParams.person_id = params.person_id;
|
|
235
|
+
if (params.distinct_id)
|
|
236
|
+
queryParams.distinct_id = params.distinct_id;
|
|
237
|
+
if (params.after)
|
|
238
|
+
queryParams.after = params.after;
|
|
239
|
+
if (params.before)
|
|
240
|
+
queryParams.before = params.before;
|
|
241
|
+
if (params.properties)
|
|
242
|
+
queryParams.properties = params.properties;
|
|
243
|
+
if (params.limit !== undefined)
|
|
244
|
+
queryParams.limit = String(params.limit);
|
|
245
|
+
const response = await this.makePosthogGetRequest(params.host, `/api/projects/${params.project_id}/events/`, queryParams);
|
|
246
|
+
return {
|
|
247
|
+
operation: 'list_events',
|
|
248
|
+
success: true,
|
|
249
|
+
events: response.results,
|
|
250
|
+
next: response.next,
|
|
251
|
+
error: '',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Execute a HogQL query
|
|
256
|
+
*/
|
|
257
|
+
async executeQuery(params) {
|
|
258
|
+
const response = await this.makePosthogPostRequest(params.host, `/api/projects/${params.project_id}/query/`, {
|
|
259
|
+
query: {
|
|
260
|
+
kind: 'HogQLQuery',
|
|
261
|
+
query: params.query,
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
// The response may have nested results structure
|
|
265
|
+
const results = response.results;
|
|
266
|
+
return {
|
|
267
|
+
operation: 'query',
|
|
268
|
+
success: true,
|
|
269
|
+
columns: (results?.columns || response.columns),
|
|
270
|
+
results: (results?.results || response.results),
|
|
271
|
+
types: (results?.types || response.types),
|
|
272
|
+
hasMore: (results?.hasMore || response.hasMore),
|
|
273
|
+
error: '',
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get person profiles
|
|
278
|
+
*/
|
|
279
|
+
async getPerson(params) {
|
|
280
|
+
const queryParams = {};
|
|
281
|
+
if (params.distinct_id)
|
|
282
|
+
queryParams.distinct_id = params.distinct_id;
|
|
283
|
+
if (params.search)
|
|
284
|
+
queryParams.search = params.search;
|
|
285
|
+
if (params.limit !== undefined)
|
|
286
|
+
queryParams.limit = String(params.limit);
|
|
287
|
+
const response = await this.makePosthogGetRequest(params.host, `/api/projects/${params.project_id}/persons/`, queryParams);
|
|
288
|
+
return {
|
|
289
|
+
operation: 'get_person',
|
|
290
|
+
success: true,
|
|
291
|
+
persons: response.results,
|
|
292
|
+
next: response.next,
|
|
293
|
+
error: '',
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get a saved insight's results
|
|
298
|
+
*/
|
|
299
|
+
async getInsight(params) {
|
|
300
|
+
const response = await this.makePosthogGetRequest(params.host, `/api/projects/${params.project_id}/insights/${params.insight_id}/`);
|
|
301
|
+
return {
|
|
302
|
+
operation: 'get_insight',
|
|
303
|
+
success: true,
|
|
304
|
+
insight: response,
|
|
305
|
+
error: '',
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=posthog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/posthog/posthog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GASpB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,aAEX,SAAQ,aAGT;IACC,8CAA8C;IAC9C,MAAM,CAAU,OAAO,GAAG,SAAS,CAAC;IACpC,MAAM,CAAU,QAAQ,GAAG,QAAiB,CAAC;IAC7C,MAA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