feat(uuid-generator): add support for UUID v7 and update uuid package to version 11.0.0

This commit is contained in:
Sebastian Trincado 2024-12-13 16:25:15 -03:00
parent 63fbd3b45c
commit a22a17b19a
2 changed files with 4 additions and 3 deletions

View file

@ -93,7 +93,7 @@
"ulid": "^2.3.0",
"unicode-emoji-json": "^0.4.0",
"unplugin-auto-import": "^0.16.4",
"uuid": "^9.0.0",
"uuid": "^11.0.0",
"vue": "^3.3.4",
"vue-i18n": "^9.9.1",
"vue-router": "^4.1.6",

View file

@ -1,10 +1,10 @@
<script setup lang="ts">
import { v1 as generateUuidV1, v3 as generateUuidV3, v4 as generateUuidV4, v5 as generateUuidV5, NIL as nilUuid } from 'uuid';
import { v1 as generateUuidV1, v3 as generateUuidV3, v4 as generateUuidV4, v5 as generateUuidV5, v7 as generateUuidV7, NIL as nilUuid } from 'uuid';
import { useCopy } from '@/composable/copy';
import { computedRefreshable } from '@/composable/computedRefreshable';
import { withDefaultOnError } from '@/utils/defaults';
const versions = ['NIL', 'v1', 'v3', 'v4', 'v5'] as const;
const versions = ['NIL', 'v1', 'v3', 'v4', 'v5', 'v7'] as const;
const version = useStorage<typeof versions[number]>('uuid-generator:version', 'v4');
const count = useStorage('uuid-generator:quantity', 1);
@ -34,6 +34,7 @@ const generators = {
v3: () => generateUuidV3(v35Args.value.name, v35Args.value.namespace),
v4: () => generateUuidV4(),
v5: () => generateUuidV5(v35Args.value.name, v35Args.value.namespace),
v7: () => generateUuidV7(),
};
const [uuids, refreshUUIDs] = computedRefreshable(() => withDefaultOnError(() =>