Skip to content

Commit

Permalink
feat: Using EventEmitter instead of pubsub-js
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Dec 5, 2019
1 parent da0ae7f commit 5d50acf
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 151 deletions.
2 changes: 1 addition & 1 deletion examples/expressjs-ethr/src/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function main() {
})
})

core.on(Daf.EventTypes.validatedMessage, async (eventType: string, message: Daf.Types.ValidatedMessage) => {
core.on(Daf.EventTypes.validatedMessage, async (message: Daf.Types.ValidatedMessage, b: any) => {
debug('New message %s', message.hash)
debug('Meta %O', message.meta)
console.log(message)
Expand Down
68 changes: 34 additions & 34 deletions examples/expressjs-ethr/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -586,65 +586,65 @@ cross-fetch@^3.0.4:
node-fetch "2.6.0"
whatwg-fetch "3.0.0"

daf-core@../../packages/daf-core, daf-core@^0.7.0:
version "0.7.0"
daf-core@../../packages/daf-core, daf-core@^0.8.0:
version "0.8.0"
dependencies:
blakejs "^1.1.0"
debug "^4.1.1"
pubsub-js "^1.7.0"
events "^3.0.0"

daf-data-store@../../packages/daf-data-store, daf-data-store@^0.7.5:
version "0.7.5"
daf-data-store@../../packages/daf-data-store, daf-data-store@^0.8.0:
version "0.8.0"
dependencies:
blakejs "^1.1.0"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
sql-bricks-sqlite "^0.1.0"

daf-debug@../../packages/daf-debug:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"

daf-did-comm@../../packages/daf-did-comm:
version "0.7.0"
version "0.8.0"
dependencies:
DIDComm-js "git://github.com/uport-project/DIDComm-js.git#fix/build-issues"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
uuid "^3.3.3"

daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^0.7.0:
version "0.7.0"
daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^0.8.0:
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"
did-resolver "^1.1.0"

daf-ethr-did-fs@../../packages/daf-ethr-did-fs:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
ethr-did "^1.1.0"

daf-node-sqlite3@../../packages/daf-node-sqlite3:
version "0.7.5"
version "0.8.0"
dependencies:
daf-data-store "^0.7.5"
daf-data-store "^0.8.0"
debug "^4.1.1"
sqlite3 "^4.1.0"

daf-resolver-universal@../../packages/daf-resolver-universal:
version "0.7.0"
version "0.8.0"
dependencies:
cross-fetch "^3.0.4"
debug "^4.1.1"

daf-resolver@../../packages/daf-resolver:
version "0.7.0"
version "0.8.0"
dependencies:
debug "^4.1.1"
did-resolver "^1.1.0"
Expand All @@ -653,22 +653,22 @@ daf-resolver@../../packages/daf-resolver:
web-did-resolver "^1.2.0"

daf-selective-disclosure@../../packages/daf-selective-disclosure:
version "0.7.4"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-did-jwt "^0.7.0"
daf-core "^0.8.0"
daf-did-jwt "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"

daf-sodium-fs@../../packages/daf-sodium-fs:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
libsodium-wrappers "^0.7.6"

daf-trust-graph@../../packages/daf-trust-graph:
version "0.7.8"
version "0.8.0"
dependencies:
apollo-cache-inmemory "^1.6.3"
apollo-client "^2.6.4"
Expand All @@ -677,18 +677,18 @@ daf-trust-graph@../../packages/daf-trust-graph:
apollo-link-ws "^1.0.19"
apollo-utilities "^1.3.2"
cross-fetch "^3.0.4"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"
graphql "^14.0.0"
graphql-tag "^2.10.1"
subscriptions-transport-ws "^0.9.0"

daf-w3c@../../packages/daf-w3c:
version "0.7.5"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-did-jwt "^0.7.0"
daf-core "^0.8.0"
daf-did-jwt "^0.8.0"
debug "^4.1.1"
did-jwt-vc "^0.1.2"
did-resolver "^1.1.0"
Expand Down Expand Up @@ -1048,6 +1048,11 @@ eventemitter3@^3.1.0:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==

events@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88"
integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==

express-handlebars@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/express-handlebars/-/express-handlebars-3.1.0.tgz#c177ee9a81f6a2abada6b550b77b3e30c6bc0796"
Expand Down Expand Up @@ -1925,11 +1930,6 @@ psl@^1.1.24:
resolved "https://registry.yarnpkg.com/psl/-/psl-1.5.0.tgz#47fd1292def7fdb1e138cd78afa8814cebcf7b13"
integrity sha512-4vqUjKi2huMu1OJiLhi3jN6jeeKvMZdI1tYgi/njW5zV52jNLgSAZSdN16m9bJFe61/cT8ulmw4qFitV9QRsEA==

pubsub-js@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/pubsub-js/-/pubsub-js-1.7.0.tgz#eca97f9a4217bef62b2d3aaa1552005260cc2e49"
integrity sha512-Pb68P9qFZxnvDipHMuj9oT1FoIgBcXJ9C9eWdHCLZAnulaUoJ3+Y87RhGMYilWpun6DMWVmvK70T4RP4drZMSA==

punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
Expand Down
2 changes: 1 addition & 1 deletion examples/expressjs/src/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function main() {
})
})

core.on(Daf.EventTypes.validatedMessage, async (eventType: string, message: Daf.Types.ValidatedMessage) => {
core.on(Daf.EventTypes.validatedMessage, async (message: Daf.Types.ValidatedMessage) => {
debug('New message %s', message.hash)
debug('Meta %O', message.meta)
console.log(message)
Expand Down
78 changes: 34 additions & 44 deletions examples/expressjs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -631,75 +631,65 @@ cross-fetch@^3.0.4:
node-fetch "2.6.0"
whatwg-fetch "3.0.0"

daf-core@../../packages/daf-core, daf-core@^0.7.0:
version "0.7.0"
dependencies:
blakejs "^1.1.0"
debug "^4.1.1"
pubsub-js "^1.7.0"

daf-data-store@../../packages/daf-data-store:
version "0.7.3"
daf-core@../../packages/daf-core, daf-core@^0.8.0:
version "0.8.0"
dependencies:
blakejs "^1.1.0"
daf-core "^0.7.0"
debug "^4.1.1"
sql-bricks-sqlite "^0.1.0"
events "^3.0.0"

daf-data-store@^0.7.3:
version "0.7.5"
resolved "https://registry.yarnpkg.com/daf-data-store/-/daf-data-store-0.7.5.tgz#66461bf3af007d18171fab3f8d3bcab2162fa1a5"
integrity sha512-ipqT/WRMpwVMiHkexsMbeniISJcBcfbI3I2fY22l1dXQ0Q2s/BYgPlZjtL41zgqbA8+0hjWzIfLvSSr5zIMrxg==
daf-data-store@../../packages/daf-data-store, daf-data-store@^0.8.0:
version "0.8.0"
dependencies:
blakejs "^1.1.0"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
sql-bricks-sqlite "^0.1.0"

daf-debug@../../packages/daf-debug:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"

daf-did-comm@../../packages/daf-did-comm:
version "0.7.0"
version "0.8.0"
dependencies:
DIDComm-js "git://github.com/uport-project/DIDComm-js.git#fix/build-issues"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
uuid "^3.3.3"

daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^0.7.0:
version "0.7.0"
daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^0.8.0:
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"
did-resolver "^1.1.0"

daf-ethr-did-fs@../../packages/daf-ethr-did-fs:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
ethr-did "^1.1.0"

daf-node-sqlite3@../../packages/daf-node-sqlite3:
version "0.7.3"
version "0.8.0"
dependencies:
daf-data-store "^0.7.3"
daf-data-store "^0.8.0"
debug "^4.1.1"
sqlite3 "^4.1.0"

daf-resolver-universal@../../packages/daf-resolver-universal:
version "0.7.0"
version "0.8.0"
dependencies:
cross-fetch "^3.0.4"
debug "^4.1.1"

daf-resolver@../../packages/daf-resolver:
version "0.7.0"
version "0.8.0"
dependencies:
debug "^4.1.1"
did-resolver "^1.1.0"
Expand All @@ -708,22 +698,22 @@ daf-resolver@../../packages/daf-resolver:
web-did-resolver "^1.2.0"

daf-selective-disclosure@../../packages/daf-selective-disclosure:
version "0.7.4"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-did-jwt "^0.7.0"
daf-core "^0.8.0"
daf-did-jwt "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"

daf-sodium-fs@../../packages/daf-sodium-fs:
version "0.7.0"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
libsodium-wrappers "^0.7.6"

daf-trust-graph@../../packages/daf-trust-graph:
version "0.7.4"
version "0.8.0"
dependencies:
apollo-cache-inmemory "^1.6.3"
apollo-client "^2.6.4"
Expand All @@ -732,18 +722,18 @@ daf-trust-graph@../../packages/daf-trust-graph:
apollo-link-ws "^1.0.19"
apollo-utilities "^1.3.2"
cross-fetch "^3.0.4"
daf-core "^0.7.0"
daf-core "^0.8.0"
debug "^4.1.1"
did-jwt "^3.0.0"
graphql "^14.0.0"
graphql-tag "^2.10.1"
subscriptions-transport-ws "^0.9.0"

daf-w3c@../../packages/daf-w3c:
version "0.7.2"
version "0.8.0"
dependencies:
daf-core "^0.7.0"
daf-did-jwt "^0.7.0"
daf-core "^0.8.0"
daf-did-jwt "^0.8.0"
debug "^4.1.1"
did-jwt-vc "^0.1.2"
did-resolver "^1.1.0"
Expand Down Expand Up @@ -1116,6 +1106,11 @@ eventemitter3@^3.1.0:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==

events@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88"
integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==

express-handlebars@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/express-handlebars/-/express-handlebars-3.1.0.tgz#c177ee9a81f6a2abada6b550b77b3e30c6bc0796"
Expand Down Expand Up @@ -2043,11 +2038,6 @@ psl@^1.1.24, psl@^1.1.28:
resolved "https://registry.yarnpkg.com/psl/-/psl-1.5.0.tgz#47fd1292def7fdb1e138cd78afa8814cebcf7b13"
integrity sha512-4vqUjKi2huMu1OJiLhi3jN6jeeKvMZdI1tYgi/njW5zV52jNLgSAZSdN16m9bJFe61/cT8ulmw4qFitV9QRsEA==

pubsub-js@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/pubsub-js/-/pubsub-js-1.7.0.tgz#eca97f9a4217bef62b2d3aaa1552005260cc2e49"
integrity sha512-Pb68P9qFZxnvDipHMuj9oT1FoIgBcXJ9C9eWdHCLZAnulaUoJ3+Y87RhGMYilWpun6DMWVmvK70T4RP4drZMSA==

punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
Expand Down
2 changes: 1 addition & 1 deletion packages/daf-cli/src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ program
export const listen = async (pollSeconds?: number) => {
await dataStore.initialize()

core.on(EventTypes.validatedMessage, async (type, msg: Types.ValidatedMessage) => {
core.on(EventTypes.validatedMessage, async (msg: Types.ValidatedMessage) => {
console.log('New message type:', msg.type)
})

Expand Down
Loading

0 comments on commit 5d50acf

Please sign in to comment.