@breeze.blue/sdk 0.3.0 → 0.3.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 +7 -0
- package/README.md +2 -0
- package/dist/client.js +14 -6
- package/dist/types.d.ts +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- Added SDK-side validation for `voices.createClonePreview(...)` and
|
|
6
|
+
`voices.edit(...)` reference audio inputs so `file` and single-item `files`
|
|
7
|
+
forms are accepted, while missing or multiple clone samples are rejected
|
|
8
|
+
before sending a request.
|
|
9
|
+
|
|
3
10
|
## 0.3.0
|
|
4
11
|
|
|
5
12
|
- Added async text-to-speech helpers: `client.textToSpeech.createJob(...)`,
|
package/README.md
CHANGED
|
@@ -163,6 +163,8 @@ const design = await client.voices.createDesignPreview({
|
|
|
163
163
|
generatedVoiceId = design.previews[0].generatedVoiceId;
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
`files` is also accepted with exactly one item.
|
|
167
|
+
|
|
166
168
|
Stream the preview so the user can audition it, then save the one they
|
|
167
169
|
pick:
|
|
168
170
|
|
package/dist/client.js
CHANGED
|
@@ -279,7 +279,7 @@ function clonePreviewForm(request) {
|
|
|
279
279
|
appendOptional(form, "labels", request.labels ? JSON.stringify(request.labels) : undefined);
|
|
280
280
|
appendOptional(form, "text", request.text);
|
|
281
281
|
appendOptional(form, "instructions", request.instructions);
|
|
282
|
-
for (const file of normalizeFiles(request.file, request.files)) {
|
|
282
|
+
for (const file of normalizeFiles(request.file, request.files, { required: true })) {
|
|
283
283
|
appendFile(form, "files", file);
|
|
284
284
|
}
|
|
285
285
|
return form;
|
|
@@ -289,7 +289,7 @@ function voiceEditForm(request) {
|
|
|
289
289
|
form.set("name", request.name);
|
|
290
290
|
appendOptional(form, "description", request.description);
|
|
291
291
|
appendOptional(form, "labels", request.labels ? JSON.stringify(request.labels) : undefined);
|
|
292
|
-
for (const file of normalizeFiles(request.file, request.files)) {
|
|
292
|
+
for (const file of normalizeFiles(request.file, request.files, { required: false })) {
|
|
293
293
|
appendFile(form, "files", file);
|
|
294
294
|
}
|
|
295
295
|
return form;
|
|
@@ -299,10 +299,18 @@ function appendOptional(form, key, value) {
|
|
|
299
299
|
return;
|
|
300
300
|
form.set(key, String(value));
|
|
301
301
|
}
|
|
302
|
-
function normalizeFiles(file, files) {
|
|
303
|
-
if (
|
|
304
|
-
|
|
305
|
-
|
|
302
|
+
function normalizeFiles(file, files, options) {
|
|
303
|
+
if (file !== undefined && files !== undefined) {
|
|
304
|
+
throw new BreezeBlueConfigurationError("Pass either file or files, not both.");
|
|
305
|
+
}
|
|
306
|
+
const selected = files !== undefined ? files : file === undefined ? [] : [file];
|
|
307
|
+
if (options.required && selected.length === 0) {
|
|
308
|
+
throw new BreezeBlueConfigurationError("Exactly one sample file is required.");
|
|
309
|
+
}
|
|
310
|
+
if (selected.length > 1) {
|
|
311
|
+
throw new BreezeBlueConfigurationError("Exactly one sample file is currently supported.");
|
|
312
|
+
}
|
|
313
|
+
return selected;
|
|
306
314
|
}
|
|
307
315
|
function appendFile(form, key, input) {
|
|
308
316
|
const upload = isUploadFile(input) ? input : { data: input };
|
package/dist/types.d.ts
CHANGED
|
@@ -192,6 +192,9 @@ export interface HistoryItem {
|
|
|
192
192
|
requestId?: string | null;
|
|
193
193
|
latencyMs?: number | null;
|
|
194
194
|
httpStatus?: number | null;
|
|
195
|
+
billableUnits?: number | null;
|
|
196
|
+
cost?: number | null;
|
|
197
|
+
costMillicredits?: number | null;
|
|
195
198
|
[key: string]: unknown;
|
|
196
199
|
}
|
|
197
200
|
export interface HistoryList {
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.3.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.1";
|
|
2
2
|
export declare const SDK_NAME = "@breeze.blue/sdk";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.3.
|
|
1
|
+
export const SDK_VERSION = "0.3.1";
|
|
2
2
|
export const SDK_NAME = "@breeze.blue/sdk";
|