@myapihq/sdk 2.6.2 → 2.7.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/dist/container.d.ts +28 -1
- package/dist/container.js +26 -4
- package/dist/crm.d.ts +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/container.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface CreatePayload {
|
|
|
30
30
|
min_instances?: number;
|
|
31
31
|
max_instances?: number;
|
|
32
32
|
port?: number;
|
|
33
|
+
health_check?: string;
|
|
33
34
|
}
|
|
34
35
|
export interface CreateResponse {
|
|
35
36
|
container: Container;
|
|
@@ -42,12 +43,38 @@ export interface DeployResponse {
|
|
|
42
43
|
url: string;
|
|
43
44
|
status: string;
|
|
44
45
|
scoped_api_key: string;
|
|
46
|
+
promoted?: boolean;
|
|
47
|
+
revision_url?: string;
|
|
48
|
+
message?: string;
|
|
45
49
|
}
|
|
46
50
|
export declare function createContainer(apiKey: string, orgId: string, payload: CreatePayload): Promise<CreateResponse>;
|
|
47
51
|
export declare function listContainers(apiKey: string, orgId: string): Promise<Container[]>;
|
|
48
52
|
export declare function getContainer(apiKey: string, orgId: string, containerId: string): Promise<Container>;
|
|
49
53
|
export declare function deleteContainer(apiKey: string, orgId: string, containerId: string): Promise<void>;
|
|
50
|
-
export
|
|
54
|
+
export interface SmokeCheck {
|
|
55
|
+
path?: string;
|
|
56
|
+
method?: 'GET' | 'HEAD';
|
|
57
|
+
status?: number;
|
|
58
|
+
contains?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface Revision {
|
|
61
|
+
revision: string;
|
|
62
|
+
ready: boolean;
|
|
63
|
+
serving: boolean;
|
|
64
|
+
traffic_percent: number;
|
|
65
|
+
created_at: string;
|
|
66
|
+
}
|
|
67
|
+
export interface DeployOptions {
|
|
68
|
+
promote?: boolean;
|
|
69
|
+
smoke?: SmokeCheck;
|
|
70
|
+
}
|
|
71
|
+
export declare function deployContainer(apiKey: string, orgId: string, containerId: string, image: string, opts?: DeployOptions): Promise<DeployResponse>;
|
|
72
|
+
export declare function listRevisions(apiKey: string, orgId: string, containerId: string): Promise<Revision[]>;
|
|
73
|
+
export declare function promoteRevision(apiKey: string, orgId: string, containerId: string, revision?: string): Promise<{
|
|
74
|
+
revision?: string;
|
|
75
|
+
serving?: string;
|
|
76
|
+
message?: string;
|
|
77
|
+
}>;
|
|
51
78
|
export interface BuildDeployResponse {
|
|
52
79
|
container_id: string;
|
|
53
80
|
revision_id: string;
|
package/dist/container.js
CHANGED
|
@@ -6,6 +6,8 @@ exports.listContainers = listContainers;
|
|
|
6
6
|
exports.getContainer = getContainer;
|
|
7
7
|
exports.deleteContainer = deleteContainer;
|
|
8
8
|
exports.deployContainer = deployContainer;
|
|
9
|
+
exports.listRevisions = listRevisions;
|
|
10
|
+
exports.promoteRevision = promoteRevision;
|
|
9
11
|
exports.deployContainerSource = deployContainerSource;
|
|
10
12
|
exports.getContainerLogs = getContainerLogs;
|
|
11
13
|
exports.bindDomain = bindDomain;
|
|
@@ -22,6 +24,8 @@ exports.EXPOSES = [
|
|
|
22
24
|
'GET /container/orgs/{org_id}/containers/{id}',
|
|
23
25
|
'DELETE /container/orgs/{org_id}/containers/{id}',
|
|
24
26
|
'POST /container/orgs/{org_id}/containers/{id}/deploy',
|
|
27
|
+
'GET /container/orgs/{org_id}/containers/{id}/revisions',
|
|
28
|
+
'POST /container/orgs/{org_id}/containers/{id}/promote',
|
|
25
29
|
'GET /container/orgs/{org_id}/containers/{id}/logs',
|
|
26
30
|
'POST /container/orgs/{org_id}/containers/{id}/domain',
|
|
27
31
|
'DELETE /container/orgs/{org_id}/containers/{id}/domain',
|
|
@@ -39,10 +43,28 @@ async function getContainer(apiKey, orgId, containerId) {
|
|
|
39
43
|
async function deleteContainer(apiKey, orgId, containerId) {
|
|
40
44
|
return (0, client_1.request)('DELETE', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}`, apiKey);
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
async function deployContainer(apiKey, orgId, containerId, image, opts = {}) {
|
|
47
|
+
const body = { image };
|
|
48
|
+
if (opts.promote === false)
|
|
49
|
+
body.promote = false;
|
|
50
|
+
if (opts.smoke)
|
|
51
|
+
body.smoke = opts.smoke;
|
|
52
|
+
return (0, client_1.request)('POST', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/deploy`, apiKey, body);
|
|
53
|
+
}
|
|
54
|
+
// listRevisions reads from the runtime, newest first.
|
|
55
|
+
async function listRevisions(apiKey, orgId, containerId) {
|
|
56
|
+
const res = await (0, client_1.request)('GET', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/revisions`, apiKey);
|
|
57
|
+
return res?.revisions ?? [];
|
|
58
|
+
}
|
|
59
|
+
// promoteRevision moves ALL traffic to one revision. A traffic shift only —
|
|
60
|
+
// no build, no new revision — so it completes in seconds.
|
|
61
|
+
//
|
|
62
|
+
// Omitting `revision` rolls back to the previous ready revision. Promote and
|
|
63
|
+
// rollback are deliberately the same call with a different target, which is
|
|
64
|
+
// why there is no separate rollback function here: two functions could drift
|
|
65
|
+
// apart, and the API models them as one operation.
|
|
66
|
+
async function promoteRevision(apiKey, orgId, containerId, revision) {
|
|
67
|
+
return (0, client_1.request)('POST', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}/promote`, apiKey, revision ? { revision } : {});
|
|
46
68
|
}
|
|
47
69
|
// deployContainerSource uploads a build-context tarball via multipart `source`
|
|
48
70
|
// (backend deploy.go builds it via Cloud Build → Artifact Registry, then
|
package/dist/crm.d.ts
CHANGED
|
@@ -67,10 +67,12 @@ export interface ContactSearchFilter {
|
|
|
67
67
|
max_last_engagement_days?: number;
|
|
68
68
|
include_deleted?: boolean;
|
|
69
69
|
limit?: number;
|
|
70
|
+
offset?: number;
|
|
70
71
|
}
|
|
71
72
|
export interface ContactSearchResult {
|
|
72
73
|
contacts: Contact[];
|
|
73
74
|
total: number;
|
|
75
|
+
has_more?: boolean;
|
|
74
76
|
}
|
|
75
77
|
export interface CreateCompanyInput {
|
|
76
78
|
domain?: string | null;
|
|
@@ -91,10 +93,12 @@ export interface CompanySearchFilter {
|
|
|
91
93
|
domain?: string;
|
|
92
94
|
include_deleted?: boolean;
|
|
93
95
|
limit?: number;
|
|
96
|
+
offset?: number;
|
|
94
97
|
}
|
|
95
98
|
export interface CompanySearchResult {
|
|
96
99
|
companies: Company[];
|
|
97
100
|
total: number;
|
|
101
|
+
has_more?: boolean;
|
|
98
102
|
}
|
|
99
103
|
export interface EventsResponse {
|
|
100
104
|
events: ContactEvent[];
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.7.0";
|
package/dist/version.js
CHANGED
|
@@ -8,4 +8,4 @@ exports.SDK_VERSION = void 0;
|
|
|
8
8
|
// Why a constant and not a package.json read: the SDK runs inside edge
|
|
9
9
|
// functions (Cloudflare Workers), so it must not import node:fs. A literal
|
|
10
10
|
// is the only version source that works in every runtime we ship to.
|
|
11
|
-
exports.SDK_VERSION = '2.
|
|
11
|
+
exports.SDK_VERSION = '2.7.0';
|