@budibase/frontend-core 3.18.2 → 3.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/utils/validation/yup/app.ts +14 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.3",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"shortid": "2.2.15",
|
|
18
18
|
"socket.io-client": "^4.7.5"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "572306dc0decede5567d7b3644f0afa890797638"
|
|
21
21
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { App } from "@budibase/types"
|
|
1
|
+
import { Workspace } from "@budibase/types"
|
|
2
|
+
import { mixed, string } from "yup"
|
|
4
3
|
import { ValidationStore } from "."
|
|
5
|
-
import {
|
|
4
|
+
import { APP_NAME_REGEX, APP_URL_REGEX } from "../../../constants"
|
|
6
5
|
|
|
7
6
|
export const name = (
|
|
8
7
|
validation: ValidationStore,
|
|
9
|
-
{ apps, currentApp }: { apps:
|
|
10
|
-
|
|
8
|
+
{ apps, currentApp }: { apps: Workspace[]; currentApp?: Workspace } = {
|
|
9
|
+
apps: [],
|
|
10
|
+
}
|
|
11
11
|
) => {
|
|
12
12
|
validation.addValidator(
|
|
13
13
|
"name",
|
|
14
14
|
string()
|
|
15
15
|
.trim()
|
|
16
|
-
.required(`Your
|
|
16
|
+
.required(`Your workspace must have a name`)
|
|
17
17
|
.matches(
|
|
18
18
|
APP_NAME_REGEX,
|
|
19
|
-
|
|
19
|
+
"Workspace name must be letters, numbers and spaces only"
|
|
20
20
|
)
|
|
21
21
|
.test(
|
|
22
22
|
"non-existing-app-name",
|
|
23
|
-
|
|
23
|
+
"Another workspace with the same name already exists",
|
|
24
24
|
value => {
|
|
25
25
|
if (!value) {
|
|
26
26
|
// exit early, above validator will fail
|
|
@@ -39,19 +39,20 @@ export const name = (
|
|
|
39
39
|
|
|
40
40
|
export const url = (
|
|
41
41
|
validation: ValidationStore,
|
|
42
|
-
{ apps, currentApp }: { apps:
|
|
43
|
-
|
|
42
|
+
{ apps, currentApp }: { apps: Workspace[]; currentApp?: Workspace } = {
|
|
43
|
+
apps: [],
|
|
44
|
+
}
|
|
44
45
|
) => {
|
|
45
46
|
validation.addValidator(
|
|
46
47
|
"url",
|
|
47
48
|
string()
|
|
48
49
|
.trim()
|
|
49
50
|
.nullable()
|
|
50
|
-
.required(`Your
|
|
51
|
+
.required(`Your workspace must have a url`)
|
|
51
52
|
.matches(APP_URL_REGEX, "Please enter a valid url")
|
|
52
53
|
.test(
|
|
53
54
|
"non-existing-app-url",
|
|
54
|
-
`Another
|
|
55
|
+
`Another workspace with the same URL already exists`,
|
|
55
56
|
value => {
|
|
56
57
|
if (!value) {
|
|
57
58
|
return true
|