@plitzi/sdk-event-bridge 0.37.1 → 0.37.2
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/CHANGELOG.md +145 -0
- package/dist/EventBridgeContextProvider.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,150 @@
|
|
|
1
1
|
# @plitzi/sdk-event-bridge
|
|
2
2
|
|
|
3
|
+
## 0.37.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ## Authoring and agents
|
|
8
|
+
- **A step's params are templates in full.** Only a bare name (`{{ post.slug }}`) used to be recognised, so a
|
|
9
|
+
condition or a loop in a `setState` or a webhook body was handed on as its own text — a flag set to
|
|
10
|
+
`{% if … %}1{% endif %}` stored the template, a non-empty string every later check read as true. Any `{{ }}` or
|
|
11
|
+
`{% %}` in a param is now evaluated; what it resolves to is data and is not evaluated again.
|
|
12
|
+
- **Twig tests work.** `x is defined`, `is empty`, `is null`, `is iterable`, `is even`, `is odd` (and `is not …`) used
|
|
13
|
+
to be read as comparisons with a variable of that name — `x is defined` answered true exactly when `x` was not
|
|
14
|
+
defined. Anything else on the right of `is` still compares.
|
|
15
|
+
- **A group takes an access chain.** `(rows|find('id', 3)).title` read the whole row; the key after the parenthesis
|
|
16
|
+
was never parsed.
|
|
17
|
+
- **An expression that chose to be empty renders empty** under `keepEmptyTokens`. A kept token is for a name still
|
|
18
|
+
waiting for a value; `{{ on ? 'active' : '' }}` said "nothing" on purpose, and handing back its text made the
|
|
19
|
+
empty branch a non-empty string.
|
|
20
|
+
- **Checkbox params written as text are booleans.** `dateConverter({ isUnix: 'false' })` read `'false'` as yes and
|
|
21
|
+
gave an ISO date back raw. Every utility's checkbox params are normalised before its callback runs.
|
|
22
|
+
- **`condition-starts-visible`** warns about a visibility computed from data on an element that starts on screen: it
|
|
23
|
+
is drawn until its provider answers and then hidden — an empty state or a "get started" card flashing past on
|
|
24
|
+
every load. `visible: false` makes it wait hidden. The export reads a visibility binding back in its place, so a
|
|
25
|
+
space whose condition is not its last binding round-trips unchanged.
|
|
26
|
+
- **A source named by its short id inside a binding's template is refused** with the full name, as it already was in
|
|
27
|
+
a flow: `{{ stats.total }}` resolved to nothing and the element showed its empty branch.
|
|
28
|
+
- **`activeOn(class, pageIds)`** marks a menu's current entry from `navigation.currentPageId` — one binding for a menu
|
|
29
|
+
kept in a layout. `variantFrom` now says `append: 'true'`, which is what it did.
|
|
30
|
+
- **Two elements with one id** name where the first one was written. **`template-never-resolved`** warns about a
|
|
31
|
+
condition left in an attribute, which only resolves `{{ name|filter }}` tokens.
|
|
32
|
+
- **The authoring skill is a folder**: `SKILL.md` plus references for layouts, data and visibility, templates,
|
|
33
|
+
flows, structure, testing and a review checklist. `plitzi create` copies all of it, and writes an `AGENTS.md`
|
|
34
|
+
(imported by `CLAUDE.md`) pointing any agent at it.
|
|
35
|
+
|
|
36
|
+
- **A new space starts on a page worth keeping.** The space `POST /spaces` and `plitzi create` both begin from is
|
|
37
|
+
redesigned: a top bar with the theme switch, a hero with two calls to action, and six guides — each a card linking to
|
|
38
|
+
its page of the docs (`https://plitzi.com/docs/…`). Every link used to be `#`, and one promised a course that does
|
|
39
|
+
not exist. The palette is a set of light/dark tokens in Geist, the guides are one list mapped to one card, and the
|
|
40
|
+
bands of the page share a `shell` class — the page is written the way the authoring skill asks a space to be.
|
|
41
|
+
- **The copy `plitzi create` writes passes its own project's lint.** An import of the package that would not fit
|
|
42
|
+
120 columns is wrapped one name per line, as the project's formatter would wrap it.
|
|
43
|
+
|
|
44
|
+
## Server actions and scheduled jobs
|
|
45
|
+
|
|
46
|
+
**Scheduled jobs across replicas, out of the box, on the database a deployment already runs.** The scheduler and the
|
|
47
|
+
workers were already the package's; where the jobs wait was left to each deployment to write — and a queue is the part
|
|
48
|
+
that is easiest to get subtly wrong. Two helpers now build the adapters over a store the deployment owns, without the
|
|
49
|
+
package opening a connection or keeping data of its own:
|
|
50
|
+
|
|
51
|
+
- `@plitzi/sdk-server/mongo` — `createMongoJobQueue({ db })` and `createMongoKv({ db })`, over a `Db` (or a getter for a
|
|
52
|
+
client that reconnects). Creates the indexes its queries need; `mongodb` is an optional peer, used for its types.
|
|
53
|
+
- `@plitzi/sdk-server/mysql` — `createMysqlJobQueue({ pool })` and `createMysqlKv({ pool })`, over a `mysql2` pool.
|
|
54
|
+
Each job is claimed by a single-row compare-and-set, so replicas claiming at once never deadlock. Creates its three
|
|
55
|
+
tables on first use, or hands them to your own migrations through `mysqlJobSchemaStatements()`.
|
|
56
|
+
|
|
57
|
+
Every instant is the database server's, never a replica's. The in-process queue and both helpers pass one contract test
|
|
58
|
+
suite: exactly-once enqueue, atomic claims, leases that lapse and are reaped, heartbeats, settlements ignored from a
|
|
59
|
+
worker that lost its claim, refunded hand-backs, schedules advanced by compare-and-set, operator retry and cancel.
|
|
60
|
+
|
|
61
|
+
**`closeOnSignals(server, { afterClose })`** closes the server on SIGTERM/SIGINT and exits only once it has — so a
|
|
62
|
+
deploy finishes the jobs a replica is running and leaves the waiting ones for the next. A second signal exits at once.
|
|
63
|
+
Opt-in: a host with its own signal handling calls `server.close()` itself. Projects from `plitzi create` use it.
|
|
64
|
+
|
|
65
|
+
**A replica that is told to stop finishes the jobs it is running — and only those.** `server.close()` (and the job
|
|
66
|
+
worker's `stop()`) now waits for every running job to end however long past its lease that is, and keeps renewing
|
|
67
|
+
their claims while it waits. It used to stop renewing the moment the drain began and give up at the lease: a job longer
|
|
68
|
+
than its lease was taken over by another replica and run a second time while the first was still finishing it, and the
|
|
69
|
+
process exited in the middle of it. What is still waiting is not touched — it stays in the shared queue for the replica
|
|
70
|
+
that is staying or the one the deploy starts — and a job claimed in the instant the stop arrived is handed back with its
|
|
71
|
+
attempt refunded, never started. A run is bounded by its own timeout, which is the number an orchestrator's grace period
|
|
72
|
+
has to cover.
|
|
73
|
+
|
|
74
|
+
- **An every-minute schedule fired every other minute.** After producing a fire, the scheduler asked for the next
|
|
75
|
+
one from `lateness + 1 minute`, and `cronNextFire` rounds up to a whole minute — so a sweep that ran even a second
|
|
76
|
+
late (with the default 15-second sweep, nearly all of them) skipped the minute it should have produced. It now asks
|
|
77
|
+
from the minute after the one the sweep ran in. Only expressions with consecutive-minute fires were affected;
|
|
78
|
+
hourly and daily schedules were not.
|
|
79
|
+
- **A job that gives up says which step failed and why.** Its `error` and the failed attempt in its history used to
|
|
80
|
+
read "the flow ended failed" for every failure there is; they now read `step "<id>" failed: <message>`, taken from
|
|
81
|
+
the run's outline — already redacted of every credential the run resolved, so nothing reaches the job that the
|
|
82
|
+
run history would not show.
|
|
83
|
+
- **`apiContainer` takes `refreshSeconds`**: it asks again on its own every N seconds, for a page showing something
|
|
84
|
+
still moving — a queue, a feed, a status board. It is the same refresh `performQuery` runs, so it works for both
|
|
85
|
+
runtimes (a browser request is sent again; a server provider asks for its own RSC slice again). It pauses while
|
|
86
|
+
the tab is hidden and never starts a refresh while the last one is in flight. `0`, the default, never does. Before
|
|
87
|
+
this a live server provider needed a plugin element of its own to call `useRscRefresh` on a timer: `onApiSuccess`
|
|
88
|
+
never fires for a server provider, so there was no way to author the loop. The builder shows it as "Refresh every
|
|
89
|
+
(s)" for either runtime.
|
|
90
|
+
- **`onApiSuccess` / `onApiError` fire for a server provider.** The declaration offered them for every
|
|
91
|
+
`apiContainer`, but they were decided from the browser request alone — which a `runtime: 'server'` provider never
|
|
92
|
+
makes — so a flow wired to them never ran. They now fire when the provider's slice arrives (or the payload arrives
|
|
93
|
+
without it), and again on each refresh, the same as a browser refetch. A payload resolved for another page fires
|
|
94
|
+
neither. **A space that wired a flow to one of them will now see it run.**
|
|
95
|
+
- **The theme toggle shows one icon by default.** It renders both — which one is right depends on stored state, and
|
|
96
|
+
markup that depended on it would differ between the server and the browser — and until now every space had to copy
|
|
97
|
+
ten lines of `customCss` to hide the other; one that did not showed a sun and a moon side by side. The SDK's base
|
|
98
|
+
layer now shows the icon of the scheme in use, and a space's own rule still wins.
|
|
99
|
+
- **`variantFrom(cls, source)`** in `@plitzi/sdk-authoring` binds which of a CLASS's variants an element wears to a
|
|
100
|
+
value in the data — a status pill that is amber while a job waits and green once it is done. Written by hand the
|
|
101
|
+
variant key is the trap: it names the selector the variants belong to, and the element's type (`text.base`) is a
|
|
102
|
+
different selector from its class (`statusPill.base`), so the element rendered with no variant and nothing
|
|
103
|
+
reported it. The helper takes the key from the class declaration.
|
|
104
|
+
- **`authorSpace` refuses a flow template that reads a source by its short name.** A binding completes the prefix
|
|
105
|
+
(`jobRows.item.id` → `list_jobRows.item.id`), so the short form is the one an author learns first; a step's params
|
|
106
|
+
are read as written, and there it resolved to nothing — a row's button posted an empty id and every layer below
|
|
107
|
+
reported success. The error names the full source. A root that is a step of the same flow is left alone.
|
|
108
|
+
- New example, [`05-with-server-actions/05-schedules`](../examples/05-with-server-actions/05-schedules): scheduled and
|
|
109
|
+
delayed jobs on a self-hosted server, with the `ActionJobQueue` and `kv` seams written out in full over one SQLite
|
|
110
|
+
file, two replicas sharing it, failover when one is killed, and a board that watches it happen.
|
|
111
|
+
|
|
112
|
+
## Rendering, data and styles
|
|
113
|
+
- **A server element inside a layout is resolved.** `collectServerElements` walked the page alone, so a
|
|
114
|
+
`runtime: 'server'` provider in a layout — a dashboard's sidebar, a section's header — was never resolved: the RSC
|
|
115
|
+
payload came back empty and the element rendered with nothing. It now walks the page and every shell in its layout
|
|
116
|
+
chain.
|
|
117
|
+
- **The twig `date` filter reads an epoch.** `new Date("1790143200000")` is Invalid Date, so an epoch in milliseconds
|
|
118
|
+
handed over as text — how an attribute passes one — formatted as nothing. A number, or a string of digits, is now
|
|
119
|
+
read as milliseconds.
|
|
120
|
+
- **An action is called by its name, not by its trigger kind.** `actionName` took the first trigger's title, and a
|
|
121
|
+
trigger nobody named is titled with its kind — so every rendered action in a workspace read "render" and every clock
|
|
122
|
+
"schedule". A title that only repeats the kind is no longer a name, and `defineAction` titles each trigger with the
|
|
123
|
+
action's name.
|
|
124
|
+
- **`variant` on an element that wears a class is that class's variant** when the class declares it and the type does
|
|
125
|
+
not. Keyed by the type, `text({ class: avatar, variant: 'violet' })` named `text--violet`, a selector nothing wears,
|
|
126
|
+
and rendered with no variant at all. Exporting a document back to authoring reads the same key back into `variant`.
|
|
127
|
+
- **`variantFrom` takes `{ slot, template }`**, where `template` turns a value into a variant name for data that does
|
|
128
|
+
not already speak in them — `"{{ source == 'code' ? 'on' : '' }}"`. The third argument was the slot name alone.
|
|
129
|
+
- **Entry declarations no longer alternate with `export {}`.** In `@plitzi/sdk-server` and `@plitzi/sdk-mcp` a repeated
|
|
130
|
+
`build:dev` left some `dist/<entry>.d.ts` as a ten-byte `export {}`, and consumers saw "has no exported member". The
|
|
131
|
+
cause was `insertTypesEntry` writing a types entry over the real declaration of the same path; it is gone.
|
|
132
|
+
- **Signing in keeps what a guest was doing.** `runtimeStatePersist` reset `runtime.state` whenever its owner changed,
|
|
133
|
+
and a guest becoming a user is a change — so a sign-in screen that remembered where to send somebody (`?redirect=`)
|
|
134
|
+
forgot it the moment the session arrived, and the sign-in ended on the fallback page instead. Only a change FROM an
|
|
135
|
+
account resets now: one account's state still never reaches the next, and a guest has no account to protect.
|
|
136
|
+
|
|
137
|
+
**A value with functions inside functions is written as it was given, and fast.** A CSS value was split into layers
|
|
138
|
+
at commas by a pattern that could only see one level of parentheses, so `var(--bg, light-dark(#fff, #111))` was cut at
|
|
139
|
+
its inner comma and half a function went on into the stylesheet. The half was then tokenised by an expression that
|
|
140
|
+
nested one quantifier inside another and backtracked exponentially on it — nearly two seconds for thirty characters,
|
|
141
|
+
on every generation of that selector's cache. Both are now one linear scan that splits only outside parentheses and
|
|
142
|
+
quotes. Generated caches keep the spacing the value was written with inside functions (`repeat(3, minmax(0, 1fr))`,
|
|
143
|
+
`color-mix(in oklab, oklch(…) 50%, transparent)`), where they used to drop it after the first comma.
|
|
144
|
+
|
|
145
|
+
- Updated dependencies
|
|
146
|
+
- @plitzi/sdk-shared@0.37.2
|
|
147
|
+
|
|
3
148
|
## 0.37.1
|
|
4
149
|
|
|
5
150
|
### Patch Changes
|
|
@@ -5,5 +5,5 @@ export type EventBridgeContextProviderProps = {
|
|
|
5
5
|
debugMode: boolean;
|
|
6
6
|
onInit?: (instance: EventBridgeContextValue) => void;
|
|
7
7
|
};
|
|
8
|
-
declare const EventBridgeContextProvider: ({ children, debugMode, onInit }: EventBridgeContextProviderProps) => import(
|
|
8
|
+
declare const EventBridgeContextProvider: ({ children, debugMode, onInit }: EventBridgeContextProviderProps) => import('react').JSX.Element;
|
|
9
9
|
export default EventBridgeContextProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-event-bridge",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"type": "module",
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@plitzi/sdk-shared": "0.37.
|
|
48
|
+
"@plitzi/sdk-shared": "0.37.2",
|
|
49
49
|
"prop-types": "^15.8.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|