@twin.org/api-auth-entity-storage-models 0.0.3-next.21 → 0.0.3-next.23

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.
Files changed (55) hide show
  1. package/dist/es/index.js +9 -1
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/es/models/IAuthenticationAuditComponent.js +2 -0
  4. package/dist/es/models/IAuthenticationAuditComponent.js.map +1 -0
  5. package/dist/es/models/IAuthenticationAuditEntry.js +2 -0
  6. package/dist/es/models/IAuthenticationAuditEntry.js.map +1 -0
  7. package/dist/es/models/IAuthenticationRateActionConfig.js +4 -0
  8. package/dist/es/models/IAuthenticationRateActionConfig.js.map +1 -0
  9. package/dist/es/models/IAuthenticationRateComponent.js +2 -0
  10. package/dist/es/models/IAuthenticationRateComponent.js.map +1 -0
  11. package/dist/es/models/api/IAuditCreateRequest.js +2 -0
  12. package/dist/es/models/api/IAuditCreateRequest.js.map +1 -0
  13. package/dist/es/models/api/IAuditQueryRequest.js +2 -0
  14. package/dist/es/models/api/IAuditQueryRequest.js.map +1 -0
  15. package/dist/es/models/api/IAuditQueryResponse.js +2 -0
  16. package/dist/es/models/api/IAuditQueryResponse.js.map +1 -0
  17. package/dist/es/models/authAuditEvent.js +49 -0
  18. package/dist/es/models/authAuditEvent.js.map +1 -0
  19. package/dist/types/index.d.ts +9 -1
  20. package/dist/types/models/IAuthenticationAuditComponent.d.ts +40 -0
  21. package/dist/types/models/IAuthenticationAuditEntry.d.ts +50 -0
  22. package/dist/types/models/IAuthenticationRateActionConfig.d.ts +13 -0
  23. package/dist/types/models/IAuthenticationRateComponent.d.ts +46 -0
  24. package/dist/types/models/api/IAuditCreateRequest.d.ts +10 -0
  25. package/dist/types/models/api/IAuditQueryRequest.d.ts +47 -0
  26. package/dist/types/models/api/IAuditQueryResponse.d.ts +19 -0
  27. package/dist/types/models/authAuditEvent.d.ts +49 -0
  28. package/docs/changelog.md +14 -0
  29. package/docs/reference/index.md +15 -0
  30. package/docs/reference/interfaces/IAdminUserCreateRequest.md +1 -1
  31. package/docs/reference/interfaces/IAdminUserGetByIdentityRequest.md +1 -1
  32. package/docs/reference/interfaces/IAdminUserGetRequest.md +1 -1
  33. package/docs/reference/interfaces/IAdminUserGetResponse.md +1 -1
  34. package/docs/reference/interfaces/IAdminUserRemoveRequest.md +1 -1
  35. package/docs/reference/interfaces/IAdminUserUpdatePasswordRequest.md +3 -3
  36. package/docs/reference/interfaces/IAdminUserUpdateRequest.md +2 -2
  37. package/docs/reference/interfaces/IAuditCreateRequest.md +11 -0
  38. package/docs/reference/interfaces/IAuditQueryRequest.md +65 -0
  39. package/docs/reference/interfaces/IAuditQueryResponse.md +23 -0
  40. package/docs/reference/interfaces/IAuthenticationAdminComponent.md +6 -6
  41. package/docs/reference/interfaces/IAuthenticationAuditComponent.md +103 -0
  42. package/docs/reference/interfaces/IAuthenticationAuditEntry.md +91 -0
  43. package/docs/reference/interfaces/IAuthenticationComponent.md +4 -4
  44. package/docs/reference/interfaces/IAuthenticationRateActionConfig.md +19 -0
  45. package/docs/reference/interfaces/IAuthenticationRateComponent.md +165 -0
  46. package/docs/reference/interfaces/IAuthenticationUser.md +6 -6
  47. package/docs/reference/interfaces/ILoginRequest.md +1 -1
  48. package/docs/reference/interfaces/ILoginResponse.md +4 -4
  49. package/docs/reference/interfaces/ILogoutRequest.md +3 -3
  50. package/docs/reference/interfaces/IRefreshTokenRequest.md +3 -3
  51. package/docs/reference/interfaces/IRefreshTokenResponse.md +4 -4
  52. package/docs/reference/interfaces/IUpdatePasswordRequest.md +1 -1
  53. package/docs/reference/type-aliases/AuthAuditEvent.md +5 -0
  54. package/docs/reference/variables/AuthAuditEvent.md +67 -0
  55. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ # Interface: IAuditQueryRequest
