diff --git a/package-lock.json b/package-lock.json index 1a92e6f2..42e4b689 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ali-oss", - "version": "6.19.0", + "version": "6.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ali-oss", - "version": "6.19.0", + "version": "6.20.0", "license": "MIT", "dependencies": { "address": "^1.2.2", @@ -36,6 +36,9 @@ "xml2js": "^0.6.2" }, "devDependencies": { + "@alicloud/openapi-client": "^0.4.10", + "@alicloud/resourcemanager20200331": "^2.3.0", + "@alicloud/tea-util": "^1.4.9", "@babel/core": "^7.11.6", "@babel/plugin-transform-regenerator": "^7.10.4", "@babel/plugin-transform-runtime": "^7.11.5", @@ -73,7 +76,6 @@ "git-pre-hooks": "^1.2.0", "husky": "^7.0.4", "immediate": "^3.3.0", - "istanbul-lib-processinfo": "2.0.2", "karma": "^6.3.4", "karma-browserify": "^8.1.0", "karma-chrome-launcher": "^2.2.0", @@ -88,7 +90,6 @@ "prettier": "^3.0.0", "promise-polyfill": "^6.0.2", "puppeteer": "19.0.0", - "regenerate-unicode-properties": "10.1.0", "semantic-release": "^21.1.1", "should": "^11.0.0", "sinon": "^15.2.0", @@ -112,6 +113,114 @@ "node": ">=0.10.0" } }, + "node_modules/@alicloud/credentials": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@alicloud/credentials/-/credentials-2.3.1.tgz", + "integrity": "sha512-FK8N1YNVqUGOl7qOFn8h3zTwv2Tj8ON3459XXnJkAa08YBECj8o/V81D/ubxpX0yZub4RVKjknxNSHEbrASc+A==", + "dev": true, + "dependencies": { + "@alicloud/tea-typescript": "^1.5.3", + "httpx": "^2.2.0", + "ini": "^1.3.5", + "kitx": "^2.0.0" + } + }, + "node_modules/@alicloud/endpoint-util": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@alicloud/endpoint-util/-/endpoint-util-0.0.1.tgz", + "integrity": "sha512-+pH7/KEXup84cHzIL6UJAaPqETvln4yXlD9JzlrqioyCSaWxbug5FUobsiI6fuUOpw5WwoB3fWAtGbFnJ1K3Yg==", + "dev": true, + "dependencies": { + "@alicloud/tea-typescript": "^1.5.1", + "kitx": "^2.0.0" + } + }, + "node_modules/@alicloud/gateway-spi": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@alicloud/gateway-spi/-/gateway-spi-0.0.8.tgz", + "integrity": "sha512-KM7fu5asjxZPmrz9sJGHJeSU+cNQNOxW+SFmgmAIrITui5hXL2LB+KNRuzWmlwPjnuA2X3/keq9h6++S9jcV5g==", + "dev": true, + "dependencies": { + "@alicloud/credentials": "^2", + "@alicloud/tea-typescript": "^1.7.1" + } + }, + "node_modules/@alicloud/openapi-client": { + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/@alicloud/openapi-client/-/openapi-client-0.4.10.tgz", + "integrity": "sha512-AarOnkQzVscj33eWwIqe5BN+snE/Q3d+s+wzJnRvnldO/E9yiGdZ8UbQQCltzBVoUpuZfu9tVBg60dYvX7wIhg==", + "dev": true, + "dependencies": { + "@alicloud/credentials": "^2", + "@alicloud/gateway-spi": "^0.0.8", + "@alicloud/openapi-util": "^0.3.2", + "@alicloud/tea-typescript": "^1.7.1", + "@alicloud/tea-util": "^1.4.8", + "@alicloud/tea-xml": "0.0.3" + } + }, + "node_modules/@alicloud/openapi-util": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@alicloud/openapi-util/-/openapi-util-0.3.2.tgz", + "integrity": "sha512-EC2JvxdcOgMlBAEG0+joOh2IB1um8CPz9EdYuRfTfd1uP8Yc9D8QRUWVGjP6scnj6fWSOaHFlit9H6PrJSyFow==", + "dev": true, + "dependencies": { + "@alicloud/tea-typescript": "^1.7.1", + "@alicloud/tea-util": "^1.3.0", + "kitx": "^2.1.0", + "sm3": "^1.0.3" + } + }, + "node_modules/@alicloud/resourcemanager20200331": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@alicloud/resourcemanager20200331/-/resourcemanager20200331-2.3.0.tgz", + "integrity": "sha512-jwKoQDghR8exp3wRsJE6wPpPZFSVnwfwEg1lTa6nbJWm9IBJDi+8Arbm1MLoXtWmwbFjsZdOc+STnaO7hOlzeA==", + "dev": true, + "dependencies": { + "@alicloud/endpoint-util": "^0.0.1", + "@alicloud/openapi-client": "^0.4.7", + "@alicloud/openapi-util": "^0.3.2", + "@alicloud/tea-typescript": "^1.7.1", + "@alicloud/tea-util": "^1.4.7" + } + }, + "node_modules/@alicloud/tea-typescript": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@alicloud/tea-typescript/-/tea-typescript-1.8.0.tgz", + "integrity": "sha512-CWXWaquauJf0sW30mgJRVu9aaXyBth5uMBCUc+5vKTK1zlgf3hIqRUjJZbjlwHwQ5y9anwcu18r48nOZb7l2QQ==", + "dev": true, + "dependencies": { + "@types/node": "^12.0.2", + "httpx": "^2.2.6" + } + }, + "node_modules/@alicloud/tea-typescript/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + }, + "node_modules/@alicloud/tea-util": { + "version": "1.4.9", + "resolved": "https://registry.npmjs.org/@alicloud/tea-util/-/tea-util-1.4.9.tgz", + "integrity": "sha512-S0wz76rGtoPKskQtRTGqeuqBHFj8BqUn0Vh+glXKun2/9UpaaaWmuJwcmtImk6bJZfLYEShDF/kxDmDJoNYiTw==", + "dev": true, + "dependencies": { + "@alicloud/tea-typescript": "^1.5.1", + "kitx": "^2.0.0" + } + }, + "node_modules/@alicloud/tea-xml": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@alicloud/tea-xml/-/tea-xml-0.0.3.tgz", + "integrity": "sha512-+/9GliugjrLglsXVrd1D80EqqKgGpyA0eQ6+1ZdUOYCaRguaSwz44trX3PaxPu/HhIPJg9PsGQQ3cSLXWZjbAA==", + "dev": true, + "dependencies": { + "@alicloud/tea-typescript": "^1", + "@types/xml2js": "^0.4.5", + "xml2js": "^0.6.0" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", @@ -3834,6 +3943,15 @@ "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, + "node_modules/@types/xml2js": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.14.tgz", + "integrity": "sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yauzl": { "version": "2.10.3", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", @@ -9277,6 +9395,25 @@ "node": ">= 6" } }, + "node_modules/httpx": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/httpx/-/httpx-2.3.2.tgz", + "integrity": "sha512-ZG7QArW/BB/opy+XVp/zSJYdiPD9FTmPb3VfMnPdAknKFJq2OiIXS9D4oBeDJvWnZnJAzXDy9J/JKATXkJ7qlw==", + "dev": true, + "dependencies": { + "@types/node": "^20", + "debug": "^4.1.1" + } + }, + "node_modules/httpx/node_modules/@types/node": { + "version": "20.14.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.12.tgz", + "integrity": "sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -10588,6 +10725,21 @@ "node": ">=0.10.0" } }, + "node_modules/kitx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/kitx/-/kitx-2.1.0.tgz", + "integrity": "sha512-C/5v9MtIX7aHGOjwn5BmrrbNkJSf7i0R5mRzmh13GSAdRqQ7bYQo/Su2pTYNylFicqKNTVX3HML9k1u8k51+pQ==", + "dev": true, + "dependencies": { + "@types/node": "^12.0.2" + } + }, + "node_modules/kitx/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + }, "node_modules/ko-sleep": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/ko-sleep/-/ko-sleep-1.1.4.tgz", @@ -18003,6 +18155,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/sm3": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sm3/-/sm3-1.0.3.tgz", + "integrity": "sha512-KyFkIfr8QBlFG3uc3NaljaXdYcsbRy1KrSfc4tsQV8jW68jAktGeOcifu530Vx/5LC+PULHT0Rv8LiI8Gw+c1g==", + "dev": true + }, "node_modules/socket.io": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.4.tgz", @@ -19297,6 +19455,12 @@ "undeclared-identifiers": "bin.js" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/unescape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unescape/-/unescape-1.0.1.tgz", diff --git a/package.json b/package.json index 336992ee..032c0e92 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,9 @@ "node": ">=8" }, "devDependencies": { + "@alicloud/openapi-client": "^0.4.10", + "@alicloud/resourcemanager20200331": "^2.3.0", + "@alicloud/tea-util": "^1.4.9", "@babel/core": "^7.11.6", "@babel/plugin-transform-regenerator": "^7.10.4", "@babel/plugin-transform-runtime": "^7.11.5", diff --git a/test/node/bucket.test.js b/test/node/bucket.test.js index 84e4efdd..c7acd09a 100644 --- a/test/node/bucket.test.js +++ b/test/node/bucket.test.js @@ -1,7 +1,12 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ const assert = require('assert'); const utils = require('./utils'); const oss = require('../..'); const ms = require('humanize-ms'); +const { default: ResourceManager, ListResourceGroupsRequest } = require('@alicloud/resourcemanager20200331'); +const { Config: OConfig } = require('@alicloud/openapi-client'); +const { RuntimeOptions } = require('@alicloud/tea-util'); + const { oss: config, metaSyncTime, timeout } = require('../config'); describe('test/bucket.test.js', () => { @@ -265,12 +270,23 @@ describe('test/bucket.test.js', () => { } }); - it('should list buckets by group id', async () => { - const { buckets } = await store.listBuckets( - {}, - { headers: { 'x-oss-resource-group-id': 'rg-acfmwscflgywd3q' } } // default resource group - ); - assert(buckets.length > 0); + it.only('should list buckets by group id', async () => { + const { accessKeyId, accessKeySecret } = config; + const oconfig = new OConfig({ + accessKeyId, + accessKeySecret + }); + oconfig.endpoint = `resourcemanager.aliyuncs.com`; + const client = new ResourceManager(oconfig); + const runtime = new RuntimeOptions({}); + const { + body: { + resourceGroups: { resourceGroup } + } + } = await client.listResourceGroupsWithOptions(new ListResourceGroupsRequest({}), runtime); + const { id } = resourceGroup.find(re => re.name === 'sdktest'); + const { buckets } = await store.listBuckets({}, { headers: { 'x-oss-resource-group-id': id } }); + assert(buckets.length, 2); }); after(async () => {