@plitzi/sdk-event-bridge 0.37.8 → 0.37.9
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 +235 -0
- package/dist/EventBridgeContext.mjs +2 -3
- package/dist/EventBridgeHelper.mjs +1 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,240 @@
|
|
|
1
1
|
# @plitzi/sdk-event-bridge
|
|
2
2
|
|
|
3
|
+
## 0.37.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ae61a4: ## Components replace segments
|
|
8
|
+
|
|
9
|
+
- **What a component is:** a reusable block written once and placed anywhere as an instance. An edit to the component
|
|
10
|
+
is an edit to every instance.
|
|
11
|
+
- **Where it lives:** in the space document, as `schema.components`, one tree per component and never in
|
|
12
|
+
`schema.flat`. It is published, rolled back, copied by templates and exported with the space.
|
|
13
|
+
- **Props and slots:**
|
|
14
|
+
- A component declares props (`type`, `description`, `required`, `default`, `options`). An instance hands them in
|
|
15
|
+
as its own attributes, so templates and bindings reach them. Inside, they are read as `{{ props.<name> }}`.
|
|
16
|
+
- Slots are elements an instance fills; each child names its slot in `attributes.slot`.
|
|
17
|
+
- **A prop an instance leaves out prints nothing.** It is its `default`, or `null`. `props` is a settled source:
|
|
18
|
+
- `processTwig` takes `{ settled }` in place of `keepEmptyTokens: true`.
|
|
19
|
+
- Every other empty token is still kept for a later pass.
|
|
20
|
+
- `COMPONENT_PROPS_SOURCE` names the source.
|
|
21
|
+
- **Fixed: a flow in a list row or a component instance acts on its own copy.** A step's target resolves in the
|
|
22
|
+
replica the flow fired in first, then outwards. It used to reach whichever copy registered last.
|
|
23
|
+
- **Fixed: an instance's own `visible` hides it in preview.** The same goes for an element reference.
|
|
24
|
+
- **Fixed: a list row keeps its state with its record.** Rows are keyed by each record's unique `id`, so filtering no
|
|
25
|
+
longer moves one row's state onto another.
|
|
26
|
+
- **Closed scope:** inside, a component reads only its props and the globals. The validator, `lintSpace` and
|
|
27
|
+
`authorSpace` each refuse a read of the page around an instance. Components nest, and a cycle is refused.
|
|
28
|
+
- **Where to use them:**
|
|
29
|
+
- In code (`@plitzi/sdk-authoring`): `SpaceSpec.components` and `component(id, { props, children })`.
|
|
30
|
+
`specFromSpace` and `specToSource` read and write both.
|
|
31
|
+
- In the builder:
|
|
32
|
+
- a Components panel lists them, and an open component becomes the canvas;
|
|
33
|
+
- an element becomes a component with **Save as component**;
|
|
34
|
+
- in an instance's settings, an instance gets its props and slots, or is **detached** back into a copy.
|
|
35
|
+
- In the MCP: `upsertComponent` and `deleteComponent`. Element ops work inside a component through `pageRef`.
|
|
36
|
+
- **Schema helpers:** `@plitzi/sdk-schema` gains `addComponent`, `updateComponent`, `removeComponent`,
|
|
37
|
+
`detachInstance`, `renameElement`, `treeOf`, `flatMapOf` and `documentIds`.
|
|
38
|
+
- **GraphQL and live events:** `SpaceAddComponent`, `SpaceUpdateComponent`, `SpaceRemoveComponent` and
|
|
39
|
+
`SpaceDetachInstance`, each with a live event. History records a declaration change as a `component` entry.
|
|
40
|
+
- **Breaking: segments are removed.** This covers:
|
|
41
|
+
- `@plitzi/sdk-shared`'s segment types, queries, mutations, context and `SEGMENT_*` events;
|
|
42
|
+
- `referenceType: 'segment'`;
|
|
43
|
+
- the `Segments` builder module;
|
|
44
|
+
- `Space.segments` and the `Segment`/`Segments` queries;
|
|
45
|
+
- `CommonState.prevSchema`.
|
|
46
|
+
- **Breaking: `ElementLayout` and `LayoutBody` change shape.**
|
|
47
|
+
- `ElementLayout` is `{ slots, rootId, type }`; it was `{ containerId }`.
|
|
48
|
+
- `LayoutBody` takes `bodies` keyed by slot.
|
|
49
|
+
- `reference`'s `referenceContainer` attribute is removed.
|
|
50
|
+
- Guide: `docs/en/components.md`.
|
|
51
|
+
|
|
52
|
+
## Functions ask for the time they need
|
|
53
|
+
- **What changes:** a task can ask for more CPU or wall time than the default with `limits`, in milliseconds. Example:
|
|
54
|
+
`limits: { cpuMs: 1000, wallMs: 20_000 }`. `defineFunctions({ limits })` asks it for every task and route at once,
|
|
55
|
+
and a task's own limits win over those.
|
|
56
|
+
- **What a run is given:** what it asked for, or the default (100 ms of CPU, 10 s) when it asked for nothing. Never
|
|
57
|
+
above the space's plan or the deployment's ceiling.
|
|
58
|
+
- **Deployment ceilings:** `functions.limits` sets them. `DEFAULT_FUNCTION_CEILINGS` covers each unset one, at 2 s of
|
|
59
|
+
CPU and 30 s.
|
|
60
|
+
- **Asking for more than the ceiling** is a problem when the functions are saved; it is never quietly cut down.
|
|
61
|
+
- **Manifest:** carries what each task asked for, and the builder shows it beside the task.
|
|
62
|
+
|
|
63
|
+
## Functions answer under `/fn`, not `/api`
|
|
64
|
+
|
|
65
|
+
A space's routes are served at `/fn/<path>` (`FUNCTION_ROUTES_PREFIX`). `/api` is a slug a site wants for a page of its
|
|
66
|
+
own. A page under `/fn` is refused instead (`page-route-reserved`).
|
|
67
|
+
|
|
68
|
+
## The builder's Functions panel
|
|
69
|
+
|
|
70
|
+
Rebuilt around the code. The panel reads `defineFunctions` as it is typed and writes into it, so the code stays the one
|
|
71
|
+
place a function is declared.
|
|
72
|
+
|
|
73
|
+
- **Layout:** the tasks, routes and files on the left, the code in the middle, the selected task on the right.
|
|
74
|
+
- **Live list:** tasks and routes are listed as the code declares them, including tasks imported from another file.
|
|
75
|
+
A task you have written but not saved says so. Tasks built by calling something are counted, and listed once saved.
|
|
76
|
+
- **Code and panel follow each other:** clicking a task or a route opens its file at its line. Putting the cursor inside
|
|
77
|
+
a task's code selects that task.
|
|
78
|
+
- **New task:** + in Tasks asks for its namespace, action and title. The task is written into `defineFunctions` with a
|
|
79
|
+
`run` to start from, in the file's own quotes, and the editor opens on it.
|
|
80
|
+
- **Time limit:** each task gets a slider from 100 ms to 1 s of CPU per run, with presets. The value is written into
|
|
81
|
+
the task as `limits: { cpuMs }`. "Use default" takes it out. `DEFAULT_FUNCTION_TIME_LIMITS` in
|
|
82
|
+
`@plitzi/sdk-shared/actions` is the default both the panel and the server use.
|
|
83
|
+
- **Test:** fills a task's params the way its step does, from their defaults: a select, a switch or text. JSON stays a
|
|
84
|
+
toggle away. With unsaved changes, the button reads "Save & run": it saves, then runs. If the save fails, it says why.
|
|
85
|
+
- **Header:** shows Saved, Unsaved (and in how many files) or the number of problems the last save found. ⌘S saves.
|
|
86
|
+
**Discard** asks first, then puts every file back to what was last saved, or back to nothing for functions never
|
|
87
|
+
saved. Removing the functions is a quiet button beside Save.
|
|
88
|
+
- **Problems:** clicking one opens its file at its line.
|
|
89
|
+
- **Editor:** each file has its own editor and undo history. Opening another file no longer marks the one you left as
|
|
90
|
+
changed. Before this, it could also write the newly opened file's text into the one you left. The cause was in
|
|
91
|
+
`@plitzi/plitzi-ui`'s CodeMirror, fixed in 1.6.25, which every package now depends on. That release also sets code
|
|
92
|
+
editors (several lines) in a monospaced face again. Long lines scroll inside the editor, and the line numbers stay
|
|
93
|
+
in place.
|
|
94
|
+
|
|
95
|
+
## A space's own functions are their own category of steps
|
|
96
|
+
|
|
97
|
+
In the action editor's step picker, the space's own functions are listed under **Functions**, apart from the
|
|
98
|
+
platform's **Tasks**. The other headings now read Callbacks, Global callbacks and Utilities. The saved step is still a
|
|
99
|
+
`task` node.
|
|
100
|
+
|
|
101
|
+
- `@plitzi/sdk-server`: every registered task has an `origin`, `'deployment'` (shipped with the server or a native
|
|
102
|
+
function) or `'space'` (from the space's functions). `describeCatalog`, `/_action/catalog` and the builder's
|
|
103
|
+
`SpaceActionTasks` carry it (`ActionTaskDescriptor.origin`).
|
|
104
|
+
- `@plitzi/sdk-shared`: an `InteractionCallback` may name the `group` the picker lists it under.
|
|
105
|
+
|
|
106
|
+
## Fixed: preview no longer breaks a builder that is embedded in a page
|
|
107
|
+
|
|
108
|
+
When the builder is mounted inside a Plitzi page (the platform's `/spaces/:id/update`), going to preview with a page
|
|
109
|
+
that has SEO turned on left the builder unstyled. The previewed page wrote its title and description through a head
|
|
110
|
+
manager of the builder's own, and that manager rewrote the host page's head, removing the builder's own stylesheet.
|
|
111
|
+
|
|
112
|
+
- `@plitzi/sdk-shared`: a new render setting, `ownsHead`, says whether the page may write the document head. It is on
|
|
113
|
+
by default (`DEFAULT_RENDER_SETTINGS`).
|
|
114
|
+
- `@plitzi/sdk-elements`: `Page` writes its SEO only where `ownsHead` is on.
|
|
115
|
+
- Builder: sets `ownsHead: false` for its canvas. A page drawn there is in a frame, and the document head is the
|
|
116
|
+
editor's. The canvas's own `HelmetProvider` is gone.
|
|
117
|
+
|
|
118
|
+
## Fixed: the builder's plan usage panel shows the space being edited
|
|
119
|
+
- **The 404 is gone.** Opening Plan usage said "The account breakdown could not be read (The server answered 404.)".
|
|
120
|
+
The panel asked `/account/usage`, which went away when accounts became workspaces.
|
|
121
|
+
- **Only this space.** The panel listed every space of the workspace. It now reads `/spaces/:spaceId/usage`, which
|
|
122
|
+
now also answers the space's own `pages` (the heaviest ten), `pagesTotal` and `periodEndsAt`. The plan's ceilings
|
|
123
|
+
stay on top. Anyone who can edit the space can read it, including a guest of another workspace.
|
|
124
|
+
- **It scrolls.** A long breakdown scrolls inside the modal, where it used to overflow.
|
|
125
|
+
- **`getKeyDecoded(webKey, true)` reads the token's subject.** The function, in `@plitzi/sdk-shared`, looked for
|
|
126
|
+
`data.spaceId`, which space tokens no longer carry, so every space decoded as 0. The builder asked about space 0, and
|
|
127
|
+
the builder and the SDK kept every space's persisted state under the same key on a host. Pages served without a
|
|
128
|
+
`webKey` (SSR) still decode as 0, which is what their painted-state cookie is named after.
|
|
129
|
+
|
|
130
|
+
## Fixed: a remote plugin in the builder reads the canvas it sits in
|
|
131
|
+
|
|
132
|
+
The builder carries its own copy of the Plitzi runtime. A remote plugin imports `@plitzi/plitzi-sdk`, which the page's
|
|
133
|
+
import map resolves to the SDK's copy. Each copy made its own React contexts, so on the builder's canvas a plugin read
|
|
134
|
+
none of the canvas's providers. In the builder embedded in Plitzi's site, it read the site around the builder instead:
|
|
135
|
+
the site's element as its own, the site's live mode (so it stayed interactive while being edited), and the site's store
|
|
136
|
+
and interactions.
|
|
137
|
+
|
|
138
|
+
- `@plitzi/sdk-shared` gains `sharedContext(name, default)`: a context made once per page and handed to every copy of
|
|
139
|
+
the runtime that asks for it.
|
|
140
|
+
- The runtime's contexts now go through it, so a provider from any copy reaches a consumer from any copy:
|
|
141
|
+
- `@plitzi/sdk-shared`: service, component, schema, network, theme scope, dev tools, builder.
|
|
142
|
+
- `@plitzi/sdk-elements`: element, element parent, layout body.
|
|
143
|
+
- interactions, plugins, event bridge, auth, variables and style.
|
|
144
|
+
- The store's contexts need `@plitzi/nexus` 1.4.0, which does the same. Every `@plitzi/*` package now asks for
|
|
145
|
+
`^1.4.0`, which is published.
|
|
146
|
+
|
|
147
|
+
## The source of plugins and runtimes is kept on the space
|
|
148
|
+
|
|
149
|
+
What a plugin or a runtime is built from now goes up with it, so a space can be taken back out as a project
|
|
150
|
+
(`plitzi create --from`, below).
|
|
151
|
+
|
|
152
|
+
- `@plitzi/cli`:
|
|
153
|
+
- `plitzi pack plugin` writes the plugin's source beside its zip: every file of the project its elements import,
|
|
154
|
+
`import type` included, and the packages they need. `--source-root` names the project those paths are relative to.
|
|
155
|
+
- `plitzi upload plugin` and `plitzi runtime push` keep that source on the space, in its private bucket.
|
|
156
|
+
- `plitzi pack source` writes it to a file.
|
|
157
|
+
- A source that cannot be kept (a file outside the project, an undeclared package, a credential in the code) never
|
|
158
|
+
stops the upload or the push: they say why, and the artifact is kept built only.
|
|
159
|
+
- `@plitzi/sdk-shared/source`: the snapshot's format, the paths it may hold and the credential check, shared by the CLI
|
|
160
|
+
and the platform.
|
|
161
|
+
|
|
162
|
+
## `plitzi create --from` and `plitzi pull`: a space on Plitzi as a project of your own
|
|
163
|
+
|
|
164
|
+
The way back from everything the CLI puts on Plitzi. `plitzi create my-board --from pizarra` writes a server project
|
|
165
|
+
holding what the space is made of, and runs it with nothing of Plitzi's: neither its servers nor its CDN. `plitzi pull`
|
|
166
|
+
keeps it in step with the space. See `docs/en/projects-from-spaces.md`.
|
|
167
|
+
|
|
168
|
+
- **What lands in the project:**
|
|
169
|
+
- its pages as authoring code;
|
|
170
|
+
- its server actions as `defineAction` code — JSON, with the reason said, for one that would not read back exactly;
|
|
171
|
+
- its plugins and runtime as the source they were uploaded from, and its functions;
|
|
172
|
+
- its files, downloaded into `public/`, with every CDN address rewritten to the project's.
|
|
173
|
+
- **`src/main.ts`** serves all of it, the runtime in the same process.
|
|
174
|
+
- **`.env`** gets a key made for the project's actions to sign with, and the names of the variables and credentials
|
|
175
|
+
the space had. Their values stay on Plitzi.
|
|
176
|
+
- **Who may run it:** the person must be signed in and able to change the space (owner, administrator or writer).
|
|
177
|
+
- **Plugins** are rebuilt against the project's SDK. One uploaded before sources were kept runs as it was built, from
|
|
178
|
+
`vendor/plugins/`, and the report says to upload it again.
|
|
179
|
+
- **The end of `create`** says what came across differently, including a space whose visitors sign in with Plitzi.
|
|
180
|
+
- `--source cloud` keeps the pages on Plitzi and runs the rest locally.
|
|
181
|
+
- **Any version:** `--environment` and `--revision` take out a published snapshot — its latest, or one revision pinned
|
|
182
|
+
— instead of the draft, with the source its plugins and runtime were built from then. A cloud project serves that
|
|
183
|
+
revision pinned.
|
|
184
|
+
- **`plitzi pull`** writes what changed on the space, keeps what changed in the project, and writes nothing when a
|
|
185
|
+
file changed on both — naming them, with `--force` to take the space's copy. It never touches `.env`, only adds to
|
|
186
|
+
`package.json`, and keeps `plitzi functions push` working from the project. It follows the version the project was
|
|
187
|
+
made from, and `--environment`/`--revision` move it.
|
|
188
|
+
- `@plitzi/sdk-authoring`:
|
|
189
|
+
- `actionSpecFromEntry` reads an action document back into its `defineAction` declaration, only when the round trip
|
|
190
|
+
is exact, and `actionToSource` writes it as a module.
|
|
191
|
+
- `defineAction` takes `limits`.
|
|
192
|
+
- `specToSource` takes `importExtension: '.ts'`, for split files that Node imports as they are.
|
|
193
|
+
|
|
194
|
+
## The builder shows what a snapshot holds
|
|
195
|
+
|
|
196
|
+
**Make Snapshot** lists what it will freeze — pages, layouts and elements, server actions, connectors, functions, the
|
|
197
|
+
runtime and the plugins, each with whether its source is kept — and what no snapshot freezes: the space's files, its
|
|
198
|
+
variables and credentials. A space's components are part of its document, so they are frozen with its pages. **Publish Snapshot** lists what the chosen environment's snapshot holds.
|
|
199
|
+
|
|
200
|
+
## Fixed: a space read from Plitzi kept its server elements
|
|
201
|
+
- **What happened:** a page server reading its space from Plitzi (`createCloudAdapters`) never ran an element's
|
|
202
|
+
`render` action, and a browser-rendered space ignored `loadStrategy`. The space's GraphQL answered neither
|
|
203
|
+
`runtime` nor `loadStrategy` of an element, nor the space's `rsc` settings.
|
|
204
|
+
- **Now:** the platform answers them, and the SDK, the builder and the cloud adapters ask for them.
|
|
205
|
+
|
|
206
|
+
## A plugin the deployment registers is not looked for elsewhere
|
|
207
|
+
|
|
208
|
+
`@plitzi/sdk-server` used to fetch the manifest of every plugin the space lists on its CDN, even one the deployment
|
|
209
|
+
registers itself, and logged a warning when the CDN was out of reach. It now asks only for the ones it does not have.
|
|
210
|
+
|
|
211
|
+
## Fixed: inline code in Markdown carries nothing of the syntax tree
|
|
212
|
+
|
|
213
|
+
A `markdown` element wrote every inline `` `code` `` as `<code node="[object Object]">`: `react-markdown` hands its
|
|
214
|
+
renderers the syntax-tree node as a prop, and the inline branch spread it onto the tag. Fixed in
|
|
215
|
+
`@plitzi/plitzi-ui` 1.6.26 (with a test), which every package now asks for.
|
|
216
|
+
|
|
217
|
+
## Dev tools hear about the render run the page stopped waiting for
|
|
218
|
+
|
|
219
|
+
When a server element's action ran past the section's budget, the page was answered without it. The run ended a moment
|
|
220
|
+
later, after the page's runs had been sent, so the dev tools never showed the one run that needed debugging. It is now
|
|
221
|
+
told the moment the page stops waiting, as `aborted`, with the reason.
|
|
222
|
+
|
|
223
|
+
## Fixed: a tab you come back to no longer loses its session
|
|
224
|
+
- **What happened:** a page left in another tab past its access token's life signed its visitor out on return. A
|
|
225
|
+
reload put them right back in.
|
|
226
|
+
- **Why:** the browser drops the cookie carrying the access token the moment the token expires, and the background
|
|
227
|
+
tab's renewal timer had not run. The first check on return was told `missing`, which the client took as no
|
|
228
|
+
session at all.
|
|
229
|
+
- **Now:** a `missing` refusal is renewed instead whenever the browser can still renew, meaning it holds a refresh
|
|
230
|
+
token or a session hint whose renewal window is open. The session ends only if that renewal fails.
|
|
231
|
+
- **Requests made in that moment:** `reportAuthFailure` now answers whether it renewed the session. A read refused
|
|
232
|
+
as the tab came back is asked again, once, once the session is renewed. This covers an api container's read and a
|
|
233
|
+
server section's refresh, so they no longer show a 401 that only a reload cleared.
|
|
234
|
+
|
|
235
|
+
- Updated dependencies [3ae61a4]
|
|
236
|
+
- @plitzi/sdk-shared@0.37.9
|
|
237
|
+
|
|
3
238
|
## 0.37.8
|
|
4
239
|
|
|
5
240
|
### Patch Changes
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/EventBridgeHelper.ts
|
|
2
2
|
var e = {
|
|
3
|
-
main: /* @__PURE__ */ "schemaAddPage.schemaHomePage.schemaUpdatePage.schemaRemovePage.schemaAddPageFolder.schemaUpdatePageFolder.schemaRemovePageFolder.schemaUpdateSettings.schemaUpdate.schemaAddElement.schemaUpdateElement.schemaRenameElement.schemaUpdateElements.schemaRemoveElement.schemaMoveElement.schemaCloneElement.schemaAddVariable.schemaUpdateVariable.schemaRemoveVariable.schemaAddTemplate.styleUpdate.styleAddSelector.styleUpdateSelector.styleRemoveSelector.styleRemoveSelectors.styleAddSelectorVariable.styleUpdateSelectorVariable.styleRemoveSelectorVariable.styleAddVariable.styleUpdateVariable.styleRemoveVariable.styleAddTemplate.styleUpdateSettings".split("."),
|
|
3
|
+
main: /* @__PURE__ */ "schemaAddPage.schemaHomePage.schemaUpdatePage.schemaRemovePage.schemaAddPageFolder.schemaUpdatePageFolder.schemaRemovePageFolder.schemaUpdateSettings.schemaUpdate.schemaAddElement.schemaUpdateElement.schemaRenameElement.schemaUpdateElements.schemaRemoveElement.schemaMoveElement.schemaCloneElement.schemaAddVariable.schemaUpdateVariable.schemaRemoveVariable.schemaAddTemplate.schemaAddComponent.schemaUpdateComponent.schemaRemoveComponent.schemaDetachInstance.styleUpdate.styleAddSelector.styleUpdateSelector.styleRemoveSelector.styleRemoveSelectors.styleAddSelectorVariable.styleUpdateSelectorVariable.styleRemoveSelectorVariable.styleAddVariable.styleUpdateVariable.styleRemoveVariable.styleAddTemplate.styleUpdateSettings".split("."),
|
|
4
4
|
builder: [
|
|
5
5
|
"builderSetBaseContext",
|
|
6
6
|
"builderSetSelected",
|
|
7
7
|
"builderSetHovered"
|
|
8
8
|
],
|
|
9
|
-
segment: [],
|
|
10
9
|
template: [],
|
|
11
10
|
interaction: [],
|
|
12
11
|
element: []
|
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.9",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"type": "module",
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@plitzi/sdk-shared": "0.37.
|
|
49
|
+
"@plitzi/sdk-shared": "0.37.9",
|
|
50
50
|
"prop-types": "^15.8.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|