pabal-store-api-mcp 1.3.15 → 1.3.16
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.
|
@@ -6,6 +6,29 @@ import { verifyAppStoreAuth } from "../../packages/stores/app-store/verify-auth.
|
|
|
6
6
|
import { createAppStoreClient } from "../../core/clients/app-store-factory.js";
|
|
7
7
|
import { parseAppStoreScreenshots, hasScreenshots, APP_STORE_DEVICE_TYPES, } from "../../core/helpers/screenshot-helpers.js";
|
|
8
8
|
import { checkPushPrerequisites, serviceFailure, toServiceResult, updateRegisteredLocales, } from "./service-helpers.js";
|
|
9
|
+
const APP_STORE_RELEASE_NOTES_UPDATE_CONCURRENCY = 5;
|
|
10
|
+
const updateReleaseNotesWithConcurrency = async (options) => {
|
|
11
|
+
const { locales, concurrency, update } = options;
|
|
12
|
+
const results = new Array(locales.length);
|
|
13
|
+
let nextIndex = 0;
|
|
14
|
+
const workerCount = Math.min(concurrency, locales.length);
|
|
15
|
+
await Promise.all(Array.from({ length: workerCount }, async () => {
|
|
16
|
+
while (nextIndex < locales.length) {
|
|
17
|
+
const currentIndex = nextIndex;
|
|
18
|
+
nextIndex += 1;
|
|
19
|
+
const locale = locales[currentIndex];
|
|
20
|
+
try {
|
|
21
|
+
await update(locale);
|
|
22
|
+
results[currentIndex] = { locale };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26
|
+
results[currentIndex] = { locale, error: message };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
return results;
|
|
31
|
+
};
|
|
9
32
|
export function resolveAppStoreLocales(allLocales, requestedLocales) {
|
|
10
33
|
if (!requestedLocales?.length) {
|
|
11
34
|
return { localesToPush: allLocales, missingLocales: [] };
|
|
@@ -111,22 +134,19 @@ export class AppStoreService {
|
|
|
111
134
|
const localesToUpdate = supportedLocales
|
|
112
135
|
? Object.keys(releaseNotes).filter((locale) => supportedLocales.includes(locale))
|
|
113
136
|
: Object.keys(releaseNotes);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
failed.push({ locale, error: msg });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
137
|
+
const updateResults = await updateReleaseNotesWithConcurrency({
|
|
138
|
+
locales: localesToUpdate,
|
|
139
|
+
concurrency: APP_STORE_RELEASE_NOTES_UPDATE_CONCURRENCY,
|
|
140
|
+
update: (locale) => client.updateWhatsNew({
|
|
141
|
+
versionId: targetVersionId,
|
|
142
|
+
locale,
|
|
143
|
+
whatsNew: releaseNotes[locale],
|
|
144
|
+
}),
|
|
145
|
+
});
|
|
146
|
+
const updated = updateResults
|
|
147
|
+
.filter((result) => !result.error)
|
|
148
|
+
.map((result) => result.locale);
|
|
149
|
+
const failed = updateResults.flatMap((result) => result.error ? [{ locale: result.locale, error: result.error }] : []);
|
|
130
150
|
const success = failed.length === 0;
|
|
131
151
|
const partialError = !success
|
|
132
152
|
? AppError.wrap(failed[0]?.error ?? "Failed to update some release notes", HTTP_STATUS.INTERNAL_SERVER_ERROR, ERROR_CODES.APP_STORE_UPDATE_RELEASE_NOTES_PARTIAL)
|