@localazy/strapi-plugin 1.1.0 → 1.1.2

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 (65) hide show
  1. package/dist/_chunks/{FetchIdentity-DfV1OWMB.js → FetchIdentity-CevvxeEj.js} +73 -46
  2. package/dist/_chunks/{FetchIdentity-lkoWjYjn.mjs → FetchIdentity-DeThazz9.mjs} +43 -16
  3. package/dist/_chunks/{LanguagesSelector-BmWfSZq6.js → LanguagesSelector-BExpl4Vx.js} +15 -3
  4. package/dist/_chunks/{LanguagesSelector-vSZvVGUT.mjs → LanguagesSelector-D62gLZsM.mjs} +15 -3
  5. package/dist/_chunks/{LocalazyApp-st8mwIbM.mjs → LocalazyApp-Czkb4s5J.mjs} +791 -61
  6. package/dist/_chunks/{LocalazyApp-BUfYt7UL.js → LocalazyApp-DIcO748C.js} +791 -59
  7. package/dist/_chunks/{LocalazyContentTransferSetup-BjLBgqFO.js → LocalazyContentTransferSetup-DAyZdwi9.js} +13 -10
  8. package/dist/_chunks/{LocalazyContentTransferSetup-D2YvBYs_.mjs → LocalazyContentTransferSetup-Dx0Z6DXc.mjs} +13 -10
  9. package/dist/_chunks/{LocalazyGlobalSettings-DHCU2_RH.mjs → LocalazyGlobalSettings-DWMBqlN4.mjs} +149 -12
  10. package/dist/_chunks/{LocalazyGlobalSettings-Do5tOyhB.js → LocalazyGlobalSettings-DjrXGVxl.js} +148 -11
  11. package/dist/_chunks/{LocalazyPanel-CulgT97p.mjs → LocalazyPanel-B-0HBTL_.mjs} +4 -4
  12. package/dist/_chunks/{LocalazyPanel-BDxUI_RH.js → LocalazyPanel-nBOpQo5B.js} +4 -4
  13. package/dist/_chunks/{LocalazyStatusColumn-DoTWD2eL.mjs → LocalazyStatusColumn-CpO3yccG.mjs} +9 -7
  14. package/dist/_chunks/{LocalazyStatusColumn-Dpwoc5Ig.js → LocalazyStatusColumn-cGsUDMlX.js} +9 -7
  15. package/dist/_chunks/{RequireLocalazyAuth-BzM7C6Yw.js → RequireLocalazyAuth-56K8HUNR.js} +4 -4
  16. package/dist/_chunks/{RequireLocalazyAuth-CqHrZ1Ah.mjs → RequireLocalazyAuth-Dh-mAMcg.mjs} +4 -4
  17. package/dist/_chunks/{entry-exclusion-service-DWFMKgkA.mjs → entry-exclusion-service-Dm5_iP7I.mjs} +1 -1
  18. package/dist/_chunks/{entry-exclusion-service-Cvu8PQUI.js → entry-exclusion-service-Rf4Tr0zW.js} +1 -1
  19. package/dist/_chunks/{has-model-changed-CWdMNRB1.mjs → has-model-changed-6p1lR-Ho.mjs} +2 -2
  20. package/dist/_chunks/{has-model-changed-D1f6is8z.js → has-model-changed-CGyDQARr.js} +2 -2
  21. package/dist/_chunks/{i18n-DaBjUC3Y.js → i18n-CAsbU4pi.js} +62 -4
  22. package/dist/_chunks/{i18n-Bga-GG_Z.mjs → i18n-QelOdIB2.mjs} +62 -4
  23. package/dist/_chunks/{index-BSNW1ypR.js → index-BK7lmZSN.js} +57 -19
  24. package/dist/_chunks/{index-CtvR-R3c.mjs → index-Bpf1Mw2A.mjs} +8 -8
  25. package/dist/_chunks/{index-BgPI2yQD.js → index-BsQ_ie4C.js} +8 -8
  26. package/dist/_chunks/{index-BIHAiJnE.mjs → index-CHjIMO9T.mjs} +78 -40
  27. package/dist/_chunks/{strapi-api-base-CturxOqD.mjs → strapi-api-base-Bem_CGuz.mjs} +2 -2
  28. package/dist/_chunks/{strapi-api-base-CN6q5tPh.js → strapi-api-base-W_bUTSlY.js} +2 -2
  29. package/dist/admin/index.js +1 -1
  30. package/dist/admin/index.mjs +1 -1
  31. package/dist/admin/src/components/PluginErrorBoundary.d.ts +5 -0
  32. package/dist/admin/src/modules/@common/locale/en.d.ts +4 -0
  33. package/dist/admin/src/modules/@common/services/project-service.d.ts +9 -0
  34. package/dist/admin/src/modules/@common/styles/heading-fix.d.ts +7 -0
  35. package/dist/admin/src/modules/@common/utils/export-json.d.ts +1 -0
  36. package/dist/admin/src/modules/@common/utils/redirect-to-plugin-route.d.ts +1 -0
  37. package/dist/admin/src/modules/activity-logs/components/HighlightMatch.d.ts +6 -0
  38. package/dist/admin/src/modules/activity-logs/components/SessionMetadata.d.ts +7 -0
  39. package/dist/admin/src/modules/activity-logs/components/SessionsTable.d.ts +17 -0
  40. package/dist/admin/src/modules/activity-logs/components/SortableHeader.d.ts +10 -0
  41. package/dist/admin/src/modules/activity-logs/components/StatusLabel.d.ts +6 -0
  42. package/dist/admin/src/modules/activity-logs/hooks/use-debounced-search.d.ts +6 -0
  43. package/dist/admin/src/modules/activity-logs/locale/en.d.ts +33 -0
  44. package/dist/admin/src/modules/activity-logs/models/activity-logs.d.ts +19 -0
  45. package/dist/admin/src/modules/activity-logs/services/activity-logs-service.d.ts +6 -0
  46. package/dist/admin/src/modules/activity-logs/utils/export-logs.d.ts +1 -0
  47. package/dist/admin/src/modules/activity-logs/utils/format-utils.d.ts +4 -0
  48. package/dist/admin/src/modules/plugin-settings/components/WebhookSetup.d.ts +2 -0
  49. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +21 -0
  50. package/dist/admin/src/pages/ActivityLogDetail.d.ts +7 -0
  51. package/dist/admin/src/pages/ActivityLogs.d.ts +7 -0
  52. package/dist/server/index.js +395 -49
  53. package/dist/server/index.mjs +395 -49
  54. package/dist/server/src/controllers/activity-logs-controller.d.ts +10 -0
  55. package/dist/server/src/controllers/index.d.ts +12 -1
  56. package/dist/server/src/controllers/localazy-project-controller.d.ts +4 -1
  57. package/dist/server/src/core/index.d.ts +13 -0
  58. package/dist/server/src/db/model/activity-logs.d.ts +20 -0
  59. package/dist/server/src/db/model/plugin-settings.d.ts +14 -0
  60. package/dist/server/src/index.d.ts +27 -1
  61. package/dist/server/src/routes/activity-logs-routes.d.ts +9 -0
  62. package/dist/server/src/services/activity-logs-service.d.ts +17 -0
  63. package/dist/server/src/services/index.d.ts +15 -0
  64. package/dist/server/src/services/localazy-pubapi-service.d.ts +2 -0
  65. package/package.json +4 -3
