@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 CHANGED
@@ -204,7 +204,15 @@ declare class TaskHandle {
204
204
  /** Artifact URLs, once completed. */
205
205
  urls(): string[];
206
206
  progress(): number | null;
207
+ /**
208
+ * Fetch current task state, remembering it once terminal.
209
+ *
210
+ * A caller that drives its own poll loop — checking status between polls so it
211
+ * can report progress — only ever calls this. Without recording here, urls()
212
+ * and result() stay empty after the task has plainly finished.
213
+ */
207
214
  get(): Promise<Record<string, unknown>>;
215
+ private accept;
208
216
  isCompleted(): Promise<boolean>;
209
217
  wait(opts?: TaskHandleOptions): Promise<Record<string, unknown>>;
210
218
  get result(): Record<string, unknown> | null;
package/dist/index.d.ts CHANGED
@@ -204,7 +204,15 @@ declare class TaskHandle {
204
204
  /** Artifact URLs, once completed. */
205
205
  urls(): string[];
206
206
  progress(): number | null;
207
+ /**
208
+ * Fetch current task state, remembering it once terminal.
209
+ *
210
+ * A caller that drives its own poll loop — checking status between polls so it
211
+ * can report progress — only ever calls this. Without recording here, urls()
212
+ * and result() stay empty after the task has plainly finished.
213
+ */
207
214
  get(): Promise<Record<string, unknown>>;
215
+ private accept;
208
216
  isCompleted(): Promise<boolean>;
209
217
  wait(opts?: TaskHandleOptions): Promise<Record<string, unknown>>;
210
218
  get result(): Record<string, unknown> | null;
package/dist/index.js CHANGED
@@ -596,15 +596,30 @@ var TaskHandle = class {
596
596
  progress() {
597
597
  return taskProgress(this._result);
598
598
  }
599
+ /**
600
+ * Fetch current task state, remembering it once terminal.
601
+ *
602
+ * A caller that drives its own poll loop — checking status between polls so it
603
+ * can report progress — only ever calls this. Without recording here, urls()
604
+ * and result() stay empty after the task has plainly finished.
605
+ */
599
606
  async get() {
600
- return this.transport.request("POST", this.pollEndpoint, {
607
+ const state = await this.transport.request("POST", this.pollEndpoint, {
601
608
  json: { id: this.id, action: "retrieve" }
602
609
  });
610
+ this.accept(state);
611
+ return state;
612
+ }
613
+ accept(state) {
614
+ const status = taskStatus(state);
615
+ if (status === "succeeded" || status === "failed") {
616
+ this._result = state;
617
+ }
603
618
  }
604
619
  async isCompleted() {
605
620
  if (this.done) return true;
606
- const status = taskStatus(await this.get());
607
- return status === "succeeded" || status === "failed";
621
+ await this.get();
622
+ return this.done;
608
623
  }
609
624
  async wait(opts = {}) {
610
625
  if (this._result !== null) return this._result;
@@ -613,11 +628,7 @@ var TaskHandle = class {
613
628
  const start = Date.now();
614
629
  while (Date.now() - start < maxWait) {
615
630
  const state = await this.get();
616
- const status = taskStatus(state);
617
- if (status === "succeeded" || status === "failed") {
618
- this._result = state;
619
- return state;
620
- }
631
+ if (this.done) return state;
621
632
  await new Promise((resolve) => setTimeout(resolve, pollInterval));
622
633
  }
623
634
  throw new Error(`Task ${this.id} did not complete within ${maxWait}ms`);
@@ -1839,7 +1850,7 @@ var Producer = class {
1839
1850
  return await this.transport.request("POST", "/producer/upload", { json: body });
1840
1851
  }
1841
1852
  /** AceData Producer MP4 retrieval API. Pass an audio_id to receive an MP4 video download link with cover art. */
1842
- async generate(options) {
1853
+ async videos(options) {
1843
1854
  const body = {};
1844
1855
  body["audio_id"] = options.audioId;
1845
1856
  for (const [key, value] of Object.entries(options)) {
@@ -1863,7 +1874,7 @@ var Producer = class {
1863
1874
  return await this.transport.request("POST", "/producer/wav", { json: body });
1864
1875
  }
1865
1876
  /** Producer AI music generation API, generates 1 song per request. */
1866
- async producer_audios(options) {
1877
+ async generate(options) {
1867
1878
  const body = {};
1868
1879
  body["lyric"] = options.lyric;
1869
1880
  body["action"] = options.action;