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

feat(rest)!: update to AFJ 0.2.0 #148

Merged
merged 99 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
94d7967
chore: release @aries-framework/rest 0.8.0
github-actions[bot] Feb 26, 2022
a7f7977
build(deps): bump urijs from 1.19.7 to 1.19.8 (#98)
dependabot[bot] Feb 27, 2022
f907053
feat(rest): added multi use param to create invitation (#100)
janrtvld Mar 8, 2022
e96b6ef
build: bump feature as patch (#102)
TimoGlastra Mar 9, 2022
38d0327
build(deps): bump urijs from 1.19.8 to 1.19.10 (#103)
dependabot[bot] Mar 9, 2022
e56e3c5
feat(rest): improved class validation (#108)
janrtvld Apr 14, 2022
a53d627
fix(push-notifications): add @id to messages
TimoGlastra Apr 14, 2022
da7521e
fix(rest): ledger not found error
TimoGlastra Apr 14, 2022
46b4bd3
test(rest): use local ledger instead of bcovrin
TimoGlastra Apr 14, 2022
407c4aa
build(deps): bump minimist from 1.2.5 to 1.2.6 (#106)
dependabot[bot] Apr 14, 2022
02be219
chore: release @aries-framework/push-notifications 0.2.1 (#112)
github-actions[bot] Apr 14, 2022
fa70ab5
refactor(rest): switched to tsyringe for dependency injection (#109)
janrtvld Apr 28, 2022
fae9b45
build(deps): bump urijs from 1.19.10 to 1.19.11 (#110)
dependabot[bot] Apr 28, 2022
8f8f798
feat(pn)!: more services (#115)
berendsliedrecht May 27, 2022
479a64f
chore: release @aries-framework/push-notifications 0.3.0
github-actions[bot] May 27, 2022
eb5e492
fix(rest): changed webhook event topic to type (#117)
janrtvld Jun 10, 2022
2759ecd
fix(react-hooks): update providers on delete events (#113)
Przytua Jun 9, 2022
6c32ef3
Upgrades AFJ to latest 0.2.0. Fix credential endpoints type errors
amanji Jun 13, 2022
afa1151
Align credential endpoint parameters with AFJ 0.2.0 credential module…
amanji Jun 13, 2022
531e5c0
Fix types in credential tests
amanji Jun 14, 2022
2162cc4
Update connection controller, tests and remove unused schemas
amanji Jun 14, 2022
36784b6
Remove unused credential controller schemas
amanji Jun 14, 2022
d62a2f2
Update basic message controller tests and remove unused schemas
amanji Jun 14, 2022
1c51dd4
Update webhooks controller tests
amanji Jun 15, 2022
c414fa1
Update cred def and schema controllers
amanji Jun 15, 2022
017768f
Update credential controller tests
amanji Jun 15, 2022
80d7a3f
Remove unused schemas
amanji Jun 15, 2022
b78ad78
Update remaining tests
amanji Jun 15, 2022
5b66a48
feat(push-notifications)!: update to afj 0.2.0 (#126)
TimoGlastra Jun 20, 2022
d510523
Skip failing tests until they can be fixed
amanji Jun 21, 2022
67ce5e9
Update AFJ to latest stable
amanji Jun 27, 2022
b3d32b4
Fix validation errrors and failing tests
amanji Jun 27, 2022
6df8a3d
feat: started tsoa implementation
janrtvld Jun 17, 2022
621b80c
fix: added multer
janrtvld Jun 17, 2022
af22546
fix: routes
janrtvld Jun 17, 2022
8306022
fix: cleanup
janrtvld Jun 23, 2022
504d14b
feat: tsoa controllers
janrtvld Jun 23, 2022
5227bee
chore: yarn.lock
janrtvld Jun 23, 2022
f9850c5
fix: removed unused imports
janrtvld Jun 23, 2022
d10437d
refactor:fixed some tests
janrtvld Jun 24, 2022
329b1b5
test: fixed tests
janrtvld Jun 27, 2022
0a1de45
fix: cleanup
janrtvld Jun 27, 2022
2a7adbc
refactor: moved files to src utils and cleanup
janrtvld Jun 27, 2022
e6ecb73
fix: typo
janrtvld Jun 27, 2022
ff46514
test: changed connection tests to use mocks
janrtvld Jun 27, 2022
cd50b78
feat: added examples
janrtvld Jun 27, 2022
bc1857a
fix: credential protocol fix
janrtvld Jun 28, 2022
8e29137
ci: run on afj next branches (#118)
TimoGlastra Jun 10, 2022
ff314b9
chore(push-notifications): use stable afj release
TimoGlastra Jun 28, 2022
a7a26c2
fix(push-notifications): validation method
TimoGlastra Jun 28, 2022
f0cac4b
build(deps): bump got from 11.8.3 to 11.8.5 (#127)
dependabot[bot] Jun 28, 2022
fa9028f
chore: release @aries-framework/rest 0.8.1 (#104)
github-actions[bot] Jun 28, 2022
d2917b4
chore: release @aries-framework/push-notifications 0.4.0 (#131)
github-actions[bot] Jun 28, 2022
ddae07f
chore: nohoist afj dependencies (#134)
TimoGlastra Jul 4, 2022
4214b54
feat(redux-store)!: update to afj 0.2.0 (#133)
TimoGlastra Jul 4, 2022
a24c5d1
chore: release @aries-framework/redux-store 0.3.0
github-actions[bot] Jul 4, 2022
f605cc8
fix(redux-store): update store listener type (#137)
TimoGlastra Jul 14, 2022
5e71843
refactor(react-hooks)!: update AFJ to stable 0.2.0 (#136)
amanji Jul 14, 2022
36254dc
refactor(react-hooks): records utils (#139)
amanji Jul 14, 2022
9052628
chore: release @aries-framework/react-hooks 0.3.0 (#132)
github-actions[bot] Jul 15, 2022
f0e2815
chore: release @aries-framework/redux-store 0.3.1 (#138)
github-actions[bot] Jul 15, 2022
73d7b54
fix(redux-store): tests and proper record update (#140)
berendsliedrecht Jul 22, 2022
7649a1f
chore: release @aries-framework/redux-store 0.3.2 (#141)
github-actions[bot] Jul 22, 2022
31f8b93
Add swagegr.json update
amanji Aug 2, 2022
8640617
chore: add maintainers.md file (#144)
TimoGlastra Aug 9, 2022
4583ba8
feat: oob controller
janrtvld Aug 18, 2022
d25b543
feat: out of band tests
janrtvld Aug 19, 2022
b18256b
tests: oob tests
janrtvld Aug 23, 2022
2873948
fix: tests
janrtvld Aug 23, 2022
204b0f1
fix: minor improvements
janrtvld Aug 24, 2022
bad245c
fix: changes
janrtvld Aug 24, 2022
ae3a61f
feat: bad request error
janrtvld Aug 26, 2022
60ae9d7
fix: tests
janrtvld Aug 23, 2022
0b152fb
Merge remote-tracking branch 'upstream/main' into feat/controllers
janrtvld Aug 26, 2022
c0375cc
fix: revert hooks
janrtvld Aug 26, 2022
8c65c2b
feat: schema improvements
janrtvld Aug 30, 2022
39e077e
fix: removed unused dep
janrtvld Aug 30, 2022
d6af0fd
chore(deps): removed class-transformer and class-validator
janrtvld Aug 30, 2022
be23504
chore(tests): runinband for debugging
janrtvld Aug 30, 2022
c7a9d6b
test: removed all functions
janrtvld Sep 1, 2022
58cb00f
chore: yarn.lock
janrtvld Sep 1, 2022
94dffdb
ci: removed runinband
janrtvld Sep 1, 2022
9beb5bd
chore: removed test commits
janrtvld Sep 1, 2022
5f9cbe7
chore: yarn.lock
janrtvld Sep 1, 2022
9f3dc93
chore: yarn.lock
janrtvld Sep 1, 2022
dab11e6
chore: yarn.lock
janrtvld Sep 1, 2022
6c09ba6
chore: yarn.lock
janrtvld Sep 1, 2022
0600ade
chore: yarn.lock
janrtvld Sep 1, 2022
9776df9
Merge branch 'main' into feat/controllers
TimoGlastra Sep 1, 2022
7b78dc1
refactor: added credentialrecord to routes
janrtvld Sep 1, 2022
45b2913
Merge branch 'feat/controllers' of https://github.com/janrtvld/aries-…
janrtvld Sep 1, 2022
5289b79
fix: moved file
janrtvld Sep 1, 2022
67d74e4
fix: yarn.lock
janrtvld Sep 1, 2022
8b75a66
refactor: removed some props from endpoint input
janrtvld Sep 2, 2022
a218aec
fix: ci
janrtvld Sep 2, 2022
6b3e64e
fix: ci
janrtvld Sep 2, 2022
a533510
fix: ci
janrtvld Sep 2, 2022
f26f848
fix: improvements
janrtvld Sep 2, 2022
e70aa01
fix: tests
janrtvld Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,17 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Run tests
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test --coverage
- name: Run tests for Push notifications
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test push-notifications --coverage

- name: Run tests for React hooks
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test react-hooks --coverage

- name: Run tests for Redux store
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test redux-store --coverage

- name: Run tests for Rest
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test rest --coverage

- uses: codecov/codecov-action@v1
if: always()
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ build
.vscode
.idea
coverage
CHANGELOG.md
CHANGELOG.md
routes
22 changes: 12 additions & 10 deletions packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,36 @@
"afj-rest": "bin/afj-rest.js"
},
"scripts": {
"dev": "tsnd --respawn samples/sampleWithApp.ts",
"tsoa": "tsoa spec-and-routes",
"dev": "tsoa spec-and-routes && tsnd --respawn samples/sampleWithApp.ts",
"build": "yarn run clean && yarn run compile",
"clean": "rimraf -rf ./build",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
"test": "jest"
"test": "jest",
"postinstall": "tsoa spec-and-routes"
},
"dependencies": {
"@aries-framework/core": "^0.1.0",
"@aries-framework/node": "^0.1.0",
"class-transformer": "0.5.1",
"class-validator": "0.13.1",
"class-validator-jsonschema": "^3.1.1",
"@aries-framework/core": "^0.2.3",
"@aries-framework/node": "^0.2.3",
"body-parser": "^1.20.0",
"cors": "^2.8.5",
"express": "^4.18.1",
"node-fetch": "^2.6.7",
"reflect-metadata": "^0.1.13",
"routing-controllers": "^0.9.0",
"routing-controllers-openapi": "^3.1.0",
"swagger-ui-express": "^4.4.0",
"tslog": "^3.3.3",
"tsoa": "^4.1.2",
"tsyringe": "^4.7.0",
"yargs": "^17.3.1"
},
"devDependencies": {
"@types/body-parser": "^1.19.2",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/jest": "^27.0.3",
"@types/node": "^17.0.41",
"@types/multer": "^1.4.7",
"@types/node": "^16.7.10",
"@types/supertest": "^2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@types/uuid": "^8.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/samples/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ServerConfig } from '../src/utils/ServerConfig'
import { connect } from 'ngrok'

import { startServer } from '../src/index'
import { setupAgent } from '../tests/utils/agent'
import { setupAgent } from '../src/utils/agent'

const run = async () => {
const endpoint = await connect(3001)
Expand Down
20 changes: 12 additions & 8 deletions packages/rest/samples/sampleWithApp.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import type { ServerConfig } from '../src/utils/ServerConfig'
import type { Express } from 'express'

import { AgentConfig } from '@aries-framework/core'
import bodyParser from 'body-parser'
import express from 'express'
import { connect } from 'ngrok'
import { createExpressServer } from 'routing-controllers'

import { startServer } from '../src/index'
import { setupAgent } from '../tests/utils/agent'

import { GreetingController } from './utils/GreetingController'
import { setupAgent } from '../src/utils/agent'

const run = async () => {
const endpoint = await connect(3001)
Expand All @@ -19,14 +18,19 @@ const run = async () => {
name: 'Aries Test Agent',
})

const app: Express = createExpressServer({
controllers: [GreetingController],
const app = express()
const jsonParser = bodyParser.json()

app.post('/greeting', jsonParser, (req, res) => {
const config = agent.injectionContainer.resolve(AgentConfig)

res.send(`Hello, ${config.label}!`)
})

const conf: ServerConfig = {
port: 3000,
app: app,
webhookUrl: 'http://localhost:5000/agent-events',
app: app,
}

await startServer(agent, conf)
Expand Down
23 changes: 0 additions & 23 deletions packages/rest/samples/utils/GreetingController.ts

This file was deleted.

12 changes: 8 additions & 4 deletions packages/rest/src/controllers/agent/AgentController.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import type { AgentInfo } from '../types'

import { Agent } from '@aries-framework/core'
import { Get, JsonController } from 'routing-controllers'
import { Controller, Get, Route, Tags } from 'tsoa'
import { injectable } from 'tsyringe'

@JsonController('/agent')
@Tags('Agent')
@Route('/agent')
@injectable()
export class AgentController {
export class AgentController extends Controller {
private agent: Agent

public constructor(agent: Agent) {
super()
this.agent = agent
}

/**
* Retrieve basic agent information
*/
@Get('/')
public async getAgentInfo() {
public async getAgentInfo(): Promise<AgentInfo> {
return {
label: this.agent.config.label,
endpoints: this.agent.config.endpoints,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
import type { BasicMessageRecord, BasicMessageStorageProps } from '@aries-framework/core'

import { Agent, RecordNotFoundError } from '@aries-framework/core'
import {
Body,
Get,
InternalServerError,
JsonController,
NotFoundError,
OnUndefined,
Param,
Post,
} from 'routing-controllers'
import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse } from 'tsoa'
import { injectable } from 'tsyringe'

import { BasicMessageRequest } from '../../schemas/BasicMessageRequest'
import { BasicMessageRecordExample, RecordId } from '../examples'

@JsonController('/basic-messages')
@Tags('Basic Messages')
@Route('/basic-messages')
@injectable()
export class BasicMessageController {
export class BasicMessageController extends Controller {
private agent: Agent

public constructor(agent: Agent) {
super()
this.agent = agent
}

/**
* Retrieve basic messages by connectionId
* Retrieve basic messages by connection id
*
* @param connectionId Connection identifier
* @returns BasicMessageRecord[]
*/
@Example<BasicMessageStorageProps[]>([BasicMessageRecordExample])
@Get('/:connectionId')
public async getBasicMessages(@Param('connectionId') connectionId: string) {
const basicMessages = await this.agent.basicMessages.findAllByQuery({ connectionId: connectionId })
return basicMessages.map((m) => m.toJSON())
public async getBasicMessages(@Path('connectionId') connectionId: RecordId): Promise<BasicMessageRecord[]> {
return await this.agent.basicMessages.findAllByQuery({ connectionId })
}

/**
* Send a basic message to a connection
*
* @param connectionId Connection identifier
* @param content The content of the message
*/
@Post('/:connectionId')
@OnUndefined(204)
public async sendMessage(
@Param('connectionId') connectionId: string,
@Body()
basicMessage: BasicMessageRequest
@Path('connectionId') connectionId: RecordId,
@Body() request: Record<'content', string>,
@Res() notFoundError: TsoaResponse<404, { reason: string }>,
@Res() internalServerError: TsoaResponse<500, { message: string }>
) {
try {
await this.agent.basicMessages.sendMessage(connectionId, basicMessage.content)
this.setStatus(204)
await this.agent.basicMessages.sendMessage(connectionId, request.content)
} catch (error) {
if (error instanceof RecordNotFoundError) {
throw new NotFoundError(`connection with connectionId "${connectionId}" not found.`)
return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` })
}
throw new InternalServerError(`something went wrong: ${error}`)
return internalServerError(500, { message: `something went wrong: ${error}` })
}
}
}