onehook-api-client 1.0.43 → 1.0.45

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.
@@ -0,0 +1,145 @@
1
+ /**
2
+ * OneHook domain-event catalog — the single TypeScript source of truth for EventBridge `source` and
3
+ * `detail-type` strings and for which consumer subscribes to which event.
4
+ *
5
+ * Producers in Java keep their own constants (e.g. `MatchingConstants.EVENT_SOURCE_MATCHING`,
6
+ * identity's `OutboxEventType`); `packages/events/test/events-contract.test.ts` reads those Java
7
+ * sources and fails the build if they drift from this catalog, so a rename on either side cannot
8
+ * silently break a consumer.
9
+ */
10
+ /**
11
+ * EventBridge `source` per producing service, exactly as published today.
12
+ *
13
+ * The naming is inconsistent (`identity`, `onehook.chat`, `club.onehook.*`). Renaming a source is a
14
+ * coordinated migration across producers and every rule that filters on it, so the values are frozen
15
+ * here rather than "fixed" in place. Always reference these constants instead of literals.
16
+ */
17
+ export declare const EventSources: {
18
+ readonly IDENTITY: "identity";
19
+ readonly PROFILE: "club.onehook.profile";
20
+ readonly MATCHING: "club.onehook.matching";
21
+ readonly INTELLIGENCE: "club.onehook.intelligence";
22
+ readonly CHAT: "onehook.chat";
23
+ readonly STATE: "onehook.state";
24
+ readonly PAYMENTS: "onehook.payments";
25
+ readonly ANALYTICS: "club.onehook.analytics";
26
+ };
27
+ export type EventSource = (typeof EventSources)[keyof typeof EventSources];
28
+ /** EventBridge `detail-type` values. */
29
+ export declare const EventTypes: {
30
+ readonly USER_REGISTERED: "UserRegistered";
31
+ readonly INVITE_REDEEMED: "InviteRedeemed";
32
+ readonly USERNAME_CHANGED: "UsernameChanged";
33
+ readonly PHONE_NUMBER_CHANGED: "PhoneNumberChanged";
34
+ /**
35
+ * A member's ACTIVE matching profile changed (Profile), merged with the chat profile's display name
36
+ * and birth date. Never published for a draft or for a member with matching off.
37
+ */
38
+ readonly PROFILE_UPDATED: "ProfileUpdated";
39
+ /** A member's chat profile changed (Profile): moderation and analytics. */
40
+ readonly CHAT_PROFILE_UPDATED: "ChatProfileUpdated";
41
+ /** A matching draft untouched for 30 days was erased (Profile). */
42
+ readonly MATCHING_DRAFT_EXPIRED: "MatchingDraftExpired";
43
+ /** A matching draft will be erased in 3 days unless edited (Profile); Chat sends a reminder. */
44
+ readonly MATCHING_DRAFT_EXPIRING: "MatchingDraftExpiring";
45
+ readonly USER_DELETED: "UserDeleted";
46
+ readonly SWIPE_RECORDED: "SwipeRecorded";
47
+ readonly MUTUAL_MATCH: "MutualMatch";
48
+ readonly PROFILE_LIKED: "ProfileLiked";
49
+ readonly HOOK_CREATED: "HookCreated";
50
+ readonly HOOK_RELEASED: "HookReleased";
51
+ /**
52
+ * A hook filled a member's last slot (State). Their pending stack (requests and likes) is cleared,
53
+ * and they are paused in discovery until a slot frees.
54
+ */
55
+ readonly CAPACITY_REACHED: "CapacityReached";
56
+ readonly MESSAGE_SENT: "MessageSent";
57
+ readonly SUBSCRIPTION_CHANGED: "SubscriptionChanged";
58
+ readonly INTELLIGENCE_SCORES_UPDATED: "IntelligenceScoresUpdated";
59
+ /** Social-graph conversation features for one match after a message (analytics → intelligence). */
60
+ readonly CONVERSATION_UPDATED: "ConversationUpdated";
61
+ /** An established conversation went quiet; the user who owes a reply gets a nudge (Chat). */
62
+ readonly CONVERSATION_COOLING: "ConversationCooling";
63
+ /** Synthetic end-to-end probe of the lake pipeline (analytics canary). Carries no user data. */
64
+ readonly PIPELINE_CANARY: "PipelineCanary";
65
+ /** The contextual-AI workload fetched a match's AI context on a member's behalf (State). */
66
+ readonly AI_CONTEXT_REQUESTED: "AiContextRequested";
67
+ /** A 1:1 call reached ENDED (Chat). Metadata only — media and signaling are E2EE. */
68
+ readonly CALL_ENDED: "CallEnded";
69
+ /**
70
+ * A member blocked someone (State). State releases any hook between the pair before the block
71
+ * request returns; Matching keeps its discovery copy of blocks from this event.
72
+ */
73
+ readonly USER_BLOCKED: "UserBlocked";
74
+ /** A member lifted a block (State). `version` orders it after the matching `UserBlocked`. */
75
+ readonly USER_UNBLOCKED: "UserUnblocked";
76
+ /**
77
+ * A member sent a hook request by username and it was delivered (State). Chat sends the recipient
78
+ * a generic push. Never published for a request that was silently dropped.
79
+ */
80
+ readonly HOOK_REQUESTED: "HookRequested";
81
+ /**
82
+ * A hook's conversation was suspended (State): one of its members holds more hooks than their
83
+ * capacity after a downgrade. Chat rejects sends, reactions, typing and calls until `HookResumed`.
84
+ */
85
+ readonly HOOK_SUSPENDED: "HookSuspended";
86
+ /** A suspended hook's conversation is open again (State). */
87
+ readonly HOOK_RESUMED: "HookResumed";
88
+ /** A member turned matching on (State). Profile activates their matching draft; Matching hydrates. */
89
+ readonly MATCHING_ENABLED: "MatchingEnabled";
90
+ /**
91
+ * A member turned matching off (State). Profile, Matching and the derived stores erase every piece
92
+ * of matching data about them for this `generation`; hooks, chats, blocks and reports stay in State.
93
+ */
94
+ readonly MATCHING_OPT_OUT_STARTED: "MatchingOptOutStarted";
95
+ /** Both erasure steps confirmed: the member's matching is OFF (State). */
96
+ readonly MATCHING_DISABLED: "MatchingDisabled";
97
+ /** Profile erased a member's matching profile and media for `generation`. */
98
+ readonly MATCHING_PROFILE_ERASED: "MatchingProfileErased";
99
+ /** Matching erased every row naming the member for `generation`. */
100
+ readonly MATCHING_DATA_ERASED: "MatchingDataErased";
101
+ /**
102
+ * A member's moderation account state changed (Identity). Matching and the admin portal consume it
103
+ * to exclude non-active members from discovery and to drive the moderation queue. Account state is
104
+ * owned by Identity (sign-in and token refresh check it directly).
105
+ */
106
+ readonly ACCOUNT_STATE_CHANGED: "AccountStateChanged";
107
+ /**
108
+ * A legal preservation hold on a member changed (Identity). The OneHook Admin portal mirrors it to
109
+ * show which accounts are preserved (e.g. suspected child-safety cases, IT Rules 2021 r.3(1)(g)).
110
+ * Carries no PII - only the userId, whether the hold is active, a reason CODE, the optional expiry
111
+ * and the change time.
112
+ */
113
+ readonly PRESERVATION_HOLD_CHANGED: "PreservationHoldChanged";
114
+ /**
115
+ * A member reported another member (State). Consumed by the moderation portal (and analytics)
116
+ * to build the moderation queue grouped by the reported subject. Free-text report details never
117
+ * travel in the event - they stay in State and the portal fetches them via the admin route.
118
+ */
119
+ readonly MEMBER_REPORTED: "MemberReported";
120
+ /**
121
+ * A member's tier was reconciled (State). Matching projects the tier (incognito entitlement and
122
+ * ranking) and, when sent, the member's availability after the change.
123
+ */
124
+ readonly ENTITLEMENTS_CHANGED: "EntitlementsChanged";
125
+ };
126
+ export type EventType = (typeof EventTypes)[keyof typeof EventTypes];
127
+ /** Which service publishes each event type (documentation + contract tests). */
128
+ export declare const EVENT_PRODUCERS: Record<EventType, EventSource>;
129
+ /**
130
+ * Server-authoritative events captured by the analytics lake. The order is significant: it is the
131
+ * Glue partition-projection enum and the lake rule pattern, so append new types at the end.
132
+ * `IntelligenceScoresUpdated` gives the lake a full score history (the matching read model keeps
133
+ * only the latest snapshot per user).
134
+ */
135
+ export declare const LAKE_EVENT_TYPES: readonly EventType[];
136
+ /** Events that mutate (or erase from) the social graph. */
137
+ export declare const SOCIAL_GRAPH_EVENT_TYPES: readonly EventType[];
138
+ /** Events forwarded to the intelligence engines (packages/intelligence). */
139
+ export declare const INTELLIGENCE_FORWARDED_EVENT_TYPES: readonly ["SwipeRecorded", "MutualMatch", "ProfileUpdated", "UserDeleted", "ConversationUpdated", "AiContextRequested"];
140
+ export type IntelligenceForwardedEventType = (typeof INTELLIGENCE_FORWARDED_EVENT_TYPES)[number];
141
+ /** Events reconciled lake-vs-producer by the analytics reconciliation job. */
142
+ export declare const RECONCILED_EVENT_TYPES: readonly EventType[];
143
+ /** Business-volume events whose daily lake volume is alarmed on (sudden drops). */
144
+ export declare const BUSINESS_KPI_EVENT_TYPES: readonly EventType[];
145
+ export declare function isKnownEventType(v: unknown): v is EventType;