diff --git a/src/action/ActionOptions.ts b/src/action/ActionOptions.ts deleted file mode 100644 index 6438e12e..00000000 --- a/src/action/ActionOptions.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface ActionOptions { - json: string - neo4jUri: string - neo4jUser: string - neo4jPassword: string -} \ No newline at end of file diff --git a/src/action/getOptions.ts b/src/action/getOptions.ts deleted file mode 100644 index 76cfdf7e..00000000 --- a/src/action/getOptions.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as core from '@actions/core'; - -import { ActionOptions } from './ActionOptions' - -const getOptions = (): ActionOptions => { - return { - json: core.getInput("json"), - // from .env - neo4jUri: core.getInput("neo4j-uri"), - // neo4j-uri: ${{ secrets.NEO4J_URI }} - neo4jUser: core.getInput("neo4j-user"), - // neo4j-user: ${{ secrets.NEO4J_USERNAME }} - neo4jPassword: core.getInput("neo4j-password"), - // neo4j-password: ${{ secrets.NEO4J_PASSWORD }} - - }; -}; - -export default getOptions; \ No newline at end of file diff --git a/src/action/operationSwitch.ts b/src/action/operationSwitch.ts deleted file mode 100644 index 1c45b567..00000000 --- a/src/action/operationSwitch.ts +++ /dev/null @@ -1,12 +0,0 @@ -import operations from './operations'; - -const operationSwitch = async (options) => { - try{ - return operations(options) - } catch(e){ - console.error(e) - throw new Error('Action does not support the options provided') - } -} - -export default operationSwitch \ No newline at end of file diff --git a/src/action/operations/index.ts b/src/action/operations/index.ts deleted file mode 100644 index 0d0bd31c..00000000 --- a/src/action/operations/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ActionOptions } from '../ActionOptions' - -import * as neo4j from './neo4j' - -const operations = async (options: ActionOptions) => { - if (options.neo4jUri) { - return neo4j.run(options) - } -} - -export default operations \ No newline at end of file diff --git a/src/action/operations/neo4j/index.ts b/src/action/operations/neo4j/index.ts deleted file mode 100644 index 0f0e9e2c..00000000 --- a/src/action/operations/neo4j/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import neo4j from 'neo4j-driver' - -import { ActionOptions } from '../../ActionOptions' - -import jsongraph from '../../../api/rdf/jsongraph' -import cypher from '../../../api/cypher' - -export const run = async (options: ActionOptions) => { - const driver = neo4j.driver( - options.neo4jUri, - neo4j.auth.basic(options.neo4jUser, options.neo4jPassword), - ) - const session = driver.session() - const document = JSON.parse(options.json) - const graph = await jsongraph.fromDocument(document) - const { query, params } = await cypher.fromJsonGraph(graph) - await session.run(query, params) - await session.close() - await driver.close() - return { query, params } -} diff --git a/src/action/run.ts b/src/action/run.ts index 872da245..864a3064 100644 --- a/src/action/run.ts +++ b/src/action/run.ts @@ -1,15 +1,13 @@ #!/usr/bin/env node import * as core from '@actions/core' -import getOpts from './getOptions' -import operationSwitch from './operationSwitch' + import cli from '../cli' async function run() { try { if (process.env.GITHUB_ACTION) { - const opts = getOpts() - await operationSwitch(opts) + console.warn('todo github action') } else { await cli.init() } diff --git a/src/cli/jose/key/diagnose.ts b/src/cli/cose/diagnostic/diagnose.ts similarity index 100% rename from src/cli/jose/key/diagnose.ts rename to src/cli/cose/diagnostic/diagnose.ts diff --git a/src/cli/jose/key/index.ts b/src/cli/cose/diagnostic/index.ts similarity index 100% rename from src/cli/jose/key/index.ts rename to src/cli/cose/diagnostic/index.ts diff --git a/src/cli/jose/index.ts b/src/cli/cose/index.ts similarity index 100% rename from src/cli/jose/index.ts rename to src/cli/cose/index.ts diff --git a/src/cli/jose/module.ts b/src/cli/cose/module.ts similarity index 100% rename from src/cli/jose/module.ts rename to src/cli/cose/module.ts