@localazy/strapi-plugin 0.1.13-rc.5 → 0.1.13-rc.6
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/admin/src/modules/plugin-settings/components/GlobalSettings/index.js +8 -10
- package/package.json +2 -2
- package/server/bootstrap.js +19 -0
- package/server/config/development/index.js +1 -0
- package/server/config/example/index.js +2 -1
- package/server/config/local/index.js +1 -0
- package/server/config/production/index.js +1 -0
- package/server/controllers/localazy-transfer-controller.js +4 -3
- package/server/services/localazy-upload-service.js +11 -4
- package/admin/src/plugins/apolloClient.js +0 -33
|
@@ -200,16 +200,14 @@ function GlobalSettings() {
|
|
|
200
200
|
<Option value="updated">{t("plugin_settings.editing_data_entry")}</Option>
|
|
201
201
|
</Select>
|
|
202
202
|
{/* Deprecate source keys on deletion */}
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
onChange={e => patchFormModel("upload.allowDeprecate", e.target.checked)} />
|
|
212
|
-
</div>
|
|
203
|
+
<br /><br />
|
|
204
|
+
<ToggleInput
|
|
205
|
+
label={t("plugin_settings.deprecate_source_keys_on_delete")}
|
|
206
|
+
hint={t("plugin_settings.deprecate_source_keys_on_delete_info")}
|
|
207
|
+
offLabel={t("plugin_settings.off")}
|
|
208
|
+
onLabel={t("plugin_settings.on")}
|
|
209
|
+
checked={typeof formModel?.upload?.allowDeprecate === "boolean" ? formModel.upload.allowDeprecate : false}
|
|
210
|
+
onChange={e => patchFormModel("upload.allowDeprecate", e.target.checked)} />
|
|
213
211
|
<br /><br />
|
|
214
212
|
<Divider />
|
|
215
213
|
{/* Download Settings */}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localazy/strapi-plugin",
|
|
3
|
-
"version": "0.1.13-rc.
|
|
3
|
+
"version": "0.1.13-rc.6",
|
|
4
4
|
"description": "The official Strapi Plugin by Localazy.",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "localazy",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
42
|
-
"@localazy/ts-api": "^1.0.
|
|
42
|
+
"@localazy/ts-api": "^1.0.13",
|
|
43
43
|
"i18next": "^22.4.9",
|
|
44
44
|
"isomorphic-fetch": "^3.0.0",
|
|
45
45
|
"js-cookie": "^3.0.1",
|
package/server/bootstrap.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const deepPopulateHook = require('./lifecycles/deep-populate-hook');
|
|
4
4
|
const uploadEventEntryToLocalazyHook = require('./lifecycles/upload-event-entry-to-localazy-hook');
|
|
5
|
+
const deprecateEventEntryInLocalazyHook = require('./lifecycles/deprecate-event-entry-in-localazy-hook');
|
|
5
6
|
const RequestInitiatorHelper = require('./utils/request-initiator-helper');
|
|
6
7
|
|
|
7
8
|
module.exports = ({ strapi }) => {
|
|
@@ -34,6 +35,24 @@ module.exports = ({ strapi }) => {
|
|
|
34
35
|
break;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
case 'beforeDeleteMany':
|
|
39
|
+
case 'beforeDelete': {
|
|
40
|
+
try {
|
|
41
|
+
if (requestInitiatorHelper.isInitiatedByLocalazyWebhook() || requestInitiatorHelper.isInitiatedByLocalazyPluginUI()) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// have to await here
|
|
46
|
+
const result = await deprecateEventEntryInLocalazyHook(event);
|
|
47
|
+
if (typeof result !== 'undefined') {
|
|
48
|
+
strapi.log.info(`${action} hook result: ${JSON.stringify(result)}`);
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
strapi.log.error(e);
|
|
52
|
+
} finally {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
37
56
|
default:
|
|
38
57
|
break;
|
|
39
58
|
}
|
|
@@ -11,5 +11,6 @@ module.exports = {
|
|
|
11
11
|
LOCALAZY_DEFAULT_FILE_EXTENSION: "",
|
|
12
12
|
LOCALAZY_DEFAULT_LOCALE: "",
|
|
13
13
|
LOCALAZY_API_USER_JWT_COOKIE_NAME: "",
|
|
14
|
-
LOCALAZY_API_USER_COOKIE_EXPIRATION:
|
|
14
|
+
LOCALAZY_API_USER_COOKIE_EXPIRATION: -1,
|
|
15
|
+
LOCALAZY_PUBLIC_API_LIFTED_LIMITS: false,
|
|
15
16
|
};
|
|
@@ -177,11 +177,12 @@ module.exports = {
|
|
|
177
177
|
locale,
|
|
178
178
|
chunks
|
|
179
179
|
);
|
|
180
|
+
// Use `deprecate: "file"` if there is one chunk of transferred data only!
|
|
181
|
+
const hasMoreTransferFilesChunks = importFile.length > 1;
|
|
182
|
+
const uploadConfig = !hasMoreTransferFilesChunks ? { deprecate: "file" } : {};
|
|
180
183
|
await LocalazyUploadService.upload(
|
|
181
184
|
importFile,
|
|
182
|
-
|
|
183
|
-
// deprecate: "file"
|
|
184
|
-
// }
|
|
185
|
+
uploadConfig
|
|
185
186
|
);
|
|
186
187
|
|
|
187
188
|
ctx.body = {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const getLocalazyApi = require("../utils/get-localazy-api");
|
|
6
6
|
const delay = require("../utils/delay");
|
|
7
|
+
const config = require("../config").default;
|
|
7
8
|
|
|
8
9
|
module.exports = ({ strapi }) => ({
|
|
9
10
|
/**
|
|
@@ -45,15 +46,21 @@ module.exports = ({ strapi }) => ({
|
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Check Directus for the Lifted Limits OAuth Apps IDs
|
|
51
|
+
*/
|
|
52
|
+
CHUNK_LIMIT: config.LOCALAZY_PUBLIC_API_LIFTED_LIMITS ? 99900 : 9990,
|
|
53
|
+
|
|
54
|
+
splitToChunks(data, CHUNK_LIMIT = null) {
|
|
49
55
|
const chunks = [];
|
|
50
56
|
const keys = Object.keys(data);
|
|
51
57
|
const keysCount = keys.length;
|
|
52
|
-
const
|
|
58
|
+
const localChunkLimit = CHUNK_LIMIT || this.CHUNK_LIMIT;
|
|
59
|
+
const chunksCount = Math.ceil(keysCount / localChunkLimit);
|
|
53
60
|
for (let i = 0; i < chunksCount; i += 1) {
|
|
54
61
|
const chunkStrings = {};
|
|
55
|
-
const from =
|
|
56
|
-
const to =
|
|
62
|
+
const from = localChunkLimit * i;
|
|
63
|
+
const to = localChunkLimit * (i + 1);
|
|
57
64
|
|
|
58
65
|
const currentKeys = keys.slice(from, to);
|
|
59
66
|
currentKeys.forEach((key) => {
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApolloClient,
|
|
3
|
-
HttpLink,
|
|
4
|
-
ApolloLink,
|
|
5
|
-
InMemoryCache,
|
|
6
|
-
} from "@apollo/client";
|
|
7
|
-
import Cookies from "js-cookie";
|
|
8
|
-
|
|
9
|
-
const createClient = () => {
|
|
10
|
-
const httpLink = new HttpLink({ uri: process.env.STRAPI_ADMIN_GRAPHQL_URL });
|
|
11
|
-
|
|
12
|
-
const authLink = new ApolloLink((operation, forward) => {
|
|
13
|
-
// Retrieve the authorization token from local storage.
|
|
14
|
-
const token = Cookies.get('LOCALAZY-API-USER-JWT');
|
|
15
|
-
|
|
16
|
-
// Use the setContext method to set the HTTP headers.
|
|
17
|
-
operation.setContext({
|
|
18
|
-
headers: {
|
|
19
|
-
'Authorization': token ? `Bearer ${token}` : ''
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Call the next link in the middleware chain.
|
|
24
|
-
return forward(operation);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return new ApolloClient({
|
|
28
|
-
link: authLink.concat(httpLink),
|
|
29
|
-
cache: new InMemoryCache()
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default createClient;
|