@onkernel/sdk 0.1.0-alpha.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +32 -44
- package/client.d.mts +5 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -5
- package/client.d.ts.map +1 -1
- package/client.js +4 -4
- package/client.js.map +1 -1
- package/client.mjs +4 -4
- package/client.mjs.map +1 -1
- package/core/app-framework.d.mts +3 -3
- package/core/app-framework.d.mts.map +1 -1
- package/core/app-framework.d.ts +3 -3
- package/core/app-framework.d.ts.map +1 -1
- package/core/app-framework.js +14 -31
- package/core/app-framework.js.map +1 -1
- package/core/app-framework.mjs +14 -31
- package/core/app-framework.mjs.map +1 -1
- package/core/streaming.d.mts +31 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +31 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +257 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +252 -0
- package/core/streaming.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +10 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +10 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +2 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +2 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/package.json +11 -4
- package/resources/apps/apps.d.mts +65 -0
- package/resources/apps/apps.d.mts.map +1 -0
- package/resources/apps/apps.d.ts +65 -0
- package/resources/apps/apps.d.ts.map +1 -0
- package/resources/apps/apps.js +33 -0
- package/resources/apps/apps.js.map +1 -0
- package/resources/apps/apps.mjs +28 -0
- package/resources/apps/apps.mjs.map +1 -0
- package/resources/apps/deployments.d.mts +157 -0
- package/resources/apps/deployments.d.mts.map +1 -0
- package/resources/apps/deployments.d.ts +157 -0
- package/resources/apps/deployments.d.ts.map +1 -0
- package/resources/apps/deployments.js +43 -0
- package/resources/apps/deployments.js.map +1 -0
- package/resources/apps/deployments.mjs +39 -0
- package/resources/apps/deployments.mjs.map +1 -0
- package/resources/apps/index.d.mts +4 -0
- package/resources/apps/index.d.mts.map +1 -0
- package/resources/apps/index.d.ts +4 -0
- package/resources/apps/index.d.ts.map +1 -0
- package/resources/apps/index.js +11 -0
- package/resources/apps/index.js.map +1 -0
- package/resources/apps/index.mjs +5 -0
- package/resources/apps/index.mjs.map +1 -0
- package/resources/apps/invocations.d.mts +110 -0
- package/resources/apps/invocations.d.mts.map +1 -0
- package/resources/apps/invocations.d.ts +110 -0
- package/resources/apps/invocations.d.ts.map +1 -0
- package/resources/apps/invocations.js +38 -0
- package/resources/apps/invocations.js.map +1 -0
- package/resources/apps/invocations.mjs +34 -0
- package/resources/apps/invocations.mjs.map +1 -0
- package/resources/apps.d.mts +1 -120
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +1 -120
- package/resources/apps.d.ts.map +1 -1
- package/resources/apps.js +2 -51
- package/resources/apps.js.map +1 -1
- package/resources/apps.mjs +1 -49
- package/resources/apps.mjs.map +1 -1
- package/resources/browsers.d.mts +65 -0
- package/resources/browsers.d.mts.map +1 -0
- package/resources/browsers.d.ts +65 -0
- package/resources/browsers.d.ts.map +1 -0
- package/resources/browsers.js +36 -0
- package/resources/browsers.js.map +1 -0
- package/resources/browsers.mjs +32 -0
- package/resources/browsers.mjs.map +1 -0
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -4
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +14 -18
- package/src/core/app-framework.ts +19 -36
- package/src/core/streaming.ts +301 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/parse.ts +14 -0
- package/src/internal/request-options.ts +2 -0
- package/src/resources/apps/apps.ts +104 -0
- package/src/resources/apps/deployments.ts +202 -0
- package/src/resources/apps/index.ts +15 -0
- package/src/resources/apps/invocations.ts +140 -0
- package/src/resources/apps.ts +1 -159
- package/src/resources/browsers.ts +85 -0
- package/src/resources/index.ts +6 -8
- package/src/streaming.ts +2 -0
- package/src/version.ts +1 -1
- package/streaming.d.mts +2 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +2 -0
- package/streaming.mjs.map +1 -0
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/browser.d.mts +0 -27
- package/resources/browser.d.mts.map +0 -1
- package/resources/browser.d.ts +0 -27
- package/resources/browser.d.ts.map +0 -1
- package/resources/browser.js +0 -15
- package/resources/browser.js.map +0 -1
- package/resources/browser.mjs +0 -11
- package/resources/browser.mjs.map +0 -1
- package/src/resources/browser.ts +0 -35
package/resources/apps.js
CHANGED
|
@@ -1,55 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const uploads_1 = require("../internal/uploads.js");
|
|
7
|
-
const path_1 = require("../internal/utils/path.js");
|
|
8
|
-
class Apps extends resource_1.APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* Deploy a new application
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const response = await client.apps.deploy({
|
|
15
|
-
* appName: 'my-awesome-app',
|
|
16
|
-
* file: fs.createReadStream('path/to/file'),
|
|
17
|
-
* version: '1.0.0',
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
deploy(body, options) {
|
|
22
|
-
return this._client.post('/apps/deploy', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Invoke an application
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* const response = await client.apps.invoke({
|
|
30
|
-
* actionName: 'analyze',
|
|
31
|
-
* appName: 'my-awesome-app',
|
|
32
|
-
* payload: '{ "data": "example input" }',
|
|
33
|
-
* version: '1.0.0',
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
invoke(body, options) {
|
|
38
|
-
return this._client.post('/apps/invoke', { body, ...options });
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get an app invocation by id
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* const response = await client.apps.retrieveInvocation(
|
|
46
|
-
* 'ckqwer3o20000jb9s7abcdef',
|
|
47
|
-
* );
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
retrieveInvocation(id, options) {
|
|
51
|
-
return this._client.get((0, path_1.path) `/apps/invocations/${id}`, options);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.Apps = Apps;
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./apps/index.js"), exports);
|
|
55
6
|
//# sourceMappingURL=apps.js.map
|
package/resources/apps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../src/resources/apps.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../src/resources/apps.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0DAA6B"}
|
package/resources/apps.mjs
CHANGED
|
@@ -1,51 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
4
|
-
import { path } from "../internal/utils/path.mjs";
|
|
5
|
-
export class Apps extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Deploy a new application
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const response = await client.apps.deploy({
|
|
12
|
-
* appName: 'my-awesome-app',
|
|
13
|
-
* file: fs.createReadStream('path/to/file'),
|
|
14
|
-
* version: '1.0.0',
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
deploy(body, options) {
|
|
19
|
-
return this._client.post('/apps/deploy', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Invoke an application
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const response = await client.apps.invoke({
|
|
27
|
-
* actionName: 'analyze',
|
|
28
|
-
* appName: 'my-awesome-app',
|
|
29
|
-
* payload: '{ "data": "example input" }',
|
|
30
|
-
* version: '1.0.0',
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
invoke(body, options) {
|
|
35
|
-
return this._client.post('/apps/invoke', { body, ...options });
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get an app invocation by id
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* const response = await client.apps.retrieveInvocation(
|
|
43
|
-
* 'ckqwer3o20000jb9s7abcdef',
|
|
44
|
-
* );
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
retrieveInvocation(id, options) {
|
|
48
|
-
return this._client.get(path `/apps/invocations/${id}`, options);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
2
|
+
export * from "./apps/index.mjs";
|
|
51
3
|
//# sourceMappingURL=apps.mjs.map
|
package/resources/apps.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.mjs","sourceRoot":"","sources":["../src/resources/apps.ts"],"names":[],"mappings":"AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"apps.mjs","sourceRoot":"","sources":["../src/resources/apps.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
|
+
export declare class Browsers extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create Browser Session
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const browser = await client.browsers.create({
|
|
11
|
+
* invocation_id: 'ckqwer3o20000jb9s7abcdef',
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
create(body: BrowserCreateParams, options?: RequestOptions): APIPromise<BrowserCreateResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Get Browser Session by ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const browser = await client.browsers.retrieve(
|
|
22
|
+
* 'e5bf36fe-9247-4e2b-8b5a-2f594cc1c073',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<BrowserRetrieveResponse>;
|
|
27
|
+
}
|
|
28
|
+
export interface BrowserCreateResponse {
|
|
29
|
+
/**
|
|
30
|
+
* Remote URL for live viewing the browser session
|
|
31
|
+
*/
|
|
32
|
+
browser_live_view_url: string;
|
|
33
|
+
/**
|
|
34
|
+
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
35
|
+
*/
|
|
36
|
+
cdp_ws_url: string;
|
|
37
|
+
/**
|
|
38
|
+
* Unique identifier for the browser session
|
|
39
|
+
*/
|
|
40
|
+
session_id: string;
|
|
41
|
+
}
|
|
42
|
+
export interface BrowserRetrieveResponse {
|
|
43
|
+
/**
|
|
44
|
+
* Remote URL for live viewing the browser session
|
|
45
|
+
*/
|
|
46
|
+
browser_live_view_url: string;
|
|
47
|
+
/**
|
|
48
|
+
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
49
|
+
*/
|
|
50
|
+
cdp_ws_url: string;
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the browser session
|
|
53
|
+
*/
|
|
54
|
+
session_id: string;
|
|
55
|
+
}
|
|
56
|
+
export interface BrowserCreateParams {
|
|
57
|
+
/**
|
|
58
|
+
* action invocation ID
|
|
59
|
+
*/
|
|
60
|
+
invocation_id: string;
|
|
61
|
+
}
|
|
62
|
+
export declare namespace Browsers {
|
|
63
|
+
export { type BrowserCreateResponse as BrowserCreateResponse, type BrowserRetrieveResponse as BrowserRetrieveResponse, type BrowserCreateParams as BrowserCreateParams, };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=browsers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsers.d.mts","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAGpF;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
4
|
+
export declare class Browsers extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create Browser Session
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const browser = await client.browsers.create({
|
|
11
|
+
* invocation_id: 'ckqwer3o20000jb9s7abcdef',
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
create(body: BrowserCreateParams, options?: RequestOptions): APIPromise<BrowserCreateResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Get Browser Session by ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const browser = await client.browsers.retrieve(
|
|
22
|
+
* 'e5bf36fe-9247-4e2b-8b5a-2f594cc1c073',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<BrowserRetrieveResponse>;
|
|
27
|
+
}
|
|
28
|
+
export interface BrowserCreateResponse {
|
|
29
|
+
/**
|
|
30
|
+
* Remote URL for live viewing the browser session
|
|
31
|
+
*/
|
|
32
|
+
browser_live_view_url: string;
|
|
33
|
+
/**
|
|
34
|
+
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
35
|
+
*/
|
|
36
|
+
cdp_ws_url: string;
|
|
37
|
+
/**
|
|
38
|
+
* Unique identifier for the browser session
|
|
39
|
+
*/
|
|
40
|
+
session_id: string;
|
|
41
|
+
}
|
|
42
|
+
export interface BrowserRetrieveResponse {
|
|
43
|
+
/**
|
|
44
|
+
* Remote URL for live viewing the browser session
|
|
45
|
+
*/
|
|
46
|
+
browser_live_view_url: string;
|
|
47
|
+
/**
|
|
48
|
+
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
49
|
+
*/
|
|
50
|
+
cdp_ws_url: string;
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the browser session
|
|
53
|
+
*/
|
|
54
|
+
session_id: string;
|
|
55
|
+
}
|
|
56
|
+
export interface BrowserCreateParams {
|
|
57
|
+
/**
|
|
58
|
+
* action invocation ID
|
|
59
|
+
*/
|
|
60
|
+
invocation_id: string;
|
|
61
|
+
}
|
|
62
|
+
export declare namespace Browsers {
|
|
63
|
+
export { type BrowserCreateResponse as BrowserCreateResponse, type BrowserRetrieveResponse as BrowserRetrieveResponse, type BrowserCreateParams as BrowserCreateParams, };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=browsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsers.d.ts","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAGpF;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Browsers = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const path_1 = require("../internal/utils/path.js");
|
|
7
|
+
class Browsers extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Create Browser Session
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const browser = await client.browsers.create({
|
|
14
|
+
* invocation_id: 'ckqwer3o20000jb9s7abcdef',
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
create(body, options) {
|
|
19
|
+
return this._client.post('/browsers', { body, ...options });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get Browser Session by ID
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const browser = await client.browsers.retrieve(
|
|
27
|
+
* 'e5bf36fe-9247-4e2b-8b5a-2f594cc1c073',
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
retrieve(id, options) {
|
|
32
|
+
return this._client.get((0, path_1.path) `/browsers/${id}`, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Browsers = Browsers;
|
|
36
|
+
//# sourceMappingURL=browsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsers.js","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF;AA5BD,4BA4BC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { path } from "../internal/utils/path.mjs";
|
|
4
|
+
export class Browsers extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create Browser Session
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const browser = await client.browsers.create({
|
|
11
|
+
* invocation_id: 'ckqwer3o20000jb9s7abcdef',
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
create(body, options) {
|
|
16
|
+
return this._client.post('/browsers', { body, ...options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get Browser Session by ID
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const browser = await client.browsers.retrieve(
|
|
24
|
+
* 'e5bf36fe-9247-4e2b-8b5a-2f594cc1c073',
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
retrieve(id, options) {
|
|
29
|
+
return this._client.get(path `/browsers/${id}`, options);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=browsers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browsers.mjs","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Apps, type
|
|
2
|
-
export {
|
|
1
|
+
export { Apps, type AppListResponse, type AppListParams } from "./apps/apps.mjs";
|
|
2
|
+
export { Browsers, type BrowserCreateResponse, type BrowserRetrieveResponse, type BrowserCreateParams, } from "./browsers.mjs";
|
|
3
3
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Apps, type
|
|
2
|
-
export {
|
|
1
|
+
export { Apps, type AppListResponse, type AppListParams } from "./apps/apps.js";
|
|
2
|
+
export { Browsers, type BrowserCreateResponse, type BrowserRetrieveResponse, type BrowserCreateParams, } from "./browsers.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB"}
|
package/resources/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
var apps_1 = require("./apps.js");
|
|
4
|
+
exports.Browsers = exports.Apps = void 0;
|
|
5
|
+
var apps_1 = require("./apps/apps.js");
|
|
6
6
|
Object.defineProperty(exports, "Apps", { enumerable: true, get: function () { return apps_1.Apps; } });
|
|
7
|
-
var
|
|
8
|
-
Object.defineProperty(exports, "
|
|
7
|
+
var browsers_1 = require("./browsers.js");
|
|
8
|
+
Object.defineProperty(exports, "Browsers", { enumerable: true, get: function () { return browsers_1.Browsers; } });
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,uCAA6E;AAApE,4FAAA,IAAI,OAAA;AACb,0CAKoB;AAJlB,oGAAA,QAAQ,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
export { Apps
|
|
3
|
-
export {
|
|
2
|
+
export { Apps } from "./apps/apps.mjs";
|
|
3
|
+
export { Browsers, } from "./browsers.mjs";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAA4C;OAClD,EACL,QAAQ,GAIT"}
|
package/src/client.ts
CHANGED
|
@@ -21,18 +21,16 @@ import { type Fetch } from './internal/builtin-types';
|
|
|
21
21
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
22
22
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
23
23
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Apps,
|
|
30
|
-
} from './resources/apps';
|
|
31
|
-
import { Browser, BrowserCreateSessionResponse } from './resources/browser';
|
|
24
|
+
BrowserCreateParams,
|
|
25
|
+
BrowserCreateResponse,
|
|
26
|
+
BrowserRetrieveResponse,
|
|
27
|
+
Browsers,
|
|
28
|
+
} from './resources/browsers';
|
|
32
29
|
import { readEnv } from './internal/utils/env';
|
|
33
30
|
import { formatRequestDetails, loggerFor } from './internal/utils/log';
|
|
34
31
|
import { isEmptyObj } from './internal/utils/values';
|
|
35
32
|
import { KernelApp } from './core/app-framework';
|
|
33
|
+
import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
|
|
36
34
|
|
|
37
35
|
const environments = {
|
|
38
36
|
production: 'https://api.onkernel.com/',
|
|
@@ -735,21 +733,19 @@ export class Kernel {
|
|
|
735
733
|
static toFile = Uploads.toFile;
|
|
736
734
|
|
|
737
735
|
apps: API.Apps = new API.Apps(this);
|
|
738
|
-
|
|
736
|
+
browsers: API.Browsers = new API.Browsers(this);
|
|
739
737
|
}
|
|
740
738
|
Kernel.Apps = Apps;
|
|
741
|
-
Kernel.
|
|
739
|
+
Kernel.Browsers = Browsers;
|
|
742
740
|
export declare namespace Kernel {
|
|
743
741
|
export type RequestOptions = Opts.RequestOptions;
|
|
744
742
|
|
|
743
|
+
export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams };
|
|
744
|
+
|
|
745
745
|
export {
|
|
746
|
-
|
|
747
|
-
type
|
|
748
|
-
type
|
|
749
|
-
type
|
|
750
|
-
type AppDeployParams as AppDeployParams,
|
|
751
|
-
type AppInvokeParams as AppInvokeParams,
|
|
746
|
+
Browsers as Browsers,
|
|
747
|
+
type BrowserCreateResponse as BrowserCreateResponse,
|
|
748
|
+
type BrowserRetrieveResponse as BrowserRetrieveResponse,
|
|
749
|
+
type BrowserCreateParams as BrowserCreateParams,
|
|
752
750
|
};
|
|
753
|
-
|
|
754
|
-
export { Browser as Browser, type BrowserCreateSessionResponse as BrowserCreateSessionResponse };
|
|
755
751
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface KernelContext {
|
|
2
|
-
|
|
2
|
+
invocation_id: string;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export interface KernelAction {
|
|
6
6
|
name: string;
|
|
7
|
-
handler: (context: KernelContext,
|
|
7
|
+
handler: (context: KernelContext, payload?: any) => Promise<any>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface KernelJson {
|
|
@@ -34,45 +34,28 @@ export class KernelApp {
|
|
|
34
34
|
* Define an action
|
|
35
35
|
*/
|
|
36
36
|
action<T, R>(
|
|
37
|
-
|
|
38
|
-
handler
|
|
37
|
+
name: string,
|
|
38
|
+
handler: ((context: KernelContext) => Promise<R>) | ((context: KernelContext, payload?: T) => Promise<R>),
|
|
39
39
|
) {
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const singleArgHandler = handler as (input: T) => Promise<R>;
|
|
51
|
-
actionHandler = async (context: KernelContext, input: T) => singleArgHandler(input);
|
|
52
|
-
} else {
|
|
53
|
-
// Handler takes both context and input
|
|
54
|
-
actionHandler = handler as (context: KernelContext, input: T) => Promise<R>;
|
|
55
|
-
}
|
|
56
|
-
} else if (typeof nameOrHandler === 'function') {
|
|
57
|
-
// Case: app.action(handler)
|
|
58
|
-
actionName = nameOrHandler.name || 'default';
|
|
59
|
-
|
|
60
|
-
// Create a handler that accepts context and input, adapting if needed
|
|
61
|
-
if (nameOrHandler.length === 1) {
|
|
62
|
-
// Original handler only takes input, so we adapt it to the new signature
|
|
63
|
-
const singleArgHandler = nameOrHandler as (input: T) => Promise<R>;
|
|
64
|
-
actionHandler = async (context: KernelContext, input: T) => singleArgHandler(input);
|
|
65
|
-
} else {
|
|
66
|
-
// Handler takes both context and input
|
|
67
|
-
actionHandler = nameOrHandler as (context: KernelContext, input: T) => Promise<R>;
|
|
68
|
-
}
|
|
40
|
+
let actionHandler: (context: KernelContext, payload?: T) => Promise<R>;
|
|
41
|
+
|
|
42
|
+
// Create a handler that accepts context and payload, adapting if needed
|
|
43
|
+
if (handler.length === 0) {
|
|
44
|
+
// Handlers with no arguments are not supported
|
|
45
|
+
throw new Error('Action handlers must accept at least the context parameter');
|
|
46
|
+
} else if (handler.length === 1) {
|
|
47
|
+
// Handler takes context only
|
|
48
|
+
const contextOnlyHandler = handler as (context: KernelContext) => Promise<R>;
|
|
49
|
+
actionHandler = async (context: KernelContext, _payload?: T) => contextOnlyHandler(context);
|
|
69
50
|
} else {
|
|
70
|
-
|
|
51
|
+
// Handler takes both context and payload
|
|
52
|
+
const twoArgHandler = handler as (context: KernelContext, payload?: T) => Promise<R>;
|
|
53
|
+
actionHandler = twoArgHandler;
|
|
71
54
|
}
|
|
72
55
|
|
|
73
56
|
// Register the action
|
|
74
|
-
this.actions.set(
|
|
75
|
-
name
|
|
57
|
+
this.actions.set(name, {
|
|
58
|
+
name,
|
|
76
59
|
handler: actionHandler,
|
|
77
60
|
});
|
|
78
61
|
|