@upsnap/strapi 1.0.9 → 1.0.11

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.
@@ -1,27 +1,42 @@
1
- const bootstrap = ({ strapi }) => {
2
- };
3
- const destroy = ({ strapi }) => {
4
- };
5
- const register = ({ strapi }) => {
6
- };
7
- const config = {
8
- default: {},
9
- validator() {
10
- }
11
- };
12
- const contentTypes = {};
13
- const controller = ({ strapi }) => ({
14
- index(ctx) {
15
- ctx.body = strapi.plugin("upsnap").service("service").getWelcomeMessage();
16
- }
17
- });
18
1
  const BACKEND_URL = "https://api.upsnap.ai/v1";
19
2
  const LIGHTHOUSE_CHECKS = ["performance", "accessibility", "bestPractices", "seo", "pwa"];
20
- const service = ({ strapi }) => ({
3
+ const version = "1.0.11";
4
+ const repository = { "type": "git", "url": "https://github.com/Appfoster/upsnap-strapi" };
5
+ const keywords = [];
6
+ const type = "commonjs";
7
+ const exports$1 = { "./package.json": "./package.json", "./strapi-admin": { "types": "./dist/admin/src/index.d.ts", "source": "./admin/src/index.ts", "import": "./dist/admin/index.mjs", "require": "./dist/admin/index.js", "default": "./dist/admin/index.js" }, "./strapi-server": { "types": "./dist/server/src/index.d.ts", "source": "./server/src/index.ts", "import": "./dist/server/index.mjs", "require": "./dist/server/index.js", "default": "./dist/server/index.js" } };
8
+ const files = ["dist"];
9
+ const scripts = { "build": "strapi-plugin build", "watch": "strapi-plugin watch", "watch:link": "strapi-plugin watch:link", "verify": "strapi-plugin verify", "test:ts:front": "run -T tsc -p admin/tsconfig.json", "test:ts:back": "run -T tsc -p server/tsconfig.json" };
10
+ const dependencies = { "@strapi/design-system": "^2.0.0-rc.30", "@strapi/icons": "^2.0.0-rc.30", "axios": "^1.13.5", "react-apexcharts": "^2.0.1", "react-intl": "^6.6.0", "react-toastify": "^11.0.5" };
11
+ const devDependencies = { "@strapi/sdk-plugin": "^6.0.1", "@strapi/strapi": "^5.37.1", "@strapi/typescript-utils": "^5.37.1", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "prettier": "^3.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.30.3", "styled-components": "^6.3.11", "typescript": "^5.9.3" };
12
+ const peerDependencies = { "@strapi/sdk-plugin": "^5.4.0", "@strapi/strapi": "^5.0.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.30.3", "styled-components": "^6.3.11" };
13
+ const strapi = { "kind": "plugin", "name": "upsnap", "displayName": "Upsnap", "description": "Complete website health monitoring for Strapi, including uptime, SSL certificates, broken links, performance metrics, domain health, and mixed content issues." };
14
+ const name = "@upsnap/strapi";
15
+ const description = "Complete website health monitoring for Strapi, including uptime, SSL certificates, broken links, performance metrics, domain health, and mixed content issues.";
16
+ const license = "MIT";
17
+ const author = "Upsnap <support@upsnap.ai>";
18
+ const packageJson = {
19
+ version,
20
+ repository,
21
+ keywords,
22
+ type,
23
+ exports: exports$1,
24
+ files,
25
+ scripts,
26
+ dependencies,
27
+ devDependencies,
28
+ peerDependencies,
29
+ strapi,
30
+ name,
31
+ description,
32
+ license,
33
+ author
34
+ };
35
+ const service = ({ strapi: strapi2 }) => ({
21
36
  getWelcomeMessage() {
22
37
  return "Welcome to Strapi 🚀";
23
38
  },
24
- settingsStore: strapi.store({
39
+ settingsStore: strapi2.store({
25
40
  type: "plugin",
26
41
  name: "upsnap",
27
42
  key: "settings"
@@ -59,11 +74,65 @@ const service = ({ strapi }) => ({
59
74
  data: await response.arrayBuffer(),
60
75
  headers: response.headers
61
76
  };
77
+ },
78
+ async trackInstallation() {
79
+ try {
80
+ const settings2 = await this.settingsStore.get();
81
+ if (settings2?.installationTracked) {
82
+ return;
83
+ }
84
+ const pluginVersion = packageJson.version;
85
+ const strapiVersion = strapi2.config.get("info.strapi");
86
+ const siteUrl = strapi2.config.get("server.url") || `http://${strapi2.config.get("server.host") || "localhost"}:${strapi2.config.get("server.port") || 1337}`;
87
+ const response = await this.makeBackendRequest(
88
+ "/installation-data",
89
+ {
90
+ method: "POST",
91
+ body: JSON.stringify({
92
+ platform: "strapi",
93
+ details: {
94
+ version: pluginVersion,
95
+ site_url: siteUrl,
96
+ strapi_version: strapiVersion
97
+ }
98
+ })
99
+ },
100
+ true
101
+ );
102
+ if (response?.status === "success") {
103
+ await this.settingsStore.set({
104
+ value: {
105
+ ...settings2,
106
+ installationTracked: true
107
+ }
108
+ });
109
+ }
110
+ } catch (error) {
111
+ console.log("UpSnap: Failed to track installation data ", error);
112
+ }
62
113
  }
63
114
  });
64
- const settings = ({ strapi }) => ({
115
+ const bootstrap = async ({ strapi: strapi2 }) => {
116
+ await service({ strapi: strapi2 }).trackInstallation();
117
+ };
118
+ const destroy = ({ strapi: strapi2 }) => {
119
+ };
120
+ const register = ({ strapi: strapi2 }) => {
121
+ };
122
+ const config = {
123
+ default: {},
124
+ validator() {
125
+ }
126
+ };
127
+ const contentTypes = {};
128
+ const controller = ({ strapi: strapi2 }) => ({
129
+ index(ctx) {
130
+ ctx.body = strapi2.plugin("upsnap").service("service").getWelcomeMessage();
131
+ }
132
+ });
133
+ const settings = ({ strapi: strapi2 }) => ({
65
134
  async get(ctx) {
66
- const settings2 = await service({ strapi }).settingsStore.get();
135
+ const settings2 = await service({ strapi: strapi2 }).settingsStore.get();
67
136
  ctx.body = {
68
137
  token: settings2?.token ?? null,
69
138
  primaryMonitorId: settings2?.primaryMonitorId ?? null
@@ -72,7 +141,7 @@ const settings = ({ strapi }) => ({
72
141
  async set(ctx) {
73
142
  const { token, logOut } = ctx.request.body;
74
143
  if (!logOut) {
75
- const isValidData = await service({ strapi }).makeBackendRequest("/tokens/validate", {
144
+ const isValidData = await service({ strapi: strapi2 }).makeBackendRequest("/tokens/validate", {
76
145
  method: "POST",
77
146
  body: JSON.stringify({ token })
78
147
  }, true);
@@ -81,7 +150,7 @@ const settings = ({ strapi }) => ({
81
150
  return;
82
151
  }
83
152
  }
84
- const store = service({ strapi }).settingsStore;
153
+ const store = service({ strapi: strapi2 }).settingsStore;
85
154
  const current = await store.get() || {};
86
155
  await store.set({
87
156
  value: {
@@ -93,7 +162,7 @@ const settings = ({ strapi }) => ({
93
162
  },
94
163
  async setPrimaryMonitorId(ctx) {
95
164
  const { monitorId } = ctx.request.body;
96
- const store = service({ strapi }).settingsStore;
165
+ const store = service({ strapi: strapi2 }).settingsStore;
97
166
  const current = await store.get() || {};
98
167
  await store.set({
99
168
  value: {
@@ -104,7 +173,7 @@ const settings = ({ strapi }) => ({
104
173
  ctx.body = { ok: true };
105
174
  },
106
175
  async getPrimaryMonitorId(ctx) {
107
- const settings2 = await service({ strapi }).settingsStore.get();
176
+ const settings2 = await service({ strapi: strapi2 }).settingsStore.get();
108
177
  ctx.body = { primaryMonitorId: settings2?.primaryMonitorId };
109
178
  }
110
179
  });
@@ -332,10 +401,10 @@ function buildBrokenLinksErrorResponse(raw) {
332
401
  data: raw
333
402
  };
334
403
  }
335
- const monitor = ({ strapi }) => ({
404
+ const monitor = ({ strapi: strapi2 }) => ({
336
405
  async getById(ctx) {
337
406
  const monitorId = ctx.params.id;
338
- const token = await service({ strapi }).getToken();
407
+ const token = await service({ strapi: strapi2 }).getToken();
339
408
  const monitorResponse = await fetch(`${BACKEND_URL}/user/monitors/${monitorId}`, {
340
409
  method: "GET",
341
410
  headers: {
@@ -347,7 +416,7 @@ const monitor = ({ strapi }) => ({
347
416
  ctx.body = { monitor: monitor2 };
348
417
  },
349
418
  async get(ctx) {
350
- const monitorsData = await service({ strapi }).makeBackendRequest(
419
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(
351
420
  `/user/monitors`,
352
421
  {
353
422
  method: "GET"
@@ -358,7 +427,7 @@ const monitor = ({ strapi }) => ({
358
427
  async getMonitorUptimeStats(ctx) {
359
428
  const monitorId = ctx.params.id;
360
429
  const { region } = ctx.query;
361
- const uptimeStatsData = await service({ strapi }).makeBackendRequest(
430
+ const uptimeStatsData = await service({ strapi: strapi2 }).makeBackendRequest(
362
431
  `/user/monitors/${monitorId}/uptime-stats?uptime_stats_time_frames=day,week,month&region=${region}`,
363
432
  {
364
433
  method: "GET"
@@ -369,7 +438,7 @@ const monitor = ({ strapi }) => ({
369
438
  async getMonitorHistogram(ctx) {
370
439
  const monitorId = ctx.params.id;
371
440
  const { region } = ctx.query;
372
- const histogramData = await service({ strapi }).makeBackendRequest(
441
+ const histogramData = await service({ strapi: strapi2 }).makeBackendRequest(
373
442
  `/user/monitors/${monitorId}/histogram?region=${region}`,
374
443
  {
375
444
  method: "GET"
@@ -379,7 +448,7 @@ const monitor = ({ strapi }) => ({
379
448
  },
380
449
  async getHealthChecks(ctx) {
381
450
  const { monitorUrl } = ctx.request.body;
382
- const healthCheckData = await service({ strapi }).makeBackendRequest(`/healthcheck`, {
451
+ const healthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(`/healthcheck`, {
383
452
  method: "POST",
384
453
  headers: {
385
454
  "X-Requested-From": "craft"
@@ -395,7 +464,7 @@ const monitor = ({ strapi }) => ({
395
464
  },
396
465
  async getUptimeHealthCheck(ctx) {
397
466
  const { monitorUrl } = ctx.request.body;
398
- const uptimeHealthCheckData = await service({ strapi }).makeBackendRequest(
467
+ const uptimeHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(
399
468
  `/healthcheck`,
400
469
  {
401
470
  method: "POST",
@@ -420,7 +489,7 @@ const monitor = ({ strapi }) => ({
420
489
  },
421
490
  async getSslHealthCheck(ctx) {
422
491
  const { monitorUrl } = ctx.request.body;
423
- const sslHealthCheckData = await service({ strapi }).makeBackendRequest(`/healthcheck`, {
492
+ const sslHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(`/healthcheck`, {
424
493
  method: "POST",
425
494
  headers: {
426
495
  "X-Requested-From": "craft"
@@ -442,7 +511,7 @@ const monitor = ({ strapi }) => ({
442
511
  },
443
512
  async getDomainHealthCheck(ctx) {
444
513
  const { monitorUrl } = ctx.request.body;
445
- const domainHealthCheckData = await service({ strapi }).makeBackendRequest(
514
+ const domainHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(
446
515
  `/healthcheck`,
447
516
  {
448
517
  method: "POST",
@@ -467,7 +536,7 @@ const monitor = ({ strapi }) => ({
467
536
  },
468
537
  async getLighthouseHealthCheck(ctx) {
469
538
  const { monitorUrl, strategy } = ctx.request.body;
470
- const lighthouseHealthCheckData = await service({ strapi }).makeBackendRequest(
539
+ const lighthouseHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(
471
540
  `/healthcheck`,
472
541
  {
473
542
  method: "POST",
@@ -497,7 +566,7 @@ const monitor = ({ strapi }) => ({
497
566
  },
498
567
  async getBrokenLinksHealthCheck(ctx) {
499
568
  const { monitorUrl } = ctx.request.body;
500
- const brokenLinksHealthCheckData = await service({ strapi }).makeBackendRequest(
569
+ const brokenLinksHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(
501
570
  `/healthcheck`,
502
571
  {
503
572
  method: "POST",
@@ -526,7 +595,7 @@ const monitor = ({ strapi }) => ({
526
595
  },
527
596
  async getMixedContentHealthCheck(ctx) {
528
597
  const { monitorUrl } = ctx.request.body;
529
- const mixedContentHealthCheckData = await service({ strapi }).makeBackendRequest(
598
+ const mixedContentHealthCheckData = await service({ strapi: strapi2 }).makeBackendRequest(
530
599
  `/healthcheck`,
531
600
  {
532
601
  method: "POST",
@@ -545,7 +614,7 @@ const monitor = ({ strapi }) => ({
545
614
  async getMonitorResponseTime(ctx) {
546
615
  const monitorId = ctx.params.id;
547
616
  const { start, end, region } = ctx.query;
548
- const responseTimeData = await service({ strapi }).makeBackendRequest(
617
+ const responseTimeData = await service({ strapi: strapi2 }).makeBackendRequest(
549
618
  `/user/monitors/${monitorId}/response-time?start=${start}&end=${end}&region=${region || "default"}`,
550
619
  {
551
620
  method: "GET"
@@ -555,7 +624,7 @@ const monitor = ({ strapi }) => ({
555
624
  },
556
625
  async getMonitorIncidents(ctx) {
557
626
  const monitorId = ctx.params.id;
558
- const incidentsData = await service({ strapi }).makeBackendRequest(
627
+ const incidentsData = await service({ strapi: strapi2 }).makeBackendRequest(
559
628
  `/user/monitors/incidents?monitorId=${monitorId}&page=1&page_size=20&time_range=7D`,
560
629
  {
561
630
  method: "GET"
@@ -565,7 +634,7 @@ const monitor = ({ strapi }) => ({
565
634
  },
566
635
  async getMonitorSettings(ctx) {
567
636
  const monitorId = ctx.params.id;
568
- const monitorSettingsData = await service({ strapi }).makeBackendRequest(
637
+ const monitorSettingsData = await service({ strapi: strapi2 }).makeBackendRequest(
569
638
  `/user/monitors/settings?id=${monitorId}`,
570
639
  {
571
640
  method: "GET"
@@ -575,7 +644,7 @@ const monitor = ({ strapi }) => ({
575
644
  },
576
645
  async createMonitor(ctx) {
577
646
  const { ...data } = ctx.request.body;
578
- const monitorsData = await service({ strapi }).makeBackendRequest(`/user/monitors`, {
647
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/monitors`, {
579
648
  method: "POST",
580
649
  body: JSON.stringify(data)
581
650
  });
@@ -584,7 +653,7 @@ const monitor = ({ strapi }) => ({
584
653
  async updateMonitor(ctx) {
585
654
  const monitorId = ctx.params.id;
586
655
  const { ...data } = ctx.request.body;
587
- const monitorsData = await service({ strapi }).makeBackendRequest(
656
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(
588
657
  `/user/monitors/${monitorId}`,
589
658
  {
590
659
  method: "PUT",
@@ -595,7 +664,7 @@ const monitor = ({ strapi }) => ({
595
664
  },
596
665
  async deleteMonitor(ctx) {
597
666
  const monitorId = ctx.params.id;
598
- const monitorsData = await service({ strapi }).makeBackendRequest(
667
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(
599
668
  `/user/monitors/${monitorId}`,
600
669
  {
601
670
  method: "DELETE"
@@ -605,7 +674,7 @@ const monitor = ({ strapi }) => ({
605
674
  },
606
675
  async deleteMonitors(ctx) {
607
676
  const { monitorIds } = ctx.request.body;
608
- const monitorsData = await service({ strapi }).makeBackendRequest(`/user/monitors`, {
677
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/monitors`, {
609
678
  method: "PATCH",
610
679
  body: JSON.stringify({ ids: monitorIds, action: "delete" })
611
680
  });
@@ -640,7 +709,7 @@ const monitor = ({ strapi }) => ({
640
709
  if (search) queryParams.set("search", search);
641
710
  if (sortBy) queryParams.set("sort_by", sortBy);
642
711
  if (sortOrder) queryParams.set("sort_order", sortOrder);
643
- const incidentsData = await service({ strapi }).makeBackendRequest(
712
+ const incidentsData = await service({ strapi: strapi2 }).makeBackendRequest(
644
713
  `/user/monitors/incidents?${queryParams.toString()}`,
645
714
  {
646
715
  method: "GET"
@@ -650,20 +719,20 @@ const monitor = ({ strapi }) => ({
650
719
  },
651
720
  async exportIncidents(ctx) {
652
721
  try {
653
- const { monitorId, region, type, start_time, end_time, search, file_type } = ctx.request.body;
722
+ const { monitorId, region, type: type2, start_time, end_time, search, file_type } = ctx.request.body;
654
723
  if (!monitorId) {
655
724
  ctx.status = 400;
656
725
  ctx.body = { error: "monitorId is required" };
657
726
  return;
658
727
  }
659
728
  const queryParams = new URLSearchParams();
660
- if (type) queryParams.set("type", type);
729
+ if (type2) queryParams.set("type", type2);
661
730
  if (start_time) queryParams.set("start_time", start_time);
662
731
  if (end_time) queryParams.set("end_time", end_time);
663
732
  if (search) queryParams.set("search", search);
664
733
  if (file_type) queryParams.set("file_type", file_type);
665
734
  if (region) queryParams.set("region", region);
666
- const response = await service({ strapi }).makeBackendRequest(
735
+ const response = await service({ strapi: strapi2 }).makeBackendRequest(
667
736
  `/user/monitors/${monitorId}/incidents/export?${queryParams.toString()}`,
668
737
  { method: "GET" }
669
738
  );
@@ -687,16 +756,16 @@ const monitor = ({ strapi }) => ({
687
756
  }
688
757
  }
689
758
  });
690
- const statusPage = ({ strapi }) => ({
759
+ const statusPage = ({ strapi: strapi2 }) => ({
691
760
  async getStatusPages(ctx) {
692
- const statusPagesData = await service({ strapi }).makeBackendRequest(`/user/status-pages`, {
761
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/status-pages`, {
693
762
  method: "GET"
694
763
  });
695
764
  ctx.body = { statusPagesData };
696
765
  },
697
766
  async getStatusPagesByID(ctx) {
698
767
  const id = ctx.params.id;
699
- const statusPagesData = await service({ strapi }).makeBackendRequest(
768
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(
700
769
  `/user/status-pages/${id}`,
701
770
  {
702
771
  method: "GET"
@@ -705,16 +774,16 @@ const statusPage = ({ strapi }) => ({
705
774
  ctx.body = { statusPagesData };
706
775
  },
707
776
  async saveStatusPages(ctx) {
708
- const { name, monitor_ids, is_published } = ctx.request.body;
709
- const statusPagesData = await service({ strapi }).makeBackendRequest(`/user/status-pages`, {
777
+ const { name: name2, monitor_ids, is_published } = ctx.request.body;
778
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/status-pages`, {
710
779
  method: "POST",
711
- body: JSON.stringify({ name, monitor_ids, is_published })
780
+ body: JSON.stringify({ name: name2, monitor_ids, is_published })
712
781
  });
713
782
  ctx.body = { statusPagesData };
714
783
  },
715
784
  async updateStatusPages(ctx) {
716
785
  const { id, ...data } = ctx.request.body;
717
- const statusPagesData = await service({ strapi }).makeBackendRequest(
786
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(
718
787
  `/user/status-pages/${id}`,
719
788
  {
720
789
  method: "PUT",
@@ -725,7 +794,7 @@ const statusPage = ({ strapi }) => ({
725
794
  },
726
795
  async resetLink(ctx) {
727
796
  const { id } = ctx.request.body;
728
- const statusPagesData = await service({ strapi }).makeBackendRequest(
797
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(
729
798
  `/user/status-pages/${id}/reset`,
730
799
  {
731
800
  method: "POST"
@@ -735,7 +804,7 @@ const statusPage = ({ strapi }) => ({
735
804
  },
736
805
  async deleteStatusPages(ctx) {
737
806
  const id = ctx.params.id;
738
- const statusPagesData = await service({ strapi }).makeBackendRequest(
807
+ const statusPagesData = await service({ strapi: strapi2 }).makeBackendRequest(
739
808
  `/user/status-pages/${id}`,
740
809
  {
741
810
  method: "DELETE"
@@ -744,17 +813,17 @@ const statusPage = ({ strapi }) => ({
744
813
  ctx.body = { statusPagesData };
745
814
  }
746
815
  });
747
- const regions = ({ strapi }) => ({
816
+ const regions = ({ strapi: strapi2 }) => ({
748
817
  async getRegions(ctx) {
749
- const regionsData = await service({ strapi }).makeBackendRequest(`/regions`, {
818
+ const regionsData = await service({ strapi: strapi2 }).makeBackendRequest(`/regions`, {
750
819
  method: "GET"
751
820
  });
752
821
  ctx.body = { regionsData };
753
822
  }
754
823
  });
755
- const userDetailsService = ({ strapi }) => ({
824
+ const userDetailsService = ({ strapi: strapi2 }) => ({
756
825
  async createUserApiToken(sessionToken) {
757
- const apiTokens = await service({ strapi }).makeBackendRequest(
826
+ const apiTokens = await service({ strapi: strapi2 }).makeBackendRequest(
758
827
  `/tokens/generate`,
759
828
  {
760
829
  method: "POST",
@@ -774,7 +843,7 @@ const userDetailsService = ({ strapi }) => ({
774
843
  return null;
775
844
  },
776
845
  async getUserApiToken(sessionToken) {
777
- const apiTokens = await service({ strapi }).makeBackendRequest(
846
+ const apiTokens = await service({ strapi: strapi2 }).makeBackendRequest(
778
847
  `/tokens`,
779
848
  {
780
849
  method: "GET"
@@ -843,7 +912,7 @@ const userDetailsService = ({ strapi }) => ({
843
912
  }
844
913
  }
845
914
  };
846
- const monitorsData = await service({ strapi }).makeBackendRequest(`/user/monitors`, {
915
+ const monitorsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/monitors`, {
847
916
  method: "POST",
848
917
  body: JSON.stringify(payload)
849
918
  }, true, apiToken);
@@ -858,9 +927,9 @@ const userDetailsService = ({ strapi }) => ({
858
927
  }
859
928
  }
860
929
  });
861
- const userDetails = ({ strapi }) => ({
930
+ const userDetails = ({ strapi: strapi2 }) => ({
862
931
  async getUserDetails(ctx) {
863
- const userDetailsData = await service({ strapi }).makeBackendRequest(`/user/details`, {
932
+ const userDetailsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/details`, {
864
933
  method: "GET"
865
934
  });
866
935
  ctx.body = { userDetailsData };
@@ -868,7 +937,7 @@ const userDetails = ({ strapi }) => ({
868
937
  async signUp(ctx) {
869
938
  try {
870
939
  const { email, password, source, site_url, fullName } = ctx.request.body;
871
- const registerData = await service({ strapi }).makeBackendRequest(
940
+ const registerData = await service({ strapi: strapi2 }).makeBackendRequest(
872
941
  `/user/register`,
873
942
  {
874
943
  method: "POST",
@@ -882,13 +951,13 @@ const userDetails = ({ strapi }) => ({
882
951
  true
883
952
  );
884
953
  if (registerData?.data?.token) {
885
- const apiToken = await userDetailsService({ strapi }).getUserApiToken(registerData?.data?.token);
886
- const monitorId = await userDetailsService({ strapi }).createInitialMonitor(site_url, apiToken);
954
+ const apiToken = await userDetailsService({ strapi: strapi2 }).getUserApiToken(registerData?.data?.token);
955
+ const monitorId = await userDetailsService({ strapi: strapi2 }).createInitialMonitor(site_url, apiToken);
887
956
  if (!apiToken || !monitorId) {
888
957
  ctx.body = { ok: false, message: "Error creating API token or Monitor" };
889
958
  return;
890
959
  }
891
- const store = service({ strapi }).settingsStore;
960
+ const store = service({ strapi: strapi2 }).settingsStore;
892
961
  const current = await store.get() || {};
893
962
  await store.set({
894
963
  value: {
@@ -908,7 +977,7 @@ const userDetails = ({ strapi }) => ({
908
977
  async signIn(ctx) {
909
978
  try {
910
979
  const { email, password } = ctx.request.body;
911
- const loginData = await service({ strapi }).makeBackendRequest(
980
+ const loginData = await service({ strapi: strapi2 }).makeBackendRequest(
912
981
  `/user/login`,
913
982
  {
914
983
  method: "POST",
@@ -920,8 +989,8 @@ const userDetails = ({ strapi }) => ({
920
989
  true
921
990
  );
922
991
  if (loginData?.data?.token) {
923
- const apiToken = await userDetailsService({ strapi }).getUserApiToken(loginData?.data?.token);
924
- const store = service({ strapi }).settingsStore;
992
+ const apiToken = await userDetailsService({ strapi: strapi2 }).getUserApiToken(loginData?.data?.token);
993
+ const store = service({ strapi: strapi2 }).settingsStore;
925
994
  const current = await store.get() || {};
926
995
  await store.set({
927
996
  value: {
@@ -940,7 +1009,7 @@ const userDetails = ({ strapi }) => ({
940
1009
  async forgotPassword(ctx) {
941
1010
  try {
942
1011
  const { email } = ctx.request.body;
943
- const forgotPasswordData = await service({ strapi }).makeBackendRequest(
1012
+ const forgotPasswordData = await service({ strapi: strapi2 }).makeBackendRequest(
944
1013
  `/user/forgot-password`,
945
1014
  {
946
1015
  method: "POST",
@@ -960,9 +1029,9 @@ const userDetails = ({ strapi }) => ({
960
1029
  }
961
1030
  }
962
1031
  });
963
- const notificationChannels = ({ strapi }) => ({
1032
+ const notificationChannels = ({ strapi: strapi2 }) => ({
964
1033
  async getNotificationChannels(ctx) {
965
- const notificationChannelsData = await service({ strapi }).makeBackendRequest(
1034
+ const notificationChannelsData = await service({ strapi: strapi2 }).makeBackendRequest(
966
1035
  `/user/integrations`,
967
1036
  {
968
1037
  method: "GET"
@@ -972,7 +1041,7 @@ const notificationChannels = ({ strapi }) => ({
972
1041
  },
973
1042
  async createNotificationChannel(ctx) {
974
1043
  const { ...data } = ctx.request.body;
975
- const notificationChannelsData = await service({ strapi }).makeBackendRequest(
1044
+ const notificationChannelsData = await service({ strapi: strapi2 }).makeBackendRequest(
976
1045
  `/user/integrations`,
977
1046
  {
978
1047
  method: "POST",
@@ -982,7 +1051,7 @@ const notificationChannels = ({ strapi }) => ({
982
1051
  ctx.body = { notificationChannelsData };
983
1052
  },
984
1053
  async getSupportedIntegrations(ctx) {
985
- const supportedIntegrationsData = await service({ strapi }).makeBackendRequest(
1054
+ const supportedIntegrationsData = await service({ strapi: strapi2 }).makeBackendRequest(
986
1055
  `/integrations/supported`,
987
1056
  {
988
1057
  method: "GET"
@@ -992,7 +1061,7 @@ const notificationChannels = ({ strapi }) => ({
992
1061
  },
993
1062
  async testNotificationChannel(ctx) {
994
1063
  const { id } = ctx.params;
995
- const testResult = await service({ strapi }).makeBackendRequest(
1064
+ const testResult = await service({ strapi: strapi2 }).makeBackendRequest(
996
1065
  `/user/integrations/${id}/test`,
997
1066
  {
998
1067
  method: "POST"
@@ -1003,7 +1072,7 @@ const notificationChannels = ({ strapi }) => ({
1003
1072
  async updateNotificationChannel(ctx) {
1004
1073
  const { id } = ctx.params;
1005
1074
  const { ...data } = ctx.request.body;
1006
- const updatedChannel = await service({ strapi }).makeBackendRequest(
1075
+ const updatedChannel = await service({ strapi: strapi2 }).makeBackendRequest(
1007
1076
  `/user/integrations/${id}`,
1008
1077
  {
1009
1078
  method: "PUT",
@@ -1014,12 +1083,65 @@ const notificationChannels = ({ strapi }) => ({
1014
1083
  },
1015
1084
  async deleteNotificationChannel(ctx) {
1016
1085
  const { id } = ctx.params;
1017
- const deleteResult = await service({ strapi }).makeBackendRequest(`/user/integrations/${id}`, {
1086
+ const deleteResult = await service({ strapi: strapi2 }).makeBackendRequest(`/user/integrations/${id}`, {
1018
1087
  method: "DELETE"
1019
1088
  });
1020
1089
  ctx.body = { deleteResult };
1021
1090
  }
1022
1091
  });
1092
+ const tags = ({ strapi: strapi2 }) => ({
1093
+ async getTags(ctx) {
1094
+ const tagsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/tags`, {
1095
+ method: "GET"
1096
+ });
1097
+ ctx.body = { tagsData };
1098
+ },
1099
+ async getTagsByID(ctx) {
1100
+ const id = ctx.params.id;
1101
+ const tagsData = await service({ strapi: strapi2 }).makeBackendRequest(
1102
+ `/user/tags/${id}`,
1103
+ {
1104
+ method: "GET"
1105
+ }
1106
+ );
1107
+ ctx.body = { tagsData };
1108
+ },
1109
+ async createTag(ctx) {
1110
+ const { name: name2, color } = ctx.request.body;
1111
+ const tagsData = await service({ strapi: strapi2 }).makeBackendRequest(`/user/tags`, {
1112
+ method: "POST",
1113
+ body: JSON.stringify({ name: name2, color })
1114
+ });
1115
+ ctx.body = { tagsData };
1116
+ },
1117
+ async updateTags(ctx) {
1118
+ const id = ctx.params.id;
1119
+ const { ...data } = ctx.request.body;
1120
+ if (!id) {
1121
+ ctx.status = 400;
1122
+ ctx.body = { error: "Tag ID is required" };
1123
+ return;
1124
+ }
1125
+ const tagsData = await service({ strapi: strapi2 }).makeBackendRequest(
1126
+ `/user/tags/${id}`,
1127
+ {
1128
+ method: "PUT",
1129
+ body: JSON.stringify(data)
1130
+ }
1131
+ );
1132
+ ctx.body = { tagsData };
1133
+ },
1134
+ async deleteTags(ctx) {
1135
+ const id = ctx.params.id;
1136
+ const tagsData = await service({ strapi: strapi2 }).makeBackendRequest(
1137
+ `/user/tags/${id}`,
1138
+ {
1139
+ method: "DELETE"
1140
+ }
1141
+ );
1142
+ ctx.body = { tagsData };
1143
+ }
1144
+ });
1023
1145
  const controllers = {
1024
1146
  controller,
1025
1147
  settings,
@@ -1027,7 +1149,8 @@ const controllers = {
1027
1149
  statusPage,
1028
1150
  regions,
1029
1151
  userDetails,
1030
- notificationChannels
1152
+ notificationChannels,
1153
+ tags
1031
1154
  };
1032
1155
  const middlewares = {};
1033
1156
  const policies = {};
@@ -1403,6 +1526,51 @@ const routes = {
1403
1526
  policies: [],
1404
1527
  auth: false
1405
1528
  }
1529
+ },
1530
+ {
1531
+ method: "GET",
1532
+ path: "/tags",
1533
+ handler: "tags.getTags",
1534
+ config: {
1535
+ policies: [],
1536
+ auth: false
1537
+ }
1538
+ },
1539
+ {
1540
+ method: "GET",
1541
+ path: "/tags/:id",
1542
+ handler: "tags.getTagsByID",
1543
+ config: {
1544
+ policies: [],
1545
+ auth: false
1546
+ }
1547
+ },
1548
+ {
1549
+ method: "POST",
1550
+ path: "/tags",
1551
+ handler: "tags.createTag",
1552
+ config: {
1553
+ policies: [],
1554
+ auth: false
1555
+ }
1556
+ },
1557
+ {
1558
+ method: "PUT",
1559
+ path: "/tags/:id",
1560
+ handler: "tags.updateTags",
1561
+ config: {
1562
+ policies: [],
1563
+ auth: false
1564
+ }
1565
+ },
1566
+ {
1567
+ method: "DELETE",
1568
+ path: "/tags/:id",
1569
+ handler: "tags.deleteTags",
1570
+ config: {
1571
+ policies: [],
1572
+ auth: false
1573
+ }
1406
1574
  }
1407
1575
  ]
1408
1576
  }