Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

2.6 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        SELECT ep.entity_type AS \"entity_type!: EntityType\", ep.entity_id AS \"entity_id!\"\n        FROM UNNEST($1::text[]) AS company(id)\n        JOIN entity_properties ep\n            ON ep.property_definition_id = '00000001-0000-0000-0000-00000000000c'\n           AND ep.values->'value' @> jsonb_build_array(jsonb_build_object('entity_id', company.id))\n        UNION\n        SELECT ep.entity_type, ep.entity_id\n        FROM UNNEST($2::text[]) AS contact(id)\n        JOIN entity_properties ep\n            ON ep.property_definition_id = '00000001-0000-0000-0000-000000000013'\n           AND ep.values->'value' @> jsonb_build_array(jsonb_build_object('entity_id', contact.id))\n        UNION\n        SELECT ep.entity_type, ep.entity_id\n        FROM database_columns dc\n        JOIN property_definitions pd\n            ON pd.id = dc.property_definition_id AND pd.data_type = 'ENTITY'\n        JOIN entity_properties ep\n            ON ep.property_definition_id = dc.property_definition_id\n           AND ep.entity_type = 'DATABASE_ROW'\n        JOIN database_rows r\n            ON r.id::text = ep.entity_id AND r.table_id = dc.table_id\n        WHERE EXISTS (\n            SELECT 1\n            FROM jsonb_array_elements(\n                CASE WHEN jsonb_typeof(ep.values->'value') = 'array'\n                    THEN ep.values->'value' ELSE '[]'::jsonb END\n            ) AS reference\n            WHERE (reference->>'entity_type' = 'COMPANY'\n                   AND reference->>'entity_id' = ANY($1::text[]))\n               OR (reference->>'entity_type' = 'CONTACT'\n                   AND reference->>'entity_id' = ANY($2::text[]))\n        )\n        ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "entity_type!: EntityType",
        "type_info": {
          "Custom": {
            "name": "property_entity_type",
            "kind": {
              "Enum": [
                "CHANNEL",
                "CHAT",
                "DOCUMENT",
                "PROJECT",
                "THREAD",
                "USER",
                "COMPANY",
                "TASK",
                "CALL_RECORD",
                "CALENDAR_EVENT",
                "INITIATIVE",
                "CONTACT",
                "DATABASE_ROW"
              ]
            }
          }
        }
      },
      {
        "ordinal": 1,
        "name": "entity_id!",
        "type_info": "Text"
      }
    ],
    "parameters": {
      "Left": [
        "TextArray",
        "TextArray"
      ]
    },
    "nullable": [
      null,
      null
    ]
  },
  "hash": "6127edc878cb974a9671b6b953e1379bcb4516d3b5b6817aa7b5b2b809a9654b"
}