@lowdefy/docs-content 0.0.0-experimental-20260710073520
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/LICENSE +201 -0
- package/README.md +20 -0
- package/content/actions/callapi.md +66 -0
- package/content/actions/callmethod.md +41 -0
- package/content/actions/copytoclipboard.md +32 -0
- package/content/actions/displaymessage.md +53 -0
- package/content/actions/downloadcsv.md +89 -0
- package/content/actions/fetch.md +50 -0
- package/content/actions/geolocationcurrentposition.md +56 -0
- package/content/actions/link.md +104 -0
- package/content/actions/login.md +85 -0
- package/content/actions/logout.md +56 -0
- package/content/actions/pdfmake.md +304 -0
- package/content/actions/request.md +67 -0
- package/content/actions/reset.md +27 -0
- package/content/actions/resetvalidation.md +85 -0
- package/content/actions/scrollto.md +85 -0
- package/content/actions/setdarkmode.md +62 -0
- package/content/actions/setfocus.md +33 -0
- package/content/actions/setglobal.md +63 -0
- package/content/actions/setlocale.md +69 -0
- package/content/actions/setstate.md +70 -0
- package/content/actions/throw.md +72 -0
- package/content/actions/validate.md +87 -0
- package/content/actions/wait.md +24 -0
- package/content/agents/agent-endpoint-tools.md +190 -0
- package/content/agents/agent-mcp-tools.md +124 -0
- package/content/agents/agent-multi-agent.md +136 -0
- package/content/agents/agent-properties.md +174 -0
- package/content/agents/agent-server-hooks.md +336 -0
- package/content/agents/agentchat.md +515 -0
- package/content/agents/agentconversations.md +148 -0
- package/content/concepts/ai-agent-docs.md +190 -0
- package/content/concepts/cli.md +213 -0
- package/content/concepts/connections-and-requests.md +7 -0
- package/content/concepts/custom-html.md +3 -0
- package/content/concepts/custom-styling.md +161 -0
- package/content/concepts/events-and-actions.md +271 -0
- package/content/concepts/hosting-files.md +18 -0
- package/content/concepts/i18n.md +320 -0
- package/content/concepts/keyboard-shortcuts.md +218 -0
- package/content/concepts/layout-overview.md +478 -0
- package/content/concepts/lists.md +144 -0
- package/content/concepts/logger.md +43 -0
- package/content/concepts/lowdefy-schema.md +365 -0
- package/content/concepts/menus.md +144 -0
- package/content/concepts/module-authoring.md +564 -0
- package/content/concepts/modules.md +338 -0
- package/content/concepts/operators.md +45 -0
- package/content/concepts/overview.md +19 -0
- package/content/concepts/references-and-templates.md +207 -0
- package/content/concepts/secrets.md +24 -0
- package/content/concepts/selectors.md +143 -0
- package/content/connections/amazonredshift.md +176 -0
- package/content/connections/anthropic.md +232 -0
- package/content/connections/awss3.md +313 -0
- package/content/connections/azureblobstorage.md +133 -0
- package/content/connections/elasticsearch.md +371 -0
- package/content/connections/google.md +228 -0
- package/content/connections/googlecloudstorage.md +139 -0
- package/content/connections/googlesheet.md +313 -0
- package/content/connections/knex.md +206 -0
- package/content/connections/mariadb.md +177 -0
- package/content/connections/mcp.md +134 -0
- package/content/connections/mongodb.md +739 -0
- package/content/connections/mssql.md +191 -0
- package/content/connections/mysql.md +192 -0
- package/content/connections/openai-connection.md +228 -0
- package/content/connections/postgresql.md +200 -0
- package/content/connections/redis.md +116 -0
- package/content/connections/sendgridmail.md +94 -0
- package/content/connections/smtp.md +149 -0
- package/content/connections/sqlite.md +187 -0
- package/content/connections/stripe.md +115 -0
- package/content/container-blocks/affix.md +413 -0
- package/content/container-blocks/alert.md +937 -0
- package/content/container-blocks/badge.md +1222 -0
- package/content/container-blocks/box.md +1453 -0
- package/content/container-blocks/card.md +1200 -0
- package/content/container-blocks/carousel.md +2247 -0
- package/content/container-blocks/collapse.md +1335 -0
- package/content/container-blocks/configprovider.md +1070 -0
- package/content/container-blocks/confirmmodal.md +1159 -0
- package/content/container-blocks/content.md +597 -0
- package/content/container-blocks/descriptions.md +870 -0
- package/content/container-blocks/drawer.md +1379 -0
- package/content/container-blocks/dropdownmenu.md +643 -0
- package/content/container-blocks/flex.md +1510 -0
- package/content/container-blocks/footer.md +380 -0
- package/content/container-blocks/googlemaps.md +546 -0
- package/content/container-blocks/googlemapsheatmap.md +607 -0
- package/content/container-blocks/googlemapsscript.md +61 -0
- package/content/container-blocks/header.md +302 -0
- package/content/container-blocks/label.md +739 -0
- package/content/container-blocks/layout.md +604 -0
- package/content/container-blocks/masonry.md +1090 -0
- package/content/container-blocks/mobilemenu.md +1244 -0
- package/content/container-blocks/modal.md +1180 -0
- package/content/container-blocks/pageheadermenu.md +614 -0
- package/content/container-blocks/pagesidebarlayout.md +438 -0
- package/content/container-blocks/pagesidermenu.md +651 -0
- package/content/container-blocks/popover.md +1421 -0
- package/content/container-blocks/result.md +972 -0
- package/content/container-blocks/sider.md +1064 -0
- package/content/container-blocks/span.md +747 -0
- package/content/container-blocks/spinner.md +267 -0
- package/content/container-blocks/splitter.md +1735 -0
- package/content/container-blocks/tabs.md +1718 -0
- package/content/container-blocks/tooltip.md +1274 -0
- package/content/container-blocks/watermark.md +515 -0
- package/content/controls/for.md +103 -0
- package/content/controls/if.md +107 -0
- package/content/controls/log.md +50 -0
- package/content/controls/parallel.md +71 -0
- package/content/controls/parallel_for.md +36 -0
- package/content/controls/reject.md +56 -0
- package/content/controls/return.md +66 -0
- package/content/controls/set_state.md +98 -0
- package/content/controls/switch.md +90 -0
- package/content/controls/throw.md +79 -0
- package/content/controls/try.md +88 -0
- package/content/deployment/docker.md +149 -0
- package/content/deployment/node-server.md +27 -0
- package/content/deployment/vercel.md +101 -0
- package/content/display-blocks/aggrid.md +1459 -0
- package/content/display-blocks/anchor.md +336 -0
- package/content/display-blocks/avatar.md +1154 -0
- package/content/display-blocks/breadcrumb.md +517 -0
- package/content/display-blocks/button.md +758 -0
- package/content/display-blocks/calendar.md +156 -0
- package/content/display-blocks/dangeroushtml.md +314 -0
- package/content/display-blocks/dangerousmarkdown.md +423 -0
- package/content/display-blocks/diffgit.md +44 -0
- package/content/display-blocks/difflist.md +225 -0
- package/content/display-blocks/diffsidebyside.md +56 -0
- package/content/display-blocks/difftimeline.md +94 -0
- package/content/display-blocks/divider.md +406 -0
- package/content/display-blocks/download.md +60 -0
- package/content/display-blocks/dropdownbutton.md +661 -0
- package/content/display-blocks/echart.md +418 -0
- package/content/display-blocks/floatbutton.md +545 -0
- package/content/display-blocks/html.md +311 -0
- package/content/display-blocks/icon.md +717 -0
- package/content/display-blocks/img.md +479 -0
- package/content/display-blocks/markdown.md +520 -0
- package/content/display-blocks/markdownwithcode.md +730 -0
- package/content/display-blocks/menu.md +1123 -0
- package/content/display-blocks/message.md +941 -0
- package/content/display-blocks/notification.md +1410 -0
- package/content/display-blocks/paragraph.md +643 -0
- package/content/display-blocks/progress.md +818 -0
- package/content/display-blocks/qrcode.md +519 -0
- package/content/display-blocks/s3download.md +240 -0
- package/content/display-blocks/search.md +360 -0
- package/content/display-blocks/skeleton.md +272 -0
- package/content/display-blocks/skeletonavatar.md +222 -0
- package/content/display-blocks/skeletonbutton.md +245 -0
- package/content/display-blocks/skeletoninput.md +223 -0
- package/content/display-blocks/skeletonparagraph.md +201 -0
- package/content/display-blocks/statistic.md +485 -0
- package/content/display-blocks/steps.md +585 -0
- package/content/display-blocks/tag.md +620 -0
- package/content/display-blocks/title.md +654 -0
- package/content/display-blocks/tour.md +2359 -0
- package/content/input-blocks/autocomplete.md +786 -0
- package/content/input-blocks/buttonselector.md +964 -0
- package/content/input-blocks/checkboxselector.md +765 -0
- package/content/input-blocks/checkboxswitch.md +497 -0
- package/content/input-blocks/colorselector.md +884 -0
- package/content/input-blocks/daterangeselector.md +777 -0
- package/content/input-blocks/dateselector.md +693 -0
- package/content/input-blocks/datetimeselector.md +791 -0
- package/content/input-blocks/inputgallery.md +528 -0
- package/content/input-blocks/monthselector.md +717 -0
- package/content/input-blocks/multipleselector.md +1337 -0
- package/content/input-blocks/numberinput.md +855 -0
- package/content/input-blocks/pagination.md +679 -0
- package/content/input-blocks/paragraphinput.md +1664 -0
- package/content/input-blocks/passwordinput.md +480 -0
- package/content/input-blocks/phonenumberinput.md +688 -0
- package/content/input-blocks/radioselector.md +820 -0
- package/content/input-blocks/ratingslider.md +684 -0
- package/content/input-blocks/s3uploadbutton.md +384 -0
- package/content/input-blocks/s3uploaddragger.md +305 -0
- package/content/input-blocks/s3uploadphoto.md +288 -0
- package/content/input-blocks/segmentedselector.md +782 -0
- package/content/input-blocks/selector.md +1162 -0
- package/content/input-blocks/switch.md +552 -0
- package/content/input-blocks/textarea.md +714 -0
- package/content/input-blocks/textinput.md +639 -0
- package/content/input-blocks/tiptapinput.md +226 -0
- package/content/input-blocks/tiptapmentioninput.md +471 -0
- package/content/input-blocks/titleinput.md +1094 -0
- package/content/input-blocks/treeinput.md +144 -0
- package/content/input-blocks/treemultipleselector.md +162 -0
- package/content/input-blocks/treeselector.md +185 -0
- package/content/input-blocks/upload.md +149 -0
- package/content/input-blocks/uploaddragger.md +85 -0
- package/content/input-blocks/uploadphoto.md +84 -0
- package/content/input-blocks/weekselector.md +630 -0
- package/content/list-blocks/controlledlist.md +498 -0
- package/content/list-blocks/list.md +529 -0
- package/content/list-blocks/listselector.md +301 -0
- package/content/list-blocks/masonrylist.md +230 -0
- package/content/migration/upgrade-guide.md +106 -0
- package/content/migration/v4-to-v5.md +589 -0
- package/content/migration/v5-to-v6.md +36 -0
- package/content/operators/_actions.md +58 -0
- package/content/operators/_and.md +76 -0
- package/content/operators/_api.md +254 -0
- package/content/operators/_app.md +114 -0
- package/content/operators/_args.md +65 -0
- package/content/operators/_array.md +331 -0
- package/content/operators/_base64.md +49 -0
- package/content/operators/_boolean.md +33 -0
- package/content/operators/_build.md +166 -0
- package/content/operators/_change_case.md +357 -0
- package/content/operators/_date.md +415 -0
- package/content/operators/_dayjs.md +128 -0
- package/content/operators/_diff.md +61 -0
- package/content/operators/_divide.md +32 -0
- package/content/operators/_eq.md +52 -0
- package/content/operators/_event.md +86 -0
- package/content/operators/_function.md +52 -0
- package/content/operators/_get.md +92 -0
- package/content/operators/_global.md +86 -0
- package/content/operators/_gt.md +50 -0
- package/content/operators/_gte.md +50 -0
- package/content/operators/_hash.md +112 -0
- package/content/operators/_if.md +30 -0
- package/content/operators/_if_none.md +47 -0
- package/content/operators/_index.md +48 -0
- package/content/operators/_input.md +86 -0
- package/content/operators/_intl.md +135 -0
- package/content/operators/_item.md +166 -0
- package/content/operators/_js.md +113 -0
- package/content/operators/_json.md +120 -0
- package/content/operators/_jsonata.md +152 -0
- package/content/operators/_locale.md +65 -0
- package/content/operators/_location.md +40 -0
- package/content/operators/_log.md +22 -0
- package/content/operators/_lt.md +50 -0
- package/content/operators/_lte.md +50 -0
- package/content/operators/_math.md +407 -0
- package/content/operators/_media.md +83 -0
- package/content/operators/_menu.md +62 -0
- package/content/operators/_module.md +340 -0
- package/content/operators/_mql.md +95 -0
- package/content/operators/_ne.md +62 -0
- package/content/operators/_not.md +33 -0
- package/content/operators/_number.md +159 -0
- package/content/operators/_nunjucks.md +117 -0
- package/content/operators/_object.md +253 -0
- package/content/operators/_operator.md +33 -0
- package/content/operators/_or.md +67 -0
- package/content/operators/_product.md +45 -0
- package/content/operators/_random.md +90 -0
- package/content/operators/_ref.md +80 -0
- package/content/operators/_regex.md +69 -0
- package/content/operators/_request.md +35 -0
- package/content/operators/_request_details.md +29 -0
- package/content/operators/_secret.md +56 -0
- package/content/operators/_state.md +134 -0
- package/content/operators/_step.md +98 -0
- package/content/operators/_string.md +327 -0
- package/content/operators/_subtract.md +24 -0
- package/content/operators/_sum.md +45 -0
- package/content/operators/_switch.md +37 -0
- package/content/operators/_t.md +96 -0
- package/content/operators/_theme.md +65 -0
- package/content/operators/_type.md +78 -0
- package/content/operators/_uri.md +49 -0
- package/content/operators/_url_query.md +92 -0
- package/content/operators/_user.md +154 -0
- package/content/operators/_uuid.md +118 -0
- package/content/operators/_var.md +88 -0
- package/content/operators/_yaml.md +96 -0
- package/content/other/introduction.md +39 -0
- package/content/other/next-auth-providers.md +3 -0
- package/content/other/updatesession.md +26 -0
- package/content/plugins/plugins-actions.md +80 -0
- package/content/plugins/plugins-connections.md +98 -0
- package/content/plugins/plugins-dev.md +138 -0
- package/content/plugins/plugins-introduction.md +29 -0
- package/content/plugins/plugins-operators.md +71 -0
- package/content/testing/e2e-auth.md +108 -0
- package/content/testing/e2e-configuration.md +107 -0
- package/content/testing/e2e-getting-started.md +96 -0
- package/content/testing/e2e-introduction.md +53 -0
- package/content/testing/e2e-mocking.md +155 -0
- package/content/testing/e2e-writing-tests.md +214 -0
- package/content/tutorial/tutorial-actions-operators.md +222 -0
- package/content/tutorial/tutorial-add-blocks.md +86 -0
- package/content/tutorial/tutorial-create-page.md +57 -0
- package/content/tutorial/tutorial-display-data-page.md +181 -0
- package/content/tutorial/tutorial-next-steps.md +53 -0
- package/content/tutorial/tutorial-requests-sql.md +22 -0
- package/content/tutorial/tutorial-start.md +71 -0
- package/content/user-authentication/auth-providers.md +15 -0
- package/content/user-authentication/login-and-logout.md +122 -0
- package/content/user-authentication/users-introduction.md +31 -0
- package/index.json +2281 -0
- package/package.json +34 -0
- package/scripts/extractAgentDocs.js +130 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# _and
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(values: any[]): boolean
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_and` operator performs a logical `and` over an array of inputs, using javascript [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) rules.
|
|
8
|
+
|
|
9
|
+
It only returns true if all the values in the array are truthy (not `false`, `0`, `null`, `undefined`, or the empty string `""`). Else it returns false.
|
|
10
|
+
|
|
11
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
12
|
+
|
|
13
|
+
#### Arguments
|
|
14
|
+
|
|
15
|
+
###### array
|
|
16
|
+
An array of values over which to perform a logical and.
|
|
17
|
+
|
|
18
|
+
#### Examples
|
|
19
|
+
|
|
20
|
+
###### Two `true` values:
|
|
21
|
+
```yaml
|
|
22
|
+
_and:
|
|
23
|
+
- true
|
|
24
|
+
- true
|
|
25
|
+
```
|
|
26
|
+
Returns: `true`
|
|
27
|
+
|
|
28
|
+
###### Array of `true` and `false` values:
|
|
29
|
+
```yaml
|
|
30
|
+
_and:
|
|
31
|
+
- true
|
|
32
|
+
- true
|
|
33
|
+
- true
|
|
34
|
+
- false
|
|
35
|
+
```
|
|
36
|
+
Returns: `false`
|
|
37
|
+
|
|
38
|
+
###### Check if two boolean inputs are true:
|
|
39
|
+
```yaml
|
|
40
|
+
_and:
|
|
41
|
+
- _state: confirm_accept_terms
|
|
42
|
+
- _state: confirm_accept_privacy_policy
|
|
43
|
+
```
|
|
44
|
+
Returns: `true` if both inputs are `true`
|
|
45
|
+
|
|
46
|
+
###### Truthy values:
|
|
47
|
+
```yaml
|
|
48
|
+
_and:
|
|
49
|
+
- "Hello"
|
|
50
|
+
- 42
|
|
51
|
+
- []
|
|
52
|
+
- key: value
|
|
53
|
+
```
|
|
54
|
+
Returns: `true`
|
|
55
|
+
|
|
56
|
+
###### Falsy values:
|
|
57
|
+
```yaml
|
|
58
|
+
_and:
|
|
59
|
+
- true
|
|
60
|
+
- null
|
|
61
|
+
```
|
|
62
|
+
Returns: `false`
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
_and:
|
|
66
|
+
- true
|
|
67
|
+
- 0
|
|
68
|
+
```
|
|
69
|
+
Returns: `false`
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
_and:
|
|
73
|
+
- true
|
|
74
|
+
- ""
|
|
75
|
+
```
|
|
76
|
+
Returns: `false`
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# _api
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(endpointId: string): any
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_api` operator returns the response object from an API endpoint that has been called using the [`CallAPI`](/CallAPI) action. This operator is only available on the client side (in pages) and provides access to the full API response object including the response data, loading state, success status, and any errors. If the API endpoint has not yet been called or is still executing, the returned value is `null`. Dot notation is supported for accessing nested properties.
|
|
8
|
+
|
|
9
|
+
If the call was made with `holdValue: true` on the [`CallAPI`](/CallAPI) action, the previous response is retained on the entry while the new call is loading. `_api: <endpointId>.response` keeps returning the previous data instead of going to `null`, while `_api: <endpointId>.loading` still reflects the in-flight state. The previous response is also retained if the new call errors.
|
|
10
|
+
|
|
11
|
+
The response includes the following fields:
|
|
12
|
+
|
|
13
|
+
- `blockId: string`: The block id of the block from which the API call was initiated.
|
|
14
|
+
- `endTimestamp: date`: The timestamp when the API call ended.
|
|
15
|
+
- `endpointId: string`: The endpoint id of the API endpoint that was called.
|
|
16
|
+
- `error: object`: Any error if the API endpoint failed or used :reject.
|
|
17
|
+
- `holdValue: boolean`: Present (and `true`) when the call was made with `holdValue: true`.
|
|
18
|
+
- `loading: boolean`: When `true`, the API endpoint is awaiting a response.
|
|
19
|
+
- `pageId: string`: The page id of the page from which the API call was initiated.
|
|
20
|
+
- `payload: object`: The payload sent with the API call.
|
|
21
|
+
- `response: object`: The data returned by the API endpoint's :return statement.
|
|
22
|
+
- `responseTime: number`: The time taken to get the response in milliseconds.
|
|
23
|
+
- `startTimestamp: date`: The timestamp when the API call started.
|
|
24
|
+
- `status: string`: The status of the API call.
|
|
25
|
+
- `success: boolean`: When `true`, the API call completed successfully.
|
|
26
|
+
|
|
27
|
+
#### Arguments
|
|
28
|
+
|
|
29
|
+
###### string
|
|
30
|
+
The endpoint id of the API endpoint that was called using the CallAPI action.
|
|
31
|
+
|
|
32
|
+
#### Examples
|
|
33
|
+
|
|
34
|
+
###### Accessing the full API response object:
|
|
35
|
+
```yaml
|
|
36
|
+
blocks:
|
|
37
|
+
- id: fetch_button
|
|
38
|
+
type: Button
|
|
39
|
+
properties:
|
|
40
|
+
title: Load User Data
|
|
41
|
+
events:
|
|
42
|
+
onClick:
|
|
43
|
+
- id: call_user_api
|
|
44
|
+
type: CallAPI
|
|
45
|
+
params:
|
|
46
|
+
endpointId: get_user_profile
|
|
47
|
+
payload:
|
|
48
|
+
user_id:
|
|
49
|
+
_state: selected_user_id
|
|
50
|
+
|
|
51
|
+
- id: api_response_display
|
|
52
|
+
type: Descriptions
|
|
53
|
+
properties:
|
|
54
|
+
items:
|
|
55
|
+
_api: get_user_profile # Returns the full response object
|
|
56
|
+
```
|
|
57
|
+
Returns: The complete API response object containing response, error, success, status, loading, and timing information.
|
|
58
|
+
|
|
59
|
+
###### Using dot notation to access the response data:
|
|
60
|
+
```yaml
|
|
61
|
+
blocks:
|
|
62
|
+
- id: user_name_display
|
|
63
|
+
type: Paragraph
|
|
64
|
+
properties:
|
|
65
|
+
content:
|
|
66
|
+
_if:
|
|
67
|
+
test:
|
|
68
|
+
_api: get_user_profile.success
|
|
69
|
+
then:
|
|
70
|
+
_string.concat:
|
|
71
|
+
- 'Welcome, '
|
|
72
|
+
- _api: get_user_profile.response.name
|
|
73
|
+
else: 'User not loaded'
|
|
74
|
+
|
|
75
|
+
- id: user_email_display
|
|
76
|
+
type: Html
|
|
77
|
+
properties:
|
|
78
|
+
html:
|
|
79
|
+
_nunjucks:
|
|
80
|
+
template: |
|
|
81
|
+
<div>
|
|
82
|
+
<span>Email:</span>
|
|
83
|
+
<span>
|
|
84
|
+
{{ email }}
|
|
85
|
+
</span>
|
|
86
|
+
</div>
|
|
87
|
+
on:
|
|
88
|
+
email:
|
|
89
|
+
_api: get_user_profile.response.email
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
###### Checking loading and error states:
|
|
93
|
+
```yaml
|
|
94
|
+
events:
|
|
95
|
+
onMount:
|
|
96
|
+
- id: fetch_products
|
|
97
|
+
type: CallAPI
|
|
98
|
+
params:
|
|
99
|
+
endpointId: get_products
|
|
100
|
+
- id: set_products_list
|
|
101
|
+
type: SetState
|
|
102
|
+
params:
|
|
103
|
+
products_list
|
|
104
|
+
_api: fetch_products.response.products
|
|
105
|
+
|
|
106
|
+
blocks:
|
|
107
|
+
- id: loading_text
|
|
108
|
+
type: Html
|
|
109
|
+
visible:
|
|
110
|
+
_api: fetch_products.loading # Show loading text while API is loading
|
|
111
|
+
properties:
|
|
112
|
+
html: '<div class="secondary">Loading...</div>'
|
|
113
|
+
|
|
114
|
+
- id: error_message
|
|
115
|
+
type: Alert
|
|
116
|
+
visible:
|
|
117
|
+
_not:
|
|
118
|
+
_api: fetch_products.success
|
|
119
|
+
properties:
|
|
120
|
+
type: error
|
|
121
|
+
message:
|
|
122
|
+
_if:
|
|
123
|
+
test:
|
|
124
|
+
_api: fetch_products.error
|
|
125
|
+
then:
|
|
126
|
+
_api: fetch_products.error.message
|
|
127
|
+
else: 'An error occurred'
|
|
128
|
+
|
|
129
|
+
- id: products_list
|
|
130
|
+
type: List
|
|
131
|
+
visible:
|
|
132
|
+
_and:
|
|
133
|
+
- _api: fetch_products.success
|
|
134
|
+
- _not:
|
|
135
|
+
_api: fetch_products.loading
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
###### Working with multiple API calls:
|
|
139
|
+
```yaml
|
|
140
|
+
blocks:
|
|
141
|
+
- id: load_all_button
|
|
142
|
+
type: Button
|
|
143
|
+
properties:
|
|
144
|
+
title: Load All Data
|
|
145
|
+
events:
|
|
146
|
+
onClick:
|
|
147
|
+
- id: fetch_user
|
|
148
|
+
type: CallAPI
|
|
149
|
+
params:
|
|
150
|
+
endpointId: get_current_user
|
|
151
|
+
|
|
152
|
+
- id: fetch_permissions
|
|
153
|
+
type: CallAPI
|
|
154
|
+
params:
|
|
155
|
+
endpointId: get_user_permissions
|
|
156
|
+
payload:
|
|
157
|
+
user_id:
|
|
158
|
+
_api: get_current_user.response._id
|
|
159
|
+
|
|
160
|
+
- id: fetch_dashboard_data
|
|
161
|
+
type: CallAPI
|
|
162
|
+
params:
|
|
163
|
+
endpointId: get_dashboard_stats
|
|
164
|
+
payload:
|
|
165
|
+
permission_level:
|
|
166
|
+
_api: get_user_permissions.response.level
|
|
167
|
+
|
|
168
|
+
- id: dashboard_container
|
|
169
|
+
type: Box
|
|
170
|
+
visible:
|
|
171
|
+
_and:
|
|
172
|
+
- _api: get_current_user.success
|
|
173
|
+
- _api: get_user_permissions.success
|
|
174
|
+
- _api: get_dashboard_stats.success
|
|
175
|
+
blocks:
|
|
176
|
+
- id: welcome_message
|
|
177
|
+
type: Title
|
|
178
|
+
properties:
|
|
179
|
+
content:
|
|
180
|
+
_string.concat:
|
|
181
|
+
- 'Dashboard for '
|
|
182
|
+
- _api: get_current_user.response.name
|
|
183
|
+
|
|
184
|
+
- id: stats_display
|
|
185
|
+
type: Statistic
|
|
186
|
+
properties:
|
|
187
|
+
title: Total Revenue
|
|
188
|
+
value:
|
|
189
|
+
_api: get_dashboard_stats.response.total_revenue
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
###### Using API response in form validation:
|
|
193
|
+
```yaml
|
|
194
|
+
blocks:
|
|
195
|
+
- id: check_username_button
|
|
196
|
+
type: Button
|
|
197
|
+
properties:
|
|
198
|
+
title: Check Availability
|
|
199
|
+
events:
|
|
200
|
+
onClick:
|
|
201
|
+
- id: check_username
|
|
202
|
+
type: CallAPI
|
|
203
|
+
params:
|
|
204
|
+
endpointId: validate_username
|
|
205
|
+
payload:
|
|
206
|
+
username:
|
|
207
|
+
_state: username_input
|
|
208
|
+
|
|
209
|
+
- id: username_input
|
|
210
|
+
type: TextInput
|
|
211
|
+
properties:
|
|
212
|
+
title: Username
|
|
213
|
+
disabled:
|
|
214
|
+
_eq:
|
|
215
|
+
- _api: validate_username.response.available
|
|
216
|
+
- false
|
|
217
|
+
label:
|
|
218
|
+
extra:
|
|
219
|
+
_if:
|
|
220
|
+
test:
|
|
221
|
+
_api: validate_username.response
|
|
222
|
+
then:
|
|
223
|
+
_if:
|
|
224
|
+
test:
|
|
225
|
+
_api: validate_username.response.available
|
|
226
|
+
then: 'Username is available!'
|
|
227
|
+
else: 'Username is already taken'
|
|
228
|
+
else: 'Enter a username and check availability'
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
###### Accessing API response time and metadata:
|
|
232
|
+
```yaml
|
|
233
|
+
blocks:
|
|
234
|
+
- id: api_debug_info
|
|
235
|
+
type: Descriptions
|
|
236
|
+
properties:
|
|
237
|
+
items:
|
|
238
|
+
- label: API Status
|
|
239
|
+
value:
|
|
240
|
+
_api: fetch_data.status
|
|
241
|
+
- label: Success
|
|
242
|
+
value:
|
|
243
|
+
_api: fetch_data.success
|
|
244
|
+
- label: Response Time
|
|
245
|
+
value:
|
|
246
|
+
_string.concat:
|
|
247
|
+
- _api: fetch_data.responseTime
|
|
248
|
+
- 'ms'
|
|
249
|
+
- label: Timestamp
|
|
250
|
+
value:
|
|
251
|
+
_date.format:
|
|
252
|
+
- _api: fetch_data.endTimestamp
|
|
253
|
+
- 'HH:mm:ss'
|
|
254
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# _app
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(key: string): any
|
|
5
|
+
(all: boolean): any
|
|
6
|
+
(arguments: {
|
|
7
|
+
all?: boolean,
|
|
8
|
+
key?: string,
|
|
9
|
+
default?: any,
|
|
10
|
+
}): any
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The `_app` operator reads structured app metadata declared in `lowdefy.yaml` together with build-environment facts captured by the build. It runs on the client, the server, and at build time.
|
|
14
|
+
|
|
15
|
+
The metadata object has the following keys:
|
|
16
|
+
|
|
17
|
+
- `slug`: From the root `slug` field. **Required when referenced in string form** — `_app: slug` (or `_build.app: slug`) fails the build when `slug` is not declared in `lowdefy.yaml`. This guards against a `null` slug silently scoping namespaced data (e.g. MongoDB filters). The object form with an explicit `default` (`_app: { key: slug, default: ... }`) is the deliberate escape hatch: it returns the default instead of throwing, for the rare site that knowingly tolerates an unset slug. When set, the slug must be kebab-case (`^[a-z][a-z0-9]*(-[a-z0-9]+)*$`) — lowercase letters and digits, hyphen-separated, starts with a letter, no leading/trailing/consecutive hyphens, no underscores. An app that never references `slug` need not declare it.
|
|
18
|
+
- `name`: From the root `name` field. Free-form string.
|
|
19
|
+
- `version`: From the root `version` field. Free-form string.
|
|
20
|
+
- `description`: From the root `description` field. Free-form string.
|
|
21
|
+
- `license`: From the root `license` field. Free-form string.
|
|
22
|
+
- `lowdefyVersion`: From the root `lowdefy` field — the framework version the app targets.
|
|
23
|
+
- `gitSha`: The build's git commit SHA. Resolved at build time in three steps: the `LOWDEFY_GIT_SHA` environment variable (when set non-empty) wins; otherwise the build runs `git rev-parse HEAD`; if both fail (no `.git`, no `git` binary, env unset), `gitSha` is `null`. The build does not error in any case. Build-time and runtime reads return the same value.
|
|
24
|
+
|
|
25
|
+
Missing root fields yield `null` — every key in the metadata is always present. The sole exception is `slug`: referencing it fails the build when it is not set (see above).
|
|
26
|
+
|
|
27
|
+
Unknown keys return `null`. Dot-paths against the flat shape also return `null` (no exception).
|
|
28
|
+
|
|
29
|
+
#### Build time and runtime
|
|
30
|
+
|
|
31
|
+
`_app` resolves at **build time** and at runtime, and both produce the same value (app metadata is fixed at build). In most positions, write `_app: slug` — the build bakes it into the artifact. Inside a `_build.*` operator (for example as a [`_build.object.fromEntries`](/_build) map key), use the `_build.app` form so it resolves in time to be consumed by the surrounding build operator. See [`_build`](/_build).
|
|
32
|
+
|
|
33
|
+
#### Root metadata fields accept literals and `_build.*` only
|
|
34
|
+
|
|
35
|
+
The root metadata fields (`slug`, `name`, `description`, `version`, `license`, `lowdefy`) are resolved before the rest of the config, so they accept only literals and [`_build.*`](/_build) operators. `_ref`, `_var`, and static `_` operators are not resolved in these positions and fail the build with a clear error naming the field. Use `_build.env` for a deploy-time slug or name (for example `slug: { _build.env: APP_SLUG }`).
|
|
36
|
+
|
|
37
|
+
#### Pinning `gitSha` in deploy environments
|
|
38
|
+
|
|
39
|
+
Several common deploy paths strip `.git` before the build runs — Docker images that `COPY` only built output, hermetic PaaS sandboxes (Vercel, Netlify, Render), and CI runners with `actions/checkout` configured to fetch only a shallow tree without `.git`. In those environments, `git rev-parse HEAD` fails and `_app: gitSha` resolves to `null` unless `LOWDEFY_GIT_SHA` is set. Map your platform's commit env var via shell expansion in the build command:
|
|
40
|
+
|
|
41
|
+
| Platform | Build command |
|
|
42
|
+
| --------------- | ---------------------------------------------------------- |
|
|
43
|
+
| Vercel | `LOWDEFY_GIT_SHA=$VERCEL_GIT_COMMIT_SHA lowdefy build` |
|
|
44
|
+
| Netlify | `LOWDEFY_GIT_SHA=$COMMIT_REF lowdefy build` |
|
|
45
|
+
| Render | `LOWDEFY_GIT_SHA=$RENDER_GIT_COMMIT lowdefy build` |
|
|
46
|
+
| GitHub Actions | `LOWDEFY_GIT_SHA=$GITHUB_SHA lowdefy build` |
|
|
47
|
+
| Docker (CLI) | `--build-arg LOWDEFY_GIT_SHA=$(git rev-parse HEAD)` |
|
|
48
|
+
|
|
49
|
+
#### Arguments
|
|
50
|
+
|
|
51
|
+
###### string
|
|
52
|
+
If the `_app` operator is called with a string argument, the value of the key in the app metadata is returned. If the key is not found, `null` is returned. Dot notation is supported.
|
|
53
|
+
|
|
54
|
+
###### boolean
|
|
55
|
+
If the `_app` operator is called with the boolean argument `true`, the entire app metadata object is returned.
|
|
56
|
+
|
|
57
|
+
###### object
|
|
58
|
+
- `all: boolean`: If `all` is set to `true`, the entire app metadata object is returned. One of `all` or `key` are required.
|
|
59
|
+
- `key: string`: The value of the key in the app metadata is returned. If the value is not found, `null`, or the specified default value is returned. One of `all` or `key` are required.
|
|
60
|
+
- `default: any`: A value to return if the `key` is not found. By default, `null` is returned if a value is not found.
|
|
61
|
+
|
|
62
|
+
#### Examples
|
|
63
|
+
|
|
64
|
+
###### Get the app slug:
|
|
65
|
+
```yaml
|
|
66
|
+
_app: slug
|
|
67
|
+
```
|
|
68
|
+
```yaml
|
|
69
|
+
_app:
|
|
70
|
+
key: slug
|
|
71
|
+
```
|
|
72
|
+
Returns: The value of `slug` declared in `lowdefy.yaml`.
|
|
73
|
+
|
|
74
|
+
###### Get the app name:
|
|
75
|
+
```yaml
|
|
76
|
+
_app: name
|
|
77
|
+
```
|
|
78
|
+
Returns: The value of the root `name` field.
|
|
79
|
+
|
|
80
|
+
###### Get the entire app metadata object:
|
|
81
|
+
```yaml
|
|
82
|
+
_app: true
|
|
83
|
+
```
|
|
84
|
+
```yaml
|
|
85
|
+
_app:
|
|
86
|
+
all: true
|
|
87
|
+
```
|
|
88
|
+
Returns: The full `{ slug, name, version, description, license, lowdefyVersion, gitSha }` object.
|
|
89
|
+
|
|
90
|
+
###### Return a default value if `gitSha` was not captured:
|
|
91
|
+
```yaml
|
|
92
|
+
_app:
|
|
93
|
+
key: gitSha
|
|
94
|
+
default: dev
|
|
95
|
+
```
|
|
96
|
+
Returns: The git SHA, or `"dev"` when unavailable (e.g. local dev with no `LOWDEFY_GIT_SHA` and no `.git`).
|
|
97
|
+
|
|
98
|
+
###### Scope a MongoDB request by app slug:
|
|
99
|
+
```yaml
|
|
100
|
+
filter:
|
|
101
|
+
created.app_name:
|
|
102
|
+
_app: slug
|
|
103
|
+
```
|
|
104
|
+
Returns: A filter document with `created.app_name` equal to the app's slug.
|
|
105
|
+
|
|
106
|
+
###### Show the version in a page title:
|
|
107
|
+
```yaml
|
|
108
|
+
title:
|
|
109
|
+
_string.concat:
|
|
110
|
+
- { _app: name }
|
|
111
|
+
- ' v'
|
|
112
|
+
- { _app: version }
|
|
113
|
+
```
|
|
114
|
+
Returns: e.g. `"My App v1.2.3"`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# _args
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(key: string): any
|
|
5
|
+
(key: integer): any
|
|
6
|
+
(all: boolean): any
|
|
7
|
+
(arguments: {
|
|
8
|
+
all?: boolean,
|
|
9
|
+
key?: string | integer,
|
|
10
|
+
default?: any
|
|
11
|
+
}): any
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `_args` operator gets a value from the `arguments` array passed to a function operator. The `arguments` array is an array of all the positional arguments passed to the function.
|
|
15
|
+
|
|
16
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
17
|
+
|
|
18
|
+
#### Arguments
|
|
19
|
+
|
|
20
|
+
###### string
|
|
21
|
+
If the `_args` operator is called with a string argument, the value of the key in the `arguments` array is returned. If the value is not found, `null` is returned. Dot notation and [block list indexes](/lists) are supported.
|
|
22
|
+
|
|
23
|
+
###### integer
|
|
24
|
+
If the `_args` operator is called with a integer argument, the value at that index in the `arguments` array is returned. If the value is not found, `null` is returned. Dot notation and [block list indexes](/lists) are supported.
|
|
25
|
+
|
|
26
|
+
###### boolean
|
|
27
|
+
If the `_args` operator is called with boolean argument `true`, the entire `arguments` array is returned.
|
|
28
|
+
|
|
29
|
+
###### object
|
|
30
|
+
- `all: boolean`: If `all` is set to `true`, the entire `arguments` array is returned. One of `all` or `key` are required.
|
|
31
|
+
- `key: string | integer`: The value of the key or index in the `arguments` array is returned. If the value is not found, `null`, or the specified default value is returned. Dot notation and [block list indexes](/lists) are supported. One of `all` or `key` are required.
|
|
32
|
+
- `default: any`: A value to return if the `key` is not found in `arguments`. By default, `null` is returned if a value is not found.
|
|
33
|
+
|
|
34
|
+
#### Examples
|
|
35
|
+
|
|
36
|
+
###### Map over an array:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
_array.map:
|
|
40
|
+
on:
|
|
41
|
+
- firstName: Ted
|
|
42
|
+
lastName: Mosby
|
|
43
|
+
- firstName: Robin
|
|
44
|
+
lastName: Scherbatsky
|
|
45
|
+
- firstName: Marshall
|
|
46
|
+
lastName: Eriksen
|
|
47
|
+
- firstName: Lily
|
|
48
|
+
lastName: Aldrin
|
|
49
|
+
- firstName: Barney
|
|
50
|
+
lastName: Stinson
|
|
51
|
+
callback:
|
|
52
|
+
_function:
|
|
53
|
+
__string.concat:
|
|
54
|
+
- __args: 0.firstName
|
|
55
|
+
- ' '
|
|
56
|
+
- __args: 0.lastName
|
|
57
|
+
```
|
|
58
|
+
Returns:
|
|
59
|
+
```yaml
|
|
60
|
+
- Ted Mosby
|
|
61
|
+
- Robin Scherbatsky
|
|
62
|
+
- Marshall Eriksen
|
|
63
|
+
- Lily Aldrin
|
|
64
|
+
- Barney Stinson
|
|
65
|
+
```
|