tweak uuid import (#2001)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import { useCallback, MouseEventHandler, useEffect } from 'react'
|
import { useCallback, MouseEventHandler, useEffect } from 'react'
|
||||||
import { DebugPanel } from './components/DebugPanel'
|
import { DebugPanel } from './components/DebugPanel'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { PaneType, useStore } from './useStore'
|
import { PaneType, useStore } from './useStore'
|
||||||
import { Logs, KCLErrors } from './components/Logs'
|
import { Logs, KCLErrors } from './components/Logs'
|
||||||
import { CollapsiblePanel } from './components/CollapsiblePanel'
|
import { CollapsiblePanel } from './components/CollapsiblePanel'
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
Subscription,
|
Subscription,
|
||||||
EngineCommandManager,
|
EngineCommandManager,
|
||||||
} from 'lang/std/engineConnection'
|
} from 'lang/std/engineConnection'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { deg2Rad } from 'lib/utils2d'
|
import { deg2Rad } from 'lib/utils2d'
|
||||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
||||||
import * as TWEEN from '@tweenjs/tween.js'
|
import * as TWEEN from '@tweenjs/tween.js'
|
||||||
|
@ -82,7 +82,7 @@ import {
|
|||||||
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
import { getTangentPointFromPreviousArc } from 'lib/utils2d'
|
||||||
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
||||||
import { Models } from '@kittycad/lib'
|
import { Models } from '@kittycad/lib'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { SketchDetails } from 'machines/modelingMachine'
|
import { SketchDetails } from 'machines/modelingMachine'
|
||||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
import { isTauri } from 'lib/isTauri'
|
import { isTauri } from 'lib/isTauri'
|
||||||
import { authCommandBarConfig } from 'lib/commandBarConfigs/authCommandConfig'
|
import { authCommandBarConfig } from 'lib/commandBarConfigs/authCommandConfig'
|
||||||
import { kclManager, sceneInfra, engineCommandManager } from 'lib/singletons'
|
import { kclManager, sceneInfra, engineCommandManager } from 'lib/singletons'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { IndexLoaderData } from 'lib/types'
|
import { IndexLoaderData } from 'lib/types'
|
||||||
import { settings } from 'lib/settings/initialSettings'
|
import { settings } from 'lib/settings/initialSettings'
|
||||||
import {
|
import {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { executeAst, executeCode } from 'useStore'
|
import { executeAst, executeCode } from 'useStore'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections } from 'lib/selections'
|
||||||
import { KCLError } from './errors'
|
import { KCLError } from './errors'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { EngineCommandManager } from './std/engineConnection'
|
import { EngineCommandManager } from './std/engineConnection'
|
||||||
|
|
||||||
import { deferExecution } from 'lib/utils'
|
import { deferExecution } from 'lib/utils'
|
||||||
|
@ -2,7 +2,7 @@ import { PathToNode, Program, SourceRange } from 'lang/wasm'
|
|||||||
import { VITE_KC_API_WS_MODELING_URL, VITE_KC_CONNECTION_TIMEOUT_MS } from 'env'
|
import { VITE_KC_API_WS_MODELING_URL, VITE_KC_CONNECTION_TIMEOUT_MS } from 'env'
|
||||||
import { Models } from '@kittycad/lib'
|
import { Models } from '@kittycad/lib'
|
||||||
import { exportSave } from 'lib/exportSave'
|
import { exportSave } from 'lib/exportSave'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { getNodePathFromSourceRange } from 'lang/queryAst'
|
import { getNodePathFromSourceRange } from 'lang/queryAst'
|
||||||
import { Themes, getThemeColorForEngine } from 'lib/theme'
|
import { Themes, getThemeColorForEngine } from 'lib/theme'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { engineCommandManager } from 'lib/singletons'
|
import { engineCommandManager } from 'lib/singletons'
|
||||||
import { type Models } from '@kittycad/lib'
|
import { type Models } from '@kittycad/lib'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
|
|
||||||
// Isolating a function to call the engine to export the current scene.
|
// Isolating a function to call the engine to export the current scene.
|
||||||
// Because it has given us trouble in automated testing environments.
|
// Because it has given us trouble in automated testing environments.
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
} from 'lib/singletons'
|
} from 'lib/singletons'
|
||||||
import { CallExpression, SourceRange, parse, recast } from 'lang/wasm'
|
import { CallExpression, SourceRange, parse, recast } from 'lang/wasm'
|
||||||
import { ModelingMachineEvent } from 'machines/modelingMachine'
|
import { ModelingMachineEvent } from 'machines/modelingMachine'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { EditorSelection } from '@codemirror/state'
|
import { EditorSelection } from '@codemirror/state'
|
||||||
import { SelectionRange } from '@uiw/react-codemirror'
|
import { SelectionRange } from '@uiw/react-codemirror'
|
||||||
import { getNormalisedCoordinates, isOverlap } from 'lib/utils'
|
import { getNormalisedCoordinates, isOverlap } from 'lib/utils'
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import { SourceRange } from '../lang/wasm'
|
import { SourceRange } from '../lang/wasm'
|
||||||
|
|
||||||
|
import { v4 } from 'uuid'
|
||||||
|
|
||||||
|
export const uuidv4 = v4
|
||||||
|
|
||||||
export function isOverlap(a: SourceRange, b: SourceRange) {
|
export function isOverlap(a: SourceRange, b: SourceRange) {
|
||||||
const [startingRange, secondRange] = a[0] < b[0] ? [a, b] : [b, a]
|
const [startingRange, secondRange] = a[0] < b[0] ? [a, b] : [b, a]
|
||||||
const [lastOfFirst, firstOfSecond] = [startingRange[1], secondRange[0]]
|
const [lastOfFirst, firstOfSecond] = [startingRange[1], secondRange[0]]
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import { generateUuidFromHashSeed } from './uuid'
|
|
||||||
|
|
||||||
describe('generateUuidFromHashSeed', () => {
|
|
||||||
it('generates a UUID from a hash seed', () => {
|
|
||||||
const inputString = 'Hello, World!'
|
|
||||||
const uuid = generateUuidFromHashSeed(inputString)
|
|
||||||
expect(uuid).toEqual('64666664-3630-4231-a262-326264356230')
|
|
||||||
})
|
|
||||||
})
|
|
@ -1,10 +0,0 @@
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
|
||||||
import { SHA256 } from 'crypto-js'
|
|
||||||
|
|
||||||
export function generateUuidFromHashSeed(seed: string): string {
|
|
||||||
const hashedSeed = SHA256(seed).toString()
|
|
||||||
const uuid = uuidv4({
|
|
||||||
random: hashedSeed.split('').map((c: string) => c.charCodeAt(0)),
|
|
||||||
})
|
|
||||||
return uuid
|
|
||||||
}
|
|
@ -42,7 +42,7 @@ import { ModelingCommandSchema } from 'lib/commandBarConfigs/modelingCommandConf
|
|||||||
import { DefaultPlaneStr } from 'clientSideScene/sceneEntities'
|
import { DefaultPlaneStr } from 'clientSideScene/sceneEntities'
|
||||||
import { Vector3 } from 'three'
|
import { Vector3 } from 'three'
|
||||||
import { quaternionFromUpNForward } from 'clientSideScene/helpers'
|
import { quaternionFromUpNForward } from 'clientSideScene/helpers'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { uuidv4 } from 'lib/utils'
|
||||||
|
|
||||||
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user