-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support entity type mappings #206
Merged
Merged
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4726583
feat: introduced basic type map
ffMathy 11dd5ae
feat: use stronger types
ffMathy 6a706f6
fix: tests pass
ffMathy 666e155
fix: compile issues
ffMathy 43a9422
fix: better `ensure` types
ffMathy 7e754bf
Merge branch 'main' into feature/type-extensibility
ffMathy 956d104
Merge branch 'main' into feature/type-extensibility
ffMathy 92c3832
fix: keyof everywhere
ffMathy 6fc0776
Merge branch 'main' into feature/type-extensibility
ffMathy d8aab39
Merge branch 'main' into feature/type-extensibility
ffMathy dd5d437
Merge branch 'main' into feature/type-extensibility
ffMathy f6aac8d
Update source/types.ts
ffMathy 564da6b
Merge branch 'main' into feature/type-extensibility
ffMathy 4f98e71
Merge branch 'main' into feature/type-extensibility
ffMathy 63a89e0
Refinements
gismya 259e993
K to TEntityType
gismya 1ad712d
Make the entitytype key the base for the responses as well
gismya 03a2242
Merge branch 'main' into feature/type-extensibility
ffMathy 074e937
Merge branch 'main' into feature/type-extensibility
ffMathy 8681d18
Review Fixes
gismya bd88b36
Merge branch 'main' into feature/type-extensibility
gismya 1b651c3
TS/Prettier/Import fixes
gismya 54e1ca9
Made EntityType generic naming consistent
gismya 3a42230
WIP
gismya f943e02
send tentitytypemap as a generic
jimmycallin ae3672a
add documentation
jimmycallin 15d678b
Merge branch 'main' into feature/more-type-extensibility
jimmycallin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
import * as operation from "./operation.js"; | ||
import { Session } from "./session.js"; | ||
import type { Data, QueryResponse } from "./types.js"; | ||
import type { QueryResponse } from "./types.js"; | ||
/** | ||
* Project schema namespace | ||
* @namespace project_schema | ||
|
@@ -18,8 +18,8 @@ import type { Data, QueryResponse } from "./types.js"; | |
* | ||
* @memberof project_schema | ||
*/ | ||
export function getStatuses( | ||
session: Session, | ||
export function getStatuses<TEntityTypeMap extends Record<string, any>>( | ||
session: Session<TEntityTypeMap>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should automatically get the entitytypemap inferred from the provided session, make sure it works so you don't have to specify it explicitly |
||
projectSchemaId: string, | ||
entityType: string, | ||
typeId: string | null = null, | ||
|
@@ -71,7 +71,8 @@ export function getStatuses( | |
), | ||
); | ||
|
||
response = session.call<QueryResponse<Data>>(operations); | ||
response = | ||
session.call<QueryResponse<TEntityTypeMap["ProjectSchema"]>>(operations); | ||
response = response.then((results) => { | ||
// Since the operations where performed in one batched call, | ||
// the result will be merged into a single entity. | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TEntityType is automatically inferred from the options type, so no need to specify it explicitly (please verify)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's clever if it works. Needs to be tested. The only issue I see is a lack of verification of the TEntitityType in the Options.