{"_id":"@amplication/plugin-storage-core","_rev":"3-d04bd04760a62ae5edfe2df7b60968a9","name":"@amplication/plugin-storage-core","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@amplication/plugin-storage-core","version":"0.0.1","author":{"name":"Ashish Padhy","email":"100484401+Shurtu-gal@users.noreply.github.com"},"license":"Apache-2.0","_id":"@amplication/plugin-storage-core@0.0.1","maintainers":[{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"},{"name":"overbit","email":"daniele.iasella@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"amitbarletz","email":"amit@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"}],"nx":{},"dist":{"shasum":"60093ac7cdb8af7daee20d551fd65f6c8d6839d9","tarball":"https://registry.npmjs.org/@amplication/plugin-storage-core/-/plugin-storage-core-0.0.1.tgz","fileCount":41,"integrity":"sha512-ndGZR9+sWLXtdio68ZtdY0SLjXq104Y/XCL4IyQVcPzIjvuRu8is2zdx8UsJAPhPW1++JYCSf1ZntaEB5Nd2XQ==","signatures":[{"sig":"MEYCIQC/2g2o312yL4boFnxvJY1caVW6pZPOdVRm/+3Qxz34lAIhAJGDJ14v11wFnFGnMCElhTMhl5zNXC80PxLn2DFCULBT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3120442},"jest":{"rootDir":"src/tests","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"passWithNoTests":true,"testEnvironment":"node","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","gitHead":"7723b83cfb7af46a9eb9db23854dd8e9c653d7d3","scripts":{"dev":"webpack --watch","test":"jest","build":"webpack","prebuild":"rimraf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"amplication-bot","email":"engineering@amplication.com"},"_npmVersion":"10.5.0","description":"Adds the core functionality for file upload to Amplication","directories":{},"_nodeVersion":"18.20.2","dependencies":{"lodash":"^4.17.21","pascal-case":"^3.1.2","@amplication/code-gen-types":"^2.0.27","@amplication/code-gen-utils":"^0.0.9"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.53.0","rimraf":"^5.0.5","ts-jest":"^29.1.1","webpack":"^5.89.0","prettier":"^3.1.0","ts-loader":"^9.5.1","typescript":"^5.2.2","@types/jest":"^29.5.8","webpack-cli":"^5.1.4","@babel/types":"^7.23.3","@babel/parser":"^7.23.3","@types/lodash":"^4.14.201","jest-mock-extended":"^3.0.5","copy-webpack-plugin":"^11.0.0","@typescript-eslint/parser":"^6.11.0","@typescript-eslint/eslint-plugin":"^6.11.0"},"_npmOperationalInternal":{"tmp":"tmp/plugin-storage-core_0.0.1_1714403628909_0.9244916732922339","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@amplication/plugin-storage-core","version":"0.0.2","author":{"name":"Ashish Padhy","email":"100484401+Shurtu-gal@users.noreply.github.com"},"license":"Apache-2.0","_id":"@amplication/plugin-storage-core@0.0.2","maintainers":[{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"},{"name":"overbit","email":"daniele.iasella@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"amitbarletz","email":"amit@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"}],"nx":{},"dist":{"shasum":"d9765ca51a449db8ad05833a4f95319e386f61dd","tarball":"https://registry.npmjs.org/@amplication/plugin-storage-core/-/plugin-storage-core-0.0.2.tgz","fileCount":41,"integrity":"sha512-jBuuZv5yXR1iGTEURkFPvie53Qvw0JEWBb2l9PY+bkrbUJFeKuhngqunG7Y2rSLcgM6WPTY+vk/Ne8Zt300ZEQ==","signatures":[{"sig":"MEYCIQDaO5QArQ8TWocHeIo2B1D9XpqARzjSDQTiOLiynCOHoQIhAKw7XskURLxb/71cqiQ9dE8JjpRCfoodyUwIB5M0Zws8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3120442},"jest":{"rootDir":"src/tests","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"passWithNoTests":true,"testEnvironment":"node","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","gitHead":"4f08fd12ad0715ae0bc08b994b0ed45fd811ac77","scripts":{"dev":"webpack --watch","test":"jest","build":"webpack","prebuild":"rimraf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"amplication-bot","email":"engineering@amplication.com"},"_npmVersion":"10.5.0","description":"Adds the core functionality for file upload to Amplication","directories":{},"_nodeVersion":"18.20.2","dependencies":{"lodash":"^4.17.21","pascal-case":"^3.1.2","@amplication/code-gen-types":"^2.0.27","@amplication/code-gen-utils":"^0.0.9"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.53.0","rimraf":"^5.0.5","ts-jest":"^29.1.1","webpack":"^5.89.0","prettier":"^3.1.0","ts-loader":"^9.5.1","typescript":"^5.2.2","@types/jest":"^29.5.8","webpack-cli":"^5.1.4","@babel/types":"^7.23.3","@babel/parser":"^7.23.3","@types/lodash":"^4.14.201","jest-mock-extended":"^3.0.5","copy-webpack-plugin":"^11.0.0","@typescript-eslint/parser":"^6.11.0","@typescript-eslint/eslint-plugin":"^6.11.0"},"_npmOperationalInternal":{"tmp":"tmp/plugin-storage-core_0.0.2_1714404693514_0.13356521070969718","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-29T15:13:48.801Z","modified":"2024-09-09T13:32:47.242Z","0.0.1":"2024-04-29T15:13:49.142Z","0.0.2":"2024-04-29T15:31:33.769Z"},"author":{"name":"Ashish Padhy","email":"100484401+Shurtu-gal@users.noreply.github.com"},"license":"Apache-2.0","description":"Adds the core functionality for file upload to Amplication","maintainers":[{"email":"engineering@amplication.com","name":"amplication-bot"},{"email":"muly@amplication.com","name":"mulygottlieb"},{"email":"vanNoort.levi@protonmail.com","name":"levivannoort"},{"email":"mor@amplication.com","name":"morhag"},{"email":"hazaz.yuval@gmail.com","name":"yuvalhazaz"}],"readme":"# @amplication/plugin-storage-core\n\n[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-storage-core)](https://www.npmjs.com/package/@amplication/plugin-storage-core)\n\n## Purpose\n\nThis plugin is used for integrating storage services into your app generated by Amplication. The plugin will add the required core functionality on top of which other storage services can be built.\n\n> [!CAUTION]\n> The other storage plugins should have plugin ids of the form `storage-<provider>` and should be added through the plugins page of the app settings before adding this plugin to get the expected functionality.\n\n## Working with the plugin\n\nIt can be used by adding the plugin in the `plugins` page of the app settings. For this plugin, no additional settings are required.\n\n> [!NOTE]\n> There should be enitities with fields of data type `File` for this plugin to generate any additional functionality.\n\n## What the plugin does\n\n### Adds resolver and controller methods\n\nThe following methods are added for each field of type `File` in the entities:\n\n**Resolver methods:**\n\n- upload< FieldName in PascalCase >: Upload a file to the storage service.\n- delete< FieldName in PascalCase >: Delete the file from the storage service.\n\n**Controller methods:**\n\n- upload< FieldName in PascalCase >: Upload a file to the storage service.\n- delete< FieldName in PascalCase >: Delete the file from the storage service.\n- download< FieldName in PascalCase >: Download the file from the storage service.\n\n### Generates the configuration for file upload services\n\nIt adds graphqlUploadExpress middleware to the express app to let the app handle file uploads.\n\n### Adds the storage core service abstract class\n\nThe plugin adds the `StorageService` abstract class which can be extended to create storage services for different storage providers. The class does the following:\n\n- Checks if the file is of the correct mimetype and size.\n- Generates a unique file name.\n- Gives proper mime type while downloading the file.\n\n### How is file upload handled?\n\nWhen a file is uploaded, the file is saved through the storage service and the following JSON is saved in the database:\n\n```json\n{\n  \"uuid\": \"/path/to/file\", // UUID for the file (can be used to retrieve the file eg. URL or file path)\n  \"filename\": \"profilePicture-<id of entity>\",\n  \"mimetype\": \"image/jpeg\",\n  \"encoding\": \"7bit\",\n  \"size\": 123456, // File size in bytes\n  \"metadata\": {} // Provider specific metadata\n}\n```\n\n## Scripts\n\n### `build`\n\nRunning `npm run build` will bundle your plugin with Webpack for production.\n\n### `dev`\n\nRunning `npm run dev` will watch your plugin's source code and automatically bundle it with every change.\n","readmeFilename":"README.md"}