-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add hooks types and base implementation
- Loading branch information
1 parent
a1dab3b
commit 3067925
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Envelope } from './envelope'; | ||
import type { Transaction } from './transaction'; | ||
|
||
export type TransactionHookName = 'startTransaction' | 'transactionFinish'; | ||
export type TransactionHookCallback = (transaction: Transaction) => void; | ||
|
||
export type EnvelopeHookName = 'beforeEnvelope'; | ||
export type EnvelopeHookCallback = (envelope: Envelope) => void; | ||
|
||
export type HookName = TransactionHookName | EnvelopeHookName; | ||
export type HookCallback = TransactionHookCallback | EnvelopeHookCallback; | ||
|
||
export type HookStoreItem<N extends HookName, C extends HookCallback> = Partial<{ [key in N]: C[] }>; | ||
|
||
export type HookStore = | ||
// Hooks related to transaction start/finish | ||
HookStoreItem<TransactionHookName, TransactionHookCallback> & | ||
// Hooks related to envelope create and send | ||
HookStoreItem<EnvelopeHookName, EnvelopeHookCallback>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters