@cloudbase/node-sdk 3.16.0 → 3.17.0
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.
|
@@ -22,6 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
25
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
37
|
exports.TcbDBApiHttpRequester = void 0;
|
|
27
38
|
const tcbapicaller = __importStar(require("./tcbapirequester"));
|
|
@@ -36,9 +47,10 @@ class TcbDBApiHttpRequester {
|
|
|
36
47
|
* @param opts - 可选配置项
|
|
37
48
|
*/
|
|
38
49
|
async send(api, data, opts) {
|
|
39
|
-
const
|
|
50
|
+
const _a = this.config, { instance, database } = _a, config = __rest(_a, ["instance", "database"]);
|
|
51
|
+
const params = Object.assign(Object.assign({}, data), { action: api, instance, database });
|
|
40
52
|
return await tcbapicaller.request({
|
|
41
|
-
config
|
|
53
|
+
config,
|
|
42
54
|
params,
|
|
43
55
|
method: 'post',
|
|
44
56
|
opts,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/node-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "tencent cloud base server sdk for node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "types/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@cloudbase/ai": "^2.23.0",
|
|
45
45
|
"@cloudbase/app": "^2.23.0",
|
|
46
|
-
"@cloudbase/database": "1.4.
|
|
46
|
+
"@cloudbase/database": "1.4.3",
|
|
47
47
|
"@cloudbase/signature-nodejs": "2.2.0",
|
|
48
48
|
"@cloudbase/types": "^2.23.0",
|
|
49
49
|
"@cloudbase/wx-cloud-client-sdk": "1.7.1",
|
package/src/cloudbase.ts
CHANGED
|
@@ -36,7 +36,8 @@ import {
|
|
|
36
36
|
IReportData,
|
|
37
37
|
|
|
38
38
|
Extension,
|
|
39
|
-
ICallApisOptions
|
|
39
|
+
ICallApisOptions,
|
|
40
|
+
ICloudBaseDBConfig
|
|
40
41
|
} from '../types'
|
|
41
42
|
|
|
42
43
|
import { auth } from './auth'
|
|
@@ -250,7 +251,7 @@ export class CloudBase {
|
|
|
250
251
|
return auth(this)
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
public database(dbConfig:
|
|
254
|
+
public database(dbConfig: ICloudBaseDBConfig = {}) {
|
|
254
255
|
return newDb(this, dbConfig)
|
|
255
256
|
}
|
|
256
257
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as tcbapicaller from './tcbapirequester'
|
|
2
|
-
import {
|
|
2
|
+
import { ICustomReqOpts, ICloudBaseDBConfig } from '../../types'
|
|
3
3
|
|
|
4
4
|
export class TcbDBApiHttpRequester {
|
|
5
|
-
private readonly config:
|
|
5
|
+
private readonly config: ICloudBaseDBConfig
|
|
6
6
|
|
|
7
|
-
public constructor(config:
|
|
7
|
+
public constructor(config: ICloudBaseDBConfig) {
|
|
8
8
|
this.config = config
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -15,10 +15,11 @@ export class TcbDBApiHttpRequester {
|
|
|
15
15
|
* @param opts - 可选配置项
|
|
16
16
|
*/
|
|
17
17
|
public async send(api: string, data: any, opts?: ICustomReqOpts): Promise<any> {
|
|
18
|
-
const
|
|
18
|
+
const { instance, database, ...config } = this.config
|
|
19
|
+
const params = { ...data, action: api, instance, database }
|
|
19
20
|
|
|
20
21
|
return await tcbapicaller.request({
|
|
21
|
-
config
|
|
22
|
+
config,
|
|
22
23
|
params,
|
|
23
24
|
method: 'post',
|
|
24
25
|
opts,
|
package/types/index.d.ts
CHANGED
|
@@ -248,6 +248,19 @@ export interface IBaseResult {
|
|
|
248
248
|
requestId?: string
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
/* ********************************** database ********************************** */
|
|
252
|
+
|
|
253
|
+
export interface ICloudBaseDBConfig extends ICloudBaseConfig {
|
|
254
|
+
/**
|
|
255
|
+
* 数据库实例
|
|
256
|
+
*/
|
|
257
|
+
instance?: string
|
|
258
|
+
/**
|
|
259
|
+
* 数据库名称
|
|
260
|
+
*/
|
|
261
|
+
database?: string
|
|
262
|
+
}
|
|
263
|
+
|
|
251
264
|
/* ********************************** storage ********************************** */
|
|
252
265
|
|
|
253
266
|
export interface IUploadFileOptions {
|
|
@@ -521,7 +534,7 @@ export declare class CloudBase {
|
|
|
521
534
|
/**
|
|
522
535
|
* database - 获取云数据库实例
|
|
523
536
|
*/
|
|
524
|
-
database(dbConfig:
|
|
537
|
+
database(dbConfig: ICloudBaseDBConfig = {}): Db
|
|
525
538
|
|
|
526
539
|
/**
|
|
527
540
|
* callFunction - 调用云函数
|