@sasjs/utils 3.6.5 → 3.6.6
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/.pre-commit-config.yaml +24 -0
- package/auth/auth.js +3 -22
- package/auth/auth.js.map +1 -1
- package/package.json +3 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Hooks for the pre-commit framework - https://pre-commit.com
|
|
2
|
+
#
|
|
3
|
+
# The repo also ships native hooks in .git-hooks/: gitleaks on the staged
|
|
4
|
+
# content before the commit, and the Conventional Commits check on the message.
|
|
5
|
+
# `npm run setup` activates them by setting core.hooksPath - but .npmrc sets
|
|
6
|
+
# ignore-scripts=true, so no install step runs it, and a fresh clone commits
|
|
7
|
+
# unchecked until someone runs it by hand.
|
|
8
|
+
#
|
|
9
|
+
# This file is the standard route instead: install the framework once with
|
|
10
|
+
# `pre-commit install`, and both hooks run on every commit. gitleaks is pinned
|
|
11
|
+
# to an exact release tag, and the message hook calls the script the native
|
|
12
|
+
# hooks already use, so there is one implementation of the rules.
|
|
13
|
+
repos:
|
|
14
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
15
|
+
rev: v8.30.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: gitleaks
|
|
18
|
+
- repo: local
|
|
19
|
+
hooks:
|
|
20
|
+
- id: commit-msg
|
|
21
|
+
name: conventional commit
|
|
22
|
+
entry: .git-hooks/commit-msg
|
|
23
|
+
language: script
|
|
24
|
+
stages: [commit-msg]
|
package/auth/auth.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
3
|
exports.decodeToken = exports.hasTokenExpired = exports.isRefreshTokenExpiring = exports.isAccessTokenExpiring = void 0;
|
|
23
|
-
const jwt_decode_1 =
|
|
4
|
+
const jwt_decode_1 = require("jwt-decode");
|
|
24
5
|
/**
|
|
25
6
|
* Checks if the Access Token is expired or is expiring in 1 hour. A default Access Token
|
|
26
7
|
* lasts 12 hours. If the Access Token expires, the Refresh Token is used to fetch a new
|
|
@@ -68,7 +49,7 @@ exports.hasTokenExpired = hasTokenExpired;
|
|
|
68
49
|
function isTokenExpiring(token, timeToLiveSeconds) {
|
|
69
50
|
let payload;
|
|
70
51
|
try {
|
|
71
|
-
payload = (0, jwt_decode_1.
|
|
52
|
+
payload = (0, jwt_decode_1.jwtDecode)(token);
|
|
72
53
|
}
|
|
73
54
|
catch (err) {
|
|
74
55
|
// Only tolerate undecodable (opaque / non-JWT) tokens - anything else
|
|
@@ -92,7 +73,7 @@ function isTokenExpiring(token, timeToLiveSeconds) {
|
|
|
92
73
|
function decodeToken(token) {
|
|
93
74
|
let payload;
|
|
94
75
|
try {
|
|
95
|
-
payload = (0, jwt_decode_1.
|
|
76
|
+
payload = (0, jwt_decode_1.jwtDecode)(token);
|
|
96
77
|
}
|
|
97
78
|
catch (err) {
|
|
98
79
|
throw new Error('Invalid token supplied.');
|
package/auth/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAGzD;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,KAAc,EACd,iBAAiB,GAAG,IAAI;IAExB,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,eAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;AAClD,CAAC;AARD,sDAQC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,KAAc,EACd,iBAAiB,GAAG,EAAE;IAEtB,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,eAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;AAClD,CAAC;AARD,wDAQC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;AAClC,CAAC;AALD,0CAKC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,iBAAyB;IAC/D,IAAI,OAAyB,CAAA;IAC7B,IAAI;QACF,OAAO,GAAG,IAAA,sBAAS,EAAmB,KAAK,CAAC,CAAA;KAC7C;IAAC,OAAO,GAAG,EAAE;QACZ,sEAAsE;QACtE,uCAAuC;QACvC,IAAI,CAAC,CAAC,GAAG,YAAY,8BAAiB,CAAC;YAAE,MAAM,GAAG,CAAA;QAClD,sDAAsD;QACtD,sEAAsE;QACtE,wEAAwE;QACxE,0DAA0D;QAC1D,OAAO,KAAK,CAAA;KACb;IAED,gEAAgE;IAChE,uEAAuE;IACvE,qBAAqB;IACrB,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAErC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAA;IAE5D,OAAO,UAAU,IAAI,iBAAiB,CAAA;AACxC,CAAC;AAED,SAAgB,WAAW,CAAC,KAAa;IACvC,IAAI,OAAqB,CAAA;IACzB,IAAI;QACF,OAAO,GAAG,IAAA,sBAAS,EAAC,KAAK,CAAC,CAAA;KAC3B;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;KAC3C;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AATD,kCASC"}
|
package/package.json
CHANGED
|
@@ -63,21 +63,20 @@
|
|
|
63
63
|
"jest-extended": "3.2.4",
|
|
64
64
|
"semantic-release": "25.0.9",
|
|
65
65
|
"ts-jest": "29.4.14",
|
|
66
|
-
"ts-loader": "9.6.2",
|
|
67
66
|
"ts-node": "10.9.2",
|
|
68
67
|
"typescript": "4.5.4",
|
|
69
68
|
"@nogoo9/gitleaks": "8.30.1-post.2"
|
|
70
69
|
},
|
|
71
70
|
"dependencies": {
|
|
72
|
-
"@fast-csv/format": "
|
|
71
|
+
"@fast-csv/format": "5.0.7",
|
|
73
72
|
"@types/fs-extra": "11.0.4",
|
|
74
73
|
"@types/prompts": "2.4.9",
|
|
75
74
|
"chalk": "4.1.1",
|
|
76
75
|
"cli-table": "0.3.11",
|
|
77
76
|
"consola": "3.4.2",
|
|
78
77
|
"fs-extra": "11.4.1",
|
|
79
|
-
"jwt-decode": "
|
|
78
|
+
"jwt-decode": "4.0.0",
|
|
80
79
|
"prompts": "2.4.2"
|
|
81
80
|
},
|
|
82
|
-
"version": "3.6.
|
|
81
|
+
"version": "3.6.6"
|
|
83
82
|
}
|