From 6d6f791e085eb7d944b91d5bd6635ee24bb34163 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 13 Feb 2019 20:41:59 +0100 Subject: [PATCH 01/11] metadata fixes --- src/models/AssetModel.ts | 11 ++++++++++- src/routes/Publish/index.tsx | 7 ++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/models/AssetModel.ts b/src/models/AssetModel.ts index 553a5ef..b8413b6 100644 --- a/src/models/AssetModel.ts +++ b/src/models/AssetModel.ts @@ -17,7 +17,16 @@ const AssetModel = { compression: null, contentType: null, workExample: null, - contentUrls: [], + files: [ + { + url: null, + checksum: null, + checksumType: null, + contentLength: null, + resourceId: null + } + ], + categories: [], links: [ { name: null, diff --git a/src/routes/Publish/index.tsx b/src/routes/Publish/index.tsx index cee2dd1..8f7f257 100644 --- a/src/routes/Publish/index.tsx +++ b/src/routes/Publish/index.tsx @@ -118,13 +118,13 @@ class Publish extends Component<{}, PublishState> { name: '', dateCreated: new Date(), description: '', - files: [''], + files: [], price: 0, author: '', type: 'dataset' as AssetType, license: '', copyrightHolder: '', - categories: [''], + categories: [], isPublishing: false, isPublished: false }) @@ -147,9 +147,10 @@ class Publish extends Component<{}, PublishState> { author: this.state.author, license: this.state.license, copyrightHolder: this.state.copyrightHolder, - contentUrls: [this.state.files], + files: [this.state.files], price: this.state.price, type: this.state.type, + categories: [this.state.categories], size: '', encoding: '', compression: undefined, From c8479e62e50b8e4a3293f96e6b679d51ce727889 Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Thu, 14 Feb 2019 15:56:55 +0100 Subject: [PATCH 02/11] squid-js update, working publish flow --- package-lock.json | 114 ++++++++++++++++------------------------------ package.json | 2 +- src/ocean.ts | 2 +- 3 files changed, 40 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index 050c8cc..52dfb27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1022,9 +1022,9 @@ "integrity": "sha512-p2n505t2K0zD1ZvGPhI6EsSviEVLCB7BYowhf/ONmVaWED138PaG4Z9nY6YuHU383uOoIWT+Lq3dLkFzDzstXw==" }, "@oceanprotocol/keeper-contracts": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.5.3.tgz", - "integrity": "sha512-Fm1iV76d38VxKXPWdGInH5Qt/yEsiWYAeyfxVLArAalxoI5QsvNrfgiFcDcKUxX/+OY6ptnEtbowr62gdCtt4g==" + "version": "0.6.12", + "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.6.12.tgz", + "integrity": "sha512-vWs4jVAvFHZobHB64444MuQDxsNIWttt6u93wa0/NA6xMxjjoqa5V4Fv8LXDi5TW2WH3Z+2YzHoqKARe0gQBmw==" }, "@oceanprotocol/secret-store-client": { "version": "0.0.14", @@ -1035,11 +1035,11 @@ } }, "@oceanprotocol/squid": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.2.8.tgz", - "integrity": "sha512-AgV+V81nba+v9Q8hyG7LnF+jtzkbFkPqousx5+QeDj9yscIhTHSwkRGW6nhqSbwDn7IC8ajkGKsD/l4lLJtu6Q==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.3.0.tgz", + "integrity": "sha512-j0qC2VcUHNoqjdD01VYoifJlRQBAuMmDAufsZ4fQo59wN5aI+/ftwYLVlaoeIg1YWhhNx07X92Dv1PjWtWg4UA==", "requires": { - "@oceanprotocol/keeper-contracts": "^0.5.3", + "@oceanprotocol/keeper-contracts": "^0.6.12", "@oceanprotocol/secret-store-client": "~0.0.14", "@types/node-fetch": "^2.1.4", "bignumber.js": "^8.0.1", @@ -1181,9 +1181,9 @@ "integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==" }, "@types/node-fetch": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.1.4.tgz", - "integrity": "sha512-tR1ekaXUGpmzOcDXWU9BW73YfA2/VW1DF1FH+wlJ82BbCSnWTbdX+JkqWQXWKIGsFPnPsYadbXfNgz28g+ccWg==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.1.6.tgz", + "integrity": "sha512-Hv1jgh3pfpUEl2F2mqUd1AfLSk1YbUCeBJFaP36t7esAO617dErqdxWb5cdG2NfJGOofkmBW36fdx0dVewxDRg==", "requires": { "@types/node": "*" } @@ -3592,8 +3592,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3614,14 +3613,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3636,20 +3633,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -3766,8 +3760,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -3779,7 +3772,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3794,7 +3786,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3802,14 +3793,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3828,7 +3817,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3909,8 +3897,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -3922,7 +3909,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4008,8 +3994,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4045,7 +4030,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4065,7 +4049,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4109,14 +4092,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -6314,13 +6295,13 @@ } }, "ethereumjs-util": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.0.0.tgz", - "integrity": "sha512-E3yKUyl0Fs95nvTFQZe/ZSNcofhDzUsDlA5y2uoRmf1+Ec7gpGhNCsgKkZBRh7Br5op8mJcYF/jFbmjj909+nQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", + "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", "requires": { "bn.js": "^4.11.0", "create-hash": "^1.1.2", - "ethjs-util": "^0.1.6", + "ethjs-util": "0.1.6", "keccak": "^1.0.2", "rlp": "^2.0.0", "safe-buffer": "^5.1.1", @@ -7630,8 +7611,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -7652,14 +7632,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7674,20 +7652,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -7804,8 +7779,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -7817,7 +7791,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7832,7 +7805,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7840,14 +7812,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -7866,7 +7836,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7947,8 +7916,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7960,7 +7928,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -8046,8 +8013,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -8083,7 +8049,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8103,7 +8068,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -8147,14 +8111,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -22317,7 +22279,7 @@ "lodash": "^4.17.11", "oboe": "2.1.4", "url-parse": "1.4.4", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", "xhr2-cookies": "1.1.0" }, "dependencies": { @@ -22362,7 +22324,7 @@ "requires": { "underscore": "1.8.3", "web3-core-helpers": "1.0.0-beta.37", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" } }, "web3-shh": { diff --git a/package.json b/package.json index 4f8710e..3b898c0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "@oceanprotocol/art": "^2.2.0", - "@oceanprotocol/squid": "^0.2.8", + "@oceanprotocol/squid": "^0.3.0", "@types/is-url": "^1.2.28", "@types/react-helmet": "^5.0.8", "@types/react-transition-group": "^2.0.15", diff --git a/src/ocean.ts b/src/ocean.ts index 180dd7e..f51b290 100644 --- a/src/ocean.ts +++ b/src/ocean.ts @@ -1,4 +1,4 @@ -import { Ocean } from '@oceanprotocol/squid/dist/node/squid' +import { Ocean } from '@oceanprotocol/squid' import { address, From c3507cebc320a723a19487c951d9566f4bc42f20 Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Thu, 14 Feb 2019 21:27:18 +0100 Subject: [PATCH 03/11] working file add --- src/config.ts | 2 +- src/models/AssetModel.ts | 18 ++---------------- src/routes/Details.tsx | 2 ++ src/routes/Publish/Files/Item.tsx | 4 ++-- src/routes/Publish/Files/index.tsx | 6 +++--- src/routes/Publish/index.tsx | 5 ++--- 6 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/config.ts b/src/config.ts index e70faaf..d06e67e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,7 +6,7 @@ export const aquariusScheme = 'http' export const aquariusHost = 'localhost' export const aquariusPort = 5000 -export const brizoScheme = 'https' +export const brizoScheme = 'http' export const brizoHost = 'localhost' export const brizoPort = 8030 diff --git a/src/models/AssetModel.ts b/src/models/AssetModel.ts index b8413b6..43b3655 100644 --- a/src/models/AssetModel.ts +++ b/src/models/AssetModel.ts @@ -17,23 +17,9 @@ const AssetModel = { compression: null, contentType: null, workExample: null, - files: [ - { - url: null, - checksum: null, - checksumType: null, - contentLength: null, - resourceId: null - } - ], + files: [], categories: [], - links: [ - { - name: null, - type: null, - url: null - } - ], + links: [], inLanguage: null, tags: [], price: null diff --git a/src/routes/Details.tsx b/src/routes/Details.tsx index 4a8fcf1..7267991 100644 --- a/src/routes/Details.tsx +++ b/src/routes/Details.tsx @@ -35,12 +35,14 @@ export default class Details extends Component { service.serviceDefinitionId, account[0] ) + Logger.log(service) await this.context.ocean.initializeServiceAgreement( ddo.id, service.serviceDefinitionId, serviceAgreementSignatureResult.serviceAgreementId, serviceAgreementSignatureResult.serviceAgreementSignature, (files: any) => { + Logger.log('downloading files', files) files.forEach((file: any) => { const parsedUrl: any = quertString.parseUrl(file) setTimeout(() => { diff --git a/src/routes/Publish/Files/Item.tsx b/src/routes/Publish/Files/Item.tsx index 1a14653..995569c 100644 --- a/src/routes/Publish/Files/Item.tsx +++ b/src/routes/Publish/Files/Item.tsx @@ -1,9 +1,9 @@ import React from 'react' import styles from './Item.module.scss' -const Item = ({ item, removeItem }: { item: string; removeItem: any }) => ( +const Item = ({ item, removeItem }: { item: any; removeItem: any }) => (
  • - {item} + {item.url}