Merge PR #68: complete 0.9.3.5 inventory operations

0.9.3.5: Complete Inventory create, search and link operations
This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-10-05 23:04:06 +02:00
commit 371e0e4e65
7 files changed
+1623 -25

No files matched your search

+51
View File
@@ -334,6 +334,23 @@ jobs:
"Node",
"NodeListResponse",
"NodeResponse",
"InventoryPermissions",
"InventoryFolder",
"InventoryItem",
"InventoryTreeResponse",
"InventoryFolderContentResponse",
"InventoryItemResponse",
"InventorySearchScan",
"InventorySearchResponse",
"InventoryItemCreateRequest",
"InventoryItemCreateResponse",
"InventoryLinkCreateRequest",
"InventoryLinkCreateResponse",
"InventoryItemCopyRequest",
"InventoryItemCopyResponse",
"InventoryRestoreRequest",
"InventoryFolderRestoreResponse",
"InventoryItemRestoreResponse",
"Estate",
"EstateListResponse",
"EstateResponse",
@@ -462,6 +479,40 @@ jobs:
assert node_get["parameters"][0]["in"] == "path" and node_get["parameters"][0]["required"]
assert schemas["Node"]["properties"]["state"]["enum"] == ["online", "stale", "offline"]
inventory_search = doc["paths"]["/api/v1/inventory/search"]["get"]
assert inventory_search["x-nexverse-scope"] == "inventory:read"
assert [p["name"] for p in inventory_search["parameters"]] == ["owner_id", "q", "limit"]
inventory_create = doc["paths"]["/api/v1/inventory/items"]["post"]
assert inventory_create["x-nexverse-scope"] == "admin:*"
assert inventory_create["requestBody"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryItemCreateRequest"
assert inventory_create["responses"]["201"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryItemCreateResponse"
inventory_links = doc["paths"]["/api/v1/inventory/links"]["post"]
assert inventory_links["x-nexverse-scope"] == "inventory:write"
assert inventory_links["requestBody"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryLinkCreateRequest"
assert inventory_links["responses"]["201"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryLinkCreateResponse"
assert schemas["InventorySearchResponse"]["properties"]["scan"]["$ref"] == "#/components/schemas/InventorySearchScan"
assert schemas["InventoryItem"]["properties"]["permissions"]["$ref"] == "#/components/schemas/InventoryPermissions"
inventory_copy = doc["paths"]["/api/v1/inventory/items/copy"]["post"]
assert inventory_copy["requestBody"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryItemCopyRequest"
folder_restore = doc["paths"]["/api/v1/inventory/folders/{folderId}/restore"]["post"]
assert folder_restore["requestBody"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryRestoreRequest"
item_restore = doc["paths"]["/api/v1/inventory/items/{itemId}/restore"]["post"]
assert item_restore["responses"]["200"]["content"]["application/json"]["schema"]["$ref"] == "#/components/schemas/InventoryItemRestoreResponse"
for inventory_path in (
"/api/v1/inventory/tree",
"/api/v1/inventory/folders",
"/api/v1/inventory/folders/{folderId}",
"/api/v1/inventory/items",
"/api/v1/inventory/items/{itemId}",
"/api/v1/inventory/items/copy",
"/api/v1/inventory/folders/{folderId}/restore",
"/api/v1/inventory/items/{itemId}/restore",
"/api/v1/inventory/links",
"/api/v1/inventory/lost-and-found",
"/api/v1/inventory/trash/empty",
):
assert inventory_path in doc["paths"], f"Inventory OpenAPI path missing: {inventory_path}"
assert doc["components"]["securitySchemes"]["apiKeyAuth"]["name"] == "X-NexVerse-Api-Key"
assert doc["x_nexverse_idempotency"]["protected_operations"] == [
"POST /api/v1/users",
File diff suppressed because it is too large. Load diff
@@ -305,6 +305,7 @@ namespace NexVerse.Server.Api
throw new InvalidOperationException("Unable to load NexVerse World API authentication service.");
IInventoryService inventory = LoadOptionalService<IInventoryService>(config, "InventoryService");
IAssetService assets = LoadOptionalService<IAssetService>(config, "AssetService");
jobRunner.Register(new OglInventoryRepairWorker(inventory));
IGridUserService gridUsers = LoadOptionalService<IGridUserService>(config, "GridUserService");
@@ -395,7 +396,11 @@ namespace NexVerse.Server.Api
adminMinimumLevel,
new PersistentNexSecurityStore(apiConfig.GetString("SecurityStorePath", "data/nexverse-security.json")));
NexInventoryApi inventoryApi = new NexInventoryApi(inventory, authenticator);
NexInventoryApi inventoryApi =
new NexInventoryApi(
inventory,
assets,
authenticator);
server.AddSimpleStreamHandler(
new SimpleStreamHandler(
"/api/v1/inventory",
@@ -185,6 +185,34 @@ namespace NexVerse.Server.Api
("post", "NexVerse-verwaltete Region starten, stoppen oder neu starten", "regions:manage", "202")),
["/api/v1/region-operations/{operationId}"] = AuthenticatedOperations(
("get", "Status einer asynchronen Regionsoperation lesen", "regions:read", "200")),
["/api/v1/inventory/tree"] = AuthenticatedOperations(
("get", "Inventarwurzel und Ordnerstruktur lesen", "inventory:read", "200")),
["/api/v1/inventory/search"] = AuthenticatedOperations(
("get", "Inventarordner und Items begrenzt durchsuchen", "inventory:read", "200")),
["/api/v1/inventory/folders"] = AuthenticatedOperations(
("post", "Inventarordner erstellen", "inventory:write", "201")),
["/api/v1/inventory/folders/{folderId}"] = AuthenticatedOperations(
("get", "Inventarordner samt direktem Inhalt lesen", "inventory:read", "200"),
("patch", "Inventarordner umbenennen oder verschieben", "inventory:write", "200"),
("delete", "Inventarordner sicher in den Papierkorb verschieben", "inventory:write", "200")),
["/api/v1/inventory/items"] = AuthenticatedOperations(
("post", "Inventaritem aus vorhandenem Asset erzeugen", "admin:*", "201")),
["/api/v1/inventory/items/{itemId}"] = AuthenticatedOperations(
("get", "Inventaritem lesen", "inventory:read", "200"),
("patch", "Inventaritem umbenennen, beschreiben oder verschieben", "inventory:write", "200"),
("delete", "Inventaritem sicher in den Papierkorb verschieben", "inventory:write", "200")),
["/api/v1/inventory/items/copy"] = AuthenticatedOperations(
("post", "Eigenes Inventaritem in einen Zielordner kopieren", "inventory:write", "201")),
["/api/v1/inventory/folders/{folderId}/restore"] = AuthenticatedOperations(
("post", "Ordner direkt aus dem Papierkorb in einen Zielordner wiederherstellen", "inventory:write", "200")),
["/api/v1/inventory/items/{itemId}/restore"] = AuthenticatedOperations(
("post", "Item direkt aus dem Papierkorb in einen Zielordner wiederherstellen", "inventory:write", "200")),
["/api/v1/inventory/links"] = AuthenticatedOperations(
("post", "Direkten Item- oder Ordnerlink erzeugen", "inventory:write", "201")),
["/api/v1/inventory/lost-and-found"] = AuthenticatedOperations(
("get", "Lost-&-Found-Ordner und direkten Inhalt lesen", "inventory:read", "200")),
["/api/v1/inventory/trash/empty"] = AuthenticatedOperations(
("post", "Papierkorb des ausgewählten Inventars endgültig leeren", "inventory:write", "200")),
["/api/v1/users/me"] = AuthenticatedOperations(
("get", "Authentifiziertes Einwohnerkonto lesen", null, "200")),
["/api/v1/users"] = AuthenticatedOperations(
@@ -414,6 +442,69 @@ namespace NexVerse.Server.Api
null,
"StatisticsSummaryResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/tree",
"get",
null,
"InventoryTreeResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/search",
"get",
null,
"InventorySearchResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/folders/{folderId}",
"get",
null,
"InventoryFolderContentResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/items/{itemId}",
"get",
null,
"InventoryItemResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/items",
"post",
"InventoryItemCreateRequest",
"InventoryItemCreateResponse",
"201");
ApplyJsonContract(
paths,
"/api/v1/inventory/links",
"post",
"InventoryLinkCreateRequest",
"InventoryLinkCreateResponse",
"201");
ApplyJsonContract(
paths,
"/api/v1/inventory/items/copy",
"post",
"InventoryItemCopyRequest",
"InventoryItemCopyResponse",
"201");
ApplyJsonContract(
paths,
"/api/v1/inventory/folders/{folderId}/restore",
"post",
"InventoryRestoreRequest",
"InventoryFolderRestoreResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/inventory/items/{itemId}/restore",
"post",
"InventoryRestoreRequest",
"InventoryItemRestoreResponse",
"200");
ApplyJsonContract(
paths,
"/api/v1/users/{principalId}/audit",
@@ -529,6 +620,116 @@ namespace NexVerse.Server.Api
false,
"Optionaler wiederholungssicherer Anfrageschlüssel; maximal 128 Zeichen."));
object inventoryOwnerParameter =
QueryParameter(
"owner_id",
false,
"Optionaler Inventory-Owner als UUID; ein fremder Owner erfordert zusätzlich admin:*.");
AddOperationParameters(
paths,
"/api/v1/inventory/tree",
"get",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/search",
"get",
inventoryOwnerParameter,
QueryParameter(
"q",
false,
"Optionaler, nicht zwischen Groß-/Kleinschreibung unterscheidender Suchbegriff."),
IntegerQueryParameter(
"limit",
false,
1,
500,
"Maximale Anzahl Ordner und Items je Ergebnistyp; Standard 100."));
AddOperationParameters(
paths,
"/api/v1/inventory/folders",
"post",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/items",
"post",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/items/copy",
"post",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/links",
"post",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/lost-and-found",
"get",
inventoryOwnerParameter);
AddOperationParameters(
paths,
"/api/v1/inventory/trash/empty",
"post",
inventoryOwnerParameter);
object inventoryFolderIdParameter =
PathParameter(
"folderId",
"UUID des Inventarordners.");
foreach (string method in new[]
{
"get",
"patch",
"delete"
})
{
AddOperationParameters(
paths,
"/api/v1/inventory/folders/{folderId}",
method,
inventoryFolderIdParameter,
inventoryOwnerParameter);
}
AddOperationParameters(
paths,
"/api/v1/inventory/folders/{folderId}/restore",
"post",
inventoryFolderIdParameter,
inventoryOwnerParameter);
object inventoryItemIdParameter =
PathParameter(
"itemId",
"UUID des Inventaritems.");
foreach (string method in new[]
{
"get",
"patch",
"delete"
})
{
AddOperationParameters(
paths,
"/api/v1/inventory/items/{itemId}",
method,
inventoryItemIdParameter,
inventoryOwnerParameter);
}
AddOperationParameters(
paths,
"/api/v1/inventory/items/{itemId}/restore",
"post",
inventoryItemIdParameter,
inventoryOwnerParameter);
object principalIdParameter =
PathParameter(
"principalId",
@@ -1859,6 +2060,9 @@ namespace NexVerse.Server.Api
object apiKeyRef = SchemaRef("ApiKey");
object auditEventRef = SchemaRef("AuditEvent");
object estateRef = SchemaRef("Estate");
object inventoryFolderRef = SchemaRef("InventoryFolder");
object inventoryItemRef = SchemaRef("InventoryItem");
object inventoryPermissionsRef = SchemaRef("InventoryPermissions");
return new Dictionary<string, object>
{
@@ -2144,6 +2348,357 @@ namespace NexVerse.Server.Api
["correlation_id"] = new { type = "string" }
}
},
["InventoryPermissions"] = new
{
type = "object",
required = new[]
{
"base_mask",
"current_mask",
"everyone_mask",
"group_mask",
"next_owner_mask"
},
properties = new Dictionary<string, object>
{
["base_mask"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["current_mask"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["everyone_mask"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["group_mask"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["next_owner_mask"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L }
}
},
["InventoryFolder"] = new
{
type = "object",
required = new[]
{
"id",
"owner_id",
"parent_id",
"name",
"type",
"version"
},
properties = new Dictionary<string, object>
{
["id"] = new { type = "string", format = "uuid" },
["owner_id"] = new { type = "string", format = "uuid" },
["parent_id"] = new { type = "string", format = "uuid" },
["name"] = new { type = "string" },
["type"] = new { type = "integer" },
["version"] = new { type = "integer" }
}
},
["InventoryItem"] = new
{
type = "object",
required = new[]
{
"id",
"owner_id",
"folder_id",
"asset_id",
"name",
"description",
"asset_type",
"inventory_type",
"creator_id",
"creation_date",
"flags",
"permissions"
},
properties = new Dictionary<string, object>
{
["id"] = new { type = "string", format = "uuid" },
["owner_id"] = new { type = "string", format = "uuid" },
["folder_id"] = new { type = "string", format = "uuid" },
["asset_id"] = new { type = "string", format = "uuid" },
["name"] = new { type = "string" },
["description"] = new { type = "string" },
["asset_type"] = new { type = "integer" },
["inventory_type"] = new { type = "integer" },
["creator_id"] = new { type = "string" },
["creator_data"] = new { type = "string" },
["creation_date"] = new { type = "integer", format = "int64" },
["flags"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["permissions"] = inventoryPermissionsRef
}
},
["InventoryTreeResponse"] = new
{
type = "object",
required = new[]
{
"owner_id",
"root",
"folders",
"folder_count"
},
properties = new Dictionary<string, object>
{
["owner_id"] = new { type = "string", format = "uuid" },
["root"] = new
{
oneOf = new object[]
{
inventoryFolderRef,
new { type = "null" }
}
},
["folders"] = new
{
type = "array",
items = inventoryFolderRef
},
["folder_count"] = new { type = "integer", minimum = 0 }
}
},
["InventoryFolderContentResponse"] = new
{
type = "object",
required = new[]
{
"folder",
"folders",
"items"
},
properties = new Dictionary<string, object>
{
["folder"] = inventoryFolderRef,
["folders"] = new
{
type = "array",
items = inventoryFolderRef
},
["items"] = new
{
type = "array",
items = inventoryItemRef
}
}
},
["InventoryItemResponse"] = new
{
type = "object",
required = new[] { "item" },
properties = new Dictionary<string, object>
{
["item"] = inventoryItemRef
}
},
["InventorySearchScan"] = new
{
type = "object",
required = new[]
{
"folder_limit",
"item_limit",
"scanned_folders",
"scanned_items",
"truncated"
},
properties = new Dictionary<string, object>
{
["folder_limit"] = new { type = "integer", minimum = 1 },
["item_limit"] = new { type = "integer", minimum = 1 },
["scanned_folders"] = new { type = "integer", minimum = 0 },
["scanned_items"] = new { type = "integer", minimum = 0 },
["truncated"] = new { type = "boolean" }
}
},
["InventorySearchResponse"] = new
{
type = "object",
required = new[]
{
"query",
"limit",
"scan",
"folders",
"items",
"folder_count",
"item_count"
},
properties = new Dictionary<string, object>
{
["query"] = new { type = "string", maxLength = 255 },
["limit"] = new { type = "integer", minimum = 1, maximum = 500 },
["scan"] = SchemaRef("InventorySearchScan"),
["folders"] = new
{
type = "array",
items = inventoryFolderRef
},
["items"] = new
{
type = "array",
items = inventoryItemRef
},
["folder_count"] = new { type = "integer", minimum = 0 },
["item_count"] = new { type = "integer", minimum = 0 }
}
},
["InventoryItemCreateRequest"] = new
{
type = "object",
required = new[]
{
"folder_id",
"asset_id",
"name",
"base_permissions",
"current_permissions",
"next_owner_permissions"
},
properties = new Dictionary<string, object>
{
["folder_id"] = new { type = "string", format = "uuid" },
["asset_id"] = new { type = "string", format = "uuid" },
["name"] = new { type = "string", minLength = 1, maxLength = 255 },
["description"] = new { type = "string" },
["inventory_type"] = new { type = "integer" },
["base_permissions"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["current_permissions"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["next_owner_permissions"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["everyone_permissions"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["group_permissions"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L },
["flags"] = new { type = "integer", format = "int64", minimum = 0L, maximum = 4294967295L }
}
},
["InventoryItemCreateResponse"] = new
{
type = "object",
required = new[] { "item", "asset" },
properties = new Dictionary<string, object>
{
["item"] = inventoryItemRef,
["asset"] = new
{
type = "object",
required = new[]
{
"id",
"type",
"content_type"
},
properties = new Dictionary<string, object>
{
["id"] = new { type = "string" },
["type"] = new { type = "integer" },
["content_type"] = new { type = "string" }
}
}
}
},
["InventoryLinkCreateRequest"] = new
{
type = "object",
required = new[]
{
"folder_id",
"target_id"
},
properties = new Dictionary<string, object>
{
["folder_id"] = new { type = "string", format = "uuid" },
["target_id"] = new { type = "string", format = "uuid" },
["target_kind"] = new
{
type = "string",
@enum = new[] { "item", "folder" },
@default = "item"
},
["name"] = new { type = "string", minLength = 1, maxLength = 255 },
["description"] = new { type = "string" }
}
},
["InventoryLinkCreateResponse"] = new
{
type = "object",
required = new[]
{
"link",
"target_kind",
"target_id"
},
properties = new Dictionary<string, object>
{
["link"] = inventoryItemRef,
["target_kind"] = new
{
type = "string",
@enum = new[] { "item", "folder" }
},
["target_id"] = new { type = "string", format = "uuid" }
}
},
["InventoryItemCopyRequest"] = new
{
type = "object",
required = new[]
{
"item_id",
"folder_id"
},
properties = new Dictionary<string, object>
{
["item_id"] = new { type = "string", format = "uuid" },
["folder_id"] = new { type = "string", format = "uuid" },
["name"] = new { type = "string", minLength = 1, maxLength = 255 }
}
},
["InventoryItemCopyResponse"] = new
{
type = "object",
required = new[]
{
"item",
"copied_from"
},
properties = new Dictionary<string, object>
{
["item"] = inventoryItemRef,
["copied_from"] = new { type = "string", format = "uuid" }
}
},
["InventoryRestoreRequest"] = new
{
type = "object",
required = new[] { "folder_id" },
properties = new Dictionary<string, object>
{
["folder_id"] = new { type = "string", format = "uuid" }
}
},
["InventoryFolderRestoreResponse"] = new
{
type = "object",
required = new[]
{
"restored",
"folder"
},
properties = new Dictionary<string, object>
{
["restored"] = new { type = "boolean" },
["folder"] = inventoryFolderRef
}
},
["InventoryItemRestoreResponse"] = new
{
type = "object",
required = new[]
{
"restored",
"item"
},
properties = new Dictionary<string, object>
{
["restored"] = new { type = "boolean" },
["item"] = inventoryItemRef
}
},
["Estate"] = new
{
type = "object",
+6 -6
View File
@@ -783,16 +783,16 @@ Support:
- [x] delete folder (safe move to Trash);
- [x] restore from trash;
- [x] empty trash;
- create item;
- create item — implemented as admin-only creation from an existing validated asset with explicit permission masks;
- [x] rename item;
- [x] move item;
- [x] copy item;
- [x] delete item (safe move to Trash);
- [x] sort (name-ordered search result foundation);
- search;
- search — implemented as bounded case-insensitive `q` search with `limit` across folder names and item names/descriptions;
- [x] inspect permissions (item permission masks);
- [x] update allowed metadata (name/description);
- links;
- links — implemented for direct owned item/folder targets using native `AssetType.Link` / `AssetType.LinkFolder` semantics;
- [x] Lost & Found;
- [x] asset reference information (asset UUID/type; read-only foundation).
@@ -823,11 +823,11 @@ API-driven avatar inventory archives:
- [x] IAR export operation foundation over authoritative `IInventoryArchiverModule`;
- [x] IAR import operation foundation with read-only archive validation;
- partial subtree export;
- partial subtree export — implemented through the authoritative IAR `inventory_path` parameter;
- [x] native conflict policy exposed as `merge=true/false` (no invented unsupported modes);
- [x] progress;
- failure reporting;
- encrypted backup option.
- failure reporting — implemented through terminal IAR operation/job state and error metadata;
- encrypted backup option — implemented as validated authenticated `.oglbackup` AES-GCM storage outside World API passphrase payloads.
### 9.4 NexVerse Job Engine
+19
View File
@@ -315,6 +315,25 @@ The worker inventories application tables directly from provider metadata, quote
OpenGenesisLINK 0.9.3.5 deliberately does not expose arbitrary SQL, `VACUUM`, `VACUUM FULL`, `OPTIMIZE TABLE`, schema migration, repair or rebuild operations through this API. Those operations can require stronger maintenance-window and backup/rollback guarantees and remain separate operational work.
## Inventory API
The 0.9.3.5 Inventory API uses the authoritative configured `IInventoryService`. Read operations require `inventory:read`; mutations require `inventory:write`. Access to another resident through `owner_id` additionally requires `admin:*`.
Implemented management operations include:
- `GET /api/v1/inventory/tree` and folder/item reads;
- `GET /api/v1/inventory/search?q=<text>&limit=<1-500>` for bounded case-insensitive search across folder names and item names/descriptions; the server scans at most 2,000 folders and 10,000 item rows per request and reports `scan.truncated` when those safety bounds are reached;
- folder create/rename/move and safe Trash handling;
- item rename/description/move, permission-aware copy, restore and safe Trash handling; Copy is refused when the source item lacks the native Copy permission, and folder move/restore operations reject ancestry cycles;
- `POST /api/v1/inventory/links` for direct item or folder links using the native link asset types;
- `POST /api/v1/inventory/items` for controlled item creation from an already-existing asset.
Raw asset-backed item creation is deliberately **administrator-only** even when the caller otherwise has `inventory:write`. The API loads the configured `AssetService`, requires the referenced asset metadata to exist, derives the asset type from that authoritative metadata, and requires explicit base/current/next-owner permission masks. This prevents a normal resident from manufacturing a full-permission inventory item merely by knowing an asset UUID. Link creation does not copy the target asset and only accepts targets already owned by the selected inventory owner.
The API never creates inventory links by cloning a linked target recursively: link-to-link chains are rejected. Folder links are inventory items with `AssetType.LinkFolder`; normal item links use `AssetType.Link`.
The OpenAPI 3.1 document publishes typed schemas for inventory folders, items, permission masks, bounded search results, asset-backed item creation and link creation so the API Control Center can render these operations without handwritten client assumptions.
## Persistent Job Engine: Inventory repair
OpenGenesisLINK 0.9.3.5 provides a conservative structural repair job for one resident inventory.
+63 -1
View File
@@ -4,6 +4,7 @@ from pathlib import Path
api = Path("NexVerse/Server/Api/NexInventoryApi.cs").read_text(encoding="utf-8")
connector = Path("NexVerse/Server/Api/NexVerseWorldApiConnector.cs").read_text(encoding="utf-8")
security = Path("NexVerse/Core/Security/NexSecurity.cs").read_text(encoding="utf-8")
world_api = Path("NexVerse/Server/Api/NexVerseWorldApiHandlers.cs").read_text(encoding="utf-8")
for marker in (
'"/api/v1/inventory/tree"',
@@ -22,6 +23,26 @@ for marker in (
'"/api/v1/inventory/lost-and-found"',
'"/api/v1/inventory/trash/empty"',
'"/api/v1/inventory/items/copy"',
'"/api/v1/inventory/items"',
'"/api/v1/inventory/links"',
'"inventory_item_create_admin_required"',
'"asset_service_unavailable"',
"GetMetadata",
"permission_masks_required",
"AssetType.Link",
"AssetType.LinkFolder",
"inventory_link_chain_forbidden",
"inventory_item_copy_forbidden",
"inventory_folder_cycle",
"WouldCreateFolderCycle",
'request?.QueryString?["q"]',
'request?.QueryString?["limit"]',
"SearchFolderScanLimit = 2000",
"SearchItemScanLimit = 10000",
'"query_too_long"',
'"invalid_optional_mask"',
"DefaultInventoryTypeForAsset",
"IsInventoryTypeCompatible",
'"folder_not_in_trash"',
'"item_not_in_trash"',
"PurgeFolder",
@@ -36,6 +57,47 @@ for marker in (
assert marker in api, f"missing inventory API marker: {marker}"
assert 'public const string InventoryRead = "inventory:read"' in security
assert 'public const string InventoryWrite = "inventory:write"' in security
assert '"/api/v1/inventory"' in connector
assert "NexInventoryApi" in connector
print("Inventory read API contract: OK")
assert 'LoadOptionalService<IAssetService>(config, "AssetService")' in connector
assert "new NexInventoryApi(" in connector
for schema in (
"InventoryPermissions",
"InventoryFolder",
"InventoryItem",
"InventoryTreeResponse",
"InventoryFolderContentResponse",
"InventoryItemResponse",
"InventorySearchScan",
"InventorySearchResponse",
"InventoryItemCreateRequest",
"InventoryItemCreateResponse",
"InventoryLinkCreateRequest",
"InventoryLinkCreateResponse",
"InventoryItemCopyRequest",
"InventoryItemCopyResponse",
"InventoryRestoreRequest",
"InventoryFolderRestoreResponse",
"InventoryItemRestoreResponse",
):
assert f'["{schema}"]' in world_api, f"missing Inventory schema: {schema}"
for marker in (
'["/api/v1/inventory/tree"]',
'["/api/v1/inventory/search"]',
'["/api/v1/inventory/folders"]',
'["/api/v1/inventory/folders/{folderId}"]',
'["/api/v1/inventory/items"]',
'["/api/v1/inventory/items/{itemId}"]',
'["/api/v1/inventory/items/copy"]',
'["/api/v1/inventory/folders/{folderId}/restore"]',
'["/api/v1/inventory/items/{itemId}/restore"]',
'["/api/v1/inventory/links"]',
'["/api/v1/inventory/lost-and-found"]',
'["/api/v1/inventory/trash/empty"]',
):
assert marker in world_api, f"missing Inventory OpenAPI marker: {marker}"
print("Inventory API contract: OK")