@nsshunt/stsutils 1.8.6 → 1.9.3

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 CHANGED
@@ -5,19 +5,26 @@
5
5
  "node": true,
6
6
  "jest": true
7
7
  },
8
- "extends": "eslint:recommended",
9
- "parser": "@babel/eslint-parser",
8
+ "extends": [
9
+ "eslint:recommended",
10
+ "plugin:@typescript-eslint/recommended"
11
+ ],
12
+ "parser": "@typescript-eslint/parser",
10
13
  "parserOptions": {
11
- "ecmaVersion": 12,
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
- "ignorePatterns": ["temp.js", "**/k6scripts/*.js", "**/public/*"],
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
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [
3
+ ["@babel/preset-env", {"targets": {"node": "current"}}],
4
+ "@babel/preset-typescript"
5
+ ]
6
+ }
package/index.ts ADDED
@@ -0,0 +1,24 @@
1
+ const sleep = require('./sleep.js');
2
+ const AuthUtilsBrowser = require('./authutilsbrowser.js');
3
+ const { AddSchema, Validate } = require('./validate.js');
4
+ const GetErrorPayload = require('./errorhandling.js');
5
+ const { OAuth2ParameterType, OIDCStandardClaim, OIDCAddressClaim, compareParameterTypes } = require('./oauth2terms.js');
6
+
7
+ export declare class status {
8
+ static readonly SUCCESS = 200;
9
+ static readonly CREATED = 201;
10
+ static readonly NO_CONTENT = 204;
11
+ static readonly BAD = 400;
12
+ static readonly UNAUTHORIZED = 401;
13
+ static readonly NOTFOUND = 404;
14
+ static readonly CONFLICT = 409;
15
+ static readonly ERROR = 500;
16
+ static readonly SERVER_ERROR_MALFORMED = 520;
17
+ }
18
+
19
+ import { STSOptionsBase } from './stsoptionsbase.js'
20
+
21
+ module.exports = {
22
+ sleep, STSOptionsBase, AuthUtilsBrowser, AddSchema, Validate, GetErrorPayload,
23
+ OAuth2ParameterType, OIDCStandardClaim, OIDCAddressClaim, compareParameterTypes
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsutils",
3
- "version": "1.8.6",
3
+ "version": "1.9.3",
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.8",
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
- "eslint": "^8.11.0",
30
- "jest": "^27.5.1"
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.26.1",
41
+ "axios": "^0.27.2",
35
42
  "colors": "^1.4.0",
36
43
  "debug": "^4.3.4"
37
44
  }
@@ -1,12 +1,12 @@
1
1
  const { Validate } = require('./validate.js');
2
2
 
3
- class STSOptionsBase
3
+ export class STSOptionsBase
4
4
  {
5
- #options = null;
5
+ private _options: any = null;
6
6
 
7
- constructor(options = null)
7
+ constructor(options: any = null)
8
8
  {
9
- this.#options = options;
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.#options;
23
+ return this._options;
33
24
  }
34
25
  }
35
-
36
- module.exports = STSOptionsBase;
package/stsutils.test.js CHANGED
@@ -1,16 +1,6 @@
1
1
 
2
2
  describe("Test Latency Controller", () =>
3
3
  {
4
- beforeAll(async () =>
5
- {
6
-
7
- });
8
-
9
- afterAll(async () =>
10
- {
11
-
12
- });
13
-
14
4
  test('Testing Module', async () =>
15
5
  {
16
6
  expect.assertions(1);
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,8 @@
1
+ export = GetErrorPayload;
2
+ declare function GetErrorPayload(errorCode: any, details?: any): {
3
+ error: any;
4
+ error_description: any;
5
+ timestamp: number;
6
+ details: any;
7
+ };
8
+ //# sourceMappingURL=errorhandling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorhandling.d.ts","sourceRoot":"","sources":["../errorhandling.js"],"names":[],"mappings":";AAAA;;;;;EASC"}
@@ -0,0 +1,12 @@
1
+ export declare class status {
2
+ static readonly SUCCESS = 200;
3
+ static readonly CREATED = 201;
4
+ static readonly NO_CONTENT = 204;
5
+ static readonly BAD = 400;
6
+ static readonly UNAUTHORIZED = 401;
7
+ static readonly NOTFOUND = 404;
8
+ static readonly CONFLICT = 409;
9
+ static readonly ERROR = 500;
10
+ static readonly SERVER_ERROR_MALFORMED = 520;
11
+ }
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,MAAM;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,OAAO;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,OAAO;IAC9B,MAAM,CAAC,QAAQ,CAAC,UAAU,OAAO;IACjC,MAAM,CAAC,QAAQ,CAAC,GAAG,OAAO;IAC1B,MAAM,CAAC,QAAQ,CAAC,YAAY,OAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,QAAQ,OAAO;IAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,OAAO;IAC/B,MAAM,CAAC,QAAQ,CAAC,KAAK,OAAO;IAC5B,MAAM,CAAC,QAAQ,CAAC,sBAAsB,OAAO;CAC7C"}
@@ -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"}
@@ -0,0 +1,3 @@
1
+ export function sleep(milliseconds: any): Promise<any>;
2
+ export function jestsleep(): Promise<any>;
3
+ //# sourceMappingURL=sleep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../sleep.js"],"names":[],"mappings":"AAAA,uDAGC;AAGD,0CAAkC"}
@@ -0,0 +1,6 @@
1
+ export declare class STSOptionsBase {
2
+ private _options;
3
+ constructor(options?: any);
4
+ get options(): any;
5
+ }
6
+ //# sourceMappingURL=stsoptionsbase.d.ts.map
@@ -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,3 @@
1
+ export function AddSchema(name: any, schema: any): (payload: any) => void;
2
+ export function Validate(name: any, payload: any): any;
3
+ //# sourceMappingURL=validate.d.ts.map
@@ -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
- { }
package/index.js DELETED
@@ -1,12 +0,0 @@
1
- let sleep = require('./sleep.js');
2
- let status = require('./status.js');
3
- const AuthUtilsBrowser = require('./authutilsbrowser.js');
4
- const STSOptionsBase = require('./stsoptionsbase.js');
5
- const { AddSchema, Validate } = require('./validate.js');
6
- const GetErrorPayload = require('./errorhandling.js');
7
- const { OAuth2ParameterType, OIDCStandardClaim, OIDCAddressClaim, compareParameterTypes } = require('./oauth2terms.js');
8
-
9
- module.exports = {
10
- sleep, status, STSOptionsBase, AuthUtilsBrowser, AddSchema, Validate, GetErrorPayload,
11
- OAuth2ParameterType, OIDCStandardClaim, OIDCAddressClaim, compareParameterTypes
12
- };
package/status.js DELETED
@@ -1,18 +0,0 @@
1
- const successMessage = { status: 'success' };
2
-
3
- const errorMessage = { status: 'error' };
4
-
5
- const status = {
6
- success: 200,
7
- created: 201,
8
- nocontent: 204,
9
- bad: 400,
10
- unauthorized: 401,
11
- notfound: 404,
12
- conflict: 409,
13
- error: 500,
14
- // STS Specific Errors
15
- serverErrorMalformed: 520
16
- };
17
-
18
- module.exports = { successMessage, errorMessage, status };