@rjromeoent/ein-supabase 0.1.9 → 0.1.11

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
@@ -87,7 +87,7 @@ Then app repos should depend on the released version:
87
87
  ```json
88
88
  {
89
89
  "dependencies": {
90
- "@rjromeoent/ein-supabase": "^0.1.2"
90
+ "@rjromeoent/ein-supabase": "^0.1.10"
91
91
  }
92
92
  }
93
93
  ```
@@ -133,7 +133,10 @@ Examples:
133
133
  - `RadDbAvailabilityStatus`
134
134
  - `RadDbAssignmentState`
135
135
  - `RadDbDecisionType`
136
+ - `BookingClientApprovalMethod`
137
+ - `BookingDealType`
136
138
  - `BookingOfferStatus`
139
+ - `BookingOfferTransitionTriggerType`
137
140
 
138
141
  Why:
139
142
 
@@ -163,7 +166,9 @@ Examples:
163
166
 
164
167
  - `EIN_APP_SLUGS`
165
168
  - `EIN_APP_HEADER`
169
+ - `EIN_APP_HEADER_NAME`
166
170
  - `einAppHeaders("rad")`
171
+ - `einAppHeaders(EIN_APP_SLUGS.einApps)`
167
172
 
168
173
  Why:
169
174
 
@@ -358,7 +363,7 @@ questions. Otherwise, keep it local in the app and revisit when reuse appears.
358
363
  | Item | Location | Reason |
359
364
  | --- | --- | --- |
360
365
  | `Database` generated Supabase type | Package | Every app should use the same DB schema contract. |
361
- | `EIN_APP_SLUGS.rad` | Package | RLS/app policies require consistent slugs. |
366
+ | `EIN_APP_SLUGS.rad` / `EIN_APP_SLUGS.einApps` | Package | RLS/app policies require consistent slugs. |
362
367
  | `CoreOrgRole` | Package | Org role meaning must be consistent across apps. |
363
368
  | `schemaClient(supabase, "rad")` | Package | Shared typed helper for schema-scoped Supabase access. |
364
369
  | `rad-get-event-edition-grid` response | RAD app | RAD-only workflow and UI grid payload today. |
@@ -1,7 +1,9 @@
1
1
  export declare const EIN_APP_HEADER = "x-ein-app";
