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