diff --git a/examples/api-basic-auth-middleware/basic-auth.w b/examples/api-basic-auth-middleware/basic-auth.w index a5a0adb..44f0204 100644 --- a/examples/api-basic-auth-middleware/basic-auth.w +++ b/examples/api-basic-auth-middleware/basic-auth.w @@ -1,8 +1,8 @@ bring cloud; class Utils { - extern "./utils.js" static inflight base64decode(value: str): str; - extern "./utils.js" static inflight base64encode(value: str): str; + extern "./utils.js" pub static inflight base64decode(value: str): str; + extern "./utils.js" pub static inflight base64encode(value: str): str; init() { } } @@ -20,7 +20,7 @@ class BasicAuth { this.password = password ?? "admin"; } - inflight call(req: cloud.ApiRequest): bool { + pub inflight call(req: cloud.ApiRequest): bool { try { let authHeader = this.authHeader(req.headers); let credentials = this.authCredentials(authHeader); @@ -33,7 +33,7 @@ class BasicAuth { } } - private inflight authCredentials(header: str): Credentials { + inflight authCredentials(header: str): Credentials { let auth = Utils.base64decode(header.split(" ").at(1)); let splittedAuth = auth.split(":"); let username = splittedAuth.at(0); @@ -45,7 +45,7 @@ class BasicAuth { }; } // workaround for https://github.com/winglang/wing/issues/3205 - private inflight authHeader(headers: Map?): str { + inflight authHeader(headers: Map?): str { if (this.authHeaderPresent(headers)) { let authHeaderOptional = headers?.get("authorization"); let var authHeader = headers?.get("Authorization"); @@ -64,7 +64,7 @@ class BasicAuth { } // workaround for https://github.com/winglang/wing/issues/3205 - private inflight authHeaderPresent(headers: Map?): bool { + inflight authHeaderPresent(headers: Map?): bool { if (headers?.has("authorization") == false) && (headers?.has("Authorization") == false) { return false; } diff --git a/examples/api-basic-auth/main.w b/examples/api-basic-auth/main.w index 3c63912..a7baeea 100644 --- a/examples/api-basic-auth/main.w +++ b/examples/api-basic-auth/main.w @@ -3,8 +3,8 @@ bring util; bring http; class Utils { - extern "./utils.js" static inflight base64decode(value: str): str; - extern "./utils.js" static inflight base64encode(value: str): str; + extern "./utils.js" pub static inflight base64decode(value: str): str; + extern "./utils.js" pub static inflight base64encode(value: str): str; init() { } } @@ -22,7 +22,7 @@ class BasicAuth { this.password = password ?? "admin"; } - inflight call(req: cloud.ApiRequest): bool { + pub inflight call(req: cloud.ApiRequest): bool { try { let authHeader = this.authHeader(req.headers); let credentials = this.authCredentials(authHeader); @@ -35,7 +35,7 @@ class BasicAuth { } } - private inflight authCredentials(header: str): Credentials { + inflight authCredentials(header: str): Credentials { let auth = Utils.base64decode(header.split(" ").at(1)); let splittedAuth = auth.split(":"); let username = splittedAuth.at(0); @@ -47,7 +47,7 @@ class BasicAuth { }; } // workaround for https://github.com/winglang/wing/issues/3205 - private inflight authHeader(headers: Map?): str { + inflight authHeader(headers: Map?): str { if (this.authHeaderPresent(headers)) { let authHeaderOptional = headers?.get("authorization"); let var authHeader = headers?.get("Authorization"); @@ -66,7 +66,7 @@ class BasicAuth { } // workaround for https://github.com/winglang/wing/issues/3205 - private inflight authHeaderPresent(headers: Map?): bool { + inflight authHeaderPresent(headers: Map?): bool { if (headers?.has("authorization") == false) && (headers?.has("Authorization") == false) { return false; } diff --git a/examples/api-counter-ssr/main.w b/examples/api-counter-ssr/main.w index 38cf9c2..e38ea7a 100644 --- a/examples/api-counter-ssr/main.w +++ b/examples/api-counter-ssr/main.w @@ -3,10 +3,10 @@ bring util; bring http; class Utils { - extern "./utils.js" static inflight render(template: str, value: num): str; + extern "./utils.js" pub static inflight render(template: str, value: num): str; // This is a workaround for the pending fs module // https://github.com/winglang/wing/issues/3096 - extern "./utils.js" static readFile(filePath: str): str; + extern "./utils.js" pub static readFile(filePath: str): str; init() { } } diff --git a/examples/api-counter-ssr/package-lock.json b/examples/api-counter-ssr/package-lock.json index ff6e8a6..87d9d20 100644 --- a/examples/api-counter-ssr/package-lock.json +++ b/examples/api-counter-ssr/package-lock.json @@ -1,5 +1,5 @@ { - "name": "api-counter-ssr-pug-htmx", + "name": "api-counter-ssr", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/examples/stock-poller/main.w b/examples/stock-poller/main.w index 705c7aa..54314e5 100644 --- a/examples/stock-poller/main.w +++ b/examples/stock-poller/main.w @@ -12,7 +12,7 @@ class TwelveDataApi { ); } - inflight stockUpdates(tickerSymbol: str): http.Response { + pub inflight stockUpdates(tickerSymbol: str): http.Response { return http.get("https://api.twelvedata.com/time_series?symbol=${tickerSymbol}&interval=1min&outputsize=1&apikey=${this.key.value()}"); } }