strapi-plugin-firebase-authentication 1.5.1 → 1.7.0

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.
@@ -0,0 +1,22 @@
1
+ import type { Core } from "@strapi/strapi";
2
+ interface DuplicateInfo {
3
+ user_id: number;
4
+ count: string;
5
+ }
6
+ interface MigrationResult {
7
+ status: "created" | "exists" | "blocked_by_duplicates" | "table_not_found" | "error";
8
+ duplicates?: DuplicateInfo[];
9
+ }
10
+ /**
11
+ * Ensure unique constraint on firebase_user_data_user_lnk.user_id
12
+ *
13
+ * This migration:
14
+ * 1. Checks if the unique index already exists (idempotent)
15
+ * 2. Checks for existing duplicates BEFORE trying to create index
16
+ * 3. If duplicates exist: logs warning, returns info, skips creation
17
+ * 4. If no duplicates: creates the unique index
18
+ *
19
+ * SAFE: This only prevents future duplicates, does NOT delete existing data.
20
+ */
21
+ declare function ensureUserLinkUniqueConstraint(strapi: Core.Strapi): Promise<MigrationResult>;
22
+ export default ensureUserLinkUniqueConstraint;
@@ -0,0 +1,31 @@
1
+ import type { Core } from "@strapi/strapi";
2
+ interface OrphanReport {
3
+ duplicateEmailGroups: number;
4
+ orphanUsers: Array<{
5
+ id: number;
6
+ email: string;
7
+ username: string;
8
+ created_at: string;
9
+ has_firebase_link: boolean;
10
+ }>;
11
+ usersToKeep: Array<{
12
+ id: number;
13
+ email: string;
14
+ firebase_user_id: string;
15
+ }>;
16
+ emailsNeedingNormalization: number;
17
+ }
18
+ /**
19
+ * Report potential orphan users created by the email whitespace bug
20
+ *
21
+ * This migration:
22
+ * 1. Finds duplicate emails (with/without whitespace)
23
+ * 2. Identifies which users have Firebase links (KEEP) vs orphans (potential DELETE)
24
+ * 3. ONLY REPORTS - does NOT delete anything
25
+ *
26
+ * Run with: FIREBASE_REPORT_ORPHANS=true yarn develop
27
+ *
28
+ * After reviewing the report, admins can run the cleanup SQL manually.
29
+ */
30
+ declare function reportOrphanUsers(strapi: Core.Strapi): Promise<OrphanReport | null>;
31
+ export default reportOrphanUsers;
@@ -3,7 +3,9 @@ export interface LinkResult {
3
3
  totalStrapiUsers: number;
4
4
  totalFirebaseUsers: number;
5
5
  linked: number;
6
- skipped: number;
6
+ alreadyLinked: number;
7
+ noFirebaseMatch: number;
8
+ uidConflict: number;
7
9
  errors: number;
8
10
  }
9
11
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-firebase-authentication",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "Allows easy integration between clients utilizing Firebase for authentication and Strapi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,10 @@
11
11
  "url": "https://github.com/Meta-CTO/strapi-plugin-firebase-auth/issues"
12
12
  },
13
13
  "homepage": "https://github.com/Meta-CTO/strapi-plugin-firebase-auth#readme",
14
- "author": "Garrett Fritz <garrett@metacto.com>",
14
+ "authors": [
15
+ "Garrett Fritz <garrett@metacto.com>",
16
+ "Felippe Haeitmann <felippe.haeitmann@metacto.com>"
17
+ ],
15
18
  "keywords": [
16
19
  "strapi5",
17
20
  "strapi-plugin"