Skip to content
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
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
@radovanjorgic @gasperzgonec @devrev/airdrop

# Test folder ownership
code/test/ @navneel99
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: "weekly"
allow:
- dependency-name: "@devrev/ts-adaas"
- dependency-name: "@devrev/airsync-sdk"
labels:
- "dependencies"
- "marketplace-submission"
Expand Down
5 changes: 4 additions & 1 deletion .github/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Syncs data between Todo and DevRev using DevRev's AirSync platform.

Install the following tools:

- [Node.js](https://nodejs.org/en/download/)
- [Node.js 20 or newer](https://nodejs.org/en/download/)
- [DevRev CLI](https://developer.devrev.ai/snapin-development/references/cli-install)
- [jq](https://jqlang.github.io/jq/download/)
- [ngrok](https://ngrok.com/download) (for local development)
Expand Down Expand Up @@ -40,6 +40,9 @@ USER_EMAIL=my@email.com

These values will be used as defaults when the scripts prompt you for credentials.

The connector uses `@devrev/airsync-sdk`. Its local test server sets
`AIRSYNC_LOCAL_DEVELOPMENT=1` to enable local logging and artifact copies.

## Deploy

Run the deployment script:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
const { owner, repo, number } = context.issue;
const prTitle = context.payload.pull_request.title;

if (!prTitle.includes('@devrev/ts-adaas')) {
if (!prTitle.includes('@devrev/airsync-sdk')) {
console.log('Skipping PR: Not a DevRev SDK update');
return;
}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@

# Local deploy logs (written by code/scripts/deploy.sh)
code/logs

.airsync/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This repository provides a template to implement an AirSync snap-in that imports

See the [AirSync snap-in documentation](https://developer.devrev.ai/airsync) for development guidance.

The template uses `@devrev/airsync-sdk` and requires Node.js 20 or newer.

## Local Fixture Testing

From the `code/` directory, you can run the built-in fixture runner to test the
Expand All @@ -26,3 +28,5 @@ npm start -- --fixturePath start_loading_data

The runner reads `code/.env` and resolves `${TODO_API_KEY}` in fixture files,
so copy `code/.env.example` before running the fixtures.
The fixture runner and local test server set `AIRSYNC_LOCAL_DEVELOPMENT=1`
to enable local logging and artifact copies in `code/extracted_files/`.
49 changes: 39 additions & 10 deletions code/package-lock.json

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

5 changes: 4 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@
"yargs": "^17.6.2"
},
"dependencies": {
"@devrev/ts-adaas": "1.20.2",
"@devrev/airsync-sdk": "2.0.0",
"@devrev/typescript-sdk": "1.1.78",
"axios": "^1.20.0",
"dotenv": "^16.0.3",
"jiti": "2.5.1",
"js-jsonl": "^1.1.1",
"yargs": "^17.6.2"
},
"engines": {
"node": ">=20"
}
}
2 changes: 1 addition & 1 deletion code/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ if [ "$DEPLOY_MODE" = "local" ]; then
echo ""

cd "$CODE_DIR"
npm run test:server -- local 2>&1 | tee "$LOG_FILE"
AIRSYNC_LOCAL_DEVELOPMENT=1 npm run test:server 2>&1 | tee "$LOG_FILE"
fi

# LAMBDA DEPLOYMENT
Expand Down
2 changes: 1 addition & 1 deletion code/src/functions/external-system/data-denormalization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExternalSystemAttachment, ExternalSystemItem } from '@devrev/ts-adaas';
import { ExternalSystemAttachment, ExternalSystemItem } from '@devrev/airsync-sdk';
import { ExternalAttachment, ExternalTodo } from './types';

export function denormalizeTodo(item: ExternalSystemItem): ExternalTodo {
Expand Down
2 changes: 1 addition & 1 deletion code/src/functions/external-system/data-normalization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExternalSyncUnit, NormalizedAttachment, NormalizedItem } from '@devrev/ts-adaas';
import { ExternalSyncUnit, NormalizedAttachment, NormalizedItem } from '@devrev/airsync-sdk';
import { ExternalAttachment, ExternalTodo, ExternalTodoList, ExternalUser } from './types';

// TODO: Replace with your actual normalization functions that will be used to
Expand Down
18 changes: 9 additions & 9 deletions code/src/functions/external-system/http-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AirdropEvent, ExternalSystemItemLoadingResponse } from '@devrev/ts-adaas';
import { AirSyncEvent, ExternalSystemItemLoadingResponse } from '@devrev/airsync-sdk';
import { ExternalAttachment, ExternalTodo, ExternalTodoList, ExternalUser } from './types';

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -85,7 +85,7 @@ export class HttpClient {
private apiEndpoint: string;
private apiToken: string;

constructor(event: AirdropEvent) {
constructor(event: AirSyncEvent) {
// TODO: Replace with the API endpoint of the external system. This is
// passed through the event payload (e.g. event.payload.connection_data.org_id
// or a keyring subdomain field).
Expand Down Expand Up @@ -120,26 +120,26 @@ export class HttpClient {
}

// TODO: Replace with an actual API call that creates a todo in the external system.
// The function must return { id } on success or { error } on failure.
// Return a status with an id on success or an error with a message on failure.
async createTodo(todo: ExternalTodo): Promise<ExternalSystemItemLoadingResponse> {
const id = `todo-${Date.now()}`;
todosStore.set(id, { ...todo, id, modified_date: new Date().toISOString() });
return { id };
return { status: 'success', id };
}

// TODO: Replace with an actual API call that updates a todo in the external system.
// The function must return { id } on success or { error } on failure.
// Return a status with an id on success or an error with a message on failure.
async updateTodo(todo: ExternalTodo): Promise<ExternalSystemItemLoadingResponse> {
if (!todosStore.has(todo.id)) {
return { error: `Todo with id "${todo.id}" not found in external system.` };
return { status: 'error', error: { message: `Todo with id "${todo.id}" not found in external system.` } };
}
todosStore.set(todo.id, { ...todo, modified_date: new Date().toISOString() });
return { id: todo.id };
return { status: 'success', id: todo.id };
}

// TODO: Replace with an actual API call that creates an attachment in the external system.
// The function must return { id } on success or { error } on failure.
// Return a status with an id on success or an error with a message on failure.
async createAttachment(attachment: ExternalAttachment): Promise<ExternalSystemItemLoadingResponse> {
return { id: attachment.id };
return { status: 'success', id: attachment.id };
}
}
4 changes: 2 additions & 2 deletions code/src/functions/extraction/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AirdropEvent, spawn } from '@devrev/ts-adaas';
import { AirSyncEvent, spawn } from '@devrev/airsync-sdk';

import initialDomainMapping from '../external-system/initial_domain_mapping.json';

Expand All @@ -19,7 +19,7 @@ export const initialExtractorState: ExtractorState = {
attachments: { completed: false },
};

const run = async (events: AirdropEvent[]) => {
const run = async (events: AirSyncEvent[]) => {
for (const event of events) {
await spawn<ExtractorState>({
event,
Expand Down
Loading
Loading