@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,117 @@
|
|
|
1
|
+
# _nunjucks
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(template: string): string
|
|
5
|
+
(arguments: {template: string, on: object}): string
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
The `_nunjucks` hydrates a [Nunjucks](https://mozilla.github.io/nunjucks/) template.
|
|
9
|
+
|
|
10
|
+
If called with a string argument, the template variables are the values in `state`. Otherwise template variables can be specified using the `on` argument.
|
|
11
|
+
|
|
12
|
+
#### Arguments
|
|
13
|
+
|
|
14
|
+
###### string
|
|
15
|
+
The template to hydrate. The template variables used are the values in state
|
|
16
|
+
|
|
17
|
+
###### object
|
|
18
|
+
- `template: string`: The template to hydrate.
|
|
19
|
+
- `on: object`: The template variables to use when hydrating the template.
|
|
20
|
+
|
|
21
|
+
#### Examples
|
|
22
|
+
|
|
23
|
+
###### Populate a template from values in `state`:
|
|
24
|
+
```yaml
|
|
25
|
+
_nunjucks: Hello {{ name }}
|
|
26
|
+
```
|
|
27
|
+
Returns: `"Hello Steven"` if the value of name in state is `"Steven"`.
|
|
28
|
+
|
|
29
|
+
###### Populate a markdown template with different values:
|
|
30
|
+
Assuming `get_items` returns:
|
|
31
|
+
```yaml
|
|
32
|
+
- name: Coca Cola
|
|
33
|
+
description: The original.
|
|
34
|
+
- name: Pepsi
|
|
35
|
+
description: The same but different.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
_nunjucks:
|
|
40
|
+
template: |
|
|
41
|
+
### {{ title }}
|
|
42
|
+
|
|
43
|
+
{% for item in item_list %}
|
|
44
|
+
- {{ item.name }}: {{ item.description }}
|
|
45
|
+
{% endfor %}
|
|
46
|
+
on:
|
|
47
|
+
title: Soft drinks
|
|
48
|
+
items:
|
|
49
|
+
_request: get_items
|
|
50
|
+
```
|
|
51
|
+
Returns:
|
|
52
|
+
```markdown
|
|
53
|
+
### Soft drinks
|
|
54
|
+
|
|
55
|
+
- Coca Cola: The original.
|
|
56
|
+
- Pepsi: The same but different.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
###### Make use of the _nunjucks date filter:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
_nunjucks:
|
|
63
|
+
template: {{ date | date('D MMM YYYY') }}
|
|
64
|
+
on:
|
|
65
|
+
date:
|
|
66
|
+
_date: 2022-08-01
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Returns: `"1 Aug 2022"`
|
|
70
|
+
|
|
71
|
+
The `_nunjucks` date filter formats dates using the [Day.js](https://day.js.org/docs/en/display/format) library.
|
|
72
|
+
|
|
73
|
+
###### Use the _nunjucks unique filter:
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
_nunjucks:
|
|
77
|
+
template: |
|
|
78
|
+
<div>
|
|
79
|
+
{% set uniqueArray = array | unique %}
|
|
80
|
+
{% for item in uniqueArray %}
|
|
81
|
+
<p>{{ item }}</p>
|
|
82
|
+
{% endfor %}
|
|
83
|
+
</div>
|
|
84
|
+
on:
|
|
85
|
+
array:
|
|
86
|
+
- South Africa
|
|
87
|
+
- New Zealand
|
|
88
|
+
- Australia
|
|
89
|
+
- South Africa
|
|
90
|
+
- Pakistan
|
|
91
|
+
- India
|
|
92
|
+
- India
|
|
93
|
+
```
|
|
94
|
+
Returns:
|
|
95
|
+
```html
|
|
96
|
+
<div>
|
|
97
|
+
<p>South Africa</p>
|
|
98
|
+
<p>New Zealand</p>
|
|
99
|
+
<p>Australia</p>
|
|
100
|
+
<p>Pakistan</p>
|
|
101
|
+
<p>India</p>
|
|
102
|
+
</div>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
###### Make use of the _nunjucks urlQuery filter:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
_nunjucks:
|
|
109
|
+
template: {{ url | urlQuery(params) | safe }}
|
|
110
|
+
on:
|
|
111
|
+
url: www.lowdefy.com
|
|
112
|
+
params:
|
|
113
|
+
id: 1234
|
|
114
|
+
type: example
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Returns: `"www.lowdefy.com?id=1234&type=example"`
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# _object
|
|
2
|
+
|
|
3
|
+
The `_object` operator can be used to run javascript [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) methods.
|
|
4
|
+
|
|
5
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
6
|
+
|
|
7
|
+
# Operator methods:
|
|
8
|
+
|
|
9
|
+
## _object.assign
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
(objs: obj[]): object
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `_object.assign` method copies the values of one ore more source objects to a target objects. The first object in the arguments array is the target object, and the rest are source objects. Keys in the target object are overwritten. The result of `_object.assign` can be seen as a "shallow-merge" of all the objects in the array, with the values in later objects taken preferentially.
|
|
16
|
+
|
|
17
|
+
#### Arguments
|
|
18
|
+
|
|
19
|
+
###### array
|
|
20
|
+
An array of objects.
|
|
21
|
+
|
|
22
|
+
#### Examples
|
|
23
|
+
|
|
24
|
+
###### Merge three objects:
|
|
25
|
+
```yaml
|
|
26
|
+
_object.assign:
|
|
27
|
+
- firstName: Rachel
|
|
28
|
+
lastName: Green
|
|
29
|
+
series: Friends
|
|
30
|
+
- firstName: Monica
|
|
31
|
+
lastName: Geller
|
|
32
|
+
address:
|
|
33
|
+
street: 90 Bedford St
|
|
34
|
+
city: New York
|
|
35
|
+
zipCode: '10014'
|
|
36
|
+
country: US
|
|
37
|
+
- friends:
|
|
38
|
+
- Ross Geller
|
|
39
|
+
- Rachel Green
|
|
40
|
+
- Chandler Bing
|
|
41
|
+
- Phoebe Buffay
|
|
42
|
+
- Joey Tribbiani
|
|
43
|
+
```
|
|
44
|
+
Returns:
|
|
45
|
+
```yaml
|
|
46
|
+
firstName: Monica
|
|
47
|
+
lastName: Geller
|
|
48
|
+
series: Friends
|
|
49
|
+
address:
|
|
50
|
+
street: 90 Bedford St
|
|
51
|
+
city: New York
|
|
52
|
+
zipCode: '10014'
|
|
53
|
+
country: US
|
|
54
|
+
friends:
|
|
55
|
+
- Ross Geller
|
|
56
|
+
- Rachel Green
|
|
57
|
+
- Chandler Bing
|
|
58
|
+
- Phoebe Buffay
|
|
59
|
+
- Joey Tribbiani
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## _object.defineProperty
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
(arguments: {
|
|
66
|
+
on: object,
|
|
67
|
+
key: string,
|
|
68
|
+
descriptor: {
|
|
69
|
+
value: any,
|
|
70
|
+
configurable?: boolean,
|
|
71
|
+
enumerable?: boolean,
|
|
72
|
+
writable?: boolean
|
|
73
|
+
}
|
|
74
|
+
}): any
|
|
75
|
+
(arguments: [
|
|
76
|
+
on: object,
|
|
77
|
+
key: string,
|
|
78
|
+
descriptor: {
|
|
79
|
+
value: any,
|
|
80
|
+
configurable?: boolean,
|
|
81
|
+
enumerable?: boolean,
|
|
82
|
+
writable?: boolean
|
|
83
|
+
}
|
|
84
|
+
]): any
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The `_object.defineProperty` method defines a new property directly on an object, or modifies an existing property on an object, and returns the object. The first object in the arguments array, or the `on` parameter, is the target object to which the property will be applied. The second argument, or the `key` parameter, is the property name or key which will be applied to the target object. The third and last object argument, or the `descriptor` parameter, has serval options to consider, however, for the most common application set the `value` object key to the value that should be applied to the target object key. See [Object.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) for a more detailed description.
|
|
88
|
+
|
|
89
|
+
> The `_object.defineProperty` method is handy when the `key` to set is variable.
|
|
90
|
+
|
|
91
|
+
#### Examples
|
|
92
|
+
|
|
93
|
+
###### Set a value to a object key:
|
|
94
|
+
```yaml
|
|
95
|
+
_object.defineProperty:
|
|
96
|
+
on:
|
|
97
|
+
firstName: Rachel
|
|
98
|
+
series: Friends
|
|
99
|
+
key: lastName
|
|
100
|
+
descriptor:
|
|
101
|
+
value: Green
|
|
102
|
+
```
|
|
103
|
+
Returns:
|
|
104
|
+
```yaml
|
|
105
|
+
firstName: Rachel
|
|
106
|
+
lastName: Green
|
|
107
|
+
series: Friends
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## _object.entries
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
(obj: object): any[]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The `_object.entries` method returns an array with an array of key-values pairs of all the fields in an object.
|
|
117
|
+
|
|
118
|
+
#### Arguments
|
|
119
|
+
|
|
120
|
+
###### object
|
|
121
|
+
The object to get entries from.
|
|
122
|
+
|
|
123
|
+
#### Examples
|
|
124
|
+
|
|
125
|
+
###### Get the entries of an object:
|
|
126
|
+
```yaml
|
|
127
|
+
_object.entries:
|
|
128
|
+
firstName: Monica
|
|
129
|
+
lastName: Geller
|
|
130
|
+
```
|
|
131
|
+
Returns:
|
|
132
|
+
```yaml
|
|
133
|
+
- - firstName
|
|
134
|
+
- Monica
|
|
135
|
+
- - lastName
|
|
136
|
+
- Geller
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## _object.fromEntries
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
(array: any[][]): object
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The `_object.fromEntries` method creates an object from an array of key-value pairs.
|
|
146
|
+
|
|
147
|
+
#### Arguments
|
|
148
|
+
|
|
149
|
+
###### array
|
|
150
|
+
The array of key-value pairs.
|
|
151
|
+
|
|
152
|
+
#### Examples
|
|
153
|
+
|
|
154
|
+
###### Get the entries of an object:
|
|
155
|
+
```yaml
|
|
156
|
+
_object.fromEntries:
|
|
157
|
+
- - firstName
|
|
158
|
+
- Monica
|
|
159
|
+
- - lastName
|
|
160
|
+
- Geller
|
|
161
|
+
```
|
|
162
|
+
Returns:
|
|
163
|
+
```yaml
|
|
164
|
+
firstName: Monica
|
|
165
|
+
lastName: Geller
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## _object.keys
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
(obj: object): string[]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The `_object.keys` method returns an array with the objects keys.
|
|
175
|
+
|
|
176
|
+
#### Arguments
|
|
177
|
+
|
|
178
|
+
###### object
|
|
179
|
+
The object to get keys from.
|
|
180
|
+
|
|
181
|
+
#### Examples
|
|
182
|
+
|
|
183
|
+
###### Get the keys of an object:
|
|
184
|
+
```yaml
|
|
185
|
+
_object.keys:
|
|
186
|
+
firstName: Monica
|
|
187
|
+
lastName: Geller
|
|
188
|
+
address:
|
|
189
|
+
street: 90 Bedford St
|
|
190
|
+
city: New York
|
|
191
|
+
zipCode: '10014'
|
|
192
|
+
country: US
|
|
193
|
+
friends:
|
|
194
|
+
- Ross Geller
|
|
195
|
+
- Rachel Green
|
|
196
|
+
- Chandler Bing
|
|
197
|
+
- Phoebe Buffay
|
|
198
|
+
- Joey Tribbiani
|
|
199
|
+
```
|
|
200
|
+
Returns:
|
|
201
|
+
```yaml
|
|
202
|
+
- firstName
|
|
203
|
+
- lastName
|
|
204
|
+
- address
|
|
205
|
+
- friends
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## _object.values
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
(obj: object): any[]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The `_object.values` method returns an array with the values of all the fields in an object.
|
|
215
|
+
|
|
216
|
+
#### Arguments
|
|
217
|
+
|
|
218
|
+
###### object
|
|
219
|
+
The object to get values from.
|
|
220
|
+
|
|
221
|
+
#### Examples
|
|
222
|
+
|
|
223
|
+
###### Get the values of an object:
|
|
224
|
+
```yaml
|
|
225
|
+
_object.values:
|
|
226
|
+
firstName: Monica
|
|
227
|
+
lastName: Geller
|
|
228
|
+
address:
|
|
229
|
+
street: 90 Bedford St
|
|
230
|
+
city: New York
|
|
231
|
+
zipCode: '10014'
|
|
232
|
+
country: US
|
|
233
|
+
friends:
|
|
234
|
+
- Ross Geller
|
|
235
|
+
- Rachel Green
|
|
236
|
+
- Chandler Bing
|
|
237
|
+
- Phoebe Buffay
|
|
238
|
+
- Joey Tribbiani
|
|
239
|
+
```
|
|
240
|
+
Returns:
|
|
241
|
+
```yaml
|
|
242
|
+
- Monica
|
|
243
|
+
- Geller
|
|
244
|
+
- street: 90 Bedford St
|
|
245
|
+
city: New York
|
|
246
|
+
zipCode: '10014'
|
|
247
|
+
country: US
|
|
248
|
+
- - Ross Geller
|
|
249
|
+
- Rachel Green
|
|
250
|
+
- Chandler Bing
|
|
251
|
+
- Phoebe Buffay
|
|
252
|
+
- Joey Tribbiani
|
|
253
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# _operator
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(arguments: {operator: string, params: any): any
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_operator` operator evaluates an operator with the given params. This is useful if the operator needs to be chosen dynamically. The `_operator` cannot evaluate itself.
|
|
8
|
+
|
|
9
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
10
|
+
|
|
11
|
+
#### Arguments
|
|
12
|
+
|
|
13
|
+
###### object
|
|
14
|
+
- `operator: string`: The name of the operator to evaluate.
|
|
15
|
+
- `params: any`: The params to give to the operator.
|
|
16
|
+
|
|
17
|
+
#### Examples
|
|
18
|
+
|
|
19
|
+
###### Get a value from `urlQuery` if specified, else use the value in `state`:
|
|
20
|
+
```yaml
|
|
21
|
+
_operator:
|
|
22
|
+
operator:
|
|
23
|
+
_if:
|
|
24
|
+
test:
|
|
25
|
+
_eq:
|
|
26
|
+
- _state: location_selector
|
|
27
|
+
- url_query
|
|
28
|
+
then: _url_query
|
|
29
|
+
else: _state
|
|
30
|
+
params:
|
|
31
|
+
key: field_to_get
|
|
32
|
+
```
|
|
33
|
+
Returns: Value from `urlQuery` if `location_selector == url_query`, else the value from `state`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# _or
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(values: any[]): boolean
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_or` operator performs a logical `or` 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 returns true if any of the values in the array are truthy (not `false`, `0`, `null`, `undefined`, or the empty string `""`). If all the values are falsy, 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 or.
|
|
17
|
+
|
|
18
|
+
#### Examples
|
|
19
|
+
|
|
20
|
+
###### `true` and `false` values:
|
|
21
|
+
```yaml
|
|
22
|
+
_or:
|
|
23
|
+
- true
|
|
24
|
+
- false
|
|
25
|
+
```
|
|
26
|
+
Returns: `true`
|
|
27
|
+
|
|
28
|
+
###### Array of `true` and `false` values:
|
|
29
|
+
```yaml
|
|
30
|
+
_or:
|
|
31
|
+
- true
|
|
32
|
+
- false
|
|
33
|
+
- false
|
|
34
|
+
- false
|
|
35
|
+
```
|
|
36
|
+
Returns: `true`
|
|
37
|
+
|
|
38
|
+
###### Falsy values values:
|
|
39
|
+
```yaml
|
|
40
|
+
_or:
|
|
41
|
+
- null
|
|
42
|
+
- 0
|
|
43
|
+
- ''
|
|
44
|
+
```
|
|
45
|
+
Returns: `false`
|
|
46
|
+
|
|
47
|
+
###### Truthy values:
|
|
48
|
+
```yaml
|
|
49
|
+
_or:
|
|
50
|
+
- false
|
|
51
|
+
- "Hello"
|
|
52
|
+
```
|
|
53
|
+
Returns: `true`
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
_or:
|
|
57
|
+
- false
|
|
58
|
+
- 99
|
|
59
|
+
```
|
|
60
|
+
Returns: `true`
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
_or:
|
|
64
|
+
- false
|
|
65
|
+
- [1,2,3]
|
|
66
|
+
```
|
|
67
|
+
Returns: `true`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# _product
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(values: any[]): number
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_product` operator takes the product of the values given as input. If a value is not a number, the value is skipped.
|
|
8
|
+
|
|
9
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
10
|
+
|
|
11
|
+
#### Arguments
|
|
12
|
+
|
|
13
|
+
###### array
|
|
14
|
+
An array of values to multiply.
|
|
15
|
+
|
|
16
|
+
#### Examples
|
|
17
|
+
|
|
18
|
+
###### Two numbers:
|
|
19
|
+
```yaml
|
|
20
|
+
_product:
|
|
21
|
+
- 3
|
|
22
|
+
- 4
|
|
23
|
+
```
|
|
24
|
+
Returns: `12`
|
|
25
|
+
|
|
26
|
+
###### Array of numbers:
|
|
27
|
+
```yaml
|
|
28
|
+
_product:
|
|
29
|
+
- 1
|
|
30
|
+
- 2
|
|
31
|
+
- 3
|
|
32
|
+
- 4
|
|
33
|
+
```
|
|
34
|
+
Returns: `24`
|
|
35
|
+
|
|
36
|
+
###### Non-numbers are skipped:
|
|
37
|
+
```yaml
|
|
38
|
+
_product:
|
|
39
|
+
- 1
|
|
40
|
+
- null
|
|
41
|
+
- 3
|
|
42
|
+
- "four"
|
|
43
|
+
- 5
|
|
44
|
+
```
|
|
45
|
+
Returns: `15`
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# _random
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(type: string): string | number
|
|
5
|
+
(arguments: {
|
|
6
|
+
type: string,
|
|
7
|
+
length?: number,
|
|
8
|
+
max?: number,
|
|
9
|
+
min?: number
|
|
10
|
+
}): string | number
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The `_random` operator returns a random string or number. The types it accepts are `string`, `integer`, or `float`.
|
|
14
|
+
|
|
15
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
16
|
+
|
|
17
|
+
#### Arguments
|
|
18
|
+
|
|
19
|
+
###### string
|
|
20
|
+
The type to generate. One of `string`, `integer`, or `float`.
|
|
21
|
+
|
|
22
|
+
###### object
|
|
23
|
+
- `type: string`: __Required__ - The type to generate. One of `string`, `integer`, or `float`.
|
|
24
|
+
- `length: string`: The length of the string to generate if type is `string`. Default is `8`.
|
|
25
|
+
- `max: number`: The maximum possible number if type is one of `integer` or `float`. Default is `100` if `integer` or `1` if `float`.
|
|
26
|
+
- `min: number`: The minimum possible number if type is one of `integer` or `float`. Default is `0`.
|
|
27
|
+
|
|
28
|
+
#### Examples
|
|
29
|
+
|
|
30
|
+
###### Random string:
|
|
31
|
+
```yaml
|
|
32
|
+
_random: string
|
|
33
|
+
```
|
|
34
|
+
Returns: Random string of length 8.
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
_random:
|
|
38
|
+
type: string
|
|
39
|
+
```
|
|
40
|
+
Returns: Random string of length 8.
|
|
41
|
+
|
|
42
|
+
###### Random integer:
|
|
43
|
+
```yaml
|
|
44
|
+
_random: integer
|
|
45
|
+
```
|
|
46
|
+
Returns: Random integer between 0 and 100 inclusive.
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
_random:
|
|
50
|
+
type: integer
|
|
51
|
+
```
|
|
52
|
+
Returns: Random integer between 0 and 100 inclusive.
|
|
53
|
+
|
|
54
|
+
###### Random float:
|
|
55
|
+
```yaml
|
|
56
|
+
_random: float
|
|
57
|
+
```
|
|
58
|
+
Returns: Random float between 0 and 1 inclusive.
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
_random:
|
|
62
|
+
type: float
|
|
63
|
+
```
|
|
64
|
+
Returns: Random float between 0 and 1 inclusive.
|
|
65
|
+
|
|
66
|
+
###### Random string of length 12:
|
|
67
|
+
```yaml
|
|
68
|
+
_random:
|
|
69
|
+
type: string
|
|
70
|
+
length: 12
|
|
71
|
+
```
|
|
72
|
+
Returns: Random string of length 12.
|
|
73
|
+
|
|
74
|
+
###### Random integer between 1 and 6 (Dice roll):
|
|
75
|
+
```yaml
|
|
76
|
+
_random:
|
|
77
|
+
type: integer
|
|
78
|
+
min: 1
|
|
79
|
+
max: 6
|
|
80
|
+
```
|
|
81
|
+
Returns: Random integer between 1 and 6 inclusive.
|
|
82
|
+
|
|
83
|
+
###### Random float between 34.2 and 42.89:
|
|
84
|
+
```yaml
|
|
85
|
+
_random:
|
|
86
|
+
type: float
|
|
87
|
+
min: 34.2
|
|
88
|
+
max: 42.89
|
|
89
|
+
```
|
|
90
|
+
Returns: Random float between 34.2 and 42.89 inclusive.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# _ref
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(path: string): any
|
|
5
|
+
(arguments: {
|
|
6
|
+
path?: string,
|
|
7
|
+
key?: string,
|
|
8
|
+
resolver?: string,
|
|
9
|
+
transformer?: string,
|
|
10
|
+
vars?: object,
|
|
11
|
+
}): any
|
|
12
|
+
(arguments: {
|
|
13
|
+
module: string,
|
|
14
|
+
component: string,
|
|
15
|
+
vars?: object,
|
|
16
|
+
key?: string,
|
|
17
|
+
}): any
|
|
18
|
+
(arguments: {
|
|
19
|
+
module: string,
|
|
20
|
+
menu: string,
|
|
21
|
+
}): object[]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The `_ref` operator can be used to reference a configuration file, in order to split the Lowdefy configuration into multiple files. More information on references and the Lowdefy configuration schema can be found [here](/lowdefy-schema).
|
|
25
|
+
|
|
26
|
+
> The `_ref` operator is a build time operator: it is evaluated when the app configuration is being built. This means it is not evaluated dynamically as the app is running, and can be used anywhere in the configuration as long as the resulting configuration files are valid YAML.
|
|
27
|
+
|
|
28
|
+
The `_ref` operator requires a file path to the file to be referenced, relative to the root directory of the project.
|
|
29
|
+
|
|
30
|
+
If this file is a YAML or JSON file, and has file extension `.yaml`, `.yml`, or `.json`, the file is parsed as YAML/JSON, and the parsed result is included in the configuration.
|
|
31
|
+
|
|
32
|
+
If this file is a Nunjucks template file, with file extension `.njk`, the file is parsed as a Nunjucks template, using any variables provided in the `vars` argument. If the file extension is `.yaml.njk`, `.yml.njk` or `.json.njk`, the template output is also parsed as YAML/JSON.
|
|
33
|
+
|
|
34
|
+
If the file is not parsed (for example has an extension like `.txt`, `.md`, or `.html`), the file contents are included in the configuration as a string.
|
|
35
|
+
|
|
36
|
+
If the referenced file is a YAML or JSON file, the `key` argument can be used to reference a specific key inside that file, instead of the whole file.
|
|
37
|
+
|
|
38
|
+
###### Variables
|
|
39
|
+
|
|
40
|
+
Variables defined in the `vars` argument can be accessed in the referenced file using the [`_var`](/_var), and as template variables in Nunjucks files.
|
|
41
|
+
|
|
42
|
+
###### Resolver
|
|
43
|
+
|
|
44
|
+
A resolver is a JavaScript function that overwrites the default way configuration files are read from the filesystem. It does not need to read from the filesystem, it could generate a value to return programmatically, or it could fetch the configuration using HTTP (from Github for example). The `resolver` argument should be the file path (relative to the root of the project) to a JavaScript file that exports a resolver function.
|
|
45
|
+
|
|
46
|
+
The resolver function receives the `path`, `vars`, and a `context` object as arguments. If a resolver function is specified, the `path` argument to the `_ref` operator is optional, and does not need to correspond to a path to a file. If `path` ends with `.yaml`, `.yml`, `.json`, `.njk`, `.yaml.njk`, `.yml.njk`, or `.json.njk`, the returned result will be parsed as YAML/JSON/Nunjucks template.
|
|
47
|
+
|
|
48
|
+
A default `_ref` resolver can be specified in the `lowdefy.yaml` `cli` section (as `refResolver`), or as a command-line option when running the CLI (as `--ref-resolver`). This resolver will then be used for all references in the app, unless another resolver is specified.
|
|
49
|
+
|
|
50
|
+
###### Transformer
|
|
51
|
+
|
|
52
|
+
A transformer is a JavaScript function that receives the result of the `_ref` operator, and its `vars` as arguments. The value returned by this function will be included in the configuration as the final result of the `_ref` operator. The `transformer` argument should be the file path (relative to the root of the project) to a JavaScript file that exports a transformer function.
|
|
53
|
+
|
|
54
|
+
###### CommonJS and ES Modules
|
|
55
|
+
|
|
56
|
+
Both [CommonJS](https://nodejs.org/api/modules.html) and [ES Modules](https://nodejs.org/api/esm.html) are supported for in resolver and transformer functions. By default the functions are imported as CommonJs modules, and the function should be exported as a default export (`module.exports = transformer`). Files can also use the `.cjs` file extension to indicate they are CommonJs modules.
|
|
57
|
+
|
|
58
|
+
To use ES Modules, either use files with `.mjs` file extension, or add a `package.json` in the project directory file with `"type": "module"` set. When using ES Modules, the functions should also be a default export (`export default transformer;`)
|
|
59
|
+
|
|
60
|
+
#### Arguments
|
|
61
|
+
|
|
62
|
+
###### string
|
|
63
|
+
The file path to the referenced file, from the root of the project directory.
|
|
64
|
+
|
|
65
|
+
###### object
|
|
66
|
+
- `path: string`: The file path to the referenced file, from the root of the project directory. If no `resolver` is specified, `path` is required.
|
|
67
|
+
- `key: string`: Only include the content at the specified key, instead of the entire file content. Dot notation is supported. This can only be used with YAML or JSON files.
|
|
68
|
+
- `resolver: string`: The file path to a JavaScript file, from the root of the project directory, that exports a resolver function.
|
|
69
|
+
- `transformer: string`: The file path to a JavaScript file, from the root of the project directory, that exports a transformer function.
|
|
70
|
+
- `vars: object`: An object to be used as variables for the `_var` operator in the referenced file, and as template variables in Nunjucks template files.
|
|
71
|
+
- `module: string`: The module entry ID (as defined in `lowdefy.yaml` `modules` array). When `module` is specified, `path` is not used — the reference resolves from the module's exported components or menus. See [Modules](/modules).
|
|
72
|
+
- `component: string`: The component name exported by the module (defined in `module.lowdefy.yaml` `components` array). Used with `module`.
|
|
73
|
+
- `menu: string`: The menu ID exported by the module (defined in `module.lowdefy.yaml` `menus` array). Used with `module`. Returns the menu's `links` array.
|
|
74
|
+
- `key: string`: Dot-notation path to extract from the resolved content. Works for both file refs and module component refs.
|
|
75
|
+
|
|
76
|
+
> When referencing a module component, `vars` are accessed via `_var` inside the component (same as standard `_ref`). Module-level configuration is accessed via [`_module.var`](/_module). Both are available simultaneously.
|
|
77
|
+
|
|
78
|
+
> Within module content, the `module` field can reference a declared dependency name (from the module's `dependencies` in `module.lowdefy.yaml`). The build resolves abstract names to concrete entry IDs via the dependency wiring. From app-level config, `module` is always a concrete entry ID.
|
|
79
|
+
|
|
80
|
+
#### Examples
|