You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: remove trailing comma in package.json for valid JSON
* refactor: replace SDKServerSide with Formo client in analytics and event queue
* feat: Replace Stainless SDK client with direct HTTP event submission and introduce new internal event types.
* tests: Consolidate integration tests for track/identify and batching
* fix: Update test script paths from `src/` to `test/` directory.
* docs: Remove Stainless SDK generation details and enhance testing instructions and README examples.
* fix: Update Authorization header from Basic to Bearer in event queue and its tests.
This project uses [Stainless](https://www.stainless.com/) to generate type-safe API clients from our OpenAPI specification. The generated code lives in `sdks/sdk-server-side-typescript/`.
59
-
60
-
### Initial Setup
61
-
62
-
If you need to set up Stainless for the first time:
63
-
64
-
1.**Install the Stainless CLI:**
65
-
66
-
```bash
67
-
brew install stainless-api/tap/stl
68
-
```
69
-
70
-
2.**Initialize Stainless in your project:**
71
-
72
-
```bash
73
-
stl init
74
-
```
53
+
## Making Changes
75
54
76
-
During initialization, you'll be prompted to:
55
+
The core SDK logic in `src/` is manually maintained.
77
56
78
-
- Select your OpenAPI specification file (`openapi.json`)
79
-
- Choose the target language(s) (TypeScript for this project)
80
-
- Configure output directories
57
+
Key components:
81
58
82
-
3.**Configuration files:**
59
+
-`FormoAnalytics.ts`: Main entry point and public API.
60
+
-`queue/`: Handles event buffering, batching, and retrying.
61
+
-`types/`: Use this for all shared interfaces and types.
83
62
84
-
The `.stainless/` directory is included in the repository and contains:
63
+
When making changes:
85
64
86
-
-`stainless.yml` - Main configuration file for SDK generation
87
-
-`workspace.json` - Workspace settings
65
+
1. Create a feature branch from `main`.
66
+
2. Make your changes with appropriate tests.
67
+
3. Ensure all unit tests pass: `npm test`.
68
+
4. If modifying API interactions, verify with integration tests (see below).
69
+
5. Submit a pull request.
88
70
89
-
Commit any changes to these files to ensure all contributors stay in sync.
71
+
## Running Tests
90
72
91
-
### Regenerating the SDK
73
+
### Unit Tests
92
74
93
-
When the OpenAPI specification (`openapi.json`) or Stainless configuration (`.stainless/stainless.yml`) is updated, you need to regenerate the SDK:
7. Review and commit the regenerated SDK files in `sdks/sdk-server-side-typescript/`
131
-
132
-
## Making Changes
91
+
```bash
92
+
FORMO_WRITE_KEY=your-key npm run test:integration
93
+
```
133
94
134
-
### Main SDK Code (`src/`)
95
+
### Manual Testing Script
135
96
136
-
The core SDK logic in `src/` is manually maintained:
97
+
To verify functionality with a real script in a separate environment:
137
98
138
-
-`FormoAnalytics.ts` - Main entry point and public API
139
-
-`queue/` - Event batching, retry logic, and graceful shutdown
140
-
-`types/` - TypeScript interfaces and type definitions
141
-
-`utils/` - Helper functions for address checksumming, property normalization
142
-
-`validators/` - Input validation logic
99
+
1. Create a `.env` file with `FORMO_WRITE_KEY=your-key`
100
+
2. Run the manual test script:
101
+
```bash
102
+
pnpm run script:test-analytics
103
+
```
143
104
144
-
When making changes:
105
+
### Testing Packaging
145
106
146
-
1. Create a feature branch from `main`
147
-
2. Make your changes with appropriate tests
148
-
3. Ensure all tests pass: `pnpm test`
149
-
4. Submit a pull request
107
+
To simulate consuming the package as a real user:
150
108
151
-
### Generated SDK Code (`sdks/`)
109
+
1. Create a tarball:
152
110
153
-
ForUpdate `.stainless/stainless.yml` if adding new methods or resources 3. Validate with `stl lint` 4. Commit: `git add openapi.json .stainless/stainless.yml && git commit -m "Update API"` 5. Regenerate the SDK: `stl builds create --branch $(git branch --show-current)` 6. Test the changes 7. Review and commit the regeneratednapi.json`with the required changes
154
-
2. Regenerate the SDK:`stainless generate` 3. Test the changes 4. Commit both files
111
+
```bash
112
+
npm pack
113
+
```
155
114
156
-
## Running Tests
115
+
This creates a file like `formo-analytics-node-1.0.0.tgz`.
0 commit comments