@ctx-core/auth0-management 9.2.184 → 9.3.0

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +40 -12
  2. package/bin/add-grant-password-auth0.mjs +2 -2
  3. package/bin/auth0.mjs +2 -2
  4. package/bin/getAll-client-grants-auth0.mjs +2 -2
  5. package/package.json +3 -2
  6. package/src/AUTH0_MANAGEMENT_ID__/index.d.ts +6 -5
  7. package/src/AUTH0_MANAGEMENT_ID__/index.js +6 -15
  8. package/src/AUTH0_MANAGEMENT_SECRET__/index.d.ts +6 -5
  9. package/src/AUTH0_MANAGEMENT_SECRET__/index.js +6 -15
  10. package/src/auth0__v2_client__GET__fetch/index.d.ts +23 -0
  11. package/src/auth0__v2_client__GET__fetch/index.js +41 -0
  12. package/src/auth0__v2_client_grants__GET__fetch/index.d.ts +22 -0
  13. package/src/auth0__v2_client_grants__GET__fetch/index.js +35 -0
  14. package/src/auth0__v2_user__GET__fetch/index.d.ts +23 -0
  15. package/src/auth0__v2_user__GET__fetch/index.js +35 -0
  16. package/src/auth0__v2_user__PATCH__fetch/index.d.ts +26 -0
  17. package/src/auth0__v2_user__PATCH__fetch/index.js +44 -0
  18. package/src/auth0__v2_users_by_email__GET__fetch/index.d.ts +22 -0
  19. package/src/auth0__v2_users_by_email__GET__fetch/index.js +37 -0
  20. package/src/{auth0_management__client_credentials__body_ → auth0_management__client_credentials__body__new}/index.d.ts +3 -2
  21. package/src/{auth0_management__client_credentials__body_ → auth0_management__client_credentials__body__new}/index.js +3 -2
  22. package/src/auth0_management__init/index.js +4 -2
  23. package/src/{auth0_management_ → auth0_management__new}/index.d.ts +4 -1
  24. package/src/{auth0_management_ → auth0_management__new}/index.js +13 -4
  25. package/src/auth0_management__token_/index.js +10 -4
  26. package/src/index.d.ts +7 -7
  27. package/src/index.js +7 -7
  28. package/src/auth0__v2_client__fetch_get/index.d.ts +0 -15
  29. package/src/auth0__v2_client__fetch_get/index.js +0 -36
  30. package/src/auth0__v2_client_grants__fetch_get/index.d.ts +0 -14
  31. package/src/auth0__v2_client_grants__fetch_get/index.js +0 -32
  32. package/src/auth0__v2_user__fetch_get/index.d.ts +0 -15
  33. package/src/auth0__v2_user__fetch_get/index.js +0 -33
  34. package/src/auth0__v2_user__fetch_patch/index.d.ts +0 -18
  35. package/src/auth0__v2_user__fetch_patch/index.js +0 -39
  36. package/src/auth0__v2_users_by_email__fetch_get/index.d.ts +0 -14
  37. package/src/auth0__v2_users_by_email__fetch_get/index.js +0 -32
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @ctx-core/auth0-management
2
2
 
3
+ ## 9.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - - auth0**v2_user**PATCH\_\_fetch
8
+ - - auth0**v2_user**GET\_\_fetch
9
+ - - auth0**v2_client**GET\_\_fetch
10
+ - - auth0**v2_user**PATCH**fetch2: aliased by auth0**v2_user\_\_fetch_patch
11
+ - - auth0*management\_\_new: aliased by auth0_management*
12
+ - - auth0**v2_users_by_email**GET\_\_fetch
13
+ - - auth0**v2_user**GET**fetch2: aliased by auth0**v2_user\_\_fetch_get
14
+ - - auth0**v2_client**GET**fetch2: aliased by auth0**v2_client\_\_fetch_get
15
+ - - auth0**v2_client_grants**GET\_\_fetch
16
+ - - auth0**v2_client_grants**GET**fetch2: aliased by auth0**v2_client_grants\_\_fetch_get
17
+ - - auth0*management**client_credentials**body**new: aliased by auth0_management**client_credentials\_\_body*
18
+ - - auth0**v2_users_by_email**GET**fetch2: aliased by auth0**v2_users_by_email\_\_fetch_get
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @ctx-core/auth0@38.2.9
24
+
25
+ ## 9.2.185
26
+
27
+ ### Patch Changes
28
+
29
+ - fix: load auth0-management using createRequire
30
+
3
31
  ## 9.2.184
