@smartkomm/plexus-cli 0.1.24 → 0.1.25
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
CHANGED
|
@@ -79,7 +79,7 @@ ${t.map(n=>`
|
|
|
79
79
|
`),a}format(t){var n;return((n=t??this.enableColors)!==null&&n!==void 0?n:e.defaultContext.colorDepth>1)?GA:zA}getUsageByRegistration(t,n){let r=this.registrations.get(t);if(typeof r>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(r.index,n)}getUsageByIndex(t,n){return this.builder.getBuilderByIndex(t).usage(n)}};zo.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:qA()};function HA(e){return e()}s(HA,"noopCaptureActivator");var ba={};vA(ba,{DefinitionsCommand:()=>ha,HelpCommand:()=>ga,TokensCommand:()=>ya,VersionCommand:()=>wa});var ha=class extends A{static{s(this,"DefinitionsCommand")}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
|
|
80
80
|
`)}};ha.paths=[["--clipanion=definitions"]];var ga=class extends A{static{s(this,"HelpCommand")}async execute(){this.context.stdout.write(this.cli.usage())}};ga.paths=[["-h"],["--help"]];function Mc(e={}){return tn({definition(t,n){var r;t.addProxy({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){return r.positionals.map(({value:i})=>i)}})}s(Mc,"Proxy");var ya=class extends A{static{s(this,"TokensCommand")}constructor(){super(...arguments),this.args=Mc()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)}
|
|
81
81
|
`)}};ya.paths=[["--clipanion=tokens"]];var wa=class extends A{static{s(this,"VersionCommand")}async execute(){var t;this.context.stdout.write(`${(t=this.cli.binaryVersion)!==null&&t!==void 0?t:"<unknown>"}
|
|
82
|
-
`)}};wa.paths=[["-v"],["--version"]];var f={};vA(f,{Array:()=>YA,Boolean:()=>JA,Counter:()=>QA,Proxy:()=>Mc,Rest:()=>ZA,String:()=>XA,applyValidator:()=>zi,cleanValidationError:()=>Pc,formatError:()=>fa,isOptionSymbol:()=>ua,makeCommandOption:()=>tn,rerouteArguments:()=>mr});function YA(e,t,n){let[r,i]=mr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return tn({definition(d){d.addOption({names:a,arity:o,hidden:i?.hidden,description:i?.description,required:i.required})},transformer(d,c,u){let p,m=typeof r<"u"?[...r]:void 0;for(let{name:g,value:w}of u.options)l.has(g)&&(p=g,m=m??[],m.push(w));return typeof m<"u"?zi(p??c,m,i.validator):m}})}s(YA,"Array");function JA(e,t,n){let[r,i]=mr(t,n??{}),o=e.split(","),a=new Set(o);return tn({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:p,value:m}of c.options)a.has(p)&&(u=m);return u}})}s(JA,"Boolean");function QA(e,t,n){let[r,i]=mr(t,n??{}),o=e.split(","),a=new Set(o);return tn({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:p,value:m}of c.options)a.has(p)&&(u??(u=0),m?u+=1:u=0);return u}})}s(QA,"Counter");function ZA(e={}){return tn({definition(t,n){var r;t.addRest({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){let i=s(a=>{let l=r.positionals[a];return l.extra===Tn||l.extra===!1&&a<t.arity.leading.length},"isRestPositional"),o=0;for(;o<r.positionals.length&&i(o);)o+=1;return r.positionals.splice(0,o).map(({value:a})=>a)}})}s(ZA,"Rest");function dK(e,t,n){let[r,i]=mr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return tn({definition(d){d.addOption({names:a,arity:i.tolerateBoolean?0:o,hidden:i.hidden,description:i.description,required:i.required})},transformer(d,c,u,p){let m,g=r;typeof i.env<"u"&&p.env[i.env]&&(m=i.env,g=p.env[i.env]);for(let{name:w,value:y}of u.options)l.has(w)&&(m=w,g=y);return typeof g=="string"?zi(m??c,g,i.validator):g}})}s(dK,"StringOption");function cK(e={}){let{required:t=!0}=e;return tn({definition(n,r){var i;n.addPositional({name:(i=e.name)!==null&&i!==void 0?i:r,required:e.required})},transformer(n,r,i){var o;for(let a=0;a<i.positionals.length;++a){if(i.positionals[a].extra===Tn||t&&i.positionals[a].extra===!0||!t&&i.positionals[a].extra===!1)continue;let[l]=i.positionals.splice(a,1);return zi((o=e.name)!==null&&o!==void 0?o:r,l.value,e.validator)}}})}s(cK,"StringPositional");function XA(e,...t){return typeof e=="string"?dK(e,...t):cK(e)}s(XA,"String");import{Readable as X4,Writable as LM}from"node:stream";var Re=class extends Error{static{s(this,"GuardRefusal")}constructor(t,n){super(t,n),this.name="GuardRefusal",this.stack=`${this.name}: ${t}`}};function eE(e){return e instanceof Re||(typeof e=="object"&&e!==null?e.clipanion:void 0)?.type==="usage"?2:1}s(eE,"exitCodeFor");var gr=[],jn=[],uK=Uint8Array,Wm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Wi=0,tE=Wm.length;Wi<tE;++Wi)gr[Wi]=Wm[Wi],jn[Wm.charCodeAt(Wi)]=Wi;var Wi,tE;jn[45]=62;jn[95]=63;function fK(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}s(fK,"getLens");function pK(e,t,n){return(t+n)*3/4-n}s(pK,"_byteLength");function Wo(e){var t,n=fK(e),r=n[0],i=n[1],o=new uK(pK(e,r,i)),a=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=jn[e.charCodeAt(d)]<<18|jn[e.charCodeAt(d+1)]<<12|jn[e.charCodeAt(d+2)]<<6|jn[e.charCodeAt(d+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=jn[e.charCodeAt(d)]<<2|jn[e.charCodeAt(d+1)]>>4,o[a++]=t&255),i===1&&(t=jn[e.charCodeAt(d)]<<10|jn[e.charCodeAt(d+1)]<<4|jn[e.charCodeAt(d+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}s(Wo,"toByteArray");function mK(e){return gr[e>>18&63]+gr[e>>12&63]+gr[e>>6&63]+gr[e&63]}s(mK,"tripletToBase64");function hK(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(mK(r));return i.join("")}s(hK,"encodeChunk");function Ho(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(hK(e,a,a+o>l?l:a+o));return r===1?(t=e[n-1],i.push(gr[t>>2]+gr[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(gr[t>>10]+gr[t>>4&63]+gr[t<<2&63]+"=")),i.join("")}s(Ho,"fromByteArray");function Bn(e){if(e===void 0)return{};if(!Kc(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}s(Bn,"parseArgs");function qc(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}s(qc,"validateDeploymentUrl");function Kc(e){let t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}s(Kc,"isSimpleObject");var iE=!0,Yo=BigInt("-9223372036854775808"),Bc=BigInt("9223372036854775807"),Qm=BigInt("0"),gK=BigInt("8"),yK=BigInt("256"),Ym="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Yi=class{static{s(this,"CommitTsPlaceholder")}[Symbol.toPrimitive](t){if(t==="string")return this.toString();throw new Error(Ym)}valueOf(){throw new Error(Ym)}toJSON(){throw new Error(Ym)}toString(){return"[unresolved commit timestamp]"}},oE=new Yi;function sE(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}s(sE,"isSpecial");function wK(e){e<Qm&&(e-=Yo+Yo);let t=e.toString(16);t.length%2===1&&(t="0"+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=gK;return Ho(n)}s(wK,"slowBigIntToBase64");function bK(e){let t=Wo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Qm,r=Qm;for(let i of t)n+=BigInt(i)*yK**r,r++;return n>Bc&&(n+=Yo+Yo),n}s(bK,"slowBase64ToBigInt");function kK(e){if(e<Yo||Bc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Ho(new Uint8Array(t))}s(kK,"modernBigIntToBase64");function vK(e){let t=Wo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}s(vK,"modernBase64ToBigInt");var xK=DataView.prototype.setBigInt64?kK:wK,SK=DataView.prototype.getBigInt64?vK:bK,nE=1024;function Zm(e){if(e.length>nE)throw new Error(`Field name ${e} exceeds maximum field name length ${nE}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}s(Zm,"validateObjectField");function Nt(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>Nt(r));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Wo(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return SK(e.$integer)}if(r==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let i=Wo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);let a=new DataView(i.buffer).getFloat64(0,iE);if(!sE(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return oE}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let n={};for(let[r,i]of Object.entries(e))Zm(r),n[r]=Nt(i);return n}s(Nt,"jsonToConvex");var rE=16384;function Hi(e){let t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="function"?"[Function]":typeof r=="symbol"?String(r):typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>rE){let n="[...truncated]",r=rE-n.length,i=t.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),t.substring(0,r)+n}return t}s(Hi,"stringifyValueForError");function jc(e,t,n,r){if(e===void 0){let a=n&&` (present at path ${n} in original object ${Hi(t)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Yo||Bc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:xK(e)}}if(typeof e=="number")if(sE(e)){let a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,e,iE),{$float:Ho(new Uint8Array(a))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Ho(new Uint8Array(e))};if(e instanceof Yi)return{$commitTs:null};if(Array.isArray(e))return e.map((a,l)=>jc(a,t,n+`[${l}]`,!1));if(e instanceof Set)throw new Error(Jm(n,"Set",[...e],t));if(e instanceof Map)throw new Error(Jm(n,"Map",[...e],t));if(!Kc(e)){let a=e?.constructor?.name,l=a?`${a} `:"";throw new Error(Jm(n,l,e,t))}let i={},o=Object.entries(e);o.sort(([a,l],[d,c])=>a===d?0:a<d?-1:1);for(let[a,l]of o)l!==void 0?(Zm(a),i[a]=jc(l,t,n+`.${a}`,!1)):r&&(Zm(a),i[a]=AK(l,t,n+`.${a}`));return i}s(jc,"convexToJsonInternal");function Jm(e,t,n,r){return e?`${t}${Hi(n)} is not a supported Convex type (present at path ${e} in original object ${Hi(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Hi(n)} is not a supported Convex type.`}s(Jm,"errorMessageForUnsupportedType");function AK(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Hi(e)} but original value is undefined`);return jc(e,t,n,!1)}s(AK,"convexOrUndefinedToJsonInternal");function Yt(e){return jc(e,e,"",!1)}s(Yt,"convexToJson");var EK=Object.defineProperty,TK=s((e,t,n)=>t in e?EK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),rt=s((e,t,n)=>TK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),$K="https://docs.convex.dev/error#undefined-validator";function ka(e,t){let n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${$K} for details.`)}s(ka,"throwUndefinedValidatorError");var Jt=class{static{s(this,"BaseValidator")}constructor({isOptional:t}){rt(this,"type"),rt(this,"fieldPaths"),rt(this,"isOptional"),rt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},Uc=class e extends Jt{static{s(this,"VId")}constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),rt(this,"tableName"),rt(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}optional(){return new e({isOptional:"optional",tableName:this.tableName})}asOptional(){return this.optional()}},va=class e extends Jt{static{s(this,"VFloat64")}constructor(){super(...arguments),rt(this,"kind","float64")}get json(){return{type:"number"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},xa=class e extends Jt{static{s(this,"VInt64")}constructor(){super(...arguments),rt(this,"kind","int64")}get json(){return{type:"bigint"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Vc=class e extends Jt{static{s(this,"VCommitTs")}constructor(){super(...arguments),rt(this,"kind","commitTs")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Gc=class e extends Jt{static{s(this,"VBoolean")}constructor(){super(...arguments),rt(this,"kind","boolean")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},zc=class e extends Jt{static{s(this,"VBytes")}constructor(){super(...arguments),rt(this,"kind","bytes")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Wc=class e extends Jt{static{s(this,"VString")}constructor(){super(...arguments),rt(this,"kind","string")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Hc=class e extends Jt{static{s(this,"VNull")}constructor(){super(...arguments),rt(this,"kind","null")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Yc=class e extends Jt{static{s(this,"VAny")}constructor(){super(...arguments),rt(this,"kind","any")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Jc=class e extends Jt{static{s(this,"VObject")}constructor({isOptional:t,fields:n}){super({isOptional:t}),rt(this,"fields"),rt(this,"kind","object"),globalThis.Object.entries(n).forEach(([r,i])=>{if(i===void 0&&ka("v.object()",r),!i.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}optional(){return new e({isOptional:"optional",fields:this.fields})}asOptional(){return this.optional()}omit(...t){let n={...this.fields};for(let r of t)delete n[r];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let r of t)n[r]=this.fields[r];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[n,r]of globalThis.Object.entries(this.fields))t[n]=r.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Qc=class e extends Jt{static{s(this,"VLiteral")}constructor({isOptional:t,value:n}){if(super({isOptional:t}),rt(this,"value"),rt(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:Yt(this.value)}}optional(){return new e({isOptional:"optional",value:this.value})}asOptional(){return this.optional()}},Zc=class e extends Jt{static{s(this,"VArray")}constructor({isOptional:t,element:n}){super({isOptional:t}),rt(this,"element"),rt(this,"kind","array"),n===void 0&&ka("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}optional(){return new e({isOptional:"optional",element:this.element})}asOptional(){return this.optional()}},Xc=class e extends Jt{static{s(this,"VRecord")}constructor({isOptional:t,key:n,value:r}){if(super({isOptional:t}),rt(this,"key"),rt(this,"value"),rt(this,"kind","record"),n===void 0&&ka("v.record()","key"),r===void 0&&ka("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(r.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!r.isConvexValidator)throw new Error("Key and value of v.record() must be validators");this.key=n,this.value=r}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}optional(){return new e({isOptional:"optional",key:this.key,value:this.value})}asOptional(){return this.optional()}},eu=class e extends Jt{static{s(this,"VUnion")}constructor({isOptional:t,members:n}){super({isOptional:t}),rt(this,"members"),rt(this,"kind","union"),n.forEach((r,i)=>{if(r===void 0&&ka("v.union()",`member at index ${i}`),!r.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}optional(){return new e({isOptional:"optional",members:this.members})}asOptional(){return this.optional()}};function tu(e){return e?.isConvexValidator===!0}s(tu,"isValidator");var b={id:s(e=>new Uc({isOptional:"required",tableName:e}),"id"),null:s(()=>new Hc({isOptional:"required"}),"null"),number:s(()=>new va({isOptional:"required"}),"number"),float64:s(()=>new va({isOptional:"required"}),"float64"),bigint:s(()=>new xa({isOptional:"required"}),"bigint"),int64:s(()=>new xa({isOptional:"required"}),"int64"),commitTs:s(()=>new Vc({isOptional:"required"}),"commitTs"),boolean:s(()=>new Gc({isOptional:"required"}),"boolean"),string:s(()=>new Wc({isOptional:"required"}),"string"),bytes:s(()=>new zc({isOptional:"required"}),"bytes"),literal:s(e=>new Qc({isOptional:"required",value:e}),"literal"),array:s(e=>new Zc({isOptional:"required",element:e}),"array"),object:s(e=>new Jc({isOptional:"required",fields:e}),"object"),record:s((e,t)=>new Xc({isOptional:"required",key:e,value:t}),"record"),union:s((...e)=>new eu({isOptional:"required",members:e}),"union"),any:s(()=>new Yc({isOptional:"required"}),"any"),optional:s(e=>e.asOptional(),"optional"),nullable:s(e=>b.union(e,b.null()),"nullable")};var RK=Object.defineProperty,IK=s((e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),Xm=s((e,t,n)=>IK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),aE,lE,OK=Symbol.for("ConvexError"),fn=class extends(lE=Error,aE=OK,lE){static{s(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:Hi(t)),Xm(this,"name","ConvexError"),Xm(this,"data"),Xm(this,aE,!0),this.data=t}};var dE=s(()=>Array.from({length:4},()=>0),"arr"),m5=dE(),h5=dE();var Sa=class extends fn{static{s(this,"RefusalError")}constructor(t,n){super({code:t,message:{de:n.de,en:n.en}}),this.message=n.de}};function fe(e,t){throw new Sa(e,t)}s(fe,"refuse");function _(e,t){throw new Error(e,t)}s(_,"bug");function _K(e){return typeof e=="object"&&e!==null&&Symbol.for("ConvexError")in e}s(_K,"isConvexError");var NK=s(e=>{console.warn(`[refusal/legacyStringMessage] a refusal arrived with a bare string message (${e.code??"no code"}): ${e.de}`)},"legacyReporter"),cE=new Set;function CK(e,t){if(e===void 0)return{de:"",en:""};if(typeof e=="string"){let n=t??e;return cE.has(n)||(cE.add(n),NK({code:t,de:e})),{de:e,en:""}}if(e!==null&&typeof e=="object"){let{de:n,en:r}=e;if(typeof n=="string"&&typeof r=="string")return{de:n,en:r}}_(`refusalOf: a ConvexError's message is neither { de, en } nor a string: ${JSON.stringify(e)}`)}s(CK,"refusalTextOf");function ui(e){if(!_K(e))return null;let t=e.data;if(typeof t=="string")return{code:null,message:{de:t,en:t}};if(t&&typeof t=="object"){let{code:n,message:r}=t,i=typeof n=="string"?n:null;return{code:i,message:CK(r,i)}}return null}s(ui,"refusalOf");function DK(e){let t=ui(e);if(t!==null&&(t.message.de!==""||t.message.en!==""))return{kind:"refusal",code:t.code,message:t.message};let n=e instanceof Error?e.message:String(e),r=/\[Request ID:\s*([0-9a-f]+)\]/i.exec(n)?.[1],i=n.replace(/\[CONVEX[^\]]*\]/g,"").replace(/\[Request ID:[^\]]*\]/gi,"").replace(/\bServer Error\b/gi,"").replace(/\bCalled by client\b/g,"").trim();return r!==void 0&&i===""?{kind:"redacted",requestId:r}:{kind:"technical",text:n}}s(DK,"classifyServerFailure");function FK(e){return{de:`Serverfehler (Request-ID ${e}) \u2014 Details in GlitchTip.`,en:`Server error (request ID ${e}) \u2014 details in GlitchTip.`}}s(FK,"serverFailureText");function eh(e){let t=DK(e);return t.kind==="refusal"?t.message.de!==""?t.message.de:t.message.en:t.kind==="redacted"?FK(t.requestId).de:t.text}s(eh,"operatorFailureLine");function fE(e,t,n,r,i){if(n||!r){e.write(`${JSON.stringify(t,null,2)}
|
|
82
|
+
`)}};wa.paths=[["-v"],["--version"]];var f={};vA(f,{Array:()=>YA,Boolean:()=>JA,Counter:()=>QA,Proxy:()=>Mc,Rest:()=>ZA,String:()=>XA,applyValidator:()=>zi,cleanValidationError:()=>Pc,formatError:()=>fa,isOptionSymbol:()=>ua,makeCommandOption:()=>tn,rerouteArguments:()=>mr});function YA(e,t,n){let[r,i]=mr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return tn({definition(d){d.addOption({names:a,arity:o,hidden:i?.hidden,description:i?.description,required:i.required})},transformer(d,c,u){let p,m=typeof r<"u"?[...r]:void 0;for(let{name:g,value:w}of u.options)l.has(g)&&(p=g,m=m??[],m.push(w));return typeof m<"u"?zi(p??c,m,i.validator):m}})}s(YA,"Array");function JA(e,t,n){let[r,i]=mr(t,n??{}),o=e.split(","),a=new Set(o);return tn({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:p,value:m}of c.options)a.has(p)&&(u=m);return u}})}s(JA,"Boolean");function QA(e,t,n){let[r,i]=mr(t,n??{}),o=e.split(","),a=new Set(o);return tn({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:p,value:m}of c.options)a.has(p)&&(u??(u=0),m?u+=1:u=0);return u}})}s(QA,"Counter");function ZA(e={}){return tn({definition(t,n){var r;t.addRest({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){let i=s(a=>{let l=r.positionals[a];return l.extra===Tn||l.extra===!1&&a<t.arity.leading.length},"isRestPositional"),o=0;for(;o<r.positionals.length&&i(o);)o+=1;return r.positionals.splice(0,o).map(({value:a})=>a)}})}s(ZA,"Rest");function dK(e,t,n){let[r,i]=mr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return tn({definition(d){d.addOption({names:a,arity:i.tolerateBoolean?0:o,hidden:i.hidden,description:i.description,required:i.required})},transformer(d,c,u,p){let m,g=r;typeof i.env<"u"&&p.env[i.env]&&(m=i.env,g=p.env[i.env]);for(let{name:w,value:y}of u.options)l.has(w)&&(m=w,g=y);return typeof g=="string"?zi(m??c,g,i.validator):g}})}s(dK,"StringOption");function cK(e={}){let{required:t=!0}=e;return tn({definition(n,r){var i;n.addPositional({name:(i=e.name)!==null&&i!==void 0?i:r,required:e.required})},transformer(n,r,i){var o;for(let a=0;a<i.positionals.length;++a){if(i.positionals[a].extra===Tn||t&&i.positionals[a].extra===!0||!t&&i.positionals[a].extra===!1)continue;let[l]=i.positionals.splice(a,1);return zi((o=e.name)!==null&&o!==void 0?o:r,l.value,e.validator)}}})}s(cK,"StringPositional");function XA(e,...t){return typeof e=="string"?dK(e,...t):cK(e)}s(XA,"String");import{Readable as X4,Writable as LM}from"node:stream";var Re=class extends Error{static{s(this,"GuardRefusal")}constructor(t,n){super(t,n),this.name="GuardRefusal",this.stack=`${this.name}: ${t}`}};function eE(e){return e instanceof Re||(typeof e=="object"&&e!==null?e.clipanion:void 0)?.type==="usage"?2:1}s(eE,"exitCodeFor");var gr=[],jn=[],uK=Uint8Array,Wm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Wi=0,tE=Wm.length;Wi<tE;++Wi)gr[Wi]=Wm[Wi],jn[Wm.charCodeAt(Wi)]=Wi;var Wi,tE;jn[45]=62;jn[95]=63;function fK(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}s(fK,"getLens");function pK(e,t,n){return(t+n)*3/4-n}s(pK,"_byteLength");function Wo(e){var t,n=fK(e),r=n[0],i=n[1],o=new uK(pK(e,r,i)),a=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=jn[e.charCodeAt(d)]<<18|jn[e.charCodeAt(d+1)]<<12|jn[e.charCodeAt(d+2)]<<6|jn[e.charCodeAt(d+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=jn[e.charCodeAt(d)]<<2|jn[e.charCodeAt(d+1)]>>4,o[a++]=t&255),i===1&&(t=jn[e.charCodeAt(d)]<<10|jn[e.charCodeAt(d+1)]<<4|jn[e.charCodeAt(d+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}s(Wo,"toByteArray");function mK(e){return gr[e>>18&63]+gr[e>>12&63]+gr[e>>6&63]+gr[e&63]}s(mK,"tripletToBase64");function hK(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(mK(r));return i.join("")}s(hK,"encodeChunk");function Ho(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(hK(e,a,a+o>l?l:a+o));return r===1?(t=e[n-1],i.push(gr[t>>2]+gr[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(gr[t>>10]+gr[t>>4&63]+gr[t<<2&63]+"=")),i.join("")}s(Ho,"fromByteArray");function Bn(e){if(e===void 0)return{};if(!Kc(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}s(Bn,"parseArgs");function qc(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}s(qc,"validateDeploymentUrl");function Kc(e){let t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}s(Kc,"isSimpleObject");var iE=!0,Yo=BigInt("-9223372036854775808"),Bc=BigInt("9223372036854775807"),Qm=BigInt("0"),gK=BigInt("8"),yK=BigInt("256"),Ym="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Yi=class{static{s(this,"CommitTsPlaceholder")}[Symbol.toPrimitive](t){if(t==="string")return this.toString();throw new Error(Ym)}valueOf(){throw new Error(Ym)}toJSON(){throw new Error(Ym)}toString(){return"[unresolved commit timestamp]"}},oE=new Yi;function sE(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}s(sE,"isSpecial");function wK(e){e<Qm&&(e-=Yo+Yo);let t=e.toString(16);t.length%2===1&&(t="0"+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=gK;return Ho(n)}s(wK,"slowBigIntToBase64");function bK(e){let t=Wo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Qm,r=Qm;for(let i of t)n+=BigInt(i)*yK**r,r++;return n>Bc&&(n+=Yo+Yo),n}s(bK,"slowBase64ToBigInt");function kK(e){if(e<Yo||Bc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Ho(new Uint8Array(t))}s(kK,"modernBigIntToBase64");function vK(e){let t=Wo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}s(vK,"modernBase64ToBigInt");var xK=DataView.prototype.setBigInt64?kK:wK,SK=DataView.prototype.getBigInt64?vK:bK,nE=1024;function Zm(e){if(e.length>nE)throw new Error(`Field name ${e} exceeds maximum field name length ${nE}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}s(Zm,"validateObjectField");function Nt(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>Nt(r));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Wo(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return SK(e.$integer)}if(r==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let i=Wo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);let a=new DataView(i.buffer).getFloat64(0,iE);if(!sE(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return oE}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let n={};for(let[r,i]of Object.entries(e))Zm(r),n[r]=Nt(i);return n}s(Nt,"jsonToConvex");var rE=16384;function Hi(e){let t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="function"?"[Function]":typeof r=="symbol"?String(r):typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>rE){let n="[...truncated]",r=rE-n.length,i=t.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),t.substring(0,r)+n}return t}s(Hi,"stringifyValueForError");function jc(e,t,n,r){if(e===void 0){let a=n&&` (present at path ${n} in original object ${Hi(t)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Yo||Bc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:xK(e)}}if(typeof e=="number")if(sE(e)){let a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,e,iE),{$float:Ho(new Uint8Array(a))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Ho(new Uint8Array(e))};if(e instanceof Yi)return{$commitTs:null};if(Array.isArray(e))return e.map((a,l)=>jc(a,t,n+`[${l}]`,!1));if(e instanceof Set)throw new Error(Jm(n,"Set",[...e],t));if(e instanceof Map)throw new Error(Jm(n,"Map",[...e],t));if(!Kc(e)){let a=e?.constructor?.name,l=a?`${a} `:"";throw new Error(Jm(n,l,e,t))}let i={},o=Object.entries(e);o.sort(([a,l],[d,c])=>a===d?0:a<d?-1:1);for(let[a,l]of o)l!==void 0?(Zm(a),i[a]=jc(l,t,n+`.${a}`,!1)):r&&(Zm(a),i[a]=AK(l,t,n+`.${a}`));return i}s(jc,"convexToJsonInternal");function Jm(e,t,n,r){return e?`${t}${Hi(n)} is not a supported Convex type (present at path ${e} in original object ${Hi(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Hi(n)} is not a supported Convex type.`}s(Jm,"errorMessageForUnsupportedType");function AK(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Hi(e)} but original value is undefined`);return jc(e,t,n,!1)}s(AK,"convexOrUndefinedToJsonInternal");function Yt(e){return jc(e,e,"",!1)}s(Yt,"convexToJson");var EK=Object.defineProperty,TK=s((e,t,n)=>t in e?EK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),rt=s((e,t,n)=>TK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),$K="https://docs.convex.dev/error#undefined-validator";function ka(e,t){let n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${$K} for details.`)}s(ka,"throwUndefinedValidatorError");var Jt=class{static{s(this,"BaseValidator")}constructor({isOptional:t}){rt(this,"type"),rt(this,"fieldPaths"),rt(this,"isOptional"),rt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},Uc=class e extends Jt{static{s(this,"VId")}constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),rt(this,"tableName"),rt(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}optional(){return new e({isOptional:"optional",tableName:this.tableName})}asOptional(){return this.optional()}},va=class e extends Jt{static{s(this,"VFloat64")}constructor(){super(...arguments),rt(this,"kind","float64")}get json(){return{type:"number"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},xa=class e extends Jt{static{s(this,"VInt64")}constructor(){super(...arguments),rt(this,"kind","int64")}get json(){return{type:"bigint"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Vc=class e extends Jt{static{s(this,"VCommitTs")}constructor(){super(...arguments),rt(this,"kind","commitTs")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Gc=class e extends Jt{static{s(this,"VBoolean")}constructor(){super(...arguments),rt(this,"kind","boolean")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},zc=class e extends Jt{static{s(this,"VBytes")}constructor(){super(...arguments),rt(this,"kind","bytes")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Wc=class e extends Jt{static{s(this,"VString")}constructor(){super(...arguments),rt(this,"kind","string")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Hc=class e extends Jt{static{s(this,"VNull")}constructor(){super(...arguments),rt(this,"kind","null")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Yc=class e extends Jt{static{s(this,"VAny")}constructor(){super(...arguments),rt(this,"kind","any")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},Jc=class e extends Jt{static{s(this,"VObject")}constructor({isOptional:t,fields:n}){super({isOptional:t}),rt(this,"fields"),rt(this,"kind","object"),globalThis.Object.entries(n).forEach(([r,i])=>{if(i===void 0&&ka("v.object()",r),!i.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}optional(){return new e({isOptional:"optional",fields:this.fields})}asOptional(){return this.optional()}omit(...t){let n={...this.fields};for(let r of t)delete n[r];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let r of t)n[r]=this.fields[r];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[n,r]of globalThis.Object.entries(this.fields))t[n]=r.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Qc=class e extends Jt{static{s(this,"VLiteral")}constructor({isOptional:t,value:n}){if(super({isOptional:t}),rt(this,"value"),rt(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:Yt(this.value)}}optional(){return new e({isOptional:"optional",value:this.value})}asOptional(){return this.optional()}},Zc=class e extends Jt{static{s(this,"VArray")}constructor({isOptional:t,element:n}){super({isOptional:t}),rt(this,"element"),rt(this,"kind","array"),n===void 0&&ka("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}optional(){return new e({isOptional:"optional",element:this.element})}asOptional(){return this.optional()}},Xc=class e extends Jt{static{s(this,"VRecord")}constructor({isOptional:t,key:n,value:r}){if(super({isOptional:t}),rt(this,"key"),rt(this,"value"),rt(this,"kind","record"),n===void 0&&ka("v.record()","key"),r===void 0&&ka("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(r.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!r.isConvexValidator)throw new Error("Key and value of v.record() must be validators");this.key=n,this.value=r}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}optional(){return new e({isOptional:"optional",key:this.key,value:this.value})}asOptional(){return this.optional()}},eu=class e extends Jt{static{s(this,"VUnion")}constructor({isOptional:t,members:n}){super({isOptional:t}),rt(this,"members"),rt(this,"kind","union"),n.forEach((r,i)=>{if(r===void 0&&ka("v.union()",`member at index ${i}`),!r.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}optional(){return new e({isOptional:"optional",members:this.members})}asOptional(){return this.optional()}};function tu(e){return e?.isConvexValidator===!0}s(tu,"isValidator");var b={id:s(e=>new Uc({isOptional:"required",tableName:e}),"id"),null:s(()=>new Hc({isOptional:"required"}),"null"),number:s(()=>new va({isOptional:"required"}),"number"),float64:s(()=>new va({isOptional:"required"}),"float64"),bigint:s(()=>new xa({isOptional:"required"}),"bigint"),int64:s(()=>new xa({isOptional:"required"}),"int64"),commitTs:s(()=>new Vc({isOptional:"required"}),"commitTs"),boolean:s(()=>new Gc({isOptional:"required"}),"boolean"),string:s(()=>new Wc({isOptional:"required"}),"string"),bytes:s(()=>new zc({isOptional:"required"}),"bytes"),literal:s(e=>new Qc({isOptional:"required",value:e}),"literal"),array:s(e=>new Zc({isOptional:"required",element:e}),"array"),object:s(e=>new Jc({isOptional:"required",fields:e}),"object"),record:s((e,t)=>new Xc({isOptional:"required",key:e,value:t}),"record"),union:s((...e)=>new eu({isOptional:"required",members:e}),"union"),any:s(()=>new Yc({isOptional:"required"}),"any"),optional:s(e=>e.asOptional(),"optional"),nullable:s(e=>b.union(e,b.null()),"nullable")};var RK=Object.defineProperty,IK=s((e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),Xm=s((e,t,n)=>IK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),aE,lE,OK=Symbol.for("ConvexError"),fn=class extends(lE=Error,aE=OK,lE){static{s(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:Hi(t)),Xm(this,"name","ConvexError"),Xm(this,"data"),Xm(this,aE,!0),this.data=t}};var dE=s(()=>Array.from({length:4},()=>0),"arr"),m3=dE(),h3=dE();var Sa=class extends fn{static{s(this,"RefusalError")}constructor(t,n){super({code:t,message:{de:n.de,en:n.en}}),this.message=n.de}};function fe(e,t){throw new Sa(e,t)}s(fe,"refuse");function _(e,t){throw new Error(e,t)}s(_,"bug");function _K(e){return typeof e=="object"&&e!==null&&Symbol.for("ConvexError")in e}s(_K,"isConvexError");var NK=s(e=>{console.warn(`[refusal/legacyStringMessage] a refusal arrived with a bare string message (${e.code??"no code"}): ${e.de}`)},"legacyReporter"),cE=new Set;function CK(e,t){if(e===void 0)return{de:"",en:""};if(typeof e=="string"){let n=t??e;return cE.has(n)||(cE.add(n),NK({code:t,de:e})),{de:e,en:""}}if(e!==null&&typeof e=="object"){let{de:n,en:r}=e;if(typeof n=="string"&&typeof r=="string")return{de:n,en:r}}_(`refusalOf: a ConvexError's message is neither { de, en } nor a string: ${JSON.stringify(e)}`)}s(CK,"refusalTextOf");function ui(e){if(!_K(e))return null;let t=e.data;if(typeof t=="string")return{code:null,message:{de:t,en:t}};if(t&&typeof t=="object"){let{code:n,message:r}=t,i=typeof n=="string"?n:null;return{code:i,message:CK(r,i)}}return null}s(ui,"refusalOf");function DK(e){let t=ui(e);if(t!==null&&(t.message.de!==""||t.message.en!==""))return{kind:"refusal",code:t.code,message:t.message};let n=e instanceof Error?e.message:String(e),r=/\[Request ID:\s*([0-9a-f]+)\]/i.exec(n)?.[1],i=n.replace(/\[CONVEX[^\]]*\]/g,"").replace(/\[Request ID:[^\]]*\]/gi,"").replace(/\bServer Error\b/gi,"").replace(/\bCalled by client\b/g,"").trim();return r!==void 0&&i===""?{kind:"redacted",requestId:r}:{kind:"technical",text:n}}s(DK,"classifyServerFailure");function FK(e){return{de:`Serverfehler (Request-ID ${e}) \u2014 Details in GlitchTip.`,en:`Server error (request ID ${e}) \u2014 details in GlitchTip.`}}s(FK,"serverFailureText");function eh(e){let t=DK(e);return t.kind==="refusal"?t.message.de!==""?t.message.de:t.message.en:t.kind==="redacted"?FK(t.requestId).de:t.text}s(eh,"operatorFailureLine");function fE(e,t,n,r,i){if(n||!r){e.write(`${JSON.stringify(t,null,2)}
|
|
83
83
|
`);return}e.write(`${LK(r(t),i)}
|
|
84
84
|
`)}s(fE,"emit");function pn(e){return eh(e)}s(pn,"errorMessage");function LK(e,t){if(e.length===0)return"(none)";let n=t??Object.keys(e[0]),r=n.map(a=>Math.max(a.length,...e.map(l=>(l[a]??"").length))),i=s(a=>a.map((l,d)=>l.padEnd(r[d])).join(" ").trimEnd(),"line"),o=[i(n),i(n.map((a,l)=>"\u2500".repeat(r[l])))];for(let a of e)o.push(i(n.map(l=>a[l]??"")));return o.join(`
|
|
85
85
|
`)}s(LK,"renderTable");function pE(e){if(!(e instanceof Error))return e;let t=ui(e),n=t?.message.de??"";if(t!==null&&n!==""){let o=new Error(t.code===null?n:`[${t.code}] ${n}`);return o.name="Refused",uE(o)}let r=eh(e);if(r===e.message)return e;let i=new Error(r);return i.name="ServerFailure",uE(i)}s(pE,"operatorError");function uE(e){return e.stack="",e}s(uE,"withoutStack");var Se=class extends A{static{s(this,"BaseCommand")}json=f.Boolean("--json",!1,{description:"Print raw JSON instead of a table"});async validateAndExecute(){try{return await super.validateAndExecute()}catch(t){let n=pE(t);return this.context.stderr.write(this.cli.error(n instanceof Error?n:new Error(String(n)))),eE(n)}}print(t,n,r){fE(this.context.stdout,t,this.json,n,r)}};var nn="1.47.0";var MK=Object.defineProperty,qK=s((e,t,n)=>t in e?MK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),mE=s((e,t,n)=>qK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),KK="color:rgb(0, 145, 255)";function jK(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}s(jK,"prefix_for_source");var nu=class{static{s(this,"DefaultLogger")}constructor(t){mE(this,"_onLogLineFuncs"),mE(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=t,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...t){if(this._verbose)for(let n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...t)}log(...t){for(let n of Object.values(this._onLogLineFuncs))n("info",...t)}warn(...t){for(let n of Object.values(this._onLogLineFuncs))n("warn",...t)}error(...t){for(let n of Object.values(this._onLogLineFuncs))n("error",...t)}};function th(e){let t=new nu(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}s(th,"instantiateDefaultLogger");function nh(e){return new nu(e)}s(nh,"instantiateNoopLogger");function Ji(e,t,n,r,i){let o=jK(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t==="info"){let a=i.match(/^\[.*?\] /);if(a===null){e.error(`[CONVEX ${o}(${r})] Could not parse console.log`);return}let l=i.slice(1,a[0].length-2),d=i.slice(a[0].length);e.log(`%c[CONVEX ${o}(${r})] [${l}]`,KK,d)}else e.error(`[CONVEX ${o}(${r})] ${i}`)}s(Ji,"logForFunction");var Qi=Symbol.for("functionName");var rh=Symbol.for("toReferencePath");function BK(e){return e[rh]??null}s(BK,"extractReferencePath");function UK(e){return e.startsWith("function://")}s(UK,"isFunctionHandle");function Mr(e){let t;if(typeof e=="string")UK(e)?t={functionHandle:e}:t={name:e};else if(e[Qi])t={name:e[Qi]};else{let n=BK(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}s(Mr,"getFunctionAddress");function Xn(e){let t=Mr(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;let n=e[Qi];if(!n)throw new Error(`${e} is not a functionReference`);return n}s(Xn,"getFunctionName");function Aa(e){return{[Qi]:e}}s(Aa,"makeFunctionReference");function yE(e=[]){let t={get(n,r){if(typeof r=="string"){let i=[...e,r];return yE(i)}else if(r===Qi){if(e.length<2){let a=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}let i=e.slice(0,-1).join("/"),o=e[e.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}s(yE,"createApi");var ru=yE();var zK=Object.defineProperty,WK=s((e,t,n)=>t in e?zK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),ih=s((e,t,n)=>WK(e,typeof t!="symbol"?t+"":t,n),"__publicField"),Zi=class e{static{s(this,"Long")}constructor(t,n){ih(this,"low"),ih(this,"high"),ih(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?wE:t>=HK?YK:new e(t%Ea|0,t/Ea|0)}toString(){return(BigInt(this.high)*BigInt(Ea)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?e.fromNumber(t):new e(t.low,t.high)}},wE=new Zi(0,0),bE=65536,Ea=bE*bE,HK=Ea*Ea,YK=new Zi(-1,-1);var oh=class extends Error{static{s(this,"InvalidTokenError")}};oh.prototype.name="InvalidTokenError";var UQ=480*60*60*1e3;import{createRequire as ej}from"module";import{resolve as tj}from"path";var ZK;function kE(e){ZK=e}s(kE,"setDefaultWebSocketConstructor");var Jo=ej(tj(".")),nj=Object.create,vE=Object.defineProperty,rj=Object.getOwnPropertyDescriptor,xE=Object.getOwnPropertyNames,ij=Object.getPrototypeOf,oj=Object.prototype.hasOwnProperty,it=(e=>typeof Jo<"u"?Jo:typeof Proxy<"u"?new Proxy(e,{get:s((t,n)=>(typeof Jo<"u"?Jo:t)[n],"get")}):e)(function(e){if(typeof Jo<"u")return Jo.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Ct=s((e,t)=>s(function(){return t||(0,e[xE(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),sj=s((e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xE(t))!oj.call(e,i)&&i!==n&&vE(e,i,{get:s(()=>t[i],"get"),enumerable:!(r=rj(t,i))||r.enumerable});return e},"__copyProps"),fi=s((e,t,n)=>(n=e!=null?nj(ij(e)):{},sj(t||!e||!e.__esModule?vE(n,"default",{value:e,enumerable:!0}):n,e)),"__toESM"),pi=Ct({"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(e,t){"use strict";var n=["nodebuffer","arraybuffer","fragments"],r=typeof Blob<"u";r&&n.push("blob"),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:r,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:s(()=>{},"NOOP")}}}),aj=Ct({"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(e,t){var n=it("fs"),r=it("path"),i=it("os"),o=typeof __webpack_require__=="function"?__non_webpack_require__:it,a=process.config&&process.config.variables||{},l=!!process.env.PREBUILDS_ONLY,d=process.versions.modules,c=W()?"electron":Y()?"node-webkit":"node",u=process.env.npm_config_arch||i.arch(),p=process.env.npm_config_platform||i.platform(),m=process.env.LIBC||(pe(p)?"musl":"glibc"),g=process.env.ARM_VERSION||(u==="arm64"?"8":a.arm_version)||"",w=(process.versions.uv||"").split(".")[0];t.exports=y;function y(te){return o(y.resolve(te))}s(y,"load"),y.resolve=y.path=function(te){te=r.resolve(te||".");try{var oe=o(r.join(te,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[oe+"_PREBUILD"]&&(te=process.env[oe+"_PREBUILD"])}catch{}if(!l){var I=T(r.join(te,"build/Release"),$);if(I)return I;var R=T(r.join(te,"build/Debug"),$);if(R)return R}var B=le(te);if(B)return B;var D=le(r.dirname(process.execPath));if(D)return D;var Z=["platform="+p,"arch="+u,"runtime="+c,"abi="+d,"uv="+w,g?"armv="+g:"","libc="+m,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+Z+`
|
|
@@ -6803,7 +6803,7 @@ plexus-cli offer workflow node set --dir <bundle> --node engagePush --payment '$
|
|
|
6803
6803
|
# goes out (\u201E\u201EVertrag" jetzt senden?" on \u201EBereitstellen"). \`--approval none\` drops
|
|
6804
6804
|
# assign.releaseApproval + titles.approve; \`--approval release\` restores a
|
|
6805
6805
|
# Freigabe (title via --approve-title, default "<Dokument> freigeben") and drops
|
|
6806
|
-
# the confirmation. Same edits as the IDE's
|
|
6806
|
+
# the confirmation. Same edits as the IDE's Knoten \u2192 Einstellungen.
|
|
6807
6807
|
plexus-cli offer workflow node set --dir <bundle> --node contract --approval none --confirm-issue true
|
|
6808
6808
|
|
|
6809
6809
|
# Document node that the family returns signed (signedUpload / signedUploadChecked):
|
|
@@ -9629,7 +9629,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
9629
9629
|
## Related
|
|
9630
9630
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli workers reap --help\`,
|
|
9631
9631
|
\`plexus-cli imports cleanup-orphaned --help\`.
|
|
9632
|
-
`};var wu="08db88abf316f2d7b1167f82085d62710403ec0e69ed38f36ef4780f4e682842",zh=ZT;var Wh=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=A.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:wu,tools:La}),0}},Hh=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=A.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let t=JSON.parse(await Gh(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},XT=[Wh,Hh];var Yh=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Vte=new Set(Yh.map(e=>e.key));function t$(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(t$,"resolveStartTarget");function oB(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(oB,"applicantText");function n$(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:oB(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(n$,"applicationRows");var e$=Yh.map(e=>e.email);function r$(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(jh(e,t)&&(r===void 0||!e$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${e$.join(", ")} (--applicant) \u2014 never a real family's`)}s(r$,"assertStartApplicant");function i$(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(i$,"processStoreJson");function sB(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(sB,"refText");function aB(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?sB(e.ref):JSON.stringify(e.value)}s(aB,"holds");function o$(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:aB(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s(o$,"storeRows");function bu(e){let t={},n={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(bu,"parseKv");var s$="started",ku="submitted",a$="submitted",l$="load-scenario:";var d$="(Bewerbung)";function c$(e){return{nodeId:d$,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(c$,"sharedAsList");function u$(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(u$,"disabledText");function f$(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:u$(r)})))}s(f$,"actionRows");function p$(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${u$(a)}`);if(i!==d$)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(p$,"nodeOfferingAction");function m$(e,t,n){if(e.startsWith(l$)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(m$,"runParams");async function lB(e,t){let n=await e.query(S.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(lB,"currentNodeIds");function dB(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(dB,"refusalText");async function vu(e,t,n){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${dB(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(S.workflow.listTestActions,{applicationId:t,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,c$(r.actions)]}s(vu,"actionsOf");async function h$(e,t,n){return n!==void 0?[n]:await lB(e,t)}s(h$,"nodesOf");var Jh=class extends C{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=A.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await vu(t,this.application,await h$(t,this.application,this.node));return this.print(n,f$,["node","action","label","disabled"]),0}},Qh=class extends C{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=A.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (upload-signed-document)"});async execute(){let t=m$(this.action,this.autoSubmit,bu(this.param??[]).values),n=await this.caller(),r=this.application,i=await h$(n,this.application,this.node),o=p$(await vu(n,r,i),this.action,i);return await n.mutation(S.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},g$=[Jh,Qh];var ze=["de","en"];function ts(e,t){return ze.every(n=>e[n]===t[n])}s(ts,"sameText");function wt(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(wt,"missingLocales");function gi(e){let t=wt(e);return t!=="not-localized"&&t.length===0}s(gi,"isLocalizedText");function Ma(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(Ma,"composeTexts");var tr=/^[a-z][A-Za-z0-9]*$/;function Zh(e){return typeof e=="string"&&tr.test(e)}s(Zh,"isNodeId");function ns(e,t){Zh(e)||_(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${tr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ns,"makeNodeId");var yi="$env";function se(e){if(e.scope==="env")return`${yi}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var br=/^[a-z][a-zA-Z0-9_]*$/,cB=/^[A-Za-z_][A-Za-z0-9_]*$/;function ro(e){return typeof e=="string"&&e.split(".").every(t=>cB.test(t))}s(ro,"isPath");function Kr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&ro(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!br.test(i)?null:y$({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!br.test(o)||(n==="node"?!tr.test(i):!br.test(i))?null:y$({scope:n,owner:i,key:o},a)}default:return null}}s(Kr,"tryParseAddress");function y$(e,t){if(t.length===0)return e;let n=t.join(".");return ro(n)?{...e,path:n}:null}s(y$,"withPath");function ve(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!ro(t.path))return!1;switch(t.scope){case"env":return ro(t.key);case"derived":return typeof t.key=="string"&&br.test(t.key);case"node":return typeof t.owner=="string"&&tr.test(t.owner)&&typeof t.key=="string"&&br.test(t.key);case"task":return typeof t.owner=="string"&&br.test(t.owner)&&typeof t.key=="string"&&br.test(t.key);default:return!1}}s(ve,"isAddress");var jr={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},rs=Object.keys(jr);function is(e){return Object.hasOwn(jr,e)}s(is,"isEnvKey");var uB=["self-service","staff"];function w$(e,t){return{kind:"fixed",values:e,labels:t}}s(w$,"fixedSet");var xu={of:"applicant.language",withoutValue:"de"},Br={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:xu},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:xu},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:xu},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:xu},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:w$(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:w$(uB,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Su={types:jr,fields:Br},Au=rs.flatMap(e=>Object.keys(jr[e]).map(t=>`${e}.${t}`));function nr(e){return Object.hasOwn(Br,e)}s(nr,"isEnvLeaf");function Eu(e){return`${yi}.${e}`}s(Eu,"envIdentifier");function io(e){let t=Br[e],[n,r]=e.split("."),i=jr[n][r];i===void 0&&_(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&_(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(io,"envLeaf");var b$="staffInput";var fB=["boolean"],qa=/^[a-z][A-Za-z0-9]*$/;function Tu(e){return e.staffInputs??[]}s(Tu,"staffInputsOf");function $u(e){return`${b$}.${e}`}s($u,"staffInputLeaf");function k$(e){return`${yi}.${$u(e)}`}s(k$,"staffInputIdentifier");function pB(e){let t=`${b$}.`;return e.startsWith(t)?e.slice(t.length):null}s(pB,"staffInputKeyOfLeaf");function Ka(e,t){let n=pB(t);return n===null?void 0:Tu(e).find(r=>r.key===n)}s(Ka,"declaredStaffInput");function mB(e){return[...Tu(e).map(t=>({leaf:$u(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Au.map(t=>{let n=io(t);return{leaf:t,type:n.type,label:n.label,valueSet:Br[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(mB,"envLeavesFor");function v$(e){return mB(e).filter(t=>!t.cohortBound)}s(v$,"conditionEnvLeaves");function x$(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of v$(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(x$,"envConditionSchemaFor");function S$(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};qa.test(l.key)||n.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&n.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),fB.includes(l.type)||n.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=wt(l.label);c==="not-localized"?n.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&n.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),n}s(S$,"staffInputIssues");var ag={required:!0,description:"Offer slug (its offerKey)"},Xh=class extends C{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=A.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",ag);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(S.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=n$(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},eg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=A.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",ag);async execute(){let t=await this.caller(),n=await t.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},tg=class extends C{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=A.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(S.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(S.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerKey},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},ng=class extends C{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=A.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.processStoreView.get,{applicationId:this.application});return this.print(i$(n),()=>o$(n),["address","state","holds","producer","written"]),0}},rg=class extends C{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=A.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",ag);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let t=await this.caller();r$(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=t$(await t.query(S.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(S.applicants.partyByEmail,{client:n,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await t.mutation(S.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:E$(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await vu(t,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},ig=class extends C{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=A.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=f.String({required:!0});async execute(){return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},og=class extends C{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=A.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},sg=class extends C{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=A.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=E$([this.input]);return await t.mutation(S.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},A$=[Xh,eg,tg,ng,rg,ig,og,sg];function E$(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!qa.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(E$,"parseStaffInputs");var dg="bundle.yaml",T$="manifest.json",cg="smartforms",$$="workflow.json";function lg(e){return JSON.parse(ke(e,"utf8"))}s(lg,"readJson");function Pe(e){return JSON.stringify(ug(e),null,2)+`
|
|
9632
|
+
`};var wu="e73445840aa748e946a37138891d8ff4c5ca341cd6f7bd81f65aa50570e43f32",zh=ZT;var Wh=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=A.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:wu,tools:La}),0}},Hh=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=A.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let t=JSON.parse(await Gh(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},XT=[Wh,Hh];var Yh=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Vte=new Set(Yh.map(e=>e.key));function t$(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(t$,"resolveStartTarget");function oB(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(oB,"applicantText");function n$(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:oB(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(n$,"applicationRows");var e$=Yh.map(e=>e.email);function r$(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(jh(e,t)&&(r===void 0||!e$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${e$.join(", ")} (--applicant) \u2014 never a real family's`)}s(r$,"assertStartApplicant");function i$(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(i$,"processStoreJson");function sB(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(sB,"refText");function aB(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?sB(e.ref):JSON.stringify(e.value)}s(aB,"holds");function o$(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:aB(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s(o$,"storeRows");function bu(e){let t={},n={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(bu,"parseKv");var s$="started",ku="submitted",a$="submitted",l$="load-scenario:";var d$="(Bewerbung)";function c$(e){return{nodeId:d$,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(c$,"sharedAsList");function u$(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(u$,"disabledText");function f$(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:u$(r)})))}s(f$,"actionRows");function p$(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${u$(a)}`);if(i!==d$)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(p$,"nodeOfferingAction");function m$(e,t,n){if(e.startsWith(l$)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(m$,"runParams");async function lB(e,t){let n=await e.query(S.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(lB,"currentNodeIds");function dB(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(dB,"refusalText");async function vu(e,t,n){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${dB(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(S.workflow.listTestActions,{applicationId:t,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,c$(r.actions)]}s(vu,"actionsOf");async function h$(e,t,n){return n!==void 0?[n]:await lB(e,t)}s(h$,"nodesOf");var Jh=class extends C{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=A.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await vu(t,this.application,await h$(t,this.application,this.node));return this.print(n,f$,["node","action","label","disabled"]),0}},Qh=class extends C{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=A.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (upload-signed-document)"});async execute(){let t=m$(this.action,this.autoSubmit,bu(this.param??[]).values),n=await this.caller(),r=this.application,i=await h$(n,this.application,this.node),o=p$(await vu(n,r,i),this.action,i);return await n.mutation(S.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},g$=[Jh,Qh];var ze=["de","en"];function ts(e,t){return ze.every(n=>e[n]===t[n])}s(ts,"sameText");function wt(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(wt,"missingLocales");function gi(e){let t=wt(e);return t!=="not-localized"&&t.length===0}s(gi,"isLocalizedText");function Ma(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(Ma,"composeTexts");var tr=/^[a-z][A-Za-z0-9]*$/;function Zh(e){return typeof e=="string"&&tr.test(e)}s(Zh,"isNodeId");function ns(e,t){Zh(e)||_(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${tr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ns,"makeNodeId");var yi="$env";function se(e){if(e.scope==="env")return`${yi}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var br=/^[a-z][a-zA-Z0-9_]*$/,cB=/^[A-Za-z_][A-Za-z0-9_]*$/;function ro(e){return typeof e=="string"&&e.split(".").every(t=>cB.test(t))}s(ro,"isPath");function Kr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&ro(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!br.test(i)?null:y$({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!br.test(o)||(n==="node"?!tr.test(i):!br.test(i))?null:y$({scope:n,owner:i,key:o},a)}default:return null}}s(Kr,"tryParseAddress");function y$(e,t){if(t.length===0)return e;let n=t.join(".");return ro(n)?{...e,path:n}:null}s(y$,"withPath");function ve(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!ro(t.path))return!1;switch(t.scope){case"env":return ro(t.key);case"derived":return typeof t.key=="string"&&br.test(t.key);case"node":return typeof t.owner=="string"&&tr.test(t.owner)&&typeof t.key=="string"&&br.test(t.key);case"task":return typeof t.owner=="string"&&br.test(t.owner)&&typeof t.key=="string"&&br.test(t.key);default:return!1}}s(ve,"isAddress");var jr={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},rs=Object.keys(jr);function is(e){return Object.hasOwn(jr,e)}s(is,"isEnvKey");var uB=["self-service","staff"];function w$(e,t){return{kind:"fixed",values:e,labels:t}}s(w$,"fixedSet");var xu={of:"applicant.language",withoutValue:"de"},Br={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:xu},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:xu},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:xu},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:xu},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:w$(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:w$(uB,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Su={types:jr,fields:Br},Au=rs.flatMap(e=>Object.keys(jr[e]).map(t=>`${e}.${t}`));function nr(e){return Object.hasOwn(Br,e)}s(nr,"isEnvLeaf");function Eu(e){return`${yi}.${e}`}s(Eu,"envIdentifier");function io(e){let t=Br[e],[n,r]=e.split("."),i=jr[n][r];i===void 0&&_(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&_(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(io,"envLeaf");var b$="staffInput";var fB=["boolean"],qa=/^[a-z][A-Za-z0-9]*$/;function Tu(e){return e.staffInputs??[]}s(Tu,"staffInputsOf");function $u(e){return`${b$}.${e}`}s($u,"staffInputLeaf");function k$(e){return`${yi}.${$u(e)}`}s(k$,"staffInputIdentifier");function pB(e){let t=`${b$}.`;return e.startsWith(t)?e.slice(t.length):null}s(pB,"staffInputKeyOfLeaf");function Ka(e,t){let n=pB(t);return n===null?void 0:Tu(e).find(r=>r.key===n)}s(Ka,"declaredStaffInput");function mB(e){return[...Tu(e).map(t=>({leaf:$u(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Au.map(t=>{let n=io(t);return{leaf:t,type:n.type,label:n.label,valueSet:Br[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(mB,"envLeavesFor");function v$(e){return mB(e).filter(t=>!t.cohortBound)}s(v$,"conditionEnvLeaves");function x$(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of v$(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(x$,"envConditionSchemaFor");function S$(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};qa.test(l.key)||n.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&n.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),fB.includes(l.type)||n.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=wt(l.label);c==="not-localized"?n.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&n.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),n}s(S$,"staffInputIssues");var ag={required:!0,description:"Offer slug (its offerKey)"},Xh=class extends C{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=A.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",ag);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(S.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=n$(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},eg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=A.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",ag);async execute(){let t=await this.caller(),n=await t.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},tg=class extends C{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=A.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(S.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(S.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerKey},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},ng=class extends C{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=A.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.processStoreView.get,{applicationId:this.application});return this.print(i$(n),()=>o$(n),["address","state","holds","producer","written"]),0}},rg=class extends C{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=A.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",ag);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let t=await this.caller();r$(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=t$(await t.query(S.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(S.applicants.partyByEmail,{client:n,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await t.mutation(S.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:E$(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await vu(t,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},ig=class extends C{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=A.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=f.String({required:!0});async execute(){return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},og=class extends C{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=A.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},sg=class extends C{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=A.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=E$([this.input]);return await t.mutation(S.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},A$=[Xh,eg,tg,ng,rg,ig,og,sg];function E$(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!qa.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(E$,"parseStaffInputs");var dg="bundle.yaml",T$="manifest.json",cg="smartforms",$$="workflow.json";function lg(e){return JSON.parse(ke(e,"utf8"))}s(lg,"readJson");function Pe(e){return JSON.stringify(ug(e),null,2)+`
|
|
9633
9633
|
`}s(Pe,"canonicalJson");function ug(e){return Array.isArray(e)?e.map(ug):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,ug(e[t])])):e}s(ug,"sortKeys");function Ie(e){let t=H.resolve(e),n=H.join(t,dg);if(!Oe(n))throw new Error(`offer: no ${dg} in ${t}`);let r=eo.load(ke(n,"utf8"));hB(r,n);let i=H.join(t,$$),o,a=Object.keys(r.smartforms??{});if(a.length>0){o={};for(let l of a){let d=H.join(t,cg,`${l}.json`);if(!Oe(d))throw new Error(`offer: bundle.yaml declares smartform "${l}" but ${cg}/${l}.json is missing`);o[l]=lg(d)}}return{dir:t,index:r,manifest:lg(H.join(t,T$)),...o?{smartforms:o}:{},...Oe(i)?{workflow:lg(i)}:{}}}s(Ie,"readBundle");function Ru(e,t,n,r){Oe(e)&&Pe(r(ke(e,"utf8")))===Pe(t)||gt(e,n,"utf8")}s(Ru,"writeIfChanged");function Un(e){if(Wt(e.dir,{recursive:!0}),Ru(H.join(e.dir,dg),e.index,eo.dump(e.index,{lineWidth:100,sortKeys:!1}),t=>eo.load(t)),Ru(H.join(e.dir,T$),e.manifest,Pe(e.manifest),JSON.parse),e.smartforms!==void 0){let t=H.join(e.dir,cg);Wt(t,{recursive:!0});for(let[n,r]of Object.entries(e.smartforms))Ru(H.join(t,`${n}.json`),r,Pe(r),JSON.parse)}e.workflow!==void 0&&Ru(H.join(e.dir,$$),e.workflow,Pe(e.workflow),JSON.parse)}s(Un,"writeBundle");function hB(e,t){let n=[];if(e?.module||n.push("module"),e?.tenant||n.push("tenant"),e?.label||n.push("label"),e?.slugs?.manifest||n.push("slugs.manifest"),n.length>0)throw new Error(`offer: ${t} is missing required keys: ${n.join(", ")}`)}s(hB,"assertIndex");var gB=new Set(["if","else","in","true","false","null"]),yB=new Set(["==","!=","<=",">=","&&","||"]);function wB(e){return e>="0"&&e<="9"}s(wB,"isDigit");function bB(e){return/[a-zA-Z_$]/.test(e)}s(bB,"isIdentStart");function kB(e){return/[a-zA-Z0-9_.$]/.test(e)}s(kB,"isIdentCont");function vB(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
|
|
9634
9634
|
`||r==="\r"){n++;continue}if(r==="'"){let o=n+1,a="";for(;o<e.length&&e.charAt(o)!=="'";)e.charAt(o)==="\\"&&o+1<e.length?(a+=e.charAt(o+1),o+=2):(a+=e.charAt(o),o++);o>=e.length&&_(`Unterminated string at ${n}`),t.push({t:"str",v:a}),n=o+1;continue}if(wB(r)){let o=n;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;t.push({t:"num",v:Number(e.slice(n,o))}),n=o;continue}if(bB(r)){let o=n;for(;o<e.length&&kB(e.charAt(o));)o++;let a=e.slice(n,o);gB.has(a)?t.push({t:"kw",v:a}):t.push({t:"ident",v:a}),n=o;continue}let i=e.slice(n,n+2);if(yB.has(i)){t.push({t:"op",v:i}),n+=2;continue}if("<>!".includes(r)){t.push({t:"op",v:r}),n++;continue}if("()[],".includes(r)){t.push({t:"punct",v:r}),n++;continue}_(`Unexpected char '${r}' at ${n}`)}return t}s(vB,"tokenise");var R$=1e4,I$=128;function os(e){e.depth++,e.depth>I$&&_(`Expression nesting too deep (> ${I$})`)}s(os,"enterDepth");function D$(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(D$,"peek");function Dt(e){let t=e.tokens[e.pos];return t||_(`Unexpected end at ${e.pos}`),e.pos++,t}s(Dt,"take");function Ft(e,t,n){let r=D$(e);return!(!r||r.t!==t||n!==void 0&&r.v!==n)}s(Ft,"match");function oo(e,t,n){return Ft(e,t,n)||_(`Expected ${t}${n?`:${n}`:""} at ${e.pos}`),Dt(e)}s(oo,"expect");function Vr(e){os(e);try{return Ft(e,"kw","if")?xB(e):SB(e)}finally{e.depth--}}s(Vr,"parseExpr");function xB(e){oo(e,"kw","if"),oo(e,"punct","(");let t=Vr(e);oo(e,"punct",")");let n=Vr(e);oo(e,"kw","else");let r=Vr(e);return{kind:"if",cond:t,then:n,else:r}}s(xB,"parseIf");function SB(e){let t=O$(e),n=0;try{for(;Ft(e,"op","||");){Dt(e),os(e),n++;let r=O$(e);t={kind:"binary",op:"||",left:t,right:r}}}finally{e.depth-=n}return t}s(SB,"parseLogicOr");function O$(e){let t=P$(e),n=0;try{for(;Ft(e,"op","&&");){Dt(e),os(e),n++;let r=P$(e);t={kind:"binary",op:"&&",left:t,right:r}}}finally{e.depth-=n}return t}s(O$,"parseLogicAnd");function P$(e){let t=_$(e),n=0;try{for(;Ft(e,"op","==")||Ft(e,"op","!=");){let r=Dt(e).v;os(e),n++;let i=_$(e);t={kind:"binary",op:r,left:t,right:i}}}finally{e.depth-=n}return t}s(P$,"parseEquality");function _$(e){let t=pg(e),n=0;try{for(;Ft(e,"op","<")||Ft(e,"op","<=")||Ft(e,"op",">")||Ft(e,"op",">=")||Ft(e,"kw","in");){let r=Dt(e),i=r.t==="kw"?"in":r.v;os(e),n++;let o=pg(e);t={kind:"binary",op:i,left:t,right:o}}}finally{e.depth-=n}return t}s(_$,"parseCompare");function pg(e){if(Ft(e,"op","!")){Dt(e),os(e);try{return{kind:"unary",op:"!",operand:pg(e)}}finally{e.depth--}}return AB(e)}s(pg,"parseUnary");function AB(e){let t=D$(e);if(t||_("Unexpected end"),t.t==="num")return Dt(e),{kind:"num",value:t.v};if(t.t==="str")return Dt(e),{kind:"str",value:t.v};if(t.t==="kw"&&t.v==="true")return Dt(e),{kind:"bool",value:!0};if(t.t==="kw"&&t.v==="false")return Dt(e),{kind:"bool",value:!1};if(t.t==="kw"&&t.v==="null")return Dt(e),{kind:"null"};if(t.t==="punct"&&t.v==="("){Dt(e);let n=Vr(e);return oo(e,"punct",")"),n}if(t.t==="punct"&&t.v==="["){Dt(e);let n=[];if(!Ft(e,"punct","]"))for(n.push(Vr(e));Ft(e,"punct",",");)Dt(e),n.push(Vr(e));return oo(e,"punct","]"),{kind:"arr",items:n}}if(t.t==="ident"){let n=t.v;if(Dt(e),Ft(e,"punct","(")){Dt(e);let r=[];if(!Ft(e,"punct",")"))for(r.push(Vr(e));Ft(e,"punct",",");)Dt(e),r.push(Vr(e));return oo(e,"punct",")"),{kind:"call",name:n,args:r}}return{kind:"ident",path:n}}_(`Unexpected token at ${e.pos}`)}s(AB,"parsePrimary");function Lt(e){e.length>R$&&_(`Expression too long (${e.length} > ${R$})`);let t={tokens:vB(e),pos:0,depth:0},n=Vr(t);return t.pos<t.tokens.length&&_(`Unexpected trailing token at ${t.pos}`),n}s(Lt,"parseExpression");var EB=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,t)=>{if(typeof e!="string"||typeof t!="string")return null;let n=new Date(e),r=new Date(t);if(isNaN(n.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return(o<0||o===0&&r.getDate()<n.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function ht(e,t){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let n=Object.hasOwn(t.values,e.path)?t.values[e.path]:void 0;return n===void 0?null:n}case"arr":return e.items.map(n=>ht(n,t));case"unary":{let n=ht(e.operand,t);return!wi(n)}case"call":{let n=t.functions!==void 0&&Object.hasOwn(t.functions,e.name)?t.functions[e.name]:EB.get(e.name);n||_(`Unknown function '${e.name}'`);let r=e.args.map(i=>ht(i,t));return n(...r)}case"binary":return TB(e.op,e.left,e.right,t);case"if":return wi(ht(e.cond,t))?ht(e.then,t):ht(e.else,t)}}s(ht,"evaluate");function TB(e,t,n,r){if(e==="&&"){let a=ht(t,r);return wi(a)?wi(ht(n,r)):!1}if(e==="||"){let a=ht(t,r);return wi(a)?!0:wi(ht(n,r))}let i=ht(t,r),o=ht(n,r);switch(e){case"==":return fg(i,o);case"!=":return!fg(i,o);case"<":{let[a,l]=Iu(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=Iu(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=Iu(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=Iu(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>fg(a,i)):!1}}s(TB,"evalBinary");function Iu(e,t){return[N$(e),N$(t)]}s(Iu,"orderedOperands");function N$(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}return null}s(N$,"numericOperand");function fg(e,t){return e===t?!0:e==null||t==null?!1:typeof e=="number"&&typeof t=="string"?e===Number(t):typeof e=="string"&&typeof t=="number"?Number(e)===t:!1}s(fg,"looseEq");function wi(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(wi,"truthy");function bt(e){let t=new Set;return Ur(e,t),[...t]}s(bt,"dependencies");function Ur(e,t){switch(e.kind){case"ident":t.add(e.path);return;case"call":e.args.forEach(n=>Ur(n,t));return;case"arr":e.items.forEach(n=>Ur(n,t));return;case"unary":Ur(e.operand,t);return;case"binary":Ur(e.left,t),Ur(e.right,t);return;case"if":Ur(e.cond,t),Ur(e.then,t),Ur(e.else,t);return;default:return}}s(Ur,"walk");var C$=new Map;function rr(e){let t=C$.get(e);return t||(t=Lt(e),C$.set(e,t)),t}s(rr,"parseCached");function $B(e,t){return ht(rr(e),t)}s($B,"evalExpression");function F$(e,t){return wi($B(e,t))}s(F$,"evalBoolean");var ss={team:{label:{de:"Team",en:"Team"},optionSource:"tenantTeams",existence:{check:"generic",catalog:"teamKeys"}},roleKey:{label:{de:"Rolle",en:"Role"},optionSource:"tenantRoles",existence:{check:"node",codes:["roleAssign/unknownRoleKey","completenessCheck/unknownRole"]}},article:{label:{de:"Artikel",en:"Article"},optionSource:"programArticles",existence:{check:"node",codes:["collectPayment/unknownArticle"]}},legalEntity:{label:{de:"Tr\xE4ger",en:"Legal entity"},optionSource:"tenantTraeger",existence:{check:"node",codes:["governedDocument/unknownTraeger","collectPayment/unknownPayee"]}},contractGenerator:{label:{de:"Vertragsgenerator",en:"Contract generator"},optionSource:"tenantGenerators",existence:{check:"publish",by:"admittedGeneratorByKey"}},documentTemplate:{label:{de:"Dokumentvorlage",en:"Document template"},optionSource:"tenantDocumentTemplates",existence:{check:"publish",by:"governedDocument/unknownTemplate"}},smartForm:{label:{de:"Formular",en:"Form"},optionSource:"offerSmartForms",existence:{check:"publish",by:"form/unknownSmartForm"}},unit:{label:{de:"Einrichtung",en:"Unit"},optionSource:"tenantUnits",existence:{check:"generic",catalog:"unitKeys"}},formFlag:{label:{de:"Merkmal im Formular",en:"Flag in the form"},optionSource:"targetFormFlags",existence:{check:"node",codes:["setFlag/unknownFlag"]}}};function Ou(e){return typeof e=="string"&&Object.hasOwn(ss,e)}s(Ou,"isResourceType");var ere=Object.keys(ss).filter(e=>ss[e].existence.check==="generic");var $n="contractGenerator",mg="documentTemplate";function ja(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(ja,"isGeneratorRef");function L$(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(L$,"literalOf");function Gr(e){let t=L$(e,$n);return ja(t)?t:null}s(Gr,"generatorRefOfNode");function ir(e){let t=L$(e,mg);return typeof t=="string"&&t.length>0?t:null}s(ir,"documentTemplateKeyOfNode");function M$(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(M$,"generatorRefLabel");var q$=/^\d{4}-\d{2}-\d{2}$/;function or(e,t){return{de:e,en:t}}s(or,"issue");function so(e){if(typeof e!="object"||e===null)return or("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:or('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return or(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?or("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!q$.test(r)?or("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!q$.test(i)?or("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?or("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?or("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?or("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?or("unbekannte Angaben","unknown details"):null:or("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(so,"reductionShapeIssue");function K$(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.groupKey=="string"&&t.groupKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||so(t.reduction)===null&&t.reduction.kind==="amount")&&Object.keys(t).every(n=>n==="groupKey"||n==="grantKeys"||n==="reduction")}s(K$,"isPricedGroupValue");var hg=["street","hausnr","plz","ort","land"];function j$(e){return hg.includes(e)}s(j$,"isAddressPart");var RB=["municipality","municipalityKey","district","districtKey"],gg=[...hg,...RB],yg={string:"text",email:"text",tel:"text",number:"number",date:"date",boolean:"boolean",enum:"option",address:"composite",docRef:"file",party:"edge",personRef:"edge",personList:"edge",roleKey:"roleKey",pricedItem:"pricedItem",pricedGroup:"pricedGroup",reduction:"reduction",article:"article",legalEntity:"legalEntity",contractGenerator:"contractGenerator",documentTemplate:"documentTemplate",localizedText:"localizedText"},as=Object.keys(yg);function bi(e){return typeof e=="string"&&e in yg}s(bi,"isValueType");function mn(e){return e===void 0?void 0:yg[e]}s(mn,"dataTypeOf");function Pu(e,t){let n=mn(e),r=mn(t);return n!==void 0&&n===r}s(Pu,"valueTypesCompatible");function wg(e){return e===null?"null is not a text in both languages":Ba(e,{type:"localizedText"})}s(wg,"completeLocalizedTextIssue");function Ba(e,t){if(Ou(t.type)&&!bi(t.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${t.type} key`;let n=mn(t.type),r=JSON.stringify(e),i=`slot type "${t.type}" takes a binding, not a literal`;if(n===void 0||n==="composite"||n==="file"||n==="edge")return i;if(e===null)return null;switch(n){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${t.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(t.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return K$(e)?null:`${r} is not a priced group {"groupKey":\u2026,"grantKeys":[\u2026]}`;case"article":return typeof e=="string"&&e.length>0?null:`${r} is not an article key`;case"legalEntity":return typeof e=="string"&&e.length>0?null:`${r} is not a legal entity key`;case"contractGenerator":return ja(e)?null:`${r} is not a contract generator {"kind":"generator"|"package","key":\u2026,"revision"?:n}`;case"documentTemplate":return typeof e=="string"&&e.length>0?null:`${r} is not a document template key`;case"roleKey":return typeof e=="string"&&e.length>0?null:`${r} is not a role key`;case"localizedText":{let o=e,a=s(l=>typeof l=="string"&&l.trim().length>0,"filled");return typeof o=="object"&&Object.keys(o).sort().join(",")==="de,en"&&a(o.de)&&a(o.en)?null:`${r} is not a text in both languages {"de":\u2026,"en":\u2026}`}case"reduction":{let o=so(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(Ba,"literalTypeIssue");var B$=yi,ki=`${B$}.`,IB=new Set(["text","number","date","boolean","option","edge"]);function _u(e,t){let n=e[t];return n===void 0&&_(`[env/unknownKey] no environment key '${t}'`),typeof n=="string"?null:Object.keys(n)}s(_u,"contextFields");function U$(e,t){return Object.hasOwn(e,t)}s(U$,"isContextKey");function V$(e){let t=[];for(let n of Object.keys(e)){let r=_u(e,n);if(r===null)t.push(n);else for(let i of r)t.push(`${n}.${i}`)}return t}s(V$,"leafPaths");function Ua(e,t){let[n="",r,...i]=t.split(".");if(!U$(e,n)||i.length>0)return;let o=e[n];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(Ua,"leafType");function G$(e){let t=new Set;for(let n of e){let r=ls(n);r!==null&&t.add(r.split(".")[0])}return[...t]}s(G$,"contextKeysOf");function ls(e){return e.startsWith(ki)?e.slice(ki.length):null}s(ls,"contextPathOf");function Va(e){return e===B$||e.startsWith(ki)}s(Va,"isContextIdentifier");function Nu(e,t){let n=ls(t)??"",[r=""]=n.split("."),i=Object.keys(e);if(!U$(e,r))return{code:"env/unknownKey",message:{de:`'${t}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${t}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(Ua(e,n)!==void 0)return null;let o=_u(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${t}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${ki}${r}'.`,en:`'${t}': environment key '${r}' is a single value \u2014 read it as '${ki}${r}'.`}:{de:`'${t}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${t}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(Nu,"identifierIssue");function Cu(e,t,n=Object.keys(e)){let r={};for(let i of n){let o=_u(e,i),a=Object.hasOwn(t,i)?t[i]:void 0;if(a===void 0&&_(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${ki}${i}`]=a;continue}for(let l of o){let d=typeof a=="object"&&a!==null&&Object.hasOwn(a,l)?a[l]:void 0;d===void 0&&_(`[env/missing] context key '${i}' carries no '${l}'`),r[`${ki}${i}.${l}`]=d}}return r}s(Cu,"flatten");function z$(e,t,n){if(n===void 0)return!1;let r=_u(e,t);return r===null?!0:typeof n=="object"&&n!==null&&r.every(i=>n[i]!==void 0)}s(z$,"contextValueComplete");function OB(e,t){switch(t){case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e);default:return typeof e=="string"}}s(OB,"valueMatchesDataType");function W$(e,t,n=Object.keys(e.types)){let r=new Set(n);for(let i of V$(e.types)){if(!r.has(i.split(".")[0]))continue;let o=t[`${ki}${i}`];o===void 0&&_(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||_(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=mn(Ua(e.types,i));OB(o,l)||_(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&_(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(W$,"assertContextValues");function PB(e){let t=[],n=V$(e.types);for(let r of n){let i=Ua(e.types,r),o=mn(i);if(!bi(i)||o===void 0||!IB.has(o)){t.push(`'${r}' has type '${String(i)}', not a scalar value type`);continue}let a=Object.hasOwn(e.fields,r)?e.fields[r]:void 0;if(a===void 0){t.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&t.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&t.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))n.includes(r)||t.push(`field spec '${r}' names no leaf of the schema`);return t}s(PB,"schemaIssues");function ds(e){let t=PB(e);t.length>0&&_(`[env/schema] ${t.join("; ")}`)}s(ds,"assertSchema");var Du={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function vi(e){return JSON.stringify(e)}s(vi,"canonical");function us(e){return e.kind==="binary"&&e.op==="&&"?[...us(e.left),...us(e.right)]:[e]}s(us,"conjuncts");function J$(e,t){let n;try{n=Lt(e)}catch{return!1}let r=vi(Lt(t));return us(n).some(i=>vi(i)===r)}s(J$,"hasConjunct");function Q$(e,t){try{return vi(Lt(e))===vi(Lt(t))}catch{return!1}}s(Q$,"sameCondition");function Z$(e){let t=[];for(let n of e)t.push(...bt(rr(n)));return G$(t)}s(Z$,"contextKeysRead");function X$(e){try{return bt(Lt(e)).some(Va)}catch{return!1}}s(X$,"readsContext");var _B=/^\d{4}-\d{2}-\d{2}$/,NB=new Set(["==","!=","<","<=",">",">=","in"]),CB=new Set(["<","<=",">",">="]);function Lu(e,t,n=[]){ds(t);let r;try{r=Lt(e)}catch(a){let l=a.message;return[Mt("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of bt(r)){if(!Va(a)){i.push(Mt("condition/foreignIdentifier",`'${a}' ist kein Umgebungswert \u2014 Bedingungen lesen nur '$env.*'`,`'${a}' is not a context identifier \u2014 conditions read only '$env.*'`));continue}let l=Nu(t.types,a);l!==null&&i.push(Mt("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=kr(r,t,i);Ga(o)||i.push(Mt("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),MB(r,t,i);for(let{identifier:a,op:l}of vg(r,t))i.push(Mt("condition/unguardedNullable",`'${l}' \xFCber '${a}', das leer sein kann, braucht davor eine Absicherung '${a} != null &&'`,`'${l}' over '${a}', which may be null, needs a guard '${a} != null &&' before it`));return i.push(...DB(r,n)),i}s(Lu,"conditionIssues");function DB(e,t){let n=us(e).map(vi);return t.flatMap(r=>{let i=Lt(r),o=FB(i);return o===null||!n.includes(vi(o))?[]:[{severity:"info",code:"condition/guardForm",message:{de:`[condition/guardForm] eine gespiegelte Absicherung z\xE4hlt nicht \u2014 schreibe sie genau als '${r}'`,en:`[condition/guardForm] a mirrored guard does not count \u2014 write it exactly as '${r}'`}}]})}s(DB,"guardFormHints");function FB(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let t={...e,left:e.right,right:e.left};return vi(t)===vi(e)?null:t}s(FB,"mirror");function Ga(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(Ga,"isBooleanish");function eR(e){let t=ls(e);return t===null&&_(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),t}s(eR,"contextPath");function tR(e,t){let n=ls(t);return n!==null&&e.fields[n]?.nullable===!0}s(tR,"isNullableLeaf");function LB(e,t){let n=mn(Ua(e.types,eR(t)));return n===void 0?{t:"unknown"}:{t:"data",dt:n}}s(LB,"identType");function Fu(e,t){return e.t==="unknown"||t.t==="unknown"||e.t==="null"||t.t==="null"?!0:e.t==="array"||t.t==="array"?!1:e.t==="str"&&t.t==="str"?!0:e.t==="str"?H$(e.value,t.dt):t.t==="str"?H$(t.value,e.dt):e.dt===t.dt}s(Fu,"fits");function H$(e,t){return t==="text"||t==="option"||t==="edge"?!0:t==="date"?_B.test(e):!1}s(H$,"strFits");function Y$(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(Y$,"orderedCategory");function kr(e,t,n){switch(e.kind){case"num":return{t:"data",dt:"number"};case"bool":return{t:"data",dt:"boolean"};case"str":return{t:"str",value:e.value};case"null":return{t:"null"};case"ident":return LB(t,e.path);case"arr":for(let r of e.items)kr(r,t,n);return{t:"array"};case"unary":{let r=kr(e.operand,t,n);return Ga(r)||n.push(Mt("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(Du,e.name)?Du[e.name]:void 0,i=e.args.map(l=>kr(l,t,n));return r===void 0?(n.push(Mt("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(Du).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(Du).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&Fu(l,{t:"data",dt:r.params[d]}))||n.push(Mt("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=kr(e.cond,t,n);Ga(r)||n.push(Mt("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=kr(e.then,t,n),o=kr(e.else,t,n);return Fu(i,o)||n.push(Mt("condition/typeMismatch","die beiden Zweige von 'if' haben verschiedene Typen","the two arms of 'if' differ in type")),i.t==="null"?o:i}case"binary":{let r=kr(e.left,t,n),i=kr(e.right,t,n);if(e.op==="&&"||e.op==="||")(!Ga(r)||!Ga(i))&&n.push(Mt("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?n.push(Mt("condition/inWithoutArray","'in' braucht rechts eine Liste, z. B. ['a', 'b']","'in' needs a list on its right, e.g. ['a', 'b']")):e.right.items.every(o=>Fu(r,kr(o,t,[])))||n.push(Mt("condition/typeMismatch","ein Listeneintrag von 'in' passt nicht zum Typ des linken Operanden","a list item of 'in' does not match the left operand's type"));else if(CB.has(e.op)){let o=Y$(r),a=Y$(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&n.push(Mt("condition/orderedComparison",`'${e.op}' vergleicht nur Zahlen \u2014 f\xFCr Daten years_between(\u2026) verwenden`,`'${e.op}' compares only numbers \u2014 for dates use years_between(\u2026)`))}else Fu(r,i)||n.push(Mt("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(kr,"typeOf");function bg(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(bg,"isLiteral");function nR(e){let t=[],n=s(r=>{if(r.kind==="binary"&&NB.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(bg):bg(r.right)?[r.right]:[];i.length>0&&t.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&bg(r.left)&&t.push({ident:r.right.path,literals:[r.left]})}rR(r,n)},"visit");return n(e),t}s(nR,"comparedLiterals");function MB(e,t,n){for(let{ident:r,literals:i}of nR(e)){let o=qB(r,i,t);o!==null&&n.push(o)}}s(MB,"literalIssues");function kg(e,t){let n;try{n=Lt(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of nR(n)){let a=ls(i);if(!(a===null||t.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(kg,"liveLiterals");function qB(e,t,n){let r=n.fields[eR(e)]?.valueSet;if(r?.kind==="unstable")return Mt("condition/literalOnUnstable",`'${e}' ist nicht \xFCber Umgebungen stabil \u2014 vergleiche ihn mit keinem festen Wert; verzweige stattdessen \xFCber ein stabiles Merkmal`,`'${e}' is not stable across environments \u2014 compare it to no literal; branch on a stable attribute instead`);if(r?.kind!=="fixed")return null;let i=t.flatMap(a=>a.kind==="str"&&!r.values.includes(a.value)?[`'${a.value}'`]:[]);if(i.length===0)return null;let o=r.values.map(a=>`'${a}'`).join(", ");return Mt("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(qB,"valueSetIssue");function rR(e,t){switch(e.kind){case"binary":t(e.left),t(e.right);return;case"unary":t(e.operand);return;case"call":e.args.forEach(t);return;case"arr":e.items.forEach(t);return;case"if":t(e.cond),t(e.then),t(e.else);return;default:return}}s(rR,"forEachChild");function iR(e){return e.kind==="binary"&&(e.op==="=="||e.op==="!=")&&(e.left.kind==="ident"&&e.right.kind==="null"||e.left.kind==="null"&&e.right.kind==="ident")}s(iR,"isNullTest");function oR(e){return us(e).flatMap(t=>{let n=sR(t);return n===null?[]:[n]})}s(oR,"guardsOf");function za(e,t,n){switch(e.kind){case"ident":return tR(t,e.path)&&!n.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=za(r,t,n);if(i!==null)return i}return null;case"if":return za(e.then,t,new Set([...n,...oR(e.cond)]))??za(e.else,t,n);default:return null}}s(za,"unguardedNullSource");function sR(e){return!iR(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(sR,"guardedIdent");function cs(e,t,n,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(n);for(let o of us(e)){cs(o,t,i,r);let a=sR(o);a!==null&&i.add(a)}return}if(e.kind==="if"){cs(e.cond,t,n,r),cs(e.then,t,new Set([...n,...oR(e.cond)]),r),cs(e.else,t,n,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=za(e.left,t,n)??za(e.right,t,n);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!iR(e.operand)){let i=bt(e.operand).filter(o=>tR(t,o)&&!n.has(o));i.length>0&&r(i[0],"!")}rR(e,i=>cs(i,t,n,r))}s(cs,"nullableReads");function vg(e,t){ds(t);let n=[];return cs(e,t,new Set,(r,i)=>{n.some(o=>o.identifier===r)||n.push({identifier:r,op:i})}),n}s(vg,"unguardedNullableReads");function Mt(e,t,n){return{severity:"error",code:e,message:{de:`[${e}] ${t}`,en:`[${e}] ${n}`}}}s(Mt,"error");function xi(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||so(t.reduction)===null&&t.reduction.kind==="amount")}s(xi,"isPricedItemValue");var fs=["freetext","recommendation","choice","pricedItem","record","reduction"],ps=[...fs,"appointment"];function lR(e){return typeof e=="string"&&ps.includes(e)}s(lR,"isTaskResultKind");function Si(e){return typeof e=="string"&&fs.includes(e)}s(Si,"isRecordedTaskResultKind");function ms(e){return Si(e.kind)}s(ms,"isRecordedTaskResult");var Mu=["number","boolean","enum"];function xg(e){return typeof e=="string"&&Mu.includes(e)}s(xg,"isRecordFieldType");var Sg=["form","siblingRank"];var zr={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function ao(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(ao,"isProseResult");function qu(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&xg(t.type)).map(t=>({key:t.writes,valueType:t.type,field:t})):KB(e)}s(qu,"draftResultStoreWrites");function KB(e){let t=zr[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(KB,"singleStoreWrite");var aR="team:";function hs(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(aR)){let t=e.slice(aR.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(hs,"parseTaskResultChat");var He={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",filesOnKind:"[taskResult/filesOnKind]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var gs={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},Ag=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function dR(e,t){if(typeof t!="string"||t.length===0)return null;if(e==="key")return t;let n=hs(t);return n?.kind==="team"?n.groupKey:null}s(dR,"decodeKey");function jB(e){let t=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return t===null&&_(`[resource] unreadable reference leaf "${e}"`),{list:t[1],field:t[2]??null,key:t[3]}}s(jB,"locate");function Ku(e){let t=[],n=e;for(let[r,i]of Object.entries(Ag(n.assign)??{})){let o=dR("key",i);t.push({path:`assign.${r}`,leaf:"assign{}",owner:r,key:o,missing:typeof i!="string"||i.length===0})}for(let r of Object.keys(gs)){if(r==="assign{}")continue;let i=gs[r],{list:o,field:a,key:l}=jB(r);for(let d of Array.isArray(n[o])?n[o]:[]){let c=Ag(d);if(c===null||typeof c.key!="string")continue;let p=(a===null?c:Ag(c[a]))?.[l];if(p===void 0&&!i.required)continue;let m=typeof p!="string"||p.length===0;t.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:dR(i.codec,p),missing:m})}}return t}s(Ku,"nodeResourceReferences");function Wa(e){let t=Array.isArray(e.nodes)?e.nodes:[],n=new Set;for(let r of t)for(let i of Ku(r))i.key!==null&&gs[i.leaf].involves&&n.add(i.key);return n}s(Wa,"declaredGroupKeys");var vt="responsible",Eg="team:";function Tg(e){return`${Eg}${e}`}s(Tg,"teamSlot");function $g(e){return e.startsWith(Eg)?e.slice(Eg.length):null}s($g,"teamKeyOfSlot");var ys=Su;var BB="unit.key",UB="offer.key";function cR(e,t){return e===BB?t.unitKeys:e===UB?t.offerKeys:null}s(cR,"liveKeyUniverse");function ju(e){return[vt,...[...Wa(e)].sort((t,n)=>t.localeCompare(n)).map(Tg)]}s(ju,"requiredSlots");var Ai=`${Eu("applicant.channel")} == 'staff'`;var Ig=["strict","leastLoaded"];var Rg=2;function uR(e){return e.some(t=>t.length===0)?{de:"nennt einen leeren Personenschl\xFCssel",en:"names an empty person key"}:new Set(e).size!==e.length?{de:"nennt eine Person zweimal",en:"names a person twice"}:e.length<Rg?{de:`braucht mindestens ${Rg} Personen`,en:`needs at least ${Rg} people`}:null}s(uR,"rotationPoolProblem");function VB(e,t){let n=t===null?-1:e.indexOf(t);return[...e.slice(n+1),...e.slice(0,n+1)]}s(VB,"strictOrder");function fR(e){let t=VB(e.pool,e.previous).filter(i=>e.eligible.has(i));if(t.length===0)return null;if(e.mode==="strict")return t[0];let n=e.openCounts;n===void 0&&_("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=n.get(i);return o===void 0&&_(`[assignment/rotation] no open count for '${i}'`),o},"load");return t.reduce((i,o)=>r(o)<r(i)?o:i)}s(fR,"pickFromPool");function mR(e,t){let n=e?.assignmentRules;n===void 0&&_(`[assignment/noRules] ${t}: the workflow has no assignment rule`);let r=wR(n);return r.length>0&&_(`${r.join("; ")} (${t})`),n}s(mR,"rulesOfGraph");function GB(e){return e===vt?{slot:e,rules:[{when:Ai,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(GB,"defaultSlotRules");function hR(e,t){let n=new Set(e.map(o=>o.slot)),r=t.filter(o=>!n.has(o)).map(GB);return[...r.filter(o=>o.slot===vt),...e,...r.filter(o=>o.slot!==vt)]}s(hR,"withRequiredSlots");function Tt(e,t){return t===void 0?`slot '${e}'`:`slot '${e}' row #${t+1}`}s(Tt,"where");function Rn(e,t){return t===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${t+1}`}s(Rn,"whereDe");function hn(e,t,n={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${t.de}`,en:`[${e}] ${t.en}`},...n}}s(hn,"issue");function pR(e){if(e===vt)return!0;let t=$g(e);return t!==null&&t.length>0}s(pR,"isKnownSlot");function zB(e,t){ds(ys);let n=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;pR(l)||n.push(hn("assignment/unknownSlot",{de:`'${l}' ist keine Liste \u2014 'responsible' oder 'team:<teamKey>'`,en:`'${l}' is no slot \u2014 'responsible' or 'team:<teamKey>'`},{slot:l})),r.has(l)&&n.push(hn("assignment/duplicateSlot",{de:`${Rn(l)} steht zweimal da`,en:`${Tt(l)} is listed twice`},{slot:l})),r.add(l),l===vt&&a!==0&&n.push(hn("assignment/responsibleFirst",{de:`'${vt}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${vt}' must be the first slot \u2014 team rows copy it`},{slot:l})),n.push(...WB(o))});for(let o of t)r.has(o)||n.push(hn("assignment/slotMissing",{de:`${Rn(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${Tt(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(t);for(let{slot:o}of e)o!==vt&&!i.has(o)&&pR(o)&&n.push(hn("assignment/unusedSlot",{de:`${Rn(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${Tt(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return n}s(zB,"validateRules");function WB({slot:e,rules:t}){let n=[];return(t.length===0||t[t.length-1].when!==null)&&n.push(hn("assignment/defaultRowMissing",{de:`${Rn(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${Tt(e)} must end with a row without condition ("otherwise")`},{slot:e})),t.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<t.length-1&&n.push(hn("assignment/ruleAfterDefault",{de:`${Rn(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${Tt(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=Lu(a,ys,[Ai]);for(let c of d)n.push({...c,message:{de:`${c.message.de} (${Rn(e,i)})`,en:`${c.message.en} (${Tt(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){X$(a)||n.push(hn("assignment/shadowedRule",{de:`${Rn(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${Tt(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=t.slice(0,i).findIndex(u=>u.when!==null&&Q$(u.when,a));c!==-1&&n.push(hn("assignment/shadowedRule",{de:`${Rn(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${Tt(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===vt&&l.kind==="slot"&&n.push(hn("assignment/slotForwardRef",{de:`${Rn(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${vt}'`,en:`${Tt(e,i)} copies '${l.slot}' \u2014 only a team slot after '${vt}' may`},o)),e===vt&&l.kind==="queue"&&n.push(hn("assignment/queueOnProcessSlot",{de:`${Rn(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${Tt(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&n.push(hn("assignment/targetMissing",{de:`${Rn(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${Tt(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=uR(l.configKeys);d!==null&&n.push(hn("assignment/rotationPool",{de:`${Rn(e,i)}: die Reihum-Liste ${d.de}`,en:`${Tt(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!J$(a,Ai))&&n.push(hn("assignment/unguardedTarget",{de:`${Rn(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${Ai}' ist (oder enth\xE4lt)`,en:`${Tt(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${Ai}'`},o))}),n}s(WB,"rowIssues");function gR(e,t){for(let r of t)e.some(i=>i.slot===r)||_(`[assignment/slotMissing] ${Tt(r)} has no rule list`);let n=new Set(t);return e.filter(r=>n.has(r.slot))}s(gR,"selectSlots");function HB(e,t){return Z$(gR(e,t).flatMap(n=>n.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(HB,"contextKeysOfRules");function yR(e,t,n,r){ds(ys);let i=gR(e,n),o=HB(e,n),a=Cu(ys.types,t,o);W$(ys,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((m,g)=>{if(m.when===null)return!0;for(let w of bt(rr(m.when)))Object.hasOwn(a,w)||_(`[condition/unknownIdentifier] ${Tt(d,g)} reads '${w}', which the context does not carry`);return F$(m.when,{values:a})});u===-1&&_(`[assignment/defaultRowMissing] ${Tt(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:YB(d,u,p,l,r)})}return l}s(yR,"evaluateRules");function YB(e,t,n,r,i){switch(n.kind){case"person":return{kind:"value",value:i.person(n.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(n,{slot:e,row:t})};case"unassigned":return _(`[assignment/targetMissing] ${Tt(e,t)} names no one`);case"queue":return e===vt&&_(`[assignment/queueOnProcessSlot] ${Tt(e,t)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===vt?void 0:r.find(a=>a.slot===n.slot);return o===void 0&&_(`[assignment/slotForwardRef] ${Tt(e,t)} copies '${n.slot}', which is not decided before it`),o.value}}}s(YB,"resolveTarget");var Og={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function wR(e){let t=[],n=s((r,i)=>t.push(`[assignment/shape] ${r}: ${i}`),"bad");return Array.isArray(e)?(e.forEach((r,i)=>{let o=`slots[${i}]`;if(typeof r!="object"||r===null)return n(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&n(o,`unknown field(s) ${Object.keys(d).join(", ")}`),typeof a!="string"&&n(o,"slot must be a string"),!Array.isArray(l))return n(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return n(p,"must be { when, assign }");let{when:m,assign:g,...w}=c;Object.keys(w).length>0&&n(p,`unknown field(s) ${Object.keys(w).join(", ")}`),m!==null&&typeof m!="string"&&n(p,"when must be a condition string or null (\u201Esonst\u201C)");let y=g?.kind;if(typeof g!="object"||g===null||typeof y!="string"||!Object.hasOwn(Og,y))return n(p,`assign must be one of ${Object.keys(Og).map(O=>`{kind:'${O}'}`).join(", ")}`);let v=Og[y],T=Object.keys(g);(T.some(O=>!v.includes(O))||v.some(O=>!T.includes(O)))&&n(p,`a '${y}' target has exactly the field(s) ${v.join(", ")}`);let $=g;if(y==="person"&&(typeof $.configKey!="string"||$.configKey.length===0)&&n(p,"a 'person' target needs a non-empty configKey"),y==="rotation"){let O=$.configKeys;(!Array.isArray(O)||O.some(N=>typeof N!="string"))&&n(p,"a 'rotation' target needs configKeys, a list of person keys"),Ig.includes($.mode)||n(p,`a 'rotation' target's mode is one of ${Ig.map(N=>`'${N}'`).join(", ")}`)}y==="slot"&&$.slot!==vt&&n(p,`a 'slot' target copies '${vt}' and nothing else`)})}),t):(n("slots","must be a list of { slot, rules }"),t)}s(wR,"ruleShapeIssues");function bR(e){let t=e??{},n=[];if(t.teamOwnerBindings!==void 0&&n.push({de:"[assignment/legacyBindings] der Workflow tr\xE4gt noch teamOwnerBindings \u2014 die Zust\xE4ndigkeitsregel ersetzt sie; das Feld entfernen",en:"[assignment/legacyBindings] the workflow still carries teamOwnerBindings \u2014 the assignment rule replaces them; remove the field"}),t.assignmentRules===void 0)return n.push({de:"[assignment/noRules] der Workflow hat keine Zust\xE4ndigkeitsregel (graph.assignmentRules) \u2014 jeder Workflow muss sagen, wer zust\xE4ndig wird",en:"[assignment/noRules] the workflow has no assignment rule (graph.assignmentRules) \u2014 every workflow must say who becomes responsible"}),n;let r=wR(t.assignmentRules);if(r.length>0)return[...n,...r.map(o=>({de:o,en:o}))];let i=ju({nodes:Array.isArray(t.nodes)?t.nodes:[]});for(let o of zB(t.assignmentRules,i))o.severity==="error"&&n.push(o.message);return n}s(bR,"workflowAssignmentIssues");function kR(e,t,n={}){let r=new Map;return{slots:yR(e,t,n.slots??e.map(o=>o.slot),{person:s(o=>`person:${o}`,"person"),creator:s(()=>(n.creator===void 0&&fe("INVALID",{de:"[assignment/noCreator] Die zutreffende Zeile weist die anlegende Person zu, aber es wurde kein --creator angegeben (ein Selbststart hat keine).",en:"[assignment/noCreator] The matching row assigns the creating person, but no --creator was given (a self-start has none)."}),`creator:${n.creator}`),"creator"),rotation:s((o,{slot:a})=>{let l=n.rotationPrevious?.[a]??null,d=fR({pool:o.configKeys,mode:o.mode,previous:l,eligible:new Set(o.configKeys.filter(c=>!(n.left??[]).includes(c))),openCounts:new Map(o.configKeys.map(c=>[c,n.openCounts?.[c]??0]))});return d===null&&fe("INVALID",{de:`[assignment/rotationEmpty] Platz \u201E${a}\u201C: alle aus dem Pool sind ausgeschieden`,en:`[assignment/rotationEmpty] slot '${a}': everyone in the pool has left`}),r.set(a,{pool:[...o.configKeys],mode:o.mode,previous:l,picked:d}),`person:${d}`},"rotation")}).map(o=>{let a=r.get(o.slot);return{slot:o.slot,row:o.ruleIndex+1,assign:o.assign,value:o.value.kind==="queue"?"queue":o.value.value,...a!==void 0?{rotation:a}:{}}})}}s(kR,"simulateRules");function vR(e,t){let n={};for(let r of t??[]){let i=r.lastIndexOf("=");if(i<=0||i===r.length-1)throw new Error(`assignment simulate: ${e} takes <key>=<value>, got '${r}'`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new Error(`assignment simulate: ${e} names '${o}' twice`);n[o]=r.slice(i+1)}return n}s(vR,"parsePairs");function JB(e){let t={};for(let[n,r]of Object.entries(vR("--open",e))){let i=Number(r);if(!Number.isInteger(i)||i<0)throw new Error(`assignment simulate: --open ${n}=${r} is no count`);t[n]=i}return t}s(JB,"parseCounts");function QB(e,t){if(e===void 0==(t===void 0))throw new Error("assignment simulate: pass exactly one of --env-json '<json>' or --env-file <path>");let n=e??ke(t,"utf8"),r=JSON.parse(n);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("assignment simulate: the environment must be a JSON object");return r}s(QB,"parseEnv");var Pg=class extends Se{static{s(this,"AssignmentSimulateCommand")}static paths=[["assignment","simulate"]];static usage=A.Usage({category:"Admission",description:"Evaluate an offer bundle's assignment rule over an application's environment ($env), offline",details:`
|
|
9635
9635
|
The environment carries every key the rule reads ($env): offer
|
|
@@ -10045,6 +10045,6 @@ ${n.length} unusable ${o}:
|
|
|
10045
10045
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli users relink-auth <email>
|
|
10046
10046
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli users provision --tenant <slug> --email <email> --name <name>
|
|
10047
10047
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
10048
|
-
`);return n.length>0?1:0}},mA=class extends An{static{s(this,"UsersRelinkAuthCommand")}static paths=[["users","relink-auth"]];static usage=A.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function OM(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(OM,"requireOnOff");var PM=[YS,JS,QS,ZS,XS,eA,tA,nA,rA,iA,oA,sA,xc,aA,lA,dA,cA,uA,fA,pA,mA];function _M(e){return e.de??e.en??Object.values(e)[0]??""}s(_M,"titleDe");function H4(e){return{id:e._id,kind:e.kind,status:e.status,title:_M(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(H4,"row");var Y4=["id","kind","status","title","assignee","group","outcome"],gA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=A.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...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(H4),Y4),0}},yA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=A.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:_M(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}},wA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=A.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,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}},bA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=A.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,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}},kA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=A.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,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}},NM=[gA,yA,wA,bA,kA];var Om=[...XT,...KR,...lO,...aO,...CO,...WO,...zO,...RM,...PM,...$M,...N0,...ER,...OO,...yM,...QT,...A$,...xR,...JO,...YO,...XO,...eP,...RO,...mO,...NM,...NF,...wL,...P0,...bL,...oM,...pM,...C0,...U0,...z0,...gM,...vM,...g$];var CM="0.1.24";function DM(){return Om.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=WT[Da(n)];return{path:n,effect:no(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(DM,"plexusCommandCatalog");import Mo from"node:path";function J4(e){let t=st()?.workspaceRoot??process.cwd(),n=Mo.resolve(t,e),r=Mo.relative(t,n);if(Mo.isAbsolute(e)||r===".."||r.startsWith(`..${Mo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(J4,"workspacePath");function Q4(e){let{absolute:t,relative:n}=J4(e.path??".");if(e.operation==="list"){if(!Oe(t))return{files:[]};let r=[],i=s(o=>{for(let a of Gi(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Mo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Mo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ke(t);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:n,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:n,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 gt(t,a,"utf8"),{path:n,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 Wt(Mo.dirname(t),{recursive:!0}),gt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Bo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(Q4,"plexusWorkspace");function FM(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=La[n];if(!o||!Object.hasOwn(La,n))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(n==="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(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(zh,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:zh[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 Q4(i)},"executePlexusAgentTool")}s(FM,"createPlexusAgentToolExecutor");var Pm=FM({inspectCommand:MM,executeCommand:qM});function _m(){let e=new zo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:CM});e.register(ba.HelpCommand),e.register(ba.VersionCommand);for(let n of Om)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return e6(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(_m,"createPlexusCli");function e6(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ca[n]===r&&dt(t,n,r),n in Ca&&no(n)==="confirm"&&!Fa(e)&&t.write(`plexus-cli: \`${Ca[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
10048
|
+
`);return n.length>0?1:0}},mA=class extends An{static{s(this,"UsersRelinkAuthCommand")}static paths=[["users","relink-auth"]];static usage=A.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function OM(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(OM,"requireOnOff");var PM=[YS,JS,QS,ZS,XS,eA,tA,nA,rA,iA,oA,sA,xc,aA,lA,dA,cA,uA,fA,pA,mA];function _M(e){return e.de??e.en??Object.values(e)[0]??""}s(_M,"titleDe");function H4(e){return{id:e._id,kind:e.kind,status:e.status,title:_M(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(H4,"row");var Y4=["id","kind","status","title","assignee","group","outcome"],gA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=A.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...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(H4),Y4),0}},yA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=A.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:_M(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}},wA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=A.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,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}},bA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=A.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,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}},kA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=A.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,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}},NM=[gA,yA,wA,bA,kA];var Om=[...XT,...KR,...lO,...aO,...CO,...WO,...zO,...RM,...PM,...$M,...N0,...ER,...OO,...yM,...QT,...A$,...xR,...JO,...YO,...XO,...eP,...RO,...mO,...NM,...NF,...wL,...P0,...bL,...oM,...pM,...C0,...U0,...z0,...gM,...vM,...g$];var CM="0.1.25";function DM(){return Om.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=WT[Da(n)];return{path:n,effect:no(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(DM,"plexusCommandCatalog");import Mo from"node:path";function J4(e){let t=st()?.workspaceRoot??process.cwd(),n=Mo.resolve(t,e),r=Mo.relative(t,n);if(Mo.isAbsolute(e)||r===".."||r.startsWith(`..${Mo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(J4,"workspacePath");function Q4(e){let{absolute:t,relative:n}=J4(e.path??".");if(e.operation==="list"){if(!Oe(t))return{files:[]};let r=[],i=s(o=>{for(let a of Gi(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Mo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Mo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ke(t);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:n,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:n,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 gt(t,a,"utf8"),{path:n,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 Wt(Mo.dirname(t),{recursive:!0}),gt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Bo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(Q4,"plexusWorkspace");function FM(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=La[n];if(!o||!Object.hasOwn(La,n))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(n==="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(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(zh,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:zh[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 Q4(i)},"executePlexusAgentTool")}s(FM,"createPlexusAgentToolExecutor");var Pm=FM({inspectCommand:MM,executeCommand:qM});function _m(){let e=new zo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:CM});e.register(ba.HelpCommand),e.register(ba.VersionCommand);for(let n of Om)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return e6(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(_m,"createPlexusCli");function e6(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ca[n]===r&&dt(t,n,r),n in Ca&&no(n)==="confirm"&&!Fa(e)&&t.write(`plexus-cli: \`${Ca[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
10049
10049
|
`)}s(e6,"noteRetiredPath");function MM(e){let t=_m().process(ca(e),{executePlexusAgentTool:Pm}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=DM().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?Ef(As(Es),i.fn??"",i.kind):void 0,a=gu(n,{confirm:Fa(t),callKind:o});return{...r,writes:a}}s(MM,"inspectPlexusCommand");async function qM(e,t){if(t)return SA(t,()=>qM(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 n="",r="",i=_m();if(st()){let l=MM(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(ca(e.argv),{executePlexusAgentTool:Pm,stdin:X4.from(e.stdin===void 0?[]:[e.stdin]),stdout:new LM({write(l,d,c){n+=String(l),c()}}),stderr:new LM({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(qM,"executePlexusCommand");RA({source:t6.join(import.meta.dirname,"skill")});_m().runExit(ca(process.argv.slice(2)),{executePlexusAgentTool:Pm});
|
|
10050
10050
|
//# sourceMappingURL=cli.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e73445840aa748e946a37138891d8ff4c5ca341cd6f7bd81f65aa50570e43f32
|
|
@@ -57,7 +57,7 @@ plexus-cli offer workflow node set --dir <bundle> --node engagePush --payment '$
|
|
|
57
57
|
# goes out („„Vertrag" jetzt senden?" on „Bereitstellen"). `--approval none` drops
|
|
58
58
|
# assign.releaseApproval + titles.approve; `--approval release` restores a
|
|
59
59
|
# Freigabe (title via --approve-title, default "<Dokument> freigeben") and drops
|
|
60
|
-
# the confirmation. Same edits as the IDE's
|
|
60
|
+
# the confirmation. Same edits as the IDE's Knoten → Einstellungen.
|
|
61
61
|
plexus-cli offer workflow node set --dir <bundle> --node contract --approval none --confirm-issue true
|
|
62
62
|
|
|
63
63
|
# Document node that the family returns signed (signedUpload / signedUploadChecked):
|