Skip to content

Commit

Permalink
chore: remove old syntax from winglibs (part 1) (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Jul 1, 2024
1 parent 037162e commit 53109e3
Show file tree
Hide file tree
Showing 32 changed files with 110 additions and 257 deletions.
4 changes: 2 additions & 2 deletions checks/check.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test "latest() returns the last check status" {
let result = check.run();
let latest = check.latest();
log(Json.stringify(latest));
expect.equal(latest?, true);
expect.equal(latest != nil, true);
expect.equal(result, latest);
}

Expand All @@ -61,4 +61,4 @@ test "run() with failure" {
let check_id = nodeof(check).id;
test "check name is set" {
expect.equal("check {check_id}", "check {checkName}");
}
}
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.12",
"version": "0.0.13",
"description": "Cloud checks",
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions checks/results.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test "store/load test" {
let response = c2.results.latest(checkid);
log(Json.stringify(response));

assert(response?);
assert(response != nil);
assert(response?.ok == true);
assert(response?.timestamp == ts);
}
}
4 changes: 2 additions & 2 deletions cognito/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 cognito/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/cognito",
"version": "0.0.11",
"version": "0.0.12",
"description": "A wing library to work with AWS Cognito",
"author": {
"name": "Elad Cohen",
Expand Down
6 changes: 3 additions & 3 deletions cognito/platform/sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub class Cognito_sim impl types.ICognito {
};
}

if !authHeader? {
if authHeader == nil {
return {
status: () => {
if authType == types.AuthenticationType.COGNITO_USER_POOLS {
Expand Down Expand Up @@ -180,7 +180,7 @@ pub class Cognito_sim impl types.ICognito {

pub inflight adminConfirmUser(email: str): void {
let row = this.table.tryGet(email);
if !row? {
if row == nil {
throw "User not found";
}

Expand All @@ -193,7 +193,7 @@ pub class Cognito_sim impl types.ICognito {

pub inflight initiateAuth(email: str, password: str): str {
let row = this.table.tryGet(email);
if !row? {
if row == nil {
throw "User not found";
}

Expand Down
6 changes: 3 additions & 3 deletions cognito/platform/tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub class Cognito_tfaws impl types.ICognito {

let apiSpec: MutJson = unsafeCast(this.api)?.apiSpec;
let var cognitoDefinition = MutJson{};
if !props? || !props?.authenticationType? || props?.authenticationType == types.AuthenticationType.COGNITO_USER_POOLS {
if props == nil || props?.authenticationType == nil || props?.authenticationType == types.AuthenticationType.COGNITO_USER_POOLS {
cognitoDefinition = {
type: "apiKey",
name: props?.headerKey ?? "Authorization",
Expand Down Expand Up @@ -169,11 +169,11 @@ pub class Cognito_tfaws impl types.ICognito {
addSecurity(path: str, method: str) {
let apiSpec: MutJson = unsafeCast(this.api)?.apiSpec;
let paths = apiSpec.get("paths");
if !paths.tryGet(path)? {
if paths.tryGet(path) == nil {
throw "Path {path} not found. `cloud.Api.{method}({path}) must be called before.`";
}
let methods = paths.get(path);
if !methods.tryGet(method)? {
if methods.tryGet(method) == nil {
throw "Method {method} not found. `cloud.Api.{method}({path}) must be called before.`";
}
let spec = methods.get(method);
Expand Down
2 changes: 1 addition & 1 deletion containers/containers-with-readiness.test.w.tf-aws.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"metadata": {
"backend": "local",
"stackName": "root",
"version": "0.20.3"
"version": "0.20.7"
},
"outputs": {
"root": {
Expand Down
2 changes: 1 addition & 1 deletion containers/containers.test.w.tf-aws.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"metadata": {
"backend": "local",
"stackName": "root",
"version": "0.20.3"
"version": "0.20.7"
},
"outputs": {
"root": {
Expand Down
139 changes: 0 additions & 139 deletions containers/helm.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 containers/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 containers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/containers",
"version": "0.1.2",
"version": "0.1.3",
"description": "Container support for Wing",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion containers/tfaws-ecr.w
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub class Repository {
// null provider singleton
let root = nodeof(this).root;
let nullProviderId = "NullProvider";
if !nodeof(root).tryFindChild(nullProviderId)? {
if nodeof(root).tryFindChild(nullProviderId) == nil {
new null_provider.provider.NullProvider() as nullProviderId in root;
}

Expand Down
4 changes: 2 additions & 2 deletions containers/tfaws-eks.w
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub class ClusterBase impl ICluster {
let singletonKey = "WingKubernetesProvider";
let attributes = this.attributes();
let existing = nodeof(root).tryFindChild(singletonKey);
if existing? {
if existing != nil {
return unsafeCast(existing);
}

Expand All @@ -50,7 +50,7 @@ pub class ClusterBase impl ICluster {
let singletonKey = "WingHelmProvider";
let attributes = this.attributes();
let existing = nodeof(root).tryFindChild(singletonKey);
if existing? {
if existing != nil {
return unsafeCast(existing);
}

Expand Down
2 changes: 1 addition & 1 deletion dynamodb/dynamodb.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub class Table_sim impl dynamodb_types.ITable {
}

let provisionedThroughput: Json? = (() => {
if gsi.readCapacity? || gsi.writeCapacity? {
if gsi.readCapacity != nil || gsi.writeCapacity != nil {
return {
ReadCapacityUnits: gsi.readCapacity,
WriteCapacityUnits: gsi.writeCapacity,
Expand Down
2 changes: 1 addition & 1 deletion dynamodb/dynamodb.tf-aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Util {
): Json;

pub inflight static safeUnmarshall(item: Json?, options: Json?): Json? {
if item? {
if item != nil {
return Util.unmarshall(item, options);
}
return nil;
Expand Down
4 changes: 2 additions & 2 deletions dynamodb/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 dynamodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/dynamodb",
"version": "0.1.14",
"version": "0.1.15",
"description": "DynamoDB library for Wing",
"author": {
"name": "Cristian Pallarés",
Expand Down
2 changes: 1 addition & 1 deletion ngrok/ngrok.w
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub class Tunnel {
this.onConnectHandlers = MutArray<inflight (str): void>[];

if !nodeof(this).app.isTestEnvironment {
if !util.tryEnv("NGROK_AUTHTOKEN")? {
if util.tryEnv("NGROK_AUTHTOKEN") == nil {
throw "NGROK_AUTHTOKEN is not defined";
}

Expand Down
Loading

0 comments on commit 53109e3

Please sign in to comment.