Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial usage of the typescript-sdk #4762

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ jobs:
cache: 'npm'
cache-dependency-path: 'ui/**/package-lock.json'

- name: Build and verify the typescript-sdk
working-directory: typescript-sdk
run: |
npm install
npm run generate-registry-sdk
npm run lint
npm run build

- name: Install UI Dependencies
run: |
cd ui
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Build and verify the typescript-sdk
working-directory: typescript-sdk
run: |
npm install
npm run generate-registry-sdk
npm run lint
npm run build

- name: Install Dependencies
run: |
cd ui
Expand Down
20 changes: 20 additions & 0 deletions typescript-sdk/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"@apicurio"
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-hooks/exhaustive-deps": [ "off" ],
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
}
4 changes: 4 additions & 0 deletions typescript-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.kiota
src-generated
13 changes: 13 additions & 0 deletions typescript-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Apicurio Registry Typescript SDK
This library provides an SDK for Apicurio Registry for use in Node.js and front-end (UI)
applications. It is written in Typescript using Kiota to generate the REST client.

## Building
Use standard Node/NPM tooling to build the code in this library.

```
npm install
npm run generate-registry-sdk
npm run lint
npm run build
```
12 changes: 12 additions & 0 deletions typescript-sdk/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Apicurio Registry Typescript SDK</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions typescript-sdk/lib/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./sdk";
17 changes: 17 additions & 0 deletions typescript-sdk/lib/sdk/factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
ApicurioRegistryClient,
createApicurioRegistryClient
} from "../../src-generated/registry-client/apicurioRegistryClient.ts";
import { AnonymousAuthenticationProvider, AuthenticationProvider, RequestAdapter } from "@microsoft/kiota-abstractions";
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";

export class RegistryClientFactory {

public static createRegistryClient(baseUrl: string): ApicurioRegistryClient {
const authProvider: AuthenticationProvider = new AnonymousAuthenticationProvider();
const requestAdapter: RequestAdapter = new FetchRequestAdapter(authProvider);
requestAdapter.baseUrl = baseUrl;
return createApicurioRegistryClient(requestAdapter);
}

}
1 change: 1 addition & 0 deletions typescript-sdk/lib/sdk/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./factory";
1 change: 1 addition & 0 deletions typescript-sdk/lib/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
Loading
Loading