verstak-sdk/schemas/events/vault.json

232 lines
9.5 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.mirv.top/verstak/verstak-sdk/schemas/events/vault.json",
"title": "Verstak Vault Events",
"description": "Event schemas for vault and case lifecycle events",
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/VaultEvent"
}
}
},
"$defs": {
"VaultEvent": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "const": "object" },
"properties": { "type": "object" },
"required": { "type": "array", "items": { "type": "string" } }
},
"required": ["type", "properties", "required"]
}
},
"required": ["name", "description", "schema"]
}
},
"events": [
{
"name": "vault.opened",
"description": "Vault has been opened and is ready",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "Absolute path to vault root" },
"version": { "type": "string", "description": "Vault schema version" },
"openedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "openedAt"]
}
},
{
"name": "vault.closed",
"description": "Vault is about to close",
"schema": {
"type": "object",
"properties": {
"closedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"clean": { "type": "boolean", "description": "Whether vault closed cleanly" }
},
"required": ["closedAt"]
}
},
{
"name": "case.selected",
"description": "A case has been selected in the navigation",
"schema": {
"type": "object",
"properties": {
"caseId": { "type": "string", "description": "Case identifier" },
"casePath": { "type": "string", "description": "Case filesystem path" },
"caseType": { "type": "string", "description": "Case type (client, project, etc.)" },
"selectedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["caseId", "casePath"]
}
},
{
"name": "workspace.created",
"description": "A top-level workspace folder has been created",
"schema": {
"type": "object",
"properties": {
"operation": { "type": "string", "const": "create" },
"workspaceRootPath": { "type": "string", "description": "Vault-relative top-level workspace folder" },
"workspaceName": { "type": "string", "description": "Workspace display/canonical folder name" },
"title": { "type": "string", "description": "Activity title" },
"templateId": { "type": "string", "description": "Template applied during creation, if any" }
},
"required": ["operation", "workspaceRootPath", "workspaceName"]
}
},
{
"name": "workspace.renamed",
"description": "A top-level workspace folder has been renamed",
"schema": {
"type": "object",
"properties": {
"operation": { "type": "string", "const": "rename" },
"workspaceRootPath": { "type": "string", "description": "New workspace root folder" },
"workspaceName": { "type": "string", "description": "New workspace name" },
"previousWorkspaceRootPath": { "type": "string", "description": "Previous workspace root folder" },
"previousWorkspaceName": { "type": "string", "description": "Previous workspace name" },
"title": { "type": "string", "description": "Activity title" }
},
"required": ["operation", "workspaceRootPath", "workspaceName", "previousWorkspaceRootPath", "previousWorkspaceName"]
}
},
{
"name": "workspace.trashed",
"description": "A top-level workspace folder has been moved to internal trash",
"schema": {
"type": "object",
"properties": {
"operation": { "type": "string", "const": "trash" },
"workspaceRootPath": { "type": "string", "description": "Workspace root folder before trash" },
"workspaceName": { "type": "string", "description": "Workspace name before trash" },
"title": { "type": "string", "description": "Activity title" },
"trashId": { "type": "string", "description": "Internal trash item identifier" },
"trashPath": { "type": "string", "description": "Vault-relative trash path" },
"deletedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["operation", "workspaceRootPath", "workspaceName", "trashId", "trashPath", "deletedAt"]
}
},
{
"name": "workspace.selected",
"description": "The current workspace selection has changed",
"schema": {
"type": "object",
"properties": {
"operation": { "type": "string", "const": "select" },
"workspaceRootPath": { "type": "string", "description": "Selected workspace root folder" },
"workspaceName": { "type": "string", "description": "Selected workspace name" },
"title": { "type": "string", "description": "Activity title" }
},
"required": ["operation", "workspaceRootPath", "workspaceName"]
}
},
{
"name": "file.added",
"description": "A file has been added to the vault",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"size": { "type": "integer", "description": "File size in bytes" },
"mimeType": { "type": "string", "description": "File MIME type" },
"caseId": { "type": "string", "description": "Associated case identifier" },
"addedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "addedAt"]
}
},
{
"name": "file.changed",
"description": "A vault file or folder has changed and file surfaces should refresh",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"title": { "type": "string", "description": "Activity title, usually the path" },
"operation": {
"type": "string",
"enum": ["create", "update", "move", "delete", "external.create", "external.update", "external.delete"],
"description": "Change operation. external.* values come from the live vault watcher."
},
"type": { "type": "string", "enum": ["file", "folder", "symlink", "unknown"], "description": "Changed entry type when known" },
"workspaceRootPath": { "type": "string", "description": "Top-level workspace folder inferred from path" },
"external": { "type": "boolean", "description": "True when the change was observed outside the Files API" },
"trashId": { "type": "string", "description": "Internal trash id for restore/trash related changes" },
"fromPath": { "type": "string", "description": "Previous path for move operations" },
"changedAt": { "type": "string", "description": "ISO 8601 timestamp when supplied by event publisher" }
},
"required": ["path", "operation"]
}
},
{
"name": "file.deleted",
"description": "A file has been deleted from the vault",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"deletedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "deletedAt"]
}
},
{
"name": "note.saved",
"description": "A note has been saved",
"schema": {
"type": "object",
"properties": {
"noteId": { "type": "string", "description": "Note identifier" },
"title": { "type": "string", "description": "Note title" },
"path": { "type": "string", "description": "Note file path relative to vault" },
"caseId": { "type": "string", "description": "Associated case identifier" },
"savedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["noteId", "path", "savedAt"]
}
},
{
"name": "activity.recorded",
"description": "An activity event has been recorded",
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "description": "Activity type (file.opened, note.saved, etc.)" },
"caseId": { "type": "string", "description": "Associated case" },
"details": { "type": "object", "description": "Activity-specific details" },
"recordedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["type", "recordedAt"]
}
},
{
"name": "case.created",
"description": "A new case has been created",
"schema": {
"type": "object",
"properties": {
"caseId": { "type": "string" },
"casePath": { "type": "string" },
"caseType": { "type": "string" },
"template": { "type": "string", "description": "Template used, if any" },
"createdAt": { "type": "string" }
},
"required": ["caseId", "casePath", "createdAt"]
}
}
]
}