@rebasepro/types 0.30.0 → 0.31.0-canary.g902a0ce

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/README.md +16 -18
  2. package/dist/call_context.d.ts +3 -3
  3. package/dist/controllers/client.d.ts +29 -0
  4. package/dist/controllers/data.d.ts +85 -332
  5. package/dist/controllers/data_driver.d.ts +47 -57
  6. package/dist/controllers/index.d.ts +0 -3
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.es.js +2567 -1151
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/schema/column_options.d.ts +336 -0
  11. package/dist/schema/column_type.d.ts +116 -0
  12. package/dist/schema/columns.d.ts +646 -0
  13. package/dist/schema/compiled.d.ts +114 -0
  14. package/dist/schema/descriptor.d.ts +349 -0
  15. package/dist/schema/hooks.d.ts +164 -0
  16. package/dist/schema/index.d.ts +13 -0
  17. package/dist/schema/infer.d.ts +340 -0
  18. package/dist/schema/json.d.ts +237 -0
  19. package/dist/schema/relations.d.ts +205 -0
  20. package/dist/schema/table.d.ts +304 -0
  21. package/dist/schema/table_options.d.ts +103 -0
  22. package/dist/schema/table_patch.d.ts +338 -0
  23. package/dist/types/auth_adapter.d.ts +12 -6
  24. package/dist/types/auth_hooks.d.ts +65 -0
  25. package/dist/types/backend.d.ts +85 -96
  26. package/dist/types/data_source.d.ts +4 -9
  27. package/dist/types/database_adapter.d.ts +30 -31
  28. package/dist/types/entities.d.ts +0 -162
  29. package/dist/types/filter-operators.d.ts +2 -26
  30. package/dist/types/history.d.ts +6 -9
  31. package/dist/types/index.d.ts +3 -9
  32. package/dist/types/mcp_app_modules.d.ts +0 -2
  33. package/dist/types/policy.d.ts +85 -10
  34. package/dist/types/project_manifest.d.ts +113 -46
  35. package/dist/types/read_query.d.ts +98 -0
  36. package/dist/types/register.d.ts +35 -5
  37. package/dist/types/relations.d.ts +0 -430
  38. package/dist/types/schema_editing.d.ts +54 -2
  39. package/dist/types/schema_version.d.ts +24 -4
  40. package/dist/types/security_rules.d.ts +225 -15
  41. package/dist/types/storage_authorize.d.ts +2 -2
  42. package/dist/types/tenancy.d.ts +3 -3
  43. package/dist/types/ui_preferences.d.ts +228 -0
  44. package/package.json +3 -2
  45. package/dist/controllers/auth_state.d.ts +0 -23
  46. package/dist/controllers/collection_registry.d.ts +0 -67
  47. package/dist/controllers/effective_role.d.ts +0 -4
  48. package/dist/types/admin_block.d.ts +0 -96
  49. package/dist/types/chips.d.ts +0 -16
  50. package/dist/types/collection_contract.d.ts +0 -43
  51. package/dist/types/collection_patch.d.ts +0 -74
  52. package/dist/types/collections.d.ts +0 -783
  53. package/dist/types/component_ref.d.ts +0 -81
  54. package/dist/types/conditions-contract.types.d.ts +0 -14
  55. package/dist/types/entity_callbacks.d.ts +0 -393
  56. package/dist/types/indexes.d.ts +0 -179
  57. package/dist/types/properties.d.ts +0 -1640
