@nuxtseo/protocol 0.2.1 → 0.3.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.
@@ -1,5 +1,5 @@
1
1
  import { z as schema } from 'zod';
2
- import { defineOperation, defineRegistry, defineResponseObject, defineSuccessEnvelope, publicV1BooleanFlag, publicV1ErrorEnvelope, publicV1StandardRatePolicy, } from './core.js';
2
+ import { defineOperation, defineRegistry, defineResponseObject, defineSuccessEnvelope, publicV1BooleanFlag, publicV1ErrorEnvelope, publicV1PageSchema, publicV1StandardRatePolicy, } from './core.js';
3
3
  export const backlinksSiteParamsSchema = schema.strictObject({
4
4
  siteId: schema.string().min(1),
5
5
  });
@@ -38,12 +38,19 @@ export const recoverableBacklinkSchema = defineResponseObject({
38
38
  lastSeenAt: schema.string().datetime().nullable(),
39
39
  });
40
40
  export const recoverableBacklinksDataSchema = defineResponseObject({
41
+ /**
42
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
43
+ */
41
44
  items: schema.array(recoverableBacklinkSchema.producer),
45
+ rows: schema.array(recoverableBacklinkSchema.producer),
46
+ page: publicV1PageSchema.producer,
42
47
  total: schema.number().int().nonnegative(),
43
48
  limit: schema.number().int().positive(),
44
49
  offset: schema.number().int().nonnegative(),
45
50
  }, {
46
51
  items: schema.array(recoverableBacklinkSchema.client),
52
+ rows: schema.array(recoverableBacklinkSchema.client).optional(),
53
+ page: publicV1PageSchema.client.optional(),
47
54
  total: schema.number().int().nonnegative(),
48
55
  limit: schema.number().int().positive(),
49
56
  offset: schema.number().int().nonnegative(),
@@ -108,6 +115,20 @@ export const recoverableBacklinksOperation = defineOperation({
108
115
  firstSeenAt: '2026-02-09T20:43:50.000Z',
109
116
  lastSeenAt: '2026-07-17T04:40:07.000Z',
110
117
  }],
118
+ rows: [{
119
+ id: 'bl_01JXYZ',
120
+ destinationUrl: 'https://example.com/docs/utils',
121
+ referringUrl: 'https://news.example/posts/seo',
122
+ referringDomain: 'news.example',
123
+ anchor: 'Read the full documentation',
124
+ destinationStatus: 404,
125
+ domainRank: 529,
126
+ pageRank: 55,
127
+ dofollow: true,
128
+ firstSeenAt: '2026-02-09T20:43:50.000Z',
129
+ lastSeenAt: '2026-07-17T04:40:07.000Z',
130
+ }],
131
+ page: { total: 1, limit: 100, offset: 0, hasMore: false },
111
132
  total: 1,
112
133
  limit: 100,
113
134
  offset: 0,
@@ -150,10 +171,23 @@ export const mentionSchema = defineResponseObject({
150
171
  publishedAt: schema.string().datetime().nullable(),
151
172
  });
152
173
  export const mentionsDataSchema = defineResponseObject({
174
+ /**
175
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
176
+ */
153
177
  items: schema.array(mentionSchema.producer),
178
+ rows: schema.array(mentionSchema.producer),
179
+ page: publicV1PageSchema.producer,
180
+ /**
181
+ * The whole result set, not this page. The response carried no total and no
182
+ * `hasMore`, so a caller could not tell a full page from the last page.
183
+ */
184
+ total: schema.number().int().nonnegative(),
154
185
  limit: schema.number().int().positive(),
155
186
  }, {
156
187
  items: schema.array(mentionSchema.client),
188
+ rows: schema.array(mentionSchema.client).optional(),
189
+ page: publicV1PageSchema.client.optional(),
190
+ total: schema.number().int().nonnegative().optional(),
157
191
  limit: schema.number().int().positive(),
158
192
  });
159
193
  export const mentionsResponseSchema = defineSuccessEnvelope(mentionsDataSchema);
@@ -217,6 +251,22 @@ export const mentionsListOperation = defineOperation({
217
251
  domainRank: 812,
218
252
  publishedAt: '2026-08-01T09:12:00.000Z',
219
253
  }],
254
+ rows: [{
255
+ id: 'mn_01JXYZ',
256
+ source: 'hackernews',
257
+ url: 'https://news.ycombinator.com/item?id=1',
258
+ domain: 'news.ycombinator.com',
259
+ title: 'Show HN: a sitemap module',
260
+ snippet: 'We moved to example.com last week',
261
+ author: 'Ada Lovelace',
262
+ authorHandle: 'ada',
263
+ engagement: 142,
264
+ sentiment: 'positive',
265
+ domainRank: 812,
266
+ publishedAt: '2026-08-01T09:12:00.000Z',
267
+ }],
268
+ page: { total: 1, limit: 100, offset: 0, hasMore: false },
269
+ total: 1,
220
270
  limit: 100,
221
271
  },
222
272
  meta: { requestId: 'req_01JXYZ', version: '1.0' },
@@ -442,6 +442,9 @@ export declare const contentBriefResourceSchema: import("./core.js").CompatibleR
442
442
  readonly markedWrittenAt: z.ZodNullable<z.ZodISODateTime>;
443
443
  }, z.core.$strip>>;
