@tocca-systems/twp-cli 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.public.md +16 -0
  2. package/README.md +59 -9
  3. package/dist/{agent-loop-RMJXHBNG.js → agent-loop-XKH5YE6A.js} +1 -1
  4. package/dist/{ai-dispatch-L6XZCCU4.js → ai-dispatch-FGVNSM6L.js} +2 -2
  5. package/dist/{analysis-KUCETWIJ.js → analysis-GAU2A3FU.js} +1 -1
  6. package/dist/{api-command-67456PBS.js → api-command-26MLBIZC.js} +2 -2
  7. package/dist/{app-7227DY7N.js → app-Y7MAQAPC.js} +2 -2
  8. package/dist/attendance-correct-5SFXA4DC.js +51 -0
  9. package/dist/{attendance-lists-NVRU2NLY.js → attendance-lists-3T7S7QF5.js} +1 -1
  10. package/dist/{backlog-XZB35X7I.js → backlog-F4EWY7MT.js} +1 -1
  11. package/dist/{budget-FOFE3YUJ.js → budget-QFUGQIPZ.js} +1 -1
  12. package/dist/{chunk-3WHD2YVF.js → chunk-4F2ONF4P.js} +35 -25
  13. package/dist/{chunk-OLBRIPOS.js → chunk-6TPGATAG.js} +1 -1
  14. package/dist/chunk-6ZB7A6VD.js +9 -0
  15. package/dist/{chunk-SBWCQAHT.js → chunk-A65V3K75.js} +1 -1
  16. package/dist/{chunk-QVZGNHRE.js → chunk-BN26WHLS.js} +1 -1
  17. package/dist/{chunk-N6AXAGS2.js → chunk-EZGN7PTO.js} +1 -1
  18. package/dist/{chunk-OVBKORPC.js → chunk-FZWRYJVM.js} +1 -1
  19. package/dist/{chunk-V24LKF3V.js → chunk-GOZCJLRA.js} +1 -1
  20. package/dist/{chunk-AKPVALTZ.js → chunk-IO5SMECE.js} +1 -1
  21. package/dist/{chunk-JYNZEZYL.js → chunk-JKL6NUVV.js} +1 -1
  22. package/dist/{chunk-G2THOTBW.js → chunk-JTJWDV5U.js} +1 -1
  23. package/dist/{chunk-HS7EKE7M.js → chunk-KS2ZUQFC.js} +1 -1
  24. package/dist/{chunk-ZE75ZDLD.js → chunk-LAXINIDA.js} +1 -1
  25. package/dist/{chunk-L25UV7DE.js → chunk-LUQ2KE6Y.js} +1 -1
  26. package/dist/{chunk-E7MUDY4P.js → chunk-MY2U3CD6.js} +1 -1
  27. package/dist/{chunk-EZMXGIGX.js → chunk-OYDF57NH.js} +1 -1
  28. package/dist/{chunk-YLXW7TIU.js → chunk-QOUDJ7XO.js} +18 -18
  29. package/dist/{chunk-ZM3MTWNT.js → chunk-SA7A5WF2.js} +1 -1
  30. package/dist/{chunk-AITUMFCH.js → chunk-TKGVAWGU.js} +1 -1
  31. package/dist/{chunk-L7IGGC7H.js → chunk-VB2CSFRO.js} +1 -1
  32. package/dist/{chunk-RMAW7KOR.js → chunk-VYT6JAXQ.js} +12 -9
  33. package/dist/{chunk-VMULCEHY.js → chunk-XQRSX2RH.js} +1 -1
  34. package/dist/cli.js +43 -7
  35. package/dist/{commands-5GP3REIU.js → commands-EIWS357Q.js} +44 -41
  36. package/dist/{company-FEXAHUPT.js → company-77JEESSV.js} +2 -2
  37. package/dist/{contract-4RALZBO5.js → contract-26SKL7XT.js} +1 -1
  38. package/dist/{department-VEXXWBZ4.js → department-IZAR2LZ4.js} +1 -1
  39. package/dist/{deposit-2AAST2DE.js → deposit-MYTKRIEX.js} +1 -1
  40. package/dist/{estimate-JQURFOCH.js → estimate-KLS7XJLD.js} +2 -2
  41. package/dist/{inquiry-YTYZYUTY.js → inquiry-52OT4HKJ.js} +1 -1
  42. package/dist/{invoice-PHYBVU6Q.js → invoice-D77PS3WU.js} +2 -2
  43. package/dist/{job-title-ORNY7A7L.js → job-title-U67Z25ZO.js} +1 -1
  44. package/dist/{knowledge-FQ32UNDW.js → knowledge-Q3QLSNDX.js} +1 -1
  45. package/dist/{leave-5V6EPGA3.js → leave-OSIABEFV.js} +1 -1
  46. package/dist/media-HDG4VHAR.js +125 -0
  47. package/dist/{notification-XARS6JH2.js → notification-MEOHWBXH.js} +1 -1
  48. package/dist/{onedrive-N4T6D2OW.js → onedrive-3OBI4B5Z.js} +15 -11
  49. package/dist/{oneshot-7BFL2VON.js → oneshot-ACV6XH5A.js} +1 -1
  50. package/dist/{position-NNJZAT3A.js → position-N7SRF3CF.js} +1 -1
  51. package/dist/{project-FDY6LETQ.js → project-YMJJDSTP.js} +1 -1
  52. package/dist/{prospect-CUWP3E5S.js → prospect-3JD7STGT.js} +1 -1
  53. package/dist/{purchase-2CZTB5H7.js → purchase-2SLZBDD6.js} +2 -2
  54. package/dist/{receivable-KV5PPNLA.js → receivable-6ZRAUHC3.js} +1 -1
  55. package/dist/{registry-NZ2HNT52.js → registry-GQ3L7PZ2.js} +1 -1
  56. package/dist/report-TUSP7RRF.js +127 -0
  57. package/dist/{run-7BS34D2P.js → run-ZPB23AZX.js} +1 -1
  58. package/dist/{sales-ai-review-SVZHVH5P.js → sales-ai-review-7NPG7KV6.js} +1 -1
  59. package/dist/{sales-master-VD6JE2P3.js → sales-master-W5MXNZQ2.js} +1 -1
  60. package/dist/{sales-numbering-P7W6N3OM.js → sales-numbering-RQV2I5G5.js} +1 -1
  61. package/dist/{schedule-command-7JGQMTQY.js → schedule-command-QCGEMBVR.js} +1 -1
  62. package/dist/{server-settings-3E7G56G7.js → server-settings-TUBJ4P57.js} +1 -1
  63. package/dist/{server-skills-OF7USNRM.js → server-skills-Z5DGCJQ7.js} +1 -1
  64. package/dist/{supplier-payment-2KPCVEPH.js → supplier-payment-TDL3IE4H.js} +1 -1
  65. package/dist/{task-MFWWP5Q7.js → task-2SHYSZBZ.js} +35 -30
  66. package/dist/{user-QG3KMK3T.js → user-YEIHSVVN.js} +2 -2
  67. package/dist/{workflow-CSYU4J4U.js → workflow-USG3ZKW6.js} +1 -1
  68. package/package.json +1 -1
  69. package/dist/attendance-K2U7RYDU.js +0 -3
  70. package/dist/chunk-B4APKONL.js +0 -9
  71. package/dist/media-BU23L547.js +0 -63
  72. package/dist/report-PCQPTRUV.js +0 -73
@@ -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}from"./chunk-XDHLO54T.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-3WHD2YVF.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{
3
+ import{booleanText,boundedText}from"./chunk-XDHLO54T.js";import{INQUIRY_CATEGORIES_PATH}from"./chunk-4F2ONF4P.js";import{UUID_RE,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{
4
4
  isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA";var LIST_COLUMNS=["id","category_code","title","sort","is_active","notification_user_count"];var GET_COLUMNS=["id","category_code","title","description","sort","is_active","notification_users"];var FORBIDDEN=`\u7BA1\u7406\u8005\u306E\u6A29\u9650\u304C\u5FC5\u8981\u3067\u3059\u3002${LABEL}\u306E\u8A73\u7D30\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u306F\u554F\u3044\u5408\u308F\u305B\u6A5F\u80FD\u306E\u7BA1\u7406\u8005\u3060\u3051\u304C\u884C\u3048\u307E\u3059`;
5
5
  var SORT_LAST="last";var CODE_RE=/^[a-zA-Z0-9_-]+$/;var REF_HELP="<\u30AB\u30C6\u30B4\u30EA> \u306F\u30AB\u30C6\u30B4\u30EA\u30B3\u30FC\u30C9\u30FB\u540D\u524D\uFF08title\uFF09\u30FBID \u306E\u3069\u308C\u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF08\u540D\u524D\u304C\u8907\u6570\u306B\u4E00\u81F4\u3059\u308C\u3070\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002\nID \u4EE5\u5916\u306F\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\uFF08\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3068\u7167\u5408\u3057\u307E\u3059\u3002";
6
6
  var NOTIFY_HELP="--notify \u306F\u901A\u77E5\u5148\u306E\u30E6\u30FC\u30B6\u30FC\u3067\u3001\u8907\u6570\u56DE\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u30E6\u30FC\u30B6\u30FC\u306F ID\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30FB\u793E\u54E1\u756A\u53F7\u30FB\u6C0F\u540D\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\n\uFF08ID \u4EE5\u5916\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3068\u7167\u5408\u3057\u307E\u3059\u3002\u7D44\u7E54\u7BA1\u7406\u8005\u3067\u306A\u3044\u5834\u5408\u306F ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{invoiceNoRuleResource}from"./chunk-EZMXGIGX.js";import{invoiceAiReviewResources}from"./chunk-OVBKORPC.js";import{invoicePdfOperation}from"./chunk-L7IGGC7H.js";import"./chunk-QVZGNHRE.js";import"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,invoiceFilters,invoiceReadOperations,licenseForbidden}from"./chunk-V24LKF3V.js";import{booleanText,isoDate}from"./chunk-XDHLO54T.js";import{readBody}from"./chunk-ORUDW52G.js";import{SALES_INVOICES_PATH,
4
- SALES_INVOICE_AUTO_TEMPLATES_PATH,isExactNumericId,resolveNamed}from"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";import"./chunk-XNLIEUAW.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,
3
+ import{invoiceNoRuleResource}from"./chunk-OYDF57NH.js";import{invoiceAiReviewResources}from"./chunk-FZWRYJVM.js";import{invoicePdfOperation}from"./chunk-VB2CSFRO.js";import"./chunk-BN26WHLS.js";import"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,invoiceFilters,invoiceReadOperations,licenseForbidden}from"./chunk-GOZCJLRA.js";import{booleanText,isoDate}from"./chunk-XDHLO54T.js";import{readBody}from"./chunk-ORUDW52G.js";import{SALES_INVOICES_PATH,
4
+ SALES_INVOICE_AUTO_TEMPLATES_PATH,isExactNumericId,resolveNamed}from"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";import"./chunk-XNLIEUAW.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,nonEmpty,
5
5
  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";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var PATH=SALES_INVOICE_AUTO_TEMPLATES_PATH;var HISTORY_SEARCH_PATH="/api/v2/sales/invoice-auto-issue-histories";var FORMATS_PATH="/api/v2/sales/estimate-formats";function adminForbidden(body){return body?.error==="permission_denied"?featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"):"\u81EA\u52D5\u8ACB\u6C42\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3068\u767A\u884C\u5C65\u6B74\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u306E\u4EBA\u3060\u3051\u304C\u6271\u3048\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}
