mirror of
https://github.com/get-drexa/drive.git
synced 2025-11-30 21:41:39 +00:00
refactor: add import maps for generated code
- Add export mappings in @fileone/convex package.json for cleaner imports - Map @fileone/convex/dataModel to _generated/dataModel.d.ts - Map @fileone/convex/api to _generated/api.js - Map @fileone/convex/server to _generated/server.js - Update all imports across packages/convex and apps/drive-web - Maintain backward compatibility with _generated/* exports Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { Link, useLocation } from "@tanstack/react-router"
|
import { Link, useLocation } from "@tanstack/react-router"
|
||||||
import { useQuery as useConvexQuery } from "convex/react"
|
import { useQuery as useConvexQuery } from "convex/react"
|
||||||
import { useAtomValue } from "jotai"
|
import { useAtomValue } from "jotai"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import type { FileSystemItem } from "@fileone/convex/filesystem"
|
import type { FileSystemItem } from "@fileone/convex/filesystem"
|
||||||
import type { DirectoryInfo } from "@fileone/convex/types"
|
import type { DirectoryInfo } from "@fileone/convex/types"
|
||||||
import { createContext } from "react"
|
import { createContext } from "react"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { newFileSystemHandle } from "@fileone/convex/filesystem"
|
import { newFileSystemHandle } from "@fileone/convex/filesystem"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { useMutation as useContextMutation } from "convex/react"
|
import { useMutation as useContextMutation } from "convex/react"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import {
|
import {
|
||||||
type DirectoryHandle,
|
type DirectoryHandle,
|
||||||
type FileHandle,
|
type FileHandle,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Id } from "@fileone/convex/_generated/dataModel"
|
import type { Id } from "@fileone/convex/dataModel"
|
||||||
import type {
|
import type {
|
||||||
DirectoryHandle,
|
DirectoryHandle,
|
||||||
DirectoryPathComponent,
|
DirectoryPathComponent,
|
||||||
@@ -86,6 +86,8 @@ function FilePathBreadcrumbItem({
|
|||||||
|
|
||||||
const dirName = component.name || rootLabel
|
const dirName = component.name || rootLabel
|
||||||
|
|
||||||
|
console.log({ dirName, isDraggedOver, dropHandlers })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip open={isDraggedOver}>
|
<Tooltip open={isDraggedOver}>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Id } from "@fileone/convex/_generated/dataModel"
|
import type { Id } from "@fileone/convex/dataModel"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { useMutation as useContextMutation } from "convex/react"
|
import { useMutation as useContextMutation } from "convex/react"
|
||||||
import { useId } from "react"
|
import { useId } from "react"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { type FileSystemItem, FileType } from "@fileone/convex/filesystem"
|
import { type FileSystemItem, FileType } from "@fileone/convex/filesystem"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { useMutation as useContextMutation } from "convex/react"
|
import { useMutation as useContextMutation } from "convex/react"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import type { FileSystemItem, FileType } from "@fileone/convex/filesystem"
|
import type { FileSystemItem } from "@fileone/convex/filesystem"
|
||||||
import type { RowSelectionState } from "@tanstack/react-table"
|
import type { RowSelectionState } from "@tanstack/react-table"
|
||||||
import { atom } from "jotai"
|
import { atom } from "jotai"
|
||||||
import type { FileDragInfo } from "../../files/use-file-drop"
|
import type { FileDragInfo } from "../../files/use-file-drop"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import { ImagePreviewDialog } from "./image-preview-dialog"
|
import { ImagePreviewDialog } from "./image-preview-dialog"
|
||||||
|
|
||||||
export function FilePreviewDialog({
|
export function FilePreviewDialog({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import type { DirectoryItem } from "@fileone/convex/types"
|
import type { DirectoryItem } from "@fileone/convex/types"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { Link } from "@tanstack/react-router"
|
import { Link } from "@tanstack/react-router"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { baseName, splitPath } from "@fileone/path"
|
import { baseName, splitPath } from "@fileone/path"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { Link } from "@tanstack/react-router"
|
import { Link } from "@tanstack/react-router"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import { DialogTitle } from "@radix-ui/react-dialog"
|
import { DialogTitle } from "@radix-ui/react-dialog"
|
||||||
import { useQuery as useConvexQuery } from "convex/react"
|
import { useQuery as useConvexQuery } from "convex/react"
|
||||||
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai"
|
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { useMutation as useContextMutation } from "convex/react"
|
import { useMutation as useContextMutation } from "convex/react"
|
||||||
import { atom, useAtom, useStore } from "jotai"
|
import { atom, useAtom, useStore } from "jotai"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Id } from "@fileone/convex/_generated/dataModel"
|
import type { Id } from "@fileone/convex/dataModel"
|
||||||
import type {
|
import type {
|
||||||
DirectoryItem,
|
DirectoryItem,
|
||||||
DirectoryItemKind,
|
DirectoryItemKind,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc } from "@fileone/convex/_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import { mutationOptions } from "@tanstack/react-query"
|
import { mutationOptions } from "@tanstack/react-query"
|
||||||
import { atom, useAtom, useAtomValue, useSetAtom, useStore } from "jotai"
|
import { atom, useAtom, useAtomValue, useSetAtom, useStore } from "jotai"
|
||||||
import { atomEffect } from "jotai-effect"
|
import { atomEffect } from "jotai-effect"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import * as Err from "@fileone/convex/error"
|
import * as Err from "@fileone/convex/error"
|
||||||
import {
|
import {
|
||||||
type DirectoryHandle,
|
type DirectoryHandle,
|
||||||
@@ -71,7 +71,6 @@ export function useFileDrop({
|
|||||||
|
|
||||||
const handleDrop = (_e: React.DragEvent) => {
|
const handleDrop = (_e: React.DragEvent) => {
|
||||||
const dragInfo = store.get(dragInfoAtom)
|
const dragInfo = store.get(dragInfoAtom)
|
||||||
console.log("handleDrop", { dragInfo, destItem })
|
|
||||||
if (dragInfo && destItem) {
|
if (dragInfo && destItem) {
|
||||||
const items = dragInfo.items.filter(
|
const items = dragInfo.items.filter(
|
||||||
(item) => !isSameHandle(item, destItem),
|
(item) => !isSameHandle(item, destItem),
|
||||||
@@ -89,6 +88,7 @@ export function useFileDrop({
|
|||||||
|
|
||||||
const handleDragOver = (e: React.DragEvent) => {
|
const handleDragOver = (e: React.DragEvent) => {
|
||||||
const dragInfo = store.get(dragInfoAtom)
|
const dragInfo = store.get(dragInfoAtom)
|
||||||
|
console.log({ dragInfo, destItem })
|
||||||
if (dragInfo && destItem) {
|
if (dragInfo && destItem) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.dataTransfer.dropEffect = "move"
|
e.dataTransfer.dropEffect = "move"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import { useMutation as useConvexMutation } from "convex/react"
|
import { useMutation as useConvexMutation } from "convex/react"
|
||||||
import { useCallback } from "react"
|
import { useCallback } from "react"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import {
|
import {
|
||||||
type FileSystemItem,
|
type FileSystemItem,
|
||||||
FileType,
|
FileType,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import {
|
import {
|
||||||
type FileSystemItem,
|
type FileSystemItem,
|
||||||
FileType,
|
FileType,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { api } from "@fileone/convex/_generated/api"
|
import { api } from "@fileone/convex/api"
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router"
|
import { createFileRoute, useNavigate } from "@tanstack/react-router"
|
||||||
import { useConvexAuth, useMutation as useConvexMutation } from "convex/react"
|
import { useConvexAuth, useMutation as useConvexMutation } from "convex/react"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { createClient, type GenericCtx } from "@convex-dev/better-auth"
|
import { createClient, type GenericCtx } from "@convex-dev/better-auth"
|
||||||
import { convex, crossDomain } from "@convex-dev/better-auth/plugins"
|
import { convex, crossDomain } from "@convex-dev/better-auth/plugins"
|
||||||
import { betterAuth } from "better-auth"
|
import { betterAuth } from "better-auth"
|
||||||
import { components } from "./_generated/api"
|
import { components } from "@fileone/convex/api"
|
||||||
import type { DataModel } from "./_generated/dataModel"
|
import type { DataModel } from "@fileone/convex/dataModel"
|
||||||
import authSchema from "./betterauth/schema"
|
import authSchema from "./betterauth/schema"
|
||||||
|
|
||||||
const siteUrl = process.env.SITE_URL!
|
const siteUrl = process.env.SITE_URL!
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { v } from "convex/values"
|
import { v } from "convex/values"
|
||||||
import type { Id } from "./_generated/dataModel"
|
import type { Id } from "@fileone/convex/dataModel"
|
||||||
import { authenticatedMutation, authenticatedQuery, authorizedGet } from "./functions"
|
import { authenticatedMutation, authenticatedQuery, authorizedGet } from "./functions"
|
||||||
import * as Directories from "./model/directories"
|
import * as Directories from "./model/directories"
|
||||||
import * as Files from "./model/files"
|
import * as Files from "./model/files"
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import {
|
|||||||
customMutation,
|
customMutation,
|
||||||
customQuery,
|
customQuery,
|
||||||
} from "convex-helpers/server/customFunctions"
|
} from "convex-helpers/server/customFunctions"
|
||||||
import type { DataModel } from "./_generated/dataModel"
|
import type { DataModel } from "@fileone/convex/dataModel"
|
||||||
import type { MutationCtx, QueryCtx } from "./_generated/server"
|
import type { MutationCtx, QueryCtx } from "@fileone/convex/server"
|
||||||
import { mutation, query } from "./_generated/server"
|
import { mutation, query } from "@fileone/convex/server"
|
||||||
import { type AuthUser, userIdentityOrThrow, userOrThrow } from "./model/user"
|
import { type AuthUser, userIdentityOrThrow, userOrThrow } from "./model/user"
|
||||||
|
|
||||||
export type AuthenticatedQueryCtx = QueryCtx & {
|
export type AuthenticatedQueryCtx = QueryCtx & {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc, Id } from "../_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import type {
|
import type {
|
||||||
AuthenticatedMutationCtx,
|
AuthenticatedMutationCtx,
|
||||||
AuthenticatedQueryCtx,
|
AuthenticatedQueryCtx,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Doc, Id } from "../_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import { type AuthenticatedMutationCtx, authorizedGet } from "../functions"
|
import { type AuthenticatedMutationCtx, authorizedGet } from "../functions"
|
||||||
import * as Err from "../shared/error"
|
import * as Err from "../shared/error"
|
||||||
import type { DirectoryHandle, FileHandle } from "../shared/filesystem"
|
import type { DirectoryHandle, FileHandle } from "../shared/filesystem"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { v } from "convex/values"
|
import { v } from "convex/values"
|
||||||
import type { Doc, Id } from "../_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import {
|
import {
|
||||||
type AuthenticatedMutationCtx,
|
type AuthenticatedMutationCtx,
|
||||||
type AuthenticatedQueryCtx,
|
type AuthenticatedQueryCtx,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { MutationCtx, QueryCtx } from "../_generated/server"
|
import type { MutationCtx, QueryCtx } from "@fileone/convex/server"
|
||||||
import { authComponent } from "../auth"
|
import { authComponent } from "../auth"
|
||||||
import * as Err from "../shared/error"
|
import * as Err from "../shared/error"
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
"./filesystem": "./shared/filesystem.ts",
|
"./filesystem": "./shared/filesystem.ts",
|
||||||
"./error": "./shared/error.ts",
|
"./error": "./shared/error.ts",
|
||||||
"./types": "./shared/types.ts",
|
"./types": "./shared/types.ts",
|
||||||
|
"./dataModel": "./_generated/dataModel.d.ts",
|
||||||
|
"./api": "./_generated/api.js",
|
||||||
|
"./server": "./_generated/server.js",
|
||||||
"./_generated/*": "./_generated/*",
|
"./_generated/*": "./_generated/*",
|
||||||
"./model/*": "./model/*",
|
"./model/*": "./model/*",
|
||||||
"./shared/*": "./shared/*"
|
"./shared/*": "./shared/*"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* NO server-only dependencies should be imported here.
|
* NO server-only dependencies should be imported here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Doc, Id } from "../_generated/dataModel"
|
import type { Doc, Id } from "@fileone/convex/dataModel"
|
||||||
import type * as Err from "./error"
|
import type * as Err from "./error"
|
||||||
|
|
||||||
export enum FileType {
|
export enum FileType {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* This file should NOT import any server-only dependencies.
|
* This file should NOT import any server-only dependencies.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Doc } from "../_generated/dataModel"
|
import type { Doc } from "@fileone/convex/dataModel"
|
||||||
import type { DirectoryPath } from "./filesystem"
|
import type { DirectoryPath } from "./filesystem"
|
||||||
|
|
||||||
export type DirectoryInfo = Doc<"directories"> & { path: DirectoryPath }
|
export type DirectoryInfo = Doc<"directories"> & { path: DirectoryPath }
|
||||||
|
|||||||
Reference in New Issue
Block a user