@farm.js/auth 0.1.0-beta.103 → 0.1.0-beta.104
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/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -1
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +14 -2
- package/package.json +1 -1
package/dist/internal.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface FarmAuthIntegration {
|
|
|
18
18
|
}
|
|
19
19
|
export declare function createFarmAuthIntegration(config: ResolvedFarmAuthConfig, options: FarmAuthIntegrationOptions): FarmAuthIntegration;
|
|
20
20
|
export declare function migrateFarmAuth(): Promise<void>;
|
|
21
|
+
export declare function compileFarmAuthMigration(): Promise<string>;
|
|
21
22
|
export declare function disposeFarmAuth(): Promise<void>;
|
|
22
23
|
export {};
|
|
23
24
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AASzD,UAAU,0BAA0B;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CACpC;AAED,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAC;IACjD,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC9C,CAAC,CAAC;CACJ;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAmBrB;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD"}
|
package/dist/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configureFarmAuth, disposeFarmAuth as runDispose, getFarmAuthRuntime, migrateFarmAuth as runMigration, } from "./runtime.js";
|
|
1
|
+
import { configureFarmAuth, disposeFarmAuth as runDispose, getFarmAuthRuntime, migrateFarmAuth as runMigration, compileFarmAuthMigration as runCompileMigration, } from "./runtime.js";
|
|
2
2
|
export function createFarmAuthIntegration(config, options) {
|
|
3
3
|
configureFarmAuth(config, options);
|
|
4
4
|
return {
|
|
@@ -21,6 +21,9 @@ export function createFarmAuthIntegration(config, options) {
|
|
|
21
21
|
export async function migrateFarmAuth() {
|
|
22
22
|
await runMigration();
|
|
23
23
|
}
|
|
24
|
+
export async function compileFarmAuthMigration() {
|
|
25
|
+
return runCompileMigration();
|
|
26
|
+
}
|
|
24
27
|
export async function disposeFarmAuth() {
|
|
25
28
|
await runDispose();
|
|
26
29
|
}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -23,5 +23,11 @@ export declare function getFarmAuthRequest(request?: Request): Request;
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function disposeFarmAuth(): Promise<void>;
|
|
25
25
|
export declare function migrateFarmAuth(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* The statements `migrateFarmAuth` would run, for review before applying them.
|
|
28
|
+
* Better Auth owns the schema, so the sql comes from its migrator rather than
|
|
29
|
+
* from Farm's own table declarations.
|
|
30
|
+
*/
|
|
31
|
+
export declare function compileFarmAuthMigration(): Promise<string>;
|
|
26
32
|
export {};
|
|
27
33
|
//# sourceMappingURL=runtime.d.ts.map
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAMzD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CACpC;AAED,UAAU,iBAAiB;IACzB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,GAAG,EAAE;QACH,UAAU,CAAC,KAAK,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KAC3D,CAAC;CACH;AAqBD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAeN;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CA6BrE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAU7D;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CASrD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAMzD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CACpC;AAED,UAAU,iBAAiB;IACzB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,GAAG,EAAE;QACH,UAAU,CAAC,KAAK,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KAC3D,CAAC;CACH;AAqBD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAeN;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CA6BrE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAU7D;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CASrD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAIrD;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEhE"}
|
package/dist/runtime.js
CHANGED
|
@@ -81,6 +81,19 @@ export async function disposeFarmAuth() {
|
|
|
81
81
|
await closeDatabase(database);
|
|
82
82
|
}
|
|
83
83
|
export async function migrateFarmAuth() {
|
|
84
|
+
await withAuthMigrations(async (migrations) => {
|
|
85
|
+
await migrations.runMigrations();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The statements `migrateFarmAuth` would run, for review before applying them.
|
|
90
|
+
* Better Auth owns the schema, so the sql comes from its migrator rather than
|
|
91
|
+
* from Farm's own table declarations.
|
|
92
|
+
*/
|
|
93
|
+
export async function compileFarmAuthMigration() {
|
|
94
|
+
return withAuthMigrations((migrations) => migrations.compileMigrations());
|
|
95
|
+
}
|
|
96
|
+
async function withAuthMigrations(use) {
|
|
84
97
|
const state = getState();
|
|
85
98
|
if (!state.config?.enabled || !state.options) {
|
|
86
99
|
throw new Error("Farm Auth is not enabled in farm.config.ts.");
|
|
@@ -90,8 +103,7 @@ export async function migrateFarmAuth() {
|
|
|
90
103
|
});
|
|
91
104
|
const { getMigrations } = await import("better-auth/db/migration");
|
|
92
105
|
try {
|
|
93
|
-
|
|
94
|
-
await migrations.runMigrations();
|
|
106
|
+
return await use(await getMigrations(options));
|
|
95
107
|
}
|
|
96
108
|
finally {
|
|
97
109
|
await closeDatabase(options.database);
|