@plitzi/plitzi-builder 0.38.19 → 0.38.21

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 (64) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/dist/index.html +1 -1
  3. package/dist/modules/App/AppContainer/containers/ContainerSettings.d.ts +1 -1
  4. package/dist/modules/Channels/Channels.d.ts +10 -0
  5. package/dist/modules/Channels/components/ChannelCard/ChannelCard.d.ts +11 -0
  6. package/dist/modules/Channels/components/ChannelCard/index.d.ts +2 -0
  7. package/dist/modules/Channels/helpers.d.ts +33 -0
  8. package/dist/modules/Channels/index.d.ts +1 -0
  9. package/dist/modules/Functions/Functions.d.ts +1 -1
  10. package/dist/modules/Functions/components/FunctionsSidebar/FunctionsSidebar.d.ts +9 -4
  11. package/dist/modules/Functions/components/FunctionsSidebar/components/JobItem/JobItem.d.ts +12 -0
  12. package/dist/modules/Functions/components/FunctionsSidebar/components/JobItem/index.d.ts +3 -0
  13. package/dist/modules/Functions/components/FunctionsSidebar/components/NewTask/NewTask.d.ts +1 -1
  14. package/dist/modules/Functions/components/JobInspector/JobInspector.d.ts +10 -0
  15. package/dist/modules/Functions/components/JobInspector/components/JobRun/JobRun.d.ts +12 -0
  16. package/dist/modules/Functions/components/JobInspector/components/JobRun/index.d.ts +3 -0
  17. package/dist/modules/Functions/components/JobInspector/index.d.ts +3 -0
  18. package/dist/modules/Functions/editor/source.d.ts +8 -1
  19. package/dist/modules/Functions/helpers.d.ts +29 -6
  20. package/dist/modules/Functions/useJobs.d.ts +13 -0
  21. package/dist/modules/Space/helpers/hasServerRendering.d.ts +17 -0
  22. package/dist/package.json.d.ts +2 -2
  23. package/dist/plitzi-builder.css +1 -1
  24. package/dist/plitzi-builder.css.gz +0 -0
  25. package/dist/plitzi-builder.js +1629 -1599
  26. package/dist/plitzi-builder.js.gz +0 -0
  27. package/dist/plitzi-functions-worker.js +3 -3
  28. package/package.json +16 -16
  29. package/dist/modules/App/components/AppHeader/RuntimeIdleNotice/timeLeftOf.test.d.ts +0 -1
  30. package/dist/modules/App/components/SitemapDiagram/helpers/schemaToSitemap.test.d.ts +0 -1
  31. package/dist/modules/App/components/VersionContents/helpers.test.d.ts +0 -1
  32. package/dist/modules/Builder/components/BuilderArea/canvasMotionCss.test.d.ts +0 -1
  33. package/dist/modules/Builder/components/BuilderArea/liveCanvas.test.d.ts +0 -1
  34. package/dist/modules/Builder/components/BuilderOverlay/BuilderOverlayHelper.test.d.ts +0 -1
  35. package/dist/modules/Builder/helpers/canvasIcons.test.d.ts +0 -1
  36. package/dist/modules/Builder/helpers/elementChain.test.d.ts +0 -1
  37. package/dist/modules/Builder/helpers/searchElements.test.d.ts +0 -1
  38. package/dist/modules/Collaboration/CollaborationHelper.test.d.ts +0 -1
  39. package/dist/modules/Components/helpers.test.d.ts +0 -1
  40. package/dist/modules/DataSource/helpers/getBindingWarnings.test.d.ts +0 -1
  41. package/dist/modules/Export/helpers/exportFiles.test.d.ts +0 -1
  42. package/dist/modules/Export/helpers/repairs.test.d.ts +0 -1
  43. package/dist/modules/Flags/components/FlagForm/ruleGroup.test.d.ts +0 -1
  44. package/dist/modules/Functions/editor/functionsEnvironment.test.d.ts +0 -1
  45. package/dist/modules/Functions/editor/source.test.d.ts +0 -1
  46. package/dist/modules/History/helpers.test.d.ts +0 -1
  47. package/dist/modules/Interactions/components/Workflow/helpers/elementOptions.test.d.ts +0 -1
  48. package/dist/modules/Interactions/components/Workflow/helpers/nodeOptions.test.d.ts +0 -1
  49. package/dist/modules/Interactions/components/Workflow/helpers/nodeWarnings.test.d.ts +0 -1
  50. package/dist/modules/Interactions/components/Workflow/helpers/whileRunning.test.d.ts +0 -1
  51. package/dist/modules/Queue/hooks/useQueueManager.test.d.ts +0 -1
  52. package/dist/modules/Resources/components/Resource/subTypes/ResourceServerCode/serverCodeKindOf.test.d.ts +0 -1
  53. package/dist/modules/Resources/components/ResourceManager/helpers/isSnippetFile.test.d.ts +0 -1
  54. package/dist/modules/Resources/components/ResourcesList/ListHelper.test.d.ts +0 -1
  55. package/dist/modules/Resources/helpers.test.d.ts +0 -1
  56. package/dist/modules/Runtime/helpers/idleDurationOf.test.d.ts +0 -1
  57. package/dist/modules/Schema/helpers/templateProblem.test.d.ts +0 -1
  58. package/dist/modules/Space/helpers/spaceIssues.test.d.ts +0 -1
  59. package/dist/modules/Space/hooks/useSpaceQuota.test.d.ts +0 -1
  60. package/dist/modules/Usages/helpers/grouping.test.d.ts +0 -1
  61. package/dist/modules/Usages/helpers/unusedParity.test.d.ts +0 -1
  62. package/dist/modules/Usages/helpers/usageIndex.test.d.ts +0 -1
  63. /package/dist/modules/Functions/components/{FunctionInspector/components/InspectorSection → InspectorSection}/InspectorSection.d.ts +0 -0
  64. /package/dist/modules/Functions/components/{FunctionInspector/components/InspectorSection → InspectorSection}/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,205 @@
