Skip to content

Commit 5ccb3a3

Browse files
committed
fix: runs in strict mode aka deno v0.34.0
1 parent 3ca4800 commit 5ccb3a3

21 files changed

+503
-973
lines changed

.github/workflows/cloud_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
TABLE_NAME: testing_table
1818
steps:
1919
- name: clone repo
20-
uses: actions/checkout@v1.0.0
20+
uses: actions/checkout@v2.0.0
2121
- name: install deno
22-
uses: denolib/setup-deno@v1.1.0
22+
uses: denolib/setup-deno@v1.2.0
2323
- name: configure aws credentials
2424
uses: aws-actions/configure-aws-credentials@v1
2525
with:

.github/workflows/local_ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: clone repo
13-
uses: actions/checkout@v1.0.0
13+
uses: actions/checkout@v2.0.0
1414
- name: install deno
15-
uses: denolib/setup-deno@v1.1.0
15+
uses: denolib/setup-deno@v1.2.0
1616
- name: run tests
1717
run: deno run --allow-env ./test/signv4.ts
1818
test_local:
1919
name: test dynamodb local
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: clone repo
23-
uses: actions/checkout@v1.0.0
23+
uses: actions/checkout@v2.0.0
2424
- name: install deno
25-
uses: denolib/setup-deno@v1.1.0
25+
uses: denolib/setup-deno@v1.2.0
2626
- name: start a local dynamodb
2727
run: curl -fsSL https://denopkg.com/chiefbiiko/[email protected]/start_db.sh | bash
2828
- name: sleep 2 allow db startup

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
dynamodb_local_latest.zip
2-
dynamodb_local_latest
1+
dynamodb_local_latest*
2+
shared-local-instance.db*

api/api.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import {
77
property /*, string as stringUtil*/
88
} from "../util.ts";
99

10+
// NOTE: 2 run in ts strict-mode (bypassing TS7009)
11+
const _Collection: any = Collection
12+
const _Operation: any = Operation
13+
1014
// var Paginator = require('./paginator');
1115
// var ResourceWaiter = require('./resource_waiter');
1216

13-
export function Api(api: Doc = {}, options: Doc = {}) {
17+
export function Api(this: any, api: Doc = {}, options: Doc = {}) {
1418
const self: any = this;
1519
// api = api || {};
1620
// options = options || {};
@@ -38,7 +42,7 @@ export function Api(api: Doc = {}, options: Doc = {}) {
3842
api.metadata.serviceAbbreviation || api.metadata.serviceFullName;
3943

4044
if (!name) {
41-
return null;
45+
return "";
4246
}
4347

4448
name = name.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g, "");
@@ -59,11 +63,11 @@ export function Api(api: Doc = {}, options: Doc = {}) {
5963
property(
6064
this,
6165
"operations",
62-
new Collection(
66+
new _Collection(
6367
api.operations,
6468
options,
6569
function(name: string, operation: Doc): any {
66-
return new Operation(name, operation, options);
70+
return new _Operation(name, operation, options);
6771
} /*, stringUtil.lowerFirst*/,
6872
addEndpointOperation
6973
)
@@ -72,7 +76,7 @@ export function Api(api: Doc = {}, options: Doc = {}) {
7276
property(
7377
this,
7478
"shapes",
75-
new Collection(api.shapes, options, function(
79+
new _Collection(api.shapes, options, function(
7680
name: string,
7781
shape: Doc
7882
): any {

api/collection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Doc, memoizedProperty, noop } from "../util.ts";
44

55
function memoize(
6+
this: any,
67
name: string,
78
value: any,
89
factory: (
@@ -16,6 +17,7 @@ function memoize(
1617
}
1718

1819
export function Collection(
20+
this: any,
1921
iterable: any,
2022
options: Doc,
2123
factory: (

api/mod.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Doc } from "../util.ts";
21
import { Api } from "./api.ts";
32

4-
const spec: Doc = JSON.parse(`
3+
const _Api: any = Api;
4+
5+
export const API: any = new _Api(JSON.parse(`
56
{
67
"version": "2.0",
78
"metadata": {
@@ -2228,6 +2229,4 @@ const spec: Doc = JSON.parse(`
22282229
}
22292230
}
22302231
}
2231-
`);
2232-
2233-
export const API: any = new Api(spec);
2232+
`));

api/operation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Shape } from "./shape.ts";
66
import { Doc, memoizedProperty, property } from "../util.ts";
77
// import { Doc} from "../types.ts"
88

9-
export function Operation(name: string, operation: Doc, options: Doc = {}) {
9+
export function Operation(this: any, name: string, operation: Doc, options: Doc = {}) {
1010
const self: any = this;
1111
// options = options || {};
1212

@@ -47,7 +47,7 @@ export function Operation(name: string, operation: Doc, options: Doc = {}) {
4747

4848
memoizedProperty(this, "errors", function(): any[] {
4949
if (!operation.errors) {
50-
return null;
50+
return [];
5151
}
5252

5353
return operation.errors.map((error: any): any =>
@@ -83,8 +83,8 @@ export function Operation(name: string, operation: Doc, options: Doc = {}) {
8383
}
8484

8585
return Object.entries(self.input.members)
86-
.filter(([_, value]: [string, Doc]): boolean => value.isIdempotent)
87-
.map(([key, _]: [string, Doc]): string => key);
86+
.filter(([_, value]: [string, any]): boolean => value.isIdempotent)
87+
.map(([key, _]: [string, any]): string => key);
8888

8989
// for (const name in members) {
9090
// if (!members.hasOwnProperty(name)) {

0 commit comments

Comments
 (0)