@solobrand/platform 0.0.0-stage → 0.1.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.
Files changed (46) hide show
  1. package/README.md +160 -2
  2. package/dist/client.d.ts +109 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +410 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/env.d.ts +17 -0
  7. package/dist/env.d.ts.map +1 -0
  8. package/dist/env.js +61 -0
  9. package/dist/env.js.map +1 -0
  10. package/dist/flush.d.ts +31 -0
  11. package/dist/flush.d.ts.map +1 -0
  12. package/dist/flush.js +54 -0
  13. package/dist/flush.js.map +1 -0
  14. package/dist/index.d.ts +78 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +29 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/mailer.d.ts +10 -0
  19. package/dist/mailer.d.ts.map +1 -0
  20. package/dist/mailer.js +10 -0
  21. package/dist/mailer.js.map +1 -0
  22. package/dist/messages.d.ts +3 -0
  23. package/dist/messages.d.ts.map +1 -0
  24. package/dist/messages.js +34 -0
  25. package/dist/messages.js.map +1 -0
  26. package/dist/outbox.d.ts +48 -0
  27. package/dist/outbox.d.ts.map +1 -0
  28. package/dist/outbox.js +62 -0
  29. package/dist/outbox.js.map +1 -0
  30. package/dist/provider.d.ts +22 -0
  31. package/dist/provider.d.ts.map +1 -0
  32. package/dist/provider.js +35 -0
  33. package/dist/provider.js.map +1 -0
  34. package/dist/sale.d.ts +7 -0
  35. package/dist/sale.d.ts.map +1 -0
  36. package/dist/sale.js +8 -0
  37. package/dist/sale.js.map +1 -0
  38. package/dist/signature.d.ts +30 -0
  39. package/dist/signature.d.ts.map +1 -0
  40. package/dist/signature.js +82 -0
  41. package/dist/signature.js.map +1 -0
  42. package/dist/ulid.d.ts +7 -0
  43. package/dist/ulid.d.ts.map +1 -0
  44. package/dist/ulid.js +23 -0
  45. package/dist/ulid.js.map +1 -0
  46. package/package.json +50 -4
