@nuxtseo/protocol 0.1.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.
Files changed (44) hide show
  1. package/dist/analytics-codecs/analytics-row.d.ts +265 -0
  2. package/dist/analytics-codecs/analytics-row.js +175 -0
  3. package/dist/analytics-codecs/analytics-web-vitals.d.ts +57 -0
  4. package/dist/analytics-codecs/analytics-web-vitals.js +76 -0
  5. package/dist/analytics-codecs/capabilities.d.ts +35 -0
  6. package/dist/analytics-codecs/capabilities.js +76 -0
  7. package/dist/analytics-codecs/index.d.ts +3 -0
  8. package/dist/analytics-codecs/index.js +3 -0
  9. package/dist/cli-pairing.d.ts +67 -0
  10. package/dist/cli-pairing.js +52 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/v1/account.d.ts +715 -0
  14. package/dist/v1/account.js +123 -0
  15. package/dist/v1/actions.d.ts +2591 -0
  16. package/dist/v1/actions.js +460 -0
  17. package/dist/v1/analytics.d.ts +6145 -0
  18. package/dist/v1/analytics.js +296 -0
  19. package/dist/v1/audit.d.ts +4053 -0
  20. package/dist/v1/audit.js +609 -0
  21. package/dist/v1/backlinks.d.ts +1002 -0
  22. package/dist/v1/backlinks.js +239 -0
  23. package/dist/v1/content.d.ts +2745 -0
  24. package/dist/v1/content.js +326 -0
  25. package/dist/v1/core.d.ts +301 -0
  26. package/dist/v1/core.js +333 -0
  27. package/dist/v1/documents.d.ts +4 -0
  28. package/dist/v1/documents.js +216 -0
  29. package/dist/v1/gsc.d.ts +5172 -0
  30. package/dist/v1/gsc.js +583 -0
  31. package/dist/v1/index.d.ts +49 -0
  32. package/dist/v1/index.js +52 -0
  33. package/dist/v1/pages.d.ts +1404 -0
  34. package/dist/v1/pages.js +287 -0
  35. package/dist/v1/performance.d.ts +1379 -0
  36. package/dist/v1/performance.js +198 -0
  37. package/dist/v1/research.d.ts +1173 -0
  38. package/dist/v1/research.js +174 -0
  39. package/dist/v1/sitemaps.d.ts +1506 -0
  40. package/dist/v1/sitemaps.js +199 -0
  41. package/dist/v1/sites.d.ts +591 -0
  42. package/dist/v1/sites.js +101 -0
  43. package/generated/openapi.v1.json +1 -0
  44. package/package.json +131 -0