2
+
3
+ Query authentication audit entries.
4
+
5
+ ## Properties
6
+
7
+ ### query? {#query}
8
+
9
+ > `optional` **query?**: `object`
10
+
11
+ The query parameters for the request.
12
+
13
+ #### actorId?
14
+
15
+ > `optional` **actorId?**: `string`
16
+
17
+ The actor identifier to filter by.
18
+
19
+ #### organizationId?
20
+
21
+ > `optional` **organizationId?**: `string`
22
+
23
+ The organization identifier to filter by.
24
+
25
+ #### tenantId?
26
+
27
+ > `optional` **tenantId?**: `string`
28
+
29
+ The tenant identifier to filter by.
30
+
31
+ #### nodeId?
32
+
33
+ > `optional` **nodeId?**: `string`
34
+
35
+ The node identifier to filter by.
36
+
37
+ #### event?
38
+
39
+ > `optional` **event?**: `string`
40
+
41
+ The event to filter by.
42
+
43
+ #### startDate?
44
+
45
+ > `optional` **startDate?**: `string`
46
+
47
+ The inclusive start date for filtering, in ISO 8601 format.
48
+
49
+ #### endDate?
50
+
51
+ > `optional` **endDate?**: `string`
52
+
53
+ The inclusive end date for filtering, in ISO 8601 format.
54
+
55
+ #### cursor?
56
+
57
+ > `optional` **cursor?**: `string`
58
+
59
+ The pagination cursor.
60
+
61
+ #### limit?
62
+
63
+ > `optional` **limit?**: `string`
64
+
65
+ The maximum number of results to return.
@@ -0,0 +1,23 @@
1
+ # Interface: IAuditQueryResponse
2
+
3
+ Response from querying authentication audit entries.
4
+
5
+ ## Properties
6
+
7
+ ### body {#body}
8
+
9
+ > **body**: `object`
10
+
11
+ The response body.
12
+
13
+ #### entries
14
+
15
+ > **entries**: [`IAuthenticationAuditEntry`](IAuthenticationAuditEntry.md)[]
16
+
17
+ The returned audit entries.
18
+
19
+ #### cursor?
20
+
21
+ > `optional` **cursor?**: `string`
22
+
23
+ The cursor to retrieve the next page, if any.
@@ -8,7 +8,7 @@ Contract definition for authentication admin component.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### create()
11
+ ### create() {#create}
12
12
 
13
13
  > **create**(`user`): `Promise`\<`void`\>
14
14
 
@@ -30,7 +30,7 @@ Nothing.
30
30
 
31
31
  ***
32
32
 
33
- ### update()
33
+ ### update() {#update}
34
34
 
35
35
  > **update**(`user`): `Promise`\<`void`\>
36
36
 
@@ -52,7 +52,7 @@ Nothing.
52
52
 
53
53
  ***
54
54
 
55
- ### get()
55
+ ### get() {#get}
56
56
 
