-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs and images in playground params (#715)
- Loading branch information
Showing
74 changed files
with
1,755 additions
and
512 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use server' | ||
|
||
import { MAX_SIZE, MAX_UPLOAD_SIZE_IN_MB } from '@latitude-data/core/browser' | ||
import { convertFile } from '@latitude-data/core/services/files/convert' | ||
import { z } from 'zod' | ||
|
||
import { authProcedure } from '../procedures' | ||
|
||
export const convertFileAction = authProcedure | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
file: z.instanceof(File).refine(async (file) => { | ||
return file?.size <= MAX_UPLOAD_SIZE_IN_MB | ||
}, `Your file must be less than ${MAX_SIZE}MB in size. You can split it into smaller files and upload them separately.`), | ||
}), | ||
) | ||
.handler(async ({ input }) => { | ||
const result = await convertFile(input.file) | ||
|
||
return result.unwrap() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use server' | ||
|
||
import { MAX_SIZE, MAX_UPLOAD_SIZE_IN_MB } from '@latitude-data/core/browser' | ||
import { uploadFile } from '@latitude-data/core/services/files/upload' | ||
import { z } from 'zod' | ||
|
||
import { authProcedure } from '../procedures' | ||
|
||
export const uploadFileAction = authProcedure | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
file: z.instanceof(File).refine(async (file) => { | ||
return file?.size <= MAX_UPLOAD_SIZE_IN_MB | ||
}, `Your file must be less than ${MAX_SIZE}MB in size. You can split it into smaller files and upload them separately.`), | ||
}), | ||
) | ||
.handler(async ({ input, ctx }) => { | ||
const result = await uploadFile(input.file, ctx.workspace) | ||
|
||
return result.unwrap() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.