random-transactions-sdk 0.3.0 → 1.0.1

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,74 +1,17 @@
1
1
  {
2
2
  "name": "random-transactions-sdk",
3
- "version": "0.3.0",
4
- "description": "An streaming XHR abstraction that works in browsers and node.js",
3
+ "version": "1.0.1",
4
+ "description": "Used to generate random transactions data",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
8
- "wd": "node test/index.js --wd",
9
- "test": "node test/index.js",
10
- "static": "node test/static.js",
11
- "node": "mocha test/requests.test.js",
12
- "watch": "mocha --watch ./test/requests.test.js",
13
- "all": "npm run test && npm run node",
14
- "coverage": "istanbul cover ./node_modules/.bin/_mocha -- test/requests.test.js",
15
- "test-node": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- test/requests.test.js",
16
- "compile": "mkdir -p dist && browserify browser.js -o dist/requests.js --standalone Requests",
17
- "pre-publish": "npm run compile",
18
- "start": "node test/development.js"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/unshiftio/requests"
23
- },
24
- "keywords": [
25
- "request",
26
- "xhr",
27
- "requests",
28
- "http",
29
- "xml",
30
- "xmlhttp",
31
- "xmlhttprequest"
32
- ],
33
- "author": "Arnout Kazemier",
34
- "license": "MIT",
35
- "bugs": {
36
- "url": "https://github.com/unshiftio/requests/issues"
37
- },
38
- "homepage": "https://github.com/unshiftio/requests",
39
6
  "dependencies": {
40
- "axo": "0.0.x",
41
- "eventemitter3": "~4.0.0",
42
- "extendible": "0.1.x",
43
- "hang": "1.0.x",
44
- "loads": "0.0.x",
45
- "node-http-xhr": "~1.3.0",
46
- "xhr-send": "1.0.x"
7
+ "python-shell": "^1.0.8",
8
+ "base-64": "^1.0.0",
9
+ "axios": "^1.6.0"
47
10
  },
48
- "devDependencies": {
49
- "argh": "0.1.x",
50
- "assume": "~2.0.0",
51
- "async-each": "~1.0.1",
52
- "browserify": "^16.0.0",
53
- "http-proxy": "~1.17.0",
54
- "istanbul": "~0.4.5",
55
- "mocha": "~3.5.0",
56
- "mochify": "~2.18.1",
57
- "pre-commit": "~1.2.0",
58
- "setheader": "~1.0.0"
11
+ "scripts": {
12
+ "test": "echo \"Error: no test specified\" && exit 1"
59
13
  },
60
- "testling": {
61
- "files": "test/*.browser.js",
62
- "harness": "mocha-bdd",
63
- "browsers": [
64
- "ie/6..latest",
65
- "chrome/22..latest",
66
- "firefox/16..latest",
67
- "safari/latest",
68
- "opera/11.0..latest",
69
- "iphone/latest",
70
- "ipad/latest",
71
- "android-browser/latest"
72
- ]
73
- }
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC"
74
17
  }
