Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/sdk/src/entities/application-run/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type { RunStatus } from './types.js';
export { getRunProgress, getRunStatus, canDownloadRunItems } from './utils.js';

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions packages/sdk/src/entities/application-run/types.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
import { RunReadResponse } from '../../generated/index.js';

/**
* Enriched application run entity that extends the raw API response
* with computed properties derived from run state and statistics.
*
* Returned by `PlatformSDKHttp.listApplicationRuns()` and `PlatformSDKHttp.getRun()`
* instead of the raw `RunReadResponse`.
*/
export interface ApplicationRun extends RunReadResponse {
/** Percentage of items processed (0–100), computed from run statistics. */
progress: number;
/** Human-readable status derived from `state` and `termination_reason`. */
status: RunStatus;
/** Whether the run's result items are available for download. */
can_download: boolean;
}

/** Derived run status that simplifies the raw `state` + `termination_reason` combination. */
export type RunStatus =
| 'PENDING'
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/entities/run-item/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { canDownloadItem, getItemStatus } from './utils.js';
export type { ItemStatus } from './types.js';
89 changes: 0 additions & 89 deletions packages/sdk/src/entities/run-item/process-run-item.spec.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/sdk/src/entities/run-item/process-run-item.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/sdk/src/entities/run-item/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
import { ItemResultReadResponse } from '../../generated/index.js';

/**
* Enriched run-item entity that extends the raw API response
* with computed properties derived from item state and termination reason.
*
* Returned by `PlatformSDKHttp.listRunResults()` instead of the raw
* `ItemResultReadResponse`.
*/
export interface ApplicationRunItem extends ItemResultReadResponse {
/** Whether the item's output artifact is available for download. */
can_download: boolean;
/** Human-readable status derived from `state` and `termination_reason`. */
status: string;
}

/** Derived item status that simplifies the raw `state` + `termination_reason` combination. */
export type ItemStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNKNOWN';
9 changes: 3 additions & 6 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ export * from './generated/index.js';
// Export error classes
export { BaseError, AuthenticationError, APIError, ConfigurationError } from './errors.js';

export type { ApplicationRun } from './entities/application-run/types.js';
export { processApplicationRun } from './entities/application-run/process-application-run.js';
export {
getRunProgress,
getRunStatus,
canDownloadRunItems,
} from './entities/application-run/utils.js';
export type { ApplicationRunItem, ItemStatus } from './entities/run-item/types.js';
export { processRunItem } from './entities/run-item/process-run-item.js';
export { canDownloadItem, getItemStatus } from './entities/run-item/utils.js';
type RunStatus,
} from './entities/application-run/index.js';
export { canDownloadItem, getItemStatus, type ItemStatus } from './entities/run-item/index.js';
// Export main SDK and types
export {
PlatformSDKHttp,
Expand Down
22 changes: 0 additions & 22 deletions packages/sdk/src/platform-sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@ describe('PlatformSDK', () => {
expect(result.length).toBeGreaterThan(0);
expect(result[0]).toHaveProperty('run_id');
expect(result[0]).toHaveProperty('state');

// Enriched ApplicationRun properties
expect(result[0]).toHaveProperty('progress');
expect(result[0]).toHaveProperty('status');
expect(result[0]).toHaveProperty('can_download');
expect(typeof result[0].progress).toBe('number');
expect(typeof result[0].status).toBe('string');
expect(typeof result[0].can_download).toBe('boolean');
});

it('should list application runs with filters successfully', async () => {
Expand Down Expand Up @@ -247,14 +239,6 @@ describe('PlatformSDK', () => {
expect(result).toHaveProperty('run_id');
expect(result).toHaveProperty('state');
expect(result).toHaveProperty('version_number');

// Enriched ApplicationRun properties
expect(result).toHaveProperty('progress');
expect(result).toHaveProperty('status');
expect(result).toHaveProperty('can_download');
expect(typeof result.progress).toBe('number');
expect(typeof result.status).toBe('string');
expect(typeof result.can_download).toBe('boolean');
});

it('should handle get run failure', async () => {
Expand Down Expand Up @@ -301,12 +285,6 @@ describe('PlatformSDK', () => {
expect(result[0]).toHaveProperty('item_id');
expect(result[0]).toHaveProperty('state');
expect(result[0]).toHaveProperty('external_id');

// Enriched ApplicationRunItem properties
expect(result[0]).toHaveProperty('status');
expect(result[0]).toHaveProperty('can_download');
expect(typeof result[0].status).toBe('string');
expect(typeof result[0].can_download).toBe('boolean');
});

it('should list run results failure', async () => {
Expand Down
Loading
Loading