6
6
  var CONTENT_KEYS=["template_name","estimate_format_id","interval_months","next_issue_date","period_start_date","period_end_date","payment_term_months","payment_term_day","estimate_expiration_months","estimate_expiration_day","order_acceptance_months","order_acceptance_day","invoice_date_months","invoice_date_day","estimate_business_place_id","estimate_seal_impression_id","invoice_business_place_id","invoice_seal_impression_id","company_id","project_id","payee_id","estimate_user_id","invoice_user\
7
7
  _id","detail","memo","template_memo","notification_user_ids","estimate_manage_content","invoice_manage_content","is_active"];var DETAIL_KEYS=["list"];var DETAIL_ROW_KEYS=["title","price","quantity","unit","tax","delivery_date"];var NOT_SAVED_KEYS=["period_start_months","period_start_day","period_end_months","period_end_day"];var FIELD_NOTES=[["template_name","\u4F5C\u6210\u3067\u5FC5\u9808\u3002\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u540D\uFF08255 \u6587\u5B57\u307E\u3067\uFF09"],["estimate_format\
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{STATUS_VALUES,flatMasterDomain}from"./chunk-SBWCQAHT.js";import"./chunk-XDHLO54T.js";import{JOB_TITLES_PATH}from"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";
3
+ import{STATUS_VALUES,flatMasterDomain}from"./chunk-A65V3K75.js";import"./chunk-XDHLO54T.js";import{JOB_TITLES_PATH}from"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";
4
4
  import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var jobTitleDomain=flatMasterDomain({name:"job-title",label:"\u8077\u4F4D",path:JOB_TITLES_PATH,itemKey:"job_title",summary:"\u8077\u4F4D\u30DE\u30B9\u30BF\uFF08\u4E00\u89A7\u30FB\u53D6\u5F97\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",listColumns:["id","code","name","sort_order","status","position_id","base_selling_price","base_cost_price"],getColumns:["id","code","name","name_short","sort_order","status","position_id","base_selling_price","base_cost_price","description"],fields:[
5
5
  {kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,summary:"\u7565\u79F0"},{kind:"integer",flag:"--sort-order",key:"sort_order",label:"\u8868\u793A\u9806",min:0,max:9999,summary:"\u8868\u793A\u9806\uFF080\u301C9999\uFF09"},{kind:"enum",flag:"--status",key:"status",values:STATUS_VALUES,summary:"\u72B6\u614B\uFF08active: \u6709\u52B9 / inactive: \u7121\u52B9\uFF09"},{kind:"text",flag:"--description",key:"description",label:"\u8AAC\u660E",maxChars:1e3,summary:"\u8AAC\u660E"},
6
6
  {kind:"integer",flag:"--base-selling-price",key:"base_selling_price",label:"\u57FA\u6E96\u58F2\u4FA1",min:0,summary:"\u57FA\u6E96\u58F2\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"integer",flag:"--base-cost-price",key:"base_cost_price",label:"\u57FA\u6E96\u539F\u4FA1",min:0,summary:"\u57FA\u6E96\u539F\u4FA1\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09"},{kind:"text",flag:"--skill-requirements",key:"skill_requirements",label:"\u30B9\u30AD\u30EB\u8981\u4EF6",maxChars:5e3,summary:"\u30B9\u30AD\u30EB\u8981\u4EF6"},
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{dateFlag}from"./chunk-4B3T4UE7.js";import{boundedText}from"./chunk-XDHLO54T.js";import"./chunk-3WHD2YVF.js";import{ResolveError,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";
3
+ import{dateFlag}from"./chunk-4B3T4UE7.js";import{boundedText}from"./chunk-XDHLO54T.js";import"./chunk-4F2ONF4P.js";import{ResolveError,isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";
4
4
  import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var MAX_BLOCK_DEPTH=10;var NAMED_ENTITIES={nbsp:" ",lt:"<",gt:">",quot:'"',apos:"'",amp:"&"};function decodeEntities(text2){return text2.replace(/&(#x[0-9a-f]{1,8}|#\d{1,8}|[a-z]{1,8});/gi,(whole,ref)=>{if(ref.startsWith("#")){const code=ref[1]==="x"||ref[1]==="X"?Number.parseInt(ref.slice(2),16):Number.parseInt(ref.slice(1),10);return Number.isInteger(code)&&code>0&&code<=1114111?String.fromCodePoint(code):whole}return NAMED_ENTITIES[ref.toLowerCase()]??whole})}var HTML_TAG_NAMES=new Set(["a","\
5
5
  abbr","article","aside","audio","b","blockquote","body","br","caption","cite","code","col","colgroup","dd","del","details","div","dl","dt","em","figcaption","figure","font","footer","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","li","main","mark","meta","nav","ol","p","pre","q","s","samp","script","section","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","tfoot","th","thead","title","tr","u","\
6
6
  ul","var","video"]);var ATTRIBUTES=/^(?:\s+[a-z_:][-\w:.]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?$/i;function tokenizeHtml(html){const tokens=[];let text2="";let i=0;let nextLt=html.indexOf("<");let nextGt=-2;while(nextLt!==-1){text2+=html.slice(i,nextLt);if(nextGt===-2||nextGt!==-1&&nextGt<nextLt)nextGt=html.indexOf(">",nextLt);const following=html.indexOf("<",nextLt+1);if(nextGt===-1||following!==-1&&following<nextGt){text2+="<";i=nextLt+1;nextLt=following;continue}const inner=html.
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{USER_REF_FLAG,USER_REF_HELP,userPath}from"./chunk-IXFMXUNT.js";import{applyInstancePlan,createInstancePlan,formColumns,writtenInstance}from"./chunk-OLBRIPOS.js";import{assertMonthsOpen}from"./chunk-YLXW7TIU.js";import{dateFlag}from"./chunk-4B3T4UE7.js";import"./chunk-ORUDW52G.js";import"./chunk-3WHD2YVF.js";import{UUID_RE}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{NotLoggedInError,
3
+ import{USER_REF_FLAG,USER_REF_HELP,userPath}from"./chunk-IXFMXUNT.js";import{applyInstancePlan,createInstancePlan,formColumns,writtenInstance}from"./chunk-6TPGATAG.js";import{assertMonthsOpen}from"./chunk-QOUDJ7XO.js";import{dateFlag}from"./chunk-4B3T4UE7.js";import"./chunk-ORUDW52G.js";import"./chunk-4F2ONF4P.js";import{UUID_RE}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{NotLoggedInError,
4
4
  SessionExpiredError}from"./chunk-XNLIEUAW.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LIST_USAGE="twp leave list";var GRANTS_USAGE="twp leave grants [<\u30E6\u30FC\u30B6\u30FC> | --user <\u30E6\u30FC\u30B6\u30FC>]";var USAGE_COLUMNS=["used_date","type_label","days","hours","status_label","reason","is_post_application","id"];var GRANT_COLUMNS=["grant_date","type_label","days","remaining_days","remaining_hours","expiry_date","status_label","reason","id"];function noArgs(input,operation){if(input.args.length>0){throw new UsageError(`${operation} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.
5
5
  args.join(" ")}`,`twp leave ${operation} help`)}}function summaryBody(body){if(!isRecord(body)||!isRecord(body["summary"])){throw new ApiResponseError("\u6709\u7D66\u30B5\u30DE\u30EA\u306E\u5FDC\u7B54\u306B summary \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function usagesBody(body){if(!isRecord(body)||!Array.isArray(body["usages"])){throw new ApiResponseError("\u6709\u7D66\u306E\u53D6\u5F97\u5C65\u6B74\u306E\u5FDC\u7B54\u306B usages \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
6
6
  return body}function grantsBody(body){if(!isRecord(body)||!Array.isArray(body["grants"])){throw new ApiResponseError("\u6709\u7D66\u306E\u4ED8\u4E0E\u5C65\u6B74\u306E\u5FDC\u7B54\u306B grants \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return body}function listBody(body){const combined=isRecord(body)?body:{};return{summary:summaryBody(combined["summary"]),usages:usagesBody(combined["usages"])}}async function list(input,ctx){
@@ -0,0 +1,125 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{contentTypeFor,inspectLocalFile}from"./chunk-HNUBM24L.js";import{checkUploadQuota}from"./chunk-2YNZ4MRT.js";import"./chunk-4F2ONF4P.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-GY7KI5E5.js";import"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger,readEnvelopeCursor}from"./chunk-IOGMOXYF.js";
4
+ import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import crypto from"crypto";import fs from"fs";import path from"path";var SCOPE_PERSONAL="personal";var SCOPE_PROJECT="project";var UUID=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var FORBIDDEN_NAME=/[/\\:*?"<>|]/;var NAME_MAX=255;var ROW_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","updated_at"];var TRASH_COLUMNS=["id","path","name","file_count","subfolder_count","parent_id","deleted_at"];function folderRows(raw){return raw.map(row=>{const id=row["id"];const name=row["name"];const parentId=row["parent_id"];if(typeof id!==
5
+ "string"||typeof name!=="string"||parentId!==null&&parentId!==void 0&&typeof parentId!=="string"){throw new ApiResponseError("\u30E1\u30C7\u30A3\u30A2\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u884C\u306B id / name / parent_id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}const path2=typeof row["path"]==="string"?row["path"]:`/${name}`;return{id,name,parentId:parentId??null,path:path2}})}function resolveFolderPath(rows,input){
6
+ const segments=folderPathSegments(input);const ids=new Set(rows.map(row=>row.id));const isTop=row=>row.parentId===null||!ids.has(row.parentId);let level=rows.filter(isTop);let walked="";for(const[index,segment]of segments.entries()){const hits=level.filter(row=>row.name===segment);const here=walked===""?"\u6700\u4E0A\u4F4D":`\u300C${walked}\u300D\u306E\u4E0B`;if(hits.length===0){const names=level.map(row=>row.name);throw new UsageError(`\u30D5\u30A9\u30EB\u30C0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${input}\
7
+ \uFF08${here}\u306B\u300C${segment}\u300D\u304C\u3042\u308A\u307E\u305B\u3093\uFF09`,names.length===0?`${here}\u306B\u30D5\u30A9\u30EB\u30C0\u306F\u3042\u308A\u307E\u305B\u3093\u3002`:`${here}\u306B\u3042\u308B\u30D5\u30A9\u30EB\u30C0: ${listNames(names)}`)}if(hits.length>1){throw new UsageError(`\u30D5\u30A9\u30EB\u30C0\u300C${input}\u300D\u306B\u5F53\u305F\u308B\u3082\u306E\u304C ${hits.length} \u4EF6\u3042\u308A\u307E\u3059\uFF08${here}\u306B\u300C${segment}\u300D\u304C\u8907\u6570\u3042\u308A\u307E\u3059\uFF09`,
8
+ `ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${hits.map(row=>`${row.id}\uFF08${row.path}\uFF09`).join(" / ")}`)}const hit=hits[0];if(index===segments.length-1)return hit;walked=walked===""?segment:`${walked}/${segment}`;level=rows.filter(row=>row.parentId===hit.id)}throw new Error("resolveFolderPath: \u5230\u9054\u3057\u306A\u3044")}function folderPathSegments(input){const segments=input.replace(/^\/+/,"").replace(/\/+$/,"").split("/");if(segments.some(segment=>segment==="")){throw new UsageError(
9
+ `\u30D5\u30A9\u30EB\u30C0\u306E\u30D1\u30B9\u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${input}`,"\u300C\u89AA/\u5B50/\u5B6B\u300D\u306E\u5F62\u3067\u3001\u7A7A\u306E\u968E\u5C64\u3092\u542B\u3081\u305A\u306B\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08ID \u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\uFF09\u3002")}return segments}function listNames(names,limit=10){const shown=names.slice(0,limit).join(" / ");return names.length>limit?`${shown} \u2026\uFF08\u5168 ${names.length} \u4EF6\uFF09`:
10
+ shown}function descendantsOf(rows,root){const result=[];const queue=[root];const seen=new Set(queue);while(queue.length>0){const parent=queue.shift();for(const row of rows){if(row.parentId===parent&&!seen.has(row.id)){seen.add(row.id);result.push(row);queue.push(row.id)}}}return result}function depthOf(byId,row){let depth=0;let current=row;const seen=new Set([row.id]);while(current.parentId!==null){const parent=byId.get(current.parentId);if(parent===void 0||seen.has(parent.id))break;seen.add(parent.
11
+ id);depth+=1;current=parent}return depth}function isFolderId(value){return UUID.test(value)}async function scopeOf(input,ctx){const ref=nonEmpty(input.flags,"--project");if(ref===void 0)return{scope:SCOPE_PERSONAL};return{scope:SCOPE_PROJECT,scopeId:await ctx.projectId(ref)}}async function resolveFolderRef(ctx,ref,scope){if(isFolderId(ref))return ref;folderPathSegments(ref);return resolveFolderPath(folderRows(await ctx.resolver.mediaFolders(scope.scope,scope.scopeId)),ref).id}function validName(input,flag,usage){
12
+ const raw=input?.trim();if(raw===void 0||raw==="")throw new UsageError(`${flag} \u306B\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,usage);if(FORBIDDEN_NAME.test(raw))throw new UsageError(`\u30D5\u30A9\u30EB\u30C0\u540D\u306B\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\uFF08/ \\ : * ? " < > | \u306F\u4F7F\u3048\u307E\u305B\u3093\uFF09: ${raw}`);if([...raw].length>NAME_MAX)throw new UsageError(`\u30D5\u30A9\u30EB\u30C0\u540D\u306F ${NAME_MAX}\
13
+ \u6587\u5B57\u307E\u3067\u3067\u3059`);return raw}function assertNoSibling(rows,parentId,name,exceptId){const clash=rows.find(row=>row.parentId===parentId&&row.name===name&&row.id!==exceptId);if(clash!==void 0){throw new UsageError(`\u540C\u3058\u5834\u6240\u306B\u540C\u3058\u540D\u524D\u306E\u30D5\u30A9\u30EB\u30C0\u304C\u3042\u308A\u307E\u3059: ${clash.path}\uFF08${clash.id}\uFF09`,"\u5225\u306E\u540D\u524D\u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u30B5\u30FC\u30D0\u3082\u540C\u540D\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093\uFF09\u3002")}}
14
+ var PROJECT_FLAG={name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u5BFE\u8C61\u306B\u3059\u308B\uFF08\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF09\u3002\u7701\u7565\u6642\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A9\u30EB\u30C0",takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var PARENT_FLAG={name:"--parent",summary:"\u89AA\u30D5\u30A9\u30EB\u30C0\uFF08ID \u304B\u300C\u89AA/\u5B50\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\uFF09\u3002\u7701\u7565\u6642\u306F\u6700\u4E0A\u4F4D",
15
+ takesValue:true,placeholder:"<ID|\u30D1\u30B9>"};var ID_FLAG={name:"--id",summary:"\u30D5\u30A9\u30EB\u30C0\uFF08ID \u304B\u300C\u89AA/\u5B50\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\uFF09\u3002\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF08\u4E21\u65B9\u6307\u5B9A\u306F\u30A8\u30E9\u30FC\uFF09",takesValue:true,placeholder:"<ID|\u30D1\u30B9>"};var REF_HELP="\u30D5\u30A9\u30EB\u30C0\u306F ID \u304B\u300C\u89AA/\u5B50/\u5B6B\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\u3067\u6307\u5B9A\u3057\u307E\u3059\uFF08\u30D1\u30B9\u306F --project \u306E\u30B9\u30B3\u30FC\u30D7\u306E\u30C4\u30EA\u30FC\u304B\u3089\u89E3\u6C7A\u3057\u3001\n\u540C\u540D\u304C\u8907\u6570\u30FB\u898B\u3064\u304B\u3089\u306A\u3044\u3068\u304D\u306F\u5019\u88DC\u3092\u51FA\u3057\u3066\u7D42\u4E86\u30B3\u30FC\u30C9 2\uFF09\u3002";
16
+ async function target(input,ctx,usage){const ref=singleRef(input,{flag:"--id",label:"\u30D5\u30A9\u30EB\u30C0",usage});if(isFolderId(ref)){const detail=await ctx.resolver.mediaFolder(ref,"folder");const scope2=typeof detail["scope"]==="string"?detail["scope"]:SCOPE_PERSONAL;const scopeId=typeof detail["scope_id"]==="string"?detail["scope_id"]:void 0;const rows2=folderRows(await ctx.resolver.mediaFolders(scope2,scopeId));const[folder]=folderRows([detail]);return{folder:rows2.find(row=>row.id===ref)??
17
+ folder,rows:rows2,scope:scope2,scopeId}}const scope=await scopeOf(input,ctx);const rows=folderRows(await ctx.resolver.mediaFolders(scope.scope,scope.scopeId));return{folder:resolveFolderPath(rows,ref),rows,...scope}}function folderPath(id){return`/api/v2/media/folders/${encodeURIComponent(id)}`}function dataOf(body,label){const data=isRecord(body)?body["data"]:void 0;if(!isRecord(data))throw new ApiResponseError(`${label}\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`);
18
+ return data}function listData(body){const data=isRecord(body)?body["data"]:void 0;if(!Array.isArray(data)||!data.every(isRecord)){throw new ApiResponseError("\u30E1\u30C7\u30A3\u30A2\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return data}function folderCursor(body){const meta=isRecord(body)&&isRecord(body["meta"])?body["meta"]:void 0;if(meta!==
19
+ void 0&&!("has_more"in meta)&&"next_cursor"in meta){const cursor=meta["next_cursor"];return{hasMore:cursor!==null&&cursor!=="",cursor}}return readEnvelopeCursor(body)}var LIST_USAGE="twp media folder list [--project <\u30B3\u30FC\u30C9|ID>] [--parent <ID|\u30D1\u30B9>] [--tree | --trash]";var GET_USAGE="twp media folder get <ID|\u30D1\u30B9> [--project <\u30B3\u30FC\u30C9|ID>]";var CREATE_USAGE="twp media folder create <\u540D\u524D> [--parent <ID|\u30D1\u30B9>] [--project <\u30B3\u30FC\u30C9|ID>]";
20
+ var UPDATE_USAGE="twp media folder update <ID|\u30D1\u30B9> --name <\u65B0\u3057\u3044\u540D\u524D> [--project <\u30B3\u30FC\u30C9|ID>]";var MOVE_USAGE="twp media folder move <ID|\u30D1\u30B9> (--parent <ID|\u30D1\u30B9> | --root) [--project <\u30B3\u30FC\u30C9|ID>]";var DELETE_USAGE="twp media folder delete <ID|\u30D1\u30B9> --yes [--recursive] [--permanent] [--project <\u30B3\u30FC\u30C9|ID>]";var RESTORE_USAGE="twp media folder restore <ID> [--project <\u30B3\u30FC\u30C9|ID>]";function listMode(input){
21
+ const tree=input.flags.has("--tree");const trash=input.flags.has("--trash");if(tree&&trash)throw new UsageError("--tree \u3068 --trash \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093",LIST_USAGE);if(trash&&input.flags.has("--parent")){throw new UsageError("--trash \u306F --parent \u3068\u7D44\u307F\u5408\u308F\u305B\u3089\u308C\u307E\u305B\u3093\uFF08\u30B4\u30DF\u7BB1\u306F\u30B9\u30B3\u30FC\u30D7\u5168\u4F53\u3092\u8FD4\u3057\u307E\u3059\uFF09",LIST_USAGE)}if(tree&&(input.flags.
22
+ has("--limit")||input.flags.has("--cursor"))){throw new UsageError("--tree \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\uFF08--limit / --cursor \u306F\u4F7F\u3048\u307E\u305B\u3093\uFF09",LIST_USAGE)}return tree?"tree":trash?"trash":"list"}function scopeQuery(input){return{scope:requireResolved(input,"scope"),scope_id:input.resolved?.["scopeId"]}}function treeRows(body){const raw=listData(body);const rows=folderRows(raw);const byId=new Map(rows.map(row=>[row.id,row]));return rows.
23
+ map((row,index)=>({raw:raw[index],row,depth:depthOf(byId,row)}))}function treeDocument(body){const lines=treeRows(body).map(({raw,row,depth})=>{const deleted=typeof raw["deleted_at"]==="string"?` \u524A\u9664 ${raw["deleted_at"]}`:"";return`${" ".repeat(depth)}${row.name}/ ${row.id}${deleted}`});return lines.length===0?"\u30D5\u30A9\u30EB\u30C0\u306F\u3042\u308A\u307E\u305B\u3093\u3002":lines.join("\n")}var NAME_FLAG={name:"--name",summary:"\u65B0\u3057\u3044\u30D5\u30A9\u30EB\u30C0\u540D\uFF08\u5FC5\u9808\uFF09",
24
+ takesValue:true,placeholder:"<\u540D\u524D>"};var ROOT_FLAG={name:"--root",summary:"\u6700\u4E0A\u4F4D\u3078\u79FB\u3059\uFF08--parent \u3068\u540C\u6642\u306B\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\uFF09",takesValue:false};var RECURSIVE_FLAG={name:"--recursive",summary:"\u4E2D\u306E\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0\u30FB\u30D5\u30A1\u30A4\u30EB\u3054\u3068\u524A\u9664\u3059\u308B\uFF08\u4E2D\u8EAB\u304C\u3042\u308B\u30D5\u30A9\u30EB\u30C0\u306F\u3001\u3053\u308C\u304C\u7121\u3044\u3068\u524A\u9664\u3067\u304D\u307E\u305B\u3093\uFF09",
25
+ takesValue:false};var PERMANENT_FLAG={name:"--permanent",summary:"\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A9\u30EB\u30C0\u3092\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\uFF08\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002ID \u3067\u6307\u5B9A\u3057\u3001\u5148\u306B\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3053\u3068\uFF09",takesValue:false};async function prepareDelete(input,ctx){const recursive=input.flags.has("--recursive");if(input.flags.has("--permanent")){const ref=singleRef(input,{flag:"\
26
+ --id",label:"\u30D5\u30A9\u30EB\u30C0",usage:DELETE_USAGE});if(!isFolderId(ref)){throw new UsageError("--permanent \u3067\u306F\u30D5\u30A9\u30EB\u30C0\u3092 ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u306F\u30D1\u30B9\u3067\u5F15\u3051\u307E\u305B\u3093\uFF09","ID \u306F twp media folder list --trash \u3067\u78BA\u304B\u3081\u3089\u308C\u307E\u3059\u3002")}const scope=await scopeOf(input,ctx);const rawTrash=await ctx.resolver.
27
+ mediaFolderTrash(scope.scope,scope.scopeId);const trash=folderRows(rawTrash);const folder2=trash.find(row=>row.id===ref);if(folder2===void 0){throw new UsageError(`\u30D5\u30A9\u30EB\u30C0 ${ref} \u306F${scope.scope===SCOPE_PROJECT?"\u3053\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E":"\u500B\u4EBA\u306E"}\u30B4\u30DF\u7BB1\u306B\u3042\u308A\u307E\u305B\u3093\uFF08\u5B8C\u5168\u524A\u9664\u3067\u304D\u308B\u306E\u306F\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u3060\u3051\u3067\u3059\uFF09`,
28
+ `\u307E\u3060\u30B4\u30DF\u7BB1\u306B\u7121\u3044\u306A\u3089\u5148\u306B twp media folder delete ${ref} --yes \u3067\u79FB\u3057\u307E\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A9\u30EB\u30C0\u306A\u3089 --project \u3092\u4ED8\u3051\u307E\u3059\u3002`)}const inside=descendantsOf(trash,ref);const rawById=new Map(rawTrash.map(row=>[row["id"],row]));const files2=[folder2,...inside].reduce((sum,row)=>{const count=rawById.get(row.id)?.["file_count"];return sum+(typeof count==="n\
29
+ umber"?count:0)},0);if((inside.length>0||files2>0)&&!recursive){throw new UsageError(`\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0 ${folder2.path} \u306B\u306F\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0 ${inside.length} \u4EF6\u30FB\u30D5\u30A1\u30A4\u30EB ${files2} \u4EF6\uFF08\u8A18\u9332\u4E0A\uFF09\u304C\u3042\u308A\u307E\u3059\u3002\u4E2D\u8EAB\u3054\u3068\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\u306A\u3089 --recursive \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044`)}return withResolved(input,
30
+ {folderId:ref,folderPath:folder2.path,subfolders:String(inside.length),files:String(files2)})}const{folder}=await target(input,ctx,DELETE_USAGE);const content=await ctx.resolver.mediaFolder(folder.id,"content");const subfolders=typeof content["subfolder_count"]==="number"?content["subfolder_count"]:0;const files=typeof content["file_count"]==="number"?content["file_count"]:0;const complete=content["scan_complete"]!==false;if((subfolders>0||files>0)&&!recursive){throw new UsageError(`\u30D5\u30A9\u30EB\u30C0 ${folder.
31
+ path} \u306B\u306F\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0 ${subfolders} \u4EF6\u30FB\u30D5\u30A1\u30A4\u30EB ${files} \u4EF6${complete?"":"\u4EE5\u4E0A"}\u304C\u3042\u308A\u307E\u3059\u3002\u4E2D\u8EAB\u3054\u3068\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u306A\u3089 --recursive \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044`)}return withResolved(input,{folderId:folder.id,folderPath:folder.path,subfolders:String(subfolders),files:String(files),complete:complete?"1":"0"})}var operations=[{name:"list",summary:"\
32
+ \u30D5\u30A9\u30EB\u30C0\u3092\u4E00\u89A7\u3059\u308B\uFF08--tree \u3067\u5168\u968E\u5C64\u3001--trash \u3067\u30B4\u30DF\u7BB1\uFF09",usage:LIST_USAGE,description:"\u65E2\u5B9A\u306F --parent\uFF08\u7121\u3051\u308C\u3070\u6700\u4E0A\u4F4D\uFF09\u306E\u76F4\u4E0B\u306E\u30D5\u30A9\u30EB\u30C0\u3060\u3051\u3067\u3059\u3002--tree \u306F\u30B9\u30B3\u30FC\u30D7\u306E\u5168\u30D5\u30A9\u30EB\u30C0\u3092\u968E\u5C64\u9806\u306B\u8FD4\u3057\u3001\n--output text \u3067\u306F\u30A4\u30F3\u30C7\u30F3\u30C8\u3067\u968E\u5C64\u3092\u8868\u793A\u3057\u307E\u3059\uFF08--parent \u3092\u4ED8\u3051\u308B\u3068\u305D\u306E\u4E0B\u3060\u3051\uFF09\u3002--trash \u306F\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u3067\u3059\u3002\n--project \u3092\u4ED8\u3051\u308B\u3068\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A9\u30EB\u30C0\u3001\u7121\u3051\u308C\u3070\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A9\u30EB\u30C0\u3067\u3059\uFF08\u65E2\u5B9A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306F\u4F7F\u3044\u307E\u305B\u3093\uFF09\u3002\n\n"+
33
+ LIST_PAGING_HELP,flags:[PROJECT_FLAG,PARENT_FLAG,{name:"--tree",summary:"\u5168\u968E\u5C64\u3092\u968E\u5C64\u9806\u306B\u51FA\u3059\uFF08\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\uFF09",takesValue:false},{name:"--trash",summary:"\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u51FA\u3059",takesValue:false},...LIST_FLAGS],paging:envelopePaging({label:"\u30E1\u30C7\u30A3\u30A2\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7",itemsKey:"data",readCursor:folderCursor}),async prepare(input,ctx){
34
+ if(input.args.length>0)throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,LIST_USAGE);listMode(input);const scope=await scopeOf(input,ctx);const parent=nonEmpty(input.flags,"--parent");const values={scope:scope.scope};if(scope.scopeId!==void 0)values["scopeId"]=scope.scopeId;if(parent!==void 0)values["parentId"]=await resolveFolderRef(ctx,parent,scope);return withResolved(input,values)},plan(input){const mode=listMode(
35
+ input);const parentId=input.resolved?.["parentId"];if(mode==="tree"){return{method:"GET",path:"/api/v2/media/folders/tree",query:{...scopeQuery(input),root_id:parentId}}}const page={limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor")};if(mode==="trash")return{method:"GET",path:"/api/v2/media/folders/trash",query:{...scopeQuery(input),...page}};return{method:"GET",path:"/api/v2/media/folders",query:{...scopeQuery(input),parent_id:parentId,...page}}},summarize:body=>treeRows(
36
+ body).map(({raw,depth,row})=>({tree:`${"\u3000".repeat(depth)}${row.name}`,...pick(raw,"deleted_at"in raw?TRASH_COLUMNS:ROW_COLUMNS)})),raw:body=>listData(body),document:treeDocument,notes(body){const meta=isRecord(body)&&isRecord(body["meta"])?body["meta"]:void 0;return meta?.["scan_truncated"]===true?["\u30B4\u30DF\u7BB1\u306E\u8D70\u67FB\u304C\u4E0A\u9650\u3067\u6253\u3061\u5207\u3089\u308C\u305F\u305F\u3081\u3001\u4E00\u90E8\u306E\u30D5\u30A9\u30EB\u30C0\u3060\u3051\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002"]:
37
+ []}},{name:"get",summary:"\u30D5\u30A9\u30EB\u30C01\u4EF6\u306E\u8A73\u7D30\u3092\u51FA\u3059",usage:GET_USAGE,description:REF_HELP,flags:[ID_FLAG,PROJECT_FLAG],async prepare(input,ctx){const ref=singleRef(input,{flag:"--id",label:"\u30D5\u30A9\u30EB\u30C0",usage:GET_USAGE});if(isFolderId(ref))return withResolved(input,{folderId:ref});return withResolved(input,{folderId:await resolveFolderRef(ctx,ref,await scopeOf(input,ctx))})},plan:input=>({method:"GET",path:folderPath(requireResolved(input,"f\
38
+ olderId"))}),summarize:body=>pick(dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u53D6\u5F97"),[...ROW_COLUMNS,"scope","scope_id","created_at"]),raw:body=>dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u53D6\u5F97")},{name:"create",summary:"\u30D5\u30A9\u30EB\u30C0\u3092\u4F5C\u308B",usage:CREATE_USAGE,description:'\u540D\u524D\u306B / \\ : * ? " < > | \u306F\u4F7F\u3048\u307E\u305B\u3093\u3002\u540C\u3058\u5834\u6240\u306B\u540C\u3058\u540D\u524D\u306E\u30D5\u30A9\u30EB\u30C0\u304C\u3042\u308C\u3070\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059\n\uFF08\u30B5\u30FC\u30D0\u3082\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093\u304C\u3001\u7406\u7531\u3092\u8FD4\u3055\u306A\u3044\u305F\u3081\uFF09\u3002\u89AA\u306F ID \u304B\u300C\u89AA/\u5B50\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002',
39
+ flags:[PARENT_FLAG,PROJECT_FLAG],async prepare(input,ctx){if(input.args.length>1)throw new UsageError(`\u30D5\u30A9\u30EB\u30C0\u540D\u306F1\u3064\u3060\u3051\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${input.args.join(" ")}`,CREATE_USAGE);const name=validName(input.args[0],"\u4F4D\u7F6E\u5F15\u6570",CREATE_USAGE);const scope=await scopeOf(input,ctx);const rows=folderRows(await ctx.resolver.mediaFolders(scope.scope,scope.scopeId));const parent=nonEmpty(input.flags,"--parent");let parentId=null;
40
+ if(parent!==void 0){parentId=isFolderId(parent)?parent:resolveFolderPath(rows,parent).id;if(!rows.some(row=>row.id===parentId)){throw new UsageError(`\u89AA\u30D5\u30A9\u30EB\u30C0 ${parent} \u306F\u3053\u306E\u30B9\u30B3\u30FC\u30D7\u306B\u3042\u308A\u307E\u305B\u3093\uFF08\u500B\u4EBA\uFF0F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u5225\u306F --project \u3067\u6307\u5B9A\u3057\u307E\u3059\uFF09`)}}assertNoSibling(rows,parentId,name);const values={scope:scope.scope,name};if(scope.scopeId!==void 0)
41
+ values["scopeId"]=scope.scopeId;if(parentId!==null)values["parentId"]=parentId;return withResolved(input,values)},plan(input){const resolved=input.resolved??{};const body={name:requireResolved(input,"name"),scope:requireResolved(input,"scope")};if(resolved["scopeId"]!==void 0)body["scope_id"]=resolved["scopeId"];if(resolved["parentId"]!==void 0)body["parent_id"]=resolved["parentId"];return{method:"POST",path:"/api/v2/media/folders",body}},summarize:body=>pick(dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u4F5C\u6210"),
42
+ ROW_COLUMNS),raw:body=>dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u4F5C\u6210")},{name:"update",summary:"\u30D5\u30A9\u30EB\u30C0\u306E\u540D\u524D\u3092\u5909\u3048\u308B",usage:UPDATE_USAGE,description:`${REF_HELP}
43
+ \u4E0B\u4F4D\u30D5\u30A9\u30EB\u30C0\u306E\u30D1\u30B9\u306F\u30B5\u30FC\u30D0\u304C\u4ED8\u3051\u76F4\u3057\u307E\u3059\u3002\u540C\u3058\u5834\u6240\u306B\u540C\u3058\u540D\u524D\u304C\u3042\u308C\u3070\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059\u3002`,flags:[ID_FLAG,NAME_FLAG,PROJECT_FLAG],async prepare(input,ctx){const name=validName(input.flags.get("--name"),"--name",UPDATE_USAGE);const{folder,rows}=await target(input,ctx,UPDATE_USAGE);assertNoSibling(rows,folder.parentId,name,folder.id);
44
+ return withResolved(input,{folderId:folder.id,name,folderPath:folder.path})},plan:input=>({method:"PUT",path:folderPath(requireResolved(input,"folderId")),body:{name:requireResolved(input,"name")}}),plannedNotes:input=>[`${requireResolved(input,"folderPath")} \u306E\u540D\u524D\u3092\u300C${requireResolved(input,"name")}\u300D\u306B\u3057\u307E\u3059\u3002`],summarize:body=>pick(dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u540D\u306E\u5909\u66F4"),ROW_COLUMNS),raw:body=>dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u540D\u306E\u5909\u66F4")},
45
+ {name:"move",summary:"\u30D5\u30A9\u30EB\u30C0\u3092\u5225\u306E\u30D5\u30A9\u30EB\u30C0\u306E\u4E0B\uFF08\u307E\u305F\u306F\u6700\u4E0A\u4F4D\uFF09\u3078\u79FB\u3059",usage:MOVE_USAGE,description:`${REF_HELP}
46
+ \u79FB\u52D5\u5148\u306F\u540C\u3058\u30B9\u30B3\u30FC\u30D7\u306E\u30D5\u30A9\u30EB\u30C0\u3060\u3051\u3067\u3059\uFF08\u500B\u4EBA\u3068\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u9593\u306F\u79FB\u305B\u307E\u305B\u3093\uFF09\u3002
47
+ \u81EA\u5206\u81EA\u8EAB\u30FB\u81EA\u5206\u306E\u4E0B\u4F4D\u30D5\u30A9\u30EB\u30C0\u3078\u306E\u79FB\u52D5\u3068\u3001\u79FB\u52D5\u5148\u306B\u540C\u3058\u540D\u524D\u304C\u3042\u308B\u3068\u304D\u306F\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059\u3002`,flags:[ID_FLAG,PARENT_FLAG,ROOT_FLAG,PROJECT_FLAG],async prepare(input,ctx){const parent=nonEmpty(input.flags,"--parent");const toRoot=input.flags.has("--root");if(parent===void 0===!toRoot)throw new UsageError("\u79FB\u52D5\u5148\u3092 --parent \u304B --root \u306E\u3069\u3061\u3089\u304B\
48
+ \u4E00\u65B9\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",MOVE_USAGE);const{folder,rows}=await target(input,ctx,MOVE_USAGE);let parentId=null;let parentPath="\u6700\u4E0A\u4F4D";if(parent!==void 0){const dest=isFolderId(parent)?rows.find(row=>row.id===parent):resolveFolderPath(rows,parent);if(dest===void 0)throw new UsageError(`\u79FB\u52D5\u5148 ${parent} \u306F ${folder.path} \u3068\u540C\u3058\u30B9\u30B3\u30FC\u30D7\u306B\u3042\u308A\u307E\u305B\u3093`);if(dest.id===folder.id)throw new UsageError(
49
+ "\u30D5\u30A9\u30EB\u30C0\u3092\u81EA\u5206\u81EA\u8EAB\u306E\u4E0B\u3078\u306F\u79FB\u305B\u307E\u305B\u3093");if(descendantsOf(rows,folder.id).some(row=>row.id===dest.id)){throw new UsageError(`\u79FB\u52D5\u5148 ${dest.path} \u306F ${folder.path} \u306E\u4E0B\u4F4D\u30D5\u30A9\u30EB\u30C0\u3067\u3059\uFF08\u81EA\u5206\u306E\u4E0B\u3078\u306F\u79FB\u305B\u307E\u305B\u3093\uFF09`)}parentId=dest.id;parentPath=dest.path}if(parentId===folder.parentId)throw new UsageError(`${folder.path} \u306F\u3059\u3067\u306B ${parentPath}\
50
+ \u306B\u3042\u308A\u307E\u3059`);assertNoSibling(rows,parentId,folder.name,folder.id);return withResolved(input,{folderId:folder.id,folderPath:folder.path,parentPath,...parentId===null?{}:{parentId}})},plan:input=>({method:"POST",path:`${folderPath(requireResolved(input,"folderId"))}/move`,body:{parent_id:input.resolved?.["parentId"]??null}}),plannedNotes:input=>[`${requireResolved(input,"folderPath")} \u3092 ${requireResolved(input,"parentPath")} \u3078\u79FB\u3057\u307E\u3059\u3002`],summarize:body=>pick(
51
+ dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u79FB\u52D5"),ROW_COLUMNS),raw:body=>dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u79FB\u52D5")},{name:"delete",summary:"\u30D5\u30A9\u30EB\u30C0\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\uFF08--permanent \u3067\u30B4\u30DF\u7BB1\u304B\u3089\u5B8C\u5168\u524A\u9664\uFF09",usage:DELETE_USAGE,description:`${REF_HELP}
52
+ \u9001\u308B\u524D\u306B\u4E2D\u8EAB\uFF08\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4EF6\u6570\uFF09\u3092\u78BA\u304B\u3081\u3001\u4E2D\u8EAB\u304C\u3042\u308B\u306E\u306B --recursive \u304C\u7121\u3051\u308C\u3070\u6B62\u3081\u307E\u3059\u3002
53
+ \u65E2\u5B9A\u306F\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3060\u3051\u3067\u3001twp media folder restore \u3067\u623B\u305B\u307E\u3059\u3002--permanent \u306F\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A9\u30EB\u30C0\u3092
54
+ \u5B8C\u5168\u306B\u524A\u9664\u3057\u3001\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\uFF08ID \u3067\u6307\u5B9A\u3002--recursive \u3067\u4E2D\u306E\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0\u30FB\u30D5\u30A1\u30A4\u30EB\u3054\u3068\uFF09\u3002
55
+ \u7834\u58CA\u7684\u306A\u64CD\u4F5C\u3068\u3057\u3066\u6271\u3046\u305F\u3081 --yes \u304C\u5FC5\u8981\u3067\u3059\u3002\u5BFE\u8C61\u4EF6\u6570\u306F --dry-run \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`,destructive:true,flags:[ID_FLAG,RECURSIVE_FLAG,PERMANENT_FLAG,PROJECT_FLAG],prepare:prepareDelete,plan(input){const base=folderPath(requireResolved(input,"folderId"));const path2=input.flags.has("--permanent")?`${base}/permanent`:base;return{method:"DELETE",path:path2,query:{recursive:input.
56
+ flags.has("--recursive")?"true":void 0}}},plannedNotes(input){const where=requireResolved(input,"folderPath");const subfolders=input.resolved?.["subfolders"]??"0";if(input.flags.has("--permanent")){return[`\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0 ${where} \u3092\u5B8C\u5168\u306B\u524A\u9664\u3057\u307E\u3059\uFF08\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0 ${subfolders} \u4EF6\u30FB\u30D5\u30A1\u30A4\u30EB ${input.resolved?.["files"]??"0"} \u4EF6\uFF08\u8A18\u9332\u4E0A\uFF09\u3092\u542B\u3080\u30FB\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\uFF09\u3002`]}
57
+ const more=input.resolved?.["complete"]==="0"?"\u4EE5\u4E0A\uFF08\u4EF6\u6570\u3092\u6570\u3048\u5207\u308C\u3066\u3044\u307E\u305B\u3093\uFF09":"";return[`\u30D5\u30A9\u30EB\u30C0 ${where} \u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u307E\u3059\uFF08\u30B5\u30D6\u30D5\u30A9\u30EB\u30C0 ${subfolders} \u4EF6\u30FB\u30D5\u30A1\u30A4\u30EB ${input.resolved?.["files"]??"0"} \u4EF6${more}\u3092\u542B\u3080\uFF09\u3002`]},summarize:body=>body,raw:body=>body},{name:"restore",summary:"\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u4E2D\u8EAB\u3054\u3068\u5143\u306B\u623B\u3059",
58
+ usage:RESTORE_USAGE,description:"\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u3092 ID \u3067\u6307\u5B9A\u3057\u307E\u3059\uFF08twp media folder list --trash\uFF09\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A9\u30EB\u30C0\u306A\u3089 --project \u3092\u4ED8\u3051\u307E\u3059\u3002\n\u30B5\u30FC\u30D0\u304C\u4E2D\u8EAB\u306E\u4E00\u90E8\u3057\u304B\u623B\u305B\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001stderr \u3067\u305D\u3046\u4F1D\u3048\u3066\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u3067\u7D42\u308F\u308A\u307E\u3059\uFF08\u30D5\u30A9\u30EB\u30C0\u81EA\u4F53\u306F\u623B\u3063\u3066\u3044\u307E\u3059\uFF09\u3002",
59
+ flags:[ID_FLAG,PROJECT_FLAG],async prepare(input,ctx){const ref=singleRef(input,{flag:"--id",label:"\u30D5\u30A9\u30EB\u30C0",usage:RESTORE_USAGE});if(!isFolderId(ref))throw new UsageError("restore \u3067\u306F\u30D5\u30A9\u30EB\u30C0\u3092 ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0\u306F\u30D1\u30B9\u3067\u5F15\u3051\u307E\u305B\u3093\uFF09",RESTORE_USAGE);const scope=await scopeOf(input,ctx);const trash=folderRows(await ctx.resolver.
60
+ mediaFolderTrash(scope.scope,scope.scopeId));const folder=trash.find(row=>row.id===ref);if(folder===void 0){throw new UsageError(`\u30D5\u30A9\u30EB\u30C0 ${ref} \u306F${scope.scope===SCOPE_PROJECT?"\u3053\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E":"\u500B\u4EBA\u306E"}\u30B4\u30DF\u7BB1\u306B\u3042\u308A\u307E\u305B\u3093`,"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A9\u30EB\u30C0\u306A\u3089 --project \u3092\u4ED8\u3051\u307E\u3059\u3002ID \u306F twp media folder list --trash \u3067\u78BA\u304B\u3081\u3089\u308C\u307E\u3059\u3002")}
61
+ return withResolved(input,{folderId:ref,folderPath:folder.path})},plan:input=>({method:"POST",path:`${folderPath(requireResolved(input,"folderId"))}/restore`,body:{}}),plannedNotes:input=>[`\u30B4\u30DF\u7BB1\u306E\u30D5\u30A9\u30EB\u30C0 ${requireResolved(input,"folderPath")} \u3092\u4E2D\u8EAB\u3054\u3068\u5143\u306B\u623B\u3057\u307E\u3059\u3002`],async execute(input,ctx){const body=await ctx.send({method:"POST",path:`${folderPath(requireResolved(input,"folderId"))}/restore`,body:{}});const meta=isRecord(
62
+ body)&&isRecord(body["meta"])?body["meta"]:void 0;if(meta?.["scan_truncated"]===true){ctx.warn(`\u30D5\u30A9\u30EB\u30C0 ${requireResolved(input,"folderPath")} \u306F\u5FA9\u5143\u3055\u308C\u307E\u3057\u305F\u304C\u3001\u4E2D\u8EAB\u306E\u4E00\u90E8\u3092\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u53D6\u308A\u6B8B\u3055\u308C\u305F\u30D5\u30A9\u30EB\u30C0\u306F twp media folder list --trash \u3067\u78BA\u304B\u3081\u30011\u4EF6\u305A\u3064 restore \u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
63
+ throw new ApiRejectedError("\u30D5\u30A9\u30EB\u30C0\u306E\u5FA9\u5143\u306F\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093\uFF08\u4E2D\u8EAB\u306E\u4E00\u90E8\u304C\u623B\u3063\u3066\u3044\u307E\u305B\u3093\uFF09\u3002")}return body},summarize:body=>pick(dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u5FA9\u5143"),ROW_COLUMNS),raw:body=>dataOf(body,"\u30D5\u30A9\u30EB\u30C0\u5FA9\u5143")}];var mediaFolderResource={name:"folder",summary:"\u30E1\u30C7\u30A3\u30A2\u306E\u30D5\u30A9\u30EB\u30C0\uFF08\u4E00\u89A7\u30FB\u30C4\u30EA\u30FC\u30FB\u4F5C\u6210\u30FB\u540D\u524D\u5909\u66F4\u30FB\u79FB\u52D5\u30FB\u524A\u9664\u30FB\u5FA9\u5143\uFF09",
64
+ operations};var SCOPE_PERSONAL2="personal";var SCOPE_PROJECT2="project";var LIST_COLUMNS=["id","file_name","content_type","file_size","folder_id","public_status","updated_at"];var UPLOAD_COLUMNS=["id","file_name","content_type","file_size","folder_id","scope","content_hash"];var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var NAME_FLAG2={
65
+ name:"--name",summary:"\u4FDD\u5B58\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u540D\uFF08\u7701\u7565\u6642\u306F\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3002\u540C\u540D\u304C\u3042\u308B\u3068\u30B5\u30FC\u30D0\u304C\u5225\u540D\u306B\u3057\u307E\u3059\uFF09",takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EB\u540D>"};var CONTENT_TYPE_FLAG={name:"--content-type",summary:"Content-Type\uFF08\u7701\u7565\u6642\u306F\u62E1\u5F35\u5B50\u304B\u3089\u63A8\u5B9A\u3002\u4E0D\u660E\u306A\u3089 application/octet-stream\uFF09",
66
+ takesValue:true,placeholder:"<\u578B>"};var FOLDER_FLAG={name:"--folder",summary:"\u30D5\u30A9\u30EB\u30C0\uFF08ID \u304B\u300C\u89AA/\u5B50\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\u3002\u7701\u7565\u6642\u306F\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<ID|\u30D1\u30B9>"};var MEDIA_PROJECT_FLAG={name:"--project",summary:"\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5BFE\u8C61\u306B\u3059\u308B\uFF08\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF09\u3002\u7701\u7565\u6642\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB",
67
+ takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var KEYWORD_FLAG={name:"--keyword",summary:"\u30D5\u30A1\u30A4\u30EB\u540D\u30FB\u5185\u5BB9\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22\uFF08\u691C\u7D22\u6642\u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30AD\u30FC\u30EF\u30FC\u30C9>"};var FILE_REF_FLAG={name:"--id",summary:"\u30D5\u30A1\u30A4\u30EBID\u3002\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF08\u4E21\u65B9\u6307\u5B9A\u306F\u30A8\u30E9\u30FC\uFF09",
68
+ takesValue:true,placeholder:"<\u30D5\u30A1\u30A4\u30EBID>"};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={name:"--force",summary:"\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308C\u3070\u4E0A\u66F8\u304D\u3059\u308B\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u306A\u3044\uFF09",
69
+ takesValue:false};var UUID2=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function folderId(input){const resolved=input.resolved?.["folderId"];if(resolved!==void 0)return resolved;const value=nonEmpty(input.flags,"--folder");if(value!==void 0&&!UUID2.test(value)){throw new Error(`\u5185\u90E8\u30A8\u30E9\u30FC: --folder ${value} \u304C ID \u3078\u89E3\u6C7A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08prepare() \u306E\u914D\u7DDA\u6F0F\u308C\uFF09`)}return value}async function resolveFolderFlag(input,ctx,scope){
70
+ const value=nonEmpty(input.flags,"--folder");if(value===void 0)return{};const scopeName=scope["scope"]??SCOPE_PERSONAL2;const scopeId=scope["scope"]===SCOPE_PROJECT2?scope["scopeId"]:void 0;return{folderId:isFolderId(value)?value:await resolveFolderRef(ctx,value,{scope:scopeName,scopeId})}}async function resolveScope(input,ctx){const ref=nonEmpty(input.flags,"--project");if(ref===void 0)return{scope:SCOPE_PERSONAL2};return{scope:SCOPE_PROJECT2,scopeId:await ctx.projectId(ref)}}function fileRef(input,usage){
71
+ const id=singleRef(input,{flag:"--id",label:"\u30D5\u30A1\u30A4\u30EBID",usage});if(!isSafePathSegment(id))throw new UsageError(`\u30D5\u30A1\u30A4\u30EBID \u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${id}`);return id}function filePath(id){return`/api/v2/media/files/${encodeURIComponent(id)}`}function listRows(body){const data=isRecord(body)?body["data"]:void 0;if(!Array.isArray(data)){throw new ApiResponseError("\u30E1\u30C7\u30A3\u30A2\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
72
+ return data}function dataOf2(body,label){const data=isRecord(body)?body["data"]:void 0;if(!isRecord(data)){throw new ApiResponseError(`${label}\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`)}return data}function localFile(input){const raw=input.flags.get("--file");if(raw===void 0||raw.trim()===""){throw new UsageError("--file \u306F\u5FC5\u9808\u3067\u3059","twp media upload --file <\u30D1\u30B9>")}
73
+ if(input.args.length>0){throw new UsageError(`upload \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp media upload --file <\u30D1\u30B9>")}const{file,size}=inspectLocalFile(raw,"--file","twp media upload --file <\u30D1\u30B9>");const nameFlag=nonEmpty(input.flags,"--name");const name=nameFlag??path.basename(file);const contentType=nonEmpty(input.flags,"--content-type")??contentTypeFor(name);return{file,name,size,contentType}}function uploadUrlPlan(input){
74
+ const resolved=input.resolved??{};const body={file_name:requireResolved(input,"fileName"),content_type:requireResolved(input,"contentType"),file_size:Number(requireResolved(input,"fileSize")),scope:requireResolved(input,"scope")};if(resolved["scopeId"]!==void 0)body["scope_id"]=resolved["scopeId"];const folder=folderId(input);if(folder!==void 0)body["folder_id"]=folder;return{method:"POST",path:"/api/v2/media/files/upload-url",body}}function issued(body){const data=dataOf2(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C");
75
+ const id=data["file_id"];const uploadUrl=data["upload_url"];if(!isSafePathSegment(id)||typeof uploadUrl!=="string"||!/^https:\/\//.test(uploadUrl)){throw new ApiResponseError("\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B data.file_id / data.upload_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{id,uploadUrl}}var discardGuidance=id=>` \u7834\u68C4: twp media delete ${id} --yes\uFF08\u30B4\
76
+ \u30DF\u7BB1\u3078\u79FB\u3057\u307E\u3059\u3002\u5B8C\u5168\u306B\u6D88\u3059\u306A\u3089 twp api /v2/media/files/${id}/permanent --method DELETE --yes\uFF09`;function orphanGuidance(id,stage){if(stage==="transfer"){return`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u4EEE\u767B\u9332\u3055\u308C\u307E\u3057\u305F\u304C\u3001\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u8EE2\u9001\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
77
+ \u30B5\u30FC\u30D0\u306B\u306F\u4E2D\u8EAB\u306E\u7121\u3044\u4EEE\u767B\u9332\u306E\u30D5\u30A1\u30A4\u30EB\u304C\u6B8B\u3063\u3066\u304A\u308A\u3001\u81EA\u52D5\u3067\u306F\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3002\u7834\u68C4\u3057\u3066\u304B\u3089\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
78
+ `+discardGuidance(id)}return`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u8EE2\u9001\u307E\u3067\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u5B8C\u4E86\u767B\u9332\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
79
+ \u30B5\u30FC\u30D0\u306B\u306F\u4EEE\u767B\u9332\u306E\u30D5\u30A1\u30A4\u30EB\u304C\u6B8B\u3063\u3066\u304A\u308A\u3001\u81EA\u52D5\u3067\u306F\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3002\u6B21\u306E\u3069\u3061\u3089\u304B\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
80
+ \u518D\u767B\u9332: twp api /v2/media/files/${id}/complete --method POST --yes
81
+ `+discardGuidance(id)}async function upload(input,ctx){const file=requireResolved(input,"file");const size=Number(requireResolved(input,"fileSize"));const contentType=requireResolved(input,"contentType");const bytes=new Uint8Array(fs.readFileSync(file));if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}
82
+ const localHash=crypto.createHash("sha256").update(bytes).digest("hex");await checkUploadQuota(ctx,size);const{id,uploadUrl}=issued(await ctx.send(uploadUrlPlan(input)));try{await ctx.putSigned(uploadUrl,bytes,contentType)}catch(err){ctx.warn(orphanGuidance(id,"transfer"));throw err}let completed;try{completed=dataOf2(await ctx.send({method:"POST",path:`${filePath(id)}/complete`,body:{}}),"\u5B8C\u4E86\u767B\u9332")}catch(err){ctx.warn(orphanGuidance(id,"complete"));throw err}const serverHash=completed["\
83
+ content_hash"];if(typeof serverHash==="string"&&serverHash!==""){if(serverHash.toLowerCase()!==localHash){ctx.warn(`\u30D5\u30A1\u30A4\u30EB ${id} \u306F\u30B5\u30FC\u30D0\u306B\u767B\u9332\u6E08\u307F\u306E\u307E\u307E\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002
84
+ ${discardGuidance(id)}`);throw new ApiResponseError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u305F\u30D5\u30A1\u30A4\u30EB ${id} \u306E\u5185\u5BB9\u304C\u30ED\u30FC\u30AB\u30EB\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\uFF08\u30ED\u30FC\u30AB\u30EB sha256 ${localHash} / \u30B5\u30FC\u30D0 ${serverHash}\uFF09\u3002`)}}else{ctx.warn(`\u30B5\u30FC\u30D0\u304C content_hash \u3092\u8FD4\u3055\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u30D5\u30A1\u30A4\u30EB ${id} \u306E\u5185\u5BB9\u306F\u7167\u5408\u3057\u3066\u3044\u307E\u305B\u3093\u3002`)}
85
+ return completed}var BULK_MAX=100;var BULK_DOWNLOAD_MAX=50;function bulkIds(input,usage,max){const ids=input.args.map(arg=>arg.trim()).filter(arg=>arg!=="");if(ids.length===0)throw new UsageError("\u30D5\u30A1\u30A4\u30EBID \u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);if(ids.length>max)throw new UsageError(`\u4E00\u5EA6\u306B\u6307\u5B9A\u3067\u304D\u308B\u30D5\u30A1\u30A4\u30EB\u306F ${max} \u4EF6\u307E\u3067\u3067\u3059\uFF08${ids.length} \u4EF6\u6307\u5B9A\uFF09`,
86
+ usage);const bad=ids.filter(id=>!UUID2.test(id));if(bad.length>0)throw new UsageError(`\u30D5\u30A1\u30A4\u30EBID\uFF08UUID\uFF09\u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${bad.join(" ")}`,usage);const duplicated=ids.filter((id,index)=>ids.indexOf(id)!==index);if(duplicated.length>0)throw new UsageError(`\u540C\u3058\u30D5\u30A1\u30A4\u30EBID \u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059: ${[...new Set(duplicated)].join(" ")}`,usage);return ids}function bulkResult(body,label){const data=dataOf2(
87
+ body,label);const{success,failed}=data;const rolledBack=data["rolled_back"]??[];if(!Array.isArray(success)||!Array.isArray(failed)||!Array.isArray(rolledBack)){throw new ApiResponseError(`${label}\u306E\u5FDC\u7B54\u306B data.success / failed \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return{success:success.map(String),failed:failed.map(row=>({id:String(isRecord(row)?row["id"]??row["file_id"]:row),reason:String(isRecord(
88
+ row)?row["reason"]??row["error"]??"":"")})),rolledBack:rolledBack.map(String)}}function assertBulkSucceeded(result,requested,label,ctx){if(result.failed.length===0)return;const lines=[`${label}: ${requested} \u4EF6\u4E2D ${result.failed.length} \u4EF6\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002`];for(const row of result.failed)lines.push(` \u5931\u6557: ${row.id}\uFF08${row.reason}\uFF09`);lines.push(result.success.length===0?" \u9069\u7528\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306F\u3042\u308A\u307E\u305B\u3093\u3002":
89
+ ` \u9069\u7528\u6E08\u307F\uFF08\u623B\u3055\u308C\u3066\u3044\u306A\u3044\uFF09: ${result.success.join(" ")}`);if(result.rolledBack.length>0)lines.push(` \u5931\u6557\u306E\u305F\u3081\u5143\u306B\u623B\u3057\u305F\u3082\u306E: ${result.rolledBack.join(" ")}`);ctx.warn(lines.join("\n"));throw new ApiRejectedError(`${label}\u306F\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093\uFF08${result.failed.length} \u4EF6\u5931\u6557\u30FB${result.success.length} \u4EF6\u9069\u7528\uFF09\u3002`)}function bulkSummary(body){
90
+ const data=isRecord(body)?body["data"]:void 0;const count=key=>isRecord(data)&&Array.isArray(data[key])?data[key].length:0;return{message:isRecord(body)?body["message"]??null:null,success:count("success"),failed:count("failed"),rolled_back:count("rolled_back")}}var BULK_STATUS_OPERATIONS=[{name:"bulk-publish",endpoint:"publish",label:"\u4E00\u62EC\u516C\u958B",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u516C\u958B\u3059\u308B",description:"\u30D5\u30A1\u30A4\u30EB\u3092\u516C\u958B\u72B6\u614B\u306B\u3057\u307E\u3059\u3002"},
91
+ {name:"bulk-unpublish",endpoint:"unpublish",label:"\u4E00\u62EC\u975E\u516C\u958B",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u975E\u516C\u958B\u306B\u3059\u308B",description:"\u30D5\u30A1\u30A4\u30EB\u3092\u975E\u516C\u958B\uFF08\u4E0B\u66F8\u304D\uFF09\u306B\u623B\u3057\u307E\u3059\u3002"},{name:"bulk-archive",endpoint:"archive",label:"\u4E00\u62EC\u30A2\u30FC\u30AB\u30A4\u30D6",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B",
92
+ description:"\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u72B6\u614B\u306B\u3057\u307E\u3059\uFF08\u524A\u9664\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002"},{name:"bulk-restore",endpoint:"restore",label:"\u4E00\u62EC\u5FA9\u5143",summary:"\u30B4\u30DF\u7BB1\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5FA9\u5143\u3059\u308B",description:"twp media delete / bulk-delete \u3067\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u5143\u306B\u623B\u3057\u307E\u3059\uFF08\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u89E3\u9664\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002"}];
93
+ function bulkUsage(name,extra=""){return`twp media ${name} <\u30D5\u30A1\u30A4\u30EBID>...${extra}`}function bulkStatusOperation(spec){const usage=bulkUsage(spec.name);return{name:spec.name,summary:spec.summary,usage,description:`${spec.description}
94
+ \u30D5\u30A1\u30A4\u30EBID\uFF08twp media list \u306E id\uFF09\u3092\u4F4D\u7F6E\u5F15\u6570\u3067\u4E26\u3079\u307E\u3059\uFF08${BULK_MAX} \u4EF6\u307E\u3067\uFF09\u3002
95
+ `+BULK_FAILURE_HELP,flags:[],plan:input=>({method:"POST",path:`/api/v2/media/files/bulk/${spec.endpoint}`,body:{file_ids:bulkIds(input,usage,BULK_MAX)}}),plannedNotes:input=>[`${bulkIds(input,usage,BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5BFE\u8C61\u306B\u3057\u307E\u3059\u3002`],execute:(input,ctx)=>runBulk(ctx,bulkIds(input,usage,BULK_MAX),spec.endpoint,spec.label,{}),summarize:bulkSummary,raw:body=>body}}var BULK_FAILURE_HELP="1\u4EF6\u3067\u3082\u5931\u6557\u3059\u308B\u3068\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u3067\u7D42\u308F\u308A\u3001\u5931\u6557\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3068\u7406\u7531\u30FB\u9069\u7528\u6E08\u307F\u306E\u30D5\u30A1\u30A4\u30EB\u3092\
96
+ stderr \u306B\u51FA\u3057\u307E\u3059\n\uFF08\u30B5\u30FC\u30D0\u306F\u5931\u6557\u304C\u3042\u3063\u3066\u3082 HTTP 200 \u3092\u8FD4\u3059\u305F\u3081\uFF09\u3002bulk-publish / bulk-unpublish / bulk-archive \u306F\n\u5B58\u5728\u3057\u306A\u3044 ID \u304C1\u4EF6\u3067\u3082\u3042\u308B\u3068\u4ED6\u3082\u9069\u7528\u3057\u307E\u305B\u3093\u3002bulk-restore / bulk-move / bulk-delete \u306F1\u4EF6\u305A\u3064\u51E6\u7406\u3057\u3001\n\u5931\u6557\u3057\u305F\u3082\u306E\u4EE5\u5916\u306F\u9069\u7528\u3055\u308C\u307E\u3059\u3002";
97
+ async function runBulk(ctx,ids,endpoint,label,extra){const body=await ctx.send({method:"POST",path:`/api/v2/media/files/bulk/${endpoint}`,body:{file_ids:ids,...extra}});assertBulkSucceeded(bulkResult(body,label),ids.length,label,ctx);return body}var PERMANENT_FLAG2={name:"--permanent",summary:"\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\uFF08\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\u5148\u306B bulk-delete \u3067\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3053\u3068\uFF09",
98
+ takesValue:false};var MOVE_FOLDER_FLAG={name:"--folder",summary:"\u79FB\u52D5\u5148\u306E\u30D5\u30A9\u30EB\u30C0\uFF08ID \u304B\u300C\u89AA/\u5B50\u300D\u5F62\u5F0F\u306E\u30D1\u30B9\u3002\u7701\u7565\u6642\u306F\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\uFF09",takesValue:true,placeholder:"<ID|\u30D1\u30B9>"};var MOVE_PROJECT_FLAG={name:"--project",summary:"\u79FB\u52D5\u5148\u3092\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u3059\u308B\uFF08\u30B3\u30FC\u30C9\u307E\u305F\u306F ID\uFF09\u3002\u7701\u7565\u6642\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB",
99
+ takesValue:true,placeholder:"<\u30B3\u30FC\u30C9|ID>"};var BULK_DELETE_USAGE=bulkUsage("bulk-delete"," --yes [--permanent]");var BULK_MOVE_USAGE=bulkUsage("bulk-move"," [--project <\u30B3\u30FC\u30C9|ID>] [--folder <ID|\u30D1\u30B9>]");var BULK_DOWNLOAD_USAGE=bulkUsage("bulk-download"," --out <\u30D1\u30B9.zip> [--force]");function bulkDeleteEndpoint(input){return input.flags.has("--permanent")?{endpoint:"permanent-delete",label:"\u4E00\u62EC\u5B8C\u5168\u524A\u9664"}:{endpoint:"delete",label:"\u4E00\
100
+ \u62EC\u524A\u9664"}}var BULK_OPERATIONS=[...BULK_STATUS_OPERATIONS.map(bulkStatusOperation),{name:"bulk-move",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5225\u306E\u30D5\u30A9\u30EB\u30C0\u30FB\u30B9\u30B3\u30FC\u30D7\u3078\u79FB\u3059",usage:BULK_MOVE_USAGE,description:"\u79FB\u52D5\u5148\u306F --project\uFF08\u7121\u3051\u308C\u3070\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\uFF09\u3068 --folder\uFF08\u7121\u3051\u308C\u3070\u6700\u4E0A\u4F4D\uFF09\u3067\u6C7A\u307E\u308A\u307E\u3059\u3002\n--project \u3092\u4ED8\u3051\u306A\u3044\u3068\u304D\u3001\u65E2\u5B9A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\uFF08TWP_PROJECT \u7B49\uFF09\u306F\u4F7F\u3044\u307E\u305B\u3093\uFF08\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\u3078\u79FB\u3057\u307E\u3059\uFF09\u3002\n"+
101
+ BULK_FAILURE_HELP,flags:[MOVE_PROJECT_FLAG,MOVE_FOLDER_FLAG],async prepare(input,ctx){bulkIds(input,BULK_MOVE_USAGE,BULK_MAX);const scope=await resolveScope(input,ctx);const scopeId=scope["scopeId"]??(await ctx.resolver.currentUser()).id;return withResolved(input,{scope:requireScope(scope),scopeId,...await resolveFolderFlag(input,ctx,scope)})},plan:input=>({method:"POST",path:"/api/v2/media/files/bulk/move",body:bulkMoveBody(input)}),plannedNotes:input=>[`${bulkIds(input,BULK_MOVE_USAGE,BULK_MAX).
102
+ length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u79FB\u3057\u307E\u3059\u3002`],execute:(input,ctx)=>{const{file_ids:ids,...extra}=bulkMoveBody(input);return runBulk(ctx,ids,"move","\u4E00\u62EC\u79FB\u52D5",extra)},summarize:bulkSummary,raw:body=>body},{name:"bulk-delete",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\uFF08--permanent \u3067\u30B4\u30DF\u7BB1\u304B\u3089\u5B8C\u5168\u524A\u9664\uFF09",usage:BULK_DELETE_USAGE,description:"\u65E2\u5B9A\u306F\u30B4\u30DF\u7BB1\u3078\
103
+ \u79FB\u3059\u3060\u3051\u3067\u3001twp media bulk-restore \u3067\u623B\u305B\u307E\u3059\u3002\n--permanent \u3092\u4ED8\u3051\u308B\u3068\u30B4\u30DF\u7BB1\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3057\u3001\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\n\u30B4\u30DF\u7BB1\u306B\u7121\u3044\u30D5\u30A1\u30A4\u30EB\u306F\u5B8C\u5168\u524A\u9664\u3067\u304D\u307E\u305B\u3093\uFF08\u30B5\u30FC\u30D0\u304C\u300C\u5148\u306B\u30B4\u30DF\u7BB1\u306B\u79FB\u52D5\u3057\u3066\u304F\u3060\u3055\u3044\u300D\u3067\u62D2\u5426\u3057\u307E\u3059\uFF09\u3002\n\u7834\u58CA\u7684\u306A\u64CD\u4F5C\u3068\u3057\u3066\u6271\u3046\u305F\u3081 --yes \u304C\u5FC5\u8981\u3067\u3059\u3002\u5BFE\u8C61\u4EF6\u6570\u306F --dry-run \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002\n"+
104
+ BULK_FAILURE_HELP,destructive:true,flags:[PERMANENT_FLAG2],plan:input=>({method:"POST",path:`/api/v2/media/files/bulk/${bulkDeleteEndpoint(input).endpoint}`,body:{file_ids:bulkIds(input,BULK_DELETE_USAGE,BULK_MAX)}}),plannedNotes:input=>[input.flags.has("--permanent")?`${bulkIds(input,BULK_DELETE_USAGE,BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u5B8C\u5168\u306B\u524A\u9664\u3057\u307E\u3059\uFF08\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\uFF09\u3002`:`${bulkIds(input,BULK_DELETE_USAGE,
105
+ BULK_MAX).length} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3057\u307E\u3059\u3002`],execute:(input,ctx)=>{const{endpoint,label}=bulkDeleteEndpoint(input);return runBulk(ctx,bulkIds(input,BULK_DELETE_USAGE,BULK_MAX),endpoint,label,{})},summarize:bulkSummary,raw:body=>body},{name:"bulk-download",summary:"\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3092 ZIP \u306B\u307E\u3068\u3081\u3066\u66F8\u304D\u51FA\u3059",usage:BULK_DOWNLOAD_USAGE,description:`\u30B5\u30FC\u30D0\u304C ZIP \u3092\u4F5C\u308A\u3001\u305D\u306E\
106
+ \u7F72\u540DURL\u304B\u3089\u672C\u4F53\u3092\u53D7\u3051\u53D6\u308A\u307E\u3059\uFF08${BULK_DOWNLOAD_MAX} \u4EF6\u307E\u3067\uFF09\u3002
107
+ \u30B5\u30FC\u30D0\u306F\u5B58\u5728\u3057\u306A\u3044\u30FB\u8AAD\u3081\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u3092\u9ED9\u3063\u3066\u9664\u3044\u3066 ZIP \u3092\u4F5C\u308B\u306E\u3067\u3001ZIP \u306B\u5165\u3063\u305F\u4EF6\u6570\u304C
108
+ \u6307\u5B9A\u3088\u308A\u5C11\u306A\u3051\u308C\u3070\u66F8\u304D\u51FA\u3055\u305A\u306B\u7D42\u4E86\u30B3\u30FC\u30C9 3 \u3067\u7D42\u308F\u308A\u307E\u3059\u3002
109
+ \u66F8\u304D\u51FA\u3057\u5148\u306F --out \u3067\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\u3002\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306F --force \u304C\u7121\u3051\u308C\u3070\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\u3002`,flags:[OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force",signedUrl(body,plan){const data=dataOf2(body,"\u4E00\u62EC\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9");const requested=isRecord(plan.body)&&Array.isArray(plan.body["file_ids"])?plan.body["file_ids"].length:
110
+ 0;const packed=data["file_count"];if(typeof packed==="number"&&packed<requested){throw new ApiRejectedError(`ZIP \u306B\u5165\u3063\u305F\u306E\u306F ${requested} \u4EF6\u4E2D ${packed} \u4EF6\u3067\u3057\u305F\uFF08\u5B58\u5728\u3057\u306A\u3044\u30FB\u8AAD\u3081\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u304C\u9664\u304B\u308C\u3066\u3044\u307E\u3059\uFF09\u3002\u66F8\u304D\u51FA\u3057\u3066\u3044\u307E\u305B\u3093\u3002twp media list \u3067 ID \u3092\u78BA\u304B\u3081\u3066\u6307\u5B9A\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
111
+ const url=data["download_url"];if(typeof url!=="string"||!/^https:\/\//.test(url)){throw new ApiResponseError("\u4E00\u62EC\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306E\u5FDC\u7B54\u306B data.download_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return url}},plan:input=>({method:"POST",path:"/api/v2/media/files/bulk/download",body:{file_ids:bulkIds(input,BULK_DOWNLOAD_USAGE,BULK_DOWNLOAD_MAX)}}),summarize:body=>body,raw:body=>body}];
112
+ function requireScope(scope){const value=scope["scope"];if(value===void 0)throw new Error("resolveScope \u304C scope \u3092\u8FD4\u3057\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u914D\u7DDA\u306E\u8AA4\u308A\uFF09");return value}function bulkMoveBody(input){const body={file_ids:bulkIds(input,BULK_MOVE_USAGE,BULK_MAX),scope:requireResolved(input,"scope"),scope_id:requireResolved(input,"scopeId")};const folder=folderId(input);if(folder!==void 0)body["folder_id"]=folder;return body}var LIST_USAGE2="\
113
+ twp media list [--project <\u30B3\u30FC\u30C9|ID>] [--folder <ID|\u30D1\u30B9>] [--keyword <\u8A9E>]";var UPLOAD_USAGE="twp media upload --file <\u30D1\u30B9> [--project <\u30B3\u30FC\u30C9|ID>] [--folder <ID|\u30D1\u30B9>] [--name <\u540D\u524D>]";var DOWNLOAD_USAGE="twp media download <\u30D5\u30A1\u30A4\u30EBID> --out <\u30D1\u30B9> [--force]";var DELETE_USAGE2="twp media delete <\u30D5\u30A1\u30A4\u30EBID> --yes";var mediaDomain={name:"media",summary:"\u30E1\u30C7\u30A3\u30A2\u30E9\u30A4\u30D6\u30E9\u30EA\u306E\u30D5\u30A1\u30A4\u30EB\u3068\u30D5\u30A9\u30EB\u30C0\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u30FB\u4E00\u89A7\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30FB\u524A\u9664\u30FB\
114
+ \u4E00\u62EC\u64CD\u4F5C\u30FB\u30D5\u30A9\u30EB\u30C0\u7BA1\u7406\uFF09",operations:[{name:"list",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\uFF09",usage:LIST_USAGE2,description:"--project \u3092\u4ED8\u3051\u308B\u3068\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30D5\u30A1\u30A4\u30EB\u3001\u7121\u3051\u308C\u3070\u81EA\u5206\u306E\u500B\u4EBA\u30D5\u30A1\u30A4\u30EB\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u30D5\u30A9\u30EB\u30C0\u3092\u4ED8\u3051\u306A\u3051\u308C\u3070\u30B9\u30B3\u30FC\u30D7\u306E\u6700\u4E0A\u4F4D\u306B\u3042\u308B\u30D5\u30A1\u30A4\u30EB\u3060\u3051\u3067\u3059\uFF08\u4E0B\u4F4D\u30D5\u30A9\u30EB\u30C0\u306F\u542B\u307F\u307E\u305B\u3093\uFF09\u3002\n\n"+
115
+ LIST_PAGING_HELP,flags:[MEDIA_PROJECT_FLAG,FOLDER_FLAG,KEYWORD_FLAG,...LIST_FLAGS],paging:envelopePaging({label:"\u30E1\u30C7\u30A3\u30A2\u4E00\u89A7",itemsKey:"data"}),async prepare(input,ctx){if(input.args.length>0){throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D7\u3051\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,LIST_USAGE2)}const scope=await resolveScope(input,ctx);return withResolved(input,{...scope,...await resolveFolderFlag(input,ctx,scope)})},plan(input){
116
+ const resolved=input.resolved??{};const keyword=nonEmpty(input.flags,"--keyword");return{method:"GET",path:"/api/v2/media/files",query:{scope:requireResolved(input,"scope"),scope_id:resolved["scopeId"],folder_id:folderId(input),keyword,limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor")}}},summarize:body=>listRows(body).map(row=>pick(row,LIST_COLUMNS)),raw:body=>listRows(body),notes(body,input){if(nonEmpty(input.flags,"--keyword")===void 0)return[];const meta=isRecord(
117
+ body)?body["meta"]:void 0;const total=isRecord(meta)?meta["total"]:void 0;const shown=listRows(body).length;if(typeof total!=="number"||total<=shown)return[];return[`\u691C\u7D22\u7D50\u679C ${total} \u4EF6\u306E\u3046\u3061 ${shown} \u4EF6\u3060\u3051\u3092\u8868\u793A\u3057\u3066\u3044\u307E\u3059\uFF08\u691C\u7D22\u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3057\u307E\u305B\u3093\u3002--limit \u3092\u4E0A\u3052\u308B\u304B\u8A9E\u3092\u7D5E\u3063\u3066\u304F\u3060\u3055\u3044\uFF09\u3002`]}},{name:"\
118
+ upload",summary:"\u30ED\u30FC\u30AB\u30EB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\uFF08\u767A\u884C\u30FB\u8EE2\u9001\u30FB\u5B8C\u4E86\u767B\u9332\u30921\u30B3\u30DE\u30F3\u30C9\u3067\uFF09",usage:UPLOAD_USAGE,description:"\u5BB9\u91CF\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\u3001\u6B21\u306E3\u5F80\u5FA9\u30921\u30B3\u30DE\u30F3\u30C9\u3067\u884C\u3044\u307E\u3059\u3002\n 0. POST /api/v2/storage/check-upload\uFF08\u30C6\u30CA\u30F3\u30C8\u306E\u5BB9\u91CF\u691C\u67FB\u3002\u8D85\u904E\u306A\u3089\u4F55\u3082\u767B\u9332\u305B\u305A\u306B\u6B62\u307E\u308A\u307E\u3059\uFF09\n 1. POST /api/v2/media/files/upload-url\uFF08\u7F72\u540DURL\u306E\u767A\u884C\u3002\u3053\u3053\u3067\u30D5\u30A1\u30A4\u30EB\u304C\u4EEE\u767B\u9332\u3055\u308C\u307E\u3059\uFF09\n 2. \u7F72\u540DURL\u3078 PUT\uFF08\u30D5\u30A1\u30A4\u30EB\u672C\u4F53\u3002TWP \u306E\u8A8D\u8A3C\u60C5\u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09\n 3. POST /api/v2/media/files/{id}/c\
119
+ omplete\uFF08\u5B8C\u4E86\u767B\u9332\uFF09\n\u5B8C\u4E86\u767B\u9332\u306E\u5FDC\u7B54\u306E content_hash\uFF08sha256\uFF09\u3092\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u3068\u7A81\u304D\u5408\u308F\u305B\u3001\u4E00\u81F4\u3057\u306A\u3051\u308C\u3070\u5931\u6557\u3057\u307E\u3059\u3002\n2\u30FB3 \u304C\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EBID\u3068\u518D\u767B\u9332\u30FB\u7834\u68C4\u306E\u624B\u9806\u3092 stderr \u306B\u51FA\u3057\u3066\u5931\u6557\u3057\u307E\u3059\uFF08\u4EEE\u767B\u9332\u306F\u81EA\u52D5\u3067\u306F\u6D88\u3048\u307E\u305B\u3093\uFF09\u3002\n--dry-run \u306F 1 \u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\uFF082 \u4EE5\u964D\u306F 1 \u306E\u5FDC\u7B54\u306B\u4F9D\u5B58\u3059\u308B\u305F\u3081\uFF09\u3002",
120
+ flags:[FILE_FLAG,MEDIA_PROJECT_FLAG,FOLDER_FLAG,NAME_FLAG2,CONTENT_TYPE_FLAG],async prepare(input,ctx){const local=localFile(input);const scope=await resolveScope(input,ctx);return withResolved(input,{...scope,...await resolveFolderFlag(input,ctx,scope),file:local.file,fileName:local.name,fileSize:String(local.size),contentType:local.contentType})},plan:uploadUrlPlan,plannedNotes:input=>[`\u5B9F\u884C\u6642\u306F\u3001\u3053\u306E\u524D\u306B\u5BB9\u91CF\u691C\u67FB\uFF08POST /api/v2/storage/check-upload\uFF09\u3092\u9001\u308A\u3001\u3053\u306E\u3042\u3068\u7F72\u540DURL\u3078 ${requireResolved(
121
+ input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3001\u5B8C\u4E86\u767B\u9332\uFF08POST \u2026/complete\uFF09\u3092\u9001\u308A\u307E\u3059\u3002`],execute:upload,summarize:body=>pick(body,UPLOAD_COLUMNS),raw:body=>body},{name:"download",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u3078\u66F8\u304D\u51FA\u3059",usage:DOWNLOAD_USAGE,description:"\u30D5\u30A1\u30A4\u30EBID \u306F twp media list \u306E id \u3067\u3059\u3002\n\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u7528\u306E\u7F72\u540DURL\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089\u672C\u4F53\u3092\u53D7\u3051\u53D6\u308A\u307E\u3059\uFF08\u7F72\u540DURL\u3078 TWP \u306E\u8A8D\u8A3C\u60C5\
122
+ \u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09\u3002\n\u66F8\u304D\u51FA\u3057\u5148\u306F --out \u3067\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\uFF08\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09\u3002\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306F --force \u304C\u7121\u3051\u308C\u3070\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\u3002",flags:[FILE_REF_FLAG,OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force",signedUrl(body){const url=dataOf2(body,"\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u53D6\
123
+ \u5F97")["download_url"];if(typeof url!=="string"||!/^https:\/\//.test(url)){throw new ApiResponseError("\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u53D6\u5F97\u306E\u5FDC\u7B54\u306B data.download_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return url}},plan:input=>({method:"GET",path:`${filePath(fileRef(input,DOWNLOAD_USAGE))}/download-url`}),summarize:body=>body,raw:body=>body},{name:"delete",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u30B4\u30DF\u7BB1\u3078\u79FB\u3059",
124
+ usage:DELETE_USAGE2,description:"\u30B4\u30DF\u7BB1\u3078\u79FB\u3059\u3060\u3051\u3067\u3001\u753B\u9762\u306E\u30B4\u30DF\u7BB1\u304B\u3089\u5FA9\u5143\u3067\u304D\u307E\u3059\uFF08\u5B8C\u5168\u524A\u9664\u306F\u3057\u307E\u305B\u3093\uFF09\u3002\n\u7834\u58CA\u7684\u306A\u64CD\u4F5C\u3068\u3057\u3066\u6271\u3046\u305F\u3081 --yes \u304C\u5FC5\u8981\u3067\u3059\u3002",destructive:true,flags:[FILE_REF_FLAG],plan:input=>({method:"DELETE",path:filePath(fileRef(input,DELETE_USAGE2))}),summarize:body=>body,
125
+ raw:body=>body},...BULK_OPERATIONS],subresources:[mediaFolderResource]};export{mediaDomain,orphanGuidance};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{boundedText}from"./chunk-XDHLO54T.js";import{NOTIFICATIONS_PATH}from"./chunk-3WHD2YVF.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";
3
+ import{boundedText}from"./chunk-XDHLO54T.js";import{NOTIFICATIONS_PATH}from"./chunk-4F2ONF4P.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-IOGMOXYF.js";import{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";
4
4
  import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var LABEL="\u901A\u77E5";var LIST_COLUMNS=["id","datetime","category_name","status_name","title"];var GET_COLUMNS=["id","datetime","category","category_name","status_name","read_time","title","content","url"];var CATEGORY_FLAG={name:"--category",summary:"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u30AD\u30FC\u304B\u540D\u524D\u3002twp notification categories \u3067\u4E00\u89A7\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u30AB\u30C6\u30B4\u30EA>"};var CATEGORY_HELP="\
5
5
  --category \u306F\u30AB\u30C6\u30B4\u30EA\u306E\u30AD\u30FC\uFF08workflow_approval\uFF09\u304B\u540D\u524D\uFF08\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u627F\u8A8D\u4F9D\u983C\uFF09\u3067\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\n\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7\u3068\u7167\u5408\u3059\u308B\u306E\u3067\u3001\u6253\u3061\u9593\u9055\u3048\u305F\u30AB\u30C6\u30B4\u30EA\u3092\u300C0\u4EF6\u300D\u3068\u3057\u3066\u8FD4\u3059\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u4E00\u89A7\u306F\u65E2\u5B9A10\u5206\u30AD\u30E3\u30C3\u30B7\u30E5\u30FB--refresh \u3067\u53D6\u308A\u76F4\u3057\uFF09\u3002";
6
6
  async function resolveCategory(input,ctx){const raw=nonEmpty(input.flags,CATEGORY_FLAG.name);if(raw===void 0)return input;return withResolved(input,{category:(await ctx.resolver.notificationCategory(raw.trim())).id})}function noArgs(input,op){if(input.args.length>0){throw new UsageError(`${op} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,`twp notification ${op} help`)}}function notificationId(input,op){const[raw,...rest]=input.args;const id=raw?.trim()??
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{cursorFlag,graphData,graphListFlags,graphPaging,graphPagingHelp,graphPagingNotes,graphValue,ms365Forbidden,str,topFlag}from"./chunk-QICH2OOI.js";import{assertMs365PathSegment,ms365Path,ms365Segment}from"./chunk-3HH5IYNO.js";import"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var UPLOAD_CHUNK_BYTES=320*1024*32;var UPLOAD_MAX_BYTES=250*1024*1024;var BAD_NAME=/["*:<>?/\\|#%\p{Cc}\p{Cf}]/u;var DRIVE_FLAG={name:"--drive",summary:"\u30C9\u30E9\u30A4\u30D6ID\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive\u3002\u30C1\u30E3\u30CD\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u306F twp teams channel folder \u306E driveId\uFF09",takesValue:true,placeholder:"<ID>"};function driveOf(input){const raw=input.flags.get("--drive");return raw===void 0?"me":assertMs365PathSegment(raw.trim(),
4
- "\u30C9\u30E9\u30A4\u30D6ID")}function driveNote(input){return input.flags.has("--drive")?null:"--drive \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u81EA\u5206\u306E OneDrive \u3092\u5BFE\u8C61\u306B\u3057\u307E\u3057\u305F\u3002"}function fileNameOf(input,localPath){const raw=input.flags.get("--name");const name=(raw??path.basename(localPath)).trim();if(name===""||/^\.+$/.test(name)||BAD_NAME.test(name)||[...name].length>255){throw new UsageError(`\u30C9\u30E9\u30A4\u30D6\u306B\u7F6E\u304F\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u3042\u308A\u307E\u3059: ${JSON.
3
+ import{cursorFlag,graphData,graphListFlags,graphPaging,graphPagingHelp,graphPagingNotes,graphValue,ms365Forbidden,str,topFlag}from"./chunk-QICH2OOI.js";import{assertMs365PathSegment,ms365Path,ms365Segment}from"./chunk-3HH5IYNO.js";import"./chunk-IOGMOXYF.js";import{requireResolved,singleRef,withResolved}from"./chunk-LXIAOCUW.js";import{isRecord,pick}from"./chunk-VTQAI52S.js";import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var UPLOAD_CHUNK_BYTES=320*1024*32;var UPLOAD_MAX_BYTES=250*1024*1024;var BAD_NAME=/["*:<>?/\\|#%\p{Cc}\p{Cf}]/u;var DRIVE_FLAG={name:"--drive",summary:"\u30C9\u30E9\u30A4\u30D6ID\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive\u3002\u30C1\u30E3\u30CD\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u306F twp teams channel folder \u306E driveId\uFF09",takesValue:true,placeholder:"<ID>"};var MY_DRIVE="me";function driveOf(input){const raw=input.flags.get("--drive");return raw===void 0?MY_DRIVE:assertMs365PathSegment(
4
+ raw.trim(),"\u30C9\u30E9\u30A4\u30D6ID")}function driveNote(input){return input.flags.has("--drive")?null:"--drive \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u81EA\u5206\u306E OneDrive \u3092\u5BFE\u8C61\u306B\u3057\u307E\u3057\u305F\u3002"}function fileNameOf(input,localPath){const raw=input.flags.get("--name");const name=(raw??path.basename(localPath)).trim();if(name===""||/^\.+$/.test(name)||BAD_NAME.test(name)||[...name].length>255){throw new UsageError(`\u30C9\u30E9\u30A4\u30D6\u306B\u7F6E\u304F\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u3042\u308A\u307E\u3059: ${JSON.
5
5
  stringify(name)}`,raw===void 0?'--name \u3067\u5225\u306E\u540D\u524D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08" * : < > ? / \\ | # % \u3068\u5236\u5FA1\u6587\u5B57\u306F\u4F7F\u3048\u307E\u305B\u3093\u30FB255 \u6587\u5B57\u307E\u3067\uFF09\u3002':'" * : < > ? / \\ | # % \u3068\u5236\u5FA1\u6587\u5B57\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08255 \u6587\u5B57\u307E\u3067\uFF09\u3002')}return name}function measure(localPath){let fd;try{fd=fs.openSync(localPath,"r")}catch(err){const reason=err.
6
6
  code??err.message;throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093: ${localPath}\uFF08${reason}\uFF09`)}try{const stat=fs.fstatSync(fd);if(!stat.isFile())throw new UsageError(`\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u4EE5\u5916\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${localPath}`);if(stat.size===0)throw new UsageError(`\u7A7A\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093: ${localPath}`);
7
7
  if(stat.size>UPLOAD_MAX_BYTES){throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u304C\u5927\u304D\u3059\u304E\u307E\u3059\uFF08${stat.size} \u30D0\u30A4\u30C8\u30FB\u4E0A\u9650 ${UPLOAD_MAX_BYTES} \u30D0\u30A4\u30C8\uFF09: ${localPath}`)}return stat.size}finally{fs.closeSync(fd)}}function uploadUrlOf(body){const url=graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u30BB\u30C3\u30B7\u30E7\u30F3")["uploadUrl"];if(typeof url!=="string"||!url.startsWith("https://")||/^https:\/\/[^/]*@/.test(url)){
@@ -23,17 +23,21 @@ takesValue:true,placeholder:"<ID>"},{name:"--name",summary:"\u30C9\u30E9\u30A4\u
23
23
  flags.has("--folder")&&(input.flags.get("--folder")??"").trim()===""){throw new UsageError("--folder \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093",usage)}const folder=assertMs365PathSegment((input.flags.get("--folder")??"root").trim(),"\u30D5\u30A9\u30EB\u30C0ID");const name=fileNameOf(input,localPath);const size=measure(localPath);return withResolved(input,{driveId:driveOf(input),folderId:folder,localPath,name,size:String(size)})},plan:sessionPlan,async execute(input,ctx){
24
24
  const session=await ctx.send(sessionPlan(input));const item=await uploadChunks(ctx,uploadUrlOf(session),requireResolved(input,"localPath"),Number(requireResolved(input,"size")));return{result:true,data:item}},plannedNotes(input){const size=Number(requireResolved(input,"size"));const pieces=Math.ceil(size/UPLOAD_CHUNK_BYTES);return[...[driveNote(input)].filter(v=>v!==null),`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9: ${requireResolved(input,"localPath")}\uFF08${size} \u30D0\u30A4\u30C8\uFF09\u2192 \u30D5\u30A9\u30EB\u30C0 ${requireResolved(
25
25
  input,"folderId")} \u306B\u300C${requireResolved(input,"name")}\u300D\uFF08\u540C\u540D\u304C\u3042\u308C\u3070\u540D\u524D\u3092\u5909\u3048\u3066\u4FDD\u5B58\u30FB\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\uFF09\u3002\u30BB\u30C3\u30B7\u30E7\u30F3\u3092\u4F5C\u3063\u305F\u5F8C\u3001Microsoft 365 \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9 URL \u3078 ${pieces} \u56DE\u306B\u5206\u3051\u3066\u9001\u308A\u307E\u3059\u3002`]},summarize:body=>pick(graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9"),
26
- ITEM_COLUMNS),raw:body=>graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9"),notes:body=>{const name=str(graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9")["name"]);return[`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u307E\u3057\u305F${name===null?"":`\uFF08\u30C9\u30E9\u30A4\u30D6\u4E0A\u306E\u540D\u524D: ${name}\uFF09`}\u3002`]}};var SCOPES=["organization","anonymous"];var TYPES=["view","edit"];var linkCreate={name:"create",summary:"\u30D5\u30A1\u30A4\u30EB\u30FB\u30D5\u30A9\u30EB\u30C0\u306E\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u308B\uFF08--scope \u5FC5\u9808\u30FB--yes \u304C\u5FC5\u8981\uFF09",
26
+ ITEM_COLUMNS),raw:body=>graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9"),notes:body=>{const name=str(graphData(body,"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9")["name"]);return[`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u307E\u3057\u305F${name===null?"":`\uFF08\u30C9\u30E9\u30A4\u30D6\u4E0A\u306E\u540D\u524D: ${name}\uFF09`}\u3002`]}};var SCOPES=["organization","anonymous"];var TYPES=["view","edit"];function linkPlan(input,drive){const item=ms365Segment(requireResolved(input,"itemId"),"\u9805\u76EEID");
27
+ return{method:"POST",path:ms365Path(`/drives/${ms365Segment(drive,"\u30C9\u30E9\u30A4\u30D6ID")}/items/${item}/createLink`),body:{type:requireResolved(input,"type"),scope:requireResolved(input,"scope")}}}async function myDriveIdOf(ctx,input){const item=ms365Segment(requireResolved(input,"itemId"),"\u9805\u76EEID");const data=graphData(await ctx.send({method:"GET",path:ms365Path(`/drives/${MY_DRIVE}/items/${item}`)}),"\u30D5\u30A1\u30A4\u30EB\u60C5\u5831");const driveId=isRecord(data["parentRefer\
28
+ ence"])?str(data["parentReference"]["driveId"]):null;if(driveId===null){throw new ApiResponseError("\u9805\u76EE\u306E\u60C5\u5831\u306B parentReference.driveId \u304C\u3042\u308A\u307E\u305B\u3093\u3002--drive \u306B\u5B9F\u969B\u306E\u30C9\u30E9\u30A4\u30D6ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return assertMs365PathSegment(driveId,"\u30C9\u30E9\u30A4\u30D6ID")}var linkCreate={name:"create",summary:"\u30D5\u30A1\u30A4\u30EB\u30FB\u30D5\u30A9\u30EB\u30C0\u306E\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u308B\uFF08--scope \u5FC5\u9808\u30FB--yes \u304C\u5FC5\u8981\uFF09",
27
29
  usage:"twp onedrive link create <\u9805\u76EEID> --scope <organization|anonymous> [--type <view|edit>] [--drive <ID>] --yes",description:"\u26A0 \u4F5C\u3063\u305F\u30EA\u30F3\u30AF\u3092\u77E5\u308B\u4EBA\u304C\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3051\u308B\u3088\u3046\u306B\u306A\u308A\u307E\u3059\u3002\u3053\u306E CLI \u304B\u3089\u306F\u30EA\u30F3\u30AF\u3092\u6D88\u305B\u307E\u305B\u3093\n \uFF08\u6D88\u3059\u306B\u306F OneDrive \u306E\u300C\u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u306E\u7BA1\u7406\u300D\u304B\u3089\u5916\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002--yes \u304C\u7121\u3051\u308C\u3070\u5B9F\u884C\u3057\u307E\u305B\u3093\u3002\n\n--scope \u306F\u5FC5\u305A\u6307\u5B9A\u3057\u307E\u3059\uFF08\u65E2\u5B9A\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002\n organization \u81EA\u5206\u306E\u7D44\u7E54\uFF08\u30C6\u30CA\u30F3\u30C8\uFF09\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u305F\u4EBA\u3060\u3051\u304C\u958B\u3051\u308B\n anonymous \u30EA\u30F3\u30AF\u3092\u77E5\u3063\u3066\u3044\u308C\u3070\u7D44\u7E54\u306E\u5916\u306E\u8AB0\u3067\u3082\u30B5\u30A4\u30F3\u30A4\u30F3\u306A\u3057\u3067\u958B\u3051\u308B\uFF08\u30C6\u30CA\u30F3\u30C8\u3067\u7981\u6B62\u3055\u308C\u3066\u3044\u308C\u3070\u4F5C\u308C\u307E\u305B\u3093\uFF09\n--type \u306F view\uFF08\u95B2\u89A7\u306E\u307F\u30FB\u65E2\u5B9A\uFF09\u304B edit\uFF08\u7DE8\u96C6\u3082\u53EF\uFF09\u3067\u3059\u3002\n\u540C\u3058\u9805\u76EE\u30FB\u540C\u3058\u7BC4\u56F2\u30FB\u540C\u3058\u7A2E\u985E\u306E\u30EA\u30F3\u30AF\u304C\u65E2\u306B\u3042\u308C\u3070\u3001Microsoft 365 \u306F\u305D\u306E\u30EA\u30F3\u30AF\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u9805\u76EEID \u306F twp onedrive \
28
- item list \u306E id \u3067\u3059\u3002",destructive:true,confirmation:"\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u308B\u64CD\u4F5C\uFF08\u30EA\u30F3\u30AF\u3092\u77E5\u308B\u4EBA\u304C\u958B\u3051\u308B\u3088\u3046\u306B\u306A\u308A\u3001\u3053\u306E CLI \u304B\u3089\u306F\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\uFF09",flags:[{name:"--item",summary:"\u9805\u76EEID\uFF08\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF09",takesValue:true,placeholder:"<ID>"},{name:"--scope",summary:"\u958B\u3051\
29
- \u308B\u7BC4\u56F2\uFF08organization / anonymous\u30FB\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u7BC4\u56F2>"},{name:"--type",summary:"view\uFF08\u95B2\u89A7\u30FB\u65E2\u5B9A\uFF09/ edit\uFF08\u7DE8\u96C6\uFF09",takesValue:true,placeholder:"<\u7A2E\u985E>"},DRIVE_FLAG],forbidden:ms365Forbidden,async prepare(input){const usage="twp onedrive link create help";const item=assertMs365PathSegment(singleRef(input,{flag:"--item",label:"\u9805\u76EEID",usage}),"\u9805\u76EEID");const scope=input.
30
- flags.get("--scope")?.trim();if(scope===void 0||!SCOPES.includes(scope)){throw new UsageError(scope===void 0?"--scope \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u65E2\u5B9A\u306F\u3042\u308A\u307E\u305B\u3093\uFF09":`--scope \u306F organization \u304B anonymous \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${scope}\uFF09`,usage)}const type=input.flags.get("--type")?.trim()??"view";if(!TYPES.includes(type))throw new UsageError(`--type \u306F view \u304B edit \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${type}\
31
- \uFF09`,usage);return withResolved(input,{driveId:driveOf(input),itemId:item,scope,type})},plan(input){const drive=ms365Segment(requireResolved(input,"driveId"),"\u30C9\u30E9\u30A4\u30D6ID");const item=ms365Segment(requireResolved(input,"itemId"),"\u9805\u76EEID");return{method:"POST",path:ms365Path(`/drives/${drive}/items/${item}/createLink`),body:{type:requireResolved(input,"type"),scope:requireResolved(input,"scope")}}},plannedNotes(input){const scope=requireResolved(input,"scope");return[...[
32
- driveNote(input)].filter(v=>v!==null),...input.flags.has("--type")?[]:["--type \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\uFF08view\uFF09\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u308A\u307E\u3059\u3002"],scope==="anonymous"?"\u26A0 \u533F\u540D\u30EA\u30F3\u30AF\uFF08anonymous\uFF09\u3092\u4F5C\u308A\u307E\u3059\u3002\u30EA\u30F3\u30AF\u3092\u77E5\u3063\u3066\u3044\u308C\u3070\u7D44\u7E54\u306E\u5916\u306E\u8AB0\u3067\u3082\u30B5\u30A4\u30F3\u30A4\u30F3\u306A\u3057\u3067\u958B\u3051\u307E\u3059\u3002":
33
- "\u7D44\u7E54\u5185\u30EA\u30F3\u30AF\uFF08organization\uFF09\u3092\u4F5C\u308A\u307E\u3059\u3002\u7D44\u7E54\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u305F\u4EBA\u304C\u958B\u3051\u307E\u3059\u3002"]},summarize(body){const data=graphData(body,"\u5171\u6709\u30EA\u30F3\u30AF");const link=isRecord(data["link"])?data["link"]:null;if(link===null||str(link["webUrl"])===null)throw new ApiResponseError("\u5171\u6709\u30EA\u30F3\u30AF\u306E\u5FDC\u7B54\u306B link.webUrl \u304C\u3042\u308A\u307E\u305B\u3093\u3002");
34
- return{id:data["id"]??null,webUrl:link["webUrl"],type:link["type"]??null,scope:link["scope"]??null}},raw:body=>graphData(body,"\u5171\u6709\u30EA\u30F3\u30AF")};var itemWriteOperations=[upload];var linkResource={name:"link",summary:"\u5171\u6709\u30EA\u30F3\u30AF\uFF08\u4F5C\u6210\uFF09",operations:[linkCreate]};var MY_DRIVE="me";var ITEM_COLUMNS2=["id","name","kind","size","childCount","lastModifiedDateTime","lastModifiedBy"];var ITEM_GET_COLUMNS=["id","name","kind","size","mimeType","childCount","driveId","parentId","createdDateTime","lastModifiedDateTime","lastModifiedBy","webUrl"];var DRIVE_FLAG2={name:"--drive",summary:"\u30C9\u30E9\u30A4\u30D6ID\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive\u3002\u30C1\u30E3\u30CD\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u306F twp teams channel folder \u306E driveId\uFF09",
30
+ item list \u306E id \u3067\u3059\u3002\n--drive \u3092\u7701\u304F\u3068\u81EA\u5206\u306E OneDrive \u306E\u9805\u76EE\u3068\u3057\u3066\u6271\u3044\u3001\u9001\u308B\u524D\u306B\u9805\u76EE\u30921\u56DE\u8AAD\u3093\u3067\u5B9F\u969B\u306E\u30C9\u30E9\u30A4\u30D6ID \u3092\u8ABF\u3079\u307E\u3059\n\uFF08--dry-run \u306E URL \u306B\u306F me \u3068\u51FA\u307E\u3059\u3002Microsoft 365 \u306F me \u306E\u307E\u307E\u3067\u306F\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u3089\u306A\u3044\u305F\u3081\u3067\u3059\uFF09\u3002",
31
+ destructive:true,confirmation:"\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u308B\u64CD\u4F5C\uFF08\u30EA\u30F3\u30AF\u3092\u77E5\u308B\u4EBA\u304C\u958B\u3051\u308B\u3088\u3046\u306B\u306A\u308A\u3001\u3053\u306E CLI \u304B\u3089\u306F\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\uFF09",flags:[{name:"--item",summary:"\u9805\u76EEID\uFF08\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\uFF09",takesValue:true,placeholder:"<ID>"},{name:"--scope",summary:"\u958B\u3051\u308B\u7BC4\u56F2\uFF08organization / anonymous\u30FB\u5FC5\u9808\uFF09",
32
+ takesValue:true,placeholder:"<\u7BC4\u56F2>"},{name:"--type",summary:"view\uFF08\u95B2\u89A7\u30FB\u65E2\u5B9A\uFF09/ edit\uFF08\u7DE8\u96C6\uFF09",takesValue:true,placeholder:"<\u7A2E\u985E>"},DRIVE_FLAG],forbidden:ms365Forbidden,async prepare(input){const usage="twp onedrive link create help";const item=assertMs365PathSegment(singleRef(input,{flag:"--item",label:"\u9805\u76EEID",usage}),"\u9805\u76EEID");const scope=input.flags.get("--scope")?.trim();if(scope===void 0||!SCOPES.includes(scope)){
33
+ throw new UsageError(scope===void 0?"--scope \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u65E2\u5B9A\u306F\u3042\u308A\u307E\u305B\u3093\uFF09":`--scope \u306F organization \u304B anonymous \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${scope}\uFF09`,usage)}const type=input.flags.get("--type")?.trim()??"view";if(!TYPES.includes(type))throw new UsageError(`--type \u306F view \u304B edit \u3067\u3059\uFF08\u53D7\u3051\u53D6\u3063\u305F\u5024: ${type}\uFF09`,usage);return withResolved(
34
+ input,{driveId:driveOf(input),itemId:item,scope,type})},plan:input=>linkPlan(input,requireResolved(input,"driveId")),async execute(input,ctx){const drive=requireResolved(input,"driveId");return ctx.send(linkPlan(input,drive===MY_DRIVE?await myDriveIdOf(ctx,input):drive))},plannedNotes(input){const scope=requireResolved(input,"scope");const resolveNote=requireResolved(input,"driveId")===MY_DRIVE?[`\u9001\u308B\u524D\u306B\u9805\u76EE\u3092\u8AAD\u307F\uFF08GET drives/me/items/${requireResolved(input,
35
+ "itemId")}\uFF09\u3001URL \u306E me \u3092\u5B9F\u969B\u306E\u30C9\u30E9\u30A4\u30D6ID \u306B\u7F6E\u304D\u63DB\u3048\u3066\u9001\u308A\u307E\u3059\uFF08Microsoft 365 \u306F drives/me \u306E\u307E\u307E\u3067\u306F\u5171\u6709\u30EA\u30F3\u30AF\u3092\u4F5C\u308A\u307E\u305B\u3093\uFF09\u3002`]:[];return[...[driveNote(input)].filter(v=>v!==null),...resolveNote,...input.flags.has("--type")?[]:["--type \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\uFF08view\uFF09\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u308A\u307E\u3059\u3002"],
36
+ scope==="anonymous"?"\u26A0 \u533F\u540D\u30EA\u30F3\u30AF\uFF08anonymous\uFF09\u3092\u4F5C\u308A\u307E\u3059\u3002\u30EA\u30F3\u30AF\u3092\u77E5\u3063\u3066\u3044\u308C\u3070\u7D44\u7E54\u306E\u5916\u306E\u8AB0\u3067\u3082\u30B5\u30A4\u30F3\u30A4\u30F3\u306A\u3057\u3067\u958B\u3051\u307E\u3059\u3002":"\u7D44\u7E54\u5185\u30EA\u30F3\u30AF\uFF08organization\uFF09\u3092\u4F5C\u308A\u307E\u3059\u3002\u7D44\u7E54\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u305F\u4EBA\u304C\u958B\u3051\u307E\u3059\u3002"]},
37
+ summarize(body){const data=graphData(body,"\u5171\u6709\u30EA\u30F3\u30AF");const link=isRecord(data["link"])?data["link"]:null;if(link===null||str(link["webUrl"])===null)throw new ApiResponseError("\u5171\u6709\u30EA\u30F3\u30AF\u306E\u5FDC\u7B54\u306B link.webUrl \u304C\u3042\u308A\u307E\u305B\u3093\u3002");return{id:data["id"]??null,webUrl:link["webUrl"],type:link["type"]??null,scope:link["scope"]??null}},raw:body=>graphData(body,"\u5171\u6709\u30EA\u30F3\u30AF")};var itemWriteOperations=[upload];
38
+ var linkResource={name:"link",summary:"\u5171\u6709\u30EA\u30F3\u30AF\uFF08\u4F5C\u6210\uFF09",operations:[linkCreate]};var MY_DRIVE2="me";var ITEM_COLUMNS2=["id","name","kind","size","childCount","lastModifiedDateTime","lastModifiedBy"];var ITEM_GET_COLUMNS=["id","name","kind","size","mimeType","childCount","driveId","parentId","createdDateTime","lastModifiedDateTime","lastModifiedBy","webUrl"];var DRIVE_FLAG2={name:"--drive",summary:"\u30C9\u30E9\u30A4\u30D6ID\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive\u3002\u30C1\u30E3\u30CD\u30EB\u306E\u30D5\u30A1\u30A4\u30EB\u306F twp teams channel folder \u306E driveId\uFF09",
35
39
  takesValue:true,placeholder:"<ID>"};function itemRow(row){const source=isRecord(row)?row:{};const folder=isRecord(source["folder"])?source["folder"]:null;const file=isRecord(source["file"])?source["file"]:null;const parent=isRecord(source["parentReference"])?source["parentReference"]:{};const modifiedBy=isRecord(source["lastModifiedBy"])&&isRecord(source["lastModifiedBy"]["user"])?str(source["lastModifiedBy"]["user"]["displayName"]):null;return pick({...source,kind:folder!==null?"folder":file!==
36
- null?"file":null,childCount:folder?.["childCount"]??null,mimeType:file?.["mimeType"]??null,driveId:parent["driveId"]??null,parentId:parent["id"]??null,lastModifiedBy:modifiedBy},ITEM_GET_COLUMNS)}function driveOf2(input){const raw=input.flags.get("--drive");return raw===void 0?MY_DRIVE:assertMs365PathSegment(raw.trim(),"\u30C9\u30E9\u30A4\u30D6ID")}function driveNotes(input){return input.flags.has("--drive")?[]:["--drive \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u81EA\u5206\u306E OneDrive \u3092\u5BFE\u8C61\u306B\u3057\u307E\u3057\u305F\u3002"]}
40
+ null?"file":null,childCount:folder?.["childCount"]??null,mimeType:file?.["mimeType"]??null,driveId:parent["driveId"]??null,parentId:parent["id"]??null,lastModifiedBy:modifiedBy},ITEM_GET_COLUMNS)}function driveOf2(input){const raw=input.flags.get("--drive");return raw===void 0?MY_DRIVE2:assertMs365PathSegment(raw.trim(),"\u30C9\u30E9\u30A4\u30D6ID")}function driveNotes(input){return input.flags.has("--drive")?[]:["--drive \u3092\u7701\u7565\u3057\u305F\u305F\u3081\u3001\u81EA\u5206\u306E OneDrive \u3092\u5BFE\u8C61\u306B\u3057\u307E\u3057\u305F\u3002"]}
37
41
  var itemResource={name:"item",summary:"\u30C9\u30E9\u30A4\u30D6\u306E\u30D5\u30A1\u30A4\u30EB\u3068\u30D5\u30A9\u30EB\u30C0\uFF08\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30FB\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\uFF09",operations:[{name:"list",summary:"\u30D5\u30A9\u30EB\u30C0\u306E\u4E2D\u8EAB\u3092\u4E00\u89A7\u3059\u308B\uFF08\u65E2\u5B9A\u306F\u81EA\u5206\u306E OneDrive \u306E\u6700\u4E0A\u4F4D\uFF09",usage:"twp onedrive item list [<\u30D5\u30A9\u30EB\u30C0ID>] [--drive <ID>] [--\
38
42
  limit <\u4EF6\u6570>] [--all]",description:"\u30D5\u30A9\u30EB\u30C0ID \u3092\u7701\u304F\u3068\u30C9\u30E9\u30A4\u30D6\u306E\u6700\u4E0A\u4F4D\uFF08root\uFF09\u3092\u4E00\u89A7\u3057\u307E\u3059\u3002kind \u304C folder \u306E\u884C\u306E id \u3092\u6E21\u3059\u3068\u3001\n\u305D\u306E\u30D5\u30A9\u30EB\u30C0\u306E\u4E2D\u3092\u4E00\u89A7\u3067\u304D\u307E\u3059\u3002\n\n"+graphPagingHelp(null),flags:[{name:"--folder",summary:"\u30D5\u30A9\u30EB\u30C0ID\uFF08\u4F4D\u7F6E\u5F15\u6570\u3068\u540C\u3058\u610F\u5473\u30FB\u65E2\u5B9A root\uFF09",
39
43
  takesValue:true,placeholder:"<ID>"},DRIVE_FLAG2,...graphListFlags({limit:true})],forbidden:ms365Forbidden,paging:graphPaging({label:"\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7",kind:"skiptoken"}),async prepare(input){if(input.flags.has("--folder")&&(input.flags.get("--folder")??"").trim()===""){throw new UsageError("--folder \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093","twp onedrive item list help")}const folder=singleRef(input,{flag:"--folder",label:"\u30D5\u30A9\u30EB\u30C0ID",
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{activateModeFiles,activatePermissionSettings,buildResidentSet,buildSystemPrompt,createAuditLogger,createTwpToolkit,currentBranch,displayCwd,residentInputs,runTurn}from"./chunk-LKS7GANP.js";import"./chunk-NZ7WI4RZ.js";import"./chunk-AUAZP2G7.js";import"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import{RelayError,createRuntime,pickModel}from"./chunk-6QOT7CHX.js";import"./chunk-D233KKXW.js";
3
+ import{activateModeFiles,activatePermissionSettings,buildResidentSet,buildSystemPrompt,createAuditLogger,createTwpToolkit,currentBranch,displayCwd,residentInputs,runTurn}from"./chunk-LKS7GANP.js";import"./chunk-NZ7WI4RZ.js";import"./chunk-AUAZP2G7.js";import"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import{RelayError,createRuntime,pickModel}from"./chunk-6QOT7CHX.js";import"./chunk-D233KKXW.js";
4
4
  import"./chunk-XNLIEUAW.js";import{checkMinSupportedVersion,enforceMinSupportedVersion,floorNeedsRefresh}from"./chunk-DXXFUNYN.js";import"./chunk-4VZKNEVN.js";import{getMode}from"./chunk-NAUH75MM.js";import"./chunk-N2UVRM3Z.js";import"./chunk-II5RVJQN.js";import"./chunk-UFND7FBC.js";import"./chunk-PMOUHEJQ.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";async function runOneShot(opts,deps={}){const out=deps.out??(text=>void process.stdout.write(stripTerminalControls(text)));const err=deps.err??(text=>void process.stderr.write(stripTerminalControls(text)));activateModeFiles(err);const permissionLayers=activatePermissionSettings(err,{...opts.allowedTools?{allowedTools:opts.allowedTools}:{},...opts.disallowedTools?{disallowedTools:opts.disallowedTools}:{}});const prompt=opts.fromStdin?await(deps.readStdin??readStdin)():opts.prompt;if(prompt.trim()===
5
5
  ""){err('\u30D7\u30ED\u30F3\u30D7\u30C8\u304C\u7A7A\u3067\u3059\u3002`twp -p "\u8CEA\u554F"`\uFF08`-p -` \u3067\u6A19\u6E96\u5165\u529B\uFF09\n');return 2}const runtime=deps.runtime??createRuntime({...opts.profile!==void 0?{profile:opts.profile}:{},...opts.model!==void 0?{model:opts.model}:{},cliVersion:opts.version});const cachedFloor=runtime.loadCachedFloor();if(await checkMinSupportedVersion({current:opts.version,cachedFloor:cachedFloor.minSupportedVersion,refresh:async()=>(await runtime.loadCatalog()).
6
6
  minSupportedVersion,write:err})){return 1}if(!runtime.loggedIn){err("\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093\u3002`twp login` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n");return 1}let model=runtime.configuredModel??"";let catalog=null;if(model===""){catalog=await runtime.loadCatalog();const picked=pickModel(catalog,void 0);model=picked.model;if(catalog.source!=="server"){err(`\u26A0 \u30E2\u30C7\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081 ${model}\
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{STATUS_VALUES,booleanQuery,flatMasterDomain}from"./chunk-SBWCQAHT.js";import"./chunk-XDHLO54T.js";import{POSITIONS_PATH}from"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";
3
+ import{STATUS_VALUES,booleanQuery,flatMasterDomain}from"./chunk-A65V3K75.js";import"./chunk-XDHLO54T.js";import{POSITIONS_PATH}from"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";
4
4
  import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var positionDomain=flatMasterDomain({name:"position",label:"\u5F79\u8077",path:POSITIONS_PATH,itemKey:"position",summary:"\u5F79\u8077\u30DE\u30B9\u30BF\uFF08\u4E00\u89A7\u30FB\u53D6\u5F97\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",listColumns:["id","code","name","rank","is_manager","status","user_count"],getColumns:["id","code","name","name_short","rank","is_manager","status","description"],fields:[{kind:"text",flag:"--name-short",key:"name_short",label:"\u7565\u79F0",maxChars:50,
5
5
  summary:"\u7565\u79F0"},{kind:"integer",flag:"--rank",key:"rank",label:"\u30E9\u30F3\u30AF",min:0,max:9999,summary:"\u30E9\u30F3\u30AF\uFF080\u301C9999\u3002\u5927\u304D\u3044\u307B\u3069\u4E0A\u4F4D\uFF09"},{kind:"boolean",flag:"--manager",key:"is_manager",summary:"\u7BA1\u7406\u8077\u304B\uFF08true / false\uFF09"},{kind:"boolean",flag:"--can-view-personal-info",key:"can_view_personal_info",summary:"\u90E8\u4E0B\u306E\u500B\u4EBA\u60C5\u5831\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},
6
6
  {kind:"boolean",flag:"--can-view-emergency-contact",key:"can_view_emergency_contact",summary:"\u90E8\u4E0B\u306E\u7DCA\u6025\u9023\u7D61\u5148\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},{kind:"boolean",flag:"--can-view-work-tel",key:"can_view_work_tel",summary:"\u90E8\u4E0B\u306E\u696D\u52D9\u7528\u96FB\u8A71\u756A\u53F7\u3092\u95B2\u89A7\u3067\u304D\u308B\u304B\uFF08true / false\uFF09"},{kind:"enum",flag:"--status",key:"status",values:STATUS_VALUES,summary:"\u72B6\u614B\uFF08active: \u6709\
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{ASSIGNED_PROJECT_COLUMNS,assignedProjectItems,projectDomain}from"./chunk-VMULCEHY.js";import"./chunk-IXFMXUNT.js";import"./chunk-E7MUDY4P.js";import"./chunk-YLXW7TIU.js";import"./chunk-4B3T4UE7.js";import"./chunk-XDHLO54T.js";import"./chunk-ORUDW52G.js";import"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";
3
+ import{ASSIGNED_PROJECT_COLUMNS,assignedProjectItems,projectDomain}from"./chunk-XQRSX2RH.js";import"./chunk-IXFMXUNT.js";import"./chunk-MY2U3CD6.js";import"./chunk-QOUDJ7XO.js";import"./chunk-4B3T4UE7.js";import"./chunk-XDHLO54T.js";import"./chunk-ORUDW52G.js";import"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";
4
4
  import"./chunk-QQRJLH6B.js";import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{ASSIGNED_PROJECT_COLUMNS,assignedProjectItems,projectDomain};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{CUSTOMER_LICENSE,INTERACTION_FIELDS,INTERACTION_TYPES,dataOf,levelForbidden}from"./chunk-HS7EKE7M.js";import"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,resolveRefFields,updateFlags}from"./chunk-SBWCQAHT.js";import"./chunk-2YNZ4MRT.js";import"./chunk-OHXZO5WK.js";import"./chunk-V24LKF3V.js";import"./chunk-XDHLO54T.js";import{PROSPECTS_PATH}from"./chunk-3WHD2YVF.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";
3
+ import{CUSTOMER_LICENSE,INTERACTION_FIELDS,INTERACTION_TYPES,dataOf,levelForbidden}from"./chunk-KS2ZUQFC.js";import"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,resolveRefFields,updateFlags}from"./chunk-A65V3K75.js";import"./chunk-2YNZ4MRT.js";import"./chunk-OHXZO5WK.js";import"./chunk-GOZCJLRA.js";import"./chunk-XDHLO54T.js";import{PROSPECTS_PATH}from"./chunk-4F2ONF4P.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";
4
4
  import{repeatedValues}from"./chunk-F7K37QG6.js";import{MultipartBody}from"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-GY7KI5E5.js";import"./chunk-II5RVJQN.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{
5
5
  ApiRejectedError,ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";import fs from"fs";import path from"path";var VIEW_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u3092\u898B\u308B\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");var EDIT_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E\u767B\u9332\u30FB\u66F4\u65B0\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7DE8\u96C6\u8005\u300D\u4EE5\u4E0A\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");
6
6
  function adminForbidden(what){return levelForbidden(CUSTOMER_LICENSE,`${what}\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\uFF08\u300C\u7DE8\u96C6\u8005\u300D\u3067\u306F\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}var ASSIGNABLE_STATUSES=["new","approaching","responded","appointment","reject\
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{inspectCaseDocumentFile}from"./chunk-AKPVALTZ.js";import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-JYNZEZYL.js";import"./chunk-HS7EKE7M.js";import"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-SBWCQAHT.js";import{purchaseNoRuleResource}from"./chunk-EZMXGIGX.js";import{purchasePdfOperation}from"./chunk-L7IGGC7H.js";import"./chunk-2YNZ4MRT.js";import{salesAdminForbidden}from"./chunk-QVZGNHRE.js";
4
- import"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-V24LKF3V.js";import{booleanText,boundedText,isoDate}from"./chunk-XDHLO54T.js";import{readBody}from"./chunk-ORUDW52G.js";import{SALES_PURCHASES_PATH,SALES_PURCHASE_AI_MAPPINGS_PATH,isExactNumericId,resolveNamed}from"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";
3
+ import{inspectCaseDocumentFile}from"./chunk-IO5SMECE.js";import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-JKL6NUVV.js";import"./chunk-KS2ZUQFC.js";import"./chunk-HNUBM24L.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-A65V3K75.js";import{purchaseNoRuleResource}from"./chunk-OYDF57NH.js";import{purchasePdfOperation}from"./chunk-VB2CSFRO.js";import"./chunk-2YNZ4MRT.js";import{salesAdminForbidden}from"./chunk-BN26WHLS.js";
4
+ import"./chunk-OHXZO5WK.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-GOZCJLRA.js";import{booleanText,boundedText,isoDate}from"./chunk-XDHLO54T.js";import{readBody}from"./chunk-ORUDW52G.js";import{SALES_PURCHASES_PATH,SALES_PURCHASE_AI_MAPPINGS_PATH,isExactNumericId,resolveNamed}from"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import{repeatedValues}from"./chunk-F7K37QG6.js";import{ApiError}from"./chunk-IF2K4PM5.js";
5
5
  import{NotLoggedInError,SessionExpiredError}from"./chunk-XNLIEUAW.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-GY7KI5E5.js";import"./chunk-II5RVJQN.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{requireResolved,withResolved}from"./chunk-LXIAOCUW.js";import{acknowledgement,isRecord,pick}from"./chunk-VTQAI52S.js";
6
6
  import{ApiResponseError,UsageError}from"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";var PATH=SALES_PURCHASE_AI_MAPPINGS_PATH;var LABEL="\u4ED5\u5165AI\u30DE\u30C3\u30D4\u30F3\u30B0";var SOURCE_LABEL_MAX_CHARS=255;var NOTE_MAX_CHARS=1e3;var SORT_MAX=2147483647;var LIST_COLUMNS=["id","source_label","target_field","target_field_label","company_name","is_active","sort_order"];var GET_COLUMNS=[...LIST_COLUMNS,"company_id","note"];var MEMBER_FORBIDDEN=licenseForbidden(featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"));var ADMIN_FORBIDDEN=salesAdminForbidden(`${LABEL}\u306E\u524A\u9664`);
7
7
  function usageOf(op){return`twp purchase ai-mapping ${op} help`}function text(value){return typeof value==="string"||typeof value==="number"?String(value):""}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){const data=envelope(body,LABEL)["da\
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{balanceRows,previousYearMonth,receivableDomain,yearMonthValue}from"./chunk-ZE75ZDLD.js";import"./chunk-QVZGNHRE.js";import"./chunk-OHXZO5WK.js";import"./chunk-V24LKF3V.js";import"./chunk-XDHLO54T.js";import"./chunk-ORUDW52G.js";import"./chunk-3WHD2YVF.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";
3
+ import{balanceRows,previousYearMonth,receivableDomain,yearMonthValue}from"./chunk-LAXINIDA.js";import"./chunk-BN26WHLS.js";import"./chunk-OHXZO5WK.js";import"./chunk-GOZCJLRA.js";import"./chunk-XDHLO54T.js";import"./chunk-ORUDW52G.js";import"./chunk-4F2ONF4P.js";import"./chunk-GMBJTG6A.js";import"./chunk-3HH5IYNO.js";import"./chunk-F7K37QG6.js";import"./chunk-IF2K4PM5.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";
4
4
  import"./chunk-II5RVJQN.js";import"./chunk-IOGMOXYF.js";import"./chunk-LXIAOCUW.js";import"./chunk-VTQAI52S.js";import"./chunk-UFND7FBC.js";import"./chunk-J7QYPKVK.js";import"./chunk-RZVI6PMW.js";import"./chunk-NHYMHCAT.js";import"./chunk-VSJBJXZO.js";export{balanceRows,previousYearMonth,receivableDomain,yearMonthValue};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{loadDomain}from"./chunk-B4APKONL.js";import"./chunk-VSJBJXZO.js";export{loadDomain};
3
+ import{loadDomain}from"./chunk-6ZB7A6VD.js";import"./chunk-VSJBJXZO.js";export{loadDomain};