@userfrosting/sprinkle-core 6.0.0-beta.7 → 6.0.0-rc.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 (67) hide show
  1. package/README.md +27 -46
  2. package/dist/Page401Unauthorized-D_EoXicK.js +11 -0
  3. package/dist/Page403Forbidden-C96BgRtx.js +11 -0
  4. package/dist/Page404NotFound-CIs-2Fy2.js +11 -0
  5. package/dist/PageError-Sk-QAv9A.js +11 -0
  6. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  7. package/dist/composables/index.d.ts +4 -0
  8. package/dist/composables/useAxiosInterceptor.d.ts +10 -0
  9. package/dist/composables/useCsrf.d.ts +18 -0
  10. package/dist/composables/useRuleSchemaAdapter.d.ts +7 -0
  11. package/dist/composables/useSprunjer.d.ts +2 -0
  12. package/dist/composables.js +151 -0
  13. package/dist/index.d.ts +18 -0
  14. package/dist/index.js +15 -0
  15. package/{app/assets/interfaces/ApiResponse.ts → dist/interfaces/ApiResponse.d.ts} +5 -6
  16. package/{app/assets/interfaces/DictionaryApi.ts → dist/interfaces/DictionaryApi.d.ts} +9 -11
  17. package/dist/interfaces/alerts.d.ts +8 -0
  18. package/{app/assets/interfaces/common.ts → dist/interfaces/common.d.ts} +1 -1
  19. package/dist/interfaces/index.d.ts +13 -0
  20. package/{app/assets/interfaces/severity.ts → dist/interfaces/severity.d.ts} +9 -9
  21. package/dist/interfaces/sprunjer.d.ts +51 -0
  22. package/{app/assets/interfaces/sprunjerApi.ts → dist/interfaces/sprunjerApi.d.ts} +12 -15
  23. package/dist/interfaces.js +5 -0
  24. package/dist/routes/index.d.ts +16 -0
  25. package/dist/routes.js +41 -0
  26. package/dist/severity-DwLpzIij.js +4 -0
  27. package/{app/assets/stores/Helpers/PluralRules.ts → dist/stores/Helpers/PluralRules.d.ts} +17 -114
  28. package/dist/stores/index.d.ts +4 -0
  29. package/dist/stores/useAlertsStore.d.ts +29 -0
  30. package/dist/stores/useConfigStore.d.ts +11 -0
  31. package/dist/stores/usePageMeta.d.ts +51 -0
  32. package/dist/stores/useTranslator.d.ts +66 -0
  33. package/dist/stores.js +7 -0
  34. package/dist/useAlertsStore-Ca6nXz8C.js +179 -0
  35. package/dist/useAxiosInterceptor-DcOpTLHG.js +68 -0
  36. package/dist/views/Page401Unauthorized.vue.d.ts +2 -0
  37. package/dist/views/Page403Forbidden.vue.d.ts +2 -0
  38. package/dist/views/Page404NotFound.vue.d.ts +2 -0
  39. package/dist/views/PageError.vue.d.ts +2 -0
  40. package/package.json +37 -9
  41. package/app/assets/composables/index.ts +0 -4
  42. package/app/assets/composables/useAxiosInterceptor.ts +0 -30
  43. package/app/assets/composables/useCsrf.ts +0 -129
  44. package/app/assets/composables/useRuleSchemaAdapter.ts +0 -205
  45. package/app/assets/composables/useSprunjer.ts +0 -188
  46. package/app/assets/index.d.ts +0 -8
  47. package/app/assets/index.ts +0 -40
  48. package/app/assets/interfaces/alerts.ts +0 -16
  49. package/app/assets/interfaces/index.ts +0 -30
  50. package/app/assets/interfaces/sprunjer.ts +0 -60
  51. package/app/assets/routes/index.ts +0 -44
  52. package/app/assets/stores/index.ts +0 -4
  53. package/app/assets/stores/useAlertsStore.ts +0 -30
  54. package/app/assets/stores/useConfigStore.ts +0 -30
  55. package/app/assets/stores/usePageMeta.ts +0 -114
  56. package/app/assets/stores/useTranslator.ts +0 -293
  57. package/app/assets/tests/composables/useCsrf.test.ts +0 -212
  58. package/app/assets/tests/composables/useRuleSchemaAdapter.test.ts +0 -657
  59. package/app/assets/tests/interfaces/alerts.test.ts +0 -43
  60. package/app/assets/tests/plugin.test.ts +0 -29
  61. package/app/assets/tests/stores/Helpers/PluralRules.test.ts +0 -440
  62. package/app/assets/tests/stores/config.test.ts +0 -42
  63. package/app/assets/tests/stores/useTranslator.test.ts +0 -373
  64. package/app/assets/views/Page401Unauthorized.vue +0 -3
  65. package/app/assets/views/Page403Forbidden.vue +0 -3
  66. package/app/assets/views/Page404NotFound.vue +0 -3
  67. package/app/assets/views/PageError.vue +0 -3
