@ctx-core/auth0-management 7.1.5 → 8.0.3
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/CHANGELOG.md +35 -0
- package/bin/add-grant-password-auth0.mjs +2 -3
- package/bin/getAll-client-grants-auth0.mjs +1 -2
- package/package.json +7 -4
- package/src/auth0_management_token__b.js +2 -3
- package/src/get_auth0_v2_client_grants_b.d.ts +4 -1
- package/src/get_auth0_v2_client_grants_b.js +3 -2
- package/src/get_auth0_v2_user_b.d.ts +3 -1
- package/src/get_auth0_v2_user_b.js +3 -2
- package/src/get_auth0_v2_users_by_email_b.d.ts +3 -1
- package/src/get_auth0_v2_users_by_email_b.js +3 -2
- package/src/patch_auth0_v2_client_b.d.ts +4 -1
- package/src/patch_auth0_v2_client_b.js +3 -2
- package/src/patch_auth0_v2_user_b.d.ts +6 -3
- package/src/patch_auth0_v2_user_b.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @ctx-core/auth0-management
|
|
2
2
|
|
|
3
|
+
## 8.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- update dependencies
|
|
8
|
+
|
|
9
|
+
## 8.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 426b34a66: auth0: ^2.37.0 -> ^2.38.0
|
|
14
|
+
|
|
15
|
+
## 8.0.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- update dependencies
|
|
20
|
+
|
|
21
|
+
## 8.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- all \_b use fetch return pairs [payload, response]
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- use fetch instead of safe_fetch
|
|
30
|
+
- use fetch instead of safe_fetch
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @ctx-core/auth0@29.0.0
|
|
36
|
+
- @ctx-core/fetch-undici@1.1.0
|
|
37
|
+
|
|
3
38
|
## 7.1.5
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ import { patch_auth0_v2_client_b } from '../src/index.js'
|
|
|
4
4
|
await main()
|
|
5
5
|
async function main() {
|
|
6
6
|
const ctx = ctx_()
|
|
7
|
-
const
|
|
7
|
+
const [client] = await patch_auth0_v2_client_b(ctx)({
|
|
8
8
|
json: {
|
|
9
9
|
grant_types: [
|
|
10
10
|
'password',
|
|
@@ -12,6 +12,5 @@ async function main() {
|
|
|
12
12
|
],
|
|
13
13
|
},
|
|
14
14
|
})
|
|
15
|
-
|
|
16
|
-
console.info(JSON.stringify(json, null, 2))
|
|
15
|
+
console.info(JSON.stringify(client, null, 2))
|
|
17
16
|
}
|
|
@@ -4,12 +4,11 @@ import { get_auth0_v2_client_grants_b, auth0_audience__b } from '../src/index.js
|
|
|
4
4
|
await main()
|
|
5
5
|
async function main() {
|
|
6
6
|
const ctx = ctx_()
|
|
7
|
-
const
|
|
7
|
+
const [json] = await get_auth0_v2_client_grants_b(ctx)({
|
|
8
8
|
json: {
|
|
9
9
|
client_id: process.env.AUTH0_CLIENT_ID,
|
|
10
10
|
audience: auth0_audience__b(ctx)()
|
|
11
11
|
}
|
|
12
12
|
})
|
|
13
|
-
const json = await response.json()
|
|
14
13
|
console.info(JSON.stringify(json, null, 2))
|
|
15
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-management",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"description": "ctx-core auth0 management api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -30,12 +30,15 @@
|
|
|
30
30
|
"getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@ctx-core/auth0": "^
|
|
34
|
-
"@ctx-core/fetch-undici": "^1.0
|
|
33
|
+
"@ctx-core/auth0": "^29.1.0",
|
|
34
|
+
"@ctx-core/fetch-undici": "^1.1.0",
|
|
35
35
|
"@ctx-core/object": "^22.0.13",
|
|
36
|
-
"
|
|
36
|
+
"@ctx-core/uri": "^12.0.38",
|
|
37
|
+
"auth0": "^2.38.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
40
|
+
"@types/auth0": "^2.34.10",
|
|
41
|
+
"@types/auth0-js": "^9.14.5",
|
|
39
42
|
"c8": "^7.11.0",
|
|
40
43
|
"check-dts": "^0.6.6",
|
|
41
44
|
"tsm": "^2.2.1",
|
|
@@ -4,12 +4,11 @@ import { auth0_management_client_credentials_body__b } from './auth0_management_
|
|
|
4
4
|
const key = 'auth0_management_token_'
|
|
5
5
|
/** @type {import('./auth0_management_token__b.d.ts').auth0_management_token__b} */
|
|
6
6
|
export const auth0_management_token__b = be_(key, ctx=>{
|
|
7
|
-
const post_auth0_oauth_token = post_auth0_oauth_token_b(ctx)
|
|
8
7
|
const auth0_management_client_credentials_body_fn = auth0_management_client_credentials_body__b(ctx)
|
|
9
8
|
return auth0_management_token_
|
|
10
9
|
async function auth0_management_token_() {
|
|
11
10
|
const management_client_credentials = auth0_management_client_credentials_body_fn()
|
|
12
|
-
const
|
|
13
|
-
return
|
|
11
|
+
const [token_response] = await post_auth0_oauth_token_b(ctx)(management_client_credentials)
|
|
12
|
+
return token_response
|
|
14
13
|
}
|
|
15
14
|
})
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
1
2
|
import { B } from '@ctx-core/object'
|
|
3
|
+
import type { CreateClientGrant } from 'auth0'
|
|
2
4
|
export declare const get_auth0_v2_client_grants_b:B<get_auth0_v2_client_grants_T>
|
|
3
5
|
export interface get_auth0_v2_client_grants_params_I {
|
|
4
6
|
query?:string;
|
|
5
7
|
json?:any;
|
|
6
8
|
}
|
|
7
|
-
export declare type get_auth0_v2_client_grants_T =
|
|
9
|
+
export declare type get_auth0_v2_client_grants_T =
|
|
10
|
+
(params:get_auth0_v2_client_grants_params_I)=>Promise<[CreateClientGrant, Response]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
|
|
2
|
-
import {
|
|
2
|
+
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
import { query_str_ } from '@ctx-core/uri'
|
|
5
5
|
import { auth0_management_token__b } from './auth0_management_token__b.js'
|
|
@@ -14,12 +14,13 @@ export const get_auth0_v2_client_grants_b = be_(key, ctx=>{
|
|
|
14
14
|
const auth0_token = await auth0_management_token_()
|
|
15
15
|
const authorization = verify_access_token_header_authorization_(auth0_token)
|
|
16
16
|
const url = `https://${AUTH0_DOMAIN$.$}/api/v2/client-grants?${query || query_str_(json)}`
|
|
17
|
-
|
|
17
|
+
const res = await fetch(url, {
|
|
18
18
|
method: 'GET',
|
|
19
19
|
headers: {
|
|
20
20
|
'Content-Type': 'application/json',
|
|
21
21
|
authorization
|
|
22
22
|
}
|
|
23
23
|
})
|
|
24
|
+
return [await res.json(), res]
|
|
24
25
|
}
|
|
25
26
|
})
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { B } from '@ctx-core/object'
|
|
2
|
+
import { User } from 'auth0'
|
|
2
3
|
export declare const get_auth0_v2_user_b:B<get_auth0_v2_user_T>
|
|
3
4
|
export interface get_auth0_v2_user_params_T {
|
|
4
5
|
AUTH0_DOMAIN:string;
|
|
5
6
|
user_id:string;
|
|
6
7
|
}
|
|
7
|
-
export declare type get_auth0_v2_user_T =
|
|
8
|
+
export declare type get_auth0_v2_user_T =
|
|
9
|
+
(params:get_auth0_v2_user_params_T)=>Promise<[User, Response]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { verify_access_token_header_authorization_ } from '@ctx-core/auth0'
|
|
2
|
-
import {
|
|
2
|
+
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
import { auth0_management_token__b } from './auth0_management_token__b.js'
|
|
5
5
|
const key = 'get_auth0_v2_user'
|
|
@@ -11,12 +11,13 @@ export const get_auth0_v2_user_b = be_(key, ctx=>{
|
|
|
11
11
|
const auth0_token = await auth0_management_token_()
|
|
12
12
|
const authorization = verify_access_token_header_authorization_(auth0_token)
|
|
13
13
|
const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
|
|
14
|
-
|
|
14
|
+
const res = await fetch(url, {
|
|
15
15
|
method: 'GET',
|
|
16
16
|
headers: {
|
|
17
17
|
'Content-Type': 'application/json',
|
|
18
18
|
authorization
|
|
19
19
|
}
|
|
20
20
|
})
|
|
21
|
+
return [await res.json(), res]
|
|
21
22
|
}
|
|
22
23
|
})
|
|
@@ -5,5 +5,7 @@ export declare type get_auth0_v2_users_by_email_params_I = {
|
|
|
5
5
|
email:string;
|
|
6
6
|
AUTH0_DOMAIN?:string;
|
|
7
7
|
};
|
|
8
|
-
export declare type get_auth0_v2_users_by_email_T = (
|
|
8
|
+
export declare type get_auth0_v2_users_by_email_T = (
|
|
9
|
+
params:get_auth0_v2_users_by_email_params_I
|
|
10
|
+
)=>Promise<[get_auth0_v2_users_by_email_response_T, Response]>;
|
|
9
11
|
export declare type get_auth0_v2_users_by_email_response_T = Auth0UserProfile[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
|
|
2
|
-
import {
|
|
2
|
+
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
import { auth0_management_token__b } from './auth0_management_token__b.js'
|
|
5
5
|
const key = 'get_auth0_v2_users_by_email'
|
|
@@ -13,12 +13,13 @@ export const get_auth0_v2_users_by_email_b = be_(key, ctx=>{
|
|
|
13
13
|
const auth0_token = await auth0_management_token_()
|
|
14
14
|
const authorization = verify_access_token_header_authorization_(auth0_token)
|
|
15
15
|
const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`
|
|
16
|
-
|
|
16
|
+
const res = await fetch(url, {
|
|
17
17
|
method: 'GET',
|
|
18
18
|
headers: {
|
|
19
19
|
'Content-Type': 'application/json',
|
|
20
20
|
authorization
|
|
21
21
|
}
|
|
22
22
|
})
|
|
23
|
+
return [await res.json(), res]
|
|
23
24
|
}
|
|
24
25
|
})
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
1
2
|
import { B } from '@ctx-core/object'
|
|
3
|
+
import type { Client } from 'auth0'
|
|
2
4
|
export declare const patch_auth0_v2_client_b:B<patch_auth0_v2_client_T>
|
|
3
5
|
export interface patch_auth0_v2_client_params_T {
|
|
4
6
|
client_id?:string;
|
|
5
7
|
body?:string;
|
|
6
8
|
json?:unknown;
|
|
7
9
|
}
|
|
8
|
-
export declare type patch_auth0_v2_client_T =
|
|
10
|
+
export declare type patch_auth0_v2_client_T =
|
|
11
|
+
(params:patch_auth0_v2_client_params_T)=>Promise<[Client, Response]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
|
|
2
|
-
import {
|
|
2
|
+
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
import { auth0_management_token__b } from './auth0_management_token__b.js'
|
|
5
5
|
const key = 'patch_auth0_v2_client'
|
|
@@ -13,7 +13,7 @@ export const patch_auth0_v2_client_b = be_(key, ctx=>{
|
|
|
13
13
|
const auth0_token = await auth0_management_token_()
|
|
14
14
|
const authorization = verify_access_token_header_authorization_(auth0_token)
|
|
15
15
|
const url = `https://${AUTH0_DOMAIN$.$}/api/v2/clients/${client_id}`
|
|
16
|
-
|
|
16
|
+
const res = await fetch(url, {
|
|
17
17
|
method: 'PATCH',
|
|
18
18
|
headers: {
|
|
19
19
|
'Content-Type': 'application/json',
|
|
@@ -21,5 +21,6 @@ export const patch_auth0_v2_client_b = be_(key, ctx=>{
|
|
|
21
21
|
},
|
|
22
22
|
body: body || JSON.stringify(json)
|
|
23
23
|
})
|
|
24
|
+
return [await res.json(), res]
|
|
24
25
|
}
|
|
25
26
|
})
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
2
|
import { B } from '@ctx-core/object'
|
|
3
|
+
import type { UserData, UpdateUserData } from 'auth0'
|
|
4
|
+
import type { Auth0Error } from 'auth0-js'
|
|
3
5
|
export declare const patch_auth0_v2_user_b:B<patch_auth0_v2_user_T>
|
|
4
|
-
export interface patch_auth0_v2_user_data_I extends Partial<
|
|
6
|
+
export interface patch_auth0_v2_user_data_I extends Partial<UserData> {
|
|
5
7
|
password?:string;
|
|
6
8
|
}
|
|
7
|
-
export declare type patch_auth0_v2_user_T =
|
|
9
|
+
export declare type patch_auth0_v2_user_T =
|
|
10
|
+
(user_id:string, data:patch_auth0_v2_user_data_I)=>Promise<[UpdateUserData|Auth0Error, Response]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
|
|
2
|
-
import {
|
|
2
|
+
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
import { auth0_management_token__b } from './auth0_management_token__b.js'
|
|
5
5
|
const key = 'patch_auth0_v2_user'
|
|
@@ -18,7 +18,7 @@ export const patch_auth0_v2_user_b = be_(key, ctx=>{
|
|
|
18
18
|
const auth0_management_token = await auth0_management_token_()
|
|
19
19
|
const authorization = verify_access_token_header_authorization_(auth0_management_token)
|
|
20
20
|
const url = `https://${AUTH0_DOMAIN$.$}/api/v2/users/${user_id}`
|
|
21
|
-
|
|
21
|
+
const res = await fetch(url, {
|
|
22
22
|
method: 'PATCH',
|
|
23
23
|
headers: {
|
|
24
24
|
'Content-Type': 'application/json',
|
|
@@ -26,5 +26,6 @@ export const patch_auth0_v2_user_b = be_(key, ctx=>{
|
|
|
26
26
|
},
|
|
27
27
|
body: JSON.stringify(data)
|
|
28
28
|
})
|
|
29
|
+
return [await res.json(), res]
|
|
29
30
|
}
|
|
30
31
|
})
|