Skip to content

Commit bc23235

Browse files
mivertowskiclaude
andcommitted
v2.0.0: Align TypeScript SDK with Rust SDK reference
18 resources, 69 endpoints matching vc-rust v2.0.0: - Add auditors, dashboard, screening, watchlists, webhooks, exports, ai, graph - Remove watches, notifications, enrichments, users, settings, sync - Update companies (events, reports, fingerprint, nearby), teams (member mgmt), analytics (anomalies, cohorts, candidates), dossiers, changes, persons - Base URL changed to https://api.vynco.ch (health at /health, rest at /v1/*) - Add ConflictError (409), _requestBytes for file downloads - ResponseMeta: add rateLimitRemaining, rateLimitReset - Types fully aligned with Rust SDK (PagedResponse, typed analytics, etc.) - CI: add package verification; Publish: add GitHub Release creation - 72 tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4789c43 commit bc23235

33 files changed

+2219
-778
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18, 20, 22]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: pnpm/action-setup@v4
20+
with:
21+
version: 9
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: pnpm
27+
28+
- run: pnpm install --frozen-lockfile
29+
30+
- run: pnpm lint
31+
32+
- run: pnpm test
33+
34+
- run: pnpm build
35+
36+
- name: Verify package
37+
run: pnpm pack --pack-destination /tmp && ls -lh /tmp/vynco-*.tgz

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: pnpm/action-setup@v4
19+
with:
20+
version: 9
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
cache: pnpm
26+
registry-url: https://registry.npmjs.org
27+
28+
- run: pnpm install --frozen-lockfile
29+
30+
- run: pnpm lint
31+
32+
- run: pnpm test
33+
34+
- run: pnpm build
35+
36+
- name: Publish to npm
37+
run: pnpm publish --no-git-checks --provenance
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
41+
- name: Create GitHub Release
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
generate_release_notes: true

CHANGELOG.md

Lines changed: 70 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,72 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file.
4-
5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7-
8-
## [0.1.0] - 2026-03-17
9-
10-
### Added
11-
12-
- **VyncoClient** with options-based configuration (`apiKey`, `baseUrl`, `timeout`, `maxRetries`)
13-
- **12 resource modules** covering 45 VynCo API endpoints:
14-
- `companies` — search, get by UID, count, statistics, change history, board members, dossier, relationships, hierarchy, compare
15-
- `persons` — get by ID, search by name
16-
- `dossiers` — generate AI company reports (summary/standard/comprehensive)
17-
- `apiKeys` — list, create, revoke API keys
18-
- `credits` — balance, usage breakdown, transaction history
19-
- `billing` — Stripe checkout and portal sessions
20-
- `webhooks` — list, create, get, update, delete, test
21-
- `teams` — get current team, create team
22-
- `users` — get profile, update profile, change password
23-
- `settings` — get/update preferences, get/update notifications
24-
- `analytics` — company stats, cantons, auditors, clustering, anomaly detection, RFM segments, cohorts, cross-tabulation
25-
- `sync` — data sync status
26-
- **Response metadata** via `VyncoResponse<T>` wrapper exposing API headers:
27-
- `X-Request-Id` — request tracing
28-
- `X-Credits-Used` — credits consumed
29-
- `X-Credits-Remaining` — remaining balance
30-
- `X-Rate-Limit-Limit` — tier rate limit
31-
- `X-Data-Source` — OGD compliance (Zefix/LINDAS)
32-
- **Typed error handling** with error classes mapping HTTP status codes:
33-
- `AuthenticationError` (401), `InsufficientCreditsError` (402), `ForbiddenError` (403)
34-
- `NotFoundError` (404), `ValidationError` (400/422), `RateLimitError` (429), `ServerError` (5xx)
35-
- `NetworkError` (connection failures), `DeserializeError` (JSON parse), `TimeoutError`, `ConfigError`
36-
- **Automatic retry** with exponential backoff on 429 and 5xx responses
37-
- **Retry-After header** support for rate-limited requests
38-
- **Dual ESM/CJS output** with TypeScript declarations via tsup
39-
- **Zero runtime dependencies** — uses native `fetch` (Node.js 18+ / browsers)
40-
- **33 tests** with vitest and msw covering auth, error mapping, resource methods, and metadata parsing
3+
## 2.0.0 (2026-03-31)
4+
5+
Major release aligning the TypeScript SDK with the Rust SDK (`vynco` v2.0.0).
6+
7+
### Breaking Changes
8+
9+
- **Base URL** changed from `https://api.vynco.ch/v1` to `https://api.vynco.ch` — the `/v1` prefix is now part of each endpoint path. Health check is at `/health` (no `/v1` prefix).
10+
- **Removed resources:** `Watches`, `Notifications`, `Enrichments`, `Users`, `Settings`, `Sync` — replaced by new equivalents or removed from the API.
11+
- **Removed methods:** `companies.search()` (POST), `companies.batch()`, `changes.review()`, `changes.batch()`, `changes.bySogcId()`, `persons.get()`, `persons.search()`, `persons.roles()`, `persons.connections()`, `persons.networkStats()`, `dossiers.generate()`, `dossiers.statistics()`, `analytics.velocity()`.
12+
- **Renamed types:** `PaginatedResponse``PagedResponse`, `UsageBreakdown``CreditUsage`, `ApiKeyInfo``ApiKey`, `CheckoutSessionResponse`/`PortalSessionResponse``SessionUrl`.
13+
- **Changed method signatures:** `companies.compare()` now takes `CompareRequest` object, `dossiers.create()` replaces `dossiers.generate()`, `changes.byCompany()` replaces `changes.get()`.
14+
- **Type changes:** `CompanyChange`, `ChangeListParams`, `ChangeStatistics`, `Company`, `CompanyStatistics`, `Team`, `CreateTeamRequest`, `CreateApiKeyRequest`, `ApiKeyCreated`, `Dossier` fields updated to match API.
15+
- **ResponseMeta:** Rate limit headers changed from `x-rate-limit-limit` to `x-ratelimit-limit` (no hyphen). Added `rateLimitRemaining` and `rateLimitReset`.
16+
17+
### New Resources (8)
18+
19+
- **`auditors`**`history(uid)`, `tenures(params?)` — auditor appointment history and long-tenure queries.
20+
- **`dashboard`**`get()` — dashboard summary data.
21+
- **`screening`**`screen(request)` — sanctions and watchlist screening.
22+
- **`watchlists`**`list()`, `create()`, `delete()`, `companies()`, `addCompanies()`, `removeCompany()`, `events()` — company monitoring lists with events.
23+
- **`webhooks`**`list()`, `create()`, `update()`, `delete()`, `test()`, `deliveries()` — webhook subscriptions with signing secrets and delivery tracking.
24+
- **`exports`**`create()`, `get()`, `download()` — bulk data export jobs with binary file downloads.
25+
- **`ai`**`dossier()`, `search()`, `riskScore()` — AI-powered company intelligence, natural language search, and risk scoring.
26+
- **`graph`**`get()`, `export()`, `analyze()` — corporate relationship graphs with network analysis.
27+
28+
### New Company Methods (5)
29+
30+
- `companies.events(uid, limit?)` — company change events (CloudEvent format)
31+
- `companies.reports(uid)` — financial report metadata
32+
- `companies.fingerprint(uid)` — extended company data profile
33+
- `companies.nearby(params)` — geo-proximity company search
34+
- `companies.relationships(uid)` — now returns typed `Relationship[]`
35+
36+
### New Team Methods (5)
37+
38+
- `teams.members()` — list team members
39+
- `teams.inviteMember(request)` — invite by email
40+
- `teams.updateMemberRole(id, request)` — change member role
41+
- `teams.removeMember(id)` — remove a member
42+
- `teams.billingSummary()` — team billing overview
43+
44+
### New Analytics Methods (4)
45+
46+
- `analytics.anomalies(request)` — anomaly detection
47+
- `analytics.cohorts(params?)` — cohort analysis
48+
- `analytics.statistics()` — company statistics
49+
- `analytics.candidates(params?)` — audit candidate ranking
50+
51+
### Other Improvements
52+
53+
- Added `ConflictError` (HTTP 409) to error mapping
54+
- Added `_requestBytes()` internal method for binary file downloads
55+
- Credits `history()` now returns typed `CreditHistory` instead of `unknown`
56+
- Analytics `cantons()` and `auditors()` return typed arrays instead of `AnalyticsResult`
57+
- GitHub Actions publish workflow now creates a GitHub Release automatically
58+
- CI workflow now includes package verification step
59+
60+
## 1.0.0 (2026-03-18)
61+
62+
Initial major release.
63+
64+
- 16 resource modules covering 60+ API endpoints
65+
- Response metadata wrapper with API headers
66+
- Typed error handling (11 error classes)
67+
- Automatic retry with exponential backoff
68+
- Dual ESM/CJS output with zero dependencies
69+
70+
## 0.1.0 (2026-03-17)
71+
72+
Alpha release.

CLAUDE.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## What This Is
66

