Skip to content

Commit

Permalink
fix: do not depend on global buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Jun 17, 2021
1 parent 7d3cd8a commit e8d8e3f
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: yarn check-format

- name: Compile
run: yarn compile
run: yarn check-types

integration-test:
runs-on: ubuntu-20.04
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"files": [
"build/src"
"build"
],
"repository": {
"url": "https://github.com/hyperledger/aries-framework-javascript",
"type": "git"
},
"scripts": {
"compile": "tsc",
"compile": "tsc --project tsconfig.build.json",
"check-types:build": "yarn compile --noEmit",
"check-types": "tsc --noEmit",
"lint": "eslint .",
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
"format": "yarn prettier --write",
"check-format": "yarn prettier --list-different",
"test": "jest --verbose",
"dev": "ts-node-dev --respawn --transpile-only ./tests/mediator.ts",
"prod:start": "node ./build/tests/mediator.js",
"prod:start-ws": "node ./build/tests/mediator-ws.js",
"prod:build": "rm -rf build && yarn compile",
"validate": "npm-run-all --parallel lint compile",
"mediator:start": "ts-node ./tests/mediator.ts",
"mediator:start-ws": "ts-node ./tests/mediator-ws.ts",
"validate": "npm-run-all --parallel lint check-types",
"prepack": "rm -rf build && yarn compile",
"release": "release-it",
"prepare": "husky install"
Expand Down
13 changes: 4 additions & 9 deletions scripts/run-mediator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [[ "$AGENT" = "mediator01" ]] || [[ "$AGENT" = "alice" ]]; then
WALLET_NAME=mediator01
WALLET_KEY=0000000000000000000000000Mediator01
PUBLIC_DID_SEED=00000000000000000000000Forward01
MEDIATOR_COMMAND="prod:start"
MEDIATOR_COMMAND="mediator:start"
elif [[ "$AGENT" = "mediator02" ]] || [[ "$AGENT" = "bob" ]]; then
AGENT_ENDPOINT="${AGENT_ENDPOINT:-http://localhost:3002}"
AGENT_HOST=http://localhost
Expand All @@ -22,7 +22,7 @@ elif [[ "$AGENT" = "mediator02" ]] || [[ "$AGENT" = "bob" ]]; then
WALLET_NAME=mediator02
WALLET_KEY=0000000000000000000000000Mediator02
PUBLIC_DID_SEED=00000000000000000000000Forward02
MEDIATOR_COMMAND="prod:start"
MEDIATOR_COMMAND="mediator:start"
elif [[ "$AGENT" = "mediator03" ]] || [[ "$AGENT" = "alice-ws" ]]; then
AGENT_ENDPOINT="${AGENT_ENDPOINT:-http://localhost:3003}"
AGENT_HOST=http://localhost
Expand All @@ -32,7 +32,7 @@ elif [[ "$AGENT" = "mediator03" ]] || [[ "$AGENT" = "alice-ws" ]]; then
WALLET_KEY=0000000000000000000000000Mediator03
PUBLIC_DID=DtWRdd6C5dN5vpcN6XRAvu
PUBLIC_DID_SEED=00000000000000000000000Forward03
MEDIATOR_COMMAND="prod:start-ws"
MEDIATOR_COMMAND="mediator:start-ws"
elif [[ "$AGENT" = "mediator04" ]] || [[ "$AGENT" = "bob-ws" ]]; then
AGENT_ENDPOINT="${AGENT_ENDPOINT:-http://localhost:3004}"
AGENT_HOST=http://localhost
Expand All @@ -42,15 +42,10 @@ elif [[ "$AGENT" = "mediator04" ]] || [[ "$AGENT" = "bob-ws" ]]; then
WALLET_KEY=0000000000000000000000000Mediator04
PUBLIC_DID=SHbU5SEwdmkQkVQ1sMwSEv
PUBLIC_DID_SEED=00000000000000000000000Forward04
MEDIATOR_COMMAND="prod:start-ws"
MEDIATOR_COMMAND="mediator:start-ws"
else
echo "Please specify which agent you want to run. Choose from 'alice', 'alice-ws', 'bob' or 'bob-ws'."
exit 1
fi

# Docker image already compiles. Not needed to do again
if [ "$RUN_MODE" != "docker" ]; then
${YARN_COMMAND} prod:build
fi

AGENT_ENDPOINT=${AGENT_ENDPOINT} AGENT_HOST=${AGENT_HOST} AGENT_PORT=${AGENT_PORT} AGENT_LABEL=${AGENT_LABEL} WALLET_NAME=${WALLET_NAME} WALLET_KEY=${WALLET_KEY} PUBLIC_DID=${PUBLIC_DID} PUBLIC_DID_SEED=${PUBLIC_DID_SEED} ${YARN_COMMAND} ${MEDIATOR_COMMAND}
1 change: 1 addition & 0 deletions src/modules/credentials/__tests__/StubWallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import type { PackedMessage, UnpackedMessageContext } from '../../../types'
import type { Buffer } from '../../../utils/buffer'
import type { Wallet } from '../../../wallet/Wallet'
import type { DidConfig, WalletRecordOptions, WalletRecord, WalletQuery, LedgerRequest } from 'indy-sdk'

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/utils/__tests__/BufferEncoder.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BufferEncoder } from '../BufferEncoder'
import { Buffer } from '../buffer'

describe('BufferEncoder', () => {
const mockCredentialRequestBuffer = Buffer.from(
Expand Down
1 change: 1 addition & 0 deletions src/utils/__tests__/JsonEncoder.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { JsonEncoder } from '../JsonEncoder'
import { Buffer } from '../buffer'

describe('JsonEncoder', () => {
const mockCredentialRequest = {
Expand Down
1 change: 1 addition & 0 deletions src/wallet/IndyWallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Logger } from '../logger'
import type { PackedMessage, UnpackedMessageContext } from '../types'
import type { Buffer } from '../utils/buffer'
import type { Wallet, DidInfo } from './Wallet'
import type {
default as Indy,
Expand Down
1 change: 1 addition & 0 deletions src/wallet/Wallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { PackedMessage, UnpackedMessageContext } from '../types'
import type { Buffer } from '../utils/buffer'
import type {
DidConfig,
Did,
Expand Down
26 changes: 26 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"lib": [],
"declaration": true,
"sourceMap": true,
"outDir": "./build",
"strict": true,
"resolveJsonModule": true,
"types": [],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["./src"],
"exclude": [
"**/*.test.ts",
"**/__tests__/**",
"**/__mocks__/**",
"node_modules",
"**/node_modules",
"**/node_modules/**"
]
}
19 changes: 5 additions & 14 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"lib": [],
"declaration": true,
"sourceMap": true,
"outDir": "./build",
"strict": true,
"typeRoots": ["node_modules/@types", "./types"],
"types": ["jest"],
"esModuleInterop": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
"types": ["jest"]
},
"include": ["src", "types", "tests", "*.config.js"],
"exclude": ["node_modules", "build", "**/node_modules", "**/node_modules/**"]
}
1 change: 0 additions & 1 deletion types/util-inspect.d.ts

This file was deleted.

0 comments on commit e8d8e3f

Please sign in to comment.