chore: upgrade to latest next.js version (#553)

* chore: upgrade next.js
* fix: canvas not found error
* chore: upgrade package for marketing
* feat: add isServer conditional
* fix: inverse isServer condition
* fix: normalize packages
* fix: upgrade ee package
* fix: depdency nightmares
* fix: failing seed script
This commit is contained in:
Nafees Nazik
2023-10-18 17:03:02 +05:30
committed by Mythie
parent f1732fab29
commit 04fc9eb187
24 changed files with 3789 additions and 4313 deletions

View File

@ -3,8 +3,6 @@ import { match } from 'ts-pattern';
import { DocumentDataType } from '@documenso/prisma/client';
import { getPresignGetUrl } from './server-actions';
export type GetFileOptions = {
type: DocumentDataType;
data: string;
@ -33,6 +31,8 @@ const getFileFromBytes64 = (data: string) => {
};
const getFileFromS3 = async (key: string) => {
const { getPresignGetUrl } = await import('./server-actions');
const { url } = await getPresignGetUrl(key);
const response = await fetch(url, {

View File

@ -4,7 +4,6 @@ import { match } from 'ts-pattern';
import { DocumentDataType } from '@documenso/prisma/client';
import { createDocumentData } from '../../server-only/document-data/create-document-data';
import { getPresignPostUrl } from './server-actions';
type File = {
name: string;
@ -34,6 +33,8 @@ const putFileInDatabase = async (file: File) => {
};
const putFileInS3 = async (file: File) => {
const { getPresignPostUrl } = await import('./server-actions');
const { url, key } = await getPresignPostUrl(file.name, file.type);
const body = await file.arrayBuffer();

View File

@ -6,7 +6,6 @@ import {
PutObjectCommand,
S3Client,
} from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
import slugify from '@sindresorhus/slugify';
import path from 'node:path';
@ -17,6 +16,8 @@ import { alphaid } from '../id';
export const getPresignPostUrl = async (fileName: string, contentType: string) => {
const client = getS3Client();
const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner');
const { user } = await getServerComponentSession();
// Get the basename and extension for the file
@ -44,6 +45,8 @@ export const getPresignPostUrl = async (fileName: string, contentType: string) =
export const getAbsolutePresignPostUrl = async (key: string) => {
const client = getS3Client();
const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner');
const putObjectCommand = new PutObjectCommand({
Bucket: process.env.NEXT_PRIVATE_UPLOAD_BUCKET,
Key: key,
@ -59,6 +62,8 @@ export const getAbsolutePresignPostUrl = async (key: string) => {
export const getPresignGetUrl = async (key: string) => {
const client = getS3Client();
const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner');
const getObjectCommand = new GetObjectCommand({
Bucket: process.env.NEXT_PRIVATE_UPLOAD_BUCKET,
Key: key,

View File

@ -3,8 +3,6 @@ import { match } from 'ts-pattern';
import { DocumentDataType } from '@documenso/prisma/client';
import { getAbsolutePresignPostUrl } from './server-actions';
export type UpdateFileOptions = {
type: DocumentDataType;
oldData: string;
@ -40,6 +38,8 @@ const updateFileWithBytes64 = (data: string) => {
};
const updateFileWithS3 = async (key: string, data: string) => {
const { getAbsolutePresignPostUrl } = await import('./server-actions');
const { url } = await getAbsolutePresignPostUrl(key);
const response = await fetch(url, {