@rebasepro/types 0.13.0 → 0.13.1-canary.g3660bd5

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.
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * @group Models
31
31
  */
32
- export declare const ADMIN_COLLECTION_KEYS: readonly ["Actions", "additionalFields", "alwaysApplyDefaultValues", "components", "defaultEntityAction", "defaultFilter", "defaultSelectedView", "defaultSize", "defaultViewMode", "disableDefaultActions", "enabledViews", "entityActions", "entityViews", "exportable", "filterPresets", "fixedFilter", "form", "formAutoSave", "formView", "group", "hideFromNavigation", "hideIdFromCollection", "hideIdFromForm", "icon", "includeJsonView", "inlineEditing", "kanban", "listProperties", "localChangesBackup", "openEntityMode", "orderProperty", "pagination", "previewProperties", "propertiesOrder", "selectionController", "selectionEnabled", "sideDialogWidth", "sort", "titleProperty"];
32
+ export declare const ADMIN_COLLECTION_KEYS: readonly ["Actions", "additionalFields", "alwaysApplyDefaultValues", "components", "defaultEntityAction", "defaultFilter", "defaultSelectedView", "defaultSize", "defaultViewMode", "disableDefaultActions", "display", "enabledViews", "entityActions", "entityViews", "exportable", "filterPresets", "fixedFilter", "form", "formAutoSave", "formView", "group", "hideFromNavigation", "hideIdFromCollection", "hideIdFromForm", "icon", "includeJsonView", "inlineEditing", "kanban", "listProperties", "localChangesBackup", "openEntityMode", "orderProperty", "pagination", "previewProperties", "propertiesOrder", "selectionController", "selectionEnabled", "sideDialogWidth", "sort", "titleProperty"];
33
33
  /** A key of a collection's `admin` block. @group Models */
34
34
  export type AdminCollectionKey = typeof ADMIN_COLLECTION_KEYS[number];
35
35
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/types",
3
3
  "type": "module",
4
- "version": "0.13.0",
4
+ "version": "0.13.1-canary.g3660bd5",
5
5
  "description": "Rebase type definitions — shared interfaces and controller types",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -38,13 +38,19 @@ export interface FilterCondition {
38
38
  *
39
39
  * `limit`/`offset` and `page` describe the same window two ways. If **both
40
40
  * `offset` and `page` are provided, `page` wins** — the backend computes
41
- * `offset = (page - 1) * (limit ?? 20)` and ignores the explicit `offset`.
42
- * Pick one style per query.
41
+ * `offset = (page - 1) * (limit ?? DEFAULT_LIST_LIMIT)` and ignores the
42
+ * explicit `offset`. Pick one style per query.
43
43
  *
44
44
  * @group Data
45
45
  */
46
46
  export interface FindParams<M extends Record<string, unknown> = Record<string, unknown>> {
47
- /** Maximum number of items to return (default: 20). */
47
+ /**
48
+ * Maximum number of items to return.
49
+ *
50
+ * Defaults to {@link DEFAULT_LIST_LIMIT}, and is clamped to
51
+ * {@link MAX_LIST_LIMIT}. Both bounds are applied by the backend, so a
52
+ * read is never unbounded whether or not a limit was asked for.
53
+ */
48
54
  limit?: number;
49
55
  /**
50
56
  * Number of items to skip. Ignored when {@link FindParams.page} is also
@@ -53,7 +59,7 @@ export interface FindParams<M extends Record<string, unknown> = Record<string, u
53
59
  offset?: number;
54
60
  /**
55
61
  * Page number (1-indexed), alternative to {@link FindParams.offset}.
56
- * When set, overrides `offset` as `(page - 1) * (limit ?? 20)`.
62
+ * When set, overrides `offset` as `(page - 1) * (limit ?? DEFAULT_LIST_LIMIT)`.
57
63
  */
58
64
  page?: number;
59
65
  /**
@@ -584,10 +590,15 @@ export type RebaseData<DB = unknown> = {
584
590
  * Dynamic collection accessor.
585
591
  * Access any collection by its slug as a property.
586
592
  *
593
+ * The index signature is `CollectionAccessor` alone, for the reason
594
+ * spelled out on {@link RebaseSdkData}: unioning in the `collection`
595
+ * method's own signature is unnecessary across an intersection, and it
596
+ * costs `data.products.find()` — the access this `@example` documents.
597
+ *
587
598
  * @example
588
599
  * data.products.find({ where: { status: ["==", "published"] } })
589
600
  */
590
- [collectionSlug: string]: CollectionAccessor | ((slug: string) => CollectionAccessor);
601
+ [collectionSlug: string]: CollectionAccessor;
591
602
  }
592
603
  );
593
604
 
@@ -639,6 +650,26 @@ export type InsertOf<T> = T extends { Insert: infer I extends Record<string, unk
639
650
  */
640
651
  export type UpdateOf<T> = T extends { Update: infer U extends Record<string, unknown> } ? U : Partial<RowOf<T>>;
641
652
 
653
+ /**
654
+ * Note on the untyped branch below: its index signature is
655
+ * `SDKCollectionClient`, NOT `SDKCollectionClient | ((slug: string) => …)`.
656
+ *
657
+ * The union looks like it is needed so `collection` — a method on this same
658
+ * object — satisfies the index signature. It is not, because `collection` is
659
+ * declared in a *separate* member of the intersection, and TypeScript only
660
+ * requires named properties to be assignable to an index signature declared
661
+ * alongside them. Including the function arm cost the documented accessor:
662
+ *
663
+ * rebase.dataAsAdmin.projects.find()
664
+ * // ^ Property 'find' does not exist on type
665
+ * // 'SDKCollectionClient | ((slug: string) => …)'
666
+ *
667
+ * Every project without a generated `Database` type lands on this branch, so
668
+ * property-style access — the form used by the `@example` below, by the
669
+ * scaffolded function template, and by the 0.13 migration note — did not
670
+ * compile for any of them. Do not restore the arm; use `collection(slug)` if a
671
+ * caller genuinely needs the by-slug function.
672
+ */
642
673
  export type RebaseSdkData<DB = unknown> = {
643
674
  /**
644
675
  * Get a flat collection accessor by slug.
@@ -659,6 +690,6 @@ export type RebaseSdkData<DB = unknown> = {
659
690
  * @example
660
691
  * data.products.find({ where: { status: ["==", "published"] } })
661
692
  */
662
- [collectionSlug: string]: SDKCollectionClient | ((slug: string) => SDKCollectionClient);
693
+ [collectionSlug: string]: SDKCollectionClient;
663
694
  }
664
695
  );
@@ -41,6 +41,7 @@ export const ADMIN_COLLECTION_KEYS = [
41
41
  "defaultSize",
42
42
  "defaultViewMode",
43
43
  "disableDefaultActions",
44
+ "display",
44
45
  "enabledViews",
45
46
  "entityActions",
46
47
  "entityViews",