444
444
  export declare const contentBriefListDataSchema: import("./core.js").CompatibleResponseSchema<z.ZodObject<{
445
+ /**
446
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
447
+ */
445
448
  readonly briefs: z.ZodArray<z.ZodObject<{
446
449
  id: z.ZodString;
447
450
  siteId: z.ZodString;
@@ -461,6 +464,25 @@ export declare const contentBriefListDataSchema: import("./core.js").CompatibleR
461
464
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
462
465
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
463
466
  }, z.core.$strip>>;
467
+ readonly rows: z.ZodArray<z.ZodObject<{
468
+ id: z.ZodString;
469
+ siteId: z.ZodString;
470
+ keyword: z.ZodString;
471
+ status: z.ZodEnum<{
472
+ archived: "archived";
473
+ failed: "failed";
474
+ published: "published";
475
+ queued: "queued";
476
+ ready: "ready";
477
+ researching: "researching";
478
+ stale: "stale";
479
+ written: "written";
480
+ }>;
481
+ error: z.ZodNullable<z.ZodString>;
482
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
483
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
484
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
485
+ }, z.core.$strip>>;
464
486
  readonly page: z.ZodObject<{
465
487
  total: z.ZodNumber;
466
488
  limit: z.ZodNumber;
@@ -487,6 +509,25 @@ export declare const contentBriefListDataSchema: import("./core.js").CompatibleR
487
509
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
488
510
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
489
511
  }, z.core.$strip>>;
512
+ readonly rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
513
+ id: z.ZodString;
514
+ siteId: z.ZodString;
515
+ keyword: z.ZodString;
516
+ status: z.ZodEnum<{
517
+ archived: "archived";
518
+ failed: "failed";
519
+ published: "published";
520
+ queued: "queued";
521
+ ready: "ready";
522
+ researching: "researching";
523
+ stale: "stale";
524
+ written: "written";
525
+ }>;
526
+ error: z.ZodNullable<z.ZodString>;
527
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
528
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
529
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
530
+ }, z.core.$strip>>>;
490
531
  readonly page: z.ZodObject<{
491
532
  total: z.ZodNumber;
492
533
  limit: z.ZodNumber;
@@ -651,6 +692,9 @@ export declare const contentBriefCreateDataSchema: import("./core.js").Compatibl
651
692
  }, z.core.$strip>>;
