feat(server): add deprecation notice to /api/file/:fileType/:streamId/:branchName? (#5032)
This commit is contained in:
@@ -70,6 +70,11 @@ import cryptoRandomString from 'crypto-random-string'
|
||||
import { getFeatureFlags } from '@speckle/shared/environment'
|
||||
import { throwIfResourceAccessNotAllowed } from '@/modules/core/helpers/token'
|
||||
import { TokenResourceIdentifierType } from '@/modules/core/domain/tokens/types'
|
||||
import { getModelUploadsFactory } from '@/modules/fileuploads/services/management'
|
||||
import {
|
||||
FileUploadRecord,
|
||||
FileUploadRecordV2
|
||||
} from '@/modules/fileuploads/helpers/types'
|
||||
|
||||
const { FF_LARGE_FILE_IMPORTS_ENABLED, FF_NEXT_GEN_FILE_IMPORTER_ENABLED } =
|
||||
getFeatureFlags()
|
||||
@@ -253,11 +258,6 @@ const fileUploadMutations: Resolvers['FileUploadMutations'] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
import { getModelUploadsFactory } from '@/modules/fileuploads/services/management'
|
||||
import {
|
||||
FileUploadRecord,
|
||||
FileUploadRecordV2
|
||||
} from '@/modules/fileuploads/helpers/types'
|
||||
|
||||
export = {
|
||||
Stream: {
|
||||
|
||||
@@ -13,12 +13,18 @@ import { UnauthorizedError } from '@/modules/shared/errors'
|
||||
import { ensureError, Nullable } from '@speckle/shared'
|
||||
import { UploadRequestErrorMessage } from '@/modules/fileuploads/helpers/rest'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
|
||||
const { FF_LARGE_FILE_IMPORTS_ENABLED } = getFeatureFlags()
|
||||
|
||||
export const fileuploadRouterFactory = (): Router => {
|
||||
const processNewFileStream = processNewFileStreamFactory()
|
||||
|
||||
const app = Router()
|
||||
|
||||
/**
|
||||
* @deprecated use POST /graphql (mutation.fileUploadMutations.generateUploadUrl), then PUT (to the provided url), then POST /graphql (mutation.fileUploadMutations.startFileImport)
|
||||
*/
|
||||
app.post(
|
||||
'/api/file/:fileType/:streamId/:branchName?',
|
||||
authMiddlewareCreator(
|
||||
@@ -89,6 +95,14 @@ export const fileuploadRouterFactory = (): Router => {
|
||||
logger.error(ensureError(err), 'File importer handling error @deprecated')
|
||||
res.status(500)
|
||||
}
|
||||
|
||||
if (FF_LARGE_FILE_IMPORTS_ENABLED) {
|
||||
res.setHeader(
|
||||
'Warning',
|
||||
'Deprecated API; use POST /graphql (mutation.fileUploadMutations.generateUploadUrl), then PUT (to the provided url), then POST /graphql (mutation.fileUploadMutations.startFileImport)'
|
||||
)
|
||||
}
|
||||
|
||||
res.status(201).send({ uploadResults })
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
Reference in New Issue
Block a user