From ff047f910f5a7059dc22c9310fe96f89148bc28c Mon Sep 17 00:00:00 2001 From: Eddy Chen <89349085+ecxyzzy@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:15:57 -0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E2=9C=A8=20migrate=20to=20drizzle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 13 +- pnpm-lock.yaml | 604 ++++++++++++++++-------- prisma/schema.prisma | 79 ---- src/lib/db/schema.ts | 108 +++++ src/lib/schema/types.ts | 7 +- src/lib/server/drizzle.ts | 6 + src/lib/server/lucia.ts | 6 +- src/lib/server/postgres.ts | 5 + src/lib/server/prisma.ts | 3 - src/routes/api/companies/+server.ts | 23 +- src/routes/api/contacts/+server.ts | 68 +-- src/routes/api/contacts/[id]/+server.ts | 8 +- src/routes/api/members/+server.ts | 35 +- src/routes/api/members/[id]/+server.ts | 17 +- src/routes/api/members/count/+server.ts | 15 +- sst.config.ts | 154 +----- svelte.config.js | 6 +- 17 files changed, 633 insertions(+), 524 deletions(-) delete mode 100644 prisma/schema.prisma create mode 100644 src/lib/db/schema.ts create mode 100644 src/lib/server/drizzle.ts create mode 100644 src/lib/server/postgres.ts delete mode 100644 src/lib/server/prisma.ts diff --git a/package.json b/package.json index eb31ca9..8d7e5be 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "dev": "vite dev", "format": "prettier --write .", - "postinstall": "husky install && prisma generate && svelte-kit sync", + "postinstall": "husky install && svelte-kit sync", "lint": "eslint --quiet --fix .", "preview": "vite preview", "sst:deploy": "sst deploy", @@ -19,15 +19,16 @@ "test:unit": "vitest" }, "dependencies": { - "@lucia-auth/adapter-prisma": "3.0.2", + "@lucia-auth/adapter-postgresql": "2.0.2", "@lucia-auth/oauth": "3.5.0", - "@melt-ui/svelte": "^0.61.1", - "@prisma/client": "5.5.2", + "@melt-ui/svelte": "0.61.1", "@tanstack/svelte-query": "5.8.2", + "drizzle-orm": "^0.29.3", "googleapis": "128.0.0", "lucia": "2.7.4", "lucide-svelte": "0.292.0", - "mimetext": "^3.0.16", + "mimetext": "3.0.16", + "postgres": "3.4.3", "zod": "3.22.4" }, "devDependencies": { @@ -49,6 +50,7 @@ "constructs": "10.3.0", "cz-conventional-changelog": "3.3.0", "devmoji": "2.3.0", + "drizzle-kit": "0.20.14", "eslint": "8.53.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-import": "2.29.0", @@ -59,7 +61,6 @@ "prettier-plugin-packagejson": "2.4.6", "prettier-plugin-prisma": "5.0.0", "prettier-plugin-svelte": "3.1.0", - "prisma": "5.5.2", "sass": "1.69.5", "sst": "2.36.1", "svelte": "4.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4125400..cecd960 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,21 +5,21 @@ settings: excludeLinksFromLockfile: false dependencies: - '@lucia-auth/adapter-prisma': - specifier: 3.0.2 - version: 3.0.2(@prisma/client@5.5.2)(lucia@2.7.4) + '@lucia-auth/adapter-postgresql': + specifier: 2.0.2 + version: 2.0.2(lucia@2.7.4)(postgres@3.4.3) '@lucia-auth/oauth': specifier: 3.5.0 version: 3.5.0(lucia@2.7.4) '@melt-ui/svelte': - specifier: ^0.61.1 - version: 0.61.3(svelte@4.2.3) - '@prisma/client': - specifier: 5.5.2 - version: 5.5.2(prisma@5.5.2) + specifier: 0.61.1 + version: 0.61.1(svelte@4.2.3) '@tanstack/svelte-query': specifier: 5.8.2 version: 5.8.2(svelte@4.2.3) + drizzle-orm: + specifier: ^0.29.3 + version: 0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(postgres@3.4.3)(react@18.2.0) googleapis: specifier: 128.0.0 version: 128.0.0 @@ -30,8 +30,11 @@ dependencies: specifier: 0.292.0 version: 0.292.0(svelte@4.2.3) mimetext: - specifier: ^3.0.16 - version: 3.0.21 + specifier: 3.0.16 + version: 3.0.16 + postgres: + specifier: 3.4.3 + version: 3.4.3 zod: specifier: 3.22.4 version: 3.22.4 @@ -48,7 +51,7 @@ devDependencies: version: 18.4.0 '@melt-ui/pp': specifier: ^0.1.4 - version: 0.1.4(@melt-ui/svelte@0.61.3)(svelte@4.2.3) + version: 0.1.4(@melt-ui/svelte@0.61.1)(svelte@4.2.3) '@playwright/test': specifier: 1.39.0 version: 1.39.0 @@ -91,6 +94,9 @@ devDependencies: devmoji: specifier: 2.3.0 version: 2.3.0 + drizzle-kit: + specifier: 0.20.14 + version: 0.20.14 eslint: specifier: 8.53.0 version: 8.53.0 @@ -121,9 +127,6 @@ devDependencies: prettier-plugin-svelte: specifier: 3.1.0 version: 3.1.0(prettier@3.1.0)(svelte@4.2.3) - prisma: - specifier: 5.5.2 - version: 5.5.2 sass: specifier: 1.69.5 version: 1.69.5 @@ -277,7 +280,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.515.0 tslib: 1.14.1 - dev: true /@aws-crypto/crc32c@3.0.0: resolution: {integrity: sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==} @@ -291,7 +293,6 @@ packages: resolution: {integrity: sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==} dependencies: tslib: 1.14.1 - dev: true /@aws-crypto/sha1-browser@3.0.0: resolution: {integrity: sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==} @@ -316,7 +317,6 @@ packages: '@aws-sdk/util-locate-window': 3.495.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: true /@aws-crypto/sha256-js@3.0.0: resolution: {integrity: sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==} @@ -324,7 +324,6 @@ packages: '@aws-crypto/util': 3.0.0 '@aws-sdk/types': 3.515.0 tslib: 1.14.1 - dev: true /@aws-crypto/sha256-js@5.2.0: resolution: {integrity: sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==} @@ -339,7 +338,6 @@ packages: resolution: {integrity: sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==} dependencies: tslib: 1.14.1 - dev: true /@aws-crypto/util@3.0.0: resolution: {integrity: sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==} @@ -347,7 +345,6 @@ packages: '@aws-sdk/types': 3.515.0 '@aws-sdk/util-utf8-browser': 3.259.0 tslib: 1.14.1 - dev: true /@aws-crypto/util@5.2.0: resolution: {integrity: sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==} @@ -801,7 +798,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: true /@aws-sdk/client-s3@3.515.0: resolution: {integrity: sha512-K527n83hrMUdosxOYTzL63wtlJtmN5SUJZnGY1sUR6UyOrnOr9lS6t3AB6BgHqLFRFZJqSqmhflv2cOD7P1UPg==} @@ -967,7 +963,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: true /@aws-sdk/client-sso@3.515.0: resolution: {integrity: sha512-4oGBLW476zmkdN98lAns3bObRNO+DLOfg4MDUSR6l6GYBV/zGAtoy2O/FhwYKgA2L5h2ZtElGopLlk/1Q0ePLw==} @@ -1013,7 +1008,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: true /@aws-sdk/client-sts@3.515.0(@aws-sdk/credential-provider-node@3.515.0): resolution: {integrity: sha512-ScYuvaIDgip3atOJIA1FU2n0gJkEdveu1KrrCPathoUCV5zpK8qQmO/n+Fj/7hKFxeKdFbB+4W4CsJWYH94nlg==} @@ -1063,7 +1057,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: true /@aws-sdk/config-resolver@3.374.0: resolution: {integrity: sha512-eTSbmpcgZ97o7PuFls8pH1344OS03nfqq1NO9HxxvoYoZ6DFfUO7kqKeNUhP9LxOF7slyHXajDT7eoPclGnTuw==} @@ -1084,7 +1077,6 @@ packages: '@smithy/smithy-client': 2.3.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/credential-provider-cognito-identity@3.515.0: resolution: {integrity: sha512-pWMJFhNc6bLbCpKhYXWWa23wMyhpFFyw3kF/6ea+95JQHF0FY2l4wDQa7ynE4hW4Wf5oA3Sf7Wf87pp9iAHubQ==} @@ -1107,7 +1099,6 @@ packages: '@smithy/property-provider': 2.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/credential-provider-http@3.515.0: resolution: {integrity: sha512-Ba6FXK77vU4WyheiamNjEuTFmir0eAXuJGPO27lBaA8g+V/seXGHScsbOG14aQGDOr2P02OPwKGZrWWA7BFpfQ==} @@ -1122,7 +1113,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-stream': 2.1.1 tslib: 2.6.2 - dev: true /@aws-sdk/credential-provider-ini@3.515.0(@aws-sdk/credential-provider-node@3.515.0): resolution: {integrity: sha512-ouDlNZdv2TKeVEA/YZk2+XklTXyAAGdbWnl4IgN9ItaodWI+lZjdIoNC8BAooVH+atIV/cZgoGTGQL7j2TxJ9A==} @@ -1142,7 +1132,6 @@ packages: transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt - dev: true /@aws-sdk/credential-provider-node@3.515.0: resolution: {integrity: sha512-Y4kHSpbxksiCZZNcvsiKUd8Fb2XlyUuONEwqWFNL82ZH6TCCjBGS31wJQCSxBHqYcOL3tiORUEJkoO7uS30uQA==} @@ -1162,7 +1151,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - aws-crt - dev: true /@aws-sdk/credential-provider-process@3.515.0: resolution: {integrity: sha512-pSjiOA2FM63LHRKNDvEpBRp80FVGT0Mw/gzgbqFXP+sewk0WVonYbEcMDTJptH3VsLPGzqH/DQ1YL/aEIBuXFQ==} @@ -1173,7 +1161,6 @@ packages: '@smithy/shared-ini-file-loader': 2.3.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/credential-provider-sso@3.515.0(@aws-sdk/credential-provider-node@3.515.0): resolution: {integrity: sha512-j7vUkiSmuhpBvZYoPTRTI4ePnQbiZMFl6TNhg9b9DprC1zHkucsZnhRhqjOVlrw/H6J4jmcPGcHHTZ5WQNI5xQ==} @@ -1189,7 +1176,6 @@ packages: transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt - dev: true /@aws-sdk/credential-provider-web-identity@3.515.0(@aws-sdk/credential-provider-node@3.515.0): resolution: {integrity: sha512-66+2g4z3fWwdoGReY8aUHvm6JrKZMTRxjuizljVmMyOBttKPeBYXvUTop/g3ZGUx1f8j+C5qsGK52viYBvtjuQ==} @@ -1203,7 +1189,6 @@ packages: transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt - dev: true /@aws-sdk/credential-providers@3.515.0: resolution: {integrity: sha512-XQ9maVLTtv6iJbOYiRS+IvaPlFkJDuxfpfxuky3aPzQpxDilU4cf1CfIDua8qivZKQ4QQOd1EaBMXPIpLI1ZTQ==} @@ -1274,7 +1259,6 @@ packages: '@smithy/protocol-http': 3.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/middleware-location-constraint@3.515.0: resolution: {integrity: sha512-ORFC5oijjTJsHhUXy9o52/vl5Irf6e83bE/8tBp+sVVx81+E8zTTWZbysoa41c0B5Ycd0H3wCWutvjdXT16ydQ==} @@ -1292,7 +1276,6 @@ packages: '@aws-sdk/types': 3.515.0 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/middleware-recursion-detection@3.515.0: resolution: {integrity: sha512-dokHLbTV3IHRIBrw9mGoxcNTnQsjlm7TpkJhPdGT9T4Mq399EyQo51u6IsVMm07RXLl2Zw7u+u9p+qWBFzmFRA==} @@ -1302,7 +1285,6 @@ packages: '@smithy/protocol-http': 3.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/middleware-retry@3.374.0: resolution: {integrity: sha512-ZnT84qnT+Zmelv7y6hAqgAEaZgpGlrvf/+rchNWT0oG4duxI5bLWcRi9U88Jz7G8JgNQcGKJqPfC6oogCd7p8w==} @@ -1360,7 +1342,6 @@ packages: '@smithy/protocol-http': 3.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/region-config-resolver@3.515.0: resolution: {integrity: sha512-RIRx9loxMgEAc/r1wPfnfShOuzn4RBi8pPPv6/jhhITEeMnJe6enAh2k5y9DdiVDDgCWZgVFSv0YkAIfzAFsnQ==} @@ -1372,7 +1353,6 @@ packages: '@smithy/util-config-provider': 2.2.1 '@smithy/util-middleware': 2.1.1 tslib: 2.6.2 - dev: true /@aws-sdk/signature-v4-crt@3.515.0: resolution: {integrity: sha512-bfWsHyNg6+b+97MpJ3frfJfHjXcL7NEk252Al7bhNyhKJnPGhbhDXiudvDE+uiINoZgIJ59xqBBQQdB8ymS4RQ==} @@ -1428,7 +1408,6 @@ packages: transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt - dev: true /@aws-sdk/types@3.515.0: resolution: {integrity: sha512-B3gUpiMlpT6ERaLvZZ61D0RyrQPsFYDkCncLPVkZOKkCOoFU46zi1o6T5JcYiz8vkx1q9RGloQ5exh79s5pU/w==} @@ -1436,7 +1415,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@aws-sdk/util-arn-parser@3.495.0: resolution: {integrity: sha512-hwdA3XAippSEUxs7jpznwD63YYFR+LtQvlEcebPTgWR9oQgG9TfS+39PUfbnEeje1ICuOrN3lrFqFbmP9uzbMg==} @@ -1453,14 +1431,12 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-endpoints': 1.1.1 tslib: 2.6.2 - dev: true /@aws-sdk/util-locate-window@3.495.0: resolution: {integrity: sha512-MfaPXT0kLX2tQaR90saBT9fWQq2DHqSSJRzW+MZWsmF+y5LGCOhO22ac/2o6TKSQm7h0HRc2GaADqYYYor62yg==} engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@aws-sdk/util-user-agent-browser@3.515.0: resolution: {integrity: sha512-pTWQb0JCafTmLHLDv3Qqs/nAAJghcPdGQIBpsCStb0YEzg3At/dOi2AIQ683yYnXmeOxLXJDzmlsovfVObJScw==} @@ -1469,7 +1445,6 @@ packages: '@smithy/types': 2.9.1 bowser: 2.11.0 tslib: 2.6.2 - dev: true /@aws-sdk/util-user-agent-node@3.515.0(aws-crt@1.21.1): resolution: {integrity: sha512-A/KJ+/HTohHyVXLH+t/bO0Z2mPrQgELbQO8tX+B2nElo8uklj70r5cT7F8ETsI9oOy+HDVpiL5/v45ZgpUOiPg==} @@ -1485,13 +1460,11 @@ packages: '@smithy/types': 2.9.1 aws-crt: 1.21.1 tslib: 2.6.2 - dev: true /@aws-sdk/util-utf8-browser@3.259.0: resolution: {integrity: sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==} dependencies: tslib: 2.6.2 - dev: true /@aws-sdk/xml-builder@3.496.0: resolution: {integrity: sha512-GvEjh537IIeOw1ZkZuB37sV12u+ipS5Z1dwjEC/HAvhl5ac23ULtTr1/n+U1gLNN+BAKSWjKiQ2ksj8DiUzeyw==} @@ -1897,6 +1870,12 @@ packages: chalk: 4.1.2 dev: true + /@drizzle-team/studio@0.0.39: + resolution: {integrity: sha512-c5Hkm7MmQC2n5qAsKShjQrHoqlfGslB8+qWzsGGZ+2dHMRTNG60UuzalF0h0rvBax5uzPXuGkYLGaQ+TUX3yMw==} + dependencies: + superjson: 2.2.1 + dev: true + /@envelop/core@3.0.6: resolution: {integrity: sha512-06t1xCPXq6QFN7W1JUEf68aCwYN0OUDNAIoJe7bAqhaoa2vn7NCcuX1VHkJ/OWpmElUgCsRO6RiBbIru1in0Ig==} dependencies: @@ -1923,6 +1902,20 @@ packages: tslib: 2.6.2 dev: true + /@esbuild-kit/core-utils@3.3.2: + resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==} + dependencies: + esbuild: 0.18.20 + source-map-support: 0.5.21 + dev: true + + /@esbuild-kit/esm-loader@2.6.5: + resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==} + dependencies: + '@esbuild-kit/core-utils': 3.3.2 + get-tsconfig: 4.7.2 + dev: true + /@esbuild/aix-ppc64@0.19.12: resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} engines: {node: '>=12'} @@ -2671,7 +2664,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /@humanwhocodes/config-array@0.11.14: resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} @@ -2742,14 +2734,20 @@ packages: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - /@lucia-auth/adapter-prisma@3.0.2(@prisma/client@5.5.2)(lucia@2.7.4): - resolution: {integrity: sha512-EyJWZene1/zasPwPctv8wwNErZt5mwwm5JATbhg+kXr3R8pbC7lJfVzDTAeeFClVH5k/FywRcsBl3JkPaNIcow==} + /@lucia-auth/adapter-postgresql@2.0.2(lucia@2.7.4)(postgres@3.4.3): + resolution: {integrity: sha512-gQ7SlFu+gxQj2IX2J8ZVivcLBbdnf9SbNQOVWkJxZOdY1uaaIQGeNfEDld2Awy02VrXmA4sjHsbkJx1JPVw2+A==} peerDependencies: - '@prisma/client': ^4.2.0 || ^5.0.0 lucia: ^2.0.0 + pg: ^8.8.0 + postgres: ^3.3.0 + peerDependenciesMeta: + pg: + optional: true + postgres: + optional: true dependencies: - '@prisma/client': 5.5.2(prisma@5.5.2) lucia: 2.7.4 + postgres: 3.4.3 dev: false /@lucia-auth/oauth@3.5.0(lucia@2.7.4): @@ -2783,20 +2781,20 @@ packages: - supports-color dev: true - /@melt-ui/pp@0.1.4(@melt-ui/svelte@0.61.3)(svelte@4.2.3): + /@melt-ui/pp@0.1.4(@melt-ui/svelte@0.61.1)(svelte@4.2.3): resolution: {integrity: sha512-zR+Kl3CZJPJBHW8V7YcdQCMI/dVcnW9Ct3yGbVaIywYVStVRS7F9uEDOea3xLLT2WTGodQePzPlUn53yKFu87g==} engines: {pnpm: '>=8.6.3'} peerDependencies: '@melt-ui/svelte': '>= 0.29.0' svelte: ^3.55.0 || ^4.0.0 || ^5.0.0-next.1 dependencies: - '@melt-ui/svelte': 0.61.3(svelte@4.2.3) + '@melt-ui/svelte': 0.61.1(svelte@4.2.3) estree-walker: 3.0.3 svelte: 4.2.3 dev: true - /@melt-ui/svelte@0.61.3(svelte@4.2.3): - resolution: {integrity: sha512-6btfQJs1zfXpZ++vftqXCYCqAq3DDdAj3TbSn/myZbFPYLib/HoFKQryg1Ctts3tIxCATaYtVQZVfSWHm8ZdWQ==} + /@melt-ui/svelte@0.61.1(svelte@4.2.3): + resolution: {integrity: sha512-xG/rRK77yfzAWm0/KrB+NrJ3qzBALv7B3OoHGyLSfFXIGum+CzklxtDH8gNSuCA6ENfuPnY7pwy390+LNqvdig==} peerDependencies: svelte: '>=3 <5' dependencies: @@ -2886,28 +2884,6 @@ packages: resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} dev: true - /@prisma/client@5.5.2(prisma@5.5.2): - resolution: {integrity: sha512-54XkqR8M+fxbzYqe+bIXimYnkkcGqgOh0dn0yWtIk6CQT4IUCAvNFNcQZwk2KqaLU+/1PHTSWrcHtx4XjluR5w==} - engines: {node: '>=16.13'} - requiresBuild: true - peerDependencies: - prisma: '*' - peerDependenciesMeta: - prisma: - optional: true - dependencies: - '@prisma/engines-version': 5.5.1-1.aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a - prisma: 5.5.2 - dev: false - - /@prisma/engines-version@5.5.1-1.aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a: - resolution: {integrity: sha512-O+qHFnZvAyOFk1tUco2/VdiqS0ym42a3+6CYLScllmnpbyiTplgyLt2rK/B9BTjYkSHjrgMhkG47S0oqzdIckA==} - dev: false - - /@prisma/engines@5.5.2: - resolution: {integrity: sha512-Be5hoNF8k+lkB3uEMiCHbhbfF6aj1GnrTBnn5iYFT7GEr3TsOEp1soviEcBR0tYCgHbxjcIxJMhdbvxALJhAqg==} - requiresBuild: true - /@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584: resolution: {integrity: sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==} dev: true @@ -2946,7 +2922,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/chunked-blob-reader-native@2.1.1: resolution: {integrity: sha512-zNW+43dltfNMUrBEYLMWgI8lQr0uhtTcUyxkgC9EP4j17WREzgSFMPUFVrVV6Rc2+QtWERYjb4tzZnQGa7R9fQ==} @@ -2980,7 +2955,6 @@ packages: '@smithy/util-config-provider': 2.2.1 '@smithy/util-middleware': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/core@1.3.2: resolution: {integrity: sha512-tYDmTp0f2TZVE18jAOH1PnmkngLQ+dOGUlMd1u67s87ieueNeyqhja6z/Z4MxhybEiXKOWFOmGjfTZWFxljwJw==} @@ -2994,7 +2968,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-middleware': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/credential-provider-imds@2.2.1: resolution: {integrity: sha512-7XHjZUxmZYnONheVQL7j5zvZXga+EWNgwEAP6OPZTi7l8J4JTeNh9aIOfE5fKHZ/ee2IeNOh54ZrSna+Vc6TFA==} @@ -3005,7 +2978,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/url-parser': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/eventstream-codec@2.1.1: resolution: {integrity: sha512-E8KYBxBIuU4c+zrpR22VsVrOPoEDzk35bQR3E+xm4k6Pa6JqzkDOdMyf9Atac5GPNKHJBdVaQ4JtjdWX2rl/nw==} @@ -3014,7 +2986,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-hex-encoding': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/eventstream-serde-browser@2.1.1: resolution: {integrity: sha512-JvEdCmGlZUay5VtlT8/kdR6FlvqTDUiJecMjXsBb0+k1H/qc9ME5n2XKPo8q/MZwEIA1GmGgYMokKGjVvMiDow==} @@ -3069,7 +3040,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-base64': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/hash-blob-browser@2.1.1: resolution: {integrity: sha512-jizu1+2PAUjiGIfRtlPEU8Yo6zn+d78ti/ZHDesdf1SUn2BuZW433JlPoCOLH3dBoEEvTgLvQ8tUGSoTTALA+A==} @@ -3088,7 +3058,6 @@ packages: '@smithy/util-buffer-from': 2.1.1 '@smithy/util-utf8': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/hash-stream-node@2.1.1: resolution: {integrity: sha512-VgDaKcfCy0iHcmtAZgZ3Yw9g37Gkn2JsQiMtFQXUh8Wmo3GfNgDwLOtdhJ272pOT7DStzpe9cNr+eV5Au8KfQA==} @@ -3104,7 +3073,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/is-array-buffer@1.1.0: resolution: {integrity: sha512-twpQ/n+3OWZJ7Z+xu43MJErmhB/WO/mMTnqR6PwWQShvSJ/emx5d1N59LQZk6ZpTAeuRWrc+eHhkzTp9NFjNRQ==} @@ -3118,7 +3086,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/md5-js@2.1.1: resolution: {integrity: sha512-L3MbIYBIdLlT+MWTYrdVSv/dow1+6iZ1Ad7xS0OHxTTs17d753ZcpOV4Ro7M7tRAVWML/sg2IAp/zzCb6aAttg==} @@ -3135,7 +3102,6 @@ packages: '@smithy/protocol-http': 3.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/middleware-endpoint@2.4.1: resolution: {integrity: sha512-XPZTb1E2Oav60Ven3n2PFx+rX9EDsU/jSTA8VDamt7FXks67ekjPY/XrmmPDQaFJOTUHJNKjd8+kZxVO5Ael4Q==} @@ -3148,7 +3114,6 @@ packages: '@smithy/url-parser': 2.1.1 '@smithy/util-middleware': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/middleware-retry@1.1.0: resolution: {integrity: sha512-lINKYxIvT+W20YFOtHBKeGm7npuJg0/YCoShttU7fVpsmU+a2rdb9zrJn1MHqWfUL6DhTAWGa0tH2O7l4XrDcw==} @@ -3176,7 +3141,6 @@ packages: '@smithy/util-retry': 2.1.1 tslib: 2.6.2 uuid: 8.3.2 - dev: true /@smithy/middleware-serde@2.1.1: resolution: {integrity: sha512-D8Gq0aQBeE1pxf3cjWVkRr2W54t+cdM2zx78tNrVhqrDykRA7asq8yVJij1u5NDtKzKqzBSPYh7iW0svUKg76g==} @@ -3184,7 +3148,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/middleware-stack@1.1.0: resolution: {integrity: sha512-XynYiIvXNea2BbLcppvpNK0zu8o2woJqgnmxqYTn4FWagH/Hr2QIk8LOsUz7BIJ4tooFhmx8urHKCdlPbbPDCA==} @@ -3199,7 +3162,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/node-config-provider@2.2.1: resolution: {integrity: sha512-epzK3x1xNxA9oJgHQ5nz+2j6DsJKdHfieb+YgJ7ATWxzNcB7Hc+Uya2TUck5MicOPhDV8HZImND7ZOecVr+OWg==} @@ -3209,7 +3171,6 @@ packages: '@smithy/shared-ini-file-loader': 2.3.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/node-http-handler@1.1.0: resolution: {integrity: sha512-d3kRriEgaIiGXLziAM8bjnaLn1fthCJeTLZIwEIpzQqe6yPX0a+yQoLCTyjb2fvdLwkMoG4p7THIIB5cj5lkbg==} @@ -3231,7 +3192,6 @@ packages: '@smithy/querystring-builder': 2.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/property-provider@2.1.1: resolution: {integrity: sha512-FX7JhhD/o5HwSwg6GLK9zxrMUrGnb3PzNBrcthqHKBc3dH0UfgEAU24xnJ8F0uow5mj17UeBEOI6o3CF2k7Mhw==} @@ -3239,7 +3199,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/protocol-http@1.2.0: resolution: {integrity: sha512-GfGfruksi3nXdFok5RhgtOnWe5f6BndzYfmEXISD+5gAGdayFGpjWu5pIqIweTudMtse20bGbc+7MFZXT1Tb8Q==} @@ -3255,7 +3214,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/querystring-builder@1.1.0: resolution: {integrity: sha512-gDEi4LxIGLbdfjrjiY45QNbuDmpkwh9DX4xzrR2AzjjXpxwGyfSpbJaYhXARw9p17VH0h9UewnNQXNwaQyYMDA==} @@ -3273,7 +3231,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-uri-escape': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/querystring-parser@2.1.1: resolution: {integrity: sha512-H4+6jKGVhG1W4CIxfBaSsbm98lOO88tpDWmZLgkJpt8Zkk/+uG0FmmqMuCAc3HNM2ZDV+JbErxr0l5BcuIf/XQ==} @@ -3281,7 +3238,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/service-error-classification@1.1.0: resolution: {integrity: sha512-OCTEeJ1igatd5kFrS2VDlYbainNNpf7Lj1siFOxnRWqYOP9oNvC5HOJBd3t+Z8MbrmehBtuDJ2QqeBsfeiNkww==} @@ -3293,7 +3249,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: '@smithy/types': 2.9.1 - dev: true /@smithy/shared-ini-file-loader@2.3.1: resolution: {integrity: sha512-2E2kh24igmIznHLB6H05Na4OgIEilRu0oQpYXo3LCNRrawHAcfDKq9004zJs+sAMt2X5AbY87CUCJ7IpqpSgdw==} @@ -3301,7 +3256,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/signature-v4@2.1.1: resolution: {integrity: sha512-Hb7xub0NHuvvQD3YwDSdanBmYukoEkhqBjqoxo+bSdC0ryV9cTfgmNjuAQhTPYB6yeU7hTR+sPRiFMlxqv6kmg==} @@ -3315,7 +3269,6 @@ packages: '@smithy/util-uri-escape': 2.1.1 '@smithy/util-utf8': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/smithy-client@1.1.0: resolution: {integrity: sha512-j32SGgVhv2G9nBTmel9u3OXux8KG20ssxuFakJrEeDug3kqbl1qrGzVLCe+Eib402UDtA0Sp1a4NZ2SEXDBxag==} @@ -3337,7 +3290,6 @@ packages: '@smithy/types': 2.9.1 '@smithy/util-stream': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/types@1.2.0: resolution: {integrity: sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==} @@ -3351,7 +3303,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/url-parser@2.1.1: resolution: {integrity: sha512-qC9Bv8f/vvFIEkHsiNrUKYNl8uKQnn4BdhXl7VzQRP774AwIjiSMMwkbT+L7Fk8W8rzYVifzJNYxv1HwvfBo3Q==} @@ -3359,7 +3310,6 @@ packages: '@smithy/querystring-parser': 2.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/util-base64@1.1.0: resolution: {integrity: sha512-FpYmDmVbOXAxqvoVCwqehUN0zXS+lN8V7VS9O7I8MKeVHdSTsZzlwiMEvGoyTNOXWn8luF4CTDYgNHnZViR30g==} @@ -3375,20 +3325,17 @@ packages: dependencies: '@smithy/util-buffer-from': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/util-body-length-browser@2.1.1: resolution: {integrity: sha512-ekOGBLvs1VS2d1zM2ER4JEeBWAvIOUKeaFch29UjjJsxmZ/f0L3K3x0dEETgh3Q9bkZNHgT+rkdl/J/VUqSRag==} dependencies: tslib: 2.6.2 - dev: true /@smithy/util-body-length-node@2.2.1: resolution: {integrity: sha512-/ggJG+ta3IDtpNVq4ktmEUtOkH1LW64RHB5B0hcr5ZaWBmo96UX2cIOVbjCqqDickTXqBWZ4ZO0APuaPrD7Abg==} engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/util-buffer-from@1.1.0: resolution: {integrity: sha512-9m6NXE0ww+ra5HKHCHig20T+FAwxBAm7DIdwc/767uGWbRcY720ybgPacQNB96JMOI7xVr/CDa3oMzKmW4a+kw==} @@ -3404,7 +3351,6 @@ packages: dependencies: '@smithy/is-array-buffer': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/util-config-provider@1.1.0: resolution: {integrity: sha512-rQ47YpNmF6Is4I9GiE3T3+0xQ+r7RKRKbmHYyGSbyep/0cSf9kteKcI0ssJTvveJ1K4QvwrxXj1tEFp/G2UqxQ==} @@ -3418,7 +3364,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/util-defaults-mode-browser@2.1.1: resolution: {integrity: sha512-lqLz/9aWRO6mosnXkArtRuQqqZBhNpgI65YDpww4rVQBuUT7qzKbDLG5AmnQTCiU4rOquaZO/Kt0J7q9Uic7MA==} @@ -3429,7 +3374,6 @@ packages: '@smithy/types': 2.9.1 bowser: 2.11.0 tslib: 2.6.2 - dev: true /@smithy/util-defaults-mode-node@2.2.0: resolution: {integrity: sha512-iFJp/N4EtkanFpBUtSrrIbtOIBf69KNuve03ic1afhJ9/korDxdM0c6cCH4Ehj/smI9pDCfVv+bqT3xZjF2WaA==} @@ -3442,7 +3386,6 @@ packages: '@smithy/smithy-client': 2.3.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/util-endpoints@1.1.1: resolution: {integrity: sha512-sI4d9rjoaekSGEtq3xSb2nMjHMx8QXcz2cexnVyRWsy4yQ9z3kbDpX+7fN0jnbdOp0b3KSTZJZ2Yb92JWSanLw==} @@ -3451,7 +3394,6 @@ packages: '@smithy/node-config-provider': 2.2.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/util-hex-encoding@1.1.0: resolution: {integrity: sha512-7UtIE9eH0u41zpB60Jzr0oNCQ3hMJUabMcKRUVjmyHTXiWDE4vjSqN6qlih7rCNeKGbioS7f/y2Jgym4QZcKFg==} @@ -3465,7 +3407,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/util-middleware@1.1.0: resolution: {integrity: sha512-6hhckcBqVgjWAqLy2vqlPZ3rfxLDhFWEmM7oLh2POGvsi7j0tHkbN7w4DFhuBExVJAbJ/qqxqZdRY6Fu7/OezQ==} @@ -3480,7 +3421,6 @@ packages: dependencies: '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/util-retry@1.1.0: resolution: {integrity: sha512-ygQW5HBqYXpR3ua09UciS0sL7UGJzGiktrKkOuEJwARoUuzz40yaEGU6xd9Gs7KBmAaFC8gMfnghHtwZ2nyBCQ==} @@ -3497,7 +3437,6 @@ packages: '@smithy/service-error-classification': 2.1.1 '@smithy/types': 2.9.1 tslib: 2.6.2 - dev: true /@smithy/util-stream@1.1.0: resolution: {integrity: sha512-w3lsdGsntaLQIrwDWJkIFKrFscgZXwU/oxsse09aSTNv5TckPhDeYea3LhsDrU5MGAG3vprhVZAKr33S45coVA==} @@ -3525,7 +3464,6 @@ packages: '@smithy/util-hex-encoding': 2.1.1 '@smithy/util-utf8': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/util-uri-escape@1.1.0: resolution: {integrity: sha512-/jL/V1xdVRt5XppwiaEU8Etp5WHZj609n0xMTuehmCqdoOFbId1M+aEeDWZsQ+8JbEB/BJ6ynY2SlYmOaKtt8w==} @@ -3539,7 +3477,6 @@ packages: engines: {node: '>=14.0.0'} dependencies: tslib: 2.6.2 - dev: true /@smithy/util-utf8@1.1.0: resolution: {integrity: sha512-p/MYV+JmqmPyjdgyN2UxAeYDj9cBqCjp0C/NsTWnnjoZUVqoeZ6IrW915L9CAKWVECgv9lVQGc4u/yz26/bI1A==} @@ -3555,7 +3492,6 @@ packages: dependencies: '@smithy/util-buffer-from': 2.1.1 tslib: 2.6.2 - dev: true /@smithy/util-waiter@2.1.1: resolution: {integrity: sha512-kYy6BLJJNif+uqNENtJqWdXcpqo1LS+nj1AfXcDhOpqpSHJSAkVySLyZV9fkmuVO21lzGoxjvd1imGGJHph/IA==} @@ -3691,10 +3627,23 @@ packages: tslib: 2.6.2 dev: true + /@tsconfig/esm@1.0.5: + resolution: {integrity: sha512-JzoZ0h299JRLPfV5VBsMq1TuMy+OmU9bdV/7NcjfRojL0eIcA1k5ESrtjWrDwJRJnk9B0QmgR0rq04LERbdfWw==} + deprecated: this package has been deprecated + dev: false + /@tsconfig/node18@18.2.2: resolution: {integrity: sha512-d6McJeGsuoRlwWZmVIeE8CUA27lu6jLjvv1JzqmpsytOYYbVi1tHZEnwCNVOXnj4pyLvneZlFlpXUK+X9wBWyw==} dev: true + /@tsconfig/node18@2.0.1: + resolution: {integrity: sha512-UqdfvuJK0SArA2CxhKWwwAWfnVSXiYe63bVpMutc27vpngCntGUZQETO24pEJ46zU6XM+7SpqYoMgcO3bM11Ew==} + dev: false + + /@tsconfig/strictest@2.0.3: + resolution: {integrity: sha512-MroLvRhMbqtXI5WBSwoomro6OQS4xnCoudUrMb20JO0vLKUs0bAaCEcvM/immEBSJjFAK1l6jW1oAO8q3Ancrg==} + dev: false + /@types/aws-lambda@8.10.126: resolution: {integrity: sha512-5eh4ffLdGYgGYI1Xr6W5L4IVse4RR7L2ns5OVUXA52nW5GFapIcGMcCzHAIMMOdpcQs3aGVxbvFlJNZH6IpgEQ==} dev: true @@ -3736,7 +3685,6 @@ packages: resolution: {integrity: sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==} dependencies: undici-types: 5.26.5 - dev: true /@types/normalize-package-data@2.4.4: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -3754,7 +3702,6 @@ packages: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} dependencies: '@types/node': 20.11.19 - dev: true /@typescript-eslint/eslint-plugin@6.10.0(@typescript-eslint/parser@6.10.0)(eslint@8.53.0)(typescript@5.2.2): resolution: {integrity: sha512-uoLj4g2OTL8rfUQVx2AFO1hp/zja1wABJq77P6IclQs6I/m9GLrm7jCdgzZkvWdDCQf1uEvoa8s8CupsgWQgVg==} @@ -4347,7 +4294,6 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: true /at-least-node@1.0.0: resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} @@ -4453,7 +4399,6 @@ packages: - debug - supports-color - utf-8-validate - dev: true /aws-iot-device-sdk@2.2.13: resolution: {integrity: sha512-rUR68vJxna5q0HSvBFy70QD0kFa91H8mQU2Jdor0JpNxmfNaOhQoiGCcgrZAxR69xY1kGHs+JzWOqqVtAfL0+A==} @@ -4493,7 +4438,6 @@ packages: proxy-from-env: 1.1.0 transitivePeerDependencies: - debug - dev: true /axobject-query@3.2.1: resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} @@ -4502,7 +4446,6 @@ packages: /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: true /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -4533,7 +4476,6 @@ packages: buffer: 5.7.1 inherits: 2.0.4 readable-stream: 3.6.2 - dev: true /bl@5.1.0: resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} @@ -4569,7 +4511,6 @@ packages: /bowser@2.11.0: resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} - dev: true /bplist-parser@0.2.0: resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==} @@ -4583,7 +4524,6 @@ packages: dependencies: balanced-match: 1.0.2 concat-map: 0.0.1 - dev: true /brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} @@ -4619,7 +4559,6 @@ packages: /buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - dev: true /buffer@4.9.2: resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==} @@ -4634,14 +4573,12 @@ packages: dependencies: base64-js: 1.5.1 ieee754: 1.2.1 - dev: true /buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} dependencies: base64-js: 1.5.1 ieee754: 1.2.1 - dev: true /builtin-modules@3.2.0: resolution: {integrity: sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==} @@ -4706,6 +4643,11 @@ packages: engines: {node: '>=6'} dev: true + /camelcase@7.0.1: + resolution: {integrity: sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==} + engines: {node: '>=14.16'} + dev: true + /caniuse-lite@1.0.30001588: resolution: {integrity: sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==} dev: true @@ -4808,6 +4750,17 @@ packages: engines: {node: '>=10'} dev: true + /cli-color@2.0.3: + resolution: {integrity: sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==} + engines: {node: '>=0.10'} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-iterator: 2.0.3 + memoizee: 0.4.15 + timers-ext: 0.1.7 + dev: true + /cli-cursor@3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} engines: {node: '>=8'} @@ -4913,7 +4866,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: true /commander@11.1.0: resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} @@ -4925,12 +4877,16 @@ packages: engines: {node: '>= 10'} dev: true + /commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + dev: true + /commist@1.1.0: resolution: {integrity: sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==} dependencies: leven: 2.1.0 minimist: 1.2.6 - dev: true /commitizen@4.3.0(@types/node@20.11.19)(typescript@5.2.2): resolution: {integrity: sha512-H0iNtClNEhT0fotHvGV3E9tDejDeS04sN1veIebsKYGMuGscFaswRoYJKmT3eW85eIJAs0F28bG2+a/9wCOfPw==} @@ -4975,7 +4931,6 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: true /concat-stream@2.0.0: resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==} @@ -4985,7 +4940,6 @@ packages: inherits: 2.0.4 readable-stream: 3.6.2 typedarray: 0.0.6 - dev: true /conf@10.2.0: resolution: {integrity: sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==} @@ -5076,6 +5030,13 @@ packages: engines: {node: '>= 0.6'} dev: true + /copy-anything@3.0.5: + resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} + engines: {node: '>=12.13'} + dependencies: + is-what: 4.1.16 + dev: true + /core-js-pure@3.36.0: resolution: {integrity: sha512-cN28qmhRNgbMZZMc/RFu5w8pK9VJzpb2rJVR/lHuZJKwmXnoWOpXmMkxqBB514igkp1Hu8WGROsiOAzUcKdHOQ==} requiresBuild: true @@ -5083,7 +5044,6 @@ packages: /core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - dev: true /cosmiconfig-typescript-loader@5.0.0(@types/node@20.11.19)(cosmiconfig@8.3.6)(typescript@5.2.2): resolution: {integrity: sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==} @@ -5144,7 +5104,6 @@ packages: /crypto-js@4.2.0: resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==} - dev: true /css-tree@2.3.1: resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} @@ -5176,6 +5135,13 @@ packages: - typescript dev: true + /d@1.0.1: + resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==} + dependencies: + es5-ext: 0.10.62 + type: 1.2.0 + dev: true + /dargs@7.0.0: resolution: {integrity: sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==} engines: {node: '>=8'} @@ -5303,7 +5269,6 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: true /delegates@1.0.0: resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} @@ -5380,6 +5345,12 @@ packages: engines: {node: '>=0.3.1'} dev: true + /difflib@0.2.4: + resolution: {integrity: sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w==} + dependencies: + heap: 0.2.7 + dev: true + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -5420,6 +5391,112 @@ packages: engines: {node: '>=12'} dev: true + /dreamopt@0.8.0: + resolution: {integrity: sha512-vyJTp8+mC+G+5dfgsY+r3ckxlz+QMX40VjPQsZc5gxVAxLmi64TBoVkP54A/pRAXMXsbu2GMMBrZPxNv23waMg==} + engines: {node: '>=0.4.0'} + dependencies: + wordwrap: 1.0.0 + dev: true + + /drizzle-kit@0.20.14: + resolution: {integrity: sha512-0fHv3YIEaUcSVPSGyaaBfOi9bmpajjhbJNdPsRMIUvYdLVxBu9eGjH8mRc3Qk7HVmEidFc/lhG1YyJhoXrn5yA==} + hasBin: true + dependencies: + '@drizzle-team/studio': 0.0.39 + '@esbuild-kit/esm-loader': 2.6.5 + camelcase: 7.0.1 + chalk: 5.3.0 + commander: 9.5.0 + env-paths: 3.0.0 + esbuild: 0.19.12 + esbuild-register: 3.5.0(esbuild@0.19.12) + glob: 8.1.0 + hanji: 0.0.5 + json-diff: 0.9.0 + minimatch: 7.4.6 + semver: 7.6.0 + zod: 3.22.4 + transitivePeerDependencies: + - supports-color + dev: true + + /drizzle-orm@0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(postgres@3.4.3)(react@18.2.0): + resolution: {integrity: sha512-uSE027csliGSGYD0pqtM+SAQATMREb3eSM/U8s6r+Y0RFwTKwftnwwSkqx3oS65UBgqDOM0gMTl5UGNpt6lW0A==} + peerDependencies: + '@aws-sdk/client-rds-data': '>=3' + '@cloudflare/workers-types': '>=3' + '@libsql/client': '*' + '@neondatabase/serverless': '>=0.1' + '@opentelemetry/api': ^1.4.1 + '@planetscale/database': '>=1' + '@types/better-sqlite3': '*' + '@types/pg': '*' + '@types/react': '>=18' + '@types/sql.js': '*' + '@vercel/postgres': '*' + better-sqlite3: '>=7' + bun-types: '*' + expo-sqlite: '>=13.2.0' + knex: '*' + kysely: '*' + mysql2: '>=2' + pg: '>=8' + postgres: '>=3' + react: '>=18' + sql.js: '>=1' + sqlite3: '>=5' + peerDependenciesMeta: + '@aws-sdk/client-rds-data': + optional: true + '@cloudflare/workers-types': + optional: true + '@libsql/client': + optional: true + '@neondatabase/serverless': + optional: true + '@opentelemetry/api': + optional: true + '@planetscale/database': + optional: true + '@types/better-sqlite3': + optional: true + '@types/pg': + optional: true + '@types/react': + optional: true + '@types/sql.js': + optional: true + '@vercel/postgres': + optional: true + better-sqlite3: + optional: true + bun-types: + optional: true + expo-sqlite: + optional: true + knex: + optional: true + kysely: + optional: true + mysql2: + optional: true + pg: + optional: true + postgres: + optional: true + react: + optional: true + sql.js: + optional: true + sqlite3: + optional: true + dependencies: + '@aws-sdk/client-rds-data': 3.515.0 + kysely: 0.25.0 + postgres: 3.4.3 + react: 18.2.0 + dev: false + /dset@3.1.3: resolution: {integrity: sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ==} engines: {node: '>=4'} @@ -5432,7 +5509,6 @@ packages: inherits: 2.0.4 readable-stream: 2.3.8 stream-shift: 1.0.3 - dev: true /duplexify@4.1.2: resolution: {integrity: sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==} @@ -5441,7 +5517,6 @@ packages: inherits: 2.0.4 readable-stream: 3.6.2 stream-shift: 1.0.3 - dev: true /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -5477,13 +5552,17 @@ packages: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} dependencies: once: 1.4.0 - dev: true /env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} dev: true + /env-paths@3.0.0: + resolution: {integrity: sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} dependencies: @@ -5575,10 +5654,55 @@ packages: is-symbol: 1.0.4 dev: true + /es5-ext@0.10.62: + resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} + engines: {node: '>=0.10'} + requiresBuild: true + dependencies: + es6-iterator: 2.0.3 + es6-symbol: 3.1.3 + next-tick: 1.1.0 + dev: true + + /es6-iterator@2.0.3: + resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-symbol: 3.1.3 + dev: true + /es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} dev: true + /es6-symbol@3.1.3: + resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} + dependencies: + d: 1.0.1 + ext: 1.7.0 + dev: true + + /es6-weak-map@2.0.3: + resolution: {integrity: sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-iterator: 2.0.3 + es6-symbol: 3.1.3 + dev: true + + /esbuild-register@3.5.0(esbuild@0.19.12): + resolution: {integrity: sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A==} + peerDependencies: + esbuild: '>=0.12 <1' + dependencies: + debug: 4.3.4 + esbuild: 0.19.12 + transitivePeerDependencies: + - supports-color + dev: true + /esbuild@0.18.13: resolution: {integrity: sha512-vhg/WR/Oiu4oUIkVhmfcc23G6/zWuEQKFS+yiosSHe4aN6+DQRXIfeloYGibIfVhkr4wyfuVsGNLr+sQU1rWWw==} engines: {node: '>=12'} @@ -5926,6 +6050,13 @@ packages: engines: {node: '>= 0.6'} dev: true + /event-emitter@0.3.5: + resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + dev: true + /eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} dev: true @@ -6026,6 +6157,12 @@ packages: - supports-color dev: true + /ext@1.7.0: + resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} + dependencies: + type: 2.7.2 + dev: true + /extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} dev: false @@ -6093,7 +6230,6 @@ packages: hasBin: true dependencies: strnum: 1.0.5 - dev: true /fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} @@ -6211,7 +6347,6 @@ packages: peerDependenciesMeta: debug: optional: true - dev: true /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -6234,7 +6369,6 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 - dev: true /forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} @@ -6278,7 +6412,6 @@ packages: /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: true /fsevents@2.3.2: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} @@ -6405,6 +6538,12 @@ packages: get-intrinsic: 1.2.4 dev: true + /get-tsconfig@4.7.2: + resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + dependencies: + resolve-pkg-maps: 1.0.0 + dev: true + /git-hooks-list@3.1.0: resolution: {integrity: sha512-LF8VeHeR7v+wAbXqfgRlTSX/1BJR9Q1vEMR8JAz1cEg6GX07+zyj3sAdDvYjj/xnlIfVuGgj4qBei1K3hKH+PA==} dev: true @@ -6456,6 +6595,16 @@ packages: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 + + /glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 dev: true /global-dirs@0.1.1: @@ -6625,6 +6774,13 @@ packages: - supports-color dev: false + /hanji@0.0.5: + resolution: {integrity: sha512-Abxw1Lq+TnYiL4BueXqMau222fPSPMFtya8HdpWsz/xVAhifXou71mPh/kY2+08RgFcVccjG3uZHs6K5HAe3zw==} + dependencies: + lodash.throttle: 4.1.1 + sisteransi: 1.0.5 + dev: true + /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} @@ -6678,12 +6834,15 @@ packages: dependencies: function-bind: 1.1.2 + /heap@0.2.7: + resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==} + dev: true + /help-me@3.0.0: resolution: {integrity: sha512-hx73jClhyk910sidBB7ERlnhMlFsJJIBqSVMFDwPN8o2v9nmp5KgLq1Xz1Bf1fCMMZ6mPrX159iG0VLy/fPMtQ==} dependencies: glob: 7.2.3 readable-stream: 3.6.2 - dev: true /homedir-polyfill@1.0.3: resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} @@ -6768,7 +6927,6 @@ packages: /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: true /ignore@5.3.1: resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} @@ -6815,11 +6973,9 @@ packages: dependencies: once: 1.4.0 wrappy: 1.0.2 - dev: true /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true /ini@1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} @@ -7088,6 +7244,10 @@ packages: engines: {node: '>=12'} dev: true + /is-promise@2.2.2: + resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==} + dev: true + /is-reference@3.0.2: resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} dependencies: @@ -7170,6 +7330,11 @@ packages: call-bind: 1.0.7 dev: true + /is-what@4.1.16: + resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} + engines: {node: '>=12.13'} + dev: true + /is-windows@1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} @@ -7184,7 +7349,6 @@ packages: /isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - dev: true /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} @@ -7200,7 +7364,6 @@ packages: ws: '*' dependencies: ws: 8.16.0 - dev: true /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} @@ -7231,11 +7394,9 @@ packages: /js-sdsl@4.3.0: resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==} - dev: true /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: true /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} @@ -7260,6 +7421,15 @@ packages: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} dev: true + /json-diff@0.9.0: + resolution: {integrity: sha512-cVnggDrVkAAA3OvFfHpFEhOnmcsUpleEKq4d4O8sQWWSH40MBrWstKigVB1kGrgLWzuom+7rRdaCsnBD6VyObQ==} + hasBin: true + dependencies: + cli-color: 2.0.3 + difflib: 0.2.4 + dreamopt: 0.8.0 + dev: true + /json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: true @@ -7385,7 +7555,6 @@ packages: /kysely@0.25.0: resolution: {integrity: sha512-srn0efIMu5IoEBk0tBmtGnoUss4uwvxtbFQWG/U2MosfqIace1l43IFP1PmEpHRDp+Z79xIcKEqmHH3dAvQdQA==} engines: {node: '>=14.0.0'} - dev: true /lazystream@1.0.1: resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} @@ -7397,7 +7566,6 @@ packages: /leven@2.1.0: resolution: {integrity: sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==} engines: {node: '>=0.10.0'} - dev: true /levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} @@ -7525,6 +7693,10 @@ packages: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} dev: true + /lodash.throttle@4.1.1: + resolution: {integrity: sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==} + dev: true + /lodash.truncate@4.4.2: resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==} dev: true @@ -7582,7 +7754,6 @@ packages: hasBin: true dependencies: js-tokens: 4.0.0 - dev: true /loupe@2.3.7: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} @@ -7606,13 +7777,18 @@ packages: engines: {node: '>=10'} dependencies: yallist: 4.0.0 - dev: true /lru-cache@7.18.3: resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} engines: {node: '>=12'} dev: true + /lru-queue@0.1.0: + resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} + dependencies: + es5-ext: 0.10.62 + dev: true + /lucia@2.7.4: resolution: {integrity: sha512-do6Aah5kX2DUl7N0CvELWV1/b+qZGF0AUmUrkthYeNfXfgx4RAkWi4BkAlgGDBB/0c1WApb18mUD1pA5qTaWmw==} dev: false @@ -7664,6 +7840,19 @@ packages: engines: {node: '>= 0.6'} dev: true + /memoizee@0.4.15: + resolution: {integrity: sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-weak-map: 2.0.3 + event-emitter: 0.3.5 + is-promise: 2.2.2 + lru-queue: 0.1.0 + next-tick: 1.1.0 + timers-ext: 0.1.7 + dev: true + /meow@12.1.1: resolution: {integrity: sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==} engines: {node: '>=16.10'} @@ -7738,11 +7927,15 @@ packages: hasBin: true dev: true - /mimetext@3.0.21: - resolution: {integrity: sha512-mB261NgTrpgd8+ApQoSfpptNlJcuWXO1DAOk5LYJXYQmuZ4DuPXmQcAfwUJtJeDmyT2TBWEpRtjhp96yE1cJhg==} + /mimetext@3.0.16: + resolution: {integrity: sha512-uqtsQ2eNEpqoLUBSGSF6Y9eSbbNNeiknv7M6k5nzcs7M0uWtSjqWINYe6ZY/CowxnVDtNFSX+k9K6IicPboNBg==} dependencies: '@babel/runtime': 7.23.9 '@babel/runtime-corejs3': 7.23.9 + '@tsconfig/esm': 1.0.5 + '@tsconfig/node18': 2.0.1 + '@tsconfig/strictest': 2.0.3 + '@types/node': 20.11.19 js-base64: 3.7.6 mime-types: 2.1.35 dev: false @@ -7775,7 +7968,6 @@ packages: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: brace-expansion: 1.1.11 - dev: true /minimatch@5.1.6: resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} @@ -7791,6 +7983,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@7.4.6: + resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -7809,7 +8008,6 @@ packages: /minimist@1.2.6: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} - dev: true /minimist@1.2.7: resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==} @@ -7817,7 +8015,6 @@ packages: /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: true /minipass@3.3.6: resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} @@ -7880,7 +8077,6 @@ packages: process-nextick-args: 2.0.1 transitivePeerDependencies: - supports-color - dev: true /mqtt@4.2.8: resolution: {integrity: sha512-DJYjlXODVXtSDecN8jnNzi6ItX3+ufGsEs9OB3YV24HtkRrh7kpx8L5M1LuyF0KzaiGtWr2PzDcMGAY60KGOSA==} @@ -7933,7 +8129,6 @@ packages: - bufferutil - supports-color - utf-8-validate - dev: true /mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} @@ -7985,6 +8180,10 @@ packages: engines: {node: '>= 0.6'} dev: true + /next-tick@1.1.0: + resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} + dev: true + /node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -8067,7 +8266,6 @@ packages: js-sdsl: 4.3.0 transitivePeerDependencies: - supports-color - dev: true /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -8145,7 +8343,6 @@ packages: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 - dev: true /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} @@ -8319,7 +8516,6 @@ packages: /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - dev: true /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} @@ -8470,6 +8666,11 @@ packages: source-map-js: 1.0.2 dev: true + /postgres@3.4.3: + resolution: {integrity: sha512-iHJn4+M9vbTdHSdDzNkC0crHq+1CUdFhx+YqCE+SqWxPjm+Zu63jq7yZborOBF64c8pc58O5uMudyL1FQcHacA==} + engines: {node: '>=12'} + dev: false + /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -8523,22 +8724,12 @@ packages: react-is: 18.2.0 dev: true - /prisma@5.5.2: - resolution: {integrity: sha512-WQtG6fevOL053yoPl6dbHV+IWgKo25IRN4/pwAGqcWmg7CrtoCzvbDbN9fXUc7QS2KK0LimHIqLsaCOX/vHl8w==} - engines: {node: '>=16.13'} - hasBin: true - requiresBuild: true - dependencies: - '@prisma/engines': 5.5.2 - /process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - dev: true /process@0.11.10: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} - dev: true /promptly@3.2.0: resolution: {integrity: sha512-WnR9obtgW+rG4oUV3hSnNGl1pHm3V1H/qD9iJBumGSmVsSC5HpZOLuu8qdMb6yCItGfT7dcRszejr/5P3i9Pug==} @@ -8556,14 +8747,12 @@ packages: /proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: true /pump@3.0.0: resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} dependencies: end-of-stream: 1.4.4 once: 1.4.0 - dev: true /punycode@1.3.2: resolution: {integrity: sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==} @@ -8653,7 +8842,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: loose-envify: 1.4.0 - dev: true /read-pkg-up@7.0.1: resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} @@ -8691,7 +8879,6 @@ packages: safe-buffer: 5.1.2 string_decoder: 1.1.1 util-deprecate: 1.0.2 - dev: true /readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} @@ -8700,7 +8887,6 @@ packages: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 - dev: true /readdir-glob@1.1.3: resolution: {integrity: sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==} @@ -8739,7 +8925,6 @@ packages: /reinterval@1.1.0: resolution: {integrity: sha512-QIRet3SYrGp0HUHO88jVskiG6seqUGC5iAG7AwI/BV4ypGcuqk9Du6YQBUOUqm9c8pw1eyLoIaONifRua1lsEQ==} - dev: true /remeda@1.43.0: resolution: {integrity: sha512-YMGznJxotoGxoWH15H5v0DtceM+rKsGSO43+qULtPlFJSJ87ZWOHC1JP4iXQmVO9ZT5JFT0SPZQaZUpn4FXJbw==} @@ -8780,6 +8965,10 @@ packages: global-dirs: 0.1.1 dev: true + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -8812,7 +9001,6 @@ packages: /rfdc@1.3.1: resolution: {integrity: sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==} - dev: true /rimraf@2.7.1: resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} @@ -8879,7 +9067,6 @@ packages: /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - dev: true /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -9053,6 +9240,10 @@ packages: totalist: 3.0.1 dev: true + /sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + dev: true + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -9119,6 +9310,18 @@ packages: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + /source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + dev: true + + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} dependencies: @@ -9145,7 +9348,6 @@ packages: resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} dependencies: readable-stream: 3.6.2 - dev: true /split2@4.2.0: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} @@ -9286,7 +9488,6 @@ packages: /stream-shift@1.0.3: resolution: {integrity: sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==} - dev: true /streamsearch@1.1.0: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} @@ -9345,13 +9546,11 @@ packages: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} dependencies: safe-buffer: 5.1.2 - dev: true /string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 - dev: true /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -9407,6 +9606,12 @@ packages: /strnum@1.0.5: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + + /superjson@2.2.1: + resolution: {integrity: sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==} + engines: {node: '>=16'} + dependencies: + copy-anything: 3.0.5 dev: true /supports-color@5.5.0: @@ -9625,6 +9830,13 @@ packages: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} dev: true + /timers-ext@0.1.7: + resolution: {integrity: sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==} + dependencies: + es5-ext: 0.10.62 + next-tick: 1.1.0 + dev: true + /tiny-glob@0.2.9: resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} dependencies: @@ -9717,7 +9929,6 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} @@ -9782,6 +9993,14 @@ packages: mime-types: 2.1.35 dev: true + /type@1.2.0: + resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} + dev: true + + /type@2.7.2: + resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} + dev: true + /typed-array-buffer@1.0.2: resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} engines: {node: '>= 0.4'} @@ -9823,7 +10042,6 @@ packages: /typedarray@0.0.6: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} - dev: true /typescript@5.2.2: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} @@ -9850,7 +10068,6 @@ packages: /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - dev: true /undici@5.26.5: resolution: {integrity: sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==} @@ -9915,7 +10132,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true /util@0.12.5: resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} @@ -9940,7 +10156,6 @@ packages: /uuid@8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - dev: true /uuid@9.0.1: resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} @@ -10205,6 +10420,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + dev: true + /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -10225,7 +10444,6 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true /ws@3.3.3: resolution: {integrity: sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==} @@ -10254,7 +10472,6 @@ packages: optional: true utf-8-validate: optional: true - dev: true /ws@8.16.0: resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} @@ -10267,7 +10484,6 @@ packages: optional: true utf-8-validate: optional: true - dev: true /xml2js@0.6.2: resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==} @@ -10285,7 +10501,6 @@ packages: /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} - dev: true /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} @@ -10298,7 +10513,6 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true /yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} diff --git a/prisma/schema.prisma b/prisma/schema.prisma deleted file mode 100644 index a1b74bf..0000000 --- a/prisma/schema.prisma +++ /dev/null @@ -1,79 +0,0 @@ -generator client { - provider = "prisma-client-js" - previewFeatures = ["fullTextSearch"] - binaryTargets = ["native"] -} - -datasource db { - provider = "postgresql" - url = env("DATABASE_URL") -} - -// Do not modify anything above this line unless you know what you are doing. - -enum UserRole { - UNAUTHORIZED - MEMBER - ADMIN -} - -enum ContactStatus { - NOT_CONTACTED - INITIAL_EMAIL_SENT - IN_PROGRESS_AUTOMATION_DISABLED - AUTOMATED_FOLLOWUP_SENT - BOUNCED - REJECTED - SEE_NEXT_YEAR -} - -model User { - id String @id @unique - auth_session Session[] - key Key[] - Contact Contact[] - role UserRole @default(UNAUTHORIZED) - name String? - email String? -} - -model Key { - id String @id @unique - hashed_password String? - user_id String - user User @relation(references: [id], fields: [user_id], onDelete: Cascade) - - @@index([user_id]) -} - -model Session { - id String @id @unique - user_id String - active_expires BigInt - idle_expires BigInt - user User @relation(references: [id], fields: [user_id], onDelete: Cascade) - - @@index([user_id]) -} - -model Company { - id String @id @unique @default(uuid()) - name String - url String? - contacts Contact[] -} - -model Contact { - id String @id @unique @default(uuid()) - name String - email String? - title String? - companyId String - company Company @relation(fields: [companyId], references: [id]) - status ContactStatus - committeeMemberUserId String? - committeeMember User? @relation(fields: [committeeMemberUserId], references: [id]) - lastContactDate DateTime? - followupDate DateTime? - notes String? @db.Text -} diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts new file mode 100644 index 0000000..ed6438c --- /dev/null +++ b/src/lib/db/schema.ts @@ -0,0 +1,108 @@ +import { pgTable, uniqueIndex, pgEnum, text, timestamp, index, bigint } from "drizzle-orm/pg-core"; + +export const userRole = ["ADMIN", "MEMBER", "UNAUTHORIZED"] as const; + +export const contactStatus = [ + "SEE_NEXT_YEAR", + "REJECTED", + "BOUNCED", + "AUTOMATED_FOLLOWUP_SENT", + "IN_PROGRESS_AUTOMATION_DISABLED", + "INITIAL_EMAIL_SENT", + "NOT_CONTACTED", +] as const; + +export const userRoleEnum = pgEnum("UserRole", userRole); +export const contactStatusEnum = pgEnum("ContactStatus", contactStatus); + +export const company = pgTable( + "Company", + { + id: text("id").primaryKey().notNull(), + name: text("name").notNull(), + url: text("url"), + }, + (table) => { + return { + idKey: uniqueIndex("Company_id_key").on(table.id), + }; + }, +); + +export const contact = pgTable( + "Contact", + { + id: text("id").primaryKey().notNull(), + name: text("name").notNull(), + email: text("email"), + title: text("title"), + companyId: text("companyId") + .notNull() + .references(() => company.id, { onDelete: "restrict", onUpdate: "cascade" }), + status: contactStatusEnum("status").notNull(), + committeeMemberUserId: text("committeeMemberUserId").references(() => user.id, { + onDelete: "set null", + onUpdate: "cascade", + }), + lastContactDate: timestamp("lastContactDate", { precision: 3, mode: "string" }), + followupDate: timestamp("followupDate", { precision: 3, mode: "string" }), + notes: text("notes"), + }, + (table) => { + return { + idKey: uniqueIndex("Contact_id_key").on(table.id), + }; + }, +); + +export const user = pgTable( + "User", + { + id: text("id").primaryKey().notNull(), + role: userRoleEnum("role").default("UNAUTHORIZED").notNull(), + name: text("name"), + email: text("email"), + }, + (table) => { + return { + idKey: uniqueIndex("User_id_key").on(table.id), + }; + }, +); + +export const session = pgTable( + "Session", + { + id: text("id").primaryKey().notNull(), + userId: text("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade", onUpdate: "cascade" }), + // You can use { mode: "bigint" } if numbers are exceeding js number limitations + activeExpires: bigint("active_expires", { mode: "number" }).notNull(), + // You can use { mode: "bigint" } if numbers are exceeding js number limitations + idleExpires: bigint("idle_expires", { mode: "number" }).notNull(), + }, + (table) => { + return { + idKey: uniqueIndex("Session_id_key").on(table.id), + userIdIdx: index("Session_user_id_idx").on(table.userId), + }; + }, +); + +export const key = pgTable( + "Key", + { + id: text("id").primaryKey().notNull(), + hashedPassword: text("hashed_password"), + userId: text("user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade", onUpdate: "cascade" }), + }, + (table) => { + return { + idKey: uniqueIndex("Key_id_key").on(table.id), + userIdIdx: index("Key_user_id_idx").on(table.userId), + }; + }, +); diff --git a/src/lib/schema/types.ts b/src/lib/schema/types.ts index 0a9412d..f55307e 100644 --- a/src/lib/schema/types.ts +++ b/src/lib/schema/types.ts @@ -1,6 +1,7 @@ -import { ContactStatus, UserRole } from "@prisma/client"; import z from "zod"; +import { contactStatus, userRole } from "$lib/db/schema"; + export const CompanyInput = z.object({ name: z.string(), url: z.string().url().optional(), @@ -20,12 +21,12 @@ export const ContactInput = z.object({ create: CompanyInput, }), ]), - status: z.nativeEnum(ContactStatus), + status: z.enum(contactStatus), lastContactDate: z.string().datetime().optional(), followupDate: z.string().datetime().optional(), notes: z.string(), }); export const MemberInput = z.object({ - role: z.nativeEnum(UserRole), + role: z.enum(userRole), }); diff --git a/src/lib/server/drizzle.ts b/src/lib/server/drizzle.ts new file mode 100644 index 0000000..c9f1175 --- /dev/null +++ b/src/lib/server/drizzle.ts @@ -0,0 +1,6 @@ +import { drizzle as d } from "drizzle-orm/postgres-js"; + +import * as schema from "$lib/db/schema"; +import { postgres } from "$lib/server/postgres"; + +export const drizzle = d(postgres, { schema }); diff --git a/src/lib/server/lucia.ts b/src/lib/server/lucia.ts index fc78eb4..45e384e 100644 --- a/src/lib/server/lucia.ts +++ b/src/lib/server/lucia.ts @@ -1,14 +1,14 @@ -import { prisma } from "@lucia-auth/adapter-prisma"; +import { postgres as postgresAdapter } from "@lucia-auth/adapter-postgresql"; import { google } from "@lucia-auth/oauth/providers"; import { lucia } from "lucia"; import { sveltekit } from "lucia/middleware"; import { dev } from "$app/environment"; import { GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, STAGE } from "$env/static/private"; -import { prisma as client } from "$lib/server/prisma"; +import { postgres } from "$lib/server/postgres"; export const auth = lucia({ - adapter: prisma(client), + adapter: postgresAdapter(postgres, { user: "User", key: "Key", session: "Session" }), env: dev ? "DEV" : "PROD", middleware: sveltekit(), getUserAttributes: ({ role, name, email }) => ({ role, name, email }), diff --git a/src/lib/server/postgres.ts b/src/lib/server/postgres.ts new file mode 100644 index 0000000..30841df --- /dev/null +++ b/src/lib/server/postgres.ts @@ -0,0 +1,5 @@ +import p from "postgres"; + +import { DATABASE_URL } from "$env/static/private"; + +export const postgres = p(DATABASE_URL); diff --git a/src/lib/server/prisma.ts b/src/lib/server/prisma.ts deleted file mode 100644 index 901f3a0..0000000 --- a/src/lib/server/prisma.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { PrismaClient } from "@prisma/client"; - -export const prisma = new PrismaClient(); diff --git a/src/routes/api/companies/+server.ts b/src/routes/api/companies/+server.ts index 1d356e4..9ce8964 100644 --- a/src/routes/api/companies/+server.ts +++ b/src/routes/api/companies/+server.ts @@ -2,21 +2,18 @@ import { error, json } from "@sveltejs/kit"; import type { RequestHandler } from "./$types"; +import { company } from "$lib/db/schema"; import { CompanyInput } from "$lib/schema/types"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; import { parseIntSearchParams } from "$lib/util"; const findMany = (take: number = 50, skip?: number) => - prisma.company.findMany({ - select: { - id: true, - name: true, - url: true, - }, - take, - skip, - }); + drizzle + .select({ id: company.id, name: company.name, url: company.url }) + .limit(take) + .offset(skip) + .from(company); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); if (!session || session.user.role === "UNAUTHORIZED") { @@ -35,11 +32,7 @@ export const POST: RequestHandler = async (event) => { } const input = CompanyInput.safeParse(event.request.json()); if (input.success) { - return json( - prisma.company.create({ - data: input.data, - }), - ); + return json(await drizzle.insert(company).values(input.data)); } else { throw error(500, input.error); } diff --git a/src/routes/api/contacts/+server.ts b/src/routes/api/contacts/+server.ts index 973373a..197bd0f 100644 --- a/src/routes/api/contacts/+server.ts +++ b/src/routes/api/contacts/+server.ts @@ -1,41 +1,33 @@ import { error, json } from "@sveltejs/kit"; import type { SortingState } from "@tanstack/svelte-table"; +import { asc, desc, eq } from "drizzle-orm"; import z from "zod"; import type { RequestHandler } from "./$types"; +import { company, contact, user } from "$lib/db/schema"; import { ContactInput } from "$lib/schema/types"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; import { parseIntSearchParams } from "$lib/util/parseIntSearchParams"; const findMany = (take: number = 50, skip?: number, filter?: string, sorting?: SortingState) => - prisma.contact.findMany({ - where: { committeeMemberUserId: filter }, - select: { - id: true, - name: true, - email: true, - title: true, - company: { - select: { id: true, name: true }, - }, - status: true, - committeeMember: { - select: { id: true, name: true }, - }, - lastContactDate: true, - followupDate: true, - notes: true, - }, - take, - skip, - ...(sorting && { - orderBy: { - [sorting[0].id]: sorting[0].desc ? "desc" : "asc", - }, - }), - }); + drizzle + .select() + .from(contact) + .where(eq(contact.committeeMemberUserId, filter)) + .innerJoin(company, eq(contact.companyId, company.id)) + .innerJoin(user, eq(contact.committeeMemberUserId, user.id)) + .limit(take) + .offset(skip) + .orderBy(sorting ? (sorting[0].desc ? desc(sorting[0].id) : asc(sorting[0].id)) : undefined) + .then((result) => + result.map(({ company, committeeMember, ...results }) => ({ + ...results, + company: { id: company.id, name: company.name }, + committeeMember: { id: committeeMember.id, name: committeeMember.name }, + })), + ); const SortingState = z.array( z.object({ @@ -67,9 +59,25 @@ export const GET: RequestHandler = async (event) => { export type GetContacts = Awaited>; const create = (data: z.infer) => - prisma.contact.create({ - data, - }); + "connect" in data.company + ? drizzle.insert(contact).values( + (() => { + const { company, ...other } = data; + return { ...other, companyId: company.connect.id }; + })(), + ) + : drizzle.transaction(async (txn) => { + const { id } = await txn + .insert(company) + .values(data.company.create) + .returning({ id: company.id }); + await txn.insert(contact).values( + (() => { + const { company: _, ...other } = data; + return { ...other, companyId: id }; + })(), + ); + }); export const POST: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); diff --git a/src/routes/api/contacts/[id]/+server.ts b/src/routes/api/contacts/[id]/+server.ts index 433849f..aea8ab9 100644 --- a/src/routes/api/contacts/[id]/+server.ts +++ b/src/routes/api/contacts/[id]/+server.ts @@ -1,12 +1,14 @@ import { error, json, type RequestHandler } from "@sveltejs/kit"; +import { eq } from "drizzle-orm"; import type { z } from "zod"; +import { contact } from "$lib/db/schema"; import { ContactInput } from "$lib/schema/types"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; const update = (id: string, data: z.infer) => - prisma.contact.update({ where: { id }, data }); + drizzle.update(contact).set(data).where(eq(contact.id, id)); export const PATCH: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); @@ -26,7 +28,7 @@ export const PATCH: RequestHandler = async (event) => { export type PatchContact = Awaited>; -const deleteContact = (id: string) => prisma.contact.delete({ where: { id } }); +const deleteContact = (id: string) => drizzle.delete(contact).where(eq(contact.id, id)); export const DELETE: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); diff --git a/src/routes/api/members/+server.ts b/src/routes/api/members/+server.ts index 56058c3..b3a5e9a 100644 --- a/src/routes/api/members/+server.ts +++ b/src/routes/api/members/+server.ts @@ -1,36 +1,33 @@ -import { UserRole } from "@prisma/client"; import { error, json } from "@sveltejs/kit"; +import { and, eq, ilike, inArray, or } from "drizzle-orm"; import z from "zod"; import type { RequestHandler } from "./$types"; +import { user, userRole } from "$lib/db/schema"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; import { parseIntSearchParams } from "$lib/util/parseIntSearchParams"; -const UserRoleZod = z.array(z.nativeEnum(UserRole)).optional(); +const UserRoleZod = z.array(z.enum(userRole)).optional(); const findMany = ( take: number = 50, skip?: number, search?: string, - role: UserRole[] = ["ADMIN", "MEMBER"], + role: userRole[] = ["ADMIN", "MEMBER"], ) => - prisma.user.findMany({ - where: { - role: { in: role }, - ...(search && { OR: [{ name: { search } }, { name: { startsWith: search } }] }), - }, - select: { - id: true, - role: true, - name: true, - email: true, - }, - take, - skip, - }); - + drizzle + .select({ id: user.id, role: user.role, name: user.name, email: user.email }) + .from(user) + .where( + and( + inArray(user.role, role), + search ? or(eq(user.name, search), ilike(user.name, `${search}%`)) : true, + ), + ) + .limit(take) + .offset(skip); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); if (!session || session.user.role === "UNAUTHORIZED") { diff --git a/src/routes/api/members/[id]/+server.ts b/src/routes/api/members/[id]/+server.ts index d88da3f..05dfcca 100644 --- a/src/routes/api/members/[id]/+server.ts +++ b/src/routes/api/members/[id]/+server.ts @@ -1,20 +1,16 @@ import { error, json } from "@sveltejs/kit"; +import { eq } from "drizzle-orm"; import type z from "zod"; import type { RequestHandler } from "./$types"; +import { user } from "$lib/db/schema"; import { MemberInput } from "$lib/schema/types"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; const findUnique = (id: string) => - prisma.user.findUnique({ - where: { id }, - select: { - id: true, - name: true, - }, - }); + drizzle.select({ id: user.id, name: user.name }).distinct().where(eq(user.id, id)).from(user); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); @@ -30,10 +26,7 @@ export const GET: RequestHandler = async (event) => { export type GetMember = Awaited>; const update = (id: string, data: z.infer) => - prisma.user.update({ - where: { id }, - data, - }); + drizzle.update(user).set(data).where(eq(user.id, id)); export const PUT: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); diff --git a/src/routes/api/members/count/+server.ts b/src/routes/api/members/count/+server.ts index 9483263..8e522f2 100644 --- a/src/routes/api/members/count/+server.ts +++ b/src/routes/api/members/count/+server.ts @@ -1,21 +1,16 @@ -import { UserRole } from "@prisma/client"; import { error, json } from "@sveltejs/kit"; import z from "zod"; import type { RequestHandler } from "./$types"; +import { user, userRole } from "$lib/db/schema"; +import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; -import { prisma } from "$lib/server/prisma"; -const UserRoleZod = z.array(z.nativeEnum(UserRole)).optional(); +const UserRoleZod = z.array(z.enum(userRole)).optional(); -const count = async (role: UserRole[] = ["ADMIN", "MEMBER"]) => ({ - count: await prisma.user.count({ - where: { - role: { in: role }, - }, - }), -}); +const count = (role: UserRole[] = ["ADMIN", "MEMBER"]) => + drizzle.select({ count: count() }).from(user).where(arrayIn(user.role, role)); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); diff --git a/sst.config.ts b/sst.config.ts index ef3febd..5120a18 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -1,106 +1,6 @@ -import { RemovalPolicy } from "aws-cdk-lib"; +import {} from "aws-cdk-lib"; import type { SSTConfig } from "sst"; -import { StackContext, SvelteKitSite } from "sst/constructs"; - -export class PrismaLayer extends LayerVersion { - externalModules: string[]; - - environment: Record; - - constructor(scope: Construct, id: string, props: PrismaLayerProps = {}) { - const { prismaVersion, prismaModules, ...rest } = props; - const nodeModules = props.nodeModules || []; - - const app = App.of(scope) as App; - - const layerDir = "/asset-output/nodejs"; - const nm = `${layerDir}/node_modules`; - const engineDir = `${nm}/@prisma/engines`; - const internalsDir = `${nm}/@prisma/internals`; - const clientDir = `${nm}/@prisma/client`; - - // what are we asking npm to install? - // deps to npm install to the layer - const modulesToInstall = prismaModules || ["@prisma/client", "@prisma/engines"]; - const modulesToInstallWithVersion = prismaVersion - ? modulesToInstall.map((dep) => `${dep}@${prismaVersion}`) - : modulesToInstall; - const modulesToInstallArgs = modulesToInstallWithVersion.concat(nodeModules).join(" "); - - // delete engines not requested - const allEngines: PrismaEngine[] = [ - "introspection-engine", - "schema-engine", - "libquery_engine", - "prisma-fmt", - ]; - const prismaEngines = props.prismaEngines || ["libquery_engine"]; - const deleteEngineCmds = allEngines - .filter((e) => !prismaEngines.includes(e)) - .map((e) => `rm -f ${engineDir}/${e}*`); - - const createBundleCommand = [ - // create asset bundle in docker - "bash", - "-c", - [ - `echo "Installing ${modulesToInstallArgs}"`, - "mkdir -p /tmp/npm && pushd /tmp/npm && HOME=/tmp npm i --no-save --no-package-lock npm@latest && popd", - `mkdir -p ${layerDir}`, - // install PRISMA_DEPS - `cd ${layerDir} && HOME=/tmp /tmp/npm/node_modules/.bin/npm install --omit dev --omit peer --omit optional ${modulesToInstallArgs}`, - // delete unneeded engines - ...deleteEngineCmds, - // internals sux - `rm -f ${internalsDir}/dist/libquery_engine*`, - `rm -f ${internalsDir}/dist/get-generators/libquery_engine*`, - `rm -rf ${internalsDir}/dist/get-generators/engines`, - // get rid of some junk - `rm -rf ${engineDir}/download`, - `rm -rf ${clientDir}/generator-build`, - `rm -rf ${nm}/@prisma/engine-core/node_modules/@prisma/engines`, - `rm -rf ${nm}/prisma/build/public`, - `rm -rf ${nm}/prisma/prisma-client/src/__tests__`, - `rm -rf ${nm}/prisma/prisma-client/generator-build`, - `rm -rf ${nm}/@types`, - `rm -rf ${nm}/.prisma`, - ].join(" && "), - ]; - - // hash our parameters so we know when we need to rebuild - const bundleCommandHash = crypto.createHash("sha256"); - bundleCommandHash.update(JSON.stringify(createBundleCommand)); - const bundleCommandDigest = bundleCommandHash.digest("hex"); - - // bundle - const code = Code.fromAsset(".", { - // don't send all our files to docker (slow) - ignoreMode: IgnoreMode.GLOB, - exclude: ["*"], - - // if our bundle commands (basically our "dockerfile") changes then rebuild the image - assetHashType: AssetHashType.CUSTOM, - assetHash: bundleCommandDigest, - - bundling: { - image: RUNTIME.bundlingImage, - command: createBundleCommand, - }, - }); - - super(scope, id, { ...rest, code }); - - // hint for prisma to find the engine - this.environment = app.local - ? {} - : { - PRISMA_QUERY_ENGINE_LIBRARY: - "/opt/nodejs/node_modules/@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node", - }; - // modules provided by layer - this.externalModules = [...new Set([...PRISMA_LAYER_EXTERNAL, ...nodeModules])]; - } -} +import { SvelteKitSite } from "sst/constructs"; export default { config(_input) { @@ -110,46 +10,18 @@ export default { }; }, stacks(app) { - app - .stack(function Site({ stack }) { - const site = new SvelteKitSite(stack, "site", { - customDomain: { - domainName: - stack.stage === "prod" - ? "corporate.internal.icssc.club" - : `${stack.stage}-corporate.internal.icssc.club`, - hostedZone: "icssc.club", - }, - }); - stack.addOutputs({ url: site.url }); - }) - .stack(function Layers({ stack, app }: StackContext) { - // shared prisma lambda layer - const prismaLayer = new PrismaLayer(stack, "PrismaLayer", { - description: "Prisma engine and library", - layerVersionName: app.logicalPrefixedName("prisma"), - prismaVersion: PRISMA_VERSION, - - // retain for rollbacks - removalPolicy: RemovalPolicy.RETAIN, - - prismaEngines: ["libquery_engine"], - }); - - app.addDefaultFunctionLayers([prismaLayer]); - app.addDefaultFunctionEnv(prismaLayer.environment); - app.setDefaultFunctionProps({ - copyFiles: [{ from: "prisma/schema.prisma", to: "src/schema.prisma" }], - nodejs: { - format: "esm", - esbuild: { - banner: { js: ESM_REQUIRE_SHIM }, - external: LAYER_MODULES.concat(prismaLayer.externalModules), - sourcemap: true, - }, - }, - }); + app.stack(function Site({ stack }) { + const site = new SvelteKitSite(stack, "site", { + customDomain: { + domainName: + stack.stage === "prod" + ? "corporate.internal.icssc.club" + : `${stack.stage}-corporate.internal.icssc.club`, + hostedZone: "icssc.club", + }, }); + stack.addOutputs({ url: site.url }); + }); if (app.stage !== "prod") { app.setDefaultRemovalPolicy("destroy"); } diff --git a/svelte.config.js b/svelte.config.js index ce29df8..7981649 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,7 +1,6 @@ import { preprocessMeltUI } from "@melt-ui/pp"; -import adapter from "@sveltejs/adapter-vercel"; import { vitePreprocess } from "@sveltejs/kit/vite"; -// import adapter from "svelte-kit-sst"; +import adapter from "svelte-kit-sst"; import sequence from "svelte-sequential-preprocessor"; /** @type {import("@sveltejs/kit").Config} */ @@ -9,9 +8,6 @@ const config = { preprocess: sequence([vitePreprocess(), preprocessMeltUI()]), kit: { adapter: adapter(), - alias: { - $api: "src/routes/api", - }, }, }; From 43c834a695160503e30720c505da417b28702adc Mon Sep 17 00:00:00 2001 From: Eddy Chen <89349085+ecxyzzy@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:20:21 -0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20postgres=20and=20coun?= =?UTF-8?q?t=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/server/postgres.ts | 2 +- src/routes/api/members/count/+server.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib/server/postgres.ts b/src/lib/server/postgres.ts index 30841df..071d680 100644 --- a/src/lib/server/postgres.ts +++ b/src/lib/server/postgres.ts @@ -2,4 +2,4 @@ import p from "postgres"; import { DATABASE_URL } from "$env/static/private"; -export const postgres = p(DATABASE_URL); +export const postgres = p(DATABASE_URL, { max: 1, ssl: { rejectUnauthorized: false } }); diff --git a/src/routes/api/members/count/+server.ts b/src/routes/api/members/count/+server.ts index 8e522f2..22585cd 100644 --- a/src/routes/api/members/count/+server.ts +++ b/src/routes/api/members/count/+server.ts @@ -1,4 +1,5 @@ import { error, json } from "@sveltejs/kit"; +import { count, inArray } from "drizzle-orm"; import z from "zod"; import type { RequestHandler } from "./$types"; @@ -9,8 +10,12 @@ import { auth } from "$lib/server/lucia"; const UserRoleZod = z.array(z.enum(userRole)).optional(); -const count = (role: UserRole[] = ["ADMIN", "MEMBER"]) => - drizzle.select({ count: count() }).from(user).where(arrayIn(user.role, role)); +const countMembersWithRoles = (role: UserRole[] = ["ADMIN", "MEMBER"]) => + drizzle + .select({ count: count() }) + .from(user) + .where(inArray(user.role, role)) + .then((x) => x[0]); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); @@ -21,7 +26,7 @@ export const GET: RequestHandler = async (event) => { const role = event.url.searchParams.get("role") ?? undefined; const roleArray = role?.split(","); - return json(await count(UserRoleZod.parse(roleArray))); + return json(await countMembersWithRoles(UserRoleZod.parse(roleArray))); }; -export type GetMembersCount = Awaited>; +export type GetMembersCount = Awaited>; From eab3e51f3557e59beca9da87328e95cb6b1989c8 Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Mon, 4 Mar 2024 01:48:37 -0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20schema=20and=20lucia?= =?UTF-8?q?=20auth=20v2=20tables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- drizzle.config.ts | 18 +++++ package.json | 1 + pnpm-lock.yaml | 3 + src/lib/db/schema.ts | 158 ++++++++++++++++++------------------------- 4 files changed, 88 insertions(+), 92 deletions(-) create mode 100644 drizzle.config.ts diff --git a/drizzle.config.ts b/drizzle.config.ts new file mode 100644 index 0000000..a01c6f6 --- /dev/null +++ b/drizzle.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from "drizzle-kit"; +import "dotenv/config"; + +if (!process.env.DATABASE_URL) { + throw new Error("DATABASE_URL environment variable is required"); +} + +export default defineConfig({ + schema: "./src/lib/db/schema.ts", + out: "./drizzle", + driver: "pg", + dbCredentials: { + connectionString: process.env.DATABASE_URL, + }, + schemaFilter: ["dev"], + verbose: true, + strict: true, +}); diff --git a/package.json b/package.json index 8d7e5be..5e09e27 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "constructs": "10.3.0", "cz-conventional-changelog": "3.3.0", "devmoji": "2.3.0", + "dotenv": "^16.4.5", "drizzle-kit": "0.20.14", "eslint": "8.53.0", "eslint-config-prettier": "9.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cecd960..b212af1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,6 +94,9 @@ devDependencies: devmoji: specifier: 2.3.0 version: 2.3.0 + dotenv: + specifier: ^16.4.5 + version: 16.4.5 drizzle-kit: specifier: 0.20.14 version: 0.20.14 diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index ed6438c..6ff20e6 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -1,6 +1,49 @@ -import { pgTable, uniqueIndex, pgEnum, text, timestamp, index, bigint } from "drizzle-orm/pg-core"; +import { pgSchema, pgEnum, text, timestamp, bigint, varchar } from "drizzle-orm/pg-core"; + +export const schema = pgSchema("dev"); export const userRole = ["ADMIN", "MEMBER", "UNAUTHORIZED"] as const; +export const userRoleEnum = pgEnum("UserRole", userRole); + +export const user = schema.table("auth_user", { + id: varchar("id", { + length: 15, + }).primaryKey(), + role: userRoleEnum("role").default("UNAUTHORIZED").notNull(), + name: text("name"), + email: text("email"), +}); + +export const session = schema.table("user_session", { + id: varchar("id", { + length: 128, + }).primaryKey(), + userId: varchar("user_id", { + length: 15, + }) + .notNull() + .references(() => user.id), + activeExpires: bigint("active_expires", { + mode: "number", + }).notNull(), + idleExpires: bigint("idle_expires", { + mode: "number", + }).notNull(), +}); + +export const key = schema.table("user_key", { + id: varchar("id", { + length: 255, + }).primaryKey(), + userId: varchar("user_id", { + length: 15, + }) + .notNull() + .references(() => user.id), + hashedPassword: varchar("hashed_password", { + length: 255, + }), +}); export const contactStatus = [ "SEE_NEXT_YEAR", @@ -12,97 +55,28 @@ export const contactStatus = [ "NOT_CONTACTED", ] as const; -export const userRoleEnum = pgEnum("UserRole", userRole); export const contactStatusEnum = pgEnum("ContactStatus", contactStatus); -export const company = pgTable( - "Company", - { - id: text("id").primaryKey().notNull(), - name: text("name").notNull(), - url: text("url"), - }, - (table) => { - return { - idKey: uniqueIndex("Company_id_key").on(table.id), - }; - }, -); - -export const contact = pgTable( - "Contact", - { - id: text("id").primaryKey().notNull(), - name: text("name").notNull(), - email: text("email"), - title: text("title"), - companyId: text("companyId") - .notNull() - .references(() => company.id, { onDelete: "restrict", onUpdate: "cascade" }), - status: contactStatusEnum("status").notNull(), - committeeMemberUserId: text("committeeMemberUserId").references(() => user.id, { - onDelete: "set null", - onUpdate: "cascade", - }), - lastContactDate: timestamp("lastContactDate", { precision: 3, mode: "string" }), - followupDate: timestamp("followupDate", { precision: 3, mode: "string" }), - notes: text("notes"), - }, - (table) => { - return { - idKey: uniqueIndex("Contact_id_key").on(table.id), - }; - }, -); - -export const user = pgTable( - "User", - { - id: text("id").primaryKey().notNull(), - role: userRoleEnum("role").default("UNAUTHORIZED").notNull(), - name: text("name"), - email: text("email"), - }, - (table) => { - return { - idKey: uniqueIndex("User_id_key").on(table.id), - }; - }, -); - -export const session = pgTable( - "Session", - { - id: text("id").primaryKey().notNull(), - userId: text("user_id") - .notNull() - .references(() => user.id, { onDelete: "cascade", onUpdate: "cascade" }), - // You can use { mode: "bigint" } if numbers are exceeding js number limitations - activeExpires: bigint("active_expires", { mode: "number" }).notNull(), - // You can use { mode: "bigint" } if numbers are exceeding js number limitations - idleExpires: bigint("idle_expires", { mode: "number" }).notNull(), - }, - (table) => { - return { - idKey: uniqueIndex("Session_id_key").on(table.id), - userIdIdx: index("Session_user_id_idx").on(table.userId), - }; - }, -); +export const company = schema.table("company", { + id: text("id").primaryKey().notNull(), + name: text("name").notNull(), + url: text("url"), +}); -export const key = pgTable( - "Key", - { - id: text("id").primaryKey().notNull(), - hashedPassword: text("hashed_password"), - userId: text("user_id") - .notNull() - .references(() => user.id, { onDelete: "cascade", onUpdate: "cascade" }), - }, - (table) => { - return { - idKey: uniqueIndex("Key_id_key").on(table.id), - userIdIdx: index("Key_user_id_idx").on(table.userId), - }; - }, -); +export const contact = schema.table("contact", { + id: text("id").primaryKey().notNull(), + name: text("name").notNull(), + email: text("email"), + title: text("title"), + companyId: text("companyId") + .notNull() + .references(() => company.id, { onDelete: "restrict", onUpdate: "cascade" }), + status: contactStatusEnum("status").notNull(), + committeeMemberUserId: text("committeeMemberUserId").references(() => user.id, { + onDelete: "set null", + onUpdate: "cascade", + }), + lastContactDate: timestamp("lastContactDate", { precision: 3 }), + followupDate: timestamp("followupDate", { precision: 3 }), + notes: text("notes"), +}); From 1ee3f90bb0490057a67a34b3fbffef47d92be483 Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Tue, 5 Mar 2024 11:47:28 -0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20lucia=20postgres=20se?= =?UTF-8?q?tup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 104 ++++++++++++++++++++++++++++++++++++---- src/lib/server/lucia.ts | 6 ++- 3 files changed, 101 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 5e09e27..0423291 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "eslint-plugin-svelte": "2.35.0", "husky": "8.0.3", "lint-staged": "15.1.0", + "pg": "8.11.3", "prettier": "3.1.0", "prettier-plugin-packagejson": "2.4.6", "prettier-plugin-prisma": "5.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b212af1..4ef667d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,7 +7,7 @@ settings: dependencies: '@lucia-auth/adapter-postgresql': specifier: 2.0.2 - version: 2.0.2(lucia@2.7.4)(postgres@3.4.3) + version: 2.0.2(lucia@2.7.4)(pg@8.11.3)(postgres@3.4.3) '@lucia-auth/oauth': specifier: 3.5.0 version: 3.5.0(lucia@2.7.4) @@ -19,7 +19,7 @@ dependencies: version: 5.8.2(svelte@4.2.3) drizzle-orm: specifier: ^0.29.3 - version: 0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(postgres@3.4.3)(react@18.2.0) + version: 0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(pg@8.11.3)(postgres@3.4.3)(react@18.2.0) googleapis: specifier: 128.0.0 version: 128.0.0 @@ -118,6 +118,9 @@ devDependencies: lint-staged: specifier: 15.1.0 version: 15.1.0 + pg: + specifier: 8.11.3 + version: 8.11.3 prettier: specifier: 3.1.0 version: 3.1.0 @@ -135,7 +138,7 @@ devDependencies: version: 1.69.5 sst: specifier: 2.36.1 - version: 2.36.1(@aws-sdk/credential-provider-node@3.515.0) + version: 2.36.1(@aws-sdk/credential-provider-node@3.515.0)(pg@8.11.3) svelte: specifier: 4.2.3 version: 4.2.3 @@ -2737,7 +2740,7 @@ packages: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - /@lucia-auth/adapter-postgresql@2.0.2(lucia@2.7.4)(postgres@3.4.3): + /@lucia-auth/adapter-postgresql@2.0.2(lucia@2.7.4)(pg@8.11.3)(postgres@3.4.3): resolution: {integrity: sha512-gQ7SlFu+gxQj2IX2J8ZVivcLBbdnf9SbNQOVWkJxZOdY1uaaIQGeNfEDld2Awy02VrXmA4sjHsbkJx1JPVw2+A==} peerDependencies: lucia: ^2.0.0 @@ -2750,6 +2753,7 @@ packages: optional: true dependencies: lucia: 2.7.4 + pg: 8.11.3 postgres: 3.4.3 dev: false @@ -4563,6 +4567,10 @@ packages: /buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + /buffer-writer@2.0.0: + resolution: {integrity: sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==} + engines: {node: '>=4'} + /buffer@4.9.2: resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==} dependencies: @@ -5423,7 +5431,7 @@ packages: - supports-color dev: true - /drizzle-orm@0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(postgres@3.4.3)(react@18.2.0): + /drizzle-orm@0.29.3(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0)(pg@8.11.3)(postgres@3.4.3)(react@18.2.0): resolution: {integrity: sha512-uSE027csliGSGYD0pqtM+SAQATMREb3eSM/U8s6r+Y0RFwTKwftnwwSkqx3oS65UBgqDOM0gMTl5UGNpt6lW0A==} peerDependencies: '@aws-sdk/client-rds-data': '>=3' @@ -5496,6 +5504,7 @@ packages: dependencies: '@aws-sdk/client-rds-data': 3.515.0 kysely: 0.25.0 + pg: 8.11.3 postgres: 3.4.3 react: 18.2.0 dev: false @@ -7522,7 +7531,7 @@ packages: resolution: {integrity: sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==} dev: true - /kysely-codegen@0.10.1(kysely@0.25.0): + /kysely-codegen@0.10.1(kysely@0.25.0)(pg@8.11.3): resolution: {integrity: sha512-8Bslh952gN5gtucRv4jTZDFD18RBioS6M50zHfe5kwb5iSyEAunU4ZYMdHzkHraa4zxjg5/183XlOryBCXLRIw==} hasBin: true peerDependencies: @@ -7543,6 +7552,7 @@ packages: kysely: 0.25.0 micromatch: 4.0.5 minimist: 1.2.8 + pg: 8.11.3 dev: true /kysely-data-api@0.2.1(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0): @@ -8474,6 +8484,9 @@ packages: engines: {node: '>=6'} dev: true + /packet-reader@1.0.0: + resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==} + /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -8566,6 +8579,62 @@ packages: estree-walker: 3.0.3 is-reference: 3.0.2 + /pg-cloudflare@1.1.1: + resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==} + requiresBuild: true + optional: true + + /pg-connection-string@2.6.2: + resolution: {integrity: sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==} + + /pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + /pg-pool@3.6.1(pg@8.11.3): + resolution: {integrity: sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==} + peerDependencies: + pg: '>=8.0' + dependencies: + pg: 8.11.3 + + /pg-protocol@1.6.0: + resolution: {integrity: sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==} + + /pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + /pg@8.11.3: + resolution: {integrity: sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==} + engines: {node: '>= 8.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + dependencies: + buffer-writer: 2.0.0 + packet-reader: 1.0.0 + pg-connection-string: 2.6.2 + pg-pool: 3.6.1(pg@8.11.3) + pg-protocol: 1.6.0 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.1.1 + + /pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + dependencies: + split2: 4.2.0 + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} dev: true @@ -8669,6 +8738,24 @@ packages: source-map-js: 1.0.2 dev: true + /postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + /postgres-bytea@1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + + /postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + /postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + dependencies: + xtend: 4.0.2 + /postgres@3.4.3: resolution: {integrity: sha512-iHJn4+M9vbTdHSdDzNkC0crHq+1CUdFhx+YqCE+SqWxPjm+Zu63jq7yZborOBF64c8pc58O5uMudyL1FQcHacA==} engines: {node: '>=12'} @@ -9355,7 +9442,6 @@ packages: /split2@4.2.0: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} engines: {node: '>= 10.x'} - dev: true /sst-aws-cdk@2.101.1: resolution: {integrity: sha512-vGIQKCL6FJX7xe68hx47iPOZZtlf4YZk+EAcEL2p02FsVBJSvTg4mPIE1tsqrqXZmrYv4slAZNVmM5o+PYyzAA==} @@ -9370,7 +9456,7 @@ packages: fsevents: 2.3.2 dev: true - /sst@2.36.1(@aws-sdk/credential-provider-node@3.515.0): + /sst@2.36.1(@aws-sdk/credential-provider-node@3.515.0)(pg@8.11.3): resolution: {integrity: sha512-sEUeM3y+D2Hr9RYkcgCu/ojlBt5kbOwBldcbgLX6G1Ee0dJQh+a9emPZMG/RiC/3DtnVqERM1mxTKRVueDNbDA==} hasBin: true peerDependencies: @@ -9434,7 +9520,7 @@ packages: ink: 4.4.1(react@18.2.0) ink-spinner: 5.0.0(ink@4.4.1)(react@18.2.0) kysely: 0.25.0 - kysely-codegen: 0.10.1(kysely@0.25.0) + kysely-codegen: 0.10.1(kysely@0.25.0)(pg@8.11.3) kysely-data-api: 0.2.1(@aws-sdk/client-rds-data@3.515.0)(kysely@0.25.0) minimatch: 6.2.0 openid-client: 5.6.4 diff --git a/src/lib/server/lucia.ts b/src/lib/server/lucia.ts index 45e384e..148a358 100644 --- a/src/lib/server/lucia.ts +++ b/src/lib/server/lucia.ts @@ -8,7 +8,11 @@ import { GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, STAGE } from "$env/ import { postgres } from "$lib/server/postgres"; export const auth = lucia({ - adapter: postgresAdapter(postgres, { user: "User", key: "Key", session: "Session" }), + adapter: postgresAdapter(postgres, { + user: "auth_user", + key: "user_key", + session: "user_session", + }), env: dev ? "DEV" : "PROD", middleware: sveltekit(), getUserAttributes: ({ role, name, email }) => ({ role, name, email }), From 9c145258255fcdd306698ed246c41ebc99ae74d9 Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Tue, 5 Mar 2024 12:01:57 -0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20api=20endpoints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/db/schema.ts | 1 + src/lib/schema/types.ts | 4 ++-- src/routes/api/companies/+server.ts | 6 +++--- src/routes/api/members/+server.ts | 12 ++++++------ src/routes/api/members/[id]/+server.ts | 2 +- src/routes/api/members/count/+server.ts | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 6ff20e6..b026eb9 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -3,6 +3,7 @@ import { pgSchema, pgEnum, text, timestamp, bigint, varchar } from "drizzle-orm/ export const schema = pgSchema("dev"); export const userRole = ["ADMIN", "MEMBER", "UNAUTHORIZED"] as const; +export type UserRole = (typeof userRole)[number]; export const userRoleEnum = pgEnum("UserRole", userRole); export const user = schema.table("auth_user", { diff --git a/src/lib/schema/types.ts b/src/lib/schema/types.ts index f55307e..dc62703 100644 --- a/src/lib/schema/types.ts +++ b/src/lib/schema/types.ts @@ -22,8 +22,8 @@ export const ContactInput = z.object({ }), ]), status: z.enum(contactStatus), - lastContactDate: z.string().datetime().optional(), - followupDate: z.string().datetime().optional(), + lastContactDate: z.coerce.date().optional(), + followupDate: z.coerce.date().optional(), notes: z.string(), }); diff --git a/src/routes/api/companies/+server.ts b/src/routes/api/companies/+server.ts index 9ce8964..d9ed4e1 100644 --- a/src/routes/api/companies/+server.ts +++ b/src/routes/api/companies/+server.ts @@ -8,12 +8,12 @@ import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; import { parseIntSearchParams } from "$lib/util"; -const findMany = (take: number = 50, skip?: number) => +const findMany = (take: number = 50, skip: number = 0) => drizzle .select({ id: company.id, name: company.name, url: company.url }) + .from(company) .limit(take) - .offset(skip) - .from(company); + .offset(skip); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); if (!session || session.user.role === "UNAUTHORIZED") { diff --git a/src/routes/api/members/+server.ts b/src/routes/api/members/+server.ts index b3a5e9a..cbb724a 100644 --- a/src/routes/api/members/+server.ts +++ b/src/routes/api/members/+server.ts @@ -4,6 +4,7 @@ import z from "zod"; import type { RequestHandler } from "./$types"; +import type { UserRole } from "$lib/db/schema"; import { user, userRole } from "$lib/db/schema"; import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; @@ -13,18 +14,17 @@ const UserRoleZod = z.array(z.enum(userRole)).optional(); const findMany = ( take: number = 50, - skip?: number, + skip: number = 0, search?: string, - role: userRole[] = ["ADMIN", "MEMBER"], + role: UserRole[] = ["ADMIN", "MEMBER"], ) => drizzle .select({ id: user.id, role: user.role, name: user.name, email: user.email }) .from(user) .where( - and( - inArray(user.role, role), - search ? or(eq(user.name, search), ilike(user.name, `${search}%`)) : true, - ), + search + ? and(inArray(user.role, role), or(eq(user.name, search), ilike(user.name, `${search}%`))) + : inArray(user.role, role), ) .limit(take) .offset(skip); diff --git a/src/routes/api/members/[id]/+server.ts b/src/routes/api/members/[id]/+server.ts index 05dfcca..5121618 100644 --- a/src/routes/api/members/[id]/+server.ts +++ b/src/routes/api/members/[id]/+server.ts @@ -10,7 +10,7 @@ import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; const findUnique = (id: string) => - drizzle.select({ id: user.id, name: user.name }).distinct().where(eq(user.id, id)).from(user); + drizzle.selectDistinct({ id: user.id, name: user.name }).from(user).where(eq(user.id, id)); export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); diff --git a/src/routes/api/members/count/+server.ts b/src/routes/api/members/count/+server.ts index 22585cd..67403ee 100644 --- a/src/routes/api/members/count/+server.ts +++ b/src/routes/api/members/count/+server.ts @@ -4,7 +4,7 @@ import z from "zod"; import type { RequestHandler } from "./$types"; -import { user, userRole } from "$lib/db/schema"; +import { user, userRole, type UserRole } from "$lib/db/schema"; import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; From a5edf8807e030ae135af173feb053059cbc2ab6a Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Wed, 6 Mar 2024 00:24:51 -0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20contacts=20list=20api?= =?UTF-8?q?=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/db/schema.ts | 17 ++++ src/routes/api/contacts/+server.ts | 130 +++++++++++++++++------------ 2 files changed, 92 insertions(+), 55 deletions(-) diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index b026eb9..4f23051 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -1,3 +1,4 @@ +import { relations } from "drizzle-orm"; import { pgSchema, pgEnum, text, timestamp, bigint, varchar } from "drizzle-orm/pg-core"; export const schema = pgSchema("dev"); @@ -14,6 +15,9 @@ export const user = schema.table("auth_user", { name: text("name"), email: text("email"), }); +export const userRelations = relations(user, ({ many }) => ({ + contacts: many(contact), +})); export const session = schema.table("user_session", { id: varchar("id", { @@ -63,6 +67,9 @@ export const company = schema.table("company", { name: text("name").notNull(), url: text("url"), }); +export const companyRelations = relations(company, ({ many }) => ({ + contacts: many(contact), +})); export const contact = schema.table("contact", { id: text("id").primaryKey().notNull(), @@ -81,3 +88,13 @@ export const contact = schema.table("contact", { followupDate: timestamp("followupDate", { precision: 3 }), notes: text("notes"), }); +export const contactRelations = relations(contact, ({ one }) => ({ + company: one(company, { + fields: [contact.companyId], + references: [company.id], + }), + committeeMember: one(user, { + fields: [contact.committeeMemberUserId], + references: [user.id], + }), +})); diff --git a/src/routes/api/contacts/+server.ts b/src/routes/api/contacts/+server.ts index 197bd0f..acc37a7 100644 --- a/src/routes/api/contacts/+server.ts +++ b/src/routes/api/contacts/+server.ts @@ -1,41 +1,61 @@ import { error, json } from "@sveltejs/kit"; -import type { SortingState } from "@tanstack/svelte-table"; -import { asc, desc, eq } from "drizzle-orm"; import z from "zod"; import type { RequestHandler } from "./$types"; -import { company, contact, user } from "$lib/db/schema"; -import { ContactInput } from "$lib/schema/types"; +import { contact } from "$lib/db/schema"; import { drizzle } from "$lib/server/drizzle"; import { auth } from "$lib/server/lucia"; import { parseIntSearchParams } from "$lib/util/parseIntSearchParams"; -const findMany = (take: number = 50, skip?: number, filter?: string, sorting?: SortingState) => - drizzle - .select() - .from(contact) - .where(eq(contact.committeeMemberUserId, filter)) - .innerJoin(company, eq(contact.companyId, company.id)) - .innerJoin(user, eq(contact.committeeMemberUserId, user.id)) - .limit(take) - .offset(skip) - .orderBy(sorting ? (sorting[0].desc ? desc(sorting[0].id) : asc(sorting[0].id)) : undefined) +const SortingState = z.array( + z.object({ + desc: z.boolean(), + id: z.custom((key) => { + return typeof key === "string" && key in contact.$inferSelect; + }), + }), +); + +const findMany = ( + take: number = 50, + skip?: number, + filter?: string, + sorting?: z.infer, +) => + drizzle.query.contact + .findMany({ + limit: take, + offset: skip, + columns: { + id: true, + name: true, + email: true, + title: true, + status: true, + lastContactDate: true, + followupDate: true, + notes: true, + }, + with: { + company: true, + committeeMember: true, + }, + where: filter ? (contacts, { eq }) => eq(contacts.committeeMemberUserId, filter) : undefined, + orderBy: sorting?.[0]?.id + ? (contacts, { asc, desc }) => [ + sorting[0].desc ? desc(contacts[sorting[0].id]) : asc(contacts[sorting[0].id]), + ] + : undefined, + }) .then((result) => result.map(({ company, committeeMember, ...results }) => ({ ...results, company: { id: company.id, name: company.name }, - committeeMember: { id: committeeMember.id, name: committeeMember.name }, + committeeMember: { id: committeeMember?.id, name: committeeMember?.name }, })), ); -const SortingState = z.array( - z.object({ - desc: z.boolean(), - id: z.string(), - }), -); - export const GET: RequestHandler = async (event) => { const session = await auth.handleRequest(event).validate(); if (!session || session.user.role === "UNAUTHORIZED") { @@ -58,38 +78,38 @@ export const GET: RequestHandler = async (event) => { export type GetContacts = Awaited>; -const create = (data: z.infer) => - "connect" in data.company - ? drizzle.insert(contact).values( - (() => { - const { company, ...other } = data; - return { ...other, companyId: company.connect.id }; - })(), - ) - : drizzle.transaction(async (txn) => { - const { id } = await txn - .insert(company) - .values(data.company.create) - .returning({ id: company.id }); - await txn.insert(contact).values( - (() => { - const { company: _, ...other } = data; - return { ...other, companyId: id }; - })(), - ); - }); +// const create = (data: z.infer) => +// "connect" in data.company +// ? drizzle.insert(contact).values( +// (() => { +// const { company, ...other } = data; +// return { ...other, companyId: company.connect.id }; +// })(), +// ) +// : drizzle.transaction(async (txn) => { +// const { id } = await txn +// .insert(company) +// .values(data.company.create) +// .returning({ id: company.id }); +// await txn.insert(contact).values( +// (() => { +// const { company: _, ...other } = data; +// return { ...other, companyId: id }; +// })(), +// ); +// }); -export const POST: RequestHandler = async (event) => { - const session = await auth.handleRequest(event).validate(); - if (!session || session.user.role === "UNAUTHORIZED") { - throw error(401); - } - const input = ContactInput.safeParse(event.request.json()); - if (input.success) { - return json(await create(input.data)); - } else { - throw error(500, input.error); - } -}; +// export const POST: RequestHandler = async (event) => { +// const session = await auth.handleRequest(event).validate(); +// if (!session || session.user.role === "UNAUTHORIZED") { +// throw error(401); +// } +// const input = ContactInput.safeParse(event.request.json()); +// if (input.success) { +// return json(await create(input.data)); +// } else { +// throw error(500, input.error); +// } +// }; -export type PostContact = Awaited>; +// export type PostContact = Awaited>;