Guler.Editor.Premium.Audit 0.2.0-alpha.0

This is a prerelease version of Guler.Editor.Premium.Audit.
dotnet add package Guler.Editor.Premium.Audit --version 0.2.0-alpha.0
                    
NuGet\Install-Package Guler.Editor.Premium.Audit -Version 0.2.0-alpha.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Guler.Editor.Premium.Audit" Version="0.2.0-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Guler.Editor.Premium.Audit" Version="0.2.0-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="Guler.Editor.Premium.Audit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Guler.Editor.Premium.Audit --version 0.2.0-alpha.0
                    
#r "nuget: Guler.Editor.Premium.Audit, 0.2.0-alpha.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Guler.Editor.Premium.Audit@0.2.0-alpha.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Guler.Editor.Premium.Audit&version=0.2.0-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Guler.Editor.Premium.Audit&version=0.2.0-alpha.0&prerelease
                    
Install as a Cake Tool

Stylus.Premium.Audit

Stylus editör için Audit Log + Version History premium paketi. ADR-011 implementasyonu.

⚠️ Ticari lisans gereklidir. Çekirdek Stylus paketleri MIT (ADR-004 kalıcı taahhüt); bu paket ayrı bir lisansla satılır. Trial mode (30 gün) varsayılan; sonrası geçerli Stylus.Premium.Audit audience'lı STY1 token zorunludur.

Özellikler (alpha)

Method Ne yapar
LogChangeAsync(ContentChangeEvent) İçeriğin yeni versiyonunu kaydeder + lazy retention cleanup tetikler
GetHistoryAsync(contentKey) İçeriğin tüm versiyonlarını yeni → eski döner
GetVersionAsync(contentKey, versionNumber) Spesifik versiyonu döner
ComputeDiffAsync(contentKey, oldVersion, newVersion) İki versiyon arası DiffResult üretir
IStylusDiffRenderer.RenderAsHtml(diff) <ins>/<del> HTML'i üretir (htmldiff.net)

Kurulum

// Program.cs (ASP.NET Core)
builder.Services.AddStylus();
builder.Services.AddStylusPremium(license: builder.Configuration["Stylus:LicenseKey"]);
builder.Services.AddStylusAudit(opts =>
{
    opts.RetentionDays = 30;       // default
});

Save akışına entegrasyon (consumer)

public class ArticleController(IStylusAuditLogger audit) : Controller
{
    [HttpPost("/admin/save")]
    public async Task<IActionResult> Save(ArticleInput input, CancellationToken ct)
    {
        // 1. İçeriği consumer'ın kendi DB'sine yaz
        await _db.SaveArticleAsync(input);

        // 2. Stylus audit log'a versiyon ekle (lazy cleanup tetiklenir)
        await audit.LogChangeAsync(new ContentChangeEvent
        {
            ContentKey = $"article:{input.Id}",
            Html = input.HtmlBody,
            UserId = User.Identity!.Name ?? "anonymous",
            Title = input.Title,
        }, ct);

        return RedirectToAction("Index");
    }
}

Admin "Geçmiş" sayfası

public class HistoryModel(IStylusAuditLogger audit, IStylusDiffRenderer diffRenderer) : PageModel
{
    public IReadOnlyList<ContentVersion> Versions { get; set; } = Array.Empty<ContentVersion>();
    public string? DiffHtml { get; set; }

    public async Task OnGetAsync(string slug, int? oldV, int? newV, CancellationToken ct)
    {
        Versions = await audit.GetHistoryAsync($"article:{slug}", ct);

        if (oldV is not null && newV is not null)
        {
            var diff = await audit.ComputeDiffAsync($"article:{slug}", oldV.Value, newV.Value, ct);
            DiffHtml = diffRenderer.RenderAsHtml(diff);
        }
    }
}
<link rel="stylesheet" href="~/_stylus/audit/diff.css" />

<ul>
@foreach (var v in Model.Versions)
{
    <li>v@(v.VersionNumber) — @v.UserId — @v.Timestamp.ToString("yyyy-MM-dd HH:mm")</li>
}
</ul>

@if (Model.DiffHtml is not null)
{
    @Html.Raw(Model.DiffHtml)
}

Mimari

ContentChangeEvent (consumer save handler)
  ↓ LogChangeAsync
StylusAuditLogger (lisans gate + lazy retention)
  ↓ SaveVersionAsync
IStylusAuditStore (default: InMemoryAuditStore; production: özel impl)
  ↓ ComputeDiffAsync (oldV vs newV)
htmldiff.net (HTML-aware word-level diff)
  ↓ DiffResult { OldHtml, NewHtml, Stats }
IStylusDiffRenderer.RenderAsHtml
  → <div class="stylus-audit-diff"><ins/><del/></div>

Sınırlamalar (alpha)

  • InMemoryAuditStore production'da uygun değil: Restart'ta veri kaybı. Consumer kendi IStylusAuditStore impl'ini yazmalı (~80 satır EF Core örneği docs/tr/audit-log.md'de).
  • Stylus.Core'da otomatik audit hook yok: Consumer save handler'ında elle LogChangeAsync çağırır. Auto-instrument Faz 5.
  • Rollback / branching / blame yok: Faz 5 candidate'ları.
  • htmldiff.net paragraph reorder yanlış işaretler: Pilot feedback gelirse Faz 5'te HTML node-tree custom diff.
  • Lazy cleanup inactive content miss: 1 yıl save almayan content temizlenmez; hosted background service Faz 5.

XSS uyarısı

htmldiff.net çıktısı <ins>/<del> HTML tag'leri içerir; consumer'ın user content'ini diff öncesi sanitize etmesi gerekir. Stylus.Core'un IStylusSanitizer'ı save akışında zaten çalışıyor — LogChangeAsync'a sanitized HTML geliyor.

İlgili kaynaklar

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Guler.Editor.Premium.Audit:

Package Downloads
Guler.Editor.Premium.Audit.EfCore

Stylus.Premium.Audit icin EF Core 8 backed IStylusAuditStore implementasyonu. Production-grade persistent storage; consumer kendi DbContext'iyle entegre eder. ADR-011 Faz 5 yan paket candidate'i. Kullanim: services.AddStylusAudit(); services.AddStylusAuditEfCore options => options.UseDbContext<MyDbContext> NOT: Stylus.Premium.Audit ile birlikte kullanilir; tek basina yetersiz. Lisans gate yine ana paketin (Stylus.Premium.Audit) audience'ini kontrol eder.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-alpha.0 91 5/1/2026