@shiftengineering/folio 0.1.42 → 0.1.48

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.
package/README.md CHANGED
@@ -514,10 +514,6 @@ Folio supports deep linking for directories, allowing users to navigate back to
514
514
 
515
515
  **Note:** Currently, only directories support deep linking. Individual files do not have deep link functionality.
516
516
 
517
- ### Configuration
518
-
519
- Deep linking is controlled by the `VITE_ENABLE_DIRECT_DEEPLINKS` environment variable, which must be provided to the container at runtime. Set this to `true` to enable the feature.
520
-
521
517
  ### How It Works
522
518
 
523
519
  When a directory is created with a `userProvidedId` (using the `useAddFolioDirectoriesWithFiles` hook), a deep link button (external link icon) will appear next to the directory in:
@@ -610,16 +606,22 @@ React component to embed Folio in an iframe.
610
606
 
611
607
  #### `useFolioProjects()`
612
608
 
613
- Hook for getting all projects for the current user.
609
+ Hook for getting all projects for the current user. Each project includes statistics about its size and file count.
614
610
 
615
611
  | Return Property | Type | Description |
616
612
  | --------------- | -------------------- | ------------------------------------- |
617
- | `projects` | `FolioProject[]` | Array of projects |
613
+ | `projects` | `FolioProject[]` | Array of projects with stats |
618
614
  | `isLoading` | `boolean` | Whether projects are being loaded |
619
615
  | `isError` | `boolean` | Whether an error occurred |
620
616
  | `error` | `Error \| null` | Error object if an error occurred |
621
617
  | `refetch` | `() => Promise<...>` | Function to manually refetch projects |
622
618
 
619
+ **Project Statistics:**
620
+ Each project in the `projects` array includes:
621
+
622
+ - `approximateSizeInBytes`: Approximate total size in bytes (sum of extracted text content character counts for all files, plus metadata character counts for directories)
623
+ - `fileCount`: Total number of files and directories in the project
624
+
623
625
  #### `useFolioFiles(projectId?: number)`
624
626
 
625
627
  Hook for getting all files for a specific project.
@@ -645,6 +647,18 @@ Hook for adding a new project.
645
647
  | `error` | `Error \| null` | Error object if an error occurred |
646
648
  | `newProject` | `FolioProject \| undefined` | The newly created project if available |
647
649
 
650
+ #### `useDeleteFolioProject()`
651
+
652
+ Hook for deleting a project and all its associated files, directories, and chunks.
653
+
654
+ | Return Property | Type | Description |
655
+ | -------------------- | -------------------------------------- | ---------------------------------- |
656
+ | `deleteProject` | `(projectId: number) => void` | Function to delete a project |
657
+ | `deleteProjectAsync` | `(projectId: number) => Promise<void>` | Async version returning a promise |
658
+ | `isDeleting` | `boolean` | Whether a project is being deleted |
659
+ | `isError` | `boolean` | Whether an error occurred |
660
+ | `error` | `Error \| null` | Error object if an error occurred |
661
+
648
662
  #### `useAddFolioFiles(projectId?: number)`
649
663
 
650
664
  Hook for adding files to a project. Files are always created at the root level (parentId = null) and are not directories.
@@ -690,17 +704,17 @@ Hook for retrieving and updating the current user's metadata.
690
704
 
691
705
  The library exports these TypeScript types:
692
706
 
693
- | Type | Description |
694
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
695
- | `FolioFile` | Represents a file in Folio. Contains properties: `id`, `name`, `blobUrl`, `parentId` (null for root items), `isDirectory` (boolean), `userProvidedId` (string), `createdAt` (Date), and `updatedAt` (Date) |
696
- | `FolioProject` | Represents a project in Folio. Contains properties: `id`, `name`, `createdAt` (Date), and `updatedAt` (Date) |
697
- | `MetadataValue` | Represents metadata values that can be nested. Can be a string, number, boolean, null, object, or array of these types. Used for both directory metadata and user metadata. |
698
- | `DirectoryEntry` | Represents a directory with metadata and files to be added to Folio. Contains properties: `directoryName`, `directoryMetadata` (now supports nested objects), and `files` |
699
- | `FolioFileInput` | Input type for adding files to Folio. Contains properties: `blobUrl`, `name`, and `userProvidedId` (required for deduplication) |
700
- | `AnalyticsEvent` | A union type for analytics events sent by Folio. Each event has a `name` property (like "page_view" or "file_view") and a `data` object with event-specific parameters. See the [Analytics Event Structure](#analytics-event-structure) section for details on all event types. |
701
- | `DeepLinkEvent` | Event emitted when a user clicks a deep link button in Folio. Contains properties: `userProvidedId` (string) and `metadata` (Record<string, unknown> \| null). See the [Deep Linking](#deep-linking) section for details. |
702
- | `FolioEmbedProps` | Props for the FolioEmbed component |
703
- | `FolioProviderProps` | Props for the FolioProvider component |
704
- | `FolioClient` | Interface for the client that interacts with the Folio API |
707
+ | Type | Description |
708
+ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
709
+ | `FolioFile` | Represents a file in Folio. Contains properties: `id`, `name`, `blobUrl`, `parentId` (null for root items), `isDirectory` (boolean), `userProvidedId` (string), `createdAt` (Date), and `updatedAt` (Date) |
710
+ | `FolioProject` | Represents a project in Folio. Contains properties: `id`, `name`, `createdAt` (Date), `updatedAt` (Date), `approximateSizeInBytes` (number - sum of extracted text content lengths for all files and metadata lengths for directories), and `fileCount` (number - total count of all files and directories) |
711
+ | `MetadataValue` | Represents metadata values that can be nested. Can be a string, number, boolean, null, object, or array of these types. Used for both directory metadata and user metadata. |
712
+ | `DirectoryEntry` | Represents a directory with metadata and files to be added to Folio. Contains properties: `directoryName`, `directoryMetadata` (now supports nested objects), and `files` |
713
+ | `FolioFileInput` | Input type for adding files to Folio. Contains properties: `blobUrl`, `name`, and `userProvidedId` (required for deduplication) |
714
+ | `AnalyticsEvent` | A union type for analytics events sent by Folio. Each event has a `name` property (like "page_view" or "file_view") and a `data` object with event-specific parameters. See the [Analytics Event Structure](#analytics-event-structure) section for details on all event types. |
715
+ | `DeepLinkEvent` | Event emitted when a user clicks a deep link button in Folio. Contains properties: `userProvidedId` (string) and `metadata` (Record<string, unknown> \| null). See the [Deep Linking](#deep-linking) section for details. |
716
+ | `FolioEmbedProps` | Props for the FolioEmbed component |
717
+ | `FolioProviderProps` | Props for the FolioProvider component |
718
+ | `FolioClient` | Interface for the client that interacts with the Folio API |
705
719
 
706
720
  ## License