@livequery/mongoose 2.0.47 → 2.0.48

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.
@@ -1,10 +1,11 @@
1
1
  import { RouteOptions } from "./RouteOptions.js";
2
- import { LivequeryRequest, LivequeryBaseEntity } from '@livequery/types';
2
+ import { LivequeryRequest, LivequeryBaseEntity, WebsocketSyncPayload } from '@livequery/types';
3
3
  import mongoose, { Connection } from 'mongoose';
4
+ import { Subject } from 'rxjs/internal/Subject';
4
5
  export type LivequeryDatasource<T> = {
5
6
  query(query: LivequeryRequest, options: T, connection: any): any;
6
7
  };
7
- export declare class MongooseDatasource implements LivequeryDatasource<RouteOptions> {
8
+ export declare class MongooseDatasource extends Subject<WebsocketSyncPayload<any>> implements LivequeryDatasource<RouteOptions> {
8
9
  #private;
9
10
  query(_: LivequeryRequest, config: RouteOptions, connection: Connection): Promise<mongoose.mongo.DeleteResult | mongoose.UpdateWriteOpResult | {
10
11
  items: any[];
@@ -41,4 +42,5 @@ export declare class MongooseDatasource implements LivequeryDatasource<RouteOpti
41
42
  options: import("@livequery/types").QueryOption<LivequeryBaseEntity>;
42
43
  method?: string;
43
44
  }>;
45
+ broadcast(): Promise<void>;
44
46
  }
@@ -3,7 +3,8 @@ import { MongoQuery } from "./MongoQuery.js";
3
3
  import mongoose from 'mongoose';
4
4
  import { ObjectId } from 'bson';
5
5
  import { SmartCache } from './SmartCache.js';
6
- export class MongooseDatasource {
6
+ import { Subject } from 'rxjs/internal/Subject';
7
+ export class MongooseDatasource extends Subject {
7
8
  #schemas = new SmartCache();
8
9
  #models = new SmartCache();
9
10
  async query(_, config, connection) {
@@ -156,4 +157,6 @@ export class MongooseDatasource {
156
157
  body: this.#convert(req.body, fields)
157
158
  };
158
159
  }
160
+ async broadcast() {
161
+ }
159
162
  }
@@ -4,5 +4,4 @@ export type RouteOptions<T = any> = {
4
4
  realtime?: boolean;
5
5
  schema: Schema<T>;
6
6
  db?: string | ((req: LivequeryRequest) => Promise<string> | string);
7
- object_ids_fields: string[];
8
7
  };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "repository": {
7
7
  "url": "git@github.com:livequery/mongoose.git"
8
8
  },
9
- "version": "2.0.47",
9
+ "version": "2.0.48",
10
10
  "description": "Mongoose datasource mapping for @livequery ecosystem",
11
11
  "main": "./build/src/index.js",
12
12
  "types": "./build/src/index.d.ts",