@microsoft/cmr-cli 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -14
- package/THIRD-PARTY-NOTICES.txt +287 -30
- package/dist/Add-4RULNL6A.js +11 -0
- package/dist/AddConfig-D2DCR3JH.js +12 -0
- package/dist/AddConnector-5ZR5AF6H.js +19 -0
- package/dist/AddDeployment-7U4I5IC4.js +11 -0
- package/dist/AddDeploymentBinding-BZVRRZ7H.js +18 -0
- package/dist/AddRayfin-45ASHNIX.js +87 -0
- package/dist/Alter-36TSNZ4M.js +11 -0
- package/dist/{AuthStatus-XA6RGYYZ.js → AuthStatus-W5ZHOAVD.js} +2 -2
- package/dist/AuthSwitch-7HRPTGEG.js +13 -0
- package/dist/Bin.js +1 -1
- package/dist/BuildMaafApp-TLQXOVQC.js +11 -0
- package/dist/Clear-X55BZKYF.js +11 -0
- package/dist/Cli-EEO7V3MZ.js +47 -0
- package/dist/CloneMaafApp-4EHW3HE2.js +12 -0
- package/dist/CreateMaafApp-VNXWCAP4.js +23 -0
- package/dist/CreateMaafProject-WVBNZPVL.js +11 -0
- package/dist/DeleteMaafApp-UGUKARMO.js +11 -0
- package/dist/DeployMaafApp-GJO567TK.js +8 -0
- package/dist/DeployMaafProject-4TSW2SFJ.js +11 -0
- package/dist/DeploymentApprovals-SZKNJT76.js +11 -0
- package/dist/Dev-ZD3L6WYY.js +15 -0
- package/dist/{EnvironmentVariableAuthenticationProvider-EBRBQ5I2.js → EnvironmentVariableAuthenticationProvider-EURTERVX.js} +2 -2
- package/dist/FeatureSettings-GG7JGFIY.js +11 -0
- package/dist/{GenerateCode-Z2OY3SZR.js → GenerateCode-PNYC45SK.js} +2 -2
- package/dist/GetMaafBuildStatus-UTPVWF5L.js +11 -0
- package/dist/GetMaafProjectDeployStatus-PLK52YC4.js +12 -0
- package/dist/{GetSettings-64N4P6L7.js → GetSettings-RLRDJEC7.js} +2 -2
- package/dist/InfoMaafApp-CTB6IPRU.js +13 -0
- package/dist/InfoMaafProject-TULH566X.js +11 -0
- package/dist/Init-TYWP2E6U.js +11 -0
- package/dist/ListConnectorActions-UQS6D4UN.js +11 -0
- package/dist/ListConnectors-OCDO64AT.js +11 -0
- package/dist/ListDeployments-PDLJ3IEI.js +11 -0
- package/dist/ListMaafApps-UAWTTCGB.js +11 -0
- package/dist/ListMaafProjects-T3Q2GEDX.js +11 -0
- package/dist/{ListSchema-IR7FTBRR.js → ListSchema-G673LK5Q.js} +2 -2
- package/dist/{ListSettings-3M7UOOLI.js → ListSettings-EXCK5ZS6.js} +2 -2
- package/dist/{Login-G7TNQISG.js → Login-XZATPT4L.js} +2 -2
- package/dist/{Logout-AOOISVWK.js → Logout-2XM4IMZF.js} +2 -2
- package/dist/{MockFetch-GKQMNDW3.js → MockFetch-LW3KYEGC.js} +2 -2
- package/dist/NodeMsalAuthenticationProvider-ALMFNUEV.js +17 -0
- package/dist/Pack-RH4D4C7W.js +8 -0
- package/dist/PackProject-5DUWSBFA.js +14 -0
- package/dist/PlayMaafApp-5BXGXE6O.js +8 -0
- package/dist/ProjectApprovals-K3JF6D72.js +13 -0
- package/dist/ProjectRoleAssignments-7IUDEVBN.js +11 -0
- package/dist/RefreshDataSource-CMHDF2GP.js +11 -0
- package/dist/RefreshGitAuth-4TRO5IOQ.js +11 -0
- package/dist/Remove-KZD3SDDC.js +11 -0
- package/dist/{RemoveDataSource-T2AG7ZWC.js → RemoveDataSource-C7UXOUNH.js} +3 -3
- package/dist/RemoveDeployment-ZQJWQPD6.js +11 -0
- package/dist/ServicePrincipalAuthenticationProvider-3NPJTLF5.js +11 -0
- package/dist/SetSetting-3XO6HPG7.js +11 -0
- package/dist/{SetSetting-KOWAPJWX.js → SetSetting-ZW7F43GC.js} +2 -2
- package/dist/ShareLinkCreate-JXPW5H7A.js +11 -0
- package/dist/ShareLinkList-ICYPRIQV.js +11 -0
- package/dist/ShareLinkRevoke-JVMQZF7K.js +11 -0
- package/dist/ShareList-YGSTFMVE.js +11 -0
- package/dist/ShareMaafApp-ZCY72WHK.js +11 -0
- package/dist/{TelemetrySettings-FVJUK5MR.js → TelemetrySettings-P6WYWGW4.js} +2 -2
- package/dist/UnshareMaafApp-N4UR6Q4A.js +11 -0
- package/dist/{chunk-JWSX7DVU.js → chunk-2SRFM7D6.js} +2 -2
- package/dist/chunk-3YCPXSCO.js +11 -0
- package/dist/chunk-45EZLDPE.js +147 -0
- package/dist/{chunk-EFTF4FA7.js → chunk-4PI5THLA.js} +2 -2
- package/dist/{chunk-4C6DWU2Y.js → chunk-6KOL66SF.js} +2 -2
- package/dist/{chunk-2VJIWD7V.js → chunk-74RNALDY.js} +2 -2
- package/dist/{chunk-4JTUAUHI.js → chunk-7AEULMP2.js} +2 -2
- package/dist/{chunk-MWN7R4VR.js → chunk-7LAMG4KK.js} +2 -2
- package/dist/chunk-A5INC5TY.js +11 -0
- package/dist/chunk-AICYZHWK.js +11 -0
- package/dist/chunk-B4NTYKGH.js +12 -0
- package/dist/chunk-BAQPANON.js +11 -0
- package/dist/{chunk-BREK3DVB.js → chunk-BMOTNINY.js} +6 -6
- package/dist/{chunk-OUKOEUZA.js → chunk-C7UWPNC3.js} +1 -1
- package/dist/{chunk-2UMD5IAQ.js → chunk-CLY3OASM.js} +2 -2
- package/dist/chunk-DLUQVMUE.js +11 -0
- package/dist/{chunk-JDRULLI3.js → chunk-ENDUKF4E.js} +2 -2
- package/dist/{chunk-DOCWK326.js → chunk-FESGOCAP.js} +7 -7
- package/dist/{chunk-IM7SC23O.js → chunk-GO22IDEN.js} +6 -6
- package/dist/{chunk-WV7KDGLS.js → chunk-HHW4SKVU.js} +2 -2
- package/dist/{chunk-CONEIY4I.js → chunk-HZGDQAKA.js} +2 -2
- package/dist/{chunk-O4G2KO7E.js → chunk-IMVZRBSQ.js} +2 -2
- package/dist/chunk-K77VBHFP.js +12 -0
- package/dist/{chunk-CER3QPDN.js → chunk-KD4NQIYX.js} +3 -3
- package/dist/{chunk-4WQT5P2M.js → chunk-KN66FSQK.js} +2 -2
- package/dist/{chunk-4UHMKZLH.js → chunk-KPKJZKWW.js} +2 -2
- package/dist/chunk-NMZFJESU.js +12 -0
- package/dist/{chunk-ZREDMBLO.js → chunk-NNYOT7IR.js} +2 -2
- package/dist/{chunk-JMF444BA.js → chunk-OH3TCDCC.js} +2 -2
- package/dist/{chunk-A57M2UGH.js → chunk-OHQNTYJG.js} +2 -2
- package/dist/{chunk-4AO24KKT.js → chunk-PYPCPMCR.js} +5 -5
- package/dist/{chunk-OTXBVG3E.js → chunk-R2IECDVU.js} +3 -3
- package/dist/{chunk-FGB6GFXI.js → chunk-RA74M3YD.js} +2 -2
- package/dist/{chunk-E2O4YZX2.js → chunk-RSHOMYG6.js} +228 -227
- package/dist/chunk-UHNOINTO.js +11 -0
- package/dist/{chunk-ELHOJBVT.js → chunk-XC7Y6E2C.js} +11 -11
- package/dist/chunk-XJXWNOJR.js +11 -0
- package/dist/chunk-Y2D37EFX.js +13 -0
- package/dist/{chunk-C7V6WEZM.js → chunk-YEWRCEPT.js} +2 -2
- package/dist/chunk-Z4UX3JOS.js +12 -0
- package/dist/chunk-ZBQT5XZJ.js +32 -0
- package/dist/chunk-ZGBTKTTU.js +11 -0
- package/dist/{chunk-5BE4TLDK.js → chunk-ZLK2CMMJ.js} +23 -23
- package/dist/chunk-ZWJ5T5VI.js +11 -0
- package/dist/node-PLZPXPD7.js +29 -0
- package/dist/typescript-6OTSQQEW.js +458 -0
- package/package.json +5 -4
- package/dist/Add-75RSJNM4.js +0 -11
- package/dist/AddConfig-4SAYYOBQ.js +0 -12
- package/dist/AddConnector-P4R4NJ5P.js +0 -16
- package/dist/AddDeployment-TBA3AAGD.js +0 -11
- package/dist/AddDeploymentBinding-6FZ7Y5JM.js +0 -18
- package/dist/AddRayfin-35GBGCWF.js +0 -38
- package/dist/Alter-U7WDVOMU.js +0 -11
- package/dist/AuthSwitch-2FXB7WFU.js +0 -13
- package/dist/BuildMaafApp-3EGRD23G.js +0 -11
- package/dist/Clear-MZGQZ2XK.js +0 -11
- package/dist/Cli-6A2HUP7R.js +0 -47
- package/dist/CloneMaafApp-YAEYSP23.js +0 -12
- package/dist/CreateMaafApp-2XYROOHB.js +0 -23
- package/dist/CreateMaafProject-Q7KIVAR2.js +0 -11
- package/dist/DeleteMaafApp-G3SL3GGP.js +0 -11
- package/dist/DeployMaafApp-DBJONCUH.js +0 -8
- package/dist/DeployMaafProject-SOMMKVJO.js +0 -11
- package/dist/DeploymentApprovals-Y67LSQQG.js +0 -11
- package/dist/Dev-TXJLPT7K.js +0 -15
- package/dist/FeatureSettings-LYV6QUZB.js +0 -11
- package/dist/GetMaafBuildStatus-ZR5GCREL.js +0 -11
- package/dist/GetMaafProjectDeployStatus-OJ56DPZ6.js +0 -12
- package/dist/InfoMaafApp-FJM7UI5H.js +0 -13
- package/dist/InfoMaafProject-EU6OQ7DX.js +0 -11
- package/dist/Init-MTONJT7V.js +0 -11
- package/dist/ListConnectorActions-PJTNNWLH.js +0 -11
- package/dist/ListConnectors-JYNVPB3O.js +0 -11
- package/dist/ListDeployments-UV6J6WA5.js +0 -11
- package/dist/ListMaafApps-QPEX7JA4.js +0 -11
- package/dist/ListMaafProjects-RDR2S3HD.js +0 -11
- package/dist/NodeMsalAuthenticationProvider-6ABSS6QK.js +0 -17
- package/dist/Pack-QJZCMVEM.js +0 -8
- package/dist/PackProject-Y3Q3KOTC.js +0 -14
- package/dist/PlayMaafApp-MH66OLOV.js +0 -8
- package/dist/ProjectApprovals-NTFYLH3W.js +0 -13
- package/dist/ProjectRoleAssignments-7IDK6SGJ.js +0 -11
- package/dist/RefreshDataSource-CISFHQNA.js +0 -11
- package/dist/RefreshGitAuth-NUQ7JNJA.js +0 -11
- package/dist/Remove-IYDTKDJE.js +0 -11
- package/dist/RemoveDeployment-K3GDRCXJ.js +0 -11
- package/dist/ServicePrincipalAuthenticationProvider-CEHIAANL.js +0 -11
- package/dist/SetSetting-PD76MA6O.js +0 -11
- package/dist/ShareLinkCreate-VCWVBQ4B.js +0 -11
- package/dist/ShareLinkList-5VG5CG34.js +0 -11
- package/dist/ShareLinkRevoke-KYUNMTG5.js +0 -11
- package/dist/ShareList-M25UE6LD.js +0 -11
- package/dist/ShareMaafApp-QMEJEXPZ.js +0 -11
- package/dist/UnshareMaafApp-RIUUYHIL.js +0 -11
- package/dist/chunk-36YYCVFC.js +0 -12
- package/dist/chunk-3UIUI5Q2.js +0 -11
- package/dist/chunk-B6REHI77.js +0 -11
- package/dist/chunk-GVLAG66W.js +0 -13
- package/dist/chunk-HWEMI6JI.js +0 -12
- package/dist/chunk-OB6WEE2V.js +0 -11
- package/dist/chunk-OBATM5M4.js +0 -11
- package/dist/chunk-PBXK6LJO.js +0 -11
- package/dist/chunk-VAKAW5BD.js +0 -12
- package/dist/chunk-WV7D7PTW.js +0 -12
- package/dist/chunk-YMRQPXY7.js +0 -32
- package/dist/chunk-YYXAAA2U.js +0 -11
- package/dist/rayfin-pack-HOUOLOHQ.js +0 -164
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as vn,c as Ie,d as J,h as dt,i as ke,l as me,m as ft,n as Q,o as N}from"./chunk-45EZLDPE.js";import"./chunk-TYRVM4PP.js";import{a as R,b as de,d as fe}from"./chunk-UT667QSU.js";var wt=de((He,Ve)=>{(function(e,t){typeof R=="function"&&typeof He=="object"&&typeof Ve=="object"?Ve.exports=t():typeof define=="function"&&define.amd?define(function(){return t()}):e.pluralize=t()})(He,function(){var e=[],t=[],n={},r={},i={};function o(d){return typeof d=="string"?new RegExp("^"+d+"$","i"):d}function s(d,p){return d===p?p:d===d.toLowerCase()?p.toLowerCase():d===d.toUpperCase()?p.toUpperCase():d[0]===d[0].toUpperCase()?p.charAt(0).toUpperCase()+p.substr(1).toLowerCase():p.toLowerCase()}function a(d,p){return d.replace(/\$(\d{1,2})/g,function(y,h){return p[h]||""})}function c(d,p){return d.replace(p[0],function(y,h){var g=a(p[1],arguments);return s(y===""?d[h-1]:y,g)})}function l(d,p,y){if(!d.length||n.hasOwnProperty(d))return p;for(var h=y.length;h--;){var g=y[h];if(g[0].test(p))return c(p,g)}return p}function m(d,p,y){return function(h){var g=h.toLowerCase();return p.hasOwnProperty(g)?s(h,g):d.hasOwnProperty(g)?s(h,d[g]):l(g,h,y)}}function u(d,p,y,h){return function(g){var b=g.toLowerCase();return p.hasOwnProperty(b)?!0:d.hasOwnProperty(b)?!1:l(b,b,y)===b}}function f(d,p,y){var h=p===1?f.singular(d):f.plural(d);return(y?p+" ":"")+h}return f.plural=m(i,r,e),f.isPlural=u(i,r,e),f.singular=m(r,i,t),f.isSingular=u(r,i,t),f.addPluralRule=function(d,p){e.push([o(d),p])},f.addSingularRule=function(d,p){t.push([o(d),p])},f.addUncountableRule=function(d){if(typeof d=="string"){n[d.toLowerCase()]=!0;return}f.addPluralRule(d,"$0"),f.addSingularRule(d,"$0")},f.addIrregularRule=function(d,p){p=p.toLowerCase(),d=d.toLowerCase(),i[d]=p,r[p]=d},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(d){return f.addIrregularRule(d[0],d[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(d){return f.addPluralRule(d[0],d[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(d){return f.addSingularRule(d[0],d[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(f.addUncountableRule),f})});var Kt=de(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.buildNodeModulesChain=Xe;z.resolveInstalledPackageVersions=Rr;z.resolvePackageJsonFrom=_e;z.resolveExistingDir=Mt;var A=R("node:fs"),xr=R("node:module"),_=R("node:path"),Sr=R("node:url");function Xe(e){let t=[],n=e;for(let r=0;r<16;r+=1){t.push(n);let i=(0,_.dirname)(n);if(i===n)break;n=i}return t}var Tr=["dependencies","optionalDependencies","peerDependencies"],_r=4,Ar=256;function Rr(e,t,n={}){let r=t.startsWith("file:")||t.includes("://")?(0,_.dirname)((0,Sr.fileURLToPath)(t)):Mt(t),i=[],o=[];for(let s of[...new Set(e)].sort()){if(!Lt(s)){o.push(s);continue}let a=_e(r,s)??(n.includeIndirect?wr(r,s):void 0);if(!a){o.push(s);continue}try{let c=JSON.parse((0,A.readFileSync)(a,"utf8"));c.name===s&&typeof c.version=="string"&&c.version.length>0&&(n.isVersionAllowed?.(c.version)??!0)?i.push({name:s,version:c.version}):o.push(s)}catch{o.push(s)}}return{packages:i,unresolvedPackageNames:o}}function Lt(e){return e.length<=214&&/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(e)}function _e(e,t){let n=(0,xr.createRequire)((0,_.join)(e,"noop.js"));try{return n.resolve(`${t}/package.json`)}catch{}try{let r=n.resolve(t),i=(0,_.dirname)(r);for(let o=0;o<16;o+=1){let s=(0,_.join)(i,"package.json");if((0,A.existsSync)(s))try{if(JSON.parse((0,A.readFileSync)(s,"utf8")).name===t)return s}catch{}let a=(0,_.dirname)(i);if(a===i)break;i=a}}catch{}for(let r of Xe(e)){let i=(0,_.join)(r,"node_modules",t,"package.json");if((0,A.existsSync)(i))return i}}function wr(e,t){let n=new Set,r=Dt((0,_.join)(e,"package.json"));r.length===0&&(r=$r(e));for(let i=0;i<_r;i+=1){let o=[];for(let s of r){if(n.size>=Ar)return;if(s===t||n.has(s)||(n.add(s),!Lt(s)))continue;let a=_e(e,s);if(!a)continue;let c;try{c=(0,A.realpathSync)((0,_.dirname)(a))}catch{continue}let l=_e(c,t);if(l)return l;o.push(...Dt((0,_.join)(c,"package.json")))}if(o.length===0)return;r=o}}function Dt(e){try{let t=JSON.parse((0,A.readFileSync)(e,"utf8")),n=[];for(let r of Tr){let i=t[r];i&&typeof i=="object"&&n.push(...Object.keys(i))}return n}catch{return[]}}function $r(e){for(let t of Xe(e)){let n=(0,_.join)(t,"node_modules");if((0,A.existsSync)(n))try{let r=[];for(let i of(0,A.readdirSync)(n,{withFileTypes:!0}))if(!i.name.startsWith(".")){if(i.name.startsWith("@")){let o=(0,_.join)(n,i.name);for(let s of(0,A.readdirSync)(o))r.push(`${i.name}/${s}`);continue}r.push(i.name)}return r}catch{return[]}}return[]}function Mt(e){let t=(0,_.resolve)(e);if(!(0,A.existsSync)(t))throw new Error(`discoverRayfinDocsPackages: \`from\` path does not exist: ${t}`);if(!(0,A.statSync)(t).isDirectory())throw new Error(`discoverRayfinDocsPackages: \`from\` must be a directory: ${t}`);return t}});var gn=de((Il,hi)=>{hi.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var xn=de((kl,v)=>{var at=R("fs"),Pe=R("path"),gi=R("os"),yi=R("crypto"),Ei=gn(),ct=Ei.version,bi=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Ci(e){let t={},n=e.toString();n=n.replace(/\r\n?/mg,`
|
|
8
|
+
`);let r;for(;(r=bi.exec(n))!=null;){let i=r[1],o=r[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
|
|
9
|
+
`),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function xi(e){e=e||{};let t=Cn(e);e.path=t;let n=E.configDotenv(e);if(!n.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let r=bn(e).split(","),i=r.length,o;for(let s=0;s<i;s++)try{let a=r[s].trim(),c=Ti(n,a);o=E.decrypt(c.ciphertext,c.key);break}catch(a){if(s+1>=i)throw a}return E.parse(o)}function Si(e){console.log(`[dotenv@${ct}][WARN] ${e}`)}function ce(e){console.log(`[dotenv@${ct}][DEBUG] ${e}`)}function En(e){console.log(`[dotenv@${ct}] ${e}`)}function bn(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ti(e,t){let n;try{n=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let r=n.password;if(!r){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:r}}function Cn(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let n of e.path)at.existsSync(n)&&(t=n.endsWith(".vault")?n:`${n}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=Pe.resolve(process.cwd(),".env.vault");return at.existsSync(t)?t:null}function yn(e){return e[0]==="~"?Pe.join(gi.homedir(),e.slice(1)):e}function _i(e){let t=!!(e&&e.debug),n=e&&"quiet"in e?e.quiet:!0;(t||!n)&&En("Loading env from encrypted .env.vault");let r=E._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),E.populate(i,r,e),{parsed:r}}function Ai(e){let t=Pe.resolve(process.cwd(),".env"),n="utf8",r=!!(e&&e.debug),i=e&&"quiet"in e?e.quiet:!0;e&&e.encoding?n=e.encoding:r&&ce("No encoding is specified. UTF-8 is used by default");let o=[t];if(e&&e.path)if(!Array.isArray(e.path))o=[yn(e.path)];else{o=[];for(let l of e.path)o.push(yn(l))}let s,a={};for(let l of o)try{let m=E.parse(at.readFileSync(l,{encoding:n}));E.populate(a,m,e)}catch(m){r&&ce(`Failed to load ${l} ${m.message}`),s=m}let c=process.env;if(e&&e.processEnv!=null&&(c=e.processEnv),E.populate(c,a,e),r||!i){let l=Object.keys(a).length,m=[];for(let u of o)try{let f=Pe.relative(process.cwd(),u);m.push(f)}catch(f){r&&ce(`Failed to load ${u} ${f.message}`),s=f}En(`injecting env (${l}) from ${m.join(",")}`)}return s?{parsed:a,error:s}:{parsed:a}}function Ri(e){if(bn(e).length===0)return E.configDotenv(e);let t=Cn(e);return t?E._configVault(e):(Si(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),E.configDotenv(e))}function wi(e,t){let n=Buffer.from(t.slice(-64),"hex"),r=Buffer.from(e,"base64"),i=r.subarray(0,12),o=r.subarray(-16);r=r.subarray(12,-16);try{let s=yi.createDecipheriv("aes-256-gcm",n,i);return s.setAuthTag(o),`${s.update(r)}${s.final()}`}catch(s){let a=s instanceof RangeError,c=s.message==="Invalid key length",l=s.message==="Unsupported state or unable to authenticate data";if(a||c){let m=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw m.code="INVALID_DOTENV_KEY",m}else if(l){let m=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw m.code="DECRYPTION_FAILED",m}else throw s}}function $i(e,t,n={}){let r=!!(n&&n.debug),i=!!(n&&n.override);if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o]),r&&ce(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=t[o]}var E={configDotenv:Ai,_configVault:_i,_parseVault:xi,config:Ri,decrypt:wi,parse:Ci,populate:$i};v.exports.configDotenv=E.configDotenv;v.exports._configVault=E._configVault;v.exports._parseVault=E._parseVault;v.exports.config=E.config;v.exports.decrypt=E.decrypt;v.exports.parse=E.parse;v.exports.populate=E.populate;v.exports=E});var un=fe(vn(),1);import{existsSync as st,mkdirSync as an,readFileSync as cn,readdirSync as ln,rmSync as Qr}from"node:fs";import{join as X,relative as Zr}from"node:path";var B={debug(){}};import{resolve as Nn,sep as Pn}from"node:path";function H(e,t){return t?Nn(e,t.replace(/[\\/]/gu,Pn)):e}var mt=["P1","P2","P3","P4","P5","F2","F4","F8","F16","F32","F64","F128","F256","F512","F1024","F2048","F4096","F8192"],ho=new Set(mt);function pe(e,t){if(!e.auth)return e;let{dynamicClaims:n,...r}=e.auth;return{...e,auth:t?{...r,dynamicClaims:t}:r}}var Dn={protected:!1,public:!0};function Fe(e){let t=e.staticHosting;if(!t)return{...e};let{assetAccess:n,anonymousAccess:r,...i}=t;if(n!==void 0&&!J.some(o=>o===n))throw new Error(`services.staticHosting.assetAccess must be "protected" or "public", but is ${JSON.stringify(n)}. If this came from an environment variable, check that it resolves to protected or public.`);return{...e,staticHosting:{...i,...n===void 0?typeof r=="boolean"?{anonymousAccess:r}:t.enabled===!0?{anonymousAccess:!1}:{}:{anonymousAccess:Dn[n]}}}}var pt="@microsoft/rayfin-cli";function ht(e){if(!e)return e;let{connectors:t,...n}=e;return n}function Oe(e){let{services:t,connectors:n,packageVersions:r,clientVersion:i}=e,o=n&&n.length>0?Object.fromEntries(n.map(({name:a,type:c,...l})=>[a,{connector:c,...l}])):void 0,s=ht(t);return{...Fe(s),...o?{connectors:o}:{},packageVersions:{...r,[pt]:i}}}import{spawn as Kn}from"node:child_process";function Et(e,t,n={}){return new Promise(r=>{let i="",o=Kn(t,{cwd:e,env:ft(n.env),shell:!0,stdio:["ignore","pipe","pipe"],windowsHide:!0}),s=a=>{let c=a.toString();i+=c,n.onOutput?.(c)};o.stdout?.on("data",s),o.stderr?.on("data",s),o.on("error",a=>{r({success:!1,output:`${i}${a.message}
|
|
10
|
+
`})}),o.on("close",a=>{if(a!==0){let c=dt(i,{projectRoot:e,buildCommand:t});if(c.length>0){let l=`
|
|
11
|
+
${c.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`;i+=l,n.onOutput?.(l)}}r({success:a===0,output:i})})})}import{createHash as or}from"node:crypto";import{copyFileSync as sr,existsSync as D,mkdirSync as ze,mkdtempSync as ar,readFileSync as We,readdirSync as vt,rmSync as Nt,rmdirSync as cr,statSync as lr,writeFileSync as ur}from"node:fs";import{dirname as L,isAbsolute as dr,join as T,relative as ie,resolve as re}from"node:path";import{pathToFileURL as Ft}from"node:url";var k=class{and(t){return new te("and",this,t)}or(t){return new te("or",this,t)}},Z=class extends k{name;constructor(t){super(),this.name=t}eq(t){return new F(this,"eq",t)}neq(t){return new F(this,"ne",t)}toString(){return`@claims.${this.name}`}},ee=class extends k{name;constructor(t){super(),this.name=t}eq(t){return new F(this,"eq",t)}neq(t){return new F(this,"ne",t)}toString(){return`@item.${this.name}`}},F=class extends k{left;operator;right;constructor(t,n,r){super(),this.left=t,this.operator=n,this.right=r}toString(){return`${bt(this.left)} ${this.operator} ${bt(this.right)}`}},te=class extends k{operator;left;right;constructor(t,n,r){super(),this.operator=t,this.left=n,this.right=r}toString(){return`(${this.left.toString()}) ${this.operator} (${this.right.toString()})`}};function bt(e){return e instanceof k?e.toString():e===null?"null":typeof e=="string"?`'${e.replace(/'/g,"''")}'`:e instanceof Date?e.toISOString():String(e)}function ge(){return new Proxy({},{get(e,t){if(t===Symbol.toStringTag)return"ItemProxy";if(typeof t=="string")return new ee(t)}})}var Ue=new Proxy({},{get(e,t){if(typeof t=="string")return new Z(t)}}),Sa=ge();function he(e){if(e instanceof te)return{op:e.operator,args:[he(e.left),he(e.right)]};if(e instanceof F)return{op:jn(e.operator),lhs:Ct(e.left,"lhs"),rhs:Hn(e.right)};throw new Error(`Unsupported policy expression for storage check AST: ${e?.constructor?.name??typeof e}. v1 storage policies support only flat boolean expressions over claims.{sub,email,role} and item.<field> using eq, neq, and, and or (subquery primitives such as Entity.where(...) or .in(...) are deferred to a future DSL extension).`)}function jn(e){switch(e){case"eq":return"eq";case"ne":return"neq";default:return Bn(e)}}function Bn(e){throw new Error(`Unsupported comparison operator for storage check AST: ${String(e)}`)}function Ct(e,t){if(e instanceof Z)return{claim:e.name};if(e instanceof ee)return{field:e.name};throw new Error(`Policy comparison ${t} must be a claim or field reference; got ${typeof e=="object"&&e!==null?e.constructor.name:typeof e}`)}function Hn(e){if(e instanceof Z||e instanceof ee)return Ct(e,"rhs");if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(e instanceof Date)return e.toISOString();throw new Error(`Unsupported policy comparison rhs for storage check AST: ${typeof e}`)}var ye=Symbol.for("microsoft.rayfin.entity"),Vn=Symbol.for("microsoft.rayfin.entity.marker"),Yn=Symbol.for("microsoft.rayfin.storage.folder");var De=e=>qn(e)&&e[Symbol.metadata]?.[ye]!==void 0&&e[Symbol.metadata]?.[Vn]===!0;var S;(function(e){e.Text="text",e.Uuid="uuid",e.Int="int",e.Decimal="decimal",e.Boolean="boolean",e.Date="date",e.Email="email"})(S||(S={}));function x(){return"id"}function qn(e){return typeof e=="function"&&"name"in e&&e.name!=="Function"}var O;(function(e){e.one="one",e.many="many"})(O||(O={}));var Ee=e=>(e[Symbol.metadata]?.[ye]||(e[Symbol.metadata][ye]={name:e.name,fields:{},permissions:{},roles:[]}),e[Symbol.metadata][ye]),xt=e=>e[Symbol.metadata]?.[Yn];var Le=class{Id;Email},Me=new Set([Le.name]);var U={MsSql:"mssql",PostgreSql:"postgresql"},Y={FabricWarehouse:"fabric-warehouse",FabricSqlAnalytics:"fabric-sqlanalytics"};function Tt(e,t,n){let r=[];return t!==void 0&&r.push(`${w(e)} >= ${t}`),n!==void 0&&r.push(`${w(e)} <= ${n}`),r.join(" AND ")}function zn(e,t,n){let r=[];return t!==void 0&&r.push(`${V(e)} >= ${t}`),n!==void 0&&r.push(`${V(e)} <= ${n}`),r.join(" AND ")}var w=e=>`[${e.replace(/]/g,"]]")}]`,V=e=>`"${e.replace(/"/g,'""')}"`,Ke=e=>`'${e.replace(/'/g,"''")}'`,Wn={[U.MsSql]:{defaultIdType:"UNIQUEIDENTIFIER",defaultStringType:(e=255)=>`NVARCHAR(${e})`,defaultIntegerType:"INT",defaultBooleanType:"BIT",defaultDateType:"DATETIME2",defaultDecimalType:(e,t)=>e!==void 0&&t!==void 0?`DECIMAL(${e},${t})`:"DECIMAL(18,2)",defaultTextType:"NVARCHAR(MAX)",defaultSchema:"dbo",checkConstraintTemplate:(e,t)=>`${`${w(e)} COLLATE Latin1_General_100_BIN2`} IN (${t.map(Ke).join(", ")})`,minLengthConstraintTemplate:(e,t)=>`LEN(${w(e)}) >= ${t}`,numericRangeConstraintTemplate:(e,t,n)=>Tt(e,t,n),emailConstraintTemplate:e=>`${w(e)} LIKE '_%@_%._%' AND CHARINDEX(' ', ${w(e)}) = 0`,maxDecimalPrecision:28,maxStringLength:4e3},[U.PostgreSql]:{defaultIdType:"UUID",defaultStringType:(e=255)=>`VARCHAR(${e})`,defaultIntegerType:"INTEGER",defaultBooleanType:"BOOLEAN",defaultDateType:"TIMESTAMP WITH TIME ZONE",defaultDecimalType:(e,t)=>e!==void 0&&t!==void 0?`NUMERIC(${e},${t})`:"NUMERIC(18,2)",defaultTextType:"TEXT",defaultSchema:"public",checkConstraintTemplate:(e,t)=>`${V(e)} IN (${t.map(Ke).join(", ")})`,minLengthConstraintTemplate:(e,t)=>`LENGTH(${V(e)}) >= ${t}`,numericRangeConstraintTemplate:(e,t,n)=>zn(e,t,n),emailConstraintTemplate:e=>`${V(e)} LIKE '_%@_%._%' AND POSITION(' ' IN ${V(e)}) = 0`,maxDecimalPrecision:28,maxStringLength:null}},St={defaultIdType:"UNIQUEIDENTIFIER",defaultStringType:(e=255)=>`VARCHAR(${e})`,defaultIntegerType:"INT",defaultBooleanType:"BIT",defaultDateType:"DATETIME2",defaultDecimalType:(e,t)=>e!==void 0&&t!==void 0?`DECIMAL(${e},${t})`:"DECIMAL(18,2)",defaultTextType:"VARCHAR(MAX)",defaultSchema:"dbo",checkConstraintTemplate:(e,t)=>`${w(e)} IN (${t.map(Ke).join(", ")})`,minLengthConstraintTemplate:(e,t)=>`LEN(${w(e)}) >= ${t}`,numericRangeConstraintTemplate:(e,t,n)=>Tt(e,t,n),emailConstraintTemplate:e=>`${w(e)} LIKE '_%@_%._%' AND CHARINDEX(' ', ${w(e)}) = 0`,maxDecimalPrecision:28,maxStringLength:8e3},Gn={[Y.FabricWarehouse]:{...St},[Y.FabricSqlAnalytics]:{...St}};function P(e){let t=Gn[e];if(t)return t;let n=Wn[e];if(!n)throw new Error(`Unknown SQL dialect: ${e}`);return n}function _t(e){return e===U.MsSql||e===U.PostgreSql}var Xn=/^[_A-Za-z][_0-9A-Za-z]*$/;function At(e){return Xn.test(e)&&!e.startsWith("__")}function Jn(e){let t=e.replace(/[^_0-9A-Za-z]/g,"_").replace(/^_+/,"");return t.length===0?"field":/^[0-9]/.test(t)?`field_${t}`:t}function je(e,t,n={}){if(At(t))return;let r=t.startsWith("__")?"starts with '__', which GraphQL reserves for introspection":"is not a valid GraphQL name (must match /^[_A-Za-z][_0-9A-Za-z]*$/)",o=`Rename the property to a valid GraphQL name (for example, '${Jn(t)}')`,s;if(n.isRelationship||n.columnName!==void 0)s=`${o}.`;else{let a=`'${JSON.stringify(t).slice(1,-1).replace(/\\"/g,'"').replace(/'/g,"\\'")}'`;s=`${o} and keep the original column with { column: ${a} } on the field decorator.`}return{entity:e,field:t,message:`Field name '${t}' ${r}`,fix:s}}var Qn=["Any","Base64String","Boolean","Byte","ByteArray","Date","DateTime","Decimal","Duration","Float","ID","Int","LocalDate","LocalDateTime","LocalTime","Long","Short","SignedByte","Single","String","Time","TimeSpan","UnsignedByte","UnsignedInt","UnsignedLong","UnsignedShort","URI","URL","UUID"],Rt=["Query","Mutation","Subscription"],Zn=[...Qn,...Rt].sort((e,t)=>e.localeCompare(t)),er=new Set(Zn);function tr(e){if(e.startsWith("__"))return"introspection";if(Rt.includes(e))return"root-type";if(er.has(e))return"scalar"}function nr(e,t){switch(t){case"introspection":return`Entity name '${e}' starts with '__', which GraphQL reserves for introspection types`;case"root-type":return`Entity name '${e}' is a GraphQL operation root type reserved by the platform`;case"scalar":return`Entity name '${e}' is a built-in GraphQL scalar type reserved by the platform`}}function Be(e,t){let n=tr(e);if(!n)return;let i=`Rename the entity to a name that is not a reserved GraphQL type (for example, '${`${e.replace(/^_+/,"")}Record`}')`;return{entity:e,message:nr(e,n),fix:t.supportsSourceMapping?`${i}, or pass an explicit name to @entity('...') and keep Source({ table: '...' }) pointed at the original table.`:`${i}, or pass an explicit name to @entity('...').`}}var be=fe(wt(),1),Ce=class{static customPluralMap=new Map;static getPlural(t){let n=this.customPluralMap.get(t);return n||be.default.plural(t)}static setCustomPlural(t,n){this.customPluralMap.set(t,n)}static clearCustomPlurals(){this.customPluralMap.clear()}static getSingular(t){return be.default.singular(t)}static isPlural(t){return be.default.isPlural(t)}};var ne=class{dialectConfig;constructor(t){this.dialectConfig=P(t)}getDefaultPrimaryKeyType(){return this.dialectConfig.defaultIdType}inferDatabaseType(t,n){let r=this.dialectConfig,i=t.columnName??n;if(t.enum){let o=t.enum.map(c=>c.replace(/['"]/g,"")).filter(c=>c!=="undefined"),s=r.checkConstraintTemplate(i,o),a=Math.max(...o.map(c=>c.length));return{type:r.defaultStringType(a),checkConstraint:s}}switch(t.format){case S.Uuid:return{type:r.defaultIdType};case S.Email:{let o=[r.emailConstraintTemplate(i)];return t.min!==void 0&&t.min>0&&o.push(r.minLengthConstraintTemplate(i,t.min)),{type:t.max?r.defaultStringType(t.max):r.defaultTextType,checkConstraint:o.join(" AND "),checkConstraintNameSuffix:"_email"}}case S.Text:{let o=t.min!==void 0&&t.min>0;return{type:t.max?r.defaultStringType(t.max):r.defaultTextType,checkConstraint:o?r.minLengthConstraintTemplate(i,t.min):void 0,checkConstraintNameSuffix:o?"_minlen":void 0}}case S.Int:{let o=t.min!==void 0||t.max!==void 0;return{type:r.defaultIntegerType,checkConstraint:o?r.numericRangeConstraintTemplate(i,t.min,t.max):void 0,checkConstraintNameSuffix:o?"_range":void 0}}case S.Boolean:return{type:r.defaultBooleanType};case S.Date:return{type:r.defaultDateType};case S.Decimal:{let o=t.min!==void 0||t.max!==void 0;return{type:r.defaultDecimalType(t.precision,t.scale),checkConstraint:o?r.numericRangeConstraintTemplate(i,t.min,t.max):void 0,checkConstraintNameSuffix:o?"_range":void 0}}default:return t?.relationship?.type===O.many?{type:"RELATIONSHIP_ARRAY"}:t?.relationship?.type===O.one?{type:"RELATIONSHIP_SINGLE"}:{type:r.defaultStringType()}}}inferPrimaryKey(t){return t===x()}inferUniqueConstraint(t,n){return!!n}inferNullability(t){return!!t}analyzeRelationship(t,n){if(n.relationship===void 0)return{isRelationship:!1};let r=this.resolveRelationshipTargetName(n.relationship.target);if(n.relationship.type===O.many)return{isRelationship:!0,relationshipType:"one-to-many",referencedEntity:r};if(n.relationship.type===O.one){let i=`${t}_${x()}`;return{isRelationship:!0,relationshipType:"many-to-one",referencedEntity:r,generatedForeignKeyColumn:i}}throw new Error(`Unknown relationship type for field ${t}`)}resolveRelationshipTargetName(t){try{let n=t();if(typeof n=="function"&&n.name)return n.name}catch{}}generateTableName(t){return Ce.getPlural(t)}generateEntityName(t){return t}isCustomType(t){return!["string","number","boolean","Date","undefined","null","void","any","unknown","object","Array","Promise","Function"].includes(t)&&!t.includes("|")&&!t.includes("&")&&!t.endsWith("[]")}};var Ye=class extends Error{errors;warnings;constructor(t){let n=t.filter(c=>c.severity!=="warning"),r=t.filter(c=>c.severity==="warning"),i=n.length,o=r.length,s="";i>0&&o>0?s=`Found ${i} schema validation error${i===1?"":"s"} and ${o} warning${o===1?"":"s"}`:i>0?s=i===1?"Found 1 schema validation error":`Found ${i} schema validation errors`:s=o===1?"Found 1 schema validation warning":`Found ${o} schema validation warnings`;let a=t.map((c,l)=>{let m=c.field?`${c.entity}.${c.field}`:c.entity,u=c.severity==="warning"?"\u26A0\uFE0F ":"",f=` ${l+1}. ${u}[${m}] ${c.message}`;return c.fix&&(f+=`
|
|
14
|
+
Fix: ${c.fix}`),f}).join(`
|
|
15
|
+
`);super(`${s}:
|
|
16
|
+
|
|
17
|
+
${a}`),this.name="SchemaValidationError",this.errors=n,this.warnings=r}},q=class{errors=[];addError(t){this.errors.push(t)}hasErrors(){return this.errors.some(t=>t.severity!=="warning")}hasIssues(){return this.errors.length>0}getErrorCount(){return this.errors.filter(t=>t.severity!=="warning").length}getErrors(){return[...this.errors]}throwIfErrors(){if(this.hasErrors())throw new Ye(this.errors)}};var $t=100;function ir(e){return e.isRelationship&&!!(e.sourceFields||e.targetFields)}var xe=class{typeInference;schema;errorCollector;dialectConfig;dialect;log;constructor(t,n,r={}){this.schema=t,this.dialect=n,this.typeInference=new ne(n),this.errorCollector=new q,this.dialectConfig=P(n),this.log=r.log??console.log}analyzeEntities(){this.errorCollector=new q;let t=[],n=this.schema.filter(i=>Ee(i)!==void 0).length;n>$t&&(this.errorCollector.addError({entity:"Schema",message:`Schema contains ${n} entities, which exceeds the maximum of ${$t}`,fix:"Please use fewer entities"}),this.errorCollector.throwIfErrors());for(let i of this.schema){let o=Ee(i);if(o){if(Me.has(o.name)){this.errorCollector.addError({entity:o.name,message:`'${o.name}' is a built-in system entity and cannot be redefined`,fix:`Rename your class to avoid conflicting with the built-in '${o.name}' entity`});continue}let s=Be(o.name,{supportsSourceMapping:!1});if(s){this.errorCollector.addError(s);continue}this.log(` \u2705 Found @entity class: ${o.name}`);let a=this.analyzeEntity(o);t.push(a)}}let r=new Set(t.map(i=>i.name));for(let i of t)for(let o of i.fields)o.isRelationship&&o.foreignKey?.referencedEntity&&!r.has(o.foreignKey.referencedEntity)&&!Me.has(o.foreignKey.referencedEntity)&&this.errorCollector.addError({entity:i.name,field:o.name,message:`Relationship '${o.name}' references entity '${o.foreignKey.referencedEntity}', but it is not included in the schema`,fix:`Add the '${o.foreignKey.referencedEntity}' class to the schema array, and/or ensure it is decorated with @entity()`});return this.errorCollector.throwIfErrors(),t}analyzeStorageFolders(){let t=[];for(let n of this.schema){let r=xt(n);if(!r)continue;this.log(` \u2705 Found storage folder: ${r.name}`);let i=r.roles&&r.roles.length>0?this.aggregatePermissions({name:r.name,fields:{},permissions:r.permissions,roles:r.roles},"storage"):r.permissions,o=[];for(let[s,a]of Object.entries(r.fields??{}))o.push({name:s,type:a.jsType??"string",nullable:a.isOptional===!0});t.push({name:r.name,folderName:r.folderName,permissions:i,onConflict:r.onConflict,maxSize:r.maxSize,allowedContentTypes:r.allowedContentTypes,fields:o})}return t}analyzeEntity(t){let n=this.typeInference.generateEntityName(t.name),r=this.typeInference.generateTableName(t.name);t.source&&this.errorCollector.addError({entity:t.name,message:`Entity '${t.name}' extends Source({...}), which is connector-only. The data path uses the 'id' primary-key convention and does not support Source-based schema/table mapping or composite/custom primary keys.`,fix:`Remove the Source({...}) base class from '${t.name}', or use this entity through a connector instead.`}),(n.includes(".")||r.includes("."))&&this.errorCollector.addError({entity:t.name,message:`Entity name '${t.name}' contains a '.'. Only the default database schema is supported; do not include a '.' in the entity name.`,fix:"Remove the '.' from the class name."});let i=this.aggregatePermissions(t,"database");this.validateFieldMetadata(t);let o=[],s=new Map;for(let[c,l]of Object.entries(t.fields)){this.log(` \u{1F50E} Analyzing field: ${c}`),this.log(` Info: ${JSON.stringify(l)}`);let m=je(t.name,c,{isRelationship:l.relationship!==void 0,columnName:l.columnName});m&&this.errorCollector.addError(m);let u=c.toLowerCase();if(s.has(u)){let d=s.get(u);this.errorCollector.addError({entity:t.name,field:c,message:`Duplicate field name detected: '${c}' collides with '${d}' (case-insensitive collision)`,fix:"Rename one of the fields to ensure all field names are unique"})}s.set(u,c);let f=this.analyzeField(c,l);o.push(f)}if(!o.some(c=>c.primaryKey)){let c=x(),l=o.find(m=>m.name.toLowerCase()===c.toLowerCase());l?this.errorCollector.addError({entity:t.name,field:l.name,message:`Field '${l.name}' collides with the auto-generated '${c}' primary key column.`,fix:`Rename the field to lowercase '${c}' to make it the primary key, or pick a different name.`}):(this.log(` \u26A0\uFE0F No primary key found for ${t.name}, adding default '${c}' field`),o.unshift({name:c,originalName:c,dbType:this.typeInference.getDefaultPrimaryKeyType(),nullable:!1,primaryKey:!0,unique:!1,isRelationship:!1}))}return this.validateRelationships(t,o),this.log(` \u{1F4CA} ${n}: ${o.length} fields, ${Object.keys(i).length} permission roles`),{name:n,tableName:r,fields:o,permissions:i,...t.source?{source:this.resolveSource(t.source,n)}:{}}}resolveSource(t,n){return{schema:t.schema??this.dialectConfig.defaultSchema??"",table:t.table??n}}aggregatePermissions(t,n){if(!t.roles||t.roles.length===0)return t.permissions||{};let r={},i=new Map;for(let s of t.roles){let a=i.get(s.role)||[];a.push(s),i.set(s.role,a)}let o=Array.from(i.keys()).sort();for(let s of o){let a=i.get(s),c=[];for(let l of a){let m=this.sortActions(l.actions);for(let u of m){let f,d;if(l.policy){let h=l.policy.check(Ue,ge());f=h.toString(),n==="storage"&&(d=he(h))}let p=l.includedFields&&l.includedFields.length>0,y=l.excludedFields&&l.excludedFields.length>0;if(p||y||f){let h={action:u};if(f&&(h.policy=n==="storage"?{storage:f,check:d}:{database:f}),p||y){let g={};p&&(g.include=[...l.includedFields].sort()),y&&(g.exclude=[...l.excludedFields].sort()),!g.include&&g.exclude&&(g.include=["*"]),h.fields=g}c.push(h)}else c.push(u)}}r[s]=c}return r}sortActions(t){let n={create:1,read:2,update:3,delete:4,execute:5,"*":99};return[...t].sort((r,i)=>n[r]-n[i])}analyzeField(t,n){let r=!!n.isUnique,i=this.typeInference.inferDatabaseType(n,t),o=this.typeInference.inferNullability(!!n.isOptional),s=this.typeInference.inferPrimaryKey(t),a=this.typeInference.inferUniqueConstraint(t,r),c=this.typeInference.analyzeRelationship(t,n);return{name:t,originalName:t,dbType:i.type,nullable:s?!1:o,primaryKey:s,unique:a,checkConstraint:i.checkConstraint,checkConstraintNameSuffix:i.checkConstraintNameSuffix,foreignKey:c.referencedEntity?{referencedEntity:c.referencedEntity,referencedField:x()}:void 0,isRelationship:c.isRelationship,relationshipType:c.relationshipType,generatedForeignKeyColumn:c.generatedForeignKeyColumn,originalFieldMetadata:n,columnName:n.columnName,sourceFields:n.relationship?.sourceFields,targetFields:n.relationship?.targetFields}}validateFieldMetadata(t){for(let[n,r]of Object.entries(t.fields)){if(n===x()&&r.format!==S.Uuid){let i=r.format?`'${r.format}'`:"no format";this.errorCollector.addError({entity:t.name,field:n,message:`Primary key field '${n}' must use @uuid() decorator, but has ${i}`,fix:`Change @${r.format||"text"}() to @uuid() on the '${n}' field`})}if(r.format==="text"||r.format==="email"){let i=r.min===void 0||Number.isFinite(r.min),o=r.max===void 0||Number.isFinite(r.max);i||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid text field: min (${r.min}) must be a finite number`,fix:"Set min to a finite non-negative value, e.g., @text({ min: 1 })"}),o||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid text field: max (${r.max}) must be a finite number`,fix:"Set max to a finite non-negative value, e.g., @text({ max: 255 })"}),i&&o&&r.min!==void 0&&r.max!==void 0&&r.min>r.max&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid text field: min (${r.min}) must be less than or equal to max (${r.max})`,fix:"Set min <= max, e.g., @text({ min: 1, max: 50 })"}),i&&r.min!==void 0&&r.min<0&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid text field: min (${r.min}) cannot be negative`,fix:"Set min to a non-negative value, e.g., @text({ min: 0 })"}),o&&r.max!==void 0&&r.max<0&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid text field: max (${r.max}) cannot be negative`,fix:"Set max to a positive value, e.g., @text({ max: 255 })"});let s=this.dialectConfig.maxStringLength;if(o&&r.max!==void 0&&s!==null&&r.max>s){let a=this.dialectConfig.defaultTextType;this.errorCollector.addError({entity:t.name,field:n,message:`Text field max (${r.max}) exceeds the maximum sized string length (${s}) for ${this.dialect.toUpperCase()}. Use @text() without a max option for unbounded text`,fix:`Set max to ${s} or less, or remove the max option to use ${a}`})}r.isUnique&&r.max===void 0&&(this.dialect===U.MsSql||this.dialect===Y.FabricWarehouse||this.dialect===Y.FabricSqlAnalytics)&&this.errorCollector.addError({entity:t.name,field:n,message:"Unique constraint on unbounded text field is not supported in MSSQL. SQL Server cannot create unique indexes on NVARCHAR(MAX) columns",fix:"Add a max length, e.g., @text({ unique: true, max: 255 })"})}if(r.format==="int"||r.format==="decimal"){let i=r.min===void 0||Number.isFinite(r.min),o=r.max===void 0||Number.isFinite(r.max);i||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid numeric field: min (${r.min}) must be a finite number`,fix:"Set min to a finite number, e.g., @int({ min: 0 })"}),o||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid numeric field: max (${r.max}) must be a finite number`,fix:"Set max to a finite number, e.g., @int({ max: 100 })"}),i&&o&&r.min!==void 0&&r.max!==void 0&&r.min>r.max&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid numeric field: min (${r.min}) must be less than or equal to max (${r.max})`,fix:"Set min <= max, e.g., @int({ min: 0, max: 100 })"})}if(r.format==="decimal"){let i=r.precision!==void 0,o=r.scale!==void 0;if(i!==o){let s=i?"precision":"scale",a=i?"scale":"precision";this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: '${s}' is defined without '${a}'. Both must be specified together`,fix:"Add the missing option, e.g., @decimal({ precision: 10, scale: 2 })"})}if(i&&o){let s=r.precision,a=r.scale,c=this.dialectConfig.maxDecimalPrecision;Number.isInteger(s)||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: precision (${s}) must be an integer`,fix:"Use a whole number, e.g., @decimal({ precision: 10, scale: 2 })"}),Number.isInteger(a)||this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: scale (${a}) must be an integer`,fix:"Use a whole number, e.g., @decimal({ precision: 10, scale: 2 })"}),s<1&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: precision (${s}) must be at least 1`,fix:`Set precision to a value between 1 and ${c}, e.g., @decimal({ precision: 10, scale: 2 })`}),s>c&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: precision (${s}) exceeds the maximum of ${c} for this dialect`,fix:`Set precision to a value between 1 and ${c}, e.g., @decimal({ precision: ${Math.min(18,c)}, scale: 2 })`}),a<0&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: scale (${a}) cannot be negative`,fix:`Set scale to a value between 0 and precision (${s}), e.g., @decimal({ precision: ${s}, scale: 2 })`}),a>s&&this.errorCollector.addError({entity:t.name,field:n,message:`Invalid decimal field: scale (${a}) cannot exceed precision (${s})`,fix:`Set scale <= precision, e.g., @decimal({ precision: ${s}, scale: ${Math.min(2,s)} })`})}}if(r.enum){r.enum.length===0&&this.errorCollector.addError({entity:t.name,field:n,message:"Invalid set field: enum must have at least one value",fix:"Provide at least one enum value, e.g., @set('option1', 'option2')"});let i=r.enum;new Set(i).size!==i.length&&this.errorCollector.addError({entity:t.name,field:n,message:"Invalid set field: enum values must be unique",fix:"Remove duplicate values from the set, e.g., @set('option1', 'option2') instead of @set('option1', 'option1')"})}}}validateRelationships(t,n){let r=new Map;for(let i of n)r.set(i.name,i);for(let i of n){if(ir(i)){let o=[i.sourceFields?"sourceFields":void 0,i.targetFields?"targetFields":void 0].filter(Boolean).join(", ");this.errorCollector.addError({entity:t.name,field:i.name,message:`Relationship '${i.name}' sets '${o}', which is not supported here; this relationship references the target entity's primary key.`,fix:`Remove '${o}' from the relationship on '${i.name}'.`})}if(i.isRelationship&&!i.foreignKey?.referencedEntity&&this.errorCollector.addError({entity:t.name,field:i.name,message:`Relationship '${i.name}' could not resolve its target entity`,fix:"Ensure the target class exists, is imported correctly, and is passed to the schema array"}),i.isRelationship&&i.relationshipType==="many-to-one"&&i.foreignKey?.referencedEntity===t.name&&!i.nullable&&this.errorCollector.addError({entity:t.name,field:i.name,message:`Self-referencing relationship '${t.name}.${i.name}' must be optional; a required self-referencing foreign key cannot be satisfied when inserting the first row because no parent row exists yet`,fix:`Mark the relationship optional, e.g. @one(() => ${t.name}, { optional: true }) ${i.name}?: ${t.name};`}),i.isRelationship&&i.generatedForeignKeyColumn){let o=i.generatedForeignKeyColumn,s=r.get(o);if(s&&s.originalFieldMetadata){let a=s.originalFieldMetadata.format;if(a!==S.Uuid){let c=a;this.errorCollector.addError({entity:t.name,field:i.name,message:`Foreign key type conflict: relationship '${i.name}' expects FK column '${o}' to be UUID, but existing field has format '${c}'`,fix:`Change the existing field '${o}' to use @uuid() decorator`})}}}}}};var Se={USER:{ENTITY_NAME:"User",TABLE_NAME:"Users"}},Te=class{dialectConfig;entities=[];junctionTables=new Set;constructor(t){this.dialectConfig=P(t)}generateConfig(t){return this.entities=t,this.analyzeRelationships(),{$schema:"https://github.com/Azure/data-api-builder/releases/download/v1.5.56/dab.draft.schema.json",entities:this.generateEntities()}}analyzeRelationships(){for(let t=0;t<this.entities.length;t++)for(let n=t+1;n<this.entities.length;n++){let r=this.entities[t],i=this.entities[n],o=r.fields.some(l=>l.isRelationship&&l.relationshipType==="one-to-many"&&l.foreignKey?.referencedEntity===i.name),s=i.fields.some(l=>l.isRelationship&&l.relationshipType==="one-to-many"&&l.foreignKey?.referencedEntity===r.name);if(o&&s)throw new Error(`Many-to-many relationship detected between ${r.name} and ${i.name}. This is not currently supported.`);let a=r.fields.some(l=>l.isRelationship&&l.relationshipType==="many-to-one"&&l.foreignKey?.referencedEntity===i.name),c=i.fields.some(l=>l.isRelationship&&l.relationshipType==="many-to-one"&&l.foreignKey?.referencedEntity===r.name);if(a&&c)throw new Error(`One-to-one relationship detected between ${r.name} and ${i.name}. This is not currently supported.`)}}generateEntities(){let t={};for(let n of this.entities)n.name!==Se.USER.ENTITY_NAME&&(t[n.name]=this.generateEntity(n));return t}generateEntity(t){let n=[],r=Object.keys(t.permissions);if(r.length===0)n.push({role:"authenticated",actions:["*"]});else for(let c of r.sort()){let l=t.permissions[c],m=this.transformPermissionActions(l);n.push({role:c,actions:m})}let i=this.generateRelationships(t),o=this.generateMappings(t),s=this.generateXSchema(t),a={source:t.source?.table??t.tableName,permissions:n,"x-schema":s};return Object.keys(i).length>0&&(a.relationships=i),Object.keys(o).length>0&&(a.mappings=o),a}transformPermissionActions(t){return t.map(n=>{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null&&"action"in n){let r={action:n.action};return"fields"in n&&n.fields&&(r.fields=n.fields),"policy"in n&&n.policy&&(r.policy=n.policy),r}return n})}generateRelationships(t){let n={};for(let r of t.fields){if(!r.isRelationship)continue;let i=r.foreignKey?.referencedEntity||r.originalFieldMetadata?.relationship?.target?.name;if(!i)continue;let o=this.generateJunctionTableName(t.name,i);if(this.junctionTables.has(o)&&r.relationshipType==="one-to-many"){let a=`${t.name}_${x()}`;n[r.name]={cardinality:"many","target.entity":i,linking:{entity:o,"source.fields":[x()],"target.fields":[a]}}}else if(r.relationshipType==="many-to-one")n[r.name]={cardinality:"one","target.entity":i,"source.fields":[r.generatedForeignKeyColumn||`${r.name}_id`],"target.fields":[this.getFieldNameForEntity(i,x())]};else if(r.relationshipType==="one-to-many"){let a=this.findForeignKeyFromEntityToEntity(i,t.name)||`${t.name}_${x()}`,c=this.getFieldNameForEntity(t.name,x());n[r.name]={cardinality:"many","target.entity":i,"source.fields":[c],"target.fields":[a]}}}return n}findForeignKeyFromEntityToEntity(t,n){let r=this.entities.find(o=>o.name===t);if(!r)return;let i=r.fields.find(o=>o.isRelationship&&o.relationshipType==="many-to-one"&&o.foreignKey?.referencedEntity===n);if(i)return i.generatedForeignKeyColumn||`${i.name}_id`}generateMappings(t){let n={};for(let r of t.fields){if(r.isRelationship)continue;let i=r.columnName??r.name;i!==r.name&&(n[i]=r.name)}return n}generateXSchema(t){let n={},r=[],i=[],o,s=[],a=[],c=this.getIncomingOneToManyRelationships(t.name),l=new Map;for(let u of c){let f=l.get(u.sourceEntityName)||0;l.set(u.sourceEntityName,f+1)}for(let[u,f]of l)if(f>1)throw new Error(`Ambiguous relationship detected: Entity '${u}' has multiple @many relationships to '${t.name}'. Rayfin cannot infer distinct foreign keys. You must define explicit @one relationships on '${t.name}' to specify distinct foreign keys.`);for(let u of t.fields)if(u.isRelationship){if(r.push(u.name),u.relationshipType==="many-to-one"&&u.generatedForeignKeyColumn){let f=u.generatedForeignKeyColumn;n[f]||(n[f]={dbType:this.dialectConfig.defaultIdType,nullable:u.nullable}),i.push({name:`FK_${t.tableName}_${f}`,columns:[f],referencedTable:this.getTableNameForEntity(u.foreignKey.referencedEntity),referencedColumns:[this.getFieldNameForEntity(u.foreignKey.referencedEntity,x())]})}}else{let f=u.columnName??u.name,d={dbType:u.dbType,nullable:u.nullable};u.originalFieldMetadata?.default!==void 0&&(d.defaultValue=u.originalFieldMetadata.default),n[f]=d,u.primaryKey&&(o={name:`PK_${t.tableName}`,columns:[f]}),u.unique&&!u.primaryKey&&s.push({name:`UQ_${t.tableName}_${f}`,columns:[f]}),u.checkConstraint&&a.push({name:`CK_${t.tableName}_${f}${u.checkConstraintNameSuffix??""}`,expression:u.checkConstraint})}for(let u of c){let f=this.generateJunctionTableName(u.sourceEntityName,t.name);if(this.junctionTables.has(f)||this.findForeignKeyFromEntityToEntity(t.name,u.sourceEntityName))continue;let p=`${u.sourceEntityName}_${x()}`;n[p]||(n[p]={dbType:this.dialectConfig.defaultIdType,nullable:!1});let y=`FK_${t.tableName}_${p}`;i.some(g=>g.name===y)||i.push({name:y,columns:[p],referencedTable:this.getTableNameForEntity(u.sourceEntityName),referencedColumns:[this.getFieldNameForEntity(u.sourceEntityName,x())]})}let m={};return o&&(m.primaryKey=o),i.length>0&&(m.foreignKeys=i),s.length>0&&(m.uniqueConstraints=s),a.length>0&&(m.checkConstraints=a),{fields:n,constraints:m}}getIncomingOneToManyRelationships(t){let n=[];for(let r of this.entities)for(let i of r.fields)!i.isRelationship||i.relationshipType!=="one-to-many"||(i.foreignKey?.referencedEntity||i.originalFieldMetadata?.relationship?.target?.name)!==t||n.push({sourceEntityName:r.name});return n}getTableNameForEntity(t){let n=this.entities.find(r=>r.name===t);return n?.source?.table||n?.tableName||(t===Se.USER.ENTITY_NAME?Se.USER.TABLE_NAME:t)}getFieldNameForEntity(t,n){if(t===Se.USER.ENTITY_NAME)return this.getSystemUserFieldName(n);let i=this.entities.find(o=>o.name===t)?.fields.find(o=>o.name.toLowerCase()===n.toLowerCase());return i?.columnName??i?.name??n}getSystemUserFieldName(t){return{id:"Id",email:"Email"}[t.toLowerCase()]||t}generateJunctionTableName(t,n){let[r,i]=[t,n].sort();return`${r}_${i}`}};var pc={b:1,kb:1024,mb:1024*1024,gb:1024*1024*1024},hc=5e3*1024*1024;async function Ot(e){let t=Date.now(),n=e.dialect||"mssql",r=e.log??(()=>{}),i=e.projectRoot,o=e.serviceRoot??i;if(e.buildCommand){if(!e.runBuild)throw new Error("A data build command is configured but no build runner was supplied.");if(r("Running configured data build command"),!await e.runBuild(o,e.buildCommand))throw new Error("Data build command failed. Fix the errors above and try again.")}if(!_t(n))throw new Error(`Dialect '${n}' is not supported`);let s=T(i,"rayfin",".temp");D(s)||(ze(s,{recursive:!0}),r(`\u{1F4C2} Created temporary directory: ${s}`));let a={},c=Ge(o);if(c){r(`\u{1F4E6} Loading entities from package exports: ${c.join(", ")}`);for(let d of c){let p=re(o,d);if(!D(p))throw new Error(`Package exports entry not found: ${p}
|
|
18
|
+
\u{1F4A1} Run the build command first (e.g. npm run build)`);kt(await Pt(p,r),a)}r("\u{1F52C} Scanned package exports for entities")}else{let p=await(e.compile??(C=>me(C)))(o);if(!p.success){let C=p.errors.join(`
|
|
19
|
+
`).trim();throw new Error(`TypeScript compilation failed. Fix the errors above and try again.${C?`
|
|
20
|
+
${C}`:""}`)}let y=re(o),h=e.inputDir||T(o,"rayfin","data"),g=re(h);if(!D(g))throw new Error(e.inputDir?`Input directory does not exist: ${g}`:`Default input directory does not exist: ${g}
|
|
21
|
+
\u{1F4A1} Create the directory or specify a custom input directory`);r(`\u{1F4C1} Scanning directory: ${g}`);let b=Cr(y);if(b.length===0)throw new Error(`No rayfin/${ke}/data/*.js files found in: ${y}
|
|
22
|
+
\u{1F4A1} - you may need to build your project`);r(`\u{1F50D} Found ${b.length} *.js file${b.length===1?"":"s"}`),b.length<=10?b.forEach(C=>r(` \u2514\u2500\u2500 ${C}`)):(b.slice(0,5).forEach(C=>r(` \u2514\u2500\u2500 ${C}`)),r(` \u2514\u2500\u2500 ... and ${b.length-5} more files`)),r(""),r("\u{1F52C} Starting export analysis...");for(let C of b)kt(await Pt(C,r),a)}r("\u{1F6E0}\uFE0F Starting schema analysis...");let m=new xe(Object.values(a),n,{log:r}).analyzeEntities();if(m.length===0)return{configPath:"",entities:[],duration:Date.now()-t,dialect:n};r(`
|
|
23
|
+
\u2705 Analysis complete: ${m.length} entit${m.length===1?"y":"ies"} found`),r("\u{1F3D7}\uFE0F Generating DAB configuration...");let u=new Te(n).generateConfig(m),f=T(s,"dab-config.json");return ur(f,JSON.stringify(u,null,2)),{configPath:f,entities:m,duration:Date.now()-t,dialect:n}}var fr=".rayfin-schema",mr=/(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)(['"])(\.{1,2}\/[^'"]+)\1/g,pr=/\.[cm]?js$/;async function Pt(e,t){let n=re(e),r=gr(n),i=br(r);if(!i){let l=It([n],L(n));return qe(n,l)}let o=[...r,...Er(r,i)],s=T(i,fr),a=It(o,i),c;try{ze(s,{recursive:!0}),c=ar(T(s,`${a}-`));for(let l of o){let m=T(c,ie(i,l));ze(L(m),{recursive:!0}),sr(l,m)}}catch(l){return c&&Nt(c,{recursive:!0,force:!0}),t(`Could not create schema snapshot; importing the original entry instead: ${l instanceof Error?l.message:String(l)}`),qe(n,a)}try{return await import(Ft(T(c,ie(i,n))).href)}catch(l){if(!hr(l))throw l;return t(`Could not resolve a schema dependency from its snapshot; importing the original entry instead: ${l.message}`),qe(n,a)}finally{Nt(c,{recursive:!0,force:!0});try{cr(s)}catch{}}}async function qe(e,t){return await import(`${Ft(e).href}?rayfin-schema=${t}`)}function hr(e){return e instanceof Error?"code"in e&&(e.code==="ERR_MODULE_NOT_FOUND"||e.code==="ERR_UNSUPPORTED_DIR_IMPORT"||e.code==="ERR_PACKAGE_PATH_NOT_EXPORTED")?!0:/Failed to resolve (?:entry for package|import)/u.test(e.message):!1}function gr(e){let t=new Set,n=[e];for(;n.length>0;){let r=n.pop();if(t.has(r)||(t.add(r),!pr.test(r)))continue;let i=We(r,"utf-8");for(let o of i.matchAll(mr)){let s=yr(L(r),o[2]);s&&!t.has(s)&&n.push(s)}}return[...t].sort((r,i)=>r.localeCompare(i))}function yr(e,t){let n=re(e,t.replace(/[?#].*$/,""));for(let r of[n,`${n}.js`,T(n,"index.js")])if(D(r)&&lr(r).isFile())return r}function Er(e,t){let n=new Set;for(let r of e){let i=L(r);for(;;){let o=T(i,"package.json");if(D(o)&&n.add(o),i===t)break;i=L(i)}}return[...n].sort((r,i)=>r.localeCompare(i))}function br(e){let t=L(e[0]);for(let n of e.slice(1))for(;ie(t,n).startsWith("..")||dr(ie(t,n));){let r=L(t);if(r===t)return;t=r}return t}function It(e,t){let n=or("sha256");for(let r of e)n.update(ie(t,r)).update("\0").update(We(r)),n.update("\0");return n.digest("hex").slice(0,16)}function Cr(e){let t=["rayfin",...ke.split("/"),"data"],n=[],r=i=>{let o=T(i,...t);if(D(o))for(let a of vt(o,{withFileTypes:!0}))a.isFile()&&a.name.endsWith(".js")&&n.push(T(o,a.name));let s;try{s=vt(i,{withFileTypes:!0})}catch{return}for(let a of s)a.isDirectory()&&a.name!=="node_modules"&&!a.name.startsWith(".")&&r(T(i,a.name))};return r(e),n.sort((i,o)=>i.localeCompare(o))}function Ge(e){let t=T(e,"package.json");if(!D(t))return null;let n;try{n=JSON.parse(We(t,"utf-8"))}catch{return null}if(n.exports){let r=Ut(n.exports);if(r.length>0)return r}return typeof n.main=="string"?[n.main]:null}function Ut(e){if(typeof e=="string")return e.endsWith(".js")?[e]:[];if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e;if("."in t)return Ut(t["."]);for(let n of["import","require","default"]){let r=t[n];if(typeof r=="string"&&r.endsWith(".js"))return[r]}}return[]}function kt(e,t){for(let[n,r]of Object.entries(e))if(r&&De(r))t[n]=r;else if(r&&Array.isArray(r))for(let i of r)De(i)&&(t[i.name]=i)}var jt=fe(Kt(),1),Bt="@microsoft/rayfin-auth";function vr(e,t){try{let{packages:n}=(0,jt.resolveInstalledPackageVersions)([t],e,{includeIndirect:!0});return n.find(r=>r.name===t)?.version}catch{return}}function Nr(e,t=Bt){return vr(e,t)}function Je(e,t){if(!e)return;let n=H(e,t?.staticHosting?.path),r=Nr(n);return r?{[Bt]:r}:void 0}import{existsSync as Ht,readFileSync as Pr}from"node:fs";import{join as Vt,relative as Ir}from"node:path";var kr="rayfin/functions",Fr="claims.contract.json";function Or(e){return Vt(e,"..","auth")}function Yt(e,t){let n=e.functions?.path?.trim()||kr;return Vt(Or(H(t,n)),Fr)}function Ur(e,t){return Ir(e,t).replace(/\\/gu,"/")}function qt(e,t){let n=Yt(e,t);return!Ht(n)&&e.auth?.dynamicClaims?.enabled!==!0?e:pe(e,Dr(e,t))}function Dr(e,t){let n=Yt(e,t),r=Ur(t,n),i=e.auth?.dynamicClaims?.enabled===!0;if(!Ht(n)){if(i)throw new Error(`services.auth.dynamicClaims.enabled is true, but ${r} was not found. Add a udf.authClaims provider and run \`rayfin dev\` (or \`rayfin up\`) to generate it, or set services.auth.dynamicClaims.enabled to false.`);return e.auth?.dynamicClaims}let o;try{o=JSON.parse(Pr(n,"utf-8"))}catch(s){throw new Error(`${r} is not valid JSON (${s instanceof Error?s.message:String(s)}). Delete it and run \`rayfin dev\` to regenerate it from the udf.authClaims provider.`)}if(!o||typeof o!="object"||!o.claims||typeof o.claims!="object"||Array.isArray(o.claims))throw new Error(`${r} is malformed (missing a \`claims\` object). Delete it and run \`rayfin dev\` to regenerate it from the udf.authClaims provider.`);return{enabled:i,contract:o}}function Lr(e){let t=e?.staticHosting;if(t?.enabled!==!0)return{state:"not-applicable"};let n=t.assetAccess;return n!==void 0?J.some(r=>r===n)?{state:"authored",assetAccess:n}:{state:"invalid",value:n}:{state:"missing"}}function zt(e){let t=Lr(e);switch(t.state){case"not-applicable":return{status:"ok"};case"authored":return{status:"ok",assetAccess:t.assetAccess};case"invalid":return{status:"invalid-posture",value:t.value};case"missing":return{status:"missing"}}}var M=".fabric-app-metadata.json",Wt="<name>",I={settings:"rayfin.yml",data:"data/dab-config.json",storage:"storage/storage-config.json",connector:`connectors/${Wt}/dab-config.json`,static:"frontend/static-app.zip",functionsZip:"functions/functions-app.zip",functionsMetadata:"functions/deploymetadata.json"},W={auth:{component:"settings",partPaths:[I.settings]},data:{component:"data",partPaths:[I.data]},storage:{component:"storage",partPaths:[I.storage]},connectors:{component:"connector",partPaths:[I.connector]},staticHosting:{component:"static",partPaths:[I.static]},functions:{component:"functions",partPaths:[I.functionsZip,I.functionsMetadata]},telemetry:{component:"settings",partPaths:[I.settings]}},G=Object.keys(W),Qe=G.filter(e=>et(e)&&W[e].component!=="connector"),Ae=G.filter(e=>et(e)&&W[e].component!=="settings"),il=[...new Set([...oe("auth"),M,...G.filter(e=>e!=="auth").flatMap(e=>et(e)?oe(e):[])])],Ze={managed:"managed-app"},Gt={"managed-app":{allowedServices:["auth","data"]}};function K(e){return W[e].component}function oe(e){return W[e].partPaths}function $(e){let[t]=oe(e);if(!t)throw new Error(`Pack service '${e}' has no part path.`);return t}function Xt(e){return $("connectors").replace(Wt,e)}function et(e){return"component"in W[e]}var Mr=["default","managed-app"];function se(e){if(e===void 0)return"default";if(typeof e=="string")return Mr.includes(e)?e:Object.prototype.hasOwnProperty.call(Ze,e)?Ze[e]:void 0}function Re(e){return{blockers:[{code:"unknown-profile",profile:String(e)}]}}function ae(e){return e==="managed-app"?Gt["managed-app"].allowedServices:void 0}function Jt(e){let t=ae(e.profile);if(!t)return{skippedServices:[],excludeServices:e.excludeServices};let n=G.filter(r=>Kr(e.config,r)&&!t.includes(r));return{skippedServices:n,excludeServices:[...new Set([...e.excludeServices,...n.filter(r=>Ae.some(i=>i===r))])]}}function tt(e){let t=ae(e.profile);return t?e.excludeServices.filter(n=>t.includes(n)):e.excludeServices}function Qt(e,t,n){let r=ae(t.profile);if(!r)return;let i=new Set(tt(t)),o=[];for(let s of G)if(r.includes(s)&&!i.has(s)){let a=e[s]??n[s];a!==void 0&&o.push([s,a])}else o.push([s,{enabled:!1}]);return Object.fromEntries(o)}function Kr(e,t){return t==="connectors"?(e.connectors?.length??0)>0:e.services[t]?.enabled===!0}import{existsSync as nt,readdirSync as jr,realpathSync as Br,statSync as Hr}from"node:fs";import{dirname as Vr,isAbsolute as Yr,join as we,relative as rt,resolve as en,sep as qr}from"node:path";var tn=we("rayfin",".pack");function $e(e,t){return en(e,t??tn)}function it(e){return we(e,"rayfin",".temp")}function Zt(e){let t=en(e),n=t;for(;!nt(n);){let r=Vr(n);if(r===n)return t;n=r}try{return we(Br.native(n),rt(n,t))}catch{return t}}function zr(e,t){let n=rt(e,t);return n===""||!(n===".."||n.startsWith(`..${qr}`)||Yr(n))}function ve(e,t){let n=Zt(e),r=Zt(t),i=o=>({code:"unsafe-out-dir",outDir:t,reason:o});if(zr(r,n))return i("contains-project");if(rt($e(n,void 0),r)!==""&&nt(r)&&(!Hr(r).isDirectory()||jr(r).length>0&&!nt(we(r,M))))return i("not-pack-output")}import{createHash as Wr}from"node:crypto";import{mkdirSync as Gr,readFileSync as nn,writeFileSync as Xr}from"node:fs";import{dirname as Jr,join as rn}from"node:path";function on(e,t,n,r){let i=JSON.parse(nn(e,"utf8"));return Ne(t,n,ot(i),r)}function Ne(e,t,n,r){let i=n.endsWith(`
|
|
24
|
+
`)?n:`${n}
|
|
25
|
+
`,o=rn(e,...t.split("/"));return Gr(Jr(o),{recursive:!0}),Xr(o,i,"utf8"),sn(e,t,r)}function sn(e,t,n){let r=rn(e,...t.split("/")),i=nn(r);return{path:t,kind:n,sizeBytes:i.byteLength,sha256:Wr("sha256").update(i).digest("hex")}}function ot(e){return`${JSON.stringify(j(e),null,2)}
|
|
26
|
+
`}function j(e){return Array.isArray(e)?e.map(j):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>[t,j(n)])):e}var dn="https://aka.ms/rayfin/pack-metadata.schema.json",ei={writeStorage:"storage",writeConnectors:"connectors",writeStatic:"staticHosting",writeFunctions:"functions"};function ti(e){let t=e.diagnostics??B,n=e.env??{},r=e.extraGenerators??{},i=e.onBuildOutput??(a=>{let c=a.trimEnd();c&&t.debug({area:"data.build",message:c})});return{validate:async a=>{let c=await ri(a,r),l=e.extraValidate?await e.extraValidate(a):{blockers:[],warnings:[]};return{blockers:[...c.blockers,...l.blockers],warnings:[...c.warnings,...l.warnings]}},clean:ii,writeSettings:a=>oi(a,e.clientVersion),writeMetadata:a=>si(a,e.clientVersion),writeData:async a=>{let c=a.config.services.data;if(c?.enabled!==!0||a.excludeServices.includes("data"))return;let l=H(a.projectRoot,c.path);if(!c.buildCommand&&Ge(l)===null&&!fn(X(l,"rayfin","data"))){t.debug({area:"data.generate",message:"No entity sources found; skipping data part"});return}let m=await Ot({projectRoot:a.projectRoot,serviceRoot:l,dialect:c.dialect,buildCommand:c.buildCommand,runBuild:async(u,f)=>{let d=await Et(u,f,{env:n,onOutput:i});if(!d.success)throw new Error(`Data build command failed in "${u}": ${f}
|
|
27
|
+
${d.output}`);return!0},compile:u=>me(u,{env:n}),log:u=>{u.trim()&&t.debug({area:"data.generate",message:u})}});if(m.configPath)return on(m.configPath,a.outDir,$("data"),"data")},writeStorage:async()=>{},writeConnectors:async()=>[],writeStatic:async()=>{},writeFunctions:async()=>[],...r}}function fn(e){return st(e)?ln(e,{withFileTypes:!0}).some(t=>t.isDirectory()?fn(X(e,t.name)):/\.[cm]?tsx?$/u.test(t.name)&&!/\.d\.[cm]?ts$/u.test(t.name)):!1}function ni(e,t){if(t==="connectors")return(e.config.connectors?.length??0)>0;let n=e.config.services[t];return typeof n=="object"&&n!==null&&n.enabled===!0}async function ri(e,t){let n=[],r=[],i=new Set(e.excludeServices);st(X(e.projectRoot,"rayfin","rayfin.yml"))||n.push({code:"missing-rayfin-yml"});let o=ve(e.projectRoot,e.outDir);o&&n.push(o);for(let a of e.excludeServices)Ae.includes(a)||n.push({code:"unknown-exclude-service",service:a});for(let[a,c]of Object.entries(ei))!t[a]&&!i.has(c)&&ni(e,c)&&n.push({code:"unsupported-service",service:c});if(e.config.services.staticHosting?.enabled===!0&&!i.has("staticHosting")){let a=zt(e.config.services);a.status==="missing"?n.push({code:"static-hosting-posture-missing"}):a.status==="invalid-posture"&&n.push({code:"static-hosting-posture-invalid",value:a.value})}let s=hn(e.projectRoot);return s.length>0&&r.push({code:"direct-runtime-config-reads",files:s}),{blockers:n,warnings:r}}async function ii(e){let t=ve(e.projectRoot,e.outDir);if(t)throw new Error(`Refusing to clean ${e.outDir} (${t.code==="unsafe-out-dir"?t.reason:t.code}).`);Qr(e.outDir,{recursive:!0,force:!0}),an(e.outDir,{recursive:!0}),an(e.scratchDir,{recursive:!0})}async function oi(e,t){let n=tt(e),r=ae(e.profile),i=ui(e),o=e.excludeServices.includes("functions")?i:qt(i,e.projectRoot),s=Oe({services:di(o,n),connectors:r&&!r.includes("connectors")||n.includes("connectors")?void 0:pi(e.config.connectors),packageVersions:Je(e.projectRoot,e.config.services),clientVersion:t}),{connectors:a,packageVersions:c,...l}=s,m=Qt(l,e,mn)??ci(l,n),u={services:li(m),connectors:j(a),packageVersions:j(c)},f=(0,un.stringify)(u,{lineWidth:0}).replace(/\r\n/gu,`
|
|
28
|
+
`);return Ne(e.outDir,$("auth"),f,"settings")}async function si(e,t){let n=ot({$schema:dn,packageVersions:{...Je(e.projectRoot,e.config.services)},deploymentClient:ai(t)});return Ne(e.outDir,M,n,"metadata")}function ai(e){let t=e.indexOf("/");return t>0&&t<e.length-1?{client:e.slice(0,t),version:e.slice(t+1)}:{client:"rayfin-cli",version:e}}var mn={auth:{enabled:!1},data:{enabled:!1},storage:{enabled:!1}};function ci(e,t){let n=new Set(Qe),r=new Set(t),i=[];for(let o of Qe){if(r.has(o))continue;let s=e[o]??mn[o];s!==void 0&&i.push([o,s])}for(let o of Object.keys(e).filter(s=>!n.has(s)).sort((s,a)=>s.localeCompare(a)))i.push([o,e[o]]);return Object.fromEntries(i)}function li(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,j(n)]))}function ui(e){let t=structuredClone(e.config.services),n=t.auth;if(!Array.isArray(n.allowedRedirectUris))return t;let r=fi(e.projectRoot);return n.allowedRedirectUris=n.allowedRedirectUris.filter(i=>{let o=pn(i);return o?r.has(o)?!1:!mi(o):!0}),t}function di(e,t){let n=structuredClone(e);for(let r of t)delete n[r];return n}function fi(e){let t=X(e,"rayfin",".deployments.json");if(!st(t))return new Set;try{let n=JSON.parse(cn(t,"utf8"));return new Set(Object.values(n.deployments??{}).map(r=>r.hostingUrl&&pn(r.hostingUrl)).filter(r=>!!r))}catch{return new Set}}function pn(e){try{return new URL(e).origin}catch{return}}function mi(e){let t=new URL(e).hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t.endsWith(".localhost")}function pi(e){return e?[...e].sort((t,n)=>t.name.localeCompare(n.name)):void 0}function hn(e){let t=[],n=new Set(["node_modules",".git",".pack",".temp","dist","build"]),r=i=>{if(t.length>=20)return;let o;try{o=ln(i,{withFileTypes:!0})}catch{return}for(let s of o){if(t.length>=20)return;if(s.isDirectory())n.has(s.name)||r(X(i,s.name));else if(/\.(?:[cm]?[jt]sx?|vue|svelte)$/u.test(s.name)){let a=X(i,s.name),c;try{c=cn(a,"utf8")}catch{continue}/\b(?:VITE_RAYFIN_|NEXT_PUBLIC_RAYFIN_)/u.test(c)&&t.push(Zr(e,a))}}};return r(e),t}var Rn=fe(xn(),1);import{existsSync as lt,readFileSync as An}from"node:fs";import{join as Ni}from"node:path";import{isAbsolute as Sn,join as vi,resolve as Tn}from"node:path";function _n(e,t,n,r){if(t)return{path:Sn(t)?t:Tn(e,t),source:"cli-arg"};if(n.RAYFIN_ENV_FILE){let i=n.RAYFIN_ENV_FILE;return{path:Sn(i)?i:Tn(e,i),source:"env-var"}}return{path:vi(e,"rayfin",".env"),source:"default"}}function Pi(e){return lt(e)?(0,Rn.parse)(An(e)):{}}function wn(e){let{projectRoot:t,envFile:n}=e,r=e.env??{},i=Ni(t,"rayfin","rayfin.yml");if(!lt(i))return;let o=_n(t,n,r),s=e.requireExplicitEnvFile??!!n;if(o.path&&o.source==="cli-arg"&&s&&!lt(o.path))throw new Error(`Environment file not found: ${o.path}. Create the file or omit the explicit env-file setting.`);let a=new Map;if(o.path){let l;try{l=Pi(o.path)}catch(m){let u=m instanceof Error?m.message:String(m);throw new Error(`Failed to load .env file at ${o.path}: ${u}`)}for(let[m,u]of Object.entries(l))a.set(m,u)}for(let[l,m]of Object.entries(r))m!==void 0&&a.set(l,m);return{config:Ie(An(i,"utf-8"),a),configPath:i,envFile:o}}function Ii(e){if(!e.projectRoot)throw new TypeError("buildPackRequest: projectRoot is required.");let{projectRoot:t}=e,n=se(e.profile);if(!n)return N("pack-validation-failed","Pack validation failed: unknown-profile",Re(e.profile));let r;try{r=wn({projectRoot:t,env:e.env??{},envFile:e.envFile})}catch(i){return N("config-load-failed",`Failed to load rayfin/rayfin.yml: ${i instanceof Error?i.message:String(i)}`,i)}return r?Q({projectRoot:t,outDir:$e(t,e.outDir),scratchDir:it(t),config:r.config,excludeServices:e.excludeServices??[],profile:n,dryRun:e.dryRun??!1}):N("missing-rayfin-yml",`rayfin/rayfin.yml was not found under ${t}.`)}var ki=async(e,t)=>{let n=t.diagnostics??B,r=(a,c)=>n.debug({area:"pack",message:a,data:c}),i=e.profile,o=se(i);if(!o)return N("pack-validation-failed","Pack validation failed: unknown-profile",Re(i));let s={...e,profile:o};try{r("Starting pack",{projectRoot:s.projectRoot,outDir:s.outDir,profile:s.profile,dryRun:s.dryRun,excludeServices:s.excludeServices,enabledServices:Object.entries(s.config.services).filter(([,h])=>h?.enabled===!0).map(([h])=>h)});let a=Jt(s),c={...s,excludeServices:a.excludeServices},{skippedServices:l}=a;l.length>0&&r("Applied profile",{profile:s.profile,skippedServices:l});let m=await t.generators.validate(c);if(r("Validated project",{blockers:m.blockers.map(h=>h.code),warnings:m.warnings.map(h=>h.code),excludeServices:c.excludeServices}),m.blockers.length>0)return N("pack-validation-failed",`Pack validation failed: ${m.blockers.map(h=>h.code).join(", ")}`,{blockers:m.blockers});let u=async(h,g)=>{let b=Date.now(),C=await g(),le=C===void 0?[]:Array.isArray(C)?C:[C];return r(le.length===0?`${h}: nothing to write`:`${h}: wrote ${le.map(ue=>ue.path).join(", ")}`,{durationMs:Date.now()-b,...le.length>0?{parts:le.map(ue=>({path:ue.path,sizeBytes:ue.sizeBytes}))}:{}}),C};if(c.dryRun){let h=Fi(c);return Q({outDir:c.outDir,parts:h,warnings:m.warnings,resolvedVariables:[],dryRun:!0,skippedServices:l,hasDeployableContent:$n(h)})}await t.generators.clean(c),r("Cleaned output directory",{outDir:c.outDir});let f=t.generators,d=[await u("settings",()=>f.writeSettings(c)),await u("metadata",()=>f.writeMetadata(c)),...ut(await u("data",()=>f.writeData(c))),...ut(await u("storage",()=>f.writeStorage(c))),...await u("connectors",()=>f.writeConnectors(c)),...ut(await u("staticHosting",()=>f.writeStatic(c))),...await u("functions",()=>f.writeFunctions(c))].sort((h,g)=>h.path.localeCompare(g.path)),p=d.flatMap(h=>h.warnings??[]),y=d.map(({warnings:h,...g})=>g);return Q({outDir:c.outDir,parts:y,warnings:[...m.warnings,...p],resolvedVariables:[],dryRun:!1,skippedServices:l,hasDeployableContent:$n(y)})}catch(a){return N("pack-failed",a instanceof Error?a.message:String(a),a)}};function Fi(e){let t=[{path:M,kind:"metadata"},{path:$("auth"),kind:K("auth")}];if(e.config.services.data?.enabled===!0&&!e.excludeServices.includes("data")&&t.push({path:$("data"),kind:K("data")}),e.config.services.storage?.enabled===!0&&!e.excludeServices.includes("storage")&&t.push({path:$("storage"),kind:K("storage")}),(e.config.connectors??[]).length>0&&!e.excludeServices.includes("connectors"))for(let n of[...e.config.connectors??[]].sort((r,i)=>r.name.localeCompare(i.name)))t.push({path:Xt(n.name),kind:K("connectors")});if(e.config.services.staticHosting?.enabled===!0&&!e.excludeServices.includes("staticHosting")&&t.push({path:$("staticHosting"),kind:K("staticHosting")}),e.config.services.functions?.enabled===!0&&!e.excludeServices.includes("functions"))for(let n of oe("functions"))t.push({path:n,kind:K("functions")});return t.sort((n,r)=>n.path.localeCompare(r.path))}function $n(e){return e.some(t=>t.kind!=="metadata"&&t.kind!=="settings")}function ut(e){return e===void 0?[]:[e]}function Oi(e){return typeof e=="object"&&e!==null&&Array.isArray(e.blockers)}var Ql=1;export{tn as DEFAULT_PACK_OUT_DIR,Ql as PACK_API_VERSION,dn as PACK_METADATA_SCHEMA,Ii as buildPackRequest,ve as checkPackOutDir,ti as createNodePackGenerators,hn as findDirectRuntimeConfigReads,Oi as isPackValidationFailure,se as normalizePackProfile,$e as resolvePackOutDir,it as resolvePackScratchDir,ki as runPackWorkflow,sn as summarizePart};
|
|
29
|
+
//# sourceMappingURL=node-PLZPXPD7.js.map
|