@meago/core 0.2.1 → 0.3.4
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 +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js +25 -1
- package/dist/index.mjs +23 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ declare const API_CONTROLLERS: {
|
|
|
5
5
|
readonly USERS: "users";
|
|
6
6
|
readonly ROLES: "roles";
|
|
7
7
|
readonly STORIES: "stories";
|
|
8
|
+
readonly AUDIT_EVENTS: "audit-events";
|
|
8
9
|
};
|
|
9
10
|
declare const API_ACTIONS: {
|
|
10
11
|
readonly LOGIN: "login";
|
|
@@ -33,6 +34,10 @@ declare const PERMISSIONS: {
|
|
|
33
34
|
readonly READ: "story:read";
|
|
34
35
|
readonly MANAGE: "story:manage";
|
|
35
36
|
};
|
|
37
|
+
/** Format "domain.resource.verb" — khác STORY/USER/ROLE, khớp AUDIT_PERMISSIONS phía server. */
|
|
38
|
+
readonly AUDIT: {
|
|
39
|
+
readonly READ: "audit.events.read";
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
declare const index$b_API_ACTIONS: typeof API_ACTIONS;
|
|
@@ -52,13 +57,30 @@ declare enum ESortDir {
|
|
|
52
57
|
ASC = "ASC",
|
|
53
58
|
DESC = "DESC"
|
|
54
59
|
}
|
|
60
|
+
/** Kết quả 1 audit event — mirror AuditOutcome của MeagoServer (audit.types.ts) */
|
|
61
|
+
declare enum EAuditOutcome {
|
|
62
|
+
SUCCESS = "success",
|
|
63
|
+
FAILURE = "failure",
|
|
64
|
+
DENIED = "denied"
|
|
65
|
+
}
|
|
66
|
+
/** Loại actor thực hiện hành động — mirror AuditActorType của MeagoServer (audit.types.ts) */
|
|
67
|
+
declare enum EAuditActorType {
|
|
68
|
+
USER = "user",
|
|
69
|
+
SYSTEM = "system",
|
|
70
|
+
SERVICE = "service",
|
|
71
|
+
ANONYMOUS = "anonymous"
|
|
72
|
+
}
|
|
55
73
|
|
|
74
|
+
type index$a_EAuditActorType = EAuditActorType;
|
|
75
|
+
declare const index$a_EAuditActorType: typeof EAuditActorType;
|
|
76
|
+
type index$a_EAuditOutcome = EAuditOutcome;
|
|
77
|
+
declare const index$a_EAuditOutcome: typeof EAuditOutcome;
|
|
56
78
|
type index$a_ESortDir = ESortDir;
|
|
57
79
|
declare const index$a_ESortDir: typeof ESortDir;
|
|
58
80
|
type index$a_EUserStatus = EUserStatus;
|
|
59
81
|
declare const index$a_EUserStatus: typeof EUserStatus;
|
|
60
82
|
declare namespace index$a {
|
|
61
|
-
export { index$a_ESortDir as ESortDir, index$a_EUserStatus as EUserStatus };
|
|
83
|
+
export { index$a_EAuditActorType as EAuditActorType, index$a_EAuditOutcome as EAuditOutcome, index$a_ESortDir as ESortDir, index$a_EUserStatus as EUserStatus };
|
|
62
84
|
}
|
|
63
85
|
|
|
64
86
|
interface ILoginDto {
|
|
@@ -116,6 +138,11 @@ interface IPaginatedResult<T> {
|
|
|
116
138
|
hasNextPage?: boolean;
|
|
117
139
|
hasPreviousPage?: boolean;
|
|
118
140
|
}
|
|
141
|
+
/** Danh sách dùng cursor thay vì offset — cho bảng lớn/append-only (vd audit_events). */
|
|
142
|
+
interface ICursorPaginatedResult<T> {
|
|
143
|
+
items: T[];
|
|
144
|
+
nextCursor: string | null;
|
|
145
|
+
}
|
|
119
146
|
interface IBaseQuery<TSortBy extends string = string> {
|
|
120
147
|
page?: number;
|
|
121
148
|
limit?: number;
|
|
@@ -137,11 +164,12 @@ interface ITrackingModel extends IBaseModel {
|
|
|
137
164
|
type index$8_IBaseModel = IBaseModel;
|
|
138
165
|
type index$8_IBaseQuery<TSortBy extends string = string> = IBaseQuery<TSortBy>;
|
|
139
166
|
type index$8_IBaseResponse<T> = IBaseResponse<T>;
|
|
167
|
+
type index$8_ICursorPaginatedResult<T> = ICursorPaginatedResult<T>;
|
|
140
168
|
type index$8_IErrorResponse<TDetails = unknown> = IErrorResponse<TDetails>;
|
|
141
169
|
type index$8_IPaginatedResult<T> = IPaginatedResult<T>;
|
|
142
170
|
type index$8_ITrackingModel = ITrackingModel;
|
|
143
171
|
declare namespace index$8 {
|
|
144
|
-
export type { index$8_IBaseModel as IBaseModel, index$8_IBaseQuery as IBaseQuery, index$8_IBaseResponse as IBaseResponse, index$8_IErrorResponse as IErrorResponse, index$8_IPaginatedResult as IPaginatedResult, index$8_ITrackingModel as ITrackingModel };
|
|
172
|
+
export type { index$8_IBaseModel as IBaseModel, index$8_IBaseQuery as IBaseQuery, index$8_IBaseResponse as IBaseResponse, index$8_ICursorPaginatedResult as ICursorPaginatedResult, index$8_IErrorResponse as IErrorResponse, index$8_IPaginatedResult as IPaginatedResult, index$8_ITrackingModel as ITrackingModel };
|
|
145
173
|
}
|
|
146
174
|
|
|
147
175
|
/** User trả về từ GET /auth/me — kèm tập permission đã resolve. */
|
|
@@ -166,13 +194,51 @@ interface IRole extends IBaseModel {
|
|
|
166
194
|
description?: string | null;
|
|
167
195
|
permissions: IPermission[];
|
|
168
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* 1 dòng lịch sử thao tác — append-only, không có updatedAt/version.
|
|
199
|
+
* Khớp AuditEventEntity của MeagoServer (audit-event.entity.ts).
|
|
200
|
+
*/
|
|
201
|
+
interface IAuditEvent {
|
|
202
|
+
id: string;
|
|
203
|
+
occurredAt: string;
|
|
204
|
+
actorType: EAuditActorType | string;
|
|
205
|
+
actorId: string | null;
|
|
206
|
+
action: string;
|
|
207
|
+
resourceType: string | null;
|
|
208
|
+
resourceId: string | null;
|
|
209
|
+
outcome: EAuditOutcome | string;
|
|
210
|
+
reasonCode: string | null;
|
|
211
|
+
requestId: string | null;
|
|
212
|
+
traceId: string | null;
|
|
213
|
+
httpMethod: string | null;
|
|
214
|
+
routeTemplate: string | null;
|
|
215
|
+
statusCode: number | null;
|
|
216
|
+
ip: string | null;
|
|
217
|
+
userAgent: string | null;
|
|
218
|
+
durationMs: number | null;
|
|
219
|
+
metadata: Record<string, unknown> | null;
|
|
220
|
+
}
|
|
221
|
+
/** Query params cho GET /audit-events — khớp AuditEventQueryDto của MeagoServer. */
|
|
222
|
+
interface IAuditEventQuery {
|
|
223
|
+
actorId?: string;
|
|
224
|
+
action?: string;
|
|
225
|
+
resourceType?: string;
|
|
226
|
+
resourceId?: string;
|
|
227
|
+
outcome?: EAuditOutcome | string;
|
|
228
|
+
from?: string;
|
|
229
|
+
to?: string;
|
|
230
|
+
cursor?: string;
|
|
231
|
+
limit?: number;
|
|
232
|
+
}
|
|
169
233
|
|
|
234
|
+
type index$7_IAuditEvent = IAuditEvent;
|
|
235
|
+
type index$7_IAuditEventQuery = IAuditEventQuery;
|
|
170
236
|
type index$7_ICurrentUser = ICurrentUser;
|
|
171
237
|
type index$7_IPermission = IPermission;
|
|
172
238
|
type index$7_IRole = IRole;
|
|
173
239
|
type index$7_IUser = IUser;
|
|
174
240
|
declare namespace index$7 {
|
|
175
|
-
export type { index$7_ICurrentUser as ICurrentUser, index$7_IPermission as IPermission, index$7_IRole as IRole, index$7_IUser as IUser };
|
|
241
|
+
export type { index$7_IAuditEvent as IAuditEvent, index$7_IAuditEventQuery as IAuditEventQuery, index$7_ICurrentUser as ICurrentUser, index$7_IPermission as IPermission, index$7_IRole as IRole, index$7_IUser as IUser };
|
|
176
242
|
}
|
|
177
243
|
|
|
178
244
|
interface ResponseMeta {
|
|
@@ -414,4 +480,4 @@ declare namespace index {
|
|
|
414
480
|
export { type index_Result as Result, index_err as err, index_isErr as isErr, index_isOk as isOk, index_mapResult as mapResult, index_ok as ok, index_unwrapResult as unwrapResult };
|
|
415
481
|
}
|
|
416
482
|
|
|
417
|
-
export { API_ACTIONS, API_CONTROLLERS, API_VERSION, type AuthContext, type AuthCredential, type AuthIdentity, AuthMode, type AuthPrincipal, type AuthResult, type AuthStrategy, type Clock, CoreError, CoreErrorCode, type CoreErrorOptions, ESortDir, EUserStatus, type ErrorResponseInput, type Hasher, type IBaseModel, type IBaseQuery, type IBaseResponse, type ICurrentUser, type IErrorResponse, type IJwtPayload, type ILoginDto, type IPaginatedResult, type IPermission, type IRegisterDto, type IRole, type ITokenResponse, type ITrackingModel, type IUser, type IdGenerator, index$6 as MeagoApi, index$5 as MeagoAuth, index$b as MeagoConstants, index$9 as MeagoDto, index$a as MeagoEnums, index$4 as MeagoErrors, index$8 as MeagoInterfacesCommon, index$7 as MeagoInterfacesModels, index$3 as MeagoPagination, index$2 as MeagoPermissions, index$1 as MeagoPorts, index as MeagoResult, type NormalizedPagination, PERMISSIONS, type PaginationInput, type PaginationPolicy, type PermissionCollection, type ResponseMeta, type Result, type SessionRecord, type SessionStore, type TransactionRunner, createErrorResponse, createPaginatedResult, createSuccessResponse, err, getPaginationOffset, hasAllPermissions, hasAnyPermission, isCoreError, isErr, isOk, joinApiPath, mapResult, normalizePagination, ok, systemClock, unwrapResult };
|
|
483
|
+
export { API_ACTIONS, API_CONTROLLERS, API_VERSION, type AuthContext, type AuthCredential, type AuthIdentity, AuthMode, type AuthPrincipal, type AuthResult, type AuthStrategy, type Clock, CoreError, CoreErrorCode, type CoreErrorOptions, EAuditActorType, EAuditOutcome, ESortDir, EUserStatus, type ErrorResponseInput, type Hasher, type IAuditEvent, type IAuditEventQuery, type IBaseModel, type IBaseQuery, type IBaseResponse, type ICurrentUser, type ICursorPaginatedResult, type IErrorResponse, type IJwtPayload, type ILoginDto, type IPaginatedResult, type IPermission, type IRegisterDto, type IRole, type ITokenResponse, type ITrackingModel, type IUser, type IdGenerator, index$6 as MeagoApi, index$5 as MeagoAuth, index$b as MeagoConstants, index$9 as MeagoDto, index$a as MeagoEnums, index$4 as MeagoErrors, index$8 as MeagoInterfacesCommon, index$7 as MeagoInterfacesModels, index$3 as MeagoPagination, index$2 as MeagoPermissions, index$1 as MeagoPorts, index as MeagoResult, type NormalizedPagination, PERMISSIONS, type PaginationInput, type PaginationPolicy, type PermissionCollection, type ResponseMeta, type Result, type SessionRecord, type SessionStore, type TransactionRunner, createErrorResponse, createPaginatedResult, createSuccessResponse, err, getPaginationOffset, hasAllPermissions, hasAnyPermission, isCoreError, isErr, isOk, joinApiPath, mapResult, normalizePagination, ok, systemClock, unwrapResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare const API_CONTROLLERS: {
|
|
|
5
5
|
readonly USERS: "users";
|
|
6
6
|
readonly ROLES: "roles";
|
|
7
7
|
readonly STORIES: "stories";
|
|
8
|
+
readonly AUDIT_EVENTS: "audit-events";
|
|
8
9
|
};
|
|
9
10
|
declare const API_ACTIONS: {
|
|
10
11
|
readonly LOGIN: "login";
|
|
@@ -33,6 +34,10 @@ declare const PERMISSIONS: {
|
|
|
33
34
|
readonly READ: "story:read";
|
|
34
35
|
readonly MANAGE: "story:manage";
|
|
35
36
|
};
|
|
37
|
+
/** Format "domain.resource.verb" — khác STORY/USER/ROLE, khớp AUDIT_PERMISSIONS phía server. */
|
|
38
|
+
readonly AUDIT: {
|
|
39
|
+
readonly READ: "audit.events.read";
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
declare const index$b_API_ACTIONS: typeof API_ACTIONS;
|
|
@@ -52,13 +57,30 @@ declare enum ESortDir {
|
|
|
52
57
|
ASC = "ASC",
|
|
53
58
|
DESC = "DESC"
|
|
54
59
|
}
|
|
60
|
+
/** Kết quả 1 audit event — mirror AuditOutcome của MeagoServer (audit.types.ts) */
|
|
61
|
+
declare enum EAuditOutcome {
|
|
62
|
+
SUCCESS = "success",
|
|
63
|
+
FAILURE = "failure",
|
|
64
|
+
DENIED = "denied"
|
|
65
|
+
}
|
|
66
|
+
/** Loại actor thực hiện hành động — mirror AuditActorType của MeagoServer (audit.types.ts) */
|
|
67
|
+
declare enum EAuditActorType {
|
|
68
|
+
USER = "user",
|
|
69
|
+
SYSTEM = "system",
|
|
70
|
+
SERVICE = "service",
|
|
71
|
+
ANONYMOUS = "anonymous"
|
|
72
|
+
}
|
|
55
73
|
|
|
74
|
+
type index$a_EAuditActorType = EAuditActorType;
|
|
75
|
+
declare const index$a_EAuditActorType: typeof EAuditActorType;
|
|
76
|
+
type index$a_EAuditOutcome = EAuditOutcome;
|
|
77
|
+
declare const index$a_EAuditOutcome: typeof EAuditOutcome;
|
|
56
78
|
type index$a_ESortDir = ESortDir;
|
|
57
79
|
declare const index$a_ESortDir: typeof ESortDir;
|
|
58
80
|
type index$a_EUserStatus = EUserStatus;
|
|
59
81
|
declare const index$a_EUserStatus: typeof EUserStatus;
|
|
60
82
|
declare namespace index$a {
|
|
61
|
-
export { index$a_ESortDir as ESortDir, index$a_EUserStatus as EUserStatus };
|
|
83
|
+
export { index$a_EAuditActorType as EAuditActorType, index$a_EAuditOutcome as EAuditOutcome, index$a_ESortDir as ESortDir, index$a_EUserStatus as EUserStatus };
|
|
62
84
|
}
|
|
63
85
|
|
|
64
86
|
interface ILoginDto {
|
|
@@ -116,6 +138,11 @@ interface IPaginatedResult<T> {
|
|
|
116
138
|
hasNextPage?: boolean;
|
|
117
139
|
hasPreviousPage?: boolean;
|
|
118
140
|
}
|
|
141
|
+
/** Danh sách dùng cursor thay vì offset — cho bảng lớn/append-only (vd audit_events). */
|
|
142
|
+
interface ICursorPaginatedResult<T> {
|
|
143
|
+
items: T[];
|
|
144
|
+
nextCursor: string | null;
|
|
145
|
+
}
|
|
119
146
|
interface IBaseQuery<TSortBy extends string = string> {
|
|
120
147
|
page?: number;
|
|
121
148
|
limit?: number;
|
|
@@ -137,11 +164,12 @@ interface ITrackingModel extends IBaseModel {
|
|
|
137
164
|
type index$8_IBaseModel = IBaseModel;
|
|
138
165
|
type index$8_IBaseQuery<TSortBy extends string = string> = IBaseQuery<TSortBy>;
|
|
139
166
|
type index$8_IBaseResponse<T> = IBaseResponse<T>;
|
|
167
|
+
type index$8_ICursorPaginatedResult<T> = ICursorPaginatedResult<T>;
|
|
140
168
|
type index$8_IErrorResponse<TDetails = unknown> = IErrorResponse<TDetails>;
|
|
141
169
|
type index$8_IPaginatedResult<T> = IPaginatedResult<T>;
|
|
142
170
|
type index$8_ITrackingModel = ITrackingModel;
|
|
143
171
|
declare namespace index$8 {
|
|
144
|
-
export type { index$8_IBaseModel as IBaseModel, index$8_IBaseQuery as IBaseQuery, index$8_IBaseResponse as IBaseResponse, index$8_IErrorResponse as IErrorResponse, index$8_IPaginatedResult as IPaginatedResult, index$8_ITrackingModel as ITrackingModel };
|
|
172
|
+
export type { index$8_IBaseModel as IBaseModel, index$8_IBaseQuery as IBaseQuery, index$8_IBaseResponse as IBaseResponse, index$8_ICursorPaginatedResult as ICursorPaginatedResult, index$8_IErrorResponse as IErrorResponse, index$8_IPaginatedResult as IPaginatedResult, index$8_ITrackingModel as ITrackingModel };
|
|
145
173
|
}
|
|
146
174
|
|
|
147
175
|
/** User trả về từ GET /auth/me — kèm tập permission đã resolve. */
|
|
@@ -166,13 +194,51 @@ interface IRole extends IBaseModel {
|
|
|
166
194
|
description?: string | null;
|
|
167
195
|
permissions: IPermission[];
|
|
168
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* 1 dòng lịch sử thao tác — append-only, không có updatedAt/version.
|
|
199
|
+
* Khớp AuditEventEntity của MeagoServer (audit-event.entity.ts).
|
|
200
|
+
*/
|
|
201
|
+
interface IAuditEvent {
|
|
202
|
+
id: string;
|
|
203
|
+
occurredAt: string;
|
|
204
|
+
actorType: EAuditActorType | string;
|
|
205
|
+
actorId: string | null;
|
|
206
|
+
action: string;
|
|
207
|
+
resourceType: string | null;
|
|
208
|
+
resourceId: string | null;
|
|
209
|
+
outcome: EAuditOutcome | string;
|
|
210
|
+
reasonCode: string | null;
|
|
211
|
+
requestId: string | null;
|
|
212
|
+
traceId: string | null;
|
|
213
|
+
httpMethod: string | null;
|
|
214
|
+
routeTemplate: string | null;
|
|
215
|
+
statusCode: number | null;
|
|
216
|
+
ip: string | null;
|
|
217
|
+
userAgent: string | null;
|
|
218
|
+
durationMs: number | null;
|
|
219
|
+
metadata: Record<string, unknown> | null;
|
|
220
|
+
}
|
|
221
|
+
/** Query params cho GET /audit-events — khớp AuditEventQueryDto của MeagoServer. */
|
|
222
|
+
interface IAuditEventQuery {
|
|
223
|
+
actorId?: string;
|
|
224
|
+
action?: string;
|
|
225
|
+
resourceType?: string;
|
|
226
|
+
resourceId?: string;
|
|
227
|
+
outcome?: EAuditOutcome | string;
|
|
228
|
+
from?: string;
|
|
229
|
+
to?: string;
|
|
230
|
+
cursor?: string;
|
|
231
|
+
limit?: number;
|
|
232
|
+
}
|
|
169
233
|
|
|
234
|
+
type index$7_IAuditEvent = IAuditEvent;
|
|
235
|
+
type index$7_IAuditEventQuery = IAuditEventQuery;
|
|
170
236
|
type index$7_ICurrentUser = ICurrentUser;
|
|
171
237
|
type index$7_IPermission = IPermission;
|
|
172
238
|
type index$7_IRole = IRole;
|
|
173
239
|
type index$7_IUser = IUser;
|
|
174
240
|
declare namespace index$7 {
|
|
175
|
-
export type { index$7_ICurrentUser as ICurrentUser, index$7_IPermission as IPermission, index$7_IRole as IRole, index$7_IUser as IUser };
|
|
241
|
+
export type { index$7_IAuditEvent as IAuditEvent, index$7_IAuditEventQuery as IAuditEventQuery, index$7_ICurrentUser as ICurrentUser, index$7_IPermission as IPermission, index$7_IRole as IRole, index$7_IUser as IUser };
|
|
176
242
|
}
|
|
177
243
|
|
|
178
244
|
interface ResponseMeta {
|
|
@@ -414,4 +480,4 @@ declare namespace index {
|
|
|
414
480
|
export { type index_Result as Result, index_err as err, index_isErr as isErr, index_isOk as isOk, index_mapResult as mapResult, index_ok as ok, index_unwrapResult as unwrapResult };
|
|
415
481
|
}
|
|
416
482
|
|
|
417
|
-
export { API_ACTIONS, API_CONTROLLERS, API_VERSION, type AuthContext, type AuthCredential, type AuthIdentity, AuthMode, type AuthPrincipal, type AuthResult, type AuthStrategy, type Clock, CoreError, CoreErrorCode, type CoreErrorOptions, ESortDir, EUserStatus, type ErrorResponseInput, type Hasher, type IBaseModel, type IBaseQuery, type IBaseResponse, type ICurrentUser, type IErrorResponse, type IJwtPayload, type ILoginDto, type IPaginatedResult, type IPermission, type IRegisterDto, type IRole, type ITokenResponse, type ITrackingModel, type IUser, type IdGenerator, index$6 as MeagoApi, index$5 as MeagoAuth, index$b as MeagoConstants, index$9 as MeagoDto, index$a as MeagoEnums, index$4 as MeagoErrors, index$8 as MeagoInterfacesCommon, index$7 as MeagoInterfacesModels, index$3 as MeagoPagination, index$2 as MeagoPermissions, index$1 as MeagoPorts, index as MeagoResult, type NormalizedPagination, PERMISSIONS, type PaginationInput, type PaginationPolicy, type PermissionCollection, type ResponseMeta, type Result, type SessionRecord, type SessionStore, type TransactionRunner, createErrorResponse, createPaginatedResult, createSuccessResponse, err, getPaginationOffset, hasAllPermissions, hasAnyPermission, isCoreError, isErr, isOk, joinApiPath, mapResult, normalizePagination, ok, systemClock, unwrapResult };
|
|
483
|
+
export { API_ACTIONS, API_CONTROLLERS, API_VERSION, type AuthContext, type AuthCredential, type AuthIdentity, AuthMode, type AuthPrincipal, type AuthResult, type AuthStrategy, type Clock, CoreError, CoreErrorCode, type CoreErrorOptions, EAuditActorType, EAuditOutcome, ESortDir, EUserStatus, type ErrorResponseInput, type Hasher, type IAuditEvent, type IAuditEventQuery, type IBaseModel, type IBaseQuery, type IBaseResponse, type ICurrentUser, type ICursorPaginatedResult, type IErrorResponse, type IJwtPayload, type ILoginDto, type IPaginatedResult, type IPermission, type IRegisterDto, type IRole, type ITokenResponse, type ITrackingModel, type IUser, type IdGenerator, index$6 as MeagoApi, index$5 as MeagoAuth, index$b as MeagoConstants, index$9 as MeagoDto, index$a as MeagoEnums, index$4 as MeagoErrors, index$8 as MeagoInterfacesCommon, index$7 as MeagoInterfacesModels, index$3 as MeagoPagination, index$2 as MeagoPermissions, index$1 as MeagoPorts, index as MeagoResult, type NormalizedPagination, PERMISSIONS, type PaginationInput, type PaginationPolicy, type PermissionCollection, type ResponseMeta, type Result, type SessionRecord, type SessionStore, type TransactionRunner, createErrorResponse, createPaginatedResult, createSuccessResponse, err, getPaginationOffset, hasAllPermissions, hasAnyPermission, isCoreError, isErr, isOk, joinApiPath, mapResult, normalizePagination, ok, systemClock, unwrapResult };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ __export(index_exports, {
|
|
|
26
26
|
AuthMode: () => AuthMode,
|
|
27
27
|
CoreError: () => CoreError,
|
|
28
28
|
CoreErrorCode: () => CoreErrorCode,
|
|
29
|
+
EAuditActorType: () => EAuditActorType,
|
|
30
|
+
EAuditOutcome: () => EAuditOutcome,
|
|
29
31
|
ESortDir: () => ESortDir,
|
|
30
32
|
EUserStatus: () => EUserStatus,
|
|
31
33
|
MeagoApi: () => api_exports,
|
|
@@ -73,7 +75,8 @@ var API_CONTROLLERS = {
|
|
|
73
75
|
AUTH: "auth",
|
|
74
76
|
USERS: "users",
|
|
75
77
|
ROLES: "roles",
|
|
76
|
-
STORIES: "stories"
|
|
78
|
+
STORIES: "stories",
|
|
79
|
+
AUDIT_EVENTS: "audit-events"
|
|
77
80
|
};
|
|
78
81
|
var API_ACTIONS = {
|
|
79
82
|
LOGIN: "login",
|
|
@@ -96,12 +99,18 @@ var PERMISSIONS = {
|
|
|
96
99
|
CREATE: "story:create",
|
|
97
100
|
READ: "story:read",
|
|
98
101
|
MANAGE: "story:manage"
|
|
102
|
+
},
|
|
103
|
+
/** Format "domain.resource.verb" — khác STORY/USER/ROLE, khớp AUDIT_PERMISSIONS phía server. */
|
|
104
|
+
AUDIT: {
|
|
105
|
+
READ: "audit.events.read"
|
|
99
106
|
}
|
|
100
107
|
};
|
|
101
108
|
|
|
102
109
|
// src/enums/index.ts
|
|
103
110
|
var enums_exports = {};
|
|
104
111
|
__export(enums_exports, {
|
|
112
|
+
EAuditActorType: () => EAuditActorType,
|
|
113
|
+
EAuditOutcome: () => EAuditOutcome,
|
|
105
114
|
ESortDir: () => ESortDir,
|
|
106
115
|
EUserStatus: () => EUserStatus
|
|
107
116
|
});
|
|
@@ -115,6 +124,19 @@ var ESortDir = /* @__PURE__ */ ((ESortDir2) => {
|
|
|
115
124
|
ESortDir2["DESC"] = "DESC";
|
|
116
125
|
return ESortDir2;
|
|
117
126
|
})(ESortDir || {});
|
|
127
|
+
var EAuditOutcome = /* @__PURE__ */ ((EAuditOutcome2) => {
|
|
128
|
+
EAuditOutcome2["SUCCESS"] = "success";
|
|
129
|
+
EAuditOutcome2["FAILURE"] = "failure";
|
|
130
|
+
EAuditOutcome2["DENIED"] = "denied";
|
|
131
|
+
return EAuditOutcome2;
|
|
132
|
+
})(EAuditOutcome || {});
|
|
133
|
+
var EAuditActorType = /* @__PURE__ */ ((EAuditActorType2) => {
|
|
134
|
+
EAuditActorType2["USER"] = "user";
|
|
135
|
+
EAuditActorType2["SYSTEM"] = "system";
|
|
136
|
+
EAuditActorType2["SERVICE"] = "service";
|
|
137
|
+
EAuditActorType2["ANONYMOUS"] = "anonymous";
|
|
138
|
+
return EAuditActorType2;
|
|
139
|
+
})(EAuditActorType || {});
|
|
118
140
|
|
|
119
141
|
// src/dto/auth/index.ts
|
|
120
142
|
var auth_exports = {};
|
|
@@ -294,6 +316,8 @@ function mapResult(result, mapper) {
|
|
|
294
316
|
AuthMode,
|
|
295
317
|
CoreError,
|
|
296
318
|
CoreErrorCode,
|
|
319
|
+
EAuditActorType,
|
|
320
|
+
EAuditOutcome,
|
|
297
321
|
ESortDir,
|
|
298
322
|
EUserStatus,
|
|
299
323
|
MeagoApi,
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,8 @@ var API_CONTROLLERS = {
|
|
|
17
17
|
AUTH: "auth",
|
|
18
18
|
USERS: "users",
|
|
19
19
|
ROLES: "roles",
|
|
20
|
-
STORIES: "stories"
|
|
20
|
+
STORIES: "stories",
|
|
21
|
+
AUDIT_EVENTS: "audit-events"
|
|
21
22
|
};
|
|
22
23
|
var API_ACTIONS = {
|
|
23
24
|
LOGIN: "login",
|
|
@@ -40,12 +41,18 @@ var PERMISSIONS = {
|
|
|
40
41
|
CREATE: "story:create",
|
|
41
42
|
READ: "story:read",
|
|
42
43
|
MANAGE: "story:manage"
|
|
44
|
+
},
|
|
45
|
+
/** Format "domain.resource.verb" — khác STORY/USER/ROLE, khớp AUDIT_PERMISSIONS phía server. */
|
|
46
|
+
AUDIT: {
|
|
47
|
+
READ: "audit.events.read"
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
|
|
46
51
|
// src/enums/index.ts
|
|
47
52
|
var enums_exports = {};
|
|
48
53
|
__export(enums_exports, {
|
|
54
|
+
EAuditActorType: () => EAuditActorType,
|
|
55
|
+
EAuditOutcome: () => EAuditOutcome,
|
|
49
56
|
ESortDir: () => ESortDir,
|
|
50
57
|
EUserStatus: () => EUserStatus
|
|
51
58
|
});
|
|
@@ -59,6 +66,19 @@ var ESortDir = /* @__PURE__ */ ((ESortDir2) => {
|
|
|
59
66
|
ESortDir2["DESC"] = "DESC";
|
|
60
67
|
return ESortDir2;
|
|
61
68
|
})(ESortDir || {});
|
|
69
|
+
var EAuditOutcome = /* @__PURE__ */ ((EAuditOutcome2) => {
|
|
70
|
+
EAuditOutcome2["SUCCESS"] = "success";
|
|
71
|
+
EAuditOutcome2["FAILURE"] = "failure";
|
|
72
|
+
EAuditOutcome2["DENIED"] = "denied";
|
|
73
|
+
return EAuditOutcome2;
|
|
74
|
+
})(EAuditOutcome || {});
|
|
75
|
+
var EAuditActorType = /* @__PURE__ */ ((EAuditActorType2) => {
|
|
76
|
+
EAuditActorType2["USER"] = "user";
|
|
77
|
+
EAuditActorType2["SYSTEM"] = "system";
|
|
78
|
+
EAuditActorType2["SERVICE"] = "service";
|
|
79
|
+
EAuditActorType2["ANONYMOUS"] = "anonymous";
|
|
80
|
+
return EAuditActorType2;
|
|
81
|
+
})(EAuditActorType || {});
|
|
62
82
|
|
|
63
83
|
// src/dto/auth/index.ts
|
|
64
84
|
var auth_exports = {};
|
|
@@ -237,6 +257,8 @@ export {
|
|
|
237
257
|
AuthMode,
|
|
238
258
|
CoreError,
|
|
239
259
|
CoreErrorCode,
|
|
260
|
+
EAuditActorType,
|
|
261
|
+
EAuditOutcome,
|
|
240
262
|
ESortDir,
|
|
241
263
|
EUserStatus,
|
|
242
264
|
api_exports as MeagoApi,
|