@qlever-llc/trellis 0.10.7 → 0.10.9

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 (57) hide show
  1. package/esm/auth/protocol.d.ts +120 -3
  2. package/esm/auth/protocol.d.ts.map +1 -1
  3. package/esm/auth/protocol.js +43 -1
  4. package/esm/contract_support/mod.d.ts +1 -1
  5. package/esm/contract_support/mod.d.ts.map +1 -1
  6. package/esm/contract_support/mod.js +1 -1
  7. package/esm/contract_support/protocol.d.ts +67 -0
  8. package/esm/contract_support/protocol.d.ts.map +1 -1
  9. package/esm/contract_support/protocol.js +90 -0
  10. package/esm/generated-sdk/auth/contract.d.ts +1 -1
  11. package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
  12. package/esm/generated-sdk/auth/contract.js +2 -2
  13. package/esm/generated-sdk/auth/schemas.d.ts +329 -2
  14. package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
  15. package/esm/generated-sdk/auth/schemas.js +3 -3
  16. package/esm/generated-sdk/auth/types.d.ts +47 -3
  17. package/esm/generated-sdk/auth/types.d.ts.map +1 -1
  18. package/esm/generated-sdk/auth/types.js +1 -1
  19. package/esm/index.d.ts +2 -2
  20. package/esm/index.d.ts.map +1 -1
  21. package/esm/index.js +1 -1
  22. package/esm/server/service.d.ts +11 -2
  23. package/esm/server/service.d.ts.map +1 -1
  24. package/esm/server/service.js +28 -4
  25. package/package.json +2 -2
  26. package/script/auth/protocol.d.ts +120 -3
  27. package/script/auth/protocol.d.ts.map +1 -1
  28. package/script/auth/protocol.js +47 -5
  29. package/script/contract_support/mod.d.ts +1 -1
  30. package/script/contract_support/mod.d.ts.map +1 -1
  31. package/script/contract_support/mod.js +8 -1
  32. package/script/contract_support/protocol.d.ts +67 -0
  33. package/script/contract_support/protocol.d.ts.map +1 -1
  34. package/script/contract_support/protocol.js +96 -1
  35. package/script/generated-sdk/auth/contract.d.ts +1 -1
  36. package/script/generated-sdk/auth/contract.d.ts.map +1 -1
  37. package/script/generated-sdk/auth/contract.js +2 -2
  38. package/script/generated-sdk/auth/schemas.d.ts +329 -2
  39. package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
  40. package/script/generated-sdk/auth/schemas.js +3 -3
  41. package/script/generated-sdk/auth/types.d.ts +47 -3
  42. package/script/generated-sdk/auth/types.d.ts.map +1 -1
  43. package/script/generated-sdk/auth/types.js +1 -1
  44. package/script/index.d.ts +2 -2
  45. package/script/index.d.ts.map +1 -1
  46. package/script/index.js +9 -2
  47. package/script/server/service.d.ts +11 -2
  48. package/script/server/service.d.ts.map +1 -1
  49. package/script/server/service.js +27 -3
  50. package/src/auth/protocol.ts +55 -1
  51. package/src/contract_support/mod.ts +12 -0
  52. package/src/contract_support/protocol.ts +137 -0
  53. package/src/index.ts +12 -0
  54. package/src/sdk/_generated/auth/contract.ts +2 -2
  55. package/src/sdk/_generated/auth/schemas.ts +3 -3
  56. package/src/sdk/_generated/auth/types.ts +4 -4
  57. package/src/server/service.ts +52 -3
@@ -381,4 +381,71 @@ export type PageResponse<TEntry> = {
381
381
  limit: number;
382
382
  nextOffset?: number;
383
383
  };
