@plitzi/sdk-shared 0.37.1 → 0.37.3

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 (195) hide show
  1. package/CHANGELOG.md +1288 -0
  2. package/dist/actions/access.d.ts +12 -0
  3. package/dist/actions/access.mjs +13 -0
  4. package/dist/actions/cron.d.ts +21 -12
  5. package/dist/actions/cron.mjs +48 -17
  6. package/dist/actions/functions.d.ts +27 -0
  7. package/dist/actions/functions.mjs +18 -0
  8. package/dist/actions/index.d.ts +5 -1
  9. package/dist/actions/index.mjs +9 -7
  10. package/dist/actions/triggers.d.ts +4 -0
  11. package/dist/actions/triggers.mjs +4 -1
  12. package/dist/auth/index.d.ts +2 -0
  13. package/dist/auth/index.mjs +2 -1
  14. package/dist/auth/visitorRoles.d.ts +27 -0
  15. package/dist/auth/visitorRoles.mjs +48 -0
  16. package/dist/authoring/builder.mjs +1 -0
  17. package/dist/authoring/declare.d.ts +74 -0
  18. package/dist/authoring/declare.mjs +2 -2
  19. package/dist/authoring/index.mjs +5 -5
  20. package/dist/authoring/paramSpec.d.ts +1 -1
  21. package/dist/authoring/paramSpec.mjs +1 -0
  22. package/dist/authoring/spaceCallbacks.mjs +2 -2
  23. package/dist/dataSource/computed.d.ts +21 -0
  24. package/dist/dataSource/computed.mjs +45 -0
  25. package/dist/dataSource/getBindingsDetails.mjs +35 -33
  26. package/dist/dataSource/index.d.ts +1 -0
  27. package/dist/dataSource/index.mjs +7 -6
  28. package/dist/dataSource/utility/checkboxParams.d.ts +11 -0
  29. package/dist/dataSource/utility/checkboxParams.mjs +12 -0
  30. package/dist/dataSource/utility/not.mjs +4 -7
  31. package/dist/dataSource/utility/stringToArray.mjs +1 -1
  32. package/dist/dataSource/utility/truthiness.d.ts +1 -0
  33. package/dist/dataSource/utility/truthiness.mjs +8 -0
  34. package/dist/dataSource/utility/twigTemplate.d.ts +2 -1
  35. package/dist/dataSource/utility/twigTemplate.mjs +29 -17
  36. package/dist/devTools/utils/PlitziConsole.mjs +22 -22
  37. package/dist/helpers/cookies.d.ts +10 -0
  38. package/dist/helpers/cookies.mjs +19 -0
  39. package/dist/helpers/fetchManifest.d.ts +9 -0
  40. package/dist/helpers/fetchManifest.mjs +3 -6
  41. package/dist/helpers/formatDate.d.ts +5 -3
  42. package/dist/helpers/formatDate.mjs +34 -36
  43. package/dist/helpers/index.d.ts +2 -0
  44. package/dist/helpers/index.mjs +18 -13
  45. package/dist/helpers/isDate.d.ts +7 -0
  46. package/dist/helpers/isDate.mjs +15 -0
  47. package/dist/helpers/keys.d.ts +42 -0
  48. package/dist/helpers/keys.mjs +91 -0
  49. package/dist/helpers/twigWrapper/AST.d.ts +2 -2
  50. package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +12 -2
  51. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +69 -31
  52. package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
  53. package/dist/helpers/twigWrapper/Evaluator/index.mjs +2 -2
  54. package/dist/helpers/twigWrapper/Parser/ExpressionParser.d.ts +2 -2
  55. package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +147 -34
  56. package/dist/helpers/twigWrapper/Parser/Parser.d.ts +2 -1
  57. package/dist/helpers/twigWrapper/Parser/Parser.mjs +21 -20
  58. package/dist/helpers/twigWrapper/filters/filters.mjs +134 -111
  59. package/dist/helpers/twigWrapper/index.d.ts +6 -2
  60. package/dist/helpers/twigWrapper/index.mjs +7 -4
  61. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +23 -0
  62. package/dist/helpers/twigWrapper/inspectTemplate.mjs +110 -0
  63. package/dist/helpers/twigWrapper/processTwig/helpers.d.ts +7 -0
  64. package/dist/helpers/twigWrapper/processTwig/helpers.mjs +2 -1
  65. package/dist/helpers/twigWrapper/processTwig/index.d.ts +2 -1
  66. package/dist/helpers/twigWrapper/processTwig/index.mjs +3 -2
  67. package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +28 -0
  68. package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +73 -16
  69. package/dist/helpers/twigWrapper/processTwig/resolveStepParam.d.ts +17 -0
  70. package/dist/helpers/twigWrapper/processTwig/resolveStepParam.mjs +14 -0
  71. package/dist/helpers/twigWrapper/templateRoots.d.ts +11 -0
  72. package/dist/helpers/twigWrapper/templateRoots.mjs +4 -4
  73. package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.d.ts +9 -0
  74. package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.mjs +4 -0
  75. package/dist/history/describe.d.ts +29 -0
  76. package/dist/history/describe.mjs +93 -0
  77. package/dist/history/diff.d.ts +33 -0
  78. package/dist/history/diff.mjs +73 -0
  79. package/dist/history/index.d.ts +3 -0
  80. package/dist/history/index.mjs +3 -0
  81. package/dist/history/types.d.ts +48 -0
  82. package/dist/history/types.mjs +0 -0
  83. package/dist/hooks/usePlitziServiceContext.d.ts +1 -1
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.mjs +77 -65
  86. package/dist/navigation/index.d.ts +1 -1
  87. package/dist/navigation/index.mjs +2 -2
  88. package/dist/navigation/routes.d.ts +11 -1
  89. package/dist/navigation/routes.mjs +35 -30
  90. package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.d.ts +14 -0
  91. package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.mjs +16 -0
  92. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.d.ts +4 -0
  93. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.mjs +2 -2
  94. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRunActionMutation.mjs +1 -0
  95. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.d.ts +3 -0
  96. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.mjs +9 -0
  97. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.d.ts +11 -0
  98. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.mjs +24 -0
  99. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.d.ts +4 -0
  100. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.mjs +15 -0
  101. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.d.ts +2 -0
  102. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.mjs +9 -0
  103. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.d.ts +2 -0
  104. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs +9 -0
  105. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.d.ts +2 -0
  106. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.mjs +9 -0
  107. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.d.ts +2 -0
  108. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.mjs +9 -0
  109. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.d.ts +2 -0
  110. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.mjs +9 -0
  111. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.d.ts +2 -0
  112. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.mjs +9 -0
  113. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.d.ts +2 -0
  114. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.mjs +11 -0
  115. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.d.ts +2 -0
  116. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.mjs +11 -0
  117. package/dist/network/graphql/builder/Mutations/index.d.ts +28 -0
  118. package/dist/network/graphql/builder/Mutations/index.mjs +108 -84
  119. package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.d.ts +23 -0
  120. package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.mjs +49 -0
  121. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.d.ts +6 -0
  122. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.mjs +13 -0
  123. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +17 -0
  124. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +22 -0
  125. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.d.ts +6 -0
  126. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.mjs +32 -0
  127. package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.d.ts +6 -0
  128. package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.mjs +16 -0
  129. package/dist/network/graphql/builder/Queries/index.d.ts +17 -3
  130. package/dist/network/graphql/builder/Queries/index.mjs +30 -22
  131. package/dist/network/graphql/sdk/Mutations/index.d.ts +1 -1
  132. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +1 -1
  133. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +2 -91
  134. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +1 -1
  135. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +2 -44
  136. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +1 -1
  137. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +2 -55
  138. package/dist/network/graphql/sdk/Queries/index.d.ts +1 -5
  139. package/dist/network/index.mjs +7 -7
  140. package/dist/network/spaceEvents.d.ts +33 -3
  141. package/dist/network/spaceEvents.mjs +102 -89
  142. package/dist/realtime/client.d.ts +46 -0
  143. package/dist/realtime/client.mjs +192 -0
  144. package/dist/realtime/index.d.ts +6 -0
  145. package/dist/realtime/index.mjs +4 -0
  146. package/dist/realtime/presence.d.ts +38 -0
  147. package/dist/realtime/presence.mjs +70 -0
  148. package/dist/realtime/topics.d.ts +36 -0
  149. package/dist/realtime/topics.mjs +25 -0
  150. package/dist/schema/serverElements.d.ts +5 -0
  151. package/dist/schema/serverElements.mjs +15 -14
  152. package/dist/server/actions/useRealtimeSync.d.ts +9 -0
  153. package/dist/server/actions/useRealtimeSync.mjs +7 -0
  154. package/dist/state/index.d.ts +1 -0
  155. package/dist/state/index.mjs +3 -2
  156. package/dist/state/paintedState.d.ts +52 -0
  157. package/dist/state/paintedState.mjs +37 -0
  158. package/dist/state/runtimeStatePersist.d.ts +24 -0
  159. package/dist/state/runtimeStatePersist.mjs +113 -10
  160. package/dist/store/index.d.ts +45 -45
  161. package/dist/store/renderSettings.d.ts +6 -3
  162. package/dist/store/tracing/index.d.ts +1 -0
  163. package/dist/store/tracing/tracingCollector.d.ts +17 -1
  164. package/dist/store/tracing/tracingCollector.mjs +5 -0
  165. package/dist/style/index.d.ts +1 -0
  166. package/dist/style/index.mjs +3 -2
  167. package/dist/style/runtimeStyle.d.ts +29 -0
  168. package/dist/style/runtimeStyle.mjs +7 -0
  169. package/dist/style/styleConstants.d.ts +3 -2
  170. package/dist/style/styleConstants.mjs +2 -0
  171. package/dist/style/styleStates.d.ts +14 -1
  172. package/dist/style/styleStates.mjs +10 -7
  173. package/dist/theme/ThemeProvider.d.ts +1 -1
  174. package/dist/theme/ThemeProvider.mjs +35 -29
  175. package/dist/theme/themeCookie.mjs +11 -15
  176. package/dist/types/ActionTypes.d.ts +193 -0
  177. package/dist/types/AuthTypes.d.ts +11 -1
  178. package/dist/types/CommonTypes.d.ts +6 -0
  179. package/dist/types/FunctionTypes.d.ts +52 -0
  180. package/dist/types/FunctionTypes.mjs +0 -0
  181. package/dist/types/PluginTypes.d.ts +0 -1
  182. package/dist/types/RealtimeTypes.d.ts +94 -0
  183. package/dist/types/RealtimeTypes.mjs +0 -0
  184. package/dist/types/SchemaTypes.d.ts +54 -0
  185. package/dist/types/SchemaTypes.mjs +8 -0
  186. package/dist/types/ServerTypes.d.ts +310 -15
  187. package/dist/types/SpaceTypes.d.ts +53 -0
  188. package/dist/types/StateTypes.d.ts +6 -0
  189. package/dist/types/StoreTypes.d.ts +12 -1
  190. package/dist/types/index.d.ts +2 -0
  191. package/dist/types/index.mjs +3 -2
  192. package/package.json +190 -21
  193. package/vite.config.ts +0 -12
  194. package/dist/network/graphql/builder/Queries/PluginsQuery.d.ts +0 -9
  195. package/dist/network/graphql/builder/Queries/PluginsQuery.mjs +0 -54
