@thinkerchain/flipper-entities 2.7.1 → 2.7.2

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 (117) hide show
  1. package/dist/assets/logos.d.ts +14 -0
  2. package/dist/assets/logos.d.ts.map +1 -0
  3. package/dist/assets/logos.js +32 -0
  4. package/dist/assets/logos.js.map +1 -0
  5. package/dist/enums/marketplace.d.ts +16 -0
  6. package/dist/enums/marketplace.d.ts.map +1 -0
  7. package/dist/enums/marketplace.js +23 -0
  8. package/dist/enums/marketplace.js.map +1 -0
  9. package/dist/enums/notification-channel.enum.d.ts +8 -0
  10. package/dist/enums/notification-channel.enum.d.ts.map +1 -0
  11. package/dist/enums/notification-channel.enum.js +12 -0
  12. package/dist/enums/notification-channel.enum.js.map +1 -0
  13. package/dist/enums/search-type.enum.d.ts +23 -0
  14. package/dist/enums/search-type.enum.d.ts.map +1 -0
  15. package/dist/enums/search-type.enum.js +44 -0
  16. package/dist/enums/search-type.enum.js.map +1 -0
  17. package/dist/index.d.ts +34 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +36 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/types/banned-seller.types.d.ts +26 -0
  22. package/dist/types/banned-seller.types.d.ts.map +1 -0
  23. package/dist/types/banned-seller.types.js +3 -0
  24. package/dist/types/banned-seller.types.js.map +1 -0
  25. package/dist/types/billing-options.types.d.ts +14 -0
  26. package/dist/types/billing-options.types.d.ts.map +1 -0
  27. package/dist/types/billing-options.types.js +3 -0
  28. package/dist/types/billing-options.types.js.map +1 -0
  29. package/dist/types/core-options.types.d.ts +98 -0
  30. package/dist/types/core-options.types.d.ts.map +1 -0
  31. package/dist/types/core-options.types.js +3 -0
  32. package/dist/types/core-options.types.js.map +1 -0
  33. package/dist/types/engine.types.d.ts +68 -0
  34. package/dist/types/engine.types.d.ts.map +1 -0
  35. package/dist/types/engine.types.js +3 -0
  36. package/dist/types/engine.types.js.map +1 -0
  37. package/dist/types/item-check.types.d.ts +15 -0
  38. package/dist/types/item-check.types.d.ts.map +1 -0
  39. package/dist/types/item-check.types.js +3 -0
  40. package/dist/types/item-check.types.js.map +1 -0
  41. package/dist/types/item-filter.types.d.ts +30 -0
  42. package/dist/types/item-filter.types.d.ts.map +1 -0
  43. package/dist/types/item-filter.types.js +3 -0
  44. package/dist/types/item-filter.types.js.map +1 -0
  45. package/dist/types/item.types.d.ts +40 -0
  46. package/dist/types/item.types.d.ts.map +1 -0
  47. package/dist/types/item.types.js +3 -0
  48. package/dist/types/item.types.js.map +1 -0
  49. package/dist/types/notification.types.d.ts +35 -0
  50. package/dist/types/notification.types.d.ts.map +1 -0
  51. package/dist/types/notification.types.js +3 -0
  52. package/dist/types/notification.types.js.map +1 -0
  53. package/dist/types/option.types.d.ts +13 -0
  54. package/dist/types/option.types.d.ts.map +1 -0
  55. package/dist/types/option.types.js +3 -0
  56. package/dist/types/option.types.js.map +1 -0
  57. package/dist/types/product.types.d.ts +99 -0
  58. package/dist/types/product.types.d.ts.map +1 -0
  59. package/dist/types/product.types.js +3 -0
  60. package/dist/types/product.types.js.map +1 -0
  61. package/dist/types/scrape.types.d.ts +42 -0
  62. package/dist/types/scrape.types.d.ts.map +1 -0
  63. package/dist/types/scrape.types.js +3 -0
  64. package/dist/types/scrape.types.js.map +1 -0
  65. package/dist/types/search-jsonb.types.d.ts +96 -0
  66. package/dist/types/search-jsonb.types.d.ts.map +1 -0
  67. package/dist/types/search-jsonb.types.js +3 -0
  68. package/dist/types/search-jsonb.types.js.map +1 -0
  69. package/dist/types/search.types.d.ts +34 -0
  70. package/dist/types/search.types.d.ts.map +1 -0
  71. package/dist/types/search.types.js +3 -0
  72. package/dist/types/search.types.js.map +1 -0
  73. package/dist/types/seller-snapshot.types.d.ts +53 -0
  74. package/dist/types/seller-snapshot.types.d.ts.map +1 -0
  75. package/dist/types/seller-snapshot.types.js +3 -0
  76. package/dist/types/seller-snapshot.types.js.map +1 -0
  77. package/dist/types/seller-summary.types.d.ts +35 -0
  78. package/dist/types/seller-summary.types.d.ts.map +1 -0
  79. package/dist/types/seller-summary.types.js +3 -0
  80. package/dist/types/seller-summary.types.js.map +1 -0
  81. package/dist/types/subscription.types.d.ts +120 -0
  82. package/dist/types/subscription.types.d.ts.map +1 -0
  83. package/dist/types/subscription.types.js +3 -0
  84. package/dist/types/subscription.types.js.map +1 -0
  85. package/dist/types/usage.types.d.ts +48 -0
  86. package/dist/types/usage.types.d.ts.map +1 -0
  87. package/dist/types/usage.types.js +3 -0
  88. package/dist/types/usage.types.js.map +1 -0
  89. package/dist/types/user-channel.types.d.ts +28 -0
  90. package/dist/types/user-channel.types.d.ts.map +1 -0
  91. package/dist/types/user-channel.types.js +3 -0
  92. package/dist/types/user-channel.types.js.map +1 -0
  93. package/dist/types/user-item.types.d.ts +15 -0
  94. package/dist/types/user-item.types.d.ts.map +1 -0
  95. package/dist/types/user-item.types.js +3 -0
  96. package/dist/types/user-item.types.js.map +1 -0
  97. package/dist/types/user.types.d.ts +28 -0
  98. package/dist/types/user.types.d.ts.map +1 -0
  99. package/dist/types/user.types.js +3 -0
  100. package/dist/types/user.types.js.map +1 -0
  101. package/dist/utilities/index.d.ts +9 -0
  102. package/dist/utilities/index.d.ts.map +1 -0
  103. package/dist/utilities/index.js +21 -0
  104. package/dist/utilities/index.js.map +1 -0
  105. package/dist/utilities/scalar.d.ts +12 -0
  106. package/dist/utilities/scalar.d.ts.map +1 -0
  107. package/dist/utilities/scalar.js +45 -0
  108. package/dist/utilities/scalar.js.map +1 -0
  109. package/dist/utilities/seller-snapshot.d.ts +41 -0
  110. package/dist/utilities/seller-snapshot.d.ts.map +1 -0
  111. package/dist/utilities/seller-snapshot.js +126 -0
  112. package/dist/utilities/seller-snapshot.js.map +1 -0
  113. package/dist/utilities/seller-summary.d.ts +22 -0
  114. package/dist/utilities/seller-summary.d.ts.map +1 -0
  115. package/dist/utilities/seller-summary.js +85 -0
  116. package/dist/utilities/seller-summary.js.map +1 -0
  117. package/package.json +1 -1
