rybbit.ts 1.0.0 → 1.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.
@@ -0,0 +1,96 @@
1
+ import type { DateString, TimeZone, Filter, Bucket, Parameter, Timestamp, SortBy, Order, Mode, Dimension } from './types.js';
2
+ /** Route interfaces, used to construct URLs. */
3
+ export declare class Routes {
4
+ #private;
5
+ /**
6
+ * Create a new route constructor.
7
+ * @param base The base URL for this constructor.
8
+ */
9
+ constructor(base: URL);
10
+ /** `GET` Returns details for a specific site */
11
+ getSite(siteId: number): URL;
12
+ /** `DELETE` Permanently deletes a site and all its data. Requires admin/owner role. */
13
+ deleteSite(siteId: number): URL;
14
+ /** `PUT` Updates site configuration settings. Requires admin/owner role. */
15
+ updateSiteConfig(siteId: number): URL;
16
+ /** `GET` Returns the list of excluded IP addresses */
17
+ getExcludedIPs(siteId: number): URL;
18
+ /** `GET` Returns the list of excluded country codes */
19
+ getExcludedCountries(siteId: number): URL;
20
+ /** `GET` Returns the private link key configuration */
21
+ getPrivateLinkConfig(siteId: number): URL;
22
+ /** `POST` Generates or revokes a private link key. Requires admin/owner role. */
23
+ updatePrivateLinkConfig(siteId: number): URL;
24
+ /** `GET` Returns all organizations the authenticated user is a member of, including all members for each organization */
25
+ getMyOrganizations(): URL;
26
+ /** `POST` Creates a new site in an organization. Requires admin/owner role. */
27
+ createSite(organizationId: string): URL;
28
+ /** `GET` Returns all members of an organization with user details */
29
+ getOrganizationMembers(organizationId: string): URL;
30
+ /** `POST` Adds a user to an organization with a specified role */
31
+ addOrganizationMember(organizationId: string): URL;
32
+ /** `GET` Returns high-level analytics metrics for a site */
33
+ getOverview(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
34
+ /** `GET` Returns time-series analytics data broken down by time buckets */
35
+ getOverviewTimeSeries(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, bucket?: Bucket): URL;
36
+ /** `GET` Returns dimensional analytics broken down by a specific parameter */
37
+ getMetric(siteId: number, parameter: Parameter, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, limit?: number, page?: number): URL;
38
+ /** `GET` Returns the count of active sessions within the specified time window */
39
+ getLiveVisitors(siteId: number, minutes?: number): URL;
40
+ /** `GET` Returns a paginated list of events with cursor-based pagination */
41
+ getEvents(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, pageSize?: number, sinceTimestamp?: Timestamp, beforeTimestamp?: Timestamp): URL;
42
+ /** `GET` Returns list of unique custom event names with counts */
43
+ getEventNames(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
44
+ /** `GET` Returns property key-value pairs for a specific event */
45
+ getEventProperties(siteId: number, eventName: string, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
46
+ /** `GET` Returns outbound link clicks with occurrence counts */
47
+ getOutboundLinks(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
48
+ /** `GET` Returns unique error messages with occurrence and session counts */
49
+ getErrorNames(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number): URL;
50
+ /** `GET` Returns individual error occurrences with context and stack traces */
51
+ getErrorEvents(siteId: number, errorMessage: string, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number): URL;
52
+ /** `GET` Returns error occurrence counts over time */
53
+ getErrorTimeSeries(siteId: number, errorMessage: string, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, bucket?: Bucket): URL;
54
+ /** `GET` Returns paginated list of goals with conversion metrics */
55
+ getGoals(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, pageSize?: number, sortBy?: SortBy, order?: Order): URL;
56
+ /** `GET` Returns sessions that completed a specific goal */
57
+ getGoalSessions(siteId: number, goalId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number): URL;
58
+ /** `POST` Creates a new goal */
59
+ createGoal(siteId: number): URL;
60
+ /** `PUT` Updates an existing goal */
61
+ updateGoal(siteId: number, goalId: number): URL;
62
+ /** `DELETE` Deletes a goal */
63
+ deleteGoal(siteId: number, goalId: number): URL;
64
+ /** `GET` Returns all saved funnels for a site */
65
+ getFunnels(siteId: number): URL;
66
+ /** `GET` Analyzes funnel conversion data step-by-step */
67
+ analyzeFunnel(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
68
+ /** `GET` Returns sessions that reached or dropped at a specific funnel step */
69
+ getFunnelStepSessions(siteId: number, stepNumber: number, mode: Mode, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number): URL;
70
+ /** `POST` Creates a saved funnel */
71
+ createFunnel(siteId: number): URL;
72
+ /** `DELETE` Deletes a saved funnel */
73
+ deleteFunnel(siteId: number, funnelId: number): URL;
74
+ /** `GET` Returns aggregate Core Web Vitals metrics */
75
+ getPerformanceOverview(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
76
+ /** `GET` Returns performance metrics over time */
77
+ getPerformanceTimeSeries(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, bucket?: Bucket): URL;
78
+ /** `GET` Returns performance breakdown by dimension */
79
+ getPerformanceByDimension(siteId: number, dimension: Dimension, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number, sortBy?: SortBy, sortOrder?: Order): URL;
80
+ /** `GET` Returns a paginated list of sessions */
81
+ getSessions(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, limit?: number, userId?: string, identifiedOnly?: boolean): URL;
82
+ /** `GET` Returns detailed session information with events */
83
+ getSession(siteId: number, sessionId: string, limit?: number, offset?: number): URL;
84
+ /** `GET` Returns aggregated session locations for map visualization */
85
+ getSessionLocations(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>): URL;
86
+ /** `GET` Returns a paginated list of users */
87
+ getUsers(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, page?: number, pageSize?: number, sortBy?: SortBy, sortOrder?: Order, identifiedOnly?: boolean): URL;
88
+ /** `GET` Returns daily session counts for a specific user */
89
+ getUserSessionCount(siteId: number, userId: string, timezone?: TimeZone): URL;
90
+ /** `GET` Returns detailed user profile information */
91
+ getUserInfo(siteId: number, userId: string): URL;
92
+ /** `GET` Returns cohort-based retention analysis */
93
+ getRetention(siteId: number, mode?: Mode, range?: number): URL;
94
+ /** `GET` Returns most common page navigation paths */
95
+ getJourneys(siteId: number, startDate?: DateString, endDate?: DateString, timezone?: TimeZone, filters?: Array<Filter>, steps?: number, limit?: number): URL;
96
+ }
@@ -1,118 +1,81 @@
1
- import type {
2
- DateString,
3
- TimeZone,
4
- Filter,
5
- Bucket,
6
- Parameter,
7
- Timestamp,
8
- SortBy,
9
- Order,
10
- Mode,
11
- Dimension
12
- } from './types.js';
13
-
14
1
  /** Route interfaces, used to construct URLs. */
15
2
  export class Routes {
16
3
  /** Base URL for this route constructor. */
17
- #base: URL;
18
-
4
+ #base;
19
5
  /**
20
6
  * Create a new route constructor.
21
7
  * @param base The base URL for this constructor.
22
8
  */
23
- constructor(base: URL) {
9
+ constructor(base) {
24
10
  this.#base = base;
25
11
  }
26
-
27
12
  /**
28
13
  * Create a URL.
29
14
  * @param path The path of this URL.
30
15
  * @param queries The queries for this URL.
31
16
  * @returns The created URL.
32
17
  */
33
- #create(path: string, queries?: Record<string, string | undefined>): URL {
18
+ #create(path, queries) {
34
19
  const url = new URL(`${this.#base.origin}${path}`);
35
-
36
20
  if (queries) {
37
21
  const search = url.searchParams;
38
22
  for (const [name, value] of Object.entries(queries)) {
39
- if (value === undefined) continue;
23
+ if (value === undefined)
24
+ continue;
40
25
  search.set(name, value);
41
26
  }
42
27
  }
43
-
44
28
  return url;
45
29
  }
46
-
47
30
  // SITES
48
-
49
31
  /** `GET` Returns details for a specific site */
50
- getSite(siteId: number): URL {
32
+ getSite(siteId) {
51
33
  return this.#create(`/api/sites/${siteId}`);
52
34
  }
53
-
54
35
  /** `DELETE` Permanently deletes a site and all its data. Requires admin/owner role. */
55
- deleteSite(siteId: number): URL {
36
+ deleteSite(siteId) {
56
37
  return this.#create(`/api/sites/${siteId}`);
57
38
  }
58
-
59
39
  /** `PUT` Updates site configuration settings. Requires admin/owner role. */
60
- updateSiteConfig(siteId: number): URL {
40
+ updateSiteConfig(siteId) {
61
41
  return this.#create(`/api/sites/${siteId}/config`);
62
42
  }
63
-
64
43
  /** `GET` Returns the list of excluded IP addresses */
65
- getExcludedIPs(siteId: number): URL {
44
+ getExcludedIPs(siteId) {
66
45
  return this.#create(`/api/sites/${siteId}/excluded-ips`);
67
46
  }
68
-
69
47
  /** `GET` Returns the list of excluded country codes */
70
- getExcludedCountries(siteId: number): URL {
48
+ getExcludedCountries(siteId) {
71
49
  return this.#create(`/api/sites/${siteId}/excluded-counties`);
72
50
  }
73
-
74
51
  /** `GET` Returns the private link key configuration */
75
- getPrivateLinkConfig(siteId: number): URL {
52
+ getPrivateLinkConfig(siteId) {
76
53
  return this.#create(`/api/sites/${siteId}/private-link-config`);
77
54
  }
78
-
79
55
  /** `POST` Generates or revokes a private link key. Requires admin/owner role. */
80
- updatePrivateLinkConfig(siteId: number): URL {
56
+ updatePrivateLinkConfig(siteId) {
81
57
  return this.#create(`/api/sites/${siteId}/private-link-config`);
82
58
  }
83
-
84
59
  // ORGANIZATIONS
85
-
86
60
  /** `GET` Returns all organizations the authenticated user is a member of, including all members for each organization */
87
- getMyOrganizations(): URL {
61
+ getMyOrganizations() {
88
62
  return this.#create(`/api/organizations`);
89
63
  }
90
-
91
64
  /** `POST` Creates a new site in an organization. Requires admin/owner role. */
92
- createSite(organizationId: string): URL {
65
+ createSite(organizationId) {
93
66
  return this.#create(`/api/organizations/${organizationId}/sites`);
94
67
  }
95
-
96
68
  /** `GET` Returns all members of an organization with user details */
97
- getOrganizationMembers(organizationId: string): URL {
69
+ getOrganizationMembers(organizationId) {
98
70
  return this.#create(`/api/organizations/${organizationId}/members`);
99
71
  }
100
-
101
72
  /** `POST` Adds a user to an organization with a specified role */
102
- addOrganizationMember(organizationId: string): URL {
73
+ addOrganizationMember(organizationId) {
103
74
  return this.#create(`/api/organizations/${organizationId}/members`);
104
75
  }
105
-
106
76
  // OVERVIEW
107
-
108
77
  /** `GET` Returns high-level analytics metrics for a site */
109
- getOverview(
110
- siteId: number,
111
- startDate?: DateString,
112
- endDate?: DateString,
113
- timezone?: TimeZone,
114
- filters?: Array<Filter>
115
- ): URL {
78
+ getOverview(siteId, startDate, endDate, timezone, filters) {
116
79
  return this.#create(`/api/sites/${siteId}/overview`, {
117
80
  start_date: startDate,
118
81
  end_date: endDate,
@@ -120,16 +83,8 @@ export class Routes {
120
83
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
121
84
  });
122
85
  }
123
-
124
86
  /** `GET` Returns time-series analytics data broken down by time buckets */
125
- getOverviewTimeSeries(
126
- siteId: number,
127
- startDate?: DateString,
128
- endDate?: DateString,
129
- timezone?: TimeZone,
130
- filters?: Array<Filter>,
131
- bucket?: Bucket
132
- ): URL {
87
+ getOverviewTimeSeries(siteId, startDate, endDate, timezone, filters, bucket) {
133
88
  return this.#create(`/api/sites/${siteId}/overview-bucketed`, {
134
89
  start_date: startDate,
135
90
  end_date: endDate,
@@ -138,18 +93,8 @@ export class Routes {
138
93
  bucket: bucket
139
94
  });
140
95
  }
141
-
142
96
  /** `GET` Returns dimensional analytics broken down by a specific parameter */
143
- getMetric(
144
- siteId: number,
145
- parameter: Parameter,
146
- startDate?: DateString,
147
- endDate?: DateString,
148
- timezone?: TimeZone,
149
- filters?: Array<Filter>,
150
- limit?: number,
151
- page?: number
152
- ): URL {
97
+ getMetric(siteId, parameter, startDate, endDate, timezone, filters, limit, page) {
153
98
  return this.#create(`/api/sites/${siteId}/metric`, {
154
99
  start_date: startDate,
155
100
  end_date: endDate,
@@ -160,27 +105,15 @@ export class Routes {
160
105
  page: page?.toString()
161
106
  });
162
107
  }
163
-
164
108
  /** `GET` Returns the count of active sessions within the specified time window */
165
- getLiveVisitors(siteId: number, minutes?: number): URL {
109
+ getLiveVisitors(siteId, minutes) {
166
110
  return this.#create(`/api/sites/${siteId}/live-user-count`, {
167
111
  minutes: minutes?.toString()
168
112
  });
169
113
  }
170
-
171
114
  // EVENTS
172
-
173
115
  /** `GET` Returns a paginated list of events with cursor-based pagination */
174
- getEvents(
175
- siteId: number,
176
- startDate?: DateString,
177
- endDate?: DateString,
178
- timezone?: TimeZone,
179
- filters?: Array<Filter>,
180
- pageSize?: number,
181
- sinceTimestamp?: Timestamp,
182
- beforeTimestamp?: Timestamp
183
- ): URL {
116
+ getEvents(siteId, startDate, endDate, timezone, filters, pageSize, sinceTimestamp, beforeTimestamp) {
184
117
  return this.#create(`/api/sites/${siteId}/events`, {
185
118
  start_date: startDate,
186
119
  end_date: endDate,
@@ -191,15 +124,8 @@ export class Routes {
191
124
  before_timestamp: beforeTimestamp
192
125
  });
193
126
  }
194
-
195
127
  /** `GET` Returns list of unique custom event names with counts */
196
- getEventNames(
197
- siteId: number,
198
- startDate?: DateString,
199
- endDate?: DateString,
200
- timezone?: TimeZone,
201
- filters?: Array<Filter>
202
- ): URL {
128
+ getEventNames(siteId, startDate, endDate, timezone, filters) {
203
129
  return this.#create(`/api/sites/${siteId}/events/names`, {
204
130
  start_date: startDate,
205
131
  end_date: endDate,
@@ -207,16 +133,8 @@ export class Routes {
207
133
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
208
134
  });
209
135
  }
210
-
211
136
  /** `GET` Returns property key-value pairs for a specific event */
212
- getEventProperties(
213
- siteId: number,
214
- eventName: string,
215
- startDate?: DateString,
216
- endDate?: DateString,
217
- timezone?: TimeZone,
218
- filters?: Array<Filter>
219
- ): URL {
137
+ getEventProperties(siteId, eventName, startDate, endDate, timezone, filters) {
220
138
  return this.#create(`/api/sites/${siteId}/events/properties`, {
221
139
  start_date: startDate,
222
140
  end_date: endDate,
@@ -225,15 +143,8 @@ export class Routes {
225
143
  event_name: eventName
226
144
  });
227
145
  }
228
-
229
146
  /** `GET` Returns outbound link clicks with occurrence counts */
230
- getOutboundLinks(
231
- siteId: number,
232
- startDate?: DateString,
233
- endDate?: DateString,
234
- timezone?: TimeZone,
235
- filters?: Array<Filter>
236
- ): URL {
147
+ getOutboundLinks(siteId, startDate, endDate, timezone, filters) {
237
148
  return this.#create(`/api/sites/${siteId}/events/outbound`, {
238
149
  start_date: startDate,
239
150
  end_date: endDate,
@@ -241,19 +152,9 @@ export class Routes {
241
152
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
242
153
  });
243
154
  }
244
-
245
155
  // ERRORS
246
-
247
156
  /** `GET` Returns unique error messages with occurrence and session counts */
248
- getErrorNames(
249
- siteId: number,
250
- startDate?: DateString,
251
- endDate?: DateString,
252
- timezone?: TimeZone,
253
- filters?: Array<Filter>,
254
- page?: number,
255
- limit?: number
256
- ): URL {
157
+ getErrorNames(siteId, startDate, endDate, timezone, filters, page, limit) {
257
158
  return this.#create(`/api/sites/${siteId}/error-names`, {
258
159
  start_date: startDate,
259
160
  end_date: endDate,
@@ -263,18 +164,8 @@ export class Routes {
263
164
  limit: limit?.toString()
264
165
  });
265
166
  }
266
-
267
167
  /** `GET` Returns individual error occurrences with context and stack traces */
268
- getErrorEvents(
269
- siteId: number,
270
- errorMessage: string,
271
- startDate?: DateString,
272
- endDate?: DateString,
273
- timezone?: TimeZone,
274
- filters?: Array<Filter>,
275
- page?: number,
276
- limit?: number
277
- ): URL {
168
+ getErrorEvents(siteId, errorMessage, startDate, endDate, timezone, filters, page, limit) {
278
169
  return this.#create(`/api/sites/${siteId}/error-events`, {
279
170
  start_date: startDate,
280
171
  end_date: endDate,
@@ -285,17 +176,8 @@ export class Routes {
285
176
  errorMessage: errorMessage
286
177
  });
287
178
  }
288
-
289
179
  /** `GET` Returns error occurrence counts over time */
290
- getErrorTimeSeries(
291
- siteId: number,
292
- errorMessage: string,
293
- startDate?: DateString,
294
- endDate?: DateString,
295
- timezone?: TimeZone,
296
- filters?: Array<Filter>,
297
- bucket?: Bucket
298
- ): URL {
180
+ getErrorTimeSeries(siteId, errorMessage, startDate, endDate, timezone, filters, bucket) {
299
181
  return this.#create(`/api/sites/${siteId}/error-bucketed`, {
300
182
  start_date: startDate,
301
183
  end_date: endDate,
@@ -305,21 +187,9 @@ export class Routes {
305
187
  errorMessage: errorMessage
306
188
  });
307
189
  }
308
-
309
190
  // GOALS
310
-
311
191
  /** `GET` Returns paginated list of goals with conversion metrics */
312
- getGoals(
313
- siteId: number,
314
- startDate?: DateString,
315
- endDate?: DateString,
316
- timezone?: TimeZone,
317
- filters?: Array<Filter>,
318
- page?: number,
319
- pageSize?: number,
320
- sortBy?: SortBy,
321
- order?: Order
322
- ): URL {
192
+ getGoals(siteId, startDate, endDate, timezone, filters, page, pageSize, sortBy, order) {
323
193
  return this.#create(`/api/sites/${siteId}/goals`, {
324
194
  start_date: startDate,
325
195
  end_date: endDate,
@@ -331,18 +201,8 @@ export class Routes {
331
201
  order: order
332
202
  });
333
203
  }
334
-
335
204
  /** `GET` Returns sessions that completed a specific goal */
336
- getGoalSessions(
337
- siteId: number,
338
- goalId: number,
339
- startDate?: DateString,
340
- endDate?: DateString,
341
- timezone?: TimeZone,
342
- filters?: Array<Filter>,
343
- page?: number,
344
- limit?: number
345
- ): URL {
205
+ getGoalSessions(siteId, goalId, startDate, endDate, timezone, filters, page, limit) {
346
206
  return this.#create(`/api/sites/${siteId}/goals/${goalId}/sessions`, {
347
207
  start_date: startDate,
348
208
  end_date: endDate,
@@ -352,37 +212,25 @@ export class Routes {
352
212
  limit: limit?.toString()
353
213
  });
354
214
  }
355
-
356
215
  /** `POST` Creates a new goal */
357
- createGoal(siteId: number): URL {
216
+ createGoal(siteId) {
358
217
  return this.#create(`/api/sites/${siteId}/goals`);
359
218
  }
360
-
361
219
  /** `PUT` Updates an existing goal */
362
- updateGoal(siteId: number, goalId: number): URL {
220
+ updateGoal(siteId, goalId) {
363
221
  return this.#create(`/api/sites/${siteId}/goals/${goalId}`);
364
222
  }
365
-
366
223
  /** `DELETE` Deletes a goal */
367
- deleteGoal(siteId: number, goalId: number): URL {
224
+ deleteGoal(siteId, goalId) {
368
225
  return this.#create(`/api/sites/${siteId}/goals/${goalId}`);
369
226
  }
370
-
371
227
  // FUNNELS
372
-
373
228
  /** `GET` Returns all saved funnels for a site */
374
- getFunnels(siteId: number): URL {
229
+ getFunnels(siteId) {
375
230
  return this.#create(`/api/sites/${siteId}/funnels`);
376
231
  }
377
-
378
232
  /** `GET` Analyzes funnel conversion data step-by-step */
379
- analyzeFunnel(
380
- siteId: number,
381
- startDate?: DateString,
382
- endDate?: DateString,
383
- timezone?: TimeZone,
384
- filters?: Array<Filter>
385
- ): URL {
233
+ analyzeFunnel(siteId, startDate, endDate, timezone, filters) {
386
234
  return this.#create(`/api/sites/${siteId}/funnels/analyze`, {
387
235
  start_date: startDate,
388
236
  end_date: endDate,
@@ -390,19 +238,8 @@ export class Routes {
390
238
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
391
239
  });
392
240
  }
393
-
394
241
  /** `GET` Returns sessions that reached or dropped at a specific funnel step */
395
- getFunnelStepSessions(
396
- siteId: number,
397
- stepNumber: number,
398
- mode: Mode,
399
- startDate?: DateString,
400
- endDate?: DateString,
401
- timezone?: TimeZone,
402
- filters?: Array<Filter>,
403
- page?: number,
404
- limit?: number
405
- ): URL {
242
+ getFunnelStepSessions(siteId, stepNumber, mode, startDate, endDate, timezone, filters, page, limit) {
406
243
  return this.#create(`/api/sites/${siteId}/funnels/${stepNumber}/sessions`, {
407
244
  start_date: startDate,
408
245
  end_date: endDate,
@@ -413,27 +250,17 @@ export class Routes {
413
250
  limit: limit?.toString()
414
251
  });
415
252
  }
416
-
417
253
  /** `POST` Creates a saved funnel */
418
- createFunnel(siteId: number): URL {
254
+ createFunnel(siteId) {
419
255
  return this.#create(`/api/sites/${siteId}/funnels`);
420
256
  }
421
-
422
257
  /** `DELETE` Deletes a saved funnel */
423
- deleteFunnel(siteId: number, funnelId: number): URL {
258
+ deleteFunnel(siteId, funnelId) {
424
259
  return this.#create(`/api/sites/${siteId}/funnels/${funnelId}`);
425
260
  }
426
-
427
261
  // PERFORMANCE
428
-
429
262
  /** `GET` Returns aggregate Core Web Vitals metrics */
430
- getPerformanceOverview(
431
- siteId: number,
432
- startDate?: DateString,
433
- endDate?: DateString,
434
- timezone?: TimeZone,
435
- filters?: Array<Filter>
436
- ): URL {
263
+ getPerformanceOverview(siteId, startDate, endDate, timezone, filters) {
437
264
  return this.#create(`/api/sites/${siteId}/performance/overview`, {
438
265
  start_date: startDate,
439
266
  end_date: endDate,
@@ -441,16 +268,8 @@ export class Routes {
441
268
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
442
269
  });
443
270
  }
444
-
445
271
  /** `GET` Returns performance metrics over time */
446
- getPerformanceTimeSeries(
447
- siteId: number,
448
- startDate?: DateString,
449
- endDate?: DateString,
450
- timezone?: TimeZone,
451
- filters?: Array<Filter>,
452
- bucket?: Bucket
453
- ): URL {
272
+ getPerformanceTimeSeries(siteId, startDate, endDate, timezone, filters, bucket) {
454
273
  return this.#create(`/api/sites/${siteId}/performance/time-series`, {
455
274
  start_date: startDate,
456
275
  end_date: endDate,
@@ -459,20 +278,8 @@ export class Routes {
459
278
  bucket: bucket
460
279
  });
461
280
  }
462
-
463
281
  /** `GET` Returns performance breakdown by dimension */
464
- getPerformanceByDimension(
465
- siteId: number,
466
- dimension: Dimension,
467
- startDate?: DateString,
468
- endDate?: DateString,
469
- timezone?: TimeZone,
470
- filters?: Array<Filter>,
471
- page?: number,
472
- limit?: number,
473
- sortBy?: SortBy,
474
- sortOrder?: Order
475
- ): URL {
282
+ getPerformanceByDimension(siteId, dimension, startDate, endDate, timezone, filters, page, limit, sortBy, sortOrder) {
476
283
  return this.#create(`/api/sites/${siteId}/performance/by-dimension`, {
477
284
  start_date: startDate,
478
285
  end_date: endDate,
@@ -485,21 +292,9 @@ export class Routes {
485
292
  sort_order: sortOrder
486
293
  });
487
294
  }
488
-
489
295
  // SESSIONS
490
-
491
296
  /** `GET` Returns a paginated list of sessions */
492
- getSessions(
493
- siteId: number,
494
- startDate?: DateString,
495
- endDate?: DateString,
496
- timezone?: TimeZone,
497
- filters?: Array<Filter>,
498
- page?: number,
499
- limit?: number,
500
- userId?: string,
501
- identifiedOnly?: boolean
502
- ): URL {
297
+ getSessions(siteId, startDate, endDate, timezone, filters, page, limit, userId, identifiedOnly) {
503
298
  return this.#create(`/api/sites/${siteId}/sessions`, {
504
299
  start_date: startDate,
505
300
  end_date: endDate,
@@ -511,23 +306,15 @@ export class Routes {
511
306
  identified_only: identifiedOnly?.toString()
512
307
  });
513
308
  }
514
-
515
309
  /** `GET` Returns detailed session information with events */
516
- getSession(siteId: number, sessionId: string, limit?: number, offset?: number): URL {
310
+ getSession(siteId, sessionId, limit, offset) {
517
311
  return this.#create(`/api/sites/${siteId}/sessions/${sessionId}`, {
518
312
  limit: limit?.toString(),
519
313
  offset: offset?.toString()
520
314
  });
521
315
  }
522
-
523
316
  /** `GET` Returns aggregated session locations for map visualization */
524
- getSessionLocations(
525
- siteId: number,
526
- startDate?: DateString,
527
- endDate?: DateString,
528
- timezone?: TimeZone,
529
- filters?: Array<Filter>
530
- ): URL {
317
+ getSessionLocations(siteId, startDate, endDate, timezone, filters) {
531
318
  return this.#create(`/api/sites/${siteId}/session-locations`, {
532
319
  start_date: startDate,
533
320
  end_date: endDate,
@@ -535,22 +322,9 @@ export class Routes {
535
322
  filters: filters !== undefined ? JSON.stringify(filters) : undefined
536
323
  });
537
324
  }
538
-
539
325
  // USERS
540
-
541
326
  /** `GET` Returns a paginated list of users */
542
- getUsers(
543
- siteId: number,
544
- startDate?: DateString,
545
- endDate?: DateString,
546
- timezone?: TimeZone,
547
- filters?: Array<Filter>,
548
- page?: number,
549
- pageSize?: number,
550
- sortBy?: SortBy,
551
- sortOrder?: Order,
552
- identifiedOnly?: boolean
553
- ): URL {
327
+ getUsers(siteId, startDate, endDate, timezone, filters, page, pageSize, sortBy, sortOrder, identifiedOnly) {
554
328
  return this.#create(`/api/sites/${siteId}/users`, {
555
329
  start_date: startDate,
556
330
  end_date: endDate,
@@ -563,40 +337,27 @@ export class Routes {
563
337
  identified_only: identifiedOnly?.toString()
564
338
  });
565
339
  }
566
-
567
340
  /** `GET` Returns daily session counts for a specific user */
568
- getUserSessionCount(siteId: number, userId: string, timezone?: TimeZone): URL {
341
+ getUserSessionCount(siteId, userId, timezone) {
569
342
  return this.#create(`/api/sites/${siteId}/users/session-count`, {
570
343
  user_id: userId,
571
344
  timezone: timezone
572
345
  });
573
346
  }
574
-
575
347
  /** `GET` Returns detailed user profile information */
576
- getUserInfo(siteId: number, userId: string): URL {
348
+ getUserInfo(siteId, userId) {
577
349
  return this.#create(`/api/sites/${siteId}/users/${userId}`);
578
350
  }
579
-
580
351
  // MISC
581
-
582
352
  /** `GET` Returns cohort-based retention analysis */
583
- getRetention(siteId: number, mode?: Mode, range?: number): URL {
353
+ getRetention(siteId, mode, range) {
584
354
  return this.#create(`/api/sites/${siteId}/retention`, {
585
355
  mode: mode,
586
356
  range: range?.toString()
587
357
  });
588
358
  }
589
-
590
359
  /** `GET` Returns most common page navigation paths */
591
- getJourneys(
592
- siteId: number,
593
- startDate?: DateString,
594
- endDate?: DateString,
595
- timezone?: TimeZone,
596
- filters?: Array<Filter>,
597
- steps?: number,
598
- limit?: number
599
- ): URL {
360
+ getJourneys(siteId, startDate, endDate, timezone, filters, steps, limit) {
600
361
  return this.#create(`/api/sites/${siteId}/users`, {
601
362
  start_date: startDate,
602
363
  end_date: endDate,
@@ -607,3 +368,4 @@ export class Routes {
607
368
  });
608
369
  }
609
370
  }
371
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAaA,gDAAgD;AAChD,MAAM,OAAO,MAAM;IACf,2CAA2C;IAC3C,KAAK,CAAM;IAEX;;;OAGG;IACH,YAAY,IAAS;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAY,EAAE,OAA4C;QAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC;QAEnD,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC;YAChC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClD,IAAI,KAAK,KAAK,SAAS;oBAAE,SAAS;gBAClC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5B,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;IAED,QAAQ;IAER,gDAAgD;IAChD,OAAO,CAAC,MAAc;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,uFAAuF;IACvF,UAAU,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,4EAA4E;IAC5E,gBAAgB,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,MAAM,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,sDAAs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QAAQ,EAAE,OAAO;YACjB,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;YACpE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE;YACxB,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export type { Bucket, DateString, Dimension, Filter, FilterParameter, FilterType, Mode, Order, Parameter, SortBy, Timestamp, TimeZone } from './types.js';
2
+ export { toDateString } from './utility.js';
3
+ export { Routes } from './endpoints.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { toDateString } from './utility.js';
2
+ export { Routes } from './endpoints.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A date with the format of `year-month-day`.
3
+ * Example: `2019-02-24`
4
+ */
5
+ export type DateString = `${number}-${number}-${number}`;
6
+ /**
7
+ * An ISO 8601 formatted timestamp.
8
+ * Example: `2024-01-31T14:00:00.000Z`
9
+ */
10
+ export type Timestamp = string;
11
+ /** List of timezones. */
12
+ export type TimeZone = 'system' | 'Pacific/Honolulu' | 'America/Anchorage' | 'America/Los_Angeles' | 'America/Denver' | 'America/Chicago' | 'America/New_York' | 'America/Halifax' | 'America/Sao_Paulo' | 'Atlantic/South_Georgia' | 'Atlantic/Azores' | 'UTC' | 'Europe/London' | 'Europe/Paris' | 'Europe/Berlin' | 'Europe/Helsinki' | 'Europe/Moscow' | 'Asia/Dubai' | 'Asia/Karachi' | 'Asia/Kolkata' | 'Asia/Dhaka' | 'Asia/Bangkok' | 'Asia/Singapore' | 'Asia/Shanghai' | 'Asia/Tokyo' | 'Australia/Sydney' | 'Pacific/Auckland';
13
+ /** List of buckets. */
14
+ export type Bucket = 'minute' | 'five_minutes' | 'ten_minutes' | 'fifteen_minutes' | 'hour' | 'day' | 'week' | 'month' | 'week' | 'year';
15
+ /** List of parameters. */
16
+ export type Parameter = 'pathname' | 'page_title' | 'country' | 'region' | 'city' | 'browser' | 'operating_system' | 'device_type' | 'referrer' | 'channel' | 'utm_source' | 'utm_medium' | 'utm_campaign' | 'utm_term' | 'utm_content' | 'language' | 'entry_page' | 'exit_page' | 'event_name';
17
+ /** List of sort by choices. */
18
+ export type SortBy = 'goalId' | 'name' | 'goalType' | 'createdAt' | 'first_seen' | 'last_seen' | 'pageviews' | 'sessions' | 'events';
19
+ /** Lust of order choices. */
20
+ export type Order = 'asc' | 'desc';
21
+ /** List of modes. */
22
+ export type Mode = 'day' | 'week' | 'reached' | 'dropped';
23
+ /** List of dimensions. */
24
+ export type Dimension = 'pathname' | 'country' | 'browser' | 'operating_system' | 'device_type';
25
+ /** List of filter parameters. */
26
+ export type FilterParameter = 'country' | 'region' | 'city' | 'browser' | 'operating_system' | 'device_type' | 'pathname' | 'referrer' | 'utm_source' | 'utm_medium' | 'utm_campaign' | 'channel' | 'entry_page' | 'exit_page' | 'language';
27
+ /** List of filter types. */
28
+ export type FilterType = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'regex';
29
+ /** A filter object. */
30
+ export interface Filter {
31
+ /** {@linkcode FilterParameter Parameter} of this filter. */
32
+ parameter: FilterParameter;
33
+ /** {@linkcode FilterType Type} of filter. */
34
+ type: FilterType;
35
+ /** Values of this filter. */
36
+ value: Array<string>;
37
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,10 +1,7 @@
1
1
  import type { DateString } from './types.js';
2
-
3
2
  /**
4
3
  * Converts a {@linkcode Date} to {@linkcode DateString}.
5
4
  * @param date The {@linkcode Date} to convert.
6
5
  * @returns The converted {@linkcode DateString}.
7
6
  */
8
- export function toDateString(date: Date): DateString {
9
- return date.toISOString().split('T')[0] as DateString;
10
- }
7
+ export declare function toDateString(date: Date): DateString;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a {@linkcode Date} to {@linkcode DateString}.
3
+ * @param date The {@linkcode Date} to convert.
4
+ * @returns The converted {@linkcode DateString}.
5
+ */
6
+ export function toDateString(date) {
7
+ return date.toISOString().split('T')[0];
8
+ }
9
+ //# sourceMappingURL=utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility.js","sourceRoot":"","sources":["../src/utility.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAe,CAAC;AAC1D,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "rybbit.ts",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/jacobhumston/rybbit.ts",
9
+ "repository": {
10
+ "url": "https://github.com/jacobhumston/rybbit.ts"
11
+ },
7
12
  "scripts": {
8
13
  "format": "bunx prettier --write --cache .",
9
14
  "compile": "del dist/ && bunx tsc",
@@ -19,7 +24,7 @@
19
24
  "typescript": "^5.9.3"
20
25
  },
21
26
  "files": [
22
- "src/",
27
+ "dist/",
23
28
  "LICENSE",
24
29
  "README.md",
25
30
  "package.json"
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- export type {
2
- Bucket,
3
- DateString,
4
- Dimension,
5
- Filter,
6
- FilterParameter,
7
- FilterType,
8
- Mode,
9
- Order,
10
- Parameter,
11
- SortBy,
12
- Timestamp,
13
- TimeZone
14
- } from './types.js';
15
- export { toDateString } from './utility.js';
16
- export { Routes } from './endpoints.js';
package/src/types.ts DELETED
@@ -1,130 +0,0 @@
1
- /**
2
- * A date with the format of `year-month-day`.
3
- * Example: `2019-02-24`
4
- */
5
- export type DateString = `${number}-${number}-${number}`;
6
-
7
- /**
8
- * An ISO 8601 formatted timestamp.
9
- * Example: `2024-01-31T14:00:00.000Z`
10
- */
11
- export type Timestamp = string;
12
-
13
- /** List of timezones. */
14
- export type TimeZone =
15
- | 'system'
16
- | 'Pacific/Honolulu'
17
- | 'America/Anchorage'
18
- | 'America/Los_Angeles'
19
- | 'America/Denver'
20
- | 'America/Chicago'
21
- | 'America/New_York'
22
- | 'America/Halifax'
23
- | 'America/Sao_Paulo'
24
- | 'Atlantic/South_Georgia'
25
- | 'Atlantic/Azores'
26
- | 'UTC'
27
- | 'Europe/London'
28
- | 'Europe/Paris'
29
- | 'Europe/Berlin'
30
- | 'Europe/Helsinki'
31
- | 'Europe/Moscow'
32
- | 'Asia/Dubai'
33
- | 'Asia/Karachi'
34
- | 'Asia/Kolkata'
35
- | 'Asia/Dhaka'
36
- | 'Asia/Bangkok'
37
- | 'Asia/Singapore'
38
- | 'Asia/Shanghai'
39
- | 'Asia/Tokyo'
40
- | 'Australia/Sydney'
41
- | 'Pacific/Auckland';
42
-
43
- /** List of buckets. */
44
- export type Bucket =
45
- | 'minute'
46
- | 'five_minutes'
47
- | 'ten_minutes'
48
- | 'fifteen_minutes'
49
- | 'hour'
50
- | 'day'
51
- | 'week'
52
- | 'month'
53
- | 'week'
54
- | 'year';
55
-
56
- /** List of parameters. */
57
- export type Parameter =
58
- | 'pathname'
59
- | 'page_title'
60
- | 'country'
61
- | 'region'
62
- | 'city'
63
- | 'browser'
64
- | 'operating_system'
65
- | 'device_type'
66
- | 'referrer'
67
- | 'channel'
68
- | 'utm_source'
69
- | 'utm_medium'
70
- | 'utm_campaign'
71
- | 'utm_term'
72
- | 'utm_content'
73
- | 'language'
74
- | 'entry_page'
75
- | 'exit_page'
76
- | 'event_name';
77
-
78
- /** List of sort by choices. */
79
- export type SortBy =
80
- | 'goalId'
81
- | 'name'
82
- | 'goalType'
83
- | 'createdAt'
84
- | 'first_seen'
85
- | 'last_seen'
86
- | 'pageviews'
87
- | 'sessions'
88
- | 'events';
89
-
90
- /** Lust of order choices. */
91
- export type Order = 'asc' | 'desc';
92
-
93
- /** List of modes. */
94
- export type Mode = 'day' | 'week' | 'reached' | 'dropped';
95
-
96
- /** List of dimensions. */
97
- export type Dimension = 'pathname' | 'country' | 'browser' | 'operating_system' | 'device_type';
98
-
99
- /** List of filter parameters. */
100
- export type FilterParameter =
101
- | 'country'
102
- | 'region'
103
- | 'city'
104
- | 'browser'
105
- | 'operating_system'
106
- | 'device_type'
107
- | 'pathname'
108
- | 'referrer'
109
- | 'utm_source'
110
- | 'utm_medium'
111
- | 'utm_campaign'
112
- | 'channel'
113
- | 'entry_page'
114
- | 'exit_page'
115
- | 'language';
116
-
117
- /** List of filter types. */
118
- export type FilterType = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'regex';
119
-
120
- /** A filter object. */
121
- export interface Filter {
122
- /** {@linkcode FilterParameter Parameter} of this filter. */
123
- parameter: FilterParameter;
124
-
125
- /** {@linkcode FilterType Type} of filter. */
126
- type: FilterType;
127
-
128
- /** Values of this filter. */
129
- value: Array<string>;
130
- }