@eluvio/elv-client-js 3.1.97 → 3.2.2

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/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.1.97",
3
+ "version": "3.2.2",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
- "main": "src/ElvClient.js",
5
+ "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/eluv-io/elv-client-js",
9
9
  "scripts": {
10
10
  "bump-version": "npm --git-tag-version --no-commit-hooks version patch",
11
11
  "build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-prod",
12
- "build-docs": "node build/BuildDocs.js && ./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
12
+ "build-docs": "node build/BuildDocs.js && npm run build-client-docs && npm run build-wallet-client-docs",
13
+ "build-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
14
+ "build-wallet-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc-mc.json --readme ./src/walletClient/README.md",
13
15
  "build-dist": "node ./node_modules/@babel/cli/bin/babel.js --source-type=unambiguous --presets=@babel/preset-env --plugins @babel/plugin-transform-runtime src --out-dir dist/src",
14
16
  "build-contracts": "node build/BuildContracts.js",
15
17
  "build-frame-client": "webpack -p --progress --entry ./dist/src/FrameClient.js --output-filename ElvFrameClient-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/frame-client.html",
package/src/ElvClient.js CHANGED
@@ -39,6 +39,9 @@ if(Utils.Platform() === Utils.PLATFORM_NODE) {
39
39
  /**
40
40
  * See the Modules section on the sidebar for details about methods related to interacting with the Fabric.
41
41
  *
42
+ * <br/>
43
+ *
44
+ * For information about the Eluvio Wallet Client, go <a href="wallet-client/index.html">here</a>.
42
45
  */
43
46
  class ElvClient {
44
47
  Log(message, error = false) {
@@ -116,7 +119,7 @@ class ElvClient {
116
119
  /**
117
120
  * Create a new ElvClient
118
121
  *
119
- * NOTE: It is highly recommended to use ElvClient.FromConfiguration to
122
+ * NOTE: It is highly recommended to use the <a href="#.FromConfigurationUrl">FromConfigurationUrl</a> or <a href="#.FromNetworkName">FromNetworkName</a> method
120
123
  * automatically import the client settings from the fabric
121
124
  *
122
125
  * @constructor
package/src/Utils.js CHANGED
@@ -18,14 +18,14 @@ const {
18
18
  *
19
19
  * Utils can be imported separately from the client:
20
20
  *
21
- * const Utils = require("@eluvio/elv-client-js/src/Utils)
21
+ * `const Utils = require("@eluvio/elv-client-js/src/Utils)`
22
22
  *
23
23
  * or
24
24
  *
25
- * import Utils from "@eluvio/elv-client-js/src/Utils"
25
+ * `import Utils from "@eluvio/elv-client-js/src/Utils"`
26
26
  *
27
27
  *
28
- * It can be accessed from ElvClient and FrameClient as client.utils
28
+ * It can be accessed from ElvClient and FrameClient as `client.utils`
29
29
  */
30
30
  const Utils = {
31
31
  name: "Utils",
@@ -442,6 +442,21 @@ const Utils = {
442
442
  return Buffer.from(str, "base64").toString("utf-8");
443
443
  },
444
444
 
445
+ FromB64URL: str => {
446
+ str = str.replace(/-/g, "+").replace(/_/g, "/");
447
+
448
+ const pad = str.length % 4;
449
+ if(pad) {
450
+ if(pad === 1) {
451
+ throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");
452
+ }
453
+
454
+ str += new Array(5-pad).join("=");
455
+ }
456
+
457
+ return Utils.FromB64(str);
458
+ },
459
+
445
460
  B58: arr => {
446
461
  return bs58.encode(Buffer.from(arr));
447
462
  },
@@ -450,6 +465,10 @@ const Utils = {
450
465
  return bs58.decode(str);
451
466
  },
452
467
 
468
+ FromB58ToStr: str => {
469
+ return new TextDecoder().decode(Utils.FromB58(str));
470
+ },
471
+
453
472
  /**
454
473
  * Decode the given fabric authorization token
455
474
  *
package/src/index.js ADDED
@@ -0,0 +1,7 @@
1
+ const {ElvClient} = require("./ElvClient.js");
2
+ const {ElvMarketplaceClient} = require("./walletClient/index.js");
3
+ const Utils = require("./Utils.js");
4
+
5
+ exports.ElvClient = ElvClient;
6
+ exports.ElvMarketplaceClient = ElvMarketplaceClient;
7
+ exports.Utils = Utils;