@tocca-systems/twp-cli 0.38.0 → 0.40.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 (61) hide show
  1. package/CHANGELOG.public.md +22 -0
  2. package/README.md +213 -3
  3. package/dist/{api-command-BZVUZIOB.js → api-command-7PZCMQO5.js} +4 -4
  4. package/dist/{app-SNRFIHTQ.js → app-PNHDMD3V.js} +4 -4
  5. package/dist/{backlog-33ELMSV6.js → backlog-ISEIWKMQ.js} +1 -1
  6. package/dist/chunk-43OMEGNH.js +94 -0
  7. package/dist/{chunk-HAIZHSNZ.js → chunk-6ZUVESMI.js} +1 -1
  8. package/dist/chunk-7ACENLLZ.js +147 -0
  9. package/dist/{chunk-QBA6THJ5.js → chunk-B7YCG2T7.js} +1 -1
  10. package/dist/{chunk-IRT7VFG4.js → chunk-BPCK5RAB.js} +1 -1
  11. package/dist/{chunk-ADQD5OPN.js → chunk-BZ7ULFR3.js} +15 -14
  12. package/dist/{chunk-ZST7XESB.js → chunk-BZAXQOLB.js} +54 -43
  13. package/dist/chunk-EOSSFTNG.js +4 -0
  14. package/dist/chunk-FKS2Z34P.js +70 -0
  15. package/dist/{chunk-57HDZYSN.js → chunk-H54MGGHB.js} +1 -1
  16. package/dist/{chunk-TAN5I2DP.js → chunk-I4ARX6NM.js} +1 -1
  17. package/dist/chunk-L6AHCTQZ.js +8 -0
  18. package/dist/chunk-PEM3HR7L.js +58 -0
  19. package/dist/{chunk-VECUCVIY.js → chunk-PKWMJIBM.js} +1 -1
  20. package/dist/{chunk-BUZKNZ45.js → chunk-UT4FACHN.js} +5 -3
  21. package/dist/chunk-V3GQEUYI.js +16 -0
  22. package/dist/{chunk-FEOST3GF.js → chunk-VK5T7ULK.js} +1 -1
  23. package/dist/{chunk-LS7P3IWP.js → chunk-WV3ZKUF4.js} +25 -23
  24. package/dist/{chunk-OHIERIBW.js → chunk-X5IVIOGL.js} +1 -1
  25. package/dist/chunk-XN5TUZOT.js +48 -0
  26. package/dist/cli.js +247 -8
  27. package/dist/{commands-7PGS2PTH.js → commands-PG5VVBKO.js} +1 -1
  28. package/dist/company-4Z4JJVA7.js +71 -0
  29. package/dist/{completion-3X7HPIPM.js → completion-EFGQJDIU.js} +1 -1
  30. package/dist/contract-BQ76SGWV.js +86 -0
  31. package/dist/{department-PVUB3ZPI.js → department-YHZRSWLB.js} +1 -1
  32. package/dist/deposit-U4AVQH5O.js +4 -0
  33. package/dist/estimate-U2K7DPGH.js +173 -0
  34. package/dist/{inquiry-CUK2LWQK.js → inquiry-5D4U6CLU.js} +1 -1
  35. package/dist/invoice-2VLK2BFV.js +210 -0
  36. package/dist/{job-title-CZRZFVUU.js → job-title-G7MIYWVA.js} +1 -1
  37. package/dist/{knowledge-XYLG42MB.js → knowledge-7QDC775Q.js} +1 -1
  38. package/dist/{leave-DL3JPO5I.js → leave-GHFJOGNC.js} +1 -1
  39. package/dist/{media-CMNIZUPY.js → media-XO6X3UQT.js} +1 -1
  40. package/dist/{notification-ULATH7AC.js → notification-SUSR5NGQ.js} +1 -1
  41. package/dist/{oneshot-RYWJ6ECA.js → oneshot-UGYF2PLB.js} +1 -1
  42. package/dist/{position-ICOGEMRG.js → position-UY33ETLX.js} +1 -1
  43. package/dist/{prospect-MB2OP7L2.js → prospect-G426O6XL.js} +1 -1
  44. package/dist/purchase-3GGAQRE6.js +214 -0
  45. package/dist/receivable-TNH4KCUO.js +4 -0
  46. package/dist/{registry-XBYUPKQQ.js → registry-ODJB7AS3.js} +1 -1
  47. package/dist/{render-MTSSHDAZ.js → render-F4MRN2FQ.js} +1 -1
  48. package/dist/{report-JL7UJB4G.js → report-UC2PCK7B.js} +1 -1
  49. package/dist/run-GDYEOQQK.js +4 -0
  50. package/dist/sales-master-ORLR5VK4.js +71 -0
  51. package/dist/sales-numbering-MBFKVR2C.js +4 -0
  52. package/dist/supplier-payment-AFJ7G6AP.js +110 -0
  53. package/dist/{task-CMCHUX2D.js → task-S3BBBELE.js} +2 -2
  54. package/dist/{user-5JXFO56G.js → user-O7H5PD4N.js} +1 -1
  55. package/dist/{workflow-XBUMFS2G.js → workflow-2YL2OF2Y.js} +1 -1
  56. package/package.json +1 -1
  57. package/dist/chunk-GLBQAXWC.js +0 -6
  58. package/dist/chunk-O4NSYHR4.js +0 -3
  59. package/dist/company-GMCHRVHF.js +0 -161
  60. package/dist/run-6JRHCC67.js +0 -4
  61. package/dist/sales-GJKW7VVG.js +0 -4
@@ -16,23 +16,28 @@ const ttl=options.ttlMs??DEFAULT_TTL_MS;const now=(options.now??Date.now)();if(M
16
16
  const tmp=`${file}.${process.pid}.tmp`;try{fs.mkdirSync(dir,{recursive:true,mode:448});fs.writeFileSync(tmp,`${JSON.stringify(body)}
17
17
  `,{mode:384});fs.renameSync(tmp,file)}catch{try{fs.rmSync(tmp,{force:true})}catch{}}}function removeCache(key,options={}){const env=options.env??process.env;if(!isCacheLocationTrusted(env))return;try{fs.rmSync(cacheFilePath(key,env),{force:true})}catch{}}var SELF_REF="me";var PRIVATE_TASKS_PATH="/api/v2/tasks/private";var PRIVATE_MASTERS_CACHE_KEY="__private__";var BACKLOG_SPACES_CACHE_KEY="__backlog__";var BACKLOG_SCOPE_LABEL="\u3053\u306E\u63A5\u7D9A\u5148";var BACKLOG_PROJECT_SCOPE_LABEL="\u3053\u306E Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8";var PRIVATE_SCOPE_LABEL="\u500B\u4EBA\u30BF\u30B9\u30AF";var TENANT_CACHE_KEY="__tenant__";var TENANT_SCOPE_LABEL="\u3053\u306E\u30C6\u30CA\u30F3\u30C8";var ADMIN_USERS_LIST_PATH="/api/v2/admin/users\
18
18
  /list";var DEPARTMENTS_PATH="/api/v2/organization/departments";var POSITIONS_PATH="/api/v2/organization/positions";var JOB_TITLES_PATH="/api/v2/organization/job-titles";var INQUIRY_CATEGORIES_PATH="/api/v2/inquiries/categories";var NOTIFICATIONS_PATH="/api/v2/notifications";var NOTIFICATION_COUNT_MAX_PAGES=20;var NOTIFICATION_COUNT_PAGE_LIMIT=100;var WORKFLOWS_PATH="/api/v2/workflows";var REPORTS_PATH="/api/v2/reports";var SALES_ESTIMATES_PATH="/api/v2/sales/estimates";var SALES_INVOICES_PATH="/\
