liwi-mongo 12.0.0 → 13.1.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.
- package/README.md +7 -7
- package/dist/definitions/MongoBaseModel.d.ts +2 -2
- package/dist/definitions/MongoBaseModel.d.ts.map +1 -1
- package/dist/definitions/MongoConnection.d.ts +10 -3
- package/dist/definitions/MongoConnection.d.ts.map +1 -1
- package/dist/definitions/MongoCursor.d.ts +6 -6
- package/dist/definitions/MongoQueryCollection.d.ts +5 -5
- package/dist/definitions/MongoQueryCollection.d.ts.map +1 -1
- package/dist/definitions/MongoQueryCollection.test.d.ts +2 -0
- package/dist/definitions/MongoQueryCollection.test.d.ts.map +1 -0
- package/dist/definitions/MongoQuerySingleItem.d.ts +5 -5
- package/dist/definitions/MongoQuerySingleItem.d.ts.map +1 -1
- package/dist/definitions/MongoStore.d.ts +12 -12
- package/dist/definitions/MongoStore.d.ts.map +1 -1
- package/dist/definitions/createMongoSubscribeStore.d.ts +6 -5
- package/dist/definitions/createMongoSubscribeStore.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +5 -5
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/index-node.mjs +555 -0
- package/dist/index-node.mjs.map +1 -0
- package/package.json +43 -38
- package/src/MongoBaseModel.ts +5 -4
- package/src/MongoConnection.ts +47 -43
- package/src/MongoCursor.ts +7 -7
- package/src/MongoQueryCollection.test.ts +108 -0
- package/src/MongoQueryCollection.ts +26 -25
- package/src/MongoQuerySingleItem.ts +27 -26
- package/src/MongoStore.ts +52 -43
- package/src/createMongoSubscribeStore.ts +7 -5
- package/src/index.ts +11 -5
- package/CHANGELOG.md +0 -628
- package/dist/index-node18.mjs +0 -588
- package/dist/index-node18.mjs.map +0 -1
- package/src/.eslintrc.json +0 -38
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<
|
|
1
|
+
<h1 align="center">
|
|
2
2
|
liwi-mongo
|
|
3
|
-
</
|
|
3
|
+
</h1>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
mongo implementation for liwi
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/v/liwi-mongo.svg?style=flat-square"></a>
|
|
11
|
-
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/dw/liwi-mongo.svg?style=flat-square"></a>
|
|
12
|
-
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/node/v/liwi-mongo.svg?style=flat-square"></a>
|
|
13
|
-
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/types/liwi-mongo.svg?style=flat-square"></a>
|
|
10
|
+
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/v/liwi-mongo.svg?style=flat-square" alt="npm version"></a>
|
|
11
|
+
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/dw/liwi-mongo.svg?style=flat-square" alt="npm downloads"></a>
|
|
12
|
+
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/node/v/liwi-mongo.svg?style=flat-square" alt="node version"></a>
|
|
13
|
+
<a href="https://npmjs.org/package/liwi-mongo"><img src="https://img.shields.io/npm/types/liwi-mongo.svg?style=flat-square" alt="types"></a>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
## Install
|
|
@@ -22,7 +22,7 @@ npm install --save liwi-mongo
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
24
|
```js
|
|
25
|
-
import liwiMongo from
|
|
25
|
+
import liwiMongo from "liwi-mongo";
|
|
26
26
|
|
|
27
27
|
console.log(liwiMongo);
|
|
28
28
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type MongoKeyPath =
|
|
1
|
+
import type { AllowedKeyValue, BaseModel, InsertType } from "liwi-store";
|
|
2
|
+
export type MongoKeyPath = "_id";
|
|
3
3
|
export interface MongoBaseModel<KeyValue extends AllowedKeyValue = string> extends BaseModel {
|
|
4
4
|
_id: KeyValue;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoBaseModel.d.ts","sourceRoot":"","sources":["../../src/MongoBaseModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"MongoBaseModel.d.ts","sourceRoot":"","sources":["../../src/MongoBaseModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEzE,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC;AAEjC,MAAM,WAAW,cAAc,CAC7B,QAAQ,SAAS,eAAe,GAAG,MAAM,CACzC,SAAQ,SAAS;IACjB,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,IACpD,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { AbstractConnection } from
|
|
2
|
-
import mongodb from
|
|
1
|
+
import { AbstractConnection } from "liwi-store";
|
|
2
|
+
import mongodb from "mongodb";
|
|
3
|
+
export interface MongoConfig {
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: number | string;
|
|
6
|
+
database: string;
|
|
7
|
+
user?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
}
|
|
3
10
|
export default class MongoConnection extends AbstractConnection {
|
|
4
11
|
_connection?: mongodb.MongoClient;
|
|
5
12
|
_connecting?: Promise<mongodb.MongoClient>;
|
|
6
13
|
connectionFailed?: boolean;
|
|
7
|
-
constructor(
|
|
14
|
+
constructor({ host, port, database, user, password, }: MongoConfig);
|
|
8
15
|
connect(connectionString: string, connectionStringRedacted: string): void;
|
|
9
16
|
getConnection(): Promise<mongodb.MongoClient>;
|
|
10
17
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoConnection.d.ts","sourceRoot":"","sources":["../../src/MongoConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,OAAO,MAAM,SAAS,CAAC;AAK9B,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,kBAAkB;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAElC,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;gBAGf,
|
|
1
|
+
{"version":3,"file":"MongoConnection.d.ts","sourceRoot":"","sources":["../../src/MongoConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,OAAO,MAAM,SAAS,CAAC;AAK9B,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,kBAAkB;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAElC,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;gBAGf,EACV,IAAkB,EAClB,IAAc,EACd,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,EAAE,WAAW;IA4Bd,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,GAAG,IAAI;IAkDzE,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IAIvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAU7B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AbstractStoreCursor } from
|
|
2
|
-
import type { AllowedKeyValue } from
|
|
3
|
-
import type { FindCursor } from
|
|
4
|
-
import type { MongoBaseModel } from
|
|
5
|
-
import type MongoStore from
|
|
6
|
-
export default class MongoCursor<Model extends MongoBaseModel<KeyValue>, Result extends Partial<Model> = Model, KeyValue extends AllowedKeyValue = Model[
|
|
1
|
+
import { AbstractStoreCursor } from "liwi-store";
|
|
2
|
+
import type { AllowedKeyValue } from "liwi-store";
|
|
3
|
+
import type { FindCursor } from "mongodb";
|
|
4
|
+
import type { MongoBaseModel } from "./MongoBaseModel";
|
|
5
|
+
import type MongoStore from "./MongoStore";
|
|
6
|
+
export default class MongoCursor<Model extends MongoBaseModel<KeyValue>, Result extends Partial<Model> = Model, KeyValue extends AllowedKeyValue = Model["_id"]> extends AbstractStoreCursor<MongoStore<Model, KeyValue>, KeyValue, Model, Result> {
|
|
7
7
|
private readonly cursor;
|
|
8
8
|
private _result?;
|
|
9
9
|
constructor(store: MongoStore<Model, KeyValue>, cursor: FindCursor<Result>);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { AbstractSubscribableStoreQuery } from
|
|
3
|
-
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from
|
|
4
|
-
import type MongoStore from
|
|
1
|
+
import type { AllowedKeyValue, QueryOptions, QueryParams, QueryResult, QuerySubscription, SubscribeCallback, Transformer } from "liwi-store";
|
|
2
|
+
import { AbstractSubscribableStoreQuery } from "liwi-subscribe-store";
|
|
3
|
+
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from "./MongoBaseModel";
|
|
4
|
+
import type MongoStore from "./MongoStore";
|
|
5
5
|
type TestCriteria = (obj: any) => boolean;
|
|
6
|
-
export default class MongoQueryCollection<Model extends MongoBaseModel<KeyValue>, Params extends QueryParams<Params> = never, KeyValue extends AllowedKeyValue = Model[
|
|
6
|
+
export default class MongoQueryCollection<Model extends MongoBaseModel<KeyValue>, Params extends QueryParams<Params> = never, KeyValue extends AllowedKeyValue = Model["_id"], Item extends Record<MongoKeyPath, KeyValue> = Model> extends AbstractSubscribableStoreQuery<MongoKeyPath, KeyValue, Model, MongoInsertType<Model, KeyValue>, Params, Item[]> {
|
|
7
7
|
private readonly store;
|
|
8
8
|
private readonly options;
|
|
9
9
|
private testCriteria?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoQueryCollection.d.ts","sourceRoot":"","sources":["../../src/MongoQueryCollection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"MongoQueryCollection.d.ts","sourceRoot":"","sources":["../../src/MongoQueryCollection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EACZ,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAS3C,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,oBAAoB,CACvC,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,MAAM,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,EAC1C,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC,EAC/C,IAAI,SAAS,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,KAAK,CACnD,SAAQ,8BAA8B,CACtC,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,EAChC,MAAM,EACN,IAAI,EAAE,CACP;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IAEpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2B;gBAGrD,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,EAClC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC5B,WAAW,GAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CAAuB;IAQ7D,kBAAkB,IAAI,YAAY;IAiB5B,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiB3E,UAAU,CACR,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,EAC7C,eAAe,EAAE,OAAO,GACvB,iBAAiB;YAiHN,iBAAiB;CAmBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoQueryCollection.test.d.ts","sourceRoot":"","sources":["../../src/MongoQueryCollection.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { AbstractSubscribableStoreQuery } from
|
|
3
|
-
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from
|
|
4
|
-
import type MongoStore from
|
|
1
|
+
import type { AllowedKeyValue, QueryOptions, QueryParams, QueryResult, QuerySubscription, SubscribeCallback, Transformer } from "liwi-store";
|
|
2
|
+
import { AbstractSubscribableStoreQuery } from "liwi-subscribe-store";
|
|
3
|
+
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from "./MongoBaseModel";
|
|
4
|
+
import type MongoStore from "./MongoStore";
|
|
5
5
|
type TestCriteria = (obj: any) => boolean;
|
|
6
|
-
export default class MongoQuerySingleItem<Model extends MongoBaseModel<KeyValue>, Params extends QueryParams<Params> = never, Result extends Record<MongoKeyPath, KeyValue> | null = Model | null, KeyValue extends AllowedKeyValue = Model[
|
|
6
|
+
export default class MongoQuerySingleItem<Model extends MongoBaseModel<KeyValue>, Params extends QueryParams<Params> = never, Result extends Record<MongoKeyPath, KeyValue> | null = Model | null, KeyValue extends AllowedKeyValue = Model["_id"]> extends AbstractSubscribableStoreQuery<MongoKeyPath, KeyValue, Model, MongoInsertType<Model, KeyValue>, Params, Result> {
|
|
7
7
|
private readonly store;
|
|
8
8
|
private readonly options;
|
|
9
9
|
private testCriteria?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoQuerySingleItem.d.ts","sourceRoot":"","sources":["../../src/MongoQuerySingleItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"MongoQuerySingleItem.d.ts","sourceRoot":"","sources":["../../src/MongoQuerySingleItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EACZ,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAS3C,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,oBAAoB,CACvC,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,MAAM,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,EAC1C,MAAM,SAAS,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,EACnE,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC,CAC/C,SAAQ,8BAA8B,CACtC,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,EAChC,MAAM,EACN,MAAM,CACP;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IAEpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;gBAGvD,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,EAClC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC5B,WAAW,GAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAuB;IAQ/D,uBAAuB,IAAI,YAAY;IAajC,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiB3E,UAAU,CACR,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC7C,eAAe,EAAE,OAAO,GACvB,iBAAiB;YAqFN,iBAAiB;CAehC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Collection } from
|
|
3
|
-
import type { MongoBaseModel,
|
|
4
|
-
import type MongoConnection from
|
|
5
|
-
import MongoCursor from
|
|
6
|
-
import MongoQueryCollection from
|
|
7
|
-
import MongoQuerySingleItem from
|
|
1
|
+
import type { AllowedKeyValue, CreateQueryOptions, Criteria, Fields, OptionalBaseModelKeysForInsert, QueryParams, Sort, SubscribableStore, Update, UpsertPartialObject, UpsertResult } from "liwi-store";
|
|
2
|
+
import type { Collection } from "mongodb";
|
|
3
|
+
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from "./MongoBaseModel.ts";
|
|
4
|
+
import type MongoConnection from "./MongoConnection.ts";
|
|
5
|
+
import MongoCursor from "./MongoCursor.ts";
|
|
6
|
+
import MongoQueryCollection from "./MongoQueryCollection.ts";
|
|
7
|
+
import MongoQuerySingleItem from "./MongoQuerySingleItem.ts";
|
|
8
8
|
export interface MongoUpsertResult<KeyValue extends AllowedKeyValue, Model extends MongoBaseModel<KeyValue>> extends UpsertResult<Model> {
|
|
9
9
|
object: Model;
|
|
10
10
|
inserted: boolean;
|
|
@@ -15,12 +15,12 @@ export default class MongoStore<Model extends MongoBaseModel<KeyValue>, KeyValue
|
|
|
15
15
|
private _collection;
|
|
16
16
|
constructor(connection: MongoConnection, collectionName: string);
|
|
17
17
|
get collection(): Promise<Collection<Model>>;
|
|
18
|
-
createQuerySingleItem<Result extends Record<MongoKeyPath, KeyValue> = Model, Params extends QueryParams<Params> = never>(options:
|
|
19
|
-
createQueryCollection<Item extends Record<MongoKeyPath, KeyValue> = Model, Params extends QueryParams<Params> = never>(options:
|
|
18
|
+
createQuerySingleItem<Result extends Record<MongoKeyPath, KeyValue> = Model, Params extends QueryParams<Params> = never>({ transformer, ...options }: CreateQueryOptions<Model, Result>): MongoQuerySingleItem<Model, Params, Result, KeyValue>;
|
|
19
|
+
createQueryCollection<Item extends Record<MongoKeyPath, KeyValue> = Model, Params extends QueryParams<Params> = never>({ transformer, ...options }: CreateQueryOptions<Model, Item>): MongoQueryCollection<Model, Params, Model["_id"], Item>;
|
|
20
20
|
insertOne(object: MongoInsertType<Model>): Promise<Model>;
|
|
21
21
|
replaceOne(object: Model): Promise<Model>;
|
|
22
|
-
upsertOne<K extends Exclude<keyof Model, MongoKeyPath | OptionalBaseModelKeysForInsert>>(object: UpsertPartialObject<MongoKeyPath, KeyValue, Model, K>, setOnInsertPartialObject?: Update<Model>[
|
|
23
|
-
upsertOneWithInfo<K extends Exclude<keyof Model, MongoKeyPath | OptionalBaseModelKeysForInsert>>(object: UpsertPartialObject<MongoKeyPath, KeyValue, Model, K>, setOnInsertPartialObject?: Update<Model>[
|
|
22
|
+
upsertOne<K extends Exclude<keyof Model, MongoKeyPath | OptionalBaseModelKeysForInsert>>(object: UpsertPartialObject<MongoKeyPath, KeyValue, Model, K>, setOnInsertPartialObject?: Update<Model>["$setOnInsert"]): Promise<Model>;
|
|
23
|
+
upsertOneWithInfo<K extends Exclude<keyof Model, MongoKeyPath | OptionalBaseModelKeysForInsert>>(object: UpsertPartialObject<MongoKeyPath, KeyValue, Model, K>, setOnInsertPartialObject?: Update<Model>["$setOnInsert"]): Promise<MongoUpsertResult<KeyValue, Model>>;
|
|
24
24
|
replaceSeveral(objects: Model[]): Promise<Model[]>;
|
|
25
25
|
partialUpdateByKey(key: KeyValue, partialUpdate: Update<Model>, criteria?: Criteria<Model>): Promise<Model>;
|
|
26
26
|
partialUpdateOne(object: Model, partialUpdate: Update<Model>): Promise<Model>;
|
|
@@ -29,7 +29,7 @@ export default class MongoStore<Model extends MongoBaseModel<KeyValue>, KeyValue
|
|
|
29
29
|
deleteOne(object: Model): Promise<void>;
|
|
30
30
|
deleteMany(selector: Criteria<Model>): Promise<void>;
|
|
31
31
|
count(filter?: Criteria<Model>): Promise<number>;
|
|
32
|
-
cursor<Result extends Partial<Model> = Model>(filter?: Criteria<Model>, sort?: Sort<Model>): Promise<MongoCursor<Model, Result, KeyValue>>;
|
|
32
|
+
cursor<Result extends Partial<Model> = Model>(filter?: Criteria<Model>, sort?: Sort<Model>, fields?: Fields<Model>): Promise<MongoCursor<Model, Result, KeyValue>>;
|
|
33
33
|
findByKey(key: KeyValue, criteria?: Criteria<Model>): Promise<Model | undefined>;
|
|
34
34
|
findAll(criteria?: Criteria<Model>, sort?: Sort<Model>): Promise<Model[]>;
|
|
35
35
|
findOne(filter: Criteria<Model>, sort?: Sort<Model>): Promise<Model | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoStore.d.ts","sourceRoot":"","sources":["../../src/MongoStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MongoStore.d.ts","sourceRoot":"","sources":["../../src/MongoStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,MAAM,EACN,8BAA8B,EAC9B,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,MAAM,EACN,mBAAmB,EACnB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,iBAAiB,CAChC,QAAQ,SAAS,eAAe,EAChC,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,CACtC,SAAQ,YAAY,CAAC,KAAK,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,UAAU,CAC7B,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,CACtD,YAAW,iBAAiB,CAC5B,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,CAAC,KAAK,CAAC,EACtB,eAAe,CAChB;IACC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAS;IAEvC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IAErC,OAAO,CAAC,WAAW,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MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAU1C,SAAS,CACb,GAAG,EAAE,QAAQ,EACb,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,GACzB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAS7B,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAMnE,OAAO,CACX,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,EACvB,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GACjB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAO9B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { AllowedKeyValue } from
|
|
2
|
-
import { SubscribeStore } from
|
|
3
|
-
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from
|
|
4
|
-
import type MongoConnection from
|
|
5
|
-
import type MongoStore from
|
|
1
|
+
import type { AllowedKeyValue } from "liwi-store";
|
|
2
|
+
import { SubscribeStore } from "liwi-subscribe-store";
|
|
3
|
+
import type { MongoBaseModel, MongoInsertType, MongoKeyPath } from "./MongoBaseModel";
|
|
4
|
+
import type MongoConnection from "./MongoConnection";
|
|
5
|
+
import type MongoStore from "./MongoStore";
|
|
6
6
|
export default function createMongoSubscribeStore<Model extends MongoBaseModel<KeyValue>, KeyValue extends AllowedKeyValue = Model[MongoKeyPath]>(mongoStore: MongoStore<Model, KeyValue>): SubscribeStore<MongoKeyPath, KeyValue, Model, MongoInsertType<Model, KeyValue>, MongoConnection, MongoStore<Model, KeyValue>>;
|
|
7
|
+
export { type SubscribeStore } from "liwi-subscribe-store";
|
|
7
8
|
//# sourceMappingURL=createMongoSubscribeStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMongoSubscribeStore.d.ts","sourceRoot":"","sources":["../../src/createMongoSubscribeStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,EAEtD,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,GACtC,cAAc,CACf,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,EAChC,eAAe,EACf,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAC5B,CAEA"}
|
|
1
|
+
{"version":3,"file":"createMongoSubscribeStore.d.ts","sourceRoot":"","sources":["../../src/createMongoSubscribeStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,SAAS,cAAc,CAAC,QAAQ,CAAC,EACtC,QAAQ,SAAS,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,EAEtD,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,GACtC,cAAc,CACf,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,EAChC,eAAe,EACf,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAC5B,CAEA;AAED,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { MongoBaseModel, MongoKeyPath, MongoInsertType, } from
|
|
2
|
-
export type { Update } from
|
|
3
|
-
export { default as MongoStore } from
|
|
4
|
-
export { default as MongoConnection } from
|
|
5
|
-
export { default as createMongoSubscribeStore } from
|
|
1
|
+
export type { MongoBaseModel, MongoKeyPath, MongoInsertType, } from "./MongoBaseModel";
|
|
2
|
+
export type { Update } from "liwi-store";
|
|
3
|
+
export { default as MongoStore } from "./MongoStore.ts";
|
|
4
|
+
export { default as MongoConnection, type MongoConfig, } from "./MongoConnection.ts";
|
|
5
|
+
export { default as createMongoSubscribeStore, type SubscribeStore, } from "./createMongoSubscribeStore.ts";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,OAAO,IAAI,yBAAyB,EACpC,KAAK,cAAc,GACpB,MAAM,gCAAgC,CAAC"}
|