@okta/okta-auth-js 6.3.2 → 6.4.2

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.
Files changed (155) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +6 -0
  3. package/cjs/AuthStateManager.js +1 -0
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +10 -11
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/ServiceManager.js +1 -1
  9. package/cjs/ServiceManager.js.map +1 -1
  10. package/cjs/TokenManager.js.map +1 -1
  11. package/cjs/crypto/node.js +11 -16
  12. package/cjs/crypto/node.js.map +1 -1
  13. package/cjs/crypto/verifyToken.js +2 -1
  14. package/cjs/crypto/verifyToken.js.map +1 -1
  15. package/cjs/errors/AuthApiError.js.map +1 -1
  16. package/cjs/errors/OAuthError.js +7 -1
  17. package/cjs/errors/OAuthError.js.map +1 -1
  18. package/cjs/fetch/fetchRequest.js +17 -3
  19. package/cjs/fetch/fetchRequest.js.map +1 -1
  20. package/cjs/http/request.js +7 -3
  21. package/cjs/http/request.js.map +1 -1
  22. package/cjs/idx/idxState/index.js +55 -0
  23. package/cjs/idx/idxState/index.js.map +1 -0
  24. package/cjs/idx/{idx-js → idxState}/v1/actionParser.js +1 -0
  25. package/cjs/idx/idxState/v1/actionParser.js.map +1 -0
  26. package/cjs/idx/{idx-js → idxState}/v1/generateIdxAction.js +43 -30
  27. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -0
  28. package/cjs/idx/{idx-js → idxState}/v1/idxResponseParser.js +8 -8
  29. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -0
  30. package/cjs/idx/{idx-js → idxState}/v1/makeIdxState.js +3 -2
  31. package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -0
  32. package/cjs/idx/{idx-js → idxState}/v1/parsers.js +1 -0
  33. package/cjs/idx/idxState/v1/parsers.js.map +1 -0
  34. package/cjs/idx/{idx-js → idxState}/v1/remediationParser.js +4 -2
  35. package/cjs/idx/idxState/v1/remediationParser.js.map +1 -0
  36. package/cjs/idx/interact.js +42 -21
  37. package/cjs/idx/interact.js.map +1 -1
  38. package/cjs/idx/introspect.js +37 -12
  39. package/cjs/idx/introspect.js.map +1 -1
  40. package/cjs/idx/remediate.js +56 -132
  41. package/cjs/idx/remediate.js.map +1 -1
  42. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  43. package/cjs/idx/remediators/AuthenticatorVerificationData.js +7 -6
  44. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  45. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  46. package/cjs/idx/remediators/Base/Remediator.js +12 -2
  47. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  48. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  49. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  50. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  51. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  52. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  53. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  54. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  55. package/cjs/idx/remediators/Identify.js.map +1 -1
  56. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  57. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  58. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  59. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  60. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
  61. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  62. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  63. package/cjs/idx/remediators/Skip.js.map +1 -1
  64. package/cjs/idx/run.js +16 -12
  65. package/cjs/idx/run.js.map +1 -1
  66. package/cjs/idx/types/idx-js.js +2 -0
  67. package/cjs/idx/types/idx-js.js.map +1 -1
  68. package/cjs/idx/types/index.js +0 -138
  69. package/cjs/idx/types/index.js.map +1 -1
  70. package/cjs/idx/util.js +127 -5
  71. package/cjs/idx/util.js.map +1 -1
  72. package/cjs/server/serverStorage.js +1 -0
  73. package/cjs/server/serverStorage.js.map +1 -1
  74. package/cjs/tx/AuthTransaction.js.map +1 -1
  75. package/cjs/types/Token.js +0 -1
  76. package/cjs/types/Token.js.map +1 -1
  77. package/cjs/util/object.js.map +1 -1
  78. package/cjs/util/types.js.map +1 -1
  79. package/dist/okta-auth-js.min.js +1 -1
  80. package/dist/okta-auth-js.min.js.map +1 -1
  81. package/dist/okta-auth-js.umd.js +1 -1
  82. package/dist/okta-auth-js.umd.js.map +1 -1
  83. package/esm/esm.browser.js +598 -683
  84. package/esm/esm.browser.js.map +1 -1
  85. package/esm/esm.node.mjs +598 -683
  86. package/esm/esm.node.mjs.map +1 -1
  87. package/lib/TokenManager.d.ts +2 -2
  88. package/lib/errors/OAuthError.d.ts +2 -0
  89. package/lib/idx/flow/RemediationFlow.d.ts +2 -2
  90. package/lib/idx/idxState/index.d.ts +7 -0
  91. package/lib/idx/{idx-js → idxState}/v1/actionParser.d.ts +0 -0
  92. package/lib/idx/{idx-js → idxState}/v1/generateIdxAction.d.ts +3 -1
  93. package/lib/idx/{idx-js → idxState}/v1/idxResponseParser.d.ts +3 -2
  94. package/lib/idx/{idx-js → idxState}/v1/makeIdxState.d.ts +3 -2
  95. package/lib/idx/{idx-js → idxState}/v1/parsers.d.ts +0 -0
  96. package/lib/idx/{idx-js → idxState}/v1/remediationParser.d.ts +2 -1
  97. package/lib/idx/interact.d.ts +22 -0
  98. package/lib/idx/remediate.d.ts +9 -12
  99. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +1 -2
  100. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -3
  101. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +3 -4
  102. package/lib/idx/remediators/Base/Remediator.d.ts +8 -4
  103. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +2 -3
  104. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +3 -4
  105. package/lib/idx/remediators/ChallengeAuthenticator.d.ts +1 -2
  106. package/lib/idx/remediators/EnrollAuthenticator.d.ts +1 -2
  107. package/lib/idx/remediators/EnrollPoll.d.ts +1 -2
  108. package/lib/idx/remediators/EnrollProfile.d.ts +1 -2
  109. package/lib/idx/remediators/EnrollmentChannelData.d.ts +1 -2
  110. package/lib/idx/remediators/Identify.d.ts +1 -2
  111. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +1 -2
  112. package/lib/idx/remediators/ResetAuthenticator.d.ts +1 -2
  113. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +1 -2
  114. package/lib/idx/remediators/SelectAuthenticatorEnroll.d.ts +1 -2
  115. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +1 -2
  116. package/lib/idx/remediators/SelectEnrollProfile.d.ts +1 -2
  117. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +1 -2
  118. package/lib/idx/remediators/Skip.d.ts +1 -2
  119. package/lib/idx/types/idx-js.d.ts +5 -2
  120. package/lib/idx/types/index.d.ts +26 -17
  121. package/lib/idx/util.d.ts +7 -4
  122. package/lib/types/EventEmitter.d.ts +3 -3
  123. package/lib/types/Service.d.ts +6 -6
  124. package/lib/types/Storage.d.ts +6 -6
  125. package/lib/types/TokenManager.d.ts +5 -2
  126. package/lib/types/UserClaims.d.ts +1 -1
  127. package/lib/util/types.d.ts +1 -1
  128. package/package.json +10 -10
  129. package/cjs/idx/headers.js +0 -59
  130. package/cjs/idx/headers.js.map +0 -1
  131. package/cjs/idx/idx-js/client.js +0 -91
  132. package/cjs/idx/idx-js/client.js.map +0 -1
  133. package/cjs/idx/idx-js/index.js +0 -40
  134. package/cjs/idx/idx-js/index.js.map +0 -1
  135. package/cjs/idx/idx-js/interact.js +0 -83
  136. package/cjs/idx/idx-js/interact.js.map +0 -1
  137. package/cjs/idx/idx-js/introspect.js +0 -62
  138. package/cjs/idx/idx-js/introspect.js.map +0 -1
  139. package/cjs/idx/idx-js/parsers.js +0 -41
  140. package/cjs/idx/idx-js/parsers.js.map +0 -1
  141. package/cjs/idx/idx-js/util.js +0 -34
  142. package/cjs/idx/idx-js/util.js.map +0 -1
  143. package/cjs/idx/idx-js/v1/actionParser.js.map +0 -1
  144. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +0 -1
  145. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +0 -1
  146. package/cjs/idx/idx-js/v1/makeIdxState.js.map +0 -1
  147. package/cjs/idx/idx-js/v1/parsers.js.map +0 -1
  148. package/cjs/idx/idx-js/v1/remediationParser.js.map +0 -1
  149. package/lib/idx/headers.d.ts +0 -16
  150. package/lib/idx/idx-js/client.d.ts +0 -36
  151. package/lib/idx/idx-js/index.d.ts +0 -35
  152. package/lib/idx/idx-js/interact.d.ts +0 -25
  153. package/lib/idx/idx-js/introspect.d.ts +0 -21
  154. package/lib/idx/idx-js/parsers.d.ts +0 -15
  155. package/lib/idx/idx-js/util.d.ts +0 -12
