@latte-macchiat-io/latte-payload 1.0.1

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 (253) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.env.example +29 -0
  3. package/.github/workflows/ci.yml +160 -0
  4. package/.github/workflows/publish.yml +126 -0
  5. package/.nvmrc +1 -0
  6. package/.prettierignore +2 -0
  7. package/.prettierrc +11 -0
  8. package/CHANGELOG.md +87 -0
  9. package/README.md +364 -0
  10. package/TESTING_AND_DOCUMENTATION_SETUP.md +348 -0
  11. package/dist/access/adminAccessOnly.d.ts +25 -0
  12. package/dist/access/adminAccessOnly.d.ts.map +1 -0
  13. package/dist/access/adminAccessOnly.js +11 -0
  14. package/dist/access/adminAccessOnly.js.map +1 -0
  15. package/dist/access/admins.d.ts +72 -0
  16. package/dist/access/admins.d.ts.map +1 -0
  17. package/dist/access/admins.js +76 -0
  18. package/dist/access/admins.js.map +1 -0
  19. package/dist/access/anyone.d.ts +35 -0
  20. package/dist/access/anyone.d.ts.map +1 -0
  21. package/dist/access/anyone.js +34 -0
  22. package/dist/access/anyone.js.map +1 -0
  23. package/dist/access/authenticated.d.ts +63 -0
  24. package/dist/access/authenticated.d.ts.map +1 -0
  25. package/dist/access/authenticated.js +68 -0
  26. package/dist/access/authenticated.js.map +1 -0
  27. package/dist/access/authenticatedAccessOnly.d.ts +13 -0
  28. package/dist/access/authenticatedAccessOnly.d.ts.map +1 -0
  29. package/dist/access/authenticatedAccessOnly.js +11 -0
  30. package/dist/access/authenticatedAccessOnly.js.map +1 -0
  31. package/dist/access/index.d.ts +7 -0
  32. package/dist/access/index.d.ts.map +1 -0
  33. package/dist/access/index.js +7 -0
  34. package/dist/access/index.js.map +1 -0
  35. package/dist/access/publicReadAuthenticatedAccess.d.ts +13 -0
  36. package/dist/access/publicReadAuthenticatedAccess.d.ts.map +1 -0
  37. package/dist/access/publicReadAuthenticatedAccess.js +12 -0
  38. package/dist/access/publicReadAuthenticatedAccess.js.map +1 -0
  39. package/dist/collections/ContactMessages/hooks/sendEmailNotification.d.ts +31 -0
  40. package/dist/collections/ContactMessages/hooks/sendEmailNotification.d.ts.map +1 -0
  41. package/dist/collections/ContactMessages/hooks/sendEmailNotification.js +29 -0
  42. package/dist/collections/ContactMessages/hooks/sendEmailNotification.js.map +1 -0
  43. package/dist/collections/ContactMessages/index.d.ts +27 -0
  44. package/dist/collections/ContactMessages/index.d.ts.map +1 -0
  45. package/dist/collections/ContactMessages/index.js +81 -0
  46. package/dist/collections/ContactMessages/index.js.map +1 -0
  47. package/dist/collections/EmailTemplates/index.d.ts +26 -0
  48. package/dist/collections/EmailTemplates/index.d.ts.map +1 -0
  49. package/dist/collections/EmailTemplates/index.js +74 -0
  50. package/dist/collections/EmailTemplates/index.js.map +1 -0
  51. package/dist/collections/Media/index.d.ts +3 -0
  52. package/dist/collections/Media/index.d.ts.map +1 -0
  53. package/dist/collections/Media/index.js +22 -0
  54. package/dist/collections/Media/index.js.map +1 -0
  55. package/dist/collections/QueuedEmails/components/HtmlViewer.d.ts +3 -0
  56. package/dist/collections/QueuedEmails/components/HtmlViewer.d.ts.map +1 -0
  57. package/dist/collections/QueuedEmails/components/HtmlViewer.js +11 -0
  58. package/dist/collections/QueuedEmails/components/HtmlViewer.js.map +1 -0
  59. package/dist/collections/QueuedEmails/components/RetryEmailButtons.d.ts +2 -0
  60. package/dist/collections/QueuedEmails/components/RetryEmailButtons.d.ts.map +1 -0
  61. package/dist/collections/QueuedEmails/components/RetryEmailButtons.js +79 -0
  62. package/dist/collections/QueuedEmails/components/RetryEmailButtons.js.map +1 -0
  63. package/dist/collections/QueuedEmails/index.d.ts +3 -0
  64. package/dist/collections/QueuedEmails/index.d.ts.map +1 -0
  65. package/dist/collections/QueuedEmails/index.js +245 -0
  66. package/dist/collections/QueuedEmails/index.js.map +1 -0
  67. package/dist/collections/Users/auth-emails/forgot-password-email.d.ts +51 -0
  68. package/dist/collections/Users/auth-emails/forgot-password-email.d.ts.map +1 -0
  69. package/dist/collections/Users/auth-emails/forgot-password-email.js +90 -0
  70. package/dist/collections/Users/auth-emails/forgot-password-email.js.map +1 -0
  71. package/dist/collections/Users/auth-emails/verify-email.d.ts +51 -0
  72. package/dist/collections/Users/auth-emails/verify-email.d.ts.map +1 -0
  73. package/dist/collections/Users/auth-emails/verify-email.js +80 -0
  74. package/dist/collections/Users/auth-emails/verify-email.js.map +1 -0
  75. package/dist/collections/Users/hooks/ensureFirstUserIsAdmin.d.ts +3 -0
  76. package/dist/collections/Users/hooks/ensureFirstUserIsAdmin.d.ts.map +1 -0
  77. package/dist/collections/Users/hooks/ensureFirstUserIsAdmin.js +19 -0
  78. package/dist/collections/Users/hooks/ensureFirstUserIsAdmin.js.map +1 -0
  79. package/dist/collections/Users/index.d.ts +76 -0
  80. package/dist/collections/Users/index.d.ts.map +1 -0
  81. package/dist/collections/Users/index.js +116 -0
  82. package/dist/collections/Users/index.js.map +1 -0
  83. package/dist/collections/index.d.ts +10 -0
  84. package/dist/collections/index.d.ts.map +1 -0
  85. package/dist/collections/index.js +14 -0
  86. package/dist/collections/index.js.map +1 -0
  87. package/dist/components/index.d.ts +3 -0
  88. package/dist/components/index.d.ts.map +1 -0
  89. package/dist/components/index.js +4 -0
  90. package/dist/components/index.js.map +1 -0
  91. package/dist/forms/states.d.ts +8 -0
  92. package/dist/forms/states.d.ts.map +1 -0
  93. package/dist/forms/states.js +16 -0
  94. package/dist/forms/states.js.map +1 -0
  95. package/dist/forms/translate-errors.d.ts +8 -0
  96. package/dist/forms/translate-errors.d.ts.map +1 -0
  97. package/dist/forms/translate-errors.js +11 -0
  98. package/dist/forms/translate-errors.js.map +1 -0
  99. package/dist/forms/validators.d.ts +10 -0
  100. package/dist/forms/validators.d.ts.map +1 -0
  101. package/dist/forms/validators.js +23 -0
  102. package/dist/forms/validators.js.map +1 -0
  103. package/dist/globals/PrivacyPolicy/hooks/revalidate-cache.d.ts +2 -0
  104. package/dist/globals/PrivacyPolicy/hooks/revalidate-cache.d.ts.map +1 -0
  105. package/dist/globals/PrivacyPolicy/hooks/revalidate-cache.js +5 -0
  106. package/dist/globals/PrivacyPolicy/hooks/revalidate-cache.js.map +1 -0
  107. package/dist/globals/PrivacyPolicy/index.d.ts +3 -0
  108. package/dist/globals/PrivacyPolicy/index.d.ts.map +1 -0
  109. package/dist/globals/PrivacyPolicy/index.js +31 -0
  110. package/dist/globals/PrivacyPolicy/index.js.map +1 -0
  111. package/dist/globals/TermsOfUse/hooks/revalidate-cache.d.ts +2 -0
  112. package/dist/globals/TermsOfUse/hooks/revalidate-cache.d.ts.map +1 -0
  113. package/dist/globals/TermsOfUse/hooks/revalidate-cache.js +5 -0
  114. package/dist/globals/TermsOfUse/hooks/revalidate-cache.js.map +1 -0
  115. package/dist/globals/TermsOfUse/index.d.ts +3 -0
  116. package/dist/globals/TermsOfUse/index.d.ts.map +1 -0
  117. package/dist/globals/TermsOfUse/index.js +31 -0
  118. package/dist/globals/TermsOfUse/index.js.map +1 -0
  119. package/dist/globals/index.d.ts +3 -0
  120. package/dist/globals/index.d.ts.map +1 -0
  121. package/dist/globals/index.js +3 -0
  122. package/dist/globals/index.js.map +1 -0
  123. package/dist/index.d.ts +13 -0
  124. package/dist/index.d.ts.map +1 -0
  125. package/dist/index.js +20 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/tasks/index.d.ts +2 -0
  128. package/dist/tasks/index.d.ts.map +1 -0
  129. package/dist/tasks/index.js +2 -0
  130. package/dist/tasks/index.js.map +1 -0
  131. package/dist/tasks/process-email-queue.d.ts +46 -0
  132. package/dist/tasks/process-email-queue.d.ts.map +1 -0
  133. package/dist/tasks/process-email-queue.js +199 -0
  134. package/dist/tasks/process-email-queue.js.map +1 -0
  135. package/dist/types/index.d.ts +14 -0
  136. package/dist/types/index.d.ts.map +1 -0
  137. package/dist/types/index.js +2 -0
  138. package/dist/types/index.js.map +1 -0
  139. package/dist/types/slug.d.ts +2 -0
  140. package/dist/types/slug.d.ts.map +1 -0
  141. package/dist/types/slug.js +11 -0
  142. package/dist/types/slug.js.map +1 -0
  143. package/dist/utils/database-dates.d.ts +3 -0
  144. package/dist/utils/database-dates.d.ts.map +1 -0
  145. package/dist/utils/database-dates.js +6 -0
  146. package/dist/utils/database-dates.js.map +1 -0
  147. package/dist/utils/email/generate-email-html.d.ts +23 -0
  148. package/dist/utils/email/generate-email-html.d.ts.map +1 -0
  149. package/dist/utils/email/generate-email-html.js +42 -0
  150. package/dist/utils/email/generate-email-html.js.map +1 -0
  151. package/dist/utils/email/get-email-template.d.ts +8 -0
  152. package/dist/utils/email/get-email-template.d.ts.map +1 -0
  153. package/dist/utils/email/get-email-template.js +14 -0
  154. package/dist/utils/email/get-email-template.js.map +1 -0
  155. package/dist/utils/email/index.d.ts +4 -0
  156. package/dist/utils/email/index.d.ts.map +1 -0
  157. package/dist/utils/email/index.js +4 -0
  158. package/dist/utils/email/index.js.map +1 -0
  159. package/dist/utils/email/queue-email.d.ts +29 -0
  160. package/dist/utils/email/queue-email.d.ts.map +1 -0
  161. package/dist/utils/email/queue-email.js +79 -0
  162. package/dist/utils/email/queue-email.js.map +1 -0
  163. package/dist/utils/get-global.d.ts +6 -0
  164. package/dist/utils/get-global.d.ts.map +1 -0
  165. package/dist/utils/get-global.js +20 -0
  166. package/dist/utils/get-global.js.map +1 -0
  167. package/dist/utils/id-from-payload.d.ts +4 -0
  168. package/dist/utils/id-from-payload.d.ts.map +1 -0
  169. package/dist/utils/id-from-payload.js +10 -0
  170. package/dist/utils/id-from-payload.js.map +1 -0
  171. package/dist/utils/index.d.ts +4 -0
  172. package/dist/utils/index.d.ts.map +1 -0
  173. package/dist/utils/index.js +4 -0
  174. package/dist/utils/index.js.map +1 -0
  175. package/dist/utils/migrations.d.ts +2 -0
  176. package/dist/utils/migrations.d.ts.map +1 -0
  177. package/dist/utils/migrations.js +18 -0
  178. package/dist/utils/migrations.js.map +1 -0
  179. package/dist/utils/payload-client.d.ts +10 -0
  180. package/dist/utils/payload-client.d.ts.map +1 -0
  181. package/dist/utils/payload-client.js +14 -0
  182. package/dist/utils/payload-client.js.map +1 -0
  183. package/dist/utils/slugify.d.ts +8 -0
  184. package/dist/utils/slugify.d.ts.map +1 -0
  185. package/dist/utils/slugify.js +15 -0
  186. package/dist/utils/slugify.js.map +1 -0
  187. package/eslint.config.mjs +90 -0
  188. package/package.json +139 -0
  189. package/pnpm-workspace.yaml +4 -0
  190. package/src/access/adminAccessOnly.ts +13 -0
  191. package/src/access/admins.ts +78 -0
  192. package/src/access/anyone.ts +35 -0
  193. package/src/access/authenticated.ts +70 -0
  194. package/src/access/authenticatedAccessOnly.ts +13 -0
  195. package/src/access/index.ts +6 -0
  196. package/src/access/publicReadAuthenticatedAccess.ts +14 -0
  197. package/src/collections/ContactMessages/hooks/sendEmailNotification.ts +58 -0
  198. package/src/collections/ContactMessages/index.ts +100 -0
  199. package/src/collections/EmailTemplates/index.ts +89 -0
  200. package/src/collections/Media/index.ts +24 -0
  201. package/src/collections/QueuedEmails/components/HtmlViewer.tsx +16 -0
  202. package/src/collections/QueuedEmails/components/RetryEmailButtons.tsx +115 -0
  203. package/src/collections/QueuedEmails/index.ts +246 -0
  204. package/src/collections/Users/auth-emails/forgot-password-email.ts +135 -0
  205. package/src/collections/Users/auth-emails/verify-email.ts +123 -0
  206. package/src/collections/Users/hooks/ensureFirstUserIsAdmin.ts +22 -0
  207. package/src/collections/Users/index.ts +201 -0
  208. package/src/collections/index.ts +23 -0
  209. package/src/components/index.ts +3 -0
  210. package/src/forms/states.ts +23 -0
  211. package/src/forms/translate-errors.ts +13 -0
  212. package/src/forms/validators.ts +33 -0
  213. package/src/globals/PrivacyPolicy/hooks/revalidate-cache.ts +5 -0
  214. package/src/globals/PrivacyPolicy/index.ts +33 -0
  215. package/src/globals/TermsOfUse/hooks/revalidate-cache.ts +5 -0
  216. package/src/globals/TermsOfUse/index.ts +33 -0
  217. package/src/globals/index.ts +2 -0
  218. package/src/index.ts +26 -0
  219. package/src/tasks/index.ts +7 -0
  220. package/src/tasks/process-email-queue.ts +261 -0
  221. package/src/types/index.ts +15 -0
  222. package/src/types/slug.ts +11 -0
  223. package/src/utils/database-dates.ts +6 -0
  224. package/src/utils/email/generate-email-html.ts +63 -0
  225. package/src/utils/email/get-email-template.ts +18 -0
  226. package/src/utils/email/index.ts +3 -0
  227. package/src/utils/email/queue-email.ts +109 -0
  228. package/src/utils/get-global.ts +25 -0
  229. package/src/utils/id-from-payload.ts +11 -0
  230. package/src/utils/index.ts +3 -0
  231. package/src/utils/migrations.ts +18 -0
  232. package/src/utils/payload-client.ts +16 -0
  233. package/src/utils/slugify.ts +21 -0
  234. package/tests/fixtures/email-template.html +58 -0
  235. package/tests/fixtures/sample-data.ts +56 -0
  236. package/tests/helpers/create-test-user.ts +37 -0
  237. package/tests/helpers/init-payload.ts +59 -0
  238. package/tests/setup.integration.ts +9 -0
  239. package/tests/setup.ts +4 -0
  240. package/tests/unit/access/adminAccessOnly.spec.ts +117 -0
  241. package/tests/unit/access/admins.spec.ts +68 -0
  242. package/tests/unit/access/anyone.spec.ts +28 -0
  243. package/tests/unit/access/authenticated.spec.ts +53 -0
  244. package/tests/unit/access/authenticatedAccessOnly.spec.ts +112 -0
  245. package/tests/unit/access/publicReadAuthenticatedAccess.spec.ts +112 -0
  246. package/tests/unit/forms/validators.spec.ts +348 -0
  247. package/tests/unit/utils/database-dates.spec.ts +97 -0
  248. package/tests/unit/utils/id-from-payload.spec.ts +142 -0
  249. package/tests/unit/utils/slugify.spec.ts +185 -0
  250. package/tsconfig.json +31 -0
  251. package/typedoc.json +40 -0
  252. package/vitest.config.ts +31 -0
  253. package/vitest.integration.config.ts +27 -0
