@onkernel/sdk 0.8.0 → 0.8.3
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 +28 -0
- package/README.md +14 -27
- package/client.d.mts +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -5
- package/resources/apps.d.mts +61 -1
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +61 -1
- package/resources/apps.d.ts.map +1 -1
- package/resources/apps.js +11 -2
- package/resources/apps.js.map +1 -1
- package/resources/apps.mjs +9 -1
- package/resources/apps.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.js +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/invocations.d.mts +4 -0
- package/resources/invocations.d.mts.map +1 -1
- package/resources/invocations.d.ts +4 -0
- package/resources/invocations.d.ts.map +1 -1
- package/src/client.ts +1 -1
- package/src/resources/apps.ts +73 -1
- package/src/resources/index.ts +1 -1
- package/src/resources/invocations.ts +5 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/apps/apps.d.mts +0 -71
- package/resources/apps/apps.d.mts.map +0 -1
- package/resources/apps/apps.d.ts +0 -71
- package/resources/apps/apps.d.ts.map +0 -1
- package/resources/apps/apps.js +0 -28
- package/resources/apps/apps.js.map +0 -1
- package/resources/apps/apps.mjs +0 -23
- package/resources/apps/apps.mjs.map +0 -1
- package/resources/apps/deployments.d.mts +0 -135
- package/resources/apps/deployments.d.mts.map +0 -1
- package/resources/apps/deployments.d.ts +0 -135
- package/resources/apps/deployments.d.ts.map +0 -1
- package/resources/apps/deployments.js +0 -43
- package/resources/apps/deployments.js.map +0 -1
- package/resources/apps/deployments.mjs +0 -39
- package/resources/apps/deployments.mjs.map +0 -1
- package/resources/apps/index.d.mts +0 -3
- package/resources/apps/index.d.mts.map +0 -1
- package/resources/apps/index.d.ts +0 -3
- package/resources/apps/index.d.ts.map +0 -1
- package/resources/apps/index.js +0 -9
- package/resources/apps/index.js.map +0 -1
- package/resources/apps/index.mjs +0 -4
- package/resources/apps/index.mjs.map +0 -1
- package/src/resources/apps/apps.ts +0 -98
- package/src/resources/apps/deployments.ts +0 -175
- package/src/resources/apps/index.ts +0 -9
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../core/resource.js";
|
|
2
|
-
import * as Shared from "../shared.js";
|
|
3
|
-
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
-
import { Stream } from "../../core/streaming.js";
|
|
5
|
-
import { type Uploadable } from "../../core/uploads.js";
|
|
6
|
-
import { RequestOptions } from "../../internal/request-options.js";
|
|
7
|
-
export declare class Deployments extends APIResource {
|
|
8
|
-
/**
|
|
9
|
-
* Deploy a new application and associated actions to Kernel.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const deployment = await client.apps.deployments.create({
|
|
14
|
-
* entrypoint_rel_path: 'src/app.py',
|
|
15
|
-
* file: fs.createReadStream('path/to/file'),
|
|
16
|
-
* });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
create(body: DeploymentCreateParams, options?: RequestOptions): APIPromise<DeploymentCreateResponse>;
|
|
20
|
-
/**
|
|
21
|
-
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
22
|
-
* status updates for a deployed application. The stream terminates automatically
|
|
23
|
-
* once the application reaches a terminal state.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const response = await client.apps.deployments.follow('id');
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
follow(id: string, options?: RequestOptions): APIPromise<Stream<DeploymentFollowResponse>>;
|
|
31
|
-
}
|
|
32
|
-
export interface DeploymentCreateResponse {
|
|
33
|
-
/**
|
|
34
|
-
* List of apps deployed
|
|
35
|
-
*/
|
|
36
|
-
apps: Array<DeploymentCreateResponse.App>;
|
|
37
|
-
/**
|
|
38
|
-
* Current status of the deployment
|
|
39
|
-
*/
|
|
40
|
-
status: 'queued' | 'deploying' | 'succeeded' | 'failed';
|
|
41
|
-
/**
|
|
42
|
-
* Status reason
|
|
43
|
-
*/
|
|
44
|
-
status_reason?: string;
|
|
45
|
-
}
|
|
46
|
-
export declare namespace DeploymentCreateResponse {
|
|
47
|
-
interface App {
|
|
48
|
-
/**
|
|
49
|
-
* ID for the app version deployed
|
|
50
|
-
*/
|
|
51
|
-
id: string;
|
|
52
|
-
/**
|
|
53
|
-
* List of actions available on the app
|
|
54
|
-
*/
|
|
55
|
-
actions: Array<Shared.AppAction>;
|
|
56
|
-
/**
|
|
57
|
-
* Name of the app
|
|
58
|
-
*/
|
|
59
|
-
name: string;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Union type representing any application event. Actual schema is determined by
|
|
64
|
-
* the 'event' field.
|
|
65
|
-
*/
|
|
66
|
-
export type DeploymentFollowResponse = DeploymentFollowResponse.StateEvent | DeploymentFollowResponse.StateUpdateEvent | Shared.LogEvent | Shared.HeartbeatEvent;
|
|
67
|
-
export declare namespace DeploymentFollowResponse {
|
|
68
|
-
/**
|
|
69
|
-
* Initial state of the application, emitted once when subscribing.
|
|
70
|
-
*/
|
|
71
|
-
interface StateEvent {
|
|
72
|
-
/**
|
|
73
|
-
* Event type identifier (always "state").
|
|
74
|
-
*/
|
|
75
|
-
event: 'state';
|
|
76
|
-
/**
|
|
77
|
-
* Current application state (e.g., "deploying", "running", "succeeded", "failed").
|
|
78
|
-
*/
|
|
79
|
-
state: string;
|
|
80
|
-
/**
|
|
81
|
-
* Time the state was reported.
|
|
82
|
-
*/
|
|
83
|
-
timestamp?: string;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* An update emitted when the application's state changes.
|
|
87
|
-
*/
|
|
88
|
-
interface StateUpdateEvent {
|
|
89
|
-
/**
|
|
90
|
-
* Event type identifier (always "state_update").
|
|
91
|
-
*/
|
|
92
|
-
event: 'state_update';
|
|
93
|
-
/**
|
|
94
|
-
* New application state (e.g., "running", "succeeded", "failed").
|
|
95
|
-
*/
|
|
96
|
-
state: string;
|
|
97
|
-
/**
|
|
98
|
-
* Time the state change occurred.
|
|
99
|
-
*/
|
|
100
|
-
timestamp?: string;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
export interface DeploymentCreateParams {
|
|
104
|
-
/**
|
|
105
|
-
* Relative path to the entrypoint of the application
|
|
106
|
-
*/
|
|
107
|
-
entrypoint_rel_path: string;
|
|
108
|
-
/**
|
|
109
|
-
* ZIP file containing the application source directory
|
|
110
|
-
*/
|
|
111
|
-
file: Uploadable;
|
|
112
|
-
/**
|
|
113
|
-
* Map of environment variables to set for the deployed application. Each key-value
|
|
114
|
-
* pair represents an environment variable.
|
|
115
|
-
*/
|
|
116
|
-
env_vars?: {
|
|
117
|
-
[key: string]: string;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Allow overwriting an existing app version
|
|
121
|
-
*/
|
|
122
|
-
force?: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Region for deployment. Currently we only support "aws.us-east-1a"
|
|
125
|
-
*/
|
|
126
|
-
region?: 'aws.us-east-1a';
|
|
127
|
-
/**
|
|
128
|
-
* Version of the application. Can be any string.
|
|
129
|
-
*/
|
|
130
|
-
version?: string;
|
|
131
|
-
}
|
|
132
|
-
export declare namespace Deployments {
|
|
133
|
-
export { type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentFollowResponse as DeploymentFollowResponse, type DeploymentCreateParams as DeploymentCreateParams, };
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/resources/apps/deployments.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAIpG;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;CAO3F;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAE1C;;OAEG;IACH,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC;IAExD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,yBAAiB,wBAAwB,CAAC;IACxC,UAAiB,GAAG;QAClB;;WAEG;QACH,EAAE,EAAE,MAAM,CAAC;QAEX;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEjC;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;KACd;CACF;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,wBAAwB,CAAC,UAAU,GACnC,wBAAwB,CAAC,gBAAgB,GACzC,MAAM,CAAC,QAAQ,GACf,MAAM,CAAC,cAAc,CAAC;AAE1B,yBAAiB,wBAAwB,CAAC;IACxC;;OAEG;IACH,UAAiB,UAAU;QACzB;;WAEG;QACH,KAAK,EAAE,OAAO,CAAC;QAEf;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAED;;OAEG;IACH,UAAiB,gBAAgB;QAC/B;;WAEG;QACH,KAAK,EAAE,cAAc,CAAC;QAEtB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
|
@@ -1,43 +0,0 @@
|
|
|
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.Deployments = void 0;
|
|
5
|
-
const resource_1 = require("../../core/resource.js");
|
|
6
|
-
const headers_1 = require("../../internal/headers.js");
|
|
7
|
-
const uploads_1 = require("../../internal/uploads.js");
|
|
8
|
-
const path_1 = require("../../internal/utils/path.js");
|
|
9
|
-
class Deployments extends resource_1.APIResource {
|
|
10
|
-
/**
|
|
11
|
-
* Deploy a new application and associated actions to Kernel.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const deployment = await client.apps.deployments.create({
|
|
16
|
-
* entrypoint_rel_path: 'src/app.py',
|
|
17
|
-
* file: fs.createReadStream('path/to/file'),
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
create(body, options) {
|
|
22
|
-
return this._client.post('/deploy', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
26
|
-
* status updates for a deployed application. The stream terminates automatically
|
|
27
|
-
* once the application reaches a terminal state.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* const response = await client.apps.deployments.follow('id');
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
follow(id, options) {
|
|
35
|
-
return this._client.get((0, path_1.path) `/apps/${id}/events`, {
|
|
36
|
-
...options,
|
|
37
|
-
headers: (0, headers_1.buildHeaders)([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
38
|
-
stream: true,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.Deployments = Deployments;
|
|
43
|
-
//# sourceMappingURL=deployments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../src/resources/apps/deployments.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,uDAAsD;AAEtD,uDAAqE;AACrE,uDAAiD;AAEjD,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,SAAS,EAAE,SAAS,EAAE;YAChD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAiD,CAAC;IACrD,CAAC;CACF;AAjCD,kCAiCC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
-
import { buildHeaders } from "../../internal/headers.mjs";
|
|
4
|
-
import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
|
|
5
|
-
import { path } from "../../internal/utils/path.mjs";
|
|
6
|
-
export class Deployments extends APIResource {
|
|
7
|
-
/**
|
|
8
|
-
* Deploy a new application and associated actions to Kernel.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const deployment = await client.apps.deployments.create({
|
|
13
|
-
* entrypoint_rel_path: 'src/app.py',
|
|
14
|
-
* file: fs.createReadStream('path/to/file'),
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
create(body, options) {
|
|
19
|
-
return this._client.post('/deploy', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
23
|
-
* status updates for a deployed application. The stream terminates automatically
|
|
24
|
-
* once the application reaches a terminal state.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const response = await client.apps.deployments.follow('id');
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
follow(id, options) {
|
|
32
|
-
return this._client.get(path `/apps/${id}/events`, {
|
|
33
|
-
...options,
|
|
34
|
-
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
35
|
-
stream: true,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=deployments.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.mjs","sourceRoot":"","sources":["../../src/resources/apps/deployments.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAKf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACvG,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,SAAS,EAAE,SAAS,EAAE;YAChD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAiD,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/apps/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,WAAW,EACX,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/apps/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,WAAW,EACX,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B"}
|
package/resources/apps/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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.Deployments = exports.Apps = void 0;
|
|
5
|
-
var apps_1 = require("./apps.js");
|
|
6
|
-
Object.defineProperty(exports, "Apps", { enumerable: true, get: function () { return apps_1.Apps; } });
|
|
7
|
-
var deployments_1 = require("./deployments.js");
|
|
8
|
-
Object.defineProperty(exports, "Deployments", { enumerable: true, get: function () { return deployments_1.Deployments; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/apps/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAAwE;AAA/D,4FAAA,IAAI,OAAA;AACb,gDAKuB;AAJrB,0GAAA,WAAW,OAAA"}
|
package/resources/apps/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/apps/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAA4C;OAClD,EACL,WAAW,GAIZ"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as Shared from '../shared';
|
|
5
|
-
import * as DeploymentsAPI from './deployments';
|
|
6
|
-
import {
|
|
7
|
-
DeploymentCreateParams,
|
|
8
|
-
DeploymentCreateResponse,
|
|
9
|
-
DeploymentFollowResponse,
|
|
10
|
-
Deployments,
|
|
11
|
-
} from './deployments';
|
|
12
|
-
import { APIPromise } from '../../core/api-promise';
|
|
13
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
14
|
-
|
|
15
|
-
export class Apps extends APIResource {
|
|
16
|
-
deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client);
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* List applications. Optionally filter by app name and/or version label.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const apps = await client.apps.list();
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise<AppListResponse> {
|
|
27
|
-
return this._client.get('/apps', { query, ...options });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type AppListResponse = Array<AppListResponse.AppListResponseItem>;
|
|
32
|
-
|
|
33
|
-
export namespace AppListResponse {
|
|
34
|
-
/**
|
|
35
|
-
* Summary of an application version.
|
|
36
|
-
*/
|
|
37
|
-
export interface AppListResponseItem {
|
|
38
|
-
/**
|
|
39
|
-
* Unique identifier for the app version
|
|
40
|
-
*/
|
|
41
|
-
id: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* List of actions available on the app
|
|
45
|
-
*/
|
|
46
|
-
actions: Array<Shared.AppAction>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Name of the application
|
|
50
|
-
*/
|
|
51
|
-
app_name: string;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Deployment ID
|
|
55
|
-
*/
|
|
56
|
-
deployment: string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Environment variables configured for this app version
|
|
60
|
-
*/
|
|
61
|
-
env_vars: { [key: string]: string };
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Deployment region code
|
|
65
|
-
*/
|
|
66
|
-
region: 'aws.us-east-1a';
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Version label for the application
|
|
70
|
-
*/
|
|
71
|
-
version: string;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface AppListParams {
|
|
76
|
-
/**
|
|
77
|
-
* Filter results by application name.
|
|
78
|
-
*/
|
|
79
|
-
app_name?: string;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Filter results by version label.
|
|
83
|
-
*/
|
|
84
|
-
version?: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Apps.Deployments = Deployments;
|
|
88
|
-
|
|
89
|
-
export declare namespace Apps {
|
|
90
|
-
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
|
|
91
|
-
|
|
92
|
-
export {
|
|
93
|
-
Deployments as Deployments,
|
|
94
|
-
type DeploymentCreateResponse as DeploymentCreateResponse,
|
|
95
|
-
type DeploymentFollowResponse as DeploymentFollowResponse,
|
|
96
|
-
type DeploymentCreateParams as DeploymentCreateParams,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as Shared from '../shared';
|
|
5
|
-
import { APIPromise } from '../../core/api-promise';
|
|
6
|
-
import { Stream } from '../../core/streaming';
|
|
7
|
-
import { type Uploadable } from '../../core/uploads';
|
|
8
|
-
import { buildHeaders } from '../../internal/headers';
|
|
9
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
10
|
-
import { multipartFormRequestOptions } from '../../internal/uploads';
|
|
11
|
-
import { path } from '../../internal/utils/path';
|
|
12
|
-
|
|
13
|
-
export class Deployments extends APIResource {
|
|
14
|
-
/**
|
|
15
|
-
* Deploy a new application and associated actions to Kernel.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const deployment = await client.apps.deployments.create({
|
|
20
|
-
* entrypoint_rel_path: 'src/app.py',
|
|
21
|
-
* file: fs.createReadStream('path/to/file'),
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
create(body: DeploymentCreateParams, options?: RequestOptions): APIPromise<DeploymentCreateResponse> {
|
|
26
|
-
return this._client.post('/deploy', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
31
|
-
* status updates for a deployed application. The stream terminates automatically
|
|
32
|
-
* once the application reaches a terminal state.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* const response = await client.apps.deployments.follow('id');
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
follow(id: string, options?: RequestOptions): APIPromise<Stream<DeploymentFollowResponse>> {
|
|
40
|
-
return this._client.get(path`/apps/${id}/events`, {
|
|
41
|
-
...options,
|
|
42
|
-
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
43
|
-
stream: true,
|
|
44
|
-
}) as APIPromise<Stream<DeploymentFollowResponse>>;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface DeploymentCreateResponse {
|
|
49
|
-
/**
|
|
50
|
-
* List of apps deployed
|
|
51
|
-
*/
|
|
52
|
-
apps: Array<DeploymentCreateResponse.App>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Current status of the deployment
|
|
56
|
-
*/
|
|
57
|
-
status: 'queued' | 'deploying' | 'succeeded' | 'failed';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Status reason
|
|
61
|
-
*/
|
|
62
|
-
status_reason?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export namespace DeploymentCreateResponse {
|
|
66
|
-
export interface App {
|
|
67
|
-
/**
|
|
68
|
-
* ID for the app version deployed
|
|
69
|
-
*/
|
|
70
|
-
id: string;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* List of actions available on the app
|
|
74
|
-
*/
|
|
75
|
-
actions: Array<Shared.AppAction>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Name of the app
|
|
79
|
-
*/
|
|
80
|
-
name: string;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Union type representing any application event. Actual schema is determined by
|
|
86
|
-
* the 'event' field.
|
|
87
|
-
*/
|
|
88
|
-
export type DeploymentFollowResponse =
|
|
89
|
-
| DeploymentFollowResponse.StateEvent
|
|
90
|
-
| DeploymentFollowResponse.StateUpdateEvent
|
|
91
|
-
| Shared.LogEvent
|
|
92
|
-
| Shared.HeartbeatEvent;
|
|
93
|
-
|
|
94
|
-
export namespace DeploymentFollowResponse {
|
|
95
|
-
/**
|
|
96
|
-
* Initial state of the application, emitted once when subscribing.
|
|
97
|
-
*/
|
|
98
|
-
export interface StateEvent {
|
|
99
|
-
/**
|
|
100
|
-
* Event type identifier (always "state").
|
|
101
|
-
*/
|
|
102
|
-
event: 'state';
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Current application state (e.g., "deploying", "running", "succeeded", "failed").
|
|
106
|
-
*/
|
|
107
|
-
state: string;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Time the state was reported.
|
|
111
|
-
*/
|
|
112
|
-
timestamp?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* An update emitted when the application's state changes.
|
|
117
|
-
*/
|
|
118
|
-
export interface StateUpdateEvent {
|
|
119
|
-
/**
|
|
120
|
-
* Event type identifier (always "state_update").
|
|
121
|
-
*/
|
|
122
|
-
event: 'state_update';
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* New application state (e.g., "running", "succeeded", "failed").
|
|
126
|
-
*/
|
|
127
|
-
state: string;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Time the state change occurred.
|
|
131
|
-
*/
|
|
132
|
-
timestamp?: string;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface DeploymentCreateParams {
|
|
137
|
-
/**
|
|
138
|
-
* Relative path to the entrypoint of the application
|
|
139
|
-
*/
|
|
140
|
-
entrypoint_rel_path: string;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* ZIP file containing the application source directory
|
|
144
|
-
*/
|
|
145
|
-
file: Uploadable;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Map of environment variables to set for the deployed application. Each key-value
|
|
149
|
-
* pair represents an environment variable.
|
|
150
|
-
*/
|
|
151
|
-
env_vars?: { [key: string]: string };
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Allow overwriting an existing app version
|
|
155
|
-
*/
|
|
156
|
-
force?: boolean;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Region for deployment. Currently we only support "aws.us-east-1a"
|
|
160
|
-
*/
|
|
161
|
-
region?: 'aws.us-east-1a';
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Version of the application. Can be any string.
|
|
165
|
-
*/
|
|
166
|
-
version?: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export declare namespace Deployments {
|
|
170
|
-
export {
|
|
171
|
-
type DeploymentCreateResponse as DeploymentCreateResponse,
|
|
172
|
-
type DeploymentFollowResponse as DeploymentFollowResponse,
|
|
173
|
-
type DeploymentCreateParams as DeploymentCreateParams,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
export { Apps, type AppListResponse, type AppListParams } from './apps';
|
|
4
|
-
export {
|
|
5
|
-
Deployments,
|
|
6
|
-
type DeploymentCreateResponse,
|
|
7
|
-
type DeploymentFollowResponse,
|
|
8
|
-
type DeploymentCreateParams,
|
|
9
|
-
} from './deployments';
|