@tocca-systems/twp-cli 0.137.0 → 0.139.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.public.md +10 -0
  2. package/README.md +8 -7
  3. package/dist/THIRD-PARTY-NOTICES.md +1 -1
  4. package/dist/{api-command-ZRZWEURH.js → api-command-KNDQLV36.js} +1 -1
  5. package/dist/{app-RD6R2BFB.js → app-Q2Q3YTZI.js} +1 -1
  6. package/dist/{brief-ISRPL272.js → brief-CG74AOQD.js} +1 -1
  7. package/dist/{capacity-list-command-W6SYFB77.js → capacity-list-command-FMHDYKA6.js} +1 -1
  8. package/dist/{chunk-XZVP3FUE.js → chunk-4OB22XRI.js} +1 -1
  9. package/dist/{chunk-DILKXZRD.js → chunk-DWZC3652.js} +1 -1
  10. package/dist/{chunk-UHNQHCPW.js → chunk-EAIDN2BE.js} +1 -1
  11. package/dist/{chunk-MNPGGAKL.js → chunk-EHHY34NR.js} +20 -18
  12. package/dist/{chunk-CAJZZF7M.js → chunk-HNW2JWHQ.js} +9 -9
  13. package/dist/{chunk-KOL4P7LC.js → chunk-L6FXTX6Q.js} +1 -1
  14. package/dist/{chunk-7CVIIHMY.js → chunk-LGRZABOT.js} +1 -1
  15. package/dist/chunk-LJWU23D2.js +66 -0
  16. package/dist/{chunk-LXFLA3PZ.js → chunk-PAJAEUPA.js} +1 -1
  17. package/dist/{chunk-R76JZIZ5.js → chunk-ROAZEXMJ.js} +1 -1
  18. package/dist/cli.js +14 -12
  19. package/dist/{commands-VAY4M4MI.js → commands-JHGKEP65.js} +5 -5
  20. package/dist/{commands-OKU5OXD5.js → commands-QEUDLNBW.js} +1 -1
  21. package/dist/{commands-JWBG4N2N.js → commands-UDICRSBR.js} +1 -1
  22. package/dist/{corporate-VRU5NXIJ.js → corporate-24WCD6ID.js} +42 -27
  23. package/dist/dist-6JBU3TAO.js +118 -0
  24. package/dist/{github-git-NX4IRTDU.js → github-git-KJY6M3L4.js} +1 -1
  25. package/dist/{holiday-D2ZM5PCX.js → holiday-RF4VPQX3.js} +1 -1
  26. package/dist/{license-NEEKNJBY.js → license-WD2VND3X.js} +1 -1
  27. package/dist/{login-history-NVMX2UAZ.js → login-history-3ZLCYSBI.js} +1 -1
  28. package/dist/{media-XD7PWQNT.js → media-2LVPBLNL.js} +1 -1
  29. package/dist/{outlook-OE7CUTAJ.js → outlook-IKZR2BEU.js} +1 -1
  30. package/dist/{query-E22FS2XX.js → query-NHJP3NF2.js} +1 -1
  31. package/dist/{registry-7H5U7QUD.js → registry-IHABQAQY.js} +1 -1
  32. package/dist/{run-AHV37JBZ.js → run-AZ6XEIXF.js} +1 -1
  33. package/dist/{runner-command-BQJ3WONI.js → runner-command-LUVEXFEQ.js} +1 -1
  34. package/dist/{skill-PQBRALUW.js → skill-MOMCYET5.js} +1 -1
  35. package/dist/{skill-manage-command-5EPL2VZA.js → skill-manage-command-2QW3BA5K.js} +2 -2
  36. package/dist/{status-command-5HBUAGWX.js → status-command-XC7KWLLW.js} +2 -2
  37. package/dist/{teams-WMKWQCLH.js → teams-5FS7HVDE.js} +1 -1
  38. package/dist/{trigger-command-JXPPZBKT.js → trigger-command-2TOL2G7C.js} +1 -1
  39. package/dist/{user-77JTTQWR.js → user-DVI5ELJJ.js} +60 -48
  40. package/package.json +1 -1
  41. package/dist/chunk-43RLWH2F.js +0 -64
  42. package/dist/dist-B4FAEXU4.js +0 -120
