@ctx-core/auth0-management 9.0.154 → 9.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.
- package/CHANGELOG.md +20 -0
- package/bin/add-grant-password-auth0.mjs +2 -2
- package/bin/getAll-client-grants-auth0.mjs +3 -3
- package/package.json +3 -3
- package/src/auth0__v2_client__fetch_get/index.d.ts +14 -0
- package/src/{patch_auth0_v2_client → auth0__v2_client__fetch_get}/index.js +9 -6
- package/src/auth0__v2_client_grants__fetch_get/index.d.ts +13 -0
- package/src/{get_auth0_v2_client_grants → auth0__v2_client_grants__fetch_get}/index.js +9 -6
- package/src/{get_auth0_v2_user → auth0__v2_user__fetch_get}/index.d.ts +4 -2
- package/src/{get_auth0_v2_user → auth0__v2_user__fetch_get}/index.js +10 -6
- package/src/auth0__v2_user__fetch_patch/index.d.ts +13 -0
- package/src/{patch_auth0_v2_user → auth0__v2_user__fetch_patch}/index.js +10 -7
- package/src/auth0__v2_users_by_email__fetch_get/index.d.ts +13 -0
- package/src/{get_auth0_v2_users_by_email → auth0__v2_users_by_email__fetch_get}/index.js +9 -6
- package/src/auth0_management_/index.d.ts +3 -2
- package/src/auth0_management_/index.js +1 -1
- package/src/auth0_management__client_credentials__body_/index.d.ts +6 -0
- package/src/auth0_management__client_credentials__body_/index.js +16 -0
- package/src/auth0_management__token_/index.d.ts +6 -0
- package/src/auth0_management__token_/index.js +14 -0
- package/src/index.d.ts +7 -8
- package/src/index.js +7 -8
- package/tsconfig.json +1 -1
- package/src/auth0_audience_/index.d.ts +0 -2
- package/src/auth0_audience_/index.js +0 -9
- package/src/auth0_management_client_credentials_body_/index.d.ts +0 -3
- package/src/auth0_management_client_credentials_body_/index.js +0 -13
- package/src/auth0_management_token_/index.d.ts +0 -3
- package/src/auth0_management_token_/index.js +0 -11
- package/src/get_auth0_v2_client_grants/index.d.ts +0 -10
- package/src/get_auth0_v2_users_by_email/index.d.ts +0 -10
- package/src/patch_auth0_v2_client/index.d.ts +0 -11
- package/src/patch_auth0_v2_user/index.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ctx-core/auth0-management
|
|
2
2
|
|
|
3
|
+
## 9.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @ctx-core/fetch-undici: ^2.3.71 -> ^2.3.72
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @ctx-core/auth0@35.1.1
|
|
11
|
+
|
|
12
|
+
## 9.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- name convention updates
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @ctx-core/auth0@35.1.0
|
|
22
|
+
|
|
3
23
|
## 9.0.154
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -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__fetch_get } 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__fetch_get(ctx, {
|
|
8
8
|
json: {
|
|
9
9
|
grant_types: [
|
|
10
10
|
'password',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { ctx_ } from '@ctx-core/object'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0__v2_client_grants__fetch_get, auth0__v2__url_ } from '../src/index.js'
|
|
4
4
|
await main()
|
|
5
5
|
async function main() {
|
|
6
6
|
const ctx = ctx_()
|
|
7
|
-
const [json] = await
|
|
7
|
+
const [json] = await auth0__v2_client_grants__fetch_get(ctx, {
|
|
8
8
|
json: {
|
|
9
9
|
client_id: process.env.AUTH0_CLIENT_ID,
|
|
10
|
-
audience:
|
|
10
|
+
audience: auth0__v2__url_(ctx)
|
|
11
11
|
}
|
|
12
12
|
})
|
|
13
13
|
console.info(JSON.stringify(json, null, 2))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-management",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"description": "ctx-core auth0 management api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ctx-core/auth0": "^35.
|
|
32
|
-
"@ctx-core/fetch-undici": "^2.3.
|
|
31
|
+
"@ctx-core/auth0": "^35.1.1",
|
|
32
|
+
"@ctx-core/fetch-undici": "^2.3.72",
|
|
33
33
|
"@ctx-core/object": "^24.1.4",
|
|
34
34
|
"@ctx-core/uri": "^12.0.69",
|
|
35
35
|
"auth0": "^3.1.2"
|
|
@@ -0,0 +1,14 @@
|
|
|
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, params:auth0__v2_client__fetch__params_T
|
|
5
|
+
):Promise<[Client, Response]>
|
|
6
|
+
export {
|
|
7
|
+
auth0__v2_client__fetch_get as patch_auth0_v2_client,
|
|
8
|
+
}
|
|
9
|
+
export interface auth0__v2_client__fetch__params_T {
|
|
10
|
+
client_id?:string
|
|
11
|
+
body?:string
|
|
12
|
+
json?:unknown
|
|
13
|
+
}
|
|
14
|
+
export declare type patch_auth0_v2_client_params_T = auth0__v2_client__fetch__params_T
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { header__access_token__verify, AUTH0_DOMAIN__ } from '@ctx-core/auth0'
|
|
2
2
|
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
4
|
/** @typedef {import('auth0').Client}Client */
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./
|
|
7
|
+
* @param {import('./auth0__v2_client__fetch_get.d.ts').auth0__v2_client__fetch__params_T}params
|
|
8
8
|
* @return {Promise<[Client, Response]>}
|
|
9
9
|
*/
|
|
10
|
-
export async function
|
|
10
|
+
export async function auth0__v2_client__fetch_get(ctx, params) {
|
|
11
11
|
const { client_id = process.env.AUTH0_CLIENT_ID, body, json, } = params
|
|
12
|
-
const auth0_token = await
|
|
13
|
-
const authorization =
|
|
12
|
+
const auth0_token = await auth0_management__token_(ctx)
|
|
13
|
+
const authorization = header__access_token__verify(auth0_token)
|
|
14
14
|
const url = `https://${AUTH0_DOMAIN__(ctx).$}/api/v2/clients/${client_id}`
|
|
15
15
|
const res = await fetch(url, {
|
|
16
16
|
method: 'PATCH',
|
|
@@ -24,3 +24,6 @@ export async function patch_auth0_v2_client(ctx, params) {
|
|
|
24
24
|
const client = await res.json()
|
|
25
25
|
return [client, res]
|
|
26
26
|
}
|
|
27
|
+
export {
|
|
28
|
+
auth0__v2_client__fetch_get as patch_auth0_v2_client,
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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, params:auth0__v2_client_grants__fetch__params_T
|
|
5
|
+
):Promise<[CreateClientGrant, Response]>
|
|
6
|
+
export {
|
|
7
|
+
auth0__v2_client_grants__fetch_get as get_auth0_v2_client_grants,
|
|
8
|
+
}
|
|
9
|
+
export interface auth0__v2_client_grants__fetch__params_T {
|
|
10
|
+
query?:string
|
|
11
|
+
json?:any
|
|
12
|
+
}
|
|
13
|
+
export declare type get_auth0_v2_client_grants_params_T = auth0__v2_client_grants__fetch__params_T
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { header__access_token__verify, AUTH0_DOMAIN__ } from '@ctx-core/auth0'
|
|
2
2
|
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
3
|
import { query_str_ } from '@ctx-core/uri'
|
|
4
|
-
import {
|
|
4
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
5
5
|
/** @typedef {import('auth0').CreateClientGrant}CreateClientGrant */
|
|
6
6
|
/**
|
|
7
7
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
8
|
-
* @param {import('./
|
|
8
|
+
* @param {import('./auth0__v2_client_grants__fetch_get.d.ts').auth0__v2_client_grants__fetch__params_T}params
|
|
9
9
|
* @return {Promise<[CreateClientGrant, Response]>}
|
|
10
10
|
*/
|
|
11
|
-
export async function
|
|
11
|
+
export async function auth0__v2_client_grants__fetch_get(ctx, params) {
|
|
12
12
|
const { query, json } = params
|
|
13
|
-
const auth0_token = await
|
|
14
|
-
const authorization =
|
|
13
|
+
const auth0_token = await auth0_management__token_(ctx)
|
|
14
|
+
const authorization = header__access_token__verify(auth0_token)
|
|
15
15
|
const url = `https://${AUTH0_DOMAIN__(ctx).$}/api/v2/client-grants?${query || query_str_(json)}`
|
|
16
16
|
const res = await fetch(url, {
|
|
17
17
|
method: 'GET',
|
|
@@ -24,3 +24,6 @@ export async function get_auth0_v2_client_grants(ctx, params) {
|
|
|
24
24
|
const create_client_grant = await res.json()
|
|
25
25
|
return [create_client_grant, res]
|
|
26
26
|
}
|
|
27
|
+
export {
|
|
28
|
+
auth0__v2_client_grants__fetch_get as get_auth0_v2_client_grants,
|
|
29
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
1
|
import type { Ctx } from '@ctx-core/object'
|
|
3
2
|
import type { User } from 'auth0'
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function auth0__v2_user__fetch_get(
|
|
5
4
|
ctx:Ctx, params:get_auth0_v2_user_params_T
|
|
6
5
|
):Promise<[User, Response]>
|
|
7
6
|
export interface get_auth0_v2_user_params_T {
|
|
8
7
|
AUTH0_DOMAIN:string
|
|
9
8
|
user_id:string
|
|
10
9
|
}
|
|
10
|
+
export {
|
|
11
|
+
auth0__v2_user__fetch_get as get_auth0_v2_user,
|
|
12
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { header__access_token__verify } from '@ctx-core/auth0'
|
|
2
2
|
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
4
|
/** @typedef {import('auth0').User}User */
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./
|
|
7
|
+
* @param {import('./auth0__v2_user__fetch_get.d.ts').get_auth0_v2_user_params_T}params
|
|
8
8
|
* @return {Promise<[User, Response]>}
|
|
9
9
|
*/
|
|
10
|
-
export async function
|
|
10
|
+
export async function auth0__v2_user__fetch_get(ctx, params) {
|
|
11
11
|
const { AUTH0_DOMAIN, user_id } = params
|
|
12
|
-
const auth0_token = await
|
|
13
|
-
const authorization =
|
|
12
|
+
const auth0_token = await auth0_management__token_(ctx)
|
|
13
|
+
const authorization = header__access_token__verify(auth0_token)
|
|
14
14
|
const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
|
|
15
15
|
const res = await fetch(url, {
|
|
16
16
|
method: 'GET',
|
|
@@ -23,3 +23,7 @@ export async function get_auth0_v2_user(ctx, params) {
|
|
|
23
23
|
const user = await res.json()
|
|
24
24
|
return [user, res]
|
|
25
25
|
}
|
|
26
|
+
export {
|
|
27
|
+
auth0__v2_user__fetch_get as get_auth0_v2_user,
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
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, user_id:string, data:auth0__v2_user__fetch_patch__data_T
|
|
6
|
+
):Promise<[UpdateUserData|Auth0Error, Response]>
|
|
7
|
+
export {
|
|
8
|
+
auth0__v2_user__fetch_patch as patch_auth0_v2_user,
|
|
9
|
+
}
|
|
10
|
+
export interface auth0__v2_user__fetch_patch__data_T extends Partial<UserData> {
|
|
11
|
+
password?:string
|
|
12
|
+
}
|
|
13
|
+
export declare type patch_auth0_v2_user_data_T = auth0__v2_user__fetch_patch__data_T
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { header__access_token__verify, AUTH0_DOMAIN__ } from '@ctx-core/auth0'
|
|
2
2
|
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
4
|
/** @typedef {import('auth0').UpdateUserData}UpdateUserData */
|
|
5
|
-
/** @typedef {import('auth0').Auth0Error}Auth0Error */
|
|
5
|
+
/** @typedef {import('auth0-js').Auth0Error}Auth0Error */
|
|
6
6
|
/**
|
|
7
7
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
8
8
|
* @param {string}user_id
|
|
9
|
-
* @param {import('./
|
|
9
|
+
* @param {import('./auth0__v2_user__fetch_patch.d.ts').auth0__v2_user__fetch_patch__data_T}data
|
|
10
10
|
* @return {Promise<[UpdateUserData|Auth0Error, Response]>}
|
|
11
11
|
* @see {@link https://auth0.com/docs/api-auth/tutorials/client-credentials}
|
|
12
12
|
* @see {@link https://auth0.com/docs/api-auth/which-oauth-flow-to-use}
|
|
@@ -14,11 +14,11 @@ import { auth0_management_token_ } from '../auth0_management_token_/index.js'
|
|
|
14
14
|
* @see {@link https://auth0.com/docs/api-auth/grant/authorization-code}
|
|
15
15
|
* @see {@link https://auth0.com/docs/protocols/oauth2}
|
|
16
16
|
*/
|
|
17
|
-
export async function
|
|
17
|
+
export async function auth0__v2_user__fetch_patch(
|
|
18
18
|
ctx, user_id, data
|
|
19
19
|
) {
|
|
20
|
-
const auth0_management_token = await
|
|
21
|
-
const authorization =
|
|
20
|
+
const auth0_management_token = await auth0_management__token_(ctx)
|
|
21
|
+
const authorization = header__access_token__verify(auth0_management_token)
|
|
22
22
|
const url = `https://${AUTH0_DOMAIN__(ctx).$}/api/v2/users/${user_id}`
|
|
23
23
|
const res = await fetch(url, {
|
|
24
24
|
method: 'PATCH',
|
|
@@ -32,3 +32,6 @@ export async function patch_auth0_v2_user(
|
|
|
32
32
|
const update_user_data_or_auth0_error = await res.json()
|
|
33
33
|
return [update_user_data_or_auth0_error, res]
|
|
34
34
|
}
|
|
35
|
+
export {
|
|
36
|
+
auth0__v2_user__fetch_patch as patch_auth0_v2_user,
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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, params:auth0__v2_users_by_email__fetch__params_T
|
|
5
|
+
):Promise<[Auth0UserProfile[], Response]>
|
|
6
|
+
export {
|
|
7
|
+
auth0__v2_users_by_email__fetch_get as get_auth0_v2_users_by_email,
|
|
8
|
+
}
|
|
9
|
+
export declare type auth0__v2_users_by_email__fetch__params_T = {
|
|
10
|
+
email:string
|
|
11
|
+
AUTH0_DOMAIN?:string
|
|
12
|
+
}
|
|
13
|
+
export declare type get_auth0_v2_users_by_email_params_T = auth0__v2_users_by_email__fetch__params_T
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { header__access_token__verify, AUTH0_DOMAIN__ } from '@ctx-core/auth0'
|
|
2
2
|
import { fetch } from '@ctx-core/fetch-undici'
|
|
3
|
-
import {
|
|
3
|
+
import { auth0_management__token_ } from '../auth0_management__token_/index.js'
|
|
4
4
|
/** @type {import('auth0-js').Auth0UserProfile}Auth0UserProfile */
|
|
5
5
|
/**
|
|
6
6
|
* @param {import('@ctx-core/object').Ctx}ctx
|
|
7
|
-
* @param {import('./
|
|
7
|
+
* @param {import('./auth0__v2_users_by_email__fetch_get.d.ts').auth0__v2_users_by_email__fetch__params_T}params
|
|
8
8
|
* @return {Promise<[Auth0UserProfile[], Response]>}
|
|
9
9
|
*/
|
|
10
|
-
export async function
|
|
10
|
+
export async function auth0__v2_users_by_email__fetch_get(ctx, params) {
|
|
11
11
|
const { email } = params
|
|
12
12
|
const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN__(ctx).$
|
|
13
|
-
const auth0_token = await
|
|
14
|
-
const authorization =
|
|
13
|
+
const auth0_token = await auth0_management__token_(ctx)
|
|
14
|
+
const authorization = header__access_token__verify(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',
|
|
@@ -24,3 +24,6 @@ export async function get_auth0_v2_users_by_email(ctx, params) {
|
|
|
24
24
|
const auth0_user_profile_a = await res.json()
|
|
25
25
|
return [auth0_user_profile_a, res]
|
|
26
26
|
}
|
|
27
|
+
export {
|
|
28
|
+
auth0__v2_users_by_email__fetch_get as get_auth0_v2_users_by_email,
|
|
29
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AppMetadata, ManagementClient, UserMetadata } from 'auth0'
|
|
2
2
|
export declare function auth0_management_(
|
|
3
|
-
params?:
|
|
3
|
+
params?:auth0_management__params_T
|
|
4
4
|
):ManagementClient<AppMetadata, UserMetadata>
|
|
5
|
-
export interface
|
|
5
|
+
export interface auth0_management__params_T {
|
|
6
6
|
domain?:string
|
|
7
7
|
clientId?:string
|
|
8
8
|
clientSecret?:string
|
|
9
9
|
}
|
|
10
|
+
export declare type auth0_management_params_I = auth0_management__params_T
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ManagementClient } from 'auth0'
|
|
2
2
|
/**
|
|
3
|
-
* @param {import('./auth0_management_.d.ts').
|
|
3
|
+
* @param {import('./auth0_management_.d.ts').auth0_management__params_T} params
|
|
4
4
|
* @returns {import('auth0').ManagementClient}
|
|
5
5
|
*/
|
|
6
6
|
export function auth0_management_(params = {}) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { auth0__oauth_token__fetch__body_T } from '@ctx-core/auth0'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
export declare function auth0_management__client_credentials__body_(ctx:Ctx):auth0__oauth_token__fetch__body_T
|
|
4
|
+
export {
|
|
5
|
+
auth0_management__client_credentials__body_ as auth0_management_client_credentials_body_,
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { auth0__v2__url_ } from '@ctx-core/auth0'
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('@ctx-core/object').Ctx}ctx
|
|
4
|
+
* @return {import('@ctx-core/auth0').auth0__oauth_token__fetch__body_T}
|
|
5
|
+
*/
|
|
6
|
+
export function auth0_management__client_credentials__body_(ctx) {
|
|
7
|
+
return {
|
|
8
|
+
grant_type: 'client_credentials',
|
|
9
|
+
client_id: process.env.AUTH0_MANAGEMENT_ID,
|
|
10
|
+
client_secret: process.env.AUTH0_MANAGEMENT_SECRET,
|
|
11
|
+
audience: auth0__v2__url_(ctx)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
auth0_management__client_credentials__body_ as auth0_management_client_credentials_body_,
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { auth0__oauth_token__fetch_get } from '@ctx-core/auth0'
|
|
2
|
+
import { auth0_management__client_credentials__body_ } from '../auth0_management__client_credentials__body_/index.js'
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@ctx-core/object').Ctx}ctx
|
|
5
|
+
* @return {Promise<import('@ctx-core/auth0').auth0__token_T>}
|
|
6
|
+
*/
|
|
7
|
+
export async function auth0_management__token_(ctx) {
|
|
8
|
+
const [token_response] = await auth0__oauth_token__fetch_get(
|
|
9
|
+
ctx, auth0_management__client_credentials__body_(ctx))
|
|
10
|
+
return token_response
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
auth0_management__token_ as auth0_management_token_,
|
|
14
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from './auth0_audience_'
|
|
2
1
|
export * from './auth0_management_'
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
2
|
+
export * from './auth0_management__client_credentials__body_'
|
|
3
|
+
export * from './auth0_management__token_'
|
|
4
|
+
export * from './auth0__v2_client_grants__fetch_get'
|
|
5
|
+
export * from './auth0__v2_user__fetch_get'
|
|
6
|
+
export * from './auth0__v2_users_by_email__fetch_get'
|
|
7
|
+
export * from './auth0__v2_client__fetch_get'
|
|
8
|
+
export * from './auth0__v2_user__fetch_patch'
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from './auth0_audience_/index.js'
|
|
2
1
|
export * from './auth0_management_/index.js'
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
2
|
+
export * from './auth0_management__client_credentials__body_/index.js'
|
|
3
|
+
export * from './auth0_management__token_/index.js'
|
|
4
|
+
export * from './auth0__v2_client_grants__fetch_get/index.js'
|
|
5
|
+
export * from './auth0__v2_user__fetch_get/index.js'
|
|
6
|
+
export * from './auth0__v2_users_by_email__fetch_get/index.js'
|
|
7
|
+
export * from './auth0__v2_client__fetch_get/index.js'
|
|
8
|
+
export * from './auth0__v2_user__fetch_patch/index.js'
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AUTH0_DOMAIN__ } from '@ctx-core/auth0'
|
|
2
|
-
/** @type {import('./auth0_audience_.d.ts').auth0_audience_} */
|
|
3
|
-
/**
|
|
4
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
5
|
-
* @return {string}
|
|
6
|
-
*/
|
|
7
|
-
export function auth0_audience_(ctx) {
|
|
8
|
-
return `https://${AUTH0_DOMAIN__(ctx).$}/api/v2/`
|
|
9
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { auth0_audience_ } from '../auth0_audience_/index.js'
|
|
2
|
-
/**
|
|
3
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
4
|
-
* @return {import('@ctx-core/auth0').post_auth0_oauth_token_body_I}
|
|
5
|
-
*/
|
|
6
|
-
export function auth0_management_client_credentials_body_(ctx) {
|
|
7
|
-
return {
|
|
8
|
-
grant_type: 'client_credentials',
|
|
9
|
-
client_id: process.env.AUTH0_MANAGEMENT_ID,
|
|
10
|
-
client_secret: process.env.AUTH0_MANAGEMENT_SECRET,
|
|
11
|
-
audience: auth0_audience_(ctx)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { post_auth0_oauth_token } from '@ctx-core/auth0'
|
|
2
|
-
import { auth0_management_client_credentials_body_ } from '../auth0_management_client_credentials_body_/index.js'
|
|
3
|
-
/**
|
|
4
|
-
* @param {import('@ctx-core/object').Ctx}ctx
|
|
5
|
-
* @return {Promise<import('@ctx-core/auth0').auth0_token_T>}
|
|
6
|
-
*/
|
|
7
|
-
export async function auth0_management_token_(ctx) {
|
|
8
|
-
const [token_response] = await post_auth0_oauth_token(
|
|
9
|
-
ctx, auth0_management_client_credentials_body_(ctx))
|
|
10
|
-
return token_response
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
import type { CreateClientGrant } from 'auth0'
|
|
4
|
-
export declare function get_auth0_v2_client_grants(
|
|
5
|
-
ctx:Ctx, params:get_auth0_v2_client_grants_params_T
|
|
6
|
-
):Promise<[CreateClientGrant, Response]>
|
|
7
|
-
export interface get_auth0_v2_client_grants_params_T {
|
|
8
|
-
query?:string
|
|
9
|
-
json?:any
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
import type { Auth0UserProfile } from 'auth0-js'
|
|
3
|
-
import type { Ctx } from '@ctx-core/object'
|
|
4
|
-
export declare function get_auth0_v2_users_by_email(
|
|
5
|
-
ctx:Ctx, params:get_auth0_v2_users_by_email_params_T
|
|
6
|
-
):Promise<[Auth0UserProfile[], Response]>
|
|
7
|
-
export declare type get_auth0_v2_users_by_email_params_T = {
|
|
8
|
-
email:string
|
|
9
|
-
AUTH0_DOMAIN?:string
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
import type { Ctx } from '@ctx-core/object'
|
|
3
|
-
import type { Client } from 'auth0'
|
|
4
|
-
export declare function patch_auth0_v2_client(
|
|
5
|
-
ctx:Ctx, params:patch_auth0_v2_client_params_T
|
|
6
|
-
):Promise<[Client, Response]>
|
|
7
|
-
export interface patch_auth0_v2_client_params_T {
|
|
8
|
-
client_id?:string
|
|
9
|
-
body?:string
|
|
10
|
-
json?:unknown
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
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 function patch_auth0_v2_user(
|
|
6
|
-
ctx:Ctx, user_id:string, data:patch_auth0_v2_user_data_T
|
|
7
|
-
):Promise<[UpdateUserData|Auth0Error, Response]>
|
|
8
|
-
export interface patch_auth0_v2_user_data_T extends Partial<UserData> {
|
|
9
|
-
password?:string
|
|
10
|
-
}
|