Improve lodash imports
This commit is contained in:
parent
39ba4a544a
commit
beaeff90cc
|
@ -8,6 +8,6 @@ then
|
||||||
jest --coverage --runInBand --forceExit
|
jest --coverage --runInBand --forceExit
|
||||||
else
|
else
|
||||||
# --maxWorkers performs better in development
|
# --maxWorkers performs better in development
|
||||||
echo "jest --coverage --forceExit"
|
echo "jest --coverage --detectOpenHandles"
|
||||||
jest --coverage --forceExit
|
jest --coverage --detectOpenHandles
|
||||||
fi
|
fi
|
|
@ -1,5 +1,5 @@
|
||||||
const { flatten } = require("lodash")
|
import flatten from "lodash/flatten"
|
||||||
const { cloneDeep } = require("lodash/fp")
|
import cloneDeep from "lodash/fp/cloneDeep"
|
||||||
|
|
||||||
export type RoleHierarchy = {
|
export type RoleHierarchy = {
|
||||||
permissionId: string
|
permissionId: string
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { prefixRoleID, getRoleParams, DocumentType, SEPARATOR } from "../db"
|
||||||
import { getAppDB } from "../context"
|
import { getAppDB } from "../context"
|
||||||
import { doWithDB } from "../db"
|
import { doWithDB } from "../db"
|
||||||
import { Screen, Role as RoleDoc } from "@budibase/types"
|
import { Screen, Role as RoleDoc } from "@budibase/types"
|
||||||
const { cloneDeep } = require("lodash/fp")
|
import cloneDeep from "lodash/fp/cloneDeep"
|
||||||
|
|
||||||
export const BUILTIN_ROLE_IDS = {
|
export const BUILTIN_ROLE_IDS = {
|
||||||
ADMIN: "ADMIN",
|
ADMIN: "ADMIN",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { cloneDeep } from "lodash"
|
import cloneDeep from "lodash/cloneDeep"
|
||||||
import * as permissions from "../permissions"
|
import * as permissions from "../permissions"
|
||||||
import { BUILTIN_ROLE_IDS } from "../roles"
|
import { BUILTIN_ROLE_IDS } from "../roles"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Feature, License, Quotas } from "@budibase/types"
|
import { Feature, License, Quotas } from "@budibase/types"
|
||||||
import _ from "lodash"
|
import cloneDeep from "lodash/cloneDeep"
|
||||||
|
|
||||||
let CLOUD_FREE_LICENSE: License
|
let CLOUD_FREE_LICENSE: License
|
||||||
let UNLIMITED_LICENSE: License
|
let UNLIMITED_LICENSE: License
|
||||||
|
@ -58,7 +58,7 @@ export const useCloudFree = () => {
|
||||||
// FEATURES
|
// FEATURES
|
||||||
|
|
||||||
const useFeature = (feature: Feature) => {
|
const useFeature = (feature: Feature) => {
|
||||||
const license = _.cloneDeep(UNLIMITED_LICENSE)
|
const license = cloneDeep(UNLIMITED_LICENSE)
|
||||||
const opts: UseLicenseOpts = {
|
const opts: UseLicenseOpts = {
|
||||||
features: [feature],
|
features: [feature],
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ export const useSyncAutomations = () => {
|
||||||
// QUOTAS
|
// QUOTAS
|
||||||
|
|
||||||
export const setAutomationLogsQuota = (value: number) => {
|
export const setAutomationLogsQuota = (value: number) => {
|
||||||
const license = _.cloneDeep(UNLIMITED_LICENSE)
|
const license = cloneDeep(UNLIMITED_LICENSE)
|
||||||
license.quotas.constant.automationLogRetentionDays.value = value
|
license.quotas.constant.automationLogRetentionDays.value = value
|
||||||
return useLicense(license)
|
return useLicense(license)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
CreateAccount,
|
CreateAccount,
|
||||||
CreatePassswordAccount,
|
CreatePassswordAccount,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import _ from "lodash"
|
import sample from "lodash/sample"
|
||||||
|
|
||||||
export const account = (partial: Partial<Account> = {}): Account => {
|
export const account = (partial: Partial<Account> = {}): Account => {
|
||||||
return {
|
return {
|
||||||
|
@ -46,13 +46,11 @@ export const cloudAccount = (): CloudAccount => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function providerType(): AccountSSOProviderType {
|
function providerType(): AccountSSOProviderType {
|
||||||
return _.sample(
|
return sample(Object.values(AccountSSOProviderType)) as AccountSSOProviderType
|
||||||
Object.values(AccountSSOProviderType)
|
|
||||||
) as AccountSSOProviderType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function provider(): AccountSSOProvider {
|
function provider(): AccountSSOProvider {
|
||||||
return _.sample(Object.values(AccountSSOProvider)) as AccountSSOProvider
|
return sample(Object.values(AccountSSOProvider)) as AccountSSOProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ssoAccount(account: Account = cloudAccount()): SSOAccount {
|
export function ssoAccount(account: Account = cloudAccount()): SSOAccount {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { ScimCreateGroupRequest, ScimCreateUserRequest } from "@budibase/types"
|
import { ScimCreateGroupRequest, ScimCreateUserRequest } from "@budibase/types"
|
||||||
import { uuid } from "./common"
|
import { uuid } from "./common"
|
||||||
import { generator } from "./generator"
|
import { generator } from "./generator"
|
||||||
import _ from "lodash"
|
|
||||||
|
|
||||||
interface CreateUserRequestFields {
|
interface CreateUserRequestFields {
|
||||||
externalId: string
|
externalId: string
|
||||||
|
@ -20,10 +19,10 @@ export function createUserRequest(userData?: Partial<CreateUserRequestFields>) {
|
||||||
username: generator.name(),
|
username: generator.name(),
|
||||||
}
|
}
|
||||||
|
|
||||||
const { externalId, email, firstName, lastName, username } = _.assign(
|
const { externalId, email, firstName, lastName, username } = {
|
||||||
defaultValues,
|
...defaultValues,
|
||||||
userData
|
...userData,
|
||||||
)
|
}
|
||||||
|
|
||||||
let user: ScimCreateUserRequest = {
|
let user: ScimCreateUserRequest = {
|
||||||
schemas: [
|
schemas: [
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { generator } from "./generator"
|
||||||
import { email, uuid } from "./common"
|
import { email, uuid } from "./common"
|
||||||
import * as shared from "./shared"
|
import * as shared from "./shared"
|
||||||
import { user } from "./shared"
|
import { user } from "./shared"
|
||||||
import _ from "lodash"
|
import sample from "lodash/sample"
|
||||||
|
|
||||||
export function OAuth(): OAuth2 {
|
export function OAuth(): OAuth2 {
|
||||||
return {
|
return {
|
||||||
|
@ -47,7 +47,7 @@ export function authDetails(userDoc?: User): SSOAuthDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function providerType(): SSOProviderType {
|
export function providerType(): SSOProviderType {
|
||||||
return _.sample(Object.values(SSOProviderType)) as SSOProviderType
|
return sample(Object.values(SSOProviderType)) as SSOProviderType
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ssoProfile(user?: User): SSOProfile {
|
export function ssoProfile(user?: User): SSOProfile {
|
||||||
|
|
Loading…
Reference in New Issue