1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3c06cee4-b555-598d-bc6d-3793efdf1b05")}catch(e){}}(); 3import{b as Ee}from"./chunk-HIIYI656.js";import{a as Fe,b as Ve}from"./chunk-FMAAPPZH.js";import{a as ve}from"./chunk-EAEYHGVD.js";import{a as ce,b as pe,c as Ce,e as fe,f as ue,h as he,i as xe,k as be,l as Se,n as ge,p as Me}from"./chunk-IZJQTZVB.js";import{j as se}from"./chunk-TA6QZW4D.js";import{a as me,b as _e}from"./chunk-XBHOMARE.js";import"./chunk-FLZNG7WM.js";import"./chunk-Y53ZYOIU.js";import{c as de}from"./chunk-CN4EGA4I.js";import{a as le}from"./chunk-5K5PYV5V.js";import"./chunk-TDGVUJZJ.js";import"./chunk-MWF7JXGK.js";import{a as ae,b as re}from"./chunk-KS3Q7H57.js";import{d as ne,e as oe}from"./chunk-UQU3EU23.js";import"./chunk-346ISJSG.js";import"./chunk-CNRKNNWP.js";import"./chunk-L6Z7ZO7O.js";import"./chunk-TLCCWCNW.js";import{a as ee}from"./chunk-5SJALNJN.js";import{a as J,d as X,i as Z}from"./chunk-XEY266ER.js";import"./chunk-SEDEP525.js";import"./chunk-SECBI6OV.js";import"./chunk-LXBG4CPT.js";import"./chunk-56KVT3OQ.js";import{H as Y,b as j,g as Q,n as U,p as K}from"./chunk-MF7VZYLI.js";import{b as z,e as G}from"./chunk-NFMDOWTR.js";import"./chunk-QE6DXY66.js";import{a as te,b as ie}from"./chunk-B5YZVWIB.js";import"./chunk-HCSN2NMS.js";import"./chunk-FDIRDMLL.js";import"./chunk-XQLUXGKM.js";import"./chunk-3JHJJCIF.js";import"./chunk-J4X36CU5.js";import"./chunk-X3ZU2Z3D.js";import"./chunk-QZXCI4ZV.js";import"./chunk-VO633UWN.js";import{g as W}from"./chunk-NK2KZLT6.js";import"./chunk-TYTNPDEC.js";import"./chunk-WAPZ5LEW.js";import{B as O,E as $}from"./chunk-746D4QTP.js";import{Ac as I,Dc as m,Ed as H,Ib as L,Ob as c,Pc as y,Sc as r,Tc as u,Uc as g,Vc as q,Yc as D,Zc as R,_c as P,cc as _,dc as s,gc as E,hc as w,hd as B,ic as h,jc as o,kc as n,lc as x,nd as M,od as V,pc as C,pd as N,qa as F,qb as a,qc as f,uc as T,va as b,wa as S,zd as A}from"./chunk-BZJI6Z2X.js";import"./chunk-CS7K6LXP.js";var we=()=>[10,25,50],k=(t,i)=>i.field;function Ie(t,i){if(t&1){let e=T();o(0,"div",0)(1,"div",1)(2,"h1",2),r(3,"Firestore Verification"),n(),o(4,"p",3),r(5," Compare leaderboard data between SQL and Firestore to detect drift. "),n()()(),o(6,"div",4)(7,"div",5)(8,"mat-form-field")(9,"mat-label"),r(10,"Leaderboard ID"),n(),o(11,"input",6),P("ngModelChange",function(d){b(e);let p=m();return R(p.leaderboardId,d)||(p.leaderboardId=d),S(d)}),I("keyup.enter",function(){b(e);let d=m();return S(d.runVerification())}),n(),x(12,"mat-icon",7),n()(),o(13,"div",8)(14,"mat-checkbox",9),P("ngModelChange",function(d){b(e);let p=m();return R(p.includeMemberMismatches,d)||(p.includeMemberMismatches=d),S(d)}),r(15," Include member comparison "),n()(),o(16,"div",10)(17,"button",11),I("click",function(){b(e);let d=m();return S(d.runVerification())}),r(18," Run "),n()()()}if(t&2){let e=m();a(11),D("ngModel",e.leaderboardId),a(3),D("ngModel",e.includeMemberMismatches),a(3),h("active",e.loading)("disabled",!e.leaderboardId)}}function ye(t,i){t&1&&(o(0,"span"),r(1,"\u2014 Firestore is disabled"),n())}function Te(t,i){if(t&1&&(o(0,"span",14),r(1),M(2,"date"),n()),t&2){let e=m(2);a(),g("Checked: ",N(2,1,e.lastDriftCheckedAt,"medium"))}}function De(t,i){t&1&&(o(0,"th",29),r(1,"Metric"),n())}function Re(t,i){if(t&1&&(o(0,"td",30),r(1),n()),t&2){let e=i.$implicit;a(),u(e.metric)}}function Pe(t,i){t&1&&(o(0,"th",29),r(1,"SQL"),n())}function ke(t,i){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=i.$implicit;a(),u(e.sql)}}function Le(t,i){t&1&&(o(0,"th",29),r(1,"Firestore"),n())}function qe(t,i){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=i.$implicit;a(),u(e.firestore)}}function Be(t,i){t&1&&(o(0,"th",29),r(1,"Status"),n())}function Ne(t,i){t&1&&(o(0,"span",32),r(1,"OK"),n())}function Ae(t,i){t&1&&(o(0,"span",33),r(1,"DOC MISSING"),n())}
3function He(t,i){t&1&&(o(0,"span",33),r(1,"FIELD MISSING"),n())}function Oe(t,i){t&1&&(o(0,"span",34),r(1,"MISMATCH"),n())}function $e(t,i){if(t&1&&(o(0,"td",31),_(1,Ne,2,0,"span",32)(2,Ae,2,0,"span",33)(3,He,2,0,"span",33)(4,Oe,2,0,"span",34),n()),t&2){let e=i.$implicit;a(),s(e.status==="ok"?1:e.status==="document_missing"?2:e.status==="missing"?3:4)}}function We(t,i){t&1&&x(0,"tr",35)}function ze(t,i){t&1&&x(0,"tr",36)}function Ge(t,i){t&1&&(o(0,"div",28)(1,"p"),r(2,"No results found."),n()())}function je(t,i){if(t&1&&(o(0,"span"),r(1,", "),o(2,"strong",39),r(3),M(4,"number"),n()()),t&2){let e=m(5);a(3),g("",V(4,1,e.orphanCount)," orphan(s)")}}function Qe(t,i){if(t&1&&(o(0,"span"),r(1),M(2,"number"),n(),_(3,je,5,3,"span"),o(4,"span"),r(5,")"),n()),t&2){let e=m(4);a(),g("(",V(2,2,e.totalFirestoreMembers)," Firestore member(s)"),a(2),s(e.orphanCount>0?3:-1)}}function Ue(t,i){t&1&&(o(0,"p",38),r(1,"All member entries match."),n())}function Ke(t,i){t&1&&(o(0,"th",29),r(1,"Entry ID"),n())}function Ye(t,i){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=i.$implicit;a(),u(e.leaderboard_entry_id||"-")}}function Je(t,i){t&1&&(o(0,"th",29),r(1,"URN"),n())}function Xe(t,i){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=i.$implicit;a(),u(e.urn||"-")}}function Ze(t,i){t&1&&(o(0,"th",29),r(1,"Perm URN (Doc ID)"),n())}function et(t,i){t&1&&(o(0,"span",48),r(1,"ORPHAN"),n())}function tt(t,i){if(t&1&&(o(0,"td",31),r(1),_(2,et,2,0,"span",48),n()),t&2){let e=i.$implicit;a(),g(" ",e.perm_urn||"-"," "),a(),s(e.orphan_document?2:-1)}}function it(t,i){t&1&&(o(0,"th",29),r(1,"Field"),n())}function nt(t,i){if(t&1&&(o(0,"div",49),r(1),n()),t&2){let e=i.$implicit;a(),u(e.field)}}function ot(t,i){if(t&1&&(o(0,"td",31),E(1,nt,2,1,"div",49,k),n()),t&2){let e=i.$implicit,l=m(5);a(),w(l.getMemberMismatchFields(e))}}function at(t,i){t&1&&(o(0,"th",29),r(1,"SQL"),n())}function rt(t,i){if(t&1&&(o(0,"div",49),r(1),n()),t&2){let e=i.$implicit;a(),u(e.sql)}}function lt(t,i){if(t&1&&(o(0,"td",31),E(1,rt,2,1,"div",49,k),n()),t&2){let e=i.$implicit,l=m(5);a(),w(l.getMemberMismatchFields(e))}}function dt(t,i){t&1&&(o(0,"th",29),r(1,"Firestore"),n())}function mt(t,i){if(t&1&&(o(0,"div",49),r(1),n()),t&2){let e=i.$implicit;a(),u(e.firestore)}}function _t(t,i){if(t&1&&(o(0,"td",31),E(1,mt,2,1,"div",49,k),n()),t&2){let e=i.$implicit,l=m(5);a(),w(l.getMemberMismatchFields(e))}}function st(t,i){t&1&&(o(0,"th",29),r(1,"Last Synced"),n())}function ct(t,i){if(t&1&&(o(0,"td",31),r(1),n()),t&2){let e=i.$implicit,l=m(5);a(),u(l.formatSyncedAt(e.synced_at))}}function pt(t,i){t&1&&x(0,"tr",35)}function Ct(t,i){t&1&&x(0,"tr",36)}function ft(t,i){t&1&&(o(0,"div",47)(1,"div",50),x(2,"mat-spinner",51),n()())}function ut(t,i){if(t&1){let e=T();o(0,"div",16)(1,"div",17)(2,"table",40),C(3,41),c(4,Ke,2,0,"th",20)(5,Ye,2,1,"td",23),f(),C(6,42),c(7,Je,2,0,"th",20)(8,Xe,2,1,"td",23),f(),C(9,43),c(10,Ze,2,0,"th",20)(11,tt,3,2,"td",23),f(),C(12,44),c(13,it,2,0,"th",20)(14,ot,3,0,"td",23),f(),C(15,22),c(16,at,2,0,"th",20)(17,lt,3,0,"td",23),f(),C(18,24),c(19,dt,2,0,"th",20)(20,_t,3,0,"td",23),f(),C(21,45),c(22,st,2,0,"th",20)(23,ct,2,1,"td",23),f(),c(24,pt,1,0,"tr",26)(25,Ct,1,0,"tr",27),n()(),o(26,"mat-paginator",46),I("page",function(d){b(e);let p=m(4);return S(p.onMemberPageChange(d))}),n(),_(27,ft,3,0,"div",47),n()}if(t&2){let e=m(4);a(2),h("dataSource",e.memberRows),a(22),h("matHeaderRowDef",e.memberColumns),a(),h("matRowDefColumns",e.memberColumns),a(),h("length",e.totalMismatches)("pageSize",e.perPage)("pageSizeOptions",B(8,we))("pageIndex",e.memberPage-1),a(),s(e.loading?27:-1)}}function ht(t,i){if(t&1&&(o(0,"div",12)(1,"div",1)(2,"h2",15),r(3,"Member Mismatches"),n(),o(4,"p",37),r(5),M(6,"number"),M(7,"number"),_(8,Qe,6,4),r(9," . "),n(),_(10,Ue,2,0,"p",38)(11,ut,28,9,"div",16),n()()),t&2){let e=m(3);a(5),q(" ",V(6,4,e.totalMismatches)," mismatch(es) found out of ",V(7,6,e.totalChecked)," SQL entries checked "),a(3),s(e.totalFirestoreMembers>0?8:-1),a(2),s(e.memberRows.length===0?10:11)}}function xt(t,i){if(t&1&&(o(0,"div",12)(1,"div",1)(2,"h2",15),r(3,"Summary Comparison"),n(),o(4,"div",16)(5,"div",17)(6,"table",18),C(7,19),c(8,De,2,0,"th",20)(9,Re,2,1,"td",21),f(),C(10,22),c(11,Pe,2,0,"th",20)(12,ke,2,1,"td",23),f(),C(13,24),c(14,Le,2,0,"th",20)(15,qe,2,1,"td",23),f(),C(16,25),c(17,Be,2,0,"th",20)(18,$e,5,1,"td",23),f(),c(19,We,1,0,"tr",26)(20,ze,1,0,"tr",27),n()(),_(21,Ge,3,0,"div",28),n()()(),_(22,ht,12,8,"div",12)),t&2){let e=m(2);a(6),h("dataSource",e.summaryRows),a(13),h("matHeaderRowDef",e.summaryColumns),a(),h("matRowDefColumns",e.summaryColumns),a(),s(e.summaryRows.length===0?21:-1),a(),s(e.result.member_mismatches?22:-1)}}function bt(t,i){if(t&1&&(o(0,"div",12)(1,"div",1)(2,"div",13)(3,"strong"),r(4),n(),o(5,"span"),r(6),n(),_(7,ye,2,0,"span"),_(8,Te,3,4,"span",14),n()()(),_(9,xt,23,5)),t&2){let e=m();a(2),y("alert-success",e.syncStatus==="in_sync")("alert-danger",e.syncStatus==="drifted")("alert-secondary",e.syncStatus==="unavailable"),a(2),u(e.statusLabel),a(2),g("Leaderboard #",e.result.leaderboard_
3id),a(),s(e.result.firestore_disabled?7:-1),a(),s(e.lastDriftCheckedAt?8:-1),a(),s(e.syncStatus!=="unavailable"?9:-1)}}function St(t,i){t&1&&(o(0,"div",0)(1,"div",52),x(2,"mat-spinner",51),n()())}var Kt=(()=>{class t{leaderboardService=F(ve);downloadReportService=F(Ee);snackBar=F(de);route=F(W);prefilledLeaderboardId=H(null);leaderboardId="";includeMemberMismatches=!0;loading=!1;memberPage=1;perPage=10;result=null;syncStatus=null;lastDriftCheckedAt=null;summaryRows=[];memberRows=[];totalMismatches=0;totalChecked=0;totalFirestoreMembers=0;orphanCount=0;totalMemberPages=0;summaryColumns=["metric","sql","firestore","status"];memberColumns=["leaderboard_entry_id","urn","perm_urn","field","sql","firestore","synced_at"];constructor(){A(()=>{let e=this.prefilledLeaderboardId();e&&(this.leaderboardId=String(e),this.includeMemberMismatches=!0,this.runVerification())}),this.route.queryParamMap.subscribe(e=>{let l=e.get("download");if(l){this.triggerCsvDownload(l);return}let d=e.get("leaderboardId");d&&!this.prefilledLeaderboardId()&&(this.leaderboardId=d,this.includeMemberMismatches=!0,this.runVerification())})}runVerification(){let e=parseInt(this.leaderboardId,10);if(!e||e<=0){this.snackBar.open("Please enter a valid leaderboard ID","Ok");return}this.loading=!0,this.memberPage=1,this.fetchVerification(e,this.memberPage,!0)}loadMemberPage(e){if(e<1||e>this.totalMemberPages)return;this.memberPage=e;let l=parseInt(this.leaderboardId,10);this.loading=!0,this.fetchVerification(l,e,!1)}onMemberPageChange(e){this.perPage=e.pageSize,this.loadMemberPage(e.pageIndex+1)}fetchVerification(e,l,d){let p={};this.includeMemberMismatches&&(p.include_member_mismatches=!0,p.page=l,p.per_page=this.perPage,d&&(p.refresh=!0)),this.leaderboardService.firestoreVerification(e,p).subscribe({next:v=>{this.result=v,this.syncStatus=v.sync_status,this.lastDriftCheckedAt=v.last_drift_checked_at||null,this.buildSummaryRows(v.summary_comparison),this.buildMemberRows(v.member_mismatches),this.loading=!1},error:()=>{this.loading=!1,this.result=null,this.syncStatus=null,this.summaryRows=[],this.memberRows=[],this.totalMismatches=0,this.totalChecked=0,this.totalFirestoreMembers=0,this.orphanCount=0,this.totalMemberPages=0}})}buildSummaryRows(e){if(!e||e.length===0){this.summaryRows=[];return}this.summaryRows=e.map(l=>({metric:l.metric,sql:l.sql??"-",firestore:l.firestore??"-",status:l.status}))}buildMemberRows(e){if(!e){this.memberRows=[],this.totalMismatches=0,this.totalChecked=0,this.totalFirestoreMembers=0,this.orphanCount=0,this.totalMemberPages=0;return}this.totalMismatches=e.total_mismatches||0,this.totalChecked=e.total_checked||0,this.totalFirestoreMembers=e.total_firestore_members||0,this.orphanCount=e.orphan_count||0,this.totalMemberPages=Math.ceil(this.totalMismatches/this.perPage)||1,this.memberRows=e.data||[]}getMemberMismatchFields(e){return e.orphan_document?[{field:"document",sql:"MISSING",firestore:"ORPHAN (Firestore only)"},...e.firestore?Object.entries(e.firestore).map(([l,d])=>({field:l,sql:"-",firestore:d})):[]]:e.missing_document?[{field:"document",sql:"exists",firestore:"MISSING"},...e.sql?Object.entries(e.sql).map(([l,d])=>({field:l,sql:d,firestore:"-"})):[]]:e.error?[{field:"error",sql:"-",firestore:e.error}]:e.mismatches?Object.entries(e.mismatches).map(([l,d])=>({field:l,sql:d.sql,firestore:d.firestore==="missing"?"MISSING":d.firestore??"null"})):[]}triggerCsvDownload(e){this.leaderboardService.firestoreDriftDownload(e).subscribe({next:l=>{this.downloadReportService.createLinkElement(decodeURI(l.url),"_self",l.file_name)},error:()=>{this.snackBar.open("Failed to download report. The file may no longer exist.","Ok")}})}formatSyncedAt(e){return e?new Date(e*1e3).toLocaleString():"-"}get statusLabel(){switch(this.syncStatus){case"in_sync":return"IN SYNC";case"drifted":return"DRIFTED";case"unavailable":return"UNAVAILABLE";default:return""}}static \u0275fac=function(l){return new(l||t)};static \u0275cmp=L({type:t,selectors:[["app-firestore-verification"]],inputs:{prefilledLeaderboardId:[1,"prefilledLeaderboardId"]},decls:5,vars:7,consts:[[1,"row"],[1,"col-12"],[1,"dashboard-heading","mb-2"],[1,"text-muted","mb-3"],[1,"row","align-items-center","mb-4"],[1,"col-12","col-md-3"],["type","number","matInput","","placeholder","Enter leaderboard ID",3,"ngModelChange","keyup.enter","ngModel"],["matPrefix","","fontSet","fa-solid","fontIcon","fa-search"],[1,"col-12","col-md-4","d-flex","align-items-center"],["color","primary",3,"ngModelChange","ngModel"],[1,"col-12","col-md-2"],["mat-raised-button","","color","primary","type","button","appLoadingBtn","",1,"custom",3,"click","active","disabled"],[1,"row","mb-4"],[1,"alert","d-flex","align-items-center","gap-3","mb-0"],[1,"ms-auto","text-muted","small"],[1,"mb-3"],[1,"table-wrapper"],[1,"table-responsive"],["mat-table","",3,"dataSource"],["matColumnDef","metric"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","","class","fw-medium",4,"matCellDef"],["matColumnDef","sql"],["mat-cell","",4,"matCellDef"],["matColumnDef","firestore"],["matColumnDef","status"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],[1,"table-no-results"],["mat-header-cell",""],["mat-cell","",1,"fw-medium"],["mat-cell",""],[1,"badge","bg-success"],[1,"badge","bg-warning","text-dark"],[1,"badge","bg-danger"],["mat-header-row",""],["mat-row",""],[1,"text-muted","mb-2"],[1,"text-success","fw-semibold"],[1,"text-danger"],["mat-table","","multiTemplateDataRows","",3,"dataSource"],["matColumnDef","leaderboard_entry_id"],["matColumnDef","urn"],["matColumnDef","perm_urn"],["matColumnDef","field"],["matColumnDef","synced_at"],["showFirstLastButtons","",3,"page","length","pageSize","pageSizeOptions","pageIndex"],[1,"update-overlay"],[1,"badge","bg-danger","ms-1"],[1,"py-1"],[1,"spinner"],["diameter","50"],[1,"col-12","text-center","py-5"]],template:function(l,d){l&1&&(o(0,"div")(1,"div"),_(2,Ie,19,4),_(3,bt,10,11),_(4,St,3,0,"div",0),n()()),l&2&&(y("min-vh-100",!d.prefilledLeaderboardId()),a(),y("dashboard-container-fluid",!d.prefilledLeaderboardId()),a(),s(d.prefilledLeaderboardId()?-1:2),a(),s(d.result?3:-1),a(),s(d.loading&&!d.result?4:-1))},dependencies:[Y,j,K,Q,U,ee,Z,J,X,oe,ne,G,z,_e,me,Me,ce,Ce,xe,fe,pe,be,ue,he,Se,ge,Ve,Fe,re,ae,se,ie,te,le,O,$],encapsulation:2})}return t})();export{Kt as FirestoreVerificationComponent}; 4 5//# debugId=3c06cee4-b555-598d-bc6d-3793efdf1b05
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.