@ctx-core/auth0-management 7.0.20 → 7.1.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/bin/add-grant-password-auth0.mjs +4 -2
  3. package/bin/auth0.mjs +2 -2
  4. package/bin/getAll-client-grants-auth0.mjs +6 -10
  5. package/package.json +16 -18
  6. package/src/auth0_audience__b.d.ts +3 -0
  7. package/src/{auth0_audience__b.ts → auth0_audience__b.js} +4 -4
  8. package/src/auth0_management_.d.ts +9 -0
  9. package/src/{auth0_management_.ts → auth0_management_.js} +7 -7
  10. package/{lib → src}/auth0_management_client_credentials_body__b.d.ts +4 -4
  11. package/src/auth0_management_client_credentials_body__b.js +16 -0
  12. package/src/auth0_management_token__b.d.ts +4 -0
  13. package/src/{auth0_management_token__b.ts → auth0_management_token__b.js} +6 -6
  14. package/src/get_auth0_v2_client_grants_b.d.ts +7 -0
  15. package/src/get_auth0_v2_client_grants_b.js +25 -0
  16. package/src/get_auth0_v2_user_b.d.ts +7 -0
  17. package/src/get_auth0_v2_user_b.js +22 -0
  18. package/src/get_auth0_v2_users_by_email_b.d.ts +9 -0
  19. package/src/get_auth0_v2_users_by_email_b.js +24 -0
  20. package/src/index.d.ts +9 -0
  21. package/src/{index.ts → index.js} +0 -0
  22. package/src/patch_auth0_v2_client_b.d.ts +8 -0
  23. package/src/patch_auth0_v2_client_b.js +25 -0
  24. package/src/patch_auth0_v2_user_b.d.ts +7 -0
  25. package/src/{patch_auth0_v2_user_b.ts → patch_auth0_v2_user_b.js} +11 -18
  26. package/tsconfig.json +9 -28
  27. package/COMMIT_EDITMSG +0 -2
  28. package/lib/auth0_audience__b.d.ts +0 -3
  29. package/lib/auth0_audience__b.js +0 -12
  30. package/lib/auth0_audience__b.js.map +0 -1
  31. package/lib/auth0_management_.d.ts +0 -7
  32. package/lib/auth0_management_.js +0 -15
  33. package/lib/auth0_management_.js.map +0 -1
  34. package/lib/auth0_management_client_credentials_body__b.js +0 -17
  35. package/lib/auth0_management_client_credentials_body__b.js.map +0 -1
  36. package/lib/auth0_management_token__b.d.ts +0 -4
  37. package/lib/auth0_management_token__b.js +0 -16
  38. package/lib/auth0_management_token__b.js.map +0 -1
  39. package/lib/get_auth0_v2_client_grants_b.d.ts +0 -7
  40. package/lib/get_auth0_v2_client_grants_b.js +0 -26
  41. package/lib/get_auth0_v2_client_grants_b.js.map +0 -1
  42. package/lib/get_auth0_v2_user_b.d.ts +0 -7
  43. package/lib/get_auth0_v2_user_b.js +0 -23
  44. package/lib/get_auth0_v2_user_b.js.map +0 -1
  45. package/lib/get_auth0_v2_users_by_email_b.d.ts +0 -9
  46. package/lib/get_auth0_v2_users_by_email_b.js +0 -25
  47. package/lib/get_auth0_v2_users_by_email_b.js.map +0 -1
  48. package/lib/index.d.ts +0 -9
  49. package/lib/index.js +0 -11
  50. package/lib/index.js.map +0 -1
  51. package/lib/patch_auth0_v2_client_b.d.ts +0 -8
  52. package/lib/patch_auth0_v2_client_b.js +0 -26
  53. package/lib/patch_auth0_v2_client_b.js.map +0 -1
  54. package/lib/patch_auth0_v2_user_b.d.ts +0 -7
  55. package/lib/patch_auth0_v2_user_b.js +0 -31
  56. package/lib/patch_auth0_v2_user_b.js.map +0 -1
  57. package/src/auth0_management_client_credentials_body__b.ts +0 -17
  58. package/src/get_auth0_v2_client_grants_b.ts +0 -33
  59. package/src/get_auth0_v2_user_b.ts +0 -28
  60. package/src/get_auth0_v2_users_by_email_b.ts +0 -32
  61. package/src/patch_auth0_v2_client_b.ts +0 -36
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @ctx-core/auth0-management
2
2
 
3
+ ## 7.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - .js + .d.ts instead of .ts
8
+ - fix: add-grant-password-auth0,auth0,getAll-client-grants-auth0
9
+
10
+ ## 7.1.1
11
+
12
+ ### Patch Changes
13
+
14
+ - dom types: fetch,Request,Response
15
+ - Updated dependencies
16
+ - @ctx-core/fetch-undici@1.0.1
17
+
18
+ ## 7.1.0
19
+
20
+ ### Minor Changes
21
+
22
+ - @ctx-core/fetch-undici instead of @ctx-core/fetch
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+ - @ctx-core/auth0@28.1.0
28
+
29
+ ## 7.0.22
30
+
31
+ ### Patch Changes
32
+
33
+ - update dependencies
34
+ - Updated dependencies
35
+ - @ctx-core/fetch@11.0.113
36
+
37
+ ## 7.0.21
38
+
39
+ ### Patch Changes
40
+
41
+ - update dependencies
42
+ - Updated dependencies
43
+ - @ctx-core/auth0@28.0.21
44
+ - @ctx-core/fetch@11.0.112
45
+
3
46
  ## 7.0.20
4
47
 
5
48
  ### Patch Changes
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { patch_auth0_v2_client } from '../lib/index.js'
2
+ import { ctx_ } from '@ctx-core/object'
3
+ import { patch_auth0_v2_client_b } from '../src/index.js'
3
4
  await main()
4
5
  async function main() {
5
- const response = await patch_auth0_v2_client({
6
+ const ctx = ctx_()
7
+ const response = await patch_auth0_v2_client_b(ctx)({
6
8
  json: {
7
9
  grant_types: [
8
10
  'password',
package/bin/auth0.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { auth0_management_fn } from '../lib/index.js'
2
+ import { auth0_management_ } 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_fn()
8
+ const management_auth0 = auth0_management_()
9
9
  const manager = management_auth0[arg_manager]
10
10
  if (!manager) throw `Invalid manager ${arg_manager}`
11
11
  const cmd = manager[arg_cmd]
@@ -1,17 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { auth0_management_fn, get_auth0_v2_client_grants, _audience } from '../lib/index.js'
3
- //main()
4
- await main2()
2
+ import { ctx_ } from '@ctx-core/object'
3
+ import { get_auth0_v2_client_grants_b, auth0_audience__b } from '../src/index.js'
4
+ await main()
5
5
  async function main() {
6
- const management_auth0 = auth0_management_fn()
7
- const clientGrant_a = await management_auth0.clientGrants.getAll()
8
- console.info(JSON.stringify(clientGrant_a, null, 2))
9
- }
10
- async function main2() {
11
- const response = await get_auth0_v2_client_grants({
6
+ const ctx = ctx_()
7
+ const response = await get_auth0_v2_client_grants_b(ctx)({
12
8
  json: {
13
9
  client_id: process.env.AUTH0_CLIENT_ID,
14
- audience: _audience()
10
+ audience: auth0_audience__b(ctx)()
15
11
  }
16
12
  })
17
13
  const json = await response.json()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/auth0-management",
3
- "version": "7.0.20",
3
+ "version": "7.1.2",
4
4
  "description": "ctx-core auth0 management api",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -30,18 +30,17 @@
30
30
  "getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
31
31
  },
32
32
  "dependencies": {
33
- "@ctx-core/auth0": "^28.0.19",
34
- "@ctx-core/fetch": "^11.0.111",
35
- "@ctx-core/object": "^22.0.12",
36
- "auth0": "^2.37.0",
37
- "svelte": "^3.46.1"
33
+ "@ctx-core/auth0": "^28.1.0",
34
+ "@ctx-core/fetch-undici": "^1.0.1",
35
+ "@ctx-core/object": "^22.0.13",
36
+ "auth0": "^2.37.0"
38
37
  },
39
38
  "devDependencies": {
40
- "@ctx-core/uri": "^12.0.38",
41
- "@swc/cli": "^0.1.55",
42
- "@swc/core": "^1.2.128",
43
- "rimraf": "^3.0.2",
44
- "typescript": "next"
39
+ "c8": "^7.11.0",
40
+ "check-dts": "^0.6.6",
41
+ "tsm": "^2.2.1",
42
+ "typescript": "next",
43
+ "uvu": "^0.5.3"
45
44
  },
46
45
  "publishConfig": {
47
46
  "access": "public",
@@ -50,12 +49,11 @@
50
49
  "svelte": "./lib/index.js",
51
50
  "sideEffects": false,
52
51
  "scripts": {
53
- "build": "npm run compile",
54
- "clean": "rimraf lib && npm run clean:tsbuildinfo",
55
- "clean:tsbuildinfo": "rimraf tsconfig.tsbuildinfo && rimraf lib/**/*.d.ts",
56
- "compile": "npm run compile:source && npm run compile:declaration",
57
- "compile:source": "swc src --out-dir lib --copy-files --source-maps --config-file .swcrc",
58
- "compile:declaration": "npm run clean:tsbuildinfo && tsc --declaration --emitDeclarationOnly --declarationDir lib",
59
- "exec": "$@"
52
+ "build": ":",
53
+ "clean": ":",
54
+ "exec": "$@",
55
+ "test": "pnpm test-unit && check-dts",
56
+ "test-unit": "tsm node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
57
+ "test-unit-coverage": "c8 pnpm test-unit"
60
58
  }
61
59
  }
@@ -0,0 +1,3 @@
1
+ import { B } from '@ctx-core/object'
2
+ export declare const auth0_audience__b:B<auth0_audience__T>
3
+ export declare type auth0_audience__T = ()=>string;
@@ -1,11 +1,11 @@
1
1
  import { AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
- import { be_, B } from '@ctx-core/object'
2
+ import { be_ } from '@ctx-core/object'
3
3
  const key = 'auth0_audience_'
4
- export const auth0_audience__b:B<auth0_audience__T> = be_(key, ctx=>{
4
+ /** @type {import('./auth0_audience__b.d.ts').auth0_audience__b} */
5
+ export const auth0_audience__b = be_(key, ctx=>{
5
6
  const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
6
- return auth0_audience_fn as auth0_audience__T
7
+ return auth0_audience_fn
7
8
  function auth0_audience_fn() {
8
9
  return `https://${AUTH0_DOMAIN$.$}/api/v2/`
9
10
  }
10
11
  })
11
- export type auth0_audience__T = ()=>string
@@ -0,0 +1,9 @@
1
+ import { ManagementClient } from 'auth0'
2
+ export declare function auth0_management_(
3
+ params?:auth0_management_params_I
4
+ ):ManagementClient<import('auth0').AppMetadata, import('auth0').UserMetadata>;
5
+ export interface auth0_management_params_I {
6
+ domain?:string;
7
+ clientId?:string;
8
+ clientSecret?:string;
9
+ }
@@ -1,5 +1,10 @@
1
1
  import { ManagementClient } from 'auth0'
2
- export function auth0_management_(params:auth0_management_params_I = {}) {
2
+ /**
3
+ * @param {import('./auth0_management_.d.ts').auth0_management_params_I} params
4
+ * @returns {import('auth0').ManagementClient}
5
+ * @private
6
+ */
7
+ export function auth0_management_(params = {}) {
3
8
  const domain = params.domain || process.env.AUTH0_DOMAIN || ''
4
9
  const clientId = params.clientId || process.env.AUTH0_MANAGEMENT_ID || ''
5
10
  const clientSecret = params.clientSecret || process.env.AUTH0_MANAGEMENT_SECRET || ''
@@ -8,11 +13,6 @@ export function auth0_management_(params:auth0_management_params_I = {}) {
8
13
  domain,
9
14
  clientId,
10
15
  clientSecret,
11
- scope,
16
+ scope
12
17
  })
13
18
  }
14
- export interface auth0_management_params_I {
15
- domain?:string
16
- clientId?:string
17
- clientSecret?:string
18
- }
@@ -1,4 +1,4 @@
1
- import type { post_auth0_oauth_token_body_I } from '@ctx-core/auth0';
2
- import { B } from '@ctx-core/object';
3
- export declare const auth0_management_client_credentials_body__b: B<auth0_management_client_credentials_body__T>;
4
- export declare type auth0_management_client_credentials_body__T = () => post_auth0_oauth_token_body_I;
1
+ import type { post_auth0_oauth_token_body_I } from '@ctx-core/auth0'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const auth0_management_client_credentials_body__b:B<auth0_management_client_credentials_body__T>
4
+ export declare type auth0_management_client_credentials_body__T = ()=>post_auth0_oauth_token_body_I;
@@ -0,0 +1,16 @@
1
+ import { be_ } from '@ctx-core/object'
2
+ import { auth0_audience__b } from './auth0_audience__b.js'
3
+ const key = 'auth0_management_client_credentials_body_'
4
+ /** @type {import('./auth0_management_client_credentials_body__b.d.ts').auth0_management_client_credentials_body__b} */
5
+ export const auth0_management_client_credentials_body__b = be_(key, ctx=>{
6
+ const auth0_audience_ = auth0_audience__b(ctx)
7
+ return auth0_management_client_credentials_body_
8
+ function auth0_management_client_credentials_body_() {
9
+ return {
10
+ grant_type: 'client_credentials',
11
+ client_id: process.env.AUTH0_MANAGEMENT_ID,
12
+ client_secret: process.env.AUTH0_MANAGEMENT_SECRET,
13
+ audience: auth0_audience_()
14
+ }
15
+ }
16
+ })
@@ -0,0 +1,4 @@
1
+ import { auth0_token_T } from '@ctx-core/auth0'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const auth0_management_token__b:B<auth0_management_token__T>
4
+ export declare type auth0_management_token__T = ()=>Promise<auth0_token_T>;
@@ -1,15 +1,15 @@
1
- import { auth0_token_T, post_auth0_oauth_token_b } from '@ctx-core/auth0'
2
- import { be_, B } from '@ctx-core/object'
1
+ import { post_auth0_oauth_token_b } from '@ctx-core/auth0'
2
+ import { be_ } from '@ctx-core/object'
3
3
  import { auth0_management_client_credentials_body__b } from './auth0_management_client_credentials_body__b.js'
4
4
  const key = 'auth0_management_token_'
5
- export const auth0_management_token__b:B<auth0_management_token__T> = be_(key, ctx=>{
5
+ /** @type {import('./auth0_management_token__b.d.ts').auth0_management_token__b} */
6
+ export const auth0_management_token__b = be_(key, ctx=>{
6
7
  const post_auth0_oauth_token = post_auth0_oauth_token_b(ctx)
7
8
  const auth0_management_client_credentials_body_fn = auth0_management_client_credentials_body__b(ctx)
8
- return auth0_management_token_ as auth0_management_token__T
9
- async function auth0_management_token_():Promise<auth0_token_T> {
9
+ return auth0_management_token_
10
+ async function auth0_management_token_() {
10
11
  const management_client_credentials = auth0_management_client_credentials_body_fn()
11
12
  const response = await post_auth0_oauth_token(management_client_credentials)
12
13
  return response.json()
13
14
  }
14
15
  })
15
- export type auth0_management_token__T = ()=>Promise<auth0_token_T>
@@ -0,0 +1,7 @@
1
+ import { B } from '@ctx-core/object'
2
+ export declare const get_auth0_v2_client_grants_b:B<get_auth0_v2_client_grants_T>
3
+ export interface get_auth0_v2_client_grants_params_I {
4
+ query?:string;
5
+ json?:any;
6
+ }
7
+ export declare type get_auth0_v2_client_grants_T = (params:get_auth0_v2_client_grants_params_I)=>Promise<Response>;
@@ -0,0 +1,25 @@
1
+ import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
+ import { safe_fetch as fetch } from '@ctx-core/fetch-undici'
3
+ import { be_ } from '@ctx-core/object'
4
+ import { query_str_ } from '@ctx-core/uri'
5
+ import { auth0_management_token__b } from './auth0_management_token__b.js'
6
+ const key = 'get_auth0_v2_client_grants'
7
+ /** @type {import('./get_auth0_v2_client_grants_b.d.ts').get_auth0_v2_client_grants_b} */
8
+ export const get_auth0_v2_client_grants_b = be_(key, ctx=>{
9
+ const auth0_management_token_ = auth0_management_token__b(ctx)
10
+ const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
11
+ return get_auth0_v2_client_grants
12
+ async function get_auth0_v2_client_grants(params) {
13
+ const { query, json } = params
14
+ const auth0_token = await auth0_management_token_()
15
+ const authorization = verify_access_token_header_authorization_(auth0_token)
16
+ const url = `https://${AUTH0_DOMAIN$.$}/api/v2/client-grants?${query || query_str_(json)}`
17
+ return fetch(url, {
18
+ method: 'GET',
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ authorization
22
+ }
23
+ })
24
+ }
25
+ })
@@ -0,0 +1,7 @@
1
+ import { B } from '@ctx-core/object'
2
+ export declare const get_auth0_v2_user_b:B<get_auth0_v2_user_T>
3
+ export interface get_auth0_v2_user_params_T {
4
+ AUTH0_DOMAIN:string;
5
+ user_id:string;
6
+ }
7
+ export declare type get_auth0_v2_user_T = (params:get_auth0_v2_user_params_T)=>Promise<Response>;
@@ -0,0 +1,22 @@
1
+ import { verify_access_token_header_authorization_ } from '@ctx-core/auth0'
2
+ import { safe_fetch as fetch } from '@ctx-core/fetch-undici'
3
+ import { be_ } from '@ctx-core/object'
4
+ import { auth0_management_token__b } from './auth0_management_token__b.js'
5
+ const key = 'get_auth0_v2_user'
6
+ /** @type {import('./get_auth0_v2_user_b.d.ts').get_auth0_v2_user_b} */
7
+ export const get_auth0_v2_user_b = be_(key, ctx=>{
8
+ const auth0_management_token_ = auth0_management_token__b(ctx)
9
+ return get_auth0_v2_user
10
+ async function get_auth0_v2_user({ AUTH0_DOMAIN, user_id }) {
11
+ const auth0_token = await auth0_management_token_()
12
+ const authorization = verify_access_token_header_authorization_(auth0_token)
13
+ const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
14
+ return fetch(url, {
15
+ method: 'GET',
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ authorization
19
+ }
20
+ })
21
+ }
22
+ })
@@ -0,0 +1,9 @@
1
+ import type { Auth0UserProfile } from 'auth0-js'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const get_auth0_v2_users_by_email_b:B<get_auth0_v2_users_by_email_T>
4
+ export declare type get_auth0_v2_users_by_email_params_I = {
5
+ email:string;
6
+ AUTH0_DOMAIN?:string;
7
+ };
8
+ export declare type get_auth0_v2_users_by_email_T = (params:get_auth0_v2_users_by_email_params_I)=>Promise<Response>;
9
+ export declare type get_auth0_v2_users_by_email_response_T = Auth0UserProfile[];
@@ -0,0 +1,24 @@
1
+ import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
+ import { safe_fetch as fetch } from '@ctx-core/fetch-undici'
3
+ import { be_ } from '@ctx-core/object'
4
+ import { auth0_management_token__b } from './auth0_management_token__b.js'
5
+ const key = 'get_auth0_v2_users_by_email'
6
+ /** @type {import('./get_auth0_v2_users_by_email_b.d.ts').get_auth0_v2_users_by_email_b} */
7
+ export const get_auth0_v2_users_by_email_b = be_(key, ctx=>{
8
+ const auth0_management_token_ = auth0_management_token__b(ctx)
9
+ return get_auth0_v2_users_by_email
10
+ async function get_auth0_v2_users_by_email(params) {
11
+ const { email } = params
12
+ const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN$_b(ctx).$
13
+ const auth0_token = await auth0_management_token_()
14
+ const authorization = verify_access_token_header_authorization_(auth0_token)
15
+ const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`
16
+ return await fetch(url, {
17
+ method: 'GET',
18
+ headers: {
19
+ 'Content-Type': 'application/json',
20
+ authorization
21
+ }
22
+ })
23
+ }
24
+ })
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from './auth0_audience__b'
2
+ export * from './auth0_management_'
3
+ export * from './auth0_management_client_credentials_body__b'
4
+ export * from './auth0_management_token__b'
5
+ export * from './get_auth0_v2_client_grants_b'
6
+ export * from './get_auth0_v2_user_b'
7
+ export * from './get_auth0_v2_users_by_email_b'
8
+ export * from './patch_auth0_v2_client_b'
9
+ export * from './patch_auth0_v2_user_b'
File without changes
@@ -0,0 +1,8 @@
1
+ import { B } from '@ctx-core/object'
2
+ export declare const patch_auth0_v2_client_b:B<patch_auth0_v2_client_T>
3
+ export interface patch_auth0_v2_client_params_T {
4
+ client_id?:string;
5
+ body?:string;
6
+ json?:unknown;
7
+ }
8
+ export declare type patch_auth0_v2_client_T = (params:patch_auth0_v2_client_params_T)=>Promise<Response>;
@@ -0,0 +1,25 @@
1
+ import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
+ import { safe_fetch as fetch } from '@ctx-core/fetch-undici'
3
+ import { be_ } from '@ctx-core/object'
4
+ import { auth0_management_token__b } from './auth0_management_token__b.js'
5
+ const key = 'patch_auth0_v2_client'
6
+ /** @type {import('./patch_auth0_v2_client_b.d.ts').patch_auth0_v2_client_b} */
7
+ export const patch_auth0_v2_client_b = be_(key, ctx=>{
8
+ const auth0_management_token_ = auth0_management_token__b(ctx)
9
+ const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
10
+ return patch_auth0_v2_client
11
+ async function patch_auth0_v2_client(params) {
12
+ const { client_id = process.env.AUTH0_CLIENT_ID, body, json, } = params
13
+ const auth0_token = await auth0_management_token_()
14
+ const authorization = verify_access_token_header_authorization_(auth0_token)
15
+ const url = `https://${AUTH0_DOMAIN$.$}/api/v2/clients/${client_id}`
16
+ return fetch(url, {
17
+ method: 'PATCH',
18
+ headers: {
19
+ 'Content-Type': 'application/json',
20
+ authorization
21
+ },
22
+ body: body || JSON.stringify(json)
23
+ })
24
+ }
25
+ })
@@ -0,0 +1,7 @@
1
+ import type { Auth0UserProfile } from 'auth0-js'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const patch_auth0_v2_user_b:B<patch_auth0_v2_user_T>
4
+ export interface patch_auth0_v2_user_data_I extends Partial<Auth0UserProfile> {
5
+ password?:string;
6
+ }
7
+ export declare type patch_auth0_v2_user_T = (user_id:string, data:patch_auth0_v2_user_data_I)=>Promise<Response>;
@@ -1,37 +1,30 @@
1
- import type { Auth0UserProfile } from 'auth0-js'
2
1
  import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
3
- import { fetch } from '@ctx-core/fetch'
4
- import { be_, B } from '@ctx-core/object'
2
+ import { safe_fetch as fetch } from '@ctx-core/fetch-undici'
3
+ import { be_ } from '@ctx-core/object'
5
4
  import { auth0_management_token__b } from './auth0_management_token__b.js'
6
5
  const key = 'patch_auth0_v2_user'
7
- export const patch_auth0_v2_user_b:B<patch_auth0_v2_user_T> = be_(key, ctx=>{
6
+ /** @type {import('./patch_auth0_v2_user_b.d.ts').patch_auth0_v2_user_b} */
7
+ export const patch_auth0_v2_user_b = be_(key, ctx=>{
8
8
  const auth0_management_token_ = auth0_management_token__b(ctx)
9
9
  const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
10
- return patch_auth0_v2_user as patch_auth0_v2_user_T
10
+ return patch_auth0_v2_user
11
11
  /**
12
12
  * @see {@link https://auth0.com/docs/api-auth/tutorials/client-credentials}
13
13
  * @see {@link https://auth0.com/docs/api-auth/which-oauth-flow-to-use}
14
14
  * @see {@link https://auth0.com/docs/clients/client-grant-types}
15
15
  * @see {@link https://auth0.com/docs/api-auth/grant/authorization-code}
16
16
  * @see {@link https://auth0.com/docs/protocols/oauth2}
17
- */
18
- async function patch_auth0_v2_user(user_id:string, data:patch_auth0_v2_user_data_I) {
17
+ */ async function patch_auth0_v2_user(user_id, data) {
19
18
  const auth0_management_token = await auth0_management_token_()
20
19
  const authorization = verify_access_token_header_authorization_(auth0_management_token)
21
20
  const url = `https://${AUTH0_DOMAIN$.$}/api/v2/users/${user_id}`
22
21
  return fetch(url, {
23
22
  method: 'PATCH',
24
- headers:
25
- {
26
- 'Content-Type': 'application/json',
27
- authorization,
28
- },
29
- body: JSON.stringify(data),
23
+ headers: {
24
+ 'Content-Type': 'application/json',
25
+ authorization
26
+ },
27
+ body: JSON.stringify(data)
30
28
  })
31
29
  }
32
30
  })
33
- export interface patch_auth0_v2_user_data_I extends Partial<Auth0UserProfile> {
34
- password?:string
35
- }
36
- export type patch_auth0_v2_user_T =
37
- (user_id:string, data:patch_auth0_v2_user_data_I)=>Promise<Response>
package/tsconfig.json CHANGED
@@ -1,36 +1,17 @@
1
1
  {
2
2
  "compileOnSave": true,
3
3
  "compilerOptions": {
4
- "target": "ES2021",
5
- "composite": true,
6
- "declaration": true,
7
- "sourceMap": true,
8
- "noEmitOnError": true,
9
- "noErrorTruncation": true,
10
- "module": "ESNext",
4
+ "jsxImportSource": "solid-js",
5
+ "jsx": "preserve",
6
+ "allowJs": true,
7
+ "lib": ["ESNext"],
8
+ "module": "esnext",
11
9
  "moduleResolution": "node",
12
- "esModuleInterop": true,
13
- "noImplicitAny": true,
14
10
  "resolveJsonModule": true,
15
- "allowSyntheticDefaultImports": true,
16
- "noImplicitThis": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
- "typeRoots": [
20
- "../../../node_modules/@types",
21
- "../../node_modules/@types",
22
- "node_modules/@types"
23
- ],
24
11
  "rootDir": "src",
25
- "outDir": "lib",
26
- "declarationDir": "lib",
27
- "lib": ["dom", "ESNext"],
28
- "importsNotUsedAsValues": "error",
29
- "strict": true
12
+ "declaration": true,
13
+ "declarationDir": "src"
30
14
  },
31
- "exclude": [
32
- "node_modules",
33
- "lib"
34
- ],
35
- "references": []
15
+ "include": ["src"],
16
+ "exclude": []
36
17
  }
package/COMMIT_EDITMSG DELETED
@@ -1,2 +0,0 @@
1
-
2
-
@@ -1,3 +0,0 @@
1
- import { B } from '@ctx-core/object';
2
- export declare const auth0_audience__b: B<auth0_audience__T>;
3
- export declare type auth0_audience__T = () => string;
@@ -1,12 +0,0 @@
1
- import { AUTH0_DOMAIN$_b } from '@ctx-core/auth0';
2
- import { be_ } from '@ctx-core/object';
3
- const key = 'auth0_audience_';
4
- export const auth0_audience__b = be_(key, (ctx)=>{
5
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx);
6
- return auth0_audience_fn;
7
- function auth0_audience_fn() {
8
- return `https://${AUTH0_DOMAIN$.$}/api/v2/`;
9
- }
10
- });
11
-
12
- //# sourceMappingURL=auth0_audience__b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auth0_audience__b.ts"],"sourcesContent":["import { AUTH0_DOMAIN$_b } from '@ctx-core/auth0'\nimport { be_, B } from '@ctx-core/object'\nconst key = 'auth0_audience_'\nexport const auth0_audience__b:B<auth0_audience__T> = be_(key, ctx=>{\n\tconst AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)\n\treturn auth0_audience_fn as auth0_audience__T\n\tfunction auth0_audience_fn() {\n\t\treturn `https://${AUTH0_DOMAIN$.$}/api/v2/`\n\t}\n})\nexport type auth0_audience__T = ()=>string\n"],"names":["AUTH0_DOMAIN$_b","be_","key","auth0_audience__b","ctx","AUTH0_DOMAIN$","auth0_audience_fn","$"],"mappings":"AAAA,MAAM,GAAGA,eAAe,QAAQ,CAAiB;AACjD,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,KAAK,CAACC,GAAG,GAAG,CAAiB;AAC7B,MAAM,CAAC,KAAK,CAACC,iBAAiB,GAAwBF,GAAG,CAACC,GAAG,GAAEE,GAAG,GAAE,CAAC;IACpE,KAAK,CAACC,aAAa,GAAGL,eAAe,CAACI,GAAG;IACzC,MAAM,CAACE,iBAAiB;aACfA,iBAAiB,GAAG,CAAC;QAC7B,MAAM,EAAE,QAAQ,EAAED,aAAa,CAACE,CAAC,CAAC,QAAQ;IAC3C,CAAC;AACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { ManagementClient } from 'auth0';
2
- export declare function auth0_management_(params?: auth0_management_params_I): ManagementClient<import("auth0").AppMetadata, import("auth0").UserMetadata>;
3
- export interface auth0_management_params_I {
4
- domain?: string;
5
- clientId?: string;
6
- clientSecret?: string;
7
- }
@@ -1,15 +0,0 @@
1
- import { ManagementClient } from 'auth0';
2
- export function auth0_management_(params = {}) {
3
- const domain = params.domain || process.env.AUTH0_DOMAIN || '';
4
- const clientId = params.clientId || process.env.AUTH0_MANAGEMENT_ID || '';
5
- const clientSecret = params.clientSecret || process.env.AUTH0_MANAGEMENT_SECRET || '';
6
- const scope = '';
7
- return new ManagementClient({
8
- domain,
9
- clientId,
10
- clientSecret,
11
- scope
12
- });
13
- }
14
-
15
- //# sourceMappingURL=auth0_management_.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auth0_management_.ts"],"sourcesContent":["import { ManagementClient } from 'auth0'\nexport function auth0_management_(params:auth0_management_params_I = {}) {\n\tconst domain = params.domain || process.env.AUTH0_DOMAIN || ''\n\tconst clientId = params.clientId || process.env.AUTH0_MANAGEMENT_ID || ''\n\tconst clientSecret = params.clientSecret || process.env.AUTH0_MANAGEMENT_SECRET || ''\n\tconst scope = ''\n\treturn new ManagementClient({\n\t\tdomain,\n\t\tclientId,\n\t\tclientSecret,\n\t\tscope,\n\t})\n}\nexport interface auth0_management_params_I {\n\tdomain?:string\n\tclientId?:string\n\tclientSecret?:string\n}\n"],"names":["ManagementClient","auth0_management_","params","domain","process","env","AUTH0_DOMAIN","clientId","AUTH0_MANAGEMENT_ID","clientSecret","AUTH0_MANAGEMENT_SECRET","scope"],"mappings":"AAAA,MAAM,GAAGA,gBAAgB,QAAQ,CAAO;AACxC,MAAM,UAAUC,iBAAiB,CAACC,MAAgC,GAAG,CAAC,CAAC,EAAE,CAAC;IACzE,KAAK,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM,IAAIC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,CAAE;IAC9D,KAAK,CAACC,QAAQ,GAAGL,MAAM,CAACK,QAAQ,IAAIH,OAAO,CAACC,GAAG,CAACG,mBAAmB,IAAI,CAAE;IACzE,KAAK,CAACC,YAAY,GAAGP,MAAM,CAACO,YAAY,IAAIL,OAAO,CAACC,GAAG,CAACK,uBAAuB,IAAI,CAAE;IACrF,KAAK,CAACC,KAAK,GAAG,CAAE;IAChB,MAAM,CAAC,GAAG,CAACX,gBAAgB,CAAC,CAAC;QAC5BG,MAAM;QACNI,QAAQ;QACRE,YAAY;QACZE,KAAK;IACN,CAAC;AACF,CAAC"}
@@ -1,17 +0,0 @@
1
- import { be_ } from '@ctx-core/object';
2
- import { auth0_audience__b } from './auth0_audience__b.js';
3
- const key = 'auth0_management_client_credentials_body_';
4
- export const auth0_management_client_credentials_body__b = be_(key, (ctx)=>{
5
- const auth0_audience_ = auth0_audience__b(ctx);
6
- return auth0_management_client_credentials_body_;
7
- function auth0_management_client_credentials_body_() {
8
- return {
9
- grant_type: 'client_credentials',
10
- client_id: process.env.AUTH0_MANAGEMENT_ID,
11
- client_secret: process.env.AUTH0_MANAGEMENT_SECRET,
12
- audience: auth0_audience_()
13
- };
14
- }
15
- });
16
-
17
- //# sourceMappingURL=auth0_management_client_credentials_body__b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auth0_management_client_credentials_body__b.ts"],"sourcesContent":["import type { post_auth0_oauth_token_body_I } from '@ctx-core/auth0'\nimport { be_, B } from '@ctx-core/object'\nimport { auth0_audience__b } from './auth0_audience__b.js'\nconst key = 'auth0_management_client_credentials_body_'\nexport const auth0_management_client_credentials_body__b:B<auth0_management_client_credentials_body__T> = be_(key, ctx=>{\n\tconst auth0_audience_ = auth0_audience__b(ctx)\n\treturn auth0_management_client_credentials_body_ as auth0_management_client_credentials_body__T\n\tfunction auth0_management_client_credentials_body_():post_auth0_oauth_token_body_I {\n\t\treturn {\n\t\t\tgrant_type: 'client_credentials',\n\t\t\tclient_id: process.env.AUTH0_MANAGEMENT_ID!,\n\t\t\tclient_secret: process.env.AUTH0_MANAGEMENT_SECRET!,\n\t\t\taudience: auth0_audience_(),\n\t\t}\n\t}\n})\nexport type auth0_management_client_credentials_body__T = ()=>post_auth0_oauth_token_body_I\n"],"names":["be_","auth0_audience__b","key","auth0_management_client_credentials_body__b","ctx","auth0_audience_","auth0_management_client_credentials_body_","grant_type","client_id","process","env","AUTH0_MANAGEMENT_ID","client_secret","AUTH0_MANAGEMENT_SECRET","audience"],"mappings":"AACA,MAAM,GAAGA,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,iBAAiB,QAAQ,CAAwB;AAC1D,KAAK,CAACC,GAAG,GAAG,CAA2C;AACvD,MAAM,CAAC,KAAK,CAACC,2CAA2C,GAAkDH,GAAG,CAACE,GAAG,GAAEE,GAAG,GAAE,CAAC;IACxH,KAAK,CAACC,eAAe,GAAGJ,iBAAiB,CAACG,GAAG;IAC7C,MAAM,CAACE,yCAAyC;aACvCA,yCAAyC,GAAiC,CAAC;QACnF,MAAM,CAAC,CAAC;YACPC,UAAU,EAAE,CAAoB;YAChCC,SAAS,EAAEC,OAAO,CAACC,GAAG,CAACC,mBAAmB;YAC1CC,aAAa,EAAEH,OAAO,CAACC,GAAG,CAACG,uBAAuB;YAClDC,QAAQ,EAAET,eAAe;QAC1B,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { auth0_token_T } from '@ctx-core/auth0';
2
- import { B } from '@ctx-core/object';
3
- export declare const auth0_management_token__b: B<auth0_management_token__T>;
4
- export declare type auth0_management_token__T = () => Promise<auth0_token_T>;
@@ -1,16 +0,0 @@
1
- import { post_auth0_oauth_token_b } from '@ctx-core/auth0';
2
- import { be_ } from '@ctx-core/object';
3
- import { auth0_management_client_credentials_body__b } from './auth0_management_client_credentials_body__b.js';
4
- const key = 'auth0_management_token_';
5
- export const auth0_management_token__b = be_(key, (ctx)=>{
6
- const post_auth0_oauth_token = post_auth0_oauth_token_b(ctx);
7
- const auth0_management_client_credentials_body_fn = auth0_management_client_credentials_body__b(ctx);
8
- return auth0_management_token_;
9
- async function auth0_management_token_() {
10
- const management_client_credentials = auth0_management_client_credentials_body_fn();
11
- const response = await post_auth0_oauth_token(management_client_credentials);
12
- return response.json();
13
- }
14
- });
15
-
16
- //# sourceMappingURL=auth0_management_token__b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auth0_management_token__b.ts"],"sourcesContent":["import { auth0_token_T, post_auth0_oauth_token_b } from '@ctx-core/auth0'\nimport { be_, B } from '@ctx-core/object'\nimport { auth0_management_client_credentials_body__b } from './auth0_management_client_credentials_body__b.js'\nconst key = 'auth0_management_token_'\nexport const auth0_management_token__b:B<auth0_management_token__T> = be_(key, ctx=>{\n\tconst post_auth0_oauth_token = post_auth0_oauth_token_b(ctx)\n\tconst auth0_management_client_credentials_body_fn = auth0_management_client_credentials_body__b(ctx)\n\treturn auth0_management_token_ as auth0_management_token__T\n\tasync function auth0_management_token_():Promise<auth0_token_T> {\n\t\tconst management_client_credentials = auth0_management_client_credentials_body_fn()\n\t\tconst response = await post_auth0_oauth_token(management_client_credentials)\n\t\treturn response.json()\n\t}\n})\nexport type auth0_management_token__T = ()=>Promise<auth0_token_T>\n"],"names":["post_auth0_oauth_token_b","be_","auth0_management_client_credentials_body__b","key","auth0_management_token__b","ctx","post_auth0_oauth_token","auth0_management_client_credentials_body_fn","auth0_management_token_","management_client_credentials","response","json"],"mappings":"AAAA,MAAM,GAAkBA,wBAAwB,QAAQ,CAAiB;AACzE,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,2CAA2C,QAAQ,CAAkD;AAC9G,KAAK,CAACC,GAAG,GAAG,CAAyB;AACrC,MAAM,CAAC,KAAK,CAACC,yBAAyB,GAAgCH,GAAG,CAACE,GAAG,GAAEE,GAAG,GAAE,CAAC;IACpF,KAAK,CAACC,sBAAsB,GAAGN,wBAAwB,CAACK,GAAG;IAC3D,KAAK,CAACE,2CAA2C,GAAGL,2CAA2C,CAACG,GAAG;IACnG,MAAM,CAACG,uBAAuB;mBACfA,uBAAuB,GAA0B,CAAC;QAChE,KAAK,CAACC,6BAA6B,GAAGF,2CAA2C;QACjF,KAAK,CAACG,QAAQ,GAAG,KAAK,CAACJ,sBAAsB,CAACG,6BAA6B;QAC3E,MAAM,CAACC,QAAQ,CAACC,IAAI;IACrB,CAAC;AACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { B } from '@ctx-core/object';
2
- export declare const get_auth0_v2_client_grants_b: B<get_auth0_v2_client_grants_T>;
3
- export interface get_auth0_v2_client_grants_params_I {
4
- query?: string;
5
- json?: any;
6
- }
7
- export declare type get_auth0_v2_client_grants_T = (params: get_auth0_v2_client_grants_params_I) => Promise<Response>;
@@ -1,26 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0';
2
- import { fetch } from '@ctx-core/fetch';
3
- import { be_ } from '@ctx-core/object';
4
- import { query_str_ } from '@ctx-core/uri';
5
- import { auth0_management_token__b } from './auth0_management_token__b.js';
6
- const key = 'get_auth0_v2_client_grants';
7
- export const get_auth0_v2_client_grants_b = be_(key, (ctx)=>{
8
- const auth0_management_token_ = auth0_management_token__b(ctx);
9
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx);
10
- return get_auth0_v2_client_grants;
11
- async function get_auth0_v2_client_grants(params) {
12
- const { query , json } = params;
13
- const auth0_token = await auth0_management_token_();
14
- const authorization = verify_access_token_header_authorization_(auth0_token);
15
- const url = `https://${AUTH0_DOMAIN$.$}/api/v2/client-grants?${query || query_str_(json)}`;
16
- return fetch(url, {
17
- method: 'GET',
18
- headers: {
19
- 'Content-Type': 'application/json',
20
- authorization
21
- }
22
- });
23
- }
24
- });
25
-
26
- //# sourceMappingURL=get_auth0_v2_client_grants_b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/get_auth0_v2_client_grants_b.ts"],"sourcesContent":["import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'\nimport { fetch } from '@ctx-core/fetch'\nimport { be_, B } from '@ctx-core/object'\nimport { query_str_ } from '@ctx-core/uri'\nimport { auth0_management_token__b} from './auth0_management_token__b.js'\nconst key = 'get_auth0_v2_client_grants'\nexport const get_auth0_v2_client_grants_b:B<get_auth0_v2_client_grants_T> = be_(key, ctx=>{\n\tconst auth0_management_token_ = auth0_management_token__b(ctx)\n\tconst AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)\n\treturn get_auth0_v2_client_grants as get_auth0_v2_client_grants_T\n\tasync function get_auth0_v2_client_grants(\n\t\tparams:get_auth0_v2_client_grants_params_I\n\t) {\n\t\tconst { query, json } = params\n\t\tconst auth0_token = await auth0_management_token_()\n\t\tconst authorization = verify_access_token_header_authorization_(auth0_token)\n\t\tconst url = `https://${AUTH0_DOMAIN$.$}/api/v2/client-grants?${query || query_str_(json)}`\n\t\treturn fetch(url, {\n\t\t\tmethod: 'GET',\n\t\t\theaders:\n\t\t\t\t{\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\tauthorization,\n\t\t\t\t},\n\t\t})\n\t}\n})\nexport interface get_auth0_v2_client_grants_params_I {\n\tquery?:string\n\tjson?:any\n}\nexport type get_auth0_v2_client_grants_T =\n\t(params:get_auth0_v2_client_grants_params_I)=>Promise<Response>\n"],"names":["verify_access_token_header_authorization_","AUTH0_DOMAIN$_b","fetch","be_","query_str_","auth0_management_token__b","key","get_auth0_v2_client_grants_b","ctx","auth0_management_token_","AUTH0_DOMAIN$","get_auth0_v2_client_grants","params","query","json","auth0_token","authorization","url","$","method","headers"],"mappings":"AAAA,MAAM,GAAGA,yCAAyC,EAAEC,eAAe,QAAQ,CAAiB;AAC5F,MAAM,GAAGC,KAAK,QAAQ,CAAiB;AACvC,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,UAAU,QAAQ,CAAe;AAC1C,MAAM,GAAGC,yBAAyB,QAAO,CAAgC;AACzE,KAAK,CAACC,GAAG,GAAG,CAA4B;AACxC,MAAM,CAAC,KAAK,CAACC,4BAA4B,GAAmCJ,GAAG,CAACG,GAAG,GAAEE,GAAG,GAAE,CAAC;IAC1F,KAAK,CAACC,uBAAuB,GAAGJ,yBAAyB,CAACG,GAAG;IAC7D,KAAK,CAACE,aAAa,GAAGT,eAAe,CAACO,GAAG;IACzC,MAAM,CAACG,0BAA0B;mBAClBA,0BAA0B,CACxCC,MAA0C,EACzC,CAAC;QACF,KAAK,CAAC,CAAC,CAACC,KAAK,GAAEC,IAAI,EAAC,CAAC,GAAGF,MAAM;QAC9B,KAAK,CAACG,WAAW,GAAG,KAAK,CAACN,uBAAuB;QACjD,KAAK,CAACO,aAAa,GAAGhB,yCAAyC,CAACe,WAAW;QAC3E,KAAK,CAACE,GAAG,IAAI,QAAQ,EAAEP,aAAa,CAACQ,CAAC,CAAC,sBAAsB,EAAEL,KAAK,IAAIT,UAAU,CAACU,IAAI;QACvF,MAAM,CAACZ,KAAK,CAACe,GAAG,EAAE,CAAC;YAClBE,MAAM,EAAE,CAAK;YACbC,OAAO,EACN,CAAC;gBACA,CAAc,eAAE,CAAkB;gBAClCJ,aAAa;YACd,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { B } from '@ctx-core/object';
2
- export declare const get_auth0_v2_user_b: B<get_auth0_v2_user_T>;
3
- export interface get_auth0_v2_user_params_T {
4
- AUTH0_DOMAIN: string;
5
- user_id: string;
6
- }
7
- export declare type get_auth0_v2_user_T = (params: get_auth0_v2_user_params_T) => Promise<Response>;
@@ -1,23 +0,0 @@
1
- import { verify_access_token_header_authorization_ } from '@ctx-core/auth0';
2
- import { fetch } from '@ctx-core/fetch';
3
- import { be_ } from '@ctx-core/object';
4
- import { auth0_management_token__b } from './auth0_management_token__b.js';
5
- const key = 'get_auth0_v2_user';
6
- export const get_auth0_v2_user_b = be_(key, (ctx)=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx);
8
- return get_auth0_v2_user;
9
- async function get_auth0_v2_user({ AUTH0_DOMAIN , user_id }) {
10
- const auth0_token = await auth0_management_token_();
11
- const authorization = verify_access_token_header_authorization_(auth0_token);
12
- const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`;
13
- return fetch(url, {
14
- method: 'GET',
15
- headers: {
16
- 'Content-Type': 'application/json',
17
- authorization
18
- }
19
- });
20
- }
21
- });
22
-
23
- //# sourceMappingURL=get_auth0_v2_user_b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/get_auth0_v2_user_b.ts"],"sourcesContent":["import { verify_access_token_header_authorization_ } from '@ctx-core/auth0'\nimport { fetch } from '@ctx-core/fetch'\nimport { be_, B } from '@ctx-core/object'\nimport { auth0_management_token__b } from './auth0_management_token__b.js'\nconst key = 'get_auth0_v2_user'\nexport const get_auth0_v2_user_b:B<get_auth0_v2_user_T> = be_(key, ctx=>{\n\tconst auth0_management_token_ = auth0_management_token__b(ctx)\n\treturn get_auth0_v2_user as get_auth0_v2_user_T\n\tasync function get_auth0_v2_user({ AUTH0_DOMAIN, user_id }:get_auth0_v2_user_params_T):Promise<Response> {\n\t\tconst auth0_token = await auth0_management_token_()\n\t\tconst authorization = verify_access_token_header_authorization_(auth0_token)\n\t\tconst url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`\n\t\treturn fetch(url, {\n\t\t\tmethod: 'GET',\n\t\t\theaders:\n\t\t\t\t{\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\tauthorization,\n\t\t\t\t},\n\t\t})\n\t}\n})\nexport interface get_auth0_v2_user_params_T {\n\tAUTH0_DOMAIN:string\n\tuser_id:string\n}\nexport type get_auth0_v2_user_T =\n\t(params:get_auth0_v2_user_params_T)=>Promise<Response>\n"],"names":["verify_access_token_header_authorization_","fetch","be_","auth0_management_token__b","key","get_auth0_v2_user_b","ctx","auth0_management_token_","get_auth0_v2_user","AUTH0_DOMAIN","user_id","auth0_token","authorization","url","method","headers"],"mappings":"AAAA,MAAM,GAAGA,yCAAyC,QAAQ,CAAiB;AAC3E,MAAM,GAAGC,KAAK,QAAQ,CAAiB;AACvC,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,yBAAyB,QAAQ,CAAgC;AAC1E,KAAK,CAACC,GAAG,GAAG,CAAmB;AAC/B,MAAM,CAAC,KAAK,CAACC,mBAAmB,GAA0BH,GAAG,CAACE,GAAG,GAAEE,GAAG,GAAE,CAAC;IACxE,KAAK,CAACC,uBAAuB,GAAGJ,yBAAyB,CAACG,GAAG;IAC7D,MAAM,CAACE,iBAAiB;mBACTA,iBAAiB,CAAC,CAAC,CAACC,YAAY,GAAEC,OAAO,EAA4B,CAAC,EAAoB,CAAC;QACzG,KAAK,CAACC,WAAW,GAAG,KAAK,CAACJ,uBAAuB;QACjD,KAAK,CAACK,aAAa,GAAGZ,yCAAyC,CAACW,WAAW;QAC3E,KAAK,CAACE,GAAG,IAAI,QAAQ,EAAEJ,YAAY,CAAC,cAAc,EAAEC,OAAO;QAC3D,MAAM,CAACT,KAAK,CAACY,GAAG,EAAE,CAAC;YAClBC,MAAM,EAAE,CAAK;YACbC,OAAO,EACN,CAAC;gBACA,CAAc,eAAE,CAAkB;gBAClCH,aAAa;YACd,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { Auth0UserProfile } from 'auth0-js';
2
- import { B } from '@ctx-core/object';
3
- export declare const get_auth0_v2_users_by_email_b: B<get_auth0_v2_users_by_email_T>;
4
- export declare type get_auth0_v2_users_by_email_params_I = {
5
- email: string;
6
- AUTH0_DOMAIN?: string;
7
- };
8
- export declare type get_auth0_v2_users_by_email_T = (params: get_auth0_v2_users_by_email_params_I) => Promise<Response>;
9
- export declare type get_auth0_v2_users_by_email_response_T = Auth0UserProfile[];
@@ -1,25 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0';
2
- import { be_ } from '@ctx-core/object';
3
- import { fetch } from '@ctx-core/fetch';
4
- import { auth0_management_token__b } from './auth0_management_token__b.js';
5
- const key = 'get_auth0_v2_users_by_email';
6
- export const get_auth0_v2_users_by_email_b = be_(key, (ctx)=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx);
8
- return get_auth0_v2_users_by_email;
9
- async function get_auth0_v2_users_by_email(params) {
10
- const { email } = params;
11
- const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN$_b(ctx).$;
12
- const auth0_token = await auth0_management_token_();
13
- const authorization = verify_access_token_header_authorization_(auth0_token);
14
- const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`;
15
- return await fetch(url, {
16
- method: 'GET',
17
- headers: {
18
- 'Content-Type': 'application/json',
19
- authorization
20
- }
21
- });
22
- }
23
- });
24
-
25
- //# sourceMappingURL=get_auth0_v2_users_by_email_b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/get_auth0_v2_users_by_email_b.ts"],"sourcesContent":["import type { Auth0UserProfile } from 'auth0-js'\nimport { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'\nimport { be_, B } from '@ctx-core/object'\nimport { fetch } from '@ctx-core/fetch'\nimport { auth0_management_token__b } from './auth0_management_token__b.js'\nconst key = 'get_auth0_v2_users_by_email'\nexport const get_auth0_v2_users_by_email_b:B<get_auth0_v2_users_by_email_T> = be_(key, ctx=>{\n\tconst auth0_management_token_ = auth0_management_token__b(ctx)\n\treturn get_auth0_v2_users_by_email as get_auth0_v2_users_by_email_T\n\tasync function get_auth0_v2_users_by_email(params:get_auth0_v2_users_by_email_params_I) {\n\t\tconst { email } = params\n\t\tconst AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN$_b(ctx).$\n\t\tconst auth0_token = await auth0_management_token_()\n\t\tconst authorization = verify_access_token_header_authorization_(auth0_token)\n\t\tconst url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`\n\t\treturn await fetch(url, {\n\t\t\tmethod: 'GET',\n\t\t\theaders:\n\t\t\t\t{\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\tauthorization,\n\t\t\t\t},\n\t\t})\n\t}\n})\nexport type get_auth0_v2_users_by_email_params_I = {\n\temail:string,\n\tAUTH0_DOMAIN?:string,\n}\nexport type get_auth0_v2_users_by_email_T =\n\t(params:get_auth0_v2_users_by_email_params_I)=>Promise<Response>\nexport type get_auth0_v2_users_by_email_response_T = Auth0UserProfile[]\n"],"names":["verify_access_token_header_authorization_","AUTH0_DOMAIN$_b","be_","fetch","auth0_management_token__b","key","get_auth0_v2_users_by_email_b","ctx","auth0_management_token_","get_auth0_v2_users_by_email","params","email","AUTH0_DOMAIN","$","auth0_token","authorization","url","encodeURIComponent","method","headers"],"mappings":"AACA,MAAM,GAAGA,yCAAyC,EAAEC,eAAe,QAAQ,CAAiB;AAC5F,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,KAAK,QAAQ,CAAiB;AACvC,MAAM,GAAGC,yBAAyB,QAAQ,CAAgC;AAC1E,KAAK,CAACC,GAAG,GAAG,CAA6B;AACzC,MAAM,CAAC,KAAK,CAACC,6BAA6B,GAAoCJ,GAAG,CAACG,GAAG,GAAEE,GAAG,GAAE,CAAC;IAC5F,KAAK,CAACC,uBAAuB,GAAGJ,yBAAyB,CAACG,GAAG;IAC7D,MAAM,CAACE,2BAA2B;mBACnBA,2BAA2B,CAACC,MAA2C,EAAE,CAAC;QACxF,KAAK,CAAC,CAAC,CAACC,KAAK,EAAC,CAAC,GAAGD,MAAM;QACxB,KAAK,CAACE,YAAY,GAAGF,MAAM,CAACE,YAAY,IAAIX,eAAe,CAACM,GAAG,EAAEM,CAAC;QAClE,KAAK,CAACC,WAAW,GAAG,KAAK,CAACN,uBAAuB;QACjD,KAAK,CAACO,aAAa,GAAGf,yCAAyC,CAACc,WAAW;QAC3E,KAAK,CAACE,GAAG,IAAI,QAAQ,EAAEJ,YAAY,CAAC,6BAA6B,EAAEK,kBAAkB,CAACN,KAAK;QAC3F,MAAM,CAAC,KAAK,CAACR,KAAK,CAACa,GAAG,EAAE,CAAC;YACxBE,MAAM,EAAE,CAAK;YACbC,OAAO,EACN,CAAC;gBACA,CAAc,eAAE,CAAkB;gBAClCJ,aAAa;YACd,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
package/lib/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export * from './auth0_audience__b.js';
2
- export * from './auth0_management_.js';
3
- export * from './auth0_management_client_credentials_body__b.js';
4
- export * from './auth0_management_token__b.js';
5
- export * from './get_auth0_v2_client_grants_b.js';
6
- export * from './get_auth0_v2_user_b.js';
7
- export * from './get_auth0_v2_users_by_email_b.js';
8
- export * from './patch_auth0_v2_client_b.js';
9
- export * from './patch_auth0_v2_user_b.js';
package/lib/index.js DELETED
@@ -1,11 +0,0 @@
1
- export * from './auth0_audience__b.js';
2
- export * from './auth0_management_.js';
3
- export * from './auth0_management_client_credentials_body__b.js';
4
- export * from './auth0_management_token__b.js';
5
- export * from './get_auth0_v2_client_grants_b.js';
6
- export * from './get_auth0_v2_user_b.js';
7
- export * from './get_auth0_v2_users_by_email_b.js';
8
- export * from './patch_auth0_v2_client_b.js';
9
- export * from './patch_auth0_v2_user_b.js';
10
-
11
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './auth0_audience__b.js'\nexport * from './auth0_management_.js'\nexport * from './auth0_management_client_credentials_body__b.js'\nexport * from './auth0_management_token__b.js'\nexport * from './get_auth0_v2_client_grants_b.js'\nexport * from './get_auth0_v2_user_b.js'\nexport * from './get_auth0_v2_users_by_email_b.js'\nexport * from './patch_auth0_v2_client_b.js'\nexport * from './patch_auth0_v2_user_b.js'\n"],"names":[],"mappings":"cAAc,CAAwB;cACxB,CAAwB;cACxB,CAAkD;cAClD,CAAgC;cAChC,CAAmC;cACnC,CAA0B;cAC1B,CAAoC;cACpC,CAA8B;cAC9B,CAA4B"}
@@ -1,8 +0,0 @@
1
- import { B } from '@ctx-core/object';
2
- export declare const patch_auth0_v2_client_b: B<patch_auth0_v2_client_T>;
3
- export interface patch_auth0_v2_client_params_T {
4
- client_id?: string;
5
- body?: string;
6
- json?: unknown;
7
- }
8
- export declare type patch_auth0_v2_client_T = (params: patch_auth0_v2_client_params_T) => Promise<Response>;
@@ -1,26 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0';
2
- import { be_ } from '@ctx-core/object';
3
- import { fetch } from '@ctx-core/fetch';
4
- import { auth0_management_token__b } from './auth0_management_token__b.js';
5
- const key = 'patch_auth0_v2_client';
6
- export const patch_auth0_v2_client_b = be_(key, (ctx)=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx);
8
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx);
9
- return patch_auth0_v2_client;
10
- async function patch_auth0_v2_client(params) {
11
- const { client_id =process.env.AUTH0_CLIENT_ID , body , json , } = params;
12
- const auth0_token = await auth0_management_token_();
13
- const authorization = verify_access_token_header_authorization_(auth0_token);
14
- const url = `https://${AUTH0_DOMAIN$.$}/api/v2/clients/${client_id}`;
15
- return fetch(url, {
16
- method: 'PATCH',
17
- headers: {
18
- 'Content-Type': 'application/json',
19
- authorization
20
- },
21
- body: body || JSON.stringify(json)
22
- });
23
- }
24
- });
25
-
26
- //# sourceMappingURL=patch_auth0_v2_client_b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/patch_auth0_v2_client_b.ts"],"sourcesContent":["import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'\nimport { be_, B } from '@ctx-core/object'\nimport { fetch } from '@ctx-core/fetch'\nimport { auth0_management_token__b } from './auth0_management_token__b.js'\nconst key = 'patch_auth0_v2_client'\nexport const patch_auth0_v2_client_b:B<patch_auth0_v2_client_T> = be_(key, ctx=>{\n\tconst auth0_management_token_ = auth0_management_token__b(ctx)\n\tconst AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)\n\treturn patch_auth0_v2_client as patch_auth0_v2_client_T\n\tasync function patch_auth0_v2_client(params:patch_auth0_v2_client_params_T) {\n\t\tconst {\n\t\t\tclient_id = process.env.AUTH0_CLIENT_ID,\n\t\t\tbody,\n\t\t\tjson,\n\t\t} = params\n\t\tconst auth0_token = await auth0_management_token_()\n\t\tconst authorization = verify_access_token_header_authorization_(auth0_token)\n\t\tconst url = `https://${AUTH0_DOMAIN$.$}/api/v2/clients/${client_id}`\n\t\treturn fetch(url, {\n\t\t\tmethod: 'PATCH',\n\t\t\theaders:\n\t\t\t\t{\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\tauthorization,\n\t\t\t\t},\n\t\t\tbody: body || JSON.stringify(json),\n\t\t})\n\t}\n})\nexport interface patch_auth0_v2_client_params_T {\n\tclient_id?:string\n\tbody?:string\n\tjson?:unknown\n}\nexport type patch_auth0_v2_client_T =\n\t(params:patch_auth0_v2_client_params_T)=>Promise<Response>\n"],"names":["verify_access_token_header_authorization_","AUTH0_DOMAIN$_b","be_","fetch","auth0_management_token__b","key","patch_auth0_v2_client_b","ctx","auth0_management_token_","AUTH0_DOMAIN$","patch_auth0_v2_client","params","client_id","process","env","AUTH0_CLIENT_ID","body","json","auth0_token","authorization","url","$","method","headers","JSON","stringify"],"mappings":"AAAA,MAAM,GAAGA,yCAAyC,EAAEC,eAAe,QAAQ,CAAiB;AAC5F,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,KAAK,QAAQ,CAAiB;AACvC,MAAM,GAAGC,yBAAyB,QAAQ,CAAgC;AAC1E,KAAK,CAACC,GAAG,GAAG,CAAuB;AACnC,MAAM,CAAC,KAAK,CAACC,uBAAuB,GAA8BJ,GAAG,CAACG,GAAG,GAAEE,GAAG,GAAE,CAAC;IAChF,KAAK,CAACC,uBAAuB,GAAGJ,yBAAyB,CAACG,GAAG;IAC7D,KAAK,CAACE,aAAa,GAAGR,eAAe,CAACM,GAAG;IACzC,MAAM,CAACG,qBAAqB;mBACbA,qBAAqB,CAACC,MAAqC,EAAE,CAAC;QAC5E,KAAK,CAAC,CAAC,CACNC,SAAS,EAAGC,OAAO,CAACC,GAAG,CAACC,eAAe,GACvCC,IAAI,GACJC,IAAI,IACL,CAAC,GAAGN,MAAM;QACV,KAAK,CAACO,WAAW,GAAG,KAAK,CAACV,uBAAuB;QACjD,KAAK,CAACW,aAAa,GAAGnB,yCAAyC,CAACkB,WAAW;QAC3E,KAAK,CAACE,GAAG,IAAI,QAAQ,EAAEX,aAAa,CAACY,CAAC,CAAC,gBAAgB,EAAET,SAAS;QAClE,MAAM,CAACT,KAAK,CAACiB,GAAG,EAAE,CAAC;YAClBE,MAAM,EAAE,CAAO;YACfC,OAAO,EACN,CAAC;gBACA,CAAc,eAAE,CAAkB;gBAClCJ,aAAa;YACd,CAAC;YACFH,IAAI,EAAEA,IAAI,IAAIQ,IAAI,CAACC,SAAS,CAACR,IAAI;QAClC,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { Auth0UserProfile } from 'auth0-js';
2
- import { B } from '@ctx-core/object';
3
- export declare const patch_auth0_v2_user_b: B<patch_auth0_v2_user_T>;
4
- export interface patch_auth0_v2_user_data_I extends Partial<Auth0UserProfile> {
5
- password?: string;
6
- }
7
- export declare type patch_auth0_v2_user_T = (user_id: string, data: patch_auth0_v2_user_data_I) => Promise<Response>;
@@ -1,31 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0';
2
- import { fetch } from '@ctx-core/fetch';
3
- import { be_ } from '@ctx-core/object';
4
- import { auth0_management_token__b } from './auth0_management_token__b.js';
5
- const key = 'patch_auth0_v2_user';
6
- export const patch_auth0_v2_user_b = be_(key, (ctx)=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx);
8
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx);
9
- return patch_auth0_v2_user;
10
- /**
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
- */ async function patch_auth0_v2_user(user_id, data) {
17
- const auth0_management_token = await auth0_management_token_();
18
- const authorization = verify_access_token_header_authorization_(auth0_management_token);
19
- const url = `https://${AUTH0_DOMAIN$.$}/api/v2/users/${user_id}`;
20
- return fetch(url, {
21
- method: 'PATCH',
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- authorization
25
- },
26
- body: JSON.stringify(data)
27
- });
28
- }
29
- });
30
-
31
- //# sourceMappingURL=patch_auth0_v2_user_b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/patch_auth0_v2_user_b.ts"],"sourcesContent":["import type { Auth0UserProfile } from 'auth0-js'\nimport { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'\nimport { fetch } from '@ctx-core/fetch'\nimport { be_, B } from '@ctx-core/object'\nimport { auth0_management_token__b } from './auth0_management_token__b.js'\nconst key = 'patch_auth0_v2_user'\nexport const patch_auth0_v2_user_b:B<patch_auth0_v2_user_T> = be_(key, ctx=>{\n\tconst auth0_management_token_ = auth0_management_token__b(ctx)\n\tconst AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)\n\treturn patch_auth0_v2_user as patch_auth0_v2_user_T\n\t/**\n\t * @see {@link https://auth0.com/docs/api-auth/tutorials/client-credentials}\n\t * @see {@link https://auth0.com/docs/api-auth/which-oauth-flow-to-use}\n\t * @see {@link https://auth0.com/docs/clients/client-grant-types}\n\t * @see {@link https://auth0.com/docs/api-auth/grant/authorization-code}\n\t * @see {@link https://auth0.com/docs/protocols/oauth2}\n\t */\n\tasync function patch_auth0_v2_user(user_id:string, data:patch_auth0_v2_user_data_I) {\n\t\tconst auth0_management_token = await auth0_management_token_()\n\t\tconst authorization = verify_access_token_header_authorization_(auth0_management_token)\n\t\tconst url = `https://${AUTH0_DOMAIN$.$}/api/v2/users/${user_id}`\n\t\treturn fetch(url, {\n\t\t\tmethod: 'PATCH',\n\t\t\theaders:\n\t\t\t\t{\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\tauthorization,\n\t\t\t\t},\n\t\t\tbody: JSON.stringify(data),\n\t\t})\n\t}\n})\nexport interface patch_auth0_v2_user_data_I extends Partial<Auth0UserProfile> {\n\tpassword?:string\n}\nexport type patch_auth0_v2_user_T =\n\t(user_id:string, data:patch_auth0_v2_user_data_I)=>Promise<Response>\n"],"names":["verify_access_token_header_authorization_","AUTH0_DOMAIN$_b","fetch","be_","auth0_management_token__b","key","patch_auth0_v2_user_b","ctx","auth0_management_token_","AUTH0_DOMAIN$","patch_auth0_v2_user","user_id","data","auth0_management_token","authorization","url","$","method","headers","body","JSON","stringify"],"mappings":"AACA,MAAM,GAAGA,yCAAyC,EAAEC,eAAe,QAAQ,CAAiB;AAC5F,MAAM,GAAGC,KAAK,QAAQ,CAAiB;AACvC,MAAM,GAAGC,GAAG,QAAW,CAAkB;AACzC,MAAM,GAAGC,yBAAyB,QAAQ,CAAgC;AAC1E,KAAK,CAACC,GAAG,GAAG,CAAqB;AACjC,MAAM,CAAC,KAAK,CAACC,qBAAqB,GAA4BH,GAAG,CAACE,GAAG,GAAEE,GAAG,GAAE,CAAC;IAC5E,KAAK,CAACC,uBAAuB,GAAGJ,yBAAyB,CAACG,GAAG;IAC7D,KAAK,CAACE,aAAa,GAAGR,eAAe,CAACM,GAAG;IACzC,MAAM,CAACG,mBAAmB;IAC1B,EAMG,AANH;;;;;;EAMG,AANH,EAMG,gBACYA,mBAAmB,CAACC,OAAc,EAAEC,IAA+B,EAAE,CAAC;QACpF,KAAK,CAACC,sBAAsB,GAAG,KAAK,CAACL,uBAAuB;QAC5D,KAAK,CAACM,aAAa,GAAGd,yCAAyC,CAACa,sBAAsB;QACtF,KAAK,CAACE,GAAG,IAAI,QAAQ,EAAEN,aAAa,CAACO,CAAC,CAAC,cAAc,EAAEL,OAAO;QAC9D,MAAM,CAACT,KAAK,CAACa,GAAG,EAAE,CAAC;YAClBE,MAAM,EAAE,CAAO;YACfC,OAAO,EACN,CAAC;gBACA,CAAc,eAAE,CAAkB;gBAClCJ,aAAa;YACd,CAAC;YACFK,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACT,IAAI;QAC1B,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { post_auth0_oauth_token_body_I } from '@ctx-core/auth0'
2
- import { be_, B } from '@ctx-core/object'
3
- import { auth0_audience__b } from './auth0_audience__b.js'
4
- const key = 'auth0_management_client_credentials_body_'
5
- export const auth0_management_client_credentials_body__b:B<auth0_management_client_credentials_body__T> = be_(key, ctx=>{
6
- const auth0_audience_ = auth0_audience__b(ctx)
7
- return auth0_management_client_credentials_body_ as auth0_management_client_credentials_body__T
8
- function auth0_management_client_credentials_body_():post_auth0_oauth_token_body_I {
9
- return {
10
- grant_type: 'client_credentials',
11
- client_id: process.env.AUTH0_MANAGEMENT_ID!,
12
- client_secret: process.env.AUTH0_MANAGEMENT_SECRET!,
13
- audience: auth0_audience_(),
14
- }
15
- }
16
- })
17
- export type auth0_management_client_credentials_body__T = ()=>post_auth0_oauth_token_body_I
@@ -1,33 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
- import { fetch } from '@ctx-core/fetch'
3
- import { be_, B } from '@ctx-core/object'
4
- import { query_str_ } from '@ctx-core/uri'
5
- import { auth0_management_token__b} from './auth0_management_token__b.js'
6
- const key = 'get_auth0_v2_client_grants'
7
- export const get_auth0_v2_client_grants_b:B<get_auth0_v2_client_grants_T> = be_(key, ctx=>{
8
- const auth0_management_token_ = auth0_management_token__b(ctx)
9
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
10
- return get_auth0_v2_client_grants as get_auth0_v2_client_grants_T
11
- async function get_auth0_v2_client_grants(
12
- params:get_auth0_v2_client_grants_params_I
13
- ) {
14
- const { query, json } = params
15
- const auth0_token = await auth0_management_token_()
16
- const authorization = verify_access_token_header_authorization_(auth0_token)
17
- const url = `https://${AUTH0_DOMAIN$.$}/api/v2/client-grants?${query || query_str_(json)}`
18
- return fetch(url, {
19
- method: 'GET',
20
- headers:
21
- {
22
- 'Content-Type': 'application/json',
23
- authorization,
24
- },
25
- })
26
- }
27
- })
28
- export interface get_auth0_v2_client_grants_params_I {
29
- query?:string
30
- json?:any
31
- }
32
- export type get_auth0_v2_client_grants_T =
33
- (params:get_auth0_v2_client_grants_params_I)=>Promise<Response>
@@ -1,28 +0,0 @@
1
- import { verify_access_token_header_authorization_ } from '@ctx-core/auth0'
2
- import { fetch } from '@ctx-core/fetch'
3
- import { be_, B } from '@ctx-core/object'
4
- import { auth0_management_token__b } from './auth0_management_token__b.js'
5
- const key = 'get_auth0_v2_user'
6
- export const get_auth0_v2_user_b:B<get_auth0_v2_user_T> = be_(key, ctx=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx)
8
- return get_auth0_v2_user as get_auth0_v2_user_T
9
- async function get_auth0_v2_user({ AUTH0_DOMAIN, user_id }:get_auth0_v2_user_params_T):Promise<Response> {
10
- const auth0_token = await auth0_management_token_()
11
- const authorization = verify_access_token_header_authorization_(auth0_token)
12
- const url = `https://${AUTH0_DOMAIN}/api/v2/users/${user_id}`
13
- return fetch(url, {
14
- method: 'GET',
15
- headers:
16
- {
17
- 'Content-Type': 'application/json',
18
- authorization,
19
- },
20
- })
21
- }
22
- })
23
- export interface get_auth0_v2_user_params_T {
24
- AUTH0_DOMAIN:string
25
- user_id:string
26
- }
27
- export type get_auth0_v2_user_T =
28
- (params:get_auth0_v2_user_params_T)=>Promise<Response>
@@ -1,32 +0,0 @@
1
- import type { Auth0UserProfile } from 'auth0-js'
2
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
3
- import { be_, B } from '@ctx-core/object'
4
- import { fetch } from '@ctx-core/fetch'
5
- import { auth0_management_token__b } from './auth0_management_token__b.js'
6
- const key = 'get_auth0_v2_users_by_email'
7
- export const get_auth0_v2_users_by_email_b:B<get_auth0_v2_users_by_email_T> = be_(key, ctx=>{
8
- const auth0_management_token_ = auth0_management_token__b(ctx)
9
- return get_auth0_v2_users_by_email as get_auth0_v2_users_by_email_T
10
- async function get_auth0_v2_users_by_email(params:get_auth0_v2_users_by_email_params_I) {
11
- const { email } = params
12
- const AUTH0_DOMAIN = params.AUTH0_DOMAIN || AUTH0_DOMAIN$_b(ctx).$
13
- const auth0_token = await auth0_management_token_()
14
- const authorization = verify_access_token_header_authorization_(auth0_token)
15
- const url = `https://${AUTH0_DOMAIN}/api/v2/users-by-email?email=${encodeURIComponent(email)}`
16
- return await fetch(url, {
17
- method: 'GET',
18
- headers:
19
- {
20
- 'Content-Type': 'application/json',
21
- authorization,
22
- },
23
- })
24
- }
25
- })
26
- export type get_auth0_v2_users_by_email_params_I = {
27
- email:string,
28
- AUTH0_DOMAIN?:string,
29
- }
30
- export type get_auth0_v2_users_by_email_T =
31
- (params:get_auth0_v2_users_by_email_params_I)=>Promise<Response>
32
- export type get_auth0_v2_users_by_email_response_T = Auth0UserProfile[]
@@ -1,36 +0,0 @@
1
- import { verify_access_token_header_authorization_, AUTH0_DOMAIN$_b } from '@ctx-core/auth0'
2
- import { be_, B } from '@ctx-core/object'
3
- import { fetch } from '@ctx-core/fetch'
4
- import { auth0_management_token__b } from './auth0_management_token__b.js'
5
- const key = 'patch_auth0_v2_client'
6
- export const patch_auth0_v2_client_b:B<patch_auth0_v2_client_T> = be_(key, ctx=>{
7
- const auth0_management_token_ = auth0_management_token__b(ctx)
8
- const AUTH0_DOMAIN$ = AUTH0_DOMAIN$_b(ctx)
9
- return patch_auth0_v2_client as patch_auth0_v2_client_T
10
- async function patch_auth0_v2_client(params:patch_auth0_v2_client_params_T) {
11
- const {
12
- client_id = process.env.AUTH0_CLIENT_ID,
13
- body,
14
- json,
15
- } = params
16
- const auth0_token = await auth0_management_token_()
17
- const authorization = verify_access_token_header_authorization_(auth0_token)
18
- const url = `https://${AUTH0_DOMAIN$.$}/api/v2/clients/${client_id}`
19
- return fetch(url, {
20
- method: 'PATCH',
21
- headers:
22
- {
23
- 'Content-Type': 'application/json',
24
- authorization,
25
- },
26
- body: body || JSON.stringify(json),
27
- })
28
- }
29
- })
30
- export interface patch_auth0_v2_client_params_T {
31
- client_id?:string
32
- body?:string
33
- json?:unknown
34
- }
35
- export type patch_auth0_v2_client_T =
36
- (params:patch_auth0_v2_client_params_T)=>Promise<Response>