@vtecx/vtecxnext 3.0.2 → 3.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 +28 -0
- package/dist/vtecxnext.js +93 -1
- package/package.json +3 -3
package/dist/vtecxnext.d.ts
CHANGED
|
@@ -113,6 +113,10 @@ export interface OAuthUserInfo {
|
|
|
113
113
|
nickname?: string;
|
|
114
114
|
state?: string | string[];
|
|
115
115
|
}
|
|
116
|
+
export interface IndexInfo {
|
|
117
|
+
uri?: string;
|
|
118
|
+
fields?: string[];
|
|
119
|
+
}
|
|
116
120
|
/**
|
|
117
121
|
* vtecxnext.
|
|
118
122
|
* Executes various operations for the vte.cx service.
|
|
@@ -1061,6 +1065,30 @@ export declare class VtecxNext {
|
|
|
1061
1065
|
* @return property value
|
|
1062
1066
|
*/
|
|
1063
1067
|
property: (name: string) => Promise<string | null>;
|
|
1068
|
+
/**
|
|
1069
|
+
* update index.
|
|
1070
|
+
* for service admin function
|
|
1071
|
+
* @param indexInfos update index information
|
|
1072
|
+
*/
|
|
1073
|
+
updateIndex: (indexInfos: IndexInfo[]) => Promise<void>;
|
|
1074
|
+
/**
|
|
1075
|
+
* delete index.
|
|
1076
|
+
* for service admin function
|
|
1077
|
+
* @param indexInfos delete index information
|
|
1078
|
+
*/
|
|
1079
|
+
deleteIndex: (indexInfos: IndexInfo[]) => Promise<void>;
|
|
1080
|
+
/**
|
|
1081
|
+
* convert index informations to argument entry
|
|
1082
|
+
* @param indexInfos index informations
|
|
1083
|
+
* @returns feed
|
|
1084
|
+
*/
|
|
1085
|
+
private convertIndexInfoToEntries;
|
|
1086
|
+
/**
|
|
1087
|
+
* convert index fields to comma-separated string
|
|
1088
|
+
* @param fields index fields
|
|
1089
|
+
* @returns comma-separated string
|
|
1090
|
+
*/
|
|
1091
|
+
private convertIndexFields;
|
|
1064
1092
|
/**
|
|
1065
1093
|
* vte.cxへリクエスト
|
|
1066
1094
|
* @param method メソッド
|
package/dist/vtecxnext.js
CHANGED
|
@@ -461,7 +461,7 @@ class VtecxNext {
|
|
|
461
461
|
logout = async () => {
|
|
462
462
|
//console.log('[vtecxnext logout] start.')
|
|
463
463
|
// vte.cxへリクエスト
|
|
464
|
-
const method = '
|
|
464
|
+
const method = 'POST';
|
|
465
465
|
const url = '/d/?_logout';
|
|
466
466
|
let response;
|
|
467
467
|
try {
|
|
@@ -3886,6 +3886,98 @@ class VtecxNext {
|
|
|
3886
3886
|
const data = await getJson(response);
|
|
3887
3887
|
return data.feed.title;
|
|
3888
3888
|
};
|
|
3889
|
+
/**
|
|
3890
|
+
* update index.
|
|
3891
|
+
* for service admin function
|
|
3892
|
+
* @param indexInfos update index information
|
|
3893
|
+
*/
|
|
3894
|
+
updateIndex = async (indexInfos) => {
|
|
3895
|
+
//console.log('[vtecxnext updateIndex] start.')
|
|
3896
|
+
const feed = this.convertIndexInfoToEntries(indexInfos);
|
|
3897
|
+
// vte.cxへリクエスト
|
|
3898
|
+
const method = 'PUT';
|
|
3899
|
+
const url = `${SERVLETPATH_DATA}/?_updateindex`;
|
|
3900
|
+
let response;
|
|
3901
|
+
try {
|
|
3902
|
+
response = await this.requestVtecx(method, url, JSON.stringify(feed));
|
|
3903
|
+
}
|
|
3904
|
+
catch (e) {
|
|
3905
|
+
throw newFetchError(e, true);
|
|
3906
|
+
}
|
|
3907
|
+
//console.log(`[vtecxnext updateIndex] response=${response}`)
|
|
3908
|
+
// vte.cxからのset-cookieを転記
|
|
3909
|
+
this.setCookie(response);
|
|
3910
|
+
// レスポンスのエラーチェック
|
|
3911
|
+
await checkVtecxResponse(response);
|
|
3912
|
+
// 戻り値
|
|
3913
|
+
return await getJson(response);
|
|
3914
|
+
};
|
|
3915
|
+
/**
|
|
3916
|
+
* delete index.
|
|
3917
|
+
* for service admin function
|
|
3918
|
+
* @param indexInfos delete index information
|
|
3919
|
+
*/
|
|
3920
|
+
deleteIndex = async (indexInfos) => {
|
|
3921
|
+
//console.log('[vtecxnext deleteIndex] start.')
|
|
3922
|
+
const feed = this.convertIndexInfoToEntries(indexInfos);
|
|
3923
|
+
// vte.cxへリクエスト
|
|
3924
|
+
const method = 'PUT';
|
|
3925
|
+
const url = `${SERVLETPATH_DATA}/?_deleteindex`;
|
|
3926
|
+
let response;
|
|
3927
|
+
try {
|
|
3928
|
+
response = await this.requestVtecx(method, url, JSON.stringify(feed));
|
|
3929
|
+
}
|
|
3930
|
+
catch (e) {
|
|
3931
|
+
throw newFetchError(e, true);
|
|
3932
|
+
}
|
|
3933
|
+
//console.log(`[vtecxnext deleteIndex] response=${response}`)
|
|
3934
|
+
// vte.cxからのset-cookieを転記
|
|
3935
|
+
this.setCookie(response);
|
|
3936
|
+
// レスポンスのエラーチェック
|
|
3937
|
+
await checkVtecxResponse(response);
|
|
3938
|
+
// 戻り値
|
|
3939
|
+
return await getJson(response);
|
|
3940
|
+
};
|
|
3941
|
+
/**
|
|
3942
|
+
* convert index informations to argument entry
|
|
3943
|
+
* @param indexInfos index informations
|
|
3944
|
+
* @returns feed
|
|
3945
|
+
*/
|
|
3946
|
+
convertIndexInfoToEntries = (indexInfos) => {
|
|
3947
|
+
const retFeed = [];
|
|
3948
|
+
for (const indexInfo of indexInfos) {
|
|
3949
|
+
const title = this.convertIndexFields(indexInfo.fields);
|
|
3950
|
+
const retEntry = {
|
|
3951
|
+
link: [
|
|
3952
|
+
{
|
|
3953
|
+
___rel: 'self',
|
|
3954
|
+
___href: indexInfo.uri
|
|
3955
|
+
}
|
|
3956
|
+
],
|
|
3957
|
+
title: title
|
|
3958
|
+
};
|
|
3959
|
+
retFeed.push(retEntry);
|
|
3960
|
+
}
|
|
3961
|
+
return retFeed;
|
|
3962
|
+
};
|
|
3963
|
+
/**
|
|
3964
|
+
* convert index fields to comma-separated string
|
|
3965
|
+
* @param fields index fields
|
|
3966
|
+
* @returns comma-separated string
|
|
3967
|
+
*/
|
|
3968
|
+
convertIndexFields = (fields) => {
|
|
3969
|
+
if (fields && fields.length) {
|
|
3970
|
+
let title = '';
|
|
3971
|
+
for (const field of fields) {
|
|
3972
|
+
if (title) {
|
|
3973
|
+
title += ',';
|
|
3974
|
+
}
|
|
3975
|
+
title += fields;
|
|
3976
|
+
}
|
|
3977
|
+
return title;
|
|
3978
|
+
}
|
|
3979
|
+
return undefined;
|
|
3980
|
+
};
|
|
3889
3981
|
//----------------------
|
|
3890
3982
|
/**
|
|
3891
3983
|
* vte.cxへリクエスト
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtecx/vtecxnext",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "vte.cx Next.js api",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/reflexworks/vtecxnext#readme",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^25.
|
|
21
|
+
"@types/node": "^25.2.3",
|
|
22
22
|
"@types/sqlstring": "^2.3.2",
|
|
23
23
|
"ts-node": "^10.9.2",
|
|
24
24
|
"typescript": "^5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"next": "^16.1.
|
|
27
|
+
"next": "^16.1.6",
|
|
28
28
|
"sqlstring": "^2.3.3"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|