From: Ruben Beltran del Rio Date: Tue, 17 May 2022 21:43:30 +0000 (+0200) Subject: Start migration to supabase X-Git-Url: https://git.r.bdr.sh/rbdr/forum/commitdiff_plain/d2cd7f1b4c318ac8587ab3dc1dec4a44b6d592fe?ds=sidebyside Start migration to supabase --- diff --git a/package-lock.json b/package-lock.json index 9756509..efda708 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0-dev1", "devDependencies": { "@apollo/client": "^3.6.4", + "@ory/client": "^0.0.1-alpha.177", "@pact-foundation/pact": "^9.17.3", "@playwright/test": "^1.20.0", "@sveltejs/adapter-auto": "next", @@ -1937,6 +1938,15 @@ "node": ">= 8" } }, + "node_modules/@ory/client": { + "version": "0.0.1-alpha.177", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-0.0.1-alpha.177.tgz", + "integrity": "sha512-kCX74/ii4Cz6Msp9FZifuPgdiAToYDAfI43Oe9VbDa9cCUmf+RkRgD0FKjN3KYIUPUq2DNqaXiyWwjogLcW6Yg==", + "dev": true, + "dependencies": { + "axios": "^0.21.4" + } + }, "node_modules/@pact-foundation/pact": { "version": "9.17.3", "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-9.17.3.tgz", @@ -3368,6 +3378,15 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/babel-jest": { "version": "28.1.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-28.1.0.tgz", @@ -3718,6 +3737,21 @@ "node": ">=0.2.0" } }, + "node_modules/bufferutil": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/bytes": { "version": "3.1.2", "dev": true, @@ -9102,6 +9136,19 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/node-gyp-build": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", + "dev": true, + "optional": true, + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -11519,6 +11566,21 @@ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", "dev": true }, + "node_modules/utf-8-validate": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", + "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "dev": true, @@ -13265,6 +13327,15 @@ "fastq": "^1.6.0" } }, + "@ory/client": { + "version": "0.0.1-alpha.177", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-0.0.1-alpha.177.tgz", + "integrity": "sha512-kCX74/ii4Cz6Msp9FZifuPgdiAToYDAfI43Oe9VbDa9cCUmf+RkRgD0FKjN3KYIUPUq2DNqaXiyWwjogLcW6Yg==", + "dev": true, + "requires": { + "axios": "^0.21.4" + } + }, "@pact-foundation/pact": { "version": "9.17.3", "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-9.17.3.tgz", @@ -14286,6 +14357,15 @@ "postcss-value-parser": "^4.2.0" } }, + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dev": true, + "requires": { + "follow-redirects": "^1.14.0" + } + }, "babel-jest": { "version": "28.1.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-28.1.0.tgz", @@ -14541,6 +14621,17 @@ "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", "dev": true }, + "bufferutil": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "bytes": { "version": "3.1.2", "dev": true @@ -18338,6 +18429,14 @@ } } }, + "node-gyp-build": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", + "dev": true, + "optional": true, + "peer": true + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -19940,6 +20039,17 @@ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", "dev": true }, + "utf-8-validate": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", + "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "util-deprecate": { "version": "1.0.2", "dev": true diff --git a/package.json b/package.json index c7e7d17..99fb282 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "devDependencies": { "@apollo/client": "^3.6.4", + "@ory/client": "^0.0.1-alpha.177", "@pact-foundation/pact": "^9.17.3", "@playwright/test": "^1.20.0", "@sveltejs/adapter-auto": "next", diff --git a/src/lib/config/apollo.ts b/src/lib/config/apollo.ts index 826fd28..a8b27ef 100644 --- a/src/lib/config/apollo.ts +++ b/src/lib/config/apollo.ts @@ -8,6 +8,9 @@ export const client = new ApolloClient({ cache, link: new HttpLink({ uri: apolloConfig.uri, + headers: { + apiKey: apolloConfig.key + }, fetch }), ...apolloConfig diff --git a/src/lib/config/config.ts b/src/lib/config/config.ts index efb7dea..2bf9bc1 100644 --- a/src/lib/config/config.ts +++ b/src/lib/config/config.ts @@ -10,6 +10,7 @@ const internals = { export const apollo = { uri: import.meta.env.VITE_APOLLO_SERVER, + key: import.meta.env.VITE_APOLLO_KEY, name: 'forum', version: internals.version }; diff --git a/src/lib/config/env.dist b/src/lib/config/env.dist index 1f3ff0c..2d95266 100644 --- a/src/lib/config/env.dist +++ b/src/lib/config/env.dist @@ -1 +1,2 @@ VITE_APOLLO_SERVER=http://location_of_apollo_server +VITE_APOLLO_KEY="" diff --git a/src/lib/data/queries.ts b/src/lib/data/queries.ts index 7364c0f..4def052 100644 --- a/src/lib/data/queries.ts +++ b/src/lib/data/queries.ts @@ -2,12 +2,16 @@ import { gql } from '@apollo/client/core'; export const GET_FORUMS = gql` query GetForums { - forums { - id - glyph - label - position - } + forumsCollection { + edges { + node { + id + glyph + label + position + } + } + } } `; diff --git a/src/lib/stores/apollo.ts b/src/lib/stores/apollo.ts index 4ef1986..c75dd87 100644 --- a/src/lib/stores/apollo.ts +++ b/src/lib/stores/apollo.ts @@ -52,7 +52,7 @@ export const store = function store({ set({ loading: false, - data: result.data[key], + data: result.data[key].edges.map((item) => item.node), error: undefined }); }, diff --git a/src/lib/stores/forums.ts b/src/lib/stores/forums.ts index 8a395b3..0ff09f7 100644 --- a/src/lib/stores/forums.ts +++ b/src/lib/stores/forums.ts @@ -6,4 +6,4 @@ import type { Forum } from '$lib/data/types'; export const getForum = (id: string) => store({ key: 'forum', query: GET_FORUM, variables: { id } }); export const getForums = () => - store({ key: 'forums', query: GET_FORUMS, initialValue: [] }); + store({ key: 'forumsCollection', query: GET_FORUMS, initialValue: [] });