@inslytic/sdk-node 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +61 -0
  2. package/package.json +4 -7
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @inslytic/sdk-node
2
+
3
+ Node.js server-side SDK for [Inslytic](https://inslytic.com) — AI-powered product analytics.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @inslytic/sdk-node
9
+ ```
10
+
11
+ Requires Node.js 18+.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { InslyticNode } from "@inslytic/sdk-node";
17
+
18
+ const inslytic = new InslyticNode({ apiKey: "your-api-key" });
19
+
20
+ // Track events
21
+ inslytic.track({
22
+ eventName: "subscription_created",
23
+ userId: "user-123",
24
+ anonymousId: "anon-456",
25
+ properties: { plan: "pro" },
26
+ });
27
+
28
+ // Identify users
29
+ inslytic.identify("user-123");
30
+
31
+ // Flush pending events and shut down gracefully
32
+ await inslytic.shutdown();
33
+ ```
34
+
35
+ ## Configuration
36
+
37
+ ```ts
38
+ const inslytic = new InslyticNode({
39
+ apiKey: "your-api-key",
40
+ endpoint: "https://api.inslytic.com", // default
41
+ flushInterval: 10000, // batch flush interval in ms
42
+ maxBatchSize: 20, // max events per batch
43
+ maxRetries: 3, // retry attempts on failure
44
+ });
45
+ ```
46
+
47
+ ## API
48
+
49
+ | Method | Description |
50
+ |---|---|
51
+ | `track(event)` | Track a server-side event |
52
+ | `identify(userId, traits?)` | Track an identify event |
53
+ | `flush()` | Flush all queued events |
54
+ | `shutdown()` | Flush and stop the SDK |
55
+ | `pending` | Number of queued events |
56
+
57
+ The SDK automatically flushes on `SIGTERM` and `SIGINT` for graceful shutdown.
58
+
59
+ ## License
60
+
61
+ MIT
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@inslytic/sdk-node",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Node.js server-side SDK for Inslytic — AI-powered product analytics",
5
5
  "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/inslytic/inslytic",
9
- "directory": "packages/sdk-node"
10
- },
6
+ "homepage": "https://www.inslytic.com/docs/node-sdk",
11
7
  "keywords": [
12
8
  "analytics",
13
9
  "tracking",
@@ -33,7 +29,8 @@
33
29
  }
34
30
  },
35
31
  "files": [
36
- "dist"
32
+ "dist",
33
+ "README.md"
37
34
  ],
38
35
  "publishConfig": {
39
36
  "access": "public"