@twin.org/api-auth-entity-storage-models 0.0.3-next.4 → 0.0.3-next.40

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 (101) hide show
  1. package/README.md +2 -2
  2. package/dist/es/index.js +17 -0
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/es/models/IAuthenticationAdminComponent.js.map +1 -1
  5. package/dist/es/models/IAuthenticationAuditComponent.js +2 -0
  6. package/dist/es/models/IAuthenticationAuditComponent.js.map +1 -0
  7. package/dist/es/models/IAuthenticationAuditEntry.js +2 -0
  8. package/dist/es/models/IAuthenticationAuditEntry.js.map +1 -0
  9. package/dist/es/models/IAuthenticationComponent.js.map +1 -1
  10. package/dist/es/models/IAuthenticationRateActionConfig.js +4 -0
  11. package/dist/es/models/IAuthenticationRateActionConfig.js.map +1 -0
  12. package/dist/es/models/IAuthenticationRateComponent.js +2 -0
  13. package/dist/es/models/IAuthenticationRateComponent.js.map +1 -0
  14. package/dist/es/models/IAuthenticationUser.js +4 -0
  15. package/dist/es/models/IAuthenticationUser.js.map +1 -0
  16. package/dist/es/models/IAuthenticationUserSecure.js +2 -0
  17. package/dist/es/models/IAuthenticationUserSecure.js.map +1 -0
  18. package/dist/es/models/api/IAdminUserCreateRequest.js +2 -0
  19. package/dist/es/models/api/IAdminUserCreateRequest.js.map +1 -0
  20. package/dist/es/models/api/IAdminUserGetByIdentityRequest.js +4 -0
  21. package/dist/es/models/api/IAdminUserGetByIdentityRequest.js.map +1 -0
  22. package/dist/es/models/api/IAdminUserGetRequest.js +4 -0
  23. package/dist/es/models/api/IAdminUserGetRequest.js.map +1 -0
  24. package/dist/es/models/api/IAdminUserGetResponse.js +2 -0
  25. package/dist/es/models/api/IAdminUserGetResponse.js.map +1 -0
  26. package/dist/es/models/api/IAdminUserRemoveRequest.js +4 -0
  27. package/dist/es/models/api/IAdminUserRemoveRequest.js.map +1 -0
  28. package/dist/es/models/api/IAdminUserUpdatePasswordRequest.js +4 -0
  29. package/dist/es/models/api/IAdminUserUpdatePasswordRequest.js.map +1 -0
  30. package/dist/es/models/api/IAdminUserUpdateRequest.js +2 -0
  31. package/dist/es/models/api/IAdminUserUpdateRequest.js.map +1 -0
  32. package/dist/es/models/api/IAuditCreateRequest.js +2 -0
  33. package/dist/es/models/api/IAuditCreateRequest.js.map +1 -0
  34. package/dist/es/models/api/IAuditQueryRequest.js +2 -0
  35. package/dist/es/models/api/IAuditQueryRequest.js.map +1 -0
  36. package/dist/es/models/api/IAuditQueryResponse.js +2 -0
  37. package/dist/es/models/api/IAuditQueryResponse.js.map +1 -0
  38. package/dist/es/models/api/ILoginResponse.js +0 -2
  39. package/dist/es/models/api/ILoginResponse.js.map +1 -1
  40. package/dist/es/models/api/ILogoutRequest.js.map +1 -1
  41. package/dist/es/models/api/IRefreshTokenRequest.js.map +1 -1
  42. package/dist/es/models/api/IRefreshTokenResponse.js +0 -2
  43. package/dist/es/models/api/IRefreshTokenResponse.js.map +1 -1
  44. package/dist/es/models/api/IUpdatePasswordRequest.js.map +1 -1
  45. package/dist/es/models/authAuditEvent.js +49 -0
  46. package/dist/es/models/authAuditEvent.js.map +1 -0
  47. package/dist/types/index.d.ts +17 -0
  48. package/dist/types/models/IAuthenticationAdminComponent.d.ts +24 -6
  49. package/dist/types/models/IAuthenticationAuditComponent.d.ts +40 -0
  50. package/dist/types/models/IAuthenticationAuditEntry.d.ts +50 -0
  51. package/dist/types/models/IAuthenticationComponent.d.ts +1 -2
  52. package/dist/types/models/IAuthenticationRateActionConfig.d.ts +13 -0
  53. package/dist/types/models/IAuthenticationRateComponent.d.ts +46 -0
  54. package/dist/types/models/IAuthenticationUser.d.ts +21 -0
  55. package/dist/types/models/IAuthenticationUserSecure.d.ts +18 -0
  56. package/dist/types/models/api/IAdminUserCreateRequest.d.ts +12 -0
  57. package/dist/types/models/api/IAdminUserGetByIdentityRequest.d.ts +14 -0
  58. package/dist/types/models/api/IAdminUserGetRequest.d.ts +14 -0
  59. package/dist/types/models/api/IAdminUserGetResponse.d.ts +10 -0
  60. package/dist/types/models/api/IAdminUserRemoveRequest.d.ts +14 -0
  61. package/dist/types/models/api/IAdminUserUpdatePasswordRequest.d.ts +27 -0
  62. package/dist/types/models/api/IAdminUserUpdateRequest.d.ts +19 -0
  63. package/dist/types/models/api/IAuditCreateRequest.d.ts +10 -0
  64. package/dist/types/models/api/IAuditQueryRequest.d.ts +47 -0
  65. package/dist/types/models/api/IAuditQueryResponse.d.ts +19 -0
  66. package/dist/types/models/api/ILoginResponse.d.ts +10 -4
  67. package/dist/types/models/api/ILogoutRequest.d.ts +1 -1
  68. package/dist/types/models/api/IRefreshTokenRequest.d.ts +1 -1
  69. package/dist/types/models/api/IRefreshTokenResponse.d.ts +10 -4
  70. package/dist/types/models/api/IUpdatePasswordRequest.d.ts +1 -10
  71. package/dist/types/models/authAuditEvent.d.ts +49 -0
  72. package/docs/changelog.md +328 -65
  73. package/docs/examples.md +80 -1
  74. package/docs/reference/index.md +24 -0
  75. package/docs/reference/interfaces/IAdminUserCreateRequest.md +17 -0
  76. package/docs/reference/interfaces/IAdminUserGetByIdentityRequest.md +17 -0
  77. package/docs/reference/interfaces/IAdminUserGetRequest.md +17 -0
  78. package/docs/reference/interfaces/IAdminUserGetResponse.md +11 -0
  79. package/docs/reference/interfaces/IAdminUserRemoveRequest.md +17 -0
  80. package/docs/reference/interfaces/IAdminUserUpdatePasswordRequest.md +37 -0
  81. package/docs/reference/interfaces/IAdminUserUpdateRequest.md +25 -0
  82. package/docs/reference/interfaces/IAuditCreateRequest.md +11 -0
  83. package/docs/reference/interfaces/IAuditQueryRequest.md +65 -0
  84. package/docs/reference/interfaces/IAuditQueryResponse.md +23 -0
  85. package/docs/reference/interfaces/IAuthenticationAdminComponent.md +64 -16
  86. package/docs/reference/interfaces/IAuthenticationAuditComponent.md +103 -0
  87. package/docs/reference/interfaces/IAuthenticationAuditEntry.md +91 -0
  88. package/docs/reference/interfaces/IAuthenticationComponent.md +5 -11
  89. package/docs/reference/interfaces/IAuthenticationRateActionConfig.md +19 -0
  90. package/docs/reference/interfaces/IAuthenticationRateComponent.md +165 -0
  91. package/docs/reference/interfaces/IAuthenticationUser.md +39 -0
  92. package/docs/reference/interfaces/IAuthenticationUserSecure.md +79 -0
  93. package/docs/reference/interfaces/ILoginRequest.md +1 -1
  94. package/docs/reference/interfaces/ILoginResponse.md +14 -6
  95. package/docs/reference/interfaces/ILogoutRequest.md +3 -3
  96. package/docs/reference/interfaces/IRefreshTokenRequest.md +3 -3
  97. package/docs/reference/interfaces/IRefreshTokenResponse.md +14 -6
  98. package/docs/reference/interfaces/IUpdatePasswordRequest.md +2 -16
  99. package/docs/reference/type-aliases/AuthAuditEvent.md +5 -0
  100. package/docs/reference/variables/AuthAuditEvent.md +67 -0
  101. package/package.json +4 -4
