@vtecx/vtecxnext 1.1.2 → 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.
@@ -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,7 +128,7 @@ 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
133
  * get feed
134
134
  * @param req request (for authentication)
@@ -136,7 +136,7 @@ export declare const getEntry: (req: IncomingMessage, res: ServerResponse, uri:
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
140
  /**
141
141
  * get feed
142
142
  * @param req request (for authentication)
@@ -144,7 +144,7 @@ export declare const getFeed: (req: IncomingMessage, res: ServerResponse, uri: s
144
144
  * @param uri key and conditions
145
145
  * @return feed (entry array). Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
146
146
  */
147
- export declare const getFeedResponse: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<VtecxResponse>;
147
+ export declare const getFeedResponse: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<VtecxResponse>;
148
148
  /**
149
149
  * get count
150
150
  * @param req request (for authentication)
@@ -152,7 +152,7 @@ export declare const getFeedResponse: (req: IncomingMessage, res: ServerResponse
152
152
  * @param uri key and conditions
153
153
  * @return count
154
154
  */
155
- 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
156
  /**
157
157
  * get count
158
158
  * @param req request (for authentication)
@@ -160,7 +160,7 @@ export declare const count: (req: IncomingMessage, res: ServerResponse, uri: str
160
160
  * @param uri key and conditions
161
161
  * @return feed. Returns a cursor in the header if more data is available. (x-vtecx-nextpage)
162
162
  */
163
- export declare const countResponse: (req: IncomingMessage, res: ServerResponse, uri: string, targetService?: string) => Promise<VtecxResponse>;
163
+ export declare const countResponse: (req: IncomingMessage | undefined, res: ServerResponse | undefined, uri: string, targetService?: string) => Promise<VtecxResponse>;
164
164
  /**
165
165
  * register entries
166
166
  * @param req request (for authentication)
@@ -169,7 +169,7 @@ export declare const countResponse: (req: IncomingMessage, res: ServerResponse,
169
169
  * @param uri parent key if not specified in entry
170
170
  * @return registed entries
171
171
  */
172
- 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>;
173
173
  /**
174
174
  * update entries
175
175
  * @param req request (for authentication)
@@ -180,7 +180,7 @@ export declare const post: (req: IncomingMessage, res: ServerResponse, feed: any
180
180
  * @param async Execute asynchronous if this param is true. Valid only if 'isbulk' is true.
181
181
  * @return updated entries
182
182
  */
183
- 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>;
184
184
  /**
185
185
  * delete entry
186
186
  * @param req request (for authentication)
@@ -189,7 +189,7 @@ export declare const put: (req: IncomingMessage, res: ServerResponse, feed: any,
189
189
  * @param revision number of revision
190
190
  * @return true if successful
191
191
  */
192
- 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>;
193
193
  /**
194
194
  * delete folder
195
195
  * @param req request (for authentication)
@@ -198,7 +198,7 @@ export declare const deleteEntry: (req: IncomingMessage, res: ServerResponse, ur
198
198
  * @param async execute async
199
199
  * @return true if successful
200
200
  */
201
- 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>;
202
202
  /**
203
203
  * allocate numbers
204
204
  * @param req request (for authentication)
@@ -207,7 +207,7 @@ export declare const deleteFolder: (req: IncomingMessage, res: ServerResponse, u
207
207
  * @param num number to allocate
208
208
  * @return allocated numbers. comma separated if multiple.
209
209
  */
210
- 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>;
211
211
  /**
212
212
  * add a number
213
213
  * @param req request (for authentication)
@@ -216,7 +216,7 @@ export declare const allocids: (req: IncomingMessage, res: ServerResponse, uri:
216
216
  * @param num number to add
217
217
  * @return added number
218
218
  */
219
- 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>;
220
220
  /**
221
221
  * get a added number
222
222
  * @param req request (for authentication)
@@ -224,7 +224,7 @@ export declare const addids: (req: IncomingMessage, res: ServerResponse, uri: st
224
224
  * @param uri key
225
225
  * @return added number
226
226
  */
227
- 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>;
228
228
  /**
229
229
  * set a number
230
230
  * @param req request (for authentication)
@@ -233,7 +233,7 @@ export declare const getids: (req: IncomingMessage, res: ServerResponse, uri: st
233
233
  * @param num number to set
234
234
  * @return set number
235
235
  */
236
- 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>;
237
237
  /**
238
238
  * set a addition range
239
239
  * @param req request (for authentication)
@@ -242,7 +242,7 @@ export declare const setids: (req: IncomingMessage, res: ServerResponse, uri: st
242
242
  * @param range addition range
243
243
  * @return addition range
244
244
  */
245
- 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>;
246
246
  /**
247
247
  * get a addition range
248
248
  * @param req request (for authentication)
@@ -250,7 +250,7 @@ export declare const rangeids: (req: IncomingMessage, res: ServerResponse, uri:
250
250
  * @param uri key
251
251
  * @return addition range
252
252
  */
253
- 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>;
254
254
  /**
255
255
  * set feed to session
256
256
  * @param req request (for authentication)
@@ -718,6 +718,12 @@ export declare const deletecontent: (req: IncomingMessage, res: ServerResponse,
718
718
  * @return true
719
719
  */
720
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>;
721
727
  /**
722
728
  * add acl
723
729
  * @param req request (for authentication)
package/dist/vtecxnext.js CHANGED
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
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.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;
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"));
@@ -405,7 +405,9 @@ const log = async (req, res, message, title, subtitle) => {
405
405
  }
406
406
  //console.log(`[vtecxnext log] response. status=${response.status}`)
407
407
  // vte.cxからのset-cookieを転記
408
- setCookie(response, res);
408
+ if (res) {
409
+ setCookie(response, res);
410
+ }
409
411
  // レスポンスのエラーチェック
410
412
  await checkVtecxResponse(response);
411
413
  // 正常処理
@@ -436,7 +438,9 @@ const getEntry = async (req, res, uri, targetService) => {
436
438
  }
437
439
  //console.log(`[vtecxnext getEntry] response=${response}`)
438
440
  // vte.cxからのset-cookieを転記
439
- setCookie(response, res);
441
+ if (res) {
442
+ setCookie(response, res);
443
+ }
440
444
  // レスポンスのエラーチェック
441
445
  await checkVtecxResponse(response);
442
446
  // 戻り値
@@ -479,7 +483,9 @@ const getFeedResponse = async (req, res, uri, targetService) => {
479
483
  }
480
484
  //console.log(`[vtecxnext getFeed] response=${response}`)
481
485
  // vte.cxからのset-cookieを転記
482
- setCookie(response, res);
486
+ if (res) {
487
+ setCookie(response, res);
488
+ }
483
489
  // レスポンスのエラーチェック
484
490
  await checkVtecxResponse(response);
485
491
  // 戻り値
@@ -530,7 +536,9 @@ const countResponse = async (req, res, uri, targetService) => {
530
536
  }
531
537
  //console.log(`[vtecxnext count] response=${response}`)
532
538
  // vte.cxからのset-cookieを転記
533
- setCookie(response, res);
539
+ if (res) {
540
+ setCookie(response, res);
541
+ }
534
542
  // レスポンスのエラーチェック
535
543
  await checkVtecxResponse(response);
536
544
  // 戻り値
@@ -571,7 +579,9 @@ const post = async (req, res, feed, uri, targetService) => {
571
579
  }
572
580
  //console.log(`[vtecxnext post] response. status=${response.status}`)
573
581
  // vte.cxからのset-cookieを転記
574
- setCookie(response, res);
582
+ if (res) {
583
+ setCookie(response, res);
584
+ }
575
585
  // レスポンスのエラーチェック
576
586
  await checkVtecxResponse(response);
577
587
  return await getJson(response);
@@ -608,7 +618,9 @@ const put = async (req, res, feed, isbulk, parallel, async, targetService) => {
608
618
  }
609
619
  //console.log(`[vtecxnext put] response. status=${response.status}`)
610
620
  // vte.cxからのset-cookieを転記
611
- setCookie(response, res);
621
+ if (res) {
622
+ setCookie(response, res);
623
+ }
612
624
  // レスポンスのエラーチェック
613
625
  await checkVtecxResponse(response);
614
626
  return await getJson(response);
@@ -639,7 +651,9 @@ const deleteEntry = async (req, res, uri, revision, targetService) => {
639
651
  }
640
652
  //console.log(`[vtecxnext deleteEntry] response. status=${response.status}`)
641
653
  // vte.cxからのset-cookieを転記
642
- setCookie(response, res);
654
+ if (res) {
655
+ setCookie(response, res);
656
+ }
643
657
  // レスポンスのエラーチェック
644
658
  await checkVtecxResponse(response);
645
659
  return true;
@@ -669,7 +683,9 @@ const deleteFolder = async (req, res, uri, async, targetService) => {
669
683
  }
670
684
  //console.log(`[vtecxnext deleteFolder] response. status=${response.status}`)
671
685
  // vte.cxからのset-cookieを転記
672
- setCookie(response, res);
686
+ if (res) {
687
+ setCookie(response, res);
688
+ }
673
689
  // レスポンスのエラーチェック
674
690
  await checkVtecxResponse(response);
675
691
  return true;
@@ -700,7 +716,9 @@ const allocids = async (req, res, uri, num, targetService) => {
700
716
  }
701
717
  //console.log(`[vtecxnext allocids] response=${response}`)
702
718
  // vte.cxからのset-cookieを転記
703
- setCookie(response, res);
719
+ if (res) {
720
+ setCookie(response, res);
721
+ }
704
722
  // レスポンスのエラーチェック
705
723
  await checkVtecxResponse(response);
706
724
  // 戻り値
@@ -733,7 +751,9 @@ const addids = async (req, res, uri, num, targetService) => {
733
751
  }
734
752
  //console.log(`[vtecxnext addids] response=${response}`)
735
753
  // vte.cxからのset-cookieを転記
736
- setCookie(response, res);
754
+ if (res) {
755
+ setCookie(response, res);
756
+ }
737
757
  // レスポンスのエラーチェック
738
758
  await checkVtecxResponse(response);
739
759
  // 戻り値
@@ -764,7 +784,9 @@ const getids = async (req, res, uri, targetService) => {
764
784
  }
765
785
  //console.log(`[vtecxnext getids] response=${response}`)
766
786
  // vte.cxからのset-cookieを転記
767
- setCookie(response, res);
787
+ if (res) {
788
+ setCookie(response, res);
789
+ }
768
790
  // レスポンスのエラーチェック
769
791
  await checkVtecxResponse(response);
770
792
  // 戻り値
@@ -797,7 +819,9 @@ const setids = async (req, res, uri, num, targetService) => {
797
819
  }
798
820
  //console.log(`[vtecxnext setids] response=${response}`)
799
821
  // vte.cxからのset-cookieを転記
800
- setCookie(response, res);
822
+ if (res) {
823
+ setCookie(response, res);
824
+ }
801
825
  // レスポンスのエラーチェック
802
826
  await checkVtecxResponse(response);
803
827
  // 戻り値
@@ -831,7 +855,9 @@ const rangeids = async (req, res, uri, range) => {
831
855
  }
832
856
  //console.log(`[vtecxnext rangeids] response=${response}`)
833
857
  // vte.cxからのset-cookieを転記
834
- setCookie(response, res);
858
+ if (res) {
859
+ setCookie(response, res);
860
+ }
835
861
  // レスポンスのエラーチェック
836
862
  await checkVtecxResponse(response);
837
863
  // 戻り値
@@ -862,7 +888,9 @@ const getRangeids = async (req, res, uri) => {
862
888
  }
863
889
  //console.log(`[vtecxnext getrangeids] response=${response}`)
864
890
  // vte.cxからのset-cookieを転記
865
- setCookie(response, res);
891
+ if (res) {
892
+ setCookie(response, res);
893
+ }
866
894
  // レスポンスのエラーチェック
867
895
  await checkVtecxResponse(response);
868
896
  // 戻り値
@@ -2680,6 +2708,19 @@ const getcontent = async (req, res, uri) => {
2680
2708
  return true;
2681
2709
  };
2682
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;
2683
2724
  /**
2684
2725
  * add acl
2685
2726
  * @param req request (for authentication)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtecx/vtecxnext",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "vte.cx Next.js api",
5
5
  "main": "dist/index.js",
6
6
  "files": [