@vtecx/vtecxnext 2.0.3 → 2.0.4
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/dist/vtecxnext.d.ts +19 -0
- package/dist/vtecxnext.js +83 -0
- package/package.json +1 -1
package/dist/vtecxnext.d.ts
CHANGED
|
@@ -721,6 +721,25 @@ export declare class VtecxNext {
|
|
|
721
721
|
* @return true
|
|
722
722
|
*/
|
|
723
723
|
getcontent: (uri: string) => Promise<boolean>;
|
|
724
|
+
/**
|
|
725
|
+
* get signed url for upload content
|
|
726
|
+
* @param uri key
|
|
727
|
+
* @return message
|
|
728
|
+
*/
|
|
729
|
+
putcontentSignedUrl: (uri: string) => Promise<any>;
|
|
730
|
+
/**
|
|
731
|
+
* get signed url for upload content and numbering
|
|
732
|
+
* @param parenturi parent key
|
|
733
|
+
* @param extension extension
|
|
734
|
+
* @return numbered key
|
|
735
|
+
*/
|
|
736
|
+
postcontentSignedUrl: (parenturi: string, extension?: string) => Promise<any>;
|
|
737
|
+
/**
|
|
738
|
+
* get signed url for download content
|
|
739
|
+
* @param uri key
|
|
740
|
+
* @return message
|
|
741
|
+
*/
|
|
742
|
+
getcontentSignedUrl: (uri: string) => Promise<any>;
|
|
724
743
|
/**
|
|
725
744
|
* OAuth authorization request to LINE.
|
|
726
745
|
* If the OAuth request is successful, this module retains the redirect information.
|
package/dist/vtecxnext.js
CHANGED
|
@@ -2879,6 +2879,89 @@ class VtecxNext {
|
|
|
2879
2879
|
}
|
|
2880
2880
|
return this.resStatus === 200;
|
|
2881
2881
|
};
|
|
2882
|
+
/**
|
|
2883
|
+
* get signed url for upload content
|
|
2884
|
+
* @param uri key
|
|
2885
|
+
* @return message
|
|
2886
|
+
*/
|
|
2887
|
+
putcontentSignedUrl = async (uri) => {
|
|
2888
|
+
//console.log(`[vtecxnext putcontentSignedUrl] start. uri=${uri} content-type:${req.headers['content-type']} content-length:${req.headers['content-length']}`)
|
|
2889
|
+
// キー入力値チェック
|
|
2890
|
+
checkUri(uri);
|
|
2891
|
+
// vte.cxへリクエスト
|
|
2892
|
+
const method = 'PUT';
|
|
2893
|
+
const url = `${SERVLETPATH_PROVIDER}${uri}?_content&_signedurl`;
|
|
2894
|
+
//console.log(`[vtecxnext putcontentSignedUrl] request. url=${url}`)
|
|
2895
|
+
const headers = { 'Content-Type': this.req.headers.get('content-type') };
|
|
2896
|
+
let response;
|
|
2897
|
+
try {
|
|
2898
|
+
response = await this.requestVtecx(method, url, undefined, headers);
|
|
2899
|
+
}
|
|
2900
|
+
catch (e) {
|
|
2901
|
+
throw newFetchError(e, true);
|
|
2902
|
+
}
|
|
2903
|
+
//console.log(`[vtecxnext putcontentSignedUrl] response. status=${response.status}`)
|
|
2904
|
+
// vte.cxからのset-cookieを転記
|
|
2905
|
+
this.setCookie(response);
|
|
2906
|
+
// レスポンスのエラーチェック
|
|
2907
|
+
await checkVtecxResponse(response);
|
|
2908
|
+
return await getJson(response);
|
|
2909
|
+
};
|
|
2910
|
+
/**
|
|
2911
|
+
* get signed url for upload content and numbering
|
|
2912
|
+
* @param parenturi parent key
|
|
2913
|
+
* @param extension extension
|
|
2914
|
+
* @return numbered key
|
|
2915
|
+
*/
|
|
2916
|
+
postcontentSignedUrl = async (parenturi, extension) => {
|
|
2917
|
+
//console.log(`[vtecxnext postcontentSignedUrl] start. parenturi=${parenturi} content-type:${req.headers['content-type']} content-length:${req.headers['content-length']}`)
|
|
2918
|
+
// キー入力値チェック
|
|
2919
|
+
checkUri(parenturi);
|
|
2920
|
+
// vte.cxへリクエスト
|
|
2921
|
+
const method = 'POST';
|
|
2922
|
+
const url = `${SERVLETPATH_PROVIDER}${parenturi}?_content&_signedurl${extension ? '&_ext=' + extension : ''}`;
|
|
2923
|
+
//console.log(`[vtecxnext postcontentSignedUrl] request. url=${url}`)
|
|
2924
|
+
const headers = { 'Content-Type': this.req.headers.get('content-type') };
|
|
2925
|
+
let response;
|
|
2926
|
+
try {
|
|
2927
|
+
response = await this.requestVtecx(method, url, undefined, headers);
|
|
2928
|
+
}
|
|
2929
|
+
catch (e) {
|
|
2930
|
+
throw newFetchError(e, true);
|
|
2931
|
+
}
|
|
2932
|
+
//console.log(`[vtecxnext postcontentSignedUrl] response. status=${response.status}`)
|
|
2933
|
+
// vte.cxからのset-cookieを転記
|
|
2934
|
+
this.setCookie(response);
|
|
2935
|
+
// レスポンスのエラーチェック
|
|
2936
|
+
await checkVtecxResponse(response);
|
|
2937
|
+
return await getJson(response);
|
|
2938
|
+
};
|
|
2939
|
+
/**
|
|
2940
|
+
* get signed url for download content
|
|
2941
|
+
* @param uri key
|
|
2942
|
+
* @return message
|
|
2943
|
+
*/
|
|
2944
|
+
getcontentSignedUrl = async (uri) => {
|
|
2945
|
+
//console.log(`[vtecxnext getcontentSignedUrl] start. uri=${uri}`)
|
|
2946
|
+
// キー入力値チェック
|
|
2947
|
+
checkUri(uri);
|
|
2948
|
+
// vte.cxへリクエスト
|
|
2949
|
+
const method = 'GET';
|
|
2950
|
+
const url = `${SERVLETPATH_PROVIDER}${uri}?_content&_signedurl`;
|
|
2951
|
+
let response;
|
|
2952
|
+
try {
|
|
2953
|
+
response = await this.requestVtecx(method, url);
|
|
2954
|
+
}
|
|
2955
|
+
catch (e) {
|
|
2956
|
+
throw newFetchError(e, true);
|
|
2957
|
+
}
|
|
2958
|
+
//console.log(`[vtecxnext getcontentSignedUrl] response. status=${response.status}`)
|
|
2959
|
+
// vte.cxからのset-cookieを転記
|
|
2960
|
+
this.setCookie(response);
|
|
2961
|
+
// レスポンスのエラーチェック
|
|
2962
|
+
await checkVtecxResponse(response);
|
|
2963
|
+
return await getJson(response);
|
|
2964
|
+
};
|
|
2882
2965
|
/**
|
|
2883
2966
|
* OAuth authorization request to LINE.
|
|
2884
2967
|
* If the OAuth request is successful, this module retains the redirect information.
|