From 7a13fcee410a1ee38d900d2c81a50b5603e14153 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 26 Aug 2022 22:43:23 -0400 Subject: [PATCH] *Initial version --- LICENSE | 2 +- package.json | 8 ++++++++ src/index.ts | 28 ++++++++++++++++++++++++++++ tsconfig.json | 14 ++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json 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 + } +}