@jdevalk/seo-graph-core 0.4.1 → 0.5.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/AGENTS.md +501 -442
- package/README.md +5 -5
- package/dist/assemble.d.ts +16 -1
- package/dist/assemble.d.ts.map +1 -1
- package/dist/assemble.js +59 -2
- package/dist/assemble.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/pieces/article.d.ts +12 -17
- package/dist/pieces/article.d.ts.map +1 -1
- package/dist/pieces/article.js +16 -6
- package/dist/pieces/article.js.map +1 -1
- package/dist/pieces/breadcrumb.d.ts +5 -11
- package/dist/pieces/breadcrumb.d.ts.map +1 -1
- package/dist/pieces/breadcrumb.js +5 -7
- package/dist/pieces/breadcrumb.js.map +1 -1
- package/dist/pieces/custom.d.ts +28 -7
- package/dist/pieces/custom.d.ts.map +1 -1
- package/dist/pieces/custom.js +1 -11
- package/dist/pieces/custom.js.map +1 -1
- package/dist/pieces/image.d.ts +4 -8
- package/dist/pieces/image.d.ts.map +1 -1
- package/dist/pieces/image.js +15 -4
- package/dist/pieces/image.js.map +1 -1
- package/dist/pieces/navigation.d.ts +4 -4
- package/dist/pieces/navigation.d.ts.map +1 -1
- package/dist/pieces/navigation.js +5 -2
- package/dist/pieces/navigation.js.map +1 -1
- package/dist/pieces/video.d.ts +4 -17
- package/dist/pieces/video.d.ts.map +1 -1
- package/dist/pieces/video.js +15 -1
- package/dist/pieces/video.js.map +1 -1
- package/dist/pieces/webpage.d.ts +5 -13
- package/dist/pieces/webpage.d.ts.map +1 -1
- package/dist/pieces/webpage.js +14 -11
- package/dist/pieces/webpage.js.map +1 -1
- package/dist/pieces/website.d.ts +4 -3
- package/dist/pieces/website.d.ts.map +1 -1
- package/dist/pieces/website.js +11 -3
- package/dist/pieces/website.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +24 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/pieces/organization.d.ts +0 -46
- package/dist/pieces/organization.d.ts.map +0 -1
- package/dist/pieces/organization.js +0 -39
- package/dist/pieces/organization.js.map +0 -1
- package/dist/pieces/person.d.ts +0 -36
- package/dist/pieces/person.d.ts.map +0 -1
- package/dist/pieces/person.js +0 -13
- package/dist/pieces/person.js.map +0 -1
package/dist/pieces/video.d.ts
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
|
+
import type { VideoObjectLeaf } from 'schema-dts';
|
|
1
2
|
import type { IdFactory } from '../ids.js';
|
|
2
3
|
import type { Reference } from '../types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Canonical URL of the page the video lives on. The @id is
|
|
6
|
-
* `${url}#video`.
|
|
7
|
-
*/
|
|
4
|
+
interface VideoObjectCoreFields {
|
|
8
5
|
url: string;
|
|
9
6
|
name: string;
|
|
10
7
|
description: string;
|
|
11
|
-
/** Reference to the enclosing WebPage (usually ids.webPage(url)). */
|
|
12
8
|
isPartOf: Reference;
|
|
13
|
-
/** YouTube video id — used to derive thumbnailUrl and embedUrl. */
|
|
14
9
|
youtubeId?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Explicit thumbnail URL. If omitted and `youtubeId` is set, defaults
|
|
17
|
-
* to `https://img.youtube.com/vi/{id}/maxresdefault.jpg`.
|
|
18
|
-
*/
|
|
19
10
|
thumbnailUrl?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Explicit embed URL. If omitted and `youtubeId` is set, defaults to
|
|
22
|
-
* `https://www.youtube-nocookie.com/embed/{id}`.
|
|
23
|
-
*/
|
|
24
11
|
embedUrl?: string;
|
|
25
12
|
uploadDate?: Date;
|
|
26
|
-
/** ISO 8601 duration, e.g. 'PT30M'. */
|
|
27
13
|
duration?: string;
|
|
28
14
|
transcript?: string;
|
|
29
|
-
extra?: Record<string, unknown>;
|
|
30
15
|
}
|
|
16
|
+
export type VideoObjectInput = VideoObjectCoreFields & Omit<Partial<VideoObjectLeaf>, keyof VideoObjectCoreFields | '@type'>;
|
|
31
17
|
/**
|
|
32
18
|
* Build a schema.org VideoObject piece.
|
|
33
19
|
*/
|
|
34
20
|
export declare function buildVideoObject(input: VideoObjectInput, ids: IdFactory): Record<string, unknown>;
|
|
21
|
+
export {};
|
|
35
22
|
//# sourceMappingURL=video.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/pieces/video.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":"video.d.ts","sourceRoot":"","sources":["../../src/pieces/video.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,UAAU,qBAAqB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAChD,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,MAAM,qBAAqB,GAAG,OAAO,CAAC,CAAC;AAe1E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6BjG"}
|
package/dist/pieces/video.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { spreadRemainingProperties } from '../types.js';
|
|
2
|
+
const HANDLED_KEYS = new Set([
|
|
3
|
+
'url',
|
|
4
|
+
'name',
|
|
5
|
+
'description',
|
|
6
|
+
'isPartOf',
|
|
7
|
+
'youtubeId',
|
|
8
|
+
'thumbnailUrl',
|
|
9
|
+
'embedUrl',
|
|
10
|
+
'uploadDate',
|
|
11
|
+
'duration',
|
|
12
|
+
'transcript',
|
|
13
|
+
]);
|
|
1
14
|
/**
|
|
2
15
|
* Build a schema.org VideoObject piece.
|
|
3
16
|
*/
|
|
@@ -27,6 +40,7 @@ export function buildVideoObject(input, ids) {
|
|
|
27
40
|
piece.duration = input.duration;
|
|
28
41
|
if (input.transcript !== undefined)
|
|
29
42
|
piece.transcript = input.transcript;
|
|
30
|
-
|
|
43
|
+
spreadRemainingProperties(piece, input, HANDLED_KEYS);
|
|
44
|
+
return piece;
|
|
31
45
|
}
|
|
32
46
|
//# sourceMappingURL=video.js.map
|
package/dist/pieces/video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../src/pieces/video.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../src/pieces/video.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAkBxD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS;IACjC,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;IACV,WAAW;IACX,cAAc;IACd,UAAU;IACV,YAAY;IACZ,UAAU;IACV,YAAY;CACf,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,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
|
|
|
1
|
+
import type { WebPageLeaf } from 'schema-dts';
|
|
1
2
|
import type { IdFactory } from '../ids.js';
|
|
2
3
|
import type { Reference, CreativeWorkFields } from '../types.js';
|
|
3
4
|
/**
|
|
@@ -5,19 +6,14 @@ import type { Reference, CreativeWorkFields } from '../types.js';
|
|
|
5
6
|
* for /about-me style pages and `CollectionPage` for index/listing pages.
|
|
6
7
|
*/
|
|
7
8
|
export type WebPageType = 'WebPage' | 'ProfilePage' | 'CollectionPage';
|
|
8
|
-
|
|
9
|
+
interface WebPageCoreFields extends CreativeWorkFields {
|
|
9
10
|
/** Canonical URL of the page. The WebPage @id equals this URL. */
|
|
10
11
|
url: string;
|
|
11
12
|
/** Page title (becomes `name`). */
|
|
12
13
|
name: string;
|
|
13
14
|
/** Reference to the site-wide WebSite (usually ids.website). */
|
|
14
15
|
isPartOf: Reference;
|
|
15
|
-
/**
|
|
16
|
-
* Reference to the BreadcrumbList for this page (usually
|
|
17
|
-
* `ids.breadcrumb(url)`). Optional — schema.org treats `breadcrumb`
|
|
18
|
-
* as optional on `WebPage`, so consumers without breadcrumbs can
|
|
19
|
-
* simply omit it.
|
|
20
|
-
*/
|
|
16
|
+
/** Reference to the BreadcrumbList for this page. */
|
|
21
17
|
breadcrumb?: Reference;
|
|
22
18
|
/** Reference to the primary ImageObject, if any. */
|
|
23
19
|
primaryImage?: Reference;
|
|
@@ -26,15 +22,11 @@ export interface WebPageInput extends CreativeWorkFields {
|
|
|
26
22
|
* targeting the page URL.
|
|
27
23
|
*/
|
|
28
24
|
potentialAction?: ReadonlyArray<Record<string, unknown>>;
|
|
29
|
-
extra?: Record<string, unknown>;
|
|
30
25
|
}
|
|
26
|
+
export type WebPageInput = WebPageCoreFields & Omit<Partial<WebPageLeaf>, keyof WebPageCoreFields | '@type'>;
|
|
31
27
|
/**
|
|
32
28
|
* Build a schema.org WebPage (or ProfilePage / CollectionPage) piece.
|
|
33
|
-
*
|
|
34
|
-
* Choose the concrete subtype via the second argument; defaults to
|
|
35
|
-
* `WebPage`. Dispatch (e.g. "blog listing pages use CollectionPage")
|
|
36
|
-
* is a caller concern, not a core concern — core ships the primitives
|
|
37
|
-
* and lets the caller decide.
|
|
38
29
|
*/
|
|
39
30
|
export declare function buildWebPage(input: WebPageInput, ids: IdFactory, type?: WebPageType): Record<string, unknown>;
|
|
31
|
+
export {};
|
|
40
32
|
//# sourceMappingURL=webpage.d.ts.map
|
|
@@ -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,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"webpage.d.ts","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOjE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvE,UAAU,iBAAkB,SAAQ,kBAAkB;IAClD,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB,qDAAqD;IACrD,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;CAC5D;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,GACxC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC;AAYlE;;GAEG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,WAAuB,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB"}
|
package/dist/pieces/webpage.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { applyCreativeWorkFields } from '../types.js';
|
|
1
|
+
import { applyCreativeWorkFields, spreadRemainingProperties, CREATIVE_WORK_KEYS, } from '../types.js';
|
|
2
|
+
const HANDLED_KEYS = new Set([
|
|
3
|
+
...CREATIVE_WORK_KEYS,
|
|
4
|
+
'url',
|
|
5
|
+
'name',
|
|
6
|
+
'isPartOf',
|
|
7
|
+
'breadcrumb',
|
|
8
|
+
'primaryImage',
|
|
9
|
+
'potentialAction',
|
|
10
|
+
]);
|
|
2
11
|
/**
|
|
3
12
|
* Build a schema.org WebPage (or ProfilePage / CollectionPage) piece.
|
|
4
|
-
*
|
|
5
|
-
* Choose the concrete subtype via the second argument; defaults to
|
|
6
|
-
* `WebPage`. Dispatch (e.g. "blog listing pages use CollectionPage")
|
|
7
|
-
* is a caller concern, not a core concern — core ships the primitives
|
|
8
|
-
* and lets the caller decide.
|
|
9
13
|
*/
|
|
10
14
|
export function buildWebPage(input, ids, type = 'WebPage') {
|
|
11
15
|
const potentialAction = input.potentialAction ?? [
|
|
@@ -19,13 +23,12 @@ export function buildWebPage(input, ids, type = 'WebPage') {
|
|
|
19
23
|
isPartOf: input.isPartOf,
|
|
20
24
|
potentialAction,
|
|
21
25
|
};
|
|
22
|
-
if (input.breadcrumb !== undefined)
|
|
26
|
+
if (input.breadcrumb !== undefined)
|
|
23
27
|
piece.breadcrumb = input.breadcrumb;
|
|
24
|
-
|
|
25
|
-
if (input.primaryImage !== undefined) {
|
|
28
|
+
if (input.primaryImage !== undefined)
|
|
26
29
|
piece.primaryImageOfPage = input.primaryImage;
|
|
27
|
-
}
|
|
28
30
|
applyCreativeWorkFields(piece, input);
|
|
29
|
-
|
|
31
|
+
spreadRemainingProperties(piece, input, HANDLED_KEYS);
|
|
32
|
+
return piece;
|
|
30
33
|
}
|
|
31
34
|
//# 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":"AAIA,OAAO,EACH,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AA6BrB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS;IACjC,GAAG,kBAAkB;IACrB,KAAK;IACL,MAAM;IACN,UAAU;IACV,YAAY;IACZ,cAAc;IACd,iBAAiB;CACpB,CAAC,CAAC;AAEH;;GAEG;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;QAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACxE,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;QAAE,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC;IACpF,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAEtD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/pieces/website.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { WebSiteLeaf } from 'schema-dts';
|
|
1
2
|
import type { IdFactory } from '../ids.js';
|
|
2
3
|
import type { Reference, CreativeWorkFields } from '../types.js';
|
|
3
|
-
|
|
4
|
+
interface WebSiteCoreFields extends CreativeWorkFields {
|
|
4
5
|
/** Site URL, typically with trailing slash. */
|
|
5
6
|
url: string;
|
|
6
7
|
name: string;
|
|
@@ -8,12 +9,12 @@ export interface WebSiteInput extends CreativeWorkFields {
|
|
|
8
9
|
publisher: Reference;
|
|
9
10
|
/** Optional navigation reference (e.g. ids.navigation). */
|
|
10
11
|
hasPart?: Reference;
|
|
11
|
-
/** Escape hatch for extra schema.org properties. */
|
|
12
|
-
extra?: Record<string, unknown>;
|
|
13
12
|
}
|
|
13
|
+
export type WebSiteInput = WebSiteCoreFields & Omit<Partial<WebSiteLeaf>, keyof WebSiteCoreFields | '@type'>;
|
|
14
14
|
/**
|
|
15
15
|
* Build a schema.org WebSite piece. This is the site-wide singleton;
|
|
16
16
|
* every page's WebPage should reference it via `isPartOf`.
|
|
17
17
|
*/
|
|
18
18
|
export declare function buildWebSite(input: WebSiteInput, ids: IdFactory): Record<string, unknown>;
|
|
19
|
+
export {};
|
|
19
20
|
//# sourceMappingURL=website.d.ts.map
|
|
@@ -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,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/pieces/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOjE,UAAU,iBAAkB,SAAQ,kBAAkB;IAClD,+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;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,GACxC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC;AAUlE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczF"}
|
package/dist/pieces/website.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { applyCreativeWorkFields } from '../types.js';
|
|
1
|
+
import { applyCreativeWorkFields, spreadRemainingProperties, CREATIVE_WORK_KEYS, } from '../types.js';
|
|
2
|
+
const HANDLED_KEYS = new Set([
|
|
3
|
+
...CREATIVE_WORK_KEYS,
|
|
4
|
+
'url',
|
|
5
|
+
'name',
|
|
6
|
+
'publisher',
|
|
7
|
+
'hasPart',
|
|
8
|
+
]);
|
|
2
9
|
/**
|
|
3
10
|
* Build a schema.org WebSite piece. This is the site-wide singleton;
|
|
4
11
|
* every page's WebPage should reference it via `isPartOf`.
|
|
@@ -9,11 +16,12 @@ export function buildWebSite(input, ids) {
|
|
|
9
16
|
'@id': ids.website,
|
|
10
17
|
url: input.url,
|
|
11
18
|
name: input.name,
|
|
19
|
+
publisher: input.publisher,
|
|
12
20
|
};
|
|
13
|
-
piece.publisher = input.publisher;
|
|
14
21
|
applyCreativeWorkFields(piece, input);
|
|
15
22
|
if (input.hasPart !== undefined)
|
|
16
23
|
piece.hasPart = input.hasPart;
|
|
17
|
-
|
|
24
|
+
spreadRemainingProperties(piece, input, HANDLED_KEYS);
|
|
25
|
+
return piece;
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=website.js.map
|
|
@@ -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":"AAIA,OAAO,EACH,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AAerB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS;IACjC,GAAG,kBAAkB;IACrB,KAAK;IACL,MAAM;IACN,WAAW;IACX,SAAS;CACZ,CAAC,CAAC;AAEH;;;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;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;KAC7B,CAAC;IAEF,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,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAEtD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -59,4 +59,11 @@ export interface CreativeWorkFields {
|
|
|
59
59
|
* Call from any builder whose input extends `CreativeWorkFields`.
|
|
60
60
|
*/
|
|
61
61
|
export declare function applyCreativeWorkFields(piece: Record<string, unknown>, input: CreativeWorkFields): void;
|
|
62
|
+
/** Keys that `applyCreativeWorkFields` handles. */
|
|
63
|
+
export declare const CREATIVE_WORK_KEYS: Set<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Spread all properties from `input` into `piece`, skipping keys that
|
|
66
|
+
* the builder handles specially. Call after all explicit field handling.
|
|
67
|
+
*/
|
|
68
|
+
export declare function spreadRemainingProperties(piece: Record<string, unknown>, input: object, handledKeys: ReadonlySet<string>): void;
|
|
62
69
|
//# 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;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAA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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;AAED,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,aAW7B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,IAAI,CAMN"}
|
package/dist/types.js
CHANGED
|
@@ -24,4 +24,28 @@ export function applyCreativeWorkFields(piece, input) {
|
|
|
24
24
|
if (input.isAccessibleForFree !== undefined)
|
|
25
25
|
piece.isAccessibleForFree = input.isAccessibleForFree;
|
|
26
26
|
}
|
|
27
|
+
/** Keys that `applyCreativeWorkFields` handles. */
|
|
28
|
+
export const CREATIVE_WORK_KEYS = new Set([
|
|
29
|
+
'description',
|
|
30
|
+
'about',
|
|
31
|
+
'inLanguage',
|
|
32
|
+
'datePublished',
|
|
33
|
+
'dateModified',
|
|
34
|
+
'copyrightHolder',
|
|
35
|
+
'copyrightYear',
|
|
36
|
+
'copyrightNotice',
|
|
37
|
+
'license',
|
|
38
|
+
'isAccessibleForFree',
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* Spread all properties from `input` into `piece`, skipping keys that
|
|
42
|
+
* the builder handles specially. Call after all explicit field handling.
|
|
43
|
+
*/
|
|
44
|
+
export function spreadRemainingProperties(piece, input, handledKeys) {
|
|
45
|
+
for (const [key, value] of Object.entries(input)) {
|
|
46
|
+
if (!handledKeys.has(key) && value !== undefined) {
|
|
47
|
+
piece[key] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
27
51
|
//# 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":"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,WA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AK,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;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS;IAC9C,aAAa;IACb,OAAO;IACP,YAAY;IACZ,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,SAAS;IACT,qBAAqB;CACxB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACrC,KAA8B,EAC9B,KAAa,EACb,WAAgC;IAEhC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/C,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;IACL,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Organization } from 'schema-dts';
|
|
2
|
-
import type { IdFactory } from '../ids.js';
|
|
3
|
-
export interface OrganizationInput<T extends Organization = Organization> {
|
|
4
|
-
/** Stable slug used for the @id. */
|
|
5
|
-
slug: string;
|
|
6
|
-
name: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
/** Logo URL (raw string) or reference to an ImageObject. */
|
|
10
|
-
logo?: string | {
|
|
11
|
-
'@id': string;
|
|
12
|
-
};
|
|
13
|
-
sameAs?: readonly string[];
|
|
14
|
-
/**
|
|
15
|
-
* Escape hatch for schema.org properties specific to a subtype. Typed
|
|
16
|
-
* as `Partial<T>` so callers that pass a concrete subtype (e.g.
|
|
17
|
-
* `OrganizationInput<Hotel>`) get schema-dts autocomplete for that
|
|
18
|
-
* subtype's fields — `checkinTime`, `numberOfRooms`, etc. — instead
|
|
19
|
-
* of an untyped `Record<string, unknown>`.
|
|
20
|
-
*/
|
|
21
|
-
extra?: Partial<T>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build a schema.org Organization piece, or any of its subtypes. Pass the
|
|
25
|
-
* concrete @type as the third argument and the matching schema-dts type as
|
|
26
|
-
* the generic parameter to get autocomplete for that subtype's fields:
|
|
27
|
-
*
|
|
28
|
-
* ```ts
|
|
29
|
-
* import type { Hotel } from 'schema-dts';
|
|
30
|
-
* const hotel = buildOrganization<Hotel>(
|
|
31
|
-
* {
|
|
32
|
-
* slug: 'la-limonaia',
|
|
33
|
-
* name: 'La Limonaia',
|
|
34
|
-
* extra: { checkinTime: '16:00' }, // <-- typed against Hotel
|
|
35
|
-
* },
|
|
36
|
-
* ids,
|
|
37
|
-
* 'Hotel',
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* The generic defaults to `Organization`, so call sites that don't need
|
|
42
|
-
* subtype typing (`buildOrganization({ slug, name }, ids)`) continue to
|
|
43
|
-
* work without specifying `<T>`.
|
|
44
|
-
*/
|
|
45
|
-
export declare function buildOrganization<T extends Organization = Organization>(input: OrganizationInput<T>, ids: IdFactory, subtype?: string): Record<string, unknown>;
|
|
46
|
-
//# sourceMappingURL=organization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../src/pieces/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACpE,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EACnE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC3B,GAAG,EAAE,SAAS,EACd,OAAO,GAAE,MAAuB,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a schema.org Organization piece, or any of its subtypes. Pass the
|
|
3
|
-
* concrete @type as the third argument and the matching schema-dts type as
|
|
4
|
-
* the generic parameter to get autocomplete for that subtype's fields:
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* import type { Hotel } from 'schema-dts';
|
|
8
|
-
* const hotel = buildOrganization<Hotel>(
|
|
9
|
-
* {
|
|
10
|
-
* slug: 'la-limonaia',
|
|
11
|
-
* name: 'La Limonaia',
|
|
12
|
-
* extra: { checkinTime: '16:00' }, // <-- typed against Hotel
|
|
13
|
-
* },
|
|
14
|
-
* ids,
|
|
15
|
-
* 'Hotel',
|
|
16
|
-
* );
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* The generic defaults to `Organization`, so call sites that don't need
|
|
20
|
-
* subtype typing (`buildOrganization({ slug, name }, ids)`) continue to
|
|
21
|
-
* work without specifying `<T>`.
|
|
22
|
-
*/
|
|
23
|
-
export function buildOrganization(input, ids, subtype = 'Organization') {
|
|
24
|
-
const piece = {
|
|
25
|
-
'@type': subtype,
|
|
26
|
-
'@id': ids.organization(input.slug),
|
|
27
|
-
name: input.name,
|
|
28
|
-
};
|
|
29
|
-
if (input.url !== undefined)
|
|
30
|
-
piece.url = input.url;
|
|
31
|
-
if (input.description !== undefined)
|
|
32
|
-
piece.description = input.description;
|
|
33
|
-
if (input.logo !== undefined)
|
|
34
|
-
piece.logo = input.logo;
|
|
35
|
-
if (input.sameAs !== undefined)
|
|
36
|
-
piece.sameAs = input.sameAs;
|
|
37
|
-
return { ...piece, ...input.extra };
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=organization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../src/pieces/organization.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,iBAAiB,CAC7B,KAA2B,EAC3B,GAAc,EACd,UAAkB,cAAc;IAEhC,MAAM,KAAK,GAA4B;QACnC,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,KAAK,CAAC,IAAI;KACnB,CAAC;IACF,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;QAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACnD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAC3E,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5D,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/pieces/person.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { IdFactory } from '../ids.js';
|
|
2
|
-
/**
|
|
3
|
-
* Input for a Person piece. All fields except `name` are optional, and
|
|
4
|
-
* any field not explicitly supported here can be passed via `extra`.
|
|
5
|
-
*
|
|
6
|
-
* This intentionally mirrors schema.org's Person vocabulary. We don't
|
|
7
|
-
* re-type every field; the shape is a `Record<string, unknown>` so
|
|
8
|
-
* consumers can pass arbitrary schema.org properties without a version
|
|
9
|
-
* upgrade of this package.
|
|
10
|
-
*/
|
|
11
|
-
export interface PersonInput {
|
|
12
|
-
name: string;
|
|
13
|
-
familyName?: string;
|
|
14
|
-
birthDate?: string;
|
|
15
|
-
gender?: string;
|
|
16
|
-
nationality?: {
|
|
17
|
-
'@id': string;
|
|
18
|
-
};
|
|
19
|
-
description?: string;
|
|
20
|
-
jobTitle?: string;
|
|
21
|
-
knowsLanguage?: readonly string[];
|
|
22
|
-
url?: string;
|
|
23
|
-
image?: {
|
|
24
|
-
'@id': string;
|
|
25
|
-
};
|
|
26
|
-
sameAs?: readonly string[];
|
|
27
|
-
worksFor?: ReadonlyArray<Record<string, unknown>>;
|
|
28
|
-
spouse?: Record<string, unknown>;
|
|
29
|
-
children?: ReadonlyArray<Record<string, unknown>>;
|
|
30
|
-
extra?: Record<string, unknown>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build a schema.org Person piece using the site-wide Person @id.
|
|
34
|
-
*/
|
|
35
|
-
export declare function buildPerson(input: PersonInput, ids: IdFactory): Record<string, unknown>;
|
|
36
|
-
//# sourceMappingURL=person.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../src/pieces/person.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQvF"}
|
package/dist/pieces/person.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a schema.org Person piece using the site-wide Person @id.
|
|
3
|
-
*/
|
|
4
|
-
export function buildPerson(input, ids) {
|
|
5
|
-
const { extra, ...rest } = input;
|
|
6
|
-
return {
|
|
7
|
-
'@type': 'Person',
|
|
8
|
-
'@id': ids.person,
|
|
9
|
-
...rest,
|
|
10
|
-
...extra,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=person.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../src/pieces/person.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAkB,EAAE,GAAc;IAC1D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACjC,OAAO;QACH,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,GAAG,IAAI;QACP,GAAG,KAAK;KACX,CAAC;AACN,CAAC"}
|