@@ -0,0 +1,118 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import"./chunk-VSJBJXZO.js";var CHILD_PROPS=["left","right","condition","child","operand","trueExpr","falseExpr","expression"];function pushChildren(node,stack){const n=node;for(const prop of CHILD_PROPS){const val=n[prop];if(val&&typeof val==="object"&&"type"in val){stack.push(val)}}if(Array.isArray(n.children)){for(const item of n.children){if(!item){continue}stack.push(item);if(item.type==="KeyValuePair"&&item.value){stack.push(item.value)}}}if(Array.isArray(n.bindings)){for(const item of n.bindings){if(!item){continue}
4
+ stack.push(item);if(item.reference){stack.push(item.reference)}}}}function forEachNode(root,visitor){const stack=[root];while(stack.length>0){const current=stack.pop();if(!current){break}if(visitor(current)===false){return}pushChildren(current,stack)}}function countNodes(root){let count=0;forEachNode(root,()=>{count+=1;return true});return count}function findDisallowedFunction(root,options){const{allowedFunctions,disallowedFunctions}=options;if(!allowedFunctions&&!disallowedFunctions){return null}
5
+ let violation=null;forEachNode(root,node=>{if(node.type!=="Function"){return true}const name=node.name;if(allowedFunctions&&!allowedFunctions.includes(name)){violation=`Function '${name}' is not allowed`;return false}if(disallowedFunctions&&disallowedFunctions.includes(name)){violation=`Function '${name}' is disallowed`;return false}return true});return violation}var isObject=obj=>{return obj!==null&&Object.prototype.toString.call(obj)==="[object Object]"};var strictDeepEqual=(first,second)=>{if(first===
6
+ second){return true}if(typeof first!==typeof second){return false}if(Array.isArray(first)&&Array.isArray(second)){if(first.length!==second.length){return false}for(let i=0;i<first.length;i+=1){if(!strictDeepEqual(first[i],second[i])){return false}}return true}if(isObject(first)&&isObject(second)){const keys=Object.keys(first);if(keys.length!==Object.keys(second).length){return false}return keys.every(key=>Object.prototype.hasOwnProperty.call(second,key)&&strictDeepEqual(first[key],second[key]))}
7
+ return false};var isFalse=obj=>{if(obj==null||obj===false){return true}if(typeof obj==="string"){return obj===""}if(typeof obj==="object"){return Array.isArray(obj)?obj.length===0:Object.keys(obj).length===0}return false};var isAlpha=ch=>{return ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"||ch==="_"};var isNum=ch=>{return ch>="0"&&ch<="9"||ch==="-"};var isAlphaNum=ch=>{return isAlpha(ch)||ch>="0"&&ch<="9"};var ensureInteger=value=>{if(!(typeof value==="number")||Math.floor(value)!==value){throw new Error(
8
+ "invalid-value: expecting an integer.")}return value};var ensurePositiveInteger=value=>{if(!(typeof value==="number")||value<0||Math.floor(value)!==value){throw new Error("invalid-value: expecting a non-negative integer.")}return value};var ensureNumbers=(...operands)=>{for(let i=0;i<operands.length;i++){if(operands[i]===null||operands[i]===void 0){throw new Error("not-a-number: undefined")}if(typeof operands[i]!=="number"){throw new Error("not-a-number")}}};var notZero=n=>{n=+n;if(!n){throw new Error(
9
+ "not-a-number: divide by zero")}return n};var binOp=fn=>(left,right)=>{ensureNumbers(left,right);return fn(left,right)};var add=binOp((a,b)=>a+b);var sub=binOp((a,b)=>a-b);var mul=binOp((a,b)=>a*b);var divide=binOp((a,b)=>a/notZero(b));var div=binOp((a,b)=>Math.floor(a/notZero(b)));var mod=binOp((a,b)=>a%notZero(b));var basicTokens={"(":"Lparen",")":"Rparen","*":"Star",",":"Comma",".":"Dot",":":"Colon","@":"Current","]":"Rbracket","{":"Lbrace","}":"Rbrace","+":"Plus","%":"Modulo","?":"Question",
10
+ "\u2212":"Minus","\xD7":"Multiply","\xF7":"Divide"};var operatorStartToken={"!":true,"<":true,"=":true,">":true,"&":true,"|":true,"/":true};var skipChars={" ":true,"\n":true,"\r":true," ":true};var StreamLexer=class{_current=0;_enable_legacy_literals=false;tokenize(stream,options){const tokens=[];this._current=0;this._enable_legacy_literals=options?.enable_legacy_literals||false;let start;let identifier;let token;while(this._current<stream.length){if(isAlpha(stream[this._current])){start=this._current;
11
+ identifier=this.consumeUnquotedIdentifier(stream);tokens.push({start,type:"UnquotedIdentifier",value:identifier})}else if(basicTokens[stream[this._current]]!==void 0){tokens.push({start:this._current,type:basicTokens[stream[this._current]],value:stream[this._current]});this._current+=1}else if(stream[this._current]==="$"){start=this._current;if(this._current+1<stream.length&&isAlpha(stream[this._current+1])){this._current+=1;identifier=this.consumeUnquotedIdentifier(stream);tokens.push({start,type:"\
12
+ Variable",value:identifier})}else{tokens.push({start,type:"Root",value:stream[this._current]});this._current+=1}}else if(stream[this._current]==="-"){if(this._current+1<stream.length&&isNum(stream[this._current+1])){const token2=this.consumeNumber(stream);token2&&tokens.push(token2)}else{const token2={start:this._current,type:"Minus",value:"-"};tokens.push(token2);this._current+=1}}else if(isNum(stream[this._current])){token=this.consumeNumber(stream);tokens.push(token)}else if(stream[this._current]===
13
+ "["){token=this.consumeLBracket(stream);tokens.push(token)}else if(stream[this._current]==='"'){start=this._current;identifier=this.consumeQuotedIdentifier(stream);tokens.push({start,type:"QuotedIdentifier",value:identifier})}else if(stream[this._current]===`'`){start=this._current;identifier=this.consumeRawStringLiteral(stream);tokens.push({start,type:"Literal",value:identifier})}else if(stream[this._current]==="`"){start=this._current;const literal=this.consumeLiteral(stream);tokens.push({start,
14
+ type:"Literal",value:literal})}else if(operatorStartToken[stream[this._current]]!==void 0){token=this.consumeOperator(stream);token&&tokens.push(token)}else if(skipChars[stream[this._current]]!==void 0){this._current+=1}else{const error=new Error(`Syntax error: unknown character: ${stream[this._current]}`);error.name="LexerError";throw error}}return tokens}consumeUnquotedIdentifier(stream){const start=this._current;this._current+=1;while(this._current<stream.length&&isAlphaNum(stream[this._current])){
15
+ this._current+=1}return stream.slice(start,this._current)}consumeUntil(stream,delimiter){const start=this._current;this._current+=1;const len=stream.length;while(this._current<len&&stream[this._current]!==delimiter){if(stream[this._current]==="\\"&&(stream[this._current+1]==="\\"||stream[this._current+1]===delimiter)){this._current+=2}else{this._current+=1}}if(this._current<len){this._current+=1}return stream.slice(start,this._current)}consumeQuotedIdentifier(stream){const raw=this.consumeUntil(
16
+ stream,'"');const[value,ok]=this.parseJSON(raw);if(!ok){const error=new Error("syntax: unexpected end of JSON input");error.name="LexerError";throw error}return value}consumeRawStringLiteral(stream){const raw=this.consumeUntil(stream,"'");if(!raw.endsWith("'")||raw.length<2){const error=new Error("Syntax error: unclosed single quote");error.name="LexerError";throw error}const content=raw.slice(1,-1);return content.replace(/\\(['\\])/g,"$1")}consumeNumber(stream){const start=this._current;this._current+=
17
+ 1;const maxLength=stream.length;while(isNum(stream[this._current])&&this._current<maxLength){this._current+=1}const value=parseInt(stream.slice(start,this._current),10);return{start,value,type:"Number"}}consumeLBracket(stream){const start=this._current;this._current+=1;if(stream[this._current]==="?"){this._current+=1;return{start,type:"Filter",value:"[?"}}if(stream[this._current]==="]"){this._current+=1;return{start,type:"Flatten",value:"[]"}}return{start,type:"Lbracket",value:"["}}consumeOrElse(stream,peek,token,orElse){
18
+ const start=this._current;this._current+=1;if(this._current<stream.length&&stream[this._current]===peek){this._current+=1;return{start,type:orElse,value:stream.slice(start,this._current)}}return{start,type:token,value:stream[start]}}consumeOperator(stream){const start=this._current;const startingChar=stream[start];switch(startingChar){case"!":return this.consumeOrElse(stream,"=","Not","NE");case"<":return this.consumeOrElse(stream,"=","LT","LTE");case">":return this.consumeOrElse(stream,"=","GT",
19
+ "GTE");case"=":return this.consumeOrElse(stream,"=","Assign","EQ");case"&":return this.consumeOrElse(stream,"&","Expref","And");case"|":return this.consumeOrElse(stream,"|","Pipe","Or");case"/":return this.consumeOrElse(stream,"/","Divide","Div")}}consumeLiteral(stream){const raw=this.consumeUntil(stream,"`");const inner=raw.endsWith("`")&&raw.length>1?raw.slice(1,-1):raw.slice(1);const literalString=inner.trimStart().replace("\\`","`");let[literal,ok]=this.parseJSON(literalString);if(!ok&&this.
20
+ _enable_legacy_literals){[literal,ok]=this.parseJSON(`"${literalString}"`)}if(!ok){const error=new Error(`Syntax error: unexpected end of JSON input or invalid format for a JSON literal: ${stream[this._current-1]??""}`);error.name="LexerError";throw error}return literal}parseJSON(text){try{const json=JSON.parse(text);return[json,true]}catch{return[null,false]}}};var Lexer=new StreamLexer;var Lexer_default=Lexer;var bindingPower={["EOF"]:0,["Variable"]:0,["UnquotedIdentifier"]:0,["QuotedIdentifie\
21
+ r"]:0,["Rbracket"]:0,["Rparen"]:0,["Comma"]:0,["Rbrace"]:0,["Number"]:0,["Current"]:0,["Expref"]:0,["Root"]:0,["Assign"]:1,["Pipe"]:1,["Question"]:2,["Or"]:3,["And"]:4,["EQ"]:5,["GT"]:5,["LT"]:5,["GTE"]:5,["LTE"]:5,["NE"]:5,["Minus"]:6,["Plus"]:6,["Div"]:7,["Divide"]:7,["Modulo"]:7,["Multiply"]:7,["Flatten"]:9,["Star"]:20,["Filter"]:21,["Dot"]:40,["Not"]:45,["Lbrace"]:50,["Lbracket"]:55,["Lparen"]:60};var DEFAULT_MAX_DEPTH=1e3;var TokenParser=class _TokenParser{index=0;tokens=[];depth=0;maxDepth=DEFAULT_MAX_DEPTH;nodeCount=0;maxNodes;parse(expression,options){
22
+ this.loadTokens(expression,options||{enable_legacy_literals:false});this.index=0;this.depth=0;this.nodeCount=0;this.maxDepth=options?.maxDepth??DEFAULT_MAX_DEPTH;this.maxNodes=options?.maxNodes;const ast=this.expression(0);if(this.lookahead(0)!=="EOF"){const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error: unexpected token type: ${token.type}, value: ${token.value}`)}if(this.maxNodes!==void 0&&countNodes(ast)>this.maxNodes){throw new Error(`Expression exceeds maximum allowed nod\
23
+ e count of ${this.maxNodes}`)}return ast}loadTokens(expression,options){this.tokens=Lexer_default.tokenize(expression,options);this.tokens.push({type:"EOF",value:"",start:expression.length})}expression(rbp){if(this.depth>=this.maxDepth){throw new Error(`Expression exceeds maximum allowed depth of ${this.maxDepth}`)}this.depth+=1;this.trackNode();try{const leftToken=this.lookaheadToken(0);this.advance();let left=this.nud(leftToken);let currentTokenType=this.lookahead(0);while(rbp<bindingPower[currentTokenType]){
24
+ this.trackNode();this.advance();left=this.led(currentTokenType,left);currentTokenType=this.lookahead(0)}return left}finally{this.depth-=1}}trackNode(){this.nodeCount+=1;if(this.maxNodes!==void 0&&this.nodeCount>this.maxNodes){throw new Error(`Expression exceeds maximum allowed node count of ${this.maxNodes}`)}}lookahead(offset){return this.tokens[this.index+offset].type}lookaheadToken(offset){return this.tokens[this.index+offset]}advance(){this.index+=1}nud(token){switch(token.type){case"Variabl\
25
+ e":return{type:"Variable",name:token.value};case"Literal":return{type:"Literal",value:token.value};case"UnquotedIdentifier":{if(_TokenParser.isKeyword(token,"let")&&this.lookahead(0)==="Variable"){return this.parseLetExpression()}else{return{type:"Field",name:token.value}}}case"QuotedIdentifier":if(this.lookahead(0)==="Lparen"){throw new Error("Syntax error: quoted identifier not allowed for function names.")}else{return{type:"Field",name:token.value}}case"Not":{const child=this.expression(bindingPower.
26
+ Not);return{type:"NotExpression",child}}case"Minus":{const child=this.expression(bindingPower.Minus);return{type:"Unary",operator:token.type,operand:child}}case"Plus":{const child=this.expression(bindingPower.Plus);return{type:"Unary",operator:token.type,operand:child}}case"Star":{const left={type:"Identity"};return{type:"ValueProjection",left,right:this.parseProjectionRHS(bindingPower.Star)}}case"Filter":return this.led(token.type,{type:"Identity"});case"Lbrace":return this.parseMultiselectHash();case"\
27
+ Flatten":{const left={type:"Flatten",child:{type:"Identity"}};const right=this.parseProjectionRHS(bindingPower.Flatten);return{type:"Projection",left,right}}case"Lbracket":{if(this.lookahead(0)==="Number"||this.lookahead(0)==="Colon"){const right=this.parseIndexExpression();return this.projectIfSlice({type:"Identity"},right)}if(this.lookahead(0)==="Star"&&this.lookahead(1)==="Rbracket"){this.advance();this.advance();const right=this.parseProjectionRHS(bindingPower.Star);return{left:{type:"Identi\
28
+ ty"},right,type:"Projection"}}return this.parseMultiselectList()}case"Current":return{type:"Current"};case"Root":return{type:"Root"};case"Expref":{const child=this.expression(bindingPower.Expref);return{type:"ExpressionReference",child}}case"Lparen":{const expression=this.expression(0);this.match("Rparen");return expression}default:this.errorToken(token)}}led(tokenName,left){switch(tokenName){case"Question":{const trueExpr=this.expression(0);this.match("Colon");const falseExpr=this.expression(0);
29
+ return{type:"Ternary",condition:left,trueExpr,falseExpr}}case"Dot":{const rbp=bindingPower.Dot;if(this.lookahead(0)!=="Star"){const right2=this.parseDotRHS(rbp);return{type:"Subexpression",left,right:right2}}this.advance();const right=this.parseProjectionRHS(rbp);return{type:"ValueProjection",left,right}}case"Pipe":{const right=this.expression(bindingPower.Pipe);return{type:"Pipe",left,right}}case"Or":{const right=this.expression(bindingPower.Or);return{type:"OrExpression",left,right}}case"And":{
30
+ const right=this.expression(bindingPower.And);return{type:"AndExpression",left,right}}case"Lparen":{if(left.type!=="Field"){throw new Error("Syntax error: expected a Field node")}const name=left.name;const args=this.parseCommaSeparatedExpressionsUntilToken("Rparen");const node={name,type:"Function",children:args};return node}case"Filter":{const condition=this.expression(0);this.match("Rbracket");const right=this.lookahead(0)==="Flatten"?{type:"Identity"}:this.parseProjectionRHS(bindingPower.Filter);
31
+ return{type:"FilterProjection",left,right,condition}}case"Flatten":{const leftNode={type:"Flatten",child:left};const right=this.parseProjectionRHS(bindingPower.Flatten);return{type:"Projection",left:leftNode,right}}case"Assign":{const leftNode=left;const right=this.expression(0);return{type:"Binding",variable:leftNode.name,reference:right}}case"EQ":case"NE":case"GT":case"GTE":case"LT":case"LTE":return this.parseComparator(left,tokenName);case"Plus":case"Minus":case"Multiply":case"Star":case"Divi\
32
+ de":case"Modulo":case"Div":return this.parseArithmetic(left,tokenName);case"Lbracket":{const token=this.lookaheadToken(0);if(token.type==="Number"||token.type==="Colon"){const right2=this.parseIndexExpression();return this.projectIfSlice(left,right2)}this.match("Star");this.match("Rbracket");const right=this.parseProjectionRHS(bindingPower.Star);return{type:"Projection",left,right}}default:return this.errorToken(this.lookaheadToken(0))}}static isKeyword(token,keyword){return token.type==="Unquot\
33
+ edIdentifier"&&token.value===keyword}match(tokenType){if(this.lookahead(0)===tokenType){this.advance();return}else{const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error: expected ${tokenType}, got: ${token.type}`)}}errorToken(token,message=""){const error=new Error(message||`Syntax error: invalid token (${token.type}): "${token.value}"`);error.name="ParserError";throw error}parseIndexExpression(){if(this.lookahead(0)==="Colon"||this.lookahead(1)==="Colon"){return this.parseSliceExpression()}
34
+ const value=Number(this.lookaheadToken(0).value);this.advance();this.match("Rbracket");return{type:"Index",value}}projectIfSlice(left,right){const indexExpr={type:"IndexExpression",left,right};if(right.type==="Slice"){const rhs=this.parseProjectionRHS(bindingPower.Star);if(rhs.type==="Identity"){return indexExpr}return{left:indexExpr,right:rhs,type:"Projection"}}return indexExpr}parseSliceExpression(){const parts=[null,null,null];let index=0;let current=this.lookaheadToken(0);while(current.type!=
35
+ "Rbracket"&&index<3){if(current.type==="Colon"){index++;if(index===3){this.errorToken(this.lookaheadToken(0),"Syntax error, too many colons in slice expression")}this.advance()}else if(current.type==="Number"&&parts[index]===null){const part=this.lookaheadToken(0).value;parts[index]=part;this.advance()}else{const next=this.lookaheadToken(0);this.errorToken(next,`Syntax error, unexpected token: ${next.value}(${next.type})`)}current=this.lookaheadToken(0)}this.match("Rbracket");const[start,stop,step]=parts;
36
+ return{type:"Slice",start,stop,step}}parseLetExpression(){const separated=this.parseCommaSeparatedExpressionsUntilKeyword("in");const expression=this.expression(0);const bindings=separated.map(binding=>binding);return{type:"LetExpression",bindings,expression}}parseCommaSeparatedExpressionsUntilKeyword(keyword){return this.parseCommaSeparatedExpressionsUntil(()=>{return _TokenParser.isKeyword(this.lookaheadToken(0),keyword)},()=>{this.advance()})}parseCommaSeparatedExpressionsUntilToken(token){return this.
37
+ parseCommaSeparatedExpressionsUntil(()=>{return this.lookahead(0)===token},()=>{return this.match(token)})}parseCommaSeparatedExpressionsUntil(isEndToken,matchEndToken){const args=[];let expression;while(!isEndToken()){expression=this.expression(0);if(this.lookahead(0)==="Comma"){this.match("Comma")}args.push(expression)}matchEndToken();return args}parseComparator(left,comparator){const right=this.expression(bindingPower[comparator]);return{type:"Comparator",name:comparator,left,right}}parseArithmetic(left,operator){
38
+ const right=this.expression(bindingPower[operator]);return{type:"Arithmetic",operator,left,right}}parseDotRHS(rbp){const lookahead=this.lookahead(0);const exprTokens=["UnquotedIdentifier","QuotedIdentifier","Star"];if(exprTokens.includes(lookahead)){return this.expression(rbp)}if(lookahead==="Lbracket"){this.match("Lbracket");return this.parseMultiselectList()}if(lookahead==="Lbrace"){this.match("Lbrace");return this.parseMultiselectHash()}const token=this.lookaheadToken(0);this.errorToken(token,
39
+ `Syntax error, unexpected token: ${token.value}(${token.type})`)}parseProjectionRHS(rbp){if(bindingPower[this.lookahead(0)]<10){return{type:"Identity"}}if(this.lookahead(0)==="Lbracket"){return this.expression(rbp)}if(this.lookahead(0)==="Filter"){return this.expression(rbp)}if(this.lookahead(0)==="Dot"){this.match("Dot");return this.parseDotRHS(rbp)}const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error, unexpected token: ${token.value}(${token.type})`)}parseMultiselectList(){const expressions=[];
40
+ while(this.lookahead(0)!=="Rbracket"){const expression=this.expression(0);expressions.push(expression);if(this.lookahead(0)==="Comma"){this.match("Comma");if(this.lookahead(0)==="Rbracket"){throw new Error("Syntax error: unexpected token Rbracket")}}else if(this.lookahead(0)!=="Rbracket"){const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error: unexpected token: ${token.value}(${token.type})`)}}this.match("Rbracket");return{type:"MultiSelectList",children:expressions}}parseMultiselectHash(){
41
+ const pairs=[];const identifierTypes=["UnquotedIdentifier","QuotedIdentifier"];let keyToken;let keyName;let value;for(;;){keyToken=this.lookaheadToken(0);if(!identifierTypes.includes(keyToken.type)){throw new Error(`Syntax error: expecting an identifier token, got: ${keyToken.type}`)}keyName=keyToken.value;this.advance();this.match("Colon");value=this.expression(0);pairs.push({value,type:"KeyValuePair",name:keyName});if(this.lookahead(0)==="Comma"){this.match("Comma")}else if(this.lookahead(0)===
42
+ "Rbrace"){this.match("Rbrace");break}else{const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error: unexpected token: ${token.value}(${token.type})`)}}return{type:"MultiSelectHash",children:pairs}}};var Parser=new TokenParser;var Parser_default=Parser;var normalizeBounds=(len,start,end)=>{let s2=ensureInteger(start??0);if(s2<0){s2=Math.max(0,len+s2)}let e=ensureInteger(end??len);if(e<0){e=Math.max(0,len+e)}return[s2,Math.min(len,e)]};var findFirst=(subject,sub2,start,end)=>{if(!subject||
43
+ !sub2){return null}const chars=[...subject];const[s2,e]=normalizeBounds(chars.length,start,end);const target=chars.slice(s2,e).join("");const idx=target.indexOf(sub2);return idx===-1?null:[...target.slice(0,idx)].length+s2};var findLast=(subject,sub2,start,end)=>{if(!subject||!sub2){return null}const chars=[...subject];const[s2,e]=normalizeBounds(chars.length,start,end);const target=chars.slice(s2,e).join("");const idx=target.lastIndexOf(sub2);return idx===-1?null:[...target.slice(0,idx)].length+
44
+ s2};var createPad=(isLeft,name)=>(subject,width,padding=" ")=>{if([...padding].length!==1){throw new Error(`invalid value, ${name} expects its 'pad' parameter to be a valid string with a single codepoint`)}ensurePositiveInteger(width);if(!subject){return""}const padLen=width-[...subject].length;if(padLen<=0){return subject}const pad=padding.repeat(padLen);return isLeft?pad+subject:subject+pad};var padLeft=createPad(true,"pad_left");var padRight=createPad(false,"pad_right");var replace=(subject,string,by,count)=>{
45
+ if(count===0){return subject}const parts=subject.split(string);if(count===null||count===void 0){return parts.join(by)}ensurePositiveInteger(count);const head=parts.slice(0,count+1).join(by);const tail=parts.slice(count+1).join(string);return tail.length>0?head+string+tail:head};var split=(subject,search2,count)=>{if(subject.length===0&&search2.length===0){return[]}if(count!==null&&count!==void 0){ensurePositiveInteger(count);if(count===0){return[subject]}}const parts=search2===""?[...subject]:subject.
46
+ split(search2);if(count===null||count===void 0){return parts}return[...parts.slice(0,count),parts.slice(count).join(search2)]};var trimImpl=(subject,pattern,chars)=>{const charClass=chars?chars.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"):"\\s\x85";return subject.replace(new RegExp(pattern.replace("%s",charClass),"u"),"")};var trimLeft=(subject,chars)=>trimImpl(subject,"^[%s]+",chars);var trimRight=(subject,chars)=>trimImpl(subject,"[%s]+$",chars);var trim=(subject,chars)=>trimLeft(trimRight(subject,
47
+ chars),chars);var compareStrings=(a,b)=>{if(a===b){return 0}const itA=a[Symbol.iterator]();const itB=b[Symbol.iterator]();while(true){const nextA=itA.next();const nextB=itB.next();if(nextA.done||nextB.done){return nextA.done&&nextB.done?0:nextA.done?-1:1}if(nextA.value!==nextB.value){return nextA.value.codePointAt(0)>nextB.value.codePointAt(0)?1:-1}}};var Text=class{constructor(string){this.string=string}get length(){return[...this.string].length}compareTo(other){return compareStrings(this.string,
48
+ other)}static comparer=compareStrings;static compareStrings=compareStrings};var InputArgument=(InputArgument2=>{InputArgument2[InputArgument2["TYPE_NUMBER"]=0]="TYPE_NUMBER";InputArgument2[InputArgument2["TYPE_ANY"]=1]="TYPE_ANY";InputArgument2[InputArgument2["TYPE_STRING"]=2]="TYPE_STRING";InputArgument2[InputArgument2["TYPE_ARRAY"]=3]="TYPE_ARRAY";InputArgument2[InputArgument2["TYPE_OBJECT"]=4]="TYPE_OBJECT";InputArgument2[InputArgument2["TYPE_BOOLEAN"]=5]="TYPE_BOOLEAN";InputArgument2[InputArgument2["\
49
+ TYPE_EXPREF"]=6]="TYPE_EXPREF";InputArgument2[InputArgument2["TYPE_NULL"]=7]="TYPE_NULL";InputArgument2[InputArgument2["TYPE_ARRAY_NUMBER"]=8]="TYPE_ARRAY_NUMBER";InputArgument2[InputArgument2["TYPE_ARRAY_STRING"]=9]="TYPE_ARRAY_STRING";InputArgument2[InputArgument2["TYPE_ARRAY_OBJECT"]=10]="TYPE_ARRAY_OBJECT";InputArgument2[InputArgument2["TYPE_ARRAY_ARRAY"]=11]="TYPE_ARRAY_ARRAY";return InputArgument2})(InputArgument||{});var ARRAY_SUBTYPES={[8]:0,[10]:4,[9]:2,[11]:3};var JSON_NUMBER_REGEX=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
50
+ var s=(...types)=>types.map(t=>({types:Array.isArray(t)?t:[t]}));var opt=(...types)=>types.map(t=>({types:Array.isArray(t)?t:[t],optional:true}));var variadic=(...types)=>types.map(t=>({types:Array.isArray(t)?t:[t],variadic:true}));var optVariadic=(...types)=>types.map(t=>({types:Array.isArray(t)?t:[t],variadic:true,optional:true}));var{TYPE_NUMBER:NUM,TYPE_ANY:ANY,TYPE_STRING:STR,TYPE_ARRAY:ARR,TYPE_OBJECT:OBJ,TYPE_EXPREF:EXP,TYPE_ARRAY_NUMBER:ARR_NUM,TYPE_ARRAY_STRING:ARR_STR,TYPE_ARRAY_ARRAY:ARR_ARR}=InputArgument;
51
+ var Runtime=class{_interpreter;_functionTable;_customFunctions=new Set;TYPE_NAME_TABLE=Object.freeze(["number","any","string","array","object","boolean","expression","null","Array<number>","Array<string>","Array<object>","Array<Array<any>>"]);constructor(interpreter){this._interpreter=interpreter;this._functionTable=this.buildFunctionTable()}buildFunctionTable(){return{abs:{_func:([v])=>Math.abs(v),_signature:s(NUM)},ceil:{_func:([v])=>Math.ceil(v),_signature:s(NUM)},floor:{_func:([v])=>Math.floor(
52
+ v),_signature:s(NUM)},lower:{_func:([s2])=>s2.toLowerCase(),_signature:s(STR)},upper:{_func:([s2])=>s2.toUpperCase(),_signature:s(STR)},keys:{_func:([o])=>Object.keys(o),_signature:s(OBJ)},values:{_func:([o])=>Object.values(o),_signature:s(OBJ)},avg:{_func:([arr])=>arr&&arr.length?arr.reduce((a,b)=>a+b,0)/arr.length:null,_signature:s(ARR_NUM)},contains:{_func:this.functionContains,_signature:s([STR,ARR],ANY)},ends_with:{_func:([str,suf])=>str.endsWith(suf),_signature:s(STR,STR)},find_first:{_func:([
53
+ s2,sub2,st,en])=>findFirst(s2,sub2,st,en),_signature:[...s(STR,STR),...opt(NUM,NUM)]},find_last:{_func:([s2,sub2,st,en])=>findLast(s2,sub2,st,en),_signature:[...s(STR,STR),...opt(NUM,NUM)]},from_items:{_func:this.functionFromItems,_signature:s(ARR_ARR)},group_by:{_func:this.functionGroupBy,_signature:s(ARR,EXP)},items:{_func:([o])=>Object.entries(o),_signature:s(OBJ)},join:{_func:([sep,arr])=>arr.join(sep),_signature:s(STR,ARR_STR)},length:{_func:([v])=>typeof v==="string"?[...v].length:Array.isArray(
54
+ v)?v.length:Object.keys(v).length,_signature:s([STR,ARR,OBJ])},map:{_func:this.functionMap,_signature:s(EXP,ARR)},max:{_func:([v])=>this.findExtreme(v,cmp=>cmp>0,Math.max),_signature:s([ARR_NUM,ARR_STR])},max_by:{_func:args=>this.findExtremeBy(args,cmp=>cmp>0),_signature:s(ARR,EXP)},merge:{_func:args=>Object.assign({},...args),_signature:optVariadic(OBJ)},min:{_func:([v])=>this.findExtreme(v,cmp=>cmp<0,Math.min),_signature:s([ARR_NUM,ARR_STR])},min_by:{_func:args=>this.findExtremeBy(args,cmp=>cmp<
55
+ 0),_signature:s(ARR,EXP)},not_null:{_func:args=>args.find(arg=>arg!==null)??null,_signature:variadic(ANY)},pad_left:{_func:([s2,w,p])=>padLeft(s2,w,p),_signature:[...s(STR,NUM),...opt(STR)]},pad_right:{_func:([s2,w,p])=>padRight(s2,w,p),_signature:[...s(STR,NUM),...opt(STR)]},replace:{_func:([s2,str,by,c])=>replace(s2,str,by,c),_signature:[...s(STR,STR,STR),...opt(NUM)]},reverse:{_func:([v])=>typeof v==="string"?[...v].reverse().join(""):[...v].reverse(),_signature:s([STR,ARR])},sort:{_func:this.
56
+ functionSort,_signature:s([ARR_STR,ARR_NUM])},sort_by:{_func:this.functionSortBy,_signature:s(ARR,EXP)},split:{_func:([s2,sub2,c])=>split(s2,sub2,c),_signature:[...s(STR,STR),...opt(NUM)]},starts_with:{_func:([str,pre])=>str.startsWith(pre),_signature:s(STR,STR)},sum:{_func:([arr])=>arr.reduce((x,y)=>x+y,0),_signature:s(ARR_NUM)},to_array:{_func:([v])=>Array.isArray(v)?v:[v],_signature:s(ANY)},to_number:{_func:this.functionToNumber,_signature:s(ANY)},to_string:{_func:([v])=>typeof v==="string"?v:
57
+ JSON.stringify(v),_signature:s(ANY)},trim:{_func:([s2,c])=>trim(s2,c),_signature:[...s(STR),...opt(STR)]},trim_left:{_func:([s2,c])=>trimLeft(s2,c),_signature:[...s(STR),...opt(STR)]},trim_right:{_func:([s2,c])=>trimRight(s2,c),_signature:[...s(STR),...opt(STR)]},type:{_func:this.functionType,_signature:s(ANY)},zip:{_func:this.functionZip,_signature:variadic(ARR)}}}registerFunction(name,customFunction,signature,options){const result=this._registerInternal(name,customFunction,signature,options);if(!result.
58
+ success){throw new Error(result.message)}}_registerInternal(name,customFunction,signature,options={}){if(!name||typeof name!=="string"||name.trim()===""){return{success:false,reason:"invalid-name",message:"Function name must be a non-empty string"}}try{this.validateInputSignatures(name,signature)}catch(error){return{success:false,reason:"invalid-signature",message:error instanceof Error?error.message:"Invalid function signature"}}const{override=false,warn=false}=options;const exists=name in this.
59
+ _functionTable;if(exists&&!override){return{success:false,reason:"already-exists",message:`Function already defined: ${name}(). Use { override: true } to replace it.`}}if(exists&&override&&warn){console.warn(`Warning: Overriding existing function: ${name}()`)}this._functionTable[name]={_func:customFunction.bind(this),_signature:signature};this._customFunctions.add(name);const message=exists?`Function ${name}() overridden successfully`:`Function ${name}() registered successfully`;return{success:true,
60
+ message}}register(name,customFunction,signature,options={}){return this._registerInternal(name,customFunction,signature,options)}unregister(name){if(!this._customFunctions.has(name)){return false}delete this._functionTable[name];this._customFunctions.delete(name);return true}isRegistered(name){return name in this._functionTable}getRegistered(){return Object.keys(this._functionTable)}getCustomFunctions(){return Array.from(this._customFunctions)}clearCustomFunctions(){for(const name of this._customFunctions){
61
+ delete this._functionTable[name]}this._customFunctions.clear()}callFunction(name,resolvedArgs){const functionEntry=this._functionTable[name];if(functionEntry===void 0){throw new Error(`Unknown function: ${name}()`)}this.validateArgs(name,resolvedArgs,functionEntry._signature);return functionEntry._func.call(this,resolvedArgs)}validateInputSignatures(name,signature){for(let i=0;i<signature.length;i+=1){if("variadic"in signature[i]&&i!==signature.length-1){throw new Error(`Invalid arity: ${name}()\
62
+ 'variadic' argument ${i+1} must occur last`)}}}validateArgs(name,args,signature){this.validateInputSignatures(name,signature);this.validateArity(name,args,signature);this.validateTypes(name,args,signature)}validateArity(name,args,signature){const numberOfRequiredArgs=signature.filter(argSignature=>!(argSignature.optional??false)).length;const lastArgIsVariadic=signature[signature.length-1]?.variadic??false;const tooFewArgs=args.length<numberOfRequiredArgs;const tooManyArgs=args.length>signature.
63
+ length;if(lastArgIsVariadic&&tooFewArgs||!lastArgIsVariadic&&(tooFewArgs||tooManyArgs)){const tooFewModifier=tooFewArgs&&(!lastArgIsVariadic&&numberOfRequiredArgs>1||lastArgIsVariadic)?"at least ":"";const pluralized=signature.length>1;throw new Error(`Invalid arity: ${name}() takes ${tooFewModifier}${numberOfRequiredArgs} argument${pluralized&&"s"||""} but received ${args.length}`)}}validateTypes(name,args,signature){const lastSigIndex=signature.length-1;const isVariadic=signature[lastSigIndex]?.
64
+ variadic??false;for(let i=0;i<args.length;i+=1){const sig=i<signature.length?signature[i]:isVariadic?signature[lastSigIndex]:void 0;if(!sig){continue}const currentSpec=sig.types;const actualType=this.getTypeName(args[i]);if(actualType===void 0){continue}const typeMatched=currentSpec.some(expectedType=>this.typeMatches(actualType,expectedType,args[i]));if(!typeMatched){const expected=currentSpec.map(typeId=>this.TYPE_NAME_TABLE[typeId]).join(" | ");throw new Error(`Invalid type: ${name}() expecte\
65
+ d argument ${i+1} to be type (${expected}) but received type ${this.TYPE_NAME_TABLE[actualType]} instead.`)}}}typeMatches(actual,expected,argValue){if(expected===1){return true}const subtype=ARRAY_SUBTYPES[expected];if(subtype!==void 0){if(actual!==3){return false}const array=argValue;return array.every(item=>{const typeName=this.getTypeName(item);return typeName===void 0||this.typeMatches(typeName,subtype,item)})}return actual===expected}getTypeName(obj){if(obj===null){return 7}if(typeof obj===
66
+ "string"){return 2}if(typeof obj==="number"){return 0}if(typeof obj==="boolean"){return 5}if(Array.isArray(obj)){return 3}if(typeof obj==="object"){if(obj.expref){return 6}return 4}return}createKeyFunction(exprefNode,allowedTypes){const interpreter=this._interpreter;const keyFunc=x=>{const current=interpreter.visit(exprefNode,x);if(!allowedTypes.includes(this.getTypeName(current))){const msg=`Invalid type: expected one of (${allowedTypes.map(t=>this.TYPE_NAME_TABLE[t]).join(" | ")}), received ${this.
67
+ TYPE_NAME_TABLE[this.getTypeName(current)]}`;throw new Error(msg)}return current};return keyFunc}functionContains=([searchable,searchValue])=>{if(Array.isArray(searchable)){const array=searchable;return array.includes(searchValue)}if(typeof searchable==="string"){const text=searchable;if(typeof searchValue==="string"){return text.includes(searchValue)}return false}return null};functionFromItems=([array])=>{for(const pair of array){if(pair.length!==2||typeof pair[0]!=="string"){throw new Error("i\
68
+ nvalid value, each array must contain two elements, a pair of string and value")}}return Object.fromEntries(array)};functionGroupBy=([array,exprefNode])=>{const interpreter=this._interpreter;if(!interpreter){return{}}const groups=new Map;for(const item of array){const raw=interpreter.visit(exprefNode,item);if(raw===null||raw===void 0){continue}if(typeof raw!=="string"){const type=this.getTypeName(raw);throw new Error(`Invalid type: expected one of (${this.TYPE_NAME_TABLE[2]}), received ${this.TYPE_NAME_TABLE[type]}`)}
69
+ let group=groups.get(raw);if(!group){group=[];groups.set(raw,group)}group.push(item)}return Object.fromEntries(groups)};functionMap=([exprefNode,elements])=>{if(!this._interpreter){return[]}const mapped=[];const interpreter=this._interpreter;for(let i=0;i<elements.length;i+=1){mapped.push(interpreter.visit(exprefNode,elements[i]))}return mapped};findExtreme(inputValue,isBetter,mathFn){if(!inputValue.length){return null}if(this.getTypeName(inputValue[0])===0){return mathFn(...inputValue)}const elements=inputValue;
70
+ let extreme=elements[0];for(let i=1;i<elements.length;i+=1){if(isBetter(Text.comparer(elements[i],extreme))){extreme=elements[i]}}return extreme}findExtremeBy(resolvedArgs,isBetter){const resolvedArray=resolvedArgs[0];if(!resolvedArray.length){return null}const exprefNode=resolvedArgs[1];const interpreter=this._interpreter;if(!interpreter){return null}const firstKey=interpreter.visit(exprefNode,resolvedArray[0]);const firstType=this.getTypeName(firstKey);if(firstType!==0&&firstType!==2){throw new Error(
71
+ `Invalid type: expected one of (${this.TYPE_NAME_TABLE[0]} | ${this.TYPE_NAME_TABLE[2]}), received ${this.TYPE_NAME_TABLE[firstType]}`)}let extremeRecord=resolvedArray[0];let extremeKey=firstKey;for(let i=1;i<resolvedArray.length;i+=1){const currentKey=interpreter.visit(exprefNode,resolvedArray[i]);const currentType=this.getTypeName(currentKey);if(currentType!==firstType){throw new Error(`Invalid type: expected (${this.TYPE_NAME_TABLE[firstType]}), received ${this.TYPE_NAME_TABLE[currentType]}`)}
72
+ const cmp=firstType===0?currentKey-extremeKey:Text.comparer(currentKey,extremeKey);if(isBetter(cmp)){extremeKey=currentKey;extremeRecord=resolvedArray[i]}}return extremeRecord}functionSort=([inputValue])=>inputValue.length<=1?inputValue:typeof inputValue[0]==="string"?[...inputValue].sort(Text.comparer):[...inputValue].sort((a,b)=>a-b);functionSortBy=resolvedArgs=>{const sortedArray=[...resolvedArgs[0]];if(sortedArray.length===0){return sortedArray}const interpreter=this._interpreter;const exprefNode=resolvedArgs[1];
73
+ const requiredType=this.getTypeName(interpreter.visit(exprefNode,sortedArray[0]));if(requiredType===void 0||![0,2].includes(requiredType)){const typeName=requiredType!==void 0?this.TYPE_NAME_TABLE[requiredType]:"undefined";throw new Error(`Invalid type: unexpected type (${typeName})`)}if(sortedArray.length===1){return sortedArray}function throwInvalidTypeError(rt,item){throw new Error(`Invalid type: expected (${rt.TYPE_NAME_TABLE[requiredType]}), received ${rt.TYPE_NAME_TABLE[rt.getTypeName(item)]}`)}
74
+ return sortedArray.sort((a,b)=>{const exprA=interpreter.visit(exprefNode,a);const exprB=interpreter.visit(exprefNode,b);if(this.getTypeName(exprA)!==requiredType){throwInvalidTypeError(this,exprA)}else if(this.getTypeName(exprB)!==requiredType){throwInvalidTypeError(this,exprB)}if(requiredType===2){return Text.comparer(exprA,exprB)}return exprA-exprB})};functionToNumber=([inputValue])=>{const typeName=this.getTypeName(inputValue);if(typeName===0){return inputValue}if(typeName===2){const str=inputValue;
75
+ if(JSON_NUMBER_REGEX.test(str)){const convertedValue=Number(str);if(!isNaN(convertedValue)){return convertedValue}}}return null};functionType=([inputValue])=>{const type=this.getTypeName(inputValue);const name=type!==void 0?this.TYPE_NAME_TABLE[type]:void 0;if(!name){throw new Error("invalid-type")}return name};functionZip=array=>{const length=Math.min(...array.map(arr=>arr.length));return Array.from({length},(_,index)=>array.map(arr=>arr[index]))}};var ScopeChain=class _ScopeChain{inner=void 0;data={};get currentScopeData(){
76
+ return this.data}withScope(data){const outer=new _ScopeChain;outer.inner=this;outer.data=data;return outer}hasValue(identifier){if(Object.prototype.hasOwnProperty.call(this.data,identifier)){return true}if(this.inner){return this.inner.hasValue(identifier)}return false}getValue(identifier){if(Object.prototype.hasOwnProperty.call(this.data,identifier)){return this.data[identifier]}if(this.inner){return this.inner.getValue(identifier)}return null}};var emptyScopeChain=new ScopeChain;var TreeInterpreter=class _TreeInterpreter{runtime;_rootValue=null;_scope;_options;_depth=0;_maxDepth=DEFAULT_MAX_DEPTH;_deadline=0;constructor(options){
77
+ this.runtime=new Runtime(this);this._scope=new ScopeChain;this._maxDepth=options?.maxDepth??DEFAULT_MAX_DEPTH;if(options){this._options=options;this._deadline=options.timeoutMs!==void 0?Date.now()+options.timeoutMs:0}}withScope(scope){const interpreter=new _TreeInterpreter(this._options);interpreter.runtime=this.runtime;interpreter._rootValue=this._rootValue;interpreter._scope=this._scope.withScope(scope);interpreter._depth=this._depth;interpreter._maxDepth=this._maxDepth;interpreter._deadline=this.
78
+ _deadline;return interpreter}search(node,value,options){if(options?.maxNodes!==void 0&&countNodes(node)>options.maxNodes){throw new Error(`Expression exceeds maximum allowed node count of ${options.maxNodes}`)}this._rootValue=value;this._scope=emptyScopeChain;this._options=options;this._maxDepth=options?.maxDepth??DEFAULT_MAX_DEPTH;this._depth=0;this._deadline=options?.timeoutMs!==void 0?Date.now()+options.timeoutMs:0;const result=this.visit(node,value);this.checkOutputSize(result);return result}checkOutputSize(val){
79
+ const max=this._options?.maxOutputSize;if(max===void 0||val==null){return}const size=Array.isArray(val)||typeof val==="string"?val.length:typeof val==="object"?Object.keys(val).length:0;if(size>max){throw new Error(`Output size exceeds maximum allowed size of ${max}`)}}collect(target,item){target.push(item);if(this._options?.maxOutputSize!==void 0&&target.length>this._options.maxOutputSize){throw new Error(`Output size exceeds maximum allowed size of ${this._options.maxOutputSize}`)}}evaluateProjectionItems(items,right){
80
+ const collected=[];if(right.type==="Field"){const key=right.name;for(let i=0;i<items.length;i++){if(this._deadline>0&&Date.now()>=this._deadline){throw new Error(`Query execution timed out after ${this._options?.timeoutMs}ms`)}const elem=items[i];if(!elem||typeof elem!=="object"||Array.isArray(elem)){continue}if(!Object.prototype.hasOwnProperty.call(elem,key)){continue}const val=elem[key];if(val!==void 0&&val!==null){this.collect(collected,val)}}return collected}if(right.type==="Identity"){for(let i=0;i<
81
+ items.length;i++){const elem=items[i];if(elem!==null){this.collect(collected,elem)}}return collected}for(const elem of items){const current=this.visit(right,elem);if(current!==null){this.collect(collected,current)}}return collected}visit(node,value){if(this._deadline>0&&Date.now()>=this._deadline){throw new Error(`Query execution timed out after ${this._options?.timeoutMs}ms`)}if(this._depth>=this._maxDepth){throw new Error(`Evaluation exceeds maximum allowed depth of ${this._maxDepth}`)}this._depth+=
82
+ 1;try{return this.evaluateNode(node,value)}finally{this._depth-=1}}evaluateNode(node,value){switch(node.type){case"Ternary":{const condition=this.visit(node.condition,value);if(!isFalse(condition)){return this.visit(node.trueExpr,value)}return this.visit(node.falseExpr,value)}case"Field":const identifier=node.name;if(value===null||typeof value!=="object"||Array.isArray(value)){return null}return Object.prototype.hasOwnProperty.call(value,identifier)?value[identifier]??null:null;case"LetExpressio\
83
+ n":{const scope={};for(const binding of node.bindings){const bound=this.visit(binding,value);for(const key of Object.keys(bound)){Object.defineProperty(scope,key,{value:bound[key],enumerable:true,writable:true,configurable:true})}}return this.withScope(scope).visit(node.expression,value)}case"Binding":{const{variable,reference}=node;const result=this.visit(reference,value);const binding={};Object.defineProperty(binding,variable,{value:result,enumerable:true,writable:true,configurable:true});return binding}case"\
84
+ Variable":{const variable=node.name;if(!this._scope.hasValue(variable)){throw new Error(`Error referencing undefined variable ${variable}`)}return this._scope.getValue(variable)}case"IndexExpression":return this.visit(node.right,this.visit(node.left,value));case"Subexpression":{const result=this.visit(node.left,value);return result!=null?this.visit(node.right,result)??null:null}case"Index":{if(!Array.isArray(value)){return null}const index=node.value<0?value.length+node.value:node.value;return value[index]??
85
+ null}case"Slice":{if(!Array.isArray(value)&&typeof value!=="string"){return null}const target=typeof value==="string"?[...value]:value;const{start,stop,step}=this.computeSliceParams(target.length,node);const sliced=this.slice(target,start,stop,step);const res=typeof value==="string"?sliced.join(""):sliced;this.checkOutputSize(res);return res}case"Projection":{const{left,right}=node;const allowString=left.type==="IndexExpression"&&left.right.type==="Slice";const base=this.visit(left,value);if(allowString&&
86
+ typeof base==="string"){return this.visit(right,base)}return Array.isArray(base)?this.evaluateProjectionItems(base,right):null}case"ValueProjection":{const base=this.visit(node.left,value);if(base===null||typeof base!=="object"||Array.isArray(base)){return null}return this.evaluateProjectionItems(Object.values(base),node.right)}case"FilterProjection":{const{left,right,condition}=node;const base=this.visit(left,value);if(!Array.isArray(base)){return null}const results=[];if(right.type==="Field"){
87
+ const key=right.name;for(let i=0;i<base.length;i++){const elem=base[i];if(isFalse(this.visit(condition,elem))){continue}if(!elem||typeof elem!=="object"||Array.isArray(elem)){continue}if(!Object.prototype.hasOwnProperty.call(elem,key)){continue}const val=elem[key];if(val!==void 0&&val!==null){this.collect(results,val)}}return results}if(right.type==="Identity"){for(let i=0;i<base.length;i++){const elem=base[i];if(isFalse(this.visit(condition,elem))){continue}if(elem!==null){this.collect(results,
88
+ elem)}}return results}for(const elem of base){if(isFalse(this.visit(condition,elem))){continue}const result=this.visit(right,elem);if(result!==null){this.collect(results,result)}}return results}case"Arithmetic":{const first=this.visit(node.left,value);const second=this.visit(node.right,value);switch(node.operator){case"Plus":return add(first,second);case"Minus":return sub(first,second);case"Multiply":case"Star":return mul(first,second);case"Divide":return divide(first,second);case"Modulo":return mod(
89
+ first,second);case"Div":return div(first,second);default:throw new Error(`Syntax error: unknown arithmetic operator: ${node.operator}`)}}case"Unary":{const operand=this.visit(node.operand,value);switch(node.operator){case"Plus":ensureNumbers(operand);return operand;case"Minus":ensureNumbers(operand);return-operand;default:throw new Error(`Syntax error: unknown arithmetic operator: ${node.operator}`)}}case"Comparator":{const first=this.visit(node.left,value);const second=this.visit(node.right,value);
90
+ switch(node.name){case"EQ":return strictDeepEqual(first,second);case"NE":return!strictDeepEqual(first,second)}if(typeof first!=="number"||typeof second!=="number"){return null}switch(node.name){case"GT":return first>second;case"GTE":return first>=second;case"LT":return first<second;case"LTE":return first<=second}}case"Flatten":{const original=this.visit(node.child,value);const res=Array.isArray(original)?original.flat():null;this.checkOutputSize(res);return res}case"Root":return this._rootValue;case"\
91
+ MultiSelectList":{const collected=[];for(const child of node.children){collected.push(this.visit(child,value))}this.checkOutputSize(collected);return collected}case"MultiSelectHash":{const collected={};for(const child of node.children){Object.defineProperty(collected,child.name,{value:this.visit(child.value,value),enumerable:true,writable:true,configurable:true})}this.checkOutputSize(collected);return collected}case"OrExpression":{const result=this.visit(node.left,value);if(isFalse(result)){return this.
92
+ visit(node.right,value)}return result}case"AndExpression":{const result=this.visit(node.left,value);if(isFalse(result)){return result}return this.visit(node.right,value)}case"NotExpression":return isFalse(this.visit(node.child,value));case"Literal":return node.value;case"Pipe":return this.visit(node.right,this.visit(node.left,value));case"Function":{if(this._options?.allowedFunctions&&!this._options.allowedFunctions.includes(node.name)){throw new Error(`Function '${node.name}' is not allowed`)}if(this.
93
+ _options?.disallowedFunctions&&this._options.disallowedFunctions.includes(node.name)){throw new Error(`Function '${node.name}' is disallowed`)}const args=[];for(const child of node.children){args.push(this.visit(child,value))}const prevInterpreter=this.runtime._interpreter;this.runtime._interpreter=this;try{const res=this.runtime.callFunction(node.name,args);this.checkOutputSize(res);return res}finally{this.runtime._interpreter=prevInterpreter}}case"ExpressionReference":return{expref:true,...node.
94
+ child};case"Current":case"Identity":return value}}computeSliceParams(arrayLength,sliceNode){let{start,stop,step}=sliceNode;if(step===null){step=1}else if(step===0){const error=new Error("Invalid value: slice step cannot be 0");error.name="RuntimeError";throw error}start=start===null?step<0?arrayLength-1:0:this.capSliceRange(arrayLength,start,step);stop=stop===null?step<0?-1:arrayLength:this.capSliceRange(arrayLength,stop,step);return{start,stop,step}}capSliceRange(arrayLength,actualValue,step){let nextActualValue=actualValue;
95
+ if(nextActualValue<0){nextActualValue+=arrayLength;if(nextActualValue<0){nextActualValue=step<0?-1:0}}else if(nextActualValue>=arrayLength){nextActualValue=step<0?arrayLength-1:arrayLength}return nextActualValue}slice(collection,start,end,step){if(step===1){return collection.slice(start,end)}const len=Math.max(0,Math.ceil((end-start)/step));const result=new Array(len);let idx=0;if(step>0){for(let i=start;i<end;i+=step){result[idx++]=collection[i]}}else{for(let i=start;i>end;i+=step){result[idx++]=
96
+ collection[i]}}return result}};var TreeInterpreterInstance=new TreeInterpreter;var TreeInterpreter_default=TreeInterpreterInstance;async function*toAsyncIterable(source){if(source==null){return}if(typeof source!=="object"&&typeof source!=="function"){throw new TypeError("Invalid stream source: expected AsyncIterable, Iterable, or ReadableStream")}if(Symbol.asyncIterator in source){for await(const chunk of source){yield chunk}return}if(typeof source.getReader==="function"){const reader=source.getReader();
97
+ try{while(true){const{done,value}=await reader.read();if(done){break}yield value}}finally{reader.releaseLock()}return}if(Symbol.iterator in source){for(const chunk of source){yield chunk}return}throw new TypeError("Invalid stream source: expected AsyncIterable, Iterable, or ReadableStream")}function parseItem(str,parseJson){if(parseJson===true){return JSON.parse(str)}if(parseJson==="auto"){try{return JSON.parse(str)}catch{return str}}return str}async function*normalizeSource(source,options){const parseJson=options?.
98
+ parseJson??"auto";const flatten=options?.flattenChunks??true;let buffer="";const textDecoder=typeof TextDecoder!=="undefined"?new TextDecoder:null;for await(const chunk of toAsyncIterable(source)){const str=chunk instanceof Uint8Array&&textDecoder?textDecoder.decode(chunk,{stream:true}):typeof chunk==="string"?chunk:null;if(str!==null){if(parseJson===false&&typeof chunk==="string"){yield chunk}else{buffer+=str;if(buffer.includes("\n")){const lines=buffer.split("\n");buffer=lines.pop()??"";for(const line of lines){
99
+ const trimmed=line.trim();if(trimmed){yield parseItem(trimmed,parseJson)}}}}}else{if(buffer.trim()){yield parseItem(buffer.trim(),parseJson);buffer=""}if(flatten&&Array.isArray(chunk)){for(const item of chunk){yield item}}else{yield chunk}}}if(textDecoder&&buffer){buffer+=textDecoder.decode()}if(buffer.trim()){yield parseItem(buffer.trim(),parseJson)}}function isStreamableNode(node){switch(node.type){case"Projection":if(node.left.type==="Identity"||node.left.type==="Current"){return true}if(node.
100
+ left.type==="IndexExpression"&&node.left.right.type==="Slice"){const slice=node.left.right;return(slice.start===null||slice.start>=0)&&(slice.stop===null||slice.stop>=0)&&(slice.step===null||slice.step>0)}return false;case"FilterProjection":return node.left.type==="Identity"||node.left.type==="Current";case"IndexExpression":if(node.left.type==="Identity"||node.left.type==="Current"){if(node.right.type==="Slice"){const slice=node.right;return(slice.start===null||slice.start>=0)&&(slice.stop===null||
101
+ slice.stop>=0)&&(slice.step===null||slice.step>0)}return false}return isStreamableNode(node.left);case"Field":case"Identity":case"Current":return true;case"Subexpression":return isStreamableNode(node.left)&&isStreamableNode(node.right);case"MultiSelectHash":case"MultiSelectList":case"Ternary":case"Comparator":case"Arithmetic":case"NotExpression":return true;case"Pipe":return isStreamableNode(node.left)&&isStreamableNode(node.right);default:return false}}async function drainStream(source,checkDeadline,maxOutputSize){
102
+ const collected=[];for await(const item of source){checkDeadline();collected.push(item);if(maxOutputSize!==void 0&&collected.length>maxOutputSize){throw new Error(`Output size exceeds maximum allowed size of ${maxOutputSize}`)}}return collected}async function*drainAndEvaluate(source,node,interpreter,checkDeadline,options){const collected=await drainStream(source,checkDeadline,options?.maxOutputSize);const result=interpreter.search(node,collected,options);if(Array.isArray(result)){for(const item of result){
103
+ yield item}}else if(result!==null&&result!==void 0){yield result}}async function*evaluateStreamNode(source,node,interpreter,options){const deadline=options?.timeoutMs!==void 0?Date.now()+options.timeoutMs:0;function checkDeadline(){if(deadline>0&&Date.now()>=deadline){throw new Error(`Query execution timed out after ${options?.timeoutMs}ms`)}}switch(node.type){case"Projection":{if(!isStreamableNode(node)){yield*drainAndEvaluate(source,node,interpreter,checkDeadline,options);return}const{left,right}=node;
104
+ let streamSource=source;if(left.type==="IndexExpression"&&left.right.type==="Slice"){streamSource=evaluateStreamNode(source,left,interpreter,options)}if(right.type==="Identity"||right.type==="Current"){for await(const item of streamSource){checkDeadline();if(item!==null&&item!==void 0){yield item}}return}if(right.type==="Field"){const key=right.name;for await(const item of streamSource){checkDeadline();if(item&&typeof item==="object"&&!Array.isArray(item)){const val=item[key];if(val!==void 0&&val!==
105
+ null){yield val}}}return}for await(const item of streamSource){checkDeadline();const res=interpreter.visit(right,item);if(res!==null&&res!==void 0){yield res}}return}case"IndexExpression":{if(node.left.type==="Identity"||node.left.type==="Current"){if(node.right.type==="Slice"){const slice=node.right;const start=slice.start??0;const stop=slice.stop??Infinity;const step=slice.step??1;if(start>=0&&stop>=0&&step>0){let index=0;for await(const item of source){checkDeadline();if(index>=stop){break}if(index>=
106
+ start&&(index-start)%step===0){yield item}index++;if(index>=stop){break}}return}}yield*drainAndEvaluate(source,node,interpreter,checkDeadline,options);return}for await(const item of source){checkDeadline();const res=interpreter.visit(node,item);if(res!==null&&res!==void 0){yield res}}return}case"FilterProjection":{if(!isStreamableNode(node)){yield*drainAndEvaluate(source,node,interpreter,checkDeadline,options);return}const{condition,right}=node;if(right.type==="Identity"||right.type==="Current"){
107
+ for await(const item of source){checkDeadline();if(!isFalse(interpreter.visit(condition,item))){yield item}}return}if(right.type==="Field"){const key=right.name;for await(const item of source){checkDeadline();if(!isFalse(interpreter.visit(condition,item))){if(item&&typeof item==="object"&&!Array.isArray(item)){const val=item[key];if(val!==void 0&&val!==null){yield val}}}}return}for await(const item of source){checkDeadline();if(!isFalse(interpreter.visit(condition,item))){const res=interpreter.visit(
108
+ right,item);if(res!==null&&res!==void 0){yield res}}}return}case"Pipe":{const leftStream=evaluateStreamNode(source,node.left,interpreter,options);if(isStreamableNode(node.right)){for await(const res of evaluateStreamNode(leftStream,node.right,interpreter,options)){yield res}}else{const collected=await drainStream(leftStream,checkDeadline,options?.maxOutputSize);const result=interpreter.search(node.right,collected,options);if(result!==null&&result!==void 0){yield result}}return}case"Identity":case"\
109
+ Current":{for await(const item of source){checkDeadline();yield item}return}case"Field":{const key=node.name;for await(const item of source){checkDeadline();if(item&&typeof item==="object"&&!Array.isArray(item)){const val=item[key];if(val!==void 0&&val!==null){yield val}}}return}default:{if(isStreamableNode(node)){for await(const item of source){checkDeadline();const res=interpreter.visit(node,item);if(res!==null&&res!==void 0){yield res}}return}yield*drainAndEvaluate(source,node,interpreter,checkDeadline,
110
+ options);return}}}function isExpressionNode(val){return typeof val==="object"&&val!==null&&"type"in val&&typeof val.type==="string"&&!(Symbol.iterator in val)&&!(Symbol.asyncIterator in val)}async function*searchStream(sourceOrExpression,expressionOrSource,options){let expression;let source;if(typeof sourceOrExpression==="string"||isExpressionNode(sourceOrExpression)){expression=sourceOrExpression;source=expressionOrSource}else{source=sourceOrExpression;expression=expressionOrSource}if(typeof expression!==
111
+ "string"&&!isExpressionNode(expression)){throw new TypeError("Expression must be a string or AST ExpressionNode")}const ast=typeof expression==="string"?Parser_default.parse(expression,options):expression;if(options){const fnError=findDisallowedFunction(ast,options);if(fnError){throw new Error(fnError)}}const interpreter=new TreeInterpreter(options);interpreter.runtime._functionTable=TreeInterpreterInstance.runtime._functionTable;const items=normalizeSource(source,options);const results=evaluateStreamNode(
112
+ items,ast,interpreter,options);const limit=options?.limit;const maxOutputSize=options?.maxOutputSize;let count=0;if(limit!==void 0&&limit<=0){return}for await(const result of results){if(maxOutputSize!==void 0&&count>=maxOutputSize){throw new Error(`Output size exceeds maximum allowed size of ${maxOutputSize}`)}yield result;count++;if(limit!==void 0&&count>=limit){break}}}var TYPE_ANY=1;var TYPE_ARRAY=3;var TYPE_ARRAY_ARRAY=11;var TYPE_ARRAY_NUMBER=8;var TYPE_ARRAY_OBJECT=10;var TYPE_ARRAY_STRING=9;
113
+ var TYPE_BOOLEAN=5;var TYPE_EXPREF=6;var TYPE_NULL=7;var TYPE_NUMBER=0;var TYPE_OBJECT=4;var TYPE_STRING=2;function compile(expression,options){return Parser_default.parse(expression,options)}function compileQuery(expression,options){const nodeTree=Parser_default.parse(expression,options);const searchFn=data=>TreeInterpreter_default.search(nodeTree,data,options);const fn=searchFn;fn.search=searchFn;fn.searchStream=(source,streamOptions)=>searchStream(source,nodeTree,{...options,...streamOptions});
114
+ fn.ast=nodeTree;return fn}function validate(expression,options){if(typeof expression!=="string"){return{valid:false,error:"Expression must be a string"}}try{const ast=Parser_default.parse(expression,options);if(options){const fnError=findDisallowedFunction(ast,options);if(fnError){return{valid:false,error:fnError}}}return{valid:true,ast}}catch(err){return{valid:false,error:err instanceof Error?err.message:String(err)}}}function tokenize(expression,options){return Lexer_default.tokenize(expression,
115
+ options)}var registerFunction=(functionName,customFunction,signature,options)=>{TreeInterpreter_default.runtime.registerFunction(functionName,customFunction,signature,options)};var register=(name,customFunction,signature,options)=>{return TreeInterpreter_default.runtime.register(name,customFunction,signature,options)};var unregisterFunction=name=>{return TreeInterpreter_default.runtime.unregister(name)};var isRegistered=name=>{return TreeInterpreter_default.runtime.isRegistered(name)};var getRegisteredFunctions=()=>{
116
+ return TreeInterpreter_default.runtime.getRegistered()};var getCustomFunctions=()=>{return TreeInterpreter_default.runtime.getCustomFunctions()};var clearCustomFunctions=()=>{TreeInterpreter_default.runtime.clearCustomFunctions()};var MAX_CACHE_SIZE=1e3;var astCache=new Map;function search(data,expression,options){let nodeTree;if(!options){nodeTree=astCache.get(expression);if(!nodeTree){nodeTree=Parser_default.parse(expression);if(astCache.size>=MAX_CACHE_SIZE){const firstKey=astCache.keys().next().
117
+ value;if(firstKey!==void 0){astCache.delete(firstKey)}}astCache.set(expression,nodeTree)}}else{nodeTree=Parser_default.parse(expression,options)}return TreeInterpreter_default.search(nodeTree,data,options)}function Scope(){return new ScopeChain}var TreeInterpreter2=TreeInterpreter_default;var jmespath={compile,compileQuery,searchStream,validate,registerFunction,register,unregisterFunction,isRegistered,getRegisteredFunctions,getCustomFunctions,clearCustomFunctions,search,tokenize,TreeInterpreter:TreeInterpreter2,
118
+ DEFAULT_MAX_DEPTH,TYPE_ANY,TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING,TYPE_ARRAY,TYPE_BOOLEAN,TYPE_EXPREF,TYPE_NULL,TYPE_NUMBER,TYPE_OBJECT,TYPE_STRING,TYPE_ARRAY_ARRAY,TYPE_ARRAY_OBJECT,Scope};var index_default=jmespath;export{DEFAULT_MAX_DEPTH,Scope,TYPE_ANY,TYPE_ARRAY,TYPE_ARRAY_ARRAY,TYPE_ARRAY_NUMBER,TYPE_ARRAY_OBJECT,TYPE_ARRAY_STRING,TYPE_BOOLEAN,TYPE_EXPREF,TYPE_NULL,TYPE_NUMBER,TYPE_OBJECT,TYPE_STRING,TreeInterpreter2 as TreeInterpreter,clearCustomFunctions,compile,compileQuery,index_default as default,getCustomFunctions,getRegisteredFunctions,isRegistered,jmespath,register,registerFunction,search,searchStream,tokenize,unregisterFunction,validate};
@@ -37,4 +37,4 @@ REMOTE_USAGE)}const account=args.account!==void 0?await resolver.githubAccount(a
37
37
  `);if(deps.hint??process.stderr.isTTY===true){const origin=new URL(ctx.apiUrl).origin;err(`\u8A8D\u8A3C\u306F credential helper \u3067\u6E21\u3057\u307E\u3059\uFF08\u672A\u8A2D\u5B9A\u306A\u30891\u56DE\u3060\u3051\u30021\u884C\u76EE\u306F\u65E2\u5B58\u306E\u6C4E\u7528 helper \u3092\u5916\u3059\uFF09:
38
38
  git config --global credential.${origin}.helper ''
39
39
  git config --global --add credential.${origin}.helper '!twp github git-credential${args.profile!==void 0?` --profile ${args.profile}`:""}'
40
- `)}return EXIT_OK}async function runGithubGit(sub,argv,deps={}){try{return sub==="git-remote"?await runRemote(argv,deps):await runCredential(argv,deps)}catch(e){const{exitCodeFor,reportError}=await import("./run-AHV37JBZ.js");const code=exitCodeFor(e);reportError(e,null,code,deps.err??writeStderr);return code}}export{GIT_TOKEN_MARGIN_MS,GIT_USERNAME,isRelayTarget,parseCredentialInput,runGithubGit};
40
+ `)}return EXIT_OK}async function runGithubGit(sub,argv,deps={}){try{return sub==="git-remote"?await runRemote(argv,deps):await runCredential(argv,deps)}catch(e){const{exitCodeFor,reportError}=await import("./run-AZ6XEIXF.js");const code=exitCodeFor(e);reportError(e,null,code,deps.err??writeStderr);return code}}export{GIT_TOKEN_MARGIN_MS,GIT_USERNAME,isRelayTarget,parseCredentialInput,runGithubGit};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{parseCsvRecords}from"./chunk-MNPGGAKL.js";import{importRejection}from"./chunk-ERLQA262.js";import{decodeCsvText}from"./chunk-OMW6BBAY.js";import"./chunk-KMZCAOSR.js";import"./chunk-YFRU7RQJ.js";import"./chunk-O756DX6D.js";import"./chunk-PXSZZRPJ.js";import"./chunk-YLF4S4MC.js";import"./chunk-CHT6EP5C.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";
3
+ import{parseCsvRecords}from"./chunk-EHHY34NR.js";import{importRejection}from"./chunk-ERLQA262.js";import{decodeCsvText}from"./chunk-OMW6BBAY.js";import"./chunk-KMZCAOSR.js";import"./chunk-YFRU7RQJ.js";import"./chunk-O756DX6D.js";import"./chunk-PXSZZRPJ.js";import"./chunk-YLF4S4MC.js";import"./chunk-CHT6EP5C.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";
4
4
  import"./chunk-UZVBQV4W.js";import{ApiError,MultipartBody}from"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import{nonEmpty}from"./chunk-DYT22FTA.js";import{requireResolved,singleRef,withResolved}from"./chunk-7DCWZ2NF.js";import{acknowledgement,isRecord,pick}from"./chunk-HCTPCUST.js";import{ApiResponseError,UsageError}from"./chunk-STILP3Z6.js";import"./chunk-J7QYPKVK.js";
5
5
  import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var NAME="holiday";var LABEL="\u795D\u65E5";var READ_PATH="/api/v2/holidays";var ADMIN_PATH="/api/v2/admin/tenant/holidays";var DATE_RE=/^\d{4}-\d{2}-\d{2}$/;var YEAR_RE=/^\d{4}$/;var NAME_MAX=100;var IMPORT_MAX_BYTES=1024*1024;var SHOWN_DIFF=30;var COLUMNS=["date","name"];var IMPACT="\u795D\u65E5\u306F\u52E4\u6020\u306E\u96C6\u8A08\uFF08\u4F11\u65E5\u52B4\u50CD\u30FB\u6240\u5B9A\u65E5\u6570\uFF09\u3068\u55B6\u696D\u65E5\u6570\u306E\u8A08\u7B97\u306B\u52B9\u304D\u307E\u3059\u3002\u7DE0\u3081\u6E08\u307F\u306E\u6708\u306E\u795D\u65E5\u3092\u5909\u3048\u3066\u3082\u3001\u7DE0\u3081\u305F\u96C6\u8A08\u306F\u81EA\u52D5\u3067\u306F\u76F4\u308A\u307E\u305B\u3093\u3002";
6
6
  var FORBIDDEN=`\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\u3002${LABEL}\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\u30FBCSV \u306E\u51FA\u3057\u5165\u308C\u306F\u7BA1\u7406\u8005\u3060\u3051\u304C\u884C\u3048\u307E\u3059`;var DATE_FLAG={name:"--date",summary:"\u5BFE\u8C61\u306E\u65E5\u4ED8\uFF08\u4F4D\u7F6E\u5F15\u6570\u306E\u4EE3\u308F\u308A\u306B\u4F7F\u3048\u308B\uFF09",takesValue:true,placeholder:"<YYYY-MM-DD>"};var NAME_FLAG={name:"--name",summary:`\u795D\u65E5\u540D\uFF08${NAME_MAX}\
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{LICENSE_FEATURE_NAMES,judge,licenseDomain,readLicenses,releaseCommand,resolveFeature}from"./chunk-UHNQHCPW.js";import"./chunk-MNPGGAKL.js";import"./chunk-OMW6BBAY.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";
3
+ import{LICENSE_FEATURE_NAMES,judge,licenseDomain,readLicenses,releaseCommand,resolveFeature}from"./chunk-EAIDN2BE.js";import"./chunk-EHHY34NR.js";import"./chunk-OMW6BBAY.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";
4
4
  import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{LICENSE_FEATURE_NAMES,judge,licenseDomain,readLicenses,releaseCommand,resolveFeature};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{LOGIN_HISTORY_RETENTION_DAYS}from"./chunk-MNPGGAKL.js";import"./chunk-OMW6BBAY.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-DYT22FTA.js";import{requireResolved,withResolved}from"./chunk-7DCWZ2NF.js";import{isRecord,pick}from"./chunk-HCTPCUST.js";
3
+ import{LOGIN_HISTORY_RETENTION_DAYS}from"./chunk-EHHY34NR.js";import"./chunk-OMW6BBAY.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-DYT22FTA.js";import{requireResolved,withResolved}from"./chunk-7DCWZ2NF.js";import{isRecord,pick}from"./chunk-HCTPCUST.js";
4
4
  import{ApiResponseError,UsageError}from"./chunk-STILP3Z6.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u30ED\u30B0\u30A4\u30F3\u5C65\u6B74";var PATH="/api/v2/admin/tenant/login-history";var FORBIDDEN=`\u7D44\u7E54\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\u3002${LABEL}\u306F\u7D44\u7E54\u7BA1\u7406\u8005\u3060\u3051\u304C\u898B\u3089\u308C\u307E\u3059`;var RESULTS=["success","failure","locked","ip_blocked"];var MAX_LIMIT=500;var DEFAULT_LIMIT=100;var STATS_SCAN_LIMIT=1e3;var MAX_STATS_DAYS=90;var LIST_COLUMNS=["timestamp","result","email","ip_address","failure_\
5
5
  reason"];var RECORDING_HELP=`\u8A18\u9332\u306B\u3064\u3044\u3066:
6
6
  - \u5C65\u6B74\u306F${LOGIN_HISTORY_RETENTION_DAYS}\u65E5\u3067\u6D88\u3048\u307E\u3059\u3002\u305D\u308C\u3088\u308A\u524D\u306F\u51FA\u307E\u305B\u3093\uFF08\u300C\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u306A\u3044\u300D\u3068\u306F\u9650\u308A\u307E\u305B\u3093\uFF09\u3002
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{checkOutTarget}from"./chunk-XZVP3FUE.js";import"./chunk-CAJZZF7M.js";import"./chunk-LXFLA3PZ.js";import"./chunk-P4QSPSOQ.js";import{contentTypeFor,inspectLocalFile}from"./chunk-D3RGSH6B.js";import{checkUploadQuota}from"./chunk-GNSZOYBQ.js";import"./chunk-Q3B65OFC.js";import{parseWaitOptions,waitUntilTerminal}from"./chunk-3EFJQDC4.js";import"./chunk-RMFLTSOV.js";import{readBody}from"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";
3
+ import{checkOutTarget}from"./chunk-4OB22XRI.js";import"./chunk-HNW2JWHQ.js";import"./chunk-PAJAEUPA.js";import"./chunk-P4QSPSOQ.js";import{contentTypeFor,inspectLocalFile}from"./chunk-D3RGSH6B.js";import{checkUploadQuota}from"./chunk-GNSZOYBQ.js";import"./chunk-Q3B65OFC.js";import{parseWaitOptions,waitUntilTerminal}from"./chunk-3EFJQDC4.js";import"./chunk-RMFLTSOV.js";import{readBody}from"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";
4
4
  import"./chunk-BD7O73GK.js";import{repeatedValues}from"./chunk-6NHLWYI2.js";import"./chunk-UZVBQV4W.js";import{ApiError}from"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import{collapsesInUrlPath,isSafePathSegment}from"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger,readEnvelopeCursor,shellQuote}from"./chunk-DYT22FTA.js";import{requireResolved,
5
5
  singleRef,withResolved}from"./chunk-7DCWZ2NF.js";import{acknowledgement,isRecord,pick}from"./chunk-HCTPCUST.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError,WaitTimeoutError}from"./chunk-STILP3Z6.js";import"./chunk-TZL2342W.js";import"./chunk-ITFO5GPX.js";import"./chunk-GWVREACM.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-ZN7AEXEI.js";import"./chunk-OKATZ4SN.js";
6
6
  import"./chunk-RKBUJKI5.js";import"./chunk-UREA4ZIG.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import crypto2 from"crypto";import fs2 from"fs";import path from"path";var SCOPE_PERSONAL="personal";var SCOPE_PROJECT="project";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var FORBIDDEN_NAME=/[/\\:*?"<>|]/;var NAME_MAX=255;var ROW_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","updated_at"];var TRASH_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","deleted_at"];function folderRows(raw){return raw.map(row=>{const id=row["id"];const name=row["name"];const parentId=row["parent_id"];if(typeof id!==
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{outlookDomain}from"./chunk-7CVIIHMY.js";import"./chunk-43RLWH2F.js";import"./chunk-K2TO4DFJ.js";import"./chunk-Q3B65OFC.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-YJP4FUY4.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
3
+ import{outlookDomain}from"./chunk-LGRZABOT.js";import"./chunk-LJWU23D2.js";import"./chunk-K2TO4DFJ.js";import"./chunk-Q3B65OFC.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-YJP4FUY4.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
4
4
  import"./chunk-VSJBJXZO.js";export{outlookDomain};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{evaluateQuery}from"./chunk-LXFLA3PZ.js";import"./chunk-STILP3Z6.js";import"./chunk-VSJBJXZO.js";export{evaluateQuery};
3
+ import{evaluateQuery}from"./chunk-PAJAEUPA.js";import"./chunk-STILP3Z6.js";import"./chunk-VSJBJXZO.js";export{evaluateQuery};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{loadDomain}from"./chunk-CAJZZF7M.js";import"./chunk-VSJBJXZO.js";export{loadDomain};
3
+ import{loadDomain}from"./chunk-HNW2JWHQ.js";import"./chunk-VSJBJXZO.js";export{loadDomain};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-XZVP3FUE.js";import"./chunk-CAJZZF7M.js";import"./chunk-LXFLA3PZ.js";import"./chunk-P4QSPSOQ.js";import"./chunk-Q3B65OFC.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";
3
+ import{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain}from"./chunk-4OB22XRI.js";import"./chunk-HNW2JWHQ.js";import"./chunk-PAJAEUPA.js";import"./chunk-P4QSPSOQ.js";import"./chunk-Q3B65OFC.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";
4
4
  import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import"./chunk-DYT22FTA.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-TZL2342W.js";import"./chunk-ITFO5GPX.js";import"./chunk-GWVREACM.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-ZN7AEXEI.js";import"./chunk-OKATZ4SN.js";import"./chunk-RKBUJKI5.js";
5
5
  import"./chunk-UREA4ZIG.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{CURATED_PAGING_VOCABULARY,buildPrepareContext,checkOutTarget,exitCodeFor,fetchAllPages,outputValue,reportError,requiresYes,resolvePaging,runDomain};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{hasRemovableRunner,parseRunners,removeHint,runRunnerCommand}from"./chunk-KOL4P7LC.js";import"./chunk-KGKSXGX7.js";import"./chunk-BLDQ6PY3.js";import"./chunk-VRBI2NPI.js";import"./chunk-STILP3Z6.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{hasRemovableRunner,parseRunners,removeHint,runRunnerCommand};
3
+ import{hasRemovableRunner,parseRunners,removeHint,runRunnerCommand}from"./chunk-L6FXTX6Q.js";import"./chunk-KGKSXGX7.js";import"./chunk-BLDQ6PY3.js";import"./chunk-VRBI2NPI.js";import"./chunk-STILP3Z6.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{hasRemovableRunner,parseRunners,removeHint,runRunnerCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{FISCAL_YEAR_FLAG,fiscalYear,groupedSkillRows,matchSkill,parseReorderFile,parseSelfEvaluation,qualificationDomain,qualificationImportPreview,qualificationImportRows,reorderPreview,skillDomain,skillMatrix,skillNames}from"./chunk-DILKXZRD.js";import"./chunk-MNPGGAKL.js";import"./chunk-OMW6BBAY.js";import"./chunk-PXSZZRPJ.js";import"./chunk-CHT6EP5C.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";
3
+ import{FISCAL_YEAR_FLAG,fiscalYear,groupedSkillRows,matchSkill,parseReorderFile,parseSelfEvaluation,qualificationDomain,qualificationImportPreview,qualificationImportRows,reorderPreview,skillDomain,skillMatrix,skillNames}from"./chunk-DWZC3652.js";import"./chunk-EHHY34NR.js";import"./chunk-OMW6BBAY.js";import"./chunk-PXSZZRPJ.js";import"./chunk-CHT6EP5C.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";
4
4
  import"./chunk-UZVBQV4W.js";import"./chunk-SH2YLLVL.js";import"./chunk-CJFIIGSH.js";import"./chunk-HVZUXLQ4.js";import"./chunk-YJP4FUY4.js";import"./chunk-SBRTBKEZ.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-J7QYPKVK.js";import"./chunk-EDF4U5BT.js";import"./chunk-RZVI6PMW.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
5
5
  import"./chunk-VSJBJXZO.js";export{FISCAL_YEAR_FLAG,fiscalYear,groupedSkillRows,matchSkill,parseReorderFile,parseSelfEvaluation,qualificationDomain,qualificationImportPreview,qualificationImportRows,reorderPreview,skillDomain,skillMatrix,skillNames};
@@ -8,11 +8,11 @@ ${e.hint?`${e.hint}
8
8
  const res=await api.request("GET","/settings/skills");if(!res.ok){io.err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\uFF08${errorDetail(res)}\uFF09
9
9
  `);return apiExit(res)}const raw=unwrap(res,"skills")["skills"];if(!Array.isArray(raw)){io.err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\uFF08\u5FDC\u7B54\u306E\u5148\u982D: ${res.raw.slice(0,120)}\uFF09
10
10
  `);return EXIT_API_SERVER}const entries=[];for(const item of raw){const r=item&&typeof item==="object"?item:{};const name=str(r["name"]);const revision=pickNumber(r,"revision");const digest=str(r["digest"]);if(!isValidSkillName(name)||revision===null||!/^sha256:[0-9a-f]{64}$/.test(digest)){io.err(`\u26D4 \u30B9\u30AD\u30EB\u5B9A\u7FA9\u306E\u4E00\u89A7\u306B\u5951\u7D04\u5916\u306E\u8981\u7D20\u304C\u3042\u308A\u307E\u3059\uFF08${JSON.stringify(item).slice(0,160)}\uFF09
11
- `);return EXIT_API_SERVER}entries.push({name,revision,updated_by_name:str(r["updated_by_name"]),updated_at:str(r["updated_at"]),bytes:pickNumber(r,"bytes"),digest})}entries.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);const{evaluateQuery}=await import("./query-E22FS2XX.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?entries:await evaluateQuery(opts.query,entries);if(format!=="json"&&opts.query===void 0&&entries.length===0){io.err("\u30B5\u30FC\
11
+ `);return EXIT_API_SERVER}entries.push({name,revision,updated_by_name:str(r["updated_by_name"]),updated_at:str(r["updated_at"]),bytes:pickNumber(r,"bytes"),digest})}entries.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);const{evaluateQuery}=await import("./query-NHJP3NF2.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?entries:await evaluateQuery(opts.query,entries);if(format!=="json"&&opts.query===void 0&&entries.length===0){io.err("\u30B5\u30FC\
12
12
  \u30D0\u306B\u30B9\u30AD\u30EB\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08\u30EB\u30FC\u30D7\u306F\u3059\u3079\u3066\u4F5C\u696D\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30D5\u30A1\u30A4\u30EB\u7248\u3092\u4F7F\u3044\u307E\u3059\uFF09\n");return EXIT_OK}const text=renderOutput(selected,format);io.out(text.endsWith("\n")?text:`${text}
13
13
  `);return EXIT_OK}async function showSkill(api,opts,name,io){if(opts.output!==void 0&&opts.output!=="json"){throw new UsageError(`skill show \u306E --output \u306B\u300C${opts.output}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,"\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F json \u3060\u3051\u3067\u3059\uFF08\u7701\u7565\u3059\u308B\u3068\u672C\u6587\u3092\u305D\u306E\u307E\u307E\u51FA\u3057\u307E\u3059\uFF09")}const structured=opts.output==="json"||opts.query!==void 0;const current=await fetchSkill(
14
14
  api,name,io.err);if(typeof current==="number")return current;if(current===null){io.err(`\u30B5\u30FC\u30D0\u306B\u30B9\u30AD\u30EB ${name} \u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08\u30EB\u30FC\u30D7\u306F\u4F5C\u696D\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30D5\u30A1\u30A4\u30EB\u7248\u3092\u4F7F\u3044\u307E\u3059\uFF09
15
- `);return EXIT_FAILURE}if(structured){const value={name:current.name,revision:current.revision,updated_by_name:current.updatedByName,updated_at:current.updatedAt,bytes:Buffer.byteLength(current.body,"utf8"),digest:skillDigest(current.body),body:current.body};const{evaluateQuery}=await import("./query-E22FS2XX.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?value:await evaluateQuery(opts.query,value);const text=renderOutput(selected,"jso\
15
+ `);return EXIT_FAILURE}if(structured){const value={name:current.name,revision:current.revision,updated_by_name:current.updatedByName,updated_at:current.updatedAt,bytes:Buffer.byteLength(current.body,"utf8"),digest:skillDigest(current.body),body:current.body};const{evaluateQuery}=await import("./query-NHJP3NF2.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?value:await evaluateQuery(opts.query,value);const text=renderOutput(selected,"jso\
16
16
  n",true);io.out(text.endsWith("\n")?text:`${text}
17
17
  `);return EXIT_OK}if(io.isTty){warnHiddenChars(io.err,current.body,name);io.out(current.body);if(!current.body.endsWith("\n"))io.out("\n");return EXIT_OK}io.rawOut(current.body);return EXIT_OK}async function deleteSkill(api,opts,name,io){let expected;if(opts.revision!==void 0){if(!/^\d{1,15}$/.test(opts.revision)){io.err(`--revision \u306F0\u4EE5\u4E0A\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${opts.revision}
18
18
  `);return EXIT_USAGE}if(!opts.yes){io.err("--revision \u306F --yes \u3068\u4E00\u7DD2\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--yes \u306A\u3057\u3067\u306F\u524A\u9664\u3057\u307E\u305B\u3093\uFF09\n");return EXIT_USAGE}expected=opts.revision}else if(opts.yes){io.err("skill delete \u306E\u78BA\u5B9A\u306B\u306F --yes \u3068 --revision <N> \u306E\u4E21\u65B9\u304C\u5FC5\u8981\u3067\u3059\uFF08--yes \u3092\u5916\u3057\u3066\u5B9F\u884C\u3059\u308B\u3068\u3001\u6D88\u3059\u5185\u5BB9\u3068 revision \u3092\u8868\u793A\u3057\u307E\u3059\uFF09\n");
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{hasRemovableRunner,removeHint}from"./chunk-KOL4P7LC.js";import"./chunk-KGKSXGX7.js";import"./chunk-BLDQ6PY3.js";import"./chunk-VRBI2NPI.js";import{describeError,filterByStatus,pick}from"./chunk-GYX2ZXQM.js";import"./chunk-RMFLTSOV.js";import{EXIT_OK,EXIT_USAGE,UsageError}from"./chunk-STILP3Z6.js";import"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";function str(v){return typeof v==="string"&&v!==""?v:null}function num(v){return typeof v==="number"&&Number.isFinite(v)?v:null}function secondsSince(iso,now){if(iso===null)return null;const at=Date.parse(iso);if(Number.isNaN(at))return null;return Math.max(0,Math.floor((now.getTime()-at)/1e3))}async function collectStatus(api,ctx){const now=ctx.now??new Date;const runnersRes=await api.runners();let runners;if(!runnersRes.ok){runners={ok:false,error:describeError(runnersRes)}}else{const raw=pick(
3
+ import{hasRemovableRunner,removeHint}from"./chunk-L6FXTX6Q.js";import"./chunk-KGKSXGX7.js";import"./chunk-BLDQ6PY3.js";import"./chunk-VRBI2NPI.js";import{describeError,filterByStatus,pick}from"./chunk-GYX2ZXQM.js";import"./chunk-RMFLTSOV.js";import{EXIT_OK,EXIT_USAGE,UsageError}from"./chunk-STILP3Z6.js";import"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";function str(v){return typeof v==="string"&&v!==""?v:null}function num(v){return typeof v==="number"&&Number.isFinite(v)?v:null}function secondsSince(iso,now){if(iso===null)return null;const at=Date.parse(iso);if(Number.isNaN(at))return null;return Math.max(0,Math.floor((now.getTime()-at)/1e3))}async function collectStatus(api,ctx){const now=ctx.now??new Date;const runnersRes=await api.runners();let runners;if(!runnersRes.ok){runners={ok:false,error:describeError(runnersRes)}}else{const raw=pick(
4
4
  runnersRes.json,"runners");const list=Array.isArray(raw)?raw:[];runners={ok:true,live_count:num(pick(runnersRes.json,"live_count")),max_runners:num(pick(runnersRes.json,"max_runners")),heartbeat_timeout:num(pick(runnersRes.json,"heartbeat_timeout")),items:list.map(r=>{const lastSeen=str(r?.["last_seen_at"]);return{runner_id:str(r?.["runner_id"]),is_live:r?.["is_live"]===true,is_reporting:r?.["is_reporting"]===true,is_waiting:r?.["is_waiting"]===true,next_run_at:str(r?.["next_run_at"]),kind:str(r?.["\
5
5
  kind"]),phase:str(r?.["phase"]),current_item_id:str(r?.["current_item_id"]),hostname:str(r?.["hostname"]),last_seen_at:lastSeen,seconds_since_last_seen:secondsSince(lastSeen,now)}})}}const queue={};for(const status of["pending","processing"]){const res=await api.list({status,limit:100});if(!res.ok){queue[status]={ok:false,error:describeError(res)};continue}const items=pick(res.json,"items");const more=pick(res.json,"has_more")===true||pick(res.json,"pagination.has_more")===true;const counted=Array.
6
6
  isArray(items)?filterByStatus(items,status).length:null;queue[status]={ok:true,count:counted,has_more:more}}const state=await api.request("GET","/state");const plan_lock=state.ok?{held:pick(state.json,"state.planning")===true,owner_runner_id:str(pick(state.json,"state.plan_owner_runner_id")),expires_at:str(pick(state.json,"state.plan_lock_expires_at"))}:null;return{project:{ref:ctx.projectRef,id:ctx.projectId},api_url:ctx.apiUrl,runners,queue,plan_lock,local_lock:{held:ctx.lockHeld,path:ctx.lockPath}}}
@@ -11,7 +11,7 @@ live_count??"?"} / ${r.max_runners??"?"} \u7A3C\u50CD\uFF08\u6B7B\u6D3B\u3057\u3
11
11
  / \u671F\u9650 ${pl.expires_at??"?"}\uFF09`:"\u7A7A\u304D"}`)}lines.push("",`\u30ED\u30FC\u30AB\u30EB\u30ED\u30C3\u30AF: ${report.local_lock.held?`\u4FDD\u6301\u4E2D\uFF08${report.local_lock.path}\uFF09`:"\u7121\u3057"}`);return`${lines.join("\n")}
12
12
  `}async function runStatusCommand(api,ctx,opts,io){if(opts.output!==void 0&&opts.output!=="json"){io.err(`task-loop status \u306E --output \u306B\u300C${opts.output}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093
13
13
  \u6307\u5B9A\u3067\u304D\u308B\u306E\u306F json \u3060\u3051\u3067\u3059\uFF08\u7701\u7565\u3059\u308B\u3068\u4EBA\u5411\u3051\u306E\u6587\u9762\u3092\u51FA\u3057\u307E\u3059\uFF09
14
- `);return EXIT_USAGE}if(opts.query!==void 0&&opts.query.trim()===""){io.err("--query \u306B\u7A7A\u306E\u5F0F\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\n");return EXIT_USAGE}const report=await collectStatus(api,ctx);if(opts.output===void 0&&opts.query===void 0){io.out(stripTerminalControls(renderStatusText(report,{profile:ctx.profile})));return EXIT_OK}const{evaluateQuery}=await import("./query-E22FS2XX.js");const{renderOutput}=await import("./render-I6U5PEYR.js");let selected=report;
14
+ `);return EXIT_USAGE}if(opts.query!==void 0&&opts.query.trim()===""){io.err("--query \u306B\u7A7A\u306E\u5F0F\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\n");return EXIT_USAGE}const report=await collectStatus(api,ctx);if(opts.output===void 0&&opts.query===void 0){io.out(stripTerminalControls(renderStatusText(report,{profile:ctx.profile})));return EXIT_OK}const{evaluateQuery}=await import("./query-NHJP3NF2.js");const{renderOutput}=await import("./render-I6U5PEYR.js");let selected=report;
15
15
  if(opts.query!==void 0){try{selected=await evaluateQuery(opts.query,report)}catch(e){if(e instanceof UsageError){io.err(`${e.message}
16
16
  `);return EXIT_USAGE}throw e}}const text=renderOutput(selected,"json");io.out(text.endsWith("\n")?text:`${text}
17
17
  `);return EXIT_OK}function runnerStateLabel(x){if(x.is_live)return"live";if(x.is_waiting)return x.next_run_at===null?"waiting":`waiting \u6B21\u56DE ${formatLocalTime(x.next_run_at)}`;return"stale"}export{collectStatus,formatElapsed,formatLocalTime,renderStatusText,runStatusCommand};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{teamsDomain}from"./chunk-R76JZIZ5.js";import"./chunk-43RLWH2F.js";import"./chunk-K2TO4DFJ.js";import"./chunk-Q3B65OFC.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-YJP4FUY4.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
