pabal-store-api-mcp 1.3.1 → 1.3.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.
@@ -1,8 +1,10 @@
1
1
  import { AppError } from "../../packages/common/errors/app-error.js";
2
2
  import { ERROR_CODES } from "../../packages/common/errors/error-codes.js";
3
3
  import { HTTP_STATUS } from "../../packages/common/errors/status-codes.js";
4
+ import { getAsoPushDir } from "../../packages/configs/aso-config/utils.js";
4
5
  import { verifyAppStoreAuth } from "../../packages/stores/app-store/verify-auth.js";
5
6
  import { createAppStoreClient } from "../../core/clients/app-store-factory.js";
7
+ import { parseAppStoreScreenshots, hasScreenshots, APP_STORE_DEVICE_TYPES, } from "../../core/helpers/screenshot-helpers.js";
6
8
  import { checkPushPrerequisites, serviceFailure, toServiceResult, updateRegisteredLocales, } from "./service-helpers.js";
7
9
  /**
8
10
  * App Store-facing service layer that wraps client creation and common operations.
@@ -197,56 +199,96 @@ export class AppStoreService {
197
199
  // Upload screenshots if enabled
198
200
  if (uploadImages && slug) {
199
201
  console.error(`[AppStore] 📤 Uploading screenshots...`);
200
- const { getAsoPushDir } = await import("../../packages/configs/aso-config/utils.js");
201
- const { parseAppStoreScreenshots, hasScreenshots } = await import("../../core/helpers/screenshot-helpers.js");
202
202
  const pushDataDir = getAsoPushDir();
203
- const screenshotsBaseDir = `${pushDataDir}/products/${slug}/store/app-store/screenshots`;
203
+ const screenshotsBaseDir = `${pushDataDir}/products/${slug}/store`;
204
204
  const uploadedLocales = [];
205
205
  const skippedLocales = [];
206
206
  const failedLocales = [];
207
207
  for (const locale of localesToPush) {
208
208
  try {
209
- if (!hasScreenshots(screenshotsBaseDir, locale)) {
210
- console.error(`[AppStore] ⏭️ Skipping ${locale} - no screenshots directory`);
211
- skippedLocales.push(locale);
212
- continue;
209
+ const localeData = appStoreData.locales[locale];
210
+ // Check if screenshots are defined in aso-data.json
211
+ const hasScreenshotsInJson = localeData?.screenshots &&
212
+ ((localeData.screenshots.iphone65 &&
213
+ localeData.screenshots.iphone65.length > 0) ||
214
+ (localeData.screenshots.ipadPro129 &&
215
+ localeData.screenshots.ipadPro129.length > 0));
216
+ let screenshotsToUpload = [];
217
+ if (hasScreenshotsInJson) {
218
+ // Use screenshots from aso-data.json (relative paths)
219
+ console.error(`[AppStore] 📋 Using screenshots from aso-data.json for ${locale}`);
220
+ const relativePaths = localeData.screenshots;
221
+ // Map iphone65 screenshots
222
+ if (relativePaths.iphone65 && relativePaths.iphone65.length > 0) {
223
+ for (const relPath of relativePaths.iphone65) {
224
+ screenshotsToUpload.push({
225
+ path: `${screenshotsBaseDir}/${relPath}`,
226
+ displayType: APP_STORE_DEVICE_TYPES.iphone65,
227
+ filename: relPath.split("/").pop() || relPath,
228
+ });
229
+ }
230
+ }
231
+ // Map ipadPro129 screenshots
232
+ if (relativePaths.ipadPro129 &&
233
+ relativePaths.ipadPro129.length > 0) {
234
+ for (const relPath of relativePaths.ipadPro129) {
235
+ screenshotsToUpload.push({
236
+ path: `${screenshotsBaseDir}/${relPath}`,
237
+ displayType: APP_STORE_DEVICE_TYPES.ipadPro129,
238
+ filename: relPath.split("/").pop() || relPath,
239
+ });
240
+ }
241
+ }
213
242
  }
214
- const result = parseAppStoreScreenshots(screenshotsBaseDir, locale);
215
- // Check if there are any valid screenshots
216
- const totalScreenshots = Object.values(result.valid).reduce((sum, screenshots) => sum + screenshots.length, 0);
217
- if (totalScreenshots === 0) {
243
+ else {
244
+ // Fallback: Parse from file system (backward compatibility)
245
+ const screenshotsFsDir = `${screenshotsBaseDir}/app-store/screenshots`;
246
+ if (!hasScreenshots(screenshotsFsDir, locale)) {
247
+ console.error(`[AppStore] ⏭️ Skipping ${locale} - no screenshots in aso-data.json or file system`);
248
+ skippedLocales.push(locale);
249
+ continue;
250
+ }
251
+ console.error(`[AppStore] 📂 Parsing screenshots from file system for ${locale}`);
252
+ const result = parseAppStoreScreenshots(screenshotsFsDir, locale);
253
+ // Report parsing issues
254
+ if (result.invalid.length > 0) {
255
+ console.error(`[AppStore] ⚠️ Invalid filenames: ${result.invalid.join(", ")}`);
256
+ }
257
+ if (result.unknown.length > 0) {
258
+ console.error(`[AppStore] ⚠️ Unknown device types: ${result.unknown.join(", ")}`);
259
+ }
260
+ // Convert parsed screenshots to upload format
261
+ for (const [displayType, screenshots] of Object.entries(result.valid)) {
262
+ for (const screenshot of screenshots) {
263
+ screenshotsToUpload.push({
264
+ path: screenshot.path,
265
+ displayType,
266
+ filename: screenshot.filename,
267
+ });
268
+ }
269
+ }
270
+ }
271
+ if (screenshotsToUpload.length === 0) {
218
272
  console.error(`[AppStore] ⚠️ Skipping ${locale} - no valid screenshots found`);
219
273
  skippedLocales.push(locale);
220
274
  continue;
221
275
  }
222
276
  console.error(`[AppStore] 📤 Uploading screenshots for ${locale}...`);
223
- // Report parsing issues
224
- if (result.invalid.length > 0) {
225
- console.error(`[AppStore] ⚠️ Invalid filenames: ${result.invalid.join(", ")}`);
226
- }
227
- if (result.unknown.length > 0) {
228
- console.error(`[AppStore] ⚠️ Unknown device types: ${result.unknown.join(", ")}`);
229
- }
230
- // Upload screenshots for each device type
231
- for (const [displayType, screenshots] of Object.entries(result.valid)) {
232
- if (screenshots.length === 0)
233
- continue;
234
- console.error(`[AppStore] 📱 Uploading ${screenshots.length} screenshots for ${displayType}...`);
235
- for (const screenshot of screenshots) {
236
- try {
237
- await client.uploadScreenshot({
238
- imagePath: screenshot.path,
239
- screenshotDisplayType: displayType,
240
- locale,
241
- });
242
- console.error(`[AppStore] ✅ ${screenshot.filename}`);
243
- }
244
- catch (uploadError) {
245
- const msg = uploadError instanceof Error
246
- ? uploadError.message
247
- : String(uploadError);
248
- console.error(`[AppStore] ❌ ${screenshot.filename}: ${msg}`);
249
- }
277
+ // Upload screenshots
278
+ for (const screenshot of screenshotsToUpload) {
279
+ try {
280
+ await client.uploadScreenshot({
281
+ imagePath: screenshot.path,
282
+ screenshotDisplayType: screenshot.displayType,
283
+ locale,
284
+ });
285
+ console.error(`[AppStore] ${screenshot.filename}`);
286
+ }
287
+ catch (uploadError) {
288
+ const msg = uploadError instanceof Error
289
+ ? uploadError.message
290
+ : String(uploadError);
291
+ console.error(`[AppStore] ❌ ${screenshot.filename}: ${msg}`);
250
292
  }
251
293
  }
252
294
  uploadedLocales.push(locale);
@@ -1,8 +1,10 @@
1
1
  import { AppError } from "../../packages/common/errors/app-error.js";
2
2
  import { ERROR_CODES } from "../../packages/common/errors/error-codes.js";
3
3
  import { HTTP_STATUS } from "../../packages/common/errors/status-codes.js";
4
+ import { getAsoPushDir } from "../../packages/configs/aso-config/utils.js";
4
5
  import { verifyPlayStoreAuth } from "../../packages/stores/play-store/verify-auth.js";
5
6
  import { createGooglePlayClient } from "../../core/clients/google-play-factory.js";
7
+ import { parseGooglePlayScreenshots, hasScreenshots, } from "../../core/helpers/screenshot-helpers.js";
6
8
  import { checkPushPrerequisites, serviceFailure, toServiceResult, updateRegisteredLocales, } from "./service-helpers.js";
7
9
  /**
8
10
  * Google Play-facing service layer that wraps client creation and common operations.
@@ -181,21 +183,47 @@ export class GooglePlayService {
181
183
  // Upload screenshots if enabled
182
184
  if (uploadImages && slug) {
183
185
  console.error(`[GooglePlay] 📤 Uploading screenshots...`);
184
- const { getAsoPushDir } = await import("../../packages/configs/aso-config/utils.js");
185
- const { parseGooglePlayScreenshots, hasScreenshots } = await import("../../core/helpers/screenshot-helpers.js");
186
186
  const pushDataDir = getAsoPushDir();
187
- const screenshotsBaseDir = `${pushDataDir}/products/${slug}/store/google-play/screenshots`;
187
+ const screenshotsBaseDir = `${pushDataDir}/products/${slug}/store`;
188
188
  const uploadedLocales = [];
189
189
  const skippedLocales = [];
190
190
  const failedLocales = [];
191
191
  for (const locale of localesToPush) {
192
192
  try {
193
- if (!hasScreenshots(screenshotsBaseDir, locale)) {
194
- console.error(`[GooglePlay] ⏭️ Skipping ${locale} - no screenshots directory`);
195
- skippedLocales.push(locale);
196
- continue;
193
+ const localeData = googlePlayData.locales[locale];
194
+ // Check if screenshots are defined in aso-data.json
195
+ const hasScreenshotsInJson = localeData?.screenshots &&
196
+ ((localeData.screenshots.phone &&
197
+ localeData.screenshots.phone.length > 0) ||
198
+ (localeData.screenshots.tablet7 &&
199
+ localeData.screenshots.tablet7.length > 0) ||
200
+ (localeData.screenshots.tablet10 &&
201
+ localeData.screenshots.tablet10.length > 0));
202
+ let screenshots;
203
+ if (hasScreenshotsInJson) {
204
+ // Use screenshots from aso-data.json (relative paths)
205
+ console.error(`[GooglePlay] 📋 Using screenshots from aso-data.json for ${locale}`);
206
+ const relativePaths = localeData.screenshots;
207
+ screenshots = {
208
+ phone: (relativePaths.phone || []).map((p) => `${screenshotsBaseDir}/${p}`),
209
+ tablet7: (relativePaths.tablet7 || []).map((p) => `${screenshotsBaseDir}/${p}`),
210
+ tablet10: (relativePaths.tablet10 || []).map((p) => `${screenshotsBaseDir}/${p}`),
211
+ featureGraphic: localeData.featureGraphic
212
+ ? `${screenshotsBaseDir}/${localeData.featureGraphic}`
213
+ : null,
214
+ };
215
+ }
216
+ else {
217
+ // Fallback: Parse from file system (backward compatibility)
218
+ const screenshotsFsDir = `${screenshotsBaseDir}/google-play/screenshots`;
219
+ if (!hasScreenshots(screenshotsFsDir, locale)) {
220
+ console.error(`[GooglePlay] ⏭️ Skipping ${locale} - no screenshots in aso-data.json or file system`);
221
+ skippedLocales.push(locale);
222
+ continue;
223
+ }
224
+ console.error(`[GooglePlay] 📂 Parsing screenshots from file system for ${locale}`);
225
+ screenshots = parseGooglePlayScreenshots(screenshotsFsDir, locale);
197
226
  }
198
- const screenshots = parseGooglePlayScreenshots(screenshotsBaseDir, locale);
199
227
  // Google Play requires minimum 2 phone screenshots
200
228
  const phoneCount = screenshots.phone.length + screenshots.tablet7.length;
201
229
  if (phoneCount < 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pabal-store-api-mcp",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "MCP server for App Store / Play Store ASO workflows",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",