Browse Source

Remove the low-code change summary and history extension points from the documentation

The change summary endpoint, history contributors, source labels and protected save points are removed from the low-code module.
pull/26341/head
SALİH ÖZKARA 3 weeks ago
parent
commit
7c03d03179
Failed to extract signature
  1. 61
      docs/en/low-code/model-history.md

61
docs/en/low-code/model-history.md

@ -68,66 +68,7 @@ A save point restore is applied as the difference between the current model and
Comparison and history actions are protected by entry, operation, and serialized-payload budgets. Old history can be pruned while a save point retains its snapshot for later comparison or restore.
## Change Summary
`POST /api/lowcode/model/history/change-summary` lists what changed between two history points, one row per changed object: an entity, a property, a page, a form, a script, an enum, a permission, and so on. It takes the same `from` and `to` points as history comparison (`Current`, `SavePoint`, `SaveBefore`, `SaveAfter`, or `Checkpoint`).
Each object row reports one of these change kinds:
| Change kind | Meaning |
|-------------|---------|
| `added` | The object did not exist at the first point |
| `changed` | The object exists at both points and some fields differ |
| `removed` | The object no longer exists at the second point |
| `restored` | A deleted object came back with its kept data |
| `replaced` | The name now belongs to a different object, for example one created again after the original was deleted |
A changed object lists each changed field with its value before and after. Set `includeObjectDetails` to also receive each object's JSON before and after and the full text of its changed scripts and expressions; with `includeObjectJson: false` only the changed code is returned. Set `objectPath` (for example `["entities", "Acme.Books.Book", "properties", "Title"]`) to return only one object. When a point has no stored model snapshot, the model is rebuilt from the other point or from the current model. When neither model can be rebuilt, `hasBeforeValues` is `false` and changed fields carry only their new values. Long values and long object lists are shortened and flagged (`isTruncated`, `isJsonTruncated`, and `totalObjectCount`).
The change summary has the same permission requirement as history comparison (the Designer edit permission). There is no MCP tool for it.
`restored` and `replaced` are reported when the history between the two points is available. A comparison of two stored snapshots without that history reports such an object as added or changed.
## Extending History
A host application can add its own information to history and keep the save points it depends on.
### History Contributors
Implement `ILowCodeModelHistoryContributor` and register it in DI to set extra properties on each new history batch and save point before it is saved, in the same unit of work. `ContributeToHistoryBatchAsync` is called for a batch recorded by a model save or a history action, and `ContributeToSavePointAsync` for a new save point, after the caller's extra properties are applied; both have default implementations, so implement only the ones you need. The context exposes the row (`Batch` or `SavePoint`), its `Layer`, and its `App` (`null` for the default app). The module stores these properties as they are and returns them in the batch and save point DTOs. Save point creation also accepts `extraProperties` from the caller.
```csharp
public class MyHistoryContributor : ILowCodeModelHistoryContributor, ITransientDependency
{
public Task ContributeToHistoryBatchAsync(LowCodeModelHistoryBatchContributionContext context)
{
context.Batch.SetProperty(LowCodeModelHistoryExtraPropertyNames.SourceLabel, "Import");
return Task.CompletedTask;
}
}
```
### Source Labels
The `SourceLabel` extra property (`LowCodeModelHistoryExtraPropertyNames.SourceLabel`) names where a batch or save point came from. The Designer shows it as a badge in **History**. Set it to a short text that is already localized. Batches created by restoring a save point get a **Restore** badge.
### Protected Save Points
The save point limit (`LowCodeRuntimeHistoryOptions.MaxSavePointsPerLayer`) prunes the oldest save points of each app. Implement `ILowCodeModelSavePointRetentionGuard` to protect save points that your application still needs:
```csharp
public class MySavePointRetentionGuard : ILowCodeModelSavePointRetentionGuard, ITransientDependency
{
public Task<IReadOnlyCollection<Guid>> GetProtectedSavePointIdsAsync(string layer, string? app)
{
// Return the IDs of the save points that must be kept.
IReadOnlyCollection<Guid> ids = Array.Empty<Guid>();
return Task.FromResult(ids);
}
}
```
A protected save point is never pruned and does not count toward the limit. Save point DTOs mark it with `isProtected`, the Designer lists it as protected, and the Designer API and MCP refuse to delete it. The application that protects it is responsible for deleting it when it no longer needs it.
Batches created by restoring a save point get a **Restore** badge in **History**.
Deleting a save point removes its row from the database. Deleting an app removes its history batches and save points too.

Loading…
Cancel
Save