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

Architecture diagram for discussion #2

Merged
merged 2 commits into from
Sep 20, 2023
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
4 changes: 3 additions & 1 deletion apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"outDir": "./dist",
"emitDeclarationOnly": true
},
"include": ["./src"],
"include": [
"./src"
],
"references": []
}
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test": "vitest"
},
"dependencies": {
"@atj/docassemble": "workspace:*",
"@atj/documents": "workspace:*",
"@atj/interviews": "workspace:*",
"@axe-core/playwright": "^4.7.3",
Expand Down
6 changes: 5 additions & 1 deletion apps/frontend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { createAppRoot } from './views/main';

createAppRoot(document.getElementById('root') as HTMLElement, {});
createAppRoot(document.getElementById('root') as HTMLElement, {
backend: {
helloWorld: (str: string) => str,
},
});
25 changes: 25 additions & 0 deletions packages-python/docassemble-server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3'

services:
web:
image: jhpyle/docassemble
ports:
- '8011:80'
volumes:
- data:/usr/share/docassemble/data
- log:/usr/share/docassemble/log
- config:/usr/share/docassemble/config
- webapp:/usr/share/docassemble/webapp
redis:
image: 'redis:latest'
postgres:
image: 'postgres:latest'
environment:
POSTGRES_DB: docassemble
POSTGRES_USER: docassemble
POSTGRES_PASSWORD: secret-password
volumes:
data:
log:
config:
webapp:
1 change: 1 addition & 0 deletions packages/docassemble/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
11 changes: 11 additions & 0 deletions packages/docassemble/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @atj/docassemble

This package is the home for adapters that leverage [docassemble](https://docassemble.org/).

## Development

Run tests with coverage:

```bash
pnpm test
```
18 changes: 18 additions & 0 deletions packages/docassemble/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@atj/docassemble",
"version": "1.0.0",
"description": "10x ATJ docassemble adapter",
"license": "CC0",
"main": "src/index.ts",
"scripts": {
"build": "tsup src/* --env.NODE_ENV production",
"test": "vitest run --coverage"
},
"dependencies": {
"@atj/documents": "workspace:*",
"@atj/interviews": "workspace:*"
},
"devDependencies": {
"vitest": "^0.34.4"
}
}
11 changes: 11 additions & 0 deletions packages/docassemble/src/client.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describe, expect, it } from 'vitest';
import { createTestDocassembleClient } from './context/test';

describe('docassemble api client', () => {
const client = createTestDocassembleClient();

it('returns a list of interviews', async () => {
const interviews = await client.getInterviews();
expect(interviews).not.toEqual(null);
});
});
33 changes: 33 additions & 0 deletions packages/docassemble/src/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { DocassembleInterview } from './types';

export const createDocassembleInterview = (interviewId: string) => {};

export type DocassembleClientContext = {
apiUrl: string;
apiKey: string;
};

export class DocassembleClient {
constructor(private ctx: DocassembleClientContext) {}

getInterviews = () => {
return fetch(`${this.ctx.apiUrl}/api/interviews`, {
headers: {
'X-API-Key': this.ctx.apiKey,
},
})
.then(response => response.json())
.then(data => {
return {
ok: true,
interviews: data.items as DocassembleInterview[],
};
})
.catch(error => {
return {
ok: false,
error: error.message,
};
});
};
}
5 changes: 5 additions & 0 deletions packages/docassemble/src/context/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DocassembleClient, type DocassembleClientContext } from '../client';

export const createDocassembleClient = (ctx: DocassembleClientContext) => {
return new DocassembleClient(ctx);
};
8 changes: 8 additions & 0 deletions packages/docassemble/src/context/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createDocassembleClient } from '.';

export const createTestDocassembleClient = () => {
return createDocassembleClient({
apiUrl: 'http://localhost:8011',
apiKey: (import.meta as any).env.VITE_DOCASSEMBLE_API_KEY || '',
});
};
21 changes: 21 additions & 0 deletions packages/docassemble/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Guessing at the types here, based on the JSON returned by the API.
export type DocassembleInterview = {
email: string;
filename: string;
metadata: {
_origin_package: string;
_origin_path: string;
title: string;
};
modtime: string;
session: string;
starttime: string;
subtitle: string | null;
tags: string[];
temp_user_id: string | null;
title: string;
user_id: number;
utc_modtime: string;
utc_starttime: string | null;
valid: boolean;
};
11 changes: 11 additions & 0 deletions packages/docassemble/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"emitDeclarationOnly": true
},
"include": [
"./src"
],
"references": []
}
Loading