@nsshunt/stsutils 1.8.4 → 1.9.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/.eslintrc.json +16 -9
- package/babel.config.json +6 -0
- package/oauth2terms.js +1 -1
- package/package.json +12 -5
- package/status.js +3 -1
- package/{stsoptionsbase.js → stsoptionsbase.ts} +5 -16
- package/stsutils.test.js +0 -10
- package/tsconfig.json +16 -0
- package/types/authutilsbrowser.d.ts +12 -0
- package/types/authutilsbrowser.d.ts.map +1 -0
- package/types/errorhandling.d.ts +8 -0
- package/types/errorhandling.d.ts.map +1 -0
- package/types/index.d.ts +13 -0
- package/types/index.d.ts.map +1 -0
- package/types/oauth2terms.d.ts +75 -0
- package/types/oauth2terms.d.ts.map +1 -0
- package/types/sleep.d.ts +3 -0
- package/types/sleep.d.ts.map +1 -0
- package/types/status.d.ts +19 -0
- package/types/status.d.ts.map +1 -0
- package/types/stsoptionsbase.d.ts +6 -0
- package/types/stsoptionsbase.d.ts.map +1 -0
- package/types/stsutils.test.d.ts +1 -0
- package/types/stsutils.test.d.ts.map +1 -0
- package/types/validate.d.ts +3 -0
- package/types/validate.d.ts.map +1 -0
- package/.babelrc +0 -1
package/.eslintrc.json
CHANGED
|
@@ -5,19 +5,26 @@
|
|
|
5
5
|
"node": true,
|
|
6
6
|
"jest": true
|
|
7
7
|
},
|
|
8
|
-
"extends":
|
|
9
|
-
|
|
8
|
+
"extends": [
|
|
9
|
+
"eslint:recommended",
|
|
10
|
+
"plugin:@typescript-eslint/recommended"
|
|
11
|
+
],
|
|
12
|
+
"parser": "@typescript-eslint/parser",
|
|
10
13
|
"parserOptions": {
|
|
11
|
-
"ecmaVersion":
|
|
12
|
-
"sourceType": "module"
|
|
13
|
-
"babelOptions": {
|
|
14
|
-
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-private-methods"]
|
|
15
|
-
}
|
|
14
|
+
"ecmaVersion": "latest",
|
|
15
|
+
"sourceType": "module"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
17
|
+
"plugins": [
|
|
18
|
+
"@typescript-eslint"
|
|
19
|
+
],
|
|
20
|
+
"ignorePatterns": ["temp.js", "**/k6scripts/*.js", "**/public/*", "**/dist/*"],
|
|
18
21
|
"rules": {
|
|
19
22
|
"indent": ["error", "tab"],
|
|
20
23
|
//"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
|
|
21
|
-
"no-mixed-spaces-and-tabs": 0 // disable rule
|
|
24
|
+
"no-mixed-spaces-and-tabs": 0, // disable rule
|
|
25
|
+
"@typescript-eslint/no-var-requires": "warn"
|
|
26
|
+
},
|
|
27
|
+
"globals": {
|
|
28
|
+
"$stsapp": true
|
|
22
29
|
}
|
|
23
30
|
}
|
package/oauth2terms.js
CHANGED
|
@@ -81,7 +81,7 @@ const OIDCAddressClaim = Object.freeze({
|
|
|
81
81
|
const compareParameterTypes = (source1, source2, authParameterTypes) => {
|
|
82
82
|
let errors = [ ];
|
|
83
83
|
authParameterTypes.forEach(authParameterType => {
|
|
84
|
-
if (source1[authParameterType
|
|
84
|
+
if (source1[authParameterType].localeCompare(source2[authParameterType]) !== 0) {
|
|
85
85
|
errors.push({
|
|
86
86
|
[OAuth2ParameterType.ERROR]: OAuth2ParameterErrorType.NOT_EQUAL.description,
|
|
87
87
|
[OAuth2ParameterType.ERROR_DESCRIPTION]: `${OAuth2ParameterErrorType.NOT_EQUAL.description}: Parameter: [${authParameterType}]`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsutils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,16 +22,23 @@
|
|
|
22
22
|
"parser": "@babel/eslint-parser"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/core": "^7.17.
|
|
25
|
+
"@babel/core": "^7.17.9",
|
|
26
26
|
"@babel/eslint-parser": "^7.17.0",
|
|
27
27
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
28
28
|
"@babel/plugin-proposal-private-methods": "^7.16.11",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"@babel/preset-env": "^7.16.11",
|
|
30
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
31
|
+
"@types/jest": "^27.4.1",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
33
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
34
|
+
"eslint": "^8.14.0",
|
|
35
|
+
"jest": "^28.0.2",
|
|
36
|
+
"supertest": "^6.2.2",
|
|
37
|
+
"typescript": "^4.6.3"
|
|
31
38
|
},
|
|
32
39
|
"dependencies": {
|
|
33
40
|
"ajv": "^8.11.0",
|
|
34
|
-
"axios": "^0.
|
|
41
|
+
"axios": "^0.27.2",
|
|
35
42
|
"colors": "^1.4.0",
|
|
36
43
|
"debug": "^4.3.4"
|
|
37
44
|
}
|
package/status.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const { Validate } = require('./validate.js');
|
|
2
2
|
|
|
3
|
-
class STSOptionsBase
|
|
3
|
+
export class STSOptionsBase
|
|
4
4
|
{
|
|
5
|
-
|
|
5
|
+
private _options: any = null;
|
|
6
6
|
|
|
7
|
-
constructor(options = null)
|
|
7
|
+
constructor(options: any = null)
|
|
8
8
|
{
|
|
9
|
-
this
|
|
9
|
+
this._options = options;
|
|
10
10
|
|
|
11
11
|
if (options !== null) {
|
|
12
12
|
if (typeof options.validator === 'undefined') {
|
|
@@ -18,19 +18,8 @@ class STSOptionsBase
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated since version 1.3.24. Use options (lower case o)
|
|
23
|
-
*/
|
|
24
|
-
get Options()
|
|
25
|
-
{
|
|
26
|
-
console.trace("Use of Options Here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<----------------------------------------")
|
|
27
|
-
return this.#options;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
21
|
get options()
|
|
31
22
|
{
|
|
32
|
-
return this
|
|
23
|
+
return this._options;
|
|
33
24
|
}
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
module.exports = STSOptionsBase;
|
package/stsutils.test.js
CHANGED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationDir": "./types",
|
|
12
|
+
"declarationMap": true
|
|
13
|
+
},
|
|
14
|
+
"lib": ["es2015"]
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export = AuthUtilsBrowser;
|
|
2
|
+
declare class AuthUtilsBrowser {
|
|
3
|
+
LoginBrowser: (options: any) => Promise<{
|
|
4
|
+
accessToken: any;
|
|
5
|
+
duration: number;
|
|
6
|
+
}>;
|
|
7
|
+
RefreshAuthTokenBrowser: (options: any) => Promise<{
|
|
8
|
+
accessToken: any;
|
|
9
|
+
duration: number;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=authutilsbrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authutilsbrowser.d.ts","sourceRoot":"","sources":["../authutilsbrowser.js"],"names":[],"mappings":";AAGA;IAEC;;;OAwBE;IAOF;;;OA0BC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorhandling.d.ts","sourceRoot":"","sources":["../errorhandling.js"],"names":[],"mappings":";AAAA;;;;;EASC"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import sleep = require("./sleep.js");
|
|
2
|
+
import status = require("./status.js");
|
|
3
|
+
import STSOptionsBase = require("./stsoptionsbase.js");
|
|
4
|
+
import AuthUtilsBrowser = require("./authutilsbrowser.js");
|
|
5
|
+
import { AddSchema } from "./validate.js";
|
|
6
|
+
import { Validate } from "./validate.js";
|
|
7
|
+
import GetErrorPayload = require("./errorhandling.js");
|
|
8
|
+
import { OAuth2ParameterType } from "./oauth2terms.js";
|
|
9
|
+
import { OIDCStandardClaim } from "./oauth2terms.js";
|
|
10
|
+
import { OIDCAddressClaim } from "./oauth2terms.js";
|
|
11
|
+
import { compareParameterTypes } from "./oauth2terms.js";
|
|
12
|
+
export { sleep, status, STSOptionsBase, AuthUtilsBrowser, AddSchema, Validate, GetErrorPayload, OAuth2ParameterType, OIDCStandardClaim, OIDCAddressClaim, compareParameterTypes };
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const OAuth2ParameterType: Readonly<{
|
|
2
|
+
AUDIENCE: string;
|
|
3
|
+
CLIENT_ID: string;
|
|
4
|
+
CLIENT_SECRET: string;
|
|
5
|
+
RESPONSE_TYPE: string;
|
|
6
|
+
SCOPE: string;
|
|
7
|
+
STATE: string;
|
|
8
|
+
REDIRECT_URI: string;
|
|
9
|
+
ERROR: string;
|
|
10
|
+
ERROR_DESCRIPTION: string;
|
|
11
|
+
ERROR_CODES: string;
|
|
12
|
+
ERROR_URI: string;
|
|
13
|
+
GRANT_TYPE: string;
|
|
14
|
+
CODE: string;
|
|
15
|
+
ACCESS_TOKEN: string;
|
|
16
|
+
TOKEN_TYPE: string;
|
|
17
|
+
EXPIRES_IN: string;
|
|
18
|
+
USERNAME: string;
|
|
19
|
+
PASSWORD: string;
|
|
20
|
+
REFRESH_TOKEN: string;
|
|
21
|
+
RESPONSE_MODE: string;
|
|
22
|
+
TIMESTAMP: string;
|
|
23
|
+
TRACE_ID: string;
|
|
24
|
+
CORRELATION_ID: string;
|
|
25
|
+
}>;
|
|
26
|
+
export const OIDCStandardClaim: Readonly<{
|
|
27
|
+
SUB: string;
|
|
28
|
+
NAME: string;
|
|
29
|
+
GIVEN_NAME: string;
|
|
30
|
+
FAMILY_NAME: string;
|
|
31
|
+
MIDDLE_NAME: string;
|
|
32
|
+
NICKNAME: string;
|
|
33
|
+
PREFERRED_USERNAME: string;
|
|
34
|
+
PROFILE: string;
|
|
35
|
+
PICTURE: string;
|
|
36
|
+
WEBSITE: string;
|
|
37
|
+
EMAIL: string;
|
|
38
|
+
EMAIL_VERIFIED: string;
|
|
39
|
+
GENDER: string;
|
|
40
|
+
BIRTHDATE: string;
|
|
41
|
+
ZONEINFO: string;
|
|
42
|
+
LOCALE: string;
|
|
43
|
+
PHONE_NUMBER: string;
|
|
44
|
+
PHONE_NUMBER_VERIFIED: string;
|
|
45
|
+
ADDRESS: string;
|
|
46
|
+
CLIENT_SECRET: string;
|
|
47
|
+
NONCE: string;
|
|
48
|
+
}>;
|
|
49
|
+
export const OIDCAddressClaim: Readonly<{
|
|
50
|
+
FORMATTED: string;
|
|
51
|
+
STREET_ADDRESS: string;
|
|
52
|
+
LOCALITY: string;
|
|
53
|
+
REGION: string;
|
|
54
|
+
COUNTRY: string;
|
|
55
|
+
}>;
|
|
56
|
+
export const OAuth2ParameterErrorType: Readonly<{
|
|
57
|
+
NOT_EQUAL: {
|
|
58
|
+
code: string;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
NOT_PRESENT: {
|
|
62
|
+
code: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
INVALID_FORMAT: {
|
|
66
|
+
code: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
EXPIRED: {
|
|
70
|
+
code: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
export function compareParameterTypes(source1: any, source2: any, authParameterTypes: any): any[];
|
|
75
|
+
//# sourceMappingURL=oauth2terms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2terms.d.ts","sourceRoot":"","sources":["../oauth2terms.js"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAuBH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AAnDH;;;;;;;;;;;;;;;;;GAiBG;AAoCH,kGAaC"}
|
package/types/sleep.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../sleep.js"],"names":[],"mappings":"AAAA,uDAGC;AAGD,0CAAkC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export namespace successMessage {
|
|
2
|
+
const status: string;
|
|
3
|
+
}
|
|
4
|
+
export namespace errorMessage {
|
|
5
|
+
const status_1: string;
|
|
6
|
+
export { status_1 as status };
|
|
7
|
+
}
|
|
8
|
+
export namespace status {
|
|
9
|
+
const success: number;
|
|
10
|
+
const created: number;
|
|
11
|
+
const nocontent: number;
|
|
12
|
+
const bad: number;
|
|
13
|
+
const unauthorized: number;
|
|
14
|
+
const notfound: number;
|
|
15
|
+
const conflict: number;
|
|
16
|
+
const error: number;
|
|
17
|
+
const serverErrorMalformed: number;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../status.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stsoptionsbase.d.ts","sourceRoot":"","sources":["../stsoptionsbase.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IAE1B,OAAO,CAAC,QAAQ,CAAa;gBAEjB,OAAO,GAAE,GAAU;IAc/B,IAAI,OAAO,QAGV;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=stsutils.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stsutils.test.d.ts","sourceRoot":"","sources":["../stsutils.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../validate.js"],"names":[],"mappings":"AAoBA,0EAMC;AAED,uDAGC"}
|
package/.babelrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ }
|