384
+ /**
385
+ * Validates and normalizes an offset pagination query.
386
+ *
387
+ * Ensures `offset` and `limit` are non-negative integers within bounds. Throws
388
+ * `RangeError` on invalid input.
389
+ */
390
+ export declare function normalizePageQuery(query: PageRequest, maxLimit?: number): Required<PageRequest>;
391
+ /**
392
+ * Builds a {@link PageResponse} from a pre-sliced offset page.
393
+ *
394
+ * @param entries - The entries for the current page, already sliced by the caller.
395
+ * @param totalCount - Total number of matching entries before slicing.
396
+ * @param query - The original pagination query used to produce the page.
397
+ * @param maxLimit - Optional maximum limit accepted by the endpoint.
398
+ */
399
+ export declare function buildPageResponse<T>(entries: T[], totalCount: number, query: PageRequest, maxLimit?: number): PageResponse<T>;
400
+ /** Schema for a cursor pagination query. */
401
+ export declare const CursorQuerySchema: Type.TObject<{
402
+ cursor: Type.TOptional<Type.TString>;
403
+ limit: Type.TOptional<Type.TInteger>;
404
+ }>;
405
+ /** Cursor pagination query. */
406
+ export type CursorQuery = Static<typeof CursorQuerySchema>;
407
+ /** Schema for cursor pagination response metadata. */
408
+ export declare const CursorPageInfoSchema: Type.TObject<{
409
+ nextCursor: Type.TOptional<Type.TString>;
410
+ }>;
411
+ /** Cursor pagination response metadata. */
412
+ export type CursorPageInfo = Static<typeof CursorPageInfoSchema>;
413
+ /** Create a schema for a cursor page response with typed items. */
414
+ export declare function CursorPageSchema<TItem extends TSchema>(item: TItem): Type.TObject<{
415
+ items: Type.TArray<TItem>;
416
+ page: Type.TObject<{
417
+ nextCursor: Type.TOptional<Type.TString>;
418
+ }>;
419
+ }>;
420
+ /** Cursor pagination response with typed items. */
421
+ export type CursorPage<TItem> = {
422
+ items: TItem[];
423
+ page: CursorPageInfo;
424
+ };
425
+ /** Options for normalizing a cursor pagination query. */
426
+ export type CursorQueryOptions = {
427
+ /** Limit used when the query does not specify one. Defaults to `100`. */
428
+ defaultLimit?: number;
429
+ /** Maximum accepted limit. Defaults to `500`. */
430
+ maxLimit?: number;
431
+ };
432
+ /** Cursor query after defaults and validation have been applied. */
433
+ export type NormalizedCursorQuery = {
434
+ cursor?: string;
435
+ limit: number;
436
+ };
437
+ /**
438
+ * Validates and normalizes a cursor pagination query.
439
+ *
440
+ * Defaults `limit` to `100`, rejects limits above `500` unless `maxLimit` is
441
+ * overridden, and preserves a non-empty optional cursor.
442
+ */
443
+ export declare function normalizeCursorQuery(query: CursorQuery, options?: CursorQueryOptions): NormalizedCursorQuery;
444
+ /**
445
+ * Builds a {@link CursorPage} from items and an optional next cursor.
446
+ *
447
+ * @param items - The items for the current page.
448
+ * @param nextCursor - Cursor clients can use to request the next page.
449
+ */
450
+ export declare function buildCursorPage<T>(items: T[], nextCursor?: string): CursorPage<T>;
384
451
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/contract_support/protocol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DAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,kBAAuB,GAC/B,qBAAqB,CAgBvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,CAAC,EAAE,MAAM,GAClB,UAAU,CAAC,CAAC,CAAC,CAKf"}
@@ -162,3 +162,93 @@ export function PageResponseSchema(entry) {
162
162
  nextOffset: Type.Optional(Type.Integer({ minimum: 0 })),
163
163
  });
164
164
  }
