@hobenakicoffee/libraries 4.9.0 → 5.1.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/types/supabase.ts +199 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "4.9.0",
3
+ "version": "5.1.0",
4
4
  "type": "module",
5
5
  "types": "src/index.ts",
6
6
  "repository": {
@@ -206,6 +206,99 @@ export type Database = {
206
206
  };
207
207
  Relationships: [];
208
208
  };
209
+ creator_platform_subscriptions: {
210
+ Row: {
211
+ created_at: string;
212
+ id: number;
213
+ period_end: string;
214
+ period_start: string;
215
+ plan_id: number;
216
+ price_at_purchase: number;
217
+ profile_id: string;
218
+ service_type: string;
219
+ status: string;
220
+ transaction_reference_id: string | null;
221
+ updated_at: string;
222
+ };
223
+ Insert: {
224
+ created_at?: string;
225
+ id?: never;
226
+ period_end: string;
227
+ period_start: string;
228
+ plan_id: number;
229
+ price_at_purchase: number;
230
+ profile_id: string;
231
+ service_type: string;
232
+ status?: string;
233
+ transaction_reference_id?: string | null;
234
+ updated_at?: string;
235
+ };
236
+ Update: {
237
+ created_at?: string;
238
+ id?: never;
239
+ period_end?: string;
240
+ period_start?: string;
241
+ plan_id?: number;
242
+ price_at_purchase?: number;
243
+ profile_id?: string;
244
+ service_type?: string;
245
+ status?: string;
246
+ transaction_reference_id?: string | null;
247
+ updated_at?: string;
248
+ };
249
+ Relationships: [
250
+ {
251
+ foreignKeyName: "creator_platform_subscriptions_plan_id_fkey";
252
+ columns: ["plan_id"];
253
+ isOneToOne: false;
254
+ referencedRelation: "platform_subscription_plans";
255
+ referencedColumns: ["id"];
256
+ },
257
+ {
258
+ foreignKeyName: "creator_platform_subscriptions_profile_id_fkey";
259
+ columns: ["profile_id"];
260
+ isOneToOne: false;
261
+ referencedRelation: "profiles";
262
+ referencedColumns: ["id"];
263
+ },
264
+ {
265
+ foreignKeyName: "creator_platform_subscriptions_transaction_reference_id_fkey";
266
+ columns: ["transaction_reference_id"];
267
+ isOneToOne: false;
268
+ referencedRelation: "transactions";
269
+ referencedColumns: ["reference_id"];
270
+ },
271
+ ];
272
+ };
273
+ creator_subscription_notifications: {
274
+ Row: {
275
+ id: number;
276
+ notification_type: string;
277
+ sent_at: string;
278
+ subscription_id: number;
279
+ };
280
+ Insert: {
281
+ id?: never;
282
+ notification_type: string;
283
+ sent_at?: string;
284
+ subscription_id: number;
285
+ };
286
+ Update: {
287
+ id?: never;
288
+ notification_type?: string;
289
+ sent_at?: string;
290
+ subscription_id?: number;
291
+ };
292
+ Relationships: [
293
+ {
294
+ foreignKeyName: "creator_subscription_notifications_subscription_id_fkey";
295
+ columns: ["subscription_id"];
296
+ isOneToOne: false;
297
+ referencedRelation: "creator_platform_subscriptions";
298
+ referencedColumns: ["id"];
299
+ },
300
+ ];
301
+ };
209
302
  follows: {
210
303
  Row: {
211
304
  created_at: string | null;
@@ -905,6 +998,42 @@ export type Database = {
905
998
  };
906
999
  Relationships: [];
907
1000
  };
1001
+ platform_subscription_plans: {
1002
+ Row: {
1003
+ created_at: string;
1004
+ description: string | null;
1005
+ id: number;
1006
+ is_active: boolean;
1007
+ name: string;
1008
+ price_per_month: number;
1009
+ service_type: string;
1010
+ sort_order: number;
1011
+ updated_at: string;
1012
+ };
1013
+ Insert: {
1014
+ created_at?: string;
1015
+ description?: string | null;
1016
+ id?: never;
1017
+ is_active?: boolean;
1018
+ name: string;
1019
+ price_per_month: number;
1020
+ service_type: string;
1021
+ sort_order?: number;
1022
+ updated_at?: string;
1023
+ };
1024
+ Update: {
1025
+ created_at?: string;
1026
+ description?: string | null;
1027
+ id?: never;
1028
+ is_active?: boolean;
1029
+ name?: string;
1030
+ price_per_month?: number;
1031
+ service_type?: string;
1032
+ sort_order?: number;
1033
+ updated_at?: string;
1034
+ };
1035
+ Relationships: [];
1036
+ };
908
1037
  post_access_grants: {
909
1038
  Row: {
910
1039
  created_at: string;
@@ -1364,6 +1493,7 @@ export type Database = {
1364
1493
  delivered_at: string | null;
1365
1494
  id: string;
1366
1495
  order_id: string;
1496
+ platform_fee_rate: number;
1367
1497
  product_id: string;
1368
1498
  product_title: string;
1369
1499
  product_type: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1387,6 +1517,7 @@ export type Database = {
1387
1517
  delivered_at?: string | null;
1388
1518
  id?: string;
1389
1519
  order_id: string;
1520
+ platform_fee_rate?: number;
1390
1521
  product_id: string;
1391
1522
  product_title: string;
1392
1523
  product_type: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1410,6 +1541,7 @@ export type Database = {
1410
1541
  delivered_at?: string | null;
1411
1542
  id?: string;
1412
1543
  order_id?: string;
1544
+ platform_fee_rate?: number;
1413
1545
  product_id?: string;
1414
1546
  product_title?: string;
1415
1547
  product_type?: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1461,7 +1593,7 @@ export type Database = {
1461
1593
  order_number: string;
1462
1594
  payment_method: Database["public"]["Enums"]["shop_payment_method_enum"];
1463
1595
  platform_fee: number;
1464
- platform_fee_rate: number;
1596
+ platform_fee_rate: number | null;
1465
1597
  seller_net: number;
1466
1598
  seller_notes: string | null;
1467
1599
  seller_profile_id: string;
@@ -1482,7 +1614,7 @@ export type Database = {
1482
1614
  order_number: string;
1483
1615
  payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1484
1616
  platform_fee: number;
1485
- platform_fee_rate: number;
1617
+ platform_fee_rate?: number | null;
1486
1618
  seller_net: number;
1487
1619
  seller_notes?: string | null;
1488
1620
  seller_profile_id: string;
@@ -1503,7 +1635,7 @@ export type Database = {
1503
1635
  order_number?: string;
1504
1636
  payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1505
1637
  platform_fee?: number;
1506
- platform_fee_rate?: number;
1638
+ platform_fee_rate?: number | null;
1507
1639
  seller_net?: number;
1508
1640
  seller_notes?: string | null;
1509
1641
  seller_profile_id?: string;
@@ -2330,12 +2462,13 @@ export type Database = {
2330
2462
  fee: number;
2331
2463
  id: string;
2332
2464
  net_amount: number;
2333
- payout_method_id: string;
2465
+ payout_method_id: string | null;
2334
2466
  payout_snapshot: Json | null;
2335
2467
  processed_at: string | null;
2336
2468
  profile_id: string;
2337
2469
  requested_at: string;
2338
2470
  status: Database["public"]["Enums"]["withdrawal_status"];
2471
+ superseded_by: string | null;
2339
2472
  wallet_id: string;
2340
2473
  };
2341
2474
  Insert: {
@@ -2346,12 +2479,13 @@ export type Database = {
2346
2479
  fee?: number;
2347
2480
  id?: string;
2348
2481
  net_amount: number;
2349
- payout_method_id: string;
2482
+ payout_method_id?: string | null;
2350
2483
  payout_snapshot?: Json | null;
2351
2484
  processed_at?: string | null;
2352
2485
  profile_id: string;
2353
2486
  requested_at?: string;
2354
2487
  status?: Database["public"]["Enums"]["withdrawal_status"];
2488
+ superseded_by?: string | null;
2355
2489
  wallet_id: string;
2356
2490
  };
2357
2491
  Update: {
@@ -2362,12 +2496,13 @@ export type Database = {
2362
2496
  fee?: number;
2363
2497
  id?: string;
2364
2498
  net_amount?: number;
2365
- payout_method_id?: string;
2499
+ payout_method_id?: string | null;
2366
2500
  payout_snapshot?: Json | null;
2367
2501
  processed_at?: string | null;
2368
2502
  profile_id?: string;
2369
2503
  requested_at?: string;
2370
2504
  status?: Database["public"]["Enums"]["withdrawal_status"];
2505
+ superseded_by?: string | null;
2371
2506
  wallet_id?: string;
2372
2507
  };
2373
2508
  Relationships: [
@@ -2385,6 +2520,13 @@ export type Database = {
2385
2520
  referencedRelation: "profiles";
2386
2521
  referencedColumns: ["id"];
2387
2522
  },
2523
+ {
2524
+ foreignKeyName: "withdrawal_requests_superseded_by_fkey";
2525
+ columns: ["superseded_by"];
2526
+ isOneToOne: false;
2527
+ referencedRelation: "withdrawal_requests";
2528
+ referencedColumns: ["id"];
2529
+ },
2388
2530
  {
2389
2531
  foreignKeyName: "withdrawal_requests_wallet_id_fkey";
2390
2532
  columns: ["wallet_id"];
@@ -2399,6 +2541,15 @@ export type Database = {
2399
2541
  [_ in never]: never;
2400
2542
  };
2401
2543
  Functions: {
2544
+ activate_creator_platform_subscription: {
2545
+ Args: {
2546
+ p_creator_profile_id: string;
2547
+ p_plan_id: number;
2548
+ p_provider: Database["public"]["Enums"]["provider_enum"];
2549
+ p_provider_transaction_id: string;
2550
+ };
2551
+ Returns: Json;
2552
+ };
2402
2553
  add_shop_product_file: {
2403
2554
  Args: {
2404
2555
  p_file_name: string;
@@ -2410,6 +2561,10 @@ export type Database = {
2410
2561
  };
2411
2562
  Returns: Json;
2412
2563
  };
2564
+ admin_grant_creator_subscription: {
2565
+ Args: { p_months?: number; p_plan_id: number; p_profile_id: string };
2566
+ Returns: Json;
2567
+ };
2413
2568
  approve_newsletter_post: { Args: { p_post_id: string }; Returns: Json };
2414
2569
  approve_shop_category: { Args: { p_category_id: string }; Returns: Json };
2415
2570
  approve_shop_product: { Args: { p_product_id: string }; Returns: Json };
@@ -2424,6 +2579,10 @@ export type Database = {
2424
2579
  Args: { p_order_item_id: string; p_reason: string };
2425
2580
  Returns: Json;
2426
2581
  };
2582
+ cancel_creator_platform_subscription: {
2583
+ Args: { p_service_type: string };
2584
+ Returns: Json;
2585
+ };
2427
2586
  check_newsletter_post_access: {
2428
2587
  Args: { p_post_id: string };
2429
2588
  Returns: {
@@ -2506,6 +2665,10 @@ export type Database = {
2506
2665
  unique_supporters_change: number;
2507
2666
  }[];
2508
2667
  };
2668
+ get_creator_effective_fee_rate: {
2669
+ Args: { p_profile_id: string; p_service_type: string };
2670
+ Returns: number;
2671
+ };
2509
2672
  get_followers: { Args: { target_user_id: string }; Returns: string[] };
2510
2673
  get_following: { Args: { target_user_id: string }; Returns: string[] };
2511
2674
  get_messages: {
@@ -2743,6 +2906,24 @@ export type Database = {
2743
2906
  recipient_name: string;
2744
2907
  }[];
2745
2908
  };
2909
+ get_withdrawal_requests_page: {
2910
+ Args: { p_cursor_requested_at?: string; p_limit?: number };
2911
+ Returns: {
2912
+ amount: number;
2913
+ completed_at: string;
2914
+ failure_reason: string;
2915
+ fee: number;
2916
+ id: string;
2917
+ net_amount: number;
2918
+ payout_method_id: string;
2919
+ payout_snapshot: Json;
2920
+ processed_at: string;
2921
+ profile_id: string;
2922
+ requested_at: string;
2923
+ status: Database["public"]["Enums"]["withdrawal_status"];
2924
+ wallet_id: string;
2925
+ }[];
2926
+ };
2746
2927
  gift_newsletter_post: {
2747
2928
  Args: {
2748
2929
  p_expires_at?: string;
@@ -2817,7 +2998,6 @@ export type Database = {
2817
2998
  p_identity_hash: string;
2818
2999
  p_is_monthly?: boolean;
2819
3000
  p_message?: string;
2820
- p_platform_fee: number;
2821
3001
  p_provider: Database["public"]["Enums"]["provider_enum"];
2822
3002
  p_provider_transaction_id: string;
2823
3003
  p_reference_type: Database["public"]["Enums"]["reference_type_enum"];
@@ -2827,6 +3007,7 @@ export type Database = {
2827
3007
  };
2828
3008
  Returns: Json;
2829
3009
  };
3010
+ process_creator_subscription_expiry: { Args: never; Returns: undefined };
2830
3011
  process_membership_expiry_notifications: {
2831
3012
  Args: never;
2832
3013
  Returns: undefined;
@@ -2851,6 +3032,7 @@ export type Database = {
2851
3032
  process_withdrawal: {
2852
3033
  Args: {
2853
3034
  p_admin_note?: string;
3035
+ p_failure_reason?: string;
2854
3036
  p_new_status: Database["public"]["Enums"]["withdrawal_status"];
2855
3037
  p_withdrawal_id: string;
2856
3038
  };
@@ -2864,7 +3046,6 @@ export type Database = {
2864
3046
  p_identity_hash: string;
2865
3047
  p_message?: string;
2866
3048
  p_plan_id: string;
2867
- p_platform_fee: number;
2868
3049
  p_provider: Database["public"]["Enums"]["provider_enum"];
2869
3050
  p_provider_transaction_id: string;
2870
3051
  p_source?: string;
@@ -2879,7 +3060,6 @@ export type Database = {
2879
3060
  p_buyer_profile_id: string;
2880
3061
  p_identity_hash: string;
2881
3062
  p_message?: string;
2882
- p_platform_fee: number;
2883
3063
  p_post_id: string;
2884
3064
  p_provider: Database["public"]["Enums"]["provider_enum"];
2885
3065
  p_provider_transaction_id: string;
@@ -2920,6 +3100,14 @@ export type Database = {
2920
3100
  Args: { p_amount: number; p_payout_method_id: string };
2921
3101
  Returns: string;
2922
3102
  };
3103
+ retry_withdrawal: {
3104
+ Args: {
3105
+ p_amount?: number;
3106
+ p_payout_method_id?: string;
3107
+ p_withdrawal_id: string;
3108
+ };
3109
+ Returns: string;
3110
+ };
2923
3111
  send_message: {
2924
3112
  Args: { p_content: string; p_conversation_id: string };
2925
3113
  Returns: {
@@ -3128,7 +3316,7 @@ export type Database = {
3128
3316
  | "refunded"
3129
3317
  | "reviewing";
3130
3318
  payout_provider: "bkash" | "nagad" | "rocket" | "bank";
3131
- post_status_enum: "draft" | "published" | "archived" | "review";
3319
+ post_status_enum: "draft" | "published" | "review" | "archived";
3132
3320
  post_version_source_enum:
3133
3321
  | "autosave"
3134
3322
  | "ai_polish"
@@ -3404,7 +3592,7 @@ export const Constants = {
3404
3592
  "reviewing",
3405
3593
  ],
3406
3594
  payout_provider: ["bkash", "nagad", "rocket", "bank"],
3407
- post_status_enum: ["draft", "published", "archived", "review"],
3595
+ post_status_enum: ["draft", "published", "review", "archived"],
3408
3596
  post_version_source_enum: [
3409
3597
  "autosave",
3410
3598
  "ai_polish",