@localazy/strapi-plugin 1.0.4 → 1.0.9
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/dist/_chunks/FetchIdentity-4kkW9N7Y.js +981 -0
- package/dist/_chunks/FetchIdentity-BWSQAXt-.mjs +983 -0
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-DwAGgpcR.mjs} +4 -2
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-yWC_Yb_S.js} +12 -10
- package/dist/_chunks/{App-NRmSxuW3.js → LocalazyApp-DnaA768k.js} +136 -117
- package/dist/_chunks/{App-CtS6CrNn.mjs → LocalazyApp-zySanVTu.mjs} +32 -13
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → LocalazyContentTransferSetup-C7qVIeix.mjs} +49 -456
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → LocalazyContentTransferSetup-CeOM6bYA.js} +113 -520
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → LocalazyGlobalSettings-QvuLdsLe.mjs} +17 -8
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → LocalazyGlobalSettings-ewETL3oG.js} +61 -52
- package/dist/_chunks/LocalazyPanel-BXVLvFgD.js +83 -0
- package/dist/_chunks/LocalazyPanel-BotUsX-y.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-C81HewMg.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Dt96YcGQ.js +51 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → RequireLocalazyAuth-CDuyGCrT.mjs} +22 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → RequireLocalazyAuth-CWBWETzC.js} +50 -29
- package/dist/_chunks/_commonjsHelpers-Bc2YnDe1.js +7 -0
- package/dist/_chunks/_commonjsHelpers-DWwsNxpa.mjs +8 -0
- package/dist/_chunks/en-CMWcM0nM.js +10 -0
- package/dist/_chunks/en-RX915msK.mjs +10 -0
- package/dist/_chunks/entry-exclusion-service-BVPICve2.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-CGV6iOkB.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-DVYRxVhM.js} +33 -32
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DZL36gWh.mjs} +3 -2
- package/dist/_chunks/i18n-0dV2P-Hm.js +2378 -0
- package/dist/_chunks/i18n-RoETLXdU.mjs +2378 -0
- package/dist/_chunks/index-1he9s_bs.js +430 -0
- package/dist/_chunks/index-BIbKC7-V.mjs +432 -0
- package/dist/_chunks/index-CCxXsn7Z.js +254 -0
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-CgI_aKe_.mjs} +906 -4408
- package/dist/_chunks/index-DsrYI6aB.mjs +231 -0
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{index-Dj68Ixl2.mjs → strapi-api-base-BE8VMlaA.js} +7 -234
- package/dist/_chunks/{index-Bbwk3kp3.js → strapi-api-base-DjeKGUw7.mjs} +15 -242
- package/dist/_chunks/useTranslation-BdIl-aLe.js +188 -0
- package/dist/_chunks/useTranslation-CZQ4lU1m.mjs +189 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LocalazyPanel.d.ts +4 -0
- package/dist/admin/src/components/LocalazyStatusColumn.d.ts +3 -0
- package/dist/admin/src/components/RequireLocalazyAuth.d.ts +6 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/modules/entry-exclusion/services/entry-exclusion-service.d.ts +18 -0
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +8 -0
- package/dist/admin/src/pages/LocalazyApp.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyContentTransferSetup.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyGlobalSettings.d.ts +2 -0
- package/dist/server/index.js +202 -35
- package/dist/server/index.mjs +202 -35
- package/dist/server/src/controllers/entry-exclusion-controller.d.ts +21 -0
- package/dist/server/src/controllers/index.d.ts +7 -0
- package/dist/server/src/core/index.d.ts +6 -0
- package/dist/server/src/index.d.ts +15 -0
- package/dist/server/src/routes/entry-exclusion-routes.d.ts +9 -0
- package/dist/server/src/services/entry-exclusion-service.d.ts +23 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/package.json +2 -2
- package/dist/_chunks/en-BTf8goGM.mjs +0 -8
- package/dist/_chunks/en-CRtsEFtl.js +0 -8
package/dist/server/index.mjs
CHANGED
|
@@ -798,7 +798,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
798
798
|
baseMerge(object, source, srcIndex);
|
|
799
799
|
});
|
|
800
800
|
const name = "@localazy/strapi-plugin";
|
|
801
|
-
const version$1 = "1.0.
|
|
801
|
+
const version$1 = "1.0.9";
|
|
802
802
|
const description = "The official Strapi Plugin by Localazy.";
|
|
803
803
|
const keywords = [
|
|
804
804
|
"strapi",
|
|
@@ -872,7 +872,7 @@ const dependencies = {
|
|
|
872
872
|
const devDependencies = {
|
|
873
873
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
874
874
|
"@localazy/api-client": "^2.1.6",
|
|
875
|
-
"@localazy/conventional-changelog-preset": "^1.
|
|
875
|
+
"@localazy/conventional-changelog-preset": "^1.3.3",
|
|
876
876
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
877
877
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
878
878
|
"@strapi/icons": "^2.0.0-rc.14",
|
|
@@ -22934,6 +22934,9 @@ const getStrapiLocalazyI18nService = () => {
|
|
|
22934
22934
|
const getLocalazyUploadService = () => {
|
|
22935
22935
|
return strapi.plugin(PLUGIN_NAME).service("LocalazyUploadService");
|
|
22936
22936
|
};
|
|
22937
|
+
const getEntryExclusionService = () => {
|
|
22938
|
+
return strapi.plugin(PLUGIN_NAME).service("EntryExclusionService");
|
|
22939
|
+
};
|
|
22937
22940
|
class PluginSettingsServiceHelper {
|
|
22938
22941
|
constructor() {
|
|
22939
22942
|
this.PluginSettingsService = getPluginSettingsService();
|
|
@@ -24182,13 +24185,71 @@ const LocalazyTransferController = ({ strapi: strapi2 }) => ({
|
|
|
24182
24185
|
}
|
|
24183
24186
|
}
|
|
24184
24187
|
});
|
|
24188
|
+
const EntryExclusionController = ({ strapi: strapi2 }) => ({
|
|
24189
|
+
/**
|
|
24190
|
+
* Get entry exclusion state
|
|
24191
|
+
* GET /entry-exclusion/:contentType/:documentId
|
|
24192
|
+
*/
|
|
24193
|
+
async getEntryExclusion(ctx) {
|
|
24194
|
+
const { contentType, documentId } = ctx.params;
|
|
24195
|
+
if (!contentType || !documentId) {
|
|
24196
|
+
return ctx.badRequest("Content type and document ID are required");
|
|
24197
|
+
}
|
|
24198
|
+
try {
|
|
24199
|
+
const isExcluded = await getEntryExclusionService().getEntryExclusion(contentType, documentId);
|
|
24200
|
+
ctx.body = { isExcluded };
|
|
24201
|
+
} catch (error) {
|
|
24202
|
+
strapi2.log.error("Error getting entry exclusion:", error);
|
|
24203
|
+
return ctx.internalServerError("Failed to get entry exclusion state");
|
|
24204
|
+
}
|
|
24205
|
+
},
|
|
24206
|
+
/**
|
|
24207
|
+
* Set entry exclusion state
|
|
24208
|
+
* PUT /entry-exclusion/:contentType/:documentId
|
|
24209
|
+
*/
|
|
24210
|
+
async setEntryExclusion(ctx) {
|
|
24211
|
+
const { contentType, documentId } = ctx.params;
|
|
24212
|
+
const { isExcluded } = ctx.request.body;
|
|
24213
|
+
if (!contentType || !documentId) {
|
|
24214
|
+
return ctx.badRequest("Content type and document ID are required");
|
|
24215
|
+
}
|
|
24216
|
+
if (typeof isExcluded !== "boolean") {
|
|
24217
|
+
return ctx.badRequest("isExcluded must be a boolean value");
|
|
24218
|
+
}
|
|
24219
|
+
try {
|
|
24220
|
+
await getEntryExclusionService().setEntryExclusion(contentType, documentId, isExcluded);
|
|
24221
|
+
ctx.body = { success: true, isExcluded };
|
|
24222
|
+
} catch (error) {
|
|
24223
|
+
strapi2.log.error("Error setting entry exclusion:", error);
|
|
24224
|
+
return ctx.internalServerError("Failed to set entry exclusion state");
|
|
24225
|
+
}
|
|
24226
|
+
},
|
|
24227
|
+
/**
|
|
24228
|
+
* Get all excluded entries for a content type
|
|
24229
|
+
* GET /entry-exclusion/:contentType
|
|
24230
|
+
*/
|
|
24231
|
+
async getContentTypeExclusions(ctx) {
|
|
24232
|
+
const { contentType } = ctx.params;
|
|
24233
|
+
if (!contentType) {
|
|
24234
|
+
return ctx.badRequest("Content type is required");
|
|
24235
|
+
}
|
|
24236
|
+
try {
|
|
24237
|
+
const excludedIds = await getEntryExclusionService().getContentTypeExclusions(contentType);
|
|
24238
|
+
ctx.body = { excludedIds };
|
|
24239
|
+
} catch (error) {
|
|
24240
|
+
strapi2.log.error("Error getting content type exclusions:", error);
|
|
24241
|
+
return ctx.internalServerError("Failed to get content type exclusions");
|
|
24242
|
+
}
|
|
24243
|
+
}
|
|
24244
|
+
});
|
|
24185
24245
|
const controllers = {
|
|
24186
24246
|
LocalazyUserController,
|
|
24187
24247
|
LocalazyAuthController,
|
|
24188
24248
|
StrapiController,
|
|
24189
24249
|
LocalazyProjectController,
|
|
24190
24250
|
PluginSettingsController,
|
|
24191
|
-
LocalazyTransferController
|
|
24251
|
+
LocalazyTransferController,
|
|
24252
|
+
EntryExclusionController
|
|
24192
24253
|
};
|
|
24193
24254
|
const verifyWebhook = (config2, { strapi: strapi2 }) => {
|
|
24194
24255
|
return async (ctx, next) => {
|
|
@@ -24245,11 +24306,11 @@ const middlewares = {
|
|
|
24245
24306
|
verifyWebhook
|
|
24246
24307
|
};
|
|
24247
24308
|
const policies = {};
|
|
24248
|
-
const ROUTE_PREFIX$
|
|
24309
|
+
const ROUTE_PREFIX$7 = "/user";
|
|
24249
24310
|
const LocalazyUserRoutes = [
|
|
24250
24311
|
{
|
|
24251
24312
|
method: "GET",
|
|
24252
|
-
path: `${ROUTE_PREFIX$
|
|
24313
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24253
24314
|
handler: "LocalazyUserController.getUser",
|
|
24254
24315
|
config: {
|
|
24255
24316
|
policies: []
|
|
@@ -24257,7 +24318,7 @@ const LocalazyUserRoutes = [
|
|
|
24257
24318
|
},
|
|
24258
24319
|
{
|
|
24259
24320
|
method: "PUT",
|
|
24260
|
-
path: `${ROUTE_PREFIX$
|
|
24321
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24261
24322
|
handler: "LocalazyUserController.updateUser",
|
|
24262
24323
|
config: {
|
|
24263
24324
|
policies: []
|
|
@@ -24265,18 +24326,18 @@ const LocalazyUserRoutes = [
|
|
|
24265
24326
|
},
|
|
24266
24327
|
{
|
|
24267
24328
|
method: "DELETE",
|
|
24268
|
-
path: `${ROUTE_PREFIX$
|
|
24329
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24269
24330
|
handler: "LocalazyUserController.deleteUser",
|
|
24270
24331
|
config: {
|
|
24271
24332
|
policies: []
|
|
24272
24333
|
}
|
|
24273
24334
|
}
|
|
24274
24335
|
];
|
|
24275
|
-
const ROUTE_PREFIX$
|
|
24336
|
+
const ROUTE_PREFIX$6 = "/auth";
|
|
24276
24337
|
const LocalazyAuthRoutes = [
|
|
24277
24338
|
{
|
|
24278
24339
|
method: "GET",
|
|
24279
|
-
path: `${ROUTE_PREFIX$
|
|
24340
|
+
path: `${ROUTE_PREFIX$6}/generate-keys`,
|
|
24280
24341
|
handler: "LocalazyAuthController.generateKeys",
|
|
24281
24342
|
config: {
|
|
24282
24343
|
policies: []
|
|
@@ -24284,18 +24345,18 @@ const LocalazyAuthRoutes = [
|
|
|
24284
24345
|
},
|
|
24285
24346
|
{
|
|
24286
24347
|
method: "GET",
|
|
24287
|
-
path: `${ROUTE_PREFIX$
|
|
24348
|
+
path: `${ROUTE_PREFIX$6}/continuous-poll`,
|
|
24288
24349
|
handler: "LocalazyAuthController.continuousPoll",
|
|
24289
24350
|
config: {
|
|
24290
24351
|
policies: []
|
|
24291
24352
|
}
|
|
24292
24353
|
}
|
|
24293
24354
|
];
|
|
24294
|
-
const ROUTE_PREFIX$
|
|
24355
|
+
const ROUTE_PREFIX$5 = "/plugin-settings";
|
|
24295
24356
|
const PluginSettingsRoutes = [
|
|
24296
24357
|
{
|
|
24297
24358
|
method: "GET",
|
|
24298
|
-
path: `${ROUTE_PREFIX$
|
|
24359
|
+
path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
|
|
24299
24360
|
handler: "PluginSettingsController.getContentTransferSetup",
|
|
24300
24361
|
config: {
|
|
24301
24362
|
policies: []
|
|
@@ -24303,7 +24364,7 @@ const PluginSettingsRoutes = [
|
|
|
24303
24364
|
},
|
|
24304
24365
|
{
|
|
24305
24366
|
method: "PUT",
|
|
24306
|
-
path: `${ROUTE_PREFIX$
|
|
24367
|
+
path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
|
|
24307
24368
|
handler: "PluginSettingsController.updateContentTransferSetup",
|
|
24308
24369
|
config: {
|
|
24309
24370
|
policies: []
|
|
@@ -24311,7 +24372,7 @@ const PluginSettingsRoutes = [
|
|
|
24311
24372
|
},
|
|
24312
24373
|
{
|
|
24313
24374
|
method: "GET",
|
|
24314
|
-
path: `${ROUTE_PREFIX$
|
|
24375
|
+
path: `${ROUTE_PREFIX$5}/plugin-settings`,
|
|
24315
24376
|
handler: "PluginSettingsController.getPluginSettings",
|
|
24316
24377
|
config: {
|
|
24317
24378
|
policies: []
|
|
@@ -24319,18 +24380,18 @@ const PluginSettingsRoutes = [
|
|
|
24319
24380
|
},
|
|
24320
24381
|
{
|
|
24321
24382
|
method: "PUT",
|
|
24322
|
-
path: `${ROUTE_PREFIX$
|
|
24383
|
+
path: `${ROUTE_PREFIX$5}/plugin-settings`,
|
|
24323
24384
|
handler: "PluginSettingsController.updatePluginSettings",
|
|
24324
24385
|
config: {
|
|
24325
24386
|
policies: []
|
|
24326
24387
|
}
|
|
24327
24388
|
}
|
|
24328
24389
|
];
|
|
24329
|
-
const ROUTE_PREFIX$
|
|
24390
|
+
const ROUTE_PREFIX$4 = "/strapi";
|
|
24330
24391
|
const StrapiRoutes = [
|
|
24331
24392
|
{
|
|
24332
24393
|
method: "GET",
|
|
24333
|
-
path: `${ROUTE_PREFIX$
|
|
24394
|
+
path: `${ROUTE_PREFIX$4}/models`,
|
|
24334
24395
|
handler: "StrapiController.getModels",
|
|
24335
24396
|
config: {
|
|
24336
24397
|
policies: []
|
|
@@ -24338,7 +24399,7 @@ const StrapiRoutes = [
|
|
|
24338
24399
|
},
|
|
24339
24400
|
{
|
|
24340
24401
|
method: "GET",
|
|
24341
|
-
path: `${ROUTE_PREFIX$
|
|
24402
|
+
path: `${ROUTE_PREFIX$4}/localizable-models`,
|
|
24342
24403
|
handler: "StrapiController.getLocalizableModels",
|
|
24343
24404
|
config: {
|
|
24344
24405
|
policies: []
|
|
@@ -24346,7 +24407,7 @@ const StrapiRoutes = [
|
|
|
24346
24407
|
},
|
|
24347
24408
|
{
|
|
24348
24409
|
method: "POST",
|
|
24349
|
-
path: `${ROUTE_PREFIX$
|
|
24410
|
+
path: `${ROUTE_PREFIX$4}/lifecycle/localazy-webhooks`,
|
|
24350
24411
|
handler: "StrapiController.postLifecycleLocalazyWebhooks",
|
|
24351
24412
|
config: {
|
|
24352
24413
|
policies: []
|
|
@@ -24354,18 +24415,18 @@ const StrapiRoutes = [
|
|
|
24354
24415
|
},
|
|
24355
24416
|
{
|
|
24356
24417
|
method: "GET",
|
|
24357
|
-
path: `${ROUTE_PREFIX$
|
|
24418
|
+
path: `${ROUTE_PREFIX$4}/version`,
|
|
24358
24419
|
handler: "StrapiController.getPluginVersion",
|
|
24359
24420
|
config: {
|
|
24360
24421
|
policies: []
|
|
24361
24422
|
}
|
|
24362
24423
|
}
|
|
24363
24424
|
];
|
|
24364
|
-
const ROUTE_PREFIX$
|
|
24425
|
+
const ROUTE_PREFIX$3 = "/transfer";
|
|
24365
24426
|
const LocalazyTransferRoutes = [
|
|
24366
24427
|
{
|
|
24367
24428
|
method: "POST",
|
|
24368
|
-
path: `${ROUTE_PREFIX$
|
|
24429
|
+
path: `${ROUTE_PREFIX$3}/upload`,
|
|
24369
24430
|
handler: "LocalazyTransferController.upload",
|
|
24370
24431
|
config: {
|
|
24371
24432
|
policies: []
|
|
@@ -24373,29 +24434,29 @@ const LocalazyTransferRoutes = [
|
|
|
24373
24434
|
},
|
|
24374
24435
|
{
|
|
24375
24436
|
method: "POST",
|
|
24376
|
-
path: `${ROUTE_PREFIX$
|
|
24437
|
+
path: `${ROUTE_PREFIX$3}/download`,
|
|
24377
24438
|
handler: "LocalazyTransferController.download",
|
|
24378
24439
|
config: {
|
|
24379
24440
|
policies: []
|
|
24380
24441
|
}
|
|
24381
24442
|
}
|
|
24382
24443
|
];
|
|
24383
|
-
const ROUTE_PREFIX$
|
|
24444
|
+
const ROUTE_PREFIX$2 = "/project";
|
|
24384
24445
|
const LocalazyProjectRoutes = [
|
|
24385
24446
|
{
|
|
24386
24447
|
method: "GET",
|
|
24387
|
-
path: `${ROUTE_PREFIX$
|
|
24448
|
+
path: `${ROUTE_PREFIX$2}`,
|
|
24388
24449
|
handler: "LocalazyProjectController.getConnectedProject",
|
|
24389
24450
|
config: {
|
|
24390
24451
|
policies: []
|
|
24391
24452
|
}
|
|
24392
24453
|
}
|
|
24393
24454
|
];
|
|
24394
|
-
const ROUTE_PREFIX = "/public/transfer";
|
|
24455
|
+
const ROUTE_PREFIX$1 = "/public/transfer";
|
|
24395
24456
|
const LocalazyPublicTransferRoutes = [
|
|
24396
24457
|
{
|
|
24397
24458
|
method: "POST",
|
|
24398
|
-
path: `${ROUTE_PREFIX}/download`,
|
|
24459
|
+
path: `${ROUTE_PREFIX$1}/download`,
|
|
24399
24460
|
handler: "LocalazyTransferController.download",
|
|
24400
24461
|
config: {
|
|
24401
24462
|
policies: [],
|
|
@@ -24405,6 +24466,33 @@ const LocalazyPublicTransferRoutes = [
|
|
|
24405
24466
|
}
|
|
24406
24467
|
}
|
|
24407
24468
|
];
|
|
24469
|
+
const ROUTE_PREFIX = "/entry-exclusion";
|
|
24470
|
+
const EntryExclusionRoutes = [
|
|
24471
|
+
{
|
|
24472
|
+
method: "GET",
|
|
24473
|
+
path: `${ROUTE_PREFIX}/:contentType/:documentId`,
|
|
24474
|
+
handler: "EntryExclusionController.getEntryExclusion",
|
|
24475
|
+
config: {
|
|
24476
|
+
policies: []
|
|
24477
|
+
}
|
|
24478
|
+
},
|
|
24479
|
+
{
|
|
24480
|
+
method: "PUT",
|
|
24481
|
+
path: `${ROUTE_PREFIX}/:contentType/:documentId`,
|
|
24482
|
+
handler: "EntryExclusionController.setEntryExclusion",
|
|
24483
|
+
config: {
|
|
24484
|
+
policies: []
|
|
24485
|
+
}
|
|
24486
|
+
},
|
|
24487
|
+
{
|
|
24488
|
+
method: "GET",
|
|
24489
|
+
path: `${ROUTE_PREFIX}/:contentType`,
|
|
24490
|
+
handler: "EntryExclusionController.getContentTypeExclusions",
|
|
24491
|
+
config: {
|
|
24492
|
+
policies: []
|
|
24493
|
+
}
|
|
24494
|
+
}
|
|
24495
|
+
];
|
|
24408
24496
|
const routes = {
|
|
24409
24497
|
"content-api": {
|
|
24410
24498
|
routes: [...StrapiRoutes]
|
|
@@ -24417,7 +24505,8 @@ const routes = {
|
|
|
24417
24505
|
...PluginSettingsRoutes,
|
|
24418
24506
|
...StrapiRoutes,
|
|
24419
24507
|
...LocalazyTransferRoutes,
|
|
24420
|
-
...LocalazyProjectRoutes
|
|
24508
|
+
...LocalazyProjectRoutes,
|
|
24509
|
+
...EntryExclusionRoutes
|
|
24421
24510
|
]
|
|
24422
24511
|
},
|
|
24423
24512
|
LocalazyPublicTransferRoutes: {
|
|
@@ -24637,6 +24726,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24637
24726
|
const StrapiService2 = getStrapiService();
|
|
24638
24727
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
24639
24728
|
const LocalazyUploadService2 = getLocalazyUploadService();
|
|
24729
|
+
const EntryExclusionService2 = getEntryExclusionService();
|
|
24640
24730
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
24641
24731
|
if (!contentTransferSetup.has_setup) {
|
|
24642
24732
|
const message = "Content transfer setup is not set up.";
|
|
@@ -24661,21 +24751,21 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24661
24751
|
}
|
|
24662
24752
|
const transferSetupModel = findSetupModelByCollectionName(setup2, collectionName);
|
|
24663
24753
|
if (!isCollectionTransferEnabled(setup2, collectionName)) {
|
|
24664
|
-
const
|
|
24754
|
+
const message2 = `Collection ${collectionName} transfer is disabled.`;
|
|
24665
24755
|
await notificationService.emit(EventType.UPLOAD, {
|
|
24666
|
-
message
|
|
24756
|
+
message: message2
|
|
24667
24757
|
});
|
|
24668
|
-
strapi2.log.info(
|
|
24758
|
+
strapi2.log.info(message2);
|
|
24669
24759
|
continue;
|
|
24670
24760
|
}
|
|
24671
24761
|
const currentTransferSetupModel = transferSetupModel[collectionName];
|
|
24672
24762
|
const pickPaths = getPickPathsWithComponents(currentTransferSetupModel);
|
|
24673
24763
|
if (!pickPaths.length) {
|
|
24674
|
-
const
|
|
24764
|
+
const message2 = `No fields for collection ${collectionName} transfer are enabled.`;
|
|
24675
24765
|
await notificationService.emit(EventType.UPLOAD, {
|
|
24676
|
-
message
|
|
24766
|
+
message: message2
|
|
24677
24767
|
});
|
|
24678
|
-
strapi2.log.warn(
|
|
24768
|
+
strapi2.log.warn(message2);
|
|
24679
24769
|
continue;
|
|
24680
24770
|
}
|
|
24681
24771
|
const pickPathsWithUid = pickPaths.map((pickPath) => `${modelUid}.${pickPath}`);
|
|
@@ -24688,6 +24778,28 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24688
24778
|
strapi2.log.info(`No entries found for model ${modelUid}`);
|
|
24689
24779
|
continue;
|
|
24690
24780
|
}
|
|
24781
|
+
const excludedEntries = await EntryExclusionService2.getContentTypeExclusions(modelUid);
|
|
24782
|
+
const filteredEntries = [];
|
|
24783
|
+
for (const entry of entries) {
|
|
24784
|
+
const isExcluded = excludedEntries.includes(entry.documentId);
|
|
24785
|
+
if (!isExcluded) {
|
|
24786
|
+
filteredEntries.push(entry);
|
|
24787
|
+
}
|
|
24788
|
+
}
|
|
24789
|
+
entries = filteredEntries;
|
|
24790
|
+
if (!entries.length) {
|
|
24791
|
+
const message2 = `All entries for model ${collectionName} are excluded from translation`;
|
|
24792
|
+
await notificationService.emit(EventType.UPLOAD, {
|
|
24793
|
+
message: message2
|
|
24794
|
+
});
|
|
24795
|
+
strapi2.log.info(message2);
|
|
24796
|
+
continue;
|
|
24797
|
+
}
|
|
24798
|
+
const message = `Excluding ${excludedEntries.length} entries for model ${collectionName} from upload. Entries to translate: ${entries.length}.`;
|
|
24799
|
+
await notificationService.emit(EventType.UPLOAD, {
|
|
24800
|
+
message
|
|
24801
|
+
});
|
|
24802
|
+
strapi2.log.info(message);
|
|
24691
24803
|
entries = omitDeep(entries, ["locale", "createdAt", "updatedAt", "publishedAt"]);
|
|
24692
24804
|
entries.forEach((entry) => {
|
|
24693
24805
|
const flatten = flattenObject({
|
|
@@ -25173,6 +25285,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
|
|
|
25173
25285
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
25174
25286
|
const LocalazyPubAPIService2 = getLocalazyPubAPIService();
|
|
25175
25287
|
const StrapiLocalazyI18nService2 = getStrapiLocalazyI18nService();
|
|
25288
|
+
const EntryExclusionService2 = getEntryExclusionService();
|
|
25176
25289
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
25177
25290
|
const user = await LocalazyUserService2.getUser();
|
|
25178
25291
|
const strapiFile = await LocalazyPubAPIService2.getStrapiFile(user.project.id);
|
|
@@ -25355,7 +25468,12 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
|
|
|
25355
25468
|
strapi2.log.info(`Content type ${uid} does not support localizations, skipping...`);
|
|
25356
25469
|
continue;
|
|
25357
25470
|
}
|
|
25471
|
+
const excludedEntries = await EntryExclusionService2.getContentTypeExclusions(uid);
|
|
25358
25472
|
for (const [documentId, translatedModel] of Object.entries(models)) {
|
|
25473
|
+
if (excludedEntries.includes(documentId)) {
|
|
25474
|
+
strapi2.log.info(`Entry ${uid}[${documentId}] is excluded from transfer, skipping...`);
|
|
25475
|
+
continue;
|
|
25476
|
+
}
|
|
25359
25477
|
try {
|
|
25360
25478
|
const baseEntry = await strapi2.documents(uid).findOne({
|
|
25361
25479
|
documentId,
|
|
@@ -26088,6 +26206,54 @@ const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
|
26088
26206
|
return updatedEntry;
|
|
26089
26207
|
}
|
|
26090
26208
|
});
|
|
26209
|
+
const ENTRY_EXCLUSION_KEY = "localazy-entry-exclusions";
|
|
26210
|
+
const EntryExclusionService = ({ strapi: strapi2 }) => ({
|
|
26211
|
+
/**
|
|
26212
|
+
* Generate a unique key for an entry based on contentType and documentId
|
|
26213
|
+
*/
|
|
26214
|
+
getEntryKey(contentType, documentId) {
|
|
26215
|
+
return `${contentType}:${documentId}`;
|
|
26216
|
+
},
|
|
26217
|
+
/**
|
|
26218
|
+
* Get entry exclusion state for a specific entry
|
|
26219
|
+
*/
|
|
26220
|
+
async getEntryExclusion(contentType, documentId) {
|
|
26221
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26222
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26223
|
+
const entryKey = this.getEntryKey(contentType, documentId);
|
|
26224
|
+
const exclusion = exclusions[entryKey];
|
|
26225
|
+
return exclusion?.excludeFromTranslation || false;
|
|
26226
|
+
},
|
|
26227
|
+
/**
|
|
26228
|
+
* Set entry exclusion state for a specific entry
|
|
26229
|
+
*/
|
|
26230
|
+
async setEntryExclusion(contentType, documentId, excludeFromTranslation) {
|
|
26231
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26232
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26233
|
+
const entryKey = this.getEntryKey(contentType, documentId);
|
|
26234
|
+
if (excludeFromTranslation) {
|
|
26235
|
+
exclusions[entryKey] = {
|
|
26236
|
+
contentType,
|
|
26237
|
+
documentId,
|
|
26238
|
+
excludeFromTranslation: true
|
|
26239
|
+
};
|
|
26240
|
+
} else {
|
|
26241
|
+
delete exclusions[entryKey];
|
|
26242
|
+
}
|
|
26243
|
+
await pluginStore.set({
|
|
26244
|
+
key: ENTRY_EXCLUSION_KEY,
|
|
26245
|
+
value: exclusions
|
|
26246
|
+
});
|
|
26247
|
+
},
|
|
26248
|
+
/**
|
|
26249
|
+
* Get all exclusions for a specific content type
|
|
26250
|
+
*/
|
|
26251
|
+
async getContentTypeExclusions(contentType) {
|
|
26252
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26253
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26254
|
+
return Object.values(exclusions).filter((exclusion) => exclusion.contentType === contentType && exclusion.excludeFromTranslation).map((exclusion) => exclusion.documentId);
|
|
26255
|
+
}
|
|
26256
|
+
});
|
|
26091
26257
|
const services = {
|
|
26092
26258
|
LocalazyUserService,
|
|
26093
26259
|
StrapiService,
|
|
@@ -26097,7 +26263,8 @@ const services = {
|
|
|
26097
26263
|
LocalazyTransferDownloadService,
|
|
26098
26264
|
StrapiI18nService,
|
|
26099
26265
|
LocalazyUploadService,
|
|
26100
|
-
StrapiLocalazyI18nService
|
|
26266
|
+
StrapiLocalazyI18nService,
|
|
26267
|
+
EntryExclusionService
|
|
26101
26268
|
};
|
|
26102
26269
|
const index = {
|
|
26103
26270
|
register,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
declare const EntryExclusionController: ({ strapi }: {
|
|
3
|
+
strapi: Core.Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
/**
|
|
6
|
+
* Get entry exclusion state
|
|
7
|
+
* GET /entry-exclusion/:contentType/:documentId
|
|
8
|
+
*/
|
|
9
|
+
getEntryExclusion(ctx: any): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Set entry exclusion state
|
|
12
|
+
* PUT /entry-exclusion/:contentType/:documentId
|
|
13
|
+
*/
|
|
14
|
+
setEntryExclusion(ctx: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Get all excluded entries for a content type
|
|
17
|
+
* GET /entry-exclusion/:contentType
|
|
18
|
+
*/
|
|
19
|
+
getContentTypeExclusions(ctx: any): Promise<any>;
|
|
20
|
+
};
|
|
21
|
+
export default EntryExclusionController;
|
|
@@ -39,5 +39,12 @@ declare const _default: {
|
|
|
39
39
|
upload(ctx: any): Promise<void>;
|
|
40
40
|
download(ctx: any): Promise<void>;
|
|
41
41
|
};
|
|
42
|
+
EntryExclusionController: ({ strapi }: {
|
|
43
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
44
|
+
}) => {
|
|
45
|
+
getEntryExclusion(ctx: any): Promise<any>;
|
|
46
|
+
setEntryExclusion(ctx: any): Promise<any>;
|
|
47
|
+
getContentTypeExclusions(ctx: any): Promise<any>;
|
|
48
|
+
};
|
|
42
49
|
};
|
|
43
50
|
export default _default;
|
|
@@ -69,3 +69,9 @@ export declare const getLocalazyUploadService: () => {
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
+
export declare const getEntryExclusionService: () => {
|
|
73
|
+
getEntryKey(contentType: string, documentId: string): string;
|
|
74
|
+
getEntryExclusion(contentType: string, documentId: string): Promise<boolean>;
|
|
75
|
+
setEntryExclusion(contentType: string, documentId: string, excludeFromTranslation: boolean): Promise<void>;
|
|
76
|
+
getContentTypeExclusions(contentType: string): Promise<string[]>;
|
|
77
|
+
};
|
|
@@ -66,6 +66,13 @@ declare const _default: {
|
|
|
66
66
|
upload(ctx: any): Promise<void>;
|
|
67
67
|
download(ctx: any): Promise<void>;
|
|
68
68
|
};
|
|
69
|
+
EntryExclusionController: ({ strapi }: {
|
|
70
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
71
|
+
}) => {
|
|
72
|
+
getEntryExclusion(ctx: any): Promise<any>;
|
|
73
|
+
setEntryExclusion(ctx: any): Promise<any>;
|
|
74
|
+
getContentTypeExclusions(ctx: any): Promise<any>;
|
|
75
|
+
};
|
|
69
76
|
};
|
|
70
77
|
routes: {
|
|
71
78
|
'content-api': {
|
|
@@ -192,6 +199,14 @@ declare const _default: {
|
|
|
192
199
|
createEntry(uid: import("@strapi/types/dist/uid").ContentType, strapiContentTypesModels: any, translatedModel: any, baseEntry: any, isoStrapi: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
193
200
|
updateEntry(uid: any, localizedDocumentId: string, strapiContentTypesModels: any, translatedModel: any, baseEntry: any, isoStrapi: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
194
201
|
};
|
|
202
|
+
EntryExclusionService: ({ strapi }: {
|
|
203
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
204
|
+
}) => {
|
|
205
|
+
getEntryKey(contentType: string, documentId: string): string;
|
|
206
|
+
getEntryExclusion(contentType: string, documentId: string): Promise<boolean>;
|
|
207
|
+
setEntryExclusion(contentType: string, documentId: string, excludeFromTranslation: boolean): Promise<void>;
|
|
208
|
+
getContentTypeExclusions(contentType: string): Promise<string[]>;
|
|
209
|
+
};
|
|
195
210
|
};
|
|
196
211
|
contentTypes: {};
|
|
197
212
|
policies: {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
declare const EntryExclusionService: ({ strapi }: {
|
|
3
|
+
strapi: Core.Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
/**
|
|
6
|
+
* Generate a unique key for an entry based on contentType and documentId
|
|
7
|
+
*/
|
|
8
|
+
getEntryKey(contentType: string, documentId: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Get entry exclusion state for a specific entry
|
|
11
|
+
*/
|
|
12
|
+
getEntryExclusion(contentType: string, documentId: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Set entry exclusion state for a specific entry
|
|
15
|
+
*/
|
|
16
|
+
setEntryExclusion(contentType: string, documentId: string, excludeFromTranslation: boolean): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Get all exclusions for a specific content type
|
|
19
|
+
*/
|
|
20
|
+
getContentTypeExclusions(contentType: string): Promise<string[]>;
|
|
21
|
+
};
|
|
22
|
+
export type EntryExclusionServiceReturnType = ReturnType<typeof EntryExclusionService>;
|
|
23
|
+
export default EntryExclusionService;
|
|
@@ -88,5 +88,13 @@ declare const _default: {
|
|
|
88
88
|
createEntry(uid: import("@strapi/types/dist/uid").ContentType, strapiContentTypesModels: any, translatedModel: any, baseEntry: any, isoStrapi: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
89
89
|
updateEntry(uid: any, localizedDocumentId: string, strapiContentTypesModels: any, translatedModel: any, baseEntry: any, isoStrapi: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
90
90
|
};
|
|
91
|
+
EntryExclusionService: ({ strapi }: {
|
|
92
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
93
|
+
}) => {
|
|
94
|
+
getEntryKey(contentType: string, documentId: string): string;
|
|
95
|
+
getEntryExclusion(contentType: string, documentId: string): Promise<boolean>;
|
|
96
|
+
setEntryExclusion(contentType: string, documentId: string, excludeFromTranslation: boolean): Promise<void>;
|
|
97
|
+
getContentTypeExclusions(contentType: string): Promise<string[]>;
|
|
98
|
+
};
|
|
91
99
|
};
|
|
92
100
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localazy/strapi-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "The official Strapi Plugin by Localazy.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
82
82
|
"@localazy/api-client": "^2.1.6",
|
|
83
|
-
"@localazy/conventional-changelog-preset": "^1.
|
|
83
|
+
"@localazy/conventional-changelog-preset": "^1.3.3",
|
|
84
84
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
85
85
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
86
86
|
"@strapi/icons": "^2.0.0-rc.14",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const en = {
|
|
4
|
-
"strapi-plugin-v5.name": "Localazy",
|
|
5
|
-
"strapi-plugin-v5.localazy_settings": "Localazy Settings",
|
|
6
|
-
"strapi-plugin-v5.content_transfer_setup": "Content Transfer Setup"
|
|
7
|
-
};
|
|
8
|
-
exports.default = en;
|