Skip to content

Commit

Permalink
fix: inline mutation event
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Jul 17, 2024
1 parent 63bcaac commit 8eb49f2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@sanity/client": "^6.9.1",
"@sanity/diff-match-patch": "^3.1.1",
"hotscript": "^1.0.13",
"mendoza": "^3.0.4",
Expand Down
40 changes: 29 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/store/sanityApiTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {type SanityMutation} from '../encoders/sanity'
import {type SanityDocumentBase} from '../mutations/types'

export type SanityMutationEvent = {
type: 'mutation'
documentId: string
eventId: string
identity: string
mutations: SanityMutation[]
previousRev?: string
resultRev?: string
result?: SanityDocumentBase
previous?: SanityDocumentBase | null
effects?: {apply: unknown[]; revert: unknown[]}
timestamp: string
transactionId: string
transition: 'update' | 'appear' | 'disappear'
visibility: 'query' | 'transaction'
}
4 changes: 2 additions & 2 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface ListenerSyncEvent {
export interface ListenerMutationEvent {
type: 'mutation'
transactionId: string
effects: Required<MutationEvent>['effects']['apply']
mutations: Required<MutationEvent>['mutations']
effects: Required<SanityMutationEvent>['effects']['apply']
mutations: Required<SanityMutationEvent>['mutations']
}
export interface ListenerErrorEvent {
type: 'error'
Expand Down

0 comments on commit 8eb49f2

Please sign in to comment.