Skip to content

Commit

Permalink
fix: updates for wing 0.61.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanaburayyan committed Mar 12, 2024
1 parent 0518876 commit 3975a1a
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion containers/local-build.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ let app = new containers.Workload(
);

test "can access container" {
let response = http.get("{app.publicUrl}");
let response = http.get("{app.publicUrl!}");
assert(response.body == "Hello, Wingnuts!");
}
2 changes: 1 addition & 1 deletion containers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/containers",
"version": "0.0.21",
"version": "0.0.22",
"description": "Container support for Wing",
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions containers/workload.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub class Workload_sim {
this.containerIdKey = "container_id";

let hash = utils.resolveContentHash(this, props);
if hash? {
if let hash = hash {
this.imageTag = "{props.name}:{hash}";
} else {
this.imageTag = props.image;
Expand Down Expand Up @@ -98,7 +98,7 @@ pub class Workload_sim {
if env.size() > 0 {
dockerRun.push("-e");
for k in env.keys() {
dockerRun.push("{k}={env.get(k)}");
dockerRun.push("{k}={env.get(k)!}");
}
}
}
Expand Down Expand Up @@ -126,14 +126,14 @@ pub class Workload_sim {
throw "Container does not listen to port {port}";
}

let publicUrl = "http://localhost:{hostPort}";
let publicUrl = "http://localhost:{hostPort!}";

if let k = this.publicUrlKey {
this.state.set(k, publicUrl);
}

if let k = this.internalUrlKey {
this.state.set(k, "http://host.docker.internal:{hostPort}");
this.state.set(k, "http://host.docker.internal:{hostPort!}");
}

if let readiness = opts.readiness {
Expand Down
2 changes: 1 addition & 1 deletion containers/workload.tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub class Workload_tfaws {
);

if let port = props.port {
this.internalUrl = "http://{props.name}:{props.port}";
this.internalUrl = "http://{props.name}:{port}";
}

// if "public" is set, lookup the address from the ingress resource created by the helm chart
Expand Down
34 changes: 18 additions & 16 deletions fifoqueue/fifo-queue.aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,24 @@ pub class FifoQueue_aws impl api.IFifoQueue {
}, env: options?.env, logRetentionDays: options?.logRetentionDays, memory: options?.memory, timeout: options?.timeout);

let lambda = awsUtil.Function.from(lambdaFn);
lambda?.addPolicyStatements({
actions: [
"sqs:ReceiveMessage",
"sqs:ChangeMessageVisibility",
"sqs:GetQueueUrl",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
],
resources: [this.arn],
});

new aws.lambdaEventSourceMapping.LambdaEventSourceMapping(
functionName: "{lambda?.functionName}",
eventSourceArn: this.arn,
batchSize: options?.batchSize ?? 1
);
if let lambda = lambda {
lambda?.addPolicyStatements({
actions: [
"sqs:ReceiveMessage",
"sqs:ChangeMessageVisibility",
"sqs:GetQueueUrl",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
],
resources: [this.arn],
});

new aws.lambdaEventSourceMapping.LambdaEventSourceMapping(
functionName: lambda.functionName,
eventSourceArn: this.arn,
batchSize: options?.batchSize ?? 1
);
}
}

pub onLift(host: std.IInflightHost, ops: Array<str>) {
Expand Down
2 changes: 1 addition & 1 deletion github/lib.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let handler = inflight (ctx) => {
ref: ctx.payload.pull_request.head.sha
);

let fileContents = util.base64Decode("{contents.data.content}");
let fileContents = util.base64Decode(contents.data.content ?? "");

ctx.octokit.repos.createOrUpdateFileContents(
owner: repo.owner.login,
Expand Down
2 changes: 1 addition & 1 deletion github/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@winglibs/github",
"description": "A Wing library for GitHub Probot",
"version": "0.0.5",
"version": "0.0.6",
"author": {
"name": "Elad Cohen",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion websockets/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@winglibs/websockets",
"description": "WebSocket library for Wing",
"version": "0.3.1",
"version": "0.3.2",
"repository": {
"type": "git",
"url": "https://github.com/winglang/winglibs.git",
Expand Down
2 changes: 1 addition & 1 deletion websockets/platform/awscdk.w
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub class WebSocket_awscdk impl awsapi.IAwsWebSocket {
) as "url";

new awscdk.CfnOutput(
value: "https://{this.api.attrApiId}.execute-api.{this.region}.{urlSuffix}/{stageName}",
value: "https://{this.api.attrApiId}.execute-api.{this.region!}.{urlSuffix}/{stageName}",
exportName: "callbackUrl"
) as "callbackUrl";
}
Expand Down

0 comments on commit 3975a1a

Please sign in to comment.