@wave-av/sdk 2.0.1 → 2.0.3
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 +1 -1
- package/README.md +27 -23
- package/dist/audience.js +93 -0
- package/dist/audience.mjs +9 -0
- package/dist/camera-control.js +95 -0
- package/dist/camera-control.mjs +71 -0
- package/dist/captions-types.js +18 -0
- package/dist/captions-types.mjs +0 -0
- package/dist/captions.js +266 -0
- package/dist/captions.mjs +9 -0
- package/dist/chapters-types.js +18 -0
- package/dist/chapters-types.mjs +0 -0
- package/dist/chapters.js +280 -0
- package/dist/chapters.mjs +9 -0
- package/dist/chunk-362MRITF.mjs +46 -0
- package/dist/chunk-3ZLK4J3V.mjs +69 -0
- package/dist/chunk-4DG4OBRD.mjs +52 -0
- package/dist/chunk-4G7FMCMJ.mjs +68 -0
- package/dist/chunk-4KD5F6E3.mjs +0 -0
- package/dist/chunk-7M6XVUUK.mjs +241 -0
- package/dist/chunk-A344OOT7.mjs +243 -0
- package/dist/chunk-AI64YR5W.mjs +173 -0
- package/dist/chunk-C2GQ756E.mjs +57 -0
- package/dist/chunk-CO2VB72Z.mjs +255 -0
- package/dist/chunk-DWXWAILB.mjs +44 -0
- package/dist/chunk-FLEFYLDM.mjs +71 -0
- package/dist/chunk-H2YYTNUH.mjs +266 -0
- package/dist/chunk-IGDBED5P.mjs +246 -0
- package/dist/chunk-IL2SGWBC.mjs +0 -0
- package/dist/chunk-IVFZ5X4W.mjs +68 -0
- package/dist/chunk-JC32PG3T.mjs +114 -0
- package/dist/chunk-K5X42NLD.mjs +54 -0
- package/dist/chunk-KCEPNS2U.mjs +276 -0
- package/dist/chunk-LVOVF6XC.mjs +54 -0
- package/dist/chunk-M4Z33V3N.mjs +247 -0
- package/dist/chunk-M6FKIX75.mjs +0 -0
- package/dist/chunk-M744Z327.mjs +244 -0
- package/dist/chunk-MRFDPPFK.mjs +61 -0
- package/dist/chunk-MXU3Q23F.mjs +68 -0
- package/dist/chunk-NCVUZ746.mjs +60 -0
- package/dist/chunk-NLQVD2LF.mjs +210 -0
- package/dist/chunk-O6DOGYP5.mjs +238 -0
- package/dist/chunk-S25NY5GE.mjs +124 -0
- package/dist/chunk-TFHXBICQ.mjs +305 -0
- package/dist/chunk-TXWOA2VR.mjs +57 -0
- package/dist/chunk-UCDSNV22.mjs +63 -0
- package/dist/chunk-V5DWA5P4.mjs +279 -0
- package/dist/chunk-VLQQDYGP.mjs +173 -0
- package/dist/chunk-VPKZUXZW.mjs +53 -0
- package/dist/chunk-WS3PEFYJ.mjs +60 -0
- package/dist/chunk-XGAYMWRH.mjs +74 -0
- package/dist/chunk-XMM5J57W.mjs +0 -0
- package/dist/chunk-XWABBOSX.mjs +278 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/chunk-YBLXHI3M.mjs +257 -0
- package/dist/chunk-YEK26SSO.mjs +100 -0
- package/dist/chunk-YLCQKCZL.mjs +0 -0
- package/dist/chunk-YRKO4XI7.mjs +0 -0
- package/dist/chunk-ZJO7AP4Q.mjs +0 -0
- package/dist/client-types.js +18 -0
- package/dist/client-types.mjs +0 -0
- package/dist/client.js +311 -0
- package/dist/client.mjs +14 -0
- package/dist/clips-types.js +18 -0
- package/dist/clips-types.mjs +0 -0
- package/dist/clips.js +198 -0
- package/dist/clips.mjs +9 -0
- package/dist/cloud-switcher.js +80 -0
- package/dist/cloud-switcher.mjs +56 -0
- package/dist/collab-types.js +18 -0
- package/dist/collab-types.mjs +1 -0
- package/dist/collab.js +304 -0
- package/dist/collab.mjs +10 -0
- package/dist/connect.js +85 -0
- package/dist/connect.mjs +9 -0
- package/dist/creator.js +79 -0
- package/dist/creator.mjs +9 -0
- package/dist/desktop.js +77 -0
- package/dist/desktop.mjs +9 -0
- package/dist/distribution.js +88 -0
- package/dist/distribution.mjs +9 -0
- package/dist/drm.js +85 -0
- package/dist/drm.mjs +9 -0
- package/dist/edge.js +93 -0
- package/dist/edge.mjs +9 -0
- package/dist/editor-types.js +18 -0
- package/dist/editor-types.mjs +1 -0
- package/dist/editor.js +330 -0
- package/dist/editor.mjs +10 -0
- package/dist/fleet.js +149 -0
- package/dist/fleet.mjs +9 -0
- package/dist/ghost.js +139 -0
- package/dist/ghost.mjs +9 -0
- package/dist/index.js +0 -250
- package/dist/index.mjs +161 -5445
- package/dist/marketplace.js +82 -0
- package/dist/marketplace.mjs +9 -0
- package/dist/mesh.js +198 -0
- package/dist/mesh.mjs +9 -0
- package/dist/notifications.js +79 -0
- package/dist/notifications.mjs +9 -0
- package/dist/phone-types.js +18 -0
- package/dist/phone-types.mjs +0 -0
- package/dist/phone.js +269 -0
- package/dist/phone.mjs +9 -0
- package/dist/pipeline-types.js +18 -0
- package/dist/pipeline-types.mjs +0 -0
- package/dist/pipeline.js +263 -0
- package/dist/pipeline.mjs +9 -0
- package/dist/podcast.js +94 -0
- package/dist/podcast.mjs +9 -0
- package/dist/prism.js +82 -0
- package/dist/prism.mjs +9 -0
- package/dist/prompter.js +99 -0
- package/dist/prompter.mjs +76 -0
- package/dist/pulse.js +99 -0
- package/dist/pulse.mjs +9 -0
- package/dist/qr.js +71 -0
- package/dist/qr.mjs +9 -0
- package/dist/replay.js +62 -0
- package/dist/replay.mjs +38 -0
- package/dist/scene-types.js +18 -0
- package/dist/scene-types.mjs +1 -0
- package/dist/scene.js +271 -0
- package/dist/scene.mjs +10 -0
- package/dist/search-types.js +18 -0
- package/dist/search-types.mjs +1 -0
- package/dist/search.js +268 -0
- package/dist/search.mjs +10 -0
- package/dist/sentiment-types.js +18 -0
- package/dist/sentiment-types.mjs +0 -0
- package/dist/sentiment.js +235 -0
- package/dist/sentiment.mjs +9 -0
- package/dist/signage.js +93 -0
- package/dist/signage.mjs +9 -0
- package/dist/slides.js +78 -0
- package/dist/slides.mjs +9 -0
- package/dist/studio-ai-types.js +18 -0
- package/dist/studio-ai-types.mjs +1 -0
- package/dist/studio-ai.js +301 -0
- package/dist/studio-ai.mjs +10 -0
- package/dist/studio-types.js +18 -0
- package/dist/studio-types.mjs +1 -0
- package/dist/studio.js +303 -0
- package/dist/studio.mjs +10 -0
- package/dist/telemetry.js +124 -0
- package/dist/telemetry.mjs +15 -0
- package/dist/transcribe-types.js +18 -0
- package/dist/transcribe-types.mjs +1 -0
- package/dist/transcribe.js +282 -0
- package/dist/transcribe.mjs +10 -0
- package/dist/usb.js +69 -0
- package/dist/usb.mjs +9 -0
- package/dist/vault.js +96 -0
- package/dist/vault.mjs +9 -0
- package/dist/voice-types.js +18 -0
- package/dist/voice-types.mjs +0 -0
- package/dist/voice.js +272 -0
- package/dist/voice.mjs +9 -0
- package/dist/zoom.js +86 -0
- package/dist/zoom.mjs +9 -0
- package/package.json +5 -5
- package/dist/audience.d.ts +0 -104
- package/dist/audience.d.ts.map +0 -1
- package/dist/camera-control.d.ts +0 -54
- package/dist/camera-control.d.ts.map +0 -1
- package/dist/captions.d.ts +0 -362
- package/dist/captions.d.ts.map +0 -1
- package/dist/chapters.d.ts +0 -315
- package/dist/chapters.d.ts.map +0 -1
- package/dist/client.d.ts +0 -191
- package/dist/client.d.ts.map +0 -1
- package/dist/clips.d.ts +0 -258
- package/dist/clips.d.ts.map +0 -1
- package/dist/cloud-switcher.d.ts +0 -65
- package/dist/cloud-switcher.d.ts.map +0 -1
- package/dist/collab-types.d.ts +0 -204
- package/dist/collab-types.d.ts.map +0 -1
- package/dist/collab.d.ts +0 -226
- package/dist/collab.d.ts.map +0 -1
- package/dist/connect.d.ts +0 -88
- package/dist/connect.d.ts.map +0 -1
- package/dist/creator.d.ts +0 -109
- package/dist/creator.d.ts.map +0 -1
- package/dist/desktop.d.ts +0 -95
- package/dist/desktop.d.ts.map +0 -1
- package/dist/distribution.d.ts +0 -92
- package/dist/distribution.d.ts.map +0 -1
- package/dist/drm.d.ts +0 -87
- package/dist/drm.d.ts.map +0 -1
- package/dist/edge.d.ts +0 -112
- package/dist/edge.d.ts.map +0 -1
- package/dist/editor-types.d.ts +0 -236
- package/dist/editor-types.d.ts.map +0 -1
- package/dist/editor.d.ts +0 -206
- package/dist/editor.d.ts.map +0 -1
- package/dist/fleet.d.ts +0 -207
- package/dist/fleet.d.ts.map +0 -1
- package/dist/ghost.d.ts +0 -213
- package/dist/ghost.d.ts.map +0 -1
- package/dist/index.d.ts +0 -144
- package/dist/index.d.ts.map +0 -1
- package/dist/marketplace.d.ts +0 -90
- package/dist/marketplace.d.ts.map +0 -1
- package/dist/mesh.d.ts +0 -237
- package/dist/mesh.d.ts.map +0 -1
- package/dist/notifications.d.ts +0 -82
- package/dist/notifications.d.ts.map +0 -1
- package/dist/phone.d.ts +0 -369
- package/dist/phone.d.ts.map +0 -1
- package/dist/pipeline.d.ts +0 -409
- package/dist/pipeline.d.ts.map +0 -1
- package/dist/podcast.d.ts +0 -113
- package/dist/podcast.d.ts.map +0 -1
- package/dist/prism.d.ts +0 -132
- package/dist/prism.d.ts.map +0 -1
- package/dist/prompter.d.ts +0 -184
- package/dist/prompter.d.ts.map +0 -1
- package/dist/pulse.d.ts +0 -156
- package/dist/pulse.d.ts.map +0 -1
- package/dist/qr.d.ts +0 -82
- package/dist/qr.d.ts.map +0 -1
- package/dist/replay.d.ts +0 -52
- package/dist/replay.d.ts.map +0 -1
- package/dist/scene-types.d.ts +0 -190
- package/dist/scene-types.d.ts.map +0 -1
- package/dist/scene.d.ts +0 -213
- package/dist/scene.d.ts.map +0 -1
- package/dist/search-types.d.ts +0 -210
- package/dist/search-types.d.ts.map +0 -1
- package/dist/search.d.ts +0 -250
- package/dist/search.d.ts.map +0 -1
- package/dist/sentiment.d.ts +0 -378
- package/dist/sentiment.d.ts.map +0 -1
- package/dist/signage.d.ts +0 -101
- package/dist/signage.d.ts.map +0 -1
- package/dist/slides.d.ts +0 -68
- package/dist/slides.d.ts.map +0 -1
- package/dist/studio-ai-types.d.ts +0 -198
- package/dist/studio-ai-types.d.ts.map +0 -1
- package/dist/studio-ai.d.ts +0 -218
- package/dist/studio-ai.d.ts.map +0 -1
- package/dist/studio-types.d.ts +0 -267
- package/dist/studio-types.d.ts.map +0 -1
- package/dist/studio.d.ts +0 -234
- package/dist/studio.d.ts.map +0 -1
- package/dist/telemetry.d.ts +0 -76
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/transcribe-types.d.ts +0 -153
- package/dist/transcribe-types.d.ts.map +0 -1
- package/dist/transcribe.d.ts +0 -218
- package/dist/transcribe.d.ts.map +0 -1
- package/dist/usb.d.ts +0 -64
- package/dist/usb.d.ts.map +0 -1
- package/dist/vault.d.ts +0 -121
- package/dist/vault.d.ts.map +0 -1
- package/dist/voice.d.ts +0 -307
- package/dist/voice.d.ts.map +0 -1
- package/dist/zoom.d.ts +0 -91
- package/dist/zoom.d.ts.map +0 -1
package/dist/captions.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/captions.ts
|
|
21
|
+
var captions_exports = {};
|
|
22
|
+
__export(captions_exports, {
|
|
23
|
+
CaptionsAPI: () => CaptionsAPI,
|
|
24
|
+
createCaptionsAPI: () => createCaptionsAPI
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(captions_exports);
|
|
27
|
+
var CaptionsAPI = class {
|
|
28
|
+
client;
|
|
29
|
+
basePath = "/v1/captions";
|
|
30
|
+
constructor(client) {
|
|
31
|
+
this.client = client;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generate captions using AI
|
|
35
|
+
*
|
|
36
|
+
* Requires: captions:generate permission
|
|
37
|
+
*/
|
|
38
|
+
async generate(request) {
|
|
39
|
+
return this.client.post(`${this.basePath}/generate`, request);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Upload existing captions
|
|
43
|
+
*
|
|
44
|
+
* Requires: captions:create permission
|
|
45
|
+
*/
|
|
46
|
+
async upload(request) {
|
|
47
|
+
return this.client.post(`${this.basePath}/upload`, request);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get a caption track by ID
|
|
51
|
+
*
|
|
52
|
+
* Requires: captions:read permission
|
|
53
|
+
*/
|
|
54
|
+
async get(trackId) {
|
|
55
|
+
return this.client.get(`${this.basePath}/${trackId}`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Update a caption track
|
|
59
|
+
*
|
|
60
|
+
* Requires: captions:update permission
|
|
61
|
+
*/
|
|
62
|
+
async update(trackId, request) {
|
|
63
|
+
return this.client.patch(`${this.basePath}/${trackId}`, request);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Remove a caption track
|
|
67
|
+
*
|
|
68
|
+
* Requires: captions:remove permission (server-side RBAC enforced)
|
|
69
|
+
*/
|
|
70
|
+
async remove(trackId) {
|
|
71
|
+
await this.client.delete(
|
|
72
|
+
`${this.basePath}/${trackId}`,
|
|
73
|
+
{ method: "DELETE" }
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* List caption tracks
|
|
78
|
+
*
|
|
79
|
+
* Requires: captions:read permission
|
|
80
|
+
*/
|
|
81
|
+
async list(params) {
|
|
82
|
+
return this.client.get(this.basePath, {
|
|
83
|
+
params
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get caption tracks for a specific media
|
|
88
|
+
*
|
|
89
|
+
* Requires: captions:read permission
|
|
90
|
+
*/
|
|
91
|
+
async getForMedia(mediaId, mediaType) {
|
|
92
|
+
const result = await this.list({ media_id: mediaId, media_type: mediaType });
|
|
93
|
+
return result.data;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get caption cues (segments)
|
|
97
|
+
*
|
|
98
|
+
* Requires: captions:read permission
|
|
99
|
+
*/
|
|
100
|
+
async getCues(trackId, params) {
|
|
101
|
+
return this.client.get(
|
|
102
|
+
`${this.basePath}/${trackId}/cues`,
|
|
103
|
+
{ params }
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Update a caption cue
|
|
108
|
+
*
|
|
109
|
+
* Requires: captions:update permission
|
|
110
|
+
*/
|
|
111
|
+
async updateCue(trackId, cueId, updates) {
|
|
112
|
+
return this.client.patch(
|
|
113
|
+
`${this.basePath}/${trackId}/cues/${cueId}`,
|
|
114
|
+
updates
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Add a new caption cue
|
|
119
|
+
*
|
|
120
|
+
* Requires: captions:update permission
|
|
121
|
+
*/
|
|
122
|
+
async addCue(trackId, cue) {
|
|
123
|
+
return this.client.post(
|
|
124
|
+
`${this.basePath}/${trackId}/cues`,
|
|
125
|
+
cue
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Remove a caption cue
|
|
130
|
+
*
|
|
131
|
+
* Requires: captions:update permission (server-side RBAC enforced)
|
|
132
|
+
*/
|
|
133
|
+
async removeCue(trackId, cueId) {
|
|
134
|
+
await this.client.delete(
|
|
135
|
+
`${this.basePath}/${trackId}/cues/${cueId}`,
|
|
136
|
+
{ method: "DELETE" }
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Bulk update cues
|
|
141
|
+
*
|
|
142
|
+
* Requires: captions:update permission
|
|
143
|
+
*/
|
|
144
|
+
async bulkUpdateCues(trackId, updates) {
|
|
145
|
+
return this.client.post(`${this.basePath}/${trackId}/cues/bulk`, { updates });
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Translate a caption track to another language
|
|
149
|
+
*
|
|
150
|
+
* Requires: captions:translate permission
|
|
151
|
+
*/
|
|
152
|
+
async translate(trackId, request) {
|
|
153
|
+
return this.client.post(
|
|
154
|
+
`${this.basePath}/${trackId}/translate`,
|
|
155
|
+
request
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Export captions in a specific format
|
|
160
|
+
*
|
|
161
|
+
* Requires: captions:read permission
|
|
162
|
+
*/
|
|
163
|
+
async exportFormat(trackId, format) {
|
|
164
|
+
return this.client.get(`${this.basePath}/${trackId}/export`, {
|
|
165
|
+
params: { format }
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get captions as plain text
|
|
170
|
+
*
|
|
171
|
+
* Requires: captions:read permission
|
|
172
|
+
*/
|
|
173
|
+
async getText(trackId) {
|
|
174
|
+
const result = await this.client.get(
|
|
175
|
+
`${this.basePath}/${trackId}/text`
|
|
176
|
+
);
|
|
177
|
+
return result.text;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Burn captions into video
|
|
181
|
+
*
|
|
182
|
+
* Requires: captions:burnin permission
|
|
183
|
+
*/
|
|
184
|
+
async burnIn(request) {
|
|
185
|
+
return this.client.post(`${this.basePath}/burn-in`, request);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get burn-in job status
|
|
189
|
+
*
|
|
190
|
+
* Requires: captions:read permission
|
|
191
|
+
*/
|
|
192
|
+
async getBurnInJob(jobId) {
|
|
193
|
+
return this.client.get(`${this.basePath}/burn-in/${jobId}`);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Wait for burn-in to complete
|
|
197
|
+
*/
|
|
198
|
+
async waitForBurnIn(jobId, options) {
|
|
199
|
+
const pollInterval = options?.pollInterval || 3e3;
|
|
200
|
+
const timeout = options?.timeout || 18e5;
|
|
201
|
+
const startTime = Date.now();
|
|
202
|
+
while (Date.now() - startTime < timeout) {
|
|
203
|
+
const job = await this.getBurnInJob(jobId);
|
|
204
|
+
if (options?.onProgress) {
|
|
205
|
+
options.onProgress(job);
|
|
206
|
+
}
|
|
207
|
+
if (job.status === "ready") {
|
|
208
|
+
return job;
|
|
209
|
+
}
|
|
210
|
+
if (job.status === "failed") {
|
|
211
|
+
throw new Error(`Burn-in failed: ${job.error || "Unknown error"}`);
|
|
212
|
+
}
|
|
213
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
214
|
+
}
|
|
215
|
+
throw new Error(`Burn-in timed out after ${timeout}ms`);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Wait for caption generation to complete
|
|
219
|
+
*/
|
|
220
|
+
async waitForReady(trackId, options) {
|
|
221
|
+
const pollInterval = options?.pollInterval || 2e3;
|
|
222
|
+
const timeout = options?.timeout || 6e5;
|
|
223
|
+
const startTime = Date.now();
|
|
224
|
+
while (Date.now() - startTime < timeout) {
|
|
225
|
+
const track = await this.get(trackId);
|
|
226
|
+
if (options?.onProgress) {
|
|
227
|
+
options.onProgress(track);
|
|
228
|
+
}
|
|
229
|
+
if (track.status === "ready") {
|
|
230
|
+
return track;
|
|
231
|
+
}
|
|
232
|
+
if (track.status === "failed") {
|
|
233
|
+
throw new Error(`Caption generation failed: ${track.error || "Unknown error"}`);
|
|
234
|
+
}
|
|
235
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
236
|
+
}
|
|
237
|
+
throw new Error(`Caption generation timed out after ${timeout}ms`);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get supported languages
|
|
241
|
+
*
|
|
242
|
+
* Requires: captions:read permission
|
|
243
|
+
*/
|
|
244
|
+
async getSupportedLanguages() {
|
|
245
|
+
return this.client.get(`${this.basePath}/languages`);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Detect language from audio
|
|
249
|
+
*
|
|
250
|
+
* Requires: captions:generate permission
|
|
251
|
+
*/
|
|
252
|
+
async detectLanguage(mediaId, mediaType) {
|
|
253
|
+
return this.client.post(`${this.basePath}/detect-language`, {
|
|
254
|
+
media_id: mediaId,
|
|
255
|
+
media_type: mediaType
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
function createCaptionsAPI(client) {
|
|
260
|
+
return new CaptionsAPI(client);
|
|
261
|
+
}
|
|
262
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
263
|
+
0 && (module.exports = {
|
|
264
|
+
CaptionsAPI,
|
|
265
|
+
createCaptionsAPI
|
|
266
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/chapters-types.ts
|
|
17
|
+
var chapters_types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(chapters_types_exports);
|
|
File without changes
|
package/dist/chapters.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/chapters.ts
|
|
21
|
+
var chapters_exports = {};
|
|
22
|
+
__export(chapters_exports, {
|
|
23
|
+
ChaptersAPI: () => ChaptersAPI,
|
|
24
|
+
createChaptersAPI: () => createChaptersAPI
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(chapters_exports);
|
|
27
|
+
var ChaptersAPI = class {
|
|
28
|
+
client;
|
|
29
|
+
basePath = "/v1/chapters";
|
|
30
|
+
constructor(client) {
|
|
31
|
+
this.client = client;
|
|
32
|
+
}
|
|
33
|
+
// Chapter Sets
|
|
34
|
+
/**
|
|
35
|
+
* Generate chapters using AI
|
|
36
|
+
*
|
|
37
|
+
* Requires: chapters:generate permission
|
|
38
|
+
*/
|
|
39
|
+
async generate(request) {
|
|
40
|
+
return this.client.post(`${this.basePath}/generate`, request);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a chapter set manually
|
|
44
|
+
*
|
|
45
|
+
* Requires: chapters:create permission
|
|
46
|
+
*/
|
|
47
|
+
async createSet(request) {
|
|
48
|
+
return this.client.post(this.basePath, request);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get a chapter set by ID
|
|
52
|
+
*
|
|
53
|
+
* Requires: chapters:read permission
|
|
54
|
+
*/
|
|
55
|
+
async getSet(setId) {
|
|
56
|
+
return this.client.get(`${this.basePath}/${setId}`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Update a chapter set
|
|
60
|
+
*
|
|
61
|
+
* Requires: chapters:update permission
|
|
62
|
+
*/
|
|
63
|
+
async updateSet(setId, request) {
|
|
64
|
+
return this.client.patch(`${this.basePath}/${setId}`, request);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Remove a chapter set
|
|
68
|
+
*
|
|
69
|
+
* Requires: chapters:remove permission (canDelete verified server-side)
|
|
70
|
+
*/
|
|
71
|
+
async removeSet(setId) {
|
|
72
|
+
await this.client.delete(`${this.basePath}/${setId}`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* List chapter sets
|
|
76
|
+
*
|
|
77
|
+
* Requires: chapters:read permission
|
|
78
|
+
*/
|
|
79
|
+
async listSets(params) {
|
|
80
|
+
return this.client.get(this.basePath, { params });
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get the default chapter set for a media
|
|
84
|
+
*
|
|
85
|
+
* Requires: chapters:read permission
|
|
86
|
+
*/
|
|
87
|
+
async getDefaultSet(mediaId, mediaType) {
|
|
88
|
+
try {
|
|
89
|
+
return await this.client.get(`${this.basePath}/default`, {
|
|
90
|
+
params: { media_id: mediaId, media_type: mediaType }
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (error.statusCode === 404) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Duplicate a chapter set
|
|
101
|
+
*
|
|
102
|
+
* Requires: chapters:create permission
|
|
103
|
+
*/
|
|
104
|
+
async duplicateSet(setId, name) {
|
|
105
|
+
return this.client.post(`${this.basePath}/${setId}/duplicate`, { name });
|
|
106
|
+
}
|
|
107
|
+
// Individual Chapters
|
|
108
|
+
/**
|
|
109
|
+
* Add a chapter to a set
|
|
110
|
+
*
|
|
111
|
+
* Requires: chapters:update permission
|
|
112
|
+
*/
|
|
113
|
+
async addChapter(setId, chapter) {
|
|
114
|
+
return this.client.post(`${this.basePath}/${setId}/chapters`, chapter);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get a chapter by ID
|
|
118
|
+
*
|
|
119
|
+
* Requires: chapters:read permission
|
|
120
|
+
*/
|
|
121
|
+
async getChapter(setId, chapterId) {
|
|
122
|
+
return this.client.get(`${this.basePath}/${setId}/chapters/${chapterId}`);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update a chapter
|
|
126
|
+
*
|
|
127
|
+
* Requires: chapters:update permission
|
|
128
|
+
*/
|
|
129
|
+
async updateChapter(setId, chapterId, request) {
|
|
130
|
+
return this.client.patch(
|
|
131
|
+
`${this.basePath}/${setId}/chapters/${chapterId}`,
|
|
132
|
+
request
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Remove a chapter
|
|
137
|
+
*
|
|
138
|
+
* Requires: chapters:update permission (server-side RBAC enforced)
|
|
139
|
+
*/
|
|
140
|
+
async removeChapter(setId, chapterId) {
|
|
141
|
+
await this.client.delete(
|
|
142
|
+
`${this.basePath}/${setId}/chapters/${chapterId}`,
|
|
143
|
+
{ method: "DELETE" }
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Reorder chapters
|
|
148
|
+
*
|
|
149
|
+
* Requires: chapters:update permission
|
|
150
|
+
*/
|
|
151
|
+
async reorderChapters(setId, chapterIds) {
|
|
152
|
+
return this.client.post(
|
|
153
|
+
`${this.basePath}/${setId}/chapters/reorder`,
|
|
154
|
+
{ chapter_ids: chapterIds }
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Bulk update chapters
|
|
159
|
+
*
|
|
160
|
+
* Requires: chapters:update permission
|
|
161
|
+
*/
|
|
162
|
+
async bulkUpdateChapters(setId, updates) {
|
|
163
|
+
return this.client.post(`${this.basePath}/${setId}/chapters/bulk`, { updates });
|
|
164
|
+
}
|
|
165
|
+
// Thumbnails
|
|
166
|
+
/**
|
|
167
|
+
* Generate thumbnail for a chapter
|
|
168
|
+
*
|
|
169
|
+
* Requires: chapters:update permission
|
|
170
|
+
*/
|
|
171
|
+
async generateThumbnail(setId, chapterId, options) {
|
|
172
|
+
return this.client.post(
|
|
173
|
+
`${this.basePath}/${setId}/chapters/${chapterId}/thumbnail`,
|
|
174
|
+
options
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Generate thumbnails for all chapters in a set
|
|
179
|
+
*
|
|
180
|
+
* Requires: chapters:update permission
|
|
181
|
+
*/
|
|
182
|
+
async generateAllThumbnails(setId) {
|
|
183
|
+
return this.client.post(`${this.basePath}/${setId}/thumbnails`);
|
|
184
|
+
}
|
|
185
|
+
// Export
|
|
186
|
+
/**
|
|
187
|
+
* Export chapters in various formats
|
|
188
|
+
*
|
|
189
|
+
* Requires: chapters:read permission
|
|
190
|
+
*/
|
|
191
|
+
async exportChapters(setId, format) {
|
|
192
|
+
return this.client.get(`${this.basePath}/${setId}/export`, {
|
|
193
|
+
params: { format }
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Import chapters from a format
|
|
198
|
+
*
|
|
199
|
+
* Requires: chapters:create permission
|
|
200
|
+
*/
|
|
201
|
+
async importChapters(mediaId, mediaType, format, content, options) {
|
|
202
|
+
return this.client.post(`${this.basePath}/import`, {
|
|
203
|
+
media_id: mediaId,
|
|
204
|
+
media_type: mediaType,
|
|
205
|
+
format,
|
|
206
|
+
content,
|
|
207
|
+
...options
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// Utilities
|
|
211
|
+
/**
|
|
212
|
+
* Wait for chapter generation to complete
|
|
213
|
+
*/
|
|
214
|
+
async waitForReady(setId, options) {
|
|
215
|
+
const pollInterval = options?.pollInterval || 2e3;
|
|
216
|
+
const timeout = options?.timeout || 6e5;
|
|
217
|
+
const startTime = Date.now();
|
|
218
|
+
while (Date.now() - startTime < timeout) {
|
|
219
|
+
const set = await this.getSet(setId);
|
|
220
|
+
if (options?.onProgress) {
|
|
221
|
+
options.onProgress(set);
|
|
222
|
+
}
|
|
223
|
+
if (set.status === "ready") {
|
|
224
|
+
return set;
|
|
225
|
+
}
|
|
226
|
+
if (set.status === "failed") {
|
|
227
|
+
throw new Error(`Chapter generation failed: ${set.error || "Unknown error"}`);
|
|
228
|
+
}
|
|
229
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
230
|
+
}
|
|
231
|
+
throw new Error(`Chapter generation timed out after ${timeout}ms`);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Get chapter at a specific time
|
|
235
|
+
*
|
|
236
|
+
* Requires: chapters:read permission
|
|
237
|
+
*/
|
|
238
|
+
async getChapterAtTime(setId, time) {
|
|
239
|
+
try {
|
|
240
|
+
return await this.client.get(`${this.basePath}/${setId}/at`, {
|
|
241
|
+
params: { time }
|
|
242
|
+
});
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (error.statusCode === 404) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Merge chapters
|
|
252
|
+
*
|
|
253
|
+
* Requires: chapters:update permission
|
|
254
|
+
*/
|
|
255
|
+
async mergeChapters(setId, chapterIds, options) {
|
|
256
|
+
return this.client.post(`${this.basePath}/${setId}/chapters/merge`, {
|
|
257
|
+
chapter_ids: chapterIds,
|
|
258
|
+
...options
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Split a chapter at a specific time
|
|
263
|
+
*
|
|
264
|
+
* Requires: chapters:update permission
|
|
265
|
+
*/
|
|
266
|
+
async splitChapter(setId, chapterId, splitTime, options) {
|
|
267
|
+
return this.client.post(`${this.basePath}/${setId}/chapters/${chapterId}/split`, {
|
|
268
|
+
split_time: splitTime,
|
|
269
|
+
...options
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
function createChaptersAPI(client) {
|
|
274
|
+
return new ChaptersAPI(client);
|
|
275
|
+
}
|
|
276
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
277
|
+
0 && (module.exports = {
|
|
278
|
+
ChaptersAPI,
|
|
279
|
+
createChaptersAPI
|
|
280
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/qr.ts
|
|
2
|
+
var QrAPI = class {
|
|
3
|
+
client;
|
|
4
|
+
basePath = "/v1/qr";
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
async create(request) {
|
|
9
|
+
return this.client.post(this.basePath, request);
|
|
10
|
+
}
|
|
11
|
+
async get(qrId) {
|
|
12
|
+
return this.client.get(`${this.basePath}/${qrId}`);
|
|
13
|
+
}
|
|
14
|
+
async update(qrId, updates) {
|
|
15
|
+
return this.client.patch(`${this.basePath}/${qrId}`, updates);
|
|
16
|
+
}
|
|
17
|
+
async remove(qrId) {
|
|
18
|
+
await this.client.delete(`${this.basePath}/${qrId}`);
|
|
19
|
+
}
|
|
20
|
+
async list(params) {
|
|
21
|
+
return this.client.get(this.basePath, {
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async getAnalytics(qrId, params) {
|
|
26
|
+
return this.client.get(`${this.basePath}/${qrId}/analytics`, {
|
|
27
|
+
params
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async createBatch(items) {
|
|
31
|
+
return this.client.post(`${this.basePath}/batch`, { items });
|
|
32
|
+
}
|
|
33
|
+
async getImage(qrId, format, size) {
|
|
34
|
+
return this.client.get(`${this.basePath}/${qrId}/image`, {
|
|
35
|
+
params: { format, size }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function createQrAPI(client) {
|
|
40
|
+
return new QrAPI(client);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
QrAPI,
|
|
45
|
+
createQrAPI
|
|
46
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/podcast.ts
|
|
2
|
+
var PodcastAPI = class {
|
|
3
|
+
client;
|
|
4
|
+
basePath = "/v1/podcasts";
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
async create(request) {
|
|
9
|
+
return this.client.post(this.basePath, request);
|
|
10
|
+
}
|
|
11
|
+
async get(podcastId) {
|
|
12
|
+
return this.client.get(`${this.basePath}/${podcastId}`);
|
|
13
|
+
}
|
|
14
|
+
async update(podcastId, updates) {
|
|
15
|
+
return this.client.patch(`${this.basePath}/${podcastId}`, updates);
|
|
16
|
+
}
|
|
17
|
+
async remove(podcastId) {
|
|
18
|
+
await this.client.delete(`${this.basePath}/${podcastId}`);
|
|
19
|
+
}
|
|
20
|
+
async list(params) {
|
|
21
|
+
return this.client.get(this.basePath, {
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async createEpisode(request) {
|
|
26
|
+
return this.client.post(`${this.basePath}/${request.podcast_id}/episodes`, request);
|
|
27
|
+
}
|
|
28
|
+
async getEpisode(episodeId) {
|
|
29
|
+
return this.client.get(`/v1/episodes/${episodeId}`);
|
|
30
|
+
}
|
|
31
|
+
async updateEpisode(episodeId, updates) {
|
|
32
|
+
return this.client.patch(`/v1/episodes/${episodeId}`, updates);
|
|
33
|
+
}
|
|
34
|
+
async removeEpisode(episodeId) {
|
|
35
|
+
await this.client.delete(`/v1/episodes/${episodeId}`);
|
|
36
|
+
}
|
|
37
|
+
async publishEpisode(episodeId) {
|
|
38
|
+
return this.client.post(`/v1/episodes/${episodeId}/publish`);
|
|
39
|
+
}
|
|
40
|
+
async listEpisodes(podcastId, params) {
|
|
41
|
+
return this.client.get(`${this.basePath}/${podcastId}/episodes`, {
|
|
42
|
+
params
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async getRSSFeed(podcastId) {
|
|
46
|
+
return this.client.get(`${this.basePath}/${podcastId}/rss`);
|
|
47
|
+
}
|
|
48
|
+
async getAnalytics(podcastId, params) {
|
|
49
|
+
return this.client.get(`${this.basePath}/${podcastId}/analytics`, {
|
|
50
|
+
params
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async distribute(podcastId, targets) {
|
|
54
|
+
return this.client.post(`${this.basePath}/${podcastId}/distribute`, {
|
|
55
|
+
targets
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async getDistributionStatus(podcastId) {
|
|
59
|
+
return this.client.get(`${this.basePath}/${podcastId}/distribution`);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function createPodcastAPI(client) {
|
|
63
|
+
return new PodcastAPI(client);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
PodcastAPI,
|
|
68
|
+
createPodcastAPI
|
|
69
|
+
};
|