@asgardeo/javascript 0.0.1 → 0.1.1

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 (73) hide show
  1. package/README.md +3 -3
  2. package/dist/AsgardeoJavaScriptClient.d.ts +17 -50
  3. package/dist/IsomorphicCrypto.d.ts +4 -4
  4. package/dist/{__legacy__/data/data-layer.d.ts → StorageManager.d.ts} +27 -26
  5. package/dist/__legacy__/client.d.ts +82 -98
  6. package/dist/__legacy__/helpers/authentication-helper.d.ts +9 -9
  7. package/dist/__legacy__/models/client-config.d.ts +6 -6
  8. package/dist/__legacy__/models/index.d.ts +0 -5
  9. package/dist/api/createOrganization.d.ts +129 -0
  10. package/dist/api/executeEmbeddedSignInFlow.d.ts +21 -0
  11. package/dist/api/executeEmbeddedSignUpFlow.d.ts +44 -0
  12. package/dist/api/getAllOrganizations.d.ts +112 -0
  13. package/dist/api/getMeOrganizations.d.ts +119 -0
  14. package/dist/api/getOrganization.d.ts +109 -0
  15. package/dist/api/getSchemas.d.ts +89 -0
  16. package/dist/api/getScim2Me.d.ts +89 -0
  17. package/dist/api/{oidc/getUserInfo.d.ts → getUserInfo.d.ts} +1 -1
  18. package/dist/api/initializeEmbeddedSignInFlow.d.ts +51 -0
  19. package/dist/api/updateMeProfile.d.ts +82 -0
  20. package/dist/api/updateOrganization.d.ts +118 -0
  21. package/dist/cjs/index.js +2437 -1224
  22. package/dist/cjs/index.js.map +4 -4
  23. package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +39 -0
  24. package/dist/constants/OIDCRequestConstants.d.ts +14 -0
  25. package/dist/constants/PKCEConstants.d.ts +1 -0
  26. package/dist/constants/ScopeConstants.d.ts +3 -6
  27. package/dist/constants/TokenExchangeConstants.d.ts +3 -3
  28. package/dist/constants/VendorConstants.d.ts +31 -0
  29. package/dist/{__legacy__/exception → errors}/exception.d.ts +3 -0
  30. package/dist/{__legacy__/data/index.d.ts → i18n/en-US.d.ts} +4 -2
  31. package/dist/{__legacy__/exception → i18n}/index.d.ts +2 -2
  32. package/dist/index.d.ts +44 -11
  33. package/dist/index.js +2399 -1219
  34. package/dist/index.js.map +4 -4
  35. package/dist/models/client.d.ts +60 -5
  36. package/dist/models/config.d.ts +51 -2
  37. package/dist/models/crypto.d.ts +2 -2
  38. package/dist/models/embedded-flow.d.ts +66 -0
  39. package/dist/models/embedded-signin-flow.d.ts +99 -0
  40. package/dist/{__legacy__/models/custom-grant.d.ts → models/field.d.ts} +13 -9
  41. package/dist/models/flow.d.ts +30 -0
  42. package/dist/models/i18n.d.ts +90 -0
  43. package/dist/{__legacy__/models/authorization-url.d.ts → models/oauth-request.d.ts} +3 -3
  44. package/dist/models/oauth-response.d.ts +1 -17
  45. package/dist/models/organization.d.ts +24 -0
  46. package/dist/models/scim2-schema.d.ts +3 -0
  47. package/dist/{__legacy__/models/data.d.ts → models/session.d.ts} +4 -0
  48. package/dist/models/store.d.ts +1 -1
  49. package/dist/models/token.d.ts +79 -20
  50. package/dist/models/user.d.ts +11 -84
  51. package/dist/theme/createTheme.d.ts +1 -1
  52. package/dist/theme/types.d.ts +29 -17
  53. package/dist/utils/deepMerge.d.ts +44 -0
  54. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +2 -2
  55. package/dist/utils/extractUserClaimsFromIdToken.d.ts +2 -2
  56. package/dist/utils/flattenUserSchema.d.ts +64 -0
  57. package/dist/utils/generateFlattenedUserProfile.d.ts +53 -0
  58. package/dist/utils/generateUserProfile.d.ts +55 -0
  59. package/dist/utils/get.d.ts +29 -0
  60. package/dist/utils/getAuthorizeRequestUrlParams.d.ts +59 -0
  61. package/dist/utils/getI18nBundles.d.ts +26 -0
  62. package/dist/utils/getLatestStateParam.d.ts +40 -0
  63. package/dist/utils/isEmpty.d.ts +48 -0
  64. package/dist/utils/processOpenIDScopes.d.ts +36 -0
  65. package/dist/{__legacy__/core/index.d.ts → utils/resolveFieldName.d.ts} +3 -2
  66. package/dist/utils/resolveFieldType.d.ts +20 -0
  67. package/dist/utils/set.d.ts +30 -0
  68. package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
  69. package/package.json +4 -4
  70. package/dist/__legacy__/core/authentication-core.d.ts +0 -51
  71. package/dist/__legacy__/models/fetch.d.ts +0 -55
  72. package/dist/__legacy__/models/user.d.ts +0 -85
  73. package/dist/models/id-token.d.ts +0 -55
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ /**
19
+ * Constants representing Application Native Authentication related configurations and constants.
20
+ */
21
+ declare const ApplicationNativeAuthenticationConstants: {
22
+ readonly SupportedAuthenticators: {
23
+ readonly IdentifierFirst: "SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM";
24
+ readonly EmailOtp: "ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw";
25
+ readonly Totp: "dG90cDpMT0NBTA";
26
+ readonly UsernamePassword: "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM";
27
+ readonly PushNotification: "cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA";
28
+ readonly Passkey: "RklET0F1dGhlbnRpY2F0b3I6TE9DQUw";
29
+ readonly SmsOtp: "c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM";
30
+ readonly MagicLink: "TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA";
31
+ readonly Google: "R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl";
32
+ readonly GitHub: "R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI";
33
+ readonly Microsoft: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0";
34
+ readonly Facebook: "RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r";
35
+ readonly LinkedIn: "TGlua2VkSW5PSURDOkxpbmtlZElu";
36
+ readonly SignInWithEthereum: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt";
37
+ };
38
+ };
39
+ export default ApplicationNativeAuthenticationConstants;
@@ -41,6 +41,20 @@ declare const OIDCRequestConstants: {
41
41
  */
42
42
  readonly SIGN_OUT_SUCCESS: "sign_out_success";
43
43
  };
