@ctx-core/auth0-management 9.8.122 → 9.8.127

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.
@@ -4,5 +4,5 @@ export const [
4
4
  auth0__user$_,
5
5
  auth0__user_,
6
6
  auth0__user__set,
7
- ] = /** @type {be_atom_triple_T<UserProfile>} */be_atom_triple_(()=>
7
+ ] = /** @type {be_atom_triple_T<import('auth0').UserProfile>} */be_atom_triple_(()=>
8
8
  undefined)
@@ -1,5 +1,5 @@
1
- import { ctx__new } from '@ctx-core/object'
2
1
  import type { UserProfile } from 'auth0'
2
+ import { ctx__new } from 'ctx-core/be'
3
3
  import { test } from 'uvu'
4
4
  import { equal } from 'uvu/assert'
5
5
  import { auth0__user$_, auth0__user_, auth0__user__set } from '../index.js'
@@ -1,7 +1,7 @@
1
1
  import type { fetch__template_pair_T } from '@ctx-core/fetch'
2
- import type { Ctx } from '@ctx-core/object'
3
2
  import type { Client } from 'auth0'
4
3
  import type { Auth0Error } from 'auth0-js'
4
+ import type { Ctx } from 'ctx-core/be'
5
5
  export declare const [
6
6
  auth0__v2_client__GET__fetch,
7
7
  auth0__v2_client__GET__fetch2,
@@ -1,10 +1,12 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_CLIENT_ID_, AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
2
4
  import { fetch__template_pair__new } from '@ctx-core/fetch'
3
5
  import { auth0_management__token__new } from '../auth0_management__token__new/index.js'
4
6
  /** @typedef {import('@ctx-core/fetch').response_pair_T} */
5
- /** @typedef {import('@ctx-core/object').Ctx} */
7
+ /** @typedef {Ctx} */
6
8
  /** @typedef {import('auth0').Client} */
7
- /** @typedef {import('./index.d.ts').auth0__v2_client__GET__fetch__params_T} */
9
+ /** @typedef {auth0__v2_client__GET__fetch__params_T} */
8
10
  export const [
9
11
  auth0__v2_client__GET__fetch,
10
12
  auth0__v2_client__GET__fetch2,
@@ -1,7 +1,7 @@
1
1
  import type { fetch__template_pair_T } from '@ctx-core/fetch'
2
- import type { Ctx } from '@ctx-core/object'
3
2
  import type { ClientGrant } from 'auth0'
4
3
  import type { Auth0Error } from 'auth0-js'
4
+ import type { Ctx } from 'ctx-core/be'
5
5
  export declare const [
6
6
  auth0__v2_client_grants__GET__fetch,
7
7
  auth0__v2_client_grants__GET__fetch2,
@@ -1,11 +1,13 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
2
4
  import { fetch__template_pair__new } from '@ctx-core/fetch'
3
- import { query_str_ } from '@ctx-core/uri'
5
+ import { query_str_ } from 'ctx-core/uri'
4
6
  import { auth0_management__token__new } from '../auth0_management__token__new/index.js'
5
7
  /** @typedef {import('@ctx-core/fetch').response_pair_T} */
6
- /** @typedef {import('@ctx-core/object').Ctx} */
8
+ /** @typedef {Ctx} */
7
9
  /** @typedef {import('auth0').CreateClientGrant} */
8
- /** @typedef {import('./index.d.ts').auth0__v2_client_grants__GET__fetch__params_T} */
10
+ /** @typedef {auth0__v2_client_grants__GET__fetch__params_T} */
9
11
  export const [
10
12
  auth0__v2_client_grants__GET__fetch,
11
13
  auth0__v2_client_grants__GET__fetch2,
@@ -1,7 +1,7 @@
1
1
  import type { fetch__template_pair_T } from '@ctx-core/fetch'
2
- import type { Ctx } from '@ctx-core/object'
3
2
  import type { UserProfile } from 'auth0'
4
3
  import type { Auth0Error } from 'auth0-js'
4
+ import type { Ctx } from 'ctx-core/be'
5
5
  export declare const [
6
6
  auth0__v2_user__GET__fetch,
7
7
  auth0__v2_user__GET__fetch2,
@@ -1,9 +1,11 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
2
4
  import { fetch__template_pair__new } from '@ctx-core/fetch'
3
5
  import { auth0_management__token__new } from '../auth0_management__token__new/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx} */
6
+ /** @typedef {Ctx} */
5
7
  /** @typedef {import('auth0').User} */
6
- /** @typedef {import('./index.d.ts').auth0__v2_user__GET__fetch__params_T} */
8
+ /** @typedef {auth0__v2_user__GET__fetch__params_T} */
7
9
  export const [
8
10
  auth0__v2_user__GET__fetch,
9
11
  auth0__v2_user__GET__fetch2,
@@ -1,6 +1,6 @@
1
1
  import { AUTH0_DOMAIN__set } from '@ctx-core/auth0'
2
- import { ctx__new } from '@ctx-core/object'
3
2
  import { type UserProfile } from 'auth0'
3
+ import { ctx__new } from 'ctx-core/be'
4
4
  import { restore, stub } from 'sinon'
5
5
  import { test } from 'uvu'
6
6
  import { equal } from 'uvu/assert'
@@ -76,30 +76,30 @@ function auth0__user__new() {
76
76
  function api_v2_user__stub(auth0__user:UserProfile) {
77
77
  const fetch = stub(globalThis, 'fetch')
78
78
  fetch
79
- .withArgs('https://myapp.auth0.com/oauth/token', {
80
- method: 'POST',
81
- headers: { 'Content-Type': 'application/json' },
82
- body: JSON.stringify({
83
- grant_type: 'client_credentials',
84
- client_id: 'AUTH0_MANAGEMENT_ID',
85
- client_secret: 'AUTH0_MANAGEMENT_SECRET',
86
- audience: 'https://myapp.auth0.com/api/v2/',
79
+ .withArgs('https://myapp.auth0.com/oauth/token', {
80
+ method: 'POST',
81
+ headers: { 'Content-Type': 'application/json' },
82
+ body: JSON.stringify({
83
+ grant_type: 'client_credentials',
84
+ client_id: 'AUTH0_MANAGEMENT_ID',
85
+ client_secret: 'AUTH0_MANAGEMENT_SECRET',
86
+ audience: 'https://myapp.auth0.com/api/v2/',
87
+ })
87
88
  })
88
- })
89
- .resolves(new Response(JSON.stringify({
90
- access_token: 'access_token',
91
- token_type: 'Bearer',
92
- }), {
93
- status: 200,
94
- headers: {
95
- 'Content-Type': 'application/json'
96
- }
97
- }))
89
+ .resolves(new Response(JSON.stringify({
90
+ access_token: 'access_token',
91
+ token_type: 'Bearer',
92
+ }), {
93
+ status: 200,
94
+ headers: {
95
+ 'Content-Type': 'application/json'
96
+ }
97
+ }))
98
98
  fetch.withArgs('https://myapp.auth0.com/api/v2/users/123')
99
- .resolves(new Response(JSON.stringify(auth0__user), {
100
- status: 200,
101
- headers: {
102
- 'Content-Type': 'application/json'
103
- }
104
- }))
99
+ .resolves(new Response(JSON.stringify(auth0__user), {
100
+ status: 200,
101
+ headers: {
102
+ 'Content-Type': 'application/json'
103
+ }
104
+ }))
105
105
  }
@@ -1,7 +1,7 @@
1
1
  import type { fetch__template_pair_T } from '@ctx-core/fetch'
2
- import type { Ctx } from '@ctx-core/object'
3
2
  import type { UserProfile, UserUpdate } from 'auth0'
4
3
  import type { Auth0Error } from 'auth0-js'
4
+ import type { Ctx } from 'ctx-core/be'
5
5
  export declare const [
6
6
  auth0__v2_user__PATCH__fetch,
7
7
  auth0__v2_user__PATCH__fetch2,
@@ -1,10 +1,12 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
2
4
  import { fetch__template_pair__new } from '@ctx-core/fetch'
3
5
  import { auth0_management__token__new } from '../auth0_management__token__new/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx} */
6
+ /** @typedef {Ctx} */
5
7
  /** @typedef {import('auth0').UpdateUserData} */
6
- /** @typedef {import('./index.d.ts').auth0__v2_user__PATCH__fetch__data_T} */
7
- /** @typedef {import('./index.d.ts').auth0__v2_user__PATCH__error_T} */
8
+ /** @typedef {auth0__v2_user__PATCH__fetch__data_T} */
9
+ /** @typedef {auth0__v2_user__PATCH__error_T} */
8
10
  export const [
9
11
  auth0__v2_user__PATCH__fetch,
10
12
  auth0__v2_user__PATCH__fetch2,
@@ -1,6 +1,6 @@
1
1
  import type { fetch__template_pair_T } from '@ctx-core/fetch'
2
- import type { Ctx } from '@ctx-core/object'
3
2
  import type { Auth0Error, Auth0UserProfile } from 'auth0-js'
3
+ import type { Ctx } from 'ctx-core/be'
4
4
  export declare const [
5
5
  auth0__v2_users_by_email__GET__fetch,
6
6
  auth0__v2_users_by_email__GET__fetch2,
@@ -1,9 +1,11 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_DOMAIN_, header__access_token__verify } from '@ctx-core/auth0'
2
4
  import { fetch__template_pair__new } from '@ctx-core/fetch'
3
5
  import { auth0_management__token__new } from '../auth0_management__token__new/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx} */
6
+ /** @typedef {Ctx} */
5
7
  /** @type {import('auth0-js').Auth0UserProfile} */
6
- /** @typedef {import('./index.d.ts').auth0__v2_users_by_email__GET__fetch__params_T} */
8
+ /** @typedef {auth0__v2_users_by_email__GET__fetch__params_T} */
7
9
  export const [
8
10
  auth0__v2_users_by_email__GET__fetch,
9
11
  auth0__v2_users_by_email__GET__fetch2,
@@ -1,6 +1,6 @@
1
1
  import { AUTH0_DOMAIN__set } from '@ctx-core/auth0'
2
- import { ctx__new } from '@ctx-core/object'
3
2
  import { type Auth0UserProfile } from 'auth0-js'
3
+ import { ctx__new } from 'ctx-core/be'
4
4
  import { restore, stub } from 'sinon'
5
5
  import { test } from 'uvu'
6
6
  import { equal } from 'uvu/assert'
@@ -46,39 +46,39 @@ test.run()
46
46
  function fetch__users_by_email__stub(user_a:Auth0UserProfile[]) {
47
47
  const fetch = stub(globalThis, 'fetch')
48
48
  fetch
49
- .withArgs('https://myapp.auth0.com/oauth/token', {
50
- method: 'POST',
51
- headers: { 'Content-Type': 'application/json' },
52
- body: JSON.stringify({
53
- grant_type: 'client_credentials',
54
- client_id: 'AUTH0_MANAGEMENT_ID',
55
- client_secret: 'AUTH0_MANAGEMENT_SECRET',
56
- audience: 'https://myapp.auth0.com/api/v2/',
49
+ .withArgs('https://myapp.auth0.com/oauth/token', {
50
+ method: 'POST',
51
+ headers: { 'Content-Type': 'application/json' },
52
+ body: JSON.stringify({
53
+ grant_type: 'client_credentials',
54
+ client_id: 'AUTH0_MANAGEMENT_ID',
55
+ client_secret: 'AUTH0_MANAGEMENT_SECRET',
56
+ audience: 'https://myapp.auth0.com/api/v2/',
57
+ })
57
58
  })
58
- })
59
- .resolves(new Response(JSON.stringify({
60
- access_token: 'access_token',
61
- token_type: 'Bearer',
62
- }), {
63
- status: 200,
64
- headers: {
65
- 'Content-Type': 'application/json'
66
- }
67
- }))
59
+ .resolves(new Response(JSON.stringify({
60
+ access_token: 'access_token',
61
+ token_type: 'Bearer',
62
+ }), {
63
+ status: 200,
64
+ headers: {
65
+ 'Content-Type': 'application/json'
66
+ }
67
+ }))
68
68
  fetch
69
- .withArgs('https://myapp.auth0.com/api/v2/users-by-email?email=john.doe%40gmail.com', {
70
- 'method': 'GET',
71
- 'headers': {
72
- 'Content-Type': 'application/json',
73
- 'authorization': 'Bearer access_token'
74
- }
75
- })
76
- .resolves(new Response(JSON.stringify(user_a), {
77
- status: 200,
78
- headers: {
79
- 'Content-Type': 'application/json'
80
- }
81
- }))
69
+ .withArgs('https://myapp.auth0.com/api/v2/users-by-email?email=john.doe%40gmail.com', {
70
+ 'method': 'GET',
71
+ 'headers': {
72
+ 'Content-Type': 'application/json',
73
+ 'authorization': 'Bearer access_token'
74
+ }
75
+ })
76
+ .resolves(new Response(JSON.stringify(user_a), {
77
+ status: 200,
78
+ headers: {
79
+ 'Content-Type': 'application/json'
80
+ }
81
+ }))
82
82
  }
83
83
  function user_a_():Auth0UserProfile[] {
84
84
  return [
@@ -1,5 +1,5 @@
1
1
  import type { auth0__oauth_token__fetch__body_T } from '@ctx-core/auth0'
2
- import type { Ctx } from '@ctx-core/object'
2
+ import type { Ctx } from 'ctx-core/be'
3
3
  export declare function auth0_management__client_credentials__body__new(
4
4
  ctx:Ctx
5
5
  ):auth0__oauth_token__fetch__body_T
@@ -1,8 +1,9 @@
1
+ /// <reference types="ctx-core" />
1
2
  import { auth0__v2__url_ } from '@ctx-core/auth0'
2
3
  import { AUTH0_MANAGEMENT_ID_ } from '../AUTH0_MANAGEMENT_ID/index.js'
3
4
  import { AUTH0_MANAGEMENT_SECRET_ } from '../AUTH0_MANAGEMENT_SECRET/index.js'
4
5
  /**
5
- * @param {import('@ctx-core/object').Ctx}ctx
6
+ * @param {Ctx}ctx
6
7
  * @return {import('@ctx-core/auth0').auth0__oauth_token__fetch__body_T}
7
8
  */
8
9
  export function auth0_management__client_credentials__body__new(ctx) {
@@ -1,4 +1,4 @@
1
- import type { Ctx } from '@ctx-core/object'
1
+ import type { Ctx } from 'ctx-core/be'
2
2
  export declare function auth0_management__init(
3
3
  ctx:Ctx,
4
4
  params:auth0_management__init__params_T
@@ -1,8 +1,10 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { import_meta_env_ } from '@ctx-core/env'
2
4
  import { AUTH0_MANAGEMENT_ID__set } from '../AUTH0_MANAGEMENT_ID/index.js'
3
5
  import { AUTH0_MANAGEMENT_SECRET__set } from '../AUTH0_MANAGEMENT_SECRET/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx} */
5
- /** @typedef {import('./index.d.ts').auth0_management__init__params_T} */
6
+ /** @typedef {Ctx} */
7
+ /** @typedef {auth0_management__init__params_T} */
6
8
  /**
7
9
  * @param {Ctx}ctx
8
10
  * @param {auth0_management__init__params_T}params
@@ -1,5 +1,5 @@
1
- import type { Ctx } from '@ctx-core/object'
2
1
  import type { ManagementClient } from 'auth0'
2
+ import type { Ctx } from 'ctx-core/be'
3
3
  export declare function auth0_management__new(
4
4
  ctx:Ctx,
5
5
  params?:auth0_management__params_T
@@ -1,12 +1,12 @@
1
+ /// <reference types="ctx-core" />
2
+ /// <reference types="./index.d.ts" />
1
3
  import { AUTH0_DOMAIN_ } from '@ctx-core/auth0'
2
- import { createRequire } from 'module'
4
+ import { ManagementClient } from 'auth0'
3
5
  import { AUTH0_MANAGEMENT_ID_ } from '../AUTH0_MANAGEMENT_ID/index.js'
4
6
  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} */
7
+ /** @typedef {Ctx} */
8
8
  /** @typedef {import('auth0').ManagementClient} */
9
- /** @typedef {import('./index.d.ts').auth0_management__params_T} */
9
+ /** @typedef {auth0_management__params_T} */
10
10
  /**
11
11
  * @param {Ctx}ctx
12
12
  * @param {auth0_management__params_T}params
@@ -1,5 +1,5 @@
1
1
  import type { auth0__token_T } from '@ctx-core/auth0'
2
- import type { Ctx } from '@ctx-core/object'
2
+ import type { Ctx } from 'ctx-core/be'
3
3
  export declare function auth0_management__token__new(
4
4
  ctx:Ctx
5
5
  ):Promise<auth0__token_T>
@@ -1,10 +1,11 @@
1
+ /// <reference types="ctx-core" />
1
2
  import { auth0__oauth_token__POST__fetch2 } from '@ctx-core/auth0'
2
- import { http_error__throw } from '@ctx-core/error'
3
+ import { http_error__throw } from 'ctx-core/error'
3
4
  import {
4
5
  auth0_management__client_credentials__body__new
5
6
  } from '../auth0_management__client_credentials__body__new/index.js'
6
7
  /** @typedef {import('@ctx-core/auth0').auth0__token_T} */
7
- /** @typedef {import('@ctx-core/object').Ctx} */
8
+ /** @typedef {Ctx} */
8
9
  /** @typedef {import('auth0-js').Auth0Error} */
9
10
  /**
10
11
  * @param {Ctx}ctx
@@ -1,5 +1,5 @@
1
1
  import { AUTH0_DOMAIN__set } from '@ctx-core/auth0'
2
- import { ctx__new } from '@ctx-core/object'
2
+ import { ctx__new } from 'ctx-core/be'
3
3
  import { restore, stub } from 'sinon'
4
4
  import { test } from 'uvu'
5
5
  import { equal } from 'uvu/assert'
@@ -15,30 +15,30 @@ test('auth0_management__token__new|error', async ()=>{
15
15
  fetch__oauth_token__stub()
16
16
  let err
17
17
  await auth0_management__token__new(ctx)
18
- .catch($err=>err = $err)
18
+ .catch($err=>err = $err)
19
19
  equal(!!err, true)
20
20
  equal(err!.message, 'security error: invalid credentials')
21
21
  function fetch__oauth_token__stub() {
22
22
  stub(globalThis, 'fetch')
23
- .withArgs('https://myapp.auth0.com/oauth/token', {
24
- method: 'POST',
25
- headers: { 'Content-Type': 'application/json' },
26
- body: JSON.stringify({
27
- grant_type: 'client_credentials',
28
- client_id: 'AUTH0_MANAGEMENT_ID',
29
- client_secret: 'AUTH0_MANAGEMENT_SECRET',
30
- audience: 'https://myapp.auth0.com/api/v2/',
23
+ .withArgs('https://myapp.auth0.com/oauth/token', {
24
+ method: 'POST',
25
+ headers: { 'Content-Type': 'application/json' },
26
+ body: JSON.stringify({
27
+ grant_type: 'client_credentials',
28
+ client_id: 'AUTH0_MANAGEMENT_ID',
29
+ client_secret: 'AUTH0_MANAGEMENT_SECRET',
30
+ audience: 'https://myapp.auth0.com/api/v2/',
31
+ })
31
32
  })
32
- })
33
- .resolves(new Response(JSON.stringify({
34
- error: 'security error',
35
- error_description: 'invalid credentials'
36
- }), {
37
- status: 403,
38
- headers: {
39
- 'Content-Type': 'application/json',
40
- }
41
- }))
33
+ .resolves(new Response(JSON.stringify({
34
+ error: 'security error',
35
+ error_description: 'invalid credentials'
36
+ }), {
37
+ status: 403,
38
+ headers: {
39
+ 'Content-Type': 'application/json',
40
+ }
41
+ }))
42
42
  }
43
43
  })
44
44
  test.run()
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { ctx__new } from '@ctx-core/object'
2
+ import { ctx__new } from 'ctx-core/be'
3
3
  import { auth0__v2_client__GET__fetch2 } from '../index.js'
4
4
  await main()
5
5
  async function main() {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { import_meta_env_ } from '@ctx-core/env'
3
- import { ctx__new } from '@ctx-core/object'
3
+ import { ctx__new } from 'ctx-core/be'
4
4
  import { auth0__v2_client_grants__GET__fetch2, auth0__v2__url_ } from '../index.js'
5
5
  await main()
6
6
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/auth0-management",
3
- "version": "9.8.122",
3
+ "version": "9.8.127",
4
4
  "description": "ctx-core auth0 management api",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -46,14 +46,12 @@
46
46
  "getAll-client-grants-auth0": "./bin/getAll-client-grants-auth0.mjs"
47
47
  },
48
48
  "dependencies": {
49
- "@ctx-core/auth0": "^40.1.114",
50
- "@ctx-core/env": "^17.4.59",
51
- "@ctx-core/error": "^12.4.53",
52
- "@ctx-core/fetch": "^13.1.59",
53
- "@ctx-core/nanostores": "10.0.2",
54
- "@ctx-core/object": "^31.1.35",
55
- "@ctx-core/uri": "^12.6.5",
56
- "auth0": "^4.2.0"
49
+ "@ctx-core/auth0": "^40.1.118",
50
+ "@ctx-core/env": "^17.4.61",
51
+ "@ctx-core/fetch": "^13.1.61",
52
+ "@ctx-core/nanostores": "10.0.4",
53
+ "auth0": "^4.2.0",
54
+ "ctx-core": "^5.1.0"
57
55
  },
58
56
  "devDependencies": {
59
57
  "@types/auth0": "^3.3.10",
@@ -62,7 +60,7 @@
62
60
  "c8": "^8.0.1",
63
61
  "check-dts": "^0.7.2",
64
62
  "sinon": "^17.0.1",
65
- "tsx": "^4.6.2",
63
+ "tsx": "^4.7.0",
66
64
  "typescript": "next",
67
65
  "uvu": "^0.5.6"
68
66
  },