]> git.r.bdr.sh - rbdr/forum/commitdiff
Start migration to supabase
authorRuben Beltran del Rio <redacted>
Tue, 17 May 2022 21:43:30 +0000 (23:43 +0200)
committerRuben Beltran del Rio <redacted>
Tue, 17 May 2022 21:43:30 +0000 (23:43 +0200)
package-lock.json
package.json
src/lib/config/apollo.ts
src/lib/config/config.ts
src/lib/config/env.dist
src/lib/data/queries.ts
src/lib/stores/apollo.ts
src/lib/stores/forums.ts

index 9756509169b7ca9efb5ae815b80f921dce9dc7aa..efda708ab2f2c2f17020342d01e56b83acab56ca 100644 (file)
@@ -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",
                                "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",
                                "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",
                                "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,
                                "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",
                        "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,
                                "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",
                                "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",
                        "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
                                }
                        }
                },
+               "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",
                        "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
index c7e7d1744f1831056cd3f0cf15daa9aa1addd383..99fb28280441bd34cb546f52717a3dcdc46531c3 100644 (file)
@@ -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",
index 826fd288b2eb382630697797febd55ff242a8f8b..a8b27efd6e7a0df23cf13fb0471a8f058b8bcead 100644 (file)
@@ -8,6 +8,9 @@ export const client = new ApolloClient({
        cache,
        link: new HttpLink({
                uri: apolloConfig.uri,
+    headers: {
+      apiKey: apolloConfig.key
+    },
                fetch
        }),
        ...apolloConfig
index efb7deadb7278dbe8b28aa783467d4f5a3e9a178..2bf9bc1f54d09575b4a59348816399a87c0e12e8 100644 (file)
@@ -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
 };
index 1f3ff0cdf290d3bbeddb63ed0cf3d49341ac8e09..2d95266183f69f7238cd088e258907f167a5123c 100644 (file)
@@ -1 +1,2 @@
 VITE_APOLLO_SERVER=http://location_of_apollo_server
+VITE_APOLLO_KEY=""
index 7364c0f1dd7e0095d24b4f4cf47e7bb8c64e2287..4def052b71dabb20710483becb76d2b430a7a76a 100644 (file)
@@ -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
+        }
+      }
+    }
        }
 `;
 
index 4ef1986bec301e15b9bba6778734ad84b2bc61b9..c75dd8723652313e43eee311b82ba3db8f64f445 100644 (file)
@@ -52,7 +52,7 @@ export const store = function store<Type>({
 
                                set({
                                        loading: false,
-                                       data: result.data[key],
+                                       data: result.data[key].edges.map((item) => item.node),
                                        error: undefined
                                });
                        },
index 8a395b329d2c29df02b9c4dec704c4adccf5374f..0ff09f7b5f6eca3b3e268ef72fabe1b0372733a3 100644 (file)
@@ -6,4 +6,4 @@ import type { Forum } from '$lib/data/types';
 export const getForum = (id: string) =>
        store<Forum>({ key: 'forum', query: GET_FORUM, variables: { id } });
 export const getForums = () =>
-       store<Forum[]>({ key: 'forums', query: GET_FORUMS, initialValue: [] });
+       store<Forum[]>({ key: 'forumsCollection', query: GET_FORUMS, initialValue: [] });