diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 347d8bf..931fce1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.9" + ".": "0.1.0-alpha.10" } diff --git a/.stats.yml b/.stats.yml index cbc2ff8..d6d797a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 4 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml -openapi_spec_hash: be02256478be81fa3f649076879850bc -config_hash: eab40627b734534462ae3b8ccd8b263b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-07d481d1498bf9677437b555e9ec2d843d50107faa7501e4c430a32b1f3c3343.yml +openapi_spec_hash: 296f78d82afbac95fad12c5eabd71f18 +config_hash: 2c8351ba6611ce4a352e248405783846 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9e9f3..1fef3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.1.0-alpha.10 (2025-05-14) + +Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10) + +### Features + +* **api:** update via SDK Studio ([3b78bc2](https://github.com/onkernel/kernel-node-sdk/commit/3b78bc20c94d4e6cfca144da4096b32fe6c5d5dc)) + + +### Chores + +* **package:** remove engines ([d4d2eb2](https://github.com/onkernel/kernel-node-sdk/commit/d4d2eb2ab59cc5e4d237fddd143388a4348d51ba)) + ## 0.1.0-alpha.9 (2025-05-12) Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9) diff --git a/README.md b/README.md index d2163df..e9bb7a3 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ const client = new Kernel({ async function main() { const response = await client.apps.deploy({ + entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME', }); @@ -53,7 +54,11 @@ const client = new Kernel({ }); async function main() { - const params: Kernel.AppDeployParams = { file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }; + const params: Kernel.AppDeployParams = { + entrypointRelPath: 'app.py', + file: fs.createReadStream('path/to/file'), + version: 'REPLACE_ME', + }; const response: Kernel.AppDeployResponse = await client.apps.deploy(params); } @@ -78,17 +83,23 @@ import Kernel, { toFile } from '@onkernel/sdk'; const client = new Kernel(); // If you have access to Node `fs` we recommend using `fs.createReadStream()`: -await client.apps.deploy({ file: fs.createReadStream('/path/to/file') }); +await client.apps.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('/path/to/file') }); // Or if you have the web `File` API you can pass a `File` instance: -await client.apps.deploy({ file: new File(['my bytes'], 'file') }); +await client.apps.deploy({ entrypointRelPath: 'app.py', file: new File(['my bytes'], 'file') }); // You can also pass a `fetch` `Response`: -await client.apps.deploy({ file: await fetch('https://somesite/file') }); +await client.apps.deploy({ entrypointRelPath: 'app.py', file: await fetch('https://somesite/file') }); // Finally, if none of the above are convenient, you can use our `toFile` helper: -await client.apps.deploy({ file: await toFile(Buffer.from('my bytes'), 'file') }); -await client.apps.deploy({ file: await toFile(new Uint8Array([0, 1, 2]), 'file') }); +await client.apps.deploy({ + entrypointRelPath: 'app.py', + file: await toFile(Buffer.from('my bytes'), 'file'), +}); +await client.apps.deploy({ + entrypointRelPath: 'app.py', + file: await toFile(new Uint8Array([0, 1, 2]), 'file'), +}); ``` ## Handling errors @@ -101,7 +112,7 @@ a subclass of `APIError` will be thrown: ```ts async function main() { const response = await client.apps - .deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) + .deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) .catch(async (err) => { if (err instanceof Kernel.APIError) { console.log(err.status); // 400 @@ -145,7 +156,7 @@ const client = new Kernel({ }); // Or, configure per-request: -await client.apps.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, { +await client.apps.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, { maxRetries: 5, }); ``` @@ -162,7 +173,7 @@ const client = new Kernel({ }); // Override per-request: -await client.apps.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, { +await client.apps.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, { timeout: 5 * 1000, }); ``` @@ -186,13 +197,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse const client = new Kernel(); const response = await client.apps - .deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) + .deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) .asResponse(); console.log(response.headers.get('X-My-Header')); console.log(response.statusText); // access the underlying Response object const { data: response, response: raw } = await client.apps - .deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) + .deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }) .withResponse(); console.log(raw.headers.get('X-My-Header')); console.log(response.apps); diff --git a/package.json b/package.json index 7e24e0f..dacc7be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.1.0-alpha.9", + "version": "0.1.0-alpha.10", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", @@ -68,8 +68,5 @@ "import": "./dist/*.mjs", "require": "./dist/*.js" } - }, - "engines": { - "node": ">= 20" } } diff --git a/src/resources/apps.ts b/src/resources/apps.ts index 8219c1c..ddf6f55 100644 --- a/src/resources/apps.ts +++ b/src/resources/apps.ts @@ -14,6 +14,7 @@ export class Apps extends APIResource { * @example * ```ts * const response = await client.apps.deploy({ + * entrypointRelPath: 'app.py', * file: fs.createReadStream('path/to/file'), * }); * ``` @@ -128,14 +129,14 @@ export interface AppRetrieveInvocationResponse { export interface AppDeployParams { /** - * ZIP file containing the application source directory + * Relative path to the entrypoint of the application */ - file: Uploadable; + entrypointRelPath: string; /** - * Relative path to the entrypoint of the application + * ZIP file containing the application source directory */ - entrypointRelPath?: string; + file: Uploadable; /** * Allow overwriting an existing app version diff --git a/src/version.ts b/src/version.ts index fdbf689..5ed52cd 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.9'; // x-release-please-version +export const VERSION = '0.1.0-alpha.10'; // x-release-please-version diff --git a/tests/api-resources/apps.test.ts b/tests/api-resources/apps.test.ts index 7cb3c56..974e97b 100644 --- a/tests/api-resources/apps.test.ts +++ b/tests/api-resources/apps.test.ts @@ -11,6 +11,7 @@ describe('resource apps', () => { // skipped: tests are disabled for the time being test.skip('deploy: only required params', async () => { const responsePromise = client.apps.deploy({ + entrypointRelPath: 'app.py', file: await toFile(Buffer.from('# my file contents'), 'README.md'), }); const rawResponse = await responsePromise.asResponse(); @@ -25,8 +26,8 @@ describe('resource apps', () => { // skipped: tests are disabled for the time being test.skip('deploy: required and optional params', async () => { const response = await client.apps.deploy({ - file: await toFile(Buffer.from('# my file contents'), 'README.md'), entrypointRelPath: 'app.py', + file: await toFile(Buffer.from('# my file contents'), 'README.md'), force: 'false', region: 'aws.us-east-1a', version: '1.0.0',