@rjromeoent/ein-supabase 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,7 @@ Shared Supabase contract package for EIN-connected apps.
5
5
  This package is the canonical home for:
6
6
 
7
7
  - Generated Supabase database types across EIN schemas.
8
+ - Type aliases for canonical database-owned enums.
8
9
  - Registered app slugs and the `x-ein-app` header helper.
9
10
  - Shared org-role helpers for `core.app_organization_memberships`.
10
11
  - Typed schema-client helpers.
@@ -68,7 +69,7 @@ Then app repos should depend on the released version:
68
69
  ```json
69
70
  {
70
71
  "dependencies": {
71
- "@rjromeoent/ein-supabase": "^0.1.0"
72
+ "@rjromeoent/ein-supabase": "^0.1.2"
72
73
  }
73
74
  }
74
75
  ```
@@ -106,6 +107,38 @@ These represent the actual EIN database contract. Every connected app should
106
107
  compile against the same source of truth instead of copying partial generated
107
108
  types.
108
109
 
110
+ #### Database-Owned Enum Aliases
111
+
112
+ Examples:
113
+
114
+ - `CoreArtistGenre`
115
+ - `RadDbAvailabilityStatus`
116
+ - `RadDbAssignmentState`
117
+ - `RadDbDecisionType`
118
+ - `BookingOfferStatus`
119
+
120
+ Why:
121
+
122
+ These are type aliases over generated Supabase enum types. They give apps a
123
+ stable import name for canonical database-owned values without copying enum
124
+ strings into each app.
125
+
126
+ Use these aliases at API, adapter, and database-boundary layers when the value
127
+ is the raw backend contract:
128
+
129
+ ```ts
130
+ import type { RadDbDecisionType } from "@rjromeoent/ein-supabase";
131
+
132
+ interface DecisionRow {
133
+ decision_type: RadDbDecisionType | null;
134
+ }
135
+ ```
136
+
137
+ Do not use these aliases for app-specific display buckets or UI commands. For
138
+ example, RAD's dashboard label `"Available"` and command action `"shortlist"`
139
+ are app vocabulary, while database values like `available` and `shortlisted`
140
+ are backend vocabulary.
141
+
109
142
  #### App Registry And Request Context
110
143
 
111
144
  Examples:
@@ -0,0 +1,10 @@
1
+ import type { Database } from "./generated/database.types.js";
2
+ export type CoreArtistGenre = Database["core"]["Enums"]["artist_genre"];
3
+ export type RadDbAssignmentState = Database["rad"]["Enums"]["assignment_state"];
4
+ export type RadDbAssignmentStatus = Database["rad"]["Enums"]["assignment_status"];
5
+ export type RadDbAvailabilityStatus = Database["rad"]["Enums"]["availability_status"];
6
+ export type RadDbDecisionActorType = Database["rad"]["Enums"]["decision_actor_type"];
7
+ export type RadDbDecisionType = Database["rad"]["Enums"]["decision_type"];
8
+ export type RadDbOfferLinkStatus = Database["rad"]["Enums"]["offer_link_status"];
9
+ export type BookingHoldLevel = Database["booking_engine"]["Enums"]["hold_level"];
10
+ export type BookingOfferStatus = Database["booking_engine"]["Enums"]["offer_status"];
@@ -0,0 +1 @@
1
+ export {};
@@ -828,6 +828,159 @@ export type Database = {
828
828
  }
829
829
  ];
830
830
  };
