@palbase/backend 12.0.1 → 13.0.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/docs/events.md CHANGED
@@ -62,7 +62,11 @@ export default class StripeWebhook {
62
62
  ```
63
63
 
64
64
  `provider` selects a preset signature scheme; a service with no preset spells
65
- one out with `signature` instead — one of the two is required. The signing
65
+ one out with `signature` instead — EXACTLY one of the two is required (neither
66
+ is an unverifiable endpoint; both is ambiguous, and only `provider` would be
67
+ used, so both are refused at build). `/webhooks` is a reserved path: a
68
+ controller route resolving under it is refused too, because the platform matches
69
+ that path before controller dispatch. The signing
66
70
  secret is resolved by the runtime from `secret: { env: "NAME" }`; your
67
71
  handlers access Environment variables via `meta.env`. The runtime verifies the
68
72
  signature before dispatching to your event handlers.
@@ -1401,9 +1401,8 @@ to drive live chat, presence, dashboards, and other push features.
1401
1401
 
1402
1402
  A `Resource` models one external connection — a pooled datastore, a stateless
1403
1403
  API client, or a per-user factory. You put it in `resources/`, export an
1404
- instance, and **do not register it**: the framework discovers it, sets it up
1405
- once at boot, and drains it on shutdown. On top of that lifecycle you expose
1406
- your own clean facade.
1404
+ instance, and **do not register it**: the framework discovers it and sets it up
1405
+ once at boot. On top of that lifecycle you expose your own clean facade.
1407
1406
 
1408
1407
  ```ts
1409
1408
  import { Resource } from "@palbase/backend";
@@ -1413,13 +1412,20 @@ import { Resource } from "@palbase/backend";
1413
1412
 
1414
1413
  A resource is created once at process boot — NOT per request. The framework:
1415
1414
 
1416
- 1. calls `init(env)` **once**, with only the secrets the resource declared;
1417
- 2. (optionally) calls `shutdown()` on SIGTERM, in reverse boot order.
1415
+ 1. calls `init(env)` **once**, with only the secrets the resource declared.
1416
+
1417
+ That is the whole lifecycle — there is no teardown counterpart. The runtime
1418
+ recycles an environment by disposing its isolate outright, with no signal
1419
+ delivered into your code first, so a `shutdown()` you declare is **never
1420
+ called**. Do not buffer in memory intending to flush on the way out; treat a
1421
+ write as durable when the call that made it returns. The optional `shutdown()`
1422
+ member survives in the type because the older process-based runtime did invoke
1423
+ it on SIGTERM.
1418
1424
 
1419
1425
  The instance lives for the whole process; your facade methods are called
1420
1426
  per-request. This makes "reconnect on every request" structurally impossible.
1421
1427
 
1422
- ## Pooled datastore — `init` + `shutdown`
1428
+ ## Pooled datastore
1423
1429
 
1424
1430
  ```ts
1425
1431
  import { Resource } from "@palbase/backend";
@@ -1431,9 +1437,6 @@ export class Neo4jResource extends Resource {
1431
1437
  async init(env: { NEO4J_URL: string; NEO4J_USER: string; NEO4J_PASSWORD: string }) {
1432
1438
  this.driver = neo4j.driver(env.NEO4J_URL, neo4j.auth.basic(env.NEO4J_USER, env.NEO4J_PASSWORD));
1433
1439
  }
1434
- async shutdown() {
1435
- await this.driver.close();
1436
- }
1437
1440
  session(): Session {
1438
1441
  return this.driver.session();
1439
1442
  }
@@ -1685,7 +1688,11 @@ export default class StripeWebhook {
1685
1688
  ```
1686
1689
 
1687
1690
  `provider` selects a preset signature scheme; a service with no preset spells
1688
- one out with `signature` instead — one of the two is required. The signing
1691
+ one out with `signature` instead — EXACTLY one of the two is required (neither
1692
+ is an unverifiable endpoint; both is ambiguous, and only `provider` would be
1693
+ used, so both are refused at build). `/webhooks` is a reserved path: a
1694
+ controller route resolving under it is refused too, because the platform matches
1695
+ that path before controller dispatch. The signing
1689
1696
  secret is resolved by the runtime from `secret: { env: "NAME" }`; your
1690
1697
  handlers access Environment variables via `meta.env`. The runtime verifies the
1691
1698
  signature before dispatching to your event handlers.
package/docs/resources.md CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  A `Resource` models one external connection — a pooled datastore, a stateless
4
4
  API client, or a per-user factory. You put it in `resources/`, export an
5
- instance, and **do not register it**: the framework discovers it, sets it up
6
- once at boot, and drains it on shutdown. On top of that lifecycle you expose
7
- your own clean facade.
5
+ instance, and **do not register it**: the framework discovers it and sets it up
6
+ once at boot. On top of that lifecycle you expose your own clean facade.
8
7
 
9
8
  ```ts
10
9
  import { Resource } from "@palbase/backend";
@@ -14,13 +13,20 @@ import { Resource } from "@palbase/backend";
14
13
 
15
14
  A resource is created once at process boot — NOT per request. The framework:
16
15
 
17
- 1. calls `init(env)` **once**, with only the secrets the resource declared;
18
- 2. (optionally) calls `shutdown()` on SIGTERM, in reverse boot order.
16
+ 1. calls `init(env)` **once**, with only the secrets the resource declared.
17
+
18
+ That is the whole lifecycle — there is no teardown counterpart. The runtime
19
+ recycles an environment by disposing its isolate outright, with no signal
20
+ delivered into your code first, so a `shutdown()` you declare is **never
21
+ called**. Do not buffer in memory intending to flush on the way out; treat a
22
+ write as durable when the call that made it returns. The optional `shutdown()`
23
+ member survives in the type because the older process-based runtime did invoke
24
+ it on SIGTERM.
19
25
 
20
26
  The instance lives for the whole process; your facade methods are called
21
27
  per-request. This makes "reconnect on every request" structurally impossible.
22
28
 
23
- ## Pooled datastore — `init` + `shutdown`
29
+ ## Pooled datastore
24
30
 
25
31
  ```ts
26
32
  import { Resource } from "@palbase/backend";
@@ -32,9 +38,6 @@ export class Neo4jResource extends Resource {
32
38
  async init(env: { NEO4J_URL: string; NEO4J_USER: string; NEO4J_PASSWORD: string }) {
33
39
  this.driver = neo4j.driver(env.NEO4J_URL, neo4j.auth.basic(env.NEO4J_USER, env.NEO4J_PASSWORD));
34
40
  }
35
- async shutdown() {
36
- await this.driver.close();
37
- }
38
41
  session(): Session {
39
42
  return this.driver.session();
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palbase/backend",
3
- "version": "12.0.1",
3
+ "version": "13.0.0",
4
4
  "description": "Palbase Backend SDK — class controllers (@Controller/@Get/@Post + @Body/@QueryParams/@Param), error classes, schema DSL",
5
5
  "license": "MIT",
6
6
  "repository": {