ngx-better-auth 0.11.0 → 1.6.1
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 +102 -2
- package/fesm2022/ngx-better-auth.mjs +109 -59
- package/fesm2022/ngx-better-auth.mjs.map +1 -1
- package/index.d.ts +63 -2179
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
8
8
|

|
|
9
9
|
|
|
10
10
|

|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -16,7 +16,8 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
16
16
|
|
|
17
17
|
| ngx-better-auth | Angular | Better Auth |
|
|
18
18
|
|-----------------|---------|-------------|
|
|
19
|
-
| `
|
|
19
|
+
| `1.6.x` | `>=20` | `>=1.6.10 <1.7.0` |
|
|
20
|
+
| `0.11.x` | `>=20` | `>=1.3.7` |
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -26,6 +27,12 @@ An **Angular 20+ wrapper for [Better Auth](https://github.com/better-auth/better
|
|
|
26
27
|
npm install ngx-better-auth better-auth
|
|
27
28
|
```
|
|
28
29
|
|
|
30
|
+
If you use Passkey, install the split Better Auth Passkey package too:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @better-auth/passkey
|
|
34
|
+
```
|
|
35
|
+
|
|
29
36
|
---
|
|
30
37
|
|
|
31
38
|
## ⚙️ Setup Provider
|
|
@@ -37,6 +44,7 @@ import { ApplicationConfig } from '@angular/core'
|
|
|
37
44
|
import { provideBetterAuth } from 'ngx-better-auth'
|
|
38
45
|
import { environment } from './environments/environment'
|
|
39
46
|
import { adminClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins'
|
|
47
|
+
import { passkeyClient } from '@better-auth/passkey/client'
|
|
40
48
|
|
|
41
49
|
export const appConfig: ApplicationConfig = {
|
|
42
50
|
providers: [
|
|
@@ -60,6 +68,7 @@ export const appConfig: ApplicationConfig = {
|
|
|
60
68
|
user,
|
|
61
69
|
},
|
|
62
70
|
}),
|
|
71
|
+
passkeyClient(),
|
|
63
72
|
siweClient(),
|
|
64
73
|
],
|
|
65
74
|
})
|
|
@@ -69,6 +78,22 @@ export const appConfig: ApplicationConfig = {
|
|
|
69
78
|
|
|
70
79
|
## 🧩 Different services
|
|
71
80
|
|
|
81
|
+
### Migrating to 1.6.x
|
|
82
|
+
|
|
83
|
+
`ngx-better-auth 1.6.x` targets Better Auth `>=1.6.10 <1.7.0`.
|
|
84
|
+
|
|
85
|
+
If you use Passkey, install the split package and update imports:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pnpm add @better-auth/passkey
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { passkeyClient } from '@better-auth/passkey/client'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
SIWE users can keep using `SiweService.getNonce(...)`; internally it now maps to Better Auth's `siwe.getNonce` endpoint introduced in `1.6.10`.
|
|
96
|
+
|
|
72
97
|
You can inject different services depending on your needs.
|
|
73
98
|
**AuthService** provides the core Better Auth client methods (signIn, signOut, signUp, e.g.).
|
|
74
99
|
The full list of methods is available at the end of this README.
|
|
@@ -135,6 +160,81 @@ export class MyComponent {
|
|
|
135
160
|
}
|
|
136
161
|
```
|
|
137
162
|
|
|
163
|
+
## ⚡ Signal resources for reads
|
|
164
|
+
|
|
165
|
+
GET/list-style methods keep their existing `Observable` API and also expose Angular `resource` factories for zoneless-friendly templates.
|
|
166
|
+
|
|
167
|
+
Mutations such as sign in, sign out, update, delete, revoke, invite, and verify still use `Observable` because they are command workflows.
|
|
168
|
+
|
|
169
|
+
### Available resource factories
|
|
170
|
+
|
|
171
|
+
- `SessionService.sessionsResource()`
|
|
172
|
+
- `AccountService.accountsResource()`
|
|
173
|
+
- `PasskeyService.userPasskeysResource()`
|
|
174
|
+
- `OrganizationService.organizationsResource()`
|
|
175
|
+
- `OrganizationService.fullOrganizationResource(() => params)`
|
|
176
|
+
- `OrganizationService.invitationResource(() => params)`
|
|
177
|
+
- `OrganizationService.invitationsResource(() => params)`
|
|
178
|
+
- `OrganizationService.userInvitationsResource()`
|
|
179
|
+
- `OrganizationService.activeMemberResource()`
|
|
180
|
+
- `AdminService.usersResource(() => params)`
|
|
181
|
+
- `AdminService.userSessionsResource(() => params)`
|
|
182
|
+
|
|
183
|
+
### Simple read resource
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
import { Component, inject } from '@angular/core'
|
|
187
|
+
import { SessionService } from 'ngx-better-auth'
|
|
188
|
+
|
|
189
|
+
@Component({
|
|
190
|
+
// ...
|
|
191
|
+
})
|
|
192
|
+
export class SessionsComponent {
|
|
193
|
+
private readonly sessionService = inject(SessionService)
|
|
194
|
+
|
|
195
|
+
readonly sessions = this.sessionService.sessionsResource()
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```html
|
|
200
|
+
@if (sessions.isLoading()) {
|
|
201
|
+
<p>Loading sessions...</p>
|
|
202
|
+
} @else if (sessions.error()) {
|
|
203
|
+
<p>Unable to load sessions.</p>
|
|
204
|
+
} @else {
|
|
205
|
+
@for (session of sessions.value() ?? []; track session.token) {
|
|
206
|
+
<p>{{ session.ipAddress }}</p>
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Parameterized read resource
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
import { Component, inject, signal } from '@angular/core'
|
|
215
|
+
import { OrganizationService } from 'ngx-better-auth'
|
|
216
|
+
|
|
217
|
+
@Component({
|
|
218
|
+
// ...
|
|
219
|
+
})
|
|
220
|
+
export class OrganizationComponent {
|
|
221
|
+
private readonly organizationService = inject(OrganizationService)
|
|
222
|
+
|
|
223
|
+
readonly organizationId = signal<string | undefined>(undefined)
|
|
224
|
+
|
|
225
|
+
readonly organization = this.organizationService.fullOrganizationResource(() => ({
|
|
226
|
+
organizationId: this.organizationId(),
|
|
227
|
+
membersLimit: 20,
|
|
228
|
+
}))
|
|
229
|
+
|
|
230
|
+
selectOrganization(organizationId: string) {
|
|
231
|
+
this.organizationId.set(organizationId)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Call `resource.reload()` after a mutation when you need to refresh a read resource manually.
|
|
237
|
+
|
|
138
238
|
## 🛡️ Guards
|
|
139
239
|
This library ships with guards to quickly set up route protection.
|
|
140
240
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, signal, computed, InjectionToken, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { inject, Injector, resource, Injectable, signal, computed, InjectionToken, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { defer, map, Observable, filter, shareReplay, switchMap, first, of, timer, catchError } from 'rxjs';
|
|
4
4
|
import { createAuthClient } from 'better-auth/client';
|
|
5
5
|
import { HttpClient } from '@angular/common/http';
|
|
6
6
|
import { Router } from '@angular/router';
|
|
7
7
|
|
|
8
8
|
class MainService {
|
|
9
9
|
config = inject(BETTER_AUTH_CONFIG_TOKEN);
|
|
10
|
+
injector = inject(Injector);
|
|
10
11
|
authClient = createAuthClient({
|
|
11
12
|
...this.config,
|
|
12
13
|
});
|
|
@@ -17,10 +18,26 @@ class MainService {
|
|
|
17
18
|
}
|
|
18
19
|
return data.data;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
read(loader) {
|
|
22
|
+
return defer(loader).pipe(map((data) => this.mapData(data)));
|
|
23
|
+
}
|
|
24
|
+
readResource(loader) {
|
|
25
|
+
return resource({
|
|
26
|
+
injector: this.injector,
|
|
27
|
+
loader: async () => this.mapData(await loader()),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
readResourceWithParams(params, loader) {
|
|
31
|
+
return resource({
|
|
32
|
+
injector: this.injector,
|
|
33
|
+
params,
|
|
34
|
+
loader: async ({ params }) => this.mapData(await loader(params)),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, providedIn: 'root' });
|
|
22
39
|
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MainService, decorators: [{
|
|
24
41
|
type: Injectable,
|
|
25
42
|
args: [{
|
|
26
43
|
providedIn: 'root',
|
|
@@ -81,7 +98,7 @@ class AuthService {
|
|
|
81
98
|
});
|
|
82
99
|
}
|
|
83
100
|
signInEmail(data) {
|
|
84
|
-
return defer(() => this.client.signIn.email(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
101
|
+
return defer(() => this.client.signIn.email(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
85
102
|
}
|
|
86
103
|
/**
|
|
87
104
|
* Sign up a new user using email and password.
|
|
@@ -90,16 +107,16 @@ class AuthService {
|
|
|
90
107
|
* @param data
|
|
91
108
|
*/
|
|
92
109
|
signUpEmail(data) {
|
|
93
|
-
return defer(() => this.client.signUp.email(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
110
|
+
return defer(() => this.client.signUp.email(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
94
111
|
}
|
|
95
112
|
signInProvider(data) {
|
|
96
113
|
return defer(() => this.client.signIn.social({
|
|
97
114
|
callbackURL: window.location.origin,
|
|
98
115
|
...data,
|
|
99
|
-
})).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
116
|
+
})).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s !== null))));
|
|
100
117
|
}
|
|
101
118
|
signOut() {
|
|
102
|
-
return defer(() => this.client.signOut()).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s === null))));
|
|
119
|
+
return defer(() => this.client.signOut()).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s === null))));
|
|
103
120
|
}
|
|
104
121
|
sendVerificationEmail(data) {
|
|
105
122
|
return defer(() => this.client.sendVerificationEmail(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -120,12 +137,12 @@ class AuthService {
|
|
|
120
137
|
return defer(() => this.client.updateUser(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
121
138
|
}
|
|
122
139
|
deleteUser(data) {
|
|
123
|
-
return defer(() => this.client.deleteUser(data)).pipe(switchMap(() => this.sessionState$.pipe(filter((s) => s === null))), first());
|
|
140
|
+
return defer(() => this.client.deleteUser(data)).pipe(map((data) => this.mainService.mapData(data)), switchMap(() => this.sessionState$.pipe(filter((s) => s === null))), first());
|
|
124
141
|
}
|
|
125
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
126
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
143
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
127
144
|
}
|
|
128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AuthService, decorators: [{
|
|
129
146
|
type: Injectable,
|
|
130
147
|
args: [{
|
|
131
148
|
providedIn: 'root',
|
|
@@ -136,7 +153,10 @@ class SessionService {
|
|
|
136
153
|
mainService = inject(MainService);
|
|
137
154
|
client = this.mainService.authClient;
|
|
138
155
|
listSessions() {
|
|
139
|
-
return
|
|
156
|
+
return this.mainService.read(() => this.client.listSessions());
|
|
157
|
+
}
|
|
158
|
+
sessionsResource() {
|
|
159
|
+
return this.mainService.readResource(() => this.client.listSessions());
|
|
140
160
|
}
|
|
141
161
|
revokeSession(data) {
|
|
142
162
|
return defer(() => this.client.revokeSession(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -147,10 +167,10 @@ class SessionService {
|
|
|
147
167
|
revokeAllSessions() {
|
|
148
168
|
return defer(() => this.client.revokeSessions()).pipe(map((data) => this.mainService.mapData(data)));
|
|
149
169
|
}
|
|
150
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
151
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
171
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, providedIn: 'root' });
|
|
152
172
|
}
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SessionService, decorators: [{
|
|
154
174
|
type: Injectable,
|
|
155
175
|
args: [{ providedIn: 'root' }]
|
|
156
176
|
}] });
|
|
@@ -159,7 +179,10 @@ class AccountService {
|
|
|
159
179
|
mainService = inject(MainService);
|
|
160
180
|
client = this.mainService.authClient;
|
|
161
181
|
listAccounts() {
|
|
162
|
-
return
|
|
182
|
+
return this.mainService.read(() => this.client.listAccounts());
|
|
183
|
+
}
|
|
184
|
+
accountsResource() {
|
|
185
|
+
return this.mainService.readResource(() => this.client.listAccounts());
|
|
163
186
|
}
|
|
164
187
|
linkSocial(data) {
|
|
165
188
|
return defer(() => this.client.linkSocial(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -167,10 +190,10 @@ class AccountService {
|
|
|
167
190
|
unlinkAccount(data) {
|
|
168
191
|
return defer(() => this.client.unlinkAccount(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
169
192
|
}
|
|
170
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
171
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
193
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
194
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, providedIn: 'root' });
|
|
172
195
|
}
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AccountService, decorators: [{
|
|
174
197
|
type: Injectable,
|
|
175
198
|
args: [{ providedIn: 'root' }]
|
|
176
199
|
}] });
|
|
@@ -217,10 +240,10 @@ class TwoFactorService {
|
|
|
217
240
|
verifyBackupCode(data) {
|
|
218
241
|
return defer(() => this.twoFactor.verifyBackupCode(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
219
242
|
}
|
|
220
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
221
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
243
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
244
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, providedIn: 'root' });
|
|
222
245
|
}
|
|
223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: TwoFactorService, decorators: [{
|
|
224
247
|
type: Injectable,
|
|
225
248
|
args: [{ providedIn: 'root' }]
|
|
226
249
|
}], ctorParameters: () => [] });
|
|
@@ -240,7 +263,10 @@ class PasskeyService {
|
|
|
240
263
|
return defer(() => this.mainService.authClient.signIn.passkey(data));
|
|
241
264
|
}
|
|
242
265
|
listUserPasskeys() {
|
|
243
|
-
return
|
|
266
|
+
return this.mainService.read(() => this.passkey.listUserPasskeys());
|
|
267
|
+
}
|
|
268
|
+
userPasskeysResource() {
|
|
269
|
+
return this.mainService.readResource(() => this.passkey.listUserPasskeys());
|
|
244
270
|
}
|
|
245
271
|
deletePasskey(data) {
|
|
246
272
|
return defer(() => this.passkey.deletePasskey(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -248,10 +274,10 @@ class PasskeyService {
|
|
|
248
274
|
updatePasskey(data) {
|
|
249
275
|
return defer(() => this.passkey.updatePasskey(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
250
276
|
}
|
|
251
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
252
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
278
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, providedIn: 'root' });
|
|
253
279
|
}
|
|
254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PasskeyService, decorators: [{
|
|
255
281
|
type: Injectable,
|
|
256
282
|
args: [{ providedIn: 'root' }]
|
|
257
283
|
}], ctorParameters: () => [] });
|
|
@@ -271,10 +297,10 @@ class GenericOauthService {
|
|
|
271
297
|
link(data) {
|
|
272
298
|
return defer(() => this.oauth.link(data));
|
|
273
299
|
}
|
|
274
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
275
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
300
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
301
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, providedIn: 'root' });
|
|
276
302
|
}
|
|
277
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GenericOauthService, decorators: [{
|
|
278
304
|
type: Injectable,
|
|
279
305
|
args: [{ providedIn: 'root' }]
|
|
280
306
|
}], ctorParameters: () => [] });
|
|
@@ -303,10 +329,10 @@ class EmailOtpService {
|
|
|
303
329
|
resetPassword(data) {
|
|
304
330
|
return defer(() => this.emailOtp.resetPassword(data));
|
|
305
331
|
}
|
|
306
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
307
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
332
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
333
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, providedIn: 'root' });
|
|
308
334
|
}
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EmailOtpService, decorators: [{
|
|
310
336
|
type: Injectable,
|
|
311
337
|
args: [{ providedIn: 'root' }]
|
|
312
338
|
}], ctorParameters: () => [] });
|
|
@@ -322,10 +348,10 @@ class OneTapService {
|
|
|
322
348
|
signIn(data) {
|
|
323
349
|
return defer(() => this.oneTap(data));
|
|
324
350
|
}
|
|
325
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
326
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
352
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, providedIn: 'root' });
|
|
327
353
|
}
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OneTapService, decorators: [{
|
|
329
355
|
type: Injectable,
|
|
330
356
|
args: [{ providedIn: 'root' }]
|
|
331
357
|
}], ctorParameters: () => [] });
|
|
@@ -344,10 +370,10 @@ class MagicLinkService {
|
|
|
344
370
|
verify(data) {
|
|
345
371
|
return defer(() => this.magicLink.verify(data));
|
|
346
372
|
}
|
|
347
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
348
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
373
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
374
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, providedIn: 'root' });
|
|
349
375
|
}
|
|
350
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MagicLinkService, decorators: [{
|
|
351
377
|
type: Injectable,
|
|
352
378
|
args: [{ providedIn: 'root' }]
|
|
353
379
|
}], ctorParameters: () => [] });
|
|
@@ -382,10 +408,10 @@ class UsernameService {
|
|
|
382
408
|
.post(`${this.mainService.url}/is-username-available`, data)
|
|
383
409
|
.pipe(map((res) => res.available));
|
|
384
410
|
}
|
|
385
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
386
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
411
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
412
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, providedIn: 'root' });
|
|
387
413
|
}
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: UsernameService, decorators: [{
|
|
389
415
|
type: Injectable,
|
|
390
416
|
args: [{ providedIn: 'root' }]
|
|
391
417
|
}] });
|
|
@@ -408,10 +434,16 @@ class AdminService {
|
|
|
408
434
|
return defer(() => this.admin.updateUser(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
409
435
|
}
|
|
410
436
|
listUsers(data) {
|
|
411
|
-
return
|
|
437
|
+
return this.mainService.read(() => this.admin.listUsers(data));
|
|
438
|
+
}
|
|
439
|
+
usersResource(params) {
|
|
440
|
+
return this.mainService.readResourceWithParams(params, (data) => this.admin.listUsers(data));
|
|
412
441
|
}
|
|
413
442
|
listUserSessions(data) {
|
|
414
|
-
return
|
|
443
|
+
return this.mainService.read(() => this.admin.listUserSessions(data));
|
|
444
|
+
}
|
|
445
|
+
userSessionsResource(params) {
|
|
446
|
+
return this.mainService.readResourceWithParams(params, (data) => this.admin.listUserSessions(data));
|
|
415
447
|
}
|
|
416
448
|
unbanUser(data) {
|
|
417
449
|
return defer(() => this.admin.unbanUser(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -443,10 +475,10 @@ class AdminService {
|
|
|
443
475
|
checkRolePermission(data) {
|
|
444
476
|
return defer(() => this.admin.checkRolePermission(data));
|
|
445
477
|
}
|
|
446
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
447
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
478
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
479
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, providedIn: 'root' });
|
|
448
480
|
}
|
|
449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: AdminService, decorators: [{
|
|
450
482
|
type: Injectable,
|
|
451
483
|
args: [{ providedIn: 'root' }]
|
|
452
484
|
}], ctorParameters: () => [] });
|
|
@@ -466,7 +498,10 @@ class OrganizationService {
|
|
|
466
498
|
return defer(() => this.organization.checkSlug(data));
|
|
467
499
|
}
|
|
468
500
|
list() {
|
|
469
|
-
return
|
|
501
|
+
return this.mainService.read(() => this.organization.list());
|
|
502
|
+
}
|
|
503
|
+
organizationsResource() {
|
|
504
|
+
return this.mainService.readResource(() => this.organization.list());
|
|
470
505
|
}
|
|
471
506
|
setActive(data) {
|
|
472
507
|
return defer(() => this.organization.setActive(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -474,6 +509,9 @@ class OrganizationService {
|
|
|
474
509
|
getFullOrganization(data) {
|
|
475
510
|
return defer(() => this.organization.getFullOrganization(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
476
511
|
}
|
|
512
|
+
fullOrganizationResource(params) {
|
|
513
|
+
return this.mainService.readResourceWithParams(params, (data) => this.organization.getFullOrganization(data));
|
|
514
|
+
}
|
|
477
515
|
update(data) {
|
|
478
516
|
return defer(() => this.organization.update(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
479
517
|
}
|
|
@@ -495,11 +533,20 @@ class OrganizationService {
|
|
|
495
533
|
getInvitation(data) {
|
|
496
534
|
return defer(() => this.organization.getInvitation(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
497
535
|
}
|
|
536
|
+
invitationResource(params) {
|
|
537
|
+
return this.mainService.readResourceWithParams(params, (data) => this.organization.getInvitation(data));
|
|
538
|
+
}
|
|
498
539
|
listInvitations(data) {
|
|
499
|
-
return
|
|
540
|
+
return this.mainService.read(() => this.organization.listInvitations(data));
|
|
541
|
+
}
|
|
542
|
+
invitationsResource(params) {
|
|
543
|
+
return this.mainService.readResourceWithParams(params, (data) => this.organization.listInvitations(data));
|
|
500
544
|
}
|
|
501
545
|
listUserInvitations() {
|
|
502
|
-
return
|
|
546
|
+
return this.mainService.read(() => this.organization.listUserInvitations());
|
|
547
|
+
}
|
|
548
|
+
userInvitationsResource() {
|
|
549
|
+
return this.mainService.readResource(() => this.organization.listUserInvitations());
|
|
503
550
|
}
|
|
504
551
|
listMembers(data = {}) {
|
|
505
552
|
return defer(() => this.organization.listMembers(data));
|
|
@@ -511,7 +558,10 @@ class OrganizationService {
|
|
|
511
558
|
return defer(() => this.organization.updateMemberRoles(data));
|
|
512
559
|
}
|
|
513
560
|
getActiveMember() {
|
|
514
|
-
return
|
|
561
|
+
return this.mainService.read(() => this.organization.getActiveMember());
|
|
562
|
+
}
|
|
563
|
+
activeMemberResource() {
|
|
564
|
+
return this.mainService.readResource(() => this.organization.getActiveMember());
|
|
515
565
|
}
|
|
516
566
|
leave(data) {
|
|
517
567
|
return defer(() => this.organization.leave(data)).pipe(map((data) => this.mainService.mapData(data)));
|
|
@@ -543,10 +593,10 @@ class OrganizationService {
|
|
|
543
593
|
removeTeamMember(data) {
|
|
544
594
|
return defer(() => this.organization.removeTeamMember(data));
|
|
545
595
|
}
|
|
546
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
547
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
596
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
597
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, providedIn: 'root' });
|
|
548
598
|
}
|
|
549
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: OrganizationService, decorators: [{
|
|
550
600
|
type: Injectable,
|
|
551
601
|
args: [{ providedIn: 'root' }]
|
|
552
602
|
}], ctorParameters: () => [] });
|
|
@@ -565,7 +615,7 @@ class SiweService {
|
|
|
565
615
|
* @param data - The wallet address and optional chain ID
|
|
566
616
|
*/
|
|
567
617
|
getNonce(data) {
|
|
568
|
-
return defer(() => this.siwe.
|
|
618
|
+
return defer(() => this.siwe.getNonce(data)).pipe(map((res) => this.mainService.mapData(res)));
|
|
569
619
|
}
|
|
570
620
|
/**
|
|
571
621
|
* Verifies a signed SIWE message and signs the user in.
|
|
@@ -575,10 +625,10 @@ class SiweService {
|
|
|
575
625
|
verifyMessage(data) {
|
|
576
626
|
return defer(() => this.siwe.verifySiweMessage(data)).pipe(map((res) => this.mainService.mapData(res)), switchMap((result) => this.authService.sessionState$.pipe(filter((s) => s !== null), map(() => result))));
|
|
577
627
|
}
|
|
578
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
579
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
629
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, providedIn: 'root' });
|
|
580
630
|
}
|
|
581
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SiweService, decorators: [{
|
|
582
632
|
type: Injectable,
|
|
583
633
|
args: [{ providedIn: 'root' }]
|
|
584
634
|
}], ctorParameters: () => [] });
|