@arcblock/payment-service 1.29.2 → 1.29.3-beta-frontend-serve.4
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/cf.d.ts +104 -0
- package/dist/cf.js +598 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +522 -292
- package/package.json +14 -7
- package/web/assets/Community-DjnKQ_eJ.js +1 -0
- package/web/assets/Holiday-B3mAiPaR.js +1 -0
- package/web/assets/Meeting-Boiro55U.js +1 -0
- package/web/assets/OffSick-CmlSODCj.js +1 -0
- package/web/assets/WorkingRemotely-CQReAoVA.js +1 -0
- package/web/assets/abtwallet-o1JAGJkW.png +0 -0
- package/web/assets/account-DETfFe4_.js +1 -0
- package/web/assets/action-B_DQJlip.js +1 -0
- package/web/assets/actions-BaDh4xWX.js +1 -0
- package/web/assets/actions-BknL4OyZ.js +1 -0
- package/web/assets/actions-Bt_jST94.js +1 -0
- package/web/assets/actions-BtaoyTWt.js +1 -0
- package/web/assets/actions-D9MHLBFH.js +1 -0
- package/web/assets/actions-DJyfN5OU.js +1 -0
- package/web/assets/actions-EPYeS5p4.js +1 -0
- package/web/assets/actions-QPa-8lfB.js +1 -0
- package/web/assets/actions-jxGAdGfb.js +1 -0
- package/web/assets/add-price-CD-utowo.js +1 -0
- package/web/assets/admin-_nEB-lHn.js +52 -0
- package/web/assets/aistro-NLUOUWwT.png +0 -0
- package/web/assets/android-Xe96zWxX.png +0 -0
- package/web/assets/assign-CkV5Q2LP.js +1 -0
- package/web/assets/attempts-DySeqBYU.js +1 -0
- package/web/assets/bedrock-yFRPpe__.png +0 -0
- package/web/assets/browser-Bb9g-cvG.js +1 -0
- package/web/assets/browser-DSLTxXlL.js +1 -0
- package/web/assets/cache-state-lld4zuDg.js +1 -0
- package/web/assets/change-payment-CPUCUEER.js +1 -0
- package/web/assets/change-plan-CxE-XfWc.js +1 -0
- package/web/assets/chrome-BPS46pXA.js +23 -0
- package/web/assets/click-boundary-y8dVA_tr.js +1 -0
- package/web/assets/collapse-BvbJGg1V.js +1 -0
- package/web/assets/collapse-CSrlJ0eG.js +1 -0
- package/web/assets/connect-CC_l_f6Q.js +5 -0
- package/web/assets/copyable-DpX04wZz.js +1 -0
- package/web/assets/create-3SsWCAOC.js +1 -0
- package/web/assets/create-BkQAaSvD.js +1 -0
- package/web/assets/create-BmcRybZ5.js +1 -0
- package/web/assets/create-Bs65p5Ne.js +1 -0
- package/web/assets/create-kG09X9gl.js +1 -0
- package/web/assets/create-tYebjhr9.js +1 -0
- package/web/assets/credit-grant-item-list-Bk27jIc7.js +1 -0
- package/web/assets/credit-overview-DmMSEs14.js +5 -0
- package/web/assets/currency-GstdXsJf.js +1 -0
- package/web/assets/currency-restrictions-DYLv4YyW.js +1 -0
- package/web/assets/currency-select-DGS-62-L.js +1 -0
- package/web/assets/dayjs-B9tvQIKg.js +1 -0
- package/web/assets/deepseek-C3x42pq3.png +0 -0
- package/web/assets/description-Ym17DL48.js +1 -0
- package/web/assets/detail-15zxCbV9.js +10 -0
- package/web/assets/detail-ASPdMJoW.js +1 -0
- package/web/assets/detail-BJTcK7mx.js +1 -0
- package/web/assets/detail-CIx9vkir.js +1 -0
- package/web/assets/detail-CT9Unyrf.js +1 -0
- package/web/assets/detail-Cb9HBSMw.js +1 -0
- package/web/assets/detail-Cr2wG4Th.js +1 -0
- package/web/assets/detail-CxYQYu_l.js +11 -0
- package/web/assets/detail-D5KRrQDx.js +1 -0
- package/web/assets/detail-D5NbV29V.js +1 -0
- package/web/assets/detail-DB56SG-k.js +1 -0
- package/web/assets/detail-DE3OOC5M.js +15 -0
- package/web/assets/detail-DG4l2CqN.js +1 -0
- package/web/assets/detail-DPCTQLOx.js +1 -0
- package/web/assets/detail-DVVzYhdV.js +1 -0
- package/web/assets/detail-Do9QO5L2.js +1 -0
- package/web/assets/detail-Dqc0OfCQ.js +1 -0
- package/web/assets/detail-DuO_Jn5X.js +1 -0
- package/web/assets/detail-DuWdZIyp.js +1 -0
- package/web/assets/detail-K9EVY3r2.js +1 -0
- package/web/assets/detail-OZeeKI69.js +24 -0
- package/web/assets/detail-cwHZbY62.js +1 -0
- package/web/assets/detail-uhlID8jD.js +15 -0
- package/web/assets/doubao-yPqHSkLx.png +0 -0
- package/web/assets/drawer-form-Cl0T1Yyt.js +24 -0
- package/web/assets/edit-3HUAnaXW.js +1 -0
- package/web/assets/editor-BF5I0siU.js +1 -0
- package/web/assets/embed-CsNqeCd0.js +1 -0
- package/web/assets/filter-toolbar-BydfQ-79.js +56 -0
- package/web/assets/form-BGm5NPDn.js +1 -0
- package/web/assets/form-BXAuSawq.js +9 -0
- package/web/assets/form-CKfKLGXP.js +16 -0
- package/web/assets/form-DSzMo9UD.js +66 -0
- package/web/assets/form-P4luyUpY.js +9 -0
- package/web/assets/gas-Qf0SSUfS.js +1 -0
- package/web/assets/gemini-DffKpc81.png +0 -0
- package/web/assets/generateCategoricalChart-BaWwaXky.js +55 -0
- package/web/assets/google-DT1VSJ0m.png +0 -0
- package/web/assets/header-ivXuPt06.js +1 -0
- package/web/assets/home-HbrLyxJL.js +2 -0
- package/web/assets/html2canvas.esm-3ybT_T2r.js +5 -0
- package/web/assets/ideogram-REIjy0Er.png +0 -0
- package/web/assets/index-0HK7CYm4.js +1 -0
- package/web/assets/index-1y9kjPIr.js +1 -0
- package/web/assets/index-2l22EYw9.js +1 -0
- package/web/assets/index-9xBRL_33.js +1 -0
- package/web/assets/index-B1pTTyGZ.js +1 -0
- package/web/assets/index-BFML4-2u.js +170 -0
- package/web/assets/index-BIoSdRvX.js +12 -0
- package/web/assets/index-BJ_E6bEO.js +1 -0
- package/web/assets/index-BMKZToMM.js +28 -0
- package/web/assets/index-BP53rZV9.js +1 -0
- package/web/assets/index-Bnyh4rlV.js +1 -0
- package/web/assets/index-BoQ7wf3O.js +1 -0
- package/web/assets/index-Br7_mvEw.js +1 -0
- package/web/assets/index-C0JaS08f.js +38 -0
- package/web/assets/index-C68x-aau.js +1 -0
- package/web/assets/index-C8s2QKoe.js +1 -0
- package/web/assets/index-CI_EY4YS.js +1 -0
- package/web/assets/index-CdkYrABk.js +1 -0
- package/web/assets/index-Clbt8nRm.js +1 -0
- package/web/assets/index-Cn7O-OP7.js +49 -0
- package/web/assets/index-Cw0ugaQL.js +1 -0
- package/web/assets/index-DE2KzqXl.js +1 -0
- package/web/assets/index-DPodCQ9c.js +1 -0
- package/web/assets/index-DU39aG5u.js +1 -0
- package/web/assets/index-DZpJPE1Z.js +1 -0
- package/web/assets/index-Dc954mDP.js +1 -0
- package/web/assets/index-DgSc1Qy8.js +684 -0
- package/web/assets/index-Dr_MwbKt.js +38 -0
- package/web/assets/index-Drav4oDH.js +61 -0
- package/web/assets/index-DtbqgSK4.js +1 -0
- package/web/assets/index-DuRu9NWB.js +14 -0
- package/web/assets/index-SYTpMMMH.js +13 -0
- package/web/assets/index-WMKOiUez.js +1 -0
- package/web/assets/index-dmHgoplS.js +1 -0
- package/web/assets/index-fByZjxLy.js +1 -0
- package/web/assets/index-fswPX_qe.js +1 -0
- package/web/assets/index-txVTkoDD.js +1 -0
- package/web/assets/index.es-BWnfUzLb.js +5 -0
- package/web/assets/info-card-C1yxhxJG.js +1 -0
- package/web/assets/info-metric-CNse3r66.js +1 -0
- package/web/assets/info-row-DOK2whMn.js +1 -0
- package/web/assets/info-row-group-BeUhWnnY.js +1 -0
- package/web/assets/ios-CBDmY-ic.png +0 -0
- package/web/assets/lexend-latin-400-normal-CHypAkT3.woff +0 -0
- package/web/assets/lexend-latin-400-normal-CwRJVcUA.woff2 +0 -0
- package/web/assets/lexend-latin-600-normal-DSBzZxpA.woff +0 -0
- package/web/assets/lexend-latin-600-normal-DdvlkEkX.woff2 +0 -0
- package/web/assets/lexend-latin-ext-400-normal-D38JI5AK.woff2 +0 -0
- package/web/assets/lexend-latin-ext-400-normal-D9P7pMo-.woff +0 -0
- package/web/assets/lexend-latin-ext-600-normal-BXtyp5LP.woff +0 -0
- package/web/assets/lexend-latin-ext-600-normal-hDcqLAH9.woff2 +0 -0
- package/web/assets/lexend-vietnamese-400-normal-DoLa7jNB.woff2 +0 -0
- package/web/assets/lexend-vietnamese-400-normal-mPlHoWg5.woff +0 -0
- package/web/assets/lexend-vietnamese-600-normal-BxEVPgxw.woff +0 -0
- package/web/assets/lexend-vietnamese-600-normal-Cr1ePs6O.woff2 +0 -0
- package/web/assets/libphonenumber-CyphiuxQ.js +7 -0
- package/web/assets/link-3eeclTeS.js +1 -0
- package/web/assets/link-DMWJcQvZ.js +1 -0
- package/web/assets/list-1OG83xc4.js +1 -0
- package/web/assets/list-C521zE_7.js +1 -0
- package/web/assets/list-CNmzJKIQ.js +1 -0
- package/web/assets/list-CO0X4L3-.js +1 -0
- package/web/assets/list-D-I0msRW.js +35 -0
- package/web/assets/list-D1aevUOI.js +5 -0
- package/web/assets/list-DnePqZ2K.js +1 -0
- package/web/assets/list-jHj_5yy3.js +1 -0
- package/web/assets/lodash-B4Ozcv0x.js +20 -0
- package/web/assets/lottie-error-DeJ4jU66.js +1 -0
- package/web/assets/lottie-loading-Npqo86wA.js +1 -0
- package/web/assets/lottie-react.esm-BuFP9VDV.js +256 -0
- package/web/assets/lottie-welcome-oyMgXGo-.js +1 -0
- package/web/assets/metadata-CMSHcSXi.js +55 -0
- package/web/assets/meter-event-lmNMgmIu.js +1 -0
- package/web/assets/metrics-C7U41HWk.js +1 -0
- package/web/assets/ollama-C7MZn2d_.png +0 -0
- package/web/assets/openai-DlpqJdrb.png +0 -0
- package/web/assets/overview-CH1HnSP-.js +1 -0
- package/web/assets/overview-Cs3-8n4e.js +6 -0
- package/web/assets/past-due-CGGRZmXY.js +5 -0
- package/web/assets/pay-CSpHBUh_.js +4 -0
- package/web/assets/payment-kit-DYSjmihw.png +0 -0
- package/web/assets/payment-method-info-BsOBbA3m.js +16 -0
- package/web/assets/poe-B588TgZu.png +0 -0
- package/web/assets/preview-CjYh9dTg.js +1 -0
- package/web/assets/preview-DjYRpRA8.js +1 -0
- package/web/assets/pricing-table-C3Lkhq46.js +36 -0
- package/web/assets/pricing-table-edE6TJGX.js +1 -0
- package/web/assets/product-select-0ScZE2e8.js +1 -0
- package/web/assets/react-stripe.esm-BZIKAsrR.js +2 -0
- package/web/assets/recharge-DcPtT8vt.js +14 -0
- package/web/assets/related-credit-grants-BygNGPfb.js +124 -0
- package/web/assets/roboto-latin-400-normal-BVyCgWwA.woff +0 -0
- package/web/assets/roboto-latin-400-normal-DXyFPIdK.woff2 +0 -0
- package/web/assets/roboto-latin-500-normal-C6iW8rdg.woff2 +0 -0
- package/web/assets/roboto-latin-500-normal-rpP1_v3s.woff +0 -0
- package/web/assets/roboto-latin-700-normal-BWcFiwQV.woff +0 -0
- package/web/assets/roboto-latin-700-normal-CbYYDfWS.woff2 +0 -0
- package/web/assets/roboto-latin-ext-400-normal-BSFkPfbf.woff +0 -0
- package/web/assets/roboto-latin-ext-400-normal-DgXbz5gU.woff2 +0 -0
- package/web/assets/roboto-latin-ext-500-normal-DvHxAkTn.woff +0 -0
- package/web/assets/roboto-latin-ext-500-normal-OQJhyaXd.woff2 +0 -0
- package/web/assets/roboto-latin-ext-700-normal-Ba-CAIIA.woff +0 -0
- package/web/assets/roboto-latin-ext-700-normal-DchBbzVz.woff2 +0 -0
- package/web/assets/safe-did-address-B0fFbUph.js +1 -0
- package/web/assets/source-data-viewer-By_Utay-.js +1 -0
- package/web/assets/status-l6pD08fw.js +1 -0
- package/web/assets/stripe.esm-BCCu7gPj.js +1 -0
- package/web/assets/style-BWb904Pt.css +1 -0
- package/web/assets/subscription-DcwhSOpa.js +1 -0
- package/web/assets/subscription-Dq22e3D1.js +1 -0
- package/web/assets/table-BRU4Enia.js +1 -0
- package/web/assets/tax-code-select-CWhIIiXi.js +1 -0
- package/web/assets/tax-utils-DqNX34-r.js +1 -0
- package/web/assets/tokenList-9PBdKlKn.js +1 -0
- package/web/assets/ubuntu-mono-cyrillic-400-normal-Di_0TARV.woff +0 -0
- package/web/assets/ubuntu-mono-cyrillic-400-normal-OGyu3tt3.woff2 +0 -0
- package/web/assets/ubuntu-mono-cyrillic-ext-400-normal-C5u8faa9.woff2 +0 -0
- package/web/assets/ubuntu-mono-cyrillic-ext-400-normal-CL-A5l1V.woff +0 -0
- package/web/assets/ubuntu-mono-greek-400-normal-CCUzT4Jh.woff2 +0 -0
- package/web/assets/ubuntu-mono-greek-400-normal-DR50Gfyl.woff +0 -0
- package/web/assets/ubuntu-mono-greek-ext-400-normal-BNZd3ZNJ.woff +0 -0
- package/web/assets/ubuntu-mono-greek-ext-400-normal-CUE8Ia0W.woff2 +0 -0
- package/web/assets/ubuntu-mono-latin-400-normal-DpWeehTz.woff +0 -0
- package/web/assets/ubuntu-mono-latin-400-normal-l4cqI2xd.woff2 +0 -0
- package/web/assets/ubuntu-mono-latin-ext-400-normal-C-izf5FM.woff +0 -0
- package/web/assets/ubuntu-mono-latin-ext-400-normal-Cadvr_Yo.woff2 +0 -0
- package/web/assets/uploader-DRXDz_r0.js +9 -0
- package/web/assets/usage-records-jjJMZ6DI.js +1 -0
- package/web/assets/util-mDHAL0lx.js +1 -0
- package/web/assets/vendor-arcblock-ChFCRdyx.js +175 -0
- package/web/assets/vendor-blocklet-D_i_QeSo.js +2742 -0
- package/web/assets/vendor-mui-BXZut9Pz.js +225 -0
- package/web/assets/vendor-react-BPknnnEA.js +1 -0
- package/web/currencies/0xBTC.png +0 -0
- package/web/currencies/1INCH.svg +1 -0
- package/web/currencies/AAVE.svg +1 -0
- package/web/currencies/ABT.svg +16 -0
- package/web/currencies/ACX.png +0 -0
- package/web/currencies/ADX.svg +12 -0
- package/web/currencies/AIKEK.png +0 -0
- package/web/currencies/AJNA.svg +12 -0
- package/web/currencies/AKIRA.png +0 -0
- package/web/currencies/ALEX.png +0 -0
- package/web/currencies/ALI.png +0 -0
- package/web/currencies/ALT.svg +12 -0
- package/web/currencies/AMKT.svg +5 -0
- package/web/currencies/AMP.svg +7 -0
- package/web/currencies/APU.png +0 -0
- package/web/currencies/APW.svg +21 -0
- package/web/currencies/APX.png +0 -0
- package/web/currencies/ARC.png +0 -0
- package/web/currencies/ARIA20.svg +1 -0
- package/web/currencies/ARPA.svg +1 -0
- package/web/currencies/ATH.svg +1 -0
- package/web/currencies/AVC.png +0 -0
- package/web/currencies/AVRK.png +0 -0
- package/web/currencies/AXGT.svg +1 -0
- package/web/currencies/AZUR.svg +20 -0
- package/web/currencies/BAL.png +0 -0
- package/web/currencies/BANK.png +0 -0
- package/web/currencies/BAXA.svg +3 -0
- package/web/currencies/BCAT.png +0 -0
- package/web/currencies/BEPRO.svg +1 -0
- package/web/currencies/BERRY.svg +1 -0
- package/web/currencies/BICO.svg +11 -0
- package/web/currencies/BITBOT.jpg +0 -0
- package/web/currencies/BITCOIN.png +0 -0
- package/web/currencies/BKN.svg +1 -0
- package/web/currencies/BLUE.png +0 -0
- package/web/currencies/BNB.png +0 -0
- package/web/currencies/BOBA.svg +16 -0
- package/web/currencies/BOBO.png +0 -0
- package/web/currencies/BOND.svg +10 -0
- package/web/currencies/BOTTO.svg +4 -0
- package/web/currencies/BRIGHT.svg +83 -0
- package/web/currencies/BTRST.svg +1 -0
- package/web/currencies/BURN.png +0 -0
- package/web/currencies/BitANT.png +0 -0
- package/web/currencies/BitBTC.png +0 -0
- package/web/currencies/CARD.svg +1 -0
- package/web/currencies/CBX.svg +1 -0
- package/web/currencies/CHI.svg +1 -0
- package/web/currencies/CIG.svg +21 -0
- package/web/currencies/CNG.svg +9 -0
- package/web/currencies/COC.svg +8 -0
- package/web/currencies/COLLAB.svg +8 -0
- package/web/currencies/COMP.svg +1 -0
- package/web/currencies/COW.svg +1 -0
- package/web/currencies/CRV.png +0 -0
- package/web/currencies/CRYO.svg +1 -0
- package/web/currencies/CTRAVL.svg +1 -0
- package/web/currencies/CTSI.svg +1 -0
- package/web/currencies/CTX.svg +1 -0
- package/web/currencies/CUSD.png +0 -0
- package/web/currencies/CXT.svg +11 -0
- package/web/currencies/D2D.svg +6 -0
- package/web/currencies/DAI.svg +13 -0
- package/web/currencies/DCN.svg +47 -0
- package/web/currencies/DF.svg +15 -0
- package/web/currencies/DHT.svg +1 -0
- package/web/currencies/DIMO.svg +1 -0
- package/web/currencies/DMS.png +0 -0
- package/web/currencies/DODO.svg +6 -0
- package/web/currencies/DOGEGF.png +0 -0
- package/web/currencies/DOLA.svg +1 -0
- package/web/currencies/DOSE.svg +1 -0
- package/web/currencies/DUCK.png +0 -0
- package/web/currencies/DYP.png +0 -0
- package/web/currencies/EIGEN.svg +13 -0
- package/web/currencies/ENS.png +0 -0
- package/web/currencies/EPOCH.svg +1 -0
- package/web/currencies/EQB.svg +4 -0
- package/web/currencies/EQZ.png +0 -0
- package/web/currencies/ERN.png +0 -0
- package/web/currencies/ERNTST.png +0 -0
- package/web/currencies/EST.png +0 -0
- package/web/currencies/ETH.svg +13 -0
- package/web/currencies/ETHIX.svg +1 -0
- package/web/currencies/EVERY.svg +13 -0
- package/web/currencies/F.svg +1 -0
- package/web/currencies/FACTR.png +0 -0
- package/web/currencies/FANS.svg +11 -0
- package/web/currencies/FARM.png +0 -0
- package/web/currencies/FCR.png +0 -0
- package/web/currencies/FET.svg +21 -0
- package/web/currencies/FIS.svg +22 -0
- package/web/currencies/FLASH.svg +22 -0
- package/web/currencies/FLy.png +0 -0
- package/web/currencies/FOAM.svg +23 -0
- package/web/currencies/FORTH.svg +1 -0
- package/web/currencies/FOX.svg +8 -0
- package/web/currencies/FRAX.png +0 -0
- package/web/currencies/FU.svg +17 -0
- package/web/currencies/FVT.svg +1 -0
- package/web/currencies/FXN.svg +25 -0
- package/web/currencies/FXS.png +0 -0
- package/web/currencies/Froglic.png +0 -0
- package/web/currencies/GALAXIS.svg +1 -0
- package/web/currencies/GCH.png +0 -0
- package/web/currencies/GENOME.svg +23 -0
- package/web/currencies/GGTK.svg +1 -0
- package/web/currencies/GHST.svg +15 -0
- package/web/currencies/GIGACHAD.png +0 -0
- package/web/currencies/GIV.svg +6 -0
- package/web/currencies/GLS.svg +22 -0
- package/web/currencies/GOLD.png +0 -0
- package/web/currencies/GRG.png +0 -0
- package/web/currencies/GROW.svg +1 -0
- package/web/currencies/GRT.svg +11 -0
- package/web/currencies/GTC.svg +5 -0
- package/web/currencies/GURU.svg +1 -0
- package/web/currencies/GYEN.svg +1 -0
- package/web/currencies/GYSR.png +0 -0
- package/web/currencies/HAIR.svg +1 -0
- package/web/currencies/HAN.svg +25 -0
- package/web/currencies/HANeP.svg +1 -0
- package/web/currencies/HAUS.png +0 -0
- package/web/currencies/HEU.svg +5 -0
- package/web/currencies/HOBA.png +0 -0
- package/web/currencies/HUNT.svg +1 -0
- package/web/currencies/IBEX.png +0 -0
- package/web/currencies/IDRISS.svg +4 -0
- package/web/currencies/IOTX.png +0 -0
- package/web/currencies/IPOR.svg +1 -0
- package/web/currencies/IPT.svg +7 -0
- package/web/currencies/IRARA.svg +1 -0
- package/web/currencies/ISK.png +0 -0
- package/web/currencies/IYKYK.svg +14 -0
- package/web/currencies/JAM.svg +20 -0
- package/web/currencies/JRT.svg +8 -0
- package/web/currencies/KAGE.png +0 -0
- package/web/currencies/KAI.svg +23 -0
- package/web/currencies/KIBSHI.png +0 -0
- package/web/currencies/KNC.png +0 -0
- package/web/currencies/KOMPETE.png +0 -0
- package/web/currencies/KROM.png +0 -0
- package/web/currencies/LCX.svg +6 -0
- package/web/currencies/LDO.svg +5 -0
- package/web/currencies/LIF3.svg +27 -0
- package/web/currencies/LINK.png +0 -0
- package/web/currencies/LIZ.png +0 -0
- package/web/currencies/LMEOW.png +0 -0
- package/web/currencies/LOCG.png +0 -0
- package/web/currencies/LORDS.png +0 -0
- package/web/currencies/LPF.svg +18 -0
- package/web/currencies/LQTY.svg +1 -0
- package/web/currencies/LRC.png +0 -0
- package/web/currencies/LRDS.svg +44 -0
- package/web/currencies/LSK.png +0 -0
- package/web/currencies/LUSD.svg +1 -0
- package/web/currencies/LYRA.png +0 -0
- package/web/currencies/MASK.svg +4 -0
- package/web/currencies/MASQ.png +0 -0
- package/web/currencies/MBS.png +0 -0
- package/web/currencies/MCADE.svg +26 -0
- package/web/currencies/MET.svg +15 -0
- package/web/currencies/MINDS.svg +32 -0
- package/web/currencies/MKR.png +0 -0
- package/web/currencies/MLN.svg +1 -0
- package/web/currencies/MOCHI.svg +1 -0
- package/web/currencies/MOM.svg +5 -0
- package/web/currencies/MONKE.png +0 -0
- package/web/currencies/MOOV.svg +5 -0
- package/web/currencies/MORPHO.svg +14 -0
- package/web/currencies/MPWR.svg +5 -0
- package/web/currencies/MTA.svg +15 -0
- package/web/currencies/MTL.png +0 -0
- package/web/currencies/MUGLOO.png +0 -0
- package/web/currencies/Mog.png +0 -0
- package/web/currencies/NAVI.svg +1 -0
- package/web/currencies/NCT.svg +49 -0
- package/web/currencies/NET.svg +11 -0
- package/web/currencies/NEURON.svg +38 -0
- package/web/currencies/NFD.png +0 -0
- package/web/currencies/NOGS.png +0 -0
- package/web/currencies/NOUNS.png +0 -0
- package/web/currencies/NOVA.png +0 -0
- package/web/currencies/NSTR.svg +4 -0
- package/web/currencies/Neiro.png +0 -0
- package/web/currencies/OCEAN.png +0 -0
- package/web/currencies/OGN.svg +8 -0
- package/web/currencies/OL.svg +21 -0
- package/web/currencies/OLAS.svg +7 -0
- package/web/currencies/OM.png +0 -0
- package/web/currencies/OMETA.svg +7 -0
- package/web/currencies/OMI.svg +42 -0
- package/web/currencies/OPENLOOT.svg +21 -0
- package/web/currencies/OPN.svg +1 -0
- package/web/currencies/OS.svg +1 -0
- package/web/currencies/OUTb.svg +4 -0
- package/web/currencies/OVR.png +0 -0
- package/web/currencies/PAGE.svg +1 -0
- package/web/currencies/PAL.svg +1 -0
- package/web/currencies/PAPER.svg +4 -0
- package/web/currencies/PENDLE.png +0 -0
- package/web/currencies/PEPE.png +0 -0
- package/web/currencies/PERP.png +0 -0
- package/web/currencies/PHTK.svg +14 -0
- package/web/currencies/PIP.svg +11 -0
- package/web/currencies/POGS.png +0 -0
- package/web/currencies/POOL.svg +22 -0
- package/web/currencies/POP.svg +8 -0
- package/web/currencies/PORK.png +0 -0
- package/web/currencies/PRE.svg +66 -0
- package/web/currencies/PREMIA.svg +4 -0
- package/web/currencies/PRF.png +0 -0
- package/web/currencies/PRO.svg +1 -0
- package/web/currencies/PSP.svg +35 -0
- package/web/currencies/PSTAKE.png +0 -0
- package/web/currencies/PSY.svg +26 -0
- package/web/currencies/RAC.png +0 -0
- package/web/currencies/RAI.svg +1 -0
- package/web/currencies/RAZOR.svg +1 -0
- package/web/currencies/REKT.png +0 -0
- package/web/currencies/RFKJ.png +0 -0
- package/web/currencies/RFWSTETH.svg +36 -0
- package/web/currencies/RGT.png +0 -0
- package/web/currencies/RICE.svg +22 -0
- package/web/currencies/RIZE.svg +21 -0
- package/web/currencies/RPL.svg +1 -0
- package/web/currencies/RSC.svg +6 -0
- package/web/currencies/RSR.png +0 -0
- package/web/currencies/RSS3.png +0 -0
- package/web/currencies/Reach.svg +17 -0
- package/web/currencies/SAIL.png +0 -0
- package/web/currencies/SALD.png +0 -0
- package/web/currencies/SARCO.png +0 -0
- package/web/currencies/SCM.svg +1 -0
- package/web/currencies/SCRY.svg +13 -0
- package/web/currencies/SDL.svg +1 -0
- package/web/currencies/SEAM.svg +5 -0
- package/web/currencies/SEXY.svg +1 -0
- package/web/currencies/SHU.png +0 -0
- package/web/currencies/SIPHER.png +0 -0
- package/web/currencies/SKAI.svg +1 -0
- package/web/currencies/SLN.png +0 -0
- package/web/currencies/SMT.svg +1 -0
- package/web/currencies/SMURFCAT.png +0 -0
- package/web/currencies/SNT.svg +14 -0
- package/web/currencies/SNX.svg +20 -0
- package/web/currencies/SOFI.png +0 -0
- package/web/currencies/SOFT.svg +1 -0
- package/web/currencies/SOVRN.svg +13 -0
- package/web/currencies/SPANK.png +0 -0
- package/web/currencies/SPC.png +0 -0
- package/web/currencies/SPOT.svg +1 -0
- package/web/currencies/SQD.png +0 -0
- package/web/currencies/SQT.svg +14 -0
- package/web/currencies/STNT.svg +38 -0
- package/web/currencies/STPT.png +0 -0
- package/web/currencies/SUDO.svg +6 -0
- package/web/currencies/SUKU.png +0 -0
- package/web/currencies/SUPER.svg +6 -0
- package/web/currencies/SUSHI.svg +19 -0
- package/web/currencies/SYNTH.svg +1 -0
- package/web/currencies/ShibDoge.png +0 -0
- package/web/currencies/Silo.svg +4 -0
- package/web/currencies/StaFi.svg +65 -0
- package/web/currencies/T.svg +4 -0
- package/web/currencies/TEN.svg +1 -0
- package/web/currencies/TETU.svg +6 -0
- package/web/currencies/THALES.png +0 -0
- package/web/currencies/THING.png +0 -0
- package/web/currencies/THX.svg +22 -0
- package/web/currencies/TKAI.svg +1 -0
- package/web/currencies/TKN.png +0 -0
- package/web/currencies/TODL.png +0 -0
- package/web/currencies/TOWER.svg +1 -0
- package/web/currencies/TRAC.png +0 -0
- package/web/currencies/TRB.png +0 -0
- package/web/currencies/TRUE.svg +11 -0
- package/web/currencies/TRX.svg +4 -0
- package/web/currencies/TSC.png +0 -0
- package/web/currencies/TT.png +0 -0
- package/web/currencies/TUSD.png +0 -0
- package/web/currencies/TYBENG.png +0 -0
- package/web/currencies/TheDAO.svg +1 -0
- package/web/currencies/U.png +0 -0
- package/web/currencies/UBI.svg +5 -0
- package/web/currencies/UCASH.svg +1 -0
- package/web/currencies/UDT.svg +4 -0
- package/web/currencies/UMA.png +0 -0
- package/web/currencies/UNI.png +0 -0
- package/web/currencies/USA.png +0 -0
- package/web/currencies/USC.svg +23 -0
- package/web/currencies/USD3.svg +13 -0
- package/web/currencies/USDD.png +0 -0
- package/web/currencies/USDS.png +0 -0
- package/web/currencies/USDbC.png +0 -0
- package/web/currencies/UST.png +0 -0
- package/web/currencies/VALX.png +0 -0
- package/web/currencies/VIDYA.png +0 -0
- package/web/currencies/VITA.svg +10 -0
- package/web/currencies/VSP.svg +15 -0
- package/web/currencies/VUSD.svg +1 -0
- package/web/currencies/WAAC.png +0 -0
- package/web/currencies/WAD.png +0 -0
- package/web/currencies/WALLET.svg +1 -0
- package/web/currencies/WAMPL.svg +53 -0
- package/web/currencies/WBTC.png +0 -0
- package/web/currencies/WCT.svg +5 -0
- package/web/currencies/WEXO.png +0 -0
- package/web/currencies/WLD.jpeg +0 -0
- package/web/currencies/WMC.png +0 -0
- package/web/currencies/WOO.png +0 -0
- package/web/currencies/Wildfire.svg +1 -0
- package/web/currencies/XCHF.png +0 -0
- package/web/currencies/XCN.svg +1 -0
- package/web/currencies/XMT.svg +1 -0
- package/web/currencies/XYO.svg +1 -0
- package/web/currencies/YFI.svg +4 -0
- package/web/currencies/YFX.svg +11 -0
- package/web/currencies/YGG.svg +11 -0
- package/web/currencies/YOKAI.png +0 -0
- package/web/currencies/YYY.svg +1 -0
- package/web/currencies/ZENT.svg +12 -0
- package/web/currencies/ZRX.png +0 -0
- package/web/currencies/ZUN.svg +24 -0
- package/web/currencies/ZUSD.svg +1 -0
- package/web/currencies/ZYN.png +0 -0
- package/web/currencies/aCRV.png +0 -0
- package/web/currencies/btc.png +0 -0
- package/web/currencies/bwAJNA.svg +1 -0
- package/web/currencies/cSTONE.svg +23 -0
- package/web/currencies/cbETH.svg +9 -0
- package/web/currencies/crvUSD.png +0 -0
- package/web/currencies/cvxFXS.png +0 -0
- package/web/currencies/dai.png +0 -0
- package/web/currencies/dollar.png +0 -0
- package/web/currencies/ePendle.png +0 -0
- package/web/currencies/frxETH.png +0 -0
- package/web/currencies/fxUSD.svg +5 -0
- package/web/currencies/iFARM.png +0 -0
- package/web/currencies/iZi.png +0 -0
- package/web/currencies/imgnAI.svg +1 -0
- package/web/currencies/mpETH.svg +4 -0
- package/web/currencies/nETH.svg +11 -0
- package/web/currencies/rETH.svg +1 -0
- package/web/currencies/rgUSD.svg +5 -0
- package/web/currencies/rnETH.svg +11 -0
- package/web/currencies/sDAI.svg +13 -0
- package/web/currencies/sFRAX.png +0 -0
- package/web/currencies/sUSDS.png +0 -0
- package/web/currencies/scWETHv2.svg +1 -0
- package/web/currencies/send.svg +12 -0
- package/web/currencies/stETH.png +1 -0
- package/web/currencies/stZENT.svg +12 -0
- package/web/currencies/stkLYRA.svg +26 -0
- package/web/currencies/tGS.png +0 -0
- package/web/currencies/tSTAR.png +0 -0
- package/web/currencies/usdc.png +0 -0
- package/web/currencies/usdt.png +0 -0
- package/web/currencies/veKWENTA.svg +24 -0
- package/web/currencies/wHOGE.svg +14 -0
- package/web/currencies/wOpenX.svg +140 -0
- package/web/currencies/wPOKT.svg +17 -0
- package/web/currencies/wTBT.svg +1 -0
- package/web/currencies/weETH.svg +23 -0
- package/web/currencies/wstETH.svg +11 -0
- package/web/currencies/yETH.svg +8 -0
- package/web/currencies/zunETH.svg +46 -0
- package/web/currencies/zunUSD.svg +33 -0
- package/web/fonts/noto-sans-sc-chinese-simplified-500-normal.ttf +0 -0
- package/web/index.html +72 -0
- package/web/methods/arcblock.png +0 -0
- package/web/methods/base.png +0 -0
- package/web/methods/binance.png +0 -0
- package/web/methods/coinbase.png +0 -0
- package/web/methods/default.png +0 -0
- package/web/methods/ethereum.jpg +0 -0
- package/web/methods/ethereum.png +0 -0
- package/web/methods/stripe.png +0 -0
package/dist/index.js
CHANGED
|
@@ -441,9 +441,9 @@ var init_env = __esm({
|
|
|
441
441
|
"../../blocklets/core/api/src/libs/env.ts"() {
|
|
442
442
|
"use strict";
|
|
443
443
|
import_env = require("@blocklet/sdk/lib/env");
|
|
444
|
-
numConfig = (key,
|
|
444
|
+
numConfig = (key, fallback) => {
|
|
445
445
|
const v = readConfig(key);
|
|
446
|
-
return v ? +v :
|
|
446
|
+
return v ? +v : fallback;
|
|
447
447
|
};
|
|
448
448
|
paymentStatCronTime = () => "0 1 0 * * *";
|
|
449
449
|
subscriptionCronTime = () => readConfig("SUBSCRIPTION_CRON_TIME") || "0 */30 * * * *";
|
|
@@ -787,6 +787,13 @@ var init_sql_migrations = __esm({
|
|
|
787
787
|
});
|
|
788
788
|
|
|
789
789
|
// ../../blocklets/core/api/src/libs/drivers/identity.ts
|
|
790
|
+
var identity_exports = {};
|
|
791
|
+
__export(identity_exports, {
|
|
792
|
+
createDefaultIdentityDriver: () => createDefaultIdentityDriver,
|
|
793
|
+
getIdentityDriver: () => getIdentityDriver,
|
|
794
|
+
resolveTenantForHost: () => resolveTenantForHost,
|
|
795
|
+
setIdentityDriver: () => setIdentityDriver
|
|
796
|
+
});
|
|
790
797
|
function createDefaultIdentityDriver() {
|
|
791
798
|
return {
|
|
792
799
|
resolveInstanceDidForHost() {
|
|
@@ -979,6 +986,46 @@ var init_drivers = __esm({
|
|
|
979
986
|
}
|
|
980
987
|
});
|
|
981
988
|
|
|
989
|
+
// ../../blocklets/core/api/src/host-node/serve-static-arc.ts
|
|
990
|
+
var serve_static_arc_exports = {};
|
|
991
|
+
__export(serve_static_arc_exports, {
|
|
992
|
+
createNodeStaticHandler: () => createNodeStaticHandler,
|
|
993
|
+
default: () => serve_static_arc_default
|
|
994
|
+
});
|
|
995
|
+
function acceptsHtml(accept) {
|
|
996
|
+
if (!accept) return true;
|
|
997
|
+
return accept.includes("text/html") || accept.includes("application/xhtml+xml") || accept.includes("*/*");
|
|
998
|
+
}
|
|
999
|
+
function createNodeStaticHandler(webRoot) {
|
|
1000
|
+
const indexPath = import_path.default.join(webRoot, "index.html");
|
|
1001
|
+
if (!import_fs.default.existsSync(indexPath)) {
|
|
1002
|
+
throw new Error(`createNodeStaticHandler: webRoot has no index.html: ${indexPath}`);
|
|
1003
|
+
}
|
|
1004
|
+
let cachedIndex = null;
|
|
1005
|
+
return (app42) => {
|
|
1006
|
+
const { serveStatic } = require("@hono/node-server/serve-static");
|
|
1007
|
+
app42.use("*", async (c, next) => {
|
|
1008
|
+
const method = c.req.method.toUpperCase();
|
|
1009
|
+
if (method !== "GET" && method !== "HEAD" || !acceptsHtml(c.req.header("accept") || "") || import_constant.RESOURCE_PATTERN.test(c.req.path)) {
|
|
1010
|
+
return next();
|
|
1011
|
+
}
|
|
1012
|
+
if (cachedIndex == null) cachedIndex = import_fs.default.readFileSync(indexPath, "utf8");
|
|
1013
|
+
return c.html(cachedIndex);
|
|
1014
|
+
});
|
|
1015
|
+
app42.use("*", serveStatic({ root: webRoot }));
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
var import_fs, import_path, import_constant, serve_static_arc_default;
|
|
1019
|
+
var init_serve_static_arc = __esm({
|
|
1020
|
+
"../../blocklets/core/api/src/host-node/serve-static-arc.ts"() {
|
|
1021
|
+
"use strict";
|
|
1022
|
+
import_fs = __toESM(require("fs"));
|
|
1023
|
+
import_path = __toESM(require("path"));
|
|
1024
|
+
import_constant = require("@blocklet/constant");
|
|
1025
|
+
serve_static_arc_default = createNodeStaticHandler;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
|
|
982
1029
|
// ../../blocklets/core/api/src/libs/logger.ts
|
|
983
1030
|
function resolveLogger() {
|
|
984
1031
|
if (resolved) return resolved;
|
|
@@ -1010,6 +1057,23 @@ var init_logger = __esm({
|
|
|
1010
1057
|
});
|
|
1011
1058
|
|
|
1012
1059
|
// ../../blocklets/core/api/src/libs/context.ts
|
|
1060
|
+
var context_exports = {};
|
|
1061
|
+
__export(context_exports, {
|
|
1062
|
+
INVALID_TENANT_TABLE: () => INVALID_TENANT_TABLE,
|
|
1063
|
+
TENANT_CONTEXT_MISSING: () => TENANT_CONTEXT_MISSING,
|
|
1064
|
+
TENANT_HOST_UNRESOLVED: () => TENANT_HOST_UNRESOLVED,
|
|
1065
|
+
TENANT_MISMATCH: () => TENANT_MISMATCH,
|
|
1066
|
+
TenantError: () => TenantError,
|
|
1067
|
+
assertValidInstanceDid: () => assertValidInstanceDid,
|
|
1068
|
+
context: () => context,
|
|
1069
|
+
getDefaultInstanceDid: () => getDefaultInstanceDid,
|
|
1070
|
+
getInstanceDid: () => getInstanceDid,
|
|
1071
|
+
getTenantMode: () => getTenantMode,
|
|
1072
|
+
isSystemContext: () => isSystemContext,
|
|
1073
|
+
resolveRowTenant: () => resolveRowTenant,
|
|
1074
|
+
setDefaultInstanceDid: () => setDefaultInstanceDid,
|
|
1075
|
+
withTenant: () => withTenant
|
|
1076
|
+
});
|
|
1013
1077
|
function withTenant(instanceDid, fn3) {
|
|
1014
1078
|
return context.withTenant(instanceDid, fn3);
|
|
1015
1079
|
}
|
|
@@ -1069,6 +1133,16 @@ var init_context = __esm({
|
|
|
1069
1133
|
if (getTenantMode() === "single") return getDefaultInstanceDid();
|
|
1070
1134
|
throw new TenantError(TENANT_CONTEXT_MISSING, "tenant context is missing in multi-tenant mode");
|
|
1071
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Non-throwing peek at the established tenant context — returns the stored
|
|
1138
|
+
* instanceDid or undefined when no context is set (regardless of tenant mode).
|
|
1139
|
+
* Used by the DID-Connect tenant-context middleware to decide whether the
|
|
1140
|
+
* request is already scoped (e.g. the CF worker wrapped /api/* in withTenant) or
|
|
1141
|
+
* needs its own Host→tenant resolution.
|
|
1142
|
+
*/
|
|
1143
|
+
peekInstanceDid() {
|
|
1144
|
+
return this.storage.getStore()?.instanceDid;
|
|
1145
|
+
}
|
|
1072
1146
|
/**
|
|
1073
1147
|
* Run fn as a system operation: TenantModel scoping is bypassed for the span
|
|
1074
1148
|
* of fn so legitimate cross-tenant reads can load rows regardless of tenant.
|
|
@@ -1324,14 +1398,100 @@ var init_dayjs = __esm({
|
|
|
1324
1398
|
}
|
|
1325
1399
|
});
|
|
1326
1400
|
|
|
1401
|
+
// ../../blocklets/core/api/src/libs/did-connect/tenant-identity.ts
|
|
1402
|
+
var tenant_identity_exports = {};
|
|
1403
|
+
__export(tenant_identity_exports, {
|
|
1404
|
+
clearTenantIdentityCache: () => clearTenantIdentityCache,
|
|
1405
|
+
getCachedTenantIdentity: () => getCachedTenantIdentity,
|
|
1406
|
+
hasDynamicIdentity: () => hasDynamicIdentity,
|
|
1407
|
+
resolveTenantIdentity: () => resolveTenantIdentity,
|
|
1408
|
+
warmTenantIdentity: () => warmTenantIdentity
|
|
1409
|
+
});
|
|
1410
|
+
function clearTenantIdentityCache(instanceDid) {
|
|
1411
|
+
if (instanceDid) identityCache.delete(instanceDid);
|
|
1412
|
+
else identityCache.clear();
|
|
1413
|
+
}
|
|
1414
|
+
function hasDynamicIdentity() {
|
|
1415
|
+
return typeof getIdentityDriver().getInstanceAppIdentity === "function";
|
|
1416
|
+
}
|
|
1417
|
+
async function resolveTenantIdentity(instanceDidArg) {
|
|
1418
|
+
const instanceDid = instanceDidArg ?? getInstanceDid();
|
|
1419
|
+
const cached = identityCache.get(instanceDid);
|
|
1420
|
+
if (cached && cached.expiry > Date.now()) return cached.value;
|
|
1421
|
+
const driver = getIdentityDriver();
|
|
1422
|
+
if (typeof driver.getInstanceAppIdentity !== "function") {
|
|
1423
|
+
throw new Error(
|
|
1424
|
+
"resolveTenantIdentity: the active IdentityDriver does not implement getInstanceAppIdentity \u2014 a non-blocklet-server DID-Connect runtime requires an AUTH_SERVICE-backed identity driver"
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
const identity = await driver.getInstanceAppIdentity(instanceDid);
|
|
1428
|
+
if (!identity || !identity.appSk) {
|
|
1429
|
+
throw new Error(`resolveTenantIdentity: no app signing key for instance "${instanceDid}" (fail-closed)`);
|
|
1430
|
+
}
|
|
1431
|
+
const wallet3 = (0, import_wallet.fromSecretKey)(identity.appSk, walletType);
|
|
1432
|
+
const ethWallet2 = (0, import_wallet.fromSecretKey)(identity.appSk.slice(0, 66), ethWalletType);
|
|
1433
|
+
const permanentWallet = identity.appPsk ? (0, import_wallet.fromSecretKey)(identity.appPsk, walletType) : wallet3;
|
|
1434
|
+
const value = {
|
|
1435
|
+
instanceDid,
|
|
1436
|
+
wallet: wallet3,
|
|
1437
|
+
ethWallet: ethWallet2,
|
|
1438
|
+
permanentWallet,
|
|
1439
|
+
appInfo: identity.appInfo ?? {}
|
|
1440
|
+
};
|
|
1441
|
+
identityCache.set(instanceDid, { value, expiry: Date.now() + IDENTITY_TTL_MS });
|
|
1442
|
+
return value;
|
|
1443
|
+
}
|
|
1444
|
+
function getCachedTenantIdentity(instanceDidArg) {
|
|
1445
|
+
const instanceDid = instanceDidArg ?? getInstanceDid();
|
|
1446
|
+
const cached = identityCache.get(instanceDid);
|
|
1447
|
+
if (!cached || cached.expiry <= Date.now()) {
|
|
1448
|
+
throw new Error(
|
|
1449
|
+
`tenant identity for "${instanceDid}" is not resolved (fail-closed) \u2014 warmTenantIdentity must run in the request/job scope before any wallet access`
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
return cached.value;
|
|
1453
|
+
}
|
|
1454
|
+
async function warmTenantIdentity(instanceDidArg) {
|
|
1455
|
+
if (!hasDynamicIdentity()) return;
|
|
1456
|
+
try {
|
|
1457
|
+
await resolveTenantIdentity(instanceDidArg);
|
|
1458
|
+
} catch (err) {
|
|
1459
|
+
logger_default.warn("[tenant-identity] warm failed \u2014 wallet access will fail-closed", {
|
|
1460
|
+
error: err?.message || String(err)
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
var Mcrypto, import_wallet, walletType, ethWalletType, IDENTITY_TTL_MS, identityCache;
|
|
1465
|
+
var init_tenant_identity = __esm({
|
|
1466
|
+
"../../blocklets/core/api/src/libs/did-connect/tenant-identity.ts"() {
|
|
1467
|
+
"use strict";
|
|
1468
|
+
Mcrypto = __toESM(require("@ocap/mcrypto"));
|
|
1469
|
+
import_wallet = require("@ocap/wallet");
|
|
1470
|
+
init_context();
|
|
1471
|
+
init_drivers();
|
|
1472
|
+
init_logger();
|
|
1473
|
+
walletType = {
|
|
1474
|
+
role: Mcrypto.types.RoleType.ROLE_APPLICATION,
|
|
1475
|
+
pk: Mcrypto.types.KeyType.ED25519,
|
|
1476
|
+
hash: Mcrypto.types.HashType.SHA3
|
|
1477
|
+
};
|
|
1478
|
+
ethWalletType = (0, import_wallet.WalletType)("ethereum");
|
|
1479
|
+
IDENTITY_TTL_MS = 5 * 60 * 1e3;
|
|
1480
|
+
identityCache = /* @__PURE__ */ new Map();
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1327
1484
|
// ../../blocklets/core/api/src/libs/auth.ts
|
|
1328
1485
|
var auth_exports = {};
|
|
1329
1486
|
__export(auth_exports, {
|
|
1330
1487
|
authenticator: () => authenticator,
|
|
1331
1488
|
blocklet: () => blocklet,
|
|
1489
|
+
createBlockletServerDidConnectRuntime: () => createBlockletServerDidConnectRuntime,
|
|
1332
1490
|
ethWallet: () => ethWallet,
|
|
1333
1491
|
getVaultAddress: () => getVaultAddress,
|
|
1334
1492
|
handlers: () => handlers,
|
|
1493
|
+
setDidConnectRuntime: () => setDidConnectRuntime,
|
|
1494
|
+
setDidConnectTokenStorage: () => setDidConnectTokenStorage,
|
|
1335
1495
|
wallet: () => wallet
|
|
1336
1496
|
});
|
|
1337
1497
|
function lazyProxy(factory) {
|
|
@@ -1360,18 +1520,82 @@ function lazyProxy(factory) {
|
|
|
1360
1520
|
function ensureNotificationPatch() {
|
|
1361
1521
|
if (notificationPatched) return;
|
|
1362
1522
|
notificationPatched = true;
|
|
1363
|
-
const { getWallet
|
|
1523
|
+
const { getWallet, getAccessWallet } = require("@blocklet/sdk/lib/wallet");
|
|
1364
1524
|
const notificationExports = require("@blocklet/sdk/service/notification");
|
|
1365
1525
|
notificationExports.getSender = () => ({
|
|
1366
|
-
appDid: blockletAppId() ||
|
|
1526
|
+
appDid: blockletAppId() || getWallet(void 0, "", "sk").address,
|
|
1367
1527
|
wallet: getAccessWallet()
|
|
1368
1528
|
});
|
|
1369
1529
|
logger_default.info("[sdk-patch] notification.getSender overridden", { expectedAppId: blockletAppId() });
|
|
1370
1530
|
}
|
|
1371
1531
|
function makeWallet(...args) {
|
|
1372
1532
|
ensureNotificationPatch();
|
|
1373
|
-
const { getWallet
|
|
1374
|
-
return
|
|
1533
|
+
const { getWallet } = require("@blocklet/sdk/lib/wallet");
|
|
1534
|
+
return getWallet(...args);
|
|
1535
|
+
}
|
|
1536
|
+
function activeBusinessWallet(chain) {
|
|
1537
|
+
const { hasDynamicIdentity: hasDynamicIdentity2, getCachedTenantIdentity: getCachedTenantIdentity2 } = (init_tenant_identity(), __toCommonJS(tenant_identity_exports));
|
|
1538
|
+
if (hasDynamicIdentity2()) {
|
|
1539
|
+
const identity = getCachedTenantIdentity2();
|
|
1540
|
+
return chain === "ethereum" ? identity.ethWallet : identity.wallet;
|
|
1541
|
+
}
|
|
1542
|
+
return chain === "ethereum" ? envEthWallet : envWallet;
|
|
1543
|
+
}
|
|
1544
|
+
function businessWalletProxy(chain) {
|
|
1545
|
+
return new Proxy({}, {
|
|
1546
|
+
get(_t, prop) {
|
|
1547
|
+
const w = activeBusinessWallet(chain);
|
|
1548
|
+
const value = w[prop];
|
|
1549
|
+
if (typeof value !== "function") return value;
|
|
1550
|
+
if (value._isMockFunction) return value;
|
|
1551
|
+
return value.bind(w);
|
|
1552
|
+
},
|
|
1553
|
+
set(_t, prop, value) {
|
|
1554
|
+
activeBusinessWallet(chain)[prop] = value;
|
|
1555
|
+
return true;
|
|
1556
|
+
},
|
|
1557
|
+
has(_t, prop) {
|
|
1558
|
+
return prop in activeBusinessWallet(chain);
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
function setDidConnectRuntime(runtime) {
|
|
1563
|
+
injectedRuntime = runtime;
|
|
1564
|
+
}
|
|
1565
|
+
function setDidConnectTokenStorage(storage) {
|
|
1566
|
+
injectedTokenStorage = storage;
|
|
1567
|
+
}
|
|
1568
|
+
function createBlockletServerDidConnectRuntime() {
|
|
1569
|
+
return {
|
|
1570
|
+
createAuthenticator() {
|
|
1571
|
+
const { WalletAuthenticator } = require("@blocklet/sdk/lib/wallet-authenticator");
|
|
1572
|
+
const { createTxEncoder } = require("@ocap/client/encode");
|
|
1573
|
+
return new WalletAuthenticator({ wallet: makeWallet(void 0, "", "sk"), txEncoder: createTxEncoder() });
|
|
1574
|
+
},
|
|
1575
|
+
createHandlers({ authenticator: auth28, tokenStorage }) {
|
|
1576
|
+
const { WalletHandlers } = require("@blocklet/sdk/lib/wallet-handler");
|
|
1577
|
+
return new WalletHandlers({ authenticator: auth28, tokenStorage });
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
function activeRuntime() {
|
|
1582
|
+
return injectedRuntime ?? createBlockletServerDidConnectRuntime();
|
|
1583
|
+
}
|
|
1584
|
+
function buildTokenStorage() {
|
|
1585
|
+
if (injectedRuntime?.tokenStorage) return injectedRuntime.tokenStorage;
|
|
1586
|
+
if (injectedTokenStorage) return injectedTokenStorage;
|
|
1587
|
+
const AuthStorage = require("@arcblock/did-connect-storage-nedb");
|
|
1588
|
+
return new AuthStorage({
|
|
1589
|
+
// `env.dataDir` (the blocklet runtime data dir) is undefined in a bare
|
|
1590
|
+
// embedded host like arc — `store/sequelize.ts` already guards its own
|
|
1591
|
+
// use, but this DID-Connect token store was the one unguarded path and
|
|
1592
|
+
// crashed `buildConnectRoutesHono` with `path.join(undefined, …)`. Fall
|
|
1593
|
+
// back to the OS temp dir (DID-Connect session tokens are ephemeral; the
|
|
1594
|
+
// blocklet server still gets its real dataDir natively).
|
|
1595
|
+
dbPath: import_path2.default.join(env_default.dataDir || import_os.default.tmpdir(), "auth.db"),
|
|
1596
|
+
// @ts-ignore
|
|
1597
|
+
onload: console.warn
|
|
1598
|
+
});
|
|
1375
1599
|
}
|
|
1376
1600
|
async function getVaultAddress() {
|
|
1377
1601
|
try {
|
|
@@ -1385,31 +1609,25 @@ async function getVaultAddress() {
|
|
|
1385
1609
|
return null;
|
|
1386
1610
|
}
|
|
1387
1611
|
}
|
|
1388
|
-
var
|
|
1612
|
+
var import_os, import_path2, notificationPatched, envWallet, envEthWallet, wallet, ethWallet, injectedRuntime, injectedTokenStorage, authenticator, handlers, blocklet;
|
|
1389
1613
|
var init_auth = __esm({
|
|
1390
1614
|
"../../blocklets/core/api/src/libs/auth.ts"() {
|
|
1391
1615
|
"use strict";
|
|
1392
|
-
|
|
1616
|
+
import_os = __toESM(require("os"));
|
|
1617
|
+
import_path2 = __toESM(require("path"));
|
|
1393
1618
|
init_env();
|
|
1394
1619
|
init_logger();
|
|
1395
1620
|
notificationPatched = false;
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1621
|
+
envWallet = lazyProxy(() => makeWallet());
|
|
1622
|
+
envEthWallet = lazyProxy(() => makeWallet("ethereum"));
|
|
1623
|
+
wallet = businessWalletProxy("arcblock");
|
|
1624
|
+
ethWallet = businessWalletProxy("ethereum");
|
|
1625
|
+
injectedRuntime = null;
|
|
1626
|
+
injectedTokenStorage = null;
|
|
1627
|
+
authenticator = lazyProxy(() => activeRuntime().createAuthenticator());
|
|
1402
1628
|
handlers = lazyProxy(() => {
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
return new WalletHandlers({
|
|
1406
|
-
authenticator,
|
|
1407
|
-
tokenStorage: new AuthStorage({
|
|
1408
|
-
dbPath: import_path.default.join(env_default.dataDir, "auth.db"),
|
|
1409
|
-
// @ts-ignore
|
|
1410
|
-
onload: console.warn
|
|
1411
|
-
})
|
|
1412
|
-
});
|
|
1629
|
+
const tokenStorage = buildTokenStorage();
|
|
1630
|
+
return activeRuntime().createHandlers({ authenticator, tokenStorage });
|
|
1413
1631
|
});
|
|
1414
1632
|
blocklet = lazyProxy(() => {
|
|
1415
1633
|
ensureNotificationPatch();
|
|
@@ -6377,19 +6595,16 @@ function authenticate({
|
|
|
6377
6595
|
return c.json({ error: "Not authorized to perform this action" }, 403);
|
|
6378
6596
|
};
|
|
6379
6597
|
}
|
|
6380
|
-
var import_verify_sign, import_verify_session,
|
|
6598
|
+
var import_verify_sign, import_verify_session, wallet2;
|
|
6381
6599
|
var init_security = __esm({
|
|
6382
6600
|
"../../blocklets/core/api/src/middlewares/hono/security.ts"() {
|
|
6383
6601
|
"use strict";
|
|
6384
6602
|
import_verify_sign = require("@blocklet/sdk/lib/util/verify-sign");
|
|
6385
6603
|
import_verify_session = require("@blocklet/sdk/lib/util/verify-session");
|
|
6386
|
-
import_wallet = require("@blocklet/sdk/lib/wallet");
|
|
6387
6604
|
init_env();
|
|
6605
|
+
init_auth();
|
|
6388
6606
|
init_customer();
|
|
6389
|
-
wallet2 = () =>
|
|
6390
|
-
cachedWallet ??= (0, import_wallet.getWallet)();
|
|
6391
|
-
return cachedWallet;
|
|
6392
|
-
};
|
|
6607
|
+
wallet2 = () => wallet;
|
|
6393
6608
|
}
|
|
6394
6609
|
});
|
|
6395
6610
|
|
|
@@ -8814,8 +9029,8 @@ async function getVerifier(bundleId, environment) {
|
|
|
8814
9029
|
const cached = verifierCache.get(key);
|
|
8815
9030
|
if (cached) return cached;
|
|
8816
9031
|
const mod = await import("@apple/app-store-server-library");
|
|
8817
|
-
const
|
|
8818
|
-
const verifier = new mod.SignedDataVerifier(APPLE_ROOT_CERTS, false,
|
|
9032
|
+
const env12 = environment === "production" ? mod.Environment.PRODUCTION : mod.Environment.SANDBOX;
|
|
9033
|
+
const verifier = new mod.SignedDataVerifier(APPLE_ROOT_CERTS, false, env12, bundleId);
|
|
8819
9034
|
verifierCache.set(key, verifier);
|
|
8820
9035
|
return verifier;
|
|
8821
9036
|
}
|
|
@@ -8861,8 +9076,8 @@ async function getApiClient(creds) {
|
|
|
8861
9076
|
const cached = apiClientCache.get(key);
|
|
8862
9077
|
if (cached) return cached;
|
|
8863
9078
|
const mod = await import("@apple/app-store-server-library");
|
|
8864
|
-
const
|
|
8865
|
-
const client = new mod.AppStoreServerAPIClient(creds.privateKeyPem, creds.keyId, creds.issuerId, creds.bundleId,
|
|
9079
|
+
const env12 = creds.environment === "production" ? mod.Environment.PRODUCTION : mod.Environment.SANDBOX;
|
|
9080
|
+
const client = new mod.AppStoreServerAPIClient(creds.privateKeyPem, creds.keyId, creds.issuerId, creds.bundleId, env12);
|
|
8866
9081
|
apiClientCache.set(key, client);
|
|
8867
9082
|
return client;
|
|
8868
9083
|
}
|
|
@@ -9289,12 +9504,17 @@ var init_client2 = __esm({
|
|
|
9289
9504
|
});
|
|
9290
9505
|
|
|
9291
9506
|
// ../../blocklets/core/api/src/store/sequelize.ts
|
|
9507
|
+
var sequelize_exports = {};
|
|
9508
|
+
__export(sequelize_exports, {
|
|
9509
|
+
sequelize: () => sequelize,
|
|
9510
|
+
setDefaultSequelize: () => setDefaultSequelize
|
|
9511
|
+
});
|
|
9292
9512
|
function buildSequelize() {
|
|
9293
9513
|
const seq = new import_sequelize16.Sequelize({
|
|
9294
9514
|
dialect: "sqlite",
|
|
9295
9515
|
logging: sqlLog(),
|
|
9296
9516
|
benchmark: sqlLog() && sqlBenchmark(),
|
|
9297
|
-
storage: (0,
|
|
9517
|
+
storage: (0, import_path3.join)(env_default.dataDir, "payment-kit.db"),
|
|
9298
9518
|
pool: {
|
|
9299
9519
|
min: sequelizeOptionsPoolMin(),
|
|
9300
9520
|
max: sequelizeOptionsPoolMax(),
|
|
@@ -9310,12 +9530,15 @@ function buildSequelize() {
|
|
|
9310
9530
|
pragma("PRAGMA cache_size = -16000");
|
|
9311
9531
|
return seq;
|
|
9312
9532
|
}
|
|
9313
|
-
|
|
9533
|
+
function setDefaultSequelize(seq) {
|
|
9534
|
+
instance = seq;
|
|
9535
|
+
}
|
|
9536
|
+
var import_sqlite3, import_path3, import_cls_hooked, import_sequelize16, namespace, instance, getSequelize, sequelize;
|
|
9314
9537
|
var init_sequelize = __esm({
|
|
9315
9538
|
"../../blocklets/core/api/src/store/sequelize.ts"() {
|
|
9316
9539
|
"use strict";
|
|
9317
9540
|
import_sqlite3 = require("sqlite3");
|
|
9318
|
-
|
|
9541
|
+
import_path3 = require("path");
|
|
9319
9542
|
import_cls_hooked = __toESM(require("cls-hooked"));
|
|
9320
9543
|
import_sequelize16 = require("sequelize");
|
|
9321
9544
|
init_env();
|
|
@@ -14888,8 +15111,8 @@ var init_remote_signer = __esm({
|
|
|
14888
15111
|
* Signs typed data (EIP-712)
|
|
14889
15112
|
* Optional but useful for signing structured data
|
|
14890
15113
|
*/
|
|
14891
|
-
async signTypedData(domain,
|
|
14892
|
-
const hash = import_ethers.ethers.TypedDataEncoder.hash(domain,
|
|
15114
|
+
async signTypedData(domain, types3, value) {
|
|
15115
|
+
const hash = import_ethers.ethers.TypedDataEncoder.hash(domain, types3, value);
|
|
14893
15116
|
const signature = await this.wallet.signETH(hash, false);
|
|
14894
15117
|
return import_ethers.ethers.hexlify(signature);
|
|
14895
15118
|
}
|
|
@@ -19013,10 +19236,10 @@ var init_discount2 = __esm({
|
|
|
19013
19236
|
});
|
|
19014
19237
|
|
|
19015
19238
|
// ../../blocklets/core/api/src/libs/slippage.ts
|
|
19016
|
-
function normalizeSlippagePercent3(value,
|
|
19239
|
+
function normalizeSlippagePercent3(value, fallback = DEFAULT_SLIPPAGE_PERCENT3) {
|
|
19017
19240
|
const normalized = typeof value === "string" ? Number(value) : Number(value);
|
|
19018
19241
|
if (!Number.isFinite(normalized) || normalized < 0) {
|
|
19019
|
-
return
|
|
19242
|
+
return fallback;
|
|
19020
19243
|
}
|
|
19021
19244
|
return normalized;
|
|
19022
19245
|
}
|
|
@@ -29022,13 +29245,18 @@ function injectJobTenant(job) {
|
|
|
29022
29245
|
}
|
|
29023
29246
|
return { ...job, instance_did: context.getInstanceDid() };
|
|
29024
29247
|
}
|
|
29248
|
+
async function warmThenRun(onJob, job) {
|
|
29249
|
+
const { warmTenantIdentity: warmTenantIdentity2 } = (init_tenant_identity(), __toCommonJS(tenant_identity_exports));
|
|
29250
|
+
await warmTenantIdentity2();
|
|
29251
|
+
return onJob(job);
|
|
29252
|
+
}
|
|
29025
29253
|
function runJobWithTenant(job, onJob) {
|
|
29026
29254
|
const tenant = job?.instance_did;
|
|
29027
29255
|
if (tenant) {
|
|
29028
|
-
return withTenant(tenant, () => onJob
|
|
29256
|
+
return withTenant(tenant, () => warmThenRun(onJob, job));
|
|
29029
29257
|
}
|
|
29030
29258
|
if (getTenantMode() === "single") {
|
|
29031
|
-
return withTenant(getDefaultInstanceDid(), () => onJob
|
|
29259
|
+
return withTenant(getDefaultInstanceDid(), () => warmThenRun(onJob, job));
|
|
29032
29260
|
}
|
|
29033
29261
|
const err = new TenantError(TENANT_CONTEXT_MISSING, "legacy job without tenant refused in multi mode");
|
|
29034
29262
|
err.nonRetryable = true;
|
|
@@ -41402,12 +41630,12 @@ async function createPaymentStat(date) {
|
|
|
41402
41630
|
})
|
|
41403
41631
|
);
|
|
41404
41632
|
}
|
|
41405
|
-
var
|
|
41633
|
+
var import_fs2, import_path4, import_util121, import_sequelize67;
|
|
41406
41634
|
var init_payment_stat2 = __esm({
|
|
41407
41635
|
"../../blocklets/core/api/src/crons/payment-stat.ts"() {
|
|
41408
41636
|
"use strict";
|
|
41409
|
-
|
|
41410
|
-
|
|
41637
|
+
import_fs2 = __toESM(require("fs"));
|
|
41638
|
+
import_path4 = __toESM(require("path"));
|
|
41411
41639
|
import_util121 = require("@ocap/util");
|
|
41412
41640
|
import_sequelize67 = require("sequelize");
|
|
41413
41641
|
init_dayjs();
|
|
@@ -46289,7 +46517,7 @@ var init_customers = __esm({
|
|
|
46289
46517
|
import_hono8 = require("hono");
|
|
46290
46518
|
import_joi8 = __toESM(require("joi"));
|
|
46291
46519
|
import_pick18 = __toESM(require("lodash/pick"));
|
|
46292
|
-
import_isEmail = __toESM(require("validator/
|
|
46520
|
+
import_isEmail = __toESM(require("validator/lib/isEmail"));
|
|
46293
46521
|
import_sequelize71 = require("sequelize");
|
|
46294
46522
|
import_util126 = require("@ocap/util");
|
|
46295
46523
|
init_stake();
|
|
@@ -47037,8 +47265,8 @@ var init_payment_methods = __esm({
|
|
|
47037
47265
|
if (!raw.settings.app_store?.bundle_id) {
|
|
47038
47266
|
return c.json({ error: "app_store bundle_id is required" }, 400);
|
|
47039
47267
|
}
|
|
47040
|
-
const
|
|
47041
|
-
if (
|
|
47268
|
+
const env12 = raw.settings.app_store?.environment;
|
|
47269
|
+
if (env12 !== "production" && env12 !== "sandbox") {
|
|
47042
47270
|
return c.json({ error: "app_store environment must be production or sandbox" }, 400);
|
|
47043
47271
|
}
|
|
47044
47272
|
const hasAnyServerCred = !!(raw.settings.app_store?.issuer_id || raw.settings.app_store?.key_id || raw.settings.app_store?.private_key_pem);
|
|
@@ -56248,11 +56476,11 @@ var init_credit_transactions = __esm({
|
|
|
56248
56476
|
});
|
|
56249
56477
|
|
|
56250
56478
|
// ../../blocklets/core/api/src/libs/reference-cache.ts
|
|
56251
|
-
function evictExpired(
|
|
56252
|
-
if (
|
|
56479
|
+
function evictExpired(cache2) {
|
|
56480
|
+
if (cache2.size <= CACHE_MAX_SIZE) return;
|
|
56253
56481
|
const now = Date.now();
|
|
56254
|
-
for (const [k, v] of
|
|
56255
|
-
if (v.expires < now)
|
|
56482
|
+
for (const [k, v] of cache2) {
|
|
56483
|
+
if (v.expires < now) cache2.delete(k);
|
|
56256
56484
|
}
|
|
56257
56485
|
}
|
|
56258
56486
|
function ensureCacheHooks() {
|
|
@@ -60132,11 +60360,11 @@ function isSelf(userDid, customerDid) {
|
|
|
60132
60360
|
const b = canonicalDid(customerDid);
|
|
60133
60361
|
return !!a && a === b;
|
|
60134
60362
|
}
|
|
60135
|
-
function parseLivemode(value,
|
|
60363
|
+
function parseLivemode(value, fallback) {
|
|
60136
60364
|
if (typeof value === "boolean") return value;
|
|
60137
60365
|
if (value === "true") return true;
|
|
60138
60366
|
if (value === "false") return false;
|
|
60139
|
-
return
|
|
60367
|
+
return fallback;
|
|
60140
60368
|
}
|
|
60141
60369
|
var import_hono26, import_joi25, app26, auth18, checkQuerySchema, listQuerySchema, entitlements_default;
|
|
60142
60370
|
var init_entitlements = __esm({
|
|
@@ -61571,7 +61799,7 @@ async function processDirectTransfer({
|
|
|
61571
61799
|
}
|
|
61572
61800
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
61573
61801
|
}
|
|
61574
|
-
var import_client4, import_util158, import_ethers5, import_hono33, import_joi29, import_pick31,
|
|
61802
|
+
var import_client4, import_util158, import_ethers5, import_hono33, import_joi29, import_pick31, import_sequelize91, app33, authAdmin5, auth23, paginationSchema9, searchSchema7, refundRequestSchema2, syncRefundRequestSchema, refunds_default;
|
|
61575
61803
|
var init_refunds = __esm({
|
|
61576
61804
|
"../../blocklets/core/api/src/routes/hono/refunds.ts"() {
|
|
61577
61805
|
"use strict";
|
|
@@ -61581,7 +61809,6 @@ var init_refunds = __esm({
|
|
|
61581
61809
|
import_hono33 = require("hono");
|
|
61582
61810
|
import_joi29 = __toESM(require("joi"));
|
|
61583
61811
|
import_pick31 = __toESM(require("lodash/pick"));
|
|
61584
|
-
import_wallet3 = require("@blocklet/sdk/lib/wallet");
|
|
61585
61812
|
import_sequelize91 = require("sequelize");
|
|
61586
61813
|
init_token();
|
|
61587
61814
|
init_api();
|
|
@@ -61800,7 +62027,7 @@ var init_refunds = __esm({
|
|
|
61800
62027
|
return c.json(existingRefund);
|
|
61801
62028
|
}
|
|
61802
62029
|
}
|
|
61803
|
-
const systemDid =
|
|
62030
|
+
const systemDid = wallet.address;
|
|
61804
62031
|
const finalCustomerName = customerName || "Broker";
|
|
61805
62032
|
let finalCustomer = await Customer.findOne({
|
|
61806
62033
|
where: { did: systemDid }
|
|
@@ -65283,17 +65510,17 @@ var init_snapshot = __esm({
|
|
|
65283
65510
|
// ../../blocklets/core/api/src/libs/archive/store.ts
|
|
65284
65511
|
function getArchiveDir() {
|
|
65285
65512
|
const dataDir = import_config4.default.env?.dataDir || "/tmp";
|
|
65286
|
-
const archiveDir =
|
|
65287
|
-
if (!
|
|
65288
|
-
|
|
65513
|
+
const archiveDir = import_path5.default.join(dataDir, "archive");
|
|
65514
|
+
if (!import_fs3.default.existsSync(archiveDir)) {
|
|
65515
|
+
import_fs3.default.mkdirSync(archiveDir, { recursive: true });
|
|
65289
65516
|
}
|
|
65290
65517
|
return archiveDir;
|
|
65291
65518
|
}
|
|
65292
65519
|
function getArchiveFilePath(fileName) {
|
|
65293
|
-
return
|
|
65520
|
+
return import_path5.default.join(getArchiveDir(), fileName);
|
|
65294
65521
|
}
|
|
65295
65522
|
function getArchiveFilePathForYear(year) {
|
|
65296
|
-
return
|
|
65523
|
+
return import_path5.default.join(getArchiveDir(), `archive-${year}.db`);
|
|
65297
65524
|
}
|
|
65298
65525
|
function getRecordYear(record) {
|
|
65299
65526
|
const createdAt = record?.created_at;
|
|
@@ -65380,13 +65607,13 @@ async function ensureArchiveTable(tableName, mainSequelize, archiveSequelize) {
|
|
|
65380
65607
|
}
|
|
65381
65608
|
function listArchiveFiles() {
|
|
65382
65609
|
const archiveDir = getArchiveDir();
|
|
65383
|
-
const files =
|
|
65610
|
+
const files = import_fs3.default.readdirSync(archiveDir).filter((name) => name.endsWith(".db"));
|
|
65384
65611
|
files.sort();
|
|
65385
|
-
return files.map((name) =>
|
|
65612
|
+
return files.map((name) => import_path5.default.join(archiveDir, name));
|
|
65386
65613
|
}
|
|
65387
65614
|
function getFileSize(filePath) {
|
|
65388
65615
|
try {
|
|
65389
|
-
return
|
|
65616
|
+
return import_fs3.default.statSync(filePath).size;
|
|
65390
65617
|
} catch (error) {
|
|
65391
65618
|
logger_default.warn("stat archive file failed", { filePath, error });
|
|
65392
65619
|
return 0;
|
|
@@ -65401,8 +65628,8 @@ function cleanupOldArchiveFiles(maxFiles) {
|
|
|
65401
65628
|
const removed = [];
|
|
65402
65629
|
for (const filePath of toRemove) {
|
|
65403
65630
|
try {
|
|
65404
|
-
|
|
65405
|
-
removed.push(
|
|
65631
|
+
import_fs3.default.unlinkSync(filePath);
|
|
65632
|
+
removed.push(import_path5.default.basename(filePath));
|
|
65406
65633
|
logger_default.info("removed old archive file", { filePath });
|
|
65407
65634
|
} catch (error) {
|
|
65408
65635
|
logger_default.warn("failed to remove old archive file", { filePath, error });
|
|
@@ -65410,12 +65637,12 @@ function cleanupOldArchiveFiles(maxFiles) {
|
|
|
65410
65637
|
}
|
|
65411
65638
|
return removed;
|
|
65412
65639
|
}
|
|
65413
|
-
var
|
|
65640
|
+
var import_fs3, import_path5, import_config4, import_sequelize97;
|
|
65414
65641
|
var init_store2 = __esm({
|
|
65415
65642
|
"../../blocklets/core/api/src/libs/archive/store.ts"() {
|
|
65416
65643
|
"use strict";
|
|
65417
|
-
|
|
65418
|
-
|
|
65644
|
+
import_fs3 = __toESM(require("fs"));
|
|
65645
|
+
import_path5 = __toESM(require("path"));
|
|
65419
65646
|
import_config4 = __toESM(require("@blocklet/sdk/lib/config"));
|
|
65420
65647
|
import_sequelize97 = require("sequelize");
|
|
65421
65648
|
init_logger();
|
|
@@ -65496,11 +65723,11 @@ function serializeJsonFields(record) {
|
|
|
65496
65723
|
return result;
|
|
65497
65724
|
}
|
|
65498
65725
|
function checkDiskSpace(minFreeDiskMB) {
|
|
65499
|
-
if (typeof
|
|
65726
|
+
if (typeof import_fs4.default.statfsSync !== "function") {
|
|
65500
65727
|
return;
|
|
65501
65728
|
}
|
|
65502
65729
|
const archiveDir = getArchiveDir();
|
|
65503
|
-
const stats =
|
|
65730
|
+
const stats = import_fs4.default.statfsSync(archiveDir);
|
|
65504
65731
|
const freeBytes = stats.bavail * stats.bsize;
|
|
65505
65732
|
const freeMB = Math.floor(freeBytes / (1024 * 1024));
|
|
65506
65733
|
if (freeMB < minFreeDiskMB) {
|
|
@@ -65858,7 +66085,7 @@ async function runArchiveJob(options) {
|
|
|
65858
66085
|
const filePath = getArchiveFilePath(fileName);
|
|
65859
66086
|
totalFileSize += getFileSize(filePath);
|
|
65860
66087
|
try {
|
|
65861
|
-
const fileChecksum = import_crypto4.default.createHash("sha256").update(
|
|
66088
|
+
const fileChecksum = import_crypto4.default.createHash("sha256").update(import_fs4.default.readFileSync(filePath)).digest("hex");
|
|
65862
66089
|
checksums.push(`${fileName}:${fileChecksum.substring(0, 8)}`);
|
|
65863
66090
|
} catch {
|
|
65864
66091
|
checksums.push(`${fileName}:error`);
|
|
@@ -65895,12 +66122,12 @@ async function runArchiveJob(options) {
|
|
|
65895
66122
|
await releaseArchiveLock(instanceId);
|
|
65896
66123
|
}
|
|
65897
66124
|
}
|
|
65898
|
-
var import_crypto4,
|
|
66125
|
+
var import_crypto4, import_fs4, import_nanoid3, import_sequelize98, ACTIVE_SUBSCRIPTION_STATUSES, TABLE_MODELS;
|
|
65899
66126
|
var init_executor = __esm({
|
|
65900
66127
|
"../../blocklets/core/api/src/libs/archive/executor.ts"() {
|
|
65901
66128
|
"use strict";
|
|
65902
66129
|
import_crypto4 = __toESM(require("crypto"));
|
|
65903
|
-
|
|
66130
|
+
import_fs4 = __toESM(require("fs"));
|
|
65904
66131
|
import_nanoid3 = require("nanoid");
|
|
65905
66132
|
import_sequelize98 = require("sequelize");
|
|
65906
66133
|
init_dayjs();
|
|
@@ -66020,7 +66247,7 @@ async function queryArchive(params, actorId) {
|
|
|
66020
66247
|
});
|
|
66021
66248
|
if (Array.isArray(rows) && rows.length > 0) {
|
|
66022
66249
|
results.push(...rows);
|
|
66023
|
-
touchedFiles.push(
|
|
66250
|
+
touchedFiles.push(import_path6.default.basename(filePath));
|
|
66024
66251
|
}
|
|
66025
66252
|
} catch (error) {
|
|
66026
66253
|
logger_default.warn("archive query failed", { filePath, error });
|
|
@@ -66036,11 +66263,11 @@ async function queryArchive(params, actorId) {
|
|
|
66036
66263
|
await recordArchiveQuery(touchedFiles, actorId);
|
|
66037
66264
|
return { data, total, archiveFiles: touchedFiles };
|
|
66038
66265
|
}
|
|
66039
|
-
var
|
|
66266
|
+
var import_path6, import_sequelize100, TENANT_TABLE_SET2, VALID_TABLE_NAME;
|
|
66040
66267
|
var init_query = __esm({
|
|
66041
66268
|
"../../blocklets/core/api/src/libs/archive/query.ts"() {
|
|
66042
66269
|
"use strict";
|
|
66043
|
-
|
|
66270
|
+
import_path6 = __toESM(require("path"));
|
|
66044
66271
|
import_sequelize100 = require("sequelize");
|
|
66045
66272
|
init_logger();
|
|
66046
66273
|
init_context();
|
|
@@ -66537,12 +66764,12 @@ var collect_exports = {};
|
|
|
66537
66764
|
__export(collect_exports, {
|
|
66538
66765
|
default: () => collect_default
|
|
66539
66766
|
});
|
|
66540
|
-
var import_util172,
|
|
66767
|
+
var import_util172, import_wallet3, collect_default;
|
|
66541
66768
|
var init_collect = __esm({
|
|
66542
66769
|
"../../blocklets/core/api/src/routes/connect/collect.ts"() {
|
|
66543
66770
|
"use strict";
|
|
66544
66771
|
import_util172 = require("@ocap/util");
|
|
66545
|
-
|
|
66772
|
+
import_wallet3 = require("@ocap/wallet");
|
|
66546
66773
|
init_token();
|
|
66547
66774
|
init_tx();
|
|
66548
66775
|
init_auth();
|
|
@@ -66678,7 +66905,7 @@ var init_collect = __esm({
|
|
|
66678
66905
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
66679
66906
|
const txHash = await client.sendTransferV3Tx(
|
|
66680
66907
|
// @ts-ignore
|
|
66681
|
-
{ tx, wallet: (0,
|
|
66908
|
+
{ tx, wallet: (0, import_wallet3.fromAddress)(userDid) },
|
|
66682
66909
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
66683
66910
|
);
|
|
66684
66911
|
await afterTxExecution({
|
|
@@ -66724,11 +66951,11 @@ var collect_batch_exports = {};
|
|
|
66724
66951
|
__export(collect_batch_exports, {
|
|
66725
66952
|
default: () => collect_batch_default
|
|
66726
66953
|
});
|
|
66727
|
-
var
|
|
66954
|
+
var import_wallet4, import_util174, collect_batch_default;
|
|
66728
66955
|
var init_collect_batch = __esm({
|
|
66729
66956
|
"../../blocklets/core/api/src/routes/connect/collect-batch.ts"() {
|
|
66730
66957
|
"use strict";
|
|
66731
|
-
|
|
66958
|
+
import_wallet4 = require("@ocap/wallet");
|
|
66732
66959
|
import_util174 = require("@ocap/util");
|
|
66733
66960
|
init_token();
|
|
66734
66961
|
init_tx();
|
|
@@ -66845,7 +67072,7 @@ var init_collect_batch = __esm({
|
|
|
66845
67072
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
66846
67073
|
const txHash = await client.sendTransferV3Tx(
|
|
66847
67074
|
// @ts-ignore
|
|
66848
|
-
{ tx, wallet: (0,
|
|
67075
|
+
{ tx, wallet: (0, import_wallet4.fromAddress)(userDid) },
|
|
66849
67076
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
66850
67077
|
);
|
|
66851
67078
|
await afterTxExecution({ tx_hash: txHash, payer: userDid, type: "transfer" });
|
|
@@ -66911,12 +67138,12 @@ var pay_exports = {};
|
|
|
66911
67138
|
__export(pay_exports, {
|
|
66912
67139
|
default: () => pay_default
|
|
66913
67140
|
});
|
|
66914
|
-
var import_util176,
|
|
67141
|
+
var import_util176, import_wallet5, pay_default;
|
|
66915
67142
|
var init_pay = __esm({
|
|
66916
67143
|
"../../blocklets/core/api/src/routes/connect/pay.ts"() {
|
|
66917
67144
|
"use strict";
|
|
66918
67145
|
import_util176 = require("@ocap/util");
|
|
66919
|
-
|
|
67146
|
+
import_wallet5 = require("@ocap/wallet");
|
|
66920
67147
|
init_token();
|
|
66921
67148
|
init_tx();
|
|
66922
67149
|
init_auth();
|
|
@@ -67039,7 +67266,7 @@ var init_pay = __esm({
|
|
|
67039
67266
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
67040
67267
|
const txHash = await client.sendTransferV3Tx(
|
|
67041
67268
|
// @ts-ignore
|
|
67042
|
-
{ tx, wallet: (0,
|
|
67269
|
+
{ tx, wallet: (0, import_wallet5.fromAddress)(userDid) },
|
|
67043
67270
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
67044
67271
|
);
|
|
67045
67272
|
const quoteValidation = await validateQuoteForPayment({
|
|
@@ -68436,11 +68663,11 @@ var recharge_exports = {};
|
|
|
68436
68663
|
__export(recharge_exports, {
|
|
68437
68664
|
default: () => recharge_default
|
|
68438
68665
|
});
|
|
68439
|
-
var
|
|
68666
|
+
var import_wallet6, import_util182, recharge_default;
|
|
68440
68667
|
var init_recharge = __esm({
|
|
68441
68668
|
"../../blocklets/core/api/src/routes/connect/recharge.ts"() {
|
|
68442
68669
|
"use strict";
|
|
68443
|
-
|
|
68670
|
+
import_wallet6 = require("@ocap/wallet");
|
|
68444
68671
|
import_util182 = require("@ocap/util");
|
|
68445
68672
|
init_token();
|
|
68446
68673
|
init_tx();
|
|
@@ -68555,7 +68782,7 @@ var init_recharge = __esm({
|
|
|
68555
68782
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
68556
68783
|
const txHash = await client.sendTransferV3Tx(
|
|
68557
68784
|
// @ts-ignore
|
|
68558
|
-
{ tx, wallet: (0,
|
|
68785
|
+
{ tx, wallet: (0, import_wallet6.fromAddress)(userDid) },
|
|
68559
68786
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
68560
68787
|
);
|
|
68561
68788
|
logger_default.info("Recharge successful", {
|
|
@@ -69167,11 +69394,11 @@ async function triggerAutoRecharge(customer) {
|
|
|
69167
69394
|
});
|
|
69168
69395
|
}
|
|
69169
69396
|
}
|
|
69170
|
-
var
|
|
69397
|
+
var import_wallet7, import_util185, import_p_all6, recharge_account_default;
|
|
69171
69398
|
var init_recharge_account = __esm({
|
|
69172
69399
|
"../../blocklets/core/api/src/routes/connect/recharge-account.ts"() {
|
|
69173
69400
|
"use strict";
|
|
69174
|
-
|
|
69401
|
+
import_wallet7 = require("@ocap/wallet");
|
|
69175
69402
|
import_util185 = require("@ocap/util");
|
|
69176
69403
|
import_p_all6 = __toESM(require("p-all"));
|
|
69177
69404
|
init_token();
|
|
@@ -69334,7 +69561,7 @@ var init_recharge_account = __esm({
|
|
|
69334
69561
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
69335
69562
|
const txHash = await client.sendTransferV3Tx(
|
|
69336
69563
|
// @ts-ignore
|
|
69337
|
-
{ tx, wallet: (0,
|
|
69564
|
+
{ tx, wallet: (0, import_wallet7.fromAddress)(userDid) },
|
|
69338
69565
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
69339
69566
|
);
|
|
69340
69567
|
await afterTxExecution({
|
|
@@ -69985,137 +70212,6 @@ var init_change_payer = __esm({
|
|
|
69985
70212
|
}
|
|
69986
70213
|
});
|
|
69987
70214
|
|
|
69988
|
-
// ../../blocklets/core/api/src/middlewares/hono/fallback.ts
|
|
69989
|
-
var fallback_exports = {};
|
|
69990
|
-
__export(fallback_exports, {
|
|
69991
|
-
default: () => fallback_default,
|
|
69992
|
-
fallback: () => fallback
|
|
69993
|
-
});
|
|
69994
|
-
function acceptsHtml(accept) {
|
|
69995
|
-
if (!accept) return true;
|
|
69996
|
-
return accept.includes("text/html") || accept.includes("application/xhtml+xml") || accept.includes("*/*");
|
|
69997
|
-
}
|
|
69998
|
-
function fallback(file, options = {}) {
|
|
69999
|
-
const filePath = options.root ? (0, import_path6.join)(options.root, file) : file;
|
|
70000
|
-
if (!import_fs4.default.existsSync(filePath)) {
|
|
70001
|
-
throw new Error(`Fallback file not found at: ${filePath}`);
|
|
70002
|
-
}
|
|
70003
|
-
return async (c, next) => {
|
|
70004
|
-
const method = c.req.method.toUpperCase();
|
|
70005
|
-
if (method !== "GET" && method !== "HEAD" || !acceptsHtml(c.req.header("accept") || "") || import_constant.RESOURCE_PATTERN.test(c.req.path)) {
|
|
70006
|
-
return next();
|
|
70007
|
-
}
|
|
70008
|
-
const pageGroup = c.req.header("x-page-group") || "";
|
|
70009
|
-
const pathPrefix = c.req.header("x-path-prefix") || "";
|
|
70010
|
-
const cacheKey = getCacheKey(c.req.path, filePath, pageGroup, pathPrefix);
|
|
70011
|
-
const { theme } = (0, import_config7.getBlockletSettings)();
|
|
70012
|
-
if (cacheEnabled) {
|
|
70013
|
-
const cached = cache2.get(cacheKey);
|
|
70014
|
-
const cacheTtl = options.cacheTtl || DEFAULT_CACHE_TTL;
|
|
70015
|
-
if (cached && Date.now() - cached.timestamp < cacheTtl && cached.pageGroup === pageGroup && cached.pathPrefix === pathPrefix) {
|
|
70016
|
-
c.header("X-Cache", "HIT");
|
|
70017
|
-
c.header("ETag", cached.etag);
|
|
70018
|
-
return c.html(cached.html);
|
|
70019
|
-
}
|
|
70020
|
-
}
|
|
70021
|
-
const pageData = await tryWithTimeout2(
|
|
70022
|
-
options.getPageData ? () => options.getPageData(c) : () => Promise.resolve({}),
|
|
70023
|
-
options.timeout || 5e3
|
|
70024
|
-
);
|
|
70025
|
-
validatePageData(pageData, options.maxLength || 1e3);
|
|
70026
|
-
const title = (0, import_escape.default)(pageData.title || import_config7.env.appName);
|
|
70027
|
-
const description = (0, import_escape.default)(pageData.description || import_config7.env.appDescription);
|
|
70028
|
-
const ogImage = pageData.ogImage || (0, import_ufo15.joinURL)(import_config7.env.appUrl || "/", import_constants24.SERVICE_PREFIX, "/blocklet/og.png");
|
|
70029
|
-
let source = await import_fs4.default.promises.readFile(filePath, "utf8");
|
|
70030
|
-
if (title) {
|
|
70031
|
-
source = source.includes("<title>") ? source.replace(TITLE_TAG_REGEX, `<title>${title}</title>`) : source.replace(HEAD_END_TAG, `<title>${title}</title>${HEAD_END_TAG}`);
|
|
70032
|
-
}
|
|
70033
|
-
if (description && !source.includes('<meta name="description"')) {
|
|
70034
|
-
source = source.replace(
|
|
70035
|
-
HEAD_END_TAG,
|
|
70036
|
-
`<meta name="description" content="${description}" data-react-helmet="true" />${HEAD_END_TAG}`
|
|
70037
|
-
);
|
|
70038
|
-
}
|
|
70039
|
-
if (!source.includes('meta property="og:image"')) {
|
|
70040
|
-
source = source.replace(
|
|
70041
|
-
HEAD_END_TAG,
|
|
70042
|
-
`${buildOpenGraph({ title, description, ogImage }, import_config7.env.appUrl || "/")}
|
|
70043
|
-
${HEAD_END_TAG}`
|
|
70044
|
-
);
|
|
70045
|
-
}
|
|
70046
|
-
if (pageData.embed) {
|
|
70047
|
-
source = source.replace(
|
|
70048
|
-
HEAD_END_TAG,
|
|
70049
|
-
`<link rel="blocklet-open-embed" type="application/json" href="${pageData.embed}" />${HEAD_END_TAG}`
|
|
70050
|
-
);
|
|
70051
|
-
}
|
|
70052
|
-
const blockletJs = (0, import_config7.getBlockletJs)(pageGroup, pathPrefix);
|
|
70053
|
-
if (blockletJs && options.injectBlockletJs !== false) {
|
|
70054
|
-
source = source.replace('<script src="__blocklet__.js"></script>', `<script>${blockletJs}</script>`).replace('<script src="__meta__.js"></script>', `<script>${blockletJs}</script>`);
|
|
70055
|
-
}
|
|
70056
|
-
const themeStyles = (0, import_theme.buildThemeStyles)(theme);
|
|
70057
|
-
const themeScript = (0, import_theme.buildThemeScript)(theme);
|
|
70058
|
-
if (!source.includes('<style id="blocklet-theme">')) {
|
|
70059
|
-
source = source.replace(HEAD_END_TAG, `${themeStyles}${HEAD_END_TAG}`);
|
|
70060
|
-
}
|
|
70061
|
-
if (!source.includes('<script id="blocklet-theme-script">')) {
|
|
70062
|
-
source = source.replace(HEAD_END_TAG, `${themeScript}${HEAD_END_TAG}`);
|
|
70063
|
-
}
|
|
70064
|
-
const etag = generateETag(source);
|
|
70065
|
-
cache2.set(cacheKey, { html: source, timestamp: Date.now(), etag, pageGroup, pathPrefix });
|
|
70066
|
-
if (options.cacheTtl) {
|
|
70067
|
-
c.header("Cache-Control", `public, max-age=${options.cacheTtl}`);
|
|
70068
|
-
} else {
|
|
70069
|
-
c.header("Surrogate-Control", "no-store");
|
|
70070
|
-
c.header("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
|
|
70071
|
-
c.header("Expires", "0");
|
|
70072
|
-
}
|
|
70073
|
-
c.header("X-Cache", "MISS");
|
|
70074
|
-
c.header("ETag", etag);
|
|
70075
|
-
return c.html(source);
|
|
70076
|
-
};
|
|
70077
|
-
}
|
|
70078
|
-
var import_fs4, import_path6, import_crypto5, import_ufo15, import_escape, import_constant, import_theme, import_config7, import_constants24, DEFAULT_CACHE_TTL, cache2, cacheEnabled, TITLE_TAG_REGEX, HEAD_END_TAG, buildOpenGraph, validatePageData, generateETag, getCacheKey, tryWithTimeout2, fallback_default;
|
|
70079
|
-
var init_fallback = __esm({
|
|
70080
|
-
"../../blocklets/core/api/src/middlewares/hono/fallback.ts"() {
|
|
70081
|
-
"use strict";
|
|
70082
|
-
import_fs4 = __toESM(require("fs"));
|
|
70083
|
-
import_path6 = require("path");
|
|
70084
|
-
import_crypto5 = __toESM(require("crypto"));
|
|
70085
|
-
import_ufo15 = require("ufo");
|
|
70086
|
-
import_escape = __toESM(require("lodash/escape"));
|
|
70087
|
-
import_constant = require("@blocklet/constant");
|
|
70088
|
-
import_theme = require("@blocklet/theme");
|
|
70089
|
-
import_config7 = require("@blocklet/sdk/lib/config");
|
|
70090
|
-
import_constants24 = require("@blocklet/sdk/lib/util/constants");
|
|
70091
|
-
init_env();
|
|
70092
|
-
DEFAULT_CACHE_TTL = 60 * 1e3;
|
|
70093
|
-
cache2 = /* @__PURE__ */ new Map();
|
|
70094
|
-
cacheEnabled = readConfig("FALLBACK_CACHE_ENABLED") === "true" || isTestEnv();
|
|
70095
|
-
TITLE_TAG_REGEX = /<title>(.+)<\/title>/;
|
|
70096
|
-
HEAD_END_TAG = "</head>";
|
|
70097
|
-
buildOpenGraph = (pageData, appUrl) => [
|
|
70098
|
-
`<meta property="og:title" content="${pageData.title}" data-react-helmet="true" />`,
|
|
70099
|
-
`<meta property="og:description" content="${pageData.description}" data-react-helmet="true" />`,
|
|
70100
|
-
'<meta property="og:type" content="website" data-react-helmet="true" />',
|
|
70101
|
-
`<meta property="og:url" content="${appUrl}" data-react-helmet="true" />`,
|
|
70102
|
-
`<meta property="og:image" content="${pageData.ogImage}" data-react-helmet="true" />`,
|
|
70103
|
-
'<meta name="twitter:card" content="summary_large_image" data-react-helmet="true" />'
|
|
70104
|
-
].join("\n");
|
|
70105
|
-
validatePageData = (data, maxLength) => {
|
|
70106
|
-
if (data.title && data.title.length > maxLength) throw new Error("Title too long");
|
|
70107
|
-
if (data.description && data.description.length > maxLength) throw new Error("Description too long");
|
|
70108
|
-
};
|
|
70109
|
-
generateETag = (content) => `W/"${import_crypto5.default.createHash("sha1").update(content).digest("base64")}"`;
|
|
70110
|
-
getCacheKey = (pathname, filePath, pageGroup, pathPrefix) => import_crypto5.default.createHash("sha1").update(`${pathname}:${filePath}:${pageGroup}:${pathPrefix}`).digest("base64");
|
|
70111
|
-
tryWithTimeout2 = (asyncFn, timeout) => new Promise((resolve, reject) => {
|
|
70112
|
-
const timer = setTimeout(() => reject(new Error(`Operation timed out after ${timeout} ms`)), timeout);
|
|
70113
|
-
Promise.resolve().then(asyncFn).then((result) => resolve(result)).catch((err) => reject(err)).finally(() => clearTimeout(timer));
|
|
70114
|
-
});
|
|
70115
|
-
fallback_default = fallback;
|
|
70116
|
-
}
|
|
70117
|
-
});
|
|
70118
|
-
|
|
70119
70215
|
// ../../blocklets/core/api/src/crons/currency.ts
|
|
70120
70216
|
var currency_exports = {};
|
|
70121
70217
|
__export(currency_exports, {
|
|
@@ -73491,11 +73587,11 @@ var init_fulfillment_coordinator = __esm({
|
|
|
73491
73587
|
});
|
|
73492
73588
|
|
|
73493
73589
|
// ../../blocklets/core/api/src/queues/vendors/status-check.ts
|
|
73494
|
-
var
|
|
73590
|
+
var import_ufo15, import_payment_vendor4, startVendorStatusCheckSchedule, handleVendorStatusCheck, vendorStatusCheckQueue;
|
|
73495
73591
|
var init_status_check = __esm({
|
|
73496
73592
|
"../../blocklets/core/api/src/queues/vendors/status-check.ts"() {
|
|
73497
73593
|
"use strict";
|
|
73498
|
-
|
|
73594
|
+
import_ufo15 = require("ufo");
|
|
73499
73595
|
import_payment_vendor4 = require("@blocklet/payment-vendor");
|
|
73500
73596
|
init_queue2();
|
|
73501
73597
|
init_checkout_session();
|
|
@@ -73580,7 +73676,7 @@ var init_status_check = __esm({
|
|
|
73580
73676
|
const url = productVendor?.app_url;
|
|
73581
73677
|
logger_default.info("found vendor url", { url, productVendor });
|
|
73582
73678
|
if (url) {
|
|
73583
|
-
const serverStatusUrl = (0,
|
|
73679
|
+
const serverStatusUrl = (0, import_ufo15.joinURL)(
|
|
73584
73680
|
url,
|
|
73585
73681
|
productVendor?.metadata?.mountPoint,
|
|
73586
73682
|
"/api/vendor/status",
|
|
@@ -73652,7 +73748,7 @@ var init_status_check = __esm({
|
|
|
73652
73748
|
|
|
73653
73749
|
// ../../blocklets/core/api/src/crons/overdue-detection.ts
|
|
73654
73750
|
function getAppName() {
|
|
73655
|
-
return
|
|
73751
|
+
return import_config7.env.appName;
|
|
73656
73752
|
}
|
|
73657
73753
|
async function createOverdueDetection() {
|
|
73658
73754
|
logger_default.info("Start health report generation");
|
|
@@ -73672,16 +73768,16 @@ async function createOverdueDetection() {
|
|
|
73672
73768
|
logger_default.error("Failed to create health report", error);
|
|
73673
73769
|
}
|
|
73674
73770
|
}
|
|
73675
|
-
var import_notification29, import_component18,
|
|
73771
|
+
var import_notification29, import_component18, import_config7, import_util196, import_sequelize107, import_ufo16, HealthReportTemplate;
|
|
73676
73772
|
var init_overdue_detection = __esm({
|
|
73677
73773
|
"../../blocklets/core/api/src/crons/overdue-detection.ts"() {
|
|
73678
73774
|
"use strict";
|
|
73679
73775
|
import_notification29 = __toESM(require("@blocklet/sdk/service/notification"));
|
|
73680
73776
|
import_component18 = require("@blocklet/sdk/lib/component");
|
|
73681
|
-
|
|
73777
|
+
import_config7 = require("@blocklet/sdk/lib/config");
|
|
73682
73778
|
import_util196 = require("@ocap/util");
|
|
73683
73779
|
import_sequelize107 = require("sequelize");
|
|
73684
|
-
|
|
73780
|
+
import_ufo16 = require("ufo");
|
|
73685
73781
|
init_notification2();
|
|
73686
73782
|
init_dayjs();
|
|
73687
73783
|
init_env();
|
|
@@ -74007,9 +74103,9 @@ var init_overdue_detection = __esm({
|
|
|
74007
74103
|
throw new Error("get owner did failed");
|
|
74008
74104
|
}
|
|
74009
74105
|
const locale = await getUserLocale(userDid);
|
|
74010
|
-
const viewDataOverviewUrl = (0, import_component18.getUrl)((0,
|
|
74011
|
-
const viewSubscriptionsUrl = (0, import_component18.getUrl)((0,
|
|
74012
|
-
const viewOverdueUrl = (0, import_component18.getUrl)((0,
|
|
74106
|
+
const viewDataOverviewUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing", { locale }));
|
|
74107
|
+
const viewSubscriptionsUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing/subscriptions", { locale }));
|
|
74108
|
+
const viewOverdueUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing/overdue", { locale }));
|
|
74013
74109
|
return {
|
|
74014
74110
|
locale,
|
|
74015
74111
|
userDid,
|
|
@@ -74222,6 +74318,7 @@ var init_event3 = __esm({
|
|
|
74222
74318
|
import_sequelize108 = require("sequelize");
|
|
74223
74319
|
init_env();
|
|
74224
74320
|
init_scoped();
|
|
74321
|
+
init_context();
|
|
74225
74322
|
init_event2();
|
|
74226
74323
|
init_logger();
|
|
74227
74324
|
init_queue2();
|
|
@@ -74278,16 +74375,26 @@ var init_event3 = __esm({
|
|
|
74278
74375
|
where: {
|
|
74279
74376
|
pending_webhooks: { [import_sequelize108.Op.gt]: 0 }
|
|
74280
74377
|
},
|
|
74281
|
-
attributes: ["id"]
|
|
74378
|
+
attributes: ["id", "instance_did"]
|
|
74282
74379
|
});
|
|
74283
74380
|
logger_default.info(`Found ${docs.length} events with pending webhooks`);
|
|
74284
|
-
|
|
74285
|
-
|
|
74286
|
-
|
|
74287
|
-
|
|
74288
|
-
|
|
74381
|
+
for (const x of docs) {
|
|
74382
|
+
if (!x.instance_did) {
|
|
74383
|
+
logger_default.warn("skip pending-webhook event with no tenant", { id: x.id });
|
|
74384
|
+
} else {
|
|
74385
|
+
try {
|
|
74386
|
+
await withTenant(x.instance_did, async () => {
|
|
74387
|
+
const exist = await eventQueue.get(x.id);
|
|
74388
|
+
if (!exist) {
|
|
74389
|
+
logger_default.info(`Pushing event ${x.id} to queue`);
|
|
74390
|
+
eventQueue.push({ id: x.id, job: { eventId: x.id }, persist: false });
|
|
74391
|
+
}
|
|
74392
|
+
});
|
|
74393
|
+
} catch (error) {
|
|
74394
|
+
logger_default.error("failed to recover pending-webhook event", { id: x.id, error });
|
|
74395
|
+
}
|
|
74289
74396
|
}
|
|
74290
|
-
}
|
|
74397
|
+
}
|
|
74291
74398
|
logger_default.info("Finished starting event queue");
|
|
74292
74399
|
};
|
|
74293
74400
|
eventQueue.on("failed", ({ id, job, error }) => {
|
|
@@ -74342,6 +74449,45 @@ var init_retry_pending_events = __esm({
|
|
|
74342
74449
|
}
|
|
74343
74450
|
});
|
|
74344
74451
|
|
|
74452
|
+
// ../../blocklets/core/api/src/crons/tenant-fanout.ts
|
|
74453
|
+
async function listProvisionedTenants() {
|
|
74454
|
+
const { PaymentMethod: PaymentMethod3 } = (init_models(), __toCommonJS(models_exports));
|
|
74455
|
+
const rows = await systemFindAll(PaymentMethod3, {
|
|
74456
|
+
attributes: ["instance_did"],
|
|
74457
|
+
raw: true
|
|
74458
|
+
});
|
|
74459
|
+
const dids = /* @__PURE__ */ new Set();
|
|
74460
|
+
for (const row of rows) {
|
|
74461
|
+
if (row?.instance_did) dids.add(row.instance_did);
|
|
74462
|
+
}
|
|
74463
|
+
return [...dids];
|
|
74464
|
+
}
|
|
74465
|
+
function perTenant(name, fn3, listTenants = listProvisionedTenants) {
|
|
74466
|
+
return async () => {
|
|
74467
|
+
if (getTenantMode() === "single") {
|
|
74468
|
+
await fn3();
|
|
74469
|
+
return;
|
|
74470
|
+
}
|
|
74471
|
+
const dids = await listTenants();
|
|
74472
|
+
if (dids.length === 0) return;
|
|
74473
|
+
logger_default.info("cron.tenant.fanout", { cron: name, tenantCount: dids.length });
|
|
74474
|
+
for (const instanceDid of dids) {
|
|
74475
|
+
await withTenant(instanceDid, async () => fn3()).catch(
|
|
74476
|
+
(error) => logger_default.error("cron tenant pass failed", { cron: name, instanceDid, error })
|
|
74477
|
+
);
|
|
74478
|
+
}
|
|
74479
|
+
};
|
|
74480
|
+
}
|
|
74481
|
+
var init_tenant_fanout = __esm({
|
|
74482
|
+
"../../blocklets/core/api/src/crons/tenant-fanout.ts"() {
|
|
74483
|
+
"use strict";
|
|
74484
|
+
init_context();
|
|
74485
|
+
init_logger();
|
|
74486
|
+
init_tenant();
|
|
74487
|
+
init_scoped();
|
|
74488
|
+
}
|
|
74489
|
+
});
|
|
74490
|
+
|
|
74345
74491
|
// ../../blocklets/core/api/src/crons/subscription-trial-will-end.ts
|
|
74346
74492
|
var import_dayjs45, import_sequelize110, SubscriptionTrialWillEndSchedule;
|
|
74347
74493
|
var init_subscription_trial_will_end2 = __esm({
|
|
@@ -75121,19 +75267,19 @@ function init() {
|
|
|
75121
75267
|
{
|
|
75122
75268
|
name: "subscription.will.renew",
|
|
75123
75269
|
time: notificationCronTime(),
|
|
75124
|
-
fn: () => new SubscriptionWillRenewSchedule().run(),
|
|
75270
|
+
fn: perTenant("subscription.will.renew", () => new SubscriptionWillRenewSchedule().run()),
|
|
75125
75271
|
options: { runOnInit: true }
|
|
75126
75272
|
},
|
|
75127
75273
|
{
|
|
75128
75274
|
name: "subscription.trial.will.end",
|
|
75129
75275
|
time: notificationCronTime(),
|
|
75130
|
-
fn: () => new SubscriptionTrialWillEndSchedule().run(),
|
|
75276
|
+
fn: perTenant("subscription.trial.will.end", () => new SubscriptionTrialWillEndSchedule().run()),
|
|
75131
75277
|
options: { runOnInit: true }
|
|
75132
75278
|
},
|
|
75133
75279
|
{
|
|
75134
75280
|
name: "customer.subscription.will_canceled",
|
|
75135
75281
|
time: notificationCronTime(),
|
|
75136
|
-
fn: () => new SubscriptionWillCanceledSchedule().run(),
|
|
75282
|
+
fn: perTenant("customer.subscription.will_canceled", () => new SubscriptionWillCanceledSchedule().run()),
|
|
75137
75283
|
options: { runOnInit: true }
|
|
75138
75284
|
},
|
|
75139
75285
|
{
|
|
@@ -75154,34 +75300,34 @@ function init() {
|
|
|
75154
75300
|
{
|
|
75155
75301
|
name: "checkoutSession.cleanup.expired",
|
|
75156
75302
|
time: expiredSessionCleanupCronTime(),
|
|
75157
|
-
fn: async () => {
|
|
75303
|
+
fn: perTenant("checkoutSession.cleanup.expired", async () => {
|
|
75158
75304
|
const removedCount = await CheckoutSession.cleanupExpiredSessions();
|
|
75159
75305
|
logger_default.info("CheckoutSession.cleanupExpiredSessions", { removedCount });
|
|
75160
|
-
},
|
|
75306
|
+
}),
|
|
75161
75307
|
options: { runOnInit: true }
|
|
75162
75308
|
},
|
|
75163
75309
|
{
|
|
75164
75310
|
name: "stripe.invoice.sync",
|
|
75165
75311
|
time: stripeInvoiceCronTime(),
|
|
75166
|
-
fn: batchHandleStripeInvoices,
|
|
75312
|
+
fn: perTenant("stripe.invoice.sync", batchHandleStripeInvoices),
|
|
75167
75313
|
options: { runOnInit: false }
|
|
75168
75314
|
},
|
|
75169
75315
|
{
|
|
75170
75316
|
name: "stripe.payment.sync",
|
|
75171
75317
|
time: stripePaymentCronTime(),
|
|
75172
|
-
fn: batchHandleStripePayments,
|
|
75318
|
+
fn: perTenant("stripe.payment.sync", batchHandleStripePayments),
|
|
75173
75319
|
options: { runOnInit: false }
|
|
75174
75320
|
},
|
|
75175
75321
|
{
|
|
75176
75322
|
name: "stripe.subscription.sync",
|
|
75177
75323
|
time: stripeSubscriptionCronTime(),
|
|
75178
|
-
fn: batchHandleStripeSubscriptions,
|
|
75324
|
+
fn: perTenant("stripe.subscription.sync", batchHandleStripeSubscriptions),
|
|
75179
75325
|
options: { runOnInit: false }
|
|
75180
75326
|
},
|
|
75181
75327
|
{
|
|
75182
75328
|
name: "customer.stake.revoked",
|
|
75183
75329
|
time: revokeStakeCronTime(),
|
|
75184
|
-
fn: checkStakeRevokeTx,
|
|
75330
|
+
fn: perTenant("customer.stake.revoked", checkStakeRevokeTx),
|
|
75185
75331
|
options: { runOnInit: false }
|
|
75186
75332
|
},
|
|
75187
75333
|
{
|
|
@@ -75190,7 +75336,7 @@ function init() {
|
|
|
75190
75336
|
// webhook missed). See blocklets/core/api/src/integrations/iap-reconcile.ts.
|
|
75191
75337
|
name: "iap.reconcile",
|
|
75192
75338
|
time: iapReconcileCronTime(),
|
|
75193
|
-
fn: () => runIapReconcile(),
|
|
75339
|
+
fn: perTenant("iap.reconcile", () => runIapReconcile()),
|
|
75194
75340
|
options: { runOnInit: false }
|
|
75195
75341
|
},
|
|
75196
75342
|
{
|
|
@@ -75199,19 +75345,19 @@ function init() {
|
|
|
75199
75345
|
// See blocklets/core/api/src/crons/retry-pending-events.ts.
|
|
75200
75346
|
name: "event.retry",
|
|
75201
75347
|
time: eventRetryCronTime(),
|
|
75202
|
-
fn: () => retryPendingEvents(),
|
|
75348
|
+
fn: perTenant("event.retry", () => retryPendingEvents()),
|
|
75203
75349
|
options: { runOnInit: false }
|
|
75204
75350
|
},
|
|
75205
75351
|
{
|
|
75206
75352
|
name: "payment.stat",
|
|
75207
75353
|
time: paymentStatCronTime(),
|
|
75208
|
-
fn: () => createPaymentStat(),
|
|
75354
|
+
fn: perTenant("payment.stat", () => createPaymentStat()),
|
|
75209
75355
|
options: { runOnInit: false }
|
|
75210
75356
|
},
|
|
75211
75357
|
{
|
|
75212
75358
|
name: "payment.daily.report",
|
|
75213
75359
|
time: overdueDetectionCronTime(),
|
|
75214
|
-
fn: () => createOverdueDetection(),
|
|
75360
|
+
fn: perTenant("payment.daily.report", () => createOverdueDetection()),
|
|
75215
75361
|
options: { runOnInit: false }
|
|
75216
75362
|
},
|
|
75217
75363
|
{
|
|
@@ -75264,6 +75410,7 @@ var init_crons = __esm({
|
|
|
75264
75410
|
init_overdue_detection();
|
|
75265
75411
|
init_payment_stat2();
|
|
75266
75412
|
init_retry_pending_events();
|
|
75413
|
+
init_tenant_fanout();
|
|
75267
75414
|
init_subscription_trial_will_end2();
|
|
75268
75415
|
init_subscription_will_canceled2();
|
|
75269
75416
|
init_subscription_will_renew2();
|
|
@@ -75283,7 +75430,7 @@ async function getPackResource(type) {
|
|
|
75283
75430
|
const resources = await (0, import_component19.getPackResources)({
|
|
75284
75431
|
types: [
|
|
75285
75432
|
{
|
|
75286
|
-
did:
|
|
75433
|
+
did: import_config9.env.componentDid,
|
|
75287
75434
|
type
|
|
75288
75435
|
}
|
|
75289
75436
|
]
|
|
@@ -75293,17 +75440,17 @@ async function getPackResource(type) {
|
|
|
75293
75440
|
}
|
|
75294
75441
|
return null;
|
|
75295
75442
|
} catch (error) {
|
|
75296
|
-
console.error(`failed to get ${type} pack resource from ${
|
|
75443
|
+
console.error(`failed to get ${type} pack resource from ${import_config9.env.componentDid}`, error);
|
|
75297
75444
|
return null;
|
|
75298
75445
|
}
|
|
75299
75446
|
}
|
|
75300
75447
|
async function getResourcesByType(type) {
|
|
75301
75448
|
try {
|
|
75302
75449
|
const pack = await getPackResource(type);
|
|
75303
|
-
const resources = await (0, import_component19.getResources)({ types: [{ did:
|
|
75450
|
+
const resources = await (0, import_component19.getResources)({ types: [{ did: import_config9.env.componentDid, type }], skipRunningCheck: true });
|
|
75304
75451
|
return pack ? [pack, ...resources] : resources;
|
|
75305
75452
|
} catch (error) {
|
|
75306
|
-
console.error(`failed to get ${type} resources from ${
|
|
75453
|
+
console.error(`failed to get ${type} resources from ${import_config9.env.componentDid}`, error);
|
|
75307
75454
|
return [];
|
|
75308
75455
|
}
|
|
75309
75456
|
}
|
|
@@ -75319,7 +75466,7 @@ async function initPaywallResources() {
|
|
|
75319
75466
|
console.info("try import paywall resource", resource);
|
|
75320
75467
|
const config4 = JSON.parse(
|
|
75321
75468
|
replace(import_fs5.default.readFileSync(import_path7.default.join(configPath, "config.json"), "utf8"), {
|
|
75322
|
-
...
|
|
75469
|
+
...import_config9.env,
|
|
75323
75470
|
monthPrice: resource.env?.MONTH_PRICE || "5",
|
|
75324
75471
|
yearPrice: resource.env?.YEAR_PRICE || "30",
|
|
75325
75472
|
passport: resource.env?.PASSPORT_NAME || "discussionSubscriber"
|
|
@@ -75509,14 +75656,14 @@ async function initPaywallResources() {
|
|
|
75509
75656
|
}
|
|
75510
75657
|
}
|
|
75511
75658
|
}
|
|
75512
|
-
var import_fs5, import_path7, import_component19,
|
|
75659
|
+
var import_fs5, import_path7, import_component19, import_config9, import_util199;
|
|
75513
75660
|
var init_resource3 = __esm({
|
|
75514
75661
|
"../../blocklets/core/api/src/libs/resource.ts"() {
|
|
75515
75662
|
"use strict";
|
|
75516
75663
|
import_fs5 = __toESM(require("fs"));
|
|
75517
75664
|
import_path7 = __toESM(require("path"));
|
|
75518
75665
|
import_component19 = require("@blocklet/sdk/lib/component");
|
|
75519
|
-
|
|
75666
|
+
import_config9 = require("@blocklet/sdk/lib/config");
|
|
75520
75667
|
import_util199 = require("@ocap/util");
|
|
75521
75668
|
init_passport();
|
|
75522
75669
|
init_locales();
|
|
@@ -75533,15 +75680,15 @@ __export(resource_exports2, {
|
|
|
75533
75680
|
initResourceHandler: () => initResourceHandler
|
|
75534
75681
|
});
|
|
75535
75682
|
function initResourceHandler() {
|
|
75536
|
-
|
|
75537
|
-
|
|
75538
|
-
|
|
75683
|
+
import_config10.events.on(import_config10.Events.componentAdded, handlePaywallResources);
|
|
75684
|
+
import_config10.events.on(import_config10.Events.componentStarted, handlePaywallResources);
|
|
75685
|
+
import_config10.events.on(import_config10.Events.envUpdate, handlePaywallResources);
|
|
75539
75686
|
}
|
|
75540
|
-
var
|
|
75687
|
+
var import_config10, handlePaywallResources;
|
|
75541
75688
|
var init_resource4 = __esm({
|
|
75542
75689
|
"../../blocklets/core/api/src/integrations/blocklet/resource.ts"() {
|
|
75543
75690
|
"use strict";
|
|
75544
|
-
|
|
75691
|
+
import_config10 = require("@blocklet/sdk/lib/config");
|
|
75545
75692
|
init_logger();
|
|
75546
75693
|
init_resource3();
|
|
75547
75694
|
handlePaywallResources = () => {
|
|
@@ -76621,6 +76768,9 @@ var init_discount_status = __esm({
|
|
|
76621
76768
|
});
|
|
76622
76769
|
|
|
76623
76770
|
// ../../blocklets/core/api/src/middlewares/hono/csrf.ts
|
|
76771
|
+
function csrfSecret() {
|
|
76772
|
+
return readConfig("PAYMENT_CSRF_SECRET") || (0, import_csrf.getCsrfSecret)();
|
|
76773
|
+
}
|
|
76624
76774
|
function csrf() {
|
|
76625
76775
|
return async (c, next) => {
|
|
76626
76776
|
const method = c.req.method.toUpperCase();
|
|
@@ -76628,7 +76778,7 @@ function csrf() {
|
|
|
76628
76778
|
const existingCsrf = (0, import_cookie.getCookie)(c, "x-csrf-token");
|
|
76629
76779
|
if (method === "GET") {
|
|
76630
76780
|
if (loginToken) {
|
|
76631
|
-
const newCsrf = (0, import_csrf.sign)((
|
|
76781
|
+
const newCsrf = (0, import_csrf.sign)(csrfSecret(), loginToken);
|
|
76632
76782
|
if (newCsrf !== existingCsrf) {
|
|
76633
76783
|
(0, import_cookie.setCookie)(c, "x-csrf-token", newCsrf, { sameSite: "Strict", secure: true });
|
|
76634
76784
|
}
|
|
@@ -76639,9 +76789,9 @@ function csrf() {
|
|
|
76639
76789
|
if (c.req.path.includes("/mcp")) return next();
|
|
76640
76790
|
if (isEmpty9(loginToken)) return next();
|
|
76641
76791
|
if (isEmpty9(existingCsrf)) return next();
|
|
76642
|
-
if ((0,
|
|
76792
|
+
if ((0, import_wallet8.isDidWalletConnect)(c.req.header())) return next();
|
|
76643
76793
|
const headerCsrf = c.req.header("x-csrf-token");
|
|
76644
|
-
if (existingCsrf === headerCsrf && (0, import_csrf.verify)((
|
|
76794
|
+
if (existingCsrf === headerCsrf && (0, import_csrf.verify)(csrfSecret(), existingCsrf, loginToken)) {
|
|
76645
76795
|
return next();
|
|
76646
76796
|
}
|
|
76647
76797
|
return c.text("Invalid request: csrf token mismatch, please refresh the page try again", 403);
|
|
@@ -76649,13 +76799,14 @@ function csrf() {
|
|
|
76649
76799
|
return next();
|
|
76650
76800
|
};
|
|
76651
76801
|
}
|
|
76652
|
-
var import_cookie, import_csrf,
|
|
76802
|
+
var import_cookie, import_csrf, import_wallet8, isEmpty9, MUTATING;
|
|
76653
76803
|
var init_csrf = __esm({
|
|
76654
76804
|
"../../blocklets/core/api/src/middlewares/hono/csrf.ts"() {
|
|
76655
76805
|
"use strict";
|
|
76656
76806
|
import_cookie = require("hono/cookie");
|
|
76657
76807
|
import_csrf = require("@blocklet/sdk/lib/util/csrf");
|
|
76658
|
-
|
|
76808
|
+
import_wallet8 = require("@blocklet/sdk/lib/util/wallet");
|
|
76809
|
+
init_env();
|
|
76659
76810
|
isEmpty9 = (v) => v === void 0 || v === null || v === "";
|
|
76660
76811
|
MUTATING = ["POST", "PUT", "PATCH", "DELETE"];
|
|
76661
76812
|
}
|
|
@@ -76680,8 +76831,8 @@ function cdn() {
|
|
|
76680
76831
|
let transformer;
|
|
76681
76832
|
return async (c, next) => {
|
|
76682
76833
|
await next();
|
|
76683
|
-
const assetHost =
|
|
76684
|
-
const did =
|
|
76834
|
+
const assetHost = import_config11.env.assetCdnHost;
|
|
76835
|
+
const did = import_config11.env.componentDid;
|
|
76685
76836
|
if (!assetHost || !did) return;
|
|
76686
76837
|
if (!shouldProcess(c.req.method.toUpperCase(), c.req.path, c.req.header("accept") || "")) return;
|
|
76687
76838
|
const contentType = c.res.headers.get("content-type") || "";
|
|
@@ -76694,12 +76845,12 @@ function cdn() {
|
|
|
76694
76845
|
c.res = rebuilt;
|
|
76695
76846
|
};
|
|
76696
76847
|
}
|
|
76697
|
-
var import_asset_host_transformer,
|
|
76848
|
+
var import_asset_host_transformer, import_config11, import_constant2, import_constant3;
|
|
76698
76849
|
var init_cdn = __esm({
|
|
76699
76850
|
"../../blocklets/core/api/src/middlewares/hono/cdn.ts"() {
|
|
76700
76851
|
"use strict";
|
|
76701
76852
|
import_asset_host_transformer = require("@blocklet/sdk/lib/util/asset-host-transformer");
|
|
76702
|
-
|
|
76853
|
+
import_config11 = require("@blocklet/sdk/lib/config");
|
|
76703
76854
|
import_constant2 = require("@abtnode/constant");
|
|
76704
76855
|
import_constant3 = require("@blocklet/constant");
|
|
76705
76856
|
init_env();
|
|
@@ -76745,6 +76896,7 @@ function contextMiddleware() {
|
|
|
76745
76896
|
throw err;
|
|
76746
76897
|
}
|
|
76747
76898
|
return context.run({ requestId, requestedBy, instanceDid }, async () => {
|
|
76899
|
+
await warmTenantIdentity(instanceDid);
|
|
76748
76900
|
await next();
|
|
76749
76901
|
});
|
|
76750
76902
|
};
|
|
@@ -76758,6 +76910,7 @@ var init_context2 = __esm({
|
|
|
76758
76910
|
init_context();
|
|
76759
76911
|
init_tenant();
|
|
76760
76912
|
init_identity();
|
|
76913
|
+
init_tenant_identity();
|
|
76761
76914
|
}
|
|
76762
76915
|
});
|
|
76763
76916
|
|
|
@@ -76872,10 +77025,17 @@ function connectHandlerModules() {
|
|
|
76872
77025
|
function buildConnectRoutesHono() {
|
|
76873
77026
|
const { handlers: handlers2 } = (init_auth(), __toCommonJS(auth_exports));
|
|
76874
77027
|
const connectApp = new import_hono42.Hono();
|
|
77028
|
+
connectApp.use("*", async (c, next) => {
|
|
77029
|
+
const { context: requestCtx } = (init_context(), __toCommonJS(context_exports));
|
|
77030
|
+
if (requestCtx.peekInstanceDid()) return next();
|
|
77031
|
+
const { resolveTenantForHost: resolveTenantForHost2 } = (init_identity(), __toCommonJS(identity_exports));
|
|
77032
|
+
const instanceDid = await resolveTenantForHost2(c.req.header("host"));
|
|
77033
|
+
return requestCtx.withTenant(instanceDid, () => next());
|
|
77034
|
+
});
|
|
76875
77035
|
for (const h of connectHandlerModules()) handlers2.attach(Object.assign({ app: connectApp }, h));
|
|
76876
77036
|
return connectApp;
|
|
76877
77037
|
}
|
|
76878
|
-
function buildHonoApp(configureNative, getConnectApp) {
|
|
77038
|
+
function buildHonoApp(configureNative, getConnectApp, attachStatic) {
|
|
76879
77039
|
const app42 = new import_hono42.Hono();
|
|
76880
77040
|
app42.onError((err, c) => {
|
|
76881
77041
|
logger_default.error("handle router error", err);
|
|
@@ -76891,14 +77051,7 @@ function buildHonoApp(configureNative, getConnectApp) {
|
|
|
76891
77051
|
if (getConnectApp) {
|
|
76892
77052
|
app42.route("/", getConnectApp());
|
|
76893
77053
|
}
|
|
76894
|
-
|
|
76895
|
-
const { serveStatic } = require("@hono/node-server/serve-static");
|
|
76896
|
-
const { fallback: fallback2 } = (init_fallback(), __toCommonJS(fallback_exports));
|
|
76897
|
-
const staticDir = import_path8.default.resolve(blockletAppDir(), "dist");
|
|
76898
|
-
const staticRoot = import_path8.default.relative(process.cwd(), staticDir) || ".";
|
|
76899
|
-
app42.use("*", fallback2("index.html", { root: staticDir }));
|
|
76900
|
-
app42.use("*", serveStatic({ root: staticRoot }));
|
|
76901
|
-
}
|
|
77054
|
+
attachStatic?.(app42);
|
|
76902
77055
|
return app42;
|
|
76903
77056
|
}
|
|
76904
77057
|
function requireTenant() {
|
|
@@ -76960,6 +77113,65 @@ async function bootstrapTenant(instanceDid) {
|
|
|
76960
77113
|
);
|
|
76961
77114
|
});
|
|
76962
77115
|
}
|
|
77116
|
+
async function provisionTenant(instanceDid) {
|
|
77117
|
+
if (!instanceDid || typeof instanceDid !== "string") {
|
|
77118
|
+
throw new TenantError(TENANT_CONTEXT_MISSING, "provisionTenant requires an instanceDid");
|
|
77119
|
+
}
|
|
77120
|
+
const { fromTokenToUnit: fromTokenToUnit31 } = require("@ocap/util");
|
|
77121
|
+
const { PaymentMethod: PaymentMethod3, PaymentCurrency: PaymentCurrency3 } = (init_models(), __toCommonJS(models_exports));
|
|
77122
|
+
const CHAINS = [
|
|
77123
|
+
{ chainId: "main", livemode: true, symbol: "ABT", label: "ArcBlock Main", contract: "z35nNRvYxBoHitx9yZ5ATS88psfShzPPBLxYD" },
|
|
77124
|
+
{ chainId: "beta", livemode: false, symbol: "TBA", label: "ArcBlock Beta", contract: "z35n6UoHSi9MED4uaQy6ozFgKPaZj2UKrurBG" }
|
|
77125
|
+
];
|
|
77126
|
+
await context.withTenant(instanceDid, async () => {
|
|
77127
|
+
const existing = await PaymentMethod3.findOne({ where: { type: "arcblock" } });
|
|
77128
|
+
if (existing) return;
|
|
77129
|
+
for (const chain of CHAINS) {
|
|
77130
|
+
const logo = "/methods/arcblock.png";
|
|
77131
|
+
const method = await PaymentMethod3.create({
|
|
77132
|
+
instance_did: instanceDid,
|
|
77133
|
+
active: true,
|
|
77134
|
+
livemode: chain.livemode,
|
|
77135
|
+
locked: true,
|
|
77136
|
+
type: "arcblock",
|
|
77137
|
+
name: chain.label,
|
|
77138
|
+
description: `Process payments with tokens on ArcBlock ${chain.chainId} chain`,
|
|
77139
|
+
logo,
|
|
77140
|
+
confirmation: { type: "immediate" },
|
|
77141
|
+
settings: {
|
|
77142
|
+
arcblock: {
|
|
77143
|
+
chain_id: chain.chainId,
|
|
77144
|
+
api_host: `https://${chain.chainId}.abtnetwork.io/api/`,
|
|
77145
|
+
explorer_host: `https://${chain.chainId}.abtnetwork.io/explorer/`
|
|
77146
|
+
}
|
|
77147
|
+
},
|
|
77148
|
+
features: { recurring: true, refund: true, dispute: false },
|
|
77149
|
+
metadata: {}
|
|
77150
|
+
});
|
|
77151
|
+
const currency = await PaymentCurrency3.create({
|
|
77152
|
+
instance_did: instanceDid,
|
|
77153
|
+
active: true,
|
|
77154
|
+
livemode: chain.livemode,
|
|
77155
|
+
locked: true,
|
|
77156
|
+
is_base_currency: true,
|
|
77157
|
+
payment_method_id: method.id,
|
|
77158
|
+
type: "standard",
|
|
77159
|
+
name: chain.symbol,
|
|
77160
|
+
description: chain.symbol,
|
|
77161
|
+
logo,
|
|
77162
|
+
symbol: chain.symbol,
|
|
77163
|
+
decimal: 18,
|
|
77164
|
+
minimum_payment_amount: fromTokenToUnit31(0.1, 18).toString(),
|
|
77165
|
+
maximum_precision: 6,
|
|
77166
|
+
maximum_payment_amount: fromTokenToUnit31(1e8, 18).toString(),
|
|
77167
|
+
contract: chain.contract,
|
|
77168
|
+
metadata: {}
|
|
77169
|
+
});
|
|
77170
|
+
await method.update({ default_currency_id: currency.id });
|
|
77171
|
+
}
|
|
77172
|
+
logger_default.info("provisionTenant: seeded arcblock payment methods + currencies", { instanceDid });
|
|
77173
|
+
});
|
|
77174
|
+
}
|
|
76963
77175
|
async function startBackgroundServices() {
|
|
76964
77176
|
if (servicesStarted) {
|
|
76965
77177
|
logger_default.info("payment core background services already started, skipping");
|
|
@@ -77059,6 +77271,8 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77059
77271
|
throw new MissingConfigError("BLOCKLET_APP_PID");
|
|
77060
77272
|
}
|
|
77061
77273
|
const { initialize: initialize2 } = (init_models(), __toCommonJS(models_exports));
|
|
77274
|
+
const { setDefaultSequelize: setDefaultSequelize2 } = (init_sequelize(), __toCommonJS(sequelize_exports));
|
|
77275
|
+
setDefaultSequelize2(slots.db.sequelize);
|
|
77062
77276
|
initialize2(slots.db.sequelize);
|
|
77063
77277
|
if (slots.locks) {
|
|
77064
77278
|
const { setLocksDriver: setLocksDriver2 } = (init_lock(), __toCommonJS(lock_exports));
|
|
@@ -77068,6 +77282,11 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77068
77282
|
if (slots.queue) setQueueHostHooks3(slots.queue);
|
|
77069
77283
|
if (slots.cron) setCronDriver3(slots.cron);
|
|
77070
77284
|
if (slots.secrets) setSecretsDriver3(slots.secrets);
|
|
77285
|
+
if (slots.didConnectRuntime || slots.storage) {
|
|
77286
|
+
const { setDidConnectRuntime: setDidConnectRuntime2, setDidConnectTokenStorage: setDidConnectTokenStorage2 } = (init_auth(), __toCommonJS(auth_exports));
|
|
77287
|
+
if (slots.didConnectRuntime) setDidConnectRuntime2(slots.didConnectRuntime);
|
|
77288
|
+
if (slots.storage) setDidConnectTokenStorage2(slots.storage);
|
|
77289
|
+
}
|
|
77071
77290
|
if (slots.identity) setIdentityDriver3(slots.identity);
|
|
77072
77291
|
if (slots.tenancy && slots.tenancy.mode === "single" && slots.tenancy.instanceDid) {
|
|
77073
77292
|
const { setDefaultInstanceDid: setDefaultInstanceDid2 } = (init_tenant(), __toCommonJS(tenant_exports));
|
|
@@ -77086,10 +77305,15 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77086
77305
|
const getHonoApp = memo(() => {
|
|
77087
77306
|
const { configureNativePipeline: configureNativePipeline2, fullPipeline: fullPipeline2 } = (init_pipeline(), __toCommonJS(pipeline_exports));
|
|
77088
77307
|
const { mountMigratedResources: mountMigratedResources2 } = (init_hono(), __toCommonJS(hono_exports));
|
|
77089
|
-
return buildHonoApp(
|
|
77090
|
-
|
|
77091
|
-
|
|
77092
|
-
|
|
77308
|
+
return buildHonoApp(
|
|
77309
|
+
(native) => {
|
|
77310
|
+
configureNativePipeline2(native);
|
|
77311
|
+
mountMigratedResources2(native, { appShell: fullPipeline2() });
|
|
77312
|
+
},
|
|
77313
|
+
getConnectRoutesHono,
|
|
77314
|
+
// S3-CF Phase 1 ①: host-provided static/SPA shell (node injects it; CF omits).
|
|
77315
|
+
slots.staticHandler
|
|
77316
|
+
);
|
|
77093
77317
|
});
|
|
77094
77318
|
let fetchHandler = null;
|
|
77095
77319
|
const getFetchHandler = () => {
|
|
@@ -77130,14 +77354,14 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77130
77354
|
},
|
|
77131
77355
|
rpc,
|
|
77132
77356
|
lifecycle,
|
|
77133
|
-
bootstrapTenant
|
|
77357
|
+
bootstrapTenant,
|
|
77358
|
+
provisionTenant
|
|
77134
77359
|
};
|
|
77135
77360
|
}
|
|
77136
|
-
var
|
|
77361
|
+
var import_error12, import_hono42, PaymentCoreSlotError, MissingConfigError, TenancySlotError, VALID_TENANT_MODES, servicesStarted, listInstanceDidsHook;
|
|
77137
77362
|
var init_service2 = __esm({
|
|
77138
77363
|
"../../blocklets/core/api/src/service.ts"() {
|
|
77139
77364
|
"use strict";
|
|
77140
|
-
import_path8 = __toESM(require("path"));
|
|
77141
77365
|
import_error12 = require("@blocklet/error");
|
|
77142
77366
|
import_hono42 = require("hono");
|
|
77143
77367
|
init_env();
|
|
@@ -77187,6 +77411,7 @@ __export(src_exports, {
|
|
|
77187
77411
|
createKeyringSecretsDriver: () => createKeyringSecretsDriver2,
|
|
77188
77412
|
createMemoryLocksDriver: () => createMemoryLocksDriver2,
|
|
77189
77413
|
createNodeDbDriver: () => createNodeDbDriver2,
|
|
77414
|
+
createNodeStaticHandler: () => createNodeStaticHandler2,
|
|
77190
77415
|
getCronDriver: () => getCronDriver2,
|
|
77191
77416
|
getIdentityDriver: () => getIdentityDriver2,
|
|
77192
77417
|
getPaymentCoreSqlMigrations: () => getPaymentCoreSqlMigrations,
|
|
@@ -77282,6 +77507,10 @@ function shouldRunInWindow2(expr, date) {
|
|
|
77282
77507
|
}
|
|
77283
77508
|
|
|
77284
77509
|
// src/index.ts
|
|
77510
|
+
function createNodeStaticHandler2(webRoot) {
|
|
77511
|
+
const mod = (init_serve_static_arc(), __toCommonJS(serve_static_arc_exports));
|
|
77512
|
+
return mod.createNodeStaticHandler(webRoot);
|
|
77513
|
+
}
|
|
77285
77514
|
function createEmbeddedPaymentService2(slots) {
|
|
77286
77515
|
const core = (init_service2(), __toCommonJS(service_exports));
|
|
77287
77516
|
return core.createEmbeddedPaymentService(slots);
|
|
@@ -77300,6 +77529,7 @@ function createEmbeddedPaymentService2(slots) {
|
|
|
77300
77529
|
createKeyringSecretsDriver,
|
|
77301
77530
|
createMemoryLocksDriver,
|
|
77302
77531
|
createNodeDbDriver,
|
|
77532
|
+
createNodeStaticHandler,
|
|
77303
77533
|
getCronDriver,
|
|
77304
77534
|
getIdentityDriver,
|
|
77305
77535
|
getPaymentCoreSqlMigrations,
|