@rebasepro/types 0.11.1-canary.gfd39654 → 0.12.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.
- package/dist/controllers/collection_registry.d.ts +1 -1
- package/dist/controllers/data.d.ts +148 -9
- package/dist/index.es.js +287 -97
- package/dist/index.es.js.map +1 -1
- package/dist/types/admin_block.d.ts +20 -0
- package/dist/types/api_keys.d.ts +60 -5
- package/dist/types/collections.d.ts +56 -31
- package/dist/types/data_source.d.ts +42 -1
- package/dist/types/database_adapter.d.ts +13 -8
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/history.d.ts +62 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/postgres_introspection.d.ts +95 -0
- package/dist/types/project_manifest.d.ts +146 -73
- package/dist/types/properties.d.ts +38 -49
- package/dist/types/storage_source.d.ts +60 -0
- package/dist/types/websockets.d.ts +0 -37
- package/package.json +1 -1
- package/src/controllers/collection_registry.ts +1 -1
- package/src/controllers/data.ts +155 -9
- package/src/types/admin_block.ts +48 -0
- package/src/types/api_keys.ts +61 -5
- package/src/types/collections.ts +68 -39
- package/src/types/data_source.ts +60 -1
- package/src/types/database_adapter.ts +13 -8
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/history.ts +66 -0
- package/src/types/index.ts +2 -0
- package/src/types/postgres_introspection.ts +101 -0
- package/src/types/project_manifest.ts +149 -80
- package/src/types/properties.ts +43 -56
- package/src/types/storage_source.ts +130 -0
- package/src/types/websockets.ts +0 -42
|
@@ -24,29 +24,48 @@
|
|
|
24
24
|
* work: two repositories never need to know about each other, only about the
|
|
25
25
|
* project.
|
|
26
26
|
*/
|
|
27
|
+
import type { StorageSourceDefinition } from "./storage_source";
|
|
27
28
|
/**
|
|
28
29
|
* Which kind of thing an app is.
|
|
29
30
|
*
|
|
30
31
|
* - `backend` — the collections/hooks/functions that define the project's API.
|
|
31
32
|
* Exactly one per *project* (not per repository); the registry enforces it.
|
|
32
|
-
* - `static` — a pre-built client bundle (SPA, static site) served
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* hatch: full control, no managed-runtime guarantees.
|
|
33
|
+
* - `static` — a pre-built client bundle (SPA, static site), served from the
|
|
34
|
+
* backend process at its declared `path` or from a CDN. The admin panel is
|
|
35
|
+
* one of these: it is an app in the user's repository like any other.
|
|
36
|
+
*
|
|
37
|
+
* That is the whole list. Ownership of the server process is a property of the
|
|
38
|
+
* backend app ({@link RebaseBackendAppConfig.runtime}), not an app type.
|
|
39
39
|
*/
|
|
40
|
-
export type RebaseAppType = "backend" | "static"
|
|
40
|
+
export type RebaseAppType = "backend" | "static";
|
|
41
41
|
/**
|
|
42
42
|
* The backend app: the project's API surface.
|
|
43
43
|
*
|
|
44
44
|
* Paths are relative to the directory holding `rebase.json`. The defaults match
|
|
45
45
|
* the layout `rebase init` scaffolds, so a stock project may declare simply
|
|
46
|
-
* `{ "type": "backend" }`.
|
|
46
|
+
* `{ "type": "backend", "runtime": "managed" }`.
|
|
47
47
|
*/
|
|
48
48
|
export interface RebaseBackendAppConfig {
|
|
49
49
|
type: "backend";
|
|
50
|
+
/**
|
|
51
|
+
* Who owns the process this backend runs in.
|
|
52
|
+
*
|
|
53
|
+
* - `managed` — the platform's runtime image boots this project's bundle.
|
|
54
|
+
* You supply collections, functions, crons and schema; Rebase supplies the
|
|
55
|
+
* server.
|
|
56
|
+
* - `custom` — this repository builds its own image and entrypoint. The
|
|
57
|
+
* escape hatch: full control, no managed-runtime guarantees.
|
|
58
|
+
*
|
|
59
|
+
* Independent of *where* it runs. Both run on Rebase Cloud and both
|
|
60
|
+
* self-host — the destination lives in `.rebase/cloud.json`, not here. See
|
|
61
|
+
* `docker/docker-compose.selfhost.yml`, which boots a managed bundle on a
|
|
62
|
+
* developer's own Docker host.
|
|
63
|
+
*
|
|
64
|
+
* This is authored rather than inferred on purpose. It is the single most
|
|
65
|
+
* consequential fact about a deployment, and inferring it is what used to
|
|
66
|
+
* land projects on the custom runtime without anyone choosing it.
|
|
67
|
+
*/
|
|
68
|
+
runtime: "managed" | "custom";
|
|
50
69
|
/** Directory of the config package (collections + index). Default `config`. */
|
|
51
70
|
config?: string;
|
|
52
71
|
/** Directory of server functions. Default `backend/functions`. */
|
|
@@ -58,22 +77,23 @@ export interface RebaseBackendAppConfig {
|
|
|
58
77
|
* Default `backend/src/schema.generated.ts`.
|
|
59
78
|
*/
|
|
60
79
|
schema?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Which collections source the runtime uses.
|
|
63
|
-
*
|
|
64
|
-
* - `cms` (default) — collections come from the config package.
|
|
65
|
-
* - `baas` — collections are introspected from the live database at boot and
|
|
66
|
-
* the config package is not required.
|
|
67
|
-
*/
|
|
68
|
-
mode?: "cms" | "baas";
|
|
69
80
|
/**
|
|
70
81
|
* Module path (relative to `config`) exporting the auth users collection as
|
|
71
82
|
* its default export. Default `collections/users`.
|
|
72
83
|
*/
|
|
73
84
|
usersCollection?: string;
|
|
85
|
+
/**
|
|
86
|
+
* `runtime: "custom"` only. Dockerfile path relative to the repository root.
|
|
87
|
+
* Default `Dockerfile`.
|
|
88
|
+
*/
|
|
89
|
+
dockerfile?: string;
|
|
90
|
+
/** `runtime: "custom"` only. Build context relative to the root. Default `.`. */
|
|
91
|
+
context?: string;
|
|
92
|
+
/** `runtime: "custom"` only. Port the container listens on. Default 8080. */
|
|
93
|
+
port?: number;
|
|
74
94
|
}
|
|
75
95
|
/**
|
|
76
|
-
* A static client bundle — SPA or static site — built here and served
|
|
96
|
+
* A static client bundle — SPA or static site — built here and served at `path`.
|
|
77
97
|
*/
|
|
78
98
|
export interface RebaseStaticAppConfig {
|
|
79
99
|
type: "static";
|
|
@@ -84,54 +104,47 @@ export interface RebaseStaticAppConfig {
|
|
|
84
104
|
/** Directory of built assets, relative to the repository root. */
|
|
85
105
|
output: string;
|
|
86
106
|
/**
|
|
87
|
-
*
|
|
107
|
+
* Public base path this app is served under. Default `/`.
|
|
108
|
+
*
|
|
109
|
+
* Several static apps run in one process, each at its own path — the API at
|
|
110
|
+
* `/api`, a site at `/`, the admin at `/admin` — which is what keeps a
|
|
111
|
+
* self-hosted deployment a single container.
|
|
112
|
+
*
|
|
113
|
+
* **This is a build-time input, not only a serving concern.** An app mounted
|
|
114
|
+
* at `/admin` must be *built* for `/admin` (Vite's `base`), or `index.html`
|
|
115
|
+
* loads and every asset 404s: a blank page with no server error. `rebase
|
|
116
|
+
* build` passes it as `REBASE_APP_BASE` and asserts the emitted HTML honours
|
|
117
|
+
* it. Changing this value requires rebuilding the app.
|
|
118
|
+
*/
|
|
119
|
+
path?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Serve `index.html` for unmatched paths under `path` (client-side routing).
|
|
88
122
|
* Default `true` — the overwhelmingly common case for a client app, and a
|
|
89
123
|
* static *site* generator emits real files for its routes anyway.
|
|
90
124
|
*/
|
|
91
125
|
spa?: boolean;
|
|
92
126
|
}
|
|
127
|
+
export type RebaseAppConfig = RebaseBackendAppConfig | RebaseStaticAppConfig;
|
|
93
128
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* `hosted` is the default and means the platform serves it — nothing is built
|
|
97
|
-
* into this repository and nothing ships in the bundle. `bundled` builds it here,
|
|
98
|
-
* which is what a self-hosted or air-gapped deployment wants.
|
|
99
|
-
*/
|
|
100
|
-
export interface RebaseAdminAppConfig {
|
|
101
|
-
type: "admin";
|
|
102
|
-
mode?: "hosted" | "bundled";
|
|
103
|
-
/** Only for `bundled`: package directory containing the admin sources. */
|
|
104
|
-
root?: string;
|
|
105
|
-
/** Only for `bundled`: build command. */
|
|
106
|
-
build?: string;
|
|
107
|
-
/** Only for `bundled`: directory of built assets. */
|
|
108
|
-
output?: string;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* A native app. Registered for credentials and configuration; never built here.
|
|
112
|
-
*/
|
|
113
|
-
export interface RebaseMobileAppConfig {
|
|
114
|
-
type: "mobile";
|
|
115
|
-
platform: "ios" | "android" | "other";
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* An app built from a Dockerfile into an arbitrary image.
|
|
129
|
+
* One declared storage source, as authored in `rebase.json`.
|
|
119
130
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
131
|
+
* The key comes from the enclosing record, so this is
|
|
132
|
+
* {@link StorageSourceDefinition} minus its `key` — the same document the
|
|
133
|
+
* runtime registry and the frontend router consume, expressed the way a JSON
|
|
134
|
+
* object naturally expresses "a set of named things".
|
|
124
135
|
*/
|
|
125
|
-
export interface
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
export interface RebaseStorageSourceConfig {
|
|
137
|
+
/** Engine backing this source: `local`, `s3`, `gcs`, or a custom id. */
|
|
138
|
+
engine: string;
|
|
139
|
+
/**
|
|
140
|
+
* How the frontend reaches it. Default `server` (proxied through
|
|
141
|
+
* `/api/storage`). `direct` means a provider SDK talks to the bucket and the
|
|
142
|
+
* backend is not in the upload path.
|
|
143
|
+
*/
|
|
144
|
+
transport?: "server" | "direct";
|
|
145
|
+
/** Human-readable label for the console and the admin UI. */
|
|
146
|
+
label?: string;
|
|
133
147
|
}
|
|
134
|
-
export type RebaseAppConfig = RebaseBackendAppConfig | RebaseStaticAppConfig | RebaseAdminAppConfig | RebaseMobileAppConfig | RebaseCustomAppConfig;
|
|
135
148
|
/**
|
|
136
149
|
* `rebase.json` — the authored project manifest.
|
|
137
150
|
*/
|
|
@@ -139,13 +152,17 @@ export interface RebaseProjectManifest {
|
|
|
139
152
|
/** JSON Schema URL, for editor completion. Ignored by the tooling. */
|
|
140
153
|
$schema?: string;
|
|
141
154
|
/**
|
|
142
|
-
* The runtime **major** this project targets, as a semver range
|
|
155
|
+
* The runtime contract **major** this project targets, as a semver range
|
|
143
156
|
* (e.g. `^1`, `~1.4`, or an exact `1.4.2` to pin).
|
|
144
157
|
*
|
|
145
158
|
* The platform upgrades patches and minors underneath a project without
|
|
146
159
|
* asking; it never crosses a major. See {@link RUNTIME_CONTRACT_VERSION}.
|
|
160
|
+
*
|
|
161
|
+
* Named `rebase` rather than `runtime` so that `runtime` means exactly one
|
|
162
|
+
* thing — {@link RebaseBackendAppConfig.runtime}, who owns the process. It
|
|
163
|
+
* reads like `engines` in a `package.json`, which is what it is.
|
|
147
164
|
*/
|
|
148
|
-
|
|
165
|
+
rebase: string;
|
|
149
166
|
/**
|
|
150
167
|
* Apps this repository contributes, keyed by app name. The key is the app's
|
|
151
168
|
* identity within the project: it is what `rebase deploy <app>` names, what
|
|
@@ -153,6 +170,28 @@ export interface RebaseProjectManifest {
|
|
|
153
170
|
* not collide with.
|
|
154
171
|
*/
|
|
155
172
|
apps: Record<string, RebaseAppConfig>;
|
|
173
|
+
/**
|
|
174
|
+
* Storage sources this project uses, keyed by source key.
|
|
175
|
+
*
|
|
176
|
+
* **Topology only — never credentials.** Which buckets exist is a property of
|
|
177
|
+
* the project and belongs in the repository; how to reach each one is a
|
|
178
|
+
* property of the deployment and lives in the environment, read per source
|
|
179
|
+
* from `<BASE>__<KEY>` (`S3_BUCKET__MEDIA` for a source keyed `media`). The
|
|
180
|
+
* default source takes no suffix, so a single-bucket project configured with
|
|
181
|
+
* plain `S3_BUCKET` keeps working having declared nothing at all.
|
|
182
|
+
*
|
|
183
|
+
* Declared here rather than only in the config package because this file is
|
|
184
|
+
* the one artifact a host can read *before* running a build. That is what
|
|
185
|
+
* lets a console show "this project wants a `media` bucket, and it has none"
|
|
186
|
+
* on a project's first deploy, and it is why the managed and custom runtimes
|
|
187
|
+
* can present the same list — a custom build emits no bundle manifest, so a
|
|
188
|
+
* declaration that lived only in compiled config would leave every custom
|
|
189
|
+
* project invisible.
|
|
190
|
+
*
|
|
191
|
+
* Omitted entirely means one default source, which is the overwhelmingly
|
|
192
|
+
* common project and must not be required to say so.
|
|
193
|
+
*/
|
|
194
|
+
storage?: Record<string, RebaseStorageSourceConfig>;
|
|
156
195
|
}
|
|
157
196
|
/**
|
|
158
197
|
* The per-checkout project link.
|
|
@@ -192,8 +231,16 @@ export interface ManagedCompatibility {
|
|
|
192
231
|
* not read. A runtime accepts any bundle whose `bundleFormat` is less than or
|
|
193
232
|
* equal to its own — old bundles keep booting on new runtimes, which is the
|
|
194
233
|
* whole point of separating the artifact from the engine.
|
|
234
|
+
*
|
|
235
|
+
* - **1** — `mode: "cms" | "baas" | "static"`, `entry.static` a single directory
|
|
236
|
+
* string, `entry.admin` for a bundled admin panel.
|
|
237
|
+
* - **2** — `kind: "backend" | "static"`, `entry.static` a list of
|
|
238
|
+
* {@link RebaseBundleStatic}, `entry.admin` removed. A format-1 runtime reading
|
|
239
|
+
* one of these would find no `mode` and an array where it expects a string, so
|
|
240
|
+
* the bump is what turns that into a refusal to boot instead of a bundle that
|
|
241
|
+
* starts and serves nothing.
|
|
195
242
|
*/
|
|
196
|
-
export declare const BUNDLE_FORMAT_VERSION =
|
|
243
|
+
export declare const BUNDLE_FORMAT_VERSION = 2;
|
|
197
244
|
/**
|
|
198
245
|
* The runtime contract major.
|
|
199
246
|
*
|
|
@@ -217,10 +264,24 @@ export interface RebaseBundleEntrypoints {
|
|
|
217
264
|
schema?: string;
|
|
218
265
|
/** Module exporting the auth users collection (default export). */
|
|
219
266
|
usersCollection?: string;
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Built static apps to serve from this process, in declaration order.
|
|
269
|
+
*
|
|
270
|
+
* A list rather than a single directory because one process serves several
|
|
271
|
+
* apps at different paths — a site at `/` and the admin at `/admin`. The
|
|
272
|
+
* runtime mounts them longest-path-first so the `/`-rooted app's catch-all
|
|
273
|
+
* does not claim its siblings' URLs.
|
|
274
|
+
*/
|
|
275
|
+
static?: RebaseBundleStatic[];
|
|
276
|
+
}
|
|
277
|
+
/** One built static app inside a bundle. */
|
|
278
|
+
export interface RebaseBundleStatic {
|
|
279
|
+
/** Public base path, e.g. `/` or `/admin`. */
|
|
280
|
+
path: string;
|
|
281
|
+
/** Bundle-relative directory holding the built assets. */
|
|
282
|
+
dir: string;
|
|
283
|
+
/** Serve `index.html` for unmatched paths under `path`. */
|
|
284
|
+
spa: boolean;
|
|
224
285
|
}
|
|
225
286
|
/**
|
|
226
287
|
* A native module found in the dependency closure.
|
|
@@ -263,15 +324,17 @@ export interface RebaseBundleManifest {
|
|
|
263
324
|
/**
|
|
264
325
|
* What the runtime does with this bundle.
|
|
265
326
|
*
|
|
266
|
-
* - `
|
|
267
|
-
*
|
|
268
|
-
* - `
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
327
|
+
* - `backend` — boot the full server: database, auth and the data API, plus
|
|
328
|
+
* any static apps in `entry.static`.
|
|
329
|
+
* - `static` — no backend at all: serve `entry.static` and nothing else. No
|
|
330
|
+
* database, no auth, no data sources. This is how a static app runs on the
|
|
331
|
+
* same image as the backend.
|
|
332
|
+
*
|
|
333
|
+
* Replaces an earlier `mode: "cms" | "baas" | "static"`. The cms/baas
|
|
334
|
+
* distinction was never a third kind of thing — it is simply whether
|
|
335
|
+
* `entry.config` is present, so it is derived rather than declared.
|
|
273
336
|
*/
|
|
274
|
-
|
|
337
|
+
kind: "backend" | "static";
|
|
275
338
|
entry: RebaseBundleEntrypoints;
|
|
276
339
|
/** Collection slugs contained in the bundle, for quick inspection. */
|
|
277
340
|
collections?: string[];
|
|
@@ -302,6 +365,17 @@ export interface RebaseBundleManifest {
|
|
|
302
365
|
storage?: {
|
|
303
366
|
/** Whether the config package exports a `storageAuthorize` hook. */
|
|
304
367
|
authorize: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Every storage source this bundle expects, resolved at build time from
|
|
370
|
+
* `rebase.json`'s `storage` block merged with any `storageSources` the
|
|
371
|
+
* config package exports.
|
|
372
|
+
*
|
|
373
|
+
* Recorded so the runtime does not have to import user code to learn its
|
|
374
|
+
* own topology, and so a host can tell — from the artifact alone, before
|
|
375
|
+
* starting anything — which buckets need configuring. Absent on bundles
|
|
376
|
+
* built before this field existed, which means one default source.
|
|
377
|
+
*/
|
|
378
|
+
sources?: StorageSourceDefinition[];
|
|
305
379
|
};
|
|
306
380
|
deps: {
|
|
307
381
|
/** Runtime dependencies of user code, as declared. */
|
|
@@ -325,7 +399,6 @@ export interface RebaseProjectContract {
|
|
|
325
399
|
version: string;
|
|
326
400
|
contract: number;
|
|
327
401
|
};
|
|
328
|
-
mode: "cms" | "baas";
|
|
329
402
|
/** Full collection definitions, serialized — the input to SDK generation. */
|
|
330
403
|
collections: unknown[];
|
|
331
404
|
/** Collection slugs, for cheap inspection without parsing the definitions. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities";
|
|
2
2
|
import type { Relation, ResolvedRelation } from "./relations";
|
|
3
|
-
import type { FilterValues } from "./collections";
|
|
4
3
|
import type { ColorKey, ColorScheme } from "./chips";
|
|
5
4
|
import type { AuthState } from "../controllers/auth_state";
|
|
6
5
|
import type { AfterReadProps, BeforeSaveProps } from "./entity_callbacks";
|
|
@@ -35,15 +34,40 @@ export type Property = StringProperty | NumberProperty | BooleanProperty | DateP
|
|
|
35
34
|
export type Properties = {
|
|
36
35
|
[key: string]: Property;
|
|
37
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* `Omit` that survives a union.
|
|
39
|
+
*
|
|
40
|
+
* `Property` is a union discriminated on `type`, and a bare `Omit<Property, K>`
|
|
41
|
+
* collapses it into one object whose `type` is the union of every tag — so
|
|
42
|
+
* `property.type === "string"` stops narrowing and the concrete property types
|
|
43
|
+
* become unreachable. The `T extends unknown` clause makes it distribute, so
|
|
44
|
+
* each member is omitted from separately and keeps its own discriminant.
|
|
45
|
+
*/
|
|
46
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
47
|
+
/**
|
|
48
|
+
* The fields that describe a property's **column**, which only an engine with
|
|
49
|
+
* columns has.
|
|
50
|
+
*
|
|
51
|
+
* `columnType` names a Postgres type (`uuid`, `bigserial`, `jsonb`, `text[]`)
|
|
52
|
+
* and `columnName` overrides the snake_case derivation used to build a column
|
|
53
|
+
* name. `DataSourceCapabilities.supportsColumnTypes` already reported this at
|
|
54
|
+
* runtime — `false` for both document engines — while the types let a MongoDB
|
|
55
|
+
* property declare `columnType: "bigserial"`.
|
|
56
|
+
*
|
|
57
|
+
* They stay declared on the concrete property interfaces rather than moving,
|
|
58
|
+
* because that is where their per-type value unions live; what changes is that
|
|
59
|
+
* the document engines' property aliases omit them.
|
|
60
|
+
*/
|
|
61
|
+
type SqlColumnFields = "columnType" | "columnName";
|
|
38
62
|
export type PostgresProperty = Exclude<Property, ReferenceProperty>;
|
|
39
63
|
export type PostgresProperties = {
|
|
40
64
|
[key: string]: PostgresProperty;
|
|
41
65
|
};
|
|
42
|
-
export type FirebaseProperty = Exclude<Property, RelationProperty>;
|
|
66
|
+
export type FirebaseProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
|
|
43
67
|
export type FirebaseProperties = {
|
|
44
68
|
[key: string]: FirebaseProperty;
|
|
45
69
|
};
|
|
46
|
-
export type MongoProperty = Exclude<Property, RelationProperty>;
|
|
70
|
+
export type MongoProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
|
|
47
71
|
export type MongoProperties = {
|
|
48
72
|
[key: string]: MongoProperty;
|
|
49
73
|
};
|
|
@@ -113,7 +137,7 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
113
137
|
description?: string;
|
|
114
138
|
/**
|
|
115
139
|
* You can use this prop to reuse a property that has been defined
|
|
116
|
-
* in the top level of the
|
|
140
|
+
* in the top level of the admin in the prop `fields`.
|
|
117
141
|
* All the configuration will be taken from the inherited config, and
|
|
118
142
|
* overwritten by the current property config.
|
|
119
143
|
*/
|
|
@@ -398,19 +422,6 @@ export interface ReferenceProperty extends BaseProperty {
|
|
|
398
422
|
* property.
|
|
399
423
|
*/
|
|
400
424
|
path?: string;
|
|
401
|
-
/**
|
|
402
|
-
* Allow selection of entities that pass the given filter only.
|
|
403
|
-
* e.g. `fixedFilter: { age: [">=", 18] }`
|
|
404
|
-
*/
|
|
405
|
-
fixedFilter?: FilterValues<string>;
|
|
406
|
-
/**
|
|
407
|
-
* Should the reference include the ID of the entity. Defaults to `true`
|
|
408
|
-
*/
|
|
409
|
-
includeId?: boolean;
|
|
410
|
-
/**
|
|
411
|
-
* Should the reference include a link to the entity (open the entity details). Defaults to `true`
|
|
412
|
-
*/
|
|
413
|
-
includeEntityLink?: boolean;
|
|
414
425
|
}
|
|
415
426
|
/**
|
|
416
427
|
* A schema-level relationship between collections **within a single
|
|
@@ -469,24 +480,6 @@ export interface RelationProperty extends BaseProperty {
|
|
|
469
480
|
* collection's `relations` array.
|
|
470
481
|
*/
|
|
471
482
|
resolvedRelation?: ResolvedRelation;
|
|
472
|
-
/**
|
|
473
|
-
* Allow selection of entities that pass the given filter only.
|
|
474
|
-
* e.g. `fixedFilter: { age: [">=", 18] }`
|
|
475
|
-
*/
|
|
476
|
-
fixedFilter?: FilterValues<string>;
|
|
477
|
-
/**
|
|
478
|
-
* Should the reference include the ID of the entity. Defaults to `true`
|
|
479
|
-
*/
|
|
480
|
-
includeId?: boolean;
|
|
481
|
-
/**
|
|
482
|
-
* Should the reference include a link to the entity (open the entity details). Defaults to `true`
|
|
483
|
-
*/
|
|
484
|
-
includeEntityLink?: boolean;
|
|
485
|
-
/**
|
|
486
|
-
* Choose the widget to use for selecting the relation.
|
|
487
|
-
* Defaults to `select`.
|
|
488
|
-
*/
|
|
489
|
-
widget?: "select" | "dialog";
|
|
490
483
|
}
|
|
491
484
|
export interface ArrayProperty extends BaseProperty {
|
|
492
485
|
type: "array";
|
|
@@ -549,16 +542,6 @@ export interface ArrayProperty extends BaseProperty {
|
|
|
549
542
|
* Rules for validating this property
|
|
550
543
|
*/
|
|
551
544
|
validation?: ArrayPropertyValidationSchema;
|
|
552
|
-
/**
|
|
553
|
-
* Can the elements in this array be reordered. Defaults to `true`.
|
|
554
|
-
* This prop has no effect if `disabled` is set to true.
|
|
555
|
-
*/
|
|
556
|
-
sortable?: boolean;
|
|
557
|
-
/**
|
|
558
|
-
* Can the elements in this array be added. Defaults to `true`
|
|
559
|
-
* This prop has no effect if `disabled` is set to true.
|
|
560
|
-
*/
|
|
561
|
-
canAddElements?: boolean;
|
|
562
545
|
}
|
|
563
546
|
export interface MapProperty extends BaseProperty {
|
|
564
547
|
type: "map";
|
|
@@ -578,6 +561,12 @@ export interface MapProperty extends BaseProperty {
|
|
|
578
561
|
* Order in which the properties are displayed.
|
|
579
562
|
* If you are specifying your collection as code, the order is the same as the
|
|
580
563
|
* one you define in `properties`, and you don't need to specify this prop.
|
|
564
|
+
*
|
|
565
|
+
* Stays on the property rather than moving to the `admin` block, unlike the
|
|
566
|
+
* rest of the map's presentation options: `sortProperties` in
|
|
567
|
+
* `@rebasepro/common` reads it recursively, and `@rebasepro/firebase` calls
|
|
568
|
+
* that when it builds collections. A core package cannot read the admin
|
|
569
|
+
* block — the field exists only once `@rebasepro/admin-types` is installed.
|
|
581
570
|
*/
|
|
582
571
|
propertiesOrder?: string[];
|
|
583
572
|
/**
|
|
@@ -586,13 +575,13 @@ export interface MapProperty extends BaseProperty {
|
|
|
586
575
|
* will be considered valid, even if you set `required` in the properties.
|
|
587
576
|
*/
|
|
588
577
|
validation?: PropertyValidationSchema;
|
|
589
|
-
/**
|
|
590
|
-
* Properties that are displayed when rendered as a preview
|
|
591
|
-
*/
|
|
592
|
-
previewProperties?: string[];
|
|
593
578
|
/**
|
|
594
579
|
* Render this map as a key-value table that allows to use
|
|
595
580
|
* arbitrary keys. You don't need to define the properties in this case.
|
|
581
|
+
*
|
|
582
|
+
* Core rather than admin despite the wording: it says the map has no
|
|
583
|
+
* declared shape, which is what the OpenAPI generator emits the schema
|
|
584
|
+
* from (`additionalProperties` instead of a property list).
|
|
596
585
|
*/
|
|
597
586
|
keyValue?: boolean;
|
|
598
587
|
}
|
|
@@ -81,3 +81,63 @@ export interface ResolvedStorageSource {
|
|
|
81
81
|
/** Human-readable label. */
|
|
82
82
|
label?: string;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The environment-variable suffix for a storage or data source key.
|
|
86
|
+
*
|
|
87
|
+
* `""` for the default source — so a single-bucket project keeps configuring
|
|
88
|
+
* plain `S3_BUCKET` — and `__<KEY>` for every named one, uppercased with
|
|
89
|
+
* non-alphanumerics collapsed to underscores: `media-cdn` → `S3_BUCKET__MEDIA_CDN`.
|
|
90
|
+
*
|
|
91
|
+
* The rule derives the variable name from the declared key rather than
|
|
92
|
+
* discovering keys by scanning the environment. Scanning would have to guess how
|
|
93
|
+
* `S3_BUCKET__MEDIA_CDN` splits into a key; deriving cannot be ambiguous, and a
|
|
94
|
+
* typo surfaces as a missing source at boot instead of a silently ignored
|
|
95
|
+
* variable.
|
|
96
|
+
*
|
|
97
|
+
* It lives in this package, with no dependencies, because four things must agree
|
|
98
|
+
* on it exactly: the CLI (validating a build), the runtime (reading its own
|
|
99
|
+
* environment), the control plane (writing a tenant's Secret), and the docs. A
|
|
100
|
+
* second implementation of a naming convention is a second chance to disagree.
|
|
101
|
+
*
|
|
102
|
+
* @group Models
|
|
103
|
+
*/
|
|
104
|
+
export declare function storageEnvSuffix(key: string, defaultKey?: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Two distinct keys that collapse onto the same variable name, or `null`.
|
|
107
|
+
*
|
|
108
|
+
* `media-cdn` and `media_cdn` are different source keys but the same suffix, so
|
|
109
|
+
* without this one of them silently reads the other's configuration. Returns the
|
|
110
|
+
* offending pair rather than throwing, so each caller can raise it in its own
|
|
111
|
+
* idiom — a `BundleError` at boot, a build failure in the CLI, a rejected deploy
|
|
112
|
+
* in a control plane.
|
|
113
|
+
*
|
|
114
|
+
* @group Models
|
|
115
|
+
*/
|
|
116
|
+
export declare function findStorageSuffixCollision(keys: string[], defaultKey?: string): {
|
|
117
|
+
a: string;
|
|
118
|
+
b: string;
|
|
119
|
+
suffix: string;
|
|
120
|
+
} | null;
|
|
121
|
+
/** The `storage` block of `rebase.json`, structurally. */
|
|
122
|
+
export type DeclaredStorageSources = Record<string, {
|
|
123
|
+
engine: string;
|
|
124
|
+
transport?: StorageSourceTransport;
|
|
125
|
+
label?: string;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Merge the two places a project may declare storage sources into one list.
|
|
129
|
+
*
|
|
130
|
+
* `rebase.json` is authoritative for every field it states. Config code may add
|
|
131
|
+
* sources it does not mention and fill in fields it left out, but may not
|
|
132
|
+
* contradict it: the manifest is what a host reads to decide which buckets need
|
|
133
|
+
* configuring, and a runtime that quietly disagreed with it would put the
|
|
134
|
+
* console back to describing a topology the tenant does not have — the exact
|
|
135
|
+
* failure this whole mechanism exists to end.
|
|
136
|
+
*
|
|
137
|
+
* Note what is *not* here: no default source is invented when both inputs are
|
|
138
|
+
* empty. That decision belongs to the resolver, which knows whether declaring
|
|
139
|
+
* nothing means "one plain bucket" (it does) or "no storage at all".
|
|
140
|
+
*
|
|
141
|
+
* @group Models
|
|
142
|
+
*/
|
|
143
|
+
export declare function normalizeStorageSources(declared: DeclaredStorageSources | StorageSourceDefinition[] | undefined, exported: StorageSourceDefinition[] | undefined): StorageSourceDefinition[];
|
|
@@ -115,40 +115,3 @@ export interface ChannelHistoryMessage extends WebSocketMessage {
|
|
|
115
115
|
*/
|
|
116
116
|
latestSeq?: number;
|
|
117
117
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Column metadata returned by table introspection.
|
|
120
|
-
*/
|
|
121
|
-
export interface TableColumnInfo {
|
|
122
|
-
column_name: string;
|
|
123
|
-
data_type: string;
|
|
124
|
-
udt_name: string;
|
|
125
|
-
is_nullable: string;
|
|
126
|
-
column_default: string | null;
|
|
127
|
-
character_maximum_length: number | null;
|
|
128
|
-
/** Enum values, populated for USER-DEFINED (enum) columns */
|
|
129
|
-
enum_values?: string[];
|
|
130
|
-
}
|
|
131
|
-
export interface TableForeignKeyInfo {
|
|
132
|
-
column_name: string;
|
|
133
|
-
foreign_table_name: string;
|
|
134
|
-
foreign_column_name: string;
|
|
135
|
-
}
|
|
136
|
-
export interface TableJunctionInfo {
|
|
137
|
-
junction_table_name: string;
|
|
138
|
-
source_column_name: string;
|
|
139
|
-
target_table_name: string;
|
|
140
|
-
target_column_name: string;
|
|
141
|
-
}
|
|
142
|
-
export interface TablePolicyInfo {
|
|
143
|
-
policy_name: string;
|
|
144
|
-
roles: string[];
|
|
145
|
-
cmd: string;
|
|
146
|
-
qual?: string;
|
|
147
|
-
with_check?: string;
|
|
148
|
-
}
|
|
149
|
-
export interface TableMetadata {
|
|
150
|
-
columns: TableColumnInfo[];
|
|
151
|
-
foreignKeys: TableForeignKeyInfo[];
|
|
152
|
-
junctions: TableJunctionInfo[];
|
|
153
|
-
policies: TablePolicyInfo[];
|
|
154
|
-
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ export type CollectionRegistryController<
|
|
|
11
11
|
> = {
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* List of the mapped collections in the
|
|
14
|
+
* List of the mapped collections in the admin.
|
|
15
15
|
* Each entry relates to a collection in the root database.
|
|
16
16
|
* Each of the navigation entries in this field
|
|
17
17
|
* generates an entry in the main menu.
|