vue-lib-exo-corrected 1.0.1-beta.1 → 1.0.1-beta.2

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.
Files changed (36) hide show
  1. package/README.md +31 -0
  2. package/dist/components/Atoms/Dropdown/Dropdown.vue.d.ts +117 -0
  3. package/dist/components/Atoms/Tag/Tag.vue.d.ts +33 -0
  4. package/dist/components/Molecules/ColorPicker/ColorPicker.vue.d.ts +27 -0
  5. package/dist/components/Molecules/ListNote/ListNote.vue.d.ts +8 -6
  6. package/dist/components/Molecules/ListUsers/ListUsers.vue.d.ts +6 -6
  7. package/dist/components/Molecules/LoginForm/LoginForm.vue.d.ts +48 -0
  8. package/dist/components/Molecules/MarkdownText/MarkdownText.vue.d.ts +3 -3
  9. package/dist/components/Molecules/ModalLayout/ModalLayout.vue.d.ts +46 -0
  10. package/dist/components/Molecules/NoteCard/NoteCard.vue.d.ts +8 -6
  11. package/dist/components/Molecules/NoteCreation/NoteCreation.vue.d.ts +14 -2
  12. package/dist/components/Molecules/RegisterForm/RegisterForm.vue.d.ts +66 -0
  13. package/dist/components/Molecules/SidebarTags/SidebarTags.vue.d.ts +57 -0
  14. package/dist/components/Molecules/TagCreationModal/TagCreationModal.vue.d.ts +16 -0
  15. package/dist/components/Molecules/TagDropdown/TagDropdown.vue.d.ts +54 -0
  16. package/dist/components/Molecules/UserCard/UserCard.vue.d.ts +6 -6
  17. package/dist/components/Organisms/Header/Header.vue.d.ts +2 -0
  18. package/dist/components/Organisms/Layout/Layout.vue.d.ts +80 -1
  19. package/dist/components/TodoListEasyExercice/AddItem.vue.d.ts +4 -0
  20. package/dist/components/TodoListEasyExercice/TodoItem.vue.d.ts +23 -0
  21. package/dist/components/TodoListEasyExercice/TodoList.vue.d.ts +16 -0
  22. package/dist/components/TodoListEasyExercice/TodoListVModel.vue.d.ts +15 -0
  23. package/dist/composables/useValidation/useValidation.d.ts +22 -0
  24. package/dist/index.d.ts +15 -9
  25. package/dist/lidinAppKitConfig/createLidinAppKit.d.ts +13 -7
  26. package/dist/lidinAppKitConfig/vuetifyConfig/defaultVuetifyConfig.d.ts +42 -42
  27. package/dist/schemas/note.schema.d.ts +77 -0
  28. package/dist/schemas/note.schema.ts +47 -0
  29. package/dist/schemas/tag.schema.d.ts +57 -0
  30. package/dist/schemas/tag.schema.ts +32 -0
  31. package/dist/style.css +2 -2
  32. package/dist/types/NoteType.d.ts +26 -0
  33. package/dist/types/TagType.d.ts +24 -0
  34. package/dist/vue-lib-exo-corrected.js +15394 -11347
  35. package/dist/vue-lib-exo-corrected.umd.cjs +9 -7
  36. package/package.json +4 -3
