diff --git a/package-lock.json b/package-lock.json index 3c6a55b..2114ab0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10171,15 +10171,16 @@ } }, "ipfs-http-client": { - "version": "30.1.1", - "resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-30.1.1.tgz", - "integrity": "sha512-tMqSwEhW57VnjHDBLjKKlgtAvlhkqVSR3oIFC0IiGnaM1nzcw7pbFBoHaFzl0PKIuXm40a5bJt85Rm2trYx+Ag==", + "version": "30.1.3", + "resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-30.1.3.tgz", + "integrity": "sha512-NQ7WTLKUZeoKaKXrTSLAtjASRYCR0bPdsolZf16Y7Gt7o3RfiPpFF+AqvP0xbekOV3/zhFj2Qyf6ShEV4CCtsQ==", "dev": true, "requires": { "async": "^2.6.1", "bignumber.js": "^8.0.2", "bl": "^3.0.0", "bs58": "^4.0.1", + "buffer": "^5.2.1", "cids": "~0.5.5", "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", "debug": "^4.1.0", @@ -10194,7 +10195,7 @@ "is-ipfs": "~0.6.0", "is-pull-stream": "0.0.0", "is-stream": "^1.1.0", - "iso-stream-http": "~0.1.1", + "iso-stream-http": "~0.1.2", "iso-url": "~0.4.6", "just-kebab-case": "^1.1.0", "just-map-keys": "^1.1.0", @@ -10219,6 +10220,16 @@ "through2": "^3.0.1" }, "dependencies": { + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, "concat-stream": { "version": "github:hugomrdias/concat-stream#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034", "from": "github:hugomrdias/concat-stream#feat/smaller", @@ -10891,25 +10902,36 @@ } }, "kosmos-schemas": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/kosmos-schemas/-/kosmos-schemas-1.1.2.tgz", - "integrity": "sha1-BTva6wQysoBudXA588l090+Bo54=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kosmos-schemas/-/kosmos-schemas-2.0.0.tgz", + "integrity": "sha512-zIjWcDxaN94m1vPgUaI5LRX6y07Ihw9ScPoGKf1NkZ0sLgD/CRV8YIKRyDafH5mThe3uBN2+F6H6Gp5qhNhALg==", "dev": true, "requires": { "brfs-babel": "^1.0.0" } }, "kredits-contracts": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-4.0.2.tgz", - "integrity": "sha512-AXIzr4U1YOL4p8GwVOoXvBXhzXbZLSQ4QCsCUQDBPQpMYkZA2zdpPK0AYBip9l8KmKjfqgbvIKgyE/BpNG5AlA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.1.1.tgz", + "integrity": "sha512-hEM/ZOcoYejOix8LMG/mMVQVoD/9q18yjQTXeQwuX2x/APP95CH8HK/UsPIqxXtMP1L3XklWnMuqTVbYUc5UYg==", "dev": true, "requires": { "ethers": "^4.0.27", "ipfs-http-client": "^30.1.1", - "rsvp": "^4.8.2" + "kosmos-schemas": "^2.0.0", + "rsvp": "^4.8.2", + "tv4": "^1.3.0" }, "dependencies": { + "kosmos-schemas": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kosmos-schemas/-/kosmos-schemas-2.0.0.tgz", + "integrity": "sha512-zIjWcDxaN94m1vPgUaI5LRX6y07Ihw9ScPoGKf1NkZ0sLgD/CRV8YIKRyDafH5mThe3uBN2+F6H6Gp5qhNhALg==", + "dev": true, + "requires": { + "brfs-babel": "^1.0.0" + } + }, "rsvp": { "version": "4.8.4", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.4.tgz", diff --git a/package.json b/package.json index 0dcce74..695e1da 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "ember-truth-helpers": "github:jmurphyau/ember-truth-helpers#31a14373a31f1f82c77537720549b47a95c28e5f", "eslint-plugin-ember": "^5.2.0", "ethers": "^4.0.27", - "kosmos-schemas": "^1.1.2", - "kredits-contracts": "4.x", + "kosmos-schemas": "^2.0.0", + "kredits-contracts": "^5.1.1", "loader.js": "^4.7.0", "qunit-dom": "^0.8.0", "tv4": "^1.3.0" diff --git a/tests/unit/lib/kredits/serializers/contribution-test.js b/tests/unit/lib/kredits/serializers/contribution-test.js deleted file mode 100644 index 8761a99..0000000 --- a/tests/unit/lib/kredits/serializers/contribution-test.js +++ /dev/null @@ -1,42 +0,0 @@ -import { module, test } from 'qunit'; -import schemas from 'npm:kosmos-schemas'; -import tv4 from 'npm:tv4'; -import ContributionSerializer from 'npm:kredits-contracts/lib/serializers/contribution'; - -module('Serializers contribution', function() { - test('#serialize returns a valid JSON-LD representation', function(assert) { - let serialized = ContributionSerializer.serialize({ - kind: 'design', - description: 'New logo design', - url: 'http://opensourcedesign.org', - contributorIpfsHash: 'QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE' - }); - - let valid = tv4.validate(JSON.parse(serialized), schemas['contribution']); - assert.ok(valid); - }); - - test('#deserialize returns a valid object representation', function(assert) { - let json = JSON.stringify({ - "@context": "https://schema.kosmos.org", - "@type": "Contribution", - "contributor": { - "ipfs": "QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE" - }, - "kind": "design", - "description": "New logo design", - "details": {}, - "url": "http://opensourcedesign.org" - }); - let deserialized = ContributionSerializer.deserialize(json); - - let expected = { - kind: 'design', - description: 'New logo design', - details: {}, - url: 'http://opensourcedesign.org', - ipfsData: json, - }; - assert.deepEqual(expected, deserialized); - }); -}); diff --git a/tests/unit/lib/kredits/serializers/contributor-test.js b/tests/unit/lib/kredits/serializers/contributor-test.js deleted file mode 100644 index f7d1d94..0000000 --- a/tests/unit/lib/kredits/serializers/contributor-test.js +++ /dev/null @@ -1,66 +0,0 @@ -import { module, test } from 'qunit'; -import schemas from 'npm:kosmos-schemas'; -import tv4 from 'npm:tv4'; -import ContributorSerializer from 'npm:kredits-contracts/lib/serializers/contributor'; - -module('Serializers contributor', function() { - test('#serialize returns a valid JSON-LD representation', function(assert) { - let serialized = ContributorSerializer.serialize({ - name: 'Satoshi Nakamoto', - kind: 'person', - github_uid: 123, - github_username: 'therealsatoshi', - wiki_username: 'Satoshi', - }); - - let valid = tv4.validate(JSON.parse(serialized), schemas['contributor']); - assert.ok(valid); - }); - - test('#deserialize returns a valid object representation', function(assert) { - let json = JSON.stringify({ - "@context": "https://schema.kosmos.org", - "@type": "Contributor", - "kind": "person", - "name": "Satoshi Nakamoto", - "accounts": [ - { - "site": "github.com", - "uid": 123, - "username": "therealsatoshi", - "url": "https://github.com/therealsatoshi" - }, - { - "site": "wiki.kosmos.org", - "username": "Satoshi", - "url": "https://wiki.kosmos.org/User:Satoshi" - } - ] - }); - let deserialized = ContributorSerializer.deserialize(json); - - let expected = { - name: 'Satoshi Nakamoto', - kind: 'person', - accounts: [ - { - "site": "github.com", - "uid": 123, - "url": "https://github.com/therealsatoshi", - "username": "therealsatoshi" - }, - { - "site": "wiki.kosmos.org", - "url": "https://wiki.kosmos.org/User:Satoshi", - "username": "Satoshi" - } - ], - github_uid: 123, - github_username: 'therealsatoshi', - wiki_username: 'Satoshi', - url: undefined, - ipfsData: json, - }; - assert.deepEqual(expected, deserialized); - }); -});