diff --git a/frontend/src/lib/components/EditorBar.svelte b/frontend/src/lib/components/EditorBar.svelte index b713caad7c..267ed501ea 100644 --- a/frontend/src/lib/components/EditorBar.svelte +++ b/frontend/src/lib/components/EditorBar.svelte @@ -105,6 +105,9 @@ function rec(x: { [name: string]: SchemaProperty }, root = false) { let res = '{\n' const entries = Object.entries(x) + if (entries.length == 0) { + return 'any' + } let i = 0 for (let [name, prop] of entries) { if (prop.type == 'object') { @@ -123,11 +126,301 @@ res += ',\n' } } + if (!root) { + res += '\n}' + } return res } return rec(schema.properties, true) } + $: console.log( + compile({ + type: 'object', + required: [], + properties: { + id: { + type: 'integer' + }, + meta: { + type: 'object', + properties: { + team: { + type: 'null' + }, + sender: { + type: 'object', + properties: { + id: { + type: 'integer' + }, + name: { + type: 'string' + }, + type: { + type: 'string' + }, + email: { + type: 'null' + }, + thumbnail: { + type: 'string' + }, + identifier: { + type: 'null' + }, + phone_number: { + type: 'null' + }, + custom_attributes: { + type: 'object' + }, + additional_attributes: { + type: 'object' + } + }, + additionalProperties: false + }, + assignee: { + type: 'null' + }, + hmac_verified: { + type: 'boolean' + } + }, + additionalProperties: false + }, + event: { + type: 'string' + }, + labels: { + type: 'array' + }, + status: { + type: 'string' + }, + channel: { + type: 'string' + }, + inbox_id: { + type: 'integer' + }, + messages: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'integer' + }, + sender: { + type: 'object', + properties: { + id: { + type: 'integer' + }, + name: { + type: 'string' + }, + type: { + type: 'string' + }, + email: { + type: ['null'] + }, + thumbnail: { + type: 'string' + }, + identifier: { + type: ['null'] + }, + phone_number: { + type: ['null'] + }, + custom_attributes: { + type: 'object' + }, + additional_attributes: { + type: 'object' + } + }, + additionalProperties: false + }, + status: { + type: 'string' + }, + content: { + type: 'string' + }, + private: { + type: 'boolean' + }, + inbox_id: { + type: 'integer' + }, + sender_id: { + type: 'integer' + }, + source_id: { + type: ['null'] + }, + account_id: { + type: 'integer' + }, + created_at: { + type: 'integer' + }, + label_list: { + type: ['null'] + }, + updated_at: { + type: 'string', + format: 'date-time' + }, + sender_type: { + type: 'string' + }, + content_type: { + type: 'string' + }, + conversation: { + type: 'object', + properties: { + assignee_id: { + type: ['null'] + }, + unread_count: { + type: 'integer' + } + }, + additionalProperties: false + }, + message_type: { + type: 'integer' + }, + conversation_id: { + type: 'integer' + }, + content_attributes: { + type: 'object' + }, + external_source_ids: { + type: 'object' + }, + additional_attributes: { + type: 'object' + } + }, + additionalProperties: false + } + }, + can_reply: { + type: 'boolean' + }, + timestamp: { + type: 'integer' + }, + created_at: { + type: 'integer' + }, + unread_count: { + type: 'integer' + }, + contact_inbox: { + type: 'object', + properties: { + id: { + type: 'integer' + }, + inbox_id: { + type: 'integer' + }, + source_id: { + type: 'string', + format: 'uuid' + }, + contact_id: { + type: 'integer' + }, + created_at: { + type: 'string', + format: 'date-time' + }, + updated_at: { + type: 'string', + format: 'date-time' + }, + pubsub_token: { + type: 'string' + }, + hmac_verified: { + type: 'boolean' + } + }, + additionalProperties: false + }, + snoozed_until: { + type: 'null' + }, + custom_attributes: { + type: 'object' + }, + agent_last_seen_at: { + type: 'integer' + }, + contact_last_seen_at: { + type: 'integer' + }, + additional_attributes: { + type: 'object', + properties: { + browser: { + type: 'object', + properties: { + device_name: { + type: 'string' + }, + browser_name: { + type: 'string' + }, + platform_name: { + type: 'string' + }, + browser_version: { + type: 'string' + }, + platform_version: { + type: 'string' + } + }, + additionalProperties: false + }, + referer: { + type: 'string', + format: 'url' + }, + initiated_at: { + type: 'object', + properties: { + timestamp: { + type: 'string' + } + }, + additionalProperties: false + }, + browser_language: { + type: 'string' + } + }, + additionalProperties: false + }, + first_reply_created_at: { + type: 'null' + } + }, + additionalProperties: false + }) + ) let historyBrowserDrawerOpen = false