@rjromeoent/ein-supabase 0.1.5 → 0.1.7

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
@@ -31,9 +31,21 @@ From the Event Intelligence Network repo root:
31
31
  ```sh
32
32
  npm install
33
33
  npm run generate:supabase-types
34
+ npm run test:functions
35
+ npm run test:db:rad
34
36
  npm run build:packages
37
+ npm run verify:ein-supabase
35
38
  ```
36
39
 
40
+ `test:db:rad` is an optional integration test suite. It requires
41
+ `DATABASE_URL` to point at a disposable or remote Supabase Postgres database
42
+ and each SQL test runs inside a transaction that rolls back its fixtures. It
43
+ proves the RAD Booking offer-context consumer RPC updates both the read model
44
+ and event consumer offset against real database constraints, and it validates
45
+ RAD decision integrity rules such as append-only decision logs and
46
+ offer-created/link consistency. It also verifies app-scoped RAD RLS blocks
47
+ cross-organization decision-log reads under the `authenticated` role.
48
+
37
49
  Or from this package directory:
38
50
 
39
51
  ```sh
@@ -54,11 +66,17 @@ available to the publishing user, types are regenerated, and the package build
54
66
  passes:
55
67
 
56
68
  ```sh
57
- npm run build:packages
69
+ npm run verify:ein-supabase
58
70
  npm run pack:ein-supabase
59
71
  npm run publish:ein-supabase
