diff --git a/Editor-Runtime-API.md b/Editor-Runtime-API.md index 01f8098..3a2b111 100644 --- a/Editor-Runtime-API.md +++ b/Editor-Runtime-API.md @@ -134,93 +134,103 @@ The existing API has some issues: - as seen in the image above, a lots of overlapping links between the editor api and the runtime api - the editor api knows about the user making a request, the runtime api doesn't -In order to provide a clean api between the two, some simplification is needed. The detail is still being worked on, but essentially a new runtime api needs to be defined that provides a higher level of abstraction of the existing internal API. The new api will also allow a user object to be passed on all calls. +In order to provide a clean api between the two, some simplification is needed. The detail is still being worked on, but essentially a new runtime api needs to be defined that provides a higher level of abstraction of the existing internal API. + +Guidelines for the new API: + + - Each HTTP request should map to a single call into the runtime api + - Each function of the runtime api will accept a user object + - Each function of the runtime api will return a promise that resolves with data to return or rejects with an error to report ![](images/runtime-api/nr-api-runtime-map-2.png) +The following table shows the simplified runtime api. + +> NOL: this is a work in progress, still need to figure out projects, comms and auth +
-Authentication||| ---------------------------------------------|--------------------------------------------|----------------------------------------------------------|---------------------------------------------------------- -api/auth/index.js|GET /auth/login|Get the active authentication scheme| -api/auth/index.js|POST /auth/token|Exchange credentials for access token| -api/auth/index.js|POST /auth/revoke|Revoke an access token| +|Authentication|||| +|--------------------------------------------|--------------------------------------------|----------------------------------------------------------|----------------------------------------------------------| +|api/auth/index.js|GET /auth/login|Get the active authentication scheme|| +|api/auth/index.js|POST /auth/token|Exchange credentials for access token|| +|api/auth/index.js|POST /auth/revoke|Revoke an access token|| -Runtime API||| ---------------------------------------------|--------------------------------------------|----------------------------------------------------------|---------------------------------------------------------- -api/admin/flows.js|GET /flows|Get the active flow configuration|runtime.flows.getFlows -api/admin/flows.js|POST /flows|Set the active flow configuration|runtime.flows.setFlows -api/admin/flow.js|POST /flow|Add a flow to the active configuration|runtime.flows.addFlow -api/admin/flow.js|GET /flow/:id|Get an individual flow configuration|runtime.flows.getFlow -api/admin/flow.js|PUT /flow/:id|Update an individual flow configuration|runtime.flows.updateFlow -api/admin/flow.js|DELETE /flow/:id|Delete an individual flow configuration|runtime.flows.deleteFlow -api/admin/nodes.js|GET /nodes|Get a list of the installed nodes|runtime.nodes.getModuleList -api/admin/nodes.js|POST /nodes|Install a new node module|runtime.nodes.addModule -api/admin/nodes.js|GET /nodes/:module|Get a node module_s information|runtime.nodes.getModule -api/admin/nodes.js|PUT /nodes/:module|Enable/Disable a node module|runtime.nodes.enableModule / runtime.nodes.disableModule -api/admin/nodes.js|DELETE /nodes/:module|Remove a node module|runtime.nodes.removeModule -api/admin/nodes.js|GET /nodes/:module/:set|Get a node module set information|runtime.nodes.getNodeSet -api/admin/nodes.js|PUT /nodes/:module/:set|Enable/Disable a node set|runtime.nodes.enableNodeSet / runtime.nodes.disableNodeSet +|Runtime API|||| +|--------------------------------------------|--------------------------------------------|----------------------------------------------------------|----------------------------------------------------------| +|api/admin/flows.js|GET /flows|Get the active flow configuration|runtime.flows.getFlows| +|api/admin/flows.js|POST /flows|Set the active flow configuration|runtime.flows.setFlows| +|api/admin/flow.js|POST /flow|Add a flow to the active configuration|runtime.flows.addFlow| +|api/admin/flow.js|GET /flow/:id|Get an individual flow configuration|runtime.flows.getFlow| +|api/admin/flow.js|PUT /flow/:id|Update an individual flow configuration|runtime.flows.updateFlow| +|api/admin/flow.js|DELETE /flow/:id|Delete an individual flow configuration|runtime.flows.deleteFlow| +|api/admin/nodes.js|GET /nodes|Get a list of the installed nodes|runtime.nodes.getModuleList| +|api/admin/nodes.js|POST /nodes|Install a new node module|runtime.nodes.addModule| +|api/admin/nodes.js|GET /nodes/:module|Get a node module_s information|runtime.nodes.getModule| +|api/admin/nodes.js|PUT /nodes/:module|Enable/Disable a node module|runtime.nodes.enableModule / runtime.nodes.disableModule| +|api/admin/nodes.js|DELETE /nodes/:module|Remove a node module|runtime.nodes.removeModule| +|api/admin/nodes.js|GET /nodes/:module/:set|Get a node module set information|runtime.nodes.getNodeSet| +|api/admin/nodes.js|PUT /nodes/:module/:set|Enable/Disable a node set|runtime.nodes.enableNodeSet / runtime.nodes.disableNodeSet| -Editor API||| ---------------------------------------------|--------------------------------------------|----------------------------------------------------------|---------------------------------------------------------- -api/editor/ui.js|GET /|Get the editor html| -api/editor/ui.js|GET /red/*|Get the main editor js/css/images| -api/editor/ui.js|GET /vendor/*|Get 3rd-party libraries used by the editor| -api/editor/settings.js|GET /settings|Get the runtime settings|runtime.settings.getRuntimeSettings -api/editor/settings.js|GET /settings/user|Get the user-specific settings|runtime.settings.getUserSettings -api/editor/settings.js|POST /settings/user|Set the user-specific settings|runtime.settings.setUserSettings -api/editor/sshkeys.js|GET /settings/user/keys|Get the user_s ssh keys|runtime.settings.getUserKeys -api/editor/sshkeys.js|GET /settings/user/keys/:id|Get a public key|runtime.setting.getUserKey -api/editor/sshkeys.js|POST /settings/user/keys|Generate a new key pair|runtime.settings.generateUserKey -api/editor/sshkeys.js|DELETE /settings/user/keys/:id|Delete a key pair|runtime.settings.removeUserKey -api/editor/credentials.js|GET /credentials/:type/:id|Get credentials for a given node|runtime.flows.getNodeCredentials -api/editor/locales.js|GET /locales/nodes|Get message catalogs for all known nodes|runtime.nodes.getModuleCatalogs -api/editor/locales.js|GET /locales/:module|Get message catalog for a specific node module|runtime.nodes.getModuleCatalog -api/editor/theme.js|GET /theme/*|Get custom resources for the editorTheme| -api/editor/ui.js|GET /icons|Get the list of all available node icons|runtime.nodes.getIconList -api/editor/ui.js|GET /icons/:module/:icon|Get a module-provided node icon|runtime.nodes.getIcon -api/editor/ui.js|GET /icons/:icon|Get a node icon from the core set| +|Editor API|||| +|--------------------------------------------|--------------------------------------------|----------------------------------------------------------|----------------------------------------------------------| +|api/editor/ui.js|GET /|Get the editor html|| +|api/editor/ui.js|GET /red/*|Get the main editor js/css/images|| +|api/editor/ui.js|GET /vendor/*|Get 3rd-party libraries used by the editor|| +|api/editor/settings.js|GET /settings|Get the runtime settings|runtime.settings.getRuntimeSettings| +|api/editor/settings.js|GET /settings/user|Get the user-specific settings|runtime.settings.getUserSettings| +|api/editor/settings.js|POST /settings/user|Set the user-specific settings|runtime.settings.setUserSettings| +|api/editor/sshkeys.js|GET /settings/user/keys|Get the user_s ssh keys|runtime.settings.getUserKeys| +|api/editor/sshkeys.js|GET /settings/user/keys/:id|Get a public key|runtime.setting.getUserKey| +|api/editor/sshkeys.js|POST /settings/user/keys|Generate a new key pair|runtime.settings.generateUserKey| +|api/editor/sshkeys.js|DELETE /settings/user/keys/:id|Delete a key pair|runtime.settings.removeUserKey| +|api/editor/credentials.js|GET /credentials/:type/:id|Get credentials for a given node|runtime.flows.getNodeCredentials| +|api/editor/locales.js|GET /locales/nodes|Get message catalogs for all known nodes|runtime.nodes.getModuleCatalogs| +|api/editor/locales.js|GET /locales/:module|Get message catalog for a specific node module|runtime.nodes.getModuleCatalog| +|api/editor/theme.js|GET /theme/*|Get custom resources for the editorTheme|| +|api/editor/ui.js|GET /icons|Get the list of all available node icons|runtime.nodes.getIconList| +|api/editor/ui.js|GET /icons/:module/:icon|Get a module-provided node icon|runtime.nodes.getIcon| +|api/editor/ui.js|GET /icons/:icon|Get a node icon from the core set|| -Library API||| ---------------------------------------------|--------------------------------------------|----------------------------------------------------------|---------------------------------------------------------- -api/editor/library.js|POST /library/flows/*||runtime.library.setEnty -api/editor/library.js|GET /library/flows/*||runtime.library.getEntry -api/editor/library.js|GET /library/flows||runtime.library.getEntries -api/editor/library.js|GET /library/:type/*|| -api/editor/library.js|POST /library/:type/*|| +|Library API|||| +|--------------------------------------------|--------------------------------------------|----------------------------------------------------------|----------------------------------------------------------| +|api/editor/library.js|POST /library/flows/*||runtime.library.setEntry| +|api/editor/library.js|GET /library/flows/*||runtime.library.getEntry| +|api/editor/library.js|GET /library/flows||runtime.library.getEntries| +|api/editor/library.js|GET /library/:type/*||| +|api/editor/library.js|POST /library/:type/*||| -Projects API||| ---------------------------------------------|--------------------------------------------|----------------------------------------------------------|---------------------------------------------------------- -api/editor/projects/index.js|GET /projects|List all projects|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects|Create project|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id|Get project metadata|runtime.storage.projects.* -api/editor/projects/index.js|PUT /projects/:id|Update a project|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id|Delete project|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/status|"Get project status - files| commit counts| branch info"|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/files|Project file listing|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/files/:treeish/*|Get file content in a given tree (index/stage)|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/files/_/*|Revert a file (delete from the stage tree)|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/stage/*|Stage a file|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/stage|Stage multiple files|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/commit|Commit changes|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/stage/*|Unstage a file|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/stage|Unstage multiple files|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/diff/:type/*|Get a file diff|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/commits|Get a list of commits|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/commits/:sha|Get an individual commit details|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/push/?*|Push local commits to remote|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/pull/?*|Pull remote commits|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/merge|Abort an ongoing merge|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/resolve/*|Resolve a merge|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/branches|Get a list of local branches|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/branches/:branchName|Delete a local branch - ?force=true|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/branches/remote|Get a list of remote branches|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/branches/remote/*/status|Get branch status - commit counts/ahead/behind|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/branches|Set the active local branch|runtime.storage.projects.* -api/editor/projects/index.js|GET /projects/:id/remotes|Get a list of remotes|runtime.storage.projects.* -api/editor/projects/index.js|POST /projects/:id/remotes|Add a remote|runtime.storage.projects.* -api/editor/projects/index.js|DELETE /projects/:id/remotes/:remoteName|Delete a remote|runtime.storage.projects.* -api/editor/projects/index.js|PUT /projects/:id/remotes/:remoteName|Update a remote|runtime.storage.projects.* +|Projects API|||| +|--------------------------------------------|--------------------------------------------|----------------------------------------------------------|----------------------------------------------------------| +|api/editor/projects/index.js|GET /projects|List all projects|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects|Create project|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id|Get project metadata|runtime.storage.projects.*| +|api/editor/projects/index.js|PUT /projects/:id|Update a project|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id|Delete project|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/status|"Get project status - files| commit counts| branch info"|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/files|Project file listing|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/files/:treeish/*|Get file content in a given tree (index/stage)|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/files/_/*|Revert a file (delete from the stage tree)|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/stage/*|Stage a file|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/stage|Stage multiple files|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/commit|Commit changes|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/stage/*|Unstage a file|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/stage|Unstage multiple files|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/diff/:type/*|Get a file diff|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/commits|Get a list of commits|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/commits/:sha|Get an individual commit details|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/push/?*|Push local commits to remote|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/pull/?*|Pull remote commits|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/merge|Abort an ongoing merge|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/resolve/*|Resolve a merge|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/branches|Get a list of local branches|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/branches/:branchName|Delete a local branch - ?force=true|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/branches/remote|Get a list of remote branches|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/branches/remote/*/status|Get branch status - commit counts/ahead/behind|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/branches|Set the active local branch|runtime.storage.projects.*| +|api/editor/projects/index.js|GET /projects/:id/remotes|Get a list of remotes|runtime.storage.projects.*| +|api/editor/projects/index.js|POST /projects/:id/remotes|Add a remote|runtime.storage.projects.*| +|api/editor/projects/index.js|DELETE /projects/:id/remotes/:remoteName|Delete a remote|runtime.storage.projects.*| +|api/editor/projects/index.js|PUT /projects/:id/remotes/:remoteName|Update a remote|runtime.storage.projects.*
\ No newline at end of file