831
+ client_closing_packages: {
832
+ Row: {
833
+ announce_target_date: string | null;
834
+ changes_for_next_year: string | null;
835
+ client_id: string;
836
+ completed_at: string | null;
837
+ completed_by: string | null;
838
+ created_at: string;
839
+ created_by: string | null;
840
+ digital_marketing_agency_contact: string | null;
841
+ digital_marketing_agency_name: string | null;
842
+ id: string;
843
+ koc_held_at: string | null;
844
+ koc_notes: string | null;
845
+ koc_recording_url: string | null;
846
+ koc_scheduled_at: string | null;
847
+ lead_id: string | null;
848
+ marketing_asset_deadline: string | null;
849
+ on_sale_target_date: string | null;
850
+ organization_id: string;
851
+ preferred_meeting_time: string | null;
852
+ preferred_meeting_timezone: string | null;
853
+ presenting_media_sponsors: string | null;
854
+ primary_decision_maker_contact_id: string | null;
855
+ prior_year_improvements: string | null;
856
+ prior_year_successes: string | null;
857
+ production_company_contact: string | null;
858
+ production_company_name: string | null;
859
+ programming_goals: string | null;
860
+ programming_vision: string | null;
861
+ rad_portal_invited_at: string | null;
862
+ rad_portal_url: string | null;
863
+ service_rep_notes: string | null;
864
+ service_rep_required: boolean | null;
865
+ standing_meeting_day_of_week: number | null;
866
+ standing_meeting_frequency: string | null;
867
+ standout_acts_prior_year: string | null;
868
+ status: string;
869
+ teams_channel_id: string | null;
870
+ teams_channel_url: string | null;
871
+ teams_folder_url: string | null;
872
+ updated_at: string;
873
+ uses_digital_marketing_agency: boolean | null;
874
+ welcome_letter_drafted_at: string | null;
875
+ welcome_letter_sent_at: string | null;
876
+ };
877
+ Insert: {
878
+ announce_target_date?: string | null;
879
+ changes_for_next_year?: string | null;
880
+ client_id: string;
881
+ completed_at?: string | null;
882
+ completed_by?: string | null;
883
+ created_at?: string;
884
+ created_by?: string | null;
885
+ digital_marketing_agency_contact?: string | null;
886
+ digital_marketing_agency_name?: string | null;
887
+ id?: string;
888
+ koc_held_at?: string | null;
889
+ koc_notes?: string | null;
890
+ koc_recording_url?: string | null;
891
+ koc_scheduled_at?: string | null;
892
+ lead_id?: string | null;
893
+ marketing_asset_deadline?: string | null;
894
+ on_sale_target_date?: string | null;
895
+ organization_id: string;
896
+ preferred_meeting_time?: string | null;
897
+ preferred_meeting_timezone?: string | null;
898
+ presenting_media_sponsors?: string | null;
899
+ primary_decision_maker_contact_id?: string | null;
900
+ prior_year_improvements?: string | null;
901
+ prior_year_successes?: string | null;
902
+ production_company_contact?: string | null;
903
+ production_company_name?: string | null;
904
+ programming_goals?: string | null;
905
+ programming_vision?: string | null;
906
+ rad_portal_invited_at?: string | null;
907
+ rad_portal_url?: string | null;
908
+ service_rep_notes?: string | null;
909
+ service_rep_required?: boolean | null;
910
+ standing_meeting_day_of_week?: number | null;
911
+ standing_meeting_frequency?: string | null;
912
+ standout_acts_prior_year?: string | null;
913
+ status?: string;
914
+ teams_channel_id?: string | null;
915
+ teams_channel_url?: string | null;
916
+ teams_folder_url?: string | null;
917
+ updated_at?: string;
918
+ uses_digital_marketing_agency?: boolean | null;
919
+ welcome_letter_drafted_at?: string | null;
920
+ welcome_letter_sent_at?: string | null;
921
+ };
922
+ Update: {
923
+ announce_target_date?: string | null;
924
+ changes_for_next_year?: string | null;
925
+ client_id?: string;
926
+ completed_at?: string | null;
927
+ completed_by?: string | null;
928
+ created_at?: string;
929
+ created_by?: string | null;
930
+ digital_marketing_agency_contact?: string | null;
931
+ digital_marketing_agency_name?: string | null;
932
+ id?: string;
933
+ koc_held_at?: string | null;
934
+ koc_notes?: string | null;
935
+ koc_recording_url?: string | null;
936
+ koc_scheduled_at?: string | null;
937
+ lead_id?: string | null;
938
+ marketing_asset_deadline?: string | null;
939
+ on_sale_target_date?: string | null;
940
+ organization_id?: string;
941
+ preferred_meeting_time?: string | null;
942
+ preferred_meeting_timezone?: string | null;
943
+ presenting_media_sponsors?: string | null;
944
+ primary_decision_maker_contact_id?: string | null;
945
+ prior_year_improvements?: string | null;
946
+ prior_year_successes?: string | null;
947
+ production_company_contact?: string | null;
948
+ production_company_name?: string | null;
949
+ programming_goals?: string | null;
950
+ programming_vision?: string | null;
951
+ rad_portal_invited_at?: string | null;
952
+ rad_portal_url?: string | null;
953
+ service_rep_notes?: string | null;
954
+ service_rep_required?: boolean | null;
955
+ standing_meeting_day_of_week?: number | null;
956
+ standing_meeting_frequency?: string | null;
957
+ standout_acts_prior_year?: string | null;
958
+ status?: string;
959
+ teams_channel_id?: string | null;
960
+ teams_channel_url?: string | null;
961
+ teams_folder_url?: string | null;
962
+ updated_at?: string;
963
+ uses_digital_marketing_agency?: boolean | null;
964
+ welcome_letter_drafted_at?: string | null;
965
+ welcome_letter_sent_at?: string | null;
966
+ };
967
+ Relationships: [
968
+ {
969
+ foreignKeyName: "client_closing_packages_client_id_fkey";
970
+ columns: ["client_id"];
971
+ isOneToOne: true;
972
+ referencedRelation: "client_context_projection";
973
+ referencedColumns: ["client_id"];
974
+ },
975
+ {
976
+ foreignKeyName: "client_closing_packages_lead_id_fkey";
977
+ columns: ["lead_id"];
978
+ isOneToOne: false;
979
+ referencedRelation: "leads";
980
+ referencedColumns: ["id"];
981
+ }
982
+ ];
983
+ };
831
984
  client_contacts: {
832
985
  Row: {
833
986
  appears_in_documents: boolean;
@@ -1351,6 +1504,44 @@ export type Database = {
1351
1504
  }
1352
1505
  ];
1353
1506
  };
