smartystreets-javascript-sdk 1.12.0 → 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/Makefile +2 -5
- package/package.json +2 -2
- package/src/ClientBuilder.js +3 -1
- package/src/HttpSender.js +1 -1
- package/browserify.js +0 -33
- package/s3.js +0 -39
package/Makefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/make -f
|
|
2
2
|
|
|
3
|
-
VERSION := $(shell tagit -
|
|
3
|
+
VERSION := $(shell tagit -p --dry-run)
|
|
4
4
|
VERSION_FILE1 := package.json
|
|
5
5
|
VERSION_FILE2 := package-lock.json
|
|
6
6
|
|
|
@@ -14,15 +14,12 @@ node_modules:
|
|
|
14
14
|
npm install
|
|
15
15
|
|
|
16
16
|
publish: clean test version upload unversion
|
|
17
|
-
tagit -
|
|
17
|
+
tagit -p
|
|
18
18
|
git push origin --tags
|
|
19
19
|
|
|
20
20
|
upload:
|
|
21
21
|
npm publish
|
|
22
22
|
|
|
23
|
-
upload_s3:
|
|
24
|
-
node browserify.js && node s3.js
|
|
25
|
-
|
|
26
23
|
version:
|
|
27
24
|
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE1)" && rm -f "$(VERSION_FILE1).bak"
|
|
28
25
|
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE2)" && rm -f "$(VERSION_FILE2).bak"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartystreets-javascript-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Quick and easy Smarty address validation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"smarty",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"zlib": "^1.0.5"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"axios
|
|
48
|
+
"axios": "^0.26.1",
|
|
49
49
|
"axios-retry": "3.2.0",
|
|
50
50
|
"promise": "^8.1.0"
|
|
51
51
|
}
|
package/src/ClientBuilder.js
CHANGED
|
@@ -94,14 +94,16 @@ class ClientBuilder {
|
|
|
94
94
|
* Use this to specify a proxy through which to send all lookups.
|
|
95
95
|
* @param host The host of the proxy server (do not include the port).
|
|
96
96
|
* @param port The port on the proxy server to which you wish to connect.
|
|
97
|
+
* @param protocol The protocol on the proxy server to which you wish to connect. If the proxy server uses HTTPS, then you must set the protocol to 'https'.
|
|
97
98
|
* @param username The username to login to the proxy.
|
|
98
99
|
* @param password The password to login to the proxy.
|
|
99
100
|
* @return Returns <b>this</b> to accommodate method chaining.
|
|
100
101
|
*/
|
|
101
|
-
withProxy(host, port, username, password) {
|
|
102
|
+
withProxy(host, port, protocol, username, password) {
|
|
102
103
|
this.proxy = {
|
|
103
104
|
host: host,
|
|
104
105
|
port: port,
|
|
106
|
+
protocol: protocol,
|
|
105
107
|
};
|
|
106
108
|
|
|
107
109
|
if (username && password) {
|
package/src/HttpSender.js
CHANGED
package/browserify.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const distFolder = __dirname + "/dist";
|
|
3
|
-
|
|
4
|
-
fs.mkdir(distFolder, distFolderExists);
|
|
5
|
-
|
|
6
|
-
function distFolderExists(error) {
|
|
7
|
-
if (error) throw error;
|
|
8
|
-
|
|
9
|
-
const filePrefix = "smartystreets-sdk-";
|
|
10
|
-
const version = require("./package.json").version;
|
|
11
|
-
const fileName = distFolder + "/" + filePrefix + version;
|
|
12
|
-
const minifiedFile = fileName + ".min.js";
|
|
13
|
-
const standardFile = fileName + ".js";
|
|
14
|
-
const sdkEntryPoint = "./index.js";
|
|
15
|
-
const standaloneVariableName = "SmartyStreetsSDK";
|
|
16
|
-
const options = {
|
|
17
|
-
standalone: standaloneVariableName,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
let writeToDisk = (destination) => fs.createWriteStream(destination);
|
|
21
|
-
let browserify = require("browserify");
|
|
22
|
-
|
|
23
|
-
browserify(sdkEntryPoint, options)
|
|
24
|
-
.transform("babelify", {presets: ["env"]})
|
|
25
|
-
.bundle()
|
|
26
|
-
.pipe(writeToDisk(standardFile));
|
|
27
|
-
|
|
28
|
-
browserify(sdkEntryPoint, options)
|
|
29
|
-
.transform("babelify", {presets: ["env"]})
|
|
30
|
-
.plugin("tinyify")
|
|
31
|
-
.bundle()
|
|
32
|
-
.pipe(writeToDisk(minifiedFile));
|
|
33
|
-
}
|
package/s3.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const zlib = require("zlib");
|
|
3
|
-
const version = require("./package").version;
|
|
4
|
-
const credentials = {
|
|
5
|
-
accessKeyId: process.env.AWS_ACCESS_KEY,
|
|
6
|
-
secretAccessKey: process.env.AWS_SECRET_KEY,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let AWS = require("aws-sdk");
|
|
10
|
-
AWS.config.update(credentials);
|
|
11
|
-
|
|
12
|
-
const S3Stream = require("s3-upload-stream");
|
|
13
|
-
const fileName = "smartystreets-sdk-" + version;
|
|
14
|
-
const basePath = __dirname + "/dist/";
|
|
15
|
-
|
|
16
|
-
[".js", ".min.js"].map(fileExtension => uploadFileToS3(basePath, fileName + fileExtension));
|
|
17
|
-
|
|
18
|
-
function uploadFileToS3(filePath, fileName) {
|
|
19
|
-
let s3Stream = S3Stream(new AWS.S3());
|
|
20
|
-
let read = fs.createReadStream(filePath + fileName);
|
|
21
|
-
let compress = zlib.createGzip();
|
|
22
|
-
let upload = s3Stream.upload({
|
|
23
|
-
Bucket: "static.smartystreets.com",
|
|
24
|
-
Key: "sdk/" + version + "/" + fileName,
|
|
25
|
-
StorageClass: "STANDARD",
|
|
26
|
-
ContentType: "application/javascript",
|
|
27
|
-
ContentEncoding: "gzip",
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
upload.on("error", e => {
|
|
31
|
-
throw new e
|
|
32
|
-
});
|
|
33
|
-
upload.on("part", console.log);
|
|
34
|
-
upload.on("uploaded", console.log);
|
|
35
|
-
|
|
36
|
-
read
|
|
37
|
-
.pipe(compress)
|
|
38
|
-
.pipe(upload);
|
|
39
|
-
}
|