@localazy/strapi-plugin 1.0.3 → 1.0.8
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/{App-CtS6CrNn.mjs → App-C0ogWaOz.mjs} +8 -4
- package/dist/_chunks/{App-NRmSxuW3.js → App-Dl58PZKy.js} +91 -87
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → ContentTransferSetup-ClR8Nwv2.mjs} +41 -452
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → ContentTransferSetup-DWQg9zDj.js} +91 -502
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → GlobalSettings-B_h5sPwa.mjs} +7 -4
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → GlobalSettings-BpY7BoXu.js} +43 -40
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-Bfrsr3-P.js} +10 -8
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-u9iDsQqB.mjs} +4 -2
- package/dist/_chunks/LocalazyPanel-BedTxk3C.js +83 -0
- package/dist/_chunks/LocalazyPanel-CuvdSJYx.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-955GpXAv.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Bf1ntoc7.js +51 -0
- 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-BlyFqyBY.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-bm-lp4za.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-B5SSh8XW.js} +4 -3
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DIHY9LBA.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-Dj68Ixl2.mjs → index-C15Goe6p.mjs} +120 -4
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-DOCSzcPH.mjs} +907 -4409
- package/dist/_chunks/{index-Bbwk3kp3.js → index-Q3-srfXc.js} +142 -4
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → isEqual-BazjlHGf.mjs} +1 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → isEqual-CrlZhAtq.js} +1 -1
- package/dist/_chunks/set-BRyy4Ra6.mjs +893 -0
- package/dist/_chunks/set-CmcBsVOP.js +891 -0
- 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/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/server/index.js +234 -40
- package/dist/server/index.mjs +234 -40
- 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/dist/server/src/utils/drop-property-deep.d.ts +2 -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.js
CHANGED
|
@@ -811,7 +811,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
811
811
|
baseMerge(object, source, srcIndex);
|
|
812
812
|
});
|
|
813
813
|
const name = "@localazy/strapi-plugin";
|
|
814
|
-
const version$1 = "1.0.
|
|
814
|
+
const version$1 = "1.0.8";
|
|
815
815
|
const description = "The official Strapi Plugin by Localazy.";
|
|
816
816
|
const keywords = [
|
|
817
817
|
"strapi",
|
|
@@ -885,7 +885,7 @@ const dependencies = {
|
|
|
885
885
|
const devDependencies = {
|
|
886
886
|
"@david-vaclavek/deep-keys": "^0.5.0",
|
|
887
887
|
"@localazy/api-client": "^2.1.6",
|
|
888
|
-
"@localazy/conventional-changelog-preset": "^1.
|
|
888
|
+
"@localazy/conventional-changelog-preset": "^1.3.3",
|
|
889
889
|
"@localazy/generic-connector-client": "^0.3.0",
|
|
890
890
|
"@strapi/design-system": "^2.0.0-rc.14",
|
|
891
891
|
"@strapi/icons": "^2.0.0-rc.14",
|
|
@@ -22947,6 +22947,9 @@ const getStrapiLocalazyI18nService = () => {
|
|
|
22947
22947
|
const getLocalazyUploadService = () => {
|
|
22948
22948
|
return strapi.plugin(PLUGIN_NAME).service("LocalazyUploadService");
|
|
22949
22949
|
};
|
|
22950
|
+
const getEntryExclusionService = () => {
|
|
22951
|
+
return strapi.plugin(PLUGIN_NAME).service("EntryExclusionService");
|
|
22952
|
+
};
|
|
22950
22953
|
class PluginSettingsServiceHelper {
|
|
22951
22954
|
constructor() {
|
|
22952
22955
|
this.PluginSettingsService = getPluginSettingsService();
|
|
@@ -24195,13 +24198,71 @@ const LocalazyTransferController = ({ strapi: strapi2 }) => ({
|
|
|
24195
24198
|
}
|
|
24196
24199
|
}
|
|
24197
24200
|
});
|
|
24201
|
+
const EntryExclusionController = ({ strapi: strapi2 }) => ({
|
|
24202
|
+
/**
|
|
24203
|
+
* Get entry exclusion state
|
|
24204
|
+
* GET /entry-exclusion/:contentType/:documentId
|
|
24205
|
+
*/
|
|
24206
|
+
async getEntryExclusion(ctx) {
|
|
24207
|
+
const { contentType, documentId } = ctx.params;
|
|
24208
|
+
if (!contentType || !documentId) {
|
|
24209
|
+
return ctx.badRequest("Content type and document ID are required");
|
|
24210
|
+
}
|
|
24211
|
+
try {
|
|
24212
|
+
const isExcluded = await getEntryExclusionService().getEntryExclusion(contentType, documentId);
|
|
24213
|
+
ctx.body = { isExcluded };
|
|
24214
|
+
} catch (error) {
|
|
24215
|
+
strapi2.log.error("Error getting entry exclusion:", error);
|
|
24216
|
+
return ctx.internalServerError("Failed to get entry exclusion state");
|
|
24217
|
+
}
|
|
24218
|
+
},
|
|
24219
|
+
/**
|
|
24220
|
+
* Set entry exclusion state
|
|
24221
|
+
* PUT /entry-exclusion/:contentType/:documentId
|
|
24222
|
+
*/
|
|
24223
|
+
async setEntryExclusion(ctx) {
|
|
24224
|
+
const { contentType, documentId } = ctx.params;
|
|
24225
|
+
const { isExcluded } = ctx.request.body;
|
|
24226
|
+
if (!contentType || !documentId) {
|
|
24227
|
+
return ctx.badRequest("Content type and document ID are required");
|
|
24228
|
+
}
|
|
24229
|
+
if (typeof isExcluded !== "boolean") {
|
|
24230
|
+
return ctx.badRequest("isExcluded must be a boolean value");
|
|
24231
|
+
}
|
|
24232
|
+
try {
|
|
24233
|
+
await getEntryExclusionService().setEntryExclusion(contentType, documentId, isExcluded);
|
|
24234
|
+
ctx.body = { success: true, isExcluded };
|
|
24235
|
+
} catch (error) {
|
|
24236
|
+
strapi2.log.error("Error setting entry exclusion:", error);
|
|
24237
|
+
return ctx.internalServerError("Failed to set entry exclusion state");
|
|
24238
|
+
}
|
|
24239
|
+
},
|
|
24240
|
+
/**
|
|
24241
|
+
* Get all excluded entries for a content type
|
|
24242
|
+
* GET /entry-exclusion/:contentType
|
|
24243
|
+
*/
|
|
24244
|
+
async getContentTypeExclusions(ctx) {
|
|
24245
|
+
const { contentType } = ctx.params;
|
|
24246
|
+
if (!contentType) {
|
|
24247
|
+
return ctx.badRequest("Content type is required");
|
|
24248
|
+
}
|
|
24249
|
+
try {
|
|
24250
|
+
const excludedIds = await getEntryExclusionService().getContentTypeExclusions(contentType);
|
|
24251
|
+
ctx.body = { excludedIds };
|
|
24252
|
+
} catch (error) {
|
|
24253
|
+
strapi2.log.error("Error getting content type exclusions:", error);
|
|
24254
|
+
return ctx.internalServerError("Failed to get content type exclusions");
|
|
24255
|
+
}
|
|
24256
|
+
}
|
|
24257
|
+
});
|
|
24198
24258
|
const controllers = {
|
|
24199
24259
|
LocalazyUserController,
|
|
24200
24260
|
LocalazyAuthController,
|
|
24201
24261
|
StrapiController,
|
|
24202
24262
|
LocalazyProjectController,
|
|
24203
24263
|
PluginSettingsController,
|
|
24204
|
-
LocalazyTransferController
|
|
24264
|
+
LocalazyTransferController,
|
|
24265
|
+
EntryExclusionController
|
|
24205
24266
|
};
|
|
24206
24267
|
const verifyWebhook = (config2, { strapi: strapi2 }) => {
|
|
24207
24268
|
return async (ctx, next) => {
|
|
@@ -24258,11 +24319,11 @@ const middlewares = {
|
|
|
24258
24319
|
verifyWebhook
|
|
24259
24320
|
};
|
|
24260
24321
|
const policies = {};
|
|
24261
|
-
const ROUTE_PREFIX$
|
|
24322
|
+
const ROUTE_PREFIX$7 = "/user";
|
|
24262
24323
|
const LocalazyUserRoutes = [
|
|
24263
24324
|
{
|
|
24264
24325
|
method: "GET",
|
|
24265
|
-
path: `${ROUTE_PREFIX$
|
|
24326
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24266
24327
|
handler: "LocalazyUserController.getUser",
|
|
24267
24328
|
config: {
|
|
24268
24329
|
policies: []
|
|
@@ -24270,7 +24331,7 @@ const LocalazyUserRoutes = [
|
|
|
24270
24331
|
},
|
|
24271
24332
|
{
|
|
24272
24333
|
method: "PUT",
|
|
24273
|
-
path: `${ROUTE_PREFIX$
|
|
24334
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24274
24335
|
handler: "LocalazyUserController.updateUser",
|
|
24275
24336
|
config: {
|
|
24276
24337
|
policies: []
|
|
@@ -24278,18 +24339,18 @@ const LocalazyUserRoutes = [
|
|
|
24278
24339
|
},
|
|
24279
24340
|
{
|
|
24280
24341
|
method: "DELETE",
|
|
24281
|
-
path: `${ROUTE_PREFIX$
|
|
24342
|
+
path: `${ROUTE_PREFIX$7}`,
|
|
24282
24343
|
handler: "LocalazyUserController.deleteUser",
|
|
24283
24344
|
config: {
|
|
24284
24345
|
policies: []
|
|
24285
24346
|
}
|
|
24286
24347
|
}
|
|
24287
24348
|
];
|
|
24288
|
-
const ROUTE_PREFIX$
|
|
24349
|
+
const ROUTE_PREFIX$6 = "/auth";
|
|
24289
24350
|
const LocalazyAuthRoutes = [
|
|
24290
24351
|
{
|
|
24291
24352
|
method: "GET",
|
|
24292
|
-
path: `${ROUTE_PREFIX$
|
|
24353
|
+
path: `${ROUTE_PREFIX$6}/generate-keys`,
|
|
24293
24354
|
handler: "LocalazyAuthController.generateKeys",
|
|
24294
24355
|
config: {
|
|
24295
24356
|
policies: []
|
|
@@ -24297,18 +24358,18 @@ const LocalazyAuthRoutes = [
|
|
|
24297
24358
|
},
|
|
24298
24359
|
{
|
|
24299
24360
|
method: "GET",
|
|
24300
|
-
path: `${ROUTE_PREFIX$
|
|
24361
|
+
path: `${ROUTE_PREFIX$6}/continuous-poll`,
|
|
24301
24362
|
handler: "LocalazyAuthController.continuousPoll",
|
|
24302
24363
|
config: {
|
|
24303
24364
|
policies: []
|
|
24304
24365
|
}
|
|
24305
24366
|
}
|
|
24306
24367
|
];
|
|
24307
|
-
const ROUTE_PREFIX$
|
|
24368
|
+
const ROUTE_PREFIX$5 = "/plugin-settings";
|
|
24308
24369
|
const PluginSettingsRoutes = [
|
|
24309
24370
|
{
|
|
24310
24371
|
method: "GET",
|
|
24311
|
-
path: `${ROUTE_PREFIX$
|
|
24372
|
+
path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
|
|
24312
24373
|
handler: "PluginSettingsController.getContentTransferSetup",
|
|
24313
24374
|
config: {
|
|
24314
24375
|
policies: []
|
|
@@ -24316,7 +24377,7 @@ const PluginSettingsRoutes = [
|
|
|
24316
24377
|
},
|
|
24317
24378
|
{
|
|
24318
24379
|
method: "PUT",
|
|
24319
|
-
path: `${ROUTE_PREFIX$
|
|
24380
|
+
path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
|
|
24320
24381
|
handler: "PluginSettingsController.updateContentTransferSetup",
|
|
24321
24382
|
config: {
|
|
24322
24383
|
policies: []
|
|
@@ -24324,7 +24385,7 @@ const PluginSettingsRoutes = [
|
|
|
24324
24385
|
},
|
|
24325
24386
|
{
|
|
24326
24387
|
method: "GET",
|
|
24327
|
-
path: `${ROUTE_PREFIX$
|
|
24388
|
+
path: `${ROUTE_PREFIX$5}/plugin-settings`,
|
|
24328
24389
|
handler: "PluginSettingsController.getPluginSettings",
|
|
24329
24390
|
config: {
|
|
24330
24391
|
policies: []
|
|
@@ -24332,18 +24393,18 @@ const PluginSettingsRoutes = [
|
|
|
24332
24393
|
},
|
|
24333
24394
|
{
|
|
24334
24395
|
method: "PUT",
|
|
24335
|
-
path: `${ROUTE_PREFIX$
|
|
24396
|
+
path: `${ROUTE_PREFIX$5}/plugin-settings`,
|
|
24336
24397
|
handler: "PluginSettingsController.updatePluginSettings",
|
|
24337
24398
|
config: {
|
|
24338
24399
|
policies: []
|
|
24339
24400
|
}
|
|
24340
24401
|
}
|
|
24341
24402
|
];
|
|
24342
|
-
const ROUTE_PREFIX$
|
|
24403
|
+
const ROUTE_PREFIX$4 = "/strapi";
|
|
24343
24404
|
const StrapiRoutes = [
|
|
24344
24405
|
{
|
|
24345
24406
|
method: "GET",
|
|
24346
|
-
path: `${ROUTE_PREFIX$
|
|
24407
|
+
path: `${ROUTE_PREFIX$4}/models`,
|
|
24347
24408
|
handler: "StrapiController.getModels",
|
|
24348
24409
|
config: {
|
|
24349
24410
|
policies: []
|
|
@@ -24351,7 +24412,7 @@ const StrapiRoutes = [
|
|
|
24351
24412
|
},
|
|
24352
24413
|
{
|
|
24353
24414
|
method: "GET",
|
|
24354
|
-
path: `${ROUTE_PREFIX$
|
|
24415
|
+
path: `${ROUTE_PREFIX$4}/localizable-models`,
|
|
24355
24416
|
handler: "StrapiController.getLocalizableModels",
|
|
24356
24417
|
config: {
|
|
24357
24418
|
policies: []
|
|
@@ -24359,7 +24420,7 @@ const StrapiRoutes = [
|
|
|
24359
24420
|
},
|
|
24360
24421
|
{
|
|
24361
24422
|
method: "POST",
|
|
24362
|
-
path: `${ROUTE_PREFIX$
|
|
24423
|
+
path: `${ROUTE_PREFIX$4}/lifecycle/localazy-webhooks`,
|
|
24363
24424
|
handler: "StrapiController.postLifecycleLocalazyWebhooks",
|
|
24364
24425
|
config: {
|
|
24365
24426
|
policies: []
|
|
@@ -24367,18 +24428,18 @@ const StrapiRoutes = [
|
|
|
24367
24428
|
},
|
|
24368
24429
|
{
|
|
24369
24430
|
method: "GET",
|
|
24370
|
-
path: `${ROUTE_PREFIX$
|
|
24431
|
+
path: `${ROUTE_PREFIX$4}/version`,
|
|
24371
24432
|
handler: "StrapiController.getPluginVersion",
|
|
24372
24433
|
config: {
|
|
24373
24434
|
policies: []
|
|
24374
24435
|
}
|
|
24375
24436
|
}
|
|
24376
24437
|
];
|
|
24377
|
-
const ROUTE_PREFIX$
|
|
24438
|
+
const ROUTE_PREFIX$3 = "/transfer";
|
|
24378
24439
|
const LocalazyTransferRoutes = [
|
|
24379
24440
|
{
|
|
24380
24441
|
method: "POST",
|
|
24381
|
-
path: `${ROUTE_PREFIX$
|
|
24442
|
+
path: `${ROUTE_PREFIX$3}/upload`,
|
|
24382
24443
|
handler: "LocalazyTransferController.upload",
|
|
24383
24444
|
config: {
|
|
24384
24445
|
policies: []
|
|
@@ -24386,29 +24447,29 @@ const LocalazyTransferRoutes = [
|
|
|
24386
24447
|
},
|
|
24387
24448
|
{
|
|
24388
24449
|
method: "POST",
|
|
24389
|
-
path: `${ROUTE_PREFIX$
|
|
24450
|
+
path: `${ROUTE_PREFIX$3}/download`,
|
|
24390
24451
|
handler: "LocalazyTransferController.download",
|
|
24391
24452
|
config: {
|
|
24392
24453
|
policies: []
|
|
24393
24454
|
}
|
|
24394
24455
|
}
|
|
24395
24456
|
];
|
|
24396
|
-
const ROUTE_PREFIX$
|
|
24457
|
+
const ROUTE_PREFIX$2 = "/project";
|
|
24397
24458
|
const LocalazyProjectRoutes = [
|
|
24398
24459
|
{
|
|
24399
24460
|
method: "GET",
|
|
24400
|
-
path: `${ROUTE_PREFIX$
|
|
24461
|
+
path: `${ROUTE_PREFIX$2}`,
|
|
24401
24462
|
handler: "LocalazyProjectController.getConnectedProject",
|
|
24402
24463
|
config: {
|
|
24403
24464
|
policies: []
|
|
24404
24465
|
}
|
|
24405
24466
|
}
|
|
24406
24467
|
];
|
|
24407
|
-
const ROUTE_PREFIX = "/public/transfer";
|
|
24468
|
+
const ROUTE_PREFIX$1 = "/public/transfer";
|
|
24408
24469
|
const LocalazyPublicTransferRoutes = [
|
|
24409
24470
|
{
|
|
24410
24471
|
method: "POST",
|
|
24411
|
-
path: `${ROUTE_PREFIX}/download`,
|
|
24472
|
+
path: `${ROUTE_PREFIX$1}/download`,
|
|
24412
24473
|
handler: "LocalazyTransferController.download",
|
|
24413
24474
|
config: {
|
|
24414
24475
|
policies: [],
|
|
@@ -24418,6 +24479,33 @@ const LocalazyPublicTransferRoutes = [
|
|
|
24418
24479
|
}
|
|
24419
24480
|
}
|
|
24420
24481
|
];
|
|
24482
|
+
const ROUTE_PREFIX = "/entry-exclusion";
|
|
24483
|
+
const EntryExclusionRoutes = [
|
|
24484
|
+
{
|
|
24485
|
+
method: "GET",
|
|
24486
|
+
path: `${ROUTE_PREFIX}/:contentType/:documentId`,
|
|
24487
|
+
handler: "EntryExclusionController.getEntryExclusion",
|
|
24488
|
+
config: {
|
|
24489
|
+
policies: []
|
|
24490
|
+
}
|
|
24491
|
+
},
|
|
24492
|
+
{
|
|
24493
|
+
method: "PUT",
|
|
24494
|
+
path: `${ROUTE_PREFIX}/:contentType/:documentId`,
|
|
24495
|
+
handler: "EntryExclusionController.setEntryExclusion",
|
|
24496
|
+
config: {
|
|
24497
|
+
policies: []
|
|
24498
|
+
}
|
|
24499
|
+
},
|
|
24500
|
+
{
|
|
24501
|
+
method: "GET",
|
|
24502
|
+
path: `${ROUTE_PREFIX}/:contentType`,
|
|
24503
|
+
handler: "EntryExclusionController.getContentTypeExclusions",
|
|
24504
|
+
config: {
|
|
24505
|
+
policies: []
|
|
24506
|
+
}
|
|
24507
|
+
}
|
|
24508
|
+
];
|
|
24421
24509
|
const routes = {
|
|
24422
24510
|
"content-api": {
|
|
24423
24511
|
routes: [...StrapiRoutes]
|
|
@@ -24430,7 +24518,8 @@ const routes = {
|
|
|
24430
24518
|
...PluginSettingsRoutes,
|
|
24431
24519
|
...StrapiRoutes,
|
|
24432
24520
|
...LocalazyTransferRoutes,
|
|
24433
|
-
...LocalazyProjectRoutes
|
|
24521
|
+
...LocalazyProjectRoutes,
|
|
24522
|
+
...EntryExclusionRoutes
|
|
24434
24523
|
]
|
|
24435
24524
|
},
|
|
24436
24525
|
LocalazyPublicTransferRoutes: {
|
|
@@ -24650,6 +24739,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24650
24739
|
const StrapiService2 = getStrapiService();
|
|
24651
24740
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
24652
24741
|
const LocalazyUploadService2 = getLocalazyUploadService();
|
|
24742
|
+
const EntryExclusionService2 = getEntryExclusionService();
|
|
24653
24743
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
24654
24744
|
if (!contentTransferSetup.has_setup) {
|
|
24655
24745
|
const message = "Content transfer setup is not set up.";
|
|
@@ -24674,21 +24764,21 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24674
24764
|
}
|
|
24675
24765
|
const transferSetupModel = findSetupModelByCollectionName(setup2, collectionName);
|
|
24676
24766
|
if (!isCollectionTransferEnabled(setup2, collectionName)) {
|
|
24677
|
-
const
|
|
24767
|
+
const message2 = `Collection ${collectionName} transfer is disabled.`;
|
|
24678
24768
|
await notificationService.emit(EventType.UPLOAD, {
|
|
24679
|
-
message
|
|
24769
|
+
message: message2
|
|
24680
24770
|
});
|
|
24681
|
-
strapi2.log.info(
|
|
24771
|
+
strapi2.log.info(message2);
|
|
24682
24772
|
continue;
|
|
24683
24773
|
}
|
|
24684
24774
|
const currentTransferSetupModel = transferSetupModel[collectionName];
|
|
24685
24775
|
const pickPaths = getPickPathsWithComponents(currentTransferSetupModel);
|
|
24686
24776
|
if (!pickPaths.length) {
|
|
24687
|
-
const
|
|
24777
|
+
const message2 = `No fields for collection ${collectionName} transfer are enabled.`;
|
|
24688
24778
|
await notificationService.emit(EventType.UPLOAD, {
|
|
24689
|
-
message
|
|
24779
|
+
message: message2
|
|
24690
24780
|
});
|
|
24691
|
-
strapi2.log.warn(
|
|
24781
|
+
strapi2.log.warn(message2);
|
|
24692
24782
|
continue;
|
|
24693
24783
|
}
|
|
24694
24784
|
const pickPathsWithUid = pickPaths.map((pickPath) => `${modelUid}.${pickPath}`);
|
|
@@ -24701,6 +24791,28 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
|
|
|
24701
24791
|
strapi2.log.info(`No entries found for model ${modelUid}`);
|
|
24702
24792
|
continue;
|
|
24703
24793
|
}
|
|
24794
|
+
const excludedEntries = await EntryExclusionService2.getContentTypeExclusions(modelUid);
|
|
24795
|
+
const filteredEntries = [];
|
|
24796
|
+
for (const entry of entries) {
|
|
24797
|
+
const isExcluded = excludedEntries.includes(entry.documentId);
|
|
24798
|
+
if (!isExcluded) {
|
|
24799
|
+
filteredEntries.push(entry);
|
|
24800
|
+
}
|
|
24801
|
+
}
|
|
24802
|
+
entries = filteredEntries;
|
|
24803
|
+
if (!entries.length) {
|
|
24804
|
+
const message2 = `All entries for model ${collectionName} are excluded from translation`;
|
|
24805
|
+
await notificationService.emit(EventType.UPLOAD, {
|
|
24806
|
+
message: message2
|
|
24807
|
+
});
|
|
24808
|
+
strapi2.log.info(message2);
|
|
24809
|
+
continue;
|
|
24810
|
+
}
|
|
24811
|
+
const message = `Excluding ${excludedEntries.length} entries for model ${collectionName} from upload. Entries to translate: ${entries.length}.`;
|
|
24812
|
+
await notificationService.emit(EventType.UPLOAD, {
|
|
24813
|
+
message
|
|
24814
|
+
});
|
|
24815
|
+
strapi2.log.info(message);
|
|
24704
24816
|
entries = omitDeep(entries, ["locale", "createdAt", "updatedAt", "publishedAt"]);
|
|
24705
24817
|
entries.forEach((entry) => {
|
|
24706
24818
|
const flatten = flattenObject({
|
|
@@ -25186,6 +25298,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
|
|
|
25186
25298
|
const LocalazyUserService2 = getLocalazyUserService();
|
|
25187
25299
|
const LocalazyPubAPIService2 = getLocalazyPubAPIService();
|
|
25188
25300
|
const StrapiLocalazyI18nService2 = getStrapiLocalazyI18nService();
|
|
25301
|
+
const EntryExclusionService2 = getEntryExclusionService();
|
|
25189
25302
|
const contentTransferSetup = await getPluginSettingsService().getContentTransferSetup();
|
|
25190
25303
|
const user = await LocalazyUserService2.getUser();
|
|
25191
25304
|
const strapiFile = await LocalazyPubAPIService2.getStrapiFile(user.project.id);
|
|
@@ -25368,7 +25481,12 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
|
|
|
25368
25481
|
strapi2.log.info(`Content type ${uid} does not support localizations, skipping...`);
|
|
25369
25482
|
continue;
|
|
25370
25483
|
}
|
|
25484
|
+
const excludedEntries = await EntryExclusionService2.getContentTypeExclusions(uid);
|
|
25371
25485
|
for (const [documentId, translatedModel] of Object.entries(models)) {
|
|
25486
|
+
if (excludedEntries.includes(documentId)) {
|
|
25487
|
+
strapi2.log.info(`Entry ${uid}[${documentId}] is excluded from transfer, skipping...`);
|
|
25488
|
+
continue;
|
|
25489
|
+
}
|
|
25372
25490
|
try {
|
|
25373
25491
|
const baseEntry = await strapi2.documents(uid).findOne({
|
|
25374
25492
|
documentId,
|
|
@@ -26005,21 +26123,48 @@ const parsedLocalazyEntryToUpdateEntry = async (allModels, localazyEntry, fullyP
|
|
|
26005
26123
|
);
|
|
26006
26124
|
return populatedEntry;
|
|
26007
26125
|
};
|
|
26008
|
-
const
|
|
26126
|
+
const isMediaObject = (obj) => {
|
|
26127
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
26128
|
+
return "url" in obj && "name" in obj && "ext" in obj && ("mime" in obj || "mimeType" in obj) && typeof obj.url === "string" && typeof obj.name === "string" && typeof obj.ext === "string";
|
|
26129
|
+
};
|
|
26130
|
+
const dropPropertyDeepWithSkip = (obj, propertyName, isRoot = true, skipPredicates = []) => {
|
|
26009
26131
|
if (Array.isArray(obj)) {
|
|
26010
|
-
return obj.filter((item) =>
|
|
26132
|
+
return obj.filter((item) => {
|
|
26133
|
+
if (skipPredicates.length > 0) {
|
|
26134
|
+
return true;
|
|
26135
|
+
}
|
|
26136
|
+
return isRoot || !(typeof item === "object" && item !== null && propertyName in item);
|
|
26137
|
+
}).map(
|
|
26138
|
+
(item) => typeof item === "object" && item !== null ? dropPropertyDeepWithSkip(item, propertyName, false, skipPredicates) : item
|
|
26139
|
+
);
|
|
26011
26140
|
}
|
|
26012
26141
|
if (typeof obj === "object" && obj !== null) {
|
|
26142
|
+
const shouldSkip = skipPredicates.some((predicate) => predicate(obj));
|
|
26143
|
+
if (shouldSkip) {
|
|
26144
|
+
const result2 = {};
|
|
26145
|
+
for (const key in obj) {
|
|
26146
|
+
if (key === propertyName) {
|
|
26147
|
+
result2[key] = obj[key];
|
|
26148
|
+
} else {
|
|
26149
|
+
result2[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26150
|
+
}
|
|
26151
|
+
}
|
|
26152
|
+
return result2;
|
|
26153
|
+
}
|
|
26013
26154
|
const result = {};
|
|
26014
26155
|
for (const key in obj) {
|
|
26015
|
-
if (
|
|
26016
|
-
|
|
26156
|
+
if (key === propertyName && !isRoot) {
|
|
26157
|
+
continue;
|
|
26017
26158
|
}
|
|
26159
|
+
result[key] = typeof obj[key] === "object" && obj[key] !== null ? dropPropertyDeepWithSkip(obj[key], propertyName, false, skipPredicates) : obj[key];
|
|
26018
26160
|
}
|
|
26019
26161
|
return result;
|
|
26020
26162
|
}
|
|
26021
26163
|
return obj;
|
|
26022
26164
|
};
|
|
26165
|
+
const dropDocumentIdExceptMedia = (obj) => {
|
|
26166
|
+
return dropPropertyDeepWithSkip(obj, "documentId", true, [isMediaObject]);
|
|
26167
|
+
};
|
|
26023
26168
|
const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
26024
26169
|
async createEntry(uid, strapiContentTypesModels, translatedModel, baseEntry, isoStrapi) {
|
|
26025
26170
|
const StrapiI18nService2 = getStrapiI18nService();
|
|
@@ -26032,7 +26177,7 @@ const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
|
26032
26177
|
);
|
|
26033
26178
|
const omitKeys = ["locale", "localizations", "createdAt", "createdBy", "updatedAt", "updatedBy", "publishedAt"];
|
|
26034
26179
|
let filteredBaseEntry = omitDeep(baseEntry, omitKeys);
|
|
26035
|
-
filteredBaseEntry =
|
|
26180
|
+
filteredBaseEntry = dropDocumentIdExceptMedia(filteredBaseEntry);
|
|
26036
26181
|
let mergedCreateEntry = {};
|
|
26037
26182
|
merge(mergedCreateEntry, filteredBaseEntry, createEntry);
|
|
26038
26183
|
mergedCreateEntry = omitDeep(mergedCreateEntry, omitKeys);
|
|
@@ -26074,6 +26219,54 @@ const StrapiLocalazyI18nService = ({ strapi: strapi2 }) => ({
|
|
|
26074
26219
|
return updatedEntry;
|
|
26075
26220
|
}
|
|
26076
26221
|
});
|
|
26222
|
+
const ENTRY_EXCLUSION_KEY = "localazy-entry-exclusions";
|
|
26223
|
+
const EntryExclusionService = ({ strapi: strapi2 }) => ({
|
|
26224
|
+
/**
|
|
26225
|
+
* Generate a unique key for an entry based on contentType and documentId
|
|
26226
|
+
*/
|
|
26227
|
+
getEntryKey(contentType, documentId) {
|
|
26228
|
+
return `${contentType}:${documentId}`;
|
|
26229
|
+
},
|
|
26230
|
+
/**
|
|
26231
|
+
* Get entry exclusion state for a specific entry
|
|
26232
|
+
*/
|
|
26233
|
+
async getEntryExclusion(contentType, documentId) {
|
|
26234
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26235
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26236
|
+
const entryKey = this.getEntryKey(contentType, documentId);
|
|
26237
|
+
const exclusion = exclusions[entryKey];
|
|
26238
|
+
return exclusion?.excludeFromTranslation || false;
|
|
26239
|
+
},
|
|
26240
|
+
/**
|
|
26241
|
+
* Set entry exclusion state for a specific entry
|
|
26242
|
+
*/
|
|
26243
|
+
async setEntryExclusion(contentType, documentId, excludeFromTranslation) {
|
|
26244
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26245
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26246
|
+
const entryKey = this.getEntryKey(contentType, documentId);
|
|
26247
|
+
if (excludeFromTranslation) {
|
|
26248
|
+
exclusions[entryKey] = {
|
|
26249
|
+
contentType,
|
|
26250
|
+
documentId,
|
|
26251
|
+
excludeFromTranslation: true
|
|
26252
|
+
};
|
|
26253
|
+
} else {
|
|
26254
|
+
delete exclusions[entryKey];
|
|
26255
|
+
}
|
|
26256
|
+
await pluginStore.set({
|
|
26257
|
+
key: ENTRY_EXCLUSION_KEY,
|
|
26258
|
+
value: exclusions
|
|
26259
|
+
});
|
|
26260
|
+
},
|
|
26261
|
+
/**
|
|
26262
|
+
* Get all exclusions for a specific content type
|
|
26263
|
+
*/
|
|
26264
|
+
async getContentTypeExclusions(contentType) {
|
|
26265
|
+
const pluginStore = getStrapiStore(strapi2);
|
|
26266
|
+
const exclusions = await pluginStore.get({ key: ENTRY_EXCLUSION_KEY }) || {};
|
|
26267
|
+
return Object.values(exclusions).filter((exclusion) => exclusion.contentType === contentType && exclusion.excludeFromTranslation).map((exclusion) => exclusion.documentId);
|
|
26268
|
+
}
|
|
26269
|
+
});
|
|
26077
26270
|
const services = {
|
|
26078
26271
|
LocalazyUserService,
|
|
26079
26272
|
StrapiService,
|
|
@@ -26083,7 +26276,8 @@ const services = {
|
|
|
26083
26276
|
LocalazyTransferDownloadService,
|
|
26084
26277
|
StrapiI18nService,
|
|
26085
26278
|
LocalazyUploadService,
|
|
26086
|
-
StrapiLocalazyI18nService
|
|
26279
|
+
StrapiLocalazyI18nService,
|
|
26280
|
+
EntryExclusionService
|
|
26087
26281
|
};
|
|
26088
26282
|
const index = {
|
|
26089
26283
|
register,
|