@myapihq/sdk 2.28.0 → 2.28.2
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 +17 -3
- package/dist/container.js +38 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/container.d.ts
CHANGED
|
@@ -51,9 +51,23 @@ export interface DeployResponse {
|
|
|
51
51
|
}
|
|
52
52
|
export declare function createContainer(apiKey: string, orgId: string, payload: CreatePayload): Promise<CreateResponse>;
|
|
53
53
|
export declare function listContainers(apiKey: string, orgId: string): Promise<Container[]>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
54
|
+
/**
|
|
55
|
+
* Reads a container. Environment VALUES come back as the string `"set"` unless
|
|
56
|
+
* `reveal` is passed — the names are always visible, the values are not.
|
|
57
|
+
*
|
|
58
|
+
* The redaction is right: this response used to return every secret in clear,
|
|
59
|
+
* and a customer keeps their document master key in it. But it shipped without
|
|
60
|
+
* a client that could ask for the values, so between that deploy and this
|
|
61
|
+
* change `container get` was the only way to read an env var back and it
|
|
62
|
+
* answered `"set"` for all of them. Setting a variable and verifying it are
|
|
63
|
+
* different operations, and only one of them worked.
|
|
64
|
+
*
|
|
65
|
+
* Two whole template literals rather than a concatenation: the coverage linter
|
|
66
|
+
* resolves the URL statically.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getContainer(apiKey: string, orgId: string, containerId: string, opts?: {
|
|
69
|
+
reveal?: boolean;
|
|
70
|
+
}): Promise<Container>;
|
|
57
71
|
export interface EnvUpdate {
|
|
58
72
|
set: string[];
|
|
59
73
|
removed: string[];
|
package/dist/container.js
CHANGED
|
@@ -43,9 +43,36 @@ async function listContainers(apiKey, orgId) {
|
|
|
43
43
|
// complete answer into a partial one.
|
|
44
44
|
return (0, client_1.requestAll)(`${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers`, apiKey);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Reads a container. Environment VALUES come back as the string `"set"` unless
|
|
48
|
+
* `reveal` is passed — the names are always visible, the values are not.
|
|
49
|
+
*
|
|
50
|
+
* The redaction is right: this response used to return every secret in clear,
|
|
51
|
+
* and a customer keeps their document master key in it. But it shipped without
|
|
52
|
+
* a client that could ask for the values, so between that deploy and this
|
|
53
|
+
* change `container get` was the only way to read an env var back and it
|
|
54
|
+
* answered `"set"` for all of them. Setting a variable and verifying it are
|
|
55
|
+
* different operations, and only one of them worked.
|
|
56
|
+
*
|
|
57
|
+
* Two whole template literals rather than a concatenation: the coverage linter
|
|
58
|
+
* resolves the URL statically.
|
|
59
|
+
*/
|
|
60
|
+
async function getContainer(apiKey, orgId, containerId, opts) {
|
|
61
|
+
const url = opts?.reveal
|
|
62
|
+
? `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}?reveal=true`
|
|
63
|
+
: `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}`;
|
|
64
|
+
return (0, client_1.request)('GET', url, apiKey);
|
|
48
65
|
}
|
|
66
|
+
/** The result of an environment change. `env` is the RESULT of the merge, so a
|
|
67
|
+
* caller never has to GET afterwards to see what a PATCH did. */
|
|
68
|
+
/**
|
|
69
|
+
* Deadline for calls that roll a container revision.
|
|
70
|
+
*
|
|
71
|
+
* Five minutes because the platform advertises "~4 minutes" for a source build
|
|
72
|
+
* and a revision roll is the same machinery without the build step. The SDK's
|
|
73
|
+
* 120s default is a read timeout and is wrong for these.
|
|
74
|
+
*/
|
|
75
|
+
const REVISION_ROLL_TIMEOUT_MS = 300_000;
|
|
49
76
|
/**
|
|
50
77
|
* Change environment variables on an existing container.
|
|
51
78
|
*
|
|
@@ -68,7 +95,15 @@ async function getContainer(apiKey, orgId, containerId) {
|
|
|
68
95
|
* takes a patch rather than one named field.
|
|
69
96
|
*/
|
|
70
97
|
async function updateContainer(apiKey, orgId, containerId, patch) {
|
|
71
|
-
|
|
98
|
+
// A revision roll, not a metadata write: the server redeploys on the same
|
|
99
|
+
// image before answering. That regularly outlasts the SDK's 120s default —
|
|
100
|
+
// `container health-check` timed out at exactly 120000ms against a real
|
|
101
|
+
// container — and the CLI's own deploy text says a build is "typically ~4
|
|
102
|
+
// minutes", so the client was giving up at half the time it advertises.
|
|
103
|
+
//
|
|
104
|
+
// A timeout here is the worst kind of answer, because PATCH is not safely
|
|
105
|
+
// retryable: the caller cannot tell whether the change landed. Better to wait.
|
|
106
|
+
return (0, client_1.request)('PATCH', `${config_1.CONTAINER_BASE}/container/orgs/${encodeURIComponent(orgId)}/containers/${encodeURIComponent(containerId)}`, apiKey, patch, undefined, { timeoutMs: REVISION_ROLL_TIMEOUT_MS });
|
|
72
107
|
}
|
|
73
108
|
/** Environment-only shorthand for {@link updateContainer}. */
|
|
74
109
|
async function updateContainerEnv(apiKey, orgId, containerId, env) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.28.
|
|
1
|
+
export declare const SDK_VERSION = "2.28.2";
|
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.28.
|
|
11
|
+
exports.SDK_VERSION = '2.28.2';
|