@budibase/frontend-core 3.18.2 → 3.18.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "3.18.2",
3
+ "version": "3.18.4",
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": "43d59f5579dd910575d8aebefb40fae25570c05d"
20
+ "gitHead": "b82c05d3d0949d198b49415d20980e72cc61ca5b"
21
21
  }
@@ -1,26 +1,26 @@
1
- import { string, mixed } from "yup"
2
- import { APP_NAME_REGEX, APP_URL_REGEX } from "../../../constants"
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 { Helpers } from "@budibase/bbui"
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: App[]; currentApp?: App } = { apps: [] },
10
- appOrWorkspace: "app" | "workspace"
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 ${appOrWorkspace} must have a name`)
16
+ .required(`Your workspace must have a name`)
17
17
  .matches(
18
18
  APP_NAME_REGEX,
19
- `${Helpers.capitalise(appOrWorkspace)} name must be letters, numbers and spaces only`
19
+ "Workspace name must be letters, numbers and spaces only"
20
20
  )
21
21
  .test(
22
22
  "non-existing-app-name",
23
- `Another ${appOrWorkspace} with the same name already exists`,
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: App[]; currentApp?: App } = { apps: [] },
43
- appOrWorkspace: "app" | "workspace"
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 ${appOrWorkspace} must have a url`)
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 ${appOrWorkspace} with the same URL already exists`,
55
+ `Another workspace with the same URL already exists`,
55
56
  value => {
56
57
  if (!value) {
57
58
  return true