@localazy/strapi-plugin 0.1.11-rc.0 → 0.1.11-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 (31) hide show
  1. package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +5 -0
  2. package/admin/src/modules/plugin-settings/components/Tree/index.js +21 -6
  3. package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +1 -1
  4. package/admin/src/modules/plugin-settings/functions/has-model-changed.js +1 -1
  5. package/admin/src/modules/plugin-settings/locale/en.js +1 -1
  6. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +1 -7
  7. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +19 -3
  8. package/package.json +4 -4
  9. package/server/controllers/localazy-transfer-controller.js +27 -7
  10. package/server/functions/should-set-downloaded-property.js +48 -3
  11. package/server/services/strapi-i18n-service.js +1 -1
  12. package/server/services/strapi-localazy-i18n-service.js +1 -1
  13. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +392 -0
  14. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-sample-json-dz.js +4675 -0
  15. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +309 -0
  16. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +884 -0
  17. package/server/tests/fixtures/strapi-plugin-all-models.js +844 -37
  18. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +211 -62
  19. package/server/utils/__tests__/pick-entries.test.js +936 -56
  20. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +287 -0
  21. package/server/utils/build-populate.js +5 -0
  22. package/server/utils/model-utils.js +5 -0
  23. package/server/utils/omit-deep.js +7 -0
  24. package/server/utils/parsed-localazy-entry-to-create-entry.js +58 -4
  25. package/server/utils/parsed-localazy-entry-to-update-entry.js +6 -1
  26. package/server/utils/pick-deep.js +22 -0
  27. package/server/utils/pick-entries.js +90 -5
  28. package/server/utils/populate-create-update-entry-with-base-entry.js +51 -3
  29. package/server/tests/fixtures/collection-flattened.js +0 -76
  30. package/server/tests/fixtures/restaurant-flattened.js +0 -46
  31. package/server/tests/fixtures/restaurants-pick-paths.js +0 -15