@@ -0,0 +1,185 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { slugify } from '@/utils/slugify';
3
+
4
+ describe('slugify utility', () => {
5
+ describe('basic functionality', () => {
6
+ it('should convert string to lowercase slug', () => {
7
+ expect(slugify('Hello World')).toBe('hello-world');
8
+ });
9
+
10
+ it('should handle empty strings', () => {
11
+ expect(slugify('')).toBe('');
12
+ });
13
+
14
+ it('should handle undefined (uses default empty string)', () => {
15
+ expect(slugify(undefined as any)).toBe('');
16
+ });
17
+
18
+ it('should trim whitespace by default', () => {
19
+ expect(slugify(' hello ')).toBe('hello');
20
+ });
21
+
22
+ it('should replace spaces with hyphens', () => {
23
+ expect(slugify('hello world test')).toBe('hello-world-test');
24
+ });
25
+
26
+ it('should handle multiple consecutive spaces', () => {
27
+ expect(slugify('hello world')).toBe('hello-world');
28
+ });
29
+ });
30
+
31
+ describe('special character removal', () => {
32
+ it('should remove question marks', () => {
33
+ expect(slugify('Hello?')).toBe('hello');
34
+ });
35
+
36
+ it('should remove exclamation marks', () => {
37
+ expect(slugify('Hello!')).toBe('hello');
38
+ });
39
+
40
+ it('should remove parentheses', () => {
41
+ expect(slugify('Hello (World)')).toBe('hello-world');
42
+ });
43
+
44
+ it('should remove quotes', () => {
45
+ expect(slugify('Hello \'World\' "Test"')).toBe('hello-world-test');
46
+ });
47
+
48
+ it('should remove or replace special characters', () => {
49
+ expect(slugify('a*b+c~d.e(f)g\'h"i!j:k@l')).toBe('abcdefghijkl');
50
+ // Note: slugify converts some chars to words (< = less, > = greater, & = and, | = or, % = percent, $ = dollar)
51
+ const result = slugify('a<b>c&d|e%f$g');
52
+ expect(result).toContain('a');
53
+ expect(result).toContain('g');
54
+ // Just verify it's a valid slug
55
+ expect(result).toMatch(/^[a-z0-9-]+$/);
56
+ });
57
+
58
+ it('should keep alphanumeric characters', () => {
59
+ expect(slugify('abc123xyz')).toBe('abc123xyz');
60
+ });
61
+
62
+ it('should handle accented characters', () => {
63
+ expect(slugify('Café')).toBe('cafe');
64
+ expect(slugify('naïve')).toBe('naive');
65
+ });
66
+ });
67
+
68
+ describe('options: trim', () => {
69
+ it('should trim when trim is true', () => {
70
+ expect(slugify(' hello ', { trim: true })).toBe('hello');
71
+ });
72
+
73
+ it('should not trim when trim is false', () => {
74
+ const result = slugify(' hello ', { trim: false });
75
+ expect(result).not.toBe('hello');
76
+ expect(result).toMatch(/hello/);
77
+ });
78
+
79
+ it('should trim by default', () => {
80
+ expect(slugify(' hello ')).toBe('hello');
81
+ });
82
+ });
83
+
84
+ describe('options: lower', () => {
85
+ it('should convert to lowercase when lower is true', () => {
86
+ expect(slugify('HELLO WORLD', { lower: true })).toBe('hello-world');
87
+ });
88
+
89
+ it('should preserve case when lower is false', () => {
90
+ expect(slugify('HELLO WORLD', { lower: false })).toBe('HELLO-WORLD');
91
+ });
92
+
93
+ it('should convert to lowercase by default', () => {
94
+ expect(slugify('HELLO WORLD')).toBe('hello-world');
95
+ });
96
+ });
97
+
98
+ describe('options: locale', () => {
99
+ it('should handle French locale', () => {
100
+ expect(slugify('Café', { locale: 'fr' })).toBe('cafe');
101
+ });
102
+
103
+ it('should handle German locale with umlauts', () => {
104
+ // Note: slugify may transliterate differently depending on locale
105
+ const result = slugify('Über', { locale: 'de' });
106
+ expect(result).toMatch(/^(uber|ueber)$/); // Can be either depending on transliteration
107
+ });
108
+
109
+ it('should work without locale option', () => {
110
+ expect(slugify('Café')).toBe('cafe');
111
+ });
112
+ });
113
+
114
+ describe('options: remove (custom removal pattern)', () => {
115
+ it('should use custom remove pattern', () => {
116
+ // The remove option removes characters before slugification
117
+ const result = slugify('a@b#c', { remove: /@/g });
118
+ expect(result).toContain('b');
119
+ expect(result).not.toContain('@');
120
+ // Note: custom remove doesn't override default behavior, it adds to it
121
+ // The # may or may not be present depending on how the library processes it
122
+ });
123
+
124
+ it('should remove multiple custom characters', () => {
125
+ const result = slugify('a@b@c', { remove: /@/g });
126
+ expect(result).not.toContain('@');
127
+ expect(result).toMatch(/^[a-z0-9-]+$/);
128
+ });
129
+
130
+ it('should remove specified pattern', () => {
131
+ // Custom remove pattern removes the specified characters
132
+ const result = slugify('a@b#c', { remove: /@/g });
133
+ expect(result).not.toContain('@');
134
+ // # is handled by default remove pattern
135
+ });
136
+ });
137
+
138
+ describe('combined options', () => {
139
+ it('should handle multiple options together', () => {
140
+ expect(
141
+ slugify(' Café WORLD! ', {
142
+ trim: true,
143
+ lower: true,
144
+ locale: 'fr',
145
+ })
146
+ ).toBe('cafe-world');
147
+ });
148
+
149
+ it('should handle trim=false and lower=false', () => {
150
+ const result = slugify(' HELLO ', { trim: false, lower: false });
151
+ expect(result).toMatch(/HELLO/);
152
+ });
153
+ });
154
+
155
+ describe('edge cases', () => {
156
+ it('should handle single character', () => {
157
+ expect(slugify('a')).toBe('a');
158
+ });
159
+
160
+ it('should handle numbers only', () => {
161
+ expect(slugify('123')).toBe('123');
162
+ });
163
+
164
+ it('should handle hyphenated strings', () => {
165
+ expect(slugify('hello-world')).toBe('hello-world');
166
+ });
167
+
168
+ it('should handle underscores', () => {
169
+ expect(slugify('hello_world')).toBe('hello_world');
170
+ });
171
+
172
+ it('should handle mixed case with numbers', () => {
173
+ expect(slugify('Test123ABC')).toBe('test123abc');
174
+ });
175
+
176
+ it('should handle strings with only special characters', () => {
177
+ expect(slugify('!!!')).toBe('');
178
+ });
179
+
180
+ it('should handle long strings', () => {
181
+ const long = 'a'.repeat(100);
182
+ expect(slugify(long)).toBe(long);
183
+ });
184
+ });
185
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "resolveJsonModule": true,
8
+ "allowJs": true,
9
+ "checkJs": false,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "strict": true,
16
+ "noUnusedLocals": true,
17
+ "noUnusedParameters": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "esModuleInterop": true,
20
+ "skipLibCheck": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "jsx": "react-jsx",
23
+ "types": ["node"],
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"]
27
+ }
28
+ },
29
+ "include": ["src/**/*"],
30
+ "exclude": ["node_modules", "dist"]
31
+ }
package/typedoc.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "name": "@latte-macchiat-io/latte-payload",
4
+ "entryPoints": ["src/index.ts"],
5
+ "out": "docs",
6
+ "readme": "README.md",
7
+ "tsconfig": "tsconfig.json",
8
+ "exclude": [
9
+ "**/*.spec.ts",
10
+ "**/*.test.ts",
11
+ "**/node_modules/**",
12
+ "**/dist/**",
13
+ "**/tests/**"
14
+ ],
15
+ "excludePrivate": true,
16
+ "excludeProtected": false,
17
+ "excludeInternal": true,
18
+ "includeVersion": true,
19
+ "sort": ["source-order"],
20
+ "categorizeByGroup": true,
21
+ "categoryOrder": [
22
+ "Collections",
23
+ "Globals",
24
+ "Access Control",
25
+ "Utilities",
26
+ "Components",
27
+ "Tasks",
28
+ "Types",
29
+ "*"
30
+ ],
31
+ "navigation": {
32
+ "includeCategories": true,
33
+ "includeGroups": true
34
+ },
35
+ "theme": "default",
36
+ "githubPages": false,
37
+ "hideGenerator": false,
38
+ "searchInComments": true,
39
+ "searchInDocuments": true
40
+ }
@@ -0,0 +1,31 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import path from 'path';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ name: 'latte-payload-unit',
7
+ globals: true,
8
+ environment: 'node',
9
+ setupFiles: ['./tests/setup.ts'],
10
+ include: ['tests/unit/**/*.spec.ts'],
11
+ exclude: ['**/node_modules/**', '**/dist/**'],
12
+ coverage: {
13
+ provider: 'v8',
14
+ reporter: ['text', 'json', 'html', 'lcov'],
15
+ reportsDirectory: './coverage',
16
+ include: ['src/**/*.ts', 'src/**/*.tsx'],
17
+ exclude: ['src/**/*.d.ts', 'src/**/index.ts', 'src/types/**'],
18
+ thresholds: {
19
+ lines: 60,
20
+ functions: 60,
21
+ branches: 60,
22
+ statements: 60,
23
+ },
24
+ },
25
+ },
26
+ resolve: {
27
+ alias: {
28
+ '@': path.resolve(__dirname, './src'),
29
+ },
30
+ },
31
+ });
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import path from 'path';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ name: 'latte-payload-integration',
7
+ globals: true,
8
+ environment: 'node',
9
+ setupFiles: ['./tests/setup.integration.ts'],
10
+ include: ['tests/integration/**/*.int.spec.ts'],
11
+ exclude: ['**/node_modules/**', '**/dist/**'],
12
+ testTimeout: 90000, // 90 seconds for Payload operations
13
+ hookTimeout: 90000,
14
+ fileParallelism: false, // Sequential execution for database tests
15
+ pool: 'forks',
16
+ poolOptions: {
17
+ forks: {
18
+ singleFork: true, // Single process to avoid database conflicts
19
+ },
20
+ },
21
+ },
22
+ resolve: {
23
+ alias: {
24
+ '@': path.resolve(__dirname, './src'),
25
+ },
26
+ },
27
+ });