@lynx-seo/engine 3.3.3 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -24
- package/dist/http-middleware.d.ts +91 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +6659 -965
- package/dist/index.mjs +6659 -965
- package/dist/matrix-engine.d.ts +139 -5
- package/dist/mcp-seo-server.js +33 -10
- package/dist/plugin/rum-plugin.d.ts +1 -1
- package/dist/plugins/account-analytics/index.d.ts +11 -9
- package/dist/plugins/early-access-features/index.d.ts +6 -1
- package/dist/plugins/group-analytics/index.d.ts +0 -1
- package/dist/plugins/llm-observability/index.d.ts +0 -1
- package/dist/plugins/mobile-messaging/index.d.ts +1 -1
- package/dist/plugins/page-performance/index.d.ts +1 -1
- package/dist/plugins/real-time-usage/index.d.ts +24 -5
- package/dist/report-builder.d.ts +26 -4
- package/dist/white-label-exports.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,46 +23,75 @@ High-Performance Universal Programmatic SEO & Structured Data Engine for Modern
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
## Quickstart:
|
|
26
|
+
## Quickstart: LynxSEO Engine Setup
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
`LynxSeoEngine` connects your application to the LynxSEO platform for programmatic SEO resolution, Schema.org rich data, live analytics tracking, and automated search indexation.
|
|
29
|
+
|
|
30
|
+
> [!IMPORTANT]
|
|
31
|
+
> **API Key Required**: An active `LYNXSEO_API_KEY` is mandatory to initialize and resolve pages with `LynxSeoEngine`.
|
|
32
|
+
> Get your license key on [https://lynxseo.com](https://lynxseo.com).
|
|
29
33
|
|
|
30
34
|
```typescript
|
|
31
|
-
import {
|
|
35
|
+
import { LynxSeoEngine } from "@lynxseo/engine";
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
samplePseoDataset.locations,
|
|
39
|
-
{ language: "fr", cleanDirectRoutes: true }
|
|
40
|
-
);
|
|
37
|
+
const engine = new LynxSeoEngine({
|
|
38
|
+
apiKey: process.env.LYNXSEO_API_KEY!, // e.g. "ba_live_..."
|
|
39
|
+
siteUrl: "https://example.com",
|
|
40
|
+
brandName: "Acme",
|
|
41
|
+
});
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.log(
|
|
45
|
-
console.log(
|
|
43
|
+
// Resolve any programmatic route
|
|
44
|
+
const page = await engine.resolve("/services/pompe-a-chaleur/france/paris");
|
|
45
|
+
console.log(page?.title); // -> "Installation Pompe à Chaleur à Paris (75) | Acme"
|
|
46
|
+
console.log(page?.canonicalUrl); // -> "https://example.com/services/pompe-a-chaleur/france/paris"
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
50
|
-
##
|
|
51
|
+
## 1-Line HTTP Integration (Express, Connect, Node.js)
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
An active API key is mandatory for `LynxSeoEngine`:
|
|
53
|
+
Serve your programmatic sitemaps, `/llms.txt`, and track visitor analytics in a single line of code:
|
|
55
54
|
|
|
56
55
|
```typescript
|
|
57
|
-
import
|
|
56
|
+
import express from "express";
|
|
57
|
+
import { LynxSeoEngine, expressMiddleware } from "@lynxseo/engine";
|
|
58
58
|
|
|
59
|
+
const app = express();
|
|
59
60
|
const engine = new LynxSeoEngine({
|
|
60
|
-
apiKey: process.env.LYNXSEO_API_KEY!,
|
|
61
|
+
apiKey: process.env.LYNXSEO_API_KEY!,
|
|
61
62
|
siteUrl: "https://example.com",
|
|
62
63
|
brandName: "Acme",
|
|
63
64
|
});
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
// 🚀 Automatically serves /sitemap-pseo.xml, /llms.txt, /robots.txt and tracks pageviews
|
|
67
|
+
app.use(expressMiddleware(engine));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Architecture & Sub-Modules
|
|
73
|
+
|
|
74
|
+
Internally, `LynxSeoEngine` orchestrates specialized sub-engines:
|
|
75
|
+
* **`PseoMatrixEngine`** : The algorithmic permutation engine powering service x location matrix calculation.
|
|
76
|
+
* **`AnalyticsClient`** : Real-time visitor and AI search crawler telemetry.
|
|
77
|
+
* **`ApiKeyGuardian`** : Commercial license authentication and quota monitoring.
|
|
78
|
+
|
|
79
|
+
### Offline Matrix Engine Reference (`PseoMatrixEngine`)
|
|
80
|
+
|
|
81
|
+
For custom internal pipelines requiring low-level matrix calculation:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { PseoMatrixEngine, samplePseoDataset } from "@lynxseo/engine";
|
|
85
|
+
|
|
86
|
+
const matrix = new PseoMatrixEngine();
|
|
87
|
+
const pages = matrix.generateLocalGeoMatrix(
|
|
88
|
+
"https://example.com",
|
|
89
|
+
samplePseoDataset.services,
|
|
90
|
+
samplePseoDataset.locations,
|
|
91
|
+
{ language: "fr", cleanDirectRoutes: true }
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
console.log(`Calculated ${pages.length} permutation routes.`);
|
|
66
95
|
```
|
|
67
96
|
|
|
68
97
|
---
|
|
@@ -165,10 +194,62 @@ const pageStandard = matrixEngine.resolvePage(["commercial-hvac", "new-york"], "
|
|
|
165
194
|
const pageCustom = matrixEngine.resolvePage(["commercial-hvac", "90210"], "https://example.com", PSEO_DATASET, SEO_CONFIG);
|
|
166
195
|
```
|
|
167
196
|
|
|
168
|
-
### 3.
|
|
197
|
+
### 3. Universal Web Middleware & Framework Handlers
|
|
198
|
+
|
|
199
|
+
Plug dynamic sitemaps, AI bot directives (`/llms.txt`, `/robots.txt`), and non-blocking traffic tracking in 1 line:
|
|
200
|
+
|
|
201
|
+
#### Express / Connect / Polka:
|
|
202
|
+
```typescript
|
|
203
|
+
import express from "express";
|
|
204
|
+
import { LynxSeoEngine, expressMiddleware } from "@lynx-seo/engine";
|
|
205
|
+
|
|
206
|
+
const app = express();
|
|
207
|
+
const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
|
|
208
|
+
|
|
209
|
+
// Plugs /sitemap-pseo.xml, /llms.txt, /robots.txt and auto-tracking
|
|
210
|
+
app.use(expressMiddleware(engine));
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Next.js App Router (`app/sitemap-pseo.xml/route.ts` & `app/llms.txt/route.ts`):
|
|
214
|
+
```typescript
|
|
215
|
+
import { LynxSeoEngine, createNextRouteHandler } from "@lynx-seo/engine";
|
|
216
|
+
|
|
217
|
+
const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
|
|
218
|
+
export const { GET } = createNextRouteHandler(engine);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Hono / Cloudflare Workers:
|
|
222
|
+
```typescript
|
|
223
|
+
import { Hono } from "hono";
|
|
224
|
+
import { LynxSeoEngine, webFetchHandler } from "@lynx-seo/engine";
|
|
225
|
+
|
|
226
|
+
const app = new Hono();
|
|
227
|
+
const engine = new LynxSeoEngine({ apiKey: process.env.LYNXSEO_API_KEY });
|
|
228
|
+
const handleFetch = webFetchHandler(engine);
|
|
229
|
+
|
|
230
|
+
app.use("*", async (c, next) => {
|
|
231
|
+
const res = await handleFetch(c.req.raw);
|
|
232
|
+
if (res) return res;
|
|
233
|
+
await next();
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### Next.js Metadata Helper (`toNextMetadata`):
|
|
238
|
+
```typescript
|
|
239
|
+
import { toNextMetadata, LynxSeoEngine } from "@lynx-seo/engine";
|
|
240
|
+
|
|
241
|
+
export async function generateMetadata({ params }) {
|
|
242
|
+
const page = engine.resolve({ service: params.service, location: params.city });
|
|
243
|
+
return toNextMetadata(page);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### 4. Edge GeoIP Resolution Example
|
|
169
250
|
|
|
170
251
|
```typescript
|
|
171
|
-
import { resolveLocationFromHeaders, PseoMatrixEngine } from "@
|
|
252
|
+
import { resolveLocationFromHeaders, PseoMatrixEngine } from "@lynx-seo/engine";
|
|
172
253
|
|
|
173
254
|
export function handleIncomingRequest(request: Request) {
|
|
174
255
|
const geo = resolveLocationFromHeaders(request.headers);
|
|
@@ -119,3 +119,94 @@ export declare function expressMiddleware(engine: LynxSeoEngine, options?: LynxM
|
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
121
|
export declare const nodeHandler: typeof createLynxNodeHandler;
|
|
122
|
+
/**
|
|
123
|
+
* Universal Web Standards Fetch Request Handler (Web Standards Request / Response).
|
|
124
|
+
* Compatible with Next.js App Router (route.ts), Cloudflare Workers, Hono, Bun, and Deno.
|
|
125
|
+
*
|
|
126
|
+
* Returns a standard `Response` if the route was handled, or `null` if the request should pass through.
|
|
127
|
+
*
|
|
128
|
+
* @example Next.js App Router (`app/[...lynx]/route.ts` or `app/sitemap-pseo.xml/route.ts`):
|
|
129
|
+
* ```typescript
|
|
130
|
+
* import { LynxSeoEngine, webFetchHandler } from "@lynx-seo/engine";
|
|
131
|
+
*
|
|
132
|
+
* const engine = new LynxSeoEngine({ ... });
|
|
133
|
+
* const handleFetch = webFetchHandler(engine);
|
|
134
|
+
*
|
|
135
|
+
* export async function GET(request: Request) {
|
|
136
|
+
* const response = await handleFetch(request);
|
|
137
|
+
* if (response) return response;
|
|
138
|
+
* return new Response("Not Found", { status: 404 });
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @example Hono (`app.use('*')`):
|
|
143
|
+
* ```typescript
|
|
144
|
+
* app.use('*', async (c, next) => {
|
|
145
|
+
* const res = await handleFetch(c.req.raw);
|
|
146
|
+
* if (res) return res;
|
|
147
|
+
* await next();
|
|
148
|
+
* });
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function webFetchHandler(engine: LynxSeoEngine, options?: LynxMiddlewareOptions): (request: Request) => Promise<Response | null>;
|
|
152
|
+
/**
|
|
153
|
+
* Next.js Route Handler Helper.
|
|
154
|
+
* Creates an object `{ GET: (request: Request) => Promise<Response> }` ready to export in `app/sitemap-pseo.xml/route.ts` or `app/api/lynx/[...slug]/route.ts`.
|
|
155
|
+
*/
|
|
156
|
+
export declare function createNextRouteHandler(engine: LynxSeoEngine, options?: LynxMiddlewareOptions): {
|
|
157
|
+
GET(request: Request): Promise<Response>;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Converts a LynxResolvedPage or GeneratedPageMeta into a standard Next.js Metadata object.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* import { toNextMetadata, LynxSeoEngine } from "@lynx-seo/engine";
|
|
165
|
+
*
|
|
166
|
+
* export async function generateMetadata({ params }) {
|
|
167
|
+
* const page = engine.resolve({ service: params.service, location: params.city });
|
|
168
|
+
* return toNextMetadata(page);
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export declare function toNextMetadata(page: {
|
|
173
|
+
title?: string;
|
|
174
|
+
metaDescription?: string;
|
|
175
|
+
canonicalUrl?: string;
|
|
176
|
+
url?: string;
|
|
177
|
+
locale?: string;
|
|
178
|
+
keywords?: string[];
|
|
179
|
+
ogImage?: string;
|
|
180
|
+
}): {
|
|
181
|
+
title: string | undefined;
|
|
182
|
+
description: string | undefined;
|
|
183
|
+
keywords: string[] | undefined;
|
|
184
|
+
alternates: {
|
|
185
|
+
canonical: string;
|
|
186
|
+
} | undefined;
|
|
187
|
+
openGraph: {
|
|
188
|
+
title: string | undefined;
|
|
189
|
+
description: string | undefined;
|
|
190
|
+
url: string | undefined;
|
|
191
|
+
locale: string | undefined;
|
|
192
|
+
images: {
|
|
193
|
+
url: string;
|
|
194
|
+
}[] | undefined;
|
|
195
|
+
};
|
|
196
|
+
twitter: {
|
|
197
|
+
card: "summary_large_image";
|
|
198
|
+
title: string | undefined;
|
|
199
|
+
description: string | undefined;
|
|
200
|
+
images: string[] | undefined;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Converts a LynxResolvedPage or GeneratedPageMeta into an HTML string of meta tags (<title>, <meta>, <link rel="canonical">).
|
|
205
|
+
*/
|
|
206
|
+
export declare function toHtmlMetaTags(page: {
|
|
207
|
+
title?: string;
|
|
208
|
+
metaDescription?: string;
|
|
209
|
+
canonicalUrl?: string;
|
|
210
|
+
url?: string;
|
|
211
|
+
schemaOrgJson?: string;
|
|
212
|
+
}): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1460,3 +1460,41 @@ export * from "./analytics/product-hunt-launch-war-room-engine";
|
|
|
1460
1460
|
export * from "./analytics/engineering-as-marketing-free-tool-engine";
|
|
1461
1461
|
export * from "./analytics/ethical-popup-overlay-engine";
|
|
1462
1462
|
export * from "./analytics/saas-value-metric-pricing-engine";
|
|
1463
|
+
export { type AbVariant, type AbExperimentLifecycle, AbExperimentsEngine, } from "./ab-experiments-engine";
|
|
1464
|
+
export * from "./ai-citation-tracker";
|
|
1465
|
+
export * from "./bing-webmaster-client";
|
|
1466
|
+
export * from "./competitor-insights";
|
|
1467
|
+
export * from "./content-writer";
|
|
1468
|
+
export * from "./deep-crawler-auditor";
|
|
1469
|
+
export * from "./device-detection";
|
|
1470
|
+
export * from "./html-diff-engine";
|
|
1471
|
+
export * from "./internal-anchor-optimizer";
|
|
1472
|
+
export * from "./meta-ad-library-intelligence";
|
|
1473
|
+
export * from "./public-status-pages";
|
|
1474
|
+
export * from "./real-user-monitoring";
|
|
1475
|
+
export { type CrawlPageNode, type OrphanPageResult, type CrawlDepthResult, type HreflangReciprocityIssue, type TechnicalAuditSummary, TechnicalSeoCrawlAuditor, } from "./technical-seo-crawl-auditor";
|
|
1476
|
+
export * from "./utm-conventions";
|
|
1477
|
+
export * from "./white-label";
|
|
1478
|
+
export * from "./word-frequency-analyzer";
|
|
1479
|
+
export * from "./youtube-api-client";
|
|
1480
|
+
export * from "./yotpo-sync-engine";
|
|
1481
|
+
export * from "./rivo-sync-engine";
|
|
1482
|
+
export * from "./page-snapshotter";
|
|
1483
|
+
export * from "./page-delivery-auditor";
|
|
1484
|
+
export * from "./local-pseo-mesh-linker";
|
|
1485
|
+
export * from "./international-serp-parser";
|
|
1486
|
+
export * from "./i18n-dictionary";
|
|
1487
|
+
export * from "./html-snapshot-replay";
|
|
1488
|
+
export * from "./embed-facade-generator";
|
|
1489
|
+
export { type BusinessModel, type EventCategory, type EventDefinition as TaxonomyEventDefinition, type FunnelTemplate, type EventCatalog, validateEventName, getEventLibrary, getFunnelTemplates, getEventDefinition, hasEvent, buildEventCatalog, } from "./event-taxonomy";
|
|
1490
|
+
export * from "./conversion-tracking-generator";
|
|
1491
|
+
export * from "./cobrowsing-webrtc-client";
|
|
1492
|
+
export { type ConnectionState, type SignalingOffer, type SignalingAnswer, type IceCandidate, type SignalingSessionOptions, CobrowsingWebRTCPeer, type SignalingBroker, type AssistClientOptions, AssistClient, createAssistClient, createSignalingSession, } from "./cobrowsing-webrtc-signaling";
|
|
1493
|
+
export * from "./backlinks-store";
|
|
1494
|
+
export * from "./analytics-query-agent";
|
|
1495
|
+
export * from "./dataforseo-targeting-catalog";
|
|
1496
|
+
export * from "./session-replay-mouse-capture";
|
|
1497
|
+
export * from "./sourcemap-reader";
|
|
1498
|
+
export * from "./sourcemap-uploader";
|
|
1499
|
+
export * from "./report-builder";
|
|
1500
|
+
export * from "./white-label-exports";
|