From 6f4b1447e54baa3642aacb181c7bb92b25ebe14e Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 09:46:40 -0700 Subject: [PATCH 1/6] rename package for testing --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5573251..334e6a0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { - "name": "@pipedreamhq/platform", - "version": "0.2.2", + "name": "@jsendo/platform", + "version": "0.2.3", "description": "Pipedream platform globals (typing and runtime type checking)", - "homepage": "https://pipedream.com", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { From 5131c475912e86e2e85d4bb1b296ef81e003f129 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 10:21:09 -0700 Subject: [PATCH 2/6] . --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 334e6a0..9710d97 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/PipedreamHQ/platform.git" + "url": "https://github.com/jsendo/platform.git" }, "dependencies": { "axios": "^0.19.0", From da78c7427993e560a8670c53b91dd701eb765033 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 10:23:49 -0700 Subject: [PATCH 3/6] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9710d97..eadc2e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jsendo/platform", - "version": "0.2.3", + "version": "0.2.4", "description": "Pipedream platform globals (typing and runtime type checking)", "main": "dist/index.js", "types": "dist/index.d.ts", From d482e368aa0b78caa44ac26647750e07668430e6 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 11:04:40 -0700 Subject: [PATCH 4/6] verson bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eadc2e8..3c9b8bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jsendo/platform", - "version": "0.2.4", + "version": "0.2.4.1", "description": "Pipedream platform globals (typing and runtime type checking)", "main": "dist/index.js", "types": "dist/index.d.ts", From a7ea5e5293e7832291905fc9cd4c3877b03c3ba7 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 11:06:08 -0700 Subject: [PATCH 5/6] version bump again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3c9b8bc..b821337 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jsendo/platform", - "version": "0.2.4.1", + "version": "0.2.5", "description": "Pipedream platform globals (typing and runtime type checking)", "main": "dist/index.js", "types": "dist/index.d.ts", From 88ae304a01520dd98a6067daa65acc67f557fd45 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 29 Oct 2019 11:11:37 -0700 Subject: [PATCH 6/6] version bump again and actually build... --- dist/axios.d.ts | 2 +- dist/axios.js | 26 +++++++++++++++++++++++++- package-lock.json | 45 ++++++++++++++++++++++++++++++++------------- package.json | 2 +- 4 files changed, 59 insertions(+), 16 deletions(-) diff --git a/dist/axios.d.ts b/dist/axios.d.ts index 3665ccf..f6e011c 100644 --- a/dist/axios.d.ts +++ b/dist/axios.d.ts @@ -1 +1 @@ -export default function (step: any, config: any): Promise; +export default function (step: any, config: any, signConfig?: any): Promise; diff --git a/dist/axios.js b/dist/axios.js index 53d8ce8..fe3ec62 100644 --- a/dist/axios.js +++ b/dist/axios.js @@ -28,8 +28,32 @@ export default async function(step: any, config) { } } */ -async function default_1(step, config) { +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI +// see non-escaped chars +// this handles not encoding [!'()*] +function encodeReservedChars(str) { + return str.replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16); + }); +} +async function default_1(step, config, signConfig) { // XXX warn about mutating config object... or clone? + // OAuth1 request + if (signConfig) { + const { oauthSignerUri, token } = signConfig; + // this handles encoding query string to make sure we match what we sign + const url = new URL(config.url); + url.search = encodeReservedChars(url.search.substr(1)); + config.url = url.toString(); + const payload = { + requestData: config, + token, + }; + const oauthSignature = (await axios_1.default.post(oauthSignerUri, payload)).data; + if (!config.headers) + config.headers = {}; + config.headers.Authorization = oauthSignature; + } for (const k in config.headers || {}) { if (typeof config.headers[k] === "undefined") { delete config.headers[k]; diff --git a/package-lock.json b/package-lock.json index 6a42055..b1df334 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "@pipedreamhq/platform", - "version": "0.2.2", + "name": "@jsendo/platform", + "version": "0.2.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2346,7 +2346,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2367,12 +2368,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2387,17 +2390,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2514,7 +2520,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -2526,6 +2533,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2540,6 +2548,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2547,12 +2556,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -2571,6 +2582,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -2651,7 +2663,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -2663,6 +2676,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -2748,7 +2762,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -2784,6 +2799,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2803,6 +2819,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2846,12 +2863,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/package.json b/package.json index b821337..1f6ca2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jsendo/platform", - "version": "0.2.5", + "version": "0.2.6", "description": "Pipedream platform globals (typing and runtime type checking)", "main": "dist/index.js", "types": "dist/index.d.ts",