@jdevalk/seo-graph-core 0.3.0 → 0.4.1
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/AGENTS.md +3019 -0
- package/LICENSE +21 -0
- package/README.md +38 -11
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pieces/article.d.ts +12 -5
- package/dist/pieces/article.d.ts.map +1 -1
- package/dist/pieces/article.js +4 -9
- package/dist/pieces/article.js.map +1 -1
- package/dist/pieces/breadcrumb.d.ts.map +1 -1
- package/dist/pieces/breadcrumb.js +2 -1
- package/dist/pieces/breadcrumb.js.map +1 -1
- package/dist/pieces/webpage.d.ts +2 -12
- package/dist/pieces/webpage.d.ts.map +1 -1
- package/dist/pieces/webpage.js +2 -12
- package/dist/pieces/webpage.js.map +1 -1
- package/dist/pieces/website.d.ts +2 -5
- package/dist/pieces/website.d.ts.map +1 -1
- package/dist/pieces/website.js +2 -4
- package/dist/pieces/website.js.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +26 -1
- package/dist/types.js.map +1 -1
- package/package.json +50 -49
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joost de Valk
|
|
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
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Pure schema.org JSON-LD graph builders. Runtime-agnostic core for agent-ready SEO.
|
|
4
4
|
|
|
5
|
-
> **Status:** `0.1.0` (pre-1.0). The API works and has three real consumers
|
|
6
|
-
> in production, but a few known warts (listed below) will be smoothed out in
|
|
7
|
-
> `0.2.x` without breaking changes before a stable `1.0`.
|
|
8
|
-
|
|
9
5
|
## What this is
|
|
10
6
|
|
|
11
7
|
A small, dependency-light library that builds a valid schema.org `@graph`
|
|
@@ -17,6 +13,9 @@ any other runtime. Use [`@jdevalk/astro-seo-graph`](https://www.npmjs.com/packag
|
|
|
17
13
|
for the Astro integration, or consume this directly from your own CMS or
|
|
18
14
|
framework.
|
|
19
15
|
|
|
16
|
+
For detailed usage — including all builder signatures, site-type recipes, and
|
|
17
|
+
schema.org best practices — see [AGENTS.md](https://github.com/jdevalk/seo-graph/blob/main/AGENTS.md).
|
|
18
|
+
|
|
20
19
|
## Install
|
|
21
20
|
|
|
22
21
|
```sh
|
|
@@ -25,12 +24,38 @@ npm install @jdevalk/seo-graph-core
|
|
|
25
24
|
|
|
26
25
|
## What you get
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
27
|
+
### Graph assembly
|
|
28
|
+
|
|
29
|
+
| API | Purpose |
|
|
30
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
31
|
+
| `makeIds({ siteUrl, personUrl? })` | `IdFactory` for stable `@id` references across site-wide and per-page entities. |
|
|
32
|
+
| `assembleGraph(pieces)` | Wraps pieces in a `{ @context, @graph }` envelope with first-wins deduplication by `@id`. |
|
|
33
|
+
| `deduplicateByGraphId(entities)` | The dedup engine on its own, in case you need custom assembly. |
|
|
34
|
+
|
|
35
|
+
### Piece builders
|
|
36
|
+
|
|
37
|
+
All builders take an input object and the `IdFactory`, and return a plain
|
|
38
|
+
object with `@type` and `@id`. Builders for CreativeWork subtypes (`WebSite`,
|
|
39
|
+
`WebPage`, `Article`) share a common set of optional fields via
|
|
40
|
+
`CreativeWorkFields`: `description`, `inLanguage`, `datePublished`,
|
|
41
|
+
`dateModified`, `about`, `copyrightHolder`, `copyrightYear`,
|
|
42
|
+
`copyrightNotice`, `license`, and `isAccessibleForFree`.
|
|
43
|
+
|
|
44
|
+
| Builder | Schema.org type | Subtype parameter |
|
|
45
|
+
| ---------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| `buildWebSite` | `WebSite` | — |
|
|
47
|
+
| `buildWebPage` | `WebPage` | `'WebPage'` \| `'ProfilePage'` \| `'CollectionPage'` |
|
|
48
|
+
| `buildArticle` | `Article` | `'Article'` \| `'BlogPosting'` \| `'NewsArticle'` \| `'TechArticle'` \| `'ScholarlyArticle'` \| `'Report'` |
|
|
49
|
+
| `buildPerson` | `Person` | — |
|
|
50
|
+
| `buildOrganization` | `Organization` | Any subtype string (e.g. `'Restaurant'`, `'LocalBusiness'`) |
|
|
51
|
+
| `buildBreadcrumbList` | `BreadcrumbList` | — |
|
|
52
|
+
| `buildImageObject` | `ImageObject` | — |
|
|
53
|
+
| `buildVideoObject` | `VideoObject` | — |
|
|
54
|
+
| `buildSiteNavigationElement` | `SiteNavigationElement` | — |
|
|
55
|
+
| `buildCustomPiece` | Any | Pass `@type` directly in the input object |
|
|
56
|
+
|
|
57
|
+
Every builder accepts an `extra` escape hatch for schema.org properties not
|
|
58
|
+
covered by the typed interface.
|
|
34
59
|
|
|
35
60
|
## Usage
|
|
36
61
|
|
|
@@ -53,6 +78,7 @@ const graph = assembleGraph([
|
|
|
53
78
|
url: 'https://example.com/',
|
|
54
79
|
name: 'Example',
|
|
55
80
|
publisher: { '@id': ids.person },
|
|
81
|
+
inLanguage: 'en-US',
|
|
56
82
|
},
|
|
57
83
|
ids,
|
|
58
84
|
),
|
|
@@ -73,10 +99,11 @@ const graph = assembleGraph([
|
|
|
73
99
|
author: { '@id': ids.person },
|
|
74
100
|
publisher: { '@id': ids.person },
|
|
75
101
|
headline: 'My Post',
|
|
76
|
-
description: '
|
|
102
|
+
description: 'A post about something interesting.',
|
|
77
103
|
datePublished: new Date('2026-04-07'),
|
|
78
104
|
},
|
|
79
105
|
ids,
|
|
106
|
+
'BlogPosting',
|
|
80
107
|
),
|
|
81
108
|
buildBreadcrumbList(
|
|
82
109
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type { GraphEntity, Reference, SchemaGraph } from './types.js';
|
|
1
|
+
export type { GraphEntity, Reference, SchemaGraph, CreativeWorkFields } from './types.js';
|
|
2
|
+
export { applyCreativeWorkFields } from './types.js';
|
|
2
3
|
export type { IdFactory, MakeIdsOptions } from './ids.js';
|
|
3
4
|
export { makeIds } from './ids.js';
|
|
4
5
|
export { deduplicateByGraphId } from './dedupe.js';
|
|
@@ -14,7 +15,7 @@ export type { NavigationItem, SiteNavigationInput } from './pieces/navigation.js
|
|
|
14
15
|
export { buildWebPage } from './pieces/webpage.js';
|
|
15
16
|
export type { WebPageInput, WebPageType } from './pieces/webpage.js';
|
|
16
17
|
export { buildArticle } from './pieces/article.js';
|
|
17
|
-
export type { ArticleInput } from './pieces/article.js';
|
|
18
|
+
export type { ArticleInput, ArticleType } from './pieces/article.js';
|
|
18
19
|
export { buildBreadcrumbList } from './pieces/breadcrumb.js';
|
|
19
20
|
export type { BreadcrumbItem, BreadcrumbListInput } from './pieces/breadcrumb.js';
|
|
20
21
|
export { buildImageObject } from './pieces/image.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @jdevalk/seo-graph-core — agent-ready schema.org JSON-LD graph builders.
|
|
2
|
+
export { applyCreativeWorkFields } from './types.js';
|
|
2
3
|
export { makeIds } from './ids.js';
|
|
3
4
|
export { deduplicateByGraphId } from './dedupe.js';
|
|
4
5
|
export { assembleGraph } from './assemble.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAG3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,iBAAiB;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/pieces/article.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IdFactory } from '../ids.js';
|
|
2
|
-
import type { Reference } from '../types.js';
|
|
3
|
-
export interface ArticleInput {
|
|
2
|
+
import type { Reference, CreativeWorkFields } from '../types.js';
|
|
3
|
+
export interface ArticleInput extends CreativeWorkFields {
|
|
4
4
|
/** Canonical URL of the article's page. The @id is `${url}#article`. */
|
|
5
5
|
url: string;
|
|
6
6
|
/** Reference to the enclosing WebPage (usually ids.webPage(url)). */
|
|
@@ -10,10 +10,10 @@ export interface ArticleInput {
|
|
|
10
10
|
/** Publisher reference. Usually the same as the author for personal blogs. */
|
|
11
11
|
publisher: Reference;
|
|
12
12
|
headline: string;
|
|
13
|
+
/** Required for articles — overrides the optional inherited field. */
|
|
13
14
|
description: string;
|
|
14
|
-
|
|
15
|
+
/** Required for articles — overrides the optional inherited field. Emitted as ISO string. */
|
|
15
16
|
datePublished: Date;
|
|
16
|
-
dateModified?: Date;
|
|
17
17
|
/** Reference to the primary ImageObject, if any. */
|
|
18
18
|
image?: Reference;
|
|
19
19
|
/** Top-level category, emitted as `articleSection`. */
|
|
@@ -26,11 +26,18 @@ export interface ArticleInput {
|
|
|
26
26
|
articleBody?: string;
|
|
27
27
|
extra?: Record<string, unknown>;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Concrete Article subtype. `Article` is the default; use `BlogPosting`
|
|
31
|
+
* for blog posts, `NewsArticle` for journalism, `TechArticle` for
|
|
32
|
+
* technical docs, `ScholarlyArticle` for academic papers, or `Report`
|
|
33
|
+
* for data/research reports.
|
|
34
|
+
*/
|
|
35
|
+
export type ArticleType = 'Article' | 'BlogPosting' | 'NewsArticle' | 'TechArticle' | 'ScholarlyArticle' | 'Report';
|
|
29
36
|
/**
|
|
30
37
|
* Build a schema.org Article piece. The caller is responsible for pre-
|
|
31
38
|
* computing the references (author, publisher, isPartOf, image) using the
|
|
32
39
|
* IdFactory, so core doesn't have to know anything about how the site
|
|
33
40
|
* models its Person/Organization/WebPage entities.
|
|
34
41
|
*/
|
|
35
|
-
export declare function buildArticle(input: ArticleInput, ids: IdFactory): Record<string, unknown>;
|
|
42
|
+
export declare function buildArticle(input: ArticleInput, ids: IdFactory, type?: ArticleType): Record<string, unknown>;
|
|
36
43
|
//# sourceMappingURL=article.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.d.ts","sourceRoot":"","sources":["../../src/pieces/article.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"article.d.ts","sourceRoot":"","sources":["../../src/pieces/article.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACpD,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,QAAQ,EAAE,SAAS,CAAC;IACpB,kEAAkE;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,aAAa,EAAE,IAAI,CAAC;IACpB,oDAAoD;IACpD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACjB,SAAS,GACT,aAAa,GACb,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,QAAQ,CAAC;AAEf;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,WAAuB,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
|
package/dist/pieces/article.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
+
import { applyCreativeWorkFields } from '../types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Build a schema.org Article piece. The caller is responsible for pre-
|
|
3
4
|
* computing the references (author, publisher, isPartOf, image) using the
|
|
4
5
|
* IdFactory, so core doesn't have to know anything about how the site
|
|
5
6
|
* models its Person/Organization/WebPage entities.
|
|
6
7
|
*/
|
|
7
|
-
export function buildArticle(input, ids) {
|
|
8
|
+
export function buildArticle(input, ids, type = 'Article') {
|
|
8
9
|
const piece = {
|
|
9
|
-
'@type':
|
|
10
|
+
'@type': type,
|
|
10
11
|
'@id': ids.article(input.url),
|
|
11
12
|
isPartOf: input.isPartOf,
|
|
12
13
|
author: input.author,
|
|
13
14
|
headline: input.headline,
|
|
14
15
|
mainEntityOfPage: { '@id': ids.webPage(input.url) },
|
|
15
16
|
publisher: input.publisher,
|
|
16
|
-
description: input.description,
|
|
17
|
-
datePublished: input.datePublished.toISOString(),
|
|
18
17
|
};
|
|
19
|
-
if (input.inLanguage !== undefined)
|
|
20
|
-
piece.inLanguage = input.inLanguage;
|
|
21
|
-
if (input.dateModified !== undefined) {
|
|
22
|
-
piece.dateModified = input.dateModified.toISOString();
|
|
23
|
-
}
|
|
24
18
|
if (input.image !== undefined)
|
|
25
19
|
piece.image = input.image;
|
|
20
|
+
applyCreativeWorkFields(piece, input);
|
|
26
21
|
if (input.articleSection !== undefined)
|
|
27
22
|
piece.articleSection = input.articleSection;
|
|
28
23
|
if (input.wordCount !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.js","sourceRoot":"","sources":["../../src/pieces/article.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"article.js","sourceRoot":"","sources":["../../src/pieces/article.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AA2CtD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CACxB,KAAmB,EACnB,GAAc,EACd,OAAoB,SAAS;IAE7B,MAAM,KAAK,GAA4B;QACnC,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACnD,SAAS,EAAE,KAAK,CAAC,SAAS;KAC7B,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACzD,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS;QAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IACpF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACrE,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAE3E,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/pieces/breadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC3B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,SAAS,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/pieces/breadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC3B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,SAAS,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB"}
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* Astro URL, use `@jdevalk/astro-seo-graph`'s breadcrumb helper instead.
|
|
8
8
|
*/
|
|
9
9
|
export function buildBreadcrumbList(input, ids) {
|
|
10
|
+
const lastIndex = input.items.length - 1;
|
|
10
11
|
const itemListElement = input.items.map((item, index) => ({
|
|
11
12
|
'@type': 'ListItem',
|
|
12
13
|
position: index + 1,
|
|
13
14
|
name: item.name,
|
|
14
|
-
item: item.url,
|
|
15
|
+
item: index === lastIndex ? { '@id': ids.webPage(item.url) } : item.url,
|
|
15
16
|
}));
|
|
16
17
|
return {
|
|
17
18
|
'@type': 'BreadcrumbList',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../src/pieces/breadcrumb.ts"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,KAA0B,EAC1B,GAAc;IAEd,MAAM,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,KAAK,GAAG,CAAC;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../src/pieces/breadcrumb.ts"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,KAA0B,EAC1B,GAAc;IAEd,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,KAAK,GAAG,CAAC;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG;KAC1E,CAAC,CAAC,CAAC;IACJ,OAAO;QACH,OAAO,EAAE,gBAAgB;QACzB,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;QAChC,eAAe;QACf,GAAG,KAAK,CAAC,KAAK;KACjB,CAAC;AACN,CAAC"}
|
package/dist/pieces/webpage.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IdFactory } from '../ids.js';
|
|
2
|
-
import type { Reference } from '../types.js';
|
|
2
|
+
import type { Reference, CreativeWorkFields } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Concrete WebPage subtype. `WebPage` is the default; use `ProfilePage`
|
|
5
5
|
* for /about-me style pages and `CollectionPage` for index/listing pages.
|
|
6
6
|
*/
|
|
7
7
|
export type WebPageType = 'WebPage' | 'ProfilePage' | 'CollectionPage';
|
|
8
|
-
export interface WebPageInput {
|
|
8
|
+
export interface WebPageInput extends CreativeWorkFields {
|
|
9
9
|
/** Canonical URL of the page. The WebPage @id equals this URL. */
|
|
10
10
|
url: string;
|
|
11
11
|
/** Page title (becomes `name`). */
|
|
@@ -19,18 +19,8 @@ export interface WebPageInput {
|
|
|
19
19
|
* simply omit it.
|
|
20
20
|
*/
|
|
21
21
|
breadcrumb?: Reference;
|
|
22
|
-
inLanguage?: string;
|
|
23
|
-
/** Publish date — emitted as ISO string. */
|
|
24
|
-
datePublished?: Date;
|
|
25
|
-
/** Update date — emitted as ISO string. */
|
|
26
|
-
dateModified?: Date;
|
|
27
22
|
/** Reference to the primary ImageObject, if any. */
|
|
28
23
|
primaryImage?: Reference;
|
|
29
|
-
/**
|
|
30
|
-
* Reference to the entity this page is "about" — used for ProfilePage
|
|
31
|
-
* (the Person) and homepage variants.
|
|
32
|
-
*/
|
|
33
|
-
about?: Reference;
|
|
34
24
|
/**
|
|
35
25
|
* Custom potentialAction. If omitted, defaults to a single ReadAction
|
|
36
26
|
* targeting the page URL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpage.d.ts","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"webpage.d.ts","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACpD,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,oDAAoD;IACpD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,WAAuB,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB"}
|
package/dist/pieces/webpage.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyCreativeWorkFields } from '../types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Build a schema.org WebPage (or ProfilePage / CollectionPage) piece.
|
|
3
4
|
*
|
|
@@ -18,24 +19,13 @@ export function buildWebPage(input, ids, type = 'WebPage') {
|
|
|
18
19
|
isPartOf: input.isPartOf,
|
|
19
20
|
potentialAction,
|
|
20
21
|
};
|
|
21
|
-
if (input.inLanguage !== undefined) {
|
|
22
|
-
piece.inLanguage = input.inLanguage;
|
|
23
|
-
}
|
|
24
22
|
if (input.breadcrumb !== undefined) {
|
|
25
23
|
piece.breadcrumb = input.breadcrumb;
|
|
26
24
|
}
|
|
27
|
-
if (input.datePublished !== undefined) {
|
|
28
|
-
piece.datePublished = input.datePublished.toISOString();
|
|
29
|
-
}
|
|
30
|
-
if (input.dateModified !== undefined) {
|
|
31
|
-
piece.dateModified = input.dateModified.toISOString();
|
|
32
|
-
}
|
|
33
25
|
if (input.primaryImage !== undefined) {
|
|
34
26
|
piece.primaryImageOfPage = input.primaryImage;
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
piece.about = input.about;
|
|
38
|
-
}
|
|
28
|
+
applyCreativeWorkFields(piece, input);
|
|
39
29
|
return { ...piece, ...input.extra };
|
|
40
30
|
}
|
|
41
31
|
//# sourceMappingURL=webpage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpage.js","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpage.js","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAgCtD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CACxB,KAAmB,EACnB,GAAc,EACd,OAAoB,SAAS;IAE7B,MAAM,eAAe,GAA2C,KAAK,CAAC,eAAe,IAAI;QACrF,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;KACjD,CAAC;IAEF,MAAM,KAAK,GAA4B;QACnC,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QAC7B,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,eAAe;KAClB,CAAC;IAEF,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACjC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACnC,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC;IAClD,CAAC;IACD,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEtC,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/pieces/website.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { IdFactory } from '../ids.js';
|
|
2
|
-
import type { Reference } from '../types.js';
|
|
3
|
-
export interface WebSiteInput {
|
|
2
|
+
import type { Reference, CreativeWorkFields } from '../types.js';
|
|
3
|
+
export interface WebSiteInput extends CreativeWorkFields {
|
|
4
4
|
/** Site URL, typically with trailing slash. */
|
|
5
5
|
url: string;
|
|
6
6
|
name: string;
|
|
7
|
-
description?: string;
|
|
8
7
|
/** Publisher entity — usually the site-wide Person or Organization. */
|
|
9
8
|
publisher: Reference;
|
|
10
|
-
/** Default content language, e.g. 'en-US'. */
|
|
11
|
-
inLanguage?: string;
|
|
12
9
|
/** Optional navigation reference (e.g. ids.navigation). */
|
|
13
10
|
hasPart?: Reference;
|
|
14
11
|
/** Escape hatch for extra schema.org properties. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/pieces/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/pieces/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjE,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACpD,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,SAAS,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzF"}
|
package/dist/pieces/website.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyCreativeWorkFields } from '../types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Build a schema.org WebSite piece. This is the site-wide singleton;
|
|
3
4
|
* every page's WebPage should reference it via `isPartOf`.
|
|
@@ -9,11 +10,8 @@ export function buildWebSite(input, ids) {
|
|
|
9
10
|
url: input.url,
|
|
10
11
|
name: input.name,
|
|
11
12
|
};
|
|
12
|
-
if (input.description !== undefined)
|
|
13
|
-
piece.description = input.description;
|
|
14
13
|
piece.publisher = input.publisher;
|
|
15
|
-
|
|
16
|
-
piece.inLanguage = input.inLanguage;
|
|
14
|
+
applyCreativeWorkFields(piece, input);
|
|
17
15
|
if (input.hasPart !== undefined)
|
|
18
16
|
piece.hasPart = input.hasPart;
|
|
19
17
|
return { ...piece, ...input.extra };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../src/pieces/website.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../src/pieces/website.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AActD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAmB,EAAE,GAAc;IAC5D,MAAM,KAAK,GAA4B;QACnC,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,GAAG,CAAC,OAAO;QAClB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,KAAK,CAAC,IAAI;KACnB,CAAC;IACF,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAClC,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC/D,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -27,4 +27,36 @@ export interface GraphEntity {
|
|
|
27
27
|
'@id'?: string;
|
|
28
28
|
[key: string]: unknown;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Optional schema.org CreativeWork properties shared across WebSite,
|
|
32
|
+
* WebPage, and Article builders. Extend your input interface from this
|
|
33
|
+
* to inherit the fields.
|
|
34
|
+
*/
|
|
35
|
+
export interface CreativeWorkFields {
|
|
36
|
+
/** Short description / summary of this entity. */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** What this entity is about — e.g. a Person, Organization, or other entity. */
|
|
39
|
+
about?: Reference;
|
|
40
|
+
/** Content language, e.g. 'en-US'. */
|
|
41
|
+
inLanguage?: string;
|
|
42
|
+
/** Publish date — emitted as ISO string. */
|
|
43
|
+
datePublished?: Date;
|
|
44
|
+
/** Update date — emitted as ISO string. */
|
|
45
|
+
dateModified?: Date;
|
|
46
|
+
/** Who holds the copyright — typically a Person or Organization reference. */
|
|
47
|
+
copyrightHolder?: Reference;
|
|
48
|
+
/** Year copyright was first asserted. */
|
|
49
|
+
copyrightYear?: number;
|
|
50
|
+
/** Human-readable copyright text, e.g. '© 2026 Jane Doe. All rights reserved.' */
|
|
51
|
+
copyrightNotice?: string;
|
|
52
|
+
/** License URL or CreativeWork reference (e.g. a Creative Commons URL). */
|
|
53
|
+
license?: string;
|
|
54
|
+
/** Whether the content is free to access. */
|
|
55
|
+
isAccessibleForFree?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Apply shared CreativeWork fields to a piece under construction.
|
|
59
|
+
* Call from any builder whose input extends `CreativeWorkFields`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function applyCreativeWorkFields(piece: Record<string, unknown>, input: CreativeWorkFields): void;
|
|
30
62
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,GAAG;IACpE,UAAU,EAAE,oBAAoB,CAAC;IACjC,QAAQ,EAAE,CAAC,EAAE,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,GAAG;IACpE,UAAU,EAAE,oBAAoB,CAAC;IACjC,QAAQ,EAAE,CAAC,EAAE,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,kBAAkB,GAC1B,IAAI,CAYN"}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Apply shared CreativeWork fields to a piece under construction.
|
|
3
|
+
* Call from any builder whose input extends `CreativeWorkFields`.
|
|
4
|
+
*/
|
|
5
|
+
export function applyCreativeWorkFields(piece, input) {
|
|
6
|
+
if (input.description !== undefined)
|
|
7
|
+
piece.description = input.description;
|
|
8
|
+
if (input.about !== undefined)
|
|
9
|
+
piece.about = input.about;
|
|
10
|
+
if (input.inLanguage !== undefined)
|
|
11
|
+
piece.inLanguage = input.inLanguage;
|
|
12
|
+
if (input.datePublished !== undefined)
|
|
13
|
+
piece.datePublished = input.datePublished.toISOString();
|
|
14
|
+
if (input.dateModified !== undefined)
|
|
15
|
+
piece.dateModified = input.dateModified.toISOString();
|
|
16
|
+
if (input.copyrightHolder !== undefined)
|
|
17
|
+
piece.copyrightHolder = input.copyrightHolder;
|
|
18
|
+
if (input.copyrightYear !== undefined)
|
|
19
|
+
piece.copyrightYear = input.copyrightYear;
|
|
20
|
+
if (input.copyrightNotice !== undefined)
|
|
21
|
+
piece.copyrightNotice = input.copyrightNotice;
|
|
22
|
+
if (input.license !== undefined)
|
|
23
|
+
piece.license = input.license;
|
|
24
|
+
if (input.isAccessibleForFree !== undefined)
|
|
25
|
+
piece.isAccessibleForFree = input.isAccessibleForFree;
|
|
26
|
+
}
|
|
2
27
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACnC,KAA8B,EAC9B,KAAyB;IAEzB,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAC3E,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACzD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACxE,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;QAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;IAC/F,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;QAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC5F,IAAI,KAAK,CAAC,eAAe,KAAK,SAAS;QAAE,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IACvF,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;QAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IACjF,IAAI,KAAK,CAAC,eAAe,KAAK,SAAS;QAAE,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IACvF,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC/D,IAAI,KAAK,CAAC,mBAAmB,KAAK,SAAS;QACvC,KAAK,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;AAC9D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"README.md",
|
|
26
|
-
"LICENSE"
|
|
27
|
-
],
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/jdevalk/seo-graph.git",
|
|
31
|
-
"directory": "packages/seo-graph-core"
|
|
32
|
-
},
|
|
33
|
-
"bugs": "https://github.com/jdevalk/seo-graph/issues",
|
|
34
|
-
"homepage": "https://github.com/jdevalk/seo-graph/tree/main/packages/seo-graph-core#readme",
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsc -p tsconfig.build.json",
|
|
40
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
41
|
-
"test": "vitest run"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"schema-dts": "^2.0.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@types/node": "^22.0.0",
|
|
48
|
-
"typescript": "^5.6.0",
|
|
49
|
-
"vitest": "^2.0.0"
|
|
2
|
+
"name": "@jdevalk/seo-graph-core",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Pure schema.org JSON-LD graph builders. Runtime-agnostic core for agent-ready SEO.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"schema.org",
|
|
7
|
+
"json-ld",
|
|
8
|
+
"seo",
|
|
9
|
+
"agent-ready",
|
|
10
|
+
"structured-data"
|
|
11
|
+
],
|
|
12
|
+
"author": "Joost de Valk <joost@joost.blog>",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
50
21
|
}
|
|
51
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"AGENTS.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/jdevalk/seo-graph.git",
|
|
32
|
+
"directory": "packages/seo-graph-core"
|
|
33
|
+
},
|
|
34
|
+
"bugs": "https://github.com/jdevalk/seo-graph/issues",
|
|
35
|
+
"homepage": "https://github.com/jdevalk/seo-graph/tree/main/packages/seo-graph-core#readme",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"schema-dts": "^2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"typescript": "^5.6.0",
|
|
45
|
+
"vitest": "^2.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.build.json && cp ../../AGENTS.md .",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
50
|
+
"test": "vitest run"
|
|
51
|
+
}
|
|
52
|
+
}
|