Skip to content

Commit

Permalink
Merge branch 'master' into praneesha-patch-5
Browse files Browse the repository at this point in the history
  • Loading branch information
praneesha committed Oct 23, 2023
2 parents 439702c + 78f7871 commit 5e3794b
Show file tree
Hide file tree
Showing 27 changed files with 448 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x project-api-tests:test
Expand Down Expand Up @@ -235,6 +236,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew :project-api-tests:test --stacktrace --scan --console=plain --no-daemon --continue
Expand All @@ -256,6 +258,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew.bat clean build --stacktrace --scan --console=plain --no-daemon -x test
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x project-api-tests:test
- name: Build Ballerina Distribution Skip Tests
Expand All @@ -47,6 +48,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x test
- name: Archive Ballerina ZIP
uses: actions/upload-artifact@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-release-artifacts-1.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}

- name: Generate metadata json
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}

- name: Generate metadata json
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: |
./gradlew build -Pversion=${VERSION}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x :ballerina:testExamples -x :project-api-tests:test

Expand All @@ -50,6 +51,7 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: ./gradlew clean :ballerina:testExamples --stacktrace --scan --console=plain --no-daemon --continue -x :project-api-tests:test
windows-build-without-tests:
Expand All @@ -72,5 +74,6 @@ jobs:
packagePAT: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
run: ./gradlew.bat clean build --stacktrace --scan --console=plain --no-daemon --continue -x test
8 changes: 4 additions & 4 deletions ballerina-test-automation/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
swan-lake-latest-version=swan-lake-2201.8.0
swan-lake-latest-version=swan-lake-2201.8.1
swan-lake-latest-spec-version=2023R1
swan-lake-latest-version-display-text=2201.8.0
swan-lake-latest-tool-version=1.4.0
latest-tool-version=1.4.0
swan-lake-latest-version-display-text=2201.8.1
swan-lake-latest-tool-version=1.4.1
latest-tool-version=1.4.1
1-x-channel-latest-version=1.2.13
1-x-channel-latest-spec-version=2020R1
13 changes: 7 additions & 6 deletions examples/custom-prefetch-methods/custom_prefetch_methods.bal
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ isolated function bookLoaderFunction(readonly & anydata[] ids) returns BookRow[]
}

