Skip to content

Commit 29003a5

Browse files
authored
chore: use indexing syntax (#204)
Cosmetic refactorings to our winglibs to use the new indexing syntax where applicable. This is mostly done as an effort to test some usage of the syntax in the real world to catch if there are any bugs. One bug was found and since fixed [here](winglang/wing#6277).
1 parent e6a3d9d commit 29003a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+101
-101
lines changed

bedrock/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub class JokeMaker {
3838
anthropic_version: "bedrock-2023-05-31"
3939
});
4040

41-
return res.get("completion").asStr();
41+
return res["completion"].asStr();
4242
}
4343
}
4444
```

bedrock/joke.w

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ pub class JokeMaker {
2020
anthropic_version: "bedrock-2023-05-31"
2121
});
2222

23-
return res.get("completion").asStr();
23+
return res["completion"].asStr();
2424
}
25-
}
25+
}

bedrock/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bedrock/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@winglibs/bedrock",
33
"description": "A Wing library for Amazon Bedrock",
4-
"version": "0.0.5",
4+
"version": "0.0.6",
55
"author": {
66
"name": "Eyal Keren",
77
"email": "[email protected]"

cognito/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cognito/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@winglibs/cognito",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "A wing library to work with AWS Cognito",
55
"author": {
66
"name": "Elad Cohen",

cognito/platform/sim.w

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ pub class Cognito_sim impl types.ICognito {
108108
for entry in api.handlers.entries() {
109109
let handler = entry.value;
110110
let func: cloud.Function = handler.func;
111-
let route = handler.mapping.eventProps.subscriptionProps.routes.at(0);
111+
let route = handler.mapping.eventProps.subscriptionProps.routes[0];
112112
if route.pathPattern == path && route.method == method.uppercase() {
113-
let pathJson = MutJson api.apiSpec.get("paths").get(path);
113+
let pathJson = MutJson api.apiSpec["paths"][path];
114114
pathJson.set(method, unsafeCast(nil));
115115

116116
let api2: Json = unsafeCast(this.api);
@@ -154,7 +154,7 @@ pub class Cognito_sim impl types.ICognito {
154154

155155
this.table.update(email, {
156156
"email": email,
157-
"password": row!.get("password").asStr(),
157+
"password": row!["password"].asStr(),
158158
"confirmed": true,
159159
});
160160
}
@@ -165,11 +165,11 @@ pub class Cognito_sim impl types.ICognito {
165165
throw "User not found";
166166
}
167167

168-
if row!.get("email").asStr() != email || row!.get("password").asStr() != password {
168+
if row!["email"].asStr() != email || row!["password"].asStr() != password {
169169
throw "Invalid credentials";
170170
}
171171

172-
if !row!.get("confirmed").asBool() {
172+
if !row!["confirmed"].asBool() {
173173
throw "User not confirmed";
174174
}
175175

containers/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

containers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@winglibs/containers",
3-
"version": "0.0.27",
3+
"version": "0.0.28",
44
"description": "Container support for Wing",
55
"repository": {
66
"type": "git",

containers/tfaws-vpc.w

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ pub class Vpc {
4242
this.privateSubnets = vpc.get("private_subnets");
4343
this.publicSubnets = vpc.get("public_subnets");
4444
}
45-
}
45+
}

0 commit comments

Comments
 (0)