57
57
  > **get**(`email`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
58
58
 
@@ -74,7 +74,7 @@ The user details.
74
74
 
75
75
  ***
76
76
 
77
- ### getByIdentity()
77
+ ### getByIdentity() {#getbyidentity}
78
78
 
79
79
  > **getByIdentity**(`identity`): `Promise`\<`Omit`\<[`IAuthenticationUser`](IAuthenticationUser.md), `"salt"` \| `"password"`\>\>
80
80
 
@@ -96,7 +96,7 @@ The user details.
96
96
 
97
97
  ***
98
98
 
99
- ### remove()
99
+ ### remove() {#remove}
100
100
 
101
101
  > **remove**(`email`): `Promise`\<`void`\>
102
102
 
@@ -118,7 +118,7 @@ Nothing.
118
118
 
119
119
  ***
120
120
 
121
- ### updatePassword()
121
+ ### updatePassword() {#updatepassword}
122
122
 
123
123
  > **updatePassword**(`email`, `newPassword`, `currentPassword?`): `Promise`\<`void`\>
124
124
 
@@ -0,0 +1,103 @@
1
+ # Interface: IAuthenticationAuditComponent
2
+
3
+ Contract definition for authentication audit component.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### create() {#create}
12
+
13
+ > **create**(`entry`): `Promise`\<`string`\>
14
+
15
+ Create a new audit entry.
16
+
17
+ #### Parameters
18
+
19
+ ##### entry
20
+
21
+ `Omit`\<[`IAuthenticationAuditEntry`](IAuthenticationAuditEntry.md), `"id"` \| `"dateCreated"`\>
22
+
23
+ The audit entry to be logged.
24
+
25
+ #### Returns
26
+
27
+ `Promise`\<`string`\>
28
+
29
+ The unique identifier of the created audit entry.
30
+
31
+ ***
32
+
33
+ ### query() {#query}
34
+
35
+ > **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: [`IAuthenticationAuditEntry`](IAuthenticationAuditEntry.md)[]; `cursor?`: `string`; \}\>
36
+
37
+ Query the audit entries.
38
+
39
+ #### Parameters
40
+
41
+ ##### options?
42
+
43
+ The query options.
44
+
45
+ ###### actorId?
46
+
47
+ `string`
48
+
49
+ The actor identifier to filter the audit entries, optional.
50
+
51
+ ###### organizationId?
52
+
53
+ `string`
54
+
55
+ The organization identifier to filter the audit entries, optional.
56
+
57
+ ###### tenantId?
58
+
59
+ `string`
60
+
61
+ The tenant identifier to filter the audit entries, optional.
62
+
63
+ ###### nodeId?
64
+
65
+ `string`
66
+
67
+ The node identifier to filter the audit entries, optional.
68
+
69
+ ###### event?
70
+
71
+ `string`
72
+
73
+ The audit event to filter the audit entries, optional.
74
+
75
+ ###### startDate?
76
+
77
+ `string`
78
+
79
+ The start date to filter the audit entries, optional.
80
+
81
+ ###### endDate?
82
+
83
+ `string`
84
+
85
+ The end date to filter the audit entries, optional.
86
+
87
+ ##### cursor?
88
+
89
+ `string`
90
+
91
+ The cursor for pagination.
92
+
93
+ ##### limit?
94
+
95
+ `number`
96
+
97
+ The maximum number of entries to return.
98
+
99
+ #### Returns
100
+
101
+ `Promise`\<\{ `entries`: [`IAuthenticationAuditEntry`](IAuthenticationAuditEntry.md)[]; `cursor?`: `string`; \}\>
102
+
103
+ The audit entries.
@@ -0,0 +1,91 @@
1
+ # Interface: IAuthenticationAuditEntry
2
+
3
+ Contract definition for authentication audit entry.
4
+
5
+ ## Properties
6
+
7
+ ### id {#id}
8
+
9
+ > **id**: `string`
10
+
11
+ The unique identifier for the audit entry.
12
+
13
+ ***
14
+
15
+ ### event {#event}
16
+
17
+ > **event**: `string`
18
+
19
+ The audit event that occurred.
20
+
21
+ ***
22
+
23
+ ### dateCreated {#datecreated}
24
+
25
+ > **dateCreated**: `string`
26
+
27
+ The timestamp of the audit entry in ISO 8601 format.
28
+
29
+ ***
30
+
31
+ ### actorId? {#actorid}
32
+
33
+ > `optional` **actorId?**: `string`
34
+
35
+ The actor identifier, could be e-mail, username, or other unique identifier.
36
+
37
+ ***
38
+
39
+ ### nodeId? {#nodeid}
40
+
41
+ > `optional` **nodeId?**: `string`
42
+
43
+ The node identifier associated with the audit entry, if applicable.
44
+
45
+ ***
46
+
47
+ ### organizationId? {#organizationid}
48
+
49
+ > `optional` **organizationId?**: `string`
50
+
51
+ The organization identifier associated with the audit entry, if applicable.
52
+
53
+ ***
54
+
55
+ ### tenantId? {#tenantid}
56
+
57
+ > `optional` **tenantId?**: `string`
58
+
59
+ The tenant identifier associated with the audit entry, if applicable.
60
+
61
+ ***
62
+
63
+ ### ipAddressHashes? {#ipaddresshashes}
64
+
65
+ > `optional` **ipAddressHashes?**: `string`[]
66
+
67
+ The hashed IP addresses of the client.
68
+
69
+ ***
70
+
71
+ ### userAgent? {#useragent}
72
+
73
+ > `optional` **userAgent?**: `string`
74
+
75
+ The user agent string of the client.
76
+
77
+ ***
78
+
79
+ ### correlationId? {#correlationid}
80
+
81
+ > `optional` **correlationId?**: `string`
82
+
83
+ The correlation ID for request tracing.
84
+
85
+ ***
86
+
87
+ ### data? {#data}
88
+
89
+ > `optional` **data?**: `unknown`
90
+
91
+ Additional data related to the audit entry, such as IP address, user agent, etc.
@@ -8,7 +8,7 @@ Contract definition for authentication component.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### login()
11
+ ### login() {#login}
12
12
 
