@vtecx/vtecxnext 1.1.1 → 1.1.3
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 +46 -15
- package/dist/vtecxnext.js +121 -26
- package/package.json +1 -1
package/dist/vtecxnext.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ export declare const rxid: (req: IncomingMessage, res: ServerResponse) => Promis
|
|
|
119
119
|
* @param subtitle subtitle
|
|
120
120
|
* @return true if successful
|
|
121
121
|
*/
|
|
122
|
-
export declare const log: (req: IncomingMessage, res: ServerResponse, message: string, title?: string, subtitle?: string) => Promise<boolean>;
|
|
122
|
+
export declare const log: (req: IncomingMessage | undefined, res: ServerResponse | undefined, message: string, title?: string, subtitle?: string) => Promise<boolean>;
|
|
123
123
|
/**
|
|
124
124
|
* get entry
|
|
125
125
|
* @param req request (for authentication)
|
|
@@ -128,15 +128,23 @@ export declare const log: (req: IncomingMessage, res: ServerResponse, message: s
|
|
|
128
128
|
* @param targetService target service name (for service linkage)
|
|
129
129
|
* @return entry
|
|
130
130
|
*/
|
|
131
|
-
export declare const getEntry: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<any>;
|
|
131
|
+
export declare const getEntry: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<any>;
|
|
132
132
|
/**
|
|
133
|
-
* get
|
|
133
|
+
* get feed
|
|
134
134
|
* @param req request (for authentication)
|
|
135
135
|
* @param res response (for authentication)
|
|
136
136
|
* @param uri key and conditions
|
|
137
137
|
* @return feed (entry array)
|
|
138
138
|
*/
|
|
139
|
-
export declare const getFeed: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<any>;
|
|
139
|
+
export declare const getFeed: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* get feed
|
|
142
|
+
* @param req request (for authentication)
|
|
143
|
+
* @param res response (for authentication)
|
|
144
|
+
* @param uri key and conditions
|
|
145
|
+
* @return feed (entry array). Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
|
|
146
|
+
*/
|
|
147
|
+
export declare const getFeedResponse: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<VtecxResponse>;
|
|
140
148
|
/**
|
|
141
149
|
* get count
|
|
142
150
|
* @param req request (for authentication)
|
|
@@ -144,7 +152,15 @@ export declare const getFeed: (req: IncomingMessage, res: ServerResponse, uri: s
|
|
|
144
152
|
* @param uri key and conditions
|
|
145
153
|
* @return count
|
|
146
154
|
*/
|
|
147
|
-
export declare const count: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<number | null>;
|
|
155
|
+
export declare const count: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<number | null>;
|
|
156
|
+
/**
|
|
157
|
+
* get count
|
|
158
|
+
* @param req request (for authentication)
|
|
159
|
+
* @param res response (for authentication)
|
|
160
|
+
* @param uri key and conditions
|
|
161
|
+
* @return feed. Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
|
|
162
|
+
*/
|
|
163
|
+
export declare const countResponse: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<VtecxResponse>;
|
|
148
164
|
/**
|
|
149
165
|
* register entries
|
|
150
166
|
* @param req request (for authentication)
|
|
@@ -153,7 +169,7 @@ export declare const count: (req: IncomingMessage, res: ServerResponse, uri: str
|
|
|
153
169
|
* @param uri parent key if not specified in entry
|
|
154
170
|
* @return registed entries
|
|
155
171
|
*/
|
|
156
|
-
export declare const post: (req: IncomingMessage, res: ServerResponse, feed: any, uri?: string, targetService?: string) => Promise<any>;
|
|
172
|
+
export declare const post: (req: IncomingMessage | undefined, res: ServerResponse | undefined, feed: any, uri?: string, targetService?: string) => Promise<any>;
|
|
157
173
|
/**
|
|
158
174
|
* update entries
|
|
159
175
|
* @param req request (for authentication)
|
|
@@ -164,7 +180,7 @@ export declare const post: (req: IncomingMessage, res: ServerResponse, feed: any
|
|
|
164
180
|
* @param async Execute asynchronous if this param is true. Valid only if 'isbulk' is true.
|
|
165
181
|
* @return updated entries
|
|
166
182
|
*/
|
|
167
|
-
export declare const put: (req: IncomingMessage, res: ServerResponse, feed: any, isbulk?: boolean, parallel?: boolean, async?: boolean, targetService?: string) => Promise<any>;
|
|
183
|
+
export declare const put: (req: IncomingMessage | undefined, res: ServerResponse | undefined, feed: any, isbulk?: boolean, parallel?: boolean, async?: boolean, targetService?: string) => Promise<any>;
|
|
168
184
|
/**
|
|
169
185
|
* delete entry
|
|
170
186
|
* @param req request (for authentication)
|
|
@@ -173,7 +189,7 @@ export declare const put: (req: IncomingMessage, res: ServerResponse, feed: any,
|
|
|
173
189
|
* @param revision number of revision
|
|
174
190
|
* @return true if successful
|
|
175
191
|
*/
|
|
176
|
-
export declare const deleteEntry: (req: IncomingMessage, res: ServerResponse, uri: string, revision?: number, targetService?: string) => Promise<boolean>;
|
|
192
|
+
export declare const deleteEntry: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, revision?: number, targetService?: string) => Promise<boolean>;
|
|
177
193
|
/**
|
|
178
194
|
* delete folder
|
|
179
195
|
* @param req request (for authentication)
|
|
@@ -182,7 +198,7 @@ export declare const deleteEntry: (req: IncomingMessage, res: ServerResponse, ur
|
|
|
182
198
|
* @param async execute async
|
|
183
199
|
* @return true if successful
|
|
184
200
|
*/
|
|
185
|
-
export declare const deleteFolder: (req: IncomingMessage, res: ServerResponse, uri: string, async?: boolean, targetService?: string) => Promise<boolean>;
|
|
201
|
+
export declare const deleteFolder: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, async?: boolean, targetService?: string) => Promise<boolean>;
|
|
186
202
|
/**
|
|
187
203
|
* allocate numbers
|
|
188
204
|
* @param req request (for authentication)
|
|
@@ -191,7 +207,7 @@ export declare const deleteFolder: (req: IncomingMessage, res: ServerResponse, u
|
|
|
191
207
|
* @param num number to allocate
|
|
192
208
|
* @return allocated numbers. comma separated if multiple.
|
|
193
209
|
*/
|
|
194
|
-
export declare const allocids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number, targetService?: string) => Promise<string>;
|
|
210
|
+
export declare const allocids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, num: number, targetService?: string) => Promise<string>;
|
|
195
211
|
/**
|
|
196
212
|
* add a number
|
|
197
213
|
* @param req request (for authentication)
|
|
@@ -200,7 +216,7 @@ export declare const allocids: (req: IncomingMessage, res: ServerResponse, uri:
|
|
|
200
216
|
* @param num number to add
|
|
201
217
|
* @return added number
|
|
202
218
|
*/
|
|
203
|
-
export declare const addids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number, targetService?: string) => Promise<number | null>;
|
|
219
|
+
export declare const addids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, num: number, targetService?: string) => Promise<number | null>;
|
|
204
220
|
/**
|
|
205
221
|
* get a added number
|
|
206
222
|
* @param req request (for authentication)
|
|
@@ -208,7 +224,7 @@ export declare const addids: (req: IncomingMessage, res: ServerResponse, uri: st
|
|
|
208
224
|
* @param uri key
|
|
209
225
|
* @return added number
|
|
210
226
|
*/
|
|
211
|
-
export declare const getids: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<number | null>;
|
|
227
|
+
export declare const getids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<number | null>;
|
|
212
228
|
/**
|
|
213
229
|
* set a number
|
|
214
230
|
* @param req request (for authentication)
|
|
@@ -217,7 +233,7 @@ export declare const getids: (req: IncomingMessage, res: ServerResponse, uri: st
|
|
|
217
233
|
* @param num number to set
|
|
218
234
|
* @return set number
|
|
219
235
|
*/
|
|
220
|
-
export declare const setids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number, targetService?: string) => Promise<number | null>;
|
|
236
|
+
export declare const setids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, num: number, targetService?: string) => Promise<number | null>;
|
|
221
237
|
/**
|
|
222
238
|
* set a addition range
|
|
223
239
|
* @param req request (for authentication)
|
|
@@ -226,7 +242,7 @@ export declare const setids: (req: IncomingMessage, res: ServerResponse, uri: st
|
|
|
226
242
|
* @param range addition range
|
|
227
243
|
* @return addition range
|
|
228
244
|
*/
|
|
229
|
-
export declare const rangeids: (req: IncomingMessage, res: ServerResponse, uri: string, range: string) => Promise<string>;
|
|
245
|
+
export declare const rangeids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, range: string) => Promise<string>;
|
|
230
246
|
/**
|
|
231
247
|
* get a addition range
|
|
232
248
|
* @param req request (for authentication)
|
|
@@ -234,7 +250,7 @@ export declare const rangeids: (req: IncomingMessage, res: ServerResponse, uri:
|
|
|
234
250
|
* @param uri key
|
|
235
251
|
* @return addition range
|
|
236
252
|
*/
|
|
237
|
-
export declare const getRangeids: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<string>;
|
|
253
|
+
export declare const getRangeids: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string) => Promise<string>;
|
|
238
254
|
/**
|
|
239
255
|
* set feed to session
|
|
240
256
|
* @param req request (for authentication)
|
|
@@ -702,6 +718,12 @@ export declare const deletecontent: (req: IncomingMessage, res: ServerResponse,
|
|
|
702
718
|
* @return true
|
|
703
719
|
*/
|
|
704
720
|
export declare const getcontent: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<boolean>;
|
|
721
|
+
/**
|
|
722
|
+
* get content url.
|
|
723
|
+
* @param uri key
|
|
724
|
+
* @return content url
|
|
725
|
+
*/
|
|
726
|
+
export declare const getcontenturl: (uri: string) => Promise<string>;
|
|
705
727
|
/**
|
|
706
728
|
* add acl
|
|
707
729
|
* @param req request (for authentication)
|
|
@@ -784,6 +806,15 @@ export declare const deleteTotp: (req: IncomingMessage, res: ServerResponse, acc
|
|
|
784
806
|
* @return message
|
|
785
807
|
*/
|
|
786
808
|
export declare const changeTdid: (req: IncomingMessage, res: ServerResponse) => Promise<any>;
|
|
809
|
+
/**
|
|
810
|
+
* response class
|
|
811
|
+
*/
|
|
812
|
+
export declare class VtecxResponse {
|
|
813
|
+
status: number;
|
|
814
|
+
header: any;
|
|
815
|
+
data: any;
|
|
816
|
+
constructor(status: number, header: any, data: any);
|
|
817
|
+
}
|
|
787
818
|
/**
|
|
788
819
|
* Error returned from vte.cx
|
|
789
820
|
*/
|
package/dist/vtecxnext.js
CHANGED
|
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
30
|
-
exports.FetchError = exports.VtecxNextError = exports.changeTdid = exports.deleteTotp = exports.createTotp = exports.getTotpLink = exports.buffer = exports.oauthCallbackLine = exports.oauthLine = exports.removealias = exports.addalias = exports.removeacl = exports.addacl = exports.getcontent = exports.deletecontent = exports.putcontent = exports.savefiles = exports.deleteusers = exports.deleteuser = exports.canceluser = exports.activateusers = exports.activateuser = exports.revokeusers = exports.revokeuser = exports.userstatus = exports.changeaccount_verify = exports.changeaccount = exports.changepassByAdmin = exports.changepass = exports.passreset = exports.adduserByAdmin = exports.adduser = exports.isAdmin = exports.isGroupMember = exports.getGroups = exports.noGroupMember = exports.leaveGroup = exports.joinGroup = exports.getMessageQueue = exports.setMessageQueue = exports.setMessageQueueStatus = exports.pushNotification = exports.sendMail = exports.checkSignature = exports.deleteSignature = void 0;
|
|
29
|
+
exports.toPdf = exports.getBQCsv = exports.getBQ = exports.deleteBQ = exports.postBQ = exports.getPage = exports.pagination = exports.getSessionLong = exports.getSessionString = exports.getSessionEntry = exports.getSessionFeed = exports.deleteSessionLong = exports.deleteSessionString = exports.deleteSessionEntry = exports.deleteSessionFeed = exports.incrementSession = exports.setSessionLong = exports.setSessionString = exports.setSessionEntry = exports.setSessionFeed = exports.getRangeids = exports.rangeids = exports.setids = exports.getids = exports.addids = exports.allocids = exports.deleteFolder = exports.deleteEntry = exports.put = exports.post = exports.countResponse = exports.count = exports.getFeedResponse = exports.getFeed = exports.getEntry = exports.log = exports.rxid = exports.service = exports.isLoggedin = exports.whoami = exports.account = exports.uid = exports.now = exports.logout = exports.loginWithTotp = exports.loginWithRxid = exports.login = exports.sendMessage = exports.checkXRequestedWith = exports.hello = void 0;
|
|
30
|
+
exports.FetchError = exports.VtecxNextError = exports.VtecxResponse = exports.changeTdid = exports.deleteTotp = exports.createTotp = exports.getTotpLink = exports.buffer = exports.oauthCallbackLine = exports.oauthLine = exports.removealias = exports.addalias = exports.removeacl = exports.addacl = exports.getcontenturl = exports.getcontent = exports.deletecontent = exports.putcontent = exports.savefiles = exports.deleteusers = exports.deleteuser = exports.canceluser = exports.activateusers = exports.activateuser = exports.revokeusers = exports.revokeuser = exports.userstatus = exports.changeaccount_verify = exports.changeaccount = exports.changepassByAdmin = exports.changepass = exports.passreset = exports.adduserByAdmin = exports.adduser = exports.isAdmin = exports.isGroupMember = exports.getGroups = exports.noGroupMember = exports.leaveGroup = exports.joinGroup = exports.getMessageQueue = exports.setMessageQueue = exports.setMessageQueueStatus = exports.pushNotification = exports.sendMail = exports.checkSignature = exports.deleteSignature = exports.putSignatures = exports.putSignature = void 0;
|
|
31
31
|
const sqlstring_1 = __importDefault(require("sqlstring"));
|
|
32
32
|
const formidable_1 = __importDefault(require("formidable"));
|
|
33
33
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -42,6 +42,7 @@ exports.hello = hello;
|
|
|
42
42
|
const SERVLETPATH_DATA = '/d';
|
|
43
43
|
const SERVLETPATH_PROVIDER = '/p';
|
|
44
44
|
const SERVLETPATH_OAUTH = '/o';
|
|
45
|
+
const HEADER_NEXTPAGE = 'x-vtecx-nextpage';
|
|
45
46
|
/**
|
|
46
47
|
* X-Requested-With header check.
|
|
47
48
|
* If not specified, set status 417 to the response.
|
|
@@ -404,7 +405,9 @@ const log = async (req, res, message, title, subtitle) => {
|
|
|
404
405
|
}
|
|
405
406
|
//console.log(`[vtecxnext log] response. status=${response.status}`)
|
|
406
407
|
// vte.cxからのset-cookieを転記
|
|
407
|
-
|
|
408
|
+
if (res) {
|
|
409
|
+
setCookie(response, res);
|
|
410
|
+
}
|
|
408
411
|
// レスポンスのエラーチェック
|
|
409
412
|
await checkVtecxResponse(response);
|
|
410
413
|
// 正常処理
|
|
@@ -435,7 +438,9 @@ const getEntry = async (req, res, uri, targetService) => {
|
|
|
435
438
|
}
|
|
436
439
|
//console.log(`[vtecxnext getEntry] response=${response}`)
|
|
437
440
|
// vte.cxからのset-cookieを転記
|
|
438
|
-
|
|
441
|
+
if (res) {
|
|
442
|
+
setCookie(response, res);
|
|
443
|
+
}
|
|
439
444
|
// レスポンスのエラーチェック
|
|
440
445
|
await checkVtecxResponse(response);
|
|
441
446
|
// 戻り値
|
|
@@ -443,7 +448,7 @@ const getEntry = async (req, res, uri, targetService) => {
|
|
|
443
448
|
};
|
|
444
449
|
exports.getEntry = getEntry;
|
|
445
450
|
/**
|
|
446
|
-
* get
|
|
451
|
+
* get feed
|
|
447
452
|
* @param req request (for authentication)
|
|
448
453
|
* @param res response (for authentication)
|
|
449
454
|
* @param uri key and conditions
|
|
@@ -451,6 +456,19 @@ exports.getEntry = getEntry;
|
|
|
451
456
|
*/
|
|
452
457
|
const getFeed = async (req, res, uri, targetService) => {
|
|
453
458
|
//console.log('[vtecxnext getFeed] start.')
|
|
459
|
+
const vtecxRes = await (0, exports.getFeedResponse)(req, res, uri, targetService);
|
|
460
|
+
return vtecxRes.data;
|
|
461
|
+
};
|
|
462
|
+
exports.getFeed = getFeed;
|
|
463
|
+
/**
|
|
464
|
+
* get feed
|
|
465
|
+
* @param req request (for authentication)
|
|
466
|
+
* @param res response (for authentication)
|
|
467
|
+
* @param uri key and conditions
|
|
468
|
+
* @return feed (entry array). Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
|
|
469
|
+
*/
|
|
470
|
+
const getFeedResponse = async (req, res, uri, targetService) => {
|
|
471
|
+
//console.log('[vtecxnext getFeedResponse] start.')
|
|
454
472
|
// キー入力値チェック
|
|
455
473
|
checkUri(uri);
|
|
456
474
|
// vte.cxへリクエスト
|
|
@@ -465,13 +483,21 @@ const getFeed = async (req, res, uri, targetService) => {
|
|
|
465
483
|
}
|
|
466
484
|
//console.log(`[vtecxnext getFeed] response=${response}`)
|
|
467
485
|
// vte.cxからのset-cookieを転記
|
|
468
|
-
|
|
486
|
+
if (res) {
|
|
487
|
+
setCookie(response, res);
|
|
488
|
+
}
|
|
469
489
|
// レスポンスのエラーチェック
|
|
470
490
|
await checkVtecxResponse(response);
|
|
471
491
|
// 戻り値
|
|
472
|
-
|
|
492
|
+
const data = await getJson(response);
|
|
493
|
+
const header = {};
|
|
494
|
+
const nextpage = response.headers.get(HEADER_NEXTPAGE);
|
|
495
|
+
if (nextpage) {
|
|
496
|
+
header[HEADER_NEXTPAGE] = nextpage;
|
|
497
|
+
}
|
|
498
|
+
return new VtecxResponse(response.status, header, data);
|
|
473
499
|
};
|
|
474
|
-
exports.
|
|
500
|
+
exports.getFeedResponse = getFeedResponse;
|
|
475
501
|
/**
|
|
476
502
|
* get count
|
|
477
503
|
* @param req request (for authentication)
|
|
@@ -481,6 +507,21 @@ exports.getFeed = getFeed;
|
|
|
481
507
|
*/
|
|
482
508
|
const count = async (req, res, uri, targetService) => {
|
|
483
509
|
//console.log('[vtecxnext count] start.')
|
|
510
|
+
const vtecxRes = await (0, exports.countResponse)(req, res, uri, targetService);
|
|
511
|
+
// 戻り値
|
|
512
|
+
const data = vtecxRes.data;
|
|
513
|
+
return vtecxRes.data.feed.title ? Number(data.feed.title) : null;
|
|
514
|
+
};
|
|
515
|
+
exports.count = count;
|
|
516
|
+
/**
|
|
517
|
+
* get count
|
|
518
|
+
* @param req request (for authentication)
|
|
519
|
+
* @param res response (for authentication)
|
|
520
|
+
* @param uri key and conditions
|
|
521
|
+
* @return feed. Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
|
|
522
|
+
*/
|
|
523
|
+
const countResponse = async (req, res, uri, targetService) => {
|
|
524
|
+
//console.log('[vtecxnext countResponse] start.')
|
|
484
525
|
// キー入力値チェック
|
|
485
526
|
checkUri(uri);
|
|
486
527
|
// vte.cxへリクエスト
|
|
@@ -495,14 +536,21 @@ const count = async (req, res, uri, targetService) => {
|
|
|
495
536
|
}
|
|
496
537
|
//console.log(`[vtecxnext count] response=${response}`)
|
|
497
538
|
// vte.cxからのset-cookieを転記
|
|
498
|
-
|
|
539
|
+
if (res) {
|
|
540
|
+
setCookie(response, res);
|
|
541
|
+
}
|
|
499
542
|
// レスポンスのエラーチェック
|
|
500
543
|
await checkVtecxResponse(response);
|
|
501
544
|
// 戻り値
|
|
502
545
|
const data = await getJson(response);
|
|
503
|
-
|
|
546
|
+
const header = {};
|
|
547
|
+
const nextpage = response.headers.get(HEADER_NEXTPAGE);
|
|
548
|
+
if (nextpage) {
|
|
549
|
+
header[HEADER_NEXTPAGE] = nextpage;
|
|
550
|
+
}
|
|
551
|
+
return new VtecxResponse(response.status, header, data);
|
|
504
552
|
};
|
|
505
|
-
exports.
|
|
553
|
+
exports.countResponse = countResponse;
|
|
506
554
|
/**
|
|
507
555
|
* register entries
|
|
508
556
|
* @param req request (for authentication)
|
|
@@ -531,7 +579,9 @@ const post = async (req, res, feed, uri, targetService) => {
|
|
|
531
579
|
}
|
|
532
580
|
//console.log(`[vtecxnext post] response. status=${response.status}`)
|
|
533
581
|
// vte.cxからのset-cookieを転記
|
|
534
|
-
|
|
582
|
+
if (res) {
|
|
583
|
+
setCookie(response, res);
|
|
584
|
+
}
|
|
535
585
|
// レスポンスのエラーチェック
|
|
536
586
|
await checkVtecxResponse(response);
|
|
537
587
|
return await getJson(response);
|
|
@@ -568,7 +618,9 @@ const put = async (req, res, feed, isbulk, parallel, async, targetService) => {
|
|
|
568
618
|
}
|
|
569
619
|
//console.log(`[vtecxnext put] response. status=${response.status}`)
|
|
570
620
|
// vte.cxからのset-cookieを転記
|
|
571
|
-
|
|
621
|
+
if (res) {
|
|
622
|
+
setCookie(response, res);
|
|
623
|
+
}
|
|
572
624
|
// レスポンスのエラーチェック
|
|
573
625
|
await checkVtecxResponse(response);
|
|
574
626
|
return await getJson(response);
|
|
@@ -599,7 +651,9 @@ const deleteEntry = async (req, res, uri, revision, targetService) => {
|
|
|
599
651
|
}
|
|
600
652
|
//console.log(`[vtecxnext deleteEntry] response. status=${response.status}`)
|
|
601
653
|
// vte.cxからのset-cookieを転記
|
|
602
|
-
|
|
654
|
+
if (res) {
|
|
655
|
+
setCookie(response, res);
|
|
656
|
+
}
|
|
603
657
|
// レスポンスのエラーチェック
|
|
604
658
|
await checkVtecxResponse(response);
|
|
605
659
|
return true;
|
|
@@ -629,7 +683,9 @@ const deleteFolder = async (req, res, uri, async, targetService) => {
|
|
|
629
683
|
}
|
|
630
684
|
//console.log(`[vtecxnext deleteFolder] response. status=${response.status}`)
|
|
631
685
|
// vte.cxからのset-cookieを転記
|
|
632
|
-
|
|
686
|
+
if (res) {
|
|
687
|
+
setCookie(response, res);
|
|
688
|
+
}
|
|
633
689
|
// レスポンスのエラーチェック
|
|
634
690
|
await checkVtecxResponse(response);
|
|
635
691
|
return true;
|
|
@@ -660,7 +716,9 @@ const allocids = async (req, res, uri, num, targetService) => {
|
|
|
660
716
|
}
|
|
661
717
|
//console.log(`[vtecxnext allocids] response=${response}`)
|
|
662
718
|
// vte.cxからのset-cookieを転記
|
|
663
|
-
|
|
719
|
+
if (res) {
|
|
720
|
+
setCookie(response, res);
|
|
721
|
+
}
|
|
664
722
|
// レスポンスのエラーチェック
|
|
665
723
|
await checkVtecxResponse(response);
|
|
666
724
|
// 戻り値
|
|
@@ -693,7 +751,9 @@ const addids = async (req, res, uri, num, targetService) => {
|
|
|
693
751
|
}
|
|
694
752
|
//console.log(`[vtecxnext addids] response=${response}`)
|
|
695
753
|
// vte.cxからのset-cookieを転記
|
|
696
|
-
|
|
754
|
+
if (res) {
|
|
755
|
+
setCookie(response, res);
|
|
756
|
+
}
|
|
697
757
|
// レスポンスのエラーチェック
|
|
698
758
|
await checkVtecxResponse(response);
|
|
699
759
|
// 戻り値
|
|
@@ -724,7 +784,9 @@ const getids = async (req, res, uri, targetService) => {
|
|
|
724
784
|
}
|
|
725
785
|
//console.log(`[vtecxnext getids] response=${response}`)
|
|
726
786
|
// vte.cxからのset-cookieを転記
|
|
727
|
-
|
|
787
|
+
if (res) {
|
|
788
|
+
setCookie(response, res);
|
|
789
|
+
}
|
|
728
790
|
// レスポンスのエラーチェック
|
|
729
791
|
await checkVtecxResponse(response);
|
|
730
792
|
// 戻り値
|
|
@@ -757,7 +819,9 @@ const setids = async (req, res, uri, num, targetService) => {
|
|
|
757
819
|
}
|
|
758
820
|
//console.log(`[vtecxnext setids] response=${response}`)
|
|
759
821
|
// vte.cxからのset-cookieを転記
|
|
760
|
-
|
|
822
|
+
if (res) {
|
|
823
|
+
setCookie(response, res);
|
|
824
|
+
}
|
|
761
825
|
// レスポンスのエラーチェック
|
|
762
826
|
await checkVtecxResponse(response);
|
|
763
827
|
// 戻り値
|
|
@@ -791,7 +855,9 @@ const rangeids = async (req, res, uri, range) => {
|
|
|
791
855
|
}
|
|
792
856
|
//console.log(`[vtecxnext rangeids] response=${response}`)
|
|
793
857
|
// vte.cxからのset-cookieを転記
|
|
794
|
-
|
|
858
|
+
if (res) {
|
|
859
|
+
setCookie(response, res);
|
|
860
|
+
}
|
|
795
861
|
// レスポンスのエラーチェック
|
|
796
862
|
await checkVtecxResponse(response);
|
|
797
863
|
// 戻り値
|
|
@@ -822,7 +888,9 @@ const getRangeids = async (req, res, uri) => {
|
|
|
822
888
|
}
|
|
823
889
|
//console.log(`[vtecxnext getrangeids] response=${response}`)
|
|
824
890
|
// vte.cxからのset-cookieを転記
|
|
825
|
-
|
|
891
|
+
if (res) {
|
|
892
|
+
setCookie(response, res);
|
|
893
|
+
}
|
|
826
894
|
// レスポンスのエラーチェック
|
|
827
895
|
await checkVtecxResponse(response);
|
|
828
896
|
// 戻り値
|
|
@@ -2640,6 +2708,19 @@ const getcontent = async (req, res, uri) => {
|
|
|
2640
2708
|
return true;
|
|
2641
2709
|
};
|
|
2642
2710
|
exports.getcontent = getcontent;
|
|
2711
|
+
/**
|
|
2712
|
+
* get content url.
|
|
2713
|
+
* @param uri key
|
|
2714
|
+
* @return content url
|
|
2715
|
+
*/
|
|
2716
|
+
const getcontenturl = async (uri) => {
|
|
2717
|
+
//console.log(`[vtecxnext getcontenturl] start. uri=${uri}`)
|
|
2718
|
+
// キー入力値チェック
|
|
2719
|
+
checkUri(uri);
|
|
2720
|
+
// urlを構築
|
|
2721
|
+
return `${VTECX_URL}${SERVLETPATH_DATA}${uri}`;
|
|
2722
|
+
};
|
|
2723
|
+
exports.getcontenturl = getcontenturl;
|
|
2643
2724
|
/**
|
|
2644
2725
|
* add acl
|
|
2645
2726
|
* @param req request (for authentication)
|
|
@@ -2916,6 +2997,20 @@ const changeTdid = async (req, res) => {
|
|
|
2916
2997
|
};
|
|
2917
2998
|
exports.changeTdid = changeTdid;
|
|
2918
2999
|
//---------------------------------------------
|
|
3000
|
+
/**
|
|
3001
|
+
* response class
|
|
3002
|
+
*/
|
|
3003
|
+
class VtecxResponse {
|
|
3004
|
+
status;
|
|
3005
|
+
header;
|
|
3006
|
+
data;
|
|
3007
|
+
constructor(status, header, data) {
|
|
3008
|
+
this.status = status;
|
|
3009
|
+
this.header = header;
|
|
3010
|
+
this.data = data;
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
exports.VtecxResponse = VtecxResponse;
|
|
2919
3014
|
/**
|
|
2920
3015
|
* Error returned from vte.cx
|
|
2921
3016
|
*/
|
|
@@ -2986,6 +3081,9 @@ const requestVtecx = async (method, url, req, body, additionalHeaders, targetSer
|
|
|
2986
3081
|
const fetchVtecx = async (method, url, headers, body, mode) => {
|
|
2987
3082
|
//console.log(`[vtecxnext fetchVtecx] url=${process.env.VTECX_URL}${url}`)
|
|
2988
3083
|
headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
3084
|
+
if (VTECX_SERVICENAME) {
|
|
3085
|
+
headers['X-SERVICENAME'] = VTECX_SERVICENAME;
|
|
3086
|
+
}
|
|
2989
3087
|
const apiKey = process.env.VTECX_APIKEY;
|
|
2990
3088
|
if (apiKey && !url.startsWith(SERVLETPATH_DATA)) {
|
|
2991
3089
|
//headers['Authorization'] = `APIKey ${apiKey}`
|
|
@@ -3016,6 +3114,7 @@ const fetchVtecx = async (method, url, headers, body, mode) => {
|
|
|
3016
3114
|
};
|
|
3017
3115
|
/** vte.cx URL */
|
|
3018
3116
|
const VTECX_URL = process.env.VTECX_URL ?? '';
|
|
3117
|
+
const VTECX_SERVICENAME = process.env.VTECX_SERVICENAME ?? '';
|
|
3019
3118
|
const newFetchError = (e, isVtecx) => {
|
|
3020
3119
|
let errMsg;
|
|
3021
3120
|
if (e instanceof Error) {
|
|
@@ -3050,12 +3149,8 @@ const setCookie = (response, res) => {
|
|
|
3050
3149
|
//console.log(`[vtecxnext setCookie] value : ${setCookieVal}`)
|
|
3051
3150
|
//res.setHeader('set-cookie', setCookieVal)
|
|
3052
3151
|
const setCookieVals = splitCookieValue(setCookieVal);
|
|
3152
|
+
//console.log(`[vtecxnext setCookie] values : ${setCookieVals}`)
|
|
3053
3153
|
res.setHeader('set-cookie', setCookieVals);
|
|
3054
|
-
/*
|
|
3055
|
-
for (const val of setCookieVals) {
|
|
3056
|
-
res.setHeader('set-cookie', val)
|
|
3057
|
-
}
|
|
3058
|
-
*/
|
|
3059
3154
|
}
|
|
3060
3155
|
};
|
|
3061
3156
|
/**
|