4
32
 
5
33
  ### Patch Changes
@@ -1581,10 +1609,10 @@
1581
1609
 
1582
1610
  ### Minor Changes
1583
1611
 
1584
- - auth0**v2_user**fetch_patch: returns Promise<[UpdateUserData|auth0__error_T, Response]>
1585
- - - AUTH0*MANAGEMENT_ID\_\_,AUTH0_MANAGEMENT_ID*,AUTH0_MANAGEMENT_ID\_\_set
1586
- - - AUTH0*MANAGEMENT_SECRET\_\_,AUTH0_MANAGEMENT_SECRET*,AUTH0_MANAGEMENT_SECRET\_\_set
1587
- - - auth0**v2_user**fetch_get\_\_params_T: aliased by get_auth0_v2_user_params_T
1612
+ - auth0\_\_v2_user\_\_fetch_patch: returns Promise<[UpdateUserData|auth0__error_T, Response]>
1613
+ - - AUTH0_MANAGEMENT_ID\__,AUTH0_MANAGEMENT_ID_,AUTH0_MANAGEMENT_ID\_\_set
1614
+ - - AUTH0_MANAGEMENT_SECRET\__,AUTH0_MANAGEMENT_SECRET_,AUTH0_MANAGEMENT_SECRET\_\_set
1615
+ - - auth0\_\_v2_user\_\_fetch_get\_\_params_T: aliased by get_auth0_v2_user_params_T
1588
1616
 
1589
1617
  AUTH0_DOMAIN?:string
1590
1618
 
@@ -2382,7 +2410,7 @@
2382
2410
 
2383
2411
  ### Patch Changes
2384
2412
 
2385
- - fix: auth0**oauth_token**fetch_get=>auth0**oauth_token**fetch_post,auth0**passwordless_start**fetch_get=>auth0**passwordless_start**fetch_post
2413
+ - fix: auth0\_\_oauth_token\_\_fetch_get=>auth0\_\_oauth_token\_\_fetch_post,auth0\_\_passwordless_start\_\_fetch_get=>auth0\_\_passwordless_start\_\_fetch_post
2386
2414
 
2387
2415
  ## 9.1.3
2388
2416
 
@@ -3288,7 +3316,7 @@
3288
3316
 
3289
3317
  ### Patch Changes
3290
3318
 
3291
- - fix: @ctx-core/\* dependencies
3319
+ - fix: @ctx-core/\_ dependencies
3292
3320
  - Updated dependencies
3293
3321
  - @ctx-core/auth0@34.2.5
3294
3322
  - @ctx-core/fetch-undici@1.2.16
@@ -3827,7 +3855,7 @@
3827
3855
 
3828
3856
  ### Patch Changes
3829
3857
 
3830
- - fix: error TS6059: \* is not under 'rootDir': package.json: types: ./dist/index.d.ts
3858
+ - fix: error TS6059: \_ is not under 'rootDir': package.json: types: ./dist/index.d.ts
3831
3859
  - Updated dependencies
3832
3860
  - @ctx-core/auth0@27.0.9
3833
3861
  - @ctx-core/fetch@11.0.101
@@ -3871,7 +3899,7 @@
3871
3899
 
3872
3900
  ### Patch Changes
3873
3901
 
3874
- - \*.d.ts export
3902
+ - \_.d.ts export
3875
3903
  - Updated dependencies
3876
3904
  - @ctx-core/auth0@27.0.5
3877
3905
  - @ctx-core/fetch@11.0.97
@@ -3925,7 +3953,7 @@
3925
3953
 
3926
3954
  ### Major Changes
3927
3955
 
3928
- - \*\_b: ctx is a map: @ctx-core/object: 22.0.0
3956
+ - \_\_b: ctx is a map: @ctx-core/object: 22.0.0
3929
3957
 
3930
3958
  ### Patch Changes
3931
3959
 
@@ -4716,7 +4744,7 @@
4716
4744
 
4717
4745
  ### Patch Changes
4718
4746
 
4719
- - fix: \*\_ctx_I.generated
4747
+ - fix: \_\_ctx_I.generated
4720
4748
  - Updated dependencies [undefined]
