Skip to content

Commit

Permalink
Merge pull request #99 from midday-ai/release-please--branches--main-…
Browse files Browse the repository at this point in the history
…-changes--next--components--engine

release: 0.1.0-alpha.23
  • Loading branch information
pontusab authored Oct 7, 2024
2 parents e3b2ee3 + 551ad82 commit 21f9c39
Show file tree
Hide file tree
Showing 24 changed files with 305 additions and 86 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,30 @@ jobs:
with:
node-version: '18'

- name: Install dependencies
run: yarn install
- name: Bootstrap
run: ./scripts/bootstrap

- name: Check types
run: ./scripts/lint

build:
name: build
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Bootstrap
run: ./scripts/bootstrap

- name: Check build
run: ./scripts/build
test:
name: test
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.MIDDAY_NPM_TOKEN || secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.22"
".": "0.1.0-alpha.23"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 13
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/midday%2Fmidday-6971ae58e4c74321bff6eb92e399bb01bed09a4e4445bb6eef5941e14908625f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/midday%2Fmidday-8189c00a2b211a7ee12ec84f3104cf7cd3e8d45b490100748937593453e95ff8.yml
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 0.1.0-alpha.23 (2024-10-07)

Full Changelog: [v0.1.0-alpha.22...v0.1.0-alpha.23](https://github.com/midday-ai/engine-sdk/compare/v0.1.0-alpha.22...v0.1.0-alpha.23)

### Features

* **api:** manual updates ([#98](https://github.com/midday-ai/engine-sdk/issues/98)) ([5ade01c](https://github.com/midday-ai/engine-sdk/commit/5ade01c5ab739d2748ab43fb8fe52c16b2b6d881))
* **api:** OpenAPI spec update via Stainless API ([#92](https://github.com/midday-ai/engine-sdk/issues/92)) ([711a167](https://github.com/midday-ai/engine-sdk/commit/711a167d960fced6fc634b22387b24f575e7c875))
* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/midday-ai/engine-sdk/issues/94)) ([649573d](https://github.com/midday-ai/engine-sdk/commit/649573d69395adb9ba219b25ca6cb036a41d99cd))
* **api:** OpenAPI spec update via Stainless API ([#95](https://github.com/midday-ai/engine-sdk/issues/95)) ([8d5bb5b](https://github.com/midday-ai/engine-sdk/commit/8d5bb5ba774c26fc23873171b610b694c5aa3957))


### Chores

* **internal:** codegen related update ([#96](https://github.com/midday-ai/engine-sdk/issues/96)) ([e808cea](https://github.com/midday-ai/engine-sdk/commit/e808cea87cacab7c102c7c69a7da4b78c039a2f2))
* **internal:** codegen related update ([#97](https://github.com/midday-ai/engine-sdk/issues/97)) ([a1ecda9](https://github.com/midday-ai/engine-sdk/commit/a1ecda9f4bbc32c96064f2a97aae614b0a458187))

## 0.1.0-alpha.22 (2024-08-03)

Full Changelog: [v0.1.0-alpha.21...v0.1.0-alpha.22](https://github.com/midday-ai/engine-sdk/compare/v0.1.0-alpha.21...v0.1.0-alpha.22)
Expand Down
54 changes: 27 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ Other package managers may work but are not officially supported for development

To set up the repository, run:

```bash
yarn
yarn build
```sh
$ yarn
$ yarn build
```

This will install all the required dependencies and build output files to `dist/`.

## Modifying/Adding code

Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
`src/lib/` and `examples/` directories are exceptions and will never be overridden.
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
result in merge conflicts between manual patches and changes from the generator. The generator will never
modify the contents of the `src/lib/` and `examples/` directories.

## Adding and running examples

All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
added to.
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```bash
```ts
// add an example to examples/<your-example>.ts

#!/usr/bin/env -S npm run tsn -T
Expand All @@ -41,38 +41,38 @@ If you’d like to use the repository from source, you can either install from g

To install via git:

```bash
npm install git+ssh://[email protected]:midday-ai/engine-sdk.git
```sh
$ npm install git+ssh://[email protected]:midday-ai/engine-sdk.git
```

Alternatively, to link a local copy of the repo:

```bash
```sh
# Clone
git clone https://www.github.com/midday-ai/engine-sdk
cd engine-sdk
$ git clone https://www.github.com/midday-ai/engine-sdk
$ cd engine-sdk

# With yarn
yarn link
cd ../my-package
yarn link @midday-ai/engine
$ yarn link
$ cd ../my-package
$ yarn link @midday-ai/engine

# With pnpm
pnpm link --global
cd ../my-package
pnpm link -—global @midday-ai/engine
$ pnpm link --global
$ cd ../my-package
$ pnpm link -—global @midday-ai/engine
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
npx prism mock path/to/your/openapi.yml
```sh
$ npx prism mock path/to/your/openapi.yml
```

```bash
yarn run test
```sh
$ yarn run test
```

## Linting and formatting
Expand All @@ -82,14 +82,14 @@ This repository uses [prettier](https://www.npmjs.com/package/prettier) and

To lint:

```bash
yarn lint
```sh
$ yarn lint
```

To format and fix all lint issues automatically:

```bash
yarn fix
```sh
$ yarn fix
```

## Publishing and releases
Expand Down
75 changes: 57 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ const client = new Midday({
});

async function main() {
const health: Midday.Health = await client.health.retrieve();
const params: Midday.TransactionListParams = {
accountId: '5341343-4234-4c65-815c-t234213442',
accountType: 'credit',
provider: 'teller',
accessToken: 'token-123',
};
const transactions: Midday.Transactions = await client.transactions.list(params);
}

main();
Expand All @@ -70,15 +76,22 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const health = await client.health.retrieve().catch(async (err) => {
if (err instanceof Midday.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
const transactions = await client.transactions
.list({
accountId: '5341343-4234-4c65-815c-t234213442',
accountType: 'credit',
provider: 'teller',
accessToken: 'token-123',
})
.catch(async (err) => {
if (err instanceof Midday.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
Expand Down Expand Up @@ -113,7 +126,7 @@ const client = new Midday({
});

// Or, configure per-request:
await client.health.retrieve({
await client.transactions.list({ accountId: '5341343-4234-4c65-815c-t234213442', accountType: 'credit', provider: 'teller', accessToken: 'token-123' }, {
maxRetries: 5,
});
```
Expand All @@ -130,7 +143,7 @@ const client = new Midday({
});

// Override per-request:
await client.health.retrieve({
await client.transactions.list({ accountId: '5341343-4234-4c65-815c-t234213442', accountType: 'credit', provider: 'teller', accessToken: 'token-123' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -151,13 +164,27 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Midday();

const response = await client.health.retrieve().asResponse();
const response = await client.transactions
.list({
accountId: '5341343-4234-4c65-815c-t234213442',
accountType: 'credit',
provider: 'teller',
accessToken: 'token-123',
})
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: health, response: raw } = await client.health.retrieve().withResponse();
const { data: transactions, response: raw } = await client.transactions
.list({
accountId: '5341343-4234-4c65-815c-t234213442',
accountType: 'credit',
provider: 'teller',
accessToken: 'token-123',
})
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(health.data);
console.log(transactions.data);
```

### Making custom/undocumented requests
Expand Down Expand Up @@ -261,9 +288,17 @@ const client = new Midday({
});

// Override per-request:
await client.health.retrieve({
httpAgent: new http.Agent({ keepAlive: false }),
});
await client.transactions.list(
{
accountId: '5341343-4234-4c65-815c-t234213442',
accountType: 'credit',
provider: 'teller',
accessToken: 'token-123',
},
{
httpAgent: new http.Agent({ keepAlive: false }),
},
);
```

## Semantic versioning
Expand All @@ -287,3 +322,7 @@ The following runtimes are supported:
Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue on GitHub.

## Contributing

See [the contributing documentation](./CONTRIBUTING.md).
1 change: 1 addition & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
fi

echo "The environment is ready to push releases!"

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@midday-ai/engine",
"version": "0.1.0-alpha.22",
"version": "0.1.0-alpha.23",
"description": "The official TypeScript library for the Midday API",
"author": "Midday <[email protected]>",
"types": "dist/index.d.ts",
Expand All @@ -21,7 +21,7 @@
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
"fix": "eslint --fix --ext ts,js ."
"fix": "./scripts/format"
},
"dependencies": {
"@types/node": "^18.11.18",
Expand All @@ -41,6 +41,7 @@
"eslint": "^8.49.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"iconv-lite": "^0.6.3",
"jest": "^29.4.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
cd "$(dirname "$0")/.."

echo "==> Running eslint --fix"
./node_modules/.bin/eslint --fix --ext ts,js .
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js .
5 changes: 4 additions & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ set -e
cd "$(dirname "$0")/.."

echo "==> Running eslint"
./node_modules/.bin/eslint --ext ts,js .
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js .

echo "==> Running tsc"
./node_modules/.bin/tsc --noEmit
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
Expand All @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL"
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL"
fi
2 changes: 1 addition & 1 deletion src/_shims/node-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
export { type Agent } from 'node:http';
export { type Readable } from 'node:stream';
export { type ReadStream as FsReadStream } from 'node:fs';
export { ReadableStream } from 'web-streams-polyfill';
export { ReadableStream } from 'node:stream/web';

export const fetch: typeof nf.default;

Expand Down
Loading

0 comments on commit 21f9c39

Please sign in to comment.