@vtecx/vtecxnext 2.2.20 → 2.2.21
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 +10 -0
- package/dist/vtecxnext.js +74 -0
- package/package.json +4 -4
package/dist/vtecxnext.d.ts
CHANGED
|
@@ -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
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtecx/vtecxnext",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.21",
|
|
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.
|
|
21
|
+
"@types/node": "^22.15.29",
|
|
22
22
|
"@types/sqlstring": "^2.3.2",
|
|
23
23
|
"ts-node": "^10.9.2",
|
|
24
|
-
"typescript": "^5.8.
|
|
24
|
+
"typescript": "^5.8.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"next": "^15.
|
|
27
|
+
"next": "^15.3.3",
|
|
28
28
|
"sqlstring": "^2.3.3"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|