impossiblefxv1 1.13.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.
Files changed (68) hide show
  1. package/HOWTO-PUBLISH.txt +15 -0
  2. package/README.md +21 -0
  3. package/apis/edit-2016-06-02.json +15 -0
  4. package/apis/metadata.json +31 -0
  5. package/apis/project-2016-06-01.json +56 -0
  6. package/apis/project-2016-06-02.json +767 -0
  7. package/apis/project-2023-03-07.json +767 -0
  8. package/apis/project-2023-12-11.json +767 -0
  9. package/apis/render-2016-06-02.json +764 -0
  10. package/apis/render-2023-12-11.json +764 -0
  11. package/dist/fx-sdk-latest.js +22494 -0
  12. package/dist-tools/build-browser.js +109 -0
  13. package/dist-tools/build-sdk.sh +6 -0
  14. package/dist-tools/es6-promise.js +957 -0
  15. package/dist-tools/foo.sh +4 -0
  16. package/dist-tools/publish.sh +6 -0
  17. package/lib/browser.js +58 -0
  18. package/lib/config.js +125 -0
  19. package/lib/core.js +15 -0
  20. package/lib/credentials/chain.js +54 -0
  21. package/lib/credentials/environment.js +69 -0
  22. package/lib/credentials/inifile.js +57 -0
  23. package/lib/credentials/token.js +38 -0
  24. package/lib/credentials.js +53 -0
  25. package/lib/encoding.js +36 -0
  26. package/lib/endpoint.js +18 -0
  27. package/lib/fx.js +50 -0
  28. package/lib/http/node.js +69 -0
  29. package/lib/http/xhr.js +12 -0
  30. package/lib/http.js +57 -0
  31. package/lib/proto.js +38 -0
  32. package/lib/protocol.js +56 -0
  33. package/lib/request.js +252 -0
  34. package/lib/response.js +24 -0
  35. package/lib/service.js +182 -0
  36. package/lib/services/batch.js +5 -0
  37. package/lib/services/edit.js +9 -0
  38. package/lib/services/project.js +102 -0
  39. package/lib/services/render.js +63 -0
  40. package/lib/services/story.js +5 -0
  41. package/lib/services.js +30 -0
  42. package/lib/util.js +126 -0
  43. package/package.json +37 -0
  44. package/package.json.save +36 -0
  45. package/proto/Movie.proto +4081 -0
  46. package/proto/fx.proto +43 -0
  47. package/templates/config.html +91 -0
  48. package/templates/examples.html +69 -0
  49. package/templates/getstarted.html +30 -0
  50. package/templates/index.html +6 -0
  51. package/templates/makeexample.py +57 -0
  52. package/templates/makerequests.html +210 -0
  53. package/templates/operation.html +36 -0
  54. package/templates/service.html +9 -0
  55. package/templates/services.html +19 -0
  56. package/templates/version.html +12 -0
  57. package/templates/versions.html +10 -0
  58. package/templates/workservice.html +68 -0
  59. package/test/circles.mp4 +0 -0
  60. package/test/config.js +131 -0
  61. package/test/index.html +35 -0
  62. package/test/mocha.opts +4 -0
  63. package/test/project.js +148 -0
  64. package/test/render.js +136 -0
  65. package/test/retry.js +53 -0
  66. package/test/sdktests.js +62 -0
  67. package/test/sdl.js +125 -0
  68. package/test/servertest/simple.js +20 -0
