mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 17:24:57 +00:00
184 lines
4.1 KiB
JSON
184 lines
4.1 KiB
JSON
{
|
|
"entity": "Snippet",
|
|
"version": "1.0",
|
|
"description": "Code snippet with syntax highlighting, Python runner, and React preview support",
|
|
"fields": {
|
|
"id": {
|
|
"type": "uuid",
|
|
"primary": true,
|
|
"required": true,
|
|
"description": "Unique snippet identifier (client-generated UUID)"
|
|
},
|
|
"title": {
|
|
"type": "string",
|
|
"required": true,
|
|
"min_length": 1,
|
|
"max_length": 255,
|
|
"description": "Snippet display title"
|
|
},
|
|
"description": {
|
|
"type": "text",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"description": "Optional description"
|
|
},
|
|
"code": {
|
|
"type": "text",
|
|
"required": true,
|
|
"description": "Source code content"
|
|
},
|
|
"language": {
|
|
"type": "string",
|
|
"required": true,
|
|
"max_length": 50,
|
|
"description": "Programming language identifier (e.g. python, typescript)"
|
|
},
|
|
"category": {
|
|
"type": "string",
|
|
"required": true,
|
|
"max_length": 50,
|
|
"description": "Category tag"
|
|
},
|
|
"namespaceId": {
|
|
"type": "string",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"description": "Parent namespace ID"
|
|
},
|
|
"hasPreview": {
|
|
"type": "boolean",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"default": false,
|
|
"description": "Whether this snippet has a React live preview"
|
|
},
|
|
"functionName": {
|
|
"type": "string",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"max_length": 100,
|
|
"description": "Entry function name for Python runner"
|
|
},
|
|
"inputParameters": {
|
|
"type": "text",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"description": "JSON-encoded input parameter definitions"
|
|
},
|
|
"files": {
|
|
"type": "text",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"description": "JSON-encoded multi-file map for split-screen editor"
|
|
},
|
|
"entryPoint": {
|
|
"type": "string",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"max_length": 255,
|
|
"description": "Entry point filename for multi-file snippets"
|
|
},
|
|
"isTemplate": {
|
|
"type": "boolean",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"default": false,
|
|
"description": "Whether this snippet is a reusable template"
|
|
},
|
|
"createdAt": {
|
|
"type": "bigint",
|
|
"generated": true,
|
|
"description": "Creation timestamp (Unix milliseconds)"
|
|
},
|
|
"updatedAt": {
|
|
"type": "bigint",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"description": "Last update timestamp (Unix milliseconds)"
|
|
},
|
|
"userId": {
|
|
"type": "string",
|
|
"required": true,
|
|
"description": "Owner user ID"
|
|
},
|
|
"tenantId": {
|
|
"type": "string",
|
|
"optional": true,
|
|
"nullable": true
|
|
},
|
|
"shareToken": {
|
|
"type": "string",
|
|
"optional": true,
|
|
"nullable": true,
|
|
"max_length": 64,
|
|
"description": "Secret share token — set to enable unauthenticated read via /share/<token>"
|
|
}
|
|
},
|
|
"indexes": [
|
|
{
|
|
"fields": [
|
|
"userId"
|
|
]
|
|
},
|
|
{
|
|
"fields": [
|
|
"tenantId",
|
|
"userId"
|
|
]
|
|
},
|
|
{
|
|
"fields": [
|
|
"namespaceId"
|
|
]
|
|
},
|
|
{
|
|
"fields": [
|
|
"language"
|
|
]
|
|
},
|
|
{
|
|
"fields": [
|
|
"updatedAt"
|
|
]
|
|
},
|
|
{
|
|
"fields": [
|
|
"shareToken"
|
|
],
|
|
"unique": true
|
|
}
|
|
],
|
|
"relations": {
|
|
"namespace": {
|
|
"type": "belongs-to",
|
|
"entity": "Namespace",
|
|
"foreign_key": "namespaceId",
|
|
"on_delete": "set_null"
|
|
}
|
|
},
|
|
"query": {
|
|
"allowed_operators": ["eq", "ne", "lt", "lte", "gt", "gte", "like", "ilike", "in", "notin", "isnull", "isnotnull"],
|
|
"allowed_group_by": ["language", "category", "userId", "namespaceId", "isTemplate"],
|
|
"allowed_includes": ["namespace"],
|
|
"max_results": 500,
|
|
"timeout_ms": 5000
|
|
},
|
|
"acl": {
|
|
"create": {
|
|
"user": true,
|
|
"admin": true
|
|
},
|
|
"read": {
|
|
"self": true,
|
|
"admin": true
|
|
},
|
|
"update": {
|
|
"self": true,
|
|
"admin": true
|
|
},
|
|
"delete": {
|
|
"self": true,
|
|
"admin": true
|
|
}
|
|
}
|
|
} |