@xano/sdk 1.0.19 → 1.0.21
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/CHANGELOG.md +28 -0
- package/README.md +5 -2
- package/dist/{agent-file-refresh-5IP25UYO.js → agent-file-refresh-5R5ALFEV.js} +13 -11
- package/dist/{agent-skill-command-BPM4S6C7.js → agent-skill-command-JBX7Z6AK.js} +49 -47
- package/dist/ai-models-command-I3FU6GYP.js +270 -0
- package/dist/{answer-shape-ZRQS7ZC4.js → answer-shape-BCGPH73R.js} +5 -5
- package/dist/{backend-dir-RLILKCMR.js → backend-dir-VOMHDVFP.js} +16 -14
- package/dist/{backend-slot-7BATLL3X.js → backend-slot-WSWAHL2W.js} +3 -3
- package/dist/bin.js +55 -51
- package/dist/{branch-SJKKUCMZ.js → branch-6DBHVVUT.js} +11 -11
- package/dist/{branch-commands-5HKCBRLN.js → branch-commands-JOSHDOXH.js} +29 -28
- package/dist/bundle.js +3 -3
- package/dist/chunk-37BT62SX.js +17 -0
- package/dist/{chunk-2IC3K22K.js → chunk-3HK7VELD.js} +2 -2
- package/dist/{chunk-ZYZ7GRX3.js → chunk-4DVP42ZC.js} +2 -2
- package/dist/{chunk-ROWYW3JF.js → chunk-4QRDNBPY.js} +2 -2
- package/dist/{chunk-KG3RDXN5.js → chunk-4TVHSC4V.js} +4 -4
- package/dist/{chunk-SINL5WMI.js → chunk-4Y3SWNPE.js} +2 -2
- package/dist/{chunk-6SEPZQYB.js → chunk-4ZV4MDKP.js} +2 -2
- package/dist/{chunk-IFHFJR5O.js → chunk-5ABAIJVV.js} +6 -6
- package/dist/chunk-5KSVMHFS.js +81 -0
- package/dist/{chunk-MOVRSULZ.js → chunk-5Z4WQQHC.js} +2 -2
- package/dist/{chunk-K23RUXSH.js → chunk-64F6ET45.js} +44 -16
- package/dist/{chunk-ZHFSIQ6E.js → chunk-6534P3VH.js} +25 -2
- package/dist/{chunk-Q6AKSLD2.js → chunk-6L32HAIP.js} +2 -2
- package/dist/chunk-6SXKKDGF.js +9 -0
- package/dist/{chunk-OTQF4B37.js → chunk-6TAYTKFM.js} +4 -4
- package/dist/{chunk-7UQZ7C4W.js → chunk-745NOWB7.js} +6 -6
- package/dist/{chunk-XAE4NIZ2.js → chunk-7J7YRAZB.js} +4 -4
- package/dist/{chunk-E34VGSCI.js → chunk-7LLVSTXY.js} +9 -1
- package/dist/{chunk-2HBJU76D.js → chunk-7SGMHGLI.js} +40 -22
- package/dist/{chunk-OTYK2V44.js → chunk-ANCNHQCH.js} +24 -24
- package/dist/{chunk-AICWDCLJ.js → chunk-BBFHZMQA.js} +2 -2
- package/dist/{chunk-54CJ74BH.js → chunk-C7KO5KKB.js} +4 -4
- package/dist/{chunk-V2MIBJZU.js → chunk-CGLYG2VF.js} +2 -2
- package/dist/{chunk-Z73I7Q2H.js → chunk-CJ5WRCVE.js} +80 -2
- package/dist/{chunk-WGKKDGSA.js → chunk-DAXFWXSV.js} +8 -8
- package/dist/{chunk-MSYMEP7Y.js → chunk-DJ7JH4UE.js} +7 -7
- package/dist/{chunk-XDGLYIB2.js → chunk-DORGB2Y2.js} +2 -2
- package/dist/{chunk-GA6HTO3O.js → chunk-EBSJUSID.js} +2 -2
- package/dist/{chunk-O2BLNQEC.js → chunk-EME5G4YP.js} +2 -2
- package/dist/{chunk-RVWWNNZQ.js → chunk-EOWNLLLV.js} +4 -4
- package/dist/{chunk-QIT2GGNB.js → chunk-EPD5J3WA.js} +2 -2
- package/dist/{chunk-WDWIXCGB.js → chunk-FJS5I6V4.js} +4 -4
- package/dist/{chunk-DO5VZIY4.js → chunk-FLM6TN7Q.js} +3 -3
- package/dist/{chunk-GT7PZCTK.js → chunk-FVBJKM6N.js} +3 -3
- package/dist/{chunk-F3IA3YWI.js → chunk-FVZ5C3PF.js} +22 -2
- package/dist/{chunk-PLOBHRGV.js → chunk-GODAKJ3L.js} +49 -49
- package/dist/{chunk-RKTVXFBV.js → chunk-GUHJV7C5.js} +31 -3
- package/dist/{chunk-B6ZHSM2D.js → chunk-HXVNBJVA.js} +73 -73
- package/dist/{chunk-G2XSDIYS.js → chunk-I52AKG2O.js} +4 -4
- package/dist/{chunk-VCFRALU7.js → chunk-I5YD7QPI.js} +28 -11
- package/dist/{chunk-ASUDP4OS.js → chunk-IA4FMPJ3.js} +8 -8
- package/dist/{chunk-YYBBJPCL.js → chunk-IUBGFCJJ.js} +14 -18
- package/dist/{chunk-L4L6YITX.js → chunk-IWFKPEWJ.js} +13 -10
- package/dist/{chunk-YP4QTC4F.js → chunk-J564PMKW.js} +6 -6
- package/dist/{chunk-AJPICYPW.js → chunk-JVMAWMO3.js} +113 -94
- package/dist/{chunk-UH5VQGNR.js → chunk-JXX2QXPP.js} +2 -2
- package/dist/{chunk-2DUYJR5N.js → chunk-KHX6VQ4M.js} +2 -2
- package/dist/{chunk-LRN6QX44.js → chunk-KL4PGJ2G.js} +3 -3
- package/dist/{chunk-BCN6OZLF.js → chunk-KU4HLYWT.js} +3 -3
- package/dist/{chunk-WGGATSIP.js → chunk-LMX4VE4H.js} +2 -2
- package/dist/{chunk-YT5UN2F4.js → chunk-LYR6W5LV.js} +14 -14
- package/dist/{chunk-DXUICABI.js → chunk-LZDH5COS.js} +21 -2
- package/dist/{chunk-2NUOFHPX.js → chunk-M42Y53Z4.js} +7 -7
- package/dist/{chunk-E5M5P23K.js → chunk-M5GXZEX7.js} +21 -215
- package/dist/{chunk-Q4LJCCH5.js → chunk-MGC5S6OE.js} +75 -9
- package/dist/{chunk-KVF7YQ2W.js → chunk-MJA5BP2M.js} +9 -9
- package/dist/{chunk-5Y5HWQ2P.js → chunk-MKRREVNB.js} +4 -4
- package/dist/{chunk-JORPZKBE.js → chunk-N2JZU6VR.js} +3 -3
- package/dist/{chunk-QK2WIASY.js → chunk-N3LPULRE.js} +7 -7
- package/dist/chunk-OF5YFPSK.js +278 -0
- package/dist/{chunk-D4N72H35.js → chunk-OFKFZSHS.js} +9 -9
- package/dist/{chunk-64UVVLDT.js → chunk-OG6WYZNA.js} +7 -7
- package/dist/{chunk-AJBOGO5U.js → chunk-OQMXCNN7.js} +59 -31
- package/dist/{chunk-EPB6FAR5.js → chunk-OSMPI45P.js} +3 -3
- package/dist/{chunk-QETVFGD7.js → chunk-OTUPQ7M3.js} +16 -16
- package/dist/{chunk-Q45RTKWW.js → chunk-OZVZ3KCH.js} +6 -6
- package/dist/{chunk-3X4B5GWY.js → chunk-P3WIMLG2.js} +3 -3
- package/dist/{chunk-JUCL5MUZ.js → chunk-PAWLPNBA.js} +8 -8
- package/dist/{chunk-GJZMKMWO.js → chunk-PC7XEO7F.js} +2 -2
- package/dist/{chunk-MF4W6FHU.js → chunk-Q4R2ABFL.js} +1 -1
- package/dist/{chunk-BT6CJNEO.js → chunk-Q77C32ZB.js} +4 -4
- package/dist/chunk-QHNSBURP.js +264 -0
- package/dist/{chunk-HUGNB6UN.js → chunk-QLXGLHK3.js} +71 -49
- package/dist/{chunk-NH5Z2NOD.js → chunk-QZ2PC6B7.js} +3 -3
- package/dist/{chunk-GTB7JL3M.js → chunk-QZXSPUNS.js} +6 -6
- package/dist/{chunk-LCOCRJ4K.js → chunk-RQGSZ7AR.js} +16 -2
- package/dist/{chunk-WLZSKD7E.js → chunk-SQVETROU.js} +3 -3
- package/dist/{chunk-554FJWNH.js → chunk-T2LFOMOP.js} +4 -4
- package/dist/{chunk-4HMF5TRB.js → chunk-T4HTNHXR.js} +8 -8
- package/dist/{chunk-FRJB3NTE.js → chunk-T6KQYCAU.js} +3 -3
- package/dist/{chunk-YYDM4DNP.js → chunk-TDSRZDQP.js} +2 -2
- package/dist/{chunk-RKNCISPM.js → chunk-VEA6EXJL.js} +3 -3
- package/dist/{chunk-KYQRIL4V.js → chunk-VJCUFHTQ.js} +26 -26
- package/dist/{chunk-6FCAFWD5.js → chunk-VO62TKK5.js} +3 -77
- package/dist/{chunk-3FNEHRJF.js → chunk-VV7FVGOX.js} +8 -8
- package/dist/{chunk-HM5X73PY.js → chunk-WK5QDV25.js} +2 -2
- package/dist/{chunk-5JUWB6XL.js → chunk-WXY24GKO.js} +7 -7
- package/dist/{chunk-XKHQLKUL.js → chunk-X7EK5PTK.js} +3 -3
- package/dist/{chunk-CO7US54H.js → chunk-X7IBJLAD.js} +2 -2
- package/dist/{chunk-E7VF2JVJ.js → chunk-XD5FOBMZ.js} +10 -10
- package/dist/{chunk-PKBC7G5H.js → chunk-XDIPEWLU.js} +25 -1
- package/dist/{chunk-NYIFU3BR.js → chunk-XWEDFVJ6.js} +21 -19
- package/dist/{chunk-OJ6YGRPV.js → chunk-YAZEB255.js} +3 -3
- package/dist/{chunk-UJ5HLRYH.js → chunk-YF7PDN6T.js} +35 -35
- package/dist/{chunk-RGPHFHJU.js → chunk-YFVD3LNL.js} +2 -2
- package/dist/{chunk-35SI4GBM.js → chunk-YSSAJQH4.js} +3 -3
- package/dist/{chunk-UQNDODRU.js → chunk-Z7IINILG.js} +5 -5
- package/dist/{chunk-PRSNMSVG.js → chunk-ZCXWOGFL.js} +3 -3
- package/dist/{chunk-5AHHO2QA.js → chunk-ZNGUETV7.js} +163 -97
- package/dist/cli.d.ts +10 -1
- package/dist/cli.js +48 -46
- package/dist/{codegen-command-OF3TPC66.js → codegen-command-ZXABRPVP.js} +68 -66
- package/dist/{commands-Z2QZOORB.js → commands-EN4RLPOP.js} +2 -2
- package/dist/{completion-LFXXNQGR.js → completion-KH45QD3E.js} +2 -2
- package/dist/{config-7GGINOFY.js → config-AKHBFTKA.js} +8 -8
- package/dist/{deploy-command-MGYR2TKC.js → deploy-command-KO5FATR6.js} +55 -53
- package/dist/{deploy-source-UHCHCI5Z.js → deploy-source-7GCMMZKV.js} +34 -33
- package/dist/{dev-env-sync-XWZVXEI2.js → dev-env-sync-LZ22CSKD.js} +51 -49
- package/dist/{display-name-hint-5GLJGPQ6.js → display-name-hint-QMT562BI.js} +13 -13
- package/dist/{emit-DlOKIJER.d.ts → emit-BfHifhJy.d.ts} +120 -7
- package/dist/{env-example-refresh-FACP4FQE.js → env-example-refresh-DWGV4DFX.js} +69 -67
- package/dist/{env-pull-command-SHK4TI6U.js → env-pull-command-5N5AUKJK.js} +52 -50
- package/dist/{env-target-ZQSPPN4A.js → env-target-CXZXMK3W.js} +13 -13
- package/dist/{env-var-command-Q2ZHKWAQ.js → env-var-command-4RGQALIH.js} +55 -54
- package/dist/{ephemeral-2DXWP3VK.js → ephemeral-MNHEWSZ6.js} +11 -11
- package/dist/{ephemeral-command-FKOSN56R.js → ephemeral-command-GIB63YX3.js} +64 -62
- package/dist/{ephemeral-state-56XEDUJW.js → ephemeral-state-QTT5JHD5.js} +11 -11
- package/dist/{generate-command-2JCMZ6CG.js → generate-command-GW42CN4I.js} +77 -75
- package/dist/{gitignore-Z5N6DEEV.js → gitignore-RDEUQHHG.js} +19 -17
- package/dist/{guards-LQ7PSXOL.js → guards-N4PUFKN5.js} +3 -2
- package/dist/{impersonate-command-R24VBFQA.js → impersonate-command-H72JM5IF.js} +44 -42
- package/dist/{import-VJQGIS33.js → import-7HFTOT7M.js} +5 -5
- package/dist/index.d.ts +142 -7
- package/dist/index.js +7 -6
- package/dist/{init-command-UOCNESZK.js → init-command-ERRMSKPB.js} +52 -50
- package/dist/{init-modules-5DYK7V4J.js → init-modules-UH7PPQTB.js} +11 -9
- package/dist/{init-web-25QJ4JWB.js → init-web-YCPD6BYN.js} +2 -2
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +169 -24
- package/dist/{keep-data-merge-HLIXZC77.js → keep-data-merge-BNX3HEHM.js} +32 -31
- package/dist/{landing-record-FYKDJIUF.js → landing-record-ZY4O7OLQ.js} +23 -21
- package/dist/{live-diff-YOFOJCFX.js → live-diff-GZ6JUNP6.js} +5 -4
- package/dist/local-engine-ai-YWAMTHME.js +47 -0
- package/dist/{local-engine-choice-4ZA2HZXH.js → local-engine-choice-PCM45R3A.js} +43 -36
- package/dist/local-engine-command-ACJ6YUP7.js +93 -0
- package/dist/{local-engine-config-6CB6FOEJ.js → local-engine-config-MVNWKHZ4.js} +15 -3
- package/dist/{local-engine-deploy-XAEDT55W.js → local-engine-deploy-IUHWB43Q.js} +21 -18
- package/dist/{local-engine-lookup-WBYTY2JE.js → local-engine-lookup-2VSUWEQY.js} +6 -6
- package/dist/{local-engine-mcp-bridge-3H5OXBWQ.js → local-engine-mcp-bridge-ECGTK7LF.js} +6 -6
- package/dist/{local-engine-mcp-command-SUAVS5UA.js → local-engine-mcp-command-EODMA3X5.js} +52 -44
- package/dist/{local-engine-process-35B2KQED.js → local-engine-process-P5T2766M.js} +19 -11
- package/dist/local-engine-release-OK6GKULS.js +40 -0
- package/dist/{local-engine-state-JZHTKHDG.js → local-engine-state-BOKHLNRQ.js} +4 -4
- package/dist/{local-engine-update-check-VXJZSIJU.js → local-engine-update-check-C72LSVUQ.js} +7 -7
- package/dist/{lock-commands-ZT6YTQYA.js → lock-commands-YBBTZB6M.js} +55 -53
- package/dist/{login-command-ONGJASKA.js → login-command-DJCCEN5O.js} +39 -32
- package/dist/{logout-command-PLYGFHBQ.js → logout-command-6FQLSD5H.js} +16 -16
- package/dist/{loop-CLLBQSJF.js → loop-EMTBWN4X.js} +5 -4
- package/dist/{marketplace-command-LNNAA7ZK.js → marketplace-command-2JZERTJW.js} +42 -40
- package/dist/{marketplace-resolve-63QWMQZU.js → marketplace-resolve-LT76KHJD.js} +9 -7
- package/dist/{meta-client-JND42QEJ.js → meta-client-KDTBLP6X.js} +15 -15
- package/dist/{module-manifest-NWJWAQLQ.js → module-manifest-B432UFBK.js} +3 -3
- package/dist/node.d.ts +5 -5
- package/dist/node.js +61 -59
- package/dist/{operation-outcome-U6IWKLBK.js → operation-outcome-POYID3M6.js} +26 -26
- package/dist/{output-target-QJSHZBVY.js → output-target-55RSDDTO.js} +20 -18
- package/dist/{plan-disclosure-XTAEE4BE.js → plan-disclosure-5HM7CMRW.js} +19 -18
- package/dist/{plugin-contributions-DD6R6RL6.js → plugin-contributions-MEXUR7TY.js} +4 -4
- package/dist/{plugin-prompt-UX2TT5NS.js → plugin-prompt-XM4ATAWA.js} +4 -4
- package/dist/{plugin-questions-WE2F4ZC4.js → plugin-questions-VGU3B4LE.js} +3 -3
- package/dist/{preflight-command-ZKUQSIL2.js → preflight-command-ZP7VVE5T.js} +60 -58
- package/dist/{profile-command-PJUA5ZMX.js → profile-command-EP7N7LNQ.js} +38 -36
- package/dist/{profile-pointer-RCPHVTJV.js → profile-pointer-DHOU26Q2.js} +5 -5
- package/dist/{profile-select-45G5VPJK.js → profile-select-ZANK43KE.js} +2 -2
- package/dist/project-config-SGRYMHBT.js +37 -0
- package/dist/{project-dependency-TPVV3YIX.js → project-dependency-WTH776QE.js} +10 -8
- package/dist/{project-sdk-DKZBK5H5.js → project-sdk-FYNY7RTO.js} +3 -3
- package/dist/promote-command-LX5UWQYG.js +150 -0
- package/dist/{prompt-OYQHQWKI.js → prompt-JVYQH4OR.js} +3 -3
- package/dist/{publish-command-JSYK6HOW.js → publish-command-DW5VLFJN.js} +65 -63
- package/dist/{pull-command-K5X367MA.js → pull-command-ZUDJRRXV.js} +71 -69
- package/dist/{pull-superseded-3SSM3JFT.js → pull-superseded-7EZ7M54I.js} +3 -3
- package/dist/{release-command-OC7MT4FV.js → release-command-Z3HXXLLO.js} +66 -64
- package/dist/{release-ns-command-EHNEAEDU.js → release-ns-command-JS3OUEFQ.js} +93 -91
- package/dist/{retry-command-WP4ZI6CJ.js → retry-command-HG4IFE65.js} +10 -10
- package/dist/{routes-manifest-file-A2PW7IQ7.js → routes-manifest-file-PIKQ3BIJ.js} +4 -4
- package/dist/{secrets-file-2RHMJFXQ.js → secrets-file-QLVCR2JD.js} +19 -17
- package/dist/{secrets-fill-command-HYMF6EZM.js → secrets-fill-command-BK7NVKPY.js} +52 -50
- package/dist/{seed-W5FNE6IB.js → seed-M33F4OJW.js} +3 -3
- package/dist/{source-resolve-PMA7SHZE.js → source-resolve-GGRHO6NW.js} +24 -24
- package/dist/{static-host-3HPZKVKK.js → static-host-HCKD26Q3.js} +5 -5
- package/dist/{status-command-CROHQRPI.js → status-command-3DISBMGH.js} +52 -51
- package/dist/{store-Dg9FLJkx.d.ts → store-Dt-5vOSe.d.ts} +149 -1
- package/dist/{store-B63BQV6R.js → store-ZWQFSXH5.js} +8 -8
- package/dist/{sync-baseline-LSGKNCKM.js → sync-baseline-XLRJQZCS.js} +7 -6
- package/dist/{sync-contributions-QDEWZ3IU.js → sync-contributions-GAV6PZEY.js} +17 -13
- package/dist/{sync-record-AWFCSS4D.js → sync-record-UFEJDNLR.js} +13 -13
- package/dist/{table-WJ7YDJ6Q.js → table-JHPGUJ2Z.js} +6 -6
- package/dist/{tables-command-BKVDHAGJ.js → tables-command-D7DSJAXI.js} +41 -40
- package/dist/{tenant-IXIW3FOI.js → tenant-SSWC7B3V.js} +12 -12
- package/dist/{tenant-command-Y7VCGDMY.js → tenant-command-6S5RU4PP.js} +96 -94
- package/dist/{test-command-2RAUNIU5.js → test-command-FSRARFF7.js} +44 -43
- package/dist/{tests-N4MMBABH.js → tests-ZFQWDWS2.js} +6 -6
- package/dist/{token-4I26OGWH.js → token-XTU3C2DI.js} +14 -12
- package/dist/{toolchain-hooks-IJWV3ZQS.js → toolchain-hooks-IRPM6LYL.js} +3 -3
- package/dist/{toolchain-modules-XM4JXHQC.js → toolchain-modules-YSM6DMDB.js} +9 -5
- package/dist/{toolchain-peers-EMOYN4U7.js → toolchain-peers-NOIM44ED.js} +11 -9
- package/dist/{tracked-backend-EZE6H3EZ.js → tracked-backend-7XW4KPIR.js} +39 -36
- package/dist/{update-check-QLB5DV3B.js → update-check-KKDYZG3X.js} +51 -49
- package/dist/{upgrade-command-4DCDBDB5.js → upgrade-command-LRJ7V3UW.js} +55 -53
- package/dist/{whoami-command-WI4VT3IN.js → whoami-command-FBRWLX5Q.js} +15 -15
- package/dist/{workspace-DIM3SBPV.js → workspace-DTM3ZNTM.js} +5 -5
- package/dist/{workspace-binding-43PBQEE4.js → workspace-binding-M7XSJIWC.js} +14 -14
- package/dist/{workspace-command-FWTHIFVI.js → workspace-command-3T6CT7UA.js} +96 -94
- package/dist/{workspace-env-5PJVWQ2O.js → workspace-env-RIKENQFC.js} +17 -15
- package/dist/{workspace-export-3KMWNZDD.js → workspace-export-A4L6272C.js} +5 -5
- package/dist/{writable-X7BCN7XE.js → writable-762DMPHW.js} +3 -3
- package/dist/{xano-RLSNDM7O.js → xano-XZN5SRDH.js} +4 -3
- package/dist/{xanosdk-import-VOJEAK5Q.js → xanosdk-import-L3ZZIT6I.js} +6 -6
- package/dist/{xanosdk-project-PV3ORVP5.js → xanosdk-project-YVLCGM3Y.js} +16 -14
- package/guides/cli.md +3 -0
- package/guides/coverage.md +4 -4
- package/llms/kinds-agent-mcp.md +3 -1
- package/llms/statements-ai.md +21 -0
- package/llms/statements-catalog.md +1 -8
- package/llms-full.txt +33 -15
- package/llms.txt +7 -6
- package/manifest.json +651 -3
- package/package.json +2 -38
- package/skills/xano-backend/SKILL.md +2 -2
- package/dist/.build-fingerprint +0 -1
- package/dist/local-engine-command-WQS4SD6N.js +0 -85
- package/dist/promote-command-NDYP66LD.js +0 -148
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ENV_WORKSPACE
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-64F6ET45.js";
|
|
4
4
|
import {
|
|
5
5
|
credentialFileOf
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4DVP42ZC.js";
|
|
7
7
|
import {
|
|
8
8
|
credentialFileFlag,
|
|
9
9
|
globalAuthFilePath,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
readProfile,
|
|
13
13
|
recordedCredentialPath,
|
|
14
14
|
sameOriginAs
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OQMXCNN7.js";
|
|
16
16
|
import {
|
|
17
17
|
readEnvVar
|
|
18
18
|
} from "./chunk-X2NL4KUO.js";
|
|
19
19
|
import {
|
|
20
20
|
CliError,
|
|
21
21
|
UsageError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6534P3VH.js";
|
|
23
23
|
import {
|
|
24
24
|
shellQuote
|
|
25
25
|
} from "./chunk-5ZSO4T2G.js";
|
|
@@ -65,7 +65,7 @@ async function readReachableWorkspaces(auth, timeoutMs = 3e4) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
async function whereaboutsOf(auth, name, kinds) {
|
|
68
|
-
const { listAllEphemeral } = await import("./ephemeral-
|
|
68
|
+
const { listAllEphemeral } = await import("./ephemeral-MNHEWSZ6.js");
|
|
69
69
|
const failures = [];
|
|
70
70
|
const reason = (err) => (err instanceof Error ? err.message : String(err)).split("\n")[0].replace(/[.:]$/, "");
|
|
71
71
|
const [all, ephemerals] = await Promise.all([
|
|
@@ -78,7 +78,7 @@ async function whereaboutsOf(auth, name, kinds) {
|
|
|
78
78
|
const listed = ephemerals?.some((r) => r.name === name) === true;
|
|
79
79
|
if (kinds === "ephemeral" && ephemerals !== void 0 && !listed) return { at: "nowhere" };
|
|
80
80
|
if (all === void 0) failures.push("the workspace list could not be read");
|
|
81
|
-
const { getTenant } = await import("./tenant-
|
|
81
|
+
const { getTenant } = await import("./tenant-SSWC7B3V.js");
|
|
82
82
|
const others = (all ?? []).filter((w) => w.id !== auth.workspaceId);
|
|
83
83
|
const found = await Promise.all(
|
|
84
84
|
others.map(
|
|
@@ -162,4 +162,4 @@ export {
|
|
|
162
162
|
rerunInWorkspace,
|
|
163
163
|
heldElsewhereError
|
|
164
164
|
};
|
|
165
|
-
//# sourceMappingURL=chunk-
|
|
165
|
+
//# sourceMappingURL=chunk-N3LPULRE.js.map
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readStoredProfileQuietly
|
|
3
|
+
} from "./chunk-64F6ET45.js";
|
|
4
|
+
import {
|
|
5
|
+
clampEngineAiTtl,
|
|
6
|
+
engineAiDir,
|
|
7
|
+
engineAiTokenPath,
|
|
8
|
+
machineIdPath
|
|
9
|
+
} from "./chunk-FVZ5C3PF.js";
|
|
10
|
+
import {
|
|
11
|
+
AI_SCOPE,
|
|
12
|
+
assertHttpsOrigin,
|
|
13
|
+
loginCommand
|
|
14
|
+
} from "./chunk-OQMXCNN7.js";
|
|
15
|
+
import {
|
|
16
|
+
registerSecret
|
|
17
|
+
} from "./chunk-4GPIOIAC.js";
|
|
18
|
+
import {
|
|
19
|
+
atomicWrite
|
|
20
|
+
} from "./chunk-LLNZGEFK.js";
|
|
21
|
+
import {
|
|
22
|
+
isRecord
|
|
23
|
+
} from "./chunk-4Y3SWNPE.js";
|
|
24
|
+
import {
|
|
25
|
+
serverMessage
|
|
26
|
+
} from "./chunk-QZ2PC6B7.js";
|
|
27
|
+
import {
|
|
28
|
+
hostLabel,
|
|
29
|
+
safeText
|
|
30
|
+
} from "./chunk-6534P3VH.js";
|
|
31
|
+
|
|
32
|
+
// src/deploy/local-engine-ai.ts
|
|
33
|
+
import { randomUUID } from "crypto";
|
|
34
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
35
|
+
import { dirname } from "path";
|
|
36
|
+
var ENGINE_TOKEN_ROUTE = "/api:meta/ai-credits/engine-token";
|
|
37
|
+
var REQUEST_TIMEOUT_MS = 15e3;
|
|
38
|
+
var DEFAULT_LIFETIME_S = 3600;
|
|
39
|
+
var defaultFetch = (url, init) => fetch(url, { ...init, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
|
|
40
|
+
var OFF = "Xano AI is off for this engine:";
|
|
41
|
+
var TRANSIENT = /* @__PURE__ */ new Set(["unreachable", "refresh-failed", "failed", "route-missing"]);
|
|
42
|
+
async function requestEngineAiCredential(req) {
|
|
43
|
+
const env = req.env ?? process.env;
|
|
44
|
+
const billing = req.billing;
|
|
45
|
+
const tokenFile = engineAiTokenPath(req.engineName, env);
|
|
46
|
+
const off = (reason, message, gatewayUrl) => {
|
|
47
|
+
let kept = "";
|
|
48
|
+
if (TRANSIENT.has(reason)) {
|
|
49
|
+
if (existsSync(tokenFile)) kept = " The earlier credential stays in use until it expires.";
|
|
50
|
+
} else {
|
|
51
|
+
removeTokenFile(tokenFile);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
status: "off",
|
|
55
|
+
billing,
|
|
56
|
+
reason,
|
|
57
|
+
message: `${OFF} ${message}${kept}`,
|
|
58
|
+
...gatewayUrl === void 0 ? {} : { gatewayUrl }
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const read = readStoredProfileQuietly(req.cwd ?? process.cwd());
|
|
62
|
+
if (read.kind === "unreadable") {
|
|
63
|
+
return off("profile-unreadable", `the stored sign-in could not be read (${firstLine(read.message)}).`);
|
|
64
|
+
}
|
|
65
|
+
if (read.kind === "none") {
|
|
66
|
+
return off("signed-out", "no Xano sign-in is stored. Run `xanosdk login` to turn it on.");
|
|
67
|
+
}
|
|
68
|
+
if (read.kind === "token") {
|
|
69
|
+
return off(
|
|
70
|
+
"not-oauth",
|
|
71
|
+
`profile "${safeText(read.profile)}" is a pasted meta API token, not an OAuth sign-in. Run \`${loginCommand(read.profile, { path: read.path }, ["--force"])}\` to sign in with \`xanosdk login\` and turn it on.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const { record, profile, path } = read;
|
|
75
|
+
const stored = record.ai_gateway_url;
|
|
76
|
+
const relogin = loginCommand(profile, { path, origin: record.auth_host }, ["--force"]);
|
|
77
|
+
if (!(record.scope ?? "").split(/\s+/).includes(AI_SCOPE)) {
|
|
78
|
+
return off(
|
|
79
|
+
"sign-in-again",
|
|
80
|
+
`profile "${safeText(profile)}" has a sign-in without Xano AI access. Run \`${relogin}\` to sign in again and turn it on.`,
|
|
81
|
+
stored
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
assertHttpsOrigin(record.auth_host, "auth_host");
|
|
86
|
+
} catch {
|
|
87
|
+
return off(
|
|
88
|
+
"sign-in-again",
|
|
89
|
+
`the sign-in server stored for profile "${safeText(profile)}" is not https. Run \`${relogin}\` to sign in again.`,
|
|
90
|
+
stored
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
let bearer;
|
|
94
|
+
try {
|
|
95
|
+
bearer = await read.bearer();
|
|
96
|
+
} catch {
|
|
97
|
+
return off(
|
|
98
|
+
"refresh-failed",
|
|
99
|
+
`the sign-in for profile "${safeText(profile)}" could not be refreshed. Deploy again to retry, or run \`${relogin}\` if it keeps happening.`,
|
|
100
|
+
stored
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
let machineId;
|
|
104
|
+
try {
|
|
105
|
+
machineId = readOrCreateMachineId(env);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
return off("failed", `this machine's id could not be read or made (${firstLine(err instanceof Error ? err.message : String(err))}).`, stored);
|
|
108
|
+
}
|
|
109
|
+
const host = record.auth_host.replace(/\/+$/, "");
|
|
110
|
+
let res;
|
|
111
|
+
let text;
|
|
112
|
+
try {
|
|
113
|
+
res = await (req.fetch ?? defaultFetch)(`${host}${ENGINE_TOKEN_ROUTE}`, {
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: {
|
|
116
|
+
Authorization: `Bearer ${bearer}`,
|
|
117
|
+
"Content-Type": "application/json",
|
|
118
|
+
Accept: "application/json"
|
|
119
|
+
},
|
|
120
|
+
body: JSON.stringify({
|
|
121
|
+
billing,
|
|
122
|
+
engine_name: req.engineName,
|
|
123
|
+
machine_id: machineId,
|
|
124
|
+
ttl: clampEngineAiTtl(req.ttl)
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
text = await res.text();
|
|
128
|
+
} catch {
|
|
129
|
+
return off("unreachable", `${hostLabel(host)} could not be reached for a credential. Deploy again to retry.`, stored);
|
|
130
|
+
}
|
|
131
|
+
if (res.ok) {
|
|
132
|
+
const body = parseObject(text);
|
|
133
|
+
const token = body?.["token"];
|
|
134
|
+
registerSecret(token);
|
|
135
|
+
if (typeof token !== "string" || token.trim() === "") {
|
|
136
|
+
const reason = answerMessage(body, text);
|
|
137
|
+
return off(
|
|
138
|
+
"unavailable",
|
|
139
|
+
`Xano AI is not available for ${hostLabel(record.instance)} right now${reason === void 0 ? "" : ` (${safeText(reason)})`}.`,
|
|
140
|
+
stored
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
const gatewayUrl = typeof body?.["ai_gateway_url"] === "string" && body["ai_gateway_url"] !== "" ? body["ai_gateway_url"] : stored;
|
|
144
|
+
try {
|
|
145
|
+
writeTokenFile(req.engineName, token.trim(), env);
|
|
146
|
+
} catch (err) {
|
|
147
|
+
return off("failed", `the credential could not be written (${firstLine(err instanceof Error ? err.message : String(err))}).`, gatewayUrl);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
status: "on",
|
|
151
|
+
billing: body?.["billing"] === "instance" || body?.["billing"] === "user" ? body["billing"] : billing,
|
|
152
|
+
expiresAt: expiryOf(body?.["expires_at"], body?.["expires_in"]),
|
|
153
|
+
...gatewayUrl === void 0 ? {} : { gatewayUrl },
|
|
154
|
+
profile,
|
|
155
|
+
instance: record.instance
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
const said = answerMessage(parseObject(text), text);
|
|
159
|
+
const because = said === void 0 ? "" : ` (${safeText(said)})`;
|
|
160
|
+
if ((res.status === 404 || res.status === 500) && said !== void 0 && /instance access denied or not found/i.test(said)) {
|
|
161
|
+
return off(
|
|
162
|
+
"refused",
|
|
163
|
+
`profile "${safeText(profile)}" has no access to ${hostLabel(record.instance)}${because}. Run \`${relogin}\` to sign in to an instance you can use.`,
|
|
164
|
+
stored
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
switch (res.status) {
|
|
168
|
+
case 404:
|
|
169
|
+
return off("route-missing", `${hostLabel(host)} does not issue Xano Engine credentials yet. Deploy again later.`, stored);
|
|
170
|
+
case 409:
|
|
171
|
+
return off("unavailable", `Xano AI is not available for ${hostLabel(record.instance)} right now${because}.`, stored);
|
|
172
|
+
case 402:
|
|
173
|
+
return off(
|
|
174
|
+
"no-credits",
|
|
175
|
+
`${billing === "instance" ? "the instance owner has" : "you have"} no Xano AI credits left${because}. Add credits, then deploy again.`,
|
|
176
|
+
stored
|
|
177
|
+
);
|
|
178
|
+
case 401:
|
|
179
|
+
case 403:
|
|
180
|
+
return off(
|
|
181
|
+
"refused",
|
|
182
|
+
billing === "instance" ? `billing the owner of ${hostLabel(record.instance)} was refused${because}. Deploy with \`--ai-billing user\` to bill yourself instead.` : `the credential was refused for profile "${safeText(profile)}"${because}. Run \`${relogin}\` if your access changed.`,
|
|
183
|
+
stored
|
|
184
|
+
);
|
|
185
|
+
default:
|
|
186
|
+
return off("failed", `${hostLabel(host)} answered HTTP ${res.status}${because}. Deploy again to retry.`, stored);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function readOrCreateMachineId(env = process.env) {
|
|
190
|
+
const path = machineIdPath(env);
|
|
191
|
+
const existing = readId(path);
|
|
192
|
+
if (existing !== void 0) return existing;
|
|
193
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
194
|
+
try {
|
|
195
|
+
writeFileSync(path, `${randomUUID()}
|
|
196
|
+
`, { mode: 384, flag: "wx" });
|
|
197
|
+
} catch (err) {
|
|
198
|
+
if (err.code !== "EEXIST") throw err;
|
|
199
|
+
}
|
|
200
|
+
const made = readId(path);
|
|
201
|
+
if (made !== void 0) return made;
|
|
202
|
+
const id = randomUUID();
|
|
203
|
+
atomicWrite(path, `${id}
|
|
204
|
+
`, { mode: 384 });
|
|
205
|
+
return id;
|
|
206
|
+
}
|
|
207
|
+
function readId(path) {
|
|
208
|
+
try {
|
|
209
|
+
const id = readFileSync(path, "utf8").trim();
|
|
210
|
+
return /^[0-9a-f-]{36}$/i.test(id) ? id : void 0;
|
|
211
|
+
} catch {
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function removeTokenFile(path) {
|
|
216
|
+
try {
|
|
217
|
+
rmSync(path, { force: true });
|
|
218
|
+
} catch {
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function writeTokenFile(engineName, token, env) {
|
|
222
|
+
mkdirSync(engineAiDir(env), { recursive: true, mode: 448 });
|
|
223
|
+
atomicWrite(engineAiTokenPath(engineName, env), token, { mode: 384 });
|
|
224
|
+
}
|
|
225
|
+
function expiryOf(at, inSeconds) {
|
|
226
|
+
if (typeof at === "number" && Number.isFinite(at) && at > 0) return at < 1e12 ? at * 1e3 : at;
|
|
227
|
+
if (typeof at === "string" && at !== "") {
|
|
228
|
+
const parsed = Date.parse(at);
|
|
229
|
+
if (!Number.isNaN(parsed)) return parsed;
|
|
230
|
+
}
|
|
231
|
+
const lifetime = typeof inSeconds === "number" && Number.isFinite(inSeconds) && inSeconds > 0 ? inSeconds : DEFAULT_LIFETIME_S;
|
|
232
|
+
return Date.now() + lifetime * 1e3;
|
|
233
|
+
}
|
|
234
|
+
function answerMessage(body, text) {
|
|
235
|
+
const message = body?.["message"];
|
|
236
|
+
const payload = body?.["payload"];
|
|
237
|
+
if (typeof message === "string" && message.trim() !== "") return firstLine(message);
|
|
238
|
+
if (typeof payload === "string" && payload.trim() !== "") return firstLine(payload);
|
|
239
|
+
return serverMessage(text);
|
|
240
|
+
}
|
|
241
|
+
function parseObject(text) {
|
|
242
|
+
try {
|
|
243
|
+
const parsed = JSON.parse(text);
|
|
244
|
+
return isRecord(parsed) ? parsed : void 0;
|
|
245
|
+
} catch {
|
|
246
|
+
return void 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function firstLine(text) {
|
|
250
|
+
return safeText(text.split("\n")[0].trim());
|
|
251
|
+
}
|
|
252
|
+
function aiOutcomeDocument(outcome) {
|
|
253
|
+
return outcome.status === "on" ? { status: "on", billing: outcome.billing, expiresAt: new Date(outcome.expiresAt).toISOString() } : { status: "off", billing: outcome.billing, reason: outcome.reason };
|
|
254
|
+
}
|
|
255
|
+
function aiOutcomeLine(outcome) {
|
|
256
|
+
if (outcome.status === "off") return outcome.message;
|
|
257
|
+
const until = localTime(new Date(outcome.expiresAt));
|
|
258
|
+
const instance = hostLabel(outcome.instance);
|
|
259
|
+
const profile = `profile ${safeText(outcome.profile)}`;
|
|
260
|
+
const who = outcome.billing === "instance" ? `billed to the owner of ${instance} (${profile})` : `billed to you (${profile}, ${instance})`;
|
|
261
|
+
return `Xano AI: on, ${who} until ${until}. Each deploy renews it.`;
|
|
262
|
+
}
|
|
263
|
+
function localTime(at) {
|
|
264
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
265
|
+
const time = `${two(at.getHours())}:${two(at.getMinutes())}`;
|
|
266
|
+
const now = /* @__PURE__ */ new Date();
|
|
267
|
+
const today = at.getFullYear() === now.getFullYear() && at.getMonth() === now.getMonth() && at.getDate() === now.getDate();
|
|
268
|
+
return today ? time : `${at.getFullYear()}-${two(at.getMonth() + 1)}-${two(at.getDate())} ${time}`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
ENGINE_TOKEN_ROUTE,
|
|
273
|
+
requestEngineAiCredential,
|
|
274
|
+
readOrCreateMachineId,
|
|
275
|
+
aiOutcomeDocument,
|
|
276
|
+
aiOutcomeLine
|
|
277
|
+
};
|
|
278
|
+
//# sourceMappingURL=chunk-OF5YFPSK.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
satisfiesRange
|
|
3
3
|
} from "./chunk-2TFRR6JV.js";
|
|
4
|
-
import {
|
|
5
|
-
configuredPackages,
|
|
6
|
-
declaredDependencies,
|
|
7
|
-
readProjectManifest,
|
|
8
|
-
readToolchainConfig
|
|
9
|
-
} from "./chunk-DXUICABI.js";
|
|
10
4
|
import {
|
|
11
5
|
fileInPackage,
|
|
12
6
|
loadFile,
|
|
13
7
|
moduleKind,
|
|
14
8
|
readInstalledManifestState
|
|
15
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DORGB2Y2.js";
|
|
10
|
+
import {
|
|
11
|
+
configuredPackages,
|
|
12
|
+
declaredDependencies,
|
|
13
|
+
readProjectManifest,
|
|
14
|
+
readToolchainConfig
|
|
15
|
+
} from "./chunk-LZDH5COS.js";
|
|
16
16
|
import {
|
|
17
17
|
UsageError,
|
|
18
18
|
warn
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6534P3VH.js";
|
|
20
20
|
|
|
21
21
|
// src/emit/toolchain-modules.ts
|
|
22
22
|
var UNKNOWN_MODULE_VERSION = "unknown";
|
|
@@ -193,4 +193,4 @@ export {
|
|
|
193
193
|
sdkPeerSkew,
|
|
194
194
|
discoverToolchainPlugins
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
196
|
+
//# sourceMappingURL=chunk-OFKFZSHS.js.map
|
|
@@ -3,16 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-2TFRR6JV.js";
|
|
4
4
|
import {
|
|
5
5
|
addDependencies
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7J7YRAZB.js";
|
|
7
7
|
import {
|
|
8
8
|
condenseNpmError
|
|
9
9
|
} from "./chunk-ZFDZKNGG.js";
|
|
10
10
|
import {
|
|
11
11
|
shellWord
|
|
12
12
|
} from "./chunk-FWD7AL6N.js";
|
|
13
|
-
import {
|
|
14
|
-
readProjectManifest
|
|
15
|
-
} from "./chunk-DXUICABI.js";
|
|
16
13
|
import {
|
|
17
14
|
addCommandFor
|
|
18
15
|
} from "./chunk-DNBP4GJN.js";
|
|
@@ -22,14 +19,17 @@ import {
|
|
|
22
19
|
readInstalledManifest,
|
|
23
20
|
readInstalledManifestState,
|
|
24
21
|
requiredPeersOf
|
|
25
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DORGB2Y2.js";
|
|
23
|
+
import {
|
|
24
|
+
readProjectManifest
|
|
25
|
+
} from "./chunk-LZDH5COS.js";
|
|
26
26
|
import {
|
|
27
27
|
spinner,
|
|
28
28
|
style,
|
|
29
29
|
success,
|
|
30
30
|
terminalText,
|
|
31
31
|
warn
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-6534P3VH.js";
|
|
33
33
|
|
|
34
34
|
// src/emit/toolchain-peers.ts
|
|
35
35
|
async function addToolchainPeers(dir, pkg, rerun) {
|
|
@@ -108,4 +108,4 @@ function projectDeclaredRanges(manifest) {
|
|
|
108
108
|
export {
|
|
109
109
|
addToolchainPeers
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-OG6WYZNA.js.map
|
|
@@ -2,35 +2,35 @@ import {
|
|
|
2
2
|
expandHome,
|
|
3
3
|
readPathEnvVar
|
|
4
4
|
} from "./chunk-EUUUMY7J.js";
|
|
5
|
-
import {
|
|
6
|
-
debugEnabled,
|
|
7
|
-
describeTransportFailure,
|
|
8
|
-
httpFailure,
|
|
9
|
-
isTimeoutError,
|
|
10
|
-
statusLabel
|
|
11
|
-
} from "./chunk-NH5Z2NOD.js";
|
|
12
5
|
import {
|
|
13
6
|
pointerRootFor,
|
|
14
7
|
resolveProjectProfile
|
|
15
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5ABAIJVV.js";
|
|
9
|
+
import {
|
|
10
|
+
registerSecret,
|
|
11
|
+
tokenTextProblem
|
|
12
|
+
} from "./chunk-4GPIOIAC.js";
|
|
16
13
|
import {
|
|
17
14
|
atomicWrite,
|
|
18
15
|
linkTarget
|
|
19
16
|
} from "./chunk-LLNZGEFK.js";
|
|
17
|
+
import {
|
|
18
|
+
debugEnabled,
|
|
19
|
+
describeTransportFailure,
|
|
20
|
+
httpFailure,
|
|
21
|
+
isTimeoutError,
|
|
22
|
+
statusLabel
|
|
23
|
+
} from "./chunk-QZ2PC6B7.js";
|
|
20
24
|
import {
|
|
21
25
|
DEFAULT_PROFILE,
|
|
22
26
|
resolveActiveProfile
|
|
23
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Q4R2ABFL.js";
|
|
24
28
|
import {
|
|
25
29
|
readEnvVar
|
|
26
30
|
} from "./chunk-X2NL4KUO.js";
|
|
27
|
-
import {
|
|
28
|
-
registerSecret,
|
|
29
|
-
tokenTextProblem
|
|
30
|
-
} from "./chunk-4GPIOIAC.js";
|
|
31
31
|
import {
|
|
32
32
|
UsageError
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6534P3VH.js";
|
|
34
34
|
import {
|
|
35
35
|
shellQuote
|
|
36
36
|
} from "./chunk-5ZSO4T2G.js";
|
|
@@ -49,6 +49,11 @@ import * as client from "openid-client";
|
|
|
49
49
|
import { existsSync, readFileSync, mkdirSync } from "fs";
|
|
50
50
|
import { homedir } from "os";
|
|
51
51
|
import { dirname, join } from "path";
|
|
52
|
+
function sameScopes(a, b) {
|
|
53
|
+
if (a === void 0) return false;
|
|
54
|
+
const norm = (s) => [...new Set(s.split(/\s+/).filter((w) => w !== ""))].sort().join(" ");
|
|
55
|
+
return norm(a) === norm(b);
|
|
56
|
+
}
|
|
52
57
|
function clientStorePath() {
|
|
53
58
|
return readPathEnvVar("XANO_CLIENT_FILE") ?? join(homedir(), ".xano", "xanosdk-clients.json");
|
|
54
59
|
}
|
|
@@ -73,15 +78,15 @@ async function getOrRegisterClient(params) {
|
|
|
73
78
|
const all = readAll(path);
|
|
74
79
|
const k = key(params.authHost, params.redirectUri);
|
|
75
80
|
const cached = all[k];
|
|
76
|
-
if (cached?.client_id) return cached.client_id;
|
|
81
|
+
if (cached?.client_id && sameScopes(cached.scope, params.scope)) return { client_id: cached.client_id };
|
|
77
82
|
const { client_id } = await registerClient({
|
|
78
83
|
registrationEndpoint: params.registrationEndpoint,
|
|
79
84
|
redirectUri: params.redirectUri,
|
|
80
85
|
scope: params.scope
|
|
81
86
|
});
|
|
82
|
-
all[k] = { client_id };
|
|
87
|
+
all[k] = { client_id, scope: params.scope };
|
|
83
88
|
writeAll(path, all);
|
|
84
|
-
return client_id;
|
|
89
|
+
return { client_id };
|
|
85
90
|
}
|
|
86
91
|
function clearClient(params) {
|
|
87
92
|
const path = clientStorePath();
|
|
@@ -96,8 +101,10 @@ function clearClient(params) {
|
|
|
96
101
|
var CALLBACK_PATH = "/oauth/callback";
|
|
97
102
|
var DEFAULT_PORT = 47100;
|
|
98
103
|
var SOFTWARE_ID = "xanosdk";
|
|
104
|
+
var FIRST_PARTY_CLIENT_ID = "xanosdk";
|
|
99
105
|
var DEFAULT_AUTH_HOST = "https://app.xano.com";
|
|
100
|
-
var
|
|
106
|
+
var AI_SCOPE = "xano:ai";
|
|
107
|
+
var DEFAULT_SCOPE = `offline_access workspace:read workspace:write xano:dev ${AI_SCOPE}`;
|
|
101
108
|
var DISCOVERY_PATH = "/.well-known/oauth-authorization-server";
|
|
102
109
|
var NETWORK_TIMEOUT_MS = 3e4;
|
|
103
110
|
function unreachableAuthHost(authHost, err) {
|
|
@@ -127,7 +134,8 @@ async function discover(authHost) {
|
|
|
127
134
|
return {
|
|
128
135
|
authorization_endpoint: doc.authorization_endpoint,
|
|
129
136
|
token_endpoint: doc.token_endpoint,
|
|
130
|
-
registration_endpoint: doc.registration_endpoint
|
|
137
|
+
registration_endpoint: doc.registration_endpoint,
|
|
138
|
+
...Array.isArray(doc.scopes_supported) ? { scopes_supported: doc.scopes_supported } : {}
|
|
131
139
|
};
|
|
132
140
|
}
|
|
133
141
|
async function registerClient(params) {
|
|
@@ -247,6 +255,16 @@ var OpenIdProvider = class {
|
|
|
247
255
|
resolvedClientId;
|
|
248
256
|
/** The issuer the resolved config discovered — set once `build()` completes. */
|
|
249
257
|
resolvedIssuer;
|
|
258
|
+
/** The scope set a registered client was registered for: the one asked for, less {@link AI_SCOPE}. */
|
|
259
|
+
resolvedScope;
|
|
260
|
+
/**
|
|
261
|
+
* The scope set the authorize request asks for: {@link OpenIdProviderOptions.scope},
|
|
262
|
+
* less {@link AI_SCOPE} on a server that does not advertise it. Final once the
|
|
263
|
+
* configuration has resolved.
|
|
264
|
+
*/
|
|
265
|
+
requestedScope() {
|
|
266
|
+
return this.resolvedScope ?? this.opts.scope;
|
|
267
|
+
}
|
|
250
268
|
redirectUri() {
|
|
251
269
|
if (!this.opts.redirectUri) {
|
|
252
270
|
throw new Error("OpenIdProvider: redirectUri is required for the authorize/exchange flow.");
|
|
@@ -282,18 +300,23 @@ var OpenIdProvider = class {
|
|
|
282
300
|
const options = server.protocol === "http:" ? { execute: [client.allowInsecureRequests] } : void 0;
|
|
283
301
|
let clientId = this.opts.clientId;
|
|
284
302
|
if (!clientId) {
|
|
285
|
-
const { registration_endpoint } = await discover(this.opts.authHost);
|
|
286
|
-
if (
|
|
303
|
+
const { registration_endpoint, scopes_supported } = await discover(this.opts.authHost);
|
|
304
|
+
if (scopes_supported?.includes(AI_SCOPE)) {
|
|
305
|
+
clientId = FIRST_PARTY_CLIENT_ID;
|
|
306
|
+
} else if (!registration_endpoint) {
|
|
287
307
|
throw new Error(
|
|
288
308
|
`The OAuth server at ${this.opts.authHost} does not advertise a registration endpoint, so xanosdk can't register its loopback client. Check --origin.`
|
|
289
309
|
);
|
|
310
|
+
} else {
|
|
311
|
+
const scope = this.opts.scope.split(/\s+/).filter((w) => w !== "" && w !== AI_SCOPE).join(" ");
|
|
312
|
+
({ client_id: clientId } = await getOrRegisterClient({
|
|
313
|
+
authHost: this.opts.authHost,
|
|
314
|
+
redirectUri: this.redirectUri(),
|
|
315
|
+
registrationEndpoint: registration_endpoint,
|
|
316
|
+
scope
|
|
317
|
+
}));
|
|
318
|
+
this.resolvedScope = scope;
|
|
290
319
|
}
|
|
291
|
-
clientId = await getOrRegisterClient({
|
|
292
|
-
authHost: this.opts.authHost,
|
|
293
|
-
redirectUri: this.redirectUri(),
|
|
294
|
-
registrationEndpoint: registration_endpoint,
|
|
295
|
-
scope: this.opts.scope
|
|
296
|
-
});
|
|
297
320
|
}
|
|
298
321
|
this.resolvedClientId = clientId;
|
|
299
322
|
const config = await client.discovery(
|
|
@@ -312,6 +335,7 @@ var OpenIdProvider = class {
|
|
|
312
335
|
async reset() {
|
|
313
336
|
this.configPromise = void 0;
|
|
314
337
|
this.resolvedClientId = void 0;
|
|
338
|
+
this.resolvedScope = void 0;
|
|
315
339
|
this.resolvedIssuer = void 0;
|
|
316
340
|
if (this.opts.redirectUri) {
|
|
317
341
|
clearClient({ authHost: this.opts.authHost, redirectUri: this.opts.redirectUri });
|
|
@@ -322,7 +346,7 @@ var OpenIdProvider = class {
|
|
|
322
346
|
const code_challenge = await client.calculatePKCECodeChallenge(verifier);
|
|
323
347
|
return client.buildAuthorizationUrl(config, {
|
|
324
348
|
redirect_uri: this.redirectUri(),
|
|
325
|
-
scope: this.
|
|
349
|
+
scope: this.requestedScope(),
|
|
326
350
|
code_challenge,
|
|
327
351
|
code_challenge_method: "S256",
|
|
328
352
|
state
|
|
@@ -356,7 +380,8 @@ function pick(t) {
|
|
|
356
380
|
access_token: t.access_token,
|
|
357
381
|
refresh_token: t.refresh_token,
|
|
358
382
|
expires_in: t.expires_in,
|
|
359
|
-
scope: t.scope
|
|
383
|
+
scope: t.scope,
|
|
384
|
+
...typeof t.ai_gateway_url === "string" && t.ai_gateway_url !== "" ? { ai_gateway_url: t.ai_gateway_url } : {}
|
|
360
385
|
};
|
|
361
386
|
}
|
|
362
387
|
|
|
@@ -804,7 +829,9 @@ function parseOAuth(record, path, profile) {
|
|
|
804
829
|
instance: record.instance,
|
|
805
830
|
workspace_id: requireWorkspaceId(record.workspace_id, at),
|
|
806
831
|
auth_host: record.auth_host,
|
|
807
|
-
client_id: record.client_id
|
|
832
|
+
client_id: record.client_id,
|
|
833
|
+
// Optional and display-only: a missing or malformed value leaves the key out.
|
|
834
|
+
...typeof record.ai_gateway_url === "string" && record.ai_gateway_url !== "" ? { ai_gateway_url: record.ai_gateway_url } : {}
|
|
808
835
|
};
|
|
809
836
|
}
|
|
810
837
|
function parseToken(record, path, profile) {
|
|
@@ -1171,6 +1198,7 @@ export {
|
|
|
1171
1198
|
CALLBACK_PATH,
|
|
1172
1199
|
DEFAULT_PORT,
|
|
1173
1200
|
DEFAULT_AUTH_HOST,
|
|
1201
|
+
AI_SCOPE,
|
|
1174
1202
|
decodeAudience,
|
|
1175
1203
|
decodeExpiry,
|
|
1176
1204
|
decodeIssuer,
|
|
@@ -1225,4 +1253,4 @@ export {
|
|
|
1225
1253
|
addGitignoreRule,
|
|
1226
1254
|
gitSaysIgnored
|
|
1227
1255
|
};
|
|
1228
|
-
//# sourceMappingURL=chunk-
|
|
1256
|
+
//# sourceMappingURL=chunk-OQMXCNN7.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
findBranch,
|
|
3
3
|
listBranches,
|
|
4
4
|
liveBranchLabel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C7KO5KKB.js";
|
|
6
6
|
import {
|
|
7
7
|
readLockFile,
|
|
8
8
|
recordSyncInLockFile,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
displayPath,
|
|
16
16
|
info,
|
|
17
17
|
warn
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6534P3VH.js";
|
|
19
19
|
|
|
20
20
|
// src/emit/sync-record.ts
|
|
21
21
|
import { existsSync } from "fs";
|
|
@@ -64,4 +64,4 @@ export {
|
|
|
64
64
|
storedBranchLabel,
|
|
65
65
|
syncBranchLabel
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-OSMPI45P.js.map
|