Skip to content

Commit aa6302e

Browse files
chore(internal): codegen related update (#41)
1 parent 607ffef commit aa6302e

File tree

18 files changed

+72
-57
lines changed

18 files changed

+72
-57
lines changed

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ jobs:
1919
bash ./bin/check-release-environment
2020
env:
2121
NPM_TOKEN: ${{ secrets.OPENLAYER_NPM_TOKEN || secrets.NPM_TOKEN }}
22+

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
201201
```ts
202202
const client = new Openlayer();
203203

204-
const response = await openlayer.inferencePipelines.data
204+
const response = await client.inferencePipelines.data
205205
.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
206206
config: {
207207
inputVariableNames: ['user_query'],
@@ -349,7 +349,7 @@ const client = new Openlayer({
349349
});
350350

351351
// Override per-request:
352-
await openlayer.inferencePipelines.data.stream(
352+
await client.inferencePipelines.data.stream(
353353
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
354354
{
355355
config: {

bin/check-release-environment

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
1919
fi
2020

2121
echo "The environment is ready to push releases!"
22+

bin/publish-npm

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
set -eux
44

5-
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
5+
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
66

7+
# Build the project
78
yarn build
9+
10+
# Navigate to the dist directory
811
cd dist
9-
yarn publish --access public
12+
13+
# Get the version from package.json
14+
VERSION="$(node -p "require('./package.json').version")"
15+
16+
# Extract the pre-release tag if it exists
17+
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
18+
# Extract the part before any dot in the pre-release identifier
19+
TAG="${BASH_REMATCH[1]}"
20+
else
21+
TAG="latest"
22+
fi
23+
24+
# Publish with the appropriate tag
25+
yarn publish --access public --tag "$TAG"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
2222
"tsn": "ts-node -r tsconfig-paths/register",
2323
"lint": "./scripts/lint",
24-
"fix": "eslint --fix --ext ts,js ."
24+
"fix": "./scripts/format"
2525
},
2626
"dependencies": {
2727
"@langchain/core": "^0.3.3",

scripts/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -e
55
cd "$(dirname "$0")/.."
66

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

scripts/mock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
2121

2222
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
24-
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &
24+
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL" &> .prism.log &
2525

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

3838
echo
3939
else
40-
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
40+
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL"
4141
fi

src/_shims/node-runtime.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import { Readable } from 'node:stream';
1313
import { type RequestOptions } from '../core';
1414
import { MultipartBody } from './MultipartBody';
1515
import { type Shims } from './registry';
16-
17-
// @ts-ignore (this package does not have proper export maps for this export)
18-
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
16+
import { ReadableStream } from 'node:stream/web';
1917

2018
type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
2119

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export class Openlayer extends Core.APIClient {
165165
}
166166

167167
static Openlayer = this;
168+
static DEFAULT_TIMEOUT = 60000; // 1 minute
168169

169170
static OpenlayerError = Errors.OpenlayerError;
170171
static APIError = Errors.APIError;

tests/api-resources/commits/test-results.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import Openlayer from 'openlayer';
44
import { Response } from 'node-fetch';
55

6-
const openlayer = new Openlayer({
6+
const client = new Openlayer({
77
apiKey: 'My API Key',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

1111
describe('resource testResults', () => {
1212
test('list', async () => {
13-
const responsePromise = openlayer.commits.testResults.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
13+
const responsePromise = client.commits.testResults.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
1414
const rawResponse = await responsePromise.asResponse();
1515
expect(rawResponse).toBeInstanceOf(Response);
1616
const response = await responsePromise;
@@ -23,7 +23,7 @@ describe('resource testResults', () => {
2323
test('list: request options instead of params are passed correctly', async () => {
2424
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
2525
await expect(
26-
openlayer.commits.testResults.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
26+
client.commits.testResults.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
2727
path: '/_stainless_unknown_path',
2828
}),
2929
).rejects.toThrow(Openlayer.NotFoundError);
@@ -32,7 +32,7 @@ describe('resource testResults', () => {
3232
test('list: request options and params are passed correctly', async () => {
3333
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
3434
await expect(
35-
openlayer.commits.testResults.list(
35+
client.commits.testResults.list(
3636
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
3737
{ includeArchived: true, page: 1, perPage: 1, status: 'passing', type: 'integrity' },
3838
{ path: '/_stainless_unknown_path' },

0 commit comments

Comments
 (0)