@onkernel/sdk 0.5.0 → 0.6.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 +35 -0
- package/README.md +1 -1
- package/client.d.mts +15 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +15 -5
- package/client.d.ts.map +1 -1
- package/client.js +31 -22
- package/client.js.map +1 -1
- package/client.mjs +20 -11
- package/client.mjs.map +1 -1
- package/core/resource.d.mts +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/resource.js.map +1 -1
- package/core/resource.mjs.map +1 -1
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +4 -4
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +4 -4
- package/internal/headers.mjs.map +1 -1
- package/internal/request-options.d.mts +1 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +1 -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/internal/uploads.js +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/log.js +1 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.d.mts.map +1 -1
- package/internal/utils/path.d.ts.map +1 -1
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/values.d.mts +2 -0
- package/internal/utils/values.d.mts.map +1 -1
- package/internal/utils/values.d.ts +2 -0
- package/internal/utils/values.d.ts.map +1 -1
- package/internal/utils/values.js +4 -1
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +2 -0
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/apps/apps.d.mts +1 -5
- package/resources/apps/apps.d.mts.map +1 -1
- package/resources/apps/apps.d.ts +1 -5
- package/resources/apps/apps.d.ts.map +1 -1
- package/resources/apps/apps.js +0 -4
- package/resources/apps/apps.js.map +1 -1
- package/resources/apps/apps.mjs +0 -4
- package/resources/apps/apps.mjs.map +1 -1
- package/resources/apps/deployments.d.mts +2 -18
- package/resources/apps/deployments.d.mts.map +1 -1
- package/resources/apps/deployments.d.ts +2 -18
- package/resources/apps/deployments.d.ts.map +1 -1
- package/resources/apps/deployments.js.map +1 -1
- package/resources/apps/deployments.mjs.map +1 -1
- package/resources/apps/index.d.mts +0 -1
- package/resources/apps/index.d.mts.map +1 -1
- package/resources/apps/index.d.ts +0 -1
- package/resources/apps/index.d.ts.map +1 -1
- package/resources/apps/index.js +1 -3
- package/resources/apps/index.js.map +1 -1
- package/resources/apps/index.mjs +0 -1
- package/resources/apps/index.mjs.map +1 -1
- package/resources/deployments.d.mts +255 -0
- package/resources/deployments.d.mts.map +1 -0
- package/resources/deployments.d.ts +255 -0
- package/resources/deployments.d.ts.map +1 -0
- package/resources/deployments.js +54 -0
- package/resources/deployments.js.map +1 -0
- package/resources/deployments.mjs +50 -0
- package/resources/deployments.mjs.map +1 -0
- package/resources/index.d.mts +3 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/{apps/invocations.d.mts → invocations.d.mts} +82 -10
- package/resources/invocations.d.mts.map +1 -0
- package/resources/{apps/invocations.d.ts → invocations.d.ts} +82 -10
- package/resources/invocations.d.ts.map +1 -0
- package/resources/{apps/invocations.js → invocations.js} +25 -8
- package/resources/invocations.js.map +1 -0
- package/resources/invocations.mjs +65 -0
- package/resources/invocations.mjs.map +1 -0
- package/resources/shared.d.mts +57 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +57 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/src/client.ts +75 -11
- package/src/core/resource.ts +1 -1
- package/src/internal/headers.ts +5 -5
- package/src/internal/request-options.ts +1 -0
- package/src/internal/uploads.ts +2 -2
- package/src/internal/utils/log.ts +1 -1
- package/src/internal/utils/path.ts +1 -1
- package/src/internal/utils/values.ts +3 -0
- package/src/resources/apps/apps.ts +1 -21
- package/src/resources/apps/deployments.ts +2 -21
- package/src/resources/apps/index.ts +0 -8
- package/src/resources/deployments.ts +326 -0
- package/src/resources/index.ts +19 -0
- package/src/resources/{apps/invocations.ts → invocations.ts} +105 -10
- package/src/resources/shared.ts +69 -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/invocations.d.mts.map +0 -1
- package/resources/apps/invocations.d.ts.map +0 -1
- package/resources/apps/invocations.js.map +0 -1
- package/resources/apps/invocations.mjs +0 -48
- package/resources/apps/invocations.mjs.map +0 -1
|
@@ -9,6 +9,9 @@ export const isAbsoluteURL = (url: string): boolean => {
|
|
|
9
9
|
return startsWithSchemeRegexp.test(url);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
|
|
13
|
+
export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
|
|
14
|
+
|
|
12
15
|
/** Returns an object if the given value isn't an object, otherwise returns as-is */
|
|
13
16
|
export function maybeObj(x: unknown): object {
|
|
14
17
|
if (typeof x !== 'object') {
|
|
@@ -8,21 +8,11 @@ import {
|
|
|
8
8
|
DeploymentFollowResponse,
|
|
9
9
|
Deployments,
|
|
10
10
|
} from './deployments';
|
|
11
|
-
import * as InvocationsAPI from './invocations';
|
|
12
|
-
import {
|
|
13
|
-
InvocationCreateParams,
|
|
14
|
-
InvocationCreateResponse,
|
|
15
|
-
InvocationRetrieveResponse,
|
|
16
|
-
InvocationUpdateParams,
|
|
17
|
-
InvocationUpdateResponse,
|
|
18
|
-
Invocations,
|
|
19
|
-
} from './invocations';
|
|
20
11
|
import { APIPromise } from '../../core/api-promise';
|
|
21
12
|
import { RequestOptions } from '../../internal/request-options';
|
|
22
13
|
|
|
23
14
|
export class Apps extends APIResource {
|
|
24
15
|
deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client);
|
|
25
|
-
invocations: InvocationsAPI.Invocations = new InvocationsAPI.Invocations(this._client);
|
|
26
16
|
|
|
27
17
|
/**
|
|
28
18
|
* List applications. Optionally filter by app name and/or version label.
|
|
@@ -57,7 +47,7 @@ export namespace AppListResponse {
|
|
|
57
47
|
/**
|
|
58
48
|
* Deployment region code
|
|
59
49
|
*/
|
|
60
|
-
region:
|
|
50
|
+
region: 'aws.us-east-1a';
|
|
61
51
|
|
|
62
52
|
/**
|
|
63
53
|
* Version label for the application
|
|
@@ -84,7 +74,6 @@ export interface AppListParams {
|
|
|
84
74
|
}
|
|
85
75
|
|
|
86
76
|
Apps.Deployments = Deployments;
|
|
87
|
-
Apps.Invocations = Invocations;
|
|
88
77
|
|
|
89
78
|
export declare namespace Apps {
|
|
90
79
|
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
|
|
@@ -95,13 +84,4 @@ export declare namespace Apps {
|
|
|
95
84
|
type DeploymentFollowResponse as DeploymentFollowResponse,
|
|
96
85
|
type DeploymentCreateParams as DeploymentCreateParams,
|
|
97
86
|
};
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
Invocations as Invocations,
|
|
101
|
-
type InvocationCreateResponse as InvocationCreateResponse,
|
|
102
|
-
type InvocationRetrieveResponse as InvocationRetrieveResponse,
|
|
103
|
-
type InvocationUpdateResponse as InvocationUpdateResponse,
|
|
104
|
-
type InvocationCreateParams as InvocationCreateParams,
|
|
105
|
-
type InvocationUpdateParams as InvocationUpdateParams,
|
|
106
|
-
};
|
|
107
87
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as Shared from '../shared';
|
|
4
5
|
import { APIPromise } from '../../core/api-promise';
|
|
5
6
|
import { Stream } from '../../core/streaming';
|
|
6
7
|
import { type Uploadable } from '../../core/uploads';
|
|
@@ -96,7 +97,7 @@ export namespace DeploymentCreateResponse {
|
|
|
96
97
|
export type DeploymentFollowResponse =
|
|
97
98
|
| DeploymentFollowResponse.StateEvent
|
|
98
99
|
| DeploymentFollowResponse.StateUpdateEvent
|
|
99
|
-
|
|
|
100
|
+
| Shared.LogEvent;
|
|
100
101
|
|
|
101
102
|
export namespace DeploymentFollowResponse {
|
|
102
103
|
/**
|
|
@@ -138,26 +139,6 @@ export namespace DeploymentFollowResponse {
|
|
|
138
139
|
*/
|
|
139
140
|
timestamp?: string;
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* A log entry from the application.
|
|
144
|
-
*/
|
|
145
|
-
export interface LogEvent {
|
|
146
|
-
/**
|
|
147
|
-
* Event type identifier (always "log").
|
|
148
|
-
*/
|
|
149
|
-
event: 'log';
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Log message text.
|
|
153
|
-
*/
|
|
154
|
-
message: string;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Time the log entry was produced.
|
|
158
|
-
*/
|
|
159
|
-
timestamp?: string;
|
|
160
|
-
}
|
|
161
142
|
}
|
|
162
143
|
|
|
163
144
|
export interface DeploymentCreateParams {
|
|
@@ -7,11 +7,3 @@ export {
|
|
|
7
7
|
type DeploymentFollowResponse,
|
|
8
8
|
type DeploymentCreateParams,
|
|
9
9
|
} from './deployments';
|
|
10
|
-
export {
|
|
11
|
-
Invocations,
|
|
12
|
-
type InvocationCreateResponse,
|
|
13
|
-
type InvocationRetrieveResponse,
|
|
14
|
-
type InvocationUpdateResponse,
|
|
15
|
-
type InvocationCreateParams,
|
|
16
|
-
type InvocationUpdateParams,
|
|
17
|
-
} from './invocations';
|
|
@@ -0,0 +1,326 @@
|
|
|
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
|
+
* Create a new deployment.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const deployment = await client.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('/deployments', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get information about a deployment's status.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const deployment = await client.deployments.retrieve('id');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<DeploymentRetrieveResponse> {
|
|
38
|
+
return this._client.get(path`/deployments/${id}`, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
43
|
+
* status updates for a deployment. The stream terminates automatically once the
|
|
44
|
+
* deployment reaches a terminal state.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const response = await client.deployments.follow('id');
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
follow(id: string, options?: RequestOptions): APIPromise<Stream<DeploymentFollowResponse>> {
|
|
52
|
+
return this._client.get(path`/deployments/${id}/events`, {
|
|
53
|
+
...options,
|
|
54
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
55
|
+
stream: true,
|
|
56
|
+
}) as APIPromise<Stream<DeploymentFollowResponse>>;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* An event representing the current state of a deployment.
|
|
62
|
+
*/
|
|
63
|
+
export interface DeploymentStateEvent {
|
|
64
|
+
/**
|
|
65
|
+
* Deployment record information.
|
|
66
|
+
*/
|
|
67
|
+
deployment: DeploymentStateEvent.Deployment;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Event type identifier (always "deployment_state").
|
|
71
|
+
*/
|
|
72
|
+
event: 'deployment_state';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Time the state was reported.
|
|
76
|
+
*/
|
|
77
|
+
timestamp: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export namespace DeploymentStateEvent {
|
|
81
|
+
/**
|
|
82
|
+
* Deployment record information.
|
|
83
|
+
*/
|
|
84
|
+
export interface Deployment {
|
|
85
|
+
/**
|
|
86
|
+
* Unique identifier for the deployment
|
|
87
|
+
*/
|
|
88
|
+
id: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Timestamp when the deployment was created
|
|
92
|
+
*/
|
|
93
|
+
created_at: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Deployment region code
|
|
97
|
+
*/
|
|
98
|
+
region: 'aws.us-east-1a';
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Current status of the deployment
|
|
102
|
+
*/
|
|
103
|
+
status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Relative path to the application entrypoint
|
|
107
|
+
*/
|
|
108
|
+
entrypoint_rel_path?: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Environment variables configured for this deployment
|
|
112
|
+
*/
|
|
113
|
+
env_vars?: Record<string, string>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Status reason
|
|
117
|
+
*/
|
|
118
|
+
status_reason?: string;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Timestamp when the deployment was last updated
|
|
122
|
+
*/
|
|
123
|
+
updated_at?: string | null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Deployment record information.
|
|
129
|
+
*/
|
|
130
|
+
export interface DeploymentCreateResponse {
|
|
131
|
+
/**
|
|
132
|
+
* Unique identifier for the deployment
|
|
133
|
+
*/
|
|
134
|
+
id: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Timestamp when the deployment was created
|
|
138
|
+
*/
|
|
139
|
+
created_at: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Deployment region code
|
|
143
|
+
*/
|
|
144
|
+
region: 'aws.us-east-1a';
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Current status of the deployment
|
|
148
|
+
*/
|
|
149
|
+
status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Relative path to the application entrypoint
|
|
153
|
+
*/
|
|
154
|
+
entrypoint_rel_path?: string;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Environment variables configured for this deployment
|
|
158
|
+
*/
|
|
159
|
+
env_vars?: Record<string, string>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Status reason
|
|
163
|
+
*/
|
|
164
|
+
status_reason?: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Timestamp when the deployment was last updated
|
|
168
|
+
*/
|
|
169
|
+
updated_at?: string | null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Deployment record information.
|
|
174
|
+
*/
|
|
175
|
+
export interface DeploymentRetrieveResponse {
|
|
176
|
+
/**
|
|
177
|
+
* Unique identifier for the deployment
|
|
178
|
+
*/
|
|
179
|
+
id: string;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Timestamp when the deployment was created
|
|
183
|
+
*/
|
|
184
|
+
created_at: string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Deployment region code
|
|
188
|
+
*/
|
|
189
|
+
region: 'aws.us-east-1a';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Current status of the deployment
|
|
193
|
+
*/
|
|
194
|
+
status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Relative path to the application entrypoint
|
|
198
|
+
*/
|
|
199
|
+
entrypoint_rel_path?: string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Environment variables configured for this deployment
|
|
203
|
+
*/
|
|
204
|
+
env_vars?: Record<string, string>;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Status reason
|
|
208
|
+
*/
|
|
209
|
+
status_reason?: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Timestamp when the deployment was last updated
|
|
213
|
+
*/
|
|
214
|
+
updated_at?: string | null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Union type representing any deployment event.
|
|
219
|
+
*/
|
|
220
|
+
export type DeploymentFollowResponse =
|
|
221
|
+
| Shared.LogEvent
|
|
222
|
+
| DeploymentStateEvent
|
|
223
|
+
| DeploymentFollowResponse.AppVersionSummaryEvent
|
|
224
|
+
| Shared.ErrorEvent;
|
|
225
|
+
|
|
226
|
+
export namespace DeploymentFollowResponse {
|
|
227
|
+
/**
|
|
228
|
+
* Summary of an application version.
|
|
229
|
+
*/
|
|
230
|
+
export interface AppVersionSummaryEvent {
|
|
231
|
+
/**
|
|
232
|
+
* Unique identifier for the app version
|
|
233
|
+
*/
|
|
234
|
+
id: string;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* List of actions available on the app
|
|
238
|
+
*/
|
|
239
|
+
actions: Array<AppVersionSummaryEvent.Action>;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Name of the application
|
|
243
|
+
*/
|
|
244
|
+
app_name: string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Event type identifier (always "app_version_summary").
|
|
248
|
+
*/
|
|
249
|
+
event: 'app_version_summary';
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Deployment region code
|
|
253
|
+
*/
|
|
254
|
+
region: 'aws.us-east-1a';
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Time the state was reported.
|
|
258
|
+
*/
|
|
259
|
+
timestamp: string;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Version label for the application
|
|
263
|
+
*/
|
|
264
|
+
version: string;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Environment variables configured for this app version
|
|
268
|
+
*/
|
|
269
|
+
env_vars?: Record<string, string>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export namespace AppVersionSummaryEvent {
|
|
273
|
+
/**
|
|
274
|
+
* An action available on the app
|
|
275
|
+
*/
|
|
276
|
+
export interface Action {
|
|
277
|
+
/**
|
|
278
|
+
* Name of the action
|
|
279
|
+
*/
|
|
280
|
+
name: string;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface DeploymentCreateParams {
|
|
286
|
+
/**
|
|
287
|
+
* Relative path to the entrypoint of the application
|
|
288
|
+
*/
|
|
289
|
+
entrypoint_rel_path: string;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* ZIP file containing the application source directory
|
|
293
|
+
*/
|
|
294
|
+
file: Uploadable;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Map of environment variables to set for the deployed application. Each key-value
|
|
298
|
+
* pair represents an environment variable.
|
|
299
|
+
*/
|
|
300
|
+
env_vars?: Record<string, string>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Allow overwriting an existing app version
|
|
304
|
+
*/
|
|
305
|
+
force?: boolean;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Region for deployment. Currently we only support "aws.us-east-1a"
|
|
309
|
+
*/
|
|
310
|
+
region?: 'aws.us-east-1a';
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Version of the application. Can be any string.
|
|
314
|
+
*/
|
|
315
|
+
version?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare namespace Deployments {
|
|
319
|
+
export {
|
|
320
|
+
type DeploymentStateEvent as DeploymentStateEvent,
|
|
321
|
+
type DeploymentCreateResponse as DeploymentCreateResponse,
|
|
322
|
+
type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
|
|
323
|
+
type DeploymentFollowResponse as DeploymentFollowResponse,
|
|
324
|
+
type DeploymentCreateParams as DeploymentCreateParams,
|
|
325
|
+
};
|
|
326
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
export * from './shared';
|
|
3
4
|
export { Apps, type AppListResponse, type AppListParams } from './apps/apps';
|
|
4
5
|
export {
|
|
5
6
|
Browsers,
|
|
@@ -10,3 +11,21 @@ export {
|
|
|
10
11
|
type BrowserCreateParams,
|
|
11
12
|
type BrowserDeleteParams,
|
|
12
13
|
} from './browsers';
|
|
14
|
+
export {
|
|
15
|
+
Deployments,
|
|
16
|
+
type DeploymentStateEvent,
|
|
17
|
+
type DeploymentCreateResponse,
|
|
18
|
+
type DeploymentRetrieveResponse,
|
|
19
|
+
type DeploymentFollowResponse,
|
|
20
|
+
type DeploymentCreateParams,
|
|
21
|
+
} from './deployments';
|
|
22
|
+
export {
|
|
23
|
+
Invocations,
|
|
24
|
+
type InvocationStateEvent,
|
|
25
|
+
type InvocationCreateResponse,
|
|
26
|
+
type InvocationRetrieveResponse,
|
|
27
|
+
type InvocationUpdateResponse,
|
|
28
|
+
type InvocationFollowResponse,
|
|
29
|
+
type InvocationCreateParams,
|
|
30
|
+
type InvocationUpdateParams,
|
|
31
|
+
} from './invocations';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { buildHeaders } from '../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
7
10
|
|
|
8
11
|
export class Invocations extends APIResource {
|
|
9
12
|
/**
|
|
@@ -11,7 +14,7 @@ export class Invocations extends APIResource {
|
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```ts
|
|
14
|
-
* const invocation = await client.
|
|
17
|
+
* const invocation = await client.invocations.create({
|
|
15
18
|
* action_name: 'analyze',
|
|
16
19
|
* app_name: 'my-app',
|
|
17
20
|
* version: '1.0.0',
|
|
@@ -27,7 +30,7 @@ export class Invocations extends APIResource {
|
|
|
27
30
|
*
|
|
28
31
|
* @example
|
|
29
32
|
* ```ts
|
|
30
|
-
* const invocation = await client.
|
|
33
|
+
* const invocation = await client.invocations.retrieve(
|
|
31
34
|
* 'rr33xuugxj9h0bkf1rdt2bet',
|
|
32
35
|
* );
|
|
33
36
|
* ```
|
|
@@ -41,10 +44,9 @@ export class Invocations extends APIResource {
|
|
|
41
44
|
*
|
|
42
45
|
* @example
|
|
43
46
|
* ```ts
|
|
44
|
-
* const invocation = await client.
|
|
45
|
-
* '
|
|
46
|
-
*
|
|
47
|
-
* );
|
|
47
|
+
* const invocation = await client.invocations.update('id', {
|
|
48
|
+
* status: 'succeeded',
|
|
49
|
+
* });
|
|
48
50
|
* ```
|
|
49
51
|
*/
|
|
50
52
|
update(
|
|
@@ -54,6 +56,92 @@ export class Invocations extends APIResource {
|
|
|
54
56
|
): APIPromise<InvocationUpdateResponse> {
|
|
55
57
|
return this._client.patch(path`/invocations/${id}`, { body, ...options });
|
|
56
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
|
|
62
|
+
* status updates for an invocation. The stream terminates automatically once the
|
|
63
|
+
* invocation reaches a terminal state.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const response = await client.invocations.follow('id');
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
follow(id: string, options?: RequestOptions): APIPromise<Stream<InvocationFollowResponse>> {
|
|
71
|
+
return this._client.get(path`/invocations/${id}/events`, {
|
|
72
|
+
...options,
|
|
73
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
74
|
+
stream: true,
|
|
75
|
+
}) as APIPromise<Stream<InvocationFollowResponse>>;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* An event representing the current state of an invocation.
|
|
81
|
+
*/
|
|
82
|
+
export interface InvocationStateEvent {
|
|
83
|
+
/**
|
|
84
|
+
* Event type identifier (always "invocation_state").
|
|
85
|
+
*/
|
|
86
|
+
event: 'invocation_state';
|
|
87
|
+
|
|
88
|
+
invocation: InvocationStateEvent.Invocation;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Time the state was reported.
|
|
92
|
+
*/
|
|
93
|
+
timestamp: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export namespace InvocationStateEvent {
|
|
97
|
+
export interface Invocation {
|
|
98
|
+
/**
|
|
99
|
+
* ID of the invocation
|
|
100
|
+
*/
|
|
101
|
+
id: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Name of the action invoked
|
|
105
|
+
*/
|
|
106
|
+
action_name: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Name of the application
|
|
110
|
+
*/
|
|
111
|
+
app_name: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* RFC 3339 Nanoseconds timestamp when the invocation started
|
|
115
|
+
*/
|
|
116
|
+
started_at: string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Status of the invocation
|
|
120
|
+
*/
|
|
121
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
|
|
125
|
+
* running)
|
|
126
|
+
*/
|
|
127
|
+
finished_at?: string | null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Output produced by the action, rendered as a JSON string. This could be: string,
|
|
131
|
+
* number, boolean, array, object, or null.
|
|
132
|
+
*/
|
|
133
|
+
output?: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Payload provided to the invocation. This is a string that can be parsed as JSON.
|
|
137
|
+
*/
|
|
138
|
+
payload?: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Status reason
|
|
142
|
+
*/
|
|
143
|
+
status_reason?: string;
|
|
144
|
+
}
|
|
57
145
|
}
|
|
58
146
|
|
|
59
147
|
export interface InvocationCreateResponse {
|
|
@@ -177,6 +265,11 @@ export interface InvocationUpdateResponse {
|
|
|
177
265
|
status_reason?: string;
|
|
178
266
|
}
|
|
179
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Union type representing any invocation event.
|
|
270
|
+
*/
|
|
271
|
+
export type InvocationFollowResponse = Shared.LogEvent | InvocationStateEvent | Shared.ErrorEvent;
|
|
272
|
+
|
|
180
273
|
export interface InvocationCreateParams {
|
|
181
274
|
/**
|
|
182
275
|
* Name of the action to invoke
|
|
@@ -219,9 +312,11 @@ export interface InvocationUpdateParams {
|
|
|
219
312
|
|
|
220
313
|
export declare namespace Invocations {
|
|
221
314
|
export {
|
|
315
|
+
type InvocationStateEvent as InvocationStateEvent,
|
|
222
316
|
type InvocationCreateResponse as InvocationCreateResponse,
|
|
223
317
|
type InvocationRetrieveResponse as InvocationRetrieveResponse,
|
|
224
318
|
type InvocationUpdateResponse as InvocationUpdateResponse,
|
|
319
|
+
type InvocationFollowResponse as InvocationFollowResponse,
|
|
225
320
|
type InvocationCreateParams as InvocationCreateParams,
|
|
226
321
|
type InvocationUpdateParams as InvocationUpdateParams,
|
|
227
322
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export interface ErrorDetail {
|
|
4
|
+
/**
|
|
5
|
+
* Lower-level error code providing more specific detail
|
|
6
|
+
*/
|
|
7
|
+
code?: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Further detail about the error
|
|
11
|
+
*/
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An error event from the application.
|
|
17
|
+
*/
|
|
18
|
+
export interface ErrorEvent {
|
|
19
|
+
error: ErrorModel;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Event type identifier (always "error").
|
|
23
|
+
*/
|
|
24
|
+
event: 'error';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Time the error occurred.
|
|
28
|
+
*/
|
|
29
|
+
timestamp: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ErrorModel {
|
|
33
|
+
/**
|
|
34
|
+
* Application-specific error code (machine-readable)
|
|
35
|
+
*/
|
|
36
|
+
code: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Human-readable error description for debugging
|
|
40
|
+
*/
|
|
41
|
+
message: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Additional error details (for multiple errors)
|
|
45
|
+
*/
|
|
46
|
+
details?: Array<ErrorDetail>;
|
|
47
|
+
|
|
48
|
+
inner_error?: ErrorDetail;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A log entry from the application.
|
|
53
|
+
*/
|
|
54
|
+
export interface LogEvent {
|
|
55
|
+
/**
|
|
56
|
+
* Event type identifier (always "log").
|
|
57
|
+
*/
|
|
58
|
+
event: 'log';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Log message text.
|
|
62
|
+
*/
|
|
63
|
+
message: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Time the log entry was produced.
|
|
67
|
+
*/
|
|
68
|
+
timestamp: string;
|
|
69
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.6.0'; // x-release-please-version
|