@digipair/skill-oauth2 0.91.0-0 → 0.92.0

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/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var simpleOauth2 = require('simple-oauth2');
6
+
7
+ let OAuth2Service = class OAuth2Service {
8
+ async authorizationCodeUrl(params, _pinsSettingsList, _context) {
9
+ const { config } = params;
10
+ const client = new simpleOauth2.AuthorizationCode(config);
11
+ return client.authorizeURL(config);
12
+ }
13
+ async authorizationCodeAccessToken(params, _pinsSettingsList, _context) {
14
+ const { config, tokenParams } = params;
15
+ const client = new simpleOauth2.AuthorizationCode(config);
16
+ return client.getToken(tokenParams);
17
+ }
18
+ async authorizationCodeCreateToken(params, _pinsSettingsList, _context) {
19
+ const { config, accessToken } = params;
20
+ const client = new simpleOauth2.AuthorizationCode(config);
21
+ return client.createToken(accessToken);
22
+ }
23
+ async resourceOwnerPasswordAccessToken(params, _pinsSettingsList, _context) {
24
+ const { config, tokenParams } = params;
25
+ const client = new simpleOauth2.ResourceOwnerPassword(config);
26
+ return client.getToken(tokenParams);
27
+ }
28
+ async resourceOwnerPasswordCreateToken(params, _pinsSettingsList, _context) {
29
+ const { config, accessToken } = params;
30
+ const client = new simpleOauth2.ResourceOwnerPassword(config);
31
+ return client.createToken(accessToken);
32
+ }
33
+ async clientCredentialsAccessToken(params, _pinsSettingsList, _context) {
34
+ const { config, tokenParams } = params;
35
+ const client = new simpleOauth2.ClientCredentials(config);
36
+ return client.getToken(tokenParams);
37
+ }
38
+ async clientCredentialsCreateToken(params, _pinsSettingsList, _context) {
39
+ const { config, accessToken } = params;
40
+ const client = new simpleOauth2.ClientCredentials(config);
41
+ return client.createToken(accessToken);
42
+ }
43
+ async tokenExpired(params, _pinsSettingsList, _context) {
44
+ const { token } = params;
45
+ return token.expired();
46
+ }
47
+ async tokenRefresh(params, _pinsSettingsList, _context) {
48
+ const { token } = params;
49
+ return token.refresh();
50
+ }
51
+ async tokenRevoke(params, _pinsSettingsList, _context) {
52
+ const { token, type } = params;
53
+ return token.revoke(type);
54
+ }
55
+ async tokenRevokeAll(params, _pinsSettingsList, _context) {
56
+ const { token } = params;
57
+ return token.revokeAll();
58
+ }
59
+ };
60
+ const authorizationCodeUrl = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeUrl(params, pinsSettingsList, context);
61
+ const authorizationCodeAccessTocken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeAccessToken(params, pinsSettingsList, context);
62
+ const authorizationCodeCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeCreateToken(params, pinsSettingsList, context);
63
+ const resourceOwnerPasswordAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordAccessToken(params, pinsSettingsList, context);
64
+ const resourceOwnerPasswordCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordCreateToken(params, pinsSettingsList, context);
65
+ const clientCredentialsAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsAccessToken(params, pinsSettingsList, context);
66
+ const clientCredentialsCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsCreateToken(params, pinsSettingsList, context);
67
+ const tokenExpired = (params, pinsSettingsList, context)=>new OAuth2Service().tokenExpired(params, pinsSettingsList, context);
68
+ const tokenRefresh = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRefresh(params, pinsSettingsList, context);
69
+ const tokenRevoke = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevoke(params, pinsSettingsList, context);
70
+ const tokenRevokeAll = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevokeAll(params, pinsSettingsList, context);
71
+
72
+ exports.authorizationCodeAccessTocken = authorizationCodeAccessTocken;
73
+ exports.authorizationCodeCreateToken = authorizationCodeCreateToken;
74
+ exports.authorizationCodeUrl = authorizationCodeUrl;
75
+ exports.clientCredentialsAccessToken = clientCredentialsAccessToken;
76
+ exports.clientCredentialsCreateToken = clientCredentialsCreateToken;
77
+ exports.resourceOwnerPasswordAccessToken = resourceOwnerPasswordAccessToken;
78
+ exports.resourceOwnerPasswordCreateToken = resourceOwnerPasswordCreateToken;
79
+ exports.tokenExpired = tokenExpired;
80
+ exports.tokenRefresh = tokenRefresh;
81
+ exports.tokenRevoke = tokenRevoke;
82
+ exports.tokenRevokeAll = tokenRevokeAll;
package/index.esm.js ADDED
@@ -0,0 +1,68 @@
1
+ import { AuthorizationCode, ResourceOwnerPassword, ClientCredentials } from 'simple-oauth2';
2
+
3
+ let OAuth2Service = class OAuth2Service {
4
+ async authorizationCodeUrl(params, _pinsSettingsList, _context) {
5
+ const { config } = params;
6
+ const client = new AuthorizationCode(config);
7
+ return client.authorizeURL(config);
8
+ }
9
+ async authorizationCodeAccessToken(params, _pinsSettingsList, _context) {
10
+ const { config, tokenParams } = params;
11
+ const client = new AuthorizationCode(config);
12
+ return client.getToken(tokenParams);
13
+ }
14
+ async authorizationCodeCreateToken(params, _pinsSettingsList, _context) {
15
+ const { config, accessToken } = params;
16
+ const client = new AuthorizationCode(config);
17
+ return client.createToken(accessToken);
18
+ }
19
+ async resourceOwnerPasswordAccessToken(params, _pinsSettingsList, _context) {
20
+ const { config, tokenParams } = params;
21
+ const client = new ResourceOwnerPassword(config);
22
+ return client.getToken(tokenParams);
23
+ }
24
+ async resourceOwnerPasswordCreateToken(params, _pinsSettingsList, _context) {
25
+ const { config, accessToken } = params;
26
+ const client = new ResourceOwnerPassword(config);
27
+ return client.createToken(accessToken);
28
+ }
29
+ async clientCredentialsAccessToken(params, _pinsSettingsList, _context) {
30
+ const { config, tokenParams } = params;
31
+ const client = new ClientCredentials(config);
32
+ return client.getToken(tokenParams);
33
+ }
34
+ async clientCredentialsCreateToken(params, _pinsSettingsList, _context) {
35
+ const { config, accessToken } = params;
36
+ const client = new ClientCredentials(config);
37
+ return client.createToken(accessToken);
38
+ }
39
+ async tokenExpired(params, _pinsSettingsList, _context) {
40
+ const { token } = params;
41
+ return token.expired();
42
+ }
43
+ async tokenRefresh(params, _pinsSettingsList, _context) {
44
+ const { token } = params;
45
+ return token.refresh();
46
+ }
47
+ async tokenRevoke(params, _pinsSettingsList, _context) {
48
+ const { token, type } = params;
49
+ return token.revoke(type);
50
+ }
51
+ async tokenRevokeAll(params, _pinsSettingsList, _context) {
52
+ const { token } = params;
53
+ return token.revokeAll();
54
+ }
55
+ };
56
+ const authorizationCodeUrl = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeUrl(params, pinsSettingsList, context);
57
+ const authorizationCodeAccessTocken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeAccessToken(params, pinsSettingsList, context);
58
+ const authorizationCodeCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeCreateToken(params, pinsSettingsList, context);
59
+ const resourceOwnerPasswordAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordAccessToken(params, pinsSettingsList, context);
60
+ const resourceOwnerPasswordCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordCreateToken(params, pinsSettingsList, context);
61
+ const clientCredentialsAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsAccessToken(params, pinsSettingsList, context);
62
+ const clientCredentialsCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsCreateToken(params, pinsSettingsList, context);
63
+ const tokenExpired = (params, pinsSettingsList, context)=>new OAuth2Service().tokenExpired(params, pinsSettingsList, context);
64
+ const tokenRefresh = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRefresh(params, pinsSettingsList, context);
65
+ const tokenRevoke = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevoke(params, pinsSettingsList, context);
66
+ const tokenRevokeAll = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevokeAll(params, pinsSettingsList, context);
67
+
68
+ export { authorizationCodeAccessTocken, authorizationCodeCreateToken, authorizationCodeUrl, clientCredentialsAccessToken, clientCredentialsCreateToken, resourceOwnerPasswordAccessToken, resourceOwnerPasswordCreateToken, tokenExpired, tokenRefresh, tokenRevoke, tokenRevokeAll };
@@ -0,0 +1,12 @@
1
+ import { PinsSettings } from '@digipair/engine';
2
+ export declare const authorizationCodeUrl: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
+ export declare const authorizationCodeAccessTocken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ export declare const authorizationCodeCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
+ export declare const resourceOwnerPasswordAccessToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
6
+ export declare const resourceOwnerPasswordCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
+ export declare const clientCredentialsAccessToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
+ export declare const clientCredentialsCreateToken: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
9
+ export declare const tokenExpired: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
10
+ export declare const tokenRefresh: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
11
+ export declare const tokenRevoke: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
12
+ export declare const tokenRevokeAll: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
package/package.json CHANGED
@@ -1,28 +1,14 @@
1
1
  {
2
2
  "name": "@digipair/skill-oauth2",
3
- "version": "0.91.0-0",
4
- "type": "module",
5
- "main": "dist/libs/skill-oauth2/index.cjs.js",
6
- "module": "dist/libs/skill-oauth2/index.esm.js",
7
- "types": "dist/libs/skill-oauth2/index.esm.d.ts",
8
- "exports": {
9
- "./package.json": "./libs/skill-oauth2/package.json",
10
- ".": {
11
- "development": "./dist/libs/skill-oauth2/src/index.ts",
12
- "types": "./dist/libs/skill-oauth2/index.esm.d.ts",
13
- "import": "./dist/libs/skill-oauth2/index.esm.js",
14
- "default": "./dist/libs/skill-oauth2/index.cjs.js"
15
- }
16
- },
3
+ "version": "0.92.0",
17
4
  "keywords": [
18
5
  "digipair",
19
- "tool",
20
- "service"
6
+ "service",
7
+ "tool"
21
8
  ],
22
- "nx": {
23
- "name": "skill-oauth2"
24
- },
25
9
  "dependencies": {
26
- "@digipair/engine": "0.91.0-0"
27
- }
28
- }
10
+ "simple-oauth2": "^5.1.0"
11
+ },
12
+ "main": "./index.cjs.js",
13
+ "module": "./index.esm.js"
14
+ }
package/.swcrc DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "jsc": {
3
- "target": "es2017",
4
- "parser": {
5
- "syntax": "typescript",
6
- "decorators": true,
7
- "dynamicImport": true
8
- },
9
- "transform": {
10
- "decoratorMetadata": true,
11
- "legacyDecorator": true
12
- },
13
- "keepClassNames": true,
14
- "externalHelpers": true,
15
- "loose": true
16
- },
17
- "module": {
18
- "type": "es6"
19
- },
20
- "sourceMaps": true,
21
- "exclude": [
22
- "jest.config.ts",
23
- ".*\\.spec.tsx?$",
24
- ".*\\.test.tsx?$",
25
- "./src/jest-setup.ts$",
26
- "./**/jest-setup.ts$"
27
- ]
28
- }
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # mylib
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build mylib` to build the library.
package/eslint.config.mjs DELETED
@@ -1,22 +0,0 @@
1
- import baseConfig from '../../eslint.config.mjs';
2
-
3
- export default [
4
- ...baseConfig,
5
- {
6
- files: ['**/*.json'],
7
- rules: {
8
- '@nx/dependency-checks': [
9
- 'error',
10
- {
11
- ignoredFiles: [
12
- '{projectRoot}/eslint.config.{js,cjs,mjs}',
13
- '{projectRoot}/rollup.config.{js,ts,mjs,mts,cjs,cts}',
14
- ],
15
- },
16
- ],
17
- },
18
- languageOptions: {
19
- parser: await import('jsonc-eslint-parser'),
20
- },
21
- },
22
- ];
package/rollup.config.cjs DELETED
@@ -1,28 +0,0 @@
1
- const { withNx } = require('@nx/rollup/with-nx');
2
-
3
- module.exports = withNx(
4
- {
5
- main: 'libs/skill-oauth2/src/index.ts',
6
- outputPath: 'dist/libs/skill-oauth2',
7
- tsConfig: 'libs/skill-oauth2/tsconfig.lib.json',
8
- compiler: 'swc',
9
- format: ['esm', "cjs"],
10
- assets: [
11
- {
12
- input: 'libs/skill-oauth2/',
13
- glob: 'package.json',
14
- output: '.'
15
- },
16
- {
17
- input: 'libs/skill-oauth2/src/',
18
- glob: '*.json',
19
- output: '.'
20
- }
21
- ]
22
- },
23
- {
24
- // Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
25
- // e.g.
26
- // output: { sourcemap: true },
27
- }
28
- );
@@ -1,7 +0,0 @@
1
- import { skillOauth2 } from './skill-oauth2';
2
-
3
- describe('skillOauth2', () => {
4
- it('should work', () => {
5
- expect(skillOauth2()).toEqual('skill-oauth2');
6
- });
7
- });
@@ -1,112 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-unused-vars */
3
- import { PinsSettings } from '@digipair/engine';
4
- import { AuthorizationCode, ClientCredentials, ResourceOwnerPassword } from 'simple-oauth2';
5
-
6
- class OAuth2Service {
7
- async authorizationCodeUrl(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
8
- const { config } = params;
9
-
10
- const client = new AuthorizationCode(config);
11
- return client.authorizeURL(config);
12
- }
13
-
14
- async authorizationCodeAccessToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
15
- const { config, tokenParams } = params;
16
-
17
- const client = new AuthorizationCode(config);
18
- return client.getToken(tokenParams);
19
- }
20
-
21
- async authorizationCodeCreateToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
22
- const { config, accessToken } = params;
23
-
24
- const client = new AuthorizationCode(config);
25
- return client.createToken(accessToken);
26
- }
27
-
28
- async resourceOwnerPasswordAccessToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
29
- const { config, tokenParams } = params;
30
-
31
- const client = new ResourceOwnerPassword(config);
32
- return client.getToken(tokenParams);
33
- }
34
-
35
- async resourceOwnerPasswordCreateToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
36
- const { config, accessToken } = params;
37
-
38
- const client = new ResourceOwnerPassword(config);
39
- return client.createToken(accessToken);
40
- }
41
-
42
- async clientCredentialsAccessToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
43
- const { config, tokenParams } = params;
44
-
45
- const client = new ClientCredentials(config);
46
- return client.getToken(tokenParams);
47
- }
48
-
49
- async clientCredentialsCreateToken(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
50
- const { config, accessToken } = params;
51
-
52
- const client = new ClientCredentials(config);
53
- return client.createToken(accessToken);
54
- }
55
-
56
- async tokenExpired(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
57
- const { token } = params;
58
-
59
- return token.expired();
60
- }
61
-
62
- async tokenRefresh(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
63
- const { token } = params;
64
-
65
- return token.refresh();
66
- }
67
-
68
- async tokenRevoke(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
69
- const { token, type } = params;
70
-
71
- return token.revoke(type);
72
- }
73
-
74
- async tokenRevokeAll(params: any, _pinsSettingsList: PinsSettings[], _context: any): Promise<any> {
75
- const { token } = params;
76
-
77
- return token.revokeAll();
78
- }
79
- }
80
-
81
- export const authorizationCodeUrl = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
82
- new OAuth2Service().authorizationCodeUrl(params, pinsSettingsList, context);
83
-
84
- export const authorizationCodeAccessTocken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
85
- new OAuth2Service().authorizationCodeAccessToken(params, pinsSettingsList, context);
86
-
87
- export const authorizationCodeCreateToken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
88
- new OAuth2Service().authorizationCodeCreateToken(params, pinsSettingsList, context);
89
-
90
- export const resourceOwnerPasswordAccessToken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
91
- new OAuth2Service().resourceOwnerPasswordAccessToken(params, pinsSettingsList, context);
92
-
93
- export const resourceOwnerPasswordCreateToken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
94
- new OAuth2Service().resourceOwnerPasswordCreateToken(params, pinsSettingsList, context);
95
-
96
- export const clientCredentialsAccessToken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
97
- new OAuth2Service().clientCredentialsAccessToken(params, pinsSettingsList, context);
98
-
99
- export const clientCredentialsCreateToken = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
100
- new OAuth2Service().clientCredentialsCreateToken(params, pinsSettingsList, context);
101
-
102
- export const tokenExpired = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
103
- new OAuth2Service().tokenExpired(params, pinsSettingsList, context);
104
-
105
- export const tokenRefresh = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
106
- new OAuth2Service().tokenRefresh(params, pinsSettingsList, context);
107
-
108
- export const tokenRevoke = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
109
- new OAuth2Service().tokenRevoke(params, pinsSettingsList, context);
110
-
111
- export const tokenRevokeAll = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
112
- new OAuth2Service().tokenRevokeAll(params, pinsSettingsList, context);
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "../engine"
8
- },
9
- {
10
- "path": "./tsconfig.lib.json"
11
- }
12
- ]
13
- }
package/tsconfig.lib.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "outDir": "dist",
6
- "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
7
- "emitDeclarationOnly": true,
8
- "module": "esnext",
9
- "moduleResolution": "node",
10
- "forceConsistentCasingInFileNames": true,
11
- "types": ["node"]
12
- },
13
- "include": ["src/**/*.ts"],
14
- "references": [
15
- {
16
- "path": "../engine/tsconfig.lib.json"
17
- }
18
- ]
19
- }
File without changes
File without changes
File without changes