@tocca-systems/twp-cli 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.public.md +6 -0
- package/README.md +35 -7
- package/dist/{api-command-AHVUUK3I.js → api-command-YUZFGC2W.js} +2 -2
- package/dist/{app-JPJHLNTW.js → app-NIJ3MAGU.js} +3 -3
- package/dist/{auto-update-worker-73HBKKVT.js → auto-update-worker-Y44TD6FD.js} +1 -1
- package/dist/{backlog-NS2V3WKG.js → backlog-2VHFVU5C.js} +1 -1
- package/dist/{chunk-WQRWQ7IM.js → chunk-DBIDYOKW.js} +1 -1
- package/dist/{chunk-FII7YYYZ.js → chunk-DCGL7XJF.js} +1 -1
- package/dist/{chunk-N4ZW4IVU.js → chunk-HAIZHSNZ.js} +2 -2
- package/dist/{chunk-7CQKNDAE.js → chunk-IF2K4PM5.js} +1 -1
- package/dist/chunk-MQ3WFH54.js +141 -0
- package/dist/{chunk-Z7GNYWCU.js → chunk-PLBOUQE7.js} +1 -1
- package/dist/{chunk-77DFFCZF.js → chunk-PWXXCLVZ.js} +1 -1
- package/dist/{chunk-U6RXDDAB.js → chunk-R5HF6LTR.js} +9 -9
- package/dist/{chunk-DU42VCON.js → chunk-REPGG75N.js} +1 -1
- package/dist/{chunk-EVR3OFVS.js → chunk-VECUCVIY.js} +8 -8
- package/dist/chunk-XNW2UNWQ.js +6 -0
- package/dist/cli.js +61 -8
- package/dist/{commands-RQQN7TXW.js → commands-OABOHHNC.js} +1 -1
- package/dist/company-6HMFGVPJ.js +161 -0
- package/dist/{department-XRIBRAQE.js → department-DH5YABBF.js} +1 -1
- package/dist/{inquiry-LOH3OKG3.js → inquiry-67OW3HBZ.js} +1 -1
- package/dist/{job-title-EMRVK4RO.js → job-title-YEIANJNC.js} +1 -1
- package/dist/{leave-BGDVEHQ7.js → leave-XXDCHUGK.js} +1 -1
- package/dist/{media-OQRJYMJT.js → media-NZD6J7KE.js} +4 -5
- package/dist/{notification-4DFO464P.js → notification-BQ4ODX6U.js} +1 -1
- package/dist/{oneshot-QLTXLUSM.js → oneshot-GCQYYNIH.js} +1 -1
- package/dist/{position-3NRFWS3E.js → position-WR5YODDU.js} +1 -1
- package/dist/{prospect-7L2UUNY3.js → prospect-YZUHE7PL.js} +3 -3
- package/dist/{registry-XL6Z2QCB.js → registry-3O2KBG5I.js} +1 -1
- package/dist/{report-YIOEMKUU.js → report-SGAVGU4G.js} +1 -1
- package/dist/{run-N5EIN5WQ.js → run-WXHHCFT7.js} +1 -1
- package/dist/{sales-7DTKXDMD.js → sales-OFEVE2PG.js} +1 -1
- package/dist/{task-CBJOR2GF.js → task-IE7DNU34.js} +2 -2
- package/dist/{update-3D2CMAIV.js → update-MAQJ6VWV.js} +1 -1
- package/dist/{user-TNGMHVOJ.js → user-UJIB3SCU.js} +1 -1
- package/dist/{workflow-XDGT7L6G.js → workflow-QWVZH4NG.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-A2MX47LP.js +0 -85
- package/dist/chunk-IWIGE7U4.js +0 -6
- package/dist/company-4O3HA6A2.js +0 -26
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{renderOutput}from"./chunk-6NEQ6PZZ.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-BUZKNZ45.js";import{loadDomain}from"./chunk-
|
|
3
|
+
import{renderOutput}from"./chunk-6NEQ6PZZ.js";import{redactSecretValues,redactSecrets,withDebug}from"./chunk-BUZKNZ45.js";import{loadDomain}from"./chunk-XNW2UNWQ.js";import{evaluateQuery}from"./chunk-GDM2QUBL.js";import{parseOperationArgs}from"./chunk-IOGVQVGD.js";import{Resolver,requireDefaultProject}from"./chunk-DBIDYOKW.js";import{ApiError,MultipartBody,TwpApiClient,appendQuery}from"./chunk-IF2K4PM5.js";import{ResolveError}from"./chunk-GMBJTG6A.js";
|
|
4
4
|
import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{AuthSession,NotLoggedInError,SessionExpiredError,loadCredentials}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,loadUserConfig,resolveConfiguredOutput,resolveProfile}from"./chunk-4VZKNEVN.js";import{HELP_TOKEN}from"./chunk-523KROGI.js";import{OUTPUT_FORMATS,resolveOutputFormat}from"./chunk-K2ONOH3L.js";import{stringWidth}from"./chunk-WVS4W5FY.js";import{
|
|
5
5
|
stripTerminalControls}from"./chunk-NHYMHCAT.js";import{DEFAULT_MAX_ITEMS,DEFAULT_MAX_PAGES,nextPageNotes,positiveInteger,shellQuote}from"./chunk-R53CMVWR.js";import{ApiRejectedError,ApiResponseError,EXIT_API_CLIENT,EXIT_API_SERVER,EXIT_AUTH,EXIT_FAILURE,EXIT_OK,EXIT_USAGE,NetworkError,UsageError}from"./chunk-7WSNIXTQ.js";import fs from"fs";import path from"path";var NO_REDACT_FLAG={name:"--no-redact",summary:"\u5FDC\u7B54\u306E\u4F0F\u5B57\u5316\u3092\u89E3\u9664\u3057\u3066\u751F\u306E\u5024\u3092\u51FA\u3059\uFF08\u9375\u306E\u53D7\u3051\u53D6\u308A\u7B49\uFF09",takesValue:false};var NO_REDACT_NOTICE="\u6CE8\u8A18: --no-redact \u306E\u305F\u3081\u51FA\u529B\u3092\u4F0F\u5B57\u5316\u3057\u307E\u305B\u3093\uFF08\u7AEF\u672B\u3068\u30ED\u30B0\u306B\u5E73\u6587\u3067\u6B8B\u308A\u307E\u3059\uFF09\u3002";function withCommonFlags(flags){return flags.some(flag=>flag.
|
|
6
6
|
name===NO_REDACT_FLAG.name)?flags:[...flags,NO_REDACT_FLAG]}function alignedList(entries,indent=" "){const width=entries.reduce((max,[left])=>Math.max(max,stringWidth(left)),0);return entries.map(([left,right])=>`${indent}${left}${" ".repeat(Math.max(0,width-stringWidth(left)))} ${right}`).join("\n")}function subresourcesOf(resource){return resource.subresources??[]}function renderResourceHelp(resource,path2){const subresources=subresourcesOf(resource);const operationSection=resource.operations.length===0?"":`
|
|
@@ -31,11 +31,11 @@ status}\uFF09`)}return{bytes:new Uint8Array(await res.arrayBuffer()),contentType
|
|
|
31
31
|
return{out:path.resolve(raw.trim()),force:input.flags.has(spec.forceFlag)}}function assertWritableTarget(target,forceFlag){if(!target.force&&fs.existsSync(target.out)){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308A\u307E\u3059: ${target.out}`,`\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 ${forceFlag} \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\uFF09\u3002`)}const dir=path.dirname(target.
|
|
32
32
|
out);if(!fs.existsSync(dir)){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u3042\u308A\u307E\u305B\u3093: ${dir}`,"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u4F5C\u3063\u3066\u304B\u3089\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u81EA\u52D5\u3067\u306F\u4F5C\u6210\u3057\u307E\u305B\u3093\uFF09\u3002")}}async function download(args){let received;if(args.signed!==void 0){const url=args.signed.signedUrl(await send(args.client,args.
|
|
33
33
|
apiUrl,args.plan),args.plan);received=await getSigned(args.signed.fetchImpl,url)}else{try{received=await args.client.requestBinary(args.plan.method,appendQuery(args.plan.path,args.plan.query))}catch(err){if(err instanceof ApiError||err instanceof NotLoggedInError||err instanceof SessionExpiredError)throw err;throw new NetworkError(`${args.apiUrl} \u3078\u306E\u901A\u4FE1\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${err.message}`,{cause:err})}}try{fs.writeFileSync(args.target.out,received.bytes,{
|
|
34
|
-
flag:args.target.force?"w":"wx"})}catch(err){const code=err.code;if(code==="EEXIST"){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308A\u307E\u3059: ${args.target.out}`,"\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 --force \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002")}throw new Error(`\u66F8\u304D\u51FA\u3057\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${args.target.out}\uFF09: ${err.message}`,{cause:err})}
|
|
35
|
-
byteLength,contentType:received.contentType}}var CURATED_PAGING_VOCABULARY={mode:"--all",resumeFlag:"--cursor",capAdvice:"--limit \u3092\u5927\u304D\u304F\u3057\u3066\u5F80\u5FA9\u3092\u6E1B\u3089\u3059\u304B\u3001--max-pages / --max-items \u3092\u4E0A\u3052\u3066\u304F\u3060\u3055\u3044\u3002"};function capExceeded(vocabulary,reason,pages,count,cursor){
|
|
36
|
-
\uFF0F${pages} \u30DA\u30FC\u30B8\u30FB${count} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`,`${vocabulary.capAdvice}\u7D9A\u304D\u3060\u3051\u3092\u53D6\u308B\u306A\u3089 ${vocabulary.resumeFlag} ${shellQuote(cursor)} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059`)}
|
|
37
|
-
const first=args.plan.query?.[paging.cursorParam];let sent=typeof first==="string"?first:"";for(let page=1;;page+=1){const plan=page===1?args.plan:{...args.plan,query:{...args.plan.query,[paging.cursorParam]:sent}};let body;try{body=page===1&&"firstPage"in args?args.firstPage:await send(args.client,args.apiUrl,plan)}catch(err){if(page>1){(args.warn??
|
|
38
|
-
length} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u7D9A\u304D\u306F ${vocabulary.resumeFlag} ${shellQuote(stripTerminalControls(sent))} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059\u3002
|
|
34
|
+
flag:args.target.force?"w":"wx"})}catch(err){const code=err.code;if(code==="EEXIST"){throw new UsageError(`\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308A\u307E\u3059: ${args.target.out}`,"\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 --force \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002")}throw new Error(`\u66F8\u304D\u51FA\u3057\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${args.target.out}\uFF09: ${err.message}`,{cause:err})}const captured={};for(const name of args.captureHeaders??
|
|
35
|
+
[]){const value=received.headers?.get(name);if(typeof value==="string")captured[name]=value}return{path:args.target.out,size:received.bytes.byteLength,contentType:received.contentType,...Object.keys(captured).length>0?{headers:captured}:{}}}var CURATED_PAGING_VOCABULARY={mode:"--all",resumeFlag:"--cursor",capAdvice:"--limit \u3092\u5927\u304D\u304F\u3057\u3066\u5F80\u5FA9\u3092\u6E1B\u3089\u3059\u304B\u3001--max-pages / --max-items \u3092\u4E0A\u3052\u3066\u304F\u3060\u3055\u3044\u3002"};function capExceeded(vocabulary,reason,pages,count,cursor){
|
|
36
|
+
return new UsageError(`${vocabulary.mode} \u304C\u4E0A\u9650\u306B\u9054\u3057\u305F\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\uFF08${reason}\uFF0F${pages} \u30DA\u30FC\u30B8\u30FB${count} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`,`${vocabulary.capAdvice}\u7D9A\u304D\u3060\u3051\u3092\u53D6\u308B\u306A\u3089 ${vocabulary.resumeFlag} ${shellQuote(cursor)} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059`)}
|
|
37
|
+
async function fetchAllPages(args){const{paging,maxPages,maxItems}=args;const vocabulary=args.vocabulary??CURATED_PAGING_VOCABULARY;const merged=[];const first=args.plan.query?.[paging.cursorParam];let sent=typeof first==="string"?first:"";for(let page=1;;page+=1){const plan=page===1?args.plan:{...args.plan,query:{...args.plan.query,[paging.cursorParam]:sent}};let body;try{body=page===1&&"firstPage"in args?args.firstPage:await send(args.client,args.apiUrl,plan)}catch(err){if(page>1){(args.warn??
|
|
38
|
+
writeErr)(`${vocabulary.mode} \u306F ${page} \u30DA\u30FC\u30B8\u76EE\u3067\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${page-1} \u30DA\u30FC\u30B8\u30FB${merged.length} \u4EF6\u3092\u53D6\u5F97\u6E08\u307F\uFF09\u3002\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u7D9A\u304D\u306F ${vocabulary.resumeFlag} ${shellQuote(stripTerminalControls(sent))} \u304B\u3089\u518D\u958B\u3067\u304D\u307E\u3059\u3002
|
|
39
39
|
`)}throw err}for(const item of paging.items(body))merged.push(item);const next=paging.nextCursor(body);if(next===null)return{body:paging.withItems(body,merged),pages:page,count:merged.length};if(merged.length>=maxItems)throw capExceeded(vocabulary,`\u6700\u5927\u4EF6\u6570 ${maxItems} \u4EF6`,page,merged.length,next);if(page>=maxPages)throw capExceeded(vocabulary,`\u6700\u5927\u30DA\u30FC\u30B8\u6570 ${maxPages}`,page,merged.length,next);if(next===sent){throw new ApiResponseError(`\u540C\u3058\u30AB\u30FC\u30BD\u30EB\uFF08${next}\
|
|
40
40
|
\uFF09\u304C\u7E70\u308A\u8FD4\u3057\u8FD4\u3055\u308C\u305F\u305F\u3081\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002${merged.length} \u4EF6\u3092\u53D6\u5F97\u3057\u305F\u6642\u70B9\u3067\u3001\u3053\u308C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`)}sent=next}}function resolvePaging(operation,path2,input){const all=input.flags.has("--all");const maxPages=positiveInteger(input.flags,"--max-pages")??DEFAULT_MAX_PAGES;const maxItems=positiveInteger(input.flags,"--max-items")??
|
|
41
41
|
DEFAULT_MAX_ITEMS;positiveInteger(input.flags,"--limit");if(all&&operation.paging===void 0){throw new UsageError(`twp ${path2} ${operation.name} \u306F --all \u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093`)}for(const name of["--max-pages","--max-items"]){if(!all&&input.flags.has(name)){throw new UsageError(`${name} \u306F --all \u3068\u4F75\u305B\u3066\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,`${name} \u3060\u3051\u3067\u306F\u4F55\u3082\u5909\u308F\u308A\u307E\u305B\u3093`)}}return{
|
|
@@ -51,9 +51,9 @@ session,fetchImpl,options.version);const ctx=buildPrepareContext({resolver:new R
|
|
|
51
51
|
void 0&&(operation.download!==void 0||operation.paging!==void 0||operation.destructive===true||plan.method!=="GET")){throw new Error(`twp ${path2} ${operation.name}: fetchCached \u306F\u9001\u4FE1\u3057\u306A\u3044\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u306E\u64CD\u4F5C\u306B\u3060\u3051\u5BA3\u8A00\u3067\u304D\u307E\u3059\uFF08\u914D\u7DDA\u306E\u8AA4\u308A\uFF09`)}for(const note of operation.plannedNotes?.(prepared)??[])errOut(`${safeText(note)}
|
|
52
52
|
`);if(noRedact)errOut(`${NO_REDACT_NOTICE}
|
|
53
53
|
`);if(globals.dryRun){out(line(renderOutput(dryRunValue(apiUrl,plan),format,noRedact)));return EXIT_OK}let body;let paged;try{if(operation.execute!==void 0){const executeCtx={send:next=>send(client,apiUrl,next),putSigned:(url,bytes,contentType)=>putSigned(fetchImpl,url,bytes,contentType),warn:text=>errOut(`${safeText(text)}
|
|
54
|
-
`)};body=await operation.execute(prepared,executeCtx)}else if(operation.fetchCached!==void 0){body=await operation.fetchCached(prepared,ctx)}else if(operation.download!==void 0&&downloadTarget!==void 0){assertWritableTarget(downloadTarget,operation.download.forceFlag);const signedUrl=operation.download.signedUrl;body=await download({client,apiUrl,plan,target:downloadTarget,...signedUrl===void 0?{}:{signed:{fetchImpl,signedUrl}}
|
|
55
|
-
{client,apiUrl,plan,paging:operation.paging,maxPages:paging.maxPages,maxItems:paging.maxItems,warn:errOut});body=paged.body}else{body=await send(client,apiUrl,plan)}}finally{try{operation.invalidates?.(prepared,ctx)}catch{}}const visible=noRedact?body:redactSecretValues(body);const value=globals.query!==void 0?await evaluateQuery(globals.query,operation.raw(visible)):outputValue(operation,format,visible);
|
|
56
|
-
\u30DA\u30FC\u30B8\u3092\u8FBF\u3063\u3066 ${paged.count} \u4EF6\u3092\u53D6\u5F97\u3057\u307E\u3057\u305F\u3002
|
|
54
|
+
`)};body=await operation.execute(prepared,executeCtx)}else if(operation.fetchCached!==void 0){body=await operation.fetchCached(prepared,ctx)}else if(operation.download!==void 0&&downloadTarget!==void 0){assertWritableTarget(downloadTarget,operation.download.forceFlag);const signedUrl=operation.download.signedUrl;body=await download({client,apiUrl,plan,target:downloadTarget,...signedUrl===void 0?{}:{signed:{fetchImpl,signedUrl}},...operation.download.captureHeaders===void 0?{}:{captureHeaders:operation.
|
|
55
|
+
download.captureHeaders}})}else if(paging.all&&operation.paging!==void 0){paged=await fetchAllPages({client,apiUrl,plan,paging:operation.paging,maxPages:paging.maxPages,maxItems:paging.maxItems,warn:errOut});body=paged.body}else{body=await send(client,apiUrl,plan)}}finally{try{operation.invalidates?.(prepared,ctx)}catch{}}const visible=noRedact?body:redactSecretValues(body);const value=globals.query!==void 0?await evaluateQuery(globals.query,operation.raw(visible)):outputValue(operation,format,visible);
|
|
56
|
+
out(line(renderOutput(value,format,noRedact)));if(paged!==void 0){errOut(`--all: ${paged.pages} \u30DA\u30FC\u30B8\u3092\u8FBF\u3063\u3066 ${paged.count} \u4EF6\u3092\u53D6\u5F97\u3057\u307E\u3057\u305F\u3002
|
|
57
57
|
`)}const pagingNotes=operation.paging===void 0?[]:nextPageNotes(body,prepared,{command:`twp ${path2} ${operation.name}`,flags:operation.flags,profile:globals.profile,readCursor:operation.paging.readCursor});for(const note of[...pagingNotes,...operation.notes?.(visible,prepared)??[]]){errOut(`${safeText(note)}
|
|
58
58
|
`)}return EXIT_OK}catch(caught){const err=withRejectedGuidance(withForbiddenGuidance(caught,forbidden),rejected);const code=exitCodeFor(err);reportError(err,format,code,errOut);return code}}function withForbiddenGuidance(err,forbidden){if(forbidden===void 0||!(err instanceof ApiError)||err.status!==403)return err;const guidance=typeof forbidden==="function"?forbidden(err.body):forbidden;if(guidance===void 0)return err;const server=err.body?.error_description??err.body?.message;const wrapped=new ApiError(
|
|
59
59
|
err.status,err.body,"","");wrapped.message=server!==void 0&&server!==""?`${guidance}\uFF08\u30B5\u30FC\u30D0\u306E\u5FDC\u7B54: ${server}\uFF09`:guidance;return wrapped}function withRejectedGuidance(err,guidance){if(guidance===void 0||!(err instanceof ApiError)||err.status!==422)return err;const description=err.body?.error_description;const fallback=err.body?.message;const server=(typeof description==="string"&&description!==""?description:void 0)??(typeof fallback==="string"?fallback:"");const extra=guidance(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{createRuntime}from"./chunk-
|
|
3
|
+
import{createRuntime}from"./chunk-PWXXCLVZ.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{describeAutoUpdate}from"./chunk-2NKVGAAE.js";import{PACKAGE_NAME,UPDATE_COMMAND,compareVersionCores,isBelowMinSupported,parseVersionCore}from"./chunk-DXXFUNYN.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import{findExecutable}from"./chunk-PMOUHEJQ.js";import{execFile}from"child_process";import fs from"fs";import path from"path";function resolveNpmCommand(deps={}){const platform=deps.platform??process.platform;const env=deps.env??process.env;const npmPath=(deps.find??(name=>findExecutable(name,{env,platform})))("npm");if(npmPath===null)return null;if(platform!=="win32")return{file:npmPath,prefix:[]};if(/\.exe$/i.test(npmPath))return{file:npmPath,prefix:[]};const cliJs=path.win32.join(path.win32.dirname(npmPath),"node_modules","npm","bin","npm-cli.js");return(deps.exists??fs.existsSync)(cliJs)?{file:deps.nodePath??process.
|
|
4
4
|
execPath,prefix:[cliJs]}:null}var DEFAULT_REGISTRY="https://registry.npmjs.org";function registryBase(env=process.env){const configured=env["npm_config_registry"]?.trim();if(configured===void 0||configured==="")return DEFAULT_REGISTRY;try{const url=new URL(configured);if(url.protocol!=="https:"&&url.protocol!=="http:")return DEFAULT_REGISTRY}catch{return DEFAULT_REGISTRY}return configured.replace(/\/+$/,"")}async function fetchFromRegistry(fetchImpl=httpFetch,env=process.env){const url=`${registryBase(env)}/${PACKAGE_NAME.replace(
|
|
5
5
|
"/","%2f")}`;const res=await fetchImpl(url,{headers:{Accept:"application/vnd.npm.install-v1+json"},signal:AbortSignal.timeout(5e3)});if(!res.ok){throw new Error(`registry \u304C ${res.status} \u3092\u8FD4\u3057\u307E\u3057\u305F`)}const body=await res.json();const latest=body["dist-tags"]?.latest;if(typeof latest!=="string"||parseVersionCore(latest)===null){throw new Error("registry \u306E\u5FDC\u7B54\u306B dist-tags.latest \u304C\u3042\u308A\u307E\u305B\u3093")}return{version:latest.trim(),source:"\
|
|
6
6
|
registry"}}async function fetchFromNpmCli(){const npm=resolveNpmCommand();if(npm===null){throw new Error("npm \u304C PATH \u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093")}const stdout=await new Promise((resolve,reject)=>{execFile(npm.file,[...npm.prefix,"view",PACKAGE_NAME,"version","--json"],{timeout:15e3,windowsHide:true},(error,out)=>error?reject(error):resolve(out))});const parsed=JSON.parse(stdout.trim());const latest=typeof parsed==="string"?parsed:null;if(latest===null||parseVersionCore(
|
|
@@ -29,13 +29,13 @@ takesValue:true,placeholder:"<\u578B>"};var OUT_FLAG={name:"--out",summary:"\u66
|
|
|
29
29
|
<\u6DFB\u4ED8ID>"};var FORCE_FLAG={name:"--force",summary:"\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308C\u3070\u4E0A\u66F8\u304D\u3059\u308B\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u306A\u3044\uFF09",takesValue:false};function taskPath(input){const projectId=encodeURIComponent(requireResolved(input,"projectId"));return`/api/v2/projects/${projectId}/tasks/${encodeURIComponent(requireResolved(input,"taskId"))}`}function taskAttachmentIds(body){const task=isRecord(body)?
|
|
30
30
|
body["task"]:void 0;if(!isRecord(task)){throw new ApiResponseError("\u30BF\u30B9\u30AF\u8A73\u7D30\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")}const ids=task["attachment_ids"];if(ids===null||ids===void 0)return[];if(!Array.isArray(ids)||!ids.every(id=>typeof id==="string")){throw new ApiResponseError("\u30BF\u30B9\u30AF\u8A73\u7D30\u306E attachment_ids \u304C\u6587\u5B57\u5217\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
31
31
|
return ids}function attachmentRows(body){const data=isRecord(body)?body["data"]:void 0;if(!Array.isArray(data)){throw new ApiResponseError("\u6DFB\u4ED8\u4E00\u89A7\u306E\u5FDC\u7B54\u306B data \u914D\u5217\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return data}async function resolveTask(input,ctx,usage){const ref=singleRef(input,{flag:"--task",label:"\u30BF\u30B9\u30AF",usage});return withResolved(input,await resolveTaskLocation(
|
|
32
|
-
input,ctx,ref))}function localFile(input){const
|
|
33
|
-
if(
|
|
34
|
-
return{method:"POST",path:"/api/v2/attachments/upload-url",body:{file_name:requireResolved(input,"fileName"),content_type:requireResolved(input,"contentType"),file_size:Number(requireResolved(input,"fileSize")),source:TASK_SOURCE}}}function issued(body){const data=isRecord(body)?body["data"]:void 0;const id=isRecord(data)?data["id"]:void 0;const uploadUrl=isRecord(data)?data["
|
|
35
|
-
"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B data.id / data.upload_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{id,uploadUrl}}async function upload(input,ctx){const file=requireResolved(input,"file");const size=Number(requireResolved(input,"
|
|
36
|
-
uploadUrlPlan(input)));const bytes=new Uint8Array(fs.readFileSync(file));if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}await ctx.putSigned(uploadUrl,
|
|
37
|
-
id)?current:[...current,id];const updated=await ctx.send({method:"PUT",path:taskPath(input),body:{attachment_ids:next}});const linked=taskAttachmentIds(updated);if(!linked.includes(id)){throw new ApiResponseError("\u30BF\u30B9\u30AF\u66F4\u65B0\u306E\u5FDC\u7B54\u306E attachment_ids \u306B\u4ECA\u56DE\u306E\u6DFB\u4ED8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
38
|
-
|
|
32
|
+
input,ctx,ref))}function localFile(input){const{file,size}=inspectLocalFile(input.flags.get("--file"),"--file","twp task attachment upload <\u30AD\u30FC|ID> --file <\u30D1\u30B9>");const nameFlag=input.flags.get("--name");const name=nameFlag!==void 0&&nameFlag.trim()!==""?nameFlag.trim():path.basename(file);const typeFlag=input.flags.get("--content-type");const contentType=typeFlag!==void 0&&typeFlag.trim()!==""?typeFlag.trim():contentTypeFor(name);return{file,name,size,contentType}}function inspectLocalFile(raw,flag,usage){
|
|
33
|
+
if(raw===void 0||raw.trim()===""){throw new UsageError(`${flag} \u306F\u5FC5\u9808\u3067\u3059`,usage)}const file=path.resolve(raw.trim());let stat;try{stat=fs.statSync(file)}catch{throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093\uFF08${flag}\uFF09: ${file}`)}if(!stat.isFile())throw new UsageError(`\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08${flag}\uFF09: ${file}`);if(stat.size===0)throw new UsageError(`\u7A7A\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30A2\u30C3\u30D7\u30ED\u30FC\
|
|
34
|
+
\u30C9\u3067\u304D\u307E\u305B\u3093\uFF08${flag}\uFF09: ${file}`);return{file,size:stat.size}}function uploadUrlPlan(input){return{method:"POST",path:"/api/v2/attachments/upload-url",body:{file_name:requireResolved(input,"fileName"),content_type:requireResolved(input,"contentType"),file_size:Number(requireResolved(input,"fileSize")),source:TASK_SOURCE}}}function issued(body){const data=isRecord(body)?body["data"]:void 0;const id=isRecord(data)?data["id"]:void 0;const uploadUrl=isRecord(data)?data["\
|
|
35
|
+
upload_url"]:void 0;if(!isSafePathSegment(id)||typeof uploadUrl!=="string"||!/^https:\/\//.test(uploadUrl)){throw new ApiResponseError("\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B data.id / data.upload_url \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{id,uploadUrl}}async function upload(input,ctx){const file=requireResolved(input,"file");const size=Number(requireResolved(input,"fil\
|
|
36
|
+
eSize"));const contentType=requireResolved(input,"contentType");await checkUploadQuota(ctx,size);const{id,uploadUrl}=issued(await ctx.send(uploadUrlPlan(input)));const bytes=new Uint8Array(fs.readFileSync(file));if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}await ctx.putSigned(uploadUrl,
|
|
37
|
+
bytes,contentType);try{const current=taskAttachmentIds(await ctx.send({method:"GET",path:taskPath(input)}));const next=current.includes(id)?current:[...current,id];const updated=await ctx.send({method:"PUT",path:taskPath(input),body:{attachment_ids:next}});const linked=taskAttachmentIds(updated);if(!linked.includes(id)){throw new ApiResponseError("\u30BF\u30B9\u30AF\u66F4\u65B0\u306E\u5FDC\u7B54\u306E attachment_ids \u306B\u4ECA\u56DE\u306E\u6DFB\u4ED8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}
|
|
38
|
+
return{attachment_id:id,task_id:requireResolved(input,"taskId"),project_id:requireResolved(input,"projectId"),file_name:requireResolved(input,"fileName"),content_type:contentType,file_size:size,attachment_count:linked.length}}catch(err){ctx.warn(`\u6DFB\u4ED8 ${id} \u306F\u30B9\u30C8\u30EC\u30FC\u30B8\u3078\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u307E\u3067\u5B8C\u4E86\u3057\u307E\u3057\u305F\u304C\u3001\u30BF\u30B9\u30AF\u3078\u306E\u7D10\u3065\u3051\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
|
|
39
39
|
\u672A\u7D10\u3065\u3051\u306E\u6DFB\u4ED8\u306F\u30B5\u30FC\u30D0\u304C\u4E00\u5B9A\u6642\u9593\uFF08\u7F72\u540DURL\u306E\u6709\u52B9\u671F\u9650\uFF0B1\u6642\u9593\uFF09\u5F8C\u306B\u81EA\u52D5\u3067\u524A\u9664\u3057\u307E\u3059\u3002\u3082\u3046\u4E00\u5EA6 twp task attachment upload \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);throw err}}async function list(input,ctx){const ids=taskAttachmentIds(await ctx.send({method:"GET",path:taskPath(input)}));const rows=[];for(let offset=0;offset<
|
|
40
40
|
ids.length;offset+=IDS_PER_REQUEST){const chunk=ids.slice(offset,offset+IDS_PER_REQUEST);rows.push(...attachmentRows(await ctx.send({method:"GET",path:"/api/v2/attachments",query:{ids:chunk.join(",")}})))}if(rows.length<ids.length){ctx.warn(`\u30BF\u30B9\u30AF\u306B\u7D10\u3065\u304F\u6DFB\u4ED8 ${ids.length} \u4EF6\u306E\u3046\u3061 ${ids.length-rows.length} \u4EF6\u306F\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u524A\u9664\u6E08\u307F\u304B\u3001\u95B2\u89A7\u3067\u304D\u307E\u305B\u3093\uFF09\u3002`)}
|
|
41
41
|
return{data:rows}}var taskAttachmentResource={name:"attachment",summary:"\u30BF\u30B9\u30AF\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u30FB\u4E00\u89A7\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\uFF09",operations:[{name:"list",summary:"\u30BF\u30B9\u30AF\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u3059\u308B",usage:"twp task attachment list <\u30AD\u30FC|ID> [--project <\u30B3\u30FC\u30C9|ID>]",description:`${TASK_REF_HELP}
|
|
@@ -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,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,inspectLocalFile,issued,taskAttachmentResource};
|
|
@@ -0,0 +1,6 @@
|
|
|
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-SP2UKXIG.js")).agentLoopDomain,attendance:async()=>(await import("./attendance-LM3Q4TAU.js")).attendanceDomain,backlog:async()=>(await import("./backlog-2VHFVU5C.js")).backlogDomain,company:async()=>(await import("./company-6HMFGVPJ.js")).companyDomain,customer:async()=>(await import("./company-6HMFGVPJ.js")).customerDomain,department:async()=>(await import("./department-DH5YABBF.js")).departmentDomain,estimate:async()=>(await import("./sales-OFEVE2PG.js")).
|
|
4
|
+
estimateDomain,inquiry:async()=>(await import("./inquiry-67OW3HBZ.js")).inquiryDomain,invoice:async()=>(await import("./sales-OFEVE2PG.js")).invoiceDomain,"job-title":async()=>(await import("./job-title-YEIANJNC.js")).jobTitleDomain,leave:async()=>(await import("./leave-XXDCHUGK.js")).leaveDomain,media:async()=>(await import("./media-NZD6J7KE.js")).mediaDomain,notification:async()=>(await import("./notification-BQ4ODX6U.js")).notificationDomain,position:async()=>(await import("./position-WR5YODDU.js")).
|
|
5
|
+
positionDomain,project:async()=>(await import("./project-ROLQ535L.js")).projectDomain,prospect:async()=>(await import("./prospect-YZUHE7PL.js")).prospectDomain,report:async()=>(await import("./report-SGAVGU4G.js")).reportDomain,shift:async()=>(await import("./attendance-lists-PR6NQDQB.js")).shiftDomain,storage:async()=>(await import("./storage-ANKKJJJO.js")).storageDomain,task:async()=>(await import("./task-IE7DNU34.js")).taskDomain,user:async()=>(await import("./user-UJIB3SCU.js")).
|
|
6
|
+
userDomain,workchange:async()=>(await import("./attendance-lists-PR6NQDQB.js")).workchangeDomain,workflow:async()=>(await import("./workflow-QWVZH4NG.js")).workflowDomain};async function loadDomain(name){return LOADERS[name]()}export{loadDomain};
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
3
3
|
const require = __twpCreateRequire(import.meta.url);
|
|
4
|
-
import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{parseArgv}from"./chunk-VQMR5UTD.js";import"./chunk-NAUH75MM.js";import"./chunk-523KROGI.js";import"./chunk-QQRJLH6B.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.
|
|
4
|
+
import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{parseArgv}from"./chunk-VQMR5UTD.js";import"./chunk-NAUH75MM.js";import"./chunk-523KROGI.js";import"./chunk-QQRJLH6B.js";import"./chunk-VSJBJXZO.js";var VERSION=true?"0.36.0":"0.0.0-dev";var HELP=`twp ${VERSION} \u2014 TWP CLI
|
|
5
5
|
|
|
6
6
|
\u4F7F\u3044\u65B9:
|
|
7
7
|
twp \u5BFE\u8A71 TUI \u3092\u8D77\u52D5
|
|
@@ -296,6 +296,11 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{parseArgv}from"./chu
|
|
|
296
296
|
twp company list \u53D6\u5F15\u5148\u4F01\u696D\u3092\u4E00\u89A7\u3059\u308B\uFF08--keyword\uFF09
|
|
297
297
|
twp company get <\u53D6\u5F15\u5148>
|
|
298
298
|
\u53D6\u5F15\u5148\u4F01\u696D1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u540D\u524D\u304B ID\uFF09
|
|
299
|
+
twp company create \u53D6\u5F15\u5148\u4F01\u696D\u3092\u767B\u9332\u3059\u308B\uFF08--name\u30FB--customer / --supplier true\uFF09
|
|
300
|
+
twp company update <\u53D6\u5F15\u5148>
|
|
301
|
+
\u53D6\u5F15\u5148\u4F01\u696D\u306E\u9805\u76EE\u3092\u66F4\u65B0\u3059\u308B\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\uFF09
|
|
302
|
+
twp company delete <\u53D6\u5F15\u5148>
|
|
303
|
+
\u53D6\u5F15\u5148\u4F01\u696D\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\u30FB\u62C5\u5F53\u8005\u304C\u6B8B\u308C\u3070\u6B62\u3081\u308B\uFF09
|
|
299
304
|
twp customer list \u9867\u5BA2\u3092\u4E00\u89A7\u3059\u308B\uFF08--keyword\uFF09
|
|
300
305
|
twp customer get <\u9867\u5BA2> \u9867\u5BA21\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u540D\u524D\u304B ID\u30FB\u62C5\u5F53\u8005\u6570\u3068\u76F4\u8FD1\u306E\u5BFE\u5FDC\u3092\u542B\u3080\uFF09
|
|
301
306
|
twp customer create \u9867\u5BA2\u3092\u767B\u9332\u3059\u308B\uFF08--name\u30FB--supplier true \u3067\u4ED5\u5165\u5148\u3082\u517C\u306D\u308B\uFF09
|
|
@@ -303,8 +308,38 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{parseArgv}from"./chu
|
|
|
303
308
|
\u9867\u5BA2\u306E\u9805\u76EE\u3092\u66F4\u65B0\u3059\u308B\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\uFF09
|
|
304
309
|
twp customer delete <\u9867\u5BA2>
|
|
305
310
|
\u9867\u5BA2\u3092\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u3054\u3068\u524A\u9664\u3059\u308B\uFF08--file \u3067\u4E00\u62EC\u30FB--yes \u304C\u8981\u308B\uFF09
|
|
311
|
+
twp customer search-similar <\u4F01\u696D\u540D>
|
|
312
|
+
\u540D\u524D\u304C\u4F3C\u305F\u65E2\u5B58\u306E\u53D6\u5F15\u5148\u3092\u63A2\u3059\uFF08\u767B\u9332\u524D\u306E\u91CD\u8907\u78BA\u8A8D\uFF09
|
|
313
|
+
twp customer contract list
|
|
314
|
+
\u9867\u5BA2\u306E\u5951\u7D04\u66F8\u3092\u4E00\u89A7\u3059\u308B\uFF08--customer <\u9867\u5BA2>\uFF09
|
|
315
|
+
twp customer contract get <\u66F8\u985EID>
|
|
316
|
+
\u5951\u7D04\u66F81\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u73FE\u884C\u7248\u30FB\u904E\u53BB\u7248\u3092\u542B\u3080\u30FB--customer\uFF09
|
|
317
|
+
twp customer contract create
|
|
318
|
+
PDF \u3092\u5951\u7D04\u66F8\u3068\u3057\u3066\u767B\u9332\u3059\u308B\uFF08--customer\u30FB--file\u30FB--type\u30FB--name\uFF09
|
|
319
|
+
twp customer contract add-version <\u66F8\u985EID>
|
|
320
|
+
\u5951\u7D04\u66F8\u306E PDF \u3092\u5DEE\u3057\u66FF\u3048\u308B\uFF08\u65B0\u3057\u3044\u7248\u30FB--customer\u30FB--file\uFF09
|
|
321
|
+
twp customer contract download <\u66F8\u985EID>
|
|
322
|
+
\u5951\u7D04\u66F8\u306E PDF \u3092\u66F8\u304D\u51FA\u3059\uFF08--customer\u30FB--out\u30FB--rev \u3067\u904E\u53BB\u7248\uFF09
|
|
323
|
+
twp customer contract update <\u66F8\u985EID>
|
|
324
|
+
\u5951\u7D04\u66F8\u306E\u66F8\u985E\u540D\u30FB\u7A2E\u5225\u3092\u5909\u66F4\u3059\u308B\uFF08--customer\uFF09
|
|
325
|
+
twp customer contract delete <\u66F8\u985EID>
|
|
326
|
+
\u5951\u7D04\u66F8\u3092\u524A\u9664\u3059\u308B\uFF08--customer\u30FB--yes \u304C\u8981\u308B\u30FB\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
327
|
+
twp customer case-document list
|
|
328
|
+
\u9867\u5BA2\u306E\u6848\u4EF6\u66F8\u985E\u3092\u898B\u7A4D\u3092\u307E\u305F\u3044\u3067\u4E00\u89A7\u3059\u308B\uFF08--customer\uFF09
|
|
329
|
+
twp customer campaign list
|
|
330
|
+
\u65BD\u7B56\u3092\u4E00\u89A7\u3059\u308B\uFF08--keyword\u30FB--active\uFF09
|
|
331
|
+
twp customer campaign get <\u65BD\u7B56ID>
|
|
332
|
+
\u65BD\u7B561\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B
|
|
333
|
+
twp customer campaign create
|
|
334
|
+
\u65BD\u7B56\u3092\u4F5C\u6210\u3059\u308B\uFF08--name\u30FB\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
335
|
+
twp customer campaign update <\u65BD\u7B56ID>
|
|
336
|
+
\u65BD\u7B56\u3092\u66F4\u65B0\u3059\u308B\uFF08\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
337
|
+
twp customer campaign delete <\u65BD\u7B56ID>
|
|
338
|
+
\u65BD\u7B56\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\u30FB\u7BA1\u7406\u8005\u306E\u307F\uFF09
|
|
306
339
|
twp customer contact list
|
|
307
340
|
\u9867\u5BA2\u306E\u62C5\u5F53\u8005\u3092\u4E00\u89A7\u3059\u308B\uFF08--customer <\u9867\u5BA2>\uFF09
|
|
341
|
+
twp customer contact get <\u62C5\u5F53\u8005ID>
|
|
342
|
+
\u62C5\u5F53\u80051\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08--customer\uFF09
|
|
308
343
|
twp customer contact create
|
|
309
344
|
\u9867\u5BA2\u306B\u62C5\u5F53\u8005\u3092\u767B\u9332\u3059\u308B\uFF08--customer\u30FB--name\uFF09
|
|
310
345
|
twp customer contact update <\u62C5\u5F53\u8005ID>
|
|
@@ -313,12 +348,30 @@ import{GLOBAL_OPTIONS_HELP}from"./chunk-TAN5I2DP.js";import{parseArgv}from"./chu
|
|
|
313
348
|
\u62C5\u5F53\u8005\u3092\u524A\u9664\u3059\u308B\uFF08--customer\u30FB--yes \u304C\u8981\u308B\uFF09
|
|
314
349
|
twp customer interaction list
|
|
315
350
|
\u9867\u5BA2\u306E\u5BFE\u5FDC\u5C65\u6B74\u3092\u4E00\u89A7\u3059\u308B\uFF08--customer <\u9867\u5BA2>\uFF09
|
|
351
|
+
twp customer interaction get <\u5BFE\u5FDC\u5C65\u6B74ID>
|
|
352
|
+
\u5BFE\u5FDC\u5C65\u6B741\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08--customer\uFF09
|
|
353
|
+
twp customer interaction recent
|
|
354
|
+
\u6700\u8FD1\u306E\u5BFE\u5FDC\u5C65\u6B74\u3092\u4E00\u89A7\u3059\u308B\uFF08\u9867\u5BA2\u30FB\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u3092\u307E\u305F\u3050\uFF09
|
|
316
355
|
twp customer interaction create
|
|
317
356
|
\u9867\u5BA2\u306B\u5BFE\u5FDC\u5C65\u6B74\u3092\u767B\u9332\u3059\u308B\uFF08--customer\u30FB--type\u30FB--date\uFF09
|
|
318
357
|
twp customer interaction update <\u5BFE\u5FDC\u5C65\u6B74ID>
|
|
319
358
|
\u5BFE\u5FDC\u5C65\u6B74\u3092\u66F4\u65B0\u3059\u308B\uFF08--customer\uFF09
|
|
320
359
|
twp customer interaction delete <\u5BFE\u5FDC\u5C65\u6B74ID>
|
|
321
360
|
\u5BFE\u5FDC\u5C65\u6B74\u3092\u524A\u9664\u3059\u308B\uFF08--customer\u30FB--yes \u304C\u8981\u308B\uFF09
|
|
361
|
+
twp customer business-card list
|
|
362
|
+
\u62C5\u5F53\u8005\u306E\u540D\u523A\u3092\u4E00\u89A7\u3059\u308B\uFF08--customer\u30FB--contact\uFF09
|
|
363
|
+
twp customer business-card add
|
|
364
|
+
\u540D\u523A\u306E\u753B\u50CF\u3092\u767B\u9332\u3059\u308B\uFF08--front / --back\u30FB--note\uFF09
|
|
365
|
+
twp customer business-card note <\u540D\u523AID>
|
|
366
|
+
\u540D\u523A\u306E\u88CF\u9762\u30E1\u30E2\u3092\u66F8\u304D\u63DB\u3048\u308B\uFF08--note\u30FB--clear\uFF09
|
|
367
|
+
twp customer business-card delete <\u540D\u523AID>
|
|
368
|
+
\u540D\u523A\u3092\u524A\u9664\u3059\u308B\uFF08\u753B\u50CF\u3082\u6D88\u3048\u308B\u30FB--yes \u304C\u8981\u308B\uFF09
|
|
369
|
+
twp customer people list
|
|
370
|
+
\u4F01\u696D\u3092\u307E\u305F\u3044\u3067\u4EBA\u7269\u3092\u4E00\u89A7\u3059\u308B\uFF08--keyword\u30FB--company\uFF09
|
|
371
|
+
twp customer people get <\u4EBA\u7269ID>
|
|
372
|
+
\u4EBA\u72691\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u6240\u5C5E\u4F01\u696D\u540D\u3064\u304D\uFF09
|
|
373
|
+
twp customer people export
|
|
374
|
+
\u4EBA\u7269\u3092 CSV \u306B\u66F8\u304D\u51FA\u3059\uFF08\u7BA1\u7406\u8005\u306E\u307F\u30FB--out\uFF09
|
|
322
375
|
twp prospect list \u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u3092\u4E00\u89A7\u3059\u308B\uFF08--keyword\u30FB--status\u30FB--assignee\uFF09
|
|
323
376
|
twp prospect get <\u30A2\u30D7\u30ED\u30FC\u30C1\u5148>
|
|
324
377
|
\u30A2\u30D7\u30ED\u30FC\u30C1\u51481\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08ID \u304B\u4F01\u696D\u540D\uFF09
|
|
@@ -376,15 +429,15 @@ TUI \u5185:
|
|
|
376
429
|
TWP API \u3092\u547C\u3079\u307E\u3059\u3002TWP API \u306E\u30C4\u30FC\u30EB\u306F\u65E2\u5B9A\u3067\u78BA\u8A8D\u304C\u51FA\u307E\u3059\uFF08-p \u3067\u306F\u62D2\u5426\u3002--allowed-tools \u3067\u540D\u524D\u3092\u8A31\u53EF\uFF09\u3002
|
|
377
430
|
\u4F1A\u8A71\u30FB\u30ED\u30FC\u30AB\u30EB\u30C4\u30FC\u30EB\uFF08\u30D5\u30A1\u30A4\u30EB\u30FB\u30B3\u30DE\u30F3\u30C9\u30FBgit\uFF09\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u30AF\u30EC\u30B8\u30C3\u30C8\u3067\u5B9F\u969B\u306B\u52D5\u304D\u307E\u3059\u3002
|
|
378
431
|
`;function ignoreEpipe(stream){stream.on("error",err=>{if(err.code==="EPIPE")process.exit(0);throw err})}async function main(){const nodeMajor=Number(process.versions.node.split(".")[0]);if(nodeMajor<22){process.stderr.write(`twp-cli \u306B\u306F Node.js 22 \u4EE5\u4E0A\u304C\u5FC5\u8981\u3067\u3059\uFF08\u73FE\u5728: ${process.versions.node}\uFF09
|
|
379
|
-
`);process.exit(1)}ignoreEpipe(process.stdout);ignoreEpipe(process.stderr);if(process.env["TWP_AUTO_UPDATE_WORKER"]==="1"){const{runAutoUpdateWorker}=await import("./auto-update-worker-
|
|
380
|
-
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-
|
|
432
|
+
`);process.exit(1)}ignoreEpipe(process.stdout);ignoreEpipe(process.stderr);if(process.env["TWP_AUTO_UPDATE_WORKER"]==="1"){const{runAutoUpdateWorker}=await import("./auto-update-worker-Y44TD6FD.js");await runAutoUpdateWorker().catch(()=>void 0);return}const[first,...rest]=process.argv.slice(2);if(first==="__complete"||first==="completion"){const completion=await import("./completion-DGJH42YO.js");if(first==="completion"){process.exitCode=completion.runCompletion(rest,process.stdout,process.stderr);return}
|
|
433
|
+
const[{loadDomain},{loadUserConfig}]=await Promise.all([import("./registry-3O2KBG5I.js"),import("./config-3CNEQ7KN.js")]);process.exitCode=await completion.runComplete(rest,process.stdout,{loadDomain,profileNames:()=>Object.keys(loadUserConfig().profiles??{})});return}if(first==="configure"){const autoUpdate2=await import("./auto-update-JNSBIQM6.js");autoUpdate2.registerRunning();autoUpdate2.onStartup(VERSION);const{runConfigure}=await import("./configure-PIOFJFL5.js");process.exitCode=
|
|
381
434
|
await runConfigure(rest);return}const args=parseArgv(process.argv.slice(2));if(args.command==="version"){process.stdout.write(`${VERSION}
|
|
382
435
|
`);return}if(args.command==="help"){process.stdout.write(HELP);return}if(args.unknown.length>0){process.stderr.write(`\u4E0D\u660E\u306A\u5F15\u6570: ${args.unknown.join(" ")}
|
|
383
436
|
|
|
384
|
-
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-JNSBIQM6.js");autoUpdate.registerRunning();if(args.command==="task-loop"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-
|
|
385
|
-
domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-
|
|
386
|
-
void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes},version:VERSION});return}if(args.command==="update"){const{runUpdate}=await import("./update-
|
|
437
|
+
${HELP}`);process.exitCode=2;return}const autoUpdate=await import("./auto-update-JNSBIQM6.js");autoUpdate.registerRunning();if(args.command==="task-loop"){process.env[autoUpdate.DISABLE_ENV]="1"}else if(args.command!=="update"){autoUpdate.onStartup(VERSION)}if(args.command==="domain"&&args.domain!==void 0){const{runDomain}=await import("./run-WXHHCFT7.js");process.exitCode=await runDomain({domain:args.domain,...args.operation!==void 0?{operation:args.operation}:{},argv:args.domainArgv,help:args.
|
|
438
|
+
domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes,refresh:args.refresh},version:VERSION});return}if(args.command==="api"){const{runApiCommand}=await import("./api-command-YUZFGC2W.js");process.exitCode=await runApiCommand({argv:args.domainArgv,help:args.domainHelp,globals:{...args.profile!==void 0?{profile:args.profile}:{},...args.output!==
|
|
439
|
+
void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{},dryRun:args.dryRun,debug:args.debug,yes:args.yes},version:VERSION});return}if(args.command==="update"){const{runUpdate}=await import("./update-MAQJ6VWV.js");process.exitCode=await runUpdate({...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}if(args.command==="login"||args.command==="logout"||args.command==="whoami"){const{runLogin,runLogout,runWhoami}=await import("./commands-OABOHHNC.js");
|
|
387
440
|
const options={profile:args.profile,method:args.loginMethod,tenant:args.tenant,noBrowser:args.loginNoBrowser,cliVersion:VERSION,force:args.logoutForce,...args.output!==void 0?{output:args.output}:{},...args.query!==void 0?{query:args.query}:{}};const runner=args.command==="login"?runLogin:args.command==="logout"?runLogout:runWhoami;process.exitCode=await runner(options);return}if(args.command==="task-loop"){const{runTaskLoop}=await import("./commands-M4B3MDUA.js");process.exitCode=await runTaskLoop(
|
|
388
441
|
{action:args.taskLoopAction??"run",project:args.project,profile:args.profile,safe:args.safe,daemon:args.daemon,interval:args.interval,maxCycles:args.maxCycles,forceRunner:args.forceRunner,force:args.stopForce,drain:args.stopDrain,engine:args.engine,version:VERSION,verbose:args.verbose,scheduleNow:args.scheduleNow,scheduleCounts:args.scheduleCounts,scheduleGate:args.scheduleGate,charterOp:args.charterOp,charterInput:args.charterFile,charterOutput:args.charterOut,charterRevision:args.charterRevision,
|
|
389
|
-
skillOp:args.skillOp,skillName:args.skillName,skillAll:args.skillAll,skillDir:args.skillDir,yes:args.yes,ais:args.ais,workspace:args.workspace,aiConfigFile:args.aiConfigFile,noAiConfigFile:args.noAiConfigFile});return}if(args.command==="print"){const{runOneShot}=await import("./oneshot-
|
|
390
|
-
allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-
|
|
442
|
+
skillOp:args.skillOp,skillName:args.skillName,skillAll:args.skillAll,skillDir:args.skillDir,yes:args.yes,ais:args.ais,workspace:args.workspace,aiConfigFile:args.aiConfigFile,noAiConfigFile:args.noAiConfigFile});return}if(args.command==="print"){const{runOneShot}=await import("./oneshot-GCQYYNIH.js");process.exitCode=await runOneShot({prompt:args.prompt??"",fromStdin:args.promptFromStdin,mode:args.mode??"dev",...args.permissionMode!==void 0?{permissionMode:args.permissionMode}:{},allowedTools:args.
|
|
443
|
+
allowedTools,disallowedTools:args.disallowedTools,...args.model!==void 0?{model:args.model}:{},...args.profile!==void 0?{profile:args.profile}:{},version:VERSION});return}const{startTui}=await import("./app-NIJ3MAGU.js");await startTui({mode:args.mode,permissionMode:args.permissionMode,allowedTools:args.allowedTools,disallowedTools:args.disallowedTools,model:args.model,profile:args.profile,noTui:args.noTui||!process.stdout.isTTY,doctor:args.doctor,version:VERSION})}await main();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
2
|
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
-
import{PromptAbortedError,promptHidden,promptText}from"./chunk-L37NS5L2.js";import{ApiError,TwpApiClient,errorListMessages}from"./chunk-
|
|
3
|
+
import{PromptAbortedError,promptHidden,promptText}from"./chunk-L37NS5L2.js";import{ApiError,TwpApiClient,errorListMessages}from"./chunk-IF2K4PM5.js";import{AuthSession,NotLoggedInError,SessionExpiredError,deleteCredentials,loadCredentials,maskToken,saveCredentials}from"./chunk-XNLIEUAW.js";import{httpFetch}from"./chunk-J7QYPKVK.js";import{effectiveApiUrl,resolveProfile}from"./chunk-4VZKNEVN.js";import{stripTerminalControls}from"./chunk-NHYMHCAT.js";import{system32}from"./chunk-N2UVRM3Z.js";
|
|
4
4
|
import{EXIT_USAGE,UsageError}from"./chunk-7WSNIXTQ.js";import{isWindowsDriveAbsolute}from"./chunk-PMOUHEJQ.js";import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";import os from"os";import{createHash,randomBytes}from"crypto";function generatePkcePair(){const verifier=randomBytes(32).toString("base64url");return{verifier,challenge:computeChallenge(verifier),method:"S256"}}function computeChallenge(verifier){return createHash("sha256").update(verifier,"ascii").digest("base64url")}function generateState(){return randomBytes(16).toString("base64url")}import http from"http";import crypto from"crypto";function safeEqual(a,b){const x=Buffer.from(a,"utf8");const y=Buffer.from(b,"utf8");const len=Math.max(x.length,y.length,1);const px=Buffer.alloc(len);const py=Buffer.alloc(len);x.copy(px);y.copy(py);return crypto.timingSafeEqual(px,py)&&x.length===y.length}var LoginTimeoutError=class extends Error{constructor(timeoutMs){super(`\u30D6\u30E9\u30A6\u30B6\u3067\u306E\u627F\u8A8D\u3092 ${Math.round(timeoutMs/1e3)} \u79D2\u5F85\u3061\u307E\u3057\u305F\u304C\u5B8C\u4E86\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002twp login \u3092\u3084\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\
|
|
5
5
|
\u3044\u3002`)}};var SUCCESS_HTML=`<!doctype html><html lang="ja"><head><meta charset="utf-8"><title>TWP CLI \u30ED\u30B0\u30A4\u30F3\u5B8C\u4E86</title></head>
|
|
6
6
|
<body style="font-family: sans-serif; text-align: center; padding-top: 4rem; background:#f7f9fc; color:#1b2559">
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createRequire as __twpCreateRequire } from 'node:module';
|
|
2
|
+
const require = __twpCreateRequire(import.meta.url);
|
|
3
|
+
import{COMPANY_FIELDS,COMPANY_LICENSE,CUSTOMER_FLAG,CUSTOMER_LICENSE,childForbidden,customerSubresources,customerWriteOperations,dataOf,levelForbidden,prepareCustomerFlag}from"./chunk-MQ3WFH54.js";import"./chunk-I6DWJXPC.js";import{inspectLocalFile}from"./chunk-VECUCVIY.js";import{checkUploadQuota}from"./chunk-DDKZ5IPT.js";import{featureLicenseGuidance,licenseForbidden}from"./chunk-PLBOUQE7.js";import{createFlags,fieldBody,hasAnyField,updateFlags}from"./chunk-DCGL7XJF.js";
|
|
4
|
+
import{repeatedValues}from"./chunk-IOGVQVGD.js";import{booleanText}from"./chunk-UDPJ2IGK.js";import{CUSTOMERS_PATH,SALES_COMPANIES_PATH,isExactNumericId}from"./chunk-DBIDYOKW.js";import{ApiError}from"./chunk-IF2K4PM5.js";import{isSafePathSegment}from"./chunk-GMBJTG6A.js";import{NotLoggedInError,SessionExpiredError}from"./chunk-XNLIEUAW.js";import"./chunk-J7QYPKVK.js";import"./chunk-4VZKNEVN.js";import"./chunk-QQRJLH6B.js";import"./chunk-NHYMHCAT.js";
|
|
5
|
+
import"./chunk-GY7KI5E5.js";import{LIST_FLAGS,LIST_PAGING_HELP,PAGE_NUMBER_LIST_FLAGS,PAGE_NUMBER_PAGING_HELP,STABLE_PAGE_ORDER,envelopePaging,nonEmpty,pageNumberPaging,pageNumberQuery,pageRangeNotes,positiveInteger}from"./chunk-R53CMVWR.js";import"./chunk-II5RVJQN.js";import{requireResolved,singleRef,withResolved}from"./chunk-ZN5EFDH7.js";import{acknowledgement,isRecord,pick}from"./chunk-ZWVYVS2A.js";import{ApiResponseError,UsageError}from"./chunk-7WSNIXTQ.js";
|
|
6
|
+
import"./chunk-RZVI6PMW.js";import"./chunk-VSJBJXZO.js";var CUSTOMER_FLAG_FIELD={kind:"boolean",flag:"--customer",key:"customer_flg",summary:"\u9867\u5BA2\u3068\u3057\u3066\u6271\u3046\u304B\uFF08true / false\uFF09"};var FIELDS=[...COMPANY_FIELDS,CUSTOMER_FLAG_FIELD];var COLUMNS=["id","company_name","company_name_kana","company_short_name","customer_flg","supplier_flg","tel","address1"];var WRITE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u53D6\u5F15\u5148\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u304B\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7DE8\u96C6\u8005\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");
|
|
7
|
+
var DELETE_FORBIDDEN=levelForbidden(COMPANY_LICENSE,"\u53D6\u5F15\u5148\u306E\u524A\u9664\u306B\u306F\u3001\u8CA9\u58F2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u30E1\u30F3\u30D0\u30FC\u300D\u4EE5\u4E0A\u304B\u3001\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\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");var REF_HELP="<\u53D6\u5F15\u5148> \u306F\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u5B8C\u5168\u4E00\u81F4\u304B\
|
|
8
|
+
ID\uFF08twp company list \u306E id \u5217\u306E\u6570\u5B57\uFF09\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u3069\u3061\u3089\u3082\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002";function companyPath(input){const id=requireResolved(input,"companyId");if(!isExactNumericId(id))throw new UsageError(`\u53D6\u5F15\u5148 ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${id}`);return`${SALES_COMPANIES_PATH}/${id}`}async function resolveCompany(input,ctx,usage){
|
|
9
|
+
const raw=singleRef(input,{flag:"<\u53D6\u5F15\u5148>",label:"\u53D6\u5F15\u5148",usage});return withResolved(input,{companyId:(await ctx.resolver.company(raw,{flag:"<\u53D6\u5F15\u5148>",source:"sales",mustExist:true})).id})}var createOperation={name:"create",summary:"\u53D6\u5F15\u5148\u4F01\u696D\u3092\u767B\u9332\u3059\u308B\uFF08\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u4EE5\u4E0A\uFF09",usage:"twp company create --name <\u4F01\u696D\u540D> (--customer true | --suppli\
|
|
10
|
+
er true) [\u9805\u76EE\u2026]",description:"--name \u304C\u5FC5\u9808\u3067\u3059\u3002\u9867\u5BA2\uFF08--customer true\uFF09\u304B\u4ED5\u5165\u5148\uFF08--supplier true\uFF09\u306E\u5C11\u306A\u304F\u3068\u3082\u4E00\u65B9\u304C\u8981\u308A\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u3082\u540C\u3058\u6761\u4EF6\u3067\u65AD\u308A\u307E\u3059\uFF09\u3002\n\u9867\u5BA2\u3068\u3057\u3066\u767B\u9332\u3059\u308B\u3060\u3051\u306A\u3089 twp customer create \u3067\u3082\u540C\u3058\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u4F5C\u6210\u3057\u305F\u53D6\u5F15\u5148\u306E ID \u304C\u8FD4\u308A\u307E\u3059\u3002",
|
|
11
|
+
forbidden:WRITE_FORBIDDEN,flags:createFlags(FIELDS),plan(input){if(input.args.length>0)throw new UsageError(`create \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,"twp company create help");const body=fieldBody(input,FIELDS);if(body["company_name"]===void 0)throw new UsageError("--name \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","twp company create help");if(body["customer_flg"]!==true&&body["supplier_flg"]!==true){throw new UsageError("-\
|
|
12
|
+
-customer true \u304B --supplier true \u306E\u5C11\u306A\u304F\u3068\u3082\u4E00\u65B9\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044","\u30B5\u30FC\u30D0\u306F\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u3069\u3061\u3089\u3067\u3082\u306A\u3044\u53D6\u5F15\u5148\u3092\u767B\u9332\u3057\u307E\u305B\u3093\u3002")}return{method:"POST",path:SALES_COMPANIES_PATH,body}},summarize:body=>pick(dataOf(body,"\u53D6\u5F15\u5148\u306E\u767B\u9332"),COLUMNS),raw:body=>dataOf(body,"\u53D6\u5F15\u5148\u306E\u767B\u9332")};
|
|
13
|
+
var updateOperation={name:"update",summary:"\u53D6\u5F15\u5148\u4F01\u696D\u306E\u9805\u76EE\u3092\u66F4\u65B0\u3059\u308B",usage:"twp company update <\u53D6\u5F15\u5148> [\u9805\u76EE\u2026]",description:`\u6307\u5B9A\u3057\u305F\u9805\u76EE\u3060\u3051\u3092\u5909\u66F4\u3057\u307E\u3059\uFF08\u6307\u5B9A\u3057\u306A\u304B\u3063\u305F\u9805\u76EE\u306F\u5909\u308F\u308A\u307E\u305B\u3093\uFF09\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
|
|
14
|
+
\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u4E21\u65B9\u3092 false \u306B\u3059\u308B\u5909\u66F4\u306F\u30B5\u30FC\u30D0\u304C\u65AD\u308A\u307E\u3059\u3002
|
|
15
|
+
|
|
16
|
+
${REF_HELP}`,forbidden:WRITE_FORBIDDEN,flags:updateFlags(FIELDS),async prepare(input,ctx){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","twp company update help");fieldBody(input,FIELDS);return resolveCompany(input,ctx,"twp company update help")},plan:input=>({method:"PUT",path:companyPath(input),body:fieldBody(input,FIELDS)}),summarize:body=>pick(dataOf(body,"\u53D6\u5F15\u5148\u306E\u66F4\u65B0"),
|
|
17
|
+
COLUMNS),raw:body=>dataOf(body,"\u53D6\u5F15\u5148\u306E\u66F4\u65B0")};function truthy(value){return value===true||value===1||value==="1"}var toCustomerDelete=id=>`twp customer delete ${id} --yes \u3067\u3001\u4F01\u696D \u2192 \u62C5\u5F53\u8005\u306E\u9806\u306B\u6D88\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u53D6\u5F15\u5148\u306E\u524A\u9664\u306F\u62C5\u5F53\u8005\u3092\u6D88\u3055\u306A\u3044\u305F\u3081\u3001\u3053\u3053\u3067\u6D88\u3059\u3068\u62C5\u5F53\u8005\u3060\u3051\u304C\u6B8B\u308A\u307E\u3059\uFF09\u3002\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u7121\u3051\u308C\u3070\u3001\u6A29\u9650\u3092\u6301\u3064\u4EBA\u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`;
|
|
18
|
+
async function prepareDelete(input,ctx){const resolved=await resolveCompany(input,ctx,"twp company delete help");const id=requireResolved(resolved,"companyId");const record=await ctx.resolver.companyRecord(id);if(record===null)throw new UsageError(`\u53D6\u5F15\u5148 ${id} \u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u524A\u9664\u6E08\u307F\u304B\u3082\u3057\u308C\u307E\u305B\u3093\uFF09`,"twp company list \u3067\u78BA\u304B\u3081\u3066\u304F\u3060\u3055\u3044\u3002");const customer=truthy(record["\
|
|
19
|
+
customer_flg"]);let contacts;try{contacts=(await ctx.resolver.customerChildren(id,"contacts")).length}catch(err){if(!(err instanceof ApiError&&err.status===403))throw err;if(customer){throw new UsageError(`\u53D6\u5F15\u5148 ${id} \u306F\u9867\u5BA2\u3067\u3059\u304C\u3001\u62C5\u5F53\u8005\u304C\u6B8B\u3063\u3066\u3044\u306A\u3044\u304B\u3092\u78BA\u304B\u3081\u3089\u308C\u306A\u3044\u305F\u3081\u524A\u9664\u3057\u307E\u305B\u3093\uFF08\u62C5\u5F53\u8005\u3092\u898B\u308B\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u8981\u308A\u307E\u3059\uFF09\u3002`,
|
|
20
|
+
toCustomerDelete(id))}return withResolved(resolved,{kind:"unchecked"})}if(contacts>0){throw new UsageError(`\u53D6\u5F15\u5148 ${id} \u306B\u306F\u62C5\u5F53\u8005\u304C ${contacts} \u4EF6\u6B8B\u3063\u3066\u3044\u307E\u3059${customer?"":"\uFF08\u9867\u5BA2\u306E\u533A\u5206\u306F\u5916\u308C\u3066\u3044\u307E\u3059\uFF09"}\u3002`,customer?toCustomerDelete(id):`twp company update ${id} --customer true \u3067\u9867\u5BA2\u306B\u623B\u3057\u3066\u304B\u3089\u3001${toCustomerDelete(id)}`)}return withResolved(
|
|
21
|
+
resolved,{kind:customer?"customer":"supplier"})}var deleteOperation={name:"delete",summary:"\u53D6\u5F15\u5148\u4F01\u696D\u3092\u524A\u9664\u3059\u308B\uFF08--yes \u304C\u8981\u308B\u30FB\u62C5\u5F53\u8005\u304C\u6B8B\u308C\u3070 twp customer delete \u3078\uFF09",usage:"twp company delete <\u53D6\u5F15\u5148> --yes",description:`${REF_HELP}
|
|
22
|
+
|
|
23
|
+
\u898B\u7A4D\u30FB\u8ACB\u6C42\u66F8\u30FB\u6848\u4EF6\u66F8\u985E\u30FB\u5951\u7D04\u66F8\u30FB\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u7B49\u304B\u3089\u4F7F\u308F\u308C\u3066\u3044\u308B\u53D6\u5F15\u5148\u306F\u30B5\u30FC\u30D0\u304C\u65AD\u308A\u307E\u3059\uFF08\u7406\u7531\u3092\u305D\u306E\u307E\u307E\u51FA\u3057\u3066\u6B62\u307E\u308A\u307E\u3059\uFF09\u3002
|
|
24
|
+
\u5BFE\u5FDC\u5C65\u6B74\u306F\u30B5\u30FC\u30D0\u304C\u4F75\u305B\u3066\u524A\u9664\u3057\u307E\u3059\u3002**\u62C5\u5F53\u8005\u306F\u524A\u9664\u3055\u308C\u306A\u3044**\u306E\u3067\u3001\u62C5\u5F53\u8005\u304C\u6B8B\u308B\u53D6\u5F15\u5148\u306F\uFF08\u9867\u5BA2\u306E\u533A\u5206\u3092\u5916\u3057\u305F\u4F01\u696D\u3082\uFF09\u9001\u308B\u524D\u306B\u6B62\u3081\u3001twp customer delete \u3092\u6848\u5185\u3057\u307E\u3059\u3002`,destructive:true,forbidden:DELETE_FORBIDDEN,flags:[],prepare:prepareDelete,
|
|
25
|
+
plan:input=>({method:"DELETE",path:companyPath(input)}),plannedNotes:input=>[input.resolved?.["kind"]==="unchecked"?"\u4ED5\u5165\u5148\u3060\u3051\u306E\u53D6\u5F15\u5148\u3067\u3059\u3002\u62C5\u5F53\u8005\u306E\u6709\u7121\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u7121\u3044\u305F\u3081\u78BA\u304B\u3081\u3066\u3044\u307E\u305B\u3093\u3002":"\u62C5\u5F53\u8005\u304C\u6B8B\u3063\u3066\u3044\u306A\u3044\u3053\u3068\u3092\u78BA\u304B\u3081\u307E\u3057\u305F\u3002\u5BFE\u5FDC\u5C65\u6B74\u306F\u30B5\u30FC\u30D0\u304C\u9023\u9396\u3057\u3066\u524A\u9664\u3057\u307E\u3059\u3002"],
|
|
26
|
+
summarize:body=>acknowledgement(body,"\u53D6\u5F15\u5148\u524A\u9664"),raw:body=>acknowledgement(body,"\u53D6\u5F15\u5148\u524A\u9664")};var companyWriteOperations=[createOperation,updateOperation,deleteOperation];var PEOPLE_COLUMNS=["id","company_id","company_name","name","department","position","email","phone","is_customer"];var PERSON_GET_COLUMNS=[...PEOPLE_COLUMNS,"name_kana","role_label","mobile","is_primary","notes","business_card_owner_name","updated_at"];var VIEW_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u4EBA\u7269\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");
|
|
27
|
+
var EXPORT_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u4EBA\u7269\u306E CSV \u51FA\u529B\u306B\u306F\u9867\u5BA2\u7BA1\u7406\u306E\u6A29\u9650\u304C\u300C\u7BA1\u7406\u8005\u300D\u3067\u3042\u308B\u3053\u3068\u304C\u8981\u308A\u307E\u3059\uFF08\u300C\u7DE8\u96C6\u8005\u300D\u300C\u95B2\u89A7\u8005\u300D\u3067\u306F\u51FA\u529B\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");var TRUNCATED_NOTE="\u26A0 \u30B5\u30FC\
|
|
28
|
+
\u30D0\u306E\u8D70\u67FB\u4E0A\u9650\uFF08\u30C6\u30CA\u30F3\u30C8\u306E\u62C5\u5F53\u8005 5,000 \u4EF6\uFF09\u3067\u6253\u3061\u5207\u3089\u308C\u305F\u305F\u3081\u3001\u3053\u306E\u7D50\u679C\u306F\u5168\u4EF6\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u4EF6\u6570\u3082\u78BA\u5B9A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002--company \u3084 --keyword \u3067\u5BFE\u8C61\u3092\u7D5E\u3063\u3066\u304F\u3060\u3055\u3044\u3002";var CAMPAIGN_FLAG={name:"--campaign",summary:"\u65BD\u7B56\u306E \
|
|
29
|
+
ID \u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u7E70\u308A\u8FD4\u3057\u6307\u5B9A\u3067\u304D\u308B\uFF09",takesValue:true,placeholder:"<\u65BD\u7B56ID>",repeatable:true};var FILTER_FLAGS=[{name:"--keyword",summary:"\u6C0F\u540D\u30FB\u30D5\u30EA\u30AC\u30CA\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306A\u3069\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"},{name:"--company",summary:"\u4F01\u696D\u540D\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u90E8\u5206\u4E00\u81F4\uFF09",
|
|
30
|
+
takesValue:true,placeholder:"<\u8A9E>"},{name:"--owner",summary:"\u540D\u523A\u306E\u62C5\u5F53\u8005\uFF08\u30E6\u30FC\u30B6\u30FC\u3002ID\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30FB\u793E\u54E1\u756A\u53F7\u30FB\u6C0F\u540D\uFF09\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u30E6\u30FC\u30B6\u30FC>"},CAMPAIGN_FLAG,{name:"--is-customer",summary:"\u9867\u5BA2\u5148\u306E\u4EBA\u7269\u3060\u3051\uFF08true\uFF09\u304B\u3001\u9867\u5BA2\u5148\u3067\u306A\u3044\u4EBA\u7269\u3060\u3051\uFF08false\uFF09",
|
|
31
|
+
takesValue:true,placeholder:"<true|false>"}];function isCustomerOf(input){const raw=input.flags.get("--is-customer");if(raw===void 0)return void 0;const value=raw.trim().toLowerCase();if(value!=="true"&&value!=="false")throw new UsageError(`--is-customer \u306B\u300C${raw}\u300D\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093`,"\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F true / false \u3067\u3059\u3002");return value}function filterQuery(input){const campaigns=repeatedValues(input,CAMPAIGN_FLAG.name);
|
|
32
|
+
const bad=campaigns.find(value=>value.includes(","));if(bad!==void 0)throw new UsageError(`--campaign \u306B\u30AB\u30F3\u30DE\u3092\u542B\u3080\u5024\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093: ${bad}`,"\u5024\u3054\u3068\u306B --campaign \u3092\u7E70\u308A\u8FD4\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return{keyword:nonEmpty(input.flags,"--keyword"),company_keyword:nonEmpty(input.flags,"--company"),owner_user_ids:input.resolved?.["ownerUserId"],campaign_ids:campaigns.length>0?[...campaigns]:
|
|
33
|
+
void 0,is_customer:isCustomerOf(input)}}async function prepareFilters(input,ctx,usage){if(input.args.length>0)throw new UsageError(`\u4F4D\u7F6E\u5F15\u6570\u306F\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,usage);filterQuery(input);const owner=nonEmpty(input.flags,"--owner");return owner===void 0?input:withResolved(input,{ownerUserId:(await ctx.resolver.user(owner,"--owner")).id})}var listPaging=envelopePaging({label:"\u4EBA\u7269\u4E00\u89A7"});function truncated(body){return isRecord(
|
|
34
|
+
body)&&body["scan_truncated"]===true}var listOperation={name:"list",summary:"\u4F01\u696D\u3092\u307E\u305F\u3044\u3067\u4EBA\u7269\uFF08\u9867\u5BA2\u306E\u62C5\u5F53\u8005\uFF09\u3092\u4E00\u89A7\u3059\u308B\uFF08\u30D5\u30EA\u30AC\u30CA\u9806\uFF09",usage:"twp customer people list [--keyword <\u8A9E>] [--company <\u8A9E>] [--owner <\u30E6\u30FC\u30B6\u30FC>] [--campaign <\u65BD\u7B56ID>\u2026] [--is-customer true|false] [--all] [--limit <\u4EF6\u6570>]",description:`\u30C6\u30CA\u30F3\u30C8\u5185\u306E\u5168\u9867\u5BA2\u306E\u62C5\u5F53\u8005\u3092\u3001\u4F01\u696D\u3092\u307E\u305F\u3044\u3067\u30D5\u30EA\u30AC\u30CA\
|
|
35
|
+
\u9806\u306B\u4E00\u89A7\u3057\u307E\u3059\u3002\u4F01\u696D\u3054\u3068\u306E\u4E00\u89A7\u306F twp customer contact list \u3067\u3059\u3002
|
|
36
|
+
\u7D5E\u308A\u8FBC\u307F\u5168\u4F53\u306E\u4EF6\u6570\u306F stderr \u306B\u51FA\u307E\u3059\u3002\u30B5\u30FC\u30D0\u306E\u8D70\u67FB\u4E0A\u9650\u3067\u6253\u3061\u5207\u3089\u308C\u305F\u3068\u304D\u306F\u3001\u305D\u306E\u65E8\u3092 stderr \u306B\u51FA\u3057\u307E\u3059\uFF08\u4EF6\u6570\u3082\u78BA\u5B9A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3002
|
|
37
|
+
|
|
38
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
39
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${PEOPLE_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
|
|
40
|
+
|
|
41
|
+
${LIST_PAGING_HELP}`,flags:[...LIST_FLAGS,...FILTER_FLAGS],paging:listPaging,forbidden:VIEW_FORBIDDEN,prepare:(input,ctx)=>prepareFilters(input,ctx,"twp customer people list help"),plan:input=>({method:"GET",path:`${CUSTOMERS_PATH}/contacts`,query:{...filterQuery(input),limit:positiveInteger(input.flags,"--limit"),cursor:nonEmpty(input.flags,"--cursor")}}),summarize:body=>listPaging.items(body).map(row=>pick(row,PEOPLE_COLUMNS)),raw:body=>listPaging.items(body),notes:body=>{if(truncated(body))return[
|
|
42
|
+
TRUNCATED_NOTE];return isRecord(body)&&typeof body["total"]==="number"?[`\u8A72\u5F53 ${body["total"]} \u4EF6`]:[]}};var getOperation={name:"get",summary:"\u4EBA\u72691\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u6240\u5C5E\u4F01\u696D\u540D\u3064\u304D\uFF09",usage:"twp customer people get <\u4EBA\u7269ID>",description:`\u4EBA\u7269\u306E ID \u306F twp customer people list \u306E id \u5217\uFF08\u62C5\u5F53\u8005\u306E ID \u3068\u540C\u3058\uFF09\u3067\u3059\u3002\u6240\u5C5E\u3059\u308B\u9867\u5BA2\u3092\u77E5\u3089\u306A\u304F\u3066\u3082\u5F15\u3051\u307E\u3059\u3002
|
|
43
|
+
|
|
44
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08\u540D\u523A business_cards \u3092\u542B\u3080\uFF09\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
45
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${PERSON_GET_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002`,flags:[],forbidden:VIEW_FORBIDDEN,plan(input){const[raw,...rest]=input.args;const usage="twp customer people get help";if(raw===void 0||raw.trim()==="")throw new UsageError("\u4EBA\u7269\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",usage);if(rest.length>0)throw new UsageError(`\u53D7\u3051\u53D6\u308C\u308B\u4EBA\u7269\u306E ID \u306F1\u3064\u3060\u3051\u3067\u3059: ${rest.
|
|
46
|
+
join(" ")}`,usage);const id=raw.trim();if(!isSafePathSegment(id)||id==="export"){throw new UsageError(`\u4EBA\u7269\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u5024\u3067\u3059: ${id}`,"twp customer people list \u306E id \u5217\u306E\u5024\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{method:"GET",path:`${CUSTOMERS_PATH}/contacts/${encodeURIComponent(id)}`}},summarize:body=>pick(dataOf(body,"\u4EBA\u7269"),PERSON_GET_COLUMNS),raw:body=>dataOf(body,"\u4EBA\u7269")};
|
|
47
|
+
var SCAN_TRUNCATED_HEADER="x-scan-truncated";var exportOperation={name:"export",summary:"\u4EBA\u7269\u3092 CSV \u306B\u66F8\u304D\u51FA\u3059\uFF08\u9867\u5BA2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306E\u307F\u30FB--out\uFF09",usage:"twp customer people export --out <\u30D1\u30B9.csv> [--force] [\u7D5E\u308A\u8FBC\u307F\u2026]",description:"\u7D5E\u308A\u8FBC\u307F\uFF08twp customer people list \u3068\u540C\u3058\uFF09\u306B\u5F53\u305F\u308B\u4EBA\u7269\u3092 CSV\uFF08UTF-8\u30FBBOM \u4ED8\u304D\uFF09\u3067\u66F8\u304D\u51FA\u3057\u307E\u3059\u3002\u30DA\u30FC\u30B8\u30F3\u30B0\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n\u5217\u306F \u6C0F\u540D\u30FB\u30D5\u30EA\u30AC\u30CA\u30FB\u4F01\u696D\u540D\u30FB\u90E8\u7F72\u30FB\u5F79\u8077\u30FB\u5F79\u5272\u30FB\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30FB\u96FB\u8A71\u756A\u53F7\u30FB\u643A\u5E2F\u756A\u53F7\u30FB\u4E3B\u62C5\u5F53\u30FB\u9867\u5BA2\u5148\u30FB\u540D\u523A\u306E\u62C5\u5F53\u8005\u30FB\u6240\u5C5E\u65BD\u7B56\u30FB\u30E1\u30E2\u30FB\u88CF\u9762\u30E1\u30E2 \u3067\u3059\u3002\n\u30B5\u30FC\u30D0\
|
|
48
|
+
\u306E\u8D70\u67FB\u4E0A\u9650\u3067\u6253\u3061\u5207\u3089\u308C\u305F\u3068\u304D\u306F\u3001\u66F8\u304D\u51FA\u3057\u305F\u3046\u3048\u3067\u5168\u4EF6\u3067\u306F\u306A\u3044\u3053\u3068\u3092 stderr \u3068 --output json \u306E headers \u306B\u51FA\u3057\u307E\u3059\u3002\n\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u4E0A\u66F8\u304D\u3057\u307E\u305B\u3093\uFF08\u4E0A\u66F8\u304D\u3059\u308B\u306A\u3089 --force\uFF09\u3002",flags:[{name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",
|
|
49
|
+
takesValue:true,placeholder:"<\u30D1\u30B9>"},{name:"--force",summary:"\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4E0A\u66F8\u304D\u3059\u308B",takesValue:false},...FILTER_FLAGS],download:{outFlag:"--out",forceFlag:"--force",captureHeaders:[SCAN_TRUNCATED_HEADER]},forbidden:EXPORT_FORBIDDEN,prepare:(input,ctx)=>prepareFilters(input,ctx,"twp customer people export help"),plan:input=>({method:"GET",path:`${CUSTOMERS_PATH}/contacts/export`,query:filterQuery(input)}),summarize:body=>body,raw:body=>body,
|
|
50
|
+
notes:body=>body?.headers?.[SCAN_TRUNCATED_HEADER]==="1"?[TRUNCATED_NOTE]:[]};var peopleResource={name:"people",summary:"\u4F01\u696D\u3092\u307E\u305F\u3044\u3060\u4EBA\u7269\uFF08\u9867\u5BA2\u306E\u62C5\u5F53\u8005\uFF09\u306E\u4E00\u89A7\u30FB\u8A73\u7D30\u30FBCSV \u51FA\u529B",operations:[listOperation,getOperation,exportOperation]};import fs from"fs";import path from"path";var CONTRACT_TYPES=["basic_contract","nda","other"];var CONTRACT_TYPE_HELP="basic_contract\uFF1D\u57FA\u672C\u5951\u7D04\u66F8 / nda\uFF1D\u6A5F\u5BC6\u4FDD\u6301\u5951\u7D04\u66F8 / other\uFF1D\u305D\u306E\u4ED6\u5951\u7D04\u66F8\u985E";var FILE_NAME_MAX_CHARS=255;var PDF_MAGIC="%PDF-";var CONTRACT_FIELDS=[{kind:"text",flag:"--name",key:"document_name",label:"\u66F8\u985E\u540D",maxChars:255,summary:"\u66F8\u985E\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"enum",flag:"--type",key:"\
|
|
51
|
+
document_type",values:CONTRACT_TYPES,summary:`\u66F8\u985E\u7A2E\u5225\uFF08${CONTRACT_TYPE_HELP}\u30FBcreate \u3067\u306F\u5FC5\u9808\uFF09`}];var CONTRACT_COLUMNS=["document_id","company_id","document_type","document_name","current_version","updated_by_name","updated_at"];var VERSION_COLUMNS=["version_number","file_name","file_size","is_current","created_by_name","created_at"];var CASE_COLUMNS=["document_id","document_type_label","document_name","estimate_no","estimate_title","project_name","c\
|
|
52
|
+
urrent_version","updated_at"];var FILE_FLAG={name:"--file",summary:"\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B PDF \u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\uFF08\u5FC5\u9808\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9.pdf>"};var OUT_FLAG={name:"--out",summary:"\u66F8\u304D\u51FA\u3057\u5148\u306E\u30D5\u30A1\u30A4\u30EB\u30D1\u30B9\uFF08\u5FC5\u9808\u3002\u6A19\u6E96\u51FA\u529B\u3078\u306F\u51FA\u3057\u307E\u305B\u3093\uFF09",takesValue:true,placeholder:"<\u30D1\u30B9>"};var FORCE_FLAG={
|
|
53
|
+
name:"--force",summary:"\u66F8\u304D\u51FA\u3057\u5148\u304C\u65E2\u306B\u3042\u308C\u3070\u4E0A\u66F8\u304D\u3059\u308B\uFF08\u65E2\u5B9A\u3067\u306F\u4E0A\u66F8\u304D\u3057\u306A\u3044\uFF09",takesValue:false};var REV_FLAG={name:"--rev",summary:"\u53D6\u308A\u51FA\u3059\u7248\u306E\u756A\u53F7\uFF08\u7701\u7565\u6642\u306F\u73FE\u884C\u7248\u3002twp customer contract get \u306E versions \u306E version_number\uFF09",takesValue:true,placeholder:"<\u7248\u756A\u53F7>"};var CONTRACT_REF_HELP="--cu\
|
|
54
|
+
stomer\uFF08\u9867\u5BA2\uFF09\u304C\u5FC5\u9808\u3067\u3059\u3002<\u66F8\u985EID> \u306F twp customer contract list \u306E document_id \u5217\u306E\u5024\u3067\u3059\u3002\n<\u9867\u5BA2> \u306F\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u5B8C\u5168\u4E00\u81F4\u304B ID\uFF08twp customer list \u306E id \u5217\u306E\u6570\u5B57\uFF09\u3067\u6307\u5B9A\u3057\u307E\u3059\u3002";var VIEW_FORBIDDEN2=label=>levelForbidden(CUSTOMER_LICENSE,`${label}\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`);
|
|
55
|
+
function usageOf(resource,op){return`twp customer ${resource} ${op} help`}function companyBase(input,kind){const id=requireResolved(input,"companyId");if(!isExactNumericId(id))throw new ApiResponseError(`\u53D6\u5F15\u5148 ID \u3092\u30D1\u30B9\u306B\u4F7F\u3048\u307E\u305B\u3093: ${id}\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);return`${CUSTOMERS_PATH}/${id}/${kind}`}function singleId(input,label,usage,listHint){const[raw,...rest]=input.args;if(raw===void 0||
|
|
56
|
+
raw.trim()==="")throw new UsageError(`${label}\u306E ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,usage);if(rest.length>0)throw new UsageError(`\u53D7\u3051\u53D6\u308C\u308B${label}\u306E ID \u306F1\u3064\u3060\u3051\u3067\u3059: ${rest.join(" ")}`,usage);const id=raw.trim();if(!isSafePathSegment(id))throw new UsageError(`${label}\u306E ID \u3068\u3057\u3066\u4F7F\u3048\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: ${id}`,listHint);return id}function noArgs(input,op,usage){
|
|
57
|
+
if(input.args.length>0)throw new UsageError(`${op} \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,usage)}function itemsOf(body,what){const items=isRecord(body)?body["items"]:void 0;if(!isRecord(body)||body["result"]!==true||!Array.isArray(items)||!items.every(isRecord)){throw new ApiResponseError(`${what}\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`)}
|
|
58
|
+
return items}var docUsage=op=>usageOf("contract",op);var docId=(input,op)=>singleId(input,"\u66F8\u985E",docUsage(op),"twp customer contract list \u306E document_id \u5217\u306E\u5024\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");var docPath=(input,op)=>`${companyBase(input,"contract-documents")}/${encodeURIComponent(docId(input,op))}`;function contractOf(body,what){const doc=isRecord(body)?body["contract_document"]:void 0;if(!isRecord(body)||body["result"]!==true||!isRecord(doc)||
|
|
59
|
+
typeof doc["document_id"]!=="string"){throw new ApiResponseError(`${what}\u306E\u5FDC\u7B54\u306B contract_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 versionsOf(doc){const versions=doc["versions"];return Array.isArray(versions)?versions.filter(isRecord):[]}function localPdf(input,usage){const{file,size}=inspectLocalFile(input.flags.get(FILE_FLAG.name),FILE_FLAG.name,usage);const name=path.
|
|
60
|
+
basename(file);if(!/\.pdf$/i.test(name)){throw new UsageError(`\u5951\u7D04\u66F8\u306F PDF \u3060\u3051\u3092\u767B\u9332\u3067\u304D\u307E\u3059\uFF08\u30D5\u30A1\u30A4\u30EB\u540D\u304C .pdf \u3067\u7D42\u308F\u3063\u3066\u3044\u307E\u305B\u3093\uFF09: ${file}`)}if(Array.from(name).length>FILE_NAME_MAX_CHARS){throw new UsageError(`\u30D5\u30A1\u30A4\u30EB\u540D\u306F ${FILE_NAME_MAX_CHARS} \u6587\u5B57\u307E\u3067\u3067\u3059\uFF08${Array.from(name).length} \u6587\u5B57\uFF09: ${name}`)}const head=Buffer.
|
|
61
|
+
alloc(PDF_MAGIC.length);try{const fd=fs.openSync(file,"r");try{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${FILE_FLAG.name}\uFF09: ${file}\uFF08${err.code??err.message}\uFF09`)}if(head.toString("latin1")!==PDF_MAGIC){throw new UsageError(`\u6709\u52B9\u306A PDF \u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u5148\u982D\u304C ${PDF_MAGIC} \u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09: ${file}`)}
|
|
62
|
+
return{file,name,size}}function uploadUrlPlan(input){return{method:"POST",path:`${companyBase(input,"contract-documents")}/upload-url`,body:{file_name:requireResolved(input,"fileName"),file_size:Number(requireResolved(input,"fileSize"))}}}function issuedPdf(body){const uploadUrl=isRecord(body)?body["upload_url"]:void 0;const uploadKey=isRecord(body)?body["upload_key"]:void 0;const contentType=isRecord(body)?body["content_type"]:void 0;if(typeof uploadUrl!=="string"||!/^https:\/\//.test(uploadUrl)||
|
|
63
|
+
typeof uploadKey!=="string"||uploadKey===""||typeof contentType!=="string"||contentType===""){throw new ApiResponseError("\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9URL\u767A\u884C\u306E\u5FDC\u7B54\u306B upload_url / upload_key / content_type \u304C\u3042\u308A\u307E\u305B\u3093\u3002\u63A5\u7D9A\u5148\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002")}return{uploadUrl,uploadKey,contentType}}async function uploadPdf(input,ctx,retry,register){const file=requireResolved(input,"file");const size=Number(
|
|
64
|
+
requireResolved(input,"fileSize"));await checkUploadQuota(ctx,size);const{uploadUrl,uploadKey,contentType}=issuedPdf(await ctx.send(uploadUrlPlan(input)));let registerSent=false;try{const bytes=fs.readFileSync(file);if(bytes.byteLength!==size){throw new UsageError(`\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u306E\u5927\u304D\u3055\u304C\u5909\u308F\u308A\u307E\u3057\u305F\uFF08${size} \u2192 ${bytes.byteLength} \u30D0\u30A4\u30C8\uFF09: ${file}`)}await ctx.putSigned(
|
|
65
|
+
uploadUrl,bytes,contentType);registerSent=true;return await register(uploadKey)}catch(err){const refused=err instanceof ApiError&&err.status>=400&&err.status<500||err instanceof NotLoggedInError||err instanceof SessionExpiredError;ctx.warn(registerSent&&!refused?`\u5951\u7D04\u66F8\u306E\u767B\u9332\u306F\u9001\u4FE1\u3057\u307E\u3057\u305F\u304C\u3001\u6210\u529F\u3092\u78BA\u304B\u3081\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u6253\u3061\u76F4\u3059\u524D\u306B ${retry} \u3067\u767B\u9332\u3055\u308C\u305F\u304B\u3092\u78BA\u304B\
|
|
66
|
+
\u3081\u3066\u304F\u3060\u3055\u3044\uFF08\u4E8C\u91CD\u306B\u767B\u9332\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\uFF09\u3002
|
|
67
|
+
`:`\u5951\u7D04\u66F8\u306F\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\uFF08${registerSent?"\u30B5\u30FC\u30D0\u304C\u767B\u9332\u3092\u65AD\u308A\u307E\u3057\u305F\u3002":""}\u9001\u3063\u305F PDF \u306F\u66F8\u985E\u3068\u3057\u3066\u6210\u7ACB\u3057\u3066\u3044\u306A\u3044\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3067\u3001\u3069\u306E\u4E00\u89A7\u306B\u3082\u51FA\u307E\u305B\u3093\uFF09\u3002\u539F\u56E0\u3092\u53D6\u308A\u9664\u3044\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u540C\u3058\u30B3\u30DE\u30F3\u30C9\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
68
|
+
`);throw err}}async function preparePdf(input,ctx,op){const pdf=localPdf(input,docUsage(op));const prepared=await prepareCustomerFlag(input,ctx,docUsage(op));return withResolved(prepared,{file:pdf.file,fileName:pdf.name,fileSize:String(pdf.size)})}var CONTRACT_EDIT_FORBIDDEN=childForbidden("\u5951\u7D04\u66F8","edit");async function createContract(input,ctx){const body=fieldBody(input,CONTRACT_FIELDS);return uploadPdf(input,ctx,`twp customer contract list --customer ${requireResolved(input,"comp\
|
|
69
|
+
anyId")}`,async uploadKey=>{const created=contractOf(await ctx.send({method:"POST",path:companyBase(input,"contract-documents"),body:{...body,upload_key:uploadKey,file_name:requireResolved(input,"fileName")}}),"\u5951\u7D04\u66F8\u306E\u767B\u9332");return{result:true,contract_document:created}})}async function addVersion(input,ctx){const target=docPath(input,"add-version");const before=contractOf(await ctx.send({method:"GET",path:target}),"\u5951\u7D04\u66F8");const previous=typeof before["curr\
|
|
70
|
+
ent_version"]==="number"?before["current_version"]:0;return uploadPdf(input,ctx,`twp customer contract get ${docId(input,"add-version")} --customer ${requireResolved(input,"companyId")}`,async uploadKey=>{const after=contractOf(await ctx.send({method:"POST",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(
|
|
71
|
+
`\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`)}return{result:true,contract_document:after}})}function contractSummary(body,what){const doc=contractOf(body,what);return{...pick(doc,CONTRACT_COLUMNS),versions:versionsOf(doc).length}}var contractResource={
|
|
72
|
+
name:"contract",summary:"\u9867\u5BA2\u306E\u5951\u7D04\u66F8\uFF08\u4E00\u89A7\u30FB\u8A73\u7D30\u30FBPDF \u306E\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:"\u9867\u5BA2\u306E\u5951\u7D04\u66F8\u3092\u4E00\u89A7\u3059\u308B",usage:"twp customer contract list --customer <\u9867\u5BA2>",description:`\u9867\u5BA2\u306B\u767B\u9332\u3055\u308C\u305F\u5951\u7D04\u66F8\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
|
|
73
|
+
\u898B\u7A4D\u306B\u7D10\u3065\u304F\u6848\u4EF6\u66F8\u985E\u306F\u542B\u307F\u307E\u305B\u3093\uFF08twp customer case-document list\uFF09\u3002
|
|
74
|
+
|
|
75
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
76
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${CONTRACT_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002`,flags:[CUSTOMER_FLAG],forbidden:VIEW_FORBIDDEN2("\u5951\u7D04\u66F8"),async prepare(input,ctx){noArgs(input,"list",docUsage("list"));return prepareCustomerFlag(input,ctx,docUsage("list"))},plan:input=>({method:"GET",path:companyBase(input,"contract-documents")}),summarize:body=>itemsOf(body,"\u5951\u7D04\u66F8\u4E00\u89A7").map(row=>pick(row,CONTRACT_COLUMNS)),raw:body=>itemsOf(body,
|
|
77
|
+
"\u5951\u7D04\u66F8\u4E00\u89A7")},{name:"get",summary:"\u5951\u7D04\u66F81\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B\uFF08\u73FE\u884C\u7248\u30FB\u904E\u53BB\u7248\u3092\u542B\u3080\uFF09",usage:"twp customer contract get <\u66F8\u985EID> --customer <\u9867\u5BA2>",description:`${CONTRACT_REF_HELP}
|
|
78
|
+
|
|
79
|
+
--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
|
|
80
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${CONTRACT_COLUMNS.join(" / ")} / versions\uFF1D\u7248\u306E\u6570\uFF09\u3067\u3059\u3002
|
|
81
|
+
\u7248\u3054\u3068\u306E\u5217\u306F ${VERSION_COLUMNS.join(" / ")} \u3067\u3059\uFF08--output json\uFF09\u3002`,flags:[CUSTOMER_FLAG],forbidden:VIEW_FORBIDDEN2("\u5951\u7D04\u66F8"),async prepare(input,ctx){docId(input,"get");return prepareCustomerFlag(input,ctx,docUsage("get"))},plan:input=>({method:"GET",path:docPath(input,"get")}),summarize:body=>contractSummary(body,"\u5951\u7D04\u66F8"),raw:body=>contractOf(body,"\u5951\u7D04\u66F8")},{name:"create",summary:"PDF \u3092\u9867\u5BA2\u306E\u5951\u7D04\u66F8\u3068\u3057\u3066\u767B\u9332\u3059\u308B\uFF08\u5BB9\u91CF\u691C\u67FB\u30FB\u8EE2\u9001\u30FB\u767B\u9332\u30921\
|
|
82
|
+
\u30B3\u30DE\u30F3\u30C9\u3067\uFF09",usage:"twp customer contract create --customer <\u9867\u5BA2> --file <\u30D1\u30B9.pdf> --type <\u7A2E\u5225> --name <\u66F8\u985E\u540D>",description:`--customer\u30FB--file\u30FB--type\uFF08${CONTRACT_TYPE_HELP}\uFF09\u30FB--name \u304C\u5FC5\u9808\u3067\u3059\u3002
|
|
83
|
+
|
|
84
|
+
\u6B21\u306E\u9806\u306B\u9001\u308A\u307E\u3059\u3002
|
|
85
|
+
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
|
|
86
|
+
1. POST \u2026/contract-documents/upload-url\uFF08\u7F72\u540DURL\u306E\u767A\u884C\uFF09
|
|
87
|
+
2. \u7F72\u540DURL\u3078 PUT\uFF08PDF \u672C\u4F53\u3002TWP \u306E\u8A8D\u8A3C\u60C5\u5831\u306F\u9001\u308A\u307E\u305B\u3093\uFF09
|
|
88
|
+
3. POST \u2026/contract-documents\uFF08\u66F8\u985E\u306E\u767B\u9332\u3002\u3053\u3053\u3067\u5951\u7D04\u66F8\u304C\u6210\u7ACB\u3057\u307E\u3059\uFF09
|
|
89
|
+
PDF \u4EE5\u5916\uFF08\u30D5\u30A1\u30A4\u30EB\u540D\u304C .pdf \u3067\u7D42\u308F\u3089\u306A\u3044\u30FB\u4E2D\u8EAB\u306E\u5148\u982D\u304C %PDF- \u3067\u306A\u3044\uFF09\u306F\u3001\u4F55\u3082\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059\uFF08\u30B5\u30FC\u30D0\u3082\u540C\u3058\u6761\u4EF6\u3067\u65AD\u308A\u307E\u3059\uFF09\u3002
|
|
90
|
+
--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
|
|
91
|
+
\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:[CUSTOMER_FLAG,FILE_FLAG,...createFlags(CONTRACT_FIELDS)],forbidden:CONTRACT_EDIT_FORBIDDEN,async prepare(input,ctx){noArgs(input,"create",docUsage("create"));fieldBody(input,CONTRACT_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`,
|
|
92
|
+
docUsage("create"))}return preparePdf(input,ctx,"create")},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\u3066\u304B\u3089\u3001POST ${companyBase(input,"contract-documents")} \u3067\u5951\u7D04\u66F8\u3092\u767B\u9332\u3057\u307E\u3059\u3002`],
|
|
93
|
+
execute:createContract,summarize:body=>contractSummary(body,"\u5951\u7D04\u66F8\u306E\u767B\u9332"),raw:body=>contractOf(body,"\u5951\u7D04\u66F8\u306E\u767B\u9332")},{name:"add-version",summary:"\u5951\u7D04\u66F8\u306B\u65B0\u3057\u3044\u7248\u306E PDF \u3092\u767B\u9332\u3059\u308B\uFF08\u5DEE\u66FF\u3048\u3002\u904E\u53BB\u7248\u306F\u6B8B\u308A\u307E\u3059\uFF09",usage:"twp customer contract add-version <\u66F8\u985EID> --customer <\u9867\u5BA2> --file <\u30D1\u30B9.pdf>",description:`${CONTRACT_REF_HELP}\
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
\u66F8\u985E\u304C\u3053\u306E\u9867\u5BA2\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
|
|
97
|
+
\u767B\u9332\u3057\u305F PDF \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\uFF08twp customer contract get \u306E versions\uFF09\u3002
|
|
98
|
+
\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
|
|
99
|
+
PDF \u4EE5\u5916\u306F\u4F55\u3082\u9001\u3089\u305A\u306B\u6B62\u3081\u307E\u3059\u3002--dry-run \u306F\u7F72\u540DURL\u306E\u767A\u884C\u3060\u3051\u3092\u8868\u793A\u3057\u307E\u3059\u3002
|
|
100
|
+
\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:[CUSTOMER_FLAG,FILE_FLAG],forbidden:CONTRACT_EDIT_FORBIDDEN,async prepare(input,ctx){docId(input,"add-version");return preparePdf(input,ctx,"add-version")},plan:uploadUrlPlan,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(
|
|
101
|
+
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=>contractSummary(body,"\u7248\u306E\u5DEE\u66FF\u3048"),raw:body=>contractOf(body,"\u7248\u306E\u5DEE\u66FF\u3048")},{name:"update",summary:"\u5951\u7D04\u66F8\u306E\u66F8\u985E\u540D\u30FB\u7A2E\u5225\u3092\u5909\u66F4\u3059\u308B\uFF08PDF \u306F\u5909\u308F\u308A\u307E\u305B\u3093\uFF09",
|
|
102
|
+
usage:"twp customer contract update <\u66F8\u985EID> --customer <\u9867\u5BA2> [--name <\u66F8\u985E\u540D>] [--type <\u7A2E\u5225>]",description:`${CONTRACT_REF_HELP}
|
|
103
|
+
|
|
104
|
+
\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
|
|
105
|
+
PDF \u3092\u5DEE\u3057\u66FF\u3048\u308B\u306A\u3089 twp customer contract add-version \u3092\u4F7F\u3044\u307E\u3059\u3002`,flags:[CUSTOMER_FLAG,...updateFlags(CONTRACT_FIELDS)],forbidden:CONTRACT_EDIT_FORBIDDEN,async prepare(input,ctx){if(!hasAnyField(input,CONTRACT_FIELDS))throw new UsageError("\u5909\u66F4\u3059\u308B\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",docUsage("update"));fieldBody(input,CONTRACT_FIELDS);docId(input,"update");return prepareCustomerFlag(
|
|
106
|
+
input,ctx,docUsage("update"))},plan:input=>({method:"PUT",path:docPath(input,"update"),body:fieldBody(input,CONTRACT_FIELDS)}),summarize:body=>contractSummary(body,"\u5951\u7D04\u66F8\u306E\u66F4\u65B0"),raw:body=>contractOf(body,"\u5951\u7D04\u66F8\u306E\u66F4\u65B0")},{name:"delete",summary:"\u5951\u7D04\u66F8\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 customer contract delete\
|
|
107
|
+
<\u66F8\u985EID> --customer <\u9867\u5BA2> --yes",description:`${CONTRACT_REF_HELP}
|
|
108
|
+
|
|
109
|
+
\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
|
|
110
|
+
\u9867\u5BA2\uFF08\u53D6\u5F15\u5148\uFF09\u3092\u524A\u9664\u3059\u308B\u524D\u306B\u3001\u305D\u306E\u9867\u5BA2\u306E\u5951\u7D04\u66F8\u3092\u6D88\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u6B8B\u3063\u3066\u3044\u308B\u3068\u30B5\u30FC\u30D0\u304C\u9867\u5BA2\u306E\u524A\u9664\u3092\u65AD\u308A\u307E\u3059\uFF09\u3002`,destructive:true,flags:[CUSTOMER_FLAG],forbidden:childForbidden("\u5951\u7D04\u66F8","delete"),async prepare(input,ctx){docId(input,"delete");return prepareCustomerFlag(
|
|
111
|
+
input,ctx,docUsage("delete"))},plan:input=>({method:"DELETE",path:docPath(input,"delete")}),summarize:body=>acknowledgement(body,"\u5951\u7D04\u66F8\u524A\u9664"),raw:body=>acknowledgement(body,"\u5951\u7D04\u66F8\u524A\u9664")},{name:"download",summary:"\u5951\u7D04\u66F8\u306E PDF \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 customer contract download <\u66F8\u985EID> --customer <\u9867\
|
|
112
|
+
\u5BA2> --out <\u30D1\u30B9> [--rev <\u7248\u756A\u53F7>] [--force]",description:`${CONTRACT_REF_HELP}
|
|
113
|
+
|
|
114
|
+
\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
|
|
115
|
+
\u904E\u53BB\u7248\u306F --rev \u3067\u7248\u756A\u53F7\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF08twp customer contract get \u306E versions \u306E version_number\uFF09\u3002`,flags:[CUSTOMER_FLAG,OUT_FLAG,REV_FLAG,FORCE_FLAG],forbidden:VIEW_FORBIDDEN2("\u5951\u7D04\u66F8"),download:{outFlag:OUT_FLAG.name,forceFlag:FORCE_FLAG.name},async prepare(input,ctx){docId(input,"download");revOf(input);return prepareCustomerFlag(input,ctx,docUsage("download"))},plan:input=>({method:"GET",path:`${docPath(input,
|
|
116
|
+
"download")}/download`,query:{version:revOf(input)}}),summarize:body=>body,raw:body=>body}]};function revOf(input){const raw=input.flags.get(REV_FLAG.name);if(raw===void 0)return void 0;const value=/^\d+$/.test(raw.trim())?Number(raw.trim()):Number.NaN;if(!Number.isSafeInteger(value)||value<1)throw new UsageError(`--rev \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${raw}`,docUsage("download"));return value}var caseDocumentResource={name:"case-doc\
|
|
117
|
+
ument",summary:"\u9867\u5BA2\u306E\u6848\u4EF6\u66F8\u985E\uFF08\u898B\u7A4D\u3092\u307E\u305F\u3044\u3060\u4E00\u89A7\u306E\u307F\uFF09",operations:[{name:"list",summary:"\u9867\u5BA2\u306E\u6848\u4EF6\u66F8\u985E\u3092\u898B\u7A4D\u3092\u307E\u305F\u3044\u3067\u4E00\u89A7\u3059\u308B",usage:"twp customer case-document list --customer <\u9867\u5BA2>",description:`\u9867\u5BA2\u306E\u3059\u3079\u3066\u306E\u898B\u7A4D\u306B\u7D10\u3065\u304F\u6848\u4EF6\u66F8\u985E\u3092\u8FD4\u3057\u307E\u3059\uFF08\u3053\u306E API \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3092\u6301\u3061\u307E\u305B\u3093\uFF09\u3002
|
|
118
|
+
\u767B\u9332\u30FB\u5DEE\u66FF\u3048\u30FB\u524A\u9664\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306F\u898B\u7A4D\u3054\u3068\u306E\u64CD\u4F5C\u3067\u3001\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3067\u306F\u6271\u3044\u307E\u305B\u3093\u3002
|
|
119
|
+
|
|
120
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
121
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${CASE_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002`,flags:[CUSTOMER_FLAG],forbidden:VIEW_FORBIDDEN2("\u6848\u4EF6\u66F8\u985E"),async prepare(input,ctx){noArgs(input,"list",usageOf("case-document","list"));return prepareCustomerFlag(input,ctx,usageOf("case-document","list"))},plan:input=>({method:"GET",path:companyBase(input,"case-documents")}),summarize:body=>itemsOf(body,"\u6848\u4EF6\u66F8\u985E\u4E00\u89A7").map(row=>pick(row,CASE_COLUMNS)),
|
|
122
|
+
raw:body=>itemsOf(body,"\u6848\u4EF6\u66F8\u985E\u4E00\u89A7")}]};var CAMPAIGNS_PATH=`${CUSTOMERS_PATH}/campaigns`;var CAMPAIGN_COLUMNS=["id","name","description","sort_order","is_active","updated_at"];var CAMPAIGN_FIELDS=[{kind:"text",flag:"--name",key:"name",label:"\u65BD\u7B56\u540D",maxChars:255,summary:"\u65BD\u7B56\u540D\uFF08create \u3067\u306F\u5FC5\u9808\uFF09"},{kind:"text",flag:"--description",key:"description",label:"\u8AAC\u660E",maxChars:1e3,summary:"\u8AAC\u660E\uFF081,000 \u6587\u5B57\u307E\u3067\uFF09"},
|
|
123
|
+
{kind:"integer",flag:"--sort-order",key:"sort_order",label:"\u4E26\u3073\u9806",min:0,summary:"\u4E26\u3073\u9806\uFF080 \u4EE5\u4E0A\u306E\u6574\u6570\u3002\u5C0F\u3055\u3044\u307B\u3069\u5148\uFF09"},{kind:"boolean",flag:"--active",key:"is_active",summary:"\u6709\u52B9\u306B\u3059\u308B\u304B\uFF08true / false\uFF09"}];var campaignUsage=op=>usageOf("campaign",op);var campaignId=(input,op)=>singleId(input,"\u65BD\u7B56",campaignUsage(op),"twp customer campaign list \u306E id \u5217\u306E\u5024\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
124
|
+
var campaignPath=(input,op)=>`${CAMPAIGNS_PATH}/${encodeURIComponent(campaignId(input,op))}`;var CAMPAIGN_ADMIN_FORBIDDEN=levelForbidden(CUSTOMER_LICENSE,"\u65BD\u7B56\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\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\u3002\u30C6\u30CA\u30F3\u30C8\u7BA1\u7406\u8005\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002");function campaignOf(body,what){
|
|
125
|
+
const data=isRecord(body)?body["data"]:void 0;if(!isRecord(body)||body["result"]!==true||!isRecord(data)||typeof data["id"]!=="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}var campaignResource={name:"campaign",summary:"\u65BD\u7B56\uFF08\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\uFF09\u30DE\u30B9\u30BF\u306E\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF08\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\u306F\u7BA1\u7406\u8005\u306E\u307F\uFF09",
|
|
126
|
+
operations:[{name:"list",summary:"\u65BD\u7B56\u3092\u4E26\u3073\u9806\u306B\u4E00\u89A7\u3059\u308B",usage:"twp customer campaign list [--keyword <\u8A9E>] [--active true|false]",description:`\u65BD\u7B56\u3092\u4E26\u3073\u9806\uFF08sort_order\uFF09\u306E\u6607\u9806\u306B\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u5168\u4EF6\u3092\u8FD4\u3057\u307E\u3059\uFF08\u3053\u306E API \u306F\u30DA\u30FC\u30B8\u30F3\u30B0\u3092\u6301\u3061\u307E\u305B\u3093\uFF09\u3002
|
|
127
|
+
--keyword \u306F\u65BD\u7B56\u540D\u30FB\u8AAC\u660E\u306E\u90E8\u5206\u4E00\u81F4\u3067\u3059\u3002--active \u3067\u6709\u52B9\u30FB\u7121\u52B9\u3092\u7D5E\u308A\u8FBC\u307F\u307E\u3059\u3002
|
|
128
|
+
\u65BD\u7B56\u306E ID \u306F\u3001\u62C5\u5F53\u8005\u30FB\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u306E\u7D5E\u308A\u8FBC\u307F\uFF08twp customer people list --campaign / twp prospect list --campaign\uFF09\u306B\u4F7F\u3044\u307E\u3059\u3002
|
|
129
|
+
|
|
130
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
131
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${CAMPAIGN_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002`,flags:[{name:"--keyword",summary:"\u65BD\u7B56\u540D\u30FB\u8AAC\u660E\u306E\u90E8\u5206\u4E00\u81F4\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<\u8A9E>"},{name:"--active",summary:"\u6709\u52B9\uFF08true\uFF09\u30FB\u7121\u52B9\uFF08false\uFF09\u3067\u7D5E\u308A\u8FBC\u3080",takesValue:true,placeholder:"<true|false>"}],forbidden:VIEW_FORBIDDEN2("\u65BD\u7B56"),plan(input){
|
|
132
|
+
noArgs(input,"list",campaignUsage("list"));const active=input.flags.get("--active");return{method:"GET",path:CAMPAIGNS_PATH,query:{keyword:nonEmpty(input.flags,"--keyword"),is_active:active===void 0?void 0:booleanText("--active",active)?"1":"0"}}},summarize:body=>itemsOf(body,"\u65BD\u7B56\u4E00\u89A7").map(row=>pick(row,CAMPAIGN_COLUMNS)),raw:body=>itemsOf(body,"\u65BD\u7B56\u4E00\u89A7")},{name:"get",summary:"\u65BD\u7B561\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B",usage:"twp custo\
|
|
133
|
+
mer campaign get <\u65BD\u7B56ID>",description:"\u65BD\u7B56\u306E ID \u306F twp customer campaign list \u306E id \u5217\u306E\u5024\u3067\u3059\u3002",flags:[],forbidden:VIEW_FORBIDDEN2("\u65BD\u7B56"),plan:input=>({method:"GET",path:campaignPath(input,"get")}),summarize:body=>pick(campaignOf(body,"\u65BD\u7B56"),CAMPAIGN_COLUMNS),raw:body=>campaignOf(body,"\u65BD\u7B56")},{name:"create",summary:"\u65BD\u7B56\u3092\u4F5C\u6210\u3059\u308B\uFF08\u9867\u5BA2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306E\u307F\uFF09",
|
|
134
|
+
usage:"twp customer campaign create --name <\u65BD\u7B56\u540D> [--description <\u8AAC\u660E>] [--sort-order <\u6574\u6570>] [--active true|false]",description:"--name \u304C\u5FC5\u9808\u3067\u3059\u3002\u4F5C\u6210\u3057\u305F\u65BD\u7B56\u306E ID \u304C\u8FD4\u308A\u307E\u3059\u3002",flags:createFlags(CAMPAIGN_FIELDS),forbidden:CAMPAIGN_ADMIN_FORBIDDEN,plan(input){noArgs(input,"create",campaignUsage("create"));if(!input.flags.has("--name"))throw new UsageError("--name \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
135
|
+
campaignUsage("create"));return{method:"POST",path:CAMPAIGNS_PATH,body:fieldBody(input,CAMPAIGN_FIELDS)}},summarize:body=>pick(campaignOf(body,"\u65BD\u7B56\u306E\u4F5C\u6210"),CAMPAIGN_COLUMNS),raw:body=>campaignOf(body,"\u65BD\u7B56\u306E\u4F5C\u6210")},{name:"update",summary:"\u65BD\u7B56\u3092\u66F4\u65B0\u3059\u308B\uFF08\u9867\u5BA2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306E\u307F\uFF09",usage:"twp customer campaign update <\u65BD\u7B56ID> [--name <\u65BD\u7B56\u540D>] [--description <\u8AAC\u660E>] [--sort-order <\u6574\u6570>] [--ac\
|
|
136
|
+
tive true|false]",description:"\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",flags:updateFlags(CAMPAIGN_FIELDS),forbidden:CAMPAIGN_ADMIN_FORBIDDEN,plan(input){if(!hasAnyField(input,CAMPAIGN_FIELDS))throw new UsageError("\u5909\u66F4\u3059\u308B\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
137
|
+
campaignUsage("update"));return{method:"PUT",path:campaignPath(input,"update"),body:fieldBody(input,CAMPAIGN_FIELDS)}},summarize:body=>pick(campaignOf(body,"\u65BD\u7B56\u306E\u66F4\u65B0"),CAMPAIGN_COLUMNS),raw:body=>campaignOf(body,"\u65BD\u7B56\u306E\u66F4\u65B0")},{name:"delete",summary:"\u65BD\u7B56\u3092\u524A\u9664\u3059\u308B\uFF08\u9867\u5BA2\u7BA1\u7406\u306E\u7BA1\u7406\u8005\u306E\u307F\u30FB--yes \u304C\u8981\u308B\uFF09",usage:"twp customer campaign delete <\u65BD\u7B56ID> --yes",description:"\
|
|
138
|
+
\u65BD\u7B561\u4EF6\u3092\u524A\u9664\u3057\u307E\u3059\u3002\n\u30B5\u30FC\u30D0\u306F\u62C5\u5F53\u8005\u30FB\u30A2\u30D7\u30ED\u30FC\u30C1\u5148\u304B\u3089\u306E\u53C2\u7167\u3092\u691C\u67FB\u305B\u305A\u306B\u6D88\u3057\u307E\u3059\uFF08\u305D\u308C\u3089\u306B\u4ED8\u3044\u305F\u65BD\u7B56\u306E ID \u306F\u305D\u306E\u307E\u307E\u6B8B\u308A\u307E\u3059\uFF09\u3002\n\u53C2\u7167\u3092\u6B8B\u3057\u305F\u307E\u307E\u6B62\u3081\u308B\u306A\u3089\u3001\u524A\u9664\u3067\u306F\u306A\u304F twp customer campaign update <\u65BD\u7B56ID> --active false \u3067\u7121\u52B9\u306B\u3057\u307E\u3059\u3002",
|
|
139
|
+
destructive:true,flags:[],forbidden:CAMPAIGN_ADMIN_FORBIDDEN,plan:input=>({method:"DELETE",path:campaignPath(input,"delete")}),summarize:body=>acknowledgement(body,"\u65BD\u7B56\u524A\u9664"),raw:body=>acknowledgement(body,"\u65BD\u7B56\u524A\u9664")}]};var customerDocumentSubresources=[contractResource,caseDocumentResource,campaignResource];var LIST_COLUMNS=["id","company_name","company_short_name","customer_flg","supplier_flg","tel"];var COMPANY_GET_COLUMNS=["id","company_name","company_name_kana","company_short_name","company_no","customer_flg","supplier_flg","post_code","address1","address2","address3","tel","website","start_date","end_date"];var COMPANY={name:"company",label:"\u53D6\u5F15\u5148",path:SALES_COMPANIES_PATH,source:"sales",forbidden:licenseForbidden("\u53D6\u5F15\u5148\u3092\u898B\u308B\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\
|
|
140
|
+
\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"),getColumns:COMPANY_GET_COLUMNS};var CUSTOMER={name:"customer",label:"\u9867\u5BA2",path:CUSTOMERS_PATH,source:"customer",forbidden:licenseForbidden(featureLicenseGuidance("\u9867\u5BA2\u7BA1\u7406")),getColumns:[...COMPANY_GET_COLUMNS,"industry","contact_count"]};function envelope(body,what){if(!isRecord(body)||body["\
|
|
141
|
+
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 detail(body,what){const data=envelope(body,what)["data"];if(!isRecord(data)||typeof data["id"]!=="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`)}
|
|
142
|
+
return data}function listOperation2(resource){const paging=pageNumberPaging({label:`${resource.label}\u4E00\u89A7`});const rows=body=>{envelope(body,`${resource.label}\u4E00\u89A7`);return paging.items(body)};const scope=resource.name==="customer"?"\u9867\u5BA2\uFF08\u53D6\u5F15\u5148\u306E\u3046\u3061\u9867\u5BA2\u3068\u3057\u3066\u767B\u9332\u3055\u308C\u305F\u3082\u306E\uFF09\u3092\u767B\u9332\u306E\u65B0\u3057\u3044\u9806\u306B\u4E00\u89A7\u3057\u307E\u3059\u3002\u4ED5\u5165\u5148\u3060\u3051\u306E\u53D6\u5F15\u5148\u306F\u51FA\u307E\u305B\u3093\uFF08twp company list\uFF09\u3002\n":
|
|
143
|
+
"\u53D6\u5F15\u5148\u4F01\u696D\uFF08\u9867\u5BA2\u30FB\u4ED5\u5165\u5148\u306E\u4E21\u65B9\uFF09\u3092\u65B0\u3057\u304F\u767B\u9332\u3057\u305F\u9806\u306B\u4E00\u89A7\u3057\u307E\u3059\u3002\n";return{name:"list",summary:resource.name==="customer"?"\u9867\u5BA2\u3092\u4E00\u89A7\u3059\u308B\uFF08\u767B\u9332\u306E\u65B0\u3057\u3044\u9806\uFF09":"\u53D6\u5F15\u5148\u4F01\u696D\u3092\u4E00\u89A7\u3059\u308B\uFF08\u767B\u9332\u306E\u65B0\u3057\u3044\u9806\uFF09",usage:`twp ${resource.name} list \
|
|
144
|
+
[--keyword <\u8A9E>] [--all] [--limit <\u4EF6\u6570>]`,description:scope+`--keyword \u306F\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u90E8\u5206\u4E00\u81F4\u3067\u3059\u3002
|
|
145
|
+
\u7D5E\u308A\u8FBC\u307F\u5168\u4F53\u306E\u4EF6\u6570\u306F stderr \u306B\u51FA\u307E\u3059\u3002
|
|
146
|
+
|
|
147
|
+
--output json \u306F API \u304C\u8FD4\u3059\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002
|
|
148
|
+
--output table / text / tsv \u306F\u8981\u7D04\u5217\uFF08${LIST_COLUMNS.join(" / ")}\uFF09\u3067\u3059\u3002
|
|
149
|
+
|
|
150
|
+
`+LIST_PAGING_HELP+"\n"+PAGE_NUMBER_PAGING_HELP,flags:[...PAGE_NUMBER_LIST_FLAGS,{name:"--keyword",summary:"\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u8A9E\u3067\u7D5E\u308A\u8FBC\u3080\uFF08\u90E8\u5206\u4E00\u81F4\uFF09",takesValue:true,placeholder:"<\u8A9E>"}],paging,forbidden:resource.forbidden,plan(input){if(input.args.length>0){throw new UsageError(`list \u306F\u4F4D\u7F6E\u5F15\u6570\u3092\u53D6\u308A\u307E\u305B\u3093: ${input.args.join(" ")}`,`twp ${resource.name} lis\
|
|
151
|
+
t help`)}const{page_no,page_limit}=pageNumberQuery(input);return{method:"GET",path:resource.path,query:{keyword:nonEmpty(input.flags,"--keyword"),...STABLE_PAGE_ORDER,page_limit,page_no}}},summarize:body=>rows(body).map(row=>pick(row,LIST_COLUMNS)),raw:rows,notes:body=>[...pageRangeNotes(body),...isRecord(body)&&typeof body["sum"]==="number"?[`\u8A72\u5F53 ${body["sum"]} \u4EF6`]:[]]}}async function prepareGet(input,ctx,resource){const[raw,...rest]=input.args;const usage=`twp ${resource.name} ge\
|
|
152
|
+
t help`;if(raw===void 0||raw.trim()==="")throw new UsageError(`${resource.label}\u306E\u540D\u524D\u304B ID \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`,usage);if(rest.length>0){throw new UsageError(`get \u304C\u53D7\u3051\u53D6\u308C\u308B${resource.label}\u306F1\u3064\u3060\u3051\u3067\u3059: ${rest.join(" ")}`,'\u7A7A\u767D\u3092\u542B\u3080\u540D\u524D\u306F\u5F15\u7528\u7B26\u3067\u56F2\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u4F8B: "\u682A\u5F0F\u4F1A\u793E \u30B5\u30F3\u30D7\u30EB"\uFF09\u3002')}
|
|
153
|
+
const ref=await ctx.resolver.company(raw,{flag:`<${resource.label}>`,source:resource.source});return withResolved(input,{companyId:ref.id})}function getOperation2(resource){const what=resource.label;return{name:"get",summary:`${what}1\u4EF6\u306E\u8A73\u7D30\u3092\u8868\u793A\u3059\u308B`,usage:`twp ${resource.name} get <${what}>`,description:`<${what}> \u306F\u4F01\u696D\u540D\u30FB\u7565\u79F0\u30FB\u30AB\u30CA\u306E\u5B8C\u5168\u4E00\u81F4\u304B ID\uFF08twp ${resource.name} list \u306E id \u5217\u306E\u6570\u5B57\uFF09\u3067\u6307\u5B9A\
|
|
154
|
+
\u3057\u307E\u3059\u3002
|
|
155
|
+
\u540D\u524D\u306F\u30B5\u30FC\u30D0\u306E\u691C\u7D22\u3067\u5019\u88DC\u3092\u5F15\u3044\u3066\u7167\u5408\u3057\u307E\u3059\u3002\u4E00\u81F4\u3057\u306A\u3051\u308C\u3070\u8FD1\u3044\u5019\u88DC\u3092\u51FA\u3057\u3066\u6B62\u307E\u308A\u3001\u540C\u540D\u304C\u8907\u6570\u3042\u308C\u3070 ID \u3067\u6307\u5B9A\u3059\u308B\u3088\u3046\u6C42\u3081\u307E\u3059\u3002
|
|
156
|
+
\u6570\u5B57\u3060\u3051\u306E\u5024\u306F ID \u3068\u3057\u3066\u6271\u3044\u307E\u3059\uFF08\u793E\u540D\u304C\u6570\u5B57\u3060\u3051\u306E\u4F01\u696D\u306F ID \u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09\u3002
|
|
157
|
+
|
|
158
|
+
`+(resource.name==="customer"?"--output json \u306F\u9867\u5BA2\u306E\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u3001\u62C5\u5F53\u8005\u6570\uFF08contact_count\uFF09\u3068\u76F4\u8FD15\u4EF6\u306E\u5BFE\u5FDC\u5C65\u6B74\uFF08recent_interactions\uFF09\u3092\u8DB3\u3057\u3066\u51FA\u3057\u307E\u3059\u3002":"--output json \u306F\u53D6\u5F15\u5148\u306E\u5168\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002"),flags:[],forbidden:resource.forbidden,prepare:(input,ctx)=>prepareGet(input,
|
|
159
|
+
ctx,resource),plan:input=>({method:"GET",path:`${resource.path}/${encodeURIComponent(requireResolved(input,"companyId"))}`}),summarize:body=>pick(detail(body,what),resource.getColumns),raw:body=>detail(body,what)}}function buildDomain(resource,summary){return{name:resource.name,summary,operations:[listOperation2(resource),getOperation2(resource)]}}var companyRead=buildDomain(COMPANY,"");var companyDomain={name:COMPANY.name,summary:"\u53D6\u5F15\u5148\u4F01\u696D\uFF08\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u767B\u9332\u30FB\u66F4\u65B0\u30FB\u524A\u9664\uFF09",
|
|
160
|
+
operations:[...companyRead.operations,...companyWriteOperations]};var customerRead=buildDomain(CUSTOMER,"");var customerDomain={name:CUSTOMER.name,summary:"\u9867\u5BA2\uFF08\u4E00\u89A7\u30FB\u8A73\u7D30\u30FB\u767B\u9332\u30FB\u66F4\u65B0\u30FB\u524A\u9664\u3068\u4E00\u62EC\u524A\u9664\u30FB\u985E\u4F3C\u4F01\u696D\u691C\u7D22\u30FB\u62C5\u5F53\u8005\u30FB\u5BFE\u5FDC\u5C65\u6B74\u30FB\u540D\u523A\u30FB\u4EBA\u7269\u4E00\u89A7\u30FB\u5951\u7D04\u66F8\u30FB\u6848\u4EF6\u66F8\u985E\u30FB\u65BD\u7B56\uFF09",
|
|
161
|
+
operations:[...customerRead.operations,...customerWriteOperations],subresources:[...customerSubresources,peopleResource,...customerDocumentSubresources]};export{companyDomain,customerDomain};
|