From 7125a899331253ff82fe518606f9623b98b36ed5 Mon Sep 17 00:00:00 2001 From: Aaron Sutula Date: Wed, 23 Sep 2020 13:49:09 -0500 Subject: [PATCH] feat: pg 0.6.2, getStorageJob, release drafter Signed-off-by: Aaron Sutula --- .github/release-drafter.yml | 37 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 16 ++++++++++++ package-lock.json | 22 ++++++++-------- package.json | 2 +- src/ffs/index.spec.ts | 9 +++++++ src/ffs/index.ts | 18 +++++++++++++ 6 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..8b1a5bcb --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,37 @@ +name-template: "v$RESOLVED_VERSION 🌈" +tag-template: "v$RESOLVED_VERSION" +categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "🧰 Maintenance" + label: "chore" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch +exclude-labels: + - "skip-changelog" +template: | + ## Changes + + $CHANGES + + 🙏 A big thank you to all the contributors to this release: + + $CONTRIBUTORS diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..2c30bcdb --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package-lock.json b/package-lock.json index eb424e53..5d00c4a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -435,13 +435,13 @@ "integrity": "sha512-Ev8pfMs7FbsBWc4FAY8N4dd8xQRowHFyu2AzEHl++8orrB4KSx6NonMqlsLDPBHLKwlYs7EEI6uxGwpjnYiS2Q==" }, "@textile/grpc-powergate-client": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@textile/grpc-powergate-client/-/grpc-powergate-client-0.4.0.tgz", - "integrity": "sha512-IJrqc9Eg302vRXT6OfwDt6WN7n8j0CVBVPJB/E9u67A2X3kBoi1Vig0UlIS34s2zHVgOX/1TgvqmTXmUZXL3Mg==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@textile/grpc-powergate-client/-/grpc-powergate-client-0.6.2.tgz", + "integrity": "sha512-Iew7vUX+d3wc9NuQOZPZHxx51mkqZObLrfmH7E4PgiuZ1rOODeT8rQQc6GDbLlT/YJ91xYhWon8BeBuwruuS4g==", "requires": { "@improbable-eng/grpc-web": "^0.13.0", - "@types/google-protobuf": "^3.7.2", - "google-protobuf": "^3.12.4" + "@types/google-protobuf": "^3.7.3", + "google-protobuf": "^3.13.0" } }, "@types/chai": { @@ -482,9 +482,9 @@ "dev": true }, "@types/google-protobuf": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/@types/google-protobuf/-/google-protobuf-3.7.2.tgz", - "integrity": "sha512-ifFemzjNchFBCtHS6bZNhSZCBu7tbtOe0e8qY0z2J4HtFXmPJjm6fXSaQsTG7yhShBEZtt2oP/bkwu5k+emlkQ==" + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/@types/google-protobuf/-/google-protobuf-3.7.3.tgz", + "integrity": "sha512-FRwj40euE2bYkG+0X5w2nEA8yAzgJRcEa7RBd0Gsdkb9/tPM2pctVVAvnOUTbcXo2VmIHPo0Ae94Gl9vRHfKzg==" }, "@types/json-schema": { "version": "7.0.5", @@ -3289,9 +3289,9 @@ } }, "google-protobuf": { - "version": "3.12.4", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.12.4.tgz", - "integrity": "sha512-ItTn8YepDQMHEMHloUPH+FDaTPiHTnbsMvP50aXfbI65IK3AA5+wXlHSygJH8xz+h1g4gu7V+CK5X1/SaGITsA==" + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.13.0.tgz", + "integrity": "sha512-ZIf3qfLFayVrPvAjeKKxO5FRF1/NwRxt6Dko+fWEMuHwHbZx8/fcaAao9b0wCM6kr8qeg2te8XTpyuvKuD9aKw==" }, "graceful-fs": { "version": "4.2.4", diff --git a/package.json b/package.json index fc55dee7..a211106a 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ }, "dependencies": { "@improbable-eng/grpc-web-node-http-transport": "^0.13.0", - "@textile/grpc-powergate-client": "0.4.0", + "@textile/grpc-powergate-client": "0.6.2", "ipfs-http-client": "^45.0.0" } } diff --git a/src/ffs/index.spec.ts b/src/ffs/index.spec.ts index bf58d7af..839a929d 100644 --- a/src/ffs/index.spec.ts +++ b/src/ffs/index.spec.ts @@ -79,6 +79,14 @@ describe("ffs", function () { await expectPushStorageConfig(cid, { override: false, storageConfig: config }) }) + it("should get storage job", async () => { + await expectNewInstance() + const cid = await expectStage("sample-data/samplefile") + const jobId = await expectPushStorageConfig(cid) + const res = await c.getStorageJob(jobId) + expect(res.job?.cid).eq(cid) + }) + it("should watch job", async () => { await expectNewInstance() const addrs = await expectAddrs(1) @@ -267,6 +275,7 @@ describe("ffs", function () { hot: { allowUnfreeze: false, enabled: false, + unfreezeMaxPrice: 0, }, } const jobId = await expectPushStorageConfig(cid, { override: false, storageConfig: conf }) diff --git a/src/ffs/index.ts b/src/ffs/index.ts index fda52303..43cec2c9 100644 --- a/src/ffs/index.ts +++ b/src/ffs/index.ts @@ -12,6 +12,8 @@ import { GetRequest, GetStorageConfigRequest, GetStorageConfigResponse, + GetStorageJobRequest, + GetStorageJobResponse, IDRequest, IDResponse, InfoRequest, @@ -136,6 +138,13 @@ export interface FFS { */ info: () => Promise + /** + * Get the current state of a storage job. + * @param jobId The job id to query. + * @returns The current state of the storage job. + */ + getStorageJob: (jobId: string) => Promise + /** * Listen for job updates for the provided job ids. * @param handler The callback to receive job updates. @@ -373,6 +382,15 @@ export const createFFS = ( (res: InfoResponse) => res.toObject(), ), + getStorageJob: (jobId: string) => { + const req = new GetStorageJobRequest() + req.setJid(jobId) + return promise( + (cb) => client.getStorageJob(req, getMeta(), cb), + (res: GetStorageJobResponse) => res.toObject(), + ) + }, + watchJobs: (handler: (event: Job.AsObject) => void, ...jobs: string[]) => { const req = new WatchJobsRequest() req.setJidsList(jobs)