-
Notifications
You must be signed in to change notification settings - Fork 63
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
Create packages/product-core containing shared code between the various products #3661
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
7de3662
wip
rbuels a0c2eb3
wip
rbuels 30349d9
wip
rbuels a63fe4f
wip
rbuels 075f788
wip
rbuels f3f977b
wip
rbuels 7a23b3d
wip
rbuels e77ba9b
wip
rbuels efb8ac7
fix tests
rbuels 7b59ce9
factor out drawer widgets
rbuels e9d1e42
wip
rbuels 63e6b52
wip
rbuels cb9a206
wip
rbuels 3eeb219
wip
rbuels 3361fe8
wip
rbuels 8a52815
wip
rbuels 063fd5d
wip
rbuels dcd135c
queueOfDialogs actually does need to be observable
rbuels c2952c9
wip
rbuels 4b9e5ba
pass more tests
rbuels 9695755
update snaps, tests now passing
rbuels 373bbfa
wip
rbuels 249c49c
wip
rbuels 6fe456e
break up jb desktop root model more
rbuels bfa7beb
wip
rbuels a790584
remove session management from desktop session model
rbuels 433e700
fixup
rbuels 746f06d
wip
rbuels 4fb58dc
wip
rbuels e2bc30f
rework root and session model instantiation
rbuels bdcece8
fix last ts errors
rbuels b9b8704
fix lint
rbuels b5a0b64
ts-ify web rootmodel test
rbuels 801b8cb
rootmodel tests fixed
rbuels 856cd69
some simple test fixes
rbuels d81ad43
fix jbweb internet account tests
rbuels f41b88f
update snap
rbuels 24431d4
snaps
rbuels 19d0848
fix build, make session type names and guards consistent
rbuels 9e329d8
add type guard for jb root model
rbuels f0f8d58
lint
rbuels eb66f7f
fix product-core version
rbuels 5f9e9d8
add built-package resolutions for product-core
rbuels acec95e
remove unused getJBrowseRoot
rbuels 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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default } from './assemblyManager' | ||
export { default as assemblyConfigSchemaFactory } from './assemblyConfigSchema' | ||
export type { BaseAssemblyConfigSchema } from './assemblyConfigSchema' |
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
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
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
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,58 @@ | ||
{ | ||
"name": "@jbrowse/product-core", | ||
"version": "2.5.0", | ||
"description": "JBrowse 2 code shared between products but not used by plugins", | ||
"keywords": [ | ||
"jbrowse", | ||
"jbrowse2", | ||
"bionode", | ||
"biojs", | ||
"genomics" | ||
], | ||
"license": "Apache-2.0", | ||
"homepage": "https://jbrowse.org", | ||
"bugs": "https://github.com/GMOD/jbrowse-components/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GMOD/jbrowse-components.git", | ||
"directory": "packages/text-indexing" | ||
}, | ||
"author": "JBrowse Team", | ||
"distMain": "dist/index.js", | ||
"distModule": "esm/index.js", | ||
"srcMain": "src/index.ts", | ||
"srcModule": "src/index.ts", | ||
"main": "src/index.ts", | ||
"module": "", | ||
"files": [ | ||
"dist", | ||
"esm", | ||
"src" | ||
], | ||
"scripts": { | ||
"build:esm": "tsc --build tsconfig.build.esm.json", | ||
"build:es5": "tsc --build tsconfig.build.es5.json", | ||
"build": "npm run build:esm && npm run build:es5", | ||
"test": "cd ../..; jest packages/text-indexing", | ||
"clean": "rimraf dist esm *.tsbuildinfo", | ||
"prebuild": "yarn clean", | ||
"prepack": "yarn build && yarn useDist", | ||
"postpack": "yarn useSrc", | ||
"useDist": "node ../../scripts/useDist.js", | ||
"useSrc": "node ../../scripts/useSrc.js" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.16.3", | ||
"@mui/material": "^5.10.17", | ||
"shortid": "^2.2.15" | ||
}, | ||
"peerDependencies": { | ||
"mobx": "^6.0.0", | ||
"mobx-react": "^7.0.0", | ||
"mobx-state-tree": "^5.0.0", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"rxjs": "^7.0.0" | ||
}, | ||
"private": true | ||
} |
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,131 @@ | ||
import PluginManager from '@jbrowse/core/PluginManager' | ||
import assemblyManagerFactory, { | ||
BaseAssemblyConfigSchema, | ||
} from '@jbrowse/core/assemblyManager' | ||
import RpcManager from '@jbrowse/core/rpc/RpcManager' | ||
import { | ||
IAnyType, | ||
Instance, | ||
SnapshotIn, | ||
cast, | ||
getSnapshot, | ||
isStateTreeNode, | ||
types, | ||
} from 'mobx-state-tree' | ||
import TextSearchManager from '@jbrowse/core/TextSearch/TextSearchManager' | ||
|
||
/** | ||
* factory function for the Base-level root model shared by all products | ||
*/ | ||
export default function BaseRootModelTypeF( | ||
pluginManager: PluginManager, | ||
jbrowseModelType: IAnyType, | ||
sessionModelType: IAnyType, | ||
assemblyConfigSchema: BaseAssemblyConfigSchema, | ||
) { | ||
return types | ||
.model('BaseRootModel', { | ||
/** | ||
* #property | ||
* `jbrowse` is a mapping of the config.json into the in-memory state tree | ||
*/ | ||
jbrowse: jbrowseModelType, | ||
/** | ||
* #property | ||
*/ | ||
version: 'development', | ||
|
||
/** | ||
* #property | ||
* `session` encompasses the currently active state of the app, including | ||
* views open, tracks open in those views, etc. | ||
*/ | ||
session: types.maybe(sessionModelType), | ||
/** | ||
* #property | ||
*/ | ||
sessionPath: types.optional(types.string, ''), | ||
|
||
/** | ||
* #property | ||
*/ | ||
assemblyManager: types.optional( | ||
assemblyManagerFactory(assemblyConfigSchema, pluginManager), | ||
{}, | ||
), | ||
}) | ||
.volatile(self => ({ | ||
rpcManager: new RpcManager( | ||
pluginManager, | ||
self.jbrowse.configuration.rpc, | ||
{ | ||
MainThreadRpcDriver: {}, | ||
}, | ||
), | ||
|
||
/** | ||
* #volatile | ||
* Boolean indicating whether the session is in admin mode or not | ||
*/ | ||
adminMode: true, | ||
isAssemblyEditing: false, | ||
error: undefined as unknown, | ||
textSearchManager: new TextSearchManager(pluginManager), | ||
pluginManager, | ||
})) | ||
.actions(self => ({ | ||
/** | ||
* #action | ||
*/ | ||
setError(error: unknown) { | ||
self.error = error | ||
}, | ||
/** | ||
* #action | ||
*/ | ||
setSession(sessionSnapshot?: SnapshotIn<IAnyType>) { | ||
self.session = cast(sessionSnapshot) | ||
}, | ||
/** | ||
* #action | ||
*/ | ||
setDefaultSession() { | ||
this.setSession(self.jbrowse.defaultSession) | ||
}, | ||
/** | ||
* #action | ||
*/ | ||
setSessionPath(path: string) { | ||
self.sessionPath = path | ||
}, | ||
/** | ||
* #action | ||
*/ | ||
async renameCurrentSession(newName: string) { | ||
if (self.session) { | ||
const snapshot = JSON.parse(JSON.stringify(getSnapshot(self.session))) | ||
snapshot.name = newName | ||
this.setSession(snapshot) | ||
} | ||
}, | ||
/** | ||
* #action | ||
*/ | ||
setAssemblyEditing(flag: boolean) { | ||
self.isAssemblyEditing = flag | ||
}, | ||
})) | ||
} | ||
|
||
export type BaseRootModelType = ReturnType<typeof BaseRootModelTypeF> | ||
export type BaseRootModel = Instance<BaseRootModelType> | ||
|
||
/** Type guard for checking if something is a JB root model */ | ||
export function isRootModel(thing: unknown): thing is BaseRootModelType { | ||
return ( | ||
isStateTreeNode(thing) && | ||
'session' in thing && | ||
'jbrowse' in thing && | ||
'assemblyManager' in thing | ||
) | ||
} |
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.
this allows non-null assertions in test code