@entrolytics/api-client 2.2.0 → 2.2.2
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 +52 -58
- package/package.json +34 -30
- package/dist/index.cjs +0 -1609
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1932
- package/dist/index.d.ts +0 -1932
- package/dist/index.js +0 -1554
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,85 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ⚠️ DEPRECATED
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**This package is deprecated in favor of [`@entrolytics/trpc-client`](../trpc/).**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The new tRPC client provides:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
yarn add @entrolytics/api-client
|
|
13
|
-
```
|
|
7
|
+
- ✅ Full end-to-end type safety
|
|
8
|
+
- ✅ Auto-completion for all API methods
|
|
9
|
+
- ✅ Automatic request batching
|
|
10
|
+
- ✅ Better error handling
|
|
11
|
+
- ✅ Same functionality, better DX
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Migration Guide
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
import { EntrolyticsClient } from '@entrolytics/api-client';
|
|
15
|
+
### Installation
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
apiKey: 'your-api-key',
|
|
22
|
-
apiUrl: 'https://api.entrolytics.click', // optional
|
|
23
|
-
});
|
|
17
|
+
```bash
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
await client.track({
|
|
27
|
-
websiteId: 'your-website-id',
|
|
28
|
-
event: 'pageview',
|
|
29
|
-
url: 'https://example.com/page',
|
|
30
|
-
properties: {
|
|
31
|
-
customProperty: 'value',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
19
|
+
# Remove old client
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
21
|
+
npm uninstall @entrolytics/api-client
|
|
22
|
+
|
|
23
|
+
# Install new client
|
|
24
|
+
|
|
25
|
+
npm install @entrolytics/trpc-client
|
|
41
26
|
```
|
|
42
27
|
|
|
43
|
-
|
|
28
|
+
### Usage Changes
|
|
44
29
|
|
|
45
|
-
|
|
46
|
-
- 📊 Full analytics API coverage
|
|
47
|
-
- 🚀 Promise-based async/await
|
|
48
|
-
- ⚡ Automatic retry logic
|
|
49
|
-
- 🔄 Request/response interceptors
|
|
50
|
-
- 📝 TypeScript definitions included
|
|
30
|
+
**Before (REST Client)**:
|
|
51
31
|
|
|
52
|
-
|
|
32
|
+
```typescript
|
|
33
|
+
import { EntrolyticsClient } from "@entrolytics/api-client";
|
|
53
34
|
|
|
54
|
-
|
|
35
|
+
const client = new EntrolyticsClient({
|
|
36
|
+
apiUrl: "https://api.entrolytics.click",
|
|
37
|
+
apiKey: "your-key",
|
|
38
|
+
});
|
|
55
39
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- `timeout` (number, optional): Request timeout in ms (default: 5000)
|
|
59
|
-
- `retries` (number, optional): Number of retries on failure (default: 3)
|
|
40
|
+
const websites = await client.websites.list();
|
|
41
|
+
```
|
|
60
42
|
|
|
61
|
-
|
|
43
|
+
**After (tRPC Client)**:
|
|
62
44
|
|
|
63
|
-
|
|
45
|
+
```typescript
|
|
46
|
+
import { createClient } from "@entrolytics/trpc-client";
|
|
64
47
|
|
|
65
|
-
|
|
48
|
+
const client = createClient({
|
|
49
|
+
apiUrl: "https://api.entrolytics.click",
|
|
50
|
+
apiKey: "your-key",
|
|
51
|
+
});
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
const websites = await client.websites.list.query();
|
|
54
|
+
```
|
|
68
55
|
|
|
69
|
-
|
|
56
|
+
### Key Differences
|
|
70
57
|
|
|
71
|
-
|
|
58
|
+
1. **Query/Mutation Pattern**: tRPC uses `.query()` for reads and `.mutate()` for writes
|
|
59
|
+
2. **Type Safety**: All types are automatically inferred from the backend
|
|
60
|
+
3. **Error Handling**: Errors are typed and more predictable
|
|
72
61
|
|
|
73
|
-
|
|
62
|
+
### API Mapping
|
|
74
63
|
|
|
75
|
-
|
|
64
|
+
| Old Method | New Method |
|
|
65
|
+
| ----------------------------------- | ----------------------------------------- |
|
|
66
|
+
| `client.websites.list()` | `client.websites.list.query()` |
|
|
67
|
+
| `client.websites.create(data)` | `client.websites.create.mutate(data)` |
|
|
68
|
+
| `client.analytics.overview(params)` | `client.analytics.overview.query(params)` |
|
|
69
|
+
| `client.events.list(params)` | `client.events.list.query(params)` |
|
|
76
70
|
|
|
77
|
-
|
|
71
|
+
See the [full tRPC client documentation](../trpc/README.md) for complete migration details.
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
---
|
|
80
74
|
|
|
81
|
-
|
|
75
|
+
# @entrolytics/api-client (Legacy)
|
|
82
76
|
|
|
83
|
-
|
|
77
|
+
REST API client for Entrolytics (no longer maintained).
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
For new projects, use [`@entrolytics/trpc-client`](../trpc/) instead.
|
package/package.json
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entrolytics/api-client",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "TypeScript API client for Entrolytics - First-party growth analytics for the edge",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"analytics",
|
|
7
|
+
"api",
|
|
8
|
+
"client",
|
|
9
|
+
"entrolytics",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/entrolytics/api-client.git",
|
|
16
|
+
"directory": "packages/api"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
5
22
|
"type": "module",
|
|
6
23
|
"main": "./dist/index.cjs",
|
|
7
24
|
"module": "./dist/index.js",
|
|
@@ -18,37 +35,24 @@
|
|
|
18
35
|
}
|
|
19
36
|
}
|
|
20
37
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist",
|
|
23
|
-
"README.md"
|
|
24
|
-
],
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@biomejs/biome": "^2.3.11",
|
|
27
|
-
"@types/node": "^25.0.3",
|
|
28
|
-
"tsup": "^8.5.1",
|
|
29
|
-
"typescript": "^5.9.3"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [
|
|
32
|
-
"entrolytics",
|
|
33
|
-
"analytics",
|
|
34
|
-
"api",
|
|
35
|
-
"client",
|
|
36
|
-
"typescript"
|
|
37
|
-
],
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/entrolytics/api-client.git",
|
|
41
|
-
"directory": "packages/api"
|
|
42
|
-
},
|
|
43
|
-
"license": "MIT",
|
|
44
38
|
"dependencies": {
|
|
45
|
-
"@entrolytics/shared": "^2.
|
|
39
|
+
"@entrolytics/shared": "^2.4.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.9.1",
|
|
43
|
+
"typescript": "^6.0.3",
|
|
44
|
+
"vite": "^8.0.15",
|
|
45
|
+
"vite-plus": "^0.1.23"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
48
|
+
"build": "vp pack",
|
|
49
|
+
"check": "vp check",
|
|
50
|
+
"dev": "vp pack --watch",
|
|
51
|
+
"lint": "vp lint --fix . && vp fmt --write .",
|
|
52
|
+
"lint:check": "vp lint . && vp fmt --check .",
|
|
53
|
+
"lint:fix-unsafe": "vp lint -f stylish --import-plugin --type-aware --type-check --vitest-plugin --fix --fix-suggestions --fix-dangerously .",
|
|
54
|
+
"format": "vp fmt --write .",
|
|
55
|
+
"test": "vp test run",
|
|
56
|
+
"typecheck": "tsgo --noEmit"
|
|
53
57
|
}
|
|
54
58
|
}
|