@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 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.83",
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.22",
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": "^3.7.1"
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 { User } from 'auth0'
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_<User>
8
+ WritableAtom_<UserProfile>
9
9
  >
@@ -1,5 +1,5 @@
1
1
  import { ctx_ } from '@ctx-core/object'
2
- import { User } from 'auth0'
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 User
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 { CreateClientGrant } from 'auth0'
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
- CreateClientGrant|Auth0Error
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 { User } from 'auth0'
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
- User|Auth0Error
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 { AUTH0_DOMAIN__set } from '@ctx-core/auth0'
2
- import { ctx_ } from '@ctx-core/object'
3
- import { type User } 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
- test.after.each(()=>restore())
10
- test('auth0__v2_user__GET__fetch', async ()=>{
11
- const ctx = ctx_()
12
- AUTH0_DOMAIN__set(ctx, 'myapp.auth0.com')
13
- auth0_management__init(ctx, {
14
- AUTH0_MANAGEMENT_ID: 'AUTH0_MANAGEMENT_ID',
15
- AUTH0_MANAGEMENT_SECRET: 'AUTH0_MANAGEMENT_SECRET'
16
- })
17
- const auth0__user = auth0__user__new()
18
- api_v2_user__stub(auth0__user)
19
- const response = await auth0__v2_user__GET__fetch(ctx, {
20
- user_id: '123'
21
- })
22
- equal(response.status, 200)
23
- equal(await response.json(), auth0__user)
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
- const ctx = ctx_()
27
- AUTH0_DOMAIN__set(ctx, 'myapp.auth0.com')
28
- auth0_management__init(ctx, {
29
- AUTH0_MANAGEMENT_ID: 'AUTH0_MANAGEMENT_ID',
30
- AUTH0_MANAGEMENT_SECRET: 'AUTH0_MANAGEMENT_SECRET'
31
- })
32
- const test__auth0__user = auth0__user__new()
33
- api_v2_user__stub(test__auth0__user)
34
- const [auth0__user, response] =
35
- await auth0__v2_user__GET__fetch2(ctx, {
36
- user_id: '123'
37
- })
38
- equal(response.status, 200)
39
- equal(auth0__user, test__auth0__user)
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
- return {
44
- 'user_id': 'auth0|507f1f77bcf86cd799439020',
45
- 'email': 'john.doe@gmail.com',
46
- 'email_verified': false,
47
- 'username': 'johndoe',
48
- 'phone_number': '+199999999999999',
49
- 'phone_verified': false,
50
- 'created_at': '',
51
- 'updated_at': '',
52
- 'identities': [
53
- {
54
- 'connection': 'Initial-Connection',
55
- 'user_id': '507f1f77bcf86cd799439020',
56
- 'provider': 'auth0',
57
- 'isSocial': false
58
- }
59
- ],
60
- 'app_metadata': {},
61
- 'user_metadata': {},
62
- 'picture': '',
63
- 'name': '',
64
- 'nickname': '',
65
- 'multifactor': [
66
- ''
67
- ],
68
- 'last_ip': '',
69
- 'last_login': '',
70
- 'logins_count': 0,
71
- 'blocked': false,
72
- 'given_name': '',
73
- 'family_name': ''
74
- } as User
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
- function api_v2_user__stub(auth0__user:User) {
77
- const fetch = stub(globalThis, 'fetch')
78
- fetch
79
- .withArgs('https://myapp.auth0.com/oauth/token', {
80
- method: 'POST',
81
- headers: { 'Content-Type': 'application/json' },
82
- body: JSON.stringify({
83
- grant_type: 'client_credentials',
84
- client_id: 'AUTH0_MANAGEMENT_ID',
85
- client_secret: 'AUTH0_MANAGEMENT_SECRET',
86
- audience: 'https://myapp.auth0.com/api/v2/',
87
- })
88
- })
89
- .resolves(new Response(JSON.stringify({
90
- access_token: 'access_token',
91
- token_type: 'Bearer',
92
- }), {
93
- status: 200,
94
- headers: {
95
- 'Content-Type': 'application/json'
96
- }
97
- }))
98
- fetch.withArgs('https://myapp.auth0.com/api/v2/users/123')
99
- .resolves(new Response(JSON.stringify(auth0__user), {
100
- status: 200,
101
- headers: {
102
- 'Content-Type': 'application/json'
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 { UpdateUserData, UserData } from 'auth0'
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
- UpdateUserData|auth0__v2_user__PATCH__error_T
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<UserData> {
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 { AppMetadata, ManagementClient, UserMetadata } from 'auth0'
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<AppMetadata, UserMetadata>
6
+ ):ManagementClient
7
7
  export {
8
8
  auth0_management__new as auth0_management_
9
9
  }