1
1
  # @plitzi/plitzi-builder
2
2
 
3
+ ## 0.38.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 19fbc45: ## Server
8
+
9
+ - **Jobs: work longer than a request** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-elements`,
10
+ `@plitzi/plitzi-sdk`, `@plitzi/sdk-authoring`) — PZ-136. A space's code declares them in
11
+ `defineFunctions({ jobs: { train: { watch, maxSeconds, run(input, job, ctx) } } })` and starts them with
12
+ `ctx.jobs.start(name, input, { key })` (`get`, `pause`, `resume`, `cancel` beside it). They run in the actions' durable
13
+ queue — leased, taken over when a server dies, retried with backoff — slice by slice, in the sandbox, in a space's
14
+ runtime and natively alike: `job.save(state)` is the one checkpoint and the next slice starts with `job.state`;
15
+ `job.report(fraction, step)` says how far it is; on `job.signal` (`job.stopping`: `pause`, `cancel`, `limit`,
16
+ `shutdown`) the code has 5 s to save and return. A sandbox slice runs at most `sliceMs` and goes on in the next if it
17
+ saved since it began — one that saved nothing fails, so a job cannot loop forever; a runtime's runs until the job's
18
+ time is up. A real pause: `paused` keeps what it saved until resumed. Who may watch it is RBAC: whoever started it, and
19
+ whoever its `watch` (a channel's access) lets in, on `$job:<id>` — the platform's topic, retained — read with
20
+ `useJob(id)` or a `channel` element on `$job:{{ id }}`; the view never carries its input, its state, or an error other
21
+ than the code's own refusal. Limits per space (its plan) through `functions.jobs.limitsFor` —
22
+ `DEFAULT_FUNCTION_JOB_LIMITS` otherwise: 10 running across the account's spaces (`pool`, the oldest first), 1,000
23
+ waiting, 6 h, slices of 5 min / 30 s CPU / 10,000 calls, 1 MB of state.
24
+ - **The queue's types are the queue's** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): `ActionJobQueue`, `ActionJob`,
25
+ `ActionJobInput`, `ActionJobStatus`, `ActionJobAttempt`, `ActionJobSettlement`, `ActionJobQuery` are `JobQueue`, `Job`,
26
+ `JobInput`, `JobStatus`, `JobAttempt`, `JobSettlement`, `JobQuery` (`ACTION_JOB_STATUSES` → `JOB_STATUSES`,
27
+ `isJobStatus`, `TERMINAL_JOB_STATUSES`) — the queue holds a schedule's fires, the runs set for later and the jobs of
28
+ the spaces' functions. **What a job runs is its `target`**: `{ kind: 'action', name, trigger }` or
29
+ `{ kind: 'function', name, user, watch, at }`, in place of `actionId`, `trigger` and `function`; `listJobs` filters
30
+ by `kind` and `name`. Also on the queue: `paused` with `pause`/`resume`, `write` for what a running job saves and
31
+ reports, `state`/`progress`/`result`/`activeMs`, `heartbeat` answering `{ jobId, stop: 'cancel' | 'pause' }[]`, a
32
+ settlement's explicit `refund`, `requeue(…, { input, fresh })`. The helpers bring a store a release before left up
33
+ to it by themselves: MySQL's `ensureJobTables` gives each job its target from `action_id`/`trigger_type` and drops
34
+ them (`mysqlJobSchemaUpgrades` lists the statements for a deployment's own migrations); Mongo's queue does the same
35
+ to the documents on first use and drops the `spaceId_1_actionId_1_updatedAt_-1` index. A deployment with a queue of
36
+ its own: the contract tests (`describeJobQueue`) say what it must now do.
37
+ - **A runtime's routes stream** (`@plitzi/sdk-server`): a route under `/fn/` answered by a space's runtime is passed on
38
+ as it is written — its head at once, its body as the code writes it, with the platform's `ctx` — over the functions
39
+ protocol's new `head`/`chunk` messages, with no time limit once it answered; the deployment's own routes stream too.
40
+ A runtime's `endpoints` are for addresses outside `/fn/` (an MCP server at `/mcp`); anything that can live under
41
+ `/fn/` is a route. A sandbox's routes are answered whole, as before.
42
+ - **`createJobControl({ queue, realtime: { pubsub, kv } })`** (`@plitzi/sdk-server/actions`): an operator's
43
+ `pause`/`resume`/`cancel`/`requeue` from a process that serves no pages — a Queue panel's API — each said on
44
+ `$job:<id>` through the page server's own pub/sub and retained store, so a watcher hears what an operator did.
45
+ - **A run's user carries no session** (`RunUser`): what a step, a function and a job see of who asked.
46
+ - **The builder shows the jobs** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`): **Server → Functions** lists the
47
+ jobs the code declares as it is typed (how long each may run; one spread in or built by a call is counted, not
48
+ guessed), and the inspector of one says how it is started and who may watch it, with the space's runs of it — live
49
+ while one moves, progress and step as its code reported them — and **Pause**, **Resume**, **Cancel** and **Run
50
+ again**. Through two new builder operations, `SpaceJobs(kind, name, status, page, pageSize)` — a `SpaceJob` each:
51
+ what it runs, where it is and how far, never its input, state or result — and `SpaceControlJob(jobId, control)`
52
+ (`JobControlAction`). Beside them in `@plitzi/sdk-shared/actions`: `JOB_KINDS`/`isJobKind`, and `actionAccessOf`, the
53
+ one reading of a channel's access, which the functions' manifest now reads a job's `watch` with too.
54
+
55
+ - **`ctx.oauth.token` for an SDK in the page** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): Spotify's Web Playback,
56
+ Google's Picker and their kind ask the page for the access token themselves, and `ctx.oauth` kept every token on the
57
+ server. A connection that declares `exposeToken: true` now answers `ctx.oauth.token(name, { owner })` —
58
+ `{ token, type, expiresAt, scopes }`, renewed first when about to lapse — for a route of the code to hand to the
59
+ connection's owner. The refresh token never leaves; a connection without `exposeToken` refuses `token`, naming the
60
+ field. Through the sandbox's protocol and natively alike.
61
+
62
+ - **A page for some permissions, kept by the server** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`,
63
+ `@plitzi/sdk-authoring`, `@plitzi/sdk-elements`, `@plitzi/plitzi-builder`): a page says
64
+ `access: { permissions: [...] }`, and a visitor without every one is answered 401 (or the page's sign-in redirect) or
65
+ 403 with a refusal drawn in the page's layout. Its content is withheld from everything that visitor is sent — the
66
+ render, the hydration payload, the space document (and a document built for somebody with access is not handed to
67
+ somebody without it by its name) and the page's server data. The builder's page settings take the permissions;
68
+ authoring refuses an `access` the server could not keep (`page-access`). A space read back as code — `plitzi create
69
+ --from`, the Export — keeps each page's `access`, so a protected page is never exported open. A page's handle carries
70
+ its `access` too, and a project's `visual/home.spec.ts` leaves such a page to a test that signs in, as it does a page
71
+ behind a session (`plitzi upgrade` rewrites an untouched one).
72
+ - **A project's first plugin is picked up while it runs** (`@plitzi/sdk-server`): `start:dev` registers a plugin folder
73
+ added under `src/plugins/` and reloads the open pages — but only watched that folder when it existed at boot, so a
74
+ project with no plugin yet (one taken out of a space that had none) showed nothing of its first `plitzi plugin add`
75
+ until a restart. With no folder, the server waits for it to appear and takes what it holds then.
76
+
77
+ ## Packaging
78
+ - **No package ships the declarations of its tests** (`@plitzi/sdk-server`, `@plitzi/sdk-mcp`, `@plitzi/plitzi-sdk`,
79
+ `@plitzi/plitzi-builder`, `@plitzi/sdk-elements`, `@plitzi/sdk-shared`): each app wrote its declarations with its own
80
+ `dts({ exclude })`, and the ones that left the tests out of it shipped a `.test.d.ts` beside their modules — 148 in
81
+ sdk-server alone — and the base config let a `.bench.d.ts` through. Every `dts()` now excludes
82
+ `'**/*.(test|bench).(ts|tsx)'`, and `yarn check:dist-exports` (CI, after `build:prod`) fails a build of any published
83
+ package that holds one.
84
+ - **`@plitzi/plitzi-builder` depends on `graphql` ^16** (was ^17): Apollo Server — the builder's API — supports only
85
+ 16, so a host installing the builder beside it got two copies. The builder uses nothing of 17's.
86
+
87
+ ## Elements
88
+ - **A dropdown closes when a link in it is chosen** (`@plitzi/sdk-elements`): a link stops its click from bubbling,
89
+ and the popup listened for clicks on the way up — so no menu of links ever closed, and a click that did reach it was
90
+ cancelled, which would have kept an external link from going anywhere. The popup now hears the click as it goes down
91
+ and lets it through.
92
+
93
+ ## CLI
94
+ - **A refused push says why** (`@plitzi/cli`): `space push functions` and the data push read any 409 as "changed since
95
+ your pull" — and the platform also answers 409 when the space has no private bucket to keep its code or data in, so
96
+ a first push to a space with no storage sent its author to pull, which changed nothing. The CLI now names a conflict
97
+ only when the refusal says `version`, and prints the platform's own words otherwise (where to add the bucket).
98
+ - **`create` points at the Academy** (`@plitzi/cli`): its last lines name the docs' Academy,
99
+ `https://docs.plitzi.com/academy`, for whoever is new to Plitzi — and the README the docs themselves.
100
+
101
+ ## Builder
102
+ - **A space served by Plitzi has a server, and the builder says so** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`):
103
+ whether a space can run its actions and resolve its connectors was read off an SSR _credential_, which only a space
104
+ deployed to a page server of its own has — so every space served at `<space>.plitzi.app` showed "No server-rendered
105
+ deployment" over Server and counted its actions unavailable, while they ran. The deployments now carry what serves
106
+ them (`provider`), and a deployment served by SSR — Plitzi's or the space's — counts.
107
+ - **New Layout saves the layout** (`@plitzi/sdk-schema`): a layout is a root of the pages' tree, added with no anchor,
108
+ and `flatMapOf` found no tree for an empty anchor — so the server refused every new layout, saying it was "already
109
+ added". A root now goes into the pages' tree, and the refusal says which of the two it is.
110
+ - **Settings → Realtime: a space's channels, declared by hand** (`@plitzi/plitzi-builder`): `settings.channels` was
111
+ written only in code or by an agent over MCP, so a space made in the builder could not open a channel. The section
112
+ lists the channels with who may join (anyone, signed-in visitors, visitors with permissions), who may speak (pages, or
113
+ only the server's `Publish On Channel`), presence, a grant, keeping the last message and the two limits — saved only
114
+ when `channelProblems` passes, with what is wrong said under the channel otherwise.
115
+
116
+ - Updated dependencies [19fbc45]
117
+ - @plitzi/plitzi-sdk@0.38.21
118
+ - @plitzi/sdk-auth@0.38.21
119
+ - @plitzi/sdk-authoring@0.38.21
120
+ - @plitzi/sdk-dev-tools@0.38.21
121
+ - @plitzi/sdk-elements@0.38.21
122
+ - @plitzi/sdk-event-bridge@0.38.21
123
+ - @plitzi/sdk-interactions@0.38.21
124
+ - @plitzi/sdk-navigation@0.38.21
125
+ - @plitzi/sdk-plugins@0.38.21
126
+ - @plitzi/sdk-schema@0.38.21
127
+ - @plitzi/sdk-shared@0.38.21
128
+ - @plitzi/sdk-style@0.38.21
129
+ - @plitzi/sdk-variables@0.38.21
130
+
131
+ ## 0.38.20
132
+
133
+ ### Patch Changes
134
+
135
+ - c7c241a: ## Security
136
+
137
+ - **The `Origin` fallback reads the request's own authority before a forwarded one** (`@plitzi/sdk-server`): 0.38.19
138
+ took `X-Forwarded-Host` first, and with no proxy in front a client could send one naming this host on another port,
139
+ making that port's `Origin` this server's own. Now `:authority` or `Host` decide whenever they name the host the
140
+ request is answered as; `X-Forwarded-Host` only when they do not — a host that took its hostname from the header
141
+ (Express's `trust proxy`) trusts the proxy that wrote it. No option to set: what the host resolved says which one it
142
+ believes. The write guard (`crossSiteWrites`), the sign-in's login-CSRF check and `createOriginGuardMiddleware`
143
+ share it.
144
+
145
+ ## Server
146
+ - **`ctx.oauth`: OAuth 2.0 for a space's code, any provider** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): a
147
+ connection is data in `defineFunctions({ oauth: { calendar: { issuer | authorizeUrl + tokenUrl, credential, scopes,
148
+ authorizeParams, clientAuth } } })` — an OpenID provider by its `issuer` (endpoints discovered), any other by its
149
+ endpoints; none is known to the platform by name. `ctx.oauth.connect(name, { returnTo, owner? })` answers the
150
+ consent URL (authorization code with PKCE); the platform answers `/fn/oauth/callback` — the one address to register
151
+ with every provider — exchanges the code with the app's id and secret from the named credential, and sends the
152
+ visitor back to `returnTo` with `?oauth=<name>&oauth_result=connected` (or `&oauth_error=`). `ctx.oauth.fetch(name,
153
+ url)` writes the token in, renewed before it lapses and once more on a 401, only to `allow.hosts`; `status` and
154
+ `disconnect` (revoked where the provider says). A token is a signed-in visitor's own by default, `{ owner: 'space' }`
155
+ the space's, or a key of the code's own; it is kept in the space's `kv` sealed with a key of the space's that no
156
+ `ctx.sign` reaches, so the code never holds one. In the sandbox, natively and in a space's runtime alike; a plugin's
157
+ functions declare and reach none. Needs `signingSecret`. Runs also carry the `origin` of the request that started
158
+ them (`ctx.origin` of a task context), what the callback address is made of.
159
+
160
+ ## Packages
161
+ - **No path a package does not export is written anywhere in the packages** (`@plitzi/plitzi-sdk`,
162
+ `@plitzi/sdk-shared`): two JSDoc comments sent readers to `@plitzi/sdk-authoring/testing`, which is not an entry —
163
+ `inspectRenders` is exported by `@plitzi/sdk-authoring`. `yarn check:specifiers` (in CI after the build) reads every
164
+ `@plitzi/<package>/<path>` the workspace writes — the code, its built declarations, JSDoc, skills and docs — against
165
+ what that package exports, so an import somebody would copy into a project and get `ERR_MODULE_NOT_FOUND` from cannot
166
+ be published again.
167
+
168
+ - **The packages that run in Node say which Node** (`@plitzi/sdk-server`, `@plitzi/cli`, `@plitzi/sdk-mcp`,
169
+ `@plitzi/sdk-authoring`): `"engines": { "node": ">=22.18" }`, the floor every project the CLI makes already declares —
170
+ installed on an older Node they now say so, instead of failing on the first API it lacks (`--env-file-if-exists`,
171
+ `--permission`, `Set#union`). The browser's packages declare none: a bundler reads them.
172
+
173
+ - **A short render guide, and each part of it alone** (`@plitzi/sdk-mcp`): `renderGuideText` stays the whole guide
174
+ (~30k characters); `renderGuideCore` is a third of it for an agent that counts its tokens — a voice assistant, a small
175
+ model — with the model of a render, the element types, the host's theme and what to do on a refusal, and the address
176
+ of every other section; `renderGuideTopics[topic]` and `renderGuideTopicUri(topic)` (`plitzi://render/guide/repeat`,
177
+ `…/data`…) serve each one, cut from the one text. The MCP server answers them as resources and through `plitzi_read`.
178
+
179
+ ## CLI
180
+ - **What Plitzi decided reaches the agent writing a report** (`@plitzi/cli`): `plitzi feedback`'s brief lists what was
181
+ reported and kept as it is — with why, and what to do instead — so a report files it under `changed` as `decided`
182
+ rather than carrying it as open, and the page has that status.
183
+
184
+ - **The CLI skill says what `ERR_MODULE_NOT_FOUND` into a `@plitzi` package's `dist` is** (`@plitzi/cli`): an import of
185
+ a path the package does not export — a file rather than its folder — with `plitzi doctor` to name each one and
186
+ `plitzi upgrade migrations --write` to rewrite it.
187
+
188
+ - Updated dependencies [c7c241a]
189
+ - @plitzi/plitzi-sdk@0.38.20
190
+ - @plitzi/sdk-auth@0.38.20
191
+ - @plitzi/sdk-authoring@0.38.20
192
+ - @plitzi/sdk-dev-tools@0.38.20
193
+ - @plitzi/sdk-elements@0.38.20
194
+ - @plitzi/sdk-event-bridge@0.38.20
195
+ - @plitzi/sdk-interactions@0.38.20
196
+ - @plitzi/sdk-navigation@0.38.20
197
+ - @plitzi/sdk-plugins@0.38.20
198
+ - @plitzi/sdk-schema@0.38.20
199
+ - @plitzi/sdk-shared@0.38.20
200
+ - @plitzi/sdk-style@0.38.20
201
+ - @plitzi/sdk-variables@0.38.20
202
+
3
203
  ## 0.38.19