@@ -1,2 +1,81 @@
1
- declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ import type { PropType as __PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ showTagsSidebar: {
4
+ type: __PropType<boolean>;
5
+ required: false;
6
+ default: boolean;
7
+ };
8
+ tags: {
9
+ type: __PropType<{
10
+ libelleName: string;
11
+ isSelected: boolean;
12
+ color?: string;
13
+ }[]>;
14
+ required: false;
15
+ };
16
+ sidebarTitle: {
17
+ type: __PropType<string>;
18
+ required: false;
19
+ default: string;
20
+ };
21
+ sidebarModelValue: {
22
+ type: __PropType<boolean>;
23
+ required: false;
24
+ default: boolean;
25
+ };
26
+ sidebarPermanent: {
27
+ type: __PropType<boolean>;
28
+ required: false;
29
+ default: boolean;
30
+ };
31
+ sidebarTemporary: {
32
+ type: __PropType<boolean>;
33
+ required: false;
34
+ default: boolean;
35
+ };
36
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("tag-click" | "tag-create" | "sidebar-update")[], "tag-click" | "tag-create" | "sidebar-update", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
37
+ showTagsSidebar: {
38
+ type: __PropType<boolean>;
39
+ required: false;
40
+ default: boolean;
41
+ };
42
+ tags: {
43
+ type: __PropType<{
44
+ libelleName: string;
45
+ isSelected: boolean;
46
+ color?: string;
47
+ }[]>;
48
+ required: false;
49
+ };
50
+ sidebarTitle: {
51
+ type: __PropType<string>;
52
+ required: false;
53
+ default: string;
54
+ };
55
+ sidebarModelValue: {
56
+ type: __PropType<boolean>;
57
+ required: false;
58
+ default: boolean;
59
+ };
60
+ sidebarPermanent: {
61
+ type: __PropType<boolean>;
62
+ required: false;
63
+ default: boolean;
64
+ };
65
+ sidebarTemporary: {
66
+ type: __PropType<boolean>;
67
+ required: false;
68
+ default: boolean;
69
+ };
70
+ }>> & Readonly<{
71
+ "onTag-click"?: (...args: any[]) => any;
72
+ "onTag-create"?: (...args: any[]) => any;
73
+ "onSidebar-update"?: (...args: any[]) => any;
74
+ }>, {
75
+ showTagsSidebar: boolean;
76
+ sidebarTitle: string;
77
+ sidebarModelValue: boolean;
78
+ sidebarPermanent: boolean;
79
+ sidebarTemporary: boolean;
80
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
81
  export default _sfc_main;
@@ -0,0 +1,4 @@
1
+ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "add"[], "add", import("vue").PublicProps, Readonly<{}> & Readonly<{
2
+ onAdd?: (...args: any[]) => any;
3
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ export default _sfc_main;
@@ -0,0 +1,23 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ todo: {
4
+ type: __PropType<string>;
5
+ required: true;
6
+ };
7
+ index: {
8
+ type: __PropType<number>;
9
+ required: true;
10
+ };
11
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "delete"[], "delete", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
+ todo: {
13
+ type: __PropType<string>;
14
+ required: true;
15
+ };
16
+ index: {
17
+ type: __PropType<number>;
18
+ required: true;
19
+ };
20
+ }>> & Readonly<{
21
+ onDelete?: (...args: any[]) => any;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
23
+ export default _sfc_main;
@@ -0,0 +1,16 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ todos: {
4
+ type: __PropType<string[]>;
5
+ required: true;
6
+ };
7
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("add" | "delete")[], "add" | "delete", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
+ todos: {
9
+ type: __PropType<string[]>;
10
+ required: true;
11
+ };
12
+ }>> & Readonly<{
13
+ onAdd?: (...args: any[]) => any;
14
+ onDelete?: (...args: any[]) => any;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ export default _sfc_main;
@@ -0,0 +1,15 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ modelValue: {
4
+ type: __PropType<string[]>;
5
+ required: true;
6
+ };
7
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
+ modelValue: {
9
+ type: __PropType<string[]>;
10
+ required: true;
11
+ };
12
+ }>> & Readonly<{
13
+ "onUpdate:modelValue"?: (...args: any[]) => any;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ export default _sfc_main;
@@ -0,0 +1,22 @@
1
+ import { z, type ZodSchema } from 'zod';
2
+ /**
3
+ * Composable de validation avec Zod
4
+ *
5
+ * @param schema - Schéma Zod pour valider les données
6
+ * @returns Objet avec errors, isTouched, validate, isValid
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const { errors, validate, isValid } = useValidation(NoteCreateSchema)
11
+ *
12
+ * if (validate(formData.value)) {
13
+ * // Données valides
14
+ * }
15
+ * ```
16
+ */
17
+ export declare function useValidation<T extends ZodSchema>(schema: T): {
18
+ errors: import("vue").Ref<Record<string, string[]>, Record<string, string[]>>;
19
+ isTouched: import("vue").Ref<boolean, boolean>;
20
+ validate: (data: unknown) => data is z.TypeOf<T>;
21
+ isValid: import("vue").ComputedRef<boolean>;
22
+ };
package/dist/index.d.ts CHANGED
@@ -1,26 +1,32 @@
1
+ import Dropdown from "./components/Atoms/Dropdown/Dropdown.vue";
2
+ import Tag from "./components/Atoms/Tag/Tag.vue";
1
3
  import MarkdownText from "./components/Molecules/MarkdownText/MarkdownText.vue";
2
4
  import Layout from "./components/Organisms/Layout/Layout.vue";
3
5
  import ListLayout from "./components/Molecules/ListLayout/ListLayout.vue";
6
+ import TodoList from "./components/TodoListEasyExercice/TodoList.vue";
7
+ import TodoListVModel from "./components/TodoListEasyExercice/TodoListVModel.vue";
4
8
  import ListNote from "./components/Molecules/ListNote/ListNote.vue";
5
9
  import ListUsers from "./components/Molecules/ListUsers/ListUsers.vue";
6
10
  import NoteCard from "./components/Molecules/NoteCard/NoteCard.vue";
7
11
  import NoteCreation from "./components/Molecules/NoteCreation/NoteCreation.vue";
12
+ import SidebarTags from "./components/Molecules/SidebarTags/SidebarTags.vue";
13
+ import TagDropdown from "./components/Molecules/TagDropdown/TagDropdown.vue";
8
14
  import UserCard from "./components/Molecules/UserCard/UserCard.vue";
15
+ import LoginForm from "./components/Molecules/LoginForm/LoginForm.vue";
16
+ import RegisterForm from "./components/Molecules/RegisterForm/RegisterForm.vue";
9
17
  import { DEFAULT_VUETIFY_CONFIG } from "./lidinAppKitConfig/vuetifyConfig/defaultVuetifyConfig";
10
18
  import { createLidinAppKit } from "./lidinAppKitConfig/createLidinAppKit.ts";
11
19
  import { useLanguage } from "./modules/globalAppData/composables/useLanguage.ts";
12
20
  import { useTheme } from "./modules/globalAppData/composables/useTheme.ts";
21
+ import { useValidation } from "./composables/useValidation/useValidation.ts";
13
22
  import { generateRandomUuid } from "./services/utils/randomId.ts";
14
23
  import { extractTitleFromMarkdown } from "./services/utils/markdownUtils.ts";
15
- export { useLanguage, useTheme, createLidinAppKit, DEFAULT_VUETIFY_CONFIG, MarkdownText, Layout, ListLayout, ListNote, ListUsers, NoteCard, NoteCreation, UserCard, generateRandomUuid, extractTitleFromMarkdown, };
24
+ export type { NoteType, NoteCreateInput, NoteUpdateInput, } from "./types/NoteType";
25
+ export type { TagType, TagCreateInput, TagUpdateInput, } from "./types/TagType";
26
+ export { NoteCommonSchema, NoteCreateSchema, NoteUpdateSchema, type NoteCommon, type NoteCreate, type NoteUpdate, } from "./schemas/note.schema";
27
+ export { TagCommonSchema, TagCreateSchema, TagUpdateSchema, type TagCommon, type TagCreate, type TagUpdate, } from "./schemas/tag.schema";
28
+ export { useLanguage, useTheme, useValidation, createLidinAppKit, DEFAULT_VUETIFY_CONFIG, Dropdown, Tag, MarkdownText, Layout, ListLayout, ListNote, ListUsers, NoteCard, NoteCreation, SidebarTags, TagDropdown, UserCard, LoginForm, RegisterForm, TodoList, TodoListVModel, generateRandomUuid, extractTitleFromMarkdown, };
16
29
 
17
30
  import type { DefineComponent } from 'vue';
18
31
 
19
- export declare const MarkdownText: DefineComponent<{}, {}, any>;
20
- export declare const Layout: DefineComponent<{}, {}, any>;
21
- export declare const ListLayout: DefineComponent<{}, {}, any>;
22
- export declare const ListNote: DefineComponent<{}, {}, any>;
23
- export declare const ListUsers: DefineComponent<{}, {}, any>;
24
- export declare const NoteCard: DefineComponent<{}, {}, any>;
25
- export declare const NoteCreation: DefineComponent<{}, {}, any>;
26
- export declare const UserCard: DefineComponent<{}, {}, any>;
32
+
@@ -2,7 +2,13 @@ import { type VuetifyOptions } from "vuetify";
2
2
  export declare function createLidinAppKit(vuetify: VuetifyOptions): {
3
3
  install: (app: import("vue").App<any>) => void;
4
4
  unmount: () => void;
5
- defaults: import("vue").Ref<import("vuetify").DefaultsInstance, import("vuetify").DefaultsInstance>;
5
+ defaults: import("vue").Ref<{
6
+ [key: string]: Record<string, unknown>;
7
+ global?: Record<string, unknown>;
8
+ }, {
9
+ [key: string]: Record<string, unknown>;
10
+ global?: Record<string, unknown>;
11
+ }>;
6
12
  display: import("vuetify").DisplayInstance;
7
13
  theme: import("vuetify").ThemeInstance & {
8
14
  install: (app: import("vue").App<any>) => void;
@@ -31,7 +37,7 @@ export declare function createLidinAppKit(vuetify: VuetifyOptions): {
31
37
  locale: any;
32
38
  formats?: any;
33
39
  }) => import("vuetify").DateInstance) | import("vuetify").DateInstance;
34
- formats?: Record<string, any> | undefined;
40
+ formats?: Record<string, any>;
35
41
  locale: Record<string, any>;
36
42
  };
37
43
  instance: {
@@ -42,7 +48,7 @@ export declare function createLidinAppKit(vuetify: VuetifyOptions): {
42
48
  toISO: (date: unknown) => string;
43
49
  startOfDay: (date: unknown) => unknown;
44
50
  endOfDay: (date: unknown) => unknown;
45
- startOfWeek: (date: unknown, firstDayOfWeek?: string | number | undefined) => unknown;
51
+ startOfWeek: (date: unknown, firstDayOfWeek?: string | number) => unknown;
46
52
  endOfWeek: (date: unknown) => unknown;
47
53
  startOfMonth: (date: unknown) => unknown;
48
54
  endOfMonth: (date: unknown) => unknown;
@@ -64,10 +70,10 @@ export declare function createLidinAppKit(vuetify: VuetifyOptions): {
64
70
  addMonths: (date: unknown, amount: number) => unknown;
65
71
  getYear: (date: unknown) => number;
66
72
  setYear: (date: unknown, year: number) => unknown;
67
- getDiff: (date: unknown, comparing: unknown, unit?: string | undefined) => number;
68
- getWeekArray: (date: unknown, firstDayOfWeek?: string | number | undefined) => unknown[][];
69
- getWeekdays: (firstDayOfWeek?: string | number | undefined, weekdayFormat?: "long" | "narrow" | "short" | undefined) => string[];
70
- getWeek: (date: unknown, firstDayOfWeek?: string | number | undefined, firstDayOfYear?: string | number | undefined) => number;
73
+ getDiff: (date: unknown, comparing: unknown, unit?: string) => number;
74
+ getWeekArray: (date: unknown, firstDayOfWeek?: string | number) => unknown[][];
75
+ getWeekdays: (firstDayOfWeek?: string | number, weekdayFormat?: "long" | "narrow" | "short") => string[];
76
+ getWeek: (date: unknown, firstDayOfWeek?: string | number, firstDayOfYear?: string | number) => number;
71
77
  getMonth: (date: unknown) => number;
72
78
  setMonth: (date: unknown, month: number) => unknown;
73
79
  getDate: (date: unknown) => number;
@@ -6,54 +6,54 @@ export declare const DEFAULT_VUETIFY_CONFIG: {
6
6
  defaultTheme: string;
7
7
  themes: {
8
8
  light: {
9
- dark?: boolean | undefined;
9
+ dark?: boolean;
10
10
  colors?: {
11
- [x: string]: string | undefined;
12
- background?: string | undefined;
13
- surface?: string | undefined;
14
- primary?: string | undefined;
15
- secondary?: string | undefined;
16
- success?: string | undefined;
17
- warning?: string | undefined;
18
- error?: string | undefined;
19
- info?: string | undefined;
20
- 'on-background'?: string | undefined;
21
- 'on-surface'?: string | undefined;
22
- 'on-primary'?: string | undefined;
23
- 'on-secondary'?: string | undefined;
24
- 'on-success'?: string | undefined;
25
- 'on-warning'?: string | undefined;
26
- 'on-error'?: string | undefined;
27
- 'on-info'?: string | undefined;
28
- } | undefined;
11
+ [x: string]: string;
12
+ background?: string;
13
+ surface?: string;
14
+ primary?: string;
15
+ secondary?: string;
16
+ success?: string;
17
+ warning?: string;
18
+ error?: string;
19
+ info?: string;
20
+ 'on-background'?: string;
21
+ 'on-surface'?: string;
22
+ 'on-primary'?: string;
23
+ 'on-secondary'?: string;
24
+ 'on-success'?: string;
25
+ 'on-warning'?: string;
26
+ 'on-error'?: string;
27
+ 'on-info'?: string;
28
+ };
29
29
  variables?: {
30
- [x: string]: string | number | undefined;
31
- } | undefined;
30
+ [x: string]: string | number;
31
+ };
32
32
  };
33
33
  dark: {
34
- dark?: boolean | undefined;
34
+ dark?: boolean;
35
35
  colors?: {
36
- [x: string]: string | undefined;
37
- background?: string | undefined;
38
- surface?: string | undefined;
39
- primary?: string | undefined;
40
- secondary?: string | undefined;
41
- success?: string | undefined;
42
- warning?: string | undefined;
43
- error?: string | undefined;
44
- info?: string | undefined;
45
- 'on-background'?: string | undefined;
46
- 'on-surface'?: string | undefined;
47
- 'on-primary'?: string | undefined;
48
- 'on-secondary'?: string | undefined;
49
- 'on-success'?: string | undefined;
50
- 'on-warning'?: string | undefined;
51
- 'on-error'?: string | undefined;
52
- 'on-info'?: string | undefined;
53
- } | undefined;
36
+ [x: string]: string;
37
+ background?: string;
38
+ surface?: string;
39
+ primary?: string;
40
+ secondary?: string;
41
+ success?: string;
42
+ warning?: string;
43
+ error?: string;
44
+ info?: string;
45
+ 'on-background'?: string;
46
+ 'on-surface'?: string;
47
+ 'on-primary'?: string;
48
+ 'on-secondary'?: string;
49
+ 'on-success'?: string;
50
+ 'on-warning'?: string;
51
+ 'on-error'?: string;
52
+ 'on-info'?: string;
53
+ };
54
54
  variables?: {
55
- [x: string]: string | number | undefined;
56
- } | undefined;
55
+ [x: string]: string | number;
56
+ };
57
57
  };
58
58
  };
59
59
  };
