@vtecx/vtecxnext 2.2.14 → 2.2.16

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.
@@ -718,16 +718,18 @@ export declare class VtecxNext {
718
718
  /**
719
719
  * revoke user
720
720
  * @param account account
721
+ * @param isDeleteGroups true if delete groups
721
722
  * @return message feed
722
723
  */
723
- revokeuser: (account: string) => Promise<any>;
724
+ revokeuser: (account: string, isDeleteGroups?: boolean) => Promise<any>;
724
725
  /**
725
726
  * revoke users
726
727
  * @param accounts account list
727
728
  * @param uids uid list
729
+ * @param isDeleteGroups true if delete groups
728
730
  * @return message feed
729
731
  */
730
- revokeusers: (accounts?: string[], uids?: string[]) => Promise<any>;
732
+ revokeusers: (accounts?: string[], uids?: string[], isDeleteGroups?: boolean) => Promise<any>;
731
733
  /**
732
734
  * activate user
733
735
  * @param account account
@@ -743,10 +745,10 @@ export declare class VtecxNext {
743
745
  activateusers: (accounts?: string[], uids?: string[]) => Promise<any>;
744
746
  /**
745
747
  * cancel user.
746
- * @param account account
748
+ * @param isDeleteGroups true if delete groups
747
749
  * @return message feed
748
750
  */
749
- canceluser: () => Promise<any>;
751
+ canceluser: (isDeleteGroups?: boolean) => Promise<any>;
750
752
  /**
751
753
  * delete user
752
754
  * @param account account
package/dist/vtecxnext.js CHANGED
@@ -192,8 +192,7 @@ class VtecxNext {
192
192
  if (this.resStatus !== 204) {
193
193
  if (data) {
194
194
  if (data instanceof Object) {
195
- if (!('content-type' in this.resHeaders) &&
196
- !('Content-Type' in this.resHeaders)) {
195
+ if (!('content-type' in this.resHeaders) && !('Content-Type' in this.resHeaders)) {
197
196
  this.resHeaders['content-type'] = 'application/json';
198
197
  }
199
198
  resData = JSON.stringify(data);
@@ -222,7 +221,7 @@ class VtecxNext {
222
221
  * @return true
223
222
  */
224
223
  sendMessage = (statusCode, message) => {
225
- const resJson = { 'feed': { 'title': message } };
224
+ const resJson = { feed: { title: message } };
226
225
  return this.response(statusCode, resJson);
227
226
  };
228
227
  /**
@@ -434,7 +433,7 @@ class VtecxNext {
434
433
  // ログイン
435
434
  const method = 'GET';
436
435
  const url = `${SERVLETPATH_DATA}/?_login`;
437
- const headers = { 'Authorization': `TOTP ${totp}` };
436
+ const headers = { Authorization: `TOTP ${totp}` };
438
437
  if (isTrustedDevice) {
439
438
  headers['X-TRUSTED-DEVICE'] = 'true';
440
439
  }
@@ -514,7 +513,7 @@ class VtecxNext {
514
513
  log = async (message, title, subtitle) => {
515
514
  const logTitle = title ?? 'JavaScript';
516
515
  const logSubtitle = subtitle ?? 'INFO';
517
- const feed = [{ 'title': logTitle, 'subtitle': logSubtitle, 'summary': message }];
516
+ const feed = [{ title: logTitle, subtitle: logSubtitle, summary: message }];
518
517
  const method = 'POST';
519
518
  const url = `${SERVLETPATH_PROVIDER}/?_log`;
520
519
  let response;
@@ -941,7 +940,7 @@ class VtecxNext {
941
940
  // vte.cxへリクエスト
942
941
  const method = 'PUT';
943
942
  const url = `${SERVLETPATH_PROVIDER}${uri}?_rangeids`;
944
- const feed = { 'feed': { 'title': range } };
943
+ const feed = { feed: { title: range } };
945
944
  let response;
946
945
  try {
947
946
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -1028,7 +1027,7 @@ class VtecxNext {
1028
1027
  // vte.cxへリクエスト
1029
1028
  const method = 'PUT';
1030
1029
  const url = `${SERVLETPATH_PROVIDER}/?_sessionentry=${name}`;
1031
- const feed = { 'feed': { 'entry': entry } };
1030
+ const feed = { feed: { entry: entry } };
1032
1031
  let response;
1033
1032
  try {
1034
1033
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -1057,7 +1056,7 @@ class VtecxNext {
1057
1056
  // vte.cxへリクエスト
1058
1057
  const method = 'PUT';
1059
1058
  const url = `${SERVLETPATH_PROVIDER}/?_sessionstring=${name}`;
1060
- const feed = { 'feed': { 'title': str } };
1059
+ const feed = { feed: { title: str } };
1061
1060
  let response;
1062
1061
  try {
1063
1062
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -1086,7 +1085,7 @@ class VtecxNext {
1086
1085
  // vte.cxへリクエスト
1087
1086
  const method = 'PUT';
1088
1087
  const url = `${SERVLETPATH_PROVIDER}/?_sessionlong=${name}`;
1089
- const feed = { 'feed': { 'title': String(num) } };
1088
+ const feed = { feed: { title: String(num) } };
1090
1089
  let response;
1091
1090
  try {
1092
1091
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -1388,10 +1387,10 @@ class VtecxNext {
1388
1387
  hasNext = true;
1389
1388
  }
1390
1389
  const pagenationInfo = {
1391
- 'lastPageNumber': Number(respJson.feed.title),
1392
- 'countWithinRange': Number(respJson.feed.subtitle),
1393
- 'hasNext': hasNext,
1394
- 'isMemorysort': respJson.feed.rights === MEMORYSORT
1390
+ lastPageNumber: Number(respJson.feed.title),
1391
+ countWithinRange: Number(respJson.feed.subtitle),
1392
+ hasNext: hasNext,
1393
+ isMemorysort: respJson.feed.rights === MEMORYSORT
1395
1394
  };
1396
1395
  return pagenationInfo;
1397
1396
  };
@@ -1492,7 +1491,7 @@ class VtecxNext {
1492
1491
  // 入力チェック
1493
1492
  checkNotNull(feed, 'Feed');
1494
1493
  // リクエストデータ
1495
- const reqFeed = 'feed' in feed ? feed : { 'feed': { 'entry': feed } };
1494
+ const reqFeed = 'feed' in feed ? feed : { feed: { entry: feed } };
1496
1495
  // テーブル名の指定がある場合は指定
1497
1496
  const tablenamesStr = editBqTableNames(tablenames);
1498
1497
  if (tablenamesStr) {
@@ -1533,10 +1532,10 @@ class VtecxNext {
1533
1532
  let idx = 0;
1534
1533
  for (const key of keys) {
1535
1534
  //console.log(`[vtecxnext deleteBQ] key=${key}`)
1536
- links[idx] = { '___href': key };
1535
+ links[idx] = { ___href: key };
1537
1536
  idx++;
1538
1537
  }
1539
- const feed = { 'feed': {} };
1538
+ const feed = { feed: {} };
1540
1539
  if (tablenamesStr) {
1541
1540
  feed.feed['title'] = tablenamesStr;
1542
1541
  }
@@ -1660,7 +1659,7 @@ class VtecxNext {
1660
1659
  checkUri(uri);
1661
1660
  }
1662
1661
  // リクエストデータ
1663
- const reqFeed = 'feed' in feed ? feed : { 'feed': { 'entry': feed } };
1662
+ const reqFeed = 'feed' in feed ? feed : { feed: { entry: feed } };
1664
1663
  // テーブル名の指定がある場合は指定
1665
1664
  const tablenamesStr = editBqTableNames(tablenames);
1666
1665
  if (tablenamesStr) {
@@ -1699,7 +1698,7 @@ class VtecxNext {
1699
1698
  checkUri(uri);
1700
1699
  }
1701
1700
  // リクエストデータ
1702
- const reqFeed = 'feed' in feed ? feed : { 'feed': { 'entry': feed } };
1701
+ const reqFeed = 'feed' in feed ? feed : { feed: { entry: feed } };
1703
1702
  // テーブル名の指定がある場合は指定
1704
1703
  const tablenamesStr = editBqTableNames(tablenames);
1705
1704
  //console.log(`[putBDBQ] tableamesStr=${tablenamesStr}`)
@@ -1740,10 +1739,10 @@ class VtecxNext {
1740
1739
  let idx = 0;
1741
1740
  for (const key of keys) {
1742
1741
  //console.log(`[vtecxnext deleteBDBQ] key=${key}`)
1743
- links[idx] = { '___href': key };
1742
+ links[idx] = { ___href: key };
1744
1743
  idx++;
1745
1744
  }
1746
- const feed = { 'feed': {} };
1745
+ const feed = { feed: {} };
1747
1746
  if (tablenamesStr) {
1748
1747
  feed.feed['title'] = tablenamesStr;
1749
1748
  }
@@ -2057,7 +2056,7 @@ class VtecxNext {
2057
2056
  }
2058
2057
  }
2059
2058
  //console.log(`[vtecxnext sendMail] links = ${JSON.stringify(links)}`)
2060
- let feed = { 'feed': { 'entry': [entry], 'link': links } };
2059
+ let feed = { feed: { entry: [entry], link: links } };
2061
2060
  //console.log(`[vtecxnext sendMail] feed = ${JSON.stringify(feed)}`)
2062
2061
  // vte.cxへリクエスト
2063
2062
  const method = 'POST';
@@ -2094,21 +2093,21 @@ class VtecxNext {
2094
2093
  // 引数編集
2095
2094
  const links = [];
2096
2095
  for (const destination of to) {
2097
- const link = { '___rel': 'to', '___href': destination };
2096
+ const link = { ___rel: 'to', ___href: destination };
2098
2097
  links.push(link);
2099
2098
  }
2100
2099
  const categories = [];
2101
2100
  if (imageUrl) {
2102
- const category = { '___scheme': 'imageurl', '___label': imageUrl };
2101
+ const category = { ___scheme: 'imageurl', ___label: imageUrl };
2103
2102
  categories.push(category);
2104
2103
  }
2105
2104
  if (data) {
2106
2105
  for (const name in data) {
2107
- const category = { '___scheme': name, '___label': data[name] };
2106
+ const category = { ___scheme: name, ___label: data[name] };
2108
2107
  categories.push(category);
2109
2108
  }
2110
2109
  }
2111
- const content = { '______text': message };
2110
+ const content = { ______text: message };
2112
2111
  const entry = {};
2113
2112
  if (title) {
2114
2113
  entry['title'] = title;
@@ -2120,9 +2119,10 @@ class VtecxNext {
2120
2119
  if (categories) {
2121
2120
  entry['category'] = categories;
2122
2121
  }
2123
- const feed = { 'feed': {
2124
- 'entry': [entry],
2125
- 'link': links
2122
+ const feed = {
2123
+ feed: {
2124
+ entry: [entry],
2125
+ link: links
2126
2126
  }
2127
2127
  };
2128
2128
  //console.log(`[vtecxnext pushNotification] feed = ${JSON.stringify(feed)}`)
@@ -2300,7 +2300,7 @@ class VtecxNext {
2300
2300
  const url = `${SERVLETPATH_PROVIDER}${group}?_addgroupByAdmin${selfid ? '&_selfid=' + selfid : ''}`;
2301
2301
  const feed = [];
2302
2302
  for (const uid of uids) {
2303
- const entry = { 'link': [{ '___rel': 'self', '___href': `/_user/${uid}` }] };
2303
+ const entry = { link: [{ ___rel: 'self', ___href: `/_user/${uid}` }] };
2304
2304
  feed.push(entry);
2305
2305
  }
2306
2306
  const value = JSON.stringify(feed);
@@ -2391,7 +2391,7 @@ class VtecxNext {
2391
2391
  const url = `${SERVLETPATH_PROVIDER}${group}?_leavegroupByAdmin`;
2392
2392
  const feed = [];
2393
2393
  for (const uid of uids) {
2394
- const entry = { 'link': [{ '___rel': 'self', '___href': `/_user/${uid}` }] };
2394
+ const entry = { link: [{ ___rel: 'self', ___href: `/_user/${uid}` }] };
2395
2395
  feed.push(entry);
2396
2396
  }
2397
2397
  const value = JSON.stringify(feed);
@@ -2549,13 +2549,15 @@ class VtecxNext {
2549
2549
  */
2550
2550
  convertAdduserInfoToEntry = (adduserInfo, isNoPswd) => {
2551
2551
  return {
2552
- 'contributor': [{
2553
- 'uri': `urn:vte.cx:auth:${this.null2blank(adduserInfo.username)}${isNoPswd ? '' : ',' + this.null2blank(adduserInfo.pswd)}`,
2554
- 'name': adduserInfo.nickname,
2555
- }],
2556
- 'title': adduserInfo.emailSubject,
2557
- 'summary': adduserInfo.emailText,
2558
- 'content': { '______text': adduserInfo.emailHtml }
2552
+ contributor: [
2553
+ {
2554
+ uri: `urn:vte.cx:auth:${this.null2blank(adduserInfo.username)}${isNoPswd ? '' : ',' + this.null2blank(adduserInfo.pswd)}`,
2555
+ name: adduserInfo.nickname
2556
+ }
2557
+ ],
2558
+ title: adduserInfo.emailSubject,
2559
+ summary: adduserInfo.emailText,
2560
+ content: { ______text: adduserInfo.emailHtml }
2559
2561
  };
2560
2562
  };
2561
2563
  /**
@@ -2665,17 +2667,17 @@ class VtecxNext {
2665
2667
  // 入力チェック
2666
2668
  checkNotNull(newpswd, 'new password');
2667
2669
  const contributors = [];
2668
- const newPswdContributor = { 'uri': `urn:vte.cx:auth:,${newpswd}` };
2670
+ const newPswdContributor = { uri: `urn:vte.cx:auth:,${newpswd}` };
2669
2671
  contributors.push(newPswdContributor);
2670
2672
  if (oldpswd) {
2671
- const oldPswdContributor = { 'uri': `urn:vte.cx:oldphash:${oldpswd}` };
2673
+ const oldPswdContributor = { uri: `urn:vte.cx:oldphash:${oldpswd}` };
2672
2674
  contributors.push(oldPswdContributor);
2673
2675
  }
2674
2676
  if (passresetToken) {
2675
- const passresetTokenContributor = { 'uri': `urn:vte.cx:passreset_token:${passresetToken}` };
2677
+ const passresetTokenContributor = { uri: `urn:vte.cx:passreset_token:${passresetToken}` };
2676
2678
  contributors.push(passresetTokenContributor);
2677
2679
  }
2678
- const feed = [{ 'contributor': contributors }];
2680
+ const feed = [{ contributor: contributors }];
2679
2681
  // vte.cxへリクエスト
2680
2682
  const method = 'PUT';
2681
2683
  const url = `${SERVLETPATH_DATA}/?_changephash`;
@@ -2708,12 +2710,8 @@ class VtecxNext {
2708
2710
  checkNotNull(changepassByAdminInfo.uid, 'password change information');
2709
2711
  checkNotNull(changepassByAdminInfo.pswd, 'password change information');
2710
2712
  const entry = {
2711
- 'contributor': [
2712
- { 'uri': `urn:vte.cx:auth:,${changepassByAdminInfo.pswd}` }
2713
- ],
2714
- 'link': [
2715
- { '___rel': 'self', '___href': `/_user/${changepassByAdminInfo.uid}/auth` }
2716
- ]
2713
+ contributor: [{ uri: `urn:vte.cx:auth:,${changepassByAdminInfo.pswd}` }],
2714
+ link: [{ ___rel: 'self', ___href: `/_user/${changepassByAdminInfo.uid}/auth` }]
2717
2715
  };
2718
2716
  feed.push(entry);
2719
2717
  }
@@ -2821,15 +2819,16 @@ class VtecxNext {
2821
2819
  /**
2822
2820
  * revoke user
2823
2821
  * @param account account
2822
+ * @param isDeleteGroups true if delete groups
2824
2823
  * @return message feed
2825
2824
  */
2826
- revokeuser = async (account) => {
2825
+ revokeuser = async (account, isDeleteGroups) => {
2827
2826
  //console.log('[vtecxnext revokeuser] start.')
2828
2827
  // 入力値チェック
2829
2828
  checkNotNull(account, 'account');
2830
2829
  // vte.cxへリクエスト
2831
2830
  const method = 'PUT';
2832
- const url = `${SERVLETPATH_DATA}/?_revokeuser=${account}`;
2831
+ const url = `${SERVLETPATH_PROVIDER}/?_revokeuser=${account}${isDeleteGroups ? '&_deletegroup=true' : ''}`;
2833
2832
  let response;
2834
2833
  try {
2835
2834
  response = await this.requestVtecx(method, url);
@@ -2849,9 +2848,10 @@ class VtecxNext {
2849
2848
  * revoke users
2850
2849
  * @param accounts account list
2851
2850
  * @param uids uid list
2851
+ * @param isDeleteGroups true if delete groups
2852
2852
  * @return message feed
2853
2853
  */
2854
- revokeusers = async (accounts, uids) => {
2854
+ revokeusers = async (accounts, uids, isDeleteGroups) => {
2855
2855
  //console.log(`[vtecxnext revokeusers] start. feed=${feed}`)
2856
2856
  // 入力チェック
2857
2857
  if (isBlank(accounts) && isBlank(uids)) {
@@ -2860,19 +2860,19 @@ class VtecxNext {
2860
2860
  const feed = [];
2861
2861
  if (accounts) {
2862
2862
  for (const account of accounts) {
2863
- const entry = { 'title': account };
2863
+ const entry = { title: account };
2864
2864
  feed.push(entry);
2865
2865
  }
2866
2866
  }
2867
2867
  if (uids) {
2868
2868
  for (const uid of uids) {
2869
- const entry = { 'link': [{ '___rel': 'self', '___href': `/_user/${uid}` }] };
2869
+ const entry = { link: [{ ___rel: 'self', ___href: `/_user/${uid}` }] };
2870
2870
  feed.push(entry);
2871
2871
  }
2872
2872
  }
2873
2873
  // vte.cxへリクエスト
2874
2874
  const method = 'PUT';
2875
- const url = `${SERVLETPATH_DATA}/?_revokeuser`;
2875
+ const url = `${SERVLETPATH_PROVIDER}/?_revokeuser${isDeleteGroups ? '&_deletegroup=true' : ''}`;
2876
2876
  let response;
2877
2877
  try {
2878
2878
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -2898,7 +2898,7 @@ class VtecxNext {
2898
2898
  checkNotNull(account, 'account');
2899
2899
  // vte.cxへリクエスト
2900
2900
  const method = 'PUT';
2901
- const url = `${SERVLETPATH_DATA}/?_activateuser=${account}`;
2901
+ const url = `${SERVLETPATH_PROVIDER}/?_activateuser=${account}`;
2902
2902
  let response;
2903
2903
  try {
2904
2904
  response = await this.requestVtecx(method, url);
@@ -2929,19 +2929,19 @@ class VtecxNext {
2929
2929
  const feed = [];
2930
2930
  if (accounts) {
2931
2931
  for (const account of accounts) {
2932
- const entry = { 'title': account };
2932
+ const entry = { title: account };
2933
2933
  feed.push(entry);
2934
2934
  }
2935
2935
  }
2936
2936
  if (uids) {
2937
2937
  for (const uid of uids) {
2938
- const entry = { 'link': [{ '___rel': 'self', '___href': `/_user/${uid}` }] };
2938
+ const entry = { link: [{ ___rel: 'self', ___href: `/_user/${uid}` }] };
2939
2939
  feed.push(entry);
2940
2940
  }
2941
2941
  }
2942
2942
  // vte.cxへリクエスト
2943
2943
  const method = 'PUT';
2944
- const url = `${SERVLETPATH_DATA}/?_activateuser`;
2944
+ const url = `${SERVLETPATH_PROVIDER}/?_activateuser`;
2945
2945
  let response;
2946
2946
  try {
2947
2947
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -2958,14 +2958,14 @@ class VtecxNext {
2958
2958
  };
2959
2959
  /**
2960
2960
  * cancel user.
2961
- * @param account account
2961
+ * @param isDeleteGroups true if delete groups
2962
2962
  * @return message feed
2963
2963
  */
2964
- canceluser = async () => {
2964
+ canceluser = async (isDeleteGroups) => {
2965
2965
  //console.log('[vtecxnext canceluser] start.')
2966
2966
  // vte.cxへリクエスト
2967
2967
  const method = 'DELETE';
2968
- const url = `${SERVLETPATH_DATA}/?_canceluser`;
2968
+ const url = `${SERVLETPATH_DATA}/?_canceluser${isDeleteGroups ? '&_deletegroup=true' : ''}`;
2969
2969
  let response;
2970
2970
  try {
2971
2971
  response = await this.requestVtecx(method, url);
@@ -3023,13 +3023,13 @@ class VtecxNext {
3023
3023
  const feed = [];
3024
3024
  if (accounts) {
3025
3025
  for (const account of accounts) {
3026
- const entry = { 'title': account };
3026
+ const entry = { title: account };
3027
3027
  feed.push(entry);
3028
3028
  }
3029
3029
  }
3030
3030
  if (uids) {
3031
3031
  for (const uid of uids) {
3032
- const entry = { 'link': [{ '___rel': 'self', '___href': `/_user/${uid}` }] };
3032
+ const entry = { link: [{ ___rel: 'self', ___href: `/_user/${uid}` }] };
3033
3033
  feed.push(entry);
3034
3034
  }
3035
3035
  }
@@ -3219,7 +3219,7 @@ class VtecxNext {
3219
3219
  // レスポンスのエラーチェック
3220
3220
  await checkVtecxResponse(response);
3221
3221
  }
3222
- return { 'feed': { 'title': contentUris } };
3222
+ return { feed: { title: contentUris } };
3223
3223
  };
3224
3224
  /**
3225
3225
  * save files registering with specified size
@@ -3636,12 +3636,12 @@ class VtecxNext {
3636
3636
  checkNotNull(createGroupadminInfo.group, 'group name');
3637
3637
  checkContainSlash(createGroupadminInfo.group, 'group name');
3638
3638
  checkNotNull(createGroupadminInfo.uids, 'uid');
3639
- const links = [{ '___rel': 'self', '___href': `/_group/${createGroupadminInfo.group}` }];
3639
+ const links = [{ ___rel: 'self', ___href: `/_group/${createGroupadminInfo.group}` }];
3640
3640
  for (const uid of createGroupadminInfo.uids) {
3641
- const link = { '___rel': 'via', '___title': uid };
3641
+ const link = { ___rel: 'via', ___title: uid };
3642
3642
  links.push(link);
3643
3643
  }
3644
- const entry = { 'link': links };
3644
+ const entry = { link: links };
3645
3645
  feed.push(entry);
3646
3646
  }
3647
3647
  // vte.cxへリクエスト
@@ -3675,8 +3675,8 @@ class VtecxNext {
3675
3675
  for (const groupName of groupNames) {
3676
3676
  checkNotNull(groupName, 'group name');
3677
3677
  checkContainSlash(groupName, 'group name');
3678
- const links = [{ '___rel': 'self', '___href': `/_group/${groupName}` }];
3679
- const entry = { 'link': links };
3678
+ const links = [{ ___rel: 'self', ___href: `/_group/${groupName}` }];
3679
+ const entry = { link: links };
3680
3680
  feed.push(entry);
3681
3681
  }
3682
3682
  // vte.cxへリクエスト
@@ -3743,7 +3743,7 @@ class VtecxNext {
3743
3743
  // cookieの値をvte.cxへのリクエストヘッダに設定
3744
3744
  const cookie = this.editRequestCookie();
3745
3745
  //console.log(`[requestVtecx] cookie = ${cookie}`)
3746
- const headers = cookie ? { 'Cookie': cookie } : {};
3746
+ const headers = cookie ? { Cookie: cookie } : {};
3747
3747
  if (this.accessToken) {
3748
3748
  headers.Authorization = `Token ${this.accessToken}`;
3749
3749
  }
@@ -3956,11 +3956,11 @@ class VtecxNext {
3956
3956
  // アクセストークン取得URL生成
3957
3957
  const accesstokenMethod = 'POST';
3958
3958
  const accessTokenData = {
3959
- 'grant_type': 'authorization_code',
3960
- 'code': code,
3961
- 'redirect_uri': redirect_uri,
3962
- 'client_id': client_id,
3963
- 'client_secret': client_secret
3959
+ grant_type: 'authorization_code',
3960
+ code: code,
3961
+ redirect_uri: redirect_uri,
3962
+ client_id: client_id,
3963
+ client_secret: client_secret
3964
3964
  };
3965
3965
  const accesstokenBody = createURLSearchParams(accessTokenData).toString();
3966
3966
  //const accesstokenBodyStr = `grant_type=authorization_code&code=${code}&redirect_uri=${encodeRedirect_uri}&client_id=${client_id}&client_secret=${client_secret}`
@@ -3970,11 +3970,11 @@ class VtecxNext {
3970
3970
  const requestInit = {
3971
3971
  headers: {
3972
3972
  'Content-Type': 'application/x-www-form-urlencoded',
3973
- 'Content-Length': String(accesstokenBody.length),
3973
+ 'Content-Length': String(accesstokenBody.length)
3974
3974
  },
3975
3975
  body: accesstokenBody,
3976
3976
  method: accesstokenMethod,
3977
- cache: 'no-cache',
3977
+ cache: 'no-cache'
3978
3978
  };
3979
3979
  let accesstokenResponse;
3980
3980
  try {
@@ -3995,11 +3995,11 @@ class VtecxNext {
3995
3995
  throw new VtecxNextError(401, `Get accesstoken failed.`);
3996
3996
  }
3997
3997
  return {
3998
- 'client_id': client_id,
3999
- 'client_secret': client_secret,
4000
- 'redirect_uri': redirect_uri,
4001
- 'state': state,
4002
- 'access_token': access_token
3998
+ client_id: client_id,
3999
+ client_secret: client_secret,
4000
+ redirect_uri: redirect_uri,
4001
+ state: state,
4002
+ access_token: access_token
4003
4003
  };
4004
4004
  };
4005
4005
  /**
@@ -4012,12 +4012,12 @@ class VtecxNext {
4012
4012
  // LINEユーザ識別情報取得リクエスト
4013
4013
  const url = 'https://api.line.me/v2/profile';
4014
4014
  const method = 'GET';
4015
- const headers = { 'Authorization': `Bearer ${oauthInfo.access_token}` };
4015
+ const headers = { Authorization: `Bearer ${oauthInfo.access_token}` };
4016
4016
  //console.log(`[vtecxnext oauthGetUserinfoLine] url=${url}`)
4017
4017
  const requestInit = {
4018
4018
  headers: headers,
4019
4019
  method: method,
4020
- cache: 'no-cache',
4020
+ cache: 'no-cache'
4021
4021
  };
4022
4022
  let response;
4023
4023
  try {
@@ -4036,9 +4036,9 @@ class VtecxNext {
4036
4036
  throw new VtecxNextError(401, `Get user information failed. `);
4037
4037
  }
4038
4038
  return {
4039
- 'guid': guid,
4040
- 'nickname': nickname,
4041
- 'state': oauthInfo.state
4039
+ guid: guid,
4040
+ nickname: nickname,
4041
+ state: oauthInfo.state
4042
4042
  };
4043
4043
  };
4044
4044
  /**
@@ -4055,7 +4055,7 @@ class VtecxNext {
4055
4055
  const param = '';
4056
4056
  const method = 'POST';
4057
4057
  const url = `${SERVLETPATH_OAUTH}/${provider}/link?state=${userInfo.state}${param}`;
4058
- const reqFeed = [{ 'title': userInfo.guid, 'subtitle': userInfo.nickname }];
4058
+ const reqFeed = [{ title: userInfo.guid, subtitle: userInfo.nickname }];
4059
4059
  let response;
4060
4060
  try {
4061
4061
  response = await fetchVtecx(method, url, {}, JSON.stringify(reqFeed));
@@ -4091,7 +4091,7 @@ class VtecxNext {
4091
4091
  // vte.cxへリクエスト
4092
4092
  const method = 'PUT';
4093
4093
  const url = `${SERVLETPATH_DATA}/?_mergeoauthuser`;
4094
- const feed = { 'feed': { 'subtitle': provider, 'rights': rxid } };
4094
+ const feed = { feed: { subtitle: provider, rights: rxid } };
4095
4095
  let response;
4096
4096
  try {
4097
4097
  response = await this.requestVtecx(method, url, JSON.stringify(feed));
@@ -4157,16 +4157,16 @@ exports.FetchError = FetchError;
4157
4157
  */
4158
4158
  const isVtecxNextError = (value) => {
4159
4159
  // 値がオブジェクトであるかの判定
4160
- if (typeof value !== "object" || value === null) {
4160
+ if (typeof value !== 'object' || value === null) {
4161
4161
  return false;
4162
4162
  }
4163
4163
  const { status, message } = value;
4164
4164
  // statusプロパティーが数値型かを判定
4165
- if (typeof status !== "number") {
4165
+ if (typeof status !== 'number') {
4166
4166
  return false;
4167
4167
  }
4168
4168
  // messageプロパティーが文字列型かを判定
4169
- if (typeof message !== "string") {
4169
+ if (typeof message !== 'string') {
4170
4170
  return false;
4171
4171
  }
4172
4172
  return true;
@@ -4205,7 +4205,7 @@ const fetchVtecx = async (method, url, pHeaders, body, mode) => {
4205
4205
  body: body,
4206
4206
  method: method,
4207
4207
  headers: headers,
4208
- cache: 'no-cache',
4208
+ cache: 'no-cache'
4209
4209
  };
4210
4210
  if (mode) {
4211
4211
  requestInit['mode'] = mode;
@@ -4383,7 +4383,7 @@ const editSqlArgument = (sql, values, parent) => {
4383
4383
  const editSql = values ? formatSql(sql, values) : sql;
4384
4384
  //console.log(`[vtecxnext editSqlArgument] sql=${editSql}`)
4385
4385
  // 引数
4386
- const entry = { 'title': editSql };
4386
+ const entry = { title: editSql };
4387
4387
  if (parent) {
4388
4388
  entry['subtitle'] = parent;
4389
4389
  }
@@ -4415,7 +4415,7 @@ const editSqlsArgument = (sqls, values) => {
4415
4415
  const feed = [];
4416
4416
  let i = 0;
4417
4417
  for (const editSql of editedSqls) {
4418
- const entry = { 'title': editSql };
4418
+ const entry = { title: editSql };
4419
4419
  feed[i] = entry;
4420
4420
  i++;
4421
4421
  }
@@ -4446,7 +4446,7 @@ const getLinks = (rel, hrefs) => {
4446
4446
  const links = [];
4447
4447
  let idx = 0;
4448
4448
  for (const href of hrefs) {
4449
- const link = { '___rel': rel, '___href': href };
4449
+ const link = { ___rel: rel, ___href: href };
4450
4450
  links[idx] = link;
4451
4451
  idx++;
4452
4452
  }
@@ -4473,6 +4473,6 @@ const getOrigin = (oauthUrl) => {
4473
4473
  */
4474
4474
  const createURLSearchParams = (data) => {
4475
4475
  const params = new url_1.URLSearchParams();
4476
- Object.keys(data).forEach(key => params.append(key, data[key]));
4476
+ Object.keys(data).forEach((key) => params.append(key, data[key]));
4477
4477
  return params;
4478
4478
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtecx/vtecxnext",
3
- "version": "2.2.14",
3
+ "version": "2.2.16",
4
4
  "description": "vte.cx Next.js api",
5
5
  "main": "dist/index.js",
6
6
  "files": [