-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stainless Bot
committed
Oct 29, 2024
1 parent
7dc67e7
commit cb159c9
Showing
37 changed files
with
225 additions
and
208 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is used to automatically assign reviewers to PRs | ||
# For more information see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners | ||
|
||
* @maestro-org/Typescript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g | |
To install via git: | ||
|
||
```sh | ||
$ npm install git+ssh://[email protected]:stainless-sdks/maestro-arch-rpc-node.git | ||
$ npm install git+ssh://[email protected]:maestro-org/maestro-arch-rpc-node-sdk.git | ||
``` | ||
|
||
Alternatively, to link a local copy of the repo: | ||
|
||
```sh | ||
# Clone | ||
$ git clone https://www.github.com/stainless-sdks/maestro-arch-rpc-node | ||
$ cd maestro-arch-rpc-node | ||
$ git clone https://www.github.com/maestro-org/maestro-arch-rpc-node-sdk | ||
$ cd maestro-arch-rpc-node-sdk | ||
|
||
# With yarn | ||
$ yarn link | ||
$ cd ../my-package | ||
$ yarn link maestro-arch-rpc | ||
$ yarn link @maestro-org/maestro-arch-rpc-node-sdk | ||
|
||
# With pnpm | ||
$ pnpm link --global | ||
$ cd ../my-package | ||
$ pnpm link -—global maestro-arch-rpc | ||
$ pnpm link -—global @maestro-org/maestro-arch-rpc-node-sdk | ||
``` | ||
|
||
## Running tests | ||
|
@@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel | |
|
||
### Publish with a GitHub workflow | ||
|
||
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/stainless-sdks/maestro-arch-rpc-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. | ||
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/maestro-org/maestro-arch-rpc-node-sdk/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. | ||
|
||
### Publish manually | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
# Maestro Arch Rpc Node API Library | ||
# Maestro Node API Library | ||
|
||
[![NPM version](https://img.shields.io/npm/v/maestro-arch-rpc.svg)](https://npmjs.org/package/maestro-arch-rpc) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/maestro-arch-rpc) | ||
[![NPM version](https://img.shields.io/npm/v/@maestro-org/maestro-arch-rpc-node-sdk.svg)](https://npmjs.org/package/@maestro-org/maestro-arch-rpc-node-sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@maestro-org/maestro-arch-rpc-node-sdk) | ||
|
||
This library provides convenient access to the Maestro Arch Rpc REST API from server-side TypeScript or JavaScript. | ||
This library provides convenient access to the Maestro REST API from server-side TypeScript or JavaScript. | ||
|
||
The REST API documentation can be found on [docs.maestro-arch-rpc.com](https://docs.maestro-arch-rpc.com). The full API of this library can be found in [api.md](api.md). | ||
The REST API documentation can be found on [docs.gomaestro.org](https://docs.gomaestro.org/). The full API of this library can be found in [api.md](api.md). | ||
|
||
It is generated with [Stainless](https://www.stainlessapi.com/). | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install git+ssh://[email protected]:stainless-sdks/maestro-arch-rpc-node.git | ||
npm install @maestro-org/maestro-arch-rpc-node-sdk | ||
``` | ||
|
||
> [!NOTE] | ||
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install maestro-arch-rpc` | ||
## Usage | ||
|
||
The full API of this library can be found in [api.md](api.md). | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
import MaestroArchRpc from 'maestro-arch-rpc'; | ||
import Maestro from '@maestro-org/maestro-arch-rpc-node-sdk'; | ||
|
||
const client = new MaestroArchRpc(); | ||
const client = new Maestro(); | ||
|
||
async function main() { | ||
const response = await client.accounts.address([0, 0, 0]); | ||
|
@@ -42,13 +39,13 @@ This library includes TypeScript definitions for all request params and response | |
|
||
<!-- prettier-ignore --> | ||
```ts | ||
import MaestroArchRpc from 'maestro-arch-rpc'; | ||
import Maestro from '@maestro-org/maestro-arch-rpc-node-sdk'; | ||
|
||
const client = new MaestroArchRpc(); | ||
const client = new Maestro(); | ||
|
||
async function main() { | ||
const params: MaestroArchRpc.AccountAddressParams = [0, 0, 0]; | ||
const response: MaestroArchRpc.AccountAddressResponse = await client.accounts.address(params); | ||
const params: Maestro.AccountAddressParams = [0, 0, 0]; | ||
const response: Maestro.AccountAddressResponse = await client.accounts.address(params); | ||
} | ||
|
||
main(); | ||
|
@@ -66,7 +63,7 @@ a subclass of `APIError` will be thrown: | |
```ts | ||
async function main() { | ||
const response = await client.accounts.address([0, 0, 0]).catch(async (err) => { | ||
if (err instanceof MaestroArchRpc.APIError) { | ||
if (err instanceof Maestro.APIError) { | ||
console.log(err.status); // 400 | ||
console.log(err.name); // BadRequestError | ||
console.log(err.headers); // {server: 'nginx', ...} | ||
|
@@ -103,7 +100,7 @@ You can use the `maxRetries` option to configure or disable this: | |
<!-- prettier-ignore --> | ||
```js | ||
// Configure the default for all requests: | ||
const client = new MaestroArchRpc({ | ||
const client = new Maestro({ | ||
maxRetries: 0, // default is 2 | ||
}); | ||
|
||
|
@@ -120,7 +117,7 @@ Requests time out after 1 minute by default. You can configure this with a `time | |
<!-- prettier-ignore --> | ||
```ts | ||
// Configure the default for all requests: | ||
const client = new MaestroArchRpc({ | ||
const client = new Maestro({ | ||
timeout: 20 * 1000, // 20 seconds (default is 1 minute) | ||
}); | ||
|
||
|
@@ -144,7 +141,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi | |
|
||
<!-- prettier-ignore --> | ||
```ts | ||
const client = new MaestroArchRpc(); | ||
const client = new Maestro(); | ||
|
||
const response = await client.accounts.address([0, 0, 0]).asResponse(); | ||
console.log(response.headers.get('X-My-Header')); | ||
|
@@ -205,17 +202,17 @@ By default, this library uses `node-fetch` in Node, and expects a global `fetch` | |
|
||
If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment, | ||
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`), | ||
add the following import before your first import `from "MaestroArchRpc"`: | ||
add the following import before your first import `from "Maestro"`: | ||
|
||
```ts | ||
// Tell TypeScript and the package to use the global web fetch instead of node-fetch. | ||
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed. | ||
import 'maestro-arch-rpc/shims/web'; | ||
import MaestroArchRpc from 'maestro-arch-rpc'; | ||
import '@maestro-org/maestro-arch-rpc-node-sdk/shims/web'; | ||
import Maestro from '@maestro-org/maestro-arch-rpc-node-sdk'; | ||
``` | ||
|
||
To do the inverse, add `import "maestro-arch-rpc/shims/node"` (which does import polyfills). | ||
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/stainless-sdks/maestro-arch-rpc-node/tree/main/src/_shims#readme)). | ||
To do the inverse, add `import "@maestro-org/maestro-arch-rpc-node-sdk/shims/node"` (which does import polyfills). | ||
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/maestro-org/maestro-arch-rpc-node-sdk/tree/main/src/_shims#readme)). | ||
|
||
### Logging and middleware | ||
|
||
|
@@ -224,9 +221,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e | |
|
||
```ts | ||
import { fetch } from 'undici'; // as one example | ||
import MaestroArchRpc from 'maestro-arch-rpc'; | ||
import Maestro from '@maestro-org/maestro-arch-rpc-node-sdk'; | ||
|
||
const client = new MaestroArchRpc({ | ||
const client = new Maestro({ | ||
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => { | ||
console.log('About to make a request', url, init); | ||
const response = await fetch(url, init); | ||
|
@@ -251,7 +248,7 @@ import http from 'http'; | |
import { HttpsProxyAgent } from 'https-proxy-agent'; | ||
|
||
// Configure the default for all requests: | ||
const client = new MaestroArchRpc({ | ||
const client = new Maestro({ | ||
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), | ||
}); | ||
|
||
|
@@ -271,7 +268,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con | |
|
||
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. | ||
|
||
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/maestro-arch-rpc-node/issues) with questions, bugs, or suggestions. | ||
We are keen for your feedback; please open an [issue](https://www.github.com/maestro-org/maestro-arch-rpc-node-sdk/issues) with questions, bugs, or suggestions. | ||
|
||
## Requirements | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "maestro-arch-rpc", | ||
"name": "@maestro-org/maestro-arch-rpc-node-sdk", | ||
"version": "0.1.0-alpha.1", | ||
"description": "The official TypeScript library for the Maestro Arch Rpc API", | ||
"author": "Maestro Arch Rpc <support@gomaestro.org>", | ||
"description": "The official TypeScript library for the Maestro API", | ||
"author": "Maestro <info@gomaestro.org>", | ||
"types": "dist/index.d.ts", | ||
"main": "dist/index.js", | ||
"type": "commonjs", | ||
"repository": "github:stainless-sdks/maestro-arch-rpc-node", | ||
"repository": "github:maestro-org/maestro-arch-rpc-node-sdk", | ||
"license": "Apache-2.0", | ||
"packageManager": "[email protected]", | ||
"files": [ | ||
|
@@ -60,8 +60,8 @@ | |
"./shims/web.mjs" | ||
], | ||
"imports": { | ||
"maestro-arch-rpc": ".", | ||
"maestro-arch-rpc/*": "./src/*" | ||
"@maestro-org/maestro-arch-rpc-node-sdk": ".", | ||
"@maestro-org/maestro-arch-rpc-node-sdk/*": "./src/*" | ||
}, | ||
"exports": { | ||
"./_shims/auto/*": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.