@acedatacloud/sdk 2026.727.0 → 2026.727.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.
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/providers/producer.ts +4 -4
- package/src/runtime/tasks.ts +20 -9
package/dist/index.mjs
CHANGED
|
@@ -548,15 +548,30 @@ var TaskHandle = class {
|
|
|
548
548
|
progress() {
|
|
549
549
|
return taskProgress(this._result);
|
|
550
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Fetch current task state, remembering it once terminal.
|
|
553
|
+
*
|
|
554
|
+
* A caller that drives its own poll loop — checking status between polls so it
|
|
555
|
+
* can report progress — only ever calls this. Without recording here, urls()
|
|
556
|
+
* and result() stay empty after the task has plainly finished.
|
|
557
|
+
*/
|
|
551
558
|
async get() {
|
|
552
|
-
|
|
559
|
+
const state = await this.transport.request("POST", this.pollEndpoint, {
|
|
553
560
|
json: { id: this.id, action: "retrieve" }
|
|
554
561
|
});
|
|
562
|
+
this.accept(state);
|
|
563
|
+
return state;
|
|
564
|
+
}
|
|
565
|
+
accept(state) {
|
|
566
|
+
const status = taskStatus(state);
|
|
567
|
+
if (status === "succeeded" || status === "failed") {
|
|
568
|
+
this._result = state;
|
|
569
|
+
}
|
|
555
570
|
}
|
|
556
571
|
async isCompleted() {
|
|
557
572
|
if (this.done) return true;
|
|
558
|
-
|
|
559
|
-
return
|
|
573
|
+
await this.get();
|
|
574
|
+
return this.done;
|
|
560
575
|
}
|
|
561
576
|
async wait(opts = {}) {
|
|
562
577
|
if (this._result !== null) return this._result;
|
|
@@ -565,11 +580,7 @@ var TaskHandle = class {
|
|
|
565
580
|
const start = Date.now();
|
|
566
581
|
while (Date.now() - start < maxWait) {
|
|
567
582
|
const state = await this.get();
|
|
568
|
-
|
|
569
|
-
if (status === "succeeded" || status === "failed") {
|
|
570
|
-
this._result = state;
|
|
571
|
-
return state;
|
|
572
|
-
}
|
|
583
|
+
if (this.done) return state;
|
|
573
584
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
574
585
|
}
|
|
575
586
|
throw new Error(`Task ${this.id} did not complete within ${maxWait}ms`);
|
|
@@ -1791,7 +1802,7 @@ var Producer = class {
|
|
|
1791
1802
|
return await this.transport.request("POST", "/producer/upload", { json: body });
|
|
1792
1803
|
}
|
|
1793
1804
|
/** AceData Producer MP4 retrieval API. Pass an audio_id to receive an MP4 video download link with cover art. */
|
|
1794
|
-
async
|
|
1805
|
+
async videos(options) {
|
|
1795
1806
|
const body = {};
|
|
1796
1807
|
body["audio_id"] = options.audioId;
|
|
1797
1808
|
for (const [key, value] of Object.entries(options)) {
|
|
@@ -1815,7 +1826,7 @@ var Producer = class {
|
|
|
1815
1826
|
return await this.transport.request("POST", "/producer/wav", { json: body });
|
|
1816
1827
|
}
|
|
1817
1828
|
/** Producer AI music generation API, generates 1 song per request. */
|
|
1818
|
-
async
|
|
1829
|
+
async generate(options) {
|
|
1819
1830
|
const body = {};
|
|
1820
1831
|
body["lyric"] = options.lyric;
|
|
1821
1832
|
body["action"] = options.action;
|