Skip to content

Commit 24e37bb

Browse files
feat(api): add IP address logging for residential and custom proxies
1 parent b695aee commit 24e37bb

38 files changed

+87
-67
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 90
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-6a44c851ec955b997558a8524eb641355ff3097474f40772b8ea2fef5bee4134.yml
3-
openapi_spec_hash: 155ee005a1b43e1c11e843de91e9f509
4-
config_hash: 6cbbf855a29bc675f35ddb1106ea9083
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-cc60c65c6bb0b8a8ea662cf758806e641790870ded35f6ffdb9f4801f3d29b15.yml
3+
openapi_spec_hash: a1074e1bba578bcd5912512166ada0dc
4+
config_hash: 7868d3397406c2974b6f058488aeefd6

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ $ cd kernel-node-sdk
5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link @onkernel/sdk
58+
$ yarn link @kernel/sdk
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global @onkernel/sdk
63+
$ pnpm link -—global @kernel/sdk
6464
```
6565

6666
## Running tests

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kernel TypeScript API Library
22

3-
[![NPM version](<https://img.shields.io/npm/v/@onkernel/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@onkernel/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@onkernel/sdk)
3+
[![NPM version](<https://img.shields.io/npm/v/@kernel/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@kernel/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@kernel/sdk)
44

55
This library provides convenient access to the Kernel REST API from server-side TypeScript or JavaScript.
66

@@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install @onkernel/sdk
14+
npm install @kernel/sdk
1515
```
1616

1717
## Usage
@@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md).
2020

2121
<!-- prettier-ignore -->
2222
```js
23-
import Kernel from '@onkernel/sdk';
23+
import Kernel from '@kernel/sdk';
2424

2525
const client = new Kernel({
2626
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
@@ -38,7 +38,7 @@ This library includes TypeScript definitions for all request params and response
3838

3939
<!-- prettier-ignore -->
4040
```ts
41-
import Kernel from '@onkernel/sdk';
41+
import Kernel from '@kernel/sdk';
4242