13
13
  > **login**(`email`, `password`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
14
14
 
@@ -36,7 +36,7 @@ The authentication token for the user, if it uses a mechanism with public access
36
36
 
37
37
  ***
38
38
 
39
- ### logout()
39
+ ### logout() {#logout}
40
40
 
41
41
  > **logout**(`token?`): `Promise`\<`void`\>
42
42
 
@@ -58,7 +58,7 @@ Nothing.
58
58
 
59
59
  ***
60
60
 
61
- ### refresh()
61
+ ### refresh() {#refresh}
62
62
 
63
63
  > **refresh**(`token?`): `Promise`\<\{ `token?`: `string`; `expiry`: `number`; \}\>
64
64
 
@@ -80,7 +80,7 @@ The refreshed token, if it uses a mechanism with public access.
80
80
 
81
81
  ***
82
82
 
83
- ### updatePassword()
83
+ ### updatePassword() {#updatepassword}
84
84
 
85
85
  > **updatePassword**(`currentPassword`, `newPassword`): `Promise`\<`void`\>
86
86
 
@@ -0,0 +1,19 @@
1
+ # Interface: IAuthenticationRateActionConfig
2
+
3
+ Configuration for an authentication rate limited action.
4
+
5
+ ## Properties
6
+
7
+ ### maxAttempts {#maxattempts}
8
+
9
+ > **maxAttempts**: `number`
10
+
11
+ Maximum number of failed attempts allowed per window.
12
+
13
+ ***
14
+
15
+ ### windowMinutes {#windowminutes}
16
+
17
+ > **windowMinutes**: `number`
18
+
19
+ Rate limit window duration in minutes.
@@ -0,0 +1,165 @@
1
+ # Interface: IAuthenticationRateComponent
2
+
3
+ Contract definition for authentication rate component.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### start() {#start}
12
+
13
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
14
+
15
+ The service needs to be started when the application is initialized.
16
+
17
+ #### Parameters
18
+
19
+ ##### nodeLoggingComponentType?
20
+
21
+ `string`
22
+
23
+ The node logging component type.
24
+
25
+ #### Returns
26
+
27
+ `Promise`\<`void`\>
28
+
29
+ Nothing.
30
+
31
+ #### Overrides
32
+
33
+ `IComponent.start`
34
+
35
+ ***
36
+
37
+ ### stop() {#stop}
38
+
39
+ > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
40
+
41
+ The component needs to be stopped when the node is closed.
42
+
43
+ #### Parameters
44
+
45
+ ##### nodeLoggingComponentType?
46
+
47
+ `string`
48
+
49
+ The node logging component type.
50
+
51
+ #### Returns
52
+
53
+ `Promise`\<`void`\>
54
+
55
+ Nothing.
56
+
57
+ #### Overrides
58
+
59
+ `IComponent.stop`
60
+
61
+ ***
62
+
63
+ ### registerAction() {#registeraction}
64
+
65
+ > **registerAction**(`action`, `config`): `Promise`\<`void`\>
66
+
67
+ Register or update rate-limit configuration for an action.
68
+
69
+ #### Parameters
70
+
71
+ ##### action
72
+
73
+ `string`
74
+
75
+ The action name.
76
+
77
+ ##### config
78
+
79
+ [`IAuthenticationRateActionConfig`](IAuthenticationRateActionConfig.md)
80
+
81
+ The action configuration.
82
+
83
+ #### Returns
84
+
85
+ `Promise`\<`void`\>
86
+
87
+ Nothing.
88
+
89
+ ***
90
+
91
+ ### unregisterAction() {#unregisteraction}
92
+
93
+ > **unregisterAction**(`action`): `Promise`\<`void`\>
94
+
95
+ Unregister rate-limit configuration for an action.
96
+
97
+ #### Parameters
98
+
99
+ ##### action
100
+
101
+ `string`
102
+
103
+ The action name.
104
+
105
+ #### Returns
106
+
107
+ `Promise`\<`void`\>
108
+
109
+ Nothing.
110
+
111
+ ***
112
+
113
+ ### check() {#check}
114
+
115
+ > **check**(`action`, `identifier`): `Promise`\<`string`\>
116
+
117
+ Check the authentication rate for a given action and identifier.
118
+
119
+ #### Parameters
120
+
121
+ ##### action
122
+
123
+ `string`
124
+
125
+ The action to be checked.
126
+
127
+ ##### identifier
128
+
129
+ `string`
130
+
131
+ The identifier to be checked.
132
+
133
+ #### Returns
134
+
135
+ `Promise`\<`string`\>
136
+
137
+ The result of the rate check.
138
+
139
+ ***
140
+
141
+ ### clear() {#clear}
142
+
143
+ > **clear**(`action`, `identifier`): `Promise`\<`void`\>
144
+
145
+ Clear the authentication rate entry for the given action and identifier.
146
+
147
+ #### Parameters
148
+
149
+ ##### action
150
+
151
+ `string`
152
+
153
+ The action to clear.
154
+
155
+ ##### identifier
156
+
157
+ `string`
158
+
159
+ The identifier to clear.
160
+
161
+ #### Returns
162
+
163
+ `Promise`\<`void`\>
164
+
165
+ Nothing.
@@ -4,7 +4,7 @@ Contract definition for authentication user.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### email
7
+ ### email {#email}
8
8
 
9
9
  > **email**: `string`
10
10
 
@@ -12,7 +12,7 @@ The user e-mail address.
12
12
 
13
13
  ***
14
14
 
15
- ### password
15
+ ### password {#password}
16
16
 
17
17
  > **password**: `string`
18
18
 
@@ -20,7 +20,7 @@ The encrypted password for the user.
20
20
 
21
21
  ***
22
22
 
23
- ### salt
23
+ ### salt {#salt}
24
24
 
25
25
  > **salt**: `string`
26
26
 
@@ -28,7 +28,7 @@ The salt for the password.
28
28
 
29
29
  ***
30
30
 
31
- ### userIdentity
31
+ ### userIdentity {#useridentity}
32
32
 
33
33
  > **userIdentity**: `string`
34
34
 
@@ -36,7 +36,7 @@ The user identity.
36
36
 
37
37
  ***
38
38
 
39
- ### organizationIdentity
39
+ ### organizationIdentity {#organizationidentity}
40
40
 
41
41
  > **organizationIdentity**: `string`
42
42
 
@@ -44,7 +44,7 @@ The users organization.
44
44
 
45
45
  ***
46
46
 
47
- ### scope
47
+ ### scope {#scope}
48
48
 
49
49
  > **scope**: `string`[]
50
50
 
@@ -4,7 +4,7 @@ Perform a login on the server.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10
 
@@ -4,21 +4,21 @@ Response from a login on the server.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  Response headers.
12
12
 
13
13
  #### set-cookie?
14
14
 
15
- > `optional` **set-cookie**: `string`
15
+ > `optional` **set-cookie?**: `string`
16
16
 
17
17
  The cookie containing the auth token.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `object`
24
24
 
@@ -4,14 +4,14 @@ Perform a logout on the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query?
7
+ ### query? {#query}
8
8
 
9
- > `optional` **query**: `object`
9
+ > `optional` **query?**: `object`
10
10
 
11
11
  The logout token details.
12
12
 
13
13
  #### token?
14
14
 
15
- > `optional` **token**: `string`
15
+ > `optional` **token?**: `string`
16
16
 
17
17
  The token to logout, if it uses a mechanism with public access.
@@ -4,14 +4,14 @@ Perform a refresh of the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query?
7
+ ### query? {#query}
8
8
 
9
- > `optional` **query**: `object`
9
+ > `optional` **query?**: `object`
10
10
 
11
11
  The refresh token details.
12
12
 
13
13
  #### token?
14
14
 
15
- > `optional` **token**: `string`
15
+ > `optional` **token?**: `string`
16
16
 
17
17
  The token to refresh, if it uses a mechanism with public access.
@@ -4,21 +4,21 @@ Response from a refresh on the auth token.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  Response headers.
12
12
 
13
13
  #### set-cookie?
14
14
 
15
- > `optional` **set-cookie**: `string`
15
+ > `optional` **set-cookie?**: `string`
16
16
 
17
17
  The cookie containing the auth token.
18
18
 
19
19
  ***
20
20
 
21
- ### body
21
+ ### body {#body}
22
22
 
23
23
  > **body**: `object`
24
24
 
@@ -4,7 +4,7 @@ Update the current user's password.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10