@prismatic-io/components-mixpanel 0.0.0-stage → 0.0.1
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 +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +218 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +2183 -0
- package/npm-dist/index.d.cts +1896 -0
- package/package.json +51 -4
|
@@ -0,0 +1,2183 @@
|
|
|
1
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
2
|
+
let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/connections/index.ts
|
|
5
|
+
var connections_default = [(0, _prismatic_io_spectral.connection)({
|
|
6
|
+
key: "apiToken",
|
|
7
|
+
display: {
|
|
8
|
+
label: "API Key",
|
|
9
|
+
description: "API Key for a Mixpanel Account"
|
|
10
|
+
},
|
|
11
|
+
inputs: {
|
|
12
|
+
username: {
|
|
13
|
+
label: "Username",
|
|
14
|
+
placeholder: "Enter service account username",
|
|
15
|
+
type: "string",
|
|
16
|
+
required: false,
|
|
17
|
+
comments: "The Mixpanel Service Account username. Obtain this from Settings > Organization Settings > Service Accounts in the Mixpanel dashboard.",
|
|
18
|
+
example: "service-account-12345"
|
|
19
|
+
},
|
|
20
|
+
password: {
|
|
21
|
+
label: "Password",
|
|
22
|
+
placeholder: "Enter service account password",
|
|
23
|
+
type: "password",
|
|
24
|
+
required: false,
|
|
25
|
+
comments: "The Mixpanel Service Account secret. Obtain this from Settings > Organization Settings > Service Accounts in the Mixpanel dashboard.",
|
|
26
|
+
example: "a7183e1b7e9ab09b8a5cfa87d1934c3c"
|
|
27
|
+
},
|
|
28
|
+
projectToken: {
|
|
29
|
+
label: "Project Token",
|
|
30
|
+
placeholder: "Enter project token",
|
|
31
|
+
type: "password",
|
|
32
|
+
required: false,
|
|
33
|
+
comments: "The Mixpanel Project Token. Find this in Settings > Project Settings in the Mixpanel dashboard.",
|
|
34
|
+
example: "725a93138a7d12e00f16912848590ae7"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})];
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/util/auth.ts
|
|
40
|
+
const validateConnection = (connection) => {
|
|
41
|
+
if (!connections_default.map((c) => c.key).includes(connection.key)) throw new _prismatic_io_spectral.ConnectionError(connection, `Unsupported connection ${connection.key}.`);
|
|
42
|
+
};
|
|
43
|
+
const generateBasicBase64Authorization = (toEncode) => {
|
|
44
|
+
return `Basic ${Buffer.from(toEncode).toString("base64")}`;
|
|
45
|
+
};
|
|
46
|
+
const getProjectToken = (connection) => {
|
|
47
|
+
const { projectToken } = connection.fields;
|
|
48
|
+
if (!projectToken) throw new _prismatic_io_spectral.ConnectionError(connection, "Project token is required for this connection.");
|
|
49
|
+
return generateBasicBase64Authorization(`${projectToken}:`);
|
|
50
|
+
};
|
|
51
|
+
const getServiceAccountToken = (connection) => {
|
|
52
|
+
const { username, password } = connection.fields;
|
|
53
|
+
if (!username && !password) throw new _prismatic_io_spectral.ConnectionError(connection, "Username and password are required for this connection.");
|
|
54
|
+
return generateBasicBase64Authorization(`${username}:${password}`);
|
|
55
|
+
};
|
|
56
|
+
const getFallbackConnectionToken = (connection) => {
|
|
57
|
+
const { username, password, projectToken } = connection.fields;
|
|
58
|
+
if (username && password) return generateBasicBase64Authorization(`${username}:${password}`);
|
|
59
|
+
if (projectToken) return generateBasicBase64Authorization(`${projectToken}:`);
|
|
60
|
+
throw new _prismatic_io_spectral.ConnectionError(connection, "Username and password or project token are required for this connection.");
|
|
61
|
+
};
|
|
62
|
+
const getAuthorization = (authorizationType, connection) => {
|
|
63
|
+
switch (authorizationType) {
|
|
64
|
+
case "account": return getServiceAccountToken(connection);
|
|
65
|
+
case "token": return getProjectToken(connection);
|
|
66
|
+
case "fallback": return getFallbackConnectionToken(connection);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/util/clean.ts
|
|
71
|
+
const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
|
|
72
|
+
const jsonInputClean = (value) => {
|
|
73
|
+
if (value !== null && value !== "") return JSON.parse(value);
|
|
74
|
+
};
|
|
75
|
+
const valueListInputClean = (value) => {
|
|
76
|
+
if (Array.isArray(value) && value.length >= 1 && value[0] !== "000xxx") return value;
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/client.ts
|
|
80
|
+
const createClient = (region, connection, authorizationType, debug) => {
|
|
81
|
+
validateConnection(connection);
|
|
82
|
+
const authorization = getAuthorization(authorizationType, connection);
|
|
83
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
84
|
+
baseUrl: `https://${region}.mixpanel.com`,
|
|
85
|
+
headers: {
|
|
86
|
+
Authorization: authorization,
|
|
87
|
+
"Content-Type": "application/json"
|
|
88
|
+
},
|
|
89
|
+
debug
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const createNoAuthClient = (region, connection, debug) => {
|
|
93
|
+
validateConnection(connection);
|
|
94
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
95
|
+
baseUrl: `https://${region}.mixpanel.com`,
|
|
96
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
97
|
+
debug
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const createMixpanelClient = (regionAndDomain, connection, authorizationType, debug) => {
|
|
101
|
+
validateConnection(connection);
|
|
102
|
+
const authorization = getAuthorization(authorizationType, connection);
|
|
103
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
104
|
+
baseUrl: `https://${regionAndDomain}.com/api/2.0/`,
|
|
105
|
+
headers: {
|
|
106
|
+
Authorization: authorization,
|
|
107
|
+
"Content-Type": "application/json"
|
|
108
|
+
},
|
|
109
|
+
debug
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const createDataClient = (dataAndDomain, connection, authorizationType, debug) => {
|
|
113
|
+
validateConnection(connection);
|
|
114
|
+
const authorization = getAuthorization(authorizationType, connection);
|
|
115
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
116
|
+
baseUrl: `https://${dataAndDomain}.mixpanel.com/api/2.0/`,
|
|
117
|
+
headers: {
|
|
118
|
+
Authorization: authorization,
|
|
119
|
+
"Content-Type": "application/json"
|
|
120
|
+
},
|
|
121
|
+
debug
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/inputs/common.ts
|
|
126
|
+
const connectionInput = (0, _prismatic_io_spectral.input)({
|
|
127
|
+
label: "Connection",
|
|
128
|
+
type: "connection",
|
|
129
|
+
required: true,
|
|
130
|
+
comments: "The Mixpanel connection to use."
|
|
131
|
+
});
|
|
132
|
+
const verbose = (0, _prismatic_io_spectral.input)({
|
|
133
|
+
label: "Verbose",
|
|
134
|
+
type: "string",
|
|
135
|
+
clean: toOptionalString,
|
|
136
|
+
comments: "When true, Mixpanel will respond with a detailed JSON object describing the success or failure of the tracking call. Set to 1 to enable verbose responses for debugging.",
|
|
137
|
+
placeholder: "Enter 1 to enable verbose mode",
|
|
138
|
+
required: false,
|
|
139
|
+
example: "1"
|
|
140
|
+
});
|
|
141
|
+
const redirect = (0, _prismatic_io_spectral.input)({
|
|
142
|
+
label: "Redirect",
|
|
143
|
+
type: "string",
|
|
144
|
+
clean: toOptionalString,
|
|
145
|
+
comments: "When provided, Mixpanel will serve a redirect to the given URL as a response. Useful for link tracking in notifications.",
|
|
146
|
+
placeholder: "Enter redirect URL",
|
|
147
|
+
required: false,
|
|
148
|
+
example: "https://example.com/redirect"
|
|
149
|
+
});
|
|
150
|
+
const region = (0, _prismatic_io_spectral.input)({
|
|
151
|
+
label: "Region",
|
|
152
|
+
type: "string",
|
|
153
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
154
|
+
comments: "The server location to use. Select 'api' for the default US servers or 'api-eu' for EU servers if the account is enrolled in EU Data Residency.",
|
|
155
|
+
placeholder: "Select region",
|
|
156
|
+
model: [{
|
|
157
|
+
label: "api",
|
|
158
|
+
value: "api"
|
|
159
|
+
}, {
|
|
160
|
+
label: "api-eu",
|
|
161
|
+
value: "api-eu"
|
|
162
|
+
}],
|
|
163
|
+
required: true
|
|
164
|
+
});
|
|
165
|
+
const regionAndDomain = (0, _prismatic_io_spectral.input)({
|
|
166
|
+
label: "Region and Domain",
|
|
167
|
+
type: "string",
|
|
168
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
169
|
+
comments: "The server location to use. Select 'mixpanel' for the default US servers or 'eu.mixpanel' for EU servers if the account is enrolled in EU Data Residency.",
|
|
170
|
+
placeholder: "Select region and domain",
|
|
171
|
+
model: [{
|
|
172
|
+
label: "mixpanel",
|
|
173
|
+
value: "mixpanel"
|
|
174
|
+
}, {
|
|
175
|
+
label: "eu.mixpanel",
|
|
176
|
+
value: "eu.mixpanel"
|
|
177
|
+
}],
|
|
178
|
+
required: true
|
|
179
|
+
});
|
|
180
|
+
const dataAndDomain = (0, _prismatic_io_spectral.input)({
|
|
181
|
+
label: "Data and Domain",
|
|
182
|
+
type: "string",
|
|
183
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
184
|
+
comments: "The server location to use. Select 'data' for the default US servers or 'data-eu' for EU servers if the account is enrolled in EU Data Residency.",
|
|
185
|
+
placeholder: "Select data and domain",
|
|
186
|
+
model: [{
|
|
187
|
+
label: "data",
|
|
188
|
+
value: "data"
|
|
189
|
+
}, {
|
|
190
|
+
label: "data-eu",
|
|
191
|
+
value: "data-eu"
|
|
192
|
+
}],
|
|
193
|
+
required: true
|
|
194
|
+
});
|
|
195
|
+
const project_id = (0, _prismatic_io_spectral.input)({
|
|
196
|
+
label: "Project ID",
|
|
197
|
+
type: "string",
|
|
198
|
+
clean: toOptionalString,
|
|
199
|
+
comments: "The Mixpanel project ID. Required when using service account authentication (Username and Password). Find this in Settings > Project Settings in the Mixpanel dashboard.",
|
|
200
|
+
placeholder: "Enter project ID",
|
|
201
|
+
required: false,
|
|
202
|
+
example: "2891273"
|
|
203
|
+
});
|
|
204
|
+
const workspace_id = (0, _prismatic_io_spectral.input)({
|
|
205
|
+
label: "Workspace ID",
|
|
206
|
+
type: "string",
|
|
207
|
+
clean: toOptionalString,
|
|
208
|
+
comments: "The ID of the workspace if applicable. Only required for workspace-specific queries.",
|
|
209
|
+
placeholder: "Enter workspace ID",
|
|
210
|
+
required: false,
|
|
211
|
+
example: "3847562"
|
|
212
|
+
});
|
|
213
|
+
const from_date = (0, _prismatic_io_spectral.input)({
|
|
214
|
+
label: "From Date",
|
|
215
|
+
type: "string",
|
|
216
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
217
|
+
comments: "The start date for querying in YYYY-MM-DD format. This date is inclusive.",
|
|
218
|
+
placeholder: "Enter start date (YYYY-MM-DD)",
|
|
219
|
+
required: true,
|
|
220
|
+
example: "2024-01-01"
|
|
221
|
+
});
|
|
222
|
+
const to_date = (0, _prismatic_io_spectral.input)({
|
|
223
|
+
label: "To Date",
|
|
224
|
+
type: "string",
|
|
225
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
226
|
+
comments: "The end date for querying in YYYY-MM-DD format. This date is inclusive.",
|
|
227
|
+
placeholder: "Enter end date (YYYY-MM-DD)",
|
|
228
|
+
required: true,
|
|
229
|
+
example: "2024-01-31"
|
|
230
|
+
});
|
|
231
|
+
const where = (0, _prismatic_io_spectral.input)({
|
|
232
|
+
label: "Where",
|
|
233
|
+
type: "string",
|
|
234
|
+
clean: toOptionalString,
|
|
235
|
+
comments: "An expression to filter events. See [segmentation expressions](https://docs.mixpanel.com/reference/segmentation-expressions) for syntax details.",
|
|
236
|
+
placeholder: "Enter filter expression",
|
|
237
|
+
required: false,
|
|
238
|
+
example: "properties['account_id'] in [1,2,3,4]"
|
|
239
|
+
});
|
|
240
|
+
const limit = (0, _prismatic_io_spectral.input)({
|
|
241
|
+
label: "Limit",
|
|
242
|
+
type: "string",
|
|
243
|
+
clean: toOptionalString,
|
|
244
|
+
comments: "The maximum number of top property values to return. Defaults to 255, maximum 10,000. Only applies when 'on' is specified.",
|
|
245
|
+
placeholder: "Enter limit value",
|
|
246
|
+
required: false,
|
|
247
|
+
example: "100"
|
|
248
|
+
});
|
|
249
|
+
const useProjectToken = (0, _prismatic_io_spectral.input)({
|
|
250
|
+
label: "Use Project Token",
|
|
251
|
+
type: "boolean",
|
|
252
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
253
|
+
default: "false",
|
|
254
|
+
comments: "When true, uses the project token from the connection to authenticate the request instead of service account credentials."
|
|
255
|
+
});
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/inputs/dataExport.ts
|
|
258
|
+
const event = (0, _prismatic_io_spectral.input)({
|
|
259
|
+
label: "Event Name",
|
|
260
|
+
type: "string",
|
|
261
|
+
clean: toOptionalString,
|
|
262
|
+
comments: "The name of the event to filter data by.",
|
|
263
|
+
placeholder: "Enter event name",
|
|
264
|
+
required: false,
|
|
265
|
+
example: "Page View"
|
|
266
|
+
});
|
|
267
|
+
const gzipEncoding = (0, _prismatic_io_spectral.input)({
|
|
268
|
+
label: "Gzip Encoding",
|
|
269
|
+
type: "boolean",
|
|
270
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
271
|
+
comments: "When true, the response will be compressed with gzip and Content-Encoding will be set to gzip.",
|
|
272
|
+
required: false,
|
|
273
|
+
example: "false"
|
|
274
|
+
});
|
|
275
|
+
const downloadDataInputs = {
|
|
276
|
+
connection: connectionInput,
|
|
277
|
+
dataAndDomain,
|
|
278
|
+
from_date,
|
|
279
|
+
to_date,
|
|
280
|
+
project_id,
|
|
281
|
+
filters: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
282
|
+
label: "Filters",
|
|
283
|
+
required: false,
|
|
284
|
+
comments: "Optional query controls to refine the exported events: a result limit, an event-name filter, a segmentation filter expression, and gzip response encoding.",
|
|
285
|
+
inputs: {
|
|
286
|
+
limit,
|
|
287
|
+
event,
|
|
288
|
+
where: {
|
|
289
|
+
...where,
|
|
290
|
+
comments: "An expression to filter events by. See [segmentation expressions](https://docs.mixpanel.com/reference/segmentation-expressions) for syntax details."
|
|
291
|
+
},
|
|
292
|
+
gzipEncoding
|
|
293
|
+
}
|
|
294
|
+
})
|
|
295
|
+
};
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/inputs/dataSources.ts
|
|
298
|
+
const funnelsInputs = {
|
|
299
|
+
connection: connectionInput,
|
|
300
|
+
regionAndDomain,
|
|
301
|
+
project_id: {
|
|
302
|
+
...project_id,
|
|
303
|
+
required: true,
|
|
304
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
305
|
+
},
|
|
306
|
+
workspace_id
|
|
307
|
+
};
|
|
308
|
+
const pipelinesInputs = {
|
|
309
|
+
connection: connectionInput,
|
|
310
|
+
dataAndDomain,
|
|
311
|
+
project_id: {
|
|
312
|
+
...project_id,
|
|
313
|
+
required: true,
|
|
314
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/inputs/events.ts
|
|
319
|
+
const events = (0, _prismatic_io_spectral.input)({
|
|
320
|
+
label: "Events",
|
|
321
|
+
type: "code",
|
|
322
|
+
language: "json",
|
|
323
|
+
comments: "An array of event objects to ingest into Mixpanel. Each request accepts up to 2000 events and 2MB uncompressed. See the [Event Ingestion API](https://docs.mixpanel.com/reference/import-events) documentation for details.",
|
|
324
|
+
example: JSON.stringify([{
|
|
325
|
+
event: "Signed up",
|
|
326
|
+
properties: {
|
|
327
|
+
time: 1618716477e3,
|
|
328
|
+
distinct_id: "91304156-cafc-4673-a237-623d1129c801",
|
|
329
|
+
$insert_id: "29fc2962-6d9c-455d-95ad-95b84f09b9e4",
|
|
330
|
+
ip: "136.24.0.114",
|
|
331
|
+
"Referred by": "Friend",
|
|
332
|
+
URL: "mixpanel.com/signup"
|
|
333
|
+
}
|
|
334
|
+
}], null, 2),
|
|
335
|
+
clean: jsonInputClean,
|
|
336
|
+
required: true
|
|
337
|
+
});
|
|
338
|
+
const ip = (0, _prismatic_io_spectral.input)({
|
|
339
|
+
label: "IP",
|
|
340
|
+
type: "string",
|
|
341
|
+
clean: toOptionalString,
|
|
342
|
+
comments: "When true, Mixpanel will use the IP address of the incoming request and compute a distinct_id using a hash function if no distinct_id is provided. Set to 1 to enable.",
|
|
343
|
+
placeholder: "Enter 1 to enable IP tracking",
|
|
344
|
+
required: false,
|
|
345
|
+
example: "1"
|
|
346
|
+
});
|
|
347
|
+
const img = (0, _prismatic_io_spectral.input)({
|
|
348
|
+
label: "Img",
|
|
349
|
+
type: "string",
|
|
350
|
+
clean: toOptionalString,
|
|
351
|
+
comments: "When true, Mixpanel will serve a 1x1 transparent pixel image as a response. Set to 1 to enable pixel tracking for environments without JavaScript support.",
|
|
352
|
+
placeholder: "Enter 1 to enable pixel tracking",
|
|
353
|
+
required: false,
|
|
354
|
+
example: "1"
|
|
355
|
+
});
|
|
356
|
+
const deliveryOptions = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
357
|
+
label: "Delivery Options",
|
|
358
|
+
required: false,
|
|
359
|
+
comments: "Optional request delivery controls: IP-based distinct ID computation, verbose responses, redirect URL, and pixel-image response.",
|
|
360
|
+
inputs: {
|
|
361
|
+
ip,
|
|
362
|
+
verbose,
|
|
363
|
+
redirect,
|
|
364
|
+
img
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
const trackEventsInputs = {
|
|
368
|
+
connection: connectionInput,
|
|
369
|
+
useProjectToken: {
|
|
370
|
+
...useProjectToken,
|
|
371
|
+
default: "true"
|
|
372
|
+
},
|
|
373
|
+
region,
|
|
374
|
+
deliveryOptions,
|
|
375
|
+
events
|
|
376
|
+
};
|
|
377
|
+
const importEventsInputs = {
|
|
378
|
+
connection: connectionInput,
|
|
379
|
+
useProjectToken,
|
|
380
|
+
region,
|
|
381
|
+
events,
|
|
382
|
+
project_id
|
|
383
|
+
};
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/inputs/funnels.ts
|
|
386
|
+
const funnel_id = (0, _prismatic_io_spectral.input)({
|
|
387
|
+
label: "Funnel ID",
|
|
388
|
+
type: "string",
|
|
389
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
390
|
+
comments: "The unique identifier of the funnel to retrieve data for.",
|
|
391
|
+
placeholder: "Enter funnel ID",
|
|
392
|
+
dataSource: "funnels",
|
|
393
|
+
required: true,
|
|
394
|
+
example: "7509"
|
|
395
|
+
});
|
|
396
|
+
const length = (0, _prismatic_io_spectral.input)({
|
|
397
|
+
label: "Length",
|
|
398
|
+
type: "string",
|
|
399
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
400
|
+
comments: "The number of units (defined by length_unit) each user has to complete the funnel. Maximum 90 days. Defaults to the value saved in the UI for this funnel.",
|
|
401
|
+
placeholder: "Enter length value",
|
|
402
|
+
required: true,
|
|
403
|
+
example: "7"
|
|
404
|
+
});
|
|
405
|
+
const length_unit = (0, _prismatic_io_spectral.input)({
|
|
406
|
+
label: "Length Unit",
|
|
407
|
+
type: "string",
|
|
408
|
+
clean: toOptionalString,
|
|
409
|
+
comments: "The time unit for the length parameter. Defaults to the value saved in the UI for this funnel.",
|
|
410
|
+
placeholder: "Select length unit",
|
|
411
|
+
model: [
|
|
412
|
+
{
|
|
413
|
+
label: "day",
|
|
414
|
+
value: "day"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
label: "hour",
|
|
418
|
+
value: "hour"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
label: "minute",
|
|
422
|
+
value: "minute"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
label: "seconds",
|
|
426
|
+
value: "seconds"
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
required: false,
|
|
430
|
+
example: "day"
|
|
431
|
+
});
|
|
432
|
+
const interval = (0, _prismatic_io_spectral.input)({
|
|
433
|
+
label: "Interval",
|
|
434
|
+
type: "string",
|
|
435
|
+
clean: toOptionalString,
|
|
436
|
+
comments: "The number of days for each time bucket. Defaults to 1 day per bucket.",
|
|
437
|
+
placeholder: "Enter interval in days",
|
|
438
|
+
required: false,
|
|
439
|
+
example: "1"
|
|
440
|
+
});
|
|
441
|
+
const unit = (0, _prismatic_io_spectral.input)({
|
|
442
|
+
label: "Unit",
|
|
443
|
+
type: "string",
|
|
444
|
+
clean: toOptionalString,
|
|
445
|
+
comments: "An alternate way of specifying the interval. Choose day, week, or month.",
|
|
446
|
+
placeholder: "Select time unit",
|
|
447
|
+
model: [
|
|
448
|
+
{
|
|
449
|
+
label: "day",
|
|
450
|
+
value: "day"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
label: "week",
|
|
454
|
+
value: "week"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
label: "month",
|
|
458
|
+
value: "month"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
required: false,
|
|
462
|
+
example: "week"
|
|
463
|
+
});
|
|
464
|
+
const on = (0, _prismatic_io_spectral.input)({
|
|
465
|
+
label: "On",
|
|
466
|
+
type: "string",
|
|
467
|
+
clean: toOptionalString,
|
|
468
|
+
comments: "The property expression to segment the event on. See [segmentation expressions](https://docs.mixpanel.com/reference/segmentation-expressions) for syntax details.",
|
|
469
|
+
placeholder: "Enter segmentation expression",
|
|
470
|
+
required: false,
|
|
471
|
+
example: "properties['account_id']"
|
|
472
|
+
});
|
|
473
|
+
const segmentation = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
474
|
+
label: "Segmentation",
|
|
475
|
+
required: false,
|
|
476
|
+
comments: "Property expression to segment on, an optional filter expression, and a result limit. Limit only applies when a segmentation expression is set.",
|
|
477
|
+
inputs: {
|
|
478
|
+
on,
|
|
479
|
+
where,
|
|
480
|
+
limit
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
const listSavedFunnelsInputs = {
|
|
484
|
+
connection: connectionInput,
|
|
485
|
+
useProjectToken,
|
|
486
|
+
regionAndDomain,
|
|
487
|
+
project_id: {
|
|
488
|
+
...project_id,
|
|
489
|
+
required: true,
|
|
490
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
491
|
+
},
|
|
492
|
+
workspace_id
|
|
493
|
+
};
|
|
494
|
+
const queryFunnelSavedReportsInputs = {
|
|
495
|
+
connection: connectionInput,
|
|
496
|
+
useProjectToken,
|
|
497
|
+
regionAndDomain,
|
|
498
|
+
funnel_id,
|
|
499
|
+
from_date,
|
|
500
|
+
to_date,
|
|
501
|
+
project_id,
|
|
502
|
+
workspace_id,
|
|
503
|
+
length,
|
|
504
|
+
length_unit,
|
|
505
|
+
interval,
|
|
506
|
+
unit,
|
|
507
|
+
segmentation
|
|
508
|
+
};
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/inputs/identities.ts
|
|
511
|
+
const strict = (0, _prismatic_io_spectral.input)({
|
|
512
|
+
label: "Strict",
|
|
513
|
+
type: "string",
|
|
514
|
+
clean: toOptionalString,
|
|
515
|
+
comments: "When true, Mixpanel will validate the provided records and return per-record error messages for records that fail validation. Set to 1 to enable strict validation.",
|
|
516
|
+
placeholder: "Enter 1 to enable strict validation",
|
|
517
|
+
required: false,
|
|
518
|
+
example: "1"
|
|
519
|
+
});
|
|
520
|
+
const distinct_id = (0, _prismatic_io_spectral.input)({
|
|
521
|
+
label: "Distinct ID",
|
|
522
|
+
type: "string",
|
|
523
|
+
clean: toOptionalString,
|
|
524
|
+
comments: "The unique identifier for the user post-identification. Equivalent to $identified_id and will be inferred if not provided.",
|
|
525
|
+
placeholder: "Enter distinct ID",
|
|
526
|
+
required: false,
|
|
527
|
+
example: "user-12345"
|
|
528
|
+
});
|
|
529
|
+
const identified_id = (0, _prismatic_io_spectral.input)({
|
|
530
|
+
label: "Identified ID",
|
|
531
|
+
type: "string",
|
|
532
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
533
|
+
comments: "The identified user ID to merge with the anonymous ID.",
|
|
534
|
+
placeholder: "Enter identified ID",
|
|
535
|
+
required: true,
|
|
536
|
+
example: "user-12345"
|
|
537
|
+
});
|
|
538
|
+
const anon_id = (0, _prismatic_io_spectral.input)({
|
|
539
|
+
label: "Anon ID",
|
|
540
|
+
type: "string",
|
|
541
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
542
|
+
comments: "The anonymous user ID to merge with the identified ID. Must be in UUID v4 format and not previously merged.",
|
|
543
|
+
placeholder: "Enter anonymous ID (UUID v4)",
|
|
544
|
+
required: true,
|
|
545
|
+
example: "3e2a0d22-7465-4dc3-a2ab-56f8762e1a29"
|
|
546
|
+
});
|
|
547
|
+
const project_token = (0, _prismatic_io_spectral.input)({
|
|
548
|
+
label: "Project Token",
|
|
549
|
+
type: "string",
|
|
550
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
551
|
+
comments: "The Mixpanel project token. Find this in Settings > Project Settings in the Mixpanel dashboard.",
|
|
552
|
+
placeholder: "Enter project token",
|
|
553
|
+
required: true,
|
|
554
|
+
example: "725a93138a7d12e00f16912848590ae7"
|
|
555
|
+
});
|
|
556
|
+
const alias = (0, _prismatic_io_spectral.input)({
|
|
557
|
+
label: "Alias",
|
|
558
|
+
type: "string",
|
|
559
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
560
|
+
comments: "A new distinct_id to be merged with the original distinct_id. Each alias can only map to one distinct_id.",
|
|
561
|
+
placeholder: "Enter alias ID",
|
|
562
|
+
required: true,
|
|
563
|
+
example: "user-alias-67890"
|
|
564
|
+
});
|
|
565
|
+
const createIdentityDeliveryOptions = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
566
|
+
label: "Delivery Options",
|
|
567
|
+
required: false,
|
|
568
|
+
comments: "Optional request delivery controls: strict record validation, verbose responses, and redirect URL.",
|
|
569
|
+
inputs: {
|
|
570
|
+
strict,
|
|
571
|
+
verbose,
|
|
572
|
+
redirect
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
const createAliasDeliveryOptions = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
576
|
+
label: "Delivery Options",
|
|
577
|
+
required: false,
|
|
578
|
+
comments: "Optional request delivery controls: strict record validation, verbose responses, and redirect URL.",
|
|
579
|
+
inputs: {
|
|
580
|
+
strict,
|
|
581
|
+
verbose,
|
|
582
|
+
redirect
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
const createIdentityInputs = {
|
|
586
|
+
connection: connectionInput,
|
|
587
|
+
region,
|
|
588
|
+
identified_id,
|
|
589
|
+
anon_id,
|
|
590
|
+
project_token,
|
|
591
|
+
deliveryOptions: createIdentityDeliveryOptions
|
|
592
|
+
};
|
|
593
|
+
const createAliasInputs = {
|
|
594
|
+
connection: connectionInput,
|
|
595
|
+
region,
|
|
596
|
+
distinct_id: {
|
|
597
|
+
...distinct_id,
|
|
598
|
+
required: true,
|
|
599
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
600
|
+
},
|
|
601
|
+
project_token,
|
|
602
|
+
alias,
|
|
603
|
+
deliveryOptions: createAliasDeliveryOptions
|
|
604
|
+
};
|
|
605
|
+
const queryInsightsSavedReportsInputs = {
|
|
606
|
+
connection: connectionInput,
|
|
607
|
+
regionAndDomain,
|
|
608
|
+
bookmark_id: (0, _prismatic_io_spectral.input)({
|
|
609
|
+
label: "Bookmark ID",
|
|
610
|
+
type: "string",
|
|
611
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
612
|
+
comments: "The ID of the Insights report. Find this in the URL: https://mixpanel.com/report/1/insights#report/YOUR_BOOKMARK_ID/example-report",
|
|
613
|
+
placeholder: "Enter bookmark ID",
|
|
614
|
+
required: true,
|
|
615
|
+
example: "8947562"
|
|
616
|
+
}),
|
|
617
|
+
project_id,
|
|
618
|
+
workspace_id
|
|
619
|
+
};
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/inputs/misc.ts
|
|
622
|
+
const { debugRequest: _$1, ...rawRequestHttpInputs$1 } = _prismatic_io_spectral_http.inputs;
|
|
623
|
+
const customJQLQueryInputs = {
|
|
624
|
+
connection: connectionInput,
|
|
625
|
+
regionAndDomain,
|
|
626
|
+
script: (0, _prismatic_io_spectral.input)({
|
|
627
|
+
label: "Script",
|
|
628
|
+
type: "string",
|
|
629
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
630
|
+
comments: "The JQL script to execute. See the [JQL API](https://docs.mixpanel.com/reference/query-jql) documentation for query syntax.",
|
|
631
|
+
placeholder: "Enter JQL script",
|
|
632
|
+
required: true,
|
|
633
|
+
example: "function main(){return Events(params).groupBy(['name'],mixpanel.reducer.count())}"
|
|
634
|
+
}),
|
|
635
|
+
params: (0, _prismatic_io_spectral.input)({
|
|
636
|
+
label: "Params",
|
|
637
|
+
type: "code",
|
|
638
|
+
language: "json",
|
|
639
|
+
comments: "A JSON object containing parameters that will be made available to the JQL script as the params global variable.",
|
|
640
|
+
example: JSON.stringify({
|
|
641
|
+
from_date: "2024-01-01",
|
|
642
|
+
to_date: "2024-01-31",
|
|
643
|
+
event_name: "Page View"
|
|
644
|
+
}, null, 2),
|
|
645
|
+
clean: jsonInputClean,
|
|
646
|
+
required: false
|
|
647
|
+
}),
|
|
648
|
+
project_id,
|
|
649
|
+
workspace_id
|
|
650
|
+
};
|
|
651
|
+
const rawRequestInputs = {
|
|
652
|
+
connection: connectionInput,
|
|
653
|
+
baseUrl: {
|
|
654
|
+
...rawRequestHttpInputs$1.url,
|
|
655
|
+
label: "Base URL",
|
|
656
|
+
comments: "The base URL to send the request to. For example, https://api.mixpanel.com/ or https://api-eu.mixpanel.com/",
|
|
657
|
+
example: "https://api.mixpanel.com/",
|
|
658
|
+
required: true
|
|
659
|
+
},
|
|
660
|
+
...rawRequestHttpInputs$1,
|
|
661
|
+
url: {
|
|
662
|
+
...rawRequestHttpInputs$1.url,
|
|
663
|
+
comments: "Input the path only (/import), The base URL is going to defined in the previous input. For example, to connect to https://api.mixpanel.com/import, only /import is entered in this field and https://api.mixpanel.com/ is entered in the 'Base URL' field.",
|
|
664
|
+
example: "/import"
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/gcs_regions.json
|
|
669
|
+
var gcs_regions_default = [
|
|
670
|
+
"northamerica-northeast1",
|
|
671
|
+
"us-central1",
|
|
672
|
+
"us-east1",
|
|
673
|
+
"us-east4",
|
|
674
|
+
"us-west1",
|
|
675
|
+
"us-west2",
|
|
676
|
+
"southamerica-east1",
|
|
677
|
+
"europe-north1",
|
|
678
|
+
"europe-west1",
|
|
679
|
+
"europe-west2",
|
|
680
|
+
"europe-west3",
|
|
681
|
+
"europe-west4",
|
|
682
|
+
"europe-west6",
|
|
683
|
+
"asia-east1",
|
|
684
|
+
"asia-east2",
|
|
685
|
+
"asia-northeast1",
|
|
686
|
+
"asia-northeast2",
|
|
687
|
+
"asia-northeast3",
|
|
688
|
+
"asia-south1",
|
|
689
|
+
"asia-southeast1",
|
|
690
|
+
"australia-southeast1"
|
|
691
|
+
];
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/inputs/pipelines.ts
|
|
694
|
+
const { debugRequest: _, ...rawRequestHttpInputs } = _prismatic_io_spectral_http.inputs;
|
|
695
|
+
const name = (0, _prismatic_io_spectral.input)({
|
|
696
|
+
label: "Name",
|
|
697
|
+
type: "string",
|
|
698
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
699
|
+
comments: "The unique name that identifies the pipeline.",
|
|
700
|
+
placeholder: "Enter pipeline name",
|
|
701
|
+
required: true,
|
|
702
|
+
dataSource: "pipelines",
|
|
703
|
+
example: "events-daily-export"
|
|
704
|
+
});
|
|
705
|
+
const summary = (0, _prismatic_io_spectral.input)({
|
|
706
|
+
label: "Summary",
|
|
707
|
+
type: "boolean",
|
|
708
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
709
|
+
comments: "When true, returns only task count by status without detailed information.",
|
|
710
|
+
required: false,
|
|
711
|
+
example: "false",
|
|
712
|
+
default: "false"
|
|
713
|
+
});
|
|
714
|
+
const status = (0, _prismatic_io_spectral.input)({
|
|
715
|
+
label: "Status",
|
|
716
|
+
type: "string",
|
|
717
|
+
collection: "valuelist",
|
|
718
|
+
required: false,
|
|
719
|
+
comments: "An array of status values to filter tasks. Valid options: pending, running, retried, failed, canceled, timed_out.",
|
|
720
|
+
default: ["pending"],
|
|
721
|
+
clean: valueListInputClean,
|
|
722
|
+
example: "pending, running, retried"
|
|
723
|
+
});
|
|
724
|
+
const trial = (0, _prismatic_io_spectral.input)({
|
|
725
|
+
label: "Trial",
|
|
726
|
+
type: "string",
|
|
727
|
+
clean: toOptionalString,
|
|
728
|
+
comments: "When true, creates a trial pipeline for testing purposes before production deployment.",
|
|
729
|
+
placeholder: "Select trial mode",
|
|
730
|
+
model: [
|
|
731
|
+
{
|
|
732
|
+
label: "True",
|
|
733
|
+
value: "true"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
label: "False",
|
|
737
|
+
value: "false"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
label: "",
|
|
741
|
+
value: ""
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
required: false,
|
|
745
|
+
default: ""
|
|
746
|
+
});
|
|
747
|
+
const frequency = (0, _prismatic_io_spectral.input)({
|
|
748
|
+
label: "Frequency",
|
|
749
|
+
type: "string",
|
|
750
|
+
clean: toOptionalString,
|
|
751
|
+
comments: "The export frequency. 'hourly' exports data every hour, 'daily' exports at midnight in the project's timezone. Only applies to indefinite export windows.",
|
|
752
|
+
placeholder: "Select frequency",
|
|
753
|
+
model: [
|
|
754
|
+
{
|
|
755
|
+
label: "daily",
|
|
756
|
+
value: "daily"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
label: "hourly",
|
|
760
|
+
value: "hourly"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
label: "",
|
|
764
|
+
value: ""
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
required: false,
|
|
768
|
+
default: "daily"
|
|
769
|
+
});
|
|
770
|
+
const eventArray = (0, _prismatic_io_spectral.input)({
|
|
771
|
+
label: "Events",
|
|
772
|
+
type: "string",
|
|
773
|
+
collection: "valuelist",
|
|
774
|
+
required: false,
|
|
775
|
+
comments: "An array of event names to whitelist for export. Only these events will be exported from Mixpanel.",
|
|
776
|
+
default: ["Page View"],
|
|
777
|
+
clean: valueListInputClean,
|
|
778
|
+
example: "Signed Up, Purchase, Page View"
|
|
779
|
+
});
|
|
780
|
+
const gcs_bucket = (0, _prismatic_io_spectral.input)({
|
|
781
|
+
label: "GCS Bucket",
|
|
782
|
+
type: "string",
|
|
783
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
784
|
+
comments: "The Google Cloud Storage bucket name where Mixpanel data will be exported.",
|
|
785
|
+
placeholder: "Enter GCS bucket name",
|
|
786
|
+
required: true,
|
|
787
|
+
example: "my-mixpanel-exports"
|
|
788
|
+
});
|
|
789
|
+
const gcs_prefix = (0, _prismatic_io_spectral.input)({
|
|
790
|
+
label: "GCS Prefix",
|
|
791
|
+
type: "string",
|
|
792
|
+
clean: toOptionalString,
|
|
793
|
+
comments: "The path prefix within the GCS bucket for organizing exported files.",
|
|
794
|
+
placeholder: "Enter GCS prefix path",
|
|
795
|
+
required: false,
|
|
796
|
+
example: "mixpanel/events"
|
|
797
|
+
});
|
|
798
|
+
const gcs_region = (0, _prismatic_io_spectral.input)({
|
|
799
|
+
label: "GCS Region",
|
|
800
|
+
placeholder: "Select GCS region",
|
|
801
|
+
type: "string",
|
|
802
|
+
required: true,
|
|
803
|
+
comments: "The Google Cloud Storage region where the bucket is located.",
|
|
804
|
+
example: "northamerica-northeast1",
|
|
805
|
+
default: "northamerica-northeast1",
|
|
806
|
+
model: gcs_regions_default.map((region) => {
|
|
807
|
+
return {
|
|
808
|
+
label: region,
|
|
809
|
+
value: region
|
|
810
|
+
};
|
|
811
|
+
}),
|
|
812
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
813
|
+
});
|
|
814
|
+
const createGenericPipelineInputs = {
|
|
815
|
+
connection: connectionInput,
|
|
816
|
+
dataAndDomain,
|
|
817
|
+
...rawRequestHttpInputs,
|
|
818
|
+
url: {
|
|
819
|
+
...rawRequestHttpInputs.url,
|
|
820
|
+
default: "/nessie/pipeline/create",
|
|
821
|
+
comments: "The endpoint to send the request to. Defaults to /nessie/pipeline/create."
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
const createGCSPipelineInputs = {
|
|
825
|
+
connection: connectionInput,
|
|
826
|
+
dataAndDomain,
|
|
827
|
+
gcs_bucket,
|
|
828
|
+
gcs_prefix,
|
|
829
|
+
gcs_region,
|
|
830
|
+
project_id: {
|
|
831
|
+
...project_id,
|
|
832
|
+
comments: "The project ID (must be specified when using service account based authentication)"
|
|
833
|
+
},
|
|
834
|
+
from_date: {
|
|
835
|
+
...from_date,
|
|
836
|
+
comments: "The starting date of the export window. It is formatted as YYYY-MM-DD and cannot be more than six months in the past. If trial is set to true this will default to the previous day; otherwise, it is a required parameter."
|
|
837
|
+
},
|
|
838
|
+
to_date: {
|
|
839
|
+
...to_date,
|
|
840
|
+
comments: "The ending date of the export window. It is formatted as YYYY-MM-DD. The export will continue indefinitely if to_date is empty.",
|
|
841
|
+
required: false,
|
|
842
|
+
clean: toOptionalString
|
|
843
|
+
},
|
|
844
|
+
trial,
|
|
845
|
+
frequency,
|
|
846
|
+
events: eventArray,
|
|
847
|
+
where: {
|
|
848
|
+
...where,
|
|
849
|
+
comments: "A selector expression used to filter by events data, such as event properties. Learn more about how to construct event selector expressions here."
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
const editGenericPipelineInputs = {
|
|
853
|
+
connection: connectionInput,
|
|
854
|
+
dataAndDomain,
|
|
855
|
+
name,
|
|
856
|
+
...rawRequestHttpInputs,
|
|
857
|
+
url: {
|
|
858
|
+
...rawRequestHttpInputs.url,
|
|
859
|
+
default: "/nessie/pipeline/edit",
|
|
860
|
+
comments: "The endpoint to send the request to. Defaults to /nessie/pipeline/edit."
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
const editGCSPipelineInputs = {
|
|
864
|
+
connection: connectionInput,
|
|
865
|
+
dataAndDomain,
|
|
866
|
+
name,
|
|
867
|
+
project_id: {
|
|
868
|
+
...project_id,
|
|
869
|
+
comments: "The project ID (must be specified when using service account based authentication)"
|
|
870
|
+
},
|
|
871
|
+
events: eventArray,
|
|
872
|
+
where: {
|
|
873
|
+
...where,
|
|
874
|
+
comments: "A selector expression used to filter by events data, such as event properties. Please note that after this update, the sync of older dates to the data warehouse (if enabled) will only contain events matching the new where clause."
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
const listPipelinesInputs = {
|
|
878
|
+
connection: connectionInput,
|
|
879
|
+
dataAndDomain,
|
|
880
|
+
project_id: {
|
|
881
|
+
...project_id,
|
|
882
|
+
required: true,
|
|
883
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
const getPipelineInputs = {
|
|
887
|
+
connection: connectionInput,
|
|
888
|
+
dataAndDomain,
|
|
889
|
+
project_id: {
|
|
890
|
+
...project_id,
|
|
891
|
+
required: true,
|
|
892
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
893
|
+
},
|
|
894
|
+
name,
|
|
895
|
+
summary,
|
|
896
|
+
status
|
|
897
|
+
};
|
|
898
|
+
const deletePipelineInputs = {
|
|
899
|
+
connection: connectionInput,
|
|
900
|
+
useProjectToken: {
|
|
901
|
+
...useProjectToken,
|
|
902
|
+
default: "true"
|
|
903
|
+
},
|
|
904
|
+
dataAndDomain,
|
|
905
|
+
name,
|
|
906
|
+
project_id
|
|
907
|
+
};
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/inputs/profiles.ts
|
|
910
|
+
const properties = (0, _prismatic_io_spectral.input)({
|
|
911
|
+
label: "Properties",
|
|
912
|
+
type: "code",
|
|
913
|
+
language: "json",
|
|
914
|
+
comments: "An array of profile property objects. If the profile does not exist, it creates it with these properties. If it does exist, it sets the properties to these values, overwriting existing values. See the [Engage API](https://docs.mixpanel.com/reference/profile-set) documentation for details.",
|
|
915
|
+
example: JSON.stringify([{
|
|
916
|
+
$token: "725a93138a7d12e00f16912848590ae7",
|
|
917
|
+
$distinct_id: "13793",
|
|
918
|
+
$set: {
|
|
919
|
+
$email: "john.doe@example.com",
|
|
920
|
+
$name: "John Doe",
|
|
921
|
+
plan: "Premium"
|
|
922
|
+
}
|
|
923
|
+
}], null, 2),
|
|
924
|
+
clean: jsonInputClean,
|
|
925
|
+
required: true
|
|
926
|
+
});
|
|
927
|
+
const propertiesToUpdate = (0, _prismatic_io_spectral.input)({
|
|
928
|
+
label: "Properties To Update",
|
|
929
|
+
type: "code",
|
|
930
|
+
language: "json",
|
|
931
|
+
comments: "An array of profile update objects for batch operations. Each object can use operations like $set, $add, $union, etc. See the [Engage API](https://docs.mixpanel.com/reference/profile-set) documentation for details.",
|
|
932
|
+
example: JSON.stringify([{
|
|
933
|
+
$token: "725a93138a7d12e00f16912848590ae7",
|
|
934
|
+
$distinct_id: "13793",
|
|
935
|
+
$add: { "Coins Gathered": 12 }
|
|
936
|
+
}, {
|
|
937
|
+
$token: "725a93138a7d12e00f16912848590ae7",
|
|
938
|
+
$distinct_id: "13794",
|
|
939
|
+
$add: { "Coins Gathered": 13 }
|
|
940
|
+
}], null, 2),
|
|
941
|
+
clean: jsonInputClean,
|
|
942
|
+
required: true
|
|
943
|
+
});
|
|
944
|
+
const deleteProfiles = (0, _prismatic_io_spectral.input)({
|
|
945
|
+
label: "Delete Profiles",
|
|
946
|
+
type: "code",
|
|
947
|
+
language: "json",
|
|
948
|
+
comments: "An array of profile deletion objects. Permanently deletes profiles from Mixpanel along with all properties. The profile is determined by the $distinct_id. See the [Engage API](https://docs.mixpanel.com/reference/delete-profile) documentation for details.",
|
|
949
|
+
example: JSON.stringify([{
|
|
950
|
+
$token: "725a93138a7d12e00f16912848590ae7",
|
|
951
|
+
$distinct_id: "13793",
|
|
952
|
+
$delete: "",
|
|
953
|
+
$ignore_alias: false
|
|
954
|
+
}], null, 2),
|
|
955
|
+
clean: jsonInputClean,
|
|
956
|
+
required: true
|
|
957
|
+
});
|
|
958
|
+
const distinct_ids = (0, _prismatic_io_spectral.input)({
|
|
959
|
+
label: "Distinct IDs",
|
|
960
|
+
type: "string",
|
|
961
|
+
collection: "valuelist",
|
|
962
|
+
required: false,
|
|
963
|
+
comments: "An array of unique identifiers to distinguish individual profiles. Each ID represents a distinct user profile.",
|
|
964
|
+
default: ["user-12345"],
|
|
965
|
+
clean: valueListInputClean,
|
|
966
|
+
example: "user-12345, user-67890"
|
|
967
|
+
});
|
|
968
|
+
const output_properties = (0, _prismatic_io_spectral.input)({
|
|
969
|
+
label: "Output Properties",
|
|
970
|
+
type: "string",
|
|
971
|
+
collection: "valuelist",
|
|
972
|
+
required: false,
|
|
973
|
+
comments: "An array of property names to return in the response. Specifying properties can significantly reduce response size and improve query performance.",
|
|
974
|
+
default: ["$email", "$name"],
|
|
975
|
+
clean: valueListInputClean,
|
|
976
|
+
example: "$last_name, $email, Total Spent"
|
|
977
|
+
});
|
|
978
|
+
const session_id = (0, _prismatic_io_spectral.input)({
|
|
979
|
+
label: "Session ID",
|
|
980
|
+
type: "string",
|
|
981
|
+
clean: toOptionalString,
|
|
982
|
+
comments: "A session ID from a previous query result. Using this speeds up API responses and enables pagination through results.",
|
|
983
|
+
placeholder: "Enter session ID",
|
|
984
|
+
required: false,
|
|
985
|
+
example: "1234567890-EXAMPL"
|
|
986
|
+
});
|
|
987
|
+
const page = (0, _prismatic_io_spectral.input)({
|
|
988
|
+
label: "Page",
|
|
989
|
+
type: "string",
|
|
990
|
+
clean: toOptionalString,
|
|
991
|
+
comments: "The page number of results to retrieve (zero-indexed). Required: Must provide session_id when using pagination.",
|
|
992
|
+
placeholder: "Enter page number",
|
|
993
|
+
required: false,
|
|
994
|
+
example: "0"
|
|
995
|
+
});
|
|
996
|
+
const pagination = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
997
|
+
label: "Pagination",
|
|
998
|
+
required: false,
|
|
999
|
+
comments: "Session ID from a prior query result and the zero-indexed page to retrieve against it. Provide the session ID when paging.",
|
|
1000
|
+
inputs: {
|
|
1001
|
+
session_id,
|
|
1002
|
+
page
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
const behaviors = (0, _prismatic_io_spectral.input)({
|
|
1006
|
+
label: "Behaviors",
|
|
1007
|
+
type: "string",
|
|
1008
|
+
clean: toOptionalString,
|
|
1009
|
+
comments: "Event selector for exporting user profiles based on behaviors. Note: Mutually exclusive with filter_by_cohort.",
|
|
1010
|
+
placeholder: "Enter behaviors expression",
|
|
1011
|
+
required: false,
|
|
1012
|
+
example: "event(\"Purchase\").count() > 5"
|
|
1013
|
+
});
|
|
1014
|
+
const as_of_timestamp = (0, _prismatic_io_spectral.input)({
|
|
1015
|
+
label: "As Of Timestamp",
|
|
1016
|
+
type: "string",
|
|
1017
|
+
clean: toOptionalString,
|
|
1018
|
+
comments: "A Unix timestamp for querying profiles as of a specific time. Required when exporting more than 1k profiles with behaviors parameter.",
|
|
1019
|
+
placeholder: "Enter Unix timestamp",
|
|
1020
|
+
required: false,
|
|
1021
|
+
example: "1609459200"
|
|
1022
|
+
});
|
|
1023
|
+
const filter_by_cohort = (0, _prismatic_io_spectral.input)({
|
|
1024
|
+
label: "Filter By Cohort",
|
|
1025
|
+
type: "string",
|
|
1026
|
+
clean: toOptionalString,
|
|
1027
|
+
comments: "A JSON object containing the cohort ID to filter by. Format: {\"id\":12345}. Note: Mutually exclusive with behaviors.",
|
|
1028
|
+
placeholder: "Enter cohort filter JSON",
|
|
1029
|
+
required: false,
|
|
1030
|
+
example: "{\"id\":12345}"
|
|
1031
|
+
});
|
|
1032
|
+
const include_all_users = (0, _prismatic_io_spectral.input)({
|
|
1033
|
+
label: "Include All Users",
|
|
1034
|
+
type: "boolean",
|
|
1035
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
1036
|
+
comments: "When true, includes distinct_ids without user profiles. When false, only includes distinct_ids with user profiles. Only applies when using filter_by_cohort.",
|
|
1037
|
+
required: false,
|
|
1038
|
+
example: "false",
|
|
1039
|
+
default: "true"
|
|
1040
|
+
});
|
|
1041
|
+
const cohortFilters = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
1042
|
+
label: "Cohort & Behavior Filters",
|
|
1043
|
+
required: false,
|
|
1044
|
+
comments: "Behavior-based event selector, cohort filter, and whether to include all users. Behaviors and cohort filter are mutually exclusive; including all users only applies with a cohort filter.",
|
|
1045
|
+
inputs: {
|
|
1046
|
+
behaviors,
|
|
1047
|
+
filter_by_cohort,
|
|
1048
|
+
include_all_users
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
const queryProfilesInputs = {
|
|
1052
|
+
connection: connectionInput,
|
|
1053
|
+
regionAndDomain,
|
|
1054
|
+
project_id: {
|
|
1055
|
+
...project_id,
|
|
1056
|
+
required: true,
|
|
1057
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
1058
|
+
},
|
|
1059
|
+
workspace_id,
|
|
1060
|
+
distinct_ids,
|
|
1061
|
+
where: {
|
|
1062
|
+
...where,
|
|
1063
|
+
comments: "An expression to filter users by. See [segmentation expressions](https://docs.mixpanel.com/reference/segmentation-expressions) for syntax details."
|
|
1064
|
+
},
|
|
1065
|
+
output_properties,
|
|
1066
|
+
pagination,
|
|
1067
|
+
cohortFilters,
|
|
1068
|
+
as_of_timestamp
|
|
1069
|
+
};
|
|
1070
|
+
const createProfileInputs = {
|
|
1071
|
+
connection: connectionInput,
|
|
1072
|
+
properties,
|
|
1073
|
+
verbose,
|
|
1074
|
+
redirect,
|
|
1075
|
+
region
|
|
1076
|
+
};
|
|
1077
|
+
const updateMultipleProfilesInputs = {
|
|
1078
|
+
connection: connectionInput,
|
|
1079
|
+
propertiesToUpdate,
|
|
1080
|
+
verbose,
|
|
1081
|
+
redirect,
|
|
1082
|
+
region
|
|
1083
|
+
};
|
|
1084
|
+
const deleteProfileInputs = {
|
|
1085
|
+
connection: connectionInput,
|
|
1086
|
+
deleteProfiles,
|
|
1087
|
+
verbose,
|
|
1088
|
+
redirect,
|
|
1089
|
+
region
|
|
1090
|
+
};
|
|
1091
|
+
//#endregion
|
|
1092
|
+
//#region src/examplePayloads.ts
|
|
1093
|
+
const trackEventsExamplePayload = { data: {
|
|
1094
|
+
code: 200,
|
|
1095
|
+
num_records_imported: 2e3,
|
|
1096
|
+
status: "OK"
|
|
1097
|
+
} };
|
|
1098
|
+
const importEventsExamplePayload = { data: {
|
|
1099
|
+
code: 200,
|
|
1100
|
+
num_records_imported: 2e3,
|
|
1101
|
+
status: "OK"
|
|
1102
|
+
} };
|
|
1103
|
+
const createProfileExamplePayload = { data: {
|
|
1104
|
+
code: 200,
|
|
1105
|
+
num_records_imported: 2e3,
|
|
1106
|
+
status: "OK"
|
|
1107
|
+
} };
|
|
1108
|
+
const queryProfilesExamplePayload = { data: {
|
|
1109
|
+
page: 0,
|
|
1110
|
+
page_size: 1e3,
|
|
1111
|
+
results: [{
|
|
1112
|
+
$distinct_id: 4,
|
|
1113
|
+
$properties: {
|
|
1114
|
+
$created: "2008-12-12T11:20:47",
|
|
1115
|
+
$email: "example@mixpanel.com",
|
|
1116
|
+
$first_name: "Example",
|
|
1117
|
+
$last_name: "Name",
|
|
1118
|
+
$last_seen: "2008-06-09T23:08:40"
|
|
1119
|
+
}
|
|
1120
|
+
}],
|
|
1121
|
+
session_id: "1234567890-EXAMPL",
|
|
1122
|
+
status: "ok",
|
|
1123
|
+
total: 1
|
|
1124
|
+
} };
|
|
1125
|
+
const updateMultipleProfilesExamplePayload = { data: 1 };
|
|
1126
|
+
const deleteProfileExamplePayload = { data: {
|
|
1127
|
+
code: 200,
|
|
1128
|
+
num_records_imported: 2e3,
|
|
1129
|
+
status: "OK"
|
|
1130
|
+
} };
|
|
1131
|
+
const createIdentityExamplePayload = { data: 1 };
|
|
1132
|
+
const createAliasExamplePayload = { data: 1 };
|
|
1133
|
+
const listPipelinesExamplePayload = { data: { "9876543210": [{
|
|
1134
|
+
name: "events-daily-bigquery-monoschema",
|
|
1135
|
+
Dispatcher: "backfill",
|
|
1136
|
+
last_dispatched: "2019-02-01 12:00:00 US/Pacific",
|
|
1137
|
+
frequency: "hourly",
|
|
1138
|
+
sync_enabled: "true"
|
|
1139
|
+
}] } };
|
|
1140
|
+
const getPipelineExamplePayload = { data: {
|
|
1141
|
+
canceled: [{
|
|
1142
|
+
project_id: 2195193,
|
|
1143
|
+
name: "events-daily-bigquery-monoschema",
|
|
1144
|
+
state: "canceled",
|
|
1145
|
+
last_finish: "2024-01-15 12:00:00 US/Pacific",
|
|
1146
|
+
run_at: "2024-01-15 11:00:00 US/Pacific",
|
|
1147
|
+
from_date: "2024-01-01",
|
|
1148
|
+
to_date: "2024-01-02"
|
|
1149
|
+
}],
|
|
1150
|
+
retried: [{
|
|
1151
|
+
project_id: 2195193,
|
|
1152
|
+
name: "events-daily-bigquery-monoschema",
|
|
1153
|
+
state: "retried",
|
|
1154
|
+
last_finish: "2024-01-15 13:00:00 US/Pacific",
|
|
1155
|
+
run_at: "2024-01-15 12:30:00 US/Pacific",
|
|
1156
|
+
from_date: "2024-01-02",
|
|
1157
|
+
to_date: "2024-01-03"
|
|
1158
|
+
}],
|
|
1159
|
+
succeeded: [{
|
|
1160
|
+
project_id: 2195193,
|
|
1161
|
+
name: "events-daily-bigquery-monoschema",
|
|
1162
|
+
state: "succeeded",
|
|
1163
|
+
last_finish: "2024-01-15 14:00:00 US/Pacific",
|
|
1164
|
+
run_at: "2024-01-15 13:30:00 US/Pacific",
|
|
1165
|
+
from_date: "2024-01-03",
|
|
1166
|
+
to_date: "2024-01-04"
|
|
1167
|
+
}]
|
|
1168
|
+
} };
|
|
1169
|
+
const createGCSPipelineExamplePayload = { data: {
|
|
1170
|
+
pipeline_names: ["trial-events-daily-bigquery-monoschema", "trial-people-daily-bigquery-monoschema"],
|
|
1171
|
+
bigquery_dataset_name: "https://bigquery.cloud.google.com/dataset/mixpanel-prod-1:sample_dataset_name"
|
|
1172
|
+
} };
|
|
1173
|
+
const editGCSPipelineExamplePayload = { data: null };
|
|
1174
|
+
const createGenericPipelineExamplePayload = { data: {
|
|
1175
|
+
pipeline_names: ["trial-events-daily-generic-monoschema", "trial-people-daily-generic-monoschema"],
|
|
1176
|
+
bigquery_dataset_name: "https://bigquery.cloud.google.com/dataset/mixpanel-prod-1:generic_dataset_name"
|
|
1177
|
+
} };
|
|
1178
|
+
const editGenericPipelineExamplePayload = { data: null };
|
|
1179
|
+
const deletePipelineExamplePayload = { data: null };
|
|
1180
|
+
const listSavedFunnelsExamplePayload = { data: [{
|
|
1181
|
+
funnel_id: 7509,
|
|
1182
|
+
name: "Signup funnel"
|
|
1183
|
+
}, {
|
|
1184
|
+
funnel_id: 9070,
|
|
1185
|
+
name: "Funnel tutorial"
|
|
1186
|
+
}] };
|
|
1187
|
+
const queryFunnelSavedReportsExamplePayload = { data: {
|
|
1188
|
+
meta: { dates: [
|
|
1189
|
+
"2016-09-12",
|
|
1190
|
+
"2016-09-19",
|
|
1191
|
+
"2016-09-26"
|
|
1192
|
+
] },
|
|
1193
|
+
data: {
|
|
1194
|
+
"2016-09-12": {
|
|
1195
|
+
steps: [{
|
|
1196
|
+
count: 32688,
|
|
1197
|
+
avg_time: 2,
|
|
1198
|
+
avg_time_from_start: 5,
|
|
1199
|
+
step_conv_ratio: 1,
|
|
1200
|
+
goal: "App Open",
|
|
1201
|
+
overall_conv_ratio: 1,
|
|
1202
|
+
event: "App Open"
|
|
1203
|
+
}, {
|
|
1204
|
+
count: 20524,
|
|
1205
|
+
avg_time: 133,
|
|
1206
|
+
avg_time_from_start: 133,
|
|
1207
|
+
step_conv_ratio: .627875673029858,
|
|
1208
|
+
goal: "$custom_event:12345",
|
|
1209
|
+
step_label: "Game Played",
|
|
1210
|
+
custom_event: true,
|
|
1211
|
+
custom_event_id: 12345,
|
|
1212
|
+
overall_conv_ratio: .627875673029858,
|
|
1213
|
+
event: "$custom_event:12345"
|
|
1214
|
+
}],
|
|
1215
|
+
analysis: {
|
|
1216
|
+
completion: 20524,
|
|
1217
|
+
starting_amount: 32688,
|
|
1218
|
+
steps: 2,
|
|
1219
|
+
worst: 1
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
"2016-09-19": {
|
|
1223
|
+
steps: [{
|
|
1224
|
+
count: 32486,
|
|
1225
|
+
avg_time: 10,
|
|
1226
|
+
avg_time_from_start: 10,
|
|
1227
|
+
step_conv_ratio: 1,
|
|
1228
|
+
goal: "App Open",
|
|
1229
|
+
overall_conv_ratio: 1,
|
|
1230
|
+
event: "App Open"
|
|
1231
|
+
}, {
|
|
1232
|
+
count: 20809,
|
|
1233
|
+
avg_time: 75,
|
|
1234
|
+
avg_time_from_start: 75,
|
|
1235
|
+
step_conv_ratio: .6405528535369082,
|
|
1236
|
+
goal: "$custom_event:12345",
|
|
1237
|
+
step_label: "Game Played",
|
|
1238
|
+
custom_event: true,
|
|
1239
|
+
custom_event_id: 12345,
|
|
1240
|
+
overall_conv_ratio: .6405528535369082,
|
|
1241
|
+
event: "$custom_event:12345"
|
|
1242
|
+
}],
|
|
1243
|
+
analysis: {
|
|
1244
|
+
completion: 20809,
|
|
1245
|
+
starting_amount: 32486,
|
|
1246
|
+
steps: 2,
|
|
1247
|
+
worst: 1
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
"2016-09-26": {
|
|
1251
|
+
steps: [{
|
|
1252
|
+
count: 16103,
|
|
1253
|
+
avg_time: 10,
|
|
1254
|
+
avg_time_from_start: 5,
|
|
1255
|
+
step_conv_ratio: 1,
|
|
1256
|
+
goal: "App Open",
|
|
1257
|
+
overall_conv_ratio: 1,
|
|
1258
|
+
event: "App Open"
|
|
1259
|
+
}, {
|
|
1260
|
+
count: 12679,
|
|
1261
|
+
avg_time: 571,
|
|
1262
|
+
avg_time_from_start: 571,
|
|
1263
|
+
step_conv_ratio: .7873688132646091,
|
|
1264
|
+
goal: "$custom_event:12345",
|
|
1265
|
+
step_label: "Game Played",
|
|
1266
|
+
custom_event: true,
|
|
1267
|
+
custom_event_id: 12345,
|
|
1268
|
+
overall_conv_ratio: .7873688132646091,
|
|
1269
|
+
event: "$custom_event:12345"
|
|
1270
|
+
}],
|
|
1271
|
+
analysis: {
|
|
1272
|
+
completion: 12679,
|
|
1273
|
+
starting_amount: 16103,
|
|
1274
|
+
steps: 2,
|
|
1275
|
+
worst: 1
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
} };
|
|
1280
|
+
const queryInsightsSavedReportsExamplePayload = { data: {
|
|
1281
|
+
computed_at: "2020-09-21T16:35:41.252314+00:00",
|
|
1282
|
+
date_range: {
|
|
1283
|
+
from_date: "2020-08-31T00:00:00-07:00",
|
|
1284
|
+
to_date: "2020-09-12T23:59:59.999000-07:00"
|
|
1285
|
+
},
|
|
1286
|
+
headers: ["$event"],
|
|
1287
|
+
series: {
|
|
1288
|
+
"Logged in": {
|
|
1289
|
+
"2020-08-31T00:00:00-07:00": 9852,
|
|
1290
|
+
"2020-09-07T00:00:00-07:00": 4325
|
|
1291
|
+
},
|
|
1292
|
+
"Viewed page": {
|
|
1293
|
+
"2020-08-31T00:00:00-07:00": 10246,
|
|
1294
|
+
"2020-09-07T00:00:00-07:00": 11432
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
} };
|
|
1298
|
+
const downloadDataExamplePayload = { data: [{
|
|
1299
|
+
event: "Signed up",
|
|
1300
|
+
properties: {
|
|
1301
|
+
time: 1602611311,
|
|
1302
|
+
$insert_id: "hpuDqcvpltpCjBsebtxwadtEBDnFAdycabFb",
|
|
1303
|
+
mp_processing_time_ms: 1602625711874
|
|
1304
|
+
}
|
|
1305
|
+
}, {
|
|
1306
|
+
event: "Signed up",
|
|
1307
|
+
properties: {
|
|
1308
|
+
time: 1602787121,
|
|
1309
|
+
$insert_id: "jajcebutltmvhbbholfhxtCcycwnBjDtndha",
|
|
1310
|
+
mp_processing_time_ms: 1602801521561
|
|
1311
|
+
}
|
|
1312
|
+
}] };
|
|
1313
|
+
const customJQLQueryExamplePayload = { data: 1 };
|
|
1314
|
+
//#endregion
|
|
1315
|
+
//#region src/outputSchemas/funnels.ts
|
|
1316
|
+
const listSavedFunnelsOutputSchema = {
|
|
1317
|
+
type: "array",
|
|
1318
|
+
items: {
|
|
1319
|
+
type: "object",
|
|
1320
|
+
properties: {
|
|
1321
|
+
funnel_id: { type: "integer" },
|
|
1322
|
+
name: { type: "string" }
|
|
1323
|
+
},
|
|
1324
|
+
required: ["funnel_id", "name"]
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
const queryFunnelSavedReportsOutputSchema = {
|
|
1328
|
+
type: "object",
|
|
1329
|
+
properties: {
|
|
1330
|
+
meta: {
|
|
1331
|
+
type: "object",
|
|
1332
|
+
properties: { dates: {
|
|
1333
|
+
type: "array",
|
|
1334
|
+
items: { type: "string" }
|
|
1335
|
+
} },
|
|
1336
|
+
required: ["dates"]
|
|
1337
|
+
},
|
|
1338
|
+
data: {
|
|
1339
|
+
type: "object",
|
|
1340
|
+
additionalProperties: {
|
|
1341
|
+
type: "object",
|
|
1342
|
+
properties: {
|
|
1343
|
+
steps: {
|
|
1344
|
+
type: "array",
|
|
1345
|
+
items: {
|
|
1346
|
+
type: "object",
|
|
1347
|
+
properties: {
|
|
1348
|
+
count: { type: "integer" },
|
|
1349
|
+
goal: { type: "string" },
|
|
1350
|
+
event: { type: "string" },
|
|
1351
|
+
step_conv_ratio: { type: "number" },
|
|
1352
|
+
overall_conv_ratio: { type: "number" },
|
|
1353
|
+
avg_time: { type: ["integer", "null"] },
|
|
1354
|
+
avg_time_from_start: { type: "integer" },
|
|
1355
|
+
step_label: { type: "string" },
|
|
1356
|
+
custom_event: { type: "boolean" },
|
|
1357
|
+
custom_event_id: { type: "integer" }
|
|
1358
|
+
},
|
|
1359
|
+
required: [
|
|
1360
|
+
"count",
|
|
1361
|
+
"goal",
|
|
1362
|
+
"event",
|
|
1363
|
+
"step_conv_ratio",
|
|
1364
|
+
"overall_conv_ratio",
|
|
1365
|
+
"avg_time_from_start"
|
|
1366
|
+
]
|
|
1367
|
+
}
|
|
1368
|
+
},
|
|
1369
|
+
analysis: {
|
|
1370
|
+
type: "object",
|
|
1371
|
+
properties: {
|
|
1372
|
+
completion: { type: "integer" },
|
|
1373
|
+
starting_amount: { type: "integer" },
|
|
1374
|
+
steps: { type: "integer" },
|
|
1375
|
+
worst: { type: "integer" }
|
|
1376
|
+
},
|
|
1377
|
+
required: [
|
|
1378
|
+
"completion",
|
|
1379
|
+
"starting_amount",
|
|
1380
|
+
"steps",
|
|
1381
|
+
"worst"
|
|
1382
|
+
]
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
required: ["meta", "data"]
|
|
1389
|
+
};
|
|
1390
|
+
//#endregion
|
|
1391
|
+
//#region src/outputSchemas/pipelines.ts
|
|
1392
|
+
const createGCSPipelineOutputSchema = {
|
|
1393
|
+
type: "object",
|
|
1394
|
+
properties: {
|
|
1395
|
+
pipeline_names: {
|
|
1396
|
+
type: "array",
|
|
1397
|
+
items: { type: "string" }
|
|
1398
|
+
},
|
|
1399
|
+
bigquery_dataset_name: { type: "string" }
|
|
1400
|
+
},
|
|
1401
|
+
required: ["pipeline_names"]
|
|
1402
|
+
};
|
|
1403
|
+
const pipelineJobSchema = {
|
|
1404
|
+
type: "object",
|
|
1405
|
+
properties: {
|
|
1406
|
+
project_id: { type: "number" },
|
|
1407
|
+
name: { type: "string" },
|
|
1408
|
+
state: { type: "string" },
|
|
1409
|
+
last_finish: { type: "string" },
|
|
1410
|
+
run_at: { type: "string" },
|
|
1411
|
+
from_date: { type: "string" },
|
|
1412
|
+
to_date: { type: "string" }
|
|
1413
|
+
},
|
|
1414
|
+
required: [
|
|
1415
|
+
"project_id",
|
|
1416
|
+
"name",
|
|
1417
|
+
"state",
|
|
1418
|
+
"last_finish",
|
|
1419
|
+
"run_at",
|
|
1420
|
+
"from_date",
|
|
1421
|
+
"to_date"
|
|
1422
|
+
]
|
|
1423
|
+
};
|
|
1424
|
+
const getPipelineOutputSchema = {
|
|
1425
|
+
type: "object",
|
|
1426
|
+
properties: {
|
|
1427
|
+
canceled: {
|
|
1428
|
+
type: "array",
|
|
1429
|
+
items: pipelineJobSchema
|
|
1430
|
+
},
|
|
1431
|
+
retried: {
|
|
1432
|
+
type: "array",
|
|
1433
|
+
items: pipelineJobSchema
|
|
1434
|
+
},
|
|
1435
|
+
succeeded: {
|
|
1436
|
+
type: "array",
|
|
1437
|
+
items: pipelineJobSchema
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
required: [
|
|
1441
|
+
"canceled",
|
|
1442
|
+
"retried",
|
|
1443
|
+
"succeeded"
|
|
1444
|
+
]
|
|
1445
|
+
};
|
|
1446
|
+
const listPipelinesOutputSchema = {
|
|
1447
|
+
type: "object",
|
|
1448
|
+
additionalProperties: {
|
|
1449
|
+
type: "array",
|
|
1450
|
+
items: {
|
|
1451
|
+
type: "object",
|
|
1452
|
+
properties: {
|
|
1453
|
+
name: { type: "string" },
|
|
1454
|
+
Dispatcher: { type: "string" },
|
|
1455
|
+
last_dispatched: { type: "string" },
|
|
1456
|
+
frequency: { type: "string" },
|
|
1457
|
+
sync_enabled: { type: "string" }
|
|
1458
|
+
},
|
|
1459
|
+
required: [
|
|
1460
|
+
"name",
|
|
1461
|
+
"Dispatcher",
|
|
1462
|
+
"last_dispatched",
|
|
1463
|
+
"frequency",
|
|
1464
|
+
"sync_enabled"
|
|
1465
|
+
]
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/outputSchemas/profiles.ts
|
|
1471
|
+
const queryProfilesOutputSchema = {
|
|
1472
|
+
type: "object",
|
|
1473
|
+
properties: {
|
|
1474
|
+
page: { type: "integer" },
|
|
1475
|
+
page_size: { type: "integer" },
|
|
1476
|
+
session_id: { type: "string" },
|
|
1477
|
+
status: { type: "string" },
|
|
1478
|
+
total: { type: "integer" },
|
|
1479
|
+
results: {
|
|
1480
|
+
type: "array",
|
|
1481
|
+
items: {
|
|
1482
|
+
type: "object",
|
|
1483
|
+
properties: {
|
|
1484
|
+
$distinct_id: { type: "integer" },
|
|
1485
|
+
$properties: { type: "object" }
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
required: [
|
|
1491
|
+
"page",
|
|
1492
|
+
"page_size",
|
|
1493
|
+
"session_id",
|
|
1494
|
+
"status",
|
|
1495
|
+
"total",
|
|
1496
|
+
"results"
|
|
1497
|
+
]
|
|
1498
|
+
};
|
|
1499
|
+
//#endregion
|
|
1500
|
+
//#region src/outputSchemas/insights.ts
|
|
1501
|
+
const queryInsightsSavedReportsOutputSchema = {
|
|
1502
|
+
type: "object",
|
|
1503
|
+
properties: {
|
|
1504
|
+
computed_at: { type: "string" },
|
|
1505
|
+
date_range: {
|
|
1506
|
+
type: "object",
|
|
1507
|
+
properties: {
|
|
1508
|
+
from_date: { type: "string" },
|
|
1509
|
+
to_date: { type: "string" }
|
|
1510
|
+
},
|
|
1511
|
+
required: ["from_date", "to_date"]
|
|
1512
|
+
},
|
|
1513
|
+
headers: {
|
|
1514
|
+
type: "array",
|
|
1515
|
+
items: { type: "string" }
|
|
1516
|
+
},
|
|
1517
|
+
series: {
|
|
1518
|
+
type: "object",
|
|
1519
|
+
additionalProperties: {
|
|
1520
|
+
type: "object",
|
|
1521
|
+
additionalProperties: { type: "number" }
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
required: [
|
|
1526
|
+
"computed_at",
|
|
1527
|
+
"date_range",
|
|
1528
|
+
"headers",
|
|
1529
|
+
"series"
|
|
1530
|
+
]
|
|
1531
|
+
};
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region src/outputSchemas/events.ts
|
|
1534
|
+
const importEventsOutputSchema = {
|
|
1535
|
+
type: "object",
|
|
1536
|
+
properties: {
|
|
1537
|
+
code: { type: "integer" },
|
|
1538
|
+
num_records_imported: { type: "integer" },
|
|
1539
|
+
status: { type: "string" }
|
|
1540
|
+
},
|
|
1541
|
+
required: [
|
|
1542
|
+
"code",
|
|
1543
|
+
"num_records_imported",
|
|
1544
|
+
"status"
|
|
1545
|
+
]
|
|
1546
|
+
};
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/outputSchemas/ingestionAck.ts
|
|
1549
|
+
const ingestionAckOutputSchema = {
|
|
1550
|
+
properties: {
|
|
1551
|
+
status: { type: "integer" },
|
|
1552
|
+
error: { type: "string" }
|
|
1553
|
+
},
|
|
1554
|
+
required: [],
|
|
1555
|
+
additionalProperties: true
|
|
1556
|
+
};
|
|
1557
|
+
//#endregion
|
|
1558
|
+
//#region src/actions/dataExport/index.ts
|
|
1559
|
+
var dataExport_default = { downloadData: (0, _prismatic_io_spectral.action)({
|
|
1560
|
+
display: {
|
|
1561
|
+
label: "Download Data",
|
|
1562
|
+
description: "Download event data as it is received and stored within Mixpanel."
|
|
1563
|
+
},
|
|
1564
|
+
inputs: downloadDataInputs,
|
|
1565
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1566
|
+
type: "actionOutput",
|
|
1567
|
+
schema: {
|
|
1568
|
+
type: "array",
|
|
1569
|
+
items: {
|
|
1570
|
+
type: "object",
|
|
1571
|
+
properties: {
|
|
1572
|
+
event: { type: "string" },
|
|
1573
|
+
properties: {
|
|
1574
|
+
type: "object",
|
|
1575
|
+
properties: {
|
|
1576
|
+
time: { type: "integer" },
|
|
1577
|
+
$insert_id: { type: "string" },
|
|
1578
|
+
mp_processing_time_ms: { type: "integer" }
|
|
1579
|
+
},
|
|
1580
|
+
required: [],
|
|
1581
|
+
additionalProperties: true
|
|
1582
|
+
}
|
|
1583
|
+
},
|
|
1584
|
+
required: ["event", "properties"]
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}),
|
|
1588
|
+
performSafety: "notAllowed",
|
|
1589
|
+
perform: async (context, { connection, dataAndDomain, from_date, to_date, project_id, filters }) => {
|
|
1590
|
+
const { data } = await createDataClient(dataAndDomain, connection, "fallback", context.debug.enabled).get("/export", {
|
|
1591
|
+
params: {
|
|
1592
|
+
from_date,
|
|
1593
|
+
to_date,
|
|
1594
|
+
project_id,
|
|
1595
|
+
limit: filters.limit,
|
|
1596
|
+
event: filters.event,
|
|
1597
|
+
where: filters.where
|
|
1598
|
+
},
|
|
1599
|
+
headers: { "Accept-Encoding": filters.gzipEncoding ? "gzip" : void 0 }
|
|
1600
|
+
});
|
|
1601
|
+
return { data };
|
|
1602
|
+
},
|
|
1603
|
+
examplePerform: async () => downloadDataExamplePayload,
|
|
1604
|
+
examplePayload: downloadDataExamplePayload
|
|
1605
|
+
}) };
|
|
1606
|
+
//#endregion
|
|
1607
|
+
//#region src/actions/events/index.ts
|
|
1608
|
+
var events_default = {
|
|
1609
|
+
importEvents: (0, _prismatic_io_spectral.action)({
|
|
1610
|
+
display: {
|
|
1611
|
+
label: "Import Events",
|
|
1612
|
+
description: "Each request ingests a batch of events into Mixpanel."
|
|
1613
|
+
},
|
|
1614
|
+
inputs: importEventsInputs,
|
|
1615
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1616
|
+
type: "actionOutput",
|
|
1617
|
+
schema: importEventsOutputSchema
|
|
1618
|
+
}),
|
|
1619
|
+
performSafety: "notAllowed",
|
|
1620
|
+
perform: async (context, { connection, region, events, project_id, useProjectToken }) => {
|
|
1621
|
+
const { data } = await createClient(region, connection, useProjectToken ? "token" : "account", context.debug.enabled).post("/import", events, { params: { project_id } });
|
|
1622
|
+
return { data };
|
|
1623
|
+
},
|
|
1624
|
+
examplePerform: async () => importEventsExamplePayload,
|
|
1625
|
+
examplePayload: importEventsExamplePayload
|
|
1626
|
+
}),
|
|
1627
|
+
trackEvents: (0, _prismatic_io_spectral.action)({
|
|
1628
|
+
display: {
|
|
1629
|
+
label: "Track Events",
|
|
1630
|
+
description: "Track events to Mixpanel from client devices."
|
|
1631
|
+
},
|
|
1632
|
+
inputs: trackEventsInputs,
|
|
1633
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1634
|
+
type: "actionOutput",
|
|
1635
|
+
schema: ingestionAckOutputSchema
|
|
1636
|
+
}),
|
|
1637
|
+
performSafety: "notAllowed",
|
|
1638
|
+
perform: async (context, { connection, events, deliveryOptions, region, useProjectToken }) => {
|
|
1639
|
+
const { data } = await createClient(region, connection, useProjectToken ? "token" : "account", context.debug.enabled).post("/track", events, { params: {
|
|
1640
|
+
ip: deliveryOptions.ip,
|
|
1641
|
+
verbose: deliveryOptions.verbose,
|
|
1642
|
+
redirect: deliveryOptions.redirect,
|
|
1643
|
+
img: deliveryOptions.img
|
|
1644
|
+
} });
|
|
1645
|
+
return { data };
|
|
1646
|
+
},
|
|
1647
|
+
examplePerform: async () => trackEventsExamplePayload,
|
|
1648
|
+
examplePayload: trackEventsExamplePayload
|
|
1649
|
+
})
|
|
1650
|
+
};
|
|
1651
|
+
//#endregion
|
|
1652
|
+
//#region src/actions/funnels/index.ts
|
|
1653
|
+
var funnels_default = {
|
|
1654
|
+
listSavedFunnels: (0, _prismatic_io_spectral.action)({
|
|
1655
|
+
display: {
|
|
1656
|
+
label: "List Saved Funnels",
|
|
1657
|
+
description: "Get the names and funnel_ids of the funnels."
|
|
1658
|
+
},
|
|
1659
|
+
inputs: listSavedFunnelsInputs,
|
|
1660
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1661
|
+
type: "actionOutput",
|
|
1662
|
+
schema: listSavedFunnelsOutputSchema
|
|
1663
|
+
}),
|
|
1664
|
+
performSafety: "safe",
|
|
1665
|
+
perform: async (context, { connection, project_id, regionAndDomain, workspace_id, useProjectToken }) => {
|
|
1666
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, useProjectToken ? "token" : "account", context.debug.enabled).get("/funnels/list", { params: {
|
|
1667
|
+
project_id,
|
|
1668
|
+
workspace_id
|
|
1669
|
+
} });
|
|
1670
|
+
return { data };
|
|
1671
|
+
},
|
|
1672
|
+
examplePayload: listSavedFunnelsExamplePayload
|
|
1673
|
+
}),
|
|
1674
|
+
queryFunnelSavedReports: (0, _prismatic_io_spectral.action)({
|
|
1675
|
+
display: {
|
|
1676
|
+
label: "Query Funnel Saved Reports",
|
|
1677
|
+
description: "Get data for a funnel."
|
|
1678
|
+
},
|
|
1679
|
+
inputs: queryFunnelSavedReportsInputs,
|
|
1680
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1681
|
+
type: "actionOutput",
|
|
1682
|
+
schema: queryFunnelSavedReportsOutputSchema
|
|
1683
|
+
}),
|
|
1684
|
+
performSafety: "safe",
|
|
1685
|
+
perform: async (context, { connection, useProjectToken, regionAndDomain, funnel_id, from_date, to_date, project_id, workspace_id, length, length_unit, interval, unit, segmentation }) => {
|
|
1686
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, useProjectToken ? "token" : "account", context.debug.enabled).get("/funnels", { params: {
|
|
1687
|
+
project_id,
|
|
1688
|
+
workspace_id,
|
|
1689
|
+
funnel_id,
|
|
1690
|
+
from_date,
|
|
1691
|
+
to_date,
|
|
1692
|
+
length,
|
|
1693
|
+
length_unit,
|
|
1694
|
+
interval,
|
|
1695
|
+
unit,
|
|
1696
|
+
on: segmentation.on,
|
|
1697
|
+
where: segmentation.where,
|
|
1698
|
+
limit: segmentation.limit
|
|
1699
|
+
} });
|
|
1700
|
+
return { data };
|
|
1701
|
+
},
|
|
1702
|
+
examplePayload: queryFunnelSavedReportsExamplePayload
|
|
1703
|
+
})
|
|
1704
|
+
};
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region src/actions/identities/index.ts
|
|
1707
|
+
var identities_default = {
|
|
1708
|
+
createIdentity: (0, _prismatic_io_spectral.action)({
|
|
1709
|
+
display: {
|
|
1710
|
+
label: "Create Identity",
|
|
1711
|
+
description: "Creates a new Identity"
|
|
1712
|
+
},
|
|
1713
|
+
inputs: createIdentityInputs,
|
|
1714
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1715
|
+
type: "actionOutput",
|
|
1716
|
+
schema: ingestionAckOutputSchema
|
|
1717
|
+
}),
|
|
1718
|
+
performSafety: "notAllowed",
|
|
1719
|
+
perform: async (context, { connection, deliveryOptions, region, identified_id, anon_id, project_token }) => {
|
|
1720
|
+
const client = createNoAuthClient(region, connection, context.debug.enabled);
|
|
1721
|
+
const identityData = JSON.stringify({
|
|
1722
|
+
event: "$identify",
|
|
1723
|
+
properties: {
|
|
1724
|
+
$identified_id: identified_id,
|
|
1725
|
+
$anon_id: anon_id,
|
|
1726
|
+
token: project_token
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
const body = new URLSearchParams({ data: identityData });
|
|
1730
|
+
if (deliveryOptions.strict) body.append("strict", deliveryOptions.strict);
|
|
1731
|
+
const { data } = await client.post("/track#create-identity", body, { params: {
|
|
1732
|
+
verbose: deliveryOptions.verbose,
|
|
1733
|
+
redirect: deliveryOptions.redirect
|
|
1734
|
+
} });
|
|
1735
|
+
return { data };
|
|
1736
|
+
},
|
|
1737
|
+
examplePerform: async () => createIdentityExamplePayload,
|
|
1738
|
+
examplePayload: createIdentityExamplePayload
|
|
1739
|
+
}),
|
|
1740
|
+
createAlias: (0, _prismatic_io_spectral.action)({
|
|
1741
|
+
display: {
|
|
1742
|
+
label: "Create Alias",
|
|
1743
|
+
description: "Mixpanel supports adding an alias to a distinct id."
|
|
1744
|
+
},
|
|
1745
|
+
inputs: createAliasInputs,
|
|
1746
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1747
|
+
type: "actionOutput",
|
|
1748
|
+
schema: ingestionAckOutputSchema
|
|
1749
|
+
}),
|
|
1750
|
+
performSafety: "notAllowed",
|
|
1751
|
+
perform: async (context, { connection, region, deliveryOptions, distinct_id, project_token, alias }) => {
|
|
1752
|
+
const client = createClient(region, connection, "fallback", context.debug.enabled);
|
|
1753
|
+
const identityData = JSON.stringify({
|
|
1754
|
+
event: "$create_alias",
|
|
1755
|
+
properties: {
|
|
1756
|
+
distinct_id,
|
|
1757
|
+
alias,
|
|
1758
|
+
token: project_token
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
const body = new URLSearchParams({ data: identityData });
|
|
1762
|
+
if (deliveryOptions.strict) body.append("strict", deliveryOptions.strict);
|
|
1763
|
+
const { data } = await client.post("/track#identity-create-alias", body, { params: {
|
|
1764
|
+
verbose: deliveryOptions.verbose,
|
|
1765
|
+
redirect: deliveryOptions.redirect
|
|
1766
|
+
} });
|
|
1767
|
+
return { data };
|
|
1768
|
+
},
|
|
1769
|
+
examplePerform: async () => createAliasExamplePayload,
|
|
1770
|
+
examplePayload: createAliasExamplePayload
|
|
1771
|
+
})
|
|
1772
|
+
};
|
|
1773
|
+
//#endregion
|
|
1774
|
+
//#region src/actions/insights/index.ts
|
|
1775
|
+
var insights_default = { queryInsightsSavedReports: (0, _prismatic_io_spectral.action)({
|
|
1776
|
+
display: {
|
|
1777
|
+
label: "Query Insights Saved Reports",
|
|
1778
|
+
description: "Get data from Insights reports."
|
|
1779
|
+
},
|
|
1780
|
+
inputs: queryInsightsSavedReportsInputs,
|
|
1781
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1782
|
+
type: "actionOutput",
|
|
1783
|
+
schema: queryInsightsSavedReportsOutputSchema
|
|
1784
|
+
}),
|
|
1785
|
+
performSafety: "safe",
|
|
1786
|
+
perform: async (context, { connection, regionAndDomain, bookmark_id, project_id, workspace_id }) => {
|
|
1787
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, "fallback", context.debug.enabled).get("/insights", { params: {
|
|
1788
|
+
bookmark_id,
|
|
1789
|
+
project_id,
|
|
1790
|
+
workspace_id
|
|
1791
|
+
} });
|
|
1792
|
+
return { data };
|
|
1793
|
+
},
|
|
1794
|
+
examplePayload: queryInsightsSavedReportsExamplePayload
|
|
1795
|
+
}) };
|
|
1796
|
+
//#endregion
|
|
1797
|
+
//#region src/actions/misc/index.ts
|
|
1798
|
+
var misc_default = {
|
|
1799
|
+
customJQLQuery: (0, _prismatic_io_spectral.action)({
|
|
1800
|
+
display: {
|
|
1801
|
+
label: "Custom JQL Query",
|
|
1802
|
+
description: "The HTTP API is the lowest-level way to use JQL."
|
|
1803
|
+
},
|
|
1804
|
+
inputs: customJQLQueryInputs,
|
|
1805
|
+
performSafety: "notAllowed",
|
|
1806
|
+
perform: async (context, { connection, regionAndDomain, script, params, project_id, workspace_id }) => {
|
|
1807
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, "fallback", context.debug.enabled).post("/jql", {
|
|
1808
|
+
script,
|
|
1809
|
+
params
|
|
1810
|
+
}, { params: {
|
|
1811
|
+
project_id,
|
|
1812
|
+
workspace_id
|
|
1813
|
+
} });
|
|
1814
|
+
return { data };
|
|
1815
|
+
},
|
|
1816
|
+
examplePerform: async () => customJQLQueryExamplePayload,
|
|
1817
|
+
examplePayload: customJQLQueryExamplePayload
|
|
1818
|
+
}),
|
|
1819
|
+
rawRequest: (0, _prismatic_io_spectral.action)({
|
|
1820
|
+
display: {
|
|
1821
|
+
label: "Raw Request",
|
|
1822
|
+
description: "Send raw HTTP request to Mixpanel"
|
|
1823
|
+
},
|
|
1824
|
+
inputs: rawRequestInputs,
|
|
1825
|
+
performSafety: "notAllowed",
|
|
1826
|
+
perform: async (context, { connection, ...params }) => {
|
|
1827
|
+
validateConnection(connection);
|
|
1828
|
+
const authorization = getFallbackConnectionToken(connection);
|
|
1829
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(params.baseUrl, {
|
|
1830
|
+
...params,
|
|
1831
|
+
debugRequest: context.debug.enabled
|
|
1832
|
+
}, { Authorization: authorization });
|
|
1833
|
+
return { data };
|
|
1834
|
+
}
|
|
1835
|
+
})
|
|
1836
|
+
};
|
|
1837
|
+
//#endregion
|
|
1838
|
+
//#region src/actions/pipelines/index.ts
|
|
1839
|
+
var pipelines_default = {
|
|
1840
|
+
createGCSPipeline: (0, _prismatic_io_spectral.action)({
|
|
1841
|
+
display: {
|
|
1842
|
+
label: "Create GCS Pipeline",
|
|
1843
|
+
description: "This request creates an export pipeline."
|
|
1844
|
+
},
|
|
1845
|
+
inputs: createGCSPipelineInputs,
|
|
1846
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1847
|
+
type: "actionOutput",
|
|
1848
|
+
schema: createGCSPipelineOutputSchema
|
|
1849
|
+
}),
|
|
1850
|
+
performSafety: "notAllowed",
|
|
1851
|
+
perform: async (context, { connection, dataAndDomain, ...params }) => {
|
|
1852
|
+
const client = createDataClient(dataAndDomain, connection, "fallback", context.debug.enabled);
|
|
1853
|
+
const body = new URLSearchParams({
|
|
1854
|
+
data_format: "json",
|
|
1855
|
+
data_source: "events",
|
|
1856
|
+
type: "gcs-raw"
|
|
1857
|
+
});
|
|
1858
|
+
for (const [key, value] of Object.entries(params)) if (value) if (Array.isArray(value)) body.append(key, value.toString());
|
|
1859
|
+
else body.append(key, value);
|
|
1860
|
+
const { data } = await client.post("/nessie/pipeline/create", body, { headers: { "content-type": "application/x-www-form-urlencoded" } });
|
|
1861
|
+
return { data };
|
|
1862
|
+
},
|
|
1863
|
+
examplePerform: async () => createGCSPipelineExamplePayload,
|
|
1864
|
+
examplePayload: createGCSPipelineExamplePayload
|
|
1865
|
+
}),
|
|
1866
|
+
createGenericPipeline: (0, _prismatic_io_spectral.action)({
|
|
1867
|
+
display: {
|
|
1868
|
+
label: "Create Generic Pipeline",
|
|
1869
|
+
description: "This request creates an export pipeline."
|
|
1870
|
+
},
|
|
1871
|
+
inputs: createGenericPipelineInputs,
|
|
1872
|
+
performSafety: "notAllowed",
|
|
1873
|
+
perform: async (context, { connection, dataAndDomain, ...params }) => {
|
|
1874
|
+
validateConnection(connection);
|
|
1875
|
+
const baseUrl = `https://${dataAndDomain}.mixpanel.com/api/2.0/`;
|
|
1876
|
+
const authorization = getFallbackConnectionToken(connection);
|
|
1877
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(baseUrl, {
|
|
1878
|
+
...params,
|
|
1879
|
+
debugRequest: context.debug.enabled
|
|
1880
|
+
}, { Authorization: authorization });
|
|
1881
|
+
return { data };
|
|
1882
|
+
},
|
|
1883
|
+
examplePerform: async () => createGenericPipelineExamplePayload,
|
|
1884
|
+
examplePayload: createGenericPipelineExamplePayload
|
|
1885
|
+
}),
|
|
1886
|
+
deletePipeline: (0, _prismatic_io_spectral.action)({
|
|
1887
|
+
display: {
|
|
1888
|
+
label: "Delete Pipeline",
|
|
1889
|
+
description: "Deletes the pipeline and stops any future jobs to be scheduled for the pipeline."
|
|
1890
|
+
},
|
|
1891
|
+
inputs: deletePipelineInputs,
|
|
1892
|
+
performSafety: "notAllowed",
|
|
1893
|
+
perform: async (context, { connection, project_id, dataAndDomain, name, useProjectToken }) => {
|
|
1894
|
+
const { data } = await createDataClient(dataAndDomain, connection, useProjectToken ? "token" : "account", context.debug.enabled).post("/nessie/pipeline/cancel", {
|
|
1895
|
+
project_id,
|
|
1896
|
+
name
|
|
1897
|
+
});
|
|
1898
|
+
return { data };
|
|
1899
|
+
},
|
|
1900
|
+
examplePerform: async () => deletePipelineExamplePayload,
|
|
1901
|
+
examplePayload: deletePipelineExamplePayload
|
|
1902
|
+
}),
|
|
1903
|
+
editGCSPipeline: (0, _prismatic_io_spectral.action)({
|
|
1904
|
+
display: {
|
|
1905
|
+
label: "Edit GCS Pipeline",
|
|
1906
|
+
description: "This request edit the params for an export pipeline."
|
|
1907
|
+
},
|
|
1908
|
+
inputs: editGCSPipelineInputs,
|
|
1909
|
+
performSafety: "notAllowed",
|
|
1910
|
+
perform: async (context, { connection, dataAndDomain, ...params }) => {
|
|
1911
|
+
const client = createDataClient(dataAndDomain, connection, "fallback", context.debug.enabled);
|
|
1912
|
+
const body = new URLSearchParams();
|
|
1913
|
+
for (const [key, value] of Object.entries(params)) if (value) if (Array.isArray(value)) body.append(key, value.toString());
|
|
1914
|
+
else body.append(key, value);
|
|
1915
|
+
const { data } = await client.post("/nessie/pipeline/edit", body, { headers: { "content-type": "application/x-www-form-urlencoded" } });
|
|
1916
|
+
return { data };
|
|
1917
|
+
},
|
|
1918
|
+
examplePerform: async () => editGCSPipelineExamplePayload,
|
|
1919
|
+
examplePayload: editGCSPipelineExamplePayload
|
|
1920
|
+
}),
|
|
1921
|
+
editGenericPipeline: (0, _prismatic_io_spectral.action)({
|
|
1922
|
+
display: {
|
|
1923
|
+
label: "Edit Generic Pipeline",
|
|
1924
|
+
description: "This request edit the params for an export pipeline."
|
|
1925
|
+
},
|
|
1926
|
+
inputs: editGenericPipelineInputs,
|
|
1927
|
+
performSafety: "notAllowed",
|
|
1928
|
+
perform: async (context, { connection, dataAndDomain, ...params }) => {
|
|
1929
|
+
const baseUrl = `https://${dataAndDomain}.mixpanel.com/api/2.0/`;
|
|
1930
|
+
const authorization = getFallbackConnectionToken(connection);
|
|
1931
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(baseUrl, {
|
|
1932
|
+
...params,
|
|
1933
|
+
debugRequest: context.debug.enabled
|
|
1934
|
+
}, { Authorization: authorization });
|
|
1935
|
+
return { data };
|
|
1936
|
+
},
|
|
1937
|
+
examplePerform: async () => editGenericPipelineExamplePayload,
|
|
1938
|
+
examplePayload: editGenericPipelineExamplePayload
|
|
1939
|
+
}),
|
|
1940
|
+
getPipeline: (0, _prismatic_io_spectral.action)({
|
|
1941
|
+
display: {
|
|
1942
|
+
label: "Get Pipeline",
|
|
1943
|
+
description: "Given the name of the pipeline this API returns the status of the pipeline."
|
|
1944
|
+
},
|
|
1945
|
+
inputs: getPipelineInputs,
|
|
1946
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1947
|
+
type: "actionOutput",
|
|
1948
|
+
schema: getPipelineOutputSchema
|
|
1949
|
+
}),
|
|
1950
|
+
performSafety: "safe",
|
|
1951
|
+
perform: async (context, { connection, project_id, dataAndDomain, name, summary, status }) => {
|
|
1952
|
+
const { data } = await createDataClient(dataAndDomain, connection, "account", context.debug.enabled).get("/nessie/pipeline/status", { params: {
|
|
1953
|
+
project_id,
|
|
1954
|
+
name,
|
|
1955
|
+
summary,
|
|
1956
|
+
status
|
|
1957
|
+
} });
|
|
1958
|
+
return { data };
|
|
1959
|
+
},
|
|
1960
|
+
examplePayload: getPipelineExamplePayload
|
|
1961
|
+
}),
|
|
1962
|
+
listPipelines: (0, _prismatic_io_spectral.action)({
|
|
1963
|
+
display: {
|
|
1964
|
+
label: "List Pipelines",
|
|
1965
|
+
description: "Returns the list of all the pipelines scheduled for a project."
|
|
1966
|
+
},
|
|
1967
|
+
inputs: listPipelinesInputs,
|
|
1968
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1969
|
+
type: "actionOutput",
|
|
1970
|
+
schema: listPipelinesOutputSchema
|
|
1971
|
+
}),
|
|
1972
|
+
performSafety: "safe",
|
|
1973
|
+
perform: async (context, { connection, project_id, dataAndDomain }) => {
|
|
1974
|
+
const { data } = await createDataClient(dataAndDomain, connection, "account", context.debug.enabled).get("/nessie/pipeline/jobs", { params: { project_id } });
|
|
1975
|
+
return { data };
|
|
1976
|
+
},
|
|
1977
|
+
examplePayload: listPipelinesExamplePayload
|
|
1978
|
+
})
|
|
1979
|
+
};
|
|
1980
|
+
//#endregion
|
|
1981
|
+
//#region src/actions/profiles/createProfile.ts
|
|
1982
|
+
const createProfile = (0, _prismatic_io_spectral.action)({
|
|
1983
|
+
display: {
|
|
1984
|
+
label: "Create Profile",
|
|
1985
|
+
description: "Takes a JSON object containing names and values of profile properties. This API will return a 200 OK even if there are data validation issues. To ensure the request actually succeeded, check the response body."
|
|
1986
|
+
},
|
|
1987
|
+
inputs: createProfileInputs,
|
|
1988
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
1989
|
+
type: "actionOutput",
|
|
1990
|
+
schema: ingestionAckOutputSchema
|
|
1991
|
+
}),
|
|
1992
|
+
performSafety: "notAllowed",
|
|
1993
|
+
perform: async (context, { connection, region, properties, verbose, redirect }) => {
|
|
1994
|
+
const { data } = await createClient(region, connection, "fallback", context.debug.enabled).post("/engage#profile-set", properties, { params: {
|
|
1995
|
+
verbose,
|
|
1996
|
+
redirect
|
|
1997
|
+
} });
|
|
1998
|
+
return { data };
|
|
1999
|
+
},
|
|
2000
|
+
examplePerform: async () => createProfileExamplePayload,
|
|
2001
|
+
examplePayload: createProfileExamplePayload
|
|
2002
|
+
});
|
|
2003
|
+
//#endregion
|
|
2004
|
+
//#region src/actions/profiles/deleteProfile.ts
|
|
2005
|
+
const deleteProfile = (0, _prismatic_io_spectral.action)({
|
|
2006
|
+
display: {
|
|
2007
|
+
label: "Delete Profile",
|
|
2008
|
+
description: "Permanently delete the profile from Mixpanel, along with all of its properties."
|
|
2009
|
+
},
|
|
2010
|
+
inputs: deleteProfileInputs,
|
|
2011
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
2012
|
+
type: "actionOutput",
|
|
2013
|
+
schema: ingestionAckOutputSchema
|
|
2014
|
+
}),
|
|
2015
|
+
performSafety: "notAllowed",
|
|
2016
|
+
perform: async (context, { connection, deleteProfiles, region, verbose, redirect }) => {
|
|
2017
|
+
const { data } = await createClient(region, connection, "fallback", context.debug.enabled).post("/engage#profile-delete", deleteProfiles, { params: {
|
|
2018
|
+
verbose,
|
|
2019
|
+
redirect
|
|
2020
|
+
} });
|
|
2021
|
+
return { data };
|
|
2022
|
+
},
|
|
2023
|
+
examplePerform: async () => deleteProfileExamplePayload,
|
|
2024
|
+
examplePayload: deleteProfileExamplePayload
|
|
2025
|
+
});
|
|
2026
|
+
//#endregion
|
|
2027
|
+
//#region src/actions/profiles/queryProfiles.ts
|
|
2028
|
+
const queryProfiles = (0, _prismatic_io_spectral.action)({
|
|
2029
|
+
display: {
|
|
2030
|
+
label: "Query Profile",
|
|
2031
|
+
description: "Query user profile data and return list of users that fit specified parameters."
|
|
2032
|
+
},
|
|
2033
|
+
inputs: queryProfilesInputs,
|
|
2034
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
2035
|
+
type: "actionOutput",
|
|
2036
|
+
schema: queryProfilesOutputSchema
|
|
2037
|
+
}),
|
|
2038
|
+
performSafety: "notAllowed",
|
|
2039
|
+
perform: async (context, { connection, regionAndDomain, project_id, workspace_id, distinct_ids, where, output_properties, pagination, cohortFilters, as_of_timestamp }) => {
|
|
2040
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, "account", context.debug.enabled).post("/engage", {
|
|
2041
|
+
distinct_ids,
|
|
2042
|
+
where,
|
|
2043
|
+
output_properties,
|
|
2044
|
+
session_id: pagination.session_id,
|
|
2045
|
+
page: pagination.page,
|
|
2046
|
+
behaviors: cohortFilters.behaviors,
|
|
2047
|
+
as_of_timestamp,
|
|
2048
|
+
filter_by_cohort: cohortFilters.filter_by_cohort,
|
|
2049
|
+
include_all_users: cohortFilters.include_all_users
|
|
2050
|
+
}, { params: {
|
|
2051
|
+
project_id,
|
|
2052
|
+
workspace_id
|
|
2053
|
+
} });
|
|
2054
|
+
return { data };
|
|
2055
|
+
},
|
|
2056
|
+
examplePerform: async () => queryProfilesExamplePayload,
|
|
2057
|
+
examplePayload: queryProfilesExamplePayload
|
|
2058
|
+
});
|
|
2059
|
+
//#endregion
|
|
2060
|
+
//#region src/actions/profiles/index.ts
|
|
2061
|
+
var profiles_default = {
|
|
2062
|
+
createProfile,
|
|
2063
|
+
deleteProfile,
|
|
2064
|
+
updateMultipleProfiles: (0, _prismatic_io_spectral.action)({
|
|
2065
|
+
display: {
|
|
2066
|
+
label: "Update Multiple Profiles",
|
|
2067
|
+
description: "Send a batch of profile updates."
|
|
2068
|
+
},
|
|
2069
|
+
inputs: updateMultipleProfilesInputs,
|
|
2070
|
+
outputSchema: (0, _prismatic_io_spectral.outputSchema)({
|
|
2071
|
+
type: "actionOutput",
|
|
2072
|
+
schema: ingestionAckOutputSchema
|
|
2073
|
+
}),
|
|
2074
|
+
performSafety: "notAllowed",
|
|
2075
|
+
perform: async (context, { connection, region, propertiesToUpdate, verbose, redirect }) => {
|
|
2076
|
+
const { data } = await createClient(region, connection, "fallback", context.debug.enabled).post("/engage#profile-batch-update", propertiesToUpdate, { params: {
|
|
2077
|
+
verbose,
|
|
2078
|
+
redirect
|
|
2079
|
+
} });
|
|
2080
|
+
return { data };
|
|
2081
|
+
},
|
|
2082
|
+
examplePerform: async () => updateMultipleProfilesExamplePayload,
|
|
2083
|
+
examplePayload: updateMultipleProfilesExamplePayload
|
|
2084
|
+
}),
|
|
2085
|
+
queryProfiles
|
|
2086
|
+
};
|
|
2087
|
+
//#endregion
|
|
2088
|
+
//#region src/actions/index.ts
|
|
2089
|
+
var actions_default = {
|
|
2090
|
+
...dataExport_default,
|
|
2091
|
+
...events_default,
|
|
2092
|
+
...funnels_default,
|
|
2093
|
+
...identities_default,
|
|
2094
|
+
...insights_default,
|
|
2095
|
+
...misc_default,
|
|
2096
|
+
...pipelines_default,
|
|
2097
|
+
...profiles_default
|
|
2098
|
+
};
|
|
2099
|
+
//#endregion
|
|
2100
|
+
//#region src/dataSources/funnels.ts
|
|
2101
|
+
const funnels = (0, _prismatic_io_spectral.dataSource)({
|
|
2102
|
+
display: {
|
|
2103
|
+
label: "Fetch Funnels",
|
|
2104
|
+
description: "Fetch an array of funnels"
|
|
2105
|
+
},
|
|
2106
|
+
inputs: funnelsInputs,
|
|
2107
|
+
perform: async (_context, { connection, regionAndDomain, project_id, workspace_id }) => {
|
|
2108
|
+
const { data } = await createMixpanelClient(regionAndDomain, connection, "account", false).get("/funnels/list", { params: {
|
|
2109
|
+
project_id: project_id || void 0,
|
|
2110
|
+
workspace_id: workspace_id || void 0
|
|
2111
|
+
} });
|
|
2112
|
+
if (data.length) return { result: data.map((funnel) => ({
|
|
2113
|
+
label: funnel.name,
|
|
2114
|
+
key: funnel.funnel_id.toString()
|
|
2115
|
+
})) };
|
|
2116
|
+
return { result: [] };
|
|
2117
|
+
},
|
|
2118
|
+
dataSourceType: "picklist",
|
|
2119
|
+
examplePayload: { result: [{
|
|
2120
|
+
label: "Signup funnel",
|
|
2121
|
+
key: "7509"
|
|
2122
|
+
}, {
|
|
2123
|
+
label: "Funnel tutorial",
|
|
2124
|
+
key: "9070"
|
|
2125
|
+
}] }
|
|
2126
|
+
});
|
|
2127
|
+
//#endregion
|
|
2128
|
+
//#region src/dataSources/index.ts
|
|
2129
|
+
var dataSources_default = {
|
|
2130
|
+
pipelines: (0, _prismatic_io_spectral.dataSource)({
|
|
2131
|
+
display: {
|
|
2132
|
+
label: "Fetch Pipelines",
|
|
2133
|
+
description: "Fetch an array of Pipelines"
|
|
2134
|
+
},
|
|
2135
|
+
inputs: pipelinesInputs,
|
|
2136
|
+
perform: async (_context, { connection, dataAndDomain, project_id }) => {
|
|
2137
|
+
const { data } = await createDataClient(dataAndDomain, connection, "account", false).get("/nessie/pipeline/jobs", { params: { project_id: project_id || void 0 } });
|
|
2138
|
+
if (data) {
|
|
2139
|
+
const result = [];
|
|
2140
|
+
for (const pipelineId in data) {
|
|
2141
|
+
const pipeline = data[pipelineId];
|
|
2142
|
+
result.push({
|
|
2143
|
+
label: `${pipeline.name} - PipelineId: ${pipelineId}`,
|
|
2144
|
+
key: pipeline.name
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
return { result };
|
|
2148
|
+
}
|
|
2149
|
+
return { result: [] };
|
|
2150
|
+
},
|
|
2151
|
+
dataSourceType: "picklist",
|
|
2152
|
+
examplePayload: { result: [{
|
|
2153
|
+
label: "events-daily-bigquery-monoschema - PipelineId: 9876543210",
|
|
2154
|
+
key: "events-daily-bigquery-monoschema"
|
|
2155
|
+
}, {
|
|
2156
|
+
label: "events-daily-bigquery-multischema - PipelineId: 9876543210",
|
|
2157
|
+
key: "events-daily-bigquery-multischema"
|
|
2158
|
+
}] }
|
|
2159
|
+
}),
|
|
2160
|
+
funnels
|
|
2161
|
+
};
|
|
2162
|
+
//#endregion
|
|
2163
|
+
//#region src/index.ts
|
|
2164
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
2165
|
+
key: "mixpanel",
|
|
2166
|
+
public: true,
|
|
2167
|
+
documentationUrl: "https://prismatic.io/docs/components/mixpanel/",
|
|
2168
|
+
display: {
|
|
2169
|
+
label: "Mixpanel",
|
|
2170
|
+
description: "Manage events, profiles, and analytics data in Mixpanel.",
|
|
2171
|
+
iconPath: "icon.png",
|
|
2172
|
+
category: "Application Connectors"
|
|
2173
|
+
},
|
|
2174
|
+
actions: actions_default,
|
|
2175
|
+
connections: connections_default,
|
|
2176
|
+
dataSources: dataSources_default,
|
|
2177
|
+
hooks: { error: _prismatic_io_spectral_http.handleErrors }
|
|
2178
|
+
});
|
|
2179
|
+
//#endregion
|
|
2180
|
+
//#region npm-dist/.entry.ts
|
|
2181
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
2182
|
+
//#endregion
|
|
2183
|
+
module.exports = _entry_default;
|