From 5b7caa90f30b18bcdb6fcf348da9b179f7982b3f Mon Sep 17 00:00:00 2001 From: aashikam Date: Wed, 6 Mar 2024 10:59:39 +0530 Subject: [PATCH] Add initial implementation --- .github/CODEOWNERS | 7 + .../workflows/build-with-bal-test-graalvm.yml | 17 + .github/workflows/ci.yml | 18 + .github/workflows/daily-build.yml | 14 + .github/workflows/dev-stg-release.yml | 21 + .github/workflows/pull-request.yml | 14 + .github/workflows/release.yml | 14 + .github/workflows/trivy-scan.yml | 13 + .gitignore | 31 +- README.md | 184 +- ballerina/Module.md | 113 + ballerina/Package.md | 113 + ballerina/build.gradle | 80 + ballerina/icon.png | Bin 0 -> 8244 bytes ballerina/types.bal | 31317 + build-config/resources/Ballerina.toml | 13 + build.gradle | 76 + docs/spec/oas.json | 644687 +++++++++++++++ gradle.properties | 10 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 248 + gradlew.bat | 92 + pull_request_template.md | 54 +- settings.gradle | 49 + 25 files changed, 677141 insertions(+), 51 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/build-with-bal-test-graalvm.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/daily-build.yml create mode 100644 .github/workflows/dev-stg-release.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/trivy-scan.yml create mode 100644 ballerina/Module.md create mode 100644 ballerina/Package.md create mode 100644 ballerina/build.gradle create mode 100644 ballerina/icon.png create mode 100644 ballerina/types.bal create mode 100644 build-config/resources/Ballerina.toml create mode 100644 build.gradle create mode 100644 docs/spec/oas.json create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..76687b3 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# See: https://help.github.com/articles/about-codeowners/ + +# These owners will be the default owners for everything in the repo. +* @aashikam @niveathika diff --git a/.github/workflows/build-with-bal-test-graalvm.yml b/.github/workflows/build-with-bal-test-graalvm.yml new file mode 100644 index 0000000..a319c46 --- /dev/null +++ b/.github/workflows/build-with-bal-test-graalvm.yml @@ -0,0 +1,17 @@ +name: GraalVM Check + +on: + schedule: + - cron: "30 18 * * *" + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + call_stdlib_workflow: + name: Run StdLib Workflow + if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@main + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8edc602 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: Build + +on: + push: + branches: + - master + - 2201.[0-9]+.x + repository_dispatch: + types: check_connector_for_breaking_changes + +jobs: + call_workflow: + name: Run Connector Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/build-connector-template.yml@main + secrets: inherit + with: + repo-name: module-ballerinax-salesforce.types diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml new file mode 100644 index 0000000..060e3f0 --- /dev/null +++ b/.github/workflows/daily-build.yml @@ -0,0 +1,14 @@ +name: Daily build + +on: + schedule: + - cron: "30 2 * * *" + +jobs: + call_workflow: + name: Run Daily Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/daily-build-connector-template.yml@main + secrets: inherit + with: + repo-name: module-ballerinax-salesforce.types diff --git a/.github/workflows/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml new file mode 100644 index 0000000..49d6f52 --- /dev/null +++ b/.github/workflows/dev-stg-release.yml @@ -0,0 +1,21 @@ +name: Publish to the Ballerina Dev\Stage Central + +on: + workflow_dispatch: + inputs: + environment: + type: choice + description: Select Environment + required: true + options: + - DEV CENTRAL + - STAGE CENTRAL + +jobs: + call_workflow: + name: Run Dev\Stage Central Publish Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/dev-stage-central-publish-connector-template.yml@main + secrets: inherit + with: + environment: ${{ github.event.inputs.environment }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..5dda019 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,14 @@ +name: PR Build + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +on: pull_request + +jobs: + call_workflow: + name: Run PR Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/pr-build-connector-template.yml@main + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..83339a0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,14 @@ +name: Publish Release + +on: + workflow_dispatch: + +jobs: + call_workflow: + name: Run Release Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/release-package-connector-template.yml@main + secrets: inherit + with: + package-name: salesforce.types + package-org: ballerinax diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml new file mode 100644 index 0000000..e625103 --- /dev/null +++ b/.github/workflows/trivy-scan.yml @@ -0,0 +1,13 @@ +name: Trivy + +on: + workflow_dispatch: + schedule: + - cron: "30 20 * * *" + +jobs: + call_workflow: + name: Run Trivy Scan Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/trivy-scan-template.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore index 524f096..b97ad98 100644 --- a/.gitignore +++ b/.gitignore @@ -12,13 +12,42 @@ # Package Files # *.jar +!gradle-wrapper/*.jar *.war *.nar *.ear *.zip *.tar.gz *.rar +*.deb # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* -replay_pid* + +# .DS_Store files +*.DS_Store + +# Ballerina configuartion file +ballerina.conf +Config.toml + +# Target folder of ballerina project +target + +# json files created inside resources folder +/resources/*.json + +# idea files +*.idea +*.iml +*.ipr +*.iws + +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build + +# Ignore lib +lib diff --git a/README.md b/README.md index 4501c9d..0645dce 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,182 @@ -# module-ballerinax-salesforce.types -The Ballerina types corresponding to the base types of Salesforce SObjects, without any custom SObjects. +Salesforce SObject Types for Ballerina Salesforce Connector +=================== + +[![Build](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/ci.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/ci.yml) +[![Trivy](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/trivy-scan.yml) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-salesforce.types.svg)](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/commits/main) +[![GraalVM Check](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/build-with-bal-test-graalvm.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-salesforce.types/actions/workflows/build-with-bal-test-graalvm.yml) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) + +Salesforce is a leading customer relationship management (CRM) platform that helps businesses manage and streamline their sales, service, and marketing operations. The [Ballerina Salesforce Connector](https://central.ballerina.io/ballerinax/salesforce/latest) is a project designed to enhance integration capabilities with Salesforce by providing a seamless connection for Ballerina. Notably, this Ballerina project incorporates record type definitions for the base types of Salesforce objects, offering a comprehensive and adaptable solution for developers working on Salesforce integration projects. + +## Setup Guide + +To customize this project for your Salesforce account and include your custom SObjects, follow the steps below: + +### Step 1: Login to Your Salesforce Developer Account + +Begin by logging into your [Salesforce Developer Account](https://developer.salesforce.com/). + +### Step 2: Generate Open API Specification for Your SObjects + +#### Step 2.1: Initiate OpenAPI Document Generation + +Use the following command to send a POST request to start the OpenAPI document generation process. + +```bash +curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3 \ +-d '{"resources": ["*"]}' +``` +Replace YOUR_ACCESS_TOKEN and MyDomainName with your actual access token and Salesforce domain. If successful, you'll receive a response with a URI. Extract the locator ID from the URI. + +#### Step 2.2: Retrieve the OpenAPI Document + +Send a GET request to fetch the generated OpenAPI document using the following command. + +```bash +curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3/LOCATOR_ID -o oas.json +``` +Replace YOUR_ACCESS_TOKEN, MyDomainName, and LOCATOR_ID with your actual values. + +### Step 3: Configure Cluster Settings + +To prevent Out-of-Memory (OOM) issues, execute the following command: + +```bash +export JAVA_OPTS="$JAVA_OPTS -DmaxYamlCodePoints=99999999" +``` + +Generate the Ballerina project for the OpenAPI spec using the Ballerina Open API tool with the following commands. + +```bash +bal openapi -i oas.json --mode client --client-methods resource +``` + +### Step 4: Edit the Generated Client and Push it to Local Repository + +#### Step 4.1 Delete the utils.bal and clients.bal files. + +#### Step 4.2 Use the following commands to build, pack, and push the package: + +````bash +bal pack + +bal push --repository=local +```` + +By following these steps, you can set up and customize the Ballerina Salesforce Connector for your Salesforce account with ease. + +## Quickstart + +To use the `salesforce.types` module in your Ballerina application, modify the `.bal` file as follows: + +### Step 1: Import the package + +Import `ballerinax/salesforce.types` module. + +```ballerina +import ballerinax/salesforce; +import ballerinax/salesforce.types; +``` + +### Step 2: Instantiate a new client + +Obtain the tokens using the following the [`ballerinax/salesforce` connector set up guide](https://central.ballerina.io/ballerinax/salesforce/latest). Create a salesforce:ConnectionConfig with the obtained OAuth2 tokens and initialize the connector with it. + +```ballerina +salesforce:ConnectionConfig config = { + baseUrl: baseUrl, + auth: { + clientId: clientId, + clientSecret: clientSecret, + refreshToken: refreshToken, + refreshUrl: refreshUrl + } +}; + +salesforce:Client salesforce = new(config); +``` + +### Step 3: Invoke the connector operation + +Now you can utilize the available operations. Note that they are in the form of remote operations. Following is an example on how to create a record using the connector. + +```ballerina +salesforce:Client salesforce = check new (config); +stypes:AccountSObject response = { + Name: "IT World", + BillingCity: "New York" +}; + +salesforce:CreationResponse response = check salesforce->create("Account", response); +``` + +Use following command to compile and run the Ballerina program. + +```bash +bal run +``` + +## Issues and projects + +The **Issues** and **Projects** tabs are disabled for this repository as this is part of the Ballerina library. To report bugs, request new features, start new discussions, view project boards, etc., visit the Ballerina library [parent repository](https://github.com/ballerina-platform/ballerina-library). + +This repository only contains the source code for the package. + +## Build from the source + +### Prerequisites + +1. Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources: + + * [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) + * [OpenJDK](https://adoptium.net/) + + > **Note:** After installation, remember to set the `JAVA_HOME` environment variable to the directory where JDK was installed. + +2. Download and install [Ballerina Swan Lake](https://ballerina.io/). + +3. Download and install [Docker](https://www.docker.com/get-started). + + > **Note**: Ensure that the Docker daemon is running before executing any tests. + +### Build options + +Execute the commands below to build from the source. + +1. To build the package: + + ```bash + ./gradlew clean build + ``` + +2. Publish the generated artifacts to the local Ballerina Central repository: + + ```bash + ./gradlew clean build -PpublishToLocalCentral=true + ``` + +3. Publish the generated artifacts to the Ballerina Central repository: + + ```bash + ./gradlew clean build -PpublishToCentral=true + ``` + +## Contribute to Ballerina + +As an open-source project, Ballerina welcomes contributions from the community. + +For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md). + +## Code of conduct + +All the contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct). + +## Useful links + +* For more information go to the [`salesforce.types` package](https://lib.ballerina.io/ballerinax/salesforce.types/latest). +* For example demonstrations of the usage, go to [Ballerina By Examples](https://ballerina.io/learn/by-example/). +* Chat live with us via our [Discord server](https://discord.gg/ballerinalang). +* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag. diff --git a/ballerina/Module.md b/ballerina/Module.md new file mode 100644 index 0000000..3389c56 --- /dev/null +++ b/ballerina/Module.md @@ -0,0 +1,113 @@ +## Overview + +Salesforce is a leading customer relationship management (CRM) platform that helps businesses manage and streamline their sales, service, and marketing operations. The [Ballerina Salesforce Connector](https://central.ballerina.io/ballerinax/salesforce/latest) is a project designed to enhance integration capabilities with Salesforce by providing a seamless connection for Ballerina. Notably, this Ballerina project incorporates record type definitions for the base types of Salesforce objects, offering a comprehensive and adaptable solution for developers working on Salesforce integration projects. + +## Setup Guide + +To customize this project for your Salesforce account and include your custom SObjects, follow the steps below: + +### Step 1: Login to Your Salesforce Developer Account + +Begin by logging into your [Salesforce Developer Account](https://developer.salesforce.com/). + +### Step 2: Generate Open API Specification for Your SObjects + +#### Step 2.1: Initiate OpenAPI Document Generation + +Use the following command to send a POST request to start the OpenAPI document generation process. + +```bash +curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3 \ +-d '{"resources": ["*"]}' +``` +Replace YOUR_ACCESS_TOKEN and MyDomainName with your actual access token and Salesforce domain. If successful, you'll receive a response with a URI. Extract the locator ID from the URI. + +#### Step 2.2: Retrieve the OpenAPI Document + +Send a GET request to fetch the generated OpenAPI document using the following command. + +```bash +curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3/LOCATOR_ID -o oas.json +``` +Replace YOUR_ACCESS_TOKEN, MyDomainName, and LOCATOR_ID with your actual values. + +### Step 3: Configure Cluster Settings + +To prevent Out-of-Memory (OOM) issues, execute the following command: + +```bash +export JAVA_OPTS="$JAVA_OPTS -DmaxYamlCodePoints=99999999" +``` + +Generate the Ballerina project for the OpenAPI spec using the Ballerina Open API tool with the following commands. + +```bash +bal openapi -i oas.json --mode client --client-methods resource +``` + +### Step 4: Edit the Generated Client and Push it to Local Repository + +#### Step 4.1 Delete the utils.bal and clients.bal files. + +#### Step 4.2 Use the following commands to build, pack, and push the package: + +````bash +bal pack + +bal push --repository=local +```` + +By following these steps, you can set up and customize the Ballerina Salesforce Connector for your Salesforce account with ease. + +## Quickstart + +To use the `salesforce.types` module in your Ballerina application, modify the `.bal` file as follows: + +### Step 1: Import the package + +Import `ballerinax/salesforce.types` module. + +```ballerina +import ballerinax/salesforce; +import ballerinax/salesforce.types; +``` + +### Step 2: Instantiate a new client + +Obtain the tokens using the following the [`ballerinax/salesforce` connector set up guide](https://central.ballerina.io/ballerinax/salesforce/latest). Create a salesforce:ConnectionConfig with the obtained OAuth2 tokens and initialize the connector with it. + +```ballerina +salesforce:ConnectionConfig config = { + baseUrl: baseUrl, + auth: { + clientId: clientId, + clientSecret: clientSecret, + refreshToken: refreshToken, + refreshUrl: refreshUrl + } +}; + +salesforce:Client salesforce = new(config); +``` + +### Step 3: Invoke the connector operation + +Now you can utilize the available operations. Note that they are in the form of remote operations. Following is an example on how to create a record using the connector. + +```ballerina +salesforce:Client salesforce = check new (config); +stypes:AccountSObject response = { + Name: "IT World", + BillingCity: "New York" +}; + +salesforce:CreationResponse response = check salesforce->create("Account", response); +``` + +Use following command to compile and run the Ballerina program. + +```bash +bal run +``` diff --git a/ballerina/Package.md b/ballerina/Package.md new file mode 100644 index 0000000..3389c56 --- /dev/null +++ b/ballerina/Package.md @@ -0,0 +1,113 @@ +## Overview + +Salesforce is a leading customer relationship management (CRM) platform that helps businesses manage and streamline their sales, service, and marketing operations. The [Ballerina Salesforce Connector](https://central.ballerina.io/ballerinax/salesforce/latest) is a project designed to enhance integration capabilities with Salesforce by providing a seamless connection for Ballerina. Notably, this Ballerina project incorporates record type definitions for the base types of Salesforce objects, offering a comprehensive and adaptable solution for developers working on Salesforce integration projects. + +## Setup Guide + +To customize this project for your Salesforce account and include your custom SObjects, follow the steps below: + +### Step 1: Login to Your Salesforce Developer Account + +Begin by logging into your [Salesforce Developer Account](https://developer.salesforce.com/). + +### Step 2: Generate Open API Specification for Your SObjects + +#### Step 2.1: Initiate OpenAPI Document Generation + +Use the following command to send a POST request to start the OpenAPI document generation process. + +```bash +curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3 \ +-d '{"resources": ["*"]}' +``` +Replace YOUR_ACCESS_TOKEN and MyDomainName with your actual access token and Salesforce domain. If successful, you'll receive a response with a URI. Extract the locator ID from the URI. + +#### Step 2.2: Retrieve the OpenAPI Document + +Send a GET request to fetch the generated OpenAPI document using the following command. + +```bash +curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ +https://MyDomainName.my.salesforce.com/services/data/vXX.X/async/specifications/oas3/LOCATOR_ID -o oas.json +``` +Replace YOUR_ACCESS_TOKEN, MyDomainName, and LOCATOR_ID with your actual values. + +### Step 3: Configure Cluster Settings + +To prevent Out-of-Memory (OOM) issues, execute the following command: + +```bash +export JAVA_OPTS="$JAVA_OPTS -DmaxYamlCodePoints=99999999" +``` + +Generate the Ballerina project for the OpenAPI spec using the Ballerina Open API tool with the following commands. + +```bash +bal openapi -i oas.json --mode client --client-methods resource +``` + +### Step 4: Edit the Generated Client and Push it to Local Repository + +#### Step 4.1 Delete the utils.bal and clients.bal files. + +#### Step 4.2 Use the following commands to build, pack, and push the package: + +````bash +bal pack + +bal push --repository=local +```` + +By following these steps, you can set up and customize the Ballerina Salesforce Connector for your Salesforce account with ease. + +## Quickstart + +To use the `salesforce.types` module in your Ballerina application, modify the `.bal` file as follows: + +### Step 1: Import the package + +Import `ballerinax/salesforce.types` module. + +```ballerina +import ballerinax/salesforce; +import ballerinax/salesforce.types; +``` + +### Step 2: Instantiate a new client + +Obtain the tokens using the following the [`ballerinax/salesforce` connector set up guide](https://central.ballerina.io/ballerinax/salesforce/latest). Create a salesforce:ConnectionConfig with the obtained OAuth2 tokens and initialize the connector with it. + +```ballerina +salesforce:ConnectionConfig config = { + baseUrl: baseUrl, + auth: { + clientId: clientId, + clientSecret: clientSecret, + refreshToken: refreshToken, + refreshUrl: refreshUrl + } +}; + +salesforce:Client salesforce = new(config); +``` + +### Step 3: Invoke the connector operation + +Now you can utilize the available operations. Note that they are in the form of remote operations. Following is an example on how to create a record using the connector. + +```ballerina +salesforce:Client salesforce = check new (config); +stypes:AccountSObject response = { + Name: "IT World", + BillingCity: "New York" +}; + +salesforce:CreationResponse response = check salesforce->create("Account", response); +``` + +Use following command to compile and run the Ballerina program. + +```bash +bal run +``` diff --git a/ballerina/build.gradle b/ballerina/build.gradle new file mode 100644 index 0000000..339bfed --- /dev/null +++ b/ballerina/build.gradle @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.tools.ant.taskdefs.condition.Os + +plugins { + id 'io.ballerina.plugin' +} + +description = 'Ballerina - Salesforce Base Types' + +def packageName = "salesforce.types" +def packageOrg = "ballerinax" +def tomlVersion = stripBallerinaExtensionVersion("${project.version}") +def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml") +def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml") + +def stripBallerinaExtensionVersion(String extVersion) { + if (extVersion.matches(project.ext.timestampedVersionRegex)) { + def splitVersion = extVersion.split('-') + if (splitVersion.length > 3) { + def strippedValues = splitVersion[0..-4] + return strippedValues.join('-') + } else { + return extVersion + } + } else { + return extVersion.replace("${project.ext.snapshotVersion}", "") + } +} + +ballerina { + packageOrganization = packageOrg + module = packageName + isConnector = true + platform = "java17" +} + +task updateTomlFiles { + doLast { + def newConfig = ballerinaTomlFilePlaceHolder.text.replace('@project.version@', project.version.toString()) + newConfig = newConfig.replace('@toml.version@', tomlVersion) + ballerinaTomlFile.text = newConfig + } +} + +task commitTomlFiles { + doLast { + project.exec { + ignoreExitValue true + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the toml files\" Ballerina.toml Dependencies.toml" + } else { + commandLine 'sh', '-c', "git commit -m '[Automated] Update the toml files' Ballerina.toml Dependencies.toml" + } + } + } +} + +clean { + delete 'build' +} + +build.dependsOn copyToLib +publish.dependsOn build diff --git a/ballerina/icon.png b/ballerina/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..9e38832a5fa0aae757ee824e823f68ca24059ee3 GIT binary patch literal 8244 zcmb`M1ydYNw1#naw;;h;Ah^3*aCZyt?gV!U1PSht;O?-vyR+y5OCY#pA=u@+f8pMm z>6xmoo|&%hIsHCwpEz|@c}z4iG#D5dOhpA5&G-BGe+32U{aUMER{#S88)+{st*$67 zP3`94YGd#81qO!cTktngg&_%&=-r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