feat(scum): rebuild plugin-owned management data
This commit is contained in:
@@ -1,121 +0,0 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"browser.local/platform/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GameGiftItemRequest struct {
|
||||
CatalogItemKey string `json:"catalogItemKey"`
|
||||
Quantity int `json:"quantity"`
|
||||
}
|
||||
type GameGiftItemResponse struct {
|
||||
CatalogItemKey string `json:"catalogItemKey"`
|
||||
Label string `json:"label"`
|
||||
Quantity int `json:"quantity"`
|
||||
}
|
||||
type GameGiftCatalogRequest struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
GameVersion string `json:"gameVersion"`
|
||||
Items []GameGiftItemRequest `json:"items"`
|
||||
}
|
||||
type GameGiftCatalogResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
GameVersion string `json:"gameVersion"`
|
||||
DraftItems []GameGiftItemResponse `json:"draftItems"`
|
||||
LatestRevisionID string `json:"latestRevisionId,omitempty"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
type GameGiftCatalogListResponse struct {
|
||||
Items []GameGiftCatalogResponse `json:"items"`
|
||||
}
|
||||
type GameGiftRevisionResponse struct {
|
||||
ID string `json:"id"`
|
||||
CatalogID string `json:"catalogId"`
|
||||
Revision int `json:"revision"`
|
||||
GameVersion string `json:"gameVersion"`
|
||||
Items []GameGiftItemResponse `json:"items"`
|
||||
PublishedBy string `json:"publishedBy"`
|
||||
PublishedAt time.Time `json:"publishedAt"`
|
||||
}
|
||||
type GameGiftRevisionListResponse struct {
|
||||
Items []GameGiftRevisionResponse `json:"items"`
|
||||
}
|
||||
type GameGiftGrantRequest struct {
|
||||
RevisionID string `json:"revisionId"`
|
||||
GamePlayerRecordID string `json:"gamePlayerRecordId"`
|
||||
Notice string `json:"notice"`
|
||||
IdempotencyKey string `json:"idempotencyKey"`
|
||||
}
|
||||
type GameGiftGrantResponse struct {
|
||||
ID string `json:"id"`
|
||||
RevisionID string `json:"revisionId"`
|
||||
RevisionNumber int `json:"revisionNumber"`
|
||||
GameVersion string `json:"gameVersion"`
|
||||
Items []GameGiftItemResponse `json:"items"`
|
||||
GamePlayerRecordID string `json:"gamePlayerRecordId"`
|
||||
PlayerDisplayName string `json:"playerDisplayName"`
|
||||
Notice string `json:"notice"`
|
||||
RequesterID string `json:"requesterId"`
|
||||
ApproverID string `json:"approverId,omitempty"`
|
||||
Status string `json:"status"`
|
||||
DeliverySummary string `json:"deliverySummary,omitempty"`
|
||||
NotificationSummary string `json:"notificationSummary,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ApprovedAt time.Time `json:"approvedAt,omitempty"`
|
||||
CompletedAt time.Time `json:"completedAt,omitempty"`
|
||||
}
|
||||
type GameGiftGrantListResponse struct {
|
||||
Items []GameGiftGrantResponse `json:"items"`
|
||||
}
|
||||
|
||||
func (r GameGiftCatalogRequest) ToDomain() domain.GameGiftCatalogRequest {
|
||||
items := make([]domain.GameGiftItem, len(r.Items))
|
||||
for i, item := range r.Items {
|
||||
def, _ := domain.SCUMGiftItemForVersion(r.GameVersion, item.CatalogItemKey)
|
||||
items[i] = domain.GameGiftItem{CatalogItemKey: item.CatalogItemKey, Label: def.Label, Quantity: item.Quantity}
|
||||
}
|
||||
return domain.GameGiftCatalogRequest{ID: r.ID, Name: r.Name, GameVersion: r.GameVersion, Items: items}
|
||||
}
|
||||
func (r GameGiftGrantRequest) ToDomain() domain.GameGiftGrantRequest {
|
||||
return domain.GameGiftGrantRequest{RevisionID: r.RevisionID, GamePlayerRecordID: r.GamePlayerRecordID, Notice: r.Notice, IdempotencyKey: r.IdempotencyKey}
|
||||
}
|
||||
func giftItems(items []domain.GameGiftItem) []GameGiftItemResponse {
|
||||
out := make([]GameGiftItemResponse, len(items))
|
||||
for i, item := range items {
|
||||
out[i] = GameGiftItemResponse{CatalogItemKey: item.CatalogItemKey, Label: item.Label, Quantity: item.Quantity}
|
||||
}
|
||||
return out
|
||||
}
|
||||
func GameGiftCatalogFromDomain(v domain.GameGiftCatalog) GameGiftCatalogResponse {
|
||||
return GameGiftCatalogResponse{ID: v.ID, Name: v.Name, GameVersion: v.GameVersion, DraftItems: giftItems(v.DraftItems), LatestRevisionID: v.LatestRevisionID, UpdatedAt: v.UpdatedAt}
|
||||
}
|
||||
func GameGiftCatalogsFromDomain(v []domain.GameGiftCatalog) GameGiftCatalogListResponse {
|
||||
out := make([]GameGiftCatalogResponse, len(v))
|
||||
for i, x := range v {
|
||||
out[i] = GameGiftCatalogFromDomain(x)
|
||||
}
|
||||
return GameGiftCatalogListResponse{Items: out}
|
||||
}
|
||||
func GameGiftRevisionFromDomain(v domain.GameGiftRevision) GameGiftRevisionResponse {
|
||||
return GameGiftRevisionResponse{ID: v.ID, CatalogID: v.CatalogID, Revision: v.Revision, GameVersion: v.GameVersion, Items: giftItems(v.Items), PublishedBy: v.PublishedBy, PublishedAt: v.PublishedAt}
|
||||
}
|
||||
func GameGiftRevisionsFromDomain(v []domain.GameGiftRevision) GameGiftRevisionListResponse {
|
||||
out := make([]GameGiftRevisionResponse, len(v))
|
||||
for i, x := range v {
|
||||
out[i] = GameGiftRevisionFromDomain(x)
|
||||
}
|
||||
return GameGiftRevisionListResponse{Items: out}
|
||||
}
|
||||
func GameGiftGrantFromDomain(v domain.GameGiftGrant) GameGiftGrantResponse {
|
||||
return GameGiftGrantResponse{ID: v.ID, RevisionID: v.RevisionID, RevisionNumber: v.RevisionNumber, GameVersion: v.GameVersion, Items: giftItems(v.Items), GamePlayerRecordID: v.GamePlayerRecordID, PlayerDisplayName: v.PlayerDisplayName, Notice: v.Notice, RequesterID: v.RequesterID, ApproverID: v.ApproverID, Status: string(v.Status), DeliverySummary: v.DeliverySummary, NotificationSummary: v.NotificationSummary, CreatedAt: v.CreatedAt, ApprovedAt: v.ApprovedAt, CompletedAt: v.CompletedAt}
|
||||
}
|
||||
func GameGiftGrantsFromDomain(v []domain.GameGiftGrant) GameGiftGrantListResponse {
|
||||
out := make([]GameGiftGrantResponse, len(v))
|
||||
for i, x := range v {
|
||||
out[i] = GameGiftGrantFromDomain(x)
|
||||
}
|
||||
return GameGiftGrantListResponse{Items: out}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"browser.local/platform/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GameMapTrajectoryPointResponse struct {
|
||||
MapX float64 `json:"mapX"`
|
||||
MapY float64 `json:"mapY"`
|
||||
OccurredAt time.Time `json:"occurredAt"`
|
||||
CollectedAt time.Time `json:"collectedAt"`
|
||||
Source string `json:"source"`
|
||||
}
|
||||
type GameMapTrajectoryEntityResponse struct {
|
||||
Kind string `json:"kind"`
|
||||
EntityID string `json:"entityId"`
|
||||
GamePlayerRecordID string `json:"gamePlayerRecordId,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Points []GameMapTrajectoryPointResponse `json:"points"`
|
||||
CollectedAt time.Time `json:"collectedAt,omitempty"`
|
||||
Sources []string `json:"sources"`
|
||||
}
|
||||
type GameMapTrajectorySegmentResponse struct {
|
||||
GamePlayerRecordID string `json:"gamePlayerRecordId"`
|
||||
VehicleID string `json:"vehicleId"`
|
||||
StartedAt time.Time `json:"startedAt"`
|
||||
EndedAt time.Time `json:"endedAt,omitempty"`
|
||||
}
|
||||
type GameMapTrajectoryMapResponse struct {
|
||||
MapID string `json:"mapId"`
|
||||
MapVersion string `json:"mapVersion"`
|
||||
ImageWidth float64 `json:"imageWidth"`
|
||||
ImageHeight float64 `json:"imageHeight"`
|
||||
Precision float64 `json:"precision"`
|
||||
}
|
||||
type GameMapTrajectoryResponse struct {
|
||||
Status string `json:"status"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Map *GameMapTrajectoryMapResponse `json:"map,omitempty"`
|
||||
From time.Time `json:"from,omitempty"`
|
||||
To time.Time `json:"to,omitempty"`
|
||||
Players []GameMapTrajectoryEntityResponse `json:"players"`
|
||||
Vehicles []GameMapTrajectoryEntityResponse `json:"vehicles"`
|
||||
RideSegments []GameMapTrajectorySegmentResponse `json:"rideSegments"`
|
||||
}
|
||||
|
||||
func GameMapTrajectoryFromDomain(value domain.GameMapTrajectoryView) GameMapTrajectoryResponse {
|
||||
value = domain.CopyGameMapTrajectoryView(value)
|
||||
response := GameMapTrajectoryResponse{Status: value.Status, Reason: value.Reason, From: value.From, To: value.To, Players: mapTrajectoryEntitiesFromDomain(value.Players), Vehicles: mapTrajectoryEntitiesFromDomain(value.Vehicles), RideSegments: make([]GameMapTrajectorySegmentResponse, len(value.RideSegments))}
|
||||
if value.Status != "missing-map" {
|
||||
response.Map = &GameMapTrajectoryMapResponse{MapID: value.Map.MapID, MapVersion: value.Map.MapVersion, ImageWidth: value.Map.ImageWidth, ImageHeight: value.Map.ImageHeight, Precision: value.Map.Precision}
|
||||
}
|
||||
for i, segment := range value.RideSegments {
|
||||
response.RideSegments[i] = GameMapTrajectorySegmentResponse{GamePlayerRecordID: segment.GamePlayerRecordID, VehicleID: segment.VehicleID, StartedAt: segment.StartedAt, EndedAt: segment.EndedAt}
|
||||
}
|
||||
return response
|
||||
}
|
||||
func mapTrajectoryEntitiesFromDomain(values []domain.GameMapTrajectoryEntity) []GameMapTrajectoryEntityResponse {
|
||||
result := make([]GameMapTrajectoryEntityResponse, len(values))
|
||||
for i, value := range values {
|
||||
points := make([]GameMapTrajectoryPointResponse, len(value.Points))
|
||||
for j, point := range value.Points {
|
||||
points[j] = GameMapTrajectoryPointResponse{MapX: point.MapX, MapY: point.MapY, OccurredAt: point.OccurredAt, CollectedAt: point.CollectedAt, Source: point.Source}
|
||||
}
|
||||
result[i] = GameMapTrajectoryEntityResponse{Kind: string(value.Kind), EntityID: value.EntityID, GamePlayerRecordID: value.GamePlayerRecordID, Label: value.Label, Points: points, CollectedAt: value.CollectedAt, Sources: domain.CopyStringSlice(value.Sources)}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"browser.local/platform/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GamePlayerStateFieldResponse struct {
|
||||
Key string `json:"key"`
|
||||
Label string `json:"label"`
|
||||
Kind string `json:"kind"`
|
||||
Minimum float64 `json:"minimum"`
|
||||
Maximum float64 `json:"maximum"`
|
||||
Value float64 `json:"value"`
|
||||
}
|
||||
type GamePlayerStateResponse struct {
|
||||
GameVersion string `json:"gameVersion"`
|
||||
StateVersion string `json:"stateVersion"`
|
||||
SafetyWindow string `json:"safetyWindow,omitempty"`
|
||||
MaintenanceVerified bool `json:"maintenanceVerified"`
|
||||
PlayerOnline bool `json:"playerOnline"`
|
||||
Supported bool `json:"supported"`
|
||||
Fields []GamePlayerStateFieldResponse `json:"fields"`
|
||||
ObservedAt time.Time `json:"observedAt"`
|
||||
}
|
||||
type GamePlayerStatePatchChangeRequest struct {
|
||||
FieldKey string `json:"fieldKey"`
|
||||
Before float64 `json:"before"`
|
||||
After float64 `json:"after"`
|
||||
}
|
||||
type GamePlayerStatePatchRequest struct {
|
||||
GameVersion string `json:"gameVersion"`
|
||||
ExpectedStateVersion string `json:"expectedStateVersion"`
|
||||
SafetyWindow string `json:"safetyWindow"`
|
||||
Changes []GamePlayerStatePatchChangeRequest `json:"changes"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
type GamePlayerStatePatchChangeResponse struct {
|
||||
FieldKey string `json:"fieldKey"`
|
||||
Before float64 `json:"before"`
|
||||
After float64 `json:"after"`
|
||||
}
|
||||
type GamePlayerStatePatchResponse struct {
|
||||
ID string `json:"id"`
|
||||
GameVersion string `json:"gameVersion"`
|
||||
ExpectedStateVersion string `json:"expectedStateVersion"`
|
||||
Changes []GamePlayerStatePatchChangeResponse `json:"changes"`
|
||||
Reason string `json:"reason"`
|
||||
RequesterID string `json:"requesterId"`
|
||||
ApproverID string `json:"approverId,omitempty"`
|
||||
Status string `json:"status"`
|
||||
BridgeCommandID string `json:"bridgeCommandId,omitempty"`
|
||||
ExecutionSummary string `json:"executionSummary,omitempty"`
|
||||
ConfirmedStateVersion string `json:"confirmedStateVersion,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ApprovedAt time.Time `json:"approvedAt,omitempty"`
|
||||
CompletedAt time.Time `json:"completedAt,omitempty"`
|
||||
}
|
||||
type GamePlayerStatePatchListResponse struct {
|
||||
Items []GamePlayerStatePatchResponse `json:"items"`
|
||||
}
|
||||
|
||||
func (request GamePlayerStatePatchRequest) ToDomain() domain.GamePlayerStatePatchRequest {
|
||||
changes := make([]domain.GamePlayerStatePatchChange, len(request.Changes))
|
||||
for i, change := range request.Changes {
|
||||
changes[i] = domain.GamePlayerStatePatchChange{FieldKey: change.FieldKey, Before: change.Before, After: change.After}
|
||||
}
|
||||
return domain.GamePlayerStatePatchRequest{GameVersion: request.GameVersion, ExpectedStateVersion: request.ExpectedStateVersion, SafetyWindow: request.SafetyWindow, Changes: changes, Reason: request.Reason}
|
||||
}
|
||||
func GamePlayerStateFromDomain(value domain.GamePlayerStateSnapshot) GamePlayerStateResponse {
|
||||
catalog, supported := domain.SCUMPlayerStateCatalogForVersion(value.GameVersion)
|
||||
fields := make([]GamePlayerStateFieldResponse, 0, len(catalog.Fields))
|
||||
for _, field := range catalog.Fields {
|
||||
fields = append(fields, GamePlayerStateFieldResponse{Key: field.Key, Label: field.Label, Kind: string(field.Kind), Minimum: field.Minimum, Maximum: field.Maximum, Value: value.Fields[field.Key]})
|
||||
}
|
||||
return GamePlayerStateResponse{GameVersion: value.GameVersion, StateVersion: value.StateVersion, SafetyWindow: value.SafetyWindow, MaintenanceVerified: value.MaintenanceVerified, PlayerOnline: value.PlayerOnline, Supported: supported, Fields: fields, ObservedAt: value.ObservedAt}
|
||||
}
|
||||
func GamePlayerStatePatchFromDomain(value domain.GamePlayerStatePatch) GamePlayerStatePatchResponse {
|
||||
changes := make([]GamePlayerStatePatchChangeResponse, len(value.Changes))
|
||||
for i, change := range value.Changes {
|
||||
changes[i] = GamePlayerStatePatchChangeResponse{FieldKey: change.FieldKey, Before: change.Before, After: change.After}
|
||||
}
|
||||
return GamePlayerStatePatchResponse{ID: value.ID, GameVersion: value.GameVersion, ExpectedStateVersion: value.ExpectedStateVersion, Changes: changes, Reason: value.Reason, RequesterID: value.RequesterID, ApproverID: value.ApproverID, Status: string(value.Status), BridgeCommandID: value.BridgeCommandID, ExecutionSummary: value.ExecutionSummary, ConfirmedStateVersion: value.ConfirmedStateVersion, CreatedAt: value.CreatedAt, ApprovedAt: value.ApprovedAt, CompletedAt: value.CompletedAt}
|
||||
}
|
||||
func GamePlayerStatePatchesFromDomain(values []domain.GamePlayerStatePatch) GamePlayerStatePatchListResponse {
|
||||
items := make([]GamePlayerStatePatchResponse, len(values))
|
||||
for i, value := range values {
|
||||
items[i] = GamePlayerStatePatchFromDomain(value)
|
||||
}
|
||||
return GamePlayerStatePatchListResponse{Items: items}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"browser.local/platform/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GamePlayerResponse struct {
|
||||
ID string `json:"id"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
GamePlayerID string `json:"gamePlayerId"`
|
||||
DisplayName string `json:"displayName"`
|
||||
FirstSeenAt time.Time `json:"firstSeenAt"`
|
||||
LastSeenAt time.Time `json:"lastSeenAt"`
|
||||
}
|
||||
type GamePlayerAliasResponse struct {
|
||||
Alias string `json:"alias"`
|
||||
FirstSeenAt time.Time `json:"firstSeenAt"`
|
||||
LastSeenAt time.Time `json:"lastSeenAt"`
|
||||
}
|
||||
type GamePlayerSessionResponse struct {
|
||||
ID string `json:"id"`
|
||||
SourceSessionID string `json:"sourceSessionId"`
|
||||
StartedAt time.Time `json:"startedAt"`
|
||||
EndedAt time.Time `json:"endedAt,omitempty"`
|
||||
EndReason string `json:"endReason,omitempty"`
|
||||
}
|
||||
type GameAccessAttemptResponse struct {
|
||||
ID string `json:"id"`
|
||||
OccurredAt time.Time `json:"occurredAt"`
|
||||
Outcome string `json:"outcome"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
type GameSecuritySignalResponse struct {
|
||||
ID string `json:"id"`
|
||||
RuleKey string `json:"ruleKey"`
|
||||
Status string `json:"status"`
|
||||
EvidenceCount int `json:"evidenceCount"`
|
||||
Summary string `json:"summary"`
|
||||
FirstObservedAt time.Time `json:"firstObservedAt"`
|
||||
LastObservedAt time.Time `json:"lastObservedAt"`
|
||||
}
|
||||
type GamePlayerProfileResponse struct {
|
||||
Player GamePlayerResponse `json:"player"`
|
||||
Aliases []GamePlayerAliasResponse `json:"aliases"`
|
||||
Sessions []GamePlayerSessionResponse `json:"sessions"`
|
||||
AccessAttempts []GameAccessAttemptResponse `json:"accessAttempts"`
|
||||
SecuritySignals []GameSecuritySignalResponse `json:"securitySignals"`
|
||||
}
|
||||
type GamePlayerListResponse struct {
|
||||
Items []GamePlayerResponse `json:"items"`
|
||||
}
|
||||
|
||||
func GamePlayersFromDomain(values []domain.GamePlayer) []GamePlayerResponse {
|
||||
out := make([]GamePlayerResponse, len(values))
|
||||
for i, v := range values {
|
||||
out[i] = gamePlayerFromDomain(v)
|
||||
}
|
||||
return out
|
||||
}
|
||||
func GamePlayerListFromDomain(values []domain.GamePlayer) GamePlayerListResponse {
|
||||
return GamePlayerListResponse{Items: GamePlayersFromDomain(values)}
|
||||
}
|
||||
func GamePlayerProfileFromDomain(v domain.GamePlayerProfile) GamePlayerProfileResponse {
|
||||
out := GamePlayerProfileResponse{Player: gamePlayerFromDomain(v.Player), Aliases: make([]GamePlayerAliasResponse, len(v.Aliases)), Sessions: make([]GamePlayerSessionResponse, len(v.Sessions)), AccessAttempts: make([]GameAccessAttemptResponse, len(v.AccessAttempts)), SecuritySignals: make([]GameSecuritySignalResponse, len(v.SecuritySignals))}
|
||||
for i, x := range v.Aliases {
|
||||
out.Aliases[i] = GamePlayerAliasResponse{Alias: x.Alias, FirstSeenAt: x.FirstSeenAt, LastSeenAt: x.LastSeenAt}
|
||||
}
|
||||
for i, x := range v.Sessions {
|
||||
out.Sessions[i] = GamePlayerSessionResponse{ID: x.ID, SourceSessionID: x.SourceSessionID, StartedAt: x.StartedAt, EndedAt: x.EndedAt, EndReason: x.EndReason}
|
||||
}
|
||||
for i, x := range v.AccessAttempts {
|
||||
out.AccessAttempts[i] = GameAccessAttemptResponse{ID: x.ID, OccurredAt: x.OccurredAt, Outcome: x.Outcome, Reason: x.Reason}
|
||||
}
|
||||
for i, x := range v.SecuritySignals {
|
||||
out.SecuritySignals[i] = GameSecuritySignalResponse{ID: x.ID, RuleKey: x.RuleKey, Status: string(x.Status), EvidenceCount: x.EvidenceCount, Summary: x.Summary, FirstObservedAt: x.FirstObservedAt, LastObservedAt: x.LastObservedAt}
|
||||
}
|
||||
return out
|
||||
}
|
||||
func gamePlayerFromDomain(v domain.GamePlayer) GamePlayerResponse {
|
||||
return GamePlayerResponse{ID: v.ID, ServerInstanceID: v.ServerInstanceID, GamePlayerID: v.GamePlayerID, DisplayName: v.DisplayName, FirstSeenAt: v.FirstSeenAt, LastSeenAt: v.LastSeenAt}
|
||||
}
|
||||
@@ -11,6 +11,24 @@ type PluginDataPutRequest struct {
|
||||
Value map[string]any `json:"value"`
|
||||
}
|
||||
|
||||
type PluginDataMutationBody struct {
|
||||
Operation string `json:"operation"`
|
||||
Key string `json:"key"`
|
||||
Value map[string]any `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
type PluginDataTransactionRequest struct {
|
||||
Mutations []PluginDataMutationBody `json:"mutations"`
|
||||
}
|
||||
|
||||
func (request PluginDataTransactionRequest) ToDomain(pluginID, serverInstanceID, collection string) domain.PluginDataTransaction {
|
||||
mutations := make([]domain.PluginDataMutation, len(request.Mutations))
|
||||
for index, mutation := range request.Mutations {
|
||||
mutations[index] = domain.PluginDataMutation{Operation: domain.PluginDataMutationOperation(mutation.Operation), Key: mutation.Key, Value: mutation.Value}
|
||||
}
|
||||
return domain.PluginDataTransaction{PluginID: pluginID, ServerInstanceID: serverInstanceID, Collection: collection, Mutations: mutations}
|
||||
}
|
||||
|
||||
type PluginDataRecordResponse struct {
|
||||
Key string `json:"key"`
|
||||
Value map[string]any `json:"value"`
|
||||
|
||||
+47
-51
@@ -290,16 +290,31 @@ type GameClientBridgeSnapshotDeclarationBody struct {
|
||||
}
|
||||
|
||||
type GameClientBridgeQueryTemplateDeclarationBody struct {
|
||||
Key string `json:"key"`
|
||||
Title string `json:"title"`
|
||||
Permission string `json:"permission"`
|
||||
Engine string `json:"engine"`
|
||||
TransportKey string `json:"transportKey"`
|
||||
TargetKey string `json:"targetKey"`
|
||||
ParameterSchemaRef string `json:"parameterSchemaRef"`
|
||||
ResultSchemaRef string `json:"resultSchemaRef"`
|
||||
MaxRows int `json:"maxRows"`
|
||||
TimeoutSeconds int `json:"timeoutSeconds"`
|
||||
Key string `json:"key"`
|
||||
Title string `json:"title"`
|
||||
Permission string `json:"permission"`
|
||||
Engine string `json:"engine"`
|
||||
TransportKey string `json:"transportKey"`
|
||||
TargetKey string `json:"targetKey"`
|
||||
ParameterSchemaRef string `json:"parameterSchemaRef"`
|
||||
ResultSchemaRef string `json:"resultSchemaRef"`
|
||||
SQLRef string `json:"sqlRef,omitempty"`
|
||||
MaxRows int `json:"maxRows"`
|
||||
TimeoutSeconds int `json:"timeoutSeconds"`
|
||||
RowTarget *PluginDataRowTargetDeclarationBody `json:"rowTarget,omitempty"`
|
||||
}
|
||||
|
||||
type PluginDataRowTargetDeclarationBody struct {
|
||||
Collection string `json:"collection"`
|
||||
UpsertKeys []string `json:"upsertKeys"`
|
||||
ColumnMappings map[string]string `json:"columnMappings"`
|
||||
}
|
||||
|
||||
type GameClientBridgeDataPackDeclarationBody struct {
|
||||
Key string `json:"key"`
|
||||
DatabaseUserVersion int `json:"databaseUserVersion"`
|
||||
LogParserRefs []string `json:"logParserRefs"`
|
||||
ConfigMapRefs []string `json:"configMapRefs"`
|
||||
}
|
||||
|
||||
type GameClientBridgeOperationSafetyBody struct {
|
||||
@@ -377,6 +392,7 @@ type GameClientBridgeManifestBody struct {
|
||||
Commands []GameClientBridgeCommandDeclarationBody `json:"commands"`
|
||||
Snapshots []GameClientBridgeSnapshotDeclarationBody `json:"snapshots"`
|
||||
QueryTemplates []GameClientBridgeQueryTemplateDeclarationBody `json:"queryTemplates,omitempty"`
|
||||
DataPacks []GameClientBridgeDataPackDeclarationBody `json:"dataPacks,omitempty"`
|
||||
OperationTemplates []GameClientBridgeOperationTemplateDeclarationBody `json:"operationTemplates,omitempty"`
|
||||
CommandRetentionSeconds int `json:"commandRetentionSeconds"`
|
||||
MaxCommands int `json:"maxCommands"`
|
||||
@@ -384,21 +400,6 @@ type GameClientBridgeManifestBody struct {
|
||||
Features []GameClientBridgeFeatureDeclarationBody `json:"features,omitempty"`
|
||||
Companion *GameClientBridgeCompanionDeclarationBody `json:"companion,omitempty"`
|
||||
}
|
||||
type GameMapTrajectoryDeclarationBody struct {
|
||||
MapID string `json:"mapId"`
|
||||
MapVersion string `json:"mapVersion"`
|
||||
WorldMinX float64 `json:"worldMinX"`
|
||||
WorldMinY float64 `json:"worldMinY"`
|
||||
WorldMaxX float64 `json:"worldMaxX"`
|
||||
WorldMaxY float64 `json:"worldMaxY"`
|
||||
ImageWidth float64 `json:"imageWidth"`
|
||||
ImageHeight float64 `json:"imageHeight"`
|
||||
Precision float64 `json:"precision"`
|
||||
SampleDistance float64 `json:"sampleDistance"`
|
||||
SampleIntervalSeconds int `json:"sampleIntervalSeconds"`
|
||||
RetentionSeconds int `json:"retentionSeconds"`
|
||||
}
|
||||
|
||||
type GamePluginManifestBody struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -419,7 +420,6 @@ type GamePluginManifestBody struct {
|
||||
RemoteAccess GamePluginRemoteAccessBody `json:"remoteAccess,omitempty"`
|
||||
RuntimeProfiles GamePluginRuntimeProfilesBody `json:"runtimeProfiles,omitempty"`
|
||||
GameClientBridge GameClientBridgeManifestBody `json:"gameClientBridge,omitempty"`
|
||||
MapTrajectories *GameMapTrajectoryDeclarationBody `json:"mapTrajectories,omitempty"`
|
||||
}
|
||||
|
||||
type GamePluginManifestRegistrationRequest struct {
|
||||
@@ -458,7 +458,6 @@ type GamePluginCreateRequest struct {
|
||||
RemoteAccess GamePluginRemoteAccessBody `json:"remoteAccess,omitempty"`
|
||||
RuntimeProfiles GamePluginRuntimeProfilesBody `json:"runtimeProfiles,omitempty"`
|
||||
GameClientBridge GameClientBridgeManifestBody `json:"gameClientBridge,omitempty"`
|
||||
MapTrajectories *GameMapTrajectoryDeclarationBody `json:"mapTrajectories,omitempty"`
|
||||
ValidationViolations []string `json:"validationViolations,omitempty"`
|
||||
}
|
||||
|
||||
@@ -486,7 +485,6 @@ type GamePluginResponse struct {
|
||||
RemoteAccess GamePluginRemoteAccessBody `json:"remoteAccess,omitempty"`
|
||||
RuntimeProfiles GamePluginRuntimeProfilesResponseBody `json:"runtimeProfiles,omitempty"`
|
||||
GameClientBridge GameClientBridgeManifestBody `json:"gameClientBridge,omitempty"`
|
||||
MapTrajectories *GameMapTrajectoryDeclarationBody `json:"mapTrajectories,omitempty"`
|
||||
ValidationViolations []string `json:"validationViolations,omitempty"`
|
||||
Status domain.GamePluginStatus `json:"status"`
|
||||
}
|
||||
@@ -518,7 +516,6 @@ type MarketplacePluginResponse struct {
|
||||
RemoteAccess GamePluginRemoteAccessBody `json:"remoteAccess,omitempty"`
|
||||
RuntimeProfiles GamePluginRuntimeProfilesResponseBody `json:"runtimeProfiles,omitempty"`
|
||||
GameClientBridge GameClientBridgeManifestBody `json:"gameClientBridge,omitempty"`
|
||||
MapTrajectories *GameMapTrajectoryDeclarationBody `json:"mapTrajectories,omitempty"`
|
||||
ValidationViolations []string `json:"validationViolations,omitempty"`
|
||||
Status domain.GamePluginStatus `json:"status"`
|
||||
Source string `json:"source"`
|
||||
@@ -1082,7 +1079,6 @@ func (request GamePluginManifestRegistrationRequest) ToDomain() domain.GamePlugi
|
||||
RemoteAccess: request.Manifest.RemoteAccess.ToDomain(),
|
||||
RuntimeProfiles: request.Manifest.RuntimeProfiles.ToDomain(),
|
||||
GameClientBridge: request.Manifest.GameClientBridge.ToDomain(),
|
||||
MapTrajectories: mapTrajectoryDeclarationToDomain(request.Manifest.MapTrajectories),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1098,20 +1094,6 @@ func pluginAssetFilesToDomain(files []PluginAssetFileBody) []domain.PluginAssetF
|
||||
return out
|
||||
}
|
||||
|
||||
func mapTrajectoryDeclarationToDomain(value *GameMapTrajectoryDeclarationBody) *domain.GameMapTrajectoryDeclaration {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
result := domain.GameMapTrajectoryDeclaration{MapID: value.MapID, MapVersion: value.MapVersion, WorldMinX: value.WorldMinX, WorldMinY: value.WorldMinY, WorldMaxX: value.WorldMaxX, WorldMaxY: value.WorldMaxY, ImageWidth: value.ImageWidth, ImageHeight: value.ImageHeight, Precision: value.Precision, SampleDistance: value.SampleDistance, SampleIntervalSeconds: value.SampleIntervalSeconds, RetentionSeconds: value.RetentionSeconds}
|
||||
return &result
|
||||
}
|
||||
func mapTrajectoryDeclarationFromDomain(value *domain.GameMapTrajectoryDeclaration) *GameMapTrajectoryDeclarationBody {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
return &GameMapTrajectoryDeclarationBody{MapID: value.MapID, MapVersion: value.MapVersion, WorldMinX: value.WorldMinX, WorldMinY: value.WorldMinY, WorldMaxX: value.WorldMaxX, WorldMaxY: value.WorldMaxY, ImageWidth: value.ImageWidth, ImageHeight: value.ImageHeight, Precision: value.Precision, SampleDistance: value.SampleDistance, SampleIntervalSeconds: value.SampleIntervalSeconds, RetentionSeconds: value.RetentionSeconds}
|
||||
}
|
||||
|
||||
func fileWorkspaceToDomain(body PluginFileWorkspaceBody) domain.PluginFileWorkspace {
|
||||
workspace := domain.PluginFileWorkspace{DefaultDirectoryKey: body.DefaultDirectoryKey}
|
||||
for _, item := range body.Directories {
|
||||
@@ -1205,7 +1187,16 @@ func (body GameClientBridgeManifestBody) ToDomain() domain.GameClientBridgeManif
|
||||
}
|
||||
queryTemplates := make([]domain.GameClientBridgeQueryTemplateDeclaration, len(body.QueryTemplates))
|
||||
for index, template := range body.QueryTemplates {
|
||||
queryTemplates[index] = domain.GameClientBridgeQueryTemplateDeclaration{Key: template.Key, Title: template.Title, Permission: template.Permission, Engine: template.Engine, TransportKey: template.TransportKey, TargetKey: template.TargetKey, ParameterSchemaRef: template.ParameterSchemaRef, ResultSchemaRef: template.ResultSchemaRef, MaxRows: template.MaxRows, TimeoutSeconds: template.TimeoutSeconds}
|
||||
var rowTarget *domain.PluginDataRowTargetDeclaration
|
||||
if template.RowTarget != nil {
|
||||
value := domain.PluginDataRowTargetDeclaration{Collection: template.RowTarget.Collection, UpsertKeys: domain.CopyStringSlice(template.RowTarget.UpsertKeys), ColumnMappings: domain.CopyStringMap(template.RowTarget.ColumnMappings)}
|
||||
rowTarget = &value
|
||||
}
|
||||
queryTemplates[index] = domain.GameClientBridgeQueryTemplateDeclaration{Key: template.Key, Title: template.Title, Permission: template.Permission, Engine: template.Engine, TransportKey: template.TransportKey, TargetKey: template.TargetKey, ParameterSchemaRef: template.ParameterSchemaRef, ResultSchemaRef: template.ResultSchemaRef, SQLRef: template.SQLRef, MaxRows: template.MaxRows, TimeoutSeconds: template.TimeoutSeconds, RowTarget: rowTarget}
|
||||
}
|
||||
dataPacks := make([]domain.GameClientBridgeDataPackDeclaration, len(body.DataPacks))
|
||||
for index, dataPack := range body.DataPacks {
|
||||
dataPacks[index] = domain.GameClientBridgeDataPackDeclaration{Key: dataPack.Key, DatabaseUserVersion: dataPack.DatabaseUserVersion, LogParserRefs: domain.CopyStringSlice(dataPack.LogParserRefs), ConfigMapRefs: domain.CopyStringSlice(dataPack.ConfigMapRefs)}
|
||||
}
|
||||
operationTemplates := make([]domain.GameClientBridgeOperationTemplateDeclaration, len(body.OperationTemplates))
|
||||
for index, template := range body.OperationTemplates {
|
||||
@@ -1223,7 +1214,7 @@ func (body GameClientBridgeManifestBody) ToDomain() domain.GameClientBridgeManif
|
||||
if body.Companion != nil {
|
||||
companion = domain.GameClientBridgeCompanionDeclaration{ProfileKey: body.Companion.ProfileKey, ConfigTemplateKey: body.Companion.ConfigTemplateKey, ConfigSchemaRef: body.Companion.ConfigSchemaRef, ConfigFormat: body.Companion.ConfigFormat, PlatformBaseURLSource: body.Companion.PlatformBaseURLSource, RegistrationProof: body.Companion.RegistrationProof, ProofMaterialSource: body.Companion.ProofMaterialSource, ProofMaterialEnv: body.Companion.ProofMaterialEnv, SessionMode: body.Companion.SessionMode, TLSPolicy: body.Companion.TLSPolicy, HeartbeatIntervalSeconds: body.Companion.HeartbeatIntervalSeconds, CommandPollIntervalSeconds: body.Companion.CommandPollIntervalSeconds, RequestTimeoutSeconds: body.Companion.RequestTimeoutSeconds}
|
||||
}
|
||||
return domain.GameClientBridgeManifest{Commands: commands, Snapshots: snapshots, QueryTemplates: queryTemplates, OperationTemplates: operationTemplates, Retention: domain.GameClientBridgeRetention{KeepForSeconds: body.CommandRetentionSeconds, MaxRecords: body.MaxCommands}, Pages: pages, Features: features, Companion: companion}
|
||||
return domain.GameClientBridgeManifest{Commands: commands, Snapshots: snapshots, QueryTemplates: queryTemplates, DataPacks: dataPacks, OperationTemplates: operationTemplates, Retention: domain.GameClientBridgeRetention{KeepForSeconds: body.CommandRetentionSeconds, MaxRecords: body.MaxCommands}, Pages: pages, Features: features, Companion: companion}
|
||||
}
|
||||
|
||||
func protectedRequestToDomain(value *GameClientBridgeProtectedRequestDeclarationBody) *domain.GameClientBridgeProtectedRequestDeclaration {
|
||||
@@ -1268,7 +1259,6 @@ func (request GamePluginCreateRequest) ToDomain() domain.GamePlugin {
|
||||
RemoteAccess: request.RemoteAccess.ToDomain(),
|
||||
RuntimeProfiles: request.RuntimeProfiles.ToDomain(),
|
||||
GameClientBridge: request.GameClientBridge.ToDomain(),
|
||||
MapTrajectories: mapTrajectoryDeclarationToDomain(request.MapTrajectories),
|
||||
ValidationViolations: domain.CopyStringSlice(request.ValidationViolations),
|
||||
}
|
||||
}
|
||||
@@ -1521,7 +1511,6 @@ func GamePluginFromDomain(plugin domain.GamePlugin) GamePluginResponse {
|
||||
RemoteAccess: remoteAccessFromDomain(plugin.RemoteAccess),
|
||||
RuntimeProfiles: runtimeProfilesFromDomain(plugin.RuntimeProfiles),
|
||||
GameClientBridge: gameClientBridgeManifestFromDomain(plugin.GameClientBridge),
|
||||
MapTrajectories: mapTrajectoryDeclarationFromDomain(plugin.MapTrajectories),
|
||||
ValidationViolations: plugin.ValidationViolations,
|
||||
Status: plugin.Status,
|
||||
}
|
||||
@@ -1613,7 +1602,6 @@ func MarketplacePluginFromDomain(plugin domain.PluginMarketplacePlugin) Marketpl
|
||||
RemoteAccess: remoteAccessFromDomain(plugin.RemoteAccess),
|
||||
RuntimeProfiles: runtimeProfilesFromDomain(plugin.RuntimeProfiles),
|
||||
GameClientBridge: gameClientBridgeManifestFromDomain(plugin.GameClientBridge),
|
||||
MapTrajectories: mapTrajectoryDeclarationFromDomain(plugin.MapTrajectories),
|
||||
ValidationViolations: plugin.ValidationViolations,
|
||||
Status: plugin.Status,
|
||||
Source: plugin.Source,
|
||||
@@ -1637,7 +1625,15 @@ func gameClientBridgeManifestFromDomain(value domain.GameClientBridgeManifest) G
|
||||
}
|
||||
queryTemplates := make([]GameClientBridgeQueryTemplateDeclarationBody, len(value.QueryTemplates))
|
||||
for index, template := range value.QueryTemplates {
|
||||
queryTemplates[index] = GameClientBridgeQueryTemplateDeclarationBody{Key: template.Key, Title: template.Title, Permission: template.Permission, Engine: template.Engine, TransportKey: template.TransportKey, TargetKey: template.TargetKey, ParameterSchemaRef: template.ParameterSchemaRef, ResultSchemaRef: template.ResultSchemaRef, MaxRows: template.MaxRows, TimeoutSeconds: template.TimeoutSeconds}
|
||||
var rowTarget *PluginDataRowTargetDeclarationBody
|
||||
if template.RowTarget != nil {
|
||||
rowTarget = &PluginDataRowTargetDeclarationBody{Collection: template.RowTarget.Collection, UpsertKeys: domain.CopyStringSlice(template.RowTarget.UpsertKeys), ColumnMappings: domain.CopyStringMap(template.RowTarget.ColumnMappings)}
|
||||
}
|
||||
queryTemplates[index] = GameClientBridgeQueryTemplateDeclarationBody{Key: template.Key, Title: template.Title, Permission: template.Permission, Engine: template.Engine, TransportKey: template.TransportKey, TargetKey: template.TargetKey, ParameterSchemaRef: template.ParameterSchemaRef, ResultSchemaRef: template.ResultSchemaRef, SQLRef: template.SQLRef, MaxRows: template.MaxRows, TimeoutSeconds: template.TimeoutSeconds, RowTarget: rowTarget}
|
||||
}
|
||||
dataPacks := make([]GameClientBridgeDataPackDeclarationBody, len(value.DataPacks))
|
||||
for index, dataPack := range value.DataPacks {
|
||||
dataPacks[index] = GameClientBridgeDataPackDeclarationBody{Key: dataPack.Key, DatabaseUserVersion: dataPack.DatabaseUserVersion, LogParserRefs: domain.CopyStringSlice(dataPack.LogParserRefs), ConfigMapRefs: domain.CopyStringSlice(dataPack.ConfigMapRefs)}
|
||||
}
|
||||
operationTemplates := make([]GameClientBridgeOperationTemplateDeclarationBody, len(value.OperationTemplates))
|
||||
for index, template := range value.OperationTemplates {
|
||||
@@ -1655,7 +1651,7 @@ func gameClientBridgeManifestFromDomain(value domain.GameClientBridgeManifest) G
|
||||
if value.Companion.ProfileKey != "" {
|
||||
companion = &GameClientBridgeCompanionDeclarationBody{ProfileKey: value.Companion.ProfileKey, ConfigTemplateKey: value.Companion.ConfigTemplateKey, ConfigSchemaRef: value.Companion.ConfigSchemaRef, ConfigFormat: value.Companion.ConfigFormat, PlatformBaseURLSource: value.Companion.PlatformBaseURLSource, RegistrationProof: value.Companion.RegistrationProof, ProofMaterialSource: value.Companion.ProofMaterialSource, ProofMaterialEnv: value.Companion.ProofMaterialEnv, SessionMode: value.Companion.SessionMode, TLSPolicy: value.Companion.TLSPolicy, HeartbeatIntervalSeconds: value.Companion.HeartbeatIntervalSeconds, CommandPollIntervalSeconds: value.Companion.CommandPollIntervalSeconds, RequestTimeoutSeconds: value.Companion.RequestTimeoutSeconds}
|
||||
}
|
||||
return GameClientBridgeManifestBody{Commands: commands, Snapshots: snapshots, QueryTemplates: queryTemplates, OperationTemplates: operationTemplates, CommandRetentionSeconds: value.Retention.KeepForSeconds, MaxCommands: value.Retention.MaxRecords, Pages: pages, Features: features, Companion: companion}
|
||||
return GameClientBridgeManifestBody{Commands: commands, Snapshots: snapshots, QueryTemplates: queryTemplates, DataPacks: dataPacks, OperationTemplates: operationTemplates, CommandRetentionSeconds: value.Retention.KeepForSeconds, MaxCommands: value.Retention.MaxRecords, Pages: pages, Features: features, Companion: companion}
|
||||
}
|
||||
|
||||
func protectedRequestFromDomain(value *domain.GameClientBridgeProtectedRequestDeclaration) *GameClientBridgeProtectedRequestDeclarationBody {
|
||||
|
||||
@@ -137,17 +137,24 @@ func TestGameClientBridgeQueryTemplateDeclarationRoundTripIsSafe(t *testing.T) {
|
||||
body := GameClientBridgeManifestBody{
|
||||
QueryTemplates: []GameClientBridgeQueryTemplateDeclarationBody{{
|
||||
Key: "player.lookup", Title: "Player lookup", Permission: "server.game-client.read", Engine: "sqlite", TransportKey: "sqlite-db", TargetKey: "db/sqlite",
|
||||
ParameterSchemaRef: "schemas/bridge/query/player-lookup.parameters.schema.json", ResultSchemaRef: "schemas/bridge/query/player-lookup.result.schema.json", MaxRows: 50, TimeoutSeconds: 10,
|
||||
ParameterSchemaRef: "schemas/bridge/query/player-lookup.parameters.schema.json", ResultSchemaRef: "schemas/bridge/query/player-lookup.result.schema.json", SQLRef: "sql/player-lookup.sql", MaxRows: 50, TimeoutSeconds: 10,
|
||||
RowTarget: &PluginDataRowTargetDeclarationBody{Collection: "users", UpsertKeys: []string{"userId"}, ColumnMappings: map[string]string{"userId": "user_id"}},
|
||||
}},
|
||||
DataPacks: []GameClientBridgeDataPackDeclarationBody{{Key: "db-v1", DatabaseUserVersion: 1, LogParserRefs: []string{"data/logs.json"}, ConfigMapRefs: []string{"data/config.json"}}},
|
||||
CommandRetentionSeconds: 86400,
|
||||
MaxCommands: 1000,
|
||||
Pages: []GameClientBridgePageContractBody{{PageKey: "players", QueryTemplateKeys: []string{"player.lookup"}}},
|
||||
}
|
||||
|
||||
domainManifest := body.ToDomain()
|
||||
if len(domainManifest.QueryTemplates) != 1 || domainManifest.QueryTemplates[0].TransportKey != "sqlite-db" || domainManifest.QueryTemplates[0].MaxRows != 50 || domainManifest.Pages[0].QueryTemplateKeys[0] != "player.lookup" {
|
||||
if len(domainManifest.QueryTemplates) != 1 || domainManifest.QueryTemplates[0].SQLRef != "sql/player-lookup.sql" || domainManifest.QueryTemplates[0].RowTarget.Collection != "users" || len(domainManifest.DataPacks) != 1 || domainManifest.Pages[0].QueryTemplateKeys[0] != "player.lookup" {
|
||||
t.Fatalf("query template conversion lost declaration fields: %#v", domainManifest)
|
||||
}
|
||||
domainManifest.QueryTemplates[0].RowTarget.ColumnMappings["userId"] = "mutated"
|
||||
if body.QueryTemplates[0].RowTarget.ColumnMappings["userId"] != "user_id" {
|
||||
t.Fatal("query template row target aliases request DTO data")
|
||||
}
|
||||
domainManifest.QueryTemplates[0].RowTarget.ColumnMappings["userId"] = "user_id"
|
||||
domainManifest.Pages[0].QueryTemplateKeys[0] = "mutated"
|
||||
if body.Pages[0].QueryTemplateKeys[0] != "player.lookup" {
|
||||
t.Fatal("query template page keys alias request DTO data")
|
||||
@@ -168,7 +175,7 @@ func TestGameClientBridgeQueryTemplateDeclarationRoundTripIsSafe(t *testing.T) {
|
||||
if err := json.Unmarshal(encoded, &projection); err != nil {
|
||||
t.Fatalf("decode safe query template projection: %v", err)
|
||||
}
|
||||
expectedFields := []string{"key", "title", "permission", "engine", "transportKey", "targetKey", "parameterSchemaRef", "resultSchemaRef", "maxRows", "timeoutSeconds"}
|
||||
expectedFields := []string{"key", "title", "permission", "engine", "transportKey", "targetKey", "parameterSchemaRef", "resultSchemaRef", "sqlRef", "maxRows", "timeoutSeconds", "rowTarget"}
|
||||
if len(projection) != len(expectedFields) {
|
||||
t.Fatalf("query template projection contains unexpected fields: %s", encoded)
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package dto
|
||||
|
||||
import "browser.local/platform/domain"
|
||||
|
||||
type SCUMPlayerLiveStateListResponse struct {
|
||||
Items []domain.SCUMPlayerLiveState `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMSquadListResponse struct {
|
||||
Items []domain.SCUMSquad `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMSquadMemberListResponse struct {
|
||||
Items []domain.SCUMSquadMember `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMVehicleListResponse struct {
|
||||
Items []domain.SCUMVehicle `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMFlagListResponse struct {
|
||||
Items []domain.SCUMFlag `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMCurrentPositionListResponse struct {
|
||||
Items []domain.SCUMCurrentPosition `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
func SCUMPlayerLiveStatesFromDomain(values []domain.SCUMPlayerLiveState) SCUMPlayerLiveStateListResponse {
|
||||
out := make([]domain.SCUMPlayerLiveState, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMPlayerLiveState(value)
|
||||
}
|
||||
return SCUMPlayerLiveStateListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
|
||||
func SCUMSquadsFromDomain(values []domain.SCUMSquad) SCUMSquadListResponse {
|
||||
out := make([]domain.SCUMSquad, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMSquad(value)
|
||||
}
|
||||
return SCUMSquadListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
|
||||
func SCUMSquadMembersFromDomain(values []domain.SCUMSquadMember) SCUMSquadMemberListResponse {
|
||||
out := make([]domain.SCUMSquadMember, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMSquadMember(value)
|
||||
}
|
||||
return SCUMSquadMemberListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
|
||||
func SCUMVehiclesFromDomain(values []domain.SCUMVehicle) SCUMVehicleListResponse {
|
||||
out := make([]domain.SCUMVehicle, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMVehicle(value)
|
||||
}
|
||||
return SCUMVehicleListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
|
||||
func SCUMFlagsFromDomain(values []domain.SCUMFlag) SCUMFlagListResponse {
|
||||
out := make([]domain.SCUMFlag, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMFlag(value)
|
||||
}
|
||||
return SCUMFlagListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
|
||||
func SCUMCurrentPositionsFromDomain(values []domain.SCUMCurrentPosition) SCUMCurrentPositionListResponse {
|
||||
out := make([]domain.SCUMCurrentPosition, len(values))
|
||||
for index, value := range values {
|
||||
out[index] = domain.CopySCUMCurrentPosition(value)
|
||||
}
|
||||
return SCUMCurrentPositionListResponse{Items: out, Count: len(out)}
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"browser.local/platform/domain"
|
||||
)
|
||||
|
||||
type SCUMSafeSummaryBody struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMDataObservationResponse struct {
|
||||
ID string `json:"id"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
PluginID string `json:"pluginId"`
|
||||
Source string `json:"source"`
|
||||
QueryKey string `json:"queryKey,omitempty"`
|
||||
SubjectType string `json:"subjectType,omitempty"`
|
||||
SubjectID string `json:"subjectId,omitempty"`
|
||||
Sequence uint64 `json:"sequence"`
|
||||
Checksum string `json:"checksum,omitempty"`
|
||||
Status string `json:"status"`
|
||||
ErrorCode string `json:"errorCode,omitempty"`
|
||||
SafeSummary SCUMSafeSummaryBody `json:"safeSummary,omitempty"`
|
||||
ObservedAt time.Time `json:"observedAt"`
|
||||
ReceivedAt time.Time `json:"receivedAt"`
|
||||
}
|
||||
|
||||
type SCUMProjectionFreshnessBody struct {
|
||||
Status string `json:"status"`
|
||||
ObservationID string `json:"observationId,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
QueryKey string `json:"queryKey,omitempty"`
|
||||
Sequence uint64 `json:"sequence,omitempty"`
|
||||
Checksum string `json:"checksum,omitempty"`
|
||||
StaleReason string `json:"staleReason,omitempty"`
|
||||
ObservedAt time.Time `json:"observedAt,omitempty"`
|
||||
ReceivedAt time.Time `json:"receivedAt,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMMutationGuardBody struct {
|
||||
FieldKey string `json:"fieldKey,omitempty"`
|
||||
Before any `json:"before,omitempty"`
|
||||
After any `json:"after,omitempty"`
|
||||
MaxRowsAffected int `json:"maxRowsAffected,omitempty"`
|
||||
SafetyWindow string `json:"safetyWindow,omitempty"`
|
||||
BackupRef string `json:"backupRef,omitempty"`
|
||||
RequiresOfflinePlayer bool `json:"requiresOfflinePlayer,omitempty"`
|
||||
RequiresMaintenance bool `json:"requiresMaintenance,omitempty"`
|
||||
RequiresBackup bool `json:"requiresBackup,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMOperationConfirmationBody struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
ObservationID string `json:"observationId,omitempty"`
|
||||
ConfirmedFields map[string]any `json:"confirmedFields,omitempty"`
|
||||
AffectedRows int `json:"affectedRows,omitempty"`
|
||||
MutationChecksum string `json:"mutationChecksum,omitempty"`
|
||||
Checksum string `json:"checksum,omitempty"`
|
||||
ObservedAt time.Time `json:"observedAt,omitempty"`
|
||||
SafeSummary SCUMSafeSummaryBody `json:"safeSummary,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMOperationRequestBody struct {
|
||||
TemplateKey string `json:"templateKey"`
|
||||
PlayerID string `json:"playerId,omitempty"`
|
||||
Payload map[string]any `json:"payload,omitempty"`
|
||||
Guard SCUMMutationGuardBody `json:"guard,omitempty"`
|
||||
Reason string `json:"reason"`
|
||||
IdempotencyKey string `json:"idempotencyKey"`
|
||||
}
|
||||
|
||||
type SCUMWorkflowCreateRequest struct {
|
||||
TemplateKey string `json:"templateKey"`
|
||||
IdempotencyKey string `json:"idempotencyKey"`
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMOperationResponse struct {
|
||||
ID string `json:"id"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
PluginID string `json:"pluginId"`
|
||||
TemplateKey string `json:"templateKey"`
|
||||
PlayerID string `json:"playerId,omitempty"`
|
||||
RequesterID string `json:"requesterId,omitempty"`
|
||||
ApproverID string `json:"approverId,omitempty"`
|
||||
ApprovalLevel string `json:"approvalLevel"`
|
||||
Payload map[string]any `json:"payload,omitempty"`
|
||||
Guard SCUMMutationGuardBody `json:"guard,omitempty"`
|
||||
Confirmation SCUMOperationConfirmationBody `json:"confirmation,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
RunJobID string `json:"runJobId,omitempty"`
|
||||
SafeSummary SCUMSafeSummaryBody `json:"safeSummary,omitempty"`
|
||||
AuditReferences []string `json:"auditReferences,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ApprovedAt time.Time `json:"approvedAt,omitempty"`
|
||||
CompletedAt time.Time `json:"completedAt,omitempty"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type SCUMOperationListResponse struct {
|
||||
Items []SCUMOperationResponse `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMWorkflowResponse struct {
|
||||
ID string `json:"id"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
PluginID string `json:"pluginId"`
|
||||
TemplateKey string `json:"templateKey"`
|
||||
RequestedBy string `json:"requestedBy,omitempty"`
|
||||
IdempotencyKey string `json:"idempotencyKey,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CurrentStepKey string `json:"currentStepKey,omitempty"`
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
SafeSummary SCUMSafeSummaryBody `json:"safeSummary,omitempty"`
|
||||
BlockerReason string `json:"blockerReason,omitempty"`
|
||||
AuditReferences []string `json:"auditReferences,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
CompletedAt time.Time `json:"completedAt,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMWorkflowListResponse struct {
|
||||
Items []SCUMWorkflowResponse `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type SCUMWorkflowStepResponse struct {
|
||||
ID string `json:"id"`
|
||||
WorkflowID string `json:"workflowId"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
StepKey string `json:"stepKey"`
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
Status string `json:"status"`
|
||||
OperationKey string `json:"operationKey,omitempty"`
|
||||
QueryTemplateKey string `json:"queryTemplateKey,omitempty"`
|
||||
Capability string `json:"capability,omitempty"`
|
||||
TargetKey string `json:"targetKey,omitempty"`
|
||||
JobID string `json:"jobId,omitempty"`
|
||||
Attempt int `json:"attempt,omitempty"`
|
||||
MaxAttempts int `json:"maxAttempts,omitempty"`
|
||||
MutatesState bool `json:"mutatesState,omitempty"`
|
||||
Confirmation SCUMOperationConfirmationBody `json:"confirmation,omitempty"`
|
||||
SafeSummary SCUMSafeSummaryBody `json:"safeSummary,omitempty"`
|
||||
BlockerReason string `json:"blockerReason,omitempty"`
|
||||
AuditReferences []string `json:"auditReferences,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
CompletedAt time.Time `json:"completedAt,omitempty"`
|
||||
}
|
||||
|
||||
type SCUMWorkflowStepListResponse struct {
|
||||
Items []SCUMWorkflowStepResponse `json:"items"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
func SCUMSafeSummaryFromDomain(value domain.SCUMSafeSummary) SCUMSafeSummaryBody {
|
||||
value = domain.CopySCUMSafeSummary(value)
|
||||
return SCUMSafeSummaryBody{Title: value.Title, Message: value.Message, Details: value.Details}
|
||||
}
|
||||
|
||||
func scumSafeSummaryToDomain(value SCUMSafeSummaryBody) domain.SCUMSafeSummary {
|
||||
return domain.SCUMSafeSummary{Title: value.Title, Message: value.Message, Details: domain.CopyStringMap(value.Details)}
|
||||
}
|
||||
|
||||
func SCUMDataObservationFromDomain(value domain.SCUMDataObservation) SCUMDataObservationResponse {
|
||||
value = domain.CopySCUMDataObservation(value)
|
||||
return SCUMDataObservationResponse{ID: value.ID, ServerInstanceID: value.ServerInstanceID, PluginID: value.PluginID, Source: value.Source, QueryKey: value.QueryKey, SubjectType: value.SubjectType, SubjectID: value.SubjectID, Sequence: value.Sequence, Checksum: value.Checksum, Status: string(value.Status), ErrorCode: value.ErrorCode, SafeSummary: SCUMSafeSummaryFromDomain(value.SafeSummary), ObservedAt: value.ObservedAt, ReceivedAt: value.ReceivedAt}
|
||||
}
|
||||
|
||||
func SCUMProjectionFreshnessFromDomain(value domain.SCUMProjectionFreshnessState) SCUMProjectionFreshnessBody {
|
||||
value = domain.CopySCUMProjectionFreshnessState(value)
|
||||
return SCUMProjectionFreshnessBody{Status: string(value.Status), ObservationID: value.ObservationID, Source: value.Source, QueryKey: value.QueryKey, Sequence: value.Sequence, Checksum: value.Checksum, StaleReason: value.StaleReason, ObservedAt: value.ObservedAt, ReceivedAt: value.ReceivedAt}
|
||||
}
|
||||
|
||||
func SCUMOperationRequestBodyToDomain(request SCUMOperationRequestBody) domain.SCUMOperationRequest {
|
||||
return domain.SCUMOperationRequest{TemplateKey: request.TemplateKey, PlayerID: request.PlayerID, Payload: domain.CopyGameClientBridgePayload(request.Payload), Guard: scumMutationGuardToDomain(request.Guard), Reason: request.Reason, IdempotencyKey: request.IdempotencyKey}
|
||||
}
|
||||
|
||||
func SCUMWorkflowCreateRequestToDomain(request SCUMWorkflowCreateRequest) domain.SCUMWorkflowInstance {
|
||||
return domain.SCUMWorkflowInstance{TemplateKey: request.TemplateKey, IdempotencyKey: request.IdempotencyKey, Input: domain.CopyGameClientBridgePayload(request.Input)}
|
||||
}
|
||||
|
||||
func SCUMOperationFromDomain(value domain.SCUMOperationRequest) SCUMOperationResponse {
|
||||
value = domain.CopySCUMOperationRequest(value)
|
||||
return SCUMOperationResponse{ID: value.ID, ServerInstanceID: value.ServerInstanceID, PluginID: value.PluginID, TemplateKey: value.TemplateKey, PlayerID: value.PlayerID, RequesterID: value.RequesterID, ApproverID: value.ApproverID, ApprovalLevel: string(value.ApprovalLevel), Payload: value.Payload, Guard: scumMutationGuardFromDomain(value.Guard), Confirmation: scumOperationConfirmationFromDomain(value.Confirmation), Status: string(value.Status), Reason: value.Reason, RunJobID: value.RunJobID, SafeSummary: SCUMSafeSummaryFromDomain(value.SafeSummary), AuditReferences: value.AuditReferences, CreatedAt: value.CreatedAt, ApprovedAt: value.ApprovedAt, CompletedAt: value.CompletedAt, UpdatedAt: value.UpdatedAt}
|
||||
}
|
||||
|
||||
func SCUMOperationsFromDomain(values []domain.SCUMOperationRequest) SCUMOperationListResponse {
|
||||
items := make([]SCUMOperationResponse, len(values))
|
||||
for index, value := range values {
|
||||
items[index] = SCUMOperationFromDomain(value)
|
||||
}
|
||||
return SCUMOperationListResponse{Items: items, Count: len(items)}
|
||||
}
|
||||
|
||||
func SCUMWorkflowFromDomain(value domain.SCUMWorkflowInstance) SCUMWorkflowResponse {
|
||||
value = domain.CopySCUMWorkflowInstance(value)
|
||||
return SCUMWorkflowResponse{ID: value.ID, ServerInstanceID: value.ServerInstanceID, PluginID: value.PluginID, TemplateKey: value.TemplateKey, RequestedBy: value.RequestedBy, IdempotencyKey: value.IdempotencyKey, Status: string(value.Status), CurrentStepKey: value.CurrentStepKey, Input: value.Input, SafeSummary: SCUMSafeSummaryFromDomain(value.SafeSummary), BlockerReason: value.BlockerReason, AuditReferences: value.AuditReferences, CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt, CompletedAt: value.CompletedAt}
|
||||
}
|
||||
|
||||
func SCUMWorkflowsFromDomain(values []domain.SCUMWorkflowInstance) SCUMWorkflowListResponse {
|
||||
items := make([]SCUMWorkflowResponse, len(values))
|
||||
for index, value := range values {
|
||||
items[index] = SCUMWorkflowFromDomain(value)
|
||||
}
|
||||
return SCUMWorkflowListResponse{Items: items, Count: len(items)}
|
||||
}
|
||||
|
||||
func SCUMWorkflowStepFromDomain(value domain.SCUMWorkflowStep) SCUMWorkflowStepResponse {
|
||||
value = domain.CopySCUMWorkflowStep(value)
|
||||
return SCUMWorkflowStepResponse{ID: value.ID, WorkflowID: value.WorkflowID, ServerInstanceID: value.ServerInstanceID, StepKey: value.StepKey, DependsOn: value.DependsOn, Status: string(value.Status), OperationKey: value.OperationKey, QueryTemplateKey: value.QueryTemplateKey, Capability: value.Capability, TargetKey: value.TargetKey, JobID: value.JobID, Attempt: value.Attempt, MaxAttempts: value.MaxAttempts, MutatesState: value.MutatesState, Confirmation: scumOperationConfirmationFromDomain(value.Confirmation), SafeSummary: SCUMSafeSummaryFromDomain(value.SafeSummary), BlockerReason: value.BlockerReason, AuditReferences: value.AuditReferences, CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt, CompletedAt: value.CompletedAt}
|
||||
}
|
||||
|
||||
func SCUMWorkflowStepsFromDomain(values []domain.SCUMWorkflowStep) SCUMWorkflowStepListResponse {
|
||||
items := make([]SCUMWorkflowStepResponse, len(values))
|
||||
for index, value := range values {
|
||||
items[index] = SCUMWorkflowStepFromDomain(value)
|
||||
}
|
||||
return SCUMWorkflowStepListResponse{Items: items, Count: len(items)}
|
||||
}
|
||||
|
||||
func scumMutationGuardFromDomain(value domain.SCUMMutationGuard) SCUMMutationGuardBody {
|
||||
return SCUMMutationGuardBody{FieldKey: value.FieldKey, Before: value.Before, After: value.After, MaxRowsAffected: value.MaxRowsAffected, SafetyWindow: value.SafetyWindow, BackupRef: value.BackupRef, RequiresOfflinePlayer: value.RequiresOfflinePlayer, RequiresMaintenance: value.RequiresMaintenance, RequiresBackup: value.RequiresBackup}
|
||||
}
|
||||
|
||||
func scumMutationGuardToDomain(value SCUMMutationGuardBody) domain.SCUMMutationGuard {
|
||||
return domain.SCUMMutationGuard{FieldKey: value.FieldKey, Before: value.Before, After: value.After, MaxRowsAffected: value.MaxRowsAffected, SafetyWindow: value.SafetyWindow, BackupRef: value.BackupRef, RequiresOfflinePlayer: value.RequiresOfflinePlayer, RequiresMaintenance: value.RequiresMaintenance, RequiresBackup: value.RequiresBackup}
|
||||
}
|
||||
|
||||
func scumOperationConfirmationFromDomain(value domain.SCUMOperationConfirmation) SCUMOperationConfirmationBody {
|
||||
value = domain.CopySCUMOperationConfirmation(value)
|
||||
return SCUMOperationConfirmationBody{Status: value.Status, ObservationID: value.ObservationID, ConfirmedFields: value.ConfirmedFields, AffectedRows: value.AffectedRows, MutationChecksum: value.MutationChecksum, Checksum: value.Checksum, ObservedAt: value.ObservedAt, SafeSummary: SCUMSafeSummaryFromDomain(value.SafeSummary)}
|
||||
}
|
||||
|
||||
func scumOperationConfirmationToDomain(value SCUMOperationConfirmationBody) domain.SCUMOperationConfirmation {
|
||||
return domain.SCUMOperationConfirmation{Status: value.Status, ObservationID: value.ObservationID, ConfirmedFields: domain.CopyGameClientBridgePayload(value.ConfirmedFields), AffectedRows: value.AffectedRows, MutationChecksum: value.MutationChecksum, Checksum: value.Checksum, ObservedAt: value.ObservedAt, SafeSummary: scumSafeSummaryToDomain(value.SafeSummary)}
|
||||
}
|
||||
Reference in New Issue
Block a user