@deepsel/cms-utils
Advanced tools
@@ -14,3 +14,3 @@ export * from './cookieUtils.js'; | ||
| * Builds the relative URL for an attachment file (no host) | ||
| * @param name - The attachment filename | ||
| * @param name - The attachment filename (AttachmentLocaleVersionModel.name) | ||
| * @returns Relative URL to serve the attachment, or empty string if name is falsy | ||
@@ -20,2 +20,9 @@ */ | ||
| /** | ||
| * Builds the relative URL for an attachment by AttachmentModel.name with optional locale (no host) | ||
| * @param name - The attachment name (AttachmentModel.name) | ||
| * @param locale - Optional locale ISO code (e.g. "en", "fr"); defaults to org default on the backend | ||
| * @returns Relative URL to serve the attachment, or empty string if name is falsy | ||
| */ | ||
| export declare function getAttachmentByNameRelativeUrl(name: string, locale?: string): string; | ||
| /** | ||
| * Extracts the filename from an attachment serve URL | ||
@@ -22,0 +29,0 @@ * @param url - The attachment URL (e.g. "https://api.example.com/attachment/serve/file.png") |
@@ -16,3 +16,3 @@ export * from './cookieUtils.js'; | ||
| * Builds the relative URL for an attachment file (no host) | ||
| * @param name - The attachment filename | ||
| * @param name - The attachment filename (AttachmentLocaleVersionModel.name) | ||
| * @returns Relative URL to serve the attachment, or empty string if name is falsy | ||
@@ -24,2 +24,14 @@ */ | ||
| /** | ||
| * Builds the relative URL for an attachment by AttachmentModel.name with optional locale (no host) | ||
| * @param name - The attachment name (AttachmentModel.name) | ||
| * @param locale - Optional locale ISO code (e.g. "en", "fr"); defaults to org default on the backend | ||
| * @returns Relative URL to serve the attachment, or empty string if name is falsy | ||
| */ | ||
| export function getAttachmentByNameRelativeUrl(name, locale) { | ||
| if (!name) | ||
| return ''; | ||
| const base = `/api/v1/attachment/serve-by-name/${name}`; | ||
| return locale ? `${base}?locale=${locale}` : base; | ||
| } | ||
| /** | ||
| * Extracts the filename from an attachment serve URL | ||
@@ -26,0 +38,0 @@ * @param url - The attachment URL (e.g. "https://api.example.com/attachment/serve/file.png") |
+1
-1
| { | ||
| "name": "@deepsel/cms-utils", | ||
| "version": "1.9.7", | ||
| "version": "1.9.8", | ||
| "description": "Helper utilities for Deepsel CMS", | ||
@@ -5,0 +5,0 @@ "repository": { |
53377
2.08%1485
1.3%