@storecraft/storage-google 1.0.0 → 1.0.1
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.
- package/README.md +10 -1
- package/adapter.js +2 -2
- package/adapter.utils.js +1 -1
- package/{tsconfig.json → jsconfig.json} +0 -4
- package/package.json +4 -4
- package/tests/storage.test.js +1 -1
- package/types.public.d.ts +1 -1
- package/index.js +0 -1
package/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Storecraft Google Cloud Storage
|
2
2
|
|
3
|
+
<div style="text-align:center">
|
4
|
+
<img src='https://storecraft.app/storecraft-color.svg'
|
5
|
+
width='90%'' />
|
6
|
+
</div><hr/><br/>
|
7
|
+
|
3
8
|
`fetch` ready support for an `GCP` **Storage**
|
4
9
|
|
5
10
|
Features:
|
@@ -7,6 +12,10 @@ Features:
|
|
7
12
|
- Supports streaming `Get` / `Put` / `Delete`
|
8
13
|
- Supports `presigned` `Get` / `Put` requests to offload to client
|
9
14
|
|
15
|
+
```bash
|
16
|
+
npm i @storecraft/storage-google
|
17
|
+
```
|
18
|
+
|
10
19
|
## How-to
|
11
20
|
1. Create a bucket at `GCP console` or even at `firebase`
|
12
21
|
2. Download the `service json file`
|
@@ -35,7 +44,7 @@ await storage.putBlob(
|
|
35
44
|
|
36
45
|
// read
|
37
46
|
const { value } = await storage.getBlob('folder1/tomer.txt');
|
38
|
-
const url = await storage.getSigned('folder1/tomer.txt');
|
47
|
+
const { url } = await storage.getSigned('folder1/tomer.txt');
|
39
48
|
console.log('presign GET url ', url);
|
40
49
|
|
41
50
|
```
|
package/adapter.js
CHANGED
@@ -24,8 +24,8 @@ const infer_content_type = (name) => {
|
|
24
24
|
|
25
25
|
|
26
26
|
/**
|
27
|
-
* @typedef {import('./types.public.
|
28
|
-
* @typedef {import('./types.public.
|
27
|
+
* @typedef {import('./types.public.d.ts').ServiceFile} ServiceFile
|
28
|
+
* @typedef {import('./types.public.d.ts').Config} Config
|
29
29
|
*/
|
30
30
|
|
31
31
|
/**
|
package/adapter.utils.js
CHANGED
@@ -2,7 +2,7 @@ import { base64, jwt } from '@storecraft/core/v-crypto';
|
|
2
2
|
|
3
3
|
/**
|
4
4
|
*
|
5
|
-
* @param {import('./types.public.
|
5
|
+
* @param {import('./types.public.d.ts').ServiceFile} sf Google service account json
|
6
6
|
* @param {string} [aud]
|
7
7
|
* @returns
|
8
8
|
*/
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storecraft/storage-google",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "Google Storage
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "Official Google Storage adapter for storecraft",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Tomer Shalev (https://github.com/store-craft)",
|
7
7
|
"homepage": "https://github.com/store-craft/storecraft",
|
@@ -21,8 +21,8 @@
|
|
21
21
|
"storage-google:publish": "npm publish --access public"
|
22
22
|
},
|
23
23
|
"type": "module",
|
24
|
-
"main": "
|
25
|
-
"types": "
|
24
|
+
"main": "adapter.js",
|
25
|
+
"types": "types.public.d.ts",
|
26
26
|
"dependencies": {
|
27
27
|
"@storecraft/core": "^1.0.0"
|
28
28
|
},
|
package/tests/storage.test.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import 'dotenv/config';
|
2
2
|
import { test } from 'uvu';
|
3
3
|
import * as assert from 'uvu/assert';
|
4
|
-
import { GoogleStorage } from '
|
4
|
+
import { GoogleStorage } from '@storecraft/storage-google'
|
5
5
|
import { readFile } from 'node:fs/promises';
|
6
6
|
|
7
7
|
const areBlobsEqual = async (blob1, blob2) => {
|
package/types.public.d.ts
CHANGED
package/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './adapter.js'
|