Merge branch 'fix/global-users-search-numeric-prefixing' of github.com:Budibase/budibase into fix/global-users-search-numeric-prefixing

This commit is contained in:
Andrew Kingston 2023-12-12 10:28:53 +00:00
commit 635bf9acf2
28 changed files with 1639 additions and 1369 deletions

View File

@ -8,3 +8,6 @@ packages/backend-core/coverage
packages/server/client packages/server/client
packages/builder/.routify packages/builder/.routify
packages/sdk/sdk packages/sdk/sdk
packages/account-portal/packages/server/build
packages/account-portal/packages/ui/.routify
packages/account-portal/packages/ui/build

View File

@ -251,3 +251,53 @@ jobs:
} else { } else {
console.log('All good, the submodule had been merged and setup correctly!') console.log('All good, the submodule had been merged and setup correctly!')
} }
check-accountportal-submodule:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase'
steps:
- name: Checkout repo and submodules
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Check account portal commit
id: get_accountportal_commits
run: |
cd packages/account-portal
accountportal_commit=$(git rev-parse HEAD)
branch="${{ github.base_ref || github.ref_name }}"
echo "Running on branch '$branch' (base_ref=${{ github.base_ref }}, ref_name=${{ github.head_ref }})"
base_commit=$(git rev-parse origin/master)
if [[ ! -z $base_commit ]]; then
echo "target_branch=$branch"
echo "target_branch=$branch" >> "$GITHUB_OUTPUT"
echo "accountportal_commit=$accountportal_commit"
echo "accountportal_commit=$accountportal_commit" >> "$GITHUB_OUTPUT"
echo "base_commit=$base_commit"
echo "base_commit=$base_commit" >> "$GITHUB_OUTPUT"
else
echo "Nothing to do - branch to branch merge."
fi
- name: Check submodule merged to base branch
if: ${{ steps.get_accountportal_commits.outputs.base_commit != '' }}
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const submoduleCommit = '${{ steps.get_accountportal_commits.outputs.accountportal_commit }}';
const baseCommit = '${{ steps.get_accountportal_commits.outputs.base_commit }}';
if (submoduleCommit !== baseCommit) {
console.error('Submodule commit does not match the latest commit on the "${{ steps.get_accountportal_commits.outputs.target_branch }}" branch.');
console.error('Refer to the account portal repo to merge your changes: https://github.com/Budibase/account-portal/blob/master/docs/index.md')
process.exit(1);
} else {
console.log('All good, the submodule had been merged and setup correctly!')
}

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "packages/pro"] [submodule "packages/pro"]
path = packages/pro path = packages/pro
url = git@github.com:Budibase/budibase-pro.git url = git@github.com:Budibase/budibase-pro.git
[submodule "packages/account-portal"]
path = packages/account-portal
url = git@github.com:Budibase/account-portal.git

View File

@ -8,4 +8,7 @@ packages/worker/coverage
packages/backend-core/coverage packages/backend-core/coverage
packages/builder/.routify packages/builder/.routify
packages/sdk/sdk packages/sdk/sdk
packages/pro/coverage packages/pro/coverage
packages/account-portal/packages/ui/build
packages/account-portal/packages/ui/.routify
packages/account-portal/packages/server/build

View File

@ -22,6 +22,6 @@
"@types/react": "17.0.39", "@types/react": "17.0.39",
"eslint": "8.10.0", "eslint": "8.10.0",
"eslint-config-next": "12.1.0", "eslint-config-next": "12.1.0",
"typescript": "4.6.2" "typescript": "5.2.2"
} }
} }

View File

@ -2,7 +2,9 @@
"version": "2.13.36", "version": "2.13.36",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*",
"!packages/account-portal",
"packages/account-portal/packages/*"
], ],
"useNx": true, "useNx": true,
"command": { "command": {
@ -19,4 +21,4 @@
"loadEnvFiles": false "loadEnvFiles": false
} }
} }
} }

View File

