@lowdefy/docs 4.0.0-alpha.7 → 4.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/operators/client/filter_default_value.js +55 -0
  2. package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
  3. package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
  4. package/package.json +19 -3
  5. package/404.yaml +0 -26
  6. package/CHANGELOG.md +0 -697
  7. package/actions/CallMethod.yaml +0 -57
  8. package/actions/JsAction.yaml +0 -281
  9. package/actions/Link.yaml +0 -120
  10. package/actions/Login.yaml +0 -123
  11. package/actions/Logout.yaml +0 -44
  12. package/actions/Message.yaml +0 -68
  13. package/actions/Notification.yaml +0 -84
  14. package/actions/Request.yaml +0 -70
  15. package/actions/Reset.yaml +0 -42
  16. package/actions/ResetValidation.yaml +0 -102
  17. package/actions/ScrollTo.yaml +0 -100
  18. package/actions/SetGlobal.yaml +0 -78
  19. package/actions/SetState.yaml +0 -85
  20. package/actions/Throw.yaml +0 -89
  21. package/actions/Validate.yaml +0 -104
  22. package/actions/Wait.yaml +0 -40
  23. package/blocks/all_icons.yaml +0 -803
  24. package/blocks/container/Affix.yaml +0 -26
  25. package/blocks/container/Alert.yaml +0 -27
  26. package/blocks/container/Badge.yaml +0 -27
  27. package/blocks/container/Box.yaml +0 -27
  28. package/blocks/container/Card.yaml +0 -29
  29. package/blocks/container/Collapse.yaml +0 -38
  30. package/blocks/container/Comment.yaml +0 -43
  31. package/blocks/container/ConfirmModal.yaml +0 -36
  32. package/blocks/container/Descriptions.yaml +0 -51
  33. package/blocks/container/Drawer.yaml +0 -46
  34. package/blocks/container/Label.yaml +0 -28
  35. package/blocks/container/Modal.yaml +0 -46
  36. package/blocks/container/PageHCF.yaml +0 -28
  37. package/blocks/container/PageHCSF.yaml +0 -29
  38. package/blocks/container/PageHSCF.yaml +0 -29
  39. package/blocks/container/PageHeaderMenu.yaml +0 -52
  40. package/blocks/container/PageSHCF.yaml +0 -29
  41. package/blocks/container/PageSiderMenu.yaml +0 -53
  42. package/blocks/container/Result.yaml +0 -34
  43. package/blocks/container/Span.yaml +0 -27
  44. package/blocks/container/Spin.yaml +0 -27
  45. package/blocks/container/Tabs.yaml +0 -41
  46. package/blocks/container/Tooltip.yaml +0 -38
  47. package/blocks/display/Anchor.yaml +0 -25
  48. package/blocks/display/Avatar.yaml +0 -23
  49. package/blocks/display/Breadcrumb.yaml +0 -28
  50. package/blocks/display/Button.yaml +0 -43
  51. package/blocks/display/DangerousHtml.yaml +0 -62
  52. package/blocks/display/DangerousMarkdown.yaml +0 -46
  53. package/blocks/display/Divider.yaml +0 -23
  54. package/blocks/display/EChart.yaml +0 -53
  55. package/blocks/display/Html.yaml +0 -50
  56. package/blocks/display/Icon.yaml +0 -23
  57. package/blocks/display/Img.yaml +0 -40
  58. package/blocks/display/Markdown.yaml +0 -31
  59. package/blocks/display/MarkdownWithCode.yaml +0 -46
  60. package/blocks/display/Menu.yaml +0 -48
  61. package/blocks/display/Message.yaml +0 -34
  62. package/blocks/display/MobileMenu.yaml +0 -47
  63. package/blocks/display/Notification.yaml +0 -34
  64. package/blocks/display/Paragraph.yaml +0 -30
  65. package/blocks/display/Progress.yaml +0 -52
  66. package/blocks/display/Skeleton.yaml +0 -27
  67. package/blocks/display/Statistic.yaml +0 -35
  68. package/blocks/display/Title.yaml +0 -32
  69. package/blocks/input/AutoComplete.yaml +0 -30
  70. package/blocks/input/ButtonSelector.yaml +0 -36
  71. package/blocks/input/CheckboxSelector.yaml +0 -36
  72. package/blocks/input/CheckboxSwitch.yaml +0 -56
  73. package/blocks/input/ChromeColorSelector.yaml +0 -24
  74. package/blocks/input/CircleColorSelector.yaml +0 -24
  75. package/blocks/input/ColorSelector.yaml +0 -24
  76. package/blocks/input/CompactColorSelector.yaml +0 -24
  77. package/blocks/input/DateRangeSelector.yaml +0 -26
  78. package/blocks/input/DateSelector.yaml +0 -26
  79. package/blocks/input/DateTimeSelector.yaml +0 -28
  80. package/blocks/input/GithubColorSelector.yaml +0 -24
  81. package/blocks/input/MonthSelector.yaml +0 -26
  82. package/blocks/input/MultipleSelector.yaml +0 -117
  83. package/blocks/input/NumberInput.yaml +0 -24
  84. package/blocks/input/Pagination.yaml +0 -33
  85. package/blocks/input/ParagraphInput.yaml +0 -32
  86. package/blocks/input/PasswordInput.yaml +0 -48
  87. package/blocks/input/RadioSelector.yaml +0 -36
  88. package/blocks/input/RatingSlider.yaml +0 -24
  89. package/blocks/input/S3UploadButton.yaml +0 -28
  90. package/blocks/input/Selector.yaml +0 -98
  91. package/blocks/input/SliderColorSelector.yaml +0 -24
  92. package/blocks/input/SwatchesColorSelector.yaml +0 -24
  93. package/blocks/input/Switch.yaml +0 -24
  94. package/blocks/input/TextArea.yaml +0 -27
  95. package/blocks/input/TextInput.yaml +0 -59
  96. package/blocks/input/TitleInput.yaml +0 -32
  97. package/blocks/input/TwitterColorSelector.yaml +0 -24
  98. package/blocks/input/WeekSelector.yaml +0 -26
  99. package/blocks/list/ControlledList.yaml +0 -191
  100. package/blocks/list/List.yaml +0 -157
  101. package/blocks/list/TimelineList.yaml +0 -136
  102. package/body.html +0 -1
  103. package/concepts/blocks.yaml +0 -249
  104. package/concepts/cli.yaml +0 -173
  105. package/concepts/connections-and-requests.yaml +0 -114
  106. package/concepts/context-and-state.yaml +0 -82
  107. package/concepts/custom-blocks.yaml +0 -190
  108. package/concepts/custom-code.yaml +0 -197
  109. package/concepts/events-and-actions.yaml +0 -224
  110. package/concepts/hosting-files.yaml +0 -50
  111. package/concepts/layout.yaml +0 -1464
  112. package/concepts/lists.yaml +0 -162
  113. package/concepts/lowdefy-schema.yaml +0 -245
  114. package/concepts/operators.yaml +0 -66
  115. package/concepts/overview.yaml +0 -48
  116. package/concepts/secrets.yaml +0 -56
  117. package/connections/AWSS3.yaml +0 -228
  118. package/connections/AmazonRedshift.yaml +0 -75
  119. package/connections/AxiosHttp.yaml +0 -194
  120. package/connections/Elasticsearch.yaml +0 -378
  121. package/connections/GoogleSheet.yaml +0 -332
  122. package/connections/Knex.yaml +0 -181
  123. package/connections/KnexRequests.md +0 -121
  124. package/connections/MSSQL.yaml +0 -90
  125. package/connections/MariaDB.yaml +0 -77
  126. package/connections/MongoDB.yaml +0 -581
  127. package/connections/MySQL.yaml +0 -92
  128. package/connections/OracleDB.yaml +0 -73
  129. package/connections/PostgreSQL.yaml +0 -99
  130. package/connections/Redis.yaml +0 -147
  131. package/connections/SQLite.yaml +0 -94
  132. package/connections/SendGridMail.yaml +0 -113
  133. package/connections/Stripe.yaml +0 -139
  134. package/deployment/aws-lambda.yaml +0 -128
  135. package/deployment/docker.yaml +0 -118
  136. package/deployment/netlify.yaml +0 -69
  137. package/deployment/node-server.yaml +0 -111
  138. package/head.html +0 -7
  139. package/howto/generate-csv.yaml.njk +0 -252
  140. package/howto/generate-pdf.yaml.njk +0 -651
  141. package/howto/generateCsv/lowdefy.yaml +0 -64
  142. package/howto/generateCsv/public/csvMake.js +0 -27
  143. package/howto/generatePdf/inv_template.yaml +0 -200
  144. package/howto/generatePdf/lowdefy.yaml +0 -117
  145. package/howto/generatePdf/my_header.html +0 -1
  146. package/howto/generatePdf/public/logo_example.png +0 -0
  147. package/howto/generatePdf/public/modules/importUmd.js +0 -7
  148. package/howto/generatePdf/public/modules/pdfMake.js +0 -7
  149. package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
  150. package/howto/use-refrences.md +0 -5
  151. package/introduction.yaml +0 -100
  152. package/lowdefy.yaml +0 -66
  153. package/menus.yaml +0 -832
  154. package/operators/_actions.yaml +0 -123
  155. package/operators/_and.yaml +0 -90
  156. package/operators/_args.yaml +0 -79
  157. package/operators/_array.yaml +0 -326
  158. package/operators/_base64.yaml +0 -56
  159. package/operators/_change_case.yaml +0 -347
  160. package/operators/_date.yaml +0 -71
  161. package/operators/_diff.yaml +0 -75
  162. package/operators/_divide.yaml +0 -46
  163. package/operators/_eq.yaml +0 -67
  164. package/operators/_event.yaml +0 -103
  165. package/operators/_format.yaml +0 -209
  166. package/operators/_function.yaml +0 -66
  167. package/operators/_get.yaml +0 -108
  168. package/operators/_global.yaml +0 -107
  169. package/operators/_gt.yaml +0 -65
  170. package/operators/_gte.yaml +0 -65
  171. package/operators/_hash.yaml +0 -109
  172. package/operators/_if.yaml +0 -44
  173. package/operators/_if_none.yaml +0 -61
  174. package/operators/_index.yaml +0 -65
  175. package/operators/_input.yaml +0 -114
  176. package/operators/_js.yaml +0 -189
  177. package/operators/_json.yaml +0 -128
  178. package/operators/_list_contexts.yaml +0 -37
  179. package/operators/_location.yaml +0 -59
  180. package/operators/_log.yaml +0 -36
  181. package/operators/_lt.yaml +0 -65
  182. package/operators/_lte.yaml +0 -65
  183. package/operators/_math.yaml +0 -374
  184. package/operators/_media.yaml +0 -86
  185. package/operators/_menu.yaml +0 -81
  186. package/operators/_mql.yaml +0 -101
  187. package/operators/_ne.yaml +0 -77
  188. package/operators/_not.yaml +0 -47
  189. package/operators/_number.yaml +0 -157
  190. package/operators/_nunjucks.yaml +0 -73
  191. package/operators/_object.yaml +0 -193
  192. package/operators/_operator.yaml +0 -47
  193. package/operators/_or.yaml +0 -81
  194. package/operators/_product.yaml +0 -59
  195. package/operators/_random.yaml +0 -104
  196. package/operators/_ref.yaml +0 -266
  197. package/operators/_regex.yaml +0 -83
  198. package/operators/_request.yaml +0 -50
  199. package/operators/_secret.yaml +0 -74
  200. package/operators/_state.yaml +0 -114
  201. package/operators/_string.yaml +0 -283
  202. package/operators/_subtract.yaml +0 -38
  203. package/operators/_sum.yaml +0 -59
  204. package/operators/_switch.yaml +0 -51
  205. package/operators/_type.yaml +0 -92
  206. package/operators/_uri.yaml +0 -56
  207. package/operators/_url_query.yaml +0 -120
  208. package/operators/_user.yaml +0 -107
  209. package/operators/_uuid.yaml +0 -114
  210. package/operators/_var.yaml +0 -105
  211. package/operators/_yaml.yaml +0 -107
  212. package/pages.yaml +0 -227
  213. package/public/images/authors/gervwyk.jpeg +0 -0
  214. package/public/images/authors/sandile.jpeg +0 -0
  215. package/public/images/howto/header_generate_csv.jpg +0 -0
  216. package/public/images/howto/header_generate_pdf.jpg +0 -0
  217. package/public/logo_example.png +0 -0
  218. package/public/lowdefy_app_schema.png +0 -0
  219. package/public/modules/csvMake.js +0 -27
  220. package/public/modules/filterDefaultValue.js +0 -48
  221. package/public/modules/importUmd.js +0 -7
  222. package/public/modules/index.js +0 -5
  223. package/public/modules/pdfMake.js +0 -7
  224. package/public/modules/test/filterDefaultValue.test.js +0 -91
  225. package/public/modules/vfs_fonts.js +0 -12
  226. package/public/sitemap.xml +0 -1024
  227. package/templates/actions.yaml.njk +0 -68
  228. package/templates/blocks/defaultValueTransformer.js +0 -53
  229. package/templates/blocks/exampleTransformer.js +0 -81
  230. package/templates/blocks/layout.yaml +0 -114
  231. package/templates/blocks/propertiesFormTransformer.js +0 -419
  232. package/templates/blocks/propertiesGetterTransformer.js +0 -132
  233. package/templates/blocks/schema.yaml.njk +0 -42
  234. package/templates/blocks/style.yaml +0 -26
  235. package/templates/blocks/template.yaml.njk +0 -495
  236. package/templates/blog.yaml.njk +0 -221
  237. package/templates/cli_command.yaml.njk +0 -37
  238. package/templates/footer.yaml.njk +0 -604
  239. package/templates/general.yaml.njk +0 -124
  240. package/templates/generateSitemap.js +0 -41
  241. package/templates/header.yaml +0 -138
  242. package/templates/navigation_buttons.yaml +0 -68
  243. package/templates/operators.yaml.njk +0 -82
  244. package/templates/operatorsMethodTransformer.js +0 -119
  245. package/templates/test/array.test.js +0 -1335
  246. package/templates/test/boolean.test.js +0 -98
  247. package/templates/test/button.test.js +0 -166
  248. package/templates/test/color.test.js +0 -126
  249. package/templates/test/enum.test.js +0 -105
  250. package/templates/test/icon.test.js +0 -109
  251. package/templates/test/integer.test.js +0 -99
  252. package/templates/test/manual.test.js +0 -238
  253. package/templates/test/number.test.js +0 -99
  254. package/templates/test/object.test.js +0 -434
  255. package/templates/test/oneOf.test.js +0 -794
  256. package/templates/test/string.test.js +0 -98
  257. package/templates/test/yaml.test.js +0 -605
  258. package/tutorial/next-steps.yaml +0 -83
  259. package/tutorial/tutorial-actions-operators-config.yaml +0 -142
  260. package/tutorial/tutorial-actions-operators.yaml +0 -436
  261. package/tutorial/tutorial-add-blocks-config.yaml +0 -109
  262. package/tutorial/tutorial-add-blocks.yaml +0 -195
  263. package/tutorial/tutorial-create-page-config.yaml +0 -77
  264. package/tutorial/tutorial-create-page.yaml +0 -196
  265. package/tutorial/tutorial-deploy.yaml +0 -146
  266. package/tutorial/tutorial-requests-config.yaml +0 -186
  267. package/tutorial/tutorial-requests.yaml +0 -338
  268. package/tutorial/tutorial-start.yaml +0 -282
  269. package/users/login-and-logout.yaml +0 -164
  270. package/users/openid-connect.yaml +0 -84
  271. package/users/protected-pages.yaml +0 -67
  272. package/users/roles.yaml +0 -70
  273. package/users/user-object.yaml +0 -73
  274. package/users/users-introduction.yaml +0 -80
  275. package/version.yaml +0 -1