3
+ import{teamsDomain}from"./chunk-ROAZEXMJ.js";import"./chunk-LJWU23D2.js";import"./chunk-K2TO4DFJ.js";import"./chunk-Q3B65OFC.js";import"./chunk-V5WDGX4S.js";import"./chunk-W4NLJ2YK.js";import"./chunk-BD7O73GK.js";import"./chunk-6NHLWYI2.js";import"./chunk-YJP4FUY4.js";import"./chunk-DYT22FTA.js";import"./chunk-7DCWZ2NF.js";import"./chunk-HCTPCUST.js";import"./chunk-STILP3Z6.js";import"./chunk-OKATZ4SN.js";import"./chunk-NHYMHCAT.js";
4
4
  import"./chunk-VSJBJXZO.js";export{teamsDomain};
@@ -4,7 +4,7 @@ import{stableJson}from"./chunk-FDECUPTW.js";import{reasonOf,unwrap}from"./chunk-
4
4
  deps.api,opts,io);case"show":return await show(deps.api,opts,io);case"push":return await push(deps.api,opts,io);case"delete":return await remove(deps.api,opts,io);case"history":return await history(deps.api,opts,io);case"release":return await release(deps.api,opts,io)}}catch(e){if(e instanceof UsageError){io.err(`${e.message}
5
5
  ${e.hint?`${e.hint}
6
6
  `:""}`);return EXIT_USAGE}throw e}}async function formatOf(opts,io){const{resolveOutputFormat}=await import("./format-X65HXAAU.js");const format=resolveOutputFormat({...opts.output!==void 0?{flag:opts.output}:{},isTty:io.isTty});if(format===null||!FORMATS.includes(format)){throw new UsageError(`trigger ${opts.op} \u306E --output \u306B\u300C${opts.output??""}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F ${FORMATS.join(" / ")} \u3067\u3059`)}
7
- return format}async function emit(value,opts,format,io){const{evaluateQuery}=await import("./query-E22FS2XX.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?value:await evaluateQuery(opts.query,value);const text2=renderOutput(selected,format);io.out(text2.endsWith("\n")?text2:`${text2}
7
+ return format}async function emit(value,opts,format,io){const{evaluateQuery}=await import("./query-NHJP3NF2.js");const{renderOutput}=await import("./render-I6U5PEYR.js");const selected=opts.query===void 0?value:await evaluateQuery(opts.query,value);const text2=renderOutput(selected,format);io.out(text2.endsWith("\n")?text2:`${text2}
8
8
  `)}async function list(api,opts,io){const format=await formatOf(opts,io);const triggers=await fetchTriggers(api,io.err);if(typeof triggers==="number")return triggers;const sorted=[...triggers].sort((a,b)=>str(a["id"]).localeCompare(str(b["id"])));if(format==="json"){await emit(sorted,opts,format,io);return EXIT_OK}io.err(`\u6761\u4EF6\u30C8\u30EA\u30AC\u30FC ${sorted.length} \u4EF6
9
9
  `);if(opts.query===void 0&&sorted.length===0)return EXIT_OK;await emit(sorted.map(summaryRow),opts,format,io);return EXIT_OK}function summaryRow(t){const match=obj(t["match"]);const threshold=obj(t["threshold"]);const action=obj(t["action"]);const skills=Array.isArray(match["skills"])?match["skills"].map(String).join(","):"";const codes=Array.isArray(match["outcome_codes"])?match["outcome_codes"].map(String).join(","):"";return{id:str(t["id"]),enabled:t["enabled"]===false?"\u7121\u52B9":"\u6709\u52B9",
10
10
  name:str(t["name"]),skills,outcome_codes:codes,condition:`${text(threshold["count"])}\u56DE/${text(threshold["window_hours"])}h${match["require_state_unchanged"]===false?"":"\u30FB\u72B6\u614B\u4E0D\u5909"}`,action:`${str(action["skill"])}${str(action["args"])!==""?` ${str(action["args"])}`:""}\uFF08${str(action["priority"])}\uFF09`,block_source:action["block_source"]===true?"\u3042\u308A":"\u306A\u3057",revision:t["revision"]??""}}async function show(api,opts,io){const id=requireId(opts);const format=await formatOf(