652
693
  export declare const contentBriefListResponseSchema: import("./core.js").CompatibleResponseSchema<z.ZodObject<{
653
694
  data: z.ZodObject<{
695
+ /**
696
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
697
+ */
654
698
  readonly briefs: z.ZodArray<z.ZodObject<{
655
699
  id: z.ZodString;
656
700
  siteId: z.ZodString;
@@ -670,6 +714,25 @@ export declare const contentBriefListResponseSchema: import("./core.js").Compati
670
714
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
671
715
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
672
716
  }, z.core.$strip>>;
717
+ readonly rows: z.ZodArray<z.ZodObject<{
718
+ id: z.ZodString;
719
+ siteId: z.ZodString;
720
+ keyword: z.ZodString;
721
+ status: z.ZodEnum<{
722
+ archived: "archived";
723
+ failed: "failed";
724
+ published: "published";
725
+ queued: "queued";
726
+ ready: "ready";
727
+ researching: "researching";
728
+ stale: "stale";
729
+ written: "written";
730
+ }>;
731
+ error: z.ZodNullable<z.ZodString>;
732
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
733
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
734
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
735
+ }, z.core.$strip>>;
673
736
  readonly page: z.ZodObject<{
674
737
  total: z.ZodNumber;
675
738
  limit: z.ZodNumber;
@@ -702,6 +765,25 @@ export declare const contentBriefListResponseSchema: import("./core.js").Compati
702
765
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
703
766
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
704
767
  }, z.core.$strip>>;
768
+ readonly rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
769
+ id: z.ZodString;
770
+ siteId: z.ZodString;
771
+ keyword: z.ZodString;
772
+ status: z.ZodEnum<{
773
+ archived: "archived";
774
+ failed: "failed";
775
+ published: "published";
776
+ queued: "queued";
777
+ ready: "ready";
778
+ researching: "researching";
779
+ stale: "stale";
780
+ written: "written";
781
+ }>;
782
+ error: z.ZodNullable<z.ZodString>;
783
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
784
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
785
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
786
+ }, z.core.$strip>>>;
705
787
  readonly page: z.ZodObject<{
706
788
  total: z.ZodNumber;
707
789
  limit: z.ZodNumber;
@@ -1096,6 +1178,9 @@ export declare const contentBriefListOperation: {
1096
1178
  readonly responses: {
1097
1179
  readonly 200: import("./core.js").CompatibleResponseSchema<z.ZodObject<{
1098
1180
  data: z.ZodObject<{
1181
+ /**
1182
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
1183
+ */
1099
1184
  readonly briefs: z.ZodArray<z.ZodObject<{
1100
1185
  id: z.ZodString;
1101
1186
  siteId: z.ZodString;
@@ -1115,6 +1200,25 @@ export declare const contentBriefListOperation: {
1115
1200
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1116
1201
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
1117
1202
  }, z.core.$strip>>;
1203
+ readonly rows: z.ZodArray<z.ZodObject<{
1204
+ id: z.ZodString;
1205
+ siteId: z.ZodString;
1206
+ keyword: z.ZodString;
1207
+ status: z.ZodEnum<{
1208
+ archived: "archived";
1209
+ failed: "failed";
1210
+ published: "published";
1211
+ queued: "queued";
1212
+ ready: "ready";
1213
+ researching: "researching";
1214
+ stale: "stale";
1215
+ written: "written";
1216
+ }>;
1217
+ error: z.ZodNullable<z.ZodString>;
1218
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
1219
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1220
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
1221
+ }, z.core.$strip>>;
1118
1222
  readonly page: z.ZodObject<{
1119
1223
  total: z.ZodNumber;
1120
1224
  limit: z.ZodNumber;
@@ -1147,6 +1251,25 @@ export declare const contentBriefListOperation: {
1147
1251
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1148
1252
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
1149
1253
  }, z.core.$strip>>;
1254
+ readonly rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
1255
+ id: z.ZodString;
1256
+ siteId: z.ZodString;
1257
+ keyword: z.ZodString;
1258
+ status: z.ZodEnum<{
1259
+ archived: "archived";
1260
+ failed: "failed";
1261
+ published: "published";
1262
+ queued: "queued";
1263
+ ready: "ready";
1264
+ researching: "researching";
1265
+ stale: "stale";
1266
+ written: "written";
1267
+ }>;
1268
+ error: z.ZodNullable<z.ZodString>;
1269
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
1270
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1271
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
1272
+ }, z.core.$strip>>>;
1150
1273
  readonly page: z.ZodObject<{
1151
1274
  total: z.ZodNumber;
1152
1275
  limit: z.ZodNumber;
@@ -1258,6 +1381,16 @@ export declare const contentBriefListOperation: {
1258
1381
  readonly markedPublishedAt: null;
1259
1382
  readonly updatedAt: '2026-08-10T00:00:00.000Z';
1260
1383
  }];
1384
+ readonly rows: readonly [{
1385
+ readonly id: 'brief_01JXYZ';
1386
+ readonly siteId: 'site_01JXYZ';
1387
+ readonly keyword: 'nuxt seo';
1388
+ readonly status: 'ready';
1389
+ readonly error: null;
1390
+ readonly generatedAt: '2026-08-10T00:00:00.000Z';
1391
+ readonly markedPublishedAt: null;
1392
+ readonly updatedAt: '2026-08-10T00:00:00.000Z';
1393
+ }];
1261
1394
  readonly page: {
1262
1395
  readonly total: 1;
1263
1396
  readonly limit: 25;
@@ -1940,6 +2073,9 @@ export declare const contentV1Registry: import("./core.js").PublicV1Registry<{
1940
2073
  readonly responses: {
1941
2074
  readonly 200: import("./core.js").CompatibleResponseSchema<z.ZodObject<{
1942
2075
  data: z.ZodObject<{
2076
+ /**
2077
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
2078
+ */
1943
2079
  readonly briefs: z.ZodArray<z.ZodObject<{
1944
2080
  id: z.ZodString;
1945
2081
  siteId: z.ZodString;
@@ -1959,6 +2095,25 @@ export declare const contentV1Registry: import("./core.js").PublicV1Registry<{
1959
2095
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1960
2096
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
1961
2097
  }, z.core.$strip>>;
2098
+ readonly rows: z.ZodArray<z.ZodObject<{
2099
+ id: z.ZodString;
2100
+ siteId: z.ZodString;
2101
+ keyword: z.ZodString;
2102
+ status: z.ZodEnum<{
2103
+ archived: "archived";
2104
+ failed: "failed";
2105
+ published: "published";
2106
+ queued: "queued";
2107
+ ready: "ready";
2108
+ researching: "researching";
2109
+ stale: "stale";
2110
+ written: "written";
2111
+ }>;
2112
+ error: z.ZodNullable<z.ZodString>;
2113
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
2114
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
2115
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
2116
+ }, z.core.$strip>>;
1962
2117
  readonly page: z.ZodObject<{
1963
2118
  total: z.ZodNumber;
1964
2119
  limit: z.ZodNumber;
@@ -1991,6 +2146,25 @@ export declare const contentV1Registry: import("./core.js").PublicV1Registry<{
1991
2146
  markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
1992
2147
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
1993
2148
  }, z.core.$strip>>;
2149
+ readonly rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
2150
+ id: z.ZodString;
2151
+ siteId: z.ZodString;
2152
+ keyword: z.ZodString;
2153
+ status: z.ZodEnum<{
2154
+ archived: "archived";
2155
+ failed: "failed";
2156
+ published: "published";
2157
+ queued: "queued";
2158
+ ready: "ready";
2159
+ researching: "researching";
2160
+ stale: "stale";
2161
+ written: "written";
2162
+ }>;
2163
+ error: z.ZodNullable<z.ZodString>;
2164
+ generatedAt: z.ZodNullable<z.ZodISODateTime>;
2165
+ markedPublishedAt: z.ZodNullable<z.ZodISODateTime>;
2166
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
2167
+ }, z.core.$strip>>>;
1994
2168
  readonly page: z.ZodObject<{
1995
2169
  total: z.ZodNumber;
1996
2170
  limit: z.ZodNumber;
@@ -2102,6 +2276,16 @@ export declare const contentV1Registry: import("./core.js").PublicV1Registry<{
2102
2276
  readonly markedPublishedAt: null;
2103
2277
  readonly updatedAt: '2026-08-10T00:00:00.000Z';
2104
2278
  }];
2279
+ readonly rows: readonly [{
2280
+ readonly id: 'brief_01JXYZ';
2281
+ readonly siteId: 'site_01JXYZ';
2282
+ readonly keyword: 'nuxt seo';
2283
+ readonly status: 'ready';
2284
+ readonly error: null;
2285
+ readonly generatedAt: '2026-08-10T00:00:00.000Z';
2286
+ readonly markedPublishedAt: null;
2287
+ readonly updatedAt: '2026-08-10T00:00:00.000Z';
2288
+ }];
2105
2289
  readonly page: {
2106
2290
  readonly total: 1;
2107
2291
  readonly limit: 25;
@@ -123,10 +123,15 @@ const contentBriefPageShape = {
123
123
  };
124
124
  const contentBriefPageSchema = defineResponseObject(contentBriefPageShape);
125
125
  export const contentBriefListDataSchema = defineResponseObject({
126
+ /**
127
+ * Deprecated alias of `rows`. Kept for one minor version, then removed.
128
+ */
126
129
  briefs: schema.array(contentBriefSummarySchema.producer),
130
+ rows: schema.array(contentBriefSummarySchema.producer),
127
131
  page: contentBriefPageSchema.producer,
128
132
  }, {
129
133
  briefs: schema.array(contentBriefSummarySchema.client),
134
+ rows: schema.array(contentBriefSummarySchema.client).optional(),
130
135
  page: contentBriefPageSchema.client,
131
136
  });
132
137
  export const contentBriefCreateDataSchema = defineResponseObject({
@@ -198,6 +203,16 @@ export const contentBriefListOperation = defineOperation({
198
203
  markedPublishedAt: null,
199
204
  updatedAt: '2026-08-10T00:00:00.000Z',
200
205
  }],
206
+ rows: [{
207
+ id: 'brief_01JXYZ',
208
+ siteId: 'site_01JXYZ',
209
+ keyword: 'nuxt seo',
210
+ status: 'ready',
211
+ error: null,
212
+ generatedAt: '2026-08-10T00:00:00.000Z',
213
+ markedPublishedAt: null,
214
+ updatedAt: '2026-08-10T00:00:00.000Z',
215
+ }],
201
216
  page: { total: 1, limit: 25, offset: 0, hasMore: false },
202
217
  },
203
218
  meta: { requestId: 'req_01JXYZ', version: '1.0' },
package/dist/v1/core.d.ts CHANGED
@@ -234,6 +234,55 @@ export declare const publicV1ErrorClientSchema: z.ZodObject<{
234
234
  retryable: z.ZodBoolean;
235
235
  details: z.ZodRecord<z.ZodString, z.ZodUnknown>;
236
236
  }, z.core.$loose>;
237
+ /**
238
+ * One page of a list response.
239
+ *
240
+ * Every list operation answers `data.rows` plus `data.page`. One envelope means
241
+ * a caller reads any list the same way, instead of guessing between `rows`,
242
+ * `items`, `sites`, `actions`, `briefs` and `clusters`.
243
+ *
244
+ * `total` counts the whole result set, not this page. `limit` is the page size
245
+ * the operation applied, and is 0 when the operation returned no page at all.
246
+ * `offset` is the index of the first row in `rows`. `hasMore` states whether a
247
+ * further request returns more rows.
248
+ *
249
+ * A producer must emit `rows` and `page`. A client treats both as optional, so
250
+ * a client newer than the deployed server still parses its answers. Read the
251
+ * domain key when `rows` is absent.
252
+ */
253
+ export declare const publicV1PageSchema: CompatibleResponseSchema<z.ZodObject<{
254
+ readonly total: z.ZodNumber;
255
+ readonly limit: z.ZodNumber;
256
+ readonly offset: z.ZodNumber;
257
+ readonly hasMore: z.ZodBoolean;
258
+ }, z.core.$strip>, z.ZodObject<{
259
+ readonly total: z.ZodNumber;
260
+ readonly limit: z.ZodNumber;
261
+ readonly offset: z.ZodNumber;
262
+ readonly hasMore: z.ZodBoolean;
263
+ }, z.core.$strip>>;
264
+ /**
265
+ * Builds the `page` object of a list response, so every operation derives
266
+ * `hasMore` the same way.
267
+ *
268
+ * `total` counts the whole result set. `rowCount` is the number of rows in this
269
+ * answer. Pass `limit` when a further request can return more rows. If the
270
+ * operation answers one response only, leave `limit` out: `limit` then reports
271
+ * the rows returned and `hasMore` is false, even when a display cap holds fewer
272
+ * rows than `total`. A `hasMore` that no request can act on sends a caller into
273
+ * a paging loop that never ends.
274
+ */
275
+ export declare function publicV1Page(input: {
276
+ total: number;
277
+ rowCount: number;
278
+ limit?: number;
279
+ offset?: number;
280
+ }): {
281
+ total: number;
282
+ limit: number;
283
+ offset: number;
284
+ hasMore: boolean;
285
+ };
237
286
  export declare const publicV1ErrorEnvelope: CompatibleResponseSchema<z.ZodObject<{
238
287
  readonly error: z.ZodObject<{
239
288
  code: z.ZodEnum<{
package/dist/v1/core.js CHANGED
@@ -347,6 +347,45 @@ export const publicV1ErrorClientSchema = z.looseObject({
347
347
  retryable: z.boolean(),
348
348
  details: publicV1ErrorDetailsSchema,
349
349
  });
350
+ /**
351
+ * One page of a list response.
352
+ *
353
+ * Every list operation answers `data.rows` plus `data.page`. One envelope means
354
+ * a caller reads any list the same way, instead of guessing between `rows`,
355
+ * `items`, `sites`, `actions`, `briefs` and `clusters`.
356
+ *
357
+ * `total` counts the whole result set, not this page. `limit` is the page size
358
+ * the operation applied, and is 0 when the operation returned no page at all.
359
+ * `offset` is the index of the first row in `rows`. `hasMore` states whether a
360
+ * further request returns more rows.
361
+ *
362
+ * A producer must emit `rows` and `page`. A client treats both as optional, so
363
+ * a client newer than the deployed server still parses its answers. Read the
364
+ * domain key when `rows` is absent.
365
+ */
366
+ export const publicV1PageSchema = defineResponseObject({
367
+ total: z.number().int().nonnegative(),
368
+ limit: z.number().int().nonnegative(),
369
+ offset: z.number().int().nonnegative(),
370
+ hasMore: z.boolean(),
371
+ });
372
+ /**
373
+ * Builds the `page` object of a list response, so every operation derives
374
+ * `hasMore` the same way.
375
+ *
376
+ * `total` counts the whole result set. `rowCount` is the number of rows in this
377
+ * answer. Pass `limit` when a further request can return more rows. If the
378
+ * operation answers one response only, leave `limit` out: `limit` then reports
379
+ * the rows returned and `hasMore` is false, even when a display cap holds fewer
380
+ * rows than `total`. A `hasMore` that no request can act on sends a caller into
381
+ * a paging loop that never ends.
382
+ */
383
+ export function publicV1Page(input) {
384
+ const offset = input.offset ?? 0;
385
+ const limit = input.limit ?? input.rowCount;
386
+ const pages = input.limit !== undefined;
387
+ return { total: input.total, limit, offset, hasMore: pages && offset + input.rowCount < input.total };
388
+ }
350
389
  export const publicV1ErrorEnvelope = defineResponseObject({ error: publicV1ErrorProducerSchema }, { error: publicV1ErrorClientSchema });
351
390
  export const publicV1MetaProducerSchema = z.strictObject({
352
391
  requestId: z.string().min(1),