@ctx-core/auth0-management 9.2.185 → 9.4.2
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 +46 -0
- package/COMMIT_EDITMSG +1 -0
- package/bin/add-grant-password-auth0.mjs +2 -2
- package/bin/auth0.mjs +2 -2
- package/bin/getAll-client-grants-auth0.mjs +2 -2
- package/package.json +5 -4
- package/src/AUTH0_MANAGEMENT_ID__/index.d.ts +6 -5
- package/src/AUTH0_MANAGEMENT_ID__/index.js +6 -15
- package/src/AUTH0_MANAGEMENT_SECRET__/index.d.ts +6 -5
- package/src/AUTH0_MANAGEMENT_SECRET__/index.js +6 -15
- package/src/auth0__v2_client__GET__fetch/index.d.ts +24 -0
- package/src/auth0__v2_client__GET__fetch/index.js +41 -0
- package/src/auth0__v2_client_grants__GET__fetch/index.d.ts +23 -0
- package/src/auth0__v2_client_grants__GET__fetch/index.js +35 -0
- package/src/auth0__v2_user__GET__fetch/index.d.ts +24 -0
- package/src/auth0__v2_user__GET__fetch/index.js +35 -0
- package/src/auth0__v2_user__PATCH__fetch/index.d.ts +28 -0
- package/src/auth0__v2_user__PATCH__fetch/index.js +44 -0
- package/src/auth0__v2_users_by_email__GET__fetch/index.d.ts +23 -0
- package/src/auth0__v2_users_by_email__GET__fetch/index.js +37 -0
- package/src/{auth0_management__client_credentials__body_ → auth0_management__client_credentials__body__new}/index.d.ts +3 -2
- package/src/{auth0_management__client_credentials__body_ → auth0_management__client_credentials__body__new}/index.js +3 -2
- package/src/auth0_management__init/index.js +4 -2
- package/src/{auth0_management_ → auth0_management__new}/index.d.ts +4 -1
- package/src/{auth0_management_ → auth0_management__new}/index.js +10 -3
- package/src/auth0_management__token_/index.js +10 -4
- package/src/index.d.ts +7 -7
- package/src/index.js +7 -7
- package/src/auth0__v2_client__fetch_get/index.d.ts +0 -15
- package/src/auth0__v2_client__fetch_get/index.js +0 -36
- package/src/auth0__v2_client_grants__fetch_get/index.d.ts +0 -14
- package/src/auth0__v2_client_grants__fetch_get/index.js +0 -32
- package/src/auth0__v2_user__fetch_get/index.d.ts +0 -15
- package/src/auth0__v2_user__fetch_get/index.js +0 -33
- package/src/auth0__v2_user__fetch_patch/index.d.ts +0 -18
- package/src/auth0__v2_user__fetch_patch/index.js +0 -39
- package/src/auth0__v2_users_by_email__fetch_get/index.d.ts +0 -14
- package/src/auth0__v2_users_by_email__fetch_get/index.js +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @ctx-core/auth0-management
|
|
2
2
|
|
|
3
|
+
## 9.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @ctx-core/auth0: ^38.2.9 -> ^38.2.10
|
|
8
|
+
- @ctx-core/env: ^17.2.89 -> ^17.2.90
|
|
9
|
+
|
|
10
|
+
## 9.4.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @ctx-core/nanostores@3.4.3
|
|
16
|
+
|
|
17
|
+
## 9.4.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- - auth0\_\_v2_user\_\_PATCH\_\_fetch\_\_data_T: aliased by auth0\_\_v2_user\_\_fetch_patch\_\_params_T
|
|
22
|
+
- - auth0\_\_v2_users_by_email\_\_GET\_\_fetch\_\_params_T: aliased by auth0\_\_v2_users_by_email\_\_fetch_get\_\_params_T
|
|
23
|
+
- - auth0\_\_v2_client_grants\_\_GET\_\_fetch\_\_params_T: aliased by auth0\_\_v2_client_grants\_\_fetch_get\_\_params_T
|
|
24
|
+
- - auth0\_\_v2_client\_\_GET\_\_fetch\_\_params_T: aliased by auth0\_\_v2_client\_\_fetch_get\_\_params_T
|
|
25
|
+
- - auth0\_\_v2_user\_\_GET\_\_fetch\_\_params_T: aliased by auth0\_\_v2_user\_\_fetch_get\_\_params_T
|
|
26
|
+
|
|
27
|
+
## 9.3.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- - auth0\_\_v2_user\_\_PATCH\_\_fetch
|
|
32
|
+
- - auth0\_\_v2_user\_\_GET\_\_fetch
|
|
33
|
+
- - auth0\_\_v2_client\_\_GET\_\_fetch
|
|
34
|
+
- - auth0\_\_v2_user\_\_PATCH\_\_fetch2: aliased by auth0\_\_v2_user\_\_fetch_patch
|
|
35
|
+
- - auth0_management\__new: aliased by auth0_management_
|
|
36
|
+
- - auth0\_\_v2_users_by_email\_\_GET\_\_fetch
|
|
37
|
+
- - auth0\_\_v2_user\_\_GET\_\_fetch2: aliased by auth0\_\_v2_user\_\_fetch_get
|
|
38
|
+
- - auth0\_\_v2_client\_\_GET\_\_fetch2: aliased by auth0\_\_v2_client\_\_fetch_get
|
|
39
|
+
- - auth0\_\_v2_client_grants\_\_GET\_\_fetch
|
|
40
|
+
- - auth0\_\_v2_client_grants\_\_GET\_\_fetch2: aliased by auth0\_\_v2_client_grants\_\_fetch_get
|
|
41
|
+
- - auth0_management\_\_client_credentials\_\_body\_\_new: aliased by auth0_management\_\_client_credentials\__body_
|
|
42
|
+
- - auth0\_\_v2_users_by_email\_\_GET\_\_fetch2: aliased by auth0\_\_v2_users_by_email\_\_fetch_get
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies
|
|
47
|
+
- @ctx-core/auth0@38.2.9
|
|
48
|
+
|
|
3
49
|
## 9.2.185
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/COMMIT_EDITMSG
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { ctx_ } from '@ctx-core/object'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__v2_client__GET__fetch2 } from '../src/index.js'
|
|
4
4
|
await main()
|
|
5
5
|
async function main() {
|
|
6
6
|
const ctx = ctx_()
|
|
7
|
-
const [client] = await
|
|
7
|
+
const [client] = await auth0__v2_client__GET__fetch2(ctx, {
|
|
8
8
|
json: {
|
|
9
9
|
grant_types: [
|
|
10
10
|
'password',
|
package/bin/auth0.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { auth0_management__new } from '../src/index.js'
|
|
3
3
|
await main()
|
|
4
4
|
// auth0.js clientGrants getAll
|
|
5
5
|
async function main() {
|
|
6
6
|
const rest_argv_a = process.argv.slice(2)
|
|
7
7
|
const [arg_manager, arg_cmd, ...arg_a] = rest_argv_a
|
|
8
|
-
const management_auth0 =
|
|
8
|
+
const management_auth0 = auth0_management__new()
|
|
9
9
|
const manager = management_auth0[arg_manager]
|
|
10
10
|
if (!manager) throw new Error(`Invalid manager ${arg_manager}`)
|
|
11
11
|
const cmd = manager[arg_cmd]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { import_meta_env_ } from '@ctx-core/env'
|
|
3
3
|
import { ctx_ } from '@ctx-core/object'
|
|
4
|
-
import {
|
|
4
|
+
import { auth0__v2_client_grants__GET__fetch2, auth0__v2__url_ } from '../src/index.js'
|
|
5
5
|
await main()
|
|
6
6
|
async function main() {
|
|
7
7
|
const ctx = ctx_()
|
|
8
|
-
const [json] = await
|
|
8
|
+
const [json] = await auth0__v2_client_grants__GET__fetch2(ctx, {
|
|
9
9
|
json: {
|
|
10
10
|
client_id: import_meta_env_().AUTH0_CLIENT_ID,
|
|
11
11
|
audience: auth0__v2__url_(ctx)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-management",
|
|
3
|
-
"version": "9.2
|
|
3
|
+
"version": "9.4.2",
|
|
4
4
|
"description": "ctx-core auth0 management api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -28,11 +28,12 @@
|
|
|
28
28
|
"getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ctx-core/auth0": "^38.2.
|
|
32
|
-
"@ctx-core/env": "^17.2.
|
|
31
|
+
"@ctx-core/auth0": "^38.2.10",
|
|
32
|
+
"@ctx-core/env": "^17.2.90",
|
|
33
33
|
"@ctx-core/error": "^12.3.28",
|
|
34
|
+
"@ctx-core/fetch": "^12.10.3",
|
|
34
35
|
"@ctx-core/fetch-undici": "^2.6.56",
|
|
35
|
-
"@ctx-core/nanostores": "3.4.
|
|
36
|
+
"@ctx-core/nanostores": "3.4.3",
|
|
36
37
|
"@ctx-core/object": "^27.4.25",
|
|
37
38
|
"@ctx-core/uri": "^12.4.40",
|
|
38
39
|
"auth0": "^3.4.0"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { be_atom_triple_T } from '@ctx-core/nanostores'
|
|
2
|
+
export declare const [
|
|
3
|
+
AUTH0_MANAGEMENT_ID__,
|
|
4
|
+
AUTH0_MANAGEMENT_ID_,
|
|
5
|
+
AUTH0_MANAGEMENT_ID__set,
|
|
6
|
+
]:be_atom_triple_T<string>
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { import_meta_env_ } from '@ctx-core/env'
|
|
2
|
-
import { atom_ } from '@ctx-core/nanostores'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { atom_, be_atom_triple_ } from '@ctx-core/nanostores'
|
|
3
|
+
export const [
|
|
4
|
+
AUTH0_MANAGEMENT_ID__,
|
|
5
|
+
AUTH0_MANAGEMENT_ID_,
|
|
6
|
+
AUTH0_MANAGEMENT_ID__set,
|
|
7
|
+
] = be_atom_triple_(()=>
|
|
7
8
|
atom_(import_meta_env_().AUTH0_MANAGEMENT_ID))
|
|
8
|
-
export function AUTH0_MANAGEMENT_ID_(ctx) {
|
|
9
|
-
return AUTH0_MANAGEMENT_ID__(ctx).$
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @param {Ctx}ctx
|
|
13
|
-
* @param {string}AUTH0_MANAGEMENT_ID
|
|
14
|
-
*/
|
|
15
|
-
export function AUTH0_MANAGEMENT_ID__set(ctx, AUTH0_MANAGEMENT_ID) {
|
|
16
|
-
AUTH0_MANAGEMENT_ID__(ctx).$ = AUTH0_MANAGEMENT_ID
|
|
17
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { be_atom_triple_T } from '@ctx-core/nanostores'
|
|
2
|
+
export declare const [
|
|
3
|
+
AUTH0_MANAGEMENT_SECRET__,
|
|
4
|
+
AUTH0_MANAGEMENT_SECRET_,
|
|
5
|
+
AUTH0_MANAGEMENT_SECRET__set,
|
|
6
|
+
]:be_atom_triple_T<string>
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { import_meta_env_ } from '@ctx-core/env'
|
|
2
|
-
import { atom_ } from '@ctx-core/nanostores'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { atom_, be_atom_triple_ } from '@ctx-core/nanostores'
|
|
3
|
+
export const [
|
|
4
|
+
AUTH0_MANAGEMENT_SECRET__,
|
|
5
|
+
AUTH0_MANAGEMENT_SECRET_,
|
|
6
|
+
AUTH0_MANAGEMENT_SECRET__set,
|
|
7
|
+
] = be_atom_triple_(()=>
|
|
7
8
|
atom_(import_meta_env_().AUTH0_MANAGEMENT_SECRET))
|
|
8
|
-
export function AUTH0_MANAGEMENT_SECRET_(ctx) {
|
|
9
|
-
return AUTH0_MANAGEMENT_SECRET__(ctx).$
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @param {Ctx}ctx
|
|
13
|
-
* @param {string}AUTH0_MANAGEMENT_SECRET
|
|
14
|
-
*/
|
|
15
|
-
export function AUTH0_MANAGEMENT_SECRET__set(ctx, AUTH0_MANAGEMENT_SECRET) {
|
|
16
|
-
AUTH0_MANAGEMENT_SECRET__(ctx).$ = AUTH0_MANAGEMENT_SECRET
|
|
17
|
-
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
import type { Client } from 'auth0'
|
|
4
|
+
export declare const [
|
|
5
|
+
auth0__v2_client__GET__fetch,
|
|
6
|
+
auth0__v2_client__GET__fetch2,
|
|
7
|
+
]:fetch__template_pair_T<
|
|
8
|
+
[
|
|
9
|
+
ctx:Ctx,
|
|
10
|
+
params:auth0__v2_client__GET__fetch__params_T
|
|
11
|
+
],
|
|
12
|
+
Client
|
|
13
|
+
>
|
|
14
|
+
export {
|
|
15
|
+
auth0__v2_client__GET__fetch2 as auth0__v2_client__fetch_get,
|
|
16
|
+
auth0__v2_client__GET__fetch2 as patch_auth0_v2_client,
|
|
17
|
+
}
|
|
18
|
+
export interface auth0__v2_client__GET__fetch__params_T {
|
|
19
|
+
client_id?:string
|
|
20
|
+
body?:string
|
|
21
|
+
json?:unknown
|
|
22
|
+
}
|
|
23
|
+
export type auth0__v2_client__fetch_get = auth0__v2_client__GET__fetch__params_T
|
|
24
|
+
export declare type patch_auth0_v2_client_params_T = auth0__v2_client__GET__fetch__params_T
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AUTH0_CLIENT_ID_, AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
+
import { fetch, fetch__template_pair_ } from '@ctx-core/fetch-undici'
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/fetch').response_pair_T}response_pair_T */
|
|
5
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
6
|
+
/** @typedef {import('auth0').Client}Client */
|
|
7
|
+
/** @typedef {import('./auth0__v2_client__GET__fetch2.d.ts').auth0__v2_client__GET__fetch__params_T}auth0__v2_client__GET__fetch__params_T */
|
|
8
|
+
export const [
|
|
9
|
+
auth0__v2_client__GET__fetch,
|
|
10
|
+
auth0__v2_client__GET__fetch2,
|
|
11
|
+
] = fetch__template_pair_(
|
|
12
|
+
/**
|
|
13
|
+
* @param {Ctx}ctx
|
|
14
|
+
* @param {auth0__v2_client__GET__fetch__params_T}params
|
|
15
|
+
* @returns {Promise<response_pair_T<Client>>}
|
|
16
|
+
*/
|
|
17
|
+
async(
|
|
18
|
+
ctx,
|
|
19
|
+
params
|
|
20
|
+
)=>{
|
|
21
|
+
const {
|
|
22
|
+
client_id = AUTH0_CLIENT_ID_(ctx),
|
|
23
|
+
body,
|
|
24
|
+
json,
|
|
25
|
+
} = params
|
|
26
|
+
const auth0_management__token = await auth0_management__token_(ctx)
|
|
27
|
+
const authorization = header__access_token__verify(auth0_management__token)
|
|
28
|
+
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/clients/${client_id}`
|
|
29
|
+
return fetch(url, {
|
|
30
|
+
method: 'PATCH',
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
authorization
|
|
34
|
+
},
|
|
35
|
+
body: body || JSON.stringify(json)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
export {
|
|
39
|
+
auth0__v2_client__GET__fetch2 as auth0__v2_client__fetch_get,
|
|
40
|
+
auth0__v2_client__GET__fetch2 as patch_auth0_v2_client,
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
import type { CreateClientGrant } from 'auth0'
|
|
4
|
+
export declare const [
|
|
5
|
+
auth0__v2_client_grants__GET__fetch,
|
|
6
|
+
auth0__v2_client_grants__GET__fetch2,
|
|
7
|
+
]:fetch__template_pair_T<
|
|
8
|
+
[
|
|
9
|
+
ctx:Ctx,
|
|
10
|
+
params:auth0__v2_client_grants__GET__fetch__params_T
|
|
11
|
+
],
|
|
12
|
+
CreateClientGrant
|
|
13
|
+
>
|
|
14
|
+
export {
|
|
15
|
+
auth0__v2_client_grants__GET__fetch2 as auth0__v2_client_grants__fetch_get,
|
|
16
|
+
auth0__v2_client_grants__GET__fetch2 as get_auth0_v2_client_grants,
|
|
17
|
+
}
|
|
18
|
+
export interface auth0__v2_client_grants__GET__fetch__params_T {
|
|
19
|
+
query?:string
|
|
20
|
+
json?:any
|
|
21
|
+
}
|
|
22
|
+
export type auth0__v2_client_grants__fetch_get__params_T = auth0__v2_client_grants__GET__fetch__params_T
|
|
23
|
+
export declare type get_auth0_v2_client_grants_params_T = auth0__v2_client_grants__GET__fetch__params_T
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
+
import { fetch, fetch__template_pair_ } from '@ctx-core/fetch-undici'
|
|
3
|
+
import { query_str_ } from '@ctx-core/uri'
|
|
4
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
5
|
+
/** @typedef {import('@ctx-core/fetch').response_pair_T}response_pair_T */
|
|
6
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
7
|
+
/** @typedef {import('auth0').CreateClientGrant}CreateClientGrant */
|
|
8
|
+
/** @typedef {import('./auth0__v2_client_grants__GET__fetch2.d.ts').auth0__v2_client_grants__GET__fetch__params_T}auth0__v2_client_grants__GET__fetch__params_T */
|
|
9
|
+
export const [
|
|
10
|
+
auth0__v2_client_grants__GET__fetch,
|
|
11
|
+
auth0__v2_client_grants__GET__fetch2,
|
|
12
|
+
] = fetch__template_pair_(
|
|
13
|
+
/**
|
|
14
|
+
* @param {Ctx}ctx
|
|
15
|
+
* @param {auth0__v2_client_grants__GET__fetch__params_T}params
|
|
16
|
+
* @returns {Promise<response_pair_T<CreateClientGrant>>}
|
|
17
|
+
*/
|
|
18
|
+
async(ctx, params)=>{
|
|
19
|
+
const { query, json } = params
|
|
20
|
+
const auth0__token = await auth0_management__token_(ctx)
|
|
21
|
+
const authorization = header__access_token__verify(auth0__token)
|
|
22
|
+
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/client-grants?${query || query_str_(json)}`
|
|
23
|
+
return fetch(url, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
authorization
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
export {
|
|
33
|
+
auth0__v2_client_grants__GET__fetch2 as auth0__v2_client_grants__fetch_get,
|
|
34
|
+
auth0__v2_client_grants__GET__fetch2 as get_auth0_v2_client_grants,
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
import type { User } from 'auth0'
|
|
4
|
+
export declare const [
|
|
5
|
+
auth0__v2_user__GET__fetch,
|
|
6
|
+
auth0__v2_user__GET__fetch2,
|
|
7
|
+
]:fetch__template_pair_T<
|
|
8
|
+
[
|
|
9
|
+
ctx:Ctx,
|
|
10
|
+
params:auth0__v2_user__GET__fetch__params_T
|
|
11
|
+
],
|
|
12
|
+
User
|
|
13
|
+
>
|
|
14
|
+
export {
|
|
15
|
+
auth0__v2_user__GET__fetch2 as auth0__v2_user__fetch_get,
|
|
16
|
+
auth0__v2_user__GET__fetch2 as get_auth0_v2_user,
|
|
17
|
+
}
|
|
18
|
+
export interface auth0__v2_user__GET__fetch__params_T {
|
|
19
|
+
AUTH0_DOMAIN?:string
|
|
20
|
+
user_id:string
|
|
21
|
+
}
|
|
22
|
+
export type auth0__v2_user__fetch_get__params_T = auth0__v2_user__GET__fetch__params_T
|
|
23
|
+
export declare type get_auth0_v2_user_params_T = auth0__v2_user__GET__fetch__params_T
|
|
24
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
+
import { fetch, fetch__template_pair_ } from '@ctx-core/fetch-undici'
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @typedef {import('auth0').User}User */
|
|
6
|
+
/** @typedef {import('./auth0__v2_user__GET__fetch2.d.ts').auth0__v2_user__GET__fetch__params_T}auth0__v2_user__GET__fetch__params_T */
|
|
7
|
+
export const [
|
|
8
|
+
auth0__v2_user__GET__fetch,
|
|
9
|
+
auth0__v2_user__GET__fetch2,
|
|
10
|
+
] = fetch__template_pair_(
|
|
11
|
+
/**
|
|
12
|
+
* @param {Ctx}ctx
|
|
13
|
+
* @param {auth0__v2_user__GET__fetch__params_T}params
|
|
14
|
+
* @return {Promise<[User, Response]>}
|
|
15
|
+
*/
|
|
16
|
+
async(ctx, params)=>{
|
|
17
|
+
const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN_(ctx)
|
|
18
|
+
const { user_id } = params
|
|
19
|
+
const auth0__token = await auth0_management__token_(ctx)
|
|
20
|
+
const authorization = header__access_token__verify(auth0__token)
|
|
21
|
+
const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
|
|
22
|
+
return fetch(url, {
|
|
23
|
+
method: 'GET',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
authorization
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
export {
|
|
32
|
+
auth0__v2_user__GET__fetch2 as auth0__v2_user__fetch_get,
|
|
33
|
+
auth0__v2_user__GET__fetch2 as get_auth0_v2_user,
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
import type { UpdateUserData, UserData } from 'auth0'
|
|
4
|
+
import type { Auth0Error } from 'auth0-js'
|
|
5
|
+
export declare const [
|
|
6
|
+
auth0__v2_user__PATCH__fetch,
|
|
7
|
+
auth0__v2_user__PATCH__fetch2,
|
|
8
|
+
]:fetch__template_pair_T<
|
|
9
|
+
[
|
|
10
|
+
ctx:Ctx,
|
|
11
|
+
user_id:string,
|
|
12
|
+
data:auth0__v2_user__PATCH__fetch__data_T
|
|
13
|
+
],
|
|
14
|
+
UpdateUserData|auth0__v2_user__PATCH__error_T
|
|
15
|
+
>
|
|
16
|
+
export {
|
|
17
|
+
auth0__v2_user__PATCH__fetch2 as auth0__v2_user__fetch_patch,
|
|
18
|
+
auth0__v2_user__PATCH__fetch2 as patch_auth0_v2_user,
|
|
19
|
+
}
|
|
20
|
+
export interface auth0__v2_user__PATCH__fetch__data_T extends Partial<UserData> {
|
|
21
|
+
password?:string
|
|
22
|
+
}
|
|
23
|
+
export type auth0__v2_user__fetch_patch__params_T = auth0__v2_user__PATCH__fetch__data_T
|
|
24
|
+
export declare type patch_auth0_v2_user_data_T = auth0__v2_user__PATCH__fetch__data_T
|
|
25
|
+
export interface auth0__v2_user__PATCH__error_T extends Auth0Error {
|
|
26
|
+
message:string
|
|
27
|
+
}
|
|
28
|
+
export type auth0__v2_user__fetch_patch__error_T = auth0__v2_user__PATCH__error_T
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
+
import { fetch, fetch__template_pair_ } from '@ctx-core/fetch-undici'
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @typedef {import('auth0').UpdateUserData}UpdateUserData */
|
|
6
|
+
/** @typedef {import('./auth0__v2_user__PATCH__fetch2.d.ts').auth0__v2_user__PATCH__fetch__data_T}auth0__v2_user__PATCH__fetch__data_T */
|
|
7
|
+
/** @typedef {import('./index.d.ts').auth0__v2_user__PATCH__error_T}auth0__v2_user__PATCH__error_T */
|
|
8
|
+
export const [
|
|
9
|
+
auth0__v2_user__PATCH__fetch,
|
|
10
|
+
auth0__v2_user__PATCH__fetch2,
|
|
11
|
+
] = fetch__template_pair_(
|
|
12
|
+
/**
|
|
13
|
+
* @param {Ctx}ctx
|
|
14
|
+
* @param {string}user_id
|
|
15
|
+
* @param {auth0__v2_user__PATCH__fetch__data_T}data
|
|
16
|
+
* @return {Promise<[UpdateUserData|auth0__v2_user__PATCH__error_T, Response]>}
|
|
17
|
+
* @see {@link https://auth0.com/docs/api-auth/tutorials/client-credentials}
|
|
18
|
+
* @see {@link https://auth0.com/docs/api-auth/which-oauth-flow-to-use}
|
|
19
|
+
* @see {@link https://auth0.com/docs/clients/client-grant-types}
|
|
20
|
+
* @see {@link https://auth0.com/docs/api-auth/grant/authorization-code}
|
|
21
|
+
* @see {@link https://auth0.com/docs/protocols/oauth2}
|
|
22
|
+
*/
|
|
23
|
+
async(
|
|
24
|
+
ctx,
|
|
25
|
+
user_id,
|
|
26
|
+
data
|
|
27
|
+
)=>{
|
|
28
|
+
const auth0_management_token = await auth0_management__token_(ctx)
|
|
29
|
+
const authorization = header__access_token__verify(auth0_management_token)
|
|
30
|
+
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/users/${user_id}`
|
|
31
|
+
return fetch(url, {
|
|
32
|
+
method: 'PATCH',
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
authorization
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify(data)
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
export {
|
|
42
|
+
auth0__v2_user__PATCH__fetch2 as auth0__v2_user__fetch_patch,
|
|
43
|
+
auth0__v2_user__PATCH__fetch2 as patch_auth0_v2_user,
|
|
44
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { fetch__template_pair_T } from '@ctx-core/fetch'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
import type { Auth0UserProfile } from 'auth0-js'
|
|
4
|
+
export declare const [
|
|
5
|
+
auth0__v2_users_by_email__GET__fetch,
|
|
6
|
+
auth0__v2_users_by_email__GET__fetch2,
|
|
7
|
+
]:fetch__template_pair_T<
|
|
8
|
+
[
|
|
9
|
+
ctx:Ctx,
|
|
10
|
+
params:auth0__v2_users_by_email__GET__fetch__params_T
|
|
11
|
+
],
|
|
12
|
+
Auth0UserProfile[]
|
|
13
|
+
>
|
|
14
|
+
export {
|
|
15
|
+
auth0__v2_users_by_email__GET__fetch2 as auth0__v2_users_by_email__fetch_get,
|
|
16
|
+
auth0__v2_users_by_email__GET__fetch2 as get_auth0_v2_users_by_email,
|
|
17
|
+
}
|
|
18
|
+
export declare type auth0__v2_users_by_email__GET__fetch__params_T = {
|
|
19
|
+
email:string
|
|
20
|
+
AUTH0_DOMAIN?:string
|
|
21
|
+
}
|
|
22
|
+
export type auth0__v2_users_by_email__fetch_get__params_T = auth0__v2_users_by_email__GET__fetch__params_T
|
|
23
|
+
export declare type get_auth0_v2_users_by_email_params_T = auth0__v2_users_by_email__GET__fetch__params_T
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
+
import { fetch, fetch__template_pair_ } from '@ctx-core/fetch-undici'
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @type {import('auth0-js').Auth0UserProfile}Auth0UserProfile */
|
|
6
|
+
/** @typedef {import('./auth0__v2_users_by_email__GET__fetch2.d.ts').auth0__v2_users_by_email__GET__fetch__params_T}auth0__v2_users_by_email__GET__fetch__params_T */
|
|
7
|
+
export const [
|
|
8
|
+
auth0__v2_users_by_email__GET__fetch,
|
|
9
|
+
auth0__v2_users_by_email__GET__fetch2,
|
|
10
|
+
] = fetch__template_pair_(
|
|
11
|
+
/**
|
|
12
|
+
* @param {Ctx}ctx
|
|
13
|
+
* @param {auth0__v2_users_by_email__GET__fetch__params_T}params
|
|
14
|
+
* @return {Promise<[Auth0UserProfile[], Response]>}
|
|
15
|
+
*/
|
|
16
|
+
async (ctx, params)=>{
|
|
17
|
+
const { email } = params
|
|
18
|
+
const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN_(ctx)
|
|
19
|
+
const auth0__token = await auth0_management__token_(ctx)
|
|
20
|
+
const authorization = header__access_token__verify(auth0__token)
|
|
21
|
+
const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`
|
|
22
|
+
const res = await fetch(url, {
|
|
23
|
+
method: 'GET',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
authorization
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
/** @type {Auth0UserProfile[]} */
|
|
30
|
+
const auth0_user_profile_a = await res.json()
|
|
31
|
+
return [auth0_user_profile_a, res]
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
export {
|
|
35
|
+
auth0__v2_users_by_email__GET__fetch2 as auth0__v2_users_by_email__fetch_get,
|
|
36
|
+
auth0__v2_users_by_email__GET__fetch2 as get_auth0_v2_users_by_email,
|
|
37
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { auth0__oauth_token__fetch__body_T } from '@ctx-core/auth0'
|
|
2
2
|
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function auth0_management__client_credentials__body__new(
|
|
4
4
|
ctx:Ctx
|
|
5
5
|
):auth0__oauth_token__fetch__body_T
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
auth0_management__client_credentials__body__new as auth0_management__client_credentials__body_,
|
|
8
|
+
auth0_management__client_credentials__body__new as auth0_management_client_credentials_body_,
|
|
8
9
|
}
|
|
@@ -5,7 +5,7 @@ import { AUTH0_MANAGEMENT_SECRET_ } from '../AUTH0_MANAGEMENT_SECRET__/index.js'
|
|
|
5
5
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
6
6
|
* @return {import('@ctx-core/auth0').auth0__oauth_token__fetch__body_T}
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function auth0_management__client_credentials__body__new(ctx) {
|
|
9
9
|
return {
|
|
10
10
|
grant_type: 'client_credentials',
|
|
11
11
|
client_id: AUTH0_MANAGEMENT_ID_(ctx),
|
|
@@ -14,5 +14,6 @@ export function auth0_management__client_credentials__body_(ctx) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
auth0_management__client_credentials__body__new as auth0_management__client_credentials__body_,
|
|
18
|
+
auth0_management__client_credentials__body__new as auth0_management_client_credentials_body_,
|
|
18
19
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { import_meta_env_ } from '@ctx-core/env'
|
|
2
2
|
import { AUTH0_MANAGEMENT_ID__set } from '../AUTH0_MANAGEMENT_ID__/index.js'
|
|
3
3
|
import { AUTH0_MANAGEMENT_SECRET__set } from '../AUTH0_MANAGEMENT_SECRET__/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @typedef {import('./index.d.ts').auth0_management__init__params_T}auth0_management__init__params_T */
|
|
4
6
|
/**
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
7
|
+
* @param {Ctx}ctx
|
|
8
|
+
* @param {auth0_management__init__params_T}params
|
|
7
9
|
*/
|
|
8
10
|
export function auth0_management__init(
|
|
9
11
|
ctx, params
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Ctx } from '@ctx-core/object'
|
|
2
2
|
import type { AppMetadata, ManagementClient, UserMetadata } from 'auth0'
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function auth0_management__new(
|
|
4
4
|
ctx:Ctx,
|
|
5
5
|
params?:auth0_management__params_T
|
|
6
6
|
):ManagementClient<AppMetadata, UserMetadata>
|
|
7
|
+
export {
|
|
8
|
+
auth0_management__new as auth0_management_
|
|
9
|
+
}
|
|
7
10
|
export interface auth0_management__params_T {
|
|
8
11
|
AUTH0_DOMAIN?:string
|
|
9
12
|
AUTH0_MANAGEMENT_ID?:string
|
|
@@ -4,11 +4,15 @@ import { AUTH0_MANAGEMENT_ID_ } from '../AUTH0_MANAGEMENT_ID__/index.js'
|
|
|
4
4
|
import { AUTH0_MANAGEMENT_SECRET_ } from '../AUTH0_MANAGEMENT_SECRET__/index.js'
|
|
5
5
|
const require = createRequire(import.meta.url)
|
|
6
6
|
const { ManagementClient } = require('auth0')
|
|
7
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
8
|
+
/** @typedef {import('auth0').ManagementClient}ManagementClient */
|
|
9
|
+
/** @typedef {import('./auth0_management__new.d.ts').auth0_management__params_T}auth0_management__params_T */
|
|
7
10
|
/**
|
|
8
|
-
* @param {
|
|
9
|
-
* @
|
|
11
|
+
* @param {Ctx}ctx
|
|
12
|
+
* @param {auth0_management__params_T}params
|
|
13
|
+
* @returns {ManagementClient}
|
|
10
14
|
*/
|
|
11
|
-
export function
|
|
15
|
+
export function auth0_management__new(
|
|
12
16
|
ctx,
|
|
13
17
|
params = {}
|
|
14
18
|
) {
|
|
@@ -32,3 +36,6 @@ export function auth0_management_(
|
|
|
32
36
|
scope
|
|
33
37
|
})
|
|
34
38
|
}
|
|
39
|
+
export {
|
|
40
|
+
auth0_management__new as auth0_management_
|
|
41
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { auth0__oauth_token__POST__fetch2 } from '@ctx-core/auth0'
|
|
2
2
|
import { http_error__throw } from '@ctx-core/error'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
auth0_management__client_credentials__body__new
|
|
5
|
+
} from '../auth0_management__client_credentials__body__new/index.js'
|
|
4
6
|
/** @typedef {import('@ctx-core/auth0').auth0__token_T}auth0__token_T */
|
|
7
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
8
|
/** @typedef {import('auth0-js').Auth0Error}Auth0Error */
|
|
6
9
|
/**
|
|
7
|
-
* @param {
|
|
10
|
+
* @param {Ctx}ctx
|
|
8
11
|
* @return {Promise<auth0__token_T>}
|
|
9
12
|
*/
|
|
10
13
|
export async function auth0_management__token_(ctx) {
|
|
11
|
-
const [
|
|
14
|
+
const [
|
|
15
|
+
payload,
|
|
16
|
+
response
|
|
17
|
+
] =
|
|
12
18
|
await auth0__oauth_token__POST__fetch2(
|
|
13
|
-
ctx,
|
|
19
|
+
ctx, auth0_management__client_credentials__body__new(ctx))
|
|
14
20
|
if (!response.ok) {
|
|
15
21
|
/** @type {Auth0Error} */
|
|
16
22
|
const auth0_error = payload
|
package/src/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './auth0_management__new'
|
|
2
|
+
export * from './auth0_management__client_credentials__body__new'
|
|
3
3
|
export * from './auth0_management__init'
|
|
4
4
|
export * from './auth0_management__token_'
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
5
|
+
export * from './auth0__v2_client_grants__GET__fetch'
|
|
6
|
+
export * from './auth0__v2_user__GET__fetch'
|
|
7
|
+
export * from './auth0__v2_users_by_email__GET__fetch'
|
|
8
|
+
export * from './auth0__v2_client__GET__fetch'
|
|
9
|
+
export * from './auth0__v2_user__PATCH__fetch'
|
|
10
10
|
export * from './AUTH0_MANAGEMENT_ID__'
|
|
11
11
|
export * from './AUTH0_MANAGEMENT_SECRET__'
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './auth0_management__new/index.js'
|
|
2
|
+
export * from './auth0_management__client_credentials__body__new/index.js'
|
|
3
3
|
export * from './auth0_management__init/index.js'
|
|
4
4
|
export * from './auth0_management__token_/index.js'
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
5
|
+
export * from './auth0__v2_client_grants__GET__fetch/index.js'
|
|
6
|
+
export * from './auth0__v2_user__GET__fetch/index.js'
|
|
7
|
+
export * from './auth0__v2_users_by_email__GET__fetch/index.js'
|
|
8
|
+
export * from './auth0__v2_client__GET__fetch/index.js'
|
|
9
|
+
export * from './auth0__v2_user__PATCH__fetch/index.js'
|
|
10
10
|
export * from './AUTH0_MANAGEMENT_ID__/index.js'
|
|
11
11
|
export * from './AUTH0_MANAGEMENT_SECRET__/index.js'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Ctx } from '@ctx-core/object'
|
|
2
|
-
import type { Client } from 'auth0'
|
|
3
|
-
export declare function auth0__v2_client__fetch_get(
|
|
4
|
-
ctx:Ctx,
|
|
5
|
-
params:auth0__v2_client__fetch__params_T
|
|
6
|
-
):Promise<[Client, Response]>
|
|
7
|
-
export {
|
|
8
|
-
auth0__v2_client__fetch_get as patch_auth0_v2_client,
|
|
9
|
-
}
|
|
10
|
-
export interface auth0__v2_client__fetch__params_T {
|
|
11
|
-
client_id?:string
|
|
12
|
-
body?:string
|
|
13
|
-
json?:unknown
|
|
14
|
-
}
|
|
15
|
-
export declare type patch_auth0_v2_client_params_T = auth0__v2_client__fetch__params_T
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AUTH0_CLIENT_ID_, AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
-
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
-
/** @typedef {import('auth0').Client}Client */
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./auth0__v2_client__fetch_get.d.ts').auth0__v2_client__fetch__params_T}params
|
|
8
|
-
* @return {Promise<[Client, Response]>}
|
|
9
|
-
*/
|
|
10
|
-
export async function auth0__v2_client__fetch_get(
|
|
11
|
-
ctx,
|
|
12
|
-
params
|
|
13
|
-
) {
|
|
14
|
-
const {
|
|
15
|
-
client_id = AUTH0_CLIENT_ID_(ctx),
|
|
16
|
-
body,
|
|
17
|
-
json,
|
|
18
|
-
} = params
|
|
19
|
-
const auth0_management__token = await auth0_management__token_(ctx)
|
|
20
|
-
const authorization = header__access_token__verify(auth0_management__token)
|
|
21
|
-
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/clients/${client_id}`
|
|
22
|
-
const res = await fetch(url, {
|
|
23
|
-
method: 'PATCH',
|
|
24
|
-
headers: {
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
authorization
|
|
27
|
-
},
|
|
28
|
-
body: body || JSON.stringify(json)
|
|
29
|
-
})
|
|
30
|
-
/** @type {Client} */
|
|
31
|
-
const client = await res.json()
|
|
32
|
-
return [client, res]
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
auth0__v2_client__fetch_get as patch_auth0_v2_client,
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Ctx } from '@ctx-core/object'
|
|
2
|
-
import type { CreateClientGrant } from 'auth0'
|
|
3
|
-
export declare function auth0__v2_client_grants__fetch_get(
|
|
4
|
-
ctx:Ctx,
|
|
5
|
-
params:auth0__v2_client_grants__fetch__params_T
|
|
6
|
-
):Promise<[CreateClientGrant, Response]>
|
|
7
|
-
export {
|
|
8
|
-
auth0__v2_client_grants__fetch_get as get_auth0_v2_client_grants,
|
|
9
|
-
}
|
|
10
|
-
export interface auth0__v2_client_grants__fetch__params_T {
|
|
11
|
-
query?:string
|
|
12
|
-
json?:any
|
|
13
|
-
}
|
|
14
|
-
export declare type get_auth0_v2_client_grants_params_T = auth0__v2_client_grants__fetch__params_T
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
-
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import { query_str_ } from '@ctx-core/uri'
|
|
4
|
-
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
5
|
-
/** @typedef {import('auth0').CreateClientGrant}CreateClientGrant */
|
|
6
|
-
/**
|
|
7
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
8
|
-
* @param {import('./auth0__v2_client_grants__fetch_get.d.ts').auth0__v2_client_grants__fetch__params_T}params
|
|
9
|
-
* @return {Promise<[CreateClientGrant, Response]>}
|
|
10
|
-
*/
|
|
11
|
-
export async function auth0__v2_client_grants__fetch_get(
|
|
12
|
-
ctx,
|
|
13
|
-
params
|
|
14
|
-
) {
|
|
15
|
-
const { query, json } = params
|
|
16
|
-
const auth0__token = await auth0_management__token_(ctx)
|
|
17
|
-
const authorization = header__access_token__verify(auth0__token)
|
|
18
|
-
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/client-grants?${query || query_str_(json)}`
|
|
19
|
-
const res = await fetch(url, {
|
|
20
|
-
method: 'GET',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
authorization
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
/** @type {CreateClientGrant} */
|
|
27
|
-
const create_client_grant = await res.json()
|
|
28
|
-
return [create_client_grant, res]
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
auth0__v2_client_grants__fetch_get as get_auth0_v2_client_grants,
|
|
32
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Ctx } from '@ctx-core/object'
|
|
2
|
-
import type { User } from 'auth0'
|
|
3
|
-
export declare function auth0__v2_user__fetch_get(
|
|
4
|
-
ctx:Ctx,
|
|
5
|
-
params:auth0__v2_user__fetch_get__params_T
|
|
6
|
-
):Promise<[User, Response]>
|
|
7
|
-
export {
|
|
8
|
-
auth0__v2_user__fetch_get as get_auth0_v2_user,
|
|
9
|
-
}
|
|
10
|
-
export interface auth0__v2_user__fetch_get__params_T {
|
|
11
|
-
AUTH0_DOMAIN?:string
|
|
12
|
-
user_id:string
|
|
13
|
-
}
|
|
14
|
-
export declare type get_auth0_v2_user_params_T = auth0__v2_user__fetch_get__params_T
|
|
15
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
-
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
-
/** @typedef {import('auth0').User}User */
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./auth0__v2_user__fetch_get.d.ts').auth0__v2_user__fetch_get__params_T}params
|
|
8
|
-
* @return {Promise<[User, Response]>}
|
|
9
|
-
*/
|
|
10
|
-
export async function auth0__v2_user__fetch_get(
|
|
11
|
-
ctx,
|
|
12
|
-
params
|
|
13
|
-
) {
|
|
14
|
-
const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN_(ctx)
|
|
15
|
-
const { user_id } = params
|
|
16
|
-
const auth0__token = await auth0_management__token_(ctx)
|
|
17
|
-
const authorization = header__access_token__verify(auth0__token)
|
|
18
|
-
const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
|
|
19
|
-
const res = await fetch(url, {
|
|
20
|
-
method: 'GET',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
authorization
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
/** @type {User} */
|
|
27
|
-
const user = await res.json()
|
|
28
|
-
return [user, res]
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
auth0__v2_user__fetch_get as get_auth0_v2_user,
|
|
32
|
-
}
|
|
33
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Ctx } from '@ctx-core/object'
|
|
2
|
-
import type { UpdateUserData, UserData } from 'auth0'
|
|
3
|
-
import type { Auth0Error } from 'auth0-js'
|
|
4
|
-
export declare function auth0__v2_user__fetch_patch(
|
|
5
|
-
ctx:Ctx,
|
|
6
|
-
user_id:string,
|
|
7
|
-
data:auth0__v2_user__fetch_patch__data_T
|
|
8
|
-
):Promise<[UpdateUserData|auth0__v2_user__fetch_patch__error_T, Response]>
|
|
9
|
-
export {
|
|
10
|
-
auth0__v2_user__fetch_patch as patch_auth0_v2_user,
|
|
11
|
-
}
|
|
12
|
-
export interface auth0__v2_user__fetch_patch__data_T extends Partial<UserData> {
|
|
13
|
-
password?:string
|
|
14
|
-
}
|
|
15
|
-
export declare type patch_auth0_v2_user_data_T = auth0__v2_user__fetch_patch__data_T
|
|
16
|
-
export interface auth0__v2_user__fetch_patch__error_T extends Auth0Error {
|
|
17
|
-
message:string
|
|
18
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
-
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
-
/** @typedef {import('auth0').UpdateUserData}UpdateUserData */
|
|
5
|
-
/** @typedef {import('./index.d.ts').auth0__v2_user__fetch_patch__error_T}auth0__v2_user__fetch_patch__error_T */
|
|
6
|
-
/**
|
|
7
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
8
|
-
* @param {string}user_id
|
|
9
|
-
* @param {import('./auth0__v2_user__fetch_patch.d.ts').auth0__v2_user__fetch_patch__data_T}data
|
|
10
|
-
* @return {Promise<[UpdateUserData|auth0__v2_user__fetch_patch__error_T, Response]>}
|
|
11
|
-
* @see {@link https://auth0.com/docs/api-auth/tutorials/client-credentials}
|
|
12
|
-
* @see {@link https://auth0.com/docs/api-auth/which-oauth-flow-to-use}
|
|
13
|
-
* @see {@link https://auth0.com/docs/clients/client-grant-types}
|
|
14
|
-
* @see {@link https://auth0.com/docs/api-auth/grant/authorization-code}
|
|
15
|
-
* @see {@link https://auth0.com/docs/protocols/oauth2}
|
|
16
|
-
*/
|
|
17
|
-
export async function auth0__v2_user__fetch_patch(
|
|
18
|
-
ctx,
|
|
19
|
-
user_id,
|
|
20
|
-
data
|
|
21
|
-
) {
|
|
22
|
-
const auth0_management_token = await auth0_management__token_(ctx)
|
|
23
|
-
const authorization = header__access_token__verify(auth0_management_token)
|
|
24
|
-
const url = `https://${AUTH0_DOMAIN_(ctx)}/api/v2/users/${user_id}`
|
|
25
|
-
const res = await fetch(url, {
|
|
26
|
-
method: 'PATCH',
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
authorization
|
|
30
|
-
},
|
|
31
|
-
body: JSON.stringify(data)
|
|
32
|
-
})
|
|
33
|
-
/** @type {UpdateUserData|auth0__v2_user__fetch_patch__error_T} */
|
|
34
|
-
const update_user_data_or_auth0_error = await res.json()
|
|
35
|
-
return [update_user_data_or_auth0_error, res]
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
auth0__v2_user__fetch_patch as patch_auth0_v2_user,
|
|
39
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Auth0UserProfile } from 'auth0-js'
|
|
2
|
-
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
export declare function auth0__v2_users_by_email__fetch_get(
|
|
4
|
-
ctx:Ctx,
|
|
5
|
-
params:auth0__v2_users_by_email__fetch__params_T
|
|
6
|
-
):Promise<[Auth0UserProfile[], Response]>
|
|
7
|
-
export {
|
|
8
|
-
auth0__v2_users_by_email__fetch_get as get_auth0_v2_users_by_email,
|
|
9
|
-
}
|
|
10
|
-
export declare type auth0__v2_users_by_email__fetch__params_T = {
|
|
11
|
-
email:string
|
|
12
|
-
AUTH0_DOMAIN?:string
|
|
13
|
-
}
|
|
14
|
-
export declare type get_auth0_v2_users_by_email_params_T = auth0__v2_users_by_email__fetch__params_T
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
|
|
2
|
-
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
|
-
/** @type {import('auth0-js').Auth0UserProfile}Auth0UserProfile */
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./auth0__v2_users_by_email__fetch_get.d.ts').auth0__v2_users_by_email__fetch__params_T}params
|
|
8
|
-
* @return {Promise<[Auth0UserProfile[], Response]>}
|
|
9
|
-
*/
|
|
10
|
-
export async function auth0__v2_users_by_email__fetch_get(
|
|
11
|
-
ctx,
|
|
12
|
-
params
|
|
13
|
-
) {
|
|
14
|
-
const { email } = params
|
|
15
|
-
const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN_(ctx)
|
|
16
|
-
const auth0__token = await auth0_management__token_(ctx)
|
|
17
|
-
const authorization = header__access_token__verify(auth0__token)
|
|
18
|
-
const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`
|
|
19
|
-
const res = await fetch(url, {
|
|
20
|
-
method: 'GET',
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
authorization
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
/** @type {Auth0UserProfile[]} */
|
|
27
|
-
const auth0_user_profile_a = await res.json()
|
|
28
|
-
return [auth0_user_profile_a, res]
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
auth0__v2_users_by_email__fetch_get as get_auth0_v2_users_by_email,
|
|
32
|
-
}
|