44
+ /**
45
+ * Constants related to the OpenID Connect (OIDC) sign-in flow.
46
+ */
47
+ readonly SignIn: {
48
+ /**
49
+ * Constants related to the payload of the OIDC sign-in request.
50
+ */
51
+ readonly Payload: {
52
+ /**
53
+ * The default scopes used in OIDC sign-in requests.
54
+ */
55
+ readonly DEFAULT_SCOPES: readonly [string, string, string];
56
+ };
57
+ };
44
58
  /**
45
59
  * Sign-out related constants for managing the end-session flow in OIDC.
46
60
  */
@@ -33,6 +33,7 @@
33
33
  * ```
34
34
  */
35
35
  declare const PKCEConstants: {
36
+ readonly DEFAULT_CODE_CHALLENGE_METHOD: "S256";
36
37
  /**
37
38
  * Storage-related constants for managing PKCE state
38
39
  */
@@ -35,11 +35,8 @@
35
35
  * ```
36
36
  */
37
37
  declare const ScopeConstants: {
38
- /**
39
- * The base OpenID Connect scope.
40
- * Required for all OpenID Connect flows. Indicates that the client
41
- * is initiating an OpenID Connect authentication request.
42
- */
43
- readonly OPENID: "openid";
38
+ INTERNAL_LOGIN: string;
39
+ OPENID: string;
40
+ PROFILE: string;
44
41
  };
45
42
  export default ScopeConstants;
