@rebasepro/types 0.11.0 → 0.11.1-canary.g8caabf3
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 +9 -9
- package/dist/index.es.js +9 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/data_source.d.ts +1 -1
- package/dist/types/database_adapter.d.ts +13 -8
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/project_manifest.d.ts +96 -77
- package/dist/types/properties.d.ts +1 -1
- package/package.json +1 -1
- package/src/controllers/collection_registry.ts +1 -1
- package/src/controllers/data.ts +9 -9
- package/src/types/collections.ts +0 -1
- package/src/types/data_source.ts +1 -1
- package/src/types/database_adapter.ts +13 -8
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/project_manifest.ts +98 -85
- package/src/types/properties.ts +1 -1
|
@@ -30,25 +30,43 @@
|
|
|
30
30
|
*
|
|
31
31
|
* - `backend` — the collections/hooks/functions that define the project's API.
|
|
32
32
|
* Exactly one per *project* (not per repository); the registry enforces it.
|
|
33
|
-
* - `static` — a pre-built client bundle (SPA, static site) served
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* 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.
|
|
40
39
|
*/
|
|
41
|
-
export type RebaseAppType = "backend" | "static"
|
|
40
|
+
export type RebaseAppType = "backend" | "static";
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* The backend app: the project's API surface.
|
|
45
44
|
*
|
|
46
45
|
* Paths are relative to the directory holding `rebase.json`. The defaults match
|
|
47
46
|
* the layout `rebase init` scaffolds, so a stock project may declare simply
|
|
48
|
-
* `{ "type": "backend" }`.
|
|
47
|
+
* `{ "type": "backend", "runtime": "managed" }`.
|
|
49
48
|
*/
|
|
50
49
|
export interface RebaseBackendAppConfig {
|
|
51
50
|
type: "backend";
|
|
51
|
+
/**
|
|
52
|
+
* Who owns the process this backend runs in.
|
|
53
|
+
*
|
|
54
|
+
* - `managed` — the platform's runtime image boots this project's bundle.
|
|
55
|
+
* You supply collections, functions, crons and schema; Rebase supplies the
|
|
56
|
+
* server.
|
|
57
|
+
* - `custom` — this repository builds its own image and entrypoint. The
|
|
58
|
+
* escape hatch: full control, no managed-runtime guarantees.
|
|
59
|
+
*
|
|
60
|
+
* Independent of *where* it runs. Both run on Rebase Cloud and both
|
|
61
|
+
* self-host — the destination lives in `.rebase/cloud.json`, not here. See
|
|
62
|
+
* `docker/docker-compose.selfhost.yml`, which boots a managed bundle on a
|
|
63
|
+
* developer's own Docker host.
|
|
64
|
+
*
|
|
65
|
+
* This is authored rather than inferred on purpose. It is the single most
|
|
66
|
+
* consequential fact about a deployment, and inferring it is what used to
|
|
67
|
+
* land projects on the custom runtime without anyone choosing it.
|
|
68
|
+
*/
|
|
69
|
+
runtime: "managed" | "custom";
|
|
52
70
|
/** Directory of the config package (collections + index). Default `config`. */
|
|
53
71
|
config?: string;
|
|
54
72
|
/** Directory of server functions. Default `backend/functions`. */
|
|
@@ -60,23 +78,25 @@ export interface RebaseBackendAppConfig {
|
|
|
60
78
|
* Default `backend/src/schema.generated.ts`.
|
|
61
79
|
*/
|
|
62
80
|
schema?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Which collections source the runtime uses.
|
|
65
|
-
*
|
|
66
|
-
* - `cms` (default) — collections come from the config package.
|
|
67
|
-
* - `baas` — collections are introspected from the live database at boot and
|
|
68
|
-
* the config package is not required.
|
|
69
|
-
*/
|
|
70
|
-
mode?: "cms" | "baas";
|
|
71
81
|
/**
|
|
72
82
|
* Module path (relative to `config`) exporting the auth users collection as
|
|
73
83
|
* its default export. Default `collections/users`.
|
|
74
84
|
*/
|
|
75
85
|
usersCollection?: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* `runtime: "custom"` only. Dockerfile path relative to the repository root.
|
|
89
|
+
* Default `Dockerfile`.
|
|
90
|
+
*/
|
|
91
|
+
dockerfile?: string;
|
|
92
|
+
/** `runtime: "custom"` only. Build context relative to the root. Default `.`. */
|
|
93
|
+
context?: string;
|
|
94
|
+
/** `runtime: "custom"` only. Port the container listens on. Default 8080. */
|
|
95
|
+
port?: number;
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
/**
|
|
79
|
-
* A static client bundle — SPA or static site — built here and served
|
|
99
|
+
* A static client bundle — SPA or static site — built here and served at `path`.
|
|
80
100
|
*/
|
|
81
101
|
export interface RebaseStaticAppConfig {
|
|
82
102
|
type: "static";
|
|
@@ -87,63 +107,28 @@ export interface RebaseStaticAppConfig {
|
|
|
87
107
|
/** Directory of built assets, relative to the repository root. */
|
|
88
108
|
output: string;
|
|
89
109
|
/**
|
|
90
|
-
*
|
|
110
|
+
* Public base path this app is served under. Default `/`.
|
|
111
|
+
*
|
|
112
|
+
* Several static apps run in one process, each at its own path — the API at
|
|
113
|
+
* `/api`, a site at `/`, the admin at `/admin` — which is what keeps a
|
|
114
|
+
* self-hosted deployment a single container.
|
|
115
|
+
*
|
|
116
|
+
* **This is a build-time input, not only a serving concern.** An app mounted
|
|
117
|
+
* at `/admin` must be *built* for `/admin` (Vite's `base`), or `index.html`
|
|
118
|
+
* loads and every asset 404s: a blank page with no server error. `rebase
|
|
119
|
+
* build` passes it as `REBASE_APP_BASE` and asserts the emitted HTML honours
|
|
120
|
+
* it. Changing this value requires rebuilding the app.
|
|
121
|
+
*/
|
|
122
|
+
path?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Serve `index.html` for unmatched paths under `path` (client-side routing).
|
|
91
125
|
* Default `true` — the overwhelmingly common case for a client app, and a
|
|
92
126
|
* static *site* generator emits real files for its routes anyway.
|
|
93
127
|
*/
|
|
94
128
|
spa?: boolean;
|
|
95
129
|
}
|
|
96
130
|
|
|
97
|
-
|
|
98
|
-
* The admin panel.
|
|
99
|
-
*
|
|
100
|
-
* `hosted` is the default and means the platform serves it — nothing is built
|
|
101
|
-
* into this repository and nothing ships in the bundle. `bundled` builds it here,
|
|
102
|
-
* which is what a self-hosted or air-gapped deployment wants.
|
|
103
|
-
*/
|
|
104
|
-
export interface RebaseAdminAppConfig {
|
|
105
|
-
type: "admin";
|
|
106
|
-
mode?: "hosted" | "bundled";
|
|
107
|
-
/** Only for `bundled`: package directory containing the admin sources. */
|
|
108
|
-
root?: string;
|
|
109
|
-
/** Only for `bundled`: build command. */
|
|
110
|
-
build?: string;
|
|
111
|
-
/** Only for `bundled`: directory of built assets. */
|
|
112
|
-
output?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* A native app. Registered for credentials and configuration; never built here.
|
|
117
|
-
*/
|
|
118
|
-
export interface RebaseMobileAppConfig {
|
|
119
|
-
type: "mobile";
|
|
120
|
-
platform: "ios" | "android" | "other";
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* An app built from a Dockerfile into an arbitrary image.
|
|
125
|
-
*
|
|
126
|
-
* This is the deliberate escape hatch. A project containing one is not eligible
|
|
127
|
-
* for the managed runtime — the platform cannot make guarantees about an image
|
|
128
|
-
* it did not build — but it still deploys, and nothing else about the project
|
|
129
|
-
* changes.
|
|
130
|
-
*/
|
|
131
|
-
export interface RebaseCustomAppConfig {
|
|
132
|
-
type: "custom";
|
|
133
|
-
/** Dockerfile path relative to the repository root. */
|
|
134
|
-
dockerfile?: string;
|
|
135
|
-
/** Build context relative to the repository root. Default `.`. */
|
|
136
|
-
context?: string;
|
|
137
|
-
/** Port the container listens on. Default 8080. */
|
|
138
|
-
port?: number;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export type RebaseAppConfig =
|
|
142
|
-
| RebaseBackendAppConfig
|
|
143
|
-
| RebaseStaticAppConfig
|
|
144
|
-
| RebaseAdminAppConfig
|
|
145
|
-
| RebaseMobileAppConfig
|
|
146
|
-
| RebaseCustomAppConfig;
|
|
131
|
+
export type RebaseAppConfig = RebaseBackendAppConfig | RebaseStaticAppConfig;
|
|
147
132
|
|
|
148
133
|
/**
|
|
149
134
|
* `rebase.json` — the authored project manifest.
|
|
@@ -152,13 +137,17 @@ export interface RebaseProjectManifest {
|
|
|
152
137
|
/** JSON Schema URL, for editor completion. Ignored by the tooling. */
|
|
153
138
|
$schema?: string;
|
|
154
139
|
/**
|
|
155
|
-
* The runtime **major** this project targets, as a semver range
|
|
140
|
+
* The runtime contract **major** this project targets, as a semver range
|
|
156
141
|
* (e.g. `^1`, `~1.4`, or an exact `1.4.2` to pin).
|
|
157
142
|
*
|
|
158
143
|
* The platform upgrades patches and minors underneath a project without
|
|
159
144
|
* asking; it never crosses a major. See {@link RUNTIME_CONTRACT_VERSION}.
|
|
145
|
+
*
|
|
146
|
+
* Named `rebase` rather than `runtime` so that `runtime` means exactly one
|
|
147
|
+
* thing — {@link RebaseBackendAppConfig.runtime}, who owns the process. It
|
|
148
|
+
* reads like `engines` in a `package.json`, which is what it is.
|
|
160
149
|
*/
|
|
161
|
-
|
|
150
|
+
rebase: string;
|
|
162
151
|
/**
|
|
163
152
|
* Apps this repository contributes, keyed by app name. The key is the app's
|
|
164
153
|
* identity within the project: it is what `rebase deploy <app>` names, what
|
|
@@ -212,8 +201,16 @@ export interface ManagedCompatibility {
|
|
|
212
201
|
* not read. A runtime accepts any bundle whose `bundleFormat` is less than or
|
|
213
202
|
* equal to its own — old bundles keep booting on new runtimes, which is the
|
|
214
203
|
* whole point of separating the artifact from the engine.
|
|
204
|
+
*
|
|
205
|
+
* - **1** — `mode: "cms" | "baas" | "static"`, `entry.static` a single directory
|
|
206
|
+
* string, `entry.admin` for a bundled admin panel.
|
|
207
|
+
* - **2** — `kind: "backend" | "static"`, `entry.static` a list of
|
|
208
|
+
* {@link RebaseBundleStatic}, `entry.admin` removed. A format-1 runtime reading
|
|
209
|
+
* one of these would find no `mode` and an array where it expects a string, so
|
|
210
|
+
* the bump is what turns that into a refusal to boot instead of a bundle that
|
|
211
|
+
* starts and serves nothing.
|
|
215
212
|
*/
|
|
216
|
-
export const BUNDLE_FORMAT_VERSION =
|
|
213
|
+
export const BUNDLE_FORMAT_VERSION = 2;
|
|
217
214
|
|
|
218
215
|
/**
|
|
219
216
|
* The runtime contract major.
|
|
@@ -239,10 +236,25 @@ export interface RebaseBundleEntrypoints {
|
|
|
239
236
|
schema?: string;
|
|
240
237
|
/** Module exporting the auth users collection (default export). */
|
|
241
238
|
usersCollection?: string;
|
|
242
|
-
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Built static apps to serve from this process, in declaration order.
|
|
241
|
+
*
|
|
242
|
+
* A list rather than a single directory because one process serves several
|
|
243
|
+
* apps at different paths — a site at `/` and the admin at `/admin`. The
|
|
244
|
+
* runtime mounts them longest-path-first so the `/`-rooted app's catch-all
|
|
245
|
+
* does not claim its siblings' URLs.
|
|
246
|
+
*/
|
|
247
|
+
static?: RebaseBundleStatic[];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** One built static app inside a bundle. */
|
|
251
|
+
export interface RebaseBundleStatic {
|
|
252
|
+
/** Public base path, e.g. `/` or `/admin`. */
|
|
253
|
+
path: string;
|
|
254
|
+
/** Bundle-relative directory holding the built assets. */
|
|
255
|
+
dir: string;
|
|
256
|
+
/** Serve `index.html` for unmatched paths under `path`. */
|
|
257
|
+
spa: boolean;
|
|
246
258
|
}
|
|
247
259
|
|
|
248
260
|
/**
|
|
@@ -287,15 +299,17 @@ export interface RebaseBundleManifest {
|
|
|
287
299
|
/**
|
|
288
300
|
* What the runtime does with this bundle.
|
|
289
301
|
*
|
|
290
|
-
* - `
|
|
291
|
-
*
|
|
292
|
-
* - `
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
302
|
+
* - `backend` — boot the full server: database, auth and the data API, plus
|
|
303
|
+
* any static apps in `entry.static`.
|
|
304
|
+
* - `static` — no backend at all: serve `entry.static` and nothing else. No
|
|
305
|
+
* database, no auth, no data sources. This is how a static app runs on the
|
|
306
|
+
* same image as the backend.
|
|
307
|
+
*
|
|
308
|
+
* Replaces an earlier `mode: "cms" | "baas" | "static"`. The cms/baas
|
|
309
|
+
* distinction was never a third kind of thing — it is simply whether
|
|
310
|
+
* `entry.config` is present, so it is derived rather than declared.
|
|
297
311
|
*/
|
|
298
|
-
|
|
312
|
+
kind: "backend" | "static";
|
|
299
313
|
entry: RebaseBundleEntrypoints;
|
|
300
314
|
/** Collection slugs contained in the bundle, for quick inspection. */
|
|
301
315
|
collections?: string[];
|
|
@@ -350,7 +364,6 @@ export interface RebaseProjectContract {
|
|
|
350
364
|
version: string;
|
|
351
365
|
contract: number;
|
|
352
366
|
};
|
|
353
|
-
mode: "cms" | "baas";
|
|
354
367
|
/** Full collection definitions, serialized — the input to SDK generation. */
|
|
355
368
|
collections: unknown[];
|
|
356
369
|
/** Collection slugs, for cheap inspection without parsing the definitions. */
|
package/src/types/properties.ts
CHANGED
|
@@ -164,7 +164,7 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* You can use this prop to reuse a property that has been defined
|
|
167
|
-
* in the top level of the
|
|
167
|
+
* in the top level of the admin in the prop `fields`.
|
|
168
168
|
* All the configuration will be taken from the inherited config, and
|
|
169
169
|
* overwritten by the current property config.
|
|
170
170
|
*/
|