@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,460 @@
1
+ import { z as schema } from 'zod';
2
+ import { defineOperation, defineRegistry, defineResponseObject, defineSuccessEnvelope, publicV1ErrorEnvelope, publicV1StandardRatePolicy, } from './core.js';
3
+ export const actionSiteParamsSchema = schema.strictObject({
4
+ siteId: schema.string().min(1),
5
+ });
6
+ export const actionParamsSchema = schema.strictObject({
7
+ siteId: schema.string().min(1),
8
+ actionId: schema.string().min(1),
9
+ });
10
+ export const actionListQuerySchema = schema.strictObject({
11
+ limit: schema.coerce.number().int().min(1).max(25).default(10),
12
+ offset: schema.coerce.number().int().min(0).default(0),
13
+ });
14
+ export const actionShowQuerySchema = schema.strictObject({
15
+ groupId: schema.string().min(1).optional(),
16
+ cursor: schema.string().min(1).optional(),
17
+ limit: schema.coerce.number().int().min(1).max(100).default(50),
18
+ });
19
+ export const actionResolveBodySchema = schema.strictObject({
20
+ artifactVersion: schema.string().min(1),
21
+ });
22
+ export const actionSubjectSchema = defineResponseObject({
23
+ kind: schema.string().min(1),
24
+ label: schema.string().min(1),
25
+ url: schema.string().optional(),
26
+ }, {
27
+ kind: schema.string().min(1),
28
+ label: schema.string().min(1),
29
+ url: schema.string().optional(),
30
+ });
31
+ export const actionSourceSchema = defineResponseObject({ label: schema.string().min(1), url: schema.string().url() }, { label: schema.string().min(1), url: schema.string().url() });
32
+ export const actionEvidenceSummarySchema = defineResponseObject({
33
+ artifactVersion: schema.string().min(1).nullable(),
34
+ coverage: schema.enum(['complete', 'partial', 'count-only', 'unknown', 'unavailable']),
35
+ primaryKnownTotal: schema.number().int().nonnegative().nullable(),
36
+ knownTotal: schema.number().int().nonnegative(),
37
+ reportedTotal: schema.number().int().nonnegative().nullable(),
38
+ groupCount: schema.number().int().nonnegative(),
39
+ observedAt: schema.string().datetime().nullable(),
40
+ asOf: schema.string().datetime().nullable(),
41
+ }, {
42
+ artifactVersion: schema.string().min(1).nullable(),
43
+ coverage: schema.enum(['complete', 'partial', 'count-only', 'unknown', 'unavailable']),
44
+ primaryKnownTotal: schema.number().int().nonnegative().nullable(),
45
+ knownTotal: schema.number().int().nonnegative(),
46
+ reportedTotal: schema.number().int().nonnegative().nullable(),
47
+ groupCount: schema.number().int().nonnegative(),
48
+ observedAt: schema.string().datetime().nullable(),
49
+ asOf: schema.string().datetime().nullable(),
50
+ });
51
+ export const actionListItemSchema = defineResponseObject({
52
+ id: schema.string().min(1),
53
+ status: schema.string().min(1),
54
+ diagnosis: schema.string().min(1),
55
+ subject: actionSubjectSchema.producer.nullable(),
56
+ source: actionSourceSchema.producer.nullable(),
57
+ authoredBy: schema.enum(['detector', 'agent']),
58
+ findingType: schema.string().min(1),
59
+ workLocation: schema.enum(['code', 'infra', 'off-site']),
60
+ effort: schema.enum(['S', 'M', 'L']),
61
+ affectedPages: schema.number().int().nonnegative().nullable(),
62
+ evidence: actionEvidenceSummarySchema.producer,
63
+ firstSeenAt: schema.string().datetime().nullable(),
64
+ relatedActionIds: schema.array(schema.string().min(1)),
65
+ resolution: schema.strictObject({
66
+ artifactVersion: schema.string().min(1),
67
+ evidenceScope: schema.enum(['complete', 'partial', 'count-only', 'unknown']),
68
+ }).nullable(),
69
+ }, {
70
+ id: schema.string().min(1),
71
+ status: schema.string().min(1),
72
+ diagnosis: schema.string().min(1),
73
+ subject: actionSubjectSchema.client.nullable(),
74
+ source: actionSourceSchema.client.nullable(),
75
+ authoredBy: schema.enum(['detector', 'agent']),
76
+ findingType: schema.string().min(1),
77
+ workLocation: schema.enum(['code', 'infra', 'off-site']),
78
+ effort: schema.enum(['S', 'M', 'L']),
79
+ affectedPages: schema.number().int().nonnegative().nullable(),
80
+ evidence: actionEvidenceSummarySchema.client,
81
+ firstSeenAt: schema.string().datetime().nullable(),
82
+ relatedActionIds: schema.array(schema.string().min(1)),
83
+ resolution: schema.looseObject({
84
+ artifactVersion: schema.string().min(1),
85
+ evidenceScope: schema.enum(['complete', 'partial', 'count-only', 'unknown']),
86
+ }).nullable(),
87
+ });
88
+ export const actionListDataSchema = defineResponseObject({
89
+ actions: schema.array(actionListItemSchema.producer),
90
+ page: schema.strictObject({
91
+ total: schema.number().int().nonnegative(),
92
+ limit: schema.number().int().nonnegative(),
93
+ offset: schema.number().int().nonnegative(),
94
+ hasMore: schema.boolean(),
95
+ }),
96
+ listedAsOf: schema.string().datetime(),
97
+ }, {
98
+ actions: schema.array(actionListItemSchema.client),
99
+ page: schema.looseObject({
100
+ total: schema.number().int().nonnegative(),
101
+ limit: schema.number().int().nonnegative(),
102
+ offset: schema.number().int().nonnegative(),
103
+ hasMore: schema.boolean(),
104
+ }),
105
+ listedAsOf: schema.string().datetime(),
106
+ });
107
+ export const actionListResponseSchema = defineSuccessEnvelope(actionListDataSchema);
108
+ export const actionEvidenceCoverageSchema = schema.discriminatedUnion('_tag', [
109
+ schema.strictObject({ _tag: schema.literal('complete'), knownTotal: schema.number().int().nonnegative() }),
110
+ schema.strictObject({
111
+ _tag: schema.literal('partial'),
112
+ reportedTotal: schema.number().int().nonnegative(),
113
+ knownTotal: schema.number().int().nonnegative(),
114
+ limitation: schema.string().min(1),
115
+ }),
116
+ schema.strictObject({
117
+ _tag: schema.literal('count-only'),
118
+ reportedTotal: schema.number().int().nonnegative(),
119
+ limitation: schema.string().min(1),
120
+ }),
121
+ schema.strictObject({
122
+ _tag: schema.literal('unknown'),
123
+ knownTotal: schema.number().int().nonnegative(),
124
+ limitation: schema.string().min(1),
125
+ }),
126
+ schema.strictObject({ _tag: schema.literal('unavailable'), limitation: schema.string().min(1) }),
127
+ ]);
128
+ export const actionEvidenceCoverageClientSchema = schema.discriminatedUnion('_tag', [
129
+ schema.looseObject({ _tag: schema.literal('complete'), knownTotal: schema.number().int().nonnegative() }),
130
+ schema.looseObject({
131
+ _tag: schema.literal('partial'),
132
+ reportedTotal: schema.number().int().nonnegative(),
133
+ knownTotal: schema.number().int().nonnegative(),
134
+ limitation: schema.string().min(1),
135
+ }),
136
+ schema.looseObject({
137
+ _tag: schema.literal('count-only'),
138
+ reportedTotal: schema.number().int().nonnegative(),
139
+ limitation: schema.string().min(1),
140
+ }),
141
+ schema.looseObject({
142
+ _tag: schema.literal('unknown'),
143
+ knownTotal: schema.number().int().nonnegative(),
144
+ limitation: schema.string().min(1),
145
+ }),
146
+ schema.looseObject({ _tag: schema.literal('unavailable'), limitation: schema.string().min(1) }),
147
+ ]);
148
+ export const actionEvidenceItemSchema = schema.discriminatedUnion('_tag', [
149
+ schema.strictObject({
150
+ _tag: schema.literal('page-status'),
151
+ id: schema.string().min(1),
152
+ url: schema.string().url(),
153
+ status: schema.number().int(),
154
+ }),
155
+ schema.strictObject({
156
+ _tag: schema.literal('link-edge'),
157
+ id: schema.string().min(1),
158
+ sourceUrl: schema.string().url(),
159
+ targetUrl: schema.string().url(),
160
+ targetStatus: schema.number().int().nullable(),
161
+ }),
162
+ schema.strictObject({
163
+ _tag: schema.literal('provider-page'),
164
+ id: schema.string().min(1),
165
+ url: schema.string().url(),
166
+ reason: schema.string().min(1),
167
+ observedAt: schema.string().datetime().nullable(),
168
+ }),
169
+ schema.strictObject({
170
+ _tag: schema.literal('page'),
171
+ id: schema.string().min(1),
172
+ url: schema.string().url(),
173
+ detail: schema.string().nullable(),
174
+ }),
175
+ ]);
176
+ export const actionEvidenceItemClientSchema = schema.discriminatedUnion('_tag', [
177
+ schema.looseObject({
178
+ _tag: schema.literal('page-status'),
179
+ id: schema.string().min(1),
180
+ url: schema.string().url(),
181
+ status: schema.number().int(),
182
+ }),
183
+ schema.looseObject({
184
+ _tag: schema.literal('link-edge'),
185
+ id: schema.string().min(1),
186
+ sourceUrl: schema.string().url(),
187
+ targetUrl: schema.string().url(),
188
+ targetStatus: schema.number().int().nullable(),
189
+ }),
190
+ schema.looseObject({
191
+ _tag: schema.literal('provider-page'),
192
+ id: schema.string().min(1),
193
+ url: schema.string().url(),
194
+ reason: schema.string().min(1),
195
+ observedAt: schema.string().datetime().nullable(),
196
+ }),
197
+ schema.looseObject({
198
+ _tag: schema.literal('page'),
199
+ id: schema.string().min(1),
200
+ url: schema.string().url(),
201
+ detail: schema.string().nullable(),
202
+ }),
203
+ ]);
204
+ export const actionVerifierSchema = schema.discriminatedUnion('_tag', [
205
+ schema.strictObject({ _tag: schema.literal('target-healthy'), url: schema.string().url() }),
206
+ schema.strictObject({ _tag: schema.literal('finding-cleared'), findingType: schema.string().min(1) }),
207
+ schema.strictObject({ _tag: schema.literal('metric'), metric: schema.string().min(1) }),
208
+ schema.strictObject({ _tag: schema.literal('user-attested') }),
209
+ ]);
210
+ export const actionVerifierClientSchema = schema.discriminatedUnion('_tag', [
211
+ schema.looseObject({ _tag: schema.literal('target-healthy'), url: schema.string().url() }),
212
+ schema.looseObject({ _tag: schema.literal('finding-cleared'), findingType: schema.string().min(1) }),
213
+ schema.looseObject({ _tag: schema.literal('metric'), metric: schema.string().min(1) }),
214
+ schema.looseObject({ _tag: schema.literal('user-attested') }),
215
+ ]);
216
+ export const actionEvidenceGroupSchema = defineResponseObject({
217
+ id: schema.string().min(1),
218
+ relation: schema.string().min(1),
219
+ source: schema.strictObject({
220
+ kind: schema.string().min(1),
221
+ generationId: schema.string().min(1).nullable(),
222
+ observedAt: schema.string().datetime().nullable(),
223
+ collectedAt: schema.string().datetime(),
224
+ }),
225
+ coverage: actionEvidenceCoverageSchema,
226
+ items: schema.array(actionEvidenceItemSchema),
227
+ nextCursor: schema.string().nullable(),
228
+ }, {
229
+ id: schema.string().min(1),
230
+ relation: schema.string().min(1),
231
+ source: schema.looseObject({
232
+ kind: schema.string().min(1),
233
+ generationId: schema.string().min(1).nullable(),
234
+ observedAt: schema.string().datetime().nullable(),
235
+ collectedAt: schema.string().datetime(),
236
+ }),
237
+ coverage: actionEvidenceCoverageClientSchema,
238
+ items: schema.array(actionEvidenceItemClientSchema),
239
+ nextCursor: schema.string().nullable(),
240
+ });
241
+ export const actionShowDataSchema = defineResponseObject({
242
+ id: schema.string().min(1),
243
+ status: schema.string().min(1),
244
+ findingType: schema.string().min(1),
245
+ artifactVersion: schema.string().min(1),
246
+ assessmentId: schema.string().min(1),
247
+ asOf: schema.string().datetime(),
248
+ diagnosis: schema.string().min(1),
249
+ action: schema.string().min(1),
250
+ verifier: actionVerifierSchema,
251
+ materiality: schema.strictObject({
252
+ affectedSubjects: schema.number().int().nonnegative(),
253
+ internalReferrers: schema.number().int().nonnegative(),
254
+ }),
255
+ evidenceGroups: schema.array(actionEvidenceGroupSchema.producer),
256
+ }, {
257
+ id: schema.string().min(1),
258
+ status: schema.string().min(1),
259
+ findingType: schema.string().min(1),
260
+ artifactVersion: schema.string().min(1),
261
+ assessmentId: schema.string().min(1),
262
+ asOf: schema.string().datetime(),
263
+ diagnosis: schema.string().min(1),
264
+ action: schema.string().min(1),
265
+ verifier: actionVerifierClientSchema,
266
+ materiality: schema.looseObject({
267
+ affectedSubjects: schema.number().int().nonnegative(),
268
+ internalReferrers: schema.number().int().nonnegative(),
269
+ }),
270
+ evidenceGroups: schema.array(actionEvidenceGroupSchema.client),
271
+ });
272
+ export const actionShowResponseSchema = defineSuccessEnvelope(actionShowDataSchema);
273
+ export const actionResolveDataSchema = defineResponseObject({
274
+ actionId: schema.string().min(1),
275
+ status: schema.string().min(1),
276
+ verification: schema.enum(['recheck-queued', 'scan-queued', 'next-assessment', 'metric-watch', 'user-resolved']),
277
+ }, {
278
+ actionId: schema.string().min(1),
279
+ status: schema.string().min(1),
280
+ verification: schema.enum(['recheck-queued', 'scan-queued', 'next-assessment', 'metric-watch', 'user-resolved']),
281
+ });
282
+ export const actionResolveResponseSchema = defineSuccessEnvelope(actionResolveDataSchema);
283
+ const actionReadSemantics = {
284
+ kind: 'query',
285
+ sideEffects: 'none',
286
+ retry: 'idempotent',
287
+ readConsistency: 'primary',
288
+ };
289
+ const actionReadAuth = {
290
+ credentials: ['session', 'api_token'],
291
+ scopes: ['actions:read'],
292
+ minimumRole: 'viewer',
293
+ ownership: 'site',
294
+ };
295
+ const actionReadErrors = [
296
+ 'invalid_request',
297
+ 'unauthorized',
298
+ 'auth_expired',
299
+ 'forbidden',
300
+ 'entitlement_required',
301
+ 'not_found',
302
+ 'conflict',
303
+ 'stale_evidence',
304
+ 'rate_limited',
305
+ 'provider_unavailable',
306
+ 'contract_violation',
307
+ 'internal_error',
308
+ ];
309
+ const actionReadResources = {
310
+ reads: [{ type: 'site.actions', idFrom: 'params.siteId' }],
311
+ changes: [],
312
+ };
313
+ const actionReadPolicy = {
314
+ rate: publicV1StandardRatePolicy,
315
+ idempotency: { _tag: 'none' },
316
+ entitlement: null,
317
+ meter: null,
318
+ };
319
+ export const actionListOperation = defineOperation({
320
+ id: 'actions.list',
321
+ method: 'GET',
322
+ path: '/api/v1/sites/{siteId}/actions',
323
+ visibility: 'public',
324
+ semantics: actionReadSemantics,
325
+ auth: actionReadAuth,
326
+ request: { params: actionSiteParamsSchema, query: actionListQuerySchema, headers: null, body: null },
327
+ responses: { 200: actionListResponseSchema },
328
+ errors: actionReadErrors,
329
+ errorResponse: publicV1ErrorEnvelope,
330
+ resources: actionReadResources,
331
+ policy: actionReadPolicy,
332
+ lifecycle: { introduced: '1.0.0' },
333
+ docs: {
334
+ summary: 'List next actions',
335
+ description: 'Returns the ranked open work for one site with stable evidence and resolution handles. Advisory movement signals remain separate from actionable work.',
336
+ tags: ['Actions'],
337
+ examples: [{
338
+ request: { params: { siteId: 'site_01JXYZ' }, query: { limit: 10, offset: 0 } },
339
+ response: {
340
+ status: 200,
341
+ body: {
342
+ data: {
343
+ actions: [],
344
+ page: { total: 0, limit: 0, offset: 0, hasMore: false },
345
+ listedAsOf: '2026-08-10T01:30:00.000Z',
346
+ },
347
+ meta: { requestId: 'req_01JXYZ', version: '1.0' },
348
+ },
349
+ },
350
+ }],
351
+ },
352
+ });
353
+ export const actionShowOperation = defineOperation({
354
+ id: 'actions.show',
355
+ method: 'GET',
356
+ path: '/api/v1/sites/{siteId}/actions/{actionId}',
357
+ visibility: 'public',
358
+ semantics: actionReadSemantics,
359
+ auth: actionReadAuth,
360
+ request: { params: actionParamsSchema, query: actionShowQuerySchema, headers: null, body: null },
361
+ responses: { 200: actionShowResponseSchema },
362
+ errors: actionReadErrors,
363
+ errorResponse: publicV1ErrorEnvelope,
364
+ resources: actionReadResources,
365
+ policy: actionReadPolicy,
366
+ lifecycle: { introduced: '1.0.0' },
367
+ docs: {
368
+ summary: 'Inspect an action',
369
+ description: 'Reads the versioned evidence reviewed before resolving an action. Evidence group cursors are bound to the artifact version.',
370
+ tags: ['Actions'],
371
+ examples: [{
372
+ request: { params: { siteId: 'site_01JXYZ', actionId: 'ticket_01JXYZ' }, query: { limit: 50 } },
373
+ response: {
374
+ status: 200,
375
+ body: {
376
+ data: {
377
+ id: 'ticket_01JXYZ',
378
+ status: 'open',
379
+ findingType: 'broken-pages',
380
+ artifactVersion: 'te2:ticket_01JXYZ:scope',
381
+ assessmentId: 'assessment_01JXYZ',
382
+ asOf: '2026-08-10T01:30:00.000Z',
383
+ diagnosis: 'One page returns HTTP 404.',
384
+ action: 'Restore or redirect the page.',
385
+ verifier: { _tag: 'finding-cleared', findingType: 'broken-pages' },
386
+ materiality: { affectedSubjects: 1, internalReferrers: 2 },
387
+ evidenceGroups: [],
388
+ },
389
+ meta: { requestId: 'req_01JXYZ', version: '1.0' },
390
+ },
391
+ },
392
+ }],
393
+ },
394
+ });
395
+ export const actionResolveOperation = defineOperation({
396
+ id: 'actions.resolve',
397
+ method: 'POST',
398
+ path: '/api/v1/sites/{siteId}/actions/{actionId}/resolve',
399
+ visibility: 'public',
400
+ semantics: { kind: 'mutation', sideEffects: 'state', retry: 'never', readConsistency: null },
401
+ auth: {
402
+ credentials: ['session', 'api_token'],
403
+ scopes: ['actions:write'],
404
+ minimumRole: 'member',
405
+ ownership: 'site',
406
+ },
407
+ request: { params: actionParamsSchema, query: null, headers: null, body: actionResolveBodySchema },
408
+ responses: { 200: actionResolveResponseSchema },
409
+ errors: [
410
+ 'invalid_request',
411
+ 'unauthorized',
412
+ 'auth_expired',
413
+ 'forbidden',
414
+ 'entitlement_required',
415
+ 'not_found',
416
+ 'stale_evidence',
417
+ 'conflict',
418
+ 'rate_limited',
419
+ 'contract_violation',
420
+ 'internal_error',
421
+ ],
422
+ errorResponse: publicV1ErrorEnvelope,
423
+ resources: {
424
+ reads: [{ type: 'site.actions', idFrom: 'params.siteId' }],
425
+ changes: [{ type: 'site.actions', idFrom: 'params.siteId' }],
426
+ },
427
+ policy: {
428
+ rate: publicV1StandardRatePolicy,
429
+ idempotency: { _tag: 'none' },
430
+ entitlement: null,
431
+ meter: null,
432
+ },
433
+ lifecycle: { introduced: '1.0.0' },
434
+ docs: {
435
+ summary: 'Resolve an action',
436
+ description: 'Claims a reviewed action against its exact evidence artifact and starts the authoritative verification path. This mutation is deliberately non-retryable because it writes claim clocks and events.',
437
+ tags: ['Actions'],
438
+ examples: [{
439
+ request: {
440
+ params: { siteId: 'site_01JXYZ', actionId: 'ticket_01JXYZ' },
441
+ body: { artifactVersion: 'te2:ticket_01JXYZ:scope' },
442
+ },
443
+ response: {
444
+ status: 200,
445
+ body: {
446
+ data: { actionId: 'ticket_01JXYZ', status: 'open', verification: 'recheck-queued' },
447
+ meta: { requestId: 'req_01JXYZ', version: '1.0' },
448
+ },
449
+ },
450
+ }],
451
+ },
452
+ });
453
+ export const actionsV1Registry = defineRegistry({
454
+ feature: 'actions',
455
+ operations: {
456
+ list: actionListOperation,
457
+ show: actionShowOperation,
458
+ resolve: actionResolveOperation,
459
+ },
460
+ });