7-
TypeScript SDK for the VynCo API (`api.vynco.ch/v1`) — Swiss company data, analytics, credit management, and platform administration. This is the TypeScript counterpart to the Rust SDK at `../VynCorp-rust/vc-rust`. It is a superset: all Rust SDK endpoints plus additional endpoints used by VynCorpPortal.
7+
TypeScript SDK for the VynCo API (`api.vynco.ch`) — Swiss company data, analytics, AI intelligence, credit management, and platform administration. This is the TypeScript counterpart to the Rust SDK at `../VynCorp-rust/vc-rust`.
88

99
## Commands
1010

@@ -27,32 +27,37 @@ If `pnpm` is not installed globally, prefix with `npx`: `npx pnpm build`.
2727

2828
**Single entry point**: Everything is exported from `src/index.ts`. The public API surface is `VyncoClient` plus typed resources, errors, and data model interfaces.
2929

30+
**Base URL**: Default is `https://api.vynco.ch`. The health endpoint is at `/health` (no `/v1` prefix). All other endpoints use `/v1/` prefix (e.g., `/v1/companies`, `/v1/credits/balance`).
31+
3032
**Client → Resources pattern**: `VyncoClient` (in `src/client.ts`) owns the HTTP transport layer and exposes internal `_request*` methods (underscore-prefixed, not truly private — used by resource classes). Each resource class (e.g., `Companies`, `Credits`) takes a `VyncoClient` reference and calls these internal methods. Resources are instantiated in the `VyncoClient` constructor and exposed as readonly properties (`client.companies`, `client.credits`, etc.).
3133

34+
**18 resource modules** (69 endpoints): health, companies, auditors, dashboard, screening, watchlists, webhooks, exports, ai, apiKeys, credits, billing, teams, changes, persons, analytics, dossiers, graph.
35+
3236
**Key internal methods on VyncoClient**:
3337
- `_request<T>(method, path)` — GET with no body, returns `VyncoResponse<T>`
3438
- `_requestWithBody<T>(method, path, body)` — POST/PUT with JSON body
3539
- `_requestWithParams<T>(method, path, params)` — GET with query string
3640
- `_requestEmpty(method, path)` — DELETE, returns `ResponseMeta` only
41+
- `_requestBytes(method, path)` — GET returning raw bytes for file downloads (exports, graph export)
3742

38-
**Error mapping**: HTTP status codes map to typed error classes in `src/errors.ts`. All extend `VyncoError`. The mapping lives in `#throwIfError` in `client.ts`.
43+
**Error mapping**: HTTP status codes map to typed error classes in `src/errors.ts`. All extend `VyncoError`. The mapping lives in `#throwIfError` in `client.ts`. Includes 409 → `ConflictError`.
3944

4045
**Retry logic**: `#fetchWithRetry` in `client.ts` retries on 429/5xx with exponential backoff (500ms base). Respects `Retry-After` header.
4146

42-
**Response metadata**: Every API response wraps data in `VyncoResponse<T>` which includes `ResponseMeta` parsed from `X-Request-Id`, `X-Credits-Used`, `X-Credits-Remaining`, `X-Rate-Limit-Limit`, `X-Data-Source` headers.
47+
**Response metadata**: Every API response wraps data in `VyncoResponse<T>` which includes `ResponseMeta` parsed from `X-Request-Id`, `X-Credits-Used`, `X-Credits-Remaining`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `X-Data-Source` headers.
4348

4449
## Conventions
4550

4651
- Zero runtime dependencies — uses native `fetch` only
4752
- All imports use `.js` extensions (required for ESM)
4853
- Resource classes use `#private` fields for the client reference
4954
- Data model interfaces in `src/types.ts` use camelCase matching the API's JSON format
50-
- Endpoints returning unstable/untyped JSON use `unknown` as the return type (e.g., `credits.history()`, `companies.statistics()`, analytics endpoints)
55+
- All endpoints return fully typed responses — no `unknown` return types
5156
- Tests use `msw` (Mock Service Worker) for HTTP-level mocking via `setupServer`
5257
- When testing error codes, set `maxRetries: 0` to avoid retry delays
5358

5459
## Related Projects
5560

5661
- **Rust SDK**: `../VynCorp-rust/vc-rust` — the reference implementation this SDK mirrors
57-
- **VynCorpPortal**: `../../VynCorpPortal/VynCorpPortal` — Next.js frontend that consumes this API (source of Portal-only endpoints)
62+
- **VynCorpPortal**: `../../VynCorpPortal/VynCorpPortal` — Next.js frontend that consumes this API
5863
- **ZefixMiner**: `../../ZefixMiner/EY.EW.ASU.ZefixMiner` — .NET backend that serves the API

0 commit comments

Comments
 (0)