@pmate/cli 0.24.28 → 0.24.29

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.d.ts CHANGED
@@ -936,6 +936,15 @@ type ServiceCommandArgs = {
936
936
  history: boolean;
937
937
  search?: string;
938
938
  follow: boolean;
939
+ } | {
940
+ type: Command.Service;
941
+ action: "deploy-logs" | "deploy-history";
942
+ namespace: string;
943
+ name: string;
944
+ env?: string;
945
+ page: number;
946
+ baseUrl?: string;
947
+ json: boolean;
939
948
  } | {
940
949
  type: Command.Service;
941
950
  action: "env-list";
package/dist/index.js CHANGED
@@ -18226,6 +18226,16 @@ var ServiceRegistryClient = class {
18226
18226
  input
18227
18227
  );
18228
18228
  }
18229
+ async listDeployHistory(serviceId, options = {}) {
18230
+ const params = new URLSearchParams();
18231
+ if (options.page !== void 0) {
18232
+ params.set("page", String(options.page));
18233
+ }
18234
+ return this.request(
18235
+ "GET",
18236
+ `/services/by-id/${encodeURIComponent(serviceId)}/deploy-history${params.size > 0 ? `?${params.toString()}` : ""}`
18237
+ );
18238
+ }
18229
18239
  async pullEnv(serviceId, options) {
18230
18240
  const pathname = `/services/by-id/${encodeURIComponent(serviceId)}/env/pull`;
18231
18241
  const response = await fetch(`${this.resolveBaseUrl()}${pathname}`, {
@@ -19829,6 +19839,22 @@ var ServiceCommandHandler = class {
19829
19839
  });
19830
19840
  return;
19831
19841
  }
19842
+ case "deploy-logs":
19843
+ case "deploy-history": {
19844
+ const serviceId = formatNamespacedDisplayId(args.namespace, args.name);
19845
+ const payload = await registry.listDeployHistory(serviceId, {
19846
+ page: args.page
19847
+ });
19848
+ const items = args.env ? payload.items.filter((item) => item.environment === args.env) : payload.items;
19849
+ this.renderDeployHistory(
19850
+ {
19851
+ ...payload,
19852
+ items
19853
+ },
19854
+ args.json
19855
+ );
19856
+ return;
19857
+ }
19832
19858
  case "env-list": {
19833
19859
  const payload = await this.request(
19834
19860
  baseUrl,
@@ -20328,6 +20354,22 @@ var ServiceCommandHandler = class {
20328
20354
  ui.info(formatNamespacedDisplayId(item.namespace, item.name), item);
20329
20355
  }
20330
20356
  }
20357
+ renderDeployHistory(payload, asJson) {
20358
+ if (asJson) {
20359
+ ui.plain(JSON.stringify(payload, null, 2));
20360
+ return;
20361
+ }
20362
+ if (payload.items.length === 0) {
20363
+ ui.warn(`No deploy logs found for ${payload.serviceId}.`);
20364
+ return;
20365
+ }
20366
+ for (const item of payload.items) {
20367
+ const time = new Date(item.createdAt).toISOString();
20368
+ const status = item.status === "success" ? "success" : "failed";
20369
+ const message = item.message ? ` ${item.message}` : "";
20370
+ ui.info(`${time} ${item.environment} ${status}${message}`, item);
20371
+ }
20372
+ }
20331
20373
  async deleteServiceResources(service) {
20332
20374
  switch (this.getServiceType(service)) {
20333
20375
  case "vite":
@@ -22877,7 +22919,7 @@ function parseServiceArgs(tokens) {
22877
22919
  json
22878
22920
  };
22879
22921
  }
22880
- if (action === "get" || action === "delete" || action === "deploy" || action === "stop" || action === "init" || action === "log") {
22922
+ if (action === "get" || action === "delete" || action === "deploy" || action === "stop" || action === "init" || action === "log" || action === "deploy-logs" || action === "deploy-history") {
22881
22923
  const ref = rest.shift();
22882
22924
  if (!ref || ref.startsWith("-")) {
22883
22925
  throw new Error(`Usage: service ${action} <ns:objectId> [--base-url <url>] [--json]`);
@@ -22901,7 +22943,7 @@ function parseServiceArgs(tokens) {
22901
22943
  cwd = requireValue6(rest, token);
22902
22944
  break;
22903
22945
  case "--env":
22904
- if (action !== "deploy" && action !== "init" && action !== "stop") {
22946
+ if (action !== "deploy" && action !== "init" && action !== "stop" && action !== "deploy-logs" && action !== "deploy-history") {
22905
22947
  throw new Error(`Unknown service ${action} option: ${token}`);
22906
22948
  }
22907
22949
  env = requireValue6(rest, token);
@@ -22932,6 +22974,9 @@ function parseServiceArgs(tokens) {
22932
22974
  if (action === "log") {
22933
22975
  return { type: "service" /* Service */, action, namespace, name, baseUrl, json, page, history, search, follow };
22934
22976
  }
22977
+ if (action === "deploy-logs" || action === "deploy-history") {
22978
+ return { type: "service" /* Service */, action, namespace, name, env, page, baseUrl, json };
22979
+ }
22935
22980
  if (action === "deploy" || action === "stop") {
22936
22981
  if (action === "deploy" && !env) {
22937
22982
  throw new Error("Missing required option --env for service deploy");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.24.28",
3
+ "version": "0.24.29",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {