Remove client example

This commit is contained in:
Alec Thilenius 2023-04-29 10:04:47 -07:00
parent 4c84deddc9
commit 32313e83b5
11 changed files with 0 additions and 1499 deletions

View file

@ -1,123 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
# Firebase cache
.firebase/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Build and dist directories
build
dist
dist_tmp
# Parcel caches
.cache
# Rust Stuff
target
# OSX Crap
.DS_Store
.parcel-cache
.next
# Test coverage output
/coverage/
# Docusaurus
.docusaurus
.cache-loader
/web/build
### C++ ###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Yarn 2+
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

View file

@ -1 +0,0 @@
@buf:registry=https://buf.build/gen/npm/v1

View file

@ -1,3 +0,0 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}

View file

@ -1,8 +0,0 @@
version: v1
plugins:
- plugin: es
out: gen
opt: target=ts
- plugin: connect-es
out: gen
opt: target=ts

View file

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="theme-color" content="#001529" />
<title>Axum Connect Example Client</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
background: #1e1e1e;
color: #ffffff;
margin: 0;
}
</style>
</head>
<body>
<span id="root">
<div>Loading</div>
</span>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -1,34 +0,0 @@
{
"name": "axum-connect-examples-client",
"version": "1.0.0",
"description": "An example React client to demo end-to-end RPC calls",
"main": "index.js",
"repository": "https://github.com/AThilenius/axum-connect",
"author": "Alec Thilenius",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "tsc --noEmit && yarn vite build",
"preview": "vite preview"
},
"dependencies": {
"@buf/bufbuild_eliza.bufbuild_connect-es": "^0.8.4-20221224180530-f3801d450ef9.1",
"@bufbuild/connect": "^0.8.4",
"@bufbuild/connect-web": "^0.8.4",
"@bufbuild/protobuf": "^1.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@bufbuild/buf": "^1.15.0-1",
"@bufbuild/protoc-gen-connect-es": "^0.8.4",
"@bufbuild/protoc-gen-es": "^1.2.0",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"prettier": "^2.8.7",
"tslib": "^2.5.0",
"typescript": "^5.0.2",
"vite": "^4.2.1"
}
}

View file

@ -1,71 +0,0 @@
import React, { useEffect, useState } from "react";
import { createPromiseClient } from "@bufbuild/connect";
import { createConnectTransport } from "@bufbuild/connect-web";
import { ElizaService } from "@buf/bufbuild_eliza.bufbuild_connect-es/buf/connect/demo/eliza/v1/eliza_connect";
const transport = createConnectTransport({
baseUrl: "https://demo.connect.build",
});
const client = createPromiseClient(ElizaService, transport);
export const App: React.FC = () => {
useEffect(() => {
(async () => {
for await (const message of client.introduce({})) {
console.log(message);
}
})();
}, []);
const [inputValue, setInputValue] = useState("");
const [messages, setMessages] = useState<
{
fromMe: boolean;
message: string;
}[]
>([]);
return (
<>
<ol>
{messages.map((msg, index) => (
<li key={index}>
{`${msg.fromMe ? "ME:" : "ELIZA:"} ${msg.message}`}
</li>
))}
</ol>
<form
onSubmit={async (e) => {
e.preventDefault();
// Clear inputValue since the user has submitted.
setInputValue("");
// Store the inputValue in the chain of messages and
// mark this message as coming from "me"
setMessages((prev) => [
...prev,
{
fromMe: true,
message: inputValue,
},
]);
const response = await client.say({
sentence: inputValue,
});
setMessages((prev) => [
...prev,
{
fromMe: false,
message: response.sentence,
},
]);
}}
>
<input
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
/>
<button type="submit">Send</button>
</form>
</>
);
};

View file

@ -1,9 +0,0 @@
import { createRoot } from "react-dom/client";
import { App } from "~/app";
async function main() {
const root = createRoot(document.getElementById("root")!);
root.render(<App />);
}
main();

View file

@ -1,36 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"baseUrl": ".",
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext", "webworker"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"paths": { "~/*": ["src/*"] },
"removeComments": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"target": "es6",
"useDefineForClassFields": true
},
"include": ["src/**/*"],
"exclude": ["node_modules/**/*"]
}

View file

@ -1,13 +0,0 @@
import { defineConfig } from "vite";
import { resolve } from "path";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"~": resolve(__dirname, "./src"),
},
},
});