@robelest/convex-auth 0.0.4-preview.34 → 0.0.4-preview.36

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.
@@ -1408,6 +1408,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
1408
1408
  email?: string;
1409
1409
  emailVerificationTime?: number;
1410
1410
  extend?: any;
1411
+ hasTotp?: boolean;
1411
1412
  image?: string;
1412
1413
  isAnonymous?: boolean;
1413
1414
  lastActiveGroup?: string;
@@ -1454,6 +1455,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
1454
1455
  email?: string;
1455
1456
  emailVerificationTime?: number;
1456
1457
  extend?: any;
1458
+ hasTotp?: boolean;
1457
1459
  image?: string;
1458
1460
  isAnonymous?: boolean;
1459
1461
  lastActiveGroup?: string;
@@ -2593,6 +2595,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
2593
2595
  email?: string;
2594
2596
  emailVerificationTime?: number;
2595
2597
  extend?: any;
2598
+ hasTotp?: boolean;
2596
2599
  image?: string;
2597
2600
  isAnonymous?: boolean;
2598
2601
  lastActiveGroup?: string;
@@ -2626,6 +2629,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
2626
2629
  email?: string;
2627
2630
  emailVerificationTime?: number;
2628
2631
  extend?: any;
2632
+ hasTotp?: boolean;
2629
2633
  image?: string;
2630
2634
  isAnonymous?: boolean;
2631
2635
  lastActiveGroup?: string;
@@ -2638,6 +2642,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
2638
2642
  email?: string;
2639
2643
  emailVerificationTime?: number;
2640
2644
  extend?: any;
2645
+ hasTotp?: boolean;
2641
2646
  image?: string;
2642
2647
  isAnonymous?: boolean;
2643
2648
  lastActiveGroup?: string;
@@ -2771,6 +2776,7 @@ type ComponentApi<Name extends string | undefined = string | undefined> = {
2771
2776
  email?: string;
2772
2777
  emailVerificationTime?: number;
2773
2778
  extend?: any;
2779
+ hasTotp?: boolean;
2774
2780
  image?: string;
2775
2781
  isAnonymous?: boolean;
2776
2782
  lastActiveGroup?: string;
@@ -1,7 +1,9 @@
1
1
  import { defineComponent } from "convex/server";
2
+ import migrations from "@convex-dev/migrations/convex.config";
2
3
 
3
4
  //#region src/component/convex.config.ts
4
5
  const component = defineComponent("auth");
6
+ component.use(migrations);
5
7
  var convex_config_default = component;
6
8
 
7
9
  //#endregion
@@ -0,0 +1,36 @@
1
+ import { components, internal } from "./_generated/api.js";
2
+ import { internalMutation } from "./_generated/server.js";
3
+ import { Migrations } from "@convex-dev/migrations";
4
+
5
+ //#region src/component/migrations.ts
6
+ /**
7
+ * Component-internal data migrations, run via the `@convex-dev/migrations`
8
+ * component mounted in `convex.config.ts`.
9
+ *
10
+ * The auth component owns its own tables, so migrations over them must run
11
+ * *inside* the component. Consumers trigger a migration after upgrading:
12
+ *
13
+ * ```sh
14
+ * npx convex run auth/migrations:runDropHasTotp '{}'
15
+ * ```
16
+ *
17
+ * @module
18
+ */
19
+ const migrations = new Migrations(components.migrations, { internalMutation });
20
+ /**
21
+ * Strip the deprecated denormalized `User.hasTotp` cache from every row.
22
+ *
23
+ * The field was removed from the typed surface; this clears it from
24
+ * pre-existing data so it can eventually be dropped from the schema.
25
+ * Idempotent — rows without the field are skipped.
26
+ */
27
+ const dropHasTotp = migrations.define({
28
+ table: "User",
29
+ migrateOne: (_ctx, doc) => doc.hasTotp === void 0 ? void 0 : { hasTotp: void 0 }
30
+ });
31
+ /** CLI/dashboard runner: `npx convex run auth/migrations:runDropHasTotp`. */
32
+ const runDropHasTotp = migrations.runner(internal.migrations.dropHasTotp);
33
+
34
+ //#endregion
35
+ export { dropHasTotp, migrations, runDropHasTotp };
36
+ //# sourceMappingURL=migrations.js.map