@rpcbase/server 0.355.0 → 0.356.0-tsbundlerserver.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,13 +1,10 @@
1
- /* @flow */
2
1
  const assert = require("assert")
3
2
  const crypto = require("crypto")
4
3
 
5
- const isHexadecimal = require("validator/lib/isHexadecimal")
6
-
4
+ import isHexadecimal from "validator/lib/isHexadecimal"
7
5
 
8
6
  const {RB_TENANT_ID} = process.env
9
7
 
10
-
11
8
  // TODO: WARNING: DANGER: this code is duplicated in the client
12
9
  // TODO: move it to iso
13
10
 
@@ -18,9 +15,8 @@ assert(isHexadecimal(RB_TENANT_ID), "expected RB_TENANT_ID to be a hexadecimal")
18
15
  // is 4 bytes
19
16
  assert(RB_TENANT_ID.length === 8, "RB_TENANT_ID must be exactly 4 bytes (8 hex chars)")
20
17
 
21
-
22
18
  // generates a 12 bytes mongodb object id using the org id prefix or custom customer id
23
- const get_object_id = () => {
19
+ export const get_object_id = (): string => {
24
20
  const ts_bytes = Math.floor(Date.now() / 1000).toString(16)
25
21
  expect(ts_bytes.length).toBe(8)
26
22
 
@@ -29,5 +25,3 @@ const get_object_id = () => {
29
25
  const obj_id = `${ts_bytes}${RB_TENANT_ID}${random_bytes}`
30
26
  return obj_id
31
27
  }
32
-
33
- module.exports = get_object_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.355.0",
3
+ "version": "0.356.0-tsbundlerserver.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "scripts": {