Skip to content

Commit

Permalink
Merge branch 'main' into feat-gcs-locker
Browse files Browse the repository at this point in the history
* main:
  Add issue templates
  [ci] release (tus#625)
  Add .npmrc
  @tus/server: add `lastPath` arg to `getFileIdFromRequest` (tus#626)
  Add basic storage info to Upload model (tus#624)
  Release
  v0.0.0
  @tus/server: allow onUploadFinish hook to override response data (tus#615)
  • Loading branch information
Murderlon committed Jul 15, 2024
2 parents 8982256 + a09bb31 commit d4cecf7
Show file tree
Hide file tree
Showing 34 changed files with 425 additions and 100 deletions.
5 changes: 0 additions & 5 deletions .changeset/fifty-pianos-hug.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/four-owls-juggle.md

This file was deleted.

41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 🐛 Bug report
labels: [bug]
description: Describe a bug with a project
body:
- type: checkboxes
id: initial-checklist
attributes:
label: Initial checklist
options:
- label:
I understand this is a bug report and questions should be posted in the
[Community Forum](https://community.transloadit.com/c/tus/6)
required: true
- label:
I searched
[issues](https://github.com/tus/tus-node-server/issues?q=is%3Aissue) and
couldn’t find anything (or linked relevant results below)
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description:
How did this happen? Please provide a [minimal, reproducible
example](https://stackoverflow.com/help/minimal-reproducible-example).
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What should happen?
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: What happens instead?
validations:
required: true
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/2-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 🚀 Feature request
labels: [feature]
description: Suggest an idea
body:
- type: checkboxes
id: initial-checklist
attributes:
label: Initial checklist
options:
- label:
I understand this is a feature request and questions should be posted in the
[Community Forum](https://community.transloadit.com/c/tus/6)
required: true
- label:
I searched
[issues](https://github.com/tus/tus-node-server/issues?q=is%3Aissue) and
couldn’t find anything (or linked relevant results below)
required: true
- type: textarea
id: problem
attributes:
label: Problem
description: Please describe the problem you are trying to solve here.
validations:
required: true
- type: textarea
id: solution
attributes:
label: Solution
description: What should happen? Please describe the desired behavior.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives
description:
What are the alternative solutions? Can this be solved in a different way?
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 🙋 Ask a question
url: https://community.transloadit.com/c/tus/6
about: Ask questions and discuss with other community members
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
8 changes: 4 additions & 4 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"start:s3": "cross-env DATA_STORE=S3Store node server.js"
},
"dependencies": {
"@tus/file-store": "^1.3.2",
"@tus/gcs-store": "^1.2.1",
"@tus/s3-store": "^1.4.2",
"@tus/server": "^1.5.0",
"@tus/file-store": "^1.4.0",
"@tus/gcs-store": "^1.3.0",
"@tus/s3-store": "^1.5.0",
"@tus/server": "^1.7.0",
"tus-js-client": "^2.3.2"
},
"devDependencies": {
Expand Down
38 changes: 20 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.8",
"turbo": "^1.13.0"
}
},
"version": "0.0.0"
}
20 changes: 20 additions & 0 deletions packages/file-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @tus/file-store

## 1.4.0

### Minor Changes

- 117e1b2: Add basic storage information to the Upload model. You can now access
`upload.storage` which has `type` (`file`, `s3`, `gcs`), `path`, and when applicable
`bucket`.

### Patch Changes

- Updated dependencies [117e1b2]
- @tus/utils@0.3.0

## 1.3.3

### Patch Changes

- Updated dependencies [60698da]
- @tus/utils@0.2.0

## 1.3.2

### Patch Changes
Expand Down
6 changes: 5 additions & 1 deletion packages/file-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ export class FileStore extends DataStore {
*/
async create(file: Upload): Promise<Upload> {
const dirs = file.id.split('/').slice(0, -1)
const filePath = path.join(this.directory, file.id)

await fsProm.mkdir(path.join(this.directory, ...dirs), {recursive: true})
await fsProm.writeFile(path.join(this.directory, file.id), '')
await fsProm.writeFile(filePath, '')
await this.configstore.set(file.id, file)

file.storage = {type: 'file', path: filePath}

return file
}

Expand Down Expand Up @@ -164,6 +167,7 @@ export class FileStore extends DataStore {
offset: stats.size,
metadata: file.metadata,
creation_date: file.creation_date,
storage: {type: 'file', path: file_path},
})
)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/file-store/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@tus/file-store",
"version": "1.3.2",
"version": "1.4.0",
"description": "Local file storage for @tus/server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -21,7 +21,7 @@
"test": "mocha test.ts --exit --extension ts --require ts-node/register"
},
"dependencies": {
"@tus/utils": "^0.1.0",
"@tus/utils": "^0.3.0",
"debug": "^4.3.4"
},
"devDependencies": {
Expand Down
21 changes: 21 additions & 0 deletions packages/gcs-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# @tus/gcs-store

## 1.3.0

### Minor Changes

- 117e1b2: Add basic storage information to the Upload model. You can now access
`upload.storage` which has `type` (`file`, `s3`, `gcs`), `path`, and when applicable
`bucket`.

### Patch Changes

- Updated dependencies [117e1b2]
- @tus/utils@0.3.0

## 1.2.2

### Patch Changes

- 86b8b9f: Fix CRC32 error when writing offsetted data to store
- Updated dependencies [60698da]
- @tus/utils@0.2.0

## 1.2.1

### Patch Changes
Expand Down
5 changes: 5 additions & 0 deletions packages/gcs-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class GCSStore extends DataStore {

const gcs_file = this.bucket.file(file.id)

file.storage = {type: 'gcs', path: file.id, bucket: this.bucket.name}

const options = {
metadata: {
metadata: {
Expand All @@ -41,6 +43,7 @@ export class GCSStore extends DataStore {
sizeIsDeferred: `${file.sizeIsDeferred}`,
offset: file.offset,
metadata: JSON.stringify(file.metadata),
storage: JSON.stringify(file.storage),
},
},
}
Expand Down Expand Up @@ -82,6 +85,7 @@ export class GCSStore extends DataStore {
sizeIsDeferred: `${upload.sizeIsDeferred}`,
offset,
metadata: JSON.stringify(upload.metadata),
storage: JSON.stringify(upload.storage),
},
},
}
Expand Down Expand Up @@ -150,6 +154,7 @@ export class GCSStore extends DataStore {
size: size ? Number.parseInt(size, 10) : size,
offset: Number.parseInt(metadata.size, 10), // `size` is set by GCS
metadata: meta ? JSON.parse(meta) : undefined,
storage: {type: 'gcs', path: id, bucket: this.bucket.name},
})
)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/gcs-store/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@tus/gcs-store",
"version": "1.2.1",
"version": "1.3.0",
"description": "Google Cloud Storage for @tus/server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -21,12 +21,12 @@
"test": "mocha test.ts --timeout 30000 --exit --extension ts --require ts-node/register"
},
"dependencies": {
"@tus/utils": "^0.1.0",
"@tus/utils": "^0.3.0",
"debug": "^4.3.4"
},
"devDependencies": {
"@google-cloud/storage": "^7.11.0",
"@tus/server": "^1.4.1",
"@tus/server": "^1.7.0",
"@types/debug": "^4.1.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.5",
Expand Down
Loading

0 comments on commit d4cecf7

Please sign in to comment.