@phala/cloud 0.6.0 → 0.6.1

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/index.js CHANGED
@@ -969,7 +969,7 @@ function defaultUserAgent(runtime = globalThis) {
969
969
  if (runtime.window !== void 0 && runtime.document !== void 0) {
970
970
  return void 0;
971
971
  }
972
- const product = "phala-cloud-sdk-js/0.6.0";
972
+ const product = "phala-cloud-sdk-js/0.6.1";
973
973
  const token = runtimeToken(runtime);
974
974
  return token ? `${product} ${token}` : product;
975
975
  }
@@ -8293,8 +8293,19 @@ async function getCvmLogEndpoint(client, id, channel) {
8293
8293
  }
8294
8294
  return endpoint;
8295
8295
  }
8296
+ function containerLogsDisabledError() {
8297
+ return new LogAccessError({
8298
+ code: "ERR-17-006",
8299
+ message: "Container logs are disabled",
8300
+ httpStatus: 409
8301
+ });
8302
+ }
8296
8303
  async function getContainerLogEndpoint(client, id, containerName, matchContainerIdPrefix = true) {
8297
8304
  const cvmId = resolveCvmId(id);
8305
+ const info = await getCvmInfoLogs(client, cvmId);
8306
+ if (info.public_logs === false) {
8307
+ throw containerLogsDisabledError();
8308
+ }
8298
8309
  const composition = await client.get(`/cvms/${cvmId}/composition`);
8299
8310
  if (!composition.containers?.length) {
8300
8311
  throw new Error(`No containers found for CVM '${cvmId}'`);
package/dist/index.mjs CHANGED
@@ -440,7 +440,7 @@ function defaultUserAgent(runtime = globalThis) {
440
440
  if (runtime.window !== void 0 && runtime.document !== void 0) {
441
441
  return void 0;
442
442
  }
443
- const product = "phala-cloud-sdk-js/0.6.0";
443
+ const product = "phala-cloud-sdk-js/0.6.1";
444
444
  const token = runtimeToken(runtime);
445
445
  return token ? `${product} ${token}` : product;
446
446
  }
@@ -7796,8 +7796,19 @@ async function getCvmLogEndpoint(client, id, channel) {
7796
7796
  }
7797
7797
  return endpoint;
7798
7798
  }
7799
+ function containerLogsDisabledError() {
7800
+ return new LogAccessError({
7801
+ code: "ERR-17-006",
7802
+ message: "Container logs are disabled",
7803
+ httpStatus: 409
7804
+ });
7805
+ }
7799
7806
  async function getContainerLogEndpoint(client, id, containerName, matchContainerIdPrefix = true) {
7800
7807
  const cvmId = resolveCvmId(id);
7808
+ const info = await getCvmInfoLogs(client, cvmId);
7809
+ if (info.public_logs === false) {
7810
+ throw containerLogsDisabledError();
7811
+ }
7801
7812
  const composition = await client.get(`/cvms/${cvmId}/composition`);
7802
7813
  if (!composition.containers?.length) {
7803
7814
  throw new Error(`No containers found for CVM '${cvmId}'`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phala/cloud",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "TypeScript SDK for Phala Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",