@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
@@ -1,230 +0,0 @@
1
- module.exports = {
2
- kind: "collectionType",
3
- collectionName: "restaurants",
4
- info: {
5
- singularName: "restaurant",
6
- pluralName: "restaurants",
7
- displayName: "Restaurant",
8
- description: "",
9
- },
10
- options: {
11
- draftAndPublish: true,
12
- },
13
- pluginOptions: {
14
- i18n: {
15
- localized: true,
16
- },
17
- },
18
- attributes: {
19
- title: {
20
- pluginOptions: {
21
- i18n: {
22
- localized: true,
23
- },
24
- },
25
- type: "string",
26
- required: true,
27
- },
28
- description: {
29
- pluginOptions: {
30
- i18n: {
31
- localized: true,
32
- },
33
- },
34
- type: "text",
35
- },
36
- books: {
37
- type: "relation",
38
- relation: "oneToMany",
39
- target: "api::book.book",
40
- },
41
- recipes: {
42
- type: "component",
43
- repeatable: true,
44
- pluginOptions: {
45
- i18n: {
46
- localized: true,
47
- },
48
- },
49
- component: "food.recipe",
50
- },
51
- descs: {
52
- type: "component",
53
- repeatable: false,
54
- pluginOptions: {
55
- i18n: {
56
- localized: true,
57
- },
58
- },
59
- component: "food.pub-component-1",
60
- },
61
- street: {
62
- pluginOptions: {
63
- i18n: {
64
- localized: true,
65
- },
66
- },
67
- type: "string",
68
- },
69
- city: {
70
- pluginOptions: {
71
- i18n: {
72
- localized: true,
73
- },
74
- },
75
- type: "string",
76
- },
77
- country: {
78
- pluginOptions: {
79
- i18n: {
80
- localized: true,
81
- },
82
- },
83
- type: "string",
84
- },
85
- createdAt: {
86
- type: "datetime",
87
- },
88
- updatedAt: {
89
- type: "datetime",
90
- },
91
- publishedAt: {
92
- type: "datetime",
93
- configurable: false,
94
- writable: true,
95
- visible: false,
96
- },
97
- createdBy: {
98
- type: "relation",
99
- relation: "oneToOne",
100
- target: "admin::user",
101
- configurable: false,
102
- writable: false,
103
- visible: false,
104
- useJoinTable: false,
105
- private: true,
106
- },
107
- updatedBy: {
108
- type: "relation",
109
- relation: "oneToOne",
110
- target: "admin::user",
111
- configurable: false,
112
- writable: false,
113
- visible: false,
114
- useJoinTable: false,
115
- private: true,
116
- },
117
- localizations: {
118
- writable: true,
119
- private: false,
120
- configurable: false,
121
- visible: false,
122
- type: "relation",
123
- relation: "oneToMany",
124
- target: "api::restaurant.restaurant",
125
- },
126
- locale: {
127
- writable: true,
128
- private: false,
129
- configurable: false,
130
- visible: false,
131
- type: "string",
132
- },
133
- },
134
- __schema__: {
135
- collectionName: "restaurants",
136
- info: {
137
- singularName: "restaurant",
138
- pluralName: "restaurants",
139
- displayName: "Restaurant",
140
- description: "",
141
- },
142
- options: {
143
- draftAndPublish: true,
144
- },
145
- pluginOptions: {
146
- i18n: {
147
- localized: true,
148
- },
149
- },
150
- attributes: {
151
- title: {
152
- pluginOptions: {
153
- i18n: {
154
- localized: true,
155
- },
156
- },
157
- type: "string",
158
- required: true,
159
- },
160
- description: {
161
- pluginOptions: {
162
- i18n: {
163
- localized: true,
164
- },
165
- },
166
- type: "text",
167
- },
168
- books: {
169
- type: "relation",
170
- relation: "oneToMany",
171
- target: "api::book.book",
172
- },
173
- recipes: {
174
- type: "component",
175
- repeatable: true,
176
- pluginOptions: {
177
- i18n: {
178
- localized: true,
179
- },
180
- },
181
- component: "food.recipe",
182
- },
183
- descs: {
184
- type: "component",
185
- repeatable: false,
186
- pluginOptions: {
187
- i18n: {
188
- localized: true,
189
- },
190
- },
191
- component: "food.pub-component-1",
192
- },
193
- street: {
194
- pluginOptions: {
195
- i18n: {
196
- localized: true,
197
- },
198
- },
199
- type: "string",
200
- },
201
- city: {
202
- pluginOptions: {
203
- i18n: {
204
- localized: true,
205
- },
206
- },
207
- type: "string",
208
- },
209
- country: {
210
- pluginOptions: {
211
- i18n: {
212
- localized: true,
213
- },
214
- },
215
- type: "string",
216
- },
217
- },
218
- kind: "collectionType",
219
- },
220
- modelType: "contentType",
221
- modelName: "restaurant",
222
- connection: "default",
223
- uid: "api::restaurant.restaurant",
224
- apiName: "restaurant",
225
- globalId: "Restaurant",
226
- actions: {},
227
- lifecycles: {},
228
- singularName: "restaurant",
229
- tableName: "restaurants",
230
- };
@@ -1,152 +0,0 @@
1
- module.exports = [
2
- {
3
- id: 1,
4
- title: "Restaurant 1",
5
- description: "Restaurant 1 description",
6
- createdAt: "2022-03-10T14:45:51.764Z",
7
- updatedAt: "2022-04-07T18:34:34.132Z",
8
- publishedAt: "2022-03-23T11:57:05.812Z",
9
- locale: "en",
10
- street: null,
11
- city: null,
12
- country: null,
13
- recipes: [
14
- {
15
- id: 1,
16
- name: null,
17
- ingredients: [
18
- {
19
- id: 1,
20
- name: null,
21
- pcs: null,
22
- required: null,
23
- },
24
- ],
25
- variants: {
26
- id: 1,
27
- name: null,
28
- },
29
- },
30
- ],
31
- descs: {
32
- id: 1,
33
- rich_description: "restaurant 1 rich_desc",
34
- history: null,
35
- excerpt: null,
36
- test_variants: {
37
- id: 2,
38
- name: null,
39
- },
40
- },
41
- },
42
- {
43
- id: 2,
44
- title: "Restaurant 2",
45
- description: "Restaurant 2 description",
46
- createdAt: "2022-03-14T10:35:27.187Z",
47
- updatedAt: "2022-04-07T18:34:34.154Z",
48
- publishedAt: "2022-03-24T13:32:31.066Z",
49
- locale: "en",
50
- street: null,
51
- city: null,
52
- country: null,
53
- recipes: [],
54
- descs: null,
55
- },
56
- {
57
- id: 3,
58
- title: "Full Restaurant",
59
- description: "With some great description",
60
- createdAt: "2022-03-24T13:17:22.161Z",
61
- updatedAt: "2022-04-07T18:34:34.168Z",
62
- publishedAt: "2022-03-24T13:37:31.870Z",
63
- locale: "en",
64
- street: "Testowa",
65
- city: "Testow",
66
- country: "Test Rep.",
67
- recipes: [
68
- {
69
- id: 3,
70
- name: "Tomato Soup",
71
- ingredients: [
72
- {
73
- id: 2,
74
- name: "Tomato",
75
- pcs: 4,
76
- required: false,
77
- },
78
- {
79
- id: 3,
80
- name: "Soup",
81
- pcs: 1,
82
- required: true,
83
- },
84
- ],
85
- variants: {
86
- id: 4,
87
- name: "Red, yellow, green",
88
- },
89
- },
90
- {
91
- id: 2,
92
- name: "Beef Broth",
93
- ingredients: [
94
- {
95
- id: 4,
96
- name: "Beef",
97
- pcs: 1,
98
- required: true,
99
- },
100
- {
101
- id: 5,
102
- name: "Water",
103
- pcs: 2,
104
- required: true,
105
- },
106
- ],
107
- variants: null,
108
- },
109
- {
110
- id: 4,
111
- name: "Goulash",
112
- ingredients: [
113
- {
114
- id: 6,
115
- name: "Beef meat",
116
- pcs: 1,
117
- required: true,
118
- },
119
- {
120
- id: 7,
121
- name: "Pepper",
122
- pcs: 4,
123
- required: null,
124
- },
125
- {
126
- id: 8,
127
- name: "Pepper spices",
128
- pcs: 1,
129
- required: true,
130
- },
131
- {
132
- id: 9,
133
- name: "Water",
134
- pcs: 1,
135
- required: null,
136
- },
137
- ],
138
- variants: null,
139
- },
140
- ],
141
- descs: {
142
- id: 3,
143
- rich_description: "Another restaurant desc",
144
- history: "Est. 2022, based in NY, NY",
145
- excerpt: "Est. 2022",
146
- test_variants: {
147
- id: 5,
148
- name: "no such thing...",
149
- },
150
- },
151
- },
152
- ];
@@ -1,31 +0,0 @@
1
- module.exports = {
2
- id: 29,
3
- Title: "Kniha s obálkou 2",
4
- Author: null,
5
- Pages: null,
6
- non_localizable_name: "Non localizable book for kids",
7
- additional_info: {
8
- id: 38,
9
- rich_description: "RD",
10
- history: "H",
11
- excerpt: "E",
12
- test_variants: {
13
- id: 38,
14
- name: "Nejsou k dispozici žádné varianty",
15
- },
16
- },
17
- seo_setup: [
18
- {
19
- id: 21,
20
- seo_desc: "nastavení 1",
21
- main_image: null,
22
- rest: null,
23
- },
24
- {
25
- id: 22,
26
- seo_desc: "nastavení 2",
27
- main_image: null,
28
- rest: null,
29
- },
30
- ],
31
- };
@@ -1,3 +0,0 @@
1
- module.exports =
2
- // eslint-disable-next-line quotes
3
- '{"Title":"Moje první dětská kniha","additional_info":[null,null,{"rich_description":"# H1\\n## H2\\n#### H4\\n\\n** Jedna** _dva_ <u>tři</u>... a možná ještě více pohádek...","history":"Není tu žádný...","excerpt":"Krátký výňatek","test_variants":[null,null,null,{"name":"toto je finální verze"}]}]}';
@@ -1,3 +0,0 @@
1
- module.exports =
2
- // eslint-disable-next-line quotes
3
- '{"seo_setup":[null,{"seo_desc":"nastavení 1"},{"seo_desc":"nastavení 2"}],"Title":"Kniha s obálkou 2","additional_info":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"rich_description":"RD","history":"H 2","excerpt":"E","test_variants":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,{"name":"Nejsou k dispozici žádné varianty, proč?"}]}]}';
@@ -1,3 +0,0 @@
1
- module.exports =
2
- // eslint-disable-next-line quotes
3
- '{"title":"Plná restaurace","description":"S nějakým skvělým popisem","recipes":[null,null,{"name":"Hovězí vývar","ingredients":[null,null,null,null,{"name":"Hovězí"},{"name":"Voda"}]},{"name":"Rajčatová polévka","ingredients":[null,null,{"name":"rajče"},{"name":"Polévka"}],"variants":[null,null,null,null,{"name":"Červená, žlutá, zelená"}]},{"name":"Guláš","ingredients":[null,null,null,null,null,null,{"name":"Hovězí maso"},{"name":"Pepř"},{"name":"pepř, koření"},{"name":"Voda"}]}],"descs":[null,null,null,{"rich_description":"Další restaurace desc","history":"Est. 2022, se sídlem v NY, NY","excerpt":"Est. 2022","test_variants":[null,null,null,null,null,{"name":"nic takového..."}]}]}';
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- module.exports =
4
- // eslint-disable-next-line quotes
5
- '{"title":"Volles Restaurant","description":"Mit einer großartigen Beschreibung","recipes":[null,null,{"name":"Rinderbrühe","ingredients":[null,null,null,null,{"name":"Rindfleisch"},{"name":"Wasser"}]},{"name":"Tomatensuppe","ingredients":[null,null,{"name":"Tomate"},{"name":"Suppe"}],"variants":[null,null,null,null,{"name":"Rot, gelb, grün"}]},{"name":"Gulasch","ingredients":[null,null,null,null,null,null,{"name":"Rindfleisch"},{"name":"Pfeffer"},{"name":"Pfeffer-Gewürze"},{"name":"Wasser"}]}],"descs":[null,null,null,{"rich_description":"Ein weiteres Restaurant desc","history":"Est. 2022, mit Sitz in NY, NY","excerpt":"Est. 2022","test_variants":[null,null,null,null,null,{"name":"so etwas nicht..."}]}]}';