@tocca-systems/twp-cli 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.public.md +16 -0
- package/README.md +60 -5
- package/dist/{agent-loop-MMWJHN3D.js → agent-loop-RMJXHBNG.js} +1 -1
- package/dist/{ai-dispatch-FEDOAV2E.js → ai-dispatch-L6XZCCU4.js} +2 -2
- package/dist/{api-command-OIXWF72C.js → api-command-67456PBS.js} +8 -7
- package/dist/{app-6VL7WWT3.js → app-7227DY7N.js} +5 -5
- package/dist/{backlog-R3M54DPM.js → backlog-XZB35X7I.js} +1 -1
- package/dist/budget-FOFE3YUJ.js +97 -0
- package/dist/chunk-3AD2T6L2.js +64 -0
- package/dist/{chunk-4MTEXWYQ.js → chunk-3WHD2YVF.js} +16 -13
- package/dist/{chunk-AJIHNSXI.js → chunk-4OSCQLZT.js} +1 -1
- package/dist/{chunk-R4MOGEGN.js → chunk-AKPVALTZ.js} +1 -1
- package/dist/{chunk-O5AUX7AQ.js → chunk-AUAZP2G7.js} +5 -4
- package/dist/chunk-B4APKONL.js +9 -0
- package/dist/{chunk-FCISZHMZ.js → chunk-EZMXGIGX.js} +1 -1
- package/dist/{chunk-OKIENL5P.js → chunk-HS7EKE7M.js} +1 -1
- package/dist/{chunk-FUH3J5VB.js → chunk-JYNZEZYL.js} +1 -1
- package/dist/{chunk-EZ3RJBN6.js → chunk-L7IGGC7H.js} +1 -1
- package/dist/{chunk-UTIZTCAP.js → chunk-LKS7GANP.js} +1 -1
- package/dist/{chunk-OUP3JLVH.js → chunk-MXKAEPXA.js} +1 -1
- package/dist/{chunk-ERQT4AMC.js → chunk-OLBRIPOS.js} +1 -1
- package/dist/{chunk-2ZTJP74M.js → chunk-OVBKORPC.js} +1 -1
- package/dist/chunk-Q3B65OFC.js +3 -0
- package/dist/{chunk-3UW33UZI.js → chunk-QVZGNHRE.js} +1 -1
- package/dist/{chunk-SSYA2LNP.js → chunk-RMAW7KOR.js} +19 -17
- package/dist/{chunk-JC5HZGPD.js → chunk-SBWCQAHT.js} +1 -1
- package/dist/{chunk-R5KWKK5Z.js → chunk-V24LKF3V.js} +1 -1
- package/dist/{chunk-G2TBGGER.js → chunk-VMULCEHY.js} +1 -1
- package/dist/chunk-Y5EN7RYN.js +4 -0
- package/dist/{chunk-NIZXUROF.js → chunk-ZE75ZDLD.js} +1 -1
- package/dist/{chunk-QEWI75KI.js → chunk-ZM3MTWNT.js} +1 -1
- package/dist/cli.js +48 -9
- package/dist/{commands-DUFVGY5V.js → commands-5GP3REIU.js} +12 -12
- package/dist/{commands-255HOMWQ.js → commands-SWR442MR.js} +1 -1
- package/dist/{company-46SIKR43.js → company-FEXAHUPT.js} +3 -3
- package/dist/{completion-4EIFB6JN.js → completion-YSP6UE25.js} +1 -1
- package/dist/{contract-NDED7WTP.js → contract-4RALZBO5.js} +2 -2
- package/dist/{department-GLIMOUQM.js → department-VEXXWBZ4.js} +1 -1
- package/dist/{deposit-U6O52S6F.js → deposit-2AAST2DE.js} +2 -2
- package/dist/{estimate-DALQK4M5.js → estimate-JQURFOCH.js} +4 -4
- package/dist/{inquiry-QFW33SDT.js → inquiry-YTYZYUTY.js} +1 -1
- package/dist/{invoice-OO6EPZAZ.js → invoice-PHYBVU6Q.js} +3 -3
- package/dist/{job-title-WA6FRUL6.js → job-title-ORNY7A7L.js} +1 -1
- package/dist/{knowledge-3IT2MBRG.js → knowledge-FQ32UNDW.js} +2 -2
- package/dist/{leave-YYKSAXHD.js → leave-5V6EPGA3.js} +2 -2
- package/dist/{media-JMVFUWIM.js → media-BU23L547.js} +1 -1
- package/dist/{notification-5KPTSLO6.js → notification-XARS6JH2.js} +1 -1
- package/dist/onedrive-N4T6D2OW.js +47 -0
- package/dist/{oneshot-GXXMSQ4Y.js → oneshot-7BFL2VON.js} +1 -1
- package/dist/outlook-LY6WBXIJ.js +94 -0
- package/dist/{position-PCVPUJZQ.js → position-NNJZAT3A.js} +1 -1
- package/dist/{project-3WW2PW3O.js → project-FDY6LETQ.js} +2 -2
- package/dist/{prospect-6RF45LPK.js → prospect-CUWP3E5S.js} +3 -3
- package/dist/{purchase-TTKRSNCF.js → purchase-2CZTB5H7.js} +3 -3
- package/dist/{receivable-H6GMZ6JQ.js → receivable-KV5PPNLA.js} +2 -2
- package/dist/{registry-7OIXAAIO.js → registry-NZ2HNT52.js} +1 -1
- package/dist/{render-ASQBZ75M.js → render-R5QZ46GF.js} +1 -1
- package/dist/{report-OEETO2S5.js → report-PCQPTRUV.js} +1 -1
- package/dist/run-7BS34D2P.js +4 -0
- package/dist/{sales-ai-review-MXMECYDW.js → sales-ai-review-SVZHVH5P.js} +2 -2
- package/dist/{sales-master-PFGXXJFP.js → sales-master-VD6JE2P3.js} +3 -3
- package/dist/sales-numbering-P7W6N3OM.js +4 -0
- package/dist/{server-settings-326MD7T4.js → server-settings-3E7G56G7.js} +1 -1
- package/dist/{supplier-payment-FRHPIV4D.js → supplier-payment-2KPCVEPH.js} +3 -3
- package/dist/{task-XTTCYGDC.js → task-MFWWP5Q7.js} +3 -3
- package/dist/teams-DRHXPLWN.js +93 -0
- package/dist/{user-3J4CZ4LO.js → user-QG3KMK3T.js} +3 -3
- package/dist/{workflow-3M2KCVYI.js → workflow-CSYU4J4U.js} +1 -1
- package/package.json +2 -2
- package/dist/chunk-34X4JXND.js +0 -4
- package/dist/chunk-YPNMQCVG.js +0 -9
- package/dist/onedrive-XAFONTRT.js +0 -16
- package/dist/outlook-KVMKMFUE.js +0 -37
- package/dist/run-KVDDYJ6W.js +0 -4
- package/dist/sales-numbering-KR2L3FQA.js +0 -4
- package/dist/teams-RDBKQJMM.js +0 -50
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{JsonBodyWithView}from"./chunk-Q3B65OFC.js";import{emailText,ms365Forbidden,recipientsText,str}from"./chunk-QICH2OOI.js";import{readBody}from"./chunk-ORUDW52G.js";import{assertMs365PathSegment,ms365Path,ms365Segment}from"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import fs from"fs";import path from"path";var BODY_MAX_CHARS=1e5;var ATTACH_TOTAL_MAX_BYTES=3*1024*1024;var ADDRESS=/^[^\s@,;<>"]+@[^\s@,;<>"]+$/;var INVISIBLE=/[\p{Cc}\p{Cf}]/u;function oneLine(value){return value.replace(/[\r\n\t]+/g," ").replace(/[\p{Cc}\p{Cf}]/gu,"")}var TO_FLAG={name:"--to",summary:"\u5B9B\u5148\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u5FC5\u9808\u3002\u8907\u6570\u306A\u3089\u7E70\u308A\u8FD4\u3059\uFF09",takesValue:true,placeholder:"<\u30A2\u30C9\u30EC\u30B9>",repeatable:true};var CC_FLAG={name:"--c\
|
|
4
|
+
c",summary:"Cc \u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u8907\u6570\u306A\u3089\u7E70\u308A\u8FD4\u3059\uFF09",takesValue:true,placeholder:"<\u30A2\u30C9\u30EC\u30B9>",repeatable:true};var BODY_FILE_FLAG={name:"--body-file",summary:"\u672C\u6587\u3092\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u8AAD\u3080\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9|->"};var BODY_FLAG={name:"--body",summary:"\u672C\u6587\u3092\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u4E00\u884C\u5411\u3051\u3002--body-file \u3068\u306E\u4F75\u7528\u306F\u30A8\u30E9\u30FC\uFF09",
|
|
5
|
+
takesValue:true,placeholder:"<\u6587\u5B57\u5217>"};var HTML_FLAG={name:"--html",summary:"\u672C\u6587\u3092 HTML \u3068\u3057\u3066\u9001\u308B\uFF08\u65E2\u5B9A\u306F\u30C6\u30AD\u30B9\u30C8\uFF09",takesValue:false};var MESSAGE_FLAG={name:"--message",summary:"\u5143\u306E\u30E1\u30FC\u30EBID\uFF08\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF09",takesValue:true,placeholder:"<ID>"};var EXTERNAL_SEND_HELP="\u26A0 \u5916\u90E8\u3078\u51FA\u308B\u64CD\u4F5C\u3067\u3059\u3002\u5B9F\u884C\u3057\u305F\u77AC\u9593\u306B\u76F8\u624B\u306E\u53D7\u4FE1\u7BB1\u3078\u5C4A\u304D\u3001\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002\n --yes \u304C\u7121\u3051\u308C\u3070\u5B9F\u884C\u3057\u307E\u305B\u3093\u3002--dry-run \u3067\u9001\u308B\u5185\u5BB9\uFF08\u5B9B\u5148\u30FB\u4EF6\
|
|
6
|
+
\u540D\u30FB\u672C\u6587\u30FB\u6DFB\u4ED8\u306E\u540D\u524D\u3068\u5927\u304D\u3055\uFF09\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\n --yes \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08--dry-run \u306F --yes \u3092\u8981\u308A\u307E\u305B\u3093\uFF09\u3002\n\u26A0 \u7D42\u4E86\u30B3\u30FC\u30C9 4\uFF08\u901A\u4FE1\u306E\u5931\u6557\u30FB\u30B5\u30FC\u30D0\u306E\u4E00\u6642\u30A8\u30E9\u30FC\uFF09\u3067\u3082\u3001Microsoft 365 \u5074\u3067\u306F\u9001\u4FE1\u6E08\u307F\u306E\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002\n \u6253\u3061\u76F4\u3059\u524D\u306B twp outlook mail list --folder sentitems \u3067\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
7
|
+
var BODY_HELP="\u672C\u6587\u306F --body-file <\u30D1\u30B9>\uFF08- \u3067\u6A19\u6E96\u5165\u529B\uFF09\u304B --body <\u6587\u5B57\u5217> \u3067\u6E21\u3057\u307E\u3059\u3002\u6539\u884C\u3084\u8A18\u53F7\u3092\u542B\u3080\u672C\u6587\u306F\n--body-file \u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\uFF08\u30B7\u30A7\u30EB\u306E\u5F15\u6570\u306B\u8F09\u305B\u308B\u3068\u58CA\u308C\u307E\u3059\uFF09\u3002";function addresses(input,flag){return repeatedValues(input,flag).map(raw=>{const value=raw.
|
|
8
|
+
trim();if(!ADDRESS.test(value)||INVISIBLE.test(value)){throw new UsageError(`${flag} \u306B\u306F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30921\u3064\u305A\u3064\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${raw}\uFF09`,`\u540D\u524D\u304B\u3089\u306F\u5B9B\u5148\u3092\u63A2\u3057\u307E\u305B\u3093\u3002\u8907\u6570\u306E\u5B9B\u5148\u306F ${flag} \u3092\u7E70\u308A\u8FD4\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: ${flag} a@example.com ${flag}\
|
|
9
|
+
b@example.com\uFF09\u3002`)}return value})}function recipients(list){return list.map(address=>({emailAddress:{address}}))}function textToHtml(text){return text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\t/g," ").replace(/ {2,}/g,run=>` ${" ".repeat(run.length-1)}`).replace(/(^|\r\n|\r|\n) /g,"$1 ").replace(/\r\n|\r|\n/g,"<br>\n")}var CONTENT_TYPES={".pdf":"application/pdf",".csv":"text/csv",".txt":"text/plain",
|
|
10
|
+
".md":"text/markdown",".json":"application/json",".xml":"application/xml",".html":"text/html",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".zip":"application/zip",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".xls":"application/vnd.ms-excel",".d\
|
|
11
|
+
oc":"application/msword",".ppt":"application/vnd.ms-powerpoint"};function readAttachments(input){const files=repeatedValues(input,"--attach");const opened=[];try{let total=0;for(const file of files){let fd;try{fd=fs.openSync(file,"r")}catch(err){const reason=err.code??err.message;throw new UsageError(`--attach \u306E\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${file}\uFF08${reason}\uFF09`)}const stat=fs.fstatSync(fd);opened.push({file,fd,size:stat.size});if(!stat.isFile())throw new UsageError(
|
|
12
|
+
`--attach \u306B\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u4EE5\u5916\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: ${file}`);total+=stat.size}if(total>ATTACH_TOTAL_MAX_BYTES)throw tooLarge(total);let read=0;const attachments=opened.map(({file,fd})=>{const bytes=fs.readFileSync(fd);read+=bytes.byteLength;const name=path.basename(file);const contentType=CONTENT_TYPES[path.extname(name).toLowerCase()];return{name,path:path.resolve(file),bytes:bytes.byteLength,contentBytes:bytes.toString("base6\
|
|
13
|
+
4"),...contentType===void 0?{}:{contentType}}});if(read>ATTACH_TOTAL_MAX_BYTES)throw tooLarge(read);return attachments}finally{for(const{fd}of opened)fs.closeSync(fd)}}function tooLarge(total){return new UsageError(`\u6DFB\u4ED8\u306E\u5408\u8A08\u304C\u5927\u304D\u3059\u304E\u307E\u3059\uFF08${total} \u30D0\u30A4\u30C8\u30FB\u4E0A\u9650 ${ATTACH_TOTAL_MAX_BYTES} \u30D0\u30A4\u30C8\uFF09`,"Microsoft 365 \u306F\u30E1\u30FC\u30EB\u306B\u76F4\u63A5\u8F09\u305B\u308B\u6DFB\u4ED8\u3092 3MB \u672A\u6E80\u307E\u3067\u3068\u3057\u3066\u3044\u307E\u3059\u3002\u5927\u304D\u3044\u30D5\u30A1\u30A4\u30EB\u306F OneDrive \u306B\u7F6E\u3044\u3066\u5171\u6709\u30EA\u30F3\u30AF\u3092\u672C\u6587\u306B\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
14
|
+
function assertSent(body,label){if(!isRecord(body)||body["result"]!==true){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u304C\u60F3\u5B9A\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08result \u304C true \u3067\u306F\u306A\u3044\uFF09\u3002\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return body}function sentSummary(body,label){assertSent(body,label);return{sent:true}}function resolvedJson(input,key){return JSON.
|
|
15
|
+
parse(requireResolved(input,key))}function bodySummary(text,html){if(text===void 0)return"\u672C\u6587: \u306A\u3057";return`\u672C\u6587: ${html?"HTML":"\u30C6\u30AD\u30B9\u30C8"} ${[...text].length} \u6587\u5B57`}function messageId(input,op){return assertMs365PathSegment(singleRef(input,{flag:"--message",label:"\u5143\u306E\u30E1\u30FC\u30EBID",usage:`twp outlook mail ${op} help`}),"\u5143\u306E\u30E1\u30FC\u30EBID")}function replyAudience(message,all){const replyTo=recipientsText(message["rep\
|
|
16
|
+
lyTo"]);const from=replyTo??emailText(message["from"])??"\uFF08\u5DEE\u51FA\u4EBA\u3092\u8AAD\u3081\u307E\u305B\u3093\uFF09";if(!all)return oneLine(`To ${from}`);const to=recipientsText(message["toRecipients"]);const cc=recipientsText(message["ccRecipients"]);return oneLine([`To ${from}${to===null?"":`\u3001${to}`}`,cc===null?null:`Cc ${cc}`].filter(v=>v!==null).join(" / ")+"\uFF08\u81EA\u5206\u81EA\u8EAB\u306F Microsoft 365 \u304C\u9664\u304D\u307E\u3059\uFF09")}var send={name:"send",summary:"\u30E1\
|
|
17
|
+
\u30FC\u30EB\u3092\u65B0\u3057\u304F\u9001\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09",usage:"twp outlook mail send --to <\u30A2\u30C9\u30EC\u30B9> [--to \u2026] [--cc <\u30A2\u30C9\u30EC\u30B9> \u2026] --subject <\u4EF6\u540D> (--body-file <\u30D1\u30B9> | --body <\u6587\u5B57\u5217>) [--html] [--attach <\u30D1\u30B9> \u2026] --yes",description:`${EXTERNAL_SEND_HELP}
|
|
18
|
+
|
|
19
|
+
\u5B9B\u5148\u306F --to / --cc \u306B\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u6307\u5B9A\u3057\u307E\u3059\uFF08\u540D\u524D\u304B\u3089\u306F\u63A2\u3057\u307E\u305B\u3093\uFF09\u3002\u8907\u6570\u306A\u3089\u30D5\u30E9\u30B0\u3092\u7E70\u308A\u8FD4\u3057\u307E\u3059\u3002
|
|
20
|
+
Bcc \u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\uFF08Microsoft 365 \u306E\u4E2D\u7D99\u304C\u53D7\u3051\u4ED8\u3051\u306A\u3044\u305F\u3081\uFF09\u3002
|
|
21
|
+
|
|
22
|
+
${BODY_HELP}
|
|
23
|
+
\u672C\u6587\u306F\u65E2\u5B9A\u3067\u30C6\u30AD\u30B9\u30C8\u3068\u3057\u3066\u9001\u308A\u307E\u3059\uFF08\u9014\u4E2D\u306E\u6539\u884C\u306F\u6B8B\u308A\u307E\u3059\u3002\u5148\u982D\u3068\u672B\u5C3E\u306E\u7A7A\u767D\u30FB\u6539\u884C\u306F\u30B5\u30FC\u30D0\u5074\u3067\u843D\u3061\u307E\u3059\uFF09\u3002
|
|
24
|
+
--html \u3092\u4ED8\u3051\u308B\u3068 HTML \u3068\u3057\u3066\u9001\u308A\u307E\u3059\u3002
|
|
25
|
+
|
|
26
|
+
--attach <\u30D1\u30B9> \u3067\u30D5\u30A1\u30A4\u30EB\u3092\u6DFB\u4ED8\u3067\u304D\u307E\u3059\uFF08\u7E70\u308A\u8FD4\u3057\u3066\u8907\u6570\uFF09\u3002\u5408\u8A08\u306F 3MB\uFF083,145,728 \u30D0\u30A4\u30C8\uFF09\u307E\u3067\u3067\u3059
|
|
27
|
+
\uFF08Microsoft 365 \u304C\u30E1\u30FC\u30EB\u306B\u76F4\u63A5\u8F09\u305B\u3089\u308C\u308B\u4E0A\u9650\uFF09\u3002\u76F8\u624B\u306B\u898B\u3048\u308B\u30D5\u30A1\u30A4\u30EB\u540D\u306F\u30D1\u30B9\u306E\u672B\u5C3E\u3060\u3051\u3067\u3059\u3002
|
|
28
|
+
--dry-run \u3067\u306F\u6DFB\u4ED8\u306E\u4E2D\u8EAB\u3092\u51FA\u3055\u305A\u3001\u540D\u524D\u3068\u5927\u304D\u3055\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\u3002
|
|
29
|
+
|
|
30
|
+
\u9001\u3063\u305F\u30E1\u30FC\u30EB\u306F\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\u306B\u6B8B\u308A\u307E\u3059\uFF08twp outlook mail list --folder sentitems\uFF09\u3002`,destructive:true,confirmation:"\u5916\u90E8\u3078\u30E1\u30FC\u30EB\u3092\u9001\u308B\u64CD\u4F5C\uFF08\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\uFF09",flags:[TO_FLAG,CC_FLAG,{name:"--subject",summary:"\u4EF6\u540D\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u4EF6\u540D>"},BODY_FILE_FLAG,BODY_FLAG,HTML_FLAG,
|
|
31
|
+
{name:"--attach",summary:"\u6DFB\u4ED8\u3059\u308B\u30D5\u30A1\u30A4\u30EB\uFF08\u8907\u6570\u306A\u3089\u7E70\u308A\u8FD4\u3059\u30FB\u5408\u8A08 3MB \u307E\u3067\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>",repeatable:true}],forbidden:ms365Forbidden,async prepare(input){const usage="twp outlook mail send help";if(input.args.length>0)throw new UsageError(`\u4F4D\u7F6E\u5F15\u6570\u306F\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093: ${input.args.join(" ")}`,usage);const to=addresses(input,"--\
|
|
32
|
+
to");if(to.length===0)throw new UsageError("\u5B9B\u5148\uFF08--to\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);const cc=addresses(input,"--cc");const subject=input.flags.get("--subject");if(subject===void 0||subject.trim()==="")throw new UsageError("\u4EF6\u540D\uFF08--subject\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);const attachments=readAttachments(input);const body=await readBody(input,{flag:"--body",fileFlag:"--body-file",label:"\u30E1\u30FC\u30EB\u672C\u6587",
|
|
33
|
+
maxChars:BODY_MAX_CHARS,usage});if(body===void 0)throw new UsageError("\u672C\u6587\uFF08--body-file \u304B --body\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);return withResolved(input,{to:JSON.stringify(to),cc:JSON.stringify(cc),subject,body,attachments:JSON.stringify(attachments)})},plan(input){const to=resolvedJson(input,"to");const cc=resolvedJson(input,"cc");const attachments=resolvedJson(input,"attachments");const base={subject:requireResolved(input,"subject"),body:{
|
|
34
|
+
contentType:input.flags.has("--html")?"HTML":"Text",content:requireResolved(input,"body")},toRecipients:recipients(to),...cc.length>0?{ccRecipients:recipients(cc)}:{}};if(attachments.length===0)return{method:"POST",path:ms365Path("/outlook/sendMail"),body:base};const file=(a,contentBytes)=>({"@odata.type":"#microsoft.graph.fileAttachment",name:a.name,...a.contentType===void 0?{}:{contentType:a.contentType},contentBytes});return{method:"POST",path:ms365Path("/outlook/sendMail"),body:new JsonBodyWithView(
|
|
35
|
+
{...base,attachments:attachments.map(a=>file(a,a.contentBytes))},{...base,attachments:attachments.map(a=>file(a,`\uFF08base64\u30FB\u5143 ${a.bytes} \u30D0\u30A4\u30C8\u30FB\u8868\u793A\u3057\u306A\u3044\uFF09`))})}},plannedNotes(input){const to=resolvedJson(input,"to");const cc=resolvedJson(input,"cc");const attachments=resolvedJson(input,"attachments");return[`\u9001\u4FE1\u5185\u5BB9: To ${to.join("\u3001")}${cc.length>0?` / Cc ${cc.join("\u3001")}`:""} / \u4EF6\u540D\u300C${requireResolved(input,
|
|
36
|
+
"subject")}\u300D / ${bodySummary(requireResolved(input,"body"),input.flags.has("--html"))} / \u6DFB\u4ED8: ${attachments.length===0?"\u306A\u3057":attachments.map(a=>`${a.name}\uFF08${a.bytes} \u30D0\u30A4\u30C8\u30FB${a.path}\uFF09`).join("\u3001")}`]},summarize:body=>sentSummary(body,"\u30E1\u30FC\u30EB\u9001\u4FE1"),raw:body=>assertSent(body,"\u30E1\u30FC\u30EB\u9001\u4FE1"),notes:()=>["\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\uFF08twp outlook mail list --folder sentitems\uFF09\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002"]};
|
|
37
|
+
function replyOperation(all){const op=all?"reply-all":"reply";const endpoint=all?"replyAll":"reply";const label=all?"\u5168\u54E1\u8FD4\u4FE1":"\u8FD4\u4FE1";return{name:op,summary:all?"\u30E1\u30FC\u30EB\u306B\u5168\u54E1\u8FD4\u4FE1\u3059\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09":"\u30E1\u30FC\u30EB\u306E\u5DEE\u51FA\u4EBA\u306B\u8FD4\u4FE1\u3059\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09",usage:`twp outlook mail ${op} <\u30E1\u30FC\u30EBID> (--body-file <\u30D1\u30B9> | --body <\u6587\u5B57\u5217>) [--html] --yes`,
|
|
38
|
+
description:`${EXTERNAL_SEND_HELP}
|
|
39
|
+
|
|
40
|
+
`+(all?"\u5143\u306E\u30E1\u30FC\u30EB\u306E\u5DEE\u51FA\u4EBA\u3068\u3001To\u30FBCc \u306E\u5168\u54E1\u306B\u8FD4\u4FE1\u3057\u307E\u3059\uFF08\u81EA\u5206\u81EA\u8EAB\u306F Microsoft 365 \u304C\u9664\u304D\u307E\u3059\uFF09\u3002\n":"\u5143\u306E\u30E1\u30FC\u30EB\u306E\u5DEE\u51FA\u4EBA\uFF08\u8FD4\u4FE1\u5148\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308C\u3070\u305D\u306E\u76F8\u624B\uFF09\u306B\u8FD4\u4FE1\u3057\u307E\u3059\u3002\n")+`\u5B9B\u5148\u306F Microsoft 365 \u304C\u5143\u306E\u30E1\u30FC\u30EB\u304B\u3089\u6C7A\u3081\u307E\u3059\u3002\u9001\u308B\u524D\u306B\u5143\u306E\u30E1\u30FC\u30EB\u3092\u8AAD\u307F\u3001\u5C4A\u304F\u76F8\u624B\u306E\u76EE\u5B89\u3092\u8868\
|
|
41
|
+
\u793A\u3057\u307E\u3059
|
|
42
|
+
\uFF08--dry-run \u3067\u3082\u8868\u793A\u3057\u307E\u3059\uFF09\u3002\u5B9B\u5148\u30FBCc \u3092\u8DB3\u3059\u3053\u3068\u3001\u6DFB\u4ED8\u3092\u4ED8\u3051\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
|
|
43
|
+
\u30E1\u30FC\u30EBID \u306F twp outlook mail list \u306E id \u3067\u3059\u3002
|
|
44
|
+
|
|
45
|
+
${BODY_HELP}
|
|
46
|
+
\u672C\u6587\u306F\u5143\u306E\u30E1\u30FC\u30EB\u306E\u4E0A\u306B\u5DEE\u3057\u8FBC\u307E\u308C\u307E\u3059\u3002Microsoft 365 \u306F\u672C\u6587\u3092 HTML \u3068\u3057\u3066\u8AAD\u3080\u306E\u3067\u3001\u65E2\u5B9A\uFF08\u30C6\u30AD\u30B9\u30C8\uFF09\u3067\u306F
|
|
47
|
+
\u6539\u884C\u3068\u8A18\u53F7\u304C\u898B\u305F\u3068\u304A\u308A\u306B\u5C4A\u304F\u3088\u3046 HTML \u306B\u76F4\u3057\u3066\u9001\u308A\u307E\u3059\uFF08--dry-run \u306E body \u306B\u5909\u63DB\u5F8C\u306E\u5024\u304C\u51FA\u307E\u3059\uFF09\u3002
|
|
48
|
+
--html \u3092\u4ED8\u3051\u308B\u3068\u3001\u672C\u6587\u3092 HTML \u3068\u3057\u3066\u305D\u306E\u307E\u307E\u9001\u308A\u307E\u3059\u3002`,destructive:true,confirmation:"\u5916\u90E8\u3078\u30E1\u30FC\u30EB\u3092\u9001\u308B\u64CD\u4F5C\uFF08\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\uFF09",flags:[MESSAGE_FLAG,BODY_FILE_FLAG,BODY_FLAG,HTML_FLAG],forbidden:ms365Forbidden,async prepare(input,ctx){const usage=`twp outlook mail ${op} help`;const id=messageId(input,op);const body=await readBody(input,
|
|
49
|
+
{flag:"--body",fileFlag:"--body-file",label:`${label}\u306E\u672C\u6587`,maxChars:BODY_MAX_CHARS,usage});if(body===void 0)throw new UsageError("\u672C\u6587\uFF08--body-file \u304B --body\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);const original=await ctx.resolver.ms365Message(id);return withResolved(input,{messageId:id,body,audience:replyAudience(original,all),subject:oneLine(str(original["subject"])??"\uFF08\u4EF6\u540D\u306A\u3057\uFF09")})},plan(input){const body=requireResolved(
|
|
50
|
+
input,"body");const id=ms365Segment(requireResolved(input,"messageId"),"\u5143\u306E\u30E1\u30FC\u30EBID");return{method:"POST",path:ms365Path(`/outlook/messages/${id}/${endpoint}`),body:{comment:input.flags.has("--html")?body:textToHtml(body)}}},plannedNotes:input=>[`${label}\u306E\u5185\u5BB9: \u5143\u306E\u30E1\u30FC\u30EB\u300C${requireResolved(input,"subject")}\u300D / \u5C4A\u304F\u76F8\u624B\u306E\u76EE\u5B89\uFF08\u5143\u306E\u30E1\u30FC\u30EB\u304B\u3089 Microsoft 365 \u304C\u6C7A\u3081\u307E\u3059\uFF09: ${requireResolved(
|
|
51
|
+
input,"audience")} / ${bodySummary(requireResolved(input,"body"),input.flags.has("--html"))}`],summarize:body=>sentSummary(body,label),raw:body=>assertSent(body,label),notes:()=>[`${label}\u3057\u307E\u3057\u305F\u3002\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\uFF08twp outlook mail list --folder sentitems\uFF09\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`]}}var forward={name:"forward",summary:"\u30E1\u30FC\u30EB\u3092\u8EE2\u9001\u3059\u308B\uFF08--yes \u304C\u5FC5\u8981\uFF09",usage:"\
|
|
52
|
+
twp outlook mail forward <\u30E1\u30FC\u30EBID> --to <\u30A2\u30C9\u30EC\u30B9> [--to \u2026] [--body-file <\u30D1\u30B9> | --body <\u6587\u5B57\u5217>] [--html] --yes",description:`${EXTERNAL_SEND_HELP}
|
|
53
|
+
|
|
54
|
+
\u5143\u306E\u30E1\u30FC\u30EB\u3092\u3001\u6DFB\u4ED8\u3082\u542B\u3081\u3066 --to \u306E\u76F8\u624B\u3078\u8EE2\u9001\u3057\u307E\u3059\u3002\u5B9B\u5148\u306F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u6307\u5B9A\u3057\u307E\u3059\uFF08\u540D\u524D\u304B\u3089\u306F\u63A2\u3057\u307E\u305B\u3093\uFF09\u3002
|
|
55
|
+
\u8907\u6570\u306A\u3089\u30D5\u30E9\u30B0\u3092\u7E70\u308A\u8FD4\u3057\u307E\u3059\u3002Cc\u30FBBcc \u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\uFF08Microsoft 365 \u306E\u4E2D\u7D99\u304C\u53D7\u3051\u4ED8\u3051\u306A\u3044\u305F\u3081\uFF09\u3002
|
|
56
|
+
\u30E1\u30FC\u30EBID \u306F twp outlook mail list \u306E id \u3067\u3059\u3002
|
|
57
|
+
|
|
58
|
+
\u672C\u6587\uFF08\u6DFB\u3048\u66F8\u304D\uFF09\u306F\u4EFB\u610F\u3067\u3059\u3002${BODY_HELP}
|
|
59
|
+
\u672C\u6587\u306F\u5143\u306E\u30E1\u30FC\u30EB\u306E\u4E0A\u306B\u5DEE\u3057\u8FBC\u307E\u308C\u307E\u3059\u3002Microsoft 365 \u306F\u672C\u6587\u3092 HTML \u3068\u3057\u3066\u8AAD\u3080\u306E\u3067\u3001\u65E2\u5B9A\uFF08\u30C6\u30AD\u30B9\u30C8\uFF09\u3067\u306F
|
|
60
|
+
\u6539\u884C\u3068\u8A18\u53F7\u304C\u898B\u305F\u3068\u304A\u308A\u306B\u5C4A\u304F\u3088\u3046 HTML \u306B\u76F4\u3057\u3066\u9001\u308A\u307E\u3059\u3002--html \u3092\u4ED8\u3051\u308B\u3068\u3001\u672C\u6587\u3092 HTML \u3068\u3057\u3066\u305D\u306E\u307E\u307E\u9001\u308A\u307E\u3059\u3002`,destructive:true,confirmation:"\u5916\u90E8\u3078\u30E1\u30FC\u30EB\u3092\u9001\u308B\u64CD\u4F5C\uFF08\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\uFF09",flags:[MESSAGE_FLAG,TO_FLAG,BODY_FILE_FLAG,BODY_FLAG,
|
|
61
|
+
HTML_FLAG],forbidden:ms365Forbidden,async prepare(input){const usage="twp outlook mail forward help";const id=messageId(input,"forward");const to=addresses(input,"--to");if(to.length===0)throw new UsageError("\u8EE2\u9001\u5148\uFF08--to\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);if(input.flags.has("--html")&&!input.flags.has("--body")&&!input.flags.has("--body-file")){throw new UsageError("--html \u306F\u672C\u6587\uFF08--body-file \u304B --body\uFF09\u3068\u4E00\u7DD2\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
62
|
+
usage)}const body=await readBody(input,{flag:"--body",fileFlag:"--body-file",label:"\u8EE2\u9001\u306E\u672C\u6587",maxChars:BODY_MAX_CHARS,usage});return withResolved(input,{messageId:id,to:JSON.stringify(to),...body===void 0?{}:{body}})},plan(input){const id=ms365Segment(requireResolved(input,"messageId"),"\u5143\u306E\u30E1\u30FC\u30EBID");const body=input.resolved?.["body"];return{method:"POST",path:ms365Path(`/outlook/messages/${id}/forward`),body:{...body===void 0?{}:{comment:input.flags.has(
|
|
63
|
+
"--html")?body:textToHtml(body)},toRecipients:recipients(resolvedJson(input,"to"))}}},plannedNotes:input=>[`\u8EE2\u9001\u306E\u5185\u5BB9: To ${resolvedJson(input,"to").join("\u3001")} / ${bodySummary(input.resolved?.["body"],input.flags.has("--html"))}\uFF08\u5143\u306E\u30E1\u30FC\u30EB\u3068\u6DFB\u4ED8\u306F\u305D\u306E\u307E\u307E\u4ED8\u304D\u307E\u3059\uFF09`],summarize:body=>sentSummary(body,"\u8EE2\u9001"),raw:body=>assertSent(body,"\u8EE2\u9001"),notes:()=>["\u8EE2\u9001\u3057\u307E\u3057\u305F\u3002\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0\uFF08twp outloo\
|
|
64
|
+
k mail list --folder sentitems\uFF09\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002"]};var mailSendOperations=[send,replyOperation(false),replyOperation(true),forward];export{textToHtml,mailSendOperations};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{ResolveError,UUID_RE,isSafePathSegment,resolveProjectRef,safeProjectIdPolicy}from"./chunk-GMBJTG6A.js";import{
|
|
3
|
+
import{ResolveError,UUID_RE,isSafePathSegment,resolveProjectRef,safeProjectIdPolicy}from"./chunk-GMBJTG6A.js";import{graphNextCursor,ms365NamedRow,ms365NotConnectedGuidance,ms365Path,ms365Segment}from"./chunk-3HH5IYNO.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{loadProjectConfig,loadUserConfig}from"./chunk-4VZKNEVN.js";import{isTaskKey}from"./chunk-II5RVJQN.js";import{UsageError}from"./chunk-UFND7FBC.js";import{twpHomeDir}from"./chunk-RZVI6PMW.js";var BACKLOG_BASE_PATH="/api/v2/integrations/backlog";function assertBacklogPathSegment(value,label){if(!isSafePathSegment(value)){throw new ResolveError(`${label}\u3068\u3057\u3066 URL \u306B\u5165\u308C\u3089\u308C\u306A\u3044\u5024\u304C\u30B5\u30FC\u30D0\u304B\u3089\u8FD4\u308A\u307E\u3057\u305F: ${JSON.stringify(value)}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return value}function backlogSpacePath(spaceId,suffix=""){assertBacklogPathSegment(spaceId,
|
|
4
4
|
"Backlog \u30B9\u30DA\u30FC\u30B9 ID");return`${BACKLOG_BASE_PATH}/${encodeURIComponent(spaceId)}${suffix}`}function idString(value){if(typeof value==="number"&&Number.isFinite(value))return String(value);if(typeof value==="string"&&value.trim()!=="")return value.trim();return null}function text(value){return typeof value==="string"&&value.trim()!==""?value.trim():null}function backlogSpaceAliases(spaceUrl){const aliases=[];const trimmed=spaceUrl.trim().replace(/\/+$/,"");if(trimmed==="")return aliases;
|
|
5
5
|
let host;try{host=new URL(trimmed).host}catch{host=trimmed.replace(/^\/+/,"").split("/")[0]??""}if(host==="")return aliases;aliases.push(host);const label=host.split(".")[0];if(label!==void 0&&label!==""&&label!==host)aliases.push(label);return aliases}function backlogSpaceRow(row){const url=text(row["space_url"]);return{id:idString(row["id"]),name:url,code:null,aliases:url!==null?backlogSpaceAliases(url):[]}}function backlogProjectRow(row){return{id:idString(row["id"]),name:text(row["name"]),code:text(
|
|
6
6
|
row["projectKey"])}}function backlogStatusRow(row){return{id:idString(row["id"]),name:text(row["name"]),code:null}}function backlogUserRow(row){return{id:idString(row["id"]),name:text(row["name"]),code:null,aliases:[text(row["userId"]),text(row["mailAddress"])].filter(v=>v!==null)}}var DEFAULT_LOOKUP_SCOPE="\u3053\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8";function fold(value){return value.trim().toLowerCase()}function keysOf(ref){return[ref.id,ref.code,ref.name,...ref.aliases??[]].filter(v=>typeof v==="string"&&v.trim()!=="").map(fold)}function describe(ref){return ref.code!==void 0&&ref.code!==null&&ref.code!==""&&ref.code!==ref.name?`${ref.name}\uFF08${ref.code}\uFF09`:ref.name}async function suggest(input,candidates){try{const{default:fuzzysort}=await import("./fuzzysort-DFVKV4B4.js");
|
|
@@ -99,16 +99,19 @@ key,options);if(hit!==null&&Array.isArray(hit))return hit;const fresh=await load
|
|
|
99
99
|
"TWP \u306E\u5916\u90E8\u9023\u643A\u8A2D\u5B9A\u3067 Backlog \u30B9\u30DA\u30FC\u30B9\u3092\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp backlog space list \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\uFF09\u3002")}throw new UsageError(`Backlog \u30B9\u30DA\u30FC\u30B9\u304C ${spaces.length} \u4EF6\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001--space \u30671\u3064\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,`twp backlog space list \u3067 ID \u3068\u30B9\u30DA\u30FC\u30B9URL\u3092\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`)}async backlogProjects(spaceId){
|
|
100
100
|
return this.cached("backlog-projects",spaceId,()=>this.namedList(backlogSpacePath(spaceId,"/projects"),"projects","Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8",backlogProjectRow))}async backlogStatuses(spaceId,projectId){return this.cached("backlog-statuses",`${spaceId}/${projectId}`,()=>this.namedList(backlogSpacePath(spaceId,`/projects/${encodeURIComponent(assertBacklogPathSegment(projectId,"Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 ID"))}/statuses`),"statuses","Backlog \u30B9\u30C6\u30FC\u30BF\u30B9",
|
|
101
101
|
backlogStatusRow))}async backlogUsers(spaceId,projectId){return this.cached("backlog-users",`${spaceId}/${projectId}`,()=>this.namedList(backlogSpacePath(spaceId,`/projects/${encodeURIComponent(assertBacklogPathSegment(projectId,"Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 ID"))}/users`),"users","Backlog \u30E6\u30FC\u30B6\u30FC",backlogUserRow))}async ms365Teams(){return this.cached("ms365-teams",MS365_TEAMS_CACHE_KEY,()=>this.ms365NamedList(ms365Path("/teams/teams"),"Teams \u306E\u30C1\u30FC\u30E0"))}async ms365Team(ref){
|
|
102
|
-
return resolveNamed(ref,await this.ms365Teams(),{flag:"--team",label:"\u30C1\u30FC\u30E0",scope:MS365_SCOPE_LABEL})}async ms365Channels(teamId){return this.cached("ms365-channels",teamId,()=>this.ms365NamedList(ms365Path(`/teams/teams/${ms365Segment(teamId,"\u30C1\u30FC\u30E0 ID")}/channels`),"Teams \u306E\u30C1\u30E3\u30CD\u30EB"))}async ms365Channel(teamId,ref){return resolveNamed(ref,await this.ms365Channels(teamId),{flag:"--channel",label:"\u30C1\u30E3\u30CD\u30EB",scope:"\u3053\u306E\u30C1\u30FC\u30E0"})}async
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
res.status)}
|
|
112
|
-
|
|
113
|
-
throw new
|
|
102
|
+
return resolveNamed(ref,await this.ms365Teams(),{flag:"--team",label:"\u30C1\u30FC\u30E0",scope:MS365_SCOPE_LABEL})}async ms365Channels(teamId){return this.cached("ms365-channels",teamId,()=>this.ms365NamedList(ms365Path(`/teams/teams/${ms365Segment(teamId,"\u30C1\u30FC\u30E0 ID")}/channels`),"Teams \u306E\u30C1\u30E3\u30CD\u30EB"))}async ms365Channel(teamId,ref){return resolveNamed(ref,await this.ms365Channels(teamId),{flag:"--channel",label:"\u30C1\u30E3\u30CD\u30EB",scope:"\u3053\u306E\u30C1\u30FC\u30E0"})}async ms365Message(messageId){
|
|
103
|
+
const res=await this.get(ms365Path(`/outlook/messages/${ms365Segment(messageId,"\u30E1\u30FC\u30EBID")}`));if(!res.ok){throw new ResolveError(ms365NotConnectedGuidance(res.json)??`\u5143\u306E\u30E1\u30FC\u30EB\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002\u30E1\u30FC\u30EBID \u306F twp outlook mail list \u306E id \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const data=isRecord(res.json)?res.json["data"]:void 0;
|
|
104
|
+
if(!isRecord(data)){throw new ResolveError("\u5143\u306E\u30E1\u30FC\u30EB\u306E\u5FDC\u7B54\u306B data \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return data}async ms365Event(eventId){const res=await this.get(ms365Path(`/calendar/events/${ms365Segment(eventId,"\u4E88\u5B9AID")}`));if(!res.ok){throw new ResolveError(ms365NotConnectedGuidance(res.json)??`\u4E88\u5B9A\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
|
|
105
|
+
status}\uFF09\u3002\u4E88\u5B9AID \u306F twp outlook event list \u306E id \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const data=isRecord(res.json)?res.json["data"]:void 0;if(!isRecord(data)){throw new ResolveError("\u4E88\u5B9A\u306E\u5FDC\u7B54\u306B data \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return data}async ms365NamedList(path2,label){const rows=[];let cursor=null;for(let page=1;page<=
|
|
106
|
+
MS365_RESOLVE_MAX_PAGES;page+=1){const res=await this.get(cursor===null?path2:`${path2}?skiptoken=${encodeURIComponent(cursor)}`);if(!res.ok){throw new ResolveError(ms365NotConnectedGuidance(res.json)??`${label}\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const data=isRecord(res.json)?res.json["\
|
|
107
|
+
data"]:void 0;const value=isRecord(data)?data["value"]:void 0;if(!isRecord(data)||!Array.isArray(value)){throw new ResolveError(`${label}\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data.value \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}value.forEach((row,index)=>{if(!isRecord(row)){throw new ResolveError(`${label}\u4E00\u89A7\u306E ${rows.length+index+1} \u4EF6\u76EE\u304C\u60F3\u5B9A\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
108
|
+
res.status)}rows.push(row)});const next=data["@odata.nextLink"];if(next===void 0||next===null)return namedFromRows(rows,label,ms365NamedRow,res.status??void 0);const parsed=typeof next==="string"?graphNextCursor(next):null;if(parsed===null||parsed.kind!=="skiptoken"){throw new ResolveError(`${label}\u4E00\u89A7\u306E\u7D9A\u304D\uFF08@odata.nextLink\uFF09\u3092\u8AAD\u3081\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}cursor=parsed.
|
|
109
|
+
value}throw new UsageError(`${label}\u304C\u591A\u3059\u304E\u308B\u305F\u3081\u540D\u524D\u3067\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\uFF08${MS365_RESOLVE_MAX_PAGES} \u30DA\u30FC\u30B8\u3092\u8D85\u3048\u307E\u3057\u305F\uFF09`,"\u4E00\u89A7\u30B3\u30DE\u30F3\u30C9\u306E\u51FA\u529B\u306B\u3042\u308B id \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}get apiClient(){return this.client}};function assertMembersComplete(rows){if(rows.length>=PROJECT_MEMBERS_LIMIT){throw new ResolveError(
|
|
110
|
+
`\u30E1\u30F3\u30D0\u30FC\u304C ${PROJECT_MEMBERS_LIMIT} \u4EBA\u4EE5\u4E0A\u3044\u308B\u305F\u3081\u3001\u5168\u54E1\u3092\u7167\u5408\u3067\u304D\u307E\u305B\u3093\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return rows}function rawListFrom(res,envelope,label){if(!res.ok){throw new ResolveError(`${label}\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
111
|
+
res.status)}const list=isRecord(res.json)?res.json[envelope]:void 0;if(!Array.isArray(list)){throw new ResolveError(`${label}\u4E00\u89A7\u306E\u5FDC\u7B54\u306B ${envelope} \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return list.map((row,index)=>{if(!isRecord(row)){throw new ResolveError(`${label}\u4E00\u89A7\u306E ${index+1} \u4EF6\u76EE\u304C\u60F3\u5B9A\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
112
|
+
res.status)}return row})}function userRow(row){const email=str(row["email"]);const employeeCode=str(row["employee_code"]);return{id:str(row["user_id"]),name:str(row["user_name"]),code:employeeCode??email,aliases:[email,employeeCode].filter(v=>v!==null)}}function notificationCategoryRow(row){return{id:str(row["key"]),name:str(row["name"]),code:str(row["key"])}}function inquiryCategoryRow(row){return{id:str(row["id"]),name:str(row["title"]),code:str(row["category_code"])}}function masterList(res,label){
|
|
113
|
+
const rows=rawListFrom(res,"list",label);const count=isRecord(res.json)?res.json["count"]:void 0;if(typeof count==="number"&&count>rows.length){throw new ResolveError(`${label}\u4E00\u89A7\u304C ${count} \u4EF6\u4E2D ${rows.length} \u4EF6\u3067\u5207\u308A\u8A70\u3081\u3089\u308C\u305F\u305F\u3081\u3001\u540D\u524D\u3067\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return rows}function codedMasterRow(row){return{id:str(
|
|
114
|
+
row["id"]),name:str(row["name"]),code:str(row["code"]),isDefault:truthyFlag(row["is_default"])}}function namedListFrom(res,envelope,label,map){return namedFromRows(rawListFrom(res,envelope,label),label,map,res.status??void 0)}function namedFromRows(rows,label,map,status=200){return rows.map((row,index)=>{const mapped=map(row);if(mapped.id===null||mapped.name===null){throw new ResolveError(`${label}\u4E00\u89A7\u306E ${index+1} \u4EF6\u76EE\u306B id / \u540D\u524D\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
115
|
+
status)}return{id:mapped.id,name:mapped.name,...mapped.code!==void 0?{code:mapped.code}:{},...mapped.aliases!==void 0&&mapped.aliases.length>0?{aliases:mapped.aliases}:{},...mapped.isDefault!==void 0?{isDefault:mapped.isDefault}:{}}})}function requireDefault(candidates,ctx){const hit=candidates.find(ref=>ref.isDefault===true);if(hit!==void 0)return hit;throw new UsageError(`${ctx.flag} \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${ctx.scope??DEFAULT_LOOKUP_SCOPE}\u306B\u306F\u65E2\u5B9A\u306E${ctx.
|
|
116
|
+
label}\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF09`,`\u6307\u5B9A\u3067\u304D\u308B${ctx.label}: ${candidates.map(ref=>ref.name).join(" / ")}\uFF08\u53E4\u3044\u30AD\u30E3\u30C3\u30B7\u30E5\u304C\u6B8B\u3063\u3066\u3044\u308B\u5834\u5408\u306F --refresh \u3067\u53D6\u308A\u76F4\u305B\u307E\u3059\uFF09`)}export{BACKLOG_BASE_PATH,backlogSpacePath,resolveNamed,requireDefaultProject,PRIVATE_TASKS_PATH,BACKLOG_SCOPE_LABEL,BACKLOG_PROJECT_SCOPE_LABEL,PROJECT_MEMBERS_LIMIT,DEPARTMENTS_PATH,POSITIONS_PATH,JOB_TITLES_PATH,INQUIRY_CATEGORIES_PATH,NOTIFICATIONS_PATH,WORKFLOWS_PATH,REPORTS_PATH,SALES_ESTIMATES_PATH,SALES_INVOICES_PATH,SALES_CONTRACTS_PATH,SALES_INVOICE_AUTO_TEMPLATES_PATH,SALES_DEPOSITS_PATH,SALES_PURCHASES_PATH,SALES_SUPPLIER_PAYMENTS_PATH,SALES_SUPPLIER_PAYMENT_SCHEDULES_PATH,SALES_BUSINESS_PLACES_PATH,
|
|
114
117
|
SALES_PAYEES_PATH,SALES_SEAL_IMPRESSIONS_PATH,SALES_PURCHASE_AI_MAPPINGS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,SALES_PURCHASE_NO_RULES_PATH,SALES_ESTIMATE_FORMATS_PATH,SALES_ROUNDING_SETTING_PATH,SALES_COMPANIES_PATH,CUSTOMERS_PATH,PROSPECTS_PATH,isExactNumericId,ORG_MASTER_LIMIT,TASK_MASTERS,Resolver};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{isModeId,isPermissionModeId}from"./chunk-NAUH75MM.js";import{API_TOKEN,HELP_TOKEN,isDomainName}from"./chunk-
|
|
3
|
+
import{isModeId,isPermissionModeId}from"./chunk-NAUH75MM.js";import{API_TOKEN,HELP_TOKEN,isDomainName}from"./chunk-Y5EN7RYN.js";import{splitFlagToken}from"./chunk-QQRJLH6B.js";var BUILTIN_COMMANDS=["login","logout","whoami","update","task-loop"];var TASK_LOOP_ACTIONS=["run","status","stop","schedule","setup","charter","skill"];var VALUE_FLAGS=new Set(["-p","--print","--profile","--tenant","--mode","--permission-mode","--model","--allowed-tools","--disallowed-tools","--project","--engine","--interval","--max-cycles","--ai","--workspace","--ai-config-file","--now","--counts","--gate","--file","--out","--revision","--dir","--output","--query"]);var BOOLEAN_FLAGS=new Set(
|
|
4
4
|
["-h","--help","-v","--version","--no-tui","--doctor","--password","--token","--no-browser","--safe","--daemon","--force-runner","--force","--drain","--yes","-y","--no-ai-config-file","--verbose","--all","--dry-run","--debug","--refresh"]);function dispatch(argv,limit=2){const tokens=[];const indexes=[];let truncated=false;for(let i=0;i<argv.length;i++){const arg=argv[i];if(arg===void 0)continue;if(arg.startsWith("-")&&arg!=="-"){const{name,value:inline}=splitFlagToken(arg);if(BOOLEAN_FLAGS.has(
|
|
5
5
|
name)){if(inline!==void 0){truncated=true;break}continue}if(VALUE_FLAGS.has(name)){if(inline!==void 0)continue;const next=argv[i+1];if(next!==void 0&&(!next.startsWith("-")||next==="-"))i++;continue}truncated=true;break}if(arg===""||arg==="-")continue;if(tokens.length>=limit)break;tokens.push(arg);indexes.push(i)}return{tokens,indexes,truncated}}function isBuiltin(token){return token!==void 0&&BUILTIN_COMMANDS.includes(token)}function isTaskLoopAction(token){return token!==void 0&&TASK_LOOP_ACTIONS.
|
|
6
6
|
includes(token)}function resolveRoute(result){const{tokens,indexes}=result;const[first,second]=tokens;const firstIndex=indexes[0];if(first===void 0||firstIndex===void 0)return{kind:"none",consumed:[]};const consumed=[firstIndex];const secondIndex=indexes[1];if(isBuiltin(first)){if(first==="task-loop"&&isTaskLoopAction(second)){if(secondIndex!==void 0)consumed.push(secondIndex);return{kind:"builtin",command:first,action:second,consumed}}return{kind:"builtin",command:first,...first==="task-loop"?{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-
|
|
3
|
+
import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-JYNZEZYL.js";import{CUSTOMER_LICENSE,childForbidden,levelForbidden}from"./chunk-HS7EKE7M.js";import{inspectLocalFile}from"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-SBWCQAHT.js";import{SALES_ESTIMATES_PATH,isExactNumericId}from"./chunk-3WHD2YVF.js";import{nonEmpty}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";
|
|
4
4
|
import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import fs from"fs";import path from"path";var DOCUMENT_TYPES=["order_form","individual_contract","other"];var DOCUMENT_TYPE_HELP="order_form\uFF1D\u6CE8\u6587\u66F8 / individual_contract\uFF1D\u500B\u5225\u5951\u7D04\u66F8 / other\uFF1D\u305D\u306E\u4ED6\u6848\u4EF6\u66F8\u985E";var MAGIC_BYTES={pdf:["%PDF-"],jpg:["\xFF\xD8\xFF"],jpeg:["\xFF\xD8\xFF"],png:["\x89PNG\r\n\n"],xlsx:["PK","PK","PK\x07\b"],docx:["PK","PK","PK\x07\b"],xls:["\xD0\xCF\xE0\xA1\xB1\xE1"],doc:["\xD0\xCF\xE0\xA1\xB1\xE1"]};var FILE_NAME_MAX_CHARS=255;var FIELDS=[
|
|
5
5
|
{kind:"text",flag:"--name",key:"document_name",label:"\u66F8\u985E\u540D",maxChars:255,summary:"\u66F8\u985E\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"enum",flag:"--type",key:"document_type",values:DOCUMENT_TYPES,summary:`\u66F8\u985E\u7A2E\u5225\uFF08${DOCUMENT_TYPE_HELP}\u30FBcreate \u3067\u306F\u5FC5\u9808\uFF09`}];var COLUMNS=["document_id","estimate_id","document_type","document_type_label","document_name","current_version","updated_by_name","updated_at"];var VERSION_COLUMNS=[
|
|
6
6
|
"version_number","file_name","file_size","is_current","created_by_name","created_at"];var ESTIMATE_FLAG={name:"--estimate",summary:"\u898B\u7A4D\u306E ID\uFF08twp estimate list \u306E id \u5217\u306E\u6570\u5B57\u30FB\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u898B\u7A4DID>"};var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\uFF08PDF\u30FBJPEG\u30FBPNG\u30FBWord\u30FBExcel\u3002\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{stripTerminalControls}from"./chunk-NHYMHCAT.js";var SENSITIVE_HEADERS=new Set(["authorization","proxy-authorization","cookie","set-cookie","x-api-key","x-auth-token","x-vercel-protection-bypass"]);var REDACTED="***\uFF08\u4F0F\u5B57\uFF09";var SECRET_KEY_PATTERN="[A-Za-z0-9_-]*(?:token|secret|password|passwd|api[_-]?key|credential|signature)[A-Za-z0-9_-]*";var NOT_SECRET_FLAGS="(?:starting-token)";var NOT_SECRET_QUERY="(?:skiptoken)";function redactSecrets(text){return text.replace(/\bBearer\s+[^\s"'`,;)\]}]+/gi,`Bearer ${REDACTED}`).
|
|
4
|
-
/(\/v2\/(?:admin\/)?invitations\/)[A-Za-z0-9_-]{16,}/g,`$1${REDACTED}`).replace(new RegExp(`("${SECRET_KEY_PATTERN}"\\s*:\\s*)"(?:[^"\\\\]|\\\\.)*"`,"gi"),`$1"${REDACTED}"`).replace(new RegExp(`([?&](?!${NOT_SECRET_QUERY}=)${SECRET_KEY_PATTERN}=)[^&\\s"'\`,;)\\]}]+`,"gi"),`$1${REDACTED}`).replace(new RegExp(`(--(?!${NOT_SECRET_FLAGS}(?:=|\\s))${SECRET_KEY_PATTERN}(?:=|\\s+))('[^']*'|"[^"]*"|[A-Za-z0-9_.~+/=|:%-]+)`,"gi"),`$1${REDACTED}`)}var SECRET_KEY_NAME=new RegExp(`^${SECRET_KEY_PATTERN}
|
|
5
|
-
i");function redactSecretValues(value){if(Array.isArray(value))return value.map(item=>redactSecretValues(item));if(value!==null&&typeof value==="object"){const out={};for(const[key,item]of Object.entries(value)){out[key]=SECRET_KEY_NAME.test(key)?REDACTED:redactSecretValues(item)}return out}return value}function formatHeaders(headers){if(!headers)return[];const entries=headers instanceof Headers?[...headers.entries()]:Array.isArray(headers)?headers:Object.entries(headers);return entries.map(
|
|
6
|
-
value])=>{const shown=SENSITIVE_HEADERS.has(name.toLowerCase())?REDACTED:redactSecrets(String(value));return` ${name.toLowerCase()}: ${shown}`})}var BODY_LIMIT=4e3;function formatBody(raw){const safe=redactSecrets(stripTerminalControls(raw));return safe.length>BODY_LIMIT
|
|
3
|
+
import{stripTerminalControls}from"./chunk-NHYMHCAT.js";var SENSITIVE_HEADERS=new Set(["authorization","proxy-authorization","cookie","set-cookie","x-api-key","x-auth-token","x-vercel-protection-bypass"]);var REDACTED="***\uFF08\u4F0F\u5B57\uFF09";var SECRET_KEY_PATTERN="[A-Za-z0-9_-]*(?:token|secret|password|passwd|api[_-]?key|credential|signature|tempauth|upload_?url)[A-Za-z0-9_-]*";var NOT_SECRET_FLAGS="(?:starting-token)";var NOT_SECRET_QUERY="(?:skiptoken)";function redactSecrets(text){return text.replace(/\bBearer\s+[^\s"'`,;)\]}]+/gi,`Bearer ${REDACTED}`).
|
|
4
|
+
replace(/(\/v2\/(?:admin\/)?invitations\/)[A-Za-z0-9_-]{16,}/g,`$1${REDACTED}`).replace(new RegExp(`("${SECRET_KEY_PATTERN}"\\s*:\\s*)"(?:[^"\\\\]|\\\\.)*"`,"gi"),`$1"${REDACTED}"`).replace(new RegExp(`([?&](?!${NOT_SECRET_QUERY}=)${SECRET_KEY_PATTERN}=)[^&\\s"'\`,;)\\]}]+`,"gi"),`$1${REDACTED}`).replace(new RegExp(`(--(?!${NOT_SECRET_FLAGS}(?:=|\\s))${SECRET_KEY_PATTERN}(?:=|\\s+))('[^']*'|"[^"]*"|[A-Za-z0-9_.~+/=|:%-]+)`,"gi"),`$1${REDACTED}`)}var SECRET_KEY_NAME=new RegExp(`^${SECRET_KEY_PATTERN}\
|
|
5
|
+
$`,"i");function redactSecretValues(value){if(Array.isArray(value))return value.map(item=>redactSecretValues(item));if(value!==null&&typeof value==="object"){const out={};for(const[key,item]of Object.entries(value)){out[key]=SECRET_KEY_NAME.test(key)?REDACTED:redactSecretValues(item)}return out}return value}function formatHeaders(headers){if(!headers)return[];const entries=headers instanceof Headers?[...headers.entries()]:Array.isArray(headers)?headers:Object.entries(headers);return entries.map(
|
|
6
|
+
([name,value])=>{const shown=SENSITIVE_HEADERS.has(name.toLowerCase())?REDACTED:redactSecrets(String(value));return` ${name.toLowerCase()}: ${shown}`})}var BODY_LIMIT=4e3;function omitAttachmentBytes(body){return body.replace(/"contentBytes":"([A-Za-z0-9+/=]*)"/g,(_,b64)=>`"contentBytes":"\uFF08base64 ${b64.length} \u6587\u5B57\u30FB\u51FA\u529B\u3057\u306A\u3044\uFF09"`)}function formatBody(raw){const safe=omitAttachmentBytes(redactSecrets(stripTerminalControls(raw)));return safe.length>BODY_LIMIT?
|
|
7
|
+
`${safe.slice(0,BODY_LIMIT)}
|
|
7
8
|
\u2026\uFF08\u4EE5\u964D ${safe.length-BODY_LIMIT} \u6587\u5B57\u3092\u7701\u7565\uFF09`:safe}function isTextualContentType(contentType){if(contentType===null)return false;return/^\s*(text\/|application\/(json|xml|javascript|x-www-form-urlencoded)|application\/[\w.+-]*\+(json|xml))/i.test(contentType)}function withDebug(inner,options={}){const write=options.write??(text=>void process.stderr.write(text));const now=options.now??(()=>Date.now());return async(input,init)=>{const method=init?.method??
|
|
8
9
|
"GET";const lines=[`[debug] \u2192 ${method} ${redactSecrets(input)}`,...formatHeaders(init?.headers)];if(options.omitBodies!==void 0&&init?.body!==void 0&&init.body!==null)lines.push(` \uFF08\u672C\u6587\u306F${options.omitBodies}\u305F\u3081\u51FA\u529B\u3057\u306A\u3044\uFF09`);else if(typeof init?.body==="string")lines.push(` ${formatBody(init.body)}`);else if(init?.body instanceof Uint8Array)lines.push(` \uFF08\u672C\u6587\u306F ${init.body.byteLength} \u30D0\u30A4\u30C8\u306E\u30D0\u30A4\u30C8\u5217\u3002\u51FA\u529B\u3057\u306A\u3044\uFF09`);
|
|
9
10
|
write(`${lines.join("\n")}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
var LOADERS={"agent-loop":async()=>(await import("./agent-loop-RMJXHBNG.js")).agentLoopDomain,"ai-review-reason":async()=>(await import("./sales-ai-review-SVZHVH5P.js")).aiReviewReasonDomain,analysis:async()=>(await import("./analysis-KUCETWIJ.js")).analysisDomain,attendance:async()=>(await import("./attendance-K2U7RYDU.js")).attendanceDomain,backlog:async()=>(await import("./backlog-XZB35X7I.js")).backlogDomain,budget:async()=>(await import("./budget-FOFE3YUJ.js")).budgetDomain,"busin\
|
|
4
|
+
ess-place":async()=>(await import("./sales-master-VD6JE2P3.js")).businessPlaceDomain,company:async()=>(await import("./company-FEXAHUPT.js")).companyDomain,contract:async()=>(await import("./contract-4RALZBO5.js")).contractDomain,customer:async()=>(await import("./company-FEXAHUPT.js")).customerDomain,department:async()=>(await import("./department-VEXXWBZ4.js")).departmentDomain,deposit:async()=>(await import("./deposit-2AAST2DE.js")).depositDomain,estimate:async()=>(await import("./estimate-JQURFOCH.js")).
|
|
5
|
+
estimateDomain,inquiry:async()=>(await import("./inquiry-YTYZYUTY.js")).inquiryDomain,invoice:async()=>(await import("./invoice-PHYBVU6Q.js")).invoiceDomain,"job-title":async()=>(await import("./job-title-ORNY7A7L.js")).jobTitleDomain,leave:async()=>(await import("./leave-5V6EPGA3.js")).leaveDomain,media:async()=>(await import("./media-BU23L547.js")).mediaDomain,meeting:async()=>(await import("./knowledge-FQ32UNDW.js")).meetingDomain,note:async()=>(await import("./knowledge-FQ32UNDW.js")).
|
|
6
|
+
noteDomain,notification:async()=>(await import("./notification-XARS6JH2.js")).notificationDomain,onedrive:async()=>(await import("./onedrive-N4T6D2OW.js")).onedriveDomain,outlook:async()=>(await import("./outlook-LY6WBXIJ.js")).outlookDomain,payee:async()=>(await import("./sales-master-VD6JE2P3.js")).payeeDomain,position:async()=>(await import("./position-NNJZAT3A.js")).positionDomain,project:async()=>(await import("./project-FDY6LETQ.js")).projectDomain,prospect:async()=>(await import("./prospect-CUWP3E5S.js")).
|
|
7
|
+
prospectDomain,purchase:async()=>(await import("./purchase-2CZTB5H7.js")).purchaseDomain,receivable:async()=>(await import("./receivable-KV5PPNLA.js")).receivableDomain,report:async()=>(await import("./report-PCQPTRUV.js")).reportDomain,"rounding-setting":async()=>(await import("./sales-numbering-P7W6N3OM.js")).roundingSettingDomain,"seal-impression":async()=>(await import("./sales-master-VD6JE2P3.js")).sealImpressionDomain,shift:async()=>(await import("./attendance-lists-NVRU2NLY.js")).shiftDomain,
|
|
8
|
+
storage:async()=>(await import("./storage-KLLBENBY.js")).storageDomain,"supplier-payment":async()=>(await import("./supplier-payment-2KPCVEPH.js")).supplierPaymentDomain,task:async()=>(await import("./task-MFWWP5Q7.js")).taskDomain,teams:async()=>(await import("./teams-DRHXPLWN.js")).teamsDomain,user:async()=>(await import("./user-QG3KMK3T.js")).userDomain,wiki:async()=>(await import("./knowledge-FQ32UNDW.js")).wikiDomain,workchange:async()=>(await import("./attendance-lists-NVRU2NLY.js")).
|
|
9
|
+
workchangeDomain,workflow:async()=>(await import("./workflow-CSYU4J4U.js")).workflowDomain};async function loadDomain(name){return LOADERS[name]()}export{loadDomain};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{salesAdminForbidden}from"./chunk-
|
|
3
|
+
import{salesAdminForbidden}from"./chunk-QVZGNHRE.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-V24LKF3V.js";import{booleanText,boundedText}from"./chunk-XDHLO54T.js";import{SALES_ESTIMATE_FORMATS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,SALES_PURCHASE_NO_RULES_PATH,SALES_ROUNDING_SETTING_PATH,isExactNumericId}from"./chunk-3WHD2YVF.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,
|
|
4
4
|
nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";var INT_MAX=2147483647;var MEMBER_FORBIDDEN=licenseForbidden(featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"));function envelope(body,what){if(!isRecord(body)||body["result"]!==true)throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306E\u5F62\u304C\u60F3\u5B9A\u3068\u9055\u3044\u307E\u3059\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return body}function recordOf(body,what){const data=envelope(body,what)["data"];if(!isRecord(data)||typeof data["id"]!==
|
|
5
5
|
"string")throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306B data.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return data}function serverMessage(body){const message=isRecord(body)?body["message"]:void 0;return typeof message==="string"&&message!==""?[message]:[]}function text(value){return typeof value==="string"||typeof value==="number"?String(value):""}function integerValue(flag,raw,min,max=INT_MAX){const trimmed=raw.
|
|
6
6
|
trim();const value=/^\d+$/.test(trimmed)?Number(trimmed):Number.NaN;if(!Number.isSafeInteger(value)||value<min||value>max)throw new UsageError(`${flag} \u306F ${min} \u4EE5\u4E0A ${max} \u4EE5\u4E0B\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`);return value}var RULE_COLUMNS=["id","rule_name","prefix","digit_count","current_number","count_up_num","next_number","sort_order"];function nextNumber(rule,purchaseFormat){const current=rule["current_number"];const step=rule["\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{contentTypeFor,inspectLocalFile,issued}from"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-SBWCQAHT.js";import{checkUploadQuota}from"./chunk-2YNZ4MRT.js";import{readCsvFileText}from"./chunk-OHXZO5WK.js";import{featureLicenseGuidance}from"./chunk-V24LKF3V.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-3WHD2YVF.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import{ApiError,
|
|
4
4
|
errorListMessages}from"./chunk-IF2K4PM5.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import fs from"fs";import path from"path";function levelForbidden(licenseGuidance,levelGuidance){return body=>body?.error==="permission_denied"?licenseGuidance:levelGuidance}var COMPANY_LICENSE="\u53D6\u5F15\u5148\u3092\u6271\u3046\u306B\u306F\u8CA9\u58F2\u7BA1\u7406\u304B\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u8981\u308A\u307E\u3059\u304C\u3001\u3069\u3061\u3089\u3082\u3042\u308A\u307E\u305B\u3093\u3002\u30C6\u30CA\u30F3\u30C8\u304C\u3069\u3061\u3089\u3082\u5951\u7D04\u3057\u3066\u3044\u306A\u3044\u304B\u3001\u3042\u306A\u305F\u306E\u6A29\u9650\u304C\u3069\u3061\u3089\u3082\u300C\u306A\u3057\u300D\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
5
5
|
var CUSTOMER_LICENSE=featureLicenseGuidance("\u9867\u5BA2\u7BA1\u7406");var COMPANY_WRITE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u9867\u5BA2\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u306F\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7DE8\u96C6\u8005\u300D\u4EE5\u4E0A\u304B\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u306E\u3069\u3061\u3089\u304B\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
6
6
|
var LEVEL_LABELS={admin:"\u7BA1\u7406\u8005",editor:"\u7DE8\u96C6\u8005",viewer:"\u95B2\u89A7\u8005",none:"\u306A\u3057"};var CHILD_DELETE_NEEDS="\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u306E\u524A\u9664\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u3067\u3042\u308B\u3053\u3068\u304C\u8981\u308A\u307E\u3059";var CUSTOMER_DELETE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u9867\u5BA2\u306E\u524A\u9664\u306B\u306F\u3001\u4F01\u696D\u306E\u524A\u9664\u306B\u9867\u5BA2\u7BA1\u7406\u306E\u300C\u7BA1\u7406\u8005\u300D\u304B\u8CA9\u58F2\u7BA1\u7406\u306E\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u3001\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u306E\u524A\u9664\u306B\u9867\u5BA2\u7BA1\u7406\u306E\u300C\u7BA1\u7406\u8005\u300D\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{CUSTOMER_FLAG,CUSTOMER_LICENSE,childForbidden,levelForbidden,prepareCustomerFlag}from"./chunk-
|
|
3
|
+
import{CUSTOMER_FLAG,CUSTOMER_LICENSE,childForbidden,levelForbidden,prepareCustomerFlag}from"./chunk-HS7EKE7M.js";import{inspectLocalFile}from"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-SBWCQAHT.js";import{checkUploadQuota}from"./chunk-2YNZ4MRT.js";import{booleanText}from"./chunk-XDHLO54T.js";import{CUSTOMERS_PATH,isExactNumericId}from"./chunk-3WHD2YVF.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import{
|
|
4
4
|
ApiError}from"./chunk-IF2K4PM5.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-XNLIEUAW.js";import{nonEmpty}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import fs from"fs";import path from"path";var CONTRACT_TYPES=["basic_contract","nda","other"];var CONTRACT_TYPE_HELP="basic_contract\uFF1D\u57FA\u672C\u5951\u7D04\u66F8 / nda\uFF1D\u6A5F\u5BC6\u4FDD\u6301\u5951\u7D04\u66F8 / other\uFF1D\u305D\u306E\u4ED6\u5951\u7D04\u66F8\u985E";var FILE_NAME_MAX_CHARS=255;var PDF_MAGIC="%PDF-";var CONTRACT_FIELDS=[{kind:"text",flag:"--name",key:"document_name",label:"\u66F8\u985E\u540D",maxChars:255,summary:"\u66F8\u985E\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"enum",flag:"--type",key:"\
|
|
5
5
|
document_type",values:CONTRACT_TYPES,summary:`\u66F8\u985E\u7A2E\u5225\uFF08${CONTRACT_TYPE_HELP}\u30FBcreate \u3067\u306F\u5FC5\u9808\uFF09`}];var CONTRACT_COLUMNS=["document_id","company_id","document_type","document_name","current_version","updated_by_name","updated_at"];var VERSION_COLUMNS=["version_number","file_name","file_size","is_current","created_by_name","created_at"];var CASE_COLUMNS=["document_id","document_type_label","document_name","estimate_no","estimate_title","project_name","c\
|
|
6
6
|
urrent_version","updated_at"];var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B PDF \u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9.pdf>"};var OUT_FLAG={name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\u3002\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var FORCE_FLAG={
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{featureLicenseGuidance}from"./chunk-
|
|
3
|
+
import{featureLicenseGuidance}from"./chunk-V24LKF3V.js";import{isExactNumericId}from"./chunk-3WHD2YVF.js";import{nonEmpty}from"./chunk-IOGMOXYF.js";import{UsageError}from"./chunk-UFND7FBC.js";var PDF_PATH="/api/v2/sales/pdf";var FEATURE_DENIED="\u3053\u306E\u6A5F\u80FD\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function salesFeatureDenied(body){return body?.error==="permission_denied"||body?.error==="forbidden"&&body.error_description===FEATURE_DENIED}function pdfForbidden(body){if(salesFeatureDenied(body))return featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406");const reason=body?.error;if(typeof reason==="string"&&reason.endsWith(
|
|
4
4
|
"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093")){return`${reason}\uFF08\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u7D10\u3065\u304F\u66F8\u985E\u306F\u305D\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u3001\u7D10\u3065\u304B\u306A\u3044\u66F8\u985E\u306F\u4F5C\u6210\u8005\u30FB\u62C5\u5F53\u8005\u3068\u7BA1\u7406\u8005\u3060\u3051\u304C\u51FA\u529B\u3067\u304D\u307E\u3059\uFF09`}return void 0}var ESTIMATE={name:"estimate",label:"\u898B\u7A4D",noExample:"EST0000063",
|
|
5
5
|
defaultKind:"estimate",kinds:{estimate:{segment:"estimate",label:"\u898B\u7A4D\u66F8"},order:{segment:"order",label:"\u6CE8\u6587\u66F8"},"order-acceptance":{segment:"order-acceptance",label:"\u6CE8\u6587\u8ACB\u66F8"}}};var INVOICE={name:"invoice",label:"\u8ACB\u6C42",noExample:"INV0000170",defaultKind:"invoice",kinds:{invoice:{segment:"invoice",label:"\u8ACB\u6C42\u66F8"},delivery:{segment:"delivery",label:"\u7D0D\u54C1\u66F8"},inspection:{segment:"inspection",label:"\u691C\u53CE\u66F8"}}};var PURCHASE={
|
|
6
6
|
name:"purchase",label:"\u4ED5\u5165",defaultKind:"order",kinds:{order:{segment:"purchase-order",label:"\u6CE8\u6587\u66F8"},"order-acceptance":{segment:"purchase-order-acceptance",label:"\u6CE8\u6587\u8ACB\u66F8"}}};var OUT_FLAG={name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9.pdf>"};var FORCE_FLAG={name:"--force",summary:"\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4E0A\u66F8\u304D\u3059\u308B",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{CommandModelMissingError,MAX_REPORTED_VIOLATIONS,loadCommandModelDomain,loadCommandModelIndex,validateBody,validateQuery}from"./chunk-NZ7WI4RZ.js";import{redactSecretValues,redactSecrets}from"./chunk-
|
|
3
|
+
import{CommandModelMissingError,MAX_REPORTED_VIOLATIONS,loadCommandModelDomain,loadCommandModelIndex,validateBody,validateQuery}from"./chunk-NZ7WI4RZ.js";import{redactSecretValues,redactSecrets}from"./chunk-AUAZP2G7.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import{ApiError,TwpApiClient,appendQuery}from"./chunk-IF2K4PM5.js";import{DEFAULT_MAX_TOKENS,emptyUsage}from"./chunk-6QOT7CHX.js";import{isPrivateTwpHome,isTrustworthyCacheFile,writePrivateFileAtomic}from"./chunk-D233KKXW.js";
|
|
4
4
|
import{AuthSession,NotLoggedInError,SessionExpiredError,withFileLock}from"./chunk-XNLIEUAW.js";import{MODES,applyPermissionMode,checkPermission,isModeId,setActiveModes}from"./chunk-NAUH75MM.js";import{isForceOnly,killProcessTree,system32}from"./chunk-N2UVRM3Z.js";import{findExecutable,isWindowsDriveAbsolute}from"./chunk-PMOUHEJQ.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{configReadDirs,ensureTwpHome,twpHomeDir}from"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs2 from"fs";import path3 from"path";import os2 from"os";import{realpathSync}from"fs";import{homedir}from"os";import{dirname,isAbsolute,relative,resolve,sep}from"path";var PathDeniedError=class extends Error{constructor(message){super(message);this.name="PathDeniedError"}};function resolveToolPath(input,cwd,home=homedir()){if(typeof input!=="string"||input.trim()===""){throw new PathDeniedError("path must be a non-empty string")}const expanded=expandHome(input,home);const abs=isAbsolute(expanded)?resolve(expanded):resolve(cwd,expanded);const root=realOrSelf(resolve(cwd));assertInside(abs,resolve(cwd),abs);assertNotSecret(abs,home);const real=realOrSelf(abs);if(real!==
|
|
5
5
|
abs){assertInside(real,root,abs);assertNotSecret(real,home)}return abs}function realToolPath(input,cwd,home=homedir()){return realOrSelf(resolveToolPath(input,cwd,home))}function assertInside(target,root,reported){const rel=relative(root,target);const outside=rel===".."||rel.startsWith(`..${sep}`)||isAbsolute(rel);if(outside){throw new PathDeniedError(`path escapes the working directory (${reported}). Only paths under ${root} can be accessed.`)}}function realOrSelf(target){let current=target;const rest=[];
|
|
6
6
|
for(;;){try{const real=realpathSync(current);return rest.length===0?real:resolve(real,...rest.reverse())}catch{const parent=dirname(current);if(parent===current)return target;rest.push(current.slice(parent.length+1));current=parent}}}function assertNotSecret(absPath,home=homedir(),env=process.env){const reason=secretReason(absPath,home,env);if(reason!==null)throw new PathDeniedError(`refusing to access ${absPath}: ${reason}`)}function secretReason(absPath,_home=homedir(),env=process.env){const lower=absPath.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{redactSecretValues,redactSecrets}from"./chunk-
|
|
3
|
+
import{redactSecretValues,redactSecrets}from"./chunk-AUAZP2G7.js";import{formatOutput}from"./chunk-K2ONOH3L.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";function renderOutput(value,format,noRedact=false){if(noRedact)return formatOutput(value,format);return redactSecrets(formatOutput(redactSecretValues(value),format))}function renderDocument(text,noRedact=false){const visible=stripTerminalControls(text);return noRedact?visible:redactSecrets(visible)}export{renderOutput,renderDocument};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{readBody}from"./chunk-ORUDW52G.js";import{WORKFLOWS_PATH}from"./chunk-
|
|
3
|
+
import{readBody}from"./chunk-ORUDW52G.js";import{WORKFLOWS_PATH}from"./chunk-3WHD2YVF.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";var WORKFLOW_FLAG={name:"--workflow",summary:"\u7533\u8ACB\u66F8\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\uFF09\u306E\u540D\u524D\u304B ID \u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC>"};var CATEGORIES={undefined:"\u6C4E\u7528",paid_holiday:"\u6709\u7D66\u4F11\u6687",substitute_holiday:"\u632F\u66FF\u4F11\u6687",comp_holiday:"\u4EE3\u4F11",absence:"\u6B20\u52E4",special_holiday:"\u7279\u5225\u4F11\u6687",other_leave:"\u305D\u306E\u4ED6\u4F11\u6687\u30FB\u6B20\u52E4",
|
|
4
4
|
sales:"\u53D6\u5F15",commuting_expenses:"\u901A\u52E4\u4EA4\u901A\u8CBB",cms_publish:"\u30B3\u30F3\u30C6\u30F3\u30C4\u516C\u958B",equipment_lending:"\u5099\u54C1\u8CB8\u51FA",ai_tool_license:"AI\u30C4\u30FC\u30EB\u30E9\u30A4\u30BB\u30F3\u30B9",qualification_bonus:"\u5408\u683C\u304A\u795D\u3044\u91D1"};var CATEGORY_HELP=`\u30AB\u30C6\u30B4\u30EA: ${Object.entries(CATEGORIES).map(([key,label])=>`${key}\uFF08${label}\uFF09`).join(" / ")}`;var WORKFLOW_STATUSES=["active","inactive","draft"];var INSTANCE_STATUSES=[
|
|
5
5
|
"new","in_progress","approved","rejected","canceled","sent_back"];var INSTANCE_STATUS_HELP="\u72B6\u614B: new\uFF08\u4E0B\u66F8\u304D\uFF09/ in_progress\uFF08\u627F\u8A8D\u5F85\u3061\uFF09/ approved\uFF08\u627F\u8A8D\u6E08\u307F\uFF09/ rejected\uFF08\u5374\u4E0B\uFF09/ canceled\uFF08\u53D6\u6D88\uFF09/ sent_back\uFF08\u5DEE\u3057\u623B\u3057\uFF09";var WORKFLOW_COLUMNS=["id","name","defined_category","status","is_hidden","valid_from","valid_to"];var WORKFLOW_ADMIN_COLUMNS=[...WORKFLOW_COLUMNS,"s\
|
|
6
6
|
tep_count"];var WORKFLOW_GET_COLUMNS=["id","name","defined_category","status","is_hidden","valid_from","valid_to","description"];var INSTANCE_COLUMNS=["id","title","workflow_name","status","current_step_no","applicant_name","applied_at","completed_at"];var INSTANCE_GET_COLUMNS=["id","title","workflow_id","workflow_name","status","current_step_no","applicant_name","applied_at","completed_at","can_approve","is_editable","is_cancelable"];var PENDING_COLUMNS=["id","title","workflow_name","applicant_\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{salesFeatureDenied}from"./chunk-
|
|
3
|
+
import{salesFeatureDenied}from"./chunk-L7IGGC7H.js";import{featureLicenseGuidance}from"./chunk-V24LKF3V.js";import{charCount,readBody}from"./chunk-ORUDW52G.js";import{isExactNumericId}from"./chunk-3WHD2YVF.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-XNLIEUAW.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";
|
|
4
4
|
import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,NetworkError,UsageError}from"./chunk-UFND7FBC.js";var SALES_PATH="/api/v2/sales";var REASONS_PATH=`${SALES_PATH}/ai-review-reasons`;function documentForbidden(body){if(salesFeatureDenied(body))return featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406");const reason=body?.error;if(typeof reason==="string"&&reason.endsWith("\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093")){return`${reason}\uFF08\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u7D10\u3065\u304F\u66F8\u985E\u306F\u305D\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u3001\u7D10\u3065\u304B\u306A\u3044\u66F8\u985E\u306F\u4F5C\u6210\u8005\u30FB\u62C5\u5F53\u8005\u3068\u7BA1\u7406\u8005\u3060\u3051\u304C\u6271\u3048\u307E\u3059\uFF09`}
|
|
5
5
|
return void 0}function reasonsForbidden(body){if(body?.error==="permission_denied")return featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406");return"\u7406\u7531\u306E\u6A2A\u65AD\u4E00\u89A7\u30FB\u6587\u6848\u751F\u6210\u30FBPR \u4F5C\u6210\u306F\u8CA9\u58F2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u4F7F\u3048\u307E\u3059\uFF08\u66F8\u985E\u3092\u8DE8\u3044\u3067\u7406\u7531\u3092\u8AAD\u3080\u305F\u3081\uFF09\u3002\u30C6\u30CA\u30F3\u30C8\u304C\u8CA9\u58F2\u7BA1\u7406\u3092\u5951\u7D04\u3057\u3066\u3044\u308B\u304B\u30FB\u3042\u306A\u305F\u306E\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u304B\u3092\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}
|
|
6
6
|
var ESTIMATE={name:"estimate",label:"\u898B\u7A4D",segment:"estimates"};var INVOICE={name:"invoice",label:"\u8ACB\u6C42",segment:"invoices"};var CONTRACT={name:"contract",label:"\u53D6\u5F15\u5951\u7D04",segment:"contracts"};var JUDGMENTS={no_issue:"\u78BA\u8A8D\u3057\u305F\u304C\u554F\u984C\u306A\u3044\u3068\u5224\u65AD\u3057\u305F",corrected:"\u6307\u6458\u3092\u53D7\u3051\u3066\u66F8\u985E\u3092\u4FEE\u6B63\u3057\u305F",not_applicable:"\u3053\u306E\u6848\u4EF6\u306B\u306F\u5F53\u3066\u306F\u307E\u3089\u306A\u3044\u6307\u6458\u3060\u3068\u5224\u65AD\u3057\u305F"};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
var JsonBodyWithView=class{constructor(value,view){this.value=value;this.view=view}value;view;toJSON(){return this.value}dryRunView(){return this.view}};export{JsonBodyWithView};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{readCsvFileText}from"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,invoiceFilters}from"./chunk-
|
|
3
|
+
import{readCsvFileText}from"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,invoiceFilters}from"./chunk-V24LKF3V.js";import{boundedText,isoDate}from"./chunk-XDHLO54T.js";import{readBody}from"./chunk-ORUDW52G.js";import{SALES_DEPOSITS_PATH,isExactNumericId,resolveNamed}from"./chunk-3WHD2YVF.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,
|
|
4
4
|
STABLE_PAGE_ORDER,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";var PATH=SALES_DEPOSITS_PATH;function salesAdminForbidden(what){return body=>body?.error==="permission_denied"?featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"):`${what}\u306B\u306F\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u3067\u3042\u308B\u3053\u3068\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`}var FORBIDDEN=salesAdminForbidden("\u5165\u91D1");var ALLOCATION_STATUSES={
|
|
5
5
|
allocated:"\u5F15\u5F53\u6E08",shortage:"\u672A\u5165\u91D1\u6709",excess:"\u5165\u91D1\u8D85\u904E\u6709",transfer_fee_resolved:"\u624B\u6570\u6599\u51E6\u7406\u6E08"};var EXCESS_REASONS={transfer_fee:"\u632F\u8FBC\u624B\u6570\u6599",agency_fee:"\u4EE3\u884C\u624B\u6570\u6599\uFF08\u53E3\u5EA7\u632F\u66FF \u57FA\u672C\u5229\u7528\u6599\uFF09",partial:"\u4E00\u90E8\u5165\u91D1",offset:"\u76F8\u6BBA",overpayment:"\u904E\u5165\u91D1",other:"\u305D\u306E\u4ED6"};var EXCESS_TAX_CATEGORIES={taxable_purchase_10:"\
|
|
6
6
|
\u8AB2\u7A0E\u4ED5\u5165 10%",not_applicable:"\u5BFE\u8C61\u5916"};var BULK_MAX_ROWS=100;var PLAN_MAX_ITEMS=50;var PLAN_MAX_ALLOCATIONS=100;var FILE_MAX_BYTES=1024*1024;var EXCESS_NOTE_MAX_CHARS=255;var PLAN_MEMO_MAX_CHARS=1e3;var CONTENT_MAX_CHARS=1e6;var LIST_COLUMNS=["id","deposit_date","company_name","payee_name","deposit_amount","allocated_amount","unallocated_amount","allocation_status"];var GET_COLUMNS=[...LIST_COLUMNS,"memo","excess_reason","excess_amount","excess_note","excess_tax_categ\
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{loadDomain}from"./chunk-
|
|
4
|
-
import{GLOBAL_OPTIONS_HELP}from"./chunk-YLM54X35.js";import{AuthSession,NotLoggedInError,SessionExpiredError,loadCredentials}from"./chunk-XNLIEUAW.js";import{effectiveApiUrl,loadUserConfig,resolveConfiguredOutput,resolveProfile}from"./chunk-4VZKNEVN.js";import{HELP_TOKEN}from"./chunk-
|
|
5
|
-
positiveInteger,shellQuote}from"./chunk-IOGMOXYF.js";import{isRecord}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_AUTH,EXIT_FAILURE,EXIT_OK,EXIT_USAGE,NetworkError,UsageError}from"./chunk-UFND7FBC.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs from"fs";import path from"path";var NO_REDACT_FLAG={name:"--no-redact",summary:"\u5FDC\u7B54\u306E\u4F0F\u5B57\u5316\u3092\u89E3\u9664\u3057\u3066\u751F\u306E\u5024\u3092\u51FA\u3059\uFF08\u9375\u306E\u53D7\u3051\u53D6\u308A\u7B49\uFF09",takesValue:false};var NO_REDACT_NOTICE="\u6CE8\u8A18: --no-redact \u306E\u305F\u3081\u51FA\u529B\u3092\u4F0F\u5B57\u5316\u3057\u307E\u305B\u3093\uFF08\u7AEF\u672B\u3068\u30ED\u30B0\u306B\u5E73\u6587\u3067\u6B8B\u308A\u307E\u3059\uFF09\u3002";function withCommonFlags(flags){return flags.some(flag=>flag.
|
|
3
|
+
import{loadDomain}from"./chunk-B4APKONL.js";import{evaluateQuery}from"./chunk-ATYA6DG5.js";import{renderDocument,renderOutput}from"./chunk-MXKAEPXA.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-AUAZP2G7.js";import{JsonBodyWithView}from"./chunk-Q3B65OFC.js";import{Resolver,requireDefaultProject}from"./chunk-3WHD2YVF.js";import{ResolveError}from"./chunk-GMBJTG6A.js";import{parseOperationArgs}from"./chunk-F7K37QG6.js";import{ApiError,
|
|
4
|
+
MultipartBody,TwpApiClient,appendQuery}from"./chunk-IF2K4PM5.js";import{GLOBAL_OPTIONS_HELP}from"./chunk-YLM54X35.js";import{AuthSession,NotLoggedInError,SessionExpiredError,loadCredentials}from"./chunk-XNLIEUAW.js";import{effectiveApiUrl,loadUserConfig,resolveConfiguredOutput,resolveProfile}from"./chunk-4VZKNEVN.js";import{HELP_TOKEN}from"./chunk-Y5EN7RYN.js";import{OUTPUT_FORMATS,resolveOutputFormat}from"./chunk-K2ONOH3L.js";import{stringWidth}from"./chunk-WVS4W5FY.js";
|
|
5
|
+
import{DEFAULT_MAX_ITEMS,DEFAULT_MAX_PAGES,nextPageNotes,positiveInteger,shellQuote}from"./chunk-IOGMOXYF.js";import{isRecord}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_AUTH,EXIT_FAILURE,EXIT_OK,EXIT_USAGE,NetworkError,UsageError}from"./chunk-UFND7FBC.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import fs from"fs";import path from"path";var NO_REDACT_FLAG={name:"--no-redact",summary:"\u5FDC\u7B54\u306E\u4F0F\u5B57\u5316\u3092\u89E3\u9664\u3057\u3066\u751F\u306E\u5024\u3092\u51FA\u3059\uFF08\u9375\u306E\u53D7\u3051\u53D6\u308A\u7B49\uFF09",takesValue:false};var NO_REDACT_NOTICE="\u6CE8\u8A18: --no-redact \u306E\u305F\u3081\u51FA\u529B\u3092\u4F0F\u5B57\u5316\u3057\u307E\u305B\u3093\uFF08\u7AEF\u672B\u3068\u30ED\u30B0\u306B\u5E73\u6587\u3067\u6B8B\u308A\u307E\u3059\uFF09\u3002";function withCommonFlags(flags){return flags.some(flag=>flag.
|
|
6
6
|
name===NO_REDACT_FLAG.name)?flags:[...flags,NO_REDACT_FLAG]}function alignedList(entries,indent=" "){const width=entries.reduce((max,[left])=>Math.max(max,stringWidth(left)),0);return entries.map(([left,right])=>`${indent}${left}${" ".repeat(Math.max(0,width-stringWidth(left)))} ${right}`).join("\n")}function subresourcesOf(resource){return resource.subresources??[]}function renderResourceHelp(resource,path2){const subresources=subresourcesOf(resource);const operationSection=resource.operations.length===0?"":`
|
|
7
7
|
\u64CD\u4F5C:
|
|
8
8
|
${alignedList(resource.operations.map(op=>[op.name,op.summary]))}
|
|
@@ -24,19 +24,21 @@ return EXIT_AUTH;if(err instanceof ApiError)return exitCodeForStatus(err.status)
|
|
|
24
24
|
Error?err.message:String(err));const rawHint=err instanceof UsageError?err.hint:void 0;const hint=rawHint!==void 0?safeText(rawHint):void 0;if(format==="json"){const body={code,message};if(err instanceof ApiError)body["status"]=err.status;if(err instanceof ResolveError&&err.status!==null)body["status"]=err.status;if(hint!==void 0)body["hint"]=hint;write(`${JSON.stringify({error:body},null,2)}
|
|
25
25
|
`);return}write(`${message}
|
|
26
26
|
`);if(hint!==void 0)write(`${hint}
|
|
27
|
-
`)}function dryRunValue(apiUrl,plan,sensitiveBody){const value={method:plan.method,url:`${apiUrl}${appendQuery(plan.path,plan.query)}`};if(plan.body!==void 0)value["body"]=plan.body instanceof MultipartBody?plan.body.toJSON():plan.body;if(sensitiveBody!==void 0&&isRecord(value["body"])){const hidden=`\uFF08${sensitiveBody}\u305F\u3081\u8868\u793A\u3057\u306A\u3044\u30FB--no-redact \u3067\u8868\u793A\uFF09`;value["body"]=
|
|
28
|
-
async function send(client,apiUrl,plan){try{return await client.request(plan.method,appendQuery(plan.path,plan.query),plan.body)}catch(err){if(err instanceof ApiError||err instanceof NotLoggedInError||err instanceof SessionExpiredError){throw err}throw new NetworkError(`${apiUrl} \u3078\u306E\u901A\u4FE1\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.message}`,{cause:err})}}async function putSigned(fetchImpl,url,bytes,contentType){
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if(!
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
`)}function dryRunValue(apiUrl,plan,sensitiveBody){const value={method:plan.method,url:`${apiUrl}${appendQuery(plan.path,plan.query)}`};if(plan.body!==void 0)value["body"]=plan.body instanceof MultipartBody?plan.body.toJSON():plan.body;if(plan.body instanceof JsonBodyWithView)value["body"]=plan.body.dryRunView();if(sensitiveBody!==void 0&&isRecord(value["body"])){const hidden=`\uFF08${sensitiveBody}\u305F\u3081\u8868\u793A\u3057\u306A\u3044\u30FB--no-redact \u3067\u8868\u793A\uFF09`;value["body"]=
|
|
28
|
+
Object.fromEntries(Object.keys(value["body"]).map(key=>[key,hidden]))}return value}async function send(client,apiUrl,plan){try{return await client.request(plan.method,appendQuery(plan.path,plan.query),plan.body)}catch(err){if(err instanceof ApiError||err instanceof NotLoggedInError||err instanceof SessionExpiredError){throw err}throw new NetworkError(`${apiUrl} \u3078\u306E\u901A\u4FE1\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.message}`,{cause:err})}}async function putSigned(fetchImpl,url,bytes,contentType){
|
|
29
|
+
let res;try{res=await fetchImpl(url,{method:"PUT",headers:{"Content-Type":contentType},body:bytes})}catch(err){throw new NetworkError(`\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.message}`,{cause:err})}if(!res.ok){throw new NetworkError(`\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF08HTTP ${res.status}\uFF09`)}}async function putRange(fetchImpl,url,bytes,start,total){
|
|
30
|
+
let res;try{res=await fetchImpl(url,{method:"PUT",headers:{"Content-Range":`bytes ${start}-${start+bytes.byteLength-1}/${total}`},body:bytes})}catch(err){throw new NetworkError(`\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.message}`,{cause:err})}if(!res.ok){const message=`\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF08HTTP ${res.status}\u30FB${start} \u30D0\u30A4\u30C8\
|
|
31
|
+
\u76EE\u304B\u3089\uFF09`;if(res.status>=400&&res.status<500&&res.status!==408&&res.status!==429)throw new ApiRejectedError(message);throw new NetworkError(message)}const body=await res.json().catch(()=>null);return{status:res.status,body}}async function getSigned(fetchImpl,url){let res;try{res=await fetchImpl(url,{method:"GET"})}catch(err){throw new NetworkError(`\u30B9\u30C8\u30EC\u30FC\u30B8\u304B\u3089\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.
|
|
32
|
+
message}`,{cause:err})}if(!res.ok){throw new NetworkError(`\u30B9\u30C8\u30EC\u30FC\u30B8\u304B\u3089\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF08HTTP ${res.status}\uFF09`)}return{bytes:new Uint8Array(await res.arrayBuffer()),contentType:res.headers.get("content-type")}}function resolveDownloadTarget(spec,commandPath,operationName,input){const raw=input.flags.get(spec.outFlag);if(raw===void 0||raw.trim()===""){throw new UsageError(`${spec.outFlag}\
|
|
33
|
+
\u306F\u5FC5\u9808\u3067\u3059\uFF08twp ${commandPath} ${operationName}\uFF09`,`\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09\u3002`)}return{out:path.resolve(raw.trim()),force:input.flags.has(spec.forceFlag)}}function assertWritableTarget(target,forceFlag){if(!target.force&&fs.existsSync(target.out)){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308A\u307E\u3059: ${target.
|
|
34
|
+
out}`,`\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 ${forceFlag} \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\uFF09\u3002`)}const dir=path.dirname(target.out);if(!fs.existsSync(dir)){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u3042\u308A\u307E\u305B\u3093: ${dir}`,"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u4F5C\u3063\u3066\u304B\u3089\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u81EA\u52D5\u3067\u306F\u4F5C\u6210\u3057\u307E\u305B\u3093\uFF09\u3002")}}
|
|
35
|
+
async function download(args){let received;if(args.signed!==void 0){const url=args.signed.signedUrl(await send(args.client,args.apiUrl,args.plan),args.plan);received=await getSigned(args.signed.fetchImpl,url)}else{try{received=await args.client.requestBinary(args.plan.method,appendQuery(args.plan.path,args.plan.query))}catch(err){if(err instanceof ApiError||err instanceof NotLoggedInError||err instanceof SessionExpiredError)throw err;throw new NetworkError(`${args.apiUrl} \u3078\u306E\u901A\u4FE1\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.
|
|
36
|
+
message}`,{cause:err})}}try{fs.writeFileSync(args.target.out,received.bytes,{flag:args.target.force?"w":"wx"})}catch(err){const code=err.code;if(code==="EEXIST"){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308A\u307E\u3059: ${args.target.out}`,"\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 --force \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002")}throw new Error(`\u66F8\u304D\u51FA\u3057\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${args.target.out}\uFF09: ${err.
|
|
37
|
+
message}`,{cause:err})}const captured={};for(const name of args.captureHeaders??[]){const value=received.headers?.get(name);if(typeof value==="string")captured[name]=value}return{path:args.target.out,size:received.bytes.byteLength,contentType:received.contentType,...Object.keys(captured).length>0?{headers:captured}:{}}}function resumeHint(vocabulary,cursor){return vocabulary.resume!==void 0?vocabulary.resume(cursor):`${vocabulary.resumeFlag} ${shellQuote(cursor)}`}var CURATED_PAGING_VOCABULARY={
|
|
38
|
+
mode:"--all",resumeFlag:"--cursor",capAdvice:"--limit \u3092\u5927\u304D\u304F\u3057\u3066\u5F80\u5FA9\u3092\u6E1B\u3089\u3059\u304B\u3001--max-pages / --max-items \u3092\u4E0A\u3052\u3066\u304F\u3060\u3055\u3044\u3002"};function capExceeded(vocabulary,reason,pages,count,cursor){return new UsageError(`${vocabulary.mode} \u304C\u4E0A\u9650\u306B\u9054\u3057\u305F\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\uFF08${reason}\uFF0F${pages} \u30DA\u30FC\u30B8\u30FB${count} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`,
|
|
39
|
+
`${vocabulary.capAdvice}\u7D9A\u304D\u3060\u3051\u3092\u53D6\u308B\u306A\u3089 ${resumeHint(vocabulary,cursor)} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059`)}async function fetchAllPages(args){const{paging,maxPages,maxItems}=args;const vocabulary=args.vocabulary??CURATED_PAGING_VOCABULARY;const merged=[];const cursorParam=paging.cursorParamFor?.(args.plan)??paging.cursorParam;const first=args.plan.query?.[cursorParam];let sent=typeof first==="string"?first:"";let scanTruncated=false;for(let page=1;;page+=
|
|
40
|
+
1){const plan=page===1?args.plan:{...args.plan,query:{...args.plan.query,[cursorParam]:sent}};let body;try{body=page===1&&"firstPage"in args?args.firstPage:await send(args.client,args.apiUrl,plan)}catch(err){if(page>1){(args.warn??writeErr)(`${vocabulary.mode} \u306F ${page} \u30DA\u30FC\u30B8\u76EE\u3067\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${page-1} \u30DA\u30FC\u30B8\u30FB${merged.length} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u7D9A\u304D\u306F ${resumeHint(
|
|
41
|
+
vocabulary,stripTerminalControls(sent))} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059\u3002
|
|
40
42
|
`)}throw err}for(const item of paging.items(body))merged.push(item);if(typeof body==="object"&&body!==null&&body["scan_truncated"]===true)scanTruncated=true;const next=paging.nextCursor(body);if(next===null){const combined=paging.withItems(body,merged);const flagged=scanTruncated&&typeof combined==="object"&&combined!==null&&!Array.isArray(combined)?{...combined,scan_truncated:true}:combined;return{body:flagged,pages:page,count:merged.length}}if(merged.length>=maxItems)throw capExceeded(vocabulary,
|
|
41
43
|
`\u6700\u5927\u4EF6\u6570 ${maxItems} \u4EF6`,page,merged.length,next);if(page>=maxPages)throw capExceeded(vocabulary,`\u6700\u5927\u30DA\u30FC\u30B8\u6570 ${maxPages}`,page,merged.length,next);if(next===sent){throw new ApiResponseError(`\u540C\u3058\u30AB\u30FC\u30BD\u30EB\uFF08${next}\uFF09\u304C\u7E70\u308A\u8FD4\u3057\u8FD4\u3055\u308C\u305F\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002${merged.length} \u4EF6\u3092\u53D6\u5F97\u3057\u305F\u6642\u70B9\u3067\u3001\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`)}
|
|
42
44
|
sent=next}}function resolvePaging(operation,path2,input){const all=input.flags.has("--all");const maxPages=positiveInteger(input.flags,"--max-pages")??DEFAULT_MAX_PAGES;const maxItems=positiveInteger(input.flags,"--max-items")??DEFAULT_MAX_ITEMS;positiveInteger(input.flags,"--limit");if(all&&operation.paging===void 0){throw new UsageError(`twp ${path2} ${operation.name} \u306F --all \u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093`)}for(const name of["--max-pages","--max-items"]){if(!all&&
|
|
@@ -53,7 +55,7 @@ d \u3068\u540C\u6642\u306B\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\uFF08\u914D
|
|
|
53
55
|
void 0||plan.method==="GET")){throw new Error(`twp ${path2} ${operation.name}: invalidates \u306F\u66F8\u304D\u8FBC\u307F\u306E\u64CD\u4F5C\u306B\u3060\u3051\u5BA3\u8A00\u3067\u304D\u307E\u3059\uFF08\u914D\u7DDA\u306E\u8AA4\u308A\uFF09`)}if(operation.fetchCached!==void 0&&(operation.download!==void 0||operation.paging!==void 0||operation.destructive===true||plan.method!=="GET")){throw new Error(`twp ${path2} ${operation.name}: fetchCached \u306F\u9001\u4FE1\u3057\u306A\u3044\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u306E\u64CD\u4F5C\u306B\u3060\u3051\u5BA3\u8A00\u3067\u304D\u307E\u3059\uFF08\u914D\u7DDA\u306E\u8AA4\u308A\uFF09`)}
|
|
54
56
|
for(const note of operation.plannedNotes?.(prepared)??[])errOut(`${safeText(note)}
|
|
55
57
|
`);if(noRedact)errOut(`${NO_REDACT_NOTICE}
|
|
56
|
-
`);if(globals.dryRun){out(line(renderOutput(dryRunValue(apiUrl,plan,noRedact?void 0:operation.sensitiveBody),format,noRedact)));return EXIT_OK}let body;let paged;try{if(operation.execute!==void 0){const executeCtx={send:next=>send(client,apiUrl,next),putSigned:(url,bytes,contentType)=>putSigned(fetchImpl,url,bytes,contentType),warn:text=>errOut(`${safeText(text)}
|
|
58
|
+
`);if(globals.dryRun){out(line(renderOutput(dryRunValue(apiUrl,plan,noRedact?void 0:operation.sensitiveBody),format,noRedact)));return EXIT_OK}let body;let paged;try{if(operation.execute!==void 0){const executeCtx={send:next=>send(client,apiUrl,next),putSigned:(url,bytes,contentType)=>putSigned(fetchImpl,url,bytes,contentType),putRange:(url,bytes,start,total)=>putRange(fetchImpl,url,bytes,start,total),warn:text=>errOut(`${safeText(text)}
|
|
57
59
|
`)};body=await operation.execute(prepared,executeCtx)}else if(operation.fetchCached!==void 0){body=await operation.fetchCached(prepared,ctx)}else if(operation.download!==void 0&&downloadTarget!==void 0){assertWritableTarget(downloadTarget,operation.download.forceFlag);const signedUrl=operation.download.signedUrl;body=await download({client,apiUrl,plan,target:downloadTarget,...signedUrl===void 0?{}:{signed:{fetchImpl,signedUrl}},...operation.download.captureHeaders===void 0?{}:{captureHeaders:operation.
|
|
58
60
|
download.captureHeaders}})}else if(paging.all&&operation.paging!==void 0){paged=await fetchAllPages({client,apiUrl,plan,paging:operation.paging,maxPages:paging.maxPages,maxItems:paging.maxItems,warn:errOut});body=paged.body}else{body=await send(client,apiUrl,plan)}}finally{try{operation.invalidates?.(prepared,ctx)}catch{}}if(operation.narrow!==void 0)body=operation.narrow(body,prepared);if(paged!==void 0&&operation.paging!==void 0){paged={...paged,count:operation.paging.items(body).length}}const visible=noRedact?
|
|
59
61
|
body:redactSecretValues(body);const document=globals.query===void 0&&format==="text"&&operation.document!==void 0?operation.document(visible):void 0;const value=document!==void 0?void 0:globals.query!==void 0?await evaluateQuery(globals.query,operation.raw(visible)):outputValue(operation,format,visible);out(line(document!==void 0?renderDocument(document,noRedact):renderOutput(value,format,noRedact)));if(paged!==void 0){errOut(`--all: ${paged.pages} \u30DA\u30FC\u30B8\u3092\u8FBF\u3063\u3066 ${paged.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{booleanText,boundedText,isoDate}from"./chunk-XDHLO54T.js";import{ORG_MASTER_LIMIT}from"./chunk-
|
|
3
|
+
import{booleanText,boundedText,isoDate}from"./chunk-XDHLO54T.js";import{ORG_MASTER_LIMIT}from"./chunk-3WHD2YVF.js";import{ULID_RE,UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import{nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";var CLEAR_DATE="none";function placeholderOf(field){switch(field.kind){case"text":return`<${field.label}>`;case"integer":return"<\u6574\u6570>";case"boolean":return"<true|false>";case"enum":return`<${field.values.join("|")}>`;case"date":return`<YYYY-MM-DD|${CLEAR_DATE}>`;case"ref":return field.placeholder}}function createFlags(fields){return fields.map(field=>({name:field.flag,summary:field.summary,takesValue:true,placeholder:placeholderOf(field)}))}function updateFlags(fields){const flags=[];for(const field of fields){
|
|
4
4
|
flags.push({name:field.flag,summary:field.summary,takesValue:true,placeholder:placeholderOf(field)});if(field.kind==="ref")flags.push({name:field.clearFlag,summary:field.clearSummary,takesValue:false})}return flags}function integerValue(field,raw){const trimmed=raw.trim();const value=/^\d+$/.test(trimmed)?Number(trimmed):Number.NaN;const tooLarge=field.max!==void 0&&value>field.max;if(!Number.isSafeInteger(value)||value<field.min||tooLarge){const range=field.max!==void 0?`${field.min} \u4EE5\u4E0A ${field.
|
|
5
5
|
max} \u4EE5\u4E0B`:`${field.min} \u4EE5\u4E0A`;throw new UsageError(`${field.flag} \u306F ${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`,`${field.label}\u3092\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return value}function fieldBody(input,fields){const body={};for(const field of fields){switch(field.kind){case"text":{const value=boundedText(input,field.flag,{maxChars:field.maxChars,label:field.label});if(value!==void 0)body[field.
|
|
6
6
|
key]=value;break}case"integer":{const raw=input.flags.get(field.flag);if(raw!==void 0)body[field.key]=integerValue(field,raw);break}case"boolean":{const raw=input.flags.get(field.flag);if(raw!==void 0)body[field.key]=booleanText(field.flag,raw);break}case"enum":{const raw=input.flags.get(field.flag);if(raw===void 0)break;const value=raw.trim().toLowerCase();if(!field.values.includes(value)){throw new UsageError(`${field.flag} \u306B\u300C${raw}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{isoDate}from"./chunk-XDHLO54T.js";import{
|
|
3
|
+
import{isoDate}from"./chunk-XDHLO54T.js";import{SALES_ESTIMATES_PATH,SALES_INVOICES_PATH,isExactNumericId,resolveNamed}from"./chunk-3WHD2YVF.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-IOGMOXYF.js";import{withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{
|
|
4
4
|
ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";var ESTIMATE_STATUSES={new:"\u4F5C\u6210\u4E2D",create_completed:"\u4F5C\u6210\u5B8C\u4E86",in_progress:"\u7533\u8ACB\u4E2D",approved:"\u627F\u8A8D\u6E08",submitted:"\u63D0\u793A\u6E08",rejected:"\u5DEE\u3057\u623B\u3057",deleted:"\u524A\u9664\u6E08"};var INVOICE_STATUSES={new:"\u4F5C\u6210\u4E2D",create_completed:"\u4F5C\u6210\u5B8C\u4E86",in_progress:"\u7533\u8ACB\u4E2D",approved:"\u627F\u8A8D\u6E08",rejected:"\u5DEE\u3057\u623B\u3057",submitted:"\u63D0\u793A\u6E08",manager_confirmation:"\u6848\u4EF6\u62C5\u5F53\u8005\
|
|
5
5
|
_\u6848\u4EF6\u5185\u5BB9\u30FB\u91D1\u984D\u78BA\u8A8D",invoice_issued:"\u8ACB\u6C42\u66F8\u767A\u884C\u6E08",sent_to_client:"\u5148\u65B9\u9001\u4ED8\u6E08",archived:"\u4FDD\u7BA1\u6E08",deleted:"\u524A\u9664\u6E08",cancelled:"\u53D6\u6D88\uFF08\u7121\u52B9\uFF09",lost:"\u5931\u6CE8"};var ALLOCATION_STATUSES={unallocated:"\u672A\u56DE\u53CE",allocated:"\u56DE\u53CE\u6E08"};function statusRefs(table){return Object.entries(table).map(([code,name])=>({id:code,name,code}))}function statusHelp(table){
|
|
6
6
|
return Object.entries(table).map(([code,name])=>`${code}\uFF08${name}\uFF09`).join(" / ")}function licenseForbidden(guidance){return body=>body?.error==="permission_denied"?guidance:void 0}function featureLicenseGuidance(feature){return`${feature}\u3092\u4F7F\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30C6\u30CA\u30F3\u30C8\u304C${feature}\u3092\u5951\u7D04\u3057\u3066\u3044\u306A\u3044\u304B\u3001\u3042\u306A\u305F\u306E${feature}\u306E\u6A29\u9650\u304C\u300C\u306A\u3057\u300D\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`}
|