@@ -0,0 +1,392 @@
1
+ const parsedLocalazyEntry = {
2
+ title: "Test: Sčítání",
3
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
4
+ lesson_type: [
5
+ null,
6
+ {
7
+ title: "Vyberte správnou odpověď",
8
+ questions: [
9
+ null,
10
+ {
11
+ question: "1 + 1 = ",
12
+ },
13
+ {
14
+ question: "5 + 15 = ",
15
+ },
16
+ {
17
+ question: "Kolik pohárů je na fotce?",
18
+ },
19
+ ],
20
+ answers: [
21
+ null,
22
+ {
23
+ correct_answer: "2",
24
+ },
25
+ {
26
+ correct_answer: "20",
27
+ },
28
+ {
29
+ correct_answer: "15",
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ };
35
+
36
+ const baseEntry = {
37
+ id: 2,
38
+ title: "Test: Addition",
39
+ start_time: "2022-10-01T13:00:00.000Z",
40
+ duration: "02:00:00.000",
41
+ description: "Test your skills we've learnt in the previous lesson.",
42
+ createdAt: "2022-10-19T09:56:10.979Z",
43
+ updatedAt: "2022-10-19T12:13:58.102Z",
44
+ publishedAt: null,
45
+ locale: "en",
46
+ lesson_type: [
47
+ {
48
+ __component: "lesson.quiz",
49
+ id: 1,
50
+ title: "Choose the correct answer",
51
+ questions: [
52
+ {
53
+ id: 1,
54
+ question: "1 + 1 = ",
55
+ is_active: true,
56
+ question_number: 1,
57
+ assets: null,
58
+ },
59
+ {
60
+ id: 2,
61
+ question: "5 + 15 = ",
62
+ is_active: false,
63
+ question_number: 2,
64
+ assets: null,
65
+ },
66
+ {
67
+ id: 3,
68
+ question: "How many cups are on the photo?",
69
+ is_active: false,
70
+ question_number: 3,
71
+ assets: [
72
+ {
73
+ id: 13,
74
+ name: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
75
+ alternativeText: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
76
+ caption: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
77
+ width: 3360,
78
+ height: 5040,
79
+ formats: {
80
+ thumbnail: {
81
+ name: "thumbnail_lidya-nada-BnzqQwerUOY-unsplash.jpg",
82
+ hash: "thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
83
+ ext: ".jpg",
84
+ mime: "image/jpeg",
85
+ path: null,
86
+ width: 104,
87
+ height: 156,
88
+ size: 2.59,
89
+ url: "/uploads/thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
90
+ },
91
+ large: {
92
+ name: "large_lidya-nada-BnzqQwerUOY-unsplash.jpg",
93
+ hash: "large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
94
+ ext: ".jpg",
95
+ mime: "image/jpeg",
96
+ path: null,
97
+ width: 667,
98
+ height: 1000,
99
+ size: 38.91,
100
+ url: "/uploads/large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
101
+ },
102
+ medium: {
103
+ name: "medium_lidya-nada-BnzqQwerUOY-unsplash.jpg",
104
+ hash: "medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
105
+ ext: ".jpg",
106
+ mime: "image/jpeg",
107
+ path: null,
108
+ width: 500,
109
+ height: 750,
110
+ size: 24.62,
111
+ url: "/uploads/medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
112
+ },
113
+ small: {
114
+ name: "small_lidya-nada-BnzqQwerUOY-unsplash.jpg",
115
+ hash: "small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
116
+ ext: ".jpg",
117
+ mime: "image/jpeg",
118
+ path: null,
119
+ width: 333,
120
+ height: 500,
121
+ size: 12.98,
122
+ url: "/uploads/small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
123
+ },
124
+ },
125
+ hash: "lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
126
+ ext: ".jpg",
127
+ mime: "image/jpeg",
128
+ size: 1536.82,
129
+ url: "/uploads/lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
130
+ previewUrl: null,
131
+ provider: "local",
132
+ provider_metadata: null,
133
+ createdAt: "2022-10-19T09:57:52.620Z",
134
+ updatedAt: "2022-10-19T09:57:52.620Z",
135
+ },
136
+ ],
137
+ },
138
+ ],
139
+ answers: [
140
+ {
141
+ id: 1,
142
+ question_number: 1,
143
+ correct_answer: "2",
144
+ answer_asset: null,
145
+ },
146
+ {
147
+ id: 2,
148
+ question_number: 2,
149
+ correct_answer: "20",
150
+ answer_asset: null,
151
+ },
152
+ {
153
+ id: 3,
154
+ question_number: 3,
155
+ correct_answer: "15",
156
+ answer_asset: null,
157
+ },
158
+ ],
159
+ },
160
+ ],
161
+ localizations: [
162
+ {
163
+ id: 4,
164
+ title: "Test: Sčítání",
165
+ start_time: "2022-10-01T13:00:00.000Z",
166
+ duration: "02:00:00.000",
167
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
168
+ createdAt: "2022-10-19T12:13:58.101Z",
169
+ updatedAt: "2022-10-20T07:58:33.627Z",
170
+ publishedAt: null,
171
+ locale: "cs",
172
+ lesson_type: [
173
+ {
174
+ __component: "lesson.quiz",
175
+ id: 2,
176
+ title: "Vyberte správnou odpověď",
177
+ questions: [
178
+ {
179
+ id: 4,
180
+ question: "1 + 1 = ",
181
+ is_active: true,
182
+ question_number: 1,
183
+ assets: null,
184
+ },
185
+ {
186
+ id: 5,
187
+ question: "5 + 15 = ",
188
+ is_active: false,
189
+ question_number: 2,
190
+ assets: null,
191
+ },
192
+ {
193
+ id: 6,
194
+ question: "Kolik pohárů je na fotce?",
195
+ is_active: false,
196
+ question_number: 3,
197
+ assets: [
198
+ {
199
+ id: 13,
200
+ name: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
201
+ alternativeText: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
202
+ caption: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
203
+ width: 3360,
204
+ height: 5040,
205
+ formats: {
206
+ thumbnail: {
207
+ name: "thumbnail_lidya-nada-BnzqQwerUOY-unsplash.jpg",
208
+ hash: "thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
209
+ ext: ".jpg",
210
+ mime: "image/jpeg",
211
+ path: null,
212
+ width: 104,
213
+ height: 156,
214
+ size: 2.59,
215
+ url: "/uploads/thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
216
+ },
217
+ large: {
218
+ name: "large_lidya-nada-BnzqQwerUOY-unsplash.jpg",
219
+ hash: "large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
220
+ ext: ".jpg",
221
+ mime: "image/jpeg",
222
+ path: null,
223
+ width: 667,
224
+ height: 1000,
225
+ size: 38.91,
226
+ url: "/uploads/large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
227
+ },
228
+ medium: {
229
+ name: "medium_lidya-nada-BnzqQwerUOY-unsplash.jpg",
230
+ hash: "medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
231
+ ext: ".jpg",
232
+ mime: "image/jpeg",
233
+ path: null,
234
+ width: 500,
235
+ height: 750,
236
+ size: 24.62,
237
+ url: "/uploads/medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
238
+ },
239
+ small: {
240
+ name: "small_lidya-nada-BnzqQwerUOY-unsplash.jpg",
241
+ hash: "small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
242
+ ext: ".jpg",
243
+ mime: "image/jpeg",
244
+ path: null,
245
+ width: 333,
246
+ height: 500,
247
+ size: 12.98,
248
+ url: "/uploads/small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
249
+ },
250
+ },
251
+ hash: "lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
252
+ ext: ".jpg",
253
+ mime: "image/jpeg",
254
+ size: 1536.82,
255
+ url: "/uploads/lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
256
+ previewUrl: null,
257
+ provider: "local",
258
+ provider_metadata: null,
259
+ createdAt: "2022-10-19T09:57:52.620Z",
260
+ updatedAt: "2022-10-19T09:57:52.620Z",
261
+ },
262
+ ],
263
+ },
264
+ ],
265
+ answers: [
266
+ {
267
+ id: 4,
268
+ question_number: 1,
269
+ correct_answer: "2",
270
+ answer_asset: null,
271
+ },
272
+ {
273
+ id: 5,
274
+ question_number: 2,
275
+ correct_answer: "20",
276
+ answer_asset: null,
277
+ },
278
+ {
279
+ id: 6,
280
+ question_number: 3,
281
+ correct_answer: "15",
282
+ answer_asset: null,
283
+ },
284
+ ],
285
+ },
286
+ ],
287
+ localizations: [
288
+ {
289
+ id: 2,
290
+ title: "Test: Addition",
291
+ start_time: "2022-10-01T13:00:00.000Z",
292
+ duration: "02:00:00.000",
293
+ description: "Test your skills we've learnt in the previous lesson.",
294
+ createdAt: "2022-10-19T09:56:10.979Z",
295
+ updatedAt: "2022-10-19T12:13:58.102Z",
296
+ publishedAt: null,
297
+ locale: "en",
298
+ lesson_type: [
299
+ {
300
+ __component: "lesson.quiz",
301
+ id: 1,
302
+ title: "Choose the correct answer",
303
+ questions: [
304
+ {
305
+ id: 1,
306
+ question: "1 + 1 = ",
307
+ is_active: true,
308
+ question_number: 1,
309
+ },
310
+ {
311
+ id: 2,
312
+ question: "5 + 15 = ",
313
+ is_active: false,
314
+ question_number: 2,
315
+ },
316
+ {
317
+ id: 3,
318
+ question: "How many cups are on the photo?",
319
+ is_active: false,
320
+ question_number: 3,
321
+ },
322
+ ],
323
+ answers: [
324
+ {
325
+ id: 1,
326
+ question_number: 1,
327
+ correct_answer: "2",
328
+ },
329
+ {
330
+ id: 2,
331
+ question_number: 2,
332
+ correct_answer: "20",
333
+ },
334
+ {
335
+ id: 3,
336
+ question_number: 3,
337
+ correct_answer: "15",
338
+ },
339
+ ],
340
+ },
341
+ ],
342
+ localizations: [
343
+ {
344
+ id: 4,
345
+ title: "Test: Sčítání",
346
+ start_time: "2022-10-01T13:00:00.000Z",
347
+ duration: "02:00:00.000",
348
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
349
+ createdAt: "2022-10-19T12:13:58.101Z",
350
+ updatedAt: "2022-10-20T07:58:33.627Z",
351
+ publishedAt: null,
352
+ locale: "cs",
353
+ lesson_type: [
354
+ {
355
+ __component: "lesson.quiz",
356
+ id: 2,
357
+ title: "Vyberte správnou odpověď",
358
+ },
359
+ ],
360
+ createdBy: null,
361
+ updatedBy: null,
362
+ localizations: [
363
+ {
364
+ id: 2,
365
+ title: "Test: Addition",
366
+ start_time: "2022-10-01T13:00:00.000Z",
367
+ duration: "02:00:00.000",
368
+ description: "Test your skills we've learnt in the previous lesson.",
369
+ createdAt: "2022-10-19T09:56:10.979Z",
370
+ updatedAt: "2022-10-19T12:13:58.102Z",
371
+ publishedAt: null,
372
+ locale: "en",
373
+ },
374
+ ],
375
+ },
376
+ ],
377
+ },
378
+ ],
379
+ },
380
+ ],
381
+ };
382
+
383
+ const uid = "api::lesson.lesson";
384
+
385
+ const locale = "cs";
386
+
387
+ module.exports = {
388
+ parsedLocalazyEntry,
389
+ baseEntry,
390
+ uid,
391
+ locale,
392
+ };