proteum 2.5.21 → 2.5.22
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proteum",
|
|
3
3
|
"description": "LLM-first Opinionated Typescript Framework for web applications.",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.22",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/proteum.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -3,26 +3,23 @@
|
|
|
3
3
|
----------------------------------*/
|
|
4
4
|
|
|
5
5
|
/*----------------------------------
|
|
6
|
-
-
|
|
6
|
+
- DEPENDENCIES
|
|
7
7
|
----------------------------------*/
|
|
8
8
|
|
|
9
|
-
type
|
|
9
|
+
import type { Thing } from 'schema-dts';
|
|
10
|
+
import type { TApplicationIdentityConfig } from '@common/applicationConfig';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
locale: string;
|
|
15
|
-
author: { name: string; url: string };
|
|
16
|
-
web: { jsonld?: Record<string, unknown> };
|
|
17
|
-
};
|
|
12
|
+
/*----------------------------------
|
|
13
|
+
- TYPES
|
|
14
|
+
----------------------------------*/
|
|
18
15
|
|
|
19
16
|
export type TDefaultJsonLdInput = {
|
|
20
17
|
/** The nodes the page pushed itself, before the defaults are added. */
|
|
21
|
-
pageJsonLd: readonly
|
|
22
|
-
url: string;
|
|
23
|
-
title: string;
|
|
24
|
-
description: string;
|
|
25
|
-
identity:
|
|
18
|
+
pageJsonLd: readonly Thing[];
|
|
19
|
+
url: string | undefined;
|
|
20
|
+
title: string | undefined;
|
|
21
|
+
description: string | undefined;
|
|
22
|
+
identity: TApplicationIdentityConfig;
|
|
26
23
|
resolveUrl: (path: string) => string;
|
|
27
24
|
};
|
|
28
25
|
|
|
@@ -50,10 +47,14 @@ const WEB_PAGE_TYPES: ReadonlySet<string> = new Set([
|
|
|
50
47
|
'SearchResultsPage',
|
|
51
48
|
]);
|
|
52
49
|
|
|
53
|
-
const describesWebPage = (node:
|
|
54
|
-
(
|
|
50
|
+
const describesWebPage = (node: Thing): boolean => {
|
|
51
|
+
if (typeof node !== 'object' || node === null || !('@type' in node)) return false;
|
|
52
|
+
|
|
53
|
+
const declared: unknown = node['@type'];
|
|
54
|
+
return (Array.isArray(declared) ? declared : [declared]).some(
|
|
55
55
|
(type) => typeof type === 'string' && WEB_PAGE_TYPES.has(type),
|
|
56
56
|
);
|
|
57
|
+
};
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* The publisher identity every page carries (`#organization`, `#website`) plus a generic
|
|
@@ -72,8 +73,8 @@ export const buildDefaultJsonLd = ({
|
|
|
72
73
|
description,
|
|
73
74
|
identity,
|
|
74
75
|
resolveUrl,
|
|
75
|
-
}: TDefaultJsonLdInput):
|
|
76
|
-
const nodes:
|
|
76
|
+
}: TDefaultJsonLdInput): Thing[] => {
|
|
77
|
+
const nodes: Thing[] = [
|
|
77
78
|
{
|
|
78
79
|
'@type': 'Organization',
|
|
79
80
|
'@id': resolveUrl('/#organization'),
|