@@ -1,59 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _product
20
- pageTitle: _product
21
- filePath: operators/_product.yaml
22
- types: |
23
- ```
24
- (values: any[]): number
25
- ```
26
- description: |
27
- The `_product` operator takes the product of the values given as input. If a value is not a number, the value is skipped.
28
- arguments: |
29
- ###### array
30
- An array of values to multiply.
31
- examples: |
32
- ###### Two numbers:
33
- ```yaml
34
- _product:
35
- - 3
36
- - 4
37
- ```
38
- Returns: `12`
39
-
40
- ###### Array of numbers:
41
- ```yaml
42
- _product:
43
- - 1
44
- - 2
45
- - 3
46
- - 4
47
- ```
48
- Returns: `24`
49
-
50
- ###### Non-numbers are skipped:
51
- ```yaml
52
- _product:
53
- - 1
54
- - null
55
- - 3
56
- - "four"
57
- - 5
58
- ```
59
- Returns: `15`
@@ -1,104 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _random
20
- pageTitle: _random
21
- filePath: operators/_random.yaml
22
- types: |
23
- ```
24
- (type: string): string | number
25
- (arguments: {
26
- type: string,
27
- length?: number,
28
- max?: number,
29
- min?: number
30
- }): string | number
31
- ```
32
- description: |
33
- The `_random` operator returns a random string or number. The types it accepts are `string`, `integer`, or `float`.
34
- arguments: |
35
- ###### string
36
- The type to generate. One of `string`, `integer`, or `float`.
37
-
38
- ###### object
39
- - `type: string`: __Required__ - The type to generate. One of `string`, `integer`, or `float`.
40
- - `length: string`: The length of the string to generate if type is `string`. Default is `8`.
41
- - `max: number`: The maximum possible number if type is one of `integer` or `float`. Default is `100` if `integer` or `1` if `float`.
42
- - `min: number`: The minimum possible number if type is one of `integer` or `float`. Default is `0`.
43
- examples: |
44
- ###### Random string:
45
- ```yaml
46
- _random: string
47
- ```
48
- Returns: Random string of length 8.
49
-
50
- ```yaml
51
- _random:
52
- type: string
53
- ```
54
- Returns: Random string of length 8.
55
-
56
- ###### Random integer:
57
- ```yaml
58
- _random: integer
59
- ```
60
- Returns: Random integer between 0 and 100 inclusive.
61
-
62
- ```yaml
63
- _random:
64
- type: integer
65
- ```
66
- Returns: Random integer between 0 and 100 inclusive.
67
-
68
- ###### Random float:
69
- ```yaml
70
- _random: float
71
- ```
72
- Returns: Random float between 0 and 1 inclusive.
73
-
74
- ```yaml
75
- _random:
76
- type: float
77
- ```
78
- Returns: Random float between 0 and 1 inclusive.
79
-
80
- ###### Random string of length 12:
81
- ```yaml
82
- _random:
83
- type: string
84
- length: 12
85
- ```
86
- Returns: Random string of length 12.
87
-
88
- ###### Random integer between 1 and 6 (Dice roll):
89
- ```yaml
90
- _random:
91
- type: integer
92
- min: 1
93
- max: 6
94
- ```
95
- Returns: Random integer between 1 and 6 inclusive.
96
-
97
- ###### Random float between 34.2 and 42.89:
98
- ```yaml
99
- _random:
100
- type: float
101
- min: 34.2
102
- max: 42.89
103
- ```
104
- Returns: Random float between 34.2 and 42.89 inclusive.
@@ -1,266 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _ref
20
- pageTitle: _ref
21
- filePath: operators/_ref.yaml
22
- env: Build Only
23
- types: |
24
- ```
25
- (path: string): any
26
- (arguments: {
27
- path?: string,
28
- resolver?: string,
29
- transformer?: string,
30
- vars?: object,
31
- }): any
32
- ```
33
- description: |
34
- 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).
35
-
36
- > 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.
37
-
38
- The `_ref` operator requires a file path to the file to be referenced, relative to the root directory of the project.
39
-
40
- 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.
41
-
42
- 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.
43
-
44
- 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.
45
-
46
- ###### Variables
47
-
48
- Variables defined in the `vars` argument can be accessed in the referenced file using the [`_var`](/_var), and as template variables in Nunjucks files.
49
-
50
- ###### Resolver
51
-
52
- 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.
53
-
54
- 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.
55
-
56
- 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.
57
-
58
- ###### Transformer
59
-
60
- 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.
61
-
62
- ###### CommonJS and ES Modules
63
-
64
- 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.
65
-
66
- 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;`)
67
-
68
- arguments: |
69
- ###### string
70
- The file path to the referenced file, from the root of the project directory.
71
-
72
- ###### object
73
- - `path: string`: The file path to the referenced file, from the root of the project directory. If no `resolver` is specified, `path` is required.
74
- - `resolver: string`: The file path to a JavaScript file, from the root of the project directory, that exports a resolver function.
75
- - `transformer: string`: The file path to a JavaScript file, from the root of the project directory, that exports a transformer function.
76
- - `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.
77
-
78
- examples: |
79
- ###### Reference pages:
80
- ```yaml
81
- # lowdefy.yaml
82
- lowdefy: '3.23.2'
83
- pages:
84
- - _ref: pages/page1.yaml
85
- - _ref: pages/page2.yaml
86
- ```
87
- ```yaml
88
- # pages/page1.yaml
89
- id: page1
90
- type: PageHeaderMenu
91
- blocks:
92
- # ...
93
- ```
94
- ```yaml
95
- # pages/page2.yaml
96
- id: page2
97
- type: PageHeaderMenu
98
- blocks:
99
- # ...
100
- ```
101
- Returns:
102
- ```
103
- lowdefy: '3.23.2'
104
- pages:
105
- - id: page1
106
- type: PageHeaderMenu
107
- blocks:
108
- # ...
109
- - id: page2
110
- type: PageHeaderMenu
111
- blocks:
112
- # ...
113
- ```
114
-
115
- ###### Using a standardized input label template:
116
- ```yaml
117
- blocks:
118
- - id: name
119
- type: TextInput
120
- properties:
121
- label:
122
- _ref:
123
- path: label.yaml
124
- vars:
125
- title: Name
126
- description: Your name and surname.
127
- - id: age
128
- type: NumberInput
129
- properties:
130
- label:
131
- _ref:
132
- path: label.yaml
133
- vars:
134
- title: Age
135
- description: Your age.
136
- ```
137
- ```yaml
138
- # label.yaml
139
- title:
140
- _var: title
141
- extra:
142
- _var: description
143
- span: 8
144
- colon: false
145
- extraStyle:
146
- color: '#546358'
147
- ```
148
- Returns:
149
- ```yaml
150
- blocks:
151
- - id: name
152
- type: TextInput
153
- properties:
154
- label:
155
- title: Name
156
- extra: Your name and surname.
157
- span: 8
158
- colon: false
159
- extraStyle:
160
- color: '#546358'
161
- - id: age
162
- type: NumberInput
163
- properties:
164
- label:
165
- title: Age
166
- extra: Your age.
167
- span: 8
168
- colon: false
169
- extraStyle:
170
- color: '#546358'
171
- ```
172
-
173
- ###### Local or shared resolver:
174
-
175
- This resolver function will first look for the configuration file in the current working directory, but if the file is not found it will be read from an adjacent "shared" directory. This pattern can be used to build apps that mostly use a shared configuration, with a few components that are customised per app.
176
-
177
- ```js
178
- // resolvers/useLocalOrSharedConfig.js
179
- const fs = require('fs');
180
- const path = require('path');
181
- const { promisify } = require('util');
182
-
183
- const readFilePromise = promisify(fs.readFile);
184
-
185
- async function useLocalOrSharedConfig(refPath, vars, context) {
186
- let fileContent
187
- try {
188
- fileContent = await readFilePromise(path.resolve(refPath), 'utf8');
189
- return fileContent;
190
- } catch (error) {
191
- if (error.code === 'ENOENT') {
192
- fileContent = readFilePromise(path.resolve('../shared', refPath), 'utf8');
193
- return fileContent;
194
- }
195
- throw error;
196
- }
197
-
198
-
199
- }
200
-
201
- module.exports = useLocalOrSharedConfig;
202
- ```
203
-
204
- ```yaml
205
- // lowdefy.yaml
206
- lowdefy: 3.23.2
207
-
208
- cli:
209
- refResolver: resolvers/useLocalOrSharedConfig.js
210
-
211
- pages:
212
- - _ref: pages/local-page.yaml
213
- - _ref: pages/shared-page.yaml
214
- ```
215
-
216
- ###### This transformer adds a standard footer to each page:
217
-
218
- ```js
219
- // transformers/addFooter.js
220
-
221
- function addFooter(page, vars) {
222
- const footer = {
223
- // ...
224
- };
225
- page.areas.footer = footer;
226
- return page;
227
- }
228
- module.exports = addFooter;
229
- ```
230
- ```yaml
231
- // lowdefy.yaml
232
- lowdefy: 3.23.2
233
-
234
- pages:
235
- - _ref:
236
- path: pages/page1.yaml
237
- transformer: transformers/addFooter.js
238
- ```
239
- ###### Using ES Modules with `.mjs` file extension:
240
-
241
- ```js
242
- // resolvers/useLocalOrSharedConfig.mjs
243
- import fs from 'fs';
244
- import path from 'path';
245
- import { promisify } from 'util';
246
-
247
- const readFilePromise = promisify(fs.readFile);
248
-
249
- async function useLocalOrSharedConfig(refPath, vars, context) {
250
- let fileContent
251
- try {
252
- fileContent = await readFilePromise(path.resolve(refPath), 'utf8');
253
- return fileContent;
254
- } catch (error) {
255
- if (error.code === 'ENOENT') {
256
- fileContent = readFilePromise(path.resolve('../shared', refPath), 'utf8');
257
- return fileContent;
258
- }
259
- throw error;
260
- }
261
-
262
-
263
- }
264
-
265
- export default useLocalOrSharedConfig;
266
- ```
@@ -1,83 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _regex
20
- pageTitle: _regex
21
- filePath: operators/_regex.yaml
22
- types: |
23
- ```
24
- (pattern: string): boolean
25
- (arguments: {
26
- pattern: string,
27
- on?: string,
28
- key?: string,
29
- flags?: string
30
- }): boolean
31
- ```
32
- description: |
33
- The `_regex` operator performs a regex test on a string, and returns `true` if there is a match.
34
-
35
- The regex operator has shorthand argument definitions that can be used on web client.
36
- arguments: |
37
- ###### object
38
- - `pattern: string`: __Required__ - The regular expression pattern to test.
39
- - `on: string`: The string to test the value on. One of `on` or `key` must be specified unless the operator is used in an input block.
40
- - `key: string`: The key of a value in `state` to test. One of `on` or `key` must be specified unless the operator is used in an input block.
41
- - `flags: string`: The regex flags to use. The default value is `"gm"`.
42
-
43
- ###### string
44
- The regular expression pattern to test. The string shorthand can only be used in an input block, and the tested value will be the block's value.
45
- examples: |
46
- ###### Check if a username is valid (Alphanumeric string that may include _ and – having a length of 3 to 16 characters):
47
- ```yaml
48
- _regex:
49
- pattern: ^[a-z0-9_-]{3,16}$
50
- on:
51
- _state: username_input
52
- ```
53
- Returns: `true` if matched else `false`.
54
-
55
- ###### Using the key of the value in `state`:
56
- ```yaml
57
- _regex:
58
- pattern: ^[a-z0-9_-]{3,16}$
59
- key: username_input
60
- ```
61
- Returns: `true` if matched else `false`.
62
-
63
- ###### Using the value of the block in which the operator is evaluated:
64
- ```yaml
65
- id: username_input
66
- type: TextInput
67
- validate:
68
- - message: Invalid username.
69
- status: error
70
- pass:
71
- _regex: ^[a-z0-9_-]{3,16}$
72
- ```
73
- Returns: `true` if matched else `false`.
74
-
75
- ###### Case insensitive match:
76
- ```yaml
77
- _regex:
78
- pattern: ^[a-z0-9_-]{3,16}$
79
- on:
80
- _state: username_input
81
- flags: 'gmi'
82
- ```
83
- Returns: `true` if matched else `false`.
@@ -1,50 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _request
20
- pageTitle: _request
21
- filePath: operators/_request.yaml
22
- env: Client Only
23
- types: |
24
- ```
25
- (requestId: string): any
26
- ```
27
- description: |
28
- The `_request` operator returns the response value of a request. If the request has not yet been call, or is still executing, the returned value is `null`. Dot notation and [block list indexes](/lists) are supported.
29
- arguments: |
30
- ###### string
31
- The id of the request.
32
- examples: |
33
- ###### Using a request response:
34
- ```yaml
35
- _request: my_request
36
- ```
37
- Returns: The response returned by the request.
38
-
39
- ###### Using dot notation to get the data object from the response:
40
- ```yaml
41
- _request: my_request.data
42
- ```
43
- ###### Using dot notation to get the first element of an array response:
44
- ```yaml
45
- _request: array_request.0
46
- ```
47
- ###### Using dot notation and block list indexes to get the name field from the element corresponding to the block index of an array response:
48
- ```yaml
49
- _request: array_request.$.name
50
- ```
@@ -1,74 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/operators.yaml.njk
17
- transformer: templates/operatorsMethodTransformer.js
18
- vars:
19
- pageId: _secret
20
- pageTitle: _secret
21
- filePath: operators/_secret.yaml
22
- env: Server Only
23
- types: |
24
- ```
25
- (key: string): any
26
- (all: boolean): any
27
- (arguments: {
28
- all?: boolean,
29
- key?: string,
30
- default?: any
31
- }): any
32
- ```
33
- description: |
34
- The `_secret` operator gets a value from the [`secret`](/context-and-secret) object. The `secrets` is a data object that contains sensitive information like passwords or API keys. The `_secret` operator can only be used in `connections` and `requests`. Secrets are read from environment variables on the server that start with `LOWDEFY_SECRET_`, (i.e. `LOWDEFY_SECRET_SECRET_NAME`). The name of the secret is the part after `LOWDEFY_SECRET_`. Since environment variables can only be strings, secrets can be JSON encoded, and parsed using the [`_json.parse`](/_json) method.
35
-
36
- arguments: |
37
- ###### string
38
- If the `_secret` operator is called with a string argument, the value of the key in the `secrets` object is returned. If the value is not found, `null` is returned.
39
-
40
- ###### boolean
41
- If the `_secret` operator is called with boolean argument `true`, the entire `secrets` object is returned.
42
-
43
- ###### object
44
- - `all: boolean`: If `all` is set to `true`, the entire `secrets` object is returned. One of `all` or `key` are required.
45
- - `key: string`: The value of the key in the `secrets` object is returned. If the value is not found, `null`, or the specified default value is returned. One of `all` or `key` are required.
46
- - `default: any`: A value to return if the `key` is not found in `secrets`. By default, `null` is returned if a value is not found.
47
- examples: |
48
- ###### Get the value of `MY_SECRET` from `secrets`:
49
- ```yaml
50
- _secret: MY_SECRET
51
- ```
52
- ```yaml
53
- _secret:
54
- key: MY_SECRET
55
- ```
56
- Returns: The value of `MY_SECRET` in `secrets`.
57
-
58
- ###### Get the entire `secret` object:
59
- ```yaml
60
- _secret: true
61
- ```
62
- ```yaml
63
- _secret:
64
- all: true
65
- ```
66
- Returns: The entire `secrets` object.
67
-
68
- ###### Return a default value if the value is not found:
69
- ```yaml
70
- _secret:
71
- key: MY_SECRET
72
- default: Not so secret
73
- ```
74
- Returns: The value of `MY_SECRET`, or `"Not so secret"`.