@thallylabs/migrate 0.2.17 → 0.2.19

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/README.md CHANGED
@@ -11,7 +11,13 @@ authored nesting or order. The adapter supports tabs, dropdowns, products,
11
11
  versions, languages, and reusable `$ref` navigation files; it also preserves
12
12
  dropdown presentation, collection descriptions and icons, explicit default
13
13
  versions, page route casing, redirects, local snippets, static assets,
14
- compatible page frontmatter, site identity, and OpenAPI configuration. For public Mintlify
14
+ compatible page frontmatter, site identity, and OpenAPI configuration.
15
+ Analytics come across too: docs.json `integrations` and legacy mint.json
16
+ `analytics` for GA4, Google Tag Manager, PostHog, and Plausible are validated
17
+ and written to `docs.json` `integrations` (`integrations` wins per provider when
18
+ both exist). Invalid values are skipped with a warning, and every other
19
+ Mintlify provider (Amplitude, Mixpanel, Segment, and so on) is listed once in a
20
+ warning instead of being dropped silently. For public Mintlify
15
21
  sites, the URL adapter reads the structured configuration embedded in the
16
22
  rendered application before falling back to DOM link inference.
17
23
 
@@ -34,6 +40,13 @@ instead of silently dropping that API tab's reference. AsyncAPI has no Thally
34
40
  renderer, so it always produces a clear warning naming the spec instead of
35
41
  disappearing.
36
42
 
43
+ Page `openapi:` frontmatter with a spec prefix
44
+ (`openapi: "specs/openapi-b.yaml GET /widgets/{id}"`) is rewritten to where the
45
+ spec lands in the output (`/openapi-b.yaml GET /widgets/{id}`). A prefix naming
46
+ a spec that was not migrated is kept and reported. Manual API pages keep their
47
+ `api:` and `authMethod:` frontmatter, and `api.mdx.server` / `api.mdx.auth` map
48
+ into `docs.json`; invalid values are dropped with a warning.
49
+
37
50
  In-content links to auto-generated API operation pages are rewritten to the
38
51
  matching Thally `/api/...` route. A link under a known API section that matches
39
52
  no operation points to that section's overview page instead, and one warning
