@protobase/cli 0.75.2 → 0.76.1
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/build/bundle-mobile.js +6 -5
- package/dist/build/config-bundle.js +2 -1
- package/dist/build/deploy-bundle.js +2 -2
- package/dist/bundle/manifest.js +1 -1
- package/dist/cli/package.js +1 -1
- package/package.json +8 -8
- package/skills/protobase/references/features/workflows.md +2 -2
- package/skills/protobase/references/reference/cli.md +3 -3
- package/skills/protobase/references/reference/mcp.md +1 -1
- package/skills/protobase/references/reference/notifications.md +1 -1
- package/skills/protobase/references/reference/workflows.md +4 -0
|
@@ -2,16 +2,17 @@ import { checkMobileConfig } from "../mobile/mobile-config.js";
|
|
|
2
2
|
//#region src/build/bundle-mobile.ts
|
|
3
3
|
/**
|
|
4
4
|
* What the manifest says of the config's `mobile` section, checked as `protobase mobile` checks it: its app id, which a
|
|
5
|
-
* host that never runs the config binds in the release's statement, and its plugins, empty when it gives none,
|
|
6
|
-
* fingerprints the mobile release
|
|
7
|
-
*
|
|
5
|
+
* host that never runs the config binds in the release's statement, and its plugins, empty when it gives none, and
|
|
6
|
+
* `push`, the config's `notifications()`, with which it fingerprints the mobile release. `undefined` without a section,
|
|
7
|
+
* so its presence means the app has a mobile build.
|
|
8
8
|
*/
|
|
9
|
-
const bundleMobile = (section) => {
|
|
9
|
+
const bundleMobile = (section, push) => {
|
|
10
10
|
if (section === void 0) return;
|
|
11
11
|
const { appId, plugins } = checkMobileConfig(section);
|
|
12
12
|
return {
|
|
13
13
|
appId,
|
|
14
|
-
plugins: plugins ?? {}
|
|
14
|
+
plugins: plugins ?? {},
|
|
15
|
+
push
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
18
|
//#endregion
|
|
@@ -99,7 +99,8 @@ const buildConfigBundle = async ({ projectDir, outFile, bun, extensions = [], co
|
|
|
99
99
|
});
|
|
100
100
|
return {
|
|
101
101
|
native: [...native.values()],
|
|
102
|
-
mobile: config.mobile
|
|
102
|
+
mobile: config.mobile,
|
|
103
|
+
notifications: Boolean(config.notifications)
|
|
103
104
|
};
|
|
104
105
|
};
|
|
105
106
|
//#endregion
|
|
@@ -51,14 +51,14 @@ const buildDeployBundle = async ({ projectDir, outDir, bun, extensions = [], sou
|
|
|
51
51
|
await removeOwnFolder(outDir, bundleNodeModules, "nodeModules");
|
|
52
52
|
await removeOwnFolder(outDir, bundleMigrations, "migrations");
|
|
53
53
|
const components = /* @__PURE__ */ new Set();
|
|
54
|
-
const { native, mobile } = await buildConfigBundle({
|
|
54
|
+
const { native, mobile, notifications } = await buildConfigBundle({
|
|
55
55
|
projectDir,
|
|
56
56
|
outFile: path.join(outDir, bundleLayout.server),
|
|
57
57
|
bun,
|
|
58
58
|
extensions,
|
|
59
59
|
components
|
|
60
60
|
});
|
|
61
|
-
const mobileSection = bundleMobile(mobile);
|
|
61
|
+
const mobileSection = bundleMobile(mobile, notifications);
|
|
62
62
|
await checkViews(projectDir);
|
|
63
63
|
await checkUi(projectDir, extensions, components);
|
|
64
64
|
const packages = native.length > 0 ? await copyPackages(native, path.join(outDir, bundleNodeModules)) : [];
|
package/dist/bundle/manifest.js
CHANGED
|
@@ -32,7 +32,7 @@ const parseManifest = (value, file) => {
|
|
|
32
32
|
if (builtAt !== void 0 && !isTime(builtAt)) throw new Error(`${file} has a builtAt that is no time in ms`);
|
|
33
33
|
if (icons !== void 0 && !isIcons(icons)) throw new Error(`${file} has icons that are not a favicon flag and a list of PNG icons`);
|
|
34
34
|
if (native !== void 0 && !isVersions(native)) throw new Error(`${file} has a native that is not a map of package names to versions`);
|
|
35
|
-
if (mobile !== void 0 && !(isObject(mobile) && isVersions(mobile.plugins) && (mobile.appId === void 0 || typeof mobile.appId === "string"))) throw new Error(`${file} has a mobile that is not { appId, plugins } with an app id
|
|
35
|
+
if (mobile !== void 0 && !(isObject(mobile) && isVersions(mobile.plugins) && (mobile.appId === void 0 || typeof mobile.appId === "string") && (mobile.push === void 0 || typeof mobile.push === "boolean"))) throw new Error(`${file} has a mobile that is not { appId, plugins, push } with an app id, a map of package names to versions and true or false`);
|
|
36
36
|
if (nodeModules !== void 0 && typeof nodeModules !== "string") throw new Error(`${file} has a nodeModules that is no path`);
|
|
37
37
|
if (migrations !== void 0 && typeof migrations !== "string") throw new Error(`${file} has a migrations that is no path`);
|
|
38
38
|
return {
|
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.1",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.
|
|
47
|
-
"@protobase/layout": "0.
|
|
48
|
-
"@protobase/query": "0.
|
|
49
|
-
"@protobase/schema": "0.
|
|
50
|
-
"@protobase/server": "0.
|
|
51
|
-
"@protobase/ui": "0.
|
|
52
|
-
"@protobase/workflows": "0.
|
|
46
|
+
"@protobase/config": "0.76.1",
|
|
47
|
+
"@protobase/layout": "0.76.1",
|
|
48
|
+
"@protobase/query": "0.76.1",
|
|
49
|
+
"@protobase/schema": "0.76.1",
|
|
50
|
+
"@protobase/server": "0.76.1",
|
|
51
|
+
"@protobase/ui": "0.76.1",
|
|
52
|
+
"@protobase/workflows": "0.76.1",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -6,7 +6,7 @@ Graphs of steps the server runs along their edges, written in a language a model
|
|
|
6
6
|
|
|
7
7
|
- [Workflows](../reference/workflows.md#turning-them-on) (beta): Workflows kept in the app's database, each changed definition checked and kept as a version, run on the app's own jobs.
|
|
8
8
|
- [Workflow language](../reference/workflows.md#the-document) (beta): The States Language with JSONata expressions, every value read by name, so a model writes and edits it as a small, local change.
|
|
9
|
-
- [Checked on save](../reference/workflows.md#reading-values-by-name) (beta): A definition that does not fit the language, has an edge to no step, reads a value nothing gives or leaves out an argument its step type needs is refused, naming the step and the field.
|
|
9
|
+
- [Checked on save](../reference/workflows.md#reading-values-by-name) (beta): A definition that does not fit the language, has an edge to no step, reads a value nothing gives or leaves out an argument its step type needs is refused, naming the step and the field. A workflow may start with no steps; such a version is kept, and refused as it is published or run.
|
|
10
10
|
- [Workflow editor](../reference/workflows.md#the-editor) (beta): The admin app draws a workflow as a graph that lays itself out, to add, connect and remove steps of every trigger and step type of the app, its plugins' included, each with a form for its input beside the graph, with every problem the save would refuse shown on its step as it is edited.
|
|
11
11
|
- [One page per workflow](../reference/workflows.md#the-workflows-page) (beta): A workflow's full-width page holds its graph, its saved versions to look at read-only, its runs shown on the graph and its trigger, so you build and debug without leaving it; the sidebar has only Workflows.
|
|
12
12
|
- [Branches, steps per item and retries](../reference/workflows.md#states) (beta): Choices, a step per item with their results merged, waits, and per-step retries, timeouts and error paths.
|
|
@@ -15,7 +15,7 @@ Graphs of steps the server runs along their edges, written in a language a model
|
|
|
15
15
|
- [Mail step](../reference/workflows.md#appmailsend) (beta): Sends mail, with files the run downloaded attached, from the app's own sender.
|
|
16
16
|
- [Runs and step records](../reference/workflows.md#runs-and-their-steps) (beta): Each run started by hand through the API, from the app's code or by a trigger, with every step's input, output, logs, timing, tries and error recorded, secrets blanked out.
|
|
17
17
|
- [Run debugger](../reference/workflows.md#following-and-debugging-a-run) (beta): Each workflow lists its runs with their status, who started them, when and for how long; a run shown on its workflow's page marks every step's status on the graph of the version it ran on, live while it runs, with each step's input, output, logs, timing, tries and error, secrets blanked out.
|
|
18
|
-
- [Re-run from
|
|
18
|
+
- [Re-run from a step](../reference/workflows.md#re-running-a-failed-run) (beta): Once the workflow is fixed, a run runs again from any step of the workflow itself it reached, outside For each, keeping what the steps before it gave; a test run starts the workflow with a sample input from its page.
|
|
19
19
|
- [Replay a run](../reference/workflows.md#replaying-a-run) (beta): replay a finished run on your workflow as it is now, with the same input. Steps that write are held back and reads come from the step cache or run again, so you can try a change on the same data without sending anything again.
|
|
20
20
|
- [Runs that survive restarts](../reference/workflows.md#how-a-run-is-run) (beta): A run takes up where it stood after a restart or a crashed worker, never running a saved step again, and every limit fails closed.
|
|
21
21
|
- [Who may run workflows](../reference/workflows.md#who-may-do-what) (beta): Making, changing and running workflows and reading their runs are each granted by name, within the tenant.
|
|
@@ -254,7 +254,7 @@ By default the bundle runs on Node and on Bun. `--bun` makes it a bundle for Bun
|
|
|
254
254
|
],
|
|
255
255
|
"shell": { "protobase": "0.12.0", "pluginApi": 1, "paths": ["/index.html", "/assets", "/protobase.sw.js"] },
|
|
256
256
|
"native": { "@capacitor/core": "8.5.3", "@capacitor/ios": "8.5.3" },
|
|
257
|
-
"mobile": { "appId": "com.example.shop", "plugins": { "@capacitor/camera": "^8.0.1" } },
|
|
257
|
+
"mobile": { "appId": "com.example.shop", "plugins": { "@capacitor/camera": "^8.0.1" }, "push": true },
|
|
258
258
|
"nodeModules": "node_modules",
|
|
259
259
|
"migrations": "migrations"
|
|
260
260
|
}
|
|
@@ -265,7 +265,7 @@ By default the bundle runs on Node and on Bun. `--bun` makes it a bundle for Bun
|
|
|
265
265
|
- `plugins` are the bundle's own plugins, in the order the app merges them: the extensions', then the project's (`app`). Each names its `plugin.json`, the plugin API and Protobase versions it is built for, and the [field types](plugins.md#field-types) it registers with the storage types each shows, which the serve runtime checks the views against at startup. `/api/meta` names them to everyone, before any other plugin.
|
|
266
266
|
- `shell` is the admin app `public/` holds a copy of: its Protobase version and plugin API, and its files as URL paths. A host with a shell of its own may serve its own for those paths instead (see [The UI](#the-ui)), so the app gets that release's fixes without a rebuild.
|
|
267
267
|
- `native` is the native code, name to version, that `shell` runs on in the [mobile app](../guides/mobile-app.md): the native packages `@protobase/mobile` pins, and `@protobase/mobile` itself at its native contract, such as `native-1`, which Protobase raises when its own native code changes. The fingerprint of the bundle's [mobile release](#mobile-releases) names them. A bundle built before it serves no mobile release.
|
|
268
|
-
- `mobile` is present only when the project's config has a `mobile` section, so a host learns that the app has a mobile build without running the config: the section's `appId`, which the statement of a signed mobile release binds,
|
|
268
|
+
- `mobile` is present only when the project's config has a `mobile` section, so a host learns that the app has a mobile build without running the config: the section's `appId`, which the statement of a signed mobile release binds, its `plugins`, name to the spec it gives, `{}` when it gives none, and `push`, whether the config has [`notifications()`](notifications.md), with which the binaries compile native push in; the fingerprint of the mobile release names both besides `native`. A bundle built before it names no `appId`, and one built before `push` none, which counts as `false`. The build checks the section as `protobase mobile` does.
|
|
269
269
|
- `theme` is the project's [theme](theme.md), which the app links at `/protobase.theme.css`. It is always there, empty when the project has none.
|
|
270
270
|
- `nodeModules` is present only when the config module imports [native packages](#native-packages). It is always the `node_modules` folder beside `server`, where Bun and Node resolve the module's imports from, and holds plain packages: JavaScript, `package.json` files and native binaries for linux x64 and arm64 (glibc), which the runtime loads with `dlopen`. A host keeps it next to the server module and must not mount it `noexec` (an add-on there then fails with `failed to map segment from shared object`). Its binaries link nothing but glibc, `libstdc++.so.6`, `libgcc_s.so.1` and libraries in the bundle itself, so the run image must have those three. Without `nodeModules`, the server module is the only file the runtime reads.
|
|
271
271
|
- `migrations` is present only when the project has a `db/migrations` folder: its `.sql` files, which the runtime's `migrate` applies (see [Deploy](../guides/deploy.md)). A host never serves it.
|
|
@@ -493,7 +493,7 @@ An Android or iOS app built with `mobile.publicKey` updates itself from the serv
|
|
|
493
493
|
|
|
494
494
|
A host that serves bundles without running their config, such as a router in front of many apps or a static host, serves the same release from the files it already serves with `@protobase/server/mobile-release`, which loads none of the rest of the server: `protobase serve` composes its own release with the same exports.
|
|
495
495
|
|
|
496
|
-
- `nativeFingerprint(native, plugins)`: the release's fingerprint, from the manifest's `native` (or that of the shell the host serves) and `mobile.
|
|
496
|
+
- `nativeFingerprint(native, plugins, { push })`: the release's fingerprint, from the manifest's `native` (or that of the shell the host serves), `mobile.plugins` and `mobile.push`, `false` when the manifest names none. A host that leaves `push` out matches no binary of an app with `notifications()`. It is a contract across versions: a binary one Protobase release built is matched by a host that runs another.
|
|
497
497
|
- `releaseOrder({ builtAt, shell })`: the order a release signs, from the manifest's build time and that of the server's own shell the host serves in its place, `[builtAt, 0]` with the bundle's copy; `undefined` when either names no build time.
|
|
498
498
|
- `withApiOrigin(html, origin)`: the `spa` page naming the API origin, the app's `url`.
|
|
499
499
|
- `composeRelease(files, signing?)`: the release of `{ href, content }` files, every file the host serves the web with the page above in place of `spa`, with its id and, with `signing`, `{ key, binding: { order, appId, fingerprint, shellVersion } }`, `appId` the manifest's `mobile.appId`, the signed checksums and statement.
|
|
@@ -112,7 +112,7 @@ In an app with [workflows](workflows.md), the endpoint also offers tools to find
|
|
|
112
112
|
| `list_connections` | The person's own [connected accounts](workflows.md#connecting-an-account), by each connection the app's plugins declare: its key and label, and each account's `id`, scopes and `needs_sign_in`. A definition's `connections` binds an account by its `id`. It returns no token, and no one else's accounts. |
|
|
113
113
|
| `create_workflow` | Creates a workflow from its `name`, `description` and `definition`, and returns its `id`, `version` and ETag. |
|
|
114
114
|
| `update_workflow` | Changes a workflow's definition by an `edit` or whole, as `definition`, and its `name` or `description`, and returns its `id`, new `version` and ETag. With the `etag` that `get_workflow` gave, it fails when someone changed the workflow since; an edit without one is saved against the version it was applied to. |
|
|
115
|
-
| `run_workflow` | Starts a run of a workflow's version saved last, or of the `version` it names, with an `input`, and returns its `run_id` and `status`. With `rerun_of`, a failed run's id, it [re-runs](workflows.md#re-running-a-failed-run) that run from its failed step instead, on its input; with `replay: true` too, it [replays](workflows.md#replaying-a-run) any ended run of the workflow on its current version, with that run's input, sending none of its outside writes. |
|
|
115
|
+
| `run_workflow` | Starts a run of a workflow's version saved last, or of the `version` it names, with an `input`, and returns its `run_id` and `status`. With `rerun_of`, a failed run's id, it [re-runs](workflows.md#re-running-a-failed-run) that run from its failed step instead, on its input, and with `rerun_from` any ended run from that state; with `replay: true` too, it [replays](workflows.md#replaying-a-run) any ended run of the workflow on its current version, with that run's input, sending none of its outside writes. |
|
|
116
116
|
| `enable_workflow` | Publishes the saved `version` it names (`enabled: true`), which puts the workflow's trigger on it, or turns the workflow off, and returns its `enabled_version`. A save never goes live by itself. One that uses a [connected account](workflows.md#connecting-an-account) is turned on only by the account's owner in the admin app: the tool answers `own-sign-in-only` and says so. |
|
|
117
117
|
| `new_webhook_url` | Issues a new URL and secret for a workflow that starts from a [webhook trigger](workflows.md#appwebhook), keeping a `secret` the sender makes when given one, and returns `{ url, secret }`, shown this once; the old URL stops. |
|
|
118
118
|
|
|
@@ -234,7 +234,7 @@ The notification's title and body are its alert, with its `badge` and `sound`; t
|
|
|
234
234
|
## Android
|
|
235
235
|
|
|
236
236
|
:::caution[Beta]
|
|
237
|
-
Push on Android is new.
|
|
237
|
+
Push on Android is new, and a message over FCM's size limit is not refused before it is sent (see below).
|
|
238
238
|
:::
|
|
239
239
|
|
|
240
240
|
Android devices receive push through Firebase Cloud Messaging's HTTP v1 API. You create a service account key in your Firebase project (Project settings, Service accounts, Generate new private key) and set its JSON as `PROTOBASE_FCM_SERVICE_ACCOUNT`. Without it, Android devices are skipped. `protobase mobile` sets the app up from your `google-services.json`: see [Push notifications in the mobile app guide](../guides/mobile-app.md#9-push-notifications).
|
|
@@ -335,6 +335,10 @@ A failed run, shown on its workflow's page, offers *Re-run from the failed step*
|
|
|
335
335
|
- keeps the earlier run's steps, copied as they were, but the try that failed and that state's retried tries before it, so the failed state runs again from its first try and none of the steps before it runs again. A Map that runs again keeps its finished items and runs again only those that had not finished, each from where it stood;
|
|
336
336
|
- is refused, and nothing starts, when the earlier run is not one of the workflow's runs the person may read (404), did not fail (`run-not-failed`), or would go on at a state the version no longer has (`rerun-refused`, naming the state).
|
|
337
337
|
|
|
338
|
+
With `rerun_from`, the name of a state of the workflow itself, it re-runs any run that ended, succeeded or failed, from that state: the steps before its first visit stay as they ran, and it and all after it run again, so what they send goes out again. A kept step that succeeded, whose state now has a variable that keeps its whole result, `"Assign": { "customer": "{% $states.result %}" }`, gets that variable from what it gave, unless that state shaped its result with `Output` in the version the earlier run ran. A kept step that failed into a catcher keeps what it assigned then. A re-run needs read access to every step, as a replay does. `POST /api/v1/workflow_runs` with `{ "workflow_id": "...", "rerun_of": "...", "rerun_from": "Store" }` does it. It is refused when the run has not ended (`run-not-ended`), never reached that state, or the version no longer has it or no longer starts there (`rerun-refused`), and without `rerun_of` (`rerun-from-without-run`).
|
|
339
|
+
|
|
340
|
+
A workflow may be created with no steps: its `definition` then defaults to one with `manual` as its trigger and no states. A save of a definition with no states checks the rest of it as any save does; such a version is kept, and refused as it is published or run.
|
|
341
|
+
|
|
338
342
|
A kept step's card says it is from the earlier run, as it finished before the re-run started; the earlier run's own page lists its re-runs.
|
|
339
343
|
|
|
340
344
|
### Replaying a run
|