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

release: 0.1.0-alpha.25 #118

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
23dd10a
feat(internal): make git install file structure match npm (#117)
stainless-app[bot] Nov 28, 2024
cba2e87
feat(api): api update (#119)
stainless-app[bot] Dec 3, 2024
f2e356b
codegen metadata
stainless-bot Dec 3, 2024
ee84913
codegen metadata
stainless-app[bot] Dec 8, 2024
b43312a
codegen metadata
stainless-app[bot] Dec 8, 2024
cc5c5d8
codegen metadata
stainless-app[bot] Dec 8, 2024
b24ee51
codegen metadata
stainless-app[bot] Dec 9, 2024
a448ff6
codegen metadata
stainless-app[bot] Dec 9, 2024
816e9ef
wip (#120)
stainless-app[bot] Dec 10, 2024
3eeaf11
chore(types): nicer error class types + jsdocs (#121)
stainless-app[bot] Dec 11, 2024
f562447
feat(api): api update (#122)
stainless-app[bot] Dec 11, 2024
70d727b
chore(internal): update isAbsoluteURL (#123)
stainless-app[bot] Dec 12, 2024
9a2ebaf
chore(internal): codegen related update (#124)
stainless-app[bot] Dec 19, 2024
3447f7d
chore(internal): codegen related update (#125)
stainless-app[bot] Dec 19, 2024
a440d76
chore(internal): codegen related update (#126)
stainless-app[bot] Dec 19, 2024
1450ab2
chore(internal): codegen related update (#127)
stainless-app[bot] Dec 19, 2024
b691d99
chore(internal): fix some typos (#128)
stainless-app[bot] Dec 19, 2024
bf609ea
fix(client): normalize method (#129)
stainless-app[bot] Dec 20, 2024
3dad50d
chore(internal): codegen related update (#130)
stainless-app[bot] Dec 21, 2024
338b99a
chore(internal): codegen related update (#131)
stainless-app[bot] Jan 2, 2025
83b5664
chore(internal): codegen related update (#132)
stainless-app[bot] Jan 9, 2025
be9565f
chore(internal): change formatting (#133)
stainless-app[bot] Jan 10, 2025
7588036
chore(internal): codegen related update (#134)
stainless-app[bot] Jan 17, 2025
98cf86a
chore(internal): codegen related update (#135)
stainless-app[bot] Jan 21, 2025
b5e0603
feat(api): api update (#136)
stainless-app[bot] Feb 25, 2025
b319761
feat(api): api update (#137)
stainless-app[bot] Feb 25, 2025
c01376f
codegen metadata
stainless-app[bot] Feb 26, 2025
5bfa50a
chore(internal): codegen related update (#138)
stainless-app[bot] Feb 27, 2025
e6ad1e1
codegen metadata
stainless-app[bot] Mar 6, 2025
0dab932
chore(internal): codegen related update (#139)
stainless-app[bot] Mar 7, 2025
a039600
release: 0.1.0-alpha.25
stainless-app[bot] Mar 7, 2025
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
23 changes: 0 additions & 23 deletions .devcontainer/Dockerfile

This file was deleted.

27 changes: 12 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
"name": "Development",
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"postCreateCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
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.24"
".": "0.1.0-alpha.25"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/midday%2Fmidday-bf3c1ab4d60dd56bbe6b8e4e42832474665c53b9fca4b86966f595f766da84b7.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/midday%2Fmidday-3089747a609049d5b0327876a96f911742d6071866bf0952418eb8d06ca7b1b0.yml
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## 0.1.0-alpha.25 (2025-03-07)

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

### Features

* **api:** api update ([#119](https://github.com/midday-ai/engine-sdk/issues/119)) ([cba2e87](https://github.com/midday-ai/engine-sdk/commit/cba2e872ae7b05cbf700b219c8044f1f94586e89))
* **api:** api update ([#122](https://github.com/midday-ai/engine-sdk/issues/122)) ([f562447](https://github.com/midday-ai/engine-sdk/commit/f5624476ce0412dca3e4f9d2adef2b1206c43c90))
* **api:** api update ([#136](https://github.com/midday-ai/engine-sdk/issues/136)) ([b5e0603](https://github.com/midday-ai/engine-sdk/commit/b5e0603fb5d49c3a2cc1c6563a098047c35263ff))
* **api:** api update ([#137](https://github.com/midday-ai/engine-sdk/issues/137)) ([b319761](https://github.com/midday-ai/engine-sdk/commit/b319761df67bbabf572da267deb2067e8e1aa2ea))
* **internal:** make git install file structure match npm ([#117](https://github.com/midday-ai/engine-sdk/issues/117)) ([23dd10a](https://github.com/midday-ai/engine-sdk/commit/23dd10a9c381605b86adb9bb14c2d8afc05cd13d))


### Bug Fixes

* **client:** normalize method ([#129](https://github.com/midday-ai/engine-sdk/issues/129)) ([bf609ea](https://github.com/midday-ai/engine-sdk/commit/bf609ea551fc8fea57cfa5c1d67fb4f56ae24d28))


### Chores

* **internal:** change formatting ([#133](https://github.com/midday-ai/engine-sdk/issues/133)) ([be9565f](https://github.com/midday-ai/engine-sdk/commit/be9565f909dc9f7aad71f0b680bd884d4ddd3cb1))
* **internal:** codegen related update ([#124](https://github.com/midday-ai/engine-sdk/issues/124)) ([9a2ebaf](https://github.com/midday-ai/engine-sdk/commit/9a2ebaf6c7e49eebe1627a7b6bbc0c011374d65e))
* **internal:** codegen related update ([#125](https://github.com/midday-ai/engine-sdk/issues/125)) ([3447f7d](https://github.com/midday-ai/engine-sdk/commit/3447f7db0d7d1d5f61cfa066b7db70c00219d360))
* **internal:** codegen related update ([#126](https://github.com/midday-ai/engine-sdk/issues/126)) ([a440d76](https://github.com/midday-ai/engine-sdk/commit/a440d769d91f3caabe494e5bac3f7a41dbe055a2))
* **internal:** codegen related update ([#127](https://github.com/midday-ai/engine-sdk/issues/127)) ([1450ab2](https://github.com/midday-ai/engine-sdk/commit/1450ab2a25a94b643c420fb7bd459426f9d7c740))
* **internal:** codegen related update ([#130](https://github.com/midday-ai/engine-sdk/issues/130)) ([3dad50d](https://github.com/midday-ai/engine-sdk/commit/3dad50d6caccc8ad1e7e451d714b42de7fae3c2d))
* **internal:** codegen related update ([#131](https://github.com/midday-ai/engine-sdk/issues/131)) ([338b99a](https://github.com/midday-ai/engine-sdk/commit/338b99a0e470c2a496228d8a452687806fc9a390))
* **internal:** codegen related update ([#132](https://github.com/midday-ai/engine-sdk/issues/132)) ([83b5664](https://github.com/midday-ai/engine-sdk/commit/83b5664586e301c937bbcf1c427d753d4c3db90b))
* **internal:** codegen related update ([#134](https://github.com/midday-ai/engine-sdk/issues/134)) ([7588036](https://github.com/midday-ai/engine-sdk/commit/75880363ec3033da306fdcd959ed93b25d11bc63))
* **internal:** codegen related update ([#135](https://github.com/midday-ai/engine-sdk/issues/135)) ([98cf86a](https://github.com/midday-ai/engine-sdk/commit/98cf86a6be37f8958ca2ecabd05dc39b923372d9))
* **internal:** codegen related update ([#138](https://github.com/midday-ai/engine-sdk/issues/138)) ([5bfa50a](https://github.com/midday-ai/engine-sdk/commit/5bfa50adddd2545586cbeceeaabbea0e026004d4))
* **internal:** codegen related update ([#139](https://github.com/midday-ai/engine-sdk/issues/139)) ([0dab932](https://github.com/midday-ai/engine-sdk/commit/0dab9321834cdf4c2c58adda2bca0eed8de50e63))
* **internal:** fix some typos ([#128](https://github.com/midday-ai/engine-sdk/issues/128)) ([b691d99](https://github.com/midday-ai/engine-sdk/commit/b691d99dcacde8f9073e5e87d5ddc12ec15b459d))
* **internal:** update isAbsoluteURL ([#123](https://github.com/midday-ai/engine-sdk/issues/123)) ([70d727b](https://github.com/midday-ai/engine-sdk/commit/70d727b5871aec130f468e98f3481b26cffeef05))
* **types:** nicer error class types + jsdocs ([#121](https://github.com/midday-ai/engine-sdk/issues/121)) ([3eeaf11](https://github.com/midday-ai/engine-sdk/commit/3eeaf11f93ed92a4bb932af21c637e7811f06cb4))

## 0.1.0-alpha.24 (2024-11-23)

Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/midday-ai/engine-sdk/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Setting up the environment

This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
Other package managers may work but are not officially supported for development.

To set up the repository, run:
Expand Down Expand Up @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
```

```
chmod +x examples/<your-example>.ts
```sh
$ chmod +x examples/<your-example>.ts
# run the example against your api
yarn tsn -T examples/<your-example>.ts
$ yarn tsn -T examples/<your-example>.ts
```

## Using the repository from source
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Midday
Copyright 2025 Midday

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This library provides convenient access to the Midday REST API from server-side

The REST API documentation can be found on [docs.midday.ai](https://docs.midday.ai). The full API of this library can be found in [api.md](api.md).

It is generated with [Stainless](https://www.stainlessapi.com/).
It is generated with [Stainless](https://www.stainless.com/).

## Installation

Expand Down Expand Up @@ -271,7 +271,7 @@ await client.health.retrieve({
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Reporting Security Issues

This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.

To report a security issue, please contact the Stainless team at security@stainlessapi.com.
To report a security issue, please contact the Stainless team at security@stainless.com.

## Responsible Disclosure

Expand Down
39 changes: 30 additions & 9 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.24",
"version": "0.1.0-alpha.25",
"description": "The official TypeScript library for the Midday API",
"author": "Midday <[email protected]>",
"types": "dist/index.d.ts",
Expand All @@ -18,7 +18,7 @@
"build": "./scripts/build",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
"fix": "./scripts/format"
Expand Down Expand Up @@ -107,17 +107,38 @@
"default": "./dist/index.mjs"
},
"./*.mjs": {
"types": "./dist/*.d.ts",
"default": "./dist/*.mjs"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"default": [
"./dist/*.mjs",
"./dist/*/index.mjs"
]
},
"./*.js": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"default": [
"./dist/*.js",
"./dist/*/index.js"
]
},
"./*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.js",
"default": "./dist/*.mjs"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"require": [
"./dist/*.js",
"./dist/*/index.js"
],
"default": [
"./dist/*.mjs",
"./dist/*/index.mjs"
]
}
}
}
2 changes: 1 addition & 1 deletion scripts/utils/check-is-in-git-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Check if you happen to call prepare for a repository that's already in node_modules.
[ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] ||
# The name of the containing directory that 'npm` uses, which looks like
Expand Down
13 changes: 13 additions & 0 deletions scripts/utils/git-swap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -exuo pipefail
# the package is published to NPM from ./dist
# we want the final file structure for git installs to match the npm installs, so we

# delete everything except ./dist and ./node_modules
find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' +

# move everything from ./dist to .
mv dist/* .

# delete the now-empty ./dist
rmdir dist
52 changes: 32 additions & 20 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export abstract class APIClient {
maxRetries = 2,
timeout = 60000, // 1 minute
httpAgent,
fetch: overridenFetch,
fetch: overriddenFetch,
}: {
baseURL: string;
maxRetries?: number | undefined;
Expand All @@ -176,7 +176,7 @@ export abstract class APIClient {
this.timeout = validatePositiveInteger('timeout', timeout);
this.httpAgent = httpAgent;

this.fetch = overridenFetch ?? fetch;
this.fetch = overriddenFetch ?? fetch;
}

protected authHeaders(opts: FinalRequestOptions): Headers {
Expand Down Expand Up @@ -280,6 +280,7 @@ export abstract class APIClient {
options: FinalRequestOptions<Req>,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: RequestInit; url: string; timeout: number } {
options = { ...options };
const { method, path, query, headers: headers = {} } = options;

const body =
Expand All @@ -292,9 +293,9 @@ export abstract class APIClient {

const url = this.buildURL(path!, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
const timeout = options.timeout ?? this.timeout;
options.timeout = options.timeout ?? this.timeout;
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
const minAgentTimeout = timeout + 1000;
const minAgentTimeout = options.timeout + 1000;
if (
typeof (httpAgent as any)?.options?.timeout === 'number' &&
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
Expand Down Expand Up @@ -323,7 +324,7 @@ export abstract class APIClient {
signal: options.signal ?? null,
};

return { req, url, timeout };
return { req, url, timeout: options.timeout };
}

private buildHeaders({
Expand Down Expand Up @@ -351,15 +352,22 @@ export abstract class APIClient {
delete reqHeaders['content-type'];
}

// Don't set the retry count header if it was already set or removed through default headers or by the
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
// account for the removal case.
// Don't set theses headers if they were already set or removed through default headers or by the caller.
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
// for the removal case.
if (
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
getHeader(headers, 'x-stainless-retry-count') === undefined
) {
reqHeaders['x-stainless-retry-count'] = String(retryCount);
}
if (
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
getHeader(headers, 'x-stainless-timeout') === undefined &&
options.timeout
) {
reqHeaders['x-stainless-timeout'] = String(options.timeout);
}

this.validateHeaders(reqHeaders, headers);

Expand Down Expand Up @@ -522,20 +530,24 @@ export abstract class APIClient {

const timeout = setTimeout(() => controller.abort(), ms);

const fetchOptions = {
signal: controller.signal as any,
...options,
};
if (fetchOptions.method) {
// Custom methods like 'patch' need to be uppercased
// See https://github.com/nodejs/undici/issues/2294
fetchOptions.method = fetchOptions.method.toUpperCase();
}

return (
this.getRequestClient()
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
.fetch.call(undefined, url, { signal: controller.signal as any, ...options })
.finally(() => {
clearTimeout(timeout);
})
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
this.fetch.call(undefined, url, fetchOptions).finally(() => {
clearTimeout(timeout);
})
);
}

protected getRequestClient(): RequestClient {
return { fetch: this.fetch };
}

private shouldRetry(response: Response): boolean {
// Note this is not a standard header.
const shouldRetryHeader = response.headers.get('x-should-retry');
Expand Down Expand Up @@ -976,8 +988,8 @@ export const safeJSON = (text: string) => {
}
};

// https://stackoverflow.com/a/19709846
const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i');
// https://url.spec.whatwg.org/#url-scheme-string
const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
const isAbsoluteURL = (url: string): boolean => {
return startsWithSchemeRegexp.test(url);
};
Expand Down
Loading