@@ -0,0 +1,18 @@
1
+ import type { IAuthenticationUser } from "./IAuthenticationUser.js";
2
+ /**
3
+ * Contract definition for authentication user.
4
+ */
5
+ export interface IAuthenticationUserSecure extends IAuthenticationUser {
6
+ /**
7
+ * The encrypted password for the user.
8
+ */
9
+ password: string;
10
+ /**
11
+ * The salt for the password.
12
+ */
13
+ salt: string;
14
+ /**
15
+ * The tenant ID associated with the user, optional in single tenant contexts.
16
+ */
17
+ tenantId: string;
18
+ }
@@ -0,0 +1,12 @@
1
+ import type { IAuthenticationUser } from "../IAuthenticationUser.js";
2
+ /**
3
+ * Create a new user as an admin.
4
+ */
5
+ export interface IAdminUserCreateRequest {
6
+ /**
7
+ * The body of the request.
8
+ */
9
+ body: IAuthenticationUser & {
10
+ password: string;
11
+ };
12
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Get a user as an admin.
3
+ */
4
+ export interface IAdminUserGetByIdentityRequest {
5
+ /**
6
+ * The path parameters for the request.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The user identity.
11
+ */
12
+ identity: string;
13
+ };
14
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Get a user as an admin.
3
+ */
4
+ export interface IAdminUserGetRequest {
5
+ /**
6
+ * The path parameters for the request.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The user email.
11
+ */
12
+ email: string;
13
+ };
14
+ }
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticationUser } from "../IAuthenticationUser.js";
2
+ /**
3
+ * Get a user as an admin.
4
+ */
5
+ export interface IAdminUserGetResponse {
6
+ /**
7
+ * The body of the request.
8
+ */
9
+ body: IAuthenticationUser;
10
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Remove a user as an admin.
3
+ */
4
+ export interface IAdminUserRemoveRequest {
5
+ /**
6
+ * The path parameters for the request.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The user email.
11
+ */
12
+ email: string;
13
+ };
14
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Update a users password as an admin.
3
+ */
4
+ export interface IAdminUserUpdatePasswordRequest {
5
+ /**
6
+ * The path parameters for the request.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The user email.
11
+ */
12
+ email: string;
13
+ };
14
+ /**
15
+ * The body of the request.
16
+ */
17
+ body: {
18
+ /**
19
+ * The new password for the user.
20
+ */
21
+ newPassword: string;
22
+ /**
23
+ * The current password for the user.
24
+ */
25
+ currentPassword?: string;
26
+ };
27
+ }
@@ -0,0 +1,19 @@
1
+ import type { IAuthenticationUser } from "../IAuthenticationUser.js";
2
+ /**
3
+ * Update a user as an admin.
4
+ */
5
+ export interface IAdminUserUpdateRequest {
6
+ /**
7
+ * The path parameters for the request.
8
+ */
9
+ pathParams: {
10
+ /**
11
+ * The user email.
12
+ */
13
+ email: string;
14
+ };
15
+ /**
16
+ * The body of the request.
17
+ */
18
+ body: Partial<Omit<IAuthenticationUser, "email">>;
19
+ }
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticationAuditEntry } from "../IAuthenticationAuditEntry.js";
2
+ /**
3
+ * Create an authentication audit entry.
4
+ */
5
+ export interface IAuditCreateRequest {
6
+ /**
7
+ * The body of the request.
8
+ */
9
+ body: Omit<IAuthenticationAuditEntry, "id" | "dateCreated">;
10
+ }
@@ -0,0 +1,47 @@
1
+ import type { AuthAuditEvent } from "../authAuditEvent.js";
2
+ /**
3
+ * Query authentication audit entries.
4
+ */
5
+ export interface IAuditQueryRequest {
6
+ /**
7
+ * The query parameters for the request.
8
+ */
9
+ query?: {
10
+ /**
11
+ * The actor identifier to filter by.
12
+ */
13
+ actorId?: string;
14
+ /**
15
+ * The organization identifier to filter by.
16
+ */
17
+ organizationId?: string;
18
+ /**
19
+ * The tenant identifier to filter by.
20
+ */
21
+ tenantId?: string;
22
+ /**
23
+ * The node identifier to filter by.
24
+ */
25
+ nodeId?: string;
26
+ /**
27
+ * The event to filter by.
28
+ */
29
+ event?: AuthAuditEvent | string;
30
+ /**
31
+ * The inclusive start date for filtering, in ISO 8601 format.
32
+ */
33
+ startDate?: string;
34
+ /**
35
+ * The inclusive end date for filtering, in ISO 8601 format.
36
+ */
37
+ endDate?: string;
38
+ /**
39
+ * The pagination cursor.
40
+ */
41
+ cursor?: string;
42
+ /**
43
+ * The maximum number of results to return.
44
+ */
45
+ limit?: string;
46
+ };
47
+ }
@@ -0,0 +1,19 @@
1
+ import type { IAuthenticationAuditEntry } from "../IAuthenticationAuditEntry.js";
2
+ /**
3
+ * Response from querying authentication audit entries.
4
+ */
5
+ export interface IAuditQueryResponse {
6
+ /**
7
+ * The response body.
8
+ */
9
+ body: {
10
+ /**
11
+ * The returned audit entries.
12
+ */
13
+ entries: IAuthenticationAuditEntry[];
14
+ /**
15
+ * The cursor to retrieve the next page, if any.
16
+ */
17
+ cursor?: string;
18
+ };
19
+ }
@@ -1,15 +1,21 @@
1
+ import type { HeaderTypes } from "@twin.org/web";
1
2
  /**
2
3
  * Response from a login on the server.
3
4
  */
