@pitcher/cli-scripts 2.0.2 → 2.0.4

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.
@@ -7,7 +7,7 @@ import FormData from "form-data";
7
7
  import { fileURLToPath } from "url";
8
8
  async function fetchAllInstances(baseUrl, apiKey) {
9
9
  const pageSize = 100;
10
- const maxPages = 1000;
10
+ const maxPages = 50;
11
11
  try {
12
12
  console.log("Fetching instances page 1 to determine total count...");
13
13
  const firstResponse = await axios.get(`${baseUrl}/api/v1/instances`, {
@@ -61,9 +61,10 @@ async function fetchAllInstances(baseUrl, apiKey) {
61
61
  }
62
62
  }
63
63
  function filterInstancesByEnvName(instances, envName) {
64
- const normalizedEnvName = envName.toLowerCase();
65
- const filtered = instances.filter((instance) => instance.env_name &&
66
- instance.env_name.toLowerCase() === normalizedEnvName);
64
+ const filtered = instances.filter((instance) => {
65
+ console.log(instance.environment?.name.toLowerCase(), envName.toLowerCase());
66
+ return instance.environment?.name.toLowerCase() === envName.toLowerCase();
67
+ });
67
68
  if (filtered.length === 0) {
68
69
  console.warn(`No instances found with environment name "${envName}"`);
69
70
  }
@@ -94,8 +95,8 @@ async function installAppToInstances(baseUrl, apiKey, appName, instances) {
94
95
  }
95
96
  const instanceIds = instances.map((inst) => inst.id);
96
97
  console.log(`\nInstalling app "${appName}" to ${instances.length} instance(s):`);
97
- instances.forEach((inst) => {
98
- console.log(` - ${inst.id}${inst.env_name ? ` (${inst.env_name})` : ""}${inst.name ? ` - ${inst.name}` : ""}`);
98
+ instances.forEach((i) => {
99
+ console.log(` - ${i.id}${i.environment?.name ? ` (${i.environment.name})` : ""}${i.name ? ` - ${i.name}` : ""}`);
99
100
  });
100
101
  try {
101
102
  const response = await axios.post(`${baseUrl}/api/v1/apps/${appName}/install/`, { instance_ids: instanceIds }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitcher/cli-scripts",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "The Pitcher CLI for various tasks in its ecosystem.",
5
5
  "author": "Pitcher AG",
6
6
  "license": "MIT",