@@ -1,4 +0,0 @@
1
- export interface EffectiveRoleController {
2
- effectiveRole: string | null;
3
- setEffectiveRole: (role: string | null) => void;
4
- }
@@ -1,96 +0,0 @@
1
- /**
2
- * The keys of a collection's admin block, as data.
3
- *
4
- * There is no *type* for the block in this package any more, and that is the point:
5
- * `admin` is not declared on `BaseCollectionConfig` or on any property here, so a
6
- * BaaS install cannot even write one. `@rebasepro/cms-types` adds the field back by
7
- * declaration merging, which is why installing it is what makes the admin surface
8
- * appear.
9
- *
10
- * The *list* still has to live here, because three runtime consumers need it and two
11
- * of them are core — see below.
12
- */
13
- /**
14
- * Every key that belongs inside a collection's `admin` block, as data.
15
- *
16
- * The type that describes these fields is `AdminCollectionOptions` in
17
- * `@rebasepro/cms-types`, and it is erased at build time — but three runtime
18
- * consumers need the list, and two of them are core:
19
- *
20
- * - `serializeCollections`, to drop the block from the contract
21
- * - the ts-morph schema editor in `@rebasepro/server`, which rewrites collection
22
- * files on disk from the admin panel and has to know where each key goes. A key
23
- * missing from this list gets written to the *top level* of the file, where the
24
- * backend ignores it and the panel never finds it again.
25
- * - the `collections-admin-block` codemod
26
- *
27
- * `@rebasepro/cms-types` re-exports this and asserts it names only real option
28
- * keys; the count is pinned by a test there.
29
- *
30
- * @group Models
31
- */
32
- export declare const ADMIN_COLLECTION_KEYS: readonly ["Actions", "additionalFields", "alwaysApplyDefaultValues", "browserCallbacks", "components", "customViews", "defaultEntityAction", "defaultFilter", "defaultSelectedView", "defaultSize", "defaultViewMode", "disableDefaultActions", "display", "enabledViews", "entityActions", "entityViews", "exportable", "filterPresets", "fixedFilter", "form", "formAutoSave", "formView", "group", "hideFromEntityViews", "hideFromNavigation", "hideIdFromCollection", "hideIdFromForm", "icon", "includeJsonView", "inlineEditing", "kanban", "listProperties", "localChangesBackup", "openEntityMode", "orderProperty", "pagination", "previewProperties", "propertiesOrder", "selectionController", "selectionEnabled", "sideDialogWidth", "sort"];
33
- /** A key of a collection's `admin` block. @group Models */
34
- export type AdminCollectionKey = typeof ADMIN_COLLECTION_KEYS[number];
35
- /**
36
- * Every key that belongs inside a *property's* `admin` block, as data.
37
- *
38
- * The union of `AdminPropertyOptions` and its per-type extensions
39
- * (`AdminStringOptions`, `AdminArrayOptions`, …) in `@rebasepro/cms-types`.
40
- * It lives here for the same reason {@link ADMIN_COLLECTION_KEYS} does: the
41
- * runtime consumers are core packages that the BaaS guard forbids from
42
- * importing `@rebasepro/cms-types`. Here it is the boot-time collection
43
- * validator in `@rebasepro/server`, which has to tell "you left `readOnly` at
44
- * the top of the property, where nothing reads it" apart from "you invented a
45
- * key we have never heard of".
46
- *
47
- * `@rebasepro/cms-types` re-exports this and asserts it names only real
48
- * option keys.
49
- *
50
- * @group Models
51
- */
52
- export declare const ADMIN_PROPERTY_KEYS: readonly ["canAddElements", "clearable", "columnWidth", "customProps", "disabled", "expanded", "Field", "filledByServer", "Filter", "filterOperators", "fixedFilter", "format", "hideFromCollection", "includeEntityLink", "includeId", "markdown", "minimalistView", "multiline", "Preview", "previewAsTag", "previewProperties", "readOnly", "renderInForm", "sortable", "span", "spreadChildren", "urlPreview", "widget"];
53
- /** A key of a property's `admin` block. @group Models */
54
- export type AdminPropertyKey = typeof ADMIN_PROPERTY_KEYS[number];
55
- /**
56
- * Move flattened admin keys back down into the `admin` block.
57
- *
58
- * The admin panel works with a *flat* view model — the block merged onto the
59
- * collection — so what comes back from a form has `icon` and `defaultViewMode`
60
- * at the top level while `admin` still holds whatever the file was loaded with.
61
- * This is the way back.
62
- *
63
- * **The top-level value wins.** It is the one the form just wrote; the block is
64
- * the copy the collection was loaded with, and preferring it resolves every edit
65
- * in favour of the value the user changed away from.
66
- *
67
- * This lives here, next to the key lists, because it had two implementations —
68
- * `toAdminCollectionConfig` in `@rebasepro/cms-types` and `nestAdminKeys` in
69
- * `@rebasepro/server`'s schema editor — that agreed on everything except that
70
- * precedence, which is the only part that decides whether a save is visible.
71
- *
72
- * @group Models
73
- */
74
- export declare function nestAdminKeysOf(source: Record<string, unknown>, adminKeys: readonly string[]): Record<string, unknown>;
75
- /**
76
- * {@link nestAdminKeysOf} for a collection.
77
- *
78
- * @group Models
79
- */
80
- export declare function nestAdminCollectionKeys(collection: Record<string, unknown>): Record<string, unknown>;
81
- /**
82
- * {@link nestAdminKeysOf} for a property, applied to its children too.
83
- *
84
- * A map property carries `properties`, an array property carries `of`, and an
85
- * array of typed blocks carries `oneOf.properties` — a record of properties like
86
- * a map's. All of them hold properties with `admin` blocks of their own. A flat
87
- * `readOnly` left on a child is as dead — and as fatal at the next boot — as one
88
- * left on the parent, so the walk goes all the way down.
89
- *
90
- * `oneOf` was the container this walk did not know about, and it is the one the
91
- * block-based collection templates are built out of: every block inside them
92
- * kept its flat `markdown`, and the collection they created would not boot.
93
- *
94
- * @group Models
95
- */
96
- export declare function nestAdminPropertyKeys(property: Record<string, unknown>): Record<string, unknown>;
@@ -1,16 +0,0 @@
1
- export type ColorScheme = {
2
- color: string;
3
- text: string;
4
- };
5
- /**
6
- * The hues a chip can take.
7
- *
8
- * Kept in step with `CHIP_HUES` in `@rebasepro/ui` by hand: config types cannot
9
- * depend on the component library. A hue added there needs adding here too.
10
- */
11
- export type ColorHue = "blue" | "cyan" | "teal" | "green" | "yellow" | "orange" | "red" | "pink" | "purple" | "gray" | "indigo" | "violet" | "fuchsia" | "rose" | "emerald";
12
- /**
13
- * How light or saturated a chip is. A hue on its own means `Lighter`.
14
- */
15
- export type ColorTone = "Lighter" | "Light" | "Dark" | "Darker";
16
- export type ColorKey = ColorHue | `${ColorHue}${ColorTone}`;
@@ -1,43 +0,0 @@
1
- import type { CollectionConfig } from "./collections.js";
2
- /**
3
- * Serializing collections so they survive a network hop.
4
- *
5
- * A collection definition is not plain data. Relations point at their target
6
- * with a *function* (`target: () => usersCollection`) so two collections can
7
- * reference each other without an import cycle, and collections also carry
8
- * callbacks, custom views and component references. `JSON.stringify` silently
9
- * drops every one of those, which matters because the SDK generator *calls*
10
- * `relation.target()` to decide whether a foreign key is a string or a number.
11
- * Serialize naively and remote SDK generation produces subtly wrong types
12
- * instead of failing — the worst possible outcome.
13
- *
14
- * So relation targets are resolved to a slug reference on the way out and
15
- * rebuilt into functions on the way in. Everything else that cannot cross a wire
16
- * is dropped deliberately: an SDK is generated from the *shape* of the data, and
17
- * server-side behaviour is neither useful to a client nor safe to publish.
18
- */
19
- /** Marker replacing a relation's `target` function in serialized form. */
20
- export interface SerializedCollectionRef {
21
- __collectionRef: string;
22
- }
23
- export declare function isSerializedCollectionRef(value: unknown): value is SerializedCollectionRef;
24
- /**
25
- * Serialize collections for transport over the contract endpoint.
26
- *
27
- * Sorted by slug so the output — and therefore the schema hash computed from it
28
- * — does not depend on filesystem ordering.
29
- */
30
- export declare function serializeCollections(collections: CollectionConfig[]): unknown[];
31
- /**
32
- * Rebuild collections received from a contract endpoint.
33
- *
34
- * Relation refs become real thunks resolving through the returned set, so
35
- * downstream consumers — the SDK generator above all — see exactly the shape
36
- * they would have seen had the collections been imported from source.
37
- *
38
- * A ref naming a collection that is not in the payload resolves to `undefined`
39
- * rather than throwing: the generator already tolerates an unresolvable target
40
- * by falling back to a permissive key type, and a partial contract should still
41
- * produce a usable SDK.
42
- */
43
- export declare function deserializeCollections(payload: unknown[]): CollectionConfig[];
@@ -1,74 +0,0 @@
1
- /** One change to a collection. `path` is a list of object keys. */
2
- export type CollectionPatchOp = {
3
- op: "set";
4
- path: string[];
5
- value: unknown;
6
- } | {
7
- op: "remove";
8
- path: string[];
9
- };
10
- /** @group Models */
11
- export type CollectionPatch = CollectionPatchOp[];
12
- /**
13
- * Keys the runtime adds to a collection that must never be written into its
14
- * source. `resolvedRelation` is the registry's resolved form of a relation; a
15
- * file holding one does not type-check (`target` is missing from it).
16
- */
17
- export declare const RUNTIME_ONLY_COLLECTION_KEYS: readonly string[];
18
- /** A JSON value as JSON would carry it: functions, `undefined` and symbols dropped. */
19
- export declare function toCollectionJson(value: unknown): unknown;
20
- /**
21
- * The operations that take `before` to `after`, both JSON values.
22
- *
23
- * Objects are compared key by key; anything else that differs — a primitive,
24
- * an array, a change of kind — is set whole.
25
- */
26
- export declare function diffJsonValues(before: unknown, after: unknown, path?: string[]): CollectionPatch;
27
- /**
28
- * The patch, with every flat presentation key moved into its `admin` block.
29
- *
30
- * The panel edits a flat view model — `icon` beside `name`, a property's
31
- * `readOnly` beside its `type` — while the file keeps them under `admin`. The
32
- * difference is taken on the flat model, because that is where a cleared field
33
- * shows up as a removed key (the `admin` copy the model was loaded with still
34
- * holds the old value), and moved here.
35
- *
36
- * The flat value wins over the `admin` copy, as in {@link nestAdminKeysOf}:
37
- * operations that were already under `admin` are ordered first, so the flat
38
- * one — what the form just wrote — is applied last.
39
- */
40
- export declare function nestCollectionPatchPaths(patch: CollectionPatch): CollectionPatch;
41
- /**
42
- * The patch that takes the collection the editor loaded to the one it is
43
- * saving, in the authoring shape. Empty when nothing changed.
44
- *
45
- * Both sides go through JSON first, so whatever JSON cannot carry — a
46
- * function, a value it drops — is equally absent from both and never appears
47
- * as a change.
48
- */
49
- export declare function diffCollections(loaded: unknown, saving: unknown): CollectionPatch;
50
- /**
51
- * Why a patch may not be applied, or an empty list.
52
- *
53
- * Checked by every door that accepts one: a path is a list of non-empty object
54
- * keys that cannot reach a prototype, and no runtime-only key may be written.
55
- */
56
- export declare function collectionPatchProblems(patch: unknown): string[];
57
- /**
58
- * The first runtime-only key (see {@link RUNTIME_ONLY_COLLECTION_KEYS}) found
59
- * anywhere in a value, or `undefined`. For the doors that take a whole
60
- * collection rather than a patch.
61
- */
62
- export declare function runtimeOnlyKeyIn(value: unknown): string | undefined;
63
- /** A patch every door may apply: {@link collectionPatchProblems} found nothing. */
64
- export declare function isCollectionPatch(patch: unknown): patch is CollectionPatch;
65
- /**
66
- * `target` with the patch applied, copying only what it changes.
67
- *
68
- * Everything the patch does not reach is shared with `target` by reference —
69
- * functions, thunks and all — which is what lets a planner see a relation's
70
- * `target()` on the patched collection exactly as it was. Intermediate objects
71
- * a `set` needs are created; a `remove` of a key that is not there is nothing
72
- * to do.
73
- */
74
- export declare function applyCollectionPatch<T>(target: T, patch: CollectionPatch): T;