package/dist/index.d.ts CHANGED
@@ -128,6 +128,34 @@ interface MigrationDocsConfig {
128
128
  analytics?: {
129
129
  enabled?: boolean;
130
130
  };
131
+ /** Manual API pages: default server(s) and auth for `api:` frontmatter pages. */
132
+ api?: {
133
+ mdx?: {
134
+ server?: string | Array<string>;
135
+ auth?: {
136
+ method?: 'bearer' | 'basic' | 'key';
137
+ name?: string;
138
+ };
139
+ };
140
+ };
141
+ /** Third-party analytics in Mintlify's `integrations` shape; validated again by the renderer. */
142
+ integrations?: {
143
+ ga4?: {
144
+ measurementId: string;
145
+ };
146
+ gtm?: {
147
+ tagId: string;
148
+ };
149
+ posthog?: {
150
+ apiKey: string;
151
+ apiHost?: string;
152
+ sessionRecording?: boolean;
153
+ };
154
+ plausible?: {
155
+ domain: string;
156
+ server?: string;
157
+ };
158
+ };
131
159
  redirects?: Array<{
132
160
  source: string;
133
161
  destination: string;
@@ -161,6 +189,10 @@ interface MigrationPage {
161
189
  noindex?: boolean;
162
190
  /** OpenAPI operation key rendered by Thally instead of ordinary MDX. */
163
191
  openapi?: string;
192
+ /** Manual API page: `METHOD <url-or-path>`; rendered by Thally's playground. */
193
+ api?: string;
194
+ /** Page-level playground auth override: bearer | basic | key | none. */
195
+ authMethod?: string;
164
196
  body: string;
165
197
  source: string;
166
198
  /** Set when the page's frontmatter was invalid YAML; the page is kept with a best-effort salvage. */
@@ -445,8 +477,30 @@ declare function parseMarkdownPage(input: {
445
477
  platform?: MigrationPlatform;
446
478
  /** Resolve platform-specific routes from the already-parsed frontmatter. */
447
479
  resolveIdentity?: (frontmatter: Record<string, unknown>, fallback: MarkdownPageIdentity) => MarkdownPageIdentity;
480
+ /** Receives a message when frontmatter is dropped or altered. */
481
+ warn?: (message: string) => void;
448
482
  }): MigrationPage | null;
449
483
 
484
+ /**
485
+ * Mintlify analytics -> Thally `docs.json` `integrations`.
486
+ *
487
+ * Reads docs.json `integrations` and the legacy mint.json `analytics` block.
488
+ * Values land in an inline script on the rendered site, so each is validated
489
+ * here with the same patterns the renderer applies (src/lib/analytics-config.ts;
490
+ * a test keeps the two in agreement). Invalid values are skipped with a warning,
491
+ * never coerced, and no warning echoes a full value.
492
+ */
493
+ type MigrationIntegrations = NonNullable<MigrationDocsConfig['integrations']>;
494
+ declare function projectMintlifyIntegrations(config: Record<string, unknown>): {
495
+ integrations?: MigrationIntegrations;
496
+ warnings: Array<MigrationWarning>;
497
+ };
498
+ /**
499
+ * Validate an authored Thally `docs.json` `integrations` value with the same
500
+ * rules as the import and the renderer; one value-free message per problem.
501
+ */
502
+ declare function validateIntegrations(integrations: unknown): Array<string>;
503
+
450
504
  /** Render canonical migration bundles into a portable Thally repository tree. */
451
505
 
452
506
  /** Merge imported tabs into an existing site without duplicating changelog tabs. */
@@ -486,4 +540,4 @@ declare function migrateUrl(options: UrlMigrationOptions): Promise<MigrationBund
486
540
  */
487
541
  declare function hydrateRemoteApiSpecs(bundle: MigrationBundle, fetcher?: MigrationFetcher): Promise<MigrationBundle>;
488
542
 
489
- export { type GitHubRepositorySource, type MigrationAsset, type MigrationBundle, type MigrationDocsConfig, type MigrationFetchRequest, type MigrationFetchResponse, type MigrationFetcher, type MigrationNavigationGroup, type MigrationNavigationTab, type MigrationPage, type MigrationPlatform, type MigrationWarning, type RenderedMigrationFile, type RepositoryMigrationOptions, type UrlMigrationOptions, addMintlifyDirectoryRedirects, buildNavigationFromPages, cloneGitHubRepository, defaultMigrationFetcher, detectRepositoryDocsDir, detectRepositoryPlatform, gitmodulePaths, hydrateRemoteApiSpecs, mergeMigrationConfig, migrateRepository, migrateUrl, normalizeMdx, parseGitHubRepositoryUrl, parseMarkdownPage, projectFernNavigation, projectMintlifyNavigation, pruneMissingNavigationPages, readFernConfig, readMintlifyConfig, renderMigrationFiles, validateMigrationUrl };
543
+ export { type GitHubRepositorySource, type MigrationAsset, type MigrationBundle, type MigrationDocsConfig, type MigrationFetchRequest, type MigrationFetchResponse, type MigrationFetcher, type MigrationNavigationGroup, type MigrationNavigationTab, type MigrationPage, type MigrationPlatform, type MigrationWarning, type RenderedMigrationFile, type RepositoryMigrationOptions, type UrlMigrationOptions, addMintlifyDirectoryRedirects, buildNavigationFromPages, cloneGitHubRepository, defaultMigrationFetcher, detectRepositoryDocsDir, detectRepositoryPlatform, gitmodulePaths, hydrateRemoteApiSpecs, mergeMigrationConfig, migrateRepository, migrateUrl, normalizeMdx, parseGitHubRepositoryUrl, parseMarkdownPage, projectFernNavigation, projectMintlifyIntegrations, projectMintlifyNavigation, pruneMissingNavigationPages, readFernConfig, readMintlifyConfig, renderMigrationFiles, validateIntegrations, validateMigrationUrl };