Skip to content

Commit

Permalink
chore: update deps (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato authored Sep 13, 2020
1 parent f641282 commit cff24a7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ on:

jobs:
build:
name: build-${{ matrix.deno-version == 'nightly' && 'nightly' || 'release' }}-${{ matrix.unstable && 'unstable' || 'stable' }}-${{ matrix.no-check && 'nocheck' || 'tsc' }}
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [v1.4.0, nightly]
unstable: [false, true]
no-check: [false, true]
env:
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
steps:
- name: Setup Deno environment
uses: denolib/setup-deno@v1.3.0
uses: denolib/setup-deno@v2.2.0
with:
deno-version: v1.2.3
deno-version: ${{ matrix.deno-version }}

- uses: actions/checkout@v2

Expand All @@ -32,4 +38,4 @@ jobs:
aws --endpoint-url "http://localhost:9324" sqs create-queue --queue-name test --region us-east-1 --attributes VisibilityTimeout=0
- name: Test
run: deno test --allow-net --allow-env
run: deno test --allow-net --allow-env${{ matrix.unstable && ' --unstable' || '' }}${{ matrix.no-check && ' --no-check' || '' }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Amazon SQS for Deno
## Examples

```ts
import { SQSQueue } from "https://deno.land/x/sqs@0.3.2/mod.ts";
import { SQSQueue } from "https://deno.land/x/sqs@0.3.3/mod.ts";

// Create a queue using the queue url and credentials
const queue = new SQSQueue({
Expand Down
12 changes: 8 additions & 4 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export { AWSSignerV4 } from "https://raw.githubusercontent.com/lucacasonato/deno-aws-sign-v4/70a9846c3a856525ee4a3f864ce2f4a0465b95a2/src/mod.ts";
export type { RequestHeaders } from "https://raw.githubusercontent.com/lucacasonato/deno-aws-sign-v4/70a9846c3a856525ee4a3f864ce2f4a0465b95a2/src/types.ts";
export { sha256 } from "https://denopkg.com/chiefbiiko/sha256@v1.0.2/mod.ts";
export { default as parseXML } from "https://raw.githubusercontent.com/nekobato/deno-xml-parser/master/index.ts";
export { AWSSignerV4 } from "https://deno.land/x/aws_sign_v4@0.1.1/mod.ts";
import { createHash } from "https://deno.land/std@0.69.0/hash/mod.ts";
export function sha256Hex(data: string | Uint8Array): string {
const hasher = createHash("sha256");
hasher.update(data);
return hasher.toString("hex");
}
export { default as parseXML } from "https://raw.githubusercontent.com/nekobato/deno-xml-parser/0bc4c2bd2f5fad36d274279978ca57eec57c680c/index.ts";
export { decode as decodeXMLEntities } from "https://deno.land/x/html_entities@v1.0/lib/xml-entities.js";
2 changes: 1 addition & 1 deletion src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SQSError } from "./error.ts";

interface Document {
declaration: {
attributes: {};
attributes: Record<string, unknown>;
};
root: Xml | undefined;
}
Expand Down
25 changes: 10 additions & 15 deletions src/queue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AWSSignerV4, sha256 } from "../deps.ts";
import { AWSSignerV4, sha256Hex } from "../deps.ts";
import {
parseSendMessageResponse,
parseReceiveMessageBody,
Expand Down Expand Up @@ -36,7 +36,7 @@ export class SQSQueue {
this.#queueURL = config.queueURL;
}

private _doRequest(
private async _doRequest(
path: string,
params: Params,
method: string,
Expand All @@ -47,23 +47,18 @@ export class SQSQueue {
for (const key in params) {
url.searchParams.set(key, params[key]);
}
const signedHeaders = this.#signer.sign(
"sqs",
url.toString(),
method,
const request = new Request(url.toString(), {
headers,
body,
);
signedHeaders["x-amz-content-sha256"] = sha256(
body ?? "",
"utf8",
"hex",
) as string;
return fetch(url, {
method,
headers: signedHeaders,
body,
});

const signedRequest = await this.#signer.sign(
"sqs",
request,
);
signedRequest.headers.set("x-amz-content-sha256", sha256Hex(body ?? ""));
return fetch(signedRequest);
}

async sendMessage(
Expand Down
2 changes: 1 addition & 1 deletion test_deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {
assert,
assertEquals,
} from "https://deno.land/std@0.64.0/testing/asserts.ts";
} from "https://deno.land/std@0.69.0/testing/asserts.ts";

0 comments on commit cff24a7

Please sign in to comment.