@eluvio/elv-client-js 4.2.15 → 4.2.17

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.
Files changed (41) hide show
  1. package/dist/ElvClient-min.js +1 -1
  2. package/dist/ElvClient-node-min.js +1 -1
  3. package/dist/ElvFrameClient-min.js +1 -1
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +1 -1
  6. package/dist/ElvWalletClient-node-min.js +1 -1
  7. package/dist/src/AuthorizationClient.js +2 -1
  8. package/dist/src/ContentObjectAudit.js +2 -1
  9. package/dist/src/ContentObjectVerification.js +281 -0
  10. package/dist/src/ElvClient.js +8 -9
  11. package/dist/src/FrameClient.js +1 -1
  12. package/dist/src/HttpClient.js +83 -47
  13. package/dist/src/NetworkUrls.js +8 -0
  14. package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
  15. package/dist/src/client/ContentAccess.js +76 -85
  16. package/dist/src/client/LiveConf.js +170 -84
  17. package/dist/src/client/LiveStream.js +5205 -2118
  18. package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
  19. package/package.json +3 -2
  20. package/src/AuthorizationClient.js +2 -1
  21. package/src/ContentObjectAudit.js +4 -1
  22. package/src/ElvClient.js +8 -15
  23. package/src/FrameClient.js +23 -2
  24. package/src/HttpClient.js +17 -1
  25. package/src/NetworkUrls.js +9 -0
  26. package/src/abr_profiles/abr_profile_live_drm.js +0 -10
  27. package/src/client/ContentAccess.js +8 -23
  28. package/src/client/LiveConf.js +149 -65
  29. package/src/client/LiveStream.js +2592 -654
  30. package/src/live_recording_config_profiles/live_recording_config_default.js +54 -0
  31. package/src/live_recording_config_profiles/live_stream_profile_full.json +143 -0
  32. package/testScripts/StreamUpdateLinks.js +95 -0
  33. package/utilities/ChannelCreate.js +1 -1
  34. package/utilities/LibraryDownloadMp4.js +54 -8
  35. package/utilities/LibraryDownloadMp4Parallel.js +544 -0
  36. package/utilities/LiveOutputs.js +149 -0
  37. package/utilities/StreamCreate.js +53 -0
  38. package/utilities/lib/concerns/Client.js +5 -0
  39. package/utilities/lib/helpers.js +5 -1
  40. package/utilities/tests/mocks/ElvClient.mock.js +9 -1
  41. package/utilities/tests/unit/StreamCreate.test.js +39 -0
@@ -0,0 +1,53 @@
1
+ const Client = require("./lib/concerns/Client");
2
+ const {NewOpt, StdOpt} = require("./lib/options");
3
+ const Library = require("./lib/concerns/Library");
4
+ const Utility = require("./lib/Utility");
5
+
6
+ class StreamCreate extends Utility {
7
+ blueprint() {
8
+ return {
9
+ concerns: [Client],
10
+ options: [
11
+ StdOpt(
12
+ "libraryId",
13
+ {
14
+ demand: true,
15
+ forX: "new stream"
16
+ }
17
+ ),
18
+ NewOpt(
19
+ "url",
20
+ {
21
+ demand: true,
22
+ descTemplate: "URL{X}",
23
+ type: "string"
24
+ }
25
+ )
26
+ ]
27
+ };
28
+ }
29
+
30
+ async body() {
31
+ const logger = this.logger;
32
+ const {libraryId, url} = this.args;
33
+
34
+ const client = await this.concerns.Client.get();
35
+ const response = await client.StreamCreate({
36
+ libraryId,
37
+ url
38
+ });
39
+
40
+ logger.log(`New object ID: ${response.id}`);
41
+ logger.data("object_id", response.id);
42
+ }
43
+
44
+ header() {
45
+ return `Create live stream '${this.args.libraryId}':`;
46
+ }
47
+ }
48
+
49
+ if(require.main === module) {
50
+ Utility.cmdLineInvoke(StreamCreate);
51
+ } else {
52
+ module.exports = StreamCreate;
53
+ }
@@ -31,6 +31,11 @@ const blueprint = {
31
31
  descTemplate: "Geographic region for the fabric nodes.",
32
32
  group: "API",
33
33
  type: "string"
34
+ }),
35
+ NewOpt("node", {
36
+ descTemplate: "Pin all fabric and file-service requests to a specific node hostname or URL (e.g. host-76-74-28-240.contentfabric.io). Overrides the nodes returned by the config URL.",
37
+ group: "API",
38
+ type: "string"
34
39
  })
35
40
  ]
36
41
  };
@@ -77,6 +77,9 @@ const suppressNullLike = x => kindOf(x) === "null" || kindOf(x) === "undefined"
77
77
 
78
78
  const trimSlashes = R.compose(removeLeadingSlash, removeTrailingSlash);
79
79
 
80
+ const slugify = str =>
81
+ (str || "").toLowerCase().trim().replace(/ /g, "-").replace(/[^a-z0-9-]/g, "");
82
+
80
83
  // --------------------------------------------
81
84
  // time formatting
82
85
  // --------------------------------------------
@@ -225,6 +228,7 @@ module.exports = {
225
228
  removeTrailingSlash,
226
229
  seconds,
227
230
  singleEntryMap,
231
+ slugify,
228
232
  spaceAfter,
229
233
  stringOrFileContents,
230
234
  subst,
@@ -235,4 +239,4 @@ module.exports = {
235
239
  unit,
236
240
  valOrThrow,
237
241
  widthForRatioAndHeight
238
- };
242
+ };
@@ -307,6 +307,13 @@ const StartABRMezzanineJobs = async (args) => {
307
307
  };
308
308
  };
309
309
 
310
+ const StreamCreate = async (args) => {
311
+ calls.push("StreamCreate: " + JSON.stringify(args));
312
+ return {
313
+ id: "iq__dummy_new_id"
314
+ };
315
+ };
316
+
310
317
  const UploadFiles = async (args) => {
311
318
  calls.push("UploadFiles: " + JSON.stringify(args));
312
319
  };
@@ -332,6 +339,7 @@ const MockClient = {
332
339
  ReplaceMetadata,
333
340
  SetVisibility,
334
341
  StartABRMezzanineJobs,
342
+ StreamCreate,
335
343
  UploadFiles
336
344
  };
337
345
 
@@ -503,4 +511,4 @@ const writeTokens = {};
503
511
 
504
512
 
505
513
 
506
- module.exports = {removeStubs, stubClient};
514
+ module.exports = {removeStubs, stubClient};
@@ -0,0 +1,39 @@
1
+ const chai = require("chai");
2
+ const chaiAsPromised = require("chai-as-promised");
3
+ const expect = chai.expect;
4
+ chai.use(chaiAsPromised);
5
+
6
+ const {removeStubs, stubClient} = require("../mocks/ElvClient.mock");
7
+ const {argList2Params, removeElvEnvVars} = require("../helpers/params");
8
+
9
+ removeElvEnvVars();
10
+ beforeEach(removeStubs);
11
+
12
+ const StreamCreate = require("../../StreamCreate");
13
+
14
+ describe("StreamCreate", () => {
15
+ it("should complain if --libraryId not supplied", () => {
16
+ expect(() => {
17
+ new StreamCreate(argList2Params("--url", "http://example.com"));
18
+ }).to.throw("Missing required argument: libraryId");
19
+ });
20
+
21
+ it("should complain if --url not supplied", () => {
22
+ expect(() => {
23
+ new StreamCreate(argList2Params("--libraryId", "ilib123"));
24
+ }).to.throw("Missing required argument: url");
25
+ });
26
+
27
+ it("should call StreamCreate() and include object_id in return value", () => {
28
+ const utility = new StreamCreate(argList2Params("--libraryId", "ilib123", "--url", "http://example.com", "--json"));
29
+ const stub = stubClient(utility.concerns.Client);
30
+ stub.resetHistory();
31
+ return utility.run().then( (retVal) => {
32
+ expect(retVal.object_id).to.equal("iq__dummy_new_id");
33
+
34
+ expect(stub.callHistoryMismatches([
35
+ "StreamCreate"
36
+ ]).length).to.equal(0);
37
+ });
38
+ });
39
+ });