Skip to content

Commit a98c776

Browse files
PaoloRollojnsdls
authored andcommitted
feat: add @thirdweb-dev/nebula package.
1 parent 997beea commit a98c776

File tree

15 files changed

+5768
-5
lines changed

15 files changed

+5768
-5
lines changed

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@
5555
"build": "turbo run build --filter=./packages/*",
5656
"build:release": "turbo run build --filter=./packages/* --force",
5757
"changeset": "changeset",
58-
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/vault-sdk --filter=./packages/engine",
58+
"dashboard": "turbo run dev --filter=./apps/dashboard --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/vault-sdk --filter=./packages/engine --filter=./packages/nebula",
5959
"dashboard:build": "turbo run build --filter=./apps/dashboard",
6060
"e2e": "turbo run e2e --filter=./packages/*",
6161
"fix": "turbo run fix",
6262
"hotlink-init": "node ./scripts/hotlink/hotlink-init.mjs",
6363
"hotlink-revert": "node ./scripts/hotlink/hotlink-revert.mjs",
6464
"lint": "pnpm dlx sherif@latest -i remark-gfm -i eslint && turbo run lint",
65-
"playground": "turbo run dev --filter=./apps/playground-web --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
65+
"playground": "turbo run dev --filter=./apps/playground-web --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
6666
"playground:build": "turbo run build --filter=./apps/playground-web",
67-
"portal": "turbo run dev --filter=./apps/portal --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
67+
"portal": "turbo run dev --filter=./apps/portal --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
6868
"portal:build": "turbo run build --filter=./apps/portal",
6969
"prefix": "pnpm dlx sherif@latest -i remark-gfm -i eslint --fix",
7070
"preinstall": "npx only-allow pnpm",
@@ -75,8 +75,9 @@
7575
"typedoc": "turbo run typedoc",
7676
"version-packages": "changeset version",
7777
"version-packages:nightly": "node scripts/pre-nightly.mjs && changeset version --snapshot nightly",
78-
"wallet-ui": "turbo run dev --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine",
79-
"wallet-ui:build": "turbo run build --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine"
78+
"wallet-ui": "turbo run dev --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula",
79+
"wallet-ui:build": "turbo run build --filter=./apps/wallet-ui --filter=./packages/thirdweb --filter=./packages/insight --filter=./packages/engine --filter=./packages/nebula"
8080
},
81+
8182
"version": "1.0.0"
8283
}

packages/nebula/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @thirdweb-dev/nebula

packages/nebula/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Nebula OpenAPI TypeScript wrapper
2+
3+
This package is a thin OpenAPI wrapper for Nebula, our AI agent service.
4+
5+
## Configuration
6+
7+
```ts
8+
import { configure } from "@thirdweb-dev/nebula";
9+
10+
// call this once at the startup of your application
11+
configure({
12+
secretKey: "<PROJECT_SECRET_KEY>",
13+
});
14+
```
15+
16+
You can also configure the client with a Thirdweb client instance:
17+
18+
```ts
19+
import { configureWithClient } from "@thirdweb-dev/nebula";
20+
import { twClient } from "./thirdwebClient";
21+
22+
// call this once at the startup of your application
23+
configureWithClient(twClient);
24+
```
25+
26+
## Example Usage
27+
28+
```ts
29+
import { getModels } from "@thirdweb-dev/nebula";
30+
31+
const models = await getModels();
32+
```
33+
34+
You can also use this package on a client application (eg. NextJS) by retrieving the Nebula API client first.
35+
36+
```ts
37+
import { getNebulaClient, getAgents } from "@thirdweb-dev/nebula";
38+
39+
// retrieve the Nebula auth token
40+
const nebulaClient = getNebulaClient(authToken);
41+
42+
// pass the client inside the methods
43+
const agentsResult = await getAgents({ client: nebulaClient });
44+
```
45+
46+
This package was autogenerated from the [Nebula openAPI spec](https://nebula-api.thirdweb.com/docs) using [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts)

packages/nebula/biome.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3+
"extends": "//"
4+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from "@hey-api/openapi-ts";
2+
3+
export default defineConfig({
4+
input: "https://nebula-api.thirdweb-dev.com/openapi.json",
5+
output: { format: "biome", lint: "biome", path: "src/client" },
6+
plugins: ["@hey-api/client-fetch"],
7+
});

packages/nebula/package.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "@thirdweb-dev/nebula",
3+
"version": "1.0.0",
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/thirdweb-dev/js.git#main"
7+
},
8+
"license": "Apache-2.0",
9+
"bugs": {
10+
"url": "https://github.com/thirdweb-dev/js/issues"
11+
},
12+
"author": "thirdweb eng <[email protected]>",
13+
"type": "module",
14+
"main": "./dist/cjs/exports/thirdweb.js",
15+
"module": "./dist/esm/exports/thirdweb.js",
16+
"types": "./dist/types/exports/thirdweb.d.ts",
17+
"typings": "./dist/types/exports/thirdweb.d.ts",
18+
"exports": {
19+
".": {
20+
"types": "./dist/types/exports/thirdweb.d.ts",
21+
"import": "./dist/esm/exports/thirdweb.js",
22+
"default": "./dist/cjs/exports/thirdweb.js"
23+
},
24+
"./package.json": "./package.json"
25+
},
26+
"files": [
27+
"dist/*",
28+
"src/*"
29+
],
30+
"dependencies": {
31+
"@hey-api/client-fetch": "0.10.0",
32+
"thirdweb": "workspace:*"
33+
},
34+
"devDependencies": {
35+
"@hey-api/openapi-ts": "0.72.1",
36+
"rimraf": "6.0.1",
37+
"tslib": "^2.8.1"
38+
},
39+
"peerDependencies": {
40+
"typescript": ">=5.0.4"
41+
},
42+
"peerDependenciesMeta": {
43+
"typescript": {
44+
"optional": true
45+
}
46+
},
47+
"scripts": {
48+
"format": "biome format ./src --write",
49+
"lint": "biome check ./src",
50+
"fix": "biome check ./src --fix",
51+
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
52+
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
53+
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
54+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
55+
"clean": "rimraf dist",
56+
"build:generate": "openapi-ts && pnpm format"
57+
},
58+
"engines": {
59+
"node": ">=18"
60+
}
61+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import {
4+
type Config,
5+
type ClientOptions as DefaultClientOptions,
6+
createClient,
7+
createConfig,
8+
} from "@hey-api/client-fetch";
9+
import type { ClientOptions } from "./types.gen.js";
10+
11+
/**
12+
* The `createClientConfig()` function will be called on client initialization
13+
* and the returned object will become the client's initial configuration.
14+
*
15+
* You may want to initialize your client this way instead of calling
16+
* `setConfig()`. This is useful for example if you're using Next.js
17+
* to ensure your client always has the correct values.
18+
*/
19+
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
20+
(
21+
override?: Config<DefaultClientOptions & T>,
22+
) => Config<Required<DefaultClientOptions> & T>;
23+
24+
export const client = createClient(
25+
createConfig<ClientOptions>({
26+
baseUrl: "https://nebula-api.thirdweb-dev.com",
27+
}),
28+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
export * from "./types.gen.js";
3+
export * from "./sdk.gen.js";

0 commit comments

Comments
 (0)