4
204
 
5
205
  ### Patch Changes
package/dist/index.html CHANGED
@@ -53,7 +53,7 @@
53
53
  webKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwib3JpZ2lucyI6WyJodHRwczovL3dlYnNpdGUucGxpdHppLmFwcCIsImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImh0dHA6Ly8xMjcuMC4wLjE6ODA4MCIsImh0dHBzOi8vZGV2LnBsaXR6aS5jb20iLCJodHRwczovL3BsaXR6aS5jb20iLCJodHRwczovL3N0Zy5wbGl0emkuY29tIl0sImlzcyI6Imh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImF1ZCI6WyJodHRwczovL3BsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbDozMDAwIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDEiLCJodHRwczovL2FwaS5wbGl0emkubG9jYWwiLCJodHRwczovL3Nzci5wbGl0emkubG9jYWwiLCJodHRwczovL3NlcnZlci5wbGl0emkubG9jYWwiLCJodHRwczovL21jcC5wbGl0emkubG9jYWwiLCJodHRwczovL2F1dGgucGxpdHppLmxvY2FsIiwiaHR0cDovLzEyNy4wLjAuMTo1MzAwIiwiaHR0cDovL2xvY2FsaG9zdDo1MTgwIl0sInNjb3BlIjoic3BhY2U6cmVuZGVyIiwiaWF0IjoxNzkwMjEzMjg5LCJqdGkiOiJhZDgyN2EyMjliZjhlMzk3IiwibmJmIjoxNzkwMjEzMjg5fQ.dedpVVA5Nv3Xr7nEOZ8UmEJcIamF9AHGnLgqQyDV8-k',
