@asgardeo/javascript 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AsgardeoJavaScriptClient.d.ts +2 -1
- package/dist/AsgardeoJavaScriptClient.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts +57 -0
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts.map +1 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/index.js.map +4 -4
- package/dist/edge/index.js +69 -0
- package/dist/edge/index.js.map +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -0
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +8 -1
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +1 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/embedded-flow.d.ts +3 -2
- package/dist/models/embedded-flow.d.ts.map +1 -1
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts +143 -0
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2
|
+
* Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
3
|
*
|
|
4
4
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -55,6 +55,7 @@ declare class AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T>
|
|
|
55
55
|
decodeJwtToken<R = Record<string, unknown>>(_token: string): Promise<R>;
|
|
56
56
|
signIn(_options?: SignInOptions): Promise<User>;
|
|
57
57
|
signOut(_options?: SignOutOptions, _sessionIdOrAfterSignOut?: string | ((afterSignOutUrl: string) => void), _afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
58
|
+
recover(_payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
58
59
|
signUp(options?: SignUpOptions): Promise<void>;
|
|
59
60
|
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
60
61
|
getAgentToken(agentConfig: AgentConfig): Promise<TokenResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsgardeoJavaScriptClient.d.ts","sourceRoot":"","sources":["../src/AsgardeoJavaScriptClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AAKnE,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAC,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAEL,iCAAiC,EACjC,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,2BAA2B,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,0BAA0B,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAGhD,cAAM,wBAAwB,CAAC,CAAC,GAAG,MAAM,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,UAAU,C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
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2 } from '../../models/v2/embedded-flow-v2';
|
|
19
|
+
import { EmbeddedRecoveryFlowResponse } from '../../models/v2/embedded-recovery-flow-v2';
|
|
20
|
+
/**
|
|
21
|
+
* Executes an embedded recovery flow by sending a request to the flow execution endpoint.
|
|
22
|
+
*
|
|
23
|
+
* This function handles password-recovery and account-recovery flows driven by the
|
|
24
|
+
* Asgardeo server. The server returns UI components for each step (e.g. username
|
|
25
|
+
* collection, OTP verification, password reset) and this function forwards the
|
|
26
|
+
* user's responses back to the server.
|
|
27
|
+
*
|
|
28
|
+
* @param requestConfig - Request configuration containing URL, payload, and optional headers.
|
|
29
|
+
* @returns A promise that resolves with the flow execution response.
|
|
30
|
+
* @throws AsgardeoAPIError when the request fails or a payload is missing.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Initiate recovery flow
|
|
35
|
+
* const response = await executeEmbeddedRecoveryFlowV2({
|
|
36
|
+
* baseUrl: 'https://api.asgardeo.io/t/myorg',
|
|
37
|
+
* payload: {
|
|
38
|
+
* flowType: 'RECOVERY',
|
|
39
|
+
* applicationId: 'my-app-id',
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Continue recovery flow with user input
|
|
44
|
+
* const nextResponse = await executeEmbeddedRecoveryFlowV2({
|
|
45
|
+
* baseUrl: 'https://api.asgardeo.io/t/myorg',
|
|
46
|
+
* payload: {
|
|
47
|
+
* executionId: response.executionId,
|
|
48
|
+
* action: 'submit',
|
|
49
|
+
* inputs: { username: 'user@example.com' },
|
|
50
|
+
* challengeToken: response.challengeToken,
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare const executeEmbeddedRecoveryFlowV2: ({ url, baseUrl, payload, ...requestConfig }: EmbeddedFlowExecuteRequestConfigV2) => Promise<EmbeddedRecoveryFlowResponse>;
|
|
56
|
+
export default executeEmbeddedRecoveryFlowV2;
|
|
57
|
+
//# sourceMappingURL=executeEmbeddedRecoveryFlowV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeEmbeddedRecoveryFlowV2.d.ts","sourceRoot":"","sources":["../../../src/api/v2/executeEmbeddedRecoveryFlowV2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,gCAAgC,IAAI,kCAAkC,EAAC,MAAM,kCAAkC,CAAC;AACxH,OAAO,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,QAAA,MAAM,6BAA6B,gDAKhC,kCAAkC,KAAG,OAAO,CAAC,4BAA4B,CAqE3E,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -49,6 +49,8 @@ __export(index_exports, {
|
|
|
49
49
|
EmbeddedFlowStatus: () => EmbeddedFlowStatus,
|
|
50
50
|
EmbeddedFlowTextVariantV2: () => EmbeddedFlowTextVariant,
|
|
51
51
|
EmbeddedFlowType: () => EmbeddedFlowType,
|
|
52
|
+
EmbeddedRecoveryFlowStatusV2: () => EmbeddedRecoveryFlowStatus,
|
|
53
|
+
EmbeddedRecoveryFlowTypeV2: () => EmbeddedRecoveryFlowType,
|
|
52
54
|
EmbeddedSignInFlowAuthenticatorKnownIdPType: () => EmbeddedSignInFlowAuthenticatorKnownIdPType,
|
|
53
55
|
EmbeddedSignInFlowAuthenticatorParamType: () => EmbeddedSignInFlowAuthenticatorParamType,
|
|
54
56
|
EmbeddedSignInFlowAuthenticatorPromptType: () => EmbeddedSignInFlowAuthenticatorPromptType,
|
|
@@ -86,6 +88,7 @@ __export(index_exports, {
|
|
|
86
88
|
deepMerge: () => deepMerge_default,
|
|
87
89
|
deriveOrganizationHandleFromBaseUrl: () => deriveOrganizationHandleFromBaseUrl_default,
|
|
88
90
|
error: () => error,
|
|
91
|
+
executeEmbeddedRecoveryFlowV2: () => executeEmbeddedRecoveryFlowV2_default,
|
|
89
92
|
executeEmbeddedSignInFlow: () => executeEmbeddedSignInFlow_default,
|
|
90
93
|
executeEmbeddedSignInFlowV2: () => executeEmbeddedSignInFlowV2_default,
|
|
91
94
|
executeEmbeddedSignUpFlow: () => executeEmbeddedSignUpFlow_default,
|
|
@@ -2324,6 +2327,7 @@ var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
|
2324
2327
|
// src/models/embedded-flow.ts
|
|
2325
2328
|
var EmbeddedFlowType = /* @__PURE__ */ ((EmbeddedFlowType2) => {
|
|
2326
2329
|
EmbeddedFlowType2["Authentication"] = "AUTHENTICATION";
|
|
2330
|
+
EmbeddedFlowType2["Recovery"] = "RECOVERY";
|
|
2327
2331
|
EmbeddedFlowType2["Registration"] = "REGISTRATION";
|
|
2328
2332
|
EmbeddedFlowType2["UserOnboarding"] = "USER_ONBOARDING";
|
|
2329
2333
|
return EmbeddedFlowType2;
|
|
@@ -3329,6 +3333,55 @@ var executeEmbeddedSignUpFlowV2 = async ({
|
|
|
3329
3333
|
};
|
|
3330
3334
|
var executeEmbeddedSignUpFlowV2_default = executeEmbeddedSignUpFlowV2;
|
|
3331
3335
|
|
|
3336
|
+
// src/api/v2/executeEmbeddedRecoveryFlowV2.ts
|
|
3337
|
+
var executeEmbeddedRecoveryFlowV2 = async ({
|
|
3338
|
+
url,
|
|
3339
|
+
baseUrl,
|
|
3340
|
+
payload,
|
|
3341
|
+
...requestConfig
|
|
3342
|
+
}) => {
|
|
3343
|
+
if (!payload) {
|
|
3344
|
+
throw new AsgardeoAPIError(
|
|
3345
|
+
"Recovery payload is required",
|
|
3346
|
+
"executeEmbeddedRecoveryFlow-ValidationError-002",
|
|
3347
|
+
"javascript",
|
|
3348
|
+
400,
|
|
3349
|
+
"If a recovery payload is not provided, the request cannot be constructed correctly."
|
|
3350
|
+
);
|
|
3351
|
+
}
|
|
3352
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3353
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3354
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3355
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3356
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {
|
|
3357
|
+
...cleanPayload,
|
|
3358
|
+
verbose: true
|
|
3359
|
+
} : cleanPayload;
|
|
3360
|
+
const response = await fetch(endpoint, {
|
|
3361
|
+
...requestConfig,
|
|
3362
|
+
body: JSON.stringify(requestPayload),
|
|
3363
|
+
headers: {
|
|
3364
|
+
Accept: "application/json",
|
|
3365
|
+
"Content-Type": "application/json",
|
|
3366
|
+
...requestConfig.headers
|
|
3367
|
+
},
|
|
3368
|
+
method: requestConfig.method || "POST"
|
|
3369
|
+
});
|
|
3370
|
+
if (!response.ok) {
|
|
3371
|
+
const errorText = await response.text();
|
|
3372
|
+
throw new AsgardeoAPIError(
|
|
3373
|
+
`Recovery request failed: ${errorText}`,
|
|
3374
|
+
"executeEmbeddedRecoveryFlow-ResponseError-001",
|
|
3375
|
+
"javascript",
|
|
3376
|
+
response.status,
|
|
3377
|
+
response.statusText
|
|
3378
|
+
);
|
|
3379
|
+
}
|
|
3380
|
+
const flowResponse = await response.json();
|
|
3381
|
+
return flowResponse;
|
|
3382
|
+
};
|
|
3383
|
+
var executeEmbeddedRecoveryFlowV2_default = executeEmbeddedRecoveryFlowV2;
|
|
3384
|
+
|
|
3332
3385
|
// src/api/v2/executeEmbeddedUserOnboardingFlowV2.ts
|
|
3333
3386
|
var executeEmbeddedUserOnboardingFlowV2 = async ({
|
|
3334
3387
|
url,
|
|
@@ -3590,6 +3643,19 @@ var EmbeddedFlowEventType = /* @__PURE__ */ ((EmbeddedFlowEventType2) => {
|
|
|
3590
3643
|
return EmbeddedFlowEventType2;
|
|
3591
3644
|
})(EmbeddedFlowEventType || {});
|
|
3592
3645
|
|
|
3646
|
+
// src/models/v2/embedded-recovery-flow-v2.ts
|
|
3647
|
+
var EmbeddedRecoveryFlowStatus = /* @__PURE__ */ ((EmbeddedRecoveryFlowStatus2) => {
|
|
3648
|
+
EmbeddedRecoveryFlowStatus2["Complete"] = "COMPLETE";
|
|
3649
|
+
EmbeddedRecoveryFlowStatus2["Error"] = "ERROR";
|
|
3650
|
+
EmbeddedRecoveryFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
3651
|
+
return EmbeddedRecoveryFlowStatus2;
|
|
3652
|
+
})(EmbeddedRecoveryFlowStatus || {});
|
|
3653
|
+
var EmbeddedRecoveryFlowType = /* @__PURE__ */ ((EmbeddedRecoveryFlowType2) => {
|
|
3654
|
+
EmbeddedRecoveryFlowType2["Redirection"] = "REDIRECTION";
|
|
3655
|
+
EmbeddedRecoveryFlowType2["View"] = "VIEW";
|
|
3656
|
+
return EmbeddedRecoveryFlowType2;
|
|
3657
|
+
})(EmbeddedRecoveryFlowType || {});
|
|
3658
|
+
|
|
3593
3659
|
// src/models/v2/flow-meta-v2.ts
|
|
3594
3660
|
var FlowMetaType = /* @__PURE__ */ ((FlowMetaType2) => {
|
|
3595
3661
|
FlowMetaType2["App"] = "APP";
|
|
@@ -3794,6 +3860,9 @@ var AsgardeoJavaScriptClient = class {
|
|
|
3794
3860
|
signOut(_options, _sessionIdOrAfterSignOut, _afterSignOut) {
|
|
3795
3861
|
throw new Error("Method not implemented.");
|
|
3796
3862
|
}
|
|
3863
|
+
recover(_payload) {
|
|
3864
|
+
throw new Error("Method not implemented.");
|
|
3865
|
+
}
|
|
3797
3866
|
signUp(_optionsOrPayload) {
|
|
3798
3867
|
throw new Error("Method not implemented.");
|
|
3799
3868
|
}
|
|
@@ -5557,6 +5626,8 @@ var HttpClient = _HttpClient;
|
|
|
5557
5626
|
EmbeddedFlowStatus,
|
|
5558
5627
|
EmbeddedFlowTextVariantV2,
|
|
5559
5628
|
EmbeddedFlowType,
|
|
5629
|
+
EmbeddedRecoveryFlowStatusV2,
|
|
5630
|
+
EmbeddedRecoveryFlowTypeV2,
|
|
5560
5631
|
EmbeddedSignInFlowAuthenticatorKnownIdPType,
|
|
5561
5632
|
EmbeddedSignInFlowAuthenticatorParamType,
|
|
5562
5633
|
EmbeddedSignInFlowAuthenticatorPromptType,
|
|
@@ -5594,6 +5665,7 @@ var HttpClient = _HttpClient;
|
|
|
5594
5665
|
deepMerge,
|
|
5595
5666
|
deriveOrganizationHandleFromBaseUrl,
|
|
5596
5667
|
error,
|
|
5668
|
+
executeEmbeddedRecoveryFlowV2,
|
|
5597
5669
|
executeEmbeddedSignInFlow,
|
|
5598
5670
|
executeEmbeddedSignInFlowV2,
|
|
5599
5671
|
executeEmbeddedSignUpFlow,
|