@lowdefy/docs-content 6.1.0 → 7.0.0

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 (285) hide show
  1. package/README.md +1 -0
  2. package/content/actions/downloadcsv.md +1 -1
  3. package/content/actions/emailotpsend.md +58 -0
  4. package/content/actions/emailotpverify.md +79 -0
  5. package/content/actions/getlocalstorage.md +43 -0
  6. package/content/actions/link.md +47 -1
  7. package/content/actions/login.md +25 -5
  8. package/content/actions/logout.md +7 -5
  9. package/content/actions/magiclinkverify.md +117 -0
  10. package/content/actions/pdfmake.md +2 -2
  11. package/content/actions/posthogalias.md +29 -0
  12. package/content/actions/posthogcapture.md +49 -0
  13. package/content/actions/posthogcapturepageleave.md +38 -0
  14. package/content/actions/posthogfeatureflag.md +50 -0
  15. package/content/actions/posthoggroup.md +37 -0
  16. package/content/actions/posthogidentify.md +54 -0
  17. package/content/actions/posthoginit.md +96 -0
  18. package/content/actions/posthogoptin.md +29 -0
  19. package/content/actions/posthogoptout.md +29 -0
  20. package/content/actions/posthogpageview.md +37 -0
  21. package/content/actions/posthogreloadfeatureflags.md +47 -0
  22. package/content/actions/posthogreset.md +28 -0
  23. package/content/actions/posthogsetpersonproperties.md +36 -0
  24. package/content/actions/removelocalstorage.md +28 -0
  25. package/content/actions/resetvalidation.md +5 -3
  26. package/content/actions/setdarkmode.md +3 -3
  27. package/content/actions/setglobal.md +2 -0
  28. package/content/actions/setlocale.md +1 -1
  29. package/content/actions/setlocalstorage.md +34 -0
  30. package/content/actions/setstate.md +2 -0
  31. package/content/actions/validate.md +7 -4
  32. package/content/adapter-reference/mongodbauthadapter.md +46 -0
  33. package/content/agents/agent-endpoint-tools.md +24 -0
  34. package/content/agents/agent-properties.md +13 -3
  35. package/content/agents/agent-server-hooks.md +1 -1
  36. package/content/agents/agentchat.md +43 -7
  37. package/content/agents/agentconversations.md +42 -8
  38. package/content/agents/agents-introduction.md +107 -0
  39. package/content/callback-reference/auth0logoutcallback.md +54 -0
  40. package/content/concepts/ai-agent-docs.md +455 -106
  41. package/content/concepts/blocks.md +150 -0
  42. package/content/concepts/connections-and-requests.md +402 -0
  43. package/content/concepts/custom-html.md +42 -0
  44. package/content/concepts/custom-styling.md +50 -5
  45. package/content/concepts/dynamic-page-content.md +309 -0
  46. package/content/concepts/events-and-actions.md +154 -2
  47. package/content/concepts/four-primitives.md +31 -0
  48. package/content/concepts/html-attributes.md +293 -0
  49. package/content/concepts/i18n.md +8 -3
  50. package/content/concepts/keyboard-shortcuts.md +2 -2
  51. package/content/concepts/layout-overview.md +1 -1
  52. package/content/concepts/logger.md +99 -0
  53. package/content/concepts/lowdefy-api.md +1319 -0
  54. package/content/concepts/lowdefy-schema.md +136 -3
  55. package/content/concepts/menus.md +8 -7
  56. package/content/concepts/module-authoring.md +76 -5
  57. package/content/concepts/modules.md +3 -1
  58. package/content/concepts/notifications.md +180 -0
  59. package/content/concepts/operators.md +7 -0
  60. package/content/concepts/page-and-app-state.md +252 -0
  61. package/content/concepts/page-paths.md +209 -0
  62. package/content/concepts/theming.md +582 -0
  63. package/content/connections/aigateway.md +375 -0
  64. package/content/connections/anthropic.md +169 -2
  65. package/content/connections/awss3.md +178 -2
  66. package/content/connections/axioshttp.md +181 -0
  67. package/content/connections/google.md +169 -2
  68. package/content/connections/mongodb.md +1014 -3
  69. package/content/connections/openai-connection.md +169 -2
  70. package/content/connections/sendgridmail.md +2 -0
  71. package/content/connections/smtp.md +3 -1
  72. package/content/connections/treg.md +329 -0
  73. package/content/container-blocks/affix.md +47 -7
  74. package/content/container-blocks/alert.md +76 -24
  75. package/content/container-blocks/badge.md +100 -24
  76. package/content/container-blocks/box.md +9 -9
  77. package/content/container-blocks/card.md +132 -27
  78. package/content/container-blocks/carousel.md +60 -7
  79. package/content/container-blocks/collapse.md +153 -9
  80. package/content/container-blocks/configprovider.md +35 -13
  81. package/content/container-blocks/confirmmodal.md +69 -23
  82. package/content/container-blocks/content.md +62 -98
  83. package/content/container-blocks/descriptions.md +45 -4
  84. package/content/container-blocks/drawer.md +139 -28
  85. package/content/container-blocks/dropdownmenu.md +119 -31
  86. package/content/container-blocks/flex.md +40 -62
  87. package/content/container-blocks/footer.md +15 -11
  88. package/content/container-blocks/googlemapsheatmap.md +1 -1
  89. package/content/container-blocks/googlemapsscript.md +2 -2
  90. package/content/container-blocks/header.md +71 -36
  91. package/content/container-blocks/label.md +34 -7
  92. package/content/container-blocks/layout.md +52 -34
  93. package/content/container-blocks/masonry.md +17 -71
  94. package/content/container-blocks/mobilemenu.md +131 -88
  95. package/content/container-blocks/modal.md +161 -26
  96. package/content/container-blocks/pageheadermenu.md +138 -31
  97. package/content/container-blocks/pagesidebarlayout.md +230 -27
  98. package/content/container-blocks/pagesidermenu.md +153 -43
  99. package/content/container-blocks/popover.md +34 -31
  100. package/content/container-blocks/result.md +32 -21
  101. package/content/container-blocks/sider.md +85 -122
  102. package/content/container-blocks/span.md +7 -7
  103. package/content/container-blocks/spinner.md +3 -3
  104. package/content/container-blocks/splitter.md +150 -68
  105. package/content/container-blocks/tabs.md +64 -12
  106. package/content/container-blocks/tooltip.md +22 -46
  107. package/content/container-blocks/watermark.md +22 -4
  108. package/content/controls/parallel_for.md +21 -2
  109. package/content/controls/reject.md +24 -3
  110. package/content/controls/return.md +17 -1
  111. package/content/controls/throw.md +1 -0
  112. package/content/controls/try.md +4 -2
  113. package/content/controls/while.md +46 -0
  114. package/content/deployment/deployment-environments.md +10 -7
  115. package/content/deployment/docker.md +22 -7
  116. package/content/deployment/node-server.md +4 -0
  117. package/content/deployment/vercel.md +17 -6
  118. package/content/display-blocks/aggrid.md +33 -16
  119. package/content/display-blocks/anchor.md +16 -15
  120. package/content/display-blocks/avatar.md +57 -37
  121. package/content/display-blocks/breadcrumb.md +70 -21
  122. package/content/display-blocks/button.md +93 -19
  123. package/content/display-blocks/calendar.md +12 -0
  124. package/content/display-blocks/clickablehtml.md +239 -0
  125. package/content/display-blocks/dangeroushtml.md +1 -1
  126. package/content/display-blocks/difflist.md +1 -1
  127. package/content/display-blocks/difftimeline.md +1 -1
  128. package/content/display-blocks/divider.md +64 -3
  129. package/content/display-blocks/dropdownbutton.md +81 -30
  130. package/content/display-blocks/echart.md +35 -1
  131. package/content/display-blocks/eventlog.md +363 -0
  132. package/content/display-blocks/floatbutton.md +129 -42
  133. package/content/display-blocks/html.md +61 -1
  134. package/content/display-blocks/icon.md +250 -67
  135. package/content/display-blocks/img.md +2 -2
  136. package/content/display-blocks/menu.md +146 -73
  137. package/content/display-blocks/message.md +38 -124
  138. package/content/display-blocks/notification.md +94 -222
  139. package/content/display-blocks/paragraph.md +59 -9
  140. package/content/display-blocks/pollingtimer.md +263 -0
  141. package/content/display-blocks/progress.md +96 -17
  142. package/content/display-blocks/qrcode.md +19 -4
  143. package/content/display-blocks/s3download.md +1 -1
  144. package/content/display-blocks/search.md +19 -9
  145. package/content/display-blocks/skeletonbutton.md +1 -0
  146. package/content/display-blocks/skeletoninput.md +1 -0
  147. package/content/display-blocks/statistic.md +75 -17
  148. package/content/display-blocks/steps.md +58 -25
  149. package/content/display-blocks/table.md +2527 -0
  150. package/content/display-blocks/tablelight.md +621 -0
  151. package/content/display-blocks/tag.md +102 -17
  152. package/content/display-blocks/title.md +50 -11
  153. package/content/display-blocks/tour.md +33 -23
  154. package/content/input-blocks/autocomplete.md +81 -9
  155. package/content/input-blocks/buttonselector.md +45 -8
  156. package/content/input-blocks/captcha.md +40 -0
  157. package/content/input-blocks/checkboxselector.md +97 -7
  158. package/content/input-blocks/checkboxswitch.md +33 -3
  159. package/content/input-blocks/colorselector.md +63 -14
  160. package/content/input-blocks/daterangeselector.md +165 -45
  161. package/content/input-blocks/dateselector.md +139 -41
  162. package/content/input-blocks/datetimeselector.md +158 -49
  163. package/content/input-blocks/inputgallery.md +3 -3
  164. package/content/input-blocks/intentinput.md +207 -0
  165. package/content/input-blocks/monthselector.md +120 -52
  166. package/content/input-blocks/multipleselector.md +150 -39
  167. package/content/input-blocks/numberinput.md +98 -12
  168. package/content/input-blocks/pagination.md +70 -14
  169. package/content/input-blocks/paragraphinput.md +51 -37
  170. package/content/input-blocks/passwordinput.md +60 -6
  171. package/content/input-blocks/phonenumberinput.md +59 -26
  172. package/content/input-blocks/placesautocomplete.md +319 -0
  173. package/content/input-blocks/radioselector.md +83 -7
  174. package/content/input-blocks/ratingslider.md +57 -26
  175. package/content/input-blocks/s3uploadbutton.md +24 -24
  176. package/content/input-blocks/s3uploaddragger.md +3 -3
  177. package/content/input-blocks/s3uploadphoto.md +5 -5
  178. package/content/input-blocks/segmentedselector.md +72 -32
  179. package/content/input-blocks/selector.md +109 -21
  180. package/content/input-blocks/switch.md +65 -17
  181. package/content/input-blocks/tableinput.md +445 -0
  182. package/content/input-blocks/tagmultipleselector.md +114 -0
  183. package/content/input-blocks/tagselector.md +114 -0
  184. package/content/input-blocks/textarea.md +32 -3
  185. package/content/input-blocks/textinput.md +70 -29
  186. package/content/input-blocks/tiptapinput.md +1 -1
  187. package/content/input-blocks/tiptapmentioninput.md +2 -2
  188. package/content/input-blocks/titleinput.md +39 -12
  189. package/content/input-blocks/treeinput.md +49 -25
  190. package/content/input-blocks/treemultipleselector.md +127 -10
  191. package/content/input-blocks/treeselector.md +97 -9
  192. package/content/input-blocks/upload.md +64 -15
  193. package/content/input-blocks/uploaddragger.md +17 -1
  194. package/content/input-blocks/uploadphoto.md +18 -1
  195. package/content/input-blocks/weekselector.md +120 -55
  196. package/content/learn/introduction.md +27 -0
  197. package/content/learn/quickstart.md +53 -0
  198. package/content/learn/showcase.md +8 -0
  199. package/content/list-blocks/controlledlist.md +24 -15
  200. package/content/list-blocks/list.md +11 -11
  201. package/content/list-blocks/masonrylist.md +7 -34
  202. package/content/migration/auth-upgrade.md +337 -0
  203. package/content/migration/upgrade-guide.md +1 -0
  204. package/content/migration/v3-to-v4.md +417 -0
  205. package/content/migration/v6-to-v7.md +620 -0
  206. package/content/operators/_agent.md +155 -0
  207. package/content/operators/_app.md +2 -1
  208. package/content/operators/_array.md +122 -1
  209. package/content/operators/_build.md +1 -0
  210. package/content/operators/_credential.md +57 -0
  211. package/content/operators/_cron.md +292 -0
  212. package/content/operators/_date.md +2 -0
  213. package/content/operators/_error.md +24 -1
  214. package/content/operators/_get.md +6 -6
  215. package/content/operators/_hmac.md +78 -0
  216. package/content/operators/_js.md +2 -1
  217. package/content/operators/_location.md +1 -1
  218. package/content/operators/_media.md +13 -0
  219. package/content/operators/_module.md +56 -2
  220. package/content/operators/_operator.md +17 -3
  221. package/content/operators/_path_params.md +82 -0
  222. package/content/operators/_ref.md +258 -0
  223. package/content/operators/_request.md +1 -1
  224. package/content/operators/_request_details.md +6 -0
  225. package/content/operators/_type.md +14 -3
  226. package/content/operators/_url_query.md +2 -0
  227. package/content/operators/_user.md +3 -3
  228. package/content/plugins/plugins-actions.md +10 -0
  229. package/content/plugins/plugins-connections.md +25 -0
  230. package/content/plugins/plugins-dev.md +66 -0
  231. package/content/plugins/plugins-icon-sets.md +267 -0
  232. package/content/plugins/plugins-introduction.md +27 -1
  233. package/content/plugins/plugins.md +19 -0
  234. package/content/plugins/posthog.md +359 -0
  235. package/content/provider-reference/auth-js-providers.md +107 -0
  236. package/content/provider-reference/openidconnectprovider.md +44 -0
  237. package/content/recipes/recipes.md +16 -0
  238. package/content/reference/actions-reference.md +31 -0
  239. package/content/reference/blocks-reference.md +35 -0
  240. package/content/reference/cli.md +403 -0
  241. package/content/reference/connections-reference.md +23 -0
  242. package/content/reference/operators-reference.md +47 -0
  243. package/content/reference/reference.md +16 -0
  244. package/content/reference/schema-reference.md +12 -0
  245. package/content/testing/config-tests.md +677 -0
  246. package/content/testing/e2e-configuration.md +31 -1
  247. package/content/testing/e2e-getting-started.md +1 -1
  248. package/content/testing/e2e-introduction.md +1 -1
  249. package/content/testing/e2e-writing-tests.md +12 -1
  250. package/content/testing/explore-pull-request.md +136 -0
  251. package/content/testing/journey-data-sets.md +326 -0
  252. package/content/tutorial/tutorial-actions-operators.md +2 -2
  253. package/content/tutorial/tutorial-add-blocks.md +2 -2
  254. package/content/tutorial/tutorial-create-page.md +48 -2
  255. package/content/tutorial/tutorial-display-data-page.md +3 -3
  256. package/content/tutorial/tutorial-requests-api.md +155 -0
  257. package/content/tutorial/tutorial-requests-sql.md +153 -0
  258. package/content/tutorial/tutorial-start.md +66 -1
  259. package/content/user-authentication/auth-configuration.md +267 -0
  260. package/content/user-authentication/auth-providers.md +24 -0
  261. package/content/user-authentication/auth-steps.md +141 -0
  262. package/content/user-authentication/login-and-logout.md +160 -8
  263. package/content/user-authentication/mcp-oauth.md +424 -0
  264. package/content/user-authentication/organizations.md +246 -0
  265. package/content/user-authentication/protected-pages-apis.md +97 -0
  266. package/content/user-authentication/roles.md +49 -0
  267. package/content/user-authentication/two-factor.md +229 -0
  268. package/content/user-authentication/user-object.md +58 -0
  269. package/content/user-authentication/users-introduction.md +8 -0
  270. package/content/websockets/websocket-publish.md +105 -0
  271. package/content/websockets/websocket-subscriptions.md +136 -0
  272. package/content/websockets/websockets-introduction.md +101 -0
  273. package/hazards.json +56 -0
  274. package/index.json +3458 -14
  275. package/package.json +10 -1
  276. package/scripts/extractAgentDocs.js +41 -30
  277. package/scripts/hashDocSources.js +38 -0
  278. package/scripts/isRedirectPage.js +26 -0
  279. package/scripts/recordSourceHashes.js +97 -0
  280. package/scripts/resolvePageSections.js +42 -0
  281. package/scripts/sectionKind.js +27 -0
  282. package/content/concepts/cli.md +0 -223
  283. package/content/other/introduction.md +0 -39
  284. package/content/other/next-auth-providers.md +0 -3
  285. /package/content/{other → actions}/updatesession.md +0 -0
@@ -11,6 +11,8 @@ The OpenAI connection connects to the [OpenAI API](https://platform.openai.com/d
11
11
  #### Properties
12
12
  - `apiKey: string`: __Required__ - OpenAI API key. Use [`_secret`](/_secret) to reference this securely.
13
13
  - `baseURL: string`: Optional base URL. Use this to connect to Azure OpenAI or any OpenAI-compatible endpoint.
14
+ - `maxOutputTokens: number`: Default maximum number of tokens a model call generates, for the requests and agents on this connection that do not set their own.
15
+ - `timeout: number`: Default milliseconds a model call may take, retries included, before it is cancelled, for the requests and agents on this connection that do not set their own. See _Limits and cancellation_ below.
14
16
 
15
17
  ###### Connection example:
16
18
  ```yaml
@@ -87,11 +89,32 @@ Request types:
87
89
 
88
90
  - GenerateText
89
91
  - GenerateObject
92
+ - Decide
90
93
 
91
- All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText` and `GenerateObject` request types — the `connectionId` selects the provider. These make a single, one-shot model call and return the result. They can be used as page requests, or as steps in [API endpoint routines](/api) — useful for classify, extract, summarize, or decide steps where the surrounding logic stays in your routine.
94
+ All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText`, `GenerateObject` and `Decide` request types — the `connectionId` selects the provider. These make a single, one-shot model call and return the result. They can be used as page requests, or as steps in [API endpoint routines](/api) — useful for classify, extract, summarize, or decide steps where the surrounding logic stays in your routine. For a closed-vocabulary decision — pick one of these options, yes or no, rate on this scale — use `Decide`.
92
95
 
93
96
  For multi-step tool use, see [agents](/agents-introduction) instead.
94
97
 
98
+ ### Limits and cancellation
99
+
100
+ Two limits bound every AI request. Set them on the request, or on the connection as the default for every request and agent that uses it:
101
+
102
+ - `maxOutputTokens` caps the tokens one call generates. Without it, the provider's default applies.
103
+ - `timeout` cancels a call, retries included, that runs longer than this many milliseconds. The request fails with a `ServiceError`.
104
+
105
+ A call is also cancelled when the request that started it closes, so a provider call that nobody is waiting for stops instead of running, and billing, to its end:
106
+
107
+ - A page request, or an API endpoint called over HTTP, is cancelled when the server's request timeout (`config.requestTimeout`, default 30 seconds) answers first, which fails it with a `ServiceError`. On the Node server it is also cancelled when the client disconnects; that is logged as a warning, not an error.
108
+ - On [Vercel](/vercel), only the request timeout cancels a call: a client disconnect does not, and the call runs until it finishes, times out, or the function reaches `config.vercel.maxDuration`. Keep `config.requestTimeout` below `maxDuration`, or Vercel stops the function before the timeout can cancel anything (the build warns when it is not).
109
+ - Endpoints with `async: true`, `detached: true` calls, and scheduled runs answer at once and then run to their end: the closing request does not cancel them.
110
+ - An agent chat turn runs to its end after the client disconnects, so its `onFinish` hooks still save the conversation. Bound it with the agent's `timeout` and `maxSteps`. A `CallAgent` step is cancelled with the routine that runs it.
111
+
112
+ ### Files in messages
113
+
114
+ A file part in `messages` (`{ type: 'file', data: <link>, mediaType }`) goes to the model as a link when the provider takes that media type as a link (the main providers do for images and PDFs). Any other file, such as a CSV or text file, is downloaded by the server and sent as content, within the request's `fileDownload` limits. The server downloads only an `https:` link to a public address, checking the address on every redirect, and a failed download names the file's host, never its link, so a signed link stays out of the server log. `Decide` takes no files.
115
+
116
+ When a provider rate-limits a call (HTTP 429), the model client retries it (`maxRetries`), waiting as long as the provider's `Retry-After` asks, up to a minute. If the retries run out, the request fails with a `ServiceError`, as a 429 does on every connection, and the server log records the `Retry-After` value.
117
+
95
118
  ### GenerateText
96
119
 
97
120
  Generates text from a prompt.
@@ -102,7 +125,12 @@ Generates text from a prompt.
102
125
  - `prompt: string`: Text prompt. Use either `prompt` or `messages`, not both.
103
126
  - `messages: object[]`: Model messages (`{ role, content }`). Use either `prompt` or `messages`, not both.
104
127
  - `system: string`: System prompt.
105
- - `maxOutputTokens: number`: Maximum number of tokens to generate.
128
+ - `allowSystemInMessages: boolean`: Default: `false` - Allow `system` role messages in `messages`. A system message instructs the model as the app itself, so without this a request whose `messages` include one fails. Only set it when the messages come from the app, never from a user (for example a message list built from `_payload`). Use `system` for the system prompt.
129
+ - `maxOutputTokens: number`: Maximum number of tokens to generate. Defaults to the connection's `maxOutputTokens`.
130
+ - `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
131
+ - `fileDownload: object`: Limits on a file in `messages` the server downloads (see [Files in messages](#files-in-messages)).
132
+ - `maxBytes: integer`: Default: `20971520` (20 MB) - Largest file the server downloads. A larger file fails the request.
133
+ - `timeout: integer`: Default: `30000` - Milliseconds a file download may take.
106
134
  - `temperature: number`: Sampling temperature (0 to 2).
107
135
  - `topP: number`: Nucleus sampling.
108
136
  - `topK: number`: Only sample from the top K options for each subsequent token.
@@ -226,3 +254,142 @@ api:
226
254
  category:
227
255
  _step: classify.object.category
228
256
  ```
257
+
258
+ ### Decide
259
+
260
+ Makes typed decisions about a piece of state: pick one of a set of options, judge a statement true or false, or place something on an ordered scale. Every answer comes back in the shape you declared, with a confidence, so a routine can branch on it — and send a low-confidence answer to a person instead.
261
+
262
+ The build knows every option, so a routine branch that compares an answer with a name that is not one of its options — `_eq: [{ _step: triage.team.choice }, bil-ling]` — fails the build rather than silently never matching. A `_step` reference to a question the step does not ask, or to a field its answer does not have, fails the build the same way.
263
+
264
+ `Decide` has two backends behind the same interface:
265
+
266
+ - `evaluation` — an evaluation model, such as TypeSafe's Jev (`typesafe-ai/jev`) on the [AI Gateway](/AIGateway). It returns a probability for every option in one pass, in under a second, and bills input tokens only. The default, and only available, on the `AIGateway` connection.
267
+ - `structured-output` — any language model, asked for the answers as structured output that follows a schema of the questions. Providers do not all enforce the schema, so Lowdefy checks each answer against its question (see `null` answers below). Available on every AI connection, and the default on `Anthropic`, `OpenAI` and `Google`. Its confidence is the model's own estimate, not a calibrated probability.
268
+
269
+ Keep the state to what the questions need: an evaluation model reads the state literally, and accuracy drops as it grows. A `Decide` is never a security boundary — text in the state can argue for its own answer.
270
+
271
+ #### Properties
272
+
273
+ - `model: string`: **Required** - Model id to decide with, e.g. `typesafe-ai/jev`. Pin a version wherever a confidence threshold is tuned — a `latest` alias changes answers on release.
274
+ - `state: string | object | array`: **Required** - What the questions are about.
275
+ - `questions: object`: **Required** - Named questions, answered together against the state. Each question id becomes a key of the response (`usage` is reserved). A question is one of:
276
+ - `{ choice: string, options: object }` - Pick exactly one option. `options` maps option names (2 to 255) to what each one means (`null` for no description), or to an object with a `description` — its other keys are ignored, so one file can describe the options for `Decide` and for an [`IntentInput`](/IntentInput) block.
277
+ - `{ yesno: string, criteria?: { yes: string, no: string } }` - Judge a statement true or false. `criteria` optionally says what counts as yes and as no.
278
+ - `{ score: string, levels: string[] }` - Place the state on 2 to 10 ordered levels, lowest first.
279
+ - `backend: enum`: `evaluation` or `structured-output`. Defaults to `evaluation` on `AIGateway` and `structured-output` elsewhere.
280
+ - `maxOutputTokens: number`: Maximum number of tokens to generate, on the `structured-output` backend (an evaluation model generates no text). Defaults to the connection's `maxOutputTokens`.
281
+ - `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
282
+ - `maxRetries: number`: Maximum number of retries. Defaults to 2.
283
+ - `providerOptions: object`: Provider-specific options, keyed by provider (e.g. `gateway: { zeroDataRetention: true }`).
284
+
285
+ #### Response
286
+
287
+ One key per question, plus `usage`:
288
+
289
+ ```yaml
290
+ <choice question>:
291
+ choice: string # The chosen option.
292
+ confidence: number # 0 to 1.
293
+ probabilities: object # Probability per option (evaluation backend), else null.
294
+ <yesno question>:
295
+ answer: boolean # true when the statement holds.
296
+ probability: number # Probability that it holds.
297
+ confidence: number # Probability of the given answer.
298
+ <score question>:
299
+ level: string # The most likely level.
300
+ index: number # Its position, from 0.
301
+ score: number # Fractional position on the scale (evaluation backend).
302
+ confidence: number # 0 to 1.
303
+ probabilities: object # Probability per level (evaluation backend), else null.
304
+ usage: object # Token usage ({ inputTokens, outputTokens, totalTokens }).
305
+ ```
306
+
307
+ An answer outside its question's terms (an option or level the question does not have, a yes/no that is not true or false, or no answer at all) comes back with every field `null`, its confidence included. `_lt` compares `null` below any number, so a confidence gate such as `_lt: [{ _step: triage.team.confidence }, 0.7]` holds it back like a low-confidence answer, and a branch on the choice matches none of the options.
308
+
309
+ #### Examples
310
+
311
+ ###### Route a support ticket, and queue uncertain ones for a person:
312
+
313
+ ```yaml
314
+ api:
315
+ - id: triage-ticket
316
+ type: Api
317
+ routine:
318
+ - id: triage
319
+ type: Decide
320
+ connectionId: gateway
321
+ properties:
322
+ model: typesafe-ai/jev
323
+ state:
324
+ subject:
325
+ _payload: subject
326
+ body:
327
+ _payload: body
328
+ questions:
329
+ team:
330
+ choice: Which team handles this ticket
331
+ options:
332
+ billing: Invoices, charges and refunds
333
+ tech: Outages and bugs
334
+ sales: Plans and quotes
335
+ down:
336
+ yesno: The customer says the service is down
337
+ providerOptions:
338
+ gateway:
339
+ zeroDataRetention: true
340
+ - ':if':
341
+ _lt:
342
+ - _step: triage.team.confidence
343
+ - 0.7
344
+ ':then':
345
+ - id: queue_review
346
+ type: MongoDBInsertOne
347
+ connectionId: review_queue
348
+ properties:
349
+ doc:
350
+ subject:
351
+ _payload: subject
352
+ suggested_team:
353
+ _step: triage.team.choice
354
+ - ':return':
355
+ status: review
356
+ - ':if':
357
+ _eq:
358
+ - _step: triage.team.choice
359
+ - billing
360
+ ':then':
361
+ - id: open_billing_case
362
+ type: CallApi
363
+ properties:
364
+ endpointId: open-billing-case
365
+ - ':return':
366
+ team:
367
+ _step: triage.team.choice
368
+ urgent:
369
+ _step: triage.down.answer
370
+ ```
371
+
372
+ ###### The same decision with any language model:
373
+
374
+ ```yaml
375
+ requests:
376
+ - id: rate_review
377
+ type: Decide
378
+ connectionId: claude
379
+ payload:
380
+ review:
381
+ _state: review_text
382
+ properties:
383
+ model: claude-haiku-4-5
384
+ state:
385
+ _payload: review
386
+ questions:
387
+ sentiment:
388
+ score: How positive is this review
389
+ levels:
390
+ - Very negative
391
+ - Negative
392
+ - Neutral
393
+ - Positive
394
+ - Very positive
395
+ ```
@@ -43,6 +43,8 @@ Request types:
43
43
  - `regex: string`: A regular expression. Only recipient addresses matching the pattern are sent to.
44
44
  When the connection sets no `filter`, or every field of it resolves to `null`, the current environment's `email.filter` from [`config.environments`](/lowdefy-schema) applies instead. A connection's own `filter` wins when it sets at least one field, and `filter: false` turns filtering off entirely, the environment's too. With `email.enabled: false` on the current environment, mail requests send nothing and report each message as `{ disabled: true }`.
45
45
 
46
+ Addresses on the reserved `.invalid` domain, which never resolves (RFC 6761), are always dropped from `to`, `cc` and `bcc` before the filter runs, in every environment, with no filter and with `filter: false` too. Case, surrounding spaces and a trailing dot are ignored. SendGrid reads a string recipient as one address, so a comma-separated string is dropped only when every address in it is on `.invalid`. Only those addresses are dropped: when every `to` recipient is on `.invalid`, the remaining `cc` and `bcc` recipients each get their own copy, addressed to them, since SendGrid needs a `to` recipient. When no recipient is left, the message is not sent and reports `{ messageId: null, to: null, filtered: true }`. So test users with addresses such as `user@audit.invalid` never reach a `replaceAddress` catch-all. Use `.invalid` for test users that must never receive mail, and `example.com` or `.test` for journey users whose mail a journey reads.
47
+
46
48
  ### SendGridMailSend
47
49
 
48
50
  #### Properties
@@ -75,7 +75,9 @@ The connection's `filter` is applied to every message before it is sent — from
75
75
  - `allowlist: string[]`: A list of domains. Only recipients whose domain is in the list are sent to; others are dropped. When every `to` recipient is filtered out, the message is not sent.
76
76
  - `regex: string`: A regular expression. Only recipient addresses matching the pattern are sent to.
77
77
 
78
- When the connection sets no `filter`, or every field of it resolves to `null`, the current environment's `email.filter` from [`config.environments`](/lowdefy-schema) applies instead, so the per-environment rule lives in one place for every mail connection. A connection's own `filter` wins when it sets at least one field, and `filter: false` turns filtering off entirely — the environment's too — for mail that must reach its real recipient in every environment (an invite, say). Auth emails are never filtered. With `email.enabled: false` on the current environment, mail requests send nothing and report each message as `{ disabled: true }`.
78
+ Addresses on the reserved `.invalid` domain, which never resolves (RFC 6761), are always dropped from `to`, `cc` and `bcc` before the filter runs. This happens in every environment, with no filter and with `filter: false`, and for auth emails too. Case, surrounding spaces and a trailing dot are ignored, and each address in a comma-separated string is checked on its own. Only those addresses are dropped: when every `to` recipient is on `.invalid`, the remaining `cc` and `bcc` recipients still get the mail. When no recipient is left, the message is not sent and reports `{ messageId: null, to: null, filtered: true }`. So test users with addresses such as `user@audit.invalid` never reach a `replaceAddress` catch-all. Use `.invalid` for test users that must never receive mail, and `example.com` or `.test` for journey users whose mail a journey reads.
79
+
80
+ When the connection sets no `filter`, or every field of it resolves to `null`, the current environment's `email.filter` from [`config.environments`](/lowdefy-schema) applies instead, so the per-environment rule lives in one place for every mail connection. A connection's own `filter` wins when it sets at least one field, and `filter: false` turns filtering off entirely — the environment's too — for mail that must reach its real recipient in every environment (an invite, say). Auth emails (magic links, email codes, verification, password reset, invitations) send through the `auth.email` connection with only that connection's own `filter`: the environment's `email.filter` and `email.enabled` do not apply to them, so sign-in keeps working in every environment. To catch auth emails outside production, set a `filter` on the auth connection itself. With `email.enabled: false` on the current environment, mail requests send nothing and report each message as `{ disabled: true }`.
79
81
 
80
82
  ```yaml
81
83
  config:
@@ -0,0 +1,329 @@
1
+ # treg
2
+
3
+ [treg](https://treg.to) is an open-source catalog of external API endpoints (SEO and SERP data, people and company enrichment, social data, scraping, generation and more) behind one token. treg holds the provider credentials and bills each call from the team's prepaid balance, or runs it on the team's own provider key for free. Its routed endpoints, such as `treg.people.email.find`, try provider after provider for one job and answer with the first hit.
4
+
5
+ The `TregConnection` connection calls treg from server routines. It is a good provider backend for [enrichment tables](/Table): one connection gives every enrichment column access to the whole catalog, with an exact cost per call.
6
+
7
+ > Store the token with the [`_secret`](/_secret) operator. `TregCall` spends money, so call it from API endpoints, and bound it with `maxCost` and `idempotencyKey`.
8
+
9
+ ## Connections
10
+
11
+ Connection types:
12
+ - TregConnection
13
+
14
+ ## Requests
15
+
16
+ Request types:
17
+ - TregCall
18
+ - TregCatalogSearch
19
+ - TregCatalogGet
20
+ - TregBalance
21
+
22
+ ### TregConnection
23
+
24
+ #### Properties
25
+
26
+ - `token: string`: __Required__ - The treg token, sent as `X-Treg-Token`. Use a per-team token (`treg org agent-new <name>`, or a dashboard API key), which carries its team.
27
+ - `org: string`: The team slug, sent as `X-Treg-Org`. Only needed with a personal identity token (from `treg login`).
28
+ - `baseUrl: string`: Default: `https://treg.to` - The treg URL, for a self-hosted treg. An `https` URL, or `http` on `localhost`.
29
+ - `timeout: integer`: Default: `30000` - The time in milliseconds each HTTP call to treg may take.
30
+ - `maxCost: number`: The default spend ceiling per call in USD, sent as `X-Treg-Route-Max-Cost`. treg refuses a call whose reserve would exceed it and charges nothing. treg itself caps routed calls at $1 and direct calls not at all.
31
+ - `meta: object`: Default tags for every call, sent as `X-Treg-Meta`, for treg's per-tag usage reports and budgets. Up to 5 pairs; keys are lowercase letters, digits and `_`; values are letters, digits and `. _ - :`. Request `meta` is merged over it.
32
+ - `allowCustomTools: boolean`: Default: `false` - Allow `TregCall` to call the team's own registered tools with `tool` and `path`. Without it a request can only reach catalog and routed endpoints.
33
+
34
+ ### TregCall
35
+
36
+ Calls one treg endpoint by its id, `POST` (or `GET` without a body) to `/call/<endpoint>`.
37
+
38
+ `endpoint` must be a catalog or routed endpoint id, such as `treg.people.email.find`: lowercase letters, digits, `.`, `_` and `-`. The raw upstream-URL form (`/call/https://…`) is never accepted, because it would let config send any URL through the team's stored credentials. The team's own registered tools are called with `tool` and `path` instead, and only when the connection sets `allowCustomTools: true`.
39
+
40
+ #### Properties
41
+
42
+ - `endpoint: string`: The catalog or routed endpoint id to call. Find ids with `TregCatalogSearch`.
43
+ - `tool: string`: The name of one of the team's own tools, with `path`. Needs `allowCustomTools` on the connection.
44
+ - `path: string`: The path on the tool's API, such as `/v1/charges`. A path only: printable ASCII (also once percent-decoded) with no scheme, host, query, backslash, `.` or `..` segment, whitespace or control characters. A path the URL parser would change (it strips tabs and newlines and resolves `..`) is refused before anything is sent.
45
+ - `method: enum`: `GET`, `POST`, `PUT`, `PATCH` or `DELETE`. Defaults to `POST` when `body` is set, otherwise `GET`.
46
+ - `query: object`: Query parameters. An array value sends the parameter once per item.
47
+ - `body: any`: The JSON request body. A routed endpoint takes its inputs here.
48
+ - `idempotencyKey: string`: Sent as `Idempotency-Key`. A repeat of a call with the same key gets treg's stored answer and is not charged again (`replayed: true`, cost 0). treg keeps keys for 24 hours, frees the key of a failed call, and refuses a key reused for a different request with a 422. Use a new key for genuinely new work.
49
+ - `maxCost: number`: The spend ceiling for this call in USD, overriding the connection's `maxCost`. On a routed endpoint it bounds the whole waterfall.
50
+ - `maxAge: integer`: Only accept a cached answer younger than this many seconds (`X-Treg-Max-Age`).
51
+ - `noCache: boolean`: Force a live call instead of a cached answer (`Cache-Control: no-cache`).
52
+ - `waterfall: boolean`: Routed endpoints: `false` stops at the first provider that misses. treg falls through to the next provider by default.
53
+ - `strictFilters: boolean`: Routed endpoints: `true` refuses with a 422 (nothing charged) instead of answering from a provider that could not apply a filter.
54
+ - `meta: object`: Tags for this call, merged over the connection's `meta`.
55
+ - `await: object`: Wait for an async task. Without it, a task that is still running returns `pending: true`.
56
+ - `timeoutMs: integer`: Default: `60000` - How long to poll, from 100 to 900000.
57
+ - `intervalMs: integer`: The wait between polls. Defaults to the interval treg's descriptor names (at least 100), or 2000.
58
+
59
+ #### Response
60
+
61
+ ```yaml
62
+ output: # routed: the job's normalised answer; catalog: the provider body (without _treg)
63
+ email: ada@example.com
64
+ verified: false
65
+ raw: # routed: the serving provider's body; catalog: the provider body as it came
66
+ data: { … }
67
+ cost: # what treg charged, from X-Treg-Cost-Micro. 0 on the team's own key and on a replay.
68
+ micro: 4000
69
+ usd: 0.004
70
+ callId: call_8f2… # X-Treg-Call-Id: store it with the cost; treg support looks calls up by it
71
+ servedBy: hunter.people.email.find
72
+ tried: [ … ] # routed: every provider tried, with its outcome and charge
73
+ outcome: hit # routed: hit, weak, miss or pending; null for catalog endpoints
74
+ cached: false # answered from treg's cache (X-Treg-Cache: hit)
75
+ replayed: false # an idempotent replay of an earlier call
76
+ pending: false # an async task that is still running (only without await)
77
+ task: null # the async task: { id, status, pollEndpoint, reserved }
78
+ httpStatus: 200
79
+ ```
80
+
81
+ The cost is always what treg reports it charged, never the catalog estimate. An async task is charged only when it succeeds: while it is pending `cost` is 0 and `task.reserved` is the hold, and after `await` it is the reserve treg settles.
82
+
83
+ #### Async tasks
84
+
85
+ Generation endpoints, and routed endpoints whose provider is still working after treg's own 60 second wait, answer with a task and an `X-Treg-Async` poll descriptor. With `await`, `TregCall` polls the descriptor's catalog endpoint (`GET /call/<poll endpoint>?<param>=<task id>`, which is free) every `intervalMs` until the task's status is a success or failure value, and returns the terminal answer (the descriptor's result path, or the whole body). Transient poll failures are retried; five in a row end the wait.
86
+
87
+ - A failed task throws a final error; treg refunds its hold.
88
+ - A task still running at `timeoutMs` throws a retryable `ServiceError` naming the call id and task id. treg keeps a routed endpoint's pending answer, with its task, under the `Idempotency-Key`, so a retry with the same key replays it at no charge and resumes waiting for the same task instead of starting a new one.
89
+ - A descriptor that polls a dynamic URL is not followed.
90
+
91
+ ### TregCatalogSearch
92
+
93
+ Searches the catalog by what an endpoint does, `GET /catalog/search`. Returns treg's answer: `{ query, count, total, results, hints }`, each result with its `id`, provider, `cost` and measured reliability (`observed`).
94
+
95
+ #### Properties
96
+
97
+ - `q: string`: __Required__ - The job, in words, such as `find a work email`.
98
+ - `limit: integer`: The most results, 1 to 100. treg defaults to 25.
99
+
100
+ ### TregCatalogGet
101
+
102
+ One endpoint in full, `GET /catalog/endpoints/<endpoint>`: its parameters, cost, sibling providers for the same job with their price and reliability, and an example response.
103
+
104
+ #### Properties
105
+
106
+ - `endpoint: string`: __Required__ - The endpoint id.
107
+ - `access: boolean`: Also read how this team would be served and at what price, as `access`: `{ tier, detail, estimated_cost_micro, estimated_cost_usd }`. Use it for the `cost` of a provider in an enrichment catalogue.
108
+
109
+ ### TregBalance
110
+
111
+ The team's prepaid balance. Returns `{ orgId, org, balance: { micro, usd }, held: { micro, usd }, holds, entries }`: `held` is the spend reserved by calls in flight, and `entries` the recent ledger (listed to team admins only).
112
+
113
+ #### Properties
114
+
115
+ - `limit: integer`: Default: `20` - The ledger entries to return, 1 to 200.
116
+
117
+ ### Errors
118
+
119
+ `TregCall` sorts treg's answers into errors a routine can branch on with [`_error`](/_error): a `ServiceError` passes with time and can be retried; anything else is final, and retrying it would fail or cost the same again.
120
+
121
+ | Answer | Error | Retry |
122
+ | --- | --- | --- |
123
+ | 402 `insufficient_balance` | "treg balance too low: needs ~$X, has $Y." The top-up link is only in the server log. | No |
124
+ | 402 `route_max_cost` | The call would exceed `maxCost`. Nothing was charged. | No |
125
+ | 422 from treg | `ConfigError` with treg's explanation: malformed `meta`, an idempotency key reused for another request, a strict filter. | No |
126
+ | 429 | `ServiceError`, with `retryAfter` from `Retry-After`. | Yes |
127
+ | 503 `provider_capacity_unavailable` | `ServiceError`: treg's own provider account is out, nothing charged. `retryAfter` is the reset time, or 60 seconds. | Yes |
128
+ | 503 `treg_saturated`, other 5xx | `ServiceError`, with `retryAfter` when treg sent one. | Yes |
129
+ | 409 from treg | `ServiceError`: a call with the same idempotency key is still in flight. | Yes |
130
+ | 502 `response_buffer_limit` | The answer is larger than treg's 8 MiB settlement buffer. Nothing was charged. | No |
131
+ | Network failure or `timeout` | `ServiceError`. | Yes |
132
+ | 401, 403, other 4xx | The status, and treg's own explanation when the answer is treg's. | No |
133
+
134
+ `_error: retryAfter` reads the seconds treg asked to wait, `_error: statusCode` the HTTP status and `_error: code` treg's error name (such as `insufficient_balance`). Error messages never contain the token, a provider's response body or the body of an authentication failure.
135
+
136
+ ### Examples
137
+
138
+ ###### A treg connection
139
+
140
+ ```yaml
141
+ connections:
142
+ - id: treg
143
+ type: TregConnection
144
+ properties:
145
+ token:
146
+ _secret: TREG_TOKEN
147
+ maxCost: 0.1
148
+ meta:
149
+ app: crm
150
+ ```
151
+ Environment variables:
152
+ ```
153
+ LOWDEFY_SECRET_TREG_TOKEN = treg_…
154
+ ```
155
+
156
+ ###### Find a work email
157
+
158
+ ```yaml
159
+ id: find_email
160
+ type: TregCall
161
+ connectionId: treg
162
+ properties:
163
+ endpoint: treg.people.email.find
164
+ body:
165
+ full_name:
166
+ _payload: full_name
167
+ domain:
168
+ _payload: domain
169
+ maxCost: 0.05
170
+ ```
171
+
172
+ ###### An enrichment provider endpoint
173
+
174
+ An enrichment column's provider endpoint (`enrich_<provider>`) that finds a work email through treg. The worker calls it with the claimed cell's inputs and an idempotency key, and completes the cell with its answer, including the cost treg charged.
175
+
176
+ The idempotency key must stay the same across the attempts of one run of a cell, so that a cell retried after treg charged for an answer that was then lost gets the stored answer instead of paying again, and a timed-out async task is resumed. A claim token is new on every attempt, so build the key from the claim's `runId`, `columnKey`, `rowKey` and `inputHash` instead. When the provider endpoint throws a `ServiceError`, the worker completes the cell with `retryAfterMs`, so the retry waits as long as treg asked. In the worker:
177
+
178
+ ```yaml
179
+ - :try:
180
+ - id: provider
181
+ type: CallApi
182
+ properties:
183
+ endpointId:
184
+ _string.concat:
185
+ - enrich_
186
+ - _item: cell.provider
187
+ payload:
188
+ inputs:
189
+ _item: cell.inputs
190
+ idempotencyKey:
191
+ _js:
192
+ fn: |
193
+ const { cell } = args;
194
+ // An ObjectId row key reaches the routine as { _oid }.
195
+ const rowKey = cell.rowKey?._oid ?? String(cell.rowKey);
196
+ return [cell.runId, cell.columnKey, rowKey, cell.inputHash].join(':');
197
+ args:
198
+ cell:
199
+ _item: cell
200
+ # MongoDBEnrichmentComplete with the claim's cell and the provider's answer,
201
+ # { status, value, raw, cost }.
202
+ :catch:
203
+ - id: complete_error
204
+ type: MongoDBEnrichmentComplete
205
+ connectionId: leads
206
+ properties:
207
+ columnDefs:
208
+ _state: columnDefs
209
+ results:
210
+ - rowKey:
211
+ _item: cell.rowKey
212
+ columnKey:
213
+ _item: cell.columnKey
214
+ claimToken:
215
+ _item: cell.claimToken
216
+ status: error
217
+ error:
218
+ _error: message
219
+ retryAfterMs:
220
+ _js:
221
+ fn: |
222
+ const { retryAfter } = args;
223
+ return typeof retryAfter === 'number' ? retryAfter * 1000 : null;
224
+ args:
225
+ retryAfter:
226
+ _error: retryAfter
227
+ ```
228
+
229
+ The provider endpoint:
230
+
231
+ ```yaml
232
+ id: enrich_find_work_email_treg
233
+ type: InternalApi
234
+ routine:
235
+ - :try:
236
+ - id: find
237
+ type: TregCall
238
+ connectionId: treg
239
+ properties:
240
+ endpoint: treg.people.email.find
241
+ body:
242
+ full_name:
243
+ _payload: inputs.full_name
244
+ domain:
245
+ _payload: inputs.domain
246
+ idempotencyKey:
247
+ _payload: idempotencyKey
248
+ maxCost: 0.05
249
+ meta:
250
+ feature: enrichment
251
+ await:
252
+ timeoutMs: 60000
253
+ - :return:
254
+ status:
255
+ _if:
256
+ test:
257
+ _eq:
258
+ - _step: find.output.email
259
+ - null
260
+ then: empty
261
+ else: ok
262
+ value:
263
+ _step: find.output.email
264
+ raw:
265
+ _step: find.raw
266
+ cost:
267
+ _step: find.cost.micro
268
+ :catch:
269
+ # A ServiceError (a rate limit, treg saturated or out of capacity, a timeout)
270
+ # passes with time: throw it, and the worker queues the cell again after its
271
+ # backoff. `_error: retryAfter` has the seconds treg asked to wait.
272
+ - :if:
273
+ _eq:
274
+ - _error: name
275
+ - ServiceError
276
+ :then:
277
+ - :throw:
278
+ _error: true
279
+ # Anything else, such as a balance that is too low, is final.
280
+ - :return:
281
+ status: error
282
+ error:
283
+ _error: message
284
+ retry: false
285
+ ```
286
+
287
+ ###### Find endpoints for a provider catalogue
288
+
289
+ ```yaml
290
+ id: search_treg
291
+ type: TregCatalogSearch
292
+ connectionId: treg
293
+ properties:
294
+ q:
295
+ _payload: q
296
+ limit: 10
297
+ ```
298
+
299
+ ###### Read an endpoint's price for this team
300
+
301
+ ```yaml
302
+ id: email_find_price
303
+ type: TregCatalogGet
304
+ connectionId: treg
305
+ properties:
306
+ endpoint: treg.people.email.find
307
+ access: true
308
+ ```
309
+ `_step: email_find_price.access.estimated_cost_usd` is the price per call.
310
+
311
+ ###### Call one of the team's own tools
312
+
313
+ ```yaml
314
+ connections:
315
+ - id: treg_tools
316
+ type: TregConnection
317
+ properties:
318
+ token:
319
+ _secret: TREG_TOKEN
320
+ allowCustomTools: true
321
+ ```
322
+ ```yaml
323
+ id: stripe_balance
324
+ type: TregCall
325
+ connectionId: treg_tools
326
+ properties:
327
+ tool: stripe
328
+ path: /v1/balance
329
+ ```
@@ -67,6 +67,45 @@ An Affix block makes its content stick to the viewport when scrolling.
67
67
  size: small
68
68
  ```
69
69
 
70
+ Scroll this panel. The toolbar sticks to the top of the panel instead of the page, because `target` names the panel's id. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
71
+
72
+ ```yaml
73
+ - id: affix_panel
74
+ type: Box
75
+ class:
76
+ .element: h-48 overflow-y-auto rounded border border-gray-200 p-3
77
+ blocks:
78
+ - id: affix_panel_toolbar
79
+ type: Affix
80
+ properties:
81
+ offsetTop: 0
82
+ target: affix_panel
83
+ blocks:
84
+ - id: affix_panel_toolbar_btn
85
+ type: Button
86
+ layout:
87
+ flex: 0 0 auto
88
+ properties:
89
+ title: Save changes
90
+ icon: save
91
+ size: small
92
+ - id: affix_panel_text
93
+ type: Paragraph
94
+ properties:
95
+ content: Scroll this panel. The toolbar sticks to the top of the panel instead
96
+ of the page, because `target` names the panel's id. Lorem ipsum dolor
97
+ sit amet, consectetur adipiscing elit, sed do eiusmod tempor
98
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
99
+ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
100
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
101
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
102
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt
103
+ mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur
104
+ adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
105
+ magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
106
+ ullamco laboris nisi ut aliquip ex ea commodo consequat.
107
+ ```
108
+
70
109
  ```yaml
71
110
  - id: affix_offset_bottom_0
72
111
  type: Affix
@@ -209,7 +248,7 @@ An Affix block makes its content stick to the viewport when scrolling.
209
248
  layout:
210
249
  flex: 0 0 auto
211
250
  class:
212
- element: shadow-lg rounded-lg
251
+ .element: shadow-lg rounded-lg
213
252
  properties:
214
253
  offsetTop: 10
215
254
  blocks:
@@ -227,7 +266,7 @@ An Affix block makes its content stick to the viewport when scrolling.
227
266
  layout:
228
267
  flex: 0 0 auto
229
268
  class:
230
- element: ring-2 ring-green-400 rounded-lg
269
+ .element: ring-2 ring-green-400 rounded-lg
231
270
  properties:
232
271
  offsetTop: 10
233
272
  blocks:
@@ -316,7 +355,7 @@ Edit Employee Record
316
355
  flex: 0 0 auto
317
356
  properties:
318
357
  title: Save Changes
319
- icon: AiOutlineSave
358
+ icon: save
320
359
  color: primary
321
360
  variant: solid
322
361
  size: small
@@ -362,7 +401,7 @@ Edit Employee Record
362
401
  flex: 0 0 auto
363
402
  properties:
364
403
  title: Delete
365
- icon: AiOutlineDelete
404
+ icon: delete
366
405
  color: danger
367
406
  variant: outlined
368
407
  size: small
@@ -379,7 +418,7 @@ Edit Employee Record
379
418
  flex: 0 0 auto
380
419
  properties:
381
420
  title: Export
382
- icon: AiOutlineDownload
421
+ icon: download
383
422
  color: primary
384
423
  variant: solid
385
424
  size: small
@@ -395,13 +434,14 @@ Edit Employee Record
395
434
  | Property | Type | Default | Description |
396
435
  | --- | --- | --- | --- |
397
436
  | `offsetBottom` | number | - | Offset from the bottom of the viewport (in pixels). |
398
- | `offsetTop` | number | - | Offset from the top of the viewport (in pixels). |
437
+ | `offsetTop` | number | `0` | Offset from the top of the viewport (in pixels). |
438
+ | `target` | string | - | Id of the scrollable element the content sticks to, for example a scrolling panel. Defaults to the page window. |
399
439
  | `theme` | object | - | Antd design token overrides for this block. See [antd design tokens](https://ant.design/components/overview#design-token). See [Ant Design affix tokens](https://ant.design/components/affix#design-token). |
400
440
  | `theme.zIndexPopup` | number | `10` | Z-index of the affix element when fixed. |
401
441
 
402
442
  | Event | Event Data | Description |
403
443
  | --- | --- | --- |
404
- | `onChange` | \- | Triggered when container affix status changes. |
444
+ | `onChange` | `{ affixed }` | Triggered when container affix status changes. |
405
445
 
406
446
  | Key | Target |
407
447
  | --- | --- |