@@ -1,29 +0,0 @@
1
- import { describe, expect, test, vi } from 'vitest'
2
- import { createApp } from 'vue'
3
- import { useConfigStore } from '../stores/useConfigStore'
4
- import plugin from '..'
5
- import * as Config from '../stores/useConfigStore'
6
- import * as Translator from '../stores/useTranslator'
7
-
8
- const mockConfigStore = {
9
- load: vi.fn(),
10
- get: vi.fn().mockReturnValue('csrf')
11
- }
12
-
13
- const mockTranslatorStore = {
14
- load: vi.fn()
15
- }
16
-
17
- describe('Plugin', () => {
18
- test('should install the plugin and initiate load', () => {
19
- const app = createApp({})
20
-
21
- vi.spyOn(Config, 'useConfigStore').mockReturnValue(mockConfigStore as any)
22
- vi.spyOn(Translator, 'useTranslator').mockReturnValue(mockTranslatorStore as any)
23
-
24
- plugin.install(app)
25
-
26
- expect(useConfigStore).toHaveBeenCalled()
27
- expect(mockConfigStore.load).toHaveBeenCalled()
28
- })
29
- })
@@ -1,440 +0,0 @@
1
- import { describe, test, expect } from 'vitest'
2
- import {
3
- rule0,
4
- rule1,
5
- rule2,
6
- rule3,
7
- rule4,
8
- rule5,
9
- rule6,
10
- rule7,
11
- rule8,
12
- rule9,
13
- rule10,
14
- rule11,
15
- rule12,
16
- rule13,
17
- rule14,
18
- rule15
19
- } from '../../../stores/Helpers/PluralRules'
20
-
21
- describe('PluralRules Tests', () => {
22
- test('rule0', () => {
23
- const testCases = [
24
- [0, 1],
25
- [1, 1],
26
- [2, 1],
27
- [-2, 1],
28
- [128, 1]
29
- ]
30
-
31
- testCases.forEach(([input, expected]) => {
32
- expect(rule0(input)).toBe(expected)
33
- })
34
- })
35
-
36
- test('rule1', () => {
37
- const testCases = [
38
- [0, 2],
39
- [1, 1],
40
- [2, 2],
41
- [-2, 2],
42
- [128, 2]
43
- ]
44
-
45
- testCases.forEach(([input, expected]) => {
46
- expect(rule1(input)).toBe(expected)
47
- })
48
- })
49
-
50
- test('rule2', () => {
51
- const testCases = [
52
- [0, 1],
53
- [1, 1],
54
- [2, 2],
55
- [-2, 2],
56
- [128, 2]
57
- ]
58
-
59
- testCases.forEach(([input, expected]) => {
60
- expect(rule2(input)).toBe(expected)
61
- })
62
- })
63
-
64
- test('rule3', () => {
65
- const testCases = [
66
- [0, 1],
67
- [1, 2],
68
- [2, 3],
69
- [11, 3],
70
- [21, 2],
71
- [141, 2],
72
- [128, 3]
73
- ]
74
-
75
- testCases.forEach(([input, expected]) => {
76
- expect(rule3(input)).toBe(expected)
77
- })
78
- })
79
-
80
- test('rule4', () => {
81
- const testCases = [
82
- [0, 4],
83
- [1, 1],
84
- [2, 2],
85
- [3, 3],
86
- [11, 1],
87
- [12, 2],
88
- [13, 3],
89
- [19, 3],
90
- [20, 4],
91
- [21, 4],
92
- [128, 4]
93
- ]
94
-
95
- testCases.forEach(([input, expected]) => {
96
- expect(rule4(input)).toBe(expected)
97
- })
98
- })
99
-
100
- test('rule5', () => {
101
- const testCases = [
102
- [0, 2],
103
- [1, 1],
104
- [2, 2],
105
- [3, 2],
106
- [11, 2],
107
- [12, 2],
108
- [13, 2],
109
- [19, 2],
110
- [20, 3],
111
- [21, 3],
112
- [100, 3],
113
- [101, 2],
114
- [110, 2],
115
- [111, 2],
116
- [128, 3]
117
- ]
118
-
119
- testCases.forEach(([input, expected]) => {
120
- expect(rule5(input)).toBe(expected)
121
- })
122
- })
123
-
124
- test('rule6', () => {
125
- const testCases = [
126
- [0, 2],
127
- [1, 1],
128
- [2, 3],
129
- [3, 3],
130
- [11, 2],
131
- [12, 2],
132
- [13, 2],
133
- [19, 2],
134
- [20, 2],
135
- [21, 1],
136
- [40, 2],
137
- [100, 2],
138
- [101, 1],
139
- [110, 2],
140
- [111, 2],
141
- [128, 3]
142
- ]
143
-
144
- testCases.forEach(([input, expected]) => {
145
- expect(rule6(input)).toBe(expected)
146
- })
147
- })
148
-
149
- test('rule7', () => {
150
- const testCases = [
151
- [0, 3],
152
- [1, 1],
153
- [2, 2],
154
- [3, 2],
155
- [11, 3],
156
- [12, 3],
157
- [13, 3],
158
- [19, 3],
159
- [20, 3],
160
- [21, 1],
161
- [40, 3],
162
- [100, 3],
163
- [101, 1],
164
- [110, 3],
165
- [111, 3],
166
- [120, 3],
167
- [121, 1],
168
- [122, 2],
169
- [123, 2],
170
- [124, 2],
171
- [125, 3]
172
- ]
173
-
174
- testCases.forEach(([input, expected]) => {
175
- expect(rule7(input)).toBe(expected)
176
- })
177
- })
178
-
179
- test('rule8', () => {
180
- const testCases = [
181
- [0, 3],
182
- [1, 1],
183
- [2, 2],
184
- [3, 2],
185
- [4, 2],
186
- [5, 3],
187
- [11, 3],
188
- [12, 3],
189
- [13, 3],
190
- [19, 3],
191
- [20, 3],
192
- [21, 3],
193
- [40, 3],
194
- [100, 3],
195
- [101, 3],
196
- [110, 3],
197
- [111, 3],
198
- [128, 3]
199
- ]
200
-
201
- testCases.forEach(([input, expected]) => {
202
- expect(rule8(input)).toBe(expected)
203
- })
204
- })
205
-
206
- test('rule9', () => {
207
- const testCases = [
208
- [0, 3],
209
- [1, 1],
210
- [2, 2],
211
- [3, 2],
212
- [11, 3],
213
- [12, 3],
214
- [13, 3],
215
- [19, 3],
216
- [20, 3],
217
- [21, 3],
218
- [40, 3],
219
- [100, 3],
220
- [101, 3],
221
- [120, 3],
222
- [121, 3],
223
- [122, 2],
224
- [123, 2],
225
- [124, 2],
226
- [125, 3]
227
- ]
228
-
229
- testCases.forEach(([input, expected]) => {
230
- expect(rule9(input)).toBe(expected)
231
- })
232
- })
233
-
234
- test('rule10', () => {
235
- const testCases = [
236
- [0, 4],
237
- [1, 1],
238
- [2, 2],
239
- [3, 3],
240
- [11, 4],
241
- [12, 4],
242
- [13, 4],
243
- [19, 4],
244
- [20, 4],
245
- [21, 4],
246
- [40, 4],
247
- [100, 4],
248
- [101, 1],
249
- [102, 2],
250
- [120, 4],
251
- [121, 4],
252
- [122, 4],
253
- [123, 4],
254
- [124, 4],
255
- [125, 4],
256
- [201, 1],
257
- [202, 2],
258
- [203, 3],
259
- [204, 3],
260
- [205, 4]
261
- ]
262
-
263
- testCases.forEach(([input, expected]) => {
264
- expect(rule10(input)).toBe(expected)
265
- })
266
- })
267
-
268
- test('rule11', () => {
269
- const testCases = [
270
- [0, 5],
271
- [1, 1],
272
- [2, 2],
273
- [3, 3],
274
- [4, 3],
275
- [5, 3],
276
- [6, 3],
277
- [7, 4],
278
- [8, 4],
279
- [9, 4],
280
- [10, 4],
281
- [11, 5],
282
- [12, 5],
283
- [21, 5],
284
- [100, 5],
285
- [101, 5],
286
- [120, 5],
287
- [121, 5],
288
- [122, 5],
289
- [123, 5],
290
- [124, 5],
291
- [125, 5]
292
- ]
293
-
294
- testCases.forEach(([input, expected]) => {
295
- expect(rule11(input)).toBe(expected)
296
- })
297
- })
298
-
299
- test('rule12', () => {
300
- const testCases = [
301
- [0, 6],
302
- [1, 1],
303
- [2, 2],
304
- [3, 3],
305
- [11, 4],
306
- [12, 4],
307
- [13, 4],
308
- [19, 4],
309
- [20, 4],
310
- [21, 4],
311
- [40, 4],
312
- [100, 5],
313
- [101, 5],
314
- [102, 5],
315
- [103, 3],
316
- [109, 3],
317
- [110, 3],
318
- [111, 4],
319
- [112, 4],
320
- [120, 4],
321
- [121, 4],
322
- [122, 4],
323
- [123, 4],
324
- [124, 4],
325
- [125, 4],
326
- [200, 5]
327
- ]
328
-
329
- testCases.forEach(([input, expected]) => {
330
- expect(rule12(input)).toBe(expected)
331
- })
332
- })
333
-
334
- test('rule13', () => {
335
- const testCases = [
336
- [0, 2],
337
- [1, 1],
338
- [2, 2],
339
- [3, 2],
340
- [11, 3],
341
- [12, 3],
342
- [13, 3],
343
- [19, 3],
344
- [20, 4],
345
- [21, 4],
346
- [40, 4],
347
- [100, 4],
348
- [101, 2],
349
- [102, 2],
350
- [103, 2],
351
- [109, 2],
352
- [110, 2],
353
- [111, 3],
354
- [112, 3],
355
- [120, 4],
356
- [121, 4],
357
- [122, 4],
358
- [123, 4],
359
- [124, 4],
360
- [125, 4],
361
- [200, 4],
362
- [201, 2],
363
- [202, 2]
364
- ]
365
-
366
- testCases.forEach(([input, expected]) => {
367
- expect(rule13(input)).toBe(expected)
368
- })
369
- })
370
-
371
- test('rule14', () => {
372
- const testCases = [
373
- [0, 3],
374
- [1, 1],
375
- [2, 2],
376
- [3, 3],
377
- [11, 1],
378
- [12, 2],
379
- [13, 3],
380
- [19, 3],
381
- [20, 3],
382
- [21, 1],
383
- [40, 3],
384
- [100, 3],
385
- [101, 1],
386
- [102, 2],
387
- [103, 3],
388
- [109, 3],
389
- [110, 3],
390
- [111, 1],
391
- [112, 2],
392
- [120, 3],
393
- [121, 1],
394
- [122, 2],
395
- [123, 3],
396
- [124, 3],
397
- [125, 3],
398
- [200, 3]
399
- ]
400
-
401
- testCases.forEach(([input, expected]) => {
402
- expect(rule14(input)).toBe(expected)
403
- })
404
- })
405
-
406
- test('rule15', () => {
407
- const testCases = [
408
- [0, 2],
409
- [1, 1],
410
- [2, 2],
411
- [3, 2],
412
- [11, 2],
413
- [12, 2],
414
- [13, 2],
415
- [19, 2],
416
- [20, 2],
417
- [21, 1],
418
- [40, 2],
419
- [100, 2],
420
- [101, 1],
421
- [102, 2],
422
- [103, 2],
423
- [109, 2],
424
- [110, 2],
425
- [111, 2],
426
- [112, 2],
427
- [120, 2],
428
- [121, 1],
429
- [122, 2],
430
- [123, 2],
431
- [124, 2],
432
- [125, 2],
433
- [200, 2]
434
- ]
435
-
436
- testCases.forEach(([input, expected]) => {
437
- expect(rule15(input)).toBe(expected)
438
- })
439
- })
440
- })
@@ -1,42 +0,0 @@
1
- import { describe, expect, beforeEach, test, vi } from 'vitest'
2
- import { setActivePinia, createPinia } from 'pinia'
3
- import axios from 'axios'
4
- import { useConfigStore } from '../../stores/useConfigStore'
5
-
6
- const testConfig = {
7
- name: 'Test Config',
8
- description: 'Test description',
9
- api: {
10
- url: 'https://api.example.com',
11
- version: '1.0'
12
- }
13
- }
14
-
15
- describe('Config Store', () => {
16
- beforeEach(() => {
17
- setActivePinia(createPinia())
18
- })
19
-
20
- test('should load config data', async () => {
21
- // Arrange
22
- const configStore = useConfigStore()
23
- const response = { data: testConfig }
24
- vi.spyOn(axios, 'get').mockResolvedValue(response as any)
25
-
26
- // Assert initial state
27
- expect(configStore.config).toEqual({})
28
-
29
- // Act
30
- await configStore.load()
31
-
32
- // Assert
33
- expect(axios.get).toHaveBeenCalledWith('/api/config')
34
- expect(configStore.config).toStrictEqual(testConfig)
35
-
36
- // Assert get method
37
- expect(configStore.get('name')).toBe('Test Config')
38
- expect(configStore.get('api.url')).toBe('https://api.example.com')
39
- expect(configStore.get('api.version', '0.0')).toBe('1.0')
40
- expect(configStore.get('api.key', 'API_KEY')).toBe('API_KEY')
41
- })
42
- })