@ -6,13 +6,13 @@
"@babel/eslint-parser": "^7.22.5", "@babel/eslint-parser": "^7.22.5",
"@babel/preset-env": "^7.22.5", "@babel/preset-env": "^7.22.5",
"@esbuild-plugins/tsconfig-paths": "^0.1.2", "@esbuild-plugins/tsconfig-paths": "^0.1.2",
"@typescript-eslint/parser": "6.7.2", "@typescript-eslint/parser": "6.9.0",
"esbuild": "^0.18.17", "esbuild": "^0.18.17",
"esbuild-node-externals": "^1.8.0", "esbuild-node-externals": "^1.8.0",
"eslint": "^8.44.0", "eslint": "^8.52.0",
"eslint-plugin-import": "^2.29.0", "eslint-plugin-import": "^2.29.0",
"eslint-plugin-local-rules": "^2.0.0", "eslint-plugin-local-rules": "^2.0.0",
"eslint-plugin-svelte": "^2.32.2", "eslint-plugin-svelte": "^2.34.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"kill-port": "^1.6.1", "kill-port": "^1.6.1",
"lerna": "7.1.1", "lerna": "7.1.1",
@ -22,7 +22,7 @@
"prettier": "2.8.8", "prettier": "2.8.8",
"prettier-plugin-svelte": "^2.3.0", "prettier-plugin-svelte": "^2.3.0",
"svelte": "3.49.0", "svelte": "3.49.0",
"svelte-eslint-parser": "^0.32.0", "svelte-eslint-parser": "^0.33.1",
"typescript": "5.2.2", "typescript": "5.2.2",
"yargs": "^17.7.2" "yargs": "^17.7.2"
}, },
@ -39,13 +39,16 @@
"nuke": "yarn run nuke:packages && yarn run nuke:docker", "nuke": "yarn run nuke:packages && yarn run nuke:docker",
"nuke:packages": "yarn run restore", "nuke:packages": "yarn run restore",
"nuke:docker": "lerna run --stream dev:stack:nuke", "nuke:docker": "lerna run --stream dev:stack:nuke",
"clean": "lerna clean -y", "clean": "lerna clean -y && echo Cleaning top level node modules 🧹 && rm -rf ./node_modules && echo Done! 🚀",
"kill-builder": "kill-port 3000", "kill-builder": "kill-port 3000",
"kill-server": "kill-port 4001 4002", "kill-server": "kill-port 4001 4002",
"kill-all": "yarn run kill-builder && yarn run kill-server", "kill-accountportal": "kill-port 3001 4003",
"dev": "yarn run kill-all && lerna run --parallel prebuild && lerna run --stream dev:builder", "kill-all": "yarn run kill-builder && yarn run kill-server && yarn kill-accountportal",
"dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", "dev": "yarn run kill-all && lerna run --parallel prebuild && lerna run --stream dev --ignore=@budibase/account-portal-ui --ignore @budibase/account-portal-server",
"dev:server": "yarn run kill-server && lerna run --stream dev:builder --scope @budibase/worker --scope @budibase/server", "dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream dev --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker --ignore=@budibase/account-portal-ui --ignore @budibase/account-portal-server",
"dev:server": "yarn run kill-server && lerna run --stream dev --scope @budibase/worker --scope @budibase/server",
"dev:accountportal": "yarn kill-accountportal && lerna run dev --stream --scope @budibase/account-portal-ui --scope @budibase/account-portal-server",
"dev:all": "yarn run kill-all && lerna run --stream dev",
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built", "dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
"dev:docker": "yarn build --scope @budibase/server --scope @budibase/worker && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0", "dev:docker": "yarn build --scope @budibase/server --scope @budibase/worker && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
"test": "lerna run --stream test --stream", "test": "lerna run --stream test --stream",
@ -84,7 +87,9 @@
}, },
"workspaces": { "workspaces": {
"packages": [ "packages": [
"packages/*" "packages/*",
"!packages/account-portal",
"packages/account-portal/packages/*"
] ]
}, },
"resolutions": { "resolutions": {

@ -0,0 +1 @@
Subproject commit 62c4ed384670406576a2d52ce8dafd683cc0a571

View File

@ -21,7 +21,7 @@
"test:watch": "jest --watchAll" "test:watch": "jest --watchAll"
}, },
"dependencies": { "dependencies": {
"@budibase/nano": "10.1.3", "@budibase/nano": "10.1.4",
"@budibase/pouchdb-replication-stream": "1.2.10", "@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/shared-core": "0.0.0", "@budibase/shared-core": "0.0.0",
"@budibase/types": "0.0.0", "@budibase/types": "0.0.0",
@ -73,8 +73,8 @@
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"chance": "1.1.8", "chance": "1.1.8",
"ioredis-mock": "8.9.0", "ioredis-mock": "8.9.0",
"jest": "29.6.2", "jest": "29.7.0",
"jest-environment-node": "29.6.2", "jest-environment-node": "29.7.0",
"jest-serial-runner": "1.2.1", "jest-serial-runner": "1.2.1",
"pino-pretty": "10.0.0", "pino-pretty": "10.0.0",
"pouchdb-adapter-memory": "7.2.2", "pouchdb-adapter-memory": "7.2.2",

View File

@ -6,7 +6,7 @@
"scripts": { "scripts": {
"build": "routify -b && vite build --emptyOutDir", "build": "routify -b && vite build --emptyOutDir",
"start": "routify -c rollup", "start": "routify -c rollup",
"dev:builder": "routify -c dev:vite", "dev": "routify -c dev:vite",
"dev:vite": "vite --host 0.0.0.0", "dev:vite": "vite --host 0.0.0.0",
"rollup": "rollup -c -w", "rollup": "rollup -c -w",
"test": "vitest run", "test": "vitest run",
@ -61,9 +61,9 @@
"@codemirror/theme-one-dark": "^6.1.2", "@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.11.2", "@codemirror/view": "^6.11.2",
"@fontsource/source-sans-pro": "^5.0.3", "@fontsource/source-sans-pro": "^5.0.3",
"@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.4.2",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",
"codemirror": "^5.59.0", "codemirror": "^5.59.0",
@ -78,25 +78,24 @@
"svelte-dnd-action": "^0.9.8", "svelte-dnd-action": "^0.9.8",
"svelte-loading-spinners": "^0.1.1", "svelte-loading-spinners": "^0.1.1",
"svelte-portal": "1.0.0", "svelte-portal": "1.0.0",
"yup": "0.29.2" "yup": "^0.32.11"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.14",
"@babel/plugin-transform-runtime": "^7.13.10", "@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.12", "@babel/preset-env": "^7.13.12",
"@rollup/plugin-replace": "^5.0.3", "@rollup/plugin-replace": "^5.0.3",
"@roxi/routify": "2.18.12", "@roxi/routify": "2.18.12",
"@sveltejs/vite-plugin-svelte": "1.0.1", "@sveltejs/vite-plugin-svelte": "1.4.0",
"@testing-library/jest-dom": "5.17.0", "@testing-library/jest-dom": "5.17.0",
"@testing-library/svelte": "^3.2.2", "@testing-library/svelte": "^3.2.2",
"babel-jest": "29.6.2", "babel-jest": "^29.6.2",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "29.6.2", "jest": "29.7.0",
"jsdom": "^21.1.1", "jsdom": "^21.1.1",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"svelte": "^3.48.0", "svelte": "^3.49.0",
"svelte-jester": "^1.3.2", "svelte-jester": "^1.3.2",
"vite": "^4.4.11", "vite": "^4.5.0",
"vite-plugin-static-copy": "^0.17.0", "vite-plugin-static-copy": "^0.17.0",
"vitest": "^0.29.2" "vitest": "^0.29.2"
}, },
@ -115,7 +114,7 @@
} }
] ]
}, },
"dev:builder": { "dev": {
"dependsOn": [ "dependsOn": [
{ {
"projects": [ "projects": [

View File

@ -125,7 +125,6 @@
// Handler for DatasourceModal confirmation, move to screen access select // Handler for DatasourceModal confirmation, move to screen access select
const confirmScreenDatasources = async ({ templates }) => { const confirmScreenDatasources = async ({ templates }) => {
console.log(templates)
selectedTemplates = templates selectedTemplates = templates
screenAccessRoleModal.show() screenAccessRoleModal.show()
} }

View File

@ -134,6 +134,10 @@ export default defineConfig(({ mode }) => {
find: "@budibase/shared-core", find: "@budibase/shared-core",
replacement: path.resolve("../shared-core/src"), replacement: path.resolve("../shared-core/src"),
}, },
{
find: "@budibase/bbui",
replacement: path.resolve("../bbui/src"),
},
], ],
}, },
} }

View File

@ -52,11 +52,11 @@
"yaml": "^2.1.1" "yaml": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "29.5.3", "@types/jest": "29.5.5",
"@types/node-fetch": "2.6.4", "@types/node-fetch": "2.6.4",
"@types/pouchdb": "^6.4.0", "@types/pouchdb": "^6.4.0",
"renamer": "^4.0.0", "renamer": "^4.0.0",
"ts-node": "^10.9.1", "ts-node": "10.8.1",
"typescript": "5.2.2" "typescript": "5.2.2"
} }
} }