package/.min-wd DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "hostname": "localhost",
3
- "port": 4444,
4
- "browsers": [{
5
- "name": "firefox",
6
- "url": "http://localhost:8080/test"
7
- }, {
8
- "name": "phantomjs",
9
- "url": "http://localhost:8080/test"
10
- }]
11
- }
package/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- sudo: false
2
- language: node_js
3
- matrix:
4
- fast_finish: true
5
- include:
6
- - node_js: "4"
7
- env: TASK=test-node
8
- - node_js: "3"
9
- env: TASK=test-node
10
- - node_js: "2"
11
- env: TASK=test-node
12
- - node_js: "1"
13
- env: TASK=test-node
14
- - node_js: "0.12"
15
- env: TASK=test-node
16
- - node_js: "0.10"
17
- env: TASK=test-node
18
- script:
19
- - "npm run ${TASK}"
20
- after_script:
21
- - 'if [ "${TASK}" == "test-node" ]; then npm i coveralls@2 && cat coverage/lcov.info | coveralls; fi'
22
- notifications:
23
- irc:
24
- channels:
25
- - "irc.freenode.org#unshift"
26
- on_success: change
27
- on_failure: change
package/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
package/requested.js DELETED
@@ -1,110 +0,0 @@
1
- 'use strict';
2
-
3
- var EventEmitter = require('eventemitter3');
4
-
5
- function Requested(url, options) {
6
- EventEmitter.call(this);
7
-
8
- //
9
- // All properties/options that should be introduced on the prototype.
10
- //
11
- this.merge(this, Requested.defaults, options || {});
12
-
13
- //
14
- // Private properties that should not be overridden by developers.
15
- //
16
- this.id = ++Requested.requested;
17
-
18
- //
19
- // We want to implement a stream like interface on top of this module so it
20
- // can be used to read streaming data in node as well as through browserify.
21
- //
22
- this.readable = true;
23
- this.writable = false;
24
-
25
- if (this.initialize) this.initialize(url);
26
- if (!this.manual && this.open) this.open(url);
27
- }
28
-
29
- Requested.extend = require('extendible');
30
- Requested.prototype = new EventEmitter();
31
- Requested.prototype.constructor = Requested;
32
-
33
-
34
- /**
35
- * Accurate type discovery.
36
- *
37
- * @param {Mixed} what What ever needs to be figured out.
38
- * @returns {String} Name of the type.
39
- * @api private
40
- */
41
- Requested.prototype.typeof = function type(what) {
42
- return Object.prototype.toString.call(what).slice(8, -1).toLowerCase();
43
- };
44
-
45
- /**
46
- * Deeply assign and merge objects together.
47
- *
48
- * @param {Object} target The target object that should receive the merged data.
49
- * @returns {Object} The merged target object.
50
- * @api private
51
- */
52
- Requested.prototype.merge = function merge(target) {
53
- var i = 1
54
- , arg, key;
55
-
56
- for (; i < arguments.length; i++) {
57
- arg = arguments[i];
58
-
59
- for (key in arg) {
60
- if (!Object.prototype.hasOwnProperty.call(arg, key)) continue;
61
-
62
- if ('object' === this.typeof(arg[key])) {
63
- target[key] = this.merge('object' === this.typeof(target[key]) ? target[key] : {}, arg[key]);
64
- } else {
65
- target[key] = arg[key];
66
- }
67
- }
68
- }
69
-
70
- return target;
71
- };
72
-
73
- /**
74
- * The defaults for the Requests. These values will be used if no options object
75
- * or matching key is provided. It can be override globally if needed but this
76
- * is not advised as it can have some potential side affects for other libraries
77
- * that use this module.
78
- *
79
- * @type {Object}
80
- * @public
81
- */
82
- Requested.defaults = {
83
- streaming: false,
84
- manual: false,
85
- method: 'GET',
86
- mode: 'cors',
87
- headers: {
88
- //
89
- // We're forcing text/plain mode by default to ensure that regular
90
- // requests can benefit from CORS requests without an OPTIONS request. It's
91
- // shared between server and client implementations to ensure that requests
92
- // are handled in exactly the same way.
93
- //
94
- 'Content-Type': 'text/plain'
95
- }
96
- };
97
-
98
- /**
99
- * Unique id and also an indication on how many XHR requests we've made using
100
- * this library.
101
- *
102
- * @type {Number}
103
- * @private
104
- */
105
- Requested.requested = 0;
106
-
107
- //
108
- // Expose the module interface.
109
- //
110
- module.exports = Requested;
@@ -1,59 +0,0 @@
1
- 'use strict';
2
-
3
- var browserify = require('browserify')
4
- , path = require('path')
5
- , fs = require('fs');
6
-
7
- require('http').createServer(function statical(req, res) {
8
- res.statusCode = 200;
9
- res.setHeader('Content-Type', 'text/html');
10
-
11
- switch (req.url) {
12
- case '/':
13
- req.url = '/index.html';
14
- break;
15
-
16
- case '/dist/requests.js':
17
- var compiler
18
- , stream;
19
-
20
- res.setHeader('Content-Type', 'text/javascript');
21
-
22
- compiler = browserify({ debug: true, standalone: 'Requests' });
23
- compiler.add(path.join(__dirname, '..', 'browser.js'));
24
-
25
- stream = compiler.bundle();
26
-
27
- stream.pipe(res);
28
- stream.pipe(fs.createWriteStream(path.join(__dirname, '..', req.url)));
29
- return;
30
-
31
- case '/stream':
32
- res.write('[first chunk]');
33
- setTimeout(function () {
34
- res.write('[second chunk]');
35
-
36
- setTimeout(function () {
37
- res.end('[final chunk]');
38
- }, 10000);
39
- }, 100);
40
- return;
41
- }
42
-
43
- if (!fs.existsSync(__dirname + req.url)) {
44
- res.write('<script src="/dist/requests.js"></script>');
45
- return res.end('Nope, doesn\'t exist.');
46
- }
47
-
48
- require('fs').createReadStream(__dirname + req.url).pipe(res);
49
- }).on('connection', function connection(socket) {
50
- //
51
- // Force buffer flusing when we call our write.
52
- //
53
- socket.setNoDelay(true);
54
- }).listen(+process.argv[2] || 8080, function listening() {
55
- console.log('Development server is now running on:');
56
- console.log('');
57
- console.log(' http://localhost:'+ this.address().port);
58
- console.log('');
59
- });
package/test/index.html DELETED
@@ -1,26 +0,0 @@
1
- <div id="output">
2
- <h2>Progress log</h2>
3
- </div>
4
-
5
- <script src="/dist/requests.js"></script>
6
- <script>
7
- /**
8
- * Poor mans cross browser logger.
9
- *
10
- * @param {String} line The message that needs to be logged
11
- * @api private
12
- */
13
- function log(line) {
14
- document.getElementById('output').innerHTML += line +'<br />';
15
- }
16
-
17
- var r = new Requests('/stream', { streaming: true });
18
-
19
- r.on('data', function (data) {
20
- log('<strong>received chunk:</strong> <code>'+ data +'</code>');
21
- });
22
-
23
- r.on('end', function () {
24
- log('<strong>request has ended</strong>');
25
- });
26
- </script>
package/test/index.js DELETED
@@ -1,107 +0,0 @@
1
- 'use strict';
2
-
3
- var path = require('path')
4
- , Mocha = require('mocha')
5
- , argv = require('argh').argv
6
- , mochify = require('mochify');
7
-
8
- argv.reporter = argv.reporter || 'spec';
9
- argv.ui = argv.ui || 'bdd';
10
- argv.wd = argv.wd || false;
11
-
12
- /**
13
- * Poor mans kill switch. Kills all active hooks.
14
- *
15
- * @api private
16
- */
17
- function kill() {
18
- require('async-each')(kill.hooks, function each(fn, next) {
19
- fn(next);
20
- }, function done(err) {
21
- if (err) return process.exit(1);
22
-
23
- process.exit(0);
24
- });
25
- }
26
-
27
- /**
28
- * All the hooks that need destruction.
29
- *
30
- * @type {Array}
31
- * @private
32
- */
33
- kill.hooks = [];
34
-
35
- //
36
- // This is the magical test runner that setup's all the things and runs various
37
- // of test suites until something starts failing.
38
- //
39
- (function runner(steps) {
40
- if (!steps.length) return kill(), runner;
41
-
42
- var step = steps.shift();
43
-
44
- step(function unregister(fn) {
45
- kill.hooks.push(fn);
46
- }, function register(err) {
47
- if (err) throw err;
48
-
49
- runner(steps);
50
- });
51
-
52
- return runner;
53
- })([
54
- //
55
- // Run the normal node tests.
56
- //
57
- function creamy(kill, next) {
58
- var mocha = new Mocha();
59
-
60
- mocha.reporter(argv.reporter);
61
- mocha.ui(argv.ui);
62
-
63
- //
64
- // The next bulk of logic is required to correctly glob and lookup all the
65
- // files required for testing.
66
- //
67
- mocha.files = [
68
- './test/*.test.js'
69
- ].map(function lookup(glob) {
70
- return Mocha.utils.lookupFiles(glob, ['js']);
71
- }).reduce(function flatten(arr, what) {
72
- Array.prototype.push.apply(arr, what);
73
- return arr;
74
- }, []).map(function resolve(file) {
75
- return path.resolve(file);
76
- });
77
-
78
- //
79
- // Run the mocha test suite inside this node process with a custom callback
80
- // so we don't accidentally exit the process and forget to run the test of the
81
- // tests.
82
- //
83
- mocha.run(function ran(err) {
84
- if (err) err = new Error('Something failed in the mocha test suite');
85
- next(err);
86
- });
87
- },
88
-
89
- //
90
- // Start-up a small static file server so we can download files and fixtures
91
- // inside our PhantomJS test.
92
- //
93
- require('./static'),
94
-
95
- //
96
- // Run the PhantomJS tests now that we have a small static server setup.
97
- //
98
- function phantomjs(kill, next) {
99
- mochify('./test/*.browser.js', {
100
- reporter: argv.reporter,
101
- cover: argv.cover,
102
- wd: argv.wd,
103
- ui: argv.ui
104
- })
105
- .bundle(next);
106
- }
107
- ]);