@vesperjs/nuxt 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/composables/backend/error/index.ts +1 -2
- package/app/composables/backend/use-alert.ts +2 -2
- package/app/composables/index.ts +2 -0
- package/app/composables/util/index.ts +1 -1
- package/package.json +5 -5
- package/types/index.ts +4 -1
- package/app/composables/backend/error/use-backend-error-info.ts +0 -15
- package/app/composables/backend/error/use-external-errors.ts +0 -42
- package/app/composables/use-entity.ts +0 -13
- package/app/composables/use-flash.ts +0 -15
- package/app/composables/util/use-date.ts +0 -7
- package/interfaces/error/backend-error-info.ts +0 -4
- package/interfaces/error/index.ts +0 -1
- package/interfaces/flash.ts +0 -4
- package/interfaces/index.ts +0 -5
- package/interfaces/resource/beckend-error-resource.ts +0 -5
- package/interfaces/resource/errors-resource.ts +0 -3
- package/interfaces/resource/index.ts +0 -2
- package/types/error-messages.ts +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { useExternalErrors } from '
|
|
2
|
-
export { useBackendErrorInfo } from './use-backend-error-info'
|
|
1
|
+
export { useExternalErrors, useBackendErrorInfo } from '@vesperjs/shared'
|
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
BackendErrorInfo,
|
|
11
11
|
BackendErrorResource,
|
|
12
12
|
Flash,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
ErrorMessages,
|
|
14
|
+
} from '../../../types'
|
|
15
15
|
|
|
16
16
|
import { useBackendErrorInfo } from './error'
|
|
17
17
|
|
package/app/composables/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDate } from '
|
|
1
|
+
export { useDate } from '@vesperjs/shared'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesperjs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"nuxt",
|
|
6
6
|
"vue.js"
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"app",
|
|
16
|
-
"interfaces",
|
|
17
16
|
"types",
|
|
18
17
|
"nuxt.config.ts",
|
|
19
18
|
"app.config.ts"
|
|
@@ -24,11 +23,12 @@
|
|
|
24
23
|
"@formkit/tempo": "^1.0.0",
|
|
25
24
|
"@nuxt/eslint": "latest",
|
|
26
25
|
"@nuxtjs/i18n": "^10.2.4",
|
|
27
|
-
"@types/node": "^24.
|
|
28
|
-
"
|
|
26
|
+
"@types/node": "^24.12.2",
|
|
27
|
+
"@vesperjs/shared": "0.2.0",
|
|
28
|
+
"eslint": "^9.39.4",
|
|
29
29
|
"nuxt": "^4.3.1",
|
|
30
30
|
"ofetch": "^1.5.1",
|
|
31
|
-
"oxfmt": "^0.
|
|
31
|
+
"oxfmt": "^0.43.0",
|
|
32
32
|
"typescript": "^5.9.3",
|
|
33
33
|
"vue": "^3.6.0-beta.9"
|
|
34
34
|
},
|
package/types/index.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { BackendErrorInfo } from '@vesperjs/shared'
|
|
2
|
+
export type { BackendErrorResource, ErrorsResource } from '@vesperjs/shared'
|
|
3
|
+
export type { Flash } from '@vesperjs/shared'
|
|
4
|
+
export type { ErrorMessages } from '@vesperjs/shared'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { BackendErrorInfo } from '../../../../interfaces'
|
|
2
|
-
|
|
3
|
-
export const useBackendErrorInfo = function <R extends object>() {
|
|
4
|
-
const info = ref<BackendErrorInfo<R>>({})
|
|
5
|
-
|
|
6
|
-
const backendErrorInfo = computed<BackendErrorInfo<R>>(() => {
|
|
7
|
-
return info.value as BackendErrorInfo<R>
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
const clearBackendErrorInfo = (): void => {
|
|
11
|
-
info.value = {}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return { backendErrorInfo, clearBackendErrorInfo }
|
|
15
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Flash } from '../../../../interfaces'
|
|
2
|
-
import type { ErrorMessages } from '../../../../types'
|
|
3
|
-
|
|
4
|
-
export const useExternalErrors = function <P extends string>({ flash }: { flash: Ref<Flash> }) {
|
|
5
|
-
const errors = ref<ErrorMessages<P>>({})
|
|
6
|
-
|
|
7
|
-
const externalErrors = computed<ErrorMessages<P>>({
|
|
8
|
-
get() {
|
|
9
|
-
return errors.value as ErrorMessages<string>
|
|
10
|
-
},
|
|
11
|
-
set(value: ErrorMessages<P>) {
|
|
12
|
-
if (errors.value) {
|
|
13
|
-
for (const key in value) {
|
|
14
|
-
;(errors.value as ErrorMessages<P>)[key] = value[key] ?? []
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const clearExternalErrors = (): void => {
|
|
21
|
-
externalErrors.value = {}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const isSuccess = (): boolean => {
|
|
25
|
-
let result = true
|
|
26
|
-
|
|
27
|
-
for (const key in errors.value) {
|
|
28
|
-
const error = errors.value as ErrorMessages<string>
|
|
29
|
-
if ((error[key] as string[]).length > 0) result = false
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (flash.value.alert) result = false
|
|
33
|
-
|
|
34
|
-
return result
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
externalErrors,
|
|
39
|
-
clearExternalErrors,
|
|
40
|
-
isSuccess,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const useEntity = function <M extends object, R extends object = M>() {
|
|
2
|
-
const create = ({ from }: { from: R | M }): M => {
|
|
3
|
-
const model: Partial<M> = {}
|
|
4
|
-
Object.assign(model, from)
|
|
5
|
-
return model as M
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const copy = ({ from, to }: { from: R | M; to: M }): void => {
|
|
9
|
-
Object.assign(to, from)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return { create, copy }
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Flash } from '../../interfaces'
|
|
2
|
-
|
|
3
|
-
import { ref } from 'vue'
|
|
4
|
-
|
|
5
|
-
export const useFlash = function () {
|
|
6
|
-
const flash = ref<Flash>({})
|
|
7
|
-
|
|
8
|
-
const clearFlash = (): void => {
|
|
9
|
-
flash.value = {}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return { flash, clearFlash }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type UseFlashType = ReturnType<typeof useFlash>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { BackendErrorInfo } from './backend-error-info'
|
package/interfaces/flash.ts
DELETED
package/interfaces/index.ts
DELETED
package/types/error-messages.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ErrorMessages<T extends string> = Partial<Record<T, string[]>>
|