jspg cleanup

This commit is contained in:
2026-07-07 12:42:05 -04:00
parent abf1d12e43
commit edd0dd4763
31 changed files with 992 additions and 962 deletions

View File

@ -1293,8 +1293,8 @@
" 'age', person_3.age",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.person person_3 ON person_3.id = organization_2.id",
" JOIN agreego.organization organization_2",
" JOIN agreego.person person_3",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -1336,15 +1336,15 @@
" 'number', phone_number_8.number",
" )",
" FROM agreego.entity entity_7",
" JOIN agreego.phone_number phone_number_8 ON phone_number_8.id = entity_7.id",
" JOIN agreego.phone_number phone_number_8",
" WHERE",
" NOT entity_7.archived",
" AND relationship_5.target_id = entity_7.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_4",
" JOIN agreego.relationship relationship_5 ON relationship_5.id = entity_4.id",
" JOIN agreego.contact contact_6 ON contact_6.id = relationship_5.id",
" JOIN agreego.relationship relationship_5",
" JOIN agreego.contact contact_6",
" WHERE",
" NOT entity_4.archived",
" AND relationship_5.target_type = 'phone_number'",
@ -1366,15 +1366,15 @@
" 'address', email_address_13.address",
" )",
" FROM agreego.entity entity_12",
" JOIN agreego.email_address email_address_13 ON email_address_13.id = entity_12.id",
" JOIN agreego.email_address email_address_13",
" WHERE",
" NOT entity_12.archived",
" AND relationship_10.target_id = entity_12.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_9",
" JOIN agreego.relationship relationship_10 ON relationship_10.id = entity_9.id",
" JOIN agreego.contact contact_11 ON contact_11.id = relationship_10.id",
" JOIN agreego.relationship relationship_10",
" JOIN agreego.contact contact_11",
" WHERE",
" NOT entity_9.archived",
" AND relationship_10.target_type = 'email_address'",
@ -1396,15 +1396,15 @@
" 'city', address_18.city",
" )",
" FROM agreego.entity entity_17",
" JOIN agreego.address address_18 ON address_18.id = entity_17.id",
" JOIN agreego.address address_18",
" WHERE",
" NOT entity_17.archived",
" AND relationship_15.target_id = entity_17.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_14",
" JOIN agreego.relationship relationship_15 ON relationship_15.id = entity_14.id",
" JOIN agreego.contact contact_16 ON contact_16.id = relationship_15.id",
" JOIN agreego.relationship relationship_15",
" JOIN agreego.contact contact_16",
" WHERE",
" NOT entity_14.archived",
" AND relationship_15.target_type = 'address'",
@ -1427,7 +1427,7 @@
" 'number', phone_number_23.number",
" )",
" FROM agreego.entity entity_22",
" JOIN agreego.phone_number phone_number_23 ON phone_number_23.id = entity_22.id",
" JOIN agreego.phone_number phone_number_23",
" WHERE",
" NOT entity_22.archived",
" AND relationship_20.target_id = entity_22.id",
@ -1441,7 +1441,7 @@
" 'address', email_address_25.address",
" )",
" FROM agreego.entity entity_24",
" JOIN agreego.email_address email_address_25 ON email_address_25.id = entity_24.id",
" JOIN agreego.email_address email_address_25",
" WHERE",
" NOT entity_24.archived",
" AND relationship_20.target_id = entity_24.id",
@ -1455,7 +1455,7 @@
" 'city', address_27.city",
" )",
" FROM agreego.entity entity_26",
" JOIN agreego.address address_27 ON address_27.id = entity_26.id",
" JOIN agreego.address address_27",
" WHERE",
" NOT entity_26.archived",
" AND relationship_20.target_id = entity_26.id",
@ -1464,16 +1464,16 @@
" END",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_19",
" JOIN agreego.relationship relationship_20 ON relationship_20.id = entity_19.id",
" JOIN agreego.contact contact_21 ON contact_21.id = relationship_20.id",
" JOIN agreego.relationship relationship_20",
" JOIN agreego.contact contact_21",
" WHERE",
" NOT entity_19.archived",
" AND relationship_20.source_id = entity_1.id",
" )",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.person person_3 ON person_3.id = organization_2.id",
" JOIN agreego.organization organization_2",
" JOIN agreego.person person_3",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -1586,7 +1586,7 @@
" 'number', phone_number_8.number",
" )",
" FROM agreego.entity entity_7",
" JOIN agreego.phone_number phone_number_8 ON phone_number_8.id = entity_7.id",
" JOIN agreego.phone_number phone_number_8",
" WHERE",
" NOT entity_7.archived",
" AND phone_number_8.number ILIKE $32 #>> '{}'",
@ -1594,8 +1594,8 @@
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_4",
" JOIN agreego.relationship relationship_5 ON relationship_5.id = entity_4.id",
" JOIN agreego.contact contact_6 ON contact_6.id = relationship_5.id",
" JOIN agreego.relationship relationship_5",
" JOIN agreego.contact contact_6",
" WHERE",
" NOT entity_4.archived",
" AND relationship_5.target_type = 'phone_number'",
@ -1617,15 +1617,15 @@
" 'address', email_address_13.address",
" )",
" FROM agreego.entity entity_12",
" JOIN agreego.email_address email_address_13 ON email_address_13.id = entity_12.id",
" JOIN agreego.email_address email_address_13",
" WHERE",
" NOT entity_12.archived",
" AND relationship_10.target_id = entity_12.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_9",
" JOIN agreego.relationship relationship_10 ON relationship_10.id = entity_9.id",
" JOIN agreego.contact contact_11 ON contact_11.id = relationship_10.id",
" JOIN agreego.relationship relationship_10",
" JOIN agreego.contact contact_11",
" WHERE",
" NOT entity_9.archived",
" AND relationship_10.target_type = 'email_address'",
@ -1647,15 +1647,15 @@
" 'city', address_18.city",
" )",
" FROM agreego.entity entity_17",
" JOIN agreego.address address_18 ON address_18.id = entity_17.id",
" JOIN agreego.address address_18",
" WHERE",
" NOT entity_17.archived",
" AND relationship_15.target_id = entity_17.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_14",
" JOIN agreego.relationship relationship_15 ON relationship_15.id = entity_14.id",
" JOIN agreego.contact contact_16 ON contact_16.id = relationship_15.id",
" JOIN agreego.relationship relationship_15",
" JOIN agreego.contact contact_16",
" WHERE",
" NOT entity_14.archived",
" AND relationship_15.target_type = 'address'",
@ -1678,7 +1678,7 @@
" 'number', phone_number_23.number",
" )",
" FROM agreego.entity entity_22",
" JOIN agreego.phone_number phone_number_23 ON phone_number_23.id = entity_22.id",
" JOIN agreego.phone_number phone_number_23",
" WHERE",
" NOT entity_22.archived",
" AND relationship_20.target_id = entity_22.id",
@ -1692,7 +1692,7 @@
" 'address', email_address_25.address",
" )",
" FROM agreego.entity entity_24",
" JOIN agreego.email_address email_address_25 ON email_address_25.id = entity_24.id",
" JOIN agreego.email_address email_address_25",
" WHERE",
" NOT entity_24.archived",
" AND relationship_20.target_id = entity_24.id",
@ -1706,7 +1706,7 @@
" 'city', address_27.city",
" )",
" FROM agreego.entity entity_26",
" JOIN agreego.address address_27 ON address_27.id = entity_26.id",
" JOIN agreego.address address_27",
" WHERE",
" NOT entity_26.archived",
" AND relationship_20.target_id = entity_26.id",
@ -1715,8 +1715,8 @@
" END",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_19",
" JOIN agreego.relationship relationship_20 ON relationship_20.id = entity_19.id",
" JOIN agreego.contact contact_21 ON contact_21.id = relationship_20.id",
" JOIN agreego.relationship relationship_20",
" JOIN agreego.contact contact_21",
" WHERE",
" NOT entity_19.archived",
" AND contact_21.is_primary = ($11 #>> '{}')::BOOLEAN",
@ -1724,8 +1724,8 @@
" )",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.person person_3 ON person_3.id = organization_2.id",
" JOIN agreego.organization organization_2",
" JOIN agreego.person person_3",
" WHERE",
" NOT entity_1.archived",
" AND person_3.age = ($1 #>> '{}')::NUMERIC",
@ -1787,15 +1787,15 @@
" 'address', email_address_5.address",
" )",
" FROM agreego.entity entity_4",
" JOIN agreego.email_address email_address_5 ON email_address_5.id = entity_4.id",
" JOIN agreego.email_address email_address_5",
" WHERE",
" NOT entity_4.archived",
" AND relationship_2.target_id = entity_4.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_1",
" JOIN agreego.relationship relationship_2 ON relationship_2.id = entity_1.id",
" JOIN agreego.contact contact_3 ON contact_3.id = relationship_2.id",
" JOIN agreego.relationship relationship_2",
" JOIN agreego.contact contact_3",
" WHERE",
" NOT entity_1.archived",
" AND relationship_2.target_type = 'email_address'",
@ -1832,8 +1832,8 @@
" 'age', person_5.age",
" )",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.person person_5 ON person_5.id = organization_4.id",
" JOIN agreego.organization organization_4",
" JOIN agreego.person person_5",
" WHERE",
" NOT entity_3.archived",
" AND order_2.customer_id = person_5.id",
@ -1849,14 +1849,14 @@
" 'price', order_line_7.price",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_6",
" JOIN agreego.order_line order_line_7 ON order_line_7.id = entity_6.id",
" JOIN agreego.order_line order_line_7",
" WHERE",
" NOT entity_6.archived",
" AND order_line_7.order_id = order_2.id",
" )",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.order order_2 ON order_2.id = entity_1.id",
" JOIN agreego.order order_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -1881,7 +1881,7 @@
" 'name', organization_2.name",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.organization organization_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -1910,8 +1910,8 @@
" 'role', bot_5.role",
" )",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.bot bot_5 ON bot_5.id = organization_4.id",
" JOIN agreego.organization organization_4",
" JOIN agreego.bot bot_5",
" WHERE",
" NOT entity_3.archived",
" AND entity_3.id = entity_1.id",
@ -1925,7 +1925,7 @@
" 'name', organization_7.name",
" )",
" FROM agreego.entity entity_6",
" JOIN agreego.organization organization_7 ON organization_7.id = entity_6.id",
" JOIN agreego.organization organization_7",
" WHERE",
" NOT entity_6.archived",
" AND entity_6.id = entity_1.id",
@ -1942,8 +1942,8 @@
" 'age', person_10.age",
" )",
" FROM agreego.entity entity_8",
" JOIN agreego.organization organization_9 ON organization_9.id = entity_8.id",
" JOIN agreego.person person_10 ON person_10.id = organization_9.id",
" JOIN agreego.organization organization_9",
" JOIN agreego.person person_10",
" WHERE",
" NOT entity_8.archived",
" AND entity_8.id = entity_1.id",
@ -1951,7 +1951,7 @@
" ELSE NULL",
" END), '[]'::jsonb)",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.organization organization_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -1979,8 +1979,8 @@
" 'token', bot_5.token",
" )",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.bot bot_5 ON bot_5.id = organization_4.id",
" JOIN agreego.organization organization_4",
" JOIN agreego.bot bot_5",
" WHERE",
" NOT entity_3.archived",
" AND entity_3.id = entity_1.id",
@ -1996,8 +1996,8 @@
" 'last_name', person_8.last_name",
" )",
" FROM agreego.entity entity_6",
" JOIN agreego.organization organization_7 ON organization_7.id = entity_6.id",
" JOIN agreego.person person_8 ON person_8.id = organization_7.id",
" JOIN agreego.organization organization_7",
" JOIN agreego.person person_8",
" WHERE",
" NOT entity_6.archived",
" AND entity_6.id = entity_1.id",
@ -2005,7 +2005,7 @@
" ELSE NULL",
" END",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.organization organization_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2049,15 +2049,15 @@
" 'number', phone_number_10.number",
" )",
" FROM agreego.entity entity_9",
" JOIN agreego.phone_number phone_number_10 ON phone_number_10.id = entity_9.id",
" JOIN agreego.phone_number phone_number_10",
" WHERE",
" NOT entity_9.archived",
" AND relationship_7.target_id = entity_9.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_6",
" JOIN agreego.relationship relationship_7 ON relationship_7.id = entity_6.id",
" JOIN agreego.contact contact_8 ON contact_8.id = relationship_7.id",
" JOIN agreego.relationship relationship_7",
" JOIN agreego.contact contact_8",
" WHERE",
" NOT entity_6.archived",
" AND relationship_7.target_type = 'phone_number'",
@ -2079,15 +2079,15 @@
" 'address', email_address_15.address",
" )",
" FROM agreego.entity entity_14",
" JOIN agreego.email_address email_address_15 ON email_address_15.id = entity_14.id",
" JOIN agreego.email_address email_address_15",
" WHERE",
" NOT entity_14.archived",
" AND relationship_12.target_id = entity_14.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_11",
" JOIN agreego.relationship relationship_12 ON relationship_12.id = entity_11.id",
" JOIN agreego.contact contact_13 ON contact_13.id = relationship_12.id",
" JOIN agreego.relationship relationship_12",
" JOIN agreego.contact contact_13",
" WHERE",
" NOT entity_11.archived",
" AND relationship_12.target_type = 'email_address'",
@ -2109,15 +2109,15 @@
" 'city', address_20.city",
" )",
" FROM agreego.entity entity_19",
" JOIN agreego.address address_20 ON address_20.id = entity_19.id",
" JOIN agreego.address address_20",
" WHERE",
" NOT entity_19.archived",
" AND relationship_17.target_id = entity_19.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_16",
" JOIN agreego.relationship relationship_17 ON relationship_17.id = entity_16.id",
" JOIN agreego.contact contact_18 ON contact_18.id = relationship_17.id",
" JOIN agreego.relationship relationship_17",
" JOIN agreego.contact contact_18",
" WHERE",
" NOT entity_16.archived",
" AND relationship_17.target_type = 'address'",
@ -2140,7 +2140,7 @@
" 'number', phone_number_25.number",
" )",
" FROM agreego.entity entity_24",
" JOIN agreego.phone_number phone_number_25 ON phone_number_25.id = entity_24.id",
" JOIN agreego.phone_number phone_number_25",
" WHERE",
" NOT entity_24.archived",
" AND relationship_22.target_id = entity_24.id",
@ -2154,7 +2154,7 @@
" 'address', email_address_27.address",
" )",
" FROM agreego.entity entity_26",
" JOIN agreego.email_address email_address_27 ON email_address_27.id = entity_26.id",
" JOIN agreego.email_address email_address_27",
" WHERE",
" NOT entity_26.archived",
" AND relationship_22.target_id = entity_26.id",
@ -2168,7 +2168,7 @@
" 'city', address_29.city",
" )",
" FROM agreego.entity entity_28",
" JOIN agreego.address address_29 ON address_29.id = entity_28.id",
" JOIN agreego.address address_29",
" WHERE",
" NOT entity_28.archived",
" AND relationship_22.target_id = entity_28.id",
@ -2177,16 +2177,16 @@
" END",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_21",
" JOIN agreego.relationship relationship_22 ON relationship_22.id = entity_21.id",
" JOIN agreego.contact contact_23 ON contact_23.id = relationship_22.id",
" JOIN agreego.relationship relationship_22",
" JOIN agreego.contact contact_23",
" WHERE",
" NOT entity_21.archived",
" AND relationship_22.source_id = entity_3.id",
" )",
" )",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.person person_5 ON person_5.id = organization_4.id",
" JOIN agreego.organization organization_4",
" JOIN agreego.person person_5",
" WHERE",
" NOT entity_3.archived",
" AND entity_3.id = entity_1.id",
@ -2194,7 +2194,7 @@
" ELSE NULL",
" END",
" FROM agreego.entity entity_1",
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.organization organization_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2230,15 +2230,15 @@
" 'age', person_5.age",
" )",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.person person_5 ON person_5.id = organization_4.id",
" JOIN agreego.organization organization_4",
" JOIN agreego.person person_5",
" WHERE",
" NOT entity_3.archived",
" AND order_2.customer_id = person_5.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_1",
" JOIN agreego.order order_2 ON order_2.id = entity_1.id",
" JOIN agreego.order order_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2273,7 +2273,7 @@
" ELSE NULL",
" END), '[]'::jsonb)",
" FROM agreego.entity entity_1",
" JOIN agreego.widget widget_2 ON widget_2.id = entity_1.id",
" JOIN agreego.widget widget_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2306,7 +2306,7 @@
" 'price', invoice_line_4.price",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_3",
" JOIN agreego.invoice_line invoice_line_4 ON invoice_line_4.id = entity_3.id",
" JOIN agreego.invoice_line invoice_line_4",
" WHERE",
" NOT entity_3.archived",
" AND invoice_line_4.invoice_id = invoice_2.id",
@ -2317,7 +2317,7 @@
" 'metadata_nested_lines', invoice_2.metadata_nested_lines",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.invoice invoice_2 ON invoice_2.id = entity_1.id",
" JOIN agreego.invoice invoice_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2344,7 +2344,7 @@
" 'card_number', account_2.card_number",
" )",
" FROM agreego.entity entity_1",
" JOIN agreego.account account_2 ON account_2.id = entity_1.id",
" JOIN agreego.account account_2",
" WHERE",
" NOT entity_1.archived",
"))))"
@ -2381,8 +2381,8 @@
" 'role', bot_7.role",
" )",
" FROM agreego.entity entity_5",
" JOIN agreego.organization organization_6 ON organization_6.id = entity_5.id",
" JOIN agreego.bot bot_7 ON bot_7.id = organization_6.id",
" JOIN agreego.organization organization_6",
" JOIN agreego.bot bot_7",
" WHERE",
" NOT entity_5.archived",
" AND entity_5.id = entity_3.id",
@ -2396,7 +2396,7 @@
" 'name', organization_9.name",
" )",
" FROM agreego.entity entity_8",
" JOIN agreego.organization organization_9 ON organization_9.id = entity_8.id",
" JOIN agreego.organization organization_9",
" WHERE",
" NOT entity_8.archived",
" AND entity_8.id = entity_3.id",
@ -2413,8 +2413,8 @@
" 'age', person_12.age",
" )",
" FROM agreego.entity entity_10",
" JOIN agreego.organization organization_11 ON organization_11.id = entity_10.id",
" JOIN agreego.person person_12 ON person_12.id = organization_11.id",
" JOIN agreego.organization organization_11",
" JOIN agreego.person person_12",
" WHERE",
" NOT entity_10.archived",
" AND entity_10.id = entity_3.id",
@ -2422,14 +2422,14 @@
" ELSE NULL",
" END",
" FROM agreego.entity entity_3",
" JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id",
" JOIN agreego.organization organization_4",
" WHERE",
" NOT entity_3.archived",
" AND order_2.counterparty_id = entity_3.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.entity entity_1",
" JOIN agreego.order order_2 ON order_2.id = entity_1.id",
" JOIN agreego.order order_2",
" WHERE",
" NOT entity_1.archived",
" AND order_2.counterparty_type IN ('bot', 'organization', 'person')",