@yielded/auth-persistence-drizzle 0.1.0-beta.0 → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/D1.d.mts +135 -25
- package/dist/D1.mjs +1 -3
- package/dist/D1.mjs.map +1 -1
- package/dist/Libsql.d.mts +192 -75
- package/dist/Libsql.mjs +1 -7
- package/dist/Libsql.mjs.map +1 -1
- package/dist/Mysql2.d.mts +177 -37
- package/dist/Mysql2.mjs +1 -3
- package/dist/Mysql2.mjs.map +1 -1
- package/dist/Pglite.d.mts +171 -30
- package/dist/Pglite.mjs +2 -3
- package/dist/Pglite.mjs.map +1 -1
- package/dist/Postgres.d.mts +177 -36
- package/dist/Postgres.mjs +2 -3
- package/dist/Postgres.mjs.map +1 -1
- package/dist/SqliteBun.d.mts +192 -74
- package/dist/SqliteBun.mjs +1 -5
- package/dist/SqliteBun.mjs.map +1 -1
- package/dist/SqliteDo.d.mts +194 -110
- package/dist/SqliteDo.mjs +2 -32
- package/dist/SqliteDo.mjs.map +1 -1
- package/dist/SqliteNode.d.mts +190 -72
- package/dist/SqliteNode.mjs +1 -5
- package/dist/SqliteNode.mjs.map +1 -1
- package/dist/SqliteWasm.d.mts +192 -74
- package/dist/SqliteWasm.mjs +1 -5
- package/dist/SqliteWasm.mjs.map +1 -1
- package/dist/drizzle/D1BatchStatements.d.mts +1 -1
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -1
- package/dist/drizzle/d1-emails.mjs.map +1 -1
- package/dist/drizzle/d1-generated-statement.mjs.map +1 -1
- package/dist/drizzle/d1-identity.d.mts +1 -1
- package/dist/drizzle/d1-oauth.d.mts +35 -5
- package/dist/drizzle/d1-oauth.mjs +1 -1
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
- package/dist/drizzle/d1-passwords.d.mts +1 -1
- package/dist/drizzle/d1-passwords.mjs.map +1 -1
- package/dist/drizzle/d1-proofs.d.mts +1 -1
- package/dist/drizzle/d1-proofs.mjs.map +1 -1
- package/dist/drizzle/d1-sessions.d.mts +3 -3
- package/dist/drizzle/d1-sessions.mjs.map +1 -1
- package/dist/drizzle/email-registration.d.mts +1 -1
- package/dist/drizzle/email-target.d.mts +1 -1
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/model.d.mts +2 -126
- package/dist/drizzle/model.mjs +2 -21
- package/dist/drizzle/model.mjs.map +1 -1
- package/dist/drizzle/mysql-emails.d.mts +1 -1
- package/dist/drizzle/mysql-emails.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.d.mts +1 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +1 -1
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
- package/dist/drizzle/mysql-passwords.d.mts +1 -1
- package/dist/drizzle/mysql-passwords.mjs.map +1 -1
- package/dist/drizzle/mysql-proofs.d.mts +1 -1
- package/dist/drizzle/mysql-proofs.mjs.map +1 -1
- package/dist/drizzle/mysql-sessions.d.mts +1 -1
- package/dist/drizzle/mysql-sessions.mjs.map +1 -1
- package/dist/drizzle/oauth-accounts.mjs +1 -1
- package/dist/drizzle/oauth-connected-access.mjs +14 -12
- package/dist/drizzle/oauth-connected-access.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-custody.mjs +2 -2
- package/dist/drizzle/oauth-connected-drivers.mjs +4 -1
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-flow.mjs +2 -2
- package/dist/drizzle/oauth-connected-input.mjs +14 -1
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-maintenance.mjs +1 -1
- package/dist/drizzle/oauth-connected-management.mjs +2 -2
- package/dist/drizzle/oauth-connected-model.d.mts +17 -3
- package/dist/drizzle/oauth-connected-model.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-settlement.mjs +51 -41
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-sign-in.mjs +263 -0
- package/dist/drizzle/oauth-connected-sign-in.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-state.d.mts +110 -2
- package/dist/drizzle/oauth-connected-state.mjs +9 -4
- package/dist/drizzle/oauth-connected-state.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-target.d.mts +137 -9
- package/dist/drizzle/oauth-connected-target.mjs +6 -2
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +1 -1
- package/dist/drizzle/oauth-flow.d.mts +1 -1
- package/dist/drizzle/oauth-flow.mjs +1 -1
- package/dist/drizzle/oauth-input.mjs +1 -1
- package/dist/drizzle/oauth-model.d.mts +1 -1
- package/dist/drizzle/oauth-owner.d.mts +1 -1
- package/dist/drizzle/oauth-registration.d.mts +2 -2
- package/dist/drizzle/oauth-registration.mjs +1 -1
- package/dist/drizzle/oauth-state.mjs +5 -4
- package/dist/drizzle/oauth-state.mjs.map +1 -1
- package/dist/drizzle/oauth-target.d.mts +2 -2
- package/dist/drizzle/oauth-target.mjs +1 -1
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey-write-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-state.mjs +1 -1
- package/dist/drizzle/password-prepared-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-target.mjs.map +1 -1
- package/dist/drizzle/password-target.d.mts +1 -1
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-emails.d.mts +1 -1
- package/dist/drizzle/pg-emails.mjs.map +1 -1
- package/dist/drizzle/pg-identity.d.mts +22 -0
- package/dist/drizzle/pg-identity.mjs +89 -0
- package/dist/drizzle/pg-identity.mjs.map +1 -0
- package/dist/drizzle/pg-password-prepared.d.mts +1 -1
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
- package/dist/drizzle/pg-passwords.d.mts +1 -1
- package/dist/drizzle/pg-passwords.mjs.map +1 -1
- package/dist/drizzle/pg-proofs.d.mts +1 -1
- package/dist/drizzle/pg-proofs.mjs.map +1 -1
- package/dist/drizzle/pg-sessions.d.mts +1 -1
- package/dist/drizzle/pg-sessions.mjs.map +1 -1
- package/dist/drizzle/phone-model.d.mts +1 -1
- package/dist/drizzle/phone-target.d.mts +1 -1
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-target.d.mts +1 -1
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/session-target.d.mts +1 -1
- package/dist/drizzle/session-target.mjs.map +1 -1
- package/dist/drizzle/sqlite-emails.mjs.map +1 -1
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
- package/dist/drizzle/standalone-guard.mjs.map +1 -1
- package/dist/drizzle/totp-model.d.mts +1 -1
- package/dist/drizzle/totp-target.d.mts +1 -1
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/dist/drizzle/transaction-mysql.mjs +1 -1
- package/dist/drizzle/transaction-mysql.mjs.map +1 -1
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +2 -4
- package/dist/internal/drizzle-postgres.mjs.map +1 -1
- package/dist/internal/drizzle-sqlite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/D1.ts +1 -17
- package/src/Libsql.ts +0 -44
- package/src/Mysql2.ts +1 -23
- package/src/Pglite.ts +2 -18
- package/src/Postgres.ts +2 -18
- package/src/SqliteBun.ts +1 -38
- package/src/SqliteDo.ts +1 -256
- package/src/SqliteNode.ts +1 -38
- package/src/SqliteWasm.ts +1 -38
- package/src/drizzle/D1BatchStatements.ts +1 -1
- package/src/drizzle/d1-emails.ts +2 -4
- package/src/drizzle/d1-generated-statement.ts +1 -1
- package/src/drizzle/d1-password-prepared.ts +2 -5
- package/src/drizzle/d1-passwords.ts +2 -4
- package/src/drizzle/d1-proofs.ts +2 -4
- package/src/drizzle/d1-sessions.ts +2 -2
- package/src/drizzle/email-target.ts +1 -1
- package/src/drizzle/model.ts +1 -208
- package/src/drizzle/mysql-emails.ts +1 -1
- package/src/drizzle/mysql-password-prepared.ts +1 -1
- package/src/drizzle/mysql-passwords.ts +1 -1
- package/src/drizzle/mysql-proofs.ts +1 -1
- package/src/drizzle/mysql-sessions.ts +1 -1
- package/src/drizzle/oauth-connected-access.ts +8 -1
- package/src/drizzle/oauth-connected-drivers.ts +3 -0
- package/src/drizzle/oauth-connected-input.ts +13 -0
- package/src/drizzle/oauth-connected-model.ts +17 -0
- package/src/drizzle/oauth-connected-settlement.ts +65 -42
- package/src/drizzle/oauth-connected-sign-in.ts +438 -0
- package/src/drizzle/oauth-connected-state.ts +19 -7
- package/src/drizzle/oauth-connected-target.ts +10 -1
- package/src/drizzle/oauth-state.ts +5 -4
- package/src/drizzle/oauth-target.ts +1 -1
- package/src/drizzle/password-prepared-target.ts +1 -1
- package/src/drizzle/password-target.ts +1 -1
- package/src/drizzle/pg-emails.ts +1 -1
- package/src/drizzle/pg-identity.ts +301 -0
- package/src/drizzle/pg-password-prepared.ts +1 -1
- package/src/drizzle/pg-passwords.ts +1 -1
- package/src/drizzle/pg-proofs.ts +1 -1
- package/src/drizzle/pg-sessions.ts +1 -1
- package/src/drizzle/phone-target.ts +1 -1
- package/src/drizzle/proof-target.ts +1 -1
- package/src/drizzle/session-target.ts +1 -1
- package/src/drizzle/sqlite-emails.ts +1 -1
- package/src/drizzle/sqlite-password-prepared.ts +1 -1
- package/src/drizzle/sqlite-passwords.ts +1 -1
- package/src/drizzle/sqlite-proofs.ts +1 -1
- package/src/drizzle/sqlite-sessions.ts +1 -1
- package/src/drizzle/standalone-guard.ts +1 -1
- package/src/drizzle/totp-target.ts +1 -1
- package/src/drizzle/transaction-mysql.ts +1 -1
- package/src/index.ts +0 -24
- package/src/internal/drizzle-postgres.ts +1 -1
- package/src/internal/drizzle-sqlite.ts +1 -1
- package/dist/drizzle/mysql.d.mts +0 -69
- package/dist/drizzle/mysql.mjs +0 -218
- package/dist/drizzle/mysql.mjs.map +0 -1
- package/dist/drizzle/pg.d.mts +0 -80
- package/dist/drizzle/pg.mjs +0 -289
- package/dist/drizzle/pg.mjs.map +0 -1
- package/dist/drizzle/sqlite.d.mts +0 -77
- package/dist/drizzle/sqlite.mjs +0 -217
- package/dist/drizzle/sqlite.mjs.map +0 -1
- package/src/drizzle/mysql.ts +0 -687
- package/src/drizzle/pg.ts +0 -984
- package/src/drizzle/sqlite.ts +0 -705
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-postgres.mjs","names":[],"sources":["../../src/internal/drizzle-postgres.ts"],"sourcesContent":["import {\n PersistenceConfigurationError,\n makeComposedPasskeys,\n createPersistence,\n} from \"@yielded/auth-persistence/Adapter\";\nimport type { StorageTable } from \"@yielded/auth-persistence/Adapter\";\nimport { getTableColumns } from \"drizzle-orm\";\nimport {\n getTableConfig,\n bigint,\n boolean,\n pgTable,\n text,\n uniqueIndex,\n type PgTable,\n} from \"drizzle-orm/pg-core\";\nimport type { Effect } from \"effect\";\nimport type { SqlClient } from \"effect/
|
|
1
|
+
{"version":3,"file":"drizzle-postgres.mjs","names":[],"sources":["../../src/internal/drizzle-postgres.ts"],"sourcesContent":["import {\n PersistenceConfigurationError,\n makeComposedPasskeys,\n createPersistence,\n} from \"@yielded/auth-persistence/Adapter\";\nimport type { StorageTable } from \"@yielded/auth-persistence/Adapter\";\nimport { getTableColumns } from \"drizzle-orm\";\nimport {\n getTableConfig,\n bigint,\n boolean,\n pgTable,\n text,\n uniqueIndex,\n type PgTable,\n} from \"drizzle-orm/pg-core\";\nimport type { Effect } from \"effect\";\nimport type { SqlClient } from \"effect/sql/SqlClient\";\n\nimport { drizzleQueryOperations } from \"../drizzle/query-operations\";\n\nconst makeTable = (definition: StorageTable) =>\n pgTable(\n definition.name,\n Object.fromEntries(\n Object.entries(definition.columns).map(([key, column]) => {\n const builder =\n column.type === \"text\"\n ? text(column.name)\n : column.type === \"boolean\"\n ? boolean(column.name)\n : bigint(column.name, { mode: \"number\" });\n\n return [key, column.nullable ? builder : builder.notNull()];\n }),\n ),\n (columns) =>\n definition.unique.map((keys, i) => {\n const [first, ...rest] = keys;\n\n if (first === undefined)\n throw PersistenceConfigurationError.make({ reason: \"An empty unique key is invalid\" });\n\n return uniqueIndex(`${definition.name}_key_${i}`).on(\n columns[first],\n ...rest.map((key) => columns[key]),\n );\n }),\n );\n\nconst describe = (table: PgTable): StorageTable => {\n const config = getTableConfig(table);\n\n return {\n name: config.name,\n ...(config.schema === undefined ? {} : { schema: config.schema }),\n columns: Object.fromEntries(\n Object.entries(getTableColumns(table)).map(([key, column]) => [\n key,\n {\n name: column.name,\n type:\n column.dataType === \"boolean\"\n ? \"boolean\"\n : column.dataType === \"number\"\n ? \"integer\"\n : \"text\",\n nullable: !column.notNull,\n },\n ]),\n ),\n unique: [],\n };\n};\n\nexport const postgresPersistence = <R>(acquire: Effect.Effect<object, never, R | SqlClient>) =>\n createPersistence<PgTable, R>({\n makeTable,\n describe,\n operations: drizzleQueryOperations,\n acquire,\n passkeys: makeComposedPasskeys(drizzleQueryOperations),\n });\n"],"mappings":";;;;;AAqBA,MAAM,aAAa,eACjB,QACE,WAAW,MACX,OAAO,YACL,OAAO,QAAQ,WAAW,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY;CACxD,MAAM,UACJ,OAAO,SAAS,SACZ,KAAK,OAAO,IAAI,IAChB,OAAO,SAAS,YACd,QAAQ,OAAO,IAAI,IACnB,OAAO,OAAO,MAAM,EAAE,MAAM,SAAS,CAAC;CAE9C,OAAO,CAAC,KAAK,OAAO,WAAW,UAAU,QAAQ,QAAQ,CAAC;AAC5D,CAAC,CACH,IACC,YACC,WAAW,OAAO,KAAK,MAAM,MAAM;CACjC,MAAM,CAAC,OAAO,GAAG,QAAQ;CAEzB,IAAI,UAAU,KAAA,GACZ,MAAM,8BAA8B,KAAK,EAAE,QAAQ,iCAAiC,CAAC;CAEvF,OAAO,YAAY,GAAG,WAAW,KAAK,OAAO,GAAG,CAAC,CAAC,GAChD,QAAQ,QACR,GAAG,KAAK,KAAK,QAAQ,QAAQ,IAAI,CACnC;AACF,CAAC,CACL;AAEF,MAAM,YAAY,UAAiC;CACjD,MAAM,SAAS,eAAe,KAAK;CAEnC,OAAO;EACL,MAAM,OAAO;EACb,GAAI,OAAO,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,OAAO;EAC/D,SAAS,OAAO,YACd,OAAO,QAAQ,gBAAgB,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY,CAC5D,KACA;GACE,MAAM,OAAO;GACb,MACE,OAAO,aAAa,YAChB,YACA,OAAO,aAAa,WAClB,YACA;GACR,UAAU,CAAC,OAAO;EACpB,CACF,CAAC,CACH;EACA,QAAQ,CAAC;CACX;AACF;AAEA,MAAa,uBAA0B,YACrC,kBAA8B;CAC5B;CACA;CACA,YAAY;CACZ;CACA,UAAU,qBAAqB,sBAAsB;AACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-sqlite.mjs","names":[],"sources":["../../src/internal/drizzle-sqlite.ts"],"sourcesContent":["import {\n PersistenceConfigurationError,\n makeComposedPasskeys,\n createPersistence,\n} from \"@yielded/auth-persistence/Adapter\";\nimport type { StorageTable } from \"@yielded/auth-persistence/Adapter\";\nimport { getTableColumns } from \"drizzle-orm\";\nimport {\n getTableConfig,\n integer,\n sqliteTable,\n text,\n uniqueIndex,\n type SQLiteTable,\n} from \"drizzle-orm/sqlite-core\";\nimport type { Effect } from \"effect\";\nimport type { SqlClient } from \"effect/
|
|
1
|
+
{"version":3,"file":"drizzle-sqlite.mjs","names":[],"sources":["../../src/internal/drizzle-sqlite.ts"],"sourcesContent":["import {\n PersistenceConfigurationError,\n makeComposedPasskeys,\n createPersistence,\n} from \"@yielded/auth-persistence/Adapter\";\nimport type { StorageTable } from \"@yielded/auth-persistence/Adapter\";\nimport { getTableColumns } from \"drizzle-orm\";\nimport {\n getTableConfig,\n integer,\n sqliteTable,\n text,\n uniqueIndex,\n type SQLiteTable,\n} from \"drizzle-orm/sqlite-core\";\nimport type { Effect } from \"effect\";\nimport type { SqlClient } from \"effect/sql/SqlClient\";\n\nimport { drizzleQueryOperations } from \"../drizzle/query-operations\";\n\nconst makeTable = (definition: StorageTable) =>\n sqliteTable(\n definition.name,\n Object.fromEntries(\n Object.entries(definition.columns).map(([key, column]) => {\n const builder =\n column.type === \"text\"\n ? text(column.name)\n : column.type === \"boolean\"\n ? integer(column.name, { mode: \"boolean\" })\n : integer(column.name);\n\n return [key, column.nullable ? builder : builder.notNull()];\n }),\n ),\n (columns) =>\n definition.unique.map((keys, i) => {\n const [first, ...rest] = keys;\n\n if (first === undefined)\n throw PersistenceConfigurationError.make({ reason: \"An empty unique key is invalid\" });\n\n return uniqueIndex(`${definition.name}_key_${i}`).on(\n columns[first],\n ...rest.map((key) => columns[key]),\n );\n }),\n );\n\nconst describe = (table: SQLiteTable): StorageTable => {\n const config = getTableConfig(table);\n\n return {\n name: config.name,\n columns: Object.fromEntries(\n Object.entries(getTableColumns(table)).map(([key, column]) => [\n key,\n {\n name: column.name,\n type:\n column.dataType === \"boolean\"\n ? \"boolean\"\n : column.dataType === \"number\"\n ? \"integer\"\n : \"text\",\n nullable: !column.notNull,\n },\n ]),\n ),\n unique: [],\n };\n};\n\nexport const sqlitePersistence = <R>(acquire: Effect.Effect<object, never, R | SqlClient>) =>\n createPersistence<SQLiteTable, R>({\n makeTable,\n describe,\n operations: drizzleQueryOperations,\n acquire,\n passkeys: makeComposedPasskeys(drizzleQueryOperations),\n });\n"],"mappings":";;;;;AAoBA,MAAM,aAAa,eACjB,YACE,WAAW,MACX,OAAO,YACL,OAAO,QAAQ,WAAW,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY;CACxD,MAAM,UACJ,OAAO,SAAS,SACZ,KAAK,OAAO,IAAI,IAChB,OAAO,SAAS,YACd,QAAQ,OAAO,MAAM,EAAE,MAAM,UAAU,CAAC,IACxC,QAAQ,OAAO,IAAI;CAE3B,OAAO,CAAC,KAAK,OAAO,WAAW,UAAU,QAAQ,QAAQ,CAAC;AAC5D,CAAC,CACH,IACC,YACC,WAAW,OAAO,KAAK,MAAM,MAAM;CACjC,MAAM,CAAC,OAAO,GAAG,QAAQ;CAEzB,IAAI,UAAU,KAAA,GACZ,MAAM,8BAA8B,KAAK,EAAE,QAAQ,iCAAiC,CAAC;CAEvF,OAAO,YAAY,GAAG,WAAW,KAAK,OAAO,GAAG,CAAC,CAAC,GAChD,QAAQ,QACR,GAAG,KAAK,KAAK,QAAQ,QAAQ,IAAI,CACnC;AACF,CAAC,CACL;AAEF,MAAM,YAAY,UAAqC;CAGrD,OAAO;EACL,MAHa,eAAe,KAGjB,CAAC,CAAC;EACb,SAAS,OAAO,YACd,OAAO,QAAQ,gBAAgB,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY,CAC5D,KACA;GACE,MAAM,OAAO;GACb,MACE,OAAO,aAAa,YAChB,YACA,OAAO,aAAa,WAClB,YACA;GACR,UAAU,CAAC,OAAO;EACpB,CACF,CAAC,CACH;EACA,QAAQ,CAAC;CACX;AACF;AAEA,MAAa,qBAAwB,YACnC,kBAAkC;CAChC;CACA;CACA,YAAY;CACZ;CACA,UAAU,qBAAqB,sBAAsB;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/auth-persistence-drizzle","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@yielded/auth-persistence-drizzle","version":"0.1.0-beta.1","dependencies":{"@noble/hashes":"2.3.0","@yielded/auth":"0.1.0-beta.11","@yielded/auth-crypto":"0.1.0-beta.1","@yielded/auth-persistence":"0.1.0-beta.11"},"devDependencies":{"@effect/platform-bun":"4.0.0","@effect/platform-node":"4.0.0","@effect/sql-d1":"4.0.0","@effect/sql-libsql":"4.0.0","@effect/sql-mysql2":"4.0.0","@effect/sql-pg":"4.0.0","@effect/sql-pglite":"4.0.0","@effect/sql-sqlite-bun":"4.0.0","@effect/sql-sqlite-do":"4.0.0","@effect/sql-sqlite-node":"4.0.0","@effect/sql-sqlite-wasm":"4.0.0","@effect/vitest":"4.0.0","drizzle-orm":"1.0.0-rc.4","effect":"4.0.0","typescript":"7.0.2","vite-plus":"0.3.3"},"peerDependencies":{"@effect/sql-d1":">=4.0.0","@effect/sql-libsql":">=4.0.0","@effect/sql-mysql2":">=4.0.0","@effect/sql-pg":">=4.0.0","@effect/sql-pglite":">=4.0.0","@effect/sql-sqlite-bun":">=4.0.0","@effect/sql-sqlite-do":">=4.0.0","@effect/sql-sqlite-node":">=4.0.0","@effect/sql-sqlite-wasm":">=4.0.0","drizzle-orm":">=1.0.0-rc.4","effect":"^4.0.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./D1":{"types":"./dist/D1.d.mts","default":"./dist/D1.mjs"},"./Libsql":{"types":"./dist/Libsql.d.mts","default":"./dist/Libsql.mjs"},"./Mysql2":{"types":"./dist/Mysql2.d.mts","default":"./dist/Mysql2.mjs"},"./Pglite":{"types":"./dist/Pglite.d.mts","default":"./dist/Pglite.mjs"},"./Postgres":{"types":"./dist/Postgres.d.mts","default":"./dist/Postgres.mjs"},"./SqliteBun":{"types":"./dist/SqliteBun.d.mts","default":"./dist/SqliteBun.mjs"},"./SqliteDo":{"types":"./dist/SqliteDo.d.mts","default":"./dist/SqliteDo.mjs"},"./SqliteNode":{"types":"./dist/SqliteNode.d.mts","default":"./dist/SqliteNode.mjs"},"./SqliteWasm":{"types":"./dist/SqliteWasm.d.mts","default":"./dist/SqliteWasm.mjs"}},"description":"Drizzle persistence, table mappings, and migration adapters for Yielded Auth.","homepage":"https://yielded.dev/auth/","bugs":{"url":"https://github.com/yielded-dev/auth/issues"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/auth.git","directory":"packages/auth-persistence-drizzle"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests","example:totp":"bun test/fixtures/totp-sqlite-bun.ts"},"peerDependenciesMeta":{"@effect/sql-d1":{"optional":true},"@effect/sql-libsql":{"optional":true},"@effect/sql-mysql2":{"optional":true},"@effect/sql-pg":{"optional":true},"@effect/sql-pglite":{"optional":true},"@effect/sql-sqlite-bun":{"optional":true},"@effect/sql-sqlite-do":{"optional":true},"@effect/sql-sqlite-node":{"optional":true},"@effect/sql-sqlite-wasm":{"optional":true}}}
|
package/src/D1.ts
CHANGED
|
@@ -52,31 +52,15 @@ export {
|
|
|
52
52
|
makeD1EmailSignInServices as makeEmailSignInServices,
|
|
53
53
|
} from "./drizzle/d1-emails";
|
|
54
54
|
|
|
55
|
-
import { type
|
|
56
|
-
import {
|
|
57
|
-
makeSqliteAuthServices,
|
|
58
|
-
makeSqliteAuthStoreServices,
|
|
59
|
-
makeSqliteOAuthStateServices,
|
|
60
|
-
} from "./drizzle/sqlite";
|
|
55
|
+
import { type D1GeneratedIdentityMapping } from "./drizzle/model";
|
|
61
56
|
|
|
62
57
|
export {
|
|
63
58
|
makeD1ExternalIdentityServices as makeExternalIdentityServices,
|
|
64
59
|
makeD1SubjectProvisioningServices as makeSubjectProvisioningServices,
|
|
65
|
-
makeSqliteAuthStoreServices as makeAuthStoreServices,
|
|
66
|
-
makeSqliteOAuthStateServices as makeOAuthStateServices,
|
|
67
60
|
};
|
|
68
61
|
|
|
69
62
|
export const commitMode = "batch" as const;
|
|
70
63
|
|
|
71
|
-
export const makeAuthServices = <
|
|
72
|
-
C extends AnySQLiteTable,
|
|
73
|
-
R extends AnySQLiteTable,
|
|
74
|
-
S extends AnySQLiteTable,
|
|
75
|
-
>(
|
|
76
|
-
database: EffectSQLiteD1Database<AnyRelations>,
|
|
77
|
-
mapping: AuthTables<C, R, S>,
|
|
78
|
-
) => makeSqliteAuthServices(database, mapping);
|
|
79
|
-
|
|
80
64
|
export const makeIdentityServices = <
|
|
81
65
|
Subject extends AnySQLiteTable,
|
|
82
66
|
Identifier extends AnySQLiteTable,
|
package/src/Libsql.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { requireStandalone as standalone } from "@yielded/auth-persistence/Adapter";
|
|
2
2
|
import { EmailUnavailable } from "@yielded/auth/Email";
|
|
3
|
-
import { AuthStoreError } from "@yielded/auth/Errors";
|
|
4
3
|
import { PasswordUnavailable } from "@yielded/auth/Password";
|
|
5
4
|
import { ProofUnavailable } from "@yielded/auth/Proofs";
|
|
6
5
|
import { SessionUnavailable } from "@yielded/auth/Sessions";
|
|
@@ -10,28 +9,10 @@ import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
|
10
9
|
import { Effect } from "effect";
|
|
11
10
|
|
|
12
11
|
import type {
|
|
13
|
-
AuthStoreTables,
|
|
14
|
-
AuthTables,
|
|
15
12
|
ExternalIdentityTables,
|
|
16
13
|
IdentityTables,
|
|
17
|
-
OAuthStateTables,
|
|
18
14
|
SubjectProvisioningTables,
|
|
19
15
|
} from "./drizzle/model";
|
|
20
|
-
import {
|
|
21
|
-
coordinateSqliteAuthStoreTransaction,
|
|
22
|
-
coordinateSqliteAuthTransaction,
|
|
23
|
-
coordinateSqliteOAuthStateTransaction,
|
|
24
|
-
makeSqliteAuthServices,
|
|
25
|
-
makeSqliteAuthStoreServices,
|
|
26
|
-
makeSqliteOAuthStateServices,
|
|
27
|
-
} from "./drizzle/sqlite";
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
coordinateSqliteAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
31
|
-
coordinateSqliteAuthTransaction as coordinateAuthTransaction,
|
|
32
|
-
coordinateSqliteOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
16
|
import { makeSqliteEmailTarget, sqliteEmailConfiguration } from "./drizzle/sqlite-emails";
|
|
36
17
|
import {
|
|
37
18
|
makeSqliteExternalIdentityServices,
|
|
@@ -42,12 +23,6 @@ import { makeSqlitePasswordTarget, sqlitePasswordConfiguration } from "./drizzle
|
|
|
42
23
|
import { makeSqliteProofTarget, sqliteProofConfiguration } from "./drizzle/sqlite-proofs";
|
|
43
24
|
import { makeSqliteSessionTarget, sqliteSessionConfiguration } from "./drizzle/sqlite-sessions";
|
|
44
25
|
|
|
45
|
-
const requireStandalone = standalone(() =>
|
|
46
|
-
AuthStoreError.make({
|
|
47
|
-
message: "Use the decision consume API inside an outer database transaction",
|
|
48
|
-
}),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
26
|
const requireStandaloneSession = standalone(() => SessionUnavailable.make({}));
|
|
52
27
|
const requireStandaloneProof = standalone(() => ProofUnavailable.make({}));
|
|
53
28
|
const requireStandalonePassword = standalone(() => PasswordUnavailable.make({}));
|
|
@@ -101,25 +76,6 @@ export const {
|
|
|
101
76
|
|
|
102
77
|
export const commitMode = "interactive" as const;
|
|
103
78
|
|
|
104
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
105
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
106
|
-
mapping: AuthStoreTables<C, R>,
|
|
107
|
-
) => makeSqliteAuthStoreServices(database, mapping, requireStandalone);
|
|
108
|
-
|
|
109
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
110
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
111
|
-
mapping: OAuthStateTables<S>,
|
|
112
|
-
) => makeSqliteOAuthStateServices(database, mapping, requireStandalone);
|
|
113
|
-
|
|
114
|
-
export const makeAuthServices = <
|
|
115
|
-
C extends AnySQLiteTable,
|
|
116
|
-
R extends AnySQLiteTable,
|
|
117
|
-
S extends AnySQLiteTable,
|
|
118
|
-
>(
|
|
119
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
120
|
-
mapping: AuthTables<C, R, S>,
|
|
121
|
-
) => makeSqliteAuthServices(database, mapping, requireStandalone);
|
|
122
|
-
|
|
123
79
|
export const makeIdentityServices = <
|
|
124
80
|
Subject extends AnySQLiteTable,
|
|
125
81
|
Identifier extends AnySQLiteTable,
|
package/src/Mysql2.ts
CHANGED
|
@@ -2,15 +2,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
2
2
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
3
3
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
coordinateMysqlAuthStoreTransaction,
|
|
8
|
-
coordinateMysqlAuthTransaction,
|
|
9
|
-
coordinateMysqlOAuthStateTransaction,
|
|
10
|
-
makeMysqlAuthServices,
|
|
11
|
-
makeMysqlAuthStoreServices,
|
|
12
|
-
makeMysqlOAuthStateServices,
|
|
13
|
-
} from "./drizzle/mysql";
|
|
5
|
+
import type { IdentityTables } from "./drizzle/model";
|
|
14
6
|
import {
|
|
15
7
|
makeMysqlExternalIdentityServices,
|
|
16
8
|
makeMysqlIdentityServices,
|
|
@@ -49,26 +41,12 @@ export {
|
|
|
49
41
|
} from "./drizzle/mysql-emails";
|
|
50
42
|
|
|
51
43
|
export {
|
|
52
|
-
coordinateMysqlAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
53
|
-
coordinateMysqlAuthTransaction as coordinateAuthTransaction,
|
|
54
|
-
coordinateMysqlOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
55
|
-
makeMysqlAuthStoreServices as makeAuthStoreServices,
|
|
56
44
|
makeMysqlExternalIdentityServices as makeExternalIdentityServices,
|
|
57
|
-
makeMysqlOAuthStateServices as makeOAuthStateServices,
|
|
58
45
|
makeMysqlSubjectProvisioningServices as makeSubjectProvisioningServices,
|
|
59
46
|
};
|
|
60
47
|
|
|
61
48
|
export const commitMode = "interactive" as const;
|
|
62
49
|
|
|
63
|
-
export const makeAuthServices = <
|
|
64
|
-
C extends AnyMySqlTable,
|
|
65
|
-
R extends AnyMySqlTable,
|
|
66
|
-
S extends AnyMySqlTable,
|
|
67
|
-
>(
|
|
68
|
-
database: EffectMysql2Database<AnyRelations>,
|
|
69
|
-
mapping: AuthTables<C, R, S>,
|
|
70
|
-
) => makeMysqlAuthServices(database, mapping);
|
|
71
|
-
|
|
72
50
|
export const makeIdentityServices = <
|
|
73
51
|
Subject extends AnyMySqlTable,
|
|
74
52
|
Identifier extends AnyMySqlTable,
|
package/src/Pglite.ts
CHANGED
|
@@ -3,18 +3,12 @@ import { type EffectPgDatabase, makeWithDefaults } from "drizzle-orm/effect-pgli
|
|
|
3
3
|
import type { AnyPgTable } from "drizzle-orm/pg-core";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { IdentityTables } from "./drizzle/model";
|
|
7
7
|
import {
|
|
8
|
-
coordinatePgAuthStoreTransaction,
|
|
9
|
-
coordinatePgAuthTransaction,
|
|
10
|
-
coordinatePgOAuthStateTransaction,
|
|
11
|
-
makePgAuthServices,
|
|
12
|
-
makePgAuthStoreServices,
|
|
13
8
|
makePgExternalIdentityServices,
|
|
14
9
|
makePgIdentityServices,
|
|
15
|
-
makePgOAuthStateServices,
|
|
16
10
|
makePgSubjectProvisioningServices,
|
|
17
|
-
} from "./drizzle/pg";
|
|
11
|
+
} from "./drizzle/pg-identity";
|
|
18
12
|
|
|
19
13
|
export {
|
|
20
14
|
coordinatePgAuthenticationAuthority as coordinateAuthenticationAuthority,
|
|
@@ -48,22 +42,12 @@ export {
|
|
|
48
42
|
} from "./drizzle/pg-emails";
|
|
49
43
|
|
|
50
44
|
export {
|
|
51
|
-
coordinatePgAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
52
|
-
coordinatePgAuthTransaction as coordinateAuthTransaction,
|
|
53
|
-
coordinatePgOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
54
|
-
makePgAuthStoreServices as makeAuthStoreServices,
|
|
55
45
|
makePgExternalIdentityServices as makeExternalIdentityServices,
|
|
56
|
-
makePgOAuthStateServices as makeOAuthStateServices,
|
|
57
46
|
makePgSubjectProvisioningServices as makeSubjectProvisioningServices,
|
|
58
47
|
};
|
|
59
48
|
|
|
60
49
|
export const commitMode = "interactive" as const;
|
|
61
50
|
|
|
62
|
-
export const makeAuthServices = <C extends AnyPgTable, R extends AnyPgTable, S extends AnyPgTable>(
|
|
63
|
-
database: EffectPgDatabase<AnyRelations>,
|
|
64
|
-
mapping: AuthTables<C, R, S>,
|
|
65
|
-
) => makePgAuthServices(database, mapping);
|
|
66
|
-
|
|
67
51
|
export const makeIdentityServices = <
|
|
68
52
|
Subject extends AnyPgTable,
|
|
69
53
|
Identifier extends AnyPgTable,
|
package/src/Postgres.ts
CHANGED
|
@@ -3,18 +3,12 @@ import { type EffectPgDatabase, makeWithDefaults } from "drizzle-orm/effect-post
|
|
|
3
3
|
import type { AnyPgTable } from "drizzle-orm/pg-core";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { IdentityTables } from "./drizzle/model";
|
|
7
7
|
import {
|
|
8
|
-
coordinatePgAuthStoreTransaction,
|
|
9
|
-
coordinatePgAuthTransaction,
|
|
10
|
-
coordinatePgOAuthStateTransaction,
|
|
11
|
-
makePgAuthServices,
|
|
12
|
-
makePgAuthStoreServices,
|
|
13
8
|
makePgExternalIdentityServices,
|
|
14
9
|
makePgIdentityServices,
|
|
15
|
-
makePgOAuthStateServices,
|
|
16
10
|
makePgSubjectProvisioningServices,
|
|
17
|
-
} from "./drizzle/pg";
|
|
11
|
+
} from "./drizzle/pg-identity";
|
|
18
12
|
|
|
19
13
|
export {
|
|
20
14
|
coordinatePgAuthenticationAuthority as coordinateAuthenticationAuthority,
|
|
@@ -48,22 +42,12 @@ export {
|
|
|
48
42
|
} from "./drizzle/pg-emails";
|
|
49
43
|
|
|
50
44
|
export {
|
|
51
|
-
coordinatePgAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
52
|
-
coordinatePgAuthTransaction as coordinateAuthTransaction,
|
|
53
|
-
coordinatePgOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
54
|
-
makePgAuthStoreServices as makeAuthStoreServices,
|
|
55
45
|
makePgExternalIdentityServices as makeExternalIdentityServices,
|
|
56
|
-
makePgOAuthStateServices as makeOAuthStateServices,
|
|
57
46
|
makePgSubjectProvisioningServices as makeSubjectProvisioningServices,
|
|
58
47
|
};
|
|
59
48
|
|
|
60
49
|
export const commitMode = "interactive" as const;
|
|
61
50
|
|
|
62
|
-
export const makeAuthServices = <C extends AnyPgTable, R extends AnyPgTable, S extends AnyPgTable>(
|
|
63
|
-
database: EffectPgDatabase<AnyRelations>,
|
|
64
|
-
mapping: AuthTables<C, R, S>,
|
|
65
|
-
) => makePgAuthServices(database, mapping);
|
|
66
|
-
|
|
67
51
|
export const makeIdentityServices = <
|
|
68
52
|
Subject extends AnyPgTable,
|
|
69
53
|
Identifier extends AnyPgTable,
|
package/src/SqliteBun.ts
CHANGED
|
@@ -3,30 +3,12 @@ import { type EffectSQLiteBunDatabase, makeWithDefaults } from "drizzle-orm/effe
|
|
|
3
3
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
6
|
+
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
6
7
|
import type {
|
|
7
|
-
AuthStoreTables,
|
|
8
|
-
AuthTables,
|
|
9
8
|
ExternalIdentityTables,
|
|
10
9
|
IdentityTables,
|
|
11
|
-
OAuthStateTables,
|
|
12
10
|
SubjectProvisioningTables,
|
|
13
11
|
} from "./drizzle/model";
|
|
14
|
-
import {
|
|
15
|
-
coordinateSqliteAuthStoreTransaction,
|
|
16
|
-
coordinateSqliteAuthTransaction,
|
|
17
|
-
coordinateSqliteOAuthStateTransaction,
|
|
18
|
-
makeSqliteAuthServices,
|
|
19
|
-
makeSqliteAuthStoreServices,
|
|
20
|
-
makeSqliteOAuthStateServices,
|
|
21
|
-
} from "./drizzle/sqlite";
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
coordinateSqliteAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
25
|
-
coordinateSqliteAuthTransaction as coordinateAuthTransaction,
|
|
26
|
-
coordinateSqliteOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
30
12
|
import { sqlClientPasswordStandaloneGuard } from "./drizzle/password-target";
|
|
31
13
|
import { sqlClientProofStandaloneGuard } from "./drizzle/proof-target";
|
|
32
14
|
import { sqlClientSessionStandaloneGuard } from "./drizzle/session-target";
|
|
@@ -96,25 +78,6 @@ export const {
|
|
|
96
78
|
|
|
97
79
|
export const commitMode = "interactive" as const;
|
|
98
80
|
|
|
99
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
100
|
-
database: EffectSQLiteBunDatabase<AnyRelations>,
|
|
101
|
-
mapping: AuthStoreTables<C, R>,
|
|
102
|
-
) => makeSqliteAuthStoreServices(database, mapping);
|
|
103
|
-
|
|
104
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
105
|
-
database: EffectSQLiteBunDatabase<AnyRelations>,
|
|
106
|
-
mapping: OAuthStateTables<S>,
|
|
107
|
-
) => makeSqliteOAuthStateServices(database, mapping);
|
|
108
|
-
|
|
109
|
-
export const makeAuthServices = <
|
|
110
|
-
C extends AnySQLiteTable,
|
|
111
|
-
R extends AnySQLiteTable,
|
|
112
|
-
S extends AnySQLiteTable,
|
|
113
|
-
>(
|
|
114
|
-
database: EffectSQLiteBunDatabase<AnyRelations>,
|
|
115
|
-
mapping: AuthTables<C, R, S>,
|
|
116
|
-
) => makeSqliteAuthServices(database, mapping);
|
|
117
|
-
|
|
118
81
|
export const makeIdentityServices = <
|
|
119
82
|
Subject extends AnySQLiteTable,
|
|
120
83
|
Identifier extends AnySQLiteTable,
|
package/src/SqliteDo.ts
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import { OAuthStateDecisions } from "@yielded/auth/OAuth";
|
|
2
|
-
import { AuthStoreDecisions } from "@yielded/auth/Persistence";
|
|
3
1
|
import type { AnyRelations } from "drizzle-orm";
|
|
4
2
|
import type { EffectSQLiteDoDatabase } from "drizzle-orm/effect-sqlite-do";
|
|
5
3
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
6
|
-
import {
|
|
7
|
-
import type { SqlError } from "effect/unstable/sql/SqlError";
|
|
4
|
+
import { Effect } from "effect";
|
|
8
5
|
|
|
9
6
|
import type {
|
|
10
|
-
AuthStoreTables,
|
|
11
|
-
AuthTables,
|
|
12
7
|
ExternalIdentityTables,
|
|
13
8
|
IdentityTables,
|
|
14
|
-
OAuthStateTables,
|
|
15
9
|
SubjectProvisioningTables,
|
|
16
10
|
} from "./drizzle/model";
|
|
17
|
-
import {
|
|
18
|
-
makeSqliteAuthServices,
|
|
19
|
-
makeSqliteAuthStoreServices,
|
|
20
|
-
makeSqliteOAuthStateServices,
|
|
21
|
-
} from "./drizzle/sqlite";
|
|
22
11
|
import { makeSqliteEmailTarget, sqliteEmailConfiguration } from "./drizzle/sqlite-emails";
|
|
23
12
|
import {
|
|
24
13
|
makeSqliteExternalIdentityServices,
|
|
@@ -28,7 +17,6 @@ import {
|
|
|
28
17
|
import { makeSqlitePasswordTarget, sqlitePasswordConfiguration } from "./drizzle/sqlite-passwords";
|
|
29
18
|
import { makeSqliteProofTarget, sqliteProofConfiguration } from "./drizzle/sqlite-proofs";
|
|
30
19
|
import { makeSqliteSessionTarget, sqliteSessionConfiguration } from "./drizzle/sqlite-sessions";
|
|
31
|
-
import type { SuppliedService } from "./drizzle/SuppliedService";
|
|
32
20
|
|
|
33
21
|
const sessionTarget = makeSqliteSessionTarget<EffectSQLiteDoDatabase<AnyRelations>, true>(
|
|
34
22
|
sqliteSessionConfiguration("synchronous", Effect.void),
|
|
@@ -100,249 +88,6 @@ export const {
|
|
|
100
88
|
|
|
101
89
|
export const commitMode = "synchronous" as const;
|
|
102
90
|
|
|
103
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
104
|
-
database: EffectSQLiteDoDatabase<AnyRelations>,
|
|
105
|
-
mapping: AuthStoreTables<C, R>,
|
|
106
|
-
) => makeSqliteAuthStoreServices(database, mapping);
|
|
107
|
-
|
|
108
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
109
|
-
database: EffectSQLiteDoDatabase<AnyRelations>,
|
|
110
|
-
mapping: OAuthStateTables<S>,
|
|
111
|
-
) => makeSqliteOAuthStateServices(database, mapping);
|
|
112
|
-
|
|
113
|
-
export const makeAuthServices = <
|
|
114
|
-
C extends AnySQLiteTable,
|
|
115
|
-
R extends AnySQLiteTable,
|
|
116
|
-
S extends AnySQLiteTable,
|
|
117
|
-
>(
|
|
118
|
-
database: EffectSQLiteDoDatabase<AnyRelations>,
|
|
119
|
-
mapping: AuthTables<C, R, S>,
|
|
120
|
-
) => makeSqliteAuthServices(database, mapping);
|
|
121
|
-
|
|
122
|
-
type TransactionOf<D extends EffectSQLiteDoDatabase<AnyRelations>> = Parameters<
|
|
123
|
-
Parameters<D["transaction"]>[0]
|
|
124
|
-
>[0];
|
|
125
|
-
|
|
126
|
-
export function coordinateAuthStoreTransaction<
|
|
127
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
128
|
-
C extends AnySQLiteTable,
|
|
129
|
-
R extends AnySQLiteTable,
|
|
130
|
-
A,
|
|
131
|
-
E,
|
|
132
|
-
DatabaseError,
|
|
133
|
-
DatabaseRequirements,
|
|
134
|
-
>(
|
|
135
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
136
|
-
options: { readonly mapping: AuthStoreTables<C, R>; readonly transaction?: never },
|
|
137
|
-
body: Effect.Effect<A, E, NoInfer<AuthStoreDecisions>>,
|
|
138
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
139
|
-
|
|
140
|
-
export function coordinateAuthStoreTransaction<
|
|
141
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
142
|
-
C extends AnySQLiteTable,
|
|
143
|
-
R extends AnySQLiteTable,
|
|
144
|
-
A,
|
|
145
|
-
E,
|
|
146
|
-
DatabaseError,
|
|
147
|
-
DatabaseRequirements,
|
|
148
|
-
TxId,
|
|
149
|
-
TxShape,
|
|
150
|
-
>(
|
|
151
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
152
|
-
options: {
|
|
153
|
-
readonly mapping: AuthStoreTables<C, R>;
|
|
154
|
-
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
155
|
-
},
|
|
156
|
-
body: Effect.Effect<A, E, NoInfer<AuthStoreDecisions | TxId>>,
|
|
157
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
158
|
-
|
|
159
|
-
export function coordinateAuthStoreTransaction<
|
|
160
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
161
|
-
C extends AnySQLiteTable,
|
|
162
|
-
R extends AnySQLiteTable,
|
|
163
|
-
A,
|
|
164
|
-
E,
|
|
165
|
-
Requirements,
|
|
166
|
-
DatabaseError,
|
|
167
|
-
DatabaseRequirements,
|
|
168
|
-
TxId,
|
|
169
|
-
TxShape,
|
|
170
|
-
>(
|
|
171
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
172
|
-
options: {
|
|
173
|
-
readonly mapping: AuthStoreTables<C, R>;
|
|
174
|
-
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
175
|
-
},
|
|
176
|
-
body: Effect.Effect<A, E, Requirements>,
|
|
177
|
-
) {
|
|
178
|
-
return Effect.flatMap(acquire, (database) =>
|
|
179
|
-
database.transaction<A, E, Exclude<Requirements, AuthStoreDecisions>>((transaction) => {
|
|
180
|
-
const decisions = makeSqliteAuthStoreServices(transaction, options.mapping).decisions;
|
|
181
|
-
const provided = Context.make(AuthStoreDecisions, decisions);
|
|
182
|
-
const work = Effect.provideContext(body, provided);
|
|
183
|
-
|
|
184
|
-
return options.transaction === undefined
|
|
185
|
-
? work
|
|
186
|
-
: Effect.provideService(
|
|
187
|
-
work,
|
|
188
|
-
options.transaction,
|
|
189
|
-
options.transaction.of(transaction as TransactionOf<D>),
|
|
190
|
-
);
|
|
191
|
-
}),
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function coordinateOAuthStateTransaction<
|
|
196
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
197
|
-
S extends AnySQLiteTable,
|
|
198
|
-
A,
|
|
199
|
-
E,
|
|
200
|
-
DatabaseError,
|
|
201
|
-
DatabaseRequirements,
|
|
202
|
-
>(
|
|
203
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
204
|
-
options: { readonly mapping: OAuthStateTables<S>; readonly transaction?: never },
|
|
205
|
-
body: Effect.Effect<A, E, NoInfer<OAuthStateDecisions>>,
|
|
206
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
207
|
-
|
|
208
|
-
export function coordinateOAuthStateTransaction<
|
|
209
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
210
|
-
S extends AnySQLiteTable,
|
|
211
|
-
A,
|
|
212
|
-
E,
|
|
213
|
-
DatabaseError,
|
|
214
|
-
DatabaseRequirements,
|
|
215
|
-
TxId,
|
|
216
|
-
TxShape,
|
|
217
|
-
>(
|
|
218
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
219
|
-
options: {
|
|
220
|
-
readonly mapping: OAuthStateTables<S>;
|
|
221
|
-
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
222
|
-
},
|
|
223
|
-
body: Effect.Effect<A, E, NoInfer<OAuthStateDecisions | TxId>>,
|
|
224
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
225
|
-
|
|
226
|
-
export function coordinateOAuthStateTransaction<
|
|
227
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
228
|
-
S extends AnySQLiteTable,
|
|
229
|
-
A,
|
|
230
|
-
E,
|
|
231
|
-
Requirements,
|
|
232
|
-
DatabaseError,
|
|
233
|
-
DatabaseRequirements,
|
|
234
|
-
TxId,
|
|
235
|
-
TxShape,
|
|
236
|
-
>(
|
|
237
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
238
|
-
options: {
|
|
239
|
-
readonly mapping: OAuthStateTables<S>;
|
|
240
|
-
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
241
|
-
},
|
|
242
|
-
body: Effect.Effect<A, E, Requirements>,
|
|
243
|
-
) {
|
|
244
|
-
return Effect.flatMap(acquire, (database) =>
|
|
245
|
-
database.transaction<A, E, Exclude<Requirements, OAuthStateDecisions>>((transaction) => {
|
|
246
|
-
const decisions = makeSqliteOAuthStateServices(transaction, options.mapping).decisions;
|
|
247
|
-
const provided = Context.make(OAuthStateDecisions, decisions);
|
|
248
|
-
const work = Effect.provideContext(body, provided);
|
|
249
|
-
|
|
250
|
-
return options.transaction === undefined
|
|
251
|
-
? work
|
|
252
|
-
: Effect.provideService(
|
|
253
|
-
work,
|
|
254
|
-
options.transaction,
|
|
255
|
-
options.transaction.of(transaction as TransactionOf<D>),
|
|
256
|
-
);
|
|
257
|
-
}),
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Supported composition boundary for Durable Objects. The owner must return
|
|
263
|
-
* decisions as values and translate rejection only after this root
|
|
264
|
-
* transactionSync commit. Its body may contain only runSync-compatible Effects;
|
|
265
|
-
* the installed driver rejects suspension and rolls back. Owner failure rolls
|
|
266
|
-
* back synchronously, so no retry is performed inside this boundary.
|
|
267
|
-
*/
|
|
268
|
-
export function coordinateAuthTransaction<
|
|
269
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
270
|
-
C extends AnySQLiteTable,
|
|
271
|
-
R extends AnySQLiteTable,
|
|
272
|
-
S extends AnySQLiteTable,
|
|
273
|
-
A,
|
|
274
|
-
E,
|
|
275
|
-
DatabaseError,
|
|
276
|
-
DatabaseRequirements,
|
|
277
|
-
>(
|
|
278
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
279
|
-
options: { readonly mapping: AuthTables<C, R, S>; readonly transaction?: never },
|
|
280
|
-
body: Effect.Effect<A, E, NoInfer<AuthStoreDecisions | OAuthStateDecisions>>,
|
|
281
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
282
|
-
|
|
283
|
-
export function coordinateAuthTransaction<
|
|
284
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
285
|
-
C extends AnySQLiteTable,
|
|
286
|
-
R extends AnySQLiteTable,
|
|
287
|
-
S extends AnySQLiteTable,
|
|
288
|
-
A,
|
|
289
|
-
E,
|
|
290
|
-
DatabaseError,
|
|
291
|
-
DatabaseRequirements,
|
|
292
|
-
TxId,
|
|
293
|
-
TxShape,
|
|
294
|
-
>(
|
|
295
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
296
|
-
options: {
|
|
297
|
-
readonly mapping: AuthTables<C, R, S>;
|
|
298
|
-
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
299
|
-
},
|
|
300
|
-
body: Effect.Effect<A, E, NoInfer<AuthStoreDecisions | OAuthStateDecisions | TxId>>,
|
|
301
|
-
): Effect.Effect<A, E | DatabaseError | SqlError, DatabaseRequirements>;
|
|
302
|
-
|
|
303
|
-
export function coordinateAuthTransaction<
|
|
304
|
-
D extends EffectSQLiteDoDatabase<AnyRelations>,
|
|
305
|
-
C extends AnySQLiteTable,
|
|
306
|
-
R extends AnySQLiteTable,
|
|
307
|
-
S extends AnySQLiteTable,
|
|
308
|
-
A,
|
|
309
|
-
E,
|
|
310
|
-
Requirements,
|
|
311
|
-
DatabaseError,
|
|
312
|
-
DatabaseRequirements,
|
|
313
|
-
TxId,
|
|
314
|
-
TxShape,
|
|
315
|
-
>(
|
|
316
|
-
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
317
|
-
options: {
|
|
318
|
-
readonly mapping: AuthTables<C, R, S>;
|
|
319
|
-
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
320
|
-
},
|
|
321
|
-
body: Effect.Effect<A, E, Requirements>,
|
|
322
|
-
) {
|
|
323
|
-
return Effect.flatMap(acquire, (database) =>
|
|
324
|
-
database.transaction<A, E, Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions>>(
|
|
325
|
-
(transaction) => {
|
|
326
|
-
const decisions = makeSqliteAuthServices(transaction, options.mapping).decisions;
|
|
327
|
-
|
|
328
|
-
const provided = Context.make(AuthStoreDecisions, decisions).pipe(
|
|
329
|
-
Context.add(OAuthStateDecisions, decisions),
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
const work = Effect.provideContext(body, provided);
|
|
333
|
-
|
|
334
|
-
return options.transaction === undefined
|
|
335
|
-
? work
|
|
336
|
-
: Effect.provideService(
|
|
337
|
-
work,
|
|
338
|
-
options.transaction,
|
|
339
|
-
options.transaction.of(transaction as TransactionOf<D>),
|
|
340
|
-
);
|
|
341
|
-
},
|
|
342
|
-
),
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
91
|
export const makeIdentityServices = <
|
|
347
92
|
Subject extends AnySQLiteTable,
|
|
348
93
|
Identifier extends AnySQLiteTable,
|