@uluops/ops-sdk 1.0.1 → 1.2.0

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 (37) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/README.md +33 -16
  3. package/dist/client.d.ts +23 -328
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +7 -1
  6. package/dist/client.js.map +1 -1
  7. package/dist/config/constants.d.ts +2 -2
  8. package/dist/config/constants.js +1 -1
  9. package/dist/config/validators.d.ts +6 -6
  10. package/dist/operations/issues.d.ts +4 -2
  11. package/dist/operations/issues.d.ts.map +1 -1
  12. package/dist/operations/issues.js +6 -12
  13. package/dist/operations/issues.js.map +1 -1
  14. package/dist/operations/projects.d.ts.map +1 -1
  15. package/dist/operations/projects.js +3 -0
  16. package/dist/operations/projects.js.map +1 -1
  17. package/dist/operations/taxonomy.d.ts.map +1 -1
  18. package/dist/operations/taxonomy.js +2 -1
  19. package/dist/operations/taxonomy.js.map +1 -1
  20. package/dist/types/analytics.d.ts +3 -17
  21. package/dist/types/analytics.d.ts.map +1 -1
  22. package/dist/types/enums.d.ts +2 -1
  23. package/dist/types/enums.d.ts.map +1 -1
  24. package/dist/types/enums.js +2 -1
  25. package/dist/types/enums.js.map +1 -1
  26. package/dist/types/response-schemas.d.ts +62 -8
  27. package/dist/types/response-schemas.d.ts.map +1 -1
  28. package/dist/types/response-schemas.js +25 -0
  29. package/dist/types/response-schemas.js.map +1 -1
  30. package/dist/types/schemas.d.ts +12 -13
  31. package/dist/types/schemas.d.ts.map +1 -1
  32. package/dist/types/schemas.js +4 -0
  33. package/dist/types/schemas.js.map +1 -1
  34. package/dist/utils/helpers.d.ts.map +1 -1
  35. package/dist/utils/helpers.js +2 -0
  36. package/dist/utils/helpers.js.map +1 -1
  37. package/package.json +6 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,240 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@uluops/ops-sdk` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+
7
+ ## [1.1.0] - 2026-04-09
8
+
9
+ ### Fixed
10
+ - Package description updated to reflect full SDK scope (tracker, analytics, auth, org management)
11
+ - `issues.search()` refactored to use `toApiQuery()` instead of manual query serialization
12
+ - `normalizeKeys()` now guards against prototype pollution (`__proto__`, `constructor`, `prototype` keys) — matches `deepMerge()` behavior
13
+ - README version updated from 0.7.0 to 1.0.1
14
+ - README Quick Start base URL comment corrected (defaults to production, not localhost)
15
+ - JSDoc on `OpsClientConfig.baseUrl` corrected to document NODE_ENV-conditional default
16
+ - `files` field in package.json now includes README.md and CHANGELOG.md in published tarball
17
+
18
+ ## [1.0.0] - 2026-04-08
19
+
20
+ ### Changed
21
+ - **Breaking:** All response types now derived from Zod schemas via `z.infer<>` — hand-written interfaces removed. Type shapes are identical but provenance changed. Consumers importing types may see different IDE hover text.
22
+ - `SDK_VERSION` constant synced to `1.0.0`
23
+
24
+ ### Added
25
+ - Phase 6: Response types derived from Zod schemas — single source of truth for all domain types (Run, Issue, Project, Auth, Analytics)
26
+
27
+ ## [0.10.1] - 2026-04-08
28
+
29
+ ### Fixed
30
+ - `deleteProject` and `softDelete` return 204 no-content handling
31
+
32
+ ## [0.10.0] - 2026-04-08
33
+
34
+ ### Added
35
+ - Phase 5: Response schemas wired into all analytics operations — runtime validation on all 14 analytics endpoints
36
+
37
+ ## [0.9.4] - 2026-04-08
38
+
39
+ ### Fixed
40
+ - `ValidateRunResponse.preview` contains arrays not counts
41
+
42
+ ## [0.9.3] - 2026-04-08
43
+
44
+ ### Fixed
45
+ - `ValidateRunResponse` and `ProjectTrends` schemas aligned to API reality
46
+
47
+ ## [0.9.2] - 2026-04-08
48
+
49
+ ### Fixed
50
+ - `Issue.deletedAt` stripped by API `issueToPublic` — removed from schema
51
+
52
+ ## [0.9.1] - 2026-04-08
53
+
54
+ ### Fixed
55
+ - `Project` and `ProjectSummary` schemas aligned to API reality
56
+
57
+ ## [0.9.0] - 2026-04-08
58
+
59
+ ### Added
60
+ - Phase 4: Response schemas wired into issue, project, and auth operations
61
+
62
+ ## [0.8.2] - 2026-04-08
63
+
64
+ ### Fixed
65
+ - `ArchiveRunsResult` schema aligned to API reality
66
+
67
+ ## [0.8.1] - 2026-04-08
68
+
69
+ ### Fixed
70
+ - `RunDetailsResponseSchema` aligned to API reality
71
+
72
+ ## [0.8.0] - 2026-04-08
73
+
74
+ ### Added
75
+ - Phase 3: Response schemas wired into all run operations — runtime Zod validation on every runs endpoint
76
+ - Phase 1: All response schemas aligned to API reality (optional→required where API guarantees, missing fields added)
77
+ - `@uluops/sdk-core` bumped to 0.3.0 (adds `patch()` schema support and `ResponseValidationError`)
78
+
79
+ ## [0.7.0] - 2026-04-08
80
+
81
+ ### Added
82
+ - `archivedAt` and `archiveReason` fields on `UpdateRunInput` — enables archive/unarchive via the standard update endpoint
83
+ - `updateById()` now forwards `archivedAt` and `archiveReason` to the API
84
+ - `update()` (by project+number) now forwards `archivedAt` and `archiveReason` to the API
85
+ - `orgSlug` constructor option on `OpsClient` for multi-tenancy (sets `X-Org-Slug` header)
86
+
87
+ ### Fixed
88
+ - **Breaking:** `AgentInput.decision` and `AgentSnapshot.decision` now match Zod schemas — previously the TypeScript interfaces used `decision` while `AgentInputSchema` and `AgentSnapshotResponseSchema` used `status`, causing runtime validation failures for consumers following the TypeScript types
89
+ - `SDK_VERSION` constant synced to `0.7.0`
90
+
91
+ ### Removed
92
+ - Admin operations (`client.admin.*`) — removed from public SDK surface. Use the dashboard or direct API for admin tasks.
93
+ - Dead admin test suites (16 tests referencing removed operations)
94
+
95
+ ### Docs
96
+ - README: removed 165-line Admin Operations section documenting removed `client.admin.*`
97
+ - README: Quick Start examples use `decision` (not `status`) and `inputTokens` (not `input_tokens`)
98
+ - README: fixed stale type import (`SaveFeaturesListInput` → `SaveRunInput`)
99
+ - README: version badge updated from 0.3.1 to 0.7.0
100
+ - README: documented `orgSlug` constructor option
101
+
102
+ ## [0.6.0] - 2026-04-06
103
+
104
+ ### Added
105
+ - `ULUOPS_SESSION_TOKEN` environment variable support for session-based auth
106
+
107
+ ## [0.4.0] - 2026-03-15
108
+
109
+ ### Removed
110
+ - Admin operations removed from public SDK surface (moved to dashboard-only)
111
+
112
+ ### Changed
113
+ - Bumped version to reflect breaking change
114
+
115
+ ## [0.2.0] - 2026-03-01
116
+
117
+ ### Added
118
+ - Analysis operations: `getAnalysis()`, `getProjectAnalysis()`, `queryAnalysisRecords()`
119
+ - `AnalysisRecord` and `AnalysisSummary` types for structured analysis data
120
+ - `definitionType`, `definitionName`, `definitionVersion`, `definitionHash` fields on `SaveRunInput`
121
+
122
+ ## [0.1.5] - 2026-02-15
123
+
124
+ ### Fixed
125
+ - `getVelocity`, `getDiscovery`, `getValidatorMatrix` now use `toApiQuery()` for consistent snake_case query parameter conversion (was manually constructing query objects, bypassing conversion)
126
+
127
+ ### Improved
128
+ - `OpsClient` class JSDoc with authentication mode examples and usage patterns
129
+ - `login()` JSDoc clarifies relationship with `auth.login()` (install-session vs raw-token)
130
+ - `listValidators()` JSDoc documents O(n) complexity note
131
+ - README: `updateProfile` documents "at least one field required" constraint
132
+ - README: `getByMetric` lists all available metric names
133
+ - README: low-level HTTP client section warns to prefer `OpsClient`
134
+
135
+ ## [0.1.4] - 2026-02-15
136
+
137
+ ### Fixed
138
+ - Query parameters now sent as snake_case to match API expectations (`failureDomain` → `failure_domain`, `includeResolved` → `include_resolved`, etc.)
139
+ - `priority=all` filter value stripped before sending (API rejects it; omitting means "all")
140
+ - `lineNumber` field now accepts `null` in `RecommendationInputSchema` and `CreateUserIssueInputSchema` (`.optional()` → `.nullish()`)
141
+ - `deepMerge` utility now guards against prototype pollution (`__proto__`, `constructor`, `prototype` keys)
142
+ - `formatDate` now throws `RangeError` on invalid date strings instead of returning `"Invalid Date"`
143
+
144
+ ### Added
145
+ - `toApiQuery()` utility for centralized camelCase→snake_case query parameter conversion
146
+ - JSDoc descriptions on all 7 operation group properties in `OpsClient`
147
+ - Documented `requestRaw` tradeoff in `listIssuesWithCount` (no retry/refresh for envelope access)
148
+
149
+ ### Changed
150
+ - `RegisterResponseSchema` now requires `id`, `email`, `isActive`, `role`, `createdAt`, `updatedAt` (were optional)
151
+ - `LoginResponseSchema` documented `sessionToken`/`token` backward compatibility
152
+
153
+ ## [0.1.3] - 2026-02-15
154
+
155
+ ### Added
156
+ - `normalizeKeys<T>()` — recursive snake_case→camelCase key conversion with mapped types
157
+ - `getFlexibleProperty()` — dual-case property access for mixed API responses
158
+ - `retryMutations` option on `runs.save()` for idempotent retry safety
159
+ - `loadEnvFiles()` — loads `.env` from cwd and `~/.uluops/.env`
160
+ - `listIssuesWithCount()` — paginated issue listing preserving API envelope count
161
+ - `listValidators()` — derived validator list from performance data
162
+ - `updateById()` — update a run by UUID (vs by project+runNumber)
163
+ - `updateStatusByFingerprint()` — update issue status by fingerprint hash
164
+
165
+ ### Fixed
166
+ - Error guards on all SDK error classes (missing `instanceof` checks)
167
+ - Delete operations now return `{ deleted: true }` result type
168
+
169
+ ## [0.1.2] - 2026-02-08
170
+
171
+ ### Added
172
+ - `readFileOption` helper for CLI file argument parsing
173
+ - `parseIntOption`/`parseFloatOption` for safe CLI numeric parsing
174
+ - Global `unhandledRejection` handler in CLI entry point
175
+ - `--timeout` flag for CLI commands
176
+ - 503 `Retry-After` header support in retry logic
177
+ - `retryMutations` option for POST requests that are safe to retry
178
+ - EACCES error handling for config file writes
179
+
180
+ ### Fixed
181
+ - Retry logic respects `Retry-After` header from 503/429 responses
182
+ - Config directory creation handles permission errors gracefully
183
+
184
+ ## [0.1.1] - 2026-02-07
185
+
186
+ ### Changed
187
+ - SDK core extraction: shared HTTP client, auth strategies, and utilities moved to `@uluops/sdk-core`
188
+ - Aligned SDK types with actual API response shapes
189
+
190
+ ## [0.1.0] - 2026-02-05
191
+
192
+ ### Added
193
+ - Initial SDK for UluOps validation tracker API
194
+ - `OpsClient` with namespaced operations: auth, projects, runs, issues, analytics, taxonomy, admin
195
+ - `OpsHttpClient` with native fetch, retry logic, timeout handling, and exponential backoff
196
+ - JWT session auth and API key auth strategies with automatic token refresh
197
+ - Typed error classes: `ValidationError`, `UnauthorizedError`, `NotFoundError`, `RateLimitError`, etc.
198
+ - Configuration loading from environment variables, `.env` files, and `~/.uluops/credentials.json`
199
+ - Runtime input validators using Zod schemas wired into all 5 operation modules
200
+ - Granular package.json exports for tree-shaking (`/types`, `/errors`, `/config`)
201
+ - ESLint with typescript-eslint flat config (ESLint 9)
202
+ - Password schema with complexity requirements (lowercase, uppercase, digit)
203
+ - Typed generic overloads for `analytics.getByMetric()` via `AnalyticsMetricResultMap`
204
+ - Token refresh race condition protection with promise deduplication
205
+ - Credential sanitization in `OpsApiError.toJSON()` via `sanitizeForDisplay()`
206
+ - `QueryParams`/`QueryParamValue` types for HTTP client methods
207
+ - Shared `buildIssueListParams()` utility for issue listing endpoints
208
+ - JSDoc `@param`/`@returns` on all exported helpers
209
+ - Comprehensive test suite with 467 tests across 16 files
210
+
211
+ ### Changed
212
+ - Migrated HTTP layer from axios to native fetch (zero runtime HTTP dependencies)
213
+ - Extracted CLI to dedicated `@uluops/cli` package
214
+ - Retry logic now only retries idempotent methods (GET/PUT/DELETE)
215
+ - SDK sends camelCase directly to API (removed snake_case conversion layer)
216
+ - Restricted barrel exports: `config/index.ts` exposes consumer-facing constants only; `utils/index.ts` exposes `createLogger` and `Logger` type only
217
+ - Removed 14 unnecessary `as Record<string, unknown>` type casts across operation files
218
+
219
+ ### Fixed
220
+ - Safe JSON parsing on success-path responses (handles empty/non-JSON bodies)
221
+ - Token refresh errors now logged instead of silently swallowed
222
+ - Login response validated before destructuring to prevent undefined values
223
+ - `getAvatar()` uses binary response handling instead of JSON parsing
224
+ - `Error.captureStackTrace` guarded for non-V8 runtimes
225
+ - `encodeURIComponent` applied to all URL path parameters
226
+ - Debug logging for credential loading errors
227
+ - Admin/analytics endpoints receiving snake_case when they expected camelCase
228
+ - Test data corrected by validators: invalid role enums, non-UUID IDs, wrong field names
229
+
230
+ ### Testing
231
+ - 467 tests across 16 test files (up from 314)
232
+ - Schema-validated mock factories with contract helpers for all response types
233
+ - Nock interceptor leak detection in test setup (unconsumed = implicit assertion)
234
+ - Return value verification on all 18 validator test suites (mutation resistance)
235
+ - Error path inspection on validation failures (message content, error paths, statusCode)
236
+ - Explicit `nock.isDone()` assertions on retry logic tests
237
+ - Shared test constants (`TEST_API_KEY`, `TEST_UUID`) eliminating magic strings
238
+ - 52 error constructor edge case tests
239
+ - HTTP timeout boundary tests
240
+ - `query-utils.test.ts` with full branch coverage
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  Official TypeScript SDK with Zod runtime validation for the UluOps validation tracker API. Track validation runs, manage issues, analyze trends, and integrate AI validation pipelines into your workflow.
13
13
 
14
- **Current version: 0.7.0** | [Changelog](./CHANGELOG.md)
14
+ **Current version: 1.1.0** | [Changelog](./CHANGELOG.md)
15
15
 
16
16
  ## Quick Start
17
17
 
@@ -20,8 +20,8 @@ Official TypeScript SDK with Zod runtime validation for the UluOps validation tr
20
20
  ```typescript