@@ -1,4 +1,5 @@
1
1
  import { User } from './AuthTypes';
2
+ import { RealtimeTransport } from './RealtimeTypes';
2
3
  import { SSRRenderResult, SSRRscData } from './ServerTypes';
3
4
  export type Environment = 'production' | 'staging' | 'development' | 'main';
4
5
  export type Server<T extends Record<string, unknown> = Record<string, unknown>> = {
@@ -44,6 +45,11 @@ export type ServerSSR = {
44
45
  * is what tells a client flow that a `serverAction` step has nowhere to run, rather than letting it fail per
45
46
  * click. A static export publishes nothing here and the step reports itself inert. */
46
47
  actionPath?: string;
48
+ /** Path where this origin's realtime channels answer. Published only by a server that mounts them: its absence is
49
+ * what keeps a `channel` element closed in the builder, an embed or a static export. */
50
+ realtimePath?: string;
51
+ /** How pages connect to them — a stream (`sse`, when absent) or a socket (`websocket`). */
52
+ realtimeTransport?: RealtimeTransport;
47
53
  /** Channel the SSR render writes its response into (status, redirect). Server-side only and by reference: it never
48
54
  * crosses to the browser, and nothing subscribes to it. */
49
55
  renderResult?: SSRRenderResult;
@@ -0,0 +1,52 @@
1
+ import { InteractionCallbackParam } from './InteractionTypes';
2
+ /**
3
+ * A space's own functions, as everything outside the runner sees them: the builder, the CLI, the MCP and the
4
+ * platform that stores them. The contract the code itself is written against is `@plitzi/sdk-server/functions`.
5
+ */
6
+ /** One task the functions declare: everything but its code — what the catalog shows and a step is drawn from. */
7
+ export type FunctionTaskManifest = {
8
+ namespace: string;
9
+ action: string;
10
+ title: string;
11
+ description?: string;
12
+ params: Record<string, InteractionCallbackParam<Record<string, unknown>>>;
13
+ };
14
+ /** What a space's functions declare, read from the bundle when it is saved: its tasks, routes and reachable hosts. */
15
+ export type FunctionsManifest = {
16
+ hosts: string[];
17
+ tasks: FunctionTaskManifest[];
18
+ /** The route keys, `'GET /board-assets/:board/:asset'`, as declared. */
19
+ routes: string[];
20
+ };
21
+ /** One reason functions were not saved, where it is — what an editor underlines. */
22
+ export type FunctionsProblem = {
23
+ file?: string;
24
+ line?: number;
25
+ column?: number;
26
+ message: string;
27
+ };
28
+ /** The live draft: the source files, which copy of them this is, and what they declared when last saved. */
29
+ export type FunctionsDraft = {
30
+ /** `{ "index.ts": "…", "lib/feed.ts": "…" }`. */
31
+ files: Record<string, string>;
32
+ /** Hand it back as `base` when saving: a draft that moved on since is refused rather than overwritten. */
33
+ version: string;
34
+ manifest: FunctionsManifest | null;
35
+ };
36
+ /** Why nothing was built: the draft moved on since the copy this save started from. */
37
+ export type FunctionsRefusal = {
38
+ status: 409;
39
+ error: string;
40
+ limit: 'version';
41
+ };
42
+ export type FunctionsSaveResult = {
43
+ ok: true;
44
+ version: string;
45
+ manifest: FunctionsManifest;
46
+ } | {
47
+ ok: false;
48
+ problems: FunctionsProblem[];
49
+ } | {
50
+ ok: false;
51
+ refusal: FunctionsRefusal;
52
+ };
File without changes
@@ -101,7 +101,6 @@ export type PluginsContextValue = {
101
101
  assets: Record<string, Asset>;
102
102
  plugins: Record<string, ComponentDefinition>;
103
103
  dispatchPlugins?: unknown;
104
- fetch?: (filter: object, cursor: string, limit: number) => Promise<unknown>;
105
104
  add?: (pluginType: string, resource?: string) => Promise<boolean>;
106
105
  setSettings?: (pluginType: string, attribute: string, value: string) => Promise<boolean>;
107
106
  getSettings?: (pluginType: string, attribute?: string, defaultValue?: string | number | boolean) => ComponentDefinition['settings'] | string | number | boolean;
@@ -0,0 +1,94 @@
1
+ import { ActionAccess } from './ActionTypes';
2
+ /**
3
+ * One kind of channel a space offers, declared under a topic PATTERN — `board:{id}` is every board, each its own topic.
4
+ *
5
+ * A topic no pattern of the space matches is refused, by the server and at authoring: a page cannot open a channel
6
+ * nobody decided should exist.
7
+ */
8
+ export type ChannelDeclaration = {
9
+ /** Who may subscribe and publish — the access vocabulary actions use. */
10
+ access: ActionAccess;
11
+ /**
12
+ * Who may send: `clients` (pages publish directly — cursors, reactions, what is cheap and ephemeral) or `server`
13
+ * (only a flow's `realtime.publish` — what was validated and saved first). `clients` when absent.
14
+ */
15
+ publish?: 'clients' | 'server';
16
+ /** Whether members announce themselves — who is here, and what they are pointing at. */
17
+ presence?: boolean;
18
+ /**
19
+ * Whether a page needs a GRANT to open a topic of it: a token a flow's `realtime.grant` issued for that exact topic —
20
+ * after checking a password, an invitation, an order's owner, whatever decides who is in. Without one the topic is
21
+ * refused, however well its name is known; `access` still applies on top. For a private room, a customer's order,
22
+ * a locked board.
23
+ */
24
+ grant?: boolean;
25
+ /** The largest `data` a page may send, as JSON bytes. 4 KB when absent. */
26
+ maxMessageBytes?: number;
27
+ /** How many messages one connection may send a second. 30 when absent. */
28
+ messagesPerSecond?: number;
29
+ };
30
+ export type ChannelDeclarations = Record<string, ChannelDeclaration>;
31
+ /** Who sent a message, as the SERVER knows them: a page cannot say it is someone else. */
32
+ export type RealtimeSender = {
33
+ /** The connection, as the server named it — stable for as long as the page stays connected. */
34
+ from: string;
35
+ /** The signed-in visitor, when the connection carries a session. */
36
+ user?: {
37
+ id: number;
38
+ name: string;
39
+ };
40
+ };
41
+ /**
42
+ * A message, as every subscriber receives it.
43
+ *
44
+ * `type` and `data` are the sender's own vocabulary; everything else is stamped by the server. Types starting with
45
+ * `$` are the channel's own: `$presence` (a member's state) and `$leave` (a member gone).
46
+ */
47
+ export type RealtimeMessage = RealtimeSender & {
48
+ topic: string;
49
+ type: string;
50
+ data: unknown;
51
+ /** Server time, in milliseconds. */
52
+ at: number;
53
+ };
54
+ /** What a page sends to publish: the secret its connection was given, and the message. */
55
+ export type RealtimePublishRequest = {
56
+ token: string;
57
+ topic: string;
58
+ type: string;
59
+ data: unknown;
60
+ };
61
+ /**
62
+ * How messages move between the processes and replicas of a deployment — transport only, strings in and out.
63
+ *
64
+ * Everything a channel DOES (who may, how big, how often, who sent it) is decided above it, once, for every
65
+ * deployment. In memory for one self-hosted process and its workers; Redis, NATS or a cloud service for a fleet.
66
+ */
67
+ export type PubSubAdapter = {
68
+ /** Delivers `message` to every subscriber of `topic`, in this process and every other sharing the adapter. */
69
+ publish: (topic: string, message: string) => Promise<void>;
70
+ /** Calls `listener` for each message on `topic` until the returned function is called. */
71
+ subscribe: (topic: string, listener: (message: string) => void) => Promise<() => Promise<void>>;
72
+ };
73
+ /**
74
+ * How a page connects: a Server-Sent Events stream it publishes to with requests, or one WebSocket both ways.
75
+ *
76
+ * The stream works through anything that passes HTTP; the socket sends a message as a frame instead of a request,
77
+ * which is what a page publishing a cursor twenty times a second wants. A page told to use the socket falls back to
78
+ * the stream on its own where one cannot open (behind HTTP/2, a proxy that drops upgrades).
79
+ */
80
+ export type RealtimeTransport = 'sse' | 'websocket';
81
+ /** A server's realtime channels. On by default; `false` turns the endpoint off. */
82
+ export type SSRRealtimeConfig = {
83
+ /** How messages reach the other processes and replicas. In memory (and across workers) when absent. */
84
+ pubsub?: PubSubAdapter;
85
+ /** Where pages connect. `/_realtime` when absent. */
86
+ path?: string;
87
+ /** How pages connect. `sse` when absent; both are always served, this is what pages are told to use. */
88
+ transport?: RealtimeTransport;
89
+ /**
90
+ * Origins, besides the server's own, whose pages may open a WebSocket here (`https://app.example.com`). A
91
+ * socket carries the visitor's cookies from any site, so every other origin is refused.
92
+ */
93
+ allowedOrigins?: string[];
94
+ } | false;
File without changes
@@ -1,4 +1,5 @@
1
1
  import { InteractionCallbackParamValues, InteractionCallbackType } from './InteractionTypes';
2
+ import { ChannelDeclarations } from './RealtimeTypes';
2
3
  import { Style } from './StyleTypes';
3
4
  import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
4
5
  export type ElementRuntime = 'server' | 'client' | 'shared';
@@ -44,6 +45,15 @@ export type ElementBinding = {
44
45
  enabled?: boolean;
45
46
  to: string;
46
47
  };
48
+ /**
49
+ * What a trigger does when it fires again while the flow it started is still running.
50
+ *
51
+ * - `skip` (the default): the new firing is ignored — what keeps a double click from submitting twice.
52
+ * - `parallel`: every firing runs its own flow, at the same time.
53
+ * - `queue`: every firing runs, one after another, in the order they came — none lost, none overlapping.
54
+ */
55
+ export type WhileRunning = 'skip' | 'parallel' | 'queue';
56
+ export declare const WHILE_RUNNING_MODES: readonly WhileRunning[];
47
57
  export type ElementInteraction<T extends Record<string, unknown> = Record<string, unknown>> = {
48
58
  id: string;
49
59
  title: string;
@@ -57,6 +67,8 @@ export type ElementInteraction<T extends Record<string, unknown> = Record<string
57
67
  flowId: string;
58
68
  enabled: boolean;
59
69
  when?: RuleGroup;
70
+ /** On a trigger only: what a firing does while this flow is still running. `skip` when absent. */
71
+ whileRunning?: WhileRunning;
60
72
  };
61
73
  export type ElementDefinition = {
62
74
  rootId: Element['id'];
@@ -123,7 +135,30 @@ export type Schema = {
123
135
  settings: {
124
136
  keepState?: boolean;
125
137
  stateStorage?: 'localStorage' | 'sessionStorage';
138
+ /**
139
+ * Keys of `runtime.state` that are never kept, even with `keepState` on: they are not written, not brought back,
140
+ * and a value one of them already holds survives the moment the rest is restored. For state that must start fresh
141
+ * on every visit — a demo, a panel somebody left open, a step of a walkthrough. Top-level keys, as `setState`
142
+ * writes them.
143
+ */
144
+ transientState?: string[];
145
+ /**
146
+ * Keys of `runtime.state` the first paint depends on — the tool a toolbar shows, a name in an avatar — kept in a
147
+ * cookie as well as in `stateStorage`, so the server renders with them and the page does not swap them in after
148
+ * hydration. Small values only: the cookie travels with every request and holds at most a few kilobytes. Needs
149
+ * `keepState`; a key cannot be both painted and transient. Top-level keys, as `setState` writes them.
150
+ */
151
+ paintedState?: string[];
126
152
  customCss: string;
153
+ /**
154
+ * The roles a signed-in visitor may hold in this space, each with the permissions it gives:
155
+ * `{ author: ['postPublish'] }`. They are what an action's `access: 'role'` and a page's `can()` are answered from
156
+ * — a visitor holds exactly the permissions of their roles here, never those of their account anywhere else.
157
+ *
158
+ * Declared by the space, so they are published, versioned and exported with it. WHO holds which is not: that is a
159
+ * list of people, kept by the platform the space runs on, and never part of a document anybody can read.
160
+ */
161
+ visitorRoles?: Record<string, string[]>;
127
162
  /** `basic` covers any HTTP+JSON backend by configuration; anything else is a name someone registered. */
128
163
  userProvider?: 'basic' | 'custom' | '' | (string & {});
129
164
  tokenStorage?: 'localStorage' | 'sessionStorage' | '';
@@ -151,6 +186,13 @@ export type Schema = {
151
186
  * session itself, which is the case whenever `loginUrl` is your own API.
152
187
  */
153
188
  sessionExchangeUrl?: string;
189
+ /**
190
+ * Where a sign-in that owed a second factor is completed: a password the backend answered with `mfaRequired` and
191
+ * an `mfaToken` resolves `auth.login` to `{ ok: false, reason: 'mfa', mfaToken }`, and `auth.login` with `mode:
192
+ * 'mfa'` posts `{ mfaToken, code }` here and adopts the session it answers with. Leave empty when the backend has
193
+ * no second factor.
194
+ */
195
+ mfaUrl?: string;
154
196
  /**
155
197
  * What to do on a page that requires a session while the stored one is being re-checked. `optimistic` (the
156
198
  * default) renders from the stored session and signs out if the check disagrees; `strict` waits for the answer,
@@ -167,6 +209,18 @@ export type Schema = {
167
209
  * `false` there cannot be turned around from here. Never `devMode`, which makes a deployment a development server.
168
210
  */
169
211
  debugMode?: boolean;
212
+ /**
213
+ * Values the space computes once and reads everywhere, by name: `{ xp: '{{ state.favourites|length * 10 }}' }` is
214
+ * read as `{{ computed.xp }}` in any binding, attribute or step. Each is a template over the global sources and the
215
+ * values declared before it (`computed.<earlier>`), re-evaluated when any of them changes. A template that is one
216
+ * `{{ expression }}` gives its value (a number, a list); anything else gives text.
217
+ */
218
+ computed?: Record<string, string>;
219
+ /**
220
+ * The realtime channels the space offers, by topic pattern: `{ 'board:{id}': { access: { mode: 'public' } } }`.
221
+ * A page subscribes to and publishes on a topic one of them matches, and on nothing else.
222
+ */
223
+ channels?: ChannelDeclarations;
170
224
  };
171
225
  rsc?: SchemaRsc;
172
226
  pages: Element['id'][];
@@ -0,0 +1,8 @@
1
+ //#region src/types/SchemaTypes.ts
2
+ var e = [
3
+ "skip",
4
+ "parallel",
5
+ "queue"
6
+ ];
7
+ //#endregion
8
+ export { e as WHILE_RUNNING_MODES };