bkper 4.13.6 → 4.14.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/lib/commands/apps/build.d.ts +1 -2
- package/lib/commands/apps/build.d.ts.map +1 -1
- package/lib/commands/apps/build.js +13 -39
- package/lib/commands/apps/build.js.map +1 -1
- package/lib/commands/apps/config.d.ts +5 -14
- package/lib/commands/apps/config.d.ts.map +1 -1
- package/lib/commands/apps/config.js +13 -45
- package/lib/commands/apps/config.js.map +1 -1
- package/lib/commands/apps/deploy.d.ts +14 -4
- package/lib/commands/apps/deploy.d.ts.map +1 -1
- package/lib/commands/apps/deploy.js +42 -58
- package/lib/commands/apps/deploy.js.map +1 -1
- package/lib/commands/apps/dev.d.ts +1 -7
- package/lib/commands/apps/dev.d.ts.map +1 -1
- package/lib/commands/apps/dev.js +44 -111
- package/lib/commands/apps/dev.js.map +1 -1
- package/lib/commands/apps/init.d.ts +1 -1
- package/lib/commands/apps/init.d.ts.map +1 -1
- package/lib/commands/apps/init.js +6 -12
- package/lib/commands/apps/init.js.map +1 -1
- package/lib/commands/apps/register.d.ts.map +1 -1
- package/lib/commands/apps/register.js +3 -11
- package/lib/commands/apps/register.js.map +1 -1
- package/lib/commands/apps/types.d.ts +3 -27
- package/lib/commands/apps/types.d.ts.map +1 -1
- package/lib/dev/local-assets.d.ts +15 -0
- package/lib/dev/local-assets.d.ts.map +1 -0
- package/lib/dev/local-assets.js +43 -0
- package/lib/dev/local-assets.js.map +1 -0
- package/lib/dev/local-outbound.d.ts +8 -0
- package/lib/dev/local-outbound.d.ts.map +1 -0
- package/lib/dev/local-outbound.js +88 -0
- package/lib/dev/local-outbound.js.map +1 -0
- package/lib/dev/logger.d.ts +3 -7
- package/lib/dev/logger.d.ts.map +1 -1
- package/lib/dev/logger.js +3 -6
- package/lib/dev/logger.js.map +1 -1
- package/lib/dev/miniflare.d.ts +4 -0
- package/lib/dev/miniflare.d.ts.map +1 -1
- package/lib/dev/miniflare.js +85 -21
- package/lib/dev/miniflare.js.map +1 -1
- package/lib/docs/app-building.md +151 -141
- package/lib/docs/app-management.md +43 -28
- package/lib/docs/bkper-js.md +2 -0
- package/lib/docs/index.md +1 -1
- package/lib/platform/client.d.ts +2 -2
- package/lib/platform/client.js +2 -2
- package/package.json +2 -2
|
@@ -12,47 +12,63 @@ Build, deploy, and manage Bkper apps using the `bkper` CLI.
|
|
|
12
12
|
When scaffolding, developing, or deploying an app, verify each step before proceeding. This prevents broken deployments and silent failures.
|
|
13
13
|
|
|
14
14
|
### 1. Init
|
|
15
|
+
|
|
15
16
|
```bash
|
|
16
17
|
bkper app init my-app
|
|
17
18
|
```
|
|
19
|
+
|
|
18
20
|
Verify:
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
- `client/` and `server/` exist
|
|
20
23
|
- `bkper.yaml` has `id`, `name`, `description`, and `developers`
|
|
21
24
|
- `package.json` scripts include `dev` and `build`
|
|
22
25
|
|
|
23
26
|
### 2. Develop
|
|
27
|
+
|
|
24
28
|
```bash
|
|
25
29
|
npm run dev
|
|
26
30
|
```
|
|
31
|
+
|
|
27
32
|
Verify:
|
|
28
|
-
|
|
33
|
+
|
|
34
|
+
- Server worker responds: `curl http://localhost:8787/health` (or the port you configured)
|
|
29
35
|
- Client dev server is reachable if running separately
|
|
30
|
-
-
|
|
31
|
-
- If
|
|
36
|
+
- If the app declares `events`, the events tunnel URL is printed in terminal and registered in Bkper as `webhookUrlDev`
|
|
37
|
+
- If the worker fails to start, fix before writing code
|
|
32
38
|
|
|
33
39
|
### 3. Build
|
|
40
|
+
|
|
34
41
|
```bash
|
|
35
42
|
npm run build
|
|
36
43
|
```
|
|
44
|
+
|
|
37
45
|
Verify:
|
|
38
|
-
|
|
39
|
-
- `dist/
|
|
46
|
+
|
|
47
|
+
- `dist/server/` contains the server Worker bundle
|
|
48
|
+
- `dist/client/` contains the Vite client build when `deployment.client` is configured
|
|
40
49
|
- No build errors in terminal output
|
|
41
50
|
|
|
42
51
|
### 4. Sync & Deploy
|
|
52
|
+
|
|
43
53
|
```bash
|
|
44
54
|
bkper app sync && bkper app deploy
|
|
45
55
|
```
|
|
56
|
+
|
|
46
57
|
Verify:
|
|
58
|
+
|
|
47
59
|
- `bkper app status` shows the deployed version
|
|
48
60
|
- URLs in `bkper.yaml` match the deployed domain (`https://{appId}.bkper.app`)
|
|
49
61
|
|
|
50
62
|
### 5. Validate
|
|
63
|
+
|
|
51
64
|
```bash
|
|
52
65
|
bkper app install <appId> -b <bookId>
|
|
53
66
|
```
|
|
67
|
+
|
|
54
68
|
Verify:
|
|
69
|
+
|
|
55
70
|
- Menu appears in the book's "More" menu (if configured)
|
|
71
|
+
- App server `/api/*` routes are called with `Authorization: Bearer <token>`
|
|
56
72
|
- Trigger a subscribed event in the book
|
|
57
73
|
- Check the Bkper activity stream for the handler response
|
|
58
74
|
- If the handler writes back to the book, confirm loop prevention is in place (check `event.agent.id`)
|
|
@@ -66,11 +82,11 @@ Verify:
|
|
|
66
82
|
bkper app init my-app
|
|
67
83
|
|
|
68
84
|
# Start the worker runtime (Miniflare + tunnel + file watching)
|
|
69
|
-
# In your project, use "npm run dev" to run both Vite and
|
|
85
|
+
# In your project, use "npm run dev" to run both Vite and the worker concurrently
|
|
70
86
|
bkper app dev
|
|
71
87
|
|
|
72
|
-
# Build
|
|
73
|
-
# In your project, use "npm run build" to build both client (Vite) and
|
|
88
|
+
# Build the server Worker bundle
|
|
89
|
+
# In your project, use "npm run build" to build both client (Vite) and worker
|
|
74
90
|
bkper app build
|
|
75
91
|
|
|
76
92
|
# Sync configuration and deploy to production
|
|
@@ -79,14 +95,11 @@ bkper app sync && bkper app deploy
|
|
|
79
95
|
# Deploy to preview environment (URL: https://{appId}-preview.bkper.app)
|
|
80
96
|
bkper app deploy --preview
|
|
81
97
|
|
|
82
|
-
# Deploy only the events handler
|
|
83
|
-
bkper app deploy --events
|
|
84
|
-
|
|
85
98
|
# Check deployment status
|
|
86
99
|
bkper app status
|
|
87
100
|
```
|
|
88
101
|
|
|
89
|
-
> **Note:** `bkper app dev` runs
|
|
102
|
+
> **Note:** `bkper app dev` runs one local Worker runtime — Miniflare, file watching, and an optional Cloudflare tunnel to `/events` when the app subscribes to events. Miniflare is loaded from the app project's `devDependencies` so each app can keep its local Workers simulator aligned with its own code. The Vite client dev server is configured in the project's `vite.config.ts` and run separately. The project template composes both via `npm run dev` using `concurrently`. If needed, install Miniflare in the app root with `bun add -d miniflare` or `npm install -D miniflare`.
|
|
90
103
|
|
|
91
104
|
---
|
|
92
105
|
|
|
@@ -115,6 +128,8 @@ bkper app secrets list
|
|
|
115
128
|
bkper app secrets delete EXTERNAL_SERVICE_TOKEN
|
|
116
129
|
```
|
|
117
130
|
|
|
131
|
+
Use `--preview` to manage preview secrets.
|
|
132
|
+
|
|
118
133
|
---
|
|
119
134
|
|
|
120
135
|
## Configuration
|
|
@@ -231,6 +246,7 @@ menuPopupHeight: 300
|
|
|
231
246
|
# EVENT HANDLING (optional)
|
|
232
247
|
# -----------------------------------------------------------------------------
|
|
233
248
|
# When configured, Bkper calls your webhook URL when subscribed events occur.
|
|
249
|
+
# On the Bkper Platform, /events is handled by the same Worker as /api/*.
|
|
234
250
|
|
|
235
251
|
# Production webhook URL
|
|
236
252
|
webhookUrl: https://${id}.bkper.app/events
|
|
@@ -323,19 +339,23 @@ propertiesSchema:
|
|
|
323
339
|
# -----------------------------------------------------------------------------
|
|
324
340
|
# For apps deployed to Bkper's Workers for Platforms infrastructure.
|
|
325
341
|
deployment:
|
|
326
|
-
#
|
|
327
|
-
|
|
328
|
-
bundle: packages/web/server/dist
|
|
329
|
-
# assets: packages/web/client/dist # Static assets (when supported)
|
|
342
|
+
# Single server Worker entry point. It serves /api/* and /events.
|
|
343
|
+
server: server/src/index.ts
|
|
330
344
|
|
|
331
|
-
#
|
|
332
|
-
|
|
333
|
-
bundle: packages/events/dist
|
|
345
|
+
# Optional Vite/static client root. Built assets are deployed with the same Worker.
|
|
346
|
+
client: client
|
|
334
347
|
|
|
335
348
|
# Platform services available to your app (one per type, auto-provisioned)
|
|
336
349
|
# See: https://developers.cloudflare.com/kv/
|
|
337
350
|
services:
|
|
338
351
|
- KV # Key-value storage
|
|
352
|
+
|
|
353
|
+
# Secret names managed with bkper app secrets
|
|
354
|
+
secrets:
|
|
355
|
+
- EXTERNAL_SERVICE_TOKEN
|
|
356
|
+
|
|
357
|
+
# Cloudflare Workers compatibility date
|
|
358
|
+
compatibility_date: '2026-01-28'
|
|
339
359
|
```
|
|
340
360
|
|
|
341
361
|
</details>
|
|
@@ -364,30 +384,25 @@ deployment:
|
|
|
364
384
|
- `app init <name>` - Scaffold a new app from the template
|
|
365
385
|
- `app list` - List all apps you have access to
|
|
366
386
|
- `app sync` - Sync [bkper.yaml][bkper.yaml reference] configuration (URLs, description) to Bkper API
|
|
367
|
-
- `app build` - Build
|
|
387
|
+
- `app build` - Build the server Worker bundle for deployment
|
|
368
388
|
- `app deploy` - Deploy built artifacts to Cloudflare Workers for Platforms
|
|
369
389
|
- `-p, --preview` - Deploy to preview environment
|
|
370
|
-
- `--events` - Deploy events handler instead of web handler
|
|
371
390
|
- `app status` - Show deployment status
|
|
372
391
|
- `app logs` - View recent app logs
|
|
373
392
|
- `--since <time>` - ISO8601 or relative lower bound (e.g. `5m`, `1h`, `15d`)
|
|
374
393
|
- `--until <time>` - ISO8601 or relative upper bound
|
|
375
394
|
- `--last <n>` - Show newest N entries after filters (default: 100)
|
|
376
395
|
- `-p, --preview` - Query preview logs instead of production
|
|
377
|
-
- `-w, --web` - Filter to
|
|
378
|
-
- `-e, --events` - Filter to
|
|
396
|
+
- `-w, --web` - Filter to normal web/API requests
|
|
397
|
+
- `-e, --events` - Filter to `/events` requests
|
|
379
398
|
- `--outcome <outcome>` - Filter by Cloudflare worker outcome
|
|
380
399
|
- `--status-code <code>` - Filter by HTTP status code
|
|
381
400
|
- `app undeploy` - Remove app from platform
|
|
382
401
|
- `-p, --preview` - Remove from preview environment
|
|
383
|
-
- `--events` - Remove events handler instead of web handler
|
|
384
402
|
- `--delete-data` - Permanently delete all associated data (requires confirmation)
|
|
385
403
|
- `--force` - Skip confirmation prompts (use with `--delete-data` for automation)
|
|
386
404
|
- `app dev` - Start the worker runtime for local development
|
|
387
405
|
- `--sp, --server-port <port>` - Server simulation port (default: `8787`)
|
|
388
|
-
- `--ep, --events-port <port>` - Events handler port (default: `8791`)
|
|
389
|
-
- `-w, --web` - Run only the web handler
|
|
390
|
-
- `-e, --events` - Run only the events handler
|
|
391
406
|
|
|
392
407
|
> **Note:** `sync` and `deploy` are independent operations. Use `sync` to update your app's URLs in Bkper (required for webhooks and menu integration). Use `deploy` to push code to Cloudflare. For a typical deployment workflow, run both: `bkper app sync && bkper app deploy`
|
|
393
408
|
|
package/lib/docs/bkper-js.md
CHANGED
|
@@ -122,6 +122,8 @@ const books = await bkper.getBooks();
|
|
|
122
122
|
|
|
123
123
|
See the [@bkper/web-auth documentation](https://bkper.com/docs/api/bkper-web-auth) for more details.
|
|
124
124
|
|
|
125
|
+
For Bkper Platform app server routes under `/api/*`, send `Authorization: Bearer ${auth.getAccessToken()}` from the client. The server route can use `new Bkper()` without a token provider because platform outbound auth injects the validated user's token on Bkper API calls.
|
|
126
|
+
|
|
125
127
|
### API Key (Optional)
|
|
126
128
|
|
|
127
129
|
API keys are optional and only needed for dedicated quota limits. If not provided, requests use a shared managed quota via the Bkper API proxy.
|
package/lib/docs/index.md
CHANGED
|
@@ -4,7 +4,7 @@ Reference docs for Bkper tasks. Load only the specific doc(s) relevant to the ta
|
|
|
4
4
|
|
|
5
5
|
- **data-management.md** — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), output formats (table/json/csv), batch operations via stdin/piping, collections.
|
|
6
6
|
- **app-management.md** — CLI reference for building and deploying Bkper apps: dev/build/deploy workflow, app install/uninstall, secrets management, app logs, bkper.yaml configuration reference (identity, branding, events, menu integration, deployment).
|
|
7
|
-
- **app-building.md** — Full app-building reference: architecture (
|
|
7
|
+
- **app-building.md** — Full app-building reference: single Worker app architecture (`client/` + `server/`), development loop, `/api/*` routes, `/events` handlers, deployment patterns, the Bkper Platform, and self-hosted alternatives. Includes authentication patterns for web clients (`@bkper/web-auth`), server API routes (`Authorization: Bearer` on `/api/*` with outbound auth injection), platform event handlers (`new Bkper()` with outbound auth injection), and local development.
|
|
8
8
|
- **financial-statements.md** — Step-by-step workflow for aggregate financial reports (balance sheet, P&L): root group discovery, query patterns, date semantics (before: vs after:+before:), common mistakes to avoid.
|
|
9
9
|
- **taxes.md** — Deterministic workflow for tax position and filing summaries: discovering tax-relevant groups, period-based balance queries, persisting a local tax runner. Jurisdiction-agnostic — outputs raw period balances, leaving rate/application to the user.
|
|
10
10
|
- **bkper-js.md** — bkper-js Node.js/browser SDK: Bkper, Book, Account, Transaction, Group, Balance classes, all methods, getBalancesReport, OAuth configuration, library setup.
|
package/lib/platform/client.d.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* // Deploy an app
|
|
14
14
|
* const { data, error } = await client.POST('/api/apps/{appId}/deploy', {
|
|
15
|
-
* params: { path: { appId: 'my-app' }, query: { env: '
|
|
16
|
-
* body:
|
|
15
|
+
* params: { path: { appId: 'my-app' }, query: { env: 'preview' } },
|
|
16
|
+
* body: formData,
|
|
17
17
|
* });
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
package/lib/platform/client.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* // Deploy an app
|
|
14
14
|
* const { data, error } = await client.POST('/api/apps/{appId}/deploy', {
|
|
15
|
-
* params: { path: { appId: 'my-app' }, query: { env: '
|
|
16
|
-
* body:
|
|
15
|
+
* params: { path: { appId: 'my-app' }, query: { env: 'preview' } },
|
|
16
|
+
* body: formData,
|
|
17
17
|
* });
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@earendil-works/pi-coding-agent": "0.75.5",
|
|
55
|
-
"bkper-js": "^2.
|
|
55
|
+
"bkper-js": "^2.35.2",
|
|
56
56
|
"commander": "^13.1.0",
|
|
57
57
|
"dotenv": "^8.2.0",
|
|
58
58
|
"esbuild": "^0.27.2",
|