@@ -0,0 +1,287 @@
1
+ import { z as schema } from 'zod';
2
+ import { defineOperation, defineRegistry, defineResponseObject, defineSuccessEnvelope, publicV1ErrorEnvelope, publicV1StandardRatePolicy, } from './core.js';
3
+ export const pageSiteParamsSchema = schema.strictObject({
4
+ siteId: schema.string().min(1),
5
+ });
6
+ export const pageInspectQuerySchema = schema.strictObject({
7
+ url: schema.string().url(),
8
+ includeResolved: schema.enum(['0', '1', 'true', 'false']).default('0').transform(value => value === '1' || value === 'true'),
9
+ limit: schema.coerce.number().int().min(1).max(200).default(100),
10
+ offset: schema.coerce.number().int().min(0).default(0),
11
+ });
12
+ export const pageScanBodySchema = schema.strictObject({
13
+ url: schema.string().url(),
14
+ });
15
+ export const pageObservationSchema = defineResponseObject({
16
+ url: schema.string().url(),
17
+ path: schema.string(),
18
+ pathWithQuery: schema.string(),
19
+ source: schema.string().min(1),
20
+ issueType: schema.string().min(1),
21
+ severity: schema.enum(['error', 'warning', 'info']),
22
+ detail: schema.record(schema.string(), schema.unknown()).nullable(),
23
+ firstSeenAt: schema.string().datetime().nullable(),
24
+ lastSeenAt: schema.string().datetime().nullable(),
25
+ resolvedAt: schema.string().datetime().nullable(),
26
+ resolution: schema.enum(['fixed', 'removed', 'excluded', 'unmonitored']).nullable(),
27
+ }, {
28
+ url: schema.string().url(),
29
+ path: schema.string(),
30
+ pathWithQuery: schema.string(),
31
+ source: schema.string().min(1),
32
+ issueType: schema.string().min(1),
33
+ severity: schema.enum(['error', 'warning', 'info']),
34
+ detail: schema.record(schema.string(), schema.unknown()).nullable(),
35
+ firstSeenAt: schema.string().datetime().nullable(),
36
+ lastSeenAt: schema.string().datetime().nullable(),
37
+ resolvedAt: schema.string().datetime().nullable(),
38
+ resolution: schema.enum(['fixed', 'removed', 'excluded', 'unmonitored']).nullable(),
39
+ });
40
+ export const pageLighthouseSchema = defineResponseObject({
41
+ scanId: schema.string().min(1),
42
+ strategy: schema.enum(['mobile', 'desktop']),
43
+ completedAt: schema.string().datetime().nullable(),
44
+ performance: schema.number().nullable(),
45
+ accessibility: schema.number().nullable(),
46
+ bestPractices: schema.number().nullable(),
47
+ seo: schema.number().nullable(),
48
+ lcp: schema.number().nullable(),
49
+ tbt: schema.number().nullable(),
50
+ cls: schema.number().nullable(),
51
+ }, {
52
+ scanId: schema.string().min(1),
53
+ strategy: schema.enum(['mobile', 'desktop']),
54
+ completedAt: schema.string().datetime().nullable(),
55
+ performance: schema.number().nullable(),
56
+ accessibility: schema.number().nullable(),
57
+ bestPractices: schema.number().nullable(),
58
+ seo: schema.number().nullable(),
59
+ lcp: schema.number().nullable(),
60
+ tbt: schema.number().nullable(),
61
+ cls: schema.number().nullable(),
62
+ });
63
+ export const pageRankingKeywordSchema = defineResponseObject({
64
+ keyword: schema.string().min(1),
65
+ volume: schema.number().nullable(),
66
+ position: schema.number().nullable(),
67
+ checkedAt: schema.string().datetime().nullable(),
68
+ }, {
69
+ keyword: schema.string().min(1),
70
+ volume: schema.number().nullable(),
71
+ position: schema.number().nullable(),
72
+ checkedAt: schema.string().datetime().nullable(),
73
+ });
74
+ export const pageInspectDataSchema = defineResponseObject({
75
+ page: schema.strictObject({
76
+ url: schema.string().url(),
77
+ path: schema.string(),
78
+ }),
79
+ observations: schema.strictObject({
80
+ rows: schema.array(pageObservationSchema.producer),
81
+ total: schema.number().int().nonnegative(),
82
+ pagination: schema.strictObject({
83
+ limit: schema.number().int().positive(),
84
+ offset: schema.number().int().nonnegative(),
85
+ hasMore: schema.boolean(),
86
+ }),
87
+ }),
88
+ performance: schema.strictObject({
89
+ lighthouse: pageLighthouseSchema.producer.nullable(),
90
+ }),
91
+ search: schema.strictObject({
92
+ keywords: schema.array(pageRankingKeywordSchema.producer),
93
+ }),
94
+ }, {
95
+ page: schema.looseObject({
96
+ url: schema.string().url(),
97
+ path: schema.string(),
98
+ }),
99
+ observations: schema.looseObject({
100
+ rows: schema.array(pageObservationSchema.client),
101
+ total: schema.number().int().nonnegative(),
102
+ pagination: schema.looseObject({
103
+ limit: schema.number().int().positive(),
104
+ offset: schema.number().int().nonnegative(),
105
+ hasMore: schema.boolean(),
106
+ }),
107
+ }),
108
+ performance: schema.looseObject({
109
+ lighthouse: pageLighthouseSchema.client.nullable(),
110
+ }),
111
+ search: schema.looseObject({
112
+ keywords: schema.array(pageRankingKeywordSchema.client),
113
+ }),
114
+ });
115
+ export const pageInspectResponseSchema = defineSuccessEnvelope(pageInspectDataSchema);
116
+ export const pageScanItemSchema = defineResponseObject({
117
+ scanId: schema.string().min(1),
118
+ pageId: schema.string().min(1),
119
+ url: schema.string().url(),
120
+ strategy: schema.enum(['mobile', 'desktop']),
121
+ }, {
122
+ scanId: schema.string().min(1),
123
+ pageId: schema.string().min(1),
124
+ url: schema.string().url(),
125
+ strategy: schema.enum(['mobile', 'desktop']),
126
+ });
127
+ export const pageScanDataSchema = defineResponseObject({
128
+ pageId: schema.string().min(1),
129
+ pageCreated: schema.boolean(),
130
+ scanId: schema.string().min(1),
131
+ status: schema.literal('running'),
132
+ scans: schema.array(pageScanItemSchema.producer),
133
+ }, {
134
+ pageId: schema.string().min(1),
135
+ pageCreated: schema.boolean(),
136
+ scanId: schema.string().min(1),
137
+ status: schema.literal('running'),
138
+ scans: schema.array(pageScanItemSchema.client),
139
+ });
140
+ export const pageScanResponseSchema = defineSuccessEnvelope(pageScanDataSchema);
141
+ export const pageInspectOperation = defineOperation({
142
+ id: 'page.inspect',
143
+ method: 'GET',
144
+ path: '/api/v1/sites/{siteId}/pages/inspect',
145
+ visibility: 'public',
146
+ semantics: { kind: 'query', sideEffects: 'none', retry: 'idempotent', readConsistency: 'primary' },
147
+ auth: {
148
+ credentials: ['session', 'api_token'],
149
+ scopes: ['page:read'],
150
+ minimumRole: 'viewer',
151
+ ownership: 'site',
152
+ },
153
+ request: { params: pageSiteParamsSchema, query: pageInspectQuerySchema, headers: null, body: null },
154
+ responses: { 200: pageInspectResponseSchema },
155
+ errors: [
156
+ 'invalid_request',
157
+ 'unauthorized',
158
+ 'auth_expired',
159
+ 'forbidden',
160
+ 'not_found',
161
+ 'rate_limited',
162
+ 'contract_violation',
163
+ 'internal_error',
164
+ ],
165
+ errorResponse: publicV1ErrorEnvelope,
166
+ resources: {
167
+ reads: [{ type: 'site.page', idFrom: 'params.siteId' }],
168
+ changes: [],
169
+ },
170
+ policy: {
171
+ rate: publicV1StandardRatePolicy,
172
+ idempotency: { _tag: 'none' },
173
+ entitlement: null,
174
+ meter: null,
175
+ },
176
+ lifecycle: { introduced: '1.0.0' },
177
+ docs: {
178
+ summary: 'Inspect a Page',
179
+ description: 'Returns the current stored crawl, indexing, Lighthouse, and tracked ranking observations for one Page on the Site origin.',
180
+ tags: ['Pages'],
181
+ examples: [{
182
+ request: {
183
+ params: { siteId: 'site_01JXYZ' },
184
+ query: { url: 'https://example.com/guide', includeResolved: '0', limit: 100, offset: 0 },
185
+ },
186
+ response: {
187
+ status: 200,
188
+ body: {
189
+ data: {
190
+ page: { url: 'https://example.com/guide', path: '/guide' },
191
+ observations: {
192
+ rows: [],
193
+ total: 0,
194
+ pagination: { limit: 100, offset: 0, hasMore: false },
195
+ },
196
+ performance: { lighthouse: null },
197
+ search: { keywords: [] },
198
+ },
199
+ meta: { requestId: 'req_01JXYZ', version: '1.0' },
200
+ },
201
+ },
202
+ }],
203
+ },
204
+ });
205
+ export const pageScanOperation = defineOperation({
206
+ id: 'page.scan',
207
+ method: 'POST',
208
+ path: '/api/v1/sites/{siteId}/pages/scan',
209
+ visibility: 'public',
210
+ semantics: { kind: 'mutation', sideEffects: 'state', retry: 'never', readConsistency: null },
211
+ auth: {
212
+ credentials: ['session', 'api_token'],
213
+ scopes: ['page:write'],
214
+ minimumRole: 'member',
215
+ ownership: 'site',
216
+ },
217
+ request: { params: pageSiteParamsSchema, query: null, headers: null, body: pageScanBodySchema },
218
+ responses: { 202: pageScanResponseSchema },
219
+ errors: [
220
+ 'invalid_request',
221
+ 'unauthorized',
222
+ 'auth_expired',
223
+ 'forbidden',
224
+ 'entitlement_required',
225
+ 'quota_exhausted',
226
+ 'conflict',
227
+ 'rate_limited',
228
+ 'contract_violation',
229
+ 'internal_error',
230
+ ],
231
+ errorResponse: publicV1ErrorEnvelope,
232
+ resources: {
233
+ reads: [{ type: 'site.page', idFrom: 'params.siteId' }],
234
+ changes: [{ type: 'site.page', idFrom: 'params.siteId' }],
235
+ },
236
+ policy: {
237
+ rate: publicV1StandardRatePolicy,
238
+ idempotency: { _tag: 'none' },
239
+ entitlement: 'growth',
240
+ meter: { key: 'lighthouse', units: 2, charge: 'live-only' },
241
+ },
242
+ lifecycle: { introduced: '1.0.0' },
243
+ docs: {
244
+ summary: 'Scan a Page',
245
+ description: 'Ensures one Page is monitored and starts its mobile and desktop Lighthouse scans. This mutation is deliberately non-retryable because it can create monitoring and scan records.',
246
+ tags: ['Pages'],
247
+ examples: [{
248
+ request: {
249
+ params: { siteId: 'site_01JXYZ' },
250
+ body: { url: 'https://example.com/guide' },
251
+ },
252
+ response: {
253
+ status: 202,
254
+ body: {
255
+ data: {
256
+ pageId: 'page_01JXYZ',
257
+ pageCreated: true,
258
+ scanId: 'scan_mobile_01JXYZ',
259
+ status: 'running',
260
+ scans: [
261
+ {
262
+ scanId: 'scan_mobile_01JXYZ',
263
+ pageId: 'page_01JXYZ',
264
+ url: 'https://example.com/guide',
265
+ strategy: 'mobile',
266
+ },
267
+ {
268
+ scanId: 'scan_desktop_01JXYZ',
269
+ pageId: 'page_01JXYZ',
270
+ url: 'https://example.com/guide',
271
+ strategy: 'desktop',
272
+ },
273
+ ],
274
+ },
275
+ meta: { requestId: 'req_01JXYZ', version: '1.0' },
276
+ },
277
+ },
278
+ }],
279
+ },
280
+ });
281
+ export const pagesV1Registry = defineRegistry({
282
+ feature: 'page',
283
+ operations: {
284
+ inspect: pageInspectOperation,
285
+ scan: pageScanOperation,
286
+ },
287
+ });