19
- api/v2/sales/invoices";var SALES_COMPANIES_PATH="/api/v2/sales/companies";var CUSTOMERS_PATH="/api/v2/customers";var COMPANY_SEARCH_PAGE_LIMIT=100;var COMPANY_SEARCH_MAX_PAGES=10;var CUSTOMER_CHILDREN_PAGE_LIMIT=100;var PROSPECTS_PATH="/api/v2/prospects";var PROSPECT_SEARCH_PAGE_LIMIT=100;var PROSPECT_SEARCH_MAX_PAGES=10;function isExactNumericId(value){return/^[0-9]+$/.test(value)&&String(Number(value))===value}function exactCompanyId(ref,label){if(!isExactNumericId(ref.id)){throw new ResolveError(
20
- `${label}\u4E00\u89A7\u306E id \u304C\u6574\u6570\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08${ref.id}\uFF09\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return ref}var ORG_MASTER_LIMIT=1e3;var USER_LIST_MAX_PAGES=100;function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function str(value){return typeof value==="string"&&value.trim()!==""?value:null}function truthyFlag(value){return value===true||value===1}function rawGetVia(client){
21
- return async path2=>{try{return{ok:true,status:200,json:await client.request("GET",path2),error:null}}catch(err){if(err instanceof ApiError){return{ok:false,status:err.status,json:err.body,error:err.message}}throw err}}}var TASK_MASTERS={status:{path:"task-statuses",envelope:"data",scope:"task-statuses",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"},type:{path:"task-types",envelope:"data",scope:"task-types",label:"\u7A2E\u5225"},category:{path:"task-categories",envelope:"data",scope:"task-categories",label:"\
22
- \u30AB\u30C6\u30B4\u30EA"},milestone:{path:"task-milestones",envelope:"data",scope:"task-milestones",label:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3"},label:{path:"task-labels",envelope:"items",scope:"task-labels",label:"\u30E9\u30D9\u30EB"}};var Resolver=class{constructor(client,options){this.client=client;this.options=options;this.get=rawGetVia(client)}client;options;get;privateMastersInFlight=null;async project(ref){const trimmed=ref.trim();if(trimmed==="")throw new UsageError("\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30B3\u30FC\u30C9\u304B \
23
- ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");return resolveProjectRef(trimmed,this.get,safeProjectIdPolicy)}async taskByKey(key){const trimmed=key.trim();if(!isTaskKey(trimmed)){throw new UsageError(`\u30BF\u30B9\u30AF\u30AD\u30FC\u306E\u5F62\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${key}`,"\u30AD\u30FC\u306F\u300C\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30B3\u30FC\u30C9-\u756A\u53F7\u300D\u306E\u5F62\u3067\u3059\uFF08\u4F8B: ABC-123\uFF09\u3002")}const res=await this.get(`/\
24
- api/v2/tasks/resolve-by-key/${encodeURIComponent(trimmed)}`);if(res.status===404){throw new ResolveError(`\u30BF\u30B9\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${trimmed}\uFF08\u5B58\u5728\u3057\u306A\u3044\u304B\u3001\u95B2\u89A7\u3067\u304D\u308B\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3042\u308A\u307E\u305B\u3093\uFF09`,404)}if(!res.ok){throw new ResolveError(`\u30BF\u30B9\u30AF\u30AD\u30FC\u3092\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${trimmed}\uFF08HTTP ${res.
25
- status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const body=isRecord(res.json)?res.json:{};const projectId=str(body["project_id"]);const task=body["task"];if(projectId===null||!isRecord(task)){throw new ResolveError("\u30BF\u30B9\u30AF\u30AD\u30FC\u89E3\u6C7A\u306E\u5FDC\u7B54\u306B project_id / task \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
26
- res.status)}safeProjectIdPolicy.assertId(projectId);return{projectId,task}}async currentUser(){const res=await this.get("/api/v2/user");if(!res.ok){throw new ResolveError(`\u30ED\u30B0\u30A4\u30F3\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002twp login \u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const user=isRecord(res.json)?res.json["user"]:void 0;if(!isRecord(user)||str(user["\
27
- id"])===null){throw new ResolveError("\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306E\u5FDC\u7B54\u306B user.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return{id:user["id"],name:str(user["name"])??user["id"],email:str(user["email"])}}async status(projectId,input){return resolveNamed(this.applyAlias("status",input),await this.statuses(projectId),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"})}async taskType(projectId,input){
28
- return resolveNamed(this.applyAlias("type",input),await this.taskTypes(projectId),{flag:"--type",label:"\u7A2E\u5225"})}async assignee(projectId,input,flag="--assignee"){if(input.trim().toLowerCase()===SELF_REF)return this.self();const value=this.applyAlias("assignee",input);if(value.trim().toLowerCase()===SELF_REF)return this.self();return resolveNamed(value,await this.members(projectId),{flag,label:"\u30E1\u30F3\u30D0\u30FC"})}async self(){const me=await this.currentUser();return{id:me.id,name:me.
29
- name,...me.email!==null?{aliases:[me.email]}:{}}}async defaultStatus(projectId){return requireDefault(await this.statuses(projectId),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"})}async defaultTaskType(projectId){return requireDefault(await this.taskTypes(projectId),{flag:"--type",label:"\u7A2E\u5225"})}async statuses(projectId){return namedFromRows(await this.taskMasterRows("status",projectId),"\u30B9\u30C6\u30FC\u30BF\u30B9",codedMasterRow)}async taskTypes(projectId){return namedFromRows(
30
- await this.taskMasterRows("type",projectId),"\u7A2E\u5225",codedMasterRow)}async taskMaster(kind,projectId,input,flag){const spec=TASK_MASTERS[kind];return resolveNamed(input,await this.taskMasterRefs(kind,projectId),{flag,label:spec.label})}async taskMasterRefs(kind,projectId){const spec=TASK_MASTERS[kind];return namedFromRows(await this.taskMasterRows(kind,projectId),spec.label,codedMasterRow)}async privateTaskMaster(envelope,input,flag,label){return resolveNamed(input,await this.privateMasters(
31
- envelope,label),{flag,label,scope:PRIVATE_SCOPE_LABEL})}async taskMasterRows(kind,projectId){const spec=TASK_MASTERS[kind];return this.cached(spec.scope,projectId,async()=>rawListFrom(await this.get(`/api/v2/projects/${encodeURIComponent(projectId)}/${spec.path}`),spec.envelope,spec.label))}invalidateTaskMaster(kind,projectId){removeCache({profile:this.options.profile,scope:TASK_MASTERS[kind].scope,project:projectId},this.options.env!==void 0?{env:this.options.env}:{})}async privateStatuses(){return this.
32
- privateMasters("statuses","\u30B9\u30C6\u30FC\u30BF\u30B9")}async privateTaskTypes(){return this.privateMasters("types","\u7A2E\u5225")}async privateStatus(input){return resolveNamed(this.applyAlias("status",input),await this.privateStatuses(),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9",scope:PRIVATE_SCOPE_LABEL})}async privateTaskType(input){return resolveNamed(this.applyAlias("type",input),await this.privateTaskTypes(),{flag:"--type",label:"\u7A2E\u5225",scope:PRIVATE_SCOPE_LABEL})}async privateDefaultStatus(){
33
- return requireDefault(await this.privateStatuses(),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9",scope:PRIVATE_SCOPE_LABEL})}async privateDefaultTaskType(){return requireDefault(await this.privateTaskTypes(),{flag:"--type",label:"\u7A2E\u5225",scope:PRIVATE_SCOPE_LABEL})}async privateTask(ref){const trimmed=ref.trim();const res=await this.get(`${PRIVATE_TASKS_PATH}/${encodeURIComponent(trimmed)}`);if(res.status===404){throw new ResolveError(`\u500B\u4EBA\u30BF\u30B9\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${trimmed}`,
34
- 404)}if(!res.ok){throw new ResolveError(`\u500B\u4EBA\u30BF\u30B9\u30AF\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${trimmed}\uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const task=isRecord(res.json)?res.json["task"]:void 0;if(!isRecord(task)){throw new ResolveError("\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u5FDC\u7B54\u306B task \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
35
- res.status)}return task}async primaryAssignment(userId){if(!isSafePathSegment(userId)){throw new ResolveError(`\u30E6\u30FC\u30B6\u30FC ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${userId}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}const res=await this.get(`/api/v2/organization/users/${encodeURIComponent(userId)}/assignments/primary`);if(res.status===404)return null;if(!res.ok){throw new ResolveError(`\u73FE\u5728\u306E\u4E3B\u6240\u5C5E\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
19
+ api/v2/sales/invoices";var SALES_CONTRACTS_PATH="/api/v2/sales/contracts";var SALES_INVOICE_AUTO_TEMPLATES_PATH="/api/v2/sales/invoice-auto-templates";var SALES_DEPOSITS_PATH="/api/v2/sales/deposits";var SALES_PURCHASES_PATH="/api/v2/sales/purchases";var SALES_SUPPLIER_PAYMENTS_PATH="/api/v2/sales/supplier-payments";var SALES_SUPPLIER_PAYMENT_SCHEDULES_PATH="/api/v2/sales/supplier-payment-schedules";var SALES_BUSINESS_PLACES_PATH="/api/v2/sales/business-places";var SALES_PAYEES_PATH="/api/v2/sal\
20
+ es/payees";var SALES_SEAL_IMPRESSIONS_PATH="/api/v2/sales/seal-impressions";var SALES_PURCHASE_AI_MAPPINGS_PATH="/api/v2/sales/purchase-ai-field-mappings";var SALES_ESTIMATE_NO_RULES_PATH="/api/v2/sales/estimate-no-rules";var SALES_INVOICE_NO_RULES_PATH="/api/v2/sales/invoice-no-rules";var SALES_PURCHASE_NO_RULES_PATH="/api/v2/sales/purchase-no-rules";var SALES_ESTIMATE_FORMATS_PATH="/api/v2/sales/estimate-formats";var SALES_ROUNDING_SETTING_PATH="/api/v2/sales/rounding-setting";var SALES_RECORD_KINDS={
21
+ estimate:{path:SALES_ESTIMATES_PATH,label:"\u898B\u7A4D"},invoice:{path:SALES_INVOICES_PATH,label:"\u8ACB\u6C42"},contract:{path:SALES_CONTRACTS_PATH,label:"\u53D6\u5F15\u5951\u7D04"},"invoice-auto-template":{path:SALES_INVOICE_AUTO_TEMPLATES_PATH,label:"\u81EA\u52D5\u8ACB\u6C42\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8"},deposit:{path:SALES_DEPOSITS_PATH,label:"\u5165\u91D1"},purchase:{path:SALES_PURCHASES_PATH,label:"\u4ED5\u5165"},"supplier-payment":{path:SALES_SUPPLIER_PAYMENTS_PATH,label:"\u652F\u6255"},
22
+ "supplier-payment-schedule":{path:SALES_SUPPLIER_PAYMENT_SCHEDULES_PATH,label:"\u652F\u6255\u5148\u30DE\u30B9\u30BF"},"business-place":{path:SALES_BUSINESS_PLACES_PATH,label:"\u4E8B\u696D\u6240"},payee:{path:SALES_PAYEES_PATH,label:"\u632F\u8FBC\u5148"},"seal-impression":{path:SALES_SEAL_IMPRESSIONS_PATH,label:"\u5370\u5F71"},"purchase-ai-mapping":{path:SALES_PURCHASE_AI_MAPPINGS_PATH,label:"\u4ED5\u5165AI\u30DE\u30C3\u30D4\u30F3\u30B0"},"estimate-no-rule":{path:SALES_ESTIMATE_NO_RULES_PATH,label:"\
23
+ \u898B\u7A4D\u756A\u53F7\u30EB\u30FC\u30EB"},"invoice-no-rule":{path:SALES_INVOICE_NO_RULES_PATH,label:"\u8ACB\u6C42\u756A\u53F7\u30EB\u30FC\u30EB"},"purchase-no-rule":{path:SALES_PURCHASE_NO_RULES_PATH,label:"\u4ED5\u5165\u756A\u53F7\u30EB\u30FC\u30EB"},"estimate-format":{path:SALES_ESTIMATE_FORMATS_PATH,label:"\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8"}};var SALES_COMPANIES_PATH="/api/v2/sales/companies";var CUSTOMERS_PATH="/api/v2/customers";var COMPANY_SEARCH_PAGE_LIMIT=100;var COMPANY_SEARCH_MAX_PAGES=10;
24
+ var CUSTOMER_CHILDREN_PAGE_LIMIT=100;var PROSPECTS_PATH="/api/v2/prospects";var PROSPECT_SEARCH_PAGE_LIMIT=100;var PROSPECT_SEARCH_MAX_PAGES=10;function isExactNumericId(value){return/^[0-9]+$/.test(value)&&String(Number(value))===value}function exactCompanyId(ref,label){if(!isExactNumericId(ref.id)){throw new ResolveError(`${label}\u4E00\u89A7\u306E id \u304C\u6574\u6570\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08${ref.id}\uFF09\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
25
+ return ref}var ORG_MASTER_LIMIT=1e3;var USER_LIST_MAX_PAGES=100;function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function str(value){return typeof value==="string"&&value.trim()!==""?value:null}function truthyFlag(value){return value===true||value===1}function rawGetVia(client){return async path2=>{try{return{ok:true,status:200,json:await client.request("GET",path2),error:null}}catch(err){if(err instanceof ApiError){return{ok:false,status:err.status,json:err.
26
+ body,error:err.message}}throw err}}}var TASK_MASTERS={status:{path:"task-statuses",envelope:"data",scope:"task-statuses",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"},type:{path:"task-types",envelope:"data",scope:"task-types",label:"\u7A2E\u5225"},category:{path:"task-categories",envelope:"data",scope:"task-categories",label:"\u30AB\u30C6\u30B4\u30EA"},milestone:{path:"task-milestones",envelope:"data",scope:"task-milestones",label:"\u30DE\u30A4\u30EB\u30B9\u30C8\u30FC\u30F3"},label:{path:"task-labels",
27
+ envelope:"items",scope:"task-labels",label:"\u30E9\u30D9\u30EB"}};var Resolver=class{constructor(client,options){this.client=client;this.options=options;this.get=rawGetVia(client)}client;options;get;privateMastersInFlight=null;async project(ref){const trimmed=ref.trim();if(trimmed==="")throw new UsageError("\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30B3\u30FC\u30C9\u304B ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");return resolveProjectRef(trimmed,this.get,safeProjectIdPolicy)}async taskByKey(key){
28
+ const trimmed=key.trim();if(!isTaskKey(trimmed)){throw new UsageError(`\u30BF\u30B9\u30AF\u30AD\u30FC\u306E\u5F62\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${key}`,"\u30AD\u30FC\u306F\u300C\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30B3\u30FC\u30C9-\u756A\u53F7\u300D\u306E\u5F62\u3067\u3059\uFF08\u4F8B: ABC-123\uFF09\u3002")}const res=await this.get(`/api/v2/tasks/resolve-by-key/${encodeURIComponent(trimmed)}`);if(res.status===404){throw new ResolveError(`\u30BF\u30B9\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${trimmed}\
29
+ \uFF08\u5B58\u5728\u3057\u306A\u3044\u304B\u3001\u95B2\u89A7\u3067\u304D\u308B\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3042\u308A\u307E\u305B\u3093\uFF09`,404)}if(!res.ok){throw new ResolveError(`\u30BF\u30B9\u30AF\u30AD\u30FC\u3092\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${trimmed}\uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const body=isRecord(res.
30
+ json)?res.json:{};const projectId=str(body["project_id"]);const task=body["task"];if(projectId===null||!isRecord(task)){throw new ResolveError("\u30BF\u30B9\u30AF\u30AD\u30FC\u89E3\u6C7A\u306E\u5FDC\u7B54\u306B project_id / task \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}safeProjectIdPolicy.assertId(projectId);return{projectId,task}}async currentUser(){const res=await this.get("/api/v2/user");if(!res.ok){throw new ResolveError(
31
+ `\u30ED\u30B0\u30A4\u30F3\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002twp login \u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const user=isRecord(res.json)?res.json["user"]:void 0;if(!isRecord(user)||str(user["id"])===null){throw new ResolveError("\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306E\u5FDC\u7B54\u306B user.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
32
+ res.status)}return{id:user["id"],name:str(user["name"])??user["id"],email:str(user["email"])}}async status(projectId,input){return resolveNamed(this.applyAlias("status",input),await this.statuses(projectId),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"})}async taskType(projectId,input){return resolveNamed(this.applyAlias("type",input),await this.taskTypes(projectId),{flag:"--type",label:"\u7A2E\u5225"})}async assignee(projectId,input,flag="--assignee"){if(input.trim().toLowerCase()===SELF_REF)
33
+ return this.self();const value=this.applyAlias("assignee",input);if(value.trim().toLowerCase()===SELF_REF)return this.self();return resolveNamed(value,await this.members(projectId),{flag,label:"\u30E1\u30F3\u30D0\u30FC"})}async self(){const me=await this.currentUser();return{id:me.id,name:me.name,...me.email!==null?{aliases:[me.email]}:{}}}async defaultStatus(projectId){return requireDefault(await this.statuses(projectId),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9"})}async defaultTaskType(projectId){
34
+ return requireDefault(await this.taskTypes(projectId),{flag:"--type",label:"\u7A2E\u5225"})}async statuses(projectId){return namedFromRows(await this.taskMasterRows("status",projectId),"\u30B9\u30C6\u30FC\u30BF\u30B9",codedMasterRow)}async taskTypes(projectId){return namedFromRows(await this.taskMasterRows("type",projectId),"\u7A2E\u5225",codedMasterRow)}async taskMaster(kind,projectId,input,flag){const spec=TASK_MASTERS[kind];return resolveNamed(input,await this.taskMasterRefs(kind,projectId),{
35
+ flag,label:spec.label})}async taskMasterRefs(kind,projectId){const spec=TASK_MASTERS[kind];return namedFromRows(await this.taskMasterRows(kind,projectId),spec.label,codedMasterRow)}async privateTaskMaster(envelope,input,flag,label){return resolveNamed(input,await this.privateMasters(envelope,label),{flag,label,scope:PRIVATE_SCOPE_LABEL})}async taskMasterRows(kind,projectId){const spec=TASK_MASTERS[kind];return this.cached(spec.scope,projectId,async()=>rawListFrom(await this.get(`/api/v2/projects\
36
+ /${encodeURIComponent(projectId)}/${spec.path}`),spec.envelope,spec.label))}invalidateTaskMaster(kind,projectId){removeCache({profile:this.options.profile,scope:TASK_MASTERS[kind].scope,project:projectId},this.options.env!==void 0?{env:this.options.env}:{})}async privateStatuses(){return this.privateMasters("statuses","\u30B9\u30C6\u30FC\u30BF\u30B9")}async privateTaskTypes(){return this.privateMasters("types","\u7A2E\u5225")}async privateStatus(input){return resolveNamed(this.applyAlias("status",
37
+ input),await this.privateStatuses(),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9",scope:PRIVATE_SCOPE_LABEL})}async privateTaskType(input){return resolveNamed(this.applyAlias("type",input),await this.privateTaskTypes(),{flag:"--type",label:"\u7A2E\u5225",scope:PRIVATE_SCOPE_LABEL})}async privateDefaultStatus(){return requireDefault(await this.privateStatuses(),{flag:"--status",label:"\u30B9\u30C6\u30FC\u30BF\u30B9",scope:PRIVATE_SCOPE_LABEL})}async privateDefaultTaskType(){return requireDefault(
38
+ await this.privateTaskTypes(),{flag:"--type",label:"\u7A2E\u5225",scope:PRIVATE_SCOPE_LABEL})}async privateTask(ref){const trimmed=ref.trim();const res=await this.get(`${PRIVATE_TASKS_PATH}/${encodeURIComponent(trimmed)}`);if(res.status===404){throw new ResolveError(`\u500B\u4EBA\u30BF\u30B9\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${trimmed}`,404)}if(!res.ok){throw new ResolveError(`\u500B\u4EBA\u30BF\u30B9\u30AF\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${trimmed}\
39
+ \uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}const task=isRecord(res.json)?res.json["task"]:void 0;if(!isRecord(task)){throw new ResolveError("\u500B\u4EBA\u30BF\u30B9\u30AF\u306E\u5FDC\u7B54\u306B task \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return task}async primaryAssignment(userId){
40
+ if(!isSafePathSegment(userId)){throw new ResolveError(`\u30E6\u30FC\u30B6\u30FC ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${userId}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}const res=await this.get(`/api/v2/organization/users/${encodeURIComponent(userId)}/assignments/primary`);if(res.status===404)return null;if(!res.ok){throw new ResolveError(`\u73FE\u5728\u306E\u4E3B\u6240\u5C5E\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
36
41
  status}${res.error?`: ${res.error}`:""}\uFF09\u3002`,res.status)}const assignment=isRecord(res.json)?res.json["assignment"]:void 0;if(!isRecord(assignment)||typeof assignment["id"]!=="string"){throw new ResolveError("\u4E3B\u6240\u5C5E\u306E\u5FDC\u7B54\u306B assignment.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return assignment}async assignments(userId){if(!isSafePathSegment(userId)){throw new ResolveError(
37
42
  `\u30E6\u30FC\u30B6\u30FC ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${userId}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}const res=await this.get(`/api/v2/organization/users/${encodeURIComponent(userId)}/assignments`);if(!res.ok){throw new ResolveError(`\u6240\u5C5E\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}${res.error?`: ${res.error}`:""}\uFF09\u3002`,res.status)}const list=isRecord(
38
43
  res.json)?res.json["list"]:void 0;if(!Array.isArray(list)||!list.every(isRecord)){throw new ResolveError("\u6240\u5C5E\u4E00\u89A7\u306E\u5FDC\u7B54\u306B list \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return list}async privateMasters(envelope,label){return namedFromRows(await this.privateMasterRows(envelope,label),label,codedMasterRow)}async privateMasterRows(envelope,label){return this.cached(
@@ -59,31 +64,36 @@ y_name_kana"])].filter(v=>v!==null)}));const needle=trimmed.toLowerCase();const
59
64
  if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`${options.flag} \u306E ID ${id} \u306E${label}\u306F\u3042\u308A\u307E\u305B\u3093`);if(!res.ok)throw new ResolveError(`${label}\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const data=isRecord(res.json)?res.json["data"]:void 0;const name=isRecord(data)?str(data["company_n\
60
65
  ame"]):null;if(!isRecord(data)||data["id"]!==id||name===null){throw new ResolveError(`${label}\u306E\u5FDC\u7B54\u306B data.id / company_name \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return{id,name}}async companyRecord(id){if(!isExactNumericId(id))throw new UsageError(`\u53D6\u5F15\u5148\u306E ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${id}`);
61
66
  const path2=`${SALES_COMPANIES_PATH}/${id}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)return null;if(!res.ok)throw new ResolveError(`\u53D6\u5F15\u5148\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const data=isRecord(res.json)?res.json["data"]:void 0;if(!isRecord(res.json)||res.json["result"]!==true||!isRecord(
62
- data)||data["id"]!==id){throw new ResolveError("\u53D6\u5F15\u5148\u306E\u5FDC\u7B54\u306B data.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return data}async reportRecord(kind,id,flag){const label=kind==="format"?"\u30EC\u30DD\u30FC\u30C8\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8":"\u30EC\u30DD\u30FC\u30C8";if(!isSafePathSegment(id))throw new UsageError(`${flag} \u306E${label} ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`);
63
- const path2=`${REPORTS_PATH}${kind==="format"?"/formats":""}/${encodeURIComponent(id)}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`${flag} \u306E ID ${id} \u306E${label}\u306F\u3042\u308A\u307E\u305B\u3093`);if(!res.ok)throw new ResolveError(`${label}\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,
64
- res.status);const data=isRecord(res.json)?res.json[kind]:void 0;if(!isRecord(res.json)||res.json["result"]!==true||!isRecord(data)||data["id"]!==id){throw new ResolveError(`${label}\u306E\u5FDC\u7B54\u306B ${kind}.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return data}async customerChildren(companyId,kind){if(!isExactNumericId(companyId))throw new UsageError(`\u53D6\u5F15\u5148\u306E ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${companyId}`);
65
- const label=kind==="contacts"?"\u62C5\u5F53\u8005":"\u5BFE\u5FDC\u5C65\u6B74";const rows=[];let cursor=null;const seenCursors=new Set;for(;;){const query=`limit=${CUSTOMER_CHILDREN_PAGE_LIMIT}${cursor===null?"":`&cursor=${encodeURIComponent(cursor)}`}`;const path2=`${CUSTOMERS_PATH}/${companyId}/${kind}?${query}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}rows.push(...rawListFrom(res,"items",label));
66
- const hasMore=isRecord(res.json)?res.json["has_more"]:void 0;const next=isRecord(res.json)?res.json["next_cursor"]:void 0;if(hasMore===false)return rows;if(hasMore!==true||typeof next!=="string"||next===""){throw new ResolveError(`${label}\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u304C\u8AAD\u3081\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}if(seenCursors.has(next))throw new ResolveError(`${label}\u4E00\u89A7\u306E next_c\
67
- ursor \u304C\u9032\u307F\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status);seenCursors.add(next);cursor=next}}async featureLevel(feature){const res=await this.get("/api/v2/user");if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET","/api/v2/user")}if(!res.ok)throw new ResolveError(`\u30ED\u30B0\u30A4\u30F3\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
68
- status}\uFF09\u3002`,res.status);const user=isRecord(res.json)?res.json["user"]:void 0;if(!isRecord(user))throw new ResolveError("\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306E\u5FDC\u7B54\u306B user \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status);const permissions=user["feature_permissions"];const level=isRecord(permissions)?permissions[feature]:void 0;return{isAdmin:user["is_admin"]===true,level:typeof level==="s\
69
- tring"?level:null}}async prospect(input,flag="<\u30A2\u30D7\u30ED\u30FC\u30C1\u5148>"){const trimmed=input.trim();if(trimmed==="")throw new UsageError(`${flag} \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`);if(UUID_RE.test(trimmed))return{id:trimmed,name:trimmed};const rows=[];let cursor=null;let truncated=false;const seenCursors=new Set;for(let page=1;;page+=1){const query=`keyword=${encodeURIComponent(trimmed)}&limit=${PROSPECT_SEARCH_PAGE_LIMIT}${cursor===null?"":`\
70
- &cursor=${encodeURIComponent(cursor)}`}`;const path2=`${PROSPECTS_PATH}?${query}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}rows.push(...rawListFrom(res,"items","\u30A2\u30D7\u30ED\u30FC\u30C1\u5148"));const hasMore=isRecord(res.json)?res.json["has_more"]:void 0;const next=isRecord(res.json)?res.json["next_cursor"]:void 0;if(hasMore===false)break;if(hasMore!==true||typeof next!=="string"||next===
71
- ""||seenCursors.has(next)){throw new ResolveError("\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u304C\u8AAD\u3081\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}if(page>=PROSPECT_SEARCH_MAX_PAGES){truncated=true;break}seenCursors.add(next);cursor=next}const needle=trimmed.toLowerCase();const hits=rows.filter(row=>str(row["company_name"])?.trim().toLowerCase()===needle);if(hits.
72
- some(row=>str(row["id"])===null))throw new ResolveError("\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u4E00\u89A7\u306E\u884C\u306B id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");const ids=[...new Set(hits.map(row=>str(row["id"])))];if(truncated){throw new UsageError(`${flag} \u306E\u300C${trimmed}\u300D\u306B\u5F53\u305F\u308B\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u304C\u591A\u3059\u304E\u308B\u305F\u3081\uFF08${PROSPECT_SEARCH_MAX_PAGES*
73
- PROSPECT_SEARCH_PAGE_LIMIT} \u4EF6\u3092\u8D85\u3048\u3066\uFF09\u4E00\u610F\u306B\u6C7A\u3081\u3089\u308C\u307E\u305B\u3093`,"ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}if(ids.length===1&&ids[0]!==null&&ids[0]!==void 0){if(!isSafePathSegment(ids[0]))throw new ResolveError(`\u30B5\u30FC\u30D0\u304C\u8FD4\u3057\u305F\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E id \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${ids[0]}\
74
- \u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return{id:ids[0],name:trimmed}}if(ids.length>1){const shown=hits.slice(0,10).map(row=>`${String(row["id"])}\uFF08${[str(row["contact_department"]),str(row["contact_name"])].filter(v=>v!==null).join(" ")||"\u9023\u7D61\u5148\u306A\u3057"}\uFF09`).join(" / ");throw new UsageError(`${flag} \u306E\u300C${trimmed}\u300D\u304C\u30A2\u30D7\u30ED\u30FC\u30C1\u5148${ids.length}\u4EF6\u306B\u4E00\u81F4\u3057\u307E\u3059: ${shown}${hits.
75
- length>10?` \u2026\uFF08\u5168 ${hits.length} \u4EF6\uFF09`:""}`,"\u540C\u3058\u4F01\u696D\u540D\u306E\u884C\u304C\u8907\u6570\u3042\u308A\u307E\u3059\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}throw new UsageError(`${flag} \u306E\u300C${trimmed}\u300D\u3068\u4F01\u696D\u540D\u304C\u5B8C\u5168\u306B\u4E00\u81F4\u3059\u308B\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u304C\u3042\u308A\u307E\u305B\u3093`,"\u4F5C\u6210\u3057\u305F\u76F4\u5F8C\u306F\u691C\
76
- \u7D22\u306B\u51FA\u306A\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}async prospectPromotionPreview(id){if(!isSafePathSegment(id))throw new UsageError(`\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: ${id}`);const path2=`${PROSPECTS_PATH}/${encodeURIComponent(
77
- id)}/promotion-preview`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`ID ${id} \u306E\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306F\u3042\u308A\u307E\u305B\u3093`,"twp prospect list \u3067 ID \u3092\u78BA\u304B\u3081\u3066\u304F\u3060\u3055\u3044\u3002");if(!res.ok)throw new ResolveError(`\u6607\u683C\u306E\u4E0B\u898B\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
78
- status}\uFF09\u3002`,res.status);const body=res.json;if(!isRecord(body)||body["result"]!==true||typeof body["already_promoted"]!=="boolean"||!Array.isArray(body["customer_matches"])){throw new ResolveError("\u6607\u683C\u306E\u4E0B\u898B\u306E\u5FDC\u7B54\u306B already_promoted / customer_matches \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return body}async inquiryCategory(input,flag="<\u30AB\u30C6\u30B4\u30EA>"){
79
- const rows=await this.inquiryCategoryRows();return resolveNamed(input,namedFromRows(rows,"\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA",inquiryCategoryRow),{flag,label:"\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA",scope:TENANT_SCOPE_LABEL})}async inquiryCategoryRows(options={}){const load=async()=>rawListFrom(await this.get(INQUIRY_CATEGORIES_PATH),"list","\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA");if(options.fresh!==true)return this.cached("inquiry-categories",
80
- TENANT_CACHE_KEY,load);const rows=await load();writeCache({profile:this.options.profile,scope:"inquiry-categories",project:TENANT_CACHE_KEY},rows,{...this.options.env!==void 0?{env:this.options.env}:{},...this.options.ttlMs!==void 0?{ttlMs:this.options.ttlMs}:{},...this.options.now!==void 0?{now:this.options.now}:{}});return rows}invalidateInquiryCategories(){removeCache({profile:this.options.profile,scope:"inquiry-categories",project:TENANT_CACHE_KEY},this.options.env!==void 0?{env:this.options.
81
- env}:{})}async notificationCategory(input,flag="--category"){const rows=await this.cached("notification-categories",TENANT_CACHE_KEY,async()=>rawListFrom(await this.get(`${NOTIFICATIONS_PATH}/categories`),"categories","\u901A\u77E5\u30AB\u30C6\u30B4\u30EA"));return resolveNamed(input,namedFromRows(rows,"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA",notificationCategoryRow),{flag,label:"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA",scope:TENANT_SCOPE_LABEL})}async notificationUnreadCount(category){if(category===
82
- null){const res=await this.get(`${NOTIFICATIONS_PATH}/counts`);const count=res.ok&&isRecord(res.json)?res.json["unread_count"]:void 0;if(typeof count!=="number"||!Number.isSafeInteger(count)||count<0){throw new ResolveError(res.ok?"\u901A\u77E5\u4EF6\u6570\u306E\u5FDC\u7B54\u306B unread_count \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002":`\u901A\u77E5\u306E\u672A\u8AAD\u4EF6\u6570\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.
83
- status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return{count,complete:true}}let total=0;let cursor=null;for(let page=0;page<NOTIFICATION_COUNT_MAX_PAGES;page++){const query=new URLSearchParams({read_status:"unread",category,limit:String(NOTIFICATION_COUNT_PAGE_LIMIT)});if(cursor!==null)query.set("cursor",cursor);const res=await this.get(`${NOTIFICATIONS_PATH}?${query.toString()}`);total+=rawListFrom(
84
- res,"list","\u901A\u77E5").length;const body=res.json;if(body["has_more"]===false)return{count:total,complete:true};if(body["has_more"]!==true||typeof body["next_cursor"]!=="string"||body["next_cursor"]===""){throw new ResolveError("\u901A\u77E5\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\u3002\u672A\u8AAD\u4EF6\u6570\u3092\u6570\u3048\u3089\u308C\u306A\u3044\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002",res.status)}cursor=
85
- body["next_cursor"]}return{count:total,complete:false}}async namedList(path2,envelope,label,map){return namedListFrom(await this.get(path2),envelope,label,map)}async cached(scope,projectId,load){const key={profile:this.options.profile,scope,project:projectId};const options={...this.options.env!==void 0?{env:this.options.env}:{},refresh:this.options.refresh,...this.options.ttlMs!==void 0?{ttlMs:this.options.ttlMs}:{},...this.options.now!==void 0?{now:this.options.now}:{}};const hit=readCache(key,
86
- options);if(hit!==null&&Array.isArray(hit))return hit;const fresh=await load();writeCache(key,fresh,options);return fresh}applyAlias(kind,input){const table=this.options.aliases?.[kind];if(table===void 0)return input;const needle=input.trim().toLowerCase();for(const[from,to]of Object.entries(table)){if(from.trim().toLowerCase()===needle&&typeof to==="string"&&to.trim()!=="")return to}return input}async backlogSpaces(){return this.cached("backlog-spaces",BACKLOG_SPACES_CACHE_KEY,()=>this.namedList(
67
+ data)||data["id"]!==id){throw new ResolveError("\u53D6\u5F15\u5148\u306E\u5FDC\u7B54\u306B data.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return data}async salesRecord(kind,id,flag){const{label,path:base}=SALES_RECORD_KINDS[kind];if(!isExactNumericId(id))throw new UsageError(`${flag} \u306E${label} ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${id}`);
68
+ const path2=`${base}/${id}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`${flag} \u306E ID ${id} \u306E${label}\u306F\u3042\u308A\u307E\u305B\u3093`);if(!res.ok)throw new ResolveError(`${label}\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const data=isRecord(res.json)?res.json["data"]:
69
+ void 0;if(!isRecord(res.json)||res.json["result"]!==true||!isRecord(data)||data["id"]!==id){throw new ResolveError(`${label}\u306E\u5FDC\u7B54\u306B data.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return data}async salesJson(path2,label){const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(!res.ok)throw new ResolveError(
70
+ `${label}\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);if(!isRecord(res.json)||res.json["result"]!==true)throw new ResolveError(`${label}\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`,res.status);return res.json}async invoiceByNumber(invoiceNo){const path2=`${SALES_INVOICES_PATH}?keyword=${encodeURIComponent(invoiceNo)}\
71
+ &page_limit=100&page_no=1`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}const rows=rawListFrom(res,"list","\u8ACB\u6C42");const all=rows.flatMap(row=>[row,...Array.isArray(row["children"])?row["children"].filter(isRecord):[]]);const hits=all.filter(row=>row["invoice_no"]===invoiceNo);return hits.length===1?hits[0]:null}async estimateAllocations(estimateId){if(!isExactNumericId(estimateId))throw new UsageError(
72
+ `\u898B\u7A4D\u306E ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${estimateId}`);const path2=`${SALES_ESTIMATES_PATH}/${estimateId}/allocations`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}return rawListFrom(res,"data","\u90E8\u7F72\u6309\u5206")}async reportRecord(kind,id,flag){const label=kind==="format"?"\u30EC\u30DD\u30FC\u30C8\u30D5\
73
+ \u30A9\u30FC\u30DE\u30C3\u30C8":"\u30EC\u30DD\u30FC\u30C8";if(!isSafePathSegment(id))throw new UsageError(`${flag} \u306E${label} ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`);const path2=`${REPORTS_PATH}${kind==="format"?"/formats":""}/${encodeURIComponent(id)}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`${flag} \u306E ID ${id}\
74
+ \u306E${label}\u306F\u3042\u308A\u307E\u305B\u3093`);if(!res.ok)throw new ResolveError(`${label}\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const data=isRecord(res.json)?res.json[kind]:void 0;if(!isRecord(res.json)||res.json["result"]!==true||!isRecord(data)||data["id"]!==id){throw new ResolveError(`${label}\u306E\u5FDC\u7B54\u306B ${kind}.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
75
+ res.status)}return data}async customerChildren(companyId,kind){if(!isExactNumericId(companyId))throw new UsageError(`\u53D6\u5F15\u5148\u306E ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${companyId}`);const label=kind==="contacts"?"\u62C5\u5F53\u8005":"\u5BFE\u5FDC\u5C65\u6B74";const rows=[];let cursor=null;const seenCursors=new Set;for(;;){const query=`limit=${CUSTOMER_CHILDREN_PAGE_LIMIT}${cursor===null?"":`&cu\
76
+ rsor=${encodeURIComponent(cursor)}`}`;const path2=`${CUSTOMERS_PATH}/${companyId}/${kind}?${query}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}rows.push(...rawListFrom(res,"items",label));const hasMore=isRecord(res.json)?res.json["has_more"]:void 0;const next=isRecord(res.json)?res.json["next_cursor"]:void 0;if(hasMore===false)return rows;if(hasMore!==true||typeof next!=="string"||next===""){throw new ResolveError(
77
+ `${label}\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u304C\u8AAD\u3081\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}if(seenCursors.has(next))throw new ResolveError(`${label}\u4E00\u89A7\u306E next_cursor \u304C\u9032\u307F\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status);seenCursors.add(next);cursor=next}}async featureLevel(feature){const res=await this.
78
+ get("/api/v2/user");if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET","/api/v2/user")}if(!res.ok)throw new ResolveError(`\u30ED\u30B0\u30A4\u30F3\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const user=isRecord(res.json)?res.json["user"]:void 0;if(!isRecord(user))throw new ResolveError("\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306E\u5FDC\u7B54\u306B user \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
79
+ res.status);const permissions=user["feature_permissions"];const level=isRecord(permissions)?permissions[feature]:void 0;return{isAdmin:user["is_admin"]===true,level:typeof level==="string"?level:null}}async prospect(input,flag="<\u30A2\u30D7\u30ED\u30FC\u30C1\u5148>"){const trimmed=input.trim();if(trimmed==="")throw new UsageError(`${flag} \u306B\u7A7A\u306E\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`);if(UUID_RE.test(trimmed))return{id:trimmed,name:trimmed};const rows=[];let cursor=null;
80
+ let truncated=false;const seenCursors=new Set;for(let page=1;;page+=1){const query=`keyword=${encodeURIComponent(trimmed)}&limit=${PROSPECT_SEARCH_PAGE_LIMIT}${cursor===null?"":`&cursor=${encodeURIComponent(cursor)}`}`;const path2=`${PROSPECTS_PATH}?${query}`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}rows.push(...rawListFrom(res,"items","\u30A2\u30D7\u30ED\u30FC\u30C1\u5148"));const hasMore=isRecord(
81
+ res.json)?res.json["has_more"]:void 0;const next=isRecord(res.json)?res.json["next_cursor"]:void 0;if(hasMore===false)break;if(hasMore!==true||typeof next!=="string"||next===""||seenCursors.has(next)){throw new ResolveError("\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u304C\u8AAD\u3081\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}if(page>=PROSPECT_SEARCH_MAX_PAGES){truncated=
82
+ true;break}seenCursors.add(next);cursor=next}const needle=trimmed.toLowerCase();const hits=rows.filter(row=>str(row["company_name"])?.trim().toLowerCase()===needle);if(hits.some(row=>str(row["id"])===null))throw new ResolveError("\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u4E00\u89A7\u306E\u884C\u306B id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");const ids=[...new Set(hits.map(row=>str(row["id"])))];if(truncated){throw new UsageError(
83
+ `${flag} \u306E\u300C${trimmed}\u300D\u306B\u5F53\u305F\u308B\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u304C\u591A\u3059\u304E\u308B\u305F\u3081\uFF08${PROSPECT_SEARCH_MAX_PAGES*PROSPECT_SEARCH_PAGE_LIMIT} \u4EF6\u3092\u8D85\u3048\u3066\uFF09\u4E00\u610F\u306B\u6C7A\u3081\u3089\u308C\u307E\u305B\u3093`,"ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}if(ids.length===1&&ids[0]!==null&&ids[0]!==void 0){if(!isSafePathSegment(
84
+ ids[0]))throw new ResolveError(`\u30B5\u30FC\u30D0\u304C\u8FD4\u3057\u305F\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E id \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${ids[0]}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return{id:ids[0],name:trimmed}}if(ids.length>1){const shown=hits.slice(0,10).map(row=>`${String(row["id"])}\uFF08${[str(row["contact_department"]),str(row["contact_name"])].filter(v=>v!==null).join(" ")||"\u9023\u7D61\u5148\u306A\u3057"}\
85
+ \uFF09`).join(" / ");throw new UsageError(`${flag} \u306E\u300C${trimmed}\u300D\u304C\u30A2\u30D7\u30ED\u30FC\u30C1\u5148${ids.length}\u4EF6\u306B\u4E00\u81F4\u3057\u307E\u3059: ${shown}${hits.length>10?` \u2026\uFF08\u5168 ${hits.length} \u4EF6\uFF09`:""}`,"\u540C\u3058\u4F01\u696D\u540D\u306E\u884C\u304C\u8907\u6570\u3042\u308A\u307E\u3059\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}throw new UsageError(
86
+ `${flag} \u306E\u300C${trimmed}\u300D\u3068\u4F01\u696D\u540D\u304C\u5B8C\u5168\u306B\u4E00\u81F4\u3059\u308B\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u304C\u3042\u308A\u307E\u305B\u3093`,"\u4F5C\u6210\u3057\u305F\u76F4\u5F8C\u306F\u691C\u7D22\u306B\u51FA\u306A\u3044\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp prospect list --keyword <\u8A9E> \u306E id \u5217\uFF09\u3002")}async prospectPromotionPreview(id){if(!isSafePathSegment(id))
87
+ throw new UsageError(`\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: ${id}`);const path2=`${PROSPECTS_PATH}/${encodeURIComponent(id)}/promotion-preview`;const res=await this.get(path2);if(res.status===401||res.status===403){throw new ApiError(res.status,isRecord(res.json)?res.json:null,"GET",path2)}if(res.status===404)throw new UsageError(`ID ${id} \u306E\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306F\u3042\u308A\u307E\u305B\u3093`,
88
+ "twp prospect list \u3067 ID \u3092\u78BA\u304B\u3081\u3066\u304F\u3060\u3055\u3044\u3002");if(!res.ok)throw new ResolveError(`\u6607\u683C\u306E\u4E0B\u898B\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002`,res.status);const body=res.json;if(!isRecord(body)||body["result"]!==true||typeof body["already_promoted"]!=="boolean"||!Array.isArray(body["customer_matches"])){throw new ResolveError("\u6607\u683C\u306E\u4E0B\u898B\u306E\u5FDC\u7B54\u306B already_promoted / customer_matches \u304C\u3042\u308A\u307E\u305B\u3093\u3002\
89
+ \u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",res.status)}return body}async inquiryCategory(input,flag="<\u30AB\u30C6\u30B4\u30EA>"){const rows=await this.inquiryCategoryRows();return resolveNamed(input,namedFromRows(rows,"\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA",inquiryCategoryRow),{flag,label:"\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA",scope:TENANT_SCOPE_LABEL})}async inquiryCategoryRows(options={}){const load=async()=>rawListFrom(await this.
90
+ get(INQUIRY_CATEGORIES_PATH),"list","\u554F\u3044\u5408\u308F\u305B\u30AB\u30C6\u30B4\u30EA");if(options.fresh!==true)return this.cached("inquiry-categories",TENANT_CACHE_KEY,load);const rows=await load();writeCache({profile:this.options.profile,scope:"inquiry-categories",project:TENANT_CACHE_KEY},rows,{...this.options.env!==void 0?{env:this.options.env}:{},...this.options.ttlMs!==void 0?{ttlMs:this.options.ttlMs}:{},...this.options.now!==void 0?{now:this.options.now}:{}});return rows}invalidateInquiryCategories(){
91
+ removeCache({profile:this.options.profile,scope:"inquiry-categories",project:TENANT_CACHE_KEY},this.options.env!==void 0?{env:this.options.env}:{})}async notificationCategory(input,flag="--category"){const rows=await this.cached("notification-categories",TENANT_CACHE_KEY,async()=>rawListFrom(await this.get(`${NOTIFICATIONS_PATH}/categories`),"categories","\u901A\u77E5\u30AB\u30C6\u30B4\u30EA"));return resolveNamed(input,namedFromRows(rows,"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA",notificationCategoryRow),
92
+ {flag,label:"\u901A\u77E5\u30AB\u30C6\u30B4\u30EA",scope:TENANT_SCOPE_LABEL})}async notificationUnreadCount(category){if(category===null){const res=await this.get(`${NOTIFICATIONS_PATH}/counts`);const count=res.ok&&isRecord(res.json)?res.json["unread_count"]:void 0;if(typeof count!=="number"||!Number.isSafeInteger(count)||count<0){throw new ResolveError(res.ok?"\u901A\u77E5\u4EF6\u6570\u306E\u5FDC\u7B54\u306B unread_count \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002":
93
+ `\u901A\u77E5\u306E\u672A\u8AAD\u4EF6\u6570\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08HTTP ${res.status}\uFF09\u3002\u63A5\u7D9A\u5148\u3068\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,res.status)}return{count,complete:true}}let total=0;let cursor=null;for(let page=0;page<NOTIFICATION_COUNT_MAX_PAGES;page++){const query=new URLSearchParams({read_status:"unread",category,limit:String(NOTIFICATION_COUNT_PAGE_LIMIT)});
94
+ if(cursor!==null)query.set("cursor",cursor);const res=await this.get(`${NOTIFICATIONS_PATH}?${query.toString()}`);total+=rawListFrom(res,"list","\u901A\u77E5").length;const body=res.json;if(body["has_more"]===false)return{count:total,complete:true};if(body["has_more"]!==true||typeof body["next_cursor"]!=="string"||body["next_cursor"]===""){throw new ResolveError("\u901A\u77E5\u4E00\u89A7\u306E\u5FDC\u7B54\u306E has_more / next_cursor \u3092\u89E3\u91C8\u3067\u304D\u307E\u305B\u3093\u3002\u672A\u8AAD\u4EF6\u6570\u3092\u6570\u3048\u3089\u308C\u306A\u3044\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002",
95
+ res.status)}cursor=body["next_cursor"]}return{count:total,complete:false}}async namedList(path2,envelope,label,map){return namedListFrom(await this.get(path2),envelope,label,map)}async cached(scope,projectId,load){const key={profile:this.options.profile,scope,project:projectId};const options={...this.options.env!==void 0?{env:this.options.env}:{},refresh:this.options.refresh,...this.options.ttlMs!==void 0?{ttlMs:this.options.ttlMs}:{},...this.options.now!==void 0?{now:this.options.now}:{}};const hit=readCache(
96
+ key,options);if(hit!==null&&Array.isArray(hit))return hit;const fresh=await load();writeCache(key,fresh,options);return fresh}applyAlias(kind,input){const table=this.options.aliases?.[kind];if(table===void 0)return input;const needle=input.trim().toLowerCase();for(const[from,to]of Object.entries(table)){if(from.trim().toLowerCase()===needle&&typeof to==="string"&&to.trim()!=="")return to}return input}async backlogSpaces(){return this.cached("backlog-spaces",BACKLOG_SPACES_CACHE_KEY,()=>this.namedList(
87
97
  `${BACKLOG_BASE_PATH}/spaces`,"spaces","Backlog \u30B9\u30DA\u30FC\u30B9",backlogSpaceRow))}async backlogSpace(ref){return resolveNamed(ref,await this.backlogSpaces(),{flag:"--space",label:"Backlog \u30B9\u30DA\u30FC\u30B9",scope:BACKLOG_SCOPE_LABEL})}async backlogDefaultSpace(){const spaces=await this.backlogSpaces();if(spaces.length===1)return spaces[0];if(spaces.length===0){throw new UsageError("Backlog \u30B9\u30DA\u30FC\u30B9\u304C1\u4EF6\u3082\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",
88
98
  "TWP \u306E\u5916\u90E8\u9023\u643A\u8A2D\u5B9A\u3067 Backlog \u30B9\u30DA\u30FC\u30B9\u3092\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\uFF08twp backlog space list \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\uFF09\u3002")}throw new UsageError(`Backlog \u30B9\u30DA\u30FC\u30B9\u304C ${spaces.length} \u4EF6\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001--space \u30671\u3064\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,`twp backlog space list \u3067 ID \u3068\u30B9\u30DA\u30FC\u30B9URL\u3092\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002`)}async backlogProjects(spaceId){
89
99
  return this.cached("backlog-projects",spaceId,()=>this.namedList(backlogSpacePath(spaceId,"/projects"),"projects","Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8",backlogProjectRow))}async backlogStatuses(spaceId,projectId){return this.cached("backlog-statuses",`${spaceId}/${projectId}`,()=>this.namedList(backlogSpacePath(spaceId,`/projects/${encodeURIComponent(assertBacklogPathSegment(projectId,"Backlog \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8 ID"))}/statuses`),"statuses","Backlog \u30B9\u30C6\u30FC\u30BF\u30B9",
@@ -93,4 +103,5 @@ row)){throw new ResolveError(`${label}\u4E00\u89A7\u306E ${index+1} \u4EF6\u76EE
93
103
  return{id:str(row["key"]),name:str(row["name"]),code:str(row["key"])}}function inquiryCategoryRow(row){return{id:str(row["id"]),name:str(row["title"]),code:str(row["category_code"])}}function masterList(res,label){const rows=rawListFrom(res,"list",label);const count=isRecord(res.json)?res.json["count"]:void 0;if(typeof count==="number"&&count>rows.length){throw new ResolveError(`${label}\u4E00\u89A7\u304C ${count} \u4EF6\u4E2D ${rows.length} \u4EF6\u3067\u5207\u308A\u8A70\u3081\u3089\u308C\u305F\u305F\u3081\u3001\u540D\u524D\u3067\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3002ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
94
104
  res.status)}return rows}function codedMasterRow(row){return{id:str(row["id"]),name:str(row["name"]),code:str(row["code"]),isDefault:truthyFlag(row["is_default"])}}function namedListFrom(res,envelope,label,map){return namedFromRows(rawListFrom(res,envelope,label),label,map,res.status??void 0)}function namedFromRows(rows,label,map,status=200){return rows.map((row,index)=>{const mapped=map(row);if(mapped.id===null||mapped.name===null){throw new ResolveError(`${label}\u4E00\u89A7\u306E ${index+1} \u4EF6\u76EE\
95
105
  \u306B id / \u540D\u524D\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,status)}return{id:mapped.id,name:mapped.name,...mapped.code!==void 0?{code:mapped.code}:{},...mapped.aliases!==void 0&&mapped.aliases.length>0?{aliases:mapped.aliases}:{},...mapped.isDefault!==void 0?{isDefault:mapped.isDefault}:{}}})}function requireDefault(candidates,ctx){const hit=candidates.find(ref=>ref.isDefault===true);if(hit!==void 0)return hit;
96
- throw new UsageError(`${ctx.flag} \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${ctx.scope??DEFAULT_LOOKUP_SCOPE}\u306B\u306F\u65E2\u5B9A\u306E${ctx.label}\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF09`,`\u6307\u5B9A\u3067\u304D\u308B${ctx.label}: ${candidates.map(ref=>ref.name).join(" / ")}\uFF08\u53E4\u3044\u30AD\u30E3\u30C3\u30B7\u30E5\u304C\u6B8B\u3063\u3066\u3044\u308B\u5834\u5408\u306F --refresh \u3067\u53D6\u308A\u76F4\u305B\u307E\u3059\uFF09`)}export{BACKLOG_BASE_PATH,backlogSpacePath,resolveNamed,requireDefaultProject,PRIVATE_TASKS_PATH,BACKLOG_SCOPE_LABEL,BACKLOG_PROJECT_SCOPE_LABEL,DEPARTMENTS_PATH,POSITIONS_PATH,JOB_TITLES_PATH,INQUIRY_CATEGORIES_PATH,NOTIFICATIONS_PATH,WORKFLOWS_PATH,REPORTS_PATH,SALES_ESTIMATES_PATH,SALES_INVOICES_PATH,SALES_COMPANIES_PATH,CUSTOMERS_PATH,PROSPECTS_PATH,isExactNumericId,ORG_MASTER_LIMIT,TASK_MASTERS,Resolver};
106
+ throw new UsageError(`${ctx.flag} \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${ctx.scope??DEFAULT_LOOKUP_SCOPE}\u306B\u306F\u65E2\u5B9A\u306E${ctx.label}\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF09`,`\u6307\u5B9A\u3067\u304D\u308B${ctx.label}: ${candidates.map(ref=>ref.name).join(" / ")}\uFF08\u53E4\u3044\u30AD\u30E3\u30C3\u30B7\u30E5\u304C\u6B8B\u3063\u3066\u3044\u308B\u5834\u5408\u306F --refresh \u3067\u53D6\u308A\u76F4\u305B\u307E\u3059\uFF09`)}export{BACKLOG_BASE_PATH,backlogSpacePath,resolveNamed,requireDefaultProject,PRIVATE_TASKS_PATH,BACKLOG_SCOPE_LABEL,BACKLOG_PROJECT_SCOPE_LABEL,DEPARTMENTS_PATH,POSITIONS_PATH,JOB_TITLES_PATH,INQUIRY_CATEGORIES_PATH,NOTIFICATIONS_PATH,WORKFLOWS_PATH,REPORTS_PATH,SALES_ESTIMATES_PATH,SALES_INVOICES_PATH,SALES_CONTRACTS_PATH,SALES_INVOICE_AUTO_TEMPLATES_PATH,SALES_DEPOSITS_PATH,SALES_PURCHASES_PATH,SALES_SUPPLIER_PAYMENTS_PATH,SALES_SUPPLIER_PAYMENT_SCHEDULES_PATH,SALES_BUSINESS_PLACES_PATH,SALES_PAYEES_PATH,
107
+ SALES_SEAL_IMPRESSIONS_PATH,SALES_PURCHASE_AI_MAPPINGS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,SALES_PURCHASE_NO_RULES_PATH,SALES_ESTIMATE_FORMATS_PATH,SALES_ROUNDING_SETTING_PATH,SALES_COMPANIES_PATH,CUSTOMERS_PATH,PROSPECTS_PATH,isExactNumericId,ORG_MASTER_LIMIT,TASK_MASTERS,Resolver};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ var DOMAIN_NAMES=["agent-loop","attendance","backlog","business-place","company","contract","customer","department","deposit","estimate","inquiry","invoice","job-title","leave","media","meeting","note","notification","payee","position","project","prospect","purchase","receivable","report","rounding-setting","seal-impression","shift","storage","supplier-payment","task","user","wiki","workchange","workflow"];function isDomainName(value){return value!==void 0&&DOMAIN_NAMES.includes(value)}var HELP_TOKEN="\
4
+ help";var API_TOKEN="api";export{DOMAIN_NAMES,isDomainName,HELP_TOKEN,API_TOKEN};
@@ -0,0 +1,70 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{salesAdminForbidden}from"./chunk-7ACENLLZ.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-BZ7ULFR3.js";import{repeatedValues}from"./chunk-IOGVQVGD.js";import{booleanText,boundedText}from"./chunk-UDPJ2IGK.js";import{SALES_ESTIMATE_FORMATS_PATH,SALES_ESTIMATE_NO_RULES_PATH,SALES_INVOICE_NO_RULES_PATH,SALES_PURCHASE_NO_RULES_PATH,SALES_ROUNDING_SETTING_PATH,isExactNumericId}from"./chunk-BZAXQOLB.js";import{LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,
4
+ nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes}from"./chunk-5R4SEO3I.js";import{requireResolved,withResolved}from"./chunk-ZN5EFDH7.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";var INT_MAX=2147483647;var MEMBER_FORBIDDEN=licenseForbidden(featureLicenseGuidance("\u8CA9\u58F2\u7BA1\u7406"));function envelope(body,what){if(!isRecord(body)||body["result"]!==true)throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306E\u5F62\u304C\u60F3\u5B9A\u3068\u9055\u3044\u307E\u3059\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return body}function recordOf(body,what){const data=envelope(body,what)["data"];if(!isRecord(data)||typeof data["id"]!==
5
+ "string")throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306B data.id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return data}function serverMessage(body){const message=isRecord(body)?body["message"]:void 0;return typeof message==="string"&&message!==""?[message]:[]}function text(value){return typeof value==="string"||typeof value==="number"?String(value):""}function integerValue(flag,raw,min,max=INT_MAX){const trimmed=raw.
6
+ trim();const value=/^\d+$/.test(trimmed)?Number(trimmed):Number.NaN;if(!Number.isSafeInteger(value)||value<min||value>max)throw new UsageError(`${flag} \u306F ${min} \u4EE5\u4E0A ${max} \u4EE5\u4E0B\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`);return value}var RULE_COLUMNS=["id","rule_name","prefix","digit_count","current_number","count_up_num","next_number","sort_order"];function nextNumber(rule,purchaseFormat){const current=rule["current_number"];const step=rule["\
7
+ count_up_num"]??1;const digits=rule["digit_count"];if(typeof current!=="number"||typeof step!=="number"||typeof digits!=="number")return void 0;const width=purchaseFormat&&digits===0?4:digits;const padded=String(current+step).padStart(width,"0");const prefix=rule["prefix"];if(purchaseFormat)return`${prefix===null||prefix===void 0?"2000":text(prefix)}${padded}`;return typeof prefix==="string"&&prefix!==""&&prefix!=="0"?`${prefix}${padded}`:padded}function withNext(spec,row){const next=nextNumber(
8
+ row,spec.purchaseFormat);return next===void 0?row:{...row,next_number:next}}function ruleUsage(spec,op){return`twp ${spec.parent} no-rule ${op} help`}function ruleIdArg(spec,input,op){const[raw,...rest]=input.args;const id=raw?.trim()??"";if(id==="")throw new UsageError(`${spec.label}\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,ruleUsage(spec,op));if(rest.length>0)throw new UsageError(`\u4F59\u5206\u306A\u5F15\u6570\u304C\u3042\u308A\u307E\u3059: ${rest.join(" ")}`,ruleUsage(
9
+ spec,op));if(!isExactNumericId(id))throw new UsageError(`${spec.label}\u306E ID \u306F\u5148\u982D\u306B 0 \u3092\u4ED8\u3051\u306A\u3044\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${id}`,`ID \u306F twp ${spec.parent} no-rule list \u306E id \u5217\u3067\u3059\u3002`);return id}function ruleFlags(spec){return[{name:"--name",summary:"\u30EB\u30FC\u30EB\u540D\uFF08100 \u6587\u5B57\u307E\u3067\u30FB\u4F5C\u6210\u3067\u306F\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30EB\u30FC\u30EB\u540D\
10
+ >"},{name:"--prefix",summary:`\u756A\u53F7\u306E\u524D\u306B\u4ED8\u3051\u308B\u6587\u5B57\uFF0820 \u6587\u5B57\u307E\u3067${spec.prefixDefault===null?"":`\u30FB\u4F5C\u6210\u3067\u7701\u304F\u3068 ${spec.prefixDefault}`}\uFF09`,takesValue:true,placeholder:"<\u6587\u5B57>"},{name:"--digit-count",summary:"\u9023\u756A\u306E\u6841\u6570\uFF081\u301C10\u30FB\u30BC\u30ED\u57CB\u3081\u3002\u4F5C\u6210\u3067\u306F\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u6841\u6570>"},{name:"--current-number",
11
+ summary:"\u4ECA\u306E\u9023\u756A\uFF080 \u4EE5\u4E0A\u3002\u6B21\u306E\u756A\u53F7\u306F\u3053\u308C\uFF0B\u5897\u5206\u3002\u4F5C\u6210\u3067\u7701\u304F\u3068 0\uFF09",takesValue:true,placeholder:"<\u6574\u6570>"},{name:"--count-up-num",summary:"1\u56DE\u306E\u63A1\u756A\u3067\u9032\u3081\u308B\u6570\uFF081 \u4EE5\u4E0A\u3002\u4F5C\u6210\u3067\u7701\u304F\u3068 1\uFF09",takesValue:true,placeholder:"<\u6574\u6570>"},{name:"--sort",summary:"\u8868\u793A\u9806\uFF080 \u4EE5\u4E0A\u306E\u6574\u6570\u30FB\u5C0F\u3055\u3044\u307B\u3069\u4E0A\uFF09",
12
+ takesValue:true,placeholder:"<\u6574\u6570>"},...spec.hasActive?[{name:"--active",summary:"\u6709\u52B9\u304B\uFF08true / false\uFF09",takesValue:true,placeholder:"<true|false>"}]:[]]}function ruleClearFlag(spec){const effect=spec.purchaseFormat?"\u4ED5\u5165\u306F\u7A7A\u306B\u3059\u308B\u3068\u65E2\u5B9A\u306E 2000 \u304C\u4ED8\u304D\u307E\u3059":"\u756A\u53F7\u306E\u524D\u306B\u4F55\u3082\u4ED8\u3051\u306A\u3044";return{name:"--clear",summary:`\u9805\u76EE\u3092\u7A7A\u306B\u3059\u308B\uFF08prefix \u3060\u3051\u30FB${effect}\
13
+ \uFF09`,takesValue:true,placeholder:"<\u9805\u76EE>",repeatable:true}}function ruleBody(spec,input,op){const body={};const name=boundedText(input,"--name",{maxChars:100,label:"\u30EB\u30FC\u30EB\u540D"});if(name!==void 0)body["rule_name"]=name;const rawPrefix=input.flags.get("--prefix");if(rawPrefix!==void 0){const prefix=rawPrefix.trim();if([...prefix].length>20)throw new UsageError(`--prefix \u304C\u9577\u3059\u304E\u307E\u3059\uFF08${[...prefix].length} \u6587\u5B57\u30FB\u4E0A\u9650 20 \u6587\u5B57\uFF09`);
14
+ body["prefix"]=prefix===""?null:prefix}const digits=input.flags.get("--digit-count");if(digits!==void 0)body["digit_count"]=integerValue("--digit-count",digits,1,10);const current=input.flags.get("--current-number");if(current!==void 0)body["current_number"]=integerValue("--current-number",current,0);const step=input.flags.get("--count-up-num");if(step!==void 0)body["count_up_num"]=integerValue("--count-up-num",step,1);const sort=input.flags.get("--sort");if(sort!==void 0)body["sort_order"]=integerValue(
15
+ "--sort",sort,0);const active=spec.hasActive?input.flags.get("--active"):void 0;if(active!==void 0)body["is_active"]=booleanText("--active",active);if(op==="update"){for(const raw of repeatedValues(input,"--clear")){if(raw.trim()!=="prefix")throw new UsageError(`--clear \u306B\u300C${raw}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,"\u7A7A\u306B\u3067\u304D\u308B\u9805\u76EE: prefix\uFF08\u6841\u6570\u30FB\u9023\u756A\u30FB\u5897\u5206\u30FB\u8868\u793A\u9806\u306F\u7A7A\u306B\u3067\u304D\u307E\u305B\u3093\uFF09");
16
+ if(rawPrefix!==void 0)throw new UsageError("prefix \u306B\u5024\u3068 --clear \u306E\u4E21\u65B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059","\u3069\u3061\u3089\u304B\u4E00\u65B9\u3060\u3051\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");body["prefix"]=null}}return body}function parsedOf(input,key){return JSON.parse(requireResolved(input,key))}function describeRule(spec,rule){const next=nextNumber(rule,spec.purchaseFormat);return`ID ${text(rule["id"])}\u30FB${text(rule["\
17
+ rule_name"])}${next===void 0?"":`\uFF08\u6B21\u306E\u756A\u53F7 ${next}\uFF09`}`}async function formatsUsing(spec,ctx,id){if(spec.formatKey===void 0)return{names:[],partial:false};const body=await ctx.resolver.salesJson(`${SALES_ESTIMATE_FORMATS_PATH}?page_limit=100&page_no=1`,"\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u4E00\u89A7");const list=Array.isArray(body["list"])?body["list"].filter(isRecord):[];const names=list.filter(row=>row[spec.formatKey]===id).map(row=>`ID ${text(row["id"])}\
18
+ \u300C${text(row["format_name"])}\u300D`);const pageSum=body["page_sum"];return{names,partial:typeof pageSum==="number"&&pageSum>1}}var RULE_LIST_ORDER_HELP=" \u26A0 \u3053\u306E\u4E00\u89A7\u306F\u30DA\u30FC\u30B8\u756A\u53F7\u3067\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF08--cursor \u306F\u30DA\u30FC\u30B8\u756A\u53F7\u3067\u3059\uFF09\u3002\n \u4E26\u3073\u306F\u8868\u793A\u9806\uFF08--sort \u306E\u5024\uFF09\u306E\u5C0F\u3055\u3044\u9806\u30FB\u540C\u3058\u306A\u3089 ID \u306E\u9806\u306B\u30B5\u30FC\u30D0\u304C\u56FA\u5B9A\u3057\u3066\u3044\u307E\u3059\u3002\u8FBF\u3063\u3066\u3044\u308B\u6700\u4E2D\u306B\u30C7\u30FC\u30BF\u304C\u5897\u6E1B\u3059\u308B\u3068\u3001\u53D6\u308A\u3053\u307C\u3057\u30FB\u91CD\u8907\u304C\u8D77\u3053\u308A\u5F97\u307E\u3059\u3002";
19
+ function ruleAbout(spec){return`${spec.label}\u306F\u3001${spec.document}\u3092\u4F5C\u308B\u3068\u304D\u306B\u632F\u308B\u756A\u53F7\u306E\u6C7A\u307E\u308A\u3067\u3059\u3002\u6B21\u306E\u756A\u53F7\u306F\u300C\u4ECA\u306E\u9023\u756A\uFF08current_number\uFF09\uFF0B\u5897\u5206\uFF08count_up_num\uFF09\u300D\u3092
20
+ \u6841\u6570\uFF08digit_count\uFF09\u3067\u30BC\u30ED\u57CB\u3081\u3057\u3001\u524D\u306B prefix \u3092\u4ED8\u3051\u305F\u3082\u306E\u3067\u3059\uFF08next_number \u5217\uFF09\u3002`+(spec.formatKey===void 0?"":`
21
+ \u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\uFF08twp estimate format\uFF09\u304C\u65E2\u5B9A\u306E\u30EB\u30FC\u30EB\u3092 ${spec.formatKey} \u3067\u9078\u3073\u307E\u3059\u3002`)}function ruleListOperation(spec){const paging=pageNumberPaging({label:`${spec.label}\u4E00\u89A7`});const rows=body=>{envelope(body,`${spec.label}\u4E00\u89A7`);return paging.items(body).map(row=>{if(!isRecord(row))throw new ApiResponseError(`${spec.label}\u4E00\u89A7\u306E\u884C\u306E\u5F62\u304C\u60F3\u5B9A\u3068\u9055\u3044\u307E\u3059\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
22
+ return withNext(spec,row)})};return{name:"list",summary:`${spec.label}\u3092\u4E00\u89A7\u3059\u308B\uFF08\u8868\u793A\u9806\u30FB\u6B21\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7\u3064\u304D\uFF09`,usage:`twp ${spec.parent} no-rule list [--keyword <\u8A9E>] [--all] [--limit <\u4EF6\u6570>]`,description:`${ruleAbout(spec)}
23
+
24
+ --keyword \u306F\u30EB\u30FC\u30EB\u540D\u3068 prefix \u306E\u90E8\u5206\u4E00\u81F4\u3067\u3059\u3002
25
+ next_number \u306F CLI \u304C\u30B5\u30FC\u30D0\u306E\u63A1\u756A\u306E\u5F0F\u3067\u8A08\u7B97\u3057\u305F\u5024\u3067\u3059\uFF08--output json \u306B\u3082\u8DB3\u3057\u307E\u3059\uFF09\u3002
26
+ --output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${[...RULE_COLUMNS,...spec.hasActive?["is_active"]:[]].join(" / ")}\uFF09\u3067\u3059\u3002
27
+
28
+ `+LIST_PAGING_HELP+"\n"+RULE_LIST_ORDER_HELP,flags:[...PAGE_NUMBER_LIST_FLAGS,{name:"--keyword",summary:"\u30EB\u30FC\u30EB\u540D\u30FBprefix \u306E\u90E8\u5206\u4E00\u81F4\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"}],paging,forbidden:MEMBER_FORBIDDEN,prepare:async input=>{if(input.args.length>0)throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,ruleUsage(spec,"list"));pageNumberQuery(input);return input},
29
+ plan:input=>{const{page_no,page_limit}=pageNumberQuery(input);return{method:"GET",path:spec.path,query:{keyword:nonEmpty(input.flags,"--keyword"),page_limit,page_no}}},summarize:body=>rows(body).map(row=>pick(row,[...RULE_COLUMNS,...spec.hasActive?["is_active"]:[]])),raw:rows,notes:body=>{const sum=isRecord(body)?body["sum"]:void 0;return[...pageRangeNotes(body),...typeof sum==="number"?[`\u8A72\u5F53 ${sum} \u4EF6`]:[]]}}}function ruleRecord(spec,body){return withNext(spec,recordOf(body,spec.label))}
30
+ function ruleGetColumns(spec){return[...RULE_COLUMNS,...spec.hasActive?["is_active"]:[],"updated_at"]}function noRuleResource(spec){const writeForbidden=spec.writeLevel==="admin"?salesAdminForbidden(`${spec.label}\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664`):MEMBER_FORBIDDEN;const deleteForbidden=salesAdminForbidden(`${spec.label}\u306E\u524A\u9664`);const flags=ruleFlags(spec);const confirmation=`\u4EE5\u5F8C\u306B\u767A\u884C\u3055\u308C\u308B${spec.document}\u306E\u756A\u53F7\u3092\u5909\u3048\u308B\u64CD\u4F5C`;
31
+ const getOperation={name:"get",summary:`${spec.label}1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u6B21\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7\u3064\u304D\uFF09`,usage:`twp ${spec.parent} no-rule get <\u30EB\u30FC\u30EBID>`,description:`ID \u306F twp ${spec.parent} no-rule list \u306E id \u5217\u306E\u6570\u5B57\u3067\u3059\u3002next_number \u306F CLI \u304C\u8A08\u7B97\u3057\u305F\u6B21\u306E\u756A\u53F7\u3067\u3059\u3002`,flags:[],forbidden:MEMBER_FORBIDDEN,plan:input=>({
32
+ method:"GET",path:`${spec.path}/${ruleIdArg(spec,input,"get")}`}),summarize:body=>pick(ruleRecord(spec,body),ruleGetColumns(spec)),raw:body=>ruleRecord(spec,body)};const createOperation={name:"create",summary:`${spec.label}\u3092\u767B\u9332\u3059\u308B\uFF08--name \u3068 --digit-count \u304C\u5FC5\u9808${spec.writeLevel==="admin"?"\u30FB\u8CA9\u58F2\u7BA1\u7406\u306E\u7BA1\u7406\u8005":""}\uFF09`,usage:`twp ${spec.parent} no-rule create --name <\u30EB\u30FC\u30EB\u540D> --digit-count <\u6841\u6570> [--prefix <\u6587\u5B57>] [--curren\
33
+ t-number <\u6574\u6570>] [--count-up-num <\u6574\u6570>] [--sort <\u6574\u6570>]${spec.hasActive?" [--active true|false]":""}`,description:`POST ${spec.path.replace("/api","")}\u3002
34
+
35
+ ${ruleAbout(spec)}
36
+
37
+ \u9001\u308B\u524D\u306B\u3001\u3053\u306E\u30EB\u30FC\u30EB\u3067\u6700\u521D\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08--dry-run \u3067\u3082\u51FA\u307E\u3059\uFF09\u3002`,flags,forbidden:writeForbidden,prepare:async input=>{if(input.args.length>0)throw new UsageError(`create \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,ruleUsage(spec,"create"));const missing=["--name","--digit-count"].filter(
38
+ flag=>!input.flags.has(flag));if(missing.length>0)throw new UsageError(`${spec.label}\u306E\u767B\u9332\u306B\u306F ${missing.join(" / ")} \u304C\u8981\u308A\u307E\u3059`,ruleUsage(spec,"create"));return withResolved(input,{body:JSON.stringify(ruleBody(spec,input,"create"))})},plan:input=>({method:"POST",path:spec.path,body:parsedOf(input,"body")}),execute:async(input,ctx)=>{const created=await ctx.send({method:"POST",path:spec.path,body:parsedOf(input,"body")});const id=text(recordOf(created,spec.
39
+ label)["id"]);const fresh=await ctx.send({method:"GET",path:`${spec.path}/${id}`});return{...isRecord(fresh)?fresh:{},message:isRecord(created)?created["message"]:void 0}},plannedNotes:input=>{const body=parsedOf(input,"body");const first=nextNumber({current_number:0,count_up_num:1,prefix:spec.prefixDefault,...body},spec.purchaseFormat);return first===void 0?[]:[`\u3053\u306E\u30EB\u30FC\u30EB\u3067\u6700\u521D\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7: ${first}`]},summarize:body=>pick(ruleRecord(
40
+ spec,body),ruleGetColumns(spec)),raw:body=>ruleRecord(spec,body),notes:serverMessage};const updateOperation={name:"update",summary:`${spec.label}\u3092\u66F8\u304D\u63DB\u3048\u308B\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\u30FB--yes \u304C\u8981\u308B\uFF09`,usage:`twp ${spec.parent} no-rule update <\u30EB\u30FC\u30EBID> [\u9805\u76EE\u2026] [--clear prefix] --yes`,description:`PUT ${spec.path.replace("/api","")}/{id}\u3002\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\u3092\u9001\u308A\u307E\u3059\uFF08\u6307\u5B9A\u3057\u306A\u304B\u3063\u305F\u9805\u76EE\u306F\u5909\u308F\u308A\u307E\u305B\u3093\uFF09\u3002
41
+ \u26A0\uFE0F \u4EE5\u5F8C\u306B\u767A\u884C\u3055\u308C\u308B${spec.document}\u306E\u756A\u53F7\u304C\u5909\u308F\u308A\u307E\u3059\u3002--current-number \u3092\u4ECA\u3088\u308A\u5C0F\u3055\u304F\u3059\u308B\u3068\u3001\u767A\u884C\u6E08\u307F\u3068\u540C\u3058\u756A\u53F7\u304C\u518D\u3073\u632F\u3089\u308C\u307E\u3059\u3002
42
+ \u9001\u308B\u524D\u306B\u4ECA\u306E\u5024\u3092\u8AAD\u307F\u3001\u6B21\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7\u3092\u5909\u66F4\u524D\u30FB\u5909\u66F4\u5F8C\u3067 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08--dry-run \u3067\u3082\u51FA\u307E\u3059\u3002--dry-run \u306F --yes \u7121\u3057\u3067\u4F7F\u3048\u307E\u3059\uFF09\u3002
43
+ \u7A7A\u306B\u3067\u304D\u308B\u306E\u306F prefix \u3060\u3051\u3067\u3059\uFF08--clear prefix${spec.purchaseFormat?"\u3002\u4ED5\u5165\u306F\u7A7A\u306B\u3059\u308B\u3068\u65E2\u5B9A\u306E 2000 \u304C\u4ED8\u304D\u3001prefix \u306A\u3057\u306B\u306F\u3067\u304D\u307E\u305B\u3093":""}\uFF09\u3002\u6841\u6570\u30FB\u9023\u756A\u30FB\u5897\u5206\u30FB\u8868\u793A\u9806\u306F\u30B5\u30FC\u30D0\u306E\u5217\u304C\u7A7A\u3092\u53D7\u3051\u307E\u305B\u3093\u3002--prefix \u306E\u524D\u5F8C\u306E\u7A7A\u767D\u306F\u30B5\u30FC\u30D0\u3068\u540C\u3058\u304F\u843D\u3068\u3057\u307E\u3059\u3002`,
44
+ destructive:true,confirmation,flags:[...flags,ruleClearFlag(spec)],forbidden:writeForbidden,prepare:async(input,ctx)=>{const id=ruleIdArg(spec,input,"update");const body=ruleBody(spec,input,"update");if(Object.keys(body).length===0)throw new UsageError("\u66F8\u304D\u63DB\u3048\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093",ruleUsage(spec,"update"));const current=await ctx.resolver.salesRecord(spec.kind,id,"<\u30EB\u30FC\u30EBID>");return withResolved(input,{body:JSON.stringify(body),current:JSON.
45
+ stringify(current)})},plan:input=>({method:"PUT",path:`${spec.path}/${ruleIdArg(spec,input,"update")}`,body:parsedOf(input,"body")}),plannedNotes:input=>{const current=parsedOf(input,"current");const before=nextNumber(current,spec.purchaseFormat);const after=nextNumber({...current,...parsedOf(input,"body")},spec.purchaseFormat);const lines=[`\u66F8\u304D\u63DB\u3048\u308B${spec.label}: ID ${text(current["id"])}\u30FB${text(current["rule_name"])}`];if(before!==void 0&&after!==void 0){lines.push(before===
46
+ after?`\u6B21\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7: ${before}\uFF08\u5909\u308F\u308A\u307E\u305B\u3093\uFF09`:`\u6B21\u306B\u767A\u884C\u3055\u308C\u308B\u756A\u53F7: ${before} \u2192 ${after}`)}return lines},summarize:body=>pick(ruleRecord(spec,body),ruleGetColumns(spec)),raw:body=>ruleRecord(spec,body),notes:serverMessage};const deleteOperation={name:"delete",summary:`${spec.label}\u3092\u524A\u9664\u3059\u308B\uFF08\u8CA9\u58F2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u30FB--yes \u304C\u8981\u308B\uFF09`,
47
+ usage:`twp ${spec.parent} no-rule delete <\u30EB\u30FC\u30EBID> --yes`,description:`DELETE ${spec.path.replace("/api","")}/{id}\uFF08\u8AD6\u7406\u524A\u9664\uFF09\u3002\u767A\u884C\u6E08\u307F\u306E${spec.document}\u306F\u756A\u53F7\u3092\u81EA\u5206\u3067\u6301\u3063\u3066\u3044\u308B\u306E\u3067\u3001\u756A\u53F7\u306F\u6D88\u3048\u307E\u305B\u3093\u3002
48
+ `+(spec.formatKey===void 0?"\u4F7F\u7528\u4E2D\u3067\u3082\u30B5\u30FC\u30D0\u306F\u524A\u9664\u3092\u65AD\u308A\u307E\u305B\u3093\u3002\n":`\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u304C\u65E2\u5B9A\uFF08${spec.formatKey}\uFF09\u306B\u9078\u3093\u3067\u3044\u3066\u3082\u30B5\u30FC\u30D0\u306F\u524A\u9664\u3092\u65AD\u308A\u307E\u305B\u3093\u3002\u9001\u308B\u524D\u306B\u3001\u9078\u3093\u3067\u3044\u308B\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\u3002
49
+ `)+"\u9001\u308B\u524D\u306B\u5BFE\u8C61\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08--dry-run \u3067\u3082\u51FA\u307E\u3059\uFF09\u3002",destructive:true,flags:[],forbidden:deleteForbidden,prepare:async(input,ctx)=>{const id=ruleIdArg(spec,input,"delete");const current=await ctx.resolver.salesRecord(spec.kind,id,"<\u30EB\u30FC\u30EBID>");const using=await formatsUsing(spec,ctx,id);return withResolved(input,{current:JSON.stringify(current),using:JSON.stringify(using)})},plan:input=>({method:"\
50
+ DELETE",path:`${spec.path}/${ruleIdArg(spec,input,"delete")}`}),plannedNotes:input=>{const using=parsedOf(input,"using");const lines=[`\u524A\u9664\u3059\u308B${spec.label}: ${describeRule(spec,parsedOf(input,"current"))}`];if(using.names.length>0){lines.push(`\u26A0\uFE0F \u6B21\u306E\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u304C\u3053\u306E\u30EB\u30FC\u30EB\u3092\u65E2\u5B9A\u306B\u9078\u3093\u3067\u3044\u307E\u3059: ${using.names.join(" / ")}\u3002\u9078\u3073\u76F4\u3059\u307E\u3067\u3001\u3053\u308C\u3089\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u3067\u4F5C\u308B${spec.
51
+ document}\uFF08\u81EA\u52D5\u8ACB\u6C42\u3092\u542B\u3080\uFF09\u306B\u306F\u756A\u53F7\u304C\u632F\u3089\u308C\u307E\u305B\u3093\u3002twp estimate format update \u3067\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044`)}if(using.partial)lines.push("\uFF08\u898B\u7A4D\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u306F\u5148\u982D 100 \u4EF6\u3060\u3051\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\uFF09");return lines},summarize:body=>acknowledgement(body,`${spec.label}\u524A\u9664`),raw:body=>acknowledgement(
52
+ body,`${spec.label}\u524A\u9664`)};return{name:"no-rule",summary:`${spec.label}\uFF08${spec.document}\u306E\u756A\u53F7\u306E\u632F\u308A\u65B9\u3002\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u767B\u9332\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09`,operations:[ruleListOperation(spec),getOperation,createOperation,updateOperation,deleteOperation]}}var estimateNoRuleResource=noRuleResource({parent:"estimate",label:"\u898B\u7A4D\u756A\u53F7\u30EB\u30FC\u30EB",document:"\u898B\u7A4D",path:SALES_ESTIMATE_NO_RULES_PATH,
53
+ kind:"estimate-no-rule",writeLevel:"admin",hasActive:false,formatKey:"default_estimate_no_id",prefixDefault:null,purchaseFormat:false});var invoiceNoRuleResource=noRuleResource({parent:"invoice",label:"\u8ACB\u6C42\u756A\u53F7\u30EB\u30FC\u30EB",document:"\u8ACB\u6C42",path:SALES_INVOICE_NO_RULES_PATH,kind:"invoice-no-rule",writeLevel:"admin",hasActive:false,formatKey:"default_invoice_no_id",prefixDefault:null,purchaseFormat:false});var purchaseNoRuleResource=noRuleResource({parent:"purchase",label:"\
54
+ \u4ED5\u5165\u756A\u53F7\u30EB\u30FC\u30EB",document:"\u4ED5\u5165\uFF08\u6CE8\u6587\u66F8\uFF09",path:SALES_PURCHASE_NO_RULES_PATH,kind:"purchase-no-rule",writeLevel:"member",hasActive:true,prefixDefault:"2000",purchaseFormat:true});var ROUNDING_METHODS={round:"\u56DB\u6368\u4E94\u5165",ceil:"\u5207\u308A\u4E0A\u3052",floor:"\u5207\u308A\u6368\u3066"};function roundingMethod(raw){const value=raw.trim();const key=Object.hasOwn(ROUNDING_METHODS,value.toLowerCase())?value.toLowerCase():Object.keys(
55
+ ROUNDING_METHODS).find(k=>ROUNDING_METHODS[k]===value);if(key===void 0){throw new UsageError(`--method \u306B\u300C${raw}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,`\u6307\u5B9A\u3067\u304D\u308B\u5024: ${Object.entries(ROUNDING_METHODS).map(([k,label])=>`${k}\uFF08${label}\uFF09`).join(" / ")}`)}return key}function roundingOf(body){const data=envelope(body,"\u7AEF\u6570\u51E6\u7406\u8A2D\u5B9A")["data"];if(!isRecord(data)||typeof data["rounding_method"]!=="string")throw new ApiResponseError(
56
+ "\u7AEF\u6570\u51E6\u7406\u8A2D\u5B9A\u306E\u5FDC\u7B54\u306B data.rounding_method \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");const method=data["rounding_method"];return{...data,rounding_method_label:Object.hasOwn(ROUNDING_METHODS,method)?ROUNDING_METHODS[method]:method}}var ROUNDING_COLUMNS=["rounding_method","rounding_method_label","updated_at","updated_by"];function roundingNotes(record){return record["updated_at"]===
57
+ null?["\u307E\u3060\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u65E2\u5B9A\u306E\u56DB\u6368\u4E94\u5165\u3067\u8A08\u7B97\u3057\u3066\u3044\u307E\u3059"]:[]}var ROUNDING_ABOUT="\u7AEF\u6570\u51E6\u7406\u306F\u3001\u898B\u7A4D\u30FB\u8ACB\u6C42\u30FB\u5951\u7D04\u30FB\u4ED5\u5165\u30FB\u652F\u6255\u306E\u91D1\u984D\uFF08\u7A0E\u984D\u306A\u3069\uFF09\u306E1\u5186\u672A\u6E80\u3092\u3069\u3046\u4E38\u3081\u308B\u304B\u306E\u30C6\u30CA\u30F3\u30C8\u306E\u8A2D\u5B9A\u3067\u3059\uFF08round\uFF1D\u56DB\u6368\u4E94\u5165 / ceil\uFF1D\u5207\u308A\u4E0A\u3052 / floor\uFF1D\u5207\u308A\u6368\u3066\uFF09\u3002\n\u5909\u3048\u308B\u3068\u3001\u3053\u308C\u4EE5\u964D\u306B\u4F5C\u308B\u5E33\u7968\u304B\u3089\u52B9\u304D\u307E\u3059\u3002\u4F5C\u6210\u6E08\u307F\u306E\u898B\u7A4D\u30FB\u8ACB\u6C42\u30FB\u5951\u7D04\u30FB\u4ED5\u5165\u306F\u4F5C\u3063\u305F\u6642\u70B9\u306E\u65B9\u5F0F\u3092\u6301\u3063\u3066\u3044\u308B\u306E\u3067\u3001\u91D1\u984D\u306F\u5909\u308F\u308A\u307E\u305B\u3093\u3002\n\u305F\u3060\u3057\u652F\u6255\u306F\u65B9\u5F0F\u3092\u6301\u305F\u305A\u3001\u91D1\u984D\u30FB\u7A0E\u7387\u3092\u66F8\u304D\u63DB\u3048\u308B\u305F\u3073\u306B\u305D\u306E\u6642\u70B9\u306E\u65B9\u5F0F\u3067\u7A0E\u629C\u984D\u3092\u8A08\u7B97\u3057\u76F4\u3057\u307E\u3059\u3002";
58
+ var roundingGet={name:"get",summary:"\u7AEF\u6570\u51E6\u7406\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3059\u308B",usage:"twp rounding-setting get",description:`GET /api/v2/sales/rounding-setting\u3002\u8CA9\u58F2\u7BA1\u7406\u306E\u30E1\u30F3\u30D0\u30FC\u4EE5\u4E0A\u304C\u4F7F\u3048\u307E\u3059\u3002
59
+
60
+ ${ROUNDING_ABOUT}`,flags:[],forbidden:MEMBER_FORBIDDEN,plan:input=>{if(input.args.length>0)throw new UsageError(`get \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp rounding-setting get help");return{method:"GET",path:SALES_ROUNDING_SETTING_PATH}},summarize:body=>pick(roundingOf(body),ROUNDING_COLUMNS),raw:roundingOf,notes:body=>roundingNotes(roundingOf(body))};var roundingUpdate={name:"update",summary:"\u7AEF\u6570\u51E6\u7406\u306E\u65B9\u5F0F\u3092\u5909\u3048\u308B\uFF08\u8CA9\u58F2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u30FB--yes \u304C\u8981\u308B\uFF09",
61
+ usage:"twp rounding-setting update --method <round|ceil|floor> --yes",description:`PUT /api/v2/sales/rounding-setting\uFF08\u307E\u3060\u8A2D\u5B9A\u304C\u7121\u3051\u308C\u3070\u4F5C\u3089\u308C\u307E\u3059\uFF09\u3002\u8CA9\u58F2\u7BA1\u7406\u306E\u300C\u7BA1\u7406\u8005\u300D\u3060\u3051\u304C\u4F7F\u3048\u307E\u3059\u3002
62
+
63
+ ${ROUNDING_ABOUT}
64
+
65
+ --method \u306F round / ceil / floor \u306E\u307B\u304B\u3001\u56DB\u6368\u4E94\u5165 / \u5207\u308A\u4E0A\u3052 / \u5207\u308A\u6368\u3066 \u3067\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002
66
+ \u9001\u308B\u524D\u306B\u4ECA\u306E\u65B9\u5F0F\u3092\u8AAD\u307F\u3001\u5909\u66F4\u524D\u30FB\u5909\u66F4\u5F8C\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08--dry-run \u3067\u3082\u51FA\u307E\u3059\u3002--dry-run \u306F --yes \u7121\u3057\u3067\u4F7F\u3048\u307E\u3059\uFF09\u3002`,destructive:true,confirmation:"\u4EE5\u5F8C\u306B\u4F5C\u308B\u898B\u7A4D\u30FB\u8ACB\u6C42\u30FB\u5951\u7D04\u30FB\u4ED5\u5165\u30FB\u652F\u6255\u306E\u91D1\u984D\u306E\u4E38\u3081\u3092\u5909\u3048\u308B\u64CD\u4F5C",
67
+ flags:[{name:"--method",summary:"\u7AEF\u6570\u51E6\u7406\u306E\u65B9\u5F0F\uFF08round / ceil / floor\u30FB\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u65B9\u5F0F>"}],forbidden:salesAdminForbidden("\u7AEF\u6570\u51E6\u7406\u306E\u5909\u66F4"),prepare:async(input,ctx)=>{if(input.args.length>0)throw new UsageError(`update \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp rounding-setting update help");const raw=input.flags.get("--method");if(raw===
68
+ void 0)throw new UsageError("--method \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","twp rounding-setting update help");const method=roundingMethod(raw);const current=roundingOf(await ctx.resolver.salesJson(SALES_ROUNDING_SETTING_PATH,"\u7AEF\u6570\u51E6\u7406\u8A2D\u5B9A"));return withResolved(input,{method,current:JSON.stringify(current)})},plan:input=>({method:"PUT",path:SALES_ROUNDING_SETTING_PATH,body:{rounding_method:requireResolved(input,"method")}}),plannedNotes:input=>{const current=parsedOf(
69
+ input,"current");const before=text(current["rounding_method"]);const after=requireResolved(input,"method");const label=key=>`${key}\uFF08${Object.hasOwn(ROUNDING_METHODS,key)?ROUNDING_METHODS[key]:key}\uFF09`;return[before===after?`\u7AEF\u6570\u51E6\u7406: ${label(before)}\uFF08\u5909\u308F\u308A\u307E\u305B\u3093\uFF09`:`\u7AEF\u6570\u51E6\u7406: ${label(before)} \u2192 ${label(after)}`,...current["updated_at"]===null?["\u4ECA\u306F\u307E\u3060\u8A2D\u5B9A\u304C\u7121\u304F\u65E2\u5B9A\u306E\u56DB\u6368\u4E94\u5165\u3067\u3059\u3002\u9001\u308B\u3068\u8A2D\u5B9A\u304C\u4F5C\u3089\u308C\u307E\u3059"]:
70
+ []]},summarize:body=>pick(roundingOf(body),ROUNDING_COLUMNS),raw:roundingOf,notes:serverMessage};var roundingSettingDomain={name:"rounding-setting",summary:"\u8CA9\u58F2\u7BA1\u7406\u306E\u7AEF\u6570\u51E6\u7406\uFF08\u898B\u7A4D\u30FB\u8ACB\u6C42\u30FB\u5951\u7D04\u30FB\u4ED5\u5165\u30FB\u652F\u6255\u306E\u91D1\u984D\u306E\u4E38\u3081\u65B9\u3002\u8868\u793A\u3068\u5909\u66F4\uFF09",operations:[roundingGet,roundingUpdate]};export{nextNumber,estimateNoRuleResource,invoiceNoRuleResource,purchaseNoRuleResource,roundingSettingDomain};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __twpCreateRequire } from 'node:module';
2
2
  const require = __twpCreateRequire(import.meta.url);
3
- import{readCsvFileText}from"./chunk-I6DWJXPC.js";import{contentTypeFor,inspectLocalFile,issued}from"./chunk-VECUCVIY.js";import{checkUploadQuota}from"./chunk-DDKZ5IPT.js";import{featureLicenseGuidance}from"./chunk-ADQD5OPN.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-IRT7VFG4.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-ZST7XESB.js";import{ApiError,errorListMessages}from"./chunk-IF2K4PM5.js";import{
3
+ import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-BPCK5RAB.js";import{contentTypeFor,inspectLocalFile,issued}from"./chunk-PKWMJIBM.js";import{checkUploadQuota}from"./chunk-DDKZ5IPT.js";import{readCsvFileText}from"./chunk-I6DWJXPC.js";import{featureLicenseGuidance}from"./chunk-BZ7ULFR3.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-BZAXQOLB.js";import{ApiError,errorListMessages}from"./chunk-IF2K4PM5.js";import{
4
4
  isSafePathSegment}from"./chunk-GMBJTG6A.js";import{LIST_FLAGS,LIST_PAGING_HELP,envelopePaging,nonEmpty,positiveInteger}from"./chunk-5R4SEO3I.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiRejectedError,ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import fs from"fs";import path from"path";function levelForbidden(licenseGuidance,levelGuidance){return body=>body?.error==="permission_denied"?licenseGuidance:levelGuidance}var COMPANY_LICENSE="\u53D6\u5F15\u5148\u3092\u6271\u3046\u306B\u306F\u8CA9\u58F2\u7BA1\u7406\u304B\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u8981\u308A\u307E\u3059\u304C\u3001\u3069\u3061\u3089\u3082\u3042\u308A\u307E\u305B\u3093\u3002\u30C6\u30CA\u30F3\u30C8\u304C\u3069\u3061\u3089\u3082\u5951\u7D04\u3057\u3066\u3044\u306A\u3044\u304B\u3001\u3042\u306A\u305F\u306E\u6A29\u9650\u304C\u3069\u3061\u3089\u3082\u300C\u306A\u3057\u300D\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
5
5
  var CUSTOMER_LICENSE=featureLicenseGuidance("\u9867\u5BA2\u7BA1\u7406");var COMPANY_WRITE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u9867\u5BA2\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u306F\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7DE8\u96C6\u8005\u300D\u4EE5\u4E0A\u304B\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u306E\u3069\u3061\u3089\u304B\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
6
6
  var LEVEL_LABELS={admin:"\u7BA1\u7406\u8005",editor:"\u7DE8\u96C6\u8005",viewer:"\u95B2\u89A7\u8005",none:"\u306A\u3057"};var CHILD_DELETE_NEEDS="\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u306E\u524A\u9664\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u3067\u3042\u308B\u3053\u3068\u304C\u8981\u308A\u307E\u3059";var CUSTOMER_DELETE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u9867\u5BA2\u306E\u524A\u9664\u306B\u306F\u3001\u4F01\u696D\u306E\u524A\u9664\u306B\u9867\u5BA2\u7BA1\u7406\u306E\u300C\u7BA1\u7406\u8005\u300D\u304B\u8CA9\u58F2\u7BA1\u7406\u306E\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u3001\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u306E\u524A\u9664\u306B\u9867\u5BA2\u7BA1\u7406\u306E\u300C\u7BA1\u7406\u8005\u300D\u304C\u8981\u308A\u307E\u3059\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\
@@ -17,7 +17,7 @@ var GLOBAL_OPTIONS_HELP=`\u30B0\u30ED\u30FC\u30D0\u30EB\u30AA\u30D7\u30B7\u30E7\
17
17
  \uFF08Authorization \u30D8\u30C3\u30C0\u3068\u30C8\u30FC\u30AF\u30F3\u306F\u4F0F\u5B57\u5316\u3055\u308C\u308B\uFF09
18
18
  --refresh --status / --type / --assignee \u3092\u540D\u524D\u3067\u53D7\u3051\u308B\u30B3\u30DE\u30F3\u30C9\u3067\u3001
19
19
  \u540D\u524D \u2192 ID \u306E\u30AD\u30E3\u30C3\u30B7\u30E5\u3092\u8AAD\u307E\u305A\u306B\u53D6\u308A\u76F4\u3059\uFF08\u65E2\u5B9A 10 \u5206\uFF09
20
- --yes \u7834\u58CA\u7684\u306A\u64CD\u4F5C\u306E\u78BA\u8A8D\u3092\u7701\u304F
20
+ --yes \u78BA\u8A8D\u304C\u8981\u308B\u64CD\u4F5C\uFF08\u524A\u9664\u30FB\u5168\u4EF6\u7F6E\u63DB\u30FB\u8AB2\u91D1\u306A\u3069\uFF09\u3092\u5B9F\u884C\u3059\u308B
21
21
 
22
22
  \u5024\u306E\u66F8\u304D\u65B9:
23
23
  --flag <\u5024> \u3068 --flag=<\u5024> \u306F\u3069\u3061\u3089\u3082\u4F7F\u3048\u307E\u3059\uFF08\u540C\u3058\u610F\u5473\uFF09\u3002
@@ -0,0 +1,8 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ var LOADERS={"agent-loop":async()=>(await import("./agent-loop-4U5RLC4L.js")).agentLoopDomain,attendance:async()=>(await import("./attendance-5KE2JPK4.js")).attendanceDomain,backlog:async()=>(await import("./backlog-ISEIWKMQ.js")).backlogDomain,"business-place":async()=>(await import("./sales-master-ORLR5VK4.js")).businessPlaceDomain,company:async()=>(await import("./company-4Z4JJVA7.js")).companyDomain,contract:async()=>(await import("./contract-BQ76SGWV.js")).contractDomain,customer:async()=>(await import("./company-4Z4JJVA7.js")).
4
+ customerDomain,department:async()=>(await import("./department-YHZRSWLB.js")).departmentDomain,deposit:async()=>(await import("./deposit-U4AVQH5O.js")).depositDomain,estimate:async()=>(await import("./estimate-U2K7DPGH.js")).estimateDomain,inquiry:async()=>(await import("./inquiry-5D4U6CLU.js")).inquiryDomain,invoice:async()=>(await import("./invoice-2VLK2BFV.js")).invoiceDomain,"job-title":async()=>(await import("./job-title-G7MIYWVA.js")).jobTitleDomain,leave:async()=>(await import("./leave-GHFJOGNC.js")).
5
+ leaveDomain,media:async()=>(await import("./media-XO6X3UQT.js")).mediaDomain,meeting:async()=>(await import("./knowledge-7QDC775Q.js")).meetingDomain,note:async()=>(await import("./knowledge-7QDC775Q.js")).noteDomain,notification:async()=>(await import("./notification-SUSR5NGQ.js")).notificationDomain,payee:async()=>(await import("./sales-master-ORLR5VK4.js")).payeeDomain,position:async()=>(await import("./position-UY33ETLX.js")).positionDomain,project:async()=>(await import("./project-ZGOB5W25.js")).
6
+ projectDomain,prospect:async()=>(await import("./prospect-G426O6XL.js")).prospectDomain,purchase:async()=>(await import("./purchase-3GGAQRE6.js")).purchaseDomain,receivable:async()=>(await import("./receivable-TNH4KCUO.js")).receivableDomain,report:async()=>(await import("./report-UC2PCK7B.js")).reportDomain,"rounding-setting":async()=>(await import("./sales-numbering-MBFKVR2C.js")).roundingSettingDomain,"seal-impression":async()=>(await import("./sales-master-ORLR5VK4.js")).sealImpressionDomain,
7
+ shift:async()=>(await import("./attendance-lists-MXQNWUIH.js")).shiftDomain,storage:async()=>(await import("./storage-ANKKJJJO.js")).storageDomain,"supplier-payment":async()=>(await import("./supplier-payment-AFJ7G6AP.js")).supplierPaymentDomain,task:async()=>(await import("./task-S3BBBELE.js")).taskDomain,user:async()=>(await import("./user-O7H5PD4N.js")).userDomain,wiki:async()=>(await import("./knowledge-7QDC775Q.js")).wikiDomain,workchange:async()=>(await import("./attendance-lists-MXQNWUIH.js")).
8
+ workchangeDomain,workflow:async()=>(await import("./workflow-2YL2OF2Y.js")).workflowDomain};async function loadDomain(name){return LOADERS[name]()}export{loadDomain};
@@ -0,0 +1,58 @@
1
+ import { createRequire as __twpCreateRequire } from 'node:module';
2
+ const require = __twpCreateRequire(import.meta.url);
3
+ import{FORCE_FLAG,OUT_FLAG,REV_FLAG,revOf,singleId,uploadStaged}from"./chunk-43OMEGNH.js";import{CUSTOMER_LICENSE,childForbidden,levelForbidden}from"./chunk-H54MGGHB.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-BPCK5RAB.js";import{inspectLocalFile}from"./chunk-PKWMJIBM.js";import{SALES_ESTIMATES_PATH,isExactNumericId}from"./chunk-BZAXQOLB.js";import{nonEmpty}from"./chunk-5R4SEO3I.js";import{requireResolved,withResolved}from"./chunk-ZN5EFDH7.js";
4
+ import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";import fs from"fs";import path from"path";var DOCUMENT_TYPES=["order_form","individual_contract","other"];var DOCUMENT_TYPE_HELP="order_form\uFF1D\u6CE8\u6587\u66F8 / individual_contract\uFF1D\u500B\u5225\u5951\u7D04\u66F8 / other\uFF1D\u305D\u306E\u4ED6\u6848\u4EF6\u66F8\u985E";var MAGIC_BYTES={pdf:["%PDF-"],jpg:["\xFF\xD8\xFF"],jpeg:["\xFF\xD8\xFF"],png:["\x89PNG\r\n\n"],xlsx:["PK","PK","PK\x07\b"],docx:["PK","PK","PK\x07\b"],xls:["\xD0\xCF\xE0\xA1\xB1\xE1"],doc:["\xD0\xCF\xE0\xA1\xB1\xE1"]};var FILE_NAME_MAX_CHARS=255;var FIELDS=[
5
+ {kind:"text",flag:"--name",key:"document_name",label:"\u66F8\u985E\u540D",maxChars:255,summary:"\u66F8\u985E\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"enum",flag:"--type",key:"document_type",values:DOCUMENT_TYPES,summary:`\u66F8\u985E\u7A2E\u5225\uFF08${DOCUMENT_TYPE_HELP}\u30FBcreate \u3067\u306F\u5FC5\u9808\uFF09`}];var COLUMNS=["document_id","estimate_id","document_type","document_type_label","document_name","current_version","updated_by_name","updated_at"];var VERSION_COLUMNS=[
6
+ "version_number","file_name","file_size","is_current","created_by_name","created_at"];var ESTIMATE_FLAG={name:"--estimate",summary:"\u898B\u7A4D\u306E ID\uFF08twp estimate list \u306E id \u5217\u306E\u6570\u5B57\u30FB\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u898B\u7A4DID>"};var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B\u30D5\u30A1\u30A4\u30EB\uFF08PDF\u30FBJPEG\u30FBPNG\u30FBWord\u30FBExcel\u3002\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\
7
+ \u30D1\u30B9>"};var REF_HELP="--estimate\uFF08\u898B\u7A4D\u306E ID\uFF09\u304C\u5FC5\u9808\u3067\u3059\u3002<\u66F8\u985EID> \u306F twp estimate case-document list \u306E document_id \u5217\u306E\u5024\u3067\u3059\u3002\n\u9867\u5BA2\u3092\u307E\u305F\u3044\u3060\u4E00\u89A7\u306F twp customer case-document list --customer <\u9867\u5BA2> \u3067\u898B\u3089\u308C\u307E\u3059\u3002";var VIEW_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u6848\u4EF6\u66F8\u985E\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");
8
+ var EDIT_FORBIDDEN=childForbidden("\u6848\u4EF6\u66F8\u985E","edit");var usageOf=op=>`twp estimate case-document ${op} help`;function estimateBase(input,op){const raw=nonEmpty(input.flags,ESTIMATE_FLAG.name);if(raw===void 0)throw new UsageError(`${ESTIMATE_FLAG.name} \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,usageOf(op));const id=raw.trim();if(!isExactNumericId(id))throw new UsageError(`${ESTIMATE_FLAG.name} \u306F\u898B\u7A4D\u306E ID\uFF08\u6570\u5B57\uFF09\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${id}`,
9
+ usageOf(op));return`${SALES_ESTIMATES_PATH}/${id}/case-documents`}var docId=(input,op)=>singleId(input,"\u66F8\u985E",usageOf(op),"twp estimate case-document list --estimate <\u898B\u7A4DID> \u306E document_id \u5217\u306E\u5024\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");var docPath=(input,op)=>`${estimateBase(input,op)}/${encodeURIComponent(docId(input,op))}`;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.
10
+ args.join(" ")}`,usageOf(op))}function itemsOf(body){const items=isRecord(body)?body["items"]:void 0;if(!isRecord(body)||body["result"]!==true||!Array.isArray(items)||!items.every(isRecord)){throw new ApiResponseError("\u6848\u4EF6\u66F8\u985E\u4E00\u89A7\u306E\u5FDC\u7B54\u306B items \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return items}function docOf(body,what){const doc=isRecord(body)?body["case_docu\
11
+ ment"]:void 0;if(!isRecord(body)||body["result"]!==true||!isRecord(doc)||typeof doc["document_id"]!=="string"){throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306B case_document.document_id \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}return doc}function summaryOf(body,what){const doc=docOf(body,what);const versions=doc["versions"];return{...pick(doc,COLUMNS),versions:Array.isArray(versions)?versions.length:0}}function inspectCaseDocumentFile(raw,flag,usage,label){
12
+ const{file,size}=inspectLocalFile(raw,flag,usage);const name=path.basename(file);const extension=path.extname(name).slice(1).toLowerCase();const signatures=MAGIC_BYTES[extension];if(signatures===void 0){throw new UsageError(`${label}\u306F PDF\u30FB\u753B\u50CF\uFF08JPEG/PNG\uFF09\u30FBOffice\uFF08Word/Excel\uFF09\u3060\u3051\u3092\u767B\u9332\u3067\u304D\u307E\u3059: ${name}`)}if(Array.from(name).length>FILE_NAME_MAX_CHARS){throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u540D\u306F ${FILE_NAME_MAX_CHARS}\
13
+ \u6587\u5B57\u307E\u3067\u3067\u3059\uFF08${Array.from(name).length} \u6587\u5B57\uFF09: ${name}`)}const head=Buffer.alloc(Math.max(...signatures.map(s=>s.length)));let read;try{const fd=fs.openSync(file,"r");try{read=fs.readSync(fd,head,0,head.length,0)}finally{fs.closeSync(fd)}}catch(err){throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\uFF08${flag}\uFF09: ${file}\uFF08${err.code??err.message}\uFF09`)}const text=head.subarray(0,read).toString("lat\
14
+ in1");if(!signatures.some(signature=>text.startsWith(signature))){throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u306E\u5185\u5BB9\u304C\u62E1\u5F35\u5B50\uFF08.${extension}\uFF09\u3068\u5408\u3044\u307E\u305B\u3093\uFF08\u58CA\u308C\u3066\u3044\u308B\u304B\u5225\u306E\u5F62\u5F0F\u3067\u3059\uFF09: ${file}`)}return{file,name,size}}function localDocument(input,op){return inspectCaseDocumentFile(input.flags.get(FILE_FLAG.name),FILE_FLAG.name,usageOf(op),"\u6848\u4EF6\u66F8\u985E")}function uploadUrlPlan(input,op){
15
+ return{method:"POST",path:`${estimateBase(input,op)}/upload-url`,body:{file_name:requireResolved(input,"fileName"),file_size:Number(requireResolved(input,"fileSize"))}}}function prepareFile(input,op){estimateBase(input,op);const doc=localDocument(input,op);return Promise.resolve(withResolved(input,{file:doc.file,fileName:doc.name,fileSize:String(doc.size)}))}function estimateOf(input){return(input.flags.get(ESTIMATE_FLAG.name)??"").trim()}async function createDocument(input,ctx){const body=fieldBody(
16
+ input,FIELDS);return uploadStaged(input,ctx,{label:"\u6848\u4EF6\u66F8\u985E",issue:uploadUrlPlan(input,"create"),retry:`twp estimate case-document list --estimate ${estimateOf(input)}`,register:async uploadKey=>{const created=docOf(await ctx.send({method:"POST",path:estimateBase(input,"create"),body:{...body,upload_key:uploadKey,file_name:requireResolved(input,"fileName")}}),"\u6848\u4EF6\u66F8\u985E\u306E\u767B\u9332");return{result:true,case_document:created}}})}async function addVersion(input,ctx){
17
+ const target=docPath(input,"add-version");const before=docOf(await ctx.send({method:"GET",path:target}),"\u6848\u4EF6\u66F8\u985E");const previous=typeof before["current_version"]==="number"?before["current_version"]:0;return uploadStaged(input,ctx,{label:"\u6848\u4EF6\u66F8\u985E",issue:uploadUrlPlan(input,"add-version"),retry:`twp estimate case-document get ${docId(input,"add-version")} --estimate ${estimateOf(input)}`,register:async uploadKey=>{const after=docOf(await ctx.send({method:"POST",
18
+ path:`${target}/versions`,body:{upload_key:uploadKey,file_name:requireResolved(input,"fileName")}}),"\u7248\u306E\u5DEE\u66FF\u3048");const current=after["current_version"];if(typeof current!=="number"||current<=previous){throw new ApiResponseError(`\u7248\u306E\u5DEE\u66FF\u3048\u306E\u5FDC\u7B54\u3067\u73FE\u884C\u7248\u304C\u9032\u3093\u3067\u3044\u307E\u305B\u3093\uFF08\u5DEE\u66FF\u3048\u524D ${previous} \u2192 \u5FDC\u7B54 ${String(current)}\uFF09\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)}
19
+ return{result:true,case_document:after}}})}var estimateCaseDocumentResource={name:"case-document",summary:"\u898B\u7A4D\u306E\u6848\u4EF6\u66F8\u985E\uFF08\u6CE8\u6587\u66F8\u30FB\u500B\u5225\u5951\u7D04\u66F8\u306A\u3069\u3002\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u767B\u9332\u30FB\u7248\u306E\u5DEE\u66FF\u3048\u30FB\u66F4\u65B0\u30FB\u524A\u9664\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\uFF09",operations:[{name:"list",summary:"\u898B\u7A4D\u306E\u6848\u4EF6\u66F8\u985E\u3092\u4E00\u89A7\u3059\u308B",
20
+ usage:"twp estimate case-document list --estimate <\u898B\u7A4DID>",description:`\u898B\u7A4D\u306B\u767B\u9332\u3055\u308C\u305F\u6848\u4EF6\u66F8\u985E\uFF08\u524A\u9664\u3057\u305F\u3082\u306E\u3092\u9664\u304F\uFF09\u3092\u3059\u3079\u3066\u8FD4\u3057\u307E\u3059\uFF08\u3053\u306E API \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3092\u6301\u3061\u307E\u305B\u3093\uFF09\u3002
21
+
22
+ --output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
23
+ --output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002`,flags:[ESTIMATE_FLAG],forbidden:VIEW_FORBIDDEN,plan(input){noArgs(input,"list");return{method:"GET",path:estimateBase(input,"list")}},summarize:body=>itemsOf(body).map(row=>pick(row,COLUMNS)),raw:itemsOf},{name:"get",summary:"\u6848\u4EF6\u66F8\u985E1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u73FE\u884C\u7248\u30FB\u904E\u53BB\u7248\u3092\u542B\u3080\uFF09",usage:"twp esti\
24
+ mate case-document get <\u66F8\u985EID> --estimate <\u898B\u7A4DID>",description:`${REF_HELP}
25
+
26
+ --output json \u306F\u73FE\u884C\u7248\u30FB\u904E\u53BB\u7248\uFF08versions\uFF09\u3092\u542B\u3080\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
27
+ --output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${COLUMNS.join(" / ")} / versions\uFF1D\u7248\u306E\u6570\uFF09\u3067\u3059\u3002
28
+ \u7248\u3054\u3068\u306E\u5217\u306F ${VERSION_COLUMNS.join(" / ")} \u3067\u3059\uFF08--output json\uFF09\u3002`,flags:[ESTIMATE_FLAG],forbidden:VIEW_FORBIDDEN,plan:input=>({method:"GET",path:docPath(input,"get")}),summarize:body=>summaryOf(body,"\u6848\u4EF6\u66F8\u985E"),raw:body=>docOf(body,"\u6848\u4EF6\u66F8\u985E")},{name:"create",summary:"\u30D5\u30A1\u30A4\u30EB\u3092\u898B\u7A4D\u306E\u6848\u4EF6\u66F8\u985E\u3068\u3057\u3066\u767B\u9332\u3059\u308B\uFF08\u5BB9\u91CF\u691C\u67FB\u30FB\u8EE2\u9001\u30FB\u767B\u9332\u30921\u30B3\u30DE\u30F3\u30C9\u3067\uFF09",
29
+ usage:"twp estimate case-document create --estimate <\u898B\u7A4DID> --file <\u30D1\u30B9> --type <\u7A2E\u5225> --name <\u66F8\u985E\u540D>",description:`--estimate\u30FB--file\u30FB--type\uFF08${DOCUMENT_TYPE_HELP}\uFF09\u30FB--name \u304C\u5FC5\u9808\u3067\u3059\u3002
30
+
31
+ \u6B21\u306E\u9806\u306B\u9001\u308A\u307E\u3059\u3002
32
+ 0. POST /api/v2/storage/check-upload\uFF08\u30C6\u30CA\u30F3\u30C8\u306E\u5BB9\u91CF\u691C\u67FB\u3002\u8D85\u904E\u306A\u3089\u4F55\u3082\u9001\u3089\u305A\u306B\u6B62\u307E\u308A\u307E\u3059\uFF09
33
+ 1. POST \u2026/case-documents/upload-url\uFF08\u7F72\u540DURL\u306E\u767A\u884C\uFF09
34
+ 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
35
+ 3. POST \u2026/case-documents\uFF08\u66F8\u985E\u306E\u767B\u9332\u3002\u3053\u3053\u3067\u6848\u4EF6\u66F8\u985E\u304C\u6210\u7ACB\u3057\u307E\u3059\uFF09
36
+ \u5BFE\u5FDC\u5916\u306E\u5F62\u5F0F\uFF08\u62E1\u5F35\u5B50\u304C PDF\u30FBJPEG\u30FBPNG\u30FBWord\u30FBExcel \u3067\u306A\u3044\u30FB\u4E2D\u8EAB\u304C\u62E1\u5F35\u5B50\u3068\u5408\u308F\u306A\u3044\uFF09\u306F\u3001\u4F55\u3082\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059
37
+ \uFF08\u30B5\u30FC\u30D0\u3082\u540C\u3058\u6761\u4EF6\u3067\u65AD\u308A\u307E\u3059\uFF09\u3002--dry-run \u306F 1 \u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\u3002
38
+ \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\uFF08\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002`,flags:[ESTIMATE_FLAG,FILE_FLAG,...createFlags(FIELDS)],forbidden:EDIT_FORBIDDEN,prepare(input){noArgs(input,"create");fieldBody(input,FIELDS);for(const flag of["--type","--name"]){if(!input.flags.has(flag))throw new UsageError(`${flag} \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,
39
+ usageOf("create"))}return prepareFile(input,"create")},plan:input=>uploadUrlPlan(input,"create"),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(input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3066\u304B\u3089\u3001POST ${estimateBase(input,"create")} \u3067\u6848\u4EF6\u66F8\u985E\u3092\u767B\u9332\u3057\u307E\u3059\u3002`],
40
+ execute:createDocument,summarize:body=>summaryOf(body,"\u6848\u4EF6\u66F8\u985E\u306E\u767B\u9332"),raw:body=>docOf(body,"\u6848\u4EF6\u66F8\u985E\u306E\u767B\u9332")},{name:"add-version",summary:"\u6848\u4EF6\u66F8\u985E\u306B\u65B0\u3057\u3044\u7248\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u767B\u9332\u3059\u308B\uFF08\u5DEE\u66FF\u3048\u3002\u904E\u53BB\u7248\u306F\u6B8B\u308A\u307E\u3059\uFF09",usage:"twp estimate case-document add-version <\u66F8\u985EID> --estimate <\u898B\u7A4DID> --file <\u30D1\u30B9>",
41
+ description:`${REF_HELP}
42
+
43
+ \u66F8\u985E\u304C\u3053\u306E\u898B\u7A4D\u306B\u3042\u308B\u3053\u3068\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\u3001\u5BB9\u91CF\u691C\u67FB \u2192 \u7F72\u540DURL\u306E\u767A\u884C \u2192 PUT \u2192 POST \u2026/{\u66F8\u985EID}/versions \u306E\u9806\u306B\u9001\u308A\u307E\u3059\u3002
44
+ \u767B\u9332\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u304C\u73FE\u884C\u7248\u306B\u306A\u308A\u3001\u305D\u308C\u307E\u3067\u306E\u7248\u306F\u904E\u53BB\u7248\u3068\u3057\u3066\u6B8B\u308A\u307E\u3059\uFF08get \u306E versions\uFF09\u3002
45
+ \u5FDC\u7B54\u3067\u73FE\u884C\u7248\u306E\u756A\u53F7\u304C\u9032\u3093\u3060\u3053\u3068\u3092\u78BA\u304B\u3081\u3066\u304B\u3089\u6210\u529F\u3092\u540D\u4E57\u308A\u307E\u3059\u3002--dry-run \u306F\u7F72\u540DURL\u306E\u767A\u884C\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\u3002
46
+ \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`,flags:[ESTIMATE_FLAG,FILE_FLAG],forbidden:EDIT_FORBIDDEN,prepare(input){docId(input,"add-version");return prepareFile(input,"add-version")},plan:input=>uploadUrlPlan(input,"add-version"),plannedNotes:input=>[`\u5B9F\u884C\u6642\u306F\u3001\u3053\u306E\u524D\u306B GET ${docPath(input,"add-version")}\uFF08\u66F8\u985E\u306E\u78BA\u8A8D\uFF09\u3068\u5BB9\u91CF\u691C\u67FB\u3092\u9001\u308A\u3001\u3053\u306E\u3042\u3068\u7F72\u540DURL\u3078 ${requireResolved(
47
+ input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3066\u304B\u3089\u3001POST ${docPath(input,"add-version")}/versions \u3067\u7248\u3092\u767B\u9332\u3057\u307E\u3059\u3002`],execute:addVersion,summarize:body=>summaryOf(body,"\u7248\u306E\u5DEE\u66FF\u3048"),raw:body=>docOf(body,"\u7248\u306E\u5DEE\u66FF\u3048")},{name:"update",summary:"\u6848\u4EF6\u66F8\u985E\u306E\u66F8\u985E\u540D\u30FB\u7A2E\u5225\u3092\u5909\u66F4\u3059\u308B\uFF08\u30D5\u30A1\u30A4\u30EB\u306F\u5909\u308F\u308A\u307E\u305B\u3093\uFF09",
48
+ usage:"twp estimate case-document update <\u66F8\u985EID> --estimate <\u898B\u7A4DID> [--name <\u66F8\u985E\u540D>] [--type <\u7A2E\u5225>]",description:`${REF_HELP}
49
+
50
+ \u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\u3092\u5909\u66F4\u3057\u307E\u3059\u3002\u5909\u66F4\u3059\u308B\u9805\u76EE\u30921\u3064\u3082\u6307\u5B9A\u3057\u306A\u3044\u3068\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u3059\u3002
51
+ \u30D5\u30A1\u30A4\u30EB\u3092\u5DEE\u3057\u66FF\u3048\u308B\u306A\u3089 twp estimate case-document add-version \u3092\u4F7F\u3044\u307E\u3059\u3002`,flags:[ESTIMATE_FLAG,...updateFlags(FIELDS)],forbidden:EDIT_FORBIDDEN,plan(input){if(!hasAnyField(input,FIELDS))throw new UsageError("\u5909\u66F4\u3059\u308B\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usageOf("update"));return{method:"PATCH",path:docPath(input,"update"),body:fieldBody(input,FIELDS)}},summarize:body=>summaryOf(
52
+ body,"\u6848\u4EF6\u66F8\u985E\u306E\u66F4\u65B0"),raw:body=>docOf(body,"\u6848\u4EF6\u66F8\u985E\u306E\u66F4\u65B0")},{name:"delete",summary:"\u6848\u4EF6\u66F8\u985E\u3092\u524A\u9664\u3059\u308B\uFF08\u5168\u7248\u3002\u9867\u5BA2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306E\u307F\u30FB--yes \u304C\u8981\u308B\uFF09",usage:"twp estimate case-document delete <\u66F8\u985EID> --estimate <\u898B\u7A4DID> --yes",description:`${REF_HELP}
53
+
54
+ \u66F8\u985E\u3092\u904E\u53BB\u7248\u3054\u3068\u524A\u9664\u3057\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u306F\u8AD6\u7406\u524A\u9664\u3067\u3001\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u304B\u3089\u6D88\u3048\u307E\u3059\uFF09\u3002`,destructive:true,flags:[ESTIMATE_FLAG],forbidden:childForbidden("\u6848\u4EF6\u66F8\u985E","delete"),plan:input=>({method:"DELETE",path:docPath(input,"delete")}),summarize:body=>acknowledgement(body,"\u6848\u4EF6\u66F8\u985E\u524A\u9664"),
55
+ raw:body=>acknowledgement(body,"\u6848\u4EF6\u66F8\u985E\u524A\u9664")},{name:"download",summary:"\u6848\u4EF6\u66F8\u985E\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u3078\u66F8\u304D\u51FA\u3059\uFF08\u65E2\u5B9A\u306F\u73FE\u884C\u7248\uFF09",usage:"twp estimate case-document download <\u66F8\u985EID> --estimate <\u898B\u7A4DID> --out <\u30D1\u30B9> [--rev <\u7248\u756A\u53F7>] [--force]",description:`${REF_HELP}
56
+
57
+ \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
58
+ \u904E\u53BB\u7248\u306F --rev \u3067\u7248\u756A\u53F7\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF08get \u306E versions \u306E version_number\uFF09\u3002`,flags:[ESTIMATE_FLAG,OUT_FLAG,REV_FLAG,FORCE_FLAG],forbidden:VIEW_FORBIDDEN,download:{outFlag:OUT_FLAG.name,forceFlag:FORCE_FLAG.name},plan:input=>({method:"GET",path:`${docPath(input,"download")}/download`,query:{version:revOf(input,usageOf("download"))}}),summarize:body=>body,raw:body=>body}]};export{inspectCaseDocumentFile,estimateCaseDocumentResource};
@@ -54,4 +54,4 @@ execute:list,summarize:body=>attachmentRows(body).map(row=>pick(row,LIST_COLUMNS
54
54
  --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`,flags:[FILE_FLAG,NAME_FLAG,CONTENT_TYPE_FLAG,TASK_REF_FLAG,PROJECT_FLAG],async prepare(input,ctx){const local=localFile(input);const resolved=await resolveTask(input,ctx,"twp task attachment upload help");return withResolved(resolved,{file:local.file,fileName:local.name,fileSize:String(local.size),
55
55
  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(input,"fileSize")} \u30D0\u30A4\u30C8\u3092 PUT \u3057\u3001\u30BF\u30B9\u30AF\u306E attachment_ids \u306B\u8FFD\u52A0\u3057\u3066 PUT \u3057\u307E\u3059\u3002`],execute:upload,summarize:body=>pick(body,UPLOAD_COLUMNS),
56
56
  raw:body=>body},{name:"download",summary:"\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u30D5\u30A1\u30A4\u30EB\u3078\u66F8\u304D\u51FA\u3059",usage:"twp task attachment download <\u6DFB\u4ED8ID> --out <\u30D1\u30B9> [--force]",description:"\u6DFB\u4ED8 ID \u306F twp task attachment list \u306E id \u3067\u3059\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",
57
- flags:[ATTACHMENT_REF_FLAG,OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force"},plan(input){const id=singleRef(input,{flag:"--attachment",label:"\u6DFB\u4ED8ID",usage:"twp task attachment download help"});if(!isSafePathSegment(id))throw new UsageError(`\u6DFB\u4ED8ID \u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${id}`);return{method:"GET",path:`/api/v2/attachments/${encodeURIComponent(id)}/download`}},summarize:body=>body,raw:body=>body}]};export{classifyTaskRef,wantsPrivateSurface,taskSurface,rejectPrivateSurface,resolveTaskLocation,rejectRedundantProject,TASK_REF_FLAG,PROJECT_FLAG,TASK_REF_HELP,contentTypeFor,inspectLocalFile,issued,taskAttachmentResource};
57
+ flags:[ATTACHMENT_REF_FLAG,OUT_FLAG,FORCE_FLAG],download:{outFlag:"--out",forceFlag:"--force"},plan(input){const id=singleRef(input,{flag:"--attachment",label:"\u6DFB\u4ED8ID",usage:"twp task attachment download help"});if(!isSafePathSegment(id))throw new UsageError(`\u6DFB\u4ED8ID \u306E\u5F62\u5F0F\u304C\u9055\u3044\u307E\u3059: ${id}`);return{method:"GET",path:`/api/v2/attachments/${encodeURIComponent(id)}/download`}},summarize:body=>body,raw:body=>body}]};export{classifyTaskRef,wantsPrivateSurface,taskSurface,rejectPrivateSurface,resolveTaskLocation,rejectRedundantProject,TASK_REF_FLAG,PROJECT_FLAG,TASK_REF_HELP,contentTypeFor,attachmentRows,inspectLocalFile,issued,taskAttachmentResource};