Skip to content

Commit

Permalink
Plaid connector (airbytehq#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiardina authored Dec 31, 2020
1 parent d16ef61 commit 92fa63f
Show file tree
Hide file tree
Showing 17 changed files with 583 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
TWILIO_TEST_CREDS: ${{ secrets.TWILIO_TEST_CREDS }}
ZENDESK_SECRETS_CREDS: ${{ secrets.ZENDESK_SECRETS_CREDS }}
ZOOM_INTEGRATION_TEST_CREDS: ${{ secrets.ZOOM_INTEGRATION_TEST_CREDS }}
PLAID_INTEGRATION_TEST_CREDS: ${{ secrets.PLAID_INTEGRATION_TEST_CREDS }}
- run: |
./tools/bin/ci_integration_test.sh ${{ github.event.inputs.connector }}
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sourceDefinitionId": "ed799e2b-2158-4c66-8da4-b40fe63bc72a",
"name": "Plaid",
"dockerRepository": "airbyte/source-plaid",
"dockerImageTag": "0.1.0",
"documentationUrl": "https://hub.docker.com/r/airbyte/source-plaid"
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,8 @@
dockerRepository: airbyte/source-looker
dockerImageTag: 0.1.0
documentationUrl: https://hub.docker.com/r/airbyte/source-looker
- sourceDefinitionId: ed799e2b-2158-4c66-8da4-b40fe63bc72a
name: Plaid
dockerRepository: airbyte/source-plaid
dockerImageTag: 0.1.0
documentationUrl: https://hub.docker.com/r/airbyte/source-plaid
8 changes: 8 additions & 0 deletions airbyte-integrations/connectors/source-plaid/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!Dockerfile
!Dockerfile.test
!package.json
!spec.json
!source.js
!secrets
!fullrefresh_configured_catalog.json
1 change: 1 addition & 0 deletions airbyte-integrations/connectors/source-plaid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions airbyte-integrations/connectors/source-plaid/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"singleQuote": true
}
15 changes: 15 additions & 0 deletions airbyte-integrations/connectors/source-plaid/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# node 14
FROM node:alpine3.12

WORKDIR /airbyte/integration_code
# Copy source files
COPY package.json .
COPY source.js .
COPY spec.json .
# Install any needed dependencies
RUN npm install

ENTRYPOINT ["node", "/airbyte/integration_code/source.js"]

LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.name=airbyte/source-plaid
75 changes: 75 additions & 0 deletions airbyte-integrations/connectors/source-plaid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Plaid Source

This is the repository for the JavaScript Template source connector, written in JavaScript.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/javascript-template).

## Local development

### Prerequisites

**To iterate on this connector, make sure to complete this prerequisites section.**

#### Build & Activate Virtual Environment

First, build the module by running the following from the `airbyte` project root directory:

```
./gradlew :airbyte-integrations:connectors:source-plaid:build
```

This will generate a virtualenv for this module in `source-plaid/.venv`. Make sure this venv is active in your
development environment of choice. To activate the venv from the terminal, run:

```
cd airbyte-integrations/connectors/source-plaid # cd into the connector directory
source .venv/bin/activate
```

If you are in an IDE, follow your IDE's instructions to activate the virtualenv.

#### Create credentials

**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/javascript-template)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_javascript_template/spec.json` file.
See `sample_files/sample_config.json` for a sample config file.

**If you are an Airbyte core member**, copy the credentials in RPass under the secret name `source-plaid-integration-test-config`
and place them into `secrets/config.json`.

### Locally running the connector

```
npm install
node source.js spec
node source.js check --config secrets/config.json
node source.js discover --config secrets/config.json
node source.js read --config secrets/config.json --catalog sample_files/configured_catalog.json
```

### Unit Tests (wip)

To run unit tests locally, from the connector directory run:

```
npm test
```

### Locally running the connector docker image

```
# in airbyte root directory
./gradlew :airbyte-integrations:connectors:source-plaid:airbyteDocker
docker run --rm airbyte/source-plaid:dev spec
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-plaid/secrets:/secrets airbyte/source-plaid:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-plaid/secrets:/secrets airbyte/source-plaid:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-plaid/secrets:/secrets -v $(pwd)/airbyte-integrations/connectors/source-plaid/sample_files:/sample_files airbyte/source-plaid:dev read --config /secrets/config.json --catalog /sample_files/fullrefresh_configured_catalog.json
```

### Integration Tests

1. From the airbyte project root, run `./gradlew :airbyte-integrations:connectors:source-plaid:integrationTest` to run the standard integration test suite.
1. To run additional integration tests, place your integration tests in a new directory `integration_tests` and run them with `node test (wip)`.

## Dependency Management

All of your dependencies should go in `package.json`.
42 changes: 42 additions & 0 deletions airbyte-integrations/connectors/source-plaid/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
plugins {
id 'airbyte-docker'
id 'airbyte-standard-source-test-file'
id 'base' // ?
id 'com.github.node-gradle.node' version '2.2.4'
}

node {
download = true
version = "14.11.0"
}

npm_run_build {
inputs.files fileTree('public')
inputs.files fileTree('src')
inputs.file 'package.json'
inputs.file 'package-lock.json'

outputs.dir project.buildDir
}
assemble.dependsOn npm_run_build

//task test(type: NpmTask) {
// dependsOn assemble
//
// args = ['run', 'test', '--', '--watchAll=false']
// inputs.files fileTree('src')
// inputs.file 'package.json'
// inputs.file 'package-lock.json'
//}

airbyteStandardSourceTestFile {
// All these input paths must live inside this connector's directory (or subdirectories)
configPath = "secrets/config.json"
configuredCatalogPath = "sample_files/fullrefresh_configured_catalog.json"
specPath = "spec.json"
}

dependencies {
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base').airbyteDocker.outputs)
}
31 changes: 31 additions & 0 deletions airbyte-integrations/connectors/source-plaid/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions airbyte-integrations/connectors/source-plaid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "source-plaid",
"version": "1.0.0",
"description": "Airbyte Plaid Source.",
"main": "source.js",
"scripts": {
"build": ""
},
"author": "",
"license": "ISC",
"dependencies": {
"argparse": "^2.0.1",
"axios": "^0.21.1",
"date-fns": "^2.16.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"streams": [
{
"stream": {
"name": "balances",
"supported_sync_modes": ["full_refresh"],
"json_schema": {
"properties": {
"account_id": {
"type": "string"
},
"available": {
"type": "number"
},
"current": {
"type": "number"
},
"iso_currency_code": {
"type": "string"
},
"limit": {
"type": "number"
},
"unofficial_currency_code": {
"type": "string"
}
}
}
},
"sync_mode": "full_refresh"
}
]
}
Loading

0 comments on commit 92fa63f

Please sign in to comment.