@adonisjs/ally 6.0.0-next.0 → 6.1.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.
- package/README.md +2 -2
- package/build/{chunk-WM3V3APX.js → chunk-46TOMXWK.js} +92 -15
- package/build/chunk-6BP2DK5A.js +43 -0
- package/build/{chunk-KSJ4CFTC.js → chunk-NK6X76EQ.js} +16 -25
- package/build/{chunk-KWRXS6EG.js → chunk-SBQAXPUK.js} +33 -3
- package/build/chunk-TFPW7D75.js +125 -0
- package/build/index.js +67 -6
- package/build/providers/ally_provider.d.ts +10 -0
- package/build/providers/ally_provider.js +13 -2
- package/build/src/abstract_drivers/oauth1.d.ts +26 -0
- package/build/src/abstract_drivers/oauth2.d.ts +50 -2
- package/build/src/ally_manager.d.ts +67 -3
- package/build/src/debug.d.ts +1 -1
- package/build/src/define_config.d.ts +16 -1
- package/build/src/drivers/discord.d.ts +9 -0
- package/build/src/drivers/discord.js +13 -3
- package/build/src/drivers/facebook.d.ts +9 -0
- package/build/src/drivers/facebook.js +13 -3
- package/build/src/drivers/github.d.ts +12 -0
- package/build/src/drivers/github.js +17 -4
- package/build/src/drivers/google.d.ts +9 -0
- package/build/src/drivers/google.js +13 -3
- package/build/src/drivers/linked_in.d.ts +12 -0
- package/build/src/drivers/linked_in.js +16 -3
- package/build/src/drivers/linked_in_openid_connect.d.ts +14 -5
- package/build/src/drivers/linked_in_openid_connect.js +14 -5
- package/build/src/drivers/spotify.d.ts +11 -0
- package/build/src/drivers/spotify.js +15 -3
- package/build/src/drivers/twitter.d.ts +17 -0
- package/build/src/drivers/twitter.js +22 -3
- package/build/src/drivers/twitter_x.d.ts +137 -0
- package/build/src/drivers/twitter_x.js +169 -0
- package/build/src/errors.d.ts +29 -0
- package/build/src/redirect_request.d.ts +7 -0
- package/build/src/types.d.ts +150 -0
- package/package.json +27 -21
- package/build/chunk-MLKGABMK.js +0 -9
- package/build/chunk-SZ4YJCVU.js +0 -46
package/build/chunk-SZ4YJCVU.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// src/ally_manager.ts
|
|
2
|
-
import { RuntimeException } from "@adonisjs/core/exceptions";
|
|
3
|
-
var AllyManager = class {
|
|
4
|
-
/**
|
|
5
|
-
* @param config - Map of provider names to driver factory functions
|
|
6
|
-
* @param ctx - The current HTTP context
|
|
7
|
-
*/
|
|
8
|
-
constructor(config, ctx) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
this.#ctx = ctx;
|
|
11
|
-
}
|
|
12
|
-
#ctx;
|
|
13
|
-
#driversCache = /* @__PURE__ */ new Map();
|
|
14
|
-
/**
|
|
15
|
-
* Get a driver instance for the specified social provider. The driver
|
|
16
|
-
* instance is cached for the duration of the HTTP request.
|
|
17
|
-
*
|
|
18
|
-
* @param provider - The name of the social provider (e.g., 'github', 'google')
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* const github = ally.use('github')
|
|
23
|
-
* await github.redirect()
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
use(provider) {
|
|
27
|
-
if (this.#driversCache.has(provider)) {
|
|
28
|
-
return this.#driversCache.get(provider);
|
|
29
|
-
}
|
|
30
|
-
const driver = this.config[provider];
|
|
31
|
-
if (!driver) {
|
|
32
|
-
throw new RuntimeException(
|
|
33
|
-
`Unknown ally provider "${String(
|
|
34
|
-
provider
|
|
35
|
-
)}". Make sure it is registered inside the config/ally.ts file`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
const driverInstance = driver(this.#ctx);
|
|
39
|
-
this.#driversCache.set(provider, driverInstance);
|
|
40
|
-
return driverInstance;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
AllyManager
|
|
46
|
-
};
|