4343
const client = new Kernel({
4444
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
@@ -62,7 +62,7 @@ Request parameters that correspond to file uploads can be passed in many differe
6262

6363
```ts
6464
import fs from 'fs';
65-
import Kernel, { toFile } from '@onkernel/sdk';
65+
import Kernel, { toFile } from '@kernel/sdk';
6666

6767
const client = new Kernel();
6868

@@ -227,7 +227,7 @@ The log level can be configured in two ways:
227227
2. Using the `logLevel` client option (overrides the environment variable if set)
228228

229229
```ts
230-
import Kernel from '@onkernel/sdk';
230+
import Kernel from '@kernel/sdk';
231231

232232
const client = new Kernel({
233233
logLevel: 'debug', // Show all log messages
@@ -255,7 +255,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
255255
below the configured level will not be sent to your logger.
256256

257257
```ts
258-
import Kernel from '@onkernel/sdk';
258+
import Kernel from '@kernel/sdk';
259259
import pino from 'pino';
260260

261261
const logger = pino();
@@ -324,7 +324,7 @@ globalThis.fetch = fetch;
324324
Or pass it to the client:
325325

326326
```ts
327-
import Kernel from '@onkernel/sdk';
327+
import Kernel from '@kernel/sdk';
328328
import fetch from 'my-fetch';
329329

330330
const client = new Kernel({ fetch });
@@ -335,7 +335,7 @@ const client = new Kernel({ fetch });
335335
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
336336

337337
```ts
338-
import Kernel from '@onkernel/sdk';
338+
import Kernel from '@kernel/sdk';
339339

340340
const client = new Kernel({
341341
fetchOptions: {
@@ -352,7 +352,7 @@ options to requests:
352352
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
353353

354354
```ts
355-
import Kernel from '@onkernel/sdk';
355+
import Kernel from '@kernel/sdk';
356356
import * as undici from 'undici';
357357

358358
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -366,7 +366,7 @@ const client = new Kernel({
366366
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
367367

368368
```ts
369-
import Kernel from '@onkernel/sdk';
369+
import Kernel from '@kernel/sdk';
370370

371371
const client = new Kernel({
372372
fetchOptions: {
@@ -378,7 +378,7 @@ const client = new Kernel({
378378
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
379379

380380
```ts
381-
import Kernel from 'npm:@onkernel/sdk';
381+
import Kernel from 'npm:@kernel/sdk';
382382

383383
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
384384
const client = new Kernel({

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default tseslint.config(
2525
{
2626
patterns: [
2727
{
28-
regex: '^@onkernel/sdk(/.*)?',
28+
regex: '^@kernel/sdk(/.*)?',
2929
message: 'Use a relative import, not a package import.',
3030
},
3131
],

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^@onkernel/sdk$': '<rootDir>/src/index.ts',
11-
'^@onkernel/sdk/(.*)$': '<rootDir>/src/$1',
10+
'^@kernel/sdk$': '<rootDir>/src/index.ts',
11+
'^@kernel/sdk/(.*)$': '<rootDir>/src/$1',
1212
},
1313
modulePathIgnorePatterns: [
1414
'<rootDir>/ecosystem-tests/',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@onkernel/sdk",
2+
"name": "@kernel/sdk",
33
"version": "0.24.0",
44
"description": "The official TypeScript library for the Kernel API",
55
"author": "Kernel <>",

scripts/build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
88

99
# Build into dist and will publish the package from there,
1010
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
11-
# This way importing from `"@onkernel/sdk/resources/foo"` works
11+
# This way importing from `"@kernel/sdk/resources/foo"` works
1212
# even with `"moduleResolution": "node"`
1313

1414
rm -rf dist; mkdir dist
@@ -42,8 +42,8 @@ node scripts/utils/postprocess-files.cjs
4242

4343
# make sure that nothing crashes when we require the output CJS or
4444
# import the output ESM
45-
(cd dist && node -e 'require("@onkernel/sdk")')
46-
(cd dist && node -e 'import("@onkernel/sdk")' --input-type=module)
45+
(cd dist && node -e 'require("@kernel/sdk")')
46+
(cd dist && node -e 'import("@kernel/sdk")' --input-type=module)
4747

4848
if [ -e ./scripts/build-deno ]
4949
then

src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ import {
112112
import { isEmptyObj } from './internal/utils/values';
113113

114114
const environments = {
115-
production: 'https://api.onkernel.com/',
115+
production: 'https://api.kernel.com/',
116116
development: 'https://localhost:3001/',
117117
};
118118
type Environment = keyof typeof environments;
@@ -127,7 +127,7 @@ export interface ClientOptions {
127127
* Specifies the environment to use for the API.
128128
*
129129
* Each environment maps to a different base URL:
130-
* - `production` corresponds to `https://api.onkernel.com/`
130+
* - `production` corresponds to `https://api.kernel.com/`
131131
* - `development` corresponds to `https://localhost:3001/`
132132
*/
133133
environment?: Environment | undefined;
@@ -224,7 +224,7 @@ export class Kernel {
224224
*
225225
* @param {string | undefined} [opts.apiKey=process.env['KERNEL_API_KEY'] ?? undefined]
226226
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
227-
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.onkernel.com/] - Override the default base URL for the API.
227+
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.kernel.com/] - Override the default base URL for the API.
228228
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
229229
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
230230
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.

src/resources/proxies.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export interface ProxyCreateResponse {
6868
| ProxyCreateResponse.MobileProxyConfig
6969
| ProxyCreateResponse.CustomProxyConfig;
7070

71+
/**
72+
* IP address that the proxy uses when making requests.
73+
*/
74+
ip_address?: string;
75+
7176
/**
7277
* Timestamp of the last health check performed on this proxy.
7378
*/
@@ -288,6 +293,11 @@ export interface ProxyRetrieveResponse {
288293
| ProxyRetrieveResponse.MobileProxyConfig
289294
| ProxyRetrieveResponse.CustomProxyConfig;
290295

296+
/**
297+
* IP address that the proxy uses when making requests.
298+
*/
299+
ip_address?: string;
300+
291301
/**
292302
* Timestamp of the last health check performed on this proxy.
293303
*/
@@ -511,6 +521,11 @@ export namespace ProxyListResponse {
511521
| ProxyListResponseItem.MobileProxyConfig
512522
| ProxyListResponseItem.CustomProxyConfig;
513523

524+
/**
525+
* IP address that the proxy uses when making requests.
526+
*/
527+
ip_address?: string;
528+
514529
/**
515530
* Timestamp of the last health check performed on this proxy.
516531
*/
@@ -732,6 +747,11 @@ export interface ProxyCheckResponse {
732747
| ProxyCheckResponse.MobileProxyConfig
733748
| ProxyCheckResponse.CustomProxyConfig;
734749

750+
/**
751+
* IP address that the proxy uses when making requests.
752+
*/
753+
ip_address?: string;
754+
735755
/**
736756
* Timestamp of the last health check performed on this proxy.
737757
*/

tests/api-resources/agents/auth/auth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import Kernel from '@onkernel/sdk';
3+
import Kernel from '@kernel/sdk';
44

55
const client = new Kernel({
66
apiKey: 'My API Key',

0 commit comments

Comments
 (0)