@hobenakicoffee/libraries 1.22.0 → 1.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "type": "module",
5
5
  "types": "src/index.ts",
6
6
  "exports": {
@@ -337,6 +337,62 @@ export type Database = {
337
337
  };
338
338
  Relationships: [];
339
339
  };
340
+ membership_plans: {
341
+ Row: {
342
+ access_config: Json;
343
+ billing_cycle: Database["public"]["Enums"]["membership_billing_cycle_enum"];
344
+ created_at: string;
345
+ description: string | null;
346
+ id: string;
347
+ is_active: boolean;
348
+ is_featured: boolean;
349
+ name: string;
350
+ owner_profile_id: string;
351
+ price: number;
352
+ service_type: string;
353
+ sort_order: number;
354
+ updated_at: string;
355
+ };
356
+ Insert: {
357
+ access_config?: Json;
358
+ billing_cycle: Database["public"]["Enums"]["membership_billing_cycle_enum"];
359
+ created_at?: string;
360
+ description?: string | null;
361
+ id?: string;
362
+ is_active?: boolean;
363
+ is_featured?: boolean;
364
+ name: string;
365
+ owner_profile_id: string;
366
+ price: number;
367
+ service_type: string;
368
+ sort_order?: number;
369
+ updated_at?: string;
370
+ };
371
+ Update: {
372
+ access_config?: Json;
373
+ billing_cycle?: Database["public"]["Enums"]["membership_billing_cycle_enum"];
374
+ created_at?: string;
375
+ description?: string | null;
376
+ id?: string;
377
+ is_active?: boolean;
378
+ is_featured?: boolean;
379
+ name?: string;
380
+ owner_profile_id?: string;
381
+ price?: number;
382
+ service_type?: string;
383
+ sort_order?: number;
384
+ updated_at?: string;
385
+ };
386
+ Relationships: [
387
+ {
388
+ foreignKeyName: "membership_plans_owner_profile_id_fkey";
389
+ columns: ["owner_profile_id"];
390
+ isOneToOne: false;
391
+ referencedRelation: "profiles";
392
+ referencedColumns: ["id"];
393
+ },
394
+ ];
395
+ };
340
396
  messages: {
341
397
  Row: {
342
398
  content: string;
@@ -472,6 +528,289 @@ export type Database = {
472
528
  };
473
529
  Relationships: [];
474
530
  };
531
+ newsletter_post_analytics_daily: {
532
+ Row: {
533
+ clicks: number;
534
+ created_at: string;
535
+ date: string;
536
+ id: string;
537
+ post_id: string;
538
+ purchases: number;
539
+ revenue: number;
540
+ updated_at: string;
541
+ views: number;
542
+ };
543
+ Insert: {
544
+ clicks?: number;
545
+ created_at?: string;
546
+ date: string;
547
+ id?: string;
548
+ post_id: string;
549
+ purchases?: number;
550
+ revenue?: number;
551
+ updated_at?: string;
552
+ views?: number;
553
+ };
554
+ Update: {
555
+ clicks?: number;
556
+ created_at?: string;
557
+ date?: string;
558
+ id?: string;
559
+ post_id?: string;
560
+ purchases?: number;
561
+ revenue?: number;
562
+ updated_at?: string;
563
+ views?: number;
564
+ };
565
+ Relationships: [
566
+ {
567
+ foreignKeyName: "newsletter_post_analytics_daily_post_id_fkey";
568
+ columns: ["post_id"];
569
+ isOneToOne: false;
570
+ referencedRelation: "newsletter_posts";
571
+ referencedColumns: ["id"];
572
+ },
573
+ ];
574
+ };
575
+ newsletter_post_likes: {
576
+ Row: {
577
+ created_at: string;
578
+ id: string;
579
+ post_id: string;
580
+ profile_id: string;
581
+ };
582
+ Insert: {
583
+ created_at?: string;
584
+ id?: string;
585
+ post_id: string;
586
+ profile_id: string;
587
+ };
588
+ Update: {
589
+ created_at?: string;
590
+ id?: string;
591
+ post_id?: string;
592
+ profile_id?: string;
593
+ };
594
+ Relationships: [
595
+ {
596
+ foreignKeyName: "newsletter_post_likes_post_id_fkey";
597
+ columns: ["post_id"];
598
+ isOneToOne: false;
599
+ referencedRelation: "newsletter_posts";
600
+ referencedColumns: ["id"];
601
+ },
602
+ {
603
+ foreignKeyName: "newsletter_post_likes_profile_id_fkey";
604
+ columns: ["profile_id"];
605
+ isOneToOne: false;
606
+ referencedRelation: "profiles";
607
+ referencedColumns: ["id"];
608
+ },
609
+ ];
610
+ };
611
+ newsletter_post_versions: {
612
+ Row: {
613
+ ai_summary: string | null;
614
+ content: string | null;
615
+ created_at: string;
616
+ id: string;
617
+ post_id: string;
618
+ source: Database["public"]["Enums"]["post_version_source_enum"];
619
+ title: string | null;
620
+ version_number: number;
621
+ };
622
+ Insert: {
623
+ ai_summary?: string | null;
624
+ content?: string | null;
625
+ created_at?: string;
626
+ id?: string;
627
+ post_id: string;
628
+ source: Database["public"]["Enums"]["post_version_source_enum"];
629
+ title?: string | null;
630
+ version_number: number;
631
+ };
632
+ Update: {
633
+ ai_summary?: string | null;
634
+ content?: string | null;
635
+ created_at?: string;
636
+ id?: string;
637
+ post_id?: string;
638
+ source?: Database["public"]["Enums"]["post_version_source_enum"];
639
+ title?: string | null;
640
+ version_number?: number;
641
+ };
642
+ Relationships: [
643
+ {
644
+ foreignKeyName: "newsletter_post_versions_post_id_fkey";
645
+ columns: ["post_id"];
646
+ isOneToOne: false;
647
+ referencedRelation: "newsletter_posts";
648
+ referencedColumns: ["id"];
649
+ },
650
+ ];
651
+ };
652
+ newsletter_posts: {
653
+ Row: {
654
+ click_count: number;
655
+ content: string | null;
656
+ cover_image_url: string | null;
657
+ created_at: string;
658
+ excerpt: string | null;
659
+ id: string;
660
+ is_members_only: boolean;
661
+ is_pay_per_post: boolean;
662
+ like_count: number;
663
+ price: number | null;
664
+ profile_id: string;
665
+ published_at: string | null;
666
+ purchase_count: number;
667
+ reading_time_minutes: number | null;
668
+ revenue_total: number;
669
+ slug: string | null;
670
+ status: Database["public"]["Enums"]["post_status_enum"];
671
+ subtitle: string | null;
672
+ tags: string[];
673
+ title: string;
674
+ updated_at: string;
675
+ view_count: number;
676
+ visibility: Database["public"]["Enums"]["visibility_enum"];
677
+ };
678
+ Insert: {
679
+ click_count?: number;
680
+ content?: string | null;
681
+ cover_image_url?: string | null;
682
+ created_at?: string;
683
+ excerpt?: string | null;
684
+ id?: string;
685
+ is_members_only?: boolean;
686
+ is_pay_per_post?: boolean;
687
+ like_count?: number;
688
+ price?: number | null;
689
+ profile_id: string;
690
+ published_at?: string | null;
691
+ purchase_count?: number;
692
+ reading_time_minutes?: number | null;
693
+ revenue_total?: number;
694
+ slug?: string | null;
695
+ status?: Database["public"]["Enums"]["post_status_enum"];
696
+ subtitle?: string | null;
697
+ tags?: string[];
698
+ title: string;
699
+ updated_at?: string;
700
+ view_count?: number;
701
+ visibility?: Database["public"]["Enums"]["visibility_enum"];
702
+ };
703
+ Update: {
704
+ click_count?: number;
705
+ content?: string | null;
706
+ cover_image_url?: string | null;
707
+ created_at?: string;
708
+ excerpt?: string | null;
709
+ id?: string;
710
+ is_members_only?: boolean;
711
+ is_pay_per_post?: boolean;
712
+ like_count?: number;
713
+ price?: number | null;
714
+ profile_id?: string;
715
+ published_at?: string | null;
716
+ purchase_count?: number;
717
+ reading_time_minutes?: number | null;
718
+ revenue_total?: number;
719
+ slug?: string | null;
720
+ status?: Database["public"]["Enums"]["post_status_enum"];
721
+ subtitle?: string | null;
722
+ tags?: string[];
723
+ title?: string;
724
+ updated_at?: string;
725
+ view_count?: number;
726
+ visibility?: Database["public"]["Enums"]["visibility_enum"];
727
+ };
728
+ Relationships: [
729
+ {
730
+ foreignKeyName: "newsletter_posts_profile_id_fkey";
731
+ columns: ["profile_id"];
732
+ isOneToOne: false;
733
+ referencedRelation: "profiles";
734
+ referencedColumns: ["id"];
735
+ },
736
+ ];
737
+ };
738
+ newsletter_settings: {
739
+ Row: {
740
+ annual_plan_id: string | null;
741
+ annual_price: number | null;
742
+ created_at: string;
743
+ free_tier_label: string;
744
+ gifting_enabled: boolean;
745
+ id: string;
746
+ member_label: string;
747
+ memberships_enabled: boolean;
748
+ monthly_plan_id: string | null;
749
+ monthly_price: number | null;
750
+ newsletter_description: string | null;
751
+ newsletter_title: string | null;
752
+ profile_id: string;
753
+ updated_at: string;
754
+ welcome_message: string | null;
755
+ };
756
+ Insert: {
757
+ annual_plan_id?: string | null;
758
+ annual_price?: number | null;
759
+ created_at?: string;
760
+ free_tier_label?: string;
761
+ gifting_enabled?: boolean;
762
+ id?: string;
763
+ member_label?: string;
764
+ memberships_enabled?: boolean;
765
+ monthly_plan_id?: string | null;
766
+ monthly_price?: number | null;
767
+ newsletter_description?: string | null;
768
+ newsletter_title?: string | null;
769
+ profile_id: string;
770
+ updated_at?: string;
771
+ welcome_message?: string | null;
772
+ };
773
+ Update: {
774
+ annual_plan_id?: string | null;
775
+ annual_price?: number | null;
776
+ created_at?: string;
777
+ free_tier_label?: string;
778
+ gifting_enabled?: boolean;
779
+ id?: string;
780
+ member_label?: string;
781
+ memberships_enabled?: boolean;
782
+ monthly_plan_id?: string | null;
783
+ monthly_price?: number | null;
784
+ newsletter_description?: string | null;
785
+ newsletter_title?: string | null;
786
+ profile_id?: string;
787
+ updated_at?: string;
788
+ welcome_message?: string | null;
789
+ };
790
+ Relationships: [
791
+ {
792
+ foreignKeyName: "newsletter_settings_annual_plan_id_fkey";
793
+ columns: ["annual_plan_id"];
794
+ isOneToOne: false;
795
+ referencedRelation: "membership_plans";
796
+ referencedColumns: ["id"];
797
+ },
798
+ {
799
+ foreignKeyName: "newsletter_settings_monthly_plan_id_fkey";
800
+ columns: ["monthly_plan_id"];
801
+ isOneToOne: false;
802
+ referencedRelation: "membership_plans";
803
+ referencedColumns: ["id"];
804
+ },
805
+ {
806
+ foreignKeyName: "newsletter_settings_profile_id_fkey";
807
+ columns: ["profile_id"];
808
+ isOneToOne: true;
809
+ referencedRelation: "profiles";
810
+ referencedColumns: ["id"];
811
+ },
812
+ ];
813
+ };
475
814
  payout_methods: {
476
815
  Row: {
477
816
  created_at: string;
@@ -513,6 +852,163 @@ export type Database = {
513
852
  },
514
853
  ];
515
854
  };
855
+ post_access_grants: {
856
+ Row: {
857
+ created_at: string;
858
+ expires_at: string | null;
859
+ gift_message: string | null;
860
+ grant_type: Database["public"]["Enums"]["access_grant_type_enum"];
861
+ granted_by_profile_id: string | null;
862
+ grantee_profile_id: string;
863
+ id: string;
864
+ is_redeemed: boolean;
865
+ post_id: string;
866
+ redeemed_at: string | null;
867
+ transaction_reference_id: string | null;
868
+ updated_at: string;
869
+ };
870
+ Insert: {
871
+ created_at?: string;
872
+ expires_at?: string | null;
873
+ gift_message?: string | null;
874
+ grant_type: Database["public"]["Enums"]["access_grant_type_enum"];
875
+ granted_by_profile_id?: string | null;
876
+ grantee_profile_id: string;
877
+ id?: string;
878
+ is_redeemed?: boolean;
879
+ post_id: string;
880
+ redeemed_at?: string | null;
881
+ transaction_reference_id?: string | null;
882
+ updated_at?: string;
883
+ };
884
+ Update: {
885
+ created_at?: string;
886
+ expires_at?: string | null;
887
+ gift_message?: string | null;
888
+ grant_type?: Database["public"]["Enums"]["access_grant_type_enum"];
889
+ granted_by_profile_id?: string | null;
890
+ grantee_profile_id?: string;
891
+ id?: string;
892
+ is_redeemed?: boolean;
893
+ post_id?: string;
894
+ redeemed_at?: string | null;
895
+ transaction_reference_id?: string | null;
896
+ updated_at?: string;
897
+ };
898
+ Relationships: [
899
+ {
900
+ foreignKeyName: "post_access_grants_granted_by_profile_id_fkey";
901
+ columns: ["granted_by_profile_id"];
902
+ isOneToOne: false;
903
+ referencedRelation: "profiles";
904
+ referencedColumns: ["id"];
905
+ },
906
+ {
907
+ foreignKeyName: "post_access_grants_grantee_profile_id_fkey";
908
+ columns: ["grantee_profile_id"];
909
+ isOneToOne: false;
910
+ referencedRelation: "profiles";
911
+ referencedColumns: ["id"];
912
+ },
913
+ {
914
+ foreignKeyName: "post_access_grants_post_id_fkey";
915
+ columns: ["post_id"];
916
+ isOneToOne: false;
917
+ referencedRelation: "newsletter_posts";
918
+ referencedColumns: ["id"];
919
+ },
920
+ {
921
+ foreignKeyName: "post_access_grants_transaction_reference_id_fkey";
922
+ columns: ["transaction_reference_id"];
923
+ isOneToOne: false;
924
+ referencedRelation: "transactions";
925
+ referencedColumns: ["reference_id"];
926
+ },
927
+ ];
928
+ };
929
+ profile_memberships: {
930
+ Row: {
931
+ auto_renew: boolean;
932
+ cancelled_at: string | null;
933
+ created_at: string;
934
+ id: string;
935
+ member_profile_id: string;
936
+ owner_profile_id: string;
937
+ period_end: string | null;
938
+ period_start: string;
939
+ plan_id: string;
940
+ price_at_purchase: number;
941
+ renewed_at: string | null;
942
+ service_type: string;
943
+ status: Database["public"]["Enums"]["membership_status_enum"];
944
+ transaction_id: string | null;
945
+ updated_at: string;
946
+ };
947
+ Insert: {
948
+ auto_renew?: boolean;
949
+ cancelled_at?: string | null;
950
+ created_at?: string;
951
+ id?: string;
952
+ member_profile_id: string;
953
+ owner_profile_id: string;
954
+ period_end?: string | null;
955
+ period_start?: string;
956
+ plan_id: string;
957
+ price_at_purchase: number;
958
+ renewed_at?: string | null;
959
+ service_type: string;
960
+ status?: Database["public"]["Enums"]["membership_status_enum"];
961
+ transaction_id?: string | null;
962
+ updated_at?: string;
963
+ };
964
+ Update: {
965
+ auto_renew?: boolean;
966
+ cancelled_at?: string | null;
967
+ created_at?: string;
968
+ id?: string;
969
+ member_profile_id?: string;
970
+ owner_profile_id?: string;
971
+ period_end?: string | null;
972
+ period_start?: string;
973
+ plan_id?: string;
974
+ price_at_purchase?: number;
975
+ renewed_at?: string | null;
976
+ service_type?: string;
977
+ status?: Database["public"]["Enums"]["membership_status_enum"];
978
+ transaction_id?: string | null;
979
+ updated_at?: string;
980
+ };
981
+ Relationships: [
982
+ {
983
+ foreignKeyName: "profile_memberships_member_profile_id_fkey";
984
+ columns: ["member_profile_id"];
985
+ isOneToOne: false;
986
+ referencedRelation: "profiles";
987
+ referencedColumns: ["id"];
988
+ },
989
+ {
990
+ foreignKeyName: "profile_memberships_owner_profile_id_fkey";
991
+ columns: ["owner_profile_id"];
992
+ isOneToOne: false;
993
+ referencedRelation: "profiles";
994
+ referencedColumns: ["id"];
995
+ },
996
+ {
997
+ foreignKeyName: "profile_memberships_plan_id_fkey";
998
+ columns: ["plan_id"];
999
+ isOneToOne: false;
1000
+ referencedRelation: "membership_plans";
1001
+ referencedColumns: ["id"];
1002
+ },
1003
+ {
1004
+ foreignKeyName: "profile_memberships_transaction_id_fkey";
1005
+ columns: ["transaction_id"];
1006
+ isOneToOne: false;
1007
+ referencedRelation: "transactions";
1008
+ referencedColumns: ["id"];
1009
+ },
1010
+ ];
1011
+ };
516
1012
  profiles: {
517
1013
  Row: {
518
1014
  allow_gifting: boolean | null;
@@ -994,6 +1490,13 @@ export type Database = {
994
1490
  };
995
1491
  Returns: boolean;
996
1492
  };
1493
+ check_newsletter_post_access: {
1494
+ Args: { p_post_id: string };
1495
+ Returns: {
1496
+ access_reason: string;
1497
+ has_access: boolean;
1498
+ }[];
1499
+ };
997
1500
  create_manager: {
998
1501
  Args: {
999
1502
  manager_department?: string;
@@ -1054,6 +1557,14 @@ export type Database = {
1054
1557
  sender_username: string;
1055
1558
  }[];
1056
1559
  };
1560
+ get_newsletter_stats: {
1561
+ Args: { p_from?: string; p_profile_id: string; p_to?: string };
1562
+ Returns: {
1563
+ newsletter_subs: number;
1564
+ post_sales_revenue: number;
1565
+ total_post_views: number;
1566
+ }[];
1567
+ };
1057
1568
  get_or_create_direct_conversation: {
1058
1569
  Args: { p_recipient_id: string };
1059
1570
  Returns: string;
@@ -1066,6 +1577,85 @@ export type Database = {
1066
1577
  total_amount: number;
1067
1578
  }[];
1068
1579
  };
1580
+ get_post_analytics: {
1581
+ Args: { p_from?: string; p_post_id: string; p_to?: string };
1582
+ Returns: {
1583
+ chart_date: string;
1584
+ conv_rate: number;
1585
+ day_clicks: number;
1586
+ day_purchases: number;
1587
+ day_revenue: number;
1588
+ day_views: number;
1589
+ total_clicks: number;
1590
+ total_sales: number;
1591
+ total_views: number;
1592
+ }[];
1593
+ };
1594
+ get_posts_page: {
1595
+ Args: {
1596
+ p_cursor?: string;
1597
+ p_from?: string;
1598
+ p_limit?: number;
1599
+ p_profile_id: string;
1600
+ p_search?: string;
1601
+ p_status: Database["public"]["Enums"]["post_status_enum"];
1602
+ p_to?: string;
1603
+ };
1604
+ Returns: {
1605
+ click_count: number;
1606
+ cover_image_url: string;
1607
+ created_at: string;
1608
+ draft_count: number;
1609
+ excerpt: string;
1610
+ id: string;
1611
+ is_members_only: boolean;
1612
+ is_pay_per_post: boolean;
1613
+ like_count: number;
1614
+ price: number;
1615
+ published_at: string;
1616
+ purchase_count: number;
1617
+ revenue_total: number;
1618
+ slug: string;
1619
+ subtitle: string;
1620
+ tags: string[];
1621
+ title: string;
1622
+ updated_at: string;
1623
+ view_count: number;
1624
+ }[];
1625
+ };
1626
+ get_reader_feed: {
1627
+ Args: {
1628
+ p_cursor?: string;
1629
+ p_filter?: string;
1630
+ p_from?: string;
1631
+ p_limit?: number;
1632
+ p_search?: string;
1633
+ p_to?: string;
1634
+ };
1635
+ Returns: {
1636
+ access_badge: string;
1637
+ author_avatar_url: string;
1638
+ author_display_name: string;
1639
+ author_username: string;
1640
+ cover_image_url: string;
1641
+ excerpt: string;
1642
+ has_access: boolean;
1643
+ is_liked: boolean;
1644
+ is_members_only: boolean;
1645
+ is_pay_per_post: boolean;
1646
+ like_count: number;
1647
+ post_id: string;
1648
+ price: number;
1649
+ profile_id: string;
1650
+ published_at: string;
1651
+ reading_time_minutes: number;
1652
+ slug: string;
1653
+ subtitle: string;
1654
+ tags: string[];
1655
+ title: string;
1656
+ view_count: number;
1657
+ }[];
1658
+ };
1069
1659
  get_supporter_coffee_gifts_stats: {
1070
1660
  Args: {
1071
1661
  p_from_date: string;
@@ -1082,6 +1672,16 @@ export type Database = {
1082
1672
  Args: { p_creator_id: string; p_from_date: string; p_to_date: string };
1083
1673
  Returns: number;
1084
1674
  };
1675
+ gift_newsletter_post: {
1676
+ Args: {
1677
+ p_expires_at?: string;
1678
+ p_gift_message?: string;
1679
+ p_grantee_profile_id: string;
1680
+ p_post_id: string;
1681
+ p_transaction_reference_id?: string;
1682
+ };
1683
+ Returns: string;
1684
+ };
1085
1685
  handle_successful_payment: {
1086
1686
  Args: {
1087
1687
  p_amount: number;
@@ -1097,6 +1697,14 @@ export type Database = {
1097
1697
  };
1098
1698
  Returns: Json;
1099
1699
  };
1700
+ has_active_membership: {
1701
+ Args: {
1702
+ p_member_profile_id: string;
1703
+ p_owner_profile_id: string;
1704
+ p_service_type: string;
1705
+ };
1706
+ Returns: boolean;
1707
+ };
1100
1708
  is_admin: { Args: never; Returns: boolean };
1101
1709
  is_following: { Args: { target_user_id: string }; Returns: boolean };
1102
1710
  is_manager: { Args: { user_email: string }; Returns: boolean };
@@ -1104,6 +1712,10 @@ export type Database = {
1104
1712
  Args: { p_conversation_id: string };
1105
1713
  Returns: undefined;
1106
1714
  };
1715
+ record_newsletter_post_click: {
1716
+ Args: { p_post_id: string };
1717
+ Returns: undefined;
1718
+ };
1107
1719
  request_withdrawal: {
1108
1720
  Args: { p_amount: number; p_payout_method_id: string };
1109
1721
  Returns: string;
@@ -1118,10 +1730,13 @@ export type Database = {
1118
1730
  sender_id: string;
1119
1731
  }[];
1120
1732
  };
1121
- show_limit: { Args: never; Returns: number };
1122
- show_trgm: { Args: { "": string }; Returns: string[] };
1123
1733
  toggle_follow: { Args: { target_user_id: string }; Returns: boolean };
1734
+ toggle_newsletter_post_like: {
1735
+ Args: { p_post_id: string };
1736
+ Returns: Json;
1737
+ };
1124
1738
  unfollow_user: { Args: { target_user_id: string }; Returns: undefined };
1739
+ unpublish_newsletter_post: { Args: { p_post_id: string }; Returns: Json };
1125
1740
  upsert_supporter: {
1126
1741
  Args: {
1127
1742
  p_amount?: number;
@@ -1137,6 +1752,7 @@ export type Database = {
1137
1752
  };
1138
1753
  };
1139
1754
  Enums: {
1755
+ access_grant_type_enum: "purchase" | "gift";
1140
1756
  manager_permission:
1141
1757
  | "managers.create"
1142
1758
  | "managers.view"
@@ -1173,6 +1789,13 @@ export type Database = {
1173
1789
  | "finance_manager"
1174
1790
  | "developer_manager";
1175
1791
  manager_status: "ACTIVE" | "INACTIVE" | "SUSPENDED";
1792
+ membership_billing_cycle_enum: "monthly" | "annual" | "lifetime";
1793
+ membership_status_enum:
1794
+ | "active"
1795
+ | "cancelled"
1796
+ | "expired"
1797
+ | "paused"
1798
+ | "past_due";
1176
1799
  payment_status_enum:
1177
1800
  | "pending"
1178
1801
  | "processing"
@@ -1183,6 +1806,12 @@ export type Database = {
1183
1806
  | "refunded"
1184
1807
  | "reviewing";
1185
1808
  payout_provider: "bkash" | "nagad" | "rocket" | "bank";
1809
+ post_status_enum: "draft" | "published" | "archived";
1810
+ post_version_source_enum:
1811
+ | "autosave"
1812
+ | "ai_polish"
1813
+ | "manual_save"
1814
+ | "pre_publish";
1186
1815
  provider_enum:
1187
1816
  | "HobeNakiCoffee"
1188
1817
  | "Bkash"
@@ -1369,6 +1998,7 @@ export type CompositeTypes<
1369
1998
  export const Constants = {
1370
1999
  public: {
1371
2000
  Enums: {
2001
+ access_grant_type_enum: ["purchase", "gift"],
1372
2002
  manager_permission: [
1373
2003
  "managers.create",
1374
2004
  "managers.view",
@@ -1407,6 +2037,14 @@ export const Constants = {
1407
2037
  "developer_manager",
1408
2038
  ],
1409
2039
  manager_status: ["ACTIVE", "INACTIVE", "SUSPENDED"],
2040
+ membership_billing_cycle_enum: ["monthly", "annual", "lifetime"],
2041
+ membership_status_enum: [
2042
+ "active",
2043
+ "cancelled",
2044
+ "expired",
2045
+ "paused",
2046
+ "past_due",
2047
+ ],
1410
2048
  payment_status_enum: [
1411
2049
  "pending",
1412
2050
  "processing",
@@ -1418,6 +2056,13 @@ export const Constants = {
1418
2056
  "reviewing",
1419
2057
  ],
1420
2058
  payout_provider: ["bkash", "nagad", "rocket", "bank"],
2059
+ post_status_enum: ["draft", "published", "archived"],
2060
+ post_version_source_enum: [
2061
+ "autosave",
2062
+ "ai_polish",
2063
+ "manual_save",
2064
+ "pre_publish",
2065
+ ],
1421
2066
  provider_enum: [
1422
2067
  "HobeNakiCoffee",
1423
2068
  "Bkash",
@@ -0,0 +1,21 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { formatCount } from "./format-count";
3
+
4
+ describe("formatCount", () => {
5
+ test("formats numbers less than 1000 using formatNumber", () => {
6
+ expect(formatCount(0)).toBe("0");
7
+ expect(formatCount(999)).toBe("999");
8
+ });
9
+
10
+ test("formats numbers >= 1000 with k suffix", () => {
11
+ expect(formatCount(1000)).toBe("1k");
12
+ expect(formatCount(2000)).toBe("2k");
13
+ expect(formatCount(10_000)).toBe("10k");
14
+ expect(formatCount(1_000_000)).toBe("1000k");
15
+ });
16
+
17
+ test("shows decimal for non-round thousands", () => {
18
+ expect(formatCount(1500)).toBe("1.5k");
19
+ expect(formatCount(10_500)).toBe("10.5k");
20
+ });
21
+ });
@@ -0,0 +1,11 @@
1
+ import { formatNumber } from "./format-number";
2
+
3
+ export function formatCount(n: number) {
4
+ if (n >= 1000) {
5
+ const formatted = n / 1000;
6
+ return Number.isInteger(formatted)
7
+ ? `${formatted}k`
8
+ : `${formatted.toFixed(1)}k`;
9
+ }
10
+ return formatNumber(n);
11
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./check-moderation";
2
2
  export * from "./format-amount";
3
+ export * from "./format-count";
3
4
  export * from "./format-date";
4
5
  export * from "./format-number";
5
6
  export * from "./format-plain-text";