@momentumcms/core 0.3.0 → 0.4.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.
package/package.json CHANGED
@@ -1,35 +1,44 @@
1
1
  {
2
- "name": "@momentumcms/core",
3
- "version": "0.3.0",
4
- "description": "Core collection config, fields, hooks, and access control for Momentum CMS",
5
- "license": "MIT",
6
- "author": "Momentum CMS Contributors",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/DonaldMurillo/momentum-cms.git",
10
- "directory": "libs/core"
11
- },
12
- "homepage": "https://github.com/DonaldMurillo/momentum-cms#readme",
13
- "bugs": {
14
- "url": "https://github.com/DonaldMurillo/momentum-cms/issues"
15
- },
16
- "keywords": [
17
- "cms",
18
- "headless-cms",
19
- "angular",
20
- "momentum-cms",
21
- "collections",
22
- "fields",
23
- "content-management"
24
- ],
25
- "engines": {
26
- "node": ">=18"
27
- },
28
- "main": "./index.cjs",
29
- "types": "./src/index.d.ts",
30
- "bin": {
31
- "momentum-generate": "./generators/generator.cjs"
32
- },
33
- "dependencies": {},
34
- "module": "./index.js"
35
- }
2
+ "name": "@momentumcms/core",
3
+ "version": "0.4.0",
4
+ "description": "Core collection config, fields, hooks, and access control for Momentum CMS",
5
+ "license": "MIT",
6
+ "author": "Momentum CMS Contributors",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/DonaldMurillo/momentum-cms.git",
10
+ "directory": "libs/core"
11
+ },
12
+ "homepage": "https://github.com/DonaldMurillo/momentum-cms#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/DonaldMurillo/momentum-cms/issues"
15
+ },
16
+ "keywords": [
17
+ "cms",
18
+ "headless-cms",
19
+ "angular",
20
+ "momentum-cms",
21
+ "collections",
22
+ "fields",
23
+ "content-management"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "main": "./src/index.cjs",
29
+ "module": "./src/index.js",
30
+ "types": "./src/index.d.ts",
31
+ "schematics": "./schematics/collection.json",
32
+ "bin": {
33
+ "momentum-generate": "./src/generators/generator.cjs"
34
+ },
35
+ "peerDependencies": {
36
+ "@angular-devkit/schematics": ">=17.0.0"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@angular-devkit/schematics": {
40
+ "optional": true
41
+ }
42
+ },
43
+ "dependencies": {}
44
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "types": {
5
+ "description": "Generate TypeScript types and browser-safe admin config from momentum.config.ts",
6
+ "factory": "./types/index#generateTypes",
7
+ "schema": "./types/schema.json"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // libs/core/schematics/types/index.ts
21
+ var types_exports = {};
22
+ __export(types_exports, {
23
+ generateTypes: () => generateTypes
24
+ });
25
+ module.exports = __toCommonJS(types_exports);
26
+ var import_node_child_process = require("node:child_process");
27
+ function generateTypes(options) {
28
+ return (_tree, context) => {
29
+ const configPath = options.configPath || "src/momentum.config.ts";
30
+ const typesOutput = options.typesOutput || "src/generated/momentum.types.ts";
31
+ const configOutput = options.configOutput || "src/generated/momentum.config.ts";
32
+ context.logger.info("Generating Momentum CMS types and admin config...");
33
+ context.logger.info(` Config: ${configPath}`);
34
+ context.logger.info(` Types: ${typesOutput}`);
35
+ context.logger.info(` Admin: ${configOutput}`);
36
+ try {
37
+ (0, import_node_child_process.execFileSync)(
38
+ "npx",
39
+ ["momentum-generate", configPath, "--types", typesOutput, "--config", configOutput],
40
+ { stdio: "inherit", shell: true }
41
+ );
42
+ context.logger.info("Types and admin config generated successfully.");
43
+ } catch (error) {
44
+ context.logger.error("Failed to generate types. Is @momentumcms/core installed?");
45
+ throw error;
46
+ }
47
+ return _tree;
48
+ };
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ generateTypes
53
+ });
@@ -0,0 +1,28 @@
1
+ // libs/core/schematics/types/index.ts
2
+ import { execFileSync } from "node:child_process";
3
+ function generateTypes(options) {
4
+ return (_tree, context) => {
5
+ const configPath = options.configPath || "src/momentum.config.ts";
6
+ const typesOutput = options.typesOutput || "src/generated/momentum.types.ts";
7
+ const configOutput = options.configOutput || "src/generated/momentum.config.ts";
8
+ context.logger.info("Generating Momentum CMS types and admin config...");
9
+ context.logger.info(` Config: ${configPath}`);
10
+ context.logger.info(` Types: ${typesOutput}`);
11
+ context.logger.info(` Admin: ${configOutput}`);
12
+ try {
13
+ execFileSync(
14
+ "npx",
15
+ ["momentum-generate", configPath, "--types", typesOutput, "--config", configOutput],
16
+ { stdio: "inherit", shell: true }
17
+ );
18
+ context.logger.info("Types and admin config generated successfully.");
19
+ } catch (error) {
20
+ context.logger.error("Failed to generate types. Is @momentumcms/core installed?");
21
+ throw error;
22
+ }
23
+ return _tree;
24
+ };
25
+ }
26
+ export {
27
+ generateTypes
28
+ };
@@ -0,0 +1,5 @@
1
+ export interface TypesSchema {
2
+ configPath: string;
3
+ typesOutput: string;
4
+ configOutput: string;
5
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "MomentumGenerateTypes",
4
+ "title": "Momentum CMS Type Generation",
5
+ "description": "Generate TypeScript types and browser-safe admin config from momentum.config.ts",
6
+ "type": "object",
7
+ "properties": {
8
+ "configPath": {
9
+ "type": "string",
10
+ "description": "Path to momentum.config.ts",
11
+ "default": "src/momentum.config.ts",
12
+ "x-prompt": "Path to your momentum.config.ts file?"
13
+ },
14
+ "typesOutput": {
15
+ "type": "string",
16
+ "description": "Output path for generated TypeScript types",
17
+ "default": "src/generated/momentum.types.ts"
18
+ },
19
+ "configOutput": {
20
+ "type": "string",
21
+ "description": "Output path for generated browser-safe admin config",
22
+ "default": "src/generated/momentum.config.ts"
23
+ }
24
+ },
25
+ "required": []
26
+ }
@@ -392,12 +392,31 @@ var FIELD_ADMIN_STRIP_KEYS = /* @__PURE__ */ new Set(["condition"]);
392
392
  function isRecord(value) {
393
393
  return typeof value === "object" && value !== null && !Array.isArray(value);
394
394
  }