54
54
  // The actor. Without it the builder loads and every write is refused, since authorization is
55
55
  // can(actor, space, permission). Both halves come from `yarn token 1 --user admin` in plitzi-sdk-server.
56
- userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzkyMjc4MTE2LCJpYXQiOjE3OTIxOTE3MTYsImp0aSI6ImViZTJhZGZmOWNlMmEyMjQiLCJuYmYiOjE3OTIxOTE3MTZ9.LGVl_ka6p_TFxiWcuIvnnUUMueSH472eE2UkrMhylyY',
56
+ userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzkyNDMxMTA1LCJpYXQiOjE3OTIzNDQ3MDUsImp0aSI6IjUwNjFmMmM3NDlhZTJlZTIiLCJuYmYiOjE3OTIzNDQ3MDV9.k_Ju7vY8JFIIZIQdU_H8CdeQ9kAp_Pb4yGhlNI2Ld_U',
57
57
  environment: 'main',
58
58
  functionsWorkerUrl: '/plitzi-functions-worker.js',
59
59
  sdkIconsStylePath: '',
@@ -1,3 +1,3 @@
1
- /** The space's settings, and who may visit it: the roles it declares and who holds them. */
1
+ /** The space's settings, who may visit it — the roles it declares and who holds them — and its realtime channels. */
2
2
  declare const ContainerSettings: () => import('react').JSX.Element;