21
21
  import { OpsClient } from '@uluops/ops-sdk';
22
22
 
23
- // Defaults to http://localhost:3100/api/v1 for local dev.
24
- // For production, set ULUOPS_BASE_URL env var or pass baseUrl below.
23
+ // Defaults to https://api.uluops.ai/api/v1/ops in production.
24
+ // Set NODE_ENV=development for localhost:3100, or pass baseUrl explicitly.
25
25
  const client = new OpsClient({
26
26
  apiKey: 'ulr_your-api-key-here', // Create via client.auth.createApiKey() or admin dashboard
27
27
  });
@@ -109,7 +109,7 @@ The SDK covers **83 API methods** across 7 operation domains with full TypeScrip
109
109
 
110
110
  ## Features
111
111
 
112
- - **Full API Coverage**: Access all 83 methods across auth, projects, runs, issues, analytics, taxonomy, and admin domains
112
+ - **Full API Coverage**: Access all 83 methods across auth, projects, runs, issues, analytics, and taxonomy domains
113
113
  - **Type-Safe**: Complete TypeScript definitions with Zod runtime validation
114
114
  - **Dual Authentication**: API key (preferred) and JWT session support
115
115
  - **Automatic Retries**: Exponential backoff for transient errors (502, 503, 504, 429)
