@rebasepro/types 0.13.0 → 0.13.1-canary.gcd6689e
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
package/src/controllers/data.ts
CHANGED
|
@@ -584,10 +584,15 @@ export type RebaseData<DB = unknown> = {
|
|
|
584
584
|
* Dynamic collection accessor.
|
|
585
585
|
* Access any collection by its slug as a property.
|
|
586
586
|
*
|
|
587
|
+
* The index signature is `CollectionAccessor` alone, for the reason
|
|
588
|
+
* spelled out on {@link RebaseSdkData}: unioning in the `collection`
|
|
589
|
+
* method's own signature is unnecessary across an intersection, and it
|
|
590
|
+
* costs `data.products.find()` — the access this `@example` documents.
|
|
591
|
+
*
|
|
587
592
|
* @example
|
|
588
593
|
* data.products.find({ where: { status: ["==", "published"] } })
|
|
589
594
|
*/
|
|
590
|
-
[collectionSlug: string]: CollectionAccessor
|
|
595
|
+
[collectionSlug: string]: CollectionAccessor;
|
|
591
596
|
}
|
|
592
597
|
);
|
|
593
598
|
|
|
@@ -639,6 +644,26 @@ export type InsertOf<T> = T extends { Insert: infer I extends Record<string, unk
|
|
|
639
644
|
*/
|
|
640
645
|
export type UpdateOf<T> = T extends { Update: infer U extends Record<string, unknown> } ? U : Partial<RowOf<T>>;
|
|
641
646
|
|
|
647
|
+
/**
|
|
648
|
+
* Note on the untyped branch below: its index signature is
|
|
649
|
+
* `SDKCollectionClient`, NOT `SDKCollectionClient | ((slug: string) => …)`.
|
|
650
|
+
*
|
|
651
|
+
* The union looks like it is needed so `collection` — a method on this same
|
|
652
|
+
* object — satisfies the index signature. It is not, because `collection` is
|
|
653
|
+
* declared in a *separate* member of the intersection, and TypeScript only
|
|
654
|
+
* requires named properties to be assignable to an index signature declared
|
|
655
|
+
* alongside them. Including the function arm cost the documented accessor:
|
|
656
|
+
*
|
|
657
|
+
* rebase.dataAsAdmin.projects.find()
|
|
658
|
+
* // ^ Property 'find' does not exist on type
|
|
659
|
+
* // 'SDKCollectionClient | ((slug: string) => …)'
|
|
660
|
+
*
|
|
661
|
+
* Every project without a generated `Database` type lands on this branch, so
|
|
662
|
+
* property-style access — the form used by the `@example` below, by the
|
|
663
|
+
* scaffolded function template, and by the 0.13 migration note — did not
|
|
664
|
+
* compile for any of them. Do not restore the arm; use `collection(slug)` if a
|
|
665
|
+
* caller genuinely needs the by-slug function.
|
|
666
|
+
*/
|
|
642
667
|
export type RebaseSdkData<DB = unknown> = {
|
|
643
668
|
/**
|
|
644
669
|
* Get a flat collection accessor by slug.
|
|
@@ -659,6 +684,6 @@ export type RebaseSdkData<DB = unknown> = {
|
|
|
659
684
|
* @example
|
|
660
685
|
* data.products.find({ where: { status: ["==", "published"] } })
|
|
661
686
|
*/
|
|
662
|
-
[collectionSlug: string]: SDKCollectionClient
|
|
687
|
+
[collectionSlug: string]: SDKCollectionClient;
|
|
663
688
|
}
|
|
664
689
|
);
|