3
3
  export default ContainerSettings;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The space's realtime channels (`settings.channels`): the patterns its pages may open a channel on, who may join and
3
+ * speak on each, and what the server keeps of it.
4
+ *
5
+ * Saved as they are edited, and only when every channel is one the server accepts — `channelProblems`, the check
6
+ * authoring and the server make — so the document never holds a channel that would be refused: what is wrong is said
7
+ * under the channel until it is fixed.
8
+ */
9
+ declare const Channels: () => import('react').JSX.Element;
10
+ export default Channels;
@@ -0,0 +1,11 @@
1
+ import { ChannelDraft } from '../../helpers';
2
+ export type ChannelCardProps = {
3
+ pattern: string;
4
+ draft: ChannelDraft;
5
+ problems?: string[];
6
+ onChange: (pattern: string, draft: ChannelDraft) => void;
7
+ onRemove: (pattern: string) => void;
8
+ };
9
+ /** One channel of the space: who may join it, who may speak on it, and what the server keeps of it. */
10
+ declare const ChannelCard: ({ pattern, draft, problems, onChange, onRemove }: ChannelCardProps) => import('react').JSX.Element;
11
+ export default ChannelCard;
@@ -0,0 +1,2 @@
1
+ export { default } from './ChannelCard';
2
+ export type { ChannelCardProps } from './ChannelCard';
@@ -0,0 +1,33 @@
1
+ import { ChannelDeclaration, ChannelDeclarations } from '@plitzi/sdk-shared';
2
+ export type ChannelAccessMode = ChannelDeclaration['access']['mode'];
3
+ /**
4
+ * One channel as its fields hold it while it is edited: the permissions and the limits as the text typed, so a comma or
5
+ * a digit being typed is never normalised away under the cursor.
6
+ */
7
+ export type ChannelDraft = {
8
+ mode: ChannelAccessMode;
9
+ permissions: string;
10
+ publish: 'clients' | 'server';
11
+ presence: boolean;
12
+ grant: boolean;
13
+ retain: boolean;
14
+ maxMessageBytes: string;
15
+ messagesPerSecond: string;
16
+ };
17
+ /** What a channel added in the builder starts as: anybody joins, and pages speak directly. */
18
+ export declare const NEW_CHANNEL: ChannelDraft;
19
+ export declare const draftOf: (declaration: ChannelDeclaration) => ChannelDraft;
20
+ /** The channel a draft declares: only what differs from the defaults is written, as authoring writes it. */
21
+ export declare const declarationOf: (draft: ChannelDraft) => ChannelDeclaration;
22
+ export type CheckedChannels = {
23
+ ok: true;
24
+ channels: ChannelDeclarations;
25
+ } | {
26
+ ok: false;
27
+ problems: Record<string, string[]>;
28
+ };
29
+ /**
30
+ * The space's channels as the drafts declare them — or, when one would be refused, every problem of every channel, by
31
+ * its pattern: the server's and authoring's own check (`channelProblems`), so the builder never saves one they refuse.
32
+ */
33
+ export declare const checkChannels: (drafts: Record<string, ChannelDraft>) => CheckedChannels;
@@ -0,0 +1 @@
1
+ export { default } from './Channels';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The space's own server code: its tasks and routes as the code declares them — listed as it is typed — its files,
2
+ * The space's own server code: its tasks, routes and jobs as the code declares them — listed as it is typed — its files,
3
3
  * edited with TypeScript that knows the contract, and the selected task's time limit and test run beside them. Saved as
