Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #52 from hayd/0.34.0
Browse files Browse the repository at this point in the history
Bump to 0.34.0
  • Loading branch information
hayd authored Feb 22, 2020
2 parents 9b549ea + 7a4392f commit 02a839b
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 35 deletions.
2 changes: 1 addition & 1 deletion example-sam/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Resources:
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno
SemanticVersion: 0.33.0
SemanticVersion: 0.34.0

HelloWorldFunction:
Type: AWS::Serverless::Function
Expand Down
2 changes: 1 addition & 1 deletion example-serverless/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export {
DynamoDBClient
} from "https://deno.land/x/dynamodb@v0.2.0/mod.ts";

import { v4 } from "https://deno.land/std@v0.33.0/uuid/mod.ts";
import { v4 } from "https://deno.land/std@v0.34.0/uuid/mod.ts";
export const uuid = v4.generate;
2 changes: 1 addition & 1 deletion example-serverless/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resources:
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno
SemanticVersion: 0.33.0
SemanticVersion: 0.34.0

candidatesTable:
Type: AWS::DynamoDB::Table
Expand Down
2 changes: 1 addition & 1 deletion example-serverless/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import {
assert,
assertEquals
} from "https://deno.land/std@v0.33.0/testing/asserts.ts";
} from "https://deno.land/std@v0.34.0/testing/asserts.ts";
import {
APIGatewayProxyEvent,
Context
Expand Down
2 changes: 1 addition & 1 deletion tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Note: This must be built in the .. context

FROM hayd/deno:amazonlinux1-0.33.0
FROM hayd/deno:amazonlinux1-0.34.0
# This is the runtime used by AWS Lambda
# plus a compatible deno executable /bin/deno.
# https://github.com/hayd/deno_docker
Expand Down
9 changes: 7 additions & 2 deletions tests/decorate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
function decorate(target) {}
import {
APIGatewayProxyEvent,
Context
} from "https://deno.land/x/lambda/mod.ts";

function decorate(target: any) {}

@decorate
class Foo {
}

export async function handler(event, context) {
export async function handler(event: APIGatewayProxyEvent, context: Context) {
return {
statusCode: 200,
body: `decorated 🦕`
Expand Down
15 changes: 8 additions & 7 deletions tests/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "https://deno.land/x/lambda/mod.ts";

class MyError extends Error {
constructor(message) {
constructor(message: string) {
super(message);
this.name = "MyError";
}
Expand All @@ -14,7 +14,7 @@ export async function error(event: APIGatewayProxyEvent, context: Context) {
throw new MyError("error thrown");
}

export async function foo(event, context) {
export async function foo(event: any, context: Context) {
// is there a foo attribute?! who knows!
return event.foo || "a string";
}
Expand All @@ -33,13 +33,13 @@ export async function withContext(

// Note: This is evaluated prior to the redefinition of console.log in bootstrap.
// This is a devious trick to catch the output of console.log and friends.
let LOGGED = [];
let LOGGED: any[] = [];
const _log = console.log;
console.log = (...args) => {
LOGGED.push(args);
_log(args);
};
export async function log(event, context) {
export async function log(event: any, context: Context) {
LOGGED = [];
// pretty print with newlines
const message = JSON.stringify({ message: event.hello }, null, 2);
Expand All @@ -56,10 +56,11 @@ export async function log(event, context) {
};
}

export async function badPrefix(event, context) {
export async function badPrefix(event: any, context: Context) {
// assert warning message on init:
console.log(event.hello);
const log = LOGGED.map(args => {
// @ts-ignore
return Deno[Deno.symbols.internal].stringifyArgs(args);
});
LOGGED = [];
Expand All @@ -70,7 +71,7 @@ export async function noArgs() {
return {};
}

export async function runDeno(event, context) {
export async function runDeno(event: APIGatewayProxyEvent, context: Context) {
const r = Deno.run({ args: ["deno", "--version"], stdout: "piped" });
const out = await r.output();
const version = new TextDecoder().decode(out).split("\n")[0];
Expand All @@ -81,6 +82,6 @@ export async function wrongArgs(a: number, b: number, c: number) {
return { result: a * b * c };
}

export async function xray(event, context) {
export async function xray(event: APIGatewayProxyEvent, context: Context) {
return { _X_AMZN_TRACE_ID: Deno.env("_X_AMZN_TRACE_ID") };
}
6 changes: 5 additions & 1 deletion tests/importmap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import {
APIGatewayProxyEvent,
Context
} from "https://deno.land/x/lambda/mod.ts";
import { pad } from "std/strings/pad.ts";

export function handler(event, context) {
export function handler(event: any, context: Context) {
const strLen: number = Number(event.strLen) || 5;
return pad("deno", strLen);
}
4 changes: 2 additions & 2 deletions tests/pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// i.e. we must download precisely one file from deno.land.
import { pad } from "https://deno.land/std/strings/pad.ts";

export function handler(event, context) {
export function handler(event: any, context: any) {
const strLen: number = Number(event.strLen) || 5;
return pad("deno", strLen);
}

export async function assertLock(event, context) {
export async function assertLock(event: any, context: any) {
// assert --lock was passed
// Note: This is a file with external imports in order for -lock to be used.
// FIXME remove this env hack and pull out the actual cli args from Deno itself.
Expand Down
10 changes: 4 additions & 6 deletions tests/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface TestJson {
files: string | string[];
expected?: string;
env: Record<string, string>;
headers?: any;
headers?: Record<string, Record<string, string | Record<string, string>>>;
events: string[];
}

Expand Down Expand Up @@ -79,11 +79,9 @@ export async function serveEvents(testJson: TestJson) {
});
if (testJson.headers) {
for (let [k, v] of Object.entries(testJson.headers)) {
if (Object.prototype.toString.call(v) !== "[object String]") {
v = JSON.stringify(v);
}
assert(typeof v === "string");
headers.append(k, v.toString());
const vv = typeof v === "string" ? v : JSON.stringify(v);
assert(typeof vv === "string");
headers.append(k, vv);
}
}
await req.respond({
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"expected": [
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
},
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
}
],
"files": ["hello.bundle.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_example_zip.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"expected": [
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
},
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
}
],
"files": "deno-lambda-example.zip",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_js.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"expected": [
{
"status": "ok",
"content": "{\"statusCode\":200,\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"body\":\"Welcome to deno 0.34.0 🦕\"}"
},
{
"status": "ok",
"content": "{\"statusCode\":200,\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"body\":\"Welcome to deno 0.34.0 🦕\"}"
}
],
"files": ["hello.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_run_deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"expected": [
{
"status": "ok",
"content": "{\"out\":\"deno 0.33.0\"}"
"content": "{\"out\":\"deno 0.34.0\"}"
},
{
"status": "ok",
"content": "{\"out\":\"deno 0.33.0\"}"
"content": "{\"out\":\"deno 0.34.0\"}"
}
],
"files": ["handlers.ts"],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_self_contained.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"expected": [
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
},
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
}
],
"files": ["hello.ts", "bootstrap", "bin/deno"]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"expected": [
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
},
{
"status": "ok",
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.33.0 🦕\"}"
"content": "{\"statusCode\":200,\"headers\":{\"content-type\":\"text/html;charset=utf8\"},\"body\":\"Welcome to deno 0.34.0 🦕\"}"
}
],
"files": ["hello.ts"],
Expand Down

0 comments on commit 02a839b

Please sign in to comment.