@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,82 @@
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
+ import { User } from '../models/user';
19
+ /**
20
+ * Configuration for the updateMeProfile request
21
+ */
22
+ export interface UpdateMeProfileConfig extends Omit<RequestInit, 'method' | 'body'> {
23
+ /**
24
+ * The absolute API endpoint.
25
+ */
26
+ url?: string;
27
+ /**
28
+ * The base path of the API endpoint.
29
+ */
30
+ baseUrl?: string;
31
+ /**
32
+ * The value object to patch (SCIM2 PATCH value)
33
+ */
34
+ payload: any;
35
+ /**
36
+ * Optional custom fetcher function.
37
+ * If not provided, native fetch will be used
38
+ */
39
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
40
+ }
41
+ /**
42
+ * Updates the user profile information at the specified SCIM2 Me endpoint.
43
+ *
44
+ * @param config - Configuration object with URL, payload and optional request config.
45
+ * @returns A promise that resolves with the updated user profile information.
46
+ * @example
47
+ * ```typescript
48
+ * // Using default fetch
49
+ * await updateMeProfile({
50
+ * url: "https://api.asgardeo.io/t/<ORG>/scim2/Me",
51
+ * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
52
+ * });
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // Using custom fetcher (e.g., axios-based httpClient)
58
+ * await updateMeProfile({
59
+ * url: "https://api.asgardeo.io/t/<ORG>/scim2/Me",
60
+ * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
61
+ * fetcher: async (url, config) => {
62
+ * const response = await httpClient({
63
+ * url,
64
+ * method: config.method,
65
+ * headers: config.headers,
66
+ * data: config.body,
67
+ * ...config
68
+ * });
69
+ * // Convert axios-like response to fetch-like Response
70
+ * return {
71
+ * ok: response.status >= 200 && response.status < 300,
72
+ * status: response.status,
73
+ * statusText: response.statusText,
74
+ * json: () => Promise.resolve(response.data),
75
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
76
+ * } as Response;
77
+ * }
78
+ * });
79
+ * ```
80
+ */
81
+ declare const updateMeProfile: ({ url, baseUrl, payload, fetcher, ...requestConfig }: UpdateMeProfileConfig) => Promise<User>;
82
+ export default updateMeProfile;
@@ -0,0 +1,118 @@
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
+ import { OrganizationDetails } from './getOrganization';
19
+ /**
20
+ * Configuration for the updateOrganization request
21
+ */
22
+ export interface UpdateOrganizationConfig extends Omit<RequestInit, 'method' | 'body'> {
23
+ /**
24
+ * The base URL for the API endpoint.
25
+ */
26
+ baseUrl: string;
27
+ /**
28
+ * The ID of the organization to update
29
+ */
30
+ organizationId: string;
31
+ /**
32
+ * Array of patch operations to apply
33
+ */
34
+ operations: Array<{
35
+ operation: 'REPLACE' | 'ADD' | 'REMOVE';
36
+ path: string;
37
+ value?: any;
38
+ }>;
39
+ /**
40
+ * Optional custom fetcher function.
41
+ * If not provided, native fetch will be used
42
+ */
43
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
44
+ }
45
+ /**
46
+ * Updates the organization information using the Organizations Management API.
47
+ *
48
+ * @param config - Configuration object with baseUrl, organizationId, operations and optional request config.
49
+ * @returns A promise that resolves with the updated organization information.
50
+ * @example
51
+ * ```typescript
52
+ * // Using the helper function to create operations automatically
53
+ * const operations = createPatchOperations({
54
+ * name: "Updated Organization Name", // Will use REPLACE
55
+ * description: "", // Will use REMOVE (empty string)
56
+ * customField: "Some value" // Will use REPLACE
57
+ * });
58
+ *
59
+ * await updateOrganization({
60
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
61
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
62
+ * operations
63
+ * });
64
+ *
65
+ * // Or manually specify operations
66
+ * await updateOrganization({
67
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
68
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
69
+ * operations: [
70
+ * { operation: "REPLACE", path: "/name", value: "Updated Organization Name" },
71
+ * { operation: "REMOVE", path: "/description" }
72
+ * ]
73
+ * });
74
+ * ```
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // Using custom fetcher (e.g., axios-based httpClient)
79
+ * await updateOrganization({
80
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
81
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
82
+ * operations: [
83
+ * { operation: "REPLACE", path: "/name", value: "Updated Organization Name" }
84
+ * ],
85
+ * fetcher: async (url, config) => {
86
+ * const response = await httpClient({
87
+ * url,
88
+ * method: config.method,
89
+ * headers: config.headers,
90
+ * data: config.body,
91
+ * ...config
92
+ * });
93
+ * // Convert axios-like response to fetch-like Response
94
+ * return {
95
+ * ok: response.status >= 200 && response.status < 300,
96
+ * status: response.status,
97
+ * statusText: response.statusText,
98
+ * json: () => Promise.resolve(response.data),
99
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
100
+ * } as Response;
101
+ * }
102
+ * });
103
+ * ```
104
+ */
105
+ declare const updateOrganization: ({ baseUrl, organizationId, operations, fetcher, ...requestConfig }: UpdateOrganizationConfig) => Promise<OrganizationDetails>;
106
+ /**
107
+ * Helper function to convert field updates to patch operations format.
108
+ * Uses REMOVE operation when the value is empty, otherwise uses REPLACE.
109
+ *
110
+ * @param payload - Object containing field updates
111
+ * @returns Array of patch operations
112
+ */
113
+ export declare const createPatchOperations: (payload: Record<string, any>) => Array<{
114
+ operation: "REPLACE" | "REMOVE";
115
+ path: string;
116
+ value?: any;
117
+ }>;
118
+ export default updateOrganization;