1507
+ lead_activities: {
1508
+ Row: {
1509
+ activity_type: string;
1510
+ actor_id: string | null;
1511
+ created_at: string;
1512
+ id: string;
1513
+ lead_id: string;
1514
+ organization_id: string;
1515
+ payload: Json;
1516
+ };
1517
+ Insert: {
1518
+ activity_type: string;
1519
+ actor_id?: string | null;
1520
+ created_at?: string;
1521
+ id?: string;
1522
+ lead_id: string;
1523
+ organization_id: string;
1524
+ payload?: Json;
1525
+ };
1526
+ Update: {
1527
+ activity_type?: string;
1528
+ actor_id?: string | null;
1529
+ created_at?: string;
1530
+ id?: string;
1531
+ lead_id?: string;
1532
+ organization_id?: string;
1533
+ payload?: Json;
1534
+ };
1535
+ Relationships: [
1536
+ {
1537
+ foreignKeyName: "lead_activities_lead_id_fkey";
1538
+ columns: ["lead_id"];
1539
+ isOneToOne: false;
1540
+ referencedRelation: "leads";
1541
+ referencedColumns: ["id"];
1542
+ }
1543
+ ];
1544
+ };
1354
1545
  lead_approval_records: {
1355
1546
  Row: {
1356
1547
  approver_id: string;
@@ -1404,6 +1595,62 @@ export type Database = {
1404
1595
  }
1405
1596
  ];
1406
1597
  };
