create-db 0.0.11-pr27-feat-posthog-16470238868.0 → 0.0.11-pr27-feat-posthog-16471599418.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/analytics.js +16 -12
  2. package/package.json +1 -1
package/analytics.js CHANGED
@@ -1,4 +1,4 @@
1
- import { randomUUID } from 'crypto';
1
+ import { randomUUID } from "crypto";
2
2
 
3
3
  class EventCaptureError extends Error {
4
4
  constructor(event, status) {
@@ -8,13 +8,17 @@ class EventCaptureError extends Error {
8
8
 
9
9
  class PosthogEventCapture {
10
10
  async capture(eventName, properties = {}) {
11
- const POSTHOG_CAPTURE_URL = process.env.POSTHOG_API_HOST ? process.env.POSTHOG_API_HOST + '/capture' : null
12
- const POSTHOG_KEY = process.env.POSTHOG_API_KEY
11
+ const POSTHOG_CAPTURE_URL = process.env.POSTHOG_API_HOST
12
+ ? process.env.POSTHOG_API_HOST + "/capture"
13
+ : null;
14
+ const POSTHOG_KEY = process.env.POSTHOG_API_KEY;
13
15
 
14
16
  // Skip if environment variables are not set
15
17
  if (!POSTHOG_CAPTURE_URL || !POSTHOG_KEY) {
16
- if (process.env.NODE_ENV === 'development') {
17
- console.warn('Analytics skipped: POSTHOG_API_HOST or POSTHOG_API_KEY not set');
18
+ if (process.env.NODE_ENV === "development") {
19
+ console.warn(
20
+ "Analytics skipped: POSTHOG_API_HOST or POSTHOG_API_KEY not set"
21
+ );
18
22
  }
19
23
  return;
20
24
  }
@@ -25,15 +29,15 @@ class PosthogEventCapture {
25
29
  distinct_id: randomUUID(),
26
30
  properties: {
27
31
  $process_person_profile: false,
28
- ...properties
29
- }
32
+ ...properties,
33
+ },
30
34
  };
31
35
 
32
36
  try {
33
37
  const response = await fetch(POSTHOG_CAPTURE_URL, {
34
- method: 'POST',
38
+ method: "POST",
35
39
  headers: {
36
- 'Content-Type': 'application/json',
40
+ "Content-Type": "application/json",
37
41
  },
38
42
  body: JSON.stringify(payload),
39
43
  });
@@ -43,8 +47,8 @@ class PosthogEventCapture {
43
47
  }
44
48
  } catch (error) {
45
49
  // Silently fail analytics to not disrupt user experience
46
- if (process.env.NODE_ENV === 'development') {
47
- console.error('Analytics error:', error.message);
50
+ if (process.env.NODE_ENV === "development") {
51
+ console.error("Analytics error:", error.message);
48
52
  }
49
53
  }
50
54
  }
@@ -53,4 +57,4 @@ class PosthogEventCapture {
53
57
  // Create a singleton instance
54
58
  const analytics = new PosthogEventCapture();
55
59
 
56
- export { analytics, EventCaptureError };
60
+ export { analytics, EventCaptureError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-db",
3
- "version": "0.0.11-pr27-feat-posthog-16470238868.0",
3
+ "version": "0.0.11-pr27-feat-posthog-16471599418.0",
4
4
  "description": "Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.",
5
5
  "main": "index.js",
6
6
  "author": "",