@dnax/core 0.64.9 → 0.65.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.
@@ -9,6 +9,7 @@ import {
9
9
  ClientSession,
10
10
  MongoClient,
11
11
  ObjectId,
12
+ type ChangeStreamOptions,
12
13
  type FilterOperations,
13
14
  } from "mongodb";
14
15
  import { contextError, fn, toJson, dotJson, getEntryBykeys } from "../../utils";
@@ -1062,7 +1063,10 @@ class useRest {
1062
1063
  collection: string,
1063
1064
  id: string,
1064
1065
  update: updateParams,
1065
- options?: Omit<optionCb, "withMeta" | "elementAt" | "withMeta">
1066
+ options?: Omit<optionCb, "withMeta" | "elementAt" | "withMeta"> & {
1067
+ arrayFilters?: Array<object>;
1068
+ upsert?: boolean;
1069
+ }
1066
1070
  ): Promise<object> {
1067
1071
  return new Promise(async (resolve, reject) => {
1068
1072
  try {
@@ -1185,6 +1189,8 @@ class useRest {
1185
1189
  },
1186
1190
  },
1187
1191
  {
1192
+ upsert: options?.upsert ?? false,
1193
+ arrayFilters: options?.arrayFilters,
1188
1194
  returnDocument: "after",
1189
1195
  session: this.#session ? this.#session : undefined,
1190
1196
  }
@@ -2060,10 +2066,15 @@ class useRest {
2060
2066
  return await this.#tenant.database.db?.stats().then((e) => e);
2061
2067
  }
2062
2068
 
2063
- watch(collection: string, pipeline: Array<any>): ChangeStream {
2064
- return this.#tenant.database.db
2065
- ?.collection(collection)
2066
- .watch(pipeline) as ChangeStream;
2069
+ watch(
2070
+ collection: string,
2071
+ pipeline: Array<any>,
2072
+ options: ChangeStreamOptions
2073
+ ): ChangeStream {
2074
+ return this.#tenant.database.db?.collection(collection).watch(pipeline, {
2075
+ allowDiskUse: true,
2076
+ ...options,
2077
+ }) as ChangeStream;
2067
2078
  }
2068
2079
  }
2069
2080
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.64.9",
3
+ "version": "0.65.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
package/types/index.ts CHANGED
@@ -278,6 +278,9 @@ export type ctxApi = {
278
278
  update?: updateParams;
279
279
  };
280
280
 
281
+
282
+
283
+
281
284
  export type Collection = {
282
285
  init?: (ctx: {
283
286
  rest: InstanceType<typeof useRest>;