create-bcp-app 0.2.7 → 0.2.8

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/README.md CHANGED
@@ -92,10 +92,10 @@ Example:
92
92
  "schemaVersion": 1,
93
93
  "framework": "bcp",
94
94
  "projectName": "my-app",
95
- "frameworkPackage": "npm:@chidchanun/bcp@0.2.7",
95
+ "frameworkPackage": "npm:@chidchanun/bcp@0.2.8",
96
96
  "createdWith": {
97
97
  "package": "create-bcp-app",
98
- "version": "0.2.7"
98
+ "version": "0.2.8"
99
99
  },
100
100
  "packageManager": "npm",
101
101
  "presets": {
@@ -357,6 +357,43 @@ The default HTTP request metrics use `method` and `status` labels only. Raw path
357
357
 
358
358
  `bcp/observability` is server-only. Protect metrics and operational health detail with an appropriate network or authorization boundary when needed.
359
359
 
360
+ ## Background jobs — 0.2.8+
361
+
362
+ Generated projects can create a server-only background job queue without adding another package:
363
+
364
+ ```ts
365
+ import {
366
+ createJobQueue,
367
+ } from "bcp/jobs";
368
+
369
+ export const jobs =
370
+ createJobQueue();
371
+ ```
372
+
373
+ Register handlers and enqueue work:
374
+
375
+ ```ts
376
+ jobs.register(
377
+ "email.welcome",
378
+ async ({ payload }) => {
379
+ await sendWelcomeEmail(
380
+ payload.userId
381
+ );
382
+ }
383
+ );
384
+
385
+ await jobs.enqueue(
386
+ "email.welcome",
387
+ {
388
+ userId: 42,
389
+ }
390
+ );
391
+ ```
392
+
393
+ Workers support concurrency, delayed jobs, retry/backoff and cancellation. The default memory adapter is process-local and should be replaced with a durable `JobQueueAdapter` for multi-process/container production workloads that must survive restarts.
394
+
395
+ `bcp/jobs` is server-only and must not be imported into page/client bundles.
396
+
360
397
  ## Application Packaging — 0.2.4+
361
398
 
362
399
  Generated projects include:
@@ -438,5 +475,5 @@ npx create-bcp-app my-app --yes
438
475
  The `--bcp` option is mainly for prerelease/local package verification:
439
476
 
440
477
  ```bash
441
- npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.7.tgz
478
+ npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.8.tgz
442
479
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bcp-app",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Create a new BCP Framework application.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -125,6 +125,45 @@ The default request metrics use bounded `method` and `status` labels and do not
125
125
 
126
126
  Protect operational endpoints when their contents should not be public.
127
127
 
128
+ ## Background jobs — BCP 0.2.8+
129
+
130
+ Create a server-only background queue:
131
+
132
+ ```ts
133
+ import {
134
+ createJobQueue,
135
+ } from "bcp/jobs";
136
+
137
+ export const jobs =
138
+ createJobQueue();
139
+ ```
140
+
141
+ Register and enqueue work:
142
+
143
+ ```ts
144
+ jobs.register(
145
+ "email.welcome",
146
+ async ({ payload }) => {
147
+ await sendWelcomeEmail(
148
+ payload.userId
149
+ );
150
+ }
151
+ );
152
+
153
+ await jobs.enqueue(
154
+ "email.welcome",
155
+ {
156
+ userId: 42,
157
+ }
158
+ );
159
+ ```
160
+
161
+ Workers support delayed jobs, retry/backoff, cancellation and configurable concurrency.
162
+
163
+ The default memory adapter is process-local and not durable. For production jobs that must survive restarts or run across multiple processes/containers, implement `JobQueueAdapter` with shared durable infrastructure.
164
+
165
+ `bcp/jobs` is server-only and cannot be imported into page/client bundles.
166
+
128
167
  ## Generate framework files
129
168
 
130
169
  BCP can generate common project files: