@adonisjs/ally 5.0.1 → 5.0.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.
@@ -1,16 +1,12 @@
1
1
  // src/ally_manager.ts
2
2
  import { RuntimeException } from "@poppinss/utils";
3
3
  var AllyManager = class {
4
- /**
5
- * Config with the list of social providers
6
- */
7
- #config;
8
- #ctx;
9
- #driversCache = /* @__PURE__ */ new Map();
10
4
  constructor(config, ctx) {
5
+ this.config = config;
11
6
  this.#ctx = ctx;
12
- this.#config = config;
13
7
  }
8
+ #ctx;
9
+ #driversCache = /* @__PURE__ */ new Map();
14
10
  /**
15
11
  * Returns the driver instance of a social provider
16
12
  */
@@ -18,7 +14,7 @@ var AllyManager = class {
18
14
  if (this.#driversCache.has(provider)) {
19
15
  return this.#driversCache.get(provider);
20
16
  }
21
- const driver = this.#config[provider];
17
+ const driver = this.config[provider];
22
18
  if (!driver) {
23
19
  throw new RuntimeException(
24
20
  `Unknown ally provider "${String(
@@ -35,4 +31,4 @@ var AllyManager = class {
35
31
  export {
36
32
  AllyManager
37
33
  };
38
- //# sourceMappingURL=chunk-UIZWPBWM.js.map
34
+ //# sourceMappingURL=chunk-NZT2DLWM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ally_manager.ts"],"sourcesContent":["/*\n * @adonisjs/ally\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { RuntimeException } from '@poppinss/utils'\nimport type { HttpContext } from '@adonisjs/core/http'\nimport type { AllyDriverContract, AllyManagerDriverFactory } from './types.js'\n\n/**\n * AllyManager is used to create instances of a social drivers during an\n * HTTP request. The drivers are cached during the lifecycle of a request.\n */\nexport class AllyManager<KnownSocialProviders extends Record<string, AllyManagerDriverFactory>> {\n #ctx: HttpContext\n #driversCache: Map<keyof KnownSocialProviders, AllyDriverContract<any, any>> = new Map()\n\n constructor(\n public config: KnownSocialProviders,\n ctx: HttpContext\n ) {\n this.#ctx = ctx\n }\n\n /**\n * Returns the driver instance of a social provider\n */\n use<SocialProvider extends keyof KnownSocialProviders>(\n provider: SocialProvider\n ): ReturnType<KnownSocialProviders[SocialProvider]> {\n if (this.#driversCache.has(provider)) {\n return this.#driversCache.get(provider) as ReturnType<KnownSocialProviders[SocialProvider]>\n }\n\n const driver = this.config[provider]\n if (!driver) {\n throw new RuntimeException(\n `Unknown ally provider \"${String(\n provider\n )}\". Make sure it is registered inside the config/ally.ts file`\n )\n }\n\n const driverInstance = driver(this.#ctx) as ReturnType<KnownSocialProviders[SocialProvider]>\n this.#driversCache.set(provider, driverInstance)\n\n return driverInstance\n }\n}\n"],"mappings":";AASA,SAAS,wBAAwB;AAQ1B,IAAM,cAAN,MAAyF;AAAA,EAI9F,YACS,QACP,KACA;AAFO;AAGP,SAAK,OAAO;AAAA,EACd;AAAA,EARA;AAAA,EACA,gBAA+E,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA,EAYvF,IACE,UACkD;AAClD,QAAI,KAAK,cAAc,IAAI,QAAQ,GAAG;AACpC,aAAO,KAAK,cAAc,IAAI,QAAQ;AAAA,IACxC;AAEA,UAAM,SAAS,KAAK,OAAO,QAAQ;AACnC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR,0BAA0B;AAAA,UACxB;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,UAAM,iBAAiB,OAAO,KAAK,IAAI;AACvC,SAAK,cAAc,IAAI,UAAU,cAAc;AAE/C,WAAO;AAAA,EACT;AACF;","names":[]}
package/build/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-Y3GA4Y2H.js";
4
4
  import {
5
5
  AllyManager
6
- } from "./chunk-UIZWPBWM.js";
6
+ } from "./chunk-NZT2DLWM.js";
7
7
  import {
8
8
  Oauth2Driver
9
9
  } from "./chunk-OSVNBZ7V.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AllyManager
3
- } from "../chunk-UIZWPBWM.js";
3
+ } from "../chunk-NZT2DLWM.js";
4
4
  import "../chunk-CSAU5B4Q.js";
5
5
 
6
6
  // providers/ally_provider.ts
@@ -6,6 +6,7 @@ import type { AllyManagerDriverFactory } from './types.js';
6
6
  */
7
7
  export declare class AllyManager<KnownSocialProviders extends Record<string, AllyManagerDriverFactory>> {
8
8
  #private;
9
+ config: KnownSocialProviders;
9
10
  constructor(config: KnownSocialProviders, ctx: HttpContext);
10
11
  /**
11
12
  * Returns the driver instance of a social provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/ally",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Social authentication provider for AdonisJS",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -47,36 +47,36 @@
47
47
  "author": "adonisjs,virk",
48
48
  "license": "MIT",
49
49
  "devDependencies": {
50
- "@adonisjs/assembler": "^7.0.0",
51
- "@adonisjs/core": "^6.2.0",
50
+ "@adonisjs/assembler": "^7.1.0",
51
+ "@adonisjs/core": "^6.2.1",
52
52
  "@adonisjs/eslint-config": "^1.2.1",
53
53
  "@adonisjs/prettier-config": "^1.2.1",
54
54
  "@adonisjs/tsconfig": "^1.2.1",
55
- "@commitlint/cli": "^18.4.4",
56
- "@commitlint/config-conventional": "^18.4.4",
55
+ "@commitlint/cli": "^18.5.0",
56
+ "@commitlint/config-conventional": "^18.5.0",
57
57
  "@japa/assert": "^2.1.0",
58
58
  "@japa/expect-type": "^2.0.1",
59
- "@japa/file-system": "^2.1.1",
59
+ "@japa/file-system": "^2.2.0",
60
60
  "@japa/runner": "^3.1.1",
61
- "@swc/core": "^1.3.102",
62
- "@types/node": "^20.10.7",
63
- "c8": "^9.0.0",
61
+ "@swc/core": "^1.3.105",
62
+ "@types/node": "^20.11.5",
63
+ "c8": "^9.1.0",
64
64
  "copyfiles": "^2.4.1",
65
65
  "del-cli": "^5.1.0",
66
- "dotenv": "^16.3.1",
66
+ "dotenv": "^16.3.2",
67
67
  "eslint": "^8.56.0",
68
68
  "github-label-sync": "^2.3.1",
69
69
  "husky": "^8.0.3",
70
- "nock": "^13.4.0",
70
+ "nock": "^13.5.0",
71
71
  "np": "^9.2.0",
72
- "prettier": "^3.1.1",
72
+ "prettier": "^3.2.4",
73
73
  "ts-node": "^10.9.2",
74
74
  "tsup": "^8.0.1",
75
75
  "typescript": "^5.3.3"
76
76
  },
77
77
  "dependencies": {
78
78
  "@poppinss/oauth-client": "^5.1.2",
79
- "@poppinss/utils": "^6.7.0"
79
+ "@poppinss/utils": "^6.7.1"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@adonisjs/core": "^6.2.0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ally_manager.ts"],"sourcesContent":["/*\n * @adonisjs/ally\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { RuntimeException } from '@poppinss/utils'\nimport type { HttpContext } from '@adonisjs/core/http'\nimport type { AllyDriverContract, AllyManagerDriverFactory } from './types.js'\n\n/**\n * AllyManager is used to create instances of a social drivers during an\n * HTTP request. The drivers are cached during the lifecycle of a request.\n */\nexport class AllyManager<KnownSocialProviders extends Record<string, AllyManagerDriverFactory>> {\n /**\n * Config with the list of social providers\n */\n #config: KnownSocialProviders\n #ctx: HttpContext\n #driversCache: Map<keyof KnownSocialProviders, AllyDriverContract<any, any>> = new Map()\n\n constructor(config: KnownSocialProviders, ctx: HttpContext) {\n this.#ctx = ctx\n this.#config = config\n }\n\n /**\n * Returns the driver instance of a social provider\n */\n use<SocialProvider extends keyof KnownSocialProviders>(\n provider: SocialProvider\n ): ReturnType<KnownSocialProviders[SocialProvider]> {\n if (this.#driversCache.has(provider)) {\n return this.#driversCache.get(provider) as ReturnType<KnownSocialProviders[SocialProvider]>\n }\n\n const driver = this.#config[provider]\n if (!driver) {\n throw new RuntimeException(\n `Unknown ally provider \"${String(\n provider\n )}\". Make sure it is registered inside the config/ally.ts file`\n )\n }\n\n const driverInstance = driver(this.#ctx) as ReturnType<KnownSocialProviders[SocialProvider]>\n this.#driversCache.set(provider, driverInstance)\n\n return driverInstance\n }\n}\n"],"mappings":";AASA,SAAS,wBAAwB;AAQ1B,IAAM,cAAN,MAAyF;AAAA;AAAA;AAAA;AAAA,EAI9F;AAAA,EACA;AAAA,EACA,gBAA+E,oBAAI,IAAI;AAAA,EAEvF,YAAY,QAA8B,KAAkB;AAC1D,SAAK,OAAO;AACZ,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,IACE,UACkD;AAClD,QAAI,KAAK,cAAc,IAAI,QAAQ,GAAG;AACpC,aAAO,KAAK,cAAc,IAAI,QAAQ;AAAA,IACxC;AAEA,UAAM,SAAS,KAAK,QAAQ,QAAQ;AACpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR,0BAA0B;AAAA,UACxB;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,UAAM,iBAAiB,OAAO,KAAK,IAAI;AACvC,SAAK,cAAc,IAAI,UAAU,cAAc;AAE/C,WAAO;AAAA,EACT;AACF;","names":[]}