@@ -205,7 +205,7 @@ import type {
205
205
  Project,
206
206
  Issue,
207
207
  Run,
208
- ValidatorPerformance,
208
+ AgentPerformance,
209
209
  Priority,
210
210
  Status,
211
211
  Severity,
@@ -260,7 +260,7 @@ const client = new OpsClient({
260
260
  password: 'password', // Password for login
261
261
 
262
262
  // Connection settings
263
- baseUrl: 'http://localhost:3100/api/v1', // API base URL
263
+ baseUrl: 'https://api.uluops.ai/api/v1/ops', // API base URL (localhost:3100 when NODE_ENV=development)
264
264
  timeout: 30000, // Request timeout in ms (default: 30000)
265
265
  retries: 3, // Retry count for transient errors (default: 3)
266
266
  debug: false, // Enable debug logging
@@ -1046,9 +1046,9 @@ const issue = await client.issues.updateStatus('issue-uuid', {
1046
1046
  });
1047
1047
  ```
1048
1048
 
1049
- #### `client.issues.edit(issueId, input)`
1049
+ #### `client.issues.update(issueId, input)`
1050
1050
 
1051
- Edit issue metadata.
1051
+ Update issue metadata.
1052
1052
 
1053
1053
  | Parameter | Type | Required | Description |
1054
1054
  |-----------|------|----------|-------------|
@@ -1060,7 +1060,7 @@ Edit issue metadata.
1060
1060
  | `failureCode` | `string` | No | New failure code |
1061
1061
 
1062
1062
  ```typescript
1063
- const issue = await client.issues.edit('issue-uuid', {
1063
+ const issue = await client.issues.update('issue-uuid', {
1064
1064
  title: 'Updated title',
1065
1065
  severity: 'high',
1066
1066
  });
@@ -1322,6 +1322,19 @@ for (const v of agents) {
1322
1322
  }
1323
1323
  ```
1324
1324
 
1325
+ #### Deprecated Aliases
1326
+
1327
+ The following analytics methods were renamed from "validator" to "agent" terminology. The old names still work but will be removed in a future major version:
1328
+
1329
+ | Deprecated | Replacement |
1330
+ |-----------|-------------|
1331
+ | `getValidatorPerformance` | `getAgentPerformance` |
1332
+ | `getValidatorReliability` | `getAgentReliability` |
1333
+ | `getValidatorMatrix` | `getAgentMatrix` |
1334
+ | `listValidators` | `listAgents` |
1335
+
1336
+ Similarly, `client.issues.edit()` is deprecated in favor of `client.issues.update()`.
1337
+
1325
1338
  ---
1326
1339
 
1327
1340
  ### Taxonomy Operations
@@ -1337,14 +1350,14 @@ const taxonomy = await client.taxonomy.get();
1337
1350
 
1338
1351
  console.log('Domains:', taxonomy.domains);
1339
1352
  // [
1340
- // { code: 'STR', name: 'Structural', modes: ['OMI', 'RED', 'MIS'] },
1341
- // { code: 'SEM', name: 'Semantic', modes: ['VAL', 'TYP', 'LOG'] },
1342
- // { code: 'PRA', name: 'Pragmatic', modes: ['PER', 'SEC', 'MAI'] },
1343
- // { code: 'EPI', name: 'Epistemic', modes: ['DOC', 'NAM', 'CLR'] },
1353
+ // { code: 'STR', name: 'Structural', description: '...', modes: [{ code: 'OMI', name: 'Omission', description: '...' }, ...] },
1354
+ // { code: 'SEM', name: 'Semantic', description: '...', modes: [...] },
1355
+ // { code: 'PRA', name: 'Pragmatic', description: '...', modes: [...] },
1356
+ // { code: 'EPI', name: 'Epistemic', description: '...', modes: [...] },
1344
1357
  // ]
1345
1358
 
1346
1359
  console.log('Severities:', taxonomy.severities);
1347
- // ['critical', 'high', 'medium', 'low', 'info']
1360
+ // [{ code: 'C', name: 'critical', weight: 10 }, { code: 'H', name: 'high', weight: 5 }, ...]
1348
1361
 
1349
1362
  console.log('Priorities:', taxonomy.priorities);
1350
1363
  // ['critical', 'suggested', 'backlog']
@@ -1380,7 +1393,8 @@ For command-line usage, see the dedicated CLI package: [`@uluops/cli`](https://w
1380
1393
  | `ULUOPS_API_KEY` | API key for authentication | - |
1381
1394
  | `ULUOPS_EMAIL` | Email for session auth | - |
1382
1395
  | `ULUOPS_PASSWORD` | Password for session auth | - |
1383
- | `ULUOPS_BASE_URL` | API base URL | `http://localhost:3100/api/v1` |
1396
+ | `ULUOPS_SESSION_TOKEN` | Session token for auth | - |
1397
+ | `ULUOPS_BASE_URL` | API base URL | `https://api.uluops.ai/api/v1/ops` (localhost:3100 when `NODE_ENV=development`) |
1384
1398
  | `ULUOPS_DEBUG` | Enable debug logging | `false` |
1385
1399
 
1386
1400
  Create a `.env` file in your project:
@@ -1392,7 +1406,7 @@ ULUOPS_BASE_URL=https://api.uluops.com/api/v1
1392
1406
 
1393
1407
  Or configure globally in `~/.uluops/.env`.
1394
1408
 
1395
- > **Note:** The SDK defaults to `http://localhost:3100/api/v1` for local development. For production use, always set `ULUOPS_BASE_URL` or pass `baseUrl` to the constructor.
1409
+ > **Note:** The SDK defaults to `https://api.uluops.ai/api/v1/ops` in production. Set `NODE_ENV=development` to default to `http://localhost:3100/api/v1`, or pass `baseUrl` explicitly.
1396
1410
 
1397
1411
  ## Error Handling
1398
1412
 
@@ -1441,9 +1455,12 @@ try {
1441
1455
  | `NotFoundError` | 404 | Resource not found |
1442
1456
  | `ConflictError` | 409 | Resource conflict |
1443
1457
  | `RateLimitError` | 429 | Rate limit exceeded |
1458
+ | `PayloadTooLargeError` | 413 | Request body too large |
1459
+ | `UnprocessableError` | 422 | Semantically invalid request |
1444
1460
  | `ServiceUnavailableError` | 503 | Server unavailable |
1445
1461
  | `NetworkError` | - | Connection error |
1446
1462
  | `TimeoutError` | - | Request timeout |
1463
+ | `InputValidationError` | - | Client-side Zod validation failure (import from `/config`) |
1447
1464
 
1448
1465
  ### Automatic Retries
1449
1466