@@ -1,4 +1,4 @@
1
- import { RefreshToken, Token, Tokens, TokenType } from './Token';
1
+ import { AccessToken, IDToken, RefreshToken, Token, Tokens, TokenType } from './Token';
2
2
  export interface TokenManagerError {
3
3
  errorSummary: string;
4
4
  errorCode: string;
@@ -8,11 +8,14 @@ export interface TokenManagerError {
8
8
  }
9
9
  export declare type TokenManagerErrorEventHandler = (error: TokenManagerError) => void;
10
10
  export declare type TokenManagerEventHandler = (key: string, token: Token, oldtoken?: Token) => void;
11
+ export declare type AccessTokenCallback = (key: string, token: AccessToken) => void;
12
+ export declare type IDTokenCallback = (key: string, token: IDToken) => void;
13
+ export declare type RefreshTokenCallback = (key: string, token: RefreshToken) => void;
11
14
  export interface TokenManagerInterface {
12
15
  on: (event: string, handler: TokenManagerErrorEventHandler | TokenManagerEventHandler, context?: object) => void;
13
16
  off: (event: string, handler?: TokenManagerErrorEventHandler | TokenManagerEventHandler) => void;
14
17
  getTokensSync(): Tokens;
15
- setTokens({ accessToken, idToken, refreshToken }: Tokens, accessTokenCb?: Function, idTokenCb?: Function, refreshTokenCb?: Function): void;
18
+ setTokens({ accessToken, idToken, refreshToken }: Tokens, accessTokenCb?: AccessTokenCallback, idTokenCb?: IDTokenCallback, refreshTokenCb?: RefreshTokenCallback): void;
16
19
  getStorageKeyByType(type: TokenType): string;
17
20
  add(key: any, token: Token): void;
18
21
  updateRefreshToken(token: RefreshToken): any;
@@ -15,7 +15,7 @@
15
15
  * ID Token or returned from the /userinfo response and depend on the
16
16
  * response_type and scope parameters in the authorize request
17
17
  */
18
- export declare type UserClaims<T = {}> = T & {
18
+ export declare type UserClaims<T = Record<string, string | boolean | number>> = T & {
19
19
  auth_time?: number;
20
20
  aud?: string;
21
21
  email?: string;
@@ -12,5 +12,5 @@
12
12
  export declare function isString(obj: any): obj is string;
13
13
  export declare function isObject(obj: any): obj is object;
14
14
  export declare function isNumber(obj: any): obj is number;
15
- export declare function isFunction(fn: any): fn is Function;
15
+ export declare function isFunction(fn: any): fn is (...any: any[]) => any;
16
16
  export declare function isPromise(obj: any): any;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@okta/okta-auth-js",
4
4
  "description": "The Okta Auth SDK",
5
- "version": "6.3.2",
5
+ "version": "6.4.2",
6
6
  "homepage": "https://github.com/okta/okta-auth-js",
7
7
  "license": "Apache-2.0",
8
8
  "main": "cjs/index.js",
@@ -105,6 +105,7 @@
105
105
  "@babel/cli": "^7.8.0",
106
106
  "@babel/core": "^7.8.0",
107
107
  "@babel/plugin-proposal-class-properties": "^7.10.1",
108
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
108
109
  "@babel/plugin-transform-modules-commonjs": "^7.10.1",
109
110
  "@babel/plugin-transform-runtime": "^7.8.3",
110
111
  "@babel/plugin-transform-typescript": "^7.10.5",
@@ -116,15 +117,15 @@
116
117
  "@rollup/plugin-replace": "^3.0.0",
117
118
  "@types/jest": "^27.4.0",
118
119
  "@types/node": "^14.0.3",
119
- "@typescript-eslint/eslint-plugin": "^2.34.0",
120
- "@typescript-eslint/parser": "^2.34.0",
121
- "babel-jest": "^26.6.3",
120
+ "@typescript-eslint/eslint-plugin": "^5.18.0",
121
+ "@typescript-eslint/parser": "^5.18.0",
122
+ "babel-jest": "^27.5.1",
122
123
  "babel-loader": "^8.2.2",
123
124
  "babel-plugin-add-module-exports": "^1.0.2",
124
125
  "babel-plugin-inline-replace-variables": "^1.3.1",
125
126
  "chalk": "2.4.2",
126
127
  "cross-env": "^5.1.1",
127
- "eslint": "^7.1.0",
128
+ "eslint": "^8.12.0",
128
129
  "eslint-import-resolver-typescript": "^2.5.0",
129
130
  "eslint-plugin-compat": "^3.3.0",
130
131
  "eslint-plugin-import": "^2.25.4",
@@ -135,7 +136,7 @@
135
136
  "istanbul-instrumenter-loader": "^3.0.1",
136
137
  "jasmine-ajax": "^4.0.0",
137
138
  "jest": "^27.5.1",
138
- "jest-junit": "^9.0.0",
139
+ "jest-junit": "^13.0.0",
139
140
  "json-loader": "0.5.4",
140
141
  "lodash": "4.17.20",
141
142
  "rollup": "^2.59.0",
@@ -144,7 +145,6 @@
144
145
  "rollup-plugin-typescript2": "^0.30.0",
145
146
  "shelljs": "0.8.4",
146
147
  "ts-jest": "^27.1.3",
147
- "ts-loader": "^9.2.6",
148
148
  "tsd": "^0.17.0",
149
149
  "typescript": "^4.2.3",
150
150
  "webpack": "^5.60.0",
@@ -187,8 +187,8 @@
187
187
  }
188
188
  },
189
189
  "okta": {
190
- "commitSha": "d8949fd4d8fa6d87a1966259520b9a239914ec67",
191
- "fullVersion": "6.3.2-gd8949fd",
192
- "testedSha": "97c218a35528ea5d2d055953d554d72ce1e71011"
190
+ "commitSha": "df5296fe5935b093118455de1856279ea0aa4790",
191
+ "fullVersion": "6.4.2-gdf5296f",
192
+ "testedSha": "8b2980f93ad144dc81ba8c9866ed380a86396544"
193
193
  }
194
194
  }
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.setGlobalRequestInterceptor = setGlobalRequestInterceptor;
6
- exports.clearGlobalRequestInterceptor = clearGlobalRequestInterceptor;
7
- exports.createGlobalRequestInterceptor = createGlobalRequestInterceptor;
8
-
9
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
10
-
11
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
12
-
13
- var _idxJs = _interopRequireDefault(require("./idx-js"));
14
-
15
- /*!
16
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
17
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
18
- *
19
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- *
24
- * See the License for the specific language governing permissions and limitations under the License.
25
- *
26
- */
27
- // BETA - SUBJECT TO CHANGE
28
- // Currently we must modify request headers using the single instance of `idx.client.interceptors` exported from IDX-JS
29
- // This means that multiple instances of OktaAuth will see the same header modifications
30
- // TODO: use AuthJS http agent for IDX API requests. OKTA-417473
31
- function setGlobalRequestInterceptor(fn) {
32
- _idxJs.default.client.interceptors.request.use(fn);
33
- }
34
-
35
- function clearGlobalRequestInterceptor() {
36
- _idxJs.default.client.interceptors.request.clear();
37
- } // A factory which returns a function that can be passed to `setGlobalRequestInterceptor`
38
-
39
-
40
- function createGlobalRequestInterceptor(sdk) {
41
- return function (requestConfig) {
42
- // Set user-agent and any other custom headers set in the options
43
- var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();
44
-
45
- const headers = (0, _assign.default)({ ...oktaUserAgentHeader
46
- }, sdk.options.headers);
47
- (0, _keys.default)(headers).forEach(name => {
48
- // X-Device-Token may only be specified if the /interact request includes a `client_secret`
49
- // which indicates a trusted client which is allowed to present this information on behalf of the end user.
50
- // https://oktainc.atlassian.net/browse/OKTA-441021
51
- if (!sdk.options.clientSecret && name === 'X-Device-Token') {
52
- return;
53
- }
54
-
55
- requestConfig.headers[name] = headers[name];
56
- });
57
- };
58
- }
59
- //# sourceMappingURL=headers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/idx/headers.ts"],"names":["setGlobalRequestInterceptor","fn","idx","client","interceptors","request","use","clearGlobalRequestInterceptor","clear","createGlobalRequestInterceptor","sdk","requestConfig","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","headers","options","forEach","name","clientSecret"],"mappings":";;;;;;;;;;;;AAkBA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGO,SAASA,2BAAT,CAAqCC,EAArC,EAAyC;AAC9CC,iBAAIC,MAAJ,CAAWC,YAAX,CAAwBC,OAAxB,CAAgCC,GAAhC,CAAoCL,EAApC;AACD;;AAEM,SAASM,6BAAT,GAAyC;AAC9CL,iBAAIC,MAAJ,CAAWC,YAAX,CAAwBC,OAAxB,CAAgCG,KAAhC;AACD,C,CAED;;;AACO,SAASC,8BAAT,CAAwCC,GAAxC,EAAgE;AACrE,SAAO,UAAUC,aAAV,EAAyB;AAC9B;AACA,QAAIC,mBAAmB,GAAGF,GAAG,CAACG,cAAJ,CAAmBC,aAAnB,EAA1B;;AACA,UAAMC,OAAO,GAAG,qBAAc,EAC5B,GAAGH;AADyB,KAAd,EAEbF,GAAG,CAACM,OAAJ,CAAYD,OAFC,CAAhB;AAGA,uBAAYA,OAAZ,EAAqBE,OAArB,CAA6BC,IAAI,IAAI;AACnC;AACA;AACA;AACA,UAAI,CAACR,GAAG,CAACM,OAAJ,CAAYG,YAAb,IAA6BD,IAAI,KAAK,gBAA1C,EAA4D;AAC1D;AACD;;AACDP,MAAAA,aAAa,CAACI,OAAd,CAAsBG,IAAtB,IAA8BH,OAAO,CAACG,IAAD,CAArC;AACD,KARD;AASD,GAfD;AAgBD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\n// BETA - SUBJECT TO CHANGE\n// Currently we must modify request headers using the single instance of `idx.client.interceptors` exported from IDX-JS\n// This means that multiple instances of OktaAuth will see the same header modifications\n// TODO: use AuthJS http agent for IDX API requests. OKTA-417473\nimport { OktaAuthInterface } from '../types';\nimport idx from './idx-js';\nexport function setGlobalRequestInterceptor(fn) {\n idx.client.interceptors.request.use(fn);\n}\n\nexport function clearGlobalRequestInterceptor() {\n idx.client.interceptors.request.clear();\n}\n\n// A factory which returns a function that can be passed to `setGlobalRequestInterceptor`\nexport function createGlobalRequestInterceptor(sdk: OktaAuthInterface) {\n return function (requestConfig) {\n // Set user-agent and any other custom headers set in the options\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n const headers = Object.assign({\n ...oktaUserAgentHeader\n }, sdk.options.headers);\n Object.keys(headers).forEach(name => {\n // X-Device-Token may only be specified if the /interact request includes a `client_secret`\n // which indicates a trusted client which is allowed to present this information on behalf of the end user. \n // https://oktainc.atlassian.net/browse/OKTA-441021\n if (!sdk.options.clientSecret && name === 'X-Device-Token') {\n return;\n }\n requestConfig.headers[name] = headers[name];\n });\n };\n}\n"],"file":"headers.js"}
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.request = exports.HttpClient = exports.Interceptor = void 0;
6
-
7
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
8
-
9
- var _crossFetch = _interopRequireDefault(require("cross-fetch"));
10
-
11
- /*!
12
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
13
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
14
- *
15
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- *
20
- * See the License for the specific language governing permissions and limitations under the License.
21
- */
22
- // @ts-nocheck
23
-
24
- /**
25
- * Reusable interceptor interface
26
- */
27
- class Interceptor {
28
- constructor() {
29
- (0, _defineProperty2.default)(this, "handlers", []);
30
- }
31
-
32
- // Adds a new interceptor to our HttpClient
33
- use(before) {
34
- this.handlers.push({
35
- before
36
- });
37
- } // Clears all interceptors
38
-
39
-
40
- clear() {
41
- this.handlers = [];
42
- }
43
-
44
- }
45
- /**
46
- * Singleton instance of the IdX HTTP Client
47
- *
48
- * Invoke the `use` method to add a new interceptor:
49
- * - client.interceptors.request.use((requestConfig) => { some logic });
50
- */
51
-
52
-
53
- exports.Interceptor = Interceptor;
54
- const HttpClient = {
55
- interceptors: {
56
- request: new Interceptor()
57
- }
58
- };
59
- exports.HttpClient = HttpClient;
60
-
61
- const request = async (target, {
62
- method = 'POST',
63
- headers = {},
64
- credentials = 'include',
65
- body
66
- }) => {
67
- const requestOptions = {
68
- url: target,
69
- method,
70
- headers: { ...headers
71
- },
72
- credentials,
73
- body
74
- };
75
-
76
- if (HttpClient.interceptors) {
77
- HttpClient.interceptors.request.handlers.forEach(interceptor => {
78
- interceptor.before(requestOptions);
79
- });
80
- } // Extract the URL to adhere to the fetch API
81
-
82
-
83
- const {
84
- url
85
- } = requestOptions;
86
- delete requestOptions.url;
87
- return (0, _crossFetch.default)(url, requestOptions);
88
- };
89
-
90
- exports.request = request;
91
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/client.ts"],"names":["Interceptor","use","before","handlers","push","clear","HttpClient","interceptors","request","target","method","headers","credentials","body","requestOptions","url","forEach","interceptor"],"mappings":";;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AAGA;AACA;AACA;AACO,MAAMA,WAAN,CAAkB;AAAA;AAAA,oDACZ,EADY;AAAA;;AAGvB;AACAC,EAAAA,GAAG,CAACC,MAAD,EAAS;AACV,SAAKC,QAAL,CAAcC,IAAd,CAAmB;AACjBF,MAAAA;AADiB,KAAnB;AAGD,GARsB,CAUvB;;;AACAG,EAAAA,KAAK,GAAG;AACN,SAAKF,QAAL,GAAgB,EAAhB;AACD;;AAbsB;AAgBzB;AACA;AACA;AACA;AACA;AACA;;;;AACO,MAAMG,UAAU,GAAG;AACxBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,OAAO,EAAE,IAAIR,WAAJ;AADG;AADU,CAAnB;;;AAMA,MAAMQ,OAAO,GAAG,OACrBC,MADqB,EAErB;AACEC,EAAAA,MAAM,GAAG,MADX;AAEEC,EAAAA,OAAO,GAAG,EAFZ;AAGEC,EAAAA,WAAW,GAAG,SAHhB;AAIEC,EAAAA;AAJF,CAFqB,KAQlB;AACH,QAAMC,cAAc,GAAG;AACrBC,IAAAA,GAAG,EAAEN,MADgB;AAErBC,IAAAA,MAFqB;AAGrBC,IAAAA,OAAO,EAAE,EACP,GAAGA;AADI,KAHY;AAMrBC,IAAAA,WANqB;AAOrBC,IAAAA;AAPqB,GAAvB;;AAUA,MAAIP,UAAU,CAACC,YAAf,EAA6B;AAC3BD,IAAAA,UAAU,CAACC,YAAX,CAAwBC,OAAxB,CAAgCL,QAAhC,CAAyCa,OAAzC,CAAkDC,WAAW,IAAI;AAC/DA,MAAAA,WAAW,CAACf,MAAZ,CAAmBY,cAAnB;AACD,KAFD;AAGD,GAfE,CAiBH;;;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAUD,cAAhB;AACA,SAAOA,cAAc,CAACC,GAAtB;AAEA,SAAO,yBAAOA,GAAP,EAAYD,cAAZ,CAAP;AACD,CA9BM","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n// @ts-nocheck\nimport fetch from 'cross-fetch';\n\n/**\n * Reusable interceptor interface\n */\nexport class Interceptor {\n handlers = [];\n\n // Adds a new interceptor to our HttpClient\n use(before) {\n this.handlers.push({\n before,\n });\n }\n\n // Clears all interceptors\n clear() {\n this.handlers = [];\n }\n}\n\n/**\n * Singleton instance of the IdX HTTP Client\n *\n * Invoke the `use` method to add a new interceptor:\n * - client.interceptors.request.use((requestConfig) => { some logic });\n */\nexport const HttpClient = {\n interceptors: {\n request: new Interceptor(),\n },\n};\n\nexport const request = async (\n target, \n { \n method = 'POST', \n headers = {}, \n credentials = 'include', \n body \n }\n) => {\n const requestOptions = {\n url: target,\n method,\n headers: {\n ...headers,\n },\n credentials,\n body,\n };\n\n if (HttpClient.interceptors) {\n HttpClient.interceptors.request.handlers.forEach( interceptor => {\n interceptor.before(requestOptions);\n });\n }\n\n // Extract the URL to adhere to the fetch API\n const { url } = requestOptions;\n delete requestOptions.url;\n\n return fetch( url, requestOptions );\n};\n"],"file":"client.js"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.default = void 0;
6
-
7
- var _introspect = _interopRequireDefault(require("./introspect"));
8
-
9
- var _interact = _interopRequireDefault(require("./interact"));
10
-
11
- var _parsers = _interopRequireDefault(require("./parsers"));
12
-
13
- var _client = require("./client");
14
-
15
- /*!
16
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
17
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
18
- *
19
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- *
24
- * See the License for the specific language governing permissions and limitations under the License.
25
- */
26
- // @ts-nocheck
27
- const LATEST_SUPPORTED_IDX_API_VERSION = '1.0.0';
28
- const {
29
- makeIdxState
30
- } = (0, _parsers.default)(LATEST_SUPPORTED_IDX_API_VERSION);
31
- var _default = {
32
- introspect: _introspect.default,
33
- interact: _interact.default,
34
- makeIdxState,
35
- client: _client.HttpClient,
36
- LATEST_SUPPORTED_IDX_API_VERSION
37
- };
38
- exports.default = _default;
39
- module.exports = exports.default;
40
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/index.ts"],"names":["LATEST_SUPPORTED_IDX_API_VERSION","makeIdxState","introspect","interact","client","HttpClient"],"mappings":";;;;;;AAaA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAMA,MAAMA,gCAAgC,GAAG,OAAzC;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAmB,sBAAkBD,gCAAlB,CAAzB;eAEe;AACbE,EAAAA,UAAU,EAAVA,mBADa;AAEbC,EAAAA,QAAQ,EAARA,iBAFa;AAGbF,EAAAA,YAHa;AAIbG,EAAAA,MAAM,EAAEC,kBAJK;AAKbL,EAAAA;AALa,C","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n// @ts-nocheck\nimport introspect from './introspect';\nimport interact from './interact';\nimport parsersForVersion from './parsers';\nimport { HttpClient } from './client';\n\nconst LATEST_SUPPORTED_IDX_API_VERSION = '1.0.0';\n\nconst { makeIdxState } = parsersForVersion(LATEST_SUPPORTED_IDX_API_VERSION);\n\nexport default {\n introspect,\n interact,\n makeIdxState,\n client: HttpClient,\n LATEST_SUPPORTED_IDX_API_VERSION,\n};\n"],"file":"index.js"}
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.default = void 0;
6
-
7
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
8
-
9
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
10
-
11
- var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
12
-
13
- var _client = require("./client");
14
-
15
- /*!
16
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
17
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
18
- *
19
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- *
24
- * See the License for the specific language governing permissions and limitations under the License.
25
- */
26
-
27
- /* eslint-disable camelcase */
28
- // @ts-nocheck
29
- const parseAndReject = response => response.json().then(err => _promise.default.reject(err));
30
-
31
- const interact = async function interact({
32
- withCredentials,
33
- clientId,
34
- baseUrl,
35
- scopes = ['openid', 'email'],
36
- redirectUri,
37
- codeChallenge,
38
- codeChallengeMethod,
39
- state,
40
- activationToken,
41
- recoveryToken,
42
- clientSecret
43
- }) {
44
- var _context;
45
-
46
- const target = `${baseUrl}/v1/interact`;
47
- const params = {
48
- client_id: clientId,
49
- scope: scopes.join(' '),
50
- redirect_uri: redirectUri,
51
- code_challenge: codeChallenge,
52
- code_challenge_method: codeChallengeMethod,
53
- state
54
- };
55
-
56
- if (activationToken) {
57
- params.activation_token = activationToken;
58
- }
59
-
60
- if (recoveryToken) {
61
- params.recovery_token = recoveryToken;
62
- }
63
-
64
- if (clientSecret) {
65
- params.client_secret = clientSecret;
66
- }
67
-
68
- const body = (0, _map.default)(_context = (0, _entries.default)(params)).call(_context, ([param, value]) => `${param}=${encodeURIComponent(value)}`).join('&');
69
- const headers = {
70
- 'content-type': 'application/x-www-form-urlencoded'
71
- };
72
- const credentials = withCredentials === false ? 'omit' : 'include';
73
- return (0, _client.request)(target, {
74
- credentials,
75
- headers,
76
- body
77
- }).then(response => response.ok ? response.json() : parseAndReject(response)).then(data => data.interaction_handle);
78
- };
79
-
80
- var _default = interact;
81
- exports.default = _default;
82
- module.exports = exports.default;
83
- //# sourceMappingURL=interact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/interact.ts"],"names":["parseAndReject","response","json","then","err","reject","interact","withCredentials","clientId","baseUrl","scopes","redirectUri","codeChallenge","codeChallengeMethod","state","activationToken","recoveryToken","clientSecret","target","params","client_id","scope","join","redirect_uri","code_challenge","code_challenge_method","activation_token","recovery_token","client_secret","body","param","value","encodeURIComponent","headers","credentials","ok","data","interaction_handle"],"mappings":";;;;;;;;;;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAGA,MAAMA,cAAc,GAAGC,QAAQ,IAAIA,QAAQ,CAACC,IAAT,GAAgBC,IAAhB,CAAsBC,GAAG,IAAI,iBAAQC,MAAR,CAAeD,GAAf,CAA7B,CAAnC;;AAEA,MAAME,QAAQ,GAAG,eAAeA,QAAf,CAAwB;AACvCC,EAAAA,eADuC;AAEvCC,EAAAA,QAFuC;AAGvCC,EAAAA,OAHuC;AAIvCC,EAAAA,MAAM,GAAG,CAAC,QAAD,EAAW,OAAX,CAJ8B;AAKvCC,EAAAA,WALuC;AAMvCC,EAAAA,aANuC;AAOvCC,EAAAA,mBAPuC;AAQvCC,EAAAA,KARuC;AASvCC,EAAAA,eATuC;AAUvCC,EAAAA,aAVuC;AAWvCC,EAAAA;AAXuC,CAAxB,EAYd;AAAA;;AAED,QAAMC,MAAM,GAAI,GAAET,OAAQ,cAA1B;AACA,QAAMU,MAAM,GAAG;AACbC,IAAAA,SAAS,EAAEZ,QADE;AAEba,IAAAA,KAAK,EAAEX,MAAM,CAACY,IAAP,CAAY,GAAZ,CAFM;AAGbC,IAAAA,YAAY,EAAEZ,WAHD;AAIba,IAAAA,cAAc,EAAEZ,aAJH;AAKba,IAAAA,qBAAqB,EAAEZ,mBALV;AAMbC,IAAAA;AANa,GAAf;;AAQA,MAAIC,eAAJ,EAAqB;AACnBI,IAAAA,MAAM,CAACO,gBAAP,GAA0BX,eAA1B;AACD;;AACD,MAAIC,aAAJ,EAAmB;AACjBG,IAAAA,MAAM,CAACQ,cAAP,GAAwBX,aAAxB;AACD;;AACD,MAAIC,YAAJ,EAAkB;AAChBE,IAAAA,MAAM,CAACS,aAAP,GAAuBX,YAAvB;AACD;;AACD,QAAMY,IAAI,GAAG,mDAAeV,MAAf,kBACL,CAAC,CAACW,KAAD,EAAQC,KAAR,CAAD,KAAqB,GAAED,KAAM,IAAGE,kBAAkB,CAACD,KAAD,CAAQ,EADrD,EAEVT,IAFU,CAEL,GAFK,CAAb;AAGA,QAAMW,OAAO,GAAG;AACd,oBAAgB;AADF,GAAhB;AAGA,QAAMC,WAAW,GAAG3B,eAAe,KAAK,KAApB,GAA4B,MAA5B,GAAqC,SAAzD;AACA,SAAO,qBAAQW,MAAR,EAAgB;AAAEgB,IAAAA,WAAF;AAAeD,IAAAA,OAAf;AAAwBJ,IAAAA;AAAxB,GAAhB,EACJ1B,IADI,CACEF,QAAQ,IAAIA,QAAQ,CAACkC,EAAT,GAAclC,QAAQ,CAACC,IAAT,EAAd,GAAgCF,cAAc,CAAEC,QAAF,CAD5D,EAEJE,IAFI,CAEEiC,IAAI,IAAIA,IAAI,CAACC,kBAFf,CAAP;AAGD,CA1CD;;eA4Ce/B,Q","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable camelcase */\n// @ts-nocheck\nimport { request } from './client';\n\nconst parseAndReject = response => response.json().then( err => Promise.reject(err) );\n\nconst interact = async function interact({\n withCredentials,\n clientId,\n baseUrl,\n scopes = ['openid', 'email'],\n redirectUri,\n codeChallenge,\n codeChallengeMethod,\n state,\n activationToken,\n recoveryToken,\n clientSecret,\n}) {\n\n const target = `${baseUrl}/v1/interact`;\n const params = {\n client_id: clientId,\n scope: scopes.join(' '),\n redirect_uri: redirectUri,\n code_challenge: codeChallenge,\n code_challenge_method: codeChallengeMethod,\n state,\n };\n if (activationToken) {\n params.activation_token = activationToken;\n }\n if (recoveryToken) {\n params.recovery_token = recoveryToken;\n }\n if (clientSecret) {\n params.client_secret = clientSecret;\n }\n const body = Object.entries(params)\n .map( ([param, value]) => `${param}=${encodeURIComponent(value)}` )\n .join('&');\n const headers = {\n 'content-type': 'application/x-www-form-urlencoded',\n };\n const credentials = withCredentials === false ? 'omit' : 'include';\n return request(target, { credentials, headers, body })\n .then( response => response.ok ? response.json() : parseAndReject( response ) )\n .then( data => data.interaction_handle);\n};\n\nexport default interact;\n"],"file":"interact.js"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.default = void 0;
6
-
7
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
8
-
9
- var _client = require("./client");
10
-
11
- var _util = require("./util");
12
-
13
- /*!
14
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
15
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
16
- *
17
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- *
22
- * See the License for the specific language governing permissions and limitations under the License.
23
- */
24
- const introspect = async function introspect({
25
- withCredentials,
26
- domain,
27
- interactionHandle,
28
- stateHandle,
29
- version
30
- }) {
31
- (0, _util.validateVersionConfig)(version);
32
- const target = `${domain}/idp/idx/introspect`;
33
- const body = stateHandle ? {
34
- stateToken: stateHandle
35
- } : {
36
- interactionHandle
37
- };
38
- const headers = {
39
- 'content-type': `application/ion+json; okta-version=${version}`,
40
- // Server wants this version info
41
- accept: `application/ion+json; okta-version=${version}`
42
- };
43
- const credentials = withCredentials === false ? 'omit' : 'include';
44
- const response = await (0, _client.request)(target, {
45
- credentials,
46
- headers,
47
- body: (0, _stringify.default)(body)
48
- });
49
- const requestDidSucceed = response.ok;
50
- const rawIdxResponse = await response.json(); // Throw IDX response if request did not succeed. This behavior will be removed in version 7.0: OKTA-481844
51
-
52
- if (!requestDidSucceed) {
53
- throw rawIdxResponse;
54
- }
55
-
56
- return rawIdxResponse;
57
- };
58
-
59
- var _default = introspect;
60
- exports.default = _default;
61
- module.exports = exports.default;
62
- //# sourceMappingURL=introspect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/introspect.ts"],"names":["introspect","withCredentials","domain","interactionHandle","stateHandle","version","target","body","stateToken","headers","accept","credentials","response","requestDidSucceed","ok","rawIdxResponse","json"],"mappings":";;;;;;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA,MAAMA,UAAU,GAAG,eAAeA,UAAf,CAA0B;AAC3CC,EAAAA,eAD2C;AAE3CC,EAAAA,MAF2C;AAG3CC,EAAAA,iBAH2C;AAI3CC,EAAAA,WAJ2C;AAK3CC,EAAAA;AAL2C,CAA1B,EAM4B;AAC7C,mCAAsBA,OAAtB;AACA,QAAMC,MAAM,GAAI,GAAEJ,MAAO,qBAAzB;AACA,QAAMK,IAAI,GAAGH,WAAW,GAAG;AAAEI,IAAAA,UAAU,EAAEJ;AAAd,GAAH,GAAiC;AAAED,IAAAA;AAAF,GAAzD;AACA,QAAMM,OAAO,GAAG;AACd,oBAAiB,sCAAqCJ,OAAQ,EADhD;AACmD;AACjEK,IAAAA,MAAM,EAAG,sCAAqCL,OAAQ;AAFxC,GAAhB;AAIA,QAAMM,WAAW,GAAGV,eAAe,KAAK,KAApB,GAA4B,MAA5B,GAAqC,SAAzD;AACA,QAAMW,QAAQ,GAAG,MAAM,qBAAQN,MAAR,EAAgB;AAAEK,IAAAA,WAAF;AAAeF,IAAAA,OAAf;AAAwBF,IAAAA,IAAI,EAAE,wBAAeA,IAAf;AAA9B,GAAhB,CAAvB;AACA,QAAMM,iBAAiB,GAAGD,QAAQ,CAACE,EAAnC;AACA,QAAMC,cAAc,GAAG,MAAMH,QAAQ,CAACI,IAAT,EAA7B,CAX6C,CAa7C;;AACA,MAAI,CAACH,iBAAL,EAAwB;AACtB,UAAME,cAAN;AACD;;AACD,SAAOA,cAAP;AACD,CAxBD;;eA0Bef,U","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { RawIdxResponse } from '../types';\nimport { request } from './client';\nimport { validateVersionConfig } from './util';\n\nexport interface IntrospectOptions {\n domain: string;\n withCredentials?: boolean;\n interactionHandle?: string;\n stateHandle?: string;\n version?: string;\n}\n\nconst introspect = async function introspect({\n withCredentials,\n domain,\n interactionHandle,\n stateHandle,\n version,\n}: IntrospectOptions): Promise<RawIdxResponse> {\n validateVersionConfig(version);\n const target = `${domain}/idp/idx/introspect`;\n const body = stateHandle ? { stateToken: stateHandle } : { interactionHandle };\n const headers = {\n 'content-type': `application/ion+json; okta-version=${version}`, // Server wants this version info\n accept: `application/ion+json; okta-version=${version}`,\n };\n const credentials = withCredentials === false ? 'omit' : 'include';\n const response = await request(target, { credentials, headers, body: JSON.stringify(body) });\n const requestDidSucceed = response.ok;\n const rawIdxResponse = await response.json();\n\n // Throw IDX response if request did not succeed. This behavior will be removed in version 7.0: OKTA-481844\n if (!requestDidSucceed) {\n throw rawIdxResponse;\n }\n return rawIdxResponse;\n};\n\nexport default introspect;\n"],"file":"introspect.js"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.default = void 0;
6
-
7
- var _parsers = _interopRequireDefault(require("./v1/parsers"));
8
-
9
- /*!
10
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
11
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
12
- *
13
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- *
18
- * See the License for the specific language governing permissions and limitations under the License.
19
- */
20
- // We load all the current parsers, because we won't know in advance which version(s) we need to parse
21
- // Expect to only support current major - 1 (also suspect that this limit may never be hit)
22
- // @ts-nocheck
23
- // More granularity to be defined as needed
24
- const parsersForVersion = function parsersForVersion(version) {
25
- switch (version) {
26
- case '1.0.0':
27
- return _parsers.default;
28
-
29
- case undefined:
30
- case null:
31
- throw new Error('Api version is required');
32
-
33
- default:
34
- throw new Error(`Unknown api version: ${version}. Use an exact semver version.`);
35
- }
36
- };
37
-
38
- var _default = parsersForVersion;
39
- exports.default = _default;
40
- module.exports = exports.default;
41
- //# sourceMappingURL=parsers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/parsers.ts"],"names":["parsersForVersion","version","v1","undefined","Error"],"mappings":";;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AAC+B;AAE/B,MAAMA,iBAAiB,GAAG,SAASA,iBAAT,CAA4BC,OAA5B,EAAsC;AAC9D,UAAQA,OAAR;AACE,SAAK,OAAL;AACE,aAAOC,gBAAP;;AACF,SAAKC,SAAL;AACA,SAAK,IAAL;AACE,YAAM,IAAIC,KAAJ,CAAU,yBAAV,CAAN;;AACF;AACE,YAAM,IAAIA,KAAJ,CAAW,wBAAuBH,OAAQ,iCAA1C,CAAN;AAPJ;AASD,CAVD;;eAYeD,iB","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n// We load all the current parsers, because we won't know in advance which version(s) we need to parse\n// Expect to only support current major - 1 (also suspect that this limit may never be hit)\n\n// @ts-nocheck\nimport v1 from './v1/parsers'; // More granularity to be defined as needed\n\nconst parsersForVersion = function parsersForVersion( version ) {\n switch (version) {\n case '1.0.0':\n return v1;\n case undefined:\n case null:\n throw new Error('Api version is required');\n default:\n throw new Error(`Unknown api version: ${version}. Use an exact semver version.`);\n }\n};\n\nexport default parsersForVersion;\n"],"file":"parsers.js"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- exports.validateVersionConfig = validateVersionConfig;
6
-
7
- var _parsers = _interopRequireDefault(require("./parsers"));
8
-
9
- /*!
10
- * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
11
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
12
- *
13
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- *
18
- * See the License for the specific language governing permissions and limitations under the License.
19
- */
20
- // @ts-nocheck
21
- function validateVersionConfig(version) {
22
- if (!version) {
23
- throw new Error('version is required');
24
- }
25
-
26
- const cleanVersion = (version !== null && version !== void 0 ? version : '').replace(/[^0-9a-zA-Z._-]/, '');
27
-
28
- if (cleanVersion !== version || !version) {
29
- throw new Error('invalid version supplied - version is required and uses semver syntax');
30
- }
31
-
32
- (0, _parsers.default)(version); // will throw for invalid version
33
- }
34
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/idx-js/util.ts"],"names":["validateVersionConfig","version","Error","cleanVersion","replace"],"mappings":";;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIO,SAASA,qBAAT,CAA+BC,OAA/B,EAAwC;AAC7C,MAAK,CAACA,OAAN,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,qBAAV,CAAN;AACD;;AAED,QAAMC,YAAY,GAAG,CAACF,OAAD,aAACA,OAAD,cAACA,OAAD,GAAY,EAAZ,EAAgBG,OAAhB,CAAwB,iBAAxB,EAA2C,EAA3C,CAArB;;AACA,MAAKD,YAAY,KAAKF,OAAjB,IAA4B,CAACA,OAAlC,EAA4C;AAC1C,UAAM,IAAIC,KAAJ,CAAU,uEAAV,CAAN;AACD;;AAED,wBAAkBD,OAAlB,EAV6C,CAUjB;AAC7B","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n// @ts-nocheck\nimport parsersForVersion from './parsers';\n\n\nexport function validateVersionConfig(version) {\n if ( !version ) {\n throw new Error('version is required');\n }\n\n const cleanVersion = (version ?? '').replace(/[^0-9a-zA-Z._-]/, '');\n if ( cleanVersion !== version || !version ) {\n throw new Error('invalid version supplied - version is required and uses semver syntax');\n }\n\n parsersForVersion(version); // will throw for invalid version\n}\n"],"file":"util.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/actionParser.ts"],"names":["isFieldMutable","field","mutable","divideSingleActionParamsByMutability","action","defaultParamsForAction","neededParamsForAction","immutableParamsForAction","value","push","name","divideActionParamsByMutability","actionList","Array","isArray","neededParams","defaultParams","immutableParams"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA,MAAMA,cAAc,GAAG,SAASA,cAAT,CAAwBC,KAAxB,EAA+B;AACpD;AACA,SAASA,KAAK,CAACC,OAAN,KAAkB,KAA3B;AACD,CAHD;;AAKA,MAAMC,oCAAoC,GAAG,SAASA,oCAAT,CAA+CC,MAA/C,EAAwD;AACnG,QAAMC,sBAAsB,GAAG,EAA/B,CADmG,CAChE;;AACnC,QAAMC,qBAAqB,GAAG,EAA9B,CAFmG,CAEjE;;AAClC,QAAMC,wBAAwB,GAAG,EAAjC,CAHmG,CAG9D;AACrC;AACA;AACA;;AACA,MAAI,CAACH,MAAM,CAACI,KAAZ,EAAmB;AACjBF,IAAAA,qBAAqB,CAACG,IAAtB,CAA2BL,MAA3B;AACA,WAAO;AAAEC,MAAAA,sBAAF;AAA0BC,MAAAA,qBAA1B;AAAiDC,MAAAA;AAAjD,KAAP;AACD;;AAED,OAAM,IAAIN,KAAV,IAAmBG,MAAM,CAACI,KAA1B,EAAkC;AAEhC,QAAKR,cAAc,CAAEC,KAAF,CAAnB,EAA+B;AAAA;;AAE7BK,MAAAA,qBAAqB,CAACG,IAAtB,CAA2BR,KAA3B;;AAEA,0BAAKA,KAAK,CAACO,KAAX,uDAAoB,KAApB,EAA4B;AAC1BH,QAAAA,sBAAsB,CAACJ,KAAK,CAACS,IAAP,CAAtB,GAAqCT,KAAK,CAACO,KAA3C;AACD;AAEF,KARD,MAQO;AAAA;;AACLD,MAAAA,wBAAwB,CAACN,KAAK,CAACS,IAAP,CAAxB,oBAAuCT,KAAK,CAACO,KAA7C,yDAAsD,EAAtD;AACD;AACF;;AACD,SAAO;AAAEH,IAAAA,sBAAF;AAA0BC,IAAAA,qBAA1B;AAAiDC,IAAAA;AAAjD,GAAP;AACD,CA3BD;;AA6BO,MAAMI,8BAA8B,GAAG,SAASA,8BAAT,CAAyCC,UAAzC,EAAsD;AAClG;AACAA,EAAAA,UAAU,GAAGC,KAAK,CAACC,OAAN,CAAcF,UAAd,IAA4BA,UAA5B,GAAyC,CAAEA,UAAF,CAAtD;AACA,QAAMG,YAAY,GAAG,EAArB;AACA,QAAMC,aAAa,GAAG,EAAtB;AACA,QAAMC,eAAe,GAAG,EAAxB;;AAEA,OAAM,IAAIb,MAAV,IAAoBQ,UAApB,EAAiC;AAC/B,UAAM;AACJP,MAAAA,sBADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA;AAHI,QAIFJ,oCAAoC,CAACC,MAAD,CAJxC;AAKAW,IAAAA,YAAY,CAACN,IAAb,CAAkBH,qBAAlB;AACAU,IAAAA,aAAa,CAACZ,MAAM,CAACM,IAAR,CAAb,GAA6BL,sBAA7B;AACAY,IAAAA,eAAe,CAACb,MAAM,CAACM,IAAR,CAAf,GAA+BH,wBAA/B;AACD;;AAED,SAAO;AAAES,IAAAA,aAAF;AAAiBD,IAAAA,YAAjB;AAA+BE,IAAAA;AAA/B,GAAP;AACD,CAnBM","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n// @ts-nocheck\nconst isFieldMutable = function isFieldMutable(field) {\n // mutable defaults to true, annoyingly\n return ( field.mutable !== false );\n};\n\nconst divideSingleActionParamsByMutability = function divideSingleActionParamsByMutability( action ) {\n const defaultParamsForAction = {}; // mutable and present\n const neededParamsForAction = []; // mutable values\n const immutableParamsForAction = {}; // immutable\n // TODO: remove assumption that form names are unique, neededParams being an array is a temp fix\n // not all actions have value (e.g. redirect)\n // making sure they are not empty and instead hold the remediation object\n if (!action.value) {\n neededParamsForAction.push(action);\n return { defaultParamsForAction, neededParamsForAction, immutableParamsForAction };\n }\n\n for ( let field of action.value ) {\n\n if ( isFieldMutable( field ) ) {\n\n neededParamsForAction.push(field);\n\n if ( field.value ?? false ) {\n defaultParamsForAction[field.name] = field.value;\n }\n\n } else {\n immutableParamsForAction[field.name] = field.value ?? '';\n }\n }\n return { defaultParamsForAction, neededParamsForAction, immutableParamsForAction };\n};\n\nexport const divideActionParamsByMutability = function divideActionParamsByMutability( actionList ) {\n // TODO: when removing form name is unique assumption, this may all be redundant\n actionList = Array.isArray(actionList) ? actionList : [ actionList ];\n const neededParams = [];\n const defaultParams = {};\n const immutableParams = {};\n\n for ( let action of actionList ) {\n const { \n defaultParamsForAction, \n neededParamsForAction, \n immutableParamsForAction \n } = divideSingleActionParamsByMutability(action);\n neededParams.push(neededParamsForAction);\n defaultParams[action.name] = defaultParamsForAction;\n immutableParams[action.name] = immutableParamsForAction;\n }\n\n return { defaultParams, neededParams, immutableParams };\n};\n\n"],"file":"actionParser.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/generateIdxAction.ts"],"names":["generateDirectFetch","actionDefinition","defaultParamsForAction","immutableParamsForAction","toPersist","target","href","params","headers","accepts","body","credentials","withCredentials","response","method","responseJSON","json","requestDidSucceed","ok","idxResponse","status","get","stepUp","generateIdxAction","generator","defaultParams","neededParams","immutableParams","action","name"],"mappings":";;;;;;;;AAcA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAKA,MAAMA,mBAAmB,GAAG,SAASA,mBAAT,CAA6B;AACvDC,EAAAA,gBADuD;AAEvDC,EAAAA,sBAAsB,GAAG,EAF8B;AAGvDC,EAAAA,wBAAwB,GAAG,EAH4B;AAIvDC,EAAAA;AAJuD,CAA7B,EAKzB;AACD,QAAMC,MAAM,GAAGJ,gBAAgB,CAACK,IAAhC;AACA,SAAO,gBAAeC,MAAf,EAAuB;AAC5B,UAAMC,OAAO,GAAG;AACd,sBAAgB,kBADF;AAEd,gBAAUP,gBAAgB,CAACQ,OAAjB,IAA4B;AAFxB,KAAhB;AAIA,UAAMC,IAAI,GAAG,wBAAe,EAC1B,GAAGR,sBADuB;AAE1B,SAAGK,MAFuB;AAG1B,SAAGJ;AAHuB,KAAf,CAAb;AAKA,UAAMQ,WAAW,GAAGP,SAAS,IAAIA,SAAS,CAACQ,eAAV,KAA8B,KAA3C,GAAmD,MAAnD,GAA4D,SAAhF;AACA,UAAMC,QAAQ,GAAG,MAAM,qBAAQR,MAAR,EAAgB;AAAES,MAAAA,MAAM,EAAEb,gBAAgB,CAACa,MAA3B;AAAmCN,MAAAA,OAAnC;AAA4CE,MAAAA,IAA5C;AAAkDC,MAAAA;AAAlD,KAAhB,CAAvB;AACA,UAAMI,YAAY,GAAG,MAAMF,QAAQ,CAACG,IAAT,EAA3B;AACA,UAAMC,iBAAiB,GAAGJ,QAAQ,CAACK,EAAnC;AACA,UAAMC,WAAW,GAAG,gCAAaJ,YAAb,EAA2BX,SAA3B,EAAsCa,iBAAtC,CAApB;;AACA,QAAIJ,QAAQ,CAACO,MAAT,KAAoB,GAApB,IAA2BP,QAAQ,CAACL,OAAT,CAAiBa,GAAjB,CAAqB,kBAArB,MAA6C,mCAA5E,EAAiH;AAC/G;AACA;AACA;AACA;AACAF,MAAAA,WAAW,CAACG,MAAZ,GAAqB,IAArB;AACD,KArB2B,CAuB3B;;;AACA,QAAI,CAACL,iBAAL,EAAwB;AACtB,YAAME,WAAN;AACD;;AAEF,WAAOA,WAAP;AACD,GA7BD;AA8BD,CArCD,C,CAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,MAAMI,iBAAiB,GAAG,SAASA,iBAAT,CAA4BtB,gBAA5B,EAA8CG,SAA9C,EAA0D;AAClF;AACA;AACA,QAAMoB,SAAS,GAAGxB,mBAAlB;AACA,QAAM;AAAEyB,IAAAA,aAAF;AAAiBC,IAAAA,YAAjB;AAA+BC,IAAAA;AAA/B,MAAmD,kDAAgC1B,gBAAhC,CAAzD;AAEA,QAAM2B,MAAM,GAAGJ,SAAS,CAAE;AACxBvB,IAAAA,gBADwB;AAExBC,IAAAA,sBAAsB,EAAEuB,aAAa,CAACxB,gBAAgB,CAAC4B,IAAlB,CAFb;AAGxB1B,IAAAA,wBAAwB,EAAEwB,eAAe,CAAC1B,gBAAgB,CAAC4B,IAAlB,CAHjB;AAIxBzB,IAAAA;AAJwB,GAAF,CAAxB;AAMAwB,EAAAA,MAAM,CAACF,YAAP,GAAsBA,YAAtB;AACA,SAAOE,MAAP;AACD,CAdD;;eAgBeL,iB","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable max-len */\n// @ts-nocheck\nimport { request } from '../client';\nimport { divideActionParamsByMutability } from './actionParser';\nimport { makeIdxState } from './makeIdxState';\n\nconst generateDirectFetch = function generateDirectFetch({ \n actionDefinition, \n defaultParamsForAction = {}, \n immutableParamsForAction = {}, \n toPersist \n}) {\n const target = actionDefinition.href;\n return async function(params) {\n const headers = {\n 'content-type': 'application/json',\n 'accept': actionDefinition.accepts || 'application/ion+json',\n };\n const body = JSON.stringify({\n ...defaultParamsForAction,\n ...params,\n ...immutableParamsForAction\n });\n const credentials = toPersist && toPersist.withCredentials === false ? 'omit' : 'include';\n const response = await request(target, { method: actionDefinition.method, headers, body, credentials });\n const responseJSON = await response.json();\n const requestDidSucceed = response.ok;\n const idxResponse = makeIdxState(responseJSON, toPersist, requestDidSucceed);\n if (response.status === 401 && response.headers.get('WWW-Authenticate') === 'Oktadevicejwt realm=\"Okta Device\"') {\n // Okta server responds 401 status code with WWW-Authenticate header and new remediation\n // so that the iOS/MacOS credential SSO extension (Okta Verify) can intercept\n // the response reaches here when Okta Verify is not installed\n // set `stepUp` to true if flow should be continued without showing any errors\n idxResponse.stepUp = true;\n }\n\n // Throw IDX response if request did not succeed. This behavior will be removed in version 7.0: OKTA-481844\n if (!requestDidSucceed) {\n throw idxResponse;\n }\n\n return idxResponse;\n };\n};\n\n// TODO: Resolve in M2: Either build the final polling solution or remove this code\n// const generatePollingFetch = function generatePollingFetch( { actionDefinition, defaultParamsForAction = {}, immutableParamsForAction = {} } ) {\n// // TODO: Discussions ongoing about when/how to terminate polling: OKTA-246581\n// const target = actionDefinition.href;\n// return async function(params) {\n// return fetch(target, {\n// method: actionDefinition.method,\n// headers: {\n// 'content-type': actionDefinition.accepts,\n// },\n// body: JSON.stringify({ ...defaultParamsForAction, ...params, ...immutableParamsForAction })\n// })\n// .then( response => response.ok ? response.json() : response.json().then( err => Promise.reject(err)) )\n// .then( idxResponse => makeIdxState(idxResponse) );\n// };\n// };\n\nconst generateIdxAction = function generateIdxAction( actionDefinition, toPersist ) {\n // TODO: leaving this here to see where the polling is EXPECTED to drop into the code, but removing any accidental trigger of incomplete code\n // const generator = actionDefinition.refresh ? generatePollingFetch : generateDirectFetch;\n const generator = generateDirectFetch;\n const { defaultParams, neededParams, immutableParams } = divideActionParamsByMutability( actionDefinition );\n\n const action = generator( {\n actionDefinition,\n defaultParamsForAction: defaultParams[actionDefinition.name],\n immutableParamsForAction: immutableParams[actionDefinition.name],\n toPersist\n });\n action.neededParams = neededParams;\n return action;\n};\n\nexport default generateIdxAction;\n"],"file":"generateIdxAction.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/idxResponseParser.ts"],"names":["SKIP_FIELDS","field","parseNonRemediations","idxResponse","toPersist","actions","context","forEach","fieldIsObject","rel","name","value","fieldValue","type","info","subField","expandRelatesTo","k","query","Array","isArray","result","path","json","innerValue","convertRemediationAction","remediation","remediationActions","actionFn","action","parseIdxResponse","remediationData","remediations"],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable max-len */\n// @ts-nocheck\nimport { generateRemediationFunctions } from './remediationParser';\nimport generateIdxAction from './generateIdxAction';\nimport { JSONPath } from 'jsonpath-plus';\n\nconst SKIP_FIELDS = Object.fromEntries([\n 'remediation', // remediations are put into proceed/neededToProceed\n 'context', // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context\n].map( (field) => [ field, !!'skip this field' ] ));\n\nexport const parseNonRemediations = function parseNonRemediations( idxResponse, toPersist = {} ) {\n const actions = {};\n const context = {};\n\n Object.keys(idxResponse)\n .filter( field => !SKIP_FIELDS[field])\n .forEach( field => {\n const fieldIsObject = typeof idxResponse[field] === 'object' && !!idxResponse[field];\n\n if ( !fieldIsObject ) {\n // simple fields are contextual info\n context[field] = idxResponse[field];\n return;\n }\n\n if ( idxResponse[field].rel ) {\n // top level actions\n actions[idxResponse[field].name] = generateIdxAction(idxResponse[field], toPersist);\n return;\n }\n\n const { value: fieldValue, type, ...info} = idxResponse[field];\n context[field] = { type, ...info}; // add the non-action parts as context\n\n if ( type !== 'object' ) {\n // only object values hold actions\n context[field].value = fieldValue;\n return;\n }\n\n // We are an object field containing an object value\n context[field].value = {};\n Object.entries(fieldValue)\n .forEach( ([subField, value]) => {\n if (value.rel) { // is [field].value[subField] an action?\n // add any \"action\" value subfields to actions\n actions[`${field}-${subField.name || subField}`] = generateIdxAction(value, toPersist);\n } else {\n // add non-action value subfields to context\n context[field].value[subField] = value;\n }\n });\n });\n\n return { context, actions };\n};\n\nconst expandRelatesTo = (idxResponse, value) => {\n Object.keys(value).forEach(k => {\n if (k === 'relatesTo') {\n const query = Array.isArray(value[k]) ? value[k][0] : value[k];\n if (typeof query === 'string') {\n // eslint-disable-next-line new-cap\n const result = JSONPath({ path: query, json: idxResponse })[0];\n if (result) {\n value[k] = result;\n return;\n }\n }\n }\n if (Array.isArray(value[k])) {\n value[k].forEach(innerValue => expandRelatesTo(idxResponse, innerValue));\n }\n });\n};\n\nconst convertRemediationAction = (remediation, toPersist) => {\n const remediationActions = generateRemediationFunctions( [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n};\n\nexport const parseIdxResponse = function parseIdxResponse( idxResponse, toPersist = {} ): {\n remediations: IdxRemediation[];\n context: IdxContext;\n actions: IdxActions;\n} {\n const remediationData = idxResponse.remediation?.value || [];\n\n remediationData.forEach(\n remediation => expandRelatesTo(idxResponse, remediation)\n );\n\n const remediations = remediationData.map(remediation => convertRemediationAction( remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"file":"idxResponseParser.js"}