@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.
- package/.eslintrc +6 -2
- package/.nvmrc +1 -1
- package/admin/src/modules/@common/models/supported-content-type-fields.js +8 -0
- package/admin/src/modules/plugin-settings/components/Tree/index.js +2 -0
- package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +4 -4
- package/admin/src/modules/plugin-settings/utils/get-models-tree.js +3 -1
- package/package.json +1 -1
- package/server/bootstrap.js +15 -1
- package/server/controllers/localazy-transfer-controller.js +45 -47
- package/server/functions/should-set-downloaded-property.js +16 -0
- package/server/models/supported-content-type-fields.js +8 -0
- package/server/services/index.js +2 -0
- package/server/services/strapi-i18n-service.js +4 -3
- package/server/services/strapi-localazy-i18n-service.js +104 -0
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +5761 -0
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +536 -0
- package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +35157 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +202 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +2700 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +47 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +169 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +3003 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +2057 -0
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +46 -0
- package/server/tests/fixtures/{all-models-with-multimedia.js → strapi-plugin-all-models.js} +717 -540
- package/server/utils/__tests__/get-models-tree.test.js +1 -1
- package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +74 -107
- package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +396 -133
- package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +852 -0
- package/server/utils/get-full-populate-object.js +56 -0
- package/server/utils/get-models-tree.js +3 -1
- package/server/utils/model-utils.js +38 -0
- package/server/utils/parsed-localazy-entry-to-create-entry.js +24 -24
- package/server/utils/parsed-localazy-entry-to-update-entry.js +43 -4
- package/server/utils/pick-entries.js +2 -1
- package/server/utils/populate-create-update-entry-with-base-entry.js +222 -0
- package/server/utils/reset-array-keys-deep.js +19 -0
- package/server/utils/transfer-setup-utils.js +14 -0
- package/server/tests/fixtures/restaurant-model.js +0 -230
- package/server/tests/fixtures/restaurants-entries.js +0 -152
- package/server/tests/fixtures/strapi-book-with-multimedia-components-cs.js +0 -31
- package/server/tests/fixtures/stringified-book-cs.js +0 -3
- package/server/tests/fixtures/stringified-book-with-multimedia-components-cs.js +0 -3
- package/server/tests/fixtures/stringified-restaurant-cs.js +0 -3
- package/server/tests/fixtures/stringified-restaurant-de.js +0 -5
package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const updateEntry = {
|
|
2
|
+
id: 34,
|
|
3
|
+
title: "Jedna cholernie pusta książka kucharska",
|
|
4
|
+
author_name: "Jamie Oliver",
|
|
5
|
+
pages: 0,
|
|
6
|
+
recipes: [
|
|
7
|
+
],
|
|
8
|
+
gallery: {
|
|
9
|
+
id: 34,
|
|
10
|
+
optional_title: "Jamie's cookbook",
|
|
11
|
+
annotation: "Zupełnie nowy, zawiera zero przepisów. Stwórz własne!",
|
|
12
|
+
main_image: {
|
|
13
|
+
id: 140,
|
|
14
|
+
image_title: "Knajpa",
|
|
15
|
+
image_description: "Pub",
|
|
16
|
+
},
|
|
17
|
+
gallery: [
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const baseEntry = {
|
|
23
|
+
id: 17,
|
|
24
|
+
title: "One hell of an empty cookbook",
|
|
25
|
+
author_name: "Jamie Oliver",
|
|
26
|
+
pages: 0,
|
|
27
|
+
recipes: [
|
|
28
|
+
],
|
|
29
|
+
gallery: {
|
|
30
|
+
id: 17,
|
|
31
|
+
optional_title: "Jamie's cookbook",
|
|
32
|
+
annotation: "Brand new, contains zero recipes. Make your own!",
|
|
33
|
+
main_image: {
|
|
34
|
+
id: 81,
|
|
35
|
+
image_title: "Pub",
|
|
36
|
+
image_description: "Pub",
|
|
37
|
+
image: {
|
|
38
|
+
id: 12,
|
|
39
|
+
name: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
40
|
+
alternativeText: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
41
|
+
caption: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
42
|
+
width: 2839,
|
|
43
|
+
height: 3785,
|
|
44
|
+
formats: {
|
|
45
|
+
thumbnail: {
|
|
46
|
+
name: "thumbnail_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
47
|
+
hash: "thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
48
|
+
ext: ".jpg",
|
|
49
|
+
mime: "image/jpeg",
|
|
50
|
+
path: null,
|
|
51
|
+
width: 117,
|
|
52
|
+
height: 156,
|
|
53
|
+
size: 5.26,
|
|
54
|
+
url: "/uploads/thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
55
|
+
},
|
|
56
|
+
large: {
|
|
57
|
+
name: "large_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
58
|
+
hash: "large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
59
|
+
ext: ".jpg",
|
|
60
|
+
mime: "image/jpeg",
|
|
61
|
+
path: null,
|
|
62
|
+
width: 750,
|
|
63
|
+
height: 1000,
|
|
64
|
+
size: 114.8,
|
|
65
|
+
url: "/uploads/large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
66
|
+
},
|
|
67
|
+
medium: {
|
|
68
|
+
name: "medium_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
69
|
+
hash: "medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
70
|
+
ext: ".jpg",
|
|
71
|
+
mime: "image/jpeg",
|
|
72
|
+
path: null,
|
|
73
|
+
width: 562,
|
|
74
|
+
height: 750,
|
|
75
|
+
size: 69.07,
|
|
76
|
+
url: "/uploads/medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
77
|
+
},
|
|
78
|
+
small: {
|
|
79
|
+
name: "small_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
80
|
+
hash: "small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
81
|
+
ext: ".jpg",
|
|
82
|
+
mime: "image/jpeg",
|
|
83
|
+
path: null,
|
|
84
|
+
width: 375,
|
|
85
|
+
height: 500,
|
|
86
|
+
size: 35.47,
|
|
87
|
+
url: "/uploads/small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
hash: "rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
91
|
+
ext: ".jpg",
|
|
92
|
+
mime: "image/jpeg",
|
|
93
|
+
size: 1736.7,
|
|
94
|
+
url: "/uploads/rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
95
|
+
previewUrl: null,
|
|
96
|
+
provider: "local",
|
|
97
|
+
provider_metadata: null,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
gallery: [
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
used_in_restaurants: [
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const fullyPopulatedLocalizedEntry = {
|
|
108
|
+
id: 34,
|
|
109
|
+
title: "Jedna cholernie pusta książka kucharska",
|
|
110
|
+
author_name: "Jamie Oliver",
|
|
111
|
+
pages: 0,
|
|
112
|
+
recipes: [
|
|
113
|
+
],
|
|
114
|
+
gallery: {
|
|
115
|
+
id: 34,
|
|
116
|
+
optional_title: "Jamie's cookbook",
|
|
117
|
+
annotation: "Zupełnie nowy, zawiera zero przepisów. Stwórz własne!",
|
|
118
|
+
main_image: {
|
|
119
|
+
id: 140,
|
|
120
|
+
image_title: "Knajpa",
|
|
121
|
+
image_description: "Pub",
|
|
122
|
+
image: {
|
|
123
|
+
id: 12,
|
|
124
|
+
name: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
125
|
+
alternativeText: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
126
|
+
caption: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
127
|
+
width: 2839,
|
|
128
|
+
height: 3785,
|
|
129
|
+
formats: {
|
|
130
|
+
thumbnail: {
|
|
131
|
+
name: "thumbnail_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
132
|
+
hash: "thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
133
|
+
ext: ".jpg",
|
|
134
|
+
mime: "image/jpeg",
|
|
135
|
+
path: null,
|
|
136
|
+
width: 117,
|
|
137
|
+
height: 156,
|
|
138
|
+
size: 5.26,
|
|
139
|
+
url: "/uploads/thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
140
|
+
},
|
|
141
|
+
large: {
|
|
142
|
+
name: "large_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
143
|
+
hash: "large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
144
|
+
ext: ".jpg",
|
|
145
|
+
mime: "image/jpeg",
|
|
146
|
+
path: null,
|
|
147
|
+
width: 750,
|
|
148
|
+
height: 1000,
|
|
149
|
+
size: 114.8,
|
|
150
|
+
url: "/uploads/large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
151
|
+
},
|
|
152
|
+
medium: {
|
|
153
|
+
name: "medium_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
154
|
+
hash: "medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
155
|
+
ext: ".jpg",
|
|
156
|
+
mime: "image/jpeg",
|
|
157
|
+
path: null,
|
|
158
|
+
width: 562,
|
|
159
|
+
height: 750,
|
|
160
|
+
size: 69.07,
|
|
161
|
+
url: "/uploads/medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
162
|
+
},
|
|
163
|
+
small: {
|
|
164
|
+
name: "small_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
|
|
165
|
+
hash: "small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
166
|
+
ext: ".jpg",
|
|
167
|
+
mime: "image/jpeg",
|
|
168
|
+
path: null,
|
|
169
|
+
width: 375,
|
|
170
|
+
height: 500,
|
|
171
|
+
size: 35.47,
|
|
172
|
+
url: "/uploads/small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
hash: "rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
|
|
176
|
+
ext: ".jpg",
|
|
177
|
+
mime: "image/jpeg",
|
|
178
|
+
size: 1736.7,
|
|
179
|
+
url: "/uploads/rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
|
|
180
|
+
previewUrl: null,
|
|
181
|
+
provider: "local",
|
|
182
|
+
provider_metadata: null,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
gallery: [
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
used_in_restaurants: [
|
|
189
|
+
],
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const uid = "api::cookbook.cookbook";
|
|
193
|
+
|
|
194
|
+
const locale = "pl";
|
|
195
|
+
|
|
196
|
+
module.exports = {
|
|
197
|
+
updateEntry,
|
|
198
|
+
baseEntry,
|
|
199
|
+
fullyPopulatedLocalizedEntry,
|
|
200
|
+
uid,
|
|
201
|
+
locale,
|
|
202
|
+
};
|