165
+ /**
166
+ * Validates and normalizes an offset pagination query.
167
+ *
168
+ * Ensures `offset` and `limit` are non-negative integers within bounds. Throws
169
+ * `RangeError` on invalid input.
170
+ */
171
+ export function normalizePageQuery(query, maxLimit = Number.MAX_SAFE_INTEGER) {
172
+ if (!Number.isInteger(query.limit) || query.limit < 0) {
173
+ throw new RangeError("list limit must be a non-negative integer");
174
+ }
175
+ if (query.limit > maxLimit) {
176
+ throw new RangeError(`list limit must be <= ${maxLimit}`);
177
+ }
178
+ const offset = query.offset ?? 0;
179
+ if (!Number.isInteger(offset) || offset < 0) {
180
+ throw new RangeError("list offset must be a non-negative integer");
181
+ }
182
+ return { offset, limit: query.limit };
183
+ }
184
+ /**
185
+ * Builds a {@link PageResponse} from a pre-sliced offset page.
186
+ *
187
+ * @param entries - The entries for the current page, already sliced by the caller.
188
+ * @param totalCount - Total number of matching entries before slicing.
189
+ * @param query - The original pagination query used to produce the page.
190
+ * @param maxLimit - Optional maximum limit accepted by the endpoint.
191
+ */
192
+ export function buildPageResponse(entries, totalCount, query, maxLimit) {
193
+ const { offset, limit } = normalizePageQuery(query, maxLimit);
194
+ return {
195
+ entries,
196
+ count: totalCount,
197
+ offset,
198
+ limit,
199
+ nextOffset: limit <= 0 || offset + limit >= totalCount
200
+ ? undefined
201
+ : offset + limit,
202
+ };
203
+ }
204
+ /** Schema for a cursor pagination query. */
205
+ export const CursorQuerySchema = Type.Object({
206
+ cursor: Type.Optional(Type.String({ minLength: 1 })),
207
+ limit: Type.Optional(Type.Integer({ minimum: 0 })),
208
+ });
209
+ /** Schema for cursor pagination response metadata. */
210
+ export const CursorPageInfoSchema = Type.Object({
211
+ nextCursor: Type.Optional(Type.String({ minLength: 1 })),
212
+ });
213
+ /** Create a schema for a cursor page response with typed items. */
214
+ export function CursorPageSchema(item) {
215
+ return Type.Object({
216
+ items: Type.Array(item, { default: [] }),
217
+ page: CursorPageInfoSchema,
218
+ });
219
+ }
220
+ /**
221
+ * Validates and normalizes a cursor pagination query.
222
+ *
223
+ * Defaults `limit` to `100`, rejects limits above `500` unless `maxLimit` is
224
+ * overridden, and preserves a non-empty optional cursor.
225
+ */
226
+ export function normalizeCursorQuery(query, options = {}) {
227
+ const maxLimit = options.maxLimit ?? 500;
228
+ const limit = query.limit ?? options.defaultLimit ?? 100;
229
+ if (!Number.isInteger(limit) || limit < 0) {
230
+ throw new RangeError("list limit must be a non-negative integer");
231
+ }
232
+ if (limit > maxLimit) {
233
+ throw new RangeError(`list limit must be <= ${maxLimit}`);
234
+ }
235
+ if (query.cursor === undefined) {
236
+ return { limit };
237
+ }
238
+ if (query.cursor.length === 0) {
239
+ throw new RangeError("list cursor must be a non-empty string");
240
+ }
241
+ return { cursor: query.cursor, limit };
242
+ }
243
+ /**
244
+ * Builds a {@link CursorPage} from items and an optional next cursor.
245
+ *
246
+ * @param items - The items for the current page.
247
+ * @param nextCursor - Cursor clients can use to request the next page.
248
+ */
249
+ export function buildCursorPage(items, nextCursor) {
250
+ return {
251
+ items,
252
+ page: nextCursor === undefined ? {} : { nextCursor },
253
+ };
254
+ }
@@ -1,7 +1,7 @@
1
1
  import type { SdkContractModule, TrellisContractV1 } from "@qlever-llc/trellis";
2
2
  import { API } from "./api.js";
3
3
  export declare const CONTRACT_ID: "trellis.auth@v1";
4
- export declare const CONTRACT_DIGEST: "gLadyuZkZX2uxa3wnVMUJkDDddoVgRrDEzH8TIdeDyw";
4
+ export declare const CONTRACT_DIGEST: "XdqgSxkrIhWOu1ODbOk6-QHLTlI52ZP-6qhYJpIdCMc";
5
5
  export declare const CONTRACT: TrellisContractV1;
6
6
  export declare const sdk: SdkContractModule<typeof CONTRACT_ID, typeof API.owned>;
7
7
  export declare const use: import("@qlever-llc/trellis").ContractUseFn<"trellis.auth@v1", {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/sdk/_generated/auth/contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAE,iBAAiB,EAAW,MAAM,mBAAmB,CAAC;AAC9G,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B,eAAO,MAAM,WAAW,EAAG,iBAA0B,CAAC;AACtD,eAAO,MAAM,eAAe,EAAG,6CAAsD,CAAC;AACtF,eAAO,MAAM,QAAQ,EAA+18L,iBAAiB,CAAC;AA0Bt48L,eAAO,MAAM,GAAG,EAAE,iBAAiB,CAAC,OAAO,WAAW,EAAE,OAAO,GAAG,CAAC,KAAK,CA8BvE,CAAC;AAEF,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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