Skip to content

Commit 20ab562

Browse files
alaistermircea-pavel-antonJonathanPicquessoedirgoMircea-Pavel Anton
authored
feat: Release V2 (#114)
* feat: improve function return types (#60) * feat: improve types * chore: better error handling * feat: custom storage api error * chore: use custom error type * chore: update custom error type * chore: replace instanceof with isStorageError * chore: move isStorageError to a non-static method * Improve `uploadOrUpdate` returned data. (#63) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * Also return the clean path for the uploaded file. * Update readme. * Add bucket id in returned data. * Update readme * Fix return type for `upload` and `update`. * Fix typo in code snippet comment. * Rename `downloadPath` to `path` * Update return types Co-authored-by: Jonathan Picques <[email protected]> Co-authored-by: Bobbie Soedirgo <[email protected]> Co-authored-by: Mircea-Pavel Anton <[email protected]> * Improve `getPublicUrl` (#62) * Improve `getPublicUrl` * Make return types consistent across all functions. * Undo return type change * Change the `getPublicUrl` method to return only the url as string. * Remove redundant method. * Update tests. Co-authored-by: Mircea-Pavel Anton <[email protected]> * upload, update: don't return bucketId as a return parameter and in the path. Just returning the path without the bucket id makes it easier to pass the value in to other storage-js functions. Also not calling it Key -- was uppercase and not as clear as just calling it path. * add docs folder to .gitignore * Merge branch 'master' into chore/merge-master-04-08-22 (#82) * fix: remove release config from package.json (#83) * chore: merge main into next (#85) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) Co-authored-by: Jonathan Picques <[email protected]> Co-authored-by: Bobbie Soedirgo <[email protected]> * fix: encode all urls fixes #78 this should ideally be done in the api server, but doing this breaking change at the client library first, so when we do it at the backend, only folks who are using the api directly will need to upgrade. * return values is always wrapped by data signedURL used to return a url directly and inside the data object. This is inconsistent. Now we always return values inside a data object only. * fix: pass through all values returned by backend instead of cherry picking only name - we still do this in the types though. also ensures data is always an object. Fixes #6 * fix tests * fix metadata type Previously accessing metada.contentType would throw a type error since we set the type to an empty object. * only export StorageClient #46 removing the change we added for backward compatibility * update ci to node 16 * upgrade typedoc to latest version * fix: move bucket and file api to package folder docs look better when we do this and add the packages to the entrypoint to the typedoc command * modify publicurl to always return data all methods return data and an error * dont return error for getPublicUrl * fix: signed url is returned as signedUrl matches the method name createSignedUrl * downgrade typedoc to 0.22.16 our doc generation pipeline only works with 0.22.16 for now * exclude protected properties from typedoc * fix: typedocs * chore: merge main into next (#99) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) * build(release-rc): sets up the rc branch as an npm prerelease (#98) Co-authored-by: Jonathan Picques <[email protected]> Co-authored-by: Bobbie Soedirgo <[email protected]> * feat: Release V2 RC BREAKING CHANGE: Release V2 * update docs (#102) * Fix docs typo (#104) * chore: increased test coverage (#106) * fix: consistent return types for copy (#110) * feat: download file via url (#112) * fix: merge main into rc (#113) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) * build(release-rc): sets up the rc branch as an npm prerelease (#98) * Adds v1 docs (#107) * docs: ci Co-authored-by: Jonathan Picques <[email protected]> Co-authored-by: Bobbie Soedirgo <[email protected]> Co-authored-by: Copple <[email protected]> Co-authored-by: Mircea-Pavel Anton <[email protected]> Co-authored-by: Jonathan Picques <[email protected]> Co-authored-by: Bobbie Soedirgo <[email protected]> Co-authored-by: Mircea-Pavel Anton <[email protected]> Co-authored-by: Inian <[email protected]> Co-authored-by: Fabrizio <[email protected]> Co-authored-by: Copple <[email protected]>
1 parent b52cdd2 commit 20ab562

26 files changed

+957
-610
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest]
18-
node: ['12']
18+
node: ['16']
1919

2020
runs-on: ${{ matrix.os }}
2121

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest]
15-
node: ['12']
15+
node: ['16']
1616

1717
runs-on: ${{ matrix.os }}
1818

@@ -26,8 +26,8 @@ jobs:
2626

2727
- run: |
2828
npm ci
29-
npm run v1:docs
30-
npm run v1:docs:json
29+
npm run docs
30+
npm run docs:json
3131
3232
- name: Publish
3333
uses: peaceiris/actions-gh-pages@v3

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Release / Node ${{ matrix.node }}
1414
strategy:
1515
matrix:
16-
node: ['14']
16+
node: ['16']
1717

1818
runs-on: ubuntu-latest
1919

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,9 @@ dist
103103

104104
# TernJS port file
105105
.tern-port
106+
107+
# generated docs
108+
docs/v2
109+
110+
# IDE
111+
.idea/

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ const storageClient = new SupabaseStorageClient(STORAGE_URL, {
8282
const { data, error } = await storageClient.from('bucket').upload('path/to/file', fileBody)
8383
```
8484

85+
> Note:
86+
> The path in `data.Key` is prefixed by the bucket ID and is not the value which should be passed to the `download` method in order to fetch the file.
87+
> To fetch the file via the `download` method, use `data.path` and `data.bucketId` as follows:
88+
>
89+
> ```javascript
90+
> const { data, error } = await storageClient.from('bucket').upload('/folder/file.txt', fileBody)
91+
> // check for errors
92+
> const { data2, error2 } = await storageClient.from(data.bucketId).download(data.path)
93+
> ```
94+
8595
> Note: The `upload` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-upload).
8696
8797
- Download a file from an exisiting bucket:
@@ -128,7 +138,7 @@ const storageClient = new SupabaseStorageClient(STORAGE_URL, {
128138

129139
```js
130140
const expireIn = 60
131-
141+
132142
const { data, error } = await storageClient
133143
.from('bucket')
134144
.createSignedUrl('path/to/file', expireIn)

docs/v2/.gitkeep

Whitespace-only changes.

infra/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
PGRST_DB_ANON_ROLE: postgres
2626
PGRST_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
2727
storage:
28-
image: supabase/storage-api:v0.13.0
28+
image: supabase/storage-api:v0.20.2
2929
ports:
3030
- '5000:5000'
3131
depends_on:

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
preset: 'ts-jest',
3-
testEnvironment: 'node',
3+
testEnvironment: 'jsdom',
44
}

0 commit comments

Comments
 (0)