@voiceflow/api-sdk 3.0.1 → 3.0.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/build/resources/user.js
CHANGED
|
@@ -4,12 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseJWT = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
8
|
+
const decodeJWT = (token) => {
|
|
9
|
+
try {
|
|
10
|
+
return jwt_decode_1.default(token);
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
8
16
|
const parseJWT = (token) => {
|
|
9
|
-
let user =
|
|
17
|
+
let user = decodeJWT(token.substring(16));
|
|
10
18
|
// try again without assuming the userHash is there
|
|
11
19
|
if (!user) {
|
|
12
|
-
user =
|
|
20
|
+
user = decodeJWT(token);
|
|
13
21
|
}
|
|
14
22
|
if (!user) {
|
|
15
23
|
throw new RangeError('Invalid JWT');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/resources/user.ts"],"names":[],"mappings":";;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/resources/user.ts"],"names":[],"mappings":";;;;;;AACA,4DAAmC;AAEnC,MAAM,SAAS,GAAG,CAAI,KAAa,EAAY,EAAE;IAC/C,IAAI;QACF,OAAO,oBAAS,CAAC,KAAK,CAAM,CAAC;KAC9B;IAAC,WAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAEK,MAAM,QAAQ,GAAG,CAAI,KAAa,EAAK,EAAE;IAC9C,IAAI,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,mDAAmD;IACnD,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;KACzB;IACD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;KACrC;IACD,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB;AASF,MAAM,IAAI;IAOR,YAAY,aAAqB;QAN1B,cAAS,GAAqB,CAAC,CAAC;QAEhC,SAAI,GAAG,EAAE,CAAC;QAEV,UAAK,GAAG,EAAE,CAAC;QAGhB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YACjC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAQ,CAAY,aAAa,CAAC,CAAC;YAE/D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;IAED,kDAAkD;IAClD,QAAQ,CAAC,aAAqB;QAC5B,OAAO,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AAED,kBAAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/api-sdk",
|
|
3
3
|
"description": "wrapper for creator-api",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"author": "Voiceflow",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/voiceflow/libs/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@types/jsonwebtoken": "^8.5.0",
|
|
11
10
|
"@voiceflow/base-types": "^2.1.0",
|
|
12
11
|
"@voiceflow/common": "6.9.3",
|
|
13
12
|
"axios": "^0.21.1",
|
|
14
|
-
"
|
|
13
|
+
"jwt-decode": "^3.1.2",
|
|
15
14
|
"superstruct": "^0.10.12"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
|
19
18
|
"@types/chai": "^4.2.11",
|
|
19
|
+
"@types/jsonwebtoken": "^8.5.0",
|
|
20
20
|
"@types/mocha": "^8.0.0",
|
|
21
21
|
"@types/sinon": "^10.0.0",
|
|
22
22
|
"chai": "^4.2.0",
|
|
23
|
+
"jsonwebtoken": "^8.5.1",
|
|
23
24
|
"mocha": "^8.0.1",
|
|
24
25
|
"nyc": "^15.1.0",
|
|
25
26
|
"sinon": "^10.0.0",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"test:unit": "NODE_ENV=test nyc --report-dir=nyc_coverage_unit ts-mocha --paths --config ./config/tests/.mocharc.json 'tests/**/*.unit.ts'"
|
|
58
59
|
},
|
|
59
60
|
"types": "build/index.d.ts",
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "8c388368280c7f936d5ceb72a1891b95ef76cb19"
|
|
61
62
|
}
|