View File

@ -16,7 +16,7 @@
}, },
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",
"dev:builder": "rollup -cw" "dev": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "0.0.0", "@budibase/bbui": "0.0.0",
@ -78,7 +78,7 @@
} }
] ]
}, },
"dev:builder": { "dev": {
"dependsOn": [ "dependsOn": [
{ {
"projects": [ "projects": [

View File

@ -9,8 +9,8 @@
"@budibase/bbui": "0.0.0", "@budibase/bbui": "0.0.0",
"@budibase/shared-core": "0.0.0", "@budibase/shared-core": "0.0.0",
"dayjs": "^1.10.8", "dayjs": "^1.10.8",
"lodash": "^4.17.21", "lodash": "4.17.21",
"socket.io-client": "^4.6.1", "socket.io-client": "^4.6.1",
"svelte": "^3.46.2" "svelte": "^3.49.0"
} }
} }

@ -1 +1 @@
Subproject commit 1037b032d49244678204704d1bca779a29e395eb Subproject commit 056c2093dbc93d9a10ea9f5050c84a84edd8100c

View File

@ -23,7 +23,7 @@
"dev:stack:up": "node scripts/dev/manage.js up", "dev:stack:up": "node scripts/dev/manage.js up",
"dev:stack:down": "node scripts/dev/manage.js down", "dev:stack:down": "node scripts/dev/manage.js down",
"dev:stack:nuke": "node scripts/dev/manage.js nuke", "dev:stack:nuke": "node scripts/dev/manage.js nuke",
"dev:builder": "yarn run dev:stack:up && nodemon", "dev": "yarn run dev:stack:up && nodemon",
"dev:built": "yarn run dev:stack:up && yarn run run:docker", "dev:built": "yarn run dev:stack:up && yarn run run:docker",
"specs": "ts-node specs/generate.ts && openapi-typescript specs/openapi.yaml --output src/definitions/openapi.ts", "specs": "ts-node specs/generate.ts && openapi-typescript specs/openapi.yaml --output src/definitions/openapi.ts",
"initialise": "node scripts/initialise.js", "initialise": "node scripts/initialise.js",
@ -111,7 +111,6 @@
"xml2js": "0.5.0" "xml2js": "0.5.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.17.4",
"@babel/preset-env": "7.16.11", "@babel/preset-env": "7.16.11",
"@swc/core": "1.3.71", "@swc/core": "1.3.71",
"@swc/jest": "0.2.27", "@swc/jest": "0.2.27",
@ -128,20 +127,20 @@
"@types/oracledb": "5.2.2", "@types/oracledb": "5.2.2",
"@types/pg": "8.6.6", "@types/pg": "8.6.6",
"@types/server-destroy": "1.0.1", "@types/server-destroy": "1.0.1",
"@types/supertest": "2.0.12", "@types/supertest": "2.0.14",
"@types/tar": "6.1.5", "@types/tar": "6.1.5",
"apidoc": "0.50.4", "apidoc": "0.50.4",
"copyfiles": "2.4.1", "copyfiles": "2.4.1",
"docker-compose": "0.23.17", "docker-compose": "0.23.17",
"jest": "29.6.2", "jest": "29.7.0",
"jest-openapi": "0.14.2", "jest-openapi": "0.14.2",
"jest-runner": "29.6.2", "jest-runner": "29.7.0",
"jest-serial-runner": "1.2.1", "jest-serial-runner": "1.2.1",
"nodemon": "2.0.15", "nodemon": "2.0.15",
"openapi-typescript": "5.2.0", "openapi-typescript": "5.2.0",
"path-to-regexp": "6.2.0", "path-to-regexp": "6.2.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"supertest": "6.2.2", "supertest": "6.3.3",
"swagger-jsdoc": "6.1.0", "swagger-jsdoc": "6.1.0",
"timekeeper": "2.2.0", "timekeeper": "2.2.0",
"ts-node": "10.8.1", "ts-node": "10.8.1",
@ -155,7 +154,7 @@
}, },
"nx": { "nx": {
"targets": { "targets": {
"dev:builder": { "dev": {
"dependsOn": [ "dependsOn": [
{ {
"comment": "Required for pro usage when submodule not loaded", "comment": "Required for pro usage when submodule not loaded",

View File

@ -28,6 +28,7 @@ async function init() {
INTERNAL_API_KEY: "budibase", INTERNAL_API_KEY: "budibase",
ACCOUNT_PORTAL_URL: "http://localhost:10001", ACCOUNT_PORTAL_URL: "http://localhost:10001",
ACCOUNT_PORTAL_API_KEY: "budibase", ACCOUNT_PORTAL_API_KEY: "budibase",
PLATFORM_URL: "http://localhost:10000",
JWT_SECRET: "testsecret", JWT_SECRET: "testsecret",
ENCRYPTION_KEY: "testsecret", ENCRYPTION_KEY: "testsecret",
REDIS_PASSWORD: "budibase", REDIS_PASSWORD: "budibase",

View File

@ -10,7 +10,7 @@
"prebuild": "rimraf dist/", "prebuild": "rimraf dist/",
"build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly --paths null", "build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly --paths null",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"dev:builder": "tsc -p tsconfig.json --watch --preserveWatchOutput", "dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
"check:types": "tsc -p tsconfig.json --noEmit --paths null" "check:types": "tsc -p tsconfig.json --noEmit --paths null"
}, },
"dependencies": { "dependencies": {
@ -32,7 +32,7 @@
} }
] ]
}, },
"dev:builder": { "dev": {
"dependsOn": [ "dependsOn": [
{ {
"projects": [ "projects": [

View File

@ -1,39 +1,42 @@
# String templating # String templating
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/budibase/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/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. 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.
2. [Array](https://github.com/budibase/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/budibase/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/budibase/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/budibase/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/budibase/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. [Object](https://github.com/budibase/handlebars-helpers/tree/master#object) - useful operator for parsing objects, as well 7. [Object](https://github.com/budibase/handlebars-helpers/tree/master#object) - useful operator for parsing objects, as well
as converting them to JSON strings. as converting them to JSON strings.
8. [Regex](https://github.com/budibase/handlebars-helpers/tree/master#regex) - allows performing regex tests on strings that 8. [Regex](https://github.com/budibase/handlebars-helpers/tree/master#regex) - allows performing regex tests on strings that
can be used in conditional statements. 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 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
This package uses the standard method for formatting date times, using the following syntax: This package uses the standard method for formatting date times, using the following syntax:
| Input | Example | Description | | Input | Example | Description |
| ----- | ------- | ----------- | | ----- | ------- | ----------- |
| YYYY | 2014 | 4 or 2 digit year. Note: Only 4 digit can be parsed on strict mode | | YYYY | 2014 | 4 or 2 digit year. Note: Only 4 digit can be parsed on strict mode |
| YY | 14 | 2 digit year | | YY | 14 | 2 digit year |
| Y | -25 | Year with any number of digits and sign | | Y | -25 | Year with any number of digits and sign |
| Q | 1..4 | Quarter of year. Sets month to first month in quarter. | | Q | 1..4 | Quarter of year. Sets month to first month in quarter. |
| M MM | 1..12 | Month number | | M MM | 1..12 | Month number |
@ -42,55 +45,64 @@ This package uses the standard method for formatting date times, using the follo
| Do | 1st..31st | Day of month with ordinal | | Do | 1st..31st | Day of month with ordinal |
| DDD DDDD | 1..365 | Day of year | | DDD DDDD | 1..365 | Day of year |
| X | 1410715640.579 | Unix timestamp | | X | 1410715640.579 | Unix timestamp |
| x | 1410715640579 | Unix ms timestamp | | x | 1410715640579 | Unix ms timestamp |
## Template format ## Template format
There are two main ways that the templating system can be used, the first is very similar to that which There are two main ways that the templating system can be used, the first is very similar to that which
would be produced by Mustache - a single statement: would be produced by Mustache - a single statement:
``` ```
Hello I'm building a {{uppercase adjective}} string with Handlebars! Hello I'm building a {{uppercase adjective}} string with Handlebars!
``` ```
In the statement above provided a context of `{adjective: "cool"}` will produce a string of `Hello I'm building a COOL string with Handlebars!`. In the statement above provided a context of `{adjective: "cool"}` will produce a string of `Hello I'm building a COOL string with Handlebars!`.
Here we can see an example of how string helpers can be used to make a string exactly as we need it. These statements are relatively Here we can see an example of how string helpers can be used to make a string exactly as we need it. These statements are relatively
simple; we can also stack helpers as such: `{{ uppercase (remove string "bad") }}` with the use of parenthesis. simple; we can also stack helpers as such: `{{ uppercase (remove string "bad") }}` with the use of parenthesis.
The other type of statement that can be made with the templating system is conditional ones, that appear as such: The other type of statement that can be made with the templating system is conditional ones, that appear as such:
``` ```
Hello I'm building a {{ #gte score "50" }}Great{{ else }}Bad{{ /gte }} string with Handlebars! Hello I'm building a {{ #gte score "50" }}Great{{ else }}Bad{{ /gte }} string with Handlebars!
``` ```
In this string we can see that the string `Great` or `Bad` will be inserted depending on the state of the
In this string we can see that the string `Great` or `Bad` will be inserted depending on the state of the
`score` context variable. The comparison, string and array helpers all provide some conditional operators which can be used `score` context variable. The comparison, string and array helpers all provide some conditional operators which can be used
in this way. There will also be some operators which will be built with a very similar syntax but will produce an in this way. There will also be some operators which will be built with a very similar syntax but will produce an
iterative operation, like a for each - an example of this would be the `forEach` array helper. iterative operation, like a for each - an example of this would be the `forEach` array helper.
## Usage ## Usage
Usage of this templating package is through one of the primary functions provided by the package - these functions are
Usage of this templating package is through one of the primary functions provided by the package - these functions are
as follows: as follows:
1. `processString` - `async (string, object)` - given a template string and a context object this will build a string
using our pre-processors, post-processors and handlebars. 1. `processString` - `async (string, object)` - given a template string and a context object this will build a string
2. `processObject` - `async (object, object)` - carries out the functionality provided by `processString` for any string using our pre-processors, post-processors and handlebars.
inside the given object. This will recurse deeply into the provided object so for very large objects this could be slow. 2. `processObject` - `async (object, object)` - carries out the functionality provided by `processString` for any string
3. `processStringSync` - `(string, object)` - a reduced functionality processing of strings which is synchronous, like inside the given object. This will recurse deeply into the provided object so for very large objects this could be slow.
functions provided by Node (e.g. `readdirSync`) 3. `processStringSync` - `(string, object)` - a reduced functionality processing of strings which is synchronous, like
functions provided by Node (e.g. `readdirSync`)
4. `processObjectSync` - `(object, object)` - as with the sync'd string, recurses an object to process it synchronously. 4. `processObjectSync` - `(object, object)` - as with the sync'd string, recurses an object to process it synchronously.
5. `makePropSafe` - `(string)` - some properties cannot be handled by Handlebars, for example `Table 1` is not valid due 5. `makePropSafe` - `(string)` - some properties cannot be handled by Handlebars, for example `Table 1` is not valid due
to spaces found in the property name. This will update the property name to `[Table 1]` wrapping it in literal to spaces found in the property name. This will update the property name to `[Table 1]` wrapping it in literal
specifiers so that it is safe for use in Handlebars. Ideally this function should be called for every level of an object specifiers so that it is safe for use in Handlebars. Ideally this function should be called for every level of an object
being accessed, for example `[Table 1].[property name]` is the syntax that is required for Handlebars. being accessed, for example `[Table 1].[property name]` is the syntax that is required for Handlebars.
6. `isValid` - `(string)` - checks the given string for any templates and provides a boolean stating whether it is a valid 6. `isValid` - `(string)` - checks the given string for any templates and provides a boolean stating whether it is a valid
template. template.
7. `getManifest` - returns the manifest JSON which has been generated for the helpers, describing them and their params. 7. `getManifest` - returns the manifest JSON which has been generated for the helpers, describing them and their params.
## Development ## Development
This library is built with [Rollup](https://rollupjs.org/guide/en/) as many of the packages built by Budibase are. We have This library is built with [Rollup](https://rollupjs.org/guide/en/) as many of the packages built by Budibase are. We have
built the string templating package as a UMD so that it can be used by Node and Browser based applications. This package also built the string templating package as a UMD so that it can be used by Node and Browser based applications. This package also
builds Typescript stubs which when making use of the library will be used by your IDE to provide code completion. The following builds Typescript stubs which when making use of the library will be used by your IDE to provide code completion. The following
commands are provided for development purposes: commands are provided for development purposes:
1. `yarn build` - will build the Typescript stubs and the bundle into the `dist` directory. 1. `yarn build` - will build the Typescript stubs and the bundle into the `dist` directory.
2. `yarn test` - runs the test suite which will check various helpers are still functioning as 2. `yarn test` - runs the test suite which will check various helpers are still functioning as
expected and a few expected use cases. expected and a few expected use cases.
3. `yarn dev:builder` - an internal command which is used by lerna to watch and build any changes 3. `yarn dev` - an internal command which is used by lerna to watch and build any changes
to the package as part of the main `yarn dev` of the repo. to the package as part of the main `yarn dev` of the repo.
It is also important to note this package is managed in the same manner as all other in the mono-repo, It is also important to note this package is managed in the same manner as all other in the mono-repo,
through lerna. through lerna.

View File

@ -20,7 +20,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc && rollup -c", "build": "tsc && rollup -c",
"dev:builder": "tsc && rollup -cw", "dev": "tsc && rollup -cw",
"test": "jest", "test": "jest",
"manifest": "node ./scripts/gen-collection-info.js" "manifest": "node ./scripts/gen-collection-info.js"
}, },
@ -35,7 +35,7 @@
"@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"doctrine": "^3.0.0", "doctrine": "^3.0.0",
"jest": "29.6.2", "jest": "29.7.0",
"marked": "^4.0.10", "marked": "^4.0.10",
"rollup": "^2.36.2", "rollup": "^2.36.2",
"rollup-plugin-inject-process-env": "^1.3.1", "rollup-plugin-inject-process-env": "^1.3.1",

View File

@ -10,12 +10,12 @@
"prebuild": "rimraf dist/", "prebuild": "rimraf dist/",
"build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly", "build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"dev:builder": "tsc -p tsconfig.json --watch --preserveWatchOutput", "dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
"check:types": "tsc -p tsconfig.json --noEmit --paths null" "check:types": "tsc -p tsconfig.json --noEmit --paths null"
}, },
"jest": {}, "jest": {},
"devDependencies": { "devDependencies": {
"@budibase/nano": "10.1.3", "@budibase/nano": "10.1.4",
"@types/koa": "2.13.4", "@types/koa": "2.13.4",
"@types/node": "18.17.0", "@types/node": "18.17.0",
"@types/pouchdb": "6.4.0", "@types/pouchdb": "6.4.0",

View File

@ -1,4 +1,4 @@
import Nano from "@budibase/nano" import type Nano from "@budibase/nano"
import { AllDocsResponse, AnyDocument, Document, ViewTemplateOpts } from "../" import { AllDocsResponse, AnyDocument, Document, ViewTemplateOpts } from "../"
import { Writable } from "stream" import { Writable } from "stream"

View File

@ -21,7 +21,7 @@
"debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js", "debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js",
"run:docker:cluster": "pm2-runtime start pm2.config.js", "run:docker:cluster": "pm2-runtime start pm2.config.js",
"dev:stack:init": "node ./scripts/dev/manage.js init", "dev:stack:init": "node ./scripts/dev/manage.js init",
"dev:builder": "npm run dev:stack:init && nodemon", "dev": "npm run dev:stack:init && nodemon",
"dev:built": "yarn run dev:stack:init && yarn run run:docker", "dev:built": "yarn run dev:stack:init && yarn run run:docker",
"test": "bash scripts/test.sh", "test": "bash scripts/test.sh",
"test:watch": "jest --watch", "test:watch": "jest --watch",
@ -75,26 +75,26 @@
"@swc/jest": "0.2.27", "@swc/jest": "0.2.27",
"@trendyol/jest-testcontainers": "2.1.1", "@trendyol/jest-testcontainers": "2.1.1",
"@types/jest": "29.5.5", "@types/jest": "29.5.5",
"@types/jsonwebtoken": "8.5.1", "@types/jsonwebtoken": "9.0.3",
"@types/koa": "2.13.4", "@types/koa": "2.13.4",
"@types/koa__router": "8.0.8", "@types/koa__router": "8.0.8",
"@types/lodash": "4.14.200", "@types/lodash": "4.14.200",
"@types/node": "18.17.0", "@types/node": "18.17.0",
"@types/node-fetch": "2.6.4", "@types/node-fetch": "2.6.4",
"@types/server-destroy": "1.0.1", "@types/server-destroy": "1.0.1",
"@types/supertest": "2.0.12", "@types/supertest": "2.0.14",
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"jest": "29.6.2", "jest": "29.7.0",
"nodemon": "2.0.15", "nodemon": "2.0.15",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"supertest": "6.2.2", "supertest": "6.3.3",
"timekeeper": "2.2.0", "timekeeper": "2.2.0",
"typescript": "5.2.2", "typescript": "5.2.2",
"update-dotenv": "1.1.1" "update-dotenv": "1.1.1"
}, },
"nx": { "nx": {
"targets": { "targets": {
"dev:builder": { "dev": {
"dependsOn": [ "dependsOn": [
{ {
"comment": "Required for pro usage when submodule not loaded", "comment": "Required for pro usage when submodule not loaded",

View File

@ -29,7 +29,7 @@
"@types/node-fetch": "2.6.4", "@types/node-fetch": "2.6.4",
"chance": "1.1.8", "chance": "1.1.8",
"dotenv": "16.0.1", "dotenv": "16.0.1",
"jest": "29.6.2", "jest": "29.7.0",
"prettier": "2.7.1", "prettier": "2.7.1",
"start-server-and-test": "1.14.0", "start-server-and-test": "1.14.0",
"@swc/core": "1.3.71", "@swc/core": "1.3.71",

View File

@ -23,7 +23,7 @@ function runBuild(entry, outfile) {
) )
if ( if (
!fs.existsSync("../pro/src") && !fs.existsSync(path.join(__dirname, "../packages/pro/src")) &&
tsconfigPathPluginContent.compilerOptions?.paths tsconfigPathPluginContent.compilerOptions?.paths
) { ) {
// If we don't have pro, we cannot bundle backend-core. // If we don't have pro, we cannot bundle backend-core.
@ -51,7 +51,15 @@ function runBuild(entry, outfile) {
".svelte": "copy", ".svelte": "copy",
}, },
metafile: true, metafile: true,
external: ["deasync", "mock-aws-s3", "nock", "bull"], external: [
"deasync",
"mock-aws-s3",
"nock",
"bull",
"pouchdb",
"bcrypt",
"bcryptjs",
],
} }
build({ build({

View File

@ -5,12 +5,12 @@ domain=$2
if [ "$enable" = "enable" ]; then if [ "$enable" = "enable" ]; then
lerna run env:localdomain:enable -- "$domain" lerna run env:localdomain:enable -- "$domain"
cd ../account-portal cd packages/account-portal
yarn env:localdomain:enable "$domain" yarn env:localdomain:enable "$domain"
cd - cd -
else else
lerna run env:localdomain:disable lerna run env:localdomain:disable
cd ../account-portal cd packages/account-portal
yarn env:localdomain:disable yarn env:localdomain:disable
cd - cd -
fi fi

2713
yarn.lock

File diff suppressed because it is too large Load Diff