Skip to content

Commit

Permalink
fix: update libraries with Wing 0.79.0 compatibility (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Jul 17, 2024
1 parent b67e215 commit 4dc0f7b
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 113 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/canary.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .mkrepo/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ new prlint.PullRequestLintWorkflow(workflowdir, libs.copy());
new gitattributes.GitAttributes();

let skipCanaryTests = [
"containers" // https://github.com/winglang/wing/issues/5716
"containers", // https://github.com/winglang/wing/issues/5716
"cognito", // https://github.com/winglang/wing/issues/6924
"python", // https://github.com/winglang/wing/issues/6923
];

new canary.CanaryWorkflow(workflowdir, libs.copy(), skipCanaryTests);
6 changes: 3 additions & 3 deletions checks/check.w
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub class Check impl ICheck {
this.checkpath = nodeof(this).path;
this.results = r.Results.of(this);

let wrapper = inflight (): str => {
let wrapper = inflight (): Json => {
log("running check {this.checkpath} ({this.checkid})...");
let ts = datetime.utcNow().toIso();

Expand All @@ -65,7 +65,7 @@ pub class Check impl ICheck {

this.results.store(result);

return Json.stringify(result);
return result;
};

if props?.deploy ?? true {
Expand All @@ -92,7 +92,7 @@ pub class Check impl ICheck {
*/
pub inflight run(): r.CheckResult {
let result = this.invoker.invoke("")!;
return r.CheckResult.fromJson(Json.parse(result));
return r.CheckResult.fromJson(result);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions checks/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion checks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/checks",
"version": "0.0.13",
"version": "0.0.14",
"description": "Cloud checks",
"publishConfig": {
"access": "public",
Expand Down
3 changes: 1 addition & 2 deletions fifoqueue/fifo-queue.aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub class FifoQueue_aws impl api.IFifoQueue {

pub setConsumer(handler: inflight (str) : void, options: api.SetConsumerOptions?) {
let lambdaFn = new cloud.Function(inflight (event) => {
let json: Json = unsafeCast(event);
let sqsEvent = SqsEvent.fromJson(event);
let sqsEvent = SqsEvent.fromJson(event!);
for message in sqsEvent.Records {
handler(message.body);
}
Expand Down
4 changes: 2 additions & 2 deletions fifoqueue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fifoqueue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/fifoqueue",
"version": "0.0.7",
"version": "0.0.8",
"description": "A wing library to work with FIFO (first-in first-out) Queues",
"author": {
"name": "Elad Cohen",
Expand Down
1 change: 0 additions & 1 deletion github/lib.w
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
bring cloud;
bring http;
bring ex;
bring util;
bring "./probot/types.w" as probot;
bring "./octokit/types.w" as octokit;
Expand Down
4 changes: 2 additions & 2 deletions github/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.11",
"version": "0.0.12",
"author": {
"name": "Elad Cohen",
"email": "[email protected]"
Expand Down
17 changes: 5 additions & 12 deletions messagefanout/lib.test.w
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
bring cloud;
bring util;
bring ex;
bring "./lib.w" as msgfanout;

let fanout = new msgfanout.MessageFanout();

let table = new ex.Table(
name: "users",
primaryKey: "msgId",
columns: {
"message" => ex.ColumnType.STRING
}
);
let data = new cloud.Bucket();

fanout.addConsumer(inflight (msg: str) => {
table.insert("first", { message: "first {msg}" });
data.putJson("first", { message: "first {msg}" });
}, name: "first");

fanout.addConsumer(inflight (msg: str) => {
table.insert("second", { message: "second {msg}" });
data.putJson("second", { message: "second {msg}" });
}, name: "second");

test "message fanout" {
fanout.publish("hello 👋");

util.sleep(10s);

assert(table.get("first")["message"] == "first hello 👋");
assert(table.get("second")["message"] == "second hello 👋");
assert(data.getJson("first")["message"] == "first hello 👋");
assert(data.getJson("second")["message"] == "second hello 👋");
}
4 changes: 2 additions & 2 deletions messagefanout/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion messagefanout/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@winglibs/messagefanout",
"description": "Message fanout library for Wing",
"version": "0.0.4",
"version": "0.0.5",
"repository": {
"type": "git",
"url": "https://github.com/winglang/winglibs.git",
Expand Down
5 changes: 2 additions & 3 deletions messagefanout/platform/tf-aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ pub class MessageFanout_tfaws impl api.IMessageFanout {
}

pub addConsumer(handler: inflight(str): void, props: api.MessageFanoutProps): void {
let my_function = new cloud.Function(inflight(event: str?): str? => {
let json: Json = unsafeCast(event);
let sqsEvent = SqsEvent.fromJson(event);
let my_function = new cloud.Function(inflight(event) => {
let sqsEvent = SqsEvent.fromJson(event!);
for message in sqsEvent.Records {
handler(message.body);
}
Expand Down
4 changes: 2 additions & 2 deletions sagemaker/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sagemaker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/sagemaker",
"version": "0.0.5",
"version": "0.0.6",
"description": "The library enables owners of a trained sagemaker model, to access its Endpoints from a winglang inflight code.",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions sagemaker/sagemaker.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ bring util;

let sm = new sageMaker.Endpoint(util.tryEnv("ENDPOINT_NAME") ?? "Example-endopint", util.tryEnv("INFERENCE_NAME") ?? "Example-inference");

let invokeModel = inflight (input: str?) => {
let var s = input ?? "Hi There!";
let invokeModel = inflight (input: Json?) => {
let var s = input?.tryAsStr() ?? "Hi There!";
let res = sm.invoke( { inputs: "{s}" }, { ContentType: "application/json" });
log(res.Body);
};
Expand Down
10 changes: 6 additions & 4 deletions tsoa/lib.extern.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tsoa/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tsoa/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@winglibs/tsoa",
"description": "TSOA library for Wing",
"version": "0.1.10",
"version": "0.1.11",
"author": {
"email": "[email protected]",
"name": "Eyal Keren"
Expand Down
2 changes: 1 addition & 1 deletion tsoa/tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub class Service_tfaws impl types.IService {
);

this.func = new TSOAFunction({ RegisterRoutes: res.routesFile }, inflight (event, context) => {
return Service_tfaws.runHandler(event, context, this.clients);
return Service_tfaws.runHandler(event!, context!, this.clients);
});

let awsFn = aws.Function.from(this.func.fn)!;
Expand Down

0 comments on commit 4dc0f7b

Please sign in to comment.