@@ -0,0 +1,102 @@
1
+
2
+ var FX = require('../core');
3
+
4
+ FX.util.update(FX.Project.prototype, {
5
+
6
+ TransformProjectList: function(request) {
7
+ var data = request.response.data
8
+ var result = {Projects: []}
9
+
10
+ for(var p=0; p < data.Projects.length; p++) {
11
+ var prjuid = data.Projects[p][0]
12
+ result.Projects.push({
13
+ ProjectId: prjuid,
14
+ Region: request.service.config.region,
15
+ Name: data.Metadata[prjuid].name,
16
+ Created: data.Metadata[prjuid].date_created
17
+ })
18
+ }
19
+
20
+ request.response.data = result
21
+ },
22
+
23
+
24
+ TransformProjectCreate: function(request) {
25
+ var data = request.response.data
26
+ request.response.data = {
27
+ Project: {
28
+ ProjectId: data['project-UID'],
29
+ Region: request.service.config.region,
30
+ Name: request.params['Name'],
31
+ Created: new Date()
32
+ }
33
+ }
34
+ },
35
+
36
+ TransformAssetList: function(request) {
37
+ var data = request.response.data
38
+ var result = { All: {}, Videos: [], Images: [], Sounds: [], Fonts: [], Datasources: [], Aux: [], Trackdata: [] }
39
+
40
+ var collectAssets = function(source, destination) {
41
+ for(var a=0; a < source.length; a++) {
42
+ var name = source[a]
43
+ var asset = {}
44
+ FX.util.each(data.Metadata[name], function(key, value){
45
+ asset[FX.util.string.upperFirst(key)] = value
46
+ })
47
+ asset.Region = request.service.config.region,
48
+ asset.ProjectId = request.params['ProjectId']
49
+ result.All[name] = asset
50
+ destination.push(asset)
51
+ }
52
+ }
53
+
54
+ collectAssets(data.Videos, result.Videos)
55
+ collectAssets(data.Images, result.Images)
56
+ collectAssets(data.Audios, result.Sounds)
57
+ collectAssets(data.Fonts, result.Fonts)
58
+ collectAssets(data.Generic, result.Aux)
59
+ collectAssets(data.Trackdata, result.Trackdata)
60
+ collectAssets(data.Datasources, result.Datasources)
61
+ request.response.data = result
62
+ },
63
+
64
+ TransformAssetGet: function(request) {
65
+ request.response.data = {
66
+ Data: request.response.httpResponse
67
+ }
68
+ },
69
+
70
+ TransformMovieGet: function(request) {
71
+ var data = request.response.data
72
+ request.response.data = {
73
+ Movie: new FX.SDL().Movie.decode(data)
74
+ }
75
+ },
76
+
77
+ TransformMovieList: function(request) {
78
+ var data = request.response.data
79
+ var result = {Movies: []}
80
+
81
+ for(var p=0; p < data.SDLS.length; p++) {
82
+ var name = data.SDLS[p];
83
+ var meta = data.Metadata[name];
84
+
85
+ result.Movies.push({
86
+ ProjectId: request.params['ProjectId'],
87
+ Region: request.service.config.region,
88
+ Name: name,
89
+ Created: meta.date_created,
90
+ Modified: meta.date_modified,
91
+ Width: meta['width'],
92
+ Height: meta['height'],
93
+ Codecs: meta['codec'],
94
+ Length: meta['seconds'],
95
+ VariableLength: meta['variablelength']
96
+ })
97
+ }
98
+
99
+ request.response.data = result
100
+ },
101
+
102
+ })
@@ -0,0 +1,63 @@
1
+
2
+ var FX = require('../core');
3
+
4
+ FX.util.update(FX.Render.prototype, {
5
+
6
+ TransformTokenGet: function(request) {
7
+ var data = request.response.data
8
+ request.response.data = {
9
+ Token: data.token
10
+ }
11
+
12
+ if(data.upload) {
13
+ request.response.data.Upload = {
14
+ Result: data.upload.result,
15
+ Status: data.upload.status
16
+ }
17
+ }
18
+ },
19
+
20
+
21
+ TransformRenderURL: function(request) {
22
+ var data = request.response.data
23
+ request.response.data = {
24
+ Token: data.token,
25
+ URL: FX.Render.computeRenderURL({
26
+ Token: data.token,
27
+ Endpoint: request.params.Endpoint || (request.httpRequest.protocol + "://" + request.httpRequest.hostname),
28
+ Mode: request.params.Mode || request.operation.input.members.Mode.default,
29
+ Format: request.params.Format || request.operation.input.members.Format.default
30
+
31
+ })
32
+ }
33
+ }
34
+ })
35
+
36
+ FX.util.update(FX.Render, {
37
+
38
+ /**
39
+ * Get a render URL for a given token.
40
+ *
41
+ * @note Synchronous operation
42
+ * @param Token [String] A token
43
+ * @param Extension [String] A video container format, e.g. "mp4"
44
+ * @option Endpoint [string] Override geo detection and route request to given region
45
+ * @option Mode [string] Delivery mode, defaults to "render"
46
+ */
47
+ computeRenderURL: function(params) {
48
+ var endpoint = params.Endpoint
49
+ var mode = params.Mode
50
+ var format = params.Format
51
+ return endpoint+ "/v2/" + mode + "/" + params.Token + "." + format
52
+ },
53
+
54
+
55
+ /**
56
+ * render preview image
57
+ */
58
+ renderPreview: function(service, method, operation, params) {
59
+ var req = new FX.Request(service, method, operation, params)
60
+ //FX.HttpClient.getInstance().exec(self.httpRequest, function(err, stream) {
61
+
62
+ }
63
+ })
@@ -0,0 +1,5 @@
1
+
2
+ var FX = require('../core');
3
+
4
+ FX.util.update(FX.Story.prototype, {
5
+ })
@@ -0,0 +1,30 @@
1
+ var FX = require('./core')
2
+ var fs = require('fs');
3
+ var path = require('path');
4
+
5
+ // the Browser version has this already loaded
6
+ //throw new Error("Browser should not load this");
7
+ if(!FX.serviceMap) {
8
+ // Default (node) ApiLoader
9
+ FX.apiLoader = function(svcName, version) {
10
+ return require(FX.Service.serviceFile(svcName, version));
11
+ }
12
+
13
+ // Default (node) ServiceMap
14
+ var apiRoot = path.join(__dirname, '..', 'apis');
15
+ FX.serviceMap = require(path.join(apiRoot, 'metadata.json'));
16
+
17
+ FX.util.each(FX.serviceMap, function(key, value){
18
+ if(value.enabled) {
19
+
20
+ FX[value.domain] = FX.Service.defineService(key, value.versions);
21
+
22
+ // load any customizations from lib/services/<svcidentifier>.js
23
+ var svcFile = path.join(__dirname, 'services', key + '.js');
24
+ if (fs.existsSync(svcFile))
25
+ require('./services/' + key);
26
+ }
27
+ })
28
+ }
29
+
30
+
package/lib/util.js ADDED
@@ -0,0 +1,126 @@
1
+
2
+ var util = {
3
+ copy: function(obj) {
4
+ if(obj === null || obj === undefined)
5
+ return obj;
6
+ var dupe = {};
7
+ // jshint forin:false
8
+ for (var key in obj) {
9
+ dupe[key] = obj[key];
10
+ }
11
+ return dupe;
12
+ },
13
+
14
+ each: function each(object, iterFunction) {
15
+ for (var key in object) {
16
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
17
+ var ret = iterFunction.call(this, key, object[key]);
18
+ // if (ret === util.abort)
19
+ // break;
20
+ }
21
+ }
22
+ },
23
+
24
+ arrayEach: function arrayEach(array, iterFunction) {
25
+ for (var idx in array) {
26
+ if (Object.prototype.hasOwnProperty.call(array, idx)) {
27
+ var ret = iterFunction.call(this, array[idx], parseInt(idx, 10));
28
+ // if (ret === util.abort) break;
29
+ }
30
+ }
31
+ },
32
+
33
+ update: function update(obj1, obj2) {
34
+ util.each(obj2, function iterator(key, item) {
35
+ obj1[key] = item;
36
+ });
37
+ return obj1;
38
+ },
39
+
40
+ isEmpty: function isEmpty(obj) {
41
+ for (var prop in obj) {
42
+ if (Object.prototype.hasOwnProperty.call(obj, prop)) {
43
+ return false;
44
+ }
45
+ }
46
+ return true;
47
+ },
48
+
49
+ inherit: function inherit(klass, features) {
50
+ var newObject = null;
51
+ if (features === undefined) {
52
+ features = klass;
53
+ klass = Object;
54
+ newObject = {};
55
+ } else {
56
+ var ctor = function ConstructorWrapper() {};
57
+ ctor.prototype = klass.prototype;
58
+ newObject = new ctor();
59
+ }
60
+
61
+ // constructor not supplied, create pass-through ctor
62
+ if(features.constructor === Object) {
63
+ features.constructor = function() {
64
+ if (klass !== Object) {
65
+ return klass.apply(this, arguments);
66
+ }
67
+ };
68
+ }
69
+
70
+ features.constructor.prototype = newObject;
71
+ util.update(features.constructor.prototype, features);
72
+ features.constructor.__super__ = klass;
73
+ return features.constructor;
74
+ },
75
+
76
+ string: {
77
+ lowerFirst: function lowerFirst(string) {
78
+ return string[0].toLowerCase() + string.substr(1);
79
+ },
80
+ upperFirst: function lowerFirst(string) {
81
+ return string[0].toUpperCase() + string.substr(1);
82
+ }
83
+ },
84
+
85
+ date: {
86
+ getDate: function() {
87
+ return new Date()
88
+ }
89
+ },
90
+
91
+ ini: {
92
+ parse: function string(ini) {
93
+ var currentSection, map = {};
94
+ util.arrayEach(ini.split(/\r?\n/), function(line) {
95
+ line = line.split(/(^|\s);/)[0]; // remove comments
96
+ var section = line.match(/^\s*\[([^\[\]]+)\]\s*$/);
97
+ if (section) {
98
+ currentSection = section[1];
99
+ } else if (currentSection) {
100
+ var item = line.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);
101
+ if (item) {
102
+ map[currentSection] = map[currentSection] || {};
103
+ map[currentSection][item[1]] = item[2];
104
+ }
105
+ }
106
+ });
107
+
108
+ return map;
109
+ }
110
+ },
111
+
112
+ readFileSync: function readFileSync(path) {
113
+ if (util.isBrowser()) return null;
114
+ return util.nodeRequire('fs').readFileSync(path, 'utf-8');
115
+ },
116
+
117
+ //injected by browserify
118
+ isBrowser: function isBrowser() { return process && process.browser; },
119
+ isNode: function isNode() { return !util.isBrowser(); },
120
+ nodeRequire: function nodeRequire(module) {
121
+ if(util.isNode()) return require(module);
122
+ },
123
+
124
+ }
125
+
126
+ module.exports = util;
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "impossiblefxv1",
3
+ "version": "1.13.2",
4
+ "description": "ImpossibleFX Scripting and API (Legacy)",
5
+ "main": "lib/fx.js",
6
+ "scripts": {
7
+ "test": "node_modules/.bin/mocha test/*.js",
8
+ "make-browser-sdk": "node dist-tools/build-browser.js > dist/fx-sdk-latest.js",
9
+ "build": "dist-tools/build-sdk.sh",
10
+ "foo": "sh dist-tools/foo.sh",
11
+ "version": "npm run build",
12
+ "postversion": "npm publish && sh dist-tools/publish.sh"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "."
17
+ },
18
+ "author": "Impossible Software GmbH",
19
+ "license": "Proprietary",
20
+ "dependencies": {
21
+ "bytebuffer": "^5.0.1",
22
+ "follow-redirects": "^1.15.2",
23
+ "long": "^3.2.0",
24
+ "protobufjs": "^5.0.1",
25
+ "stream": "0.0.2"
26
+ },
27
+ "devDependencies": {
28
+ "bluebird": "^3.4.1",
29
+ "browserify": "^13.0.1",
30
+ "buffertools": "^2.1.4",
31
+ "chai": "^3.5.0",
32
+ "debug": "^4.3.4",
33
+ "mocha": "*",
34
+ "nock": "^8.0.0",
35
+ "should": ">= 0.0.1"
36
+ }
37
+ }
@@ -0,0 +1,36 @@
1
+ "name": "impossiblefx",
2
+ "version": "3.13.1",
3
+ "description": "ImpossibleFX Scripting and API",
4
+ "main": "lib/fx.js",
5
+ "scripts": {
6
+ "test": "node_modules/.bin/mocha test/*.js",
7
+ "make-browser-sdk": "node dist-tools/build-browser.js > dist/fx-sdk-latest.js",
8
+ "build": "dist-tools/build-sdk.sh",
9
+ "foo": "sh dist-tools/foo.sh",
10
+ "version": "npm run build",
11
+ "postversion": "npm publish && sh dist-tools/publish.sh"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "."
16
+ },
17
+ "author": "Impossible Software GmbH",
18
+ "license": "Proprietary",
19
+ "dependencies": {
20
+ "bytebuffer": "^5.0.1",
21
+ "follow-redirects": "^1.15.2",
22
+ "long": "^3.2.0",
23
+ "protobufjs": "^5.0.1",
24
+ "stream": "0.0.2"
25
+ },
26
+ "devDependencies": {
27
+ "bluebird": "^3.4.1",
28
+ "browserify": "^13.0.1",
29
+ "buffertools": "^2.1.4",
30
+ "chai": "^3.5.0",
31
+ "debug": "^4.3.4",
32
+ "mocha": "*",
33
+ "nock": "^8.0.0",
34
+ "should": ">= 0.0.1"
35
+ }
36
+ }