@plitzi/plitzi-builder 0.35.10 → 0.36.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @plitzi/plitzi-builder
2
2
 
3
+ ## 0.36.1
4
+
5
+ ### Patch Changes
6
+
7
+ - v0.36.1
8
+ - Updated dependencies
9
+ - @plitzi/plitzi-sdk@0.36.1
10
+ - @plitzi/sdk-auth@0.36.1
11
+ - @plitzi/sdk-dev-tools@0.36.1
12
+ - @plitzi/sdk-elements@0.36.1
13
+ - @plitzi/sdk-event-bridge@0.36.1
14
+ - @plitzi/sdk-interactions@0.36.1
15
+ - @plitzi/sdk-navigation@0.36.1
16
+ - @plitzi/sdk-plugins@0.36.1
17
+ - @plitzi/sdk-schema@0.36.1
18
+ - @plitzi/sdk-shared@0.36.1
19
+ - @plitzi/sdk-style@0.36.1
20
+ - @plitzi/sdk-variables@0.36.1
21
+
22
+ ## 0.36.0
23
+
24
+ ### Minor Changes
25
+
26
+ - - **An `apiContainer` can keep its browser requests in a query cache, the way react-query does.** Moving between
27
+ sections or pages used to ask the API again every time a provider was shown: a provider in a hidden section is
28
+ mounted but disabled, so showing it fired a fresh request, and a page navigation remounted it and did the same.
29
+ With the new `cache: true` an answer is kept for `staleTime` seconds (30 by default) and shared by every cached
30
+ provider asking the same thing — same method, URL, credentials and headers, the token included, so two visitors
31
+ never share one. Past its time the answer is still drawn at once and a fresh one is fetched behind it; an answer
32
+ nobody shows is forgotten after `gcTime` seconds (300 by default). A refused request (`4xx`/`5xx`) is shown but
33
+ never kept. **The cache is off unless an element asks for it**: an uncached provider behaves as before, asking on
34
+ every mount and sharing nothing.
35
+
36
+ The cache is `@plitzi/sdk-shared/queries` (`queryCache`, `useQuery`, `invalidateQueries`,
37
+ `invalidateQueriesForWrite`), a nexus store written with the per-path `ttl` of `@plitzi/nexus` 1.2.0, which every
38
+ consumer now requires. It reacts to the store's own freshness events, so anything that expires a query's path
39
+ makes the providers on screen ask again.
40
+
41
+ An answer stops counting as current before its time when the element's `performQuery` runs (it always asks
42
+ again), when a flow runs the new global `invalidateQueries` step (source `queries`: `elements`, api container ids
43
+ — a container's requests are tagged with its own id — and/or a `url` prefix), and after a write. Both write steps
44
+ gained `invalidateQueries` / `invalidateElements`: a `webHook` sent with anything but `GET`/`HEAD` refreshes the
45
+ requests to its own site by default, a completed `runServerAction` refreshes all of them by default, and either
46
+ can name containers instead or refresh nothing. A `writeRecord` refreshes all. Providers on screen ask again at
47
+ once; the rest when they are next shown. A sign-in, sign-out or change of account drops everything held. Server-driven
48
+ providers and RSC are untouched.
49
+
50
+ - **A `webHook` that reads can be cached** (`cache`, `staleTime`), in the same cache and under the same key as an api
51
+ container asking the same thing. Its declaration now lives beside it (`utility/webHookSpec`) and the authoring
52
+ catalog gathers it instead of keeping a copy. A `HEAD` is no longer sent with a body, which `fetch` refused.
53
+
54
+ - **Step params can pick several elements.** A new param type, `elementIds` (with an `elementType` filter), is drawn
55
+ in the flow editor as a picker: the matching elements of the space to add, and the picked ones as chips to remove —
56
+ an id no element answers to any more is kept and flagged. The value is a list of ids, so nobody types a
57
+ comma-separated list; `invalidateQueries.elements` and the write steps' `invalidateElements` use it, and the MCP
58
+ catalog says which element type each such param takes.
59
+
60
+ - The dev-tools' Store tab lists the paths a store holds with a TTL — how long ago each was written, what is left
61
+ of it, and a button to expire one or all of them. The query cache appears there as "Queries".
62
+
63
+ - `useApi` no longer takes `params`: nothing passed them, and a GET cannot carry a body anyway. A mock now answers
64
+ synchronously, without a loading frame, and a provider whose URL has not resolved asks for nothing.
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies
69
+ - @plitzi/plitzi-sdk@0.36.0
70
+ - @plitzi/sdk-auth@0.36.0
71
+ - @plitzi/sdk-dev-tools@0.36.0
72
+ - @plitzi/sdk-elements@0.36.0
73
+ - @plitzi/sdk-event-bridge@0.36.0
74
+ - @plitzi/sdk-interactions@0.36.0
75
+ - @plitzi/sdk-navigation@0.36.0
76
+ - @plitzi/sdk-plugins@0.36.0
77
+ - @plitzi/sdk-schema@0.36.0
78
+ - @plitzi/sdk-shared@0.36.0
79
+ - @plitzi/sdk-style@0.36.0
80
+ - @plitzi/sdk-variables@0.36.0
81
+
3
82
  ## 0.35.10
4
83
 
5
84
  ### Patch Changes
package/dist/index.html CHANGED
@@ -56,10 +56,10 @@
56
56
  render(
57
57
  'plitzi',
58
58
  {
59
- webKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwib3JpZ2lucyI6WyJodHRwczovL3dlYnNpdGUucGxpdHppLmFwcCIsImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImh0dHA6Ly8xMjcuMC4wLjE6ODA4MCJdLCJpc3MiOiJodHRwczovL3NlcnZlci5wbGl0emkubG9jYWwiLCJhdWQiOlsiaHR0cHM6Ly9wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbDozMDAxIiwiaHR0cHM6Ly9hcGkucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zc3IucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9tY3AucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9h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2NhbCIsImh0dHA6Ly8xMjcuMC4wLjE6NTMwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6NTE4MCJdLCJzY29wZSI6InNwYWNlOnJlbmRlciIsImlhdCI6MTc4OTYzNjkxNiwianRpIjoiY2E3NTRhMzYyNGRlMmMwMiIsIm5iZiI6MTc4OTYzNjkxNn0.KXNGtSvJhBPr31zM-bvEgq4X0imMKMwxfS3VoAzXMYo',
60
60
  // The actor. Without it the builder loads and every write is refused, since authorization is
61
61
  // can(actor, space, permission). Both halves come from `yarn token 1 --user admin` in plitzi-sdk-server.
62
- userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzg5NTA1MTI5LCJpYXQiOjE3ODk0MTg3MjksImp0aSI6IjhkODZiNGM0NGY1N2UxNGIiLCJuYmYiOjE3ODk0MTg3Mjl9.xT_Re3lVuVT68s4UnfOXvmf0fW5Hv8Ktu_4XdgMnuBA',
62
+ userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzg5NzIzMDE5LCJpYXQiOjE3ODk2MzY2MTksImp0aSI6IjhlZjJmZmFmOGM0M2M3NmYiLCJuYmYiOjE3ODk2MzY2MTl9.sqmBSkAm3J2VSarPRvk2ChTHQ38lqOAOVKszW_MLPu0',
63
63
  environment: 'main',
64
64
  server: {
65
65
  basePath: '',
@@ -1,3 +1,4 @@
1
+ import { WorkflowElement } from './WorkflowContext';
1
2
  import { ElementInteraction, InteractionCallback, Source } from '@plitzi/sdk-shared';
2
3
  export type WorkflowProps = {
3
4
  nodes?: Record<string, ElementInteraction>;
@@ -10,7 +11,9 @@ export type WorkflowProps = {
10
11
  /** What a new TRIGGER starts as. A server action defaults to `call`; an element's flows have no obvious one. */
11
12
  defaultTrigger?: string;
12
13
  dataSource?: Record<string, Source['meta']>;
14
+ /** The space's elements, for a step param that picks some of them. */
15
+ elements?: WorkflowElement[];
13
16
  onChange?: (nodes: Record<string, ElementInteraction>) => void;
14
17
  };
15
- declare const Workflow: ({ nodes: nodesProp, triggerTitle, callbackTitle, nodeDefinitions, direction, dataSource, stepType, defaultTrigger, onChange }: WorkflowProps) => import("react").JSX.Element;
18
+ declare const Workflow: ({ nodes: nodesProp, triggerTitle, callbackTitle, nodeDefinitions, direction, dataSource, elements, stepType, defaultTrigger, onChange }: WorkflowProps) => import("react").JSX.Element;
16
19
  export default Workflow;
@@ -1,10 +1,18 @@
1
1
  import { ElementInteraction, InteractionCallback, Source, SourceField } from '@plitzi/sdk-shared';
2
+ /** An element of the space a step param can name, as the element picker lists it. */
3
+ export type WorkflowElement = {
4
+ id: string;
5
+ type: string;
6
+ label: string;
7
+ };
2
8
  export type WorkflowContextValue = {
3
9
  direction: 'horizontal' | 'vertical';
4
10
  nodeDefinitions?: InteractionCallback[];
5
11
  previewData: Record<string, ElementInteraction['preview']>;
6
12
  dataSource: Record<string, Source['meta']>;
7
13
  dataSourceContent: Record<string, SourceField[]>;
14
+ /** The space's elements, for a param that picks some of them. */
15
+ elements: WorkflowElement[];
8
16
  addNode: (nodeType: ElementInteraction['type'], siblingNodeId?: string, flowId?: string) => void;
9
17
  updateNode: (node: ElementInteraction) => void;
10
18
  removeNode: (nodeId: string) => void;
@@ -1,3 +1,4 @@
1
+ import { WorkflowElement } from './WorkflowContext';
1
2
  import { ElementInteraction, InteractionCallback, Source } from '@plitzi/sdk-shared';
2
3
  import { ReactNode } from 'react';
3
4
  export type WorkflowContextProviderProps = {
@@ -5,11 +6,12 @@ export type WorkflowContextProviderProps = {
5
6
  nodes: Record<string, ElementInteraction>;
6
7
  direction: 'horizontal' | 'vertical';
7
8
  dataSource?: Record<string, Source['meta']>;
9
+ elements?: WorkflowElement[];
8
10
  nodeDefinitions?: InteractionCallback[];
9
11
  /** Default action for a new trigger, when the flow kind has an obvious one. */
10
12
  defaultTrigger?: string;
11
13
  onChange: (nodes: Record<string, ElementInteraction>, debounced?: boolean) => void;
12
14
  setFlowId: (flowId: string) => void;
13
15
  };
14
- declare const WorkflowContextProvider: ({ children, nodes, direction, dataSource, nodeDefinitions, defaultTrigger, setFlowId, onChange }: WorkflowContextProviderProps) => import("react").JSX.Element;
16
+ declare const WorkflowContextProvider: ({ children, nodes, direction, dataSource, elements, nodeDefinitions, defaultTrigger, setFlowId, onChange }: WorkflowContextProviderProps) => import("react").JSX.Element;
15
17
  export default WorkflowContextProvider;
@@ -5,8 +5,10 @@ export type NodeBodyParamProps = {
5
5
  nodeId?: string;
6
6
  id: keyof ElementInteraction;
7
7
  label?: string;
8
- value?: string | boolean | number;
8
+ value?: string | boolean | number | string[];
9
9
  type?: InteractionParamType | ((params: Record<string, unknown>) => InteractionParamType);
10
+ /** For an `elements` param: the element type offered. */
11
+ elementType?: string;
10
12
  options?: Option[] | ((params: Record<string, unknown>) => Option[]);
11
13
  canBind?: boolean;
12
14
  params?: Record<string, unknown>;
@@ -16,7 +18,7 @@ export type NodeBodyParamProps = {
16
18
  placeholder: string;
17
19
  group: string;
18
20
  }>;
19
- onChange?: (id: keyof ElementInteraction, value: string | boolean | number) => void;
21
+ onChange?: (id: keyof ElementInteraction, value: string | boolean | number | string[]) => void;
20
22
  };
21
- declare const NodeBodyParam: ({ className, nodeId, id, label, value, type: typeProp, options: optionsProp, canBind, params, fields, onChange }: NodeBodyParamProps) => import("react").JSX.Element;
23
+ declare const NodeBodyParam: ({ className, nodeId, id, label, value, type: typeProp, options: optionsProp, elementType, canBind, params, fields, onChange }: NodeBodyParamProps) => import("react").JSX.Element;
22
24
  export default NodeBodyParam;
@@ -0,0 +1,7 @@
1
+ import { PickedElement } from '../helpers/elementOptions';
2
+ export type ParamElementChipProps = {
3
+ element: PickedElement;
4
+ onRemove: (id: string) => void;
5
+ };
6
+ declare const ParamElementChip: ({ element, onRemove }: ParamElementChipProps) => import("react").JSX.Element;
7
+ export default ParamElementChip;
@@ -0,0 +1,12 @@
1
+ import { ElementInteraction } from '@plitzi/sdk-shared';
2
+ export type ParamElementsProps = {
3
+ id: keyof ElementInteraction;
4
+ label: string;
5
+ value?: unknown;
6
+ /** Only elements of this type are offered; every element without one. */
7
+ elementType?: string;
8
+ onChange?: (id: keyof ElementInteraction, value: string[]) => void;
9
+ };
10
+ /** Several elements of the space, picked one at a time and stored as their ids. */
11
+ declare const ParamElements: ({ id, label, value, elementType, onChange }: ParamElementsProps) => import("react").JSX.Element;
12
+ export default ParamElements;
@@ -0,0 +1,18 @@
1
+ import { WorkflowElement } from '../WorkflowContext';
2
+ import { Element } from '@plitzi/sdk-shared';
3
+ /** The space's elements as the picker lists them, sorted by id — which is also the name an author gave them. */
4
+ export declare const toWorkflowElements: (flat: Record<string, Element> | undefined) => WorkflowElement[];
5
+ export type PickedElement = {
6
+ id: string;
7
+ label: string;
8
+ missing: boolean;
9
+ };
10
+ /** What is picked, in the order it was picked; an id no element answers to any more is kept and flagged. */
11
+ export declare const pickedElements: (ids: readonly string[], elements: readonly WorkflowElement[]) => PickedElement[];
12
+ /** What can still be picked: elements of the type the param asks for, minus the ones already picked. */
13
+ export declare const pickableOptions: (elements: readonly WorkflowElement[], elementType: string | undefined, picked: readonly string[]) => {
14
+ value: string;
15
+ label: string;
16
+ }[];
17
+ /** A stored value read as a list of ids — anything else is nothing picked yet. */
18
+ export declare const toIdList: (value: unknown) => string[];
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@plitzi/plitzi-builder",
3
- "version": "0.35.10",
3
+ "version": "0.36.1",
4
4
  "homepage": "./",
5
5
  "license": "AGPL-3.0",
6
6
  "files": [
@@ -28,7 +28,7 @@ declare const _default: {
28
28
  "dependencies": {
29
29
  "@apollo/client": "^4.3.0",
30
30
  "@fortawesome/fontawesome-free": "^7.3.1",
31
- "@plitzi/nexus": "^1.1.4",
31
+ "@plitzi/nexus": "^1.2.0",
32
32
  "@plitzi/plitzi-sdk": "workspace:*",
33
33
  "@plitzi/plitzi-ui": "^1.6.21",
34
34
  "@plitzi/sdk-auth": "workspace:*",