@smartkomm/plexus-cli 0.1.100 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +2 -2
- package/dist/spec.snapshot.json +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -10784,7 +10784,7 @@ Ihr Aufnahme-Team`,noReplyNote:"Diese E-Mail wurde automatisch versandt. Bitte a
|
|
|
10784
10784
|
The admissions team`,noReplyNote:"This e-mail was sent automatically. Please do not reply to it."}},pH={de:{...Vl.de,closing:`Viele Gr\xFC\xDFe
|
|
10785
10785
|
Ihr Plexus-Team`},en:{...Vl.en,closing:`Kind regards
|
|
10786
10786
|
The Plexus team`}},mH={de:{...Vl.de,closing:null},en:{...Vl.en,closing:null}};var hH=/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g,Io=2e3;function bp(e){let n=[];for(let t of e.matchAll(hH)){let r=t[1];n.includes(r)||n.push(r)}return n}s(bp,"placeholdersIn");function YN(e){return e.slots??[]}s(YN,"slotsOf");function gH(e){return e.bodyVariants!==void 0?e.bodyVariants:[YN(e).filter(n=>n.key!==Sl).map(n=>n.key)]}s(gH,"bodyVariantsOf");var yH=/:\/\/|www\.|mailto:/i;function wH(e,n){let t=`{{${n}}}`,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)return!1;let o=i===0?"":e[i-1],a=e[i+t.length]??"";if(o!==""&&!/\s/.test(o)||a!==""&&!/[\s.,;:!?)]/.test(a))return!0;r=i+t.length}}s(wH,"linkGlued");function kH(e,n){let t=e.default[n];return(typeof t!="string"||t.length===0)&&F(`notifications: slot "${e.key}" has no "${n}" text`),t}s(kH,"defaultText");function HN(e,n,t){let r=[],i=YN(e),o=e.placeholders??[],a=o.map(u=>u.key),l=o.filter(u=>u.subjectSafe===!0).map(u=>u.key);for(let[u,f]of Object.entries(n)){let m=i.find(y=>y.key===u);if(m===void 0){r.push({slotKey:u,code:"unknownSlot",message:i.length===0?{de:`Der Brief \u201E${e.label}\u201C l\xE4sst sich nicht anpassen.`,en:`The letter "${e.label}" cannot be customized.`}:{de:`Der Baustein \u201E${u}\u201C geh\xF6rt nicht zum Brief \u201E${e.label}\u201C.`,en:`The block "${u}" does not belong to the letter "${e.label}".`}});continue}if(f.trim().length===0){r.push({slotKey:u,code:"empty",message:{de:`\u201E${m.label}\u201C darf nicht leer sein. Zum Entfernen den Baustein zur\xFCcksetzen.`,en:`"${m.label}" must not be empty. To remove it, reset the block.`}});continue}if(f.length>Io){r.push({slotKey:u,code:"tooLong",message:{de:`\u201E${m.label}\u201C ist ${f.length} Zeichen lang, erlaubt sind ${Io}.`,en:`"${m.label}" is ${f.length} characters long; the limit is ${Io}.`}});continue}if(VO(e)){yH.test(f)&&r.push({slotKey:u,code:"foreignUrl",message:{de:`\u201E${m.label}\u201C enth\xE4lt eine Adresse. Der Brief \u201E${e.label}\u201C tr\xE4gt einen Anmeldeschl\xFCssel und darf keine weiteren Links enthalten.`,en:`"${m.label}" contains an address. The letter "${e.label}" carries a sign-in key and must not contain any further links.`}});for(let y of o)y.link!==!0||!wH(f,y.key)||r.push({slotKey:u,code:"linkNotStandalone",message:{de:`\u201E{{${y.key}}}\u201C (${y.label}) muss f\xFCr sich stehen \u2014 davor und dahinter nur ein Leerzeichen, ein Zeilenumbruch oder ein Satzzeichen.`,en:`"{{${y.key}}}" (${y.label}) must stand on its own \u2014 only a space, a line break or punctuation before and after it.`}})}for(let y of bp(f)){if(!a.includes(y)){r.push({slotKey:u,code:"unknownPlaceholder",message:y===qr?{de:`\u201E{{${qr}}}\u201C (${aa}) geh\xF6rt in die Anrede des Briefrahmens, nicht in \u201E${m.label}\u201C \u2014 dort gibt es eine neutrale Anrede, wenn kein Name bekannt ist.`,en:`"{{${qr}}}" (${aa}) belongs in the greeting of the letter frame, not in "${m.label}" \u2014 the greeting has a neutral form for when no name is known.`}:a.length===0?{de:`Der Brief \u201E${e.label}\u201C kennt keine Platzhalter, \u201E{{${y}}}\u201C bliebe unersetzt stehen.`,en:`The letter "${e.label}" has no placeholders; "{{${y}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${y}}}\u201C gibt es in \u201E${e.label}\u201C nicht. Erlaubt: ${a.map(g=>`{{${g}}}`).join(", ")}.`,en:`"{{${y}}}" does not exist in "${e.label}". Allowed: ${a.map(g=>`{{${g}}}`).join(", ")}.`}});continue}if(u!==Sl||l.includes(y))continue;let k=o.find(g=>g.key===y)?.label??y;r.push({slotKey:u,code:"subjectUnsupported",message:{de:`\u201E{{${y}}}\u201C (${k}) l\xE4sst sich im Betreff nicht einsetzen \u2014 der Wert entsteht erst beim Versand. `+(l.length===0?"In diesem Brief kann der Betreff keine Platzhalter tragen.":`Im Betreff m\xF6glich: ${l.map(g=>`{{${g}}}`).join(", ")}.`),en:`"{{${y}}}" (${k}) cannot be used in the subject \u2014 the value only exists when the mail is sent. `+(l.length===0?"In this letter the subject cannot carry placeholders.":`Possible in the subject: ${l.map(g=>`{{${g}}}`).join(", ")}.`)}})}}let d=s(u=>n[u]??bH(i,u,t),"textOf"),c=gH(e);for(let u of o){if(u.required!==!0)continue;let f=c.filter(g=>!bp(g.map(d).join(`
|
|
10787
|
-
`)).includes(u.key));if(f.length===0)continue;let m=s((g,b)=>g.map(A=>b(i.find($=>$.key===A)?.label??A)).join(" + "),"variantLabel"),y=c.length===1?"":` Er fehlt in der Fassung aus ${f.map(g=>m(g,b=>`\u201E${b}\u201C`)).join(" und in der aus ")}.`,k=c.length===1?"":` It is missing in the version made of ${f.map(g=>m(g,b=>`"${b}"`)).join(" and in the one made of ")}.`;r.push({slotKey:u.key,code:"missingRequired",message:{de:`Ohne \u201E{{${u.key}}}\u201C (${u.label}) funktioniert der Brief \u201E${e.label}\u201C nicht \u2014 der Platzhalter muss im Text stehen, nicht nur im Betreff.`+y,en:`Without "{{${u.key}}}" (${u.label}) the letter "${e.label}" does not work \u2014 the placeholder must be in the text, not only in the subject.`+k}})}return r}s(HN,"validateOverride");function bH(e,n,t){let r=e.find(i=>i.key===n);return r===void 0?"":kH(r,t)}s(bH,"defaultTextOf");function ek(e){let n=e?.trim();return n===void 0||n.length===0?void 0:n}s(ek,"normalizeChromeText");var Oo=s(e=>String.fromCharCode(e),"cp"),vH=new RegExp(`[${Oo(0)}-${Oo(31)}${Oo(127)}]`,"g"),xH=new RegExp(`[${Oo(8234)}-${Oo(8238)}${Oo(8294)}-${Oo(8297)}]`,"g");var SH=200;function AH(e,n=SH){return e.replace(vH," ").replace(xH,"").replace(/\s+/g," ").trim().slice(0,n)}s(AH,"sanitizeHeaderValue");function vp(e){return AH(e.replace(/["<>@]/g,""),100)}s(vp,"sanitizeDisplayName");var nk={de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}},EH={greeting:{de:"Anrede",en:"Greeting"},closing:{de:"Gru\xDFformel",en:"Closing"}};function JN(e){let n=[],t=[];for(let i of["greeting","closing"]){let o=e[i];if(o===void 0)continue;let a=EH[i],l=Rn(o);l!=="not-localized"&&l.length>0&&l.length<ze.length&&t.push({de:`${a.de} fehlt auf ${l.map(d=>nk[d].de).join(" und ")}`,en:`${a.en} is missing in ${l.map(d=>nk[d].en).join(" and ")}`});for(let d of ze){let c=Fy(m=>`${a[m]} (${nk[d][m]})`),u=ek(o[d]);u!==void 0&&u.length>Io&&n.push({de:`${c.de} hat ${u.length} Zeichen \u2014 h\xF6chstens ${Io}; der Briefrahmen ist eine Zeile der Mail, kein Dokument.`,en:`${c.en} has ${u.length} characters \u2014 at most ${Io}; the letter frame is one line of the mail, not a document.`});let f=i==="greeting"?[qr]:[];for(let m of bp(u??""))f.includes(m)||n.push(f.length===0?{de:`${c.de} kann keine Platzhalter tragen \u2014 \u201E{{${m}}}\u201C bliebe unersetzt stehen.`,en:`${c.en} cannot carry placeholders \u2014 "{{${m}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${m}}}\u201C gibt es in der ${c.de} nicht. Erlaubt: {{${qr}}} (${aa}).`,en:`"{{${m}}}" does not exist in the ${c.en}. Allowed: {{${qr}}} (${aa}).`})}}t.length>0&&n.unshift({de:`[notification/chromeMissingTranslation] ${t.map(i=>i.de).join("; ")} \u2014 der Briefrahmen gilt f\xFCr jeden Brief, in jeder Sprache.`,en:`[notification/chromeMissingTranslation] ${t.map(i=>i.en).join("; ")} \u2014 the letter frame applies to every letter, in every language.`});let r=ek(e.senderName);return r!==void 0&&vp(r)!==r&&n.push({de:`Absendername (senderName) \u201E${r}\u201C \xFCbersteht die Kopfzeile der Mail nicht unver\xE4ndert \u2014 er ginge als \u201E${vp(r)}\u201C hinaus. Keine Anf\xFChrungszeichen, spitzen Klammern, \u201E@\u201C oder Steuerzeichen.`,en:`The sender name (senderName) "${r}" does not survive the mail header unchanged \u2014 it would go out as "${vp(r)}". No quotation marks, angle brackets, "@" or control characters.`}),n}s(JN,"chromeFindings");var QN=w.object({family:w.string()}),ZN=w.object({family:w.string(),url:w.optional(w.string())}),bke=w.object({heading:w.optional(ZN),body:w.optional(ZN)}),TH=w.union(w.literal("sharp"),w.literal("rounded"),w.literal("soft")),$H=w.union(w.literal("light"),w.literal("dark")),RH=w.union(w.literal("sm"),w.literal("md"),w.literal("lg"),w.literal("max")),IH=w.union(w.literal("compact"),w.literal("normal"),w.literal("spacious")),OH=w.object({primary:w.optional(w.string()),accent:w.optional(w.string()),background:w.optional(w.string()),foreground:w.optional(w.string())}),PH=w.object({heading:w.optional(QN),body:w.optional(QN)}),vke=w.object({colors:w.optional(OH),radius:w.optional(TH),logoSize:w.optional(RH),bannerDensity:w.optional(IH),logoGround:w.optional($H),filledHeader:w.optional(w.boolean()),websiteUrl:w.optional(w.string()),fonts:w.optional(PH)}),xke=w.object({primaryUrl:w.union(w.null(),w.string())}),Ske=w.literal("primary"),Ake=w.object({headingUrl:w.union(w.null(),w.string()),bodyUrl:w.union(w.null(),w.string())}),Eke=w.union(w.literal("heading"),w.literal("body")),xp=["logo","fontHeading","fontBody"],XN={logo:null,fontHeading:"heading",fontBody:"body"};function eC(e){let{contentType:n,size:t}=e;return n==null||!n.startsWith("image/")?{de:`Das Logo muss ein Bild sein (erhalten: \u201E${n??"unbekannt"}\u201C).`,en:`The logo must be an image (received: "${n??"unknown"}").`}:n.startsWith("image/svg")?{de:"Das Logo muss eine Rastergrafik sein (PNG, JPEG oder GIF) \u2013 E-Mail-Programme zeigen SVG nicht an.",en:"The logo must be a raster image (PNG, JPEG or GIF) \u2013 email clients do not display SVG."}:t>3e6?{de:`Das Logo ist zu gro\xDF (${t} Byte, h\xF6chstens 3000000 Byte).`,en:`The logo is too large (${t} bytes, at most 3000000 bytes).`}:null}s(eC,"logoFileProblem");var tk="font/woff2";var _H=["Inter Variable","Azeret Mono Variable","Source Sans 3 Variable"];function nC(e){return e?.trim()?_H.some(n=>n.toLowerCase()===e.trim().toLowerCase())?{de:`\u201E${e}\u201C ist die Schrift von Plexus selbst \u2013 w\xE4hlen Sie f\xFCr eine eigene Datei einen anderen Familiennamen.`,en:`"${e}" is Plexus's own typeface \u2013 choose a different family name for your own file.`}:null:{de:"Speichern Sie zuerst die Schriftfamilie \u2013 die Datei wird unter diesem Namen eingebunden.",en:"Save the font family first \u2013 the file is registered under that name."}}s(nC,"fontFamilyProblem");var NH=["approved","rejected","withdrawn","waitlist","expired"];var Sp=["admitted","rejected","withdrawn","waitlist","expired","unknown"],_ke=w.union(...NH.map(e=>w.literal(e))),Nke=w.union(...Sp.map(e=>w.literal(e))),CH=["approved","rejected","waitlist"],DH=["withdrawn","expired"],FH=w.union(...CH.map(e=>w.literal(e))),LH=w.union(...DH.map(e=>w.literal(e))),Cke={active:{status:w.literal("active")},completed:{status:w.literal("completed"),outcome:FH,endedAt:w.number()},aborted:{status:w.literal("aborted"),outcome:w.optional(LH),endedAt:w.number()}};var tC=30,rC=3650;var MH=w.object({admitted:w.optional(w.number()),rejected:w.optional(w.number()),withdrawn:w.optional(w.number()),expired:w.optional(w.number()),waitlist:w.optional(w.number()),unknown:w.optional(w.number())}),Kke=MH.fields,qH=s(e=>Sp.includes(e),"isClassification");function iC(e,n="tenant.retentionDays"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[retention/shape] ${n} must be an object of days per classification (got ${JSON.stringify(e)}).`];let t=[];for(let[r,i]of Object.entries(e)){if(!qH(r)){t.push(`[retention/unknownClassification] ${n}.${r} is no retention classification \u2014 one of ${Sp.join(", ")}.`);continue}(typeof i!="number"||!Number.isSafeInteger(i)||i<tC||i>rC)&&t.push(`[retention/days] ${n}.${r} must be a whole number of days from ${tC} to ${rC} (got ${JSON.stringify(i)}).`)}return t}s(iC,"retentionDaysFindings");var KH=["ad","ae","af","ag","ai","al","am","ao","aq","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bl","bm","bn","bo","bq","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mf","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","xk","ye","yt","za","zm","zw"],jH=new Set(KH);function Ap(e){return jH.has(e)}s(Ap,"isCountryCode");var rk=["off","always","deviating"],oC={mode:"deviating",defaultCountryCode:"de"};var BH=["street","plz","ort"];function UH(e){return BH.filter(n=>!e.has(n))}s(UH,"missingInvoiceAddressParts");var VH=new Set(["0-1-select","0-n-select"]);function sC(e){return e===void 0?null:new Set(e.properties.flatMap(n=>n.addressPart!==void 0&&eO(n.addressPart)?[n.addressPart]:[]))}s(sC,"declaredAddressParts");function GH(e){return VH.has(e)}s(GH,"isSelectFieldKind");function aC(e){let n=[];for(let o of e)if(o.isNationality&&(GH(o.kind)?o.listKind!=="country"&&n.push({code:"nationality/notCountryList",fieldKey:o.key}):n.push({code:"nationality/wrongFieldKind",fieldKey:o.key})),o.isAccountEmail&&o.kind!=="email"&&n.push({code:"accountEmail/wrongFieldKind",fieldKey:o.key}),o.isContactPhone&&o.kind!=="tel"&&n.push({code:"contactPhone/wrongFieldKind",fieldKey:o.key}),o.isInvoiceAddress)if(o.addressParts===null)n.push({code:"invoiceAddress/wrongFieldKind",fieldKey:o.key});else{let a=UH(o.addressParts);a.length>0&&n.push({code:"invoiceAddress/missingPart",fieldKey:o.key,parts:a})}let t=e.filter(o=>o.isAccountEmail);if(t.length>1)for(let o of t)n.push({code:"accountEmail/multiple",fieldKey:o.key});let r=e.filter(o=>o.isContactPhone);if(r.length>1)for(let o of r)n.push({code:"contactPhone/multiple",fieldKey:o.key});let i=e.filter(o=>o.isInvoiceAddress);if(i.length>1)for(let o of i)n.push({code:"invoiceAddress/multiple",fieldKey:o.key});return n}s(aC,"fieldRoleFindings");function lC(e,n,...t){let r=e[n.code];return r(n,...t)}s(lC,"wordListElementFinding");function dC(e,n){let t=[];for(let r of n){if(e.kind==="plain"){r.countryCode!==void 0&&t.push({code:"list/countryCodeOnPlain",elementKey:r.key,countryCode:r.countryCode});continue}r.countryCode===void 0?t.push({code:"list/countryCodeMissing",elementKey:r.key}):r.countryCode!==null&&!Ap(r.countryCode)&&t.push({code:"list/unknownCountryCode",elementKey:r.key,countryCode:r.countryCode})}return t}s(dC,"listElementCountryFindings");var WH={key:!0,tenant:!0,foundation:!0,source:!0,displayGroups:!0,lists:!0,roles:!0,fields:!0,roleFields:!0,contractRoleMappings:!0,templatePlaceholders:!0,searchTargets:!0,searchFilters:!0,partyResultIcons:!0,notificationLetters:!0,admission:!0,files:!0,agent:!0,deferredColumns:!0,ignoredColumns:!0},YH={slug:!0,name:!0,enabledModules:!0,permissions:!0,defaultApplicantGroupKey:!0,defaultEnrolleeRoleKey:!0,priceCriteriaFacts:!0,defaultInteressentRoleKey:!0,admissionFieldDisplayGroupKey:!0,defaultStartInProxy:!0,terms:!0,retentionDays:!0,mailLevel:!0,notificationChrome:!0,hideMailLevelNotice:!0,magicLinkLogin:!0,externalSignIn:!0,nationalityFlag:!0,adminSeesSignatureImages:!0,signatureStamp:!0,bankImportScope:!0,branding:!0,brandingAssets:!0,partyRetention:!0},HH=new Set(["enabledMailCategories","mailEnabled"]);function JH(e){let n=s((t,r,i)=>t.filter(o=>!Object.hasOwn(r,o)&&!(i==="tenant."&&HH.has(o))).map(o=>`[config/unknownKey] ${i}${o} is not a config field of this release \u2014 a typo, or a field a newer release introduced.`),"unknown");return[...n(Object.keys(e),WH,""),...n(Object.keys(e.tenant),YH,"tenant.")]}s(JH,"unknownKeyFindings");var cC=["plain","country"],QH={"list/countryCodeMissing":s(({elementKey:e},n)=>`Element "${n}.${e}" of a country list must state countryCode (null for no state).`,"list/countryCodeMissing"),"list/countryCodeOnPlain":s(({elementKey:e},n)=>`Element "${n}.${e}" carries countryCode, but list "${n}" is not kind "country".`,"list/countryCodeOnPlain"),"list/unknownCountryCode":s(({elementKey:e,countryCode:n},t)=>`Element "${t}.${e}" has unknown countryCode ${JSON.stringify(n)}.`,"list/unknownCountryCode")},ZH={"nationality/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isNationality but not a 0-1-select / 0-n-select.`,"nationality/wrongFieldKind"),"nationality/notCountryList":s(({fieldKey:e})=>`Field "${e}" is isNationality but its list is not kind "country".`,"nationality/notCountryList"),"accountEmail/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isAccountEmail but not an email field.`,"accountEmail/wrongFieldKind"),"accountEmail/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isAccountEmail fields \u2014 at most one per tenant.`,"accountEmail/multiple"),"contactPhone/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isContactPhone but not a tel field.`,"contactPhone/wrongFieldKind"),"contactPhone/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isContactPhone fields \u2014 at most one per tenant.`,"contactPhone/multiple"),"invoiceAddress/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isInvoiceAddress but not an object field.`,"invoiceAddress/wrongFieldKind"),"invoiceAddress/missingPart":s(({fieldKey:e,parts:n})=>`Field "${e}" is isInvoiceAddress but declares no property for the address part(s) ${n.join(", ")} (objectSchema.properties[].addressPart) \u2014 an invoice cannot print its address without them.`,"invoiceAddress/missingPart"),"invoiceAddress/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isInvoiceAddress fields \u2014 at most one per tenant.`,"invoiceAddress/multiple")};function XH(e){let n=ZH[e.code];return n(e)}s(XH,"roleText");function eJ(e){let n=[],t=e.tenant.nationalityFlag,r=typeof t=="object"&&t!==null?t:{},i=r.mode;if(rk.includes(i)||n.push(`[nationality/flagMode] tenant.nationalityFlag.mode must be one of ${rk.join(", ")} (got ${t===void 0?"no tenant.nationalityFlag":JSON.stringify(i??null)}).`),t!==void 0){let l=r.defaultCountryCode;(typeof l!="string"||!Ap(l))&&n.push(`[nationality/defaultCountryCode] tenant.nationalityFlag.defaultCountryCode must be a lowercase ISO 3166-1 alpha-2 code (got ${JSON.stringify(l??null)}).`)}let o=new Map;for(let l of e.lists){let d=l.kind;if(!cC.includes(d)){n.push(`[list/kind] List "${l.key}" has kind ${JSON.stringify(d??null)} \u2014 one of ${cC.join(", ")}.`);continue}o.set(l.key,l.kind);for(let c of dC({key:l.key,kind:l.kind},l.elements))n.push(`[${c.code}] ${lC(QH,c,l.key)}`)}let a=aC(e.fields.map(l=>({key:l.key,kind:l.type,listKind:l.listKey===void 0?null:o.get(l.listKey)??null,isNationality:l.isNationality===!0,isAccountEmail:l.isAccountEmail===!0,isContactPhone:l.isContactPhone===!0,isInvoiceAddress:l.isInvoiceAddress===!0,addressParts:l.type==="object"?sC(l.objectSchema??{properties:[]}):null})));for(let l of a)n.push(`[${l.code}] ${XH(l)}`);return n}s(eJ,"nationalityFindings");function uC(e){return bi(e)?.message.de??(e instanceof Error?e.message:String(e))}s(uC,"errorText");function mC(e,n={}){let t=[...JH(e)],r=[];try{LN(e.fields.map(v=>v.key),[])}catch(v){t.push(uC(v))}e.tenant.terms!==void 0&&t.push(...Xw(e.tenant.terms)),e.tenant.retentionDays!==void 0&&t.push(...iC(e.tenant.retentionDays)),UO(e.tenant.mailLevel)?e.tenant.mailLevel==="all"&&!gp(e.tenant.enabledModules,"notifications")&&t.push('[notification/levelWithoutModule] tenant.mailLevel is "all" but the notifications module is not enabled \u2014 only sign-in and security mail would go out. Enable the module or set "loginOnly".'):t.push(`[notification/mailLevel] tenant.mailLevel must be one of ${Ky.join(", ")} (got ${e.tenant.mailLevel===void 0?"nothing":JSON.stringify(e.tenant.mailLevel)}).`),"enabledMailCategories"in e.tenant&&t.push('[notification/mailCategoriesRetired] tenant.enabledMailCategories was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),"mailEnabled"in e.tenant&&t.push('[notification/mailEnabledRetired] tenant.mailEnabled was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),En(e.displayGroups.map(v=>v.key),"display group",t),En(e.lists.map(v=>v.key),"list",t),En(e.roles.map(v=>v.key),"role",t),En(e.fields.map(v=>v.key),"field",t),En(e.foundation.legalEntities.map(v=>v.key),"legal entity",t),En(e.foundation.units.map(v=>v.key),"unit",t),En(e.foundation.permissionGroups.map(v=>v.key),"permission group",t),"teams"in e.foundation&&t.push("foundation.teams is retired: a team is a permission group \u2014 move each team to foundation.permissionGroups (same key) and remove the block.");for(let v of e.foundation.users)"teamKeys"in v&&t.push(`User "${v.email}" carries teamKeys, retired: team membership is the user's permission-group membership.`);En(e.foundation.users.map(v=>v.key),"user",t),En((e.searchFilters??[]).map(v=>v.key),"search filter",t),En((e.searchTargets??[]).map(v=>v.objectPropertyKey===void 0?v.fieldKey:`${v.fieldKey}.${v.objectPropertyKey}`),"search target",t),En((e.partyResultIcons??[]).map(v=>v.key),"party result icon",t),En((e.templatePlaceholders??[]).map(v=>v.key),"template placeholder",t),En((e.notificationLetters??[]).map(hC),"notification letter",t),lJ(e.notificationLetters??[],t),dJ(e.tenant.notificationChrome,t),e.tenant.bankImportScope!==void 0&&!["sepa_only","full_statement"].includes(e.tenant.bankImportScope)&&t.push("tenant.bankImportScope must be sepa_only or full_statement."),e.tenant.hideMailLevelNotice!==void 0&&typeof e.tenant.hideMailLevelNotice!="boolean"&&t.push("tenant.hideMailLevelNotice must be true or false (the dashboard's mail-level notice)."),typeof e.tenant.magicLinkLogin!="boolean"&&t.push("tenant.magicLinkLogin must be true or false (the login page's sign-in link option)."),typeof e.tenant.adminSeesSignatureImages!="boolean"&&t.push("tenant.adminSeesSignatureImages must be true or false (whether a school administrator sees other accounts' signature images)."),typeof e.tenant.signatureStamp!="boolean"&&t.push("tenant.signatureStamp must be true or false (whether the school offers the signature stamp at the countersignature)."),CN(e.tenant.externalSignIn)||t.push(`[auth/externalSignIn] tenant.externalSignIn must be { mode: "permanentLink" }, { mode: "oneTimeLink" } or { mode: "periodLink", validDays: 1\u2013${Gw} } (how families sign in).`);let i=new Set(e.displayGroups.map(v=>v.key)),o=new Set(e.lists.map(v=>v.key)),a=new Set(e.roles.map(v=>v.key)),l=new Set(e.fields.map(v=>v.key)),d=new Map(e.fields.map(v=>[v.key,v])),c=new Set(e.foundation.legalEntities.map(v=>v.key)),u=new Set(e.foundation.units.map(v=>v.key)),f=new Set(e.foundation.permissionGroups.map(v=>v.key));gp(e.tenant.enabledModules,"bewerbungsmanagement")&&e.tenant.defaultApplicantGroupKey!==void 0&&(e.foundation.permissionGroups.find(R=>R.key===e.tenant.defaultApplicantGroupKey)?.permissions.includes("bewerbungsmanagement.applications.submitOwn")||t.push(`Default applicant group "${e.tenant.defaultApplicantGroupKey}" must grant submitOwn.`));let m=e.tenant.admissionFieldDisplayGroupKey;m!==void 0&&!i.has(m)&&t.push(`tenant.admissionFieldDisplayGroupKey "${m}" names no display group of this config.`),m===void 0&&(gp(e.tenant.enabledModules,"bewerbungsmanagement")||(e.admission?.fields.length??0)>0)&&t.push("tenant.admissionFieldDisplayGroupKey is required when admissions is enabled or admission.fields declares fields: it names the display group the fields an offer creates land in."),t.push(...eJ(e)),En(e.fields.flatMap(v=>(v.relationshipKinds??[]).map(R=>R.key)),"relationship kind",t);for(let v of e.fields){i.has(v.displayGroupKey)||t.push(`Field "${v.key}" references missing display group "${v.displayGroupKey}".`),tJ(v,t),v.formWritable===!0&&!Jw[v.type].fieldMapTarget&&t.push(`Field "${v.key}" is formWritable, but a form cannot write a "${v.type}" field.`),v.type==="files"&&v.shareable===!0&&t.push(`[field/filesShareable] Field "${v.key}" is a files field and cannot be shareable.`),v.type==="auto-string"?rJ(v,d,t):v.autoString!==void 0&&t.push(`Non-automatic field "${v.key}" must not define autoString.`),(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Field "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`),(v.type==="0-1-select"||v.type==="0-n-select")&&!v.listKey&&t.push(`Select field "${v.key}" must define listKey.`),v.type!=="0-1-select"&&v.type!=="0-n-select"&&v.listKey!==void 0&&t.push(`Non-select field "${v.key}" must not define listKey.`),v.listKey&&!o.has(v.listKey)&&t.push(`Field "${v.key}" references missing list "${v.listKey}".`),(v.type==="object"||v.type==="relationship")&&!v.objectSchema&&t.push(`Field "${v.key}" must define objectSchema.`),v.type!=="object"&&v.type!=="relationship"&&v.objectSchema&&t.push(`Non-object field "${v.key}" must not define objectSchema.`);for(let R of v.objectSchema?.properties??[])(R.type==="0-1-select"||R.type==="0-n-select")&&!R.listKey&&t.push(`Object select property "${v.key}.${R.key}" must define listKey.`),R.listKey&&!o.has(R.listKey)&&t.push(`Object property "${v.key}.${R.key}" references missing list "${R.listKey}".`);nJ(v,t)}let y=e.tenant.priceCriteriaFacts;if(y){let v=e.fields.find(R=>R.key===y.birthDateFieldKey);(!v||v.type!=="date")&&t.push("Price criteria require a configured date field for birth dates."),a.has(y.studentRoleKey)||t.push("Price criteria require a configured Student eligibility role."),y.siblingRankSource!==void 0&&y.siblingRankSource!=="derived"&&y.siblingRankSource!=="chosen"&&t.push('Price criteria siblingRankSource must be "derived" or "chosen".');for(let R of Object.keys(y))R!=="birthDateFieldKey"&&R!=="studentRoleKey"&&R!=="siblingRankSource"&&t.push(`Unknown price criteria fact setting "${R}".`)}let k=e.tenant.defaultEnrolleeRoleKey;k&&!a.has(k)&&t.push(`Default enrollment role "${k}" does not exist.`),k&&e.roles.some(v=>v.parentRoleKey===k)&&t.push(`Default enrollment role "${k}" must be a leaf role.`);for(let v of e.roles){(typeof v.icon!="string"||v.icon.trim().length===0)&&t.push(`Role "${v.key}" must define an icon.`),v.parentRoleKey&&!a.has(v.parentRoleKey)&&t.push(`Role "${v.key}" references missing parent role "${v.parentRoleKey}".`);for(let R of v.listDisplayFieldKeys??[])l.has(R)||t.push(`Role "${v.key}" list display references missing field "${R}".`)}let g=new Map(e.roles.map(v=>[v.key,v.parentRoleKey])),b=new Map;for(let v of e.roleFields){let R=b.get(v.roleKey)??[];R.push({roleId:v.roleKey,customFieldId:v.fieldKey}),b.set(v.roleKey,R)}for(let v of e.roles)try{DN(v.key,g,b)}catch(R){t.push(uC(R))}for(let v of e.roleFields){a.has(v.roleKey)||t.push(`Role field references missing role "${v.roleKey}" for field "${v.fieldKey}".`),l.has(v.fieldKey)||t.push(`Role field references missing field "${v.fieldKey}" for role "${v.roleKey}".`);for(let R of v.targetRequirementFieldKeys??[])l.has(R)||t.push(`Role field "${v.roleKey}.${v.fieldKey}" references missing target requirement field "${R}".`)}aJ(e.contractRoleMappings??[],a,t);for(let v of e.templatePlaceholders??[])fN.test(v.key)||t.push(`Template placeholder "${v.key}" must use lower_snake_case segments, optionally separated by dots.`),v.source.kind==="customField"?Ep(v.source,d,t,`Template placeholder "${v.key}"`):v.source.kind==="relationshipTargetField"&&iJ(v,d,t);for(let v of e.searchTargets??[])Ep(v,d,t,"Search target");for(let v of e.fields)BN(v.key)&&(v.defaultValue!==void 0||v.validations!==void 0)&&t.push(`System field "${v.key}" takes no defaultValue or validations.`);for(let v of e.lists)En(v.elements.map((R,K)=>String(R.sortOrder??(K+1)*10)),`sortOrder of an element of list "${v.key}"`,t);for(let v of e.searchFilters??[])En((v.options??[]).map((R,K)=>String(R.sortOrder??(K+1)*10)),`sortOrder of an option of search filter "${v.key}"`,t);for(let v of e.foundation.permissionGroups){v.grantAllCustomFields===!0&&v.customFieldPermissions!==void 0&&t.push(`Permission group "${v.key}" states both grantAllCustomFields and customFieldPermissions \u2014 one of them.`),En((v.customFieldPermissions??[]).map(R=>R.displayGroupKey),`display group of a field permission of group "${v.key}"`,t);for(let R of v.customFieldPermissions??[]){i.has(R.displayGroupKey)||t.push(`Permission group "${v.key}" grants field permissions on missing display group "${R.displayGroupKey}".`);for(let K of R.permissions)qN.includes(K)||t.push(`Permission group "${v.key}" grants unknown field permission "${K}".`)}}let A=e.tenant.partyRetention;A!==void 0&&(jN(A.days)||t.push(`tenant.partyRetention.days must be a whole number of days from 1 to ${36500} (got ${JSON.stringify(A.days)}).`),Number.isFinite(A.enabledAt)||t.push("tenant.partyRetention.enabledAt must be a timestamp (epoch ms)."),A.formerRoleKey!==void 0&&!a.has(A.formerRoleKey)&&t.push(`tenant.partyRetention references missing role "${A.formerRoleKey}".`));for(let v of e.searchFilters??[]){(v.kind==="chips"||v.kind==="select")&&(v.options?.length??0)===0&&t.push(`Search filter "${v.key}" must define options.`),(v.kind==="text"||v.kind==="numberRange")&&v.target===void 0&&t.push(`Search filter "${v.key}" must define a target field.`),v.options!==void 0&&En(v.options.map(R=>R.key),`search filter option for "${v.key}"`,t),Ep(v.target,d,t,`Search filter "${v.key}"`);for(let R of v.options??[]){R.predicates.length===0&&t.push(`Search filter option "${v.key}.${R.key}" must define at least one predicate.`);for(let K of R.predicates){if(K.kind==="role"){a.has(K.roleKey)||t.push(`Search filter option "${v.key}.${R.key}" references missing role "${K.roleKey}".`);continue}Ep(K,d,t,`Search filter option "${v.key}.${R.key}"`)}}}for(let v of e.partyResultIcons??[])oJ(v,d,t);for(let v of e.foundation.legalEntities)if(v.terms!==void 0&&t.push(...Xw(v.terms,`foundation.legalEntities.${v.key}.terms`)),fC(v.branding,t,`foundation.legalEntities.${v.key}.branding`),pC(v,t,`foundation.legalEntities.${v.key}`),v.signatoryUserKey!==void 0&&v.type==="school_group"&&t.push(`[config/signatoryOnGroup] Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) declares an Unterschriftsperson.`),v.parentLegalEntityKey&&!c.has(v.parentLegalEntityKey)&&t.push(`Legal entity "${v.key}" references missing parent "${v.parentLegalEntityKey}".`),v.address!==void 0){let R=v.address,K=["street","hausnr","plz","ort"];v.type==="school_group"?t.push(`Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) has an address.`):(typeof R!="object"||R===null||Array.isArray(R)||Object.keys(R).some(N=>!K.includes(N))||K.some(N=>typeof R[N]!="string"||(R[N]??"").trim()===""))&&t.push(`Legal entity "${v.key}" has an invalid address \u2014 expected { street, hausnr, plz, ort }, each non-empty.`)}let $=new Map;for(let v of e.foundation.units){if(v.slug!==void 0){let R=typeof v.slug=="string"?AN(v.slug):"must be a string";R!==void 0&&t.push(`Unit "${v.key}" has invalid slug "${v.slug}" (${R}).`);let K=$.get(v.slug);K!==void 0&&t.push(`Units "${K}" and "${v.key}" both declare slug "${v.slug}" (unit slugs are unique per tenant).`),$.set(v.slug,v.key)}c.has(v.legalEntityKey)||t.push(`Unit "${v.key}" references missing legal entity "${v.legalEntityKey}".`),v.parentUnitKey&&!u.has(v.parentUnitKey)&&t.push(`Unit "${v.key}" references missing parent unit "${v.parentUnitKey}".`),v.chargeReviewEnabled!==void 0&&typeof v.chargeReviewEnabled!="boolean"&&t.push(`Unit "${v.key}": chargeReviewEnabled must be true or false.`),v.sortOrder!==void 0&&(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Unit "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`)}let O=/^[0-9a-f]{32}:[0-9a-f]{128}$/;for(let v of e.foundation.users){f.has(v.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${v.permissionGroupKey}".`),v.unitKey&&!u.has(v.unitKey)&&t.push(`User "${v.email}" references missing unit "${v.unitKey}".`),v.status!==void 0&&v.status!=="deactivated"&&t.push(`User "${v.email}": status must be "deactivated" or absent, not "${String(v.status)}".`);let R=[v,...v.additionalMemberships??[]];for(let N of v.additionalMemberships??[])f.has(N.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${N.permissionGroupKey}".`),N.unitKey&&!u.has(N.unitKey)&&t.push(`User "${v.email}" references missing unit "${N.unitKey}".`);En(R.map(N=>`${N.permissionGroupKey}/${N.unitKey??""}`),`membership (permission group/unit) of user "${v.email}"`,t);for(let N of R)N.validFrom!==void 0&&N.validTo!==void 0&&N.validTo<=N.validFrom&&t.push(`User "${v.email}": membership "${N.permissionGroupKey}" ends (validTo) before it starts (validFrom).`);let K=[v.firstName,v.lastName];K.some(N=>N!==void 0)&&K.some(N=>typeof N!="string"||N.trim()==="")&&t.push(`[config/userNameIncomplete] User "${v.email}" states only part of firstName/lastName (or an empty one) \u2014 set both or neither.`);for(let N of["staging","prod"]){let Y=v.passwordHashes?.[N];Y!==void 0&&!O.test(Y)&&t.push(`User "${v.email}" passwordHashes.${N} is not in Better Auth scrypt format "<32hex>:<128hex>".`)}}fC(e.tenant.branding,t),pC(e.tenant,t);let E=gC(e.fields.flatMap(v=>v.sourceColumns));for(let v of E)r.push(`Source column "${v}" is mapped by more than one field.`);fJ(e,t);let I=n.sourceColumns===void 0||e.source===void 0?void 0:cJ(e,n.sourceColumns,t);return{ok:t.length===0,errors:t,warnings:r,coverage:I}}s(mC,"validateTenantConfig");function nJ(e,n){let t=new Map;for(let r of e.objectSchema?.properties??[]){let i=r.addressPart;if(i===void 0)continue;let o=`Object property "${e.key}.${r.key}"`;if(!vy.includes(i)){n.push(`${o}: addressPart "${i}" is none of ${vy.join(", ")}.`);continue}e.type!=="object"&&n.push(`${o}: only an object field stores an address (addressPart).`),r.type!=="string"&&n.push(`${o}: addressPart "${i}" needs a string property, not "${r.type}".`);let a=t.get(i);a!==void 0&&n.push(`${o}: addressPart "${i}" is already declared by "${e.key}.${a}".`),t.set(i,r.key)}}s(nJ,"validateAddressParts");function tJ(e,n){let t=e.relationshipKinds;if(t===void 0)return;if(e.type!=="relationship"){n.push(`Field "${e.key}" declares relationshipKinds, but only a relationship field carries them.`);return}let r=new Map((e.objectSchema?.properties??[]).map(i=>[i.key,i]));for(let i of t){let o=`Field "${e.key}" relationship kind "${i.key}"`;if(typeof i.key!="string"||i.key.trim()===""){n.push(`Field "${e.key}": a relationship kind needs a key.`);continue}for(let l of["de","en"])(i.label?.[l]??"").trim()===""&&n.push(`${o}: label.${l} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);if(i.edge===null||typeof i.edge!="object"||Array.isArray(i.edge)){n.push(`${o}: edge must be an object.`);continue}i.sibling!==void 0&&i.sibling!==!0&&n.push(`${o}: sibling must be true or absent.`),i.sibling===!0&&i.mergeInto!==void 0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare mergeInto.`);let a=t.flatMap(l=>l.mergeInto!==void 0?[l.mergeInto]:[]);if(i.sibling===!0&&a.some(l=>l in i.edge)&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare a property another kind of the field merges into.`),i.sibling===!0&&Object.keys(i.edge).length===0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 an empty edge would count every edge of the field.`),i.mergeInto!==void 0){let l=r.get(i.mergeInto);l===void 0||l.type!=="0-n-select"?n.push(`${o}: mergeInto "${i.mergeInto}" must name a 0-n-select property of the field's objectSchema.`):Array.isArray(i.edge[i.mergeInto])||n.push(`${o}: mergeInto "${i.mergeInto}" must be set to a list in the edge.`)}}}s(tJ,"validateRelationshipKinds");function rJ(e,n,t){if(e.autoString===void 0){t.push(`Automatic field "${e.key}" must define autoString.`);return}e.allowMultiple===!0&&t.push(`Automatic field "${e.key}" must not allow multiple values.`),e.shareable===!0&&t.push(`Automatic field "${e.key}" must not be shareable.`),e.autoString.segments.length===0&&t.push(`Automatic field "${e.key}" must define at least one segment.`),e.autoString.segments.filter(i=>i.kind==="sequence").length!==1&&t.push(`Automatic field "${e.key}" must define exactly one sequence segment.`);for(let i of e.autoString.segments)if(i.kind==="literal"&&i.value.length===0&&t.push(`Automatic field "${e.key}" has an empty literal segment.`),i.kind==="sequence"&&(i.startAt!==void 0&&(!Number.isInteger(i.startAt)||i.startAt<1)&&t.push(`Automatic field "${e.key}" sequence startAt must be an integer >= 1.`),i.minDigits!==void 0&&(!Number.isInteger(i.minDigits)||i.minDigits<0)&&t.push(`Automatic field "${e.key}" sequence minDigits must be an integer >= 0.`)),i.kind==="field"){let o=n.get(i.fieldKey);if(o===void 0){t.push(`Automatic field "${e.key}" references missing field "${i.fieldKey}".`);continue}i.objectPropertyKey!==void 0&&o.objectSchema?.properties.find(l=>l.key===i.objectPropertyKey)===void 0&&t.push(`Automatic field "${e.key}" references missing object property "${i.fieldKey}.${i.objectPropertyKey}".`)}}s(rJ,"validateAutomaticStringField");function Ep(e,n,t,r){if(e===void 0)return;let i=n.get(e.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.fieldKey}".`);return}if(e.objectPropertyKey===void 0)return;(i.objectSchema?.properties.some(a=>a.key===e.objectPropertyKey)??!1)||t.push(`${r} references missing object property "${e.fieldKey}.${e.objectPropertyKey}".`)}s(Ep,"validateSearchTarget");function iJ(e,n,t){if(e.source.kind!=="relationshipTargetField")return;let r=`Template placeholder "${e.key}"`,i=n.get(e.source.relationshipFieldKey);if(i===void 0)t.push(`${r} references missing relationship field "${e.source.relationshipFieldKey}".`);else if(i.type!=="relationship")t.push(`${r} relationship field "${e.source.relationshipFieldKey}" must be a relationship field.`);else{for(let a of e.source.edgeFilters??[])ik(i,a.propertyKey,t,`${r} edge filter`);e.source.selection?.sortPropertyKey!==void 0&&ik(i,e.source.selection.sortPropertyKey,t,`${r} selection sort`)}let o=n.get(e.source.targetFieldKey);if(o===void 0){t.push(`${r} references missing target field "${e.source.targetFieldKey}".`);return}o.type==="relationship"&&t.push(`${r} target field "${e.source.targetFieldKey}" must not be a relationship field.`),e.source.targetObjectPropertyKey!==void 0&&ik(o,e.source.targetObjectPropertyKey,t,`${r} target`)}s(iJ,"validateRelationshipTemplatePlaceholder");function ik(e,n,t,r){(e.objectSchema?.properties.some(o=>o.key===n)??!1)||t.push(`${r} references missing object property "${e.key}.${n}".`)}s(ik,"validateObjectPropertyReference");function oJ(e,n,t){let r=`Party result icon "${e.key}"`,i=n.get(e.when.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.when.fieldKey}".`);return}if(e.when.objectPropertyKey===void 0){i.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`);return}let o=i.objectSchema?.properties.find(a=>a.key===e.when.objectPropertyKey);if(o===void 0){t.push(`${r} references missing object property "${e.when.fieldKey}.${e.when.objectPropertyKey}".`);return}o.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`)}s(oJ,"validatePartyResultIconTarget");function hC(e){return`${e.templateId}:${e.locale}:${e.scopeKey}`}s(hC,"letterIdentity");function sJ(e){return`${e.generatorKey??"*"}/${e.partyKind}/${e.roleKey}`}s(sJ,"contractRoleMappingIdentity");function aJ(e,n,t){let r=new Set;for(let i of e){let o=sJ(i),a=`Contract role mapping "${o}"`;zw.includes(i.partyKind)||t.push(`${a}: partyKind must be one of ${zw.join(", ")}.`),n.has(i.roleKey)||t.push(`${a} references missing role "${i.roleKey}".`),i.generatorKey!==void 0&&i.generatorKey.trim()===""&&t.push(`${a}: generatorKey must not be blank \u2014 omit it for the tenant default.`),r.has(o)&&t.push(`${a} is declared twice.`),r.add(o)}}s(aJ,"validateContractRoleMappings");function lJ(e,n){for(let t of e){let r=`Notification letter "${hC(t)}"`;if(!kp(t.locale)){n.push(`${r} declares locale "${String(t.locale)}" \u2014 letters are written in ${ze.map(i=>`"${i}"`).join(" and ")} only, so no mail would ever read this deviation.`);continue}if(t.scopeKey!==yp){n.push(`${r} declares scopeKey "${t.scopeKey}" \u2014 the only scope is "${yp}" (the whole school).`);continue}if(Object.keys(t.slots).length===0){n.push(`${r} overrides no block. A deviation that deviates in nothing is not an entry \u2014 remove it.`);continue}if(!Wy(t.templateId)){n.push(`${r} references no registered letter \u2014 "${t.templateId}" is not in the letter catalog.`);continue}for(let i of HN(zy(t.templateId),t.slots,t.locale))n.push(`${r}, block "${i.slotKey}" [${i.code}]: ${i.message.de}`)}}s(lJ,"validateNotificationLetters");function dJ(e,n){if(e!==void 0)for(let t of JN(e))n.push(`Notification chrome: ${t.de}`)}s(dJ,"validateNotificationChrome");function fC(e,n,t){if(e===void 0)return;let r=t===void 0?n:{push:s((...f)=>n.push(...f.map(m=>`${t}: ${m}`)),"push")},i=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,o=/^(?:rgb|rgba|hsl|hsla)\(.+\)$/i,a=s(f=>i.test(f.trim())||o.test(f.trim()),"isColor");for(let[f,m]of Object.entries(e.colors??{}))m!==void 0&&(a(m)||r.push(`Branding color "colors.${f}" has invalid value "${m}" (expected hex "#rgb"/"#rrggbb"/"#rrggbbaa" or rgb()/rgba()/hsl()/hsla()).`));let l=["sharp","rounded","soft"];e.radius!==void 0&&!l.includes(e.radius)&&r.push(`Branding radius "${e.radius}" is invalid (expected "sharp", "rounded", or "soft").`);let d=["sm","md","lg","max"];e.logoSize!==void 0&&!d.includes(e.logoSize)&&r.push(`Branding logoSize "${e.logoSize}" is invalid (expected "sm", "md", "lg", or "max").`);let c=["compact","normal","spacious"];e.bannerDensity!==void 0&&!c.includes(e.bannerDensity)&&r.push(`Branding bannerDensity "${e.bannerDensity}" is invalid (expected "compact", "normal", or "spacious").`);let u=["light","dark"];e.logoGround!==void 0&&!u.includes(e.logoGround)&&r.push(`Branding logoGround "${e.logoGround}" is invalid (expected "light" or "dark").`),e.websiteUrl!==void 0&&!e.websiteUrl.startsWith("https://")&&r.push(`Branding websiteUrl must be an https:// URL (got "${e.websiteUrl}").`);for(let f of["heading","body"]){let m=e.fonts?.[f];m!==void 0&&((typeof m.family!="string"||m.family.trim().length===0)&&r.push(`Branding font "fonts.${f}" must define a non-empty family.`),Object.hasOwn(m,"url")&&r.push(`Branding font "fonts.${f}.url" is no longer supported \u2014 the font file is uploaded (plexus-cli branding set-font --slot ${f} --file <woff2>) and config carries the family only.`))}}s(fC,"validateBranding");function pC(e,n,t="tenant"){let r=e.brandingAssets;if(r!==void 0){if(typeof r!="object"||r===null||Array.isArray(r)){n.push(`${t}.brandingAssets must be an object keyed by slot (${xp.join(", ")}).`);return}for(let[i,o]of Object.entries(r)){let a=`${t}.brandingAssets.${i}`;if(!xp.includes(i)){n.push(`${a}: unknown slot (expected ${xp.join(", ")}).`);continue}if(typeof o!="object"||o===null){n.push(`${a}: must be { sha256, sizeBytes, mimeType }.`);continue}if("size"in o){n.push(`[config/fileRefRenamed] ${a} still names size \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}yC.test(o.sha256??"")||n.push(`${a}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(o.sizeBytes)||o.sizeBytes<=0)&&n.push(`${a}: sizeBytes must be a positive integer.`);let l=XN[i];if(l===null){let d=eC({contentType:o.mimeType,size:o.sizeBytes});d!==null&&n.push(`${a}: ${d.de}`)}else{o.mimeType!==tk&&n.push(`${a}: mimeType must be "${tk}" (got "${o.mimeType}").`);let d=nC(e.branding?.fonts?.[l]?.family);d!==null&&n.push(`${a}: [branding/fontFamilyMissing] ${t}.branding.fonts.${l}: ${d.de}`)}"path"in o&&n.push(`${a}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}}s(pC,"validateBrandingAssets");function cJ(e,n,t){let{source:r}=e;r===void 0&&F("validateSourceCoverage: called without a `source` block.");let i=new Set(n),o=new Set(e.fields.flatMap(k=>k.sourceColumns)),a=new Set(e.deferredColumns.map(k=>k.column)),l=new Set(e.ignoredColumns.map(k=>k.column)),d=new Set([...o,...a,...l]),c=r.requiredColumns.filter(k=>!i.has(k)),u=n.filter(k=>!d.has(k)),f=[...o].filter(k=>!i.has(k)),m=[...a].filter(k=>!i.has(k)),y=[...l].filter(k=>!i.has(k));for(let k of c)t.push(`Required source column "${k}" is missing from ${r.primaryTable}.`);for(let k of u)t.push(`Source column "${k}" is neither mapped nor explicitly deferred/ignored.`);for(let k of f)t.push(`Mapped source column "${k}" does not exist in the source schema.`);for(let k of m)t.push(`Deferred source column "${k}" does not exist in the source schema.`);for(let k of y)t.push(`Ignored source column "${k}" does not exist in the source schema.`);return{table:r.primaryTable,availableColumns:n.length,mappedColumns:[...o].filter(k=>i.has(k)).length,deferredColumns:[...a].filter(k=>i.has(k)).length,ignoredColumns:[...l].filter(k=>i.has(k)).length,missingRequiredColumns:c,unmappedColumns:u,unknownMappedColumns:f,unknownDeferredColumns:m,unknownIgnoredColumns:y}}s(cJ,"validateSourceCoverage");function En(e,n,t){for(let r of gC(e))t.push(`Duplicate ${n} key "${r}".`)}s(En,"requireUnique");function gC(e){let n=new Set,t=new Set;for(let r of e)n.has(r)&&t.add(r),n.add(r);return[...t]}s(gC,"duplicates");var yC=/^[0-9a-f]{64}$/,uJ=["fileName","size"];function fJ(e,n){if(!Array.isArray(e.files)){n.push('"files" is missing \u2014 declare the file library (an empty list is fine).');return}En(e.files.map(t=>t.key),"file",n);for(let t of e.files){let r=`files["${t.key}"]`;ea(t.key)||n.push(`${r}: key must match ${vw}.`);for(let o of["de","en"])(t.label?.[o]??"").trim()===""&&n.push(`${r}: label.${o} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);let i=uJ.filter(o=>o in t);if(i.length>0){n.push(`[config/fileRefRenamed] ${r} still names ${i.join(", ")} \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now filename / sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}if(typeof t.filename!="string")n.push(`${r}: filename is missing.`);else{let o=To(t.filename);o!==null&&n.push(`${r}: filename ${o}.`)}wp.includes(t.mimeType)||n.push(`${r}: mimeType "${t.mimeType}" is not allowed (${wp.join(", ")}).`),yC.test(t.sha256??"")||n.push(`${r}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(t.sizeBytes)||t.sizeBytes<=0)&&n.push(`${r}: sizeBytes must be a positive integer.`),"path"in t&&n.push(`${r}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}s(fJ,"validateFiles");var pJ=new WeakMap,mJ=new WeakSet;function ok(e,n){n(e);let r=e.asOptional.bind(e);return Object.defineProperty(e,"asOptional",{value:s(()=>ok(r(),n),"value"),enumerable:!1}),e}s(ok,"carry");function la(e,n){return ok(e,t=>pJ.set(t,n))}s(la,"tagged");var hJ="tenant teardown drains every table explicitly (config/wipe.ts)",Yn={belongsTo:s(e=>la(e,{kind:"belongsTo"}),"belongsTo"),owns:s(e=>la(e,{kind:"owns"}),"owns"),holds:s(e=>la(e,{kind:"holds"}),"holds"),restrict:s((e,n)=>la(e,n?{kind:"restrict",unindexed:n.unindexed}:{kind:"restrict"}),"restrict"),history:s(e=>la(e,{kind:"history"}),"history"),tenant:s(e=>la(e,{kind:"restrict",unindexed:hJ}),"tenant"),historyOf:s(e=>ok(e,n=>mJ.add(n)),"historyOf")};var gJ=w.object({street:w.string(),hausnr:w.string(),plz:w.string(),ort:w.string()}),wC=w.union(w.literal("school_operator"),w.literal("school_group"),w.literal("service_entity")),Kr=wC.members.map(e=>e.value),yJ={tenantId:Yn.tenant(w.id("tenants")),name:w.optional(w.string()),type:wC,parentLegalEntityId:w.optional(Yn.restrict(w.id("legal_entities"))),configKey:w.optional(w.string()),partyId:w.optional(Yn.restrict(w.id("parties"))),address:w.optional(gJ),signatoryUserId:w.optional(Yn.restrict(w.id("users"))),terms:w.optional(WN)},Fbe=Jr(yJ).index("by_tenantId",["tenantId"]).index("by_parentLegalEntityId",["parentLegalEntityId"]).index("by_tenantId_and_configKey",["tenantId","configKey"]).index("by_partyId",["partyId"]).index("by_signatoryUserId",["signatoryUserId"]);var wJ=w.union(w.literal("school"),w.literal("kindergarten"),w.literal("after_school_care"),w.literal("department"),w.literal("site"),w.literal("other")),Ft=wJ.members.map(e=>e.value),qbe=w.union(w.literal("school"),w.literal("vocational"),w.literal("care"),w.literal("seminar"),w.literal("other")),Kbe=w.union(w.literal("none"),w.literal("manual"),w.literal("annual_rollover")),jbe=w.union(w.literal("grade_level"),w.literal("module"),w.literal("phase"),w.literal("other")),Bbe=w.union(w.literal("school_year"),w.literal("cohort"),w.literal("seminar"),w.literal("care_period"),w.literal("other")),Ube=w.union(w.literal("planned"),w.literal("active"),w.literal("completed"),w.literal("archived")),Vbe=w.union(w.literal("class"),w.literal("course"),w.literal("care_group"),w.literal("seminar_group"),w.literal("mixed_age_group"),w.literal("other")),Gbe=w.union(w.literal("planned"),w.literal("active"),w.literal("completed"),w.literal("cancelled")),zbe=w.union(w.literal("class_teacher"),w.literal("teacher"),w.literal("mentor"),w.literal("instructor"),w.literal("assistant"),w.literal("other")),Wbe=w.union(w.literal("units"),w.literal("unit_profiles"),w.literal("programs"),w.literal("program_stages"),w.literal("program_runs"),w.literal("learning_groups"),w.literal("enrollments"),w.literal("learning_group_staff_assignments")),Ybe=w.union(w.literal("open"),w.literal("mapped"),w.literal("ignored"));function bC(e){let n=["street","hausnr","plz","ort"].filter(t=>e[t]!==void 0);if(n.length!==0){if(n.length!==4)throw new Error(`config legal-entity add: an address needs all of --street, --hausnr, --plz and --ort (got ${n.map(t=>`--${t}`).join(", ")})`);return{street:e.street,hausnr:e.hausnr,plz:e.plz,ort:e.ort}}}s(bC,"addressFrom");function vC(e){if(!Kr.includes(e))throw new Error(`config legal-entity add: --type "${e}" is none of ${Kr.join(", ")}`);return e}s(vC,"legalEntityType");function xC(e){if(!Ft.includes(e))throw new Error(`config unit add: --kind "${e}" is none of ${Ft.join(", ")}`);return e}s(xC,"unitKind");function SC(e,n,t){let r=e.find(i=>i.key===n.key);if(r===void 0)return e.push(n),"create";if(Pe(r)===Pe(n))return"same";throw new Error(`${t} "${n.key}" already exists with other values \u2014 decide by hand, nothing written.
|
|
10787
|
+
`)).includes(u.key));if(f.length===0)continue;let m=s((g,b)=>g.map(A=>b(i.find($=>$.key===A)?.label??A)).join(" + "),"variantLabel"),y=c.length===1?"":` Er fehlt in der Fassung aus ${f.map(g=>m(g,b=>`\u201E${b}\u201C`)).join(" und in der aus ")}.`,k=c.length===1?"":` It is missing in the version made of ${f.map(g=>m(g,b=>`"${b}"`)).join(" and in the one made of ")}.`;r.push({slotKey:u.key,code:"missingRequired",message:{de:`Ohne \u201E{{${u.key}}}\u201C (${u.label}) funktioniert der Brief \u201E${e.label}\u201C nicht \u2014 der Platzhalter muss im Text stehen, nicht nur im Betreff.`+y,en:`Without "{{${u.key}}}" (${u.label}) the letter "${e.label}" does not work \u2014 the placeholder must be in the text, not only in the subject.`+k}})}return r}s(HN,"validateOverride");function bH(e,n,t){let r=e.find(i=>i.key===n);return r===void 0?"":kH(r,t)}s(bH,"defaultTextOf");function ek(e){let n=e?.trim();return n===void 0||n.length===0?void 0:n}s(ek,"normalizeChromeText");var Oo=s(e=>String.fromCharCode(e),"cp"),vH=new RegExp(`[${Oo(0)}-${Oo(31)}${Oo(127)}]`,"g"),xH=new RegExp(`[${Oo(8234)}-${Oo(8238)}${Oo(8294)}-${Oo(8297)}]`,"g");var SH=200;function AH(e,n=SH){return e.replace(vH," ").replace(xH,"").replace(/\s+/g," ").trim().slice(0,n)}s(AH,"sanitizeHeaderValue");function vp(e){return AH(e.replace(/["<>@]/g,""),100)}s(vp,"sanitizeDisplayName");var nk={de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}},EH={greeting:{de:"Anrede",en:"Greeting"},closing:{de:"Gru\xDFformel",en:"Closing"}};function JN(e){let n=[],t=[];for(let i of["greeting","closing"]){let o=e[i];if(o===void 0)continue;let a=EH[i],l=Rn(o);l!=="not-localized"&&l.length>0&&l.length<ze.length&&t.push({de:`${a.de} fehlt auf ${l.map(d=>nk[d].de).join(" und ")}`,en:`${a.en} is missing in ${l.map(d=>nk[d].en).join(" and ")}`});for(let d of ze){let c=Fy(m=>`${a[m]} (${nk[d][m]})`),u=ek(o[d]);u!==void 0&&u.length>Io&&n.push({de:`${c.de} hat ${u.length} Zeichen \u2014 h\xF6chstens ${Io}; der Briefrahmen ist eine Zeile der Mail, kein Dokument.`,en:`${c.en} has ${u.length} characters \u2014 at most ${Io}; the letter frame is one line of the mail, not a document.`});let f=i==="greeting"?[qr]:[];for(let m of bp(u??""))f.includes(m)||n.push(f.length===0?{de:`${c.de} kann keine Platzhalter tragen \u2014 \u201E{{${m}}}\u201C bliebe unersetzt stehen.`,en:`${c.en} cannot carry placeholders \u2014 "{{${m}}}" would stay in the text unreplaced.`}:{de:`\u201E{{${m}}}\u201C gibt es in der ${c.de} nicht. Erlaubt: {{${qr}}} (${aa}).`,en:`"{{${m}}}" does not exist in the ${c.en}. Allowed: {{${qr}}} (${aa}).`})}}t.length>0&&n.unshift({de:`[notification/chromeMissingTranslation] ${t.map(i=>i.de).join("; ")} \u2014 der Briefrahmen gilt f\xFCr jeden Brief, in jeder Sprache.`,en:`[notification/chromeMissingTranslation] ${t.map(i=>i.en).join("; ")} \u2014 the letter frame applies to every letter, in every language.`});let r=ek(e.senderName);return r!==void 0&&vp(r)!==r&&n.push({de:`Absendername (senderName) \u201E${r}\u201C \xFCbersteht die Kopfzeile der Mail nicht unver\xE4ndert \u2014 er ginge als \u201E${vp(r)}\u201C hinaus. Keine Anf\xFChrungszeichen, spitzen Klammern, \u201E@\u201C oder Steuerzeichen.`,en:`The sender name (senderName) "${r}" does not survive the mail header unchanged \u2014 it would go out as "${vp(r)}". No quotation marks, angle brackets, "@" or control characters.`}),n}s(JN,"chromeFindings");var QN=w.object({family:w.string()}),ZN=w.object({family:w.string(),url:w.optional(w.string())}),bke=w.object({heading:w.optional(ZN),body:w.optional(ZN)}),TH=w.union(w.literal("sharp"),w.literal("rounded"),w.literal("soft")),$H=w.union(w.literal("light"),w.literal("dark")),RH=w.union(w.literal("sm"),w.literal("md"),w.literal("lg"),w.literal("max")),IH=w.union(w.literal("compact"),w.literal("normal"),w.literal("spacious")),OH=w.object({primary:w.optional(w.string()),accent:w.optional(w.string()),background:w.optional(w.string()),foreground:w.optional(w.string())}),PH=w.object({heading:w.optional(QN),body:w.optional(QN)}),vke=w.object({colors:w.optional(OH),radius:w.optional(TH),logoSize:w.optional(RH),bannerDensity:w.optional(IH),logoGround:w.optional($H),filledHeader:w.optional(w.boolean()),websiteUrl:w.optional(w.string()),fonts:w.optional(PH)}),xke=w.object({primaryUrl:w.union(w.null(),w.string())}),Ske=w.literal("primary"),Ake=w.object({headingUrl:w.union(w.null(),w.string()),bodyUrl:w.union(w.null(),w.string())}),Eke=w.union(w.literal("heading"),w.literal("body")),xp=["logo","fontHeading","fontBody"],XN={logo:null,fontHeading:"heading",fontBody:"body"};function eC(e){let{contentType:n,size:t}=e;return n==null||!n.startsWith("image/")?{de:`Das Logo muss ein Bild sein (erhalten: \u201E${n??"unbekannt"}\u201C).`,en:`The logo must be an image (received: "${n??"unknown"}").`}:n.startsWith("image/svg")?{de:"Das Logo muss eine Rastergrafik sein (PNG, JPEG oder GIF) \u2013 E-Mail-Programme zeigen SVG nicht an.",en:"The logo must be a raster image (PNG, JPEG or GIF) \u2013 email clients do not display SVG."}:t>3e6?{de:`Das Logo ist zu gro\xDF (${t} Byte, h\xF6chstens 3000000 Byte).`,en:`The logo is too large (${t} bytes, at most 3000000 bytes).`}:null}s(eC,"logoFileProblem");var tk="font/woff2";var _H=["Inter Variable","Azeret Mono Variable","Source Sans 3 Variable"];function nC(e){return e?.trim()?_H.some(n=>n.toLowerCase()===e.trim().toLowerCase())?{de:`\u201E${e}\u201C ist die Schrift von Plexus selbst \u2013 w\xE4hlen Sie f\xFCr eine eigene Datei einen anderen Familiennamen.`,en:`"${e}" is Plexus's own typeface \u2013 choose a different family name for your own file.`}:null:{de:"Speichern Sie zuerst die Schriftfamilie \u2013 die Datei wird unter diesem Namen eingebunden.",en:"Save the font family first \u2013 the file is registered under that name."}}s(nC,"fontFamilyProblem");var NH=["approved","rejected","withdrawn","waitlist","expired"];var Sp=["admitted","rejected","withdrawn","waitlist","expired","unknown"],_ke=w.union(...NH.map(e=>w.literal(e))),Nke=w.union(...Sp.map(e=>w.literal(e))),CH=["approved","rejected","waitlist"],DH=["withdrawn","expired"],FH=w.union(...CH.map(e=>w.literal(e))),LH=w.union(...DH.map(e=>w.literal(e))),Cke={active:{status:w.literal("active")},completed:{status:w.literal("completed"),outcome:FH,endedAt:w.number()},aborted:{status:w.literal("aborted"),outcome:w.optional(LH),endedAt:w.number()}};var tC=30,rC=3650;var MH=w.object({admitted:w.optional(w.number()),rejected:w.optional(w.number()),withdrawn:w.optional(w.number()),expired:w.optional(w.number()),waitlist:w.optional(w.number()),unknown:w.optional(w.number())}),Kke=MH.fields,qH=s(e=>Sp.includes(e),"isClassification");function iC(e,n="tenant.retentionDays"){if(e===null||typeof e!="object"||Array.isArray(e))return[`[retention/shape] ${n} must be an object of days per classification (got ${JSON.stringify(e)}).`];let t=[];for(let[r,i]of Object.entries(e)){if(!qH(r)){t.push(`[retention/unknownClassification] ${n}.${r} is no retention classification \u2014 one of ${Sp.join(", ")}.`);continue}(typeof i!="number"||!Number.isSafeInteger(i)||i<tC||i>rC)&&t.push(`[retention/days] ${n}.${r} must be a whole number of days from ${tC} to ${rC} (got ${JSON.stringify(i)}).`)}return t}s(iC,"retentionDaysFindings");var KH=["ad","ae","af","ag","ai","al","am","ao","aq","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bl","bm","bn","bo","bq","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mf","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","xk","ye","yt","za","zm","zw"],jH=new Set(KH);function Ap(e){return jH.has(e)}s(Ap,"isCountryCode");var rk=["off","always","deviating"],oC={mode:"deviating",defaultCountryCode:"de"};var BH=["street","plz","ort"];function UH(e){return BH.filter(n=>!e.has(n))}s(UH,"missingInvoiceAddressParts");var VH=new Set(["0-1-select","0-n-select"]);function sC(e){return e===void 0?null:new Set(e.properties.flatMap(n=>n.addressPart!==void 0&&eO(n.addressPart)?[n.addressPart]:[]))}s(sC,"declaredAddressParts");function GH(e){return VH.has(e)}s(GH,"isSelectFieldKind");function aC(e){let n=[];for(let o of e)if(o.isNationality&&(GH(o.kind)?o.listKind!=="country"&&n.push({code:"nationality/notCountryList",fieldKey:o.key}):n.push({code:"nationality/wrongFieldKind",fieldKey:o.key})),o.isAccountEmail&&o.kind!=="email"&&n.push({code:"accountEmail/wrongFieldKind",fieldKey:o.key}),o.isContactPhone&&o.kind!=="tel"&&n.push({code:"contactPhone/wrongFieldKind",fieldKey:o.key}),o.isInvoiceAddress)if(o.addressParts===null)n.push({code:"invoiceAddress/wrongFieldKind",fieldKey:o.key});else{let a=UH(o.addressParts);a.length>0&&n.push({code:"invoiceAddress/missingPart",fieldKey:o.key,parts:a})}let t=e.filter(o=>o.isAccountEmail);if(t.length>1)for(let o of t)n.push({code:"accountEmail/multiple",fieldKey:o.key});let r=e.filter(o=>o.isContactPhone);if(r.length>1)for(let o of r)n.push({code:"contactPhone/multiple",fieldKey:o.key});let i=e.filter(o=>o.isInvoiceAddress);if(i.length>1)for(let o of i)n.push({code:"invoiceAddress/multiple",fieldKey:o.key});return n}s(aC,"fieldRoleFindings");function lC(e,n,...t){let r=e[n.code];return r(n,...t)}s(lC,"wordListElementFinding");function dC(e,n){let t=[];for(let r of n){if(e.kind==="plain"){r.countryCode!==void 0&&t.push({code:"list/countryCodeOnPlain",elementKey:r.key,countryCode:r.countryCode});continue}r.countryCode===void 0?t.push({code:"list/countryCodeMissing",elementKey:r.key}):r.countryCode!==null&&!Ap(r.countryCode)&&t.push({code:"list/unknownCountryCode",elementKey:r.key,countryCode:r.countryCode})}return t}s(dC,"listElementCountryFindings");var WH={key:!0,tenant:!0,foundation:!0,source:!0,displayGroups:!0,lists:!0,roles:!0,fields:!0,roleFields:!0,contractRoleMappings:!0,templatePlaceholders:!0,searchTargets:!0,searchFilters:!0,partyResultIcons:!0,notificationLetters:!0,admission:!0,files:!0,agent:!0,deferredColumns:!0,ignoredColumns:!0},YH={slug:!0,name:!0,enabledModules:!0,permissions:!0,defaultApplicantGroupKey:!0,defaultEnrolleeRoleKey:!0,priceCriteriaFacts:!0,defaultInteressentRoleKey:!0,admissionFieldDisplayGroupKey:!0,defaultStartInProxy:!0,terms:!0,retentionDays:!0,mailLevel:!0,notificationChrome:!0,hideMailLevelNotice:!0,magicLinkLogin:!0,externalSignIn:!0,nationalityFlag:!0,adminSeesSignatureImages:!0,signatureStamp:!0,bankImportScope:!0,branding:!0,brandingAssets:!0,partyRetention:!0},HH=new Set(["enabledMailCategories","mailEnabled"]);function JH(e){let n=s((t,r,i)=>t.filter(o=>!Object.hasOwn(r,o)&&!(i==="tenant."&&HH.has(o))).map(o=>`[config/unknownKey] ${i}${o} is not a config field of this release \u2014 a typo, or a field a newer release introduced.`),"unknown");return[...n(Object.keys(e),WH,""),...n(Object.keys(e.tenant),YH,"tenant.")]}s(JH,"unknownKeyFindings");var cC=["plain","country"],QH={"list/countryCodeMissing":s(({elementKey:e},n)=>`Element "${n}.${e}" of a country list must state countryCode (null for no state).`,"list/countryCodeMissing"),"list/countryCodeOnPlain":s(({elementKey:e},n)=>`Element "${n}.${e}" carries countryCode, but list "${n}" is not kind "country".`,"list/countryCodeOnPlain"),"list/unknownCountryCode":s(({elementKey:e,countryCode:n},t)=>`Element "${t}.${e}" has unknown countryCode ${JSON.stringify(n)}.`,"list/unknownCountryCode")},ZH={"nationality/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isNationality but not a 0-1-select / 0-n-select.`,"nationality/wrongFieldKind"),"nationality/notCountryList":s(({fieldKey:e})=>`Field "${e}" is isNationality but its list is not kind "country".`,"nationality/notCountryList"),"accountEmail/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isAccountEmail but not an email field.`,"accountEmail/wrongFieldKind"),"accountEmail/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isAccountEmail fields \u2014 at most one per tenant.`,"accountEmail/multiple"),"contactPhone/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isContactPhone but not a tel field.`,"contactPhone/wrongFieldKind"),"contactPhone/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isContactPhone fields \u2014 at most one per tenant.`,"contactPhone/multiple"),"invoiceAddress/wrongFieldKind":s(({fieldKey:e})=>`Field "${e}" is isInvoiceAddress but not an object field.`,"invoiceAddress/wrongFieldKind"),"invoiceAddress/missingPart":s(({fieldKey:e,parts:n})=>`Field "${e}" is isInvoiceAddress but declares no property for the address part(s) ${n.join(", ")} (objectSchema.properties[].addressPart) \u2014 an invoice cannot print its address without them.`,"invoiceAddress/missingPart"),"invoiceAddress/multiple":s(({fieldKey:e})=>`Field "${e}" is one of several isInvoiceAddress fields \u2014 at most one per tenant.`,"invoiceAddress/multiple")};function XH(e){let n=ZH[e.code];return n(e)}s(XH,"roleText");function eJ(e){let n=[],t=e.tenant.nationalityFlag,r=typeof t=="object"&&t!==null?t:{},i=r.mode;if(rk.includes(i)||n.push(`[nationality/flagMode] tenant.nationalityFlag.mode must be one of ${rk.join(", ")} (got ${t===void 0?"no tenant.nationalityFlag":JSON.stringify(i??null)}).`),t!==void 0){let l=r.defaultCountryCode;(typeof l!="string"||!Ap(l))&&n.push(`[nationality/defaultCountryCode] tenant.nationalityFlag.defaultCountryCode must be a lowercase ISO 3166-1 alpha-2 code (got ${JSON.stringify(l??null)}).`)}let o=new Map;for(let l of e.lists){let d=l.kind;if(!cC.includes(d)){n.push(`[list/kind] List "${l.key}" has kind ${JSON.stringify(d??null)} \u2014 one of ${cC.join(", ")}.`);continue}o.set(l.key,l.kind);for(let c of dC({key:l.key,kind:l.kind},l.elements))n.push(`[${c.code}] ${lC(QH,c,l.key)}`)}let a=aC(e.fields.map(l=>({key:l.key,kind:l.type,listKind:l.listKey===void 0?null:o.get(l.listKey)??null,isNationality:l.isNationality===!0,isAccountEmail:l.isAccountEmail===!0,isContactPhone:l.isContactPhone===!0,isInvoiceAddress:l.isInvoiceAddress===!0,addressParts:l.type==="object"?sC(l.objectSchema??{properties:[]}):null})));for(let l of a)n.push(`[${l.code}] ${XH(l)}`);return n}s(eJ,"nationalityFindings");function uC(e){return bi(e)?.message.de??(e instanceof Error?e.message:String(e))}s(uC,"errorText");function mC(e,n={}){let t=[...JH(e)],r=[];try{LN(e.fields.map(v=>v.key),[])}catch(v){t.push(uC(v))}e.tenant.terms!==void 0&&t.push(...Xw(e.tenant.terms)),e.tenant.retentionDays!==void 0&&t.push(...iC(e.tenant.retentionDays)),UO(e.tenant.mailLevel)?e.tenant.mailLevel==="all"&&!gp(e.tenant.enabledModules,"notifications")&&t.push('[notification/levelWithoutModule] tenant.mailLevel is "all" but the notifications module is not enabled \u2014 only sign-in and security mail would go out. Enable the module or set "loginOnly".'):t.push(`[notification/mailLevel] tenant.mailLevel must be one of ${Ky.join(", ")} (got ${e.tenant.mailLevel===void 0?"nothing":JSON.stringify(e.tenant.mailLevel)}).`),"enabledMailCategories"in e.tenant&&t.push('[notification/mailCategoriesRetired] tenant.enabledMailCategories was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),"mailEnabled"in e.tenant&&t.push('[notification/mailEnabledRetired] tenant.mailEnabled was replaced by tenant.mailLevel \u2014 "all" for every mail, "loginOnly" for sign-in mail only to families (staff mail follows personal settings).'),En(e.displayGroups.map(v=>v.key),"display group",t),En(e.lists.map(v=>v.key),"list",t),En(e.roles.map(v=>v.key),"role",t),En(e.fields.map(v=>v.key),"field",t),En(e.foundation.legalEntities.map(v=>v.key),"legal entity",t),En(e.foundation.units.map(v=>v.key),"unit",t),En(e.foundation.permissionGroups.map(v=>v.key),"permission group",t),"teams"in e.foundation&&t.push("foundation.teams is retired: a team is a permission group \u2014 move each team to foundation.permissionGroups (same key) and remove the block.");for(let v of e.foundation.users)"teamKeys"in v&&t.push(`User "${v.email}" carries teamKeys, retired: team membership is the user's permission-group membership.`);En(e.foundation.users.map(v=>v.key),"user",t),En((e.searchFilters??[]).map(v=>v.key),"search filter",t),En((e.searchTargets??[]).map(v=>v.objectPropertyKey===void 0?v.fieldKey:`${v.fieldKey}.${v.objectPropertyKey}`),"search target",t),En((e.partyResultIcons??[]).map(v=>v.key),"party result icon",t),En((e.templatePlaceholders??[]).map(v=>v.key),"template placeholder",t),En((e.notificationLetters??[]).map(hC),"notification letter",t),lJ(e.notificationLetters??[],t),dJ(e.tenant.notificationChrome,t),e.tenant.bankImportScope!==void 0&&!["sepa_only","full_statement"].includes(e.tenant.bankImportScope)&&t.push("tenant.bankImportScope must be sepa_only or full_statement."),e.tenant.hideMailLevelNotice!==void 0&&typeof e.tenant.hideMailLevelNotice!="boolean"&&t.push("tenant.hideMailLevelNotice must be true or false (the dashboard's mail-level notice)."),typeof e.tenant.magicLinkLogin!="boolean"&&t.push("tenant.magicLinkLogin must be true or false (the login page's sign-in link option)."),typeof e.tenant.adminSeesSignatureImages!="boolean"&&t.push("tenant.adminSeesSignatureImages must be true or false (whether a school administrator sees other accounts' signature images)."),typeof e.tenant.signatureStamp!="boolean"&&t.push("tenant.signatureStamp must be true or false (whether the school offers the signature stamp at the countersignature)."),CN(e.tenant.externalSignIn)||t.push(`[auth/externalSignIn] tenant.externalSignIn must be { mode: "permanentLink" }, { mode: "oneTimeLink" } or { mode: "periodLink", validDays: 1\u2013${Gw} } (how families sign in).`);let i=new Set(e.displayGroups.map(v=>v.key)),o=new Set(e.lists.map(v=>v.key)),a=new Set(e.roles.map(v=>v.key)),l=new Set(e.fields.map(v=>v.key)),d=new Map(e.fields.map(v=>[v.key,v])),c=new Set(e.foundation.legalEntities.map(v=>v.key)),u=new Set(e.foundation.units.map(v=>v.key)),f=new Set(e.foundation.permissionGroups.map(v=>v.key));gp(e.tenant.enabledModules,"bewerbungsmanagement")&&e.tenant.defaultApplicantGroupKey!==void 0&&(e.foundation.permissionGroups.find(R=>R.key===e.tenant.defaultApplicantGroupKey)?.permissions.includes("bewerbungsmanagement.applications.submitOwn")||t.push(`Default applicant group "${e.tenant.defaultApplicantGroupKey}" must grant submitOwn.`));let m=e.tenant.admissionFieldDisplayGroupKey;m!==void 0&&!i.has(m)&&t.push(`tenant.admissionFieldDisplayGroupKey "${m}" names no display group of this config.`),m===void 0&&(gp(e.tenant.enabledModules,"bewerbungsmanagement")||(e.admission?.fields.length??0)>0)&&t.push("tenant.admissionFieldDisplayGroupKey is required when admissions is enabled or admission.fields declares fields: it names the display group the fields an offer creates land in."),t.push(...eJ(e)),En(e.fields.flatMap(v=>(v.relationshipKinds??[]).map(R=>R.key)),"relationship kind",t);for(let v of e.fields){i.has(v.displayGroupKey)||t.push(`Field "${v.key}" references missing display group "${v.displayGroupKey}".`),tJ(v,t),v.formWritable===!0&&!Jw[v.type].fieldMapTarget&&t.push(`Field "${v.key}" is formWritable, but a form cannot write a "${v.type}" field.`),v.type==="files"&&v.shareable===!0&&t.push(`[field/filesShareable] Field "${v.key}" is a files field and cannot be shareable.`),v.type==="auto-string"?rJ(v,d,t):v.autoString!==void 0&&t.push(`Non-automatic field "${v.key}" must not define autoString.`),(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Field "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`),(v.type==="0-1-select"||v.type==="0-n-select")&&!v.listKey&&t.push(`Select field "${v.key}" must define listKey.`),v.type!=="0-1-select"&&v.type!=="0-n-select"&&v.listKey!==void 0&&t.push(`Non-select field "${v.key}" must not define listKey.`),v.listKey&&!o.has(v.listKey)&&t.push(`Field "${v.key}" references missing list "${v.listKey}".`),(v.type==="object"||v.type==="relationship")&&!v.objectSchema&&t.push(`Field "${v.key}" must define objectSchema.`),v.type!=="object"&&v.type!=="relationship"&&v.objectSchema&&t.push(`Non-object field "${v.key}" must not define objectSchema.`);for(let R of v.objectSchema?.properties??[])(R.type==="0-1-select"||R.type==="0-n-select")&&!R.listKey&&t.push(`Object select property "${v.key}.${R.key}" must define listKey.`),R.listKey&&!o.has(R.listKey)&&t.push(`Object property "${v.key}.${R.key}" references missing list "${R.listKey}".`);nJ(v,t)}let y=e.tenant.priceCriteriaFacts;if(y){let v=e.fields.find(R=>R.key===y.birthDateFieldKey);(!v||v.type!=="date")&&t.push("Price criteria require a configured date field for birth dates."),a.has(y.studentRoleKey)||t.push("Price criteria require a configured Student eligibility role."),y.siblingRankSource!==void 0&&y.siblingRankSource!=="derived"&&y.siblingRankSource!=="chosen"&&t.push('Price criteria siblingRankSource must be "derived" or "chosen".');for(let R of Object.keys(y))R!=="birthDateFieldKey"&&R!=="studentRoleKey"&&R!=="siblingRankSource"&&t.push(`Unknown price criteria fact setting "${R}".`)}let k=e.tenant.defaultEnrolleeRoleKey;k&&!a.has(k)&&t.push(`Default enrollment role "${k}" does not exist.`),k&&e.roles.some(v=>v.parentRoleKey===k)&&t.push(`Default enrollment role "${k}" must be a leaf role.`);for(let v of e.roles){(typeof v.icon!="string"||v.icon.trim().length===0)&&t.push(`Role "${v.key}" must define an icon.`),v.parentRoleKey&&!a.has(v.parentRoleKey)&&t.push(`Role "${v.key}" references missing parent role "${v.parentRoleKey}".`);for(let R of v.listDisplayFieldKeys??[])l.has(R)||t.push(`Role "${v.key}" list display references missing field "${R}".`)}let g=new Map(e.roles.map(v=>[v.key,v.parentRoleKey])),b=new Map;for(let v of e.roleFields){let R=b.get(v.roleKey)??[];R.push({roleId:v.roleKey,customFieldId:v.fieldKey}),b.set(v.roleKey,R)}for(let v of e.roles)try{DN(v.key,g,b)}catch(R){t.push(uC(R))}for(let v of e.roleFields){a.has(v.roleKey)||t.push(`Role field references missing role "${v.roleKey}" for field "${v.fieldKey}".`),l.has(v.fieldKey)||t.push(`Role field references missing field "${v.fieldKey}" for role "${v.roleKey}".`);for(let R of v.targetRequirementFieldKeys??[])l.has(R)||t.push(`Role field "${v.roleKey}.${v.fieldKey}" references missing target requirement field "${R}".`)}aJ(e.contractRoleMappings??[],a,t);for(let v of e.templatePlaceholders??[])fN.test(v.key)||t.push(`Template placeholder "${v.key}" must use lower_snake_case segments, optionally separated by dots.`),v.source.kind==="customField"?Ep(v.source,d,t,`Template placeholder "${v.key}"`):v.source.kind==="relationshipTargetField"&&iJ(v,d,t);for(let v of e.searchTargets??[])Ep(v,d,t,"Search target");for(let v of e.fields)BN(v.key)&&(v.defaultValue!==void 0||v.validations!==void 0)&&t.push(`System field "${v.key}" takes no defaultValue or validations.`);for(let v of e.lists)En(v.elements.map((R,K)=>String(R.sortOrder??(K+1)*10)),`sortOrder of an element of list "${v.key}"`,t);for(let v of e.searchFilters??[])En((v.options??[]).map((R,K)=>String(R.sortOrder??(K+1)*10)),`sortOrder of an option of search filter "${v.key}"`,t);for(let v of e.foundation.permissionGroups){v.grantAllCustomFields===!0&&v.customFieldPermissions!==void 0&&t.push(`Permission group "${v.key}" states both grantAllCustomFields and customFieldPermissions \u2014 one of them.`),En((v.customFieldPermissions??[]).map(R=>R.displayGroupKey),`display group of a field permission of group "${v.key}"`,t);for(let R of v.customFieldPermissions??[]){i.has(R.displayGroupKey)||t.push(`Permission group "${v.key}" grants field permissions on missing display group "${R.displayGroupKey}".`);for(let K of R.permissions)qN.includes(K)||t.push(`Permission group "${v.key}" grants unknown field permission "${K}".`)}}let A=e.tenant.partyRetention;A!==void 0&&(jN(A.days)||t.push(`tenant.partyRetention.days must be a whole number of days from 1 to ${36500} (got ${JSON.stringify(A.days)}).`),Number.isFinite(A.enabledAt)||t.push("tenant.partyRetention.enabledAt must be a timestamp (epoch ms)."),A.formerRoleKey!==void 0&&!a.has(A.formerRoleKey)&&t.push(`tenant.partyRetention references missing role "${A.formerRoleKey}".`));for(let v of e.searchFilters??[]){(v.kind==="chips"||v.kind==="select")&&(v.options?.length??0)===0&&t.push(`Search filter "${v.key}" must define options.`),(v.kind==="text"||v.kind==="numberRange")&&v.target===void 0&&t.push(`Search filter "${v.key}" must define a target field.`),v.options!==void 0&&En(v.options.map(R=>R.key),`search filter option for "${v.key}"`,t),Ep(v.target,d,t,`Search filter "${v.key}"`);for(let R of v.options??[]){R.predicates.length===0&&t.push(`Search filter option "${v.key}.${R.key}" must define at least one predicate.`);for(let K of R.predicates){if(K.kind==="role"){a.has(K.roleKey)||t.push(`Search filter option "${v.key}.${R.key}" references missing role "${K.roleKey}".`);continue}Ep(K,d,t,`Search filter option "${v.key}.${R.key}"`)}}}for(let v of e.partyResultIcons??[])oJ(v,d,t);for(let v of e.foundation.legalEntities)if(v.terms!==void 0&&t.push(...Xw(v.terms,`foundation.legalEntities.${v.key}.terms`)),fC(v.branding,t,`foundation.legalEntities.${v.key}.branding`),pC(v,t,`foundation.legalEntities.${v.key}`),v.signatoryUserKey!==void 0&&v.type==="school_group"&&t.push(`[config/signatoryOnGroup] Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) declares an Unterschriftsperson.`),v.parentLegalEntityKey&&!c.has(v.parentLegalEntityKey)&&t.push(`Legal entity "${v.key}" references missing parent "${v.parentLegalEntityKey}".`),v.address!==void 0){let R=v.address,K=["street","hausnr","plz","ort"];v.type==="school_group"?t.push(`Legal entity "${v.key}" is a school_group \u2014 only a Tr\xE4ger (school_operator, service_entity) has an address.`):(typeof R!="object"||R===null||Array.isArray(R)||Object.keys(R).some(N=>!K.includes(N))||K.some(N=>typeof R[N]!="string"||(R[N]??"").trim()===""))&&t.push(`Legal entity "${v.key}" has an invalid address \u2014 expected { street, hausnr, plz, ort }, each non-empty.`)}let $=new Map;for(let v of e.foundation.units){if(v.slug!==void 0){let R=typeof v.slug=="string"?AN(v.slug):"must be a string";R!==void 0&&t.push(`Unit "${v.key}" has invalid slug "${v.slug}" (${R}).`);let K=$.get(v.slug);K!==void 0&&t.push(`Units "${K}" and "${v.key}" both declare slug "${v.slug}" (unit slugs are unique per tenant).`),$.set(v.slug,v.key)}c.has(v.legalEntityKey)||t.push(`Unit "${v.key}" references missing legal entity "${v.legalEntityKey}".`),v.parentUnitKey&&!u.has(v.parentUnitKey)&&t.push(`Unit "${v.key}" references missing parent unit "${v.parentUnitKey}".`),v.sortOrder!==void 0&&(!Number.isFinite(v.sortOrder)||v.sortOrder<0)&&t.push(`Unit "${v.key}" has invalid sortOrder "${v.sortOrder}" (must be a non-negative number).`)}let O=/^[0-9a-f]{32}:[0-9a-f]{128}$/;for(let v of e.foundation.users){f.has(v.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${v.permissionGroupKey}".`),v.unitKey&&!u.has(v.unitKey)&&t.push(`User "${v.email}" references missing unit "${v.unitKey}".`),v.status!==void 0&&v.status!=="deactivated"&&t.push(`User "${v.email}": status must be "deactivated" or absent, not "${String(v.status)}".`);let R=[v,...v.additionalMemberships??[]];for(let N of v.additionalMemberships??[])f.has(N.permissionGroupKey)||t.push(`User "${v.email}" references missing permission group "${N.permissionGroupKey}".`),N.unitKey&&!u.has(N.unitKey)&&t.push(`User "${v.email}" references missing unit "${N.unitKey}".`);En(R.map(N=>`${N.permissionGroupKey}/${N.unitKey??""}`),`membership (permission group/unit) of user "${v.email}"`,t);for(let N of R)N.validFrom!==void 0&&N.validTo!==void 0&&N.validTo<=N.validFrom&&t.push(`User "${v.email}": membership "${N.permissionGroupKey}" ends (validTo) before it starts (validFrom).`);let K=[v.firstName,v.lastName];K.some(N=>N!==void 0)&&K.some(N=>typeof N!="string"||N.trim()==="")&&t.push(`[config/userNameIncomplete] User "${v.email}" states only part of firstName/lastName (or an empty one) \u2014 set both or neither.`);for(let N of["staging","prod"]){let Y=v.passwordHashes?.[N];Y!==void 0&&!O.test(Y)&&t.push(`User "${v.email}" passwordHashes.${N} is not in Better Auth scrypt format "<32hex>:<128hex>".`)}}fC(e.tenant.branding,t),pC(e.tenant,t);let E=gC(e.fields.flatMap(v=>v.sourceColumns));for(let v of E)r.push(`Source column "${v}" is mapped by more than one field.`);fJ(e,t);let I=n.sourceColumns===void 0||e.source===void 0?void 0:cJ(e,n.sourceColumns,t);return{ok:t.length===0,errors:t,warnings:r,coverage:I}}s(mC,"validateTenantConfig");function nJ(e,n){let t=new Map;for(let r of e.objectSchema?.properties??[]){let i=r.addressPart;if(i===void 0)continue;let o=`Object property "${e.key}.${r.key}"`;if(!vy.includes(i)){n.push(`${o}: addressPart "${i}" is none of ${vy.join(", ")}.`);continue}e.type!=="object"&&n.push(`${o}: only an object field stores an address (addressPart).`),r.type!=="string"&&n.push(`${o}: addressPart "${i}" needs a string property, not "${r.type}".`);let a=t.get(i);a!==void 0&&n.push(`${o}: addressPart "${i}" is already declared by "${e.key}.${a}".`),t.set(i,r.key)}}s(nJ,"validateAddressParts");function tJ(e,n){let t=e.relationshipKinds;if(t===void 0)return;if(e.type!=="relationship"){n.push(`Field "${e.key}" declares relationshipKinds, but only a relationship field carries them.`);return}let r=new Map((e.objectSchema?.properties??[]).map(i=>[i.key,i]));for(let i of t){let o=`Field "${e.key}" relationship kind "${i.key}"`;if(typeof i.key!="string"||i.key.trim()===""){n.push(`Field "${e.key}": a relationship kind needs a key.`);continue}for(let l of["de","en"])(i.label?.[l]??"").trim()===""&&n.push(`${o}: label.${l} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);if(i.edge===null||typeof i.edge!="object"||Array.isArray(i.edge)){n.push(`${o}: edge must be an object.`);continue}i.sibling!==void 0&&i.sibling!==!0&&n.push(`${o}: sibling must be true or absent.`),i.sibling===!0&&i.mergeInto!==void 0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare mergeInto.`);let a=t.flatMap(l=>l.mergeInto!==void 0?[l.mergeInto]:[]);if(i.sibling===!0&&a.some(l=>l in i.edge)&&n.push(`${o}: a sibling kind's edge is its identity \u2014 it cannot declare a property another kind of the field merges into.`),i.sibling===!0&&Object.keys(i.edge).length===0&&n.push(`${o}: a sibling kind's edge is its identity \u2014 an empty edge would count every edge of the field.`),i.mergeInto!==void 0){let l=r.get(i.mergeInto);l===void 0||l.type!=="0-n-select"?n.push(`${o}: mergeInto "${i.mergeInto}" must name a 0-n-select property of the field's objectSchema.`):Array.isArray(i.edge[i.mergeInto])||n.push(`${o}: mergeInto "${i.mergeInto}" must be set to a list in the edge.`)}}}s(tJ,"validateRelationshipKinds");function rJ(e,n,t){if(e.autoString===void 0){t.push(`Automatic field "${e.key}" must define autoString.`);return}e.allowMultiple===!0&&t.push(`Automatic field "${e.key}" must not allow multiple values.`),e.shareable===!0&&t.push(`Automatic field "${e.key}" must not be shareable.`),e.autoString.segments.length===0&&t.push(`Automatic field "${e.key}" must define at least one segment.`),e.autoString.segments.filter(i=>i.kind==="sequence").length!==1&&t.push(`Automatic field "${e.key}" must define exactly one sequence segment.`);for(let i of e.autoString.segments)if(i.kind==="literal"&&i.value.length===0&&t.push(`Automatic field "${e.key}" has an empty literal segment.`),i.kind==="sequence"&&(i.startAt!==void 0&&(!Number.isInteger(i.startAt)||i.startAt<1)&&t.push(`Automatic field "${e.key}" sequence startAt must be an integer >= 1.`),i.minDigits!==void 0&&(!Number.isInteger(i.minDigits)||i.minDigits<0)&&t.push(`Automatic field "${e.key}" sequence minDigits must be an integer >= 0.`)),i.kind==="field"){let o=n.get(i.fieldKey);if(o===void 0){t.push(`Automatic field "${e.key}" references missing field "${i.fieldKey}".`);continue}i.objectPropertyKey!==void 0&&o.objectSchema?.properties.find(l=>l.key===i.objectPropertyKey)===void 0&&t.push(`Automatic field "${e.key}" references missing object property "${i.fieldKey}.${i.objectPropertyKey}".`)}}s(rJ,"validateAutomaticStringField");function Ep(e,n,t,r){if(e===void 0)return;let i=n.get(e.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.fieldKey}".`);return}if(e.objectPropertyKey===void 0)return;(i.objectSchema?.properties.some(a=>a.key===e.objectPropertyKey)??!1)||t.push(`${r} references missing object property "${e.fieldKey}.${e.objectPropertyKey}".`)}s(Ep,"validateSearchTarget");function iJ(e,n,t){if(e.source.kind!=="relationshipTargetField")return;let r=`Template placeholder "${e.key}"`,i=n.get(e.source.relationshipFieldKey);if(i===void 0)t.push(`${r} references missing relationship field "${e.source.relationshipFieldKey}".`);else if(i.type!=="relationship")t.push(`${r} relationship field "${e.source.relationshipFieldKey}" must be a relationship field.`);else{for(let a of e.source.edgeFilters??[])ik(i,a.propertyKey,t,`${r} edge filter`);e.source.selection?.sortPropertyKey!==void 0&&ik(i,e.source.selection.sortPropertyKey,t,`${r} selection sort`)}let o=n.get(e.source.targetFieldKey);if(o===void 0){t.push(`${r} references missing target field "${e.source.targetFieldKey}".`);return}o.type==="relationship"&&t.push(`${r} target field "${e.source.targetFieldKey}" must not be a relationship field.`),e.source.targetObjectPropertyKey!==void 0&&ik(o,e.source.targetObjectPropertyKey,t,`${r} target`)}s(iJ,"validateRelationshipTemplatePlaceholder");function ik(e,n,t,r){(e.objectSchema?.properties.some(o=>o.key===n)??!1)||t.push(`${r} references missing object property "${e.key}.${n}".`)}s(ik,"validateObjectPropertyReference");function oJ(e,n,t){let r=`Party result icon "${e.key}"`,i=n.get(e.when.fieldKey);if(i===void 0){t.push(`${r} references missing field "${e.when.fieldKey}".`);return}if(e.when.objectPropertyKey===void 0){i.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`);return}let o=i.objectSchema?.properties.find(a=>a.key===e.when.objectPropertyKey);if(o===void 0){t.push(`${r} references missing object property "${e.when.fieldKey}.${e.when.objectPropertyKey}".`);return}o.type!=="boolean"&&t.push(`${r} must target a Boolean field or object property.`)}s(oJ,"validatePartyResultIconTarget");function hC(e){return`${e.templateId}:${e.locale}:${e.scopeKey}`}s(hC,"letterIdentity");function sJ(e){return`${e.generatorKey??"*"}/${e.partyKind}/${e.roleKey}`}s(sJ,"contractRoleMappingIdentity");function aJ(e,n,t){let r=new Set;for(let i of e){let o=sJ(i),a=`Contract role mapping "${o}"`;zw.includes(i.partyKind)||t.push(`${a}: partyKind must be one of ${zw.join(", ")}.`),n.has(i.roleKey)||t.push(`${a} references missing role "${i.roleKey}".`),i.generatorKey!==void 0&&i.generatorKey.trim()===""&&t.push(`${a}: generatorKey must not be blank \u2014 omit it for the tenant default.`),r.has(o)&&t.push(`${a} is declared twice.`),r.add(o)}}s(aJ,"validateContractRoleMappings");function lJ(e,n){for(let t of e){let r=`Notification letter "${hC(t)}"`;if(!kp(t.locale)){n.push(`${r} declares locale "${String(t.locale)}" \u2014 letters are written in ${ze.map(i=>`"${i}"`).join(" and ")} only, so no mail would ever read this deviation.`);continue}if(t.scopeKey!==yp){n.push(`${r} declares scopeKey "${t.scopeKey}" \u2014 the only scope is "${yp}" (the whole school).`);continue}if(Object.keys(t.slots).length===0){n.push(`${r} overrides no block. A deviation that deviates in nothing is not an entry \u2014 remove it.`);continue}if(!Wy(t.templateId)){n.push(`${r} references no registered letter \u2014 "${t.templateId}" is not in the letter catalog.`);continue}for(let i of HN(zy(t.templateId),t.slots,t.locale))n.push(`${r}, block "${i.slotKey}" [${i.code}]: ${i.message.de}`)}}s(lJ,"validateNotificationLetters");function dJ(e,n){if(e!==void 0)for(let t of JN(e))n.push(`Notification chrome: ${t.de}`)}s(dJ,"validateNotificationChrome");function fC(e,n,t){if(e===void 0)return;let r=t===void 0?n:{push:s((...f)=>n.push(...f.map(m=>`${t}: ${m}`)),"push")},i=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,o=/^(?:rgb|rgba|hsl|hsla)\(.+\)$/i,a=s(f=>i.test(f.trim())||o.test(f.trim()),"isColor");for(let[f,m]of Object.entries(e.colors??{}))m!==void 0&&(a(m)||r.push(`Branding color "colors.${f}" has invalid value "${m}" (expected hex "#rgb"/"#rrggbb"/"#rrggbbaa" or rgb()/rgba()/hsl()/hsla()).`));let l=["sharp","rounded","soft"];e.radius!==void 0&&!l.includes(e.radius)&&r.push(`Branding radius "${e.radius}" is invalid (expected "sharp", "rounded", or "soft").`);let d=["sm","md","lg","max"];e.logoSize!==void 0&&!d.includes(e.logoSize)&&r.push(`Branding logoSize "${e.logoSize}" is invalid (expected "sm", "md", "lg", or "max").`);let c=["compact","normal","spacious"];e.bannerDensity!==void 0&&!c.includes(e.bannerDensity)&&r.push(`Branding bannerDensity "${e.bannerDensity}" is invalid (expected "compact", "normal", or "spacious").`);let u=["light","dark"];e.logoGround!==void 0&&!u.includes(e.logoGround)&&r.push(`Branding logoGround "${e.logoGround}" is invalid (expected "light" or "dark").`),e.websiteUrl!==void 0&&!e.websiteUrl.startsWith("https://")&&r.push(`Branding websiteUrl must be an https:// URL (got "${e.websiteUrl}").`);for(let f of["heading","body"]){let m=e.fonts?.[f];m!==void 0&&((typeof m.family!="string"||m.family.trim().length===0)&&r.push(`Branding font "fonts.${f}" must define a non-empty family.`),Object.hasOwn(m,"url")&&r.push(`Branding font "fonts.${f}.url" is no longer supported \u2014 the font file is uploaded (plexus-cli branding set-font --slot ${f} --file <woff2>) and config carries the family only.`))}}s(fC,"validateBranding");function pC(e,n,t="tenant"){let r=e.brandingAssets;if(r!==void 0){if(typeof r!="object"||r===null||Array.isArray(r)){n.push(`${t}.brandingAssets must be an object keyed by slot (${xp.join(", ")}).`);return}for(let[i,o]of Object.entries(r)){let a=`${t}.brandingAssets.${i}`;if(!xp.includes(i)){n.push(`${a}: unknown slot (expected ${xp.join(", ")}).`);continue}if(typeof o!="object"||o===null){n.push(`${a}: must be { sha256, sizeBytes, mimeType }.`);continue}if("size"in o){n.push(`[config/fileRefRenamed] ${a} still names size \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}yC.test(o.sha256??"")||n.push(`${a}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(o.sizeBytes)||o.sizeBytes<=0)&&n.push(`${a}: sizeBytes must be a positive integer.`);let l=XN[i];if(l===null){let d=eC({contentType:o.mimeType,size:o.sizeBytes});d!==null&&n.push(`${a}: ${d.de}`)}else{o.mimeType!==tk&&n.push(`${a}: mimeType must be "${tk}" (got "${o.mimeType}").`);let d=nC(e.branding?.fonts?.[l]?.family);d!==null&&n.push(`${a}: [branding/fontFamilyMissing] ${t}.branding.fonts.${l}: ${d.de}`)}"path"in o&&n.push(`${a}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}}s(pC,"validateBrandingAssets");function cJ(e,n,t){let{source:r}=e;r===void 0&&F("validateSourceCoverage: called without a `source` block.");let i=new Set(n),o=new Set(e.fields.flatMap(k=>k.sourceColumns)),a=new Set(e.deferredColumns.map(k=>k.column)),l=new Set(e.ignoredColumns.map(k=>k.column)),d=new Set([...o,...a,...l]),c=r.requiredColumns.filter(k=>!i.has(k)),u=n.filter(k=>!d.has(k)),f=[...o].filter(k=>!i.has(k)),m=[...a].filter(k=>!i.has(k)),y=[...l].filter(k=>!i.has(k));for(let k of c)t.push(`Required source column "${k}" is missing from ${r.primaryTable}.`);for(let k of u)t.push(`Source column "${k}" is neither mapped nor explicitly deferred/ignored.`);for(let k of f)t.push(`Mapped source column "${k}" does not exist in the source schema.`);for(let k of m)t.push(`Deferred source column "${k}" does not exist in the source schema.`);for(let k of y)t.push(`Ignored source column "${k}" does not exist in the source schema.`);return{table:r.primaryTable,availableColumns:n.length,mappedColumns:[...o].filter(k=>i.has(k)).length,deferredColumns:[...a].filter(k=>i.has(k)).length,ignoredColumns:[...l].filter(k=>i.has(k)).length,missingRequiredColumns:c,unmappedColumns:u,unknownMappedColumns:f,unknownDeferredColumns:m,unknownIgnoredColumns:y}}s(cJ,"validateSourceCoverage");function En(e,n,t){for(let r of gC(e))t.push(`Duplicate ${n} key "${r}".`)}s(En,"requireUnique");function gC(e){let n=new Set,t=new Set;for(let r of e)n.has(r)&&t.add(r),n.add(r);return[...t]}s(gC,"duplicates");var yC=/^[0-9a-f]{64}$/,uJ=["fileName","size"];function fJ(e,n){if(!Array.isArray(e.files)){n.push('"files" is missing \u2014 declare the file library (an empty list is fine).');return}En(e.files.map(t=>t.key),"file",n);for(let t of e.files){let r=`files["${t.key}"]`;ea(t.key)||n.push(`${r}: key must match ${vw}.`);for(let o of["de","en"])(t.label?.[o]??"").trim()===""&&n.push(`${r}: label.${o} is required \u2014 [i18n/missingTranslation] every shown text needs German and English.`);let i=uJ.filter(o=>o in t);if(i.length>0){n.push(`[config/fileRefRenamed] ${r} still names ${i.join(", ")} \u2014 this bundle was exported before the file-field rename, or by a plexus-cli older than this release (now filename / sizeBytes). Update plexus-cli, export it again (plexus-cli --env <env> config export) and re-apply.`);continue}if(typeof t.filename!="string")n.push(`${r}: filename is missing.`);else{let o=To(t.filename);o!==null&&n.push(`${r}: filename ${o}.`)}wp.includes(t.mimeType)||n.push(`${r}: mimeType "${t.mimeType}" is not allowed (${wp.join(", ")}).`),yC.test(t.sha256??"")||n.push(`${r}: sha256 must be 64 lowercase hex chars.`),(!Number.isInteger(t.sizeBytes)||t.sizeBytes<=0)&&n.push(`${r}: sizeBytes must be a positive integer.`),"path"in t&&n.push(`${r}: "path" is a CLI snapshot field \u2014 resolve it with plexus-cli config apply.`)}}s(fJ,"validateFiles");var pJ=new WeakMap,mJ=new WeakSet;function ok(e,n){n(e);let r=e.asOptional.bind(e);return Object.defineProperty(e,"asOptional",{value:s(()=>ok(r(),n),"value"),enumerable:!1}),e}s(ok,"carry");function la(e,n){return ok(e,t=>pJ.set(t,n))}s(la,"tagged");var hJ="tenant teardown drains every table explicitly (config/wipe.ts)",Yn={belongsTo:s(e=>la(e,{kind:"belongsTo"}),"belongsTo"),owns:s(e=>la(e,{kind:"owns"}),"owns"),holds:s(e=>la(e,{kind:"holds"}),"holds"),restrict:s((e,n)=>la(e,n?{kind:"restrict",unindexed:n.unindexed}:{kind:"restrict"}),"restrict"),history:s(e=>la(e,{kind:"history"}),"history"),tenant:s(e=>la(e,{kind:"restrict",unindexed:hJ}),"tenant"),historyOf:s(e=>ok(e,n=>mJ.add(n)),"historyOf")};var gJ=w.object({street:w.string(),hausnr:w.string(),plz:w.string(),ort:w.string()}),wC=w.union(w.literal("school_operator"),w.literal("school_group"),w.literal("service_entity")),Kr=wC.members.map(e=>e.value),yJ={tenantId:Yn.tenant(w.id("tenants")),name:w.optional(w.string()),type:wC,parentLegalEntityId:w.optional(Yn.restrict(w.id("legal_entities"))),configKey:w.optional(w.string()),partyId:w.optional(Yn.restrict(w.id("parties"))),address:w.optional(gJ),signatoryUserId:w.optional(Yn.restrict(w.id("users"))),terms:w.optional(WN)},Fbe=Jr(yJ).index("by_tenantId",["tenantId"]).index("by_parentLegalEntityId",["parentLegalEntityId"]).index("by_tenantId_and_configKey",["tenantId","configKey"]).index("by_partyId",["partyId"]).index("by_signatoryUserId",["signatoryUserId"]);var wJ=w.union(w.literal("school"),w.literal("kindergarten"),w.literal("after_school_care"),w.literal("department"),w.literal("site"),w.literal("other")),Ft=wJ.members.map(e=>e.value),qbe=w.union(w.literal("school"),w.literal("vocational"),w.literal("care"),w.literal("seminar"),w.literal("other")),Kbe=w.union(w.literal("none"),w.literal("manual"),w.literal("annual_rollover")),jbe=w.union(w.literal("grade_level"),w.literal("module"),w.literal("phase"),w.literal("other")),Bbe=w.union(w.literal("school_year"),w.literal("cohort"),w.literal("seminar"),w.literal("care_period"),w.literal("other")),Ube=w.union(w.literal("planned"),w.literal("active"),w.literal("completed"),w.literal("archived")),Vbe=w.union(w.literal("class"),w.literal("course"),w.literal("care_group"),w.literal("seminar_group"),w.literal("mixed_age_group"),w.literal("other")),Gbe=w.union(w.literal("planned"),w.literal("active"),w.literal("completed"),w.literal("cancelled")),zbe=w.union(w.literal("class_teacher"),w.literal("teacher"),w.literal("mentor"),w.literal("instructor"),w.literal("assistant"),w.literal("other")),Wbe=w.union(w.literal("units"),w.literal("unit_profiles"),w.literal("programs"),w.literal("program_stages"),w.literal("program_runs"),w.literal("learning_groups"),w.literal("enrollments"),w.literal("learning_group_staff_assignments")),Ybe=w.union(w.literal("open"),w.literal("mapped"),w.literal("ignored"));function bC(e){let n=["street","hausnr","plz","ort"].filter(t=>e[t]!==void 0);if(n.length!==0){if(n.length!==4)throw new Error(`config legal-entity add: an address needs all of --street, --hausnr, --plz and --ort (got ${n.map(t=>`--${t}`).join(", ")})`);return{street:e.street,hausnr:e.hausnr,plz:e.plz,ort:e.ort}}}s(bC,"addressFrom");function vC(e){if(!Kr.includes(e))throw new Error(`config legal-entity add: --type "${e}" is none of ${Kr.join(", ")}`);return e}s(vC,"legalEntityType");function xC(e){if(!Ft.includes(e))throw new Error(`config unit add: --kind "${e}" is none of ${Ft.join(", ")}`);return e}s(xC,"unitKind");function SC(e,n,t){let r=e.find(i=>i.key===n.key);if(r===void 0)return e.push(n),"create";if(Pe(r)===Pe(n))return"same";throw new Error(`${t} "${n.key}" already exists with other values \u2014 decide by hand, nothing written.
|
|
10788
10788
|
in the file: ${JSON.stringify(r)}
|
|
10789
10789
|
requested: ${JSON.stringify(n)}`)}s(SC,"addRow");function kC(e){return new Set(mC(e).errors)}s(kC,"findings");function AC(e,n){let t=s(()=>JSON.parse(ye(e,"utf8")),"read"),r=t();if(typeof r!="object"||r===null||typeof r.foundation!="object")throw new Error(`config: ${e} is no exported tenant config (no "foundation" block) \u2014 export one with \`config export --out <file>\``);let i=kC(r),o=t(),a=n(o),l=[...kC(o)].filter(d=>!i.has(d));if(l.length>0)throw new Error(`config: the edit is refused by the config validator, nothing written:
|
|
10790
10790
|
${l.join(`
|
|
@@ -11017,6 +11017,6 @@ ${t.length} unusable ${o}:
|
|
|
11017
11017
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11018
11018
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli platform users provision --tenant <slug> --email <email> --name <name>
|
|
11019
11019
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11020
|
-
`);return t.length>0?1:0}},EE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function Rj(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(Rj,"requireOnOff");var Ij=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,Zc,wE,kE,bE,vE,xE,SE,AE,EE];function Oj(e){return e.de??e.en??Object.values(e)[0]??""}s(Oj,"titleDe");function w8(e){return{id:e._id,kind:e.kind,status:e.status,title:Oj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(w8,"row");var k8=["id","kind","status","title","assignee","group","outcome"],RE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(w8),k8),0}},IE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:Oj(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},OE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},PE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},_E=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},Pj=[RE,IE,OE,PE,_E];var Xc=[...fR,...xN,...NN,...CC,...NC,...sD,...pD,...fD,...Tj,...Ij,...Ej,...yK,...sN,...tD,...mj,...cR,...FR,...G_,...gD,...hD,...kD,...bD,...eD,...KC,...Pj,...hM,...eq,...hK,...nq,...QK,...oj,...wK,...$K,...OK,...CK,...FK,...lj,...wj,...RR];for(let e of Xc){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:NT(e.usage.category,n.join(" "))})}var _j="0.1.100";function Nj(){return Xc.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=IT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(Nj,"plexusCommandCatalog");import Zo from"node:path";function b8(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(b8,"workspacePath");function v8(e){let{absolute:n,relative:t}=b8(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of $r(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return We(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Cn(Zo.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(v8,"plexusWorkspace");function Cj(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=il[t];if(!o||!Object.hasOwn(il,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(_g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:_g[i.path],skillHash:Wu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return v8(i)},"executePlexusAgentTool")}s(Cj,"createPlexusAgentToolExecutor");var yh=Cj({inspectCommand:Fj,executeCommand:Lj});function wh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_j});e.register(ja.HelpCommand),e.register(ja.VersionCommand);for(let t of Xc)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return A8(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(wh,"createPlexusCli");function A8(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&za[t]===r&&an(n,t,r),t in za&&ao(t)==="confirm"&&!Wa(e)&&n.write(`plexus-cli: \`${za[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11020
|
+
`);return t.length>0?1:0}},EE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function Rj(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(Rj,"requireOnOff");var Ij=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,Zc,wE,kE,bE,vE,xE,SE,AE,EE];function Oj(e){return e.de??e.en??Object.values(e)[0]??""}s(Oj,"titleDe");function w8(e){return{id:e._id,kind:e.kind,status:e.status,title:Oj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(w8,"row");var k8=["id","kind","status","title","assignee","group","outcome"],RE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(w8),k8),0}},IE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:Oj(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},OE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},PE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},_E=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},Pj=[RE,IE,OE,PE,_E];var Xc=[...fR,...xN,...NN,...CC,...NC,...sD,...pD,...fD,...Tj,...Ij,...Ej,...yK,...sN,...tD,...mj,...cR,...FR,...G_,...gD,...hD,...kD,...bD,...eD,...KC,...Pj,...hM,...eq,...hK,...nq,...QK,...oj,...wK,...$K,...OK,...CK,...FK,...lj,...wj,...RR];for(let e of Xc){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:NT(e.usage.category,n.join(" "))})}var _j="0.1.102";function Nj(){return Xc.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=IT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(Nj,"plexusCommandCatalog");import Zo from"node:path";function b8(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(b8,"workspacePath");function v8(e){let{absolute:n,relative:t}=b8(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of $r(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return We(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Cn(Zo.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(v8,"plexusWorkspace");function Cj(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=il[t];if(!o||!Object.hasOwn(il,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(_g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:_g[i.path],skillHash:Wu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return v8(i)},"executePlexusAgentTool")}s(Cj,"createPlexusAgentToolExecutor");var yh=Cj({inspectCommand:Fj,executeCommand:Lj});function wh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_j});e.register(ja.HelpCommand),e.register(ja.VersionCommand);for(let t of Xc)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return A8(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(wh,"createPlexusCli");function A8(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&za[t]===r&&an(n,t,r),t in za&&ao(t)==="confirm"&&!Wa(e)&&n.write(`plexus-cli: \`${za[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11021
11021
|
`)}s(A8,"noteRetiredPath");function Fj(e){let n=wh().process(_a(e),{executePlexusAgentTool:yh}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=Nj().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?Dp(da(ca),i.fn??"",i.kind):void 0,a=Cu(t,{confirm:Wa(n),callKind:o});return{...r,writes:a}}s(Fj,"inspectPlexusCommand");async function Lj(e,n){if(n)return DE(n,()=>Lj(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let t="",r="",i=wh();if(ln()){let l=Fj(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(_a(e.argv),{executePlexusAgentTool:yh,stdin:S8.from(e.stdin===void 0?[]:[e.stdin]),stdout:new Dj({write(l,d,c){t+=String(l),c()}}),stderr:new Dj({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(Lj,"executePlexusCommand");KE({source:E8.join(import.meta.dirname,"skill")});wh().runExit(_a(process.argv.slice(2)),{executePlexusAgentTool:yh});
|
|
11022
11022
|
//# sourceMappingURL=cli.mjs.map
|