@mintlify/prebuild 1.0.1208 → 1.0.1209

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.
@@ -161,13 +161,14 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
161
161
  const tempNav = [];
162
162
  const tempDecoratedNav = [];
163
163
  const writePromises = [];
164
+ let generatedSlugs = [];
164
165
  if (isWebhook) {
165
166
  const webhooks = schema.webhooks;
166
167
  const webhookMatch = findOpenApiPath(webhooks, endpoint);
167
168
  if (!webhookMatch) {
168
169
  throw new Error(`Webhook ${endpoint} not found in ${openapiPath}. ${webhooks ? `Available webhooks: ${Object.keys(webhooks).join(', ')}` : ''}`.trim());
169
170
  }
170
- processOpenApiWebhook(webhookMatch.pathKey, webhookMatch.pathItem, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
171
+ generatedSlugs = processOpenApiWebhook(webhookMatch.pathKey, webhookMatch.pathItem, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
171
172
  openApiFilePath: openApiFile.originalFileLocation,
172
173
  writeFiles,
173
174
  outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
@@ -187,7 +188,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
187
188
  if (!opObject) {
188
189
  throw new Error(`Method ${method.toUpperCase()} for endpoint ${match.pathKey} not found in ${openapiPath}`);
189
190
  }
190
- processOpenApiPath(match.pathKey, { [method.toLowerCase()]: opObject }, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
191
+ generatedSlugs = processOpenApiPath(match.pathKey, { [method.toLowerCase()]: opObject }, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
191
192
  openApiFilePath: openApiFile.originalFileLocation,
192
193
  writeFiles,
193
194
  outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
@@ -198,23 +199,9 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
198
199
  }, findNavGroup);
199
200
  }
200
201
  await Promise.all(writePromises);
201
- let slug;
202
- const firstEntry = tempNav[0];
203
- if (firstEntry &&
204
- typeof firstEntry === 'object' &&
205
- 'pages' in firstEntry &&
206
- Array.isArray(firstEntry.pages) &&
207
- firstEntry.pages.length > 0) {
208
- slug = firstEntry.pages[0];
209
- }
210
- else if (typeof firstEntry === 'string') {
211
- slug = firstEntry;
212
- }
213
- else {
214
- slug = Object.keys(pagesAcc).pop();
215
- }
202
+ const slug = generatedSlugs[0];
216
203
  if (!slug) {
217
- throw new Error('Failed to generate OpenAPI endpoint page');
204
+ throw new Error(`Failed to generate OpenAPI endpoint page for ${method.toUpperCase()} ${endpoint} in ${openapiPath}`);
218
205
  }
219
206
  if (currentOpenApiOwner && !explicitOpenapiPath) {
220
207
  skipBulkForNodeId.add(currentOpenApiOwner);