@rpcbase/server 0.332.0 → 0.333.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/get_object_id.js CHANGED
@@ -5,18 +5,18 @@ const crypto = require("crypto")
5
5
  const isHexadecimal = require("validator/lib/isHexadecimal")
6
6
 
7
7
 
8
- const {TENANT_PREFIX} = process.env
8
+ const {RB_TENANT_ID} = process.env
9
9
 
10
10
 
11
11
  // TODO: WARNING: DANGER: this code is duplicated in the client
12
12
  // TODO: move it to iso
13
13
 
14
14
  // Validation: is defined
15
- assert(TENANT_PREFIX, "expected TENANT_PREFIX to be defined")
15
+ assert(RB_TENANT_ID, "expected RB_TENANT_ID to be defined")
16
16
  // is hexadecimal
17
- assert(isHexadecimal(TENANT_PREFIX), "expected TENANT_PREFIX to be a hexadecimal")
17
+ assert(isHexadecimal(RB_TENANT_ID), "expected RB_TENANT_ID to be a hexadecimal")
18
18
  // is 4 bytes
19
- assert(TENANT_PREFIX.length === 8, "TENANT_PREFIX must be exactly 4 bytes (8 hex chars)")
19
+ assert(RB_TENANT_ID.length === 8, "RB_TENANT_ID must be exactly 4 bytes (8 hex chars)")
20
20
 
21
21
 
22
22
  // generates a 12 bytes mongodb object id using the org id prefix or custom customer id
@@ -26,7 +26,7 @@ const get_object_id = () => {
26
26
 
27
27
  const random_bytes = crypto.randomBytes(4).toString("hex")
28
28
 
29
- const obj_id = `${ts_bytes}${TENANT_PREFIX}${random_bytes}`
29
+ const obj_id = `${ts_bytes}${RB_TENANT_ID}${random_bytes}`
30
30
  return obj_id
31
31
  }
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.332.0",
3
+ "version": "0.333.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -11,7 +11,7 @@ const dispatch_queue = require("./dispatch_queue")
11
11
 
12
12
  const log = debug("rb:queue:listener")
13
13
 
14
- const {RB_APP_NAME, TENANT_PREFIX} = process.env
14
+ const {RB_APP_NAME, RB_TENANT_ID} = process.env
15
15
 
16
16
  const RETRY_MAXIMUM_DELAY = 2000
17
17
  const RETRY_MINIMUM_DELAY = 10
@@ -61,7 +61,7 @@ const assert_doc_id = (change) => {
61
61
 
62
62
  const sub = doc_id.substring(8, 16)
63
63
  try {
64
- expect(sub).toBe(TENANT_PREFIX)
64
+ expect(sub).toBe(RB_TENANT_ID)
65
65
  } catch (err) {
66
66
  console.log("in document:", change.ns, change.documentKey)
67
67
  console.log("_id must be constructed with get_object_id()")