4
4
  * the draft, built and checked on the platform; the live site runs what the space was last published with. A
5
5
  * project's `plitzi functions pull` edits the same files.
@@ -1,5 +1,5 @@
1
1
  import { NewTask as NewTaskSpec } from '../../editor/source';
2
- import { ListedRoute, ListedTask } from '../../helpers';
2
+ import { ListedJob, ListedRoute, ListedTask } from '../../helpers';
3
3
  import { FunctionTimeLimits } from '@plitzi/sdk-shared';
4
4
  export type FunctionsSidebarProps = {
5
5
  tasks: ListedTask[];
@@ -7,10 +7,14 @@ export type FunctionsSidebarProps = {
7
7
  sharedLimits?: FunctionTimeLimits;
8
8
  selectedTask: string;
9
9
  /** Tasks the code builds by calling something: there, but only a save can say what they are. */
10
- unreadable: number;
10
+ unreadableTasks: number;
11
11
  /** Whether a new task can be written for you: the code has been read, and it calls `defineFunctions`. */
12
12
  canCreateTask: boolean;
13
13
  routes: ListedRoute[];
14
+ jobs: ListedJob[];
15
+ selectedJob: string;
16
+ /** Jobs the code builds by calling something, or spreads in: listed once saved. */
17
+ unreadableJobs: number;
14
18
  files: string[];
15
19
  selectedFile: string;
16
20
  /** The files whose text differs from what was last saved. */
@@ -18,13 +22,14 @@ export type FunctionsSidebarProps = {
18
22
  onSelectTask: (task: string) => void;
19
23
  onCreateTask: (task: NewTaskSpec) => void;
20
24
  onSelectRoute: (route: string) => void;
25
+ onSelectJob: (job: string) => void;
21
26
  onSelectFile: (file: string) => void;
22
27
  onAddFile: (file: string) => void;
23
28
  onRemoveFile: (file: string) => void;
24
29
  };
25
30
  /**
26
31
  * What the functions are, as the code declares them right now: the tasks a step can run — a click from the code and
27
- * the inspector — the routes they answer at, and the files they are written in.
32
+ * the inspector — the routes they answer at, the jobs they start, and the files they are written in.
28
33
  */
29
- declare const FunctionsSidebar: ({ tasks, sharedLimits, selectedTask, unreadable, canCreateTask, routes, files, selectedFile, modified, onSelectTask, onCreateTask, onSelectRoute, onSelectFile, onAddFile, onRemoveFile }: FunctionsSidebarProps) => import('react').JSX.Element;
34
+ declare const FunctionsSidebar: ({ tasks, sharedLimits, selectedTask, unreadableTasks, canCreateTask, routes, jobs, selectedJob, unreadableJobs, files, selectedFile, modified, onSelectTask, onCreateTask, onSelectRoute, onSelectJob, onSelectFile, onAddFile, onRemoveFile }: FunctionsSidebarProps) => import('react').JSX.Element;
30
35
  export default FunctionsSidebar;
@@ -0,0 +1,12 @@
1
+ export type JobItemProps = {
2
+ name: string;
3
+ /** How long it may run, every slice together — none when it runs as long as the plan allows. */
4
+ maxSeconds?: number;
5
+ selected: boolean;
6
+ /** Written, but not in the saved draft yet: nothing can start it until it is saved. */
7
+ unsaved: boolean;
8
+ onSelect: (job: string) => void;
9
+ };
10
+ /** One job in the list: its name, how long it may run, and whether a save has it yet. */
11
+ declare const JobItem: ({ name, maxSeconds, selected, unsaved, onSelect }: JobItemProps) => import('react').JSX.Element;
12
+ export default JobItem;
@@ -0,0 +1,3 @@
1
+ import { default as JobItem } from './JobItem';
2
+ export * from './JobItem';
3
+ export default JobItem;
@@ -6,7 +6,7 @@ export type NewTaskProps = {
6
6
  onCancel: () => void;
7
7
  };
8
8
  /**
9
- * A new task, named where the list is: its namespace and action — what a step calls it, `seismic.feed` — and its title.
9
+ * A new task, named where the list is: its namespace and action — what a step calls it, `orders.sync` — and its title.
10
10
  * Written into `defineFunctions` for you, with a `run` to start from.
11
11
  */
12
12
  declare const NewTask: ({ namespace: usual, onCreate, onCancel }: NewTaskProps) => import('react').JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { ListedJob } from '../../helpers';
2
+ export type JobInspectorProps = {
3
+ job: ListedJob;
4
+ };
5
+ /**
6
+ * The selected job: how long it may run and who may watch it, as its code declares, and the space's runs of it — live
7
+ * while one moves, with the Queue's controls on each.
8
+ */
9
+ declare const JobInspector: ({ job }: JobInspectorProps) => import('react').JSX.Element;
10
+ export default JobInspector;
@@ -0,0 +1,12 @@
1
+ import { JobControlAction, SpaceJob } from '@plitzi/sdk-shared';
2
+ export type JobRunProps = {
3
+ job: SpaceJob;
4
+ /** Answers why nothing changed, or nothing when it did. */
5
+ onControl: (jobId: string, action: JobControlAction) => Promise<string | undefined>;
6
+ };
7
+ /**
8
+ * One run of a job: where it is, how far its code says it got, who started it, and the controls it takes now — each
9
+ * answered by the queue, and what changed nothing says why under it.
10
+ */
11
+ declare const JobRun: ({ job, onControl }: JobRunProps) => import('react').JSX.Element;
12
+ export default JobRun;
@@ -0,0 +1,3 @@
1
+ import { default as JobRun } from './JobRun';
2
+ export * from './JobRun';
3
+ export default JobRun;
@@ -0,0 +1,3 @@
1
+ import { default as JobInspector } from './JobInspector';
2
+ export * from './JobInspector';
3
+ export default JobInspector;
@@ -1,4 +1,4 @@
1
- import { FunctionTaskManifest, FunctionTimeLimits } from '@plitzi/sdk-shared';
1
+ import { FunctionJobManifest, FunctionTaskManifest, FunctionTimeLimits } from '@plitzi/sdk-shared';
2
2
  import { VirtualTypeScriptEnvironment } from '@typescript/vfs';
3
3
  /**
4
4
  * The space's functions as their SOURCE declares them, read while they are written — what the panel lists and edits
@@ -22,17 +22,24 @@ export type SourceRoute = {
22
22
  key: string;
23
23
  at: SourcePlace;
24
24
  };
25
+ /** A job as it is written: its name, how long it may run and who may watch it, when those are written as literals. */
26
+ export type SourceJob = FunctionJobManifest & {
27
+ name: string;
28
+ at: SourcePlace;
29
+ };
25
30
  export type SourceFunctions = {
26
31
  /** `index.ts` exports `defineFunctions(…)` — without it there is nothing declared to read. */
27
32
  defined: boolean;
28
33
  tasks: SourceTask[];
29
34
  routes: SourceRoute[];
35
+ jobs: SourceJob[];
30
36
  hosts: string[];
31
37
  /** What every task and route asks for, unless one asks for its own. */
32
38
  limits?: FunctionTimeLimits;
33
39
  /** Entries that are there but cannot be read without running the code: what to look at, and where. */
34
40
  unreadable: {
35
41
  what: string;
42
+ of: 'tasks' | 'jobs';
36
43
  at: SourcePlace;
37
44
  }[];
38
45
  };
@@ -1,6 +1,6 @@
1
- import { SourceFunctions, SourcePlace, SourceRoute } from './editor/source';
1
+ import { SourceFunctions, SourceJob, SourcePlace, SourceRoute } from './editor/source';
2
2
  import { Text } from '@codemirror/state';
3
- import { FunctionsManifest, FunctionsProblem, FunctionTaskManifest, FunctionTimeLimits } from '@plitzi/sdk-shared';
3
+ import { ActionAccess, FunctionsManifest, FunctionsProblem, FunctionTaskManifest, FunctionTimeLimits, JobControlAction, SpaceJob } from '@plitzi/sdk-shared';
4
4
  /** What a space's functions start as: one file and one task already written, to change rather than to learn from blank. */
5
5
  export declare const STARTER_FILES: Record<string, string>;
6
6
  /** Where a problem is, as a person reads it: `lib/feed.ts:12:4`. */
@@ -11,7 +11,7 @@ export declare const readParams: (text: string) => {
11
11
  } | {
12
12
  error: string;
13
13
  };
14
- /** A task's name, as a step addresses it: `seismic.feed`. */
14
+ /** A task's name, as a step addresses it: `orders.sync`. */
15
15
  export declare const taskNameOf: (task: Pick<FunctionTaskManifest, "namespace" | "action">) => string;
16
16
  /** What a Try starts from: each param at the value the task declared for it — what a new step would start from. */
17
17
  export declare const paramDefaults: (task: FunctionTaskManifest | undefined) => Record<string, unknown>;
@@ -49,7 +49,7 @@ export type ListedTask = FunctionTaskManifest & {
49
49
  export declare const listedTasks: (source: SourceFunctions | undefined, manifest: FunctionsManifest | null) => ListedTask[];
50
50
  /** A time as the panel says it: milliseconds under a second, seconds from one. */
51
51
  export declare const timeLabel: (ms: number) => string;
52
- /** What a new task is called as a step: lowercase words joined by dashes — `seismic`, `feed-week`. */
52
+ /** What a new task is called as a step: lowercase words joined by dashes — `orders`, `sync-week`. */
53
53
  export declare const isTaskWord: (value: string) => boolean;
54
54
  /** A step's title from its action, until somebody writes one: `feed-week` reads `Feed week`. */
55
55
  export declare const titleFromAction: (action: string) => string;
@@ -90,5 +90,28 @@ export declare const lineRange: (doc: Text, line: number) => {
90
90
  export declare const withCpu: (limits: FunctionTimeLimits | undefined, cpuMs: number | undefined) => FunctionTimeLimits;
91
91
  /** Why the panel cannot write a task's limits for you right now, or nothing when it can. */
92
92
  export declare const limitsBlockedBy: (ready: boolean, task: ListedTask) => string;
93
- /** The task written around an offset of a file — the one the cursor is in — or none. */
94
- export declare const taskAt: (tasks: readonly ListedTask[], file: string, offset: number) => ListedTask | undefined;
93
+ /** The task or job written around an offset of a file — the one the cursor is in — or none. */
94
+ export declare const writtenAt: <T extends {
95
+ at?: SourcePlace;
96
+ }>(entries: readonly T[], file: string, offset: number) => T | undefined;
97
+ /** A job as the panel lists it: what the source declares right now, where, and whether a save has it yet. */
98
+ export type ListedJob = Omit<SourceJob, 'at'> & {
99
+ at?: SourcePlace;
100
+ /** In the saved draft too: what the code can start. One only written so far is started once it is saved. */
101
+ saved: boolean;
102
+ };
103
+ /** The jobs to list: the source's as written — so the list follows the code — or, until it has been read, the last save's. */
104
+ export declare const listedJobs: (source: SourceFunctions | undefined, manifest: FunctionsManifest | null) => ListedJob[];
105
+ /** How many entries of the source cannot be listed without running it, in one of the sidebar's sections. */
106
+ export declare const unreadableIn: (source: SourceFunctions | undefined, of: "tasks" | "jobs") => number;
107
+ /** A length of time as the panel says it: `45 s`, `20 min`, `1 h 30 min`. */
108
+ export declare const durationLabel: (seconds: number) => string;
109
+ /** Who may watch a job besides whoever started it, as a sentence. */
110
+ export declare const watchLabel: (watch: ActionAccess | undefined) => string;
111
+ /**
112
+ * What can be done to a job as it is now — the Queue's own rules: set aside a job of the functions waiting or running,
113
+ * put back one set aside, stop one not finished, run a finished one again.
114
+ */
115
+ export declare const jobControlsOf: (job: SpaceJob) => JobControlAction[];
116
+ /** Whether a job may still move by itself: what the panel keeps reading while it shows one. */
117
+ export declare const isJobMoving: (job: SpaceJob) => boolean;
@@ -0,0 +1,13 @@
1
+ import { JobControlAction, SpaceJob } from '@plitzi/sdk-shared';
2
+ /**
3
+ * The space's runs of one of its functions' jobs, newest first — read again every few seconds while one may still move —
4
+ * and the Queue's controls over each, through the same operations the dashboard's Queue reaches over REST.
5
+ */
6
+ declare const useJobs: (name: string) => {
7
+ jobs: SpaceJob[];
8
+ total: number;
9
+ error: string;
10
+ isLoading: boolean;
11
+ control: (jobId: string, action: JobControlAction) => Promise<string | undefined>;
12
+ };
13
+ export default useJobs;
@@ -0,0 +1,17 @@
1
+ import { SpaceDeployment } from '@plitzi/sdk-shared';
2
+ /**
3
+ * Whether the space has a page server to run its actions and resolve its connectors: a deployment served by SSR — the
4
+ * platform's own (`provider: 'ssr'`, no credential: every `<space>.plitzi.app`) or the space's (an SSR credential).
5
+ *
6
+ * Unknown counts as yes: the deployments arrive a moment after the panels do, and a space that is correctly set up should
7
+ * not flash a warning telling its owner it is broken. A late warning beats a wrong one.
8
+ */
9
+ /** What it reads of a deployment: what serves it, and the provider of its credential when it has one. */
10
+ type Served = {
11
+ provider: SpaceDeployment['provider'];
12
+ credential: {
13
+ provider: string;
14
+ } | null;
15
+ };
16
+ declare const hasServerRendering: (deployments: readonly Served[] | undefined) => boolean;
17
+ export default hasServerRendering;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@plitzi/plitzi-builder",
3
- "version": "0.38.19",
3
+ "version": "0.38.21",
4
4
  "homepage": "./",
5
5
  "license": "AGPL-3.0",
6
6
  "files": [
@@ -52,7 +52,7 @@ declare const _default: {
52
52
  "apollo-upload-client": "^20.0.0",
53
53
  "clsx": "^2.1.1",
54
54
  "comlink": "^4.4.2",
55
- "graphql": "^17.0.2",
55
+ "graphql": "^16.14.2",
56
56
  "graphql-ws": "^6.4.1",
57
57
  "immer": "^11.1.21",
58
58
  "jszip": "^3.10.2",