Skip to content

Commit

Permalink
feat(@captn/utils): add fileName to download item
Browse files Browse the repository at this point in the history
moves type
  • Loading branch information
pixelass committed May 15, 2024
1 parent 138f684 commit e3b5dac
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 46 deletions.
45 changes: 0 additions & 45 deletions packages/utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,48 +121,3 @@ export enum DownloadState {
*/
UPDATE = "UPDATE",
}

/**
* Represents an item to be downloaded, including its source, destination, and other metadata.
*/
export interface DownloadItem {
/**
* Unique identifier for each download request.
*/
id: string;

/**
* The URL of the file to be downloaded.
*/
source: string;

/**
* Local path where the file should be saved.
*/
destination: string;

/**
* A user-friendly name or label for the download item, for UI display purposes.
*/
label: string;

/**
* Time when the download request is sent from the client, represented as a Unix timestamp.
*/
createdAt: number;

/**
* MIME type of the file being downloaded, if known beforehand. Optional.
*/
mimeType?: string;

/**
* Whether to automatically unzip the file when download completes. Optional.
*/
unzip?: boolean;

/**
* Current state of the download. Optional.
*/
state?: DownloadState;
}
52 changes: 51 additions & 1 deletion packages/utils/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadItem } from "@captn/utils/constants";
import { DownloadState } from "@captn/utils/constants";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import type { Schemas as QdrantSchemas } from "@qdrant/js-client-rest";
Expand Down Expand Up @@ -167,6 +167,56 @@ declare global {
}
}

/**
* Represents an item to be downloaded, including its source, destination, and other metadata.
*/
export interface DownloadItem {
/**
* Unique identifier for each download request.
*/
id: string;

/**
* The URL of the file to be downloaded.
*/
source: string;

/**
* Local path where the file should be saved.
*/
destination: string;

/**
* Name of the downloaded or unpacked file
*/
fileName: string;

/**
* A user-friendly name or label for the download item, for UI display purposes.
*/
label: string;

/**
* Time when the download request is sent from the client, represented as a Unix timestamp.
*/
createdAt: number;

/**
* MIME type of the file being downloaded, if known beforehand. Optional.
*/
mimeType?: string;

/**
* Whether to automatically unzip the file when download completes. Optional.
*/
unzip?: boolean;

/**
* Current state of the download. Optional.
*/
state?: DownloadState;
}

export type RequiredDownload = Except<DownloadItem, "createdAt">;

/**
Expand Down

0 comments on commit e3b5dac

Please sign in to comment.