@docmana/sdk 0.15.1 → 0.15.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.
@@ -1,3 +1,3 @@
1
1
  import type { HttpClient } from "../http/http-client.js";
2
2
  import type { DocmanaExecutionResult } from "../types.js";
3
- export declare function getResult(http: HttpClient, executionResultId: string, signal?: AbortSignal, language?: string): Promise<DocmanaExecutionResult>;
3
+ export declare function getResult(http: HttpClient, executionResultId: string, signal?: AbortSignal, language?: string, organization?: string): Promise<DocmanaExecutionResult>;
@@ -1,6 +1,6 @@
1
1
  import type { HttpClient } from "../http/http-client.js";
2
2
  import type { ExecutionStatus } from "../types.js";
3
- export declare function getStatus(http: HttpClient, executionResultId: string, signal?: AbortSignal): Promise<{
3
+ export declare function getStatus(http: HttpClient, executionResultId: string, signal?: AbortSignal, organization?: string): Promise<{
4
4
  status: ExecutionStatus | string;
5
5
  pollAfterMs?: number;
6
6
  }>;
package/dist/cli.mjs CHANGED
@@ -298,8 +298,11 @@ function isTerminalStatus(status) {
298
298
  }
299
299
 
300
300
  // src/sdk/api/execution-status.ts
301
- async function getStatus(http, executionResultId, signal) {
302
- const res = await http.requestRaw("GET", `/executions/${executionResultId}/status`, { signal });
301
+ async function getStatus(http, executionResultId, signal, organization) {
302
+ const res = await http.requestRaw("GET", `/executions/${executionResultId}/status`, {
303
+ query: organization ? { organization } : void 0,
304
+ signal
305
+ });
303
306
  const text = await res.text();
304
307
  const body = text ? JSON.parse(text) : { status: "" };
305
308
  const normalizedBody = { ...body, status: normalizeStatus(body.status) };
@@ -320,9 +323,12 @@ function parsePositiveInt(value) {
320
323
  }
321
324
 
322
325
  // src/sdk/api/execution-result.ts
323
- async function getResult(http, executionResultId, signal, language) {
326
+ async function getResult(http, executionResultId, signal, language, organization) {
327
+ const query = {};
328
+ if (language) query.language = language;
329
+ if (organization) query.organization = organization;
324
330
  return http.requestJson("GET", `/executions/${executionResultId}/result`, {
325
- query: language ? { language } : void 0,
331
+ query: Object.keys(query).length > 0 ? query : void 0,
326
332
  signal
327
333
  });
328
334
  }
@@ -524,11 +530,11 @@ var Docmana = class {
524
530
  params.organization
525
531
  );
526
532
  }
527
- async getStatus(executionResultId, signal) {
528
- return getStatus(this.http, executionResultId, signal);
533
+ async getStatus(executionResultId, signal, organization) {
534
+ return getStatus(this.http, executionResultId, signal, organization);
529
535
  }
530
- async getResult(executionResultId, signal, language) {
531
- return getResult(this.http, executionResultId, signal, language);
536
+ async getResult(executionResultId, signal, language, organization) {
537
+ return getResult(this.http, executionResultId, signal, language, organization);
532
538
  }
533
539
  async runFlow(flowId, params, options = {}) {
534
540
  const { executionResultId } = await this.runFlowAsync(flowId, params, {
@@ -540,7 +546,11 @@ var Docmana = class {
540
546
  check: async () => {
541
547
  attempt += 1;
542
548
  try {
543
- const statusResult = await this.getStatus(executionResultId, options.signal);
549
+ const statusResult = await this.getStatus(
550
+ executionResultId,
551
+ options.signal,
552
+ params.organization
553
+ );
544
554
  const status = statusResult.status;
545
555
  const nextPollAfterMs = this.isTerminalStatus(status) ? void 0 : statusResult.pollAfterMs;
546
556
  options.onPoll?.({
@@ -568,7 +578,12 @@ var Docmana = class {
568
578
  timeoutMs: options.timeoutMs ?? this.config.timeoutMs,
569
579
  signal: options.signal
570
580
  });
571
- const result = await this.getResult(executionResultId, options.signal, params.language);
581
+ const result = await this.getResult(
582
+ executionResultId,
583
+ options.signal,
584
+ params.language,
585
+ params.organization
586
+ );
572
587
  if (isFailedStatus(result.status)) {
573
588
  throw new DocmanaExecutionError(
574
589
  `Flow ${flowId} execution failed`,