4
5
  export interface ILoginResponse {
5
6
  /**
6
- * The login response details.
7
+ * Response headers.
7
8
  */
8
- body: {
9
+ headers?: {
9
10
  /**
10
- * The access token, if it uses a mechanism with public access.
11
+ * The cookie containing the auth token.
11
12
  */
12
- token?: string;
13
+ [HeaderTypes.SetCookie]?: string;
14
+ };
15
+ /**
16
+ * The login response details.
17
+ */
18
+ body: {
13
19
  /**
14
20
  * The expiry time of the token.
15
21
  */
@@ -5,7 +5,7 @@ export interface ILogoutRequest {
5
5
  /**
6
6
  * The logout token details.
7
7
  */
8
- query?: {
8
+ body?: {
9
9
  /**
10
10
  * The token to logout, if it uses a mechanism with public access.
11
11
  */
@@ -5,7 +5,7 @@ export interface IRefreshTokenRequest {
5
5
  /**
6
6
  * The refresh token details.
7
7
  */
8
- query?: {
8
+ body?: {
9
9
  /**
10
10
  * The token to refresh, if it uses a mechanism with public access.
11
11
  */
@@ -1,15 +1,21 @@
1
+ import type { HeaderTypes } from "@twin.org/web";
1
2
  /**
2
3
  * Response from a refresh on the auth token.
3
4
  */
4
5
  export interface IRefreshTokenResponse {
5
6
  /**
6
- * The refresh token details.
7
+ * Response headers.
7
8
  */
8
- body: {
9
+ headers?: {
9
10
  /**
10
- * The refreshed token, if it uses a mechanism with public access.
11
+ * The cookie containing the auth token.
11
12
  */
12
- token?: string;
13
+ [HeaderTypes.SetCookie]?: string;
14
+ };
15
+ /**
16
+ * The refresh token details.
17
+ */
18
+ body: {
13
19
  /**
14
20
  * The expiry time of the token.
15
21
  */
@@ -1,16 +1,7 @@
1
1
  /**
2
- * Update a users password.
2
+ * Update the current user's password.
3
3
  */
4
4
  export interface IUpdatePasswordRequest {
5
- /**
6
- * The path parameters for the request.
7
- */
8
- pathParams: {
9
- /**
10
- * The user email.
11
- */
12
- email: string;
13
- };
14
5
  /**
15
6
  * The body of the request.
16
7
  */
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Supported authentication audit events.
3
+ */
4
+ export declare const AuthAuditEvent: {
5
+ /**
6
+ * Login success.
7
+ */
8
+ readonly LoginSuccess: "login-success";
9
+ /**
10
+ * Login failure.
11
+ */
12
+ readonly LoginFailure: "login-failure";
13
+ /**
14
+ * Logout.
15
+ */
16
+ readonly Logout: "logout";
17
+ /**
18
+ * Token refreshed.
19
+ */
20
+ readonly TokenRefreshed: "token-refreshed";
21
+ /**
22
+ * Account created.
23
+ */
24
+ readonly AccountCreated: "account-created";
25
+ /**
26
+ * Account deleted.
27
+ */
28
+ readonly AccountDeleted: "account-deleted";
29
+ /**
30
+ * Account updated.
31
+ */
32
+ readonly AccountUpdated: "account-updated";
33
+ /**
34
+ * Account locked.
35
+ */
36
+ readonly AccountLocked: "account-locked";
37
+ /**
38
+ * Account unlocked.
39
+ */
40
+ readonly AccountUnlocked: "account-unlocked";
41
+ /**
42
+ * Password changed.
43
+ */
44
+ readonly PasswordChanged: "password-changed";
45
+ };
46
+ /**
47
+ * Supported authentication audit event values.
48
+ */
49
+ export type AuthAuditEvent = (typeof AuthAuditEvent)[keyof typeof AuthAuditEvent];