Merge branch 'master' of https://github.com/Budibase/budibase into lab-day-2705
This commit is contained in:
commit
edfc23454d
8
LICENSE
8
LICENSE
|
@ -1,8 +1,12 @@
|
||||||
Copyright 2019-2021, Budibase Ltd
|
Copyright 2019-2021, Budibase Inc.
|
||||||
|
|
||||||
Each Budibase package has its own license:
|
Each Budibase package has its own license:
|
||||||
|
|
||||||
builder: AGPLv3
|
builder: GPLv3
|
||||||
server: GPLv3
|
server: GPLv3
|
||||||
client: MPLv2.0
|
client: MPLv2.0
|
||||||
standard-components: MPLv2.0
|
standard-components: MPLv2.0
|
||||||
|
|
||||||
|
You can consider Budibase to be GPLv3 licensed.
|
||||||
|
|
||||||
|
The apps that you build with Budibase do not fall under GPLv3 - hence why our components and client library are licensed differently.
|
||||||
|
|
18
README.md
18
README.md
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://i.imgur.com/tPQHruf.png">
|
<img src="https://i.imgur.com/k9ANC3b.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 align="center">
|
<h3 align="center">
|
||||||
<a href="https://portal.budi.live/signup">Sign-up</a>
|
<a href="https://docs.budibase.com/getting-started">Get started</a>
|
||||||
<span> · </span>
|
<span> · </span>
|
||||||
<a href="https://docs.budibase.com">Docs</a>
|
<a href="https://docs.budibase.com">Docs</a>
|
||||||
<span> · </span>
|
<span> · </span>
|
||||||
|
@ -61,16 +61,18 @@
|
||||||
|
|
||||||
- **Build and ship real software.** Unlike other platforms, with Budibase you build and ship single page applications. Budibase applications have performance baked in and can be designed responsively, providing your users with a great experience.
|
- **Build and ship real software.** Unlike other platforms, with Budibase you build and ship single page applications. Budibase applications have performance baked in and can be designed responsively, providing your users with a great experience.
|
||||||
|
|
||||||
- **Open source and extensable.** Budibase is open-source. The builder is licensed AGPL v3, the server is GPL v3, and the client is MPL. This should fill you with confidence that Budibase will always be around. You can also code against Budibase or fork it and make changes as you please, providing a developer-friendly experience.
|
- **Open source and extensable.** Budibase is open-source - licensed as GPL v3. This should fill you with confidence that Budibase will always be around. You can also code against Budibase or fork it and make changes as you please, providing a developer-friendly experience.
|
||||||
|
|
||||||
- **Load data or start from scratch.** Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, mySQL, Airtable, Google Sheets, S3, DyanmoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no data sources. [Request new data sources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
- **Load data or start from scratch.** Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, mySQL, Airtable, S3, DyanmoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no data sources. [Request new data sources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
||||||
|
|
||||||
- **Design and build apps with powerful pre-made components.** Budibase comes out of the box with beautifully designed, powerful components which you can use like building blocks to build your UI. We also expose a lot of your favourite CSS styling options so you can go that extra creative mile. [Request new components](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
- **Design and build apps with powerful pre-made components.** Budibase comes out of the box with beautifully designed, powerful components which you can use like building blocks to build your UI. We also expose a lot of your favourite CSS styling options so you can go that extra creative mile. [Request new component](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
||||||
|
|
||||||
- **Automate processes, integrate with other tools, and connect to webhooks.** Save time by automating manual processes and workflows. From connecting to webhooks, to automating emails, simply tell Budibase what to do and let it work for you. You can easily [create new automations for Budibase here](https://github.com/Budibase/automations) or [request new integrations here](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
- **Automate processes, integrate with other tools, and connect to webhooks.** Save time by automating manual processes and workflows. From connecting to webhooks, to automating emails, simply tell Budibase what to do and let it work for you. You can easily [create new automations for Budibase here](https://github.com/Budibase/automations) or [Request new automation](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
|
||||||
|
|
||||||
|
- **Admin paradise.** Budibase is made to scale. With Budibase, you can self-host on your own infraastructure and globally manage users, onboarding, SMTP, apps, groups, theming and more. You can also provide users/groups with an app portal and disseminate user-management to the group manager.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="Budibase design ui" src="https://imgur.com/v8m6v3q.png">
|
<img alt="Budibase design ui" src="https://i.imgur.com/5BnXPsN.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@
|
||||||
## ⌛ Status
|
## ⌛ Status
|
||||||
- [x] Alpha: We are demoing Budibase to users and receiving feedback
|
- [x] Alpha: We are demoing Budibase to users and receiving feedback
|
||||||
- [x] Private Beta: We are testing Budibase with a closed set of customers
|
- [x] Private Beta: We are testing Budibase with a closed set of customers
|
||||||
- [x] Public Beta: Anyone can [sign-up and use Budibase](https://portal.budi.live/signup).
|
- [x] Public Beta: Anyone can [get started](https://docs.budibase.com/getting-started).
|
||||||
- [ ] Official Launch
|
- [ ] Official Launch
|
||||||
|
|
||||||
Watch "releases" of this repo to get notified of major updates, and give the star button a click whilst you're there.
|
Watch "releases" of this repo to get notified of major updates, and give the star button a click whilst you're there.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/auth",
|
"name": "@budibase/auth",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"description": "Authentication middlewares for budibase builder and apps",
|
"description": "Authentication middlewares for budibase builder and apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -2,20 +2,26 @@ const env = require("../../environment")
|
||||||
const jwt = require("jsonwebtoken")
|
const jwt = require("jsonwebtoken")
|
||||||
const database = require("../../db")
|
const database = require("../../db")
|
||||||
const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy
|
const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy
|
||||||
const { StaticDatabases, generateGlobalUserID } = require("../../db/utils")
|
const {
|
||||||
|
StaticDatabases,
|
||||||
|
generateGlobalUserID,
|
||||||
|
ViewNames,
|
||||||
|
} = require("../../db/utils")
|
||||||
|
|
||||||
async function authenticate(token, tokenSecret, profile, done) {
|
async function authenticate(token, tokenSecret, profile, done) {
|
||||||
// Check the user exists in the instance DB by email
|
// Check the user exists in the instance DB by email
|
||||||
const db = database.getDB(StaticDatabases.GLOBAL.name)
|
const db = database.getDB(StaticDatabases.GLOBAL.name)
|
||||||
|
|
||||||
let dbUser
|
let dbUser
|
||||||
|
|
||||||
const userId = generateGlobalUserID(profile.id)
|
const userId = generateGlobalUserID(profile.id)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// use the google profile id
|
// use the google profile id
|
||||||
dbUser = await db.get(userId)
|
dbUser = await db.get(userId)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Google user not found. Creating..")
|
console.log("Google user not found. Creating..")
|
||||||
|
|
||||||
// create the user
|
// create the user
|
||||||
const user = {
|
const user = {
|
||||||
_id: userId,
|
_id: userId,
|
||||||
|
@ -26,6 +32,26 @@ async function authenticate(token, tokenSecret, profile, done) {
|
||||||
},
|
},
|
||||||
...profile._json,
|
...profile._json,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if an account with the google email address exists locally
|
||||||
|
const users = await db.query(`database/${ViewNames.USER_BY_EMAIL}`, {
|
||||||
|
key: profile._json.email,
|
||||||
|
include_docs: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Google user already exists by email
|
||||||
|
if (users.rows.length > 0) {
|
||||||
|
const existing = users.rows[0].doc
|
||||||
|
|
||||||
|
// remove the local account to avoid conflicts
|
||||||
|
await db.remove(existing._id, existing._rev)
|
||||||
|
|
||||||
|
// merge with existing account
|
||||||
|
user.roles = existing.roles
|
||||||
|
user.builder = existing.builder
|
||||||
|
user.admin = existing.admin
|
||||||
|
}
|
||||||
|
|
||||||
const response = await db.post(user)
|
const response = await db.post(user)
|
||||||
|
|
||||||
dbUser = user
|
dbUser = user
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/bbui",
|
"name": "@budibase/bbui",
|
||||||
"description": "A UI solution used in the different Budibase projects.",
|
"description": "A UI solution used in the different Budibase projects.",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 19 November 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright 2019-2021, Budibase Ltd
|
Copyright 2019-2021, Budibase Inc
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
The GNU General Public License is a free, copyleft license for
|
||||||
software and other kinds of works, specifically designed to ensure
|
software and other kinds of works.
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
share and change all versions of a program--to make sure it remains free
|
share and change all versions of a program--to make sure it remains free
|
||||||
software for all its users.
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
@ -24,34 +26,44 @@ them if you wish), that you receive source code or can get it if you
|
||||||
want it, that you can change the software or use pieces of it in new
|
want it, that you can change the software or use pieces of it in new
|
||||||
free programs, and that you know you can do these things.
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
To protect your rights, we need to prevent others from denying you
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
you this License which gives you legal permission to copy, distribute
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
and/or modify the software.
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
For example, if you distribute copies of such a program, whether
|
||||||
improvements made in alternate versions of the program, if they
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
receive widespread use, become available for other developers to
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
incorporate. Many developers of free software are heartened and
|
or can get the source code. And you must show them these terms so they
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
know their rights.
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
ensure that, in such cases, the modified source code becomes available
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
to the community. It requires the operator of a network server to
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
that there is no warranty for this free software. For both users' and
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
changed, so that their problems will not be attributed erroneously to
|
||||||
this license.
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
@ -60,7 +72,7 @@ modification follow.
|
||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
@ -537,45 +549,35 @@ to collect a royalty for further conveying from those to whom you convey
|
||||||
the Program, the only way you could satisfy both those terms and this
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
Notwithstanding any other provision of this License, you have
|
||||||
permission to link or combine any covered work with a work licensed
|
permission to link or combine any covered work with a work licensed
|
||||||
under version 3 of the GNU General Public License into a single
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
combined work, and to convey the resulting work. The terms of this
|
combined work, and to convey the resulting work. The terms of this
|
||||||
License will continue to apply to the part which is the covered work,
|
License will continue to apply to the part which is the covered work,
|
||||||
but the work with which it is combined will remain governed by version
|
but the special requirements of the GNU Affero General Public License,
|
||||||
3 of the GNU General Public License.
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
the GNU General Public License from time to time. Such new versions will
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
Program specifies that a certain numbered version of the GNU General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
version or of any later version published by the Free Software
|
||||||
Foundation. If the Program does not specify a version number of the
|
Foundation. If the Program does not specify a version number of the
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
GNU General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
public statement of acceptance of a version permanently authorizes you
|
public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
@ -633,29 +635,40 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published
|
it under the terms of the GNU General Public License as published by
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
If the program does terminal interaction, make it output a short
|
||||||
network, you should also make sure that it provides a way for users to
|
notice like this when it starts in an interactive mode:
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
<program> Copyright (C) <year> <name of author>
|
||||||
of the code. There are many ways you could offer source, and different
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
solutions will be better for different programs; see section 13 for the
|
This is free software, and you are welcome to redistribute it
|
||||||
specific requirements.
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<https://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#393C44;}
|
||||||
|
.st1{fill:#FFFFFF;}
|
||||||
|
.st2{fill:#4285F4;}
|
||||||
|
</style>
|
||||||
|
<rect x="-152.17" y="-24.17" class="st0" width="96.17" height="96.17"/>
|
||||||
|
<path class="st1" d="M-83.19,48h-41.79c-1.76,0-3.19-1.43-3.19-3.19V3.02c0-1.76,1.43-3.19,3.19-3.19h41.79
|
||||||
|
c1.76,0,3.19,1.43,3.19,3.19v41.79C-80,46.57-81.43,48-83.19,48z"/>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M-99.62,12.57v9.94c1.15-1.21,2.59-1.81,4.32-1.81c1.03,0,1.97,0.19,2.82,0.58c0.86,0.39,1.59,0.91,2.19,1.57
|
||||||
|
c0.6,0.66,1.08,1.43,1.42,2.32c0.34,0.89,0.51,1.84,0.51,2.85c0,1.03-0.18,1.99-0.53,2.89c-0.35,0.9-0.84,1.68-1.47,2.35
|
||||||
|
c-0.63,0.67-1.37,1.19-2.23,1.58c-0.86,0.39-1.78,0.58-2.77,0.58c-1.8,0-3.22-0.66-4.27-1.97V35h-4.89V12.57H-99.62z
|
||||||
|
M-93.46,28.11c0-0.43-0.08-0.84-0.24-1.23c-0.16-0.39-0.39-0.72-0.68-1.01c-0.29-0.29-0.62-0.52-1-0.69
|
||||||
|
c-0.38-0.17-0.79-0.26-1.24-0.26c-0.43,0-0.84,0.08-1.22,0.24c-0.38,0.16-0.71,0.39-0.99,0.68c-0.28,0.29-0.5,0.63-0.68,1.01
|
||||||
|
c-0.17,0.39-0.26,0.8-0.26,1.23c0,0.43,0.08,0.84,0.24,1.22c0.16,0.38,0.39,0.71,0.68,0.99c0.29,0.28,0.63,0.5,1.01,0.68
|
||||||
|
c0.39,0.17,0.8,0.26,1.23,0.26c0.43,0,0.84-0.08,1.22-0.24c0.38-0.16,0.71-0.39,0.99-0.68c0.28-0.29,0.5-0.62,0.68-1
|
||||||
|
C-93.55,28.92-93.46,28.52-93.46,28.11z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M-114.76,12.57v9.94c1.15-1.21,2.59-1.81,4.32-1.81c1.03,0,1.97,0.19,2.82,0.58
|
||||||
|
c0.86,0.39,1.59,0.91,2.19,1.57c0.6,0.66,1.08,1.43,1.42,2.32c0.34,0.89,0.51,1.84,0.51,2.85c0,1.03-0.18,1.99-0.53,2.89
|
||||||
|
c-0.35,0.9-0.84,1.68-1.47,2.35c-0.63,0.67-1.37,1.19-2.23,1.58c-0.86,0.39-1.78,0.58-2.77,0.58c-1.8,0-3.22-0.66-4.27-1.97V35
|
||||||
|
h-4.89V12.57H-114.76z M-108.6,28.11c0-0.43-0.08-0.84-0.24-1.23c-0.16-0.39-0.39-0.72-0.68-1.01c-0.29-0.29-0.62-0.52-1-0.69
|
||||||
|
c-0.38-0.17-0.79-0.26-1.24-0.26c-0.43,0-0.84,0.08-1.22,0.24c-0.38,0.16-0.71,0.39-0.99,0.68c-0.28,0.29-0.5,0.63-0.68,1.01
|
||||||
|
c-0.17,0.39-0.26,0.8-0.26,1.23c0,0.43,0.08,0.84,0.24,1.22c0.16,0.38,0.39,0.71,0.68,0.99c0.29,0.28,0.63,0.5,1.01,0.68
|
||||||
|
c0.39,0.17,0.8,0.26,1.23,0.26c0.43,0,0.84-0.08,1.22-0.24c0.38-0.16,0.71-0.39,0.99-0.68c0.28-0.29,0.5-0.62,0.68-1
|
||||||
|
C-108.68,28.92-108.6,28.52-108.6,28.11z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<path class="st2" d="M44.81,159H3.02c-1.76,0-3.19-1.43-3.19-3.19v-41.79c0-1.76,1.43-3.19,3.19-3.19h41.79
|
||||||
|
c1.76,0,3.19,1.43,3.19,3.19v41.79C48,157.57,46.57,159,44.81,159z"/>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M28.38,123.57v9.94c1.15-1.21,2.59-1.81,4.32-1.81c1.03,0,1.97,0.19,2.82,0.58c0.86,0.39,1.59,0.91,2.19,1.57
|
||||||
|
c0.6,0.66,1.08,1.43,1.42,2.32c0.34,0.89,0.51,1.84,0.51,2.85c0,1.03-0.18,1.99-0.53,2.89c-0.35,0.9-0.84,1.68-1.47,2.35
|
||||||
|
c-0.63,0.67-1.37,1.19-2.23,1.58c-0.86,0.39-1.78,0.58-2.77,0.58c-1.8,0-3.22-0.66-4.27-1.97V146h-4.89v-22.43H28.38z
|
||||||
|
M34.54,139.11c0-0.43-0.08-0.84-0.24-1.23c-0.16-0.39-0.39-0.72-0.68-1.01c-0.29-0.29-0.62-0.52-1-0.69
|
||||||
|
c-0.38-0.17-0.79-0.26-1.24-0.26c-0.43,0-0.84,0.08-1.22,0.24c-0.38,0.16-0.71,0.39-0.99,0.68c-0.28,0.29-0.5,0.63-0.68,1.01
|
||||||
|
c-0.17,0.39-0.26,0.8-0.26,1.23c0,0.43,0.08,0.84,0.24,1.22c0.16,0.38,0.39,0.71,0.68,0.99c0.29,0.28,0.63,0.5,1.01,0.68
|
||||||
|
c0.39,0.17,0.8,0.26,1.23,0.26c0.43,0,0.84-0.08,1.22-0.24c0.38-0.16,0.71-0.39,0.99-0.68c0.28-0.29,0.5-0.62,0.68-1
|
||||||
|
C34.45,139.92,34.54,139.52,34.54,139.11z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M13.24,123.57v9.94c1.15-1.21,2.59-1.81,4.32-1.81c1.03,0,1.97,0.19,2.82,0.58c0.86,0.39,1.59,0.91,2.19,1.57
|
||||||
|
c0.6,0.66,1.08,1.43,1.42,2.32c0.34,0.89,0.51,1.84,0.51,2.85c0,1.03-0.18,1.99-0.53,2.89c-0.35,0.9-0.84,1.68-1.47,2.35
|
||||||
|
c-0.63,0.67-1.37,1.19-2.23,1.58c-0.86,0.39-1.78,0.58-2.77,0.58c-1.8,0-3.22-0.66-4.27-1.97V146H8.35v-22.43H13.24z M19.4,139.11
|
||||||
|
c0-0.43-0.08-0.84-0.24-1.23c-0.16-0.39-0.39-0.72-0.68-1.01c-0.29-0.29-0.62-0.52-1-0.69c-0.38-0.17-0.79-0.26-1.24-0.26
|
||||||
|
c-0.43,0-0.84,0.08-1.22,0.24c-0.38,0.16-0.71,0.39-0.99,0.68c-0.28,0.29-0.5,0.63-0.68,1.01c-0.17,0.39-0.26,0.8-0.26,1.23
|
||||||
|
c0,0.43,0.08,0.84,0.24,1.22c0.16,0.38,0.39,0.71,0.68,0.99c0.29,0.28,0.63,0.5,1.01,0.68c0.39,0.17,0.8,0.26,1.23,0.26
|
||||||
|
c0.43,0,0.84-0.08,1.22-0.24c0.38-0.16,0.71-0.39,0.99-0.68c0.28-0.29,0.5-0.62,0.68-1C19.32,139.92,19.4,139.52,19.4,139.11z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M44,48H4c-2.21,0-4-1.79-4-4V4c0-2.21,1.79-4,4-4h40c2.21,0,4,1.79,4,4v40C48,46.21,46.21,48,44,48z"/>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M28.48,12v10.44c1.18-1.27,2.65-1.9,4.42-1.9c1.05,0,2.01,0.2,2.89,0.61c0.87,0.41,1.62,0.96,2.24,1.65
|
||||||
|
c0.62,0.69,1.1,1.5,1.45,2.44c0.35,0.94,0.52,1.93,0.52,2.99c0,1.08-0.18,2.09-0.54,3.04c-0.36,0.95-0.86,1.77-1.51,2.47
|
||||||
|
c-0.64,0.7-1.4,1.25-2.28,1.66C34.8,35.8,33.86,36,32.84,36c-1.84,0-3.3-0.69-4.37-2.07v1.62h-5V12H28.48z M34.78,28.31
|
||||||
|
c0-0.45-0.08-0.88-0.25-1.29c-0.17-0.41-0.4-0.76-0.69-1.06c-0.3-0.3-0.64-0.54-1.02-0.72c-0.39-0.18-0.81-0.27-1.27-0.27
|
||||||
|
c-0.44,0-0.86,0.09-1.24,0.26c-0.39,0.17-0.72,0.41-1.01,0.71c-0.29,0.3-0.52,0.66-0.69,1.06c-0.18,0.41-0.26,0.84-0.26,1.29
|
||||||
|
s0.08,0.88,0.25,1.28c0.17,0.4,0.4,0.74,0.69,1.04c0.29,0.29,0.64,0.53,1.04,0.71c0.4,0.18,0.82,0.27,1.26,0.27
|
||||||
|
c0.44,0,0.86-0.09,1.24-0.26c0.39-0.17,0.72-0.41,1.01-0.71c0.29-0.3,0.52-0.65,0.69-1.05C34.69,29.16,34.78,28.75,34.78,28.31z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M13,12v10.44c1.18-1.27,2.65-1.9,4.42-1.9c1.05,0,2.01,0.2,2.89,0.61c0.87,0.41,1.62,0.96,2.24,1.65
|
||||||
|
c0.62,0.69,1.1,1.5,1.45,2.44c0.35,0.94,0.52,1.93,0.52,2.99c0,1.08-0.18,2.09-0.54,3.04c-0.36,0.95-0.86,1.77-1.51,2.47
|
||||||
|
c-0.64,0.7-1.4,1.25-2.28,1.66C19.32,35.8,18.38,36,17.37,36c-1.84,0-3.3-0.69-4.37-2.07v1.62H8V12H13z M19.3,28.31
|
||||||
|
c0-0.45-0.08-0.88-0.25-1.29c-0.17-0.41-0.4-0.76-0.69-1.06c-0.3-0.3-0.64-0.54-1.02-0.72c-0.39-0.18-0.81-0.27-1.27-0.27
|
||||||
|
c-0.44,0-0.86,0.09-1.24,0.26c-0.39,0.17-0.72,0.41-1.01,0.71c-0.29,0.3-0.52,0.66-0.69,1.06c-0.18,0.41-0.26,0.84-0.26,1.29
|
||||||
|
s0.08,0.88,0.25,1.28c0.17,0.4,0.4,0.74,0.69,1.04c0.29,0.29,0.64,0.53,1.04,0.71c0.4,0.18,0.82,0.27,1.26,0.27
|
||||||
|
c0.44,0,0.86-0.09,1.24-0.26c0.39-0.17,0.72-0.41,1.01-0.71c0.29-0.3,0.52-0.65,0.69-1.05C19.21,29.16,19.3,28.75,19.3,28.31z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 6.1 KiB |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.13",
|
"@budibase/bbui": "^0.9.21",
|
||||||
"@budibase/client": "^0.9.13",
|
"@budibase/client": "^0.9.21",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^0.9.13",
|
"@budibase/string-templates": "^0.9.21",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -291,7 +291,7 @@
|
||||||
/>
|
/>
|
||||||
{#if relationshipOptions && relationshipOptions.length > 0}
|
{#if relationshipOptions && relationshipOptions.length > 0}
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
disabled={originalName}
|
disabled={originalName != null}
|
||||||
label="Define the relationship"
|
label="Define the relationship"
|
||||||
bind:value={field.relationshipType}
|
bind:value={field.relationshipType}
|
||||||
options={relationshipOptions}
|
options={relationshipOptions}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Label, Input, Layout } from "@budibase/bbui"
|
import { Label, Input, Layout, Toggle } from "@budibase/bbui"
|
||||||
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
|
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@
|
||||||
defaults={schema[configKey].default}
|
defaults={schema[configKey].default}
|
||||||
bind:object={integration[configKey]}
|
bind:object={integration[configKey]}
|
||||||
/>
|
/>
|
||||||
|
{:else if schema[configKey].type === "boolean"}
|
||||||
|
<div class="form-row">
|
||||||
|
<Label>{capitalise(configKey)}</Label>
|
||||||
|
<Toggle text="" bind:value={integration[configKey]} />
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<Label>{capitalise(configKey)}</Label>
|
<Label>{capitalise(configKey)}</Label>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
import { admin } from "stores/portal"
|
import { admin } from "stores/portal"
|
||||||
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
let adminUser = {}
|
let adminUser = {}
|
||||||
let error
|
let error
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import RevertModal from "components/deploy/RevertModal.svelte"
|
import RevertModal from "components/deploy/RevertModal.svelte"
|
||||||
import { get } from "builderStore/api"
|
import { get } from "builderStore/api"
|
||||||
import { isActive, goto, layout } from "@roxi/routify"
|
import { isActive, goto, layout } from "@roxi/routify"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
|
||||||
// Get Package and set store
|
// Get Package and set store
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { apps, organisation, auth } from "stores/portal"
|
import { apps, organisation, auth } from "stores/portal"
|
||||||
import { goto } from "@roxi/routify"
|
import { goto, redirect } from "@roxi/routify"
|
||||||
import { AppStatus } from "constants"
|
import { AppStatus } from "constants"
|
||||||
import { gradient } from "actions"
|
import { gradient } from "actions"
|
||||||
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
||||||
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
let loaded = false
|
let loaded = false
|
||||||
let userInfoModal
|
let userInfoModal
|
||||||
|
@ -28,10 +28,17 @@
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await organisation.init()
|
await organisation.init()
|
||||||
await apps.load()
|
await apps.load()
|
||||||
loaded = true
|
// Skip the portal if you only have one app
|
||||||
|
if (!$auth.isBuilder && $apps.filter(publishedAppsOnly).length === 1) {
|
||||||
|
window.location = `/${publishedApps[0].prodId}`
|
||||||
|
} else {
|
||||||
|
loaded = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED)
|
const publishedAppsOnly = app => app.status === AppStatus.DEPLOYED
|
||||||
|
|
||||||
|
$: publishedApps = $apps.filter(publishedAppsOnly)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
// Check this onMount rather than a reactive statement to avoid trumping
|
// Check this onMount rather than a reactive statement to avoid trumping
|
||||||
// the login return URL functionality.
|
// the login return URL functionality.
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if ($auth.user) {
|
if ($auth.user && !$auth.user.forceResetPassword) {
|
||||||
$redirect("../")
|
$redirect("../")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !$auth.user}
|
{#if !$auth.user || $auth.user.forceResetPassword}
|
||||||
<slot />
|
<slot />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
Heading,
|
Heading,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { organisation, auth } from "stores/portal"
|
import { organisation, auth } from "stores/portal"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
let email = ""
|
let email = ""
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
import { goto, params } from "@roxi/routify"
|
import { goto, params } from "@roxi/routify"
|
||||||
import { auth } from "stores/portal"
|
import { auth } from "stores/portal"
|
||||||
import GoogleButton from "./_components/GoogleButton.svelte"
|
import GoogleButton from "./_components/GoogleButton.svelte"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
let username = ""
|
let username = ""
|
||||||
let password = ""
|
let password = ""
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { goto, params } from "@roxi/routify"
|
import { goto, params } from "@roxi/routify"
|
||||||
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
||||||
import { auth } from "stores/portal"
|
import { auth } from "stores/portal"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
const resetCode = $params["?code"]
|
const resetCode = $params["?code"]
|
||||||
let password, error
|
let password, error
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { goto, params } from "@roxi/routify"
|
import { goto, params } from "@roxi/routify"
|
||||||
import { users } from "stores/portal"
|
import { users } from "stores/portal"
|
||||||
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
const inviteCode = $params["?code"]
|
const inviteCode = $params["?code"]
|
||||||
let password, error
|
let password, error
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
||||||
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
||||||
import Logo from "assets/bb-space-black.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
|
||||||
let loaded = false
|
let loaded = false
|
||||||
let userInfoModal
|
let userInfoModal
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Mozilla Public License Version 2.0
|
Mozilla Public License Version 2.0
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
Copyright 2019-2021, Budibase Ltd
|
Copyright 2019-2021, Budibase Inc
|
||||||
|
|
||||||
1. Definitions
|
1. Definitions
|
||||||
--------------
|
--------------
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
|
@ -18,13 +18,13 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/string-templates": "^0.9.13",
|
"@budibase/string-templates": "^0.9.21",
|
||||||
"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.9.13",
|
"@budibase/standard-components": "^0.9.21",
|
||||||
"@rollup/plugin-commonjs": "^18.0.0",
|
"@rollup/plugin-commonjs": "^18.0.0",
|
||||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright 2019-2021, Budibase Ltd
|
Copyright 2019-2021, Budibase Inc
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
presets: [["@babel/preset-env", { targets: { node: "current" } }]],
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/electron.js",
|
"main": "src/electron.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -55,9 +55,9 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.13",
|
"@budibase/auth": "^0.9.21",
|
||||||
"@budibase/client": "^0.9.13",
|
"@budibase/client": "^0.9.21",
|
||||||
"@budibase/string-templates": "^0.9.13",
|
"@budibase/string-templates": "^0.9.21",
|
||||||
"@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",
|
||||||
|
@ -107,8 +107,11 @@
|
||||||
"zlib": "1.0.5"
|
"zlib": "1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@budibase/standard-components": "^0.9.13",
|
"@babel/core": "^7.14.3",
|
||||||
|
"@babel/preset-env": "^7.14.4",
|
||||||
|
"@budibase/standard-components": "^0.9.21",
|
||||||
"@jest/test-sequencer": "^24.8.0",
|
"@jest/test-sequencer": "^24.8.0",
|
||||||
|
"babel-jest": "^27.0.2",
|
||||||
"docker-compose": "^0.23.6",
|
"docker-compose": "^0.23.6",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
|
|
@ -27,7 +27,10 @@ const { cloneDeep } = require("lodash/fp")
|
||||||
const { processObject } = require("@budibase/string-templates")
|
const { processObject } = require("@budibase/string-templates")
|
||||||
const { getAllApps } = require("../../utilities")
|
const { getAllApps } = require("../../utilities")
|
||||||
const { USERS_TABLE_SCHEMA } = require("../../constants")
|
const { USERS_TABLE_SCHEMA } = require("../../constants")
|
||||||
const { getDeployedApps } = require("../../utilities/workerRequests")
|
const {
|
||||||
|
getDeployedApps,
|
||||||
|
removeAppFromUserRoles,
|
||||||
|
} = require("../../utilities/workerRequests")
|
||||||
const { clientLibraryPath } = require("../../utilities")
|
const { clientLibraryPath } = require("../../utilities")
|
||||||
const { getAllLocks } = require("../../utilities/redis")
|
const { getAllLocks } = require("../../utilities/redis")
|
||||||
|
|
||||||
|
@ -101,6 +104,7 @@ async function createInstance(template) {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
throw "Error loading database dump from template."
|
throw "Error loading database dump from template."
|
||||||
}
|
}
|
||||||
|
var { _rev } = await db.get(DocumentTypes.APP_METADATA)
|
||||||
} else {
|
} else {
|
||||||
// create the users table
|
// create the users table
|
||||||
await db.put(USERS_TABLE_SCHEMA)
|
await db.put(USERS_TABLE_SCHEMA)
|
||||||
|
@ -111,7 +115,7 @@ async function createInstance(template) {
|
||||||
await createRoutingView(appId)
|
await createRoutingView(appId)
|
||||||
await createAllSearchIndex(appId)
|
await createAllSearchIndex(appId)
|
||||||
|
|
||||||
return { _id: appId }
|
return { _id: appId, _rev }
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.fetch = async function (ctx) {
|
exports.fetch = async function (ctx) {
|
||||||
|
@ -197,6 +201,9 @@ exports.create = async function (ctx) {
|
||||||
type: "cloud",
|
type: "cloud",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if (instance._rev) {
|
||||||
|
newApplication._rev = instance._rev
|
||||||
|
}
|
||||||
const instanceDb = new CouchDB(appId)
|
const instanceDb = new CouchDB(appId)
|
||||||
await instanceDb.put(newApplication)
|
await instanceDb.put(newApplication)
|
||||||
|
|
||||||
|
@ -241,6 +248,8 @@ exports.delete = async function (ctx) {
|
||||||
if (!env.isTest()) {
|
if (!env.isTest()) {
|
||||||
await deleteApp(ctx.params.appId)
|
await deleteApp(ctx.params.appId)
|
||||||
}
|
}
|
||||||
|
// make sure the app/role doesn't stick around after the app has been deleted
|
||||||
|
await removeAppFromUserRoles(ctx.params.appId)
|
||||||
|
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
ctx.body = result
|
ctx.body = result
|
||||||
|
|
|
@ -4,6 +4,7 @@ const {
|
||||||
getDatasourceParams,
|
getDatasourceParams,
|
||||||
getQueryParams,
|
getQueryParams,
|
||||||
} = require("../../db/utils")
|
} = require("../../db/utils")
|
||||||
|
const { integrations } = require("../../integrations")
|
||||||
|
|
||||||
exports.fetch = async function (ctx) {
|
exports.fetch = async function (ctx) {
|
||||||
const database = new CouchDB(ctx.appId)
|
const database = new CouchDB(ctx.appId)
|
||||||
|
@ -28,6 +29,12 @@ exports.save = async function (ctx) {
|
||||||
const response = await db.post(datasource)
|
const response = await db.post(datasource)
|
||||||
datasource._rev = response.rev
|
datasource._rev = response.rev
|
||||||
|
|
||||||
|
// Drain connection pools when configuration is changed
|
||||||
|
const source = integrations[datasource.source]
|
||||||
|
if (source && source.pool) {
|
||||||
|
await source.pool.end()
|
||||||
|
}
|
||||||
|
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
ctx.message = "Datasource saved successfully."
|
ctx.message = "Datasource saved successfully."
|
||||||
ctx.body = datasource
|
ctx.body = datasource
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
const Router = require("@koa/router")
|
const Router = require("@koa/router")
|
||||||
const authorized = require("../../middleware/authorized")
|
|
||||||
const controller = require("../controllers/analytics")
|
const controller = require("../controllers/analytics")
|
||||||
const { BUILDER } = require("@budibase/auth/permissions")
|
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
router.get("/api/analytics", authorized(BUILDER), controller.isEnabled)
|
router.get("/api/analytics", controller.isEnabled)
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|
|
@ -7,12 +7,8 @@ const router = Router()
|
||||||
|
|
||||||
router
|
router
|
||||||
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
||||||
.get("/api/applications", authorized(BUILDER), controller.fetch)
|
.get("/api/applications", controller.fetch)
|
||||||
.get(
|
.get("/api/applications/:appId/appPackage", controller.fetchAppPackage)
|
||||||
"/api/applications/:appId/appPackage",
|
|
||||||
authorized(BUILDER),
|
|
||||||
controller.fetchAppPackage
|
|
||||||
)
|
|
||||||
.put("/api/applications/:appId", authorized(BUILDER), controller.update)
|
.put("/api/applications/:appId", authorized(BUILDER), controller.update)
|
||||||
.post("/api/applications", authorized(BUILDER), controller.create)
|
.post("/api/applications", authorized(BUILDER), controller.create)
|
||||||
.delete("/api/applications/:appId", authorized(BUILDER), controller.delete)
|
.delete("/api/applications/:appId", authorized(BUILDER), controller.delete)
|
||||||
|
|
|
@ -61,14 +61,6 @@ describe("/applications", () => {
|
||||||
// two created apps + the inited app
|
// two created apps + the inited app
|
||||||
expect(res.body.length).toBe(3)
|
expect(res.body.length).toBe(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should apply authorization to endpoint", async () => {
|
|
||||||
await checkBuilderEndpoint({
|
|
||||||
config,
|
|
||||||
method: "GET",
|
|
||||||
url: `/api/applications`,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("fetchAppDefinition", () => {
|
describe("fetchAppDefinition", () => {
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||||
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
||||||
const setup = require("./utilities")
|
const setup = require("./utilities")
|
||||||
const { basicUser } = setup.structures
|
|
||||||
const workerRequests = require("../../../utilities/workerRequests")
|
const workerRequests = require("../../../utilities/workerRequests")
|
||||||
|
|
||||||
jest.mock("../../../utilities/workerRequests", () => ({
|
jest.mock("../../../utilities/workerRequests", () => ({
|
||||||
getGlobalUsers: jest.fn(() => {
|
getGlobalUsers: jest.fn(() => {
|
||||||
return {}
|
return {}
|
||||||
}),
|
}),
|
||||||
|
getGlobalSelf: jest.fn(() => {
|
||||||
|
return {}
|
||||||
|
}),
|
||||||
addAppRoleToUser: jest.fn(),
|
addAppRoleToUser: jest.fn(),
|
||||||
deleteGlobalUser: jest.fn(),
|
deleteGlobalUser: jest.fn(),
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -8,6 +8,12 @@ jest.mock("../../../../utilities/workerRequests", () => ({
|
||||||
_id: "us_uuid1",
|
_id: "us_uuid1",
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
getGlobalSelf: jest.fn(() => {
|
||||||
|
return {
|
||||||
|
_id: "us_uuid1",
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
removeAppFromUserRoles: jest.fn(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
exports.delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
exports.delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
|
@ -6,6 +6,7 @@ exports.QUERY_TYPES = {
|
||||||
|
|
||||||
exports.FIELD_TYPES = {
|
exports.FIELD_TYPES = {
|
||||||
STRING: "string",
|
STRING: "string",
|
||||||
|
BOOLEAN: "boolean",
|
||||||
NUMBER: "number",
|
NUMBER: "number",
|
||||||
PASSWORD: "password",
|
PASSWORD: "password",
|
||||||
LIST: "list",
|
LIST: "list",
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
const sqlServer = require("mssql")
|
const sqlServer = require("mssql")
|
||||||
const { FIELD_TYPES } = require("./Integration")
|
const { FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
let pool
|
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
docs: "https://github.com/tediousjs/node-mssql",
|
docs: "https://github.com/tediousjs/node-mssql",
|
||||||
description:
|
description:
|
||||||
|
@ -31,6 +29,10 @@ const SCHEMA = {
|
||||||
type: FIELD_TYPES.STRING,
|
type: FIELD_TYPES.STRING,
|
||||||
default: "root",
|
default: "root",
|
||||||
},
|
},
|
||||||
|
encrypt: {
|
||||||
|
type: FIELD_TYPES.BOOLEAN,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
create: {
|
create: {
|
||||||
|
@ -49,15 +51,21 @@ const SCHEMA = {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SqlServerIntegration {
|
class SqlServerIntegration {
|
||||||
|
static pool
|
||||||
|
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.config = config
|
this.config = config
|
||||||
if (!pool) {
|
this.config.options = {
|
||||||
pool = new sqlServer.ConnectionPool(this.config)
|
encrypt: this.config.encrypt,
|
||||||
|
}
|
||||||
|
delete this.config.encrypt
|
||||||
|
if (!this.pool) {
|
||||||
|
this.pool = new sqlServer.ConnectionPool(this.config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
const client = await pool.connect()
|
const client = await this.pool.connect()
|
||||||
this.client = client.request()
|
this.client = client.request()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
const { Pool } = require("pg")
|
const { Pool } = require("pg")
|
||||||
const { FIELD_TYPES } = require("./Integration")
|
const { FIELD_TYPES } = require("./Integration")
|
||||||
|
|
||||||
let pool
|
|
||||||
|
|
||||||
const SCHEMA = {
|
const SCHEMA = {
|
||||||
docs: "https://node-postgres.com",
|
docs: "https://node-postgres.com",
|
||||||
friendlyName: "PostgreSQL",
|
friendlyName: "PostgreSQL",
|
||||||
|
@ -35,7 +33,8 @@ const SCHEMA = {
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
ssl: {
|
ssl: {
|
||||||
type: FIELD_TYPES.OBJECT,
|
type: FIELD_TYPES.BOOLEAN,
|
||||||
|
default: false,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -56,28 +55,28 @@ const SCHEMA = {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PostgresIntegration {
|
class PostgresIntegration {
|
||||||
|
static pool
|
||||||
|
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.config = config
|
this.config = config
|
||||||
if (this.config.ssl.rejectUnauthorized) {
|
if (this.config.ssl) {
|
||||||
this.config.ssl.rejectUnauthorized =
|
this.config.ssl = {
|
||||||
this.config.ssl.rejectUnauthorized === "true" ? true : false
|
rejectUnauthorized: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pool) {
|
if (!this.pool) {
|
||||||
pool = new Pool(this.config)
|
this.pool = new Pool(this.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.client = this.pool
|
||||||
}
|
}
|
||||||
|
|
||||||
async query(sql) {
|
async query(sql) {
|
||||||
try {
|
try {
|
||||||
this.client = await pool.connect()
|
|
||||||
return await this.client.query(sql)
|
return await this.client.query(sql)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(err)
|
throw new Error(err)
|
||||||
} finally {
|
|
||||||
if (this.client) {
|
|
||||||
this.client.release()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ const SCHEMA = {
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
create: {
|
create: {
|
||||||
|
readable: true,
|
||||||
displayName: "POST",
|
displayName: "POST",
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
urlDisplay: true,
|
urlDisplay: true,
|
||||||
|
@ -40,6 +41,7 @@ const SCHEMA = {
|
||||||
},
|
},
|
||||||
read: {
|
read: {
|
||||||
displayName: "GET",
|
displayName: "GET",
|
||||||
|
readable: true,
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
urlDisplay: true,
|
urlDisplay: true,
|
||||||
fields: {
|
fields: {
|
||||||
|
@ -56,6 +58,7 @@ const SCHEMA = {
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
displayName: "PUT",
|
displayName: "PUT",
|
||||||
|
readable: true,
|
||||||
type: QUERY_TYPES.FIELDS,
|
type: QUERY_TYPES.FIELDS,
|
||||||
urlDisplay: true,
|
urlDisplay: true,
|
||||||
fields: {
|
fields: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { getAppId, setCookie, getCookie } = require("@budibase/auth").utils
|
const { getAppId, setCookie, getCookie } = require("@budibase/auth").utils
|
||||||
const { Cookies } = require("@budibase/auth").constants
|
const { Cookies } = require("@budibase/auth").constants
|
||||||
const { getRole } = require("@budibase/auth/roles")
|
const { getRole } = require("@budibase/auth/roles")
|
||||||
const { getGlobalUsers } = require("../utilities/workerRequests")
|
const { getGlobalSelf } = require("../utilities/workerRequests")
|
||||||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||||
const { generateUserMetadataID } = require("../db/utils")
|
const { generateUserMetadataID } = require("../db/utils")
|
||||||
|
|
||||||
|
@ -25,10 +25,11 @@ module.exports = async (ctx, next) => {
|
||||||
requestAppId != null &&
|
requestAppId != null &&
|
||||||
(appCookie == null ||
|
(appCookie == null ||
|
||||||
requestAppId !== appCookie.appId ||
|
requestAppId !== appCookie.appId ||
|
||||||
appCookie.roleId === BUILTIN_ROLE_IDS.PUBLIC)
|
appCookie.roleId === BUILTIN_ROLE_IDS.PUBLIC ||
|
||||||
|
!appCookie.roleId)
|
||||||
) {
|
) {
|
||||||
// Different App ID means cookie needs reset, or if the same public user has logged in
|
// Different App ID means cookie needs reset, or if the same public user has logged in
|
||||||
const globalUser = await getGlobalUsers(ctx, requestAppId, ctx.user._id)
|
const globalUser = await getGlobalSelf(ctx, requestAppId)
|
||||||
updateCookie = true
|
updateCookie = true
|
||||||
appId = requestAppId
|
appId = requestAppId
|
||||||
// retrieving global user gets the right role
|
// retrieving global user gets the right role
|
||||||
|
@ -51,6 +52,7 @@ module.exports = async (ctx, next) => {
|
||||||
// override userID with metadata one
|
// override userID with metadata one
|
||||||
_id: userId,
|
_id: userId,
|
||||||
userId,
|
userId,
|
||||||
|
roleId,
|
||||||
role: await getRole(appId, roleId),
|
role: await getRole(appId, roleId),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ jest.mock("../../environment", () => ({
|
||||||
prod: false,
|
prod: false,
|
||||||
isTest: () => true,
|
isTest: () => true,
|
||||||
isProd: () => this.prod,
|
isProd: () => this.prod,
|
||||||
_set: (key, value) => {
|
_set: function(key, value) {
|
||||||
this.prod = value === "production"
|
this.prod = value === "production"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,7 @@ mockWorker()
|
||||||
|
|
||||||
function mockWorker() {
|
function mockWorker() {
|
||||||
jest.mock("../../utilities/workerRequests", () => ({
|
jest.mock("../../utilities/workerRequests", () => ({
|
||||||
getGlobalUsers: () => {
|
getGlobalSelf: () => {
|
||||||
return {
|
return {
|
||||||
_id: "us_uuid1",
|
_id: "us_uuid1",
|
||||||
roles: {
|
roles: {
|
||||||
|
|
|
@ -91,7 +91,7 @@ describe("resourceId middleware", () => {
|
||||||
.mainResource("custom")
|
.mainResource("custom")
|
||||||
.subResource("customSub")
|
.subResource("customSub")
|
||||||
.build()
|
.build()
|
||||||
config = new TestConfiguration(middleware)
|
let config = new TestConfiguration(middleware)
|
||||||
config.setBody({
|
config.setBody({
|
||||||
custom: "test",
|
custom: "test",
|
||||||
customSub: "subtest"
|
customSub: "subtest"
|
||||||
|
|
|
@ -9,7 +9,8 @@ function getAppRole(appId, user) {
|
||||||
if (!user.roles) {
|
if (!user.roles) {
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
user.roleId = user.roles[appId]
|
// always use the deployed app
|
||||||
|
user.roleId = user.roles[getDeployedAppID(appId)]
|
||||||
if (!user.roleId) {
|
if (!user.roleId) {
|
||||||
user.roleId = BUILTIN_ROLE_IDS.PUBLIC
|
user.roleId = BUILTIN_ROLE_IDS.PUBLIC
|
||||||
}
|
}
|
||||||
|
@ -56,11 +57,10 @@ exports.sendSmtpEmail = async (to, from, subject, contents) => {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
const json = await response.json()
|
if (response.status !== 200) {
|
||||||
if (json.status !== 200 && response.status !== 200) {
|
|
||||||
throw "Unable to send email."
|
throw "Unable to send email."
|
||||||
}
|
}
|
||||||
return json
|
return response.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getDeployedApps = async ctx => {
|
exports.getDeployedApps = async ctx => {
|
||||||
|
@ -97,8 +97,6 @@ exports.deleteGlobalUser = async (ctx, globalId) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getGlobalUsers = async (ctx, appId = null, globalId = null) => {
|
exports.getGlobalUsers = async (ctx, appId = null, globalId = null) => {
|
||||||
// always use the deployed app
|
|
||||||
appId = getDeployedAppID(appId)
|
|
||||||
const endpoint = globalId
|
const endpoint = globalId
|
||||||
? `/api/admin/users/${globalId}`
|
? `/api/admin/users/${globalId}`
|
||||||
: `/api/admin/users`
|
: `/api/admin/users`
|
||||||
|
@ -119,21 +117,23 @@ exports.getGlobalUsers = async (ctx, appId = null, globalId = null) => {
|
||||||
return users
|
return users
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getGlobalSelf = async ctx => {
|
exports.getGlobalSelf = async (ctx, appId = null) => {
|
||||||
const endpoint = `/api/admin/users/self`
|
const endpoint = `/api/admin/users/self`
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
checkSlashesInUrl(env.WORKER_URL + endpoint),
|
checkSlashesInUrl(env.WORKER_URL + endpoint),
|
||||||
request(ctx, { method: "GET" })
|
request(ctx, { method: "GET" })
|
||||||
)
|
)
|
||||||
const json = await response.json()
|
if (response.status !== 200) {
|
||||||
if (json.status !== 200 && response.status !== 200) {
|
|
||||||
ctx.throw(400, "Unable to get self globally.")
|
ctx.throw(400, "Unable to get self globally.")
|
||||||
}
|
}
|
||||||
|
let json = await response.json()
|
||||||
|
if (appId) {
|
||||||
|
json = getAppRole(appId, json)
|
||||||
|
}
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
|
exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
|
||||||
appId = getDeployedAppID(appId)
|
|
||||||
let user,
|
let user,
|
||||||
endpoint,
|
endpoint,
|
||||||
body = {}
|
body = {}
|
||||||
|
@ -150,7 +150,7 @@ exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
|
||||||
...body,
|
...body,
|
||||||
roles: {
|
roles: {
|
||||||
...user.roles,
|
...user.roles,
|
||||||
[appId]: roleId,
|
[getDeployedAppID(appId)]: roleId,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
|
@ -160,9 +160,25 @@ exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
|
||||||
body,
|
body,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
const json = await response.json()
|
if (response.status !== 200) {
|
||||||
if (json.status !== 200 && response.status !== 200) {
|
|
||||||
ctx.throw(400, "Unable to save self globally.")
|
ctx.throw(400, "Unable to save self globally.")
|
||||||
}
|
}
|
||||||
return json
|
return response.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.removeAppFromUserRoles = async appId => {
|
||||||
|
const deployedAppId = getDeployedAppID(appId)
|
||||||
|
const response = await fetch(
|
||||||
|
checkSlashesInUrl(env.WORKER_URL + `/api/admin/roles/${deployedAppId}`),
|
||||||
|
request(null, {
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
"x-budibase-api-key": env.INTERNAL_API_KEY,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
if (response.status !== 200) {
|
||||||
|
throw "Unable to remove app role"
|
||||||
|
}
|
||||||
|
return response.json()
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
Mozilla Public License Version 2.0
|
Mozilla Public License Version 2.0
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
Copyright 2019-2021, Budibase Ltd
|
Copyright 2019-2021, Budibase Inc
|
||||||
|
|
||||||
1. Definitions
|
1. Definitions
|
||||||
--------------
|
--------------
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"svelte"
|
"svelte"
|
||||||
],
|
],
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
|
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.13",
|
"@budibase/bbui": "^0.9.21",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
"apexcharts": "^3.22.1",
|
"apexcharts": "^3.22.1",
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
const { authStore, linkable, styleable, builderStore } = getContext("sdk")
|
const { authStore, linkable, styleable, builderStore } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
|
||||||
|
// BB emblem: https://i.imgur.com/Xhdt1YP.png
|
||||||
|
// Space logo: https://i.imgur.com/Dn7Xt1G.png
|
||||||
|
|
||||||
export let logoUrl
|
export let logoUrl
|
||||||
export let hideLogo
|
export let hideLogo
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,7 +18,7 @@
|
||||||
<img
|
<img
|
||||||
class="logo"
|
class="logo"
|
||||||
alt="logo"
|
alt="logo"
|
||||||
src={logoUrl || "https://i.imgur.com/Dn7Xt1G.png"}
|
src={logoUrl || "https://i.imgur.com/Xhdt1YP.png"}
|
||||||
height="48"
|
height="48"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -77,6 +77,9 @@ const lengthConstraint = maxLength => value => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const numericalConstraint = (constraint, error) => value => {
|
const numericalConstraint = (constraint, error) => value => {
|
||||||
|
if (value == null || value === "") {
|
||||||
|
return null
|
||||||
|
}
|
||||||
if (isNaN(value)) {
|
if (isNaN(value)) {
|
||||||
return "Must be a number"
|
return "Must be a number"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.cjs",
|
"main": "src/index.cjs",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
|
|
|
@ -2,6 +2,7 @@ const dayjs = require("dayjs")
|
||||||
dayjs.extend(require("dayjs/plugin/duration"))
|
dayjs.extend(require("dayjs/plugin/duration"))
|
||||||
dayjs.extend(require("dayjs/plugin/advancedFormat"))
|
dayjs.extend(require("dayjs/plugin/advancedFormat"))
|
||||||
dayjs.extend(require("dayjs/plugin/relativeTime"))
|
dayjs.extend(require("dayjs/plugin/relativeTime"))
|
||||||
|
dayjs.extend(require("dayjs/plugin/utc"))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was largely taken from the helper-date package - we did this for two reasons:
|
* This file was largely taken from the helper-date package - we did this for two reasons:
|
||||||
|
@ -88,7 +89,11 @@ module.exports.date = (str, pattern, options) => {
|
||||||
|
|
||||||
setLocale(config.str, config.pattern, config.options)
|
setLocale(config.str, config.pattern, config.options)
|
||||||
|
|
||||||
return dayjs(new Date(config.str)).format(config.pattern)
|
const date = dayjs(new Date(config.str)).utc()
|
||||||
|
if (config.pattern === "") {
|
||||||
|
return date.toISOString()
|
||||||
|
}
|
||||||
|
return date.format(config.pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.duration = (str, pattern, format) => {
|
module.exports.duration = (str, pattern, format) => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Postprocessor {
|
||||||
|
|
||||||
module.exports.processors = [
|
module.exports.processors = [
|
||||||
new Postprocessor(PostProcessorNames.CONVERT_LITERALS, statement => {
|
new Postprocessor(PostProcessorNames.CONVERT_LITERALS, statement => {
|
||||||
if (!statement.includes(LITERAL_MARKER)) {
|
if (typeof statement !== "string" || !statement.includes(LITERAL_MARKER)) {
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
const splitMarkerIndex = statement.indexOf("-")
|
const splitMarkerIndex = statement.indexOf("-")
|
||||||
|
|
|
@ -0,0 +1,305 @@
|
||||||
|
{
|
||||||
|
"user":{
|
||||||
|
"_id":"ro_ta_users_us_b0bc7ba0ce304294accc1ced8165dd23",
|
||||||
|
"_rev":"1-e9199d92e7286005a9c11c614fdbcc51",
|
||||||
|
"email":"test2@test.com",
|
||||||
|
"status":"active",
|
||||||
|
"roleId":"PUBLIC",
|
||||||
|
"test-Created By_text":"",
|
||||||
|
"test-Updated By_text":""
|
||||||
|
},
|
||||||
|
"closestComponentId":"c670254c9e74e40518ee5becff53aa5be",
|
||||||
|
"url":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"c670254c9e74e40518ee5becff53aa5be":{
|
||||||
|
"rows":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_1399af8a08d244a9885c674dd5555c84_8c1940e906254db5ac79c51011255d6c",
|
||||||
|
"_rev":"1-49ff5a4094a251a7767155eb85f4c9b7",
|
||||||
|
"sef":"sefesfesf",
|
||||||
|
"Name":"sefesf",
|
||||||
|
"tableId":"ta_1399af8a08d244a9885c674dd5555c84",
|
||||||
|
"Auto ID":1,
|
||||||
|
"Created At":"2021-05-27T10:30:37.386Z",
|
||||||
|
"Updated At":"2021-05-27T10:30:37.386Z",
|
||||||
|
"type":"row",
|
||||||
|
"Created By":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_users_us_de1bd7fe710146db990d92845008c763"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Updated By":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_users_us_de1bd7fe710146db990d92845008c763"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testing":"2",
|
||||||
|
"Created By_text":"",
|
||||||
|
"Updated By_text":""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schema":{
|
||||||
|
"Auto ID":{
|
||||||
|
"name":"Auto ID",
|
||||||
|
"type":"number",
|
||||||
|
"subtype":"autoID",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"number",
|
||||||
|
"presence":false,
|
||||||
|
"numericality":{
|
||||||
|
"greaterThanOrEqualTo":"",
|
||||||
|
"lessThanOrEqualTo":""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lastID":1
|
||||||
|
},
|
||||||
|
"Created By":{
|
||||||
|
"name":"Created By",
|
||||||
|
"type":"link",
|
||||||
|
"subtype":"createdBy",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"array",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"tableId":"ta_users",
|
||||||
|
"fieldName":"test-Created By",
|
||||||
|
"relationshipType":"many-to-many"
|
||||||
|
},
|
||||||
|
"Created At":{
|
||||||
|
"name":"Created At",
|
||||||
|
"type":"datetime",
|
||||||
|
"subtype":"createdAt",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"presence":false,
|
||||||
|
"datetime":{
|
||||||
|
"latest":"",
|
||||||
|
"earliest":""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Updated By":{
|
||||||
|
"name":"Updated By",
|
||||||
|
"type":"link",
|
||||||
|
"subtype":"updatedBy",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"array",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"tableId":"ta_users",
|
||||||
|
"fieldName":"test-Updated By",
|
||||||
|
"relationshipType":"many-to-many"
|
||||||
|
},
|
||||||
|
"Updated At":{
|
||||||
|
"name":"Updated At",
|
||||||
|
"type":"datetime",
|
||||||
|
"subtype":"updatedAt",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"presence":false,
|
||||||
|
"datetime":{
|
||||||
|
"latest":"",
|
||||||
|
"earliest":""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Name":{
|
||||||
|
"type":"string",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
"maximum":null
|
||||||
|
},
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"Name"
|
||||||
|
},
|
||||||
|
"sef":{
|
||||||
|
"type":"string",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
"maximum":null
|
||||||
|
},
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"sef"
|
||||||
|
},
|
||||||
|
"testing":{
|
||||||
|
"type":"formula",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"testing",
|
||||||
|
"formula":"{{ add [Auto ID] 1 }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rowsLength":1
|
||||||
|
},
|
||||||
|
"data":{
|
||||||
|
"rows":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_1399af8a08d244a9885c674dd5555c84_8c1940e906254db5ac79c51011255d6c",
|
||||||
|
"_rev":"1-49ff5a4094a251a7767155eb85f4c9b7",
|
||||||
|
"sef":"sefesfesf",
|
||||||
|
"Name":"sefesf",
|
||||||
|
"tableId":"ta_1399af8a08d244a9885c674dd5555c84",
|
||||||
|
"Auto ID":1,
|
||||||
|
"Created At":"2021-05-27T10:30:37.386Z",
|
||||||
|
"Updated At":"2021-05-27T10:30:37.386Z",
|
||||||
|
"type":"row",
|
||||||
|
"Created By":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_users_us_de1bd7fe710146db990d92845008c763"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Updated By":[
|
||||||
|
{
|
||||||
|
"_id":"ro_ta_users_us_de1bd7fe710146db990d92845008c763"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testing":"2",
|
||||||
|
"Created By_text":"",
|
||||||
|
"Updated By_text":""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schema":{
|
||||||
|
"Auto ID":{
|
||||||
|
"name":"Auto ID",
|
||||||
|
"type":"number",
|
||||||
|
"subtype":"autoID",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"number",
|
||||||
|
"presence":false,
|
||||||
|
"numericality":{
|
||||||
|
"greaterThanOrEqualTo":"",
|
||||||
|
"lessThanOrEqualTo":""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lastID":1
|
||||||
|
},
|
||||||
|
"Created By":{
|
||||||
|
"name":"Created By",
|
||||||
|
"type":"link",
|
||||||
|
"subtype":"createdBy",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"array",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"tableId":"ta_users",
|
||||||
|
"fieldName":"test-Created By",
|
||||||
|
"relationshipType":"many-to-many"
|
||||||
|
},
|
||||||
|
"Created At":{
|
||||||
|
"name":"Created At",
|
||||||
|
"type":"datetime",
|
||||||
|
"subtype":"createdAt",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"presence":false,
|
||||||
|
"datetime":{
|
||||||
|
"latest":"",
|
||||||
|
"earliest":""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Updated By":{
|
||||||
|
"name":"Updated By",
|
||||||
|
"type":"link",
|
||||||
|
"subtype":"updatedBy",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"array",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"tableId":"ta_users",
|
||||||
|
"fieldName":"test-Updated By",
|
||||||
|
"relationshipType":"many-to-many"
|
||||||
|
},
|
||||||
|
"Updated At":{
|
||||||
|
"name":"Updated At",
|
||||||
|
"type":"datetime",
|
||||||
|
"subtype":"updatedAt",
|
||||||
|
"icon":"ri-magic-line",
|
||||||
|
"autocolumn":true,
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"presence":false,
|
||||||
|
"datetime":{
|
||||||
|
"latest":"",
|
||||||
|
"earliest":""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Name":{
|
||||||
|
"type":"string",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
"maximum":null
|
||||||
|
},
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"Name"
|
||||||
|
},
|
||||||
|
"sef":{
|
||||||
|
"type":"string",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"length":{
|
||||||
|
"maximum":null
|
||||||
|
},
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"sef"
|
||||||
|
},
|
||||||
|
"testing":{
|
||||||
|
"type":"formula",
|
||||||
|
"constraints":{
|
||||||
|
"type":"string",
|
||||||
|
"presence":false
|
||||||
|
},
|
||||||
|
"fieldName":"test",
|
||||||
|
"name":"testing",
|
||||||
|
"formula":"{{ add [Auto ID] 1 }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rowsLength":1
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
const { processString, processObject, isValid } = require("../src/index.cjs")
|
const { processString, processObject, isValid } = require("../src/index.cjs")
|
||||||
|
const tableJson = require("./examples/table.json")
|
||||||
|
|
||||||
describe("test the custom helpers we have applied", () => {
|
describe("test the custom helpers we have applied", () => {
|
||||||
it("should be able to use the object helper", async () => {
|
it("should be able to use the object helper", async () => {
|
||||||
|
@ -355,6 +356,15 @@ describe("Cover a few complex use cases", () => {
|
||||||
expect(validity).toBe(true)
|
expect(validity).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should test a case of attempting to get a UTC ISO back out after processing", async () => {
|
||||||
|
const date = new Date()
|
||||||
|
const input = `{{ date (subtract (date dateThing "x") 300000) "" }}`
|
||||||
|
const output = await processString(input, {
|
||||||
|
dateThing: date.toISOString(),
|
||||||
|
})
|
||||||
|
expect(output).toEqual(new Date(date.getTime() - 300000).toISOString())
|
||||||
|
})
|
||||||
|
|
||||||
it("test a very complex duration output", async () => {
|
it("test a very complex duration output", async () => {
|
||||||
const currentTime = new Date(1612432082000).toISOString(),
|
const currentTime = new Date(1612432082000).toISOString(),
|
||||||
eventTime = new Date(1612432071000).toISOString()
|
eventTime = new Date(1612432071000).toISOString()
|
||||||
|
@ -388,4 +398,17 @@ describe("Cover a few complex use cases", () => {
|
||||||
const output = await processObject(input, context)
|
const output = await processObject(input, context)
|
||||||
expect(output.text).toBe("12-01")
|
expect(output.text).toBe("12-01")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should only invalidate a single string in an object", async () => {
|
||||||
|
const input = {
|
||||||
|
dataProvider:"{{ literal [c670254c9e74e40518ee5becff53aa5be] }}",
|
||||||
|
theme:"spectrum--lightest",
|
||||||
|
showAutoColumns:false,
|
||||||
|
quiet:true,
|
||||||
|
size:"spectrum--medium",
|
||||||
|
rowCount:8,
|
||||||
|
}
|
||||||
|
const output = await processObject(input, tableJson)
|
||||||
|
expect(output.dataProvider).not.toBe("Invalid Binding")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.13",
|
"version": "0.9.21",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.13",
|
"@budibase/auth": "^0.9.21",
|
||||||
"@budibase/string-templates": "^0.9.13",
|
"@budibase/string-templates": "^0.9.21",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"aws-sdk": "^2.811.0",
|
"aws-sdk": "^2.811.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
|
|
|
@ -11,6 +11,16 @@ const { sendEmail } = require("../../../utilities/email")
|
||||||
|
|
||||||
const GLOBAL_DB = StaticDatabases.GLOBAL.name
|
const GLOBAL_DB = StaticDatabases.GLOBAL.name
|
||||||
|
|
||||||
|
async function allUsers() {
|
||||||
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
|
const response = await db.allDocs(
|
||||||
|
getGlobalUserParams(null, {
|
||||||
|
include_docs: true,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return response.rows.map(row => row.doc)
|
||||||
|
}
|
||||||
|
|
||||||
exports.save = async ctx => {
|
exports.save = async ctx => {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
const { email, password, _id } = ctx.request.body
|
const { email, password, _id } = ctx.request.body
|
||||||
|
@ -105,6 +115,23 @@ exports.destroy = async ctx => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.removeAppRole = async ctx => {
|
||||||
|
const { appId } = ctx.params
|
||||||
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
|
const users = await allUsers()
|
||||||
|
const bulk = []
|
||||||
|
for (let user of users) {
|
||||||
|
if (user.roles[appId]) {
|
||||||
|
delete user.roles[appId]
|
||||||
|
bulk.push(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await db.bulkDocs(bulk)
|
||||||
|
ctx.body = {
|
||||||
|
message: "App role removed from all users",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.getSelf = async ctx => {
|
exports.getSelf = async ctx => {
|
||||||
ctx.params = {
|
ctx.params = {
|
||||||
id: ctx.user._id,
|
id: ctx.user._id,
|
||||||
|
@ -134,13 +161,7 @@ exports.updateSelf = async ctx => {
|
||||||
|
|
||||||
// called internally by app server user fetch
|
// called internally by app server user fetch
|
||||||
exports.fetch = async ctx => {
|
exports.fetch = async ctx => {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const users = await allUsers()
|
||||||
const response = await db.allDocs(
|
|
||||||
getGlobalUserParams(null, {
|
|
||||||
include_docs: true,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
const users = response.rows.map(row => row.doc)
|
|
||||||
// user hashed password shouldn't ever be returned
|
// user hashed password shouldn't ever be returned
|
||||||
for (let user of users) {
|
for (let user of users) {
|
||||||
if (user) {
|
if (user) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ router
|
||||||
controller.save
|
controller.save
|
||||||
)
|
)
|
||||||
.get("/api/admin/users", adminOnly, controller.fetch)
|
.get("/api/admin/users", adminOnly, controller.fetch)
|
||||||
|
.delete("/api/admin/roles/:appId", adminOnly, controller.removeAppRole)
|
||||||
.delete("/api/admin/users/:id", adminOnly, controller.destroy)
|
.delete("/api/admin/users/:id", adminOnly, controller.destroy)
|
||||||
.get("/api/admin/roles/:appId")
|
.get("/api/admin/roles/:appId")
|
||||||
.post(
|
.post(
|
||||||
|
|
Loading…
Reference in New Issue