@payloadcms/plugin-cloud-storage 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +23 -0
  2. package/gcs.d.ts +1 -0
  3. package/gcs.js +1 -0
  4. package/package.json +8 -2
package/README.md CHANGED
@@ -37,6 +37,7 @@ This plugin supports the following adapters:
37
37
 
38
38
  - [Azure Blob Storage](#azure-blob-storage-adapter)
39
39
  - [AWS S3-style Storage](#s3-adapter)
40
+ - [Google Cloud Storage](#gcs-adapter)
40
41
 
41
42
  However, you can create your own adapter for any third-party service you would like to use.
42
43
 
@@ -98,6 +99,28 @@ const adapter = s3Adapter({
98
99
  // Now you can pass this adapter to the plugin
99
100
  ```
100
101
 
102
+ ### GCS Adapter
103
+
104
+ To use the GCS adapter, you need to have `@google-cloud/storage` installed in your project dependencies. To do so, run `yarn add @google-storage/cloud`.
105
+
106
+ From there, create the adapter, passing in all of its required properties:
107
+
108
+ ```js
109
+ import { gcsAdapter } from '@payloadcms/plugin-cloud-storage/gcs';
110
+
111
+ const adapter = gcsAdapter({
112
+ options: {
113
+ // you can choose any method for authentication, and authorization which is being provided by `@google-cloud/storage`
114
+ keyFilename: './gcs-credentials.json',
115
+ //OR
116
+ credentials: JSON.parse(process.env.GCS_CREDENTIALS) // this env variable will have stringify version of your credentials.json file
117
+ },
118
+ bucket: process.env.GCS_BUCKET,
119
+ })
120
+
121
+ // Now you can pass this adapter to the plugin
122
+ ```
123
+
101
124
  ### Payload Access Control
102
125
 
103
126
  Payload ships with access control that runs _even on statically served files_. The same `read` access control property on your `upload`-enabled collections is used, and it allows you to restrict who can request your uploaded files.
package/gcs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/adapters/gcs'
package/gcs.js ADDED
@@ -0,0 +1 @@
1
+ exports.gcsAdapter = require('./dist/adapters/gcs').gcsAdapter
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-cloud-storage",
3
3
  "description": "The official cloud storage plugin for Payload CMS",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "SEE LICENSE IN LICENSE.MD",
@@ -12,7 +12,9 @@
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@aws-sdk/client-s3": "^3.142.0",
15
- "@azure/storage-blob": "^12.11.0"
15
+ "@azure/storage-blob": "^12.11.0",
16
+ "@google-cloud/storage": "^6.4.1",
17
+ "payload": "^1.0.27"
16
18
  },
17
19
  "peerDependenciesMeta": {
18
20
  "@aws-sdk/client-s3": {
@@ -20,6 +22,9 @@
20
22
  },
21
23
  "@azure/storage-blob": {
22
24
  "optional": true
25
+ },
26
+ "@google-cloud/storage": {
27
+ "optional": true
23
28
  }
24
29
  },
25
30
  "files": [
@@ -31,6 +36,7 @@
31
36
  "devDependencies": {
32
37
  "@aws-sdk/client-s3": "^3.142.0",
33
38
  "@azure/storage-blob": "^12.11.0",
39
+ "@google-cloud/storage": "^6.4.1",
34
40
  "@types/express": "^4.17.9",
35
41
  "@typescript-eslint/eslint-plugin": "5.12.1",
36
42
  "@typescript-eslint/parser": "5.12.1",