@leadcms/sdk 1.2.91-pre โ†’ 2.0.0-pre

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 +154 -7
  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 +24 -8
  9. package/dist/lib/cms.d.ts.map +1 -1
  10. package/dist/lib/cms.js +159 -90
  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 +83 -0
  21. package/dist/lib/content-transformation.d.ts.map +1 -0
  22. package/dist/lib/content-transformation.js +305 -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 +1063 -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 +22 -13
  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
package/README.md CHANGED
@@ -44,6 +44,116 @@ npm install -g @leadcms/sdk
44
44
  - ๐Ÿ› ๏ธ Project initialization and setup
45
45
  - ๐Ÿ› ๏ธ Content fetching and Docker template generation
46
46
 
47
+ ## CI/CD Integration
48
+
49
+ [![CI](https://github.com/LeadCMS/leadcms-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/LeadCMS/leadcms-sdk/actions/workflows/ci.yml)
50
+
51
+ The LeadCMS SDK includes comprehensive CI/CD workflows for GitHub Actions that provide:
52
+
53
+ ### ๐Ÿงช Automated Testing
54
+ - **Multi-Node Support**: Tests run on Node.js 18, 20, and 22
55
+ - **Coverage Reports**: Automatic coverage reporting with visual coverage diffs on PRs
56
+ - **Test Results**: Interactive test results displayed directly in GitHub Actions
57
+ - **JUnit XML**: Structured test output for integration with external tools
58
+
59
+ ### ๐Ÿ“Š Coverage Reporting
60
+ - **LCOV Reports**: Line and branch coverage tracking
61
+ - **PR Comments**: Automatic coverage comments on pull requests showing coverage changes
62
+ - **Coverage Artifacts**: HTML coverage reports archived for 30 days
63
+ - **Multiple Formats**: Coverage available in LCOV, HTML, and Clover formats
64
+
65
+ ### ๐Ÿ”ง Quality Checks
66
+ - **TypeScript Compilation**: Ensures type safety across all Node.js versions
67
+ - **Package Validation**: Verifies package structure and CLI functionality
68
+ - **Docker Template Testing**: Validates generated Docker configurations
69
+
70
+ ### Setting Up CI/CD for Your Project
71
+
72
+ If you're using this SDK in your own project, you can add similar testing workflows:
73
+
74
+ ```yaml
75
+ # .github/workflows/test.yml
76
+ name: Tests
77
+
78
+ on: [push, pull_request]
79
+
80
+ jobs:
81
+ test:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+ - uses: actions/setup-node@v4
86
+ with:
87
+ node-version: '20'
88
+ cache: 'npm'
89
+ - run: npm ci
90
+ - run: npm test
91
+ ```
92
+
93
+ ### Running Tests Locally
94
+
95
+ ```bash
96
+ # Run all tests
97
+ npm test
98
+
99
+ # Run tests with coverage
100
+ npm run test:coverage
101
+
102
+ # Run tests in watch mode
103
+ npm run test:watch
104
+
105
+ # Run tests with mock server (includes CLI integration tests)
106
+ ./tests/run-tests.sh
107
+
108
+ # Run only unit tests
109
+ npm run test:unit
110
+
111
+ # Run only CLI integration tests
112
+ npm run test:integration
113
+ ```
114
+
115
+ ### Test Coverage
116
+
117
+ The SDK maintains high test coverage with comprehensive unit tests covering:
118
+ - ๐Ÿ“„ Content retrieval and parsing
119
+ - ๐ŸŒ Multi-language support and translations
120
+ - ๐Ÿ“ Draft content handling and user-specific overrides
121
+ - ๐Ÿ—๏ธ Build-time optimizations and caching
122
+ - ๐Ÿ”ง Configuration management and validation
123
+ - ๐Ÿ”„ Push/Pull synchronization with conflict detection
124
+ - ๐Ÿ–ฅ๏ธ CLI command functionality with mocked API responses
125
+
126
+ ### Testing with Mock Data
127
+
128
+ For testing CLI commands locally without a real LeadCMS instance, use the built-in mock data service:
129
+
130
+ ```bash
131
+ # Enable mock mode and test status command
132
+ LEADCMS_USE_MOCK=true LEADCMS_CONTENT_DIR=./test-content npx leadcms status
133
+
134
+ # Test with different mock scenarios
135
+ LEADCMS_USE_MOCK=true LEADCMS_MOCK_SCENARIO=hasConflicts npx leadcms status
136
+ LEADCMS_USE_MOCK=true LEADCMS_MOCK_SCENARIO=mixedOperations npx leadcms push --dry-run
137
+
138
+ # Test in development with localhost (automatically uses mock)
139
+ LEADCMS_URL=http://localhost:3001 npx leadcms status
140
+ ```
141
+
142
+ **Available Mock Scenarios:**
143
+ - `allNew` - Local content that doesn't exist remotely (default)
144
+ - `noChanges` - All content is in sync
145
+ - `hasConflicts` - Remote content is newer than local
146
+ - `hasUpdates` - Local content is newer than remote
147
+ - `mixedOperations` - Mix of new, updated, and conflicted content
148
+ - `missingContentTypes` - Content with unknown types
149
+
150
+ **Mock Mode Auto-Detection:**
151
+ - `NODE_ENV=test` - Automatically uses mock mode
152
+ - `LEADCMS_USE_MOCK=true` - Force mock mode
153
+ - `LEADCMS_URL` contains `localhost` - Automatically uses mock mode
154
+
155
+ The data service abstraction automatically handles switching between real API calls and mock data based on your environment, providing seamless testing without external dependencies.
156
+
47
157
  ## Configuration
48
158
 
49
159
  LeadCMS SDK supports multiple configuration methods in order of priority:
@@ -130,11 +240,48 @@ npx leadcms docker
130
240
  # Creates Docker files for production and preview deployments
131
241
  ```
132
242
 
133
- ### Fetch content from LeadCMS
243
+ ### Pull content from LeadCMS
244
+ ```bash
245
+ npx leadcms pull
246
+ ```
247
+
248
+ > **Note:** `npx leadcms fetch` is still supported as an alias for backward compatibility.
249
+
250
+ ### Push local content to LeadCMS
251
+ ```bash
252
+ npx leadcms push [options]
253
+ ```
254
+
255
+ Push your local content changes to LeadCMS. This command will:
256
+ - Analyze local MDX/JSON files and compare with remote content
257
+ - Detect new content, updates, and conflicts using `updatedAt` timestamps
258
+ - Prompt for confirmation before making changes
259
+ - Support for creating missing content types automatically
260
+ - Update local files with remote metadata (id, createdAt, updatedAt) after sync
261
+
262
+ **Options:**
263
+ - `--force` - Override remote changes (skip conflict check)
264
+
265
+
266
+ **Required Metadata Fields:**
267
+ ```yaml
268
+ ---
269
+ type: "article" # Content type (must exist in LeadCMS)
270
+ title: "Article Title" # Content title
271
+ slug: "article-slug" # URL slug
272
+ language: "en" # Content language
273
+ publishedAt: "2024-10-29T10:00:00Z" # Publication date
274
+ updatedAt: "2024-10-29T10:00:00Z" # Last update (used for conflict detection)
275
+ ---
276
+ ```
277
+
278
+ ### Check sync status
134
279
  ```bash
135
- npx leadcms fetch
280
+ npx leadcms status
136
281
  ```
137
282
 
283
+ Shows the current sync status between local and remote content without making any changes.
284
+
138
285
  ### Watch for real-time updates
139
286
  ```bash
140
287
  npx leadcms watch
@@ -231,11 +378,11 @@ const routes = getAllContentRoutes();
231
378
  // Get available languages (uses configured contentDir)
232
379
  const languages = getAvailableLanguages();
233
380
 
234
- // Get content with draft support
381
+ // Get content with draft support (userUid must be a valid GUID)
235
382
  const draftContent = getCMSContentBySlugForLocaleWithDraftSupport(
236
383
  'about-us',
237
384
  'en',
238
- 'user-uuid-for-drafts'
385
+ '550e8400-e29b-41d4-a716-446655440000' // Valid GUID format
239
386
  );
240
387
 
241
388
  // Load configuration objects (header, footer, etc.)
@@ -251,8 +398,8 @@ import {
251
398
  loadContentConfigStrict
252
399
  } from '@leadcms/sdk';
253
400
 
254
- // Generic config loading with auto contentDir resolution
255
- const menuConfig = loadContentConfig('menu', 'en', 'user-uuid-for-drafts');
401
+ // Generic config loading with auto contentDir resolution (userUid must be valid GUID)
402
+ const menuConfig = loadContentConfig('menu', 'en', '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
256
403
 
257
404
  // Strict config loading with detailed error information (throws on missing files)
258
405
  try {
@@ -442,4 +589,4 @@ LEADCMS_DEBUG=true npm run build
442
589
  4. Run tests: `npm run test`
443
590
  5. Submit a pull request
444
591
 
445
- For detailed development setup, see [DEVELOPMENT.md](./DEVELOPMENT.md).
592
+ For detailed development setup, see [DEVELOPMENT.md](./docs/DEVELOPMENT.md).
package/dist/cli/index.js CHANGED
@@ -1,49 +1,15 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const child_process_1 = require("child_process");
41
- const path_1 = __importDefault(require("path"));
2
+ import { spawn } from 'child_process';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
42
7
  const command = process.argv[2];
43
- const scriptDir = path_1.default.join(__dirname, '../scripts');
44
- function runScript(scriptName) {
45
- const scriptPath = path_1.default.join(scriptDir, scriptName);
46
- const child = (0, child_process_1.spawn)('node', [scriptPath], {
8
+ const commandArgs = process.argv.slice(3);
9
+ const scriptDir = path.join(__dirname, '../scripts');
10
+ function runScript(scriptName, args = []) {
11
+ const scriptPath = path.join(scriptDir, scriptName);
12
+ const child = spawn('node', [scriptPath, ...args], {
47
13
  stdio: 'inherit',
48
14
  env: process.env
49
15
  });
@@ -52,18 +18,25 @@ function runScript(scriptName) {
52
18
  });
53
19
  }
54
20
  switch (command) {
55
- case 'fetch':
56
- runScript('fetch-leadcms-content.mjs');
21
+ case 'pull':
22
+ case 'fetch': // Alias for backward compatibility
23
+ runScript('fetch-leadcms-content.js');
24
+ break;
25
+ case 'push':
26
+ runScript('push-leadcms-content.js', commandArgs);
27
+ break;
28
+ case 'status':
29
+ runScript('status-leadcms-content.js', commandArgs);
57
30
  break;
58
31
  case 'watch':
59
- runScript('sse-watcher.mjs');
32
+ runScript('sse-watcher.js');
60
33
  break;
61
34
  case 'generate-env':
62
- runScript('generate-env-js.mjs');
35
+ runScript('generate-env-js.js');
63
36
  break;
64
37
  case 'init':
65
38
  case 'config':
66
- initializeConfig();
39
+ generateConfig();
67
40
  break;
68
41
  case 'docker':
69
42
  case 'templates':
@@ -76,7 +49,17 @@ LeadCMS SDK CLI
76
49
  Usage:
77
50
  leadcms init - Initialize LeadCMS configuration
78
51
  leadcms docker - Generate Docker deployment templates
79
- leadcms fetch - Fetch content from LeadCMS
52
+ leadcms pull - Pull content from LeadCMS
53
+ leadcms push [options] - Push local content to LeadCMS
54
+ --force - Override remote changes (skip conflict check)
55
+ --dry-run - Show API calls without executing them (preview mode)
56
+ --id <content-id> - Target specific content by ID
57
+ --slug <slug> - Target specific content by slug
58
+ leadcms status [options] - Show sync status between local and remote content
59
+ --preview - Show detailed change previews for all files
60
+ --id <content-id> - Show detailed status for specific content by ID
61
+ --slug <slug> - Show detailed status for specific content by slug
62
+ leadcms fetch - Alias for 'pull' (backward compatibility)
80
63
  leadcms watch - Watch for real-time updates
81
64
  leadcms generate-env - Generate environment variables file
82
65
 
@@ -103,33 +86,43 @@ Configuration:
103
86
  `);
104
87
  break;
105
88
  }
106
- function initializeConfig() {
107
- Promise.all([Promise.resolve().then(() => __importStar(require('fs'))), Promise.resolve().then(() => __importStar(require('readline')))]).then(([fs, readline]) => {
108
- const configPath = 'leadcms.config.json';
89
+ function generateConfig() {
90
+ Promise.all([import('fs'), import('path')]).then(([fs, pathModule]) => {
91
+ const configPath = pathModule.join(process.cwd(), 'leadcms.config.json');
109
92
  if (fs.existsSync(configPath)) {
93
+ const readline = require('readline');
110
94
  const rl = readline.createInterface({
111
95
  input: process.stdin,
112
96
  output: process.stdout
113
97
  });
114
- rl.question('โ“ leadcms.config.json already exists. Overwrite? (y/N): ', (answer) => {
115
- if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
116
- createConfigFile(configPath);
117
- }
118
- else {
98
+ rl.question('leadcms.config.json already exists. Overwrite? (y/N): ', (answer) => {
99
+ if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
119
100
  console.log('โœ… Configuration initialization cancelled.');
101
+ rl.close();
102
+ return;
120
103
  }
104
+ createConfig();
121
105
  rl.close();
122
106
  });
123
107
  }
124
108
  else {
125
- createConfigFile(configPath);
109
+ createConfig();
110
+ }
111
+ function createConfig() {
112
+ const sampleConfigPath = pathModule.join(__dirname, '../../leadcms.config.json.sample');
113
+ const sampleConfig = fs.readFileSync(sampleConfigPath, 'utf-8');
114
+ fs.writeFileSync(configPath, sampleConfig, 'utf-8');
115
+ console.log(`โœ… Created ${configPath}`);
116
+ console.log('๐Ÿ“ Set LEADCMS_URL and LEADCMS_API_KEY as environment variables.');
117
+ console.log('๐Ÿ”ง Customize contentDir, mediaDir, or other settings in the config file.');
118
+ console.log('โ„น๏ธ Content types are automatically detected from your LeadCMS API.');
126
119
  }
127
120
  });
128
121
  }
129
122
  function createConfigFile(configPath) {
130
- Promise.resolve().then(() => __importStar(require('fs'))).then(fs => {
123
+ import('fs').then(fs => {
131
124
  // Use the sample config file as the source of truth
132
- const sampleConfigPath = path_1.default.join(__dirname, '../../leadcms.config.json.sample');
125
+ const sampleConfigPath = path.join(__dirname, '../../leadcms.config.json.sample');
133
126
  const sampleConfig = fs.readFileSync(sampleConfigPath, 'utf-8');
134
127
  fs.writeFileSync(configPath, sampleConfig, 'utf-8');
135
128
  console.log(`โœ… Created ${configPath}`);
@@ -139,7 +132,7 @@ function createConfigFile(configPath) {
139
132
  });
140
133
  }
141
134
  function generateDockerTemplates() {
142
- Promise.all([Promise.resolve().then(() => __importStar(require('fs'))), Promise.resolve().then(() => __importStar(require('path')))]).then(([fs, pathModule]) => {
135
+ Promise.all([import('fs'), import('path')]).then(([fs, pathModule]) => {
143
136
  const templateDir = pathModule.join(__dirname, '../templates');
144
137
  // Check if templates directory exists
145
138
  if (!fs.existsSync(templateDir)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAsC;AACtC,gDAAwB;AAExB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAErD,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE;QACxC,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAA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+D,CAAC,CAAC;YAC7E,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QAEhF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './lib/cms';
2
- export * from './lib/config';
1
+ export * from './lib/cms.js';
2
+ export * from './lib/config.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,22 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
1
  // Main exports
18
- __exportStar(require("./lib/cms"), exports);
19
- __exportStar(require("./lib/config"), exports);
2
+ export * from './lib/cms.js';
3
+ export * from './lib/config.js';
20
4
  // LeadCMS SDK - Framework-agnostic content management
21
5
  //
22
6
  // Core functions for accessing LeadCMS content:
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,eAAe;AACf,4CAA0B;AAC1B,+CAA6B;AAE7B,sDAAsD;AACtD,EAAE;AACF,gDAAgD;AAChD,yDAAyD;AACzD,0DAA0D;AAC1D,iEAAiE;AACjE,sDAAsD;AACtD,EAAE;AACF,yBAAyB;AACzB,4CAA4C;AAC5C,sCAAsC;AACtC,kDAAkD;AAClD,EAAE;AACF,iBAAiB;AACjB,qDAAqD;AACrD,uDAAuD;AACvD,wDAAwD;AACxD,yDAAyD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAEhC,sDAAsD;AACtD,EAAE;AACF,gDAAgD;AAChD,yDAAyD;AACzD,0DAA0D;AAC1D,iEAAiE;AACjE,sDAAsD;AACtD,EAAE;AACF,yBAAyB;AACzB,4CAA4C;AAC5C,sCAAsC;AACtC,kDAAkD;AAClD,EAAE;AACF,iBAAiB;AACjB,qDAAqD;AACrD,uDAAuD;AACvD,wDAAwD;AACxD,yDAAyD"}
package/dist/lib/cms.d.ts CHANGED
@@ -1,10 +1,20 @@
1
- import { type LeadCMSConfig } from "./config";
1
+ import { type LeadCMSConfig } from "./config.js";
2
2
  export interface HeaderConfig {
3
3
  [key: string]: any;
4
4
  }
5
5
  export interface FooterConfig {
6
6
  [key: string]: any;
7
7
  }
8
+ /**
9
+ * Check if content is a draft based on publishedAt field
10
+ * Content is considered draft if:
11
+ * - publishedAt is null/undefined
12
+ * - publishedAt is a future date (after current time)
13
+ *
14
+ * @param content - The content to check
15
+ * @returns true if content is draft, false otherwise
16
+ */
17
+ export declare function isContentDraft(content: CMSContent): boolean;
8
18
  /**
9
19
  * Get LeadCMS configuration with fallbacks
10
20
  * This function attempts to load the LeadCMS configuration and falls back to environment variables
@@ -26,7 +36,7 @@ export interface CMSContent {
26
36
  coverImageAlt?: string;
27
37
  language?: string;
28
38
  translationKey?: string;
29
- publishedAt?: Date;
39
+ publishedAt?: Date | string;
30
40
  draft?: boolean;
31
41
  [key: string]: any;
32
42
  body: string;
@@ -52,24 +62,30 @@ export declare function getAllContentSlugsForLocale(locale?: string, contentType
52
62
  * @param slug - Content slug
53
63
  * @param locale - Locale code
54
64
  * @param userUid - Optional user UID for draft content
65
+ * @param includeDrafts - Whether to include content that is draft based on publishedAt (default: false)
55
66
  */
56
- export declare function getCMSContentBySlugForLocaleWithDraftSupport(slug: string, locale: string, userUid?: string | null): CMSContent | null;
67
+ export declare function getCMSContentBySlugForLocaleWithDraftSupport(slug: string, locale: string, userUid?: string | null, includeDrafts?: boolean): CMSContent | null;
57
68
  /**
58
69
  * Get content by slug for a specific locale
59
70
  */
60
- export declare function getCMSContentBySlugForLocale(slug: string, locale?: string): CMSContent | null;
71
+ export declare function getCMSContentBySlugForLocale(slug: string, locale?: string, includeDrafts?: boolean): CMSContent | null;
61
72
  /**
62
73
  * Get all translations of a content item by translationKey
74
+ * @param translationKey - The translation key to search for
75
+ * @param includeDrafts - Whether to include draft content (default: false)
63
76
  */
64
- export declare function getContentTranslations(translationKey: string): {
77
+ export declare function getContentTranslations(translationKey: string, includeDrafts?: boolean): {
65
78
  locale: string;
66
79
  content: CMSContent;
67
80
  }[];
68
81
  /**
69
82
  * Get all content routes for all locales in a framework-agnostic format
70
83
  * Returns an array of route objects with locale and slug information
84
+ * @param contentTypes - Optional array of content types to filter
85
+ * @param includeDrafts - Whether to include draft content (default: false)
86
+ * @param draftUserUid - Specific user UID for draft content (only relevant if includeDrafts is true)
71
87
  */
72
- export declare function getAllContentRoutes(contentTypes?: readonly string[], includeDrafts?: boolean | null, draftUserUid?: string | null): {
88
+ export declare function getAllContentRoutes(contentTypes?: readonly string[], includeDrafts?: boolean, draftUserUid?: string | null): {
73
89
  locale: string;
74
90
  slug: string;
75
91
  slugParts: string[];
@@ -82,8 +98,8 @@ export declare function getAllContentRoutes(contentTypes?: readonly string[], in
82
98
  * @returns userUid if found, null otherwise
83
99
  */
84
100
  export declare function extractUserUidFromSlug(slug: string): string | null;
85
- export declare function getAllContentSlugs(contentTypes?: readonly string[]): string[];
86
- export declare function getCMSContentBySlug(slug: string): CMSContent | null;
101
+ export declare function getAllContentSlugs(contentTypes?: readonly string[], includeDrafts?: boolean): string[];
102
+ export declare function getCMSContentBySlug(slug: string, includeDrafts?: boolean): CMSContent | null;
87
103
  /**
88
104
  * Convenience function to load configuration with automatic contentDir resolution
89
105
  * Uses the configured contentDir from the LeadCMS configuration system
@@ -1 +1 @@
1
- {"version":3,"file":"cms.d.ts","sourceRoot":"","sources":["../../src/lib/cms.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzD,MAAM,WAAW,YAAY;IAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAAE;AACrD,MAAM,WAAW,YAAY;IAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAAE;AAerD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAchD;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,GAAG,UAAU;IACrD,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,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