@nsshunt/stsoauth2plugin 0.1.18 → 0.1.21

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 ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true,
6
+ "jest": true
7
+ },
8
+ "extends": [
9
+ "eslint:recommended",
10
+ "plugin:@typescript-eslint/recommended"
11
+ ],
12
+ "parser": "@typescript-eslint/parser",
13
+ "parserOptions": {
14
+ "ecmaVersion": "latest",
15
+ "sourceType": "module"
16
+ },
17
+ "plugins": [
18
+ "@typescript-eslint"
19
+ ],
20
+ "ignorePatterns": ["temp.js", "**/k6scripts/*.js", "**/public/*", "**/dist/*", "**/types/*"],
21
+ "rules": {
22
+ "indent": ["error", "tab"],
23
+ //"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
24
+ "no-mixed-spaces-and-tabs": 0, // disable rule
25
+ "@typescript-eslint/no-var-requires": "warn"
26
+ }
27
+ }
@@ -0,0 +1,13 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+ #
6
+ # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
7
+
8
+ version: 2
9
+ updates:
10
+ - package-ecosystem: "npm" # See documentation for possible values
11
+ directory: "/" # Location of package manifests
12
+ schedule:
13
+ interval: "monthly"
@@ -0,0 +1,54 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+ push:
10
+ branches: [ main ]
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-node@v2
18
+ with:
19
+ node-version: 18
20
+ - run: npm ci
21
+ - run: npm run lint
22
+ - run: npm test
23
+
24
+ publish-npm:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: actions/setup-node@v2
30
+ with:
31
+ node-version: 18
32
+ registry-url: https://registry.npmjs.org/
33
+ - run: npm ci
34
+ - run: npm run build
35
+ - run: npm publish --access public
36
+ env:
37
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
38
+
39
+ # publish-gpr:
40
+ # needs: build
41
+ # runs-on: ubuntu-latest
42
+ # permissions:
43
+ # contents: read
44
+ # packages: write
45
+ # steps:
46
+ # - uses: actions/checkout@v2
47
+ # - uses: actions/setup-node@v2
48
+ # with:
49
+ # node-version: 17
50
+ # registry-url: https://npm.pkg.github.com/
51
+ # - run: npm ci
52
+ # - run: npm publish
53
+ # env:
54
+ # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [
3
+ ["@babel/preset-env", {"targets": {"node": "current"}}],
4
+ "@babel/preset-typescript"
5
+ ]
6
+ }
package/build.sh ADDED
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+ rm -rf dist
3
+ rm -rf types
4
+ npm run build
5
+ RESULT=$?
6
+ if [ $RESULT -eq 0 ]; then
7
+ echo success build
8
+ npm run lint
9
+ RESULT=$?
10
+ if [ $RESULT -eq 0 ]; then
11
+ echo success lint
12
+ npm run test
13
+ RESULT=$?
14
+ if [ $RESULT -eq 0 ]; then
15
+ echo success test
16
+ git commit -a -m "changed"
17
+ npm version patch
18
+ npm i
19
+ git commit -a -m "changed"
20
+ git push
21
+ else
22
+ echo failed test
23
+ fi
24
+ else
25
+ echo failed lint
26
+ fi
27
+ else
28
+ echo failed build
29
+ fi
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@nsshunt/stsoauth2plugin",
3
+ "version": "0.1.21",
4
+ "description": "STS OAuth2 VUE Plugin",
5
+ "files": [
6
+ "dist",
7
+ "src",
8
+ "types"
9
+ ],
10
+ "main": "./dist/stsoauth2plugin.umd.js",
11
+ "module": "./dist/stsoauth2plugin.es.js",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/stsoauth2plugin.es.js",
15
+ "require": "./dist/stsoauth2plugin.umd.js"
16
+ }
17
+ },
18
+ "types": "./types/index.d.ts",
19
+ "scripts": {
20
+ "lint": "eslint . --ext js,jsx,ts,tsx --fix",
21
+ "test": "jest --detectOpenHandles --no-cache",
22
+ "testwatch": "jest --watchAll --detectOpenHandles --no-cache",
23
+ "build": "tsc",
24
+ "build2": "tsc && vite build"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/nsshunt/stsoauth2plugin.git"
29
+ },
30
+ "author": "STS",
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/nsshunt/stsoauth2plugin/issues"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/preset-env": "^7.18.2",
37
+ "@babel/preset-typescript": "^7.17.12",
38
+ "@tsconfig/node18": "^1.0.0",
39
+ "@types/debug": "^4.1.7",
40
+ "@types/jest": "^27.5.1",
41
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
42
+ "@typescript-eslint/parser": "^5.27.0",
43
+ "eslint": "^8.16.0",
44
+ "jest": "^28.0.2",
45
+ "prettier": "^2.6.2",
46
+ "supertest": "^6.2.2",
47
+ "ts-loader": "^9.3.0",
48
+ "typescript": "^4.7.3"
49
+ },
50
+ "homepage": "https://github.com/nsshunt/stsoauth2plugin#readme",
51
+ "dependencies": {
52
+ "@nsshunt/stsutils": "^1.15.1",
53
+ "axios": "^0.27.2",
54
+ "debug": "^4.3.4",
55
+ "es-cookie": "^1.3.2",
56
+ "http-status-codes": "^2.2.0",
57
+ "jwt-decode": "^3.1.2",
58
+ "vite": "^2.9.12",
59
+ "vue-router": "^4.0.16",
60
+ "vue-tsc": "^0.37.3"
61
+ }
62
+ }
package/package.json CHANGED
@@ -1,26 +1,15 @@
1
1
  {
2
2
  "name": "@nsshunt/stsoauth2plugin",
3
- "version": "0.1.18",
3
+ "version": "0.1.21",
4
4
  "description": "STS OAuth2 VUE Plugin",
5
- "files": [
6
- "dist",
7
- "src",
8
- "types"
9
- ],
10
- "main": "./dist/stsoauth2plugin.umd.js",
11
- "module": "./dist/stsoauth2plugin.es.js",
12
- "exports": {
13
- ".": {
14
- "import": "./dist/stsoauth2plugin.es.js",
15
- "require": "./dist/stsoauth2plugin.umd.js"
16
- }
17
- },
5
+ "main": "./dist/index.js",
18
6
  "types": "./types/index.d.ts",
19
7
  "scripts": {
20
8
  "lint": "eslint . --ext js,jsx,ts,tsx --fix",
21
9
  "test": "jest --detectOpenHandles --no-cache",
22
10
  "testwatch": "jest --watchAll --detectOpenHandles --no-cache",
23
- "build": "tsc && vite build"
11
+ "build": "tsc",
12
+ "build2": "tsc && vite build"
24
13
  },
25
14
  "repository": {
26
15
  "type": "git",
@@ -7,7 +7,8 @@ import CryptoUtils from './Utils/CryptoUtils'
7
7
  import QueryParams from './Utils/QueryParams';
8
8
 
9
9
  import { IAuthorizeOptions, IAuthorizeResponse, IAuthorizeErrorResponse, AuthenticateEvent,
10
- ISTSOAuth2ManagerOptions, IOauth2ListenerMessage, IOauth2ListenerMessageResponse, IOauth2ListenerCommand } from './stsoauth2types'
10
+ ISTSOAuth2ManagerOptions, IOauth2ListenerMessage, IOauth2ListenerMessageResponse,
11
+ IOauth2ListenerCommand, StsOauth2WorkerFactory } from './stsoauth2types'
11
12
 
12
13
  import { Router } from 'vue-router' //@@ only need the type
13
14
 
@@ -46,16 +47,12 @@ export class STSOAuth2Manager {
46
47
  // Use session storage for the transient nature of the OAuth2 authorize handshake. Once completed, the storage will be removed.
47
48
  this.#transactionStore = new ClientStorageFactory<IAuthorizeOptions>({clientStorageType: ClientStorageType.SESSION_STORAGE}).GetStorage();
48
49
 
49
- /*
50
- this.#worker = new Worker(new URL('./stsoauth2worker.ts', import.meta.url), {
51
- type: 'module'
52
- });
53
- */
54
-
55
- if (this.#options.worker) {
56
- this.#worker = this.#options.worker;
50
+ if (this.#options.workerFactory) {
51
+ this.#worker = this.#options.workerFactory();
57
52
  } else {
58
- this.#worker = new Worker(new URL('./stsoauth2worker.ts', import.meta.url));
53
+ this.#worker = new Worker(new URL('./stsoauth2worker.ts', import.meta.url), {
54
+ type: 'module'
55
+ });
59
56
  }
60
57
 
61
58
  this.#worker.onmessage = (data: MessageEvent) => {
@@ -102,8 +102,10 @@ export interface IOauth2ListenerMessageResponse {
102
102
  payload: any
103
103
  }
104
104
 
105
+ export type StsOauth2WorkerFactory = () => Worker
106
+
105
107
  export interface ISTSOAuth2ManagerOptions {
106
108
  router: Router
107
109
  authenticateEvent?: AuthenticateEvent
108
- worker?: Worker
110
+ workerFactory?: StsOauth2WorkerFactory
109
111
  }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "extends": "@tsconfig/node18/tsconfig.json",
3
+ "include": ["src/**/*" ],
4
+ "exclude": ["node_modules", "**/node_modules/**/*", "**/*.spec.ts"],
5
+ "compilerOptions": {
6
+ "module": "esnext",
7
+ "target": "es2021",
8
+ "moduleResolution": "node",
9
+ "sourceMap": true,
10
+ "outDir": "dist",
11
+ "allowJs": true,
12
+ "declaration": true,
13
+ "declarationDir": "./types",
14
+ "declarationMap": true,
15
+
16
+ "noImplicitAny": false,
17
+ "strictNullChecks": false,
18
+
19
+ "lib": [
20
+ // Should target at least ES2016 in Vue 3
21
+ // Support for newer versions of language built-ins are
22
+ // left for the users to include, because that would require:
23
+ // - either the project doesn't need to support older versions of browsers;
24
+ // - or the project has properly included the necessary polyfills.
25
+ "ES2016",
26
+ "DOM",
27
+ "DOM.Iterable",
28
+ "webworker"
29
+ // No `ScriptHost` because Vue 3 dropped support for IE
30
+ ],
31
+ }
32
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"stsoauth2manager.d.ts","sourceRoot":"","sources":["../src/stsoauth2manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AAKpE,OAAO,EACN,wBAAwB,EAAkF,MAAM,kBAAkB,CAAA;AAWnI,qBAAa,gBAAgB;;gBAkBhB,GAAG,KAAA,EAAE,OAAO,EAAE,wBAAwB;IAkQlD,cAAc,QAAY,QAAQ,OAAO,CAAC,CAQzC;IAED,SAAS,QAAa,QAAQ,IAAI,CAAC,CASlC;IAED,cAAc,cAAqB,UAAU,KAAG,QAAQ,OAAO,CAAC,CAoB/D;IAED,MAAM,QAAa,QAAQ,OAAO,CAAC,CAQlC;CACD"}
1
+ {"version":3,"file":"stsoauth2manager.d.ts","sourceRoot":"","sources":["../src/stsoauth2manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AAKpE,OAAO,EACN,wBAAwB,EACwB,MAAM,kBAAkB,CAAA;AAWzE,qBAAa,gBAAgB;;gBAkBhB,GAAG,KAAA,EAAE,OAAO,EAAE,wBAAwB;IA8PlD,cAAc,QAAY,QAAQ,OAAO,CAAC,CAQzC;IAED,SAAS,QAAa,QAAQ,IAAI,CAAC,CASlC;IAED,cAAc,cAAqB,UAAU,KAAG,QAAQ,OAAO,CAAC,CAoB/D;IAED,MAAM,QAAa,QAAQ,OAAO,CAAC,CAQlC;CACD"}
@@ -82,9 +82,10 @@ export interface IOauth2ListenerMessageResponse {
82
82
  command: IOauth2ListenerCommand;
83
83
  payload: any;
84
84
  }
85
+ export declare type StsOauth2WorkerFactory = () => Worker;
85
86
  export interface ISTSOAuth2ManagerOptions {
86
87
  router: Router;
87
88
  authenticateEvent?: AuthenticateEvent;
88
- worker?: Worker;
89
+ workerFactory?: StsOauth2WorkerFactory;
89
90
  }
90
91
  //# sourceMappingURL=stsoauth2types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stsoau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AAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CAGhB;AAED,oBAAY,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAI3D,oBAAY,sBAAsB;IACjC,eAAe,mBAAmB;IAClC,SAAS,cAAc;IACvB,eAAe,mBAAmB;IAClC,MAAM,WAAW;IACjB,kBAAkB,sBAAsB;IACxC,KAAK,UAAU;CACf;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,sBAAsB,CAAA;IAC/B,OAAO,CAAC,EAAE,GAAG,CAAA;CACb;AAED,MAAM,WAAW,8BAA8B;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,sBAAsB,CAAA;IAC/B,OAAO,EAAE,GAAG,CAAA;CACZ;AAED,oBAAY,sBAAsB,GAAG,MAAM,MAAM,CAAA;AAEjD,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,aAAa,CAAC,EAAE,sBAAsB,CAAA;CACtC"}
package/vite.config.ts ADDED
@@ -0,0 +1,120 @@
1
+ //import { fileURLToPath, URL } from 'url'
2
+
3
+ import { defineConfig } from 'vite'
4
+ //import vue from '@vitejs/plugin-vue'
5
+ import path from 'path'
6
+ //import fs from 'fs';
7
+
8
+ // https://vitejs.dev/config/
9
+ export default ({ mode }) => {
10
+ //export default defineConfig({
11
+ //process.env = {...process.env, ...loadEnv(mode, process.cwd())};
12
+ // https://github.com/vitejs/vite/issues/1930
13
+
14
+ /*
15
+ let envpath = `./.env.${mode}`;
16
+ require('dotenv').config({ path: envpath });
17
+
18
+ console.log(process.env);
19
+ console.log(mode);
20
+ */
21
+
22
+ return defineConfig({
23
+
24
+ build: {
25
+ lib: {
26
+ entry: path.resolve(__dirname, 'src/index.ts'),
27
+ name: 'stsoauth2plugin',
28
+ fileName: (format) => `stsoauth2plugin.${format}.js`,
29
+ //formats: ['es']
30
+ },
31
+ rollupOptions: {
32
+ // make sure to externalize deps that shouldn't be bundled
33
+ // into your library
34
+ external: [
35
+ 'vue',
36
+ 'vue-router',
37
+ 'vue-tsc',
38
+ 'axios',
39
+ 'debug',
40
+ 'jwt-decode',
41
+ 'vite',
42
+ 'http-status-codes'
43
+ ],
44
+ output: {
45
+ // Provide global variables to use in the UMD build
46
+ // for externalized deps
47
+ globals: {
48
+ vue: 'Vue',
49
+ }
50
+ }
51
+ /*
52
+ output: {
53
+ // Provide global variables to use in the UMD build
54
+ // for externalized deps
55
+ globals: {
56
+ vue: 'Vue',
57
+ debug: 'Debug',
58
+ 'jwt-decode': 'jwt-decode',
59
+ axios: 'axios'
60
+ }
61
+ }
62
+ */
63
+ }
64
+ },
65
+ define: {
66
+ 'process.argv': [ process.cwd() ], //@@ only required because of colors - delete ...
67
+ 'process.env': { ...process.env },
68
+ // Define process properties used by various imports
69
+ 'process.pid': 0,
70
+ 'process.stdout': null,
71
+ 'process.stderr': null,
72
+ 'process.platform': null
73
+ },
74
+
75
+ /*
76
+ plugins: [vue()],
77
+ define: {
78
+ 'process.argv': [ process.cwd() ], //@@ only required because of colors - delete ...
79
+ 'process.env': { ...process.env },
80
+ // Define process properties used by various imports
81
+ 'process.pid': 0,
82
+ 'process.stdout': null,
83
+ 'process.stderr': null,
84
+ 'process.platform': null
85
+ },
86
+ resolve: {
87
+ alias: {
88
+ //'@': path.resolve(__dirname, 'src'),
89
+ '@': fileURLToPath(new URL('./src', import.meta.url))
90
+ },
91
+ },
92
+
93
+ base: '/',
94
+
95
+ // serve --ssl-cert "/etc/letsencrypt/live/stsmda.org/fullchain.pem" --ssl-key "/etc/letsencrypt/live/stsmda.org/privkey.pem" -p 3010 dist
96
+
97
+ server: {
98
+ host: 'stsauth01.stsmda.org'
99
+ ,https: {
100
+ key: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/privkey.pem'),
101
+ cert: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/fullchain.pem'),
102
+ passphrase: ''
103
+ }
104
+ ,port: 3010 // was working using 3007
105
+ ,hmr: {
106
+ protocol: 'wss',
107
+ //host: '192.168.14.1',
108
+ host: 'stsauth01.stsmda.org',
109
+ port: 3010
110
+ }
111
+ },
112
+
113
+ worker: {
114
+ format: 'es'
115
+ }
116
+ */
117
+
118
+ });
119
+ }
120
+