1598
+ lead_tasks: {
1599
+ Row: {
1600
+ assigned_user_id: string | null;
1601
+ body: string | null;
1602
+ completed_at: string | null;
1603
+ completed_by: string | null;
1604
+ created_at: string;
1605
+ created_by: string | null;
1606
+ due_at: string | null;
1607
+ id: string;
1608
+ lead_id: string;
1609
+ organization_id: string;
1610
+ status: string;
1611
+ task_type: string;
1612
+ title: string;
1613
+ };
1614
+ Insert: {
1615
+ assigned_user_id?: string | null;
1616
+ body?: string | null;
1617
+ completed_at?: string | null;
1618
+ completed_by?: string | null;
1619
+ created_at?: string;
1620
+ created_by?: string | null;
1621
+ due_at?: string | null;
1622
+ id?: string;
1623
+ lead_id: string;
1624
+ organization_id: string;
1625
+ status?: string;
1626
+ task_type: string;
1627
+ title: string;
1628
+ };
1629
+ Update: {
1630
+ assigned_user_id?: string | null;
1631
+ body?: string | null;
1632
+ completed_at?: string | null;
1633
+ completed_by?: string | null;
1634
+ created_at?: string;
1635
+ created_by?: string | null;
1636
+ due_at?: string | null;
1637
+ id?: string;
1638
+ lead_id?: string;
1639
+ organization_id?: string;
1640
+ status?: string;
1641
+ task_type?: string;
1642
+ title?: string;
1643
+ };
1644
+ Relationships: [
1645
+ {
1646
+ foreignKeyName: "lead_tasks_lead_id_fkey";
1647
+ columns: ["lead_id"];
1648
+ isOneToOne: false;
1649
+ referencedRelation: "leads";
1650
+ referencedColumns: ["id"];
1651
+ }
1652
+ ];
1653
+ };
1407
1654
  lead_vetting_responses: {
1408
1655
  Row: {
1409
1656
  ability_to_pay_notes: string | null;
@@ -1603,11 +1850,18 @@ export type Database = {
1603
1850
  created_at: string;
1604
1851
  created_by: string | null;
1605
1852
  decline_reason: string | null;
1853
+ entertainment_budget_range: string | null;
1606
1854
  estimated_capacity: number | null;
1607
1855
  estimated_event_date: string | null;
1856
+ event_end_date: string | null;
1857
+ event_indoor_outdoor: string | null;
1608
1858
  event_name: string | null;
1609
1859
  event_type: Database["atlas"]["Enums"]["lead_event_type"] | null;
1860
+ genres: string[] | null;
1861
+ goals_top3: string | null;
1610
1862
  id: string;
1863
+ internal_notes: string | null;
1864
+ is_multi_day: boolean | null;
1611
1865
  is_rfp: boolean;
1612
1866
  lead_source: Database["atlas"]["Enums"]["lead_source_type"];
1613
1867
  lifecycle_status: Database["atlas"]["Enums"]["lead_lifecycle_status"];
@@ -1620,16 +1874,31 @@ export type Database = {
1620
1874
  num_event_days: number | null;
1621
1875
  organization_id: string;
1622
1876
  originating_tbep_id: string | null;
1877
+ part1_data: Json;
1878
+ part2_data: Json;
1879
+ pc_email: string | null;
1880
+ pc_first_name: string | null;
1881
+ pc_last_name: string | null;
1882
+ pc_phone: string | null;
1623
1883
  primary_city: string | null;
1624
1884
  primary_county: string | null;
1625
1885
  primary_state: string | null;
1886
+ promoted_contact_id: string | null;
1887
+ promoted_event_id: string | null;
1626
1888
  proposed_brand_name: string | null;
1627
1889
  proposed_event_name: string | null;
1890
+ referral_source: string | null;
1628
1891
  referral_source_client_id: string | null;
1629
1892
  rfp_submission_deadline: string | null;
1893
+ survey_completed_at: string | null;
1894
+ survey_sent_at: string | null;
1895
+ survey_token: string;
1630
1896
  updated_at: string;
1631
1897
  venue_lat: number | null;
1632
1898
  venue_lng: number | null;
1899
+ venue_ownership: string | null;
1900
+ venue_secured: boolean | null;
1901
+ venue_street: string | null;
1633
1902
  venue_zip: string | null;
1634
1903
  };
1635
1904
  Insert: {
@@ -1645,11 +1914,18 @@ export type Database = {
1645
1914
  created_at?: string;
1646
1915
  created_by?: string | null;
1647
1916
  decline_reason?: string | null;
1917
+ entertainment_budget_range?: string | null;
1648
1918
  estimated_capacity?: number | null;
1649
1919
  estimated_event_date?: string | null;
1920
+ event_end_date?: string | null;
1921
+ event_indoor_outdoor?: string | null;
1650
1922
  event_name?: string | null;
1651
1923
  event_type?: Database["atlas"]["Enums"]["lead_event_type"] | null;
1924
+ genres?: string[] | null;
1925
+ goals_top3?: string | null;
1652
1926
  id?: string;
1927
+ internal_notes?: string | null;
1928
+ is_multi_day?: boolean | null;
1653
1929
  is_rfp?: boolean;
1654
1930
  lead_source: Database["atlas"]["Enums"]["lead_source_type"];
1655
1931
  lifecycle_status?: Database["atlas"]["Enums"]["lead_lifecycle_status"];
@@ -1662,16 +1938,31 @@ export type Database = {
1662
1938
  num_event_days?: number | null;
1663
1939
  organization_id: string;
1664
1940
  originating_tbep_id?: string | null;
1941
+ part1_data?: Json;
1942
+ part2_data?: Json;
1943
+ pc_email?: string | null;
1944
+ pc_first_name?: string | null;
1945
+ pc_last_name?: string | null;
1946
+ pc_phone?: string | null;
1665
1947
  primary_city?: string | null;
1666
1948
  primary_county?: string | null;
1667
1949
  primary_state?: string | null;
1950
+ promoted_contact_id?: string | null;
1951
+ promoted_event_id?: string | null;
1668
1952
  proposed_brand_name?: string | null;
1669
1953
  proposed_event_name?: string | null;
1954
+ referral_source?: string | null;
1670
1955
  referral_source_client_id?: string | null;
1671
1956
  rfp_submission_deadline?: string | null;
1957
+ survey_completed_at?: string | null;
1958
+ survey_sent_at?: string | null;
1959
+ survey_token?: string;
1672
1960
  updated_at?: string;
1673
1961
  venue_lat?: number | null;
1674
1962
  venue_lng?: number | null;
1963
+ venue_ownership?: string | null;
1964
+ venue_secured?: boolean | null;
1965
+ venue_street?: string | null;
1675
1966
  venue_zip?: string | null;
1676
1967
  };
1677
1968
  Update: {
@@ -1687,11 +1978,18 @@ export type Database = {
1687
1978
  created_at?: string;
1688
1979
  created_by?: string | null;
1689
1980
  decline_reason?: string | null;
1981
+ entertainment_budget_range?: string | null;
1690
1982
  estimated_capacity?: number | null;
1691
1983
  estimated_event_date?: string | null;
1984
+ event_end_date?: string | null;
1985
+ event_indoor_outdoor?: string | null;
1692
1986
  event_name?: string | null;
1693
1987
  event_type?: Database["atlas"]["Enums"]["lead_event_type"] | null;
1988
+ genres?: string[] | null;
1989
+ goals_top3?: string | null;
1694
1990
  id?: string;
1991
+ internal_notes?: string | null;
1992
+ is_multi_day?: boolean | null;
1695
1993
  is_rfp?: boolean;
1696
1994
  lead_source?: Database["atlas"]["Enums"]["lead_source_type"];
1697
1995
  lifecycle_status?: Database["atlas"]["Enums"]["lead_lifecycle_status"];
@@ -1704,16 +2002,31 @@ export type Database = {
1704
2002
  num_event_days?: number | null;
1705
2003
  organization_id?: string;
1706
2004
  originating_tbep_id?: string | null;
2005
+ part1_data?: Json;
2006
+ part2_data?: Json;
2007
+ pc_email?: string | null;
2008
+ pc_first_name?: string | null;
2009
+ pc_last_name?: string | null;
2010
+ pc_phone?: string | null;
1707
2011
  primary_city?: string | null;
1708
2012
  primary_county?: string | null;
1709
2013
  primary_state?: string | null;
2014
+ promoted_contact_id?: string | null;
2015
+ promoted_event_id?: string | null;
1710
2016
  proposed_brand_name?: string | null;
1711
2017
  proposed_event_name?: string | null;
2018
+ referral_source?: string | null;
1712
2019
  referral_source_client_id?: string | null;
1713
2020
  rfp_submission_deadline?: string | null;
2021
+ survey_completed_at?: string | null;
2022
+ survey_sent_at?: string | null;
2023
+ survey_token?: string;
1714
2024
  updated_at?: string;
1715
2025
  venue_lat?: number | null;
1716
2026
  venue_lng?: number | null;
2027
+ venue_ownership?: string | null;
2028
+ venue_secured?: boolean | null;
2029
+ venue_street?: string | null;
1717
2030
  venue_zip?: string | null;
1718
2031
  };
1719
2032
  Relationships: [
@@ -2140,6 +2453,23 @@ export type Database = {
2140
2453
  };
2141
2454
  Returns: Json;
2142
2455
  };
2456
+ get_lead_by_survey_token: {
2457
+ Args: {
2458
+ p_token: string;
2459
+ };
2460
+ Returns: {
2461
+ event_name: string;
2462
+ lead_id: string;
2463
+ organization_name: string;
2464
+ part2_data: Json;
2465
+ pc_email: string;
2466
+ pc_first_name: string;
2467
+ pc_last_name: string;
2468
+ reg_contact_name: string;
2469
+ survey_completed_at: string;
2470
+ survey_sent_at: string;
2471
+ }[];
2472
+ };
2143
2473
  match_artists_for_bulk_pricing: {
2144
2474
  Args: {
2145
2475
  _names: string[];
@@ -2175,6 +2505,19 @@ export type Database = {
2175
2505
  };
2176
2506
  Returns: string;
2177
2507
  };
2508
+ promote_lead_to_client: {
2509
+ Args: {
2510
+ p_lead_id: string;
2511
+ p_overrides?: Json;
2512
+ };
2513
+ Returns: {
2514
+ client_id: string;
2515
+ closing_package_id: string;
2516
+ primary_contact_id: string;
2517
+ secondary_contact_id: string;
2518
+ signer_contact_id: string;
2519
+ }[];
2520
+ };
2178
2521
  recompute_contact_dedup_state: {
2179
2522
  Args: {
2180
2523
  _organization_id?: string;
@@ -2242,6 +2585,15 @@ export type Database = {
2242
2585
  };
2243
2586
  Returns: string[];
2244
2587
  };
2588
+ upsert_survey_response: {
2589
+ Args: {
2590
+ p_complete?: boolean;
2591
+ p_section_data: Json;
2592
+ p_section_key: string;
2593
+ p_token: string;
2594
+ };
2595
+ Returns: string;
2596
+ };
2245
2597
  };
2246
2598
  Enums: {
2247
2599
  agent_portal_status: "PENDING" | "APPROVED" | "SUSPENDED" | "REVOKED";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./app-context.js";
2
2
  export * from "./auth.js";
3
+ export type * from "./db-enums.js";
3
4
  export * from "./json.js";
4
5
  export * from "./schema-client.js";
5
6
  export type { Constants, Database, Enums, Json, Tables, TablesInsert, TablesUpdate, } from "./generated/database.types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjromeoent/ein-supabase",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Shared Supabase types, app context, and contract helpers for EIN-connected apps.",
5
5
  "type": "module",
6
6
  "sideEffects": false,