@@ -0,0 +1,77 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Schéma commun pour Note (base réutilisable)
4
+ */
5
+ export declare const NoteCommonSchema: z.ZodObject<{
6
+ id: z.ZodOptional<z.ZodString>;
7
+ contentMd: z.ZodString;
8
+ tagsId: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
+ createdAt: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ contentMd?: string;
12
+ id?: string;
13
+ tagsId?: string[];
14
+ createdAt?: string;
15
+ }, {
16
+ contentMd?: string;
17
+ id?: string;
18
+ tagsId?: string[];
19
+ createdAt?: string;
20
+ }>;
21
+ /**
22
+ * Schéma pour la création d'une note
23
+ * - Pas d'id (généré côté serveur)
24
+ * - Pas de createdAt (généré côté serveur)
25
+ * - title optionnel (peut être extrait du contentMd)
26
+ * - contentMd optionnel si title est présent (au moins un des deux requis)
27
+ */
28
+ export declare const NoteCreateSchema: z.ZodEffects<z.ZodObject<{
29
+ tagsId: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
+ } & {
31
+ title: z.ZodOptional<z.ZodString>;
32
+ contentMd: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ title?: string;
35
+ contentMd?: string;
36
+ tagsId?: string[];
37
+ }, {
38
+ title?: string;
39
+ contentMd?: string;
40
+ tagsId?: string[];
41
+ }>, {
42
+ title?: string;
43
+ contentMd?: string;
44
+ tagsId?: string[];
45
+ }, {
46
+ title?: string;
47
+ contentMd?: string;
48
+ tagsId?: string[];
49
+ }>;
50
+ /**
51
+ * Schéma pour la mise à jour d'une note
52
+ * - id requis
53
+ * - Tous les autres champs optionnels (partial update)
54
+ */
55
+ export declare const NoteUpdateSchema: z.ZodObject<{
56
+ contentMd: z.ZodOptional<z.ZodString>;
57
+ tagsId: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
58
+ createdAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
59
+ } & {
60
+ id: z.ZodString;
61
+ }, "strip", z.ZodTypeAny, {
62
+ contentMd?: string;
63
+ id?: string;
64
+ tagsId?: string[];
65
+ createdAt?: string;
66
+ }, {
67
+ contentMd?: string;
68
+ id?: string;
69
+ tagsId?: string[];
70
+ createdAt?: string;
71
+ }>;
72
+ /**
73
+ * Inférence de types depuis les schémas
74
+ */
75
+ export type NoteCommon = z.infer<typeof NoteCommonSchema>;
76
+ export type NoteCreate = z.infer<typeof NoteCreateSchema>;
77
+ export type NoteUpdate = z.infer<typeof NoteUpdateSchema>;
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Schéma commun pour Note (base réutilisable)
5
+ */
6
+ export const NoteCommonSchema = z.object({
7
+ id: z.string().optional(),
8
+ contentMd: z.string().min(1, 'Contenu requis'),
9
+ tagsId: z.array(z.string()).optional(),
10
+ createdAt: z.string().datetime().optional(),
11
+ });
12
+
13
+ /**
14
+ * Schéma pour la création d'une note
15
+ * - Pas d'id (généré côté serveur)
16
+ * - Pas de createdAt (généré côté serveur)
17
+ * - title optionnel (peut être extrait du contentMd)
18
+ * - contentMd optionnel si title est présent (au moins un des deux requis)
19
+ */
20
+ export const NoteCreateSchema = NoteCommonSchema.omit({ id: true, createdAt: true })
21
+ .extend({
22
+ title: z.string().optional(),
23
+ contentMd: z.string().optional(),
24
+ })
25
+ .refine(
26
+ (data) => data.title || data.contentMd,
27
+ {
28
+ message: 'Au moins un titre ou un contenu est requis',
29
+ path: ['contentMd'],
30
+ }
31
+ );
32
+
33
+ /**
34
+ * Schéma pour la mise à jour d'une note
35
+ * - id requis
36
+ * - Tous les autres champs optionnels (partial update)
37
+ */
38
+ export const NoteUpdateSchema = NoteCommonSchema.partial().extend({
39
+ id: z.string(),
40
+ });
41
+
42
+ /**
43
+ * Inférence de types depuis les schémas
44
+ */
45
+ export type NoteCommon = z.infer<typeof NoteCommonSchema>;
46
+ export type NoteCreate = z.infer<typeof NoteCreateSchema>;
47
+ export type NoteUpdate = z.infer<typeof NoteUpdateSchema>;
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Schéma commun pour Tag (base réutilisable)
4
+ */
5
+ export declare const TagCommonSchema: z.ZodObject<{
6
+ id: z.ZodOptional<z.ZodString>;
7
+ title: z.ZodString;
8
+ color: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ title?: string;
11
+ color?: string;
12
+ id?: string;
13
+ }, {
14
+ title?: string;
15
+ color?: string;
16
+ id?: string;
17
+ }>;
18
+ /**
19
+ * Schéma pour la création d'un tag
20
+ * - Pas d'id (généré côté serveur)
21
+ */
22
+ export declare const TagCreateSchema: z.ZodObject<Omit<{
23
+ id: z.ZodOptional<z.ZodString>;
24
+ title: z.ZodString;
25
+ color: z.ZodString;
26
+ }, "id">, "strip", z.ZodTypeAny, {
27
+ title?: string;
28
+ color?: string;
29
+ }, {
30
+ title?: string;
31
+ color?: string;
32
+ }>;
33
+ /**
34
+ * Schéma pour la mise à jour d'un tag
35
+ * - id requis
36
+ * - Tous les autres champs optionnels (partial update)
37
+ */
38
+ export declare const TagUpdateSchema: z.ZodObject<{
39
+ title: z.ZodOptional<z.ZodString>;
40
+ color: z.ZodOptional<z.ZodString>;
41
+ } & {
42
+ id: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ title?: string;
45
+ color?: string;
46
+ id?: string;
47
+ }, {
48
+ title?: string;
49
+ color?: string;
50
+ id?: string;
51
+ }>;
52
+ /**
53
+ * Inférence de types depuis les schémas
54
+ */
55
+ export type TagCommon = z.infer<typeof TagCommonSchema>;
56
+ export type TagCreate = z.infer<typeof TagCreateSchema>;
57
+ export type TagUpdate = z.infer<typeof TagUpdateSchema>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Schéma commun pour Tag (base réutilisable)
5
+ */
6
+ export const TagCommonSchema = z.object({
7
+ id: z.string().optional(),
8
+ title: z.string().min(1, 'Titre requis'),
9
+ color: z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Couleur doit être au format hex (#RRGGBB)'),
10
+ });
11
+
12
+ /**
13
+ * Schéma pour la création d'un tag
14
+ * - Pas d'id (généré côté serveur)
15
+ */
16
+ export const TagCreateSchema = TagCommonSchema.omit({ id: true });
17
+
18
+ /**
19
+ * Schéma pour la mise à jour d'un tag
20
+ * - id requis
21
+ * - Tous les autres champs optionnels (partial update)
22
+ */
23
+ export const TagUpdateSchema = TagCommonSchema.partial().extend({
24
+ id: z.string(),
25
+ });
26
+
27
+ /**
28
+ * Inférence de types depuis les schémas
29
+ */
30
+ export type TagCommon = z.infer<typeof TagCommonSchema>;
31
+ export type TagCreate = z.infer<typeof TagCreateSchema>;
32
+ export type TagUpdate = z.infer<typeof TagUpdateSchema>;