merge
This commit is contained in:
commit
b4628a43d0
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -63,27 +63,26 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.55.2",
|
"@budibase/bbui": "^1.56.0",
|
||||||
"@budibase/client": "^0.6.2",
|
"@budibase/client": "^0.7.4",
|
||||||
"@budibase/colorpicker": "^1.0.1",
|
"@budibase/colorpicker": "1.0.1",
|
||||||
"@budibase/string-templates": "^0.6.2",
|
"@budibase/string-templates": "^0.7.4",
|
||||||
"@budibase/svelte-ag-grid": "^0.0.16",
|
"@budibase/svelte-ag-grid": "^0.0.16",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@svelteschool/svelte-forms": "^0.7.0",
|
"@svelteschool/svelte-forms": "0.7.0",
|
||||||
"britecharts": "^2.16.0",
|
|
||||||
"codemirror": "^5.59.0",
|
"codemirror": "^5.59.0",
|
||||||
"d3-selection": "^1.4.1",
|
"d3-selection": "^1.4.1",
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"downloadjs": "^1.4.7",
|
"downloadjs": "1.4.7",
|
||||||
"fast-sort": "^2.2.0",
|
"fast-sort": "^2.2.0",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "4.17.13",
|
||||||
"posthog-js": "1.4.5",
|
"posthog-js": "1.4.5",
|
||||||
"remixicon": "^2.5.0",
|
"remixicon": "2.5.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "2.2.15",
|
||||||
"svelte-loading-spinners": "^0.1.1",
|
"svelte-loading-spinners": "^0.1.1",
|
||||||
"svelte-portal": "^0.1.0",
|
"svelte-portal": "0.1.0",
|
||||||
"uuid": "^8.3.1",
|
"uuid": "8.3.1",
|
||||||
"yup": "^0.29.2"
|
"yup": "0.29.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.5.5",
|
"@babel/core": "^7.5.5",
|
||||||
|
|
|
@ -119,6 +119,18 @@ export const getBackendUiStore = () => {
|
||||||
return json
|
return json
|
||||||
},
|
},
|
||||||
save: async (datasourceId, query) => {
|
save: async (datasourceId, query) => {
|
||||||
|
const integrations = get(store).integrations
|
||||||
|
const dataSource = get(store).datasources.filter(
|
||||||
|
ds => ds._id === datasourceId
|
||||||
|
)
|
||||||
|
// check if readable attribute is found
|
||||||
|
if (dataSource.length !== 0) {
|
||||||
|
const integration = integrations[dataSource[0].source]
|
||||||
|
const readable = integration.query[query.queryVerb].readable
|
||||||
|
if (readable) {
|
||||||
|
query.readable = readable
|
||||||
|
}
|
||||||
|
}
|
||||||
query.datasourceId = datasourceId
|
query.datasourceId = datasourceId
|
||||||
const response = await api.post(`/api/queries`, query)
|
const response = await api.post(`/api/queries`, query)
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
|
|
|
@ -64,7 +64,11 @@
|
||||||
{:else if value.customType === 'password'}
|
{:else if value.customType === 'password'}
|
||||||
<Input type="password" extraThin bind:value={block.inputs[key]} />
|
<Input type="password" extraThin bind:value={block.inputs[key]} />
|
||||||
{:else if value.customType === 'email'}
|
{:else if value.customType === 'email'}
|
||||||
<Input type="email" extraThin bind:value={block.inputs[key]} />
|
<BindableInput
|
||||||
|
type={'email'}
|
||||||
|
extraThin
|
||||||
|
bind:value={block.inputs[key]}
|
||||||
|
{bindings} />
|
||||||
{:else if value.customType === 'table'}
|
{:else if value.customType === 'table'}
|
||||||
<TableSelector bind:value={block.inputs[key]} />
|
<TableSelector bind:value={block.inputs[key]} />
|
||||||
{:else if value.customType === 'row'}
|
{:else if value.customType === 'row'}
|
||||||
|
@ -75,7 +79,7 @@
|
||||||
<SchemaSetup bind:value={block.inputs[key]} />
|
<SchemaSetup bind:value={block.inputs[key]} />
|
||||||
{:else if value.type === 'string' || value.type === 'number'}
|
{:else if value.type === 'string' || value.type === 'number'}
|
||||||
<BindableInput
|
<BindableInput
|
||||||
type="string"
|
type={value.customType}
|
||||||
extraThin
|
extraThin
|
||||||
bind:value={block.inputs[key]}
|
bind:value={block.inputs[key]}
|
||||||
{bindings} />
|
{bindings} />
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<div class="binding__description">
|
<div class="binding__description">
|
||||||
{@html helper.description || ''}
|
{@html helper.description || ''}
|
||||||
</div>
|
</div>
|
||||||
|
<pre>{helper.example || ''}</pre>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -166,7 +167,13 @@
|
||||||
.binding__description {
|
.binding__description {
|
||||||
color: var(--grey-8);
|
color: var(--grey-8);
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.binding__type {
|
.binding__type {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
background-color: var(--grey-2);
|
background-color: var(--grey-2);
|
||||||
|
|
|
@ -20,13 +20,12 @@
|
||||||
let exportFormat = FORMATS[0].key
|
let exportFormat = FORMATS[0].key
|
||||||
|
|
||||||
async function exportView() {
|
async function exportView() {
|
||||||
const response = await api.post(
|
download(
|
||||||
`/api/views/export?format=${exportFormat}`,
|
`/api/views/export?view=${encodeURIComponent(
|
||||||
view
|
view.name
|
||||||
|
)}&format=${exportFormat}`
|
||||||
)
|
)
|
||||||
const downloadInfo = await response.json()
|
|
||||||
onClosed()
|
onClosed()
|
||||||
window.location = downloadInfo.url
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
<div class="description">
|
<div class="description">
|
||||||
{@html helper.description}
|
{@html helper.description}
|
||||||
</div>
|
</div>
|
||||||
|
<pre>{helper.example || ''}</pre>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -169,6 +170,11 @@
|
||||||
border-width: 1px 0 1px 0;
|
border-width: 1px 0 1px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre,
|
||||||
|
.description {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
li:hover {
|
li:hover {
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
class="icon"
|
class="icon"
|
||||||
data-cy={`${key}-binding-button`}
|
data-cy={`${key}-binding-button`}
|
||||||
on:click={bindingDrawer.show}>
|
on:click={bindingDrawer.show}>
|
||||||
<Icon name="edit" />
|
<Icon name="lightning" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
border-top-right-radius: var(--border-radius-m);
|
border-top-right-radius: var(--border-radius-m);
|
||||||
border-bottom-right-radius: var(--border-radius-m);
|
border-bottom-right-radius: var(--border-radius-m);
|
||||||
color: var(--grey-7);
|
color: var(--grey-7);
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.icon:hover {
|
.icon:hover {
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
return [...acc, ...viewsArr]
|
return [...acc, ...viewsArr]
|
||||||
}, [])
|
}, [])
|
||||||
$: queries = $backendUiStore.queries
|
$: queries = $backendUiStore.queries
|
||||||
.filter(query => query.queryVerb === "read")
|
.filter(query => query.queryVerb === "read" || query.readable)
|
||||||
.map(query => ({
|
.map(query => ({
|
||||||
label: query.name,
|
label: query.name,
|
||||||
name: query.name,
|
name: query.name,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { Popover } from "@budibase/bbui"
|
import { Popover } from "@budibase/bbui"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
import FeedbackIframe from "./FeedbackIframe.svelte"
|
import FeedbackIframe from "./FeedbackIframe.svelte"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
@ -10,9 +11,15 @@
|
||||||
let iconContainer
|
let iconContainer
|
||||||
let popover
|
let popover
|
||||||
|
|
||||||
setInterval(() => {
|
onMount(() => {
|
||||||
$store.highlightFeedbackIcon = analytics.highlightFeedbackIcon()
|
const interval = setInterval(() => {
|
||||||
|
store.update(state => {
|
||||||
|
state.highlightFeedbackIcon = analytics.highlightFeedbackIcon()
|
||||||
|
return state
|
||||||
|
})
|
||||||
}, FIVE_MINUTES)
|
}, FIVE_MINUTES)
|
||||||
|
return () => clearInterval(interval)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container" bind:this={iconContainer} on:click={popover.show}>
|
<div class="container" bind:this={iconContainer} on:click={popover.show}>
|
||||||
|
|
|
@ -132,7 +132,8 @@
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<Input placeholder="✎ Edit Query Name" bind:value={query.name} />
|
<div class="label">Enter query name:</div>
|
||||||
|
<Input outline border bind:value={query.name} />
|
||||||
</div>
|
</div>
|
||||||
{#if config}
|
{#if config}
|
||||||
<div class="props">
|
<div class="props">
|
||||||
|
@ -216,7 +217,9 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.input {
|
.input {
|
||||||
width: 300px;
|
width: 500px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
|
@ -288,4 +291,12 @@
|
||||||
margin-top: -28px;
|
margin-top: -28px;
|
||||||
z-index: -2;
|
z-index: -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
color: var(--grey-8);
|
||||||
|
font-size: var(--font-size-s);
|
||||||
|
margin-right: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -14,9 +14,12 @@
|
||||||
async function exportApp() {
|
async function exportApp() {
|
||||||
appExportLoading = true
|
appExportLoading = true
|
||||||
try {
|
try {
|
||||||
download(`/api/backups/export?appId=${_id}`)
|
download(
|
||||||
|
`/api/backups/export?appId=${_id}&appname=${encodeURIComponent(name)}`
|
||||||
|
)
|
||||||
notifier.success("App Export Complete.")
|
notifier.success("App Export Complete.")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
notifier.danger("App Export Failed.")
|
notifier.danger("App Export Failed.")
|
||||||
} finally {
|
} finally {
|
||||||
appExportLoading = false
|
appExportLoading = false
|
||||||
|
@ -29,13 +32,13 @@
|
||||||
<Spacer medium />
|
<Spacer medium />
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<TextButton text medium blue href="/_builder/{_id}">
|
<TextButton text medium blue href="/_builder/{_id}">
|
||||||
Open
|
Open {name} →
|
||||||
{name}
|
|
||||||
→
|
|
||||||
</TextButton>
|
</TextButton>
|
||||||
{#if appExportLoading}
|
{#if appExportLoading}
|
||||||
<Spinner size="10" />
|
<Spinner size="10" />
|
||||||
{:else}<i class="ri-folder-download-line" on:click={exportApp} />{/if}
|
{:else}
|
||||||
|
<i class="ri-folder-download-line" on:click={exportApp} />
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ export function handlebarsCompletions() {
|
||||||
Object.entries(manifest[key]).map(([helperName, helperConfig]) => ({
|
Object.entries(manifest[key]).map(([helperName, helperConfig]) => ({
|
||||||
text: helperName,
|
text: helperName,
|
||||||
path: helperName,
|
path: helperName,
|
||||||
|
example: helperConfig.example,
|
||||||
label: helperName,
|
label: helperName,
|
||||||
displayText: helperName,
|
displayText: helperName,
|
||||||
description: helperConfig.description,
|
description: helperConfig.description,
|
||||||
|
|
|
@ -842,10 +842,10 @@
|
||||||
lodash "^4.17.19"
|
lodash "^4.17.19"
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@budibase/bbui@^1.55.2":
|
"@budibase/bbui@^1.56.0":
|
||||||
version "1.55.2"
|
version "1.56.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.55.2.tgz#be636e8b86b7e516a08eb626bb50c4b1f9774bf8"
|
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.56.0.tgz#91376f11b43706fd380291e9a5283760996eb62b"
|
||||||
integrity sha512-CevH/olxDFIko9uwYUpUTevPmpShrLwJSR7+wn/JetZERwhTwbLhOXzpsyXaK226qQ8vWhm0U31HRSKI1HwDDg==
|
integrity sha512-OEFC7MapbJk7Bd7oo79cVOq9BIcK1x8XPHLC1lB2N4hts37IygzB4Egg6JZBD7rh7CqU8ppc4W7wkfQbaXEO1Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
markdown-it "^12.0.2"
|
markdown-it "^12.0.2"
|
||||||
quill "^1.3.7"
|
quill "^1.3.7"
|
||||||
|
@ -854,7 +854,7 @@
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
turndown "^7.0.0"
|
turndown "^7.0.0"
|
||||||
|
|
||||||
"@budibase/colorpicker@^1.0.1":
|
"@budibase/colorpicker@1.0.1":
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.0.1.tgz#940c180e7ebba0cb0756c4c8ef13f5dfab58e810"
|
resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.0.1.tgz#940c180e7ebba0cb0756c4c8ef13f5dfab58e810"
|
||||||
integrity sha512-+DTHYhU0sTi5RfCyd7AAvMsLFwyF/wgs0owf7KyQU+ZILRW+YsWa7OQMz+hKQfgVAmvzwrNz8ATiBlG3Ac6Asg==
|
integrity sha512-+DTHYhU0sTi5RfCyd7AAvMsLFwyF/wgs0owf7KyQU+ZILRW+YsWa7OQMz+hKQfgVAmvzwrNz8ATiBlG3Ac6Asg==
|
||||||
|
@ -1257,7 +1257,7 @@
|
||||||
node-fetch "^2.6.0"
|
node-fetch "^2.6.0"
|
||||||
utf-8-validate "^5.0.2"
|
utf-8-validate "^5.0.2"
|
||||||
|
|
||||||
"@svelteschool/svelte-forms@^0.7.0":
|
"@svelteschool/svelte-forms@0.7.0":
|
||||||
version "0.7.0"
|
version "0.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/@svelteschool/svelte-forms/-/svelte-forms-0.7.0.tgz#4ecba15e9a9ab2b04fad3d892931a561118a4cea"
|
resolved "https://registry.yarnpkg.com/@svelteschool/svelte-forms/-/svelte-forms-0.7.0.tgz#4ecba15e9a9ab2b04fad3d892931a561118a4cea"
|
||||||
integrity sha512-TSt8ROqK6wq+Hav7EhZL1I0GtsZhg28aJuuDSviBzG/NG9pC0eprf8roWjl59DKHOVWIUTPTeY+T+lipb9gf8w==
|
integrity sha512-TSt8ROqK6wq+Hav7EhZL1I0GtsZhg28aJuuDSviBzG/NG9pC0eprf8roWjl59DKHOVWIUTPTeY+T+lipb9gf8w==
|
||||||
|
@ -1775,11 +1775,6 @@ balanced-match@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
||||||
|
|
||||||
base-64@^0.1.0:
|
|
||||||
version "0.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb"
|
|
||||||
integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs=
|
|
||||||
|
|
||||||
base@^0.11.1:
|
base@^0.11.1:
|
||||||
version "0.11.2"
|
version "0.11.2"
|
||||||
resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f"
|
resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f"
|
||||||
|
@ -1870,15 +1865,6 @@ braces@^3.0.1, braces@~3.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
fill-range "^7.0.1"
|
fill-range "^7.0.1"
|
||||||
|
|
||||||
britecharts@^2.16.0:
|
|
||||||
version "2.17.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/britecharts/-/britecharts-2.17.2.tgz#78e7743e7c1dcaccd78ab7dacc479d37d509cdf2"
|
|
||||||
integrity sha512-+wMG/ci+UHPRIySppTs8wQZmmlYFQHn2bCvbNiWUOYd1qAoiEQyKA/dVtgdTyR09qM+h8b9YsFofaWHJRT1mQg==
|
|
||||||
dependencies:
|
|
||||||
base-64 "^0.1.0"
|
|
||||||
d3 "^5.16.0"
|
|
||||||
lodash.assign "^4.2.0"
|
|
||||||
|
|
||||||
brorand@^1.0.1:
|
brorand@^1.0.1:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
|
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
|
||||||
|
@ -2282,16 +2268,16 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
delayed-stream "~1.0.0"
|
delayed-stream "~1.0.0"
|
||||||
|
|
||||||
commander@2, commander@^2.20.0:
|
|
||||||
version "2.20.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
|
||||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
|
||||||
|
|
||||||
commander@2.17.x:
|
commander@2.17.x:
|
||||||
version "2.17.1"
|
version "2.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
||||||
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
||||||
|
|
||||||
|
commander@^2.20.0:
|
||||||
|
version "2.20.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||||
|
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||||
|
|
||||||
commander@^5.0.0, commander@^5.1.0:
|
commander@^5.0.0, commander@^5.1.0:
|
||||||
version "5.1.0"
|
version "5.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
||||||
|
@ -2536,254 +2522,11 @@ cypress@^5.1.0:
|
||||||
url "^0.11.0"
|
url "^0.11.0"
|
||||||
yauzl "^2.10.0"
|
yauzl "^2.10.0"
|
||||||
|
|
||||||
d3-array@1, d3-array@^1.1.1, d3-array@^1.2.0:
|
d3-selection@^1.4.1:
|
||||||
version "1.2.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f"
|
|
||||||
integrity sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==
|
|
||||||
|
|
||||||
d3-axis@1:
|
|
||||||
version "1.0.12"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-1.0.12.tgz#cdf20ba210cfbb43795af33756886fb3638daac9"
|
|
||||||
integrity sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ==
|
|
||||||
|
|
||||||
d3-brush@1:
|
|
||||||
version "1.1.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-1.1.6.tgz#b0a22c7372cabec128bdddf9bddc058592f89e9b"
|
|
||||||
integrity sha512-7RW+w7HfMCPyZLifTz/UnJmI5kdkXtpCbombUSs8xniAyo0vIbrDzDwUJB6eJOgl9u5DQOt2TQlYumxzD1SvYA==
|
|
||||||
dependencies:
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-drag "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
d3-selection "1"
|
|
||||||
d3-transition "1"
|
|
||||||
|
|
||||||
d3-chord@1:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-1.0.6.tgz#309157e3f2db2c752f0280fedd35f2067ccbb15f"
|
|
||||||
integrity sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA==
|
|
||||||
dependencies:
|
|
||||||
d3-array "1"
|
|
||||||
d3-path "1"
|
|
||||||
|
|
||||||
d3-collection@1:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.7.tgz#349bd2aa9977db071091c13144d5e4f16b5b310e"
|
|
||||||
integrity sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==
|
|
||||||
|
|
||||||
d3-color@1:
|
|
||||||
version "1.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.4.1.tgz#c52002bf8846ada4424d55d97982fef26eb3bc8a"
|
|
||||||
integrity sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q==
|
|
||||||
|
|
||||||
d3-contour@1:
|
|
||||||
version "1.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-1.3.2.tgz#652aacd500d2264cb3423cee10db69f6f59bead3"
|
|
||||||
integrity sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg==
|
|
||||||
dependencies:
|
|
||||||
d3-array "^1.1.1"
|
|
||||||
|
|
||||||
d3-dispatch@1:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.6.tgz#00d37bcee4dd8cd97729dd893a0ac29caaba5d58"
|
|
||||||
integrity sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==
|
|
||||||
|
|
||||||
d3-drag@1:
|
|
||||||
version "1.2.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-1.2.5.tgz#2537f451acd39d31406677b7dc77c82f7d988f70"
|
|
||||||
integrity sha512-rD1ohlkKQwMZYkQlYVCrSFxsWPzI97+W+PaEIBNTMxRuxz9RF0Hi5nJWHGVJ3Om9d2fRTe1yOBINJyy/ahV95w==
|
|
||||||
dependencies:
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-selection "1"
|
|
||||||
|
|
||||||
d3-dsv@1:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.2.0.tgz#9d5f75c3a5f8abd611f74d3f5847b0d4338b885c"
|
|
||||||
integrity sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g==
|
|
||||||
dependencies:
|
|
||||||
commander "2"
|
|
||||||
iconv-lite "0.4"
|
|
||||||
rw "1"
|
|
||||||
|
|
||||||
d3-ease@1:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-1.0.7.tgz#9a834890ef8b8ae8c558b2fe55bd57f5993b85e2"
|
|
||||||
integrity sha512-lx14ZPYkhNx0s/2HX5sLFUI3mbasHjSSpwO/KaaNACweVwxUruKyWVcb293wMv1RqTPZyZ8kSZ2NogUZNcLOFQ==
|
|
||||||
|
|
||||||
d3-fetch@1:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-fetch/-/d3-fetch-1.2.0.tgz#15ce2ecfc41b092b1db50abd2c552c2316cf7fc7"
|
|
||||||
integrity sha512-yC78NBVcd2zFAyR/HnUiBS7Lf6inSCoWcSxFfw8FYL7ydiqe80SazNwoffcqOfs95XaLo7yebsmQqDKSsXUtvA==
|
|
||||||
dependencies:
|
|
||||||
d3-dsv "1"
|
|
||||||
|
|
||||||
d3-force@1:
|
|
||||||
version "1.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-1.2.1.tgz#fd29a5d1ff181c9e7f0669e4bd72bdb0e914ec0b"
|
|
||||||
integrity sha512-HHvehyaiUlVo5CxBJ0yF/xny4xoaxFxDnBXNvNcfW9adORGZfyNF1dj6DGLKyk4Yh3brP/1h3rnDzdIAwL08zg==
|
|
||||||
dependencies:
|
|
||||||
d3-collection "1"
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-quadtree "1"
|
|
||||||
d3-timer "1"
|
|
||||||
|
|
||||||
d3-format@1:
|
|
||||||
version "1.4.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.4.5.tgz#374f2ba1320e3717eb74a9356c67daee17a7edb4"
|
|
||||||
integrity sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==
|
|
||||||
|
|
||||||
d3-geo@1:
|
|
||||||
version "1.12.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.12.1.tgz#7fc2ab7414b72e59fbcbd603e80d9adc029b035f"
|
|
||||||
integrity sha512-XG4d1c/UJSEX9NfU02KwBL6BYPj8YKHxgBEw5om2ZnTRSbIcego6dhHwcxuSR3clxh0EpE38os1DVPOmnYtTPg==
|
|
||||||
dependencies:
|
|
||||||
d3-array "1"
|
|
||||||
|
|
||||||
d3-hierarchy@1:
|
|
||||||
version "1.1.9"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.9.tgz#2f6bee24caaea43f8dc37545fa01628559647a83"
|
|
||||||
integrity sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ==
|
|
||||||
|
|
||||||
d3-interpolate@1:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.4.0.tgz#526e79e2d80daa383f9e0c1c1c7dcc0f0583e987"
|
|
||||||
integrity sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==
|
|
||||||
dependencies:
|
|
||||||
d3-color "1"
|
|
||||||
|
|
||||||
d3-path@1:
|
|
||||||
version "1.0.9"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf"
|
|
||||||
integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==
|
|
||||||
|
|
||||||
d3-polygon@1:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-1.0.6.tgz#0bf8cb8180a6dc107f518ddf7975e12abbfbd38e"
|
|
||||||
integrity sha512-k+RF7WvI08PC8reEoXa/w2nSg5AUMTi+peBD9cmFc+0ixHfbs4QmxxkarVal1IkVkgxVuk9JSHhJURHiyHKAuQ==
|
|
||||||
|
|
||||||
d3-quadtree@1:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.7.tgz#ca8b84df7bb53763fe3c2f24bd435137f4e53135"
|
|
||||||
integrity sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA==
|
|
||||||
|
|
||||||
d3-random@1:
|
|
||||||
version "1.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.2.tgz#2833be7c124360bf9e2d3fd4f33847cfe6cab291"
|
|
||||||
integrity sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ==
|
|
||||||
|
|
||||||
d3-scale-chromatic@1:
|
|
||||||
version "1.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-1.5.0.tgz#54e333fc78212f439b14641fb55801dd81135a98"
|
|
||||||
integrity sha512-ACcL46DYImpRFMBcpk9HhtIyC7bTBR4fNOPxwVSl0LfulDAwyiHyPOTqcDG1+t5d4P9W7t/2NAuWu59aKko/cg==
|
|
||||||
dependencies:
|
|
||||||
d3-color "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
|
|
||||||
d3-scale@2:
|
|
||||||
version "2.2.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-2.2.2.tgz#4e880e0b2745acaaddd3ede26a9e908a9e17b81f"
|
|
||||||
integrity sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw==
|
|
||||||
dependencies:
|
|
||||||
d3-array "^1.2.0"
|
|
||||||
d3-collection "1"
|
|
||||||
d3-format "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
d3-time "1"
|
|
||||||
d3-time-format "2"
|
|
||||||
|
|
||||||
d3-selection@1, d3-selection@^1.1.0, d3-selection@^1.4.1:
|
|
||||||
version "1.4.2"
|
version "1.4.2"
|
||||||
resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.4.2.tgz#dcaa49522c0dbf32d6c1858afc26b6094555bc5c"
|
resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.4.2.tgz#dcaa49522c0dbf32d6c1858afc26b6094555bc5c"
|
||||||
integrity sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg==
|
integrity sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg==
|
||||||
|
|
||||||
d3-shape@1:
|
|
||||||
version "1.3.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7"
|
|
||||||
integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==
|
|
||||||
dependencies:
|
|
||||||
d3-path "1"
|
|
||||||
|
|
||||||
d3-time-format@2:
|
|
||||||
version "2.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.3.0.tgz#107bdc028667788a8924ba040faf1fbccd5a7850"
|
|
||||||
integrity sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==
|
|
||||||
dependencies:
|
|
||||||
d3-time "1"
|
|
||||||
|
|
||||||
d3-time@1:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.1.0.tgz#b1e19d307dae9c900b7e5b25ffc5dcc249a8a0f1"
|
|
||||||
integrity sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==
|
|
||||||
|
|
||||||
d3-timer@1:
|
|
||||||
version "1.0.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.10.tgz#dfe76b8a91748831b13b6d9c793ffbd508dd9de5"
|
|
||||||
integrity sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==
|
|
||||||
|
|
||||||
d3-transition@1:
|
|
||||||
version "1.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-1.3.2.tgz#a98ef2151be8d8600543434c1ca80140ae23b398"
|
|
||||||
integrity sha512-sc0gRU4PFqZ47lPVHloMn9tlPcv8jxgOQg+0zjhfZXMQuvppjG6YuwdMBE0TuqCZjeJkLecku/l9R0JPcRhaDA==
|
|
||||||
dependencies:
|
|
||||||
d3-color "1"
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-ease "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
d3-selection "^1.1.0"
|
|
||||||
d3-timer "1"
|
|
||||||
|
|
||||||
d3-voronoi@1:
|
|
||||||
version "1.1.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.4.tgz#dd3c78d7653d2bb359284ae478645d95944c8297"
|
|
||||||
integrity sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg==
|
|
||||||
|
|
||||||
d3-zoom@1:
|
|
||||||
version "1.8.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-1.8.3.tgz#b6a3dbe738c7763121cd05b8a7795ffe17f4fc0a"
|
|
||||||
integrity sha512-VoLXTK4wvy1a0JpH2Il+F2CiOhVu7VRXWF5M/LroMIh3/zBAC3WAt7QoIvPibOavVo20hN6/37vwAsdBejLyKQ==
|
|
||||||
dependencies:
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-drag "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
d3-selection "1"
|
|
||||||
d3-transition "1"
|
|
||||||
|
|
||||||
d3@^5.16.0:
|
|
||||||
version "5.16.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/d3/-/d3-5.16.0.tgz#9c5e8d3b56403c79d4ed42fbd62f6113f199c877"
|
|
||||||
integrity sha512-4PL5hHaHwX4m7Zr1UapXW23apo6pexCgdetdJ5kTmADpG/7T9Gkxw0M0tf/pjoB63ezCCm0u5UaFYy2aMt0Mcw==
|
|
||||||
dependencies:
|
|
||||||
d3-array "1"
|
|
||||||
d3-axis "1"
|
|
||||||
d3-brush "1"
|
|
||||||
d3-chord "1"
|
|
||||||
d3-collection "1"
|
|
||||||
d3-color "1"
|
|
||||||
d3-contour "1"
|
|
||||||
d3-dispatch "1"
|
|
||||||
d3-drag "1"
|
|
||||||
d3-dsv "1"
|
|
||||||
d3-ease "1"
|
|
||||||
d3-fetch "1"
|
|
||||||
d3-force "1"
|
|
||||||
d3-format "1"
|
|
||||||
d3-geo "1"
|
|
||||||
d3-hierarchy "1"
|
|
||||||
d3-interpolate "1"
|
|
||||||
d3-path "1"
|
|
||||||
d3-polygon "1"
|
|
||||||
d3-quadtree "1"
|
|
||||||
d3-random "1"
|
|
||||||
d3-scale "2"
|
|
||||||
d3-scale-chromatic "1"
|
|
||||||
d3-selection "1"
|
|
||||||
d3-shape "1"
|
|
||||||
d3-time "1"
|
|
||||||
d3-time-format "2"
|
|
||||||
d3-timer "1"
|
|
||||||
d3-transition "1"
|
|
||||||
d3-voronoi "1"
|
|
||||||
d3-zoom "1"
|
|
||||||
|
|
||||||
dashdash@^1.12.0:
|
dashdash@^1.12.0:
|
||||||
version "1.14.1"
|
version "1.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
||||||
|
@ -2995,7 +2738,7 @@ dotenv@^8.2.0:
|
||||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
|
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
|
||||||
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
|
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
|
||||||
|
|
||||||
downloadjs@^1.4.7:
|
downloadjs@1.4.7:
|
||||||
version "1.4.7"
|
version "1.4.7"
|
||||||
resolved "https://registry.yarnpkg.com/downloadjs/-/downloadjs-1.4.7.tgz#f69f96f940e0d0553dac291139865a3cd0101e3c"
|
resolved "https://registry.yarnpkg.com/downloadjs/-/downloadjs-1.4.7.tgz#f69f96f940e0d0553dac291139865a3cd0101e3c"
|
||||||
integrity sha1-9p+W+UDg0FU9rCkROYZaPNAQHjw=
|
integrity sha1-9p+W+UDg0FU9rCkROYZaPNAQHjw=
|
||||||
|
@ -3842,7 +3585,7 @@ human-signals@^1.1.1:
|
||||||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
|
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
|
||||||
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
|
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
|
||||||
|
|
||||||
iconv-lite@0.4, iconv-lite@0.4.24:
|
iconv-lite@0.4.24:
|
||||||
version "0.4.24"
|
version "0.4.24"
|
||||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
||||||
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
|
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
|
||||||
|
@ -5047,11 +4790,6 @@ lodash-es@^4.17.11:
|
||||||
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
|
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
|
||||||
integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==
|
integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==
|
||||||
|
|
||||||
lodash.assign@^4.2.0:
|
|
||||||
version "4.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
|
|
||||||
integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
|
|
||||||
|
|
||||||
lodash.once@^4.1.1:
|
lodash.once@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
|
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
|
||||||
|
@ -5062,7 +4800,12 @@ lodash.sortby@^4.7.0:
|
||||||
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
||||||
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
||||||
|
|
||||||
lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.19:
|
lodash@4.17.13:
|
||||||
|
version "4.17.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.13.tgz#0bdc3a6adc873d2f4e0c4bac285df91b64fc7b93"
|
||||||
|
integrity sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==
|
||||||
|
|
||||||
|
lodash@^4.17.15, lodash@^4.17.19:
|
||||||
version "4.17.20"
|
version "4.17.20"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
||||||
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
||||||
|
@ -6135,7 +5878,7 @@ relateurl@0.2.x:
|
||||||
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
||||||
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
|
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
|
||||||
|
|
||||||
remixicon@^2.5.0:
|
remixicon@2.5.0:
|
||||||
version "2.5.0"
|
version "2.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/remixicon/-/remixicon-2.5.0.tgz#b5e245894a1550aa23793f95daceadbf96ad1a41"
|
resolved "https://registry.yarnpkg.com/remixicon/-/remixicon-2.5.0.tgz#b5e245894a1550aa23793f95daceadbf96ad1a41"
|
||||||
integrity sha512-q54ra2QutYDZpuSnFjmeagmEiN9IMo56/zz5dDNitzKD23oFRw77cWo4TsrAdmdkPiEn8mxlrTqxnkujDbEGww==
|
integrity sha512-q54ra2QutYDZpuSnFjmeagmEiN9IMo56/zz5dDNitzKD23oFRw77cWo4TsrAdmdkPiEn8mxlrTqxnkujDbEGww==
|
||||||
|
@ -6436,11 +6179,6 @@ run-parallel@^1.1.9:
|
||||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef"
|
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef"
|
||||||
integrity sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==
|
integrity sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==
|
||||||
|
|
||||||
rw@1:
|
|
||||||
version "1.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4"
|
|
||||||
integrity sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=
|
|
||||||
|
|
||||||
rxjs@^6.3.3, rxjs@^6.5.5:
|
rxjs@^6.3.3, rxjs@^6.5.5:
|
||||||
version "6.6.3"
|
version "6.6.3"
|
||||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
|
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
|
||||||
|
@ -6583,10 +6321,10 @@ shellwords@^0.1.1:
|
||||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||||
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
||||||
|
|
||||||
shortid@^2.2.15:
|
shortid@2.2.15:
|
||||||
version "2.2.16"
|
version "2.2.15"
|
||||||
resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.16.tgz#b742b8f0cb96406fd391c76bfc18a67a57fe5608"
|
resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.15.tgz#2b902eaa93a69b11120373cd42a1f1fe4437c122"
|
||||||
integrity sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==
|
integrity sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid "^2.1.0"
|
nanoid "^2.1.0"
|
||||||
|
|
||||||
|
@ -6996,7 +6734,7 @@ svelte-loading-spinners@^0.1.1:
|
||||||
resolved "https://registry.yarnpkg.com/svelte-loading-spinners/-/svelte-loading-spinners-0.1.1.tgz#a35a811b7db0389ec2a5de6904c718c58c36e1f9"
|
resolved "https://registry.yarnpkg.com/svelte-loading-spinners/-/svelte-loading-spinners-0.1.1.tgz#a35a811b7db0389ec2a5de6904c718c58c36e1f9"
|
||||||
integrity sha512-or4zs10VOdczOJo3u25IINXQOkZbLNAxMrXK0PRbzVoJtPQq/QZPNxI32383bpe+soYcEKmESbmW+JlW3MbUKQ==
|
integrity sha512-or4zs10VOdczOJo3u25IINXQOkZbLNAxMrXK0PRbzVoJtPQq/QZPNxI32383bpe+soYcEKmESbmW+JlW3MbUKQ==
|
||||||
|
|
||||||
svelte-portal@^0.1.0:
|
svelte-portal@0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-0.1.0.tgz#cc2821cc84b05ed5814e0218dcdfcbebc53c1742"
|
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-0.1.0.tgz#cc2821cc84b05ed5814e0218dcdfcbebc53c1742"
|
||||||
integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg==
|
integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg==
|
||||||
|
@ -7317,16 +7055,16 @@ util.promisify@^1.0.0:
|
||||||
has-symbols "^1.0.1"
|
has-symbols "^1.0.1"
|
||||||
object.getownpropertydescriptors "^2.1.0"
|
object.getownpropertydescriptors "^2.1.0"
|
||||||
|
|
||||||
|
uuid@8.3.1:
|
||||||
|
version "8.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31"
|
||||||
|
integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==
|
||||||
|
|
||||||
uuid@^3.3.2:
|
uuid@^3.3.2:
|
||||||
version "3.4.0"
|
version "3.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||||
|
|
||||||
uuid@^8.3.1:
|
|
||||||
version "8.3.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31"
|
|
||||||
integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==
|
|
||||||
|
|
||||||
validate-npm-package-license@^3.0.1:
|
validate-npm-package-license@^3.0.1:
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"
|
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"
|
||||||
|
@ -7586,10 +7324,10 @@ yauzl@^2.10.0:
|
||||||
buffer-crc32 "~0.2.3"
|
buffer-crc32 "~0.2.3"
|
||||||
fd-slicer "~1.1.0"
|
fd-slicer "~1.1.0"
|
||||||
|
|
||||||
yup@^0.29.2:
|
yup@0.29.2:
|
||||||
version "0.29.3"
|
version "0.29.2"
|
||||||
resolved "https://registry.yarnpkg.com/yup/-/yup-0.29.3.tgz#69a30fd3f1c19f5d9e31b1cf1c2b851ce8045fea"
|
resolved "https://registry.yarnpkg.com/yup/-/yup-0.29.2.tgz#5302abd9024cca335b987793f8df868e410b7b67"
|
||||||
integrity sha512-RNUGiZ/sQ37CkhzKFoedkeMfJM0vNQyaz+wRZJzxdKE7VfDeVKH8bb4rr7XhRLbHJz5hSjoDNwMEIaKhuMZ8gQ==
|
integrity sha512-FbAAeopli+TnpZ8Lzv2M72wltLw58iWBT7wW8FuAPFPb3CelXmSKCXQbV1o4keywpIK1BZ0ULTLv2s3w1CfOwA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.5"
|
"@babel/runtime" "^7.10.5"
|
||||||
fn-name "~3.0.0"
|
fn-name "~3.0.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
|
@ -9,14 +9,14 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/string-templates": "^0.6.2",
|
"@budibase/string-templates": "^0.7.4",
|
||||||
"deep-equal": "^2.0.1",
|
"deep-equal": "^2.0.1",
|
||||||
"regexparam": "^1.3.0",
|
"regexparam": "^1.3.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"svelte-spa-router": "^3.0.5"
|
"svelte-spa-router": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@budibase/standard-components": "^0.6.2",
|
"@budibase/standard-components": "^0.7.4",
|
||||||
"@rollup/plugin-commonjs": "^16.0.0",
|
"@rollup/plugin-commonjs": "^16.0.0",
|
||||||
"@rollup/plugin-node-resolve": "^10.0.0",
|
"@rollup/plugin-node-resolve": "^10.0.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
|
@ -30,5 +30,5 @@
|
||||||
"svelte": "^3.30.0",
|
"svelte": "^3.30.0",
|
||||||
"svelte-jester": "^1.0.6"
|
"svelte-jester": "^1.0.6"
|
||||||
},
|
},
|
||||||
"gitHead": "62ebf3cedcd7e9b2494b4f8cbcfb90927609b491"
|
"gitHead": "1a80b09fd093f2599a68f7db72ad639dd50922dd"
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const fetchViewData = async ({
|
||||||
params.set("calculation", calculation)
|
params.set("calculation", calculation)
|
||||||
}
|
}
|
||||||
if (groupBy) {
|
if (groupBy) {
|
||||||
params.set("group", groupBy)
|
params.set("group", groupBy ? "true" : "false")
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUERY_VIEW_URL = field
|
const QUERY_VIEW_URL = field
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/electron.js",
|
"main": "src/electron.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -50,59 +50,59 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/client": "^0.6.2",
|
"@budibase/client": "^0.7.4",
|
||||||
"@budibase/string-templates": "^0.6.2",
|
"@budibase/string-templates": "^0.7.4",
|
||||||
"@elastic/elasticsearch": "^7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "8.0.0",
|
||||||
"@sendgrid/mail": "^7.1.1",
|
"@sendgrid/mail": "7.1.1",
|
||||||
"@sentry/node": "^5.19.2",
|
"@sentry/node": "5.19.2",
|
||||||
"airtable": "^0.10.1",
|
"airtable": "0.10.1",
|
||||||
"arangojs": "^7.2.0",
|
"arangojs": "7.2.0",
|
||||||
"aws-sdk": "^2.767.0",
|
"aws-sdk": "^2.767.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"chmodr": "^1.2.0",
|
"chmodr": "1.2.0",
|
||||||
"csvtojson": "^2.0.10",
|
"csvtojson": "2.0.10",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"download": "^8.0.0",
|
"download": "8.0.0",
|
||||||
"electron-is-dev": "^1.2.0",
|
"electron-is-dev": "1.2.0",
|
||||||
"electron-unhandled": "^3.0.2",
|
"electron-unhandled": "3.0.2",
|
||||||
"electron-updater": "^4.3.1",
|
"electron-updater": "4.3.1",
|
||||||
"electron-util": "^0.14.2",
|
"electron-util": "0.14.2",
|
||||||
"fix-path": "^3.0.0",
|
"fix-path": "3.0.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "8.1.0",
|
||||||
"jimp": "^0.16.1",
|
"jimp": "0.16.1",
|
||||||
"joi": "^17.2.1",
|
"joi": "17.2.1",
|
||||||
"jsonschema": "^1.4.0",
|
"jsonschema": "1.4.0",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "8.5.1",
|
||||||
"koa": "^2.7.0",
|
"koa": "2.7.0",
|
||||||
"koa-body": "^4.2.0",
|
"koa-body": "4.2.0",
|
||||||
"koa-compress": "^4.0.1",
|
"koa-compress": "4.0.1",
|
||||||
"koa-pino-logger": "^3.0.0",
|
"koa-pino-logger": "3.0.0",
|
||||||
"koa-send": "^5.0.0",
|
"koa-send": "5.0.0",
|
||||||
"koa-session": "^5.12.0",
|
"koa-session": "5.12.0",
|
||||||
"koa-static": "^5.0.0",
|
"koa-static": "5.0.0",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "4.17.13",
|
||||||
"mongodb": "^3.6.3",
|
"mongodb": "3.6.3",
|
||||||
"mssql": "^6.2.3",
|
"mssql": "6.2.3",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "2.18.1",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "2.6.0",
|
||||||
"open": "^7.3.0",
|
"open": "7.3.0",
|
||||||
"pg": "^8.5.1",
|
"pg": "8.5.1",
|
||||||
"pino-pretty": "^4.0.0",
|
"pino-pretty": "4.0.0",
|
||||||
"pouchdb": "^7.2.1",
|
"pouchdb": "7.2.1",
|
||||||
"pouchdb-all-dbs": "^1.0.2",
|
"pouchdb-all-dbs": "1.0.2",
|
||||||
"pouchdb-find": "^7.2.2",
|
"pouchdb-find": "^7.2.2",
|
||||||
"pouchdb-replication-stream": "^1.2.9",
|
"pouchdb-replication-stream": "1.2.9",
|
||||||
"sanitize-s3-objectkey": "^0.0.1",
|
"sanitize-s3-objectkey": "0.0.1",
|
||||||
"server-destroy": "^1.0.1",
|
"server-destroy": "1.0.1",
|
||||||
"svelte": "^3.30.0",
|
"svelte": "3.30.0",
|
||||||
"tar-fs": "^2.1.0",
|
"tar-fs": "2.1.0",
|
||||||
"to-json-schema": "^0.2.5",
|
"to-json-schema": "0.2.5",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "3.3.2",
|
||||||
"validate.js": "^0.13.1",
|
"validate.js": "0.13.1",
|
||||||
"worker-farm": "^1.7.0",
|
"worker-farm": "1.7.0",
|
||||||
"yargs": "^13.2.4",
|
"yargs": "13.2.4",
|
||||||
"zlib": "^1.0.5"
|
"zlib": "1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/test-sequencer": "^24.8.0",
|
"@jest/test-sequencer": "^24.8.0",
|
||||||
|
@ -121,5 +121,5 @@
|
||||||
"./scripts/jestSetup.js"
|
"./scripts/jestSetup.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gitHead": "62ebf3cedcd7e9b2494b4f8cbcfb90927609b491"
|
"gitHead": "1a80b09fd093f2599a68f7db72ad639dd50922dd"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,12 @@ const fs = require("fs-extra")
|
||||||
exports.exportAppDump = async function(ctx) {
|
exports.exportAppDump = async function(ctx) {
|
||||||
const { appId } = ctx.query
|
const { appId } = ctx.query
|
||||||
|
|
||||||
|
const appname = decodeURI(ctx.query.appname)
|
||||||
|
|
||||||
const backupsDir = path.join(os.homedir(), ".budibase", "backups")
|
const backupsDir = path.join(os.homedir(), ".budibase", "backups")
|
||||||
fs.ensureDirSync(backupsDir)
|
fs.ensureDirSync(backupsDir)
|
||||||
|
|
||||||
const backupIdentifier = `${appId} Backup: ${new Date()}.txt`
|
const backupIdentifier = `${appname}Backup${new Date().getTime()}.txt`
|
||||||
|
|
||||||
await performDump({
|
await performDump({
|
||||||
dir: backupsDir,
|
dir: backupsDir,
|
||||||
|
@ -23,19 +25,4 @@ exports.exportAppDump = async function(ctx) {
|
||||||
|
|
||||||
ctx.attachment(backupIdentifier)
|
ctx.attachment(backupIdentifier)
|
||||||
ctx.body = fs.createReadStream(backupFile)
|
ctx.body = fs.createReadStream(backupFile)
|
||||||
// ctx.body = {
|
|
||||||
// url: `/api/backups/download/${backupIdentifier}`,
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// exports.downloadAppDump = async function(ctx) {
|
|
||||||
// const fileName = ctx.params.fileName
|
|
||||||
|
|
||||||
// const backupsDir = path.join(os.homedir(), ".budibase", "backups")
|
|
||||||
// fs.ensureDirSync(backupsDir)
|
|
||||||
|
|
||||||
// const backupFile = path.join(backupsDir, fileName)
|
|
||||||
|
|
||||||
// ctx.attachment(fileName)
|
|
||||||
// ctx.body = fs.createReadStream(backupFile)
|
|
||||||
// }
|
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
const handlebars = require("handlebars")
|
const { processString } = require("@budibase/string-templates")
|
||||||
const CouchDB = require("../../db")
|
const CouchDB = require("../../db")
|
||||||
const { generateQueryID, getQueryParams } = require("../../db/utils")
|
const { generateQueryID, getQueryParams } = require("../../db/utils")
|
||||||
const { integrations } = require("../../integrations")
|
const { integrations } = require("../../integrations")
|
||||||
|
|
||||||
|
function formatResponse(resp) {
|
||||||
|
if (typeof resp === "string") {
|
||||||
|
resp = JSON.parse(resp)
|
||||||
|
}
|
||||||
|
if (!Array.isArray(resp)) {
|
||||||
|
resp = [resp]
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
exports.fetch = async function(ctx) {
|
exports.fetch = async function(ctx) {
|
||||||
const db = new CouchDB(ctx.user.appId)
|
const db = new CouchDB(ctx.user.appId)
|
||||||
|
|
||||||
|
@ -29,19 +39,22 @@ exports.save = async function(ctx) {
|
||||||
ctx.message = `Query ${query.name} saved successfully.`
|
ctx.message = `Query ${query.name} saved successfully.`
|
||||||
}
|
}
|
||||||
|
|
||||||
function enrichQueryFields(fields, parameters) {
|
async function enrichQueryFields(fields, parameters) {
|
||||||
const enrichedQuery = {}
|
const enrichedQuery = {}
|
||||||
|
|
||||||
// enrich the fields with dynamic parameters
|
// enrich the fields with dynamic parameters
|
||||||
for (let key in fields) {
|
for (let key of Object.keys(fields)) {
|
||||||
const template = handlebars.compile(fields[key])
|
enrichedQuery[key] = await processString(fields[key], parameters)
|
||||||
enrichedQuery[key] = template(parameters)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enrichedQuery.json || enrichedQuery.customData) {
|
if (enrichedQuery.json || enrichedQuery.customData) {
|
||||||
|
try {
|
||||||
enrichedQuery.json = JSON.parse(
|
enrichedQuery.json = JSON.parse(
|
||||||
enrichedQuery.json || enrichedQuery.customData
|
enrichedQuery.json || enrichedQuery.customData
|
||||||
)
|
)
|
||||||
|
} catch (err) {
|
||||||
|
throw { message: `JSON Invalid - error: ${err}` }
|
||||||
|
}
|
||||||
delete enrichedQuery.customData
|
delete enrichedQuery.customData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,9 +75,11 @@ exports.preview = async function(ctx) {
|
||||||
|
|
||||||
const { fields, parameters, queryVerb } = ctx.request.body
|
const { fields, parameters, queryVerb } = ctx.request.body
|
||||||
|
|
||||||
const enrichedQuery = enrichQueryFields(fields, parameters)
|
const enrichedQuery = await enrichQueryFields(fields, parameters)
|
||||||
|
|
||||||
ctx.body = await new Integration(datasource.config)[queryVerb](enrichedQuery)
|
ctx.body = formatResponse(
|
||||||
|
await new Integration(datasource.config)[queryVerb](enrichedQuery)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.execute = async function(ctx) {
|
exports.execute = async function(ctx) {
|
||||||
|
@ -80,17 +95,15 @@ exports.execute = async function(ctx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const enrichedQuery = enrichQueryFields(
|
const enrichedQuery = await enrichQueryFields(
|
||||||
query.fields,
|
query.fields,
|
||||||
ctx.request.body.parameters
|
ctx.request.body.parameters
|
||||||
)
|
)
|
||||||
|
|
||||||
// call the relevant CRUD method on the integration class
|
// call the relevant CRUD method on the integration class
|
||||||
const response = await new Integration(datasource.config)[query.queryVerb](
|
ctx.body = formatResponse(
|
||||||
enrichedQuery
|
await new Integration(datasource.config)[query.queryVerb](enrichedQuery)
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx.body = response
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.destroy = async function(ctx) {
|
exports.destroy = async function(ctx) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ const {
|
||||||
ViewNames,
|
ViewNames,
|
||||||
} = require("../../db/utils")
|
} = require("../../db/utils")
|
||||||
const usersController = require("./user")
|
const usersController = require("./user")
|
||||||
const { coerceRowValues } = require("../../utilities")
|
const { coerceRowValues, enrichRows } = require("../../utilities")
|
||||||
|
|
||||||
const TABLE_VIEW_BEGINS_WITH = `all${SEPARATOR}${DocumentTypes.TABLE}${SEPARATOR}`
|
const TABLE_VIEW_BEGINS_WITH = `all${SEPARATOR}${DocumentTypes.TABLE}${SEPARATOR}`
|
||||||
|
|
||||||
|
@ -190,7 +190,15 @@ exports.fetchView = async function(ctx) {
|
||||||
|
|
||||||
if (!calculation) {
|
if (!calculation) {
|
||||||
response.rows = response.rows.map(row => row.doc)
|
response.rows = response.rows.map(row => row.doc)
|
||||||
ctx.body = await linkRows.attachLinkInfo(appId, response.rows)
|
let table
|
||||||
|
try {
|
||||||
|
table = await db.get(ctx.params.tableId)
|
||||||
|
} catch (err) {
|
||||||
|
table = {
|
||||||
|
schema: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.body = await enrichRows(appId, table, response.rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calculation === CALCULATION_TYPES.STATS) {
|
if (calculation === CALCULATION_TYPES.STATS) {
|
||||||
|
@ -247,15 +255,15 @@ exports.search = async function(ctx) {
|
||||||
|
|
||||||
exports.fetchTableRows = async function(ctx) {
|
exports.fetchTableRows = async function(ctx) {
|
||||||
const appId = ctx.user.appId
|
const appId = ctx.user.appId
|
||||||
|
const db = new CouchDB(appId)
|
||||||
|
|
||||||
// special case for users, fetch through the user controller
|
// special case for users, fetch through the user controller
|
||||||
let rows
|
let rows,
|
||||||
|
table = await db.get(ctx.params.tableId)
|
||||||
if (ctx.params.tableId === ViewNames.USERS) {
|
if (ctx.params.tableId === ViewNames.USERS) {
|
||||||
await usersController.fetch(ctx)
|
await usersController.fetch(ctx)
|
||||||
rows = ctx.body
|
rows = ctx.body
|
||||||
} else {
|
} else {
|
||||||
const db = new CouchDB(appId)
|
|
||||||
|
|
||||||
const response = await db.allDocs(
|
const response = await db.allDocs(
|
||||||
getRowParams(ctx.params.tableId, null, {
|
getRowParams(ctx.params.tableId, null, {
|
||||||
include_docs: true,
|
include_docs: true,
|
||||||
|
@ -263,15 +271,16 @@ exports.fetchTableRows = async function(ctx) {
|
||||||
)
|
)
|
||||||
rows = response.rows.map(row => row.doc)
|
rows = response.rows.map(row => row.doc)
|
||||||
}
|
}
|
||||||
ctx.body = await linkRows.attachLinkInfo(appId, rows)
|
ctx.body = await enrichRows(appId, table, rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.find = async function(ctx) {
|
exports.find = async function(ctx) {
|
||||||
const appId = ctx.user.appId
|
const appId = ctx.user.appId
|
||||||
const db = new CouchDB(appId)
|
const db = new CouchDB(appId)
|
||||||
try {
|
try {
|
||||||
|
const table = await db.get(ctx.params.tableId)
|
||||||
const row = await findRow(db, appId, ctx.params.tableId, ctx.params.rowId)
|
const row = await findRow(db, appId, ctx.params.tableId, ctx.params.rowId)
|
||||||
ctx.body = await linkRows.attachLinkInfo(appId, row)
|
ctx.body = await enrichRows(appId, table, row)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(400, err)
|
ctx.throw(400, err)
|
||||||
}
|
}
|
||||||
|
@ -356,8 +365,9 @@ exports.fetchEnrichedRow = async function(ctx) {
|
||||||
keys: linkVals.map(linkVal => linkVal.id),
|
keys: linkVals.map(linkVal => linkVal.id),
|
||||||
})
|
})
|
||||||
// need to include the IDs in these rows for any links they may have
|
// need to include the IDs in these rows for any links they may have
|
||||||
let linkedRows = await linkRows.attachLinkInfo(
|
let linkedRows = await enrichRows(
|
||||||
appId,
|
appId,
|
||||||
|
table,
|
||||||
response.rows.map(row => row.doc)
|
response.rows.map(row => row.doc)
|
||||||
)
|
)
|
||||||
// insert the link rows in the correct place throughout the main row
|
// insert the link rows in the correct place throughout the main row
|
||||||
|
|
|
@ -17,11 +17,12 @@ const CouchDB = require("../../../db")
|
||||||
const setBuilderToken = require("../../../utilities/builder/setBuilderToken")
|
const setBuilderToken = require("../../../utilities/builder/setBuilderToken")
|
||||||
const fileProcessor = require("../../../utilities/fileProcessor")
|
const fileProcessor = require("../../../utilities/fileProcessor")
|
||||||
const env = require("../../../environment")
|
const env = require("../../../environment")
|
||||||
|
const { OBJ_STORE_DIRECTORY } = require("../../../constants")
|
||||||
|
|
||||||
function objectStoreUrl() {
|
function objectStoreUrl() {
|
||||||
if (env.SELF_HOSTED) {
|
if (env.SELF_HOSTED) {
|
||||||
// can use a relative url for this as all goes through the proxy (this is hosted in minio)
|
// can use a relative url for this as all goes through the proxy (this is hosted in minio)
|
||||||
return `/app-assets/assets`
|
return OBJ_STORE_DIRECTORY
|
||||||
} else {
|
} else {
|
||||||
return "https://cdn.app.budi.live/assets"
|
return "https://cdn.app.budi.live/assets"
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ exports.save = async function(ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update linked rows
|
// update linked rows
|
||||||
await linkRows.updateLinks({
|
const linkResp = await linkRows.updateLinks({
|
||||||
appId,
|
appId,
|
||||||
eventType: oldTable
|
eventType: oldTable
|
||||||
? linkRows.EventType.TABLE_UPDATED
|
? linkRows.EventType.TABLE_UPDATED
|
||||||
|
@ -116,6 +116,9 @@ exports.save = async function(ctx) {
|
||||||
table: tableToSave,
|
table: tableToSave,
|
||||||
oldTable: oldTable,
|
oldTable: oldTable,
|
||||||
})
|
})
|
||||||
|
if (linkResp != null && linkResp._rev) {
|
||||||
|
tableToSave._rev = linkResp._rev
|
||||||
|
}
|
||||||
|
|
||||||
// don't perform any updates until relationships have been
|
// don't perform any updates until relationships have been
|
||||||
// checked by the updateLinks function
|
// checked by the updateLinks function
|
||||||
|
|
|
@ -83,23 +83,42 @@ const controller = {
|
||||||
ctx.message = `View ${ctx.params.viewName} saved successfully.`
|
ctx.message = `View ${ctx.params.viewName} saved successfully.`
|
||||||
},
|
},
|
||||||
exportView: async ctx => {
|
exportView: async ctx => {
|
||||||
const view = ctx.query.view
|
const db = new CouchDB(ctx.user.appId)
|
||||||
|
const designDoc = await db.get("_design/database")
|
||||||
|
|
||||||
|
const viewName = decodeURI(ctx.query.view)
|
||||||
|
|
||||||
|
const view = designDoc.views[viewName]
|
||||||
const format = ctx.query.format
|
const format = ctx.query.format
|
||||||
|
|
||||||
|
if (view) {
|
||||||
|
ctx.params.viewName = viewName
|
||||||
// Fetch view rows
|
// Fetch view rows
|
||||||
ctx.params.viewName = view.name
|
ctx.query = {
|
||||||
ctx.query.group = view.groupBy
|
group: view.meta.groupBy,
|
||||||
if (view.field) {
|
calculation: view.meta.calculation,
|
||||||
ctx.query.stats = true
|
stats: !!view.meta.field,
|
||||||
ctx.query.field = view.field
|
field: view.meta.field,
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// table all_ view
|
||||||
|
ctx.params.viewName = viewName
|
||||||
|
}
|
||||||
|
|
||||||
await fetchView(ctx)
|
await fetchView(ctx)
|
||||||
|
|
||||||
|
let schema = view && view.meta && view.meta.schema
|
||||||
|
if (!schema) {
|
||||||
|
const tableId = ctx.params.tableId || view.meta.tableId
|
||||||
|
const table = await db.get(tableId)
|
||||||
|
schema = table.schema
|
||||||
|
}
|
||||||
|
|
||||||
// Export part
|
// Export part
|
||||||
let headers = Object.keys(view.schema)
|
let headers = Object.keys(schema)
|
||||||
const exporter = exporters[format]
|
const exporter = exporters[format]
|
||||||
const exportedFile = exporter(headers, ctx.body)
|
const exportedFile = exporter(headers, ctx.body)
|
||||||
const filename = `${view.name}.${format}`
|
const filename = `${viewName}.${format}`
|
||||||
fs.writeFileSync(join(os.tmpdir(), filename), exportedFile)
|
fs.writeFileSync(join(os.tmpdir(), filename), exportedFile)
|
||||||
|
|
||||||
ctx.attachment(filename)
|
ctx.attachment(filename)
|
||||||
|
|
|
@ -6,10 +6,5 @@ const { BUILDER } = require("../../utilities/security/permissions")
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump)
|
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump)
|
||||||
// .get(
|
|
||||||
// "/api/backups/download/:fileName",
|
|
||||||
// authorized(BUILDER),
|
|
||||||
// controller.downloadAppDump
|
|
||||||
// )
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|
|
@ -26,6 +26,7 @@ function generateQueryValidation() {
|
||||||
name: Joi.string().required(),
|
name: Joi.string().required(),
|
||||||
fields: Joi.object().required(),
|
fields: Joi.object().required(),
|
||||||
datasourceId: Joi.string().required(),
|
datasourceId: Joi.string().required(),
|
||||||
|
readable: Joi.boolean(),
|
||||||
parameters: Joi.array().items(Joi.object({
|
parameters: Joi.array().items(Joi.object({
|
||||||
name: Joi.string(),
|
name: Joi.string(),
|
||||||
default: Joi.string()
|
default: Joi.string()
|
||||||
|
|
|
@ -37,11 +37,7 @@ exports.defaultHeaders = appId => {
|
||||||
return headers
|
return headers
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.createTable = async (request, appId, table) => {
|
exports.BASE_TABLE = {
|
||||||
if (table != null && table._id) {
|
|
||||||
delete table._id
|
|
||||||
}
|
|
||||||
table = table || {
|
|
||||||
name: "TestTable",
|
name: "TestTable",
|
||||||
type: "table",
|
type: "table",
|
||||||
key: "name",
|
key: "name",
|
||||||
|
@ -59,7 +55,13 @@ exports.createTable = async (request, appId, table) => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.createTable = async (request, appId, table, removeId = true) => {
|
||||||
|
if (removeId && table != null && table._id) {
|
||||||
|
delete table._id
|
||||||
}
|
}
|
||||||
|
table = table || exports.BASE_TABLE
|
||||||
|
|
||||||
const res = await request
|
const res = await request
|
||||||
.post(`/api/tables`)
|
.post(`/api/tables`)
|
||||||
|
@ -68,6 +70,25 @@ exports.createTable = async (request, appId, table) => {
|
||||||
return res.body
|
return res.body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.createLinkedTable = async (request, appId) => {
|
||||||
|
// get the ID to link to
|
||||||
|
const table = await exports.createTable(request, appId)
|
||||||
|
table.schema.link = {
|
||||||
|
type: "link",
|
||||||
|
fieldName: "link",
|
||||||
|
tableId: table._id,
|
||||||
|
}
|
||||||
|
return exports.createTable(request, appId, table, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.createAttachmentTable = async (request, appId) => {
|
||||||
|
const table = await exports.createTable(request, appId)
|
||||||
|
table.schema.attachment = {
|
||||||
|
type: "attachment",
|
||||||
|
}
|
||||||
|
return exports.createTable(request, appId, table, false)
|
||||||
|
}
|
||||||
|
|
||||||
exports.getAllFromTable = async (request, appId, tableId) => {
|
exports.getAllFromTable = async (request, appId, tableId) => {
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(`/api/${tableId}/rows`)
|
.get(`/api/${tableId}/rows`)
|
||||||
|
|
|
@ -3,7 +3,11 @@ const {
|
||||||
createTable,
|
createTable,
|
||||||
supertest,
|
supertest,
|
||||||
defaultHeaders,
|
defaultHeaders,
|
||||||
|
createLinkedTable,
|
||||||
|
createAttachmentTable,
|
||||||
} = require("./couchTestUtils");
|
} = require("./couchTestUtils");
|
||||||
|
const { enrichRows } = require("../../../utilities")
|
||||||
|
const env = require("../../../environment")
|
||||||
|
|
||||||
describe("/rows", () => {
|
describe("/rows", () => {
|
||||||
let request
|
let request
|
||||||
|
@ -270,4 +274,44 @@ describe("/rows", () => {
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("enrich row unit test", () => {
|
||||||
|
it("should allow enriching some linked rows", async () => {
|
||||||
|
const table = await createLinkedTable(request, appId)
|
||||||
|
const firstRow = (await createRow({
|
||||||
|
name: "Test Contact",
|
||||||
|
description: "original description",
|
||||||
|
tableId: table._id
|
||||||
|
})).body
|
||||||
|
const secondRow = (await createRow({
|
||||||
|
name: "Test 2",
|
||||||
|
description: "og desc",
|
||||||
|
link: [firstRow._id],
|
||||||
|
tableId: table._id,
|
||||||
|
})).body
|
||||||
|
const enriched = await enrichRows(appId, table, [secondRow])
|
||||||
|
expect(enriched[0].link.length).toBe(1)
|
||||||
|
expect(enriched[0].link[0]).toBe(firstRow._id)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should allow enriching attachment rows", async () => {
|
||||||
|
const table = await createAttachmentTable(request, appId)
|
||||||
|
const row = (await createRow({
|
||||||
|
name: "test",
|
||||||
|
description: "test",
|
||||||
|
attachment: [{
|
||||||
|
url: "/test/thing",
|
||||||
|
}],
|
||||||
|
tableId: table._id,
|
||||||
|
})).body
|
||||||
|
// the environment needs configured for this
|
||||||
|
env.CLOUD = 1
|
||||||
|
env.SELF_HOSTED = 1
|
||||||
|
const enriched = await enrichRows(appId, table, [row])
|
||||||
|
expect(enriched[0].attachment[0].url).toBe(`/app-assets/assets/${appId}/test/thing`)
|
||||||
|
// remove env config
|
||||||
|
env.CLOUD = undefined
|
||||||
|
env.SELF_HOSTED = undefined
|
||||||
|
})
|
||||||
})
|
})
|
|
@ -12,6 +12,7 @@ const usage = require("../../middleware/usageQuota")
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
router
|
router
|
||||||
|
.get("/api/views/export", authorized(BUILDER), viewController.exportView)
|
||||||
.get(
|
.get(
|
||||||
"/api/views/:viewName",
|
"/api/views/:viewName",
|
||||||
authorized(PermissionTypes.VIEW, PermissionLevels.READ),
|
authorized(PermissionTypes.VIEW, PermissionLevels.READ),
|
||||||
|
@ -25,6 +26,5 @@ router
|
||||||
viewController.destroy
|
viewController.destroy
|
||||||
)
|
)
|
||||||
.post("/api/views", authorized(BUILDER), usage, viewController.save)
|
.post("/api/views", authorized(BUILDER), usage, viewController.save)
|
||||||
.post("/api/views/export", authorized(BUILDER), viewController.exportView)
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|
|
@ -43,3 +43,4 @@ exports.AuthTypes = AuthTypes
|
||||||
exports.USERS_TABLE_SCHEMA = USERS_TABLE_SCHEMA
|
exports.USERS_TABLE_SCHEMA = USERS_TABLE_SCHEMA
|
||||||
exports.BUILDER_CONFIG_DB = "builder-config-db"
|
exports.BUILDER_CONFIG_DB = "builder-config-db"
|
||||||
exports.HOSTING_DOC = "hosting-doc"
|
exports.HOSTING_DOC = "hosting-doc"
|
||||||
|
exports.OBJ_STORE_DIRECTORY = "/app-assets/assets"
|
||||||
|
|
|
@ -252,7 +252,11 @@ class LinkController {
|
||||||
tableId: table._id,
|
tableId: table._id,
|
||||||
fieldName: fieldName,
|
fieldName: fieldName,
|
||||||
}
|
}
|
||||||
await this._db.put(linkedTable)
|
const response = await this._db.put(linkedTable)
|
||||||
|
// special case for when linking back to self, make sure rev updated
|
||||||
|
if (linkedTable._id === table._id) {
|
||||||
|
table._rev = response.rev
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return table
|
return table
|
||||||
|
|
|
@ -31,12 +31,15 @@ exports.createLinkView = async appId => {
|
||||||
thisId: doc1.rowId,
|
thisId: doc1.rowId,
|
||||||
fieldName: doc1.fieldName,
|
fieldName: doc1.fieldName,
|
||||||
})
|
})
|
||||||
|
// if linking to same table can't emit twice
|
||||||
|
if (doc1.tableId !== doc2.tableId) {
|
||||||
emit([doc2.tableId, doc2.rowId], {
|
emit([doc2.tableId, doc2.rowId], {
|
||||||
id: doc1.rowId,
|
id: doc1.rowId,
|
||||||
thisId: doc2.rowId,
|
thisId: doc2.rowId,
|
||||||
fieldName: doc2.fieldName,
|
fieldName: doc2.fieldName,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}.toString(),
|
}.toString(),
|
||||||
}
|
}
|
||||||
designDoc.views = {
|
designDoc.views = {
|
||||||
|
@ -81,6 +84,13 @@ exports.getLinkDocuments = async function({
|
||||||
// filter to get unique entries
|
// filter to get unique entries
|
||||||
const foundIds = []
|
const foundIds = []
|
||||||
linkRows = linkRows.filter(link => {
|
linkRows = linkRows.filter(link => {
|
||||||
|
// make sure anything unique is the correct key
|
||||||
|
if (
|
||||||
|
(tableId && link.key[0] !== tableId) ||
|
||||||
|
(rowId && link.key[1] !== rowId)
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const unique = foundIds.indexOf(link.id) === -1
|
const unique = foundIds.indexOf(link.id) === -1
|
||||||
if (unique) {
|
if (unique) {
|
||||||
foundIds.push(link.id)
|
foundIds.push(link.id)
|
||||||
|
|
|
@ -17,20 +17,27 @@ const SCHEMA = {
|
||||||
type: FIELD_TYPES.PASSWORD,
|
type: FIELD_TYPES.PASSWORD,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
endpoint: {
|
||||||
|
type: FIELD_TYPES.STRING,
|
||||||
|
required: false,
|
||||||
|
default: "https://dynamodb.us-east-1.amazonaws.com",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
create: {
|
create: {
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
|
customisable: true,
|
||||||
fields: {
|
fields: {
|
||||||
table: {
|
table: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
customisable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
read: {
|
read: {
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
|
customisable: true,
|
||||||
|
readable: true,
|
||||||
fields: {
|
fields: {
|
||||||
table: {
|
table: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
|
@ -39,30 +46,51 @@ const SCHEMA = {
|
||||||
index: {
|
index: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
scan: {
|
||||||
|
type: QUERY_TYPES.FIELDS,
|
||||||
customisable: true,
|
customisable: true,
|
||||||
|
readable: true,
|
||||||
|
fields: {
|
||||||
|
table: {
|
||||||
|
type: FIELD_TYPES.STRING,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: FIELD_TYPES.STRING,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
get: {
|
||||||
|
type: QUERY_TYPES.FIELDS,
|
||||||
|
customisable: true,
|
||||||
|
readable: true,
|
||||||
|
fields: {
|
||||||
|
table: {
|
||||||
|
type: FIELD_TYPES.STRING,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
|
customisable: true,
|
||||||
fields: {
|
fields: {
|
||||||
table: {
|
table: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
customisable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
|
customisable: true,
|
||||||
fields: {
|
fields: {
|
||||||
table: {
|
table: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
key: {
|
|
||||||
type: FIELD_TYPES.STRING,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -72,7 +100,15 @@ class DynamoDBIntegration {
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.config = config
|
this.config = config
|
||||||
this.connect()
|
this.connect()
|
||||||
this.client = new AWS.DynamoDB.DocumentClient()
|
let options = {
|
||||||
|
correctClockSkew: true,
|
||||||
|
}
|
||||||
|
if (config.endpoint) {
|
||||||
|
options.endpoint = config.endpoint
|
||||||
|
}
|
||||||
|
this.client = new AWS.DynamoDB.DocumentClient({
|
||||||
|
correctClockSkew: true,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
|
@ -80,37 +116,65 @@ class DynamoDBIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(query) {
|
async create(query) {
|
||||||
const response = await this.client.query({
|
const params = {
|
||||||
TableName: query.table,
|
TableName: query.table,
|
||||||
Item: query.json,
|
...query.json,
|
||||||
})
|
}
|
||||||
return response
|
return this.client.put(params).promise()
|
||||||
}
|
}
|
||||||
|
|
||||||
async read(query) {
|
async read(query) {
|
||||||
const response = await this.client.query({
|
const params = {
|
||||||
TableName: query.Table,
|
TableName: query.table,
|
||||||
...query.json,
|
...query.json,
|
||||||
})
|
}
|
||||||
|
if (query.index) {
|
||||||
|
params.IndexName = query.index
|
||||||
|
}
|
||||||
|
const response = await this.client.query(params).promise()
|
||||||
|
if (response.Items) {
|
||||||
|
return response.Items
|
||||||
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async scan(query) {
|
||||||
|
const params = {
|
||||||
|
TableName: query.table,
|
||||||
|
...query.json,
|
||||||
|
}
|
||||||
|
if (query.index) {
|
||||||
|
params.IndexName = query.index
|
||||||
|
}
|
||||||
|
const response = await this.client.scan(params).promise()
|
||||||
|
if (response.Items) {
|
||||||
|
return response.Items
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
async get(query) {
|
||||||
|
const params = {
|
||||||
|
TableName: query.table,
|
||||||
|
...query.json,
|
||||||
|
}
|
||||||
|
return this.client.get(params).promise()
|
||||||
|
}
|
||||||
|
|
||||||
async update(query) {
|
async update(query) {
|
||||||
const response = await this.client.query({
|
const params = {
|
||||||
TableName: query.Table,
|
TableName: query.Table,
|
||||||
...query.json,
|
...query.json,
|
||||||
})
|
}
|
||||||
return response
|
return this.client.update(params).promise()
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(query) {
|
async delete(query) {
|
||||||
const response = await this.client.query({
|
const params = {
|
||||||
TableName: query.Table,
|
TableName: query.table,
|
||||||
Key: {
|
...query.json,
|
||||||
id: query.key,
|
}
|
||||||
},
|
return this.client.delete(params).promise()
|
||||||
})
|
|
||||||
return response
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,11 @@ const SCHEMA = {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
default: "localhost",
|
default: "localhost",
|
||||||
},
|
},
|
||||||
|
port: {
|
||||||
|
type: FIELD_TYPES.NUMBER,
|
||||||
|
required: false,
|
||||||
|
default: 1433,
|
||||||
|
},
|
||||||
database: {
|
database: {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
default: "root",
|
default: "root",
|
||||||
|
|
|
@ -1,25 +1,31 @@
|
||||||
const mysql = require("mysql")
|
const mysql = require("mysql")
|
||||||
|
const { FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
docs: "https://github.com/mysqljs/mysql",
|
docs: "https://github.com/mysqljs/mysql",
|
||||||
datasource: {
|
datasource: {
|
||||||
host: {
|
host: {
|
||||||
type: "string",
|
type: FIELD_TYPES.STRING,
|
||||||
default: "localhost",
|
default: "localhost",
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
port: {
|
||||||
|
type: FIELD_TYPES.NUMBER,
|
||||||
|
default: 1433,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
user: {
|
user: {
|
||||||
type: "string",
|
type: FIELD_TYPES.STRING,
|
||||||
default: "root",
|
default: "root",
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
password: {
|
password: {
|
||||||
type: "password",
|
type: FIELD_TYPES.PASSWORD,
|
||||||
default: "root",
|
default: "root",
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
database: {
|
database: {
|
||||||
type: "string",
|
type: FIELD_TYPES.STRING,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,8 @@ const { DocumentTypes, SEPARATOR } = require("../db/utils")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const { cloneDeep } = require("lodash/fp")
|
const { cloneDeep } = require("lodash/fp")
|
||||||
const CouchDB = require("../db")
|
const CouchDB = require("../db")
|
||||||
|
const { OBJ_STORE_DIRECTORY } = require("../constants")
|
||||||
|
const linkRows = require("../db/linkedRows")
|
||||||
|
|
||||||
const APP_PREFIX = DocumentTypes.APP + SEPARATOR
|
const APP_PREFIX = DocumentTypes.APP + SEPARATOR
|
||||||
|
|
||||||
|
@ -211,3 +213,34 @@ exports.getAllApps = async () => {
|
||||||
.map(({ value }) => value)
|
.map(({ value }) => value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function "enriches" the input rows with anything they are supposed to contain, for example
|
||||||
|
* link records or attachment links.
|
||||||
|
* @param {string} appId the ID of the application for which rows are being enriched.
|
||||||
|
* @param {object} table the table from which these rows came from originally, this is used to determine
|
||||||
|
* the schema of the rows and then enrich.
|
||||||
|
* @param {object[]} rows the rows which are to be enriched.
|
||||||
|
* @returns {object[]} the enriched rows will be returned.
|
||||||
|
*/
|
||||||
|
exports.enrichRows = async (appId, table, rows) => {
|
||||||
|
// attach any linked row information
|
||||||
|
const enriched = await linkRows.attachLinkInfo(appId, rows)
|
||||||
|
// update the attachments URL depending on hosting
|
||||||
|
if (env.CLOUD && env.SELF_HOSTED) {
|
||||||
|
for (let [property, column] of Object.entries(table.schema)) {
|
||||||
|
if (column.type === "attachment") {
|
||||||
|
for (let row of enriched) {
|
||||||
|
if (row[property] == null || row[property].length === 0) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
row[property].forEach(attachment => {
|
||||||
|
attachment.url = `${OBJ_STORE_DIRECTORY}/${appId}/${attachment.url}`
|
||||||
|
attachment.url = attachment.url.replace("//", "/")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return enriched
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -214,18 +214,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Text 1",
|
"label": "Subheading",
|
||||||
"key": "text1"
|
"key": "subheading"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"label": "Text 2",
|
|
||||||
"key": "text2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"label": "Text 3",
|
|
||||||
"key": "text3"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "screen",
|
"type": "screen",
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"svelte"
|
"svelte"
|
||||||
],
|
],
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"gitHead": "62ebf3cedcd7e9b2494b4f8cbcfb90927609b491",
|
"gitHead": "1a80b09fd093f2599a68f7db72ad639dd50922dd",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.55.1",
|
"@budibase/bbui": "^1.55.1",
|
||||||
"@budibase/svelte-ag-grid": "^0.0.16",
|
"@budibase/svelte-ag-grid": "^0.0.16",
|
||||||
|
|
|
@ -60,13 +60,18 @@
|
||||||
.nav__menu {
|
.nav__menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
gap: 16px;
|
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.nav__menu > a {
|
|
||||||
|
.nav__menu > * {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.nav__menu > a) {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
|
|
||||||
export let imageUrl = ""
|
export let imageUrl = ""
|
||||||
export let heading = ""
|
export let heading = ""
|
||||||
export let text1 = ""
|
export let subheading = ""
|
||||||
export let text2 = ""
|
|
||||||
export let text3 = ""
|
|
||||||
export let destinationUrl = ""
|
export let destinationUrl = ""
|
||||||
|
|
||||||
$: showImage = !!imageUrl
|
$: showImage = !!imageUrl
|
||||||
|
@ -16,16 +14,16 @@
|
||||||
|
|
||||||
<div class="container" use:styleable={$component.styles}>
|
<div class="container" use:styleable={$component.styles}>
|
||||||
<a href={destinationUrl}>
|
<a href={destinationUrl}>
|
||||||
<div class="content">
|
<div class="stackedlist">
|
||||||
{#if showImage}
|
{#if showImage}
|
||||||
<div class="image-block">
|
<div class="image-block">
|
||||||
<img class="image" src={imageUrl} alt="" />
|
<img class="image" src={imageUrl} alt="" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<h2 class="heading">{heading}</h2>
|
<div class="content">
|
||||||
<h4 class="text">{text1}</h4>
|
<div class="heading">{heading}</div>
|
||||||
<h4 class="text">{text2}</h4>
|
<div class="subheading">{subheading}</div>
|
||||||
<h4 class="text3">{text3}</h4>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,61 +32,51 @@
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
padding: 20px;
|
padding: 1rem 1.5rem;
|
||||||
|
min-height: 3rem;
|
||||||
|
display: block;
|
||||||
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.stackedlist {
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 120px 300px 1fr 1fr 1fr;
|
|
||||||
align-items: center;
|
|
||||||
gap: 20px;
|
|
||||||
min-height: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 800px) {
|
|
||||||
.content {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.image-block {
|
|
||||||
width: 80px;
|
|
||||||
height: 80px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: row;
|
||||||
justify-content: center;
|
overflow: hidden;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image {
|
.subheading {
|
||||||
padding: 2px;
|
opacity: 0.6;
|
||||||
max-width: 80px;
|
}
|
||||||
max-height: 80px;
|
|
||||||
margin-right: 20px;
|
.content {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
font-size: 24px;
|
font-weight: 600;
|
||||||
margin: 0;
|
|
||||||
min-width: 200px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.image-block {
|
||||||
font-size: 16px;
|
display: flex;
|
||||||
font-weight: 400;
|
flex: 0 0 auto;
|
||||||
|
margin-right: 1.5rem;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text3 {
|
.image {
|
||||||
text-align: end;
|
display: block;
|
||||||
font-size: 16px;
|
overflow: hidden;
|
||||||
font-weight: 400;
|
width: 3rem;
|
||||||
}
|
max-width: 100%;
|
||||||
|
-webkit-user-select: none;
|
||||||
@media (max-width: 800px) {
|
user-select: none;
|
||||||
.text3 {
|
border-radius: 99px;
|
||||||
text-align: start;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@budibase/bbui@^1.55.1":
|
"@budibase/bbui@^1.55.1":
|
||||||
version "1.55.1"
|
version "1.56.2"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.55.1.tgz#291fb6fa10479b49f078d3a911ad0ed42c2e6b12"
|
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.56.2.tgz#bb8f7d9b9b5ed06a22df877fbe028780d7602471"
|
||||||
integrity sha512-bxsHBwkOqCtuFz89e0hAXwvwycfS4xPPrEge5PxK1Lh3uqetO4bXoIxYaIDjfi2Ku7CYIzEmOwSloNaQWeTF4g==
|
integrity sha512-cWYkT1FNwNGTjisxtC5/MlQ1zeu7MYbMJsD6UyCEW3Ku6JIQZ6jyOkV6HKrmNND8VzVfddEGpzR37q+NoDpDFQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
markdown-it "^12.0.2"
|
markdown-it "^12.0.2"
|
||||||
quill "^1.3.7"
|
quill "^1.3.7"
|
||||||
|
@ -1034,7 +1034,12 @@ fill-range@^7.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
to-regex-range "^5.0.1"
|
to-regex-range "^5.0.1"
|
||||||
|
|
||||||
flatpickr@^4.5.2, flatpickr@^4.6.6:
|
flatpickr@^4.5.2:
|
||||||
|
version "4.6.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/flatpickr/-/flatpickr-4.6.9.tgz#9a13383e8a6814bda5d232eae3fcdccb97dc1499"
|
||||||
|
integrity sha512-F0azNNi8foVWKSF+8X+ZJzz8r9sE1G4hl06RyceIaLvyltKvDl6vqk9Lm/6AUUCi5HWaIjiUbk7UpeE/fOXOpw==
|
||||||
|
|
||||||
|
flatpickr@^4.6.6:
|
||||||
version "4.6.6"
|
version "4.6.6"
|
||||||
resolved "https://registry.yarnpkg.com/flatpickr/-/flatpickr-4.6.6.tgz#34d2ad80adfa34254e62583a34264d472f1038d6"
|
resolved "https://registry.yarnpkg.com/flatpickr/-/flatpickr-4.6.6.tgz#34d2ad80adfa34254e62583a34264d472f1038d6"
|
||||||
integrity sha512-EZ48CJMttMg3maMhJoX+GvTuuEhX/RbA1YeuI19attP3pwBdbYy6+yqAEVm0o0hSBFYBiLbVxscLW6gJXq6H3A==
|
integrity sha512-EZ48CJMttMg3maMhJoX+GvTuuEhX/RbA1YeuI19attP3pwBdbYy6+yqAEVm0o0hSBFYBiLbVxscLW6gJXq6H3A==
|
||||||
|
@ -1558,9 +1563,9 @@ loader-utils@^1.1.0:
|
||||||
json5 "^1.0.1"
|
json5 "^1.0.1"
|
||||||
|
|
||||||
local-access@^1.0.1:
|
local-access@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/local-access/-/local-access-1.0.1.tgz#5121258146d64e869046c642ea4f1dd39ff942bb"
|
resolved "https://registry.yarnpkg.com/local-access/-/local-access-1.1.0.tgz#e007c76ba2ca83d5877ba1a125fc8dfe23ba4798"
|
||||||
integrity sha512-ykt2pgN0aqIy6KQC1CqdWTWkmUwNgaOS6dcpHVjyBJONA+Xi7AtSB1vuxC/U/0tjIP3wcRudwQk1YYzUvzk2bA==
|
integrity sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==
|
||||||
|
|
||||||
lodash.camelcase@^4.3.0:
|
lodash.camelcase@^4.3.0:
|
||||||
version "4.3.0"
|
version "4.3.0"
|
||||||
|
@ -1648,9 +1653,9 @@ miller-rabin@^4.0.0:
|
||||||
brorand "^1.0.1"
|
brorand "^1.0.1"
|
||||||
|
|
||||||
mime@^2.3.1:
|
mime@^2.3.1:
|
||||||
version "2.4.6"
|
version "2.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1"
|
resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.0.tgz#2b4af934401779806ee98026bb42e8c1ae1876b1"
|
||||||
integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==
|
integrity sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag==
|
||||||
|
|
||||||
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
|
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
|
@ -2481,9 +2486,9 @@ rollup@^2.11.2:
|
||||||
fsevents "~2.1.2"
|
fsevents "~2.1.2"
|
||||||
|
|
||||||
sade@^1.4.0:
|
sade@^1.4.0:
|
||||||
version "1.7.3"
|
version "1.7.4"
|
||||||
resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.3.tgz#a217ccc4fb4abb2d271648bf48f6628b2636fa1b"
|
resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.4.tgz#ea681e0c65d248d2095c90578c03ca0bb1b54691"
|
||||||
integrity sha512-m4BctppMvJ60W1dXnHq7jMmFe3hPJZDAH85kQ3ACTo7XZNVUuTItCQ+2HfyaMeV5cKrbw7l4vD/6We3GBxvdJw==
|
integrity sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==
|
||||||
dependencies:
|
dependencies:
|
||||||
mri "^1.1.0"
|
mri "^1.1.0"
|
||||||
|
|
||||||
|
|
|
@ -2,26 +2,30 @@
|
||||||
This package provides a common system for string templating across the Budibase Builder, client and server.
|
This package provides a common system for string templating across the Budibase Builder, client and server.
|
||||||
The templating is provided through the use of [Handlebars](https://handlebarsjs.com/) an extension of Mustache
|
The templating is provided through the use of [Handlebars](https://handlebarsjs.com/) an extension of Mustache
|
||||||
which is capable of carrying out logic. We have also extended the base Handlebars functionality through the use
|
which is capable of carrying out logic. We have also extended the base Handlebars functionality through the use
|
||||||
of a set of helpers provided through the [handlebars-helpers](https://github.com/helpers/handlebars-helpers) package.
|
of a set of helpers provided through the [handlebars-helpers](https://github.com/budibase/handlebars-helpers) package.
|
||||||
|
|
||||||
We have not implemented all the helpers provided by the helpers package as some of them provide functionality
|
We have not implemented all the helpers provided by the helpers package as some of them provide functionality
|
||||||
we felt would not be beneficial. The following collections of helpers have been implemented:
|
we felt would not be beneficial. The following collections of helpers have been implemented:
|
||||||
1. [Math](https://github.com/helpers/handlebars-helpers/tree/master#math) - a set of useful helpers for
|
1. [Math](https://github.com/budibase/handlebars-helpers/tree/master#math) - a set of useful helpers for
|
||||||
carrying out logic pertaining to numbers e.g. `avg`, `add`, `abs` and so on.
|
carrying out logic pertaining to numbers e.g. `avg`, `add`, `abs` and so on.
|
||||||
2. [Array](https://github.com/helpers/handlebars-helpers/tree/master#array) - some very specific helpers
|
2. [Array](https://github.com/budibase/handlebars-helpers/tree/master#array) - some very specific helpers
|
||||||
for use with arrays, useful for example in automations. Helpers like `first`, `last`, `after` and `join`
|
for use with arrays, useful for example in automations. Helpers like `first`, `last`, `after` and `join`
|
||||||
can be useful for getting particular portions of arrays or turning them into strings.
|
can be useful for getting particular portions of arrays or turning them into strings.
|
||||||
3. [Number](https://github.com/helpers/handlebars-helpers/tree/master#number) - unlike the math helpers these
|
3. [Number](https://github.com/budibase/handlebars-helpers/tree/master#number) - unlike the math helpers these
|
||||||
are useful for converting numbers into useful formats for display, e.g. `bytes`, `addCommas` and `toPrecision`.
|
are useful for converting numbers into useful formats for display, e.g. `bytes`, `addCommas` and `toPrecision`.
|
||||||
4. [URL](https://github.com/helpers/handlebars-helpers/tree/master#url) - very specific helpers for dealing with URLs,
|
4. [URL](https://github.com/budibase/handlebars-helpers/tree/master#url) - very specific helpers for dealing with URLs,
|
||||||
such as `encodeURI`, `escape`, `stripQueryString` and `stripProtocol`. These are primarily useful
|
such as `encodeURI`, `escape`, `stripQueryString` and `stripProtocol`. These are primarily useful
|
||||||
for building up particular URLs to hit as say part of an automation.
|
for building up particular URLs to hit as say part of an automation.
|
||||||
5. [String](https://github.com/helpers/handlebars-helpers/tree/master#string) - these helpers are useful for building
|
5. [String](https://github.com/budibase/handlebars-helpers/tree/master#string) - these helpers are useful for building
|
||||||
strings and preparing them for display, e.g. `append`, `camelcase`, `capitalize` and `ellipsis`.
|
strings and preparing them for display, e.g. `append`, `camelcase`, `capitalize` and `ellipsis`.
|
||||||
6. [Comparison](https://github.com/helpers/handlebars-helpers/tree/master#comparison) - these helpers are mainly for
|
6. [Comparison](https://github.com/budibase/handlebars-helpers/tree/master#comparison) - these helpers are mainly for
|
||||||
building strings when particular conditions are met, for example `and`, `or`, `gt`, `lt`, `not` and so on. This is a very
|
building strings when particular conditions are met, for example `and`, `or`, `gt`, `lt`, `not` and so on. This is a very
|
||||||
extensive set of helpers but is mostly as would be expected from a set of logical operators.
|
extensive set of helpers but is mostly as would be expected from a set of logical operators.
|
||||||
7. [Date](https://github.com/helpers/helper-date) - last but certainly not least is a moment based date helper, which can
|
7. [Object](https://github.com/budibase/handlebars-helpers/tree/master#object) - useful operator for parsing objects, as well
|
||||||
|
as converting them to JSON strings.
|
||||||
|
8. [Regex](https://github.com/budibase/handlebars-helpers/tree/master#regex) - allows performing regex tests on strings that
|
||||||
|
can be used in conditional statements.
|
||||||
|
9. [Date](https://github.com/helpers/helper-date) - last but certainly not least is a moment based date helper, which can
|
||||||
format ISO/timestamp based dates into something human-readable. An example of this would be `{{date dateProperty "DD-MM-YYYY"}}`.
|
format ISO/timestamp based dates into something human-readable. An example of this would be `{{date dateProperty "DD-MM-YYYY"}}`.
|
||||||
|
|
||||||
## Date formatting
|
## Date formatting
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"a"
|
"a"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ abs 12012.1000 }} -> 12012.1",
|
||||||
"description": "<p>Return the magnitude of <code>a</code>.</p>\n"
|
"description": "<p>Return the magnitude of <code>a</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ add 1 2 }} -> 3",
|
||||||
"description": "<p>Return the sum of <code>a</code> plus <code>b</code>.</p>\n"
|
"description": "<p>Return the sum of <code>a</code> plus <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"avg": {
|
"avg": {
|
||||||
|
@ -20,7 +22,7 @@
|
||||||
"array"
|
"array"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{avg \"[1, 2, 3, 4, 5]\"}} <!-- results in: '3' --> ",
|
"example": "{{ avg [1,2,3,4,5] }} -> 3",
|
||||||
"description": "<p>Returns the average of all numbers in the given array.</p>\n"
|
"description": "<p>Returns the average of all numbers in the given array.</p>\n"
|
||||||
},
|
},
|
||||||
"ceil": {
|
"ceil": {
|
||||||
|
@ -28,6 +30,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ ceil 1.2 }} -> 2",
|
||||||
"description": "<p>Get the <code>Math.ceil()</code> of the given value.</p>\n"
|
"description": "<p>Get the <code>Math.ceil()</code> of the given value.</p>\n"
|
||||||
},
|
},
|
||||||
"divide": {
|
"divide": {
|
||||||
|
@ -36,6 +39,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ divide 10 5 }} -> 2",
|
||||||
"description": "<p>Divide <code>a</code> by <code>b</code></p>\n"
|
"description": "<p>Divide <code>a</code> by <code>b</code></p>\n"
|
||||||
},
|
},
|
||||||
"floor": {
|
"floor": {
|
||||||
|
@ -43,6 +47,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ floor 1.2 }} -> 1",
|
||||||
"description": "<p>Get the <code>Math.floor()</code> of the given value.</p>\n"
|
"description": "<p>Get the <code>Math.floor()</code> of the given value.</p>\n"
|
||||||
},
|
},
|
||||||
"minus": {
|
"minus": {
|
||||||
|
@ -51,6 +56,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ subtract 10 5 }} -> 5",
|
||||||
"description": "<p>Return the product of <code>a</code> minus <code>b</code>.</p>\n"
|
"description": "<p>Return the product of <code>a</code> minus <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"modulo": {
|
"modulo": {
|
||||||
|
@ -59,6 +65,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ modulo 10 5 }} -> 0",
|
||||||
"description": "<p>Get the remainder of a division operation.</p>\n"
|
"description": "<p>Get the remainder of a division operation.</p>\n"
|
||||||
},
|
},
|
||||||
"multiply": {
|
"multiply": {
|
||||||
|
@ -67,6 +74,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ product 10 5 }} -> 50",
|
||||||
"description": "<p>Return the product of <code>a</code> times <code>b</code>.</p>\n"
|
"description": "<p>Return the product of <code>a</code> times <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"plus": {
|
"plus": {
|
||||||
|
@ -75,6 +83,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ plus 10 5 }} -> 15",
|
||||||
"description": "<p>Add <code>a</code> by <code>b</code>.</p>\n"
|
"description": "<p>Add <code>a</code> by <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"random": {
|
"random": {
|
||||||
|
@ -83,6 +92,7 @@
|
||||||
"max"
|
"max"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ random 0 20 }} -> 10",
|
||||||
"description": "<p>Generate a random number between two values</p>\n"
|
"description": "<p>Generate a random number between two values</p>\n"
|
||||||
},
|
},
|
||||||
"remainder": {
|
"remainder": {
|
||||||
|
@ -91,6 +101,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ remainder 10 6 }} -> 4",
|
||||||
"description": "<p>Get the remainder when <code>a</code> is divided by <code>b</code>.</p>\n"
|
"description": "<p>Get the remainder when <code>a</code> is divided by <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"round": {
|
"round": {
|
||||||
|
@ -98,6 +109,7 @@
|
||||||
"number"
|
"number"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ round 10.3 }} -> 10",
|
||||||
"description": "<p>Round the given number.</p>\n"
|
"description": "<p>Round the given number.</p>\n"
|
||||||
},
|
},
|
||||||
"subtract": {
|
"subtract": {
|
||||||
|
@ -106,6 +118,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ subtract 10 5 }} -> 5",
|
||||||
"description": "<p>Return the product of <code>a</code> minus <code>b</code>.</p>\n"
|
"description": "<p>Return the product of <code>a</code> minus <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"sum": {
|
"sum": {
|
||||||
|
@ -113,7 +126,7 @@
|
||||||
"array"
|
"array"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{sum \"[1, 2, 3, 4, 5]\"}} <!-- results in: '15' --> ",
|
"example": "{{ sum [1, 2, 3] }} -> 6",
|
||||||
"description": "<p>Returns the sum of all numbers in the given array.</p>\n"
|
"description": "<p>Returns the sum of all numbers in the given array.</p>\n"
|
||||||
},
|
},
|
||||||
"times": {
|
"times": {
|
||||||
|
@ -122,6 +135,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ times 10 5 }} -> 50",
|
||||||
"description": "<p>Multiply number <code>a</code> by number <code>b</code>.</p>\n"
|
"description": "<p>Multiply number <code>a</code> by number <code>b</code>.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -132,7 +146,7 @@
|
||||||
"n"
|
"n"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{after array 1}} <!-- results in: '[\"c\"]' --> ",
|
"example": "{{ after [1, 2, 3] 1}} -> [3]",
|
||||||
"description": "<p>Returns all of the items in an array after the specified index. Opposite of <a href=\"#before\">before</a>.</p>\n"
|
"description": "<p>Returns all of the items in an array after the specified index. Opposite of <a href=\"#before\">before</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"arrayify": {
|
"arrayify": {
|
||||||
|
@ -140,7 +154,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{arrayify \"foo\"}} <!-- results in: [ \"foo\" ] --> ",
|
"example": "{{ arrayify \"foo\" }} -> [\"foo\"]",
|
||||||
"description": "<p>Cast the given <code>value</code> to an array.</p>\n"
|
"description": "<p>Cast the given <code>value</code> to an array.</p>\n"
|
||||||
},
|
},
|
||||||
"before": {
|
"before": {
|
||||||
|
@ -149,7 +163,7 @@
|
||||||
"n"
|
"n"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{before array 2}} <!-- results in: '[\"a\", \"b\"]' --> ",
|
"example": "{{ before [1, 2, 3] 2}} -> [1, 2]",
|
||||||
"description": "<p>Return all of the items in the collection before the specified count. Opposite of <a href=\"#after\">after</a>.</p>\n"
|
"description": "<p>Return all of the items in the collection before the specified count. Opposite of <a href=\"#after\">after</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"eachIndex": {
|
"eachIndex": {
|
||||||
|
@ -158,7 +172,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] --> {{#eachIndex array}} {{item}} is {{index}} {{/eachIndex}} ",
|
"example": "{{#eachIndex [1, 2, 3]}} {{item}} is {{index}} {{/eachIndex}}",
|
||||||
"description": "<p>Iterates the array, listing an item and the index of it.</p>\n"
|
"description": "<p>Iterates the array, listing an item and the index of it.</p>\n"
|
||||||
},
|
},
|
||||||
"filter": {
|
"filter": {
|
||||||
|
@ -168,7 +182,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{#filter array \"foo\"}}AAA{{else}}BBB{{/filter}} <!-- results in: 'BBB' --> ",
|
"example": "{{#filter [1, 2, 3] 2}}2 Found{{else}}2 not found{{/filter}}",
|
||||||
"description": "<p>Block helper that filters the given array and renders the block for values that evaluate to <code>true</code>, otherwise the inverse block is returned.</p>\n"
|
"description": "<p>Block helper that filters the given array and renders the block for values that evaluate to <code>true</code>, otherwise the inverse block is returned.</p>\n"
|
||||||
},
|
},
|
||||||
"first": {
|
"first": {
|
||||||
|
@ -177,7 +191,7 @@
|
||||||
"n"
|
"n"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{first \"['a', 'b', 'c', 'd', 'e']\" 2}} <!-- results in: '[\"a\", \"b\"]' --> ",
|
"example": "{{first [1, 2, 3, 4] 2}} -> [1, 2]",
|
||||||
"description": "<p>Returns the first item, or first <code>n</code> items of an array.</p>\n"
|
"description": "<p>Returns the first item, or first <code>n</code> items of an array.</p>\n"
|
||||||
},
|
},
|
||||||
"forEach": {
|
"forEach": {
|
||||||
|
@ -185,7 +199,7 @@
|
||||||
"array"
|
"array"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars <!-- accounts = [ {'name': 'John', 'email': 'john@example.com'}, {'name': 'Malcolm', 'email': 'malcolm@example.com'}, {'name': 'David', 'email': 'david@example.com'} ] --> {{#forEach accounts}} <a href=\"mailto:{{ email }}\" title=\"Send an email to {{ name }}\"> {{ name }} </a>{{#unless isLast}}, {{/unless}} {{/forEach}} ",
|
"example": "{{#forEach [{ 'name': 'John' }] }} {{ name }} {{/forEach}}",
|
||||||
"description": "<p>Iterates over each item in an array and exposes the current item in the array as context to the inner block. In addition to the current array item, the helper exposes the following variables to the inner block: - <code>index</code> - <code>total</code> - <code>isFirst</code> - <code>isLast</code> Also, <code>@index</code> is exposed as a private variable, and additional private variables may be defined as hash arguments.</p>\n"
|
"description": "<p>Iterates over each item in an array and exposes the current item in the array as context to the inner block. In addition to the current array item, the helper exposes the following variables to the inner block: - <code>index</code> - <code>total</code> - <code>isFirst</code> - <code>isLast</code> Also, <code>@index</code> is exposed as a private variable, and additional private variables may be defined as hash arguments.</p>\n"
|
||||||
},
|
},
|
||||||
"inArray": {
|
"inArray": {
|
||||||
|
@ -195,7 +209,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{#inArray array \"d\"}} foo {{else}} bar {{/inArray}} <!-- results in: 'bar' --> ",
|
"example": "{{#inArray [1, 2, 3] 2}} 2 exists {{else}} 2 does not exist {{/inArray}} -> 2 exists",
|
||||||
"description": "<p>Block helper that renders the block if an array has the given <code>value</code>. Optionally specify an inverse block to render when the array does not have the given value.</p>\n"
|
"description": "<p>Block helper that renders the block if an array has the given <code>value</code>. Optionally specify an inverse block to render when the array does not have the given value.</p>\n"
|
||||||
},
|
},
|
||||||
"isArray": {
|
"isArray": {
|
||||||
|
@ -203,7 +217,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{isArray \"abc\"}} <!-- results in: false --> <!-- array: [1, 2, 3] --> {{isArray array}} <!-- results in: true --> ",
|
"example": "{{isArray [1, 2]}} -> true",
|
||||||
"description": "<p>Returns true if <code>value</code> is an es5 array.</p>\n"
|
"description": "<p>Returns true if <code>value</code> is an es5 array.</p>\n"
|
||||||
},
|
},
|
||||||
"itemAt": {
|
"itemAt": {
|
||||||
|
@ -212,7 +226,7 @@
|
||||||
"idx"
|
"idx"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{itemAt array 1}} <!-- results in: 'b' --> ",
|
"example": "{{itemAt [1, 2, 3] 1}} -> 2",
|
||||||
"description": "<p>Returns the item from <code>array</code> at index <code>idx</code>.</p>\n"
|
"description": "<p>Returns the item from <code>array</code> at index <code>idx</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"join": {
|
"join": {
|
||||||
|
@ -221,7 +235,7 @@
|
||||||
"separator"
|
"separator"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{join array}} <!-- results in: 'a, b, c' --> {{join array '-'}} <!-- results in: 'a-b-c' --> ",
|
"example": "{{join [1, 2, 3]}} -> '1, 2, 3'",
|
||||||
"description": "<p>Join all elements of array into a string, optionally using a given separator.</p>\n"
|
"description": "<p>Join all elements of array into a string, optionally using a given separator.</p>\n"
|
||||||
},
|
},
|
||||||
"equalsLength": {
|
"equalsLength": {
|
||||||
|
@ -231,6 +245,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{equalsLength [1, 2, 3] 3}} -> true",
|
||||||
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
||||||
},
|
},
|
||||||
"last": {
|
"last": {
|
||||||
|
@ -239,7 +254,7 @@
|
||||||
"n"
|
"n"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- var value = ['a', 'b', 'c', 'd', 'e'] --> {{last value}} <!-- results in: ['e'] --> {{last value 2}} <!-- results in: ['d', 'e'] --> {{last value 3}} <!-- results in: ['c', 'd', 'e'] --> ",
|
"example": "{{last [1, 2, 3]}} -> 3",
|
||||||
"description": "<p>Returns the last item, or last <code>n</code> items of an array or string. Opposite of <a href=\"#first\">first</a>.</p>\n"
|
"description": "<p>Returns the last item, or last <code>n</code> items of an array or string. Opposite of <a href=\"#first\">first</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"length": {
|
"length": {
|
||||||
|
@ -247,7 +262,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{length '[\"a\", \"b\", \"c\"]'}} <!-- results in: 3 --> <!-- results in: myArray = ['a', 'b', 'c', 'd', 'e']; --> {{length myArray}} <!-- results in: 5 --> <!-- results in: myObject = {'a': 'a', 'b': 'b'}; --> {{length myObject}} <!-- results in: 2 --> ",
|
"example": "{{length [1, 2, 3]}} -> 3",
|
||||||
"description": "<p>Returns the length of the given string or array.</p>\n"
|
"description": "<p>Returns the length of the given string or array.</p>\n"
|
||||||
},
|
},
|
||||||
"lengthEqual": {
|
"lengthEqual": {
|
||||||
|
@ -257,6 +272,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{equalsLength [1, 2, 3] 3}} -> true",
|
||||||
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
||||||
},
|
},
|
||||||
"map": {
|
"map": {
|
||||||
|
@ -265,7 +281,7 @@
|
||||||
"fn"
|
"fn"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'], and \"double\" is a fictitious function that duplicates letters --> {{map array double}} <!-- results in: '[\"aa\", \"bb\", \"cc\"]' --> ",
|
"example": "{{map [1, 2, 3] double}} -> [2, 4, 6]",
|
||||||
"description": "<p>Returns a new array, created by calling <code>function</code> on each element of the given <code>array</code>. For example,</p>\n"
|
"description": "<p>Returns a new array, created by calling <code>function</code> on each element of the given <code>array</code>. For example,</p>\n"
|
||||||
},
|
},
|
||||||
"pluck": {
|
"pluck": {
|
||||||
|
@ -274,7 +290,7 @@
|
||||||
"prop"
|
"prop"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars // {{pluck items \"data.title\"}} <!-- results in: '[\"aa\", \"bb\", \"cc\"]' --> ",
|
"example": "{{pluck [{ 'name': 'Bob' }] \"name\" }} -> ['Bob']",
|
||||||
"description": "<p>Map over the given object or array or objects and create an array of values from the given <code>prop</code>. Dot-notation may be used (as a string) to get nested properties.</p>\n"
|
"description": "<p>Map over the given object or array or objects and create an array of values from the given <code>prop</code>. Dot-notation may be used (as a string) to get nested properties.</p>\n"
|
||||||
},
|
},
|
||||||
"reverse": {
|
"reverse": {
|
||||||
|
@ -282,7 +298,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars <!-- value: 'abcd' --> {{reverse value}} <!-- results in: 'dcba' --> <!-- value: ['a', 'b', 'c', 'd'] --> {{reverse value}} <!-- results in: ['d', 'c', 'b', 'a'] --> ",
|
"example": "{{reverse [1, 2, 3]}} -> [3, 2, 1]",
|
||||||
"description": "<p>Reverse the elements in an array, or the characters in a string.</p>\n"
|
"description": "<p>Reverse the elements in an array, or the characters in a string.</p>\n"
|
||||||
},
|
},
|
||||||
"some": {
|
"some": {
|
||||||
|
@ -292,7 +308,7 @@
|
||||||
"provided"
|
"provided"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: [1, 'b', 3] --> {{#some array isString}} Render me if the array has a string. {{else}} Render me if it doesn't. {{/some}} <!-- results in: 'Render me if the array has a string.' --> ",
|
"example": "{{#some [1, 'b', 3] isString}} string found {{else}} No string found {{/some}} -> string found",
|
||||||
"description": "<p>Block helper that returns the block if the callback returns true for some value in the given array.</p>\n"
|
"description": "<p>Block helper that returns the block if the callback returns true for some value in the given array.</p>\n"
|
||||||
},
|
},
|
||||||
"sort": {
|
"sort": {
|
||||||
|
@ -301,7 +317,7 @@
|
||||||
"key"
|
"key"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['b', 'a', 'c'] --> {{sort array}} <!-- results in: '[\"a\", \"b\", \"c\"]' --> ",
|
"example": "{{ sort ['b', 'a', 'c'] }} -> ['a', 'b', 'c']",
|
||||||
"description": "<p>Sort the given <code>array</code>. If an array of objects is passed, you may optionally pass a <code>key</code> to sort on as the second argument. You may alternatively pass a sorting function as the second argument.</p>\n"
|
"description": "<p>Sort the given <code>array</code>. If an array of objects is passed, you may optionally pass a <code>key</code> to sort on as the second argument. You may alternatively pass a sorting function as the second argument.</p>\n"
|
||||||
},
|
},
|
||||||
"sortBy": {
|
"sortBy": {
|
||||||
|
@ -310,7 +326,7 @@
|
||||||
"props"
|
"props"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: [{a: 'zzz'}, {a: 'aaa'}] --> {{sortBy array \"a\"}} <!-- results in: '[{\"a\":\"aaa\"}, {\"a\":\"zzz\"}]' --> ",
|
"example": "{{ sortBy [{a: 'zzz'}, {a: 'aaa'}] \"a\" }} -> [{\"a\":\"aaa\"}, {\"a\":\"zzz\"}]",
|
||||||
"description": "<p>Sort an <code>array</code>. If an array of objects is passed, you may optionally pass a <code>key</code> to sort on as the second argument. You may alternatively pass a sorting function as the second argument.</p>\n"
|
"description": "<p>Sort an <code>array</code>. If an array of objects is passed, you may optionally pass a <code>key</code> to sort on as the second argument. You may alternatively pass a sorting function as the second argument.</p>\n"
|
||||||
},
|
},
|
||||||
"withAfter": {
|
"withAfter": {
|
||||||
|
@ -320,7 +336,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c', 'd', 'e'] --> {{#withAfter array 3}} {{this}} {{/withAfter}} <!-- results in: \"de\" --> ",
|
"example": "{{ withAfter [1, 2, 3] 1 }} {{this}} {{/withAfter}}",
|
||||||
"description": "<p>Use the items in the array <em>after</em> the specified index as context inside a block. Opposite of <a href=\"#withBefore\">withBefore</a>.</p>\n"
|
"description": "<p>Use the items in the array <em>after</em> the specified index as context inside a block. Opposite of <a href=\"#withBefore\">withBefore</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"withBefore": {
|
"withBefore": {
|
||||||
|
@ -330,7 +346,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c', 'd', 'e'] --> {{#withBefore array 3}} {{this}} {{/withBefore}} <!-- results in: 'ab' --> ",
|
"example": "{{ withBefore [1, 2, 3] 2 }} {{this}} {{/withBefore}}",
|
||||||
"description": "<p>Use the items in the array <em>before</em> the specified index as context inside a block. Opposite of <a href=\"#withAfter\">withAfter</a>.</p>\n"
|
"description": "<p>Use the items in the array <em>before</em> the specified index as context inside a block. Opposite of <a href=\"#withAfter\">withAfter</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"withFirst": {
|
"withFirst": {
|
||||||
|
@ -340,7 +356,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{#withFirst array}} {{this}} {{/withFirst}} <!-- results in: 'a' --> ",
|
"example": "{{ withFirst [1, 2, 3] }} {{this}} {{/withFirst}}",
|
||||||
"description": "<p>Use the first item in a collection inside a handlebars block expression. Opposite of <a href=\"#withLast\">withLast</a>.</p>\n"
|
"description": "<p>Use the first item in a collection inside a handlebars block expression. Opposite of <a href=\"#withLast\">withLast</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"withGroup": {
|
"withGroup": {
|
||||||
|
@ -350,7 +366,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a','b','c','d','e','f','g','h'] --> {{#withGroup array 4}} {{#each this}} {{.}} {{each}} <br> {{/withGroup}} <!-- results in: --> <!-- 'a','b','c','d'<br> --> <!-- 'e','f','g','h'<br> --> ",
|
"example": "{{#withGroup [1, 2, 3, 4] 2}} {{#each this}} {{.}} {{each}} <br> {{/withGroup}} -> 1,2<br> 3,4<br>",
|
||||||
"description": "<p>Block helper that groups array elements by given group <code>size</code>.</p>\n"
|
"description": "<p>Block helper that groups array elements by given group <code>size</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"withLast": {
|
"withLast": {
|
||||||
|
@ -360,7 +376,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['a', 'b', 'c'] --> {{#withLast array}} {{this}} {{/withLast}} <!-- results in: 'c' --> ",
|
"example": "{{#withLast [1, 2, 3, 4]}} {{this}} {{/withLast}} -> 4",
|
||||||
"description": "<p>Use the last item or <code>n</code> items in an array as context inside a block. Opposite of <a href=\"#withFirst\">withFirst</a>.</p>\n"
|
"description": "<p>Use the last item or <code>n</code> items in an array as context inside a block. Opposite of <a href=\"#withFirst\">withFirst</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"withSort": {
|
"withSort": {
|
||||||
|
@ -370,7 +386,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- array: ['b', 'a', 'c'] --> {{#withSort array}}{{this}}{{/withSort}} <!-- results in: 'abc' --> ",
|
"example": "{{#withSort ['b', 'a', 'c']}} {{this}} {{/withSort}} -> abc",
|
||||||
"description": "<p>Block helper that sorts a collection and exposes the sorted collection as context inside the block.</p>\n"
|
"description": "<p>Block helper that sorts a collection and exposes the sorted collection as context inside the block.</p>\n"
|
||||||
},
|
},
|
||||||
"unique": {
|
"unique": {
|
||||||
|
@ -379,7 +395,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- array: ['a', 'a', 'c', 'b', 'e', 'e'] --> {{#each (unique array)}}{{.}}{{/each}} <!-- results in: 'acbe' --> ",
|
"example": "{{#each (unique ['a', 'a', 'c', 'b', 'e', 'e']) }} {{.}} {{/each}} -> acbe",
|
||||||
"description": "<p>Block helper that return an array with all duplicate values removed. Best used along with a <a href=\"#each\">each</a> helper.</p>\n"
|
"description": "<p>Block helper that return an array with all duplicate values removed. Best used along with a <a href=\"#each\">each</a> helper.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -389,6 +405,7 @@
|
||||||
"number"
|
"number"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ bytes 1386 }} -> 1.4Kb",
|
||||||
"description": "<p>Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned. <strong>Examples:</strong> - <code>'foo' => 3 B</code> - <code>13661855 => 13.66 MB</code> - <code>825399 => 825.39 kB</code> - <code>1396 => 1.4 kB</code></p>\n"
|
"description": "<p>Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned. <strong>Examples:</strong> - <code>'foo' => 3 B</code> - <code>13661855 => 13.66 MB</code> - <code>825399 => 825.39 kB</code> - <code>1396 => 1.4 kB</code></p>\n"
|
||||||
},
|
},
|
||||||
"addCommas": {
|
"addCommas": {
|
||||||
|
@ -396,6 +413,7 @@
|
||||||
"num"
|
"num"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ addCommas 1000000 }} -> 1,000,000",
|
||||||
"description": "<p>Add commas to numbers</p>\n"
|
"description": "<p>Add commas to numbers</p>\n"
|
||||||
},
|
},
|
||||||
"phoneNumber": {
|
"phoneNumber": {
|
||||||
|
@ -403,6 +421,7 @@
|
||||||
"num"
|
"num"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ phoneNumber 8005551212 }} -> (800) 555-1212",
|
||||||
"description": "<p>Convert a string or number to a formatted phone number.</p>\n"
|
"description": "<p>Convert a string or number to a formatted phone number.</p>\n"
|
||||||
},
|
},
|
||||||
"toAbbr": {
|
"toAbbr": {
|
||||||
|
@ -411,6 +430,7 @@
|
||||||
"precision"
|
"precision"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ toAbbr 10123 2 }} -> 10.12k",
|
||||||
"description": "<p>Abbreviate numbers to the given number of <code>precision</code>. This for general numbers, not size in bytes.</p>\n"
|
"description": "<p>Abbreviate numbers to the given number of <code>precision</code>. This for general numbers, not size in bytes.</p>\n"
|
||||||
},
|
},
|
||||||
"toExponential": {
|
"toExponential": {
|
||||||
|
@ -419,7 +439,7 @@
|
||||||
"fractionDigits"
|
"fractionDigits"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{toExponential number digits}}; ",
|
"example": "{{ toExponential 10123 2 }} -> 101e+4",
|
||||||
"description": "<p>Returns a string representing the given number in exponential notation.</p>\n"
|
"description": "<p>Returns a string representing the given number in exponential notation.</p>\n"
|
||||||
},
|
},
|
||||||
"toFixed": {
|
"toFixed": {
|
||||||
|
@ -428,7 +448,7 @@
|
||||||
"digits"
|
"digits"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{toFixed \"1.1234\" 2}} //=> '1.12' ",
|
"example": "{{ toFixed 1.1234 2 }} -> 1.12",
|
||||||
"description": "<p>Formats the given number using fixed-point notation.</p>\n"
|
"description": "<p>Formats the given number using fixed-point notation.</p>\n"
|
||||||
},
|
},
|
||||||
"toFloat": {
|
"toFloat": {
|
||||||
|
@ -451,7 +471,7 @@
|
||||||
"precision"
|
"precision"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{toPrecision \"1.1234\" 2}} //=> '1.1' ",
|
"example": "{{toPrecision \"1.1234\" 2}}",
|
||||||
"description": "<p>Returns a string representing the <code>Number</code> object to the specified precision.</p>\n"
|
"description": "<p>Returns a string representing the <code>Number</code> object to the specified precision.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -461,6 +481,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ encodeURI \"https://myurl?Hello There\" }} -> https://myurl?Hello%20There",
|
||||||
"description": "<p>Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.</p>\n"
|
"description": "<p>Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.</p>\n"
|
||||||
},
|
},
|
||||||
"escape": {
|
"escape": {
|
||||||
|
@ -468,6 +489,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ escape \"https://myurl?Hello+There\" }} -> https://myurl?Hello%20There",
|
||||||
"description": "<p>Escape the given string by replacing characters with escape sequences. Useful for allowing the string to be used in a URL, etc.</p>\n"
|
"description": "<p>Escape the given string by replacing characters with escape sequences. Useful for allowing the string to be used in a URL, etc.</p>\n"
|
||||||
},
|
},
|
||||||
"decodeURI": {
|
"decodeURI": {
|
||||||
|
@ -475,6 +497,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ escape \"https://myurl?Hello%20There\" }} -> https://myurl?Hello+There",
|
||||||
"description": "<p>Decode a Uniform Resource Identifier (URI) component.</p>\n"
|
"description": "<p>Decode a Uniform Resource Identifier (URI) component.</p>\n"
|
||||||
},
|
},
|
||||||
"url_encode": {
|
"url_encode": {
|
||||||
|
@ -493,6 +516,7 @@
|
||||||
"href"
|
"href"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ urlResolve \"https://myurl\" \"/api/test\" }} -> https://myurl/api/test",
|
||||||
"description": "<p>Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.</p>\n"
|
"description": "<p>Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.</p>\n"
|
||||||
},
|
},
|
||||||
"urlParse": {
|
"urlParse": {
|
||||||
|
@ -500,6 +524,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ urlParse \"https://myurl/api/test\" }}",
|
||||||
"description": "<p>Parses a <code>url</code> string into an object.</p>\n"
|
"description": "<p>Parses a <code>url</code> string into an object.</p>\n"
|
||||||
},
|
},
|
||||||
"stripQuerystring": {
|
"stripQuerystring": {
|
||||||
|
@ -507,6 +532,7 @@
|
||||||
"url"
|
"url"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
|
"example": "{{ stripQueryString \"https://myurl/api/test?foo=bar\" }} -> \"https://myurl/api/test\"",
|
||||||
"description": "<p>Strip the query string from the given <code>url</code>.</p>\n"
|
"description": "<p>Strip the query string from the given <code>url</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"stripProtocol": {
|
"stripProtocol": {
|
||||||
|
@ -514,7 +540,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars <!-- url = 'http://foo.bar' --> {{stripProtocol url}} <!-- results in: '//foo.bar' --> ",
|
"example": "{{ stripProtocol \"https://myurl/api/test\" }} -> \"myurl/api/test\"",
|
||||||
"description": "<p>Strip protocol from a <code>url</code>. Useful for displaying media that may have an 'http' protocol on secure connections.</p>\n"
|
"description": "<p>Strip protocol from a <code>url</code>. Useful for displaying media that may have an 'http' protocol on secure connections.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -525,7 +551,7 @@
|
||||||
"suffix"
|
"suffix"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- given that \"item.stem\" is \"foo\" --> {{append item.stem \".html\"}} <!-- results in: 'foo.html' --> ",
|
"example": "{{append \"index\" \".html\"}} -> index.html",
|
||||||
"description": "<p>Append the specified <code>suffix</code> to the given string.</p>\n"
|
"description": "<p>Append the specified <code>suffix</code> to the given string.</p>\n"
|
||||||
},
|
},
|
||||||
"camelcase": {
|
"camelcase": {
|
||||||
|
@ -533,7 +559,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{camelcase \"foo bar baz\"}}; <!-- results in: 'fooBarBaz' --> ",
|
"example": "{{camelcase \"foo bar baz\"}} -> fooBarBaz",
|
||||||
"description": "<p>camelCase the characters in the given <code>string</code>.</p>\n"
|
"description": "<p>camelCase the characters in the given <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"capitalize": {
|
"capitalize": {
|
||||||
|
@ -541,7 +567,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{capitalize \"foo bar baz\"}} <!-- results in: \"Foo bar baz\" --> ",
|
"example": "{{capitalize \"foo bar baz\"}} -> Foo bar baz",
|
||||||
"description": "<p>Capitalize the first word in a sentence.</p>\n"
|
"description": "<p>Capitalize the first word in a sentence.</p>\n"
|
||||||
},
|
},
|
||||||
"capitalizeAll": {
|
"capitalizeAll": {
|
||||||
|
@ -549,7 +575,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{capitalizeAll \"foo bar baz\"}} <!-- results in: \"Foo Bar Baz\" --> ",
|
"example": "{{ capitalizeAll \"foo bar baz\"}} -> Foo Bar Baz",
|
||||||
"description": "<p>Capitalize all words in a string.</p>\n"
|
"description": "<p>Capitalize all words in a string.</p>\n"
|
||||||
},
|
},
|
||||||
"center": {
|
"center": {
|
||||||
|
@ -558,6 +584,7 @@
|
||||||
"spaces"
|
"spaces"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{ center \"test\" 1}} -> \" test \"",
|
||||||
"description": "<p>Center a string using non-breaking spaces</p>\n"
|
"description": "<p>Center a string using non-breaking spaces</p>\n"
|
||||||
},
|
},
|
||||||
"chop": {
|
"chop": {
|
||||||
|
@ -565,7 +592,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{chop \"_ABC_\"}} <!-- results in: 'ABC' --> {{chop \"-ABC-\"}} <!-- results in: 'ABC' --> {{chop \" ABC \"}} <!-- results in: 'ABC' --> ",
|
"example": "{{ chop \" ABC \"}} -> \"ABC\"",
|
||||||
"description": "<p>Like trim, but removes both extraneous whitespace <strong>and non-word characters</strong> from the beginning and end of a string.</p>\n"
|
"description": "<p>Like trim, but removes both extraneous whitespace <strong>and non-word characters</strong> from the beginning and end of a string.</p>\n"
|
||||||
},
|
},
|
||||||
"dashcase": {
|
"dashcase": {
|
||||||
|
@ -573,7 +600,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{dashcase \"a-b-c d_e\"}} <!-- results in: 'a-b-c-d-e' --> ",
|
"example": "{{dashcase \"a-b-c d_e\"}} -> a-b-c-d-e",
|
||||||
"description": "<p>dash-case the characters in <code>string</code>. Replaces non-word characters and periods with hyphens.</p>\n"
|
"description": "<p>dash-case the characters in <code>string</code>. Replaces non-word characters and periods with hyphens.</p>\n"
|
||||||
},
|
},
|
||||||
"dotcase": {
|
"dotcase": {
|
||||||
|
@ -581,7 +608,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{dotcase \"a-b-c d_e\"}} <!-- results in: 'a.b.c.d.e' --> ",
|
"example": "{{dotcase \"a-b-c d_e\"}} -> a.b.c.d.e",
|
||||||
"description": "<p>dot.case the characters in <code>string</code>.</p>\n"
|
"description": "<p>dot.case the characters in <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"downcase": {
|
"downcase": {
|
||||||
|
@ -589,7 +616,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{downcase \"aBcDeF\"}} <!-- results in: 'abcdef' --> ",
|
"example": "{{downcase \"aBcDeF\"}} -> abcdef",
|
||||||
"description": "<p>Lowercase all of the characters in the given string. Alias for <a href=\"#lowercase\">lowercase</a>.</p>\n"
|
"description": "<p>Lowercase all of the characters in the given string. Alias for <a href=\"#lowercase\">lowercase</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"ellipsis": {
|
"ellipsis": {
|
||||||
|
@ -598,7 +625,7 @@
|
||||||
"length"
|
"length"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{ellipsis (sanitize \"<span>foo bar baz</span>\"), 7}} <!-- results in: 'foo bar…' --> {{ellipsis \"foo bar baz\", 7}} <!-- results in: 'foo bar…' --> ",
|
"example": "{{ellipsis \"foo bar baz\", 7}} -> foo bar…",
|
||||||
"description": "<p>Truncates a string to the specified <code>length</code>, and appends it with an elipsis, <code>…</code>.</p>\n"
|
"description": "<p>Truncates a string to the specified <code>length</code>, and appends it with an elipsis, <code>…</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"hyphenate": {
|
"hyphenate": {
|
||||||
|
@ -606,7 +633,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{hyphenate \"foo bar baz qux\"}} <!-- results in: \"foo-bar-baz-qux\" --> ",
|
"example": "{{hyphenate \"foo bar baz qux\"}} -> foo-bar-baz-qux",
|
||||||
"description": "<p>Replace spaces in a string with hyphens.</p>\n"
|
"description": "<p>Replace spaces in a string with hyphens.</p>\n"
|
||||||
},
|
},
|
||||||
"isString": {
|
"isString": {
|
||||||
|
@ -614,7 +641,7 @@
|
||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{isString \"foo\"}} <!-- results in: 'true' --> ",
|
"example": "{{isString \"foo\"}} -> true",
|
||||||
"description": "<p>Return true if <code>value</code> is a string.</p>\n"
|
"description": "<p>Return true if <code>value</code> is a string.</p>\n"
|
||||||
},
|
},
|
||||||
"lowercase": {
|
"lowercase": {
|
||||||
|
@ -622,7 +649,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{lowercase \"Foo BAR baZ\"}} <!-- results in: 'foo bar baz' --> ",
|
"example": "{{lowercase \"Foo BAR baZ\"}} -> foo bar baz",
|
||||||
"description": "<p>Lowercase all characters in the given string.</p>\n"
|
"description": "<p>Lowercase all characters in the given string.</p>\n"
|
||||||
},
|
},
|
||||||
"occurrences": {
|
"occurrences": {
|
||||||
|
@ -631,7 +658,7 @@
|
||||||
"substring"
|
"substring"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{occurrences \"foo bar foo bar baz\" \"foo\"}} <!-- results in: 2 --> ",
|
"example": "{{occurrences \"foo bar foo bar baz\" \"foo\"}} -> 2",
|
||||||
"description": "<p>Return the number of occurrences of <code>substring</code> within the given <code>string</code>.</p>\n"
|
"description": "<p>Return the number of occurrences of <code>substring</code> within the given <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"pascalcase": {
|
"pascalcase": {
|
||||||
|
@ -639,7 +666,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{pascalcase \"foo bar baz\"}} <!-- results in: 'FooBarBaz' --> ",
|
"example": "{{pascalcase \"foo bar baz\"}} -> FooBarBaz",
|
||||||
"description": "<p>PascalCase the characters in <code>string</code>.</p>\n"
|
"description": "<p>PascalCase the characters in <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"pathcase": {
|
"pathcase": {
|
||||||
|
@ -647,7 +674,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{pathcase \"a-b-c d_e\"}} <!-- results in: 'a/b/c/d/e' --> ",
|
"example": "{{pathcase \"a-b-c d_e\"}} -> a/b/c/d/e",
|
||||||
"description": "<p>path/case the characters in <code>string</code>.</p>\n"
|
"description": "<p>path/case the characters in <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"plusify": {
|
"plusify": {
|
||||||
|
@ -655,7 +682,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{plusify \"foo bar baz\"}} <!-- results in: 'foo+bar+baz' --> ",
|
"example": "{{plusify \"foo bar baz\"}} -> foo+bar+baz",
|
||||||
"description": "<p>Replace spaces in the given string with pluses.</p>\n"
|
"description": "<p>Replace spaces in the given string with pluses.</p>\n"
|
||||||
},
|
},
|
||||||
"prepend": {
|
"prepend": {
|
||||||
|
@ -664,7 +691,7 @@
|
||||||
"prefix"
|
"prefix"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars <!-- given that \"val\" is \"bar\" --> {{prepend val \"foo-\"}} <!-- results in: 'foo-bar' --> ",
|
"example": "{{prepend \"bar\" \"foo-\"}} -> foo-bar",
|
||||||
"description": "<p>Prepends the given <code>string</code> with the specified <code>prefix</code>.</p>\n"
|
"description": "<p>Prepends the given <code>string</code> with the specified <code>prefix</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"raw": {
|
"raw": {
|
||||||
|
@ -672,7 +699,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{{{#raw}}}} {{foo}} {{{{/raw}}}} <!-- results in: '{{foo}}' --> ",
|
"example": "{{{{#raw}}}} {{foo}} {{{{/raw}}}} -> {{foo}}",
|
||||||
"description": "<p>Render a block without processing mustache templates inside the block.</p>\n"
|
"description": "<p>Render a block without processing mustache templates inside the block.</p>\n"
|
||||||
},
|
},
|
||||||
"remove": {
|
"remove": {
|
||||||
|
@ -681,7 +708,7 @@
|
||||||
"substring"
|
"substring"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{remove \"a b a b a b\" \"a \"}} <!-- results in: 'b b b' --> ",
|
"example": "{{remove \"a b a b a b\" \"a \"}} -> b b b",
|
||||||
"description": "<p>Remove all occurrences of <code>substring</code> from the given <code>str</code>.</p>\n"
|
"description": "<p>Remove all occurrences of <code>substring</code> from the given <code>str</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"removeFirst": {
|
"removeFirst": {
|
||||||
|
@ -690,7 +717,7 @@
|
||||||
"substring"
|
"substring"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{remove \"a b a b a b\" \"a\"}} <!-- results in: ' b a b a b' --> ",
|
"example": "{{remove \"a b a b a b\" \"a\"}} -> b a b a b",
|
||||||
"description": "<p>Remove the first occurrence of <code>substring</code> from the given <code>str</code>.</p>\n"
|
"description": "<p>Remove the first occurrence of <code>substring</code> from the given <code>str</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
|
@ -700,7 +727,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars {{replace \"a b a b a b\" \"a\" \"z\"}} <!-- results in: 'z b z b z b' --> ",
|
"example": "{{replace \"a b a b a b\" \"a\" \"z\"}} -> z b z b z b",
|
||||||
"description": "<p>Replace all occurrences of substring <code>a</code> with substring <code>b</code>.</p>\n"
|
"description": "<p>Replace all occurrences of substring <code>a</code> with substring <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"replaceFirst": {
|
"replaceFirst": {
|
||||||
|
@ -710,7 +737,7 @@
|
||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars {{replace \"a b a b a b\" \"a\" \"z\"}} <!-- results in: 'z b a b a b' --> ",
|
"example": "{{replace \"a b a b a b\" \"a\" \"z\"}} -> z b a b a b",
|
||||||
"description": "<p>Replace the first occurrence of substring <code>a</code> with substring <code>b</code>.</p>\n"
|
"description": "<p>Replace the first occurrence of substring <code>a</code> with substring <code>b</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"sentence": {
|
"sentence": {
|
||||||
|
@ -718,7 +745,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{sentence \"hello world. goodbye world.\"}} <!-- results in: 'Hello world. Goodbye world.' --> ",
|
"example": "{{sentence \"hello world. goodbye world.\"}} -> Hello world. Goodbye world.",
|
||||||
"description": "<p>Sentence case the given string</p>\n"
|
"description": "<p>Sentence case the given string</p>\n"
|
||||||
},
|
},
|
||||||
"snakecase": {
|
"snakecase": {
|
||||||
|
@ -726,7 +753,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{snakecase \"a-b-c d_e\"}} <!-- results in: 'a_b_c_d_e' --> ",
|
"example": "{{snakecase \"a-b-c d_e\"}} -> a_b_c_d_e",
|
||||||
"description": "<p>snake_case the characters in the given <code>string</code>.</p>\n"
|
"description": "<p>snake_case the characters in the given <code>string</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"split": {
|
"split": {
|
||||||
|
@ -734,7 +761,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{split \"a,b,c\" \",\"}} <!-- results in: ['a', 'b', 'c'] --> ",
|
"example": "{{split \"a,b,c\"}} -> ['a', 'b', 'c']",
|
||||||
"description": "<p>Split <code>string</code> by the given <code>character</code>.</p>\n"
|
"description": "<p>Split <code>string</code> by the given <code>character</code>.</p>\n"
|
||||||
},
|
},
|
||||||
"startsWith": {
|
"startsWith": {
|
||||||
|
@ -744,7 +771,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars {{#startsWith \"Goodbye\" \"Hello, world!\"}} Whoops {{else}} Bro, do you even hello world? {{/startsWith}} ",
|
"example": "{{#startsWith \"Goodbye\" \"Hello, world!\"}} Yep {{else}} Nope {{/startsWith}} -> Nope",
|
||||||
"description": "<p>Tests whether a string begins with the given prefix.</p>\n"
|
"description": "<p>Tests whether a string begins with the given prefix.</p>\n"
|
||||||
},
|
},
|
||||||
"titleize": {
|
"titleize": {
|
||||||
|
@ -752,7 +779,7 @@
|
||||||
"str"
|
"str"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{titleize \"this title case\"}} <!-- results in: 'This Is Title Case' --> ",
|
"example": "{{#titleize \"this is title case\" }} -> This Is Title Case",
|
||||||
"description": "<p>Title case the given string.</p>\n"
|
"description": "<p>Title case the given string.</p>\n"
|
||||||
},
|
},
|
||||||
"trim": {
|
"trim": {
|
||||||
|
@ -760,7 +787,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{trim \" ABC \"}} <!-- results in: 'ABC' --> ",
|
"example": "{{trim \" ABC \" }} -> ABC",
|
||||||
"description": "<p>Removes extraneous whitespace from the beginning and end of a string.</p>\n"
|
"description": "<p>Removes extraneous whitespace from the beginning and end of a string.</p>\n"
|
||||||
},
|
},
|
||||||
"trimLeft": {
|
"trimLeft": {
|
||||||
|
@ -768,7 +795,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{trim \" ABC \"}} <!-- results in: 'ABC ' --> ",
|
"example": "{{trimLeft \" ABC \" }} -> \"ABC \"",
|
||||||
"description": "<p>Removes extraneous whitespace from the beginning of a string.</p>\n"
|
"description": "<p>Removes extraneous whitespace from the beginning of a string.</p>\n"
|
||||||
},
|
},
|
||||||
"trimRight": {
|
"trimRight": {
|
||||||
|
@ -776,7 +803,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{trimRight \" ABC \"}} <!-- results in: ' ABC' --> ",
|
"example": "{{trimRight \" ABC \" }} -> \" ABC \"",
|
||||||
"description": "<p>Removes extraneous whitespace from the end of a string.</p>\n"
|
"description": "<p>Removes extraneous whitespace from the end of a string.</p>\n"
|
||||||
},
|
},
|
||||||
"truncate": {
|
"truncate": {
|
||||||
|
@ -786,7 +813,7 @@
|
||||||
"suffix"
|
"suffix"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars truncate(\"foo bar baz\", 7); <!-- results in: 'foo bar' --> truncate(sanitize(\"<span>foo bar baz</span>\", 7)); <!-- results in: 'foo bar' --> ",
|
"example": "{{truncate \"foo bar baz\" 7 }} -> foo bar",
|
||||||
"description": "<p>Truncate a string to the specified <code>length</code>. Also see <a href=\"#ellipsis\">ellipsis</a>.</p>\n"
|
"description": "<p>Truncate a string to the specified <code>length</code>. Also see <a href=\"#ellipsis\">ellipsis</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"truncateWords": {
|
"truncateWords": {
|
||||||
|
@ -796,7 +823,7 @@
|
||||||
"suffix"
|
"suffix"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars truncateWords(\"foo bar baz\", 1); <!-- results in: 'foo…' --> truncateWords(\"foo bar baz\", 2); <!-- results in: 'foo bar…' --> truncateWords(\"foo bar baz\", 3); <!-- results in: 'foo bar baz' --> ",
|
"example": "{{truncateWords \"foo bar baz\" 1 }} -> foo",
|
||||||
"description": "<p>Truncate a string to have the specified number of words. Also see <a href=\"#truncate\">truncate</a>.</p>\n"
|
"description": "<p>Truncate a string to have the specified number of words. Also see <a href=\"#truncate\">truncate</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"upcase": {
|
"upcase": {
|
||||||
|
@ -804,7 +831,7 @@
|
||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "handlebars {{upcase \"aBcDeF\"}} <!-- results in: 'ABCDEF' --> ",
|
"example": "{{upcase \"aBcDef\"}} -> ABCDEF",
|
||||||
"description": "<p>Uppercase all of the characters in the given string. Alias for <a href=\"#uppercase\">uppercase</a>.</p>\n"
|
"description": "<p>Uppercase all of the characters in the given string. Alias for <a href=\"#uppercase\">uppercase</a>.</p>\n"
|
||||||
},
|
},
|
||||||
"uppercase": {
|
"uppercase": {
|
||||||
|
@ -813,7 +840,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{uppercase \"aBcDeF\"}} <!-- results in: 'ABCDEF' --> ",
|
"example": "{{uppercase \"aBcDef\"}} -> ABCDEF",
|
||||||
"description": "<p>Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.</p>\n"
|
"description": "<p>Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -825,7 +852,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
"example": "handlebars <!-- {great: true, magnificent: true} --> {{#and great magnificent}}A{{else}}B{{/and}} <!-- results in: 'A' --> ",
|
"example": "{{#and great magnificent}}both{{else}}no{{/and}}",
|
||||||
"description": "<p>Helper that renders the block if <strong>both</strong> of the given values are truthy. If an inverse block is specified it will be rendered when falsy. Works as a block helper, inline helper or subexpression.</p>\n"
|
"description": "<p>Helper that renders the block if <strong>both</strong> of the given values are truthy. If an inverse block is specified it will be rendered when falsy. Works as a block helper, inline helper or subexpression.</p>\n"
|
||||||
},
|
},
|
||||||
"compare": {
|
"compare": {
|
||||||
|
@ -836,6 +863,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 4,
|
"numArgs": 4,
|
||||||
|
"example": "{{compare 10 \"<\" 5 }} -> true",
|
||||||
"description": "<p>Render a block when a comparison of the first and third arguments returns true. The second argument is the [arithemetic operator][operators] to use. You may also optionally specify an inverse block to render when falsy.</p>\n"
|
"description": "<p>Render a block when a comparison of the first and third arguments returns true. The second argument is the [arithemetic operator][operators] to use. You may also optionally specify an inverse block to render when falsy.</p>\n"
|
||||||
},
|
},
|
||||||
"contains": {
|
"contains": {
|
||||||
|
@ -846,7 +874,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 4,
|
"numArgs": 4,
|
||||||
"example": "handlebars <!-- array = ['a', 'b', 'c'] --> {{#contains array \"d\"}} This will not be rendered. {{else}} This will be rendered. {{/contains}} ",
|
"example": "{{#contains ['a', 'b', 'c'] \"d\"}} This will not be rendered. {{else}} This will be rendered. {{/contains}}",
|
||||||
"description": "<p>Block helper that renders the block if <code>collection</code> has the given <code>value</code>, using strict equality (<code>===</code>) for comparison, otherwise the inverse block is rendered (if specified). If a <code>startIndex</code> is specified and is negative, it is used as the offset from the end of the collection.</p>\n"
|
"description": "<p>Block helper that renders the block if <code>collection</code> has the given <code>value</code>, using strict equality (<code>===</code>) for comparison, otherwise the inverse block is rendered (if specified). If a <code>startIndex</code> is specified and is negative, it is used as the offset from the end of the collection.</p>\n"
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
|
@ -855,6 +883,7 @@
|
||||||
"defaultValue"
|
"defaultValue"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{default null null \"default\"}} -> default",
|
||||||
"description": "<p>Returns the first value that is not undefined, otherwise the "default" value is returned.</p>\n"
|
"description": "<p>Returns the first value that is not undefined, otherwise the "default" value is returned.</p>\n"
|
||||||
},
|
},
|
||||||
"eq": {
|
"eq": {
|
||||||
|
@ -864,6 +893,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#eq 3 3}} equal{{else}} not equal{{/eq}} -> equal",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
||||||
},
|
},
|
||||||
"gt": {
|
"gt": {
|
||||||
|
@ -873,6 +903,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#gt 4 3}} greater than{{else}} not greater than{{/gt}} -> greater than",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>greater than</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>greater than</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
||||||
},
|
},
|
||||||
"gte": {
|
"gte": {
|
||||||
|
@ -882,6 +913,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#gte 4 3}} greater than or equal{{else}} not greater than{{/gte}} -> greater than or equal",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>greater than or equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>greater than or equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
||||||
},
|
},
|
||||||
"has": {
|
"has": {
|
||||||
|
@ -891,6 +923,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#has \"foobar\" \"foo\"}} has it{{else}} doesn't{{/has}} -> has it",
|
||||||
"description": "<p>Block helper that renders a block if <code>value</code> has <code>pattern</code>. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>value</code> has <code>pattern</code>. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
||||||
},
|
},
|
||||||
"isFalsey": {
|
"isFalsey": {
|
||||||
|
@ -899,6 +932,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{isFalsey \"\" }} -> true",
|
||||||
"description": "<p>Returns true if the given <code>value</code> is falsey. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.</p>\n"
|
"description": "<p>Returns true if the given <code>value</code> is falsey. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.</p>\n"
|
||||||
},
|
},
|
||||||
"isTruthy": {
|
"isTruthy": {
|
||||||
|
@ -907,6 +941,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{isTruthy \"12\" }} -> true",
|
||||||
"description": "<p>Returns true if the given <code>value</code> is truthy. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.</p>\n"
|
"description": "<p>Returns true if the given <code>value</code> is truthy. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.</p>\n"
|
||||||
},
|
},
|
||||||
"ifEven": {
|
"ifEven": {
|
||||||
|
@ -915,7 +950,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{#ifEven value}} render A {{else}} render B {{/ifEven}} ",
|
"example": "{{#ifEven 2}} even {{else}} odd {{/ifEven}} -> even",
|
||||||
"description": "<p>Return true if the given value is an even number.</p>\n"
|
"description": "<p>Return true if the given value is an even number.</p>\n"
|
||||||
},
|
},
|
||||||
"ifNth": {
|
"ifNth": {
|
||||||
|
@ -925,6 +960,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#ifNth 10 2}} remainder {{else}} no remainder {{/ifNth}} -> remainder",
|
||||||
"description": "<p>Conditionally renders a block if the remainder is zero when <code>a</code> operand is divided by <code>b</code>. If an inverse block is specified it will be rendered when the remainder is <strong>not zero</strong>.</p>\n"
|
"description": "<p>Conditionally renders a block if the remainder is zero when <code>a</code> operand is divided by <code>b</code>. If an inverse block is specified it will be rendered when the remainder is <strong>not zero</strong>.</p>\n"
|
||||||
},
|
},
|
||||||
"ifOdd": {
|
"ifOdd": {
|
||||||
|
@ -933,7 +969,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{#ifOdd value}} render A {{else}} render B {{/ifOdd}} ",
|
"example": "{{#ifOdd 3}} odd {{else}} even {{/ifOdd}} -> odd",
|
||||||
"description": "<p>Block helper that renders a block if <code>value</code> is <strong>an odd number</strong>. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>value</code> is <strong>an odd number</strong>. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
||||||
},
|
},
|
||||||
"is": {
|
"is": {
|
||||||
|
@ -943,6 +979,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#is 3 3}} is {{else}} is not {{/is}} -> is",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. Similar to <a href=\"#eq\">eq</a> but does not do strict equality.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. Similar to <a href=\"#eq\">eq</a> but does not do strict equality.</p>\n"
|
||||||
},
|
},
|
||||||
"isnt": {
|
"isnt": {
|
||||||
|
@ -952,6 +989,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#isnt 3 3}} isnt {{else}} is {{/isnt}} -> is",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>not equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. Similar to <a href=\"#unlesseq\">unlessEq</a> but does not use strict equality for comparisons.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>not equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. Similar to <a href=\"#unlesseq\">unlessEq</a> but does not use strict equality for comparisons.</p>\n"
|
||||||
},
|
},
|
||||||
"lt": {
|
"lt": {
|
||||||
|
@ -960,6 +998,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{#lt 2 3}} less than {{else}} more than or equal {{/lt}} -> less than",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>less than</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>less than</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
||||||
},
|
},
|
||||||
"lte": {
|
"lte": {
|
||||||
|
@ -969,6 +1008,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#lte 2 3}} less than or equal {{else}} more than {{/lte}} -> less than or equal",
|
||||||
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>less than or equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
"description": "<p>Block helper that renders a block if <code>a</code> is <strong>less than or equal to</strong> <code>b</code>. If an inverse block is specified it will be rendered when falsy. You may optionally use the <code>compare=""</code> hash argument for the second value.</p>\n"
|
||||||
},
|
},
|
||||||
"neither": {
|
"neither": {
|
||||||
|
@ -978,6 +1018,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#neither null null}} both falsey {{else}} both not falsey {{/neither}} -> both falsey",
|
||||||
"description": "<p>Block helper that renders a block if <strong>neither of</strong> the given values are truthy. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
"description": "<p>Block helper that renders a block if <strong>neither of</strong> the given values are truthy. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
||||||
},
|
},
|
||||||
"not": {
|
"not": {
|
||||||
|
@ -986,6 +1027,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
|
"example": "{{#not undefined }} falsey {{else}} not falsey {{/not}} -> falsey",
|
||||||
"description": "<p>Returns true if <code>val</code> is falsey. Works as a block or inline helper.</p>\n"
|
"description": "<p>Returns true if <code>val</code> is falsey. Works as a block or inline helper.</p>\n"
|
||||||
},
|
},
|
||||||
"or": {
|
"or": {
|
||||||
|
@ -994,7 +1036,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "handlebars {{#or a b c}} If any value is true this will be rendered. {{/or}} ",
|
"example": "{{#or 1 2 undefined }} at least one truthy {{else}} all falsey {{/or}} -> at least one truthy",
|
||||||
"description": "<p>Block helper that renders a block if <strong>any of</strong> the given values is truthy. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
"description": "<p>Block helper that renders a block if <strong>any of</strong> the given values is truthy. If an inverse block is specified it will be rendered when falsy.</p>\n"
|
||||||
},
|
},
|
||||||
"unlessEq": {
|
"unlessEq": {
|
||||||
|
@ -1004,6 +1046,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#unlessEq 2 1 }} not equal {{else}} equal {{/unlessEq}} -> not equal",
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is equal to <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is equal to <code>b</code></strong>.</p>\n"
|
||||||
},
|
},
|
||||||
"unlessGt": {
|
"unlessGt": {
|
||||||
|
@ -1013,6 +1056,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#unlessGt 20 1 }} not greater than {{else}} greater than {{/unlessGt}} -> greater than",
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is greater than <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is greater than <code>b</code></strong>.</p>\n"
|
||||||
},
|
},
|
||||||
"unlessLt": {
|
"unlessLt": {
|
||||||
|
@ -1022,6 +1066,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#unlessLt 20 1 }} greater than or equal {{else}} less than {{/unlessLt}} -> greater than or equal",
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than <code>b</code></strong>.</p>\n"
|
||||||
},
|
},
|
||||||
"unlessGteq": {
|
"unlessGteq": {
|
||||||
|
@ -1031,6 +1076,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#unlessGteq 20 1 }} less than {{else}} greater than or equal to {{/unlessGteq}} -> greater than or equal to",
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is greater than or equal to <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is greater than or equal to <code>b</code></strong>.</p>\n"
|
||||||
},
|
},
|
||||||
"unlessLteq": {
|
"unlessLteq": {
|
||||||
|
@ -1040,6 +1086,7 @@
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"numArgs": 3,
|
"numArgs": 3,
|
||||||
|
"example": "{{#unlessLteq 20 1 }} greater than {{else}} less than or equal to {{/unlessLteq}} -> greater than",
|
||||||
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than or equal to <code>b</code></strong>.</p>\n"
|
"description": "<p>Block helper that always renders the inverse block <strong>unless <code>a</code> is less than or equal to <code>b</code></strong>.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1050,8 +1097,17 @@
|
||||||
"format"
|
"format"
|
||||||
],
|
],
|
||||||
"numArgs": 2,
|
"numArgs": 2,
|
||||||
"example": "{{date now \"YYYY\"}}",
|
"example": "{{date now \"DD-MM-YYYY\"}} -> 21-01-2021",
|
||||||
"description": "<p>Format a date using moment.js data formatting.</p>\n"
|
"description": "<p>Format a date using moment.js date formatting.</p>\n"
|
||||||
|
},
|
||||||
|
"duration": {
|
||||||
|
"args": [
|
||||||
|
"time",
|
||||||
|
"durationType"
|
||||||
|
],
|
||||||
|
"numArgs": 2,
|
||||||
|
"example": "{{duration timeLeft \"seconds\"}} -> a few seconds",
|
||||||
|
"description": "<p>Produce a humanized duration left/until given an amount of time and the type of time measurement.</p>\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"module": "src/index.js",
|
"module": "src/index.js",
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
"manifest": "node ./scripts/gen-collection-info.js"
|
"manifest": "node ./scripts/gen-collection-info.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/handlebars-helpers": "^0.11.1",
|
"@budibase/handlebars-helpers": "^0.11.3",
|
||||||
|
"dayjs": "^1.10.4",
|
||||||
"handlebars": "^4.7.6",
|
"handlebars": "^4.7.6",
|
||||||
"handlebars-utils": "^1.0.6",
|
"handlebars-utils": "^1.0.6",
|
||||||
"helper-date": "^1.0.1",
|
|
||||||
"lodash": "^4.17.20"
|
"lodash": "^4.17.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -32,5 +32,6 @@
|
||||||
"rollup-plugin-node-resolve": "^5.2.0",
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
}
|
},
|
||||||
|
"gitHead": "1a80b09fd093f2599a68f7db72ad639dd50922dd"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,32 @@ const fs = require("fs")
|
||||||
const doctrine = require("doctrine")
|
const doctrine = require("doctrine")
|
||||||
const marked = require("marked")
|
const marked = require("marked")
|
||||||
|
|
||||||
const DIRECTORY = fs.existsSync("node_modules") ? "." : ".."
|
|
||||||
|
|
||||||
const FILENAME = `${DIRECTORY}/manifest.json`
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* full list of supported helpers can be found here:
|
* full list of supported helpers can be found here:
|
||||||
* https://github.com/helpers/handlebars-helpers
|
* https://github.com/budibase/handlebars-helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const DIRECTORY = fs.existsSync("node_modules") ? "." : ".."
|
||||||
const COLLECTIONS = ["math", "array", "number", "url", "string", "comparison"]
|
const COLLECTIONS = ["math", "array", "number", "url", "string", "comparison"]
|
||||||
|
const FILENAME = `${DIRECTORY}/manifest.json`
|
||||||
const outputJSON = {}
|
const outputJSON = {}
|
||||||
|
const ADDED_HELPERS = {
|
||||||
|
date: {
|
||||||
|
date: {
|
||||||
|
args: ["datetime", "format"],
|
||||||
|
numArgs: 2,
|
||||||
|
example: '{{date now "DD-MM-YYYY"}} -> 21-01-2021',
|
||||||
|
description: "Format a date using moment.js date formatting.",
|
||||||
|
},
|
||||||
|
duration: {
|
||||||
|
args: ["time", "durationType"],
|
||||||
|
numArgs: 2,
|
||||||
|
example: '{{duration timeLeft "seconds"}} -> a few seconds',
|
||||||
|
description:
|
||||||
|
"Produce a humanized duration left/until given an amount of time and the type of time measurement.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
function fixSpecialCases(name, obj) {
|
function fixSpecialCases(name, obj) {
|
||||||
const args = obj.args
|
const args = obj.args
|
||||||
|
@ -78,11 +92,14 @@ function getCommentInfo(file, func) {
|
||||||
docs.description = docs.description.replace(/\n/g, " ")
|
docs.description = docs.description.replace(/\n/g, " ")
|
||||||
docs.description = docs.description.replace(/[ ]{2,}/g, " ")
|
docs.description = docs.description.replace(/[ ]{2,}/g, " ")
|
||||||
docs.description = docs.description.replace(/is is/g, "is")
|
docs.description = docs.description.replace(/is is/g, "is")
|
||||||
const example = docs.description.split("```")
|
const examples = docs.tags
|
||||||
if (example.length > 1) {
|
.filter(el => el.title === "example")
|
||||||
docs.example = example[1]
|
.map(el => el.description)
|
||||||
|
const blocks = docs.description.split("```")
|
||||||
|
if (examples.length > 0) {
|
||||||
|
docs.example = examples.join(" ")
|
||||||
}
|
}
|
||||||
docs.description = example[0].trim()
|
docs.description = blocks[0].trim()
|
||||||
return docs
|
return docs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,15 +148,15 @@ function run() {
|
||||||
}
|
}
|
||||||
outputJSON[collection] = collectionInfo
|
outputJSON[collection] = collectionInfo
|
||||||
}
|
}
|
||||||
// add the date helper
|
// add extra helpers
|
||||||
outputJSON["date"] = {
|
for (let [collectionName, collection] of Object.entries(ADDED_HELPERS)) {
|
||||||
date: {
|
let input = collection
|
||||||
args: ["datetime", "format"],
|
if (outputJSON[collectionName]) {
|
||||||
numArgs: 2,
|
input = Object.assign(outputJSON[collectionName], collection)
|
||||||
example: '{{date now "YYYY"}}',
|
|
||||||
description: "Format a date using moment.js data formatting.",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
outputJSON[collectionName] = input
|
||||||
|
}
|
||||||
|
|
||||||
// convert all markdown to HTML
|
// convert all markdown to HTML
|
||||||
for (let collection of Object.values(outputJSON)) {
|
for (let collection of Object.values(outputJSON)) {
|
||||||
for (let helper of Object.values(collection)) {
|
for (let helper of Object.values(collection)) {
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
const dayjs = require("dayjs")
|
||||||
|
dayjs.extend(require("dayjs/plugin/duration"))
|
||||||
|
dayjs.extend(require("dayjs/plugin/advancedFormat"))
|
||||||
|
dayjs.extend(require("dayjs/plugin/relativeTime"))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was largely taken from the helper-date package - we did this for two reasons:
|
||||||
|
* 1. It made use of both moment of date.js - this caused some weird bugs with some relatively simple
|
||||||
|
* syntax and didn't offer much in return.
|
||||||
|
* 2. Replacing moment with dayjs helps massively reduce bundle size.
|
||||||
|
* The original package can be found here:
|
||||||
|
* https://github.com/helpers/helper-date
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isOptions(val) {
|
||||||
|
return typeof val === "object" && typeof val.hash === "object"
|
||||||
|
}
|
||||||
|
|
||||||
|
function isApp(thisArg) {
|
||||||
|
return (
|
||||||
|
typeof thisArg === "object" &&
|
||||||
|
typeof thisArg.options === "object" &&
|
||||||
|
typeof thisArg.app === "object"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContext(thisArg, locals, options) {
|
||||||
|
if (isOptions(thisArg)) {
|
||||||
|
return getContext({}, locals, thisArg)
|
||||||
|
}
|
||||||
|
// ensure args are in the correct order
|
||||||
|
if (isOptions(locals)) {
|
||||||
|
return getContext(thisArg, options, locals)
|
||||||
|
}
|
||||||
|
const appContext = isApp(thisArg) ? thisArg.context : {}
|
||||||
|
options = options || {}
|
||||||
|
|
||||||
|
// if "options" is not handlebars options, merge it onto locals
|
||||||
|
if (!isOptions(options)) {
|
||||||
|
locals = Object.assign({}, locals, options)
|
||||||
|
}
|
||||||
|
// merge handlebars root data onto locals if specified on the hash
|
||||||
|
if (isOptions(options) && options.hash.root === true) {
|
||||||
|
locals = Object.assign({}, options.data.root, locals)
|
||||||
|
}
|
||||||
|
let context = Object.assign({}, appContext, locals, options.hash)
|
||||||
|
if (!isApp(thisArg)) {
|
||||||
|
context = Object.assign({}, thisArg, context)
|
||||||
|
}
|
||||||
|
if (isApp(thisArg) && thisArg.view && thisArg.view.data) {
|
||||||
|
context = Object.assign({}, context, thisArg.view.data)
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialConfig(str, pattern, options) {
|
||||||
|
if (isOptions(pattern)) {
|
||||||
|
options = pattern
|
||||||
|
pattern = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOptions(str)) {
|
||||||
|
options = str
|
||||||
|
pattern = null
|
||||||
|
str = null
|
||||||
|
}
|
||||||
|
return { str, pattern, options }
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLocale(str, pattern, options) {
|
||||||
|
// if options is null then it'll get updated here
|
||||||
|
const config = initialConfig(str, pattern, options)
|
||||||
|
const defaults = { lang: "en", date: new Date(config.str) }
|
||||||
|
const opts = getContext(this, defaults, config.options)
|
||||||
|
|
||||||
|
// set the language to use
|
||||||
|
dayjs.locale(opts.lang || opts.language)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.date = (str, pattern, options) => {
|
||||||
|
const config = initialConfig(str, pattern, options)
|
||||||
|
|
||||||
|
// if no args are passed, return a formatted date
|
||||||
|
if (config.str == null && config.pattern == null) {
|
||||||
|
dayjs.locale("en")
|
||||||
|
return dayjs().format("MMMM DD, YYYY")
|
||||||
|
}
|
||||||
|
|
||||||
|
setLocale(config.str, config.pattern, config.options)
|
||||||
|
|
||||||
|
return dayjs(new Date(config.str)).format(config.pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.duration = (str, pattern, format) => {
|
||||||
|
const config = initialConfig(str, pattern)
|
||||||
|
|
||||||
|
setLocale(config.str, config.pattern)
|
||||||
|
|
||||||
|
const duration = dayjs.duration(config.str, config.pattern)
|
||||||
|
if (!isOptions(format)) {
|
||||||
|
return duration.format(format)
|
||||||
|
} else {
|
||||||
|
return duration.humanize()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
const helpers = require("@budibase/handlebars-helpers")
|
const helpers = require("@budibase/handlebars-helpers")
|
||||||
const dateHelper = require("helper-date")
|
const { date, duration } = require("./date")
|
||||||
const { HelperFunctionBuiltin } = require("./constants")
|
const { HelperFunctionBuiltin } = require("./constants")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,12 +14,19 @@ const EXTERNAL_FUNCTION_COLLECTIONS = [
|
||||||
"url",
|
"url",
|
||||||
"string",
|
"string",
|
||||||
"comparison",
|
"comparison",
|
||||||
|
"object",
|
||||||
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
const DATE_NAME = "date"
|
const ADDED_HELPERS = {
|
||||||
|
date: date,
|
||||||
|
duration: duration,
|
||||||
|
}
|
||||||
|
|
||||||
exports.registerAll = handlebars => {
|
exports.registerAll = handlebars => {
|
||||||
handlebars.registerHelper(DATE_NAME, dateHelper)
|
for (let [name, helper] of Object.entries(ADDED_HELPERS)) {
|
||||||
|
handlebars.registerHelper(name, helper)
|
||||||
|
}
|
||||||
let externalNames = []
|
let externalNames = []
|
||||||
for (let collection of EXTERNAL_FUNCTION_COLLECTIONS) {
|
for (let collection of EXTERNAL_FUNCTION_COLLECTIONS) {
|
||||||
// collect information about helper
|
// collect information about helper
|
||||||
|
@ -41,12 +48,13 @@ exports.registerAll = handlebars => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// add date external functionality
|
// add date external functionality
|
||||||
externalNames.push(DATE_NAME)
|
exports.externalHelperNames = externalNames.concat(Object.keys(ADDED_HELPERS))
|
||||||
exports.externalHelperNames = externalNames
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.unregisterAll = handlebars => {
|
exports.unregisterAll = handlebars => {
|
||||||
handlebars.unregisterHelper(DATE_NAME)
|
for (let name of Object.keys(ADDED_HELPERS)) {
|
||||||
|
handlebars.unregisterHelper(name)
|
||||||
|
}
|
||||||
for (let name of module.exports.externalHelperNames) {
|
for (let name of module.exports.externalHelperNames) {
|
||||||
handlebars.unregisterHelper(name)
|
handlebars.unregisterHelper(name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,11 @@ const handlebars = require("handlebars")
|
||||||
const { registerAll } = require("./helpers/index")
|
const { registerAll } = require("./helpers/index")
|
||||||
const processors = require("./processors")
|
const processors = require("./processors")
|
||||||
const { cloneDeep } = require("lodash/fp")
|
const { cloneDeep } = require("lodash/fp")
|
||||||
const { removeNull, addConstants } = require("./utilities")
|
const {
|
||||||
|
removeNull,
|
||||||
|
addConstants,
|
||||||
|
removeHandlebarsStatements,
|
||||||
|
} = require("./utilities")
|
||||||
const manifest = require("../manifest.json")
|
const manifest = require("../manifest.json")
|
||||||
|
|
||||||
const hbsInstance = handlebars.create()
|
const hbsInstance = handlebars.create()
|
||||||
|
@ -83,16 +87,27 @@ module.exports.processObjectSync = (object, context) => {
|
||||||
* @returns {string} The enriched string, all templates should have been replaced if they can be.
|
* @returns {string} The enriched string, all templates should have been replaced if they can be.
|
||||||
*/
|
*/
|
||||||
module.exports.processStringSync = (string, context) => {
|
module.exports.processStringSync = (string, context) => {
|
||||||
|
if (!exports.isValid(string)) {
|
||||||
|
return string
|
||||||
|
}
|
||||||
|
// take a copy of input incase error
|
||||||
|
const input = string
|
||||||
let clonedContext = removeNull(cloneDeep(context))
|
let clonedContext = removeNull(cloneDeep(context))
|
||||||
clonedContext = addConstants(clonedContext)
|
clonedContext = addConstants(clonedContext)
|
||||||
// remove any null/undefined properties
|
// remove any null/undefined properties
|
||||||
if (typeof string !== "string") {
|
if (typeof string !== "string") {
|
||||||
throw "Cannot process non-string types."
|
throw "Cannot process non-string types."
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
string = processors.preprocess(string)
|
string = processors.preprocess(string)
|
||||||
// this does not throw an error when template can't be fulfilled, have to try correct beforehand
|
// this does not throw an error when template can't be fulfilled, have to try correct beforehand
|
||||||
const template = hbsInstance.compile(string)
|
const template = hbsInstance.compile(string, {
|
||||||
|
strict: false,
|
||||||
|
})
|
||||||
return processors.postprocess(template(clonedContext))
|
return processors.postprocess(template(clonedContext))
|
||||||
|
} catch (err) {
|
||||||
|
return removeHandlebarsStatements(input)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,17 +125,33 @@ module.exports.makePropSafe = property => {
|
||||||
* @returns {boolean} Whether or not the input string is valid.
|
* @returns {boolean} Whether or not the input string is valid.
|
||||||
*/
|
*/
|
||||||
module.exports.isValid = string => {
|
module.exports.isValid = string => {
|
||||||
const specialCases = ["isNumber", "expected a number"]
|
const validCases = [
|
||||||
|
"string",
|
||||||
|
"number",
|
||||||
|
"object",
|
||||||
|
"array",
|
||||||
|
"cannot read property",
|
||||||
|
]
|
||||||
|
// this is a portion of a specific string always output by handlebars in the case of a syntax error
|
||||||
|
const invalidCases = [`expecting '`]
|
||||||
// don't really need a real context to check if its valid
|
// don't really need a real context to check if its valid
|
||||||
const context = {}
|
const context = {}
|
||||||
try {
|
try {
|
||||||
hbsInstance.compile(processors.preprocess(string, false))(context)
|
hbsInstance.compile(processors.preprocess(string, false))(context)
|
||||||
return true
|
return true
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const msg = err ? err.message : ""
|
const msg = err && err.message ? err.message : err
|
||||||
const foundCase = specialCases.find(spCase => msg.includes(spCase))
|
if (!msg) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const invalidCase = invalidCases.some(invalidCase =>
|
||||||
|
msg.toLowerCase().includes(invalidCase)
|
||||||
|
)
|
||||||
|
const validCase = validCases.some(validCase =>
|
||||||
|
msg.toLowerCase().includes(validCase)
|
||||||
|
)
|
||||||
// special case for maths functions - don't have inputs yet
|
// special case for maths functions - don't have inputs yet
|
||||||
return !!foundCase
|
return validCase && !invalidCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ module.exports.processors = [
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (HelperNames().some(option => possibleHelper.includes(option))) {
|
if (HelperNames().some(option => option.includes(possibleHelper))) {
|
||||||
insideStatement = `(${insideStatement})`
|
insideStatement = `(${insideStatement})`
|
||||||
}
|
}
|
||||||
return `{{ all ${insideStatement} }}`
|
return `{{ all ${insideStatement} }}`
|
||||||
|
|
|
@ -32,3 +32,16 @@ module.exports.addConstants = obj => {
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.removeHandlebarsStatements = string => {
|
||||||
|
let regexp = new RegExp(exports.FIND_HBS_REGEX)
|
||||||
|
let matches = string.match(regexp)
|
||||||
|
if (matches == null) {
|
||||||
|
return string
|
||||||
|
}
|
||||||
|
for (let match of matches) {
|
||||||
|
const idx = string.indexOf(match)
|
||||||
|
string = exports.swapStrings(string, idx, match.length, "Invalid Binding")
|
||||||
|
}
|
||||||
|
return string
|
||||||
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@ const {
|
||||||
|
|
||||||
describe("Handling context properties with spaces in their name", () => {
|
describe("Handling context properties with spaces in their name", () => {
|
||||||
it("should allow through literal specifiers", async () => {
|
it("should allow through literal specifiers", async () => {
|
||||||
const output = await processString("test {{ [test thing] }}", {
|
const output = await processString("test {{ [one thing] }}", {
|
||||||
"test thing": 1
|
"one thing": 1
|
||||||
})
|
})
|
||||||
expect(output).toBe("test 1")
|
expect(output).toBe("test 1")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should convert to dot notation where required", async () => {
|
it("should convert to dot notation where required", async () => {
|
||||||
const output = await processString("test {{ test[0] }}", {
|
const output = await processString("test {{ one[0] }}", {
|
||||||
test: [2]
|
one: [2]
|
||||||
})
|
})
|
||||||
expect(output).toBe("test 2")
|
expect(output).toBe("test 2")
|
||||||
})
|
})
|
||||||
|
@ -25,9 +25,9 @@ describe("Handling context properties with spaces in their name", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should be able to handle an object with layers that requires escaping", async () => {
|
it("should be able to handle an object with layers that requires escaping", async () => {
|
||||||
const output = await processString("testcase {{ testing.[test case] }}", {
|
const output = await processString("testcase {{ thing.[one case] }}", {
|
||||||
testing: {
|
thing: {
|
||||||
"test case": 1
|
"one case": 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
expect(output).toBe("testcase 1")
|
expect(output).toBe("testcase 1")
|
||||||
|
@ -52,10 +52,10 @@ describe("attempt some complex problems", () => {
|
||||||
it("should be able to process an odd string produced by builder", async () => {
|
it("should be able to process an odd string produced by builder", async () => {
|
||||||
const context = {
|
const context = {
|
||||||
"c306d140d7e854f388bae056db380a0eb": {
|
"c306d140d7e854f388bae056db380a0eb": {
|
||||||
"test prop": "test",
|
"one prop": "test",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const hbs = "null{{ [c306d140d7e854f388bae056db380a0eb].[test prop] }}"
|
const hbs = "null{{ [c306d140d7e854f388bae056db380a0eb].[one prop] }}"
|
||||||
const output = await processString(hbs, context)
|
const output = await processString(hbs, context)
|
||||||
expect(output).toBe("nulltest")
|
expect(output).toBe("nulltest")
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const {
|
const {
|
||||||
processString,
|
processString,
|
||||||
|
processObject,
|
||||||
isValid,
|
isValid,
|
||||||
} = require("../src/index")
|
} = require("../src/index")
|
||||||
|
|
||||||
|
@ -291,14 +292,61 @@ describe("Cover a few complex use cases", () => {
|
||||||
expect(output).toBe("e")
|
expect(output).toBe("e")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should allow a complex forIn case", async () => {
|
||||||
|
const input = `{{#forIn (JSONparse '{"a":1, "b":2, "c":3}' )}}number: {{.}}\n{{/forIn}}`
|
||||||
|
const output = await processString(input, {})
|
||||||
|
expect(output).toBe("number: 1\nnumber: 2\nnumber: 3\n")
|
||||||
|
})
|
||||||
|
|
||||||
it("should make sure case is valid", () => {
|
it("should make sure case is valid", () => {
|
||||||
const validity = isValid("{{ avg [c355ec2b422e54f988ae553c8acd811ea].[a] [c355ec2b422e54f988ae553c8acd811ea].[b] }}")
|
const validity = isValid("{{ avg [c355ec2b422e54f988ae553c8acd811ea].[a] [c355ec2b422e54f988ae553c8acd811ea].[b] }}")
|
||||||
expect(validity).toBe(true)
|
expect(validity).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should make sure object functions check out valid", () => {
|
||||||
|
const validity = isValid("{{ JSONstringify obj }}")
|
||||||
|
expect(validity).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
it("should be able to solve an example from docs", async () => {
|
it("should be able to solve an example from docs", async () => {
|
||||||
const output = await processString(`{{first ( split "a-b-c" "-") 2}}`, {})
|
const output = await processString(`{{first ( split "a-b-c" "-") 2}}`, {})
|
||||||
expect(output).toBe(`a,b`)
|
expect(output).toBe(`a,b`)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should confirm a subtraction validity", () => {
|
||||||
|
const validity = isValid("{{ subtract [c390c23a7f1b6441c98d2fe2a51248ef3].[total profit] [c390c23a7f1b6441c98d2fe2a51248ef3].[total revenue] }}")
|
||||||
|
expect(validity).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("test a very complex duration output", async () => {
|
||||||
|
const currentTime = new Date(1612432082000).toISOString(),
|
||||||
|
eventTime = new Date(1612432071000).toISOString()
|
||||||
|
const input = `{{duration ( subtract (date currentTime "X")(date eventTime "X")) "seconds"}}`
|
||||||
|
const output = await processString(input, {
|
||||||
|
currentTime,
|
||||||
|
eventTime,
|
||||||
|
})
|
||||||
|
expect(output).toBe("a few seconds")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should confirm a bunch of invalid strings", () => {
|
||||||
|
const invalids = ["{{ awd )", "{{ awdd () ", "{{ awdwad ", "{{ awddawd }"]
|
||||||
|
for (let invalid of invalids) {
|
||||||
|
const validity = isValid(invalid)
|
||||||
|
expect(validity).toBe(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it("input a garbage string, expect it to be returned", async () => {
|
||||||
|
const input = `{{{{{{ } {{ ]] ] ] }}} {{ ] {{ { } { dsa { dddddd }}}}}}} }DDD`
|
||||||
|
const output = await processString(input, {})
|
||||||
|
expect(output).toBe(input)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("getting a nice date from the user", async () => {
|
||||||
|
const input = {text: `{{ date user.subscriptionDue "DD-MM" }}`}
|
||||||
|
const context = JSON.parse(`{"user":{"email":"test@test.com","roleId":"ADMIN","type":"user","tableId":"ta_users","subscriptionDue":"2021-01-12T12:00:00.000Z","_id":"ro_ta_users_us_test@test.com","_rev":"2-24cc794985eb54183ecb93e148563f3d"}}`)
|
||||||
|
const output = await processObject(input, context)
|
||||||
|
expect(output.text).toBe("12-01")
|
||||||
})
|
})
|
||||||
})
|
})
|
|
@ -270,10 +270,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/handlebars-helpers@^0.11.1":
|
"@budibase/handlebars-helpers@^0.11.3":
|
||||||
version "0.11.1"
|
version "0.11.3"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.1.tgz#fe8672612fb4ad8fd3bad338ee15759f45e421eb"
|
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.3.tgz#b6e5c91b83e8906e7d7ff10ddde277a3d561016e"
|
||||||
integrity sha512-s72LhOhlHk43QYGVcqjogaGa4h4e6y6X1AfshqWBWceTRYBs/9tUnoYDUiRJ/Mt3WoTmx8Hj5GOZekSqrUsOFQ==
|
integrity sha512-MS1ptZEYq8o9J3tNLM7cZ2RGSSJIer4GiMIUHtbBI3sC9UKqZebao1JYNfmZKpNjntuqhZKgjqc5GfnVIEjsYQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
arr-flatten "^1.1.0"
|
arr-flatten "^1.1.0"
|
||||||
array-sort "^0.1.4"
|
array-sort "^0.1.4"
|
||||||
|
@ -1596,6 +1596,11 @@ date.js@^0.3.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "~3.1.0"
|
debug "~3.1.0"
|
||||||
|
|
||||||
|
dayjs@^1.10.4:
|
||||||
|
version "1.10.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
|
||||||
|
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
|
||||||
|
|
||||||
debug@^2.2.0, debug@^2.3.3:
|
debug@^2.2.0, debug@^2.3.3:
|
||||||
version "2.6.9"
|
version "2.6.9"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||||
|
@ -4386,9 +4391,9 @@ source-map-support@^0.5.6, source-map-support@~0.5.19:
|
||||||
source-map "^0.6.0"
|
source-map "^0.6.0"
|
||||||
|
|
||||||
source-map-url@^0.4.0:
|
source-map-url@^0.4.0:
|
||||||
version "0.4.0"
|
version "0.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
|
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56"
|
||||||
integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=
|
integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==
|
||||||
|
|
||||||
source-map@^0.5.0, source-map@^0.5.6:
|
source-map@^0.5.0, source-map@^0.5.6:
|
||||||
version "0.5.7"
|
version "0.5.7"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/deployment",
|
"name": "@budibase/deployment",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.6.2",
|
"version": "0.7.4",
|
||||||
"description": "Budibase Deployment Server",
|
"description": "Budibase Deployment Server",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -34,5 +34,5 @@
|
||||||
"pouchdb-all-dbs": "^1.0.2",
|
"pouchdb-all-dbs": "^1.0.2",
|
||||||
"server-destroy": "^1.0.1"
|
"server-destroy": "^1.0.1"
|
||||||
},
|
},
|
||||||
"gitHead": "62ebf3cedcd7e9b2494b4f8cbcfb90927609b491"
|
"gitHead": "1a80b09fd093f2599a68f7db72ad639dd50922dd"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue