Skip to content

Commit

Permalink
merging backend logic (DevinoSolutions#252)
Browse files Browse the repository at this point in the history
* feat(security): implemented pre-signed URL upload approach

BREAKING CHANGE: Replaced direct cloud storage configuration with pre-signed URLs

- Added pre-signed URL endpoint configuration
- Removed cloud storage credentials from frontend
- Deleted cloud storage config files
- Updated upload logic to use pre-signed URLs
- Simplified configuration interface

* fix(upload): resolved CORS issues in pre-signed URL upload

- Added CORS mode to uploadObject fetch request
- Prettier fixes

BREAKING CHANGE: Requires S3 bucket CORS configuration

* fix(app): build and prettier fixes

* chore(app): undoing unnecessary commit changes

* feat(storage): implemented and refined cloud storage SDK integrations

- Added client-side SDK approach for cloud storage providers
- Implemented AWS integration with presigned URLs
- Added credential refresh and SAS token management
- Implemented progress tracking and retry mechanisms
- Fixed type errors and improve error handling
- Removed unused code and align with latest SDK versions

BREAKING CHANGE: Storage configuration requires provider-specific SDK setup

* feat(storage): implemented Azure SDK integrations

- Added client-side SDK approach for Azure provider
- Implemented Azure integration with presigned URLs
- Implemented progress tracking
- Removed unused code and align with latest SDK versions

* chore(app): removed todo from commit

* refactor(app): streamline storageConfig prop values

- Storage config only requires `provider` and `tokenEndpoint` values

* feat(storage): implemented DO SDK integrations

- Added client-side SDK approach for DO provider
- Implemented DO integration with presigned URLs

* feat(app): s3 compliant support

- Unified s3 client-side upload approach for S3 complaint storage providers

* feat(app): merged azure and s3 SDK into one

- preview url for uploaded files

* fix(app): fixed console warning about ETag header

- made ETag header conditional
- removed `previewUrl` from object returned to FE

* feat(app): backend logic

- changed folder structure to accommodate BE logic

* chore(app): build fixes and clean up

* chore(app): better path resolutions and prettier fixes

* feat(app): dual builds

* feat(app): successful merged builds

* fix(app): prettier fixes

* fix(app): review fixes

- undid setting `Content-Type ` header when sending fetch request from `uploadObject`
- improved logic for `handleError`
- improved validation of required configuration
- Enhanced error handling by including `xhr.status` and `xhr.statusText` when reporting error from `uploadWithProgress`
- fixed issue with build failing when temp dist directory exists
  • Loading branch information
amjedidiah authored Dec 4, 2024
1 parent 6673ed3 commit b77719f
Show file tree
Hide file tree
Showing 89 changed files with 2,734 additions and 1,815 deletions.
51 changes: 22 additions & 29 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"chrome": 100
"node": "14",
"browsers": ">0.25%, not ie 11, not op_mini all"
}
}
],
"@babel/preset-typescript",
["@babel/preset-react", { "runtime": "automatic" }]
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
[
"module-resolver",
{
"extensions": [".ts", ".tsx"],
"root": "./src",
"alias": {
"#components": "./src/components",
"#types": ["./src/types"],
"#hooks": ["./src/hooks"],
"#lib": ["./src/lib"]
}
}
],
[
"@emotion",
{
"sourceMap": true,
"autoLabel": "dev-only",
"labelFormat": "[local]",
"cssPropOptimization": true
}
]
]
"env": {
"node": {
"plugins": [
[
"babel-plugin-transform-import-ignore",
{
"patterns": [
"*.css",
"react",
"react-dom",
"framer-motion"
]
}
]
]
}
}
}
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ tsconfig.json
postcss.config.js
tailwind.config.js
tsdx.config.js
dist/hooks/useUpup.d.ts
dist/version.ts
!dist
5 changes: 4 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"plugins": [
"prettier-plugin-organize-imports",
"prettier-plugin-tailwindcss"
]
],
"importOrder": ["^react$", "^[^.]", "^\\."],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
4 changes: 0 additions & 4 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ const config = {
},
},
],
docs: {
autodocs: true,
defaultName: 'Documentation',
},
core: {
builder: '@storybook/builder-webpack5',
},
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../src/tailwind.css'
import '../src/frontend/tailwind.css'

// https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters
export const parameters = {
Expand Down
46 changes: 39 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,34 @@
"readme": "README.md",
"main": "dist/index.js",
"module": "dist/upup.esm.js",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"types": "./dist/index.browser.d.ts",
"typings": "./dist/index.browser.d.ts",
"exports": {
".": {
"types": "./dist/index.browser.d.ts",
"browser": "./dist/browser.esm.js",
"import": "./dist/browser.esm.js",
"require": "./dist/browser.cjs.development.js"
},
"./server": {
"types": "./dist/index.node.d.ts",
"default": "./dist/node.node.js"
},
"./shared": {
"types": "./dist/shared/types/StorageSDK.d.ts"
}
},
"typesVersions": {
"*": {
"*": [
"./dist/index.d.ts"
]
}
},
"browser": "./dist/upup.esm.js",
"repository": {
"type": "git",
"url": "git+https://github.com/uNotesOfficial/upup.git"
"url": "git+https://github.com/DevinoSolutions/upup.git"
},
"packageManager": "pnpm@8.10.5",
"keywords": [
Expand All @@ -31,7 +54,9 @@
"scripts": {
"start": "pnpm run prebuild && tsdx watch",
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
"build": "pnpm run prebuild && tsdx build",
"build:browser": "tsdx build --entry ./src/index.browser.ts --tsconfig ./tsconfig.browser.json --format esm,cjs --name browser",
"build:node": "tsdx build --entry ./src/index.node.ts --tsconfig ./tsconfig.node.json --format cjs --name node",
"build": "node scripts/build.js",
"test": "tsdx test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "tsdx build",
Expand Down Expand Up @@ -61,6 +86,8 @@
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@changesets/cli": "^2.26.2",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^5.0.5",
"@size-limit/preset-small-lib": "^10.0.3",
"@storybook/addon-docs": "^7.6.20",
Expand Down Expand Up @@ -107,14 +134,14 @@
"@aws-sdk/client-s3": "^3.689.0",
"@aws-sdk/s3-request-presigner": "^3.689.0",
"@aws-sdk/xhr-http-handler": "^3.451.0",
"@azure/identity": "^4.5.0",
"@azure/msal-browser": "^3.5.0",
"@azure/storage-blob": "^12.25.0",
"@emotion/styled": "^11.11.0",
"@google-cloud/storage": "^7.14.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@mui/material": "^5.14.18",
"@types/gapi": "^0.0.47",
"authProviders": "link:@microsoft/microsoft-graph-client/authProviders",
"babel-plugin-module-resolver": "^5.0.0",
"framer-motion": "^10.16.5",
"load-script": "^2.0.0",
Expand All @@ -127,8 +154,12 @@
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.x",
"@mui/material": "^5.x",
"@mui/system": "^5.x",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-is": "^18.2.0"
},
"pnpm": {
"overrides": {
Expand All @@ -144,6 +175,7 @@
},
"resolutions": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"rollup": "^2.68.0"
}
}
Loading

0 comments on commit b77719f

Please sign in to comment.