@@ -42,7 +42,7 @@ declare const TokenExchangeConstants: {
42
42
  * Placeholder for the token value in exchange requests.
43
43
  * Usually replaced with an access token or refresh token.
44
44
  */
45
- readonly TOKEN: "{{token}}";
45
+ readonly ACCESS_TOKEN: "{{accessToken}}";
46
46
  /**
47
47
  * Placeholder for the username in token exchange operations.
48
48
  * Used when user identity needs to be included in the exchange.
@@ -52,12 +52,12 @@ declare const TokenExchangeConstants: {
52
52
  * Placeholder for OAuth scopes in token exchange requests.
53
53
  * Replaced with space-separated scope strings.
54
54
  */
55
- readonly SCOPE: "{{scope}}";
55
+ readonly SCOPES: "{{scopes}}";
56
56
  /**
57
57
  * Placeholder for client ID in token exchange operations.
58
58
  * Required for client authentication.
59
59
  */
60
- readonly CLIENT_ID: "{{clientID}}";
60
+ readonly CLIENT_ID: "{{clientId}}";
61
61
  /**
62
62
  * Placeholder for client secret in token exchange operations.
63
63
  * Used for client authentication in confidential client flows.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ /**
19
+ * Constants for vendor-specific configurations.
20
+ * By default, the vendor is inferred as Asgardeo.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Using the vendor prefix in a URL
25
+ * const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;
26
+ * ```
27
+ */
28
+ declare const VendorConstants: {
29
+ VENDOR_PREFIX: string;
30
+ };
31
+ export default VendorConstants;
@@ -15,6 +15,9 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ /**
19
+ * @deprecated Use `AsgardeoRuntimeError` for runtime errors and `AsgardeoAPIError` for API errors.
20
+ */
18
21
  export declare class AsgardeoAuthException {
19
22
  name: string;
20
23
  code: string | undefined;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
2
+ * Copyright (c) 2025, 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
@@ -15,4 +15,6 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- export * from "./data-layer";
18
+ import { I18nBundle } from '../models/i18n';
19
+ declare const en_US: I18nBundle;
20
+ export default en_US;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
2
+ * Copyright (c) 2025, 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
@@ -15,4 +15,4 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- export * from "./exception";
18
+ export { default as en_US } from './en-US';
package/dist/index.d.ts CHANGED
@@ -17,29 +17,62 @@
17
17
  */
18
18
  export * from './__legacy__/client';
19
19
  export * from './__legacy__/models';
20
- export * from './models/oauth-response';
21
20
  export * from './IsomorphicCrypto';
22
- export * from './__legacy__/exception';
23
- export * from './__legacy__/data';
24
- export { default as getUserInfo } from './api/oidc/getUserInfo';
21
+ export { default as initializeEmbeddedSignInFlow } from './api/initializeEmbeddedSignInFlow';
22
+ export { default as executeEmbeddedSignInFlow } from './api/executeEmbeddedSignInFlow';
23
+ export { default as executeEmbeddedSignUpFlow } from './api/executeEmbeddedSignUpFlow';
24
+ export { default as getUserInfo } from './api/getUserInfo';
25
+ export { default as getScim2Me, GetScim2MeConfig } from './api/getScim2Me';
26
+ export { default as getSchemas, GetSchemasConfig } from './api/getSchemas';
27
+ export { default as getAllOrganizations, PaginatedOrganizationsResponse, GetAllOrganizationsConfig, } from './api/getAllOrganizations';
28
+ export { default as createOrganization, CreateOrganizationPayload, CreateOrganizationConfig, } from './api/createOrganization';
29
+ export { default as getMeOrganizations, GetMeOrganizationsConfig } from './api/getMeOrganizations';
30
+ export { default as getOrganization, OrganizationDetails, GetOrganizationConfig } from './api/getOrganization';
31
+ export { default as updateOrganization, createPatchOperations, UpdateOrganizationConfig } from './api/updateOrganization';
32
+ export { default as updateMeProfile, UpdateMeProfileConfig } from './api/updateMeProfile';
33
+ export { default as ApplicationNativeAuthenticationConstants } from './constants/ApplicationNativeAuthenticationConstants';
25
34
  export { default as TokenConstants } from './constants/TokenConstants';
26
35
  export { default as OIDCRequestConstants } from './constants/OIDCRequestConstants';
36
+ export { default as VendorConstants } from './constants/VendorConstants';
27
37
  export { default as AsgardeoError } from './errors/AsgardeoError';
28
38
  export { default as AsgardeoAPIError } from './errors/AsgardeoAPIError';
29
39
  export { default as AsgardeoRuntimeError } from './errors/AsgardeoRuntimeError';
30
- export { AsgardeoClient, SignInOptions, SignOutOptions } from './models/client';
31
- export { BaseConfig, Config, Preferences, ThemePreferences } from './models/config';
32
- export { TokenResponse } from './models/token';
40
+ export { AsgardeoAuthException } from './errors/exception';
41
+ export { EmbeddedSignInFlowInitiateResponse, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignInFlowStepType, EmbeddedSignInFlowAuthenticator, EmbeddedSignInFlowLink, EmbeddedSignInFlowHandleRequestPayload, EmbeddedSignInFlowHandleResponse, EmbeddedSignInFlowAuthenticatorParamType, EmbeddedSignInFlowAuthenticatorPromptType, EmbeddedSignInFlowAuthenticatorKnownIdPType, } from './models/embedded-signin-flow';
42
+ export { EmbeddedFlowType, EmbeddedFlowStatus, EmbeddedFlowExecuteResponse, EmbeddedFlowResponseType, EmbeddedSignUpFlowData, EmbeddedFlowComponent, EmbeddedFlowComponentType, EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteRequestConfig, } from './models/embedded-flow';
43
+ export { FlowMode } from './models/flow';
44
+ export { AsgardeoClient, SignInOptions, SignOutOptions, SignUpOptions } from './models/client';
45
+ export { BaseConfig, Config, Preferences, ThemePreferences, I18nPreferences, WithPreferences } from './models/config';
46
+ export { TokenResponse, IdToken, TokenExchangeRequestConfig } from './models/token';
33
47
  export { Crypto, JWKInterface } from './models/crypto';
34
- export { IdTokenPayload } from './models/id-token';
48
+ export { OAuthResponseMode } from './models/oauth-response';
49
+ export { AuthorizeRequestUrlParams, KnownExtendedAuthorizeRequestUrlParams, ExtendedAuthorizeRequestUrlParams, } from './models/oauth-request';
35
50
  export { OIDCEndpoints } from './models/oidc-endpoints';
36
- export { Store } from './models/store';
37
- export { User } from './models/user';
38
- export { Schema, SchemaAttribute, WellKnownSchemaIds } from './models/scim2-schema';
51
+ export { Storage, TemporaryStore } from './models/store';
52
+ export { User, UserProfile } from './models/user';
53
+ export { SessionData } from './models/session';
54
+ export { Organization } from './models/organization';
55
+ export { Schema, SchemaAttribute, WellKnownSchemaIds, FlattenedSchema } from './models/scim2-schema';
39
56
  export { RecursivePartial } from './models/utility-types';
57
+ export { FieldType } from './models/field';
58
+ export { I18nBundle, I18nTranslations, I18nMetadata } from './models/i18n';
40
59
  export { default as AsgardeoJavaScriptClient } from './AsgardeoJavaScriptClient';
41
60
  export { default as createTheme } from './theme/createTheme';
42
61
  export { ThemeColors, ThemeConfig, Theme, ThemeMode } from './theme/types';
62
+ export { default as deepMerge } from './utils/deepMerge';
43
63
  export { default as extractUserClaimsFromIdToken } from './utils/extractUserClaimsFromIdToken';
44
64
  export { default as extractPkceStorageKeyFromState } from './utils/extractPkceStorageKeyFromState';
65
+ export { default as flattenUserSchema } from './utils/flattenUserSchema';
66
+ export { default as generateUserProfile } from './utils/generateUserProfile';
67
+ export { default as getLatestStateParam } from './utils/getLatestStateParam';
68
+ export { default as generateFlattenedUserProfile } from './utils/generateFlattenedUserProfile';
69
+ export { default as getI18nBundles } from './utils/getI18nBundles';
70
+ export { default as isEmpty } from './utils/isEmpty';
71
+ export { default as set } from './utils/set';
72
+ export { default as get } from './utils/get';
45
73
  export { default as removeTrailingSlash } from './utils/removeTrailingSlash';
74
+ export { default as resolveFieldType } from './utils/resolveFieldType';
75
+ export { default as resolveFieldName } from './utils/resolveFieldName';
76
+ export { default as processOpenIDScopes } from './utils/processOpenIDScopes';
77
+ export { default as withVendorCSSClassPrefix } from './utils/withVendorCSSClassPrefix';
78
+ export { default as StorageManager } from './StorageManager';