@rpcbase/server 0.354.0 → 0.355.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/boot/shared.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
  if (typeof __RB_IS_WEBPACK__ === "undefined") {
3
- throw new Error("cannot run outside of webpack bundling")
3
+ throw new Error("cannot run without webpack bundling")
4
4
  }
5
5
 
6
6
  require("source-map-support").install()
@@ -0,0 +1,12 @@
1
+ export * from "mongoose"
2
+
3
+ import mongoose from "mongoose"
4
+ import {object_id_plugin} from "./object_id_plugin"
5
+
6
+
7
+ mongoose.set("strictQuery", false)
8
+
9
+ mongoose.plugin(object_id_plugin)
10
+
11
+
12
+ export default mongoose
@@ -0,0 +1,14 @@
1
+ import mongoose, { Schema } from "mongoose"
2
+
3
+ import get_object_id from "../get_object_id"
4
+
5
+ export const object_id_plugin = (schema: Schema) => {
6
+ if (!schema.path("_id")) {
7
+ schema.add({
8
+ _id: {
9
+ type: mongoose.Types.ObjectId,
10
+ default: () => new mongoose.Types.ObjectId(get_object_id()),
11
+ },
12
+ })
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.354.0",
3
+ "version": "0.355.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -64,7 +64,7 @@ const assert_doc_id = (change) => {
64
64
  expect(sub).toBe(RB_TENANT_ID)
65
65
  } catch (err) {
66
66
  console.log("in document:", change.ns, change.documentKey)
67
- console.log("_id must be constructed with get_object_id()")
67
+ console.log("_id must be instanciated with get_object_id()")
68
68
  console.log(err.message)
69
69
  }
70
70
  }
package/mongoose.js DELETED
@@ -1,9 +0,0 @@
1
- /* @flow */
2
- const mongoose = require("mongoose")
3
-
4
- // WARNING: this shouldn't be necessary as strictQuery is back to false by default
5
- // https://mongoosejs.com/docs/migrating_to_7.html#strictquery
6
- mongoose.set("strictQuery", false)
7
-
8
-
9
- module.exports = mongoose