@plitzi/sdk-shared 0.38.24 → 0.39.1

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 (197) hide show
  1. package/CHANGELOG.md +153 -1
  2. package/dist/actions/functions.d.ts +22 -1
  3. package/dist/actions/functions.mjs +3 -3
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +7 -7
  6. package/dist/auth/failureChannel.mjs +1 -0
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.mjs +2 -2
  9. package/dist/auth/visitorRoles.d.ts +8 -0
  10. package/dist/auth/visitorRoles.mjs +5 -2
  11. package/dist/authoring/declare.d.ts +34 -1
  12. package/dist/authoring/elementCallbacks.d.ts +13 -0
  13. package/dist/authoring/elementCallbacks.mjs +11 -5
  14. package/dist/authoring/index.mjs +3 -3
  15. package/dist/authoring/paramSpec.d.ts +1 -0
  16. package/dist/dataSource/getBindingsDetails.d.ts +1 -1
  17. package/dist/dataSource/getBindingsDetails.mjs +1 -1
  18. package/dist/dataSource/globalSources.d.ts +1 -1
  19. package/dist/dataSource/index.d.ts +1 -2
  20. package/dist/dataSource/index.mjs +1 -1
  21. package/dist/dataSource/utility/arrayMap.mjs +1 -1
  22. package/dist/dataSource/utility/capitalize.mjs +1 -1
  23. package/dist/dataSource/utility/styleSelector.mjs +5 -3
  24. package/dist/dataSource/utility/styleVariant.mjs +17 -13
  25. package/dist/dataSource/variables/index.d.ts +2 -0
  26. package/dist/dataSource/variables/index.mjs +1 -0
  27. package/dist/dataSource/{resolveVariables.d.ts → variables/resolveVariables.d.ts} +1 -1
  28. package/dist/dataSource/{resolveVariables.mjs → variables/resolveVariables.mjs} +1 -1
  29. package/dist/devTools/chrome.d.ts +6 -0
  30. package/dist/devTools/chrome.mjs +2 -2
  31. package/dist/devTools/index.mjs +5 -5
  32. package/dist/devTools/sight/index.d.ts +1 -0
  33. package/dist/devTools/sight/index.mjs +1 -0
  34. package/dist/devTools/sight/sight.d.ts +28 -0
  35. package/dist/devTools/sight/sight.mjs +127 -0
  36. package/dist/devTools/utils/PlitziConsole.d.ts +14 -0
  37. package/dist/devTools/utils/PlitziConsole.mjs +20 -3
  38. package/dist/flags/flagsCookie.mjs +4 -4
  39. package/dist/flags/resolveFlags.d.ts +1 -1
  40. package/dist/helpers/index.mjs +19 -19
  41. package/dist/helpers/ruleEvaluator.d.ts +2 -0
  42. package/dist/helpers/ruleEvaluator.mjs +2 -2
  43. package/dist/helpers/scroll.d.ts +10 -0
  44. package/dist/helpers/scroll.mjs +2 -2
  45. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +90 -88
  46. package/dist/helpers/twigWrapper/Evaluator/helpers.d.ts +6 -0
  47. package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +11 -2
  48. package/dist/helpers/twigWrapper/filters/arrays.d.ts +2 -0
  49. package/dist/helpers/twigWrapper/filters/arrays.mjs +66 -0
  50. package/dist/helpers/twigWrapper/filters/catalog/index.d.ts +17 -0
  51. package/dist/helpers/twigWrapper/filters/catalog/index.mjs +351 -0
  52. package/dist/helpers/twigWrapper/filters/dateParts.d.ts +25 -0
  53. package/dist/helpers/twigWrapper/filters/dateParts.mjs +56 -0
  54. package/dist/helpers/twigWrapper/filters/dates.d.ts +2 -0
  55. package/dist/helpers/twigWrapper/filters/dates.mjs +97 -0
  56. package/dist/helpers/twigWrapper/filters/filters.d.ts +3 -13
  57. package/dist/helpers/twigWrapper/filters/filters.mjs +25 -483
  58. package/dist/helpers/twigWrapper/filters/hashing.d.ts +3 -0
  59. package/dist/helpers/twigWrapper/filters/hashing.mjs +101 -0
  60. package/dist/helpers/twigWrapper/filters/index.mjs +4 -1
  61. package/dist/helpers/twigWrapper/filters/misc.d.ts +5 -0
  62. package/dist/helpers/twigWrapper/filters/misc.mjs +52 -0
  63. package/dist/helpers/twigWrapper/filters/numbers.d.ts +2 -0
  64. package/dist/helpers/twigWrapper/filters/numbers.mjs +36 -0
  65. package/dist/helpers/twigWrapper/filters/objects.d.ts +3 -0
  66. package/dist/helpers/twigWrapper/filters/objects.mjs +61 -0
  67. package/dist/helpers/twigWrapper/filters/raw.d.ts +8 -0
  68. package/dist/helpers/twigWrapper/filters/raw.mjs +7 -0
  69. package/dist/helpers/twigWrapper/filters/strings.d.ts +7 -0
  70. package/dist/helpers/twigWrapper/filters/strings.mjs +79 -0
  71. package/dist/helpers/twigWrapper/filters/types.d.ts +5 -0
  72. package/dist/helpers/twigWrapper/filters/types.mjs +4 -0
  73. package/dist/helpers/twigWrapper/filters/values.d.ts +12 -0
  74. package/dist/helpers/twigWrapper/filters/values.mjs +17 -0
  75. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +5 -0
  76. package/dist/helpers/twigWrapper/inspectTemplate.mjs +39 -20
  77. package/dist/helpers/utils.d.ts +4 -0
  78. package/dist/helpers/utils.mjs +3 -5
  79. package/dist/navigation/index.d.ts +2 -0
  80. package/dist/navigation/index.mjs +2 -1
  81. package/dist/navigation/sitemap.d.ts +16 -0
  82. package/dist/navigation/sitemap.mjs +25 -0
  83. package/dist/network/entitlements.d.ts +101 -0
  84. package/dist/network/entitlements.mjs +4 -0
  85. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.d.ts +31 -0
  86. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +13 -0
  87. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.d.ts +5 -0
  88. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +11 -0
  89. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.d.ts +1 -1
  90. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -1
  91. package/dist/network/graphql/builder/Mutations/index.d.ts +5 -0
  92. package/dist/network/graphql/builder/Mutations/index.mjs +150 -146
  93. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.d.ts +40 -0
  94. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +24 -0
  95. package/dist/network/graphql/builder/Queries/index.d.ts +3 -0
  96. package/dist/network/graphql/builder/Queries/index.mjs +44 -42
  97. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +3 -1
  98. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
  99. package/dist/network/index.d.ts +1 -0
  100. package/dist/network/index.mjs +9 -8
  101. package/dist/network/spaceEvents.d.ts +20 -1
  102. package/dist/network/spaceEvents.mjs +12 -0
  103. package/dist/project/index.mjs +8 -5
  104. package/dist/project/layout/check.d.ts +22 -0
  105. package/dist/project/layout/check.mjs +60 -0
  106. package/dist/project/{layout.d.ts → layout/codes.d.ts} +3 -66
  107. package/dist/project/layout/codes.mjs +108 -0
  108. package/dist/project/layout/contents.d.ts +10 -0
  109. package/dist/project/layout/contents.mjs +31 -0
  110. package/dist/project/layout/files.d.ts +31 -0
  111. package/dist/project/layout/files.mjs +49 -0
  112. package/dist/project/layout/folders.d.ts +4 -0
  113. package/dist/project/layout/folders.mjs +69 -0
  114. package/dist/project/layout/index.d.ts +16 -0
  115. package/dist/project/layout/index.mjs +5 -0
  116. package/dist/project/layout/plugins.d.ts +46 -0
  117. package/dist/project/layout/plugins.mjs +99 -0
  118. package/dist/project/layout/vendor.d.ts +15 -0
  119. package/dist/project/layout/vendor.mjs +34 -0
  120. package/dist/project/pages/index.d.ts +8 -0
  121. package/dist/project/pages/index.mjs +14 -0
  122. package/dist/project/paths/index.d.ts +52 -4
  123. package/dist/project/paths/index.mjs +2 -2
  124. package/dist/project/root.d.ts +6 -0
  125. package/dist/project/root.mjs +11 -10
  126. package/dist/realtime/client.mjs +104 -91
  127. package/dist/realtime/presence.d.ts +2 -2
  128. package/dist/realtime/presence.mjs +27 -21
  129. package/dist/runs/index.d.ts +73 -0
  130. package/dist/runs/index.mjs +6 -0
  131. package/dist/runs/report.d.ts +56 -0
  132. package/dist/runs/report.mjs +17 -0
  133. package/dist/schema/index.d.ts +6 -0
  134. package/dist/schema/index.mjs +18 -12
  135. package/dist/schema/motion.d.ts +25 -0
  136. package/dist/schema/motion.mjs +47 -19
  137. package/dist/schema/pageAccess.d.ts +6 -0
  138. package/dist/schema/pageAccess.mjs +8 -3
  139. package/dist/schema/pageHead.d.ts +64 -0
  140. package/dist/schema/pageHead.mjs +68 -0
  141. package/dist/schema/providerAnswer.d.ts +17 -0
  142. package/dist/schema/providerAnswer.mjs +4 -0
  143. package/dist/schema/providerWhen.d.ts +36 -0
  144. package/dist/schema/providerWhen.mjs +58 -0
  145. package/dist/schema/schemaSettings.d.ts +14 -0
  146. package/dist/schema/schemaSettings.mjs +4 -0
  147. package/dist/schema/serverElements.d.ts +20 -1
  148. package/dist/schema/serverElements.mjs +41 -28
  149. package/dist/schema/serverInput.d.ts +34 -0
  150. package/dist/schema/serverInput.mjs +60 -0
  151. package/dist/schema/serverQuery.d.ts +47 -0
  152. package/dist/schema/serverQuery.mjs +70 -0
  153. package/dist/server/index.mjs +5 -5
  154. package/dist/server/rsc/refreshRsc.d.ts +6 -2
  155. package/dist/server/rsc/refreshRsc.mjs +75 -59
  156. package/dist/server/rsc/useRscSync.mjs +22 -18
  157. package/dist/source/export.d.ts +1 -1
  158. package/dist/state/index.mjs +3 -3
  159. package/dist/state/paintedState.d.ts +20 -4
  160. package/dist/state/paintedState.mjs +13 -12
  161. package/dist/state/runtimeStatePersist.mjs +109 -48
  162. package/dist/store/renderSettings.d.ts +2 -0
  163. package/dist/store/renderSettings.mjs +13 -5
  164. package/dist/store/storeHooks.d.ts +45 -45
  165. package/dist/style/index.mjs +16 -16
  166. package/dist/style/styleConstants.d.ts +12 -2
  167. package/dist/style/styleConstants.mjs +20 -0
  168. package/dist/style/styleStates.d.ts +5 -0
  169. package/dist/style/styleStates.mjs +21 -5
  170. package/dist/types/ActionTypes.d.ts +26 -3
  171. package/dist/types/AuthTypes.d.ts +19 -1
  172. package/dist/types/CommonTypes.d.ts +3 -2
  173. package/dist/types/ElementTypes.d.ts +1 -1
  174. package/dist/types/InteractionTypes.d.ts +10 -1
  175. package/dist/types/JobTypes.d.ts +2 -1
  176. package/dist/types/OAuthTypes.d.ts +246 -0
  177. package/dist/types/OAuthTypes.mjs +0 -0
  178. package/dist/types/PluginTypes.d.ts +2 -0
  179. package/dist/types/PreviewTypes.d.ts +71 -0
  180. package/dist/types/PreviewTypes.mjs +0 -0
  181. package/dist/types/RealtimeTypes.d.ts +11 -0
  182. package/dist/types/SchemaTypes.d.ts +63 -0
  183. package/dist/types/ServerAdapterTypes.d.ts +345 -0
  184. package/dist/types/ServerAdapterTypes.mjs +0 -0
  185. package/dist/types/ServerConfigTypes.d.ts +527 -0
  186. package/dist/types/ServerConfigTypes.mjs +0 -0
  187. package/dist/types/ServerLogTypes.d.ts +119 -0
  188. package/dist/types/ServerLogTypes.mjs +0 -0
  189. package/dist/types/ServerTypes.d.ts +30 -1215
  190. package/dist/types/StoreTypes.d.ts +39 -1
  191. package/dist/types/TestTypes.d.ts +249 -0
  192. package/dist/types/TestTypes.mjs +0 -0
  193. package/dist/types/index.d.ts +6 -0
  194. package/eslint.config.mjs +3 -1
  195. package/package.json +2 -2
  196. package/setupTests.ts +4 -3
  197. package/dist/project/layout.mjs +0 -394
@@ -7,6 +7,7 @@ import { RealtimeTransport } from './RealtimeTypes';
7
7
  import { Schema, Element } from './SchemaTypes';
8
8
  import { SpaceConnector } from './SpaceTypes';
9
9
  import { DisplayMode, Style, StylePseudo, StyleState } from './StyleTypes';
10
+ import { SignedInTestAccount } from './TestTypes';
10
11
  import { ColorScheme, Theme } from './ThemeTypes';
11
12
  import { FlagOverrides, FlagResolution } from '../flags/resolveFlags';
12
13
  export type RuntimeSourceValues = {
@@ -30,6 +31,14 @@ export type RuntimeSourceValues = {
30
31
  * Top-level for the reason `rsc` is: the overrides are written at the root — by whoever mounts the SDK, by the builder
31
32
  * forcing one — and an element scope owning `runtime` would keep a write from any depth to itself.
32
33
  */
34
+ /**
35
+ * How a navigation goes: `external` leaves the space for a whole address; `replace` takes the place of the address the
36
+ * visitor is on, so Back skips it — a sheet opened by `?stats=1` and closed, which Back reopened.
37
+ */
38
+ export type NavigateHow = {
39
+ external?: boolean;
40
+ replace?: boolean;
41
+ };
33
42
  export type FlagsState = {
34
43
  overrides?: FlagOverrides;
35
44
  /** Each declared flag's answer and the layer that gave it — what the dev tools show. The values alone are the
@@ -51,6 +60,12 @@ export type CommonState = {
51
60
  * list the host's screens unless the host can give it the list.
52
61
  */
53
62
  host?: Record<string, unknown>;
63
+ /**
64
+ * The test account a journey plays as (`tests.accounts`, its `as`), set through the dev tools' inspector: the page
65
+ * reads it as the visitor signed in — the auth source, `can()`, the pages for signed-in visitors. Never a session the
66
+ * server knows; only where the inspector is (a development page, a server's run of the journeys).
67
+ */
68
+ testAccount?: SignedInTestAccount;
54
69
  elements?: Record<string, unknown>;
55
70
  };
56
71
  sources?: Record<string, Source>;
@@ -100,7 +115,7 @@ export type CommonState = {
100
115
  */
101
116
  href: string;
102
117
  currentPageId: string;
103
- navigate: (url: string, isExternal?: boolean) => void;
118
+ navigate: (url: string, how?: NavigateHow) => void;
104
119
  /**
105
120
  * Where a navigation is going while it waits for the destination's server data — `''` when none is. A link to a
106
121
  * page resolved on the server asks for that page's data before it goes, and the page on screen stays until then:
@@ -138,6 +153,16 @@ export type RenderSettings = {
138
153
  * space's settings can turn it off.
139
154
  */
140
155
  overQuota?: boolean;
156
+ /**
157
+ * This space has nearly spent its plan's allowance, as the SERVER decided when it metered the render: the page says so
158
+ * before `overQuota` would. Like `overQuota`, nothing an author writes can set it.
159
+ */
160
+ quotaNear?: boolean;
161
+ /**
162
+ * The deployment's "Made with Plitzi" badge, as the SERVER decided when it metered the render: on a plan that does
163
+ * not remove it. Like `overQuota`, a fact about the account behind the site that nothing an author writes can set.
164
+ */
165
+ badge?: boolean;
141
166
  /**
142
167
  * Whether every element carries `data-plitzi-el="<its id>"`, which is what an end-to-end test addresses it by.
143
168
  *
@@ -229,6 +254,12 @@ export type RscState = {
229
254
  * marks nothing on this one.
230
255
  */
231
256
  refreshing?: Record<string, boolean>;
257
+ /**
258
+ * Why each server element failed on the page server since the page loaded, by id — said while developing (`$failed`)
259
+ * and kept though the browser asked again and was answered: a provider the first paint and a crawler never get, which
260
+ * `plitzi page check` says (`window.__plitzi.serverFailures()`).
261
+ */
262
+ failures?: Record<string, string>;
232
263
  /**
233
264
  * Names this SDK root, so the refreshes asked through any store under it — each element writes through a scoped store
234
265
  * of its own — are known to each other: one request per question, the newest question winning.
@@ -258,6 +289,13 @@ export type BuilderState = CommonState & {
258
289
  queryParams: QueryParams;
259
290
  hostname: string;
260
291
  };
292
+ /**
293
+ * A journey is on the canvas — opened or played — and the page shows its visitor, as the server plays it: never the
294
+ * editor's session, but the journey's test account (`as`, `runtime.testAccount`), a session it signs in to, or a guest
295
+ * (the auth source empty, `can` false); its pages held to their access, which the canvas otherwise leaves open for
296
+ * editing — a journey that met a guarded page passed on the server and failed here. Editor-only and never published.
297
+ */
298
+ journeyOnCanvas?: boolean;
261
299
  displayMode: DisplayMode;
262
300
  selector?: string;
263
301
  styleSelector?: string;
@@ -0,0 +1,249 @@
1
+ /**
2
+ * A space's tests, kept in its document beside its pages — written in the builder, by code or by an agent —
3
+ * and run against the document they are kept in: a snapshot and a publish need them passing.
4
+ *
5
+ * Two kinds, apart on purpose:
6
+ *
7
+ * - **unit**: one element of the document resolved for a state and data, with no browser — what its bindings, templates
8
+ * and rules make of it. Milliseconds.
9
+ * - **e2e**: a page opened in a browser, a visitor's steps, and what must hold as they go — the flows.
10
+ */
11
+ export interface SpaceTests {
12
+ unit?: UnitTest[];
13
+ e2e?: E2eTest[];
14
+ /** Who the journeys may play as, signed in: declared here alone — see `E2eAccount`. */
15
+ accounts?: E2eAccount[];
16
+ }
17
+ /**
18
+ * Somebody signed in, as the space's journeys play them: declared in the tests alone — no account of the platform's,
19
+ * no password. A journey that plays `as` one shows its pages that visitor: the auth source holds these details and a
20
+ * token no server takes (`test:<id>`), `can()` answers by what its roles give, a page for signed-in visitors opens. The
21
+ * server's API does not know it: what a page asks the API it asks as a guest — a journey with an account reads and
22
+ * moves, it never writes.
23
+ */
24
+ export interface E2eAccount {
25
+ /** What the journeys name it by, and its username on the page: letters, digits, `-` and `_`. */
26
+ id: string;
27
+ email?: string;
28
+ /**
29
+ * The space's visitor roles it holds (`settings.visitorRoles`): what it may is what they give, as for a visitor. One
30
+ * the space no longer declares is warned of, and gives nothing.
31
+ */
32
+ roles?: string[];
33
+ }
34
+ /** A test account as a page is signed in as it: its roles' permissions worked out (`rolesGrant`). */
35
+ export interface SignedInTestAccount extends E2eAccount {
36
+ permissions: string[];
37
+ }
38
+ /** What a unit test resolves its element for. */
39
+ export interface UnitGiven {
40
+ /** The space's state — what `state.<key>` reads. */
41
+ state?: Record<string, unknown>;
42
+ /**
43
+ * Every other source, by its name: an element's (`list_bins` — a list's row is `{ item, index }` —,
44
+ * `apiContainer_feed`) or a global's (`navigation`, `auth`, `theme`, `flags`, `variables`, `host`). The space's
45
+ * `computed` values are worked out from them and the state.
46
+ */
47
+ sources?: Record<string, unknown>;
48
+ }
49
+ /** What must hold of the element a unit test resolves. */
50
+ export type UnitExpectation =
51
+ /** It shows: neither it nor an element around it hidden. */
52
+ {
53
+ kind: 'visible';
54
+ value: boolean;
55
+ }
56
+ /** An attribute, bindings and templates applied: `content`, `href`, `items`. */
57
+ | {
58
+ kind: 'attribute';
59
+ name: string;
60
+ value: unknown;
61
+ }
62
+ /** A property its style bindings write, as CSS names it: `height`, `background-color`. */
63
+ | {
64
+ kind: 'style';
65
+ property: string;
66
+ value: string;
67
+ }
68
+ /** The variant of one of its classes: `pr-rung` is `current`. An empty value is its base. */
69
+ | {
70
+ kind: 'variant';
71
+ className: string;
72
+ value: string;
73
+ }
74
+ /** A key of its initial state, bindings applied: `visibility`, `checked`. */
75
+ | {
76
+ kind: 'state';
77
+ key: string;
78
+ value: unknown;
79
+ };
80
+ export interface UnitTest {
81
+ id: string;
82
+ title: string;
83
+ /** The element of a page it resolves, by id. */
84
+ element: string;
85
+ given?: UnitGiven;
86
+ expect: UnitExpectation[];
87
+ }
88
+ /**
89
+ * An element a step or an expectation names: its id, and for one a list draws more than once, which copy — `bin-bar:3`
90
+ * (the third, from one), `bin-bar:last`.
91
+ */
92
+ export type E2eTarget = string;
93
+ /**
94
+ * A point of an element's box, in percent from its top left — `{ x: 30, y: 60 }`: what a canvas draws (a quake on a map)
95
+ * has no element of its own to press.
96
+ */
97
+ export interface E2ePoint {
98
+ x: number;
99
+ y: number;
100
+ }
101
+ /** What a visitor does, one step of an e2e test. */
102
+ export type E2eAction =
103
+ /** A press on its centre, or on a point of its box. */
104
+ {
105
+ kind: 'click';
106
+ element: E2eTarget;
107
+ point?: E2ePoint;
108
+ }
109
+ /** The pointer put over it, and left there. */
110
+ | {
111
+ kind: 'hover';
112
+ element: E2eTarget;
113
+ point?: E2ePoint;
114
+ }
115
+ /** Typed into the field it is or holds, in place of what the field held — a select chosen, a date set. */
116
+ | {
117
+ kind: 'type';
118
+ element: E2eTarget;
119
+ text: string;
120
+ }
121
+ /** A key or a combination, as a keyboard names it: `Enter`, `Meta+k`. */
122
+ | {
123
+ kind: 'press';
124
+ key: string;
125
+ }
126
+ /** Brought into view, as a reader scrolling to it; with `dx`/`dy`, its own content scrolled by so many pixels. */
127
+ | {
128
+ kind: 'scroll';
129
+ element: E2eTarget;
130
+ dx?: number;
131
+ dy?: number;
132
+ }
133
+ /** Pressed, moved by so many pixels (negative: left, up) and let go — a slider's handle. */
134
+ | {
135
+ kind: 'drag';
136
+ element: E2eTarget;
137
+ dx: number;
138
+ dy: number;
139
+ }
140
+ /** Until the element shows — at most `ms` (10 s), up to 60 s. */
141
+ | {
142
+ kind: 'waitFor';
143
+ element: E2eTarget;
144
+ ms?: number;
145
+ }
146
+ /** A path of the space's own: `/menu`. */
147
+ | {
148
+ kind: 'goto';
149
+ path: string;
150
+ } | {
151
+ kind: 'back';
152
+ } | {
153
+ kind: 'reload';
154
+ }
155
+ /** The page's state set as a flow would set it: a case reached without its steps. */
156
+ | {
157
+ kind: 'setState';
158
+ key: string;
159
+ value: unknown;
160
+ }
161
+ /** A source's value put on the page: `apiContainer_feed.items`. */
162
+ | {
163
+ kind: 'setSource';
164
+ path: string;
165
+ value: unknown;
166
+ }
167
+ /** The page's held clock moved on, in ms. */
168
+ | {
169
+ kind: 'tick';
170
+ ms: number;
171
+ };
172
+ /** What must hold of the page, checked where it stands among the steps. */
173
+ export type E2eExpectation = {
174
+ kind: 'expectShown';
175
+ element: E2eTarget;
176
+ } | {
177
+ kind: 'expectHidden';
178
+ element: E2eTarget;
179
+ }
180
+ /** Its words hold the text — or are it, `exact`. */
181
+ | {
182
+ kind: 'expectText';
183
+ element: E2eTarget;
184
+ text: string;
185
+ exact?: boolean;
186
+ } | {
187
+ kind: 'expectState';
188
+ key: string;
189
+ value: unknown;
190
+ } | {
191
+ kind: 'expectAttribute';
192
+ element: E2eTarget;
193
+ name: string;
194
+ value: string;
195
+ }
196
+ /** A computed property, as CSS names it — or at least (`>=`) or at most (`<=`) a number of it. */
197
+ | {
198
+ kind: 'expectStyle';
199
+ element: E2eTarget;
200
+ property: string;
201
+ value: string;
202
+ at?: '>=' | '<=';
203
+ }
204
+ /** Where two elements stand: `activity.bottom + 8 <= legend.top`. */
205
+ | {
206
+ kind: 'expectPosition';
207
+ relation: string;
208
+ }
209
+ /**
210
+ * An element check of the space (`tests.unit`, by id) holds for the page as the journey left it: its element resolved
211
+ * for the page's state and sources now — not the check's own `given.state` — with the sources the check names itself
212
+ * (a list's row) laid over them. One check of the logic, held at the moment a whole flow reaches it.
213
+ */
214
+ | {
215
+ kind: 'expectCheck';
216
+ check: string;
217
+ };
218
+ export type E2eStep = E2eAction | E2eExpectation;
219
+ export interface E2eTest {
220
+ id: string;
221
+ title: string;
222
+ /**
223
+ * What it is about, in a word or two each — `sign-in`, `onboarding`, `phone`: how a list of many is sorted and filtered
224
+ * (the builder's chips, `plitzi_test run`'s `tags`). Letters, digits, `-` and `_`, lower case; none twice.
225
+ */
226
+ tags?: string[];
227
+ /** The path it opens: `/menu`, `/r/night-drive`. */
228
+ page: string;
229
+ /** The window's width, in px: 1440 when left out. */
230
+ width?: number;
231
+ scheme?: 'light' | 'dark';
232
+ /** The account it plays as, signed in (`accounts`, by id): a guest when left out. */
233
+ as?: string;
234
+ /**
235
+ * Server actions answered by the test, by id: what they return, so the test reads the same data every time. An
236
+ * action it does not name is answered by the space as for a visitor.
237
+ */
238
+ answers?: Record<string, Record<string, unknown>>;
239
+ /** The page's clock, held from this instant (ISO, UTC): a page that writes the time reads the same every run. */
240
+ clock?: string;
241
+ /**
242
+ * Where it starts: the page's state set as it opens, before the first step — a case reached without the steps that
243
+ * lead to it (a basket already full, a visitor already past the first screen).
244
+ */
245
+ given?: {
246
+ state: Record<string, unknown>;
247
+ };
248
+ steps: E2eStep[];
249
+ }
File without changes
@@ -26,3 +26,9 @@ export * from './DevToolsTypes';
26
26
  export * from './StoreTypes';
27
27
  export * from './ThemeTypes';
28
28
  export * from './ServerTypes';
29
+ export * from './ServerAdapterTypes';
30
+ export * from './ServerConfigTypes';
31
+ export * from './ServerLogTypes';
32
+ export * from './OAuthTypes';
33
+ export * from './PreviewTypes';
34
+ export * from './TestTypes';
package/eslint.config.mjs CHANGED
@@ -51,10 +51,12 @@ export default tsEslint.config({
51
51
  '@typescript-eslint/no-confusing-void-expression': 'off', // ['error', { ignoreArrowShorthand: true, ignoreVoidOperator: true }],
52
52
  'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
53
53
  'no-var': 'error',
54
+ // A file is read whole — by a person, and by an agent before it changes it: past this, it is split by what changes
55
+ // together. A project's own files are held to the same idea by `plitzi lint` (`file-too-long`, `MAX_LINES`).
56
+ 'max-lines': ['error', { max: 600, skipBlankLines: true, skipComments: true }],
54
57
  curly: 'error',
55
58
  // indent: ['warn', 2],
56
59
  'linebreak-style': ['error', 'unix'],
57
- quotes: ['error', 'single'],
58
60
  'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: false }],
59
61
  // semi: ['warn', 'never'],
60
62
  'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.38.24",
3
+ "version": "0.39.1",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@plitzi/nexus": "^1.4.0",
37
- "@plitzi/plitzi-ui": "^1.6.34",
37
+ "@plitzi/plitzi-ui": "^1.6.36",
38
38
  "date-fns": "^4.4.0",
39
39
  "immer": "^11.1.21",
40
40
  "zod": "^4.6.7"
package/setupTests.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { vi } from 'vitest';
2
2
  import createFetchMock from 'vitest-fetch-mock';
3
3
 
4
- (globalThis as Record<string, unknown>).PERF_MULTIPLIER = Number(
5
- process.env.PERF_MULTIPLIER ?? (process.env.TURBO_RUN ? 5 : 1)
6
- );
4
+ import { perfMultiplier, testTimeouts } from './testTimeouts';
5
+
6
+ (globalThis as Record<string, unknown>).PERF_MULTIPLIER = perfMultiplier();
7
+ vi.setConfig(testTimeouts());
7
8
 
8
9
  // set globalThis.fetch and globalThis.fetchMock
9
10
  const fetchMocker = createFetchMock(vi);