@myapihq/sdk 1.2.7 → 1.2.8
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/dist/container.d.ts +6 -0
- package/dist/container.js +9 -0
- package/package.json +1 -1
- package/src/container.ts +16 -0
package/dist/container.d.ts
CHANGED
|
@@ -46,3 +46,9 @@ export declare function listContainers(apiKey: string, orgId: string): Promise<C
|
|
|
46
46
|
export declare function getContainer(apiKey: string, orgId: string, containerId: string): Promise<Container>;
|
|
47
47
|
export declare function deleteContainer(apiKey: string, orgId: string, containerId: string): Promise<void>;
|
|
48
48
|
export declare function deployContainer(apiKey: string, orgId: string, containerId: string, image: string): Promise<DeployResponse>;
|
|
49
|
+
export interface LogEntry {
|
|
50
|
+
timestamp: string;
|
|
51
|
+
severity: string;
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
export declare function getContainerLogs(apiKey: string, orgId: string, containerId: string, tail?: number): Promise<LogEntry[]>;
|
package/dist/container.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.listContainers = listContainers;
|
|
|
6
6
|
exports.getContainer = getContainer;
|
|
7
7
|
exports.deleteContainer = deleteContainer;
|
|
8
8
|
exports.deployContainer = deployContainer;
|
|
9
|
+
exports.getContainerLogs = getContainerLogs;
|
|
9
10
|
const client_1 = require("./client");
|
|
10
11
|
const config_1 = require("./config");
|
|
11
12
|
// Backend: my-container-api per myapi-hq/internal/routes/container/. Phase 1
|
|
@@ -17,6 +18,7 @@ exports.EXPOSES = [
|
|
|
17
18
|
'GET /container/orgs/{org_id}/containers/{id}',
|
|
18
19
|
'DELETE /container/orgs/{org_id}/containers/{id}',
|
|
19
20
|
'POST /container/orgs/{org_id}/containers/{id}/deploy',
|
|
21
|
+
'GET /container/orgs/{org_id}/containers/{id}/logs',
|
|
20
22
|
];
|
|
21
23
|
async function createContainer(apiKey, orgId, payload) {
|
|
22
24
|
return (0, client_1.request)('POST', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers`, apiKey, payload);
|
|
@@ -35,3 +37,10 @@ async function deleteContainer(apiKey, orgId, containerId) {
|
|
|
35
37
|
async function deployContainer(apiKey, orgId, containerId, image) {
|
|
36
38
|
return (0, client_1.request)('POST', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/deploy`, apiKey, { image });
|
|
37
39
|
}
|
|
40
|
+
// getContainerLogs returns recent runtime log entries, newest first.
|
|
41
|
+
// `tail` caps the count (default 100, max 1000 server-side). An
|
|
42
|
+
// undeployed container returns an empty array.
|
|
43
|
+
async function getContainerLogs(apiKey, orgId, containerId, tail) {
|
|
44
|
+
const query = tail ? `?tail=${encodeURIComponent(String(tail))}` : '';
|
|
45
|
+
return (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/logs${query}`, apiKey);
|
|
46
|
+
}
|
package/package.json
CHANGED
package/src/container.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const EXPOSES: Exposes = [
|
|
|
11
11
|
'GET /container/orgs/{org_id}/containers/{id}',
|
|
12
12
|
'DELETE /container/orgs/{org_id}/containers/{id}',
|
|
13
13
|
'POST /container/orgs/{org_id}/containers/{id}/deploy',
|
|
14
|
+
'GET /container/orgs/{org_id}/containers/{id}/logs',
|
|
14
15
|
];
|
|
15
16
|
|
|
16
17
|
// service = HTTP server, worker = always-on background process, job = runs
|
|
@@ -88,3 +89,18 @@ export async function deleteContainer(apiKey: string, orgId: string, containerId
|
|
|
88
89
|
export async function deployContainer(apiKey: string, orgId: string, containerId: string, image: string): Promise<DeployResponse> {
|
|
89
90
|
return request('POST', `${BASE_URL}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/deploy`, apiKey, { image });
|
|
90
91
|
}
|
|
92
|
+
|
|
93
|
+
// One runtime log line from the container's Cloud Run resource.
|
|
94
|
+
export interface LogEntry {
|
|
95
|
+
timestamp: string;
|
|
96
|
+
severity: string;
|
|
97
|
+
text: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// getContainerLogs returns recent runtime log entries, newest first.
|
|
101
|
+
// `tail` caps the count (default 100, max 1000 server-side). An
|
|
102
|
+
// undeployed container returns an empty array.
|
|
103
|
+
export async function getContainerLogs(apiKey: string, orgId: string, containerId: string, tail?: number): Promise<LogEntry[]> {
|
|
104
|
+
const query = tail ? `?tail=${encodeURIComponent(String(tail))}` : '';
|
|
105
|
+
return request('GET', `${BASE_URL}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/logs${query}`, apiKey);
|
|
106
|
+
}
|