4721
4749
  - @ctx-core/auth0@25.0.29
4722
4750
 
@@ -5280,7 +5308,7 @@
5280
5308
 
5281
5309
  ### Patch Changes
5282
5310
 
5283
- - fix: deploying \*.js files
5311
+ - fix: deploying \_.js files
5284
5312
  - Updated dependencies [undefined]
5285
5313
  - @ctx-core/auth0@24.0.15
5286
5314
  - @ctx-core/fetch@10.0.11
@@ -5698,7 +5726,7 @@
5698
5726
 
5699
5727
  ### Patch Changes
5700
5728
 
5701
- - .gitignore: - \*.js
5729
+ - .gitignore: - \_.js
5702
5730
  - Updated dependencies [undefined]
5703
5731
  - @ctx-core/auth0@22.3.1
5704
5732
  - @ctx-core/fetch@8.2.1
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { ctx_ } from '@ctx-core/object'
3
- import { auth0__v2_client__fetch_get } from '../src/index.js'
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 auth0__v2_client__fetch_get(ctx, {
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 { auth0_management_ } from '../src/index.js'
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 = auth0_management_()
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 { auth0__v2_client_grants__fetch_get, auth0__v2__url_ } from '../src/index.js'
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 auth0__v2_client_grants__fetch_get(ctx, {
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.184",
3
+ "version": "9.3.0",
4
4
  "description": "ctx-core auth0 management api",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -28,9 +28,10 @@
28
28
  "getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
29
29
  },
30
30
  "dependencies": {
31
- "@ctx-core/auth0": "^38.2.8",
31
+ "@ctx-core/auth0": "^38.2.9",
32
32
  "@ctx-core/env": "^17.2.89",
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
36
  "@ctx-core/nanostores": "3.4.2",
36
37
  "@ctx-core/object": "^27.4.25",
@@ -1,5 +1,6 @@
1
- import type { WritableAtom_ } from '@ctx-core/nanostores'
2
- import type { Be, Ctx } from '@ctx-core/object'
3
- export declare const AUTH0_MANAGEMENT_ID__:Be<WritableAtom_<string>>
4
- export declare function AUTH0_MANAGEMENT_ID_(ctx:Ctx):string
5
- export declare function AUTH0_MANAGEMENT_ID__set(ctx:Ctx, AUTH0_MANAGEMENT_ID:string):void
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
- import { be_ } from '@ctx-core/object'
4
- /** @typedef {import('@ctx-core/object').Ctx}Ctx */
5
- /** @type {typeof import('./index.d.ts').AUTH0_MANAGEMENT_ID__} */
6
- export const AUTH0_MANAGEMENT_ID__ = be_('AUTH0_MANAGEMENT_ID__', ()=>
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 { WritableAtom_ } from '@ctx-core/nanostores'
2
- import type { Be, Ctx } from '@ctx-core/object'
3
- export declare const AUTH0_MANAGEMENT_SECRET__:Be<WritableAtom_<string>>
4
- export declare function AUTH0_MANAGEMENT_SECRET_(ctx:Ctx):string
5
- export declare function AUTH0_MANAGEMENT_SECRET__set(ctx:Ctx, AUTH0_MANAGEMENT_SECRET:string):void
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
- import { be_ } from '@ctx-core/object'
4
- /** @typedef {import('@ctx-core/object').Ctx}Ctx */
5
- /** @type {typeof import('./index.d.ts').AUTH0_MANAGEMENT_SECRET__} */
6
- export const AUTH0_MANAGEMENT_SECRET__ = be_('AUTH0_MANAGEMENT_SECRET__', ()=>
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,23 @@
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__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__fetch__params_T {
19
+ client_id?:string
20
+ body?:string
21
+ json?:unknown
22
+ }
23
+ export declare type patch_auth0_v2_client_params_T = auth0__v2_client__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__fetch__params_T}auth0__v2_client__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__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,22 @@
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__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__fetch__params_T {
19
+ query?:string
20
+ json?:any
21
+ }
22
+ export declare type get_auth0_v2_client_grants_params_T = auth0__v2_client_grants__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__fetch__params_T}auth0__v2_client_grants__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__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,23 @@
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__fetch2__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__fetch2__params_T {
19
+ AUTH0_DOMAIN?:string
20
+ user_id:string
21
+ }
22
+ export declare type get_auth0_v2_user_params_T = auth0__v2_user__GET__fetch2__params_T
23
+
@@ -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__fetch2__params_T}auth0__v2_user__GET__fetch2__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__fetch2__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,26 @@
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__fetch2__data_T
13
+ ],
14
+ UpdateUserData|auth0__v2_user__PATCH__fetch2__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__fetch2__data_T extends Partial<UserData> {
21
+ password?:string
22
+ }
23
+ export declare type patch_auth0_v2_user_data_T = auth0__v2_user__PATCH__fetch2__data_T
24
+ export interface auth0__v2_user__PATCH__fetch2__error_T extends Auth0Error {
25
+ message:string
26
+ }
@@ -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__fetch2__data_T}auth0__v2_user__PATCH__fetch2__data_T */
7
+ /** @typedef {import('./index.d.ts').auth0__v2_user__PATCH__fetch2__error_T}auth0__v2_user__PATCH__fetch2__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__fetch2__data_T}data
16
+ * @return {Promise<[UpdateUserData|auth0__v2_user__PATCH__fetch2__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,22 @@
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__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__fetch__params_T = {
19
+ email:string
20
+ AUTH0_DOMAIN?:string
21
+ }
22
+ export declare type get_auth0_v2_users_by_email_params_T = auth0__v2_users_by_email__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__fetch__params_T}auth0__v2_users_by_email__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__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 auth0_management__client_credentials__body_(
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
- auth0_management__client_credentials__body_ as auth0_management_client_credentials_body_,
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 auth0_management__client_credentials__body_(ctx) {
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
- auth0_management__client_credentials__body_ as auth0_management_client_credentials_body_,
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 {import('@ctx-core/object').Ctx}ctx
6
- * @param {import('./index.d.ts').auth0_management__init__params_T}params
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 auth0_management_(
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
@@ -1,12 +1,18 @@
1
1
  import { AUTH0_DOMAIN_ } from '@ctx-core/auth0'
2
- import { ManagementClient } from 'auth0'
2
+ import { createRequire } from 'module'
3
3
  import { AUTH0_MANAGEMENT_ID_ } from '../AUTH0_MANAGEMENT_ID__/index.js'
4
4
  import { AUTH0_MANAGEMENT_SECRET_ } from '../AUTH0_MANAGEMENT_SECRET__/index.js'
5
+ const require = createRequire(import.meta.url)
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 */
5
10
  /**
6
- * @param {import('./auth0_management_.d.ts').auth0_management__params_T} params
7
- * @returns {import('auth0').ManagementClient}
11
+ * @param {Ctx}ctx
12
+ * @param {auth0_management__params_T}params
13
+ * @returns {ManagementClient}
8
14
  */
9
- export function auth0_management_(
15
+ export function auth0_management__new(
10
16
  ctx,
11
17
  params = {}
12
18
  ) {
@@ -30,3 +36,6 @@ export function auth0_management_(
30
36
  scope
31
37
  })
32
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 { auth0_management__client_credentials__body_ } from '../auth0_management__client_credentials__body_/index.js'
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 {import('@ctx-core/object').Ctx}ctx
10
+ * @param {Ctx}ctx
8
11
  * @return {Promise<auth0__token_T>}
9
12
  */
10
13
  export async function auth0_management__token_(ctx) {
11
- const [payload, response] =
14
+ const [
15
+ payload,
16
+ response
17
+ ] =
12
18
  await auth0__oauth_token__POST__fetch2(
13
- ctx, auth0_management__client_credentials__body_(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 './auth0_management_'
2
- export * from './auth0_management__client_credentials__body_'
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 './auth0__v2_client_grants__fetch_get'
6
- export * from './auth0__v2_user__fetch_get'
7
- export * from './auth0__v2_users_by_email__fetch_get'
8
- export * from './auth0__v2_client__fetch_get'
9
- export * from './auth0__v2_user__fetch_patch'
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 './auth0_management_/index.js'
2
- export * from './auth0_management__client_credentials__body_/index.js'
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 './auth0__v2_client_grants__fetch_get/index.js'
6
- export * from './auth0__v2_user__fetch_get/index.js'
7
- export * from './auth0__v2_users_by_email__fetch_get/index.js'
8
- export * from './auth0__v2_client__fetch_get/index.js'
9
- export * from './auth0__v2_user__fetch_patch/index.js'
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
- }