fix(cloudly-client): correct Cloudly request handling for cluster config, cluster updates, and image pushes
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-05-08 - 5.3.7 - fix(cloudly-client)
|
||||||
|
correct Cloudly request handling for cluster config, cluster updates, and image pushes
|
||||||
|
|
||||||
|
- Return the full cluster config response instead of only configData to match the typed request contract
|
||||||
|
- Use the provided identity when requesting certificates and include clusterId in cluster update requests
|
||||||
|
- Send the actual image version during pushes and fail early when Cloudly rejects the upload
|
||||||
|
|
||||||
## 2026-05-08 - 5.3.6 - fix(deps)
|
## 2026-05-08 - 5.3.6 - fix(deps)
|
||||||
bump @api.global/typedrequest and @api.global/typedsocket patch versions
|
bump @api.global/typedrequest and @api.global/typedsocket patch versions
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/api',
|
name: '@serve.zone/api',
|
||||||
version: '5.3.6',
|
version: '5.3.7',
|
||||||
description: 'Type-safe API client for Cloudly and the serve.zone control plane.'
|
description: 'Type-safe API client for Cloudly and the serve.zone control plane.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class CloudlyApiClient {
|
|||||||
*/
|
*/
|
||||||
public async getClusterConfigFromCloudlyByIdentity(
|
public async getClusterConfigFromCloudlyByIdentity(
|
||||||
identityArg: plugins.servezoneInterfaces.data.IIdentity = this.identity
|
identityArg: plugins.servezoneInterfaces.data.IIdentity = this.identity
|
||||||
): Promise<plugins.servezoneInterfaces.data.ICluster> {
|
): Promise<plugins.servezoneInterfaces.requests.config.IRequest_Any_Cloudly_GetClusterConfig['response']> {
|
||||||
const clusterConfigRequest =
|
const clusterConfigRequest =
|
||||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.config.IRequest_Any_Cloudly_GetClusterConfig>(
|
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.config.IRequest_Any_Cloudly_GetClusterConfig>(
|
||||||
'getClusterConfig'
|
'getClusterConfig'
|
||||||
@@ -133,7 +133,7 @@ export class CloudlyApiClient {
|
|||||||
const response = await clusterConfigRequest.fire({
|
const response = await clusterConfigRequest.fire({
|
||||||
identity: identityArg,
|
identity: identityArg,
|
||||||
});
|
});
|
||||||
return response.configData;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +170,7 @@ export class CloudlyApiClient {
|
|||||||
'getCertificateForDomain'
|
'getCertificateForDomain'
|
||||||
);
|
);
|
||||||
const typedResponse = await typedCertificateRequest.fire({
|
const typedResponse = await typedCertificateRequest.fire({
|
||||||
identity: this.identity, // do proper auth here
|
identity: optionsArg.identity,
|
||||||
domainName: optionsArg.domainName,
|
domainName: optionsArg.domainName,
|
||||||
type: optionsArg.type,
|
type: optionsArg.type,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,8 +61,9 @@ export class Cluster implements plugins.servezoneInterfaces.data.ICluster {
|
|||||||
);
|
);
|
||||||
const response = await updateClusterTR.fire({
|
const response = await updateClusterTR.fire({
|
||||||
identity: this.cloudlyClientRef.identity,
|
identity: this.cloudlyClientRef.identity,
|
||||||
|
clusterId: this.id,
|
||||||
clusterData: this.data,
|
clusterData: this.data,
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
const resultClusterData = response.resultCluster.data;
|
const resultClusterData = response.resultCluster.data;
|
||||||
plugins.smartexpect.expect(resultClusterData).toEqual(this.data);
|
plugins.smartexpect.expect(resultClusterData).toEqual(this.data);
|
||||||
|
|||||||
+4
-1
@@ -86,9 +86,12 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
|||||||
const response = await pushImageTR.fire({
|
const response = await pushImageTR.fire({
|
||||||
identity: this.cloudlyClientRef.identity,
|
identity: this.cloudlyClientRef.identity,
|
||||||
imageId: this.id,
|
imageId: this.id,
|
||||||
versionString: '',
|
versionString: imageVersion,
|
||||||
imageStream: virtualStream,
|
imageStream: virtualStream,
|
||||||
});
|
});
|
||||||
|
if (!response.allowed) {
|
||||||
|
throw new Error(`Cloudly rejected image push for ${this.id}:${imageVersion}`);
|
||||||
|
}
|
||||||
await virtualStream.readFromWebstream(imageReadableArg);
|
await virtualStream.readFromWebstream(imageReadableArg);
|
||||||
await this.update();
|
await this.update();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user