@cloudbase/database 0.9.19 → 0.9.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/.trunk/configs/.markdownlint.yaml +10 -0
- package/.trunk/trunk.yaml +26 -0
- package/dist/commonjs/aggregate.d.ts +29 -29
- package/dist/commonjs/aggregate.js +156 -156
- package/dist/commonjs/collection.d.ts +9 -9
- package/dist/commonjs/collection.js +46 -46
- package/dist/commonjs/command.d.ts +175 -175
- package/dist/commonjs/command.js +298 -298
- package/dist/commonjs/commands/logic.d.ts +24 -24
- package/dist/commonjs/commands/logic.js +88 -88
- package/dist/commonjs/commands/query.d.ts +68 -68
- package/dist/commonjs/commands/query.js +157 -157
- package/dist/commonjs/commands/update.d.ts +29 -29
- package/dist/commonjs/commands/update.js +50 -50
- package/dist/commonjs/config/app.config.d.ts +6 -6
- package/dist/commonjs/config/app.config.js +7 -7
- package/dist/commonjs/config/error.config.d.ts +3 -3
- package/dist/commonjs/config/error.config.js +15 -15
- package/dist/commonjs/const/code.d.ts +30 -30
- package/dist/commonjs/const/code.js +32 -32
- package/dist/commonjs/constant.d.ts +51 -51
- package/dist/commonjs/constant.js +74 -74
- package/dist/commonjs/document.d.ts +11 -11
- package/dist/commonjs/document.js +249 -252
- package/dist/commonjs/geo/index.d.ts +6 -6
- package/dist/commonjs/geo/index.js +11 -11
- package/dist/commonjs/geo/interface.d.ts +24 -24
- package/dist/commonjs/geo/interface.js +2 -2
- package/dist/commonjs/geo/lineString.d.ts +19 -19
- package/dist/commonjs/geo/lineString.js +85 -85
- package/dist/commonjs/geo/multiLineString.d.ts +18 -18
- package/dist/commonjs/geo/multiLineString.js +94 -94
- package/dist/commonjs/geo/multiPoint.d.ts +18 -18
- package/dist/commonjs/geo/multiPoint.js +78 -78
- package/dist/commonjs/geo/multiPolygon.d.ts +18 -18
- package/dist/commonjs/geo/multiPolygon.js +121 -121
- package/dist/commonjs/geo/point.d.ts +19 -19
- package/dist/commonjs/geo/point.js +49 -49
- package/dist/commonjs/geo/polygon.d.ts +19 -19
- package/dist/commonjs/geo/polygon.js +108 -108
- package/dist/commonjs/helper/symbol.d.ts +14 -14
- package/dist/commonjs/helper/symbol.js +19 -19
- package/dist/commonjs/index.d.ts +33 -33
- package/dist/commonjs/index.js +46 -46
- package/dist/commonjs/lib/util.d.ts +1 -1
- package/dist/commonjs/lib/util.js +25 -25
- package/dist/commonjs/operator-map.d.ts +4 -4
- package/dist/commonjs/operator-map.js +23 -23
- package/dist/commonjs/query.d.ts +22 -22
- package/dist/commonjs/query.js +251 -251
- package/dist/commonjs/regexp/index.d.ts +14 -14
- package/dist/commonjs/regexp/index.js +32 -32
- package/dist/commonjs/serializer/common.d.ts +11 -11
- package/dist/commonjs/serializer/common.js +121 -121
- package/dist/commonjs/serializer/datatype.d.ts +7 -7
- package/dist/commonjs/serializer/datatype.js +126 -126
- package/dist/commonjs/serializer/query.d.ts +7 -7
- package/dist/commonjs/serializer/query.js +231 -231
- package/dist/commonjs/serializer/update.d.ts +15 -15
- package/dist/commonjs/serializer/update.js +141 -141
- package/dist/commonjs/serverDate/index.d.ts +13 -13
- package/dist/commonjs/serverDate/index.js +29 -29
- package/dist/commonjs/transaction/collection.d.ts +7 -7
- package/dist/commonjs/transaction/collection.js +46 -46
- package/dist/commonjs/transaction/document.d.ts +27 -27
- package/dist/commonjs/transaction/document.js +205 -205
- package/dist/commonjs/transaction/index.d.ts +30 -30
- package/dist/commonjs/transaction/index.js +214 -214
- package/dist/commonjs/transaction/query.d.ts +5 -5
- package/dist/commonjs/transaction/query.js +10 -10
- package/dist/commonjs/typings/index.d.ts +40 -40
- package/dist/commonjs/typings/index.js +2 -2
- package/dist/commonjs/typings/realtime.d.ts +219 -219
- package/dist/commonjs/typings/realtime.js +2 -2
- package/dist/commonjs/util.d.ts +9 -9
- package/dist/commonjs/util.js +144 -144
- package/dist/commonjs/utils/error.d.ts +37 -37
- package/dist/commonjs/utils/error.js +85 -85
- package/dist/commonjs/utils/symbol.d.ts +8 -8
- package/dist/commonjs/utils/symbol.js +57 -57
- package/dist/commonjs/utils/type.d.ts +13 -13
- package/dist/commonjs/utils/type.js +22 -22
- package/dist/commonjs/utils/utils.d.ts +4 -4
- package/dist/commonjs/utils/utils.js +36 -36
- package/dist/commonjs/validate.d.ts +1 -1
- package/dist/commonjs/validate.js +59 -59
- package/dist/esm/aggregate.d.ts +29 -29
- package/dist/esm/aggregate.js +154 -154
- package/dist/esm/collection.d.ts +9 -9
- package/dist/esm/collection.js +44 -44
- package/dist/esm/command.d.ts +175 -175
- package/dist/esm/command.js +296 -296
- package/dist/esm/commands/logic.d.ts +24 -24
- package/dist/esm/commands/logic.js +84 -84
- package/dist/esm/commands/query.d.ts +68 -68
- package/dist/esm/commands/query.js +152 -152
- package/dist/esm/commands/update.d.ts +29 -29
- package/dist/esm/commands/update.js +46 -46
- package/dist/esm/config/app.config.d.ts +6 -6
- package/dist/esm/config/app.config.js +5 -5
- package/dist/esm/config/error.config.d.ts +3 -3
- package/dist/esm/config/error.config.js +13 -13
- package/dist/esm/const/code.d.ts +30 -30
- package/dist/esm/const/code.js +30 -30
- package/dist/esm/constant.d.ts +51 -51
- package/dist/esm/constant.js +65 -65
- package/dist/esm/document.d.ts +11 -11
- package/dist/esm/document.js +247 -250
- package/dist/esm/geo/index.d.ts +6 -6
- package/dist/esm/geo/index.js +6 -6
- package/dist/esm/geo/interface.d.ts +24 -24
- package/dist/esm/geo/lineString.d.ts +19 -19
- package/dist/esm/geo/lineString.js +83 -83
- package/dist/esm/geo/multiLineString.d.ts +18 -18
- package/dist/esm/geo/multiLineString.js +92 -92
- package/dist/esm/geo/multiPoint.d.ts +18 -18
- package/dist/esm/geo/multiPoint.js +76 -76
- package/dist/esm/geo/multiPolygon.d.ts +18 -18
- package/dist/esm/geo/multiPolygon.js +119 -119
- package/dist/esm/geo/point.d.ts +19 -19
- package/dist/esm/geo/point.js +47 -47
- package/dist/esm/geo/polygon.d.ts +19 -19
- package/dist/esm/geo/polygon.js +106 -106
- package/dist/esm/helper/symbol.d.ts +14 -14
- package/dist/esm/helper/symbol.js +14 -14
- package/dist/esm/index.d.ts +33 -33
- package/dist/esm/index.js +41 -41
- package/dist/esm/lib/util.d.ts +1 -1
- package/dist/esm/lib/util.js +23 -23
- package/dist/esm/operator-map.d.ts +4 -4
- package/dist/esm/operator-map.js +20 -20
- package/dist/esm/query.d.ts +22 -22
- package/dist/esm/query.js +249 -249
- package/dist/esm/regexp/index.d.ts +14 -14
- package/dist/esm/regexp/index.js +29 -29
- package/dist/esm/serializer/common.d.ts +11 -11
- package/dist/esm/serializer/common.js +113 -113
- package/dist/esm/serializer/datatype.d.ts +7 -7
- package/dist/esm/serializer/datatype.js +122 -122
- package/dist/esm/serializer/query.d.ts +7 -7
- package/dist/esm/serializer/query.js +229 -229
- package/dist/esm/serializer/update.d.ts +15 -15
- package/dist/esm/serializer/update.js +139 -139
- package/dist/esm/serverDate/index.d.ts +13 -13
- package/dist/esm/serverDate/index.js +26 -26
- package/dist/esm/transaction/collection.d.ts +7 -7
- package/dist/esm/transaction/collection.js +44 -44
- package/dist/esm/transaction/document.d.ts +27 -27
- package/dist/esm/transaction/document.js +203 -203
- package/dist/esm/transaction/index.d.ts +30 -30
- package/dist/esm/transaction/index.js +210 -210
- package/dist/esm/transaction/query.d.ts +5 -5
- package/dist/esm/transaction/query.js +8 -8
- package/dist/esm/typings/index.d.ts +40 -40
- package/dist/esm/typings/realtime.d.ts +219 -219
- package/dist/esm/util.d.ts +9 -9
- package/dist/esm/util.js +142 -142
- package/dist/esm/utils/error.d.ts +37 -37
- package/dist/esm/utils/error.js +82 -82
- package/dist/esm/utils/symbol.d.ts +8 -8
- package/dist/esm/utils/symbol.js +55 -55
- package/dist/esm/utils/type.d.ts +13 -13
- package/dist/esm/utils/type.js +20 -20
- package/dist/esm/utils/utils.d.ts +4 -4
- package/dist/esm/utils/utils.js +33 -33
- package/dist/esm/validate.d.ts +1 -1
- package/dist/esm/validate.js +57 -57
- package/package.json +1 -1
- package/src/document.ts +1 -4
- package/src/query.ts +3 -3
- package/src/transaction/document.ts +2 -2
- package/dist/commonjs/ObjectId/index.d.ts +0 -11
- package/dist/commonjs/ObjectId/index.js +0 -21
- package/dist/commonjs/realtime/error.d.ts +0 -7
- package/dist/commonjs/realtime/error.js +0 -11
- package/dist/commonjs/realtime/listener.d.ts +0 -14
- package/dist/commonjs/realtime/listener.js +0 -17
- package/dist/commonjs/realtime/message.d.ts +0 -3
- package/dist/commonjs/realtime/message.js +0 -10
- package/dist/commonjs/realtime/snapshot.d.ts +0 -16
- package/dist/commonjs/realtime/snapshot.js +0 -42
- package/dist/commonjs/realtime/virtual-websocket-client.d.ts +0 -63
- package/dist/commonjs/realtime/virtual-websocket-client.js +0 -736
- package/dist/commonjs/realtime/websocket-client.d.ts +0 -78
- package/dist/commonjs/realtime/websocket-client.js +0 -567
- package/dist/commonjs/realtime/ws-event.d.ts +0 -126
- package/dist/commonjs/realtime/ws-event.js +0 -139
- package/dist/commonjs/transaction.d.ts +0 -42
- package/dist/commonjs/transaction.js +0 -126
- package/dist/esm/ObjectId/index.d.ts +0 -11
- package/dist/esm/ObjectId/index.js +0 -17
- package/dist/esm/realtime/error.d.ts +0 -7
- package/dist/esm/realtime/error.js +0 -8
- package/dist/esm/realtime/listener.d.ts +0 -14
- package/dist/esm/realtime/listener.js +0 -14
- package/dist/esm/realtime/message.d.ts +0 -3
- package/dist/esm/realtime/message.js +0 -6
- package/dist/esm/realtime/snapshot.d.ts +0 -16
- package/dist/esm/realtime/snapshot.js +0 -39
- package/dist/esm/realtime/virtual-websocket-client.d.ts +0 -63
- package/dist/esm/realtime/virtual-websocket-client.js +0 -733
- package/dist/esm/realtime/websocket-client.d.ts +0 -78
- package/dist/esm/realtime/websocket-client.js +0 -564
- package/dist/esm/realtime/ws-event.d.ts +0 -126
- package/dist/esm/realtime/ws-event.js +0 -137
- package/dist/esm/transaction.d.ts +0 -42
- package/dist/esm/transaction.js +0 -121
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import InternalSymbol from '../utils/symbol';
|
|
2
|
-
export * from '../utils/symbol';
|
|
3
|
-
export var SYMBOL_UNSET_FIELD_NAME = InternalSymbol.for('UNSET_FIELD_NAME');
|
|
4
|
-
export var SYMBOL_UPDATE_COMMAND = InternalSymbol.for('UPDATE_COMMAND');
|
|
5
|
-
export var SYMBOL_QUERY_COMMAND = InternalSymbol.for('QUERY_COMMAND');
|
|
6
|
-
export var SYMBOL_LOGIC_COMMAND = InternalSymbol.for('LOGIC_COMMAND');
|
|
7
|
-
export var SYMBOL_GEO_POINT = InternalSymbol.for('GEO_POINT');
|
|
8
|
-
export var SYMBOL_GEO_LINE_STRING = InternalSymbol.for('SYMBOL_GEO_LINE_STRING');
|
|
9
|
-
export var SYMBOL_GEO_POLYGON = InternalSymbol.for('SYMBOL_GEO_POLYGON');
|
|
10
|
-
export var SYMBOL_GEO_MULTI_POINT = InternalSymbol.for('SYMBOL_GEO_MULTI_POINT');
|
|
11
|
-
export var SYMBOL_GEO_MULTI_LINE_STRING = InternalSymbol.for('SYMBOL_GEO_MULTI_LINE_STRING');
|
|
12
|
-
export var SYMBOL_GEO_MULTI_POLYGON = InternalSymbol.for('SYMBOL_GEO_MULTI_POLYGON');
|
|
13
|
-
export var SYMBOL_SERVER_DATE = InternalSymbol.for('SERVER_DATE');
|
|
14
|
-
export var SYMBOL_REGEXP = InternalSymbol.for('REGEXP');
|
|
1
|
+
import InternalSymbol from '../utils/symbol';
|
|
2
|
+
export * from '../utils/symbol';
|
|
3
|
+
export var SYMBOL_UNSET_FIELD_NAME = InternalSymbol.for('UNSET_FIELD_NAME');
|
|
4
|
+
export var SYMBOL_UPDATE_COMMAND = InternalSymbol.for('UPDATE_COMMAND');
|
|
5
|
+
export var SYMBOL_QUERY_COMMAND = InternalSymbol.for('QUERY_COMMAND');
|
|
6
|
+
export var SYMBOL_LOGIC_COMMAND = InternalSymbol.for('LOGIC_COMMAND');
|
|
7
|
+
export var SYMBOL_GEO_POINT = InternalSymbol.for('GEO_POINT');
|
|
8
|
+
export var SYMBOL_GEO_LINE_STRING = InternalSymbol.for('SYMBOL_GEO_LINE_STRING');
|
|
9
|
+
export var SYMBOL_GEO_POLYGON = InternalSymbol.for('SYMBOL_GEO_POLYGON');
|
|
10
|
+
export var SYMBOL_GEO_MULTI_POINT = InternalSymbol.for('SYMBOL_GEO_MULTI_POINT');
|
|
11
|
+
export var SYMBOL_GEO_MULTI_LINE_STRING = InternalSymbol.for('SYMBOL_GEO_MULTI_LINE_STRING');
|
|
12
|
+
export var SYMBOL_GEO_MULTI_POLYGON = InternalSymbol.for('SYMBOL_GEO_MULTI_POLYGON');
|
|
13
|
+
export var SYMBOL_SERVER_DATE = InternalSymbol.for('SERVER_DATE');
|
|
14
|
+
export var SYMBOL_REGEXP = InternalSymbol.for('REGEXP');
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Point } from './geo/point';
|
|
2
|
-
import { CollectionReference } from './collection';
|
|
3
|
-
import { Command } from './command';
|
|
4
|
-
interface GeoTeyp {
|
|
5
|
-
Point: typeof Point;
|
|
6
|
-
}
|
|
7
|
-
export { Query } from './query';
|
|
8
|
-
export { CollectionReference } from './collection';
|
|
9
|
-
export { DocumentReference } from './document';
|
|
10
|
-
export declare class Db {
|
|
11
|
-
Geo: GeoTeyp;
|
|
12
|
-
command: typeof Command;
|
|
13
|
-
RegExp: any;
|
|
14
|
-
serverDate: any;
|
|
15
|
-
startTransaction: any;
|
|
16
|
-
runTransaction: any;
|
|
17
|
-
logicCommand: any;
|
|
18
|
-
updateCommand: any;
|
|
19
|
-
queryCommand: any;
|
|
20
|
-
config: any;
|
|
21
|
-
static ws: any;
|
|
22
|
-
static reqClass: any;
|
|
23
|
-
static wsClass: any;
|
|
24
|
-
static wsClientClass: any;
|
|
25
|
-
static createSign: Function;
|
|
26
|
-
static getAccessToken: Function;
|
|
27
|
-
static dataVersion: string;
|
|
28
|
-
static runtime: string;
|
|
29
|
-
static appSecretInfo: any;
|
|
30
|
-
constructor(config?: any);
|
|
31
|
-
collection(collName: string): CollectionReference;
|
|
32
|
-
createCollection(collName: string): any;
|
|
33
|
-
}
|
|
1
|
+
import { Point } from './geo/point';
|
|
2
|
+
import { CollectionReference } from './collection';
|
|
3
|
+
import { Command } from './command';
|
|
4
|
+
interface GeoTeyp {
|
|
5
|
+
Point: typeof Point;
|
|
6
|
+
}
|
|
7
|
+
export { Query } from './query';
|
|
8
|
+
export { CollectionReference } from './collection';
|
|
9
|
+
export { DocumentReference } from './document';
|
|
10
|
+
export declare class Db {
|
|
11
|
+
Geo: GeoTeyp;
|
|
12
|
+
command: typeof Command;
|
|
13
|
+
RegExp: any;
|
|
14
|
+
serverDate: any;
|
|
15
|
+
startTransaction: any;
|
|
16
|
+
runTransaction: any;
|
|
17
|
+
logicCommand: any;
|
|
18
|
+
updateCommand: any;
|
|
19
|
+
queryCommand: any;
|
|
20
|
+
config: any;
|
|
21
|
+
static ws: any;
|
|
22
|
+
static reqClass: any;
|
|
23
|
+
static wsClass: any;
|
|
24
|
+
static wsClientClass: any;
|
|
25
|
+
static createSign: Function;
|
|
26
|
+
static getAccessToken: Function;
|
|
27
|
+
static dataVersion: string;
|
|
28
|
+
static runtime: string;
|
|
29
|
+
static appSecretInfo: any;
|
|
30
|
+
constructor(config?: any);
|
|
31
|
+
collection(collName: string): CollectionReference;
|
|
32
|
+
createCollection(collName: string): any;
|
|
33
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import * as Geo from './geo/index';
|
|
2
|
-
import { CollectionReference } from './collection';
|
|
3
|
-
import { Command } from './command';
|
|
4
|
-
import { ServerDateConstructor } from './serverDate/index';
|
|
5
|
-
import { RegExpConstructor } from './regexp/index';
|
|
6
|
-
import { startTransaction, runTransaction } from './transaction/index';
|
|
7
|
-
import { LogicCommand } from './commands/logic';
|
|
8
|
-
import { QueryCommand } from './commands/query';
|
|
9
|
-
import { UpdateCommand } from './commands/update';
|
|
10
|
-
export { Query } from './query';
|
|
11
|
-
export { CollectionReference } from './collection';
|
|
12
|
-
export { DocumentReference } from './document';
|
|
13
|
-
var Db = (function () {
|
|
14
|
-
function Db(config) {
|
|
15
|
-
this.config = config;
|
|
16
|
-
this.Geo = Geo;
|
|
17
|
-
this.serverDate = ServerDateConstructor;
|
|
18
|
-
this.command = Command;
|
|
19
|
-
this.RegExp = RegExpConstructor;
|
|
20
|
-
this.startTransaction = startTransaction;
|
|
21
|
-
this.runTransaction = runTransaction;
|
|
22
|
-
this.logicCommand = LogicCommand;
|
|
23
|
-
this.updateCommand = UpdateCommand;
|
|
24
|
-
this.queryCommand = QueryCommand;
|
|
25
|
-
}
|
|
26
|
-
Db.prototype.collection = function (collName) {
|
|
27
|
-
if (!collName) {
|
|
28
|
-
throw new Error('Collection name is required');
|
|
29
|
-
}
|
|
30
|
-
return new CollectionReference(this, collName);
|
|
31
|
-
};
|
|
32
|
-
Db.prototype.createCollection = function (collName) {
|
|
33
|
-
var request = new Db.reqClass(this.config);
|
|
34
|
-
var params = {
|
|
35
|
-
collectionName: collName
|
|
36
|
-
};
|
|
37
|
-
return request.send('database.addCollection', params);
|
|
38
|
-
};
|
|
39
|
-
return Db;
|
|
40
|
-
}());
|
|
41
|
-
export { Db };
|
|
1
|
+
import * as Geo from './geo/index';
|
|
2
|
+
import { CollectionReference } from './collection';
|
|
3
|
+
import { Command } from './command';
|
|
4
|
+
import { ServerDateConstructor } from './serverDate/index';
|
|
5
|
+
import { RegExpConstructor } from './regexp/index';
|
|
6
|
+
import { startTransaction, runTransaction } from './transaction/index';
|
|
7
|
+
import { LogicCommand } from './commands/logic';
|
|
8
|
+
import { QueryCommand } from './commands/query';
|
|
9
|
+
import { UpdateCommand } from './commands/update';
|
|
10
|
+
export { Query } from './query';
|
|
11
|
+
export { CollectionReference } from './collection';
|
|
12
|
+
export { DocumentReference } from './document';
|
|
13
|
+
var Db = (function () {
|
|
14
|
+
function Db(config) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.Geo = Geo;
|
|
17
|
+
this.serverDate = ServerDateConstructor;
|
|
18
|
+
this.command = Command;
|
|
19
|
+
this.RegExp = RegExpConstructor;
|
|
20
|
+
this.startTransaction = startTransaction;
|
|
21
|
+
this.runTransaction = runTransaction;
|
|
22
|
+
this.logicCommand = LogicCommand;
|
|
23
|
+
this.updateCommand = UpdateCommand;
|
|
24
|
+
this.queryCommand = QueryCommand;
|
|
25
|
+
}
|
|
26
|
+
Db.prototype.collection = function (collName) {
|
|
27
|
+
if (!collName) {
|
|
28
|
+
throw new Error('Collection name is required');
|
|
29
|
+
}
|
|
30
|
+
return new CollectionReference(this, collName);
|
|
31
|
+
};
|
|
32
|
+
Db.prototype.createCollection = function (collName) {
|
|
33
|
+
var request = new Db.reqClass(this.config);
|
|
34
|
+
var params = {
|
|
35
|
+
collectionName: collName
|
|
36
|
+
};
|
|
37
|
+
return request.send('database.addCollection', params);
|
|
38
|
+
};
|
|
39
|
+
return Db;
|
|
40
|
+
}());
|
|
41
|
+
export { Db };
|
package/dist/esm/lib/util.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createPromiseCallback: () => any;
|
|
1
|
+
export declare const createPromiseCallback: () => any;
|
package/dist/esm/lib/util.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export var createPromiseCallback = function () {
|
|
2
|
-
var cb;
|
|
3
|
-
if (!Promise) {
|
|
4
|
-
cb = function () { };
|
|
5
|
-
cb.promise = {};
|
|
6
|
-
var throwPromiseNotDefined = function () {
|
|
7
|
-
throw new Error('Your Node runtime does support ES6 Promises. ' +
|
|
8
|
-
'Set "global.Promise" to your preferred implementation of promises.');
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(cb.promise, 'then', { get: throwPromiseNotDefined });
|
|
11
|
-
Object.defineProperty(cb.promise, 'catch', { get: throwPromiseNotDefined });
|
|
12
|
-
return cb;
|
|
13
|
-
}
|
|
14
|
-
var promise = new Promise(function (resolve, reject) {
|
|
15
|
-
cb = function (err, data) {
|
|
16
|
-
if (err)
|
|
17
|
-
return reject(err);
|
|
18
|
-
return resolve(data);
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
cb.promise = promise;
|
|
22
|
-
return cb;
|
|
23
|
-
};
|
|
1
|
+
export var createPromiseCallback = function () {
|
|
2
|
+
var cb;
|
|
3
|
+
if (!Promise) {
|
|
4
|
+
cb = function () { };
|
|
5
|
+
cb.promise = {};
|
|
6
|
+
var throwPromiseNotDefined = function () {
|
|
7
|
+
throw new Error('Your Node runtime does support ES6 Promises. ' +
|
|
8
|
+
'Set "global.Promise" to your preferred implementation of promises.');
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(cb.promise, 'then', { get: throwPromiseNotDefined });
|
|
11
|
+
Object.defineProperty(cb.promise, 'catch', { get: throwPromiseNotDefined });
|
|
12
|
+
return cb;
|
|
13
|
+
}
|
|
14
|
+
var promise = new Promise(function (resolve, reject) {
|
|
15
|
+
cb = function (err, data) {
|
|
16
|
+
if (err)
|
|
17
|
+
return reject(err);
|
|
18
|
+
return resolve(data);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
cb.promise = promise;
|
|
22
|
+
return cb;
|
|
23
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const OperatorMap: {
|
|
2
|
-
[key: string]: string;
|
|
3
|
-
};
|
|
4
|
-
export declare function operatorToString(operator: string): string;
|
|
1
|
+
export declare const OperatorMap: {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare function operatorToString(operator: string): string;
|
package/dist/esm/operator-map.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { QUERY_COMMANDS_LITERAL } from './commands/query';
|
|
2
|
-
import { LOGIC_COMMANDS_LITERAL } from './commands/logic';
|
|
3
|
-
import { UPDATE_COMMANDS_LITERAL } from './commands/update';
|
|
4
|
-
export var OperatorMap = {};
|
|
5
|
-
for (var key in QUERY_COMMANDS_LITERAL) {
|
|
6
|
-
OperatorMap[key] = '$' + key;
|
|
7
|
-
}
|
|
8
|
-
for (var key in LOGIC_COMMANDS_LITERAL) {
|
|
9
|
-
OperatorMap[key] = '$' + key;
|
|
10
|
-
}
|
|
11
|
-
for (var key in UPDATE_COMMANDS_LITERAL) {
|
|
12
|
-
OperatorMap[key] = '$' + key;
|
|
13
|
-
}
|
|
14
|
-
OperatorMap[QUERY_COMMANDS_LITERAL.NEQ] = '$ne';
|
|
15
|
-
OperatorMap[UPDATE_COMMANDS_LITERAL.REMOVE] = '$unset';
|
|
16
|
-
OperatorMap[UPDATE_COMMANDS_LITERAL.SHIFT] = '$pop';
|
|
17
|
-
OperatorMap[UPDATE_COMMANDS_LITERAL.UNSHIFT] = '$push';
|
|
18
|
-
export function operatorToString(operator) {
|
|
19
|
-
return OperatorMap[operator] || '$' + operator;
|
|
20
|
-
}
|
|
1
|
+
import { QUERY_COMMANDS_LITERAL } from './commands/query';
|
|
2
|
+
import { LOGIC_COMMANDS_LITERAL } from './commands/logic';
|
|
3
|
+
import { UPDATE_COMMANDS_LITERAL } from './commands/update';
|
|
4
|
+
export var OperatorMap = {};
|
|
5
|
+
for (var key in QUERY_COMMANDS_LITERAL) {
|
|
6
|
+
OperatorMap[key] = '$' + key;
|
|
7
|
+
}
|
|
8
|
+
for (var key in LOGIC_COMMANDS_LITERAL) {
|
|
9
|
+
OperatorMap[key] = '$' + key;
|
|
10
|
+
}
|
|
11
|
+
for (var key in UPDATE_COMMANDS_LITERAL) {
|
|
12
|
+
OperatorMap[key] = '$' + key;
|
|
13
|
+
}
|
|
14
|
+
OperatorMap[QUERY_COMMANDS_LITERAL.NEQ] = '$ne';
|
|
15
|
+
OperatorMap[UPDATE_COMMANDS_LITERAL.REMOVE] = '$unset';
|
|
16
|
+
OperatorMap[UPDATE_COMMANDS_LITERAL.SHIFT] = '$pop';
|
|
17
|
+
OperatorMap[UPDATE_COMMANDS_LITERAL.UNSHIFT] = '$push';
|
|
18
|
+
export function operatorToString(operator) {
|
|
19
|
+
return OperatorMap[operator] || '$' + operator;
|
|
20
|
+
}
|
package/dist/esm/query.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { OrderByDirection } from './constant';
|
|
2
|
-
import { IWatchOptions, DBRealtimeListener } from './typings/index';
|
|
3
|
-
interface GetRes {
|
|
4
|
-
data: any[];
|
|
5
|
-
requestId: string;
|
|
6
|
-
total: number;
|
|
7
|
-
limit: number;
|
|
8
|
-
offset: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class Query {
|
|
11
|
-
get(callback?: any): Promise<GetRes>;
|
|
12
|
-
count(callback?: any): any;
|
|
13
|
-
where(query: object): Query;
|
|
14
|
-
orderBy(fieldPath: string, directionStr: OrderByDirection): Query;
|
|
15
|
-
limit(limit: number): Query;
|
|
16
|
-
skip(offset: number): Query;
|
|
17
|
-
update(data: Object, callback?: any): Promise<any>;
|
|
18
|
-
field(projection: any): Query;
|
|
19
|
-
remove(callback?: any): any;
|
|
20
|
-
watch: (options: IWatchOptions) => DBRealtimeListener;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
1
|
+
import { OrderByDirection } from './constant';
|
|
2
|
+
import { IWatchOptions, DBRealtimeListener } from './typings/index';
|
|
3
|
+
interface GetRes {
|
|
4
|
+
data: any[];
|
|
5
|
+
requestId: string;
|
|
6
|
+
total: number;
|
|
7
|
+
limit: number;
|
|
8
|
+
offset: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class Query {
|
|
11
|
+
get(callback?: any): Promise<GetRes>;
|
|
12
|
+
count(callback?: any): any;
|
|
13
|
+
where(query: object): Query;
|
|
14
|
+
orderBy(fieldPath: string, directionStr: OrderByDirection): Query;
|
|
15
|
+
limit(limit: number): Query;
|
|
16
|
+
skip(offset: number): Query;
|
|
17
|
+
update(data: Object, callback?: any): Promise<any>;
|
|
18
|
+
field(projection: any): Query;
|
|
19
|
+
remove(callback?: any): any;
|
|
20
|
+
watch: (options: IWatchOptions) => DBRealtimeListener;
|
|
21
|
+
}
|
|
22
|
+
export {};
|