diff --git a/LICENSE b/LICENSE index 13a5b6e..8995c8b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Lume Web +Copyright (c) 2022 Hammer Technologies LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json new file mode 100644 index 0000000..ae191dd --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "@lumeweb/relay-plugins-core", + "type": "module", + "version": "0.1.0", + "devDependencies": { + "@lumeweb/relay": "https://github.com/LumeWeb/relay.git" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..bd54834 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,28 @@ +import type {Plugin, PluginAPI} from "@lumeweb/relay"; +import {RPCResponse} from "@lumeweb/relay"; + +const plugin: Plugin = { + name: "core", + async plugin(api: PluginAPI): Promise { + api.registerMethod("ping", { + cacheable: false, + handler: async (): Promise => { + return { + data: "pong" + } + } + }) + + api.registerMethod("ping", { + cacheable: false, + handler: async (): Promise => { + return { + data: api.getMethods() + } + } + }) + } + +} + +export default plugin; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e9191d7 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "commonjs", + "moduleResolution": "node", + "rootDir": "src", + "outDir": "dist", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true + } +}