@forgerock/journey-client 0.0.0-beta-20260319165545 → 2.0.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.
Files changed (183) hide show
  1. package/dist/package.json +70 -0
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +9 -0
  5. package/dist/src/lib/callbacks/attribute-input-callback.d.ts +44 -0
  6. package/dist/src/lib/callbacks/attribute-input-callback.d.ts.map +1 -0
  7. package/dist/src/lib/callbacks/attribute-input-callback.js +71 -0
  8. package/dist/src/lib/callbacks/base-callback.d.ts +45 -0
  9. package/dist/src/lib/callbacks/base-callback.d.ts.map +1 -0
  10. package/dist/src/lib/callbacks/base-callback.js +88 -0
  11. package/dist/src/lib/callbacks/choice-callback.d.ts +33 -0
  12. package/dist/src/lib/callbacks/choice-callback.d.ts.map +1 -0
  13. package/dist/src/lib/callbacks/choice-callback.js +57 -0
  14. package/dist/src/lib/callbacks/confirmation-callback.d.ts +41 -0
  15. package/dist/src/lib/callbacks/confirmation-callback.d.ts.map +1 -0
  16. package/dist/src/lib/callbacks/confirmation-callback.js +69 -0
  17. package/dist/src/lib/callbacks/device-profile-callback.d.ts +30 -0
  18. package/dist/src/lib/callbacks/device-profile-callback.d.ts.map +1 -0
  19. package/dist/src/lib/callbacks/device-profile-callback.js +43 -0
  20. package/dist/src/lib/callbacks/factory.d.ts +8 -0
  21. package/dist/src/lib/callbacks/factory.d.ts.map +1 -0
  22. package/dist/src/lib/callbacks/factory.js +87 -0
  23. package/dist/src/lib/callbacks/hidden-value-callback.d.ts +13 -0
  24. package/dist/src/lib/callbacks/hidden-value-callback.d.ts.map +1 -0
  25. package/dist/src/lib/callbacks/hidden-value-callback.js +19 -0
  26. package/dist/src/lib/callbacks/kba-create-callback.d.ts +34 -0
  27. package/dist/src/lib/callbacks/kba-create-callback.d.ts.map +1 -0
  28. package/dist/src/lib/callbacks/kba-create-callback.js +59 -0
  29. package/dist/src/lib/callbacks/metadata-callback.d.ts +17 -0
  30. package/dist/src/lib/callbacks/metadata-callback.d.ts.map +1 -0
  31. package/dist/src/lib/callbacks/metadata-callback.js +25 -0
  32. package/dist/src/lib/callbacks/name-callback.d.ts +21 -0
  33. package/dist/src/lib/callbacks/name-callback.d.ts.map +1 -0
  34. package/dist/src/lib/callbacks/name-callback.js +31 -0
  35. package/dist/src/lib/callbacks/password-callback.d.ts +29 -0
  36. package/dist/src/lib/callbacks/password-callback.d.ts.map +1 -0
  37. package/dist/src/lib/callbacks/password-callback.js +43 -0
  38. package/dist/src/lib/callbacks/ping-protect-evaluation-callback.d.ts +52 -0
  39. package/dist/src/lib/callbacks/ping-protect-evaluation-callback.d.ts.map +1 -0
  40. package/dist/src/lib/callbacks/ping-protect-evaluation-callback.js +64 -0
  41. package/dist/src/lib/callbacks/ping-protect-initialize-callback.d.ts +29 -0
  42. package/dist/src/lib/callbacks/ping-protect-initialize-callback.d.ts.map +1 -0
  43. package/dist/src/lib/callbacks/ping-protect-initialize-callback.js +40 -0
  44. package/dist/src/lib/callbacks/polling-wait-callback.d.ts +21 -0
  45. package/dist/src/lib/callbacks/polling-wait-callback.d.ts.map +1 -0
  46. package/dist/src/lib/callbacks/polling-wait-callback.js +31 -0
  47. package/dist/src/lib/callbacks/recaptcha-callback.d.ts +21 -0
  48. package/dist/src/lib/callbacks/recaptcha-callback.d.ts.map +1 -0
  49. package/dist/src/lib/callbacks/recaptcha-callback.js +31 -0
  50. package/dist/src/lib/callbacks/recaptcha-enterprise-callback.d.ts +41 -0
  51. package/dist/src/lib/callbacks/recaptcha-enterprise-callback.d.ts.map +1 -0
  52. package/dist/src/lib/callbacks/recaptcha-enterprise-callback.js +65 -0
  53. package/dist/src/lib/callbacks/redirect-callback.d.ts +17 -0
  54. package/dist/src/lib/callbacks/redirect-callback.d.ts.map +1 -0
  55. package/dist/src/lib/callbacks/redirect-callback.js +25 -0
  56. package/dist/src/lib/callbacks/select-idp-callback.d.ts +28 -0
  57. package/dist/src/lib/callbacks/select-idp-callback.d.ts.map +1 -0
  58. package/dist/src/lib/callbacks/select-idp-callback.js +35 -0
  59. package/dist/src/lib/callbacks/suspended-text-output-callback.d.ts +13 -0
  60. package/dist/src/lib/callbacks/suspended-text-output-callback.d.ts.map +1 -0
  61. package/dist/src/lib/callbacks/suspended-text-output-callback.js +19 -0
  62. package/dist/src/lib/callbacks/terms-and-conditions-callback.d.ts +29 -0
  63. package/dist/src/lib/callbacks/terms-and-conditions-callback.d.ts.map +1 -0
  64. package/dist/src/lib/callbacks/terms-and-conditions-callback.js +45 -0
  65. package/dist/src/lib/callbacks/text-input-callback.d.ts +21 -0
  66. package/dist/src/lib/callbacks/text-input-callback.d.ts.map +1 -0
  67. package/dist/src/lib/callbacks/text-input-callback.js +31 -0
  68. package/dist/src/lib/callbacks/text-output-callback.d.ts +22 -0
  69. package/dist/src/lib/callbacks/text-output-callback.d.ts.map +1 -0
  70. package/dist/src/lib/callbacks/text-output-callback.js +32 -0
  71. package/dist/src/lib/callbacks/validated-create-password-callback.d.ts +37 -0
  72. package/dist/src/lib/callbacks/validated-create-password-callback.d.ts.map +1 -0
  73. package/dist/src/lib/callbacks/validated-create-password-callback.js +63 -0
  74. package/dist/src/lib/callbacks/validated-create-username-callback.d.ts +37 -0
  75. package/dist/src/lib/callbacks/validated-create-username-callback.d.ts.map +1 -0
  76. package/dist/src/lib/callbacks/validated-create-username-callback.js +64 -0
  77. package/dist/src/lib/client.store.d.ts +59 -0
  78. package/dist/src/lib/client.store.d.ts.map +1 -0
  79. package/dist/src/lib/client.store.js +186 -0
  80. package/dist/src/lib/client.store.utils.d.ts +81 -0
  81. package/dist/src/lib/client.store.utils.d.ts.map +1 -0
  82. package/dist/src/lib/client.store.utils.js +31 -0
  83. package/dist/src/lib/client.types.d.ts +2 -0
  84. package/dist/src/lib/client.types.d.ts.map +1 -0
  85. package/dist/src/lib/client.types.js +1 -0
  86. package/dist/src/lib/client.types.test-d.d.ts +2 -0
  87. package/dist/src/lib/client.types.test-d.d.ts.map +1 -0
  88. package/dist/src/lib/client.types.test-d.js +18 -0
  89. package/dist/src/lib/config.slice.d.ts +23 -0
  90. package/dist/src/lib/config.slice.d.ts.map +1 -0
  91. package/dist/src/lib/config.slice.js +35 -0
  92. package/dist/src/lib/config.types.d.ts +38 -0
  93. package/dist/src/lib/config.types.d.ts.map +1 -0
  94. package/dist/src/lib/config.types.js +7 -0
  95. package/dist/src/lib/device/defaults.d.ts +13 -0
  96. package/dist/src/lib/device/defaults.d.ts.map +1 -0
  97. package/dist/src/lib/device/defaults.js +78 -0
  98. package/dist/src/lib/device/device-profile.d.ts +41 -0
  99. package/dist/src/lib/device/device-profile.d.ts.map +1 -0
  100. package/dist/src/lib/device/device-profile.js +216 -0
  101. package/dist/src/lib/device/device-profile.mock.data.d.ts +109 -0
  102. package/dist/src/lib/device/device-profile.mock.data.d.ts.map +1 -0
  103. package/dist/src/lib/device/device-profile.mock.data.js +117 -0
  104. package/dist/src/lib/device/interfaces.d.ts +43 -0
  105. package/dist/src/lib/device/interfaces.d.ts.map +1 -0
  106. package/dist/src/lib/device/interfaces.js +10 -0
  107. package/dist/src/lib/interfaces.d.ts +14 -0
  108. package/dist/src/lib/interfaces.d.ts.map +1 -0
  109. package/dist/src/lib/interfaces.js +7 -0
  110. package/dist/src/lib/journey.api.d.ts +15 -0
  111. package/dist/src/lib/journey.api.d.ts.map +1 -0
  112. package/dist/src/lib/journey.api.js +125 -0
  113. package/dist/src/lib/journey.utils.d.ts +15 -0
  114. package/dist/src/lib/journey.utils.d.ts.map +1 -0
  115. package/dist/src/lib/journey.utils.js +45 -0
  116. package/dist/src/lib/login-failure.utils.d.ts +16 -0
  117. package/dist/src/lib/login-failure.utils.d.ts.map +1 -0
  118. package/dist/src/lib/login-failure.utils.js +34 -0
  119. package/dist/src/lib/login-success.utils.d.ts +16 -0
  120. package/dist/src/lib/login-success.utils.d.ts.map +1 -0
  121. package/dist/src/lib/login-success.utils.js +25 -0
  122. package/dist/src/lib/policy/interfaces.d.ts +11 -0
  123. package/dist/src/lib/policy/interfaces.d.ts.map +1 -0
  124. package/dist/src/lib/policy/interfaces.js +6 -0
  125. package/dist/src/lib/policy/message-creator.d.ts +3 -0
  126. package/dist/src/lib/policy/message-creator.d.ts.map +1 -0
  127. package/dist/src/lib/policy/message-creator.js +58 -0
  128. package/dist/src/lib/policy/policy.d.ts +57 -0
  129. package/dist/src/lib/policy/policy.d.ts.map +1 -0
  130. package/dist/src/lib/policy/policy.js +108 -0
  131. package/dist/src/lib/qr-code/qr-code.d.ts +35 -0
  132. package/dist/src/lib/qr-code/qr-code.d.ts.map +1 -0
  133. package/dist/src/lib/qr-code/qr-code.js +73 -0
  134. package/dist/src/lib/qr-code/qr-code.mock.data.d.ts +66 -0
  135. package/dist/src/lib/qr-code/qr-code.mock.data.d.ts.map +1 -0
  136. package/dist/src/lib/qr-code/qr-code.mock.data.js +175 -0
  137. package/dist/src/lib/recovery-codes/recovery-codes.d.ts +40 -0
  138. package/dist/src/lib/recovery-codes/recovery-codes.d.ts.map +1 -0
  139. package/dist/src/lib/recovery-codes/recovery-codes.js +64 -0
  140. package/dist/src/lib/recovery-codes/script-parser.d.ts +8 -0
  141. package/dist/src/lib/recovery-codes/script-parser.d.ts.map +1 -0
  142. package/dist/src/lib/recovery-codes/script-parser.js +45 -0
  143. package/dist/src/lib/recovery-codes/script-text.mock.data.d.ts +27 -0
  144. package/dist/src/lib/recovery-codes/script-text.mock.data.d.ts.map +1 -0
  145. package/dist/src/lib/recovery-codes/script-text.mock.data.js +103 -0
  146. package/dist/src/lib/step.types.d.ts +14 -0
  147. package/dist/src/lib/step.types.d.ts.map +1 -0
  148. package/dist/src/lib/step.types.js +7 -0
  149. package/dist/src/lib/step.utils.d.ts +10 -0
  150. package/dist/src/lib/step.utils.d.ts.map +1 -0
  151. package/dist/src/lib/step.utils.js +62 -0
  152. package/dist/src/lib/webauthn/enums.d.ts +24 -0
  153. package/dist/src/lib/webauthn/enums.d.ts.map +1 -0
  154. package/dist/src/lib/webauthn/enums.js +35 -0
  155. package/dist/src/lib/webauthn/helpers.d.ts +18 -0
  156. package/dist/src/lib/webauthn/helpers.d.ts.map +1 -0
  157. package/dist/src/lib/webauthn/helpers.js +103 -0
  158. package/dist/src/lib/webauthn/helpers.mock.data.d.ts +6 -0
  159. package/dist/src/lib/webauthn/helpers.mock.data.d.ts.map +1 -0
  160. package/dist/src/lib/webauthn/helpers.mock.data.js +14 -0
  161. package/dist/src/lib/webauthn/interfaces.d.ts +92 -0
  162. package/dist/src/lib/webauthn/interfaces.d.ts.map +1 -0
  163. package/dist/src/lib/webauthn/interfaces.js +34 -0
  164. package/dist/src/lib/webauthn/script-text.mock.data.d.ts +76 -0
  165. package/dist/src/lib/webauthn/script-text.mock.data.d.ts.map +1 -0
  166. package/dist/src/lib/webauthn/script-text.mock.data.js +451 -0
  167. package/dist/src/lib/webauthn/webauthn.d.ts +124 -0
  168. package/dist/src/lib/webauthn/webauthn.d.ts.map +1 -0
  169. package/dist/src/lib/webauthn/webauthn.js +383 -0
  170. package/dist/src/lib/webauthn/webauthn.mock.data.d.ts +331 -0
  171. package/dist/src/lib/webauthn/webauthn.mock.data.d.ts.map +1 -0
  172. package/dist/src/lib/webauthn/webauthn.mock.data.js +446 -0
  173. package/dist/src/lib/wellknown.api.d.ts +13 -0
  174. package/dist/src/lib/wellknown.api.d.ts.map +1 -0
  175. package/dist/src/lib/wellknown.api.js +30 -0
  176. package/dist/src/lib/wellknown.utils.d.ts +45 -0
  177. package/dist/src/lib/wellknown.utils.d.ts.map +1 -0
  178. package/dist/src/lib/wellknown.utils.js +67 -0
  179. package/dist/src/types.d.ts +33 -0
  180. package/dist/src/types.d.ts.map +1 -0
  181. package/dist/src/types.js +37 -0
  182. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  183. package/package.json +7 -7
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@forgerock/journey-client",
3
+ "version": "2.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/ForgeRock/ping-javascript-sdk.git",
7
+ "directory": "packages/journey-client"
8
+ },
9
+ "type": "module",
10
+ "exports": {
11
+ ".": "./dist/src/index.js",
12
+ "./device": "./dist/src/lib/device/device-profile.js",
13
+ "./package.json": "./package.json",
14
+ "./policy": "./dist/src/lib/policy/policy.js",
15
+ "./qr-code": "./dist/src/lib/qr-code/qr-code.js",
16
+ "./recovery-codes": "./dist/src/lib/recovery-codes/recovery-codes.js",
17
+ "./types": "./dist/src/types.d.ts",
18
+ "./webauthn": "./dist/src/lib/webauthn/webauthn.js"
19
+ },
20
+ "main": "./dist/src/index.js",
21
+ "module": "./dist/src/index.js",
22
+ "types": "./dist/src/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "pnpm nx nxBuild",
28
+ "lint": "pnpm nx nxLint",
29
+ "test": "pnpm nx nxTest",
30
+ "test:watch": "pnpm nx nxTest --watch"
31
+ },
32
+ "dependencies": {
33
+ "@forgerock/sdk-logger": "workspace:*",
34
+ "@forgerock/sdk-oidc": "workspace:*",
35
+ "@forgerock/sdk-request-middleware": "workspace:*",
36
+ "@forgerock/sdk-types": "workspace:*",
37
+ "@forgerock/sdk-utilities": "workspace:*",
38
+ "@forgerock/storage": "workspace:*",
39
+ "@reduxjs/toolkit": "catalog:",
40
+ "tslib": "^2.3.0"
41
+ },
42
+ "devDependencies": {
43
+ "@vitest/coverage-v8": "catalog:vitest",
44
+ "vite": "catalog:vite",
45
+ "vitest": "catalog:vitest",
46
+ "vitest-canvas-mock": "catalog:vitest"
47
+ },
48
+ "nx": {
49
+ "tags": [
50
+ "scope:package"
51
+ ],
52
+ "implicitDependencies": [],
53
+ "targets": {
54
+ "build": {
55
+ "executor": "@nx/js:tsc",
56
+ "outputs": [
57
+ "{options.outputPath}"
58
+ ],
59
+ "options": {
60
+ "outputPath": "packages/journey-client/dist",
61
+ "main": "packages/journey-client/src/index.ts",
62
+ "tsConfig": "packages/journey-client/tsconfig.lib.json",
63
+ "format": [
64
+ "esm"
65
+ ]
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/client.store.js';
2
+ export { callbackType } from '@forgerock/sdk-types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2020 - 2025 Ping Identity Corporation. All rights reserved.
3
+ *
4
+ * This software may be modified and distributed under the terms
5
+ * of the MIT license. See the LICENSE file for details.
6
+ */
7
+ export * from './lib/client.store.js';
8
+ // Re-export types from internal packages that consumers need
9
+ export { callbackType } from '@forgerock/sdk-types';
@@ -0,0 +1,44 @@
1
+ import type { Callback, PolicyRequirement } from '@forgerock/sdk-types';
2
+ import { BaseCallback } from './base-callback.js';
3
+ /**
4
+ * Represents a callback used to collect attributes.
5
+ *
6
+ * @typeparam T Maps to StringAttributeInputCallback, NumberAttributeInputCallback and
7
+ * BooleanAttributeInputCallback, respectively
8
+ */
9
+ export declare class AttributeInputCallback<T extends string | number | boolean> extends BaseCallback {
10
+ payload: Callback;
11
+ /**
12
+ * @param payload The raw payload returned by OpenAM
13
+ */
14
+ constructor(payload: Callback);
15
+ /**
16
+ * Gets the attribute name.
17
+ */
18
+ getName(): string;
19
+ /**
20
+ * Gets the attribute prompt.
21
+ */
22
+ getPrompt(): string;
23
+ /**
24
+ * Gets whether the attribute is required.
25
+ */
26
+ isRequired(): boolean;
27
+ /**
28
+ * Gets the callback's failed policies.
29
+ */
30
+ getFailedPolicies(): PolicyRequirement[];
31
+ /**
32
+ * Gets the callback's applicable policies.
33
+ */
34
+ getPolicies(): Record<string, unknown>;
35
+ /**
36
+ * Set if validating value only.
37
+ */
38
+ setValidateOnly(value: boolean): void;
39
+ /**
40
+ * Sets the attribute's value.
41
+ */
42
+ setValue(value: T): void;
43
+ }
44
+ //# sourceMappingURL=attribute-input-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-input-callback.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/attribute-input-callback.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;GAKG;AACH,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,CAAE,SAAQ,YAAY;IAI/D,OAAO,EAAE,QAAQ;IAH7C;;OAEG;gBACyB,OAAO,EAAE,QAAQ;IAI7C;;OAEG;IACI,OAAO,IAAI,MAAM;IAIxB;;OAEG;IACI,SAAS,IAAI,MAAM;IAI1B;;OAEG;IACI,UAAU,IAAI,OAAO;IAI5B;;OAEG;IACI,iBAAiB,IAAI,iBAAiB,EAAE;IAW/C;;OAEG;IACI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI7C;;OAEG;IACI,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAI5C;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAGhC"}
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
3
+ *
4
+ * This software may be modified and distributed under the terms
5
+ * of the MIT license. See the LICENSE file for details.
6
+ */
7
+ import { BaseCallback } from './base-callback.js';
8
+ /**
9
+ * Represents a callback used to collect attributes.
10
+ *
11
+ * @typeparam T Maps to StringAttributeInputCallback, NumberAttributeInputCallback and
12
+ * BooleanAttributeInputCallback, respectively
13
+ */
14
+ export class AttributeInputCallback extends BaseCallback {
15
+ payload;
16
+ /**
17
+ * @param payload The raw payload returned by OpenAM
18
+ */
19
+ constructor(payload) {
20
+ super(payload);
21
+ this.payload = payload;
22
+ }
23
+ /**
24
+ * Gets the attribute name.
25
+ */
26
+ getName() {
27
+ return this.getOutputByName('name', '');
28
+ }
29
+ /**
30
+ * Gets the attribute prompt.
31
+ */
32
+ getPrompt() {
33
+ return this.getOutputByName('prompt', '');
34
+ }
35
+ /**
36
+ * Gets whether the attribute is required.
37
+ */
38
+ isRequired() {
39
+ return this.getOutputByName('required', false);
40
+ }
41
+ /**
42
+ * Gets the callback's failed policies.
43
+ */
44
+ getFailedPolicies() {
45
+ const failedPoliciesJsonStrings = this.getOutputByName('failedPolicies', []);
46
+ try {
47
+ return failedPoliciesJsonStrings.map((v) => JSON.parse(v));
48
+ }
49
+ catch {
50
+ throw new Error('Unable to parse "failed policies" from the ForgeRock server. The JSON within `AttributeInputCallback` was either malformed or missing.');
51
+ }
52
+ }
53
+ /**
54
+ * Gets the callback's applicable policies.
55
+ */
56
+ getPolicies() {
57
+ return this.getOutputByName('policies', {});
58
+ }
59
+ /**
60
+ * Set if validating value only.
61
+ */
62
+ setValidateOnly(value) {
63
+ this.setInputValue(value, /validateOnly/);
64
+ }
65
+ /**
66
+ * Sets the attribute's value.
67
+ */
68
+ setValue(value) {
69
+ this.setInputValue(value);
70
+ }
71
+ }
@@ -0,0 +1,45 @@
1
+ import type { CallbackType, Callback } from '@forgerock/sdk-types';
2
+ /**
3
+ * Base class for authentication tree callback wrappers.
4
+ */
5
+ export declare class BaseCallback {
6
+ payload: Callback;
7
+ /**
8
+ * @param payload The raw payload returned by OpenAM
9
+ */
10
+ constructor(payload: Callback);
11
+ /**
12
+ * Gets the name of this callback type.
13
+ */
14
+ getType(): CallbackType;
15
+ /**
16
+ * Gets the value of the specified input element, or the first element if `selector` is not
17
+ * provided.
18
+ *
19
+ * @param selector The index position or name of the desired element
20
+ */
21
+ getInputValue(selector?: number | string): unknown;
22
+ /**
23
+ * Sets the value of the specified input element, or the first element if `selector` is not
24
+ * provided.
25
+ *
26
+ * @param selector The index position or name of the desired element
27
+ */
28
+ setInputValue(value: unknown, selector?: number | string | RegExp): void;
29
+ /**
30
+ * Gets the value of the specified output element, or the first element if `selector`
31
+ * is not provided.
32
+ *
33
+ * @param selector The index position or name of the desired element
34
+ */
35
+ getOutputValue(selector?: number | string): unknown;
36
+ /**
37
+ * Gets the value of the first output element with the specified name or the
38
+ * specified default value.
39
+ *
40
+ * @param name The name of the desired element
41
+ */
42
+ getOutputByName<T>(name: string, defaultValue: T): T;
43
+ private getArrayElement;
44
+ }
45
+ //# sourceMappingURL=base-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-callback.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/base-callback.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAa,MAAM,sBAAsB,CAAC;AAE9E;;GAEG;AACH,qBAAa,YAAY;IAIJ,OAAO,EAAE,QAAQ;IAHpC;;OAEG;gBACgB,OAAO,EAAE,QAAQ;IAEpC;;OAEG;IACI,OAAO,IAAI,YAAY;IAI9B;;;;;OAKG;IACI,aAAa,CAAC,QAAQ,GAAE,MAAM,GAAG,MAAU,GAAG,OAAO;IAI5D;;;;;OAKG;IACI,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAM,GAAG,MAAM,GAAG,MAAU,GAAG,IAAI;IAIlF;;;;;OAKG;IACI,cAAc,CAAC,QAAQ,GAAE,MAAM,GAAG,MAAU,GAAG,OAAO;IAI7D;;;;;OAKG;IACI,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;IAK3D,OAAO,CAAC,eAAe;CAkCxB"}
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
3
+ *
4
+ * This software may be modified and distributed under the terms
5
+ * of the MIT license. See the LICENSE file for details.
6
+ */
7
+ /**
8
+ * Base class for authentication tree callback wrappers.
9
+ */
10
+ export class BaseCallback {
11
+ payload;
12
+ /**
13
+ * @param payload The raw payload returned by OpenAM
14
+ */
15
+ constructor(payload) {
16
+ this.payload = payload;
17
+ }
18
+ /**
19
+ * Gets the name of this callback type.
20
+ */
21
+ getType() {
22
+ return this.payload.type;
23
+ }
24
+ /**
25
+ * Gets the value of the specified input element, or the first element if `selector` is not
26
+ * provided.
27
+ *
28
+ * @param selector The index position or name of the desired element
29
+ */
30
+ getInputValue(selector = 0) {
31
+ return this.getArrayElement(this.payload.input, selector).value;
32
+ }
33
+ /**
34
+ * Sets the value of the specified input element, or the first element if `selector` is not
35
+ * provided.
36
+ *
37
+ * @param selector The index position or name of the desired element
38
+ */
39
+ setInputValue(value, selector = 0) {
40
+ this.getArrayElement(this.payload.input, selector).value = value;
41
+ }
42
+ /**
43
+ * Gets the value of the specified output element, or the first element if `selector`
44
+ * is not provided.
45
+ *
46
+ * @param selector The index position or name of the desired element
47
+ */
48
+ getOutputValue(selector = 0) {
49
+ return this.getArrayElement(this.payload.output, selector).value;
50
+ }
51
+ /**
52
+ * Gets the value of the first output element with the specified name or the
53
+ * specified default value.
54
+ *
55
+ * @param name The name of the desired element
56
+ */
57
+ getOutputByName(name, defaultValue) {
58
+ const output = this.payload.output.find((x) => x.name === name);
59
+ return output ? output.value : defaultValue;
60
+ }
61
+ getArrayElement(array, selector = 0) {
62
+ if (array === undefined) {
63
+ throw new Error(`No NameValue array was provided to search (selector ${selector})`);
64
+ }
65
+ if (typeof selector === 'number') {
66
+ if (selector < 0 || selector > array.length - 1) {
67
+ throw new Error(`Selector index ${selector} is out of range`);
68
+ }
69
+ return array[selector];
70
+ }
71
+ if (typeof selector === 'string') {
72
+ const input = array.find((x) => x.name === selector);
73
+ if (!input) {
74
+ throw new Error(`Missing callback input entry "${selector}"`);
75
+ }
76
+ return input;
77
+ }
78
+ // Duck typing for RegEx
79
+ if (typeof selector === 'object' && selector.test && Boolean(selector.exec)) {
80
+ const input = array.find((x) => selector.test(x.name));
81
+ if (!input) {
82
+ throw new Error(`Missing callback input entry "${selector}"`);
83
+ }
84
+ return input;
85
+ }
86
+ throw new Error('Invalid selector value type');
87
+ }
88
+ }
@@ -0,0 +1,33 @@
1
+ import type { Callback } from '@forgerock/sdk-types';
2
+ import { BaseCallback } from './base-callback.js';
3
+ /**
4
+ * Represents a callback used to collect an answer to a choice.
5
+ */
6
+ export declare class ChoiceCallback extends BaseCallback {
7
+ payload: Callback;
8
+ /**
9
+ * @param payload The raw payload returned by OpenAM
10
+ */
11
+ constructor(payload: Callback);
12
+ /**
13
+ * Gets the choice's prompt.
14
+ */
15
+ getPrompt(): string;
16
+ /**
17
+ * Gets the choice's default answer.
18
+ */
19
+ getDefaultChoice(): number;
20
+ /**
21
+ * Gets the choice's possible answers.
22
+ */
23
+ getChoices(): string[];
24
+ /**
25
+ * Sets the choice's answer by index position.
26
+ */
27
+ setChoiceIndex(index: number): void;
28
+ /**
29
+ * Sets the choice's answer by value.
30
+ */
31
+ setChoiceValue(value: string): void;
32
+ }
33
+ //# sourceMappingURL=choice-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-callback.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/choice-callback.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAIlB,OAAO,EAAE,QAAQ;IAH7C;;OAEG;gBACyB,OAAO,EAAE,QAAQ;IAI7C;;OAEG;IACI,SAAS,IAAI,MAAM;IAI1B;;OAEG;IACI,gBAAgB,IAAI,MAAM;IAIjC;;OAEG;IACI,UAAU,IAAI,MAAM,EAAE;IAI7B;;OAEG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ1C;;OAEG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAO3C"}
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright (c) 2020 - 2025 Ping Identity Corporation. All rights reserved.
3
+ * This software may be modified and distributed under the terms
4
+ * of the MIT license. See the LICENSE file for details.
5
+ */
6
+ import { BaseCallback } from './base-callback.js';
7
+ /**
8
+ * Represents a callback used to collect an answer to a choice.
9
+ */
10
+ export class ChoiceCallback extends BaseCallback {
11
+ payload;
12
+ /**
13
+ * @param payload The raw payload returned by OpenAM
14
+ */
15
+ constructor(payload) {
16
+ super(payload);
17
+ this.payload = payload;
18
+ }
19
+ /**
20
+ * Gets the choice's prompt.
21
+ */
22
+ getPrompt() {
23
+ return this.getOutputByName('prompt', '');
24
+ }
25
+ /**
26
+ * Gets the choice's default answer.
27
+ */
28
+ getDefaultChoice() {
29
+ return this.getOutputByName('defaultChoice', 0);
30
+ }
31
+ /**
32
+ * Gets the choice's possible answers.
33
+ */
34
+ getChoices() {
35
+ return this.getOutputByName('choices', []);
36
+ }
37
+ /**
38
+ * Sets the choice's answer by index position.
39
+ */
40
+ setChoiceIndex(index) {
41
+ const length = this.getChoices().length;
42
+ if (index < 0 || index > length - 1) {
43
+ throw new Error(`${index} is out of bounds`);
44
+ }
45
+ this.setInputValue(index);
46
+ }
47
+ /**
48
+ * Sets the choice's answer by value.
49
+ */
50
+ setChoiceValue(value) {
51
+ const index = this.getChoices().indexOf(value);
52
+ if (index === -1) {
53
+ throw new Error(`"${value}" is not a valid choice`);
54
+ }
55
+ this.setInputValue(index);
56
+ }
57
+ }
@@ -0,0 +1,41 @@
1
+ import type { Callback } from '@forgerock/sdk-types';
2
+ import { BaseCallback } from './base-callback.js';
3
+ /**
4
+ * Represents a callback used to collect a confirmation to a message.
5
+ */
6
+ export declare class ConfirmationCallback extends BaseCallback {
7
+ payload: Callback;
8
+ /**
9
+ * @param payload The raw payload returned by OpenAM
10
+ */
11
+ constructor(payload: Callback);
12
+ /**
13
+ * Gets the index position of the confirmation's default answer.
14
+ */
15
+ getDefaultOption(): number;
16
+ /**
17
+ * Gets the confirmation's message type.
18
+ */
19
+ getMessageType(): number;
20
+ /**
21
+ * Gets the confirmation's possible answers.
22
+ */
23
+ getOptions(): string[];
24
+ /**
25
+ * Gets the confirmation's option type.
26
+ */
27
+ getOptionType(): number;
28
+ /**
29
+ * Gets the confirmation's prompt.
30
+ */
31
+ getPrompt(): string;
32
+ /**
33
+ * Set option index.
34
+ */
35
+ setOptionIndex(index: number): void;
36
+ /**
37
+ * Set option value.
38
+ */
39
+ setOptionValue(value: string): void;
40
+ }
41
+ //# sourceMappingURL=confirmation-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-callback.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/confirmation-callback.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAIxB,OAAO,EAAE,QAAQ;IAH7C;;OAEG;gBACyB,OAAO,EAAE,QAAQ;IAI7C;;OAEG;IACI,gBAAgB,IAAI,MAAM;IAIjC;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,UAAU,IAAI,MAAM,EAAE;IAI7B;;OAEG;IACI,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACI,SAAS,IAAI,MAAM;IAI1B;;OAEG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ1C;;OAEG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAO3C"}
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright (c) 2020 - 2025 Ping Identity Corporation. All rights reserved.
3
+ * This software may be modified and distributed under the terms
4
+ * of the MIT license. See the LICENSE file for details.
5
+ */
6
+ import { BaseCallback } from './base-callback.js';
7
+ /**
8
+ * Represents a callback used to collect a confirmation to a message.
9
+ */
10
+ export class ConfirmationCallback extends BaseCallback {
11
+ payload;
12
+ /**
13
+ * @param payload The raw payload returned by OpenAM
14
+ */
15
+ constructor(payload) {
16
+ super(payload);
17
+ this.payload = payload;
18
+ }
19
+ /**
20
+ * Gets the index position of the confirmation's default answer.
21
+ */
22
+ getDefaultOption() {
23
+ return Number(this.getOutputByName('defaultOption', 0));
24
+ }
25
+ /**
26
+ * Gets the confirmation's message type.
27
+ */
28
+ getMessageType() {
29
+ return Number(this.getOutputByName('messageType', 0));
30
+ }
31
+ /**
32
+ * Gets the confirmation's possible answers.
33
+ */
34
+ getOptions() {
35
+ return this.getOutputByName('options', []);
36
+ }
37
+ /**
38
+ * Gets the confirmation's option type.
39
+ */
40
+ getOptionType() {
41
+ return Number(this.getOutputByName('optionType', 0));
42
+ }
43
+ /**
44
+ * Gets the confirmation's prompt.
45
+ */
46
+ getPrompt() {
47
+ return this.getOutputByName('prompt', '');
48
+ }
49
+ /**
50
+ * Set option index.
51
+ */
52
+ setOptionIndex(index) {
53
+ const opts = this.getOptions();
54
+ if (!Number.isInteger(index) || index < 0 || index >= opts.length) {
55
+ throw new Error(`"${index}" is not a valid choice (0-${Math.max(0, opts.length - 1)})`);
56
+ }
57
+ this.setInputValue(index);
58
+ }
59
+ /**
60
+ * Set option value.
61
+ */
62
+ setOptionValue(value) {
63
+ const index = this.getOptions().indexOf(value);
64
+ if (index === -1) {
65
+ throw new Error(`"${value}" is not a valid choice`);
66
+ }
67
+ this.setInputValue(index);
68
+ }
69
+ }
@@ -0,0 +1,30 @@
1
+ import type { Callback } from '@forgerock/sdk-types';
2
+ import { BaseCallback } from './base-callback.js';
3
+ import type { DeviceProfileData } from '../device/interfaces.js';
4
+ /**
5
+ * Represents a callback used to collect device profile data.
6
+ */
7
+ export declare class DeviceProfileCallback extends BaseCallback {
8
+ payload: Callback;
9
+ /**
10
+ * @param payload The raw payload returned by OpenAM
11
+ */
12
+ constructor(payload: Callback);
13
+ /**
14
+ * Gets the callback's data.
15
+ */
16
+ getMessage(): string;
17
+ /**
18
+ * Does callback require metadata?
19
+ */
20
+ isMetadataRequired(): boolean;
21
+ /**
22
+ * Does callback require location data?
23
+ */
24
+ isLocationRequired(): boolean;
25
+ /**
26
+ * Sets the profile.
27
+ */
28
+ setProfile(profile: DeviceProfileData): void;
29
+ }
30
+ //# sourceMappingURL=device-profile-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-profile-callback.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/device-profile-callback.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IAIzB,OAAO,EAAE,QAAQ;IAH7C;;OAEG;gBACyB,OAAO,EAAE,QAAQ;IAI7C;;OAEG;IACI,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACI,kBAAkB,IAAI,OAAO;IAIpC;;OAEG;IACI,kBAAkB,IAAI,OAAO;IAIpC;;OAEG;IACI,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;CAGpD"}
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright (c) 2020 - 2025 Ping Identity Corporation. All rights reserved.
3
+ * This software may be modified and distributed under the terms
4
+ * of the MIT license. See the LICENSE file for details.
5
+ */
6
+ import { BaseCallback } from './base-callback.js';
7
+ /**
8
+ * Represents a callback used to collect device profile data.
9
+ */
10
+ export class DeviceProfileCallback extends BaseCallback {
11
+ payload;
12
+ /**
13
+ * @param payload The raw payload returned by OpenAM
14
+ */
15
+ constructor(payload) {
16
+ super(payload);
17
+ this.payload = payload;
18
+ }
19
+ /**
20
+ * Gets the callback's data.
21
+ */
22
+ getMessage() {
23
+ return this.getOutputByName('message', '');
24
+ }
25
+ /**
26
+ * Does callback require metadata?
27
+ */
28
+ isMetadataRequired() {
29
+ return this.getOutputByName('metadata', false);
30
+ }
31
+ /**
32
+ * Does callback require location data?
33
+ */
34
+ isLocationRequired() {
35
+ return this.getOutputByName('location', false);
36
+ }
37
+ /**
38
+ * Sets the profile.
39
+ */
40
+ setProfile(profile) {
41
+ this.setInputValue(JSON.stringify(profile));
42
+ }
43
+ }
@@ -0,0 +1,8 @@
1
+ import type { Callback } from '@forgerock/sdk-types';
2
+ import { BaseCallback } from './base-callback.js';
3
+ export type CallbackFactory = (callback: Callback) => BaseCallback;
4
+ /**
5
+ * @hidden
6
+ */
7
+ export declare function createCallback(callback: Callback): BaseCallback;
8
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/lib/callbacks/factory.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAyBlD,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,YAAY,CAAC;AAEnE;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAqD/D"}