60
72
  ```
61
73
 
74
+ `verify:ein-supabase` regenerates Supabase types, fails if the generated
75
+ database contract is not committed, runs Deno edge-function tests, builds the
76
+ package, and runs an npm pack dry-run. The rollbacked DB integration test is
77
+ kept as an explicit script because it needs a live Postgres connection.
78
+ Publishing should not happen from unverified or locally drifted schema types.
79
+
62
80
  The package is configured as a public scoped package. That is intentional for
63
81
  Lovable apps: app deploys can install it without an npm auth token. Do not put
64
82
  secrets, service-role keys, database passwords, or private environment values in
@@ -16768,6 +16768,411 @@ export type Database = {
16768
16768
  }
16769
16769
  ];
16770
16770
  };
16771
+ dashboard_search_overlays: {
16772
+ Row: {
16773
+ availability_window_id: string;
16774
+ available_with_routing_match: boolean;
16775
+ center_city_key: string;
16776
+ computed_at: string;
16777
+ has_market_conflict: boolean;
16778
+ has_nearby_interest: boolean;
16779
+ interest_from: string;
16780
+ interest_to: string;
16781
+ is_routed: boolean;
16782
+ market_conflicts: Json;
16783
+ nearby_interest: Json;
16784
+ organization_id: string;
16785
+ radius_conflict: boolean;
16786
+ radius_conflicts: Json;
16787
+ radius_miles: number;
16788
+ routing_shows: Json;
16789
+ same_day_interest: Json;
16790
+ source_window_hash: string | null;
16791
+ };
16792
+ Insert: {
16793
+ availability_window_id: string;
16794
+ available_with_routing_match?: boolean;
16795
+ center_city_key: string;
16796
+ computed_at?: string;
16797
+ has_market_conflict?: boolean;
16798
+ has_nearby_interest?: boolean;
16799
+ interest_from: string;
16800
+ interest_to: string;
16801
+ is_routed?: boolean;
16802
+ market_conflicts?: Json;
16803
+ nearby_interest?: Json;
16804
+ organization_id: string;
16805
+ radius_conflict?: boolean;
16806
+ radius_conflicts?: Json;
16807
+ radius_miles: number;
16808
+ routing_shows?: Json;
16809
+ same_day_interest?: Json;
16810
+ source_window_hash?: string | null;
16811
+ };
16812
+ Update: {
16813
+ availability_window_id?: string;
16814
+ available_with_routing_match?: boolean;
16815
+ center_city_key?: string;
16816
+ computed_at?: string;
16817
+ has_market_conflict?: boolean;
16818
+ has_nearby_interest?: boolean;
16819
+ interest_from?: string;
16820
+ interest_to?: string;
16821
+ is_routed?: boolean;
16822
+ market_conflicts?: Json;
16823
+ nearby_interest?: Json;
16824
+ organization_id?: string;
16825
+ radius_conflict?: boolean;
16826
+ radius_conflicts?: Json;
16827
+ radius_miles?: number;
16828
+ routing_shows?: Json;
16829
+ same_day_interest?: Json;
16830
+ source_window_hash?: string | null;
16831
+ };
16832
+ Relationships: [
16833
+ {
16834
+ foreignKeyName: "dashboard_search_overlays_availability_window_id_fkey";
16835
+ columns: ["availability_window_id"];
16836
+ isOneToOne: false;
16837
+ referencedRelation: "artist_availability_windows";
16838
+ referencedColumns: ["id"];
16839
+ },
16840
+ {
16841
+ foreignKeyName: "dashboard_search_overlays_availability_window_id_fkey";
16842
+ columns: ["availability_window_id"];
16843
+ isOneToOne: false;
16844
+ referencedRelation: "availability_search_base";
16845
+ referencedColumns: ["id"];
16846
+ },
16847
+ {
16848
+ foreignKeyName: "dashboard_search_overlays_availability_window_id_fkey";
16849
+ columns: ["availability_window_id"];
16850
+ isOneToOne: false;
16851
+ referencedRelation: "event_edition_live_grid";
16852
+ referencedColumns: ["live_availability_window_id"];
16853
+ },
16854
+ {
16855
+ foreignKeyName: "dashboard_search_overlays_organization_id_fkey";
16856
+ columns: ["organization_id"];
16857
+ isOneToOne: false;
16858
+ referencedRelation: "dashboard_health_view";
16859
+ referencedColumns: ["organization_id"];
16860
+ },
16861
+ {
16862
+ foreignKeyName: "dashboard_search_overlays_organization_id_fkey";
16863
+ columns: ["organization_id"];
16864
+ isOneToOne: false;
16865
+ referencedRelation: "system_health_overview";
16866
+ referencedColumns: ["organization_id"];
16867
+ }
16868
+ ];
16869
+ };
16870
+ dashboard_search_refresh_runs: {
16871
+ Row: {
16872
+ error_message: string | null;
16873
+ finished_at: string | null;
16874
+ id: string;
16875
+ metadata: Json;
16876
+ organization_id: string | null;
16877
+ refresh_scope: string;
16878
+ refresh_status: string;
16879
+ rows_deleted: number;
16880
+ rows_upserted: number;
16881
+ started_at: string;
16882
+ };
16883
+ Insert: {
16884
+ error_message?: string | null;
16885
+ finished_at?: string | null;
16886
+ id?: string;
16887
+ metadata?: Json;
16888
+ organization_id?: string | null;
16889
+ refresh_scope: string;
16890
+ refresh_status?: string;
16891
+ rows_deleted?: number;
16892
+ rows_upserted?: number;
16893
+ started_at?: string;
16894
+ };
16895
+ Update: {
16896
+ error_message?: string | null;
16897
+ finished_at?: string | null;
16898
+ id?: string;
16899
+ metadata?: Json;
16900
+ organization_id?: string | null;
16901
+ refresh_scope?: string;
16902
+ refresh_status?: string;
16903
+ rows_deleted?: number;
16904
+ rows_upserted?: number;
16905
+ started_at?: string;
16906
+ };
16907
+ Relationships: [
16908
+ {
16909
+ foreignKeyName: "dashboard_search_refresh_runs_organization_id_fkey";
16910
+ columns: ["organization_id"];
16911
+ isOneToOne: false;
16912
+ referencedRelation: "dashboard_health_view";
16913
+ referencedColumns: ["organization_id"];
16914
+ },
16915
+ {
16916
+ foreignKeyName: "dashboard_search_refresh_runs_organization_id_fkey";
16917
+ columns: ["organization_id"];
16918
+ isOneToOne: false;
16919
+ referencedRelation: "system_health_overview";
16920
+ referencedColumns: ["organization_id"];
16921
+ }
16922
+ ];
16923
+ };
16924
+ dashboard_search_windows: {
16925
+ Row: {
16926
+ agency: string | null;
16927
+ agency_lc: string | null;
16928
+ analytics_activity_score: number | null;
16929
+ analytics_activity_tier: string | null;
16930
+ analytics_artist_rank: number | null;
16931
+ analytics_chartmetric_id: string | null;
16932
+ analytics_instagram_engagement: number | null;
16933
+ analytics_instagram_followers: number | null;
16934
+ analytics_last_updated_at: string | null;
16935
+ analytics_next_update_due: string | null;
16936
+ analytics_spotify_followers: number | null;
16937
+ analytics_spotify_monthly_listeners: number | null;
16938
+ analytics_tiktok_engagement: number | null;
16939
+ analytics_tiktok_followers: number | null;
16940
+ analytics_tiktok_track_posts: number | null;
16941
+ analytics_total_fanbase: number | null;
16942
+ artist_id: string;
16943
+ artist_name: string;
16944
+ artist_name_lc: string;
16945
+ artist_normalized_name: string | null;
16946
+ artist_normalized_name_lc: string | null;
16947
+ assignment_count: number;
16948
+ availability_window_id: string;
16949
+ confidence: number | null;
16950
+ data_freshness_days: number | null;
16951
+ effective_date: string;
16952
+ effective_status: string;
16953
+ financials_total_shows: number | null;
16954
+ genre: string | null;
16955
+ genre_lc: string | null;
16956
+ has_assignment: boolean;
16957
+ inferred_at: string | null;
16958
+ interest_source: string | null;
16959
+ is_active: boolean;
16960
+ is_inferred: boolean;
16961
+ latest_assigned_at: string | null;
16962
+ latest_assignment_state: string | null;
16963
+ market_city: string | null;
16964
+ market_city_lc: string | null;
16965
+ market_id: string | null;
16966
+ market_name: string | null;
16967
+ market_name_lc: string | null;
16968
+ market_state: string | null;
16969
+ momentum: string | null;
16970
+ organization_id: string;
16971
+ primary_source: string | null;
16972
+ quote_avg_gross: number | null;
16973
+ quote_avg_guarantee: number | null;
16974
+ quote_avg_tickets_sold: number | null;
16975
+ quote_high: number | null;
16976
+ quote_low: number | null;
16977
+ read_model_hash: string;
16978
+ read_model_refreshed_at: string;
16979
+ reg_last_mod_date: string | null;
16980
+ source_updated_at: string | null;
16981
+ status_display: string;
16982
+ tracked_artist_id: string;
16983
+ venue_capacity: number | null;
16984
+ venue_id: string | null;
16985
+ venue_name: string | null;
16986
+ venue_name_lc: string | null;
16987
+ venue_type: string | null;
16988
+ };
16989
+ Insert: {
16990
+ agency?: string | null;
16991
+ agency_lc?: string | null;
16992
+ analytics_activity_score?: number | null;
16993
+ analytics_activity_tier?: string | null;
16994
+ analytics_artist_rank?: number | null;
16995
+ analytics_chartmetric_id?: string | null;
16996
+ analytics_instagram_engagement?: number | null;
16997
+ analytics_instagram_followers?: number | null;
16998
+ analytics_last_updated_at?: string | null;
16999
+ analytics_next_update_due?: string | null;
17000
+ analytics_spotify_followers?: number | null;
17001
+ analytics_spotify_monthly_listeners?: number | null;
17002
+ analytics_tiktok_engagement?: number | null;
17003
+ analytics_tiktok_followers?: number | null;
17004
+ analytics_tiktok_track_posts?: number | null;
17005
+ analytics_total_fanbase?: number | null;
17006
+ artist_id: string;
17007
+ artist_name: string;
17008
+ artist_name_lc: string;
17009
+ artist_normalized_name?: string | null;
17010
+ artist_normalized_name_lc?: string | null;
17011
+ assignment_count?: number;
17012
+ availability_window_id: string;
17013
+ confidence?: number | null;
17014
+ data_freshness_days?: number | null;
17015
+ effective_date: string;
17016
+ effective_status: string;
17017
+ financials_total_shows?: number | null;
17018
+ genre?: string | null;
17019
+ genre_lc?: string | null;
17020
+ has_assignment?: boolean;
17021
+ inferred_at?: string | null;
17022
+ interest_source?: string | null;
17023
+ is_active?: boolean;
17024
+ is_inferred?: boolean;
17025
+ latest_assigned_at?: string | null;
17026
+ latest_assignment_state?: string | null;
17027
+ market_city?: string | null;
17028
+ market_city_lc?: string | null;
17029
+ market_id?: string | null;
17030
+ market_name?: string | null;
17031
+ market_name_lc?: string | null;
17032
+ market_state?: string | null;
17033
+ momentum?: string | null;
17034
+ organization_id: string;
17035
+ primary_source?: string | null;
17036
+ quote_avg_gross?: number | null;
17037
+ quote_avg_guarantee?: number | null;
17038
+ quote_avg_tickets_sold?: number | null;
17039
+ quote_high?: number | null;
17040
+ quote_low?: number | null;
17041
+ read_model_hash: string;
17042
+ read_model_refreshed_at?: string;
17043
+ reg_last_mod_date?: string | null;
17044
+ source_updated_at?: string | null;
17045
+ status_display: string;
17046
+ tracked_artist_id: string;
17047
+ venue_capacity?: number | null;
17048
+ venue_id?: string | null;
17049
+ venue_name?: string | null;
17050
+ venue_name_lc?: string | null;
17051
+ venue_type?: string | null;
17052
+ };
17053
+ Update: {
17054
+ agency?: string | null;
17055
+ agency_lc?: string | null;
17056
+ analytics_activity_score?: number | null;
17057
+ analytics_activity_tier?: string | null;
17058
+ analytics_artist_rank?: number | null;
17059
+ analytics_chartmetric_id?: string | null;
17060
+ analytics_instagram_engagement?: number | null;
17061
+ analytics_instagram_followers?: number | null;
17062
+ analytics_last_updated_at?: string | null;
17063
+ analytics_next_update_due?: string | null;
17064
+ analytics_spotify_followers?: number | null;
17065
+ analytics_spotify_monthly_listeners?: number | null;
17066
+ analytics_tiktok_engagement?: number | null;
17067
+ analytics_tiktok_followers?: number | null;
17068
+ analytics_tiktok_track_posts?: number | null;
17069
+ analytics_total_fanbase?: number | null;
17070
+ artist_id?: string;
17071
+ artist_name?: string;
17072
+ artist_name_lc?: string;
17073
+ artist_normalized_name?: string | null;
17074
+ artist_normalized_name_lc?: string | null;
17075
+ assignment_count?: number;
17076
+ availability_window_id?: string;
17077
+ confidence?: number | null;
17078
+ data_freshness_days?: number | null;
17079
+ effective_date?: string;
17080
+ effective_status?: string;
17081
+ financials_total_shows?: number | null;
17082
+ genre?: string | null;
17083
+ genre_lc?: string | null;
17084
+ has_assignment?: boolean;
17085
+ inferred_at?: string | null;
17086
+ interest_source?: string | null;
17087
+ is_active?: boolean;
17088
+ is_inferred?: boolean;
17089
+ latest_assigned_at?: string | null;
17090
+ latest_assignment_state?: string | null;
17091
+ market_city?: string | null;
17092
+ market_city_lc?: string | null;
17093
+ market_id?: string | null;
17094
+ market_name?: string | null;
17095
+ market_name_lc?: string | null;
17096
+ market_state?: string | null;
17097
+ momentum?: string | null;
17098
+ organization_id?: string;
17099
+ primary_source?: string | null;
17100
+ quote_avg_gross?: number | null;
17101
+ quote_avg_guarantee?: number | null;
17102
+ quote_avg_tickets_sold?: number | null;
17103
+ quote_high?: number | null;
17104
+ quote_low?: number | null;
17105
+ read_model_hash?: string;
17106
+ read_model_refreshed_at?: string;
17107
+ reg_last_mod_date?: string | null;
17108
+ source_updated_at?: string | null;
17109
+ status_display?: string;
17110
+ tracked_artist_id?: string;
17111
+ venue_capacity?: number | null;
17112
+ venue_id?: string | null;
17113
+ venue_name?: string | null;
17114
+ venue_name_lc?: string | null;
17115
+ venue_type?: string | null;
17116
+ };
17117
+ Relationships: [
17118
+ {
17119
+ foreignKeyName: "dashboard_search_windows_availability_window_id_fkey";
17120
+ columns: ["availability_window_id"];
17121
+ isOneToOne: true;
17122
+ referencedRelation: "artist_availability_windows";
17123
+ referencedColumns: ["id"];
17124
+ },
17125
+ {
17126
+ foreignKeyName: "dashboard_search_windows_availability_window_id_fkey";
17127
+ columns: ["availability_window_id"];
17128
+ isOneToOne: true;
17129
+ referencedRelation: "availability_search_base";
17130
+ referencedColumns: ["id"];
17131
+ },
17132
+ {
17133
+ foreignKeyName: "dashboard_search_windows_availability_window_id_fkey";
17134
+ columns: ["availability_window_id"];
17135
+ isOneToOne: true;
17136
+ referencedRelation: "event_edition_live_grid";
17137
+ referencedColumns: ["live_availability_window_id"];
17138
+ },
17139
+ {
17140
+ foreignKeyName: "dashboard_search_windows_organization_id_fkey";
17141
+ columns: ["organization_id"];
17142
+ isOneToOne: false;
17143
+ referencedRelation: "dashboard_health_view";
17144
+ referencedColumns: ["organization_id"];
17145
+ },
17146
+ {
17147
+ foreignKeyName: "dashboard_search_windows_organization_id_fkey";
17148
+ columns: ["organization_id"];
17149
+ isOneToOne: false;
17150
+ referencedRelation: "system_health_overview";
17151
+ referencedColumns: ["organization_id"];
17152
+ },
17153
+ {
17154
+ foreignKeyName: "dashboard_search_windows_tracked_artist_id_fkey";
17155
+ columns: ["tracked_artist_id"];
17156
+ isOneToOne: false;
17157
+ referencedRelation: "artist_detail_view";
17158
+ referencedColumns: ["tracked_artist_id"];
17159
+ },
17160
+ {
17161
+ foreignKeyName: "dashboard_search_windows_tracked_artist_id_fkey";
17162
+ columns: ["tracked_artist_id"];
17163
+ isOneToOne: false;
17164
+ referencedRelation: "artist_freshness_view";
17165
+ referencedColumns: ["tracked_artist_id"];
17166
+ },
17167
+ {
17168
+ foreignKeyName: "dashboard_search_windows_tracked_artist_id_fkey";
17169
+ columns: ["tracked_artist_id"];
17170
+ isOneToOne: false;
17171
+ referencedRelation: "tracked_artists";
17172
+ referencedColumns: ["id"];
17173
+ }
17174
+ ];
17175
+ };
16771
17176
  decision_log: {
16772
17177
  Row: {
16773
17178
  artist_id: string;
@@ -19021,14 +19426,7 @@ export type Database = {
19021
19426
  };
19022
19427
  };
19023
19428
  Functions: {
19024
- consume_booking_offer_context_events: {
19025
- Args: {
19026
- _consumer_name?: string;
19027
- _limit?: number;
19028
- };
19029
- Returns: Json;
19030
- };
19031
- count_matching_artists: {
19429
+ advanced_filtered_availability_search_rows: {
19032
19430
  Args: {
19033
19431
  p_active_only?: boolean;
19034
19432
  p_agencies?: string[];
@@ -19042,18 +19440,303 @@ export type Database = {
19042
19440
  p_fanbase_max?: number;
19043
19441
  p_fanbase_min?: number;
19044
19442
  p_genres?: string[];
19443
+ p_has_market_conflict?: boolean;
19444
+ p_has_nearby_interest?: boolean;
19445
+ p_has_radius_conflict?: boolean;
19446
+ p_has_routing_opportunity?: boolean;
19045
19447
  p_momentums?: string[];
19046
19448
  p_organization_id: string;
19047
19449
  p_quote_high?: number;
19048
19450
  p_quote_low?: number;
19049
19451
  p_radius_miles?: number;
19452
+ p_require_available_with_routing?: boolean;
19050
19453
  p_search?: string;
19051
19454
  p_spotify_max?: number;
19052
19455
  p_spotify_min?: number;
19053
19456
  p_states?: string[];
19054
19457
  p_statuses?: string[];
19055
19458
  };
19056
- Returns: number;
19459
+ Returns: {
19460
+ agency: string;
19461
+ analytics_activity_score: number;
19462
+ analytics_activity_tier: string;
19463
+ analytics_artist_rank: number;
19464
+ analytics_chartmetric_id: string;
19465
+ analytics_instagram_engagement: number;
19466
+ analytics_instagram_followers: number;
19467
+ analytics_last_updated_at: string;
19468
+ analytics_next_update_due: string;
19469
+ analytics_spotify_followers: number;
19470
+ analytics_spotify_monthly_listeners: number;
19471
+ analytics_tiktok_engagement: number;
19472
+ analytics_tiktok_followers: number;
19473
+ analytics_tiktok_track_posts: number;
19474
+ analytics_total_fanbase: number;
19475
+ artist_id: string;
19476
+ artist_name: string;
19477
+ artist_normalized_name: string;
19478
+ confidence: number;
19479
+ core_artist_website: string;
19480
+ data_freshness_days: number;
19481
+ date: string;
19482
+ distance_miles: number;
19483
+ financials_avg_gross: number;
19484
+ financials_avg_guarantee: number;
19485
+ financials_avg_tickets_sold: number;
19486
+ financials_quote_high: number;
19487
+ financials_quote_low: number;
19488
+ financials_total_shows: number;
19489
+ genre: string;
19490
+ historical_scrape_status: string;
19491
+ id: string;
19492
+ inferred_at: string;
19493
+ interest_source: string;
19494
+ is_active: boolean;
19495
+ is_assigned: boolean;
19496
+ is_inferred: boolean;
19497
+ is_market_match: boolean;
19498
+ is_radius_match: boolean;
19499
+ last_scraped_at: string;
19500
+ last_sync_status: string;
19501
+ lineage: Json;
19502
+ location_city_key: string;
19503
+ market_city: string;
19504
+ market_id: string;
19505
+ market_market: string;
19506
+ market_state: string;
19507
+ momentum: string;
19508
+ organization_id: string;
19509
+ primary_source: string;
19510
+ reg_last_mod_date: string;
19511
+ reg_last_synced_at: string;
19512
+ reg_metadata_last_synced_at: string;
19513
+ status: string;
19514
+ status_display: string;
19515
+ tracked_artist_id: string;
19516
+ tracked_artist_website: string;
19517
+ updated_at: string;
19518
+ venue_capacity: number;
19519
+ venue_id: string;
19520
+ venue_name: string;
19521
+ venue_type: string;
19522
+ }[];
19523
+ };
19524
+ consume_booking_offer_context_events: {
19525
+ Args: {
19526
+ _consumer_name?: string;
19527
+ _limit?: number;
19528
+ };
19529
+ Returns: Json;
19530
+ };
19531
+ count_matching_artists: {
19532
+ Args: {
19533
+ p_active_only?: boolean;
19534
+ p_agencies?: string[];
19535
+ p_artists?: string[];
19536
+ p_assigned_only?: boolean;
19537
+ p_center_city?: string;
19538
+ p_city?: string;
19539
+ p_date_from: string;
19540
+ p_date_to: string;
19541
+ p_event_edition_id?: string;
19542
+ p_fanbase_max?: number;
19543
+ p_fanbase_min?: number;
19544
+ p_genres?: string[];
19545
+ p_has_market_conflict?: boolean;
19546
+ p_has_nearby_interest?: boolean;
19547
+ p_has_radius_conflict?: boolean;
19548
+ p_has_routing_opportunity?: boolean;
19549
+ p_momentums?: string[];
19550
+ p_organization_id: string;
19551
+ p_quote_high?: number;
19552
+ p_quote_low?: number;
19553
+ p_radius_miles?: number;
19554
+ p_require_available_with_routing?: boolean;
19555
+ p_search?: string;
19556
+ p_spotify_max?: number;
19557
+ p_spotify_min?: number;
19558
+ p_states?: string[];
19559
+ p_statuses?: string[];
19560
+ };
19561
+ Returns: number;
19562
+ };
19563
+ dashboard_advanced_filtered_window_ids: {
19564
+ Args: {
19565
+ p_availability_window_ids: string[];
19566
+ p_center_city?: string;
19567
+ p_has_market_conflict?: boolean;
19568
+ p_has_nearby_interest?: boolean;
19569
+ p_has_radius_conflict?: boolean;
19570
+ p_has_routing_opportunity?: boolean;
19571
+ p_interest_from?: string;
19572
+ p_interest_to?: string;
19573
+ p_organization_id: string;
19574
+ p_radius_miles?: number;
19575
+ p_require_available_with_routing?: boolean;
19576
+ };
19577
+ Returns: {
19578
+ availability_window_id: string;
19579
+ }[];
19580
+ };
19581
+ dashboard_search_overlay_cache_status: {
19582
+ Args: {
19583
+ p_center_city: string;
19584
+ p_date_from: string;
19585
+ p_date_to: string;
19586
+ p_interest_from: string;
19587
+ p_interest_to: string;
19588
+ p_organization_id: string;
19589
+ p_radius_miles: number;
19590
+ };
19591
+ Returns: {
19592
+ cache_complete: boolean;
19593
+ center_city_key: string;
19594
+ interest_from: string;
19595
+ interest_to: string;
19596
+ missing_window_count: number;
19597
+ newest_refreshed_at: string;
19598
+ oldest_refreshed_at: string;
19599
+ overlay_window_count: number;
19600
+ radius_miles: number;
19601
+ source_window_count: number;
19602
+ }[];
19603
+ };
19604
+ dashboard_search_window_source_rows: {
19605
+ Args: {
19606
+ p_availability_window_id?: string;
19607
+ p_organization_id?: string;
19608
+ };
19609
+ Returns: {
19610
+ agency: string;
19611
+ agency_lc: string;
19612
+ analytics_activity_score: number;
19613
+ analytics_activity_tier: string;
19614
+ analytics_artist_rank: number;
19615
+ analytics_chartmetric_id: string;
19616
+ analytics_instagram_engagement: number;
19617
+ analytics_instagram_followers: number;
19618
+ analytics_last_updated_at: string;
19619
+ analytics_next_update_due: string;
19620
+ analytics_spotify_followers: number;
19621
+ analytics_spotify_monthly_listeners: number;
19622
+ analytics_tiktok_engagement: number;
19623
+ analytics_tiktok_followers: number;
19624
+ analytics_tiktok_track_posts: number;
19625
+ analytics_total_fanbase: number;
19626
+ artist_id: string;
19627
+ artist_name: string;
19628
+ artist_name_lc: string;
19629
+ artist_normalized_name: string;
19630
+ artist_normalized_name_lc: string;
19631
+ assignment_count: number;
19632
+ availability_window_id: string;
19633
+ confidence: number;
19634
+ data_freshness_days: number;
19635
+ effective_date: string;
19636
+ effective_status: string;
19637
+ financials_total_shows: number;
19638
+ genre: string;
19639
+ genre_lc: string;
19640
+ has_assignment: boolean;
19641
+ inferred_at: string;
19642
+ interest_source: string;
19643
+ is_active: boolean;
19644
+ is_inferred: boolean;
19645
+ latest_assigned_at: string;
19646
+ latest_assignment_state: string;
19647
+ market_city: string;
19648
+ market_city_lc: string;
19649
+ market_id: string;
19650
+ market_name: string;
19651
+ market_name_lc: string;
19652
+ market_state: string;
19653
+ momentum: string;
19654
+ organization_id: string;
19655
+ primary_source: string;
19656
+ quote_avg_gross: number;
19657
+ quote_avg_guarantee: number;
19658
+ quote_avg_tickets_sold: number;
19659
+ quote_high: number;
19660
+ quote_low: number;
19661
+ read_model_hash: string;
19662
+ reg_last_mod_date: string;
19663
+ source_updated_at: string;
19664
+ status_display: string;
19665
+ tracked_artist_id: string;
19666
+ venue_capacity: number;
19667
+ venue_id: string;
19668
+ venue_name: string;
19669
+ venue_name_lc: string;
19670
+ venue_type: string;
19671
+ }[];
19672
+ };
19673
+ dashboard_search_window_source_rows_for_window_ids: {
19674
+ Args: {
19675
+ p_availability_window_ids: string[];
19676
+ };
19677
+ Returns: {
19678
+ agency: string;
19679
+ agency_lc: string;
19680
+ analytics_activity_score: number;
19681
+ analytics_activity_tier: string;
19682
+ analytics_artist_rank: number;
19683
+ analytics_chartmetric_id: string;
19684
+ analytics_instagram_engagement: number;
19685
+ analytics_instagram_followers: number;
19686
+ analytics_last_updated_at: string;
19687
+ analytics_next_update_due: string;
19688
+ analytics_spotify_followers: number;
19689
+ analytics_spotify_monthly_listeners: number;
19690
+ analytics_tiktok_engagement: number;
19691
+ analytics_tiktok_followers: number;
19692
+ analytics_tiktok_track_posts: number;
19693
+ analytics_total_fanbase: number;
19694
+ artist_id: string;
19695
+ artist_name: string;
19696
+ artist_name_lc: string;
19697
+ artist_normalized_name: string;
19698
+ artist_normalized_name_lc: string;
19699
+ assignment_count: number;
19700
+ availability_window_id: string;
19701
+ confidence: number;
19702
+ data_freshness_days: number;
19703
+ effective_date: string;
19704
+ effective_status: string;
19705
+ financials_total_shows: number;
19706
+ genre: string;
19707
+ genre_lc: string;
19708
+ has_assignment: boolean;
19709
+ inferred_at: string;
19710
+ interest_source: string;
19711
+ is_active: boolean;
19712
+ is_inferred: boolean;
19713
+ latest_assigned_at: string;
19714
+ latest_assignment_state: string;
19715
+ market_city: string;
19716
+ market_city_lc: string;
19717
+ market_id: string;
19718
+ market_name: string;
19719
+ market_name_lc: string;
19720
+ market_state: string;
19721
+ momentum: string;
19722
+ organization_id: string;
19723
+ primary_source: string;
19724
+ quote_avg_gross: number;
19725
+ quote_avg_guarantee: number;
19726
+ quote_avg_tickets_sold: number;
19727
+ quote_high: number;
19728
+ quote_low: number;
19729
+ read_model_hash: string;
19730
+ reg_last_mod_date: string;
19731
+ source_updated_at: string;
19732
+ status_display: string;
19733
+ tracked_artist_id: string;
19734
+ venue_capacity: number;
19735
+ venue_id: string;
19736
+ venue_name: string;
19737
+ venue_name_lc: string;
19738
+ venue_type: string;
19739
+ }[];
19057
19740
  };
19058
19741
  filtered_availability_search_rows: {
19059
19742
  Args: {
@@ -19668,6 +20351,10 @@ export type Database = {
19668
20351
  p_fanbase_max?: number;
19669
20352
  p_fanbase_min?: number;
19670
20353
  p_genres?: string[];
20354
+ p_has_market_conflict?: boolean;
20355
+ p_has_nearby_interest?: boolean;
20356
+ p_has_radius_conflict?: boolean;
20357
+ p_has_routing_opportunity?: boolean;
19671
20358
  p_limit?: number;
19672
20359
  p_momentums?: string[];
19673
20360
  p_offset?: number;
@@ -19675,6 +20362,107 @@ export type Database = {
19675
20362
  p_quote_high?: number;
19676
20363
  p_quote_low?: number;
19677
20364
  p_radius_miles?: number;
20365
+ p_require_available_with_routing?: boolean;
20366
+ p_search?: string;
20367
+ p_spotify_max?: number;
20368
+ p_spotify_min?: number;
20369
+ p_states?: string[];
20370
+ p_statuses?: string[];
20371
+ p_tracked_artist_ids?: string[];
20372
+ };
20373
+ Returns: {
20374
+ agency: string;
20375
+ analytics_activity_score: number;
20376
+ analytics_activity_tier: string;
20377
+ analytics_artist_rank: number;
20378
+ analytics_chartmetric_id: string;
20379
+ analytics_instagram_engagement: number;
20380
+ analytics_instagram_followers: number;
20381
+ analytics_last_updated_at: string;
20382
+ analytics_next_update_due: string;
20383
+ analytics_spotify_followers: number;
20384
+ analytics_spotify_monthly_listeners: number;
20385
+ analytics_tiktok_engagement: number;
20386
+ analytics_tiktok_followers: number;
20387
+ analytics_tiktok_track_posts: number;
20388
+ analytics_total_fanbase: number;
20389
+ artist_id: string;
20390
+ artist_name: string;
20391
+ artist_normalized_name: string;
20392
+ confidence: number;
20393
+ data_freshness_days: number;
20394
+ date: string;
20395
+ distance_miles: number;
20396
+ financials_avg_gross: number;
20397
+ financials_avg_guarantee: number;
20398
+ financials_avg_tickets_sold: number;
20399
+ financials_quote_high: number;
20400
+ financials_quote_low: number;
20401
+ financials_total_shows: number;
20402
+ genre: string;
20403
+ has_market_conflict: boolean;
20404
+ historical_scrape_status: string;
20405
+ id: string;
20406
+ inferred_at: string;
20407
+ interest_source: string;
20408
+ is_inferred: boolean;
20409
+ is_routed: boolean;
20410
+ last_scraped_at: string;
20411
+ last_sync_status: string;
20412
+ lineage: Json;
20413
+ market_city: string;
20414
+ market_conflicts: Json;
20415
+ market_id: string;
20416
+ market_market: string;
20417
+ market_state: string;
20418
+ momentum: string;
20419
+ nearby_interest: Json;
20420
+ organization_id: string;
20421
+ primary_source: string;
20422
+ radius_conflict: boolean;
20423
+ radius_conflicts: Json;
20424
+ reg_last_mod_date: string;
20425
+ reg_last_synced_at: string;
20426
+ reg_metadata_last_synced_at: string;
20427
+ routing_shows: Json;
20428
+ same_day_interest: Json;
20429
+ status: string;
20430
+ status_display: string;
20431
+ total_count: number;
20432
+ tracked_artist_id: string;
20433
+ venue_capacity: number;
20434
+ venue_id: string;
20435
+ venue_name: string;
20436
+ venue_type: string;
20437
+ }[];
20438
+ };
20439
+ hydrate_artist_avails_overlay_cached: {
20440
+ Args: {
20441
+ p_active_only?: boolean;
20442
+ p_agencies?: string[];
20443
+ p_artist_ids?: string[];
20444
+ p_artists?: string[];
20445
+ p_assigned_only?: boolean;
20446
+ p_center_city?: string;
20447
+ p_city?: string;
20448
+ p_date_from: string;
20449
+ p_date_to: string;
20450
+ p_event_edition_id?: string;
20451
+ p_fanbase_max?: number;
20452
+ p_fanbase_min?: number;
20453
+ p_genres?: string[];
20454
+ p_has_market_conflict?: boolean;
20455
+ p_has_nearby_interest?: boolean;
20456
+ p_has_radius_conflict?: boolean;
20457
+ p_has_routing_opportunity?: boolean;
20458
+ p_limit?: number;
20459
+ p_momentums?: string[];
20460
+ p_offset?: number;
20461
+ p_organization_id: string;
20462
+ p_quote_high?: number;
20463
+ p_quote_low?: number;
20464
+ p_radius_miles?: number;
20465
+ p_require_available_with_routing?: boolean;
19678
20466
  p_search?: string;
19679
20467
  p_spotify_max?: number;
19680
20468
  p_spotify_min?: number;
@@ -19765,6 +20553,44 @@ export type Database = {
19765
20553
  refreshed_artist_count: number;
19766
20554
  }[];
19767
20555
  };
20556
+ refresh_dashboard_search_overlays_batch: {
20557
+ Args: {
20558
+ p_after_date?: string;
20559
+ p_after_id?: string;
20560
+ p_center_city: string;
20561
+ p_date_from: string;
20562
+ p_date_to: string;
20563
+ p_interest_from?: string;
20564
+ p_interest_to?: string;
20565
+ p_limit?: number;
20566
+ p_organization_id: string;
20567
+ p_radius_miles?: number;
20568
+ };
20569
+ Returns: Json;
20570
+ };
20571
+ refresh_dashboard_search_window: {
20572
+ Args: {
20573
+ p_availability_window_id: string;
20574
+ };
20575
+ Returns: Json;
20576
+ };
20577
+ refresh_dashboard_search_windows: {
20578
+ Args: {
20579
+ p_organization_id?: string;
20580
+ };
20581
+ Returns: Json;
20582
+ };
20583
+ refresh_dashboard_search_windows_batch: {
20584
+ Args: {
20585
+ p_after_availability_window_id?: string;
20586
+ p_after_effective_date?: string;
20587
+ p_date_from: string;
20588
+ p_date_to: string;
20589
+ p_limit?: number;
20590
+ p_organization_id: string;
20591
+ };
20592
+ Returns: Json;
20593
+ };
19768
20594
  search_artist_avails: {
19769
20595
  Args: {
19770
20596
  p_active_only?: boolean;
@@ -19779,6 +20605,10 @@ export type Database = {
19779
20605
  p_fanbase_max?: number;
19780
20606
  p_fanbase_min?: number;
19781
20607
  p_genres?: string[];
20608
+ p_has_market_conflict?: boolean;
20609
+ p_has_nearby_interest?: boolean;
20610
+ p_has_radius_conflict?: boolean;
20611
+ p_has_routing_opportunity?: boolean;
19782
20612
  p_momentums?: string[];
19783
20613
  p_organization_id: string;
19784
20614
  p_page?: number;
@@ -19786,6 +20616,155 @@ export type Database = {
19786
20616
  p_quote_high?: number;
19787
20617
  p_quote_low?: number;
19788
20618
  p_radius_miles?: number;
20619
+ p_require_available_with_routing?: boolean;
20620
+ p_search?: string;
20621
+ p_spotify_max?: number;
20622
+ p_spotify_min?: number;
20623
+ p_states?: string[];
20624
+ p_statuses?: string[];
20625
+ };
20626
+ Returns: {
20627
+ agency: string;
20628
+ analytics_activity_score: number;
20629
+ analytics_activity_tier: string;
20630
+ analytics_artist_rank: number;
20631
+ analytics_chartmetric_id: string;
20632
+ analytics_instagram_engagement: number;
20633
+ analytics_instagram_followers: number;
20634
+ analytics_last_updated_at: string;
20635
+ analytics_next_update_due: string;
20636
+ analytics_spotify_followers: number;
20637
+ analytics_spotify_monthly_listeners: number;
20638
+ analytics_tiktok_engagement: number;
20639
+ analytics_tiktok_followers: number;
20640
+ analytics_tiktok_track_posts: number;
20641
+ analytics_total_fanbase: number;
20642
+ artist_id: string;
20643
+ artist_name: string;
20644
+ artist_normalized_name: string;
20645
+ confidence: number;
20646
+ data_freshness_days: number;
20647
+ date: string;
20648
+ distance_miles: number;
20649
+ financials_avg_gross: number;
20650
+ financials_avg_guarantee: number;
20651
+ financials_avg_tickets_sold: number;
20652
+ financials_quote_high: number;
20653
+ financials_quote_low: number;
20654
+ financials_total_shows: number;
20655
+ genre: string;
20656
+ has_market_conflict: boolean;
20657
+ historical_scrape_status: string;
20658
+ id: string;
20659
+ inferred_at: string;
20660
+ interest_source: string;
20661
+ is_inferred: boolean;
20662
+ is_routed: boolean;
20663
+ last_scraped_at: string;
20664
+ last_sync_status: string;
20665
+ lineage: Json;
20666
+ market_city: string;
20667
+ market_conflicts: Json;
20668
+ market_id: string;
20669
+ market_market: string;
20670
+ market_state: string;
20671
+ momentum: string;
20672
+ nearby_interest: Json;
20673
+ organization_id: string;
20674
+ primary_source: string;
20675
+ radius_conflict: boolean;
20676
+ radius_conflicts: Json;
20677
+ reg_last_mod_date: string;
20678
+ reg_last_synced_at: string;
20679
+ reg_metadata_last_synced_at: string;
20680
+ routing_shows: Json;
20681
+ same_day_interest: Json;
20682
+ status: string;
20683
+ status_display: string;
20684
+ total_count: number;
20685
+ tracked_artist_id: string;
20686
+ venue_capacity: number;
20687
+ venue_id: string;
20688
+ venue_name: string;
20689
+ venue_type: string;
20690
+ }[];
20691
+ };
20692
+ search_artist_avails_advanced_summary: {
20693
+ Args: {
20694
+ p_active_only?: boolean;
20695
+ p_agencies?: string[];
20696
+ p_artists?: string[];
20697
+ p_assigned_only?: boolean;
20698
+ p_center_city?: string;
20699
+ p_city?: string;
20700
+ p_date_from: string;
20701
+ p_date_to: string;
20702
+ p_event_edition_id?: string;
20703
+ p_fanbase_max?: number;
20704
+ p_fanbase_min?: number;
20705
+ p_genres?: string[];
20706
+ p_has_market_conflict?: boolean;
20707
+ p_has_nearby_interest?: boolean;
20708
+ p_has_radius_conflict?: boolean;
20709
+ p_has_routing_opportunity?: boolean;
20710
+ p_momentums?: string[];
20711
+ p_organization_id: string;
20712
+ p_quote_high?: number;
20713
+ p_quote_low?: number;
20714
+ p_radius_miles?: number;
20715
+ p_require_available_with_routing?: boolean;
20716
+ p_search?: string;
20717
+ p_spotify_max?: number;
20718
+ p_spotify_min?: number;
20719
+ p_states?: string[];
20720
+ p_statuses?: string[];
20721
+ };
20722
+ Returns: {
20723
+ artists_with_analytics: number;
20724
+ assigned_records: number;
20725
+ available_records: number;
20726
+ avg_confidence: number;
20727
+ blocked_records: number;
20728
+ confirmed_records: number;
20729
+ conflict_artists: number;
20730
+ conflict_dates: number;
20731
+ conflict_events: number;
20732
+ conflict_records: number;
20733
+ hold_records: number;
20734
+ inferred_records: number;
20735
+ market_conflict_artists: number;
20736
+ market_conflict_dates: number;
20737
+ market_conflict_events: number;
20738
+ offer_records: number;
20739
+ radius_conflict_artists: number;
20740
+ radius_conflict_dates: number;
20741
+ radius_conflict_events: number;
20742
+ total_records: number;
20743
+ unique_artists: number;
20744
+ unique_markets: number;
20745
+ unique_venues: number;
20746
+ wishlist_records: number;
20747
+ }[];
20748
+ };
20749
+ search_artist_avails_page: {
20750
+ Args: {
20751
+ p_active_only?: boolean;
20752
+ p_agencies?: string[];
20753
+ p_artists?: string[];
20754
+ p_assigned_only?: boolean;
20755
+ p_city?: string;
20756
+ p_date_from: string;
20757
+ p_date_to: string;
20758
+ p_event_edition_id?: string;
20759
+ p_fanbase_max?: number;
20760
+ p_fanbase_min?: number;
20761
+ p_genres?: string[];
20762
+ p_momentums?: string[];
20763
+ p_organization_id: string;
20764
+ p_page?: number;
20765
+ p_page_size?: number;
20766
+ p_quote_high?: number;
20767
+ p_quote_low?: number;
19789
20768
  p_search?: string;
19790
20769
  p_spotify_max?: number;
19791
20770
  p_spotify_min?: number;
@@ -19872,11 +20851,16 @@ export type Database = {
19872
20851
  p_fanbase_max?: number;
19873
20852
  p_fanbase_min?: number;
19874
20853
  p_genres?: string[];
20854
+ p_has_market_conflict?: boolean;
20855
+ p_has_nearby_interest?: boolean;
20856
+ p_has_radius_conflict?: boolean;
20857
+ p_has_routing_opportunity?: boolean;
19875
20858
  p_momentums?: string[];
19876
20859
  p_organization_id: string;
19877
20860
  p_quote_high?: number;
19878
20861
  p_quote_low?: number;
19879
20862
  p_radius_miles?: number;
20863
+ p_require_available_with_routing?: boolean;
19880
20864
  p_search?: string;
19881
20865
  p_spotify_max?: number;
19882
20866
  p_spotify_min?: number;
@@ -19915,6 +20899,10 @@ export type Database = {
19915
20899
  p_fanbase_max?: number;
19916
20900
  p_fanbase_min?: number;
19917
20901
  p_genres?: string[];
20902
+ p_has_market_conflict?: boolean;
20903
+ p_has_nearby_interest?: boolean;
20904
+ p_has_radius_conflict?: boolean;
20905
+ p_has_routing_opportunity?: boolean;
19918
20906
  p_momentums?: string[];
19919
20907
  p_organization_id: string;
19920
20908
  p_page?: number;
@@ -19922,6 +20910,7 @@ export type Database = {
19922
20910
  p_quote_high?: number;
19923
20911
  p_quote_low?: number;
19924
20912
  p_radius_miles?: number;
20913
+ p_require_available_with_routing?: boolean;
19925
20914
  p_search?: string;
19926
20915
  p_spotify_max?: number;
19927
20916
  p_spotify_min?: number;
@@ -19952,6 +20941,19 @@ export type Database = {
19952
20941
  tracked_artist_id: string;
19953
20942
  }[];
19954
20943
  };
20944
+ upsert_dashboard_search_windows_from_source: {
20945
+ Args: {
20946
+ p_availability_window_id?: string;
20947
+ p_organization_id?: string;
20948
+ };
20949
+ Returns: number;
20950
+ };
20951
+ upsert_dashboard_search_windows_from_window_ids: {
20952
+ Args: {
20953
+ p_availability_window_ids: string[];
20954
+ };
20955
+ Returns: number;
20956
+ };
19955
20957
  };
19956
20958
  Enums: {
19957
20959
  assignment_state: "discovered" | "shortlisted" | "client_interested" | "approved_for_offer" | "offer_created" | "passed" | "removed" | "overridden";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjromeoent/ein-supabase",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Shared Supabase types, app context, and contract helpers for EIN-connected apps.",
5
5
  "type": "module",
6
6
  "sideEffects": false,