395
+ function collectFieldNames(fields) {
396
+ const names = [];
397
+ for (const field of fields) {
398
+ if (field.type === "tabs" && field.tabs) {
399
+ for (const tab of field.tabs) {
400
+ if (tab.name) {
401
+ names.push(tab.name);
402
+ } else {
403
+ names.push(...collectFieldNames(tab.fields));
404
+ }
405
+ }
406
+ } else if ((field.type === "collapsible" || field.type === "row") && field.fields) {
407
+ names.push(...collectFieldNames(field.fields));
408
+ } else {
409
+ names.push(field.name);
410
+ }
411
+ }
412
+ return names;
413
+ }
395
414
  function previewFunctionToTemplate(fn, fields) {
396
415
  try {
397
416
  const sentinel = "__MCMS_FIELD_";
398
417
  const mockDoc = {};
399
- for (const field of fields) {
400
- mockDoc[field.name] = `${sentinel}${field.name}__`;
418
+ for (const name of collectFieldNames(fields)) {
419
+ mockDoc[name] = `${sentinel}${name}__`;
401
420
  }
402
421
  const result = fn(mockDoc);
403
422
  if (typeof result !== "string")
@@ -361,12 +361,31 @@ var FIELD_ADMIN_STRIP_KEYS = /* @__PURE__ */ new Set(["condition"]);
361
361
  function isRecord(value) {
362
362
  return typeof value === "object" && value !== null && !Array.isArray(value);
363
363
  }
364
+ function collectFieldNames(fields) {
365
+ const names = [];
366
+ for (const field of fields) {
367
+ if (field.type === "tabs" && field.tabs) {
368
+ for (const tab of field.tabs) {
369
+ if (tab.name) {
370
+ names.push(tab.name);
371
+ } else {
372
+ names.push(...collectFieldNames(tab.fields));
373
+ }
374
+ }
375
+ } else if ((field.type === "collapsible" || field.type === "row") && field.fields) {
376
+ names.push(...collectFieldNames(field.fields));
377
+ } else {
378
+ names.push(field.name);
379
+ }
380
+ }
381
+ return names;
382
+ }
364
383
  function previewFunctionToTemplate(fn, fields) {
365
384
  try {
366
385
  const sentinel = "__MCMS_FIELD_";
367
386
  const mockDoc = {};
368
- for (const field of fields) {
369
- mockDoc[field.name] = `${sentinel}${field.name}__`;
387
+ for (const name of collectFieldNames(fields)) {
388
+ mockDoc[name] = `${sentinel}${name}__`;
370
389
  }
371
390
  const result = fn(mockDoc);
372
391
  if (typeof result !== "string")
@@ -17,8 +17,14 @@ export interface PluginMiddlewareDescriptor {
17
17
  path: string;
18
18
  /** Express Router or middleware function. Typed as unknown to avoid Express dependency in core. */
19
19
  handler: unknown;
20
- /** Where to mount relative to collection CRUD routes. @default 'before-api' */
21
- position?: 'before-api' | 'after-api';
20
+ /**
21
+ * Where to mount relative to collection CRUD routes.
22
+ * - 'before-api': Before collection CRUD routes (under /api)
23
+ * - 'after-api': After collection CRUD routes (under /api)
24
+ * - 'root': Mounted at the application root (not under /api)
25
+ * @default 'before-api'
26
+ */
27
+ position?: 'before-api' | 'after-api' | 'root';
22
28
  }
23
29
  /**
24
30
  * Descriptor for Angular DI providers that a plugin wants auto-registered during SSR.
package/CHANGELOG.md DELETED
@@ -1,135 +0,0 @@
1
- ## 0.3.0 (2026-02-20)
2
-
3
- ### 🚀 Features
4
-
5
- - implement Payload-style migration CLI workflow with clone-test-apply safety ([#35](https://github.com/DonaldMurillo/momentum-cms/pull/35))
6
- - add named tabs support with nested data grouping and UI improvements ([#30](https://github.com/DonaldMurillo/momentum-cms/pull/30))
7
-
8
- ### 🩹 Fixes
9
-
10
- - fix nav highlighting and resolve pre-existing E2E test failures ([#34](https://github.com/DonaldMurillo/momentum-cms/pull/34))
11
- - add auth guard and MIME validation to PATCH upload route; fix pagination with client-side filtering ([#32](https://github.com/DonaldMurillo/momentum-cms/pull/32))
12
-
13
- ### ❤️ Thank You
14
-
15
- - Claude Haiku 4.5
16
- - Claude Opus 4.6
17
- - Donald Murillo @DonaldMurillo
18
-
19
- ## 0.2.0 (2026-02-17)
20
-
21
- ### 🚀 Features
22
-
23
- - add named tabs support with nested data grouping and tab UI improvements ([63ab63e](https://github.com/DonaldMurillo/momentum-cms/commit/63ab63e))
24
-
25
- ### ❤️ Thank You
26
-
27
- - Claude Opus 4.6
28
- - Donald Murillo @DonaldMurillo
29
-
30
- ## 0.1.10 (2026-02-17)
31
-
32
- ### 🩹 Fixes
33
-
34
- - **create-momentum-app:** add shell option to execFileSync for Windows ([#28](https://github.com/DonaldMurillo/momentum-cms/pull/28))
35
-
36
- ### ❤️ Thank You
37
-
38
- - Claude Opus 4.6
39
- - Donald Murillo @DonaldMurillo
40
-
41
- ## 0.1.9 (2026-02-16)
42
-
43
- This was a version bump only for core to align it with other projects, there were no code changes.
44
-
45
- ## 0.1.8 (2026-02-16)
46
-
47
- ### 🩹 Fixes
48
-
49
- - correct repository URLs and add GitHub link to CLI ([#26](https://github.com/DonaldMurillo/momentum-cms/pull/26))
50
-
51
- ### ❤️ Thank You
52
-
53
- - Claude Opus 4.6
54
- - Donald Murillo @DonaldMurillo
55
-
56
- ## 0.1.7 (2026-02-16)
57
-
58
- ### 🩹 Fixes
59
-
60
- - correct repository URLs and add GitHub link to CLI output ([f7e96bb](https://github.com/DonaldMurillo/momentum-cms/commit/f7e96bb))
61
-
62
- ### ❤️ Thank You
63
-
64
- - Claude Opus 4.6
65
- - Donald Murillo @DonaldMurillo
66
-
67
- ## 0.1.6 (2026-02-16)
68
-
69
- This was a version bump only for core to align it with other projects, there were no code changes.
70
-
71
- ## 0.1.5 (2026-02-16)
72
-
73
- ### 🚀 Features
74
-
75
- - **create-app:** add landing page, fix setup flow, theme detection, type generator, Playwright E2E ([5e0f4ed](https://github.com/DonaldMurillo/momentum-cms/commit/5e0f4ed))
76
-
77
- ### ❤️ Thank You
78
-
79
- - Claude Opus 4.6
80
- - Donald Murillo @DonaldMurillo
81
-
82
- ## 0.1.4 (2026-02-16)
83
-
84
- This was a version bump only for core to align it with other projects, there were no code changes.
85
-
86
- ## 0.1.3 (2026-02-16)
87
-
88
- This was a version bump only for core to align it with other projects, there were no code changes.
89
-
90
- ## 0.1.2 (2026-02-16)
91
-
92
- ### 🩹 Fixes
93
-
94
- - **release:** centralize manifestRootsToUpdate to update both source and dist ([2b8f832](https://github.com/DonaldMurillo/momentum-cms/commit/2b8f832))
95
- - **create-app:** fix Angular SSR, Analog builds, and CJS/ESM compatibility ([28d4d0a](https://github.com/DonaldMurillo/momentum-cms/commit/28d4d0a))
96
-
97
- ### ❤️ Thank You
98
-
99
- - Claude Opus 4.6
100
- - Donald Murillo @DonaldMurillo
101
-
102
- ## 0.1.1 (2026-02-16)
103
-
104
- This was a version bump only for core to align it with other projects, there were no code changes.
105
-
106
- ## 0.1.0 (2026-02-16)
107
-
108
- ### 🚀 Features
109
-
110
- - implement soft deletes with full stack support ([#22](https://github.com/DonaldMurillo/momentum-cms/pull/22))
111
- - add tracking rules, content performance, and block analytics ([#21](https://github.com/DonaldMurillo/momentum-cms/pull/21))
112
- - implement globals (singleton collections) with full stack support ([#20](https://github.com/DonaldMurillo/momentum-cms/pull/20))
113
- - visual block editor & auth-gated admin mode ([#18](https://github.com/DonaldMurillo/momentum-cms/pull/18))
114
- - Add display formatting and complex field rendering ([#14](https://github.com/DonaldMurillo/momentum-cms/pull/14))
115
- - UI polish fixes and database-level FK constraints for relationship integrity ([#13](https://github.com/DonaldMurillo/momentum-cms/pull/13))
116
- - Add document versioning and drafts system ([#5](https://github.com/DonaldMurillo/momentum-cms/pull/5))
117
- - Add seeding feature with idempotent data initialization ([#1](https://github.com/DonaldMurillo/momentum-cms/pull/1))
118
- - Add typed access control helper functions ([980d8d0](https://github.com/DonaldMurillo/momentum-cms/commit/980d8d0))
119
- - Add type-safe Momentum API with signal support ([aee6c02](https://github.com/DonaldMurillo/momentum-cms/commit/aee6c02))
120
- - Implement admin UI with API integration and SSR hydration ([9ed7b2b](https://github.com/DonaldMurillo/momentum-cms/commit/9ed7b2b))
121
- - Initialize Momentum CMS foundation ([f64f581](https://github.com/DonaldMurillo/momentum-cms/commit/f64f581))
122
-
123
- ### 🩹 Fixes
124
-
125
- - resolve CUD toast interceptor issues ([#17](https://github.com/DonaldMurillo/momentum-cms/pull/17), [#1](https://github.com/DonaldMurillo/momentum-cms/issues/1), [#2](https://github.com/DonaldMurillo/momentum-cms/issues/2), [#3](https://github.com/DonaldMurillo/momentum-cms/issues/3), [#4](https://github.com/DonaldMurillo/momentum-cms/issues/4))
126
- - address 7 critical and high-severity security and validation bugs ([#12](https://github.com/DonaldMurillo/momentum-cms/pull/12))
127
- - address security vulnerabilities from code review ([#9](https://github.com/DonaldMurillo/momentum-cms/pull/9))
128
- - address security and reliability issues from code review ([#7](https://github.com/DonaldMurillo/momentum-cms/pull/7))
129
-
130
- ### ❤️ Thank You
131
-
132
- - Claude Haiku 4.5
133
- - Claude Opus 4.5
134
- - Claude Opus 4.6
135
- - Donald Murillo @DonaldMurillo
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024-present Momentum CMS Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,11 +0,0 @@
1
- # core
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build core` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test core` to execute the unit tests via [Jest](https://jestjs.io).
File without changes
File without changes