import { v4 as uuid } from 'uuid'

const ids = new Map()

const existingId = (key) => {
	return ids.get(key)
}

const newId = (key) => {
	const id = uuid()
	ids.set(key, id)
	return id
}

export default (type, domainId, opts) => {

	const key = `${ type }${ domainId || '' }${ JSON.stringify(opts) }`
	const id = existingId(key)

	if (id == null) return newId(key)
	return id

}
import { v5 as uuid } from 'uuid'

export default (type, domainId, opts) => {

	const name = `${ type }${ domainId || '' }${ JSON.stringify(opts) }`
	const namespace = '906d7dd0-b6e0-42c8-9270-436958c29c36'

	return uuid(name, namespace)

}
Use uuid v5 to generate ids
Use uuid v5 to generate ids
