soundlink 2.9.0 → 2.10.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.
- package/CHANGELOG.md +10 -0
- package/README.md +35 -0
- package/dist/cjs/api-emulator.cjs +934 -0
- package/dist/cjs/api-emulator.cjs.map +1 -0
- package/dist/esm/api-BCcqXQoy.d.ts +864 -0
- package/dist/esm/api-emulator.d.ts +127 -0
- package/dist/esm/api-emulator.js +930 -0
- package/dist/esm/api-emulator.js.map +1 -0
- package/dist/esm/index.d.ts +3 -863
- package/docs/api-emulator.md +216 -0
- package/package.json +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# soundlink
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#42](https://github.com/Fan-ID/typescript-sdk/pull/42) [`39e7138`](https://github.com/Fan-ID/typescript-sdk/commit/39e71386d981eff12be880f0096867dfa7042d3f) Thanks [@jotanarciso](https://github.com/jotanarciso)! - Add `soundlink/api-emulator` — local stateful Public API emulator for lifecycle tests (`create` → activate/spend → `stop`/`end` refund) without Meta spend.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#43](https://github.com/Fan-ID/typescript-sdk/pull/43) [`03e87a4`](https://github.com/Fan-ID/typescript-sdk/commit/03e87a48ac5b1b787ccb3ca68ff954297185782c) Thanks [@jotanarciso](https://github.com/jotanarciso)! - Add emulator plan presets so paid-campaign tests can set fee with `plan` and `getPlan()`.
|
|
12
|
+
|
|
3
13
|
## 2.9.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -375,6 +375,41 @@ SOUNDLINK_API_KEY=sk_... \
|
|
|
375
375
|
npm run test:live
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
+
## Local Public API emulator
|
|
379
|
+
|
|
380
|
+
Local integration tests without Meta spend: import `soundlink/api-emulator`, `listen` on loopback, drive lifecycle with harness transitions (`activate` / `set_spend` / `reject_meta` / `end`). Works with the SDK **or** plain `fetch` / curl (fix `port` and call from another local process).
|
|
381
|
+
|
|
382
|
+
Full guide: **[docs/api-emulator.md](./docs/api-emulator.md)**.
|
|
383
|
+
|
|
384
|
+
```ts
|
|
385
|
+
import { Soundlink } from 'soundlink';
|
|
386
|
+
import { createApiEmulator } from 'soundlink/api-emulator';
|
|
387
|
+
|
|
388
|
+
const apiKey = 'sk_emulator_test';
|
|
389
|
+
const emu = createApiEmulator({
|
|
390
|
+
apiKey,
|
|
391
|
+
initialWalletBalance: 500,
|
|
392
|
+
plan: 'enterprise',
|
|
393
|
+
});
|
|
394
|
+
const server = await emu.listen(); // or { port: 8787 } for fetch from another process
|
|
395
|
+
const soundlink = new Soundlink({ apiKey, baseUrl: server.baseUrl });
|
|
396
|
+
|
|
397
|
+
const { data: created } = await soundlink.campaigns.create(
|
|
398
|
+
{
|
|
399
|
+
spotifyUrl: 'https://open.spotify.com/track/4iV5W9uYEdYUVa79Axb7Rh',
|
|
400
|
+
dailyBudget: 10,
|
|
401
|
+
durationDays: 7,
|
|
402
|
+
genre: 'Pop',
|
|
403
|
+
strategyType: 'maximum_growth',
|
|
404
|
+
},
|
|
405
|
+
{ idempotencyKey: 'demo-1' },
|
|
406
|
+
);
|
|
407
|
+
await emu.transition(created!.campaignId, 'activate');
|
|
408
|
+
await soundlink.metrics.overview(created!.campaignId);
|
|
409
|
+
await soundlink.campaigns.stop(created!.campaignId, { idempotencyKey: 'stop-1' });
|
|
410
|
+
await server.close();
|
|
411
|
+
```
|
|
412
|
+
|
|
378
413
|
## Roadmap
|
|
379
414
|
|
|
380
415
|
- Video import helpers (`videos:write`) — when prioritized
|