package/README.md CHANGED
@@ -1,3 +1,161 @@
1
- # Temporary Holding Version
1
+ # @solobrand/platform
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Bridge to SoloBrand: CRM events, the services layer, measurement.
4
+
5
+ Part of the [SoloBrand framework](../../README.md). Public API: `src/index.ts` (frozen types, see CONTRIBUTING.md).
6
+
7
+ An app never holds a provider key. Mail, AI, images… are asked of SoloBrand with the app's own
8
+ token, and SoloBrand charges credits. An app **is** an event source of the CRM.
9
+
10
+ ## Env (Worker vars / secrets) — all required
11
+
12
+ | Name | What |
13
+ |---|---|
14
+ | `SOLOBRAND_EVENTS_URL` | Where events are POSTed (https; http only to `localhost`). |
15
+ | `SOLOBRAND_EVENTS_KEY` | The event source's signing key (secret, ≥ 16 chars). |
16
+ | `SOLOBRAND_SERVICES_URL` | Base of the services layer (https). |
17
+ | `SOLOBRAND_APP_TOKEN` | The app's token (secret), sent as `Authorization: Bearer` to services only. |
18
+
19
+ A missing one fails at once (`createPlatformClient`, or `platformProvider()`'s boot) with
20
+ `AppError('internal', 'platform.env_missing', { params: { missing: 'A, B' } })` listing **every**
21
+ missing name (never values); a bad URL/short key gives `platform.env_invalid`.
22
+
23
+ ## Use
24
+
25
+ ```ts
26
+ import { platformMailer, platformProvider, platformToken } from '@solobrand/platform';
27
+ import { authTokens } from '@solobrand/auth';
28
+
29
+ app.register(platformProvider({ ctx: () => currentExecutionContext }));
30
+ app.singleton(authTokens.mailer, (c) => platformMailer(c.make(platformToken))); // auth mails via SoloBrand
31
+
32
+ const platform = app.make(platformToken);
33
+ await platform.events.emit({ type: 'reserva.creada', contact: { email }, data: { seats: 2 } });
34
+ await platform.events.sale.paid({ amount_minor: 1999, currency: 'MXN', sale_id: 's_1' }); // crm.sale.paid
35
+ const r = await platform.services.call<{ text: string }>('ai.complete', { prompt });
36
+ if (!r.ok) return r; // AppError shape: e.g. 402 → { code: 'unavailable', messageKey: 'platform.no_credits' }
37
+ ```
38
+
39
+ Or directly: `createPlatformClient(env, ctx, options?)`. `events.sale.paid / refunded / failed` is part of
40
+ `PlatformClient` (emits `crm.sale.*`). `saleEvents(client)` and the type `SoloBrandPlatformClient` remain
41
+ as **deprecated** aliases from the first release.
42
+
43
+ ## Events — the wire format (SoloBrand aligns to this)
44
+
45
+ `POST ${SOLOBRAND_EVENTS_URL}`, `Content-Type: application/json`, body:
46
+
47
+ ```json
48
+ { "id": "01JDZ…(ULID)", "type": "crm.sale.paid", "occurredAt": "2026-11-28T12:00:00.000Z",
49
+ "contact": { "email": "…", "phone": "…", "name": "…" }, "data": { "amount_minor": 1999, "currency": "MXN" } }
50
+ ```
51
+
52
+ Headers:
53
+
54
+ ```
55
+ Idempotency-Key: <id>
56
+ X-SoloBrand-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(SOLOBRAND_EVENTS_KEY, `${t}.${rawBody}`)>
57
+ ```
58
+
59
+ - Exported as constants/functions: `SIGNATURE_HEADER`, `SIGNATURE_VERSION` (`v1`),
60
+ `SIGNATURE_TOLERANCE_SECONDS` (300), `signEvent()`, `parseSignatureHeader()`,
61
+ `verifyEventSignature()` (constant-time, rejects stale `t`). The receiver verifies the raw body
62
+ **before** parsing, rejects `t` outside ±300 s and dedupes on `id`.
63
+ - `id` is a ULID unless given, and is the **same** on every retry; `t` is fresh per attempt.
64
+ - Delivery runs in `ctx.waitUntil`; `emit()` resolves right away and never throws. Up to 3 retries
65
+ on 5xx / 429 / network errors, backoff 250 ms · 2ⁿ (`retries`, `backoffMs` options). Other 4xx are
66
+ not retried. Redirects are not followed.
67
+ - **All attempts of one event fit in 24 s** (`deliveryBudgetMs`, never above 25 s): a Worker's
68
+ `waitUntil` is cut at 30 s, and anything still running then is lost without a log line. Each
69
+ attempt's timeout is `min(timeoutMs, (budget − backoffs) / attempts)` — 5.5 s with the defaults —
70
+ and retries that would not leave 1 s each are dropped (`planDelivery()` shows the plan).
71
+ - Logged on failure: `platform.event_retry` / `platform.event_failed` with `{ type, id, attempt(s),
72
+ status | error name }` only — never contact, data, the key or the token.
73
+ - `data` and `contact` are deep-copied without secret-named keys (`password*`, `*token`, `*secret*`,
74
+ `api_key`, `authorization`, `cookie`, `*_hash`, `cvv`, `card_number`, …) and prototype keys.
75
+ - `type` must match `^[a-z0-9][a-z0-9_-]*(\.[a-z0-9][a-z0-9_-]*)*$`; a bad type/id/occurredAt, or a
76
+ sale with a non-integer/negative `amount_minor` or a non-ISO-4217 `currency`, is logged
77
+ (`platform.event_invalid`) and not sent.
78
+
79
+ ## Durable outbox — an outage never loses an event
80
+
81
+ Retries inside `waitUntil` cover a blip, not an outage: when SoloBrand is down for minutes, a
82
+ `crm.sale.paid` would be gone. With an outbox the event is written to the app's own D1 **before**
83
+ the first attempt, removed once SoloBrand takes it, and otherwise retried by the app's cron:
84
+
85
+ ```ts
86
+ // database/index.ts — the table comes from a platform migration
87
+ import { platformMigrations } from '@solobrand/platform';
88
+ export const allMigrations = [...authMigrations, ...platformMigrations, ...migrations];
89
+
90
+ // bootstrap/app.ts
91
+ import { dbTokens } from '@solobrand/db';
92
+ import { databaseOutbox, platformProvider } from '@solobrand/platform';
93
+ platformProvider({ ctx: () => currentExecutionContext, outbox: (app) => databaseOutbox(app.make(dbTokens.database)) });
94
+
95
+ // src/worker.ts — and `"triggers": { "crons": ["*/5 * * * *"] }` in wrangler.jsonc
96
+ async scheduled(_controller, env, ctx) {
97
+ const app = appFor(env); // the booted app
98
+ ctx.waitUntil(flushPlatformOutbox(env, { outbox: databaseOutbox(app.make(dbTokens.database)), logger: app.logger }));
99
+ }
100
+ ```
101
+
102
+ - Table `platform_event_outbox` (`createPlatformOutboxTable`, in `platformMigrations`): one row per
103
+ **event id**, which is also the `Idempotency-Key` — saving the same event twice is one row, and a
104
+ flush that overlaps a late `waitUntil` is still counted once by SoloBrand. It holds the envelope
105
+ (contact and scrubbed data) only until it is delivered.
106
+ - After the in-request retries fail with 5xx / 429 / network, the row waits 1 min; each cron run
107
+ tries every due row once (`limit`, default 50) and doubles the wait (at most 1 h). A 4xx, or
108
+ `MAX_OUTBOX_ATTEMPTS` (20) attempts, marks it `failed_at` and logs `platform.event_failed`: kept to
109
+ be looked at, never retried, never deleted silently.
110
+ - If the outbox itself fails (D1 down), the event is still sent now and `platform.outbox_failed`
111
+ is logged. `flushPlatformOutbox()` returns `{ delivered, retried, failed }`.
112
+ - Logs while queued: `platform.event_queued` (warn) — type, id, attempts and why, never the data.
113
+
114
+ ## Services
115
+
116
+ `services.call(name, input)` → `POST ${SOLOBRAND_SERVICES_URL}/${name}` with
117
+ `Authorization: Bearer ${SOLOBRAND_APP_TOKEN}`, `redirect: 'manual'`, 10 s timeout, response capped
118
+ at 1 MiB. `name` uses the same pattern as event types (no `/`, `..`, `@`, `:`, `%`, spaces).
119
+ Success: `{ ok: true, value }` (or `data`), or any other JSON body as the value.
120
+
121
+ | SoloBrand says | Result error (`code` / `messageKey`) |
122
+ |---|---|
123
+ | HTTP 402, or `reason: no_credits` | `unavailable` / `platform.no_credits` |
124
+ | `reason: rate_limited`, HTTP 429 | `rate_limited` / `platform.rate_limited` |
125
+ | `reason: invalid_input`, HTTP 400/422 | `validation_failed` / `platform.invalid_input` (+ `errors` when well-formed) |
126
+ | `reason: forbidden`, HTTP 403 | `forbidden` / `platform.forbidden` |
127
+ | HTTP 401 | `internal` / `platform.unauthorized` (the app token is wrong — not the user's fault) |
128
+ | HTTP 404, `reason: not_found` | `internal` / `platform.service_not_found` |
129
+ | 5xx, network error, timeout | `unavailable` / `platform.unavailable` |
130
+ | 3xx, non-JSON 2xx, too large | `unavailable` / `platform.bad_response` |
131
+ | `{ ok:false }` with an unknown reason | `unavailable` / `platform.service_failed` (the reason is not echoed) |
132
+ | invalid service name | `internal` / `platform.service_invalid` (no request made) |
133
+
134
+ `mail.send({ to, subject, text, html? })` calls the `mail.send` service; a bad address, a line
135
+ break in `to`/`subject`, or more than one recipient (`,` or `;` in `to`) is `validation_failed` /
136
+ `platform.mail_invalid` without calling SoloBrand.
137
+ `platformMailer(client)` implements `@solobrand/auth`'s `Mailer` port (type-only import; auth is an
138
+ optional peer dependency).
139
+
140
+ Messages: `platformMessages` (es, en), added by `platformProvider()`.
141
+
142
+ ## Status
143
+
144
+ **TERMINADO** — F8 platform, 2026-11-28.
145
+
146
+ - **Implemented**: `createPlatformClient` (events with HMAC signature, ULID ids, waitUntil
147
+ delivery, 3 retries with backoff, PII-free logs, secret-key scrubbing; services with error
148
+ mapping incl. `platform.no_credits`; mail), `events.sale.paid/refunded/failed` on the
149
+ `PlatformClient` contract (accepted change, 2nd round), `platformMailer`, `platformProvider()`
150
+ (binds `platformToken`, adds messages, checks env at boot), `readPlatformEnv`, signature helpers
151
+ (`signEvent` / `verifyEventSignature`), `ulid`. Deprecated aliases: `saleEvents()`,
152
+ `SoloBrandPlatformClient` (still referenced by `docs/es`).
153
+ - **Tested** (`src/platform.test.ts`, fetch mock, 57 tests, ~99 % lines): signature verifiable and
154
+ checked against an independent HMAC vector; tampered/stale/wrong-key rejected; retries and
155
+ backoff; idempotency id and body stable across retries; no retry on 4xx; no PII / key / token in
156
+ logs; T-PL-1 (service names), T-PL-2 (no redirects, token only to the configured origin),
157
+ T-PL-4 (oversized / non-JSON responses), T-PL-5 (secret keys never forwarded); every error
158
+ mapping; missing/invalid env; provider boot; `events.sale` through the contract type.
159
+ - **Left (outside F8)**: the SoloBrand receiver adopts the signature format (integrator, in
160
+ brandai); `docs/es` can drop `saleEvents` / `SoloBrandPlatformClient` for `events.sale` / `PlatformClient`
161
+ (F7 docs); measurement is not in the contract yet.
@@ -0,0 +1,109 @@
1
+ import { type AppErrorShape, type Clock, type Logger } from '@solobrand/core';
2
+ import type { PlatformClient } from './index.js';
3
+ import { type PlatformEnv } from './env.js';
4
+ import { type EventOutbox } from './outbox.js';
5
+ export interface PlatformClientOptions {
6
+ /** Default `globalThis.fetch`. */
7
+ fetch?: typeof fetch;
8
+ /** Default a JSON logger (`createLogger()`). */
9
+ logger?: Logger;
10
+ clock?: Clock;
11
+ /** Retries after the first event delivery attempt, on 5xx / 429 / network errors. Default 3. */
12
+ retries?: number;
13
+ /** Backoff before retry n (1-based) is `backoffMs * 2^(n-1)`. Default 250 ms → 250, 500, 1000. */
14
+ backoffMs?: number;
15
+ /** How the client waits between retries (tests pass a no-op). Default `setTimeout`. */
16
+ sleep?: (ms: number) => Promise<void>;
17
+ /**
18
+ * Per-request timeout. Default 10 000 ms. For event delivery it is also capped so every
19
+ * attempt plus the backoffs fit in `deliveryBudgetMs`.
20
+ */
21
+ timeoutMs?: number;
22
+ /**
23
+ * Worst-case time for ALL delivery attempts of one event, backoffs included. Default
24
+ * 24 000 ms, never more than 25 000: a Worker's `waitUntil` is cut at 30 s, and work past
25
+ * it is lost without a trace (AUD-05). Retries that would not fit are dropped.
26
+ */
27
+ deliveryBudgetMs?: number;
28
+ /**
29
+ * Durable outbox (AUD-05): the event is written here BEFORE the first attempt and removed
30
+ * once delivered; an event SoloBrand did not take waits there for `flushPlatformOutbox()`
31
+ * (the app's cron). Without it, an outage longer than the retries loses the event (logged).
32
+ */
33
+ outbox?: EventOutbox;
34
+ /** Biggest services response read, in bytes. Default 1 MiB. */
35
+ maxResponseBytes?: number;
36
+ }
37
+ export type EmitInput = Parameters<PlatformClient['events']['emit']>[0];
38
+ /** @deprecated `PlatformClient` has `events.sale` now; use `PlatformClient`. */
39
+ export type SoloBrandPlatformClient = PlatformClient;
40
+ /** Event types and service names: lowercase, dot-separated, no path characters (T-PL-1). */
41
+ export declare const NAME_PATTERN: RegExp;
42
+ export declare function isValidName(name: unknown): name is string;
43
+ /**
44
+ * Keys never forwarded in event data, at any depth (T-PL-5, SEC-015): the logger's
45
+ * {@link SECRET_KEY_PATTERN} from `@solobrand/core` (one definition for the framework)
46
+ * plus payment fields.
47
+ */
48
+ export declare const SECRET_KEY: {
49
+ readonly test: (key: string) => boolean;
50
+ };
51
+ /** A JSON-safe deep copy of `data` without secret-named keys. */
52
+ export declare function scrubData(value: unknown, depth?: number): unknown;
53
+ /** HTTP status from SoloBrand → our error (`platform.no_credits` for 402). */
54
+ export declare function errorForStatus(status: number, service: string): AppErrorShape;
55
+ export declare const DEFAULT_DELIVERY_BUDGET_MS = 24000;
56
+ /** The hard ceiling: under the 30 s a Worker's `waitUntil` lives. */
57
+ export declare const MAX_DELIVERY_BUDGET_MS = 25000;
58
+ export interface DeliveryPlan {
59
+ /** Attempts in total (first + retries). */
60
+ readonly attempts: number;
61
+ /** Timeout of each attempt. */
62
+ readonly attemptTimeoutMs: number;
63
+ /** Wait before retry n (index n-1). */
64
+ readonly backoffs: readonly number[];
65
+ /** attempts * attemptTimeoutMs + the backoffs: never above the budget. */
66
+ readonly worstCaseMs: number;
67
+ }
68
+ /**
69
+ * How one event is delivered inside its budget: drops retries whose backoff would not leave
70
+ * at least 1 s per attempt, then shares what is left between the attempts (each at most
71
+ * `timeoutMs`). The worst case always fits in `min(budget, 25 s)`.
72
+ */
73
+ export declare function planDelivery(options?: {
74
+ retries?: number | undefined;
75
+ backoffMs?: number | undefined;
76
+ timeoutMs?: number | undefined;
77
+ deliveryBudgetMs?: number | undefined;
78
+ }): DeliveryPlan;
79
+ /** What one delivery ended in. */
80
+ export type DeliveryOutcome = {
81
+ readonly ok: true;
82
+ readonly attempts: number;
83
+ } | {
84
+ readonly ok: false;
85
+ readonly attempts: number;
86
+ readonly retryable: boolean;
87
+ readonly reason: string;
88
+ };
89
+ export interface Deliverer {
90
+ deliver(type: string, id: string, body: string, plan: DeliveryPlan): Promise<DeliveryOutcome>;
91
+ }
92
+ export declare function createDeliverer(config: PlatformEnv, deps: {
93
+ doFetch: typeof fetch;
94
+ logger: Logger;
95
+ clock: Clock;
96
+ sleep: (ms: number) => Promise<void>;
97
+ }): Deliverer;
98
+ /** `status_503` → `{ status: 503 }`, `error_TypeError` → `{ error: 'TypeError' }` (for logs). */
99
+ export declare function reasonFields(reason: string): {
100
+ status: number;
101
+ } | {
102
+ error: string;
103
+ };
104
+ /**
105
+ * Builds the client. Reads the env first: a missing/invalid name throws at boot
106
+ * (`platform.env_missing` / `platform.env_invalid`), never later in a request.
107
+ */
108
+ export declare function buildPlatformClient(env: Readonly<Record<string, unknown>>, ctx: ExecutionContext, options?: PlatformClientOptions): PlatformClient;
109
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkF,KAAK,aAAa,EAAE,KAAK,KAAK,EAAkB,KAAK,MAAM,EAAe,MAAM,iBAAiB,CAAC;AAC3L,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAM9D,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAA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