v7.0.0-beta.2 release

This commit is contained in:
HeuJung committed 2026-04-20 20:37:49 +09:00
1 parent 6595fd0eb5
commit fa8eba7a0d
1165 files changed
+107118 -762127

No files matched your search

+164
View File
@@ -0,0 +1,164 @@
<?php
namespace App\Contracts\Extension;
/**
* 확장(코어/모듈/플러그인) 캐시 인터페이스
*
* 코어, 모듈, 플러그인에서 캐시를 관리하기 위한 표준화된 인터페이스입니다.
* 접두사 기반으로 캐시 키를 격리하며, 태그 기반 선택적 무효화를 지원합니다.
*
* @since engine-v1.18.0
*/
interface CacheInterface
{
// === 기본 CRUD ===
/**
* 캐시에서 값을 조회합니다.
*
* @param string $key 캐시 키
* @param mixed $default 기본값
* @return mixed 캐시된 값 또는 기본값
*/
public function get(string $key, mixed $default = null): mixed;
/**
* 캐시에 값을 저장합니다.
*
* @param string $key 캐시 키
* @param mixed $value 저장할 값
* @param int|null $ttl TTL (초), null이면 기본값 사용
* @return bool 저장 성공 여부
*/
public function put(string $key, mixed $value, ?int $ttl = null): bool;
/**
* 캐시 키가 존재하는지 확인합니다.
*
* @param string $key 캐시 키
* @return bool 존재 여부
*/
public function has(string $key): bool;
/**
* 캐시 키를 삭제합니다.
*
* @param string $key 캐시 키
* @return bool 삭제 성공 여부
*/
public function forget(string $key): bool;
// === Remember 패턴 ===
/**
* 캐시에서 값을 조회하거나 콜백 결과를 캐시합니다.
*
* @param string $key 캐시 키
* @param callable $callback 캐시 미스 시 실행할 콜백
* @param int|null $ttl TTL (초), null이면 기본값 사용
* @param array $tags 캐시 태그 (무효화용)
* @return mixed 캐시된 값 또는 콜백 결과
*/
public function remember(string $key, callable $callback, ?int $ttl = null, array $tags = []): mixed;
/**
* 쿼리 해시 기반 캐싱을 수행합니다.
*
* 내부적으로 'query:' 접두사를 부여하여 일반 캐시 키와 네임스페이스를 분리합니다.
*
* @param string $queryHash 쿼리 해시 (예: md5(json_encode($filters)))
* @param callable $callback 캐시 미스 시 실행할 콜백
* @param int|null $ttl TTL (초), null이면 기본값 사용
* @param array $tags 캐시 태그 (무효화용)
* @return mixed 캐시된 값 또는 콜백 결과
*/
public function rememberQuery(string $queryHash, callable $callback, ?int $ttl = null, array $tags = []): mixed;
// === 벌크 연산 ===
/**
* 여러 캐시 키를 한 번에 조회합니다.
*
* @param array $keys 캐시 키 배열
* @return array 키 => 값 배열
*/
public function many(array $keys): array;
/**
* 여러 캐시 키-값을 한 번에 저장합니다.
*
* @param array $values 키 => 값 배열
* @param int|null $ttl TTL (초), null이면 기본값 사용
* @return bool 저장 성공 여부
*/
public function putMany(array $values, ?int $ttl = null): bool;
// === 무효화 ===
/**
* 이 드라이버 소속 전체 캐시를 삭제합니다.
*
* @return bool 삭제 성공 여부
*/
public function flush(): bool;
/**
* 특정 태그의 캐시를 삭제합니다.
*
* @param array $tags 삭제할 태그 배열
* @return bool 삭제 성공 여부
*/
public function flushTags(array $tags): bool;
// === 리프레시 ===
/**
* 캐시를 무효화하고 새로고침합니다.
*
* forget + remember를 원자적으로 실행합니다.
*
* @param string $key 캐시 키
* @param callable $callback 새 값을 생성할 콜백
* @param int|null $ttl TTL (초), null이면 기본값 사용
* @param array $tags 캐시 태그 (무효화용)
* @return mixed 새로 캐시된 값
*/
public function refresh(string $key, callable $callback, ?int $ttl = null, array $tags = []): mixed;
// === 메타 ===
/**
* 현재 캐시 스토어가 태그를 지원하는지 확인합니다.
*
* @return bool 태그 지원 여부
*/
public function supportsTags(): bool;
/**
* 현재 사용 중인 캐시 스토어 이름을 반환합니다.
*
* @return string 스토어 이름
*/
public function getStore(): string;
/**
* 사용할 캐시 스토어를 변경한 새 인스턴스를 반환합니다.
*
* 기존 인스턴스는 변경하지 않고, 새 스토어를 사용하는 복제된 인스턴스를 반환합니다.
*
* @param string $store 캐시 스토어 이름
* @return static 새 스토어를 사용하는 인스턴스
*/
public function withStore(string $store): static;
/**
* 접두사가 적용된 전체 캐시 키를 반환합니다.
*
* 디버깅 및 로그 확인용으로 사용합니다.
*
* @param string $key 캐시 키
* @return string 접두사가 포함된 전체 키
*/
public function resolveKey(string $key): string;
}
@@ -7,10 +7,21 @@ interface HookListenerInterface
/**
* 구독할 훅과 메서드 매핑을 반환합니다.
*
* @return array [
* Action 훅은 기본적으로 환경설정의 큐 드라이버에 따라 자동으로 큐/동기 실행됩니다.
* 반드시 동기 실행이 필요한 경우에만 'sync' => true를 선언하세요.
* Filter 훅은 반환값 체인이므로 항상 동기 실행됩니다.
*
* @return array<string, array{
* method?: string,
* priority?: int,
* type?: 'action'|'filter',
* sync?: bool,
* }> [
* 'hook.name' => [
* 'method' => 'methodName',
* 'priority' => 10
* 'method' => 'methodName', // 실행할 메서드 (기본: 'handle')
* 'priority' => 10, // 실행 우선순위 (기본: 10, 낮을수록 먼저)
* 'type' => 'action', // 'action' 또는 'filter' (기본: 'action')
* 'sync' => false, // true: 큐 드라이버 무관하게 동기 실행 (기본: false)
* ]
* ]
*/
@@ -97,11 +97,12 @@ interface ModuleManagerInterface
* 모듈의 레이아웃을 파일에서 다시 읽어 DB에 갱신합니다.
*
* @param string $moduleName 모듈명
* @param bool $preserveModified true 시 사용자가 UI에서 수정한 레이아웃은 덮어쓰지 않음
* @return array{success: bool, layouts_refreshed: int} 갱신 결과 및 갱신된 레이아웃 개수
*
* @throws \Exception 모듈을 찾을 수 없거나 레이아웃 갱신 실패 시
*/
public function refreshModuleLayouts(string $moduleName): array;
public function refreshModuleLayouts(string $moduleName, bool $preserveModified = false): array;
/**
* 모듈 삭제 시 삭제될 데이터 정보를 반환합니다.
@@ -97,11 +97,12 @@ interface PluginManagerInterface
* 플러그인의 레이아웃을 파일에서 다시 읽어 DB에 갱신합니다.
*
* @param string $pluginName 플러그인명
* @param bool $preserveModified true 시 사용자가 UI에서 수정한 레이아웃은 덮어쓰지 않음
* @return array{success: bool, layouts_refreshed: int} 갱신 결과 및 갱신된 레이아웃 개수
*
* @throws \Exception 플러그인을 찾을 수 없거나 레이아웃 갱신 실패 시
*/
public function refreshPluginLayouts(string $pluginName): array;
public function refreshPluginLayouts(string $pluginName, bool $preserveModified = false): array;
/**
* 플러그인 삭제 시 삭제될 데이터 정보를 반환합니다.
@@ -0,0 +1,37 @@
<?php
namespace App\Contracts\Notifications;
/**
* 알림 채널 발송 준비 상태 검증 인터페이스
*
* 각 채널의 설정 완료 여부를 사전 검증하여,
* 미설정 채널은 발송 시도 자체를 건너뛰도록 합니다.
* 플러그인은 core.notification.channel_readiness 필터 훅으로 체커를 확장할 수 있습니다.
*/
interface ChannelReadinessCheckerInterface
{
/**
* 채널이 발송 준비 상태인지 확인합니다.
*
* @param string $channelId 채널 식별자 (mail, database 등)
* @return bool
*/
public function isReady(string $channelId): bool;
/**
* 채널별 준비 상태와 사유를 반환합니다.
*
* @param string $channelId 채널 식별자
* @return array{ready: bool, reason: string|null}
*/
public function check(string $channelId): array;
/**
* 여러 채널의 준비 상태를 일괄 반환합니다 (관리자 UI용).
*
* @param array<string> $channelIds 채널 ID 배열
* @return array<string, array{ready: bool, reason: string|null}>
*/
public function checkAll(array $channelIds): array;
}
@@ -1,52 +0,0 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\MailSendLog;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
/**
* 메일 발송 이력 리포지토리 인터페이스
*/
interface MailSendLogRepositoryInterface
{
/**
* 발송 이력을 생성합니다.
*
* @param array $data 생성 데이터
* @return MailSendLog 생성된 발송 이력 모델
*/
public function create(array $data): MailSendLog;
/**
* 발송 이력 목록을 페이지네이션하여 조회합니다.
*
* @param array $filters 필터 조건 (module, template_type, status, search, date_from, date_to)
* @param int $perPage 페이지 당 항목 수
* @return LengthAwarePaginator 페이지네이션 결과
*/
public function getPaginated(array $filters = [], int $perPage = 20): LengthAwarePaginator;
/**
* 발송 통계를 조회합니다.
*
* @return array{total: int, sent: int, failed: int, today: int} 통계 정보
*/
public function getStatistics(): array;
/**
* 발송 이력을 삭제합니다.
*
* @param int $id 삭제할 발송 이력 ID
* @return bool 삭제 성공 여부
*/
public function delete(int $id): bool;
/**
* 여러 발송 이력을 일괄 삭제합니다.
*
* @param array<int> $ids 삭제할 발송 이력 ID 목록
* @return int 삭제된 건수
*/
public function deleteMany(array $ids): int;
}
@@ -1,59 +0,0 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\MailTemplate;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Collection;
interface MailTemplateRepositoryInterface
{
/**
* ID로 메일 템플릿을 찾습니다.
*
* @param int $id 메일 템플릿 ID
* @return MailTemplate|null 찾은 모델 또는 null
*/
public function findById(int $id): ?MailTemplate;
/**
* 유형으로 메일 템플릿을 찾습니다.
*
* @param string $type 템플릿 유형
* @return MailTemplate|null 찾은 모델 또는 null
*/
public function findByType(string $type): ?MailTemplate;
/**
* 활성 상태인 특정 유형 템플릿을 찾습니다.
*
* @param string $type 템플릿 유형
* @return MailTemplate|null 활성 템플릿 또는 null
*/
public function getActiveByType(string $type): ?MailTemplate;
/**
* 모든 메일 템플릿 목록을 반환합니다.
*
* @return Collection 메일 템플릿 컬렉션
*/
public function getAllTemplates(): Collection;
/**
* 메일 템플릿을 수정합니다.
*
* @param MailTemplate $template 수정 대상
* @param array $data 수정 데이터
* @return bool 수정 성공 여부
*/
public function update(MailTemplate $template, array $data): bool;
/**
* 메일 템플릿 목록을 페이지네이션하여 조회합니다.
*
* @param array $filters 필터 조건
* @param int $perPage 페이지 당 항목 수
* @return LengthAwarePaginator 페이지네이션 결과
*/
public function getPaginated(array $filters = [], int $perPage = 20): LengthAwarePaginator;
}
@@ -0,0 +1,86 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\NotificationDefinition;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
interface NotificationDefinitionRepositoryInterface
{
/**
* ID로 알림 정의 조회.
*
* @param int $id
* @return NotificationDefinition|null
*/
public function findById(int $id): ?NotificationDefinition;
/**
* 타입으로 알림 정의 조회.
*
* @param string $type
* @return NotificationDefinition|null
*/
public function findByType(string $type): ?NotificationDefinition;
/**
* 활성 상태인 특정 타입 알림 정의 조회.
*
* @param string $type
* @return NotificationDefinition|null
*/
public function getActiveByType(string $type): ?NotificationDefinition;
/**
* 모든 활성 알림 정의 조회.
*
* @return Collection
*/
public function getAllActive(): Collection;
/**
* 활성 알림 정의의 로케일별 라벨 맵을 반환합니다.
*
* 키: type 식별자, 값: 해당 로케일의 다국어 라벨 (fallback: ko → en → 식별자)
* 알림 목록 응답에서 N+1 회피 목적으로 사용됩니다.
*
* @param string|null $locale 사용자 로케일 (null이면 app locale)
* @return array<string, string>
*/
public function getLabelMap(?string $locale = null): array;
/**
* 전체 알림 정의 목록 조회.
*
* @return Collection
*/
public function getAll(): Collection;
/**
* 특정 확장의 알림 정의 목록 조회.
*
* @param string $extensionType
* @param string $extensionIdentifier
* @return Collection
*/
public function getByExtension(string $extensionType, string $extensionIdentifier): Collection;
/**
* 알림 정의 수정.
*
* @param NotificationDefinition $definition
* @param array $data
* @return NotificationDefinition
*/
public function update(NotificationDefinition $definition, array $data): NotificationDefinition;
/**
* 페이지네이션 목록 조회.
*
* @param array $filters
* @param int $perPage
* @return LengthAwarePaginator
*/
public function getPaginated(array $filters = [], int $perPage = 20): LengthAwarePaginator;
}
@@ -0,0 +1,39 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\NotificationLog;
use App\Models\User;
use Illuminate\Pagination\LengthAwarePaginator;
interface NotificationLogRepositoryInterface
{
/**
* ID로 알림 로그 조회.
*/
public function findById(int $id): ?NotificationLog;
/**
* 알림 로그 생성.
*/
public function create(array $data): NotificationLog;
/**
* 알림 로그 삭제.
*/
public function delete(NotificationLog $log): bool;
/**
* 다건 삭제.
*
* @return int 삭제된 건수
*/
public function bulkDelete(array $ids): int;
/**
* 페이지네이션 목록 조회.
*
* @param User|null $scopeUser 스코프 적용 대상 사용자 (null이면 스코프 미적용)
*/
public function getPaginated(array $filters = [], int $perPage = 20, ?User $scopeUser = null): LengthAwarePaginator;
}
@@ -0,0 +1,58 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\User;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Pagination\LengthAwarePaginator;
interface NotificationRepositoryInterface
{
/**
* 사용자의 알림 목록을 페이지네이션으로 조회합니다.
*/
public function getByUser(User $user, array $filters = [], int $perPage = 20): LengthAwarePaginator;
/**
* 사용자의 미읽음 알림 수를 반환합니다.
*/
public function getUnreadCount(User $user): int;
/**
* 특정 알림을 읽음 처리합니다.
*/
public function markAsRead(User $user, string $notificationId): ?DatabaseNotification;
/**
* 지정된 알림들을 일괄 읽음 처리합니다.
*
* @return int 읽음 처리된 건수
*/
public function markBatchAsRead(User $user, array $ids): int;
/**
* 사용자의 모든 미읽음 알림을 읽음 처리합니다.
*
* @return int 읽음 처리된 건수
*/
public function markAllAsRead(User $user): int;
/**
* 알림을 삭제합니다.
*/
public function delete(User $user, string $notificationId): bool;
/**
* 사용자의 모든 알림을 삭제합니다.
*
* @return int 삭제된 알림 수
*/
public function deleteAll(User $user): int;
/**
* 오래된 알림을 정리합니다.
*
* @return array{deleted_read: int, deleted_unread: int}
*/
public function cleanup(int $readRetentionDays, int $unreadRetentionDays): array;
}
@@ -0,0 +1,61 @@
<?php
namespace App\Contracts\Repositories;
use App\Models\NotificationTemplate;
use Illuminate\Database\Eloquent\Collection;
interface NotificationTemplateRepositoryInterface
{
/**
* ID로 알림 템플릿 조회.
*
* @param int $id
* @return NotificationTemplate|null
*/
public function findById(int $id): ?NotificationTemplate;
/**
* 알림 정의 ID + 채널로 템플릿 조회.
*
* @param int $definitionId
* @param string $channel
* @return NotificationTemplate|null
*/
public function findByDefinitionAndChannel(int $definitionId, string $channel): ?NotificationTemplate;
/**
* 알림 타입 + 채널로 활성 템플릿 조회.
*
* @param string $type
* @param string $channel
* @return NotificationTemplate|null
*/
public function getActiveByTypeAndChannel(string $type, string $channel): ?NotificationTemplate;
/**
* 특정 알림 정의의 모든 템플릿 조회.
*
* @param int $definitionId
* @return Collection
*/
public function getByDefinitionId(int $definitionId): Collection;
/**
* 템플릿 수정.
*
* @param NotificationTemplate $template
* @param array $data
* @return NotificationTemplate
*/
public function update(NotificationTemplate $template, array $data): NotificationTemplate;
/**
* 템플릿 생성 또는 수정.
*
* @param array $attributes
* @param array $values
* @return NotificationTemplate
*/
public function updateOrCreate(array $attributes, array $values): NotificationTemplate;
}
@@ -83,6 +83,17 @@ interface RoleRepositoryInterface
*/
public function findExtensionRoleByIdentifier(string $identifier, ExtensionOwnerType $extensionType, string $extensionIdentifier): ?Role;
/**
* 확장이 소유한 모든 역할을 조회합니다.
*
* stale cleanup 진입점에서 현재 DB 에 존재하는 확장 역할 전체를 얻기 위해 사용.
*
* @param ExtensionOwnerType $extensionType 확장 타입
* @param string $extensionIdentifier 확장 식별자
* @return Collection 해당 확장 소유 역할 컬렉션
*/
public function getByExtension(ExtensionOwnerType $extensionType, string $extensionIdentifier): Collection;
/**
* 역할에 권한을 할당합니다.
*