2
+ export declare const EIN_APP_HEADER_NAME = "x-ein-app";
2
3
  export declare const EIN_APP_SLUGS: {
3
4
  readonly atlas: "atlas";
4
5
  readonly bookingEngine: "booking_engine";
6
+ readonly einApps: "ein_apps";
5
7
  readonly eventOpsConsole: "ein_ops";
6
8
  readonly festivalOs: "festivalos";
7
9
  readonly rad: "rad";
@@ -1,7 +1,9 @@
1
1
  export const EIN_APP_HEADER = "x-ein-app";
2
+ export const EIN_APP_HEADER_NAME = EIN_APP_HEADER;
2
3
  export const EIN_APP_SLUGS = {
3
4
  atlas: "atlas",
4
5
  bookingEngine: "booking_engine",
6
+ einApps: "ein_apps",
5
7
  eventOpsConsole: "ein_ops",
6
8
  festivalOs: "festivalos",
7
9
  rad: "rad",
@@ -6,5 +6,9 @@ export type RadDbAvailabilityStatus = Database["rad"]["Enums"]["availability_sta
6
6
  export type RadDbDecisionActorType = Database["rad"]["Enums"]["decision_actor_type"];
7
7
  export type RadDbDecisionType = Database["rad"]["Enums"]["decision_type"];
8
8
  export type RadDbOfferLinkStatus = Database["rad"]["Enums"]["offer_link_status"];
9
+ export type BookingClientApprovalMethod = Database["booking_engine"]["Enums"]["client_approval_method"];
10
+ export type BookingDealType = Database["booking_engine"]["Enums"]["deal_type"];
9
11
  export type BookingHoldLevel = Database["booking_engine"]["Enums"]["hold_level"];
10
12
  export type BookingOfferStatus = Database["booking_engine"]["Enums"]["offer_status"];
13
+ export type BookingOfferTransitionTriggerType = Database["booking_engine"]["Enums"]["offer_transition_trigger_type"];
14
+ export type BookingPromoterProfitDisposition = Database["booking_engine"]["Enums"]["promoter_profit_disposition"];
@@ -3561,14 +3561,14 @@ export type Database = {
3561
3561
  Relationships: [
3562
3562
  {
3563
3563
  foreignKeyName: "client_contacts_contact_id_fkey";
3564
- columns: ["primary_finance_contact_id"];
3564
+ columns: ["primary_booking_contact_id"];
3565
3565
  isOneToOne: false;
3566
3566
  referencedRelation: "contacts";
3567
3567
  referencedColumns: ["id"];
3568
3568
  },
3569
3569
  {
3570
3570
  foreignKeyName: "client_contacts_contact_id_fkey";
3571
- columns: ["primary_booking_contact_id"];
3571
+ columns: ["primary_finance_contact_id"];
3572
3572
  isOneToOne: false;
3573
3573
  referencedRelation: "contacts";
3574
3574
  referencedColumns: ["id"];
@@ -4475,6 +4475,48 @@ export type Database = {
4475
4475
  }
4476
4476
  ];
4477
4477
  };
4478
+ event_template_clauses: {
4479
+ Row: {
4480
+ clause_id: string;
4481
+ created_at: string;
4482
+ id: string;
4483
+ organization_id: string;
4484
+ sort_order: number;
4485
+ template_id: string;
4486
+ };
4487
+ Insert: {
4488
+ clause_id: string;
4489
+ created_at?: string;
4490
+ id?: string;
4491
+ organization_id: string;
4492
+ sort_order?: number;
4493
+ template_id: string;
4494
+ };
4495
+ Update: {
4496
+ clause_id?: string;
4497
+ created_at?: string;
4498
+ id?: string;
4499
+ organization_id?: string;
4500
+ sort_order?: number;
4501
+ template_id?: string;
4502
+ };
4503
+ Relationships: [
4504
+ {
4505
+ foreignKeyName: "event_template_clauses_clause_id_fkey";
4506
+ columns: ["clause_id"];
4507
+ isOneToOne: false;
4508
+ referencedRelation: "standard_clauses";
4509
+ referencedColumns: ["id"];
4510
+ },
4511
+ {
4512
+ foreignKeyName: "event_template_clauses_template_id_fkey";
4513
+ columns: ["template_id"];
4514
+ isOneToOne: false;
4515
+ referencedRelation: "event_templates";
4516
+ referencedColumns: ["id"];
4517
+ }
4518
+ ];
4519
+ };
4478
4520
  event_templates: {
4479
4521
  Row: {
4480
4522
  archived_at: string | null;
@@ -4547,6 +4589,64 @@ export type Database = {
4547
4589
  };
4548
4590
  Relationships: [];
4549
4591
  };
4592
+ offer_clause_overrides: {
4593
+ Row: {
4594
+ action: string;
4595
+ body_override: string | null;
4596
+ clause_id: string;
4597
+ created_by: string | null;
4598
+ id: string;
4599
+ offer_id: string;
4600
+ organization_id: string;
4601
+ sort_order: number | null;
4602
+ updated_at: string;
4603
+ };
4604
+ Insert: {
4605
+ action?: string;
4606
+ body_override?: string | null;
4607
+ clause_id: string;
4608
+ created_by?: string | null;
4609
+ id?: string;
4610
+ offer_id: string;
4611
+ organization_id: string;
4612
+ sort_order?: number | null;
4613
+ updated_at?: string;
4614
+ };
4615
+ Update: {
4616
+ action?: string;
4617
+ body_override?: string | null;
4618
+ clause_id?: string;
4619
+ created_by?: string | null;
4620
+ id?: string;
4621
+ offer_id?: string;
4622
+ organization_id?: string;
4623
+ sort_order?: number | null;
4624
+ updated_at?: string;
4625
+ };
4626
+ Relationships: [
4627
+ {
4628
+ foreignKeyName: "offer_clause_overrides_clause_id_fkey";
4629
+ columns: ["clause_id"];
4630
+ isOneToOne: false;
4631
+ referencedRelation: "standard_clauses";
4632
+ referencedColumns: ["id"];
4633
+ },
4634
+ {
4635
+ foreignKeyName: "offer_clause_overrides_offer_id_fkey";
4636
+ columns: ["offer_id"];
4637
+ isOneToOne: false;
4638
+ referencedRelation: "offer_projection";
4639
+ referencedColumns: ["offer_id"];
4640
+ },
4641
+ {
4642
+ foreignKeyName: "offer_clause_overrides_offer_id_fkey";
4643
+ columns: ["offer_id"];
4644
+ isOneToOne: false;
4645
+ referencedRelation: "offers";
4646
+ referencedColumns: ["id"];
4647
+ }
4648
+ ];
4649
+ };
4550
4650
  offer_communication: {
4551
4651
  Row: {
4552
4652
  attachment_urls: Json;
@@ -4973,6 +5073,57 @@ export type Database = {
4973
5073
  }
4974
5074
  ];
4975
5075
  };
5076
+ standard_clauses: {
5077
+ Row: {
5078
+ archived_at: string | null;
5079
+ body: string;
5080
+ category: string;
5081
+ clause_key: string;
5082
+ created_at: string;
5083
+ created_by: string | null;
5084
+ id: string;
5085
+ is_active: boolean;
5086
+ is_required: boolean;
5087
+ organization_id: string;
5088
+ sort_order: number;
5089
+ title: string;
5090
+ updated_at: string;
5091
+ updated_by: string | null;
5092
+ };
5093
+ Insert: {
5094
+ archived_at?: string | null;
5095
+ body: string;
5096
+ category?: string;
5097
+ clause_key: string;
5098
+ created_at?: string;
5099
+ created_by?: string | null;
5100
+ id?: string;
5101
+ is_active?: boolean;
5102
+ is_required?: boolean;
5103
+ organization_id: string;
5104
+ sort_order?: number;
5105
+ title: string;
5106
+ updated_at?: string;
5107
+ updated_by?: string | null;
5108
+ };
5109
+ Update: {
5110
+ archived_at?: string | null;
5111
+ body?: string;
5112
+ category?: string;
5113
+ clause_key?: string;
5114
+ created_at?: string;
5115
+ created_by?: string | null;
5116
+ id?: string;
5117
+ is_active?: boolean;
5118
+ is_required?: boolean;
5119
+ organization_id?: string;
5120
+ sort_order?: number;
5121
+ title?: string;
5122
+ updated_at?: string;
5123
+ updated_by?: string | null;
5124
+ };
5125
+ Relationships: [];
5126
+ };
4976
5127
  tour: {
4977
5128
  Row: {
4978
5129
  artist_id: string;
@@ -5104,6 +5255,14 @@ export type Database = {
5104
5255
  };
5105
5256
  Returns: Json;
5106
5257
  };
5258
+ clone_offer: {
5259
+ Args: {
5260
+ p_new_artist_id: string;
5261
+ p_overrides?: Json;
5262
+ p_source_offer_id: string;
5263
+ };
5264
+ Returns: Json;
5265
+ };
5107
5266
  expire_stale_offers: {
5108
5267
  Args: never;
5109
5268
  Returns: {
@@ -5112,8 +5271,16 @@ export type Database = {
5112
5271
  offer_id: string;
5113
5272
  }[];
5114
5273
  };
5274
+ find_clone_sources: {
5275
+ Args: {
5276
+ p_edition_id: string;
5277
+ p_include_series?: boolean;
5278
+ };
5279
+ Returns: Json;
5280
+ };
5115
5281
  get_event_template: {
5116
5282
  Args: {
5283
+ p_billing_tier?: string;
5117
5284
  p_edition_id: string;
5118
5285
  };
5119
5286
  Returns: Json;
@@ -5126,6 +5293,12 @@ export type Database = {
5126
5293
  };
5127
5294
  Returns: Json;
5128
5295
  };
5296
+ get_offer_clauses: {
5297
+ Args: {
5298
+ p_offer_id: string;
5299
+ };
5300
+ Returns: Json;
5301
+ };
5129
5302
  get_offer_context: {
5130
5303
  Args: {
5131
5304
  p_offer_id: string;
@@ -8323,6 +8496,20 @@ export type Database = {
8323
8496
  Args: never;
8324
8497
  Returns: Json;
8325
8498
  };
8499
+ find_duplicate_artists: {
8500
+ Args: {
8501
+ p_organization_id: string;
8502
+ p_similarity_threshold?: number;
8503
+ };
8504
+ Returns: {
8505
+ artist_count: number;
8506
+ artist_ids: string[];
8507
+ artist_names: string[];
8508
+ artist_tiers: string[];
8509
+ cluster_key: string;
8510
+ ref_counts: number[];
8511
+ }[];
8512
+ };
8326
8513
  find_duplicate_venues: {
8327
8514
  Args: {
8328
8515
  p_organization_id: string;
@@ -8494,6 +8681,13 @@ export type Database = {
8494
8681
  };
8495
8682
  Returns: Json;
8496
8683
  };
8684
+ merge_artists_fast: {
8685
+ Args: {
8686
+ p_keep_id: string;
8687
+ p_merge_id: string;
8688
+ };
8689
+ Returns: Json;
8690
+ };
8497
8691
  merge_persons: {
8498
8692
  Args: {
8499
8693
  p_keep_id: string;
@@ -8509,6 +8703,12 @@ export type Database = {
8509
8703
  };
8510
8704
  Returns: Json;
8511
8705
  };
8706
+ normalize_artist_name: {
8707
+ Args: {
8708
+ p: string;
8709
+ };
8710
+ Returns: string;
8711
+ };
8512
8712
  normalize_city_key: {
8513
8713
  Args: {
8514
8714
  p_city: string;
@@ -8704,6 +8904,21 @@ export type Database = {
8704
8904
  };
8705
8905
  Returns: string;
8706
8906
  };
8907
+ suggest_duplicate_artist: {
8908
+ Args: {
8909
+ p_limit?: number;
8910
+ p_name: string;
8911
+ p_organization_id: string;
8912
+ };
8913
+ Returns: {
8914
+ agency_primary: string;
8915
+ artist_tier: string;
8916
+ genre_primary: string;
8917
+ id: string;
8918
+ primary_name: string;
8919
+ similarity: number;
8920
+ }[];
8921
+ };
8707
8922
  suggest_duplicate_venue: {
8708
8923
  Args: {
8709
8924
  p_city?: string;
@@ -5,52 +5,6 @@ export type EinSchemaName = Extract<keyof DatabaseWithoutInternals, string>;
5
5
  export type EinTableRow<SchemaName extends EinSchemaName, TableName extends keyof DatabaseWithoutInternals[SchemaName]["Tables"]> = DatabaseWithoutInternals[SchemaName]["Tables"][TableName] extends {
6
6
  Row: infer Row;
7
7
  } ? Row : never;
8
- export declare function schemaClient<SchemaName extends EinSchemaName>(supabase: SupabaseClient<Database>, schema: SchemaName): import("@supabase/postgrest-js").PostgrestClient<Database, {
9
- PostgrestVersion: "14.4";
10
- }, SchemaName, Database[SchemaName] extends {
11
- Tables: Record<string, {
12
- Row: Record<string, unknown>;
13
- Insert: Record<string, unknown>;
14
- Update: Record<string, unknown>;
15
- Relationships: {
16
- foreignKeyName: string;
17
- columns: string[];
18
- isOneToOne?: boolean;
19
- referencedRelation: string;
20
- referencedColumns: string[];
21
- }[];
22
- }>;
23
- Views: Record<string, {
24
- Row: Record<string, unknown>;
25
- Insert: Record<string, unknown>;
26
- Update: Record<string, unknown>;
27
- Relationships: {
28
- foreignKeyName: string;
29
- columns: string[];
30
- isOneToOne?: boolean;
31
- referencedRelation: string;
32
- referencedColumns: string[];
33
- }[];
34
- } | {
35
- Row: Record<string, unknown>;
36
- Relationships: {
37
- foreignKeyName: string;
38
- columns: string[];
39
- isOneToOne?: boolean;
40
- referencedRelation: string;
41
- referencedColumns: string[];
42
- }[];
43
- }>;
44
- Functions: Record<string, {
45
- Args: Record<string, unknown> | never;
46
- Returns: unknown;
47
- SetofOptions?: {
48
- isSetofReturn?: boolean | undefined;
49
- isOneToOne?: boolean | undefined;
50
- isNotNullable?: boolean | undefined;
51
- to: string;
52
- from: string;
53
- };
54
- }>;
55
- } ? Database[SchemaName] : any>;
8
+ export type EinSchemaClient<SchemaName extends EinSchemaName> = Pick<SupabaseClient<Database, SchemaName>, "from" | "rpc">;
9
+ export declare function schemaClient<SchemaName extends EinSchemaName>(supabase: SupabaseClient<Database>, schema: SchemaName): EinSchemaClient<SchemaName>;
56
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjromeoent/ein-supabase",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Shared Supabase types, app context, and contract helpers for EIN-connected apps.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -12,10 +12,30 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "import": "./dist/index.js"
14
14
  },
15
+ "./app-context": {
16
+ "types": "./dist/app-context.d.ts",
17
+ "import": "./dist/app-context.js"
18
+ },
19
+ "./auth": {
20
+ "types": "./dist/auth.d.ts",
21
+ "import": "./dist/auth.js"
22
+ },
23
+ "./db-enums": {
24
+ "types": "./dist/db-enums.d.ts",
25
+ "import": "./dist/db-enums.js"
26
+ },
15
27
  "./generated/database.types": {
16
28
  "types": "./dist/generated/database.types.d.ts",
17
29
  "import": "./dist/generated/database.types.js"
18
30
  },
31
+ "./json": {
32
+ "types": "./dist/json.d.ts",
33
+ "import": "./dist/json.js"
34
+ },
35
+ "./schema-client": {
36
+ "types": "./dist/schema-client.d.ts",
37
+ "import": "./dist/schema-client.js"
38
+ },
19
39
  "./package.json": {
20
40
  "default": "./package.json"
21
41
  }