soundlink 2.8.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 +16 -0
- package/README.md +38 -0
- package/dist/cjs/api-emulator.cjs +934 -0
- package/dist/cjs/api-emulator.cjs.map +1 -0
- package/dist/cjs/index.cjs +22 -1
- package/dist/cjs/index.cjs.map +1 -1
- 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 +18 -851
- package/dist/esm/index.js +22 -1
- package/dist/esm/index.js.map +1 -1
- package/docs/api-emulator.md +216 -0
- package/openapi/soundlink-public-api-v1.yaml +126 -25
- package/package.json +12 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { C as CampaignStatus, S as StrategyType, M as MetricsOverview, W as WalletData } from './api-BCcqXQoy.js';
|
|
2
|
+
|
|
3
|
+
type EmulatorTransitionAction = 'activate' | 'reject_meta' | 'set_spend' | 'end';
|
|
4
|
+
interface EmulatorCampaignRecord {
|
|
5
|
+
campaignId: string;
|
|
6
|
+
status: CampaignStatus;
|
|
7
|
+
dailyBudget: number;
|
|
8
|
+
durationDays: number;
|
|
9
|
+
committedUsd: number;
|
|
10
|
+
mediaSpendUsd: number;
|
|
11
|
+
refundedAt: string | null;
|
|
12
|
+
autoRenew: boolean;
|
|
13
|
+
strategyType: StrategyType;
|
|
14
|
+
spotifyUrl: string;
|
|
15
|
+
genre: string;
|
|
16
|
+
campaignName: string;
|
|
17
|
+
trackId: string | null;
|
|
18
|
+
playlistId: string | null;
|
|
19
|
+
artistId: string | null;
|
|
20
|
+
artistName: string | null;
|
|
21
|
+
trackName: string | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
overview: MetricsOverview | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface EmulatorRequest {
|
|
28
|
+
method: string;
|
|
29
|
+
path: string;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
body?: unknown;
|
|
32
|
+
}
|
|
33
|
+
interface EmulatorResponse {
|
|
34
|
+
status: number;
|
|
35
|
+
json: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Local plan presets for paid-campaign fees.
|
|
40
|
+
* Defaults are for emulator tests only — not a published price list.
|
|
41
|
+
*/
|
|
42
|
+
type EmulatorPlan = 'free' | 'artist_pro' | 'studio' | 'label_power' | 'enterprise';
|
|
43
|
+
interface EmulatorPlanPreset {
|
|
44
|
+
feeRate: number;
|
|
45
|
+
/**
|
|
46
|
+
* Whether this preset is treated as premium in the emulator.
|
|
47
|
+
* Metadata for `getPlan()` only; does not change `/v1` payloads yet.
|
|
48
|
+
*/
|
|
49
|
+
premium: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare const EMULATOR_PLAN_PRESETS: Record<EmulatorPlan, EmulatorPlanPreset>;
|
|
52
|
+
interface ResolvedEmulatorPlan {
|
|
53
|
+
/** Selected preset, or `null` when only explicit `feeRate` / defaults were used. */
|
|
54
|
+
plan: EmulatorPlan | null;
|
|
55
|
+
feeRate: number;
|
|
56
|
+
premium: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare const LOOPBACK_HOST = "127.0.0.1";
|
|
60
|
+
interface ListenOptions {
|
|
61
|
+
/**
|
|
62
|
+
* TCP port. `0` (default) binds an ephemeral port.
|
|
63
|
+
* Use a fixed port (e.g. `8787`) when another local process will call
|
|
64
|
+
* this server with `fetch` / curl.
|
|
65
|
+
*/
|
|
66
|
+
port?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Bind address. Must be `127.0.0.1` — any other value is rejected
|
|
69
|
+
* so harness admin routes are never exposed on a public interface.
|
|
70
|
+
*/
|
|
71
|
+
host?: string;
|
|
72
|
+
}
|
|
73
|
+
interface EmulatorServer {
|
|
74
|
+
host: string;
|
|
75
|
+
port: number;
|
|
76
|
+
/** `http://127.0.0.1:<port>` — pass as SDK `baseUrl` (SDK adds `/v1`). */
|
|
77
|
+
baseUrl: string;
|
|
78
|
+
close(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface TransitionResult {
|
|
82
|
+
campaignId: string;
|
|
83
|
+
status: EmulatorCampaignRecord['status'];
|
|
84
|
+
mediaSpendUsd: number;
|
|
85
|
+
refundedAt: string | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface CreateApiEmulatorOptions {
|
|
89
|
+
/** Bearer token accepted by `/v1` (must start with `sk_`). Default: `sk_emulator_test`. */
|
|
90
|
+
apiKey?: string;
|
|
91
|
+
/** Starting wallet balance in USD. Default: `1000`. */
|
|
92
|
+
initialWalletBalance?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Paid-campaign plan preset. Sets default `feeRate` and the premium flag.
|
|
95
|
+
*/
|
|
96
|
+
plan?: EmulatorPlan;
|
|
97
|
+
/** Overrides plan fee (and default `0` when no plan). */
|
|
98
|
+
feeRate?: number;
|
|
99
|
+
/** Organization id on campaign detail. Default: `org_emulator`. */
|
|
100
|
+
organizationId?: string;
|
|
101
|
+
}
|
|
102
|
+
interface ApiEmulator {
|
|
103
|
+
/** In-process request handler (no TCP). */
|
|
104
|
+
dispatch(request: EmulatorRequest): EmulatorResponse;
|
|
105
|
+
/**
|
|
106
|
+
* Bind HTTP on `127.0.0.1` only. Pass `baseUrl` to the SDK, or call
|
|
107
|
+
* `/v1` and `/__emulator` with plain `fetch` / curl (fix `port` to share
|
|
108
|
+
* with another local process on the same machine).
|
|
109
|
+
*/
|
|
110
|
+
listen(options?: ListenOptions): Promise<EmulatorServer>;
|
|
111
|
+
/** Clears wallet/campaigns/idempotency and restores `initialWalletBalance`. */
|
|
112
|
+
reset(): void;
|
|
113
|
+
/** Sets wallet balance without deleting campaigns (402 retry path). */
|
|
114
|
+
setWallet(balance: number): WalletData;
|
|
115
|
+
/** Same logic as `POST /__emulator/campaigns/{id}/transition`. */
|
|
116
|
+
transition(campaignId: string, action: EmulatorTransitionAction, mediaSpendUsd?: number): TransitionResult;
|
|
117
|
+
/** Wallet snapshot (`reserved` is always `0` after settle). */
|
|
118
|
+
getWallet(): WalletData;
|
|
119
|
+
/**
|
|
120
|
+
* Plan, fee, and premium flag. `premium` is metadata only;
|
|
121
|
+
* it does not change `/v1` payloads yet.
|
|
122
|
+
*/
|
|
123
|
+
getPlan(): ResolvedEmulatorPlan;
|
|
124
|
+
}
|
|
125
|
+
declare function createApiEmulator(options?: CreateApiEmulatorOptions): ApiEmulator;
|
|
126
|
+
|
|
127
|
+
export { type ApiEmulator, type CreateApiEmulatorOptions, EMULATOR_PLAN_PRESETS, type EmulatorPlan, type EmulatorRequest, type EmulatorResponse, type EmulatorServer, type EmulatorTransitionAction, LOOPBACK_HOST, type ListenOptions, type ResolvedEmulatorPlan, createApiEmulator };
|