@muhgholy/next-drive 1.0.1 → 1.0.2

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
@@ -61,8 +61,9 @@ export const drive = driveConfiguration({
61
61
  information: async (req): Promise<TDriveConfigInformation> => {
62
62
  // Implement your auth verification here
63
63
  const auth = await verifyAuth(req);
64
+ if (!auth) throw new Error("Unauthenticated");
64
65
  return {
65
- key: auth ? { userId: auth.userId } : null,
66
+ key: { userId: auth.userId },
66
67
  storage: { quotaInBytes: 1024 * 1024 * 1024 }, // 1GB limit
67
68
  };
68
69
  },
@@ -132,7 +133,7 @@ You can use the exported `driveFileSchemaZod` to validate file data in your form
132
133
 
133
134
  ```typescript
134
135
  import { z } from "zod";
135
- import { driveFileSchemaZod } from "@muhgholy/next-drive/server";
136
+ import { driveFileSchemaZod } from "@muhgholy/next-drive/client";
136
137
 
137
138
  // Use in your form schema
138
139
  const myFormSchema = z.object({
@@ -1,5 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { l as TDrivePathItem, d as TDatabaseDrive, m as TDriveQuota, i as TDriveAPIResponse, n as TDriveUploadState, e as TDriveFile } from '../index-DE7-rwJm.js';
2
+ import { l as TDrivePathItem, d as TDatabaseDrive, m as TDriveQuota, i as TDriveAPIResponse, n as TDriveUploadState, e as TDriveFile } from '../index-CIbbTroj.js';
3
+ export { o as driveFileSchemaZod } from '../index-CIbbTroj.js';
4
+ import 'zod';
3
5
 
4
6
  type TDriveContext = {
5
7
  apiEndpoint: string;
@@ -2682,6 +2682,17 @@ var DriveFileChooser = (props) => {
2682
2682
  ] }) })
2683
2683
  ] });
2684
2684
  };
2685
+
2686
+ // src/types/client/index.ts
2687
+ import { z } from "zod";
2688
+ var driveFileSchemaZod = z.object({
2689
+ id: z.string(),
2690
+ file: z.object({
2691
+ name: z.string(),
2692
+ mime: z.string(),
2693
+ size: z.number()
2694
+ })
2695
+ });
2685
2696
  export {
2686
2697
  DriveExplorer,
2687
2698
  DriveFileChooser,
@@ -2691,6 +2702,7 @@ export {
2691
2702
  DriveSidebar,
2692
2703
  DriveStorageIndicator,
2693
2704
  DriveUpload,
2705
+ driveFileSchemaZod,
2694
2706
  useDrive,
2695
2707
  useUpload
2696
2708
  };