@@ -20519,7 +20519,7 @@ var distExports = dist$1.exports;
20519
20519
  const io = /* @__PURE__ */ getDefaultExportFromCjs(distExports);
20520
20520
  const { Server: Server2, Namespace, Socket: Socket3 } = io;
20521
20521
  const name = "@localazy/strapi-plugin";
20522
- const version = "1.1.0";
20522
+ const version = "1.1.2";
20523
20523
  const description = "The official Strapi Plugin by Localazy.";
20524
20524
  const keywords = [
20525
20525
  "strapi",
@@ -20569,7 +20569,8 @@ const bin = {
20569
20569
  };
20570
20570
  const files = [
20571
20571
  "dist",
20572
- "install"
20572
+ "install",
20573
+ "README.md"
20573
20574
  ];
20574
20575
  const scripts = {
20575
20576
  build: "strapi-plugin build",
@@ -20585,7 +20586,7 @@ const scripts = {
20585
20586
  verify: "strapi-plugin verify",
20586
20587
  watch: "strapi-plugin watch",
20587
20588
  "watch:link": "strapi-plugin watch:link",
20588
- prepare: "husky"
20589
+ prepare: "husky || true"
20589
20590
  };
20590
20591
  const dependencies = {
20591
20592
  shelljs: "^0.8.5",
@@ -22063,6 +22064,9 @@ const getLocalazyUploadService = () => {
22063
22064
  const getEntryExclusionService = () => {
22064
22065
  return strapi.plugin(PLUGIN_NAME).service("EntryExclusionService");
22065
22066
  };
22067
+ const getActivityLogsService = () => {
22068
+ return strapi.plugin(PLUGIN_NAME).service("ActivityLogsService");
22069
+ };
22066
22070
  class PluginSettingsServiceHelper {
22067
22071
  constructor() {
22068
22072
  this.PluginSettingsService = getPluginSettingsService();
@@ -24199,13 +24203,74 @@ const StrapiController = ({ strapi: strapi2 }) => ({
24199
24203
  };
24200
24204
  }
24201
24205
  });
24202
- const LocalazyProjectController = ({ strapi: _strapi }) => ({
24206
+ const STRAPI_WEBHOOK_CUSTOM_ID = "strapi-plugin-localazy";
24207
+ const LocalazyProjectController = ({ strapi: strapi2 }) => ({
24203
24208
  async getConnectedProject(ctx) {
24204
24209
  const LocalazyUserService2 = getLocalazyUserService();
24205
24210
  const LocalazyPubAPIService2 = getLocalazyPubAPIService();
24206
24211
  const user = await LocalazyUserService2.getUser();
24207
24212
  const project = await LocalazyPubAPIService2.getProject(user.project.id, true, true);
24208
24213
  ctx.body = project;
24214
+ },
24215
+ async getWebhookStatus(ctx) {
24216
+ const LocalazyUserService2 = getLocalazyUserService();
24217
+ const user = await LocalazyUserService2.getUser();
24218
+ const LocalazyPubApiService = getLocalazyPubAPIService();
24219
+ const webhooks = await LocalazyPubApiService.listWebhooks(user.project.id);
24220
+ const ours = webhooks.find((w2) => w2.customId === STRAPI_WEBHOOK_CUSTOM_ID);
24221
+ if (ours) {
24222
+ ctx.body = { status: "configured", url: ours.url, enabled: ours.enabled };
24223
+ return;
24224
+ }
24225
+ ctx.body = { status: "not_configured" };
24226
+ },
24227
+ async setupWebhook(ctx) {
24228
+ const { url: url2 } = ctx.request.body;
24229
+ if (!url2 || typeof url2 !== "string") {
24230
+ return ctx.badRequest("Webhook URL is required");
24231
+ }
24232
+ try {
24233
+ const parsed = new URL(url2);
24234
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
24235
+ return ctx.badRequest("Webhook URL must use http or https protocol");
24236
+ }
24237
+ } catch {
24238
+ return ctx.badRequest("Invalid webhook URL");
24239
+ }
24240
+ const LocalazyUserService2 = getLocalazyUserService();
24241
+ const user = await LocalazyUserService2.getUser();
24242
+ const LocalazyPubApiService = getLocalazyPubAPIService();
24243
+ const PluginSettingsService2 = getPluginSettingsService();
24244
+ const existing = await LocalazyPubApiService.listWebhooks(user.project.id);
24245
+ const filtered = existing.filter((w2) => w2.customId !== STRAPI_WEBHOOK_CUSTOM_ID);
24246
+ const items = [
24247
+ ...filtered,
24248
+ {
24249
+ enabled: true,
24250
+ customId: STRAPI_WEBHOOK_CUSTOM_ID,
24251
+ url: url2,
24252
+ events: ["project_published"],
24253
+ description: "Strapi Plugin - Download translations"
24254
+ }
24255
+ ];
24256
+ await LocalazyPubApiService.updateWebhooks(user.project.id, items);
24257
+ await PluginSettingsService2.updatePluginSettings({
24258
+ webhookConfig: { url: url2 }
24259
+ });
24260
+ ctx.body = { success: true };
24261
+ },
24262
+ async getStrapiUrl(ctx) {
24263
+ let url2 = strapi2.config.get("server.url");
24264
+ if (!url2) {
24265
+ const host = strapi2.config.get("server.host") || "0.0.0.0";
24266
+ const port = strapi2.config.get("server.port") || 1337;
24267
+ const displayHost = host === "0.0.0.0" || host === "::" ? "localhost" : host;
24268
+ url2 = `http://${displayHost}:${port}`;
24269
+ }
24270
+ const isLocal = /^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(
24271
+ url2
24272
+ );
24273
+ ctx.body = { url: url2, isLocal };
24209
24274
  }
24210
24275
  });
24211
24276
  const PluginSettingsController = ({ strapi: _strapi }) => ({
@@ -24403,6 +24468,27 @@ const EntryExclusionController = ({ strapi: strapi2 }) => ({
24403
24468
  }
24404
24469
  }
24405
24470
  });
24471
+ const ActivityLogsController = ({ strapi: _strapi }) => ({
24472
+ async getSessions(ctx) {
24473
+ const { type: type2 } = ctx.query;
24474
+ ctx.body = await getActivityLogsService().getSessions(type2);
24475
+ },
24476
+ async getSession(ctx) {
24477
+ const { sessionId } = ctx.params;
24478
+ const session = await getActivityLogsService().getSession(sessionId);
24479
+ if (!session) {
24480
+ return ctx.notFound("Session not found");
24481
+ }
24482
+ ctx.body = session;
24483
+ },
24484
+ async exportSessions(ctx) {
24485
+ ctx.body = await getActivityLogsService().getAllSessionsWithEntries();
24486
+ },
24487
+ async clearSessions(ctx) {
24488
+ await getActivityLogsService().clearSessions();
24489
+ ctx.body = { success: true };
24490
+ }
24491
+ });
24406
24492
  const controllers = {
24407
24493
  LocalazyUserController,
24408
24494
  LocalazyAuthController,
@@ -24410,7 +24496,8 @@ const controllers = {
24410
24496
  LocalazyProjectController,
24411
24497
  PluginSettingsController,
24412
24498
  LocalazyTransferController,
24413
- EntryExclusionController
24499
+ EntryExclusionController,
24500
+ ActivityLogsController
24414
24501
  };
24415
24502
  const verifyWebhook = (config2, { strapi: strapi2 }) => {
24416
24503
  return async (ctx, next) => {
@@ -24467,11 +24554,11 @@ const middlewares = {
24467
24554
  verifyWebhook
24468
24555
  };
24469
24556
  const policies = {};
24470
- const ROUTE_PREFIX$7 = "/user";
24557
+ const ROUTE_PREFIX$8 = "/user";
24471
24558
  const LocalazyUserRoutes = [
24472
24559
  {
24473
24560
  method: "GET",
24474
- path: `${ROUTE_PREFIX$7}`,
24561
+ path: `${ROUTE_PREFIX$8}`,
24475
24562
  handler: "LocalazyUserController.getUser",
24476
24563
  config: {
24477
24564
  policies: []
@@ -24479,7 +24566,7 @@ const LocalazyUserRoutes = [
24479
24566
  },
24480
24567
  {
24481
24568
  method: "PUT",
24482
- path: `${ROUTE_PREFIX$7}`,
24569
+ path: `${ROUTE_PREFIX$8}`,
24483
24570
  handler: "LocalazyUserController.updateUser",
24484
24571
  config: {
24485
24572
  policies: []
@@ -24487,18 +24574,18 @@ const LocalazyUserRoutes = [
24487
24574
  },
24488
24575
  {
24489
24576
  method: "DELETE",
24490
- path: `${ROUTE_PREFIX$7}`,
24577
+ path: `${ROUTE_PREFIX$8}`,
24491
24578
  handler: "LocalazyUserController.deleteUser",
24492
24579
  config: {
24493
24580
  policies: []
24494
24581
  }
24495
24582
  }
24496
24583
  ];
24497
- const ROUTE_PREFIX$6 = "/auth";
24584
+ const ROUTE_PREFIX$7 = "/auth";
24498
24585
  const LocalazyAuthRoutes = [
24499
24586
  {
24500
24587
  method: "GET",
24501
- path: `${ROUTE_PREFIX$6}/generate-keys`,
24588
+ path: `${ROUTE_PREFIX$7}/generate-keys`,
24502
24589
  handler: "LocalazyAuthController.generateKeys",
24503
24590
  config: {
24504
24591
  policies: []
@@ -24506,18 +24593,18 @@ const LocalazyAuthRoutes = [
24506
24593
  },
24507
24594
  {
24508
24595
  method: "GET",
24509
- path: `${ROUTE_PREFIX$6}/continuous-poll`,
24596
+ path: `${ROUTE_PREFIX$7}/continuous-poll`,
24510
24597
  handler: "LocalazyAuthController.continuousPoll",
24511
24598
  config: {
24512
24599
  policies: []
24513
24600
  }
24514
24601
  }
24515
24602
  ];
24516
- const ROUTE_PREFIX$5 = "/plugin-settings";
24603
+ const ROUTE_PREFIX$6 = "/plugin-settings";
24517
24604
  const PluginSettingsRoutes = [
24518
24605
  {
24519
24606
  method: "GET",
24520
- path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
24607
+ path: `${ROUTE_PREFIX$6}/content-transfer-setup`,
24521
24608
  handler: "PluginSettingsController.getContentTransferSetup",
24522
24609
  config: {
24523
24610
  policies: []
@@ -24525,7 +24612,7 @@ const PluginSettingsRoutes = [
24525
24612
  },
24526
24613
  {
24527
24614
  method: "PUT",
24528
- path: `${ROUTE_PREFIX$5}/content-transfer-setup`,
24615
+ path: `${ROUTE_PREFIX$6}/content-transfer-setup`,
24529
24616
  handler: "PluginSettingsController.updateContentTransferSetup",
24530
24617
  config: {
24531
24618
  policies: []
@@ -24533,7 +24620,7 @@ const PluginSettingsRoutes = [
24533
24620
  },
24534
24621
  {
24535
24622
  method: "GET",
24536
- path: `${ROUTE_PREFIX$5}/plugin-settings`,
24623
+ path: `${ROUTE_PREFIX$6}/plugin-settings`,
24537
24624
  handler: "PluginSettingsController.getPluginSettings",
24538
24625
  config: {
24539
24626
  policies: []
@@ -24541,7 +24628,7 @@ const PluginSettingsRoutes = [
24541
24628
  },
24542
24629
  {
24543
24630
  method: "PUT",
24544
- path: `${ROUTE_PREFIX$5}/plugin-settings`,
24631
+ path: `${ROUTE_PREFIX$6}/plugin-settings`,
24545
24632
  handler: "PluginSettingsController.updatePluginSettings",
24546
24633
  config: {
24547
24634
  policies: []
@@ -24549,18 +24636,18 @@ const PluginSettingsRoutes = [
24549
24636
  },
24550
24637
  {
24551
24638
  method: "GET",
24552
- path: `${ROUTE_PREFIX$5}/sync-cursor`,
24639
+ path: `${ROUTE_PREFIX$6}/sync-cursor`,
24553
24640
  handler: "PluginSettingsController.getSyncCursor",
24554
24641
  config: {
24555
24642
  policies: []
24556
24643
  }
24557
24644
  }
24558
24645
  ];
24559
- const ROUTE_PREFIX$4 = "/strapi";
24646
+ const ROUTE_PREFIX$5 = "/strapi";
24560
24647
  const StrapiRoutes = [
24561
24648
  {
24562
24649
  method: "GET",
24563
- path: `${ROUTE_PREFIX$4}/models`,
24650
+ path: `${ROUTE_PREFIX$5}/models`,
24564
24651
  handler: "StrapiController.getModels",
24565
24652
  config: {
24566
24653
  policies: []
@@ -24568,7 +24655,7 @@ const StrapiRoutes = [
24568
24655
  },
24569
24656
  {
24570
24657
  method: "GET",
24571
- path: `${ROUTE_PREFIX$4}/localizable-models`,
24658
+ path: `${ROUTE_PREFIX$5}/localizable-models`,
24572
24659
  handler: "StrapiController.getLocalizableModels",
24573
24660
  config: {
24574
24661
  policies: []
@@ -24576,7 +24663,7 @@ const StrapiRoutes = [
24576
24663
  },
24577
24664
  {
24578
24665
  method: "POST",
24579
- path: `${ROUTE_PREFIX$4}/lifecycle/localazy-webhooks`,
24666
+ path: `${ROUTE_PREFIX$5}/lifecycle/localazy-webhooks`,
24580
24667
  handler: "StrapiController.postLifecycleLocalazyWebhooks",
24581
24668
  config: {
24582
24669
  policies: []
@@ -24584,18 +24671,18 @@ const StrapiRoutes = [
24584
24671
  },
24585
24672
  {
24586
24673
  method: "GET",
24587
- path: `${ROUTE_PREFIX$4}/version`,
24674
+ path: `${ROUTE_PREFIX$5}/version`,
24588
24675
  handler: "StrapiController.getPluginVersion",
24589
24676
  config: {
24590
24677
  policies: []
24591
24678
  }
24592
24679
  }
24593
24680
  ];
24594
- const ROUTE_PREFIX$3 = "/transfer";
24681
+ const ROUTE_PREFIX$4 = "/transfer";
24595
24682
  const LocalazyTransferRoutes = [
24596
24683
  {
24597
24684
  method: "POST",
24598
- path: `${ROUTE_PREFIX$3}/upload`,
24685
+ path: `${ROUTE_PREFIX$4}/upload`,
24599
24686
  handler: "LocalazyTransferController.upload",
24600
24687
  config: {
24601
24688
  policies: []
@@ -24603,29 +24690,53 @@ const LocalazyTransferRoutes = [
24603
24690
  },
24604
24691
  {
24605
24692
  method: "POST",
24606
- path: `${ROUTE_PREFIX$3}/download`,
24693
+ path: `${ROUTE_PREFIX$4}/download`,
24607
24694
  handler: "LocalazyTransferController.download",
24608
24695
  config: {
24609
24696
  policies: []
24610
24697
  }
24611
24698
  }
24612
24699
  ];
24613
- const ROUTE_PREFIX$2 = "/project";
24700
+ const ROUTE_PREFIX$3 = "/project";
24614
24701
  const LocalazyProjectRoutes = [
24615
24702
  {
24616
24703
  method: "GET",
24617
- path: `${ROUTE_PREFIX$2}`,
24704
+ path: `${ROUTE_PREFIX$3}`,
24618
24705
  handler: "LocalazyProjectController.getConnectedProject",
24619
24706
  config: {
24620
24707
  policies: []
24621
24708
  }
24709
+ },
24710
+ {
24711
+ method: "GET",
24712
+ path: `${ROUTE_PREFIX$3}/webhooks`,
24713
+ handler: "LocalazyProjectController.getWebhookStatus",
24714
+ config: {
24715
+ policies: []
24716
+ }
24717
+ },
24718
+ {
24719
+ method: "POST",
24720
+ path: `${ROUTE_PREFIX$3}/webhooks/setup`,
24721
+ handler: "LocalazyProjectController.setupWebhook",
24722
+ config: {
24723
+ policies: []
24724
+ }
24725
+ },
24726
+ {
24727
+ method: "GET",
24728
+ path: `${ROUTE_PREFIX$3}/strapi-url`,
24729
+ handler: "LocalazyProjectController.getStrapiUrl",
24730
+ config: {
24731
+ policies: []
24732
+ }
24622
24733
  }
24623
24734
  ];
24624
- const ROUTE_PREFIX$1 = "/public/transfer";
24735
+ const ROUTE_PREFIX$2 = "/public/transfer";
24625
24736
  const LocalazyPublicTransferRoutes = [
24626
24737
  {
24627
24738
  method: "POST",
24628
- path: `${ROUTE_PREFIX$1}/download`,
24739
+ path: `${ROUTE_PREFIX$2}/download`,
24629
24740
  handler: "LocalazyTransferController.download",
24630
24741
  config: {
24631
24742
  policies: [],
@@ -24635,11 +24746,11 @@ const LocalazyPublicTransferRoutes = [
24635
24746
  }
24636
24747
  }
24637
24748
  ];
24638
- const ROUTE_PREFIX = "/entry-exclusion";
24749
+ const ROUTE_PREFIX$1 = "/entry-exclusion";
24639
24750
  const EntryExclusionRoutes = [
24640
24751
  {
24641
24752
  method: "GET",
24642
- path: `${ROUTE_PREFIX}/:contentType/:documentId`,
24753
+ path: `${ROUTE_PREFIX$1}/:contentType/:documentId`,
24643
24754
  handler: "EntryExclusionController.getEntryExclusion",
24644
24755
  config: {
24645
24756
  policies: []
@@ -24647,7 +24758,7 @@ const EntryExclusionRoutes = [
24647
24758
  },
24648
24759
  {
24649
24760
  method: "PUT",
24650
- path: `${ROUTE_PREFIX}/:contentType/:documentId`,
24761
+ path: `${ROUTE_PREFIX$1}/:contentType/:documentId`,
24651
24762
  handler: "EntryExclusionController.setEntryExclusion",
24652
24763
  config: {
24653
24764
  policies: []
@@ -24655,13 +24766,48 @@ const EntryExclusionRoutes = [
24655
24766
  },
24656
24767
  {
24657
24768
  method: "GET",
24658
- path: `${ROUTE_PREFIX}/:contentType`,
24769
+ path: `${ROUTE_PREFIX$1}/:contentType`,
24659
24770
  handler: "EntryExclusionController.getContentTypeExclusions",
24660
24771
  config: {
24661
24772
  policies: []
24662
24773
  }
24663
24774
  }
24664
24775
  ];
24776
+ const ROUTE_PREFIX = "/activity-logs";
24777
+ const ActivityLogsRoutes = [
24778
+ {
24779
+ method: "GET",
24780
+ path: `${ROUTE_PREFIX}`,
24781
+ handler: "ActivityLogsController.getSessions",
24782
+ config: {
24783
+ policies: []
24784
+ }
24785
+ },
24786
+ {
24787
+ method: "GET",
24788
+ path: `${ROUTE_PREFIX}/export`,
24789
+ handler: "ActivityLogsController.exportSessions",
24790
+ config: {
24791
+ policies: []
24792
+ }
24793
+ },
24794
+ {
24795
+ method: "GET",
24796
+ path: `${ROUTE_PREFIX}/:sessionId`,
24797
+ handler: "ActivityLogsController.getSession",
24798
+ config: {
24799
+ policies: []
24800
+ }
24801
+ },
24802
+ {
24803
+ method: "DELETE",
24804
+ path: `${ROUTE_PREFIX}`,
24805
+ handler: "ActivityLogsController.clearSessions",
24806
+ config: {
24807
+ policies: []
24808
+ }
24809
+ }
24810
+ ];
24665
24811
  const routes = {
24666
24812
  "content-api": {
24667
24813
  routes: [...StrapiRoutes]
@@ -24675,14 +24821,15 @@ const routes = {
24675
24821
  ...StrapiRoutes,
24676
24822
  ...LocalazyTransferRoutes,
24677
24823
  ...LocalazyProjectRoutes,
24678
- ...EntryExclusionRoutes
24824
+ ...EntryExclusionRoutes,
24825
+ ...ActivityLogsRoutes
24679
24826
  ]
24680
24827
  },
24681
24828
  LocalazyPublicTransferRoutes: {
24682
24829
  routes: [...LocalazyPublicTransferRoutes]
24683
24830
  }
24684
24831
  };
24685
- const KEY$3 = "identity";
24832
+ const KEY$4 = "identity";
24686
24833
  const emptyIdentity = {
24687
24834
  accessToken: "",
24688
24835
  project: {
@@ -24706,13 +24853,13 @@ const getStrapiStore = (strapi2) => strapi2.store({
24706
24853
  const LocalazyUserService = ({ strapi: strapi2 }) => ({
24707
24854
  async getUser() {
24708
24855
  const pluginStore = getStrapiStore(strapi2);
24709
- const user = await pluginStore.get({ key: KEY$3 });
24856
+ const user = await pluginStore.get({ key: KEY$4 });
24710
24857
  return user || emptyIdentity;
24711
24858
  },
24712
24859
  async updateUser(identity2) {
24713
24860
  const pluginStore = getStrapiStore(strapi2);
24714
24861
  await pluginStore.set({
24715
- key: KEY$3,
24862
+ key: KEY$4,
24716
24863
  value: identity2
24717
24864
  });
24718
24865
  return identity2;
@@ -24831,6 +24978,25 @@ const LocalazyPubAPIService = ({ strapi: strapi2 }) => ({
24831
24978
  return null;
24832
24979
  }
24833
24980
  },
24981
+ async listWebhooks(projectId) {
24982
+ try {
24983
+ const LocalazyApi = await LocalazyApiClientFactory();
24984
+ const result = await LocalazyApi.webhooks.list({ project: projectId });
24985
+ return result;
24986
+ } catch (e2) {
24987
+ strapi2.log.error(e2);
24988
+ return [];
24989
+ }
24990
+ },
24991
+ async updateWebhooks(projectId, items) {
24992
+ try {
24993
+ const LocalazyApi = await LocalazyApiClientFactory();
24994
+ await LocalazyApi.webhooks.update({ project: projectId, items });
24995
+ } catch (e2) {
24996
+ strapi2.log.error(e2);
24997
+ throw e2;
24998
+ }
24999
+ },
24834
25000
  async getWebhooksSecret(projectId) {
24835
25001
  try {
24836
25002
  const LocalazyApi = await LocalazyApiClientFactory();
@@ -24842,23 +25008,23 @@ const LocalazyPubAPIService = ({ strapi: strapi2 }) => ({
24842
25008
  }
24843
25009
  }
24844
25010
  });
24845
- const KEY$2 = "content-transfer-setup";
25011
+ const KEY$3 = "content-transfer-setup";
24846
25012
  const emptyContentTransferSetup = {
24847
25013
  has_setup: false,
24848
25014
  setup: []
24849
25015
  };
24850
- const KEY$1 = "plugin-settings";
25016
+ const KEY$2 = "plugin-settings";
24851
25017
  const emptyPluginSettings = {
24852
25018
  defaultRoute: null
24853
25019
  };
24854
- const KEY = "sync-cursor";
25020
+ const KEY$1 = "sync-cursor";
24855
25021
  const emptySyncCursor = {
24856
25022
  processedKeys: {}
24857
25023
  };
24858
25024
  const PluginSettingsService = ({ strapi: strapi2 }) => ({
24859
25025
  async getContentTransferSetup() {
24860
25026
  const pluginStore = getStrapiStore(strapi2);
24861
- const setup2 = await pluginStore.get({ key: KEY$2 });
25027
+ const setup2 = await pluginStore.get({ key: KEY$3 });
24862
25028
  return setup2 || emptyContentTransferSetup;
24863
25029
  },
24864
25030
  async updateContentTransferSetup(setup2) {
@@ -24868,14 +25034,14 @@ const PluginSettingsService = ({ strapi: strapi2 }) => ({
24868
25034
  };
24869
25035
  const pluginStore = getStrapiStore(strapi2);
24870
25036
  await pluginStore.set({
24871
- key: KEY$2,
25037
+ key: KEY$3,
24872
25038
  value: newSetup
24873
25039
  });
24874
25040
  return newSetup;
24875
25041
  },
24876
25042
  async getPluginSettings() {
24877
25043
  const pluginStore = getStrapiStore(strapi2);
24878
- const settings = await pluginStore.get({ key: KEY$1 });
25044
+ const settings = await pluginStore.get({ key: KEY$2 });
24879
25045
  return settings || emptyPluginSettings;
24880
25046
  },
24881
25047
  async updatePluginSettings(settings) {
@@ -24886,20 +25052,20 @@ const PluginSettingsService = ({ strapi: strapi2 }) => ({
24886
25052
  };
24887
25053
  const pluginStore = getStrapiStore(strapi2);
24888
25054
  await pluginStore.set({
24889
- key: KEY$1,
25055
+ key: KEY$2,
24890
25056
  value: newSettings
24891
25057
  });
24892
25058
  return newSettings;
24893
25059
  },
24894
25060
  async getSyncCursor() {
24895
25061
  const pluginStore = getStrapiStore(strapi2);
24896
- const cursor = await pluginStore.get({ key: KEY });
25062
+ const cursor = await pluginStore.get({ key: KEY$1 });
24897
25063
  return cursor || emptySyncCursor;
24898
25064
  },
24899
25065
  async updateSyncCursor(cursor) {
24900
25066
  const pluginStore = getStrapiStore(strapi2);
24901
25067
  await pluginStore.set({
24902
- key: KEY,
25068
+ key: KEY$1,
24903
25069
  value: cursor
24904
25070
  });
24905
25071
  return cursor;
@@ -24911,6 +25077,9 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24911
25077
  await notificationService.emit(EventType.UPLOAD, {
24912
25078
  message: "Upload started"
24913
25079
  });
25080
+ const activityLogsService = getActivityLogsService();
25081
+ const sessionId = await activityLogsService.startSession("upload", "Strapi User");
25082
+ await activityLogsService.addEntry(sessionId, "Upload started");
24914
25083
  let success = true;
24915
25084
  const StrapiService2 = getStrapiService();
24916
25085
  const StrapiI18nService2 = getStrapiI18nService();
@@ -24924,6 +25093,8 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24924
25093
  success,
24925
25094
  message
24926
25095
  });
25096
+ await activityLogsService.addEntry(sessionId, message);
25097
+ await activityLogsService.finishSession(sessionId, "failed", message);
24927
25098
  strapi2.log.info(message);
24928
25099
  return;
24929
25100
  }
@@ -24944,6 +25115,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24944
25115
  await notificationService.emit(EventType.UPLOAD, {
24945
25116
  message: message2
24946
25117
  });
25118
+ await activityLogsService.addEntry(sessionId, message2);
24947
25119
  strapi2.log.info(message2);
24948
25120
  continue;
24949
25121
  }
@@ -24954,6 +25126,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24954
25126
  await notificationService.emit(EventType.UPLOAD, {
24955
25127
  message: message2
24956
25128
  });
25129
+ await activityLogsService.addEntry(sessionId, message2);
24957
25130
  strapi2.log.warn(message2);
24958
25131
  continue;
24959
25132
  }
@@ -24980,6 +25153,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24980
25153
  await notificationService.emit(EventType.UPLOAD, {
24981
25154
  message: message2
24982
25155
  });
25156
+ await activityLogsService.addEntry(sessionId, message2);
24983
25157
  strapi2.log.info(message2);
24984
25158
  continue;
24985
25159
  }
@@ -24987,6 +25161,7 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
24987
25161
  await notificationService.emit(EventType.UPLOAD, {
24988
25162
  message
24989
25163
  });
25164
+ await activityLogsService.addEntry(sessionId, message);
24990
25165
  strapi2.log.info(message);
24991
25166
  entries = omitDeep(entries, ["locale", "createdAt", "updatedAt", "publishedAt"]);
24992
25167
  entries.forEach((entry) => {
@@ -25024,12 +25199,33 @@ const LocalazyTransferUploadService = ({ strapi: strapi2 }) => ({
25024
25199
  await notificationService.emit(EventType.UPLOAD, {
25025
25200
  message: "Uploading collections to Localazy..."
25026
25201
  });
25027
- await LocalazyUploadService2.upload(importFile, uploadConfig);
25202
+ await activityLogsService.addEntry(sessionId, "Uploading collections to Localazy...");
25203
+ try {
25204
+ await LocalazyUploadService2.upload(importFile, uploadConfig);
25205
+ } catch (error) {
25206
+ success = false;
25207
+ const errorMessage = `Upload to Localazy failed: ${error instanceof Error ? error.message : String(error)}`;
25208
+ strapi2.log.error(errorMessage);
25209
+ await notificationService.emit(EventType.UPLOAD_FINISHED, {
25210
+ success,
25211
+ message: errorMessage
25212
+ });
25213
+ await activityLogsService.addEntry(sessionId, errorMessage);
25214
+ await activityLogsService.finishSession(sessionId, "failed", errorMessage);
25215
+ console.timeEnd("upload");
25216
+ return;
25217
+ }
25028
25218
  strapi2.log.info("Upload finished in");
25029
25219
  await notificationService.emit(EventType.UPLOAD_FINISHED, {
25030
25220
  success,
25031
25221
  message: "Upload finished"
25032
25222
  });
25223
+ await activityLogsService.addEntry(sessionId, "Upload finished");
25224
+ await activityLogsService.finishSession(
25225
+ sessionId,
25226
+ success ? "completed" : "failed",
25227
+ success ? "Upload completed successfully" : "Upload finished with errors"
25228
+ );
25033
25229
  console.timeEnd("upload");
25034
25230
  }
25035
25231
  });
@@ -25448,6 +25644,12 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25448
25644
  await notificationService.emit(EventType.DOWNLOAD, {
25449
25645
  message: `Download started (${syncMode})`
25450
25646
  });
25647
+ const activityLogsService = getActivityLogsService();
25648
+ const requestInitiatorHelper = new RequestInitiatorHelper(strapi2);
25649
+ const isWebhook = requestInitiatorHelper.isInitiatedByLocalazyWebhook();
25650
+ const initiatedBy = isWebhook ? "Webhook" : "Strapi User";
25651
+ const sessionId = await activityLogsService.startSession(isWebhook ? "webhook" : "download", initiatedBy);
25652
+ await activityLogsService.addEntry(sessionId, `Download started (${syncMode})`);
25451
25653
  let success = true;
25452
25654
  const StrapiService2 = getStrapiService();
25453
25655
  const StrapiI18nService2 = getStrapiI18nService();
@@ -25466,6 +25668,8 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25466
25668
  success,
25467
25669
  message
25468
25670
  });
25671
+ await activityLogsService.addEntry(sessionId, message);
25672
+ await activityLogsService.finishSession(sessionId, "failed", message);
25469
25673
  return;
25470
25674
  }
25471
25675
  const project = await LocalazyPubAPIService2.getProject(user.project.id, false, true);
@@ -25477,6 +25681,8 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25477
25681
  success,
25478
25682
  message
25479
25683
  });
25684
+ await activityLogsService.addEntry(sessionId, message);
25685
+ await activityLogsService.finishSession(sessionId, "failed", message);
25480
25686
  return;
25481
25687
  }
25482
25688
  const projectLanguages = project.languages;
@@ -25490,6 +25696,8 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25490
25696
  success,
25491
25697
  message
25492
25698
  });
25699
+ await activityLogsService.addEntry(sessionId, message);
25700
+ await activityLogsService.finishSession(sessionId, "failed", message);
25493
25701
  return;
25494
25702
  }
25495
25703
  const projectSourceLanguageCode = sourceLanguage.code;
@@ -25503,6 +25711,8 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25503
25711
  success,
25504
25712
  message
25505
25713
  });
25714
+ await activityLogsService.addEntry(sessionId, message);
25715
+ await activityLogsService.finishSession(sessionId, "completed", message);
25506
25716
  return;
25507
25717
  }
25508
25718
  let languagesCodes = projectLanguagesWithoutSourceLanguage.map((language3) => language3.code);
@@ -25521,6 +25731,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25521
25731
  await notificationService.emit(EventType.DOWNLOAD, {
25522
25732
  message: `Created locale ${newLocale.code}`
25523
25733
  });
25734
+ await activityLogsService.addEntry(sessionId, `Created locale ${newLocale.code}`);
25524
25735
  } catch (e2) {
25525
25736
  strapi2.log.error(e2.message);
25526
25737
  if (e2.name === "ValidationError") {
@@ -25528,10 +25739,12 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25528
25739
  await notificationService.emit(EventType.DOWNLOAD, {
25529
25740
  message: `Language ${isoLocalazy} is not supported by Strapi`
25530
25741
  });
25742
+ await activityLogsService.addEntry(sessionId, `Language ${isoLocalazy} is not supported by Strapi`);
25531
25743
  } else {
25532
25744
  await notificationService.emit(EventType.DOWNLOAD, {
25533
25745
  message: e2.message
25534
25746
  });
25747
+ await activityLogsService.addEntry(sessionId, e2.message);
25535
25748
  }
25536
25749
  }
25537
25750
  }
@@ -25556,6 +25769,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25556
25769
  await notificationService.emit(EventType.DOWNLOAD, {
25557
25770
  message: `No keys found for language ${isoLocalazy}`
25558
25771
  });
25772
+ await activityLogsService.addEntry(sessionId, `No keys found for language ${isoLocalazy}`);
25559
25773
  } else {
25560
25774
  const newKeys = langKeys.filter((k2) => {
25561
25775
  const storedEvent = langProcessedKeys[k2.id];
@@ -25564,6 +25778,10 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25564
25778
  await notificationService.emit(EventType.DOWNLOAD, {
25565
25779
  message: `${syncMode}: ${newKeys.length} changed / ${langKeys.length} total keys for language ${isoLocalazy}`
25566
25780
  });
25781
+ await activityLogsService.addEntry(
25782
+ sessionId,
25783
+ `${syncMode}: ${newKeys.length} changed / ${langKeys.length} total keys for language ${isoLocalazy}`
25784
+ );
25567
25785
  }
25568
25786
  localazyContent[isoLocalazy] = langKeys;
25569
25787
  }
@@ -25716,6 +25934,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25716
25934
  await notificationService.emit(EventType.DOWNLOAD, {
25717
25935
  message
25718
25936
  });
25937
+ await activityLogsService.addEntry(sessionId, message);
25719
25938
  await markKeysProcessed(sourceKeys);
25720
25939
  } catch (e2) {
25721
25940
  success = false;
@@ -25728,6 +25947,10 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25728
25947
  localazy: localazySearchUrl
25729
25948
  }
25730
25949
  });
25950
+ await activityLogsService.addEntry(
25951
+ sessionId,
25952
+ `Failed to create ${uid} [${documentId}] in ${isoStrapi}: ${e2.message}`
25953
+ );
25731
25954
  }
25732
25955
  } else {
25733
25956
  try {
@@ -25745,6 +25968,7 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25745
25968
  await notificationService.emit(EventType.DOWNLOAD, {
25746
25969
  message
25747
25970
  });
25971
+ await activityLogsService.addEntry(sessionId, message);
25748
25972
  await markKeysProcessed(sourceKeys);
25749
25973
  } catch (e2) {
25750
25974
  success = false;
@@ -25757,6 +25981,10 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25757
25981
  localazy: localazySearchUrl
25758
25982
  }
25759
25983
  });
25984
+ await activityLogsService.addEntry(
25985
+ sessionId,
25986
+ `Failed to update ${uid} [${documentId}] in ${isoStrapi}: ${e2.message}`
25987
+ );
25760
25988
  }
25761
25989
  }
25762
25990
  } catch (e2) {
@@ -25765,6 +25993,10 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25765
25993
  await notificationService.emit(EventType.DOWNLOAD, {
25766
25994
  message: `Error processing ${uid} [${documentId}] in ${isoStrapi}: ${e2.message}`
25767
25995
  });
25996
+ await activityLogsService.addEntry(
25997
+ sessionId,
25998
+ `Error processing ${uid} [${documentId}] in ${isoStrapi}: ${e2.message}`
25999
+ );
25768
26000
  }
25769
26001
  }
25770
26002
  }
@@ -25780,6 +26012,13 @@ const LocalazyTransferDownloadService = ({ strapi: strapi2 }) => ({
25780
26012
  success,
25781
26013
  message: "Download finished"
25782
26014
  });
26015
+ const finishMessage = `Download finished. Tracked ${totalProcessedKeys} processed keys across ${Object.keys(processedKeys).length} languages.`;
26016
+ await activityLogsService.addEntry(sessionId, finishMessage);
26017
+ await activityLogsService.finishSession(
26018
+ sessionId,
26019
+ success ? "completed" : "failed",
26020
+ success ? "Download completed successfully" : "Download finished with errors"
26021
+ );
25783
26022
  console.timeEnd("download");
25784
26023
  }
25785
26024
  });
@@ -26503,6 +26742,112 @@ const EntryExclusionService = ({ strapi: strapi2 }) => ({
26503
26742
  return Object.values(exclusions).filter((exclusion) => exclusion.contentType === contentType && exclusion.excludeFromTranslation).map((exclusion) => exclusion.documentId);
26504
26743
  }
26505
26744
  });
26745
+ const KEY = "activity-logs";
26746
+ const emptyActivityLogs = {
26747
+ sessions: []
26748
+ };
26749
+ const ONE_YEAR_MS = 365 * 24 * 60 * 60 * 1e3;
26750
+ let writeLock = Promise.resolve();
26751
+ const withLock = async (fn) => {
26752
+ let release;
26753
+ const next = new Promise((resolve) => {
26754
+ release = resolve;
26755
+ });
26756
+ const prev2 = writeLock;
26757
+ writeLock = next;
26758
+ await prev2;
26759
+ try {
26760
+ return await fn();
26761
+ } finally {
26762
+ release();
26763
+ }
26764
+ };
26765
+ const ActivityLogsService = ({ strapi: strapi2 }) => ({
26766
+ async getActivityLogs() {
26767
+ const pluginStore = getStrapiStore(strapi2);
26768
+ const logs = await pluginStore.get({ key: KEY });
26769
+ return logs || { sessions: [] };
26770
+ },
26771
+ async saveActivityLogs(logs) {
26772
+ const pluginStore = getStrapiStore(strapi2);
26773
+ await pluginStore.set({
26774
+ key: KEY,
26775
+ value: logs
26776
+ });
26777
+ },
26778
+ async startSession(eventType, initiatedBy) {
26779
+ return withLock(async () => {
26780
+ const logs = await this.getActivityLogs();
26781
+ const sessionId = generateRandomId();
26782
+ const session = {
26783
+ id: sessionId,
26784
+ eventType,
26785
+ status: "in-progress",
26786
+ startedAt: Date.now(),
26787
+ initiatedBy,
26788
+ summary: "",
26789
+ entries: []
26790
+ };
26791
+ logs.sessions.unshift(session);
26792
+ const cutoff = Date.now() - ONE_YEAR_MS;
26793
+ logs.sessions = logs.sessions.filter((s2) => s2.startedAt >= cutoff);
26794
+ await this.saveActivityLogs(logs);
26795
+ return sessionId;
26796
+ });
26797
+ },
26798
+ async addEntry(sessionId, message, data) {
26799
+ return withLock(async () => {
26800
+ const logs = await this.getActivityLogs();
26801
+ const session = logs.sessions.find((s2) => s2.id === sessionId);
26802
+ if (!session) {
26803
+ return;
26804
+ }
26805
+ const entry = {
26806
+ message,
26807
+ timestamp: Date.now(),
26808
+ data
26809
+ };
26810
+ session.entries.push(entry);
26811
+ await this.saveActivityLogs(logs);
26812
+ });
26813
+ },
26814
+ async finishSession(sessionId, status, summary) {
26815
+ return withLock(async () => {
26816
+ const logs = await this.getActivityLogs();
26817
+ const session = logs.sessions.find((s2) => s2.id === sessionId);
26818
+ if (!session) {
26819
+ return;
26820
+ }
26821
+ session.status = status;
26822
+ session.finishedAt = Date.now();
26823
+ session.summary = summary;
26824
+ await this.saveActivityLogs(logs);
26825
+ });
26826
+ },
26827
+ async getSessions(eventType) {
26828
+ const logs = await this.getActivityLogs();
26829
+ let { sessions } = logs;
26830
+ if (eventType) {
26831
+ sessions = sessions.filter((s2) => s2.eventType === eventType);
26832
+ }
26833
+ return sessions.map((s2) => ({
26834
+ ...s2,
26835
+ entries: []
26836
+ }));
26837
+ },
26838
+ async getAllSessionsWithEntries() {
26839
+ const logs = await this.getActivityLogs();
26840
+ return logs.sessions;
26841
+ },
26842
+ async getSession(sessionId) {
26843
+ const logs = await this.getActivityLogs();
26844
+ const session = logs.sessions.find((s2) => s2.id === sessionId);
26845
+ return session || null;
26846
+ },
26847
+ async clearSessions() {
26848
+ await this.saveActivityLogs(emptyActivityLogs);
26849
+ }
26850
+ });
26506
26851
  const services = {
26507
26852
  LocalazyUserService,
26508
26853
  StrapiService,
@@ -26513,7 +26858,8 @@ const services = {
26513
26858
  StrapiI18nService,
26514
26859
  LocalazyUploadService,
26515
26860
  StrapiLocalazyI18nService,
26516
- EntryExclusionService
26861
+ EntryExclusionService,
26862
+ ActivityLogsService
26517
26863
  };
26518
26864
  const index = {
26519
26865
  register,