@meistrari/auth-core 1.0.0 → 1.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/dist/index.d.mts +28 -7
- package/dist/index.d.ts +28 -7
- package/dist/index.mjs +14 -4
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1812,7 +1812,9 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
1812
1812
|
image?: string | undefined;
|
|
1813
1813
|
callbackURL?: string | undefined;
|
|
1814
1814
|
fetchOptions?: FetchOptions | undefined;
|
|
1815
|
-
} & {} & {} & {} & {}
|
|
1815
|
+
} & {} & {} & {} & {} & {} & {
|
|
1816
|
+
lastActiveAt?: Date | null | undefined;
|
|
1817
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<NonNullable<{
|
|
1816
1818
|
token: null;
|
|
1817
1819
|
user: {
|
|
1818
1820
|
id: string;
|
|
@@ -1968,7 +1970,9 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
1968
1970
|
image?: (string | null) | undefined;
|
|
1969
1971
|
name?: string | undefined;
|
|
1970
1972
|
fetchOptions?: FetchOptions | undefined;
|
|
1971
|
-
} & Partial<{} & {} & {} & {}
|
|
1973
|
+
} & Partial<{} & {} & {} & {} & {} & {
|
|
1974
|
+
lastActiveAt?: Date | null | undefined;
|
|
1975
|
+
}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
1972
1976
|
status: boolean;
|
|
1973
1977
|
}, {
|
|
1974
1978
|
code?: string | undefined;
|
|
@@ -2247,6 +2251,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2247
2251
|
role?: string | null | undefined;
|
|
2248
2252
|
banReason?: string | null | undefined;
|
|
2249
2253
|
banExpires?: Date | null | undefined;
|
|
2254
|
+
lastActiveAt?: Date | null | undefined;
|
|
2250
2255
|
};
|
|
2251
2256
|
session: {
|
|
2252
2257
|
id: string;
|
|
@@ -2408,6 +2413,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2408
2413
|
role?: string | null | undefined;
|
|
2409
2414
|
banReason?: string | null | undefined;
|
|
2410
2415
|
banExpires?: Date | null | undefined;
|
|
2416
|
+
lastActiveAt?: Date | null | undefined;
|
|
2411
2417
|
};
|
|
2412
2418
|
session: {
|
|
2413
2419
|
id: string;
|
|
@@ -2518,6 +2524,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2518
2524
|
role?: string | null | undefined;
|
|
2519
2525
|
banReason?: string | null | undefined;
|
|
2520
2526
|
banExpires?: Date | null | undefined;
|
|
2527
|
+
lastActiveAt?: Date | null | undefined;
|
|
2521
2528
|
};
|
|
2522
2529
|
session: {
|
|
2523
2530
|
id: string;
|
|
@@ -4339,7 +4346,9 @@ declare const stub: {
|
|
|
4339
4346
|
image?: string | undefined;
|
|
4340
4347
|
callbackURL?: string | undefined;
|
|
4341
4348
|
fetchOptions?: FetchOptions | undefined;
|
|
4342
|
-
} & {} & {} & {} & {}
|
|
4349
|
+
} & {} & {} & {} & {} & {} & {
|
|
4350
|
+
lastActiveAt?: Date | null | undefined;
|
|
4351
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<NonNullable<{
|
|
4343
4352
|
token: null;
|
|
4344
4353
|
user: {
|
|
4345
4354
|
id: string;
|
|
@@ -4495,7 +4504,9 @@ declare const stub: {
|
|
|
4495
4504
|
image?: (string | null) | undefined;
|
|
4496
4505
|
name?: string | undefined;
|
|
4497
4506
|
fetchOptions?: FetchOptions | undefined;
|
|
4498
|
-
} & Partial<{} & {} & {} & {}
|
|
4507
|
+
} & Partial<{} & {} & {} & {} & {} & {
|
|
4508
|
+
lastActiveAt?: Date | null | undefined;
|
|
4509
|
+
}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
4499
4510
|
status: boolean;
|
|
4500
4511
|
}, {
|
|
4501
4512
|
code?: string | undefined;
|
|
@@ -4774,6 +4785,7 @@ declare const stub: {
|
|
|
4774
4785
|
role?: string | null | undefined;
|
|
4775
4786
|
banReason?: string | null | undefined;
|
|
4776
4787
|
banExpires?: Date | null | undefined;
|
|
4788
|
+
lastActiveAt?: Date | null | undefined;
|
|
4777
4789
|
};
|
|
4778
4790
|
session: {
|
|
4779
4791
|
id: string;
|
|
@@ -4935,6 +4947,7 @@ declare const stub: {
|
|
|
4935
4947
|
role?: string | null | undefined;
|
|
4936
4948
|
banReason?: string | null | undefined;
|
|
4937
4949
|
banExpires?: Date | null | undefined;
|
|
4950
|
+
lastActiveAt?: Date | null | undefined;
|
|
4938
4951
|
};
|
|
4939
4952
|
session: {
|
|
4940
4953
|
id: string;
|
|
@@ -5045,6 +5058,7 @@ declare const stub: {
|
|
|
5045
5058
|
role?: string | null | undefined;
|
|
5046
5059
|
banReason?: string | null | undefined;
|
|
5047
5060
|
banExpires?: Date | null | undefined;
|
|
5061
|
+
lastActiveAt?: Date | null | undefined;
|
|
5048
5062
|
};
|
|
5049
5063
|
session: {
|
|
5050
5064
|
id: string;
|
|
@@ -5273,11 +5287,18 @@ declare const rolesAccessControl: {
|
|
|
5273
5287
|
}>;
|
|
5274
5288
|
};
|
|
5275
5289
|
};
|
|
5290
|
+
declare const userAdditionalFields: {
|
|
5291
|
+
lastActiveAt: {
|
|
5292
|
+
type: "date";
|
|
5293
|
+
required: false;
|
|
5294
|
+
defaultValue: null;
|
|
5295
|
+
};
|
|
5296
|
+
};
|
|
5276
5297
|
declare const organizationAdditionalFields: {
|
|
5277
5298
|
settings: {
|
|
5278
5299
|
type: "json";
|
|
5279
|
-
input:
|
|
5280
|
-
required:
|
|
5300
|
+
input: true;
|
|
5301
|
+
required: false;
|
|
5281
5302
|
};
|
|
5282
5303
|
};
|
|
5283
5304
|
|
|
@@ -5753,5 +5774,5 @@ declare function isTokenExpired(token: string): any;
|
|
|
5753
5774
|
*/
|
|
5754
5775
|
declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
5755
5776
|
|
|
5756
|
-
export { AuthClient, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, Roles, ac, createAPIClient, isTokenExpired, organizationAdditionalFields, rolesAccessControl, validateToken };
|
|
5777
|
+
export { AuthClient, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, Roles, ac, createAPIClient, isTokenExpired, organizationAdditionalFields, rolesAccessControl, userAdditionalFields, validateToken };
|
|
5757
5778
|
export type { APIClient, FullOrganization, Invitation, ExtendedMember as Member, ExtendedOrganization as Organization, Role, Session, Team, TeamMember, User };
|
package/dist/index.d.ts
CHANGED
|
@@ -1812,7 +1812,9 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
1812
1812
|
image?: string | undefined;
|
|
1813
1813
|
callbackURL?: string | undefined;
|
|
1814
1814
|
fetchOptions?: FetchOptions | undefined;
|
|
1815
|
-
} & {} & {} & {} & {}
|
|
1815
|
+
} & {} & {} & {} & {} & {} & {
|
|
1816
|
+
lastActiveAt?: Date | null | undefined;
|
|
1817
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<NonNullable<{
|
|
1816
1818
|
token: null;
|
|
1817
1819
|
user: {
|
|
1818
1820
|
id: string;
|
|
@@ -1968,7 +1970,9 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
1968
1970
|
image?: (string | null) | undefined;
|
|
1969
1971
|
name?: string | undefined;
|
|
1970
1972
|
fetchOptions?: FetchOptions | undefined;
|
|
1971
|
-
} & Partial<{} & {} & {} & {}
|
|
1973
|
+
} & Partial<{} & {} & {} & {} & {} & {
|
|
1974
|
+
lastActiveAt?: Date | null | undefined;
|
|
1975
|
+
}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
1972
1976
|
status: boolean;
|
|
1973
1977
|
}, {
|
|
1974
1978
|
code?: string | undefined;
|
|
@@ -2247,6 +2251,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2247
2251
|
role?: string | null | undefined;
|
|
2248
2252
|
banReason?: string | null | undefined;
|
|
2249
2253
|
banExpires?: Date | null | undefined;
|
|
2254
|
+
lastActiveAt?: Date | null | undefined;
|
|
2250
2255
|
};
|
|
2251
2256
|
session: {
|
|
2252
2257
|
id: string;
|
|
@@ -2408,6 +2413,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2408
2413
|
role?: string | null | undefined;
|
|
2409
2414
|
banReason?: string | null | undefined;
|
|
2410
2415
|
banExpires?: Date | null | undefined;
|
|
2416
|
+
lastActiveAt?: Date | null | undefined;
|
|
2411
2417
|
};
|
|
2412
2418
|
session: {
|
|
2413
2419
|
id: string;
|
|
@@ -2518,6 +2524,7 @@ declare function createAPIClient(apiUrl: string, headers?: Record<string, string
|
|
|
2518
2524
|
role?: string | null | undefined;
|
|
2519
2525
|
banReason?: string | null | undefined;
|
|
2520
2526
|
banExpires?: Date | null | undefined;
|
|
2527
|
+
lastActiveAt?: Date | null | undefined;
|
|
2521
2528
|
};
|
|
2522
2529
|
session: {
|
|
2523
2530
|
id: string;
|
|
@@ -4339,7 +4346,9 @@ declare const stub: {
|
|
|
4339
4346
|
image?: string | undefined;
|
|
4340
4347
|
callbackURL?: string | undefined;
|
|
4341
4348
|
fetchOptions?: FetchOptions | undefined;
|
|
4342
|
-
} & {} & {} & {} & {}
|
|
4349
|
+
} & {} & {} & {} & {} & {} & {
|
|
4350
|
+
lastActiveAt?: Date | null | undefined;
|
|
4351
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<NonNullable<{
|
|
4343
4352
|
token: null;
|
|
4344
4353
|
user: {
|
|
4345
4354
|
id: string;
|
|
@@ -4495,7 +4504,9 @@ declare const stub: {
|
|
|
4495
4504
|
image?: (string | null) | undefined;
|
|
4496
4505
|
name?: string | undefined;
|
|
4497
4506
|
fetchOptions?: FetchOptions | undefined;
|
|
4498
|
-
} & Partial<{} & {} & {} & {}
|
|
4507
|
+
} & Partial<{} & {} & {} & {} & {} & {
|
|
4508
|
+
lastActiveAt?: Date | null | undefined;
|
|
4509
|
+
}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
4499
4510
|
status: boolean;
|
|
4500
4511
|
}, {
|
|
4501
4512
|
code?: string | undefined;
|
|
@@ -4774,6 +4785,7 @@ declare const stub: {
|
|
|
4774
4785
|
role?: string | null | undefined;
|
|
4775
4786
|
banReason?: string | null | undefined;
|
|
4776
4787
|
banExpires?: Date | null | undefined;
|
|
4788
|
+
lastActiveAt?: Date | null | undefined;
|
|
4777
4789
|
};
|
|
4778
4790
|
session: {
|
|
4779
4791
|
id: string;
|
|
@@ -4935,6 +4947,7 @@ declare const stub: {
|
|
|
4935
4947
|
role?: string | null | undefined;
|
|
4936
4948
|
banReason?: string | null | undefined;
|
|
4937
4949
|
banExpires?: Date | null | undefined;
|
|
4950
|
+
lastActiveAt?: Date | null | undefined;
|
|
4938
4951
|
};
|
|
4939
4952
|
session: {
|
|
4940
4953
|
id: string;
|
|
@@ -5045,6 +5058,7 @@ declare const stub: {
|
|
|
5045
5058
|
role?: string | null | undefined;
|
|
5046
5059
|
banReason?: string | null | undefined;
|
|
5047
5060
|
banExpires?: Date | null | undefined;
|
|
5061
|
+
lastActiveAt?: Date | null | undefined;
|
|
5048
5062
|
};
|
|
5049
5063
|
session: {
|
|
5050
5064
|
id: string;
|
|
@@ -5273,11 +5287,18 @@ declare const rolesAccessControl: {
|
|
|
5273
5287
|
}>;
|
|
5274
5288
|
};
|
|
5275
5289
|
};
|
|
5290
|
+
declare const userAdditionalFields: {
|
|
5291
|
+
lastActiveAt: {
|
|
5292
|
+
type: "date";
|
|
5293
|
+
required: false;
|
|
5294
|
+
defaultValue: null;
|
|
5295
|
+
};
|
|
5296
|
+
};
|
|
5276
5297
|
declare const organizationAdditionalFields: {
|
|
5277
5298
|
settings: {
|
|
5278
5299
|
type: "json";
|
|
5279
|
-
input:
|
|
5280
|
-
required:
|
|
5300
|
+
input: true;
|
|
5301
|
+
required: false;
|
|
5281
5302
|
};
|
|
5282
5303
|
};
|
|
5283
5304
|
|
|
@@ -5753,5 +5774,5 @@ declare function isTokenExpired(token: string): any;
|
|
|
5753
5774
|
*/
|
|
5754
5775
|
declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
5755
5776
|
|
|
5756
|
-
export { AuthClient, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, Roles, ac, createAPIClient, isTokenExpired, organizationAdditionalFields, rolesAccessControl, validateToken };
|
|
5777
|
+
export { AuthClient, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, Roles, ac, createAPIClient, isTokenExpired, organizationAdditionalFields, rolesAccessControl, userAdditionalFields, validateToken };
|
|
5757
5778
|
export type { APIClient, FullOrganization, Invitation, ExtendedMember as Member, ExtendedOrganization as Organization, Role, Session, Team, TeamMember, User };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
|
2
2
|
import { createAuthClient } from 'better-auth/client';
|
|
3
|
-
import { organizationClient, twoFactorClient, jwtClient, adminClient } from 'better-auth/client/plugins';
|
|
3
|
+
import { organizationClient, twoFactorClient, jwtClient, adminClient, inferAdditionalFields } from 'better-auth/client/plugins';
|
|
4
4
|
import { ssoClient } from '@better-auth/sso/client';
|
|
5
5
|
import { createAccessControl } from 'better-auth/plugins/access';
|
|
6
6
|
import { defaultStatements } from 'better-auth/plugins/organization/access';
|
|
7
7
|
|
|
8
|
-
const version = "1.
|
|
8
|
+
const version = "1.1.0";
|
|
9
9
|
|
|
10
10
|
const statements = {
|
|
11
11
|
...defaultStatements,
|
|
@@ -32,6 +32,13 @@ const rolesAccessControl = {
|
|
|
32
32
|
access: ["reviewer"]
|
|
33
33
|
})
|
|
34
34
|
};
|
|
35
|
+
const userAdditionalFields = {
|
|
36
|
+
lastActiveAt: {
|
|
37
|
+
type: "date",
|
|
38
|
+
required: false,
|
|
39
|
+
defaultValue: null
|
|
40
|
+
}
|
|
41
|
+
};
|
|
35
42
|
const organizationAdditionalFields = {
|
|
36
43
|
settings: {
|
|
37
44
|
type: "json",
|
|
@@ -97,7 +104,10 @@ function createAPIClient(apiUrl, headers) {
|
|
|
97
104
|
ssoClient(),
|
|
98
105
|
twoFactorClient(),
|
|
99
106
|
jwtClient(),
|
|
100
|
-
adminClient()
|
|
107
|
+
adminClient(),
|
|
108
|
+
inferAdditionalFields({
|
|
109
|
+
user: userAdditionalFields
|
|
110
|
+
})
|
|
101
111
|
],
|
|
102
112
|
fetchOptions: {
|
|
103
113
|
credentials: "include",
|
|
@@ -542,4 +552,4 @@ async function validateToken(token, apiUrl) {
|
|
|
542
552
|
}
|
|
543
553
|
}
|
|
544
554
|
|
|
545
|
-
export { AuthClient, Roles, ac, isTokenExpired, organizationAdditionalFields, rolesAccessControl, validateToken };
|
|
555
|
+
export { AuthClient, Roles, ac, isTokenExpired, organizationAdditionalFields, rolesAccessControl, userAdditionalFields, validateToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/auth-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "unbuild"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@better-auth/sso": "1.4.
|
|
21
|
-
"better-auth": "1.4.
|
|
20
|
+
"@better-auth/sso": "1.4.1",
|
|
21
|
+
"better-auth": "1.4.1",
|
|
22
22
|
"jose": "6.1.0",
|
|
23
23
|
"nanostores": "1.0.1",
|
|
24
24
|
"@better-fetch/fetch": "1.1.18"
|