fix npm run build

This commit is contained in:
Rayyan
2026-08-02 20:01:29 +07:00
parent 306c145f91
commit eb6031282a
236 changed files with 5557 additions and 47 deletions
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PermissionData = void 0;
class PermissionData {
id;
code;
name;
description;
createdAt;
updatedAt;
constructor(id, code, name, description, createdAt, updatedAt) {
this.id = id;
this.code = code;
this.name = name;
this.description = description;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
changeName(name) {
this.name = name;
}
changeDescription(description) {
this.description = description;
}
changeCode(code) {
this.code = code;
}
static restore(props) {
return new PermissionData(props.id, props.code || props.name, props.name, props.description, props.createdAt, props.updatedAt);
}
}
exports.PermissionData = PermissionData;
//# sourceMappingURL=permission.entity.js.map
@@ -0,0 +1 @@
{"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/entities/permission.entity.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAEP;IACT;IACA;IACA;IACA;IACA;IANT,YACkB,EAAU,EACnB,IAAY,EACZ,IAAY,EACZ,WAAmB,EACnB,SAAe,EACf,SAAe;QALN,OAAE,GAAF,EAAE,CAAQ;QACnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAM;QACf,cAAS,GAAT,SAAS,CAAM;IACrB,CAAC;IAEJ,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,iBAAiB,CAAC,WAAmB;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,KAOd;QACC,OAAO,IAAI,cAAc,CACvB,KAAK,CAAC,EAAE,EACR,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EACxB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,SAAS,CAChB,CAAC;IACJ,CAAC;CACF;AAvCD,wCAuCC"}
+51
View File
@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoleData = void 0;
class RoleData {
id;
code;
name;
description;
permissions;
isDefault;
createdAt;
updatedAt;
constructor(id, code, name, description, permissions, isDefault, createdAt, updatedAt) {
this.id = id;
this.code = code;
this.name = name;
this.description = description;
this.permissions = permissions;
this.isDefault = isDefault;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
hasPermissions(permissionId) {
return this.permissions.some(x => x.id.toLowerCase() === permissionId.toLowerCase());
}
assignPermission(permissionData) {
if (this.hasPermissions(permissionData.id))
throw new Error("Permission sudah dimiliki.");
this.permissions.push(permissionData);
}
removePermission(permissionId) {
const idx = this.permissions.findIndex(p => p.id.toLowerCase() === permissionId.toLowerCase());
if (idx === -1)
throw new Error('Permission tidak ditemukan pada role.');
this.permissions.splice(idx, 1);
}
changeName(name) {
this.name = name;
}
changeDescription(description) {
this.description = description;
}
setDefault(isDefault) {
this.isDefault = isDefault;
}
static restore(props) {
return new RoleData(props.id, props.code, props.name, props.description, props.permissions || [], props.isDefault ?? false, props.createdAt, props.updatedAt);
}
}
exports.RoleData = RoleData;
//# sourceMappingURL=role.entity.js.map
@@ -0,0 +1 @@
{"version":3,"file":"role.entity.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/entities/role.entity.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IAED;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IART,YACkB,EAAU,EACnB,IAAY,EACZ,IAAY,EACZ,WAAmB,EACnB,WAA6B,EAC7B,SAAkB,EAClB,SAAe,EACf,SAAe;QAPN,OAAE,GAAF,EAAE,CAAQ;QACnB,SAAI,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AAC,OAAO,CAAC,KASd;QACC,OAAO,IAAI,QAAQ,CACjB,KAAK,CAAC,EAAE,EACR,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,WAAW,IAAI,EAAE,EACvB,KAAK,CAAC,SAAS,IAAI,KAAK,EACxB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,SAAS,CAChB,CAAC;IACJ,CAAC;CACF;AA7DD,4BA6DC"}
+143
View File
@@ -0,0 +1,143 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserData = void 0;
class UserData {
id;
authentikId;
username;
email;
password;
roles;
permissions;
isActive;
deletedAt;
lastSeenAt;
storageQuota;
storageUsed;
constructor(id, authentikId, username, email, password, roles, permissions, isActive, deletedAt, lastSeenAt, storageQuota, storageUsed) {
this.id = id;
this.authentikId = authentikId;
this.username = username;
this.email = email;
this.password = password;
this.roles = roles;
this.permissions = permissions;
this.isActive = isActive;
this.deletedAt = deletedAt;
this.lastSeenAt = lastSeenAt;
this.storageQuota = storageQuota;
this.storageUsed = storageUsed;
}
//#region Create
static create(data) {
const quota = data.storageQuota !== undefined ? data.storageQuota : 10737418240; // 10 GB
const used = data.storageUsed !== undefined ? data.storageUsed : 0;
return new UserData(crypto.randomUUID(), data.authentikId || null, data.username, data.email, data.password ?? null, [], [], true, null, null, quota, used);
}
//#endregion
//#region Read
hasRole(roleId) {
return this.roles.some(x => x.id.toLowerCase() === roleId.toLowerCase());
}
assignRole(roleData) {
if (this.hasRole(roleData.id))
throw new Error("Role Sudah dimiliki.");
this.roles.push(roleData);
}
hasPermissions(permissionId) {
return this.permissions.some(x => x.id.toLowerCase() === permissionId.toLowerCase());
}
hasPermission(permission) {
const byPerm = this.permissions.some(x => x.id.toLowerCase() === permission.toLowerCase() || x.name.toLowerCase() === permission.toLowerCase());
if (byPerm)
return true;
// check roles
return this.roles.some(r => r.permissions.some(p => p.id.toLowerCase() === permission.toLowerCase() || p.name.toLowerCase() === permission.toLowerCase()));
}
assignPermission(permissionData) {
if (this.hasPermissions(permissionData.id))
throw new Error("Permission sudah dimiliki.");
this.permissions.push(permissionData);
}
//#endregion
//#region Update
changeEmail(email) {
this.email = email;
}
changeUsername(username) {
this.username = username;
}
touchLastSeen() {
this.lastSeenAt = new Date();
}
enable() {
this.isActive = true;
}
disable() {
this.isActive = false;
}
//#endregion
//#region Delete
softDelete() {
this.deletedAt = new Date();
this.isActive = false;
}
restoreInstance() {
this.deletedAt = null;
}
//#endregion
static restore(props) {
return new UserData(props.id, props.authentikId || null, props.username, props.email, props.password, props.roles || [], props.permissions || [], props.isActive !== undefined ? props.isActive : true, props.deletedAt || null, props.lastSeenAt || null, props.storageQuota !== undefined && props.storageQuota !== null ? props.storageQuota : 10737418240, props.storageUsed !== undefined && props.storageUsed !== null ? props.storageUsed : 0);
}
removeRole(roleId) {
const idx = this.roles.findIndex(r => r.id.toLowerCase() === roleId.toLowerCase());
if (idx === -1)
throw new Error('Role tidak ditemukan pada user.');
this.roles.splice(idx, 1);
}
removePermission(permissionId) {
const idx = this.permissions.findIndex(p => p.id.toLowerCase() === permissionId.toLowerCase());
if (idx === -1)
throw new Error('Permission tidak ditemukan pada user.');
this.permissions.splice(idx, 1);
}
// Storage helpers
setStorageQuota(bytes) {
if (bytes < 0)
throw new Error('storageQuota must be >= 0');
if (this.storageUsed > bytes)
throw new Error('storageQuota cannot be less than storageUsed');
this.storageQuota = bytes;
}
setStorageUsed(bytes) {
if (bytes < 0)
throw new Error('storageUsed must be >= 0');
if (bytes > this.storageQuota)
throw new Error('storageUsed cannot exceed storageQuota');
this.storageUsed = bytes;
}
// Response helper for API
toResponse() {
const remaining = this.storageQuota - this.storageUsed;
const usagePercentage = this.storageQuota > 0 ? Math.round((this.storageUsed / this.storageQuota) * 100) : 0;
return {
id: this.id,
authentikId: this.authentikId,
username: this.username,
email: this.email,
roles: this.roles,
permissions: this.permissions,
isActive: this.isActive,
deletedAt: this.deletedAt,
lastSeenAt: this.lastSeenAt,
storage: {
quota: this.storageQuota,
used: this.storageUsed,
remaining,
usagePercentage,
},
};
}
}
exports.UserData = UserData;
//# sourceMappingURL=user.entity.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserCreatedEvent = void 0;
class UserCreatedEvent {
payload;
name = 'UserCreated';
occurredAt = new Date();
constructor(payload) {
this.payload = payload;
}
}
exports.UserCreatedEvent = UserCreatedEvent;
//# sourceMappingURL=user-created.event.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-created.event.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/events/user-created.event.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAGC;IAFnB,IAAI,GAAG,aAAa,CAAC;IACrB,UAAU,GAAS,IAAI,IAAI,EAAE,CAAC;IACvC,YAA4B,OAAiF;QAAjF,YAAO,GAAP,OAAO,CAA0E;IAAG,CAAC;CAClH;AAJD,4CAIC"}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserDisabledEvent = void 0;
class UserDisabledEvent {
payload;
name = 'UserDisabled';
occurredAt = new Date();
constructor(payload) {
this.payload = payload;
}
}
exports.UserDisabledEvent = UserDisabledEvent;
//# sourceMappingURL=user-disabled.event.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-disabled.event.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/events/user-disabled.event.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAGA;IAFnB,IAAI,GAAG,cAAc,CAAC;IACtB,UAAU,GAAS,IAAI,IAAI,EAAE,CAAC;IACvC,YAA4B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;CAC5D;AAJD,8CAIC"}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserEmailChangedEvent = void 0;
class UserEmailChangedEvent {
payload;
name = 'UserEmailChanged';
occurredAt = new Date();
constructor(payload) {
this.payload = payload;
}
}
exports.UserEmailChangedEvent = UserEmailChangedEvent;
//# sourceMappingURL=user-email-changed.event.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-email-changed.event.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/events/user-email-changed.event.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;IAGJ;IAFnB,IAAI,GAAG,kBAAkB,CAAC;IAC1B,UAAU,GAAS,IAAI,IAAI,EAAE,CAAC;IACvC,YAA4B,OAA+D;QAA/D,YAAO,GAAP,OAAO,CAAwD;IAAG,CAAC;CAChG;AAJD,sDAIC"}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserEnabledEvent = void 0;
class UserEnabledEvent {
payload;
name = 'UserEnabled';
occurredAt = new Date();
constructor(payload) {
this.payload = payload;
}
}
exports.UserEnabledEvent = UserEnabledEvent;
//# sourceMappingURL=user-enabled.event.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-enabled.event.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/events/user-enabled.event.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAGC;IAFnB,IAAI,GAAG,aAAa,CAAC;IACrB,UAAU,GAAS,IAAI,IAAI,EAAE,CAAC;IACvC,YAA4B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;CAC5D;AAJD,4CAIC"}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserUsernameChangedEvent = void 0;
class UserUsernameChangedEvent {
payload;
name = 'UserUsernameChanged';
occurredAt = new Date();
constructor(payload) {
this.payload = payload;
}
}
exports.UserUsernameChangedEvent = UserUsernameChangedEvent;
//# sourceMappingURL=user-username-changed.event.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-username-changed.event.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/events/user-username-changed.event.ts"],"names":[],"mappings":";;;AAEA,MAAa,wBAAwB;IAGP;IAFnB,IAAI,GAAG,qBAAqB,CAAC;IAC7B,UAAU,GAAS,IAAI,IAAI,EAAE,CAAC;IACvC,YAA4B,OAAqE;QAArE,YAAO,GAAP,OAAO,CAA8D;IAAG,CAAC;CACtG;AAJD,4DAIC"}
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IPermission = void 0;
class IPermission {
}
exports.IPermission = IPermission;
//# sourceMappingURL=permission.interface.js.map
@@ -0,0 +1 @@
{"version":3,"file":"permission.interface.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/repositories/permission.interface.ts"],"names":[],"mappings":";;;AAEA,MAAsB,WAAW;CAShC;AATD,kCASC"}
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IRole = void 0;
class IRole {
}
exports.IRole = IRole;
//# sourceMappingURL=role.interface.js.map
@@ -0,0 +1 @@
{"version":3,"file":"role.interface.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/repositories/role.interface.ts"],"names":[],"mappings":";;;AAEA,MAAsB,KAAK;CAY1B;AAZD,sBAYC"}
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IUser = void 0;
class IUser {
}
exports.IUser = IUser;
//# sourceMappingURL=user.interface.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user.interface.js","sourceRoot":"","sources":["../../../../../src/modules/identity/domain/repositories/user.interface.ts"],"names":[],"mappings":";;;AAEA,MAAsB,KAAK;CA0B1B;AA1BD,sBA0BC"}