@rpcbase/server 0.369.0 → 0.371.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.
@@ -1,6 +1,7 @@
1
- import mongoose, { Schema } from "../"
1
+ import mongoose, {Schema} from "../"
2
+
3
+ import {get_object_id} from "../../get_object_id"
2
4
 
3
- import { get_object_id } from "../../get_object_id"
4
5
 
5
6
  export const object_id_plugin = (schema: Schema) => {
6
7
  if (schema.options._id === false) {
@@ -16,11 +17,12 @@ export const object_id_plugin = (schema: Schema) => {
16
17
  _id: {
17
18
  type: mongoose.Schema.Types.ObjectId,
18
19
  default: () => get_object_id(),
20
+ immutable: true,
19
21
  },
20
22
  })
21
23
 
22
24
  // Optional: Ensure the _id field is always set
23
- schema.pre("save", function (next) {
25
+ schema.pre("save", function(next) {
24
26
  if (!this._id) {
25
27
  this._id = get_object_id()
26
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.369.0",
3
+ "version": "0.371.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -61,24 +61,24 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@elastic/elasticsearch": "8.15.0",
64
- "@sentry/node": "8.24.0",
64
+ "@sentry/node": "8.28.0",
65
65
  "bluebird": "3.7.2",
66
66
  "body-parser": "1.20.2",
67
- "bull": "4.16.0",
67
+ "bull": "4.16.2",
68
68
  "connect-redis": "7.1.1",
69
69
  "cors": "2.8.5",
70
70
  "debug": "4.3.6",
71
71
  "dotenv": "16.4.5",
72
72
  "express": "4.19.2",
73
73
  "express-session": "1.18.0",
74
- "firebase-admin": "12.3.0",
74
+ "firebase-admin": "12.4.0",
75
75
  "lodash": "4.17.21",
76
76
  "mkdirp": "3.0.1",
77
- "mongoose": "8.5.2",
78
- "openai": "4.56.0",
77
+ "mongoose": "8.6.1",
78
+ "openai": "4.57.3",
79
79
  "pdf2pic": "3.1.1",
80
- "picocolors": "1.0.1",
81
- "postmark": "4.0.4",
80
+ "picocolors": "1.1.0",
81
+ "postmark": "4.0.5",
82
82
  "redis": "4.7.0",
83
83
  "request-ip": "3.3.0",
84
84
  "sift": "17.1.3",
@@ -7,6 +7,7 @@ const check_apply_permissions = require("./check_apply_permissions")
7
7
  // hooks
8
8
  const query_pre_delete = require("./hooks/query_pre_delete")
9
9
 
10
+
10
11
  const log = debug("rb")
11
12
 
12
13
 
@@ -59,7 +60,8 @@ const mongoose_plugin = (ac_config) => function rb_acl_plugin(schema, options) {
59
60
  // which can be a critical security risk
60
61
  schema.options.strictQuery = false
61
62
 
62
- if (!schema.options.isSubSchema) {
63
+ // TODO: acl should be explicitly on by default and only if set to false in schema definition we remove it
64
+ if (!schema.options.isSubSchema && schema.options.acl !== false) {
63
65
  // Add Access Control fields to top level schemas
64
66
  schema.add(get_added_fields())
65
67
  }
@@ -73,7 +75,7 @@ const mongoose_plugin = (ac_config) => function rb_acl_plugin(schema, options) {
73
75
  schema.pre("findOneAndDelete", QUERY, query_pre_delete(ac_config, schema))
74
76
 
75
77
  // Documents create and save
76
- schema.pre("save", DOC, function(next, options) {
78
+ schema.pre("save", DOC, function(next, save_options) {
77
79
  if (this.$isSubdocument) {
78
80
  return next()
79
81
  }
@@ -83,7 +85,7 @@ const mongoose_plugin = (ac_config) => function rb_acl_plugin(schema, options) {
83
85
  throw new Error("doc pre save model_name is undefined")
84
86
  }
85
87
 
86
- const {ctx} = options
88
+ const {ctx} = save_options
87
89
 
88
90
  // when no context, assume admin mode and authorize op
89
91
  if (!ctx) {
@@ -3,6 +3,6 @@ const get_stored_values = require("./get_stored_values")
3
3
  const set_stored_values = require("./set_stored_values")
4
4
 
5
5
  module.exports = (app) => {
6
- app.handler("/api/v1/stored-values/get", get_stored_values)
7
- app.handler("/api/v1/stored-values/set", set_stored_values)
6
+ app.handler("/rb-api/v1/stored-values/get", get_stored_values)
7
+ app.handler("/rb-api/v1/stored-values/set", set_stored_values)
8
8
  }
package/src/auth/index.js CHANGED
@@ -11,14 +11,14 @@ const get_account = require("./get_account")
11
11
 
12
12
 
13
13
  module.exports = (app) => {
14
- app.handler("/api/v1/auth/sign_in", sign_in)
15
- app.handler("/api/v1/auth/sign_out", sign_out)
14
+ app.handler("/rb-api/v1/auth/sign_in", sign_in)
15
+ app.handler("/rb-api/v1/auth/sign_out", sign_out)
16
16
 
17
- app.handler("/api/v1/auth/reset_password", reset_password)
18
- app.handler("/api/v1/auth/set_new_password", set_new_password)
17
+ app.handler("/rb-api/v1/auth/reset_password", reset_password)
18
+ app.handler("/rb-api/v1/auth/set_new_password", set_new_password)
19
19
 
20
- app.handler("/api/v1/auth/check_session", check_session)
20
+ app.handler("/rb-api/v1/auth/check_session", check_session)
21
21
 
22
- app.handler("/api/v1/auth/get_account", get_account)
23
- app.handler("/api/v1/auth/get_accounts", get_accounts)
22
+ app.handler("/rb-api/v1/auth/get_account", get_account)
23
+ app.handler("/rb-api/v1/auth/get_accounts", get_accounts)
24
24
  }