@graphql:ServiceConfig {
contextInit: isolated function(http:RequestContext requestContext, http:Request request)
returns graphql:Context {
graphql:Context ctx = new;
ctx.registerDataLoader("bookLoader", new dataloader:DefaultDataLoader(bookLoaderFunction));
return ctx;
}
contextInit
}
service /graphql on new graphql:Listener(9090) {
resource function get authors() returns Author[] {
Expand Down Expand Up @@ -84,3 +79,9 @@ public isolated distinct service class Author {
select {id: bookRow.id, title: bookRow.title};
}
}

isolated function contextInit(http:RequestContext requestContext, http:Request request) returns graphql:Context {
graphql:Context ctx = new;
ctx.registerDataLoader("bookLoader", new dataloader:DefaultDataLoader(bookLoaderFunction));
return ctx;
}
28 changes: 14 additions & 14 deletions examples/graphql-context/graphql_context.bal
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,7 @@ type Profile record {|

@graphql:ServiceConfig {
// Initialization of the `graphqlContext` should be provided to the `contextInit` field.
contextInit: isolated function(http:RequestContext requestContext, http:Request request)
returns graphql:Context|error {

// Initialize the `graphql:Context` object.
graphql:Context context = new;

// Retrieves the header named `scope` from the `http:request` and set it to the context with
// the `scope` key. If the header does not exist, this will return an `error`, and thereby,
// the request will not be processed.
context.set("scope", check request.getHeader("scope"));

// Finally, the context object should be returned.
return context;
}
contextInit
}
service /graphql on new graphql:Listener(9090) {
// Defines a `Profile` field inside the service.
Expand All @@ -50,3 +37,16 @@ service /graphql on new graphql:Listener(9090) {
return error("Permission denied");
}
}

isolated function contextInit(http:RequestContext requestContext, http:Request request) returns graphql:Context|error {
// Initialize the `graphql:Context` object.
graphql:Context context = new;

// Retrieves the header named `scope` from the `http:request` and set it to the context with
// the `scope` key. If the header does not exist, this will return an `error`, and thereby,
// the request will not be processed.
context.set("scope", check request.getHeader("scope"));

// Finally, the context object should be returned.
return context;
}
17 changes: 9 additions & 8 deletions examples/graphql-dataloader/graphql_dataloader.bal
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@ isolated function bookLoaderFunction(readonly & anydata[] ids) returns BookRow[]
}

@graphql:ServiceConfig {
contextInit: isolated function(http:RequestContext requestContext, http:Request request)
returns graphql:Context {
graphql:Context ctx = new;
// Register the dataloader with the context using a unique name.
// A defult implementation of the dataloader is used here.
ctx.registerDataLoader("bookLoader", new dataloader:DefaultDataLoader(bookLoaderFunction));
return ctx;
}
contextInit
}
service /graphql on new graphql:Listener(9090) {
resource function get authors() returns Author[] {
Expand Down Expand Up @@ -93,3 +86,11 @@ public isolated distinct service class Author {
select {id: bookRow.id, title: bookRow.title};
}
}

isolated function contextInit(http:RequestContext requestContext, http:Request request) returns graphql:Context {
graphql:Context ctx = new;
// Register the dataloader with the context using a unique name.
// A defult implementation of the dataloader is used here.
ctx.registerDataLoader("bookLoader", new dataloader:DefaultDataLoader(bookLoaderFunction));
return ctx;
}
30 changes: 15 additions & 15 deletions examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,21 @@
"disablePlayground": true,
"isLearnByExample": false
},
{
"name": "Hierarchical resource paths",
"url": "graphql-hierarchical-resource-paths",
"verifyBuild": true,
"verifyOutput": false,
"disablePlayground": true,
"isLearnByExample": false
}
]
},
{
"title": " GraphQL service advanced",
"column": 1,
"category": "Network libraries",
"samples": [
{
"name": "Context object",
"url": "graphql-context",
Expand Down Expand Up @@ -2483,21 +2498,6 @@
"disablePlayground": true,
"isLearnByExample": false
},
{
"name": "Hierarchical resource paths",
"url": "graphql-hierarchical-resource-paths",
"verifyBuild": true,
"verifyOutput": false,
"disablePlayground": true,
"isLearnByExample": false
}
]
},
{
"title": " GraphQL service advanced",
"column": 1,
"category": "Network libraries",
"samples": [
{
"name": "Dataloader",
"url": "graphql-dataloader",
Expand Down
10 changes: 6 additions & 4 deletions examples/mysql-prerequisite/setup_database.bal
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ public function main() returns sql:Error? {
);`);

// Adds the records to the `sales_order` table.
_ = check mysqlClient->execute(`INSERT INTO inventory VALUES
("A-123", "Lemonade", "Beyonce", 18.98, 10);`);
_ = check mysqlClient->execute(`INSERT INTO inventory VALUES
("A-321", "Renaissance", "Beyonce", 24.98, 100);`);
_ = check mysqlClient->execute(`INSERT INTO MUSIC_STORE.sales_order VALUES
("S-123", "2022-12-09", "A-123", 2);`);
_ = check mysqlClient->execute(`INSERT INTO MUSIC_STORE.sales_order VALUES
("S-321", "2022-12-09", "A-321", 1);`);
_ = check mysqlClient->execute(`INSERT INTO MUSIC_STORE.sales_order VALUES
("S-456", "2022-12-10", "A-321", 3);`);

check mysqlClient.close();
}
1 change: 1 addition & 0 deletions examples/programs-and-modules/programs_and_modules.bal
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This import declaration binds the prefix `io` to the `ballerina/io` package.
// The prefix by default comes from the last part of the package name.

// The `ballerina` org name is reserved for the Ballerina library packages.
import ballerina/io;

Expand Down
4 changes: 2 additions & 2 deletions examples/sequence-diagrams/sequence_diagrams.bal
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import ballerina/io;
public function main() returns error? {
// The diagram also has a lifeline for each client object parameter or variable in
// the initialization section, representing the remote system to which the client object is sending messages.
http:Client cl = check new ("https://www.mocky.io");
http:Client cl = check new ("https://run.mocky.io");

// Each remote method call on a client object is represented as a horizontal line
// between the lifeline of the worker making the call and the remote system.
string payload = check cl->get("/v2/5ae082123200006b00510c3d/");
string payload = check cl->get("/v3/7240398e-0435-4457-91b0-0c862f10563f/");

io:println(payload);
return;
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group=org.ballerinalang
version=2201.8.0-SNAPSHOT
codeName=swan-lake

ballerinaLangVersion=2201.8.0-20230830-220400-8a7556d8
ballerinaLangVersion=2201.8.0-20231001-002700-760d4e3b
ballerinaJreVersion=2.0.0
dependencyJREVersion=jdk-17.0.7+7-jre
specVersion=2023R1
Expand Down Expand Up @@ -75,7 +75,7 @@ persistToolVersion=1.2.0-20230908-152500-2ba8c45

# Dev Tools
devToolsVersion=1.2.1-20230914-153500-664cd40
ballerinaCommandVersion=1.4.0
ballerinaCommandVersion=1.4.1

# GraphQL Tool
graphqlVersion=0.8.0-20230914-153500-87f60d6
Expand Down
Loading

0 comments on commit 5e3794b

Please sign in to comment.