From 1502492b3797784cfa3fe1d0f62851f37160110e Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Thu, 27 Jul 2023 15:19:58 -0700 Subject: [PATCH 1/9] feat: support for holo hosting --- package-lock.json | 161 +++++++++----------------------- package.json | 3 - ui/package.json | 1 + ui/src/App.vue | 17 +++- ui/src/components/HoloLogin.vue | 40 ++++---- ui/src/utils/client.ts | 18 ++-- 6 files changed, 85 insertions(+), 155 deletions(-) diff --git a/package-lock.json b/package-lock.json index fbd593e7..8bc6a2a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,6 @@ "ui", "tests" ], - "dependencies": { - "@holo-host/web-sdk": "github:mattyg/web-sdk#fix/update-hc-client" - }, "devDependencies": { "@holochain-playground/cli": "^0.1.1", "@typescript-eslint/eslint-plugin": "^5.59.5", @@ -35,6 +32,40 @@ "npm": ">=7.0.0" } }, + "../Holochain/web-sdk": { + "name": "@holo-host/web-sdk", + "version": "0.6.13-prerelease", + "extraneous": true, + "license": "ISC", + "dependencies": { + "@holo-host/comb": "^0.3.0", + "@holochain/client": "0.14.1", + "semver": "^7.5.1" + }, + "devDependencies": { + "@babel/core": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/preset-typescript": "^7.21.0", + "@holo-host/chaperone": "^8.0.1", + "@jest/globals": "^29.4.3", + "@types/jest": "^29.4.0", + "@types/node": "^12.20.55", + "@whi/stdlog": "^0.3.0", + "babel-loader": "^8.1.0", + "babel-polyfill": "^6.26.0", + "jest": "^27.1.3", + "jest-canvas-mock": "^2.4.0", + "puppeteer": "^2.1.1", + "ts-jest": "^27.1.3", + "ts-loader": "^9.4.1", + "typescript": "^4.9.3", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" + } + }, + "../Holochain/web-sdk/dist": { + "extraneous": true + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -664,12 +695,13 @@ "integrity": "sha512-Dn5pTV/m3XaK1Zvq3liw/vQUt7goM7Y84x2zUyH8cb9CNMs4kPCNHs3kalbJZ/ymzFvwcdiLwwNW8AKk+WWN5A==" }, "node_modules/@holo-host/web-sdk": { - "version": "0.6.11-prerelease", - "resolved": "git+ssh://git@github.com/mattyg/web-sdk.git#f3eb5d007b926e3e2a8803f9fd051e7d16ea65b5", + "version": "0.6.13-prerelease", + "resolved": "git+ssh://git@github.com/mattyg/web-sdk.git#4563ec5aa1843cd9c1fd9e3fc6f7ccad2efd5ac1", "license": "ISC", "dependencies": { "@holo-host/comb": "^0.3.0", - "@holochain/client": "^0.12.5" + "@holochain/client": "0.14.1", + "semver": "^7.5.1" } }, "node_modules/@holochain-open-dev/elements": { @@ -685,25 +717,6 @@ "lit": "^2.6.1" } }, - "node_modules/@holochain-open-dev/elements/node_modules/@holochain/client": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", - "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", - "dependencies": { - "@holochain/serialization": "^0.1.0-beta-rc.3", - "@msgpack/msgpack": "^2.7.2", - "@noble/ed25519": "^2.0.0", - "@tauri-apps/api": "^1.2.0", - "emittery": "^1.0.1", - "isomorphic-ws": "^5.0.0", - "js-base64": "^3.7.3", - "lodash-es": "^4.17.21", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0 || >=18.0.0" - } - }, "node_modules/@holochain-open-dev/profiles": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/@holochain-open-dev/profiles/-/profiles-0.14.1.tgz", @@ -719,25 +732,6 @@ "@shoelace-style/shoelace": "^2.3.0" } }, - "node_modules/@holochain-open-dev/profiles/node_modules/@holochain/client": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", - "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", - "dependencies": { - "@holochain/serialization": "^0.1.0-beta-rc.3", - "@msgpack/msgpack": "^2.7.2", - "@noble/ed25519": "^2.0.0", - "@tauri-apps/api": "^1.2.0", - "emittery": "^1.0.1", - "isomorphic-ws": "^5.0.0", - "js-base64": "^3.7.3", - "lodash-es": "^4.17.21", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0 || >=18.0.0" - } - }, "node_modules/@holochain-open-dev/stores": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@holochain-open-dev/stores/-/stores-0.5.2.tgz", @@ -749,25 +743,6 @@ "svelte": "^3.53.1" } }, - "node_modules/@holochain-open-dev/stores/node_modules/@holochain/client": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", - "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", - "dependencies": { - "@holochain/serialization": "^0.1.0-beta-rc.3", - "@msgpack/msgpack": "^2.7.2", - "@noble/ed25519": "^2.0.0", - "@tauri-apps/api": "^1.2.0", - "emittery": "^1.0.1", - "isomorphic-ws": "^5.0.0", - "js-base64": "^3.7.3", - "lodash-es": "^4.17.21", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0 || >=18.0.0" - } - }, "node_modules/@holochain-open-dev/utils": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@holochain-open-dev/utils/-/utils-0.14.0.tgz", @@ -781,25 +756,6 @@ "sort-keys": "^5.0.0" } }, - "node_modules/@holochain-open-dev/utils/node_modules/@holochain/client": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", - "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", - "dependencies": { - "@holochain/serialization": "^0.1.0-beta-rc.3", - "@msgpack/msgpack": "^2.7.2", - "@noble/ed25519": "^2.0.0", - "@tauri-apps/api": "^1.2.0", - "emittery": "^1.0.1", - "isomorphic-ws": "^5.0.0", - "js-base64": "^3.7.3", - "lodash-es": "^4.17.21", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0 || >=18.0.0" - } - }, "node_modules/@holochain-playground/cli": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@holochain-playground/cli/-/cli-0.1.1.tgz", @@ -810,21 +766,22 @@ } }, "node_modules/@holochain/client": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.12.5.tgz", - "integrity": "sha512-9Q1G8sKEGsqnCl067CaRbzwPZZ5zeDCJdvQ8TJpb+psP2kLJBbHZ2qulMXAlNUz7Pg0l4B1Eh/BFJByJHRLlow==", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", + "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", "dependencies": { "@holochain/serialization": "^0.1.0-beta-rc.3", "@msgpack/msgpack": "^2.7.2", + "@noble/ed25519": "^2.0.0", "@tauri-apps/api": "^1.2.0", "emittery": "^1.0.1", "isomorphic-ws": "^5.0.0", "js-base64": "^3.7.3", "lodash-es": "^4.17.21", - "tweetnacl": "^1.0.3" + "ws": "^8.13.0" }, "engines": { - "node": "^14.13.1 || >=16.0.0 || >=18.0.0" + "node": ">=16.0.0 || >=18.0.0" } }, "node_modules/@holochain/serialization": { @@ -848,25 +805,6 @@ "node": ">=16.0.0 || >=18.0.0" } }, - "node_modules/@holochain/tryorama/node_modules/@holochain/client": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.14.1.tgz", - "integrity": "sha512-5rWPIRdxhvV+SpKHegKsPSw7AcN1JjtLS5RhAlLT7dsXvn70BcMWsImhBs1sqw69QsbEMKlhqaOH+sOS5LkDBQ==", - "dependencies": { - "@holochain/serialization": "^0.1.0-beta-rc.3", - "@msgpack/msgpack": "^2.7.2", - "@noble/ed25519": "^2.0.0", - "@tauri-apps/api": "^1.2.0", - "emittery": "^1.0.1", - "isomorphic-ws": "^5.0.0", - "js-base64": "^3.7.3", - "lodash-es": "^4.17.21", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0 || >=18.0.0" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -4139,7 +4077,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -5137,7 +5074,6 @@ "version": "7.5.1", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -5676,11 +5612,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -6512,8 +6443,7 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { "version": "2.3.1", @@ -6654,6 +6584,7 @@ "@fontsource/space-mono": "^5.0.3", "@fontsource/syne": "^5.0.3", "@headlessui/vue": "^1.7.14", + "@holo-host/web-sdk": "github:mattyg/web-sdk#fix/appagentclient-compatibility", "@holochain-open-dev/profiles": "^0.14.1", "@holochain/client": "^0.15.0", "@shoelace-style/shoelace": "^2.4.0", diff --git a/package.json b/package.json index 7396d586..a8f44c57 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,5 @@ }, "engines": { "npm": ">=7.0.0" - }, - "dependencies": { - "@holo-host/web-sdk": "github:mattyg/web-sdk#fix/update-hc-client" } } diff --git a/ui/package.json b/ui/package.json index 0f50adb0..243f9590 100644 --- a/ui/package.json +++ b/ui/package.json @@ -16,6 +16,7 @@ "@fontsource/space-mono": "^5.0.3", "@fontsource/syne": "^5.0.3", "@headlessui/vue": "^1.7.14", + "@holo-host/web-sdk": "github:mattyg/web-sdk#fix/appagentclient-compatibility", "@holochain-open-dev/profiles": "^0.14.1", "@holochain/client": "^0.15.0", "@shoelace-style/shoelace": "^2.4.0", diff --git a/ui/src/App.vue b/ui/src/App.vue index c3c315db..a1af4328 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -73,9 +73,7 @@ const dnaProperties = computed(() => ); onMounted(() => { - asyncRetry(setup, { - factor: 1.3, - }); + setup(); }); const setup = async () => { @@ -83,8 +81,19 @@ const setup = async () => { if (IS_HOLO_HOSTED) { client.value = await setupHolo(); } else { - client.value = await setupHolochain(); + client.value = await asyncRetry(setupHolochain, { + factor: 1.3, + }); } + + await asyncRetry(setupApp, { + factor: 1.3, + }); +}; + +const setupApp = async () => { + if (!client.value) throw Error("Holo / Holochain client not ready"); + appInfo.value = await client.value.appInfo(); // Setup profiles diff --git a/ui/src/components/HoloLogin.vue b/ui/src/components/HoloLogin.vue index 2e6df847..a808608c 100644 --- a/ui/src/components/HoloLogin.vue +++ b/ui/src/components/HoloLogin.vue @@ -1,39 +1,31 @@