From d7dee1bf9ce1748cffb4748484c46ab6439ffb17 Mon Sep 17 00:00:00 2001 From: maxichrome Date: Sat, 21 Jan 2023 00:10:50 -0800 Subject: [PATCH] re-add rspc codegen --- .prettierignore | 2 + packages/client/.gitignore | 2 - packages/client/src/core.ts | 195 ++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+), 2 deletions(-) delete mode 100644 packages/client/.gitignore create mode 100644 packages/client/src/core.ts diff --git a/.prettierignore b/.prettierignore index 7e61a8197..321737950 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,5 @@ Pods/ *.rs # we plainly don't need a lockfile to look nice pnpm-lock.yaml +# codegen from rspc -- not supposed to look nice +/packages/client/src/core.ts diff --git a/packages/client/.gitignore b/packages/client/.gitignore deleted file mode 100644 index 62d7ef7de..000000000 --- a/packages/client/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# rspc codegen -- generated during pnpm prep, no reason to commit -src/core.ts diff --git a/packages/client/src/core.ts b/packages/client/src/core.ts new file mode 100644 index 000000000..ad754226f --- /dev/null +++ b/packages/client/src/core.ts @@ -0,0 +1,195 @@ +/* eslint-disable */ +// This file was generated by [rspc](https://github.com/oscartbeaumont/rspc). Do not edit this file manually. + +export type Procedures = { + queries: + { key: "buildInfo", input: never, result: BuildInfo } | + { key: "files.get", input: LibraryArgs, result: { id: number, cas_id: string, integrity_checksum: string | null, name: string | null, extension: string | null, kind: number, size_in_bytes: string, key_id: number | null, hidden: boolean, favorite: boolean, important: boolean, has_thumbnail: boolean, has_thumbstrip: boolean, has_video_preview: boolean, ipfs_id: string | null, note: string | null, date_created: string, date_modified: string, date_indexed: string, file_paths: Array, media_data: MediaData | null } | null } | + { key: "jobs.getHistory", input: LibraryArgs, result: Array } | + { key: "jobs.getRunning", input: LibraryArgs, result: Array } | + { key: "jobs.isRunning", input: LibraryArgs, result: boolean } | + { key: "keys.getDefault", input: LibraryArgs, result: string | null } | + { key: "keys.getKey", input: LibraryArgs, result: string } | + { key: "keys.hasMasterPassword", input: LibraryArgs, result: boolean } | + { key: "keys.isKeyManagerUnlocking", input: LibraryArgs, result: boolean } | + { key: "keys.list", input: LibraryArgs, result: Array } | + { key: "keys.listMounted", input: LibraryArgs, result: Array } | + { key: "library.getStatistics", input: LibraryArgs, result: Statistics } | + { key: "library.list", input: never, result: Array } | + { key: "locations.getById", input: LibraryArgs, result: Location | null } | + { key: "locations.getExplorerData", input: LibraryArgs, result: ExplorerData } | + { key: "locations.indexer_rules.get", input: LibraryArgs, result: IndexerRule } | + { key: "locations.indexer_rules.list", input: LibraryArgs, result: Array } | + { key: "locations.list", input: LibraryArgs, result: Array<{ id: number, pub_id: Array, node_id: number, name: string | null, local_path: string | null, total_capacity: number | null, available_capacity: number | null, filesystem: string | null, disk_type: number | null, is_removable: boolean | null, is_online: boolean, is_archived: boolean, date_created: string, node: Node }> } | + { key: "nodeState", input: never, result: NodeState } | + { key: "normi.composite", input: never, result: NormalisedCompositeId } | + { key: "normi.org", input: never, result: NormalisedOrganisation } | + { key: "normi.user", input: never, result: NormalisedUser } | + { key: "normi.userSync", input: never, result: NormalisedUser } | + { key: "normi.version", input: never, result: string } | + { key: "tags.get", input: LibraryArgs, result: Tag | null } | + { key: "tags.getExplorerData", input: LibraryArgs, result: ExplorerData } | + { key: "tags.getForObject", input: LibraryArgs, result: Array } | + { key: "tags.list", input: LibraryArgs, result: Array } | + { key: "volumes.list", input: never, result: Array }, + mutations: + { key: "files.decryptFiles", input: LibraryArgs, result: null } | + { key: "files.delete", input: LibraryArgs, result: null } | + { key: "files.deleteFiles", input: LibraryArgs, result: null } | + { key: "files.encryptFiles", input: LibraryArgs, result: null } | + { key: "files.eraseFiles", input: LibraryArgs, result: null } | + { key: "files.setFavorite", input: LibraryArgs, result: null } | + { key: "files.setNote", input: LibraryArgs, result: null } | + { key: "jobs.clearAll", input: LibraryArgs, result: null } | + { key: "jobs.generateThumbsForLocation", input: LibraryArgs, result: null } | + { key: "jobs.identifyUniqueFiles", input: LibraryArgs, result: null } | + { key: "jobs.objectValidator", input: LibraryArgs, result: null } | + { key: "keys.add", input: LibraryArgs, result: null } | + { key: "keys.backupKeystore", input: LibraryArgs, result: null } | + { key: "keys.changeMasterPassword", input: LibraryArgs, result: null } | + { key: "keys.clearMasterPassword", input: LibraryArgs, result: null } | + { key: "keys.deleteFromLibrary", input: LibraryArgs, result: null } | + { key: "keys.mount", input: LibraryArgs, result: null } | + { key: "keys.restoreKeystore", input: LibraryArgs, result: number } | + { key: "keys.setDefault", input: LibraryArgs, result: null } | + { key: "keys.setMasterPassword", input: LibraryArgs, result: null } | + { key: "keys.syncKeyToLibrary", input: LibraryArgs, result: null } | + { key: "keys.unmount", input: LibraryArgs, result: null } | + { key: "keys.unmountAll", input: LibraryArgs, result: null } | + { key: "keys.updateAutomountStatus", input: LibraryArgs, result: null } | + { key: "library.create", input: CreateLibraryArgs, result: LibraryConfigWrapped } | + { key: "library.delete", input: string, result: null } | + { key: "library.edit", input: EditLibraryArgs, result: null } | + { key: "locations.addLibrary", input: LibraryArgs, result: null } | + { key: "locations.create", input: LibraryArgs, result: null } | + { key: "locations.delete", input: LibraryArgs, result: null } | + { key: "locations.fullRescan", input: LibraryArgs, result: null } | + { key: "locations.indexer_rules.create", input: LibraryArgs, result: IndexerRule } | + { key: "locations.indexer_rules.delete", input: LibraryArgs, result: null } | + { key: "locations.quickRescan", input: LibraryArgs, result: null } | + { key: "locations.relink", input: LibraryArgs, result: null } | + { key: "locations.update", input: LibraryArgs, result: null } | + { key: "tags.assign", input: LibraryArgs, result: null } | + { key: "tags.create", input: LibraryArgs, result: Tag } | + { key: "tags.delete", input: LibraryArgs, result: null } | + { key: "tags.update", input: LibraryArgs, result: null }, + subscriptions: + { key: "invalidateQuery", input: never, result: InvalidateOperationEvent } | + { key: "jobs.newThumbnail", input: LibraryArgs, result: string } +}; + +export type Algorithm = "XChaCha20Poly1305" | "Aes256Gcm" + +export interface AutomountUpdateArgs { uuid: string, status: boolean } + +export interface BuildInfo { version: string, commit: string } + +export interface ConfigMetadata { version: string | null } + +export interface CreateLibraryArgs { name: string, password: string, secret_key: string | null, algorithm: Algorithm, hashing_algorithm: HashingAlgorithm } + +export interface EditLibraryArgs { id: string, name: string | null, description: string | null } + +export type ExplorerContext = { type: "Location" } & Location | { type: "Tag" } & Tag + +export interface ExplorerData { context: ExplorerContext, items: Array } + +export type ExplorerItem = { type: "Path" } & FilePathWithObject | { type: "Object" } & ObjectWithFilePaths + +export interface FileDecryptorJobInit { location_id: number, path_id: number, output_path: string | null, password: string | null, save_to_library: boolean | null } + +export interface FileDeleterJobInit { location_id: number, path_id: number } + +export interface FileEncryptorJobInit { location_id: number, path_id: number, key_uuid: string, algorithm: Algorithm, metadata: boolean, preview_media: boolean, output_path: string | null } + +export interface FileEraserJobInit { location_id: number, path_id: number, passes: number } + +export interface FilePath { id: number, is_dir: boolean, location_id: number, materialized_path: string, name: string, extension: string | null, object_id: number | null, parent_id: number | null, key_id: number | null, date_created: string, date_modified: string, date_indexed: string } + +export interface GenerateThumbsForLocationArgs { id: number, path: string } + +export interface GetArgs { id: number } + +export type HashingAlgorithm = { name: "Argon2id", params: Params } | { name: "BalloonBlake3", params: Params } + +export interface IdentifyUniqueFilesArgs { id: number, path: string } + +export interface IndexerRule { id: number, kind: number, name: string, parameters: Array, date_created: string, date_modified: string } + +export interface IndexerRuleCreateArgs { kind: RuleKind, name: string, parameters: Array } + +export interface InvalidateOperationEvent { key: string, arg: any } + +export interface JobReport { id: string, name: string, data: Array | null, metadata: any | null, date_created: string, date_modified: string, status: JobStatus, task_count: number, completed_task_count: number, message: string, seconds_elapsed: number } + +export type JobStatus = "Queued" | "Running" | "Completed" | "Canceled" | "Failed" | "Paused" + +export interface KeyAddArgs { algorithm: Algorithm, hashing_algorithm: HashingAlgorithm, key: string, library_sync: boolean, automount: boolean } + +export interface LibraryArgs { library_id: string, arg: T } + +export interface LibraryConfig { version: string | null, name: string, description: string } + +export interface LibraryConfigWrapped { uuid: string, config: LibraryConfig } + +export interface Location { id: number, pub_id: Array, node_id: number, name: string | null, local_path: string | null, total_capacity: number | null, available_capacity: number | null, filesystem: string | null, disk_type: number | null, is_removable: boolean | null, is_online: boolean, is_archived: boolean, date_created: string } + +export interface LocationCreateArgs { path: string, indexer_rules_ids: Array } + +export interface LocationExplorerArgs { location_id: number, path: string, limit: number, cursor: string | null } + +export interface LocationUpdateArgs { id: number, name: string | null, indexer_rules_ids: Array } + +export interface MasterPasswordChangeArgs { password: string, secret_key: string | null, algorithm: Algorithm, hashing_algorithm: HashingAlgorithm } + +export interface MediaData { id: number, pixel_width: number | null, pixel_height: number | null, longitude: number | null, latitude: number | null, fps: number | null, capture_device_make: string | null, capture_device_model: string | null, capture_device_software: string | null, duration_seconds: number | null, codecs: string | null, streams: number | null } + +export interface Node { id: number, pub_id: Array, name: string, platform: number, version: string | null, last_seen: string, timezone: string | null, date_created: string } + +export interface NodeConfig { version: string | null, id: string, name: string, p2p_port: number | null } + +export interface NodeState { version: string | null, id: string, name: string, p2p_port: number | null, data_path: string } + +export interface NormalisedCompositeId { $type: string, $id: any, org_id: string, user_id: string } + +export interface NormalisedOrganisation { $type: string, $id: any, id: string, name: string, users: NormalizedVec, owner: NormalisedUser, non_normalised_data: Array } + +export interface NormalisedUser { $type: string, $id: any, id: string, name: string } + +export interface NormalizedVec { $type: string, edges: Array } + +export interface Object { id: number, cas_id: string, integrity_checksum: string | null, name: string | null, extension: string | null, kind: number, size_in_bytes: string, key_id: number | null, hidden: boolean, favorite: boolean, important: boolean, has_thumbnail: boolean, has_thumbstrip: boolean, has_video_preview: boolean, ipfs_id: string | null, note: string | null, date_created: string, date_modified: string, date_indexed: string } + +export interface ObjectValidatorArgs { id: number, path: string } + +export type Params = "Standard" | "Hardened" | "Paranoid" + +export interface RestoreBackupArgs { password: string, secret_key: string | null, path: string } + +export type RuleKind = "AcceptFilesByGlob" | "RejectFilesByGlob" | "AcceptIfChildrenDirectoriesArePresent" | "RejectIfChildrenDirectoriesArePresent" + +export interface SetFavoriteArgs { id: number, favorite: boolean } + +export interface SetMasterPasswordArgs { password: string, secret_key: string | null } + +export interface SetNoteArgs { id: number, note: string | null } + +export interface Statistics { id: number, date_captured: string, total_object_count: number, library_db_size: string, total_bytes_used: string, total_bytes_capacity: string, total_unique_bytes: string, total_bytes_free: string, preview_media_bytes: string } + +export interface StoredKey { uuid: string, version: StoredKeyVersion, algorithm: Algorithm, hashing_algorithm: HashingAlgorithm, content_salt: Array, master_key: Array, master_key_nonce: Array, key_nonce: Array, key: Array, salt: Array, memory_only: boolean, automount: boolean } + +export type StoredKeyVersion = "V1" + +export interface Tag { id: number, pub_id: Array, name: string | null, color: string | null, total_objects: number | null, redundancy_goal: number | null, date_created: string, date_modified: string } + +export interface TagAssignArgs { object_id: number, tag_id: number, unassign: boolean } + +export interface TagCreateArgs { name: string, color: string } + +export interface TagUpdateArgs { id: number, name: string | null, color: string | null } + +export interface Volume { name: string, mount_point: string, total_capacity: bigint, available_capacity: bigint, is_removable: boolean, disk_type: string | null, file_system: string | null, is_root_filesystem: boolean } + +export interface FilePathWithObject { id: number, is_dir: boolean, location_id: number, materialized_path: string, name: string, extension: string | null, object_id: number | null, parent_id: number | null, key_id: number | null, date_created: string, date_modified: string, date_indexed: string, object: Object | null } + +export interface ObjectWithFilePaths { id: number, cas_id: string, integrity_checksum: string | null, name: string | null, extension: string | null, kind: number, size_in_bytes: string, key_id: number | null, hidden: boolean, favorite: boolean, important: boolean, has_thumbnail: boolean, has_thumbstrip: boolean, has_video_preview: boolean, ipfs_id: string | null, note: string | null, date_created: string, date_modified: string, date_indexed: string, file_paths: Array }