-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add types for resource events (#675)
- Loading branch information
1 parent
916665c
commit b8fed5b
Showing
2 changed files
with
61 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export const RESOURCES_SEARCH_EVENT = 'resources.search' | ||
export const RESOURCES_LOOKUP_EVENT = 'resources.lookup' | ||
|
||
export type ResourcesSearchRequest = { | ||
type: 'resources.search' | ||
resourceType: string | ||
query: string | ||
limit?: number | ||
pages?: { | ||
nextCursor: string | ||
} | ||
} | ||
|
||
export type ResourcesSearchResponse<S extends Record<string, unknown> = Record<string, unknown>> = { | ||
items: S[] | ||
pages: { | ||
nextCursor?: string | ||
} | ||
} | ||
|
||
type Scalar = string | number | boolean | ||
|
||
export type ResourcesLookupRequest<L extends Record<string, Scalar[]> = Record<string, Scalar[]>> = | ||
{ | ||
type: 'resources.lookup' | ||
lookupBy: L | ||
resourceType: string | ||
limit?: number | ||
pages?: { | ||
nextCursor: string | ||
} | ||
} | ||
|
||
export type ResourcesLookupResponse<L extends Record<string, unknown> = Record<string, unknown>> = { | ||
items: L[] | ||
pages: { | ||
nextCursor?: string | ||
} | ||
} |