Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updates for wing 0.61.0 #119

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading