@ctx-core/auth0-management 9.7.83 → 9.7.86
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 +18 -0
- package/package.json +3 -3
- package/src/auth0__user/index.d.ts +2 -2
- package/src/auth0__user/index.test.ts +2 -2
- package/src/auth0__v2_client_grants__GET__fetch/index.d.ts +2 -2
- package/src/auth0__v2_user__GET__fetch/index.d.ts +2 -2
- package/src/auth0__v2_user__GET__fetch/index.test.ts +102 -99
- package/src/auth0__v2_user__PATCH__fetch/index.d.ts +3 -3
- package/src/auth0_management__new/index.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @ctx-core/auth0-management
|
|
2
2
|
|
|
3
|
+
## 9.7.86
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @ctx-core/auth0: ^40.0.22 -> ^40.0.23
|
|
8
|
+
|
|
9
|
+
## 9.7.85
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: types
|
|
14
|
+
|
|
15
|
+
## 9.7.84
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- auth0: ^3.7.1 -> ^4.0.0
|
|
20
|
+
|
|
3
21
|
## 9.7.83
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-management",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.86",
|
|
4
4
|
"description": "ctx-core auth0 management api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ctx-core/auth0": "^40.0.
|
|
31
|
+
"@ctx-core/auth0": "^40.0.23",
|
|
32
32
|
"@ctx-core/env": "^17.3.5",
|
|
33
33
|
"@ctx-core/error": "^12.3.42",
|
|
34
34
|
"@ctx-core/fetch": "^13.0.0",
|
|
35
35
|
"@ctx-core/nanostores": "6.0.8",
|
|
36
36
|
"@ctx-core/object": "^28.0.7",
|
|
37
37
|
"@ctx-core/uri": "^12.4.55",
|
|
38
|
-
"auth0": "^
|
|
38
|
+
"auth0": "^4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/auth0": "^3.3.4",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { be_atom_triple_T, WritableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import type {
|
|
2
|
+
import type { UserProfile } from 'auth0'
|
|
3
3
|
export declare const [
|
|
4
4
|
auth0__user$_,
|
|
5
5
|
auth0__user_,
|
|
6
6
|
auth0__user__set,
|
|
7
7
|
]:be_atom_triple_T<
|
|
8
|
-
WritableAtom_<
|
|
8
|
+
WritableAtom_<UserProfile>
|
|
9
9
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ctx_ } from '@ctx-core/object'
|
|
2
|
-
import {
|
|
2
|
+
import { UserProfile } from 'auth0'
|
|
3
3
|
import { test } from 'uvu'
|
|
4
4
|
import { equal } from 'uvu/assert'
|
|
5
5
|
import { auth0__user$_, auth0__user_, auth0__user__set } from '../index.js'
|
|
@@ -45,5 +45,5 @@ function auth0__user__new() {
|
|
|
45
45
|
"blocked": false,
|
|
46
46
|
"given_name": "",
|
|
47
47
|
"family_name": ""
|
|
48
|
-
} as
|
|
48
|
+
} as UserProfile
|
|
49
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
2
|
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClientGrant } from 'auth0'
|
|
4
4
|
import type { Auth0Error } from 'auth0-js'
|
|
5
5
|
export declare const [
|
|
6
6
|
auth0__v2_client_grants__GET__fetch,
|
|
@@ -10,7 +10,7 @@ export declare const [
|
|
|
10
10
|
ctx:Ctx,
|
|
11
11
|
params:auth0__v2_client_grants__GET__fetch__params_T
|
|
12
12
|
],
|
|
13
|
-
|
|
13
|
+
ClientGrant|Auth0Error
|
|
14
14
|
>
|
|
15
15
|
export {
|
|
16
16
|
auth0__v2_client_grants__GET__fetch2 as auth0__v2_client_grants__fetch_get,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
2
|
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
import type {
|
|
3
|
+
import type { UserProfile } from 'auth0'
|
|
4
4
|
import type { Auth0Error } from 'auth0-js'
|
|
5
5
|
export declare const [
|
|
6
6
|
auth0__v2_user__GET__fetch,
|
|
@@ -10,7 +10,7 @@ export declare const [
|
|
|
10
10
|
ctx:Ctx,
|
|
11
11
|
params:auth0__v2_user__GET__fetch__params_T
|
|
12
12
|
],
|
|
13
|
-
|
|
13
|
+
UserProfile|Auth0Error
|
|
14
14
|
>
|
|
15
15
|
export {
|
|
16
16
|
auth0__v2_user__GET__fetch2 as auth0__v2_user__fetch_get,
|
|
@@ -1,105 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
test(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import {AUTH0_DOMAIN__set} from '@ctx-core/auth0'
|
|
2
|
+
import {ctx_} from '@ctx-core/object'
|
|
3
|
+
import {type UserProfile} from 'auth0'
|
|
4
|
+
import {restore, stub} from 'sinon'
|
|
5
|
+
import {test} from 'uvu'
|
|
6
|
+
import {equal} from 'uvu/assert'
|
|
7
|
+
import {auth0_management__init} from '../auth0_management__init/index.js'
|
|
8
|
+
import {auth0__v2_user__GET__fetch, auth0__v2_user__GET__fetch2} from './index.js'
|
|
9
|
+
|
|
10
|
+
test.after.each(() => restore())
|
|
11
|
+
test('auth0__v2_user__GET__fetch', async () => {
|
|
12
|
+
const ctx = ctx_()
|
|
13
|
+
AUTH0_DOMAIN__set(ctx, 'myapp.auth0.com')
|
|
14
|
+
auth0_management__init(ctx, {
|
|
15
|
+
AUTH0_MANAGEMENT_ID: 'AUTH0_MANAGEMENT_ID',
|
|
16
|
+
AUTH0_MANAGEMENT_SECRET: 'AUTH0_MANAGEMENT_SECRET'
|
|
17
|
+
})
|
|
18
|
+
const auth0__user = auth0__user__new()
|
|
19
|
+
api_v2_user__stub(auth0__user)
|
|
20
|
+
const response = await auth0__v2_user__GET__fetch(ctx, {
|
|
21
|
+
user_id: '123'
|
|
22
|
+
})
|
|
23
|
+
equal(response.status, 200)
|
|
24
|
+
equal(await response.json(), auth0__user)
|
|
24
25
|
})
|
|
25
|
-
test('auth0__v2_user__GET__fetch2', async ()=>{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
test('auth0__v2_user__GET__fetch2', async () => {
|
|
27
|
+
const ctx = ctx_()
|
|
28
|
+
AUTH0_DOMAIN__set(ctx, 'myapp.auth0.com')
|
|
29
|
+
auth0_management__init(ctx, {
|
|
30
|
+
AUTH0_MANAGEMENT_ID: 'AUTH0_MANAGEMENT_ID',
|
|
31
|
+
AUTH0_MANAGEMENT_SECRET: 'AUTH0_MANAGEMENT_SECRET'
|
|
32
|
+
})
|
|
33
|
+
const test__auth0__user = auth0__user__new()
|
|
34
|
+
api_v2_user__stub(test__auth0__user)
|
|
35
|
+
const [auth0__user, response] =
|
|
36
|
+
await auth0__v2_user__GET__fetch2(ctx, {
|
|
37
|
+
user_id: '123'
|
|
38
|
+
})
|
|
39
|
+
equal(response.status, 200)
|
|
40
|
+
equal(auth0__user, test__auth0__user)
|
|
40
41
|
})
|
|
41
42
|
test.run()
|
|
43
|
+
|
|
42
44
|
function auth0__user__new() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
45
|
+
return {
|
|
46
|
+
'user_id': 'auth0|507f1f77bcf86cd799439020',
|
|
47
|
+
'email': 'john.doe@gmail.com',
|
|
48
|
+
'email_verified': false,
|
|
49
|
+
'username': 'johndoe',
|
|
50
|
+
'phone_number': '+199999999999999',
|
|
51
|
+
'phone_verified': false,
|
|
52
|
+
'created_at': '',
|
|
53
|
+
'updated_at': '',
|
|
54
|
+
'identities': [
|
|
55
|
+
{
|
|
56
|
+
'connection': 'Initial-Connection',
|
|
57
|
+
'user_id': '507f1f77bcf86cd799439020',
|
|
58
|
+
'provider': 'auth0',
|
|
59
|
+
'isSocial': false
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
'app_metadata': {},
|
|
63
|
+
'user_metadata': {},
|
|
64
|
+
'picture': '',
|
|
65
|
+
'name': '',
|
|
66
|
+
'nickname': '',
|
|
67
|
+
'multifactor': [
|
|
68
|
+
''
|
|
69
|
+
],
|
|
70
|
+
'last_ip': '',
|
|
71
|
+
'last_login': '',
|
|
72
|
+
'logins_count': 0,
|
|
73
|
+
'blocked': false,
|
|
74
|
+
'given_name': '',
|
|
75
|
+
'family_name': ''
|
|
76
|
+
} as UserProfile
|
|
75
77
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
78
|
+
|
|
79
|
+
function api_v2_user__stub(auth0__user: UserProfile) {
|
|
80
|
+
const fetch = stub(globalThis, 'fetch')
|
|
81
|
+
fetch
|
|
82
|
+
.withArgs('https://myapp.auth0.com/oauth/token', {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
headers: {'Content-Type': 'application/json'},
|
|
85
|
+
body: JSON.stringify({
|
|
86
|
+
grant_type: 'client_credentials',
|
|
87
|
+
client_id: 'AUTH0_MANAGEMENT_ID',
|
|
88
|
+
client_secret: 'AUTH0_MANAGEMENT_SECRET',
|
|
89
|
+
audience: 'https://myapp.auth0.com/api/v2/',
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
.resolves(new Response(JSON.stringify({
|
|
93
|
+
access_token: 'access_token',
|
|
94
|
+
token_type: 'Bearer',
|
|
95
|
+
}), {
|
|
96
|
+
status: 200,
|
|
97
|
+
headers: {
|
|
98
|
+
'Content-Type': 'application/json'
|
|
99
|
+
}
|
|
100
|
+
}))
|
|
101
|
+
fetch.withArgs('https://myapp.auth0.com/api/v2/users/123')
|
|
102
|
+
.resolves(new Response(JSON.stringify(auth0__user), {
|
|
103
|
+
status: 200,
|
|
104
|
+
headers: {
|
|
105
|
+
'Content-Type': 'application/json'
|
|
106
|
+
}
|
|
107
|
+
}))
|
|
105
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
2
|
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
import type {
|
|
3
|
+
import type { UserUpdate, UserProfile } from 'auth0'
|
|
4
4
|
import type { Auth0Error } from 'auth0-js'
|
|
5
5
|
export declare const [
|
|
6
6
|
auth0__v2_user__PATCH__fetch,
|
|
@@ -11,13 +11,13 @@ export declare const [
|
|
|
11
11
|
user_id:string,
|
|
12
12
|
data:auth0__v2_user__PATCH__fetch__data_T
|
|
13
13
|
],
|
|
14
|
-
|
|
14
|
+
UserUpdate|auth0__v2_user__PATCH__error_T
|
|
15
15
|
>
|
|
16
16
|
export {
|
|
17
17
|
auth0__v2_user__PATCH__fetch2 as auth0__v2_user__fetch_patch,
|
|
18
18
|
auth0__v2_user__PATCH__fetch2 as patch_auth0_v2_user,
|
|
19
19
|
}
|
|
20
|
-
export interface auth0__v2_user__PATCH__fetch__data_T extends Partial<
|
|
20
|
+
export interface auth0__v2_user__PATCH__fetch__data_T extends Partial<UserProfile> {
|
|
21
21
|
password?:string
|
|
22
22
|
}
|
|
23
23
|
export type auth0__v2_user__fetch_patch__params_T = auth0__v2_user__PATCH__fetch__data_T
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Ctx } from '@ctx-core/object'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ManagementClient } from 'auth0'
|
|
3
3
|
export declare function auth0_management__new(
|
|
4
4
|
ctx:Ctx,
|
|
5
5
|
params?:auth0_management__params_T
|
|
6
|
-
):ManagementClient
|
|
6
|
+
):ManagementClient
|
|
7
7
|
export {
|
|
8
8
|
auth0_management__new as auth0_management_
|
|
9
9
|
}
|