geo-semantic-layer 2.0.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/CHANGELOG.md +289 -0
- package/LICENSE +21 -0
- package/README.md +394 -0
- package/dist/config-BcP2K8Tq.d.ts +150 -0
- package/dist/event-BG0_yYK4.d.ts +2231 -0
- package/dist/generators/index.d.ts +723 -0
- package/dist/generators/index.js +969 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/geo/index.d.ts +38 -0
- package/dist/geo/index.js +107 -0
- package/dist/geo/index.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +1000 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +97 -0
- package/dist/schemas/index.js +402 -0
- package/dist/schemas/index.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
import { d as IdentityConfig, G as GeoConfig, P as PostalAddress, c as ContactPoint } from '../config-BcP2K8Tq.js';
|
|
2
|
+
import { a as Organization, d as Person, h as Product, n as Article, r as FAQPage, v as BreadcrumbList, H as LocalBusiness, U as Event, y as WebPage } from '../event-BG0_yYK4.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Identity schema generator (Organization/Person)
|
|
7
|
+
* @module generators/identity
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for generating Organization schema
|
|
12
|
+
*/
|
|
13
|
+
interface OrganizationConfig {
|
|
14
|
+
name: string;
|
|
15
|
+
alternateName?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
logo?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
sameAs?: string[];
|
|
20
|
+
email?: string;
|
|
21
|
+
telephone?: string;
|
|
22
|
+
address?: PostalAddress;
|
|
23
|
+
contactPoint?: ContactPoint;
|
|
24
|
+
foundingDate?: string;
|
|
25
|
+
founder?: string | string[];
|
|
26
|
+
founders?: string[];
|
|
27
|
+
numberOfEmployees?: number;
|
|
28
|
+
/**
|
|
29
|
+
* GEO optimization settings
|
|
30
|
+
*/
|
|
31
|
+
geo?: Partial<GeoConfig>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Configuration for generating Person schema
|
|
35
|
+
*/
|
|
36
|
+
interface PersonConfig {
|
|
37
|
+
name: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
image?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
jobTitle?: string;
|
|
42
|
+
sameAs?: string[];
|
|
43
|
+
email?: string;
|
|
44
|
+
telephone?: string;
|
|
45
|
+
address?: PostalAddress;
|
|
46
|
+
worksFor?: {
|
|
47
|
+
'@type': 'Organization';
|
|
48
|
+
name: string;
|
|
49
|
+
} | string;
|
|
50
|
+
birthDate?: string;
|
|
51
|
+
/**
|
|
52
|
+
* GEO optimization settings
|
|
53
|
+
*/
|
|
54
|
+
geo?: Partial<GeoConfig>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generates a validated JSON-LD schema for Organization or Person identity
|
|
58
|
+
*
|
|
59
|
+
* This is the core function for creating your website's root entity,
|
|
60
|
+
* which serves as the anchor for all semantic relationships.
|
|
61
|
+
*
|
|
62
|
+
* @param config - Identity configuration (name, URL, social profiles, etc.)
|
|
63
|
+
* @returns Validated JSON-LD schema ready to inject into <script type="application/ld+json">
|
|
64
|
+
*
|
|
65
|
+
* @throws {z.ZodError} If validation fails (invalid URLs, missing required fields, etc.)
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // Organization example
|
|
70
|
+
* const orgSchema = generateIdentitySchema({
|
|
71
|
+
* type: 'Organization',
|
|
72
|
+
* name: 'Acme Corp',
|
|
73
|
+
* url: 'https://acme.com',
|
|
74
|
+
* logoUrl: 'https://acme.com/logo.png',
|
|
75
|
+
* sameAs: [
|
|
76
|
+
* 'https://twitter.com/acme',
|
|
77
|
+
* 'https://www.wikidata.org/wiki/Q123456'
|
|
78
|
+
* ],
|
|
79
|
+
* email: 'contact@acme.com',
|
|
80
|
+
* telephone: '+1-555-0100'
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Person example
|
|
87
|
+
* const personSchema = generateIdentitySchema({
|
|
88
|
+
* type: 'Person',
|
|
89
|
+
* name: 'John Doe',
|
|
90
|
+
* url: 'https://johndoe.com',
|
|
91
|
+
* imageUrl: 'https://johndoe.com/photo.jpg',
|
|
92
|
+
* sameAs: [
|
|
93
|
+
* 'https://twitter.com/johndoe',
|
|
94
|
+
* 'https://linkedin.com/in/johndoe'
|
|
95
|
+
* ],
|
|
96
|
+
* jobTitle: 'Senior Software Architect',
|
|
97
|
+
* worksFor: 'Acme Corp'
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function generateIdentitySchema(config: IdentityConfig & {
|
|
102
|
+
geo?: Partial<GeoConfig>;
|
|
103
|
+
}): Organization | Person;
|
|
104
|
+
/**
|
|
105
|
+
* Generates Organization JSON-LD schema
|
|
106
|
+
*
|
|
107
|
+
* @param config - Organization configuration
|
|
108
|
+
* @returns Validated Organization schema
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const orgSchema = generateOrganizationSchema({
|
|
113
|
+
* name: 'Acme Corp',
|
|
114
|
+
* url: 'https://acme.com',
|
|
115
|
+
* logo: 'https://acme.com/logo.png',
|
|
116
|
+
* sameAs: ['https://twitter.com/acme']
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
declare function generateOrganizationSchema(config: OrganizationConfig): Organization;
|
|
121
|
+
/**
|
|
122
|
+
* Generates Person JSON-LD schema
|
|
123
|
+
*
|
|
124
|
+
* @param config - Person configuration
|
|
125
|
+
* @returns Validated Person schema
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const personSchema = generatePersonSchema({
|
|
130
|
+
* name: 'John Doe',
|
|
131
|
+
* url: 'https://johndoe.com',
|
|
132
|
+
* image: 'https://johndoe.com/photo.jpg',
|
|
133
|
+
* jobTitle: 'Software Engineer'
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
declare function generatePersonSchema(config: PersonConfig): Person;
|
|
138
|
+
/**
|
|
139
|
+
* Serializes a JSON-LD schema to string for HTML injection
|
|
140
|
+
*
|
|
141
|
+
* @param schema - JSON-LD schema object
|
|
142
|
+
* @returns Formatted JSON string ready for <script type="application/ld+json">
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const schema = generateIdentitySchema({ ... });
|
|
147
|
+
* const scriptContent = serializeSchema(schema);
|
|
148
|
+
*
|
|
149
|
+
* // In HTML:
|
|
150
|
+
* // <script type="application/ld+json">{scriptContent}</script>
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function serializeSchema(schema: Organization | Person): string;
|
|
154
|
+
/**
|
|
155
|
+
* Generates a complete <script> tag with JSON-LD content
|
|
156
|
+
*
|
|
157
|
+
* @param schema - JSON-LD schema object
|
|
158
|
+
* @returns Complete script tag HTML string
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const schema = generateIdentitySchema({ ... });
|
|
163
|
+
* const scriptTag = generateScriptTag(schema);
|
|
164
|
+
*
|
|
165
|
+
* // Returns:
|
|
166
|
+
* // <script type="application/ld+json">
|
|
167
|
+
* // { "@context": "https://schema.org", ... }
|
|
168
|
+
* // </script>
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare function generateScriptTag(schema: Organization | Person): string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Product schema generator
|
|
175
|
+
* @module generators/product
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Configuration for generating Product schema
|
|
180
|
+
*/
|
|
181
|
+
interface ProductConfig {
|
|
182
|
+
name: string;
|
|
183
|
+
description?: string;
|
|
184
|
+
image?: string | string[];
|
|
185
|
+
sku?: string;
|
|
186
|
+
gtin?: string;
|
|
187
|
+
brand?: string;
|
|
188
|
+
offers?: OfferConfig | OfferConfig[];
|
|
189
|
+
aggregateRating?: {
|
|
190
|
+
ratingValue: number | string;
|
|
191
|
+
reviewCount: number;
|
|
192
|
+
bestRating?: number | string;
|
|
193
|
+
worstRating?: number | string;
|
|
194
|
+
};
|
|
195
|
+
category?: string;
|
|
196
|
+
color?: string | string[];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Configuration for Offer
|
|
200
|
+
*/
|
|
201
|
+
interface OfferConfig {
|
|
202
|
+
price: number | string;
|
|
203
|
+
priceCurrency: string;
|
|
204
|
+
availability?: string;
|
|
205
|
+
url?: string;
|
|
206
|
+
priceValidUntil?: string;
|
|
207
|
+
seller?: {
|
|
208
|
+
name: string;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Generates a validated Product JSON-LD schema
|
|
213
|
+
*
|
|
214
|
+
* @param config - Product configuration
|
|
215
|
+
* @returns Validated Product schema
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const product = generateProductSchema({
|
|
220
|
+
* name: 'Premium Wireless Headphones',
|
|
221
|
+
* description: 'High-quality wireless headphones with noise cancellation',
|
|
222
|
+
* image: 'https://example.com/headphones.jpg',
|
|
223
|
+
* sku: 'WH-1000XM5',
|
|
224
|
+
* brand: 'TechBrand',
|
|
225
|
+
* offers: {
|
|
226
|
+
* price: 299.99,
|
|
227
|
+
* priceCurrency: 'USD',
|
|
228
|
+
* availability: 'https://schema.org/InStock',
|
|
229
|
+
* },
|
|
230
|
+
* aggregateRating: {
|
|
231
|
+
* ratingValue: 4.8,
|
|
232
|
+
* reviewCount: 247,
|
|
233
|
+
* },
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
declare function generateProductSchema(config: ProductConfig): Product;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Article schema generator
|
|
241
|
+
* @module generators/article
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Configuration for generating Article schema
|
|
246
|
+
*/
|
|
247
|
+
interface ArticleConfig {
|
|
248
|
+
headline: string;
|
|
249
|
+
image: string | string[];
|
|
250
|
+
author: string | {
|
|
251
|
+
name: string;
|
|
252
|
+
url?: string;
|
|
253
|
+
} | Array<{
|
|
254
|
+
name: string;
|
|
255
|
+
url?: string;
|
|
256
|
+
}>;
|
|
257
|
+
datePublished: string;
|
|
258
|
+
dateModified?: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
articleBody?: string;
|
|
261
|
+
publisher?: {
|
|
262
|
+
name: string;
|
|
263
|
+
logo?: string;
|
|
264
|
+
};
|
|
265
|
+
url?: string;
|
|
266
|
+
keywords?: string | string[];
|
|
267
|
+
articleSection?: string;
|
|
268
|
+
/**
|
|
269
|
+
* GEO optimization settings for this specific article
|
|
270
|
+
*/
|
|
271
|
+
geo?: Partial<GeoConfig>;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Generates a validated Article JSON-LD schema
|
|
275
|
+
*
|
|
276
|
+
* @param config - Article configuration
|
|
277
|
+
* @returns Validated Article schema
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const article = generateArticleSchema({
|
|
282
|
+
* headline: 'The Future of GEO in 2026',
|
|
283
|
+
* image: 'https://example.com/article-image.jpg',
|
|
284
|
+
* author: 'John Doe',
|
|
285
|
+
* datePublished: '2026-01-05',
|
|
286
|
+
* geo: { contentDensity: 'high' } // Optimize for LLMs
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
declare function generateArticleSchema(config: ArticleConfig): Article;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* FAQ schema generator
|
|
294
|
+
* @module generators/faq
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Configuration for a single FAQ question
|
|
299
|
+
*/
|
|
300
|
+
interface FAQQuestion {
|
|
301
|
+
question: string;
|
|
302
|
+
answer: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Configuration for generating FAQPage schema
|
|
306
|
+
*/
|
|
307
|
+
interface FAQConfig {
|
|
308
|
+
questions: FAQQuestion[];
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Generates a validated FAQPage JSON-LD schema
|
|
312
|
+
*
|
|
313
|
+
* @param config - FAQ configuration with array of questions and answers
|
|
314
|
+
* @returns Validated FAQPage schema
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* const faq = generateFAQSchema({
|
|
319
|
+
* questions: [
|
|
320
|
+
* {
|
|
321
|
+
* question: 'What is GEO?',
|
|
322
|
+
* answer: 'GEO (Generative Engine Optimization) is the practice of optimizing content for AI search engines like ChatGPT, Gemini, and Perplexity.',
|
|
323
|
+
* },
|
|
324
|
+
* {
|
|
325
|
+
* question: 'How does Semantic Layer help with GEO?',
|
|
326
|
+
* answer: 'Semantic Layer automatically generates validated JSON-LD schemas that help AI models understand and cite your content.',
|
|
327
|
+
* },
|
|
328
|
+
* ],
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
declare function generateFAQSchema(config: FAQConfig): FAQPage;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Breadcrumb schema generator
|
|
336
|
+
* @module generators/breadcrumb
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Configuration for a single breadcrumb item
|
|
341
|
+
*/
|
|
342
|
+
interface BreadcrumbItem {
|
|
343
|
+
name: string;
|
|
344
|
+
url?: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Configuration for generating BreadcrumbList schema
|
|
348
|
+
*/
|
|
349
|
+
interface BreadcrumbConfig {
|
|
350
|
+
items: BreadcrumbItem[];
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Generates a validated BreadcrumbList JSON-LD schema
|
|
354
|
+
*
|
|
355
|
+
* @param config - Breadcrumb configuration with ordered array of items
|
|
356
|
+
* @returns Validated BreadcrumbList schema
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* const breadcrumb = generateBreadcrumbSchema({
|
|
361
|
+
* items: [
|
|
362
|
+
* { name: 'Home', url: 'https://example.com' },
|
|
363
|
+
* { name: 'Products', url: 'https://example.com/products' },
|
|
364
|
+
* { name: 'Headphones', url: 'https://example.com/products/headphones' },
|
|
365
|
+
* { name: 'WH-1000XM5' }, // Current page (no URL)
|
|
366
|
+
* ],
|
|
367
|
+
* });
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare function generateBreadcrumbSchema(config: BreadcrumbConfig): BreadcrumbList;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* OpenGraph and Twitter Cards meta tag generators
|
|
374
|
+
* @module generators/opengraph
|
|
375
|
+
*/
|
|
376
|
+
/**
|
|
377
|
+
* Meta tag interface
|
|
378
|
+
*/
|
|
379
|
+
interface MetaTag {
|
|
380
|
+
property?: string;
|
|
381
|
+
name?: string;
|
|
382
|
+
content: string;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Configuration for OpenGraph
|
|
386
|
+
*/
|
|
387
|
+
interface OpenGraphConfig {
|
|
388
|
+
title: string;
|
|
389
|
+
description: string;
|
|
390
|
+
url: string;
|
|
391
|
+
type?: 'website' | 'article' | 'product' | 'book' | 'profile' | 'music' | 'video';
|
|
392
|
+
image: string;
|
|
393
|
+
imageAlt?: string;
|
|
394
|
+
siteName?: string;
|
|
395
|
+
locale?: string;
|
|
396
|
+
publishedTime?: string;
|
|
397
|
+
modifiedTime?: string;
|
|
398
|
+
author?: string;
|
|
399
|
+
section?: string;
|
|
400
|
+
tags?: string[];
|
|
401
|
+
price?: number | string;
|
|
402
|
+
currency?: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Configuration for Twitter Cards
|
|
406
|
+
*/
|
|
407
|
+
interface TwitterCardConfig {
|
|
408
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
409
|
+
site?: string;
|
|
410
|
+
creator?: string;
|
|
411
|
+
title: string;
|
|
412
|
+
description: string;
|
|
413
|
+
image: string;
|
|
414
|
+
imageAlt?: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Generates OpenGraph meta tags
|
|
418
|
+
*
|
|
419
|
+
* @param config - OpenGraph configuration
|
|
420
|
+
* @returns Array of validated meta tags
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```typescript
|
|
424
|
+
* const ogTags = generateOpenGraphTags({
|
|
425
|
+
* title: 'Amazing Product',
|
|
426
|
+
* description: 'The best product ever',
|
|
427
|
+
* url: 'https://example.com/product',
|
|
428
|
+
* image: 'https://example.com/image.jpg',
|
|
429
|
+
* type: 'product',
|
|
430
|
+
* price: 99.99,
|
|
431
|
+
* currency: 'USD',
|
|
432
|
+
* });
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
declare function generateOpenGraphTags(config: OpenGraphConfig): MetaTag[];
|
|
436
|
+
/**
|
|
437
|
+
* Generates Twitter Card meta tags
|
|
438
|
+
*
|
|
439
|
+
* @param config - Twitter Card configuration
|
|
440
|
+
* @returns Array of validated meta tags
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* const twitterTags = generateTwitterCardTags({
|
|
445
|
+
* card: 'summary_large_image',
|
|
446
|
+
* site: '@mysite',
|
|
447
|
+
* title: 'Amazing Product',
|
|
448
|
+
* description: 'Check out this product',
|
|
449
|
+
* image: 'https://example.com/image.jpg',
|
|
450
|
+
* });
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
declare function generateTwitterCardTags(config: TwitterCardConfig): MetaTag[];
|
|
454
|
+
/**
|
|
455
|
+
* Generates both OpenGraph and Twitter Card meta tags
|
|
456
|
+
*
|
|
457
|
+
* @param config - Combined configuration
|
|
458
|
+
* @returns Object with separate arrays for og and twitter tags
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```typescript
|
|
462
|
+
* const { openGraph, twitter } = generateSocialMetaTags({
|
|
463
|
+
* title: 'My Page',
|
|
464
|
+
* description: 'Page description',
|
|
465
|
+
* url: 'https://example.com',
|
|
466
|
+
* image: 'https://example.com/image.jpg',
|
|
467
|
+
* twitterSite: '@mysite',
|
|
468
|
+
* });
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
declare function generateSocialMetaTags(config: {
|
|
472
|
+
title: string;
|
|
473
|
+
description: string;
|
|
474
|
+
url: string;
|
|
475
|
+
image: string;
|
|
476
|
+
imageAlt?: string;
|
|
477
|
+
type?: OpenGraphConfig['type'];
|
|
478
|
+
siteName?: string;
|
|
479
|
+
twitterSite?: string;
|
|
480
|
+
twitterCreator?: string;
|
|
481
|
+
twitterCard?: TwitterCardConfig['card'];
|
|
482
|
+
}): {
|
|
483
|
+
openGraph: MetaTag[];
|
|
484
|
+
twitter: MetaTag[];
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Converts meta tags to HTML string
|
|
488
|
+
*
|
|
489
|
+
* @param tags - Array of meta tags
|
|
490
|
+
* @returns HTML string
|
|
491
|
+
*/
|
|
492
|
+
declare function metaTagsToHTML(tags: MetaTag[]): string;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* LocalBusiness schema generator
|
|
496
|
+
* @module generators/localbusiness
|
|
497
|
+
*/
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Day of week type
|
|
501
|
+
*/
|
|
502
|
+
type DayOfWeek = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
|
|
503
|
+
/**
|
|
504
|
+
* Opening hours configuration
|
|
505
|
+
*/
|
|
506
|
+
interface OpeningHoursConfig {
|
|
507
|
+
dayOfWeek: DayOfWeek | DayOfWeek[];
|
|
508
|
+
opens: string;
|
|
509
|
+
closes: string;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Configuration for LocalBusiness schema
|
|
513
|
+
*/
|
|
514
|
+
interface LocalBusinessConfig {
|
|
515
|
+
type?: string;
|
|
516
|
+
name: string;
|
|
517
|
+
image: string | string[];
|
|
518
|
+
address: {
|
|
519
|
+
streetAddress: string;
|
|
520
|
+
addressLocality: string;
|
|
521
|
+
addressRegion: string;
|
|
522
|
+
postalCode: string;
|
|
523
|
+
addressCountry: string;
|
|
524
|
+
};
|
|
525
|
+
geo?: {
|
|
526
|
+
latitude: number;
|
|
527
|
+
longitude: number;
|
|
528
|
+
};
|
|
529
|
+
url?: string;
|
|
530
|
+
telephone?: string;
|
|
531
|
+
priceRange?: string;
|
|
532
|
+
openingHours?: OpeningHoursConfig | OpeningHoursConfig[];
|
|
533
|
+
description?: string;
|
|
534
|
+
aggregateRating?: {
|
|
535
|
+
ratingValue: number | string;
|
|
536
|
+
reviewCount: number;
|
|
537
|
+
};
|
|
538
|
+
servesCuisine?: string | string[];
|
|
539
|
+
menu?: string;
|
|
540
|
+
acceptsReservations?: boolean | string;
|
|
541
|
+
paymentAccepted?: string;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Generates a validated LocalBusiness JSON-LD schema
|
|
545
|
+
*
|
|
546
|
+
* Perfect for restaurants, stores, offices, dentists, salons, etc.
|
|
547
|
+
*
|
|
548
|
+
* @param config - LocalBusiness configuration
|
|
549
|
+
* @returns Validated LocalBusiness schema
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* const business = generateLocalBusinessSchema({
|
|
554
|
+
* type: 'Restaurant',
|
|
555
|
+
* name: 'Pizza Palace',
|
|
556
|
+
* image: 'https://example.com/pizza.jpg',
|
|
557
|
+
* address: {
|
|
558
|
+
* streetAddress: '123 Main St',
|
|
559
|
+
* addressLocality: 'New York',
|
|
560
|
+
* addressRegion: 'NY',
|
|
561
|
+
* postalCode: '10001',
|
|
562
|
+
* addressCountry: 'US',
|
|
563
|
+
* },
|
|
564
|
+
* geo: {
|
|
565
|
+
* latitude: 40.7128,
|
|
566
|
+
* longitude: -74.0060,
|
|
567
|
+
* },
|
|
568
|
+
* telephone: '+1-555-0199',
|
|
569
|
+
* priceRange: '$$',
|
|
570
|
+
* servesCuisine: 'Italian',
|
|
571
|
+
* openingHours: [
|
|
572
|
+
* { dayOfWeek: ['Monday', 'Tuesday', 'Wednesday', 'Thursday'], opens: '11:00', closes: '22:00' },
|
|
573
|
+
* { dayOfWeek: ['Friday', 'Saturday'], opens: '11:00', closes: '23:00' },
|
|
574
|
+
* { dayOfWeek: 'Sunday', opens: '12:00', closes: '21:00' },
|
|
575
|
+
* ],
|
|
576
|
+
* });
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
declare function generateLocalBusinessSchema(config: LocalBusinessConfig): LocalBusiness;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Event schema generator
|
|
583
|
+
* @module generators/event
|
|
584
|
+
*/
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Configuration for Event schema
|
|
588
|
+
*/
|
|
589
|
+
interface EventConfig {
|
|
590
|
+
type?: 'Event' | 'MusicEvent' | 'BusinessEvent' | 'SportsEvent' | 'TheaterEvent' | 'EducationEvent';
|
|
591
|
+
name: string;
|
|
592
|
+
startDate: string;
|
|
593
|
+
endDate?: string;
|
|
594
|
+
eventStatus?: 'EventScheduled' | 'EventCancelled' | 'EventMovedOnline' | 'EventPostponed' | 'EventRescheduled';
|
|
595
|
+
eventAttendanceMode?: 'OfflineEventAttendanceMode' | 'OnlineEventAttendanceMode' | 'MixedEventAttendanceMode';
|
|
596
|
+
location?: {
|
|
597
|
+
name: string;
|
|
598
|
+
address?: string | {
|
|
599
|
+
streetAddress?: string;
|
|
600
|
+
addressLocality?: string;
|
|
601
|
+
addressRegion?: string;
|
|
602
|
+
postalCode?: string;
|
|
603
|
+
addressCountry?: string;
|
|
604
|
+
};
|
|
605
|
+
} | string;
|
|
606
|
+
image?: string | string[];
|
|
607
|
+
description?: string;
|
|
608
|
+
url?: string;
|
|
609
|
+
organizer?: {
|
|
610
|
+
type: 'Organization' | 'Person';
|
|
611
|
+
name: string;
|
|
612
|
+
url?: string;
|
|
613
|
+
};
|
|
614
|
+
performer?: {
|
|
615
|
+
type: 'Person' | 'PerformingGroup';
|
|
616
|
+
name: string;
|
|
617
|
+
} | Array<{
|
|
618
|
+
type: 'Person' | 'PerformingGroup';
|
|
619
|
+
name: string;
|
|
620
|
+
}>;
|
|
621
|
+
offers?: {
|
|
622
|
+
url?: string;
|
|
623
|
+
price: number | string;
|
|
624
|
+
priceCurrency: string;
|
|
625
|
+
availability?: string;
|
|
626
|
+
validFrom?: string;
|
|
627
|
+
} | Array<{
|
|
628
|
+
url?: string;
|
|
629
|
+
price: number | string;
|
|
630
|
+
priceCurrency: string;
|
|
631
|
+
availability?: string;
|
|
632
|
+
validFrom?: string;
|
|
633
|
+
}>;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Generates a validated Event JSON-LD schema
|
|
637
|
+
*
|
|
638
|
+
* Perfect for concerts, conferences, workshops, sports games, theater shows, etc.
|
|
639
|
+
*
|
|
640
|
+
* @param config - Event configuration
|
|
641
|
+
* @returns Validated Event schema
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* const event = generateEventSchema({
|
|
646
|
+
* type: 'MusicEvent',
|
|
647
|
+
* name: 'Summer Music Festival 2026',
|
|
648
|
+
* startDate: '2026-07-15T18:00:00-05:00',
|
|
649
|
+
* endDate: '2026-07-15T23:00:00-05:00',
|
|
650
|
+
* eventStatus: 'EventScheduled',
|
|
651
|
+
* eventAttendanceMode: 'OfflineEventAttendanceMode',
|
|
652
|
+
* location: {
|
|
653
|
+
* name: 'Central Park',
|
|
654
|
+
* address: {
|
|
655
|
+
* addressLocality: 'New York',
|
|
656
|
+
* addressRegion: 'NY',
|
|
657
|
+
* addressCountry: 'US',
|
|
658
|
+
* },
|
|
659
|
+
* },
|
|
660
|
+
* image: 'https://example.com/festival.jpg',
|
|
661
|
+
* description: 'Annual summer music festival featuring top artists',
|
|
662
|
+
* organizer: {
|
|
663
|
+
* type: 'Organization',
|
|
664
|
+
* name: 'Music Events Inc',
|
|
665
|
+
* },
|
|
666
|
+
* offers: {
|
|
667
|
+
* price: 75,
|
|
668
|
+
* priceCurrency: 'USD',
|
|
669
|
+
* availability: 'https://schema.org/InStock',
|
|
670
|
+
* url: 'https://example.com/tickets',
|
|
671
|
+
* },
|
|
672
|
+
* });
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
declare function generateEventSchema(config: EventConfig): Event;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* WebPage schema generator
|
|
679
|
+
* @module generators/webpage
|
|
680
|
+
*/
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Configuration for generating WebPage schema
|
|
684
|
+
*/
|
|
685
|
+
interface WebPageConfig {
|
|
686
|
+
name: string;
|
|
687
|
+
description: string;
|
|
688
|
+
url: string;
|
|
689
|
+
inLanguage?: string;
|
|
690
|
+
isPartOf?: {
|
|
691
|
+
'@type': 'WebSite';
|
|
692
|
+
name: string;
|
|
693
|
+
url: string;
|
|
694
|
+
};
|
|
695
|
+
breadcrumb?: {
|
|
696
|
+
'@type': 'BreadcrumbList';
|
|
697
|
+
itemListElement: Array<{
|
|
698
|
+
'@type': 'ListItem';
|
|
699
|
+
position: number;
|
|
700
|
+
name: string;
|
|
701
|
+
item?: string;
|
|
702
|
+
}>;
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Generates a validated WebPage JSON-LD schema
|
|
707
|
+
*
|
|
708
|
+
* @param config - WebPage configuration
|
|
709
|
+
* @returns Validated WebPage schema
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* ```typescript
|
|
713
|
+
* const webPage = generateWebPageSchema({
|
|
714
|
+
* name: 'Product Catalog',
|
|
715
|
+
* description: 'Browse our complete product catalog',
|
|
716
|
+
* url: 'https://example.com/products',
|
|
717
|
+
* inLanguage: 'en-US'
|
|
718
|
+
* });
|
|
719
|
+
* ```
|
|
720
|
+
*/
|
|
721
|
+
declare function generateWebPageSchema(config: WebPageConfig): WebPage;
|
|
722
|
+
|
|
723
|
+
export { type ArticleConfig, type BreadcrumbConfig, type BreadcrumbItem, type DayOfWeek, type EventConfig, type FAQConfig, type FAQQuestion, type LocalBusinessConfig, type MetaTag, type OfferConfig, type OpenGraphConfig, type OpeningHoursConfig, type OrganizationConfig, type PersonConfig, type ProductConfig, type TwitterCardConfig, type WebPageConfig, generateArticleSchema, generateBreadcrumbSchema, generateEventSchema, generateFAQSchema, generateIdentitySchema, generateLocalBusinessSchema, generateOpenGraphTags, generateOrganizationSchema, generatePersonSchema, generateProductSchema, generateScriptTag, generateSocialMetaTags, generateTwitterCardTags, generateWebPageSchema, metaTagsToHTML, serializeSchema };
|