@@ -0,0 +1,120 @@
1
+ import type { ProductEntity } from './product.types';
2
+ import type { MarketplaceEnum } from '../enums/marketplace';
3
+ export type SubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'canceled' | 'expired';
4
+ export type SubscriptionSource = 'manual' | 'trial' | 'payment';
5
+ /** Kelompok entitlement di dalam satu langganan. */
6
+ export type SubscriptionProfileKind = 'search' | 'channel' | 'banned_seller';
7
+ /**
8
+ * Profil slot per marketplace beku milik satu scanner (tabel `FrozenSearchMarketPlaceProfile`).
9
+ */
10
+ export interface FrozenSearchMarketPlaceProfileEntity {
11
+ id: number;
12
+ frozenSearchProfileId: number;
13
+ marketplace: string;
14
+ slot: number;
15
+ deleted?: boolean;
16
+ createdAt?: string;
17
+ updatedAt?: string;
18
+ }
19
+ /**
20
+ * Profil scanner beku milik satu langganan (tabel `FrozenSearchProfile` / `SubscriptionSearchProfile`).
21
+ */
22
+ export interface FrozenSearchProfileEntity {
23
+ id: number;
24
+ subscriptionId: number;
25
+ key: string;
26
+ name: string;
27
+ /** Deskripsi/keterangan durasi pencarian (mis. '10 Menit durasi pencarian', 'Blazing fast'). */
28
+ description?: string | null;
29
+ /** Slot total dasar / legacy fallback. */
30
+ slot?: number;
31
+ /** Delay antar-scrape (ms) beku untuk scanner ini. */
32
+ delayMilis: number;
33
+ /** Efek visual kartu di UI: basic, special-gradient, mythical. */
34
+ specialEffect?: 'basic' | 'special-gradient' | 'mythical';
35
+ /** Marketplace beku yang boleh dipakai scanner ini (legacy). */
36
+ allowedMarketPlaces?: string[];
37
+ /** Rincian profil slot per marketplace. */
38
+ marketplaceProfiles?: FrozenSearchMarketPlaceProfileEntity[];
39
+ deleted: boolean;
40
+ createdAt: string;
41
+ }
42
+ export type SubscriptionSearchProfileEntity = FrozenSearchProfileEntity;
43
+ /**
44
+ * Profil channel beku milik satu langganan (tabel `FrozenChannelProfile` / `SubscriptionChannelProfile`).
45
+ * Agnostik: tidak menyimpan jenis channel — `UserChannel.other.type` yang
46
+ * menentukan, divalidasi terhadap `SUPPORTED_CHANNEL_TYPES`.
47
+ */
48
+ export interface FrozenChannelProfileEntity {
49
+ id: number;
50
+ subscriptionId: number;
51
+ key: string;
52
+ name: string;
53
+ slot: number;
54
+ deleted: boolean;
55
+ createdAt: string;
56
+ }
57
+ export type SubscriptionChannelProfileEntity = FrozenChannelProfileEntity;
58
+ /**
59
+ * Profil banned seller beku milik satu langganan (tabel `FrozenBannedSellerProfile` / `SubscriptionBannedSellerProfile`).
60
+ */
61
+ export interface FrozenBannedSellerProfileEntity {
62
+ id: number;
63
+ subscriptionId: number;
64
+ key: string;
65
+ name: string;
66
+ slot: number;
67
+ deleted: boolean;
68
+ createdAt: string;
69
+ }
70
+ export type SubscriptionBannedSellerProfileEntity = FrozenBannedSellerProfileEntity;
71
+ /** Copy profil untuk audit; angka yang dipakai logika ada di baris relasional. */
72
+ export interface SubscriptionProfileSnapshot {
73
+ profileId: number;
74
+ kind: SubscriptionProfileKind;
75
+ key: string;
76
+ name: string;
77
+ slot?: number;
78
+ delayMilis?: number | null;
79
+ allowedMarketPlaces?: string[] | null;
80
+ marketplaces?: {
81
+ marketplace: MarketplaceEnum | string;
82
+ slot: number;
83
+ }[];
84
+ }
85
+ /** Snapshot saat langganan dibuat; audit/display saja, bukan sumber logika. */
86
+ export interface SubscriptionSnapshot {
87
+ productKey: string;
88
+ productName: string;
89
+ priceCents: number;
90
+ profiles: SubscriptionProfileSnapshot[];
91
+ }
92
+ /** Representasi tabel `Subscription`. */
93
+ export type SubscriptionEntity = {
94
+ id: number;
95
+ userId: number;
96
+ productId: number;
97
+ /** Copy beku dari katalog untuk tampilan; katalog bisa berubah. */
98
+ productKey: string | null;
99
+ productName: string | null;
100
+ status: SubscriptionStatus;
101
+ currentPeriodStart: string;
102
+ currentPeriodEnd: string;
103
+ cancelAtPeriodEnd: boolean;
104
+ source: SubscriptionSource;
105
+ snapshot: SubscriptionSnapshot | null;
106
+ assignedBy: string | null;
107
+ deleted: boolean;
108
+ createdAt: string;
109
+ createdBy: string | null;
110
+ updatedAt: string;
111
+ updatedBy: string | null;
112
+ };
113
+ /** Langganan + produk dan profil bekunya. */
114
+ export type SubscriptionWithProduct = SubscriptionEntity & {
115
+ product?: ProductEntity;
116
+ searchProfiles?: SubscriptionSearchProfileEntity[];
117
+ channelProfiles?: SubscriptionChannelProfileEntity[];
118
+ bannedSellerProfiles?: SubscriptionBannedSellerProfileEntity[];
119
+ };
120
+ //# sourceMappingURL=subscription.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.types.d.ts","sourceRoot":"","sources":["../../src/types/subscription.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,oDAAoD;AACpD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;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,+BAA+B,EAAE,CAAC;IACnD,eAAe,CAAC,EAAE,gCAAgC,EAAE,CAAC;IACrD,oBAAoB,CAAC,EAAE,qCAAqC,EAAE,CAAC;CAChE,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscription.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.types.js","sourceRoot":"","sources":["../../src/types/subscription.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import type { SubscriptionProfileKind, SubscriptionStatus } from './subscription.types';
2
+ /** Pemakaian slot marketplace di dalam satu profil scanner. */
3
+ export interface UsageMarketplaceMetric {
4
+ id: number;
5
+ marketplace: string;
6
+ slot: number;
7
+ used: number;
8
+ available: number;
9
+ isAvailable: boolean;
10
+ }
11
+ /** Pemakaian satu profil langganan (scanner atau channel). */
12
+ export interface UsageProfileMetric {
13
+ subscriptionProfileId: number;
14
+ kind: SubscriptionProfileKind;
15
+ key: string;
16
+ name: string;
17
+ /** Deskripsi/keterangan durasi pencarian (mis. '10 Menit durasi pencarian', 'Blazing fast'). */
18
+ description?: string | null;
19
+ used: number;
20
+ /** Slot efektif profil ini (= slot beku dari plan). */
21
+ slot: number;
22
+ /** Nilai beku profil scanner, dipakai FE untuk menampilkan & mengisi form. */
23
+ delayMilis?: number | null;
24
+ allowedMarketPlaces?: string[] | null;
25
+ /** Efek visual kartu di UI: basic, special-gradient, mythical. */
26
+ specialEffect?: 'basic' | 'special-gradient' | 'mythical';
27
+ /** Rincian kuota per marketplace (untuk scanner). */
28
+ marketplaces?: UsageMarketplaceMetric[];
29
+ }
30
+ /** Satu kelompok metrik: total pemakaian + rincian per profil. */
31
+ export interface UsageMetric {
32
+ used: number;
33
+ limit: number;
34
+ profiles: UsageProfileMetric[];
35
+ }
36
+ /** Respons `GET /plans/usage`: langganan aktif + pemakaian berjalan. */
37
+ export interface SubscriptionUsageSummary {
38
+ productKey: string;
39
+ productName: string;
40
+ status: SubscriptionStatus;
41
+ currentPeriodStart: string;
42
+ currentPeriodEnd: string;
43
+ remainingDays: number;
44
+ searches: UsageMetric;
45
+ channels: UsageMetric;
46
+ bannedSellers?: UsageMetric;
47
+ }
48
+ //# sourceMappingURL=usage.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.types.d.ts","sourceRoot":"","sources":["../../src/types/usage.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,+DAA+D;AAC/D,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtC,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,UAAU,CAAC;IAC1D,qDAAqD;IACrD,YAAY,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACzC;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED,wEAAwE;AACxE,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,WAAW,CAAC;IACtB,aAAa,CAAC,EAAE,WAAW,CAAC;CAC7B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usage.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.types.js","sourceRoot":"","sources":["../../src/types/usage.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ export interface ChannelEntity {
2
+ type: string;
3
+ }
4
+ export interface TelegramChannelEntity extends ChannelEntity {
5
+ chatId: string;
6
+ disableNotification: boolean;
7
+ }
8
+ /** Representasi tabel `UserChannel`. */
9
+ export type UserChannelEntity = {
10
+ id: number;
11
+ userId: number;
12
+ name: string;
13
+ other: Record<string, unknown> | null;
14
+ /**
15
+ * Profil channel langganan yang membayar channel ini
16
+ * (tabel `SubscriptionChannelProfile`); null = channel lama, tidak dipakai.
17
+ */
18
+ subscriptionProfileId?: number | null;
19
+ subscriptionId?: number | null;
20
+ subscriptionName?: string | null;
21
+ isSubscriptionActive?: boolean;
22
+ deleted: boolean;
23
+ createdAt: string;
24
+ createdBy: string | null;
25
+ updatedAt: string;
26
+ updatedBy: string | null;
27
+ };
28
+ //# sourceMappingURL=user-channel.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-channel.types.d.ts","sourceRoot":"","sources":["../../src/types/user-channel.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user-channel.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-channel.types.js","sourceRoot":"","sources":["../../src/types/user-channel.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { ItemEntity } from './item.types';
2
+ /** ProseMirror/Tiptap JSON document (output of `editor.getJSON()`). */
3
+ export type RichNoteJSONB = Record<string, unknown>;
4
+ /** Representasi tabel `UserItem` (item + state milik user). */
5
+ export type UserItemEntity = ItemEntity & {
6
+ readedAt: string | null;
7
+ favoritedAt: string | null;
8
+ richNote: RichNoteJSONB | null;
9
+ /**
10
+ * Item ini yang jadi alasan user mem-ban penjualnya (kolom
11
+ * `isBannedSellerReason`). Diisi endpoint ban/unban, bukan oleh scraper.
12
+ */
13
+ isBannedSellerReason?: boolean;
14
+ };
15
+ //# sourceMappingURL=user-item.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-item.types.d.ts","sourceRoot":"","sources":["../../src/types/user-item.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user-item.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-item.types.js","sourceRoot":"","sources":["../../src/types/user-item.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import type { BannedSellerEntity } from './banned-seller.types';
2
+ import type { UserChannelEntity } from './user-channel.types';
3
+ /** Representasi tabel `User`. */
4
+ export type UserEntity = {
5
+ id: number;
6
+ username: string;
7
+ name: string | null;
8
+ email: string | null;
9
+ phoneNumber?: string | null;
10
+ password: string;
11
+ isEmailValid: boolean;
12
+ isPhoneValid?: boolean;
13
+ timezone?: string;
14
+ roles: string[];
15
+ option: Record<string, unknown> | null;
16
+ deleted: boolean;
17
+ createdAt: string;
18
+ createdBy: string | null;
19
+ updatedAt: string;
20
+ updatedBy: string | null;
21
+ };
22
+ /** User + channel + ban seller: payload `search.user` dari orchestrator ke engine. */
23
+ export type UserWithRelations = UserEntity & {
24
+ userChannels: UserChannelEntity[];
25
+ /** Banned seller milik user ini; diisi orchestrator sekali per siklus. */
26
+ bans?: BannedSellerEntity[];
27
+ };
28
+ //# sourceMappingURL=user.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.types.d.ts","sourceRoot":"","sources":["../../src/types/user.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG;IAC3C,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,0EAA0E;IAC1E,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.types.js","sourceRoot":"","sources":["../../src/types/user.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Subpath `@thinkerchain/flipper-entities/utilities` — semua helper runtime
3
+ * (fungsi yang jalan di service), dipisah dari root yang isinya tipe.
4
+ */
5
+ export { isRecord, toIsoString, toNumberValue, toStringValue } from './scalar';
6
+ export { SELLER_SNAPSHOT_VERSION, createSellerSnapshot, parseSellerSnapshot, toSellerIdentities, toSellerMatchKey, } from './seller-snapshot';
7
+ export type { SellerMatchMechanism } from './seller-snapshot';
8
+ export { toSellerSummary } from './seller-summary';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE/E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toSellerSummary = exports.toSellerMatchKey = exports.toSellerIdentities = exports.parseSellerSnapshot = exports.createSellerSnapshot = exports.SELLER_SNAPSHOT_VERSION = exports.toStringValue = exports.toNumberValue = exports.toIsoString = exports.isRecord = void 0;
4
+ /**
5
+ * Subpath `@thinkerchain/flipper-entities/utilities` — semua helper runtime
6
+ * (fungsi yang jalan di service), dipisah dari root yang isinya tipe.
7
+ */
8
+ var scalar_1 = require("./scalar");
9
+ Object.defineProperty(exports, "isRecord", { enumerable: true, get: function () { return scalar_1.isRecord; } });
10
+ Object.defineProperty(exports, "toIsoString", { enumerable: true, get: function () { return scalar_1.toIsoString; } });
11
+ Object.defineProperty(exports, "toNumberValue", { enumerable: true, get: function () { return scalar_1.toNumberValue; } });
12
+ Object.defineProperty(exports, "toStringValue", { enumerable: true, get: function () { return scalar_1.toStringValue; } });
13
+ var seller_snapshot_1 = require("./seller-snapshot");
14
+ Object.defineProperty(exports, "SELLER_SNAPSHOT_VERSION", { enumerable: true, get: function () { return seller_snapshot_1.SELLER_SNAPSHOT_VERSION; } });
15
+ Object.defineProperty(exports, "createSellerSnapshot", { enumerable: true, get: function () { return seller_snapshot_1.createSellerSnapshot; } });
16
+ Object.defineProperty(exports, "parseSellerSnapshot", { enumerable: true, get: function () { return seller_snapshot_1.parseSellerSnapshot; } });
17
+ Object.defineProperty(exports, "toSellerIdentities", { enumerable: true, get: function () { return seller_snapshot_1.toSellerIdentities; } });
18
+ Object.defineProperty(exports, "toSellerMatchKey", { enumerable: true, get: function () { return seller_snapshot_1.toSellerMatchKey; } });
19
+ var seller_summary_1 = require("./seller-summary");
20
+ Object.defineProperty(exports, "toSellerSummary", { enumerable: true, get: function () { return seller_summary_1.toSellerSummary; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAA+E;AAAtE,kGAAA,QAAQ,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,uGAAA,aAAa,OAAA;AAAE,uGAAA,aAAa,OAAA;AAE5D,qDAM2B;AALzB,0HAAA,uBAAuB,OAAA;AACvB,uHAAA,oBAAoB,OAAA;AACpB,sHAAA,mBAAmB,OAAA;AACnB,qHAAA,kBAAkB,OAAA;AAClB,mHAAA,gBAAgB,OAAA;AAIlB,mDAAmD;AAA1C,iHAAA,eAAe,OAAA"}
@@ -0,0 +1,12 @@
1
+ /** Helper nilai mentah marketplace → tipe aman. Dipakai utilities lain. */
2
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ /** String ter-trim; angka finite jadi string (FB kadang kirim id sebagai number). */
4
+ export declare function toStringValue(raw: unknown): string | null;
5
+ /** Angka finite; string numerik diterima (marketplace sering kirim string). */
6
+ export declare function toNumberValue(raw: unknown): number | null;
7
+ /**
8
+ * Epoch (detik atau milidetik) → ISO 8601. Nilai <= 0 / tidak masuk akal → null.
9
+ * Ambang 1e11: detik saat ini ~1.7e9, milidetik ~1.7e12.
10
+ */
11
+ export declare function toIsoString(raw: unknown): string | null;
12
+ //# sourceMappingURL=scalar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/utilities/scalar.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOzD;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASzD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKvD"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /** Helper nilai mentah marketplace → tipe aman. Dipakai utilities lain. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isRecord = isRecord;
5
+ exports.toStringValue = toStringValue;
6
+ exports.toNumberValue = toNumberValue;
7
+ exports.toIsoString = toIsoString;
8
+ function isRecord(value) {
9
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
10
+ }
11
+ /** String ter-trim; angka finite jadi string (FB kadang kirim id sebagai number). */
12
+ function toStringValue(raw) {
13
+ if (typeof raw === 'string') {
14
+ const trimmed = raw.trim();
15
+ return trimmed.length > 0 ? trimmed : null;
16
+ }
17
+ if (typeof raw === 'number' && Number.isFinite(raw))
18
+ return String(raw);
19
+ return null;
20
+ }
21
+ /** Angka finite; string numerik diterima (marketplace sering kirim string). */
22
+ function toNumberValue(raw) {
23
+ if (typeof raw === 'number')
24
+ return Number.isFinite(raw) ? raw : null;
25
+ if (typeof raw === 'string') {
26
+ const trimmed = raw.trim();
27
+ if (trimmed.length === 0)
28
+ return null;
29
+ const parsed = Number(trimmed);
30
+ return Number.isFinite(parsed) ? parsed : null;
31
+ }
32
+ return null;
33
+ }
34
+ /**
35
+ * Epoch (detik atau milidetik) → ISO 8601. Nilai <= 0 / tidak masuk akal → null.
36
+ * Ambang 1e11: detik saat ini ~1.7e9, milidetik ~1.7e12.
37
+ */
38
+ function toIsoString(raw) {
39
+ const value = toNumberValue(raw);
40
+ if (value === null || value <= 0)
41
+ return null;
42
+ const date = new Date(value > 1e11 ? value : value * 1000);
43
+ return Number.isNaN(date.getTime()) ? null : date.toISOString();
44
+ }
45
+ //# sourceMappingURL=scalar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.js","sourceRoot":"","sources":["../../src/utilities/scalar.ts"],"names":[],"mappings":";AAAA,2EAA2E;;AAE3E,4BAEC;AAGD,sCAOC;AAGD,sCASC;AAMD,kCAKC;AAnCD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,qFAAqF;AACrF,SAAgB,aAAa,CAAC,GAAY;IACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,GAAG,CAA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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { SellerIdentity, SellerSnapshotJSONB } from '../types/seller-snapshot.types';
2
+ export declare const SELLER_SNAPSHOT_VERSION = 1;
3
+ /**
4
+ * Bungkus objek seller mentah jadi snapshot berversi dengan HANYA property
5
+ * penting (bentuk ternormalisasi, sama untuk semua marketplace): identitas
6
+ * matching ban (`id`, `user_id`, `marketplace_user_profile.id`), nama, avatar,
7
+ * join, rating, verified, orders. Varian gambar, `__typename`, dan nesting
8
+ * mentah rating dibuang.
9
+ * Null kalau marketplace tidak mengirim objek (kadang null/string).
10
+ * ponytail: versi ini menulis v1; tambahkan cabang kalau v2 muncul.
11
+ */
12
+ export declare function createSellerSnapshot(source: string, seller: unknown): SellerSnapshotJSONB | null;
13
+ /**
14
+ * Baca snapshot dari DB/IPC. Null kalau bentuknya tidak dikenal (mis. versi
15
+ * lebih baru) — pemanggil fail-open, bukan throw. Ini SATU-SATUNYA cabang
16
+ * versi snapshot; semua service lain lewat sini.
17
+ */
18
+ export declare function parseSellerSnapshot(value: unknown): SellerSnapshotJSONB | null;
19
+ /**
20
+ * Nilai identitas seller untuk matching ban. Nilai duplikat (FB sering mengisi
21
+ * `id` = `user_id`) dibuang, property pertama yang menang.
22
+ */
23
+ export declare function toSellerIdentities(snapshot: SellerSnapshotJSONB | null | undefined): SellerIdentity[];
24
+ /**
25
+ * Mekanisme matching ban. Dipilih MURNI dari ada/tidaknya kolom
26
+ * `sellerSnapshot` pada BARIS BAN — bukan dari isi item:
27
+ * - `snapshot`: ban punya snapshot → cocokkan nilai identitas snapshot.
28
+ * - `legacy`: ban lama tanpa snapshot → cocokkan kolom `sellerId` BAN
29
+ * (nilai pfbid lama) dengan `id`/`user_id` snapshot ITEM (nilai pfbid
30
+ * yang sama), bukan dengan kolom `sellerId` item (kini berisi
31
+ * `marketplace_user_profile.id`, ruang id berbeda).
32
+ * Prefix key menjaga dua mekanisme itu tidak pernah saling cocok.
33
+ */
34
+ export type SellerMatchMechanism = 'snapshot' | 'legacy';
35
+ /**
36
+ * Key pencocokan ban: `${prefix mekanisme}:${marketplace huruf kecil}:${value}`.
37
+ * Sengaja tidak dipisah per property di dalam mekanisme `snapshot`, karena
38
+ * matching lintas property diinginkan (mis. `id` listing vs `user_id` ban).
39
+ */
40
+ export declare function toSellerMatchKey(marketplace: string, value: string, mechanism: SellerMatchMechanism): string;
41
+ //# sourceMappingURL=seller-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seller-snapshot.d.ts","sourceRoot":"","sources":["../../src/utilities/seller-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAkBzC;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,mBAAmB,GAAG,IAAI,CAwB5B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GACb,mBAAmB,GAAG,IAAI,CAc5B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAC/C,cAAc,EAAE,CAuBlB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAOzD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,oBAAoB,GAC9B,MAAM,CAER"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SELLER_SNAPSHOT_VERSION = void 0;
4
+ exports.createSellerSnapshot = createSellerSnapshot;
5
+ exports.parseSellerSnapshot = parseSellerSnapshot;
6
+ exports.toSellerIdentities = toSellerIdentities;
7
+ exports.toSellerMatchKey = toSellerMatchKey;
8
+ const scalar_1 = require("./scalar");
9
+ const seller_summary_1 = require("./seller-summary");
10
+ exports.SELLER_SNAPSHOT_VERSION = 1;
11
+ /** Key gambar seller, prioritas pertama yang berisi URI. */
12
+ const PICTURE_KEYS = [
13
+ 'profile_picture',
14
+ 'profile_picture_160',
15
+ 'commerce_profile_picture_with_fallback_160',
16
+ ];
17
+ function pickPicture(seller) {
18
+ for (const key of PICTURE_KEYS) {
19
+ const picture = seller[key];
20
+ const uri = (0, scalar_1.isRecord)(picture) ? (0, scalar_1.toStringValue)(picture.uri) : null;
21
+ if (uri)
22
+ return { uri };
23
+ }
24
+ return null;
25
+ }
26
+ /**
27
+ * Bungkus objek seller mentah jadi snapshot berversi dengan HANYA property
28
+ * penting (bentuk ternormalisasi, sama untuk semua marketplace): identitas
29
+ * matching ban (`id`, `user_id`, `marketplace_user_profile.id`), nama, avatar,
30
+ * join, rating, verified, orders. Varian gambar, `__typename`, dan nesting
31
+ * mentah rating dibuang.
32
+ * Null kalau marketplace tidak mengirim objek (kadang null/string).
33
+ * ponytail: versi ini menulis v1; tambahkan cabang kalau v2 muncul.
34
+ */
35
+ function createSellerSnapshot(source, seller) {
36
+ if (!(0, scalar_1.isRecord)(seller))
37
+ return null;
38
+ const profile = (0, scalar_1.isRecord)(seller.marketplace_user_profile)
39
+ ? seller.marketplace_user_profile
40
+ : null;
41
+ return {
42
+ source,
43
+ version: exports.SELLER_SNAPSHOT_VERSION,
44
+ data: {
45
+ id: (0, scalar_1.toStringValue)(seller.id),
46
+ user_id: (0, scalar_1.toStringValue)(seller.user_id),
47
+ name: (0, scalar_1.toStringValue)(seller.name),
48
+ join_time: (0, scalar_1.toNumberValue)(seller.join_time),
49
+ marketplace_user_profile: profile
50
+ ? {
51
+ id: (0, scalar_1.toStringValue)(profile.id),
52
+ c2c_orders_shipped: (0, scalar_1.toNumberValue)(profile.c2c_orders_shipped),
53
+ }
54
+ : null,
55
+ profile_picture: pickPicture(seller),
56
+ rating: (0, seller_summary_1.readSellerRating)(seller),
57
+ verified: (0, seller_summary_1.readSellerVerified)(seller),
58
+ },
59
+ };
60
+ }
61
+ /**
62
+ * Baca snapshot dari DB/IPC. Null kalau bentuknya tidak dikenal (mis. versi
63
+ * lebih baru) — pemanggil fail-open, bukan throw. Ini SATU-SATUNYA cabang
64
+ * versi snapshot; semua service lain lewat sini.
65
+ */
66
+ function parseSellerSnapshot(value) {
67
+ if (!value || typeof value !== 'object' || Array.isArray(value))
68
+ return null;
69
+ const snapshot = value;
70
+ if (snapshot.version !== exports.SELLER_SNAPSHOT_VERSION)
71
+ return null;
72
+ if (typeof snapshot.source !== 'string' || snapshot.source.length === 0) {
73
+ return null;
74
+ }
75
+ const data = snapshot.data;
76
+ if (!data || typeof data !== 'object' || Array.isArray(data))
77
+ return null;
78
+ return {
79
+ source: snapshot.source,
80
+ version: exports.SELLER_SNAPSHOT_VERSION,
81
+ data: data,
82
+ };
83
+ }
84
+ /**
85
+ * Nilai identitas seller untuk matching ban. Nilai duplikat (FB sering mengisi
86
+ * `id` = `user_id`) dibuang, property pertama yang menang.
87
+ */
88
+ function toSellerIdentities(snapshot) {
89
+ const data = snapshot?.data;
90
+ if (!data)
91
+ return [];
92
+ const profile = data.marketplace_user_profile;
93
+ const candidates = [
94
+ ['id', data.id],
95
+ ['user_id', data.user_id],
96
+ [
97
+ 'marketplace_user_profile.id',
98
+ profile && typeof profile === 'object' && !Array.isArray(profile)
99
+ ? profile.id
100
+ : null,
101
+ ],
102
+ ];
103
+ const identities = [];
104
+ const seen = new Set();
105
+ for (const [property, raw] of candidates) {
106
+ const value = (0, scalar_1.toStringValue)(raw);
107
+ if (!value || seen.has(value))
108
+ continue;
109
+ seen.add(value);
110
+ identities.push({ property, value });
111
+ }
112
+ return identities;
113
+ }
114
+ const MECHANISM_PREFIX = {
115
+ snapshot: 'S',
116
+ legacy: 'L',
117
+ };
118
+ /**
119
+ * Key pencocokan ban: `${prefix mekanisme}:${marketplace huruf kecil}:${value}`.
120
+ * Sengaja tidak dipisah per property di dalam mekanisme `snapshot`, karena
121
+ * matching lintas property diinginkan (mis. `id` listing vs `user_id` ban).
122
+ */
123
+ function toSellerMatchKey(marketplace, value, mechanism) {
124
+ return `${MECHANISM_PREFIX[mechanism]}:${marketplace.toLowerCase()}:${value}`;
125
+ }
126
+ //# sourceMappingURL=seller-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seller-snapshot.js","sourceRoot":"","sources":["../../src/utilities/seller-snapshot.ts"],"names":[],"mappings":";;;AAkCA,oDA2BC;AAOD,kDAgBC;AAMD,gDAyBC;AAwBD,4CAMC;AA7ID,qCAAkE;AAClE,qDAAwE;AAE3D,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAEzC,4DAA4D;AAC5D,MAAM,YAAY,GAAG;IACnB,iBAAiB;IACjB,qBAAqB;IACrB,4CAA4C;CACpC,CAAC;AAEX,SAAS,WAAW,CAAC,MAA+B;IAClD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAA,iBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,sBAAa,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClE,IAAI,GAAG;YAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,MAAc,EACd,MAAe;IAEf,IAAI,CAAC,IAAA,iBAAQ,EAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,OAAO,GAAG,IAAA,iBAAQ,EAAC,MAAM,CAAC,wBAAwB,C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CAAC;AAcD,MAAM,gBAAgB,GAAyC;IAC7D,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,GAAG;CACZ,CAAC;AAEF;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,WAAmB,EACnB,KAAa,EACb,SAA+B;IAE/B,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,IAAI,KAAK,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { SellerSnapshotJSONB } from '../types/seller-snapshot.types';
2
+ import type { SellerRating, SellerSummaryJSONB } from '../types/seller-summary.types';
3
+ /**
4
+ * Rating seller dari dua bentuk: ternormalisasi (`rating`, tulisan
5
+ * `createSellerSnapshot`) atau nesting mentah marketplace (baris lama).
6
+ * Null kalau marketplace tidak punya angka apa pun.
7
+ */
8
+ export declare function readSellerRating(source: Record<string, unknown>): SellerRating | null;
9
+ /**
10
+ * Badge verified dari bentuk ternormalisasi (`verified`) atau badge mentah
11
+ * (baris lama).
12
+ */
13
+ export declare function readSellerVerified(source: Record<string, unknown>): boolean;
14
+ /**
15
+ * Ringkasan seller (avatar, nama, profileId, rating, verified, orders) dari
16
+ * snapshot. TIDAK disimpan sebagai kolom: dipakai be saat menyusun response
17
+ * dan fe saat render. Null kalau tidak ada snapshot — baris legacy tidak punya
18
+ * ringkasan. Field yang hilang → null, bukan dihilangkan, supaya bentuk
19
+ * barisnya stabil antar marketplace.
20
+ */
21
+ export declare function toSellerSummary(snapshot: SellerSnapshotJSONB | null | undefined): SellerSummaryJSONB | null;
22
+ //# sourceMappingURL=seller-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seller-summary.d.ts","sourceRoot":"","sources":["../../src/utilities/seller-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAuBvC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,YAAY,GAAG,IAAI,CA2BrB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAM3E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAC/C,kBAAkB,GAAG,IAAI,CAgB3B"}