@mintlify/common 1.0.472 → 1.0.474

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.
@@ -0,0 +1,3 @@
1
+ export declare function registerXMintContent(slug: string, content?: string): void;
2
+ export declare function getXMintContent(slug: string): string | undefined;
3
+ export declare function getAllXMintContent(): Map<string, string>;
@@ -0,0 +1,11 @@
1
+ const registry = new Map();
2
+ export function registerXMintContent(slug, content) {
3
+ if (content)
4
+ registry.set(slug, content);
5
+ }
6
+ export function getXMintContent(slug) {
7
+ return registry.get(slug);
8
+ }
9
+ export function getAllXMintContent() {
10
+ return new Map(registry);
11
+ }
@@ -7,3 +7,4 @@ export { validate, safeValidate } from './validate.js';
7
7
  export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
8
8
  export { prepOpenApiFrontmatter } from './prepOpenApiFrontmatter.js';
9
9
  export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
10
+ export { registerXMintContent, getXMintContent, getAllXMintContent } from './contentRegistry.js';
@@ -7,3 +7,4 @@ export { validate, safeValidate } from './validate.js';
7
7
  export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
8
8
  export { prepOpenApiFrontmatter } from './prepOpenApiFrontmatter.js';
9
9
  export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
10
+ export { registerXMintContent, getXMintContent, getAllXMintContent } from './contentRegistry.js';
@@ -1,3 +1,7 @@
1
+ export declare const getS3BaseUrl: (opts?: {
2
+ bucketName?: string;
3
+ region?: string;
4
+ }) => string;
1
5
  export declare const getS3URI: (subdomain: string, resourcePath: string, opts?: {
2
6
  bucketName?: string;
3
7
  region?: string;
@@ -1,8 +1,11 @@
1
1
  import path from 'path';
2
+ export const getS3BaseUrl = (opts = {}) => {
3
+ return `https://${opts.bucketName ? opts.bucketName : 'mintlify'}.s3.${opts.region ? opts.region : 'us-west-1'}.amazonaws.com`;
4
+ };
2
5
  export const getS3URI = (subdomain, resourcePath, opts = {}) => {
3
6
  if (resourcePath.startsWith('http://') || resourcePath.startsWith('https://'))
4
7
  return resourcePath;
5
8
  const subpath = path.join(subdomain, resourcePath);
6
- const baseUrl = new URL(`https://${opts.bucketName ? opts.bucketName : 'mintlify'}.s3.${opts.region ? opts.region : 'us-west-1'}.amazonaws.com`);
9
+ const baseUrl = new URL(getS3BaseUrl(opts));
7
10
  return new URL(subpath, baseUrl).toString();
8
11
  };