This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // rlsPgClient is a separate database connection using a postgres user that has | |
| // permissions only to assume 'authenticated' and 'anon' roles | |
| const rlsDrizzleBase = drizzle(rlsPgClient, { schema }); | |
| export function createRlsDrizzle({ session }: { session: Session | undefined | null }) { | |
| let claims = ""; | |
| if (session) { | |
| const accessToken = session.access_token; | |
| const parsedJwt = JSON.parse( | |
| Buffer.from(z.string().parse(accessToken.split(".")[1]), "base64").toString(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FetchHttpClient, HttpClient } from "@effect/platform"; | |
| import { | |
| error as sveltekitError, | |
| fail as sveltekitFail, | |
| redirect as sveltekitRedirect, | |
| type RequestEvent, | |
| type ServerLoadEvent, | |
| type ActionFailure as SveltekitActionFailure, | |
| } from "@sveltejs/kit"; | |
| import { Cause, Context, Data, Effect, Exit, Layer, ManagedRuntime, Match, pipe } from "effect"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Record } from "effect"; | |
| function renameKeys<T extends Record<string | symbol, unknown>, M extends Record<string, string>>( | |
| input: T, | |
| map: M, | |
| ): { [Property in keyof T as Property extends keyof M ? M[Property] : Property]: T[Property] } { | |
| return Record.mapKeys(input, (key) => (key in map ? map[key as keyof M] : key)) as any; | |
| } | |
| function renameKey< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A patched Drizzle relations function that enables the following: | |
| * - defining a one-to-one relation using non-nullable columns that is still nullable via | |
| * `config.optional`: resolves https://github.com/drizzle-team/drizzle-orm/issues/1066 | |
| * - defining a one-to-one relation without fields which includes a relation name: resolves | |
| * https://github.com/drizzle-team/drizzle-orm/issues/3763 | |
| * | |
| * Usage: import `relations` from this file rather than `drizzle-orm/relations` and use as normal. | |
| * `one()` now accepts a config object where the fields and references are optional, to enable use | |
| * with relation name, and also has a new key `optional` which when set to true marks this as an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/node_modules/drizzle-orm/errors.cjs b/node_modules/drizzle-orm/errors.cjs | |
| index 5cb1230..399b75d 100644 | |
| --- a/node_modules/drizzle-orm/errors.cjs | |
| +++ b/node_modules/drizzle-orm/errors.cjs | |
| @@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru | |
| var errors_exports = {}; | |
| __export(errors_exports, { | |
| DrizzleError: () => DrizzleError, | |
| - TransactionRollbackError: () => TransactionRollbackError | |
| + TransactionRollbackError: () => TransactionRollbackError, |
OlderNewer