@shohaghinfo/aerojs 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/oauth/github-driver.d.ts +16 -0
- package/dist/auth/oauth/github-driver.d.ts.map +1 -0
- package/dist/auth/oauth/github-driver.js +79 -0
- package/dist/auth/oauth/github-driver.js.map +1 -0
- package/dist/auth/oauth/google-driver.d.ts +16 -0
- package/dist/auth/oauth/google-driver.d.ts.map +1 -0
- package/dist/auth/oauth/google-driver.js +63 -0
- package/dist/auth/oauth/google-driver.js.map +1 -0
- package/dist/auth/oauth/index.d.ts +9 -0
- package/dist/auth/oauth/index.d.ts.map +1 -0
- package/dist/auth/oauth/index.js +9 -0
- package/dist/auth/oauth/index.js.map +1 -0
- package/dist/auth/oauth/oauth-driver.d.ts +35 -0
- package/dist/auth/oauth/oauth-driver.d.ts.map +1 -0
- package/dist/auth/oauth/oauth-driver.js +6 -0
- package/dist/auth/oauth/oauth-driver.js.map +1 -0
- package/dist/auth/oauth/oauth-manager.d.ts +26 -0
- package/dist/auth/oauth/oauth-manager.d.ts.map +1 -0
- package/dist/auth/oauth/oauth-manager.js +86 -0
- package/dist/auth/oauth/oauth-manager.js.map +1 -0
- package/dist/cli/commands/make.d.ts +5 -0
- package/dist/cli/commands/make.d.ts.map +1 -1
- package/dist/cli/commands/make.js +119 -0
- package/dist/cli/commands/make.js.map +1 -1
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +56 -1
- package/dist/cli/runner.js.map +1 -1
- package/dist/core/application.d.ts +5 -0
- package/dist/core/application.d.ts.map +1 -1
- package/dist/core/application.js +12 -0
- package/dist/core/application.js.map +1 -1
- package/dist/core/context.d.ts +4 -0
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +8 -0
- package/dist/core/context.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/notifications/index.d.ts +7 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +7 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notification-manager.d.ts +39 -0
- package/dist/notifications/notification-manager.d.ts.map +1 -0
- package/dist/notifications/notification-manager.js +130 -0
- package/dist/notifications/notification-manager.js.map +1 -0
- package/dist/notifications/notification.d.ts +48 -0
- package/dist/notifications/notification.d.ts.map +1 -0
- package/dist/notifications/notification.js +9 -0
- package/dist/notifications/notification.js.map +1 -0
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/signed-url.d.ts +29 -0
- package/dist/security/signed-url.d.ts.map +1 -0
- package/dist/security/signed-url.js +86 -0
- package/dist/security/signed-url.js.map +1 -0
- package/dist/storage/drivers/local-driver.d.ts +1 -0
- package/dist/storage/drivers/local-driver.d.ts.map +1 -1
- package/dist/storage/drivers/local-driver.js +5 -0
- package/dist/storage/drivers/local-driver.js.map +1 -1
- package/dist/storage/drivers/memory-driver.d.ts +1 -0
- package/dist/storage/drivers/memory-driver.d.ts.map +1 -1
- package/dist/storage/drivers/memory-driver.js +5 -0
- package/dist/storage/drivers/memory-driver.js.map +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
32. [Distributed Redis Rate Limiter (`RedisRateLimitStore`)](#32-distributed-redis-rate-limiter-redisratelimitstore)
|
|
63
63
|
33. [Redis Queue Driver with DLQ (`RedisQueueDriver`)](#33-redis-queue-driver-with-dlq-redisqueuedriver)
|
|
64
64
|
34. [Fluent HTTP Client (`Http`, `HttpResponse`)](#34-fluent-http-client-http-httpresponse)
|
|
65
|
+
35. [OAuth 2.0 & Social Login (`OAuth`, Google, GitHub)](#35-oauth-20--social-login-oauth-google-github)
|
|
66
|
+
36. [Multi-Channel Notifications (`Notification`, `Notifications`)](#36-multi-channel-notifications-notification-notifications)
|
|
67
|
+
37. [Tamper-Proof Signed URLs (`UrlSigner`, `validateSignedUrl`)](#37-tamper-proof-signed-urls-urlsigner-validatesignedurl)
|
|
65
68
|
- [Performance, Size & Advantages](#-performance-size--advantages)
|
|
66
69
|
- [Comparison Matrix](#-comparison-matrix)
|
|
67
70
|
- [License](#-license)
|
|
@@ -1329,6 +1332,113 @@ Http.assertSent((req) => req.url.includes('/billing') && req.method === 'POST');
|
|
|
1329
1332
|
|
|
1330
1333
|
---
|
|
1331
1334
|
|
|
1335
|
+
### 35. OAuth 2.0 & Social Login (`OAuth`, Google, GitHub)
|
|
1336
|
+
|
|
1337
|
+
Authenticate users with Google, GitHub, or custom OAuth 2.0 identity providers without external libraries.
|
|
1338
|
+
|
|
1339
|
+
```typescript
|
|
1340
|
+
import { OAuth, router } from '@shohaghinfo/aerojs';
|
|
1341
|
+
|
|
1342
|
+
// 1. Configure Providers
|
|
1343
|
+
OAuth.configure({
|
|
1344
|
+
providers: {
|
|
1345
|
+
google: {
|
|
1346
|
+
clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
1347
|
+
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
1348
|
+
redirectUri: 'https://myapp.com/auth/google/callback',
|
|
1349
|
+
},
|
|
1350
|
+
github: {
|
|
1351
|
+
clientId: process.env.GITHUB_CLIENT_ID!,
|
|
1352
|
+
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
1353
|
+
redirectUri: 'https://myapp.com/auth/github/callback',
|
|
1354
|
+
},
|
|
1355
|
+
},
|
|
1356
|
+
});
|
|
1357
|
+
|
|
1358
|
+
// 2. Redirect to Provider
|
|
1359
|
+
router.get('/auth/google', (ctx) => {
|
|
1360
|
+
ctx.redirect(OAuth.driver('google').getRedirectUrl());
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
// 3. Handle Callback
|
|
1364
|
+
router.get('/auth/google/callback', async (ctx) => {
|
|
1365
|
+
const code = ctx.query.code as string;
|
|
1366
|
+
const { user, accessToken } = await OAuth.driver('google').handleCallback(code);
|
|
1367
|
+
|
|
1368
|
+
console.log('Logged in user:', user.name, user.email, user.avatarUrl);
|
|
1369
|
+
ctx.json({ success: true, user });
|
|
1370
|
+
});
|
|
1371
|
+
```
|
|
1372
|
+
|
|
1373
|
+
---
|
|
1374
|
+
|
|
1375
|
+
### 36. Multi-Channel Notifications (`Notification`, `Notifications`)
|
|
1376
|
+
|
|
1377
|
+
Deliver notifications simultaneously across multiple delivery channels (Email, Database, Realtime Broadcast, SMS) with unified syntax.
|
|
1378
|
+
|
|
1379
|
+
```typescript
|
|
1380
|
+
import { Notification, Notifications, MailMessage } from '@shohaghinfo/aerojs';
|
|
1381
|
+
|
|
1382
|
+
class OrderShippedNotification extends Notification {
|
|
1383
|
+
constructor(public order: any) {
|
|
1384
|
+
super();
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// Choose delivery channels
|
|
1388
|
+
public via(user: any): string[] {
|
|
1389
|
+
return ['mail', 'database', 'broadcast'];
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
public toMail(user: any): MailMessage {
|
|
1393
|
+
const msg = new MailMessage();
|
|
1394
|
+
return msg.subject(`Order #${this.order.id} Shipped`)
|
|
1395
|
+
.html(`<h1>Your package is on its way!</h1>`);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
public toDatabase(user: any) {
|
|
1399
|
+
return { orderId: this.order.id, trackingNumber: 'TRK-98124' };
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
public toBroadcast(user: any) {
|
|
1403
|
+
return {
|
|
1404
|
+
channel: `user.${user.id}`,
|
|
1405
|
+
event: 'OrderShipped',
|
|
1406
|
+
data: { orderId: this.order.id },
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// Dispatch to single user or array of users
|
|
1412
|
+
await Notifications.send(customer, new OrderShippedNotification(order));
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
---
|
|
1416
|
+
|
|
1417
|
+
### 37. Tamper-Proof Signed URLs (`UrlSigner`, `validateSignedUrl`)
|
|
1418
|
+
|
|
1419
|
+
Generate time-limited, cryptographically verified URLs for private downloads, password resets, or webhooks.
|
|
1420
|
+
|
|
1421
|
+
```typescript
|
|
1422
|
+
import { UrlSigner, validateSignedUrl, Storage, router } from '@shohaghinfo/aerojs';
|
|
1423
|
+
|
|
1424
|
+
// 1. Generate 15-minute temporary download link
|
|
1425
|
+
const downloadUrl = await Storage.temporaryUrl('invoices/inv-2026.pdf', 900);
|
|
1426
|
+
// Returns: /storage/invoices/inv-2026.pdf?expires=1790924000&signature=8f9a2...
|
|
1427
|
+
|
|
1428
|
+
// 2. Protect route with middleware
|
|
1429
|
+
router.get('/secure/download', validateSignedUrl(), async (ctx) => {
|
|
1430
|
+
ctx.json({ data: 'Confidential file contents' });
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
// 3. Or verify inline inside controller:
|
|
1434
|
+
if (!ctx.hasValidSignature()) {
|
|
1435
|
+
ctx.status(403).json({ error: 'Signature invalid or expired' });
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
---
|
|
1441
|
+
|
|
1332
1442
|
## 📊 Comparison Matrix
|
|
1333
1443
|
|
|
1334
1444
|
| Feature | Express | Koa | Fastify | AdonisJS | **AeroJS** |
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/auth/index.js
CHANGED
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file github-driver.ts
|
|
3
|
+
* @description GitHub OAuth 2.0 social login provider for AeroJS.
|
|
4
|
+
*/
|
|
5
|
+
import type { OAuthDriver, OAuthDriverConfig, OAuthUser, OAuthCallbackResult } from './oauth-driver.js';
|
|
6
|
+
export declare class GitHubOAuthDriver implements OAuthDriver {
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: OAuthDriverConfig);
|
|
9
|
+
getRedirectUrl(options?: {
|
|
10
|
+
state?: string;
|
|
11
|
+
scopes?: string[];
|
|
12
|
+
}): string;
|
|
13
|
+
getUserFromToken(accessToken: string): Promise<OAuthUser>;
|
|
14
|
+
handleCallback(code: string): Promise<OAuthCallbackResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=github-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-driver.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/github-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxG,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,iBAAiB;IAO9B,cAAc,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO,GAAG,MAAM;IAerE,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAkCzD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAsBxE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file github-driver.ts
|
|
3
|
+
* @description GitHub OAuth 2.0 social login provider for AeroJS.
|
|
4
|
+
*/
|
|
5
|
+
import { Http } from '../../http/http.js';
|
|
6
|
+
export class GitHubOAuthDriver {
|
|
7
|
+
config;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.config = {
|
|
10
|
+
scopes: ['read:user', 'user:email'],
|
|
11
|
+
...config,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getRedirectUrl(options = {}) {
|
|
15
|
+
const scopes = options.scopes || this.config.scopes || ['read:user', 'user:email'];
|
|
16
|
+
const params = new URLSearchParams({
|
|
17
|
+
client_id: this.config.clientId,
|
|
18
|
+
redirect_uri: this.config.redirectUri,
|
|
19
|
+
scope: scopes.join(' '),
|
|
20
|
+
});
|
|
21
|
+
if (options.state) {
|
|
22
|
+
params.set('state', options.state);
|
|
23
|
+
}
|
|
24
|
+
return `https://github.com/login/oauth/authorize?${params.toString()}`;
|
|
25
|
+
}
|
|
26
|
+
async getUserFromToken(accessToken) {
|
|
27
|
+
const res = await Http.withToken(accessToken)
|
|
28
|
+
.withHeaders({ 'User-Agent': 'AeroJS-OAuth' })
|
|
29
|
+
.get('https://api.github.com/user');
|
|
30
|
+
res.throw();
|
|
31
|
+
const data = res.json();
|
|
32
|
+
// If primary email is private in GitHub, fetch from /user/emails
|
|
33
|
+
let email = data.email || null;
|
|
34
|
+
if (!email) {
|
|
35
|
+
try {
|
|
36
|
+
const emailsRes = await Http.withToken(accessToken)
|
|
37
|
+
.withHeaders({ 'User-Agent': 'AeroJS-OAuth' })
|
|
38
|
+
.get('https://api.github.com/user/emails');
|
|
39
|
+
if (emailsRes.successful) {
|
|
40
|
+
const emails = emailsRes.json();
|
|
41
|
+
const primary = emails.find((e) => e.primary && e.verified) || emails[0];
|
|
42
|
+
if (primary)
|
|
43
|
+
email = primary.email;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Ignored
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
id: String(data.id),
|
|
52
|
+
email,
|
|
53
|
+
name: data.name || data.login || null,
|
|
54
|
+
avatarUrl: data.avatar_url || null,
|
|
55
|
+
raw: data,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async handleCallback(code) {
|
|
59
|
+
const res = await Http.acceptJson()
|
|
60
|
+
.withHeaders({ 'User-Agent': 'AeroJS-OAuth' })
|
|
61
|
+
.post('https://github.com/login/oauth/access_token', {
|
|
62
|
+
client_id: this.config.clientId,
|
|
63
|
+
client_secret: this.config.clientSecret,
|
|
64
|
+
code,
|
|
65
|
+
redirect_uri: this.config.redirectUri,
|
|
66
|
+
});
|
|
67
|
+
res.throw();
|
|
68
|
+
const tokenData = res.json();
|
|
69
|
+
const accessToken = tokenData.access_token;
|
|
70
|
+
const user = await this.getUserFromToken(accessToken);
|
|
71
|
+
return {
|
|
72
|
+
accessToken,
|
|
73
|
+
tokenType: tokenData.token_type,
|
|
74
|
+
scope: tokenData.scope,
|
|
75
|
+
user,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=github-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-driver.js","sourceRoot":"","sources":["../../../src/auth/oauth/github-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,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AC;QAC7B,MAAM,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAEtD,OAAO;YACL,WAAW;YACX,SAAS,EAAE,SAAS,CAAC,UAAU;YAC/B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,IAAI;SACL,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file google-driver.ts
|
|
3
|
+
* @description Google OAuth 2.0 social login provider for AeroJS.
|
|
4
|
+
*/
|
|
5
|
+
import type { OAuthDriver, OAuthDriverConfig, OAuthUser, OAuthCallbackResult } from './oauth-driver.js';
|
|
6
|
+
export declare class GoogleOAuthDriver implements OAuthDriver {
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config: OAuthDriverConfig);
|
|
9
|
+
getRedirectUrl(options?: {
|
|
10
|
+
state?: string;
|
|
11
|
+
scopes?: string[];
|
|
12
|
+
}): string;
|
|
13
|
+
getUserFromToken(accessToken: string): Promise<OAuthUser>;
|
|
14
|
+
handleCallback(code: string): Promise<OAuthCallbackResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=google-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-driver.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/google-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxG,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,iBAAiB;IAO9B,cAAc,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO,GAAG,MAAM;IAkBrE,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAczD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuBxE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file google-driver.ts
|
|
3
|
+
* @description Google OAuth 2.0 social login provider for AeroJS.
|
|
4
|
+
*/
|
|
5
|
+
import { Http } from '../../http/http.js';
|
|
6
|
+
export class GoogleOAuthDriver {
|
|
7
|
+
config;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.config = {
|
|
10
|
+
scopes: ['openid', 'email', 'profile'],
|
|
11
|
+
...config,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getRedirectUrl(options = {}) {
|
|
15
|
+
const scopes = options.scopes || this.config.scopes || ['openid', 'email', 'profile'];
|
|
16
|
+
const params = new URLSearchParams({
|
|
17
|
+
client_id: this.config.clientId,
|
|
18
|
+
redirect_uri: this.config.redirectUri,
|
|
19
|
+
response_type: 'code',
|
|
20
|
+
scope: scopes.join(' '),
|
|
21
|
+
access_type: 'offline',
|
|
22
|
+
prompt: 'consent',
|
|
23
|
+
});
|
|
24
|
+
if (options.state) {
|
|
25
|
+
params.set('state', options.state);
|
|
26
|
+
}
|
|
27
|
+
return `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;
|
|
28
|
+
}
|
|
29
|
+
async getUserFromToken(accessToken) {
|
|
30
|
+
const res = await Http.withToken(accessToken).get('https://www.googleapis.com/oauth2/v3/userinfo');
|
|
31
|
+
res.throw();
|
|
32
|
+
const data = res.json();
|
|
33
|
+
return {
|
|
34
|
+
id: String(data.sub || data.id),
|
|
35
|
+
email: data.email || null,
|
|
36
|
+
name: data.name || null,
|
|
37
|
+
avatarUrl: data.picture || null,
|
|
38
|
+
raw: data,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async handleCallback(code) {
|
|
42
|
+
const res = await Http.asForm().post('https://oauth2.googleapis.com/token', {
|
|
43
|
+
client_id: this.config.clientId,
|
|
44
|
+
client_secret: this.config.clientSecret,
|
|
45
|
+
code,
|
|
46
|
+
grant_type: 'authorization_code',
|
|
47
|
+
redirect_uri: this.config.redirectUri,
|
|
48
|
+
});
|
|
49
|
+
res.throw();
|
|
50
|
+
const tokenData = res.json();
|
|
51
|
+
const accessToken = tokenData.access_token;
|
|
52
|
+
const user = await this.getUserFromToken(accessToken);
|
|
53
|
+
return {
|
|
54
|
+
accessToken,
|
|
55
|
+
tokenType: tokenData.token_type,
|
|
56
|
+
expiresIn: tokenData.expires_in,
|
|
57
|
+
refreshToken: tokenData.refresh_token,
|
|
58
|
+
scope: tokenData.scope,
|
|
59
|
+
user,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=google-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-driver.js","sourceRoot":"","sources":["../../../src/auth/oauth/google-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAoB;IAElC,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;YACtC,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAEM,cAAc,CAAC,UAAiD,EAAE;QACvE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACtF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,YAAY,EAAE,IAAI,CAAC,M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,CAAC;QAEZ,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAEtD,OAAO;YACL,WAAW;YACX,SAAS,EAAE,SAAS,CAAC,UAAU;YAC/B,SAAS,EAAE,SAAS,CAAC,UAAU;YAC/B,YAAY,EAAE,SAAS,CAAC,aAAa;YACrC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,IAAI;SACL,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description AeroJS Social Authentication & OAuth 2.0 Module.
|
|
4
|
+
*/
|
|
5
|
+
export * from './oauth-driver.js';
|
|
6
|
+
export * from './google-driver.js';
|
|
7
|
+
export * from './github-driver.js';
|
|
8
|
+
export * from './oauth-manager.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description AeroJS Social Authentication & OAuth 2.0 Module.
|
|
4
|
+
*/
|
|
5
|
+
export * from './oauth-driver.js';
|
|
6
|
+
export * from './google-driver.js';
|
|
7
|
+
export * from './github-driver.js';
|
|
8
|
+
export * from './oauth-manager.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/oauth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file oauth-driver.ts
|
|
3
|
+
* @description Standard contracts and models for OAuth 2.0 social login in AeroJS.
|
|
4
|
+
*/
|
|
5
|
+
export interface OAuthUser {
|
|
6
|
+
id: string;
|
|
7
|
+
email: string | null;
|
|
8
|
+
name: string | null;
|
|
9
|
+
avatarUrl: string | null;
|
|
10
|
+
raw: any;
|
|
11
|
+
}
|
|
12
|
+
export interface OAuthCallbackResult {
|
|
13
|
+
accessToken: string;
|
|
14
|
+
tokenType?: string;
|
|
15
|
+
expiresIn?: number;
|
|
16
|
+
refreshToken?: string;
|
|
17
|
+
scope?: string;
|
|
18
|
+
user: OAuthUser;
|
|
19
|
+
}
|
|
20
|
+
export interface OAuthDriverConfig {
|
|
21
|
+
clientId: string;
|
|
22
|
+
clientSecret: string;
|
|
23
|
+
redirectUri: string;
|
|
24
|
+
scopes?: string[];
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface OAuthDriver {
|
|
28
|
+
getRedirectUrl(options?: {
|
|
29
|
+
state?: string;
|
|
30
|
+
scopes?: string[];
|
|
31
|
+
}): string;
|
|
32
|
+
getUserFromToken(accessToken: string): Promise<OAuthUser>;
|
|
33
|
+
handleCallback(code: string, state?: string): Promise<OAuthCallbackResult>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=oauth-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-driver.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/oauth-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,EAAE,GAAG,CAAC;CACV;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC;IACxE,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1D,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-driver.js","sourceRoot":"","sources":["../../../src/auth/oauth/oauth-driver.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file oauth-manager.ts
|
|
3
|
+
* @description Central OAuth 2.0 social login manager for AeroJS.
|
|
4
|
+
* Manages OAuth providers (Google, GitHub, custom) with easy redirection and callback handling.
|
|
5
|
+
*/
|
|
6
|
+
import type { OAuthDriver, OAuthDriverConfig, OAuthUser } from './oauth-driver.js';
|
|
7
|
+
export interface OAuthConfig {
|
|
8
|
+
providers?: Record<string, OAuthDriverConfig>;
|
|
9
|
+
}
|
|
10
|
+
export declare class OAuthManager {
|
|
11
|
+
private configs;
|
|
12
|
+
private drivers;
|
|
13
|
+
private customFactories;
|
|
14
|
+
private fakedUser?;
|
|
15
|
+
constructor(config?: OAuthConfig);
|
|
16
|
+
configure(config: OAuthConfig): this;
|
|
17
|
+
extend(providerName: string, factory: (config: OAuthDriverConfig) => OAuthDriver): this;
|
|
18
|
+
driver(provider: 'google' | 'github' | string): OAuthDriver;
|
|
19
|
+
/**
|
|
20
|
+
* Fakes OAuth authentication for test environments.
|
|
21
|
+
*/
|
|
22
|
+
fake(user?: Partial<OAuthUser>): OAuthUser;
|
|
23
|
+
restore(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const OAuth: OAuthManager;
|
|
26
|
+
//# sourceMappingURL=oauth-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-manager.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/oauth-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAuB,MAAM,mBAAmB,CAAC;AAIxG,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC/C;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,eAAe,CAAiE;IACxF,OAAO,CAAC,SAAS,CAAC,CAAY;gBAElB,MAAM,GAAE,WAAgB;IAI7B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IASpC,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,WAAW,GAAG,IAAI;IAKvF,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW;IA8ClE;;OAEG;IACI,IAAI,CAAC,IAAI,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,SAAS;IAW9C,OAAO,IAAI,IAAI;CAGvB;AAED,eAAO,MAAM,KAAK,cAAqB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file oauth-manager.ts
|
|
3
|
+
* @description Central OAuth 2.0 social login manager for AeroJS.
|
|
4
|
+
* Manages OAuth providers (Google, GitHub, custom) with easy redirection and callback handling.
|
|
5
|
+
*/
|
|
6
|
+
import { GoogleOAuthDriver } from './google-driver.js';
|
|
7
|
+
import { GitHubOAuthDriver } from './github-driver.js';
|
|
8
|
+
export class OAuthManager {
|
|
9
|
+
configs = new Map();
|
|
10
|
+
drivers = new Map();
|
|
11
|
+
customFactories = new Map();
|
|
12
|
+
fakedUser;
|
|
13
|
+
constructor(config = {}) {
|
|
14
|
+
this.configure(config);
|
|
15
|
+
}
|
|
16
|
+
configure(config) {
|
|
17
|
+
if (config.providers) {
|
|
18
|
+
for (const [name, cfg] of Object.entries(config.providers)) {
|
|
19
|
+
this.configs.set(name.toLowerCase(), cfg);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
extend(providerName, factory) {
|
|
25
|
+
this.customFactories.set(providerName.toLowerCase(), factory);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
driver(provider) {
|
|
29
|
+
const name = provider.toLowerCase();
|
|
30
|
+
if (this.fakedUser) {
|
|
31
|
+
const mockUser = this.fakedUser;
|
|
32
|
+
return {
|
|
33
|
+
getRedirectUrl: () => `https://mock-oauth.com/${name}/auth`,
|
|
34
|
+
getUserFromToken: async () => mockUser,
|
|
35
|
+
handleCallback: async () => ({
|
|
36
|
+
accessToken: 'mock_access_token_123',
|
|
37
|
+
user: mockUser,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (this.drivers.has(name)) {
|
|
42
|
+
return this.drivers.get(name);
|
|
43
|
+
}
|
|
44
|
+
const cfg = this.configs.get(name) || {
|
|
45
|
+
clientId: process.env[`${name.toUpperCase()}_CLIENT_ID`] || '',
|
|
46
|
+
clientSecret: process.env[`${name.toUpperCase()}_CLIENT_SECRET`] || '',
|
|
47
|
+
redirectUri: process.env[`${name.toUpperCase()}_REDIRECT_URI`] || '',
|
|
48
|
+
};
|
|
49
|
+
let driverInstance;
|
|
50
|
+
if (this.customFactories.has(name)) {
|
|
51
|
+
driverInstance = this.customFactories.get(name)(cfg);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
switch (name) {
|
|
55
|
+
case 'google':
|
|
56
|
+
driverInstance = new GoogleOAuthDriver(cfg);
|
|
57
|
+
break;
|
|
58
|
+
case 'github':
|
|
59
|
+
driverInstance = new GitHubOAuthDriver(cfg);
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
throw new Error(`Unsupported OAuth provider: "${provider}". Register custom driver with OAuth.extend()`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.drivers.set(name, driverInstance);
|
|
66
|
+
return driverInstance;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fakes OAuth authentication for test environments.
|
|
70
|
+
*/
|
|
71
|
+
fake(user = {}) {
|
|
72
|
+
this.fakedUser = {
|
|
73
|
+
id: user.id || 'faked-oauth-user-id',
|
|
74
|
+
email: user.email || 'faked@example.com',
|
|
75
|
+
name: user.name || 'Faked OAuth User',
|
|
76
|
+
avatarUrl: user.avatarUrl || 'https://example.com/avatar.png',
|
|
77
|
+
raw: user.raw || {},
|
|
78
|
+
};
|
|
79
|
+
return this.fakedUser;
|
|
80
|
+
}
|
|
81
|
+
restore() {
|
|
82
|
+
this.fakedUser = undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const OAuth = new OAuthManager();
|
|
86
|
+
//# sourceMappingURL=oauth-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-manager.js","sourceRoot":"","sources":["../../../src/auth/oauth/oauth-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAMvD,MAAM,OAAO,YAAY;IACf,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC/C,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IACzC,eAAe,GAAG,IAAI,GAAG,EAAsD,CAAC;IAChF,SAAS,CAAa;IAE9B,YAAY,SAAsB,EAAE;QAClC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAEM,SAAS,CAAC,MAAmB;QAClC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,YAAoB,EAAE,OAAmD;QACrF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,QAAsC;QAClD,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CA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AAK,QAAQ;oBACX,cAAc,GAAG,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;oBAC5C,MAAM;gBACR;oBACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,+CAA+C,CAAC,CAAC;YAC7G,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACvC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,OAA2B,EAAE;QACvC,IAAI,CAAC,SAAS,GAAG;YACf,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,qBAAqB;YACpC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,mBAAmB;YACxC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,kBAAkB;YACrC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,gCAAgC;YAC7D,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -13,4 +13,9 @@ export declare function makeModel(name: string, options?: {
|
|
|
13
13
|
export declare function makeMigration(name: string, targetDir?: string): string;
|
|
14
14
|
export declare function makeSeeder(name: string, targetDir?: string): string;
|
|
15
15
|
export declare function makeMiddleware(name: string, targetDir?: string): string;
|
|
16
|
+
export declare function makeJob(name: string, targetDir?: string): string;
|
|
17
|
+
export declare function makeMail(name: string, targetDir?: string): string;
|
|
18
|
+
export declare function makePolicy(name: string, targetDir?: string): string;
|
|
19
|
+
export declare function makeEvent(name: string, targetDir?: string): string;
|
|
20
|
+
export declare function makeListener(name: string, targetDir?: string): string;
|
|
16
21
|
//# sourceMappingURL=make.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/make.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAoB,GAAG,MAAM,CA6DlF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CA4BhJ;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAwB,GAAG,MAAM,CA8BrF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,MAAM,CAuB/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAmB,GAAG,MAAM,CAoBjF"}
|
|
1
|
+
{"version":3,"file":"make.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/make.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAoB,GAAG,MAAM,CA6DlF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CA4BhJ;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAwB,GAAG,MAAM,CA8BrF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,M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