@leadcms/sdk 1.3.0-pre → 2.1.0

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.
Files changed (56) hide show
  1. package/README.md +82 -3
  2. package/dist/cli/index.js +55 -62
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -18
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/cms.d.ts +1 -1
  9. package/dist/lib/cms.d.ts.map +1 -1
  10. package/dist/lib/cms.js +49 -72
  11. package/dist/lib/cms.js.map +1 -1
  12. package/dist/lib/config.d.ts +0 -8
  13. package/dist/lib/config.d.ts.map +1 -1
  14. package/dist/lib/config.js +13 -40
  15. package/dist/lib/config.js.map +1 -1
  16. package/dist/lib/console-colors.d.ts +49 -0
  17. package/dist/lib/console-colors.d.ts.map +1 -0
  18. package/dist/lib/console-colors.js +121 -0
  19. package/dist/lib/console-colors.js.map +1 -0
  20. package/dist/lib/content-transformation.d.ts +90 -0
  21. package/dist/lib/content-transformation.d.ts.map +1 -0
  22. package/dist/lib/content-transformation.js +335 -0
  23. package/dist/lib/content-transformation.js.map +1 -0
  24. package/dist/lib/data-service.d.ts +97 -0
  25. package/dist/lib/data-service.d.ts.map +1 -0
  26. package/dist/lib/data-service.js +389 -0
  27. package/dist/lib/data-service.js.map +1 -0
  28. package/dist/scripts/fetch-leadcms-content.d.ts +19 -0
  29. package/dist/scripts/fetch-leadcms-content.d.ts.map +1 -0
  30. package/dist/scripts/fetch-leadcms-content.js +301 -0
  31. package/dist/scripts/fetch-leadcms-content.js.map +1 -0
  32. package/dist/scripts/generate-env-js.d.ts +2 -0
  33. package/dist/scripts/generate-env-js.d.ts.map +1 -0
  34. package/dist/scripts/generate-env-js.js +22 -0
  35. package/dist/scripts/generate-env-js.js.map +1 -0
  36. package/dist/scripts/leadcms-helpers.d.ts +25 -0
  37. package/dist/scripts/leadcms-helpers.d.ts.map +1 -0
  38. package/dist/scripts/leadcms-helpers.js +78 -0
  39. package/dist/scripts/leadcms-helpers.js.map +1 -0
  40. package/dist/scripts/push-leadcms-content.d.ts +50 -0
  41. package/dist/scripts/push-leadcms-content.d.ts.map +1 -0
  42. package/dist/scripts/push-leadcms-content.js +1022 -0
  43. package/dist/scripts/push-leadcms-content.js.map +1 -0
  44. package/dist/scripts/sse-watcher.d.ts +20 -0
  45. package/dist/scripts/sse-watcher.d.ts.map +1 -0
  46. package/dist/scripts/sse-watcher.js +268 -0
  47. package/dist/scripts/sse-watcher.js.map +1 -0
  48. package/dist/scripts/status-leadcms-content.d.ts +4 -0
  49. package/dist/scripts/status-leadcms-content.d.ts.map +1 -0
  50. package/dist/scripts/status-leadcms-content.js +36 -0
  51. package/dist/scripts/status-leadcms-content.js.map +1 -0
  52. package/package.json +14 -12
  53. package/dist/scripts/fetch-leadcms-content.mjs +0 -367
  54. package/dist/scripts/generate-env-js.mjs +0 -24
  55. package/dist/scripts/leadcms-helpers.mjs +0 -208
  56. package/dist/scripts/sse-watcher.mjs +0 -300
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Console color utilities for better user experience
3
+ * Uses ANSI escape codes for terminal colors
4
+ */
5
+ /**
6
+ * Colored console logging utilities
7
+ */
8
+ export declare const colorConsole: {
9
+ success: (message: any, ...args: any[]) => void;
10
+ error: (message: any, ...args: any[]) => void;
11
+ warn: (message: any, ...args: any[]) => void;
12
+ info: (message: any, ...args: any[]) => void;
13
+ debug: (message: any, ...args: any[]) => void;
14
+ progress: (message: any, ...args: any[]) => void;
15
+ important: (message: any, ...args: any[]) => void;
16
+ highlight: (text: string) => string;
17
+ red: (text: string) => string;
18
+ green: (text: string) => string;
19
+ yellow: (text: string) => string;
20
+ blue: (text: string) => string;
21
+ cyan: (text: string) => string;
22
+ gray: (text: string) => string;
23
+ bold: (text: string) => string;
24
+ log: (message: any, ...args: any[]) => void;
25
+ };
26
+ /**
27
+ * Create colored diff output for better readability
28
+ */
29
+ export declare const diffColors: {
30
+ added: (text: string) => string;
31
+ removed: (text: string) => string;
32
+ modified: (text: string) => string;
33
+ unchanged: (text: string) => string;
34
+ header: (text: string) => string;
35
+ lineNumber: (text: string) => string;
36
+ };
37
+ /**
38
+ * Status-specific colors for different operation types
39
+ */
40
+ export declare const statusColors: {
41
+ created: (text: string) => string;
42
+ modified: (text: string) => string;
43
+ renamed: (text: string) => string;
44
+ conflict: (text: string) => string;
45
+ synced: (text: string) => string;
46
+ typeChange: (text: string) => string;
47
+ };
48
+ export declare const success: (message: any, ...args: any[]) => void, error: (message: any, ...args: any[]) => void, warn: (message: any, ...args: any[]) => void, info: (message: any, ...args: any[]) => void, debug: (message: any, ...args: any[]) => void, progress: (message: any, ...args: any[]) => void, important: (message: any, ...args: any[]) => void, log: (message: any, ...args: any[]) => void;
49
+ //# sourceMappingURL=console-colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-colors.d.ts","sourceRoot":"","sources":["../../src/lib/console-colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsDH;;GAEG;AACH,eAAO,MAAM,YAAY;uBAEJ,GAAG,WAAW,GAAG,EAAE;qBAKrB,GAAG,WAAW,GAAG,EAAE;oBAKpB,GAAG,WAAW,GAAG,EAAE;oBAKnB,GAAG,WAAW,GAAG,EAAE;qBAKlB,GAAG,WAAW,GAAG,EAAE;wBAKhB,GAAG,WAAW,GAAG,EAAE;yBAKlB,GAAG,WAAW,GAAG,EAAE;sBAKtB,MAAM;gBAGZ,MAAM;kBACJ,MAAM;mBACL,MAAM;iBACR,MAAM;iBACN,MAAM;iBACN,MAAM;iBACN,MAAM;mBAGJ,GAAG,WAAW,GAAG,EAAE;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;kBACP,MAAM;oBACJ,MAAM;qBACL,MAAM;sBACL,MAAM;mBACT,MAAM;uBACF,MAAM;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;oBACP,MAAM;qBACL,MAAM;oBACP,MAAM;qBACL,MAAM;mBACR,MAAM;uBACF,MAAM;CAC1B,CAAC;AAGF,eAAO,MAAQ,OAAO,YA7ED,GAAG,WAAW,GAAG,EAAE,WA6EhB,KAAK,YAxEV,GAAG,WAAW,GAAG,EAAE,WAwEP,IAAI,YAnEjB,GAAG,WAAW,GAAG,EAAE,WAmEA,IAAI,YA9DvB,GAAG,WAAW,GAAG,EAAE,WA8DM,KAAK,YAzD7B,GAAG,WAAW,GAAG,EAAE,WAyDY,QAAQ,YApDpC,GAAG,WAAW,GAAG,EAAE,WAoDmB,SAAS,YA/C9C,GAAG,WAAW,GAAG,EAAE,WA+C6B,GAAG,YA9BzD,GAAG,WAAW,GAAG,EAAE,SA8BuD,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Console color utilities for better user experience
3
+ * Uses ANSI escape codes for terminal colors
4
+ */
5
+ // ANSI color codes
6
+ const colors = {
7
+ reset: '\x1b[0m',
8
+ bright: '\x1b[1m',
9
+ dim: '\x1b[2m',
10
+ // Foreground colors
11
+ black: '\x1b[30m',
12
+ red: '\x1b[31m',
13
+ green: '\x1b[32m',
14
+ yellow: '\x1b[33m',
15
+ blue: '\x1b[34m',
16
+ magenta: '\x1b[35m',
17
+ cyan: '\x1b[36m',
18
+ white: '\x1b[37m',
19
+ gray: '\x1b[90m',
20
+ // Background colors
21
+ bgRed: '\x1b[41m',
22
+ bgGreen: '\x1b[42m',
23
+ bgYellow: '\x1b[43m',
24
+ bgBlue: '\x1b[44m',
25
+ bgMagenta: '\x1b[45m',
26
+ bgCyan: '\x1b[46m',
27
+ bgWhite: '\x1b[47m',
28
+ };
29
+ /**
30
+ * Check if colors should be disabled (for CI/non-TTY environments)
31
+ */
32
+ function shouldUseColors() {
33
+ // Check if NO_COLOR env var is set
34
+ if (process.env.NO_COLOR) {
35
+ return false;
36
+ }
37
+ // Check if we're in a TTY (terminal)
38
+ if (typeof process.stdout.isTTY === 'boolean') {
39
+ return process.stdout.isTTY;
40
+ }
41
+ // Default to true for most environments
42
+ return true;
43
+ }
44
+ /**
45
+ * Apply color to text if colors are enabled
46
+ */
47
+ function colorize(text, color) {
48
+ return shouldUseColors() ? `${color}${text}${colors.reset}` : text;
49
+ }
50
+ /**
51
+ * Colored console logging utilities
52
+ */
53
+ export const colorConsole = {
54
+ // Success messages (green)
55
+ success: (message, ...args) => {
56
+ console.log(colorize(String(message), colors.green), ...args);
57
+ },
58
+ // Error messages (red)
59
+ error: (message, ...args) => {
60
+ console.error(colorize(String(message), colors.red), ...args);
61
+ },
62
+ // Warning messages (yellow)
63
+ warn: (message, ...args) => {
64
+ console.warn(colorize(String(message), colors.yellow), ...args);
65
+ },
66
+ // Info messages (cyan)
67
+ info: (message, ...args) => {
68
+ console.log(colorize(String(message), colors.cyan), ...args);
69
+ },
70
+ // Debug messages (gray)
71
+ debug: (message, ...args) => {
72
+ console.log(colorize(String(message), colors.gray), ...args);
73
+ },
74
+ // Progress messages (blue)
75
+ progress: (message, ...args) => {
76
+ console.log(colorize(String(message), colors.blue), ...args);
77
+ },
78
+ // Important messages (bright/bold)
79
+ important: (message, ...args) => {
80
+ console.log(colorize(String(message), colors.bright), ...args);
81
+ },
82
+ // Highlight text within a message
83
+ highlight: (text) => colorize(text, colors.bright + colors.cyan),
84
+ // Color specific parts of messages
85
+ red: (text) => colorize(text, colors.red),
86
+ green: (text) => colorize(text, colors.green),
87
+ yellow: (text) => colorize(text, colors.yellow),
88
+ blue: (text) => colorize(text, colors.blue),
89
+ cyan: (text) => colorize(text, colors.cyan),
90
+ gray: (text) => colorize(text, colors.gray),
91
+ bold: (text) => colorize(text, colors.bright),
92
+ // Regular console.log but respects color settings
93
+ log: (message, ...args) => {
94
+ console.log(message, ...args);
95
+ }
96
+ };
97
+ /**
98
+ * Create colored diff output for better readability
99
+ */
100
+ export const diffColors = {
101
+ added: (text) => colorize(text, colors.green),
102
+ removed: (text) => colorize(text, colors.red),
103
+ modified: (text) => colorize(text, colors.yellow),
104
+ unchanged: (text) => text, // No color for unchanged
105
+ header: (text) => colorize(text, colors.bright + colors.cyan),
106
+ lineNumber: (text) => colorize(text, colors.gray),
107
+ };
108
+ /**
109
+ * Status-specific colors for different operation types
110
+ */
111
+ export const statusColors = {
112
+ created: (text) => colorize(text, colors.green),
113
+ modified: (text) => colorize(text, colors.yellow),
114
+ renamed: (text) => colorize(text, colors.blue),
115
+ conflict: (text) => colorize(text, colors.red),
116
+ synced: (text) => colorize(text, colors.green),
117
+ typeChange: (text) => colorize(text, colors.magenta),
118
+ };
119
+ // Export individual color functions for convenience
120
+ export const { success, error, warn, info, debug, progress, important, log } = colorConsole;
121
+ //# sourceMappingURL=console-colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-colors.js","sourceRoot":"","sources":["../../src/lib/console-colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mBAAmB;AACnB,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IAEd,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;IAEhB,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;CACX,CAAC;AAEX;;GAEG;AACH,SAAS,eAAe;IACtB,mCAAmC;IACnC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAqC;IACr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KAAK,CAAC;IACvD,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;IACtD,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC;IACtD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;IACtD,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC;CAC7D,CAAC;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Shared content transformation utilities for LeadCMS SDK
3
+ * This module provides common functionality for transforming content between
4
+ * remote API format and local file format (MDX/JSON)
5
+ */
6
+ export interface RemoteContentData {
7
+ id?: number | string;
8
+ slug: string;
9
+ type: string;
10
+ language?: string;
11
+ title?: string;
12
+ body?: string;
13
+ isLocal?: boolean;
14
+ createdAt?: string;
15
+ updatedAt?: string;
16
+ publishedAt?: string;
17
+ [key: string]: any;
18
+ }
19
+ export interface ContentTypeMap {
20
+ [contentType: string]: 'MDX' | 'JSON';
21
+ }
22
+ /**
23
+ * Transform remote content data to local file format (MDX or JSON)
24
+ * This function converts API response format to the format expected in local files
25
+ *
26
+ * @param remote - Remote content data from API
27
+ * @param typeMap - Mapping of content types to their file formats
28
+ * @returns Transformed content as string (MDX or JSON format)
29
+ */
30
+ export declare function transformRemoteToLocalFormat(remote: RemoteContentData, typeMap?: ContentTypeMap): Promise<string>;
31
+ /**
32
+ * Transform remote content for comparison with a specific local file
33
+ * This version only includes fields that exist in BOTH remote and local content
34
+ * to avoid false positives when remote has additional metadata fields
35
+ *
36
+ * @param remote - Remote content data from API
37
+ * @param localContent - Local file content as string
38
+ * @param typeMap - Mapping of content types to their file formats
39
+ * @returns Transformed content as string, matching local field structure
40
+ */
41
+ export declare function transformRemoteForComparison(remote: RemoteContentData, localContent: string, typeMap?: ContentTypeMap): Promise<string>;
42
+ /**
43
+ * Replace API media paths with local media paths
44
+ * Converts /api/media/ paths to /media/ paths
45
+ * Only transforms paths that start with /api/media/ (not in the middle of URLs)
46
+ */
47
+ export declare function replaceApiMediaPaths(obj: any): any;
48
+ /**
49
+ * Replace local media paths with API media paths (reverse transformation for push)
50
+ * Converts /media/ paths to /api/media/ paths
51
+ * Only transforms paths that start with /media/ (not in the middle of URLs)
52
+ */
53
+ export declare function replaceLocalMediaPaths(obj: any): any;
54
+ /**
55
+ * Normalize content for comparison by handling whitespace differences
56
+ */
57
+ export declare function normalizeContentForComparison(content: string): string;
58
+ /**
59
+ * Compare two content strings after normalization
60
+ * Returns true if contents are different
61
+ */
62
+ export declare function hasContentDifferences(content1: string, content2: string): boolean;
63
+ /**
64
+ * System fields that should be excluded from local files
65
+ * These are truly internal fields, not user content fields
66
+ */
67
+ export declare const SYSTEM_FIELDS: readonly ["body", "isLocal"];
68
+ /**
69
+ * User content fields that should be preserved in local files
70
+ * These are timestamp fields that represent user content metadata
71
+ */
72
+ export declare const USER_CONTENT_FIELDS: readonly ["createdAt", "updatedAt", "publishedAt"];
73
+ /**
74
+ * Options for saving content files
75
+ */
76
+ export interface SaveContentFileOptions {
77
+ content: RemoteContentData;
78
+ typeMap?: Record<string, string>;
79
+ contentDir: string;
80
+ previewSlug?: string;
81
+ }
82
+ /**
83
+ * Save content file using shared transformation logic
84
+ * This function combines transformation and file writing operations
85
+ *
86
+ * @param options - Configuration options for saving the content file
87
+ * @returns Promise that resolves to the file path if successful, undefined otherwise
88
+ */
89
+ export declare function saveContentFile({ content, typeMap, contentDir, previewSlug }: SaveContentFileOptions): Promise<string | undefined>;
90
+ //# sourceMappingURL=content-transformation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-transformation.d.ts","sourceRoot":"","sources":["../../src/lib/content-transformation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAcjB;AA+KD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAelD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAepD;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIjF;AAgBD;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAA+B,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,EACpC,OAAO,EACP,OAAY,EACZ,UAAU,EACV,WAAW,EACZ,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4CtD"}
@@ -0,0 +1,335 @@
1
+ /**
2
+ * Shared content transformation utilities for LeadCMS SDK
3
+ * This module provides common functionality for transforming content between
4
+ * remote API format and local file format (MDX/JSON)
5
+ */
6
+ import matter from 'gray-matter';
7
+ import fs from 'fs/promises';
8
+ import path from 'path';
9
+ import { getConfig } from './config.js';
10
+ /**
11
+ * Transform remote content data to local file format (MDX or JSON)
12
+ * This function converts API response format to the format expected in local files
13
+ *
14
+ * @param remote - Remote content data from API
15
+ * @param typeMap - Mapping of content types to their file formats
16
+ * @returns Transformed content as string (MDX or JSON format)
17
+ */
18
+ export async function transformRemoteToLocalFormat(remote, typeMap = {}) {
19
+ if (!remote || typeof remote !== "object") {
20
+ throw new Error("Invalid remote content");
21
+ }
22
+ const contentType = typeMap[remote.type] || 'MDX';
23
+ if (contentType === 'MDX') {
24
+ return transformToMDXFormat(remote);
25
+ }
26
+ else if (contentType === 'JSON') {
27
+ return transformToJSONFormat(remote);
28
+ }
29
+ else {
30
+ throw new Error(`Unsupported content type: ${contentType}`);
31
+ }
32
+ }
33
+ /**
34
+ * Transform remote content for comparison with a specific local file
35
+ * This version only includes fields that exist in BOTH remote and local content
36
+ * to avoid false positives when remote has additional metadata fields
37
+ *
38
+ * @param remote - Remote content data from API
39
+ * @param localContent - Local file content as string
40
+ * @param typeMap - Mapping of content types to their file formats
41
+ * @returns Transformed content as string, matching local field structure
42
+ */
43
+ export async function transformRemoteForComparison(remote, localContent, typeMap = {}) {
44
+ if (!remote || typeof remote !== "object") {
45
+ throw new Error("Invalid remote content");
46
+ }
47
+ const contentType = typeMap[remote.type] || 'MDX';
48
+ if (contentType === 'MDX') {
49
+ return transformToMDXFormatForComparison(remote, localContent);
50
+ }
51
+ else if (contentType === 'JSON') {
52
+ return transformToJSONFormatForComparison(remote, localContent);
53
+ }
54
+ else {
55
+ throw new Error(`Unsupported content type: ${contentType}`);
56
+ }
57
+ }
58
+ /**
59
+ * Transform remote content to MDX format, but only include fields present in local content
60
+ */
61
+ function transformToMDXFormatForComparison(remote, localContent) {
62
+ // Parse local content to see which fields it has
63
+ let localFields;
64
+ try {
65
+ const parsed = matter(localContent);
66
+ localFields = new Set(Object.keys(parsed.data));
67
+ }
68
+ catch (error) {
69
+ // If we can't parse local content, fall back to including all fields
70
+ return transformToMDXFormat(remote);
71
+ }
72
+ let body = remote.body || "";
73
+ let bodyFrontmatter = {};
74
+ let bodyContent = body;
75
+ // Extract frontmatter from body if present
76
+ const fmMatch = body.match(/^---\n([\s\S]*?)\n---\n?/);
77
+ if (fmMatch) {
78
+ try {
79
+ // Use matter() to parse YAML by wrapping in delimiters
80
+ const yamlWithDelimiters = `---\n${fmMatch[1]}\n---\n`;
81
+ bodyFrontmatter = matter(yamlWithDelimiters).data || {};
82
+ }
83
+ catch (error) {
84
+ console.warn(`Failed to parse frontmatter:`, error.message);
85
+ }
86
+ bodyContent = body.slice(fmMatch[0].length);
87
+ }
88
+ // Merge frontmatter, body frontmatter takes precedence over content metadata
89
+ const mergedFrontmatter = { ...remote, ...bodyFrontmatter };
90
+ // Exclude system/internal fields that should not appear in local files
91
+ const systemFields = ['body', 'isLocal'];
92
+ systemFields.forEach(field => delete mergedFrontmatter[field]);
93
+ // IMPORTANT: Only include fields that exist in the local file
94
+ // This prevents false positives when remote has additional fields like updatedAt
95
+ const localFieldsOnlyFrontmatter = {};
96
+ for (const [key, value] of Object.entries(mergedFrontmatter)) {
97
+ if (localFields.has(key)) {
98
+ localFieldsOnlyFrontmatter[key] = value;
99
+ }
100
+ }
101
+ // Filter out null and undefined values to prevent them from appearing in frontmatter
102
+ const filteredFrontmatter = filterNullValues(localFieldsOnlyFrontmatter);
103
+ // Apply media path replacements to both frontmatter and body content
104
+ const cleanedFrontmatter = replaceApiMediaPaths(filteredFrontmatter);
105
+ const cleanedContent = replaceApiMediaPaths(bodyContent);
106
+ // Use gray-matter's stringify to build frontmatter + content, adding extra newline for consistency
107
+ return matter.stringify(`\n${cleanedContent.trim()}`, cleanedFrontmatter);
108
+ }
109
+ /**
110
+ * Transform remote content to JSON format, but only include fields present in local content
111
+ */
112
+ function transformToJSONFormatForComparison(remote, localContent) {
113
+ // Parse local content to see which fields it has
114
+ let localFields;
115
+ try {
116
+ const localData = JSON.parse(localContent);
117
+ localFields = new Set(Object.keys(localData));
118
+ }
119
+ catch (error) {
120
+ // If we can't parse local content, fall back to including all fields
121
+ return transformToJSONFormat(remote);
122
+ }
123
+ let bodyObj = {};
124
+ try {
125
+ bodyObj = remote.body ? JSON.parse(remote.body) : {};
126
+ }
127
+ catch {
128
+ bodyObj = {};
129
+ }
130
+ // Apply URL transformation to the body object first
131
+ const transformedBodyObj = replaceApiMediaPaths(bodyObj);
132
+ const merged = { ...transformedBodyObj };
133
+ // Exclude system/internal fields that should not appear in local files
134
+ const systemFields = ['body', 'isLocal'];
135
+ for (const [k, v] of Object.entries(remote)) {
136
+ if (!systemFields.includes(k) && localFields.has(k)) {
137
+ merged[k] = replaceApiMediaPaths(v);
138
+ }
139
+ }
140
+ // Filter out null and undefined values to prevent them from appearing in JSON
141
+ const filteredMerged = filterNullValues(merged);
142
+ return JSON.stringify(filteredMerged, null, 2);
143
+ }
144
+ /**
145
+ * Transform remote content to MDX format with frontmatter
146
+ */
147
+ function transformToMDXFormat(remote) {
148
+ let body = remote.body || "";
149
+ let bodyFrontmatter = {};
150
+ let bodyContent = body;
151
+ // Extract frontmatter from body if present
152
+ const fmMatch = body.match(/^---\n([\s\S]*?)\n---\n?/);
153
+ if (fmMatch) {
154
+ try {
155
+ // Use matter() to parse YAML by wrapping in delimiters
156
+ const yamlWithDelimiters = `---\n${fmMatch[1]}\n---\n`;
157
+ bodyFrontmatter = matter(yamlWithDelimiters).data || {};
158
+ }
159
+ catch (error) {
160
+ console.warn(`Failed to parse frontmatter:`, error.message);
161
+ }
162
+ bodyContent = body.slice(fmMatch[0].length);
163
+ }
164
+ // Merge frontmatter, body frontmatter takes precedence over content metadata
165
+ const mergedFrontmatter = { ...remote, ...bodyFrontmatter };
166
+ // Exclude system/internal fields that should not appear in local files
167
+ // Only exclude truly internal fields, not user content fields like timestamps
168
+ const systemFields = ['body', 'isLocal'];
169
+ systemFields.forEach(field => delete mergedFrontmatter[field]);
170
+ // Filter out null and undefined values to prevent them from appearing in frontmatter
171
+ const filteredFrontmatter = filterNullValues(mergedFrontmatter);
172
+ // Apply media path replacements to both frontmatter and body content
173
+ const cleanedFrontmatter = replaceApiMediaPaths(filteredFrontmatter);
174
+ const cleanedContent = replaceApiMediaPaths(bodyContent);
175
+ // Use gray-matter's stringify to build frontmatter + content, adding extra newline for consistency
176
+ return matter.stringify(`\n${cleanedContent.trim()}`, cleanedFrontmatter);
177
+ }
178
+ /**
179
+ * Transform remote content to JSON format
180
+ */
181
+ function transformToJSONFormat(remote) {
182
+ let bodyObj = {};
183
+ try {
184
+ bodyObj = remote.body ? JSON.parse(remote.body) : {};
185
+ }
186
+ catch {
187
+ bodyObj = {};
188
+ }
189
+ // Apply URL transformation to the body object first
190
+ const transformedBodyObj = replaceApiMediaPaths(bodyObj);
191
+ const merged = { ...transformedBodyObj };
192
+ // Exclude system/internal fields that should not appear in local files
193
+ // Only exclude truly internal fields, not user content fields like timestamps
194
+ const systemFields = ['body', 'isLocal'];
195
+ for (const [k, v] of Object.entries(remote)) {
196
+ if (!systemFields.includes(k)) {
197
+ merged[k] = replaceApiMediaPaths(v);
198
+ }
199
+ }
200
+ // Filter out null and undefined values to prevent them from appearing in JSON
201
+ const filteredMerged = filterNullValues(merged);
202
+ return JSON.stringify(filteredMerged, null, 2);
203
+ }
204
+ /**
205
+ * Replace API media paths with local media paths
206
+ * Converts /api/media/ paths to /media/ paths
207
+ * Only transforms paths that start with /api/media/ (not in the middle of URLs)
208
+ */
209
+ export function replaceApiMediaPaths(obj) {
210
+ if (typeof obj === "string") {
211
+ // Only replace /api/media/ that appears at the start of a path or after whitespace/quotes
212
+ // This prevents replacing /api/media/ inside external URLs like https://example.com/api/media/
213
+ return obj.replace(/(^|[\s"'\(\)\[\]>])\/api\/media\//g, "$1/media/");
214
+ }
215
+ else if (Array.isArray(obj)) {
216
+ return obj.map(replaceApiMediaPaths);
217
+ }
218
+ else if (typeof obj === "object" && obj !== null) {
219
+ const out = {};
220
+ for (const [k, v] of Object.entries(obj)) {
221
+ out[k] = replaceApiMediaPaths(v);
222
+ }
223
+ return out;
224
+ }
225
+ return obj;
226
+ }
227
+ /**
228
+ * Replace local media paths with API media paths (reverse transformation for push)
229
+ * Converts /media/ paths to /api/media/ paths
230
+ * Only transforms paths that start with /media/ (not in the middle of URLs)
231
+ */
232
+ export function replaceLocalMediaPaths(obj) {
233
+ if (typeof obj === "string") {
234
+ // Only replace /media/ that appears at the start of a path or after whitespace/quotes
235
+ // This prevents replacing /media/ inside external URLs like https://example.com/media/
236
+ return obj.replace(/(^|[\s"'\(\)\[\]>])\/media\//g, "$1/api/media/");
237
+ }
238
+ else if (Array.isArray(obj)) {
239
+ return obj.map(replaceLocalMediaPaths);
240
+ }
241
+ else if (typeof obj === "object" && obj !== null) {
242
+ const out = {};
243
+ for (const [k, v] of Object.entries(obj)) {
244
+ out[k] = replaceLocalMediaPaths(v);
245
+ }
246
+ return out;
247
+ }
248
+ return obj;
249
+ }
250
+ /**
251
+ * Normalize content for comparison by handling whitespace differences
252
+ */
253
+ export function normalizeContentForComparison(content) {
254
+ return content
255
+ .trim()
256
+ .replace(/\r\n/g, '\n') // Normalize line endings
257
+ .replace(/\s+\n/g, '\n') // Remove trailing whitespace on lines
258
+ .replace(/\n\n+/g, '\n\n'); // Normalize multiple newlines to double newlines
259
+ }
260
+ /**
261
+ * Compare two content strings after normalization
262
+ * Returns true if contents are different
263
+ */
264
+ export function hasContentDifferences(content1, content2) {
265
+ const normalized1 = normalizeContentForComparison(content1);
266
+ const normalized2 = normalizeContentForComparison(content2);
267
+ return normalized1 !== normalized2;
268
+ }
269
+ /**
270
+ * Filter out null and undefined values from an object
271
+ * This prevents empty/null fields from appearing in frontmatter
272
+ */
273
+ function filterNullValues(obj) {
274
+ const filtered = {};
275
+ for (const [key, value] of Object.entries(obj)) {
276
+ if (value !== null && value !== undefined) {
277
+ filtered[key] = value;
278
+ }
279
+ }
280
+ return filtered;
281
+ }
282
+ /**
283
+ * System fields that should be excluded from local files
284
+ * These are truly internal fields, not user content fields
285
+ */
286
+ export const SYSTEM_FIELDS = ['body', 'isLocal'];
287
+ /**
288
+ * User content fields that should be preserved in local files
289
+ * These are timestamp fields that represent user content metadata
290
+ */
291
+ export const USER_CONTENT_FIELDS = ['createdAt', 'updatedAt', 'publishedAt'];
292
+ /**
293
+ * Save content file using shared transformation logic
294
+ * This function combines transformation and file writing operations
295
+ *
296
+ * @param options - Configuration options for saving the content file
297
+ * @returns Promise that resolves to the file path if successful, undefined otherwise
298
+ */
299
+ export async function saveContentFile({ content, typeMap = {}, contentDir, previewSlug }) {
300
+ if (!content || typeof content !== "object") {
301
+ console.warn("[LeadCMS] Skipping undefined or invalid content:", content);
302
+ return;
303
+ }
304
+ const slug = previewSlug || content.slug;
305
+ if (!slug) {
306
+ console.warn("[LeadCMS] Skipping content with missing slug:", content);
307
+ return;
308
+ }
309
+ // Inject draft: true when previewSlug is provided (indicates draft content)
310
+ const contentToTransform = previewSlug ? { ...content, draft: true } : content;
311
+ // Convert typeMap to the format expected by shared transformation
312
+ const contentTypeMap = {};
313
+ for (const [key, value] of Object.entries(typeMap)) {
314
+ contentTypeMap[key] = value === 'JSON' ? 'JSON' : 'MDX';
315
+ }
316
+ // Use shared transformation logic
317
+ const transformedContent = await transformRemoteToLocalFormat(contentToTransform, contentTypeMap);
318
+ // Determine the target directory based on language
319
+ const config = getConfig();
320
+ let targetContentDir = contentDir;
321
+ const contentLanguage = content.language || config.defaultLanguage;
322
+ if (contentLanguage !== config.defaultLanguage) {
323
+ // Save non-default language content in language-specific folder
324
+ targetContentDir = path.join(contentDir, contentLanguage);
325
+ }
326
+ // Determine file extension based on content type
327
+ const contentType = contentTypeMap[content.type] || 'MDX';
328
+ const extension = contentType === 'MDX' ? '.mdx' : '.json';
329
+ const filePath = path.join(targetContentDir, `${slug}${extension}`);
330
+ // Ensure directory exists and write the file
331
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
332
+ await fs.writeFile(filePath, transformedContent, "utf8");
333
+ return filePath;
334
+ }
335
+ //# sourceMappingURL=content-transformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-transformation.js","sourceRoot":"","sources":["../../src/lib/content-transformation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoBxC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,MAAyB,EACzB,UAA0B,EAAE;IAE5B,IAAI,CAAC,MAAM,IAAI,OAAO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