@codaco/analytics 0.0.1 → 1.0.0-alpha

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @codaco/analytics@0.0.1 build /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics
2
+ > @codaco/analytics@1.0.0-alpha build /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics
3
3
  > tsup src/index.ts --format cjs,esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@ CLI tsup v7.2.0
8
8
  CLI Target: es2022
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/index.mjs 958.00 B
12
- ESM ⚡️ Build success in 33ms
13
- CJS dist/index.js 1.95 KB
14
- CJS ⚡️ Build success in 34ms
11
+ CJS dist/index.js 1.94 KB
12
+ CJS ⚡️ Build success in 66ms
13
+ ESM dist/index.mjs 950.00 B
14
+ ESM ⚡️ Build success in 65ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 578ms
16
+ DTS ⚡️ Build success in 726ms
17
17
  DTS dist/index.d.ts 583.00 B
18
18
  DTS dist/index.d.mts 583.00 B
@@ -1,5 +1,5 @@
1
1
 
2
- > @codaco/analytics@0.0.1 lint /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics
2
+ > @codaco/analytics@1.0.0-alpha lint /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics
3
3
  > eslint .
4
4
 
5
5
  Pages directory cannot be found at /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics/pages or /Users/buckhalt/Code/complexdatacollective/error-analytics-microservice/packages/analytics/src/pages. If using a custom path, please configure with the `no-html-link-for-pages` rule in your eslint config file.
package/dist/index.js CHANGED
@@ -25,14 +25,14 @@ __export(src_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(src_exports);
27
27
  async function trackEvent(event) {
28
- const endpoint = "localhost:3000/api/event";
28
+ const endpoint = "http://localhost:3000/api/event";
29
29
  try {
30
30
  const response = await fetch(endpoint, {
31
31
  method: "POST",
32
32
  headers: {
33
33
  "Content-Type": "application/json"
34
34
  },
35
- body: JSON.stringify({ event })
35
+ body: JSON.stringify(event)
36
36
  });
37
37
  if (!response.ok) {
38
38
  throw new Error(`HTTP error! Status: ${response.status}`);
@@ -42,14 +42,14 @@ async function trackEvent(event) {
42
42
  }
43
43
  }
44
44
  async function trackError(error) {
45
- const endpoint = "localhost:3000/api/error";
45
+ const endpoint = "http://localhost:3000/api/error";
46
46
  try {
47
47
  const response = await fetch(endpoint, {
48
48
  method: "POST",
49
49
  headers: {
50
50
  "Content-Type": "application/json"
51
51
  },
52
- body: JSON.stringify({ errorPayload: error })
52
+ body: JSON.stringify(error)
53
53
  });
54
54
  if (!response.ok) {
55
55
  throw new Error(`HTTP error! Status: ${response.status}`);
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  // src/index.ts
2
2
  async function trackEvent(event) {
3
- const endpoint = "localhost:3000/api/event";
3
+ const endpoint = "http://localhost:3000/api/event";
4
4
  try {
5
5
  const response = await fetch(endpoint, {
6
6
  method: "POST",
7
7
  headers: {
8
8
  "Content-Type": "application/json"
9
9
  },
10
- body: JSON.stringify({ event })
10
+ body: JSON.stringify(event)
11
11
  });
12
12
  if (!response.ok) {
13
13
  throw new Error(`HTTP error! Status: ${response.status}`);
@@ -17,14 +17,14 @@ async function trackEvent(event) {
17
17
  }
18
18
  }
19
19
  async function trackError(error) {
20
- const endpoint = "localhost:3000/api/error";
20
+ const endpoint = "http://localhost:3000/api/error";
21
21
  try {
22
22
  const response = await fetch(endpoint, {
23
23
  method: "POST",
24
24
  headers: {
25
25
  "Content-Type": "application/json"
26
26
  },
27
- body: JSON.stringify({ errorPayload: error })
27
+ body: JSON.stringify(error)
28
28
  });
29
29
  if (!response.ok) {
30
30
  throw new Error(`HTTP error! Status: ${response.status}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codaco/analytics",
3
- "version": "0.0.1",
3
+ "version": "1.0.0-alpha",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -16,11 +16,12 @@
16
16
  "@types/react-dom": "^18.2.0",
17
17
  "react": "^18.2.0",
18
18
  "typescript": "^5.2.2",
19
- "tsconfig": "0.0.0",
20
- "eslint-config-custom": "0.0.0"
19
+ "eslint-config-custom": "0.0.0",
20
+ "tsconfig": "0.0.0"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsup src/index.ts --format cjs,esm --dts",
24
- "lint": "eslint ."
24
+ "lint": "eslint .",
25
+ "dev": "npm run build -- --watch"
25
26
  }
26
27
  }
package/src/index.ts CHANGED
@@ -21,14 +21,15 @@ export type ErrorPayload = {
21
21
  };
22
22
 
23
23
  export async function trackEvent(event: EventPayload) {
24
- const endpoint = "localhost:3000/api/event";
24
+ const endpoint = "http://localhost:3000/api/event";
25
+
25
26
  try {
26
27
  const response = await fetch(endpoint, {
27
28
  method: "POST",
28
29
  headers: {
29
30
  "Content-Type": "application/json",
30
31
  },
31
- body: JSON.stringify({ event: event }),
32
+ body: JSON.stringify(event),
32
33
  });
33
34
 
34
35
  if (!response.ok) {
@@ -40,14 +41,14 @@ export async function trackEvent(event: EventPayload) {
40
41
  }
41
42
 
42
43
  export async function trackError(error: ErrorPayload) {
43
- const endpoint = "localhost:3000/api/error";
44
+ const endpoint = "http://localhost:3000/api/error";
44
45
  try {
45
46
  const response = await fetch(endpoint, {
46
47
  method: "POST",
47
48
  headers: {
48
49
  "Content-Type": "application/json",
49
50
  },
50
- body: JSON.stringify({ errorPayload: error }),
51
+ body: JSON.stringify(error),
51
52
  });
52
53
 
53
54
  if (!response.ok) {