@wave-av/sdk 2.0.1 → 2.0.2

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.
Files changed (260) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +27 -23
  3. package/dist/audience.js +93 -0
  4. package/dist/audience.mjs +9 -0
  5. package/dist/camera-control.js +95 -0
  6. package/dist/camera-control.mjs +71 -0
  7. package/dist/captions-types.js +18 -0
  8. package/dist/captions-types.mjs +0 -0
  9. package/dist/captions.js +266 -0
  10. package/dist/captions.mjs +9 -0
  11. package/dist/chapters-types.js +18 -0
  12. package/dist/chapters-types.mjs +0 -0
  13. package/dist/chapters.js +280 -0
  14. package/dist/chapters.mjs +9 -0
  15. package/dist/chunk-362MRITF.mjs +46 -0
  16. package/dist/chunk-3ZLK4J3V.mjs +69 -0
  17. package/dist/chunk-4DG4OBRD.mjs +52 -0
  18. package/dist/chunk-4G7FMCMJ.mjs +68 -0
  19. package/dist/chunk-4KD5F6E3.mjs +0 -0
  20. package/dist/chunk-7M6XVUUK.mjs +241 -0
  21. package/dist/chunk-A344OOT7.mjs +243 -0
  22. package/dist/chunk-AI64YR5W.mjs +173 -0
  23. package/dist/chunk-C2GQ756E.mjs +57 -0
  24. package/dist/chunk-CO2VB72Z.mjs +255 -0
  25. package/dist/chunk-DWXWAILB.mjs +44 -0
  26. package/dist/chunk-FLEFYLDM.mjs +71 -0
  27. package/dist/chunk-H2YYTNUH.mjs +266 -0
  28. package/dist/chunk-IGDBED5P.mjs +246 -0
  29. package/dist/chunk-IL2SGWBC.mjs +0 -0
  30. package/dist/chunk-IVFZ5X4W.mjs +68 -0
  31. package/dist/chunk-JC32PG3T.mjs +114 -0
  32. package/dist/chunk-K5X42NLD.mjs +54 -0
  33. package/dist/chunk-KCEPNS2U.mjs +276 -0
  34. package/dist/chunk-LVOVF6XC.mjs +54 -0
  35. package/dist/chunk-M4Z33V3N.mjs +247 -0
  36. package/dist/chunk-M6FKIX75.mjs +0 -0
  37. package/dist/chunk-M744Z327.mjs +244 -0
  38. package/dist/chunk-MRFDPPFK.mjs +61 -0
  39. package/dist/chunk-MXU3Q23F.mjs +68 -0
  40. package/dist/chunk-NCVUZ746.mjs +60 -0
  41. package/dist/chunk-NLQVD2LF.mjs +210 -0
  42. package/dist/chunk-O6DOGYP5.mjs +238 -0
  43. package/dist/chunk-S25NY5GE.mjs +124 -0
  44. package/dist/chunk-TFHXBICQ.mjs +305 -0
  45. package/dist/chunk-TXWOA2VR.mjs +57 -0
  46. package/dist/chunk-UCDSNV22.mjs +63 -0
  47. package/dist/chunk-V5DWA5P4.mjs +279 -0
  48. package/dist/chunk-VLQQDYGP.mjs +173 -0
  49. package/dist/chunk-VPKZUXZW.mjs +53 -0
  50. package/dist/chunk-WS3PEFYJ.mjs +60 -0
  51. package/dist/chunk-XGAYMWRH.mjs +74 -0
  52. package/dist/chunk-XMM5J57W.mjs +0 -0
  53. package/dist/chunk-XWABBOSX.mjs +278 -0
  54. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  55. package/dist/chunk-YBLXHI3M.mjs +257 -0
  56. package/dist/chunk-YEK26SSO.mjs +100 -0
  57. package/dist/chunk-YLCQKCZL.mjs +0 -0
  58. package/dist/chunk-YRKO4XI7.mjs +0 -0
  59. package/dist/chunk-ZJO7AP4Q.mjs +0 -0
  60. package/dist/client-types.js +18 -0
  61. package/dist/client-types.mjs +0 -0
  62. package/dist/client.js +311 -0
  63. package/dist/client.mjs +14 -0
  64. package/dist/clips-types.js +18 -0
  65. package/dist/clips-types.mjs +0 -0
  66. package/dist/clips.js +198 -0
  67. package/dist/clips.mjs +9 -0
  68. package/dist/cloud-switcher.js +80 -0
  69. package/dist/cloud-switcher.mjs +56 -0
  70. package/dist/collab-types.js +18 -0
  71. package/dist/collab-types.mjs +1 -0
  72. package/dist/collab.js +304 -0
  73. package/dist/collab.mjs +10 -0
  74. package/dist/connect.js +85 -0
  75. package/dist/connect.mjs +9 -0
  76. package/dist/creator.js +79 -0
  77. package/dist/creator.mjs +9 -0
  78. package/dist/desktop.js +77 -0
  79. package/dist/desktop.mjs +9 -0
  80. package/dist/distribution.js +88 -0
  81. package/dist/distribution.mjs +9 -0
  82. package/dist/drm.js +85 -0
  83. package/dist/drm.mjs +9 -0
  84. package/dist/edge.js +93 -0
  85. package/dist/edge.mjs +9 -0
  86. package/dist/editor-types.js +18 -0
  87. package/dist/editor-types.mjs +1 -0
  88. package/dist/editor.js +330 -0
  89. package/dist/editor.mjs +10 -0
  90. package/dist/fleet.js +149 -0
  91. package/dist/fleet.mjs +9 -0
  92. package/dist/ghost.js +139 -0
  93. package/dist/ghost.mjs +9 -0
  94. package/dist/index.js +0 -250
  95. package/dist/index.mjs +161 -5445
  96. package/dist/marketplace.js +82 -0
  97. package/dist/marketplace.mjs +9 -0
  98. package/dist/mesh.js +198 -0
  99. package/dist/mesh.mjs +9 -0
  100. package/dist/notifications.js +79 -0
  101. package/dist/notifications.mjs +9 -0
  102. package/dist/phone-types.js +18 -0
  103. package/dist/phone-types.mjs +0 -0
  104. package/dist/phone.js +269 -0
  105. package/dist/phone.mjs +9 -0
  106. package/dist/pipeline-types.js +18 -0
  107. package/dist/pipeline-types.mjs +0 -0
  108. package/dist/pipeline.js +263 -0
  109. package/dist/pipeline.mjs +9 -0
  110. package/dist/podcast.js +94 -0
  111. package/dist/podcast.mjs +9 -0
  112. package/dist/prism.js +82 -0
  113. package/dist/prism.mjs +9 -0
  114. package/dist/prompter.js +99 -0
  115. package/dist/prompter.mjs +76 -0
  116. package/dist/pulse.js +99 -0
  117. package/dist/pulse.mjs +9 -0
  118. package/dist/qr.js +71 -0
  119. package/dist/qr.mjs +9 -0
  120. package/dist/replay.js +62 -0
  121. package/dist/replay.mjs +38 -0
  122. package/dist/scene-types.js +18 -0
  123. package/dist/scene-types.mjs +1 -0
  124. package/dist/scene.js +271 -0
  125. package/dist/scene.mjs +10 -0
  126. package/dist/search-types.js +18 -0
  127. package/dist/search-types.mjs +1 -0
  128. package/dist/search.js +268 -0
  129. package/dist/search.mjs +10 -0
  130. package/dist/sentiment-types.js +18 -0
  131. package/dist/sentiment-types.mjs +0 -0
  132. package/dist/sentiment.js +235 -0
  133. package/dist/sentiment.mjs +9 -0
  134. package/dist/signage.js +93 -0
  135. package/dist/signage.mjs +9 -0
  136. package/dist/slides.js +78 -0
  137. package/dist/slides.mjs +9 -0
  138. package/dist/studio-ai-types.js +18 -0
  139. package/dist/studio-ai-types.mjs +1 -0
  140. package/dist/studio-ai.js +301 -0
  141. package/dist/studio-ai.mjs +10 -0
  142. package/dist/studio-types.js +18 -0
  143. package/dist/studio-types.mjs +1 -0
  144. package/dist/studio.js +303 -0
  145. package/dist/studio.mjs +10 -0
  146. package/dist/telemetry.js +124 -0
  147. package/dist/telemetry.mjs +15 -0
  148. package/dist/transcribe-types.js +18 -0
  149. package/dist/transcribe-types.mjs +1 -0
  150. package/dist/transcribe.js +282 -0
  151. package/dist/transcribe.mjs +10 -0
  152. package/dist/usb.js +69 -0
  153. package/dist/usb.mjs +9 -0
  154. package/dist/vault.js +96 -0
  155. package/dist/vault.mjs +9 -0
  156. package/dist/voice-types.js +18 -0
  157. package/dist/voice-types.mjs +0 -0
  158. package/dist/voice.js +272 -0
  159. package/dist/voice.mjs +9 -0
  160. package/dist/zoom.js +86 -0
  161. package/dist/zoom.mjs +9 -0
  162. package/package.json +3 -3
  163. package/dist/audience.d.ts +0 -104
  164. package/dist/audience.d.ts.map +0 -1
  165. package/dist/camera-control.d.ts +0 -54
  166. package/dist/camera-control.d.ts.map +0 -1
  167. package/dist/captions.d.ts +0 -362
  168. package/dist/captions.d.ts.map +0 -1
  169. package/dist/chapters.d.ts +0 -315
  170. package/dist/chapters.d.ts.map +0 -1
  171. package/dist/client.d.ts +0 -191
  172. package/dist/client.d.ts.map +0 -1
  173. package/dist/clips.d.ts +0 -258
  174. package/dist/clips.d.ts.map +0 -1
  175. package/dist/cloud-switcher.d.ts +0 -65
  176. package/dist/cloud-switcher.d.ts.map +0 -1
  177. package/dist/collab-types.d.ts +0 -204
  178. package/dist/collab-types.d.ts.map +0 -1
  179. package/dist/collab.d.ts +0 -226
  180. package/dist/collab.d.ts.map +0 -1
  181. package/dist/connect.d.ts +0 -88
  182. package/dist/connect.d.ts.map +0 -1
  183. package/dist/creator.d.ts +0 -109
  184. package/dist/creator.d.ts.map +0 -1
  185. package/dist/desktop.d.ts +0 -95
  186. package/dist/desktop.d.ts.map +0 -1
  187. package/dist/distribution.d.ts +0 -92
  188. package/dist/distribution.d.ts.map +0 -1
  189. package/dist/drm.d.ts +0 -87
  190. package/dist/drm.d.ts.map +0 -1
  191. package/dist/edge.d.ts +0 -112
  192. package/dist/edge.d.ts.map +0 -1
  193. package/dist/editor-types.d.ts +0 -236
  194. package/dist/editor-types.d.ts.map +0 -1
  195. package/dist/editor.d.ts +0 -206
  196. package/dist/editor.d.ts.map +0 -1
  197. package/dist/fleet.d.ts +0 -207
  198. package/dist/fleet.d.ts.map +0 -1
  199. package/dist/ghost.d.ts +0 -213
  200. package/dist/ghost.d.ts.map +0 -1
  201. package/dist/index.d.ts +0 -144
  202. package/dist/index.d.ts.map +0 -1
  203. package/dist/marketplace.d.ts +0 -90
  204. package/dist/marketplace.d.ts.map +0 -1
  205. package/dist/mesh.d.ts +0 -237
  206. package/dist/mesh.d.ts.map +0 -1
  207. package/dist/notifications.d.ts +0 -82
  208. package/dist/notifications.d.ts.map +0 -1
  209. package/dist/phone.d.ts +0 -369
  210. package/dist/phone.d.ts.map +0 -1
  211. package/dist/pipeline.d.ts +0 -409
  212. package/dist/pipeline.d.ts.map +0 -1
  213. package/dist/podcast.d.ts +0 -113
  214. package/dist/podcast.d.ts.map +0 -1
  215. package/dist/prism.d.ts +0 -132
  216. package/dist/prism.d.ts.map +0 -1
  217. package/dist/prompter.d.ts +0 -184
  218. package/dist/prompter.d.ts.map +0 -1
  219. package/dist/pulse.d.ts +0 -156
  220. package/dist/pulse.d.ts.map +0 -1
  221. package/dist/qr.d.ts +0 -82
  222. package/dist/qr.d.ts.map +0 -1
  223. package/dist/replay.d.ts +0 -52
  224. package/dist/replay.d.ts.map +0 -1
  225. package/dist/scene-types.d.ts +0 -190
  226. package/dist/scene-types.d.ts.map +0 -1
  227. package/dist/scene.d.ts +0 -213
  228. package/dist/scene.d.ts.map +0 -1
  229. package/dist/search-types.d.ts +0 -210
  230. package/dist/search-types.d.ts.map +0 -1
  231. package/dist/search.d.ts +0 -250
  232. package/dist/search.d.ts.map +0 -1
  233. package/dist/sentiment.d.ts +0 -378
  234. package/dist/sentiment.d.ts.map +0 -1
  235. package/dist/signage.d.ts +0 -101
  236. package/dist/signage.d.ts.map +0 -1
  237. package/dist/slides.d.ts +0 -68
  238. package/dist/slides.d.ts.map +0 -1
  239. package/dist/studio-ai-types.d.ts +0 -198
  240. package/dist/studio-ai-types.d.ts.map +0 -1
  241. package/dist/studio-ai.d.ts +0 -218
  242. package/dist/studio-ai.d.ts.map +0 -1
  243. package/dist/studio-types.d.ts +0 -267
  244. package/dist/studio-types.d.ts.map +0 -1
  245. package/dist/studio.d.ts +0 -234
  246. package/dist/studio.d.ts.map +0 -1
  247. package/dist/telemetry.d.ts +0 -76
  248. package/dist/telemetry.d.ts.map +0 -1
  249. package/dist/transcribe-types.d.ts +0 -153
  250. package/dist/transcribe-types.d.ts.map +0 -1
  251. package/dist/transcribe.d.ts +0 -218
  252. package/dist/transcribe.d.ts.map +0 -1
  253. package/dist/usb.d.ts +0 -64
  254. package/dist/usb.d.ts.map +0 -1
  255. package/dist/vault.d.ts +0 -121
  256. package/dist/vault.d.ts.map +0 -1
  257. package/dist/voice.d.ts +0 -307
  258. package/dist/voice.d.ts.map +0 -1
  259. package/dist/zoom.d.ts +0 -91
  260. package/dist/zoom.d.ts.map +0 -1
