@vtecx/vtecxnext 2.2.20 → 2.2.22

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.
@@ -243,6 +243,16 @@ export declare class VtecxNext {
243
243
  * @return true if successful
244
244
  */
245
245
  deleteEntry: (uri: string, revision?: number, targetService?: string) => Promise<boolean>;
246
+ /**
247
+ * delete entries
248
+ * @param feed feed
249
+ * @param isbulk Forcibly execute even if it exceeds the upper limit of entries of request feed.
250
+ * @param parallel Execute parallel if this param is true. Valid only if 'isbulk' is true.
251
+ * @param async Execute asynchronous if this param is true. Valid only if 'isbulk' is true.
252
+ * @param targetService target service name (for service linkage)
253
+ * @return true if successful
254
+ */
255
+ deleteEntries: (feed: any, isbulk?: boolean, parallel?: boolean, async?: boolean, targetService?: string) => Promise<boolean>;
246
256
  /**
247
257
  * delete folder
248
258
  * @param uri parent key
@@ -468,24 +478,28 @@ export declare class VtecxNext {
468
478
  * @param feed entries (JSON)
469
479
  * @param uri parent key if not specified in entry
470
480
  * @param tablenames key:entity's prop name, value:BigQuery table name
481
+ * @param async execute async
471
482
  * @return registed entries
472
483
  */
473
- postBDBQ: (feed: any, uri?: string, tablenames?: any) => Promise<any>;
484
+ postBDBQ: (feed: any, uri?: string, tablenames?: any, async?: boolean) => Promise<any>;
474
485
  /**
475
486
  * put data to bdb and post bigquery
476
487
  * @param feed entries (JSON)
477
488
  * @param uri parent key if not specified in entry
478
489
  * @param tablenames key:entity's prop name, value:BigQuery table name
490
+ * @param async execute async
491
+ * @param isbulk Forcibly execute even if it exceeds the upper limit of entries of request feed.
479
492
  * @return true if successful
480
493
  */
481
- putBDBQ: (feed: any, uri?: string, tablenames?: any) => Promise<any>;
494
+ putBDBQ: (feed: any, uri?: string, tablenames?: any, async?: boolean, isbulk?: boolean) => Promise<any>;
482
495
  /**
483
496
  * delete data from bdb and bigquery
484
497
  * @param keys delete keys
485
498
  * @param tablenames key:entity's prop name, value:BigQuery table name
499
+ * @param async execute async
486
500
  * @return true if successful
487
501
  */
488
- deleteBDBQ: (keys: string[], tablenames?: any) => Promise<boolean>;
502
+ deleteBDBQ: (keys: string[], tablenames?: any, async?: boolean) => Promise<boolean>;
489
503
  /**
490
504
  * Execute a query SQL to the database and get the result.
491
505
  * @param sql query sql
package/dist/vtecxnext.js CHANGED
@@ -761,6 +761,80 @@ class VtecxNext {
761
761
  await checkVtecxResponse(response);
762
762
  return true;
763
763
  };
764
+ /**
765
+ * delete entries
766
+ * @param feed feed
767
+ * @param isbulk Forcibly execute even if it exceeds the upper limit of entries of request feed.
768
+ * @param parallel Execute parallel if this param is true. Valid only if 'isbulk' is true.
769
+ * @param async Execute asynchronous if this param is true. Valid only if 'isbulk' is true.
770
+ * @param targetService target service name (for service linkage)
771
+ * @return true if successful
772
+ */
773
+ deleteEntries = async (feed, isbulk, parallel, async, targetService) => {
774
+ //console.log(`[vtecxnext deleteEntries] start.`)
775
+ // 入力チェック
776
+ checkNotNull(feed, 'Feed');
777
+ // キー入力値チェック
778
+ for (const entry of feed) {
779
+ if (!entry.link || !Array.isArray(entry.link)) {
780
+ throw new VtecxNextError(400, `Key is required.`);
781
+ }
782
+ let existKey = false;
783
+ for (const link of entry.link) {
784
+ if (link.___rel === 'self') {
785
+ checkUri(link.___href);
786
+ existKey = true;
787
+ }
788
+ }
789
+ if (!existKey) {
790
+ throw new VtecxNextError(400, `Key is required.`);
791
+ }
792
+ }
793
+ // IDに削除オプションを追加
794
+ const paramDelete = '?_delete';
795
+ const paramDelete2 = '&_delete';
796
+ const reqFeed = [...feed];
797
+ for (const entry of reqFeed) {
798
+ let id;
799
+ if (!entry.id) {
800
+ id = paramDelete;
801
+ }
802
+ else if (entry.id.indexOf(paramDelete) >= 0 ||
803
+ entry.id.indexOf(paramDelete2) >= 0) {
804
+ id = entry.id;
805
+ }
806
+ else {
807
+ if (entry.id.indexOf('?') >= 0) {
808
+ id = `${entry.id}${paramDelete2}`;
809
+ }
810
+ else {
811
+ id = `${entry.id}${paramDelete}`;
812
+ }
813
+ }
814
+ entry.id = id;
815
+ }
816
+ //console.log(`[vtecxnext deleteEntries] reqFeed = ${JSON.stringify(reqFeed)}`)
817
+ // vte.cxへリクエスト
818
+ const method = 'PUT';
819
+ let additionalParam = '';
820
+ if (isbulk) {
821
+ additionalParam = (parallel ? '&_bulk' : '&_bulkserial') + (async ? '&_async' : '');
822
+ }
823
+ const url = `${SERVLETPATH_PROVIDER}/?e${additionalParam}`;
824
+ let response;
825
+ try {
826
+ response = await this.requestVtecx(method, url, JSON.stringify(reqFeed), null, targetService);
827
+ }
828
+ catch (e) {
829
+ throw newFetchError(e, true);
830
+ }
831
+ //console.log(`[vtecxnext deleteEntries] response. status=${response.status}`)
832
+ // vte.cxからのset-cookieを転記
833
+ this.setCookie(response);
834
+ // レスポンスのエラーチェック
835
+ await checkVtecxResponse(response);
836
+ return true;
837
+ };
764
838
  /**
765
839
  * delete folder
766
840
  * @param uri parent key
@@ -1673,9 +1747,10 @@ class VtecxNext {
1673
1747
  * @param feed entries (JSON)
1674
1748
  * @param uri parent key if not specified in entry
1675
1749
  * @param tablenames key:entity's prop name, value:BigQuery table name
1750
+ * @param async execute async
1676
1751
  * @return registed entries
1677
1752
  */
1678
- postBDBQ = async (feed, uri, tablenames) => {
1753
+ postBDBQ = async (feed, uri, tablenames, async) => {
1679
1754
  //console.log(`[vtecxnext postBQ] start. async=${async} feed=${feed}`)
1680
1755
  // 入力チェック
1681
1756
  checkNotNull(feed, 'Feed');
@@ -1692,7 +1767,7 @@ class VtecxNext {
1692
1767
  }
1693
1768
  // vte.cxへリクエスト
1694
1769
  const method = 'POST';
1695
- const url = `${SERVLETPATH_PROVIDER}${uri ? uri : '/'}?_bdbq`;
1770
+ const url = `${SERVLETPATH_PROVIDER}${uri ? uri : '/'}?_bdbq${async ? '&_async' : ''}`;
1696
1771
  let response;
1697
1772
  try {
1698
1773
  response = await this.requestVtecx(method, url, JSON.stringify(reqFeed));
@@ -1712,9 +1787,11 @@ class VtecxNext {
1712
1787
  * @param feed entries (JSON)
1713
1788
  * @param uri parent key if not specified in entry
1714
1789
  * @param tablenames key:entity's prop name, value:BigQuery table name
1790
+ * @param async execute async
1791
+ * @param isbulk Forcibly execute even if it exceeds the upper limit of entries of request feed.
1715
1792
  * @return true if successful
1716
1793
  */
1717
- putBDBQ = async (feed, uri, tablenames) => {
1794
+ putBDBQ = async (feed, uri, tablenames, async, isbulk) => {
1718
1795
  //console.log(`[vtecxnext putBDBQ] start. feed=${feed}`)
1719
1796
  // 入力チェック
1720
1797
  checkNotNull(feed, 'Feed');
@@ -1732,7 +1809,7 @@ class VtecxNext {
1732
1809
  }
1733
1810
  // vte.cxへリクエスト
1734
1811
  const method = 'PUT';
1735
- const url = `${SERVLETPATH_PROVIDER}${uri ? uri : '/'}?_bdbq`;
1812
+ const url = `${SERVLETPATH_PROVIDER}${uri ? uri : '/'}?_bdbq${async ? '&_async' : ''}${isbulk ? '&_bulk' : ''}`;
1736
1813
  let response;
1737
1814
  try {
1738
1815
  response = await this.requestVtecx(method, url, JSON.stringify(reqFeed));
@@ -1751,9 +1828,10 @@ class VtecxNext {
1751
1828
  * delete data from bdb and bigquery
1752
1829
  * @param keys delete keys
1753
1830
  * @param tablenames key:entity's prop name, value:BigQuery table name
1831
+ * @param async execute async
1754
1832
  * @return true if successful
1755
1833
  */
1756
- deleteBDBQ = async (keys, tablenames) => {
1834
+ deleteBDBQ = async (keys, tablenames, async) => {
1757
1835
  //console.log(`[vtecxnext deleteBDBQ] start. keys=${keys}`)
1758
1836
  // 入力チェック
1759
1837
  checkNotNull(keys, 'Key');
@@ -1775,7 +1853,7 @@ class VtecxNext {
1775
1853
  //console.log(`[vtecxnext deleteBDBQ] feed=${feed}`)
1776
1854
  // vte.cxへリクエスト
1777
1855
  const method = 'DELETE';
1778
- const url = `${SERVLETPATH_PROVIDER}/?_bdbq`;
1856
+ const url = `${SERVLETPATH_PROVIDER}/?_bdbq${async ? '&_async' : ''}`;
1779
1857
  let response;
1780
1858
  try {
1781
1859
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtecx/vtecxnext",
3
- "version": "2.2.20",
3
+ "version": "2.2.22",
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": "^22.13.10",
21
+ "@types/node": "^24.0.4",
22
22
  "@types/sqlstring": "^2.3.2",
23
23
  "ts-node": "^10.9.2",
24
- "typescript": "^5.8.2"
24
+ "typescript": "^5.8.3"
25
25
  },
26
26
  "dependencies": {
27
- "next": "^15.2.3",
27
+ "next": "^15.3.4",
28
28
  "sqlstring": "^2.3.3"
29
29
  },
30
30
  "scripts": {