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.
- package/HOWTO-PUBLISH.txt +15 -0
- package/README.md +21 -0
- package/apis/edit-2016-06-02.json +15 -0
- package/apis/metadata.json +31 -0
- package/apis/project-2016-06-01.json +56 -0
- package/apis/project-2016-06-02.json +767 -0
- package/apis/project-2023-03-07.json +767 -0
- package/apis/project-2023-12-11.json +767 -0
- package/apis/render-2016-06-02.json +764 -0
- package/apis/render-2023-12-11.json +764 -0
- package/dist/fx-sdk-latest.js +22494 -0
- package/dist-tools/build-browser.js +109 -0
- package/dist-tools/build-sdk.sh +6 -0
- package/dist-tools/es6-promise.js +957 -0
- package/dist-tools/foo.sh +4 -0
- package/dist-tools/publish.sh +6 -0
- package/lib/browser.js +58 -0
- package/lib/config.js +125 -0
- package/lib/core.js +15 -0
- package/lib/credentials/chain.js +54 -0
- package/lib/credentials/environment.js +69 -0
- package/lib/credentials/inifile.js +57 -0
- package/lib/credentials/token.js +38 -0
- package/lib/credentials.js +53 -0
- package/lib/encoding.js +36 -0
- package/lib/endpoint.js +18 -0
- package/lib/fx.js +50 -0
- package/lib/http/node.js +69 -0
- package/lib/http/xhr.js +12 -0
- package/lib/http.js +57 -0
- package/lib/proto.js +38 -0
- package/lib/protocol.js +56 -0
- package/lib/request.js +252 -0
- package/lib/response.js +24 -0
- package/lib/service.js +182 -0
- package/lib/services/batch.js +5 -0
- package/lib/services/edit.js +9 -0
- package/lib/services/project.js +102 -0
- package/lib/services/render.js +63 -0
- package/lib/services/story.js +5 -0
- package/lib/services.js +30 -0
- package/lib/util.js +126 -0
- package/package.json +37 -0
- package/package.json.save +36 -0
- package/proto/Movie.proto +4081 -0
- package/proto/fx.proto +43 -0
- package/templates/config.html +91 -0
- package/templates/examples.html +69 -0
- package/templates/getstarted.html +30 -0
- package/templates/index.html +6 -0
- package/templates/makeexample.py +57 -0
- package/templates/makerequests.html +210 -0
- package/templates/operation.html +36 -0
- package/templates/service.html +9 -0
- package/templates/services.html +19 -0
- package/templates/version.html +12 -0
- package/templates/versions.html +10 -0
- package/templates/workservice.html +68 -0
- package/test/circles.mp4 +0 -0
- package/test/config.js +131 -0
- package/test/index.html +35 -0
- package/test/mocha.opts +4 -0
- package/test/project.js +148 -0
- package/test/render.js +136 -0
- package/test/retry.js +53 -0
- package/test/sdktests.js +62 -0
- package/test/sdl.js +125 -0
- package/test/servertest/simple.js +20 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
var util = require('util');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var Transform = require('stream').Transform;
|
|
7
|
+
|
|
8
|
+
var FX = require('../lib/core');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var apiRoot = path.join(__dirname, '..', "..", 'common', 'apis');
|
|
12
|
+
FX.serviceMap = require(path.join(apiRoot, 'metadata.json'));
|
|
13
|
+
|
|
14
|
+
function defineServiceHeader(service, domain, versions){
|
|
15
|
+
var code = util.format(
|
|
16
|
+
'FX.apiLoader.services[\'%s\'] = {};\n' +
|
|
17
|
+
'FX.%s = FX.Service.defineService(\'%s\', %s);\n',
|
|
18
|
+
service, domain, service, versions);
|
|
19
|
+
|
|
20
|
+
var svcPath = path.join(__dirname, '..', 'lib', 'services', service + '.js');
|
|
21
|
+
if(fs.existsSync(svcPath)) {
|
|
22
|
+
code += 'require(\'./services/' + service + '\');\n';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return code
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function defineService(service, version){
|
|
29
|
+
var api = require(FX.Service.serviceFile(service, version));
|
|
30
|
+
|
|
31
|
+
var line = util.format(
|
|
32
|
+
'FX.apiLoader.services[\'%s\'][\'%s\'] = %s;',
|
|
33
|
+
service, version, JSON.stringify(api));
|
|
34
|
+
|
|
35
|
+
return line;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function transform(file) {
|
|
39
|
+
var stream = new Transform();
|
|
40
|
+
stream._transform = function(data, encoding, callback) {
|
|
41
|
+
callback(null, data);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (file.match(/[\/\\]lib[\/\\]browser\.js$/)) {
|
|
45
|
+
|
|
46
|
+
svcCode = "require('bytebuffer');\n"
|
|
47
|
+
FX.util.each(FX.serviceMap, function(svc, value){
|
|
48
|
+
if(value.enabled) {
|
|
49
|
+
svcCode += defineServiceHeader(svc, value.domain, util.inspect(value.versions))
|
|
50
|
+
|
|
51
|
+
FX.util.each(value.versions, function(_ign, version){
|
|
52
|
+
svcCode += defineService(svc, version)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
stream._flush = function(callback) { stream.push(svcCode); callback(); };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return stream;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function build(options, callback) {
|
|
66
|
+
if (arguments.length === 1) {
|
|
67
|
+
callback = options;
|
|
68
|
+
options = {};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var browserify = require('browserify');
|
|
72
|
+
var brOpts = { basedir: path.resolve(__dirname, '..') };
|
|
73
|
+
var b = browserify(brOpts)
|
|
74
|
+
|
|
75
|
+
b.transform(transform)
|
|
76
|
+
b.add('./lib/browser.js')
|
|
77
|
+
b.bundle(function(err, data) {
|
|
78
|
+
if (err)
|
|
79
|
+
return callback(err);
|
|
80
|
+
|
|
81
|
+
var code = (data || '').toString();
|
|
82
|
+
|
|
83
|
+
if (code.indexOf("$$$") != -1) {
|
|
84
|
+
// if (options.minify)
|
|
85
|
+
// code = minify(code);
|
|
86
|
+
// else
|
|
87
|
+
// code = stripComments(code);
|
|
88
|
+
// code = license + code;
|
|
89
|
+
callback(null, code);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (require.main === module) {
|
|
95
|
+
var opts = {
|
|
96
|
+
services: process.argv[2] || process.env.SERVICES,
|
|
97
|
+
minify: process.env.MINIFY ? true : false
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
build(opts, function(err, code) {
|
|
101
|
+
if (err)
|
|
102
|
+
console.error(err.message);
|
|
103
|
+
else
|
|
104
|
+
console.log(code);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
module.exports = build;
|