@nopaque/sdk 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.1] - 2026-04-21
8
+
9
+ ### Fixed
10
+ - Cross-resource response envelope audit. The server uses resource-named
11
+ keys for most list endpoints (and wraps load-test config create/update
12
+ in `{config: {...}}`); the SDK previously assumed `{items: [...]}`
13
+ everywhere, so several list methods returned empty results. Aligned:
14
+ - `mapping.runs(jobId)` — reads `runs` (was: `items`).
15
+ - `mapping.paths(jobId)` — reads `rules` (was: `items`).
16
+ - `batches.list()` / `listPage()` — reads `batches`.
17
+ - `batches.runs(batchId)` and `batches.listRuns()` — read `runs`.
18
+ - `sweeps.list()` / `listPage()` — reads `sweeps`.
19
+ - `sweeps.runs(sweepId)` and `sweeps.listRuns()` — read `runs`.
20
+ - `datasets.list()` / `listPage()` — reads `datasets`.
21
+ - `loadTesting.list()` / `listPage()` — reads `configs`.
22
+ - `loadTesting.listRuns()` — reads `runs`.
23
+ - `scheduler.list()` / `listPage()` — reads `schedules`.
24
+ - `audio.list()` / `listPage()` — reads `audioFiles`.
25
+ - `profiles.list()` / `listPage()` — reads `profiles`.
26
+ - `loadTesting.create()` and `loadTesting.update()` now unwrap the
27
+ server's `{config: {...}}` envelope before returning.
28
+ - `profiles.findByParameters()` response shape corrected from
29
+ `{items: [...]}` to `{profiles: [...]}`. Callers should read
30
+ `result.profiles`.
31
+
32
+ ### Changed (non-breaking)
33
+ - `Paginator` accepts an `itemsKey?: string` option so each resource can
34
+ declare the key its list endpoint uses. Falls back to `items` if the
35
+ declared key is missing, preserving forward compatibility.
36
+ - `BatchRun`, `SweepRun`, `LoadTestRun` now declare `id` as the primary
37
+ key (matching the server); `runId` remains on the type as deprecated.
38
+
39
+ ## [0.1.0] — 2026-04-19
40
+
41
+ ### Added
42
+ - Initial release.
43
+ - `Nopaque` client with full coverage of the API-key-authenticated
44
+ Nopaque REST API: mapping, profiles, testing (configs/jobs/runs),
45
+ batches, sweeps, datasets, load testing, scheduler, enrichment, audio.
46
+ - Automatic pagination, polling helpers for long-running jobs,
47
+ one-call audio upload/download.
48
+ - Method-aware retry with exponential jitter and `Retry-After` honor.
49
+ - Typed error class hierarchy.
50
+ - Dual ESM + CJS output with TypeScript definitions.
51
+
52
+ [Unreleased]: https://github.com/nopaque/node-sdk/compare/v0.1.0...HEAD
53
+ [0.1.0]: https://github.com/nopaque/node-sdk/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nopaque Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @nopaque/sdk — Node SDK for Nopaque
2
+
3
+ Official Node.js client for the [Nopaque](https://nopaque.co.uk) API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @nopaque/sdk
9
+ # or
10
+ pnpm add @nopaque/sdk
11
+ # or
12
+ yarn add @nopaque/sdk
13
+ ```
14
+
15
+ ## Quick start
16
+
17
+ ```typescript
18
+ import { Nopaque } from '@nopaque/sdk';
19
+
20
+ const client = new Nopaque({ apiKey: process.env.NOPAQUE_API_KEY });
21
+
22
+ // Create a mapping job and wait until it completes
23
+ const job = await client.mapping.create({
24
+ name: 'Main IVR',
25
+ phoneNumber: '+441234567890',
26
+ mappingMode: 'dtmf',
27
+ });
28
+ await client.mapping.start(job.id);
29
+ const final = await client.mapping.waitForComplete(job.id);
30
+ console.log(final.status);
31
+
32
+ // List audio files with automatic pagination
33
+ for await (const audio of client.audio.list()) {
34
+ console.log(audio.id, audio.fileName);
35
+ }
36
+ ```
37
+
38
+ ## Features
39
+
40
+ - Full coverage of the Nopaque REST API via API-key auth
41
+ - Written in TypeScript; full type definitions included
42
+ - Automatic pagination for list endpoints
43
+ - Polling helpers for long-running jobs (`waitForComplete`)
44
+ - One-call audio upload/download wrapping the presigned-URL flow
45
+ - Method-aware retry with exponential jitter and `Retry-After` honor
46
+ - Typed error classes (`NotFoundError`, `RateLimitError`, etc.)
47
+ - Zero runtime dependencies — uses platform `fetch`
48
+ - Dual ESM + CJS, works in Node 20+, Next.js server actions, and bundlers
49
+
50
+ ## Documentation
51
+
52
+ Full reference: <https://nopaque.co.uk/docs/sdks>
53
+
54
+ ## Authentication
55
+
56
+ ```typescript
57
+ new Nopaque({ apiKey: 'nop_live_...' });
58
+ ```
59
+
60
+ Or set the environment variable:
61
+
62
+ ```bash
63
+ export NOPAQUE_API_KEY=nop_live_...
64
+ ```
65
+
66
+ API keys are workspace-scoped and subject to per-minute rate limits based on your subscription tier. Free tier cannot use API keys.
67
+
68
+ ## CommonJS
69
+
70
+ ```javascript
71
+ const { Nopaque } = require('@nopaque/sdk');
72
+ const client = new Nopaque({ apiKey: '...' });
73
+ ```
74
+
75
+ ## Requirements
76
+
77
+ - Node 20+
78
+
79
+ ## License
80
+
81
+ MIT