@asgardeo/javascript 0.7.3 → 0.8.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/api/v2/getFlowMetaV2.d.ts +55 -0
- package/dist/cjs/index.js +71 -1
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +69 -1
- package/dist/index.js.map +4 -4
- package/dist/models/config.d.ts +5 -0
- package/dist/models/v2/flow-meta-v2.d.ts +290 -0
- package/package.json +3 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 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 { FlowMetadataResponse, GetFlowMetaRequestConfig } from '../../models/v2/flow-meta-v2';
|
|
19
|
+
/**
|
|
20
|
+
* Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.
|
|
21
|
+
*
|
|
22
|
+
* The response includes:
|
|
23
|
+
* - Application or OU details depending on the `type` parameter
|
|
24
|
+
* - Resolved design configuration (theme and layout)
|
|
25
|
+
* - i18n translations filtered by `language` and `namespace`
|
|
26
|
+
* - Registration flow enablement status
|
|
27
|
+
*
|
|
28
|
+
* @param config - Request configuration including `baseUrl`/`url`, `type`, `id`,
|
|
29
|
+
* and optional `language` / `namespace` filters.
|
|
30
|
+
* @returns A promise that resolves to the {@link FlowMetadataResponse}.
|
|
31
|
+
*
|
|
32
|
+
* @throws {AsgardeoAPIError} When required parameters are missing or the server
|
|
33
|
+
* returns a non-OK response.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import getFlowMetaV2 from './api/v2/getFlowMetaV2';
|
|
38
|
+
* import { FlowMetaType } from './models/v2/flow-meta-v2';
|
|
39
|
+
*
|
|
40
|
+
* const meta = await getFlowMetaV2({
|
|
41
|
+
* baseUrl: 'https://localhost:8090',
|
|
42
|
+
* type: FlowMetaType.App,
|
|
43
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
44
|
+
* language: 'en',
|
|
45
|
+
* namespace: 'auth',
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* console.log(meta.application?.name);
|
|
49
|
+
* console.log(meta.i18n.translations);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @experimental This function targets the Asgardeo V2 platform API
|
|
53
|
+
*/
|
|
54
|
+
declare const getFlowMetaV2: ({ url, baseUrl, type, id, language, namespace, ...requestConfig }: GetFlowMetaRequestConfig) => Promise<FlowMetadataResponse>;
|
|
55
|
+
export default getFlowMetaV2;
|
package/dist/cjs/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
EmbeddedSignUpFlowStatusV2: () => EmbeddedSignUpFlowStatus,
|
|
49
49
|
EmbeddedSignUpFlowTypeV2: () => EmbeddedSignUpFlowType,
|
|
50
50
|
FieldType: () => FieldType,
|
|
51
|
+
FlowMetaType: () => FlowMetaType,
|
|
51
52
|
FlowMode: () => FlowMode,
|
|
52
53
|
IsomorphicCrypto: () => IsomorphicCrypto,
|
|
53
54
|
OIDCRequestConstants: () => OIDCRequestConstants_default,
|
|
@@ -85,6 +86,7 @@ __export(index_exports, {
|
|
|
85
86
|
get: () => get_default,
|
|
86
87
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
87
88
|
getBrandingPreference: () => getBrandingPreference_default,
|
|
89
|
+
getFlowMetaV2: () => getFlowMetaV2_default,
|
|
88
90
|
getLatestStateParam: () => getLatestStateParam_default,
|
|
89
91
|
getMeOrganizations: () => getMeOrganizations_default,
|
|
90
92
|
getOrganization: () => getOrganization_default,
|
|
@@ -1146,7 +1148,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1146
1148
|
} else {
|
|
1147
1149
|
this.instanceIdValue += 1;
|
|
1148
1150
|
}
|
|
1149
|
-
if (instanceID) {
|
|
1151
|
+
if (instanceID !== void 0) {
|
|
1150
1152
|
this.instanceIdValue = instanceID;
|
|
1151
1153
|
}
|
|
1152
1154
|
if (!clientId) {
|
|
@@ -3248,6 +3250,65 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
|
|
|
3248
3250
|
};
|
|
3249
3251
|
var executeEmbeddedUserOnboardingFlowV2_default = executeEmbeddedUserOnboardingFlowV2;
|
|
3250
3252
|
|
|
3253
|
+
// src/api/v2/getFlowMetaV2.ts
|
|
3254
|
+
var getFlowMetaV2 = async ({
|
|
3255
|
+
url,
|
|
3256
|
+
baseUrl,
|
|
3257
|
+
type,
|
|
3258
|
+
id,
|
|
3259
|
+
language,
|
|
3260
|
+
namespace,
|
|
3261
|
+
...requestConfig
|
|
3262
|
+
}) => {
|
|
3263
|
+
if (!type) {
|
|
3264
|
+
throw new AsgardeoAPIError(
|
|
3265
|
+
'The "type" parameter is required',
|
|
3266
|
+
"getFlowMetaV2-ValidationError-001",
|
|
3267
|
+
"javascript",
|
|
3268
|
+
400,
|
|
3269
|
+
'The "type" query parameter must be either "APP" or "OU".'
|
|
3270
|
+
);
|
|
3271
|
+
}
|
|
3272
|
+
if (!id) {
|
|
3273
|
+
throw new AsgardeoAPIError(
|
|
3274
|
+
'The "id" parameter is required',
|
|
3275
|
+
"getFlowMetaV2-ValidationError-002",
|
|
3276
|
+
"javascript",
|
|
3277
|
+
400,
|
|
3278
|
+
'The "id" query parameter must be a valid UUID of the target application or organization unit.'
|
|
3279
|
+
);
|
|
3280
|
+
}
|
|
3281
|
+
const queryParams = new URLSearchParams({
|
|
3282
|
+
id,
|
|
3283
|
+
type,
|
|
3284
|
+
...language ? { language } : {},
|
|
3285
|
+
...namespace ? { namespace } : {}
|
|
3286
|
+
});
|
|
3287
|
+
const baseEndpoint = url ?? `${baseUrl}/flow/meta`;
|
|
3288
|
+
const endpoint = `${baseEndpoint}?${queryParams.toString()}`;
|
|
3289
|
+
const response = await fetch(endpoint, {
|
|
3290
|
+
...requestConfig,
|
|
3291
|
+
headers: {
|
|
3292
|
+
Accept: "application/json",
|
|
3293
|
+
...requestConfig.headers
|
|
3294
|
+
},
|
|
3295
|
+
method: "GET"
|
|
3296
|
+
});
|
|
3297
|
+
if (!response.ok) {
|
|
3298
|
+
const errorText = await response.text();
|
|
3299
|
+
throw new AsgardeoAPIError(
|
|
3300
|
+
`Flow metadata request failed: ${errorText}`,
|
|
3301
|
+
"getFlowMetaV2-ResponseError-001",
|
|
3302
|
+
"javascript",
|
|
3303
|
+
response.status,
|
|
3304
|
+
response.statusText
|
|
3305
|
+
);
|
|
3306
|
+
}
|
|
3307
|
+
const flowMetadata = await response.json();
|
|
3308
|
+
return flowMetadata;
|
|
3309
|
+
};
|
|
3310
|
+
var getFlowMetaV2_default = getFlowMetaV2;
|
|
3311
|
+
|
|
3251
3312
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
3252
3313
|
var ApplicationNativeAuthenticationConstants = {
|
|
3253
3314
|
SupportedAuthenticators: {
|
|
@@ -3364,6 +3425,13 @@ var EmbeddedFlowEventType = /* @__PURE__ */ ((EmbeddedFlowEventType2) => {
|
|
|
3364
3425
|
return EmbeddedFlowEventType2;
|
|
3365
3426
|
})(EmbeddedFlowEventType || {});
|
|
3366
3427
|
|
|
3428
|
+
// src/models/v2/flow-meta-v2.ts
|
|
3429
|
+
var FlowMetaType = /* @__PURE__ */ ((FlowMetaType2) => {
|
|
3430
|
+
FlowMetaType2["App"] = "APP";
|
|
3431
|
+
FlowMetaType2["Ou"] = "OU";
|
|
3432
|
+
return FlowMetaType2;
|
|
3433
|
+
})(FlowMetaType || {});
|
|
3434
|
+
|
|
3367
3435
|
// src/models/flow.ts
|
|
3368
3436
|
var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
|
|
3369
3437
|
FlowMode2["Embedded"] = "DIRECT";
|
|
@@ -4858,6 +4926,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
|
|
|
4858
4926
|
EmbeddedSignUpFlowStatusV2,
|
|
4859
4927
|
EmbeddedSignUpFlowTypeV2,
|
|
4860
4928
|
FieldType,
|
|
4929
|
+
FlowMetaType,
|
|
4861
4930
|
FlowMode,
|
|
4862
4931
|
IsomorphicCrypto,
|
|
4863
4932
|
OIDCRequestConstants,
|
|
@@ -4895,6 +4964,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
|
|
|
4895
4964
|
get,
|
|
4896
4965
|
getAllOrganizations,
|
|
4897
4966
|
getBrandingPreference,
|
|
4967
|
+
getFlowMetaV2,
|
|
4898
4968
|
getLatestStateParam,
|
|
4899
4969
|
getMeOrganizations,
|
|
4900
4970
|
getOrganization,
|