@cloudbase/js-sdk 3.9.0 → 3.9.1
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/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/auth/dist/index.d.ts +1 -0
- package/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/auth/dist/type.d.ts +2 -2
- package/core.d.ts +13 -3
- package/database/dist/index.d.ts +147 -0
- package/database/dist/index.esm.js +1 -1
- package/database/dist/index.esm.js.map +1 -1
- package/database/dist/index.js +1 -1
- package/database/dist/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/auth/index.d.ts +1 -0
- package/miniprogram_dist/auth/index.js +1 -1
- package/miniprogram_dist/database/index.d.ts +147 -0
- package/miniprogram_dist/database/index.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/oauth/index.d.ts +1 -1
- package/miniprogram_dist/oauth/index.js +1 -1
- package/oauth/dist/auth/consts.d.ts +3 -1
- package/oauth/dist/index.d.ts +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,150 @@
|
|
|
1
1
|
import { ICloudbase } from '@cloudbase/js-sdk/types';
|
|
2
2
|
import cloudbaseNS from '../../index';
|
|
3
|
+
declare type QueryType = 'WHERE' | 'DOC';
|
|
4
|
+
interface IDbConfig {
|
|
5
|
+
instance?: string;
|
|
6
|
+
database?: string;
|
|
7
|
+
}
|
|
8
|
+
interface IBaseReq extends IDbConfig {
|
|
9
|
+
collectionName: string;
|
|
10
|
+
transactionId?: string;
|
|
11
|
+
}
|
|
12
|
+
interface IDocumentsQueryReq extends IBaseReq {
|
|
13
|
+
query?: any;
|
|
14
|
+
queryType?: QueryType;
|
|
15
|
+
order?: Record<string, any> | {
|
|
16
|
+
field: string;
|
|
17
|
+
direction: string;
|
|
18
|
+
}[] | string;
|
|
19
|
+
offset?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
projection?: Object;
|
|
22
|
+
}
|
|
23
|
+
interface IDocumentsAddReq extends IBaseReq {
|
|
24
|
+
data: Object | Object[];
|
|
25
|
+
}
|
|
26
|
+
interface IDocumentsUpdateReq extends IBaseReq {
|
|
27
|
+
query: Object;
|
|
28
|
+
data: Object;
|
|
29
|
+
multi?: boolean;
|
|
30
|
+
merge?: boolean;
|
|
31
|
+
upsert?: boolean;
|
|
32
|
+
replaceMode?: boolean;
|
|
33
|
+
queryType?: QueryType;
|
|
34
|
+
}
|
|
35
|
+
interface IDocumentsRemoveReq extends IBaseReq {
|
|
36
|
+
query: Object;
|
|
37
|
+
multi?: boolean;
|
|
38
|
+
queryType?: QueryType;
|
|
39
|
+
}
|
|
40
|
+
interface IDocumentsCountReq extends IBaseReq {
|
|
41
|
+
query: Object;
|
|
42
|
+
queryType?: QueryType;
|
|
43
|
+
}
|
|
44
|
+
interface ICommonRes<T> {
|
|
45
|
+
data?: T & {
|
|
46
|
+
code?: string;
|
|
47
|
+
};
|
|
48
|
+
requestId: string;
|
|
49
|
+
code?: string;
|
|
50
|
+
message?: string;
|
|
51
|
+
}
|
|
52
|
+
interface IAddRes {
|
|
53
|
+
_id?: string;
|
|
54
|
+
ids?: string[];
|
|
55
|
+
insertedIds: string[];
|
|
56
|
+
}
|
|
57
|
+
interface IRunCommandsReq {
|
|
58
|
+
transactionId?: string;
|
|
59
|
+
commands: Object[];
|
|
60
|
+
}
|
|
61
|
+
export declare const gateWayFunc: {
|
|
62
|
+
filterRes<T>(res: ICommonRes<T> & {
|
|
63
|
+
header?: any;
|
|
64
|
+
statusCode?: number;
|
|
65
|
+
}): ICommonRes<T>;
|
|
66
|
+
flattenResData<T_1>(res: ICommonRes<T_1>): any;
|
|
67
|
+
safeParseEJSON(data: any): any;
|
|
68
|
+
parseEJSONParam(value: any): any;
|
|
69
|
+
parseEJSONValue(value: any): any;
|
|
70
|
+
normalizeOrderParam(value: any): any;
|
|
71
|
+
extractDocId(query: any): string | undefined;
|
|
72
|
+
toLegacyRegExp(value: any): any;
|
|
73
|
+
parseWriteParam(value: any): any;
|
|
74
|
+
buildQueryParams(params: Record<string, any>): string;
|
|
75
|
+
getUrlPrefix(data: IDbConfig): string;
|
|
76
|
+
'database.queryDocument'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
77
|
+
offset?: number;
|
|
78
|
+
limit?: number;
|
|
79
|
+
list: any[];
|
|
80
|
+
}>>;
|
|
81
|
+
'database.addDocument'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes>>;
|
|
82
|
+
'database.updateDocument'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
83
|
+
matched: number;
|
|
84
|
+
updated: number;
|
|
85
|
+
upsert_id: string;
|
|
86
|
+
}>>;
|
|
87
|
+
'database.deleteDocument'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
88
|
+
deleted: number;
|
|
89
|
+
}>>;
|
|
90
|
+
'database.countDocument'(data: IDocumentsCountReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
91
|
+
total: number;
|
|
92
|
+
}>>;
|
|
93
|
+
'database.addCollection'(data: {
|
|
94
|
+
collectionName: string;
|
|
95
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<''>>;
|
|
96
|
+
'database.aggregate'(data: {
|
|
97
|
+
collectionName: string;
|
|
98
|
+
stages: {
|
|
99
|
+
stageKey: string;
|
|
100
|
+
stageValue: any;
|
|
101
|
+
}[];
|
|
102
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
103
|
+
list: string;
|
|
104
|
+
}>>;
|
|
105
|
+
'database.startTransaction'(data: IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
106
|
+
'database.commitTransaction'(data: {
|
|
107
|
+
transactionId: string;
|
|
108
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
109
|
+
'database.abortTransaction'(data: {
|
|
110
|
+
transactionId: string;
|
|
111
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<unknown>>;
|
|
112
|
+
'database.getInTransaction'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<any>;
|
|
113
|
+
'database.updateDocInTransaction'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<any>;
|
|
114
|
+
'database.deleteDocInTransaction'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<any>;
|
|
115
|
+
'database.insertDocInTransaction'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes & {
|
|
116
|
+
inserted?: number;
|
|
117
|
+
}>>;
|
|
118
|
+
'database.runCommands'(data: IRunCommandsReq & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
119
|
+
list: Object[][];
|
|
120
|
+
}>>;
|
|
121
|
+
'database.getDocument'(data: IDocumentsQueryReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
122
|
+
offset?: number;
|
|
123
|
+
limit?: number;
|
|
124
|
+
list: any[];
|
|
125
|
+
}>>;
|
|
126
|
+
'database.insertDocument'(data: IDocumentsAddReq, customReqOpts?: any): Promise<ICommonRes<IAddRes>>;
|
|
127
|
+
'database.modifyDocument'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
128
|
+
matched: number;
|
|
129
|
+
updated: number;
|
|
130
|
+
upsert_id: string;
|
|
131
|
+
}>>;
|
|
132
|
+
'database.modifyAndReturnDoc'(data: IDocumentsUpdateReq, customReqOpts?: any): Promise<any>;
|
|
133
|
+
'database.removeDocument'(data: IDocumentsRemoveReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
134
|
+
deleted: number;
|
|
135
|
+
}>>;
|
|
136
|
+
'database.calculateDocument'(data: IDocumentsCountReq, customReqOpts?: any): Promise<ICommonRes<{
|
|
137
|
+
total: number;
|
|
138
|
+
}>>;
|
|
139
|
+
'database.aggregateDocuments'(data: {
|
|
140
|
+
collectionName: string;
|
|
141
|
+
stages: {
|
|
142
|
+
stageKey: string;
|
|
143
|
+
stageValue: any;
|
|
144
|
+
}[];
|
|
145
|
+
} & IDbConfig, customReqOpts?: any): Promise<ICommonRes<{
|
|
146
|
+
list: any;
|
|
147
|
+
}>>;
|
|
148
|
+
};
|
|
3
149
|
export declare function registerDatabase(app: ICloudbase | typeof cloudbaseNS): void;
|
|
150
|
+
export {};
|