@nu-art/user-account-shared 0.401.8 → 0.500.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/_entity/account/api-def.d.ts +37 -84
- package/_entity/account/api-def.js +16 -20
- package/_entity/account/db-def.d.ts +3 -3
- package/_entity/account/db-def.js +4 -2
- package/_entity/account/types.d.ts +11 -9
- package/_entity/failed-login-attempt/db-def.d.ts +3 -3
- package/_entity/failed-login-attempt/db-def.js +2 -1
- package/_entity/failed-login-attempt/types.d.ts +6 -6
- package/_entity/login-attempts/db-def.d.ts +3 -3
- package/_entity/login-attempts/db-def.js +1 -0
- package/_entity/login-attempts/types.d.ts +9 -9
- package/_entity/session/consts.js +1 -1
- package/_entity/session/db-def.d.ts +5 -5
- package/_entity/session/db-def.js +3 -2
- package/_entity/session/types.d.ts +12 -12
- package/headers.d.ts +2 -0
- package/headers.js +7 -0
- package/index.d.ts +15 -2
- package/index.js +15 -2
- package/package.json +7 -6
- package/utils.d.ts +12 -0
- package/utils.js +2 -0
- package/_entity/session/index.d.ts +0 -3
- package/_entity/session/index.js +0 -3
- package/_entity.d.ts +0 -4
- package/_entity.js +0 -4
- package/_enum.d.ts +0 -1
- package/_enum.js +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ApiDefResolver, BodyApi, QueryApi } from '@nu-art/
|
|
2
|
-
import {
|
|
3
|
-
import { AccountType, DB_Account, UI_Account } from './types.js';
|
|
4
|
-
import { DB_Session, QueryParam_RedirectUrl } from '../session/index.js';
|
|
1
|
+
import { ApiDefResolver, BodyApi, QueryApi } from '@nu-art/api-types';
|
|
2
|
+
import { AccountType, DatabaseDef_Account, DB_Account, UI_Account } from './types.js';
|
|
5
3
|
import { PasswordAssertionConfig } from '../../_enum/password-assertion/index.js';
|
|
4
|
+
import { DB_BaseObject } from '@nu-art/db-api-shared';
|
|
5
|
+
import { DB_Session } from '../session/types.js';
|
|
6
|
+
import { QueryParam_RedirectUrl } from '../session/consts.js';
|
|
6
7
|
export type Response_Auth = UI_Account & DB_BaseObject;
|
|
7
8
|
export type AccountEmail = {
|
|
8
9
|
email: string;
|
|
@@ -22,94 +23,46 @@ export type DBAccountType = {
|
|
|
22
23
|
export type AccountToAssertPassword = AccountEmail & Partial<PasswordWithCheck>;
|
|
23
24
|
export type AccountToSpice = AccountEmail & AccountPassword;
|
|
24
25
|
export type Request_RegisterAccount = DBAccountType & AccountEmailWithDevice & PasswordWithCheck;
|
|
25
|
-
export type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
request: DBAccountType & AccountEmail & Partial<PasswordWithCheck>;
|
|
31
|
-
response: UI_Account & DB_BaseObject;
|
|
32
|
-
};
|
|
33
|
-
export type Account_ChangePassword = {
|
|
34
|
-
request: PasswordWithCheck & {
|
|
26
|
+
export type API_UserAccount = {
|
|
27
|
+
registerAccount: BodyApi<Response_Auth, AccountEmailWithDevice & PasswordWithCheck>;
|
|
28
|
+
refreshSession: QueryApi<void>;
|
|
29
|
+
createAccount: BodyApi<UI_Account & DB_BaseObject, DBAccountType & AccountEmail & Partial<PasswordWithCheck>>;
|
|
30
|
+
changePassword: BodyApi<Response_Auth, PasswordWithCheck & {
|
|
35
31
|
oldPassword: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export type Account_CreateToken = {
|
|
44
|
-
request: {
|
|
45
|
-
accountId: UniqueId;
|
|
32
|
+
}>;
|
|
33
|
+
login: BodyApi<Response_Auth, AccountEmailWithDevice & AccountPassword>;
|
|
34
|
+
logout: QueryApi<void>;
|
|
35
|
+
createToken: BodyApi<{
|
|
36
|
+
token: string;
|
|
37
|
+
}, {
|
|
38
|
+
accountId: DatabaseDef_Account['id'];
|
|
46
39
|
ttl: number;
|
|
47
40
|
label: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export type Account_SetPassword = {
|
|
54
|
-
request: PasswordWithCheck;
|
|
55
|
-
response: Response_Auth;
|
|
56
|
-
};
|
|
57
|
-
export type Account_GetSessions = {
|
|
58
|
-
request: DB_BaseObject;
|
|
59
|
-
response: {
|
|
41
|
+
}>;
|
|
42
|
+
setPassword: BodyApi<Response_Auth, PasswordWithCheck>;
|
|
43
|
+
getSessions: QueryApi<{
|
|
60
44
|
sessions: DB_Session[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type Account_ChangeThumbnail = {
|
|
64
|
-
request: {
|
|
65
|
-
accountId: string;
|
|
66
|
-
hash: string;
|
|
67
|
-
};
|
|
68
|
-
response: {
|
|
45
|
+
}, DB_BaseObject<DatabaseDef_Account['dbKey']>>;
|
|
46
|
+
changeThumbnail: BodyApi<{
|
|
69
47
|
account: DB_Account;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
}, {
|
|
49
|
+
accountId: DatabaseDef_Account['id'];
|
|
50
|
+
hash: string;
|
|
51
|
+
}>;
|
|
52
|
+
getPasswordAssertionConfig: QueryApi<{
|
|
75
53
|
config: PasswordAssertionConfig | undefined;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
export type ApiStruct_Account = {
|
|
79
|
-
_v1: {
|
|
80
|
-
registerAccount: BodyApi<Account_RegisterAccount['response'], Account_RegisterAccount['request']>;
|
|
81
|
-
refreshSession: QueryApi<void>;
|
|
82
|
-
createAccount: BodyApi<Account_CreateAccount['response'], Account_CreateAccount['request']>;
|
|
83
|
-
changePassword: BodyApi<Account_ChangePassword['response'], Account_ChangePassword['request']>;
|
|
84
|
-
login: BodyApi<Account_Login['response'], Account_Login['request']>;
|
|
85
|
-
logout: QueryApi<void>;
|
|
86
|
-
createToken: BodyApi<Account_CreateToken['response'], Account_CreateToken['request']>;
|
|
87
|
-
setPassword: BodyApi<Account_SetPassword['response'], Account_SetPassword['request']>;
|
|
88
|
-
getSessions: QueryApi<Account_GetSessions['response'], Account_GetSessions['request']>;
|
|
89
|
-
changeThumbnail: BodyApi<Account_ChangeThumbnail['response'], Account_ChangeThumbnail['request']>;
|
|
90
|
-
getPasswordAssertionConfig: QueryApi<Account_GetPasswordAssertionConfig['response']>;
|
|
91
|
-
};
|
|
54
|
+
}>;
|
|
92
55
|
};
|
|
93
|
-
export declare const
|
|
94
|
-
export type
|
|
95
|
-
|
|
56
|
+
export declare const ApiDef_UserAccount: ApiDefResolver<API_UserAccount>;
|
|
57
|
+
export type API_SAML = {
|
|
58
|
+
loginSaml: QueryApi<{
|
|
59
|
+
loginUrl: string;
|
|
60
|
+
}, {
|
|
96
61
|
[QueryParam_RedirectUrl]: string;
|
|
97
62
|
deviceId: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
loginUrl: string;
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export type SAML_Assert = {
|
|
104
|
-
request: {
|
|
63
|
+
}>;
|
|
64
|
+
assertSAML: BodyApi<void, {
|
|
105
65
|
RelayState: string;
|
|
106
|
-
}
|
|
107
|
-
response: void;
|
|
108
|
-
};
|
|
109
|
-
export type ApiStruct_SAML = {
|
|
110
|
-
_v1: {
|
|
111
|
-
loginSaml: QueryApi<SAML_Login['response'], SAML_Login['request']>;
|
|
112
|
-
assertSAML: BodyApi<SAML_Assert['response'], SAML_Assert['request']>;
|
|
113
|
-
};
|
|
66
|
+
}>;
|
|
114
67
|
};
|
|
115
|
-
export declare const ApiDef_SAML: ApiDefResolver<
|
|
68
|
+
export declare const ApiDef_SAML: ApiDefResolver<API_SAML>;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { HttpMethod } from '@nu-art/
|
|
1
|
+
import { HttpMethod } from '@nu-art/api-types';
|
|
2
2
|
import { Minute } from '@nu-art/ts-common';
|
|
3
|
-
import { QueryParam_RedirectUrl } from '../session/
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
getPasswordAssertionConfig: { method: HttpMethod.GET, path: '/v1/account/get-password-assertion-config' }
|
|
17
|
-
}
|
|
3
|
+
import { QueryParam_RedirectUrl } from '../session/consts.js';
|
|
4
|
+
export const ApiDef_UserAccount = {
|
|
5
|
+
registerAccount: { method: HttpMethod.POST, path: '/v1/account/register-account' },
|
|
6
|
+
refreshSession: { method: HttpMethod.GET, path: '/v1/account/refresh-session' },
|
|
7
|
+
createAccount: { method: HttpMethod.POST, path: '/v1/account/create-account' },
|
|
8
|
+
changePassword: { method: HttpMethod.POST, path: '/v1/account/change-password' },
|
|
9
|
+
login: { method: HttpMethod.POST, path: '/v1/account/login', timeout: Minute },
|
|
10
|
+
logout: { method: HttpMethod.GET, path: '/v1/account/logout' },
|
|
11
|
+
createToken: { method: HttpMethod.POST, path: '/v1/account/create-token', timeout: Minute },
|
|
12
|
+
setPassword: { method: HttpMethod.POST, path: '/v1/account/set-password' },
|
|
13
|
+
getSessions: { method: HttpMethod.GET, path: '/v1/account/get-sessions' },
|
|
14
|
+
changeThumbnail: { method: HttpMethod.POST, path: '/v1/account/change-thumbnail' },
|
|
15
|
+
getPasswordAssertionConfig: { method: HttpMethod.GET, path: '/v1/account/get-password-assertion-config' }
|
|
18
16
|
};
|
|
19
17
|
export const ApiDef_SAML = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
assertSAML: { method: HttpMethod.POST, path: 'v1/account/assert' }
|
|
23
|
-
}
|
|
18
|
+
loginSaml: { method: HttpMethod.GET, path: '/v1/account/login-saml' },
|
|
19
|
+
assertSAML: { method: HttpMethod.POST, path: '/v1/account/assert' }
|
|
24
20
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const DBDef_Accounts:
|
|
1
|
+
import { Database } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DatabaseDef_Account } from './types.js';
|
|
3
|
+
export declare const DBDef_Accounts: Database<DatabaseDef_Account>;
|
|
@@ -17,9 +17,11 @@ const generatedPropsValidator = {
|
|
|
17
17
|
export const DBDef_Accounts = {
|
|
18
18
|
dbKey: 'user-account--accounts',
|
|
19
19
|
entityName: 'Account',
|
|
20
|
-
modifiablePropsValidator
|
|
21
|
-
generatedPropsValidator
|
|
20
|
+
modifiablePropsValidator,
|
|
21
|
+
generatedPropsValidator,
|
|
22
|
+
generatedProps: ['_auditorId', '_newPasswordRequired', 'salt', 'saltedPassword'],
|
|
22
23
|
versions: ['1.0.0'],
|
|
24
|
+
uniqueKeys: ['_id'],
|
|
23
25
|
frontend: {
|
|
24
26
|
group: accountGroupName,
|
|
25
27
|
name: 'account'
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DB_BaseObject, DB_Object, DB_ProtoSeed, DB_Prototype, VersionsDeclaration } from '@nu-art/db-api-shared';
|
|
2
|
+
import { TypedKeyValue } from '@nu-art/ts-common';
|
|
3
|
+
import { AuditableV2 } from '../../utils.js';
|
|
2
4
|
export declare const AccountType_User: AccountType;
|
|
3
5
|
export declare const AccountType_Service: AccountType;
|
|
4
6
|
export declare const _accountTypes: string[];
|
|
5
7
|
export declare const accountTypes: readonly string[];
|
|
8
|
+
export declare const Account_DbKey = "user-account--accounts";
|
|
6
9
|
export type AccountType = typeof accountTypes[number];
|
|
10
|
+
type DBKey = typeof Account_DbKey;
|
|
7
11
|
type VersionTypes_Account = {
|
|
8
12
|
'1.0.0': DB_Account;
|
|
9
13
|
};
|
|
@@ -11,14 +15,9 @@ type Versions = VersionsDeclaration<['1.0.0'], VersionTypes_Account>;
|
|
|
11
15
|
type Dependencies = {};
|
|
12
16
|
type UniqueKeys = '_id';
|
|
13
17
|
type GeneratedKeys = keyof AuditableV2 | '_newPasswordRequired' | 'salt' | 'saltedPassword';
|
|
14
|
-
export
|
|
15
|
-
type
|
|
16
|
-
export type
|
|
17
|
-
export type UI_Account = DBProto_Account['uiType'];
|
|
18
|
-
export type SafeDB_Account = UI_Account & DB_BaseObject;
|
|
19
|
-
export type UI_SessionAccount = UI_Account & DB_BaseObject & SessionData_HasPassword;
|
|
20
|
-
export type _SessionKey_Account = TypedKeyValue<'account', UI_SessionAccount>;
|
|
21
|
-
export type DB_Account = DB_Object & AuditableV2 & {
|
|
18
|
+
export type DatabaseDef_Account = DB_Prototype<DB_ProtoSeed<DB_Account, DBKey, GeneratedKeys, Versions, UniqueKeys, Dependencies>>;
|
|
19
|
+
export type UI_Account = DatabaseDef_Account['uiType'];
|
|
20
|
+
export type DB_Account = DB_Object<DBKey> & AuditableV2 & {
|
|
22
21
|
type: AccountType;
|
|
23
22
|
email: string;
|
|
24
23
|
displayName?: string;
|
|
@@ -28,6 +27,9 @@ export type DB_Account = DB_Object & AuditableV2 & {
|
|
|
28
27
|
description?: string;
|
|
29
28
|
_newPasswordRequired?: boolean;
|
|
30
29
|
};
|
|
30
|
+
export type SafeDB_Account = UI_Account & DB_BaseObject<DBKey>;
|
|
31
|
+
export type UI_SessionAccount = UI_Account & DB_BaseObject<DBKey> & SessionData_HasPassword;
|
|
32
|
+
export type _SessionKey_Account = TypedKeyValue<'account', UI_SessionAccount>;
|
|
31
33
|
export type SessionData_HasPassword = {
|
|
32
34
|
hasPassword: boolean;
|
|
33
35
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const DBDef_FailedLoginAttempt:
|
|
1
|
+
import { Database } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DatabaseDef_FailedLoginAttempt } from './types.js';
|
|
3
|
+
export declare const DBDef_FailedLoginAttempt: Database<DatabaseDef_FailedLoginAttempt>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tsValidateNumber, tsValidateUniqueId } from '@nu-art/ts-common';
|
|
2
|
-
import { accountGroupName } from '../session/
|
|
2
|
+
import { accountGroupName } from '../session/consts.js';
|
|
3
3
|
const Validator_ModifiableProps = {
|
|
4
4
|
count: tsValidateNumber(),
|
|
5
5
|
accountId: tsValidateUniqueId,
|
|
@@ -12,6 +12,7 @@ export const DBDef_FailedLoginAttempt = {
|
|
|
12
12
|
versions: ['1.0.0'],
|
|
13
13
|
dbKey: 'failed-login-attempt',
|
|
14
14
|
entityName: 'failed-login-attempt',
|
|
15
|
+
uniqueKeys: ['_id'],
|
|
15
16
|
frontend: {
|
|
16
17
|
group: accountGroupName,
|
|
17
18
|
name: 'failed-login-attempt'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DB_Object,
|
|
1
|
+
import { DB_Object, DB_ProtoSeed, DB_Prototype, VersionsDeclaration } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DB_Account } from '../account/index.js';
|
|
2
3
|
type VersionTypes_FailedLoginAttempt = {
|
|
3
4
|
'1.0.0': DB_FailedLoginAttempt;
|
|
4
5
|
};
|
|
@@ -7,11 +8,10 @@ type Dependencies = {};
|
|
|
7
8
|
type UniqueKeys = '_id';
|
|
8
9
|
type GeneratedProps = never;
|
|
9
10
|
type DBKey = 'failed-login-attempt';
|
|
10
|
-
type
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
accountId: UniqueId;
|
|
11
|
+
export type DatabaseDef_FailedLoginAttempt = DB_Prototype<DB_ProtoSeed<DB_FailedLoginAttempt, DBKey, GeneratedProps, Versions, UniqueKeys, Dependencies>>;
|
|
12
|
+
export type UI_FailedLoginAttempt = DatabaseDef_FailedLoginAttempt['uiType'];
|
|
13
|
+
export type DB_FailedLoginAttempt = DB_Object<DBKey> & {
|
|
14
|
+
accountId: DB_Account['_id'];
|
|
15
15
|
count: number;
|
|
16
16
|
loginSuccessfulAt?: number;
|
|
17
17
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const DBDef_LoginAttempt:
|
|
1
|
+
import { Database } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DatabaseDef_LoginAttempt } from './types.js';
|
|
3
|
+
export declare const DBDef_LoginAttempt: Database<DatabaseDef_LoginAttempt>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { DB_Object,
|
|
1
|
+
import { DB_Object, DB_ProtoSeed, DB_Prototype, VersionsDeclaration } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DB_Account } from '../account/index.js';
|
|
3
|
+
export declare const LoginStatus_Success = "success";
|
|
4
|
+
export declare const LoginStatus_Failed = "failed";
|
|
5
|
+
export type LoginStatus = typeof LoginStatus_Failed | typeof LoginStatus_Success;
|
|
2
6
|
type VersionTypes_LoginAttempt = {
|
|
3
7
|
'1.0.0': DB_LoginAttempt;
|
|
4
8
|
};
|
|
@@ -7,18 +11,14 @@ type Dependencies = {};
|
|
|
7
11
|
type UniqueKeys = '_id';
|
|
8
12
|
type GeneratedProps = never;
|
|
9
13
|
type DBKey = 'login-attempt';
|
|
10
|
-
type
|
|
11
|
-
export type
|
|
12
|
-
export type UI_LoginAttempt = DBProto_LoginAttempt['uiType'];
|
|
13
|
-
export declare const LoginStatus_Success = "success";
|
|
14
|
-
export declare const LoginStatus_Failed = "failed";
|
|
15
|
-
export type LoginStatus = typeof LoginStatus_Failed | typeof LoginStatus_Success;
|
|
14
|
+
export type DatabaseDef_LoginAttempt = DB_Prototype<DB_ProtoSeed<DB_LoginAttempt, DBKey, GeneratedProps, Versions, UniqueKeys, Dependencies>>;
|
|
15
|
+
export type UI_LoginAttempt = DatabaseDef_LoginAttempt['uiType'];
|
|
16
16
|
export type LoginMetadata = {
|
|
17
17
|
ipAddress?: string;
|
|
18
18
|
deviceId?: string;
|
|
19
19
|
};
|
|
20
|
-
export type DB_LoginAttempt = DB_Object & {
|
|
21
|
-
accountId:
|
|
20
|
+
export type DB_LoginAttempt = DB_Object<DBKey> & {
|
|
21
|
+
accountId: DB_Account['_id'];
|
|
22
22
|
status: LoginStatus;
|
|
23
23
|
metadata: LoginMetadata;
|
|
24
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HeaderKey_Authorization } from '@nu-art/
|
|
1
|
+
import { HeaderKey_Authorization } from '@nu-art/api-types';
|
|
2
2
|
export const accountGroupName = 'account';
|
|
3
3
|
export const QueryParam_Email = 'userEmail';
|
|
4
4
|
export const QueryParam_SessionId = HeaderKey_Authorization;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const Validator_Modifiable:
|
|
4
|
-
export declare const Validator_Generated:
|
|
5
|
-
export declare const DBDef_Session:
|
|
1
|
+
import { Database } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DatabaseDef_Session } from './types.js';
|
|
3
|
+
export declare const Validator_Modifiable: DatabaseDef_Session['modifiablePropsValidator'];
|
|
4
|
+
export declare const Validator_Generated: DatabaseDef_Session['generatedPropsValidator'];
|
|
5
|
+
export declare const DBDef_Session: Database<DatabaseDef_Session>;
|
|
@@ -5,7 +5,7 @@ export const Validator_Modifiable = {
|
|
|
5
5
|
accountId: tsValidateUniqueId,
|
|
6
6
|
deviceId: tsValidateUniqueId,
|
|
7
7
|
linkedSessionId: tsValidateOptionalId,
|
|
8
|
-
validSessionJwtMd5s: tsValidateArray(tsValidateUniqueId),
|
|
8
|
+
validSessionJwtMd5s: tsValidateArray(tsValidateUniqueId),
|
|
9
9
|
sessionIdJwt: tsValidateString(),
|
|
10
10
|
};
|
|
11
11
|
export const Validator_Generated = {};
|
|
@@ -15,11 +15,12 @@ export const DBDef_Session = {
|
|
|
15
15
|
dbKey: 'user-account--sessions',
|
|
16
16
|
entityName: 'Session',
|
|
17
17
|
versions: ['1.0.0'],
|
|
18
|
+
uniqueKeys: ['_id', 'accountId', 'deviceId'],
|
|
18
19
|
frontend: {
|
|
19
20
|
group: accountGroupName,
|
|
20
21
|
name: 'session',
|
|
21
22
|
},
|
|
22
23
|
backend: {
|
|
23
|
-
name: 'user-account--sessions'
|
|
24
|
+
name: 'user-account--sessions',
|
|
24
25
|
}
|
|
25
26
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { DB_Object,
|
|
1
|
+
import { DB_Object, DB_ProtoSeed, DB_Prototype, DB_UniqueId, VersionsDeclaration } from '@nu-art/db-api-shared';
|
|
2
|
+
import { DatabaseDef_Account } from '../account/index.js';
|
|
2
3
|
type VersionTypes = {
|
|
3
4
|
'1.0.0': DB_Session;
|
|
4
5
|
};
|
|
5
6
|
type Versions = VersionsDeclaration<['1.0.0'], VersionTypes>;
|
|
6
|
-
type UniqueIds = 'accountId' | 'deviceId';
|
|
7
|
+
type UniqueIds = '_id' | 'accountId' | 'deviceId';
|
|
7
8
|
type DBKey = 'user-account--sessions';
|
|
8
|
-
type GeneratedKeys =
|
|
9
|
-
type
|
|
10
|
-
export type
|
|
11
|
-
export type UI_Session =
|
|
12
|
-
export type DB_Session = DB_Object & {
|
|
13
|
-
validSessionJwtMd5s:
|
|
9
|
+
type GeneratedKeys = never;
|
|
10
|
+
type Dependencies = {};
|
|
11
|
+
export type DatabaseDef_Session = DB_Prototype<DB_ProtoSeed<DB_Session, DBKey, GeneratedKeys, Versions, UniqueIds, Dependencies>>;
|
|
12
|
+
export type UI_Session = DatabaseDef_Session['uiType'];
|
|
13
|
+
export type DB_Session = DB_Object<DBKey> & {
|
|
14
|
+
validSessionJwtMd5s: DB_UniqueId<DBKey>[];
|
|
14
15
|
label?: string;
|
|
15
|
-
accountId:
|
|
16
|
-
deviceId:
|
|
17
|
-
linkedSessionId?:
|
|
16
|
+
accountId: DatabaseDef_Account['id'];
|
|
17
|
+
deviceId: string;
|
|
18
|
+
linkedSessionId?: DB_UniqueId<DBKey>;
|
|
18
19
|
sessionIdJwt: string;
|
|
19
20
|
};
|
|
20
|
-
export type _SessionKey_SessionId = TypedKeyValue<'_id', UniqueId>;
|
|
21
21
|
export {};
|
package/headers.d.ts
ADDED
package/headers.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @nu-art/user-account-shared - HTTP header names for auth and session
|
|
3
|
+
* Copyright (C) 2026 Adam van der Kruk aka TacB0sS
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
export const HeaderKey_DeviceId = 'device-id';
|
|
7
|
+
export const HeaderKey_TabId = 'tab-id';
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './_entity.js';
|
|
1
|
+
export * from './_entity/account/db-def.js';
|
|
2
|
+
export * from './_entity/account/types.js';
|
|
3
|
+
export * from './_entity/account/api-def.js';
|
|
4
|
+
export * from './_entity/session/types.js';
|
|
5
|
+
export * from './_entity/session/consts.js';
|
|
6
|
+
export * from './_entity/session/db-def.js';
|
|
7
|
+
export * from './_entity/failed-login-attempt/db-def.js';
|
|
8
|
+
export * from './_entity/failed-login-attempt/types.js';
|
|
9
|
+
export * from './_entity/failed-login-attempt/consts.js';
|
|
10
|
+
export * from './_entity/login-attempts/db-def.js';
|
|
11
|
+
export * from './_entity/login-attempts/types.js';
|
|
12
|
+
export * from './_enum/password-assertion/types.js';
|
|
13
|
+
export * from './_enum/password-assertion/validator.js';
|
|
14
|
+
export * from './headers.js';
|
|
15
|
+
export * from './utils.js';
|
package/index.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './_entity.js';
|
|
1
|
+
export * from './_entity/account/db-def.js';
|
|
2
|
+
export * from './_entity/account/types.js';
|
|
3
|
+
export * from './_entity/account/api-def.js';
|
|
4
|
+
export * from './_entity/session/types.js';
|
|
5
|
+
export * from './_entity/session/consts.js';
|
|
6
|
+
export * from './_entity/session/db-def.js';
|
|
7
|
+
export * from './_entity/failed-login-attempt/db-def.js';
|
|
8
|
+
export * from './_entity/failed-login-attempt/types.js';
|
|
9
|
+
export * from './_entity/failed-login-attempt/consts.js';
|
|
10
|
+
export * from './_entity/login-attempts/db-def.js';
|
|
11
|
+
export * from './_entity/login-attempts/types.js';
|
|
12
|
+
export * from './_enum/password-assertion/types.js';
|
|
13
|
+
export * from './_enum/password-assertion/validator.js';
|
|
14
|
+
export * from './headers.js';
|
|
15
|
+
export * from './utils.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/user-account-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.500.0",
|
|
4
4
|
"description": "User Account Shared",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"test": "ts-mocha -w -p src/test/tsconfig.json --timeout 0 --inspect=8107 --watch-files 'src/test/**/*.test.ts' src/test/**/*.test.ts"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nu-art/
|
|
38
|
-
"@nu-art/
|
|
39
|
-
"@nu-art/
|
|
40
|
-
"@nu-art/
|
|
41
|
-
"@nu-art/
|
|
37
|
+
"@nu-art/db-api-shared": "0.500.0",
|
|
38
|
+
"@nu-art/api-types": "{{THUNDERSTORM_VERSION}}",
|
|
39
|
+
"@nu-art/ts-common": "0.500.0",
|
|
40
|
+
"@nu-art/firebase-shared": "0.500.0",
|
|
41
|
+
"@nu-art/ts-styles": "0.500.0",
|
|
42
|
+
"@nu-art/slack-shared": "0.500.0",
|
|
42
43
|
"firebase": "^11.9.0",
|
|
43
44
|
"firebase-admin": "13.4.0",
|
|
44
45
|
"firebase-functions": "6.3.2",
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified audit information (v2).
|
|
3
|
+
*
|
|
4
|
+
* Only stores the auditor ID, not full audit details.
|
|
5
|
+
*/
|
|
6
|
+
export type AuditableV2 = {
|
|
7
|
+
/** ID of the user/system that made the change */
|
|
8
|
+
_auditorId: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const tsValidator_AuditableV2: {
|
|
11
|
+
_auditorId: import("@nu-art/ts-common").Validator<string>;
|
|
12
|
+
};
|
package/utils.js
ADDED
package/_entity/session/index.js
DELETED
package/_entity.d.ts
DELETED
package/_entity.js
DELETED
package/_enum.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './_enum/password-assertion/index.js';
|
package/_enum.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './_enum/password-assertion/index.js';
|