@mdfriday/foundry 25.9.2 → 25.9.4
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/README.md +10 -0
- package/dist/internal/application/ssg.d.ts.map +1 -1
- package/dist/internal/application/ssg.js +12 -0
- package/dist/internal/application/ssg.js.map +1 -1
- package/dist/internal/domain/config/entity/config.d.ts +8 -2
- package/dist/internal/domain/config/entity/config.d.ts.map +1 -1
- package/dist/internal/domain/config/entity/config.js +10 -3
- package/dist/internal/domain/config/entity/config.js.map +1 -1
- package/dist/internal/domain/config/entity/social.d.ts +66 -0
- package/dist/internal/domain/config/entity/social.d.ts.map +1 -0
- package/dist/internal/domain/config/entity/social.js +126 -0
- package/dist/internal/domain/config/entity/social.js.map +1 -0
- package/dist/internal/domain/config/factory/config.d.ts.map +1 -1
- package/dist/internal/domain/config/factory/config.js +2 -1
- package/dist/internal/domain/config/factory/config.js.map +1 -1
- package/dist/internal/domain/config/index.d.ts +2 -0
- package/dist/internal/domain/config/index.d.ts.map +1 -1
- package/dist/internal/domain/config/index.js +5 -1
- package/dist/internal/domain/config/index.js.map +1 -1
- package/dist/internal/domain/config/tests/entity-config.test.js +16 -12
- package/dist/internal/domain/config/tests/entity-config.test.js.map +1 -1
- package/dist/internal/domain/config/tests/social.test.d.ts +2 -0
- package/dist/internal/domain/config/tests/social.test.d.ts.map +1 -0
- package/dist/internal/domain/config/tests/social.test.js +164 -0
- package/dist/internal/domain/config/tests/social.test.js.map +1 -0
- package/dist/internal/domain/config/type.d.ts +22 -0
- package/dist/internal/domain/config/type.d.ts.map +1 -1
- package/dist/internal/domain/config/type.js.map +1 -1
- package/dist/internal/domain/config/vo/root.d.ts.map +1 -1
- package/dist/internal/domain/config/vo/root.js +2 -1
- package/dist/internal/domain/config/vo/root.js.map +1 -1
- package/dist/internal/domain/config/vo/social.d.ts +23 -0
- package/dist/internal/domain/config/vo/social.d.ts.map +1 -0
- package/dist/internal/domain/config/vo/social.js +212 -0
- package/dist/internal/domain/config/vo/social.js.map +1 -0
- package/dist/internal/domain/content/entity/page.d.ts +7 -1
- package/dist/internal/domain/content/entity/page.d.ts.map +1 -1
- package/dist/internal/domain/content/entity/page.js +36 -3
- package/dist/internal/domain/content/entity/page.js.map +1 -1
- package/dist/internal/domain/content/entity/pagebuilder.d.ts +3 -2
- package/dist/internal/domain/content/entity/pagebuilder.d.ts.map +1 -1
- package/dist/internal/domain/content/entity/pagebuilder.js +16 -5
- package/dist/internal/domain/content/entity/pagebuilder.js.map +1 -1
- package/dist/internal/domain/content/entity/pagemeta.d.ts +10 -2
- package/dist/internal/domain/content/entity/pagemeta.d.ts.map +1 -1
- package/dist/internal/domain/content/entity/pagemeta.js +17 -1
- package/dist/internal/domain/content/entity/pagemeta.js.map +1 -1
- package/dist/internal/domain/content/entity/paginator.d.ts +6 -0
- package/dist/internal/domain/content/entity/paginator.d.ts.map +1 -1
- package/dist/internal/domain/content/entity/paginator.js +26 -2
- package/dist/internal/domain/content/entity/paginator.js.map +1 -1
- package/dist/internal/domain/content/entity/section.js +5 -5
- package/dist/internal/domain/content/entity/section.js.map +1 -1
- package/dist/internal/domain/content/factory/hub.d.ts.map +1 -1
- package/dist/internal/domain/content/factory/hub.js +2 -1
- package/dist/internal/domain/content/factory/hub.js.map +1 -1
- package/dist/internal/domain/content/type.d.ts +59 -1
- package/dist/internal/domain/content/type.d.ts.map +1 -1
- package/dist/internal/domain/content/type.js.map +1 -1
- package/dist/internal/domain/content/vo/frontmatter.d.ts +29 -1
- package/dist/internal/domain/content/vo/frontmatter.d.ts.map +1 -1
- package/dist/internal/domain/content/vo/frontmatter.js +242 -1
- package/dist/internal/domain/content/vo/frontmatter.js.map +1 -1
- package/dist/internal/domain/markdown/entity/markdown.d.ts.map +1 -1
- package/dist/internal/domain/markdown/entity/markdown.js +5 -4
- package/dist/internal/domain/markdown/entity/markdown.js.map +1 -1
- package/dist/internal/domain/markdown/vo/content.d.ts +3 -6
- package/dist/internal/domain/markdown/vo/content.d.ts.map +1 -1
- package/dist/internal/domain/markdown/vo/content.js +32 -31
- package/dist/internal/domain/markdown/vo/content.js.map +1 -1
- package/dist/internal/domain/module/entity/module.d.ts.map +1 -1
- package/dist/internal/domain/module/entity/module.js +10 -6
- package/dist/internal/domain/module/entity/module.js.map +1 -1
- package/dist/internal/domain/module/vo/themes.test.js +12 -8
- package/dist/internal/domain/module/vo/themes.test.js.map +1 -1
- package/dist/internal/domain/site/entity/language.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/language.js +2 -0
- package/dist/internal/domain/site/entity/language.js.map +1 -1
- package/dist/internal/domain/site/entity/menu-builder.d.ts +39 -21
- package/dist/internal/domain/site/entity/menu-builder.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/menu-builder.js +264 -107
- package/dist/internal/domain/site/entity/menu-builder.js.map +1 -1
- package/dist/internal/domain/site/entity/page.d.ts +22 -8
- package/dist/internal/domain/site/entity/page.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/page.js +67 -6
- package/dist/internal/domain/site/entity/page.js.map +1 -1
- package/dist/internal/domain/site/entity/pager.d.ts +2 -0
- package/dist/internal/domain/site/entity/pager.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/pager.js +11 -0
- package/dist/internal/domain/site/entity/pager.js.map +1 -1
- package/dist/internal/domain/site/entity/site.d.ts +14 -8
- package/dist/internal/domain/site/entity/site.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/site.js +35 -8
- package/dist/internal/domain/site/entity/site.js.map +1 -1
- package/dist/internal/domain/site/entity/url.d.ts.map +1 -1
- package/dist/internal/domain/site/entity/url.js +3 -1
- package/dist/internal/domain/site/entity/url.js.map +1 -1
- package/dist/internal/domain/site/factory/navigation-factory.d.ts +4 -2
- package/dist/internal/domain/site/factory/navigation-factory.d.ts.map +1 -1
- package/dist/internal/domain/site/factory/navigation-factory.js +5 -4
- package/dist/internal/domain/site/factory/navigation-factory.js.map +1 -1
- package/dist/internal/domain/site/factory/site.d.ts.map +1 -1
- package/dist/internal/domain/site/factory/site.js +7 -9
- package/dist/internal/domain/site/factory/site.js.map +1 -1
- package/dist/internal/domain/site/type.d.ts +11 -0
- package/dist/internal/domain/site/type.d.ts.map +1 -1
- package/dist/internal/domain/site/valueobject/author.d.ts +14 -2
- package/dist/internal/domain/site/valueobject/author.d.ts.map +1 -1
- package/dist/internal/domain/site/valueobject/author.js +29 -4
- package/dist/internal/domain/site/valueobject/author.js.map +1 -1
- package/dist/internal/domain/site/valueobject/menu.d.ts +28 -115
- package/dist/internal/domain/site/valueobject/menu.d.ts.map +1 -1
- package/dist/internal/domain/site/valueobject/menu.js +44 -192
- package/dist/internal/domain/site/valueobject/menu.js.map +1 -1
- package/dist/internal/domain/site/valueobject/organization.d.ts +66 -0
- package/dist/internal/domain/site/valueobject/organization.d.ts.map +1 -0
- package/dist/internal/domain/site/valueobject/organization.js +115 -0
- package/dist/internal/domain/site/valueobject/organization.js.map +1 -0
- package/dist/internal/domain/site/valueobject/organization.test.d.ts +2 -0
- package/dist/internal/domain/site/valueobject/organization.test.d.ts.map +1 -0
- package/dist/internal/domain/site/valueobject/organization.test.js +78 -0
- package/dist/internal/domain/site/valueobject/organization.test.js.map +1 -0
- package/dist/internal/domain/template/vo/namespace.d.ts.map +1 -1
- package/dist/internal/domain/template/vo/namespace.js +8 -0
- package/dist/internal/domain/template/vo/namespace.js.map +1 -1
- package/dist/internal/domain/template/vo/registry.d.ts +18 -0
- package/dist/internal/domain/template/vo/registry.d.ts.map +1 -1
- package/dist/internal/domain/template/vo/registry.js +387 -9
- package/dist/internal/domain/template/vo/registry.js.map +1 -1
- package/dist/pkg/maps/scratch.d.ts +1 -0
- package/dist/pkg/maps/scratch.d.ts.map +1 -1
- package/dist/pkg/maps/scratch.js +4 -0
- package/dist/pkg/maps/scratch.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Menus = exports.Menu = void 0;
|
|
4
4
|
exports.newEmptyMenus = newEmptyMenus;
|
|
5
5
|
const log_1 = require("../../../../pkg/log");
|
|
6
6
|
// Create domain-specific logger for menu operations
|
|
7
7
|
const log = (0, log_1.getDomainLogger)('site', { component: 'menu' });
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Menu - A single menu item with hierarchical support
|
|
10
|
+
* Simplified structure focusing on essential properties
|
|
11
11
|
*/
|
|
12
|
-
class
|
|
12
|
+
class Menu {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
this._title = options.title;
|
|
15
15
|
this._url = options.url;
|
|
16
|
-
this._isDir = options.isDir;
|
|
17
|
-
this._hasIndex = options.hasIndex;
|
|
18
16
|
this._children = options.children || [];
|
|
19
17
|
this._weight = options.weight || 0;
|
|
20
18
|
this._identifier = options.identifier || this._url;
|
|
@@ -25,23 +23,17 @@ class MenuEntry {
|
|
|
25
23
|
title() {
|
|
26
24
|
return this._title;
|
|
27
25
|
}
|
|
26
|
+
get Title() {
|
|
27
|
+
return this.title();
|
|
28
|
+
}
|
|
28
29
|
/**
|
|
29
30
|
* Get menu entry URL
|
|
30
31
|
*/
|
|
31
32
|
url() {
|
|
32
33
|
return this._url;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
isDirectory() {
|
|
38
|
-
return this._isDir;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if this directory has an index page (leaf)
|
|
42
|
-
*/
|
|
43
|
-
hasIndex() {
|
|
44
|
-
return this._hasIndex;
|
|
35
|
+
get URL() {
|
|
36
|
+
return this.url();
|
|
45
37
|
}
|
|
46
38
|
/**
|
|
47
39
|
* Get child menu entries
|
|
@@ -49,6 +41,9 @@ class MenuEntry {
|
|
|
49
41
|
children() {
|
|
50
42
|
return [...this._children];
|
|
51
43
|
}
|
|
44
|
+
get Children() {
|
|
45
|
+
return this.children();
|
|
46
|
+
}
|
|
52
47
|
/**
|
|
53
48
|
* Get menu entry weight for sorting
|
|
54
49
|
*/
|
|
@@ -67,86 +62,78 @@ class MenuEntry {
|
|
|
67
62
|
hasChildren() {
|
|
68
63
|
return this._children.length > 0;
|
|
69
64
|
}
|
|
65
|
+
get HasChildren() {
|
|
66
|
+
return this.hasChildren();
|
|
67
|
+
}
|
|
70
68
|
/**
|
|
71
69
|
* Add a child menu entry
|
|
72
70
|
*/
|
|
73
71
|
addChild(child) {
|
|
74
72
|
const newChildren = [...this._children, child];
|
|
75
|
-
return new
|
|
73
|
+
return new Menu({
|
|
76
74
|
title: this._title,
|
|
77
75
|
url: this._url,
|
|
78
|
-
isDir: this._isDir,
|
|
79
|
-
hasIndex: this._hasIndex,
|
|
80
76
|
children: newChildren,
|
|
81
77
|
weight: this._weight,
|
|
82
78
|
identifier: this._identifier,
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
/**
|
|
86
|
-
* Convert to JSON representation
|
|
82
|
+
* Convert to JSON representation
|
|
87
83
|
*/
|
|
88
84
|
toJSON() {
|
|
89
85
|
return {
|
|
90
86
|
title: this._title,
|
|
91
87
|
url: this._url,
|
|
92
|
-
|
|
93
|
-
hasIndex: this._hasIndex,
|
|
88
|
+
weight: this._weight,
|
|
94
89
|
children: this._children.map(child => child.toJSON()),
|
|
95
90
|
};
|
|
96
91
|
}
|
|
97
92
|
/**
|
|
98
|
-
* Create a new
|
|
93
|
+
* Create a new Menu with updated children
|
|
99
94
|
*/
|
|
100
95
|
withChildren(children) {
|
|
101
|
-
return new
|
|
96
|
+
return new Menu({
|
|
102
97
|
title: this._title,
|
|
103
98
|
url: this._url,
|
|
104
|
-
isDir: this._isDir,
|
|
105
|
-
hasIndex: this._hasIndex,
|
|
106
99
|
children: children,
|
|
107
100
|
weight: this._weight,
|
|
108
101
|
identifier: this._identifier,
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
104
|
}
|
|
112
|
-
exports.
|
|
105
|
+
exports.Menu = Menu;
|
|
113
106
|
/**
|
|
114
|
-
*
|
|
107
|
+
* Menus - Simplified menu structure with nav and footer
|
|
115
108
|
*/
|
|
116
|
-
class
|
|
117
|
-
constructor(
|
|
118
|
-
this.
|
|
109
|
+
class Menus {
|
|
110
|
+
constructor(options = {}) {
|
|
111
|
+
this._nav = options.nav ? this.sortMenus([...options.nav]) : [];
|
|
112
|
+
this._footer = options.footer ? this.sortMenus([...options.footer]) : [];
|
|
119
113
|
}
|
|
120
114
|
/**
|
|
121
|
-
* Get
|
|
115
|
+
* Get navigation menu
|
|
122
116
|
*/
|
|
123
|
-
|
|
124
|
-
return [...this.
|
|
117
|
+
nav() {
|
|
118
|
+
return [...this._nav];
|
|
125
119
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*/
|
|
129
|
-
get(index) {
|
|
130
|
-
return this._entries[index];
|
|
120
|
+
get Nav() {
|
|
121
|
+
return this.nav();
|
|
131
122
|
}
|
|
132
123
|
/**
|
|
133
|
-
* Get
|
|
124
|
+
* Get footer menu
|
|
134
125
|
*/
|
|
135
|
-
|
|
136
|
-
return this.
|
|
126
|
+
footer() {
|
|
127
|
+
return [...this._footer];
|
|
137
128
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*/
|
|
141
|
-
add(entry) {
|
|
142
|
-
const newEntries = [...this._entries, entry];
|
|
143
|
-
return new Menu(newEntries).sortMenu();
|
|
129
|
+
get Footer() {
|
|
130
|
+
return this.footer();
|
|
144
131
|
}
|
|
145
132
|
/**
|
|
146
|
-
* Sort
|
|
133
|
+
* Sort menus by weight and then by title
|
|
147
134
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
sortMenus(menus) {
|
|
136
|
+
return menus.sort((a, b) => {
|
|
150
137
|
// Sort by weight first
|
|
151
138
|
if (a.weight() !== b.weight()) {
|
|
152
139
|
if (b.weight() === 0)
|
|
@@ -163,145 +150,15 @@ class Menu {
|
|
|
163
150
|
// Finally sort by identifier
|
|
164
151
|
return a.identifier().localeCompare(b.identifier());
|
|
165
152
|
});
|
|
166
|
-
return new Menu(sorted);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Filter menu entries by predicate
|
|
170
|
-
*/
|
|
171
|
-
filterMenu(predicate) {
|
|
172
|
-
const filtered = this._entries.filter(predicate);
|
|
173
|
-
return new Menu(filtered);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Find menu entry by identifier
|
|
177
|
-
*/
|
|
178
|
-
findByIdentifier(identifier) {
|
|
179
|
-
return this._entries.find(entry => entry.identifier() === identifier);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Find menu entry by URL
|
|
183
|
-
*/
|
|
184
|
-
findByUrl(url) {
|
|
185
|
-
return this._entries.find(entry => entry.url() === url);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Get all leaf entries (entries without children)
|
|
189
|
-
*/
|
|
190
|
-
getLeaves() {
|
|
191
|
-
return this.filterMenu(entry => !entry.hasChildren());
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Get all branch entries (entries with children)
|
|
195
|
-
*/
|
|
196
|
-
getBranches() {
|
|
197
|
-
return this.filterMenu(entry => entry.hasChildren());
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Convert to JSON array
|
|
201
|
-
*/
|
|
202
|
-
toJSON() {
|
|
203
|
-
return this._entries.map(entry => entry.toJSON());
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Iterator support
|
|
207
|
-
*/
|
|
208
|
-
[Symbol.iterator]() {
|
|
209
|
-
return this._entries[Symbol.iterator]();
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Map over entries
|
|
213
|
-
*/
|
|
214
|
-
map(callback) {
|
|
215
|
-
return this._entries.map(callback);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* ForEach over entries
|
|
219
|
-
*/
|
|
220
|
-
forEach(callback) {
|
|
221
|
-
this._entries.forEach(callback);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.Menu = Menu;
|
|
225
|
-
/**
|
|
226
|
-
* Menus - A collection of menus by name, supporting multiple languages
|
|
227
|
-
* TypeScript equivalent of valueobject.Menus from Go
|
|
228
|
-
*/
|
|
229
|
-
class Menus {
|
|
230
|
-
constructor(menus = new Map()) {
|
|
231
|
-
this._menus = new Map(menus);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Get menu by name
|
|
235
|
-
*/
|
|
236
|
-
get(name) {
|
|
237
|
-
return this._menus.get(name);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Set menu by name
|
|
241
|
-
*/
|
|
242
|
-
set(name, menu) {
|
|
243
|
-
const newMenus = new Map(this._menus);
|
|
244
|
-
newMenus.set(name, menu);
|
|
245
|
-
return new Menus(newMenus);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get all menu names
|
|
249
|
-
*/
|
|
250
|
-
names() {
|
|
251
|
-
return Array.from(this._menus.keys());
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Check if menu exists
|
|
255
|
-
*/
|
|
256
|
-
has(name) {
|
|
257
|
-
return this._menus.has(name);
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Check if menu entry has sub-menu
|
|
261
|
-
*/
|
|
262
|
-
hasSubMenu(entry) {
|
|
263
|
-
const menu = this._menus.get(entry.title());
|
|
264
|
-
if (!menu)
|
|
265
|
-
return false;
|
|
266
|
-
if (menu.length === 1 && menu.get(0)?.title() === entry.title()) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
return menu.length > 1;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Get all menus as entries
|
|
273
|
-
*/
|
|
274
|
-
entries() {
|
|
275
|
-
return Array.from(this._menus.entries());
|
|
276
153
|
}
|
|
277
154
|
/**
|
|
278
155
|
* Convert to plain object for serialization
|
|
279
156
|
*/
|
|
280
157
|
toJSON() {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
return result;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Merge with another Menus instance
|
|
289
|
-
*/
|
|
290
|
-
merge(other) {
|
|
291
|
-
const newMenus = new Map(this._menus);
|
|
292
|
-
for (const [name, menu] of other._menus.entries()) {
|
|
293
|
-
if (newMenus.has(name)) {
|
|
294
|
-
// Merge menu entries
|
|
295
|
-
const existingMenu = newMenus.get(name);
|
|
296
|
-
const mergedEntries = [...existingMenu.entries(), ...menu.entries()];
|
|
297
|
-
const mergedMenu = new Menu(mergedEntries).sortMenu();
|
|
298
|
-
newMenus.set(name, mergedMenu);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
newMenus.set(name, menu);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return new Menus(newMenus);
|
|
158
|
+
return {
|
|
159
|
+
nav: this._nav.map(menu => menu.toJSON()),
|
|
160
|
+
footer: this._footer.map(menu => menu.toJSON())
|
|
161
|
+
};
|
|
305
162
|
}
|
|
306
163
|
}
|
|
307
164
|
exports.Menus = Menus;
|
|
@@ -309,11 +166,6 @@ exports.Menus = Menus;
|
|
|
309
166
|
* Create empty menus instance
|
|
310
167
|
*/
|
|
311
168
|
function newEmptyMenus() {
|
|
312
|
-
return new Menus();
|
|
169
|
+
return new Menus({});
|
|
313
170
|
}
|
|
314
|
-
/**
|
|
315
|
-
* Menu constants
|
|
316
|
-
*/
|
|
317
|
-
exports.MENUS_AFTER = "after";
|
|
318
|
-
exports.MENUS_BEFORE = "before";
|
|
319
171
|
//# sourceMappingURL=menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../../internal/domain/site/valueobject/menu.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":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AE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACzC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SAChD,CAAC;IACJ,CAAC;CACF;AAlED,sBAkEC;AAED;;GAEG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Organization as ContentOrganization } from '../../../domain/content';
|
|
2
|
+
import { SocialLink } from "../../../domain/site/valueobject/author";
|
|
3
|
+
export declare class Organization {
|
|
4
|
+
private readonly _name;
|
|
5
|
+
private readonly _description;
|
|
6
|
+
private readonly _website;
|
|
7
|
+
private readonly _logo;
|
|
8
|
+
private readonly _email;
|
|
9
|
+
private readonly _address;
|
|
10
|
+
private readonly _vision;
|
|
11
|
+
private _homeOrganization;
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Get organization name
|
|
15
|
+
*/
|
|
16
|
+
name(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get organization description
|
|
19
|
+
*/
|
|
20
|
+
description(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get organization website
|
|
23
|
+
*/
|
|
24
|
+
website(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Set the home organization from content
|
|
27
|
+
*/
|
|
28
|
+
organization(organization: ContentOrganization | undefined): Organization;
|
|
29
|
+
/**
|
|
30
|
+
* Get organization name with fallback to home organization
|
|
31
|
+
*/
|
|
32
|
+
get Name(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Get organization description with fallback to home organization
|
|
35
|
+
*/
|
|
36
|
+
get Description(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get organization website with fallback to home organization
|
|
39
|
+
*/
|
|
40
|
+
get Website(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get organization vision from home organization
|
|
43
|
+
*/
|
|
44
|
+
get Vision(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get organization logo from home organization
|
|
47
|
+
*/
|
|
48
|
+
get Logo(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get organization contact from home organization
|
|
51
|
+
*/
|
|
52
|
+
get Address(): string;
|
|
53
|
+
get Email(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get organization social from home organization
|
|
56
|
+
*/
|
|
57
|
+
get Social(): import("../../../domain/content").Social | undefined;
|
|
58
|
+
SocialById(id: string): string;
|
|
59
|
+
get Socials(): SocialLink[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Factory function to create new Organization
|
|
63
|
+
* TypeScript equivalent of NewOrganization function from Go
|
|
64
|
+
*/
|
|
65
|
+
export declare function newOrganization(): Organization;
|
|
66
|
+
//# sourceMappingURL=organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../../../internal/domain/site/valueobject/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,IAAI,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAC,UAAU,EAAC,MAAM,0CAA0C,CAAC;AAKpE,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,iBAAiB,CAAkC;;IAY3D;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,YAAY,CAAC,YAAY,EAAE,mBAAmB,GAAG,SAAS,GAAG,YAAY;IAKzE;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,OAAO,WAEV;IAEC,IAAI,KAAK,WAER;IAEH;;OAEG;IACH,IAAI,MAAM,0DAET;IAED,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAI9B,IAAI,OAAO,IAAI,UAAU,EAAE,CAkB1B;CAEF;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAE9C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Organization = void 0;
|
|
4
|
+
exports.newOrganization = newOrganization;
|
|
5
|
+
const log_1 = require("../../../../pkg/log");
|
|
6
|
+
const log = (0, log_1.getDomainLogger)('site', { component: 'organization' });
|
|
7
|
+
class Organization {
|
|
8
|
+
constructor() {
|
|
9
|
+
this._name = 'MDFriday';
|
|
10
|
+
this._description = 'Turn markdown to website, in minutes.';
|
|
11
|
+
this._website = 'https://mdfriday.com';
|
|
12
|
+
this._logo = 'https://gohugo.net/mdfriday.svg';
|
|
13
|
+
this._email = 'support@mdfriday.com';
|
|
14
|
+
this._address = 'Cang long Street, Wuhan, China';
|
|
15
|
+
this._vision = 'Make site generation easy and accessible for everyone.';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get organization name
|
|
19
|
+
*/
|
|
20
|
+
name() {
|
|
21
|
+
return this._name;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get organization description
|
|
25
|
+
*/
|
|
26
|
+
description() {
|
|
27
|
+
return this._description;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get organization website
|
|
31
|
+
*/
|
|
32
|
+
website() {
|
|
33
|
+
return this._website;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Set the home organization from content
|
|
37
|
+
*/
|
|
38
|
+
organization(organization) {
|
|
39
|
+
this._homeOrganization = organization;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get organization name with fallback to home organization
|
|
44
|
+
*/
|
|
45
|
+
get Name() {
|
|
46
|
+
return this._homeOrganization?.name || this.name();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get organization description with fallback to home organization
|
|
50
|
+
*/
|
|
51
|
+
get Description() {
|
|
52
|
+
return this._homeOrganization?.description || this.description();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get organization website with fallback to home organization
|
|
56
|
+
*/
|
|
57
|
+
get Website() {
|
|
58
|
+
return this._homeOrganization?.website || this.website();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get organization vision from home organization
|
|
62
|
+
*/
|
|
63
|
+
get Vision() {
|
|
64
|
+
return this._homeOrganization?.vision || this._vision;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get organization logo from home organization
|
|
68
|
+
*/
|
|
69
|
+
get Logo() {
|
|
70
|
+
return this._homeOrganization?.logo || this._logo;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get organization contact from home organization
|
|
74
|
+
*/
|
|
75
|
+
get Address() {
|
|
76
|
+
return this._homeOrganization?.contact?.address || this._address;
|
|
77
|
+
}
|
|
78
|
+
get Email() {
|
|
79
|
+
return this._homeOrganization?.contact?.email || this._email;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get organization social from home organization
|
|
83
|
+
*/
|
|
84
|
+
get Social() {
|
|
85
|
+
return this._homeOrganization?.social;
|
|
86
|
+
}
|
|
87
|
+
SocialById(id) {
|
|
88
|
+
return this._homeOrganization?.social?.[id] || "";
|
|
89
|
+
}
|
|
90
|
+
get Socials() {
|
|
91
|
+
const socials = [];
|
|
92
|
+
if (!this._homeOrganization?.social) {
|
|
93
|
+
return socials;
|
|
94
|
+
}
|
|
95
|
+
// Iterate through all social media entries
|
|
96
|
+
for (const [key, value] of Object.entries(this._homeOrganization.social)) {
|
|
97
|
+
if (value) {
|
|
98
|
+
socials.push({
|
|
99
|
+
ID: key,
|
|
100
|
+
Link: value
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return socials;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.Organization = Organization;
|
|
108
|
+
/**
|
|
109
|
+
* Factory function to create new Organization
|
|
110
|
+
* TypeScript equivalent of NewOrganization function from Go
|
|
111
|
+
*/
|
|
112
|
+
function newOrganization() {
|
|
113
|
+
return new Organization();
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../../internal/domain/site/valueobject/organization.ts"],"names":[],"mappings":";;;AA0IA,0CAEC;AAzID,kCAA2C;AAC3C,MAAM,GAAG,GAAG,IAAA,qBAAe,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;AAEnE,MAAa,YAAY;IAUvB;QACE,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,uCAAuC,CAAC;QAC5D,IAAI,CAAC,QAAQ,GAAG,sBAA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AAC;IACnE,CAAC;IAEC,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;IACjE,CAAC;IAEH;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,IAAI,OAAO;QACT,MAAM,OAAO,GAAiB,EAAE,CAAC;QAEjC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,2CAA2C;QAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;YACzE,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,IAAI,CAAC;oBACX,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,KAAK;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAEF;AA9HD,oCA8HC;AAED;;;GAGG;AACH,SAAgB,eAAe;IAC7B,OAAO,IAAI,YAAY,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.test.d.ts","sourceRoot":"","sources":["../../../../../internal/domain/site/valueobject/organization.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const organization_1 = require("./organization");
|
|
4
|
+
describe('Organization', () => {
|
|
5
|
+
describe('newOrganization factory', () => {
|
|
6
|
+
it('should create Organization with default values', () => {
|
|
7
|
+
const org = (0, organization_1.newOrganization)();
|
|
8
|
+
expect(org.name()).toBe('MDFriday');
|
|
9
|
+
expect(org.description()).toBe('Turn markdown to website, in minutes.');
|
|
10
|
+
expect(org.website()).toBe('https://mdfriday.com');
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
describe('Organization methods', () => {
|
|
14
|
+
let organization;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
organization = (0, organization_1.newOrganization)();
|
|
17
|
+
});
|
|
18
|
+
it('should return default values when no home organization is set', () => {
|
|
19
|
+
expect(organization.Name).toBe('MDFriday');
|
|
20
|
+
expect(organization.Description).toBe('Turn markdown to website, in minutes.');
|
|
21
|
+
expect(organization.Website).toBe('https://mdfriday.com');
|
|
22
|
+
expect(organization.Vision).toBe('Make site generation easy and accessible for everyone.');
|
|
23
|
+
expect(organization.Logo).toBe('https://gohugo.net/mdfriday.svg');
|
|
24
|
+
expect(organization.Address).toBe('Cang long Street, Wuhan, China');
|
|
25
|
+
expect(organization.Email).toBe('support@mdfriday.com');
|
|
26
|
+
expect(organization.Social).toBeUndefined();
|
|
27
|
+
});
|
|
28
|
+
it('should return home organization values when set', () => {
|
|
29
|
+
const homeOrg = {
|
|
30
|
+
name: 'Home Org',
|
|
31
|
+
description: 'Home Description',
|
|
32
|
+
website: 'https://home.com',
|
|
33
|
+
vision: 'Home Vision',
|
|
34
|
+
logo: '/logo.png',
|
|
35
|
+
contact: {
|
|
36
|
+
email: 'contact@home.com',
|
|
37
|
+
address: '123 Home St',
|
|
38
|
+
phone: '+1-555-0123'
|
|
39
|
+
},
|
|
40
|
+
social: {
|
|
41
|
+
github: 'homeorg',
|
|
42
|
+
twitter: 'homeorg'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
organization.organization(homeOrg);
|
|
46
|
+
expect(organization.Name).toBe('Home Org');
|
|
47
|
+
expect(organization.Description).toBe('Home Description');
|
|
48
|
+
expect(organization.Website).toBe('https://home.com');
|
|
49
|
+
expect(organization.Vision).toBe('Home Vision');
|
|
50
|
+
expect(organization.Logo).toBe('/logo.png');
|
|
51
|
+
expect(organization.Email).toBe('contact@home.com');
|
|
52
|
+
expect(organization.Address).toBe('123 Home St');
|
|
53
|
+
expect(organization.Social).toEqual({
|
|
54
|
+
github: 'homeorg',
|
|
55
|
+
twitter: 'homeorg'
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
it('should fallback to default values when home organization has partial data', () => {
|
|
59
|
+
const partialHomeOrg = {
|
|
60
|
+
name: 'Partial Home Org',
|
|
61
|
+
// description and website are undefined
|
|
62
|
+
vision: 'Partial Vision'
|
|
63
|
+
};
|
|
64
|
+
organization.organization(partialHomeOrg);
|
|
65
|
+
expect(organization.Name).toBe('Partial Home Org');
|
|
66
|
+
expect(organization.Description).toBe('Turn markdown to website, in minutes.'); // fallback
|
|
67
|
+
expect(organization.Website).toBe('https://mdfriday.com'); // fallback
|
|
68
|
+
expect(organization.Vision).toBe('Partial Vision');
|
|
69
|
+
});
|
|
70
|
+
it('should handle undefined home organization', () => {
|
|
71
|
+
organization.organization(undefined);
|
|
72
|
+
expect(organization.Name).toBe('MDFriday');
|
|
73
|
+
expect(organization.Description).toBe('Turn markdown to website, in minutes.');
|
|
74
|
+
expect(organization.Website).toBe('https://mdfriday.com');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=organization.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.test.js","sourceRoot":"","sources":["../../../../../internal/domain/site/valueobject/organization.test.ts"],"names":[],"mappings":";;AAAA,iDAA+D;AAG/D,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,GAAG,GAAG,IAAA,8BAAe,GAAE,CAAC;YAE9B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aACzB,CAAC;YAEF,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;YAE1C,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACnD,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC,CAAC,WAAW;YAC3F,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,WAAW;YACtE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAErC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;YAC/E,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../../../internal/domain/template/vo/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAgB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../../../internal/domain/template/vo/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAA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