@vtecx/vtecxnext 2.2.22 → 2.3.1

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.
@@ -524,6 +524,7 @@ export declare class VtecxNext {
524
524
  * @param values values of query arguments
525
525
  * @param async execute async
526
526
  * @param isbulk execute with autocommit
527
+ * @return message
527
528
  */
528
529
  execRDB: (sqls: string[], values?: any[][], async?: boolean, isbulk?: boolean) => Promise<any>;
529
530
  /**
@@ -671,7 +672,7 @@ export declare class VtecxNext {
671
672
  * add user
672
673
  * @param adduserInfo adduser infomation
673
674
  * @param reCaptchaToken reCAPTCHA token
674
- * @return message feed
675
+ * @return message feed (uid)
675
676
  */
676
677
  adduser: (adduserInfo: AdduserInfo, reCaptchaToken: string) => Promise<any>;
677
678
  /**
package/dist/vtecxnext.js CHANGED
@@ -59,6 +59,8 @@ const HEADER_NEXTPAGE = 'x-vtecx-nextpage';
59
59
  const PAGINATION_NUM = 7;
60
60
  /** pagination memorysort */
61
61
  const MEMORYSORT = 'memorysort';
62
+ /** parameter : nextpage */
63
+ const PARAM_NEXTPAGE = 'p';
62
64
  class VtecxNext {
63
65
  /** Request */
64
66
  req;
@@ -625,11 +627,36 @@ class VtecxNext {
625
627
  * @return count
626
628
  */
627
629
  count = async (uri, targetService) => {
628
- //console.log('[vtecxnext count] start.')
629
- const vtecxRes = await this.countResponse(uri, targetService);
630
- // 戻り値
631
- const data = vtecxRes.data;
632
- return vtecxRes.data.feed.title ? Number(data.feed.title) : null;
630
+ //console.log(`[vtecxnext count] start. uri=${uri}`)
631
+ let cnt = 0;
632
+ let noRepeat = false;
633
+ let nextpage = '';
634
+ const params = getParamMap(uri);
635
+ if (params[PARAM_NEXTPAGE]) {
636
+ noRepeat = true;
637
+ }
638
+ do {
639
+ const editedUri = noRepeat ? uri : addNextpage(uri, nextpage);
640
+ //console.log(`[vtecxnext count] editedUri=${editedUri}`)
641
+ nextpage = '';
642
+ const vtecxRes = await this.countResponse(editedUri, targetService);
643
+ if (vtecxRes.status === 200) {
644
+ const data = vtecxRes.data;
645
+ if (!data?.feed?.title) {
646
+ if (!cnt) {
647
+ return null;
648
+ }
649
+ }
650
+ else {
651
+ cnt += Number(data.feed.title);
652
+ }
653
+ if (vtecxRes.header.hasOwnProperty(HEADER_NEXTPAGE)) {
654
+ nextpage = vtecxRes.header[HEADER_NEXTPAGE];
655
+ //console.log(`[vtecxnext count] ${HEADER_NEXTPAGE}=${nextpage}`)
656
+ }
657
+ }
658
+ } while (!noRepeat && nextpage);
659
+ return cnt;
633
660
  };
634
661
  /**
635
662
  * get count
@@ -1950,6 +1977,7 @@ class VtecxNext {
1950
1977
  * @param values values of query arguments
1951
1978
  * @param async execute async
1952
1979
  * @param isbulk execute with autocommit
1980
+ * @return message
1953
1981
  */
1954
1982
  execRDB = async (sqls, values, async, isbulk) => {
1955
1983
  //console.log(`[vtecxnext execRDB] start. sql=${sql} values=${values}`)
@@ -2009,7 +2037,6 @@ class VtecxNext {
2009
2037
  const resData = await response.blob();
2010
2038
  this.setResponseHeaders(response);
2011
2039
  this.bufferData = await resData.arrayBuffer();
2012
- //res.end(new Uint8Array(pdfData))
2013
2040
  return true;
2014
2041
  };
2015
2042
  /**
@@ -2616,7 +2643,7 @@ class VtecxNext {
2616
2643
  * add user
2617
2644
  * @param adduserInfo adduser infomation
2618
2645
  * @param reCaptchaToken reCAPTCHA token
2619
- * @return message feed
2646
+ * @return message feed (uid)
2620
2647
  */
2621
2648
  adduser = async (adduserInfo, reCaptchaToken) => {
2622
2649
  //console.log(`[vtecxnext adduser] start. feed=${feed}`)
@@ -2668,7 +2695,6 @@ class VtecxNext {
2668
2695
  * @param feed entries (JSON)
2669
2696
  * @return message feed
2670
2697
  */
2671
- //adduserByAdmin = async (feed:any): Promise<any> => {
2672
2698
  adduserByAdmin = async (adduserInfos) => {
2673
2699
  //console.log(`[vtecxnext adduserByAdmin] start. feed=${feed}`)
2674
2700
  // 入力チェック
@@ -4591,3 +4617,52 @@ const createURLSearchParams = (data) => {
4591
4617
  Object.keys(data).forEach((key) => params.append(key, data[key]));
4592
4618
  return params;
4593
4619
  };
4620
+ /**
4621
+ * URIのパラメータ部分を連想配列にして返却
4622
+ * @param uri URI
4623
+ * @returns パラメータを連想配列にしたオブジェクト
4624
+ */
4625
+ const getParamMap = (uri) => {
4626
+ if (!uri) {
4627
+ return {};
4628
+ }
4629
+ const idxQ = uri.indexOf('?');
4630
+ if (idxQ < 0) {
4631
+ return {};
4632
+ }
4633
+ const paramStr = uri.substring(idxQ + 1);
4634
+ if (!paramStr) {
4635
+ return {};
4636
+ }
4637
+ const params = {};
4638
+ const paramStrParts = paramStr.split('&');
4639
+ for (const paramStrPart of paramStrParts) {
4640
+ let name = '';
4641
+ let value = '';
4642
+ const idxE = paramStrPart.indexOf('=');
4643
+ if (idxE < 0) {
4644
+ name = paramStrPart;
4645
+ }
4646
+ else {
4647
+ name = paramStrPart.substring(0, idxE);
4648
+ value = paramStrPart.substring(idxE + 1);
4649
+ }
4650
+ params[name] = value;
4651
+ }
4652
+ return params;
4653
+ };
4654
+ /**
4655
+ * URIにカーソルを付加
4656
+ * @param uri URI
4657
+ * @param nextpage カーソル
4658
+ * @returns URIにカーソルを付加した文字列
4659
+ */
4660
+ const addNextpage = (uri, nextpage) => {
4661
+ if (nextpage) {
4662
+ const rchar = uri.indexOf('?') < 0 ? '?' : '&';
4663
+ return `${uri}${rchar}${PARAM_NEXTPAGE}=${nextpage}`;
4664
+ }
4665
+ else {
4666
+ return uri;
4667
+ }
4668
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtecx/vtecxnext",
3
- "version": "2.2.22",
3
+ "version": "2.3.1",
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": "^24.0.4",
21
+ "@types/node": "^24.10.1",
22
22
  "@types/sqlstring": "^2.3.2",
23
23
  "ts-node": "^10.9.2",
24
- "typescript": "^5.8.3"
24
+ "typescript": "^5.9.3"
25
25
  },
26
26
  "dependencies": {
27
- "next": "^15.3.4",
27
+ "next": "^16.0.7",
28
28
  "sqlstring": "^2.3.3"
29
29
  },
30
30
  "scripts": {