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

Update library dependency versions for RC2 #5586

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ public void openapiAnnotationExistsTest() {
.resolve("2.1.0")
.resolve("java17");

Path balaPath = TEST_DISTRIBUTION_PATH
.resolve(DIST_NAME)
.resolve("repo")
.resolve("bala")
.resolve("ballerina")
.resolve("openapi")
.resolve("2.1.0")
.resolve("java17")
.resolve("platform")
.resolve("java17");

Path breLibPath = TEST_DISTRIBUTION_PATH
.resolve(DIST_NAME)
.resolve("bre")
Expand All @@ -94,7 +83,6 @@ public void openapiAnnotationExistsTest() {
.resolve("lib");

Assert.assertTrue(Files.exists(birPath));
Assert.assertTrue(Files.exists(balaPath));
Assert.assertTrue(Files.exists(jarPath.resolve("ballerina-openapi-2.1.0.jar")));
Assert.assertNotNull(TestUtils.findFileOrDirectory(breLibPath, "openapi-cli-"));
Assert.assertNotNull(TestUtils.findFileOrDirectory(breLibPath, "openapi-validator-"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

The `graphql:Client` can connect to a service that is secured with self-signed JWT by adding the `Authorization: Bearer <token>` header by passing the `graphql:JwtIssuerConfig` to the `auth` configuration of the client. A self-signed JWT is issued before the request is sent.

::: code graphql_client_security_self_signed_jwt_authentication.bal :::
::: code graphql_client_security_jwt_authentication.bal :::

## Prerequisites
- Run the GraphQL service given in the [JWT Auth service](/learn/by-example/graphql-service-jwt-auth/) example.

Run the client program by executing the command below.

::: out graphql_client_security_self_signed_jwt_authentication.out :::
::: out graphql_client_security_jwt_authentication.out :::

## Related links
- [`graphql:JwtIssuerConfig` record - API documentation](https://lib.ballerina.io/ballerina/graphql/latest#JwtIssuerConfig)
Expand Down
4 changes: 4 additions & 0 deletions examples/http-access-logs/Config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[ballerina.http.accessLogConfig]
# Enable printing access logs on the Console. The default value is `false`.
console = true
# Specify the format of access logs. Options are `flat` or `json`. The default value is `flat`.
format = "flat"
# List of attributes to include in the access logs. This field is optional.
attributes = ["ip", "date_time", "request", "status", "response_body_size", "http_referrer", "http_user_agent"]
# Specify the file path to save the access logs. This is optional.
path = "testAccessLog.txt"
2 changes: 1 addition & 1 deletion examples/http-access-logs/http_access_logs.bal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ballerina/http;

type Album readonly & record {|
public type Album readonly & record {|
string title;
string artist;
|};
Expand Down
2 changes: 1 addition & 1 deletion examples/http-access-logs/http_access_logs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HTTP service - Access logs

Ballerina allows enabling HTTP access logs, which can be used to record the HTTP requests handled by the application. HTTP access logs are disabled by default. Set `console=true` under `ballerina.http.accessLogConfig` in the `Config.toml` file to enable them. Additionally, the `path` field can be used to specify the file path to save the access logs.
Ballerina allows enabling HTTP access logs, which can be used to record the HTTP requests handled by the application. HTTP access logs are disabled by default. Set `console=true` under `ballerina.http.accessLogConfig` in the `Config.toml` file to enable them. Additionally, the `path` field can be used to specify the file path to save the access logs. The log format can be specified as either `flat` or `json` using the optional `format` field (defaults to `flat`). Furthermore, you can customize the logged attributes using the optional `attributes` field.

::: code http_access_logs.bal :::

Expand Down
2 changes: 1 addition & 1 deletion examples/http-access-logs/http_access_logs.server.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$ bal run http_access_logs.bal
ballerina: HTTP access log enabled
127.0.0.1 - - [15/Dec/2022:11:39:42 +0530] "GET /albums HTTP/1.1" 200 95 "-" "curl/7.79.1"
127.0.0.1 [11/Jul/2024:13:21:01.620 +0530] "GET /albums HTTP/1.1" 200 95 "-" "curl/8.4.0"
13 changes: 13 additions & 0 deletions examples/http-sse-client/http_sse_client.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ballerina/http;
import ballerina/io;

public function main() returns error? {
http:Client clientEp = check new ("localhost:9090");
// Make a GET request to the "/stocks" endpoint and receive a stream of `http:SseEvent`.
stream<http:SseEvent, error?> eventStream = check clientEp->/stocks;
// Iterate over the stream and handle each event.
check from http:SseEvent event in eventStream
do {
io:println("Stock price: ", event.data);
};
}
7 changes: 7 additions & 0 deletions examples/http-sse-client/http_sse_client.client.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ bal run http_sse_client.bal

Stock price: 249.9963321685791
Stock price: 56.58070945739746
Stock price: 571.2127494812012
Stock price: 217.98820853233337
Stock price: 21.891758739948273
16 changes: 16 additions & 0 deletions examples/http-sse-client/http_sse_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# HTTP client - Server-sent events

The HTTP client supports receiving real-time data from services using server-sent events (SSE). It allows payload-binding of a stream of `http:SseEvent` when consuming SSE from a service. This payload binding fails if the content type header is not present in the response or does not have the value `text/event-stream`.

::: code http_sse_client.bal :::

## Prerequisites
- Run the HTTP service given in the [Server-sent events](/learn/by-example/http-sse-service/) example.

Run the client program by executing the following command.

::: out http_sse_client.client.out :::

## Related links
- [`http` module - API documentation](https://lib.ballerina.io/ballerina/http/latest/)
- [Client action return types - Specification](/spec/http/#243-client-action-return-types)
2 changes: 2 additions & 0 deletions examples/http-sse-client/http_sse_client.metatags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description: This example demonstrates how server-sent events (SSE) can be consumed using an HTTP client.
keywords: ballerina, ballerina by example, bbe, http, SSE, client
33 changes: 33 additions & 0 deletions examples/http-sse-service/http_sse_service.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import ballerina/http;
import ballerina/lang.runtime;
import ballerina/random;

service /stocks on new http:Listener(9090) {
// This resource method returns a stream of `http:SseEvent` (with stock prices)
// to push real-time data to clients using server-sent events (SSE).
resource function get .() returns stream<http:SseEvent, error?> {
// Create a new value of type `StockPriceEventGenerator` to generate stock price events.
StockPriceEventGenerator generator = new;
// Return a new stream that uses the generator to produce events.
return new (generator);
}
}

// Define a stream implementor that can be used to create a stream
// of `http:SseEvent`, representing stock price events.
class StockPriceEventGenerator {
int eventCounter = 0;

public isolated function next() returns record {|http:SseEvent value;|}|error? {
// If the eventCounter reaches 5, stop generating events by returning nil.
if self.eventCounter == 5 {
return ();
}
self.eventCounter += 1;
runtime:sleep(1);
// Generate a random stock price
float stockPrice = (check random:createIntInRange(1, 1000)) * random:createDecimal();
http:SseEvent event = {data: stockPrice.toString()};
return {value: event};
}
}
27 changes: 27 additions & 0 deletions examples/http-sse-service/http_sse_service.client.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$ curl -v localhost:9090/stocks
* Trying [::1]:9090...
* Connected to localhost (::1) port 9090
> GET /stocks/stockA HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/event-stream
< cache-control: no-cache,public
< transfer-encoding: chunked
< connection: keep-alive
< server: ballerina
< date: Fri, 2 Aug 2024 12:02:04 +0530
<
data: 76.6014928817749

data: 789.1765828132629

data: 241.89215344190598

data: 494.8120536804199

data: 234.36854779720306

* Connection #0 to host localhost left intact
17 changes: 17 additions & 0 deletions examples/http-sse-service/http_sse_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# HTTP service - Server-sent events

Ballerina HTTP services support pushing real-time data to clients using server-sent events (SSE). A stream of type `http:SseEvent` can be returned from service resource methods. This feature automatically handles sending SSE and sets the content type to `text/event-stream` and the transfer encoding to chunked.

::: code http_sse_service.bal :::

Run the service program by executing the following command.

::: out http_sse_service.server.out :::

Invoke the service by executing the following cURL command in a new terminal.

::: out http_sse_service.client.out :::

## Related links
- [`http` module - API documentation](https://lib.ballerina.io/ballerina/http/latest/)
- [Resource return types - Specification](/spec/http/#235-return-types)
2 changes: 2 additions & 0 deletions examples/http-sse-service/http_sse_service.metatags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description: This example demonstrates how server-sent events (SSE) can be produced using an HTTP service.
keywords: ballerina, ballerina by example, bbe, http, SSE, service
1 change: 1 addition & 0 deletions examples/http-sse-service/http_sse_service.server.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$ bal run http_sse_service.bal
16 changes: 16 additions & 0 deletions examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,14 @@
"verifyOutput": false,
"disablePlayground": false,
"isLearnByExample": false
},
{
"name": "Server-sent events",
"url": "http-sse-service",
"verifyBuild": true,
"verifyOutput": false,
"disablePlayground": false,
"isLearnByExample": false
}
]
},
Expand Down Expand Up @@ -2327,6 +2335,14 @@
"verifyOutput": false,
"disablePlayground": false,
"isLearnByExample": false
},
{
"name": "Server-sent events",
"url": "http-sse-client",
"verifyBuild": true,
"verifyOutput": false,
"disablePlayground": false,
"isLearnByExample": false
}
]
},
Expand Down
75 changes: 37 additions & 38 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group=org.ballerinalang
version=2201.10.0-SNAPSHOT
codeName=swan-lake

ballerinaLangVersion=2201.10.0-20240806-083400-aabac46a
ballerinaLangVersion=2201.10.0-20240814-095500-9d14866a
ballerinaJreVersion=2.0.0
dependencyJREVersion=jdk-17.0.7+7-jre
specVersion=2024R1
Expand All @@ -18,83 +18,82 @@ stdlibJavaArraysVersion=1.4.0
stdlibTimeVersion=2.4.0
stdlibUrlVersion=2.4.0
stdlibXmldataVersion=2.7.0
observeVersion=1.3.0-20240807-093200-e29ca7a
observeVersion=1.3.0-20240814-114100-0f71e1e
stdlibMathVectorVersion=1.0.2
stdlibLdapVersion=1.0.0


# Stdlib Level 02
stdlibAvroVersion=1.0.0
stdlibConstraintVersion=1.5.0
stdlibCryptoVersion=2.7.2
stdlibDataXmldataVersion=1.0.0-20240807-112700-58e6b2e
stdlibLogVersion=2.10.0-20240807-203000-b85cfb9
stdlibDataXmldataVersion=1.0.0-20240814-191500-2f18de5
stdlibLogVersion=2.10.0-20240814-120000-f0c3cc8
stdlibOsVersion=1.8.0
stdlibProtobufVersion=1.6.0
stdlibPersistVersion=1.4.0-20240808-102300-3b855e5
stdlibPersistVersion=1.4.0-20240814-114800-babb51d
stdlibRandomVersion=1.5.0
stdlibTaskVersion=2.5.0
stdlibXsltVersion=2.6.0
observeInternalVersion=1.3.0-20240807-094500-91e2d3a
stdlibXsltVersion=2.7.0-20240814-114700-6263914
observeInternalVersion=1.3.0-20240814-114900-8a734a3

# Stdlib Level 03
stdlibCacheVersion=3.8.0
stdlibFileVersion=1.10.0-20240807-205900-a4d66bb
stdlibFtpVersion=2.11.0-20240807-205800-1cad899
stdlibMimeVersion=2.10.0-20240807-205100-2728cdc
stdlibTcpVersion=1.11.0-20240807-210000-f59218d
stdlibUdpVersion=1.11.0-20240807-205900-6c9a844
stdlibFileVersion=1.10.0-20240814-133200-74f4d63
stdlibFtpVersion=2.11.0-20240814-133300-880498b
stdlibMimeVersion=2.10.0-20240814-133200-6c54439
stdlibTcpVersion=1.11.0-20240814-133400-6d1c825
stdlibUdpVersion=1.11.0-20240814-133300-d045fdb
stdlibUuidVersion=1.8.0

# Stdlib Level 04
stdlibAuthVersion=2.12.0-20240807-214700-37b31bb
stdlibDataJsondataVersion=0.2.0-20240807-224500-d31539b
stdlibDataYamlVersion=0.1.0-20240807-112000-b0a67ad
stdlibEdiVersion=1.3.0-20240808-145600-6ee8ef8
stdlibEmailVersion=2.10.0-20240807-214800-06a3fe5
stdlibJwtVersion=2.13.0-20240809-095500-b9d03ed
stdlibMqttVersion=1.2.0-20240807-214800-026fa3f
stdlibOAuth2Version=2.12.0-20240807-220200-7f7294b
stdlibTomlVersion=0.6.0-20240808-100500-48de492
stdlibYamlVersion=0.6.0-20240808-145600-47a4b09
stdlibAuthVersion=2.12.0-20240814-133000-6db5624
stdlibDataJsondataVersion=0.2.0-20240814-191500-f56f59d
stdlibDataYamlVersion=0.1.0-20240814-173800-28b6472
stdlibEdiVersion=1.3.0-20240814-213100-b4b2e85
stdlibEmailVersion=2.10.0-20240814-134700-5eb385e
stdlibJwtVersion=2.13.0-20240814-133100-630021f
stdlibMqttVersion=1.2.0-20240814-133700-e7f2ee8
stdlibOAuth2Version=2.12.0-20240814-133400-a7008e4
stdlibTomlVersion=0.6.0-20240814-213100-d56138d
stdlibYamlVersion=0.6.0-20240814-140300-46c5757

# Stdlib Level 05
stdlibHttpVersion=2.12.0-20240809-111500-91b1ccd
stdlibHttpVersion=2.12.0-20240814-145000-dcdc9a0

# Stdlib Level 06
stdlibGrpcVersion=1.12.0-20240809-125800-0b4a6a7
stdlibSoapVersion=1.1.0-20240809-130500-7cdbd17
stdlibTransactionVersion=1.10.0-20240809-131000-44ec1bf
stdlibWebsocketVersion=2.12.0-20240809-131100-62b3d4f
stdlibWebsubVersion=2.12.0-20240809-141900-6da2c05
stdlibWebsubhubVersion=1.12.0-20240809-145300-5c3d48f
stdlibGrpcVersion=1.12.0-20240814-155200-3ee2dba
stdlibSoapVersion=1.1.0-20240814-154600-d29a6f1
stdlibTransactionVersion=1.10.0-20240814-160700-00e0ba7
stdlibWebsocketVersion=2.12.0-20240814-155600-2780f9f
stdlibWebsubVersion=2.12.0-20240814-154800-145e936
stdlibWebsubhubVersion=1.12.0-20240814-154900-e05bf0c

# Stdlib Level 07
stdlibGraphqlVersion=1.14.0-20240809-155800-d79bf35
stdlibSqlVersion=1.14.0-20240809-142900-0689c89
stdlibGraphqlVersion=1.14.0-20240814-162600-e68e1fa
stdlibSqlVersion=1.14.0-20240814-162300-116ead6

# Persist Tool
persistToolVersion=1.4.0-20240810-075600-b104175
persistToolVersion=1.4.0-20240814-194900-d6e847f

# Dev Tools
devToolsVersion=1.5.0-20240810-220200-7827843
devToolsVersion=1.5.0-20240814-211500-779deb8
ballerinaCommandVersion=1.4.2

# API Doc UI
docUiApi=https://api.dev-central.ballerina.io/2.0/docs/doc-ui

# GraphQL Tool
graphqlToolVersion=0.11.0-20240809-162000-0507ddf
graphqlToolVersion=0.11.0-20240814-214700-06caed0

# Protoc Tool
protocToolVersion=0.3.0

# OpenAPI Module
openapiToolVersion=2.1.0-20240809-172800-92dcfd0
openapiToolVersion=2.1.0-20240814-224500-a8752fd

# AsyncAPI Module
asyncapiToolVersion=0.9.0-20240809-172800-9514d22
asyncapiToolVersion=0.9.0-20240814-221100-73a699d

c2cVersion=3.1.0-20240810-212400-ed6bd75
c2cVersion=3.1.0-20240814-182100-cd05a6f

installerVersion=f7b952b2-f64b-45f0-ab86-df7d892ffc21
Loading