@localazy/strapi-plugin 0.1.9 → 0.1.11-rc.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.
Files changed (45) hide show
  1. package/.eslintrc +6 -2
  2. package/.nvmrc +1 -1
  3. package/admin/src/modules/@common/models/supported-content-type-fields.js +8 -0
  4. package/admin/src/modules/plugin-settings/components/Tree/index.js +2 -0
  5. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +4 -4
  6. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +3 -1
  7. package/package.json +1 -1
  8. package/server/bootstrap.js +15 -1
  9. package/server/controllers/localazy-transfer-controller.js +45 -47
  10. package/server/functions/should-set-downloaded-property.js +16 -0
  11. package/server/models/supported-content-type-fields.js +8 -0
  12. package/server/services/index.js +2 -0
  13. package/server/services/strapi-i18n-service.js +4 -3
  14. package/server/services/strapi-localazy-i18n-service.js +104 -0
  15. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +5761 -0
  16. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +536 -0
  17. package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +35157 -0
  18. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +202 -0
  19. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +2700 -0
  20. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +47 -0
  21. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +169 -0
  22. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +3003 -0
  23. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +2057 -0
  24. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +46 -0
  25. package/server/tests/fixtures/{all-models-with-multimedia.js → strapi-plugin-all-models.js} +717 -540
  26. package/server/utils/__tests__/get-models-tree.test.js +1 -1
  27. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +74 -107
  28. package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +396 -133
  29. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +852 -0
  30. package/server/utils/get-full-populate-object.js +56 -0
  31. package/server/utils/get-models-tree.js +3 -1
  32. package/server/utils/model-utils.js +38 -0
  33. package/server/utils/parsed-localazy-entry-to-create-entry.js +24 -24
  34. package/server/utils/parsed-localazy-entry-to-update-entry.js +43 -4
  35. package/server/utils/pick-entries.js +2 -1
  36. package/server/utils/populate-create-update-entry-with-base-entry.js +222 -0
  37. package/server/utils/reset-array-keys-deep.js +19 -0
  38. package/server/utils/transfer-setup-utils.js +14 -0
  39. package/server/tests/fixtures/restaurant-model.js +0 -230
  40. package/server/tests/fixtures/restaurants-entries.js +0 -152
  41. package/server/tests/fixtures/strapi-book-with-multimedia-components-cs.js +0 -31
  42. package/server/tests/fixtures/stringified-book-cs.js +0 -3
  43. package/server/tests/fixtures/stringified-book-with-multimedia-components-cs.js +0 -3
  44. package/server/tests/fixtures/stringified-restaurant-cs.js +0 -3
  45. package/server/tests/fixtures/stringified-restaurant-de.js +0 -5
@@ -0,0 +1,536 @@
1
+ const parsedLocalazyEntry = {
2
+ name: "hlad, okno",
3
+ description: "Orientální pouliční jídlo v ústech rychlé a snadné!",
4
+ };
5
+
6
+ const baseEntry = {
7
+ id: 1,
8
+ name: "Hungry Window",
9
+ description: "Oriental street food in your mouth quick and easy!",
10
+ established_at: "2022-10-01",
11
+ is_franchise: false,
12
+ contact_email: "david@localazy.com",
13
+ createdAt: "2022-10-04T09:12:51.141Z",
14
+ updatedAt: "2022-10-06T09:43:22.547Z",
15
+ publishedAt: null,
16
+ locale: "en",
17
+ cuisine: "Thai",
18
+ featured_image: null,
19
+ localizations: [
20
+ {
21
+ id: 53,
22
+ name: "Ventana hambrienta",
23
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
24
+ established_at: "2022-10-01",
25
+ is_franchise: false,
26
+ contact_email: "david@localazy.com",
27
+ createdAt: "2022-10-06T09:43:22.534Z",
28
+ updatedAt: "2022-10-06T14:31:51.315Z",
29
+ publishedAt: null,
30
+ locale: "es",
31
+ cuisine: "Thai",
32
+ featured_image: null,
33
+ localizations: [
34
+ {
35
+ id: 51,
36
+ name: "Głodne okno",
37
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
38
+ established_at: "2022-10-01",
39
+ is_franchise: false,
40
+ contact_email: "david@localazy.com",
41
+ createdAt: "2022-10-05T13:51:44.550Z",
42
+ updatedAt: "2022-10-06T14:31:52.246Z",
43
+ publishedAt: null,
44
+ locale: "pl",
45
+ cuisine: "Thai",
46
+ featured_image: null,
47
+ localizations: [
48
+ {
49
+ id: 53,
50
+ name: "Ventana hambrienta",
51
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
52
+ established_at: "2022-10-01",
53
+ is_franchise: false,
54
+ contact_email: "david@localazy.com",
55
+ createdAt: "2022-10-06T09:43:22.534Z",
56
+ updatedAt: "2022-10-06T14:31:51.315Z",
57
+ publishedAt: null,
58
+ locale: "es",
59
+ cuisine: "Thai",
60
+ featured_image: null,
61
+ createdBy: null,
62
+ updatedBy: null,
63
+ localizations: [
64
+ {
65
+ id: 51,
66
+ name: "Głodne okno",
67
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
68
+ established_at: "2022-10-01",
69
+ is_franchise: false,
70
+ contact_email: "david@localazy.com",
71
+ createdAt: "2022-10-05T13:51:44.550Z",
72
+ updatedAt: "2022-10-06T14:31:52.246Z",
73
+ publishedAt: null,
74
+ locale: "pl",
75
+ cuisine: "Thai",
76
+ },
77
+ {
78
+ id: 1,
79
+ name: "Hungry Window",
80
+ description: "Oriental street food in your mouth quick and easy!",
81
+ established_at: "2022-10-01",
82
+ is_franchise: false,
83
+ contact_email: "david@localazy.com",
84
+ createdAt: "2022-10-04T09:12:51.141Z",
85
+ updatedAt: "2022-10-06T09:43:22.547Z",
86
+ publishedAt: null,
87
+ locale: "en",
88
+ cuisine: "Thai",
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ id: 1,
94
+ name: "Hungry Window",
95
+ description: "Oriental street food in your mouth quick and easy!",
96
+ established_at: "2022-10-01",
97
+ is_franchise: false,
98
+ contact_email: "david@localazy.com",
99
+ createdAt: "2022-10-04T09:12:51.141Z",
100
+ updatedAt: "2022-10-06T09:43:22.547Z",
101
+ publishedAt: null,
102
+ locale: "en",
103
+ cuisine: "Thai",
104
+ featured_image: null,
105
+ createdBy: {
106
+ id: 1,
107
+ firstname: "David",
108
+ lastname: "Vaclavek",
109
+ username: null,
110
+ email: "david@localazy.com",
111
+ password: "$2a$10$pRWPPnTWp8HFWPR7aD4Pju2nNBD9vyNPt.QaMpU9IA6pMoGFl7eVC",
112
+ resetPasswordToken: null,
113
+ registrationToken: null,
114
+ isActive: true,
115
+ blocked: false,
116
+ preferedLanguage: null,
117
+ createdAt: "2022-07-11T11:58:02.016Z",
118
+ updatedAt: "2022-07-11T12:56:16.558Z",
119
+ },
120
+ updatedBy: {
121
+ id: 1,
122
+ firstname: "David",
123
+ lastname: "Vaclavek",
124
+ username: null,
125
+ email: "david@localazy.com",
126
+ password: "$2a$10$pRWPPnTWp8HFWPR7aD4Pju2nNBD9vyNPt.QaMpU9IA6pMoGFl7eVC",
127
+ resetPasswordToken: null,
128
+ registrationToken: null,
129
+ isActive: true,
130
+ blocked: false,
131
+ preferedLanguage: null,
132
+ createdAt: "2022-07-11T11:58:02.016Z",
133
+ updatedAt: "2022-07-11T12:56:16.558Z",
134
+ },
135
+ localizations: [
136
+ {
137
+ id: 51,
138
+ name: "Głodne okno",
139
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
140
+ established_at: "2022-10-01",
141
+ is_franchise: false,
142
+ contact_email: "david@localazy.com",
143
+ createdAt: "2022-10-05T13:51:44.550Z",
144
+ updatedAt: "2022-10-06T14:31:52.246Z",
145
+ publishedAt: null,
146
+ locale: "pl",
147
+ cuisine: "Thai",
148
+ },
149
+ {
150
+ id: 53,
151
+ name: "Ventana hambrienta",
152
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
153
+ established_at: "2022-10-01",
154
+ is_franchise: false,
155
+ contact_email: "david@localazy.com",
156
+ createdAt: "2022-10-06T09:43:22.534Z",
157
+ updatedAt: "2022-10-06T14:31:51.315Z",
158
+ publishedAt: null,
159
+ locale: "es",
160
+ cuisine: "Thai",
161
+ },
162
+ ],
163
+ },
164
+ ],
165
+ },
166
+ {
167
+ id: 1,
168
+ name: "Hungry Window",
169
+ description: "Oriental street food in your mouth quick and easy!",
170
+ established_at: "2022-10-01",
171
+ is_franchise: false,
172
+ contact_email: "david@localazy.com",
173
+ createdAt: "2022-10-04T09:12:51.141Z",
174
+ updatedAt: "2022-10-06T09:43:22.547Z",
175
+ publishedAt: null,
176
+ locale: "en",
177
+ cuisine: "Thai",
178
+ featured_image: null,
179
+ localizations: [
180
+ {
181
+ id: 51,
182
+ name: "Głodne okno",
183
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
184
+ established_at: "2022-10-01",
185
+ is_franchise: false,
186
+ contact_email: "david@localazy.com",
187
+ createdAt: "2022-10-05T13:51:44.550Z",
188
+ updatedAt: "2022-10-06T14:31:52.246Z",
189
+ publishedAt: null,
190
+ locale: "pl",
191
+ cuisine: "Thai",
192
+ featured_image: null,
193
+ createdBy: null,
194
+ updatedBy: null,
195
+ localizations: [
196
+ {
197
+ id: 53,
198
+ name: "Ventana hambrienta",
199
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
200
+ established_at: "2022-10-01",
201
+ is_franchise: false,
202
+ contact_email: "david@localazy.com",
203
+ createdAt: "2022-10-06T09:43:22.534Z",
204
+ updatedAt: "2022-10-06T14:31:51.315Z",
205
+ publishedAt: null,
206
+ locale: "es",
207
+ cuisine: "Thai",
208
+ },
209
+ {
210
+ id: 1,
211
+ name: "Hungry Window",
212
+ description: "Oriental street food in your mouth quick and easy!",
213
+ established_at: "2022-10-01",
214
+ is_franchise: false,
215
+ contact_email: "david@localazy.com",
216
+ createdAt: "2022-10-04T09:12:51.141Z",
217
+ updatedAt: "2022-10-06T09:43:22.547Z",
218
+ publishedAt: null,
219
+ locale: "en",
220
+ cuisine: "Thai",
221
+ },
222
+ ],
223
+ },
224
+ {
225
+ id: 53,
226
+ name: "Ventana hambrienta",
227
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
228
+ established_at: "2022-10-01",
229
+ is_franchise: false,
230
+ contact_email: "david@localazy.com",
231
+ createdAt: "2022-10-06T09:43:22.534Z",
232
+ updatedAt: "2022-10-06T14:31:51.315Z",
233
+ publishedAt: null,
234
+ locale: "es",
235
+ cuisine: "Thai",
236
+ featured_image: null,
237
+ createdBy: null,
238
+ updatedBy: null,
239
+ localizations: [
240
+ {
241
+ id: 51,
242
+ name: "Głodne okno",
243
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
244
+ established_at: "2022-10-01",
245
+ is_franchise: false,
246
+ contact_email: "david@localazy.com",
247
+ createdAt: "2022-10-05T13:51:44.550Z",
248
+ updatedAt: "2022-10-06T14:31:52.246Z",
249
+ publishedAt: null,
250
+ locale: "pl",
251
+ cuisine: "Thai",
252
+ },
253
+ {
254
+ id: 1,
255
+ name: "Hungry Window",
256
+ description: "Oriental street food in your mouth quick and easy!",
257
+ established_at: "2022-10-01",
258
+ is_franchise: false,
259
+ contact_email: "david@localazy.com",
260
+ createdAt: "2022-10-04T09:12:51.141Z",
261
+ updatedAt: "2022-10-06T09:43:22.547Z",
262
+ publishedAt: null,
263
+ locale: "en",
264
+ cuisine: "Thai",
265
+ },
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ ],
271
+ },
272
+ {
273
+ id: 51,
274
+ name: "Głodne okno",
275
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
276
+ established_at: "2022-10-01",
277
+ is_franchise: false,
278
+ contact_email: "david@localazy.com",
279
+ createdAt: "2022-10-05T13:51:44.550Z",
280
+ updatedAt: "2022-10-06T14:31:52.246Z",
281
+ publishedAt: null,
282
+ locale: "pl",
283
+ cuisine: "Thai",
284
+ featured_image: null,
285
+ localizations: [
286
+ {
287
+ id: 53,
288
+ name: "Ventana hambrienta",
289
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
290
+ established_at: "2022-10-01",
291
+ is_franchise: false,
292
+ contact_email: "david@localazy.com",
293
+ createdAt: "2022-10-06T09:43:22.534Z",
294
+ updatedAt: "2022-10-06T14:31:51.315Z",
295
+ publishedAt: null,
296
+ locale: "es",
297
+ cuisine: "Thai",
298
+ featured_image: null,
299
+ localizations: [
300
+ {
301
+ id: 51,
302
+ name: "Głodne okno",
303
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
304
+ established_at: "2022-10-01",
305
+ is_franchise: false,
306
+ contact_email: "david@localazy.com",
307
+ createdAt: "2022-10-05T13:51:44.550Z",
308
+ updatedAt: "2022-10-06T14:31:52.246Z",
309
+ publishedAt: null,
310
+ locale: "pl",
311
+ cuisine: "Thai",
312
+ featured_image: null,
313
+ createdBy: null,
314
+ updatedBy: null,
315
+ localizations: [
316
+ {
317
+ id: 53,
318
+ name: "Ventana hambrienta",
319
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
320
+ established_at: "2022-10-01",
321
+ is_franchise: false,
322
+ contact_email: "david@localazy.com",
323
+ createdAt: "2022-10-06T09:43:22.534Z",
324
+ updatedAt: "2022-10-06T14:31:51.315Z",
325
+ publishedAt: null,
326
+ locale: "es",
327
+ cuisine: "Thai",
328
+ },
329
+ {
330
+ id: 1,
331
+ name: "Hungry Window",
332
+ description: "Oriental street food in your mouth quick and easy!",
333
+ established_at: "2022-10-01",
334
+ is_franchise: false,
335
+ contact_email: "david@localazy.com",
336
+ createdAt: "2022-10-04T09:12:51.141Z",
337
+ updatedAt: "2022-10-06T09:43:22.547Z",
338
+ publishedAt: null,
339
+ locale: "en",
340
+ cuisine: "Thai",
341
+ },
342
+ ],
343
+ },
344
+ {
345
+ id: 1,
346
+ name: "Hungry Window",
347
+ description: "Oriental street food in your mouth quick and easy!",
348
+ established_at: "2022-10-01",
349
+ is_franchise: false,
350
+ contact_email: "david@localazy.com",
351
+ createdAt: "2022-10-04T09:12:51.141Z",
352
+ updatedAt: "2022-10-06T09:43:22.547Z",
353
+ publishedAt: null,
354
+ locale: "en",
355
+ cuisine: "Thai",
356
+ featured_image: null,
357
+ createdBy: {
358
+ id: 1,
359
+ firstname: "David",
360
+ lastname: "Vaclavek",
361
+ username: null,
362
+ email: "david@localazy.com",
363
+ password: "$2a$10$pRWPPnTWp8HFWPR7aD4Pju2nNBD9vyNPt.QaMpU9IA6pMoGFl7eVC",
364
+ resetPasswordToken: null,
365
+ registrationToken: null,
366
+ isActive: true,
367
+ blocked: false,
368
+ preferedLanguage: null,
369
+ createdAt: "2022-07-11T11:58:02.016Z",
370
+ updatedAt: "2022-07-11T12:56:16.558Z",
371
+ },
372
+ updatedBy: {
373
+ id: 1,
374
+ firstname: "David",
375
+ lastname: "Vaclavek",
376
+ username: null,
377
+ email: "david@localazy.com",
378
+ password: "$2a$10$pRWPPnTWp8HFWPR7aD4Pju2nNBD9vyNPt.QaMpU9IA6pMoGFl7eVC",
379
+ resetPasswordToken: null,
380
+ registrationToken: null,
381
+ isActive: true,
382
+ blocked: false,
383
+ preferedLanguage: null,
384
+ createdAt: "2022-07-11T11:58:02.016Z",
385
+ updatedAt: "2022-07-11T12:56:16.558Z",
386
+ },
387
+ localizations: [
388
+ {
389
+ id: 51,
390
+ name: "Głodne okno",
391
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
392
+ established_at: "2022-10-01",
393
+ is_franchise: false,
394
+ contact_email: "david@localazy.com",
395
+ createdAt: "2022-10-05T13:51:44.550Z",
396
+ updatedAt: "2022-10-06T14:31:52.246Z",
397
+ publishedAt: null,
398
+ locale: "pl",
399
+ cuisine: "Thai",
400
+ },
401
+ {
402
+ id: 53,
403
+ name: "Ventana hambrienta",
404
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
405
+ established_at: "2022-10-01",
406
+ is_franchise: false,
407
+ contact_email: "david@localazy.com",
408
+ createdAt: "2022-10-06T09:43:22.534Z",
409
+ updatedAt: "2022-10-06T14:31:51.315Z",
410
+ publishedAt: null,
411
+ locale: "es",
412
+ cuisine: "Thai",
413
+ },
414
+ ],
415
+ },
416
+ ],
417
+ },
418
+ {
419
+ id: 1,
420
+ name: "Hungry Window",
421
+ description: "Oriental street food in your mouth quick and easy!",
422
+ established_at: "2022-10-01",
423
+ is_franchise: false,
424
+ contact_email: "david@localazy.com",
425
+ createdAt: "2022-10-04T09:12:51.141Z",
426
+ updatedAt: "2022-10-06T09:43:22.547Z",
427
+ publishedAt: null,
428
+ locale: "en",
429
+ cuisine: "Thai",
430
+ featured_image: null,
431
+ localizations: [
432
+ {
433
+ id: 51,
434
+ name: "Głodne okno",
435
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
436
+ established_at: "2022-10-01",
437
+ is_franchise: false,
438
+ contact_email: "david@localazy.com",
439
+ createdAt: "2022-10-05T13:51:44.550Z",
440
+ updatedAt: "2022-10-06T14:31:52.246Z",
441
+ publishedAt: null,
442
+ locale: "pl",
443
+ cuisine: "Thai",
444
+ featured_image: null,
445
+ createdBy: null,
446
+ updatedBy: null,
447
+ localizations: [
448
+ {
449
+ id: 53,
450
+ name: "Ventana hambrienta",
451
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
452
+ established_at: "2022-10-01",
453
+ is_franchise: false,
454
+ contact_email: "david@localazy.com",
455
+ createdAt: "2022-10-06T09:43:22.534Z",
456
+ updatedAt: "2022-10-06T14:31:51.315Z",
457
+ publishedAt: null,
458
+ locale: "es",
459
+ cuisine: "Thai",
460
+ },
461
+ {
462
+ id: 1,
463
+ name: "Hungry Window",
464
+ description: "Oriental street food in your mouth quick and easy!",
465
+ established_at: "2022-10-01",
466
+ is_franchise: false,
467
+ contact_email: "david@localazy.com",
468
+ createdAt: "2022-10-04T09:12:51.141Z",
469
+ updatedAt: "2022-10-06T09:43:22.547Z",
470
+ publishedAt: null,
471
+ locale: "en",
472
+ cuisine: "Thai",
473
+ },
474
+ ],
475
+ },
476
+ {
477
+ id: 53,
478
+ name: "Ventana hambrienta",
479
+ description: "¡Comida callejera oriental en tu boca rápida y fácil!",
480
+ established_at: "2022-10-01",
481
+ is_franchise: false,
482
+ contact_email: "david@localazy.com",
483
+ createdAt: "2022-10-06T09:43:22.534Z",
484
+ updatedAt: "2022-10-06T14:31:51.315Z",
485
+ publishedAt: null,
486
+ locale: "es",
487
+ cuisine: "Thai",
488
+ featured_image: null,
489
+ createdBy: null,
490
+ updatedBy: null,
491
+ localizations: [
492
+ {
493
+ id: 51,
494
+ name: "Głodne okno",
495
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
496
+ established_at: "2022-10-01",
497
+ is_franchise: false,
498
+ contact_email: "david@localazy.com",
499
+ createdAt: "2022-10-05T13:51:44.550Z",
500
+ updatedAt: "2022-10-06T14:31:52.246Z",
501
+ publishedAt: null,
502
+ locale: "pl",
503
+ cuisine: "Thai",
504
+ },
505
+ {
506
+ id: 1,
507
+ name: "Hungry Window",
508
+ description: "Oriental street food in your mouth quick and easy!",
509
+ established_at: "2022-10-01",
510
+ is_franchise: false,
511
+ contact_email: "david@localazy.com",
512
+ createdAt: "2022-10-04T09:12:51.141Z",
513
+ updatedAt: "2022-10-06T09:43:22.547Z",
514
+ publishedAt: null,
515
+ locale: "en",
516
+ cuisine: "Thai",
517
+ },
518
+ ],
519
+ },
520
+ ],
521
+ },
522
+ ],
523
+ },
524
+ ],
525
+ };
526
+
527
+ const uid = "api::restaurant-simple-flat.restaurant-simple-flat";
528
+
529
+ const locale = "cs";
530
+
531
+ module.exports = {
532
+ parsedLocalazyEntry,
533
+ baseEntry,
534
+ uid,
535
+ locale,
536
+ };