@dnax/core 0.63.0 → 0.63.2

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.
@@ -1258,7 +1258,9 @@ class useRest {
1258
1258
  filter: object,
1259
1259
  update: updateParams,
1260
1260
  options?: Omit<
1261
- optionCb,
1261
+ optionCb & {
1262
+ upsert: boolean;
1263
+ },
1262
1264
  "useHook" | "useCustomApi" | "elementAt" | "withMeta"
1263
1265
  >
1264
1266
  ): Promise<{ docs: object[]; matchedCount: number; modifiedCount: number }> {
@@ -1303,8 +1305,12 @@ class useRest {
1303
1305
  $currentDate: {
1304
1306
  updatedAt: true,
1305
1307
  },
1308
+ $setOnInsert: {
1309
+ createdAt: new Date(),
1310
+ },
1306
1311
  },
1307
1312
  {
1313
+ upsert: options?.upsert ?? false,
1308
1314
  session: this.#session ? this.#session : undefined,
1309
1315
  }
1310
1316
  );
@@ -1361,7 +1367,9 @@ class useRest {
1361
1367
  filter: object,
1362
1368
  update: updateParams,
1363
1369
  options?: Omit<
1364
- optionCb,
1370
+ optionCb & {
1371
+ upsert: boolean;
1372
+ },
1365
1373
  "useHook" | "useCustomApi" | "elementAt" | "withMeta"
1366
1374
  >
1367
1375
  ): Promise<object | null> {
@@ -1405,14 +1413,16 @@ class useRest {
1405
1413
  collection: collection,
1406
1414
  tenant_id: this.#tenant_id,
1407
1415
  }),
1416
+ $setOnInsert: {
1417
+ createdAt: new Date(),
1418
+ },
1408
1419
  $currentDate: {
1409
1420
  updatedAt: true,
1410
1421
  },
1411
1422
  },
1412
1423
  {
1413
- upsert: true,
1424
+ upsert: options?.upsert ?? false,
1414
1425
  returnDocument: "after",
1415
-
1416
1426
  session: this.#session ? this.#session : undefined,
1417
1427
  }
1418
1428
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.63.0",
3
+ "version": "0.63.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {