@rpcbase/client 0.48.0 → 0.50.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/base_url.js ADDED
@@ -0,0 +1,16 @@
1
+ /* @flow */
2
+ import axios from "axios"
3
+
4
+ import {SERVER_PORT, HOSTNAME} from "env"
5
+
6
+ const protocol = (typeof window !== "undefined" && window?.location?.protocol) || "http:"
7
+
8
+ // there is no SERVER_PORT in production, as we use the default port and we are behind the gateway
9
+ let BASE_URL
10
+ if (__DEV__) {
11
+ BASE_URL = `${protocol}//${HOSTNAME}:${SERVER_PORT}`
12
+ } else {
13
+ BASE_URL = `https://${HOSTNAME}`
14
+ }
15
+
16
+ export default BASE_URL
package/helpers/post.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  import axios from "axios"
3
3
 
4
- import {BASE_URL} from "env"
4
+ import BASE_URL from "../base_url"
5
5
 
6
6
  const client = axios.create({
7
7
  withCredentials: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 0"
6
6
  },
package/rpc_post.js CHANGED
@@ -7,7 +7,7 @@ import _set from "lodash/set"
7
7
  import get_txn_id from "@rpcbase/std/get_txn_id"
8
8
  import {add_local_txn} from "@rpcbase/client/rts"
9
9
 
10
- import {BASE_URL} from "env"
10
+ import BASE_URL from "./base_url"
11
11
 
12
12
  const client = axios.create({
13
13
  withCredentials: true,
package/rts/index.js CHANGED
@@ -5,7 +5,7 @@ import _get from "lodash/get"
5
5
  import _set from "lodash/set"
6
6
  import debug from "debug"
7
7
 
8
- import {BASE_URL} from "env"
8
+ import BASE_URL from "../base_url"
9
9
 
10
10
  import store from "./store"
11
11
  import getUseQuery from "./getUseQuery"
@@ -4,11 +4,12 @@ import PouchDB from "pouchdb-core"
4
4
  import IndexedDBAdapter from "pouchdb-adapter-indexeddb"
5
5
  import FindPlugin from "pouchdb-find"
6
6
 
7
- import {DATABASE_NAME} from "env"
7
+ import {TENANT_PREFIX, DATABASE_NAME} from "env"
8
8
 
9
9
  const log = debug("rb:store")
10
10
 
11
- let prefix = "rb/"
11
+ let prefix = `rb/${TENANT_PREFIX}/`
12
+
12
13
  if (DATABASE_NAME) prefix += `${DATABASE_NAME}/`
13
14
 
14
15
  PouchDB.prefix = prefix