diff --git a/.mise.toml b/.mise.toml index 59a67ac..755c9cf 100644 --- a/.mise.toml +++ b/.mise.toml @@ -1,2 +1,5 @@ [tools] -node = "latest" +node = "22.5.1" + +[env] +_.file = '.env.local' diff --git a/TODO b/TODO index 263826e..01f39c3 100644 --- a/TODO +++ b/TODO @@ -58,6 +58,6 @@ Tests: - finir l'implementation des triggers -- overwrite d'un fichier fonctionne pas bien +✔ overwrite d'un fichier fonctionne pas bien @done(24-07-30 17:40) - fermer trop vite la fenêtre de modifiation n'enregistre pas le changement - export Electron ne fonctionne pas diff --git a/components.d.ts b/components.d.ts index 5523160..a275eca 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,7 +8,9 @@ export {} declare module 'vue' { export interface GlobalComponents { Button: typeof import('primevue/button')['default'] + Checkbox: typeof import('primevue/checkbox')['default'] Dialog: typeof import('primevue/dialog')['default'] + Divider: typeof import('primevue/divider')['default'] Drawer: typeof import('primevue/drawer')['default'] IconField: typeof import('primevue/iconfield')['default'] Inplace: typeof import('primevue/inplace')['default'] @@ -16,6 +18,7 @@ declare module 'vue' { InputText: typeof import('primevue/inputtext')['default'] Listbox: typeof import('primevue/listbox')['default'] Panel: typeof import('primevue/panel')['default'] + Password: typeof import('primevue/password')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] SelectButton: typeof import('primevue/selectbutton')['default'] diff --git a/index.html b/index.html index 065d3e2..373cfc1 100644 --- a/index.html +++ b/index.html @@ -13,6 +13,7 @@ style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; + connect-src 'self' https://*.supabase.co; " /> diff --git a/package.json b/package.json index a1bb0c4..9064efd 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "build:linux": "npm run build:no-check && electron-builder --linux --config", "package": "electron-forge package", "make": "electron-forge make", - "publish": "electron-forge publish" + "publish": "electron-forge publish", + "supa:types": "supabase gen types typescript --project-id $VITE_SUPABASE_PROJECT_ID > src/shared/database.types.ts" }, "dependencies": { "@bugsnag/electron": "7.25.0", @@ -57,8 +58,12 @@ "@primevue/themes": "4.0.1", "@sentry/electron": "5.2.0", "@sentry/vue": "8.20.0", + "@supabase/supabase-js": "2.45.0", "@trpc/client": "^10.45.2", "@types/dompurify": "3.0.5", + "@vee-validate/valibot": "4.13.2", + "@vuelidate/core": "2.0.3", + "@vuelidate/validators": "2.0.4", "@vueuse/components": "^10.11.0", "@vueuse/core": "^10.11.0", "@vueuse/router": "^10.11.0", @@ -103,6 +108,7 @@ "type-fest": "^4.23.0", "update-electron-app": "3.0.0", "valibot": "0.36.0", + "vee-validate": "4.13.2", "vue-dompurify-html": "^5.1.0", "web-worker": "^1.3.0", "zod": "^3.23.8" @@ -139,6 +145,7 @@ "npm-upgrade": "^3.1.0", "prettier": "^3.3.3", "primeflex": "^3.3.1", + "supabase": "1.187.8", "ts-node": "10.9.2", "typescript": "^5.5.4", "unplugin-auto-import": "^0.18.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6a5d72..d6bd24e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,12 +80,24 @@ importers: '@sentry/vue': specifier: 8.20.0 version: 8.20.0(vue@3.4.34(typescript@5.5.4)) + '@supabase/supabase-js': + specifier: 2.45.0 + version: 2.45.0 '@trpc/client': specifier: ^10.45.2 version: 10.45.2(@trpc/server@10.45.2) '@types/dompurify': specifier: 3.0.5 version: 3.0.5 + '@vee-validate/valibot': + specifier: 4.13.2 + version: 4.13.2(vue@3.4.34(typescript@5.5.4)) + '@vuelidate/core': + specifier: 2.0.3 + version: 2.0.3(vue@3.4.34(typescript@5.5.4)) + '@vuelidate/validators': + specifier: 2.0.4 + version: 2.0.4(vue@3.4.34(typescript@5.5.4)) '@vueuse/components': specifier: ^10.11.0 version: 10.11.0(vue@3.4.34(typescript@5.5.4)) @@ -218,6 +230,9 @@ importers: valibot: specifier: 0.36.0 version: 0.36.0 + vee-validate: + specifier: 4.13.2 + version: 4.13.2(vue@3.4.34(typescript@5.5.4)) vue-dompurify-html: specifier: ^5.1.0 version: 5.1.0(vue@3.4.34(typescript@5.5.4)) @@ -321,6 +336,9 @@ importers: primeflex: specifier: ^3.3.1 version: 3.3.1 + supabase: + specifier: 1.187.8 + version: 1.187.8 ts-node: specifier: 10.9.2 version: 10.9.2(@types/node@20.14.12)(typescript@5.5.4) @@ -1160,6 +1178,10 @@ packages: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} + '@isaacs/fs-minipass@4.0.1': + resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} + engines: {node: '>=18.0.0'} + '@jitl/quickjs-ffi-types@0.29.2': resolution: {integrity: sha512-069uQTiEla2PphXg6UpyyJ4QXHkTj3S9TeXgaMCd8NDYz3ODBw5U/rkg6fhuU8SMpoDrWjEzybmV5Mi2Pafb5w==} @@ -1808,6 +1830,28 @@ packages: resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} engines: {node: '>=18'} + '@supabase/auth-js@2.64.4': + resolution: {integrity: sha512-9ITagy4WP4FLl+mke1rchapOH0RQpf++DI+WSG2sO1OFOZ0rW3cwAM0nCrMOxu+Zw4vJ4zObc08uvQrXx590Tg==} + + '@supabase/functions-js@2.4.1': + resolution: {integrity: sha512-8sZ2ibwHlf+WkHDUZJUXqqmPvWQ3UHN0W30behOJngVh/qHHekhJLCFbh0AjkE9/FqqXtf9eoVvmYgfCLk5tNA==} + + '@supabase/node-fetch@2.6.15': + resolution: {integrity: sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==} + engines: {node: 4.x || >=6.0.0} + + '@supabase/postgrest-js@1.15.8': + resolution: {integrity: sha512-YunjXpoQjQ0a0/7vGAvGZA2dlMABXFdVI/8TuVKtlePxyT71sl6ERl6ay1fmIeZcqxiuFQuZw/LXUuStUG9bbg==} + + '@supabase/realtime-js@2.10.2': + resolution: {integrity: sha512-qyCQaNg90HmJstsvr2aJNxK2zgoKh9ZZA8oqb7UT2LCh3mj9zpa3Iwu167AuyNxsxrUE8eEJ2yH6wLCij4EApA==} + + '@supabase/storage-js@2.6.0': + resolution: {integrity: sha512-REAxr7myf+3utMkI2oOmZ6sdplMZZ71/2NEIEMBZHL9Fkmm3/JnaOZVSRqvG4LStYj2v5WhCruCzuMn6oD/Drw==} + + '@supabase/supabase-js@2.45.0': + resolution: {integrity: sha512-j66Mfs8RhzCQCKxKogAFQYH9oNhRmgIdKk6pexguI2Oc7hi+nL9UNJug5aL1tKnBdaBM3h65riPLQSdL6sWa3Q==} + '@szmarczak/http-timer@1.1.2': resolution: {integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==} engines: {node: '>=6'} @@ -1940,6 +1984,9 @@ packages: '@types/pg@8.6.1': resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} + '@types/phoenix@1.6.5': + resolution: {integrity: sha512-xegpDuR+z0UqG9fwHqNoy3rI7JDlvaPh2TY47Fl80oq6g+hXT+c/LEuE43X48clZ6lOfANl5WrPur9fYO1RJ/w==} + '@types/qs@6.9.15': resolution: {integrity: sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==} @@ -1970,6 +2017,9 @@ packages: '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + '@types/ws@8.5.12': + resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + '@types/yauzl@2.10.3': resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} @@ -2052,6 +2102,9 @@ packages: resolution: {integrity: sha512-RVGC9UhPOCsfCdI9pU++K4nD7to+jTcMIbXTSOcrLqUEW6gF2pU1UUbYJKc9cvcRSK1UDeMJ7pdMxf4bhMpV/A==} engines: {node: ^18.18.0 || >=20.0.0} + '@vee-validate/valibot@4.13.2': + resolution: {integrity: sha512-Vz/sAJc0i1Z1zsXbER15/7EUcD2mYHCaBrmmFs6oFBSDFoDXwJYjPMSklHqyOUVEt15wBVd9HU52f+4cD/5kxw==} + '@vitejs/plugin-vue@5.1.0': resolution: {integrity: sha512-QMRxARyrdiwi1mj3AW4fLByoHTavreXq0itdEW696EihXglf1MB3D4C2gBvE0jMPH29ZjC3iK8aIaUMLf4EOGA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -2197,6 +2250,24 @@ packages: '@vue/test-utils@2.4.6': resolution: {integrity: sha512-FMxEjOpYNYiFe0GkaHsnJPXFHxQ6m4t8vI/ElPGpMWxZKpmRvQ33OIrvRXemy6yha03RxhOlQuy+gZMC3CQSow==} + '@vuelidate/core@2.0.3': + resolution: {integrity: sha512-AN6l7KF7+mEfyWG0doT96z+47ljwPpZfi9/JrNMkOGLFv27XVZvKzRLXlmDPQjPl/wOB1GNnHuc54jlCLRNqGA==} + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^2.0.0 || >=3.0.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + + '@vuelidate/validators@2.0.4': + resolution: {integrity: sha512-odTxtUZ2JpwwiQ10t0QWYJkkYrfd0SyFYhdHH44QQ1jDatlZgTh/KRzrWVmn/ib9Gq7H4hFD4e8ahoo5YlUlDw==} + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^2.0.0 || >=3.0.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + '@vueuse/components@10.11.0': resolution: {integrity: sha512-ZvLZI23d5ZAtva5fGyYh/jQtZO8l+zJ5tAXyYNqHJZkq1o5yWyqZhENvSv5mfDmN5IuAOp4tq02mRmX/ipFGcg==} @@ -2444,6 +2515,10 @@ packages: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} + bin-links@4.0.4: + resolution: {integrity: sha512-cMtq4W5ZsEwcutJrVId+a/tjt8GSbS+h0oNkdl6+6rBuEv8Ot33Bevj5KPm40t309zuhVic8NjpuL42QCiJWWA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + binary-extensions@2.3.0: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} @@ -2637,6 +2712,10 @@ packages: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + chrome-trace-event@1.0.4: resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} engines: {node: '>=6.0'} @@ -2710,6 +2789,10 @@ packages: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} + cmd-shim@6.0.3: + resolution: {integrity: sha512-FMabTRlc5t5zjdenF6mS0MBeFZm0XqHqeOkcskKFb/LYCcRQ5fVgLOHVc4Lq9CqABd9zhjwPjMBCJvMCziSVtA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + code-point-at@1.1.0: resolution: {integrity: sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==} engines: {node: '>=0.10.0'} @@ -2920,6 +3003,10 @@ packages: resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==} engines: {node: '>=0.10'} + data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + data-urls@5.0.0: resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} engines: {node: '>=18'} @@ -3430,6 +3517,10 @@ packages: fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + figgy-pudding@3.5.2: resolution: {integrity: sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==} deprecated: This module is no longer supported. @@ -3516,6 +3607,10 @@ packages: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} + formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -4662,6 +4757,10 @@ packages: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} + minizlib@3.0.1: + resolution: {integrity: sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==} + engines: {node: '>= 18'} + mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} @@ -4674,6 +4773,11 @@ packages: engines: {node: '>=10'} hasBin: true + mkdirp@3.0.1: + resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} + engines: {node: '>=10'} + hasBin: true + mlly@1.7.1: resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} @@ -4743,6 +4847,10 @@ packages: node-api-version@0.2.0: resolution: {integrity: sha512-fthTTsi8CxaBXMaBAD7ST2uylwvsnYxh2PfaScwpMhos6KlSFajXQPcM4ogNE1q2s3Lbz9GCGqeIHC+C6OZnKg==} + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -4752,6 +4860,10 @@ packages: encoding: optional: true + node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + node-gyp@7.1.2: resolution: {integrity: sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==} engines: {node: '>= 10.12.0'} @@ -4818,6 +4930,10 @@ packages: npm-normalize-package-bin@1.0.1: resolution: {integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==} + npm-normalize-package-bin@3.0.1: + resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + npm-package-arg@8.1.5: resolution: {integrity: sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==} engines: {node: '>=10'} @@ -5448,6 +5564,10 @@ packages: resolution: {integrity: sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==} hasBin: true + read-cmd-shim@4.0.0: + resolution: {integrity: sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + read-package-json-fast@2.0.3: resolution: {integrity: sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==} engines: {node: '>=10'} @@ -5605,6 +5725,11 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true + rimraf@5.0.9: + resolution: {integrity: sha512-3i7b8OcswU6CpU8Ej89quJD4O98id7TtVM5U4Mybh84zQXdrFmDLouWBEEaD/QfO3gDDfH+AGFCGsR7kngzQnA==} + engines: {node: 14 >=14.20 || 16 >=16.20 || >=18} + hasBin: true + ripemd160@2.0.2: resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} @@ -6005,6 +6130,11 @@ packages: resolution: {integrity: sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==} engines: {node: '>= 8.0'} + supabase@1.187.8: + resolution: {integrity: sha512-uHWa94ELOuv9y/vXx4jvCVtl5fHbpqMlIWTtPwjPj60A6tnfL2jyxZ7RnU2DspUWh+NC579r8mEpyDq6yJt0oA==} + engines: {npm: '>=8'} + hasBin: true + superjson@2.2.1: resolution: {integrity: sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==} engines: {node: '>=16'} @@ -6038,6 +6168,10 @@ packages: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} + tar@7.4.2: + resolution: {integrity: sha512-pP4ToLATHpXOrbxOZudW6rnfyPWJZoyERNrpTpQEtW6LkvpXw+WDnpj2GBQX9tyQ6teUyPESyyiOCFgp6HnGdw==} + engines: {node: '>=18'} + temp@0.9.4: resolution: {integrity: sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==} engines: {node: '>=6.0.0'} @@ -6392,6 +6526,9 @@ packages: v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + valibot@0.33.3: + resolution: {integrity: sha512-/fuY1DlX8uiQ7aphlzrrI2DbG0YJk84JMgvz2qKpUIdXRNsS53varfo4voPjSrjUr5BSV2K0miSEJUOlA5fQFg==} + valibot@0.36.0: resolution: {integrity: sha512-CjF1XN4sUce8sBK9TixrDqFM7RwNkuXdJu174/AwmQUB62QbCQADg5lLe8ldBalFgtj1uKj+pKwDJiNo4Mn+eQ==} @@ -6405,6 +6542,11 @@ packages: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} + vee-validate@4.13.2: + resolution: {integrity: sha512-HlpR/6MJ92TW9f135umMZKUqdd/tFQTxLNSf2ImbU4Y/MlLVAUpF1l64VdjTOhbClAqPjCb5p/SqHDxLpUHXrw==} + peerDependencies: + vue: ^3.4.26 + verror@1.10.0: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} @@ -6526,6 +6668,17 @@ packages: vue-component-type-helpers@2.0.26: resolution: {integrity: sha512-sO9qQ8oC520SW6kqlls0iqDak53gsTVSrYylajgjmkt1c0vcgjsGSy1KzlDrbEx8pm02IEYhlUkU5hCYf8rwtg==} + vue-demi@0.13.11: + resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==} + engines: {node: '>=12'} + hasBin: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + vue-demi@0.14.8: resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==} engines: {node: '>=12'} @@ -6580,6 +6733,10 @@ packages: wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + web-worker@1.3.0: resolution: {integrity: sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==} @@ -6665,6 +6822,10 @@ packages: write-file-atomic@3.0.3: resolution: {integrity: sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==} + write-file-atomic@5.0.1: + resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + ws@7.5.10: resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} engines: {node: '>=8.3.0'} @@ -6741,6 +6902,10 @@ packages: yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + yargs-parser@20.2.9: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} @@ -8000,6 +8165,10 @@ snapshots: wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.2 + '@jitl/quickjs-ffi-types@0.29.2': {} '@jitl/quickjs-wasmfile-debug-asyncify@0.29.2': @@ -8824,6 +8993,48 @@ snapshots: '@sindresorhus/merge-streams@4.0.0': {} + '@supabase/auth-js@2.64.4': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/functions-js@2.4.1': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/node-fetch@2.6.15': + dependencies: + whatwg-url: 5.0.0 + + '@supabase/postgrest-js@1.15.8': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/realtime-js@2.10.2': + dependencies: + '@supabase/node-fetch': 2.6.15 + '@types/phoenix': 1.6.5 + '@types/ws': 8.5.12 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@supabase/storage-js@2.6.0': + dependencies: + '@supabase/node-fetch': 2.6.15 + + '@supabase/supabase-js@2.45.0': + dependencies: + '@supabase/auth-js': 2.64.4 + '@supabase/functions-js': 2.4.1 + '@supabase/node-fetch': 2.6.15 + '@supabase/postgrest-js': 1.15.8 + '@supabase/realtime-js': 2.10.2 + '@supabase/storage-js': 2.6.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + '@szmarczak/http-timer@1.1.2': dependencies: defer-to-connect: 1.1.3 @@ -8984,6 +9195,8 @@ snapshots: pg-protocol: 1.6.1 pg-types: 2.2.0 + '@types/phoenix@1.6.5': {} + '@types/qs@6.9.15': {} '@types/range-parser@1.2.7': {} @@ -9013,6 +9226,10 @@ snapshots: '@types/web-bluetooth@0.0.20': {} + '@types/ws@8.5.12': + dependencies: + '@types/node': 20.14.12 + '@types/yauzl@2.10.3': dependencies: '@types/node': 20.14.12 @@ -9126,6 +9343,14 @@ snapshots: '@typescript-eslint/types': 7.17.0 eslint-visitor-keys: 3.4.3 + '@vee-validate/valibot@4.13.2(vue@3.4.34(typescript@5.5.4))': + dependencies: + type-fest: 4.23.0 + valibot: 0.33.3 + vee-validate: 4.13.2(vue@3.4.34(typescript@5.5.4)) + transitivePeerDependencies: + - vue + '@vitejs/plugin-vue@5.1.0(vite@5.3.4(@types/node@20.14.12)(less@4.2.0)(sass@1.77.8)(stylus@0.54.8))(vue@3.4.34(typescript@5.5.4))': dependencies: vite: 5.3.4(@types/node@20.14.12)(less@4.2.0)(sass@1.77.8)(stylus@0.54.8) @@ -9373,6 +9598,16 @@ snapshots: js-beautify: 1.15.1 vue-component-type-helpers: 2.0.26 + '@vuelidate/core@2.0.3(vue@3.4.34(typescript@5.5.4))': + dependencies: + vue: 3.4.34(typescript@5.5.4) + vue-demi: 0.13.11(vue@3.4.34(typescript@5.5.4)) + + '@vuelidate/validators@2.0.4(vue@3.4.34(typescript@5.5.4))': + dependencies: + vue: 3.4.34(typescript@5.5.4) + vue-demi: 0.13.11(vue@3.4.34(typescript@5.5.4)) + '@vueuse/components@10.11.0(vue@3.4.34(typescript@5.5.4))': dependencies: '@vueuse/core': 10.11.0(vue@3.4.34(typescript@5.5.4)) @@ -9644,6 +9879,13 @@ snapshots: dependencies: is-windows: 1.0.2 + bin-links@4.0.4: + dependencies: + cmd-shim: 6.0.3 + npm-normalize-package-bin: 3.0.1 + read-cmd-shim: 4.0.0 + write-file-atomic: 5.0.1 + binary-extensions@2.3.0: {} bindings@1.5.0: @@ -9934,6 +10176,8 @@ snapshots: chownr@2.0.0: {} + chownr@3.0.0: {} + chrome-trace-event@1.0.4: {} chromium-pickle-js@0.2.0: @@ -9999,6 +10243,8 @@ snapshots: clone@1.0.4: {} + cmd-shim@6.0.3: {} + code-point-at@1.1.0: {} code-tag@1.2.0: {} @@ -10215,6 +10461,8 @@ snapshots: dependencies: assert-plus: 1.0.0 + data-uri-to-buffer@4.0.1: {} + data-urls@5.0.0: dependencies: whatwg-mimetype: 4.0.0 @@ -10898,6 +11146,11 @@ snapshots: dependencies: pend: 1.2.0 + fetch-blob@3.2.0: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + figgy-pudding@3.5.2: {} figures@3.2.0: @@ -11003,6 +11256,10 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 + formdata-polyfill@4.0.10: + dependencies: + fetch-blob: 3.2.0 + forwarded@0.2.0: {} fp-and-or@0.1.4: {} @@ -12230,6 +12487,11 @@ snapshots: minipass: 3.3.6 yallist: 4.0.0 + minizlib@3.0.1: + dependencies: + minipass: 7.1.2 + rimraf: 5.0.9 + mitt@3.0.1: {} mkdirp@0.5.6: @@ -12239,6 +12501,8 @@ snapshots: mkdirp@1.0.4: {} + mkdirp@3.0.1: {} + mlly@1.7.1: dependencies: acorn: 8.12.1 @@ -12290,12 +12554,20 @@ snapshots: dependencies: semver: 7.6.3 + node-domexception@1.0.0: {} + node-fetch@2.7.0(encoding@0.1.13): dependencies: whatwg-url: 5.0.0 optionalDependencies: encoding: 0.1.13 + node-fetch@3.3.2: + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + node-gyp@7.1.2: dependencies: env-paths: 2.2.1 @@ -12427,6 +12699,8 @@ snapshots: npm-normalize-package-bin@1.0.1: {} + npm-normalize-package-bin@3.0.1: {} + npm-package-arg@8.1.5: dependencies: hosted-git-info: 4.1.0 @@ -13072,6 +13346,8 @@ snapshots: transitivePeerDependencies: - supports-color + read-cmd-shim@4.0.0: {} + read-package-json-fast@2.0.3: dependencies: json-parse-even-better-errors: 2.3.1 @@ -13262,6 +13538,10 @@ snapshots: dependencies: glob: 7.2.3 + rimraf@5.0.9: + dependencies: + glob: 10.4.5 + ripemd160@2.0.2: dependencies: hash-base: 3.1.0 @@ -13736,6 +14016,15 @@ snapshots: transitivePeerDependencies: - supports-color + supabase@1.187.8: + dependencies: + bin-links: 4.0.4 + https-proxy-agent: 7.0.5 + node-fetch: 3.3.2 + tar: 7.4.2 + transitivePeerDependencies: + - supports-color + superjson@2.2.1: dependencies: copy-anything: 3.0.5 @@ -13774,6 +14063,15 @@ snapshots: mkdirp: 1.0.4 yallist: 4.0.0 + tar@7.4.2: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.2 + minizlib: 3.0.1 + mkdirp: 3.0.1 + yallist: 5.0.0 + temp@0.9.4: dependencies: mkdirp: 0.5.6 @@ -14148,6 +14446,8 @@ snapshots: v8-compile-cache-lib@3.0.1: {} + valibot@0.33.3: {} + valibot@0.36.0: {} validate-npm-package-license@3.0.4: @@ -14161,6 +14461,12 @@ snapshots: vary@1.1.2: {} + vee-validate@4.13.2(vue@3.4.34(typescript@5.5.4)): + dependencies: + '@vue/devtools-api': 6.6.3 + type-fest: 4.23.0 + vue: 3.4.34(typescript@5.5.4) + verror@1.10.0: dependencies: assert-plus: 1.0.0 @@ -14317,6 +14623,10 @@ snapshots: vue-component-type-helpers@2.0.26: {} + vue-demi@0.13.11(vue@3.4.34(typescript@5.5.4)): + dependencies: + vue: 3.4.34(typescript@5.5.4) + vue-demi@0.14.8(vue@3.4.34(typescript@5.5.4)): dependencies: vue: 3.4.34(typescript@5.5.4) @@ -14376,6 +14686,8 @@ snapshots: dependencies: defaults: 1.0.4 + web-streams-polyfill@3.3.3: {} + web-worker@1.3.0: {} webidl-conversions@3.0.1: {} @@ -14469,6 +14781,11 @@ snapshots: signal-exit: 3.0.7 typedarray-to-buffer: 3.1.5 + write-file-atomic@5.0.1: + dependencies: + imurmurhash: 0.1.4 + signal-exit: 4.1.0 + ws@7.5.10: {} ws@8.18.0: {} @@ -14503,6 +14820,8 @@ snapshots: yallist@4.0.0: {} + yallist@5.0.0: {} + yargs-parser@20.2.9: {} yargs-parser@21.1.1: {} diff --git a/src/main.ts b/src/main.ts index 5e023ea..732254b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -216,8 +216,6 @@ exec "${process.execPath}" "$@" } } satisfies ParseArgsConfig - logger.info('config', config) - const { values } = parseArgs(config) logger.info('values', values) diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 47fd905..5fe40ea 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -35,6 +35,17 @@ +
+ + +
+
v{{ appVersion }}
@@ -44,6 +55,160 @@ + + + + +
+
+
+
+ +
+
+ + + {{ errors.email }} + + +
+ + + + + + {{ errors.password }} + + +
+ +
+ +
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+ + + {{ errors.email }} + + +
+ + + + + + + + + + {{ errors.password }} + + +
+ +
+ +
+ +
+
+
+
+
+
+
@@ -91,11 +91,16 @@ const props = defineProps({ const { value } = toRefs(props) const editor = useEditor() -const { getNodeDefinition, getPluginDefinition, setTriggerValue, addNode, removeNode } = editor +const { getNodeDefinition, getPluginDefinition, setTriggerValue, addNode, removeTrigger } = editor const { activeNode } = storeToRefs(editor) const nodeDefinition = computed(() => { - return getNodeDefinition(value.value.origin.nodeId, value.value.origin.pluginId).node as Event + console.log('value', value) + const el = getNodeDefinition(value.value.origin.nodeId, value.value.origin.pluginId) + if (el) { + return el.node as Event + } + return undefined }) const pluginDefinition = computed(() => { diff --git a/src/renderer/components/nodes/EditorNodeEventEmpty.vue b/src/renderer/components/nodes/EditorNodeEventEmpty.vue new file mode 100644 index 0000000..83dd033 --- /dev/null +++ b/src/renderer/components/nodes/EditorNodeEventEmpty.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/src/renderer/pages/editor.vue b/src/renderer/pages/editor.vue index a5d3830..f0fdebb 100644 --- a/src/renderer/pages/editor.vue +++ b/src/renderer/pages/editor.vue @@ -77,7 +77,7 @@
- + { const fileToRead = paths.filePaths[0] console.log('fileToRead', fileToRead) - const newId = nanoid() + let newId = nanoid() - const alreadyAddedPaths = Object.values(files.value.data).map((file) => { + const alreadyAddedPaths = Object.entries(files.value.data).map(([id, file]) => { if (file.type === 'external') { - return file.path + return { + ...file, + id + } } }) - if (alreadyAddedPaths.includes(fileToRead)) { - console.error('File already added') - } else { - // save file to store - updateFileStore((state) => { - state.data[newId] = { - lastModified: new Date().toISOString(), - path: fileToRead, - summary: { - description: '', - name: '', - plugins: [] - }, - type: 'external' - } - }) + + const foundElement = alreadyAddedPaths.find((x) => x.path === fileToRead) + + if (foundElement) { + newId = foundElement.id } + // save file to store + updateFileStore((state) => { + state.data[newId] = { + lastModified: new Date().toISOString(), + path: fileToRead, + summary: { + description: '', + name: '', + plugins: [] + }, + type: 'external' + } + }) await router.push({ name: 'Editor', @@ -207,7 +212,7 @@ const openFile = async () => { * and save it to user location */ const newFile = async () => { - const id = nanoid() + let id = nanoid() const presets = await api.execute('presets:get') @@ -237,35 +242,37 @@ const newFile = async () => { let path = paths.filePath - const alreadyAddedPaths = Object.values(files.value.data).map((file) => { + const alreadyAddedPaths = Object.entries(files.value.data).map(([id, file]) => { if (file.type === 'external') { - return file.path + return { + ...file, + id + } } }) - if (alreadyAddedPaths.includes(path)) { - console.error('File already added') - } else { - // update file store - updateFileStore((state) => { - console.log('state', state) - - if (state.data[id]) { - throw new Error('Cannot replace file when creating a new one') - } else { - state.data[id] = { - lastModified: new Date().toISOString(), - path, - summary: { - description: '', - name: '', - plugins: [] - }, - type: 'external' - } - } - }) + + const foundExisting = alreadyAddedPaths.find((x) => x.path === path) + + if (foundExisting && foundExisting.type === 'external') { + id = foundExisting.id } + // update file store + updateFileStore((state) => { + console.log('state', state) + + state.data[id] = { + lastModified: new Date().toISOString(), + path, + summary: { + description: '', + name: '', + plugins: [] + }, + type: 'external' + } + }) + // write file await api.execute('fs:write', { path, diff --git a/src/renderer/store/auth.ts b/src/renderer/store/auth.ts new file mode 100644 index 0000000..3c4f2e9 --- /dev/null +++ b/src/renderer/store/auth.ts @@ -0,0 +1,35 @@ +import { supabase } from "@@/supabase"; +import { User } from "@supabase/supabase-js"; +import { defineStore } from "pinia"; +import { shallowRef } from "vue"; + +export const useAuth = defineStore('auth', () => { + const user = shallowRef() + + const init = async () => { + const { data: { user: supaUser } } = await supabase.auth.getUser() + + console.log('supaUser', supaUser) + user.value = supaUser + } + + const login = async (email: string, password: string) => { + const { data: user } = await supabase.auth.signInWithPassword({ email, password }) + + console.log('user', user) + } + + const register = async (email: string, password: string) => { + const { data: user } = await supabase.auth.signUp({ email, password }) + + console.log('user', user) + } + + return { + user, + + init, + login, + register, + } +}) diff --git a/src/renderer/store/editor.ts b/src/renderer/store/editor.ts index 52a5667..5af992d 100644 --- a/src/renderer/store/editor.ts +++ b/src/renderer/store/editor.ts @@ -17,7 +17,7 @@ import { defineStore, storeToRefs } from 'pinia' import get from 'get-value' import set from 'set-value' import { nanoid } from 'nanoid' -import { AddNodeEvent } from '@renderer/components/AddNodeButton.model' +import { AddNodeEvent, AddTriggerEvent } from '@renderer/components/AddNodeButton.model' import { useAppStore } from './app' import { SaveLocation } from '@@/save-location' import { FileRepo, useFiles } from './files' @@ -188,6 +188,7 @@ export const useEditor = defineStore('editor', () => { const clear = () => { blocks.value = [] variables.value = [] + triggers.value = [] setActiveNode() console.log('clear') } @@ -308,6 +309,16 @@ export const useEditor = defineStore('editor', () => { } } + const removeTrigger = (triggerId: string) => { + const triggerIndex = triggers.value.findIndex((b) => b.uid === triggerId) + if (triggerIndex > -1) { + triggers.value = [ + ...triggers.value.slice(0, triggerIndex), + ...triggers.value.slice(triggerIndex + 1, undefined) + ] + } + } + const setBlockValue = (nodeId: string, value: Block) => { const nodeIndex = blocks.value.findIndex((b) => b.uid === nodeId) console.log('nodeIndex', nodeIndex) @@ -387,6 +398,61 @@ export const useEditor = defineStore('editor', () => { } } + const addTrigger = (event: AddTriggerEvent) => { + console.log('event', event) + console.log('nodeDefinitions', nodeDefinitions.value) + + const { trigger: triggerDefinition, path, plugin: pluginDefinition, insertAt } = event + + if (triggerDefinition && pluginDefinition) { + if (isEventDefinition(triggerDefinition)) { + const node: BlockEvent = { + uid: nanoid(), + type: triggerDefinition.type, + origin: { + nodeId: triggerDefinition.id, + pluginId: pluginDefinition.id + }, + params: {} + } + addTriggerToBlock(node, path, insertAt) + } else { + console.error('Unhandled', triggerDefinition) + } + } + } + + const addTriggerToBlock = (node: BlockEvent, path: string[], insertAt: number) => { + console.log('path', path) + console.log('insertAt', insertAt) + const value = path.length === 0 ? triggers.value : get(triggers.value, path) + console.log('value', value) + + const firstPart = value.slice(0, insertAt) + const secondPart = value.slice(insertAt + 1) + + console.log('firstPart', firstPart) + console.log('secondPart', secondPart) + + const newValue = [ + ...value.slice(0, insertAt), + node, + ...value.slice( + insertAt // already has +1 + ) + ] + console.log('newValue', newValue) + if (path.length === 0) { + triggers.value = newValue + } else { + set(triggers.value, path, newValue) + } + + console.log('triggers.value', triggers.value) + + return + } + const addNodeToBlock = (node: Block, path: string[], insertAt: number) => { console.log('path', path) console.log('insertAt', insertAt) @@ -454,11 +520,16 @@ export const useEditor = defineStore('editor', () => { setBlockValue, setTriggerValue, removeNode, + removeTrigger, clear, loadSavedFile, addNode, addNodeToBlock, + + addTrigger, + addTriggerToBlock, + addVariable, getPluginDefinition, getNodeDefinition, diff --git a/src/shared/database.types.ts b/src/shared/database.types.ts new file mode 100644 index 0000000..548d080 --- /dev/null +++ b/src/shared/database.types.ts @@ -0,0 +1,109 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + public: { + Tables: { + [_ in never]: never + } + Views: { + [_ in never]: never + } + Functions: { + [_ in never]: never + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type PublicSchema = Database[Extract] + +export type Tables< + PublicTableNameOrOptions extends + | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & + PublicSchema["Views"]) + ? (PublicSchema["Tables"] & + PublicSchema["Views"])[PublicTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + PublicEnumNameOrOptions extends + | keyof PublicSchema["Enums"] + | { schema: keyof Database }, + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = PublicEnumNameOrOptions extends { schema: keyof Database } + ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] + : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] + ? PublicSchema["Enums"][PublicEnumNameOrOptions] + : never diff --git a/src/shared/supabase.ts b/src/shared/supabase.ts new file mode 100644 index 0000000..a4d968c --- /dev/null +++ b/src/shared/supabase.ts @@ -0,0 +1,9 @@ +import { createClient } from '@supabase/supabase-js' +import { Database } from './database.types' + +export const supabase = createClient( + // @ts-expect-error + import.meta.env.VITE_SUPABASE_URL, + // @ts-expect-error + import.meta.env.VITE_SUPABASE_ANON_KEY +)