@eluvio/elv-client-js 3.2.30 → 3.2.31

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/README.md CHANGED
@@ -22,6 +22,15 @@ The Eluvio Javascript Client is designed to make interacting with the Eluvio Con
22
22
  npm install --save @eluvio/elv-client-js
23
23
  ```
24
24
 
25
+
26
+ NOTE: If you see an `unsupported architecture` error on Mac OS X, try the following:
27
+
28
+ ```
29
+ export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
30
+
31
+ export SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
32
+ ```
33
+
25
34
  #### Usage
26
35
 
27
36
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.30",
3
+ "version": "3.2.31",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -28,8 +28,9 @@ let WalletConfiguration = {
28
28
  "realcannonballrun-marketplace",
29
29
  "maskverse-marketplace",
30
30
  "dolly-marketplace",
31
- "oc-marketplace",
31
+ "eluvio-live-marketplace-sonark",
32
32
  "cirkay-marketplace",
33
+ "oc-marketplace",
33
34
  "emp-marketplace",
34
35
  "microsoft",
35
36
  "indieflix-marketplace",
@@ -0,0 +1,51 @@
1
+ /* eslint-disable no-console */
2
+
3
+ const ScriptBase = require("./parentClasses/ScriptBase");
4
+
5
+ class DraftFinalize extends ScriptBase {
6
+
7
+ async body() {
8
+ const client = await this.client();
9
+
10
+ const libraryId = this.args.libraryId;
11
+ const objectId = this.args.objectId;
12
+ const writeToken = this.args.writeToken;
13
+
14
+ console.log("Finalizing object...");
15
+ const finalizeResponse = await client.FinalizeContentObject({
16
+ libraryId,
17
+ objectId,
18
+ writeToken
19
+ });
20
+ console.log("New version hash: " + finalizeResponse.hash);
21
+ }
22
+
23
+ header() {
24
+ return "Finalize draft " + this.args.writeToken + "'... ";
25
+ }
26
+
27
+ options() {
28
+ return super.options()
29
+ .option("libraryId", {
30
+ alias: "library-id",
31
+ demandOption: true,
32
+ describe: "Library ID (should start with 'ilib')",
33
+ type: "string"
34
+ })
35
+ .option("objectId", {
36
+ alias: "object-id",
37
+ demandOption: true,
38
+ describe: "Object ID (should start with 'iq__')",
39
+ type: "string"
40
+ })
41
+ .option("writeToken", {
42
+ alias: "write-token",
43
+ demandOption: true,
44
+ describe: "Write token of draft",
45
+ type: "string"
46
+ });
47
+ }
48
+ }
49
+
50
+ const script = new DraftFinalize;
51
+ script.run();
@@ -0,0 +1,86 @@
1
+ /* eslint-disable no-console */
2
+
3
+ // Ensures that an existing offering has only strong DRM playout options (Widevine and Fairplay)
4
+
5
+ const ScriptOffering = require("./parentClasses/ScriptOffering");
6
+
7
+ class OfferingEnsureStrongDrm extends ScriptOffering {
8
+
9
+ async body() {
10
+ const client = await this.client();
11
+
12
+ const libraryId = this.args.libraryId;
13
+ const objectId = this.args.objectId;
14
+ const offeringKey = this.args.offeringKey;
15
+ const force = this.args.force;
16
+
17
+ let changesMade = false;
18
+
19
+ let metadata = await client.ContentObjectMetadata({
20
+ libraryId,
21
+ objectId
22
+ });
23
+
24
+ this.validateOffering(metadata, offeringKey);
25
+
26
+ // if offering has store_clear: false, abort
27
+ if(metadata.offerings[offeringKey].store_clear) {
28
+ if(force){
29
+ console.warn("WARNING: Offering '" + offeringKey + "' has 'store_clear' set to true, this is insecure! Proceeding anyway due to --force being specified...");
30
+ } else {
31
+ this.throwError("Offering '" + offeringKey + "' has 'store_clear' set to true. Use --force to execute command anyway.");
32
+ }
33
+ }
34
+
35
+ if(metadata.offerings[offeringKey].drm_optional) {
36
+ console.log("Offering '" + offeringKey + "' has 'drm_optional' set to true: changing to false...");
37
+ metadata.offerings[offeringKey].drm_optional = false;
38
+ changesMade = true;
39
+ }
40
+
41
+
42
+ // loop through playout formats, delete ones where drm is null or is weak
43
+ const playoutFormatKeys = Object.keys(metadata.offerings[offeringKey].playout.playout_formats);
44
+ const originalFormatCount = playoutFormatKeys.length;
45
+ if(originalFormatCount === 0){
46
+ this.throwError("Offering '" + offeringKey + "' has no playout formats.");
47
+ }
48
+
49
+ for(let i = 0; i < originalFormatCount; i++) {
50
+ const key = playoutFormatKeys[i];
51
+ const drm = metadata.offerings[offeringKey].playout.playout_formats[key].drm;
52
+ if(!drm || !["DrmWidevine", "DrmFairplay"].includes(drm.type)) {
53
+ console.log("Deleting playout format '" + key + "'...");
54
+ delete metadata.offerings[offeringKey].playout.playout_formats[key];
55
+ changesMade = true;
56
+ }
57
+ }
58
+
59
+ const newFormatCount = Object.keys(metadata.offerings[offeringKey].playout.playout_formats).length;
60
+ if(newFormatCount === 0) {
61
+ this.throwError("Offering '" + offeringKey + "' would have no playout formats remaining after this operation.");
62
+ }
63
+
64
+ if(changesMade) {
65
+ console.log(newFormatCount + " playout format(s) remaining after operation.");
66
+ await this.metadataWrite(metadata);
67
+ } else {
68
+ console.log("No playout formats removed.");
69
+ }
70
+ }
71
+
72
+ header() {
73
+ return "Removing playout formats with weak (or no) DRM from mezzanine offering '" + this.args.offeringKey + "'... ";
74
+ }
75
+
76
+ options() {
77
+ return super.options()
78
+ .option("force", {
79
+ describe: "Force operation, even if 'store_clear' is set to 'true'",
80
+ type: "boolean"
81
+ });
82
+ }
83
+ }
84
+
85
+ const script = new OfferingEnsureStrongDrm;
86
+ script.run();
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height":720 ,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -127,7 +136,7 @@
127
136
  "protocol": {
128
137
  "type": "ProtoHls"
129
138
  }
130
- }
139
+ }
131
140
  },
132
141
  "segment_specs": {
133
142
  "audio": {
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height": 720,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height":720 ,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -0,0 +1,36 @@
1
+ // Retrieve part list from object
2
+ const Utility = require("./lib/Utility");
3
+
4
+ const Draft = require("./lib/concerns/Draft");
5
+ const {NewOpt} = require("./lib/options");
6
+
7
+ class WriteTokenDecode extends Utility {
8
+ blueprint() {
9
+ return {
10
+ concerns: [Draft],
11
+ options: [
12
+ NewOpt("writeToken", {
13
+ demand: true,
14
+ descTemplate: "Write token to decode",
15
+ type: "string"
16
+ })
17
+ ]
18
+ };
19
+ }
20
+
21
+ async body() {
22
+ const {writeToken} = this.args;
23
+ // eslint-disable-next-line no-console
24
+ console.log(JSON.stringify(this.concerns.Draft.decode({writeToken}), null, 2));
25
+ }
26
+
27
+ header() {
28
+ return `Decode write token ${this.args.writeToken}`;
29
+ }
30
+ }
31
+
32
+ if(require.main === module) {
33
+ Utility.cmdLineInvoke(WriteTokenDecode);
34
+ } else {
35
+ module.exports = WriteTokenDecode;
36
+ }
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height":720 ,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -127,7 +136,7 @@
127
136
  "protocol": {
128
137
  "type": "ProtoHls"
129
138
  }
130
- }
139
+ }
131
140
  },
132
141
  "segment_specs": {
133
142
  "audio": {
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height": 720,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -34,28 +43,28 @@
34
43
  "height": 1080,
35
44
  "media_type": "video",
36
45
  "pregenerate": false,
37
- "width": 1920
46
+ "width": 1920
38
47
  },
39
48
  {
40
49
  "bit_rate": 4500000,
41
50
  "height":720 ,
42
51
  "media_type": "video",
43
52
  "pregenerate": false,
44
- "width": 1280
53
+ "width": 1280
45
54
  },
46
55
  {
47
56
  "bit_rate": 2000000,
48
57
  "height": 540,
49
58
  "media_type": "video",
50
59
  "pregenerate": false,
51
- "width": 960
60
+ "width": 960
52
61
  },
53
62
  {
54
63
  "bit_rate": 1100000,
55
64
  "height": 432,
56
65
  "media_type": "video",
57
66
  "pregenerate": false,
58
- "width": 768
67
+ "width": 768
59
68
  },
60
69
  {
61
70
  "bit_rate": 810000,
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -14,16 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
18
  "media_type": "audio",
19
19
  "pregenerate": true
20
20
  }
21
21
  ]
22
22
  },
23
- "{\"media_type\":\"audio\",\"channels\":4}": {
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
24
  "rung_specs": [
25
25
  {
26
- "bit_rate": 128000,
26
+ "bit_rate": 384000,
27
27
  "media_type": "audio",
28
28
  "pregenerate": true
29
29
  }
@@ -14,16 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
18
  "media_type": "audio",
19
19
  "pregenerate": true
20
20
  }
21
21
  ]
22
22
  },
23
- "{\"media_type\":\"audio\",\"channels\":4}": {
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
24
  "rung_specs": [
25
25
  {
26
- "bit_rate": 128000,
26
+ "bit_rate": 384000,
27
27
  "media_type": "audio",
28
28
  "pregenerate": true
29
29
  }
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -14,7 +14,16 @@
14
14
  "{\"media_type\":\"audio\",\"channels\":2}": {
15
15
  "rung_specs": [
16
16
  {
17
- "bit_rate": 128000,
17
+ "bit_rate": 192000,
18
+ "media_type": "audio",
19
+ "pregenerate": true
20
+ }
21
+ ]
22
+ },
23
+ "{\"media_type\":\"audio\",\"channels\":6}": {
24
+ "rung_specs": [
25
+ {
26
+ "bit_rate": 384000,
18
27
  "media_type": "audio",
19
28
  "pregenerate": true
20
29
  }
@@ -1,6 +1,7 @@
1
1
  // for scripts that work with Drafts (new unfinalized objects/versions)
2
2
  const Client = require("./Client");
3
3
  const Logger = require("./Logger");
4
+ const Utils = require("../../../src/Utils");
4
5
 
5
6
  const blueprint = {
6
7
  name: "Draft",
@@ -44,13 +45,19 @@ const New = context => {
44
45
  };
45
46
  };
46
47
 
48
+ const decode = ({writeToken}) => {
49
+ if(!writeToken) throw Error("Draft.decode() - missing writeToken");
50
+ return Utils.DecodeWriteToken(writeToken);
51
+ };
52
+
47
53
  // instance interface
48
54
  return {
49
- create
55
+ create,
56
+ decode
50
57
  };
51
58
  };
52
59
 
53
60
  module.exports = {
54
61
  blueprint,
55
62
  New
56
- };
63
+ };