@vtecx/vtecxnext 2.2.3 → 2.2.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.
@@ -24,6 +24,11 @@ export type CreateGroupadminInfo = {
24
24
  group: string;
25
25
  uids: string[];
26
26
  };
27
+ export type PaginationInfo = {
28
+ lastPageNumber: number;
29
+ countWithinRange: number;
30
+ hasNext: boolean;
31
+ };
27
32
  export declare class VtecxNext {
28
33
  /** Request */
29
34
  readonly req: NextRequest | undefined;
@@ -383,9 +388,9 @@ export declare class VtecxNext {
383
388
  * @param uri key and conditions
384
389
  * @param pagerange page range
385
390
  * @param targetService target service name (for service linkage)
386
- * @return feed Maximum number of pages in the specified page range, and total count.
391
+ * @return Maximum number of pages in the specified page range, and total count.
387
392
  */
388
- pagination: (uri: string, pagerange: string, targetService?: string) => Promise<any>;
393
+ pagination: (uri: string, pagerange: string, targetService?: string) => Promise<PaginationInfo>;
389
394
  /**
390
395
  * get page
391
396
  * @param uri key and conditions
package/dist/vtecxnext.js CHANGED
@@ -1356,7 +1356,7 @@ class VtecxNext {
1356
1356
  * @param uri key and conditions
1357
1357
  * @param pagerange page range
1358
1358
  * @param targetService target service name (for service linkage)
1359
- * @return feed Maximum number of pages in the specified page range, and total count.
1359
+ * @return Maximum number of pages in the specified page range, and total count.
1360
1360
  */
1361
1361
  pagination = async (uri, pagerange, targetService) => {
1362
1362
  //console.log('[vtecxnext pagination] start.')
@@ -1377,8 +1377,18 @@ class VtecxNext {
1377
1377
  this.setCookie(response);
1378
1378
  // レスポンスのエラーチェック
1379
1379
  await checkVtecxResponse(response);
1380
- // 戻り値
1381
- return await getJson(response);
1380
+ // 戻り値編集
1381
+ const respJson = await getJson(response);
1382
+ let hasNext = false;
1383
+ if (respJson.feed.link && respJson.feed.link[0]?.___rel === 'next') {
1384
+ hasNext = true;
1385
+ }
1386
+ const pagenationInfo = {
1387
+ 'lastPageNumber': Number(respJson.feed.title),
1388
+ 'countWithinRange': Number(respJson.feed.subtitle),
1389
+ 'hasNext': hasNext
1390
+ };
1391
+ return pagenationInfo;
1382
1392
  };
1383
1393
  /**
1384
1394
  * get page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtecx/vtecxnext",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "vte.cx Next.js api",
5
5
  "main": "dist/index.js",
6
6
  "files": [