@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,331 @@
|
|
|
1
|
+
# _array
|
|
2
|
+
|
|
3
|
+
The `_array` operator can be used to run javascript [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) methods.
|
|
4
|
+
|
|
5
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
6
|
+
|
|
7
|
+
# Operator methods:
|
|
8
|
+
|
|
9
|
+
## _array.concat
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
(arrays: any[][]): any[]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `_array.concat` method [concatenates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) arrays.
|
|
16
|
+
|
|
17
|
+
## _array.copyWithin
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
(arguments: {
|
|
21
|
+
on: any[],
|
|
22
|
+
target: number,
|
|
23
|
+
start?: number,
|
|
24
|
+
end?: number
|
|
25
|
+
}): any[]
|
|
26
|
+
(arguments: [
|
|
27
|
+
on: any[],
|
|
28
|
+
target: number,
|
|
29
|
+
start?: number,
|
|
30
|
+
end?: number
|
|
31
|
+
]): any[]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The `_array.copyWithin` method [copies part of an array to another location in the same array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) without modifying its length.
|
|
35
|
+
|
|
36
|
+
## _array.every
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
(arguments: {
|
|
40
|
+
on: any[],
|
|
41
|
+
callback: function,
|
|
42
|
+
}): boolean
|
|
43
|
+
(arguments: [
|
|
44
|
+
on: any[],
|
|
45
|
+
callback: function,
|
|
46
|
+
]): boolean
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The `_array.every` method tests whether [all elements in the array pass](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) the test implemented by the provided function. It returns a Boolean value.
|
|
50
|
+
|
|
51
|
+
## _array.fill
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
(arguments: {
|
|
55
|
+
on: any[],
|
|
56
|
+
value: any,
|
|
57
|
+
start?: number,
|
|
58
|
+
end?: number
|
|
59
|
+
}): any[]
|
|
60
|
+
(arguments: [
|
|
61
|
+
on: any[],
|
|
62
|
+
value: number,
|
|
63
|
+
start?: number,
|
|
64
|
+
end?: number
|
|
65
|
+
]): any[]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The `_array.fill` method [changes all elements in an array to a static value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill), from a `start` index to an `end` index.
|
|
69
|
+
|
|
70
|
+
## _array.filter
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
(arguments: {
|
|
74
|
+
on: any[],
|
|
75
|
+
callback: function,
|
|
76
|
+
}): any[]
|
|
77
|
+
(arguments: [
|
|
78
|
+
on: any[],
|
|
79
|
+
callback: function,
|
|
80
|
+
]): any[]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The `_array.filter` method returns [an array with all elements that pass the test](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) implemented by the provided function.
|
|
84
|
+
|
|
85
|
+
## _array.find
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
(arguments: {
|
|
89
|
+
on: any[],
|
|
90
|
+
callback: function,
|
|
91
|
+
}): any
|
|
92
|
+
(arguments: [
|
|
93
|
+
on: any[],
|
|
94
|
+
callback: function,
|
|
95
|
+
]): any
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The `_array.find` method returns the value of the [first element in the provided array that satisfies the provided testing function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find). If no values satisfies the testing function, undefined is returned.
|
|
99
|
+
|
|
100
|
+
## _array.findIndex
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
(arguments: {
|
|
104
|
+
on: any[],
|
|
105
|
+
callback: function,
|
|
106
|
+
}): number
|
|
107
|
+
(arguments: [
|
|
108
|
+
on: any[],
|
|
109
|
+
callback: function,
|
|
110
|
+
]): number
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The `_array.findIndex` method returns [the index of the first element in the array that satisfies the provided testing function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex). Otherwise, it returns -1, indicating that no element passed the test.
|
|
114
|
+
|
|
115
|
+
## _array.flat
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
(arguments: {on: any[], depth?: number}): any[]
|
|
119
|
+
(arguments: [on: any[], depth?: number]): any[]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The `_array.flat` method returns a array with all [sub-array elements concatenated into it recursively](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) up to the specified `depth`.
|
|
123
|
+
|
|
124
|
+
## _array.includes
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
(arguments: {on: any[], value: any}): boolean
|
|
128
|
+
(arguments: [on: any[], value: any]): boolean
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The `_array.includes` method determines whether an array [includes a certain value among its entries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes), returning `true` or `false` as appropriate.
|
|
132
|
+
|
|
133
|
+
## _array.indexOf
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
(arguments: {on: any[], value: any}): number
|
|
137
|
+
(arguments: [on: any[], value: any]): number
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The `_array.indexOf` method returns the [first index at which a given element can be found](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) in the array, or `-1` if it is not present.
|
|
141
|
+
|
|
142
|
+
## _array.join
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
(arguments: {on: any[], separator?: string}): string
|
|
146
|
+
(arguments: [on: any[], separator?: string]): string
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The `_array.join` method returns [a string by concatenating all of the elements in an array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join), separated by commas or a specified `separator` string. If the array has only one item, then that item will be returned without using the separator.
|
|
150
|
+
|
|
151
|
+
## _array.lastIndexOf
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
(arguments: {on: any[], value: any}): number
|
|
155
|
+
(arguments: [on: any[], value: any]): number
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The `_array.lastIndexOf` method returns the [last index at which a given element can be found](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf) in the array, or -1 if it is not present.
|
|
159
|
+
|
|
160
|
+
## _array.length
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
(array: any[]}): number
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `_array.length` method returns the [number of elements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) in the array.
|
|
167
|
+
|
|
168
|
+
## _array.map
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
(arguments: {
|
|
172
|
+
on: any[],
|
|
173
|
+
callback: function,
|
|
174
|
+
}): any[]
|
|
175
|
+
(arguments: [
|
|
176
|
+
on: any[],
|
|
177
|
+
callback: function,
|
|
178
|
+
]): any[]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The `_array.map` method returns an array populated with the results of [calling a provided function on every element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) in the provided array.
|
|
182
|
+
|
|
183
|
+
## _array.reduce
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
(arguments: {
|
|
187
|
+
on: any[],
|
|
188
|
+
callback: function,
|
|
189
|
+
initialValue?: any
|
|
190
|
+
}): any
|
|
191
|
+
(arguments: [
|
|
192
|
+
on: any[],
|
|
193
|
+
callback: function,
|
|
194
|
+
initialValue?: any
|
|
195
|
+
]): any
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The `_array.reduce` method [executes a reducer function on each element of the array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce), resulting in single output value.
|
|
199
|
+
|
|
200
|
+
#### Examples
|
|
201
|
+
|
|
202
|
+
The simplest example would probably be adding all the elements in an array:
|
|
203
|
+
```yaml
|
|
204
|
+
sum:
|
|
205
|
+
_array.reduce:
|
|
206
|
+
on: [1, 2, 3, 4]
|
|
207
|
+
callback:
|
|
208
|
+
_function:
|
|
209
|
+
__sum:
|
|
210
|
+
- __args: 0
|
|
211
|
+
- __args: 1
|
|
212
|
+
```
|
|
213
|
+
This will return `sum: 10`
|
|
214
|
+
|
|
215
|
+
You can start off by counting from 10 by specifying an `initialValue` for the reducer:
|
|
216
|
+
```yaml
|
|
217
|
+
sum:
|
|
218
|
+
_array.reduce:
|
|
219
|
+
on: [1, 2, 3, 4]
|
|
220
|
+
callback:
|
|
221
|
+
_function:
|
|
222
|
+
__sum:
|
|
223
|
+
- __args: 0
|
|
224
|
+
- __args: 1
|
|
225
|
+
initialValue: 10
|
|
226
|
+
```
|
|
227
|
+
This will return `sum: 20`
|
|
228
|
+
|
|
229
|
+
You can use the index of the array element to add some logic to your `callback`. For instance, when you reach index 2 of your array (the 3rd entry), add 100 instead of the current element value:
|
|
230
|
+
```yaml
|
|
231
|
+
sum:
|
|
232
|
+
_array.reduce:
|
|
233
|
+
on: [1, 2, 3, 4]
|
|
234
|
+
callback:
|
|
235
|
+
_function:
|
|
236
|
+
__sum:
|
|
237
|
+
- __args: 0
|
|
238
|
+
- __if:
|
|
239
|
+
test:
|
|
240
|
+
__eq:
|
|
241
|
+
- __args: 2
|
|
242
|
+
- 2
|
|
243
|
+
then: 100
|
|
244
|
+
else:
|
|
245
|
+
__args: 1
|
|
246
|
+
```
|
|
247
|
+
This will return `sum: 107`
|
|
248
|
+
|
|
249
|
+
## _array.reduceRight
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
(arguments: {
|
|
253
|
+
on: any[],
|
|
254
|
+
callback: function,
|
|
255
|
+
initialValue?: any
|
|
256
|
+
}): any
|
|
257
|
+
(arguments: [
|
|
258
|
+
on: any[],
|
|
259
|
+
callback: function,
|
|
260
|
+
initialValue?: any
|
|
261
|
+
]): any
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The `_array.reduceRight` method [applies a function against an accumulator and each value of the array (from right-to-left)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/ReduceRight) to reduce it to a single value.
|
|
265
|
+
|
|
266
|
+
## _array.reverse
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
(array: any[]}): any[]
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The `_array.reverse` method [reverses](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) an array.
|
|
273
|
+
|
|
274
|
+
## _array.slice
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
(arguments: {
|
|
278
|
+
on: any[],
|
|
279
|
+
start?: number,
|
|
280
|
+
end?: number
|
|
281
|
+
}): number
|
|
282
|
+
(arguments: [
|
|
283
|
+
on: any[],
|
|
284
|
+
start?: number,
|
|
285
|
+
end?: number
|
|
286
|
+
]): number
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The `_array.slice` method returns [a portion of an array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) selected from `start` to `end` (end not included) where `start` and `end` represent the index of items in that array.
|
|
290
|
+
|
|
291
|
+
## _array.some
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
(arguments: {
|
|
295
|
+
on: any[],
|
|
296
|
+
callback: function,
|
|
297
|
+
}): boolean
|
|
298
|
+
(arguments: [
|
|
299
|
+
on: any[],
|
|
300
|
+
callback: function,
|
|
301
|
+
]): boolean
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The `_array.some` method tests whether [at least one element in the array passes the test](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) implemented by the provided function. It returns a Boolean value.
|
|
305
|
+
|
|
306
|
+
## _array.sort
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
(arguments: {on: any[]}): number
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The `_array.sort` method [sorts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) the elements of an array. The sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.
|
|
313
|
+
|
|
314
|
+
## _array.splice
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
(arguments: {
|
|
318
|
+
on: any[],
|
|
319
|
+
start: number,
|
|
320
|
+
deleteCount?: number
|
|
321
|
+
insert: any[]
|
|
322
|
+
}): number
|
|
323
|
+
(arguments: {
|
|
324
|
+
on: any[],
|
|
325
|
+
start: number,
|
|
326
|
+
deleteCount?: number,
|
|
327
|
+
insert: any[]
|
|
328
|
+
}): number
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
The `_array.slice` method [changes the contents of an array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) by removing or replacing existing elements and/or adding new elements.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# _base64
|
|
2
|
+
|
|
3
|
+
The `_base64` operator converts strings to and from [base64](https://en.wikipedia.org/wiki/Base64) format.
|
|
4
|
+
|
|
5
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
6
|
+
|
|
7
|
+
# Operator methods:
|
|
8
|
+
|
|
9
|
+
## _base64.decode
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
(value: string): string
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `_base64.decode` method decodes base64 encoded content into an ASCII string.
|
|
16
|
+
|
|
17
|
+
#### Arguments
|
|
18
|
+
|
|
19
|
+
###### string
|
|
20
|
+
The string to decode.
|
|
21
|
+
|
|
22
|
+
#### Examples
|
|
23
|
+
|
|
24
|
+
###### Decode a base64 string:
|
|
25
|
+
```yaml
|
|
26
|
+
_base64.decode: SGVsbG8=
|
|
27
|
+
```
|
|
28
|
+
Returns: `"Hello"`.
|
|
29
|
+
|
|
30
|
+
## _base64.encode
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
(value: string): string
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The `_base64.encode` method base64 encodes a ASCII string.
|
|
37
|
+
|
|
38
|
+
#### Arguments
|
|
39
|
+
|
|
40
|
+
###### string
|
|
41
|
+
The string to encode.
|
|
42
|
+
|
|
43
|
+
#### Examples
|
|
44
|
+
|
|
45
|
+
###### Encode a string as base64:
|
|
46
|
+
```yaml
|
|
47
|
+
_base64.encode: Hello
|
|
48
|
+
```
|
|
49
|
+
Returns: `"SGVsbG8="`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# _boolean
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(value: any): boolean
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `_boolean` operator coerces the input to a boolean using javascript [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) rules. It is equivalent to a double negation (`_not` of `_not`), or the javascript `!!value` expression.
|
|
8
|
+
|
|
9
|
+
> This operator can be used as a [`_build`](/_build) operator method.
|
|
10
|
+
|
|
11
|
+
#### Arguments
|
|
12
|
+
|
|
13
|
+
###### any
|
|
14
|
+
|
|
15
|
+
#### Examples
|
|
16
|
+
|
|
17
|
+
###### Coerce a truthy value to `true`:
|
|
18
|
+
```yaml
|
|
19
|
+
_boolean: 100
|
|
20
|
+
```
|
|
21
|
+
Returns: `true`
|
|
22
|
+
|
|
23
|
+
###### Coerce a falsy value to `false`:
|
|
24
|
+
```yaml
|
|
25
|
+
_boolean: null
|
|
26
|
+
```
|
|
27
|
+
Returns: `false`
|
|
28
|
+
|
|
29
|
+
###### Coerce an empty string to `false`:
|
|
30
|
+
```yaml
|
|
31
|
+
_boolean: ''
|
|
32
|
+
```
|
|
33
|
+
Returns: `false`
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# _build
|
|
2
|
+
|
|
3
|
+
The `_build` operator evaluates at build time. This allows looping over a list in a JSON file generated by another application to calculate a value at build time, or to read environment variables.
|
|
4
|
+
|
|
5
|
+
# Operator methods:
|
|
6
|
+
|
|
7
|
+
## _build.env
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
(key: string): any
|
|
11
|
+
(all: boolean): any
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `_build.env` method reads from your environment variables. The return value of `_build.env` will form part of the build output, so the [`_secret`](/_secret) operator should rather be used for reading any secrets.
|
|
15
|
+
|
|
16
|
+
#### Examples
|
|
17
|
+
|
|
18
|
+
###### Read environment from environment variables:
|
|
19
|
+
With the following development and production environment variables, we can use the `_build.env` method to determine which environment we are in.
|
|
20
|
+
|
|
21
|
+
`Development environment .env`
|
|
22
|
+
```
|
|
23
|
+
MY_ENVIRONMENT="development"
|
|
24
|
+
```
|
|
25
|
+
`Production environment`
|
|
26
|
+
```
|
|
27
|
+
MY_ENVIRONMENT="production"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
_build.env: MY_ENVIRONMENT
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This will return "development" in the development environment and "production" in the production environment.
|
|
35
|
+
|
|
36
|
+
## _build.[operator]
|
|
37
|
+
|
|
38
|
+
The `_build` operator can be used to evaluate normal operators at build time. Note that when using an operator as a method, the `_` gets left out of the original operator. For example, when using `_and` as a method, we write `_build.and`. When using an operator which has methods itself, we can just chain the methods: `_array.map` as a method becomes `_build.array.map`.
|
|
39
|
+
|
|
40
|
+
The following operators can be used during the build:
|
|
41
|
+
- [_and](/_and)
|
|
42
|
+
- [_app](/_app)
|
|
43
|
+
- [_args](/_args)
|
|
44
|
+
- [_array](/_array)
|
|
45
|
+
- [_base64](/_base64)
|
|
46
|
+
- [_date](/_date)
|
|
47
|
+
- [_divide](/_divide)
|
|
48
|
+
- [_eq](/_eq)
|
|
49
|
+
- [_function](/_function)
|
|
50
|
+
- [_get](/_get)
|
|
51
|
+
- [_gt](/_gt)
|
|
52
|
+
- [_gte](/_gte)
|
|
53
|
+
- [_hash](/_hash)
|
|
54
|
+
- [_if](/_if)
|
|
55
|
+
- [_if_none](/_if_none)
|
|
56
|
+
- [_intl](/_intl)
|
|
57
|
+
- [_json](/_json)
|
|
58
|
+
- [_log](/_log)
|
|
59
|
+
- [_lt](/_lt)
|
|
60
|
+
- [_lte](/_lte)
|
|
61
|
+
- [_math](/_math)
|
|
62
|
+
- [_ne](/_ne)
|
|
63
|
+
- [_not](/_not)
|
|
64
|
+
- [_number](/_number)
|
|
65
|
+
- [_object](/_object)
|
|
66
|
+
- [_operator](/_operator)
|
|
67
|
+
- [_or](/_or)
|
|
68
|
+
- [_product](/_product)
|
|
69
|
+
- [_random](/_random)
|
|
70
|
+
- [_regex](/_regex)
|
|
71
|
+
- [_string](/_string)
|
|
72
|
+
- [_subtract](/_subtract)
|
|
73
|
+
- [_sum](/_sum)
|
|
74
|
+
- [_switch](/_switch)
|
|
75
|
+
- [_type](/_type)
|
|
76
|
+
- [_uri](/_uri)
|
|
77
|
+
|
|
78
|
+
#### Examples
|
|
79
|
+
|
|
80
|
+
###### Use the app slug as a map key at build time:
|
|
81
|
+
The [`_app`](/_app) operator also resolves at build time, so `_build.app: slug` can supply a key for a build-time map. Because the key must be a string when `_build.object.fromEntries` runs, the runtime `_app` form would arrive too late here.
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
_build.object.fromEntries:
|
|
85
|
+
- - _build.app: slug
|
|
86
|
+
- enabled: true
|
|
87
|
+
```
|
|
88
|
+
Returns (when `slug` is `my-app`):
|
|
89
|
+
```yaml
|
|
90
|
+
my-app:
|
|
91
|
+
enabled: true
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
###### Check environment variables to determine which url to link to:
|
|
95
|
+
Use the `Link` action to link to a production url if the build is a production build in Vercel (the `VERCEL_ENV` variable will be set to "production"), otherwise link to a preview url.
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
id: link_to_website
|
|
99
|
+
type: Link
|
|
100
|
+
params:
|
|
101
|
+
url:
|
|
102
|
+
_build.if:
|
|
103
|
+
test:
|
|
104
|
+
_build.eq:
|
|
105
|
+
- _build.env: VERCEL_ENV
|
|
106
|
+
- production
|
|
107
|
+
then: "https://www.productionsite.com"
|
|
108
|
+
else: "https://productionsite-git-develop-org.vercel.app"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
###### Loop over a static list at build time:
|
|
112
|
+
Let's say we have a static list of fruit and their sales in a file called `fruit_sales.json` which is generated by another application. We can map over this list at build time to return a list of the fruit and their total sales.
|
|
113
|
+
|
|
114
|
+
`fruit_sales.json`
|
|
115
|
+
```json
|
|
116
|
+
[
|
|
117
|
+
{
|
|
118
|
+
"name": "Apples",
|
|
119
|
+
"sales": [
|
|
120
|
+
15,
|
|
121
|
+
20,
|
|
122
|
+
10,
|
|
123
|
+
25
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Bananas",
|
|
128
|
+
"sales": [
|
|
129
|
+
20,
|
|
130
|
+
5,
|
|
131
|
+
25,
|
|
132
|
+
17
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "Oranges",
|
|
137
|
+
"sales": [
|
|
138
|
+
21,
|
|
139
|
+
12,
|
|
140
|
+
31,
|
|
141
|
+
40
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
```
|
|
146
|
+
```yaml
|
|
147
|
+
_build.array.map:
|
|
148
|
+
on:
|
|
149
|
+
_ref: fruit_sales.json
|
|
150
|
+
callback:
|
|
151
|
+
_build.function:
|
|
152
|
+
name:
|
|
153
|
+
__build.args: 0.name
|
|
154
|
+
total_sales:
|
|
155
|
+
__build.sum:
|
|
156
|
+
__build.args: 0.sales
|
|
157
|
+
```
|
|
158
|
+
Returns:
|
|
159
|
+
```
|
|
160
|
+
- name: Apples
|
|
161
|
+
total_sales: 70
|
|
162
|
+
- name: Bananas
|
|
163
|
+
total_sales: 67
|
|
164
|
+
- name: Oranges
|
|
165
|
+
total_sales: 104
|
|
166
|
+
```
|