@genoacms/adapter-gcp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/auth/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/database/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {};
|
package/dist/storage/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Storage } from '@google-cloud/storage';
|
2
|
-
import config from '@genoacms/cloudabstraction
|
2
|
+
import { config } from '@genoacms/cloudabstraction';
|
3
3
|
const storage = new Storage({
|
4
4
|
// @ts-expect-error: TODO: type this adapter
|
5
5
|
credentials: config.adapter.gcp.credentials
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@genoacms/adapter-gcp",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.1",
|
4
4
|
"description": "Implementation of abstraction layer of GenoaCMS for GCP",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": {
|
@@ -29,6 +29,7 @@
|
|
29
29
|
"eslint-plugin-import": "^2.29.0",
|
30
30
|
"eslint-plugin-n": "^16.2.0",
|
31
31
|
"eslint-plugin-promise": "^6.1.1",
|
32
|
+
"rimraf": "^5.0.5",
|
32
33
|
"typescript": "^5.2.2"
|
33
34
|
},
|
34
35
|
"files": [
|
@@ -37,16 +38,19 @@
|
|
37
38
|
],
|
38
39
|
"exports": {
|
39
40
|
"./auth": {
|
40
|
-
"import": "./dist/auth/index.js"
|
41
|
+
"import": "./dist/auth/index.js",
|
42
|
+
"types": "./dist/auth/index.d.ts"
|
41
43
|
},
|
42
44
|
"./database": {
|
43
|
-
"import": "./dist/database/index.js"
|
45
|
+
"import": "./dist/database/index.js",
|
46
|
+
"types": "./dist/database/index.d.ts"
|
44
47
|
},
|
45
48
|
"./storage": {
|
46
|
-
"import": "./dist/storage/index.js"
|
49
|
+
"import": "./dist/storage/index.js",
|
50
|
+
"types": "./dist/storage/index.d.ts"
|
47
51
|
}
|
48
52
|
},
|
49
53
|
"scripts": {
|
50
|
-
"build": "tsc"
|
54
|
+
"build": "rimraf dist && tsc"
|
51
55
|
}
|
52
56
|
}
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import type {
|
2
|
-
|
3
|
-
|
4
|
-
} from '@genoacms/cloudabstraction/src/services/storage'
|
2
|
+
storage as storageT
|
3
|
+
} from '@genoacms/cloudabstraction'
|
5
4
|
import { Storage } from '@google-cloud/storage'
|
6
|
-
import config from '@genoacms/cloudabstraction
|
5
|
+
import { config } from '@genoacms/cloudabstraction'
|
7
6
|
|
8
7
|
const storage = new Storage({
|
9
8
|
// @ts-expect-error: TODO: type this adapter
|
@@ -12,7 +11,7 @@ const storage = new Storage({
|
|
12
11
|
// @ts-expect-error: TODO: type this adapter
|
13
12
|
const bucket = storage.bucket(config.adapter.gcp.storage.bucket)
|
14
13
|
|
15
|
-
const listDirectory:
|
14
|
+
const listDirectory: storageT.listDirectory = async ({ limit, prefix }) => {
|
16
15
|
const [files] = await bucket.getFiles({
|
17
16
|
prefix,
|
18
17
|
maxResults: limit
|
@@ -23,7 +22,7 @@ const listDirectory: listDirectoryT = async ({ limit, prefix }) => {
|
|
23
22
|
size: file.metadata.size,
|
24
23
|
// @ts-expect-error: Handle this
|
25
24
|
lastModified: new Date(file.metadata.updated)
|
26
|
-
} as StorageObject
|
25
|
+
} as storageT.StorageObject
|
27
26
|
})
|
28
27
|
}
|
29
28
|
|