package/dist/client.js ADDED
@@ -0,0 +1,311 @@
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/client.ts
21
+ var client_exports = {};
22
+ __export(client_exports, {
23
+ RateLimitError: () => RateLimitError,
24
+ WaveClient: () => WaveClient,
25
+ WaveError: () => WaveError,
26
+ createClient: () => createClient
27
+ });
28
+ module.exports = __toCommonJS(client_exports);
29
+ var import_eventemitter3 = require("eventemitter3");
30
+
31
+ // src/telemetry.ts
32
+ var resolvedTracer = null;
33
+ var telemetryEnabled = false;
34
+ function initTelemetry(config) {
35
+ if (!config.enabled) {
36
+ telemetryEnabled = false;
37
+ resolvedTracer = null;
38
+ return;
39
+ }
40
+ try {
41
+ const otelApi = require("@opentelemetry/api");
42
+ const serviceName = config.serviceName ?? "@wave/sdk";
43
+ resolvedTracer = otelApi.trace.getTracer(serviceName, "2.0.0");
44
+ telemetryEnabled = true;
45
+ } catch {
46
+ telemetryEnabled = false;
47
+ resolvedTracer = null;
48
+ }
49
+ }
50
+
51
+ // src/client.ts
52
+ var WaveError = class extends Error {
53
+ code;
54
+ statusCode;
55
+ requestId;
56
+ details;
57
+ retryable;
58
+ constructor(message, code, statusCode, requestId, details) {
59
+ super(message);
60
+ this.name = "WaveError";
61
+ this.code = code;
62
+ this.statusCode = statusCode;
63
+ this.requestId = requestId;
64
+ this.details = details;
65
+ this.retryable = this.isRetryable(statusCode, code);
66
+ }
67
+ };
68
+ var RateLimitError = class extends WaveError {
69
+ retryAfter;
70
+ constructor(message, retryAfter, requestId) {
71
+ super(message, "RATE_LIMITED", 429, requestId);
72
+ this.name = "RateLimitError";
73
+ this.retryAfter = retryAfter;
74
+ }
75
+ };
76
+ var WaveClient = class extends import_eventemitter3.EventEmitter {
77
+ config;
78
+ constructor(config) {
79
+ super();
80
+ if (!config.apiKey) {
81
+ throw new Error("WAVE SDK: apiKey is required");
82
+ }
83
+ this.config = {
84
+ apiKey: config.apiKey,
85
+ organizationId: config.organizationId || "",
86
+ baseUrl: config.baseUrl || "https://api.wave.online",
87
+ timeout: config.timeout || 3e4,
88
+ maxRetries: config.maxRetries ?? 3,
89
+ debug: config.debug || false,
90
+ customHeaders: config.customHeaders || {},
91
+ telemetry: config.telemetry
92
+ };
93
+ if (config.telemetry) {
94
+ initTelemetry(config.telemetry);
95
+ }
96
+ }
97
+ /**
98
+ * Make a GET request
99
+ */
100
+ async get(path, options) {
101
+ return this.request(path, { ...options, method: "GET" });
102
+ }
103
+ /**
104
+ * Make a POST request
105
+ */
106
+ async post(path, body, options) {
107
+ return this.request(path, {
108
+ ...options,
109
+ method: "POST",
110
+ body: body ? JSON.stringify(body) : void 0
111
+ });
112
+ }
113
+ /**
114
+ * Make a PUT request
115
+ */
116
+ async put(path, body, options) {
117
+ return this.request(path, {
118
+ ...options,
119
+ method: "PUT",
120
+ body: body ? JSON.stringify(body) : void 0
121
+ });
122
+ }
123
+ /**
124
+ * Make a PATCH request
125
+ */
126
+ async patch(path, body, options) {
127
+ return this.request(path, {
128
+ ...options,
129
+ method: "PATCH",
130
+ body: body ? JSON.stringify(body) : void 0
131
+ });
132
+ }
133
+ /**
134
+ * Make a DELETE request
135
+ */
136
+ async delete(path, options) {
137
+ return this.request(path, { ...options, method: "DELETE" });
138
+ }
139
+ /**
140
+ * Make an API request with retry logic
141
+ */
142
+ async request(path, options = {}) {
143
+ const { params, noRetry, timeout: requestTimeout, ...fetchOptions } = options;
144
+ let url = `${this.config.baseUrl}${path}`;
145
+ if (params) {
146
+ const searchParams = new URLSearchParams();
147
+ Object.entries(params).forEach(([key, value]) => {
148
+ if (value !== void 0) {
149
+ searchParams.set(key, String(value));
150
+ }
151
+ });
152
+ const queryString = searchParams.toString();
153
+ if (queryString) {
154
+ url += `?${queryString}`;
155
+ }
156
+ }
157
+ return this.executeWithRetry(
158
+ url,
159
+ {
160
+ ...fetchOptions,
161
+ headers: this.buildHeaders(fetchOptions.headers)
162
+ },
163
+ noRetry ? 0 : this.config.maxRetries,
164
+ requestTimeout || this.config.timeout
165
+ );
166
+ }
167
+ /**
168
+ * Execute request with exponential backoff retry
169
+ */
170
+ async executeWithRetry(url, options, maxRetries, timeout) {
171
+ const method = options.method || "GET";
172
+ let lastError = null;
173
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
174
+ try {
175
+ this.emit("request.start", url, method);
176
+ const startTime = Date.now();
177
+ const response = await this.fetchWithTimeout(url, options, timeout);
178
+ const duration = Date.now() - startTime;
179
+ if (response.status === 429) {
180
+ const retryAfter = this.parseRetryAfter(response);
181
+ this.emit("rate_limit.hit", retryAfter);
182
+ if (attempt < maxRetries) {
183
+ this.emit("request.retry", url, method, attempt + 1, retryAfter);
184
+ await this.sleep(retryAfter);
185
+ continue;
186
+ }
187
+ throw new RateLimitError(
188
+ "Rate limit exceeded",
189
+ retryAfter,
190
+ response.headers.get("x-request-id") || void 0
191
+ );
192
+ }
193
+ if (!response.ok) {
194
+ const error = await this.parseErrorResponse(response);
195
+ if (error.retryable && attempt < maxRetries) {
196
+ const delay = this.calculateBackoff(attempt);
197
+ this.emit("request.retry", url, method, attempt + 1, delay);
198
+ await this.sleep(delay);
199
+ continue;
200
+ }
201
+ throw error;
202
+ }
203
+ this.emit("request.success", url, method, duration);
204
+ const contentType = response.headers.get("content-type");
205
+ if (contentType?.includes("application/json")) {
206
+ return response.json();
207
+ }
208
+ return {};
209
+ } catch (error) {
210
+ lastError = error;
211
+ if (error instanceof WaveError && !error.retryable) {
212
+ throw error;
213
+ }
214
+ if (error instanceof TypeError || error instanceof Error && error.name === "AbortError") {
215
+ if (attempt < maxRetries) {
216
+ const delay = this.calculateBackoff(attempt);
217
+ this.emit("request.retry", url, method, attempt + 1, delay);
218
+ await this.sleep(delay);
219
+ continue;
220
+ }
221
+ }
222
+ this.emit("request.error", url, method, error);
223
+ }
224
+ }
225
+ throw lastError || new WaveError("Request failed after retries", "UNKNOWN_ERROR", 0);
226
+ }
227
+ /**
228
+ * Fetch with timeout
229
+ */
230
+ async fetchWithTimeout(url, options, timeout) {
231
+ const controller = new AbortController();
232
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
233
+ try {
234
+ const response = await fetch(url, {
235
+ ...options,
236
+ signal: controller.signal
237
+ });
238
+ return response;
239
+ } finally {
240
+ clearTimeout(timeoutId);
241
+ }
242
+ }
243
+ /**
244
+ * Build request headers
245
+ */
246
+ buildHeaders(additionalHeaders) {
247
+ const headers = {
248
+ "Authorization": `Bearer ${this.config.apiKey}`,
249
+ "Content-Type": "application/json",
250
+ "Accept": "application/json",
251
+ "User-Agent": `wave-sdk-typescript/1.0.0`,
252
+ ...this.config.customHeaders
253
+ };
254
+ if (this.config.organizationId) {
255
+ headers["X-Organization-Id"] = this.config.organizationId;
256
+ }
257
+ if (additionalHeaders) {
258
+ if (additionalHeaders instanceof Headers) {
259
+ additionalHeaders.forEach((value, key) => {
260
+ headers[key] = value;
261
+ });
262
+ } else if (Array.isArray(additionalHeaders)) {
263
+ additionalHeaders.forEach(([key, value]) => {
264
+ headers[key] = value;
265
+ });
266
+ } else {
267
+ Object.assign(headers, additionalHeaders);
268
+ }
269
+ }
270
+ return headers;
271
+ }
272
+ /**
273
+ * Parse error response
274
+ */
275
+ /**
276
+ * Parse Retry-After header
277
+ */
278
+ /**
279
+ * Calculate exponential backoff delay
280
+ */
281
+ calculateBackoff(attempt) {
282
+ const baseDelay = 1e3;
283
+ const maxDelay = 3e4;
284
+ const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
285
+ return delay + Math.random() * delay * 0.25;
286
+ }
287
+ /**
288
+ * Sleep utility
289
+ */
290
+ sleep(ms) {
291
+ return new Promise((resolve) => setTimeout(resolve, ms));
292
+ }
293
+ /**
294
+ * Log debug message
295
+ */
296
+ log(message, ...args) {
297
+ if (this.config.debug) {
298
+ console.log(`[WaveSDK] ${message}`, ...args);
299
+ }
300
+ }
301
+ };
302
+ function createClient(config) {
303
+ return new WaveClient(config);
304
+ }
305
+ // Annotate the CommonJS export names for ESM import in node:
306
+ 0 && (module.exports = {
307
+ RateLimitError,
308
+ WaveClient,
309
+ WaveError,
310
+ createClient
311
+ });
@@ -0,0 +1,14 @@
1
+ import {
2
+ RateLimitError,
3
+ WaveClient,
4
+ WaveError,
5
+ createClient
6
+ } from "./chunk-H2YYTNUH.mjs";
7
+ import "./chunk-YEK26SSO.mjs";
8
+ import "./chunk-Y6FXYEAI.mjs";
9
+ export {
10
+ RateLimitError,
11
+ WaveClient,
12
+ WaveError,
13
+ createClient
14
+ };
@@ -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/clips-types.ts
17
+ var clips_types_exports = {};
18
+ module.exports = __toCommonJS(clips_types_exports);
File without changes
package/dist/clips.js ADDED
@@ -0,0 +1,198 @@
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/clips.ts
21
+ var clips_exports = {};
22
+ __export(clips_exports, {
23
+ ClipsAPI: () => ClipsAPI,
24
+ createClipsAPI: () => createClipsAPI
25
+ });
26
+ module.exports = __toCommonJS(clips_exports);
27
+ var ClipsAPI = class {
28
+ client;
29
+ basePath = "/v1/clips";
30
+ constructor(client) {
31
+ this.client = client;
32
+ }
33
+ /**
34
+ * Create a new clip
35
+ *
36
+ * Requires: clips:create permission
37
+ */
38
+ async create(request) {
39
+ return this.client.post(this.basePath, request);
40
+ }
41
+ /**
42
+ * Get a clip by ID
43
+ *
44
+ * Requires: clips:read permission
45
+ */
46
+ async get(clipId) {
47
+ return this.client.get(`${this.basePath}/${clipId}`);
48
+ }
49
+ /**
50
+ * Update a clip
51
+ *
52
+ * Requires: clips:update permission
53
+ */
54
+ async update(clipId, request) {
55
+ return this.client.patch(`${this.basePath}/${clipId}`, request);
56
+ }
57
+ /**
58
+ * Remove a clip
59
+ *
60
+ * Requires: clips:remove permission (server-side RBAC enforced)
61
+ */
62
+ async remove(clipId) {
63
+ await this.client.delete(`${this.basePath}/${clipId}`);
64
+ }
65
+ /**
66
+ * List clips with optional filters
67
+ *
68
+ * Requires: clips:read permission
69
+ */
70
+ async list(params) {
71
+ const queryParams = {
72
+ limit: params?.limit,
73
+ offset: params?.offset,
74
+ cursor: params?.cursor,
75
+ status: params?.status,
76
+ source_type: params?.source_type,
77
+ source_id: params?.source_id,
78
+ created_after: params?.created_after,
79
+ created_before: params?.created_before,
80
+ order_by: params?.order_by,
81
+ order: params?.order
82
+ };
83
+ if (params?.tags?.length) {
84
+ queryParams["tags"] = params.tags.join(",");
85
+ }
86
+ return this.client.get(this.basePath, {
87
+ params: queryParams
88
+ });
89
+ }
90
+ /**
91
+ * Export a clip to a different format
92
+ *
93
+ * Requires: clips:export permission
94
+ */
95
+ async exportClip(clipId, request) {
96
+ return this.client.post(
97
+ `${this.basePath}/${clipId}/export`,
98
+ request
99
+ );
100
+ }
101
+ /**
102
+ * Get export job status
103
+ *
104
+ * Requires: clips:read permission
105
+ */
106
+ async getExport(clipId, exportId) {
107
+ return this.client.get(
108
+ `${this.basePath}/${clipId}/exports/${exportId}`
109
+ );
110
+ }
111
+ /**
112
+ * List all exports for a clip
113
+ *
114
+ * Requires: clips:read permission
115
+ */
116
+ async listExports(clipId, params) {
117
+ return this.client.get(
118
+ `${this.basePath}/${clipId}/exports`,
119
+ { params }
120
+ );
121
+ }
122
+ /**
123
+ * Detect highlights in source content
124
+ *
125
+ * Requires: clips:analyze permission
126
+ */
127
+ async detectHighlights(sourceType, sourceId, options) {
128
+ return this.client.post(
129
+ `${this.basePath}/highlights/detect`,
130
+ {
131
+ source_type: sourceType,
132
+ source_id: sourceId,
133
+ ...options
134
+ }
135
+ );
136
+ }
137
+ /**
138
+ * Generate clips from detected highlights
139
+ *
140
+ * Requires: clips:create permission
141
+ */
142
+ async createFromHighlights(sourceType, sourceId, options) {
143
+ return this.client.post(`${this.basePath}/highlights/create`, {
144
+ source_type: sourceType,
145
+ source_id: sourceId,
146
+ ...options
147
+ });
148
+ }
149
+ /**
150
+ * Wait for a clip to be ready
151
+ */
152
+ async waitForReady(clipId, options) {
153
+ const pollInterval = options?.pollInterval || 2e3;
154
+ const timeout = options?.timeout || 3e5;
155
+ const startTime = Date.now();
156
+ while (Date.now() - startTime < timeout) {
157
+ const clip = await this.get(clipId);
158
+ if (options?.onProgress) {
159
+ options.onProgress(clip);
160
+ }
161
+ if (clip.status === "ready") {
162
+ return clip;
163
+ }
164
+ if (clip.status === "failed") {
165
+ throw new Error(`Clip processing failed: ${clip.error || "Unknown error"}`);
166
+ }
167
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
168
+ }
169
+ throw new Error(`Clip processing timed out after ${timeout}ms`);
170
+ }
171
+ /**
172
+ * Wait for an export to be ready
173
+ */
174
+ async waitForExport(clipId, exportId, options) {
175
+ const pollInterval = options?.pollInterval || 2e3;
176
+ const timeout = options?.timeout || 3e5;
177
+ const startTime = Date.now();
178
+ while (Date.now() - startTime < timeout) {
179
+ const exportJob = await this.getExport(clipId, exportId);
180
+ if (exportJob.status === "ready") {
181
+ return exportJob;
182
+ }
183
+ if (exportJob.status === "failed") {
184
+ throw new Error(`Export failed: ${exportJob.error || "Unknown error"}`);
185
+ }
186
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
187
+ }
188
+ throw new Error(`Export timed out after ${timeout}ms`);
189
+ }
190
+ };
191
+ function createClipsAPI(client) {
192
+ return new ClipsAPI(client);
193
+ }
194
+ // Annotate the CommonJS export names for ESM import in node:
195
+ 0 && (module.exports = {
196
+ ClipsAPI,
197
+ createClipsAPI
198
+ });
package/dist/clips.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ ClipsAPI,
3
+ createClipsAPI
4
+ } from "./chunk-AI64YR5W.mjs";
5
+ import "./chunk-Y6FXYEAI.mjs";
6
+ export {
7
+ ClipsAPI,
8
+ createClipsAPI
9
+ };
@@ -0,0 +1,80 @@
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/cloud-switcher.ts
21
+ var cloud_switcher_exports = {};
22
+ __export(cloud_switcher_exports, {
23
+ CloudSwitcherAPI: () => CloudSwitcherAPI,
24
+ createCloudSwitcherAPI: () => createCloudSwitcherAPI
25
+ });
26
+ module.exports = __toCommonJS(cloud_switcher_exports);
27
+ var CloudSwitcherAPI = class {
28
+ client;
29
+ basePath = "/v1/switcher";
30
+ constructor(client) {
31
+ this.client = client;
32
+ }
33
+ async create(options) {
34
+ return this.client.post(this.basePath, options);
35
+ }
36
+ async get(switcherId) {
37
+ return this.client.get(`${this.basePath}/${switcherId}`);
38
+ }
39
+ async list() {
40
+ return this.client.get(this.basePath);
41
+ }
42
+ async remove(switcherId) {
43
+ await this.client.delete(`${this.basePath}/${switcherId}`);
44
+ }
45
+ async addSource(switcherId, options) {
46
+ return this.client.post(`${this.basePath}/${switcherId}/sources`, options);
47
+ }
48
+ async removeSource(switcherId, sourceId) {
49
+ await this.client.delete(`${this.basePath}/${switcherId}/sources/${sourceId}`);
50
+ }
51
+ async switchTo(switcherId, sourceId) {
52
+ await this.client.post(`${this.basePath}/${switcherId}/control`, { type: "switch", sourceId });
53
+ }
54
+ async transition(switcherId, options) {
55
+ await this.client.post(`${this.basePath}/${switcherId}/control`, { type: "transition", config: options });
56
+ }
57
+ async addOutput(switcherId, options) {
58
+ return this.client.post(`${this.basePath}/${switcherId}/outputs`, options);
59
+ }
60
+ async startStreaming(switcherId, outputId) {
61
+ await this.client.post(`${this.basePath}/${switcherId}/outputs/${outputId}/start`, {});
62
+ }
63
+ async stopStreaming(switcherId, outputId) {
64
+ await this.client.post(`${this.basePath}/${switcherId}/outputs/${outputId}/stop`, {});
65
+ }
66
+ async startRecording(switcherId) {
67
+ await this.client.post(`${this.basePath}/${switcherId}/record/start`, {});
68
+ }
69
+ async stopRecording(switcherId) {
70
+ await this.client.post(`${this.basePath}/${switcherId}/record/stop`, {});
71
+ }
72
+ };
73
+ function createCloudSwitcherAPI(client) {
74
+ return new CloudSwitcherAPI(client);
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ CloudSwitcherAPI,
79
+ createCloudSwitcherAPI
80
+ });
@@ -0,0 +1,56 @@
1
+ import "./chunk-Y6FXYEAI.mjs";
2
+
3
+ // src/cloud-switcher.ts
4
+ var CloudSwitcherAPI = class {
5
+ client;
6
+ basePath = "/v1/switcher";
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(options) {
11
+ return this.client.post(this.basePath, options);
12
+ }
13
+ async get(switcherId) {
14
+ return this.client.get(`${this.basePath}/${switcherId}`);
15
+ }
16
+ async list() {
17
+ return this.client.get(this.basePath);
18
+ }
19
+ async remove(switcherId) {
20
+ await this.client.delete(`${this.basePath}/${switcherId}`);
21
+ }
22
+ async addSource(switcherId, options) {
23
+ return this.client.post(`${this.basePath}/${switcherId}/sources`, options);
24
+ }
25
+ async removeSource(switcherId, sourceId) {
26
+ await this.client.delete(`${this.basePath}/${switcherId}/sources/${sourceId}`);
27
+ }
28
+ async switchTo(switcherId, sourceId) {
29
+ await this.client.post(`${this.basePath}/${switcherId}/control`, { type: "switch", sourceId });
30
+ }
31
+ async transition(switcherId, options) {
32
+ await this.client.post(`${this.basePath}/${switcherId}/control`, { type: "transition", config: options });
33
+ }
34
+ async addOutput(switcherId, options) {
35
+ return this.client.post(`${this.basePath}/${switcherId}/outputs`, options);
36
+ }
37
+ async startStreaming(switcherId, outputId) {
38
+ await this.client.post(`${this.basePath}/${switcherId}/outputs/${outputId}/start`, {});
39
+ }
40
+ async stopStreaming(switcherId, outputId) {
41
+ await this.client.post(`${this.basePath}/${switcherId}/outputs/${outputId}/stop`, {});
42
+ }
43
+ async startRecording(switcherId) {
44
+ await this.client.post(`${this.basePath}/${switcherId}/record/start`, {});
45
+ }
46
+ async stopRecording(switcherId) {
47
+ await this.client.post(`${this.basePath}/${switcherId}/record/stop`, {});
48
+ }
49
+ };
50
+ function createCloudSwitcherAPI(client) {
51
+ return new CloudSwitcherAPI(client);
52
+ }
53
+